@fayz-ai/saas 0.8.1 → 0.8.2
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/dist/access/context.d.ts +47 -0
- package/dist/access/context.d.ts.map +1 -0
- package/dist/access/headless.d.ts +21 -0
- package/dist/access/headless.d.ts.map +1 -0
- package/dist/access/index.d.ts +12 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/limits-registry.d.ts +33 -0
- package/dist/access/limits-registry.d.ts.map +1 -0
- package/dist/access/module-nav.d.ts +15 -0
- package/dist/access/module-nav.d.ts.map +1 -0
- package/dist/access/resolver.d.ts +2 -0
- package/dist/access/resolver.d.ts.map +1 -0
- package/dist/access/types.d.ts +43 -0
- package/dist/access/types.d.ts.map +1 -0
- package/dist/access/upgrade-modal-store.d.ts +23 -0
- package/dist/access/upgrade-modal-store.d.ts.map +1 -0
- package/dist/app/AdminShell.d.ts +3 -0
- package/dist/app/AdminShell.d.ts.map +1 -1
- package/dist/app/admin-app.d.ts +3 -1
- package/dist/app/admin-app.d.ts.map +1 -1
- package/dist/app/config.d.ts +47 -2
- package/dist/app/config.d.ts.map +1 -1
- package/dist/app/core-entities.d.ts +25 -0
- package/dist/app/core-entities.d.ts.map +1 -0
- package/dist/app/derive-contract.d.ts +8 -0
- package/dist/app/derive-contract.d.ts.map +1 -0
- package/dist/app/scaffold.d.ts.map +1 -1
- package/dist/archetype-lookup.d.ts.map +1 -1
- package/dist/billing/index.cjs +6 -2
- package/dist/billing/index.d.ts +2 -0
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/index.js +1 -1
- package/dist/billing/plan-badge.d.ts +17 -0
- package/dist/billing/plan-badge.d.ts.map +1 -0
- package/dist/billing/store.d.ts +6 -1
- package/dist/billing/store.d.ts.map +1 -1
- package/dist/{chunk-3M25GRRU.js → chunk-I3DY47N5.js} +3 -4
- package/dist/chunk-I3DY47N5.js.map +1 -0
- package/dist/chunk-NNFGMUF2.cjs +39 -0
- package/dist/chunk-NNFGMUF2.cjs.map +1 -0
- package/dist/{chunk-4XTQ4V5L.cjs → chunk-SAZLW54Y.cjs} +16 -12
- package/dist/chunk-SAZLW54Y.cjs.map +1 -0
- package/dist/{chunk-IPWCHJPE.cjs → chunk-VKYZACG5.cjs} +5 -6
- package/dist/chunk-VKYZACG5.cjs.map +1 -0
- package/dist/chunk-VN5NTK26.js +36 -0
- package/dist/chunk-VN5NTK26.js.map +1 -0
- package/dist/{chunk-XNWCGJYH.js → chunk-VTEP2AQX.js} +15 -11
- package/dist/chunk-VTEP2AQX.js.map +1 -0
- package/dist/components/shared/ContactPicker.d.ts +92 -0
- package/dist/components/shared/ContactPicker.d.ts.map +1 -0
- package/dist/components/shared/PersonLink.d.ts +12 -1
- package/dist/components/shared/PersonLink.d.ts.map +1 -1
- package/dist/components/shared/create-person.d.ts +20 -0
- package/dist/components/shared/create-person.d.ts.map +1 -0
- package/dist/crud/CrudDetailPage.d.ts.map +1 -1
- package/dist/crud/CrudFormPage.d.ts.map +1 -1
- package/dist/crud/CrudListView.d.ts.map +1 -1
- package/dist/crud/CrudPage.d.ts.map +1 -1
- package/dist/crud/archetypes/AddressesTab.d.ts +21 -0
- package/dist/crud/archetypes/AddressesTab.d.ts.map +1 -0
- package/dist/crud/archetypes/PersonDetailTabs.d.ts +2 -1
- package/dist/crud/archetypes/PersonDetailTabs.d.ts.map +1 -1
- package/dist/crud/createCrudPage.d.ts.map +1 -1
- package/dist/crud/index.d.ts +1 -0
- package/dist/crud/index.d.ts.map +1 -1
- package/dist/index.cjs +4281 -716
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4067 -542
- package/dist/index.js.map +1 -1
- package/dist/org/index.cjs +11 -11
- package/dist/org/index.js +2 -2
- package/dist/org/store.d.ts.map +1 -1
- package/dist/permissions/context.d.ts +2 -0
- package/dist/permissions/context.d.ts.map +1 -1
- package/dist/permissions/index.cjs +7 -7
- package/dist/permissions/index.js +1 -1
- package/dist/shell/components/auth/ProtectedRoute.d.ts.map +1 -1
- package/dist/shell/components/billing/SoftLimitBanner.d.ts +5 -0
- package/dist/shell/components/billing/SoftLimitBanner.d.ts.map +1 -0
- package/dist/shell/components/billing/SubscriptionPage.d.ts +5 -0
- package/dist/shell/components/billing/SubscriptionPage.d.ts.map +1 -0
- package/dist/shell/components/billing/UpgradeModal.d.ts +3 -0
- package/dist/shell/components/billing/UpgradeModal.d.ts.map +1 -0
- package/dist/shell/components/billing/UpgradePrompt.d.ts +10 -0
- package/dist/shell/components/billing/UpgradePrompt.d.ts.map +1 -0
- package/dist/shell/components/billing/access-contract.d.ts +18 -0
- package/dist/shell/components/billing/access-contract.d.ts.map +1 -0
- package/dist/shell/components/billing/gates.d.ts +14 -0
- package/dist/shell/components/billing/gates.d.ts.map +1 -0
- package/dist/shell/components/billing/index.d.ts +9 -2
- package/dist/shell/components/billing/index.d.ts.map +1 -1
- package/dist/shell/components/chat/ChatFab.d.ts +3 -1
- package/dist/shell/components/chat/ChatFab.d.ts.map +1 -1
- package/dist/shell/components/chat/ChatPanel.d.ts +3 -1
- package/dist/shell/components/chat/ChatPanel.d.ts.map +1 -1
- package/dist/shell/components/chat/ConfirmActionCard.d.ts +13 -0
- package/dist/shell/components/chat/ConfirmActionCard.d.ts.map +1 -0
- package/dist/shell/components/chat/markdown.d.ts +5 -0
- package/dist/shell/components/chat/markdown.d.ts.map +1 -0
- package/dist/shell/components/organization/TeamTab.d.ts.map +1 -1
- package/dist/shell/components/organization/TenantOnboarding.d.ts.map +1 -1
- package/dist/shell/components/organization/index.d.ts +0 -1
- package/dist/shell/components/organization/index.d.ts.map +1 -1
- package/dist/shell/components/settings/ConnectedCompanySettings.d.ts.map +1 -1
- package/dist/shell/components/settings/ConnectedFieldRulesSettings.d.ts.map +1 -1
- package/dist/shell/components/settings/ConnectedSecuritySettings.d.ts.map +1 -1
- package/dist/shell/components/settings/LocationsCrudPage.d.ts +1 -1
- package/dist/shell/components/settings/LocationsCrudPage.d.ts.map +1 -1
- package/dist/shell/components/settings/SettingsPage.d.ts +23 -2
- package/dist/shell/components/settings/SettingsPage.d.ts.map +1 -1
- package/dist/shell/hooks/index.d.ts +3 -2
- package/dist/shell/hooks/index.d.ts.map +1 -1
- package/dist/shell/hooks/useAITools.d.ts +2 -0
- package/dist/shell/hooks/useAITools.d.ts.map +1 -1
- package/dist/shell/hooks/useChat.d.ts +22 -0
- package/dist/shell/hooks/useChat.d.ts.map +1 -1
- package/dist/shell/hooks/useSystemPermission.d.ts +3 -0
- package/dist/shell/hooks/useSystemPermission.d.ts.map +1 -0
- package/dist/shell/hooks/useTenantPluginSettings.d.ts +12 -0
- package/dist/shell/hooks/useTenantPluginSettings.d.ts.map +1 -0
- package/dist/shell/lib/ai-tool-handlers.d.ts +119 -0
- package/dist/shell/lib/ai-tool-handlers.d.ts.map +1 -0
- package/dist/shell/lib/core-ai-tools.d.ts +14 -0
- package/dist/shell/lib/core-ai-tools.d.ts.map +1 -1
- package/dist/shell/lib/create-client-orders-provider.d.ts.map +1 -1
- package/dist/shell/lib/fayz-agent.d.ts +23 -0
- package/dist/shell/lib/fayz-agent.d.ts.map +1 -0
- package/dist/shell/lib/i18n.d.ts.map +1 -1
- package/dist/shell/stores/chat.store.d.ts +69 -0
- package/dist/shell/stores/chat.store.d.ts.map +1 -1
- package/dist/shell/types/billing.d.ts +7 -0
- package/dist/shell/types/billing.d.ts.map +1 -1
- package/dist/shell/types/plugins.d.ts +2 -45
- package/dist/shell/types/plugins.d.ts.map +1 -1
- package/dist/stores/createCrudStore.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/access/context.tsx +228 -0
- package/src/access/headless.ts +71 -0
- package/src/access/index.ts +27 -0
- package/src/access/limits-registry.ts +86 -0
- package/src/access/module-nav.test.ts +78 -0
- package/src/access/module-nav.ts +82 -0
- package/src/access/resolver.test.ts +143 -0
- package/src/access/resolver.ts +5 -0
- package/src/access/types.ts +47 -0
- package/src/access/upgrade-modal-store.ts +30 -0
- package/src/app/AdminShell.tsx +451 -68
- package/src/app/admin-app.tsx +46 -9
- package/src/app/config.ts +54 -1
- package/src/app/core-entities.ts +110 -0
- package/src/app/derive-contract.test.ts +155 -0
- package/src/app/derive-contract.ts +214 -0
- package/src/app/scaffold.tsx +4 -0
- package/src/archetype-lookup.ts +8 -2
- package/src/billing/index.ts +2 -0
- package/src/billing/plan-badge.ts +32 -0
- package/src/billing/store.ts +8 -1
- package/src/components/shared/ContactPicker.tsx +394 -0
- package/src/components/shared/PersonLink.tsx +11 -3
- package/src/components/shared/create-person.ts +74 -0
- package/src/crud/CrudDetailPage.tsx +5 -1
- package/src/crud/CrudFormPage.tsx +113 -6
- package/src/crud/CrudListView.tsx +16 -1
- package/src/crud/CrudPage.tsx +27 -5
- package/src/crud/DeleteConfirmDialog.tsx +1 -1
- package/src/crud/archetypes/AddressesTab.tsx +387 -0
- package/src/crud/archetypes/PersonDetailTabs.tsx +5 -0
- package/src/crud/createCrudPage.tsx +2 -0
- package/src/crud/index.ts +6 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +49 -1
- package/src/org/store.ts +9 -1
- package/src/permissions/context.tsx +29 -15
- package/src/shell/components/auth/ProtectedRoute.tsx +12 -2
- package/src/shell/components/billing/SoftLimitBanner.tsx +81 -0
- package/src/shell/components/billing/SubscriptionPage.tsx +372 -0
- package/src/shell/components/billing/UpgradeModal.tsx +102 -0
- package/src/shell/components/billing/UpgradePrompt.tsx +229 -0
- package/src/shell/components/billing/access-contract.ts +64 -0
- package/src/shell/components/billing/gates.tsx +62 -0
- package/src/shell/components/billing/index.ts +18 -2
- package/src/shell/components/chat/ChatFab.tsx +4 -2
- package/src/shell/components/chat/ChatPanel.tsx +174 -23
- package/src/shell/components/chat/ConfirmActionCard.tsx +57 -0
- package/src/shell/components/chat/markdown.tsx +102 -0
- package/src/shell/components/organization/TeamTab.tsx +21 -4
- package/src/shell/components/organization/TenantOnboarding.tsx +3 -1
- package/src/shell/components/organization/index.ts +0 -1
- package/src/shell/components/settings/ConnectedCompanySettings.tsx +4 -1
- package/src/shell/components/settings/ConnectedFieldRulesSettings.tsx +3 -1
- package/src/shell/components/settings/ConnectedSecuritySettings.tsx +3 -1
- package/src/shell/components/settings/LocationsCrudPage.ts +6 -1
- package/src/shell/components/settings/SettingsPage.tsx +63 -21
- package/src/shell/hooks/index.ts +3 -2
- package/src/shell/hooks/useAITools.ts +27 -23
- package/src/shell/hooks/useChat.ts +381 -16
- package/src/shell/hooks/useSystemPermission.ts +23 -0
- package/src/shell/hooks/useTenantPluginSettings.ts +127 -0
- package/src/shell/lib/ai-tool-handlers.ts +910 -0
- package/src/shell/lib/core-ai-tools.ts +234 -2
- package/src/shell/lib/create-client-orders-provider.ts +24 -2
- package/src/shell/lib/fayz-agent.ts +56 -0
- package/src/shell/lib/i18n.ts +71 -0
- package/src/shell/stores/chat.store.ts +118 -1
- package/src/shell/styles.css +30 -0
- package/src/shell/types/billing.ts +8 -0
- package/src/shell/types/plugins.ts +13 -50
- package/src/stores/createCrudStore.ts +9 -0
- package/dist/chunk-3M25GRRU.js.map +0 -1
- package/dist/chunk-4XTQ4V5L.cjs.map +0 -1
- package/dist/chunk-5GYQK5IW.js +0 -21
- package/dist/chunk-5GYQK5IW.js.map +0 -1
- package/dist/chunk-IPWCHJPE.cjs.map +0 -1
- package/dist/chunk-KYID2MR6.cjs +0 -23
- package/dist/chunk-KYID2MR6.cjs.map +0 -1
- package/dist/chunk-XNWCGJYH.js.map +0 -1
- package/dist/shell/components/billing/BillingPage.d.ts +0 -7
- package/dist/shell/components/billing/BillingPage.d.ts.map +0 -1
- package/dist/shell/components/billing/PaywallGate.d.ts +0 -11
- package/dist/shell/components/billing/PaywallGate.d.ts.map +0 -1
- package/dist/shell/components/organization/PermissionGate.d.ts +0 -11
- package/dist/shell/components/organization/PermissionGate.d.ts.map +0 -1
- package/dist/shell/hooks/useBilling.d.ts +0 -14
- package/dist/shell/hooks/useBilling.d.ts.map +0 -1
- package/dist/shell/hooks/usePermission.d.ts +0 -16
- package/dist/shell/hooks/usePermission.d.ts.map +0 -1
- package/src/shell/components/billing/BillingPage.tsx +0 -56
- package/src/shell/components/billing/PaywallGate.tsx +0 -80
- package/src/shell/components/organization/PermissionGate.tsx +0 -16
- package/src/shell/hooks/useBilling.ts +0 -151
- package/src/shell/hooks/usePermission.ts +0 -101
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { LimitDeclaration } from '@fayz-ai/core';
|
|
3
|
+
import type { AccessApi, LimitState } from './types';
|
|
4
|
+
export interface AccessProviderProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* App-level limit declarations layered ON TOP of the plugins' `declaredLimits`
|
|
8
|
+
* (app wins on key collision). Sourced from `config.billing.limitDeclarations`.
|
|
9
|
+
*/
|
|
10
|
+
limitDeclarations?: LimitDeclaration[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Assembles the reactive {@link AccessSession} from the singleton stores and
|
|
14
|
+
* exposes the composed access API (role × plan). Thin by design — mounts just
|
|
15
|
+
* inside PermissionsProvider so it can reuse the live permission profile and the
|
|
16
|
+
* plugin runtime. Also publishes the merged limit declarations to the module
|
|
17
|
+
* registry so `invalidateLimit` works from non-React create handlers.
|
|
18
|
+
*/
|
|
19
|
+
export declare function AccessProvider({ children, limitDeclarations }: AccessProviderProps): React.JSX.Element;
|
|
20
|
+
export declare namespace AccessProvider {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The composed access API. Throws outside <AccessProvider> — use
|
|
25
|
+
* {@link useAccessOptional} for SDK components that must degrade gracefully.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useAccess(): AccessApi;
|
|
28
|
+
/**
|
|
29
|
+
* Like {@link useAccess} but degrades to allow-all when no provider is mounted,
|
|
30
|
+
* so components stay usable under a bare host shell (gating is an enhancement).
|
|
31
|
+
*/
|
|
32
|
+
export declare function useAccessOptional(): AccessApi;
|
|
33
|
+
/**
|
|
34
|
+
* Live usage of a quantity limit for the active tenant. Resolves the limit's
|
|
35
|
+
* declaration (plugin manifest or app override) → a tenant-scoped `count(*)`,
|
|
36
|
+
* capped by the current plan. No declaration or no cap (or `-1`) ⇒ unlimited.
|
|
37
|
+
* Re-fetches when the tenant, plan cap, or an `invalidateLimit(key)` fires.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useLimit(key: string): LimitState;
|
|
40
|
+
/**
|
|
41
|
+
* Imperative guard for create handlers: `await guard(n)` returns `'ok'` when
|
|
42
|
+
* adding `n` more rows stays within the cap, or `'blocked'` (and opens the global
|
|
43
|
+
* UpgradeModal) when it would exceed it. Always checks a FRESH count so it never
|
|
44
|
+
* relies on stale hook state.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useLimitGuard(key: string): (n?: number) => Promise<'ok' | 'blocked'>;
|
|
47
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/access/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,eAAe,CAAA;AAW7E,OAAO,KAAK,EAAE,SAAS,EAAiC,UAAU,EAAE,MAAM,SAAS,CAAA;AAgBnF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAA;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,mBAAmB,qBAiDlF;yBAjDe,cAAc;;;AA6D9B;;;GAGG;AACH,wBAAgB,SAAS,IAAI,SAAS,CAIrC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,CAG7C;AAeD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAgDhD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CA4BpF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PermissionAction } from '@fayz-ai/core';
|
|
2
|
+
import { type AgentGuardResult } from '@fayz-ai/core/access';
|
|
3
|
+
import type { AccessSession } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Snapshot of the live session assembled from the singleton stores — the same
|
|
6
|
+
* assembly AccessProvider does reactively. Values are as-hydrated: before
|
|
7
|
+
* AuthProvider/OrgProvider finish, fields are null (and decisions fail-open on
|
|
8
|
+
* profile, closed on nothing — same semantics as the providers).
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAccessSnapshot(): AccessSession;
|
|
11
|
+
/** Imperative role × plan check over the live snapshot. */
|
|
12
|
+
export declare function checkAccess(feature: string, action?: PermissionAction): AgentGuardResult;
|
|
13
|
+
/**
|
|
14
|
+
* Imperative plan-limit guard: would adding `n` rows exceed the cap for
|
|
15
|
+
* `key`? Counts FRESH (never trusts stale hook state), mirrors useLimitGuard.
|
|
16
|
+
* No declaration / no cap / `-1` / no tenant ⇒ allowed. Does NOT open the
|
|
17
|
+
* UpgradeModal — the caller decides how to surface the denial (an agent turns
|
|
18
|
+
* it into a conversational upgrade prompt).
|
|
19
|
+
*/
|
|
20
|
+
export declare function guardLimit(key: string, n?: number): Promise<AgentGuardResult>;
|
|
21
|
+
//# sourceMappingURL=headless.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../src/access/headless.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAQ,MAAM,eAAe,CAAA;AAE3D,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAMxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAa5C;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAOjD;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAKxF;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,SAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmB9E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { AccessProvider, useAccess, useAccessOptional, useLimit, useLimitGuard } from './context';
|
|
2
|
+
export type { AccessProviderProps } from './context';
|
|
3
|
+
export { resolveAccess, isEntitledByPlan } from './resolver';
|
|
4
|
+
export { getAccessSnapshot, checkAccess, guardLimit } from './headless';
|
|
5
|
+
export { agentDenial, UPGRADE_URL } from '@fayz-ai/core/access';
|
|
6
|
+
export type { AgentDenial, AgentDenialLimit, AgentGuardResult } from '@fayz-ai/core/access';
|
|
7
|
+
export { invalidateLimit, setLimitRegistry, getLimitDeclaration, CORE_LIMIT_DECLARATIONS } from './limits-registry';
|
|
8
|
+
export { useModuleNavAccess, applyNavAccess } from './module-nav';
|
|
9
|
+
export { useUpgradeModalStore } from './upgrade-modal-store';
|
|
10
|
+
export type { UpgradeModalPayload, UpgradeModalStore } from './upgrade-modal-store';
|
|
11
|
+
export type { AccessApi, AccessDecision, AccessSession, DenyReason, LimitState, } from './types';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/access/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACjG,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE5D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC/D,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE3F,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAEnH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEnF,YAAY,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LimitDeclaration, RegisteredEntity } from '@fayz-ai/core';
|
|
2
|
+
/**
|
|
3
|
+
* Module-level registry bridging React (the provider that knows the declarations)
|
|
4
|
+
* and the plain `invalidateLimit(key)` function that create handlers call outside
|
|
5
|
+
* any component. The AccessProvider publishes the merged declarations here on
|
|
6
|
+
* mount; `useLimit`/`useLimitGuard` and `invalidateLimit` read from it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Shell built-in limit declarations. Unlike plugin/app limits (contributed via
|
|
10
|
+
* `PluginManifest.declaredLimits` / `billing.limitDeclarations`), these count
|
|
11
|
+
* core tenant tables that have no owning plugin: seats (`tenant_members`) and
|
|
12
|
+
* `locations`. Merged as the LOWEST-priority layer by the AccessProvider, so a
|
|
13
|
+
* plugin or app may still override a key (e.g. add a `kindFilter`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const CORE_LIMIT_DECLARATIONS: LimitDeclaration[];
|
|
16
|
+
/**
|
|
17
|
+
* Entity-derived layer of the limit merge: any registered CRUD entity carrying
|
|
18
|
+
* `limitKey` yields a declaration for free from its own data mapping (table +
|
|
19
|
+
* archetype kind) — a cap without a countable binding is a dead cap. Shared by
|
|
20
|
+
* the AccessProvider (live registry) and the manifest derivation (agent
|
|
21
|
+
* contract), so both resolve the identical layer.
|
|
22
|
+
*/
|
|
23
|
+
export declare function entityDerivedLimitDeclarations(entities: RegisteredEntity[]): LimitDeclaration[];
|
|
24
|
+
/** Called by AccessProvider whenever the merged limit declarations change. */
|
|
25
|
+
export declare function setLimitRegistry(declarations: LimitDeclaration[]): void;
|
|
26
|
+
export declare function getLimitDeclaration(key: string): LimitDeclaration | undefined;
|
|
27
|
+
export declare function subscribeLimit(key: string, cb: () => void): () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Invalidate a limit after a create/delete so its next read is fresh, then wake
|
|
30
|
+
* any mounted `useLimit(key)`. Safe to call from plain handlers (no React).
|
|
31
|
+
*/
|
|
32
|
+
export declare function invalidateLimit(key: string): void;
|
|
33
|
+
//# sourceMappingURL=limits-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits-registry.d.ts","sourceRoot":"","sources":["../../src/access/limits-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGvE;;;;;GAKG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,EAGrD,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAc/F;AAID,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAIvE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE7E;AAQD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAWtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIjD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ModuleNavItem } from '@fayz-ai/ui';
|
|
2
|
+
import type { AccessApi } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Pure decoration used by {@link useModuleNavAccess}. Kept store-free so it is
|
|
5
|
+
* directly unit-testable: pass the composed {@link AccessApi} and the set of
|
|
6
|
+
* feature ids known to the RBAC catalog.
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyNavAccess(items: ModuleNavItem[], access: AccessApi, knownFeatures: Set<string>): ModuleNavItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a plugin's internal nav against role × plan: hides role-denied links,
|
|
11
|
+
* badges plan-denied ones with a Crown (`premium`), and passes everything else
|
|
12
|
+
* through unchanged. Recursive over children.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useModuleNavAccess(items: ModuleNavItem[]): ModuleNavItem[];
|
|
15
|
+
//# sourceMappingURL=module-nav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-nav.d.ts","sourceRoot":"","sources":["../../src/access/module-nav.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAuBxC;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EAAE,EACtB,MAAM,EAAE,SAAS,EACjB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GACzB,aAAa,EAAE,CA2BjB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAW1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/access/resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AuthUser, Organization, PermissionProfile, Plan, PermissionAction } from '@fayz-ai/core';
|
|
2
|
+
/**
|
|
3
|
+
* Decision types come from the shared engine in @fayz-ai/core/access.
|
|
4
|
+
* - `role` — the user's RBAC profile lacks the permission (fix: grant the role).
|
|
5
|
+
* - `plan` — the tenant's plan does not entitle the feature (fix: upgrade).
|
|
6
|
+
* - `limit` — a guarded write would exceed a plan cap (fix: upgrade).
|
|
7
|
+
* The distinction drives the UI: `role` → AccessDenied, `plan`/`limit` →
|
|
8
|
+
* UpgradePrompt/UpgradeModal.
|
|
9
|
+
*/
|
|
10
|
+
import type { AccessDecision } from '@fayz-ai/core/access';
|
|
11
|
+
export type { DenyReason, AccessDecision } from '@fayz-ai/core/access';
|
|
12
|
+
/**
|
|
13
|
+
* The reactive snapshot the access engine resolves against. Assembled from the
|
|
14
|
+
* singleton stores (auth user, current org incl. plan id, current permission
|
|
15
|
+
* profile, billing plans). This is intentionally ONE extensible object: future
|
|
16
|
+
* session parameters (active location, feature-flag cohort, delegated scope, …)
|
|
17
|
+
* enter here so the resolver signature never churns.
|
|
18
|
+
*/
|
|
19
|
+
export interface AccessSession {
|
|
20
|
+
user: AuthUser | null;
|
|
21
|
+
org: Organization | null;
|
|
22
|
+
/** Effective profile — becomes the previewed role during impersonation. */
|
|
23
|
+
profile: PermissionProfile | null;
|
|
24
|
+
/** The org's currently-active plan (resolved from billing plans by org.plan). */
|
|
25
|
+
plan: Plan | null;
|
|
26
|
+
}
|
|
27
|
+
export interface LimitState {
|
|
28
|
+
key: string;
|
|
29
|
+
/** Cap from the plan (`-1`/unlimited surfaces as `Infinity` here). */
|
|
30
|
+
max: number;
|
|
31
|
+
used: number;
|
|
32
|
+
remaining: number;
|
|
33
|
+
atLimit: boolean;
|
|
34
|
+
unlimited: boolean;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
/** Re-count (bypasses the short-lived cache). */
|
|
37
|
+
refresh(): void;
|
|
38
|
+
}
|
|
39
|
+
export interface AccessApi {
|
|
40
|
+
can(feature: string, action?: PermissionAction): AccessDecision;
|
|
41
|
+
entitled(feature: string): boolean;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/access/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEtG;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEtE;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;IACrB,GAAG,EAAE,YAAY,GAAG,IAAI,CAAA;IACxB,2EAA2E;IAC3E,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACjC,iFAAiF;IACjF,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,iDAAiD;IACjD,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAA;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;CACnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload describing WHY the upgrade modal opened, so the visual component (owned
|
|
3
|
+
* by the shell/gates layer) can tailor its copy — a hit quantity cap
|
|
4
|
+
* (`limitKey`) or a plan-gated feature (`feature`).
|
|
5
|
+
*/
|
|
6
|
+
export interface UpgradeModalPayload {
|
|
7
|
+
limitKey?: string;
|
|
8
|
+
feature?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UpgradeModalStore {
|
|
11
|
+
/** The active payload, or null when closed. */
|
|
12
|
+
current: UpgradeModalPayload | null;
|
|
13
|
+
open(payload: UpgradeModalPayload): void;
|
|
14
|
+
close(): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Global, lightweight store for the single app-wide UpgradeModal. `useLimitGuard`
|
|
18
|
+
* and imperative create handlers call `open(...)` when a limit blocks; the visual
|
|
19
|
+
* modal (rendered once near the shell root by the gates layer) subscribes to
|
|
20
|
+
* `current`. Kept as a zustand singleton so store + component share one instance.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useUpgradeModalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UpgradeModalStore>>;
|
|
23
|
+
//# sourceMappingURL=upgrade-modal-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-modal-store.d.ts","sourceRoot":"","sources":["../../src/access/upgrade-modal-store.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACnC,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACxC,KAAK,IAAI,IAAI,CAAA;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,gFAI9B,CAAA"}
|
package/dist/app/AdminShell.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BottomNavItem, type MobileHeaderVariant, type ModuleNavVariant } from '@fayz-ai/ui';
|
|
3
|
+
import { type LoginAmbassador } from '@fayz-ai/plugin-auth';
|
|
3
4
|
import type { CustomPage } from './config';
|
|
4
5
|
import type { AuthProvider } from '@fayz-ai/core';
|
|
5
6
|
export interface AdminShellProps {
|
|
@@ -12,6 +13,8 @@ export interface AdminShellProps {
|
|
|
12
13
|
loginDescription?: string;
|
|
13
14
|
loginLogo?: React.ReactNode;
|
|
14
15
|
loginLayout?: 'split' | 'centered';
|
|
16
|
+
loginAmbassadors?: LoginAmbassador[];
|
|
17
|
+
loginAmbassadorsLabel?: string;
|
|
15
18
|
showOAuth?: boolean;
|
|
16
19
|
oauthProviders?: Exclude<AuthProvider, 'email'>[];
|
|
17
20
|
showSettings?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminShell.d.ts","sourceRoot":"","sources":["../../src/app/AdminShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAGxB,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"AdminShell.d.ts","sourceRoot":"","sources":["../../src/app/AdminShell.t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ClE,SAAS,CAAC,EAAE,aAAa,EAAE,CAAA;IAC3B,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,mBAAmB,CAAA;CACnC;AAixBD,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAkBhD;yBAlBe,UAAU"}
|
package/dist/app/admin-app.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type AuthLayout } from '@fayz-ai/plugin-auth';
|
|
2
|
+
import { type AuthLayout, type LoginAmbassador } from '@fayz-ai/plugin-auth';
|
|
3
3
|
import type { FayzAppConfig } from './config';
|
|
4
4
|
export declare function getAuthShellProps(auth: FayzAppConfig['auth']): {
|
|
5
5
|
requireAuth?: boolean;
|
|
@@ -7,6 +7,8 @@ export declare function getAuthShellProps(auth: FayzAppConfig['auth']): {
|
|
|
7
7
|
loginDescription?: string;
|
|
8
8
|
loginLogo?: React.ReactNode;
|
|
9
9
|
loginLayout?: AuthLayout;
|
|
10
|
+
loginAmbassadors?: LoginAmbassador[];
|
|
11
|
+
loginAmbassadorsLabel?: string;
|
|
10
12
|
showOAuth?: boolean;
|
|
11
13
|
oauthProviders?: Exclude<import('@fayz-ai/core').AuthProvider, 'email'>[];
|
|
12
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-app.d.ts","sourceRoot":"","sources":["../../src/app/admin-app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,OAAO,EAGL,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"admin-app.d.ts","sourceRoot":"","sources":["../../src/app/admin-app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,OAAO,EAGL,KAAK,UAAU,EAGf,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAA;AAmB7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAyC7C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAA;IACpC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,CAAA;CAC1E,CA0BA;AAoHD,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBA0FxG;yBA1Fe,cAAc;;;AAsG9B,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,KAAK,CAAC,aAAa,CAyBxE"}
|
package/dist/app/config.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import type { AuthProvider, OrgAdapter, PluginManifest, ThemeMode, LocaleConfig, PermissionsConfig } from '@fayz-ai/core';
|
|
3
|
-
import type { AuthPluginOptions, ResolvedAuthPlugin } from '@fayz-ai/plugin-auth';
|
|
2
|
+
import type { AuthProvider, OrgAdapter, PluginManifest, ThemeMode, LocaleConfig, PermissionsConfig, LimitDeclaration, AgentDomainKnowledge, AgentRpcDeclaration, EntityDef } from '@fayz-ai/core';
|
|
3
|
+
import type { AuthPluginOptions, ResolvedAuthPlugin, LoginAmbassador } from '@fayz-ai/plugin-auth';
|
|
4
4
|
import type { BottomNavItem, MobileHeaderVariant } from '@fayz-ai/ui';
|
|
5
5
|
import type { SaasTheme } from '../shell/config/theme/tokens';
|
|
6
6
|
import type { CreateThemeOptions } from '../shell/config/theme/utils';
|
|
7
7
|
import type { PlanConfig } from '../shell/types/billing';
|
|
8
|
+
import type { FayzAgentConnectionConfig } from '../shell/lib/fayz-agent';
|
|
8
9
|
export type PageSection = 'main' | 'secondary' | 'settings';
|
|
9
10
|
export interface CustomPage {
|
|
10
11
|
/** Route path, e.g. '/reports' */
|
|
@@ -47,6 +48,12 @@ export interface AuthConfig {
|
|
|
47
48
|
loginLayout?: 'split' | 'centered';
|
|
48
49
|
loginTagline?: string;
|
|
49
50
|
loginDescription?: string;
|
|
51
|
+
/** Product ambassadors shown as a small social-proof avatar strip above the
|
|
52
|
+
* tagline on the split-login brand panel. Each needs a local `image` path;
|
|
53
|
+
* degrades to nothing when omitted. */
|
|
54
|
+
loginAmbassadors?: LoginAmbassador[];
|
|
55
|
+
/** Optional microtext beside the ambassador strip, e.g. "+2 mil profissionais". */
|
|
56
|
+
loginAmbassadorsLabel?: string;
|
|
50
57
|
showOAuth?: boolean;
|
|
51
58
|
oauthProviders?: Exclude<AuthProvider, 'email'>[];
|
|
52
59
|
}
|
|
@@ -62,13 +69,38 @@ export interface OrgConfig {
|
|
|
62
69
|
export interface ChatConfig {
|
|
63
70
|
enabled?: boolean;
|
|
64
71
|
title?: string;
|
|
72
|
+
/** Extra guidance appended to the agent's own instructions. */
|
|
65
73
|
systemPrompt?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Bring-your-own chat backend. Leave unset to use the Fayz agent configured
|
|
76
|
+
* for this project — the container injects the connection env, so no key or
|
|
77
|
+
* URL needs to live in app config.
|
|
78
|
+
*/
|
|
66
79
|
apiEndpoint?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Overrides for the Fayz agent connection, for apps built outside a Fayz
|
|
82
|
+
* container. `false` opts out of the Fayz agent entirely.
|
|
83
|
+
*/
|
|
84
|
+
agent?: FayzAgentConnectionConfig | false;
|
|
67
85
|
}
|
|
68
86
|
export interface FayzBillingConfig {
|
|
69
87
|
plans: PlanConfig[];
|
|
70
88
|
stripePublishableKey?: string;
|
|
71
89
|
portalUrl?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Payment-gateway seam. When defined, the shell's Subscription page calls this
|
|
92
|
+
* with the target plan id INSTEAD of writing `plan` straight onto the org — this
|
|
93
|
+
* is where Stripe Checkout / Pix / Mercado Pago plug in (create the intent,
|
|
94
|
+
* redirect, let the webhook persist the plan). Left undefined, changing plan is
|
|
95
|
+
* an optimistic `adapter.updateOrg(orgId, { plan })`.
|
|
96
|
+
*/
|
|
97
|
+
onCheckout?: (planId: string) => Promise<void> | void;
|
|
98
|
+
/**
|
|
99
|
+
* App-level limit declarations layered on top of the plugins' `declaredLimits`
|
|
100
|
+
* (app wins on key collision). Use to add limits for app-local tables the
|
|
101
|
+
* plugins don't know about, or to re-point a key at a different table.
|
|
102
|
+
*/
|
|
103
|
+
limitDeclarations?: LimitDeclaration[];
|
|
72
104
|
}
|
|
73
105
|
export interface FayzAppConfig {
|
|
74
106
|
/** Application display name */
|
|
@@ -116,5 +148,18 @@ export interface FayzAppConfig {
|
|
|
116
148
|
permissions?: PermissionsConfig;
|
|
117
149
|
billing?: FayzBillingConfig;
|
|
118
150
|
chat?: ChatConfig;
|
|
151
|
+
agentContract?: {
|
|
152
|
+
/** 'server' flips data tools to broker-side execution for this app. */
|
|
153
|
+
executionPlane?: 'client' | 'server';
|
|
154
|
+
knowledge?: AgentDomainKnowledge;
|
|
155
|
+
/** RPCs the app itself ships (vertical-specific, e.g. pricing quote). */
|
|
156
|
+
rpcs?: AgentRpcDeclaration[];
|
|
157
|
+
/** App-level read-models for the agent's data primitives (same contract
|
|
158
|
+
* as PluginManifest.queryEntities — stable ASCII keys). */
|
|
159
|
+
queryEntities?: Array<{
|
|
160
|
+
key: string;
|
|
161
|
+
entity: EntityDef;
|
|
162
|
+
}>;
|
|
163
|
+
};
|
|
119
164
|
}
|
|
120
165
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/app/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/app/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,KAAK,EAEV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,iBAAiB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/app/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,KAAK,EAEV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACV,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAMxE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,CAAA;AAE3D,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,IAAI,EAAE,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CAAC,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,SAAS,CAAA;SAAE,CAAC,CAAA;KAC1D,CAAA;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EntityDef } from '@fayz-ai/core';
|
|
2
|
+
export interface CoreQueryEntity {
|
|
3
|
+
key: string;
|
|
4
|
+
entity: EntityDef;
|
|
5
|
+
writable?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* How this entity attaches to another record — appended to the descriptions
|
|
8
|
+
* of the data primitives that can act on it. These entities do NOT stand
|
|
9
|
+
* alone, and nothing in a flat enum of ~37 keys conveys that.
|
|
10
|
+
*
|
|
11
|
+
* Both directions matter, and each fails differently without it. On WRITE the
|
|
12
|
+
* model reaches for `updateRecord` on the parent, is told the fields do not
|
|
13
|
+
* exist, and then gives up or buries the data in a free-text column. On READ
|
|
14
|
+
* it searches the parent, finds no address on it, and confidently answers
|
|
15
|
+
* "this contact has no address registered" — a falsehood, since the row is
|
|
16
|
+
* one filtered query away.
|
|
17
|
+
*
|
|
18
|
+
* Stated here rather than inferred at failure time on purpose: guessing the
|
|
19
|
+
* intended entity from rejected FIELD NAMES points "add an address to this
|
|
20
|
+
* contact" at the business-locations table, which declares the same columns.
|
|
21
|
+
*/
|
|
22
|
+
agentHint?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const CORE_QUERY_ENTITIES: CoreQueryEntity[];
|
|
25
|
+
//# sourceMappingURL=core-entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-entities.d.ts","sourceRoot":"","sources":["../../src/app/core-entities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AA4E9C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,SAAS,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,mBAAmB,EAAE,eAAe,EAUhD,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentContract, LimitDeclaration, RegisteredEntity } from '@fayz-ai/core';
|
|
2
|
+
import type { FayzAppConfig } from './config';
|
|
3
|
+
export interface DerivedAgentSections {
|
|
4
|
+
agent: AgentContract;
|
|
5
|
+
limitDeclarations: LimitDeclaration[];
|
|
6
|
+
}
|
|
7
|
+
export declare function deriveAgentContract(config: FayzAppConfig, entities?: RegisteredEntity[]): DerivedAgentSections;
|
|
8
|
+
//# sourceMappingURL=derive-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-contract.d.ts","sourceRoot":"","sources":["../../src/app/derive-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAKb,gBAAgB,EAGhB,gBAAgB,EACjB,MAAM,eAAe,CAAA;AAMtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAkF7C,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,aAAa,CAAA;IACpB,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;CACtC;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,QAAQ,GAAE,gBAAgB,EAAqB,GAC9C,oBAAoB,CA2GtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/app/scaffold.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/app/scaffold.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OA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,EAAE,MAAM,CAAC,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAgCD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,GAAG,YAAY,CA6EjF"}
|
package/dist/billing/index.cjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNNFGMUF2_cjs = require('../chunk-NNFGMUF2.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
Object.defineProperty(exports, "resolvePlanBadge", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkNNFGMUF2_cjs.resolvePlanBadge; }
|
|
10
|
+
});
|
|
7
11
|
Object.defineProperty(exports, "useBillingStore", {
|
|
8
12
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkNNFGMUF2_cjs.useBillingStore; }
|
|
10
14
|
});
|
|
11
15
|
//# sourceMappingURL=index.cjs.map
|
|
12
16
|
//# sourceMappingURL=index.cjs.map
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,OAAO,GACR,MAAM,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,OAAO,GACR,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/billing/index.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Plan } from '@fayz-ai/core';
|
|
2
|
+
export interface PlanBadgeInfo {
|
|
3
|
+
/** Display label, e.g. 'Free' or 'Pro'. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Resolved plan id (falls back to the raw org.plan string). */
|
|
6
|
+
planId: string;
|
|
7
|
+
/** Paid plan (price > 0) — drives the Crown icon + gold styling in the menus. */
|
|
8
|
+
paid: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolve an org's `plan` string against the configured billing plans into the
|
|
12
|
+
* badge shown next to the user in both menus. Falls back to a capitalized
|
|
13
|
+
* version of the raw string when the id isn't in config (defensive — e.g. a
|
|
14
|
+
* legacy 'free' tenant before billing was wired).
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolvePlanBadge(planId: string | undefined | null, plans: Plan[]): PlanBadgeInfo;
|
|
17
|
+
//# sourceMappingURL=plan-badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-badge.d.ts","sourceRoot":"","sources":["../../src/billing/plan-badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAEzC,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAA;IACd,iFAAiF;IACjF,IAAI,EAAE,OAAO,CAAA;CACd;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACjC,KAAK,EAAE,IAAI,EAAE,GACZ,aAAa,CAOf"}
|
package/dist/billing/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Plan } from '@fayz-ai/core';
|
|
1
|
+
import type { Plan, BillingCheckoutFn } from '@fayz-ai/core';
|
|
2
2
|
export interface Subscription {
|
|
3
3
|
id: string;
|
|
4
4
|
orgId: string;
|
|
@@ -23,12 +23,17 @@ export interface BillingState {
|
|
|
23
23
|
invoices: Invoice[];
|
|
24
24
|
plans: Plan[];
|
|
25
25
|
loading: boolean;
|
|
26
|
+
/** Payment-gateway seam seeded from `config.billing.onCheckout` (see core
|
|
27
|
+
* BillingConfig). When set, the Subscription page routes plan changes through
|
|
28
|
+
* it instead of writing `plan` straight onto the org. */
|
|
29
|
+
checkout: BillingCheckoutFn | null;
|
|
26
30
|
}
|
|
27
31
|
export interface BillingStore extends BillingState {
|
|
28
32
|
setSubscription: (subscription: Subscription | null) => void;
|
|
29
33
|
setInvoices: (invoices: Invoice[]) => void;
|
|
30
34
|
setPlans: (plans: Plan[]) => void;
|
|
31
35
|
setLoading: (loading: boolean) => void;
|
|
36
|
+
setCheckout: (checkout: BillingCheckoutFn | null) => void;
|
|
32
37
|
reset: () => void;
|
|
33
38
|
}
|
|
34
39
|
export declare const useBillingStore: import("zustand").UseBoundStore<import("zustand").StoreApi<BillingStore>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/billing/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/billing/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAM5D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAA;IACtE,kBAA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
2
2
|
import { createClient } from '@supabase/supabase-js';
|
|
3
3
|
import { setActiveTenantId, setGlobalSupabaseClient } from '@fayz-ai/core';
|
|
4
4
|
import { create } from 'zustand';
|
|
@@ -769,7 +769,6 @@ var useOrganizationStore = create((set) => ({
|
|
|
769
769
|
setLoading: (loading) => set({ loading }),
|
|
770
770
|
reset: () => {
|
|
771
771
|
setActiveTenantId(void 0);
|
|
772
|
-
persistOrgId(null);
|
|
773
772
|
set({ currentOrg: null, userOrgs: [], members: [], loading: false });
|
|
774
773
|
}
|
|
775
774
|
}));
|
|
@@ -900,5 +899,5 @@ function OrgProvider({ adapter, autoCreate = false, children }) {
|
|
|
900
899
|
}
|
|
901
900
|
|
|
902
901
|
export { OrgProvider, createFayzSupabaseClient, createMockOrgAdapter, createSupabaseOrgAdapter, getFayzSupabaseClient, getFayzSupabaseClientOptional, getPersistedOrgId, useOrgAdapter, useOrgAdapterOptional, useOrganizationStore, useTenant, useTenantOptional };
|
|
903
|
-
//# sourceMappingURL=chunk-
|
|
904
|
-
//# sourceMappingURL=chunk-
|
|
902
|
+
//# sourceMappingURL=chunk-I3DY47N5.js.map
|
|
903
|
+
//# sourceMappingURL=chunk-I3DY47N5.js.map
|