Files
dashboards/apps/customer/src/lib/config.ts
T
Alireza HassaniandCursor f566387c61 Initial commit: Meshkee dashboards monorepo.
Includes business, customer, and super-admin apps with shared packages and production deploy scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 13:48:53 +03:30

34 lines
1.0 KiB
TypeScript

import {
CUSTOMER_SUBDOMAIN_PREFIX,
getBaseDomainFromHost,
getCustomerDashboardHost,
isCustomerDashboardHost,
} from '@meshkee/dashboard-core'
export { CUSTOMER_SUBDOMAIN_PREFIX }
/** Base tenant domain without customer. prefix (e.g. sanihome.ir). */
export function getBaseBusinessDomain(hostname = window.location.hostname): string {
return getBaseDomainFromHost(hostname, import.meta.env.VITE_BUSINESS_DOMAIN)
}
/** Expected customer dashboard host (e.g. customer.sanihome.ir). */
export function getCustomerDashboardHostForApp(baseDomain?: string): string {
return getCustomerDashboardHost(baseDomain ?? getBaseBusinessDomain())
}
export function isAllowedCustomerHost(hostname = window.location.hostname): boolean {
const host = hostname.toLowerCase().trim()
if (host === 'localhost' || host === '127.0.0.1') {
return true
}
return isCustomerDashboardHost(host)
}
/** Domain sent to tenant resolution and customer registration APIs. */
export function getTenantDomain(): string {
return getBaseBusinessDomain()
}