@fayz-ai/admin 0.10.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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/CommandPalette-2AL327XQ.js +258 -0
- package/dist/CommandPalette-2AL327XQ.js.map +1 -0
- package/dist/ImportWizard-CISHGNQC.js +3 -0
- package/dist/ImportWizard-CISHGNQC.js.map +1 -0
- package/dist/ScheduleEditor-BSFF7LME.js +1040 -0
- package/dist/ScheduleEditor-BSFF7LME.js.map +1 -0
- package/dist/SubscriptionPage-NLZAZO4P.js +7 -0
- package/dist/SubscriptionPage-NLZAZO4P.js.map +1 -0
- 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 +65 -0
- package/dist/app/AdminShell.d.ts.map +1 -0
- package/dist/app/LoginPage.d.ts +3 -0
- package/dist/app/LoginPage.d.ts.map +1 -0
- package/dist/app/admin-app.d.ts +23 -0
- package/dist/app/admin-app.d.ts.map +1 -0
- package/dist/app/config.d.ts +277 -0
- package/dist/app/config.d.ts.map +1 -0
- 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/nav-contributions.store.d.ts +17 -0
- package/dist/app/nav-contributions.store.d.ts.map +1 -0
- package/dist/app/routing.d.ts +10 -0
- package/dist/app/routing.d.ts.map +1 -0
- package/dist/app/scaffold.d.ts +17 -0
- package/dist/app/scaffold.d.ts.map +1 -0
- package/dist/billing/index.d.ts +5 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +3 -0
- package/dist/billing/index.js.map +1 -0
- 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 +40 -0
- package/dist/billing/store.d.ts.map +1 -0
- package/dist/chunk-5O2UJAQ7.js +534 -0
- package/dist/chunk-5O2UJAQ7.js.map +1 -0
- package/dist/chunk-PNAJODZM.js +315 -0
- package/dist/chunk-PNAJODZM.js.map +1 -0
- package/dist/chunk-RKXZ7RUG.js +20 -0
- package/dist/chunk-RKXZ7RUG.js.map +1 -0
- package/dist/chunk-TNTZHUL6.js +817 -0
- package/dist/chunk-TNTZHUL6.js.map +1 -0
- package/dist/chunk-UMRN6427.js +510 -0
- package/dist/chunk-UMRN6427.js.map +1 -0
- package/dist/chunk-VN5NTK26.js +36 -0
- package/dist/chunk-VN5NTK26.js.map +1 -0
- package/dist/chunk-VTEP2AQX.js +101 -0
- package/dist/chunk-VTEP2AQX.js.map +1 -0
- package/dist/chunk-YUHCC7JY.js +11 -0
- package/dist/chunk-YUHCC7JY.js.map +1 -0
- package/dist/components/RightRail.d.ts +8 -0
- package/dist/components/RightRail.d.ts.map +1 -0
- package/dist/components/auth/CenteredLogin.d.ts +13 -0
- package/dist/components/auth/CenteredLogin.d.ts.map +1 -0
- package/dist/components/auth/LoginForm.d.ts +12 -0
- package/dist/components/auth/LoginForm.d.ts.map +1 -0
- package/dist/components/auth/LoginPage.d.ts +15 -0
- package/dist/components/auth/LoginPage.d.ts.map +1 -0
- package/dist/components/auth/OAuthButtons.d.ts +10 -0
- package/dist/components/auth/OAuthButtons.d.ts.map +1 -0
- package/dist/components/auth/ProtectedRoute.d.ts +11 -0
- package/dist/components/auth/ProtectedRoute.d.ts.map +1 -0
- package/dist/components/auth/RecoveryForm.d.ts +9 -0
- package/dist/components/auth/RecoveryForm.d.ts.map +1 -0
- package/dist/components/auth/SignupForm.d.ts +10 -0
- package/dist/components/auth/SignupForm.d.ts.map +1 -0
- package/dist/components/auth/SplitLogin.d.ts +14 -0
- package/dist/components/auth/SplitLogin.d.ts.map +1 -0
- package/dist/components/auth/index.d.ts +7 -0
- package/dist/components/auth/index.d.ts.map +1 -0
- package/dist/components/billing/InvoiceList.d.ts +9 -0
- package/dist/components/billing/InvoiceList.d.ts.map +1 -0
- package/dist/components/billing/PlanSelector.d.ts +13 -0
- package/dist/components/billing/PlanSelector.d.ts.map +1 -0
- package/dist/components/billing/SoftLimitBanner.d.ts +5 -0
- package/dist/components/billing/SoftLimitBanner.d.ts.map +1 -0
- package/dist/components/billing/SubscriptionCard.d.ts +12 -0
- package/dist/components/billing/SubscriptionCard.d.ts.map +1 -0
- package/dist/components/billing/SubscriptionPage.d.ts +5 -0
- package/dist/components/billing/SubscriptionPage.d.ts.map +1 -0
- package/dist/components/billing/UpgradeModal.d.ts +3 -0
- package/dist/components/billing/UpgradeModal.d.ts.map +1 -0
- package/dist/components/billing/UpgradeOverlay.d.ts +15 -0
- package/dist/components/billing/UpgradeOverlay.d.ts.map +1 -0
- package/dist/components/billing/UpgradePrompt.d.ts +10 -0
- package/dist/components/billing/UpgradePrompt.d.ts.map +1 -0
- package/dist/components/billing/access-contract.d.ts +18 -0
- package/dist/components/billing/access-contract.d.ts.map +1 -0
- package/dist/components/billing/gates.d.ts +14 -0
- package/dist/components/billing/gates.d.ts.map +1 -0
- package/dist/components/billing/index.d.ts +15 -0
- package/dist/components/billing/index.d.ts.map +1 -0
- package/dist/components/billing/plan-feature.d.ts +11 -0
- package/dist/components/billing/plan-feature.d.ts.map +1 -0
- package/dist/components/chat/ChatAttachments.d.ts +23 -0
- package/dist/components/chat/ChatAttachments.d.ts.map +1 -0
- package/dist/components/chat/ChatComposer.d.ts +21 -0
- package/dist/components/chat/ChatComposer.d.ts.map +1 -0
- package/dist/components/chat/ChatConversation.d.ts +20 -0
- package/dist/components/chat/ChatConversation.d.ts.map +1 -0
- package/dist/components/chat/ChatFab.d.ts +17 -0
- package/dist/components/chat/ChatFab.d.ts.map +1 -0
- package/dist/components/chat/ChatHistory.d.ts +16 -0
- package/dist/components/chat/ChatHistory.d.ts.map +1 -0
- package/dist/components/chat/ChatMessages.d.ts +16 -0
- package/dist/components/chat/ChatMessages.d.ts.map +1 -0
- package/dist/components/chat/ChatSuggestions.d.ts +17 -0
- package/dist/components/chat/ChatSuggestions.d.ts.map +1 -0
- package/dist/components/chat/ConfirmActionCard.d.ts +19 -0
- package/dist/components/chat/ConfirmActionCard.d.ts.map +1 -0
- package/dist/components/chat/RecordChip.d.ts +12 -0
- package/dist/components/chat/RecordChip.d.ts.map +1 -0
- package/dist/components/chat/index.d.ts +4 -0
- package/dist/components/chat/index.d.ts.map +1 -0
- package/dist/components/chat/markdown.d.ts +5 -0
- package/dist/components/chat/markdown.d.ts.map +1 -0
- package/dist/components/connect/AddConnectorPanel.d.ts +32 -0
- package/dist/components/connect/AddConnectorPanel.d.ts.map +1 -0
- package/dist/components/connect/ConnectConsentPage.d.ts +12 -0
- package/dist/components/connect/ConnectConsentPage.d.ts.map +1 -0
- package/dist/components/connect/ConnectorDetail.d.ts +29 -0
- package/dist/components/connect/ConnectorDetail.d.ts.map +1 -0
- package/dist/components/connect/ConnectorMark.d.ts +20 -0
- package/dist/components/connect/ConnectorMark.d.ts.map +1 -0
- package/dist/components/connect/ConnectorRow.d.ts +33 -0
- package/dist/components/connect/ConnectorRow.d.ts.map +1 -0
- package/dist/components/connect/ConnectorsPanel.d.ts +40 -0
- package/dist/components/connect/ConnectorsPanel.d.ts.map +1 -0
- package/dist/components/connect/ConnectorsTab.d.ts +16 -0
- package/dist/components/connect/ConnectorsTab.d.ts.map +1 -0
- package/dist/components/connect/client-marks.d.ts +31 -0
- package/dist/components/connect/client-marks.d.ts.map +1 -0
- package/dist/components/connect/index.d.ts +12 -0
- package/dist/components/connect/index.d.ts.map +1 -0
- package/dist/components/connect/model.d.ts +151 -0
- package/dist/components/connect/model.d.ts.map +1 -0
- package/dist/components/connect/useConnectors.d.ts +24 -0
- package/dist/components/connect/useConnectors.d.ts.map +1 -0
- package/dist/components/layout/BottomNav.d.ts +24 -0
- package/dist/components/layout/BottomNav.d.ts.map +1 -0
- package/dist/components/layout/CommandPalette.d.ts +23 -0
- package/dist/components/layout/CommandPalette.d.ts.map +1 -0
- package/dist/components/layout/LocationSwitchOverlay.d.ts +3 -0
- package/dist/components/layout/LocationSwitchOverlay.d.ts.map +1 -0
- package/dist/components/layout/MockModeBanner.d.ts +3 -0
- package/dist/components/layout/MockModeBanner.d.ts.map +1 -0
- package/dist/components/layout/PrintChrome.d.ts +10 -0
- package/dist/components/layout/PrintChrome.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +6 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/notes/NotesPanel.d.ts +13 -0
- package/dist/components/notes/NotesPanel.d.ts.map +1 -0
- package/dist/components/notifications/ChangelogFeed.d.ts +8 -0
- package/dist/components/notifications/ChangelogFeed.d.ts.map +1 -0
- package/dist/components/notifications/NotificationBell.d.ts +9 -0
- package/dist/components/notifications/NotificationBell.d.ts.map +1 -0
- package/dist/components/notifications/NotificationInbox.d.ts +13 -0
- package/dist/components/notifications/NotificationInbox.d.ts.map +1 -0
- package/dist/components/notifications/ToastProvider.d.ts +2 -0
- package/dist/components/notifications/ToastProvider.d.ts.map +1 -0
- package/dist/components/notifications/index.d.ts +5 -0
- package/dist/components/notifications/index.d.ts.map +1 -0
- package/dist/components/organization/InviteMemberDialog.d.ts +10 -0
- package/dist/components/organization/InviteMemberDialog.d.ts.map +1 -0
- package/dist/components/organization/OrgInitializer.d.ts +7 -0
- package/dist/components/organization/OrgInitializer.d.ts.map +1 -0
- package/dist/components/organization/OrgSwitcher.d.ts +7 -0
- package/dist/components/organization/OrgSwitcher.d.ts.map +1 -0
- package/dist/components/organization/PermissionMatrixEditor.d.ts +22 -0
- package/dist/components/organization/PermissionMatrixEditor.d.ts.map +1 -0
- package/dist/components/organization/PermissionProfilesTab.d.ts +3 -0
- package/dist/components/organization/PermissionProfilesTab.d.ts.map +1 -0
- package/dist/components/organization/TeamTab.d.ts +3 -0
- package/dist/components/organization/TeamTab.d.ts.map +1 -0
- package/dist/components/organization/TenantOnboarding.d.ts +9 -0
- package/dist/components/organization/TenantOnboarding.d.ts.map +1 -0
- package/dist/components/organization/index.d.ts +7 -0
- package/dist/components/organization/index.d.ts.map +1 -0
- package/dist/components/plugins/ConnectorsHub.d.ts +5 -0
- package/dist/components/plugins/ConnectorsHub.d.ts.map +1 -0
- package/dist/components/plugins/PluginSettingsPanel.d.ts +28 -0
- package/dist/components/plugins/PluginSettingsPanel.d.ts.map +1 -0
- package/dist/components/right-rail.d.ts +58 -0
- package/dist/components/right-rail.d.ts.map +1 -0
- package/dist/components/settings/BrandingSettings.d.ts +12 -0
- package/dist/components/settings/BrandingSettings.d.ts.map +1 -0
- package/dist/components/settings/CompanySettings.d.ts +13 -0
- package/dist/components/settings/CompanySettings.d.ts.map +1 -0
- package/dist/components/settings/ConnectedBrandingSettings.d.ts +2 -0
- package/dist/components/settings/ConnectedBrandingSettings.d.ts.map +1 -0
- package/dist/components/settings/ConnectedCompanySettings.d.ts +2 -0
- package/dist/components/settings/ConnectedCompanySettings.d.ts.map +1 -0
- package/dist/components/settings/ConnectedFieldRulesSettings.d.ts +2 -0
- package/dist/components/settings/ConnectedFieldRulesSettings.d.ts.map +1 -0
- package/dist/components/settings/ConnectedSecuritySettings.d.ts +2 -0
- package/dist/components/settings/ConnectedSecuritySettings.d.ts.map +1 -0
- package/dist/components/settings/ConnectedUserProfile.d.ts +3 -0
- package/dist/components/settings/ConnectedUserProfile.d.ts.map +1 -0
- package/dist/components/settings/FieldRulesSettings.d.ts +11 -0
- package/dist/components/settings/FieldRulesSettings.d.ts.map +1 -0
- package/dist/components/settings/HolidaysSettings.d.ts +21 -0
- package/dist/components/settings/HolidaysSettings.d.ts.map +1 -0
- package/dist/components/settings/LocationsCrudPage.d.ts +6 -0
- package/dist/components/settings/LocationsCrudPage.d.ts.map +1 -0
- package/dist/components/settings/LocationsOverview.d.ts +19 -0
- package/dist/components/settings/LocationsOverview.d.ts.map +1 -0
- package/dist/components/settings/SecuritySettings.d.ts +17 -0
- package/dist/components/settings/SecuritySettings.d.ts.map +1 -0
- package/dist/components/settings/SettingsPage.d.ts +46 -0
- package/dist/components/settings/SettingsPage.d.ts.map +1 -0
- package/dist/components/settings/UserProfile.d.ts +12 -0
- package/dist/components/settings/UserProfile.d.ts.map +1 -0
- package/dist/components/settings/index.d.ts +11 -0
- package/dist/components/settings/index.d.ts.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 +29 -0
- package/dist/components/shared/PersonLink.d.ts.map +1 -0
- package/dist/components/shared/create-person.d.ts +20 -0
- package/dist/components/shared/create-person.d.ts.map +1 -0
- package/dist/crud/CrudCardGrid.d.ts +13 -0
- package/dist/crud/CrudCardGrid.d.ts.map +1 -0
- package/dist/crud/CrudDetailPage.d.ts +23 -0
- package/dist/crud/CrudDetailPage.d.ts.map +1 -0
- package/dist/crud/CrudFormPage.d.ts +18 -0
- package/dist/crud/CrudFormPage.d.ts.map +1 -0
- package/dist/crud/CrudListView.d.ts +92 -0
- package/dist/crud/CrudListView.d.ts.map +1 -0
- package/dist/crud/CrudPage.d.ts +27 -0
- package/dist/crud/CrudPage.d.ts.map +1 -0
- package/dist/crud/CrudSkeletons.d.ts +21 -0
- package/dist/crud/CrudSkeletons.d.ts.map +1 -0
- package/dist/crud/DeleteConfirmDialog.d.ts +11 -0
- package/dist/crud/DeleteConfirmDialog.d.ts.map +1 -0
- package/dist/crud/EntityOverview.d.ts +14 -0
- package/dist/crud/EntityOverview.d.ts.map +1 -0
- package/dist/crud/ImportWizard.d.ts +18 -0
- package/dist/crud/ImportWizard.d.ts.map +1 -0
- package/dist/crud/archetype-lookup.d.ts +30 -0
- package/dist/crud/archetype-lookup.d.ts.map +1 -0
- package/dist/crud/archetypes/ActiveToggle.d.ts +8 -0
- package/dist/crud/archetypes/ActiveToggle.d.ts.map +1 -0
- package/dist/crud/archetypes/AddressesTab.d.ts +21 -0
- package/dist/crud/archetypes/AddressesTab.d.ts.map +1 -0
- package/dist/crud/archetypes/ArchetypeStatusBar.d.ts +11 -0
- package/dist/crud/archetypes/ArchetypeStatusBar.d.ts.map +1 -0
- package/dist/crud/archetypes/BlockSettingsPopover.d.ts +15 -0
- package/dist/crud/archetypes/BlockSettingsPopover.d.ts.map +1 -0
- package/dist/crud/archetypes/ClientOrdersTab.d.ts +18 -0
- package/dist/crud/archetypes/ClientOrdersTab.d.ts.map +1 -0
- package/dist/crud/archetypes/EntityLink.d.ts +32 -0
- package/dist/crud/archetypes/EntityLink.d.ts.map +1 -0
- package/dist/crud/archetypes/LocationDetailTabs.d.ts +11 -0
- package/dist/crud/archetypes/LocationDetailTabs.d.ts.map +1 -0
- package/dist/crud/archetypes/LocationFormLayout.d.ts +12 -0
- package/dist/crud/archetypes/LocationFormLayout.d.ts.map +1 -0
- package/dist/crud/archetypes/OrderDetailView.d.ts +115 -0
- package/dist/crud/archetypes/OrderDetailView.d.ts.map +1 -0
- package/dist/crud/archetypes/OrderFormView.d.ts +112 -0
- package/dist/crud/archetypes/OrderFormView.d.ts.map +1 -0
- package/dist/crud/archetypes/OrderListView.d.ts +36 -0
- package/dist/crud/archetypes/OrderListView.d.ts.map +1 -0
- package/dist/crud/archetypes/PersonDetailTabs.d.ts +35 -0
- package/dist/crud/archetypes/PersonDetailTabs.d.ts.map +1 -0
- package/dist/crud/archetypes/PersonFormLayout.d.ts +13 -0
- package/dist/crud/archetypes/PersonFormLayout.d.ts.map +1 -0
- package/dist/crud/archetypes/PersonPicker.d.ts +23 -0
- package/dist/crud/archetypes/PersonPicker.d.ts.map +1 -0
- package/dist/crud/archetypes/ProductDetailTabs.d.ts +11 -0
- package/dist/crud/archetypes/ProductDetailTabs.d.ts.map +1 -0
- package/dist/crud/archetypes/ProductFormLayout.d.ts +12 -0
- package/dist/crud/archetypes/ProductFormLayout.d.ts.map +1 -0
- package/dist/crud/archetypes/ScheduleEditor.d.ts +7 -0
- package/dist/crud/archetypes/ScheduleEditor.d.ts.map +1 -0
- package/dist/crud/archetypes/ServiceDetailTabs.d.ts +10 -0
- package/dist/crud/archetypes/ServiceDetailTabs.d.ts.map +1 -0
- package/dist/crud/archetypes/ServiceFormLayout.d.ts +12 -0
- package/dist/crud/archetypes/ServiceFormLayout.d.ts.map +1 -0
- package/dist/crud/archetypes/SubjectDetailTabs.d.ts +12 -0
- package/dist/crud/archetypes/SubjectDetailTabs.d.ts.map +1 -0
- package/dist/crud/archetypes/SubjectFormLayout.d.ts +14 -0
- package/dist/crud/archetypes/SubjectFormLayout.d.ts.map +1 -0
- package/dist/crud/createCrudPage.d.ts +34 -0
- package/dist/crud/createCrudPage.d.ts.map +1 -0
- package/dist/crud/csv-export.d.ts +3 -0
- package/dist/crud/csv-export.d.ts.map +1 -0
- package/dist/crud/fieldToColumn.d.ts +14 -0
- package/dist/crud/fieldToColumn.d.ts.map +1 -0
- package/dist/crud/index.d.ts +16 -0
- package/dist/crud/index.d.ts.map +1 -0
- package/dist/crud/placeholder.d.ts +7 -0
- package/dist/crud/placeholder.d.ts.map +1 -0
- package/dist/crud/relation-field.d.ts +28 -0
- package/dist/crud/relation-field.d.ts.map +1 -0
- package/dist/data/client.d.ts +14 -0
- package/dist/data/client.d.ts.map +1 -0
- package/dist/db.cjs +14 -0
- package/dist/db.cjs.map +1 -0
- package/dist/db.d.ts +2 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +3 -0
- package/dist/db.js.map +1 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useAITools.d.ts +23 -0
- package/dist/hooks/useAITools.d.ts.map +1 -0
- package/dist/hooks/useAgentSurface.d.ts +15 -0
- package/dist/hooks/useAgentSurface.d.ts.map +1 -0
- package/dist/hooks/useAuth.d.ts +16 -0
- package/dist/hooks/useAuth.d.ts.map +1 -0
- package/dist/hooks/useChat.d.ts +38 -0
- package/dist/hooks/useChat.d.ts.map +1 -0
- package/dist/hooks/useDictation.d.ts +31 -0
- package/dist/hooks/useDictation.d.ts.map +1 -0
- package/dist/hooks/useFieldRules.d.ts +6 -0
- package/dist/hooks/useFieldRules.d.ts.map +1 -0
- package/dist/hooks/useFormatters.d.ts +7 -0
- package/dist/hooks/useFormatters.d.ts.map +1 -0
- package/dist/hooks/useGlobalSearch.d.ts +10 -0
- package/dist/hooks/useGlobalSearch.d.ts.map +1 -0
- package/dist/hooks/useLayout.d.ts +16 -0
- package/dist/hooks/useLayout.d.ts.map +1 -0
- package/dist/hooks/useMicLevels.d.ts +10 -0
- package/dist/hooks/useMicLevels.d.ts.map +1 -0
- package/dist/hooks/useModuleNavigation.d.ts +27 -0
- package/dist/hooks/useModuleNavigation.d.ts.map +1 -0
- package/dist/hooks/useNotifications.d.ts +11 -0
- package/dist/hooks/useNotifications.d.ts.map +1 -0
- package/dist/hooks/usePluginPrefs.d.ts +23 -0
- package/dist/hooks/usePluginPrefs.d.ts.map +1 -0
- package/dist/hooks/usePlugins.d.ts +5 -0
- package/dist/hooks/usePlugins.d.ts.map +1 -0
- package/dist/hooks/useSystemPermission.d.ts +3 -0
- package/dist/hooks/useSystemPermission.d.ts.map +1 -0
- package/dist/hooks/useTenant.d.ts +23 -0
- package/dist/hooks/useTenant.d.ts.map +1 -0
- package/dist/hooks/useTenantPluginSettings.d.ts +12 -0
- package/dist/hooks/useTenantPluginSettings.d.ts.map +1 -0
- package/dist/hooks/useTenantPlugins.d.ts +10 -0
- package/dist/hooks/useTenantPlugins.d.ts.map +1 -0
- package/dist/hooks/useTranslation.d.ts +5 -0
- package/dist/hooks/useTranslation.d.ts.map +1 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17207 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agent-approvals.d.ts +27 -0
- package/dist/lib/agent-approvals.d.ts.map +1 -0
- package/dist/lib/agent-surface.d.ts +78 -0
- package/dist/lib/agent-surface.d.ts.map +1 -0
- package/dist/lib/ai-tool-handlers.d.ts +154 -0
- package/dist/lib/ai-tool-handlers.d.ts.map +1 -0
- package/dist/lib/apply-field-rules.d.ts +4 -0
- package/dist/lib/apply-field-rules.d.ts.map +1 -0
- package/dist/lib/assistant-delegation.d.ts +5 -0
- package/dist/lib/assistant-delegation.d.ts.map +1 -0
- package/dist/lib/assistant-feature.d.ts +8 -0
- package/dist/lib/assistant-feature.d.ts.map +1 -0
- package/dist/lib/attachments.d.ts +95 -0
- package/dist/lib/attachments.d.ts.map +1 -0
- package/dist/lib/auth-context.d.ts +5 -0
- package/dist/lib/auth-context.d.ts.map +1 -0
- package/dist/lib/cache.d.ts +18 -0
- package/dist/lib/cache.d.ts.map +1 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/core-ai-tools.d.ts +49 -0
- package/dist/lib/core-ai-tools.d.ts.map +1 -0
- package/dist/lib/create-client-orders-provider.d.ts +3 -0
- package/dist/lib/create-client-orders-provider.d.ts.map +1 -0
- package/dist/lib/csv.d.ts +14 -0
- package/dist/lib/csv.d.ts.map +1 -0
- package/dist/lib/currency.d.ts +7 -0
- package/dist/lib/currency.d.ts.map +1 -0
- package/dist/lib/dedup.d.ts +2 -0
- package/dist/lib/dedup.d.ts.map +1 -0
- package/dist/lib/entity-registry.d.ts +19 -0
- package/dist/lib/entity-registry.d.ts.map +1 -0
- package/dist/lib/entity-routes.d.ts +48 -0
- package/dist/lib/entity-routes.d.ts.map +1 -0
- package/dist/lib/fayz-agent.d.ts +23 -0
- package/dist/lib/fayz-agent.d.ts.map +1 -0
- package/dist/lib/format.d.ts +7 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/locale-config.d.ts +8 -0
- package/dist/lib/locale-config.d.ts.map +1 -0
- package/dist/lib/notes-tasks-bridge.d.ts +28 -0
- package/dist/lib/notes-tasks-bridge.d.ts.map +1 -0
- package/dist/lib/org-context.d.ts +5 -0
- package/dist/lib/org-context.d.ts.map +1 -0
- package/dist/lib/plugins.d.ts +2 -0
- package/dist/lib/plugins.d.ts.map +1 -0
- package/dist/lib/record-refs.d.ts +31 -0
- package/dist/lib/record-refs.d.ts.map +1 -0
- package/dist/lib/router.d.ts +15 -0
- package/dist/lib/router.d.ts.map +1 -0
- package/dist/lib/schedule-config.d.ts +32 -0
- package/dist/lib/schedule-config.d.ts.map +1 -0
- package/dist/lib/schedule-service.d.ts +76 -0
- package/dist/lib/schedule-service.d.ts.map +1 -0
- package/dist/lib/search-targets.d.ts +12 -0
- package/dist/lib/search-targets.d.ts.map +1 -0
- package/dist/lib/speech.d.ts +36 -0
- package/dist/lib/speech.d.ts.map +1 -0
- package/dist/lib/supabase.d.ts +10 -0
- package/dist/lib/supabase.d.ts.map +1 -0
- package/dist/org/adapters/mock.d.ts +4 -0
- package/dist/org/adapters/mock.d.ts.map +1 -0
- package/dist/org/adapters/supabase.d.ts +33 -0
- package/dist/org/adapters/supabase.d.ts.map +1 -0
- package/dist/org/cache.d.ts +29 -0
- package/dist/org/cache.d.ts.map +1 -0
- package/dist/org/context.d.ts +36 -0
- package/dist/org/context.d.ts.map +1 -0
- package/dist/org/index.d.ts +10 -0
- package/dist/org/index.d.ts.map +1 -0
- package/dist/org/index.js +5 -0
- package/dist/org/index.js.map +1 -0
- package/dist/org/store.d.ts +20 -0
- package/dist/org/store.d.ts.map +1 -0
- package/dist/org/team-rows.d.ts +45 -0
- package/dist/org/team-rows.d.ts.map +1 -0
- package/dist/permissions/PermissionGate.d.ts +12 -0
- package/dist/permissions/PermissionGate.d.ts.map +1 -0
- package/dist/permissions/context.d.ts +39 -0
- package/dist/permissions/context.d.ts.map +1 -0
- package/dist/permissions/index.d.ts +5 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +3 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/permissions/roles.d.ts +7 -0
- package/dist/permissions/roles.d.ts.map +1 -0
- package/dist/permissions/store.d.ts +21 -0
- package/dist/permissions/store.d.ts.map +1 -0
- package/dist/plugins/ModuleActionBar.d.ts +27 -0
- package/dist/plugins/ModuleActionBar.d.ts.map +1 -0
- package/dist/plugins/PluginRegistryManager.d.ts +13 -0
- package/dist/plugins/PluginRegistryManager.d.ts.map +1 -0
- package/dist/plugins/QuickActionsButton.d.ts +12 -0
- package/dist/plugins/QuickActionsButton.d.ts.map +1 -0
- package/dist/plugins/SettingsGroup.d.ts +25 -0
- package/dist/plugins/SettingsGroup.d.ts.map +1 -0
- package/dist/plugins/WidgetSlot.d.ts +8 -0
- package/dist/plugins/WidgetSlot.d.ts.map +1 -0
- package/dist/plugins/createPluginContext.d.ts +28 -0
- package/dist/plugins/createPluginContext.d.ts.map +1 -0
- package/dist/plugins/createViewRouter.d.ts +38 -0
- package/dist/plugins/createViewRouter.d.ts.map +1 -0
- package/dist/projects/ProjectsSettings.d.ts +3 -0
- package/dist/projects/ProjectsSettings.d.ts.map +1 -0
- package/dist/projects/SeuSiteWidget.d.ts +7 -0
- package/dist/projects/SeuSiteWidget.d.ts.map +1 -0
- package/dist/projects/provider.d.ts +8 -0
- package/dist/projects/provider.d.ts.map +1 -0
- package/dist/projects/store.d.ts +16 -0
- package/dist/projects/store.d.ts.map +1 -0
- package/dist/projects/types.d.ts +46 -0
- package/dist/projects/types.d.ts.map +1 -0
- package/dist/stores/auth.store.d.ts +12 -0
- package/dist/stores/auth.store.d.ts.map +1 -0
- package/dist/stores/billing.store.d.ts +2 -0
- package/dist/stores/billing.store.d.ts.map +1 -0
- package/dist/stores/chat.store.d.ts +208 -0
- package/dist/stores/chat.store.d.ts.map +1 -0
- package/dist/stores/createCrudStore.d.ts +54 -0
- package/dist/stores/createCrudStore.d.ts.map +1 -0
- package/dist/stores/index.d.ts +13 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/invite.store.d.ts +11 -0
- package/dist/stores/invite.store.d.ts.map +1 -0
- package/dist/stores/layout.store.d.ts +2 -0
- package/dist/stores/layout.store.d.ts.map +1 -0
- package/dist/stores/locale.store.d.ts +17 -0
- package/dist/stores/locale.store.d.ts.map +1 -0
- package/dist/stores/location.store.d.ts +20 -0
- package/dist/stores/location.store.d.ts.map +1 -0
- package/dist/stores/notifications.store.d.ts +12 -0
- package/dist/stores/notifications.store.d.ts.map +1 -0
- package/dist/stores/organization.store.d.ts +2 -0
- package/dist/stores/organization.store.d.ts.map +1 -0
- package/dist/stores/permissions.store.d.ts +2 -0
- package/dist/stores/permissions.store.d.ts.map +1 -0
- package/dist/stores/plugin.store.d.ts +24 -0
- package/dist/stores/plugin.store.d.ts.map +1 -0
- package/dist/stores/tenant.store.d.ts +11 -0
- package/dist/stores/tenant.store.d.ts.map +1 -0
- package/dist/stores/theme.store.d.ts +17 -0
- package/dist/stores/theme.store.d.ts.map +1 -0
- package/dist/theme/dark.d.ts +3 -0
- package/dist/theme/dark.d.ts.map +1 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/light.d.ts +3 -0
- package/dist/theme/light.d.ts.map +1 -0
- package/dist/theme/tailwind-preset.d.ts +4 -0
- package/dist/theme/tailwind-preset.d.ts.map +1 -0
- package/dist/theme/tokens.d.ts +119 -0
- package/dist/theme/tokens.d.ts.map +1 -0
- package/dist/theme/utils.d.ts +31 -0
- package/dist/theme/utils.d.ts.map +1 -0
- package/dist/types/auth-adapter.d.ts +14 -0
- package/dist/types/auth-adapter.d.ts.map +1 -0
- package/dist/types/auth.d.ts +34 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/billing.d.ts +81 -0
- package/dist/types/billing.d.ts.map +1 -0
- package/dist/types/client-orders.d.ts +47 -0
- package/dist/types/client-orders.d.ts.map +1 -0
- package/dist/types/crud.d.ts +137 -0
- package/dist/types/crud.d.ts.map +1 -0
- package/dist/types/entities.d.ts +150 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/entity-lookup.d.ts +18 -0
- package/dist/types/entity-lookup.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/integrations.d.ts +48 -0
- package/dist/types/integrations.d.ts.map +1 -0
- package/dist/types/invite.d.ts +23 -0
- package/dist/types/invite.d.ts.map +1 -0
- package/dist/types/layout.d.ts +26 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/notifications.d.ts +31 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/org-adapter.d.ts +92 -0
- package/dist/types/org-adapter.d.ts.map +1 -0
- package/dist/types/permissions.d.ts +39 -0
- package/dist/types/permissions.d.ts.map +1 -0
- package/dist/types/platform.d.ts +25 -0
- package/dist/types/platform.d.ts.map +1 -0
- package/dist/types/plugins.d.ts +269 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/tenant.d.ts +74 -0
- package/dist/types/tenant.d.ts.map +1 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +3 -0
- package/dist/ui.js.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { useTranslation } from './chunk-YUHCC7JY.js';
|
|
2
|
+
import { useBillingStore, resolvePlanBadge } from './chunk-VN5NTK26.js';
|
|
3
|
+
import { useOrganizationStore, useTenantOptional, useOrgAdapterOptional } from './chunk-PNAJODZM.js';
|
|
4
|
+
import { usePermissionsStore } from './chunk-VTEP2AQX.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Sparkles, Check, Crown, Minus } from 'lucide-react';
|
|
7
|
+
import { cn, Card, CardContent, Badge, CardHeader, Button, ConfirmDialog, toast } from '@fayz-ai/ui';
|
|
8
|
+
export { cn } from '@fayz-ai/ui';
|
|
9
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
import { invalidateCount, usePluginRuntimeOptional, getAllEntities, countByTenant } from '@fayz-ai/core';
|
|
11
|
+
import { useAuthStore } from '@fayz-ai/auth';
|
|
12
|
+
import { mergeLimitDeclarations, isEntitledByPlan, resolveAccess, resolveLimit, agentDenial } from '@fayz-ai/core/access';
|
|
13
|
+
export { UPGRADE_URL, agentDenial, isEntitledByPlan, resolveAccess } from '@fayz-ai/core/access';
|
|
14
|
+
import { create } from 'zustand';
|
|
15
|
+
|
|
16
|
+
function parsePlanFeature(feature) {
|
|
17
|
+
return feature.startsWith("*") ? { label: feature.slice(1).trim(), highlighted: true } : { label: feature, highlighted: false };
|
|
18
|
+
}
|
|
19
|
+
function PlanFeatureItem({ feature, className, iconClassName }) {
|
|
20
|
+
const { label, highlighted } = parsePlanFeature(feature);
|
|
21
|
+
return /* @__PURE__ */ jsxs("li", { className: cn("flex items-start gap-2", className, highlighted && "font-medium text-primary"), children: [
|
|
22
|
+
highlighted ? /* @__PURE__ */ jsx(Sparkles, { className: cn("mt-0.5 shrink-0 text-primary", iconClassName), "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Check, { className: cn("mt-0.5 shrink-0 text-primary", iconClassName), "aria-hidden": "true" }),
|
|
23
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
var CORE_LIMIT_DECLARATIONS = [
|
|
27
|
+
{ key: "users", label: "Users", table: "tenant_members" },
|
|
28
|
+
{ key: "locations", label: "Locations", table: "locations" }
|
|
29
|
+
];
|
|
30
|
+
function entityDerivedLimitDeclarations(entities) {
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const e of entities) {
|
|
33
|
+
const def = e.entityDef;
|
|
34
|
+
if (def?.limitKey && def.data?.table) {
|
|
35
|
+
out.push({
|
|
36
|
+
key: def.limitKey,
|
|
37
|
+
label: e.labelPlural,
|
|
38
|
+
table: def.data.table,
|
|
39
|
+
kindFilter: def.data.archetypeKind
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
var registry = /* @__PURE__ */ new Map();
|
|
46
|
+
function setLimitRegistry(declarations) {
|
|
47
|
+
const next = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const decl of declarations) next.set(decl.key, decl);
|
|
49
|
+
registry = next;
|
|
50
|
+
}
|
|
51
|
+
function getLimitDeclaration(key) {
|
|
52
|
+
return registry.get(key);
|
|
53
|
+
}
|
|
54
|
+
var listeners = /* @__PURE__ */ new Map();
|
|
55
|
+
function subscribeLimit(key, cb) {
|
|
56
|
+
let set = listeners.get(key);
|
|
57
|
+
if (!set) {
|
|
58
|
+
set = /* @__PURE__ */ new Set();
|
|
59
|
+
listeners.set(key, set);
|
|
60
|
+
}
|
|
61
|
+
set.add(cb);
|
|
62
|
+
return () => {
|
|
63
|
+
set?.delete(cb);
|
|
64
|
+
if (set && set.size === 0) listeners.delete(key);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function invalidateLimit(key) {
|
|
68
|
+
const decl = registry.get(key);
|
|
69
|
+
if (decl) invalidateCount(decl.table);
|
|
70
|
+
listeners.get(key)?.forEach((cb) => cb());
|
|
71
|
+
}
|
|
72
|
+
var useUpgradeModalStore = create((set) => ({
|
|
73
|
+
current: null,
|
|
74
|
+
open: (payload) => set({ current: payload }),
|
|
75
|
+
close: () => set({ current: null })
|
|
76
|
+
}));
|
|
77
|
+
var AccessContext = React.createContext(null);
|
|
78
|
+
function AccessProvider({ children, limitDeclarations }) {
|
|
79
|
+
const user = useAuthStore((s) => s.user);
|
|
80
|
+
const org = useOrganizationStore((s) => s.currentOrg);
|
|
81
|
+
const profile = usePermissionsStore((s) => s.currentProfile);
|
|
82
|
+
const plans = useBillingStore((s) => s.plans);
|
|
83
|
+
const runtime = usePluginRuntimeOptional();
|
|
84
|
+
const pluginLimits = runtime?.pluginLimits;
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
setLimitRegistry(
|
|
87
|
+
mergeLimitDeclarations(
|
|
88
|
+
CORE_LIMIT_DECLARATIONS,
|
|
89
|
+
entityDerivedLimitDeclarations(getAllEntities()),
|
|
90
|
+
pluginLimits,
|
|
91
|
+
limitDeclarations
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}, [pluginLimits, limitDeclarations]);
|
|
95
|
+
const plan = React.useMemo(
|
|
96
|
+
() => org?.plan ? plans.find((p) => p.id === org.plan) ?? null : null,
|
|
97
|
+
[plans, org?.plan]
|
|
98
|
+
);
|
|
99
|
+
const session = React.useMemo(
|
|
100
|
+
() => ({ user, org, profile, plan }),
|
|
101
|
+
[user, org, profile, plan]
|
|
102
|
+
);
|
|
103
|
+
const value = React.useMemo(
|
|
104
|
+
() => ({
|
|
105
|
+
session,
|
|
106
|
+
can: (feature, action) => resolveAccess(session, feature, action),
|
|
107
|
+
entitled: (feature) => isEntitledByPlan(session.plan, feature)
|
|
108
|
+
}),
|
|
109
|
+
[session]
|
|
110
|
+
);
|
|
111
|
+
return /* @__PURE__ */ jsx(AccessContext.Provider, { value, children });
|
|
112
|
+
}
|
|
113
|
+
AccessProvider.displayName = "AccessProvider";
|
|
114
|
+
var ALLOW_ALL = {
|
|
115
|
+
can: () => ({ allowed: true }),
|
|
116
|
+
entitled: () => true
|
|
117
|
+
};
|
|
118
|
+
function useAccess() {
|
|
119
|
+
const ctx = React.useContext(AccessContext);
|
|
120
|
+
if (!ctx) throw new Error("useAccess must be used inside <AccessProvider>");
|
|
121
|
+
return { can: ctx.can, entitled: ctx.entitled };
|
|
122
|
+
}
|
|
123
|
+
function useAccessOptional() {
|
|
124
|
+
const ctx = React.useContext(AccessContext);
|
|
125
|
+
return ctx ? { can: ctx.can, entitled: ctx.entitled } : ALLOW_ALL;
|
|
126
|
+
}
|
|
127
|
+
function useAccessSession() {
|
|
128
|
+
return React.useContext(AccessContext)?.session ?? null;
|
|
129
|
+
}
|
|
130
|
+
function resolveCap(plan, key) {
|
|
131
|
+
return plan?.entitlements?.limits?.[key];
|
|
132
|
+
}
|
|
133
|
+
function useLimit(key) {
|
|
134
|
+
const session = useAccessSession();
|
|
135
|
+
const tenantId = session?.org?.id;
|
|
136
|
+
const cap = resolveCap(session?.plan ?? null, key);
|
|
137
|
+
const declaration = getLimitDeclaration(key);
|
|
138
|
+
const unlimited = !declaration || cap === void 0 || cap === -1;
|
|
139
|
+
const [used, setUsed] = React.useState(0);
|
|
140
|
+
const [loading, setLoading] = React.useState(!unlimited);
|
|
141
|
+
const [version, setVersion] = React.useState(0);
|
|
142
|
+
const refresh = React.useCallback(() => setVersion((v) => v + 1), []);
|
|
143
|
+
React.useEffect(() => subscribeLimit(key, refresh), [key, refresh]);
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
if (unlimited || !declaration || !tenantId) {
|
|
146
|
+
setUsed(0);
|
|
147
|
+
setLoading(false);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let active = true;
|
|
151
|
+
setLoading(true);
|
|
152
|
+
countByTenant(declaration.table, {
|
|
153
|
+
kind: declaration.kindFilter,
|
|
154
|
+
period: declaration.period,
|
|
155
|
+
tenantId,
|
|
156
|
+
fresh: version > 0
|
|
157
|
+
}).then((n) => {
|
|
158
|
+
if (active) {
|
|
159
|
+
setUsed(n);
|
|
160
|
+
setLoading(false);
|
|
161
|
+
}
|
|
162
|
+
}).catch(() => {
|
|
163
|
+
if (active) setLoading(false);
|
|
164
|
+
});
|
|
165
|
+
return () => {
|
|
166
|
+
active = false;
|
|
167
|
+
};
|
|
168
|
+
}, [unlimited, declaration, tenantId, version]);
|
|
169
|
+
const bounds = resolveLimit({ cap, hasDeclaration: Boolean(declaration), used });
|
|
170
|
+
return { key, ...bounds, loading, refresh };
|
|
171
|
+
}
|
|
172
|
+
function useLimitGuard(key) {
|
|
173
|
+
const session = useAccessSession();
|
|
174
|
+
const tenantId = session?.org?.id;
|
|
175
|
+
const plan = session?.plan ?? null;
|
|
176
|
+
const openModal = useUpgradeModalStore((s) => s.open);
|
|
177
|
+
return React.useCallback(
|
|
178
|
+
async (n = 1) => {
|
|
179
|
+
const cap = resolveCap(plan, key);
|
|
180
|
+
const declaration = getLimitDeclaration(key);
|
|
181
|
+
if (!declaration || cap === void 0 || cap === -1 || !tenantId) return "ok";
|
|
182
|
+
const used = await countByTenant(declaration.table, {
|
|
183
|
+
kind: declaration.kindFilter,
|
|
184
|
+
period: declaration.period,
|
|
185
|
+
tenantId,
|
|
186
|
+
fresh: true
|
|
187
|
+
});
|
|
188
|
+
if (used + n > cap) {
|
|
189
|
+
openModal({ limitKey: key });
|
|
190
|
+
return "blocked";
|
|
191
|
+
}
|
|
192
|
+
return "ok";
|
|
193
|
+
},
|
|
194
|
+
[key, plan, tenantId, openModal]
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
function getAccessSnapshot() {
|
|
198
|
+
const user = useAuthStore.getState().user;
|
|
199
|
+
const org = useOrganizationStore.getState().currentOrg;
|
|
200
|
+
const profile = usePermissionsStore.getState().currentProfile;
|
|
201
|
+
const plans = useBillingStore.getState().plans;
|
|
202
|
+
const plan = org?.plan ? plans.find((p) => p.id === org.plan) ?? null : null;
|
|
203
|
+
return { user, org, profile, plan };
|
|
204
|
+
}
|
|
205
|
+
function checkAccess(feature, action) {
|
|
206
|
+
const session = getAccessSnapshot();
|
|
207
|
+
const decision = resolveAccess(session, feature, action);
|
|
208
|
+
if (decision.allowed) return { allowed: true };
|
|
209
|
+
return agentDenial(decision.reason ?? "role");
|
|
210
|
+
}
|
|
211
|
+
async function guardLimit(key, n = 1) {
|
|
212
|
+
const session = getAccessSnapshot();
|
|
213
|
+
const tenantId = session.org?.id;
|
|
214
|
+
const cap = session.plan?.entitlements?.limits?.[key];
|
|
215
|
+
const declaration = getLimitDeclaration(key);
|
|
216
|
+
if (!declaration || cap === void 0 || cap === -1 || !tenantId) return { allowed: true };
|
|
217
|
+
const used = await countByTenant(declaration.table, {
|
|
218
|
+
kind: declaration.kindFilter,
|
|
219
|
+
period: declaration.period,
|
|
220
|
+
tenantId,
|
|
221
|
+
fresh: true
|
|
222
|
+
});
|
|
223
|
+
if (used + n > cap) {
|
|
224
|
+
return agentDenial("limit", { key, max: cap, used });
|
|
225
|
+
}
|
|
226
|
+
return { allowed: true };
|
|
227
|
+
}
|
|
228
|
+
function applyNavAccess(items, access, knownFeatures) {
|
|
229
|
+
const decorate = (item) => {
|
|
230
|
+
const children = item.children ? item.children.map(decorate).filter((c) => c !== null) : void 0;
|
|
231
|
+
if (!item.feature) {
|
|
232
|
+
return children ? { ...item, children } : item;
|
|
233
|
+
}
|
|
234
|
+
if (knownFeatures.has(item.feature)) {
|
|
235
|
+
const decision = access.can(item.feature, "read");
|
|
236
|
+
if (!decision.allowed && decision.reason === "role") return null;
|
|
237
|
+
}
|
|
238
|
+
const premium = access.entitled(item.feature) === false;
|
|
239
|
+
return children ? { ...item, premium, children } : { ...item, premium };
|
|
240
|
+
};
|
|
241
|
+
return items.map(decorate).filter((i) => i !== null);
|
|
242
|
+
}
|
|
243
|
+
function useModuleNavAccess(items) {
|
|
244
|
+
const access = useAccessOptional();
|
|
245
|
+
const features = usePermissionsStore((s) => s.features);
|
|
246
|
+
const knownFeatures = React.useMemo(
|
|
247
|
+
() => new Set(features.map((f) => f.id)),
|
|
248
|
+
[features]
|
|
249
|
+
);
|
|
250
|
+
return React.useMemo(
|
|
251
|
+
() => applyNavAccess(items, access, knownFeatures),
|
|
252
|
+
[items, access, knownFeatures]
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// src/components/billing/access-contract.ts
|
|
257
|
+
function getPlanEntitlements(plan) {
|
|
258
|
+
return plan?.entitlements;
|
|
259
|
+
}
|
|
260
|
+
function featureDisplayName(label) {
|
|
261
|
+
if (!label) return "";
|
|
262
|
+
return label.replace(/\s*\([^)]*\)\s*$/, "").trim() || label.trim();
|
|
263
|
+
}
|
|
264
|
+
var CURRENCY_BY_REGION = {
|
|
265
|
+
BR: "BRL",
|
|
266
|
+
PT: "EUR",
|
|
267
|
+
ES: "EUR",
|
|
268
|
+
FR: "EUR",
|
|
269
|
+
DE: "EUR",
|
|
270
|
+
IT: "EUR",
|
|
271
|
+
NL: "EUR",
|
|
272
|
+
IE: "EUR",
|
|
273
|
+
GB: "GBP",
|
|
274
|
+
US: "USD",
|
|
275
|
+
CA: "CAD",
|
|
276
|
+
AU: "AUD",
|
|
277
|
+
MX: "MXN",
|
|
278
|
+
AR: "ARS",
|
|
279
|
+
CL: "CLP",
|
|
280
|
+
CO: "COP"
|
|
281
|
+
};
|
|
282
|
+
function resolvePlanCurrency(planCurrency, locale) {
|
|
283
|
+
if (planCurrency) return planCurrency;
|
|
284
|
+
const region = locale?.split(/[-_]/)[1]?.toUpperCase();
|
|
285
|
+
return region && CURRENCY_BY_REGION[region] || "USD";
|
|
286
|
+
}
|
|
287
|
+
function formatPrice(plan, tr) {
|
|
288
|
+
if (plan.price <= 0) return tr("billing.free", "Free");
|
|
289
|
+
try {
|
|
290
|
+
const isInteger = Number.isInteger(plan.price);
|
|
291
|
+
return new Intl.NumberFormat(void 0, {
|
|
292
|
+
style: "currency",
|
|
293
|
+
currency: plan.currency || "USD",
|
|
294
|
+
minimumFractionDigits: isInteger ? 0 : 2
|
|
295
|
+
}).format(plan.price);
|
|
296
|
+
} catch {
|
|
297
|
+
return `${plan.currency || ""} ${plan.price}`.trim();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function intervalSuffix(plan, tr) {
|
|
301
|
+
if (plan.price <= 0) return "";
|
|
302
|
+
return plan.interval === "year" ? tr("billing.perYear", "/yr") : tr("billing.perMonth", "/mo");
|
|
303
|
+
}
|
|
304
|
+
function SubscriptionPage({ className }) {
|
|
305
|
+
const { t } = useTranslation();
|
|
306
|
+
const tr = (key, fallback) => {
|
|
307
|
+
const v = t(key);
|
|
308
|
+
return !v || v === key ? fallback : v;
|
|
309
|
+
};
|
|
310
|
+
const plans = useBillingStore((s) => s.plans);
|
|
311
|
+
const checkout = useBillingStore((s) => s.checkout);
|
|
312
|
+
useTenantOptional();
|
|
313
|
+
const adapter = useOrgAdapterOptional();
|
|
314
|
+
const setCurrentOrg = useOrganizationStore((s) => s.setCurrentOrg);
|
|
315
|
+
const currentOrg = useOrganizationStore((s) => s.currentOrg);
|
|
316
|
+
const currentPlanId = currentOrg?.plan || "free";
|
|
317
|
+
const currentBadge = resolvePlanBadge(currentPlanId, plans);
|
|
318
|
+
const currentPlan = plans.find((p) => p.id === currentPlanId);
|
|
319
|
+
const [pending, setPending] = React.useState(null);
|
|
320
|
+
const [busy, setBusy] = React.useState(false);
|
|
321
|
+
const allFeatures = React.useMemo(() => {
|
|
322
|
+
const seen = /* @__PURE__ */ new Set();
|
|
323
|
+
const out = [];
|
|
324
|
+
for (const plan of plans) {
|
|
325
|
+
for (const f of plan.features) {
|
|
326
|
+
if (!seen.has(f)) {
|
|
327
|
+
seen.add(f);
|
|
328
|
+
out.push(f);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return out;
|
|
333
|
+
}, [plans]);
|
|
334
|
+
const featureCatalog = usePermissionsStore((s) => s.features);
|
|
335
|
+
const entitlementsMatrix = React.useMemo(() => {
|
|
336
|
+
const hasAny = plans.some((p) => getPlanEntitlements(p));
|
|
337
|
+
if (!hasAny) return null;
|
|
338
|
+
const featureIds = [];
|
|
339
|
+
const featureSeen = /* @__PURE__ */ new Set();
|
|
340
|
+
const limitKeys = [];
|
|
341
|
+
const limitSeen = /* @__PURE__ */ new Set();
|
|
342
|
+
for (const plan of plans) {
|
|
343
|
+
const ent = getPlanEntitlements(plan);
|
|
344
|
+
for (const id of Object.keys(ent?.features ?? {})) {
|
|
345
|
+
if (!featureSeen.has(id)) {
|
|
346
|
+
featureSeen.add(id);
|
|
347
|
+
featureIds.push(id);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
for (const key of Object.keys(ent?.limits ?? {})) {
|
|
351
|
+
if (!limitSeen.has(key)) {
|
|
352
|
+
limitSeen.add(key);
|
|
353
|
+
limitKeys.push(key);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (featureIds.length === 0 && limitKeys.length === 0) return null;
|
|
358
|
+
const labelForFeature = (id) => featureCatalog.find((f) => f.id === id)?.label ?? id;
|
|
359
|
+
const labelForLimit = (key) => {
|
|
360
|
+
const v = t(`limit.label.${key}`);
|
|
361
|
+
return !v || v === `limit.label.${key}` ? key : v;
|
|
362
|
+
};
|
|
363
|
+
return { featureIds, limitKeys, labelForFeature, labelForLimit };
|
|
364
|
+
}, [plans, featureCatalog, t]);
|
|
365
|
+
async function applyChange(plan) {
|
|
366
|
+
setBusy(true);
|
|
367
|
+
try {
|
|
368
|
+
if (checkout) {
|
|
369
|
+
await checkout(plan.id);
|
|
370
|
+
setPending(null);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (adapter && currentOrg) {
|
|
374
|
+
const updated = await adapter.updateOrg(currentOrg.id, { plan: plan.id });
|
|
375
|
+
setCurrentOrg(updated);
|
|
376
|
+
} else if (currentOrg) {
|
|
377
|
+
setCurrentOrg({ ...currentOrg, plan: plan.id });
|
|
378
|
+
}
|
|
379
|
+
toast.success(
|
|
380
|
+
tr("billing.planChanged", "Plan updated").replace("{{plan}}", plan.name)
|
|
381
|
+
);
|
|
382
|
+
setPending(null);
|
|
383
|
+
} catch {
|
|
384
|
+
toast.error(tr("billing.planChangeFailed", "Couldn't change your plan. Please try again."));
|
|
385
|
+
} finally {
|
|
386
|
+
setBusy(false);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (plans.length === 0) {
|
|
390
|
+
return /* @__PURE__ */ jsx("div", { className: className ?? "mx-auto max-w-5xl", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: tr("billing.noPlans", "No plans are configured.") }) });
|
|
391
|
+
}
|
|
392
|
+
return /* @__PURE__ */ jsxs("div", { className: className ?? "mx-auto max-w-5xl space-y-8", children: [
|
|
393
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
394
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold tracking-tight", children: tr("billing.subscription.title", "Subscription") }),
|
|
395
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: tr("billing.subscription.subtitle", "Manage your plan and unlock more features.") })
|
|
396
|
+
] }),
|
|
397
|
+
/* @__PURE__ */ jsx(
|
|
398
|
+
Card,
|
|
399
|
+
{
|
|
400
|
+
className: cn(
|
|
401
|
+
"relative overflow-hidden",
|
|
402
|
+
currentBadge.paid && "border-amber-400/60 bg-gradient-to-br from-amber-50/60 to-transparent dark:from-amber-950/20"
|
|
403
|
+
),
|
|
404
|
+
children: /* @__PURE__ */ jsxs(CardContent, { className: "flex flex-wrap items-center justify-between gap-4 p-6", children: [
|
|
405
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
406
|
+
/* @__PURE__ */ jsx(
|
|
407
|
+
"div",
|
|
408
|
+
{
|
|
409
|
+
className: cn(
|
|
410
|
+
"flex h-12 w-12 shrink-0 items-center justify-center rounded-xl",
|
|
411
|
+
currentBadge.paid ? "bg-amber-400/20 text-amber-600 dark:text-amber-400" : "bg-muted text-muted-foreground"
|
|
412
|
+
),
|
|
413
|
+
children: currentBadge.paid ? /* @__PURE__ */ jsx(Crown, { className: "h-6 w-6" }) : /* @__PURE__ */ jsx(Sparkles, { className: "h-6 w-6" })
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
417
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: tr("billing.currentPlan", "Current Plan") }),
|
|
418
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
419
|
+
/* @__PURE__ */ jsx("span", { className: "text-xl font-bold", children: currentBadge.label }),
|
|
420
|
+
currentBadge.paid && // Paid marker only — a literal "Pro" here was misleading next
|
|
421
|
+
// to non-Pro paid tiers ("Starter / Pro", QA finding).
|
|
422
|
+
/* @__PURE__ */ jsx(
|
|
423
|
+
Badge,
|
|
424
|
+
{
|
|
425
|
+
"aria-label": tr("billing.paidPlan", "Paid plan"),
|
|
426
|
+
className: "border-amber-400/40 bg-amber-400/15 text-amber-700 dark:text-amber-300",
|
|
427
|
+
children: /* @__PURE__ */ jsx(Crown, { className: "h-3 w-3" })
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] })
|
|
431
|
+
] })
|
|
432
|
+
] }),
|
|
433
|
+
currentPlan && /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
|
|
434
|
+
/* @__PURE__ */ jsx("span", { className: "text-2xl font-bold", children: formatPrice(currentPlan, tr) }),
|
|
435
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: intervalSuffix(currentPlan, tr) })
|
|
436
|
+
] })
|
|
437
|
+
] })
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3", children: plans.map((plan) => {
|
|
441
|
+
const isCurrent = plan.id === currentPlanId;
|
|
442
|
+
const paid = plan.price > 0;
|
|
443
|
+
return /* @__PURE__ */ jsxs(
|
|
444
|
+
Card,
|
|
445
|
+
{
|
|
446
|
+
className: cn(
|
|
447
|
+
"relative flex flex-col",
|
|
448
|
+
plan.highlighted && "border-primary shadow-md",
|
|
449
|
+
isCurrent && "ring-2 ring-primary/40"
|
|
450
|
+
),
|
|
451
|
+
children: [
|
|
452
|
+
plan.highlighted && /* @__PURE__ */ jsx("div", { className: "absolute -top-3 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsxs(Badge, { children: [
|
|
453
|
+
/* @__PURE__ */ jsx(Crown, { className: "mr-1 h-3 w-3" }),
|
|
454
|
+
tr("billing.mostPopular", "Most Popular")
|
|
455
|
+
] }) }),
|
|
456
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "pb-0", children: [
|
|
457
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
458
|
+
/* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold", children: plan.name }),
|
|
459
|
+
paid && /* @__PURE__ */ jsx(Crown, { className: "h-4 w-4 text-amber-500" })
|
|
460
|
+
] }),
|
|
461
|
+
plan.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: plan.description })
|
|
462
|
+
] }),
|
|
463
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "flex flex-1 flex-col pt-4", children: [
|
|
464
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
465
|
+
/* @__PURE__ */ jsx("span", { className: "text-4xl font-bold", children: formatPrice(plan, tr) }),
|
|
466
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: intervalSuffix(plan, tr) })
|
|
467
|
+
] }),
|
|
468
|
+
/* @__PURE__ */ jsx("ul", { className: "mb-6 flex-1 space-y-3", children: plan.features.map((feature) => /* @__PURE__ */ jsx(PlanFeatureItem, { feature, className: "text-sm", iconClassName: "h-4 w-4" }, feature)) }),
|
|
469
|
+
isCurrent ? /* @__PURE__ */ jsx(Button, { variant: "outline", className: "w-full", disabled: true, children: tr("billing.currentPlan", "Current Plan") }) : /* @__PURE__ */ jsx(
|
|
470
|
+
Button,
|
|
471
|
+
{
|
|
472
|
+
className: "w-full",
|
|
473
|
+
variant: plan.highlighted ? "default" : "outline",
|
|
474
|
+
onClick: () => setPending(plan),
|
|
475
|
+
children: tr("billing.changeToPlan", "Switch to this plan")
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
] })
|
|
479
|
+
]
|
|
480
|
+
},
|
|
481
|
+
plan.id
|
|
482
|
+
);
|
|
483
|
+
}) }),
|
|
484
|
+
(entitlementsMatrix || allFeatures.length > 0) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
485
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: tr("billing.featureMatrix", "Feature comparison") }),
|
|
486
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-lg border", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm", children: [
|
|
487
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b bg-muted/40", children: [
|
|
488
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left font-medium", children: tr("billing.features", "Features") }),
|
|
489
|
+
plans.map((plan) => /* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-center font-medium", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
|
|
490
|
+
plan.price > 0 && /* @__PURE__ */ jsx(Crown, { className: "h-3.5 w-3.5 text-amber-500" }),
|
|
491
|
+
plan.name
|
|
492
|
+
] }) }, plan.id))
|
|
493
|
+
] }) }),
|
|
494
|
+
/* @__PURE__ */ jsx("tbody", { children: entitlementsMatrix ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
495
|
+
entitlementsMatrix.featureIds.map((id, i) => /* @__PURE__ */ jsxs("tr", { className: cn(i % 2 === 1 && "bg-muted/20"), children: [
|
|
496
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-left", children: entitlementsMatrix.labelForFeature(id) }),
|
|
497
|
+
plans.map((plan) => {
|
|
498
|
+
const entitled = getPlanEntitlements(plan)?.features?.[id] !== false;
|
|
499
|
+
return /* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-center", children: entitled ? /* @__PURE__ */ jsx(Check, { className: "mx-auto h-4 w-4 text-primary" }) : /* @__PURE__ */ jsx(Minus, { className: "mx-auto h-4 w-4 text-muted-foreground/40" }) }, plan.id);
|
|
500
|
+
})
|
|
501
|
+
] }, `f:${id}`)),
|
|
502
|
+
entitlementsMatrix.limitKeys.map((key, i) => /* @__PURE__ */ jsxs("tr", { className: cn((entitlementsMatrix.featureIds.length + i) % 2 === 1 && "bg-muted/20"), children: [
|
|
503
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-left", children: entitlementsMatrix.labelForLimit(key) }),
|
|
504
|
+
plans.map((plan) => {
|
|
505
|
+
const cap = getPlanEntitlements(plan)?.limits?.[key];
|
|
506
|
+
const cell = cap === void 0 ? "\u2014" : cap < 0 ? tr("billing.unlimited", "Unlimited") : tr("billing.upTo", "Up to {count}").replace("{count}", String(cap)).replace("{{count}}", String(cap));
|
|
507
|
+
return /* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-center text-muted-foreground", children: cell }, plan.id);
|
|
508
|
+
})
|
|
509
|
+
] }, `l:${key}`))
|
|
510
|
+
] }) : allFeatures.map((feature, i) => /* @__PURE__ */ jsxs("tr", { className: cn(i % 2 === 1 && "bg-muted/20"), children: [
|
|
511
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-left", children: parsePlanFeature(feature).label }),
|
|
512
|
+
plans.map((plan) => /* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-center", children: plan.features.includes(feature) ? /* @__PURE__ */ jsx(Check, { className: "mx-auto h-4 w-4 text-primary" }) : /* @__PURE__ */ jsx(Minus, { className: "mx-auto h-4 w-4 text-muted-foreground/40" }) }, plan.id))
|
|
513
|
+
] }, feature)) })
|
|
514
|
+
] }) })
|
|
515
|
+
] }),
|
|
516
|
+
/* @__PURE__ */ jsx(
|
|
517
|
+
ConfirmDialog,
|
|
518
|
+
{
|
|
519
|
+
open: pending !== null,
|
|
520
|
+
onConfirm: () => pending && void applyChange(pending),
|
|
521
|
+
onCancel: () => setPending(null),
|
|
522
|
+
title: tr("billing.changePlanConfirmTitle", "Change plan?"),
|
|
523
|
+
description: pending ? tr("billing.changePlanConfirmBody", "You're switching to the {{plan}} plan.").replace("{{plan}}", pending.name) : void 0,
|
|
524
|
+
confirmLabel: tr("billing.changePlanConfirm", "Switch plan"),
|
|
525
|
+
cancelLabel: tr("common.cancel", "Cancel"),
|
|
526
|
+
loading: busy
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] });
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export { AccessProvider, CORE_LIMIT_DECLARATIONS, PlanFeatureItem, SubscriptionPage, checkAccess, entityDerivedLimitDeclarations, featureDisplayName, getAccessSnapshot, getPlanEntitlements, guardLimit, invalidateLimit, resolvePlanCurrency, useAccess, useAccessOptional, useLimit, useLimitGuard, useModuleNavAccess, useUpgradeModalStore };
|
|
533
|
+
//# sourceMappingURL=chunk-5O2UJAQ7.js.map
|
|
534
|
+
//# sourceMappingURL=chunk-5O2UJAQ7.js.map
|