fix(delivery): replace hardcoded product URL/name maps with dynamic product cache lookup
This commit is contained in:
parent
2f199cb67a
commit
92a6929238
@ -1,4 +1,5 @@
|
||||
import { bus } from '../../lib/event-bus.js';
|
||||
import { getProduct } from '../products/cache.js';
|
||||
import { dispatchEmail } from './dispatcher.js';
|
||||
|
||||
// ── Event Bus Subscribers ────────────────────────────────────
|
||||
@ -140,21 +141,15 @@ export function registerDeliverySubscribers(
|
||||
// ── Helpers ──────────────────────────────────────────────────
|
||||
|
||||
function resolveDashboardUrl(productId: string): string {
|
||||
const urls: Record<string, string> = {
|
||||
lysnrai: process.env.LYSNRAI_DASHBOARD_URL || 'https://app.lysnrai.com',
|
||||
chronomind: process.env.CHRONOMIND_DASHBOARD_URL || 'https://chronomind.app',
|
||||
nomgap: process.env.NOMGAP_DASHBOARD_URL || 'https://nomgap.app',
|
||||
mindlyst: process.env.MINDLYST_DASHBOARD_URL || 'https://mindlyst.app',
|
||||
};
|
||||
return urls[productId] || `https://${productId}.bytelyst.com`;
|
||||
const envKey = `${productId.toUpperCase()}_DASHBOARD_URL`;
|
||||
const envUrl = process.env[envKey];
|
||||
if (envUrl) return envUrl;
|
||||
const product = getProduct(productId);
|
||||
if (product?.websiteUrl) return product.websiteUrl;
|
||||
return `https://${productId}.bytelyst.com`;
|
||||
}
|
||||
|
||||
function resolveProductName(productId: string): string {
|
||||
const names: Record<string, string> = {
|
||||
lysnrai: 'LysnrAI',
|
||||
chronomind: 'ChronoMind',
|
||||
nomgap: 'NomGap',
|
||||
mindlyst: 'MindLyst',
|
||||
};
|
||||
return names[productId] || productId;
|
||||
const product = getProduct(productId);
|
||||
return product?.displayName || productId;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user