@fayz-ai/saas 0.6.6 → 0.8.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.
- package/README.md +3 -1
- package/dist/app/admin-app.d.ts.map +1 -1
- package/dist/archetype-lookup.d.ts +1 -1
- package/dist/archetype-lookup.d.ts.map +1 -1
- package/dist/{chunk-DCRT47W4.js → chunk-3M25GRRU.js} +6 -10
- package/dist/chunk-3M25GRRU.js.map +1 -0
- package/dist/{chunk-SRIUD35R.cjs → chunk-IPWCHJPE.cjs} +5 -11
- package/dist/chunk-IPWCHJPE.cjs.map +1 -0
- package/dist/hooks/useModuleNavigation.d.ts.map +1 -1
- package/dist/index.cjs +76 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -23
- package/dist/index.js.map +1 -1
- package/dist/lib/schedule-service.d.ts.map +1 -1
- package/dist/org/adapters/supabase.d.ts +9 -1
- package/dist/org/adapters/supabase.d.ts.map +1 -1
- package/dist/org/index.cjs +10 -10
- package/dist/org/index.js +1 -1
- package/dist/shell/components/settings/ConnectedUserProfile.d.ts.map +1 -1
- package/dist/shell/components/settings/LocationsCrudPage.d.ts.map +1 -1
- package/dist/shell/hooks/useModuleNavigation.d.ts.map +1 -1
- package/dist/shell/lib/create-client-orders-provider.d.ts.map +1 -1
- package/dist/shell/lib/supabase.d.ts +2 -1
- package/dist/shell/lib/supabase.d.ts.map +1 -1
- package/dist/shell/types/crud.d.ts +1 -1
- package/dist/shell/types/crud.d.ts.map +1 -1
- package/dist/supabase/client.d.ts +0 -4
- package/dist/supabase/client.d.ts.map +1 -1
- package/package.json +13 -7
- package/src/app/admin-app.tsx +9 -1
- package/src/archetype-lookup.ts +2 -5
- package/src/crud/archetypes/PersonPicker.tsx +6 -6
- package/src/crud/archetypes/SubjectDetailTabs.tsx +2 -2
- package/src/env.d.ts +15 -0
- package/src/hooks/useModuleNavigation.ts +7 -1
- package/src/index.ts +0 -2
- package/src/lib/schedule-service.ts +2 -1
- package/src/org/adapters/supabase.ts +15 -5
- package/src/shell/components/settings/ConnectedUserProfile.tsx +3 -6
- package/src/shell/components/settings/LocationsCrudPage.ts +0 -1
- package/src/shell/hooks/useModuleNavigation.ts +7 -1
- package/src/shell/lib/create-client-orders-provider.ts +2 -4
- package/src/shell/lib/org-adapters/supabase.ts +3 -3
- package/src/shell/lib/supabase.ts +5 -3
- package/src/shell/stores/theme.store.ts +1 -1
- package/src/shell/types/crud.ts +1 -1
- package/src/supabase/client.ts +0 -8
- package/dist/chunk-DCRT47W4.js.map +0 -1
- package/dist/chunk-SRIUD35R.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-service.d.ts","sourceRoot":"","sources":["../../src/lib/schedule-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedule-service.d.ts","sourceRoot":"","sources":["../../src/lib/schedule-service.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA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,aAAa,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,EACrH,IAAI,SAAkB,GACrB,OAAO,CAAC,IAAI,CAAC,CAuCf;AAgBD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE;IACzC,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,WAAW,GAAG,aAAa,CAAA;IACjC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,aAAa,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,OAAO,CAAC,IAAI,CAAC,CAgEhB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,IAAI,SAAkB,GACrB,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -11,7 +11,7 @@ export interface RoleIdentity {
|
|
|
11
11
|
isSystem?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export interface SupabaseOrgAdapterConfig {
|
|
14
|
-
/**
|
|
14
|
+
/** Deprecated — core tables now live in the public schema; this field is ignored. */
|
|
15
15
|
coreSchema?: string;
|
|
16
16
|
/** Business roles the host app declares (config.permissions.defaultProfiles).
|
|
17
17
|
* Falls back to the generic five when omitted. */
|
|
@@ -20,6 +20,14 @@ export interface SupabaseOrgAdapterConfig {
|
|
|
20
20
|
* auth user) — the org adapter only records the audit row. Injected by the app;
|
|
21
21
|
* when omitted, invites are recorded but not delivered. */
|
|
22
22
|
authAdapter?: AuthAdapter;
|
|
23
|
+
/** Canonical, deployment-fixed origin baked into invite/magic-link redirects
|
|
24
|
+
* (e.g. https://beauty-saas.live.fayz.ai). The container injects it as
|
|
25
|
+
* VITE_APP_URL; the app wiring passes it here. Falls back to
|
|
26
|
+
* window.location.origin, which is wrong when an admin invites from a preview
|
|
27
|
+
* or localhost origin. Note: whatever origin ends up here must ALSO be in the
|
|
28
|
+
* Supabase project's Redirect URLs allow-list, or Supabase silently swaps it
|
|
29
|
+
* for its Site URL (default http://localhost:3000). */
|
|
30
|
+
siteUrl?: string;
|
|
23
31
|
}
|
|
24
32
|
export declare function createSupabaseOrgAdapter(config?: SupabaseOrgAdapterConfig): OrgAdapter;
|
|
25
33
|
//# sourceMappingURL=supabase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../../src/org/adapters/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAOX,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAuC,WAAW,EAAE,MAAM,eAAe,CAAA;AAiGrF;iFACiF;AACjF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;kFAC8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA+HD,MAAM,WAAW,wBAAwB;IACvC,
|
|
1
|
+
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../../src/org/adapters/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAOX,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAuC,WAAW,EAAE,MAAM,eAAe,CAAA;AAiGrF;iFACiF;AACjF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;kFAC8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA+HD,MAAM,WAAW,wBAAwB;IACvC,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;uDACmD;IACnD,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;IACtB;;gEAE4D;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;;;;4DAMwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,UAAU,CAoZtF"}
|
package/dist/org/index.cjs
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIPWCHJPE_cjs = require('../chunk-IPWCHJPE.cjs');
|
|
4
4
|
require('../chunk-4XTQ4V5L.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "OrgProvider", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkIPWCHJPE_cjs.OrgProvider; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "createMockOrgAdapter", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkIPWCHJPE_cjs.createMockOrgAdapter; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "createSupabaseOrgAdapter", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkIPWCHJPE_cjs.createSupabaseOrgAdapter; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "getPersistedOrgId", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkIPWCHJPE_cjs.getPersistedOrgId; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "useOrgAdapter", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkIPWCHJPE_cjs.useOrgAdapter; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "useOrgAdapterOptional", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkIPWCHJPE_cjs.useOrgAdapterOptional; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "useOrganizationStore", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkIPWCHJPE_cjs.useOrganizationStore; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "useTenant", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkIPWCHJPE_cjs.useTenant; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "useTenantOptional", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkIPWCHJPE_cjs.useTenantOptional; }
|
|
43
43
|
});
|
|
44
44
|
//# sourceMappingURL=index.cjs.map
|
|
45
45
|
//# sourceMappingURL=index.cjs.map
|
package/dist/org/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { OrgProvider, createMockOrgAdapter, createSupabaseOrgAdapter, getPersistedOrgId, useOrgAdapter, useOrgAdapterOptional, useOrganizationStore, useTenant, useTenantOptional } from '../chunk-
|
|
1
|
+
export { OrgProvider, createMockOrgAdapter, createSupabaseOrgAdapter, getPersistedOrgId, useOrgAdapter, useOrgAdapterOptional, useOrganizationStore, useTenant, useTenantOptional } from '../chunk-3M25GRRU.js';
|
|
2
2
|
import '../chunk-XNWCGJYH.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedUserProfile.d.ts","sourceRoot":"","sources":["../../../../src/shell/components/settings/ConnectedUserProfile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ConnectedUserProfile.d.ts","sourceRoot":"","sources":["../../../../src/shell/components/settings/ConnectedUserProfile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,wBAAgB,oBAAoB,sBAgFnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationsCrudPage.d.ts","sourceRoot":"","sources":["../../../../src/shell/components/settings/LocationsCrudPage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"LocationsCrudPage.d.ts","sourceRoot":"","sources":["../../../../src/shell/components/settings/LocationsCrudPage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,eAAO,MAAM,iBAAiB,EAAE,SA2B/B,CAAA;AAED,eAAO,MAAM,iBAAiB;;CAAoC,CAEjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModuleNavigation.d.ts","sourceRoot":"","sources":["../../../src/shell/hooks/useModuleNavigation.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,CAAA;AAE7C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAW7C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,SAAY;;;;
|
|
1
|
+
{"version":3,"file":"useModuleNavigation.d.ts","sourceRoot":"","sources":["../../../src/shell/hooks/useModuleNavigation.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,CAAA;AAE7C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAW7C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,SAAY;;;;yBAmFrD,MAAM,SAAS,MAAM;;0BA8BpB,MAAM;EAWhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-client-orders-provider.d.ts","sourceRoot":"","sources":["../../../src/shell/lib/create-client-orders-provider.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAA0D,MAAM,wBAAwB,CAAA;AAgC1H,wBAAgB,0BAA0B,IAAI,oBAAoB,
|
|
1
|
+
{"version":3,"file":"create-client-orders-provider.d.ts","sourceRoot":"","sources":["../../../src/shell/lib/create-client-orders-provider.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAA0D,MAAM,wBAAwB,CAAA;AAgC1H,wBAAgB,0BAA0B,IAAI,oBAAoB,CAgEjE"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
2
2
|
export { createSupabaseProvider, setGlobalSupabaseClient } from '@fayz-ai/core';
|
|
3
3
|
export declare const getSupabaseClientOptional: () => SupabaseClient | null;
|
|
4
|
-
export {
|
|
4
|
+
export { getFayzSupabaseClient as getSupabaseClient, getFayzSupabaseClientOptional as getSupabaseClientSafe, createFayzSupabaseClient as createSupabaseClient, } from '../../supabase/client';
|
|
5
5
|
import { getFayzSupabaseClient } from '../../supabase/client';
|
|
6
|
+
export declare const getCoreClient: typeof getFayzSupabaseClient;
|
|
6
7
|
export declare const getCoreSupabaseClient: typeof getFayzSupabaseClient;
|
|
7
8
|
export declare const getProjectSupabaseClient: typeof getFayzSupabaseClient;
|
|
8
9
|
export type { SupabaseClient };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../../src/shell/lib/supabase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../../src/shell/lib/supabase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAI/E,eAAO,MAAM,yBAAyB,QAAO,cAAc,GAAG,IACf,CAAA;AAC/C,OAAO,EACL,qBAAqB,IAAI,iBAAiB,EAC1C,6BAA6B,IAAI,qBAAqB,EACtD,wBAAwB,IAAI,oBAAoB,GACjD,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAG7D,eAAO,MAAM,aAAa,8BAAwB,CAAA;AAClD,eAAO,MAAM,qBAAqB,8BAAwB,CAAA;AAC1D,eAAO,MAAM,wBAAwB,8BAAwB,CAAA;AAC7D,YAAY,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -98,7 +98,7 @@ export interface EntityDef<T = Record<string, any>> {
|
|
|
98
98
|
searchColumns?: string[];
|
|
99
99
|
selectColumns?: string;
|
|
100
100
|
columnMap?: Record<string, string>;
|
|
101
|
-
/** Which
|
|
101
|
+
/** Which public-schema archetype this entity extends (requires a project extension table) */
|
|
102
102
|
archetype?: EntityArchetype;
|
|
103
103
|
/** The `kind` discriminator value for the archetype table */
|
|
104
104
|
archetypeKind?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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AAC,CAAA;QAChC,sDAAsD;QACtD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAClC,oEAAoE;QACpE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,CAAA;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;mFAC+E;IAC/E,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAChD;AAMD,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AAEhE,yFAAyF;AACzF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
-
/** Schema name for core platform tables */
|
|
3
|
-
export declare const CORE_SCHEMA = "saas_core";
|
|
4
2
|
/**
|
|
5
3
|
* Create (and cache) the Supabase client for the Fayz app.
|
|
6
4
|
* Also registers it as the global client in @fayz-ai/core so data providers
|
|
@@ -13,6 +11,4 @@ export declare function createFayzSupabaseClient(url: string, anonKey: string):
|
|
|
13
11
|
export declare function getFayzSupabaseClient(): SupabaseClient;
|
|
14
12
|
/** Safe getter — returns null if not initialised (mock/offline mode) */
|
|
15
13
|
export declare function getFayzSupabaseClientOptional(): SupabaseClient | null;
|
|
16
|
-
/** Get a client scoped to the core platform schema */
|
|
17
|
-
export declare function getCoreSchemaClient(): ReturnType<SupabaseClient['schema']>;
|
|
18
14
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/supabase/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/supabase/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAKzE;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAkBrF;AAED,wDAAwD;AACxD,wBAAgB,qBAAqB,IAAI,cAAc,CAOtD;AAED,wEAAwE;AACxE,wBAAgB,6BAA6B,IAAI,cAAc,GAAG,IAAI,CAErE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fayz-ai/saas",
|
|
3
|
-
"
|
|
3
|
+
"fayz": {
|
|
4
|
+
"status": "beta"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.8.0",
|
|
4
7
|
"description": "Fayz SDK SaaS layer — multi-tenancy, billing, permissions, org management",
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "./dist/index.cjs",
|
|
@@ -59,12 +62,12 @@
|
|
|
59
62
|
"@tanstack/react-table": "^8.20.0",
|
|
60
63
|
"cmdk": "^1.0.0",
|
|
61
64
|
"@radix-ui/react-dialog": "^1.1.0",
|
|
62
|
-
"@fayz-ai/sdk": "^0.
|
|
63
|
-
"@fayz-ai/core": "^0.
|
|
64
|
-
"@fayz-ai/auth": "^0.
|
|
65
|
-
"@fayz-ai/plugin-auth": "^0.
|
|
66
|
-
"@fayz-ai/ui": "^0.
|
|
67
|
-
"@fayz-ai/db": "^0.
|
|
65
|
+
"@fayz-ai/sdk": "^0.8.0",
|
|
66
|
+
"@fayz-ai/core": "^0.8.0",
|
|
67
|
+
"@fayz-ai/auth": "^0.8.0",
|
|
68
|
+
"@fayz-ai/plugin-auth": "^0.8.0",
|
|
69
|
+
"@fayz-ai/ui": "^0.8.0",
|
|
70
|
+
"@fayz-ai/db": "^0.8.0"
|
|
68
71
|
},
|
|
69
72
|
"devDependencies": {
|
|
70
73
|
"@types/react": "^18.3.0",
|
|
@@ -75,6 +78,9 @@
|
|
|
75
78
|
"tailwindcss": "^3.4.0"
|
|
76
79
|
},
|
|
77
80
|
"license": "MIT",
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public"
|
|
83
|
+
},
|
|
78
84
|
"scripts": {
|
|
79
85
|
"build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
|
|
80
86
|
"dev": "tsup --watch",
|
package/src/app/admin-app.tsx
CHANGED
|
@@ -117,7 +117,15 @@ function resolveOrgAdapter(config: FayzAppConfig, authAdapter?: AuthAdapter): Or
|
|
|
117
117
|
}))
|
|
118
118
|
// Inject the resolved auth adapter so the org adapter can DELIVER invites (send
|
|
119
119
|
// the e-mail + create the auth user) — org owns the audit row + role, auth owns delivery.
|
|
120
|
-
|
|
120
|
+
// siteUrl is the deployment-fixed origin the container injects as VITE_APP_URL, so
|
|
121
|
+
// invite links point at the real host instead of the admin's current window origin
|
|
122
|
+
// (which is a preview/localhost URL during dev). Must also be allow-listed in Supabase.
|
|
123
|
+
if (strategy === 'supabase')
|
|
124
|
+
return createSupabaseOrgAdapter({
|
|
125
|
+
roles: declaredRoles,
|
|
126
|
+
authAdapter,
|
|
127
|
+
siteUrl: import.meta.env.VITE_APP_URL,
|
|
128
|
+
})
|
|
121
129
|
return createMockOrgAdapter(config.permissions?.defaultProfiles)
|
|
122
130
|
}
|
|
123
131
|
|
package/src/archetype-lookup.ts
CHANGED
|
@@ -35,7 +35,7 @@ const ARCHETYPE_DISPLAY: Record<ArchetypeType, {
|
|
|
35
35
|
priceField?: string
|
|
36
36
|
groupField?: string
|
|
37
37
|
}> = {
|
|
38
|
-
person: { table: '
|
|
38
|
+
person: { table: 'people', labelField: 'name', subtitleFields: ['phone'], groupField: 'kind' },
|
|
39
39
|
product: { table: 'products', labelField: 'name', subtitleFields: ['sku', 'description'], priceField: 'price' },
|
|
40
40
|
service: { table: 'services', labelField: 'name', subtitleFields: ['duration_minutes', 'description'], priceField: 'price' },
|
|
41
41
|
location: { table: 'locations', labelField: 'name', subtitleFields: ['city', 'address'], groupField: 'kind' },
|
|
@@ -80,7 +80,7 @@ function toResult(
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* Create an EntityLookup that queries a
|
|
83
|
+
* Create an EntityLookup that queries a core archetype table via Supabase.
|
|
84
84
|
* Returns empty results if Supabase is not configured.
|
|
85
85
|
*/
|
|
86
86
|
export function createArchetypeLookup(config: ArchetypeLookupConfig): EntityLookup {
|
|
@@ -105,7 +105,6 @@ export function createArchetypeLookup(config: ArchetypeLookupConfig): EntityLook
|
|
|
105
105
|
if (!supabase) return []
|
|
106
106
|
|
|
107
107
|
let qb = supabase
|
|
108
|
-
.schema('saas_core')
|
|
109
108
|
.from(display.table)
|
|
110
109
|
.select('*')
|
|
111
110
|
.eq('is_active', true)
|
|
@@ -126,7 +125,6 @@ export function createArchetypeLookup(config: ArchetypeLookupConfig): EntityLook
|
|
|
126
125
|
if (!supabase) return []
|
|
127
126
|
|
|
128
127
|
let qb = supabase
|
|
129
|
-
.schema('saas_core')
|
|
130
128
|
.from(display.table)
|
|
131
129
|
.select('*')
|
|
132
130
|
.eq('is_active', true)
|
|
@@ -146,7 +144,6 @@ export function createArchetypeLookup(config: ArchetypeLookupConfig): EntityLook
|
|
|
146
144
|
if (!supabase) return null
|
|
147
145
|
|
|
148
146
|
const { data } = await supabase
|
|
149
|
-
.schema('saas_core')
|
|
150
147
|
.from(display.table)
|
|
151
148
|
.select('*')
|
|
152
149
|
.eq('id', id)
|
|
@@ -52,8 +52,8 @@ export function PersonPicker({
|
|
|
52
52
|
if (value && !selected) {
|
|
53
53
|
const supabase = getSupabaseClientOptional() as any
|
|
54
54
|
if (!supabase) return
|
|
55
|
-
supabase
|
|
56
|
-
.from('
|
|
55
|
+
supabase
|
|
56
|
+
.from('people')
|
|
57
57
|
.select('id, name, email, phone, kind')
|
|
58
58
|
.eq('id', value)
|
|
59
59
|
.single()
|
|
@@ -81,8 +81,8 @@ export function PersonPicker({
|
|
|
81
81
|
try {
|
|
82
82
|
const supabase = getSupabaseClientOptional() as any
|
|
83
83
|
if (!supabase) return
|
|
84
|
-
const { data } = await supabase
|
|
85
|
-
.from('
|
|
84
|
+
const { data } = await supabase
|
|
85
|
+
.from('people')
|
|
86
86
|
.select('id, name, email, phone, kind')
|
|
87
87
|
.eq('tenant_id', tenantId)
|
|
88
88
|
.ilike('name', `%${term}%`)
|
|
@@ -123,8 +123,8 @@ export function PersonPicker({
|
|
|
123
123
|
try {
|
|
124
124
|
const supabase = getSupabaseClientOptional() as any
|
|
125
125
|
if (!supabase) return
|
|
126
|
-
const { data, error } = await supabase
|
|
127
|
-
.from('
|
|
126
|
+
const { data, error } = await supabase
|
|
127
|
+
.from('people')
|
|
128
128
|
.insert({
|
|
129
129
|
tenant_id: tenantId,
|
|
130
130
|
kind: personKind,
|
|
@@ -34,8 +34,8 @@ export function OwnerTab({ item }: { item: any }) {
|
|
|
34
34
|
const supabase = getSupabaseClientOptional() as any
|
|
35
35
|
if (!supabase) { setLoading(false); return }
|
|
36
36
|
|
|
37
|
-
supabase
|
|
38
|
-
.from('
|
|
37
|
+
supabase
|
|
38
|
+
.from('people')
|
|
39
39
|
.select('*')
|
|
40
40
|
.eq('id', tutorId)
|
|
41
41
|
.single()
|
package/src/env.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient typing for the Vite-injected env this package reads. The apps that
|
|
3
|
+
* consume @fayz-ai/saas build with Vite (envPrefix VITE_/PUBLIC_), which inlines
|
|
4
|
+
* import.meta.env.* at build time. This package doesn't depend on vite/client,
|
|
5
|
+
* so we declare only the keys we actually touch here.
|
|
6
|
+
*/
|
|
7
|
+
interface ImportMetaEnv {
|
|
8
|
+
/** Deployment-fixed canonical origin (e.g. https://beauty-saas.live.fayz.ai),
|
|
9
|
+
* injected by the container. Used to build invite/magic-link redirects. */
|
|
10
|
+
readonly VITE_APP_URL?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ImportMeta {
|
|
14
|
+
readonly env: ImportMetaEnv
|
|
15
|
+
}
|
|
@@ -44,13 +44,19 @@ export function useModuleNavigation(hashBase: string, depthMap?: DepthMap, homeV
|
|
|
44
44
|
// '/inventory/dashboard' → treat as home view
|
|
45
45
|
if (segments.length === 1 && segments[0] === homeView) return homeView
|
|
46
46
|
// Detect action + ID patterns: '/products/edit/uuid' or '/stock/detail/uuid'
|
|
47
|
-
const ACTION_KEYWORDS = ['edit', 'detail', 'view']
|
|
47
|
+
const ACTION_KEYWORDS = ['edit', 'detail', 'view', 'post']
|
|
48
48
|
if (segments.length >= 3) {
|
|
49
49
|
const maybeAction = segments[segments.length - 2]
|
|
50
50
|
if (ACTION_KEYWORDS.includes(maybeAction)) {
|
|
51
51
|
return segments.slice(0, -2).join('-') + '-' + maybeAction + ':' + segments[segments.length - 1]
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
// Generic fallback: a trailing UUID is always an ID for the view formed
|
|
55
|
+
// by the preceding segments ('/content/post/<uuid>' → 'content-post:<uuid>')
|
|
56
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
|
57
|
+
if (segments.length >= 2 && UUID_RE.test(segments[segments.length - 1])) {
|
|
58
|
+
return segments.slice(0, -1).join('-') + ':' + segments[segments.length - 1]
|
|
59
|
+
}
|
|
54
60
|
return segments.join('-')
|
|
55
61
|
}
|
|
56
62
|
return homeView
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Works outside the agenda plugin context — uses Supabase directly.
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Core tables now live in the public schema — use the plain client directly.
|
|
7
|
+
import { getFayzSupabaseClient as getCoreClient } from '../supabase/client'
|
|
7
8
|
import { useOrganizationStore } from '../org'
|
|
8
9
|
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
Invite,
|
|
9
9
|
} from '@fayz-ai/core'
|
|
10
10
|
import type { PermissionProfile, SystemPermission, AuthAdapter } from '@fayz-ai/core'
|
|
11
|
-
import { getFayzSupabaseClient
|
|
11
|
+
import { getFayzSupabaseClient } from '../../supabase/client'
|
|
12
12
|
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
// Request dedup — prevents duplicate in-flight requests (React StrictMode etc.)
|
|
@@ -241,7 +241,7 @@ function buildPermissionProfiles(
|
|
|
241
241
|
// ---------------------------------------------------------------------------
|
|
242
242
|
|
|
243
243
|
export interface SupabaseOrgAdapterConfig {
|
|
244
|
-
/**
|
|
244
|
+
/** Deprecated — core tables now live in the public schema; this field is ignored. */
|
|
245
245
|
coreSchema?: string
|
|
246
246
|
/** Business roles the host app declares (config.permissions.defaultProfiles).
|
|
247
247
|
* Falls back to the generic five when omitted. */
|
|
@@ -250,20 +250,30 @@ export interface SupabaseOrgAdapterConfig {
|
|
|
250
250
|
* auth user) — the org adapter only records the audit row. Injected by the app;
|
|
251
251
|
* when omitted, invites are recorded but not delivered. */
|
|
252
252
|
authAdapter?: AuthAdapter
|
|
253
|
+
/** Canonical, deployment-fixed origin baked into invite/magic-link redirects
|
|
254
|
+
* (e.g. https://beauty-saas.live.fayz.ai). The container injects it as
|
|
255
|
+
* VITE_APP_URL; the app wiring passes it here. Falls back to
|
|
256
|
+
* window.location.origin, which is wrong when an admin invites from a preview
|
|
257
|
+
* or localhost origin. Note: whatever origin ends up here must ALSO be in the
|
|
258
|
+
* Supabase project's Redirect URLs allow-list, or Supabase silently swaps it
|
|
259
|
+
* for its Site URL (default http://localhost:3000). */
|
|
260
|
+
siteUrl?: string
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
export function createSupabaseOrgAdapter(config?: SupabaseOrgAdapterConfig): OrgAdapter {
|
|
256
|
-
const schema = config?.coreSchema ?? CORE_SCHEMA
|
|
257
264
|
const roles: RoleIdentity[] = config?.roles && config.roles.length > 0 ? config.roles : DEFAULT_ROLES
|
|
258
265
|
const authAdapter = config?.authAdapter
|
|
259
|
-
const
|
|
266
|
+
const originBase =
|
|
267
|
+
config?.siteUrl?.replace(/\/+$/, '') ??
|
|
268
|
+
(typeof window !== 'undefined' ? window.location.origin : undefined)
|
|
269
|
+
const inviteRedirectTo = originBase ? `${originBase}/` : undefined
|
|
260
270
|
|
|
261
271
|
function supabase() {
|
|
262
272
|
return getFayzSupabaseClient()
|
|
263
273
|
}
|
|
264
274
|
|
|
265
275
|
function core() {
|
|
266
|
-
return supabase()
|
|
276
|
+
return supabase()
|
|
267
277
|
}
|
|
268
278
|
|
|
269
279
|
return {
|
|
@@ -3,7 +3,7 @@ import { UserProfile } from './UserProfile'
|
|
|
3
3
|
// The signed-in user lives in @fayz-ai/auth's store (the one AuthProvider fills) —
|
|
4
4
|
// the shell stores/auth.store is a separate, unpopulated store.
|
|
5
5
|
import { useAuthStore } from '@fayz-ai/auth'
|
|
6
|
-
import { getSupabaseClient, getSupabaseClientSafe
|
|
6
|
+
import { getSupabaseClient, getSupabaseClientSafe } from '../../lib/supabase'
|
|
7
7
|
import { toast } from '../notifications/ToastProvider'
|
|
8
8
|
|
|
9
9
|
interface ProfileRow {
|
|
@@ -13,8 +13,8 @@ interface ProfileRow {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// The "/me" surface: the current user's canonical profile = the auth user (id,
|
|
16
|
-
// e-mail) merged with their
|
|
17
|
-
// to
|
|
16
|
+
// e-mail) merged with their profiles row (name, avatar). Reads/writes go
|
|
17
|
+
// to public.profiles (RLS: id = auth.uid(), so a user only ever sees/edits their
|
|
18
18
|
// own), and keep the auth-user metadata in sync so both stay coherent.
|
|
19
19
|
export function ConnectedUserProfile() {
|
|
20
20
|
const user = useAuthStore((s) => s.user)
|
|
@@ -27,7 +27,6 @@ export function ConnectedUserProfile() {
|
|
|
27
27
|
if (!user || !supabase) return // mock/no-backend: just use the auth-store user
|
|
28
28
|
let cancelled = false
|
|
29
29
|
void supabase
|
|
30
|
-
.schema(CORE_SCHEMA)
|
|
31
30
|
.from('profiles')
|
|
32
31
|
.select('full_name, avatar_url, email')
|
|
33
32
|
.eq('id', user.id)
|
|
@@ -46,7 +45,6 @@ export function ConnectedUserProfile() {
|
|
|
46
45
|
const supabase = getSupabaseClient()
|
|
47
46
|
// Upsert the canonical row (INSERT if the profile doesn't exist yet).
|
|
48
47
|
const { error: profileError } = await supabase
|
|
49
|
-
.schema(CORE_SCHEMA)
|
|
50
48
|
.from('profiles')
|
|
51
49
|
.upsert({ id: user.id, full_name: data.fullName, email: user.email }, { onConflict: 'id' })
|
|
52
50
|
if (profileError) throw profileError
|
|
@@ -79,7 +77,6 @@ export function ConnectedUserProfile() {
|
|
|
79
77
|
const avatarUrl = urlData.publicUrl
|
|
80
78
|
|
|
81
79
|
const { error: profileError } = await supabase
|
|
82
|
-
.schema(CORE_SCHEMA)
|
|
83
80
|
.from('profiles')
|
|
84
81
|
.upsert({ id: user.id, avatar_url: avatarUrl, email: user.email }, { onConflict: 'id' })
|
|
85
82
|
if (profileError) throw profileError
|
|
@@ -44,13 +44,19 @@ export function useModuleNavigation(hashBase: string, depthMap?: DepthMap, homeV
|
|
|
44
44
|
// '/inventory/dashboard' → treat as home view
|
|
45
45
|
if (segments.length === 1 && segments[0] === homeView) return homeView
|
|
46
46
|
// Detect action + ID patterns: '/products/edit/uuid' or '/stock/detail/uuid'
|
|
47
|
-
const ACTION_KEYWORDS = ['edit', 'detail', 'view']
|
|
47
|
+
const ACTION_KEYWORDS = ['edit', 'detail', 'view', 'post']
|
|
48
48
|
if (segments.length >= 3) {
|
|
49
49
|
const maybeAction = segments[segments.length - 2]
|
|
50
50
|
if (ACTION_KEYWORDS.includes(maybeAction)) {
|
|
51
51
|
return segments.slice(0, -2).join('-') + '-' + maybeAction + ':' + segments[segments.length - 1]
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
// Generic fallback: a trailing UUID is always an ID for the view formed
|
|
55
|
+
// by the preceding segments ('/content/post/<uuid>' → 'content-post:<uuid>')
|
|
56
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
|
57
|
+
if (segments.length >= 2 && UUID_RE.test(segments[segments.length - 1])) {
|
|
58
|
+
return segments.slice(0, -1).join('-') + ':' + segments[segments.length - 1]
|
|
59
|
+
}
|
|
54
60
|
return segments.join('-')
|
|
55
61
|
}
|
|
56
62
|
return homeView
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ---------------------------------------------------------------------------
|
|
2
|
-
// Factory: creates a ClientOrdersProvider that queries
|
|
2
|
+
// Factory: creates a ClientOrdersProvider that queries public.orders
|
|
3
3
|
// for a given client (party_id). The UI keeps the historical "stage" language,
|
|
4
4
|
// but current archetype schemas expose this lifecycle as orders.status.
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
@@ -44,7 +44,6 @@ export function createClientOrdersProvider(): ClientOrdersProvider {
|
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
let qb = supabase
|
|
47
|
-
.schema('saas_core')
|
|
48
47
|
.from('orders')
|
|
49
48
|
.select('id, kind, status, total, reference_number, notes, metadata, created_at', { count: 'exact' })
|
|
50
49
|
.eq('party_id', query.clientId)
|
|
@@ -67,8 +66,7 @@ export function createClientOrdersProvider(): ClientOrdersProvider {
|
|
|
67
66
|
const bookingStartsByOrderId = new Map<string, string>()
|
|
68
67
|
if (orderIds.length > 0) {
|
|
69
68
|
const { data: bookings } = await supabase
|
|
70
|
-
.
|
|
71
|
-
.from('bookings')
|
|
69
|
+
.from('appointments')
|
|
72
70
|
.select('order_id, starts_at')
|
|
73
71
|
.in('order_id', orderIds)
|
|
74
72
|
|
|
@@ -2,7 +2,7 @@ import type { OrgAdapter, Organization, OrgMember, OrgMembership, CreateOrgOptio
|
|
|
2
2
|
import type { Location } from '../../types/tenant'
|
|
3
3
|
import type { PermissionProfile, SystemPermission, PermissionAction } from '../../types/permissions'
|
|
4
4
|
import type { Invite } from '../../types/invite'
|
|
5
|
-
import { getSupabaseClient, getCoreClient
|
|
5
|
+
import { getSupabaseClient, getCoreClient } from '../supabase'
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
// Request dedup — prevents duplicate in-flight requests (React StrictMode, etc.)
|
|
@@ -233,8 +233,8 @@ function buildPermissionProfiles(
|
|
|
233
233
|
|
|
234
234
|
export function createSupabaseOrgAdapter(): OrgAdapter {
|
|
235
235
|
const supabase = getSupabaseClient()
|
|
236
|
-
/** Core
|
|
237
|
-
const core = () => supabase
|
|
236
|
+
/** Core tables now live in the public schema — same client. */
|
|
237
|
+
const core = () => supabase
|
|
238
238
|
|
|
239
239
|
return {
|
|
240
240
|
async listUserOrgs(userId: string): Promise<OrgMembership[]> {
|
|
@@ -3,17 +3,19 @@ import type { SupabaseClient } from '@supabase/supabase-js'
|
|
|
3
3
|
import { getSupabaseClientOptional as _getOpt } from '@fayz-ai/core'
|
|
4
4
|
export { createSupabaseProvider, setGlobalSupabaseClient } from '@fayz-ai/core'
|
|
5
5
|
// @fayz-ai/core returns a loosely-typed client (no hard supabase coupling); the
|
|
6
|
-
// shell does `.
|
|
6
|
+
// shell does `.from(...)` against the single public client, so surface it as
|
|
7
|
+
// the real client type.
|
|
7
8
|
export const getSupabaseClientOptional = (): SupabaseClient | null =>
|
|
8
9
|
_getOpt() as unknown as SupabaseClient | null
|
|
9
10
|
export {
|
|
10
|
-
CORE_SCHEMA,
|
|
11
|
-
getCoreSchemaClient as getCoreClient,
|
|
12
11
|
getFayzSupabaseClient as getSupabaseClient,
|
|
13
12
|
getFayzSupabaseClientOptional as getSupabaseClientSafe,
|
|
14
13
|
createFayzSupabaseClient as createSupabaseClient,
|
|
15
14
|
} from '../../supabase/client'
|
|
16
15
|
import { getFayzSupabaseClient } from '../../supabase/client'
|
|
16
|
+
// Core tables now live in the public schema — the "core" client is just the
|
|
17
|
+
// plain public client. Kept as a backward-compatible alias for call sites.
|
|
18
|
+
export const getCoreClient = getFayzSupabaseClient
|
|
17
19
|
export const getCoreSupabaseClient = getFayzSupabaseClient
|
|
18
20
|
export const getProjectSupabaseClient = getFayzSupabaseClient
|
|
19
21
|
export type { SupabaseClient }
|
|
@@ -81,7 +81,7 @@ function buildTheme(base: ThemeTokens, overrides: CreateThemeOptions | null): Th
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
const STORE_KEY = '
|
|
84
|
+
const STORE_KEY = '__fayz_theme_store__'
|
|
85
85
|
|
|
86
86
|
function createThemeStore(): UseBoundStore<StoreApi<ThemeState>> {
|
|
87
87
|
// Window-level singleton to survive linked-package dual-module loading
|