@fayz-ai/admin 0.19.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Where the other products live, FOR THIS BUNDLE.
3
+ *
4
+ * `app.apps.url` is one column serving every environment at once. A published
5
+ * cluster has to name the published hosts, because a customer's switcher cannot
6
+ * send them to somebody's laptop — which leaves local development with no way
7
+ * back: the registry says `glow-studio.fayz.app` and the developer running the
8
+ * salon on :5301 wants `localhost:5302` for the restaurant next door.
9
+ *
10
+ * The bundle is the only thing that knows which environment it is — the same
11
+ * reason `resolveAppId()` lives here and not in a row — so the registry stays
12
+ * the default and the environment overrides it, per app id.
13
+ *
14
+ * Unset is the answer every deployed bundle wants, and what CI gets for free.
15
+ *
16
+ * VITE_APP_URLS=resto=http://localhost:5302,shop=http://localhost:5305
17
+ *
18
+ * A comma/equals list rather than JSON because it survives `.env` quoting with
19
+ * no escaping, and one variable rather than `VITE_APP_URL_<ID>` because one
20
+ * line should configure the whole fleet.
21
+ */
22
+ /**
23
+ * The parser, kept separate from the env read so it can be tested as what it
24
+ * is — a string in, a map out — rather than through a bundler's idea of
25
+ * `import.meta.env`, which a test cannot reliably reach.
26
+ *
27
+ * Malformed pairs are skipped rather than thrown: a typo in a dev convenience
28
+ * must never break the switcher, and the symptom — a tile still pointing at
29
+ * production — reads clearly enough on its own.
30
+ */
31
+ export declare function parseAppUrlOverrides(raw: string | null | undefined): Record<string, string>;
32
+ /** The same map, read from this bundle's environment. */
33
+ export declare function resolveAppUrlOverrides(): Record<string, string>;
34
+ //# sourceMappingURL=app-urls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-urls.d.ts","sourceRoot":"","sources":["../../src/directory/app-urls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAe3F;AAED,yDAAyD;AACzD,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG/D"}
@@ -12,7 +12,7 @@ interface AppDirectoryState {
12
12
  load: (tenantId: string, currentAppId: string | null, deps?: AppDirectoryDeps) => Promise<void>;
13
13
  reset: () => void;
14
14
  }
15
- export declare function normalize(apps: unknown, currentAppId: string | null): DirectoryApp[] | null;
15
+ export declare function normalize(apps: unknown, currentAppId: string | null, overrides?: Record<string, string>): DirectoryApp[] | null;
16
16
  export declare const useAppDirectoryStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppDirectoryState>>;
17
17
  /** Drop the directory on sign-out — the next user's apps are not this one's. */
18
18
  export declare function resetAppDirectory(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"directory.store.d.ts","sourceRoot":"","sources":["../../src/directory/directory.store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAoB3C,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;IAC3B,wEAAwE;IACxE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACnC,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/F,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,EAAE,GAAG,IAAI,CAiB3F;AAED,eAAO,MAAM,oBAAoB,gFA2B9B,CAAA;AAEH,gFAAgF;AAChF,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
1
+ {"version":3,"file":"directory.store.d.ts","sourceRoot":"","sources":["../../src/directory/directory.store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAoB3C,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;IAC3B,wEAAwE;IACxE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACnC,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/F,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAID,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,YAAY,EAAE,MAAM,GAAG,IAAI,EAG3B,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAA4B,GAC3D,YAAY,EAAE,GAAG,IAAI,CAoBvB;AAED,eAAO,MAAM,oBAAoB,gFA2B9B,CAAA;AAEH,gFAAgF;AAChF,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
@@ -3,5 +3,6 @@ export type { AppSwitcherViewProps } from './AppSwitcher';
3
3
  export { useAppDirectory } from './useAppDirectory';
4
4
  export { useAppDirectoryStore, resetAppDirectory } from './directory.store';
5
5
  export { resolveAppId } from './app-id';
6
+ export { resolveAppUrlOverrides, parseAppUrlOverrides } from './app-urls';
6
7
  export type { DirectoryApp } from './types';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzF,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzF,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACzE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -18094,13 +18094,33 @@ function useNavContribution(id, entries2) {
18094
18094
  return () => clearContribution(id);
18095
18095
  }, [id, key]);
18096
18096
  }
18097
+
18098
+ // src/directory/app-urls.ts
18099
+ function parseAppUrlOverrides(raw) {
18100
+ if (!raw || !raw.trim()) return {};
18101
+ const out = {};
18102
+ for (const pair of raw.split(",")) {
18103
+ const eq = pair.indexOf("=");
18104
+ if (eq < 1) continue;
18105
+ const id = pair.slice(0, eq).trim();
18106
+ const url = pair.slice(eq + 1).trim();
18107
+ if (id && url) out[id] = url;
18108
+ }
18109
+ return out;
18110
+ }
18111
+ function resolveAppUrlOverrides() {
18112
+ const env2 = import.meta.env;
18113
+ return parseAppUrlOverrides(env2?.VITE_APP_URLS ?? env2?.PUBLIC_APP_URLS);
18114
+ }
18115
+
18116
+ // src/directory/directory.store.ts
18097
18117
  var HEX = /^#[0-9a-fA-F]{6}$/;
18098
- function normalize(apps, currentAppId) {
18118
+ function normalize(apps, currentAppId, overrides = resolveAppUrlOverrides()) {
18099
18119
  if (!Array.isArray(apps)) return null;
18100
18120
  return apps.filter((app) => Boolean(app && typeof app.id === "string" && typeof app.name === "string")).filter((app) => typeof app.url === "string" && app.url.length > 0).map((app) => ({
18101
18121
  id: app.id,
18102
18122
  name: app.name,
18103
- url: app.url,
18123
+ url: overrides[app.id] ?? app.url,
18104
18124
  current: app.id === currentAppId,
18105
18125
  icon: app.icon ?? null,
18106
18126
  iconUrl: null,