mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-12 06:40:57 +04:30
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>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user