UNPKG

@hhgtech/hhg-components

Version:
28 lines (26 loc) 1.35 kB
var _a; const getDomain = (link) => { var _a, _b; return (_b = (_a = link === null || link === void 0 ? void 0 : link.match(/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : ''; }; const currentDomain = typeof window !== 'undefined' ? getDomain((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) : ''; const domainSlugs = currentDomain.split('.'); const isProduction = process.env.NEXT_PUBLIC_DEPLOY_ENV ? process.env.NEXT_PUBLIC_DEPLOY_ENV === 'production' : domainSlugs && !(domainSlugs[0] === 'dev' || domainSlugs[1] === 'dev' || domainSlugs[0] === 'staging' || domainSlugs[0] === 'staging-id' || domainSlugs[0] === 'staging-id-hotfix' || domainSlugs[0].split(':')[0] === 'localhost' || domainSlugs[1] === 'staging' || // marrybaby staging domainSlugs[0] === 'fe' || // marrybaby staging-hotfix domainSlugs[0] === 'fe-hotfix' || // discover/care/together staging domainSlugs[0] === 'discover' || // discover/care/together staging-hotfix domainSlugs[0] === 'discover-hotfix'); export { isProduction };