PageSourceSearch

https://smrtbld.ai/js/config.js

js smrtbld.ai collected 2026-10-05 15:06:56 UTC 2,775 bytes, 58 lines download raw bytes

1/**
2 * smrtBuild - App Configuration
3 *
4 * Run `npm run setup` to customize these values for your new app.
5 * Or manually update:
6 * - appName: Your app name (e.g., 'smrtBids', 'smrtTime')
7 * - apiPrefix: API endpoint prefix (e.g., 'smrtbids', 'smrttime')
8 * - apiKey: Your app's API key
9 * - themeColor: Your brand color
10 * - tokenKey/userKey/companyKey: Storage keys
11 */
12
13// Host-based environment detection. The web picks its API from the browser's
14// hostname, so it's inherently swap-safe — the running host decides which API,
15// with no sticky server config that a slot swap could carry to the wrong place.
16const hostname = window.location.hostname;
17// Inside the native shell (smrtBuild.Mobile), www/env.js sets window.__SMRT_ENV__ before any
18// module loads and WINS — Capacitor's hostname is literally "localhost", so the hostname test
19// must never decide anything there (MOB-001, smrt.NativeCore/BRIDGE-CONTRACT.md §1).
20const shellEnv = window.__SMRT_ENV__?.env;
21const isLocal = shellEnv ? shellEnv === 'development' : hostname === 'localhost';
22// staging.smrtbld.ai (and any <tenant>.staging.smrtbld.ai) → the API staging slot.
23const isStaging = shellEnv
24    ? shellEnv === 'staging'
25    : (hostname === 'staging.smrtbld.ai' || hostname.endsWith('.staging.smrtbld.ai'));
26
27export const config = {
28    // API settings — local → localhost, staging host → staging API slot, else prod.
29    apiBaseUrl: window.__SMRT_ENV__?.apiBaseUrl ?? (isLocal
30        ? 'https://localhost:7001/api'
31        : isStaging
32            ? 'https://staging-api.smrtbld.app/api'
33            : 'https://api.smrtbld.app/api'),
34    apiPrefix: 'smrtbuild',  // API endpoint prefix (e.g., 'smrtbuild/auth/login')
35    apiKey: 'smartbuild_a2PvRTQp4hwhkpRyIZGfcGqkXIl6a3rgfcCtCuzY6dpXJGDdXJACdDaUEelWT6zc',
36
37    // Tenant subdomain detection — root domains this app can be served from.
38    // Used by utils/tenant.js. ORDER MATTERS: getTenantPrefix() returns on the FIRST entry the
39    // host matches as that domain or a real subdomain of it (CA-088's dot guard: a bare
40    // endsWith() no longer matches), so the more-specific 'staging.smrtbld.ai' MUST come before
41    // 'smrtbld.ai' — otherwise 'staging.smrtbld.ai' resolves to a tenant named "staging".
42    rootDomains: ['staging.smrtbld.ai', 'smrtbld.ai', 'smrtbld.app'],
43
44    // App identity
45    appName: 'smrtBuild',
46    appVersion: '1.0.0',
47    env: shellEnv ?? (isLocal ? 'development' : 'production'),
48    // 'ios' | 'android' inside the native shell; undefined on the plain web (MOB-001).
49    platform: window.__SMRT_ENV__?.platform,
50    themeColor: '#006998',
51
52    // Storage keys
53    tokenKey: 'sb_build_token',
54    userKey: 'sb_build_user',
55    companyKey: 'sb_build_company',
56
57    async load() { return this; }
58};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.