@fayz-ai/admin 0.47.0 → 0.48.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/dist/ImportWizard-SYP3OXZU.js +3 -0
- package/dist/{ImportWizard-7UFB2PPF.js.map → ImportWizard-SYP3OXZU.js.map} +1 -1
- package/dist/PersonTimeline-X7JTPUWJ.js +3 -0
- package/dist/PersonTimeline-X7JTPUWJ.js.map +1 -0
- package/dist/ScheduleEditor-BXWJ7CMI.js +6 -0
- package/dist/{ScheduleEditor-MNHZCQIG.js.map → ScheduleEditor-BXWJ7CMI.js.map} +1 -1
- package/dist/SubscriptionPage-VBDDRSVW.js +8 -0
- package/dist/{SubscriptionPage-JWWS44SE.js.map → SubscriptionPage-VBDDRSVW.js.map} +1 -1
- package/dist/access/ModuleUnavailable.d.ts +14 -0
- package/dist/access/ModuleUnavailable.d.ts.map +1 -0
- package/dist/access/context.d.ts.map +1 -1
- package/dist/access/useModuleAccess.d.ts +11 -0
- package/dist/access/useModuleAccess.d.ts.map +1 -0
- package/dist/app/AdminShell.d.ts +1 -1
- package/dist/app/AdminShell.d.ts.map +1 -1
- package/dist/app/OfflineBoot.d.ts.map +1 -1
- package/dist/app/admin-app.d.ts +1 -1
- package/dist/app/admin-app.d.ts.map +1 -1
- package/dist/app/config.d.ts +3 -3
- package/dist/app/config.d.ts.map +1 -1
- package/dist/app/rail-preset.d.ts.map +1 -1
- package/dist/billing/TrialWidget.d.ts.map +1 -1
- package/dist/billing/ai-usage.d.ts +67 -0
- package/dist/billing/ai-usage.d.ts.map +1 -0
- package/dist/billing/index.d.ts +2 -0
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/index.js +3 -2
- package/dist/billing/module-families.d.ts +25 -0
- package/dist/billing/module-families.d.ts.map +1 -0
- package/dist/billing/module-pricing.d.ts +199 -0
- package/dist/billing/module-pricing.d.ts.map +1 -0
- package/dist/{chunk-IUCDHAAB.js → chunk-2Q6QHTZV.js} +13 -78
- package/dist/chunk-2Q6QHTZV.js.map +1 -0
- package/dist/{chunk-46UABOOC.js → chunk-5GCC7YCE.js} +40 -39
- package/dist/chunk-5GCC7YCE.js.map +1 -0
- package/dist/{chunk-WXNTUCX3.js → chunk-E4MESMNR.js} +10 -4
- package/dist/chunk-E4MESMNR.js.map +1 -0
- package/dist/chunk-F346TYKO.js +1448 -0
- package/dist/chunk-F346TYKO.js.map +1 -0
- package/dist/chunk-GZWX4ZIK.js +111 -0
- package/dist/chunk-GZWX4ZIK.js.map +1 -0
- package/dist/{chunk-OINP2UYL.js → chunk-KVIINVY6.js} +133 -169
- package/dist/chunk-KVIINVY6.js.map +1 -0
- package/dist/chunk-OEY3V6J3.js +581 -0
- package/dist/chunk-OEY3V6J3.js.map +1 -0
- package/dist/{chunk-V2IBAF4O.js → chunk-ZMP52ZHM.js} +23 -83
- package/dist/chunk-ZMP52ZHM.js.map +1 -0
- package/dist/components/RightRail.d.ts.map +1 -1
- package/dist/components/auth/CenteredLogin.d.ts +1 -1
- package/dist/components/auth/CenteredLogin.d.ts.map +1 -1
- package/dist/components/auth/LoginForm.d.ts +1 -1
- package/dist/components/auth/LoginForm.d.ts.map +1 -1
- package/dist/components/auth/LoginPage.d.ts +1 -1
- package/dist/components/auth/LoginPage.d.ts.map +1 -1
- package/dist/components/auth/OAuthButtons.d.ts +1 -1
- package/dist/components/auth/OAuthButtons.d.ts.map +1 -1
- package/dist/components/auth/ProtectedRoute.d.ts +1 -1
- package/dist/components/auth/ProtectedRoute.d.ts.map +1 -1
- package/dist/components/auth/RecoveryForm.d.ts.map +1 -1
- package/dist/components/auth/SignupForm.d.ts.map +1 -1
- package/dist/components/auth/SplitLogin.d.ts +1 -1
- package/dist/components/auth/SplitLogin.d.ts.map +1 -1
- package/dist/components/billing/AiUsageSection.d.ts +16 -0
- package/dist/components/billing/AiUsageSection.d.ts.map +1 -0
- package/dist/components/billing/InvoiceList.d.ts +1 -1
- package/dist/components/billing/InvoiceList.d.ts.map +1 -1
- package/dist/components/billing/PlanCheckoutSheet.d.ts +24 -0
- package/dist/components/billing/PlanCheckoutSheet.d.ts.map +1 -0
- package/dist/components/billing/PlanSelector.d.ts +1 -1
- package/dist/components/billing/PlanSelector.d.ts.map +1 -1
- package/dist/components/billing/PricingOverview.d.ts +20 -0
- package/dist/components/billing/PricingOverview.d.ts.map +1 -0
- package/dist/components/billing/SoftLimitWidget.d.ts.map +1 -1
- package/dist/components/billing/SubscriptionCard.d.ts +1 -1
- package/dist/components/billing/SubscriptionCard.d.ts.map +1 -1
- package/dist/components/billing/SubscriptionPage.d.ts.map +1 -1
- package/dist/components/billing/UpgradePrompt.d.ts.map +1 -1
- package/dist/components/billing/access-contract.d.ts +5 -3
- package/dist/components/billing/access-contract.d.ts.map +1 -1
- package/dist/components/billing/plan-feature.d.ts.map +1 -1
- package/dist/components/chat/AssistantActivityBar.d.ts.map +1 -1
- package/dist/components/chat/AssistantInvite.d.ts.map +1 -1
- package/dist/components/chat/AssistantRecordingView.d.ts.map +1 -1
- package/dist/components/chat/ChatAttachments.d.ts.map +1 -1
- package/dist/components/chat/ChatComposer.d.ts.map +1 -1
- package/dist/components/chat/ChatConversation.d.ts.map +1 -1
- package/dist/components/chat/ChatFab.d.ts.map +1 -1
- package/dist/components/chat/ChatHistory.d.ts.map +1 -1
- package/dist/components/chat/ChatMessages.d.ts.map +1 -1
- package/dist/components/chat/ChatSuggestions.d.ts.map +1 -1
- package/dist/components/chat/ChoiceCard.d.ts.map +1 -1
- package/dist/components/chat/ConfirmActionCard.d.ts.map +1 -1
- package/dist/components/chat/ConnectorSuggestionCard.d.ts.map +1 -1
- package/dist/components/chat/RecordChip.d.ts.map +1 -1
- package/dist/components/chat/TourCoachCard.d.ts.map +1 -1
- package/dist/components/connect/AddConnectorPanel.d.ts.map +1 -1
- package/dist/components/connect/ConnectConsentPage.d.ts.map +1 -1
- package/dist/components/connect/ConnectorDetail.d.ts.map +1 -1
- package/dist/components/connect/ConnectorRow.d.ts.map +1 -1
- package/dist/components/connect/ConnectorSyncActions.d.ts.map +1 -1
- package/dist/components/connect/ConnectorsPanel.d.ts.map +1 -1
- package/dist/components/layout/BottomNav.d.ts.map +1 -1
- package/dist/components/notifications/NotificationInbox.d.ts +1 -1
- package/dist/components/notifications/NotificationInbox.d.ts.map +1 -1
- package/dist/components/notifications/UpdateReady.d.ts.map +1 -1
- package/dist/components/organization/PermissionMatrixEditor.d.ts.map +1 -1
- package/dist/components/organization/PermissionProfilesTab.d.ts.map +1 -1
- package/dist/components/organization/TeamTab.d.ts.map +1 -1
- package/dist/components/plugins/ConnectorsHub.d.ts.map +1 -1
- package/dist/components/plugins/PluginSettingsPanel.d.ts.map +1 -1
- package/dist/components/settings/AddModulesPanel.d.ts.map +1 -1
- package/dist/components/settings/BrandingSettings.d.ts.map +1 -1
- package/dist/components/settings/CompanySettings.d.ts +1 -1
- package/dist/components/settings/CompanySettings.d.ts.map +1 -1
- package/dist/components/settings/ConnectedCompanySettings.d.ts.map +1 -1
- package/dist/components/settings/ConnectedFieldRulesSettings.d.ts.map +1 -1
- package/dist/components/settings/ConnectedModulesSettings.d.ts.map +1 -1
- package/dist/components/settings/ConnectedSecuritySettings.d.ts.map +1 -1
- package/dist/components/settings/FieldRulesEditor.d.ts +12 -0
- package/dist/components/settings/FieldRulesEditor.d.ts.map +1 -0
- package/dist/components/settings/FieldRulesSettings.d.ts.map +1 -1
- package/dist/components/settings/HolidaysSettings.d.ts.map +1 -1
- package/dist/components/settings/ModuleCard.d.ts +18 -3
- package/dist/components/settings/ModuleCard.d.ts.map +1 -1
- package/dist/components/settings/ModuleFamilyBits.d.ts +4 -0
- package/dist/components/settings/ModuleFamilyBits.d.ts.map +1 -0
- package/dist/components/settings/ModulesSettings.d.ts +3 -1
- package/dist/components/settings/ModulesSettings.d.ts.map +1 -1
- package/dist/components/settings/SecuritySettings.d.ts +1 -1
- package/dist/components/settings/SecuritySettings.d.ts.map +1 -1
- package/dist/components/settings/SettingsPage.d.ts +19 -0
- package/dist/components/settings/SettingsPage.d.ts.map +1 -1
- package/dist/components/settings/UserProfile.d.ts +1 -1
- package/dist/components/settings/UserProfile.d.ts.map +1 -1
- package/dist/components/settings/module-links.d.ts +10 -0
- package/dist/components/settings/module-links.d.ts.map +1 -0
- package/dist/components/settings/module-scope.d.ts +28 -0
- package/dist/components/settings/module-scope.d.ts.map +1 -0
- package/dist/components/settings/settings-focus.d.ts +17 -0
- package/dist/components/settings/settings-focus.d.ts.map +1 -0
- package/dist/components/settings/settings-parents.d.ts +11 -0
- package/dist/components/settings/settings-parents.d.ts.map +1 -0
- package/dist/components/settings/settings-sections.d.ts +56 -0
- package/dist/components/settings/settings-sections.d.ts.map +1 -0
- package/dist/components/settings/settings-shortcuts.d.ts +7 -0
- package/dist/components/settings/settings-shortcuts.d.ts.map +1 -0
- package/dist/components/settings/settings-subtabs.d.ts +14 -0
- package/dist/components/settings/settings-subtabs.d.ts.map +1 -0
- package/dist/components/shared/ContactPicker.d.ts.map +1 -1
- package/dist/components/shared/PersonLink.d.ts.map +1 -1
- package/dist/components/shared/RecordPickerModal.d.ts.map +1 -1
- package/dist/components/survey/PublicSurveyPage.d.ts.map +1 -1
- 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/EntityOverview.d.ts.map +1 -1
- package/dist/crud/ImportWizard.d.ts.map +1 -1
- package/dist/crud/InlineField.d.ts +36 -0
- package/dist/crud/InlineField.d.ts.map +1 -0
- package/dist/crud/LookupCreateInline.d.ts.map +1 -1
- package/dist/crud/RelatedSection.d.ts.map +1 -1
- package/dist/crud/TagsField.d.ts.map +1 -1
- package/dist/crud/archetypes/AccessTab.d.ts.map +1 -1
- package/dist/crud/archetypes/ActiveToggle.d.ts.map +1 -1
- package/dist/crud/archetypes/AddressFormModal.d.ts +34 -0
- package/dist/crud/archetypes/AddressFormModal.d.ts.map +1 -0
- package/dist/crud/archetypes/AddressesTab.d.ts +2 -20
- package/dist/crud/archetypes/AddressesTab.d.ts.map +1 -1
- package/dist/crud/archetypes/ArchetypeStatusBar.d.ts.map +1 -1
- package/dist/crud/archetypes/BlockSettingsPopover.d.ts +1 -1
- package/dist/crud/archetypes/BlockSettingsPopover.d.ts.map +1 -1
- package/dist/crud/archetypes/ClientOrdersTab.d.ts.map +1 -1
- package/dist/crud/archetypes/KanbanBoard.d.ts.map +1 -1
- package/dist/crud/archetypes/LocationFormLayout.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderBoardView.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderCreateScreen.d.ts +3 -1
- package/dist/crud/archetypes/OrderCreateScreen.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderDetailPage.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderDetailRail.d.ts.map +1 -1
- package/dist/crud/archetypes/OrderFormView.d.ts.map +1 -1
- package/dist/crud/archetypes/PayeeAccountsSection.d.ts.map +1 -1
- package/dist/crud/archetypes/PaymentStatusBadge.d.ts.map +1 -1
- package/dist/crud/archetypes/PersonPicker.d.ts.map +1 -1
- package/dist/crud/archetypes/ScheduleDateExceptions.d.ts.map +1 -1
- package/dist/crud/archetypes/ScheduleGridPanel.d.ts.map +1 -1
- package/dist/crud/fieldToColumn.d.ts.map +1 -1
- package/dist/db.cjs +831 -5
- package/dist/db.d.ts +2 -1
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +1 -1
- package/dist/directory/AppSwitcher.d.ts.map +1 -1
- package/dist/handbook/NotebookPanel.d.ts.map +1 -1
- package/dist/hooks/useAITools.d.ts.map +1 -1
- package/dist/hooks/useAuth.d.ts +3 -3
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useChat.d.ts.map +1 -1
- package/dist/hooks/useFieldRules.d.ts +4 -2
- package/dist/hooks/useFieldRules.d.ts.map +1 -1
- package/dist/hooks/useFormatters.d.ts.map +1 -1
- package/dist/hooks/useGlobalSearch.d.ts.map +1 -1
- package/dist/hooks/useLayout.d.ts.map +1 -1
- package/dist/hooks/useNotifications.d.ts +1 -1
- package/dist/hooks/useNotifications.d.ts.map +1 -1
- package/dist/hooks/useTenant.d.ts +2 -2
- package/dist/hooks/useTenant.d.ts.map +1 -1
- package/dist/hooks/useTenantPlugins.d.ts +1 -1
- package/dist/impersonation/ImpersonationBanner.d.ts.map +1 -1
- package/dist/index.d.ts +48 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4945 -4555
- package/dist/index.js.map +1 -1
- package/dist/lib/currency.d.ts +6 -0
- package/dist/lib/currency.d.ts.map +1 -1
- package/dist/lib/field-rules-db.d.ts +36 -0
- package/dist/lib/field-rules-db.d.ts.map +1 -0
- package/dist/onboarding/ActivationProvider.d.ts.map +1 -1
- package/dist/onboarding/activation.store.d.ts +1 -1
- package/dist/onboarding/activation.store.d.ts.map +1 -1
- package/dist/onboarding/checklist.d.ts +1 -1
- package/dist/onboarding/checklist.d.ts.map +1 -1
- package/dist/onboarding/tasks.d.ts +1 -1
- package/dist/onboarding/tasks.d.ts.map +1 -1
- package/dist/org/WorkspaceChooser.d.ts.map +1 -1
- package/dist/org/WorkspaceUnitSheet.d.ts.map +1 -1
- package/dist/org/adapters/supabase.d.ts +1 -0
- package/dist/org/adapters/supabase.d.ts.map +1 -1
- package/dist/org/index.js +2 -2
- package/dist/permissions/v1-catalog.d.ts +16 -0
- package/dist/permissions/v1-catalog.d.ts.map +1 -0
- package/dist/plugins/PluginRegistryManager.d.ts.map +1 -1
- package/dist/plugins/QuickActionsButton.d.ts.map +1 -1
- package/dist/plugins/SettingsGroup.d.ts +12 -4
- package/dist/plugins/SettingsGroup.d.ts.map +1 -1
- package/dist/plugins/WidgetSlot.d.ts.map +1 -1
- package/dist/projects/ProjectsSettings.d.ts.map +1 -1
- package/dist/projects/SeuSiteWidget.d.ts.map +1 -1
- package/dist/settings/MessageTemplateRow.d.ts +16 -0
- package/dist/settings/MessageTemplateRow.d.ts.map +1 -0
- package/dist/settings/SettingsForm.d.ts +60 -0
- package/dist/settings/SettingsForm.d.ts.map +1 -0
- package/dist/settings/UnitScopePicker.d.ts +22 -0
- package/dist/settings/UnitScopePicker.d.ts.map +1 -0
- package/dist/settings/core-v1-tabs.d.ts +8 -0
- package/dist/settings/core-v1-tabs.d.ts.map +1 -0
- package/dist/settings/defineSettingsTab.d.ts +17 -0
- package/dist/settings/defineSettingsTab.d.ts.map +1 -0
- package/dist/settings/registry-parent.d.ts +8 -0
- package/dist/settings/registry-parent.d.ts.map +1 -0
- package/dist/settings/useSettingKeys.d.ts +28 -0
- package/dist/settings/useSettingKeys.d.ts.map +1 -0
- package/dist/stores/auth.store.d.ts +1 -1
- package/dist/stores/auth.store.d.ts.map +1 -1
- package/dist/stores/notifications.store.d.ts +1 -1
- package/dist/stores/notifications.store.d.ts.map +1 -1
- package/dist/stores/tenant.store.d.ts +1 -1
- package/dist/stores/tenant.store.d.ts.map +1 -1
- package/dist/tasks/TasksPanel.d.ts +4 -0
- package/dist/tasks/TasksPanel.d.ts.map +1 -0
- package/dist/tasks/TasksRailPanel.d.ts.map +1 -1
- package/dist/tasks/index.d.ts +15 -14
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/timeline/PersonTimeline.d.ts +1 -0
- package/dist/timeline/PersonTimeline.d.ts.map +1 -1
- package/dist/types/billing.d.ts +2 -0
- package/dist/types/billing.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +2 -0
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/ui.d.ts +2 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +1 -1
- package/dist/units/MemberUnitsCell.d.ts.map +1 -1
- package/dist/units/UnitMembersTab.d.ts.map +1 -1
- package/dist/units/UnitSwitcher.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/ImportWizard-7UFB2PPF.js +0 -3
- package/dist/ScheduleEditor-MNHZCQIG.js +0 -6
- package/dist/SubscriptionPage-JWWS44SE.js +0 -9
- package/dist/access/index.d.ts +0 -12
- package/dist/access/index.d.ts.map +0 -1
- package/dist/access/resolver.d.ts +0 -2
- package/dist/access/resolver.d.ts.map +0 -1
- package/dist/app/LoginPage.d.ts +0 -3
- package/dist/app/LoginPage.d.ts.map +0 -1
- package/dist/chunk-46UABOOC.js.map +0 -1
- package/dist/chunk-IUCDHAAB.js.map +0 -1
- package/dist/chunk-OINP2UYL.js.map +0 -1
- package/dist/chunk-QOS6UAQ4.js +0 -54
- package/dist/chunk-QOS6UAQ4.js.map +0 -1
- package/dist/chunk-V2IBAF4O.js.map +0 -1
- package/dist/chunk-VH4LLIMH.js +0 -531
- package/dist/chunk-VH4LLIMH.js.map +0 -1
- package/dist/chunk-WXNTUCX3.js.map +0 -1
- package/dist/components/auth/index.d.ts +0 -7
- package/dist/components/auth/index.d.ts.map +0 -1
- package/dist/components/layout/index.d.ts +0 -6
- package/dist/components/layout/index.d.ts.map +0 -1
- package/dist/components/notifications/index.d.ts +0 -5
- package/dist/components/notifications/index.d.ts.map +0 -1
- package/dist/components/organization/index.d.ts +0 -5
- package/dist/components/organization/index.d.ts.map +0 -1
- package/dist/components/settings/index.d.ts +0 -11
- package/dist/components/settings/index.d.ts.map +0 -1
- package/dist/crud/index.d.ts +0 -18
- package/dist/crud/index.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -20
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/lib/format.d.ts +0 -7
- package/dist/lib/format.d.ts.map +0 -1
- package/dist/lib/plugins.d.ts +0 -2
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/stores/billing.store.d.ts +0 -2
- package/dist/stores/billing.store.d.ts.map +0 -1
- package/dist/stores/index.d.ts +0 -13
- package/dist/stores/index.d.ts.map +0 -1
- package/dist/stores/layout.store.d.ts +0 -2
- package/dist/stores/layout.store.d.ts.map +0 -1
- package/dist/stores/permissions.store.d.ts +0 -2
- package/dist/stores/permissions.store.d.ts.map +0 -1
- package/dist/tasks/components/TaskCard.d.ts +0 -11
- package/dist/tasks/components/TaskCard.d.ts.map +0 -1
- package/dist/tasks/components/TaskDetail.d.ts +0 -5
- package/dist/tasks/components/TaskDetail.d.ts.map +0 -1
- package/dist/tasks/components/TaskLabelBadge.d.ts +0 -9
- package/dist/tasks/components/TaskLabelBadge.d.ts.map +0 -1
- package/dist/tasks/components/TaskPriorityBadge.d.ts +0 -7
- package/dist/tasks/components/TaskPriorityBadge.d.ts.map +0 -1
- package/dist/tasks/components/TaskQuickAdd.d.ts +0 -5
- package/dist/tasks/components/TaskQuickAdd.d.ts.map +0 -1
- package/dist/tasks/components/TaskSourceBadge.d.ts +0 -5
- package/dist/tasks/components/TaskSourceBadge.d.ts.map +0 -1
- package/dist/tasks/components/TaskStatusGroup.d.ts +0 -17
- package/dist/tasks/components/TaskStatusGroup.d.ts.map +0 -1
- package/dist/tasks/components/TasksFilterBar.d.ts +0 -3
- package/dist/tasks/components/TasksFilterBar.d.ts.map +0 -1
- package/dist/tasks/components/TasksPanel.d.ts +0 -14
- package/dist/tasks/components/TasksPanel.d.ts.map +0 -1
- package/dist/tasks/data/mock.d.ts +0 -3
- package/dist/tasks/data/mock.d.ts.map +0 -1
- package/dist/tasks/data/supabase.d.ts +0 -3
- package/dist/tasks/data/supabase.d.ts.map +0 -1
- package/dist/tasks/entity.d.ts +0 -11
- package/dist/tasks/entity.d.ts.map +0 -1
- package/dist/tasks/store.d.ts +0 -34
- package/dist/tasks/store.d.ts.map +0 -1
- package/dist/tasks/types.d.ts +0 -89
- package/dist/tasks/types.d.ts.map +0 -1
- package/dist/theme/index.d.ts +0 -8
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/timeline/index.d.ts +0 -7
- package/dist/timeline/index.d.ts.map +0 -1
- package/dist/timeline-LECYQ4IA.js +0 -3
- package/dist/timeline-LECYQ4IA.js.map +0 -1
- package/dist/types/index.d.ts +0 -16
- package/dist/types/index.d.ts.map +0 -1
package/dist/chunk-VH4LLIMH.js
DELETED
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
import { useTranslation } from './chunk-YUHCC7JY.js';
|
|
2
|
-
import { useBillingStore, useTrial, effectivePlan, resolvePlanBadge } from './chunk-IUCDHAAB.js';
|
|
3
|
-
import { useTenantOptional, useOrgAdapterOptional } from './chunk-V2IBAF4O.js';
|
|
4
|
-
import { usePermissionsStore } from './chunk-UQ2NTFQC.js';
|
|
5
|
-
import { cn, useOrganizationStore } from './chunk-QOS6UAQ4.js';
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
import { Sparkles, Check, Crown, Minus } from 'lucide-react';
|
|
8
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
|
-
import { Card, CardContent, Badge, CardHeader, Button, ConfirmDialog, toast } from '@fayz-ai/ui';
|
|
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: "v_team_members" },
|
|
28
|
-
{ key: "locations", label: "Companies", table: "v_units" }
|
|
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, trialPlanId }) {
|
|
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 trial = useTrial();
|
|
96
|
-
const plan = React.useMemo(
|
|
97
|
-
() => effectivePlan(org, plans, trial, trialPlanId),
|
|
98
|
-
[plans, org?.plan, trial.status, trialPlanId]
|
|
99
|
-
);
|
|
100
|
-
const session = React.useMemo(
|
|
101
|
-
() => ({ user, org, profile, plan }),
|
|
102
|
-
[user, org, profile, plan]
|
|
103
|
-
);
|
|
104
|
-
const value = React.useMemo(
|
|
105
|
-
() => ({
|
|
106
|
-
session,
|
|
107
|
-
can: (feature, action) => resolveAccess(session, feature, action),
|
|
108
|
-
entitled: (feature) => isEntitledByPlan(session.plan, feature)
|
|
109
|
-
}),
|
|
110
|
-
[session]
|
|
111
|
-
);
|
|
112
|
-
return /* @__PURE__ */ jsx(AccessContext.Provider, { value, children });
|
|
113
|
-
}
|
|
114
|
-
AccessProvider.displayName = "AccessProvider";
|
|
115
|
-
var ALLOW_ALL = {
|
|
116
|
-
can: () => ({ allowed: true }),
|
|
117
|
-
entitled: () => true
|
|
118
|
-
};
|
|
119
|
-
function useAccess() {
|
|
120
|
-
const ctx = React.useContext(AccessContext);
|
|
121
|
-
if (!ctx) throw new Error("useAccess must be used inside <AccessProvider>");
|
|
122
|
-
return { can: ctx.can, entitled: ctx.entitled };
|
|
123
|
-
}
|
|
124
|
-
function useAccessOptional() {
|
|
125
|
-
const ctx = React.useContext(AccessContext);
|
|
126
|
-
return ctx ? { can: ctx.can, entitled: ctx.entitled } : ALLOW_ALL;
|
|
127
|
-
}
|
|
128
|
-
function useAccessSession() {
|
|
129
|
-
return React.useContext(AccessContext)?.session ?? null;
|
|
130
|
-
}
|
|
131
|
-
function resolveCap(plan, key) {
|
|
132
|
-
return plan?.entitlements?.limits?.[key];
|
|
133
|
-
}
|
|
134
|
-
function useLimit(key) {
|
|
135
|
-
const session = useAccessSession();
|
|
136
|
-
const tenantId = session?.org?.id;
|
|
137
|
-
const cap = resolveCap(session?.plan ?? null, key);
|
|
138
|
-
const declaration = getLimitDeclaration(key);
|
|
139
|
-
const unlimited = !declaration || cap === void 0 || cap === -1;
|
|
140
|
-
const [used, setUsed] = React.useState(0);
|
|
141
|
-
const [loading, setLoading] = React.useState(!unlimited);
|
|
142
|
-
const [version, setVersion] = React.useState(0);
|
|
143
|
-
const refresh = React.useCallback(() => setVersion((v) => v + 1), []);
|
|
144
|
-
React.useEffect(() => subscribeLimit(key, refresh), [key, refresh]);
|
|
145
|
-
React.useEffect(() => {
|
|
146
|
-
if (unlimited || !declaration || !tenantId) {
|
|
147
|
-
setUsed(0);
|
|
148
|
-
setLoading(false);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
let active = true;
|
|
152
|
-
setLoading(true);
|
|
153
|
-
countByTenant(declaration.table, {
|
|
154
|
-
kind: declaration.kindFilter,
|
|
155
|
-
period: declaration.period,
|
|
156
|
-
tenantId,
|
|
157
|
-
fresh: version > 0
|
|
158
|
-
}).then((n) => {
|
|
159
|
-
if (active) {
|
|
160
|
-
setUsed(n);
|
|
161
|
-
setLoading(false);
|
|
162
|
-
}
|
|
163
|
-
}).catch(() => {
|
|
164
|
-
if (active) setLoading(false);
|
|
165
|
-
});
|
|
166
|
-
return () => {
|
|
167
|
-
active = false;
|
|
168
|
-
};
|
|
169
|
-
}, [unlimited, declaration, tenantId, version]);
|
|
170
|
-
const bounds = resolveLimit({ cap, hasDeclaration: Boolean(declaration), used });
|
|
171
|
-
return { key, ...bounds, loading, refresh };
|
|
172
|
-
}
|
|
173
|
-
function useLimitGuard(key) {
|
|
174
|
-
const session = useAccessSession();
|
|
175
|
-
const tenantId = session?.org?.id;
|
|
176
|
-
const plan = session?.plan ?? null;
|
|
177
|
-
const openModal = useUpgradeModalStore((s) => s.open);
|
|
178
|
-
return React.useCallback(
|
|
179
|
-
async (n = 1) => {
|
|
180
|
-
const cap = resolveCap(plan, key);
|
|
181
|
-
const declaration = getLimitDeclaration(key);
|
|
182
|
-
if (!declaration || cap === void 0 || cap === -1 || !tenantId) return "ok";
|
|
183
|
-
const used = await countByTenant(declaration.table, {
|
|
184
|
-
kind: declaration.kindFilter,
|
|
185
|
-
period: declaration.period,
|
|
186
|
-
tenantId,
|
|
187
|
-
fresh: true
|
|
188
|
-
});
|
|
189
|
-
if (used + n > cap) {
|
|
190
|
-
openModal({ limitKey: key });
|
|
191
|
-
return "blocked";
|
|
192
|
-
}
|
|
193
|
-
return "ok";
|
|
194
|
-
},
|
|
195
|
-
[key, plan, tenantId, openModal]
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
function getAccessSnapshot() {
|
|
199
|
-
const user = useAuthStore.getState().user;
|
|
200
|
-
const org = useOrganizationStore.getState().currentOrg;
|
|
201
|
-
const profile = usePermissionsStore.getState().currentProfile;
|
|
202
|
-
const plans = useBillingStore.getState().plans;
|
|
203
|
-
const plan = org?.plan ? plans.find((p) => p.id === org.plan) ?? null : null;
|
|
204
|
-
return { user, org, profile, plan };
|
|
205
|
-
}
|
|
206
|
-
function checkAccess(feature, action) {
|
|
207
|
-
const session = getAccessSnapshot();
|
|
208
|
-
const decision = resolveAccess(session, feature, action);
|
|
209
|
-
if (decision.allowed) return { allowed: true };
|
|
210
|
-
return agentDenial(decision.reason ?? "role");
|
|
211
|
-
}
|
|
212
|
-
async function guardLimit(key, n = 1) {
|
|
213
|
-
const session = getAccessSnapshot();
|
|
214
|
-
const tenantId = session.org?.id;
|
|
215
|
-
const cap = session.plan?.entitlements?.limits?.[key];
|
|
216
|
-
const declaration = getLimitDeclaration(key);
|
|
217
|
-
if (!declaration || cap === void 0 || cap === -1 || !tenantId) return { allowed: true };
|
|
218
|
-
const used = await countByTenant(declaration.table, {
|
|
219
|
-
kind: declaration.kindFilter,
|
|
220
|
-
period: declaration.period,
|
|
221
|
-
tenantId,
|
|
222
|
-
fresh: true
|
|
223
|
-
});
|
|
224
|
-
if (used + n > cap) {
|
|
225
|
-
return agentDenial("limit", { key, max: cap, used });
|
|
226
|
-
}
|
|
227
|
-
return { allowed: true };
|
|
228
|
-
}
|
|
229
|
-
function applyNavAccess(items, access, knownFeatures) {
|
|
230
|
-
const decorate = (item) => {
|
|
231
|
-
const children = item.children ? item.children.map(decorate).filter((c) => c !== null) : void 0;
|
|
232
|
-
if (!item.feature) {
|
|
233
|
-
return children ? { ...item, children } : item;
|
|
234
|
-
}
|
|
235
|
-
if (knownFeatures.has(item.feature)) {
|
|
236
|
-
const decision = access.can(item.feature, "read");
|
|
237
|
-
if (!decision.allowed && decision.reason === "role") return null;
|
|
238
|
-
}
|
|
239
|
-
const premium = access.entitled(item.feature) === false;
|
|
240
|
-
return children ? { ...item, premium, children } : { ...item, premium };
|
|
241
|
-
};
|
|
242
|
-
return items.map(decorate).filter((i) => i !== null);
|
|
243
|
-
}
|
|
244
|
-
function useModuleNavAccess(items) {
|
|
245
|
-
const access = useAccessOptional();
|
|
246
|
-
const features = usePermissionsStore((s) => s.features);
|
|
247
|
-
const knownFeatures = React.useMemo(
|
|
248
|
-
() => new Set(features.map((f) => f.id)),
|
|
249
|
-
[features]
|
|
250
|
-
);
|
|
251
|
-
return React.useMemo(
|
|
252
|
-
() => applyNavAccess(items, access, knownFeatures),
|
|
253
|
-
[items, access, knownFeatures]
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// src/components/billing/access-contract.ts
|
|
258
|
-
function getPlanEntitlements(plan) {
|
|
259
|
-
return plan?.entitlements;
|
|
260
|
-
}
|
|
261
|
-
function featureDisplayName(label) {
|
|
262
|
-
if (!label) return "";
|
|
263
|
-
return label.replace(/\s*\([^)]*\)\s*$/, "").trim() || label.trim();
|
|
264
|
-
}
|
|
265
|
-
var CURRENCY_BY_REGION = {
|
|
266
|
-
BR: "BRL",
|
|
267
|
-
PT: "EUR",
|
|
268
|
-
ES: "EUR",
|
|
269
|
-
FR: "EUR",
|
|
270
|
-
DE: "EUR",
|
|
271
|
-
IT: "EUR",
|
|
272
|
-
NL: "EUR",
|
|
273
|
-
IE: "EUR",
|
|
274
|
-
GB: "GBP",
|
|
275
|
-
US: "USD",
|
|
276
|
-
CA: "CAD",
|
|
277
|
-
AU: "AUD",
|
|
278
|
-
MX: "MXN",
|
|
279
|
-
AR: "ARS",
|
|
280
|
-
CL: "CLP",
|
|
281
|
-
CO: "COP"
|
|
282
|
-
};
|
|
283
|
-
function resolvePlanCurrency(planCurrency, locale) {
|
|
284
|
-
if (planCurrency) return planCurrency;
|
|
285
|
-
const region = locale?.split(/[-_]/)[1]?.toUpperCase();
|
|
286
|
-
return region && CURRENCY_BY_REGION[region] || "USD";
|
|
287
|
-
}
|
|
288
|
-
function formatPrice(plan, tr) {
|
|
289
|
-
if (plan.price <= 0) return tr("billing.free", "Free");
|
|
290
|
-
try {
|
|
291
|
-
const isInteger = Number.isInteger(plan.price);
|
|
292
|
-
return new Intl.NumberFormat(void 0, {
|
|
293
|
-
style: "currency",
|
|
294
|
-
currency: plan.currency || "USD",
|
|
295
|
-
minimumFractionDigits: isInteger ? 0 : 2
|
|
296
|
-
}).format(plan.price);
|
|
297
|
-
} catch {
|
|
298
|
-
return `${plan.currency || ""} ${plan.price}`.trim();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function intervalSuffix(plan, tr) {
|
|
302
|
-
if (plan.price <= 0) return "";
|
|
303
|
-
return plan.interval === "year" ? tr("billing.perYear", "/yr") : tr("billing.perMonth", "/mo");
|
|
304
|
-
}
|
|
305
|
-
function SubscriptionPage({ className }) {
|
|
306
|
-
const { t } = useTranslation();
|
|
307
|
-
const tr = (key, fallback) => {
|
|
308
|
-
const v = t(key);
|
|
309
|
-
return !v || v === key ? fallback : v;
|
|
310
|
-
};
|
|
311
|
-
const plans = useBillingStore((s) => s.plans);
|
|
312
|
-
const checkout = useBillingStore((s) => s.checkout);
|
|
313
|
-
useTenantOptional();
|
|
314
|
-
const adapter = useOrgAdapterOptional();
|
|
315
|
-
const setCurrentOrg = useOrganizationStore((s) => s.setCurrentOrg);
|
|
316
|
-
const currentOrg = useOrganizationStore((s) => s.currentOrg);
|
|
317
|
-
const currentPlanId = currentOrg?.plan || "free";
|
|
318
|
-
const currentBadge = resolvePlanBadge(currentPlanId, plans);
|
|
319
|
-
const currentPlan = plans.find((p) => p.id === currentPlanId);
|
|
320
|
-
const [pending, setPending] = React.useState(null);
|
|
321
|
-
const [busy, setBusy] = React.useState(false);
|
|
322
|
-
const allFeatures = React.useMemo(() => {
|
|
323
|
-
const seen = /* @__PURE__ */ new Set();
|
|
324
|
-
const out = [];
|
|
325
|
-
for (const plan of plans) {
|
|
326
|
-
for (const f of plan.features) {
|
|
327
|
-
if (!seen.has(f)) {
|
|
328
|
-
seen.add(f);
|
|
329
|
-
out.push(f);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return out;
|
|
334
|
-
}, [plans]);
|
|
335
|
-
const featureCatalog = usePermissionsStore((s) => s.features);
|
|
336
|
-
const entitlementsMatrix = React.useMemo(() => {
|
|
337
|
-
const hasAny = plans.some((p) => getPlanEntitlements(p));
|
|
338
|
-
if (!hasAny) return null;
|
|
339
|
-
const featureIds = [];
|
|
340
|
-
const featureSeen = /* @__PURE__ */ new Set();
|
|
341
|
-
const limitKeys = [];
|
|
342
|
-
const limitSeen = /* @__PURE__ */ new Set();
|
|
343
|
-
for (const plan of plans) {
|
|
344
|
-
const ent = getPlanEntitlements(plan);
|
|
345
|
-
for (const id of Object.keys(ent?.features ?? {})) {
|
|
346
|
-
if (!featureSeen.has(id)) {
|
|
347
|
-
featureSeen.add(id);
|
|
348
|
-
featureIds.push(id);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
for (const key of Object.keys(ent?.limits ?? {})) {
|
|
352
|
-
if (!limitSeen.has(key)) {
|
|
353
|
-
limitSeen.add(key);
|
|
354
|
-
limitKeys.push(key);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (featureIds.length === 0 && limitKeys.length === 0) return null;
|
|
359
|
-
const labelForFeature = (id) => featureCatalog.find((f) => f.id === id)?.label ?? id;
|
|
360
|
-
const labelForLimit = (key) => {
|
|
361
|
-
const v = t(`limit.label.${key}`);
|
|
362
|
-
return !v || v === `limit.label.${key}` ? key : v;
|
|
363
|
-
};
|
|
364
|
-
return { featureIds, limitKeys, labelForFeature, labelForLimit };
|
|
365
|
-
}, [plans, featureCatalog, t]);
|
|
366
|
-
async function applyChange(plan) {
|
|
367
|
-
setBusy(true);
|
|
368
|
-
try {
|
|
369
|
-
if (checkout) {
|
|
370
|
-
await checkout(plan.id);
|
|
371
|
-
setPending(null);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
if (adapter && currentOrg) {
|
|
375
|
-
const updated = await adapter.updateOrg(currentOrg.id, { plan: plan.id });
|
|
376
|
-
setCurrentOrg(updated);
|
|
377
|
-
} else if (currentOrg) {
|
|
378
|
-
setCurrentOrg({ ...currentOrg, plan: plan.id });
|
|
379
|
-
}
|
|
380
|
-
toast.success(
|
|
381
|
-
tr("billing.planChanged", "Plan updated").replace("{{plan}}", plan.name)
|
|
382
|
-
);
|
|
383
|
-
setPending(null);
|
|
384
|
-
} catch {
|
|
385
|
-
toast.error(tr("billing.planChangeFailed", "Couldn't change your plan. Please try again."));
|
|
386
|
-
} finally {
|
|
387
|
-
setBusy(false);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (plans.length === 0) {
|
|
391
|
-
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.") }) });
|
|
392
|
-
}
|
|
393
|
-
return /* @__PURE__ */ jsxs("div", { className: className ?? "mx-auto max-w-5xl space-y-8", children: [
|
|
394
|
-
/* @__PURE__ */ jsx(
|
|
395
|
-
Card,
|
|
396
|
-
{
|
|
397
|
-
className: cn(
|
|
398
|
-
"relative overflow-hidden",
|
|
399
|
-
currentBadge.paid && "border-amber-400/60 bg-gradient-to-br from-amber-50/60 to-transparent dark:from-amber-950/20"
|
|
400
|
-
),
|
|
401
|
-
children: /* @__PURE__ */ jsxs(CardContent, { className: "flex flex-wrap items-center justify-between gap-4 p-6", children: [
|
|
402
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
403
|
-
/* @__PURE__ */ jsx(
|
|
404
|
-
"div",
|
|
405
|
-
{
|
|
406
|
-
className: cn(
|
|
407
|
-
"flex h-12 w-12 shrink-0 items-center justify-center rounded-xl",
|
|
408
|
-
currentBadge.paid ? "bg-amber-400/20 text-amber-600 dark:text-amber-400" : "bg-muted text-muted-foreground"
|
|
409
|
-
),
|
|
410
|
-
children: currentBadge.paid ? /* @__PURE__ */ jsx(Crown, { className: "h-6 w-6" }) : /* @__PURE__ */ jsx(Sparkles, { className: "h-6 w-6" })
|
|
411
|
-
}
|
|
412
|
-
),
|
|
413
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
414
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: tr("billing.currentPlan", "Current Plan") }),
|
|
415
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
416
|
-
/* @__PURE__ */ jsx("span", { className: "text-xl font-bold", children: currentBadge.label }),
|
|
417
|
-
currentBadge.paid && // Paid marker only — a literal "Pro" here was misleading next
|
|
418
|
-
// to non-Pro paid tiers ("Starter / Pro", QA finding).
|
|
419
|
-
/* @__PURE__ */ jsx(
|
|
420
|
-
Badge,
|
|
421
|
-
{
|
|
422
|
-
"aria-label": tr("billing.paidPlan", "Paid plan"),
|
|
423
|
-
className: "border-amber-400/40 bg-amber-400/15 text-amber-700 dark:text-amber-300",
|
|
424
|
-
children: /* @__PURE__ */ jsx(Crown, { className: "h-3 w-3" })
|
|
425
|
-
}
|
|
426
|
-
)
|
|
427
|
-
] })
|
|
428
|
-
] })
|
|
429
|
-
] }),
|
|
430
|
-
currentPlan && /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
|
|
431
|
-
/* @__PURE__ */ jsx("span", { className: "text-2xl font-bold", children: formatPrice(currentPlan, tr) }),
|
|
432
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: intervalSuffix(currentPlan, tr) })
|
|
433
|
-
] })
|
|
434
|
-
] })
|
|
435
|
-
}
|
|
436
|
-
),
|
|
437
|
-
/* @__PURE__ */ jsx("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-3", children: plans.map((plan) => {
|
|
438
|
-
const isCurrent = plan.id === currentPlanId;
|
|
439
|
-
const paid = plan.price > 0;
|
|
440
|
-
return /* @__PURE__ */ jsxs(
|
|
441
|
-
Card,
|
|
442
|
-
{
|
|
443
|
-
className: cn(
|
|
444
|
-
"relative flex flex-col",
|
|
445
|
-
plan.highlighted && "border-primary shadow-md",
|
|
446
|
-
isCurrent && "ring-2 ring-primary/40"
|
|
447
|
-
),
|
|
448
|
-
children: [
|
|
449
|
-
plan.highlighted && /* @__PURE__ */ jsx("div", { className: "absolute -top-3 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsxs(Badge, { children: [
|
|
450
|
-
/* @__PURE__ */ jsx(Crown, { className: "mr-1 h-3 w-3" }),
|
|
451
|
-
tr("billing.mostPopular", "Most Popular")
|
|
452
|
-
] }) }),
|
|
453
|
-
/* @__PURE__ */ jsxs(CardHeader, { className: "pb-0", children: [
|
|
454
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
455
|
-
/* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold", children: plan.name }),
|
|
456
|
-
paid && /* @__PURE__ */ jsx(Crown, { className: "h-4 w-4 text-amber-500" })
|
|
457
|
-
] }),
|
|
458
|
-
plan.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: plan.description })
|
|
459
|
-
] }),
|
|
460
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "flex flex-1 flex-col pt-4", children: [
|
|
461
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
462
|
-
/* @__PURE__ */ jsx("span", { className: "text-4xl font-bold", children: formatPrice(plan, tr) }),
|
|
463
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: intervalSuffix(plan, tr) })
|
|
464
|
-
] }),
|
|
465
|
-
/* @__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)) }),
|
|
466
|
-
isCurrent ? /* @__PURE__ */ jsx(Button, { variant: "outline", className: "w-full", disabled: true, children: tr("billing.currentPlan", "Current Plan") }) : /* @__PURE__ */ jsx(
|
|
467
|
-
Button,
|
|
468
|
-
{
|
|
469
|
-
className: "w-full",
|
|
470
|
-
variant: plan.highlighted ? "default" : "outline",
|
|
471
|
-
onClick: () => setPending(plan),
|
|
472
|
-
children: tr("billing.changeToPlan", "Switch to this plan")
|
|
473
|
-
}
|
|
474
|
-
)
|
|
475
|
-
] })
|
|
476
|
-
]
|
|
477
|
-
},
|
|
478
|
-
plan.id
|
|
479
|
-
);
|
|
480
|
-
}) }),
|
|
481
|
-
(entitlementsMatrix || allFeatures.length > 0) && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
482
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: tr("billing.featureMatrix", "Feature comparison") }),
|
|
483
|
-
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-lg border", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm", children: [
|
|
484
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b bg-muted/40", children: [
|
|
485
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left font-medium", children: tr("billing.features", "Features") }),
|
|
486
|
-
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: [
|
|
487
|
-
plan.price > 0 && /* @__PURE__ */ jsx(Crown, { className: "h-3.5 w-3.5 text-amber-500" }),
|
|
488
|
-
plan.name
|
|
489
|
-
] }) }, plan.id))
|
|
490
|
-
] }) }),
|
|
491
|
-
/* @__PURE__ */ jsx("tbody", { children: entitlementsMatrix ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
492
|
-
entitlementsMatrix.featureIds.map((id, i) => /* @__PURE__ */ jsxs("tr", { className: cn(i % 2 === 1 && "bg-muted/20"), children: [
|
|
493
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-left", children: entitlementsMatrix.labelForFeature(id) }),
|
|
494
|
-
plans.map((plan) => {
|
|
495
|
-
const entitled = getPlanEntitlements(plan)?.features?.[id] !== false;
|
|
496
|
-
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);
|
|
497
|
-
})
|
|
498
|
-
] }, `f:${id}`)),
|
|
499
|
-
entitlementsMatrix.limitKeys.map((key, i) => /* @__PURE__ */ jsxs("tr", { className: cn((entitlementsMatrix.featureIds.length + i) % 2 === 1 && "bg-muted/20"), children: [
|
|
500
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-left", children: entitlementsMatrix.labelForLimit(key) }),
|
|
501
|
-
plans.map((plan) => {
|
|
502
|
-
const cap = getPlanEntitlements(plan)?.limits?.[key];
|
|
503
|
-
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));
|
|
504
|
-
return /* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-center text-muted-foreground", children: cell }, plan.id);
|
|
505
|
-
})
|
|
506
|
-
] }, `l:${key}`))
|
|
507
|
-
] }) : allFeatures.map((feature, i) => /* @__PURE__ */ jsxs("tr", { className: cn(i % 2 === 1 && "bg-muted/20"), children: [
|
|
508
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-2.5 text-left", children: parsePlanFeature(feature).label }),
|
|
509
|
-
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))
|
|
510
|
-
] }, feature)) })
|
|
511
|
-
] }) })
|
|
512
|
-
] }),
|
|
513
|
-
/* @__PURE__ */ jsx(
|
|
514
|
-
ConfirmDialog,
|
|
515
|
-
{
|
|
516
|
-
open: pending !== null,
|
|
517
|
-
onConfirm: () => pending && void applyChange(pending),
|
|
518
|
-
onCancel: () => setPending(null),
|
|
519
|
-
title: tr("billing.changePlanConfirmTitle", "Change plan?"),
|
|
520
|
-
description: pending ? tr("billing.changePlanConfirmBody", "You're switching to the {{plan}} plan.").replace("{{plan}}", pending.name) : void 0,
|
|
521
|
-
confirmLabel: tr("billing.changePlanConfirm", "Switch plan"),
|
|
522
|
-
cancelLabel: tr("common.cancel", "Cancel"),
|
|
523
|
-
loading: busy
|
|
524
|
-
}
|
|
525
|
-
)
|
|
526
|
-
] });
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
export { AccessProvider, CORE_LIMIT_DECLARATIONS, PlanFeatureItem, SubscriptionPage, checkAccess, entityDerivedLimitDeclarations, featureDisplayName, getAccessSnapshot, getPlanEntitlements, guardLimit, invalidateLimit, resolvePlanCurrency, useAccess, useAccessOptional, useLimit, useLimitGuard, useModuleNavAccess, useUpgradeModalStore };
|
|
530
|
-
//# sourceMappingURL=chunk-VH4LLIMH.js.map
|
|
531
|
-
//# sourceMappingURL=chunk-VH4LLIMH.js.map
|