@wildo-ai/saas-frontend-lib 1.1.16 → 1.1.18
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 +114 -26
- package/LICENSE.enterprise +129 -0
- package/dist/esm/companion-exports.d.ts +5 -2
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js +4 -2
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/components/actions/action-bar.d.ts +16 -1
- package/dist/esm/components/actions/action-bar.d.ts.map +1 -1
- package/dist/esm/components/actions/action-bar.js.map +1 -1
- package/dist/esm/components/app/AppLayout_AuthenticatedRoute.d.ts.map +1 -1
- package/dist/esm/components/app/AppLayout_AuthenticatedRoute.js +6 -14
- package/dist/esm/components/app/AppLayout_AuthenticatedRoute.js.map +1 -1
- package/dist/esm/components/app/AppLayout_DecisionInbox.d.ts.map +1 -1
- package/dist/esm/components/app/AppLayout_DecisionInbox.js +2 -4
- package/dist/esm/components/app/AppLayout_DecisionInbox.js.map +1 -1
- package/dist/esm/components/app/AppLayout_Home.d.ts.map +1 -1
- package/dist/esm/components/app/AppLayout_Home.js +14 -7
- package/dist/esm/components/app/AppLayout_Home.js.map +1 -1
- package/dist/esm/components/app/AppLayout_IdentityPortalContainer.d.ts +13 -0
- package/dist/esm/components/app/AppLayout_IdentityPortalContainer.d.ts.map +1 -0
- package/dist/esm/components/app/AppLayout_IdentityPortalContainer.js +16 -0
- package/dist/esm/components/app/AppLayout_IdentityPortalContainer.js.map +1 -0
- package/dist/esm/components/app/DecisionInboxSection.d.ts +10 -0
- package/dist/esm/components/app/DecisionInboxSection.d.ts.map +1 -0
- package/dist/esm/components/app/DecisionInboxSection.js +15 -0
- package/dist/esm/components/app/DecisionInboxSection.js.map +1 -0
- package/dist/esm/components/app/IdentityPortalLayout_AuthenticatedRoute.d.ts +13 -0
- package/dist/esm/components/app/IdentityPortalLayout_AuthenticatedRoute.d.ts.map +1 -0
- package/dist/esm/components/app/IdentityPortalLayout_AuthenticatedRoute.js +28 -0
- package/dist/esm/components/app/IdentityPortalLayout_AuthenticatedRoute.js.map +1 -0
- package/dist/esm/components/app/IdentityPortalPage_Home.d.ts +10 -0
- package/dist/esm/components/app/IdentityPortalPage_Home.d.ts.map +1 -0
- package/dist/esm/components/app/IdentityPortalPage_Home.js +40 -0
- package/dist/esm/components/app/IdentityPortalPage_Home.js.map +1 -0
- package/dist/esm/components/app/IdentityPortalPage_SettingsDestination.d.ts +16 -0
- package/dist/esm/components/app/IdentityPortalPage_SettingsDestination.d.ts.map +1 -0
- package/dist/esm/components/app/IdentityPortalPage_SettingsDestination.js +41 -0
- package/dist/esm/components/app/IdentityPortalPage_SettingsDestination.js.map +1 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.d.ts +15 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.d.ts.map +1 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.js +268 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.js.map +1 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.labels.d.ts +3 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.labels.d.ts.map +1 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.labels.js +35 -0
- package/dist/esm/components/auth/Auth_DecisionEmailAnswer.labels.js.map +1 -0
- package/dist/esm/components/auth/Auth_Main.d.ts.map +1 -1
- package/dist/esm/components/auth/Auth_Main.js +5 -0
- package/dist/esm/components/auth/Auth_Main.js.map +1 -1
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.d.ts +19 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.d.ts.map +1 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.js +156 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.js.map +1 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.labels.d.ts +3 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.labels.d.ts.map +1 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.labels.js +107 -0
- package/dist/esm/components/auth/Auth_OAuthDeviceVerification.labels.js.map +1 -0
- package/dist/esm/components/auth/StepUpAuthDialog.d.ts +31 -10
- package/dist/esm/components/auth/StepUpAuthDialog.d.ts.map +1 -1
- package/dist/esm/components/auth/StepUpAuthDialog.js +81 -17
- package/dist/esm/components/auth/StepUpAuthDialog.js.map +1 -1
- package/dist/esm/components/auth/admin-config/AppPage_SecuritySettings.labels.d.ts.map +1 -1
- package/dist/esm/components/auth/admin-config/AppPage_SecuritySettings.labels.js +19 -0
- package/dist/esm/components/auth/admin-config/AppPage_SecuritySettings.labels.js.map +1 -1
- package/dist/esm/components/auth/pages/AuthPage_DecisionEmailAnswer.d.ts +11 -0
- package/dist/esm/components/auth/pages/AuthPage_DecisionEmailAnswer.d.ts.map +1 -0
- package/dist/esm/components/auth/pages/AuthPage_DecisionEmailAnswer.js +25 -0
- package/dist/esm/components/auth/pages/AuthPage_DecisionEmailAnswer.js.map +1 -0
- package/dist/esm/components/auth/pages/AuthPage_OAuthDeviceVerification.d.ts +11 -0
- package/dist/esm/components/auth/pages/AuthPage_OAuthDeviceVerification.d.ts.map +1 -0
- package/dist/esm/components/auth/pages/AuthPage_OAuthDeviceVerification.js +25 -0
- package/dist/esm/components/auth/pages/AuthPage_OAuthDeviceVerification.js.map +1 -0
- package/dist/esm/components/billing/billing-pricing-table.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-pricing-table.js +40 -7
- package/dist/esm/components/billing/billing-pricing-table.js.map +1 -1
- package/dist/esm/components/billing/billing-subscription-status.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-subscription-status.js +9 -1
- package/dist/esm/components/billing/billing-subscription-status.js.map +1 -1
- package/dist/esm/components/billing/billing-usage-dashboard.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-usage-dashboard.js +3 -2
- package/dist/esm/components/billing/billing-usage-dashboard.js.map +1 -1
- package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts.map +1 -1
- package/dist/esm/components/compliance/EmbeddedSigningFrame.js +17 -6
- package/dist/esm/components/compliance/EmbeddedSigningFrame.js.map +1 -1
- package/dist/esm/components/data-display/AutomaticDisplayer.d.ts.map +1 -1
- package/dist/esm/components/data-display/AutomaticDisplayer.js +7 -2
- package/dist/esm/components/data-display/AutomaticDisplayer.js.map +1 -1
- package/dist/esm/components/data-display/DisplayField.d.ts.map +1 -1
- package/dist/esm/components/data-display/DisplayField.js +67 -45
- package/dist/esm/components/data-display/DisplayField.js.map +1 -1
- package/dist/esm/components/data-display/DisplayFieldEditable.d.ts.map +1 -1
- package/dist/esm/components/data-display/DisplayFieldEditable.js +4 -1
- package/dist/esm/components/data-display/DisplayFieldEditable.js.map +1 -1
- package/dist/esm/components/data-display/DisplayValueDispatcher.d.ts.map +1 -1
- package/dist/esm/components/data-display/DisplayValueDispatcher.js +16 -6
- package/dist/esm/components/data-display/DisplayValueDispatcher.js.map +1 -1
- package/dist/esm/components/data-display/ResourceAutomaticDisplayer.d.ts.map +1 -1
- package/dist/esm/components/data-display/ResourceAutomaticDisplayer.js +3 -1
- package/dist/esm/components/data-display/ResourceAutomaticDisplayer.js.map +1 -1
- package/dist/esm/components/data-display/approval-seal.d.ts +7 -5
- package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -1
- package/dist/esm/components/data-display/approval-seal.js +10 -4
- package/dist/esm/components/data-display/approval-seal.js.map +1 -1
- package/dist/esm/components/data-display/signature-requests.d.ts +81 -0
- package/dist/esm/components/data-display/signature-requests.d.ts.map +1 -0
- package/dist/esm/components/data-display/signature-requests.js +123 -0
- package/dist/esm/components/data-display/signature-requests.js.map +1 -0
- package/dist/esm/components/feedback/empty-state-marker.d.ts +16 -0
- package/dist/esm/components/feedback/empty-state-marker.d.ts.map +1 -0
- package/dist/esm/components/feedback/empty-state-marker.js +16 -0
- package/dist/esm/components/feedback/empty-state-marker.js.map +1 -0
- package/dist/esm/components/feedback/empty-state.d.ts.map +1 -1
- package/dist/esm/components/feedback/empty-state.js +2 -1
- package/dist/esm/components/feedback/empty-state.js.map +1 -1
- package/dist/esm/components/feedback/features/feature-unavailable-prompt.d.ts +7 -1
- package/dist/esm/components/feedback/features/feature-unavailable-prompt.d.ts.map +1 -1
- package/dist/esm/components/feedback/features/feature-unavailable-prompt.js +8 -2
- package/dist/esm/components/feedback/features/feature-unavailable-prompt.js.map +1 -1
- package/dist/esm/components/feedback/resource-empty-state.d.ts.map +1 -1
- package/dist/esm/components/feedback/resource-empty-state.js +2 -1
- package/dist/esm/components/feedback/resource-empty-state.js.map +1 -1
- package/dist/esm/components/flows-actors/approval.d.ts +25 -1
- package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/approval.js +22 -24
- package/dist/esm/components/flows-actors/approval.js.map +1 -1
- package/dist/esm/components/flows-actors/approval.labels.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/approval.labels.js +30 -0
- package/dist/esm/components/flows-actors/approval.labels.js.map +1 -1
- package/dist/esm/components/flows-actors/flow-node.labels.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/flow-node.labels.js +4 -1
- package/dist/esm/components/flows-actors/flow-node.labels.js.map +1 -1
- package/dist/esm/components/flows-actors/flow-step-visuals.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/flow-step-visuals.js +8 -2
- package/dist/esm/components/flows-actors/flow-step-visuals.js.map +1 -1
- package/dist/esm/components/flows-actors/human-decision-form.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/human-decision-form.js +4 -1
- package/dist/esm/components/flows-actors/human-decision-form.js.map +1 -1
- package/dist/esm/components/form/Form.d.ts +2 -0
- package/dist/esm/components/form/Form.d.ts.map +1 -1
- package/dist/esm/components/form/Form.js +1 -0
- package/dist/esm/components/form/Form.js.map +1 -1
- package/dist/esm/components/form/automated/AutomatedArrayField.d.ts.map +1 -1
- package/dist/esm/components/form/automated/AutomatedArrayField.js +7 -4
- package/dist/esm/components/form/automated/AutomatedArrayField.js.map +1 -1
- package/dist/esm/components/form/automated/AutosaveContext.d.ts.map +1 -1
- package/dist/esm/components/form/automated/AutosaveContext.js +8 -0
- package/dist/esm/components/form/automated/AutosaveContext.js.map +1 -1
- package/dist/esm/components/form/automated/FormField.d.ts +5 -3
- package/dist/esm/components/form/automated/FormField.d.ts.map +1 -1
- package/dist/esm/components/form/automated/FormField.js +38 -13
- package/dist/esm/components/form/automated/FormField.js.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js +75 -47
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
- package/dist/esm/components/form/fields/form-field-file-provider-constraints.frontend.utils.d.ts +1 -1
- package/dist/esm/components/form/fields/form-field-file-provider-constraints.frontend.utils.js +1 -1
- package/dist/esm/components/form/fields/form-field-file-provider-constraints.frontend.utils.js.map +1 -1
- package/dist/esm/components/form/validation-errors/form-validation.d.ts +5 -7
- package/dist/esm/components/form/validation-errors/form-validation.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/form-validation.js +7 -22
- package/dist/esm/components/form/validation-errors/form-validation.js.map +1 -1
- package/dist/esm/components/form/validation-errors/getFieldError.d.ts +25 -2
- package/dist/esm/components/form/validation-errors/getFieldError.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/getFieldError.js +29 -2
- package/dist/esm/components/form/validation-errors/getFieldError.js.map +1 -1
- package/dist/esm/components/form/validation-errors/resource-error-notification-context.utils.d.ts +5 -0
- package/dist/esm/components/form/validation-errors/resource-error-notification-context.utils.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/resource-error-notification-context.utils.js +3 -0
- package/dist/esm/components/form/validation-errors/resource-error-notification-context.utils.js.map +1 -1
- package/dist/esm/components/form/validation-errors/save-attempt.d.ts +9 -0
- package/dist/esm/components/form/validation-errors/save-attempt.d.ts.map +1 -0
- package/dist/esm/components/form/validation-errors/save-attempt.js +42 -0
- package/dist/esm/components/form/validation-errors/save-attempt.js.map +1 -0
- package/dist/esm/components/form/validation-errors/unstarted-field-visit.d.ts +3 -1
- package/dist/esm/components/form/validation-errors/unstarted-field-visit.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/unstarted-field-visit.js +3 -1
- package/dist/esm/components/form/validation-errors/unstarted-field-visit.js.map +1 -1
- package/dist/esm/components/form/validation-errors/validate-fields-and-show-errors.d.ts +2 -2
- package/dist/esm/components/form/validation-errors/validate-fields-and-show-errors.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/validate-fields-and-show-errors.js +3 -0
- package/dist/esm/components/form/validation-errors/validate-fields-and-show-errors.js.map +1 -1
- package/dist/esm/components/navigation/NavigationItemBadge.d.ts +16 -0
- package/dist/esm/components/navigation/NavigationItemBadge.d.ts.map +1 -1
- package/dist/esm/components/navigation/NavigationItemBadge.js +14 -2
- package/dist/esm/components/navigation/NavigationItemBadge.js.map +1 -1
- package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.d.ts +3 -3
- package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js +3 -3
- package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js.map +1 -1
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts +5 -13
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js +30 -255
- package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts +22 -1
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js +57 -26
- package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts +1 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js +40 -4
- package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts +1 -1
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js +26 -4
- package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js.map +1 -1
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts +31 -0
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts.map +1 -0
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js +42 -0
- package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js.map +1 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts +76 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts.map +1 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js +268 -0
- package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js.map +1 -0
- package/dist/esm/components/navigation/command.d.ts +5 -0
- package/dist/esm/components/navigation/command.d.ts.map +1 -1
- package/dist/esm/components/navigation/command.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts +19 -0
- package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js +51 -12
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_InsertedViews.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_InsertedViews.js +21 -7
- package/dist/esm/components/resources/ResourceLayout_InsertedViews.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_List.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_List.js +17 -7
- package/dist/esm/components/resources/ResourceLayout_List.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.d.ts +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +4 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_Search.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_Search.js +12 -8
- package/dist/esm/components/resources/ResourceLayout_Search.js.map +1 -1
- package/dist/esm/components/resources/ResourceOwnedViewEmbeds.d.ts +1 -1
- package/dist/esm/components/resources/ResourceOwnedViewEmbeds.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceOwnedViewEmbeds.js +11 -4
- package/dist/esm/components/resources/ResourceOwnedViewEmbeds.js.map +1 -1
- package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js +4 -1
- package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +4 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
- package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js +4 -1
- package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js.map +1 -1
- package/dist/esm/components/resources/embeds/RelatedResourceSections.d.ts +1 -1
- package/dist/esm/components/resources/embeds/RelatedResourceSections.js.map +1 -1
- package/dist/esm/components/resources/embeds/ResourceEmbeds.d.ts +5 -5
- package/dist/esm/components/resources/embeds/ResourceEmbeds.d.ts.map +1 -1
- package/dist/esm/components/resources/embeds/ResourceEmbeds.js +21 -14
- package/dist/esm/components/resources/embeds/ResourceEmbeds.js.map +1 -1
- package/dist/esm/components/resources/skeleton/DisplayLayout.d.ts.map +1 -1
- package/dist/esm/components/resources/skeleton/DisplayLayout.js +40 -4
- package/dist/esm/components/resources/skeleton/DisplayLayout.js.map +1 -1
- package/dist/esm/components/resources/skeleton/FormLayout.d.ts.map +1 -1
- package/dist/esm/components/resources/skeleton/FormLayout.js +22 -6
- package/dist/esm/components/resources/skeleton/FormLayout.js.map +1 -1
- package/dist/esm/components/resources/skeleton/Group.d.ts.map +1 -1
- package/dist/esm/components/resources/skeleton/Group.js +4 -1
- package/dist/esm/components/resources/skeleton/Group.js.map +1 -1
- package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.d.ts +1 -1
- package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.js +1 -1
- package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.js.map +1 -1
- package/dist/esm/components/resources/skeleton/SectionFieldsContext.d.ts +21 -1
- package/dist/esm/components/resources/skeleton/SectionFieldsContext.d.ts.map +1 -1
- package/dist/esm/components/resources/skeleton/SectionFieldsContext.js +53 -9
- package/dist/esm/components/resources/skeleton/SectionFieldsContext.js.map +1 -1
- package/dist/esm/components/sections/ContentSectionContainer.d.ts.map +1 -1
- package/dist/esm/components/sections/ContentSectionContainer.js +11 -7
- package/dist/esm/components/sections/ContentSectionContainer.js.map +1 -1
- package/dist/esm/components/sections/content-section.d.ts +1 -3
- package/dist/esm/components/sections/content-section.d.ts.map +1 -1
- package/dist/esm/components/sections/content-section.js.map +1 -1
- package/dist/esm/components/settings/AppPage_AgentActivitySettings.d.ts.map +1 -1
- package/dist/esm/components/settings/AppPage_AgentActivitySettings.js +2 -1
- package/dist/esm/components/settings/AppPage_AgentActivitySettings.js.map +1 -1
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts +12 -0
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts.map +1 -1
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js +28 -6
- package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js.map +1 -1
- package/dist/esm/components/settings/SettingsHub.d.ts +15 -0
- package/dist/esm/components/settings/SettingsHub.d.ts.map +1 -1
- package/dist/esm/components/settings/SettingsHub.js +14 -4
- package/dist/esm/components/settings/SettingsHub.js.map +1 -1
- package/dist/esm/components/typography/document-heading-level.d.ts +28 -0
- package/dist/esm/components/typography/document-heading-level.d.ts.map +1 -0
- package/dist/esm/components/typography/document-heading-level.js +63 -0
- package/dist/esm/components/typography/document-heading-level.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts +3 -2
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.js +4 -3
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.js.map +1 -1
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts +1 -1
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts.map +1 -1
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js.map +1 -1
- package/dist/esm/components/views/chart-view/ChartKpiFigure.d.ts +33 -0
- package/dist/esm/components/views/chart-view/ChartKpiFigure.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartKpiFigure.js +63 -4
- package/dist/esm/components/views/chart-view/ChartKpiFigure.js.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.js +52 -22
- package/dist/esm/components/views/chart-view/ChartView.js.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.labels.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.labels.js +76 -3
- package/dist/esm/components/views/chart-view/ChartView.labels.js.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.lazy.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartView.lazy.js +2 -1
- package/dist/esm/components/views/chart-view/ChartView.lazy.js.map +1 -1
- package/dist/esm/components/views/chart-view/ChartWidget.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/ChartWidget.js +12 -4
- package/dist/esm/components/views/chart-view/ChartWidget.js.map +1 -1
- package/dist/esm/components/views/chart-view/chart-export.utils.d.ts +8 -0
- package/dist/esm/components/views/chart-view/chart-export.utils.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/chart-export.utils.js +15 -25
- package/dist/esm/components/views/chart-view/chart-export.utils.js.map +1 -1
- package/dist/esm/components/views/chart-view/chart-view-defaults.d.ts +6 -0
- package/dist/esm/components/views/chart-view/chart-view-defaults.d.ts.map +1 -0
- package/dist/esm/components/views/chart-view/chart-view-defaults.js +6 -0
- package/dist/esm/components/views/chart-view/chart-view-defaults.js.map +1 -0
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts +47 -12
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.js +87 -32
- package/dist/esm/components/views/chart-view/option-builder/builder-utils.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js +8 -8
- package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/composed.builder.js +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/composed.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js +7 -3
- package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js +6 -2
- package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js +8 -2
- package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js +13 -9
- package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.d.ts +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js +9 -8
- package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js +2 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.d.ts +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js +10 -11
- package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js +2 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js +5 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js +7 -3
- package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/echarts-option-builder.d.ts.map +1 -1
- package/dist/esm/components/views/chart-view/option-builder/echarts-option-builder.js +13 -13
- package/dist/esm/components/views/chart-view/option-builder/echarts-option-builder.js.map +1 -1
- package/dist/esm/components/views/chart-view/useResourceChartData.d.ts +1 -1
- package/dist/esm/components/views/chart-view/useResourceChartData.js +1 -1
- package/dist/esm/components/views/chart-view/useResourceChartData.js.map +1 -1
- package/dist/esm/components/views/composite-view/CompositeView.d.ts +6 -0
- package/dist/esm/components/views/composite-view/CompositeView.d.ts.map +1 -1
- package/dist/esm/components/views/composite-view/CompositeView.js +6 -2
- package/dist/esm/components/views/composite-view/CompositeView.js.map +1 -1
- package/dist/esm/components/views/execution-view/ExecutionView.d.ts +7 -0
- package/dist/esm/components/views/execution-view/ExecutionView.d.ts.map +1 -1
- package/dist/esm/components/views/execution-view/ExecutionView.js +11 -1
- package/dist/esm/components/views/execution-view/ExecutionView.js.map +1 -1
- package/dist/esm/components/views/flows-actors-view/FlowsActorsView.d.ts +7 -0
- package/dist/esm/components/views/flows-actors-view/FlowsActorsView.d.ts.map +1 -1
- package/dist/esm/components/views/flows-actors-view/FlowsActorsView.js +6 -2
- package/dist/esm/components/views/flows-actors-view/FlowsActorsView.js.map +1 -1
- package/dist/esm/components/views/full-custom-view/FullCustomView.d.ts +7 -0
- package/dist/esm/components/views/full-custom-view/FullCustomView.d.ts.map +1 -1
- package/dist/esm/components/views/full-custom-view/FullCustomView.js +8 -3
- package/dist/esm/components/views/full-custom-view/FullCustomView.js.map +1 -1
- package/dist/esm/components/views/onboarding-view/OnboardingView.d.ts +7 -0
- package/dist/esm/components/views/onboarding-view/OnboardingView.d.ts.map +1 -1
- package/dist/esm/components/views/onboarding-view/OnboardingView.js +11 -1
- package/dist/esm/components/views/onboarding-view/OnboardingView.js.map +1 -1
- package/dist/esm/core/app-shell/AppShellBuildingBlocks.d.ts +2 -2
- package/dist/esm/core/app-shell/AppShellBuildingBlocks.js +2 -2
- package/dist/esm/core/app-shell/AppShellBuildingBlocks.js.map +1 -1
- package/dist/esm/core/app-shell/app-shell.schemas.d.ts +87 -16
- package/dist/esm/core/app-shell/app-shell.schemas.d.ts.map +1 -1
- package/dist/esm/core/app-shell/app-shell.schemas.js +16 -0
- package/dist/esm/core/app-shell/app-shell.schemas.js.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts +4 -4
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js +3 -3
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js.map +1 -1
- package/dist/esm/core/app-shell/useIdentityPortalShellLayout.d.ts +45 -0
- package/dist/esm/core/app-shell/useIdentityPortalShellLayout.d.ts.map +1 -0
- package/dist/esm/core/app-shell/useIdentityPortalShellLayout.js +72 -0
- package/dist/esm/core/app-shell/useIdentityPortalShellLayout.js.map +1 -0
- package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.d.ts +4 -3
- package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.js +4 -3
- package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.js.map +1 -1
- package/dist/esm/core/automated-layout/automated-layout.frontend.utils.d.ts +15 -8
- package/dist/esm/core/automated-layout/automated-layout.frontend.utils.d.ts.map +1 -1
- package/dist/esm/core/automated-layout/automated-layout.frontend.utils.js +22 -21
- package/dist/esm/core/automated-layout/automated-layout.frontend.utils.js.map +1 -1
- package/dist/esm/core/billing/BillingContext.d.ts +27 -4
- package/dist/esm/core/billing/BillingContext.d.ts.map +1 -1
- package/dist/esm/core/billing/BillingContext.js +61 -2
- package/dist/esm/core/billing/BillingContext.js.map +1 -1
- package/dist/esm/core/billing/useBillingAction.d.ts.map +1 -1
- package/dist/esm/core/billing/useBillingAction.js +3 -2
- package/dist/esm/core/billing/useBillingAction.js.map +1 -1
- package/dist/esm/core/components-registry/RegisteredComponentRoot.d.ts +19 -0
- package/dist/esm/core/components-registry/RegisteredComponentRoot.d.ts.map +1 -0
- package/dist/esm/core/components-registry/RegisteredComponentRoot.js +23 -0
- package/dist/esm/core/components-registry/RegisteredComponentRoot.js.map +1 -0
- package/dist/esm/core/components-registry/register-framework-layouts.d.ts.map +1 -1
- package/dist/esm/core/components-registry/register-framework-layouts.js +4 -0
- package/dist/esm/core/components-registry/register-framework-layouts.js.map +1 -1
- package/dist/esm/core/config/app-configuration-frontend.schemas.d.ts +159 -0
- package/dist/esm/core/config/app-configuration-frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/config/app-configuration-frontend.schemas.js +68 -3
- package/dist/esm/core/config/app-configuration-frontend.schemas.js.map +1 -1
- package/dist/esm/core/config/app-level-components.frontend.schemas.d.ts +2 -2
- package/dist/esm/core/config/app-level-components.frontend.schemas.js +2 -2
- package/dist/esm/core/config/app-level-components.frontend.schemas.js.map +1 -1
- package/dist/esm/core/config/chart-view.frontend.schemas.d.ts +59 -18
- package/dist/esm/core/config/chart-view.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/config/chart-view.frontend.schemas.js +42 -7
- package/dist/esm/core/config/chart-view.frontend.schemas.js.map +1 -1
- package/dist/esm/core/config/composite-view.schemas.d.ts +8 -1
- package/dist/esm/core/config/composite-view.schemas.d.ts.map +1 -1
- package/dist/esm/core/config/composite-view.schemas.js +1 -0
- package/dist/esm/core/config/composite-view.schemas.js.map +1 -1
- package/dist/esm/core/config/decision-inbox-capability.frontend.utils.d.ts +1 -1
- package/dist/esm/core/config/decision-inbox-capability.frontend.utils.d.ts.map +1 -1
- package/dist/esm/core/config/decision-inbox-capability.frontend.utils.js +1 -1
- package/dist/esm/core/config/decision-inbox-capability.frontend.utils.js.map +1 -1
- package/dist/esm/core/config/engine-settings-destinations.d.ts +6 -0
- package/dist/esm/core/config/engine-settings-destinations.d.ts.map +1 -1
- package/dist/esm/core/config/engine-settings-destinations.js +12 -0
- package/dist/esm/core/config/engine-settings-destinations.js.map +1 -1
- package/dist/esm/core/config/execution-view.schemas.d.ts +1 -1
- package/dist/esm/core/config/execution-view.schemas.js.map +1 -1
- package/dist/esm/core/config/identity-portal-settings.frontend.d.ts +17 -0
- package/dist/esm/core/config/identity-portal-settings.frontend.d.ts.map +1 -0
- package/dist/esm/core/config/identity-portal-settings.frontend.js +64 -0
- package/dist/esm/core/config/identity-portal-settings.frontend.js.map +1 -0
- package/dist/esm/core/config/launcher-items.frontend.schemas.d.ts +8 -8
- package/dist/esm/core/config/launcher-items.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/config/launcher-items.frontend.schemas.js.map +1 -1
- package/dist/esm/core/config/settings-hub-gating.frontend.utils.d.ts +1 -1
- package/dist/esm/core/config/settings-hub-gating.frontend.utils.d.ts.map +1 -1
- package/dist/esm/core/config/settings-hub-gating.frontend.utils.js +1 -1
- package/dist/esm/core/config/settings-hub-gating.frontend.utils.js.map +1 -1
- package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts +17 -6
- package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/config/settings-hub.frontend.schemas.js.map +1 -1
- package/dist/esm/core/config/useSettingsHubConfig.d.ts.map +1 -1
- package/dist/esm/core/config/useSettingsHubConfig.js +1 -0
- package/dist/esm/core/config/useSettingsHubConfig.js.map +1 -1
- package/dist/esm/core/config/useVisibleSettingsHubConfig.d.ts +7 -0
- package/dist/esm/core/config/useVisibleSettingsHubConfig.d.ts.map +1 -1
- package/dist/esm/core/config/useVisibleSettingsHubConfig.js +9 -1
- package/dist/esm/core/config/useVisibleSettingsHubConfig.js.map +1 -1
- package/dist/esm/core/config/verify-launcher-content.d.ts +7 -1
- package/dist/esm/core/config/verify-launcher-content.d.ts.map +1 -1
- package/dist/esm/core/config/verify-launcher-content.js +31 -0
- package/dist/esm/core/config/verify-launcher-content.js.map +1 -1
- package/dist/esm/core/errors/GlobalErrorHandler.d.ts.map +1 -1
- package/dist/esm/core/errors/GlobalErrorHandler.js +10 -0
- package/dist/esm/core/errors/GlobalErrorHandler.js.map +1 -1
- package/dist/esm/core/errors/backend-refusal.frontend.d.ts +1 -1
- package/dist/esm/core/errors/backend-refusal.frontend.d.ts.map +1 -1
- package/dist/esm/core/errors/backend-refusal.frontend.js.map +1 -1
- package/dist/esm/core/events/NotificationContext.d.ts.map +1 -1
- package/dist/esm/core/events/NotificationContext.js +19 -2
- package/dist/esm/core/events/NotificationContext.js.map +1 -1
- package/dist/esm/core/events/notification-display-policy.frontend.schemas.d.ts +21 -2
- package/dist/esm/core/events/notification-display-policy.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/events/notification-display-policy.frontend.schemas.js +25 -4
- package/dist/esm/core/events/notification-display-policy.frontend.schemas.js.map +1 -1
- package/dist/esm/core/execution/useExecution.d.ts +3 -3
- package/dist/esm/core/execution/useExecution.js.map +1 -1
- package/dist/esm/core/external-providers/ConsentBasedProviderSdks.d.ts +1 -1
- package/dist/esm/core/external-providers/ConsentBasedProviderSdks.js +1 -1
- package/dist/esm/core/external-providers/ConsentBasedProviderSdks.js.map +1 -1
- package/dist/esm/core/features/FeatureGate.d.ts +13 -1
- package/dist/esm/core/features/FeatureGate.d.ts.map +1 -1
- package/dist/esm/core/features/FeatureGate.js +6 -1
- package/dist/esm/core/features/FeatureGate.js.map +1 -1
- package/dist/esm/core/features/InPlaceFeatureLock.d.ts +28 -0
- package/dist/esm/core/features/InPlaceFeatureLock.d.ts.map +1 -0
- package/dist/esm/core/features/InPlaceFeatureLock.js +49 -0
- package/dist/esm/core/features/InPlaceFeatureLock.js.map +1 -0
- package/dist/esm/core/features/PlanRefusalPrompt.d.ts +12 -0
- package/dist/esm/core/features/PlanRefusalPrompt.d.ts.map +1 -0
- package/dist/esm/core/features/PlanRefusalPrompt.js +90 -0
- package/dist/esm/core/features/PlanRefusalPrompt.js.map +1 -0
- package/dist/esm/core/features/RequiredFeaturesGate.d.ts +39 -0
- package/dist/esm/core/features/RequiredFeaturesGate.d.ts.map +1 -0
- package/dist/esm/core/features/RequiredFeaturesGate.js +51 -0
- package/dist/esm/core/features/RequiredFeaturesGate.js.map +1 -0
- package/dist/esm/core/features/feature-unavailability.frontend.utils.d.ts +6 -0
- package/dist/esm/core/features/feature-unavailability.frontend.utils.d.ts.map +1 -1
- package/dist/esm/core/features/feature-unavailability.frontend.utils.js +27 -10
- package/dist/esm/core/features/feature-unavailability.frontend.utils.js.map +1 -1
- package/dist/esm/core/features/plan-refusal.frontend.d.ts +43 -0
- package/dist/esm/core/features/plan-refusal.frontend.d.ts.map +1 -0
- package/dist/esm/core/features/plan-refusal.frontend.js +67 -0
- package/dist/esm/core/features/plan-refusal.frontend.js.map +1 -0
- package/dist/esm/core/features/required-features-gate-presentation.d.ts +21 -0
- package/dist/esm/core/features/required-features-gate-presentation.d.ts.map +1 -0
- package/dist/esm/core/features/required-features-gate-presentation.js +26 -0
- package/dist/esm/core/features/required-features-gate-presentation.js.map +1 -0
- package/dist/esm/core/features/useFeatureAvailability.d.ts.map +1 -1
- package/dist/esm/core/features/useFeatureAvailability.js +4 -0
- package/dist/esm/core/features/useFeatureAvailability.js.map +1 -1
- package/dist/esm/core/features/useOperationFeatureAvailability.d.ts +2 -0
- package/dist/esm/core/features/useOperationFeatureAvailability.d.ts.map +1 -1
- package/dist/esm/core/features/useOperationFeatureAvailability.js +6 -1
- package/dist/esm/core/features/useOperationFeatureAvailability.js.map +1 -1
- package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts +11 -0
- package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts.map +1 -1
- package/dist/esm/core/flows-actors/FlowsActorsContext.js +117 -3
- package/dist/esm/core/flows-actors/FlowsActorsContext.js.map +1 -1
- package/dist/esm/core/guidance/renderers/GuidanceAnnouncement.d.ts.map +1 -1
- package/dist/esm/core/guidance/renderers/GuidanceAnnouncement.js +3 -1
- package/dist/esm/core/guidance/renderers/GuidanceAnnouncement.js.map +1 -1
- package/dist/esm/core/navigation/NavigationContentAreas.d.ts.map +1 -1
- package/dist/esm/core/navigation/NavigationContentAreas.js +28 -9
- package/dist/esm/core/navigation/NavigationContentAreas.js.map +1 -1
- package/dist/esm/{components/views/chart-dashboard/chart-dashboard.utils.d.ts → core/navigation/chart-read-gate.d.ts} +11 -7
- package/dist/esm/core/navigation/chart-read-gate.d.ts.map +1 -0
- package/dist/esm/{components/views/chart-dashboard/chart-dashboard.utils.js → core/navigation/chart-read-gate.js} +27 -11
- package/dist/esm/core/navigation/chart-read-gate.js.map +1 -0
- package/dist/esm/core/navigation/home-resolution.d.ts +36 -0
- package/dist/esm/core/navigation/home-resolution.d.ts.map +1 -0
- package/dist/esm/core/navigation/home-resolution.js +46 -0
- package/dist/esm/core/navigation/home-resolution.js.map +1 -0
- package/dist/esm/core/navigation/launcher-resolution.d.ts +2 -34
- package/dist/esm/core/navigation/launcher-resolution.d.ts.map +1 -1
- package/dist/esm/core/navigation/launcher-resolution.js +13 -18
- package/dist/esm/core/navigation/launcher-resolution.js.map +1 -1
- package/dist/esm/core/navigation/launcher-runtime-availability.d.ts +1 -1
- package/dist/esm/core/navigation/launcher-runtime-availability.d.ts.map +1 -1
- package/dist/esm/core/navigation/launcher-runtime-availability.js +7 -2
- package/dist/esm/core/navigation/launcher-runtime-availability.js.map +1 -1
- package/dist/esm/core/navigation/primary-destination-layout.d.ts +2 -2
- package/dist/esm/core/navigation/primary-destination-layout.d.ts.map +1 -1
- package/dist/esm/core/navigation/primary-destination-layout.js +1 -1
- package/dist/esm/core/navigation/primary-destination-layout.js.map +1 -1
- package/dist/esm/core/navigation/useChartReadDecision.d.ts +26 -0
- package/dist/esm/core/navigation/useChartReadDecision.d.ts.map +1 -0
- package/dist/esm/core/navigation/useChartReadDecision.js +58 -0
- package/dist/esm/core/navigation/useChartReadDecision.js.map +1 -0
- package/dist/esm/core/navigation/useCurrentOrganizationConfigurationPresence.d.ts +1 -1
- package/dist/esm/core/navigation/useCurrentOrganizationConfigurationPresence.d.ts.map +1 -1
- package/dist/esm/core/navigation/useCurrentOrganizationConfigurationPresence.js.map +1 -1
- package/dist/esm/core/navigation/useCurrentOrganizationHoldsUnrevokedScimToken.d.ts +1 -1
- package/dist/esm/core/navigation/useCurrentOrganizationHoldsUnrevokedScimToken.d.ts.map +1 -1
- package/dist/esm/core/navigation/useCurrentOrganizationHoldsUnrevokedScimToken.js.map +1 -1
- package/dist/esm/core/navigation/view-title-resolution.d.ts +21 -0
- package/dist/esm/core/navigation/view-title-resolution.d.ts.map +1 -1
- package/dist/esm/core/navigation/view-title-resolution.js +25 -0
- package/dist/esm/core/navigation/view-title-resolution.js.map +1 -1
- package/dist/esm/core/navigation/viewer-field-reader.d.ts +81 -0
- package/dist/esm/core/navigation/viewer-field-reader.d.ts.map +1 -0
- package/dist/esm/core/navigation/viewer-field-reader.js +113 -0
- package/dist/esm/core/navigation/viewer-field-reader.js.map +1 -0
- package/dist/esm/core/navigation/viewer-roles.d.ts +40 -0
- package/dist/esm/core/navigation/viewer-roles.d.ts.map +1 -0
- package/dist/esm/core/navigation/viewer-roles.js +26 -0
- package/dist/esm/core/navigation/viewer-roles.js.map +1 -0
- package/dist/esm/core/requests/user-interaction-clock.d.ts +32 -0
- package/dist/esm/core/requests/user-interaction-clock.d.ts.map +1 -0
- package/dist/esm/core/requests/user-interaction-clock.js +47 -0
- package/dist/esm/core/requests/user-interaction-clock.js.map +1 -0
- package/dist/esm/core/requests/websockets/WebSocketEventBridge.d.ts.map +1 -1
- package/dist/esm/core/requests/websockets/WebSocketEventBridge.js +2 -0
- package/dist/esm/core/requests/websockets/WebSocketEventBridge.js.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +66 -10
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +63 -8
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
- package/dist/esm/core/requests/wildo-http-client.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/requests/wildo-http-client.frontend.service.js +13 -0
- package/dist/esm/core/requests/wildo-http-client.frontend.service.js.map +1 -1
- package/dist/esm/core/resources/hooks/useOperationEnabled.d.ts.map +1 -1
- package/dist/esm/core/resources/hooks/useOperationEnabled.js +45 -3
- package/dist/esm/core/resources/hooks/useOperationEnabled.js.map +1 -1
- package/dist/esm/core/resources/resource-addressability.frontend.utils.d.ts +1 -1
- package/dist/esm/core/resources/resource-addressability.frontend.utils.d.ts.map +1 -1
- package/dist/esm/core/resources/resource-addressability.frontend.utils.js.map +1 -1
- package/dist/esm/core/resources/resources-repository.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/resources/resources-repository.frontend.service.js +2 -0
- package/dist/esm/core/resources/resources-repository.frontend.service.js.map +1 -1
- package/dist/esm/core/resources/resources.frontend.schemas.d.ts +29 -23
- package/dist/esm/core/resources/resources.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/resources/resources.frontend.schemas.js +20 -20
- package/dist/esm/core/resources/resources.frontend.schemas.js.map +1 -1
- package/dist/esm/core/resources/rmm/ResourceMutationManager.d.ts.map +1 -1
- package/dist/esm/core/resources/rmm/ResourceMutationManager.js +4 -0
- package/dist/esm/core/resources/rmm/ResourceMutationManager.js.map +1 -1
- package/dist/esm/core/resources/useResourceOperationActions.d.ts.map +1 -1
- package/dist/esm/core/resources/useResourceOperationActions.js +7 -7
- package/dist/esm/core/resources/useResourceOperationActions.js.map +1 -1
- package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
- package/dist/esm/core/runtime/AppRouter.js +11 -33
- package/dist/esm/core/runtime/AppRouter.js.map +1 -1
- package/dist/esm/core/runtime/ApplicationMainContext.d.ts +15 -1
- package/dist/esm/core/runtime/ApplicationMainContext.d.ts.map +1 -1
- package/dist/esm/core/runtime/ApplicationMainContext.js +41 -23
- package/dist/esm/core/runtime/ApplicationMainContext.js.map +1 -1
- package/dist/esm/core/runtime/IdentityPortalRouter.d.ts +20 -0
- package/dist/esm/core/runtime/IdentityPortalRouter.d.ts.map +1 -0
- package/dist/esm/core/runtime/IdentityPortalRouter.js +31 -0
- package/dist/esm/core/runtime/IdentityPortalRouter.js.map +1 -0
- package/dist/esm/core/runtime/domain-module.frontend.definitions.d.ts +9 -0
- package/dist/esm/core/runtime/domain-module.frontend.definitions.d.ts.map +1 -1
- package/dist/esm/core/runtime/domain-module.frontend.definitions.js +3 -2
- package/dist/esm/core/runtime/domain-module.frontend.definitions.js.map +1 -1
- package/dist/esm/core/runtime/frontend-companion-resource-inputs.d.ts +21 -0
- package/dist/esm/core/runtime/frontend-companion-resource-inputs.d.ts.map +1 -1
- package/dist/esm/core/runtime/frontend-companion-resource-inputs.js +19 -1
- package/dist/esm/core/runtime/frontend-companion-resource-inputs.js.map +1 -1
- package/dist/esm/core/runtime/identity-routes.d.ts +13 -0
- package/dist/esm/core/runtime/identity-routes.d.ts.map +1 -0
- package/dist/esm/core/runtime/identity-routes.js +50 -0
- package/dist/esm/core/runtime/identity-routes.js.map +1 -0
- package/dist/esm/core/runtime/routes.frontend.definitions.d.ts +19 -0
- package/dist/esm/core/runtime/routes.frontend.definitions.d.ts.map +1 -1
- package/dist/esm/core/runtime/routes.frontend.definitions.js +20 -1
- package/dist/esm/core/runtime/routes.frontend.definitions.js.map +1 -1
- package/dist/esm/core/runtime/runtime.frontend.schemas.d.ts +3 -1
- package/dist/esm/core/runtime/runtime.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/core/runtime/runtime.frontend.schemas.js +2 -0
- package/dist/esm/core/runtime/runtime.frontend.schemas.js.map +1 -1
- package/dist/esm/core/runtime/start-application.frontend.service.d.ts +7 -0
- package/dist/esm/core/runtime/start-application.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/runtime/start-application.frontend.service.js +4 -2
- package/dist/esm/core/runtime/start-application.frontend.service.js.map +1 -1
- package/dist/esm/core/search/command-score.d.ts +33 -0
- package/dist/esm/core/search/command-score.d.ts.map +1 -0
- package/dist/esm/core/search/command-score.js +109 -0
- package/dist/esm/core/search/command-score.js.map +1 -0
- package/dist/esm/core/security/AuthSessionContext.d.ts.map +1 -1
- package/dist/esm/core/security/AuthSessionContext.js +4 -0
- package/dist/esm/core/security/AuthSessionContext.js.map +1 -1
- package/dist/esm/core/security/StepUpAuthContext.d.ts +3 -2
- package/dist/esm/core/security/StepUpAuthContext.d.ts.map +1 -1
- package/dist/esm/core/security/StepUpAuthContext.js +7 -2
- package/dist/esm/core/security/StepUpAuthContext.js.map +1 -1
- package/dist/esm/core/security/federated-reauthentication.frontend.d.ts +13 -2
- package/dist/esm/core/security/federated-reauthentication.frontend.d.ts.map +1 -1
- package/dist/esm/core/security/federated-reauthentication.frontend.js +21 -1
- package/dist/esm/core/security/federated-reauthentication.frontend.js.map +1 -1
- package/dist/esm/core/security/useAuthenticatedRouteEntry.d.ts +24 -0
- package/dist/esm/core/security/useAuthenticatedRouteEntry.d.ts.map +1 -0
- package/dist/esm/core/security/useAuthenticatedRouteEntry.js +37 -0
- package/dist/esm/core/security/useAuthenticatedRouteEntry.js.map +1 -0
- package/dist/esm/core/ui/design-token.utils.d.ts +9 -0
- package/dist/esm/core/ui/design-token.utils.d.ts.map +1 -1
- package/dist/esm/core/ui/design-token.utils.js +24 -3
- package/dist/esm/core/ui/design-token.utils.js.map +1 -1
- package/dist/esm/core/ui/themes/focus-indicator.d.ts +1 -1
- package/dist/esm/core/ui/themes/focus-indicator.js +1 -1
- package/dist/esm/core/ui/themes/focus-indicator.js.map +1 -1
- package/dist/esm/core/ui/ui.frontend.schemas.d.ts.map +1 -1
- package/dist/esm/index.d.ts +19 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +22 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/testing/mock-builders.d.ts +1 -1
- package/dist/esm/testing/mock-builders.d.ts.map +1 -1
- package/dist/esm/testing/mock-builders.js +1 -0
- package/dist/esm/testing/mock-builders.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +9 -6
- package/dist/esm/components/views/chart-dashboard/chart-dashboard.utils.d.ts.map +0 -1
- package/dist/esm/components/views/chart-dashboard/chart-dashboard.utils.js.map +0 -1
|
@@ -8,7 +8,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
8
|
* - Self-resolves scope (org/user) from AppScope + user context — no external props needed
|
|
9
9
|
* - Fetches billing state via the GET_STATE resource operation on the billing account
|
|
10
10
|
* - The backend auto-creates the billing account if one doesn't exist
|
|
11
|
-
* - Provides actions: openCheckout, openCustomerPortal (via resource operations)
|
|
11
|
+
* - Provides actions: openCheckout, openInvoicedSubscription, openCustomerPortal (via resource operations)
|
|
12
12
|
* - Caches billing state and invalidates on WebSocket events
|
|
13
13
|
* - Exposes convenience accessors for current plan, subscription status, etc.
|
|
14
14
|
*
|
|
@@ -18,7 +18,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
*/
|
|
19
19
|
import { useApplicationRoleTables } from '../../core/security/useApplicationRoleTables.js';
|
|
20
20
|
import { createContext, useEffect, useState, useCallback, useMemo, useRef } from 'react';
|
|
21
|
-
import { BillingAccount_Operations, BillingSubscription_Operations, BillingSubscription_PreviewPlanChangeRequestDto, BillingSubscription_ChangePlanRequestDto, BillingSubscription_PlanChangePreviewResponseDto, BillingStateResponseSchema, ResourceOperationVariantType, ResourcesConfig_OperationPathUtils, HttpMethod, BillingStateSlice, BillingSliceAvailability, CoreWebSocketEvent, CoreResourceType, ResourcePrimaryScope, MAIN_API_BASE_PATH, userRolesSatisfyRequiredRoles, } from '@wildo-ai/saas-models';
|
|
21
|
+
import { BillingAccount_Operations, BillingSubscription_Operations, BillingSubscription_PreviewPlanChangeRequestDto, BillingSubscription_ChangePlanRequestDto, BillingSubscription_PlanChangePreviewResponseDto, BillingStateResponseSchema, ResourceOperationVariantType, ResourcesConfig_OperationPathUtils, HttpMethod, BillingStateSlice, BillingSliceAvailability, CoreWebSocketEvent, CoreResourceType, ResourcePrimaryScope, MAIN_API_BASE_PATH, userRolesSatisfyRequiredRoles, ResourceOperationIdempotencyKeyRequirement, } from '@wildo-ai/saas-models';
|
|
22
|
+
import { resolveOperationIdempotencyHeaders } from '../../core/requests/wildo-http-client-resources.frontend.service.js';
|
|
22
23
|
import { useWebSocket } from '../../core/requests/websockets/useWebSocket.js';
|
|
23
24
|
import { useUserOrgs } from '../../core/security/useUserOrgs.js';
|
|
24
25
|
import { useAppScopeSafe } from '../../core/scope/useAppScope.js';
|
|
@@ -72,6 +73,11 @@ const SCOPE_TO_OPEN_CHECKOUT_URL = {
|
|
|
72
73
|
[ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-checkout`,
|
|
73
74
|
[ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-checkout`,
|
|
74
75
|
};
|
|
76
|
+
/** Maps ResourcePrimaryScope → OPEN_INVOICED_SUBSCRIPTION URL builder (UPDATE-like → keyed PUT) */
|
|
77
|
+
const SCOPE_TO_OPEN_INVOICED_SUBSCRIPTION_URL = {
|
|
78
|
+
[ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-invoiced-subscription`,
|
|
79
|
+
[ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-invoiced-subscription`,
|
|
80
|
+
};
|
|
75
81
|
/** Maps ResourcePrimaryScope → OPEN_PORTAL URL builder (READ-like → keyed GET) */
|
|
76
82
|
const SCOPE_TO_OPEN_PORTAL_URL = {
|
|
77
83
|
[ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-portal`,
|
|
@@ -163,6 +169,29 @@ export function BillingProvider({ children, productDefinitions: injectedProductD
|
|
|
163
169
|
unresolvableRoles: roleTables.unresolvableRoles,
|
|
164
170
|
});
|
|
165
171
|
}, [isEnabled, billingAccountResourceType, resourceRegistry, permissions, currentOrganizationId, roleTables]);
|
|
172
|
+
/**
|
|
173
|
+
* Who can BUY here: the checkout operation's own roles, decided by the same check as `mayReadBillingState`, and only
|
|
174
|
+
* for someone who may also read the billing state (a checkout is opened from the account the state carries). With no
|
|
175
|
+
* checkout operation in the registry there is no evidence to withhold on, as for the state read.
|
|
176
|
+
*/
|
|
177
|
+
const purchaseAccess = useMemo(() => {
|
|
178
|
+
if (!isEnabled || !billingAccountResourceType)
|
|
179
|
+
return { mayPurchase: false, purchaserRoleRefs: [] };
|
|
180
|
+
const checkoutOperation = resourceRegistry?.registry.resourceConfigurations[billingAccountResourceType]
|
|
181
|
+
?.operations.find((operation) => String(operation.operationIdentifier) === BillingAccount_Operations.OPEN_CHECKOUT && operation.isOperationDefault === true);
|
|
182
|
+
if (!checkoutOperation)
|
|
183
|
+
return { mayPurchase: mayReadBillingState, purchaserRoleRefs: [] };
|
|
184
|
+
const purchaserRoleRefs = (checkoutOperation.roles ?? []).map(String);
|
|
185
|
+
const mayOpenCheckout = userRolesSatisfyRequiredRoles({
|
|
186
|
+
requiredRoles: checkoutOperation.roles,
|
|
187
|
+
userAppRoles: permissions?.appLevel ?? [],
|
|
188
|
+
userOrgRoles: currentOrganizationId ? permissions?.organizations?.[currentOrganizationId] ?? [] : [],
|
|
189
|
+
appRolesConfig: roleTables.appRolesConfig,
|
|
190
|
+
orgRolesConfig: roleTables.orgRolesConfig,
|
|
191
|
+
unresolvableRoles: roleTables.unresolvableRoles,
|
|
192
|
+
});
|
|
193
|
+
return { mayPurchase: mayReadBillingState && mayOpenCheckout, purchaserRoleRefs };
|
|
194
|
+
}, [isEnabled, billingAccountResourceType, resourceRegistry, mayReadBillingState, permissions, currentOrganizationId, roleTables]);
|
|
166
195
|
// ── State ──
|
|
167
196
|
const [billingState, setBillingState] = useState(null);
|
|
168
197
|
const [isLoading, setIsLoading] = useState(mayReadBillingState && !!scopeEntityId);
|
|
@@ -383,6 +412,31 @@ export function BillingProvider({ children, productDefinitions: injectedProductD
|
|
|
383
412
|
checkoutInFlightRef.current = false;
|
|
384
413
|
}
|
|
385
414
|
}, [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, resolvedRedirectBase]);
|
|
415
|
+
const openInvoicedSubscription = useCallback(async (productKey, priceId, options) => {
|
|
416
|
+
if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {
|
|
417
|
+
throw new Error('No billing account available. Cannot subscribe by invoice.');
|
|
418
|
+
}
|
|
419
|
+
const url = SCOPE_TO_OPEN_INVOICED_SUBSCRIPTION_URL[scopeType]?.(scopeEntityId, billingAccountId);
|
|
420
|
+
if (!url) {
|
|
421
|
+
throw new Error(`No OPEN_INVOICED_SUBSCRIPTION URL builder for scope ${scopeType}.`);
|
|
422
|
+
}
|
|
423
|
+
if (checkoutInFlightRef.current) {
|
|
424
|
+
logDebug('A purchase is already in progress, ignoring duplicate request');
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
checkoutInFlightRef.current = true;
|
|
428
|
+
try {
|
|
429
|
+
logDebug('Opening invoiced subscription', { productKey, priceId, ...options });
|
|
430
|
+
// OPEN_INVOICED_SUBSCRIPTION borrows UPDATE → keyed PUT, and REQUIRES an Idempotency-Key: minted once for this
|
|
431
|
+
// call, and re-sent unchanged by the client's own retries.
|
|
432
|
+
await getManualCallsHttpClient().put(url, { productKey, priceId, quantity: options?.quantity, promotionCode: options?.promotionCode }, resolveOperationIdempotencyHeaders(undefined, { idempotencyKey: ResourceOperationIdempotencyKeyRequirement.REQUIRED }));
|
|
433
|
+
// The subscription row arrives from the provider's event; refresh so the screen follows it.
|
|
434
|
+
void fetchBillingState();
|
|
435
|
+
}
|
|
436
|
+
finally {
|
|
437
|
+
checkoutInFlightRef.current = false;
|
|
438
|
+
}
|
|
439
|
+
}, [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, fetchBillingState]);
|
|
386
440
|
const openCustomerPortal = useCallback(async () => {
|
|
387
441
|
if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {
|
|
388
442
|
throw new Error('No billing account available. Cannot open customer portal.');
|
|
@@ -442,6 +496,8 @@ export function BillingProvider({ children, productDefinitions: injectedProductD
|
|
|
442
496
|
}, [callPlanOperation, fetchBillingState]);
|
|
443
497
|
const contextValue = useMemo(() => ({
|
|
444
498
|
isEnabled,
|
|
499
|
+
mayPurchase: purchaseAccess.mayPurchase,
|
|
500
|
+
purchaserRoleRefs: purchaseAccess.purchaserRoleRefs,
|
|
445
501
|
billingConfiguration: billingConfig,
|
|
446
502
|
billingProviderRef,
|
|
447
503
|
billingAccount,
|
|
@@ -460,6 +516,7 @@ export function BillingProvider({ children, productDefinitions: injectedProductD
|
|
|
460
516
|
usage,
|
|
461
517
|
creditPools,
|
|
462
518
|
openCheckout,
|
|
519
|
+
openInvoicedSubscription,
|
|
463
520
|
openCustomerPortal,
|
|
464
521
|
previewPlanChange,
|
|
465
522
|
confirmPlanChange,
|
|
@@ -471,6 +528,7 @@ export function BillingProvider({ children, productDefinitions: injectedProductD
|
|
|
471
528
|
refetch: fetchBillingState,
|
|
472
529
|
}), [
|
|
473
530
|
isEnabled,
|
|
531
|
+
purchaseAccess,
|
|
474
532
|
billingConfig,
|
|
475
533
|
billingProviderRef,
|
|
476
534
|
billingAccount,
|
|
@@ -489,6 +547,7 @@ export function BillingProvider({ children, productDefinitions: injectedProductD
|
|
|
489
547
|
usage,
|
|
490
548
|
creditPools,
|
|
491
549
|
openCheckout,
|
|
550
|
+
openInvoicedSubscription,
|
|
492
551
|
openCustomerPortal,
|
|
493
552
|
previewPlanChange,
|
|
494
553
|
confirmPlanChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BillingContext.js","sourceRoot":"","sources":["../../../../src/core/billing/BillingContext.tsx"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AACtG,OAAc,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAehG,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,+CAA+C,EAC/C,wCAAwC,EACxC,gDAAgD,EAChD,0BAA0B,EAC1B,4BAA4B,EAC5B,kCAAkC,EAClC,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EAAE,wBAAwB,EAAE,MAAM,mFAAmF,CAAC;AAC7H,OAAO,EAAE,gBAAgB,EAAE,MAAM,kEAAkE,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iEAAiE,CAAC;AAE3G,mCAAmC;AACnC,SAAS;AACT,mCAAmC;AAEnC,MAAM,aAAa,GAA0B,qBAAq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Ac;QACd,YAAY;QACZ,cAAc;QACd,kBAAkB;QAClB,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,kBAAkB;QAClB,mBAAmB;QACnB,eAAe;QACf,mBAAmB;QACnB,gBAAgB;QAChB,KAAK;QACL,WAAW;QACX,YAAY;QACZ,kBAAkB;QAClB,iBAAiB;QACjB,iBAAiB;QACjB,uBAAuB;QACvB,SAAS;QACT,YAAY;QACZ,gBAAgB;QAChB,KAAK;QACL,OAAO,EAAE,iBAAiB;KAC3B,CAAC,EACF;QACE,SAAS;QACT,aAAa;QACb,kBAAkB;QAClB,cAAc;QACd,YAAY;QACZ,cAAc;QACd,kBAAkB;QAClB,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,kBAAkB;QAClB,mBAAmB;QACnB,eAAe;QACf,mBAAmB;QACnB,gBAAgB;QAChB,KAAK;QACL,WAAW;QACX,YAAY;QACZ,kBAAkB;QAClB,iBAAiB;QACjB,iBAAiB;QACjB,uBAAuB;QACvB,SAAS;QACT,YAAY;QACZ,gBAAgB;QAChB,KAAK;QACL,iBAAiB;KAClB,CACF,CAAC;IAEF,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACzC,QAAQ,GACe,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { z } from 'zod';\n/**\n * BillingContext\n *\n * Central context for billing operations on the frontend.\n *\n * Responsibilities:\n * - Self-resolves scope (org/user) from AppScope + user context — no external props needed\n * - Fetches billing state via the GET_STATE resource operation on the billing account\n * - The backend auto-creates the billing account if one doesn't exist\n * - Provides actions: openCheckout, openCustomerPortal (via resource operations)\n * - Caches billing state and invalidates on WebSocket events\n * - Exposes convenience accessors for current plan, subscription status, etc.\n *\n * DELEGATION PRINCIPLE: The frontend does NOT build payment UI.\n * - Stripe Checkout (hosted page): for new subscriptions and upgrades\n * - Stripe Customer Portal (hosted page): for invoices, payment methods, cancellation\n */\n\nimport { useApplicationRoleTables } from '~wildo-frontend-lib/core/security/useApplicationRoleTables';\nimport React, { createContext, useEffect, useState, useCallback, useMemo, useRef } from 'react';\nimport type {\n BillingAccount,\n BillingSubscriptionBase,\n Product,\n Price,\n Promotion,\n InvoiceRef,\n UsageSummary,\n BillingConfiguration,\n ProductDefinition,\n BillingStateResponse,\n BillingStateAvailability,\n WS_BillingEventPayload,\n} from '@wildo-ai/saas-models';\nimport {\n BillingAccount_Operations,\n BillingSubscription_Operations,\n BillingSubscription_PreviewPlanChangeRequestDto,\n BillingSubscription_ChangePlanRequestDto,\n BillingSubscription_PlanChangePreviewResponseDto,\n BillingStateResponseSchema,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n HttpMethod,\n BillingStateSlice,\n BillingSliceAvailability,\n CoreWebSocketEvent,\n CoreResourceType,\n ResourcePrimaryScope,\n MAIN_API_BASE_PATH,\n userRolesSatisfyRequiredRoles,\n} from '@wildo-ai/saas-models';\nimport { useWebSocket } from '~wildo-frontend-lib/core/requests/websockets/useWebSocket';\nimport { useUserOrgs } from '~wildo-frontend-lib/core/security/useUserOrgs';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { useApplication } from '~wildo-frontend-lib/core/runtime/useApplication';\nimport { isResourceReachable, useResourceRegistrySafe } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { getManualCallsHttpClient } from '~wildo-frontend-lib/core/requests/wildo-http-client-manual-calls.frontend.service';\nimport { readJsonResponse } from '~wildo-frontend-lib/core/requests/json-response-reading.frontend';\nimport { useEmitLoadingScope } from '~wildo-frontend-lib/core/loading/useEmitLoadingScope';\nimport { ContextLoadingIdentifier } from '~wildo-frontend-lib/core/loading/loading-types.frontend.schemas';\n\n// ================================\n// Logger\n// ================================\n\nconst billingLogger: LoggerFrontendService = LoggerFrontendService.getLogger();\nconst logDebug: (message: string, context?: Record<string, unknown>) => void = billingLogger.debugByType('BillingContext');\nbillingLogger.setDebugTypeLogging('BillingContext', false);\n\n// ================================\n// Constants\n// ================================\n\nconst API_PREFIX = MAIN_API_BASE_PATH;\n\n/** WebSocket events that trigger a refetch of billing state */\nconst INVALIDATION_EVENTS = [\n CoreWebSocketEvent.BILLING_STATUS_CHANGED,\n CoreWebSocketEvent.BILLING_SUBSCRIPTION_UPDATED,\n CoreWebSocketEvent.BILLING_ACCOUNT_CHANGED,\n CoreWebSocketEvent.BILLING_USAGE_UPDATED,\n CoreWebSocketEvent.BILLING_CREDIT_POOL_UPDATED,\n CoreWebSocketEvent.BILLING_FEATURES_UPDATED,\n] as const;\n\n/** Maps ResourcePrimaryScope → billing account variant resource type (for resource operations) */\nconst SCOPE_TO_BILLING_ACCOUNT_RESOURCE: Record<string, string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS,\n [ResourcePrimaryScope.USER_SELF]: CoreResourceType.USER_BILLING_ACCOUNTS,\n};\n\n// The billing-account GET_STATE / OPEN_CHECKOUT / OPEN_PORTAL custom operations\n// borrow COUNT / UPDATE / READ core semantics (see\n// `billing-account.shared.resources-config.schemas.ts`), so their canonical\n// routes follow the framework's scoped resource-operation shape:\n// GET_STATE (COUNT-like) → GET /<scope>/{id}/<res>/get-state/count\n// OPEN_CHECKOUT (UPDATE-like) → PUT /<scope>/{id}/<res>/{accountId}/open-checkout\n// OPEN_PORTAL (READ-like) → GET /<scope>/{id}/<res>/{accountId}/open-portal\n// Built here to mirror the routes the backend registers from the same\n// resources-config; the prior `/operations/open_checkout` POST 404'd.\n\n/** Maps ResourcePrimaryScope → GET_STATE URL builder (COUNT-like → trailing `/count`) */\nconst SCOPE_TO_GET_STATE_URL: Record<string, (scopeEntityId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/get-state/count`,\n [ResourcePrimaryScope.USER_SELF]: (id) => `${API_PREFIX}/users/${id}/user-billing-accounts/get-state/count`,\n};\n\n/** Maps ResourcePrimaryScope → OPEN_CHECKOUT URL builder (UPDATE-like → keyed PUT) */\nconst SCOPE_TO_OPEN_CHECKOUT_URL: Record<string, (scopeEntityId: string, billingAccountId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-checkout`,\n [ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-checkout`,\n};\n\n/** Maps ResourcePrimaryScope → OPEN_PORTAL URL builder (READ-like → keyed GET) */\nconst SCOPE_TO_OPEN_PORTAL_URL: Record<string, (scopeEntityId: string, billingAccountId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-portal`,\n [ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-portal`,\n};\n\n// ================================\n// API Response Types\n// ================================\n\n/** Response from PUT /<scope>/{id}/<billing-accounts>/{accountId}/open-checkout (OPEN_CHECKOUT) */\ninterface CheckoutSessionResponse {\n url: string;\n sessionId: string;\n}\n\n/** Response from GET /<scope>/{id}/<billing-accounts>/{accountId}/open-portal (OPEN_PORTAL) */\ninterface PortalSessionResponse {\n url: string;\n}\n\n// ================================\n// Context Type\n// ================================\n\n/**\n * @wildo_source:part:start saas.frontend.billing-context facet:layer:frontend facet:audience:app-developer\n *\n * Everything an application's own frontend reads or does about billing. Reached with `useBilling()`,\n * which throws outside a `BillingProvider`; `useBillingSafe()` returns `undefined` instead, for a\n * component that may render before the provider mounts or in an application where billing is off.\n *\n * The shipped billing components and the feature-gating hooks read this same context, so an\n * application composing its own purchase flow works from exactly what they do — no application code\n * builds the request.\n *\n * ## Starting a purchase\n *\n * `openCheckout(productKey, priceId, options)` posts to the scoped billing-account route and follows\n * the returned URL; success and cancel destinations come from the application's own redirect base. A\n * SECOND call while one is in flight is IGNORED, so a double-click cannot open two sessions — do not\n * add your own guard expecting otherwise, and do not read the silence as a failure.\n *\n * The `priceId` must belong to the product named by `productKey`; the checkout operation refuses a\n * mismatched pair. Resolve it through `getPricesForProduct` rather than assuming an ordering.\n *\n * `openCustomerPortal()` opens the provider's own portal — which is where payment methods, card\n * updates and receipt downloads live. Those are deliberately NOT rendered by the framework, so an\n * application that needs them links the portal rather than building them.\n *\n * ## What `usage` contains\n *\n * Metered consumption appears here only if the application RECORDS it. Nothing is automatic: a\n * metered product with no recorded usage shows an empty dashboard rather than an error.\n *\n * ## Invoices are capped\n *\n * `invoices` carries the fifty most recent, which is what the shipped history component renders. An\n * application needing more reads the invoices resource directly.\n */\nexport type BillingPlanChangeTarget = z.infer<typeof BillingSubscription_PreviewPlanChangeRequestDto>;\nexport type BillingPlanChangeConfirmation = z.infer<typeof BillingSubscription_ChangePlanRequestDto>;\nexport type BillingPlanChangePreviewResponse = z.infer<typeof BillingSubscription_PlanChangePreviewResponseDto>;\n\nexport interface BillingContextType {\n // ── Configuration ──\n isEnabled: boolean;\n billingConfiguration: BillingConfiguration | undefined;\n /**\n * The configured billing provider's REF (`billing.providerRef`), or null when billing is off or\n * names none. Surfaces show the vendor's name from it (`providers.<ref>.displayName`, #1895).\n *\n * It used to be a frontend provider MODULE, resolved from the registry by ref or by the `BILLING`\n * capability. The only such module was Stripe's, which loaded no Stripe code — checkout and the\n * customer portal are hosted redirects — and existed only to carry that name (#1701). The ref is the\n * fact the application configured; a module was a second place that had to agree with it.\n */\n billingProviderRef: string | null;\n\n // ── Billing State ──\n billingAccount: BillingAccount | null;\n subscription: BillingSubscriptionBase | null;\n currentPlanKey: string | null;\n currentPlanProduct: Product | null;\n\n // ── Product Catalog ──\n products: Product[];\n prices: Price[];\n productDefinitions: ProductDefinition[];\n getPricesForProduct: (productId: string) => Price[];\n getProductByKey: (key: string) => Product | undefined;\n /**\n * May this product be bought, or moved onto, right now? Answered from the billing state's\n * `acquirableProductKeys` — the set the backend derives with the SAME predicate its checkout,\n * plan-change and add-on doors enforce — so a surface never re-derives it from `isActive` and can\n * never offer a plan the backend refuses (a retired one, or an announced-but-upcoming one, #1835).\n * Fails closed: a state that did not carry the set answers `false`, because an unknown answer must\n * not offer a checkout.\n */\n isProductAcquirable: (key: string) => boolean;\n\n // ── Scope ──\n currentScope: ResourcePrimaryScope | null;\n\n // ── Invoices ──\n invoices: InvoiceRef[];\n\n // ── Promotions ──\n activePromotions: Promotion[];\n\n // ── Usage & Credits ──\n usage: UsageSummary;\n creditPools: Record<string, { available: number; totalPurchased: number; totalGranted: number; totalConsumed: number }>;\n\n // ── Actions ──\n openCheckout: (productKey: string, priceId: string, options?: {\n quantity?: number;\n promotionCode?: string;\n }) => Promise<void>;\n\n openCustomerPortal: () => Promise<void>;\n /** Provider estimate bound to the current subscription and selected target; never commits a change. */\n previewPlanChange: (target: BillingPlanChangeTarget, options?: { signal?: AbortSignal }) => Promise<BillingPlanChangePreviewResponse>;\n /** Confirm only the server token returned for the displayed preview. Successful mutation refreshes billing state. */\n confirmPlanChange: (confirmation: BillingPlanChangeConfirmation) => Promise<void>;\n /**\n * Withdraw the plan change pending at the end of the period (`subscription.pendingPlanChange`, #1868), so the subscription renews\n * on its current plan. Successful withdrawal refreshes billing state.\n */\n cancelPendingPlanChange: () => Promise<void>;\n\n // ── State ──\n isLoading: boolean;\n error: Error | null;\n /** Only a successful slice read establishes emptiness; failed or absent state is unavailable. */\n availability: BillingStateAvailability | null;\n isSliceAvailable: (slice: BillingStateSlice) => boolean;\n\n // ── Actions ──\n refetch: () => void;\n}\n\n// ── Default empty state ──\nconst EMPTY_USAGE: UsageSummary = {\n byProduct: {},\n};\n\n/** @wildo_source:part:end saas.frontend.billing-context */\n\nexport const BillingContext: React.Context<BillingContextType | undefined> = createContext<BillingContextType | undefined>(undefined);\n\n// ================================\n// Provider\n// ================================\n\nexport interface BillingProviderProps {\n children: React.ReactNode;\n productDefinitions?: ProductDefinition[];\n}\n\nexport function BillingProvider({ children, productDefinitions: injectedProductDefinitions }: BillingProviderProps): React.ReactElement {\n // ── Self-resolve configuration from hooks ──\n const userOrgs = useUserOrgs();\n const appScope = useAppScopeSafe();\n const { appConfig } = useApplication();\n const resourceRegistry = useResourceRegistrySafe();\n const billingConfig = appConfig.billing;\n /** What the application CONFIGURED — see `isEnabled` below for why that is only half the answer. */\n const isConfiguredEnabled = billingConfig?.enabled ?? false;\n const billingProviderRef = isConfiguredEnabled ? billingConfig?.providerRef ?? null : null;\n\n // ── Self-resolve scope ──\n const enabledScopes = billingConfig?.enabledScopes ?? [ResourcePrimaryScope.ORGANIZATIONS];\n\n const { scopeType, scopeEntityId } = useMemo(() => {\n if (enabledScopes.includes(ResourcePrimaryScope.ORGANIZATIONS) && appScope?.currentOrganizationId) {\n return { scopeType: ResourcePrimaryScope.ORGANIZATIONS as ResourcePrimaryScope, scopeEntityId: appScope.currentOrganizationId };\n }\n if (enabledScopes.includes(ResourcePrimaryScope.USER_SELF) && userOrgs.user?._id) {\n return { scopeType: ResourcePrimaryScope.USER_SELF as ResourcePrimaryScope, scopeEntityId: userOrgs.user._id };\n }\n return { scopeType: null as ResourcePrimaryScope | null, scopeEntityId: null as string | null };\n }, [enabledScopes, appScope?.currentOrganizationId, userOrgs.user?._id]);\n\n // ── Derive variant resource type for operations ──\n const billingAccountResourceType = scopeType ? SCOPE_TO_BILLING_ACCOUNT_RESOURCE[scopeType] : null;\n\n /**\n * Enabled means CONFIGURED **and** REACHABLE — the config flag alone was not enough.\n *\n * Every request this provider makes is an operation on a billing-account resource, so a consumer\n * whose registry does not carry that resource cannot serve one no matter what the config says.\n * That is not hypothetical: the application-creation workbench excludes the whole tenant\n * vocabulary from its registry (it observes an application's creation and is not that\n * application's admin console) while rendering the OBSERVED application's config, which has\n * billing enabled — so it fired `organization-billing-accounts/get-state/count` at its own origin\n * on every page load, where the companion serves no billing routes, and answered 404 every time\n * (issue #268, reproduced live).\n *\n * Reading the registry rather than adding a second opt-out keeps the two halves from disagreeing:\n * a consumer that excludes the resource has already said billing is not part of its surface, and\n * saying it twice is how the two copies drift. A tenant application carries the resource and is\n * unaffected.\n */\n const isEnabled = isConfiguredEnabled\n && billingAccountResourceType !== null\n // The absent-registry-is-ignorance rule lives on the seam (`isResourceReachable`), shared with the\n // features, guidance and analytics providers since #1069 so the four cannot drift.\n && isResourceReachable(resourceRegistry, billingAccountResourceType);\n\n /**\n * Whether THIS CALLER may read the billing state served for this scope — kept separate from `isEnabled`, on purpose.\n *\n * `isEnabled` says billing is PART OF the application. Every consumer of it — feature availability, operation\n * gating, the launcher — needs that answer for every user alike, so it must not vary with who is looking.\n *\n * Fetching is a different question. `GET_STATE` is role-gated per scope (organization owners and administrators on\n * the organization variant), and a plain member used to request it on every page load, be refused with 403, and\n * see an access-denied message on a page with nothing wrong with it (#1039). That member already ended with a null\n * billing state — the refusal produced it — so not asking changes nothing they can see except the message.\n *\n * The required roles are read from the registry's OWN operation, never copied, and decided by the same\n * hierarchy-aware check the action bar uses. That check fails open on a role it cannot resolve, so a custom role\n * inheriting an administrator role is not locked out here — the server stays the authority either way. With no\n * registry, or no such operation in it, there is no evidence to withhold on, and the request goes out as before.\n */\n const permissions = userOrgs.permissions;\n const currentOrganizationId = appScope?.currentOrganizationId ?? null;\n const roleTables = useApplicationRoleTables();\n const mayReadBillingState = useMemo((): boolean => {\n if (!isEnabled || !billingAccountResourceType) return false;\n const getStateOperation = resourceRegistry?.registry.resourceConfigurations[billingAccountResourceType]\n ?.operations.find((operation) =>\n String(operation.operationIdentifier) === BillingAccount_Operations.GET_STATE && operation.isOperationDefault === true);\n if (!getStateOperation) return true;\n return userRolesSatisfyRequiredRoles({\n requiredRoles: getStateOperation.roles,\n userAppRoles: permissions?.appLevel ?? [],\n userOrgRoles: currentOrganizationId ? permissions?.organizations?.[currentOrganizationId] ?? [] : [],\n appRolesConfig: roleTables.appRolesConfig,\n orgRolesConfig: roleTables.orgRolesConfig,\n unresolvableRoles: roleTables.unresolvableRoles,\n });\n }, [isEnabled, billingAccountResourceType, resourceRegistry, permissions, currentOrganizationId, roleTables]);\n\n // ── State ──\n const [billingState, setBillingState] = useState<BillingStateResponse | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(mayReadBillingState && !!scopeEntityId);\n const [error, setError] = useState<Error | null>(null);\n\n // L-2.b: mirror local loading state onto the LoadingContext event bus so\n // unrelated components can observe billing-state lifecycle via\n // `useComponentLoading({ customIdentifier: ContextLoadingIdentifier.BILLING_STATE })`\n // or `<LoadingGate scopes={[buildContextLoadingScope(BILLING_STATE)]}>`.\n // Local `isLoading` is still exposed for direct consumers (back-compat).\n useEmitLoadingScope({\n identifier: ContextLoadingIdentifier.BILLING_STATE,\n isLoading,\n hasLoadedOnce: billingState !== null,\n });\n\n // ── Refs for stable callbacks ──\n const fetchInFlightRef = useRef<boolean>(false);\n const mountedRef = useRef<boolean>(true);\n const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const checkoutInFlightRef = useRef<boolean>(false);\n\n // ── WebSocket ──\n const { on } = useWebSocket();\n\n // ── Resolve redirect base URL ──\n const resolvedRedirectBase = useMemo(\n () => typeof window !== 'undefined' ? window.location.origin : '',\n [],\n );\n\n // ── billingAccountId from response ──\n const billingAccountId = billingState?.billingAccount?._id ?? null;\n\n // ── Clear stale state on scope change ──\n useEffect(() => {\n setBillingState(null);\n setError(null);\n setIsLoading(mayReadBillingState && !!scopeEntityId);\n }, [scopeType, scopeEntityId, mayReadBillingState]);\n\n // ── Fetch billing state from backend ──\n const fetchBillingState = useCallback(async () => {\n if (!mayReadBillingState || !scopeType || !scopeEntityId) return;\n if (fetchInFlightRef.current) return;\n fetchInFlightRef.current = true;\n\n try {\n logDebug('Fetching billing state', { scopeType, scopeEntityId });\n const httpClient = getManualCallsHttpClient();\n\n const urlBuilder = SCOPE_TO_GET_STATE_URL[scopeType];\n if (!urlBuilder) return;\n const url = urlBuilder(scopeEntityId);\n // Its dates restored (#3478): `useBilling()` promises they are Dates, and a cast left them strings.\n const response: BillingStateResponse = readJsonResponse(BillingStateResponseSchema, await httpClient.get<unknown>(url));\n\n if (mountedRef.current) {\n setBillingState(response);\n setError(null);\n\n logDebug('Billing state fetched', {\n hasAccount: !!response.billingAccount,\n hasSubscription: !!response.subscription,\n productCount: response.products?.length ?? 0,\n priceCount: response.prices?.length ?? 0,\n billingAccountId: response.billingAccount?._id,\n });\n }\n } catch (err: unknown) {\n if (mountedRef.current) {\n const message = err instanceof Error ? err.message : 'Failed to fetch billing state';\n setBillingState(null);\n setError(err instanceof Error ? err : new Error(message));\n logDebug('Failed to fetch billing state', { error: message });\n }\n } finally {\n if (mountedRef.current) {\n setIsLoading(false);\n }\n fetchInFlightRef.current = false;\n }\n }, [mayReadBillingState, scopeType, scopeEntityId]);\n\n // ── Initial fetch ──\n useEffect(() => {\n mountedRef.current = true;\n if (mayReadBillingState && scopeType && scopeEntityId) {\n fetchBillingState();\n } else {\n setIsLoading(false);\n }\n return () => {\n mountedRef.current = false;\n };\n }, [fetchBillingState, mayReadBillingState, scopeType, scopeEntityId]);\n\n // ── WebSocket invalidation (debounced) ──\n useEffect(() => {\n if (!mayReadBillingState) return;\n\n const unsubscribers: Array<() => void> = [];\n\n const debouncedRefetch = () => {\n if (debounceTimerRef.current) {\n clearTimeout(debounceTimerRef.current);\n }\n debounceTimerRef.current = setTimeout(() => {\n debounceTimerRef.current = null;\n fetchBillingState();\n }, 300);\n };\n\n for (const event of INVALIDATION_EVENTS) {\n const unsub = on<WS_BillingEventPayload>(event, (payload) => {\n if (!scopeType || !scopeEntityId) {\n logDebug('Ignoring billing invalidation without active scope', { event, payload });\n return;\n }\n\n if (payload.scopeType !== scopeType || payload.scopeEntityId !== scopeEntityId) {\n logDebug('Ignoring billing invalidation for another scope', {\n event,\n payload,\n currentScopeType: scopeType,\n currentScopeEntityId: scopeEntityId,\n });\n return;\n }\n\n if (billingAccountId && payload.billingAccountId !== billingAccountId) {\n logDebug('Ignoring billing invalidation for another billing account', {\n event,\n payload,\n currentBillingAccountId: billingAccountId,\n });\n return;\n }\n\n logDebug('WebSocket invalidation event received, scheduling refetch', { event, payload });\n debouncedRefetch();\n });\n unsubscribers.push(unsub);\n }\n\n return () => {\n if (debounceTimerRef.current) {\n clearTimeout(debounceTimerRef.current);\n }\n for (const unsub of unsubscribers) {\n unsub();\n }\n };\n }, [on, fetchBillingState, mayReadBillingState, scopeType, scopeEntityId, billingAccountId]);\n\n // ── Derived state ──\n const availability = billingState?.availability ?? null;\n const isSliceAvailable = useCallback((slice: BillingStateSlice) => availability?.[slice] === BillingSliceAvailability.AVAILABLE, [availability]);\n\n const billingAccount = billingState?.billingAccount ?? null;\n const subscription = billingState?.subscription ?? null;\n const products = billingState?.products ?? [];\n const prices = billingState?.prices ?? [];\n const invoices = billingState?.invoices ?? [];\n const usage = billingState?.usage ?? EMPTY_USAGE;\n const creditPools = billingState?.creditPools ?? {};\n const activePromotions = billingState?.activePromotions ?? [];\n const acquirableProductKeys = billingState?.acquirableProductKeys;\n const currentScope = scopeType ?? null;\n\n // ── Product catalog lookups ──\n const productsByKey = useMemo(() => {\n const map = new Map<string, Product>();\n for (const p of products) {\n map.set(p.key, p);\n }\n return map;\n }, [products]);\n\n const pricesByProductId = useMemo(() => {\n const map = new Map<string, Price[]>();\n for (const price of prices) {\n const existing = map.get(price.productId) ?? [];\n existing.push(price);\n map.set(price.productId, existing);\n }\n return map;\n }, [prices]);\n\n const getPricesForProduct = useCallback(\n (productId: string): Price[] => pricesByProductId.get(productId) ?? [],\n [pricesByProductId],\n );\n\n const getProductByKey = useCallback(\n (key: string): Product | undefined => productsByKey.get(key),\n [productsByKey],\n );\n\n const acquirableProductKeySet = useMemo(() => new Set(acquirableProductKeys ?? []), [acquirableProductKeys]);\n const isProductAcquirable = useCallback((key: string): boolean => acquirableProductKeySet.has(key), [acquirableProductKeySet]);\n\n // ── Current plan derivation ──\n const { currentPlanKey, currentPlanProduct } = useMemo(() => {\n if (!subscription || !subscription.items?.length) {\n return { currentPlanKey: null, currentPlanProduct: null };\n }\n for (const item of subscription.items) {\n const product = products.find(p => p._id === item.productId);\n if (product && product.type === 'plan') {\n return { currentPlanKey: product.key, currentPlanProduct: product };\n }\n }\n return { currentPlanKey: null, currentPlanProduct: null };\n }, [subscription, products]);\n\n const productDefinitions = useMemo<ProductDefinition[]>(\n () => injectedProductDefinitions ?? [],\n [injectedProductDefinitions],\n );\n\n // ── Actions ──\n const openCheckout = useCallback(\n async (productKey: string, priceId: string, options?: {\n quantity?: number;\n promotionCode?: string;\n }): Promise<void> => {\n if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {\n throw new Error('No billing account available. Cannot open checkout.');\n }\n const checkoutUrl = SCOPE_TO_OPEN_CHECKOUT_URL[scopeType]?.(scopeEntityId, billingAccountId);\n if (!checkoutUrl) {\n throw new Error(`No OPEN_CHECKOUT URL builder for scope ${scopeType}.`);\n }\n if (checkoutInFlightRef.current) {\n logDebug('Checkout already in progress, ignoring duplicate request');\n return;\n }\n\n checkoutInFlightRef.current = true;\n try {\n logDebug('Opening checkout session', { productKey, priceId, ...options });\n const httpClient = getManualCallsHttpClient();\n\n // OPEN_CHECKOUT borrows UPDATE → keyed PUT on the scoped account route.\n const response = await httpClient.put<CheckoutSessionResponse>(\n checkoutUrl,\n {\n productKey,\n priceId,\n successUrl: `${resolvedRedirectBase}/billing/success?session_id={CHECKOUT_SESSION_ID}`,\n cancelUrl: `${resolvedRedirectBase}/billing/cancel`,\n quantity: options?.quantity,\n promotionCode: options?.promotionCode,\n },\n );\n\n if (response.url) {\n window.location.href = response.url;\n }\n } finally {\n checkoutInFlightRef.current = false;\n }\n },\n [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, resolvedRedirectBase],\n );\n\n const openCustomerPortal = useCallback(async (): Promise<void> => {\n if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {\n throw new Error('No billing account available. Cannot open customer portal.');\n }\n const portalUrlBase = SCOPE_TO_OPEN_PORTAL_URL[scopeType]?.(scopeEntityId, billingAccountId);\n if (!portalUrlBase) {\n throw new Error(`No OPEN_PORTAL URL builder for scope ${scopeType}.`);\n }\n\n logDebug('Opening customer portal session');\n const httpClient = getManualCallsHttpClient();\n\n // OPEN_PORTAL borrows READ → keyed GET on the scoped account route; the\n // returnUrl travels as a query param since GET carries no request body.\n const returnUrl = encodeURIComponent(`${resolvedRedirectBase}/billing`);\n const response = await httpClient.get<PortalSessionResponse>(\n `${portalUrlBase}?returnUrl=${returnUrl}`,\n );\n\n if (response.url) {\n window.location.href = response.url;\n }\n }, [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, resolvedRedirectBase]);\n\n // ── Context value (memoized for stable reference) ──\n // Use the registry's compiled operation paths and parameter vocabulary. Subscription routes have\n // account and scope parents; hand-authored URLs would silently diverge between org and user variants.\n const callPlanOperation = useCallback(async <TResponse,>(\n operationIdentifier: BillingSubscription_Operations,\n payload: BillingPlanChangeTarget | BillingPlanChangeConfirmation | Record<string, never>,\n signal?: AbortSignal,\n ): Promise<TResponse> => {\n if (!resourceRegistry || !subscription?._id || !billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId\n || ![BillingStateSlice.BILLING_ACCOUNT, BillingStateSlice.SUBSCRIPTION, BillingStateSlice.PRODUCTS, BillingStateSlice.PRICES].every(isSliceAvailable)) {\n throw new Error('Billing plan change context is unavailable.');\n }\n const subscriptionType = scopeType === ResourcePrimaryScope.ORGANIZATIONS ? CoreResourceType.ORGANIZATION_SUBSCRIPTIONS : CoreResourceType.USER_SUBSCRIPTIONS;\n const config = resourceRegistry.registry.resourceConfigurations[subscriptionType];\n const operation = config?.operations.find(candidate => candidate.operationIdentifier === operationIdentifier\n && candidate.variantType === ResourceOperationVariantType.API_CALL && candidate.isOperationDefault);\n if (!operation || operation.variantType !== ResourceOperationVariantType.API_CALL) throw new Error('Billing plan change operation is unavailable.');\n const fields = resourceRegistry.registry.allResourceFieldIdentifiers;\n const scopeResourceType = scopeType === ResourcePrimaryScope.ORGANIZATIONS ? CoreResourceType.ORGANIZATIONS : CoreResourceType.USERS;\n const accountField = fields[billingAccountResourceType];\n const scopeField = fields[scopeResourceType];\n if (!config.resourceFieldIdentifier || !accountField || !scopeField) throw new Error('Billing plan change route context is unavailable.');\n return resourceRegistry.doOperation<TResponse>(ResourcesConfig_OperationPathUtils.createOperationPathKeyFromOperation(operation), {\n contextualParameters: { [config.resourceFieldIdentifier]: subscription._id, [accountField]: billingAccountId, [scopeField]: scopeEntityId },\n ...(operation.httpVerb === HttpMethod.GET ? { queryParameters: payload } : { requestData: payload }),\n }, { signal, silent: true });\n }, [resourceRegistry, subscription?._id, billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, isSliceAvailable]);\n\n const previewPlanChange = useCallback(async (target: BillingPlanChangeTarget, options?: { signal?: AbortSignal }): Promise<BillingPlanChangePreviewResponse> => {\n const parsed = BillingSubscription_PreviewPlanChangeRequestDto.parse(target);\n const response = await callPlanOperation<BillingPlanChangePreviewResponse>(BillingSubscription_Operations.PREVIEW_PLAN_CHANGE, parsed, options?.signal);\n return BillingSubscription_PlanChangePreviewResponseDto.parse(response);\n }, [callPlanOperation]);\n\n const confirmPlanChange = useCallback(async (confirmation: BillingPlanChangeConfirmation): Promise<void> => {\n const parsed = BillingSubscription_ChangePlanRequestDto.parse(confirmation);\n await callPlanOperation(BillingSubscription_Operations.CHANGE_PLAN, parsed);\n await fetchBillingState();\n }, [callPlanOperation, fetchBillingState]);\n\n const cancelPendingPlanChange = useCallback(async (): Promise<void> => {\n await callPlanOperation(BillingSubscription_Operations.CANCEL_PLAN_CHANGE, {});\n await fetchBillingState();\n }, [callPlanOperation, fetchBillingState]);\n\n const contextValue: BillingContextType = useMemo(\n () => ({\n isEnabled,\n billingConfiguration: billingConfig,\n billingProviderRef,\n billingAccount,\n subscription,\n currentPlanKey,\n currentPlanProduct,\n currentScope,\n products,\n prices,\n invoices,\n productDefinitions,\n getPricesForProduct,\n getProductByKey,\n isProductAcquirable,\n activePromotions,\n usage,\n creditPools,\n openCheckout,\n openCustomerPortal,\n previewPlanChange,\n confirmPlanChange,\n cancelPendingPlanChange,\n isLoading,\n availability,\n isSliceAvailable,\n error,\n refetch: fetchBillingState,\n }),\n [\n isEnabled,\n billingConfig,\n billingProviderRef,\n billingAccount,\n subscription,\n currentPlanKey,\n currentPlanProduct,\n currentScope,\n products,\n prices,\n invoices,\n productDefinitions,\n getPricesForProduct,\n getProductByKey,\n isProductAcquirable,\n activePromotions,\n usage,\n creditPools,\n openCheckout,\n openCustomerPortal,\n previewPlanChange,\n confirmPlanChange,\n cancelPendingPlanChange,\n isLoading,\n availability,\n isSliceAvailable,\n error,\n fetchBillingState,\n ],\n );\n\n return (\n <BillingContext.Provider value={contextValue}>\n {children}\n </BillingContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BillingContext.js","sourceRoot":"","sources":["../../../../src/core/billing/BillingContext.tsx"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AACtG,OAAc,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAehG,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,+CAA+C,EAC/C,wCAAwC,EACxC,gDAAgD,EAChD,0BAA0B,EAC1B,4BAA4B,EAC5B,kCAAkC,EAClC,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,0CAA0C,GAC3C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kCAAkC,EAAE,MAAM,gFAAgF,CAAC;AACpI,OAAO,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AACzF,OAAO,EAA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AuB;QACvB,SAAS;QACT,YAAY;QACZ,gBAAgB;QAChB,KAAK;QACL,OAAO,EAAE,iBAAiB;KAC3B,CAAC,EACF;QACE,SAAS;QACT,cAAc;QACd,aAAa;QACb,kBAAkB;QAClB,cAAc;QACd,YAAY;QACZ,cAAc;QACd,kBAAkB;QAClB,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,kBAAkB;QAClB,mBAAmB;QACnB,eAAe;QACf,mBAAmB;QACnB,gBAAgB;QAChB,KAAK;QACL,WAAW;QACX,YAAY;QACZ,wBAAwB;QACxB,kBAAkB;QAClB,iBAAiB;QACjB,iBAAiB;QACjB,uBAAuB;QACvB,SAAS;QACT,YAAY;QACZ,gBAAgB;QAChB,KAAK;QACL,iBAAiB;KAClB,CACF,CAAC;IAEF,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACzC,QAAQ,GACe,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { z } from 'zod';\n/**\n * BillingContext\n *\n * Central context for billing operations on the frontend.\n *\n * Responsibilities:\n * - Self-resolves scope (org/user) from AppScope + user context — no external props needed\n * - Fetches billing state via the GET_STATE resource operation on the billing account\n * - The backend auto-creates the billing account if one doesn't exist\n * - Provides actions: openCheckout, openInvoicedSubscription, openCustomerPortal (via resource operations)\n * - Caches billing state and invalidates on WebSocket events\n * - Exposes convenience accessors for current plan, subscription status, etc.\n *\n * DELEGATION PRINCIPLE: The frontend does NOT build payment UI.\n * - Stripe Checkout (hosted page): for new subscriptions and upgrades\n * - Stripe Customer Portal (hosted page): for invoices, payment methods, cancellation\n */\n\nimport { useApplicationRoleTables } from '~wildo-frontend-lib/core/security/useApplicationRoleTables';\nimport React, { createContext, useEffect, useState, useCallback, useMemo, useRef } from 'react';\nimport type {\n BillingAccount,\n BillingSubscriptionBase,\n Product,\n Price,\n Promotion,\n InvoiceRef,\n UsageSummary,\n BillingConfiguration,\n ProductDefinition,\n BillingStateResponse,\n BillingStateAvailability,\n WS_BillingEventPayload,\n} from '@wildo-ai/saas-models';\nimport {\n BillingAccount_Operations,\n BillingSubscription_Operations,\n BillingSubscription_PreviewPlanChangeRequestDto,\n BillingSubscription_ChangePlanRequestDto,\n BillingSubscription_PlanChangePreviewResponseDto,\n BillingStateResponseSchema,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n HttpMethod,\n BillingStateSlice,\n BillingSliceAvailability,\n CoreWebSocketEvent,\n CoreResourceType,\n ResourcePrimaryScope,\n MAIN_API_BASE_PATH,\n userRolesSatisfyRequiredRoles,\n ResourceOperationIdempotencyKeyRequirement,\n} from '@wildo-ai/saas-models';\nimport { resolveOperationIdempotencyHeaders } from '~wildo-frontend-lib/core/requests/wildo-http-client-resources.frontend.service';\nimport { useWebSocket } from '~wildo-frontend-lib/core/requests/websockets/useWebSocket';\nimport { useUserOrgs } from '~wildo-frontend-lib/core/security/useUserOrgs';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { useApplication } from '~wildo-frontend-lib/core/runtime/useApplication';\nimport { isResourceReachable, useResourceRegistrySafe } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { getManualCallsHttpClient } from '~wildo-frontend-lib/core/requests/wildo-http-client-manual-calls.frontend.service';\nimport { readJsonResponse } from '~wildo-frontend-lib/core/requests/json-response-reading.frontend';\nimport { useEmitLoadingScope } from '~wildo-frontend-lib/core/loading/useEmitLoadingScope';\nimport { ContextLoadingIdentifier } from '~wildo-frontend-lib/core/loading/loading-types.frontend.schemas';\n\n// ================================\n// Logger\n// ================================\n\nconst billingLogger: LoggerFrontendService = LoggerFrontendService.getLogger();\nconst logDebug: (message: string, context?: Record<string, unknown>) => void = billingLogger.debugByType('BillingContext');\nbillingLogger.setDebugTypeLogging('BillingContext', false);\n\n// ================================\n// Constants\n// ================================\n\nconst API_PREFIX = MAIN_API_BASE_PATH;\n\n/** WebSocket events that trigger a refetch of billing state */\nconst INVALIDATION_EVENTS = [\n CoreWebSocketEvent.BILLING_STATUS_CHANGED,\n CoreWebSocketEvent.BILLING_SUBSCRIPTION_UPDATED,\n CoreWebSocketEvent.BILLING_ACCOUNT_CHANGED,\n CoreWebSocketEvent.BILLING_USAGE_UPDATED,\n CoreWebSocketEvent.BILLING_CREDIT_POOL_UPDATED,\n CoreWebSocketEvent.BILLING_FEATURES_UPDATED,\n] as const;\n\n/** Maps ResourcePrimaryScope → billing account variant resource type (for resource operations) */\nconst SCOPE_TO_BILLING_ACCOUNT_RESOURCE: Record<string, string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS,\n [ResourcePrimaryScope.USER_SELF]: CoreResourceType.USER_BILLING_ACCOUNTS,\n};\n\n// The billing-account GET_STATE / OPEN_CHECKOUT / OPEN_PORTAL custom operations\n// borrow COUNT / UPDATE / READ core semantics (see\n// `billing-account.shared.resources-config.schemas.ts`), so their canonical\n// routes follow the framework's scoped resource-operation shape:\n// GET_STATE (COUNT-like) → GET /<scope>/{id}/<res>/get-state/count\n// OPEN_CHECKOUT (UPDATE-like) → PUT /<scope>/{id}/<res>/{accountId}/open-checkout\n// OPEN_PORTAL (READ-like) → GET /<scope>/{id}/<res>/{accountId}/open-portal\n// Built here to mirror the routes the backend registers from the same\n// resources-config; the prior `/operations/open_checkout` POST 404'd.\n\n/** Maps ResourcePrimaryScope → GET_STATE URL builder (COUNT-like → trailing `/count`) */\nconst SCOPE_TO_GET_STATE_URL: Record<string, (scopeEntityId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/get-state/count`,\n [ResourcePrimaryScope.USER_SELF]: (id) => `${API_PREFIX}/users/${id}/user-billing-accounts/get-state/count`,\n};\n\n/** Maps ResourcePrimaryScope → OPEN_CHECKOUT URL builder (UPDATE-like → keyed PUT) */\nconst SCOPE_TO_OPEN_CHECKOUT_URL: Record<string, (scopeEntityId: string, billingAccountId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-checkout`,\n [ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-checkout`,\n};\n\n/** Maps ResourcePrimaryScope → OPEN_INVOICED_SUBSCRIPTION URL builder (UPDATE-like → keyed PUT) */\nconst SCOPE_TO_OPEN_INVOICED_SUBSCRIPTION_URL: Record<string, (scopeEntityId: string, billingAccountId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-invoiced-subscription`,\n [ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-invoiced-subscription`,\n};\n\n/** Maps ResourcePrimaryScope → OPEN_PORTAL URL builder (READ-like → keyed GET) */\nconst SCOPE_TO_OPEN_PORTAL_URL: Record<string, (scopeEntityId: string, billingAccountId: string) => string> = {\n [ResourcePrimaryScope.ORGANIZATIONS]: (id, acc) => `${API_PREFIX}/organizations/${id}/organization-billing-accounts/${acc}/open-portal`,\n [ResourcePrimaryScope.USER_SELF]: (id, acc) => `${API_PREFIX}/users/${id}/user-billing-accounts/${acc}/open-portal`,\n};\n\n// ================================\n// API Response Types\n// ================================\n\n/** Response from PUT /<scope>/{id}/<billing-accounts>/{accountId}/open-checkout (OPEN_CHECKOUT) */\ninterface CheckoutSessionResponse {\n url: string;\n sessionId: string;\n}\n\n/** Response from GET /<scope>/{id}/<billing-accounts>/{accountId}/open-portal (OPEN_PORTAL) */\ninterface PortalSessionResponse {\n url: string;\n}\n\n// ================================\n// Context Type\n// ================================\n\n/**\n * @wildo_source:part:start saas.frontend.billing-context facet:layer:frontend facet:audience:app-developer\n *\n * Everything an application's own frontend reads or does about billing. Reached with `useBilling()`,\n * which throws outside a `BillingProvider`; `useBillingSafe()` returns `undefined` instead, for a\n * component that may render before the provider mounts or in an application where billing is off.\n *\n * The shipped billing components and the feature-gating hooks read this same context, so an\n * application composing its own purchase flow works from exactly what they do — no application code\n * builds the request.\n *\n * ## Starting a purchase\n *\n * `openCheckout(productKey, priceId, options)` posts to the scoped billing-account route and follows\n * the returned URL; success and cancel destinations come from the application's own redirect base. A\n * SECOND call while one is in flight is IGNORED, so a double-click cannot open two sessions — do not\n * add your own guard expecting otherwise, and do not read the silence as a failure.\n *\n * The `priceId` must belong to the product named by `productKey`; the checkout operation refuses a\n * mismatched pair. Resolve it through `getPricesForProduct` rather than assuming an ordering.\n *\n * `openCustomerPortal()` opens the provider's own portal — which is where payment methods, card\n * updates and receipt downloads live. Those are deliberately NOT rendered by the framework, so an\n * application that needs them links the portal rather than building them.\n *\n * ## What `usage` contains\n *\n * Metered consumption appears here only if the application RECORDS it. Nothing is automatic: a\n * metered product with no recorded usage shows an empty dashboard rather than an error.\n *\n * ## Invoices are capped\n *\n * `invoices` carries the fifty most recent, which is what the shipped history component renders. An\n * application needing more reads the invoices resource directly.\n */\nexport type BillingPlanChangeTarget = z.infer<typeof BillingSubscription_PreviewPlanChangeRequestDto>;\nexport type BillingPlanChangeConfirmation = z.infer<typeof BillingSubscription_ChangePlanRequestDto>;\nexport type BillingPlanChangePreviewResponse = z.infer<typeof BillingSubscription_PlanChangePreviewResponseDto>;\n\nexport interface BillingContextType {\n // ── Configuration ──\n isEnabled: boolean;\n /**\n * Whether THIS person can buy for the current scope: read its billing account and open checkout, as the billing\n * account's own operations admit them (on an organization, its owners and administrators). False when billing is off.\n * The unavailability resolution reads it, so a person who cannot buy is told who can rather than shown an upgrade\n * button whose checkout they would be refused.\n */\n mayPurchase: boolean;\n /**\n * The roles that may open checkout for the current scope, from the checkout operation's own roles (on an\n * organization: `ORG_OWNER`, `ORG_ADMIN`). A contact-an-administrator prompt names them, so the person knows whom to\n * ask. Empty when billing is off or the operation is not in the registry.\n */\n purchaserRoleRefs: readonly string[];\n billingConfiguration: BillingConfiguration | undefined;\n /**\n * The configured billing provider's REF (`billing.providerRef`), or null when billing is off or\n * names none. Surfaces show the vendor's name from it (`providers.<ref>.displayName`).\n *\n * It used to be a frontend provider MODULE, resolved from the registry by ref or by the `BILLING`\n * capability. The only such module was Stripe's, which loaded no Stripe code — checkout and the\n * customer portal are hosted redirects — and existed only to carry that name. The ref is the\n * fact the application configured; a module was a second place that had to agree with it.\n */\n billingProviderRef: string | null;\n\n // ── Billing State ──\n billingAccount: BillingAccount | null;\n subscription: BillingSubscriptionBase | null;\n currentPlanKey: string | null;\n currentPlanProduct: Product | null;\n\n // ── Product Catalog ──\n products: Product[];\n prices: Price[];\n productDefinitions: ProductDefinition[];\n getPricesForProduct: (productId: string) => Price[];\n getProductByKey: (key: string) => Product | undefined;\n /**\n * May this product be bought, or moved onto, right now? Answered from the billing state's\n * `acquirableProductKeys` — the set the backend derives with the SAME predicate its checkout,\n * plan-change and add-on doors enforce — so a surface never re-derives it from `isActive` and can\n * never offer a plan the backend refuses (a retired one, or an announced-but-upcoming one).\n * Fails closed: a state that did not carry the set answers `false`, because an unknown answer must\n * not offer a checkout.\n */\n isProductAcquirable: (key: string) => boolean;\n\n // ── Scope ──\n currentScope: ResourcePrimaryScope | null;\n\n // ── Invoices ──\n invoices: InvoiceRef[];\n\n // ── Promotions ──\n activePromotions: Promotion[];\n\n // ── Usage & Credits ──\n usage: UsageSummary;\n creditPools: Record<string, { available: number; totalPurchased: number; totalGranted: number; totalConsumed: number }>;\n\n // ── Actions ──\n openCheckout: (productKey: string, priceId: string, options?: {\n quantity?: number;\n promotionCode?: string;\n }) => Promise<void>;\n\n /**\n * Subscribe to a plan paid BY INVOICE, without checkout (`BillingCollectionMethod.INVOICE_WITH_TERMS`): only for a\n * product whose collection policy offers it (`resolveBillingCollectionPolicy`). No page opens; the provider emails each\n * invoice, and the billing state is refreshed once the subscription is opened. One Idempotency-Key per call, so the\n * client's automatic retries never open a second subscription; a second call while one is in flight is ignored.\n */\n openInvoicedSubscription: (productKey: string, priceId: string, options?: {\n quantity?: number;\n promotionCode?: string;\n }) => Promise<void>;\n\n openCustomerPortal: () => Promise<void>;\n /** Provider estimate bound to the current subscription and selected target; never commits a change. */\n previewPlanChange: (target: BillingPlanChangeTarget, options?: { signal?: AbortSignal }) => Promise<BillingPlanChangePreviewResponse>;\n /** Confirm only the server token returned for the displayed preview. Successful mutation refreshes billing state. */\n confirmPlanChange: (confirmation: BillingPlanChangeConfirmation) => Promise<void>;\n /**\n * Withdraw the plan change pending at the end of the period (`subscription.pendingPlanChange`), so the subscription renews\n * on its current plan. Successful withdrawal refreshes billing state.\n */\n cancelPendingPlanChange: () => Promise<void>;\n\n // ── State ──\n isLoading: boolean;\n error: Error | null;\n /** Only a successful slice read establishes emptiness; failed or absent state is unavailable. */\n availability: BillingStateAvailability | null;\n isSliceAvailable: (slice: BillingStateSlice) => boolean;\n\n // ── Actions ──\n refetch: () => void;\n}\n\n// ── Default empty state ──\nconst EMPTY_USAGE: UsageSummary = {\n byProduct: {},\n};\n\n/** @wildo_source:part:end saas.frontend.billing-context */\n\nexport const BillingContext: React.Context<BillingContextType | undefined> = createContext<BillingContextType | undefined>(undefined);\n\n// ================================\n// Provider\n// ================================\n\nexport interface BillingProviderProps {\n children: React.ReactNode;\n productDefinitions?: ProductDefinition[];\n}\n\nexport function BillingProvider({ children, productDefinitions: injectedProductDefinitions }: BillingProviderProps): React.ReactElement {\n // ── Self-resolve configuration from hooks ──\n const userOrgs = useUserOrgs();\n const appScope = useAppScopeSafe();\n const { appConfig } = useApplication();\n const resourceRegistry = useResourceRegistrySafe();\n const billingConfig = appConfig.billing;\n /** What the application CONFIGURED — see `isEnabled` below for why that is only half the answer. */\n const isConfiguredEnabled = billingConfig?.enabled ?? false;\n const billingProviderRef = isConfiguredEnabled ? billingConfig?.providerRef ?? null : null;\n\n // ── Self-resolve scope ──\n const enabledScopes = billingConfig?.enabledScopes ?? [ResourcePrimaryScope.ORGANIZATIONS];\n\n const { scopeType, scopeEntityId } = useMemo(() => {\n if (enabledScopes.includes(ResourcePrimaryScope.ORGANIZATIONS) && appScope?.currentOrganizationId) {\n return { scopeType: ResourcePrimaryScope.ORGANIZATIONS as ResourcePrimaryScope, scopeEntityId: appScope.currentOrganizationId };\n }\n if (enabledScopes.includes(ResourcePrimaryScope.USER_SELF) && userOrgs.user?._id) {\n return { scopeType: ResourcePrimaryScope.USER_SELF as ResourcePrimaryScope, scopeEntityId: userOrgs.user._id };\n }\n return { scopeType: null as ResourcePrimaryScope | null, scopeEntityId: null as string | null };\n }, [enabledScopes, appScope?.currentOrganizationId, userOrgs.user?._id]);\n\n // ── Derive variant resource type for operations ──\n const billingAccountResourceType = scopeType ? SCOPE_TO_BILLING_ACCOUNT_RESOURCE[scopeType] : null;\n\n /**\n * Enabled means CONFIGURED **and** REACHABLE — the config flag alone was not enough.\n *\n * Every request this provider makes is an operation on a billing-account resource, so a consumer\n * whose registry does not carry that resource cannot serve one no matter what the config says.\n * That is not hypothetical: the application-creation workbench excludes the whole tenant\n * vocabulary from its registry (it observes an application's creation and is not that\n * application's admin console) while rendering the OBSERVED application's config, which has\n * billing enabled — so it fired `organization-billing-accounts/get-state/count` at its own origin\n * on every page load, where the companion serves no billing routes, and answered 404 every time\n * (issue #268, reproduced live).\n *\n * Reading the registry rather than adding a second opt-out keeps the two halves from disagreeing:\n * a consumer that excludes the resource has already said billing is not part of its surface, and\n * saying it twice is how the two copies drift. A tenant application carries the resource and is\n * unaffected.\n */\n const isEnabled = isConfiguredEnabled\n && billingAccountResourceType !== null\n // The absent-registry-is-ignorance rule lives on the seam (`isResourceReachable`), shared with the\n // features, guidance and analytics providers since #1069 so the four cannot drift.\n && isResourceReachable(resourceRegistry, billingAccountResourceType);\n\n /**\n * Whether THIS CALLER may read the billing state served for this scope — kept separate from `isEnabled`, on purpose.\n *\n * `isEnabled` says billing is PART OF the application. Every consumer of it — feature availability, operation\n * gating, the launcher — needs that answer for every user alike, so it must not vary with who is looking.\n *\n * Fetching is a different question. `GET_STATE` is role-gated per scope (organization owners and administrators on\n * the organization variant), and a plain member used to request it on every page load, be refused with 403, and\n * see an access-denied message on a page with nothing wrong with it (#1039). That member already ended with a null\n * billing state — the refusal produced it — so not asking changes nothing they can see except the message.\n *\n * The required roles are read from the registry's OWN operation, never copied, and decided by the same\n * hierarchy-aware check the action bar uses. That check fails open on a role it cannot resolve, so a custom role\n * inheriting an administrator role is not locked out here — the server stays the authority either way. With no\n * registry, or no such operation in it, there is no evidence to withhold on, and the request goes out as before.\n */\n const permissions = userOrgs.permissions;\n const currentOrganizationId = appScope?.currentOrganizationId ?? null;\n const roleTables = useApplicationRoleTables();\n const mayReadBillingState = useMemo((): boolean => {\n if (!isEnabled || !billingAccountResourceType) return false;\n const getStateOperation = resourceRegistry?.registry.resourceConfigurations[billingAccountResourceType]\n ?.operations.find((operation) =>\n String(operation.operationIdentifier) === BillingAccount_Operations.GET_STATE && operation.isOperationDefault === true);\n if (!getStateOperation) return true;\n return userRolesSatisfyRequiredRoles({\n requiredRoles: getStateOperation.roles,\n userAppRoles: permissions?.appLevel ?? [],\n userOrgRoles: currentOrganizationId ? permissions?.organizations?.[currentOrganizationId] ?? [] : [],\n appRolesConfig: roleTables.appRolesConfig,\n orgRolesConfig: roleTables.orgRolesConfig,\n unresolvableRoles: roleTables.unresolvableRoles,\n });\n }, [isEnabled, billingAccountResourceType, resourceRegistry, permissions, currentOrganizationId, roleTables]);\n\n /**\n * Who can BUY here: the checkout operation's own roles, decided by the same check as `mayReadBillingState`, and only\n * for someone who may also read the billing state (a checkout is opened from the account the state carries). With no\n * checkout operation in the registry there is no evidence to withhold on, as for the state read.\n */\n const purchaseAccess = useMemo((): { mayPurchase: boolean; purchaserRoleRefs: readonly string[] } => {\n if (!isEnabled || !billingAccountResourceType) return { mayPurchase: false, purchaserRoleRefs: [] };\n const checkoutOperation = resourceRegistry?.registry.resourceConfigurations[billingAccountResourceType]\n ?.operations.find((operation) =>\n String(operation.operationIdentifier) === BillingAccount_Operations.OPEN_CHECKOUT && operation.isOperationDefault === true);\n if (!checkoutOperation) return { mayPurchase: mayReadBillingState, purchaserRoleRefs: [] };\n const purchaserRoleRefs = (checkoutOperation.roles ?? []).map(String);\n const mayOpenCheckout = userRolesSatisfyRequiredRoles({\n requiredRoles: checkoutOperation.roles,\n userAppRoles: permissions?.appLevel ?? [],\n userOrgRoles: currentOrganizationId ? permissions?.organizations?.[currentOrganizationId] ?? [] : [],\n appRolesConfig: roleTables.appRolesConfig,\n orgRolesConfig: roleTables.orgRolesConfig,\n unresolvableRoles: roleTables.unresolvableRoles,\n });\n return { mayPurchase: mayReadBillingState && mayOpenCheckout, purchaserRoleRefs };\n }, [isEnabled, billingAccountResourceType, resourceRegistry, mayReadBillingState, permissions, currentOrganizationId, roleTables]);\n\n // ── State ──\n const [billingState, setBillingState] = useState<BillingStateResponse | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(mayReadBillingState && !!scopeEntityId);\n const [error, setError] = useState<Error | null>(null);\n\n // L-2.b: mirror local loading state onto the LoadingContext event bus so\n // unrelated components can observe billing-state lifecycle via\n // `useComponentLoading({ customIdentifier: ContextLoadingIdentifier.BILLING_STATE })`\n // or `<LoadingGate scopes={[buildContextLoadingScope(BILLING_STATE)]}>`.\n // Local `isLoading` is still exposed for direct consumers (back-compat).\n useEmitLoadingScope({\n identifier: ContextLoadingIdentifier.BILLING_STATE,\n isLoading,\n hasLoadedOnce: billingState !== null,\n });\n\n // ── Refs for stable callbacks ──\n const fetchInFlightRef = useRef<boolean>(false);\n const mountedRef = useRef<boolean>(true);\n const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const checkoutInFlightRef = useRef<boolean>(false);\n\n // ── WebSocket ──\n const { on } = useWebSocket();\n\n // ── Resolve redirect base URL ──\n const resolvedRedirectBase = useMemo(\n () => typeof window !== 'undefined' ? window.location.origin : '',\n [],\n );\n\n // ── billingAccountId from response ──\n const billingAccountId = billingState?.billingAccount?._id ?? null;\n\n // ── Clear stale state on scope change ──\n useEffect(() => {\n setBillingState(null);\n setError(null);\n setIsLoading(mayReadBillingState && !!scopeEntityId);\n }, [scopeType, scopeEntityId, mayReadBillingState]);\n\n // ── Fetch billing state from backend ──\n const fetchBillingState = useCallback(async () => {\n if (!mayReadBillingState || !scopeType || !scopeEntityId) return;\n if (fetchInFlightRef.current) return;\n fetchInFlightRef.current = true;\n\n try {\n logDebug('Fetching billing state', { scopeType, scopeEntityId });\n const httpClient = getManualCallsHttpClient();\n\n const urlBuilder = SCOPE_TO_GET_STATE_URL[scopeType];\n if (!urlBuilder) return;\n const url = urlBuilder(scopeEntityId);\n // Its dates restored (#3478): `useBilling()` promises they are Dates, and a cast left them strings.\n const response: BillingStateResponse = readJsonResponse(BillingStateResponseSchema, await httpClient.get<unknown>(url));\n\n if (mountedRef.current) {\n setBillingState(response);\n setError(null);\n\n logDebug('Billing state fetched', {\n hasAccount: !!response.billingAccount,\n hasSubscription: !!response.subscription,\n productCount: response.products?.length ?? 0,\n priceCount: response.prices?.length ?? 0,\n billingAccountId: response.billingAccount?._id,\n });\n }\n } catch (err: unknown) {\n if (mountedRef.current) {\n const message = err instanceof Error ? err.message : 'Failed to fetch billing state';\n setBillingState(null);\n setError(err instanceof Error ? err : new Error(message));\n logDebug('Failed to fetch billing state', { error: message });\n }\n } finally {\n if (mountedRef.current) {\n setIsLoading(false);\n }\n fetchInFlightRef.current = false;\n }\n }, [mayReadBillingState, scopeType, scopeEntityId]);\n\n // ── Initial fetch ──\n useEffect(() => {\n mountedRef.current = true;\n if (mayReadBillingState && scopeType && scopeEntityId) {\n fetchBillingState();\n } else {\n setIsLoading(false);\n }\n return () => {\n mountedRef.current = false;\n };\n }, [fetchBillingState, mayReadBillingState, scopeType, scopeEntityId]);\n\n // ── WebSocket invalidation (debounced) ──\n useEffect(() => {\n if (!mayReadBillingState) return;\n\n const unsubscribers: Array<() => void> = [];\n\n const debouncedRefetch = () => {\n if (debounceTimerRef.current) {\n clearTimeout(debounceTimerRef.current);\n }\n debounceTimerRef.current = setTimeout(() => {\n debounceTimerRef.current = null;\n fetchBillingState();\n }, 300);\n };\n\n for (const event of INVALIDATION_EVENTS) {\n const unsub = on<WS_BillingEventPayload>(event, (payload) => {\n if (!scopeType || !scopeEntityId) {\n logDebug('Ignoring billing invalidation without active scope', { event, payload });\n return;\n }\n\n if (payload.scopeType !== scopeType || payload.scopeEntityId !== scopeEntityId) {\n logDebug('Ignoring billing invalidation for another scope', {\n event,\n payload,\n currentScopeType: scopeType,\n currentScopeEntityId: scopeEntityId,\n });\n return;\n }\n\n if (billingAccountId && payload.billingAccountId !== billingAccountId) {\n logDebug('Ignoring billing invalidation for another billing account', {\n event,\n payload,\n currentBillingAccountId: billingAccountId,\n });\n return;\n }\n\n logDebug('WebSocket invalidation event received, scheduling refetch', { event, payload });\n debouncedRefetch();\n });\n unsubscribers.push(unsub);\n }\n\n return () => {\n if (debounceTimerRef.current) {\n clearTimeout(debounceTimerRef.current);\n }\n for (const unsub of unsubscribers) {\n unsub();\n }\n };\n }, [on, fetchBillingState, mayReadBillingState, scopeType, scopeEntityId, billingAccountId]);\n\n // ── Derived state ──\n const availability = billingState?.availability ?? null;\n const isSliceAvailable = useCallback((slice: BillingStateSlice) => availability?.[slice] === BillingSliceAvailability.AVAILABLE, [availability]);\n\n const billingAccount = billingState?.billingAccount ?? null;\n const subscription = billingState?.subscription ?? null;\n const products = billingState?.products ?? [];\n const prices = billingState?.prices ?? [];\n const invoices = billingState?.invoices ?? [];\n const usage = billingState?.usage ?? EMPTY_USAGE;\n const creditPools = billingState?.creditPools ?? {};\n const activePromotions = billingState?.activePromotions ?? [];\n const acquirableProductKeys = billingState?.acquirableProductKeys;\n const currentScope = scopeType ?? null;\n\n // ── Product catalog lookups ──\n const productsByKey = useMemo(() => {\n const map = new Map<string, Product>();\n for (const p of products) {\n map.set(p.key, p);\n }\n return map;\n }, [products]);\n\n const pricesByProductId = useMemo(() => {\n const map = new Map<string, Price[]>();\n for (const price of prices) {\n const existing = map.get(price.productId) ?? [];\n existing.push(price);\n map.set(price.productId, existing);\n }\n return map;\n }, [prices]);\n\n const getPricesForProduct = useCallback(\n (productId: string): Price[] => pricesByProductId.get(productId) ?? [],\n [pricesByProductId],\n );\n\n const getProductByKey = useCallback(\n (key: string): Product | undefined => productsByKey.get(key),\n [productsByKey],\n );\n\n const acquirableProductKeySet = useMemo(() => new Set(acquirableProductKeys ?? []), [acquirableProductKeys]);\n const isProductAcquirable = useCallback((key: string): boolean => acquirableProductKeySet.has(key), [acquirableProductKeySet]);\n\n // ── Current plan derivation ──\n const { currentPlanKey, currentPlanProduct } = useMemo(() => {\n if (!subscription || !subscription.items?.length) {\n return { currentPlanKey: null, currentPlanProduct: null };\n }\n for (const item of subscription.items) {\n const product = products.find(p => p._id === item.productId);\n if (product && product.type === 'plan') {\n return { currentPlanKey: product.key, currentPlanProduct: product };\n }\n }\n return { currentPlanKey: null, currentPlanProduct: null };\n }, [subscription, products]);\n\n const productDefinitions = useMemo<ProductDefinition[]>(\n () => injectedProductDefinitions ?? [],\n [injectedProductDefinitions],\n );\n\n // ── Actions ──\n const openCheckout = useCallback(\n async (productKey: string, priceId: string, options?: {\n quantity?: number;\n promotionCode?: string;\n }): Promise<void> => {\n if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {\n throw new Error('No billing account available. Cannot open checkout.');\n }\n const checkoutUrl = SCOPE_TO_OPEN_CHECKOUT_URL[scopeType]?.(scopeEntityId, billingAccountId);\n if (!checkoutUrl) {\n throw new Error(`No OPEN_CHECKOUT URL builder for scope ${scopeType}.`);\n }\n if (checkoutInFlightRef.current) {\n logDebug('Checkout already in progress, ignoring duplicate request');\n return;\n }\n\n checkoutInFlightRef.current = true;\n try {\n logDebug('Opening checkout session', { productKey, priceId, ...options });\n const httpClient = getManualCallsHttpClient();\n\n // OPEN_CHECKOUT borrows UPDATE → keyed PUT on the scoped account route.\n const response = await httpClient.put<CheckoutSessionResponse>(\n checkoutUrl,\n {\n productKey,\n priceId,\n successUrl: `${resolvedRedirectBase}/billing/success?session_id={CHECKOUT_SESSION_ID}`,\n cancelUrl: `${resolvedRedirectBase}/billing/cancel`,\n quantity: options?.quantity,\n promotionCode: options?.promotionCode,\n },\n );\n\n if (response.url) {\n window.location.href = response.url;\n }\n } finally {\n checkoutInFlightRef.current = false;\n }\n },\n [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, resolvedRedirectBase],\n );\n\n const openInvoicedSubscription = useCallback(\n async (productKey: string, priceId: string, options?: { quantity?: number; promotionCode?: string }): Promise<void> => {\n if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {\n throw new Error('No billing account available. Cannot subscribe by invoice.');\n }\n const url = SCOPE_TO_OPEN_INVOICED_SUBSCRIPTION_URL[scopeType]?.(scopeEntityId, billingAccountId);\n if (!url) {\n throw new Error(`No OPEN_INVOICED_SUBSCRIPTION URL builder for scope ${scopeType}.`);\n }\n if (checkoutInFlightRef.current) {\n logDebug('A purchase is already in progress, ignoring duplicate request');\n return;\n }\n checkoutInFlightRef.current = true;\n try {\n logDebug('Opening invoiced subscription', { productKey, priceId, ...options });\n // OPEN_INVOICED_SUBSCRIPTION borrows UPDATE → keyed PUT, and REQUIRES an Idempotency-Key: minted once for this\n // call, and re-sent unchanged by the client's own retries.\n await getManualCallsHttpClient().put(\n url,\n { productKey, priceId, quantity: options?.quantity, promotionCode: options?.promotionCode },\n resolveOperationIdempotencyHeaders(undefined, { idempotencyKey: ResourceOperationIdempotencyKeyRequirement.REQUIRED }),\n );\n // The subscription row arrives from the provider's event; refresh so the screen follows it.\n void fetchBillingState();\n } finally {\n checkoutInFlightRef.current = false;\n }\n },\n [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, fetchBillingState],\n );\n\n const openCustomerPortal = useCallback(async (): Promise<void> => {\n if (!billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId) {\n throw new Error('No billing account available. Cannot open customer portal.');\n }\n const portalUrlBase = SCOPE_TO_OPEN_PORTAL_URL[scopeType]?.(scopeEntityId, billingAccountId);\n if (!portalUrlBase) {\n throw new Error(`No OPEN_PORTAL URL builder for scope ${scopeType}.`);\n }\n\n logDebug('Opening customer portal session');\n const httpClient = getManualCallsHttpClient();\n\n // OPEN_PORTAL borrows READ → keyed GET on the scoped account route; the\n // returnUrl travels as a query param since GET carries no request body.\n const returnUrl = encodeURIComponent(`${resolvedRedirectBase}/billing`);\n const response = await httpClient.get<PortalSessionResponse>(\n `${portalUrlBase}?returnUrl=${returnUrl}`,\n );\n\n if (response.url) {\n window.location.href = response.url;\n }\n }, [billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, resolvedRedirectBase]);\n\n // ── Context value (memoized for stable reference) ──\n // Use the registry's compiled operation paths and parameter vocabulary. Subscription routes have\n // account and scope parents; hand-authored URLs would silently diverge between org and user variants.\n const callPlanOperation = useCallback(async <TResponse,>(\n operationIdentifier: BillingSubscription_Operations,\n payload: BillingPlanChangeTarget | BillingPlanChangeConfirmation | Record<string, never>,\n signal?: AbortSignal,\n ): Promise<TResponse> => {\n if (!resourceRegistry || !subscription?._id || !billingAccountId || !billingAccountResourceType || !scopeType || !scopeEntityId\n || ![BillingStateSlice.BILLING_ACCOUNT, BillingStateSlice.SUBSCRIPTION, BillingStateSlice.PRODUCTS, BillingStateSlice.PRICES].every(isSliceAvailable)) {\n throw new Error('Billing plan change context is unavailable.');\n }\n const subscriptionType = scopeType === ResourcePrimaryScope.ORGANIZATIONS ? CoreResourceType.ORGANIZATION_SUBSCRIPTIONS : CoreResourceType.USER_SUBSCRIPTIONS;\n const config = resourceRegistry.registry.resourceConfigurations[subscriptionType];\n const operation = config?.operations.find(candidate => candidate.operationIdentifier === operationIdentifier\n && candidate.variantType === ResourceOperationVariantType.API_CALL && candidate.isOperationDefault);\n if (!operation || operation.variantType !== ResourceOperationVariantType.API_CALL) throw new Error('Billing plan change operation is unavailable.');\n const fields = resourceRegistry.registry.allResourceFieldIdentifiers;\n const scopeResourceType = scopeType === ResourcePrimaryScope.ORGANIZATIONS ? CoreResourceType.ORGANIZATIONS : CoreResourceType.USERS;\n const accountField = fields[billingAccountResourceType];\n const scopeField = fields[scopeResourceType];\n if (!config.resourceFieldIdentifier || !accountField || !scopeField) throw new Error('Billing plan change route context is unavailable.');\n return resourceRegistry.doOperation<TResponse>(ResourcesConfig_OperationPathUtils.createOperationPathKeyFromOperation(operation), {\n contextualParameters: { [config.resourceFieldIdentifier]: subscription._id, [accountField]: billingAccountId, [scopeField]: scopeEntityId },\n ...(operation.httpVerb === HttpMethod.GET ? { queryParameters: payload } : { requestData: payload }),\n }, { signal, silent: true });\n }, [resourceRegistry, subscription?._id, billingAccountId, billingAccountResourceType, scopeType, scopeEntityId, isSliceAvailable]);\n\n const previewPlanChange = useCallback(async (target: BillingPlanChangeTarget, options?: { signal?: AbortSignal }): Promise<BillingPlanChangePreviewResponse> => {\n const parsed = BillingSubscription_PreviewPlanChangeRequestDto.parse(target);\n const response = await callPlanOperation<BillingPlanChangePreviewResponse>(BillingSubscription_Operations.PREVIEW_PLAN_CHANGE, parsed, options?.signal);\n return BillingSubscription_PlanChangePreviewResponseDto.parse(response);\n }, [callPlanOperation]);\n\n const confirmPlanChange = useCallback(async (confirmation: BillingPlanChangeConfirmation): Promise<void> => {\n const parsed = BillingSubscription_ChangePlanRequestDto.parse(confirmation);\n await callPlanOperation(BillingSubscription_Operations.CHANGE_PLAN, parsed);\n await fetchBillingState();\n }, [callPlanOperation, fetchBillingState]);\n\n const cancelPendingPlanChange = useCallback(async (): Promise<void> => {\n await callPlanOperation(BillingSubscription_Operations.CANCEL_PLAN_CHANGE, {});\n await fetchBillingState();\n }, [callPlanOperation, fetchBillingState]);\n\n const contextValue: BillingContextType = useMemo(\n () => ({\n isEnabled,\n mayPurchase: purchaseAccess.mayPurchase,\n purchaserRoleRefs: purchaseAccess.purchaserRoleRefs,\n billingConfiguration: billingConfig,\n billingProviderRef,\n billingAccount,\n subscription,\n currentPlanKey,\n currentPlanProduct,\n currentScope,\n products,\n prices,\n invoices,\n productDefinitions,\n getPricesForProduct,\n getProductByKey,\n isProductAcquirable,\n activePromotions,\n usage,\n creditPools,\n openCheckout,\n openInvoicedSubscription,\n openCustomerPortal,\n previewPlanChange,\n confirmPlanChange,\n cancelPendingPlanChange,\n isLoading,\n availability,\n isSliceAvailable,\n error,\n refetch: fetchBillingState,\n }),\n [\n isEnabled,\n purchaseAccess,\n billingConfig,\n billingProviderRef,\n billingAccount,\n subscription,\n currentPlanKey,\n currentPlanProduct,\n currentScope,\n products,\n prices,\n invoices,\n productDefinitions,\n getPricesForProduct,\n getProductByKey,\n isProductAcquirable,\n activePromotions,\n usage,\n creditPools,\n openCheckout,\n openInvoicedSubscription,\n openCustomerPortal,\n previewPlanChange,\n confirmPlanChange,\n cancelPendingPlanChange,\n isLoading,\n availability,\n isSliceAvailable,\n error,\n fetchBillingState,\n ],\n );\n\n return (\n <BillingContext.Provider value={contextValue}>\n {children}\n </BillingContext.Provider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBillingAction.d.ts","sourceRoot":"","sources":["../../../../src/core/billing/useBillingAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAIpG;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,IAAI,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"useBillingAction.d.ts","sourceRoot":"","sources":["../../../../src/core/billing/useBillingAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAIpG;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,IAAI,CAAC,YAAY,EAAE,mBAAmB,KAAK,IAAI,CA2D9E"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* If billing is not enabled (useBillingSafe returns undefined), the action is a no-op.
|
|
9
9
|
*/
|
|
10
10
|
import { useCallback } from 'react';
|
|
11
|
-
import { BillingStateSlice, FeatureUnavailabilityBehavior } from '@wildo-ai/saas-models';
|
|
11
|
+
import { BillingStateSlice, FeatureUnavailabilityBehavior, isPriceOffered } from '@wildo-ai/saas-models';
|
|
12
12
|
import { useBillingSafe } from './useBilling.js';
|
|
13
13
|
import { useSafeBillingActionExecutor } from './useSafeBillingActionExecutor.js';
|
|
14
14
|
/**
|
|
@@ -36,7 +36,8 @@ export function useBillingAction() {
|
|
|
36
36
|
const product = billing.getProductByKey(suggestedProductRef);
|
|
37
37
|
if (product) {
|
|
38
38
|
productKey = product.key;
|
|
39
|
-
|
|
39
|
+
// Offered prices only (#4315 review F1): checkout refuses a retired one.
|
|
40
|
+
const prices = billing.getPricesForProduct(product._id).filter(isPriceOffered);
|
|
40
41
|
const defaultPrice = prices.find(p => p.isDefault) ?? prices[0];
|
|
41
42
|
priceId = defaultPrice?._id;
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBillingAction.js","sourceRoot":"","sources":["../../../../src/core/billing/useBillingAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useBillingAction.js","sourceRoot":"","sources":["../../../../src/core/billing/useBillingAction.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEzG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;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AAG,CAAC,EAAE,CAAC;YAC/D,MAAM,WAAW,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;YACtC,IAAI,WAAW,EAAE,CAAC;gBAChB,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;gBACpC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;YAChC,CAAC;QACH,CAAC;QAED,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,6BAA6B,CAAC,cAAc,CAAC;YAClD,KAAK,6BAA6B,CAAC,oBAAoB,CAAC;YACxD,KAAK,6BAA6B,CAAC,YAAY;gBAC7C,IAAI,UAAU,IAAI,OAAO,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;oBACpJ,sBAAsB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC1E,CAAC;qBAAM,CAAC;oBACN,4EAA4E;oBAC5E,0FAA0F;oBAC1F,sBAAsB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;gBAC7D,CAAC;gBACD,MAAM;YAER,KAAK,6BAA6B,CAAC,aAAa,CAAC;YACjD,KAAK,6BAA6B,CAAC,OAAO,CAAC;YAC3C,KAAK,6BAA6B,CAAC,IAAI,CAAC;YACxC,KAAK,6BAA6B,CAAC,MAAM,CAAC;YAC1C;gBACE,wCAAwC;gBACxC,MAAM;QACV,CAAC;IACH,CAAC,EACD,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * useBillingAction Hook\n *\n * Resolves the appropriate billing action from a FeatureAvailability object.\n * Used by FeatureRouteGuard, FeatureGate, and action bar buttons to wire\n * feature unavailability prompts to billing checkout or customer portal flows.\n *\n * If billing is not enabled (useBillingSafe returns undefined), the action is a no-op.\n */\n\nimport { useCallback } from 'react';\nimport { BillingStateSlice, FeatureUnavailabilityBehavior, isPriceOffered } from '@wildo-ai/saas-models';\nimport type { FeatureAvailability } from '~wildo-frontend-lib/core/features/useFeatureAvailability';\nimport { useBillingSafe } from './useBilling';\nimport { useSafeBillingActionExecutor } from './useSafeBillingActionExecutor';\n\n/**\n * Returns a callback that executes the appropriate billing action for a given FeatureAvailability.\n *\n * - upgrade_prompt / limit_upgrade_prompt → openCheckout with suggested product + default price\n * - addon_prompt → openCheckout with suggested addon product + default price\n * - contact_admin → no-op (no billing action)\n * - disable / hide / custom → no-op\n *\n * Falls back gracefully when billing is not enabled.\n */\nexport function useBillingAction(): (availability: FeatureAvailability) => void {\n const billing = useBillingSafe();\n const runBillingActionSafely = useSafeBillingActionExecutor();\n\n return useCallback(\n (availability: FeatureAvailability) => {\n if (!billing || !billing.isEnabled || !billing.isSliceAvailable(BillingStateSlice.BILLING_ACCOUNT)) return;\n\n const { behavior, suggestedProductRef, upgradeOptions } = availability;\n\n // Determine which product/price to use for checkout\n let productKey: string | undefined;\n let priceId: string | undefined;\n\n // Try the suggestedProductRef first (per-feature override)\n if (suggestedProductRef && billing.isSliceAvailable(BillingStateSlice.PRODUCTS) && billing.isSliceAvailable(BillingStateSlice.PRICES)) {\n const product = billing.getProductByKey(suggestedProductRef);\n if (product) {\n productKey = product.key;\n // Offered prices only (#4315 review F1): checkout refuses a retired one.\n const prices = billing.getPricesForProduct(product._id).filter(isPriceOffered);\n const defaultPrice = prices.find(p => p.isDefault) ?? prices[0];\n priceId = defaultPrice?._id;\n }\n }\n\n // Fallback to upgrade options from resolved features\n if (!productKey && upgradeOptions && upgradeOptions.length > 0) {\n const firstOption = upgradeOptions[0];\n if (firstOption) {\n productKey = firstOption.productKey;\n priceId = firstOption.priceId;\n }\n }\n\n switch (behavior) {\n case FeatureUnavailabilityBehavior.UPGRADE_PROMPT:\n case FeatureUnavailabilityBehavior.LIMIT_UPGRADE_PROMPT:\n case FeatureUnavailabilityBehavior.ADDON_PROMPT:\n if (productKey && priceId && [BillingStateSlice.SUBSCRIPTION, BillingStateSlice.PRODUCTS, BillingStateSlice.PRICES].every(billing.isSliceAvailable)) {\n runBillingActionSafely(() => billing.openCheckout(productKey, priceId));\n } else {\n // Missing or unavailable purchase information must never select a checkout.\n // The portal remains usable when its account is known, independently of catalog failures.\n runBillingActionSafely(() => billing.openCustomerPortal());\n }\n break;\n\n case FeatureUnavailabilityBehavior.CONTACT_ADMIN:\n case FeatureUnavailabilityBehavior.DISABLE:\n case FeatureUnavailabilityBehavior.HIDE:\n case FeatureUnavailabilityBehavior.CUSTOM:\n default:\n // No billing action for these behaviors\n break;\n }\n },\n [billing, runBillingActionSafely],\n );\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The attribute that marks the root of a component an APPLICATION registered and the engine renders by its ref (a
|
|
4
|
+
* launcher or utility-panel custom component, a settings target, a sidebar widget or section, a feature's unavailable
|
|
5
|
+
* prompt). The built-application review reads it: an accessibility violation whose element sits inside a marked root is
|
|
6
|
+
* that component's, the application's code, and a component the review saw rendered is one it audited.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REGISTERED_COMPONENT_ROOT_ATTRIBUTE = "data-registered-component";
|
|
9
|
+
/**
|
|
10
|
+
* Marks the root of an application-registered component, by its ref. Only where the engine renders a ref the
|
|
11
|
+
* APPLICATION names: never around a framework slot an application overrides, because a wrapper there would strip the
|
|
12
|
+
* statics a compound component or a shell layout carries, and the ref and the props a Radix `asChild` merges in. Wraps its
|
|
13
|
+
* children untouched, so their own refs and props reach them as before.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RegisteredComponentRoot: React.FC<{
|
|
16
|
+
readonly componentRef: string;
|
|
17
|
+
readonly children?: React.ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=RegisteredComponentRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisteredComponentRoot.d.ts","sourceRoot":"","sources":["../../../../src/core/components-registry/RegisteredComponentRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,8BAA8B,CAAC;AAU/E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAIpH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The attribute that marks the root of a component an APPLICATION registered and the engine renders by its ref (a
|
|
4
|
+
* launcher or utility-panel custom component, a settings target, a sidebar widget or section, a feature's unavailable
|
|
5
|
+
* prompt). The built-application review reads it: an accessibility violation whose element sits inside a marked root is
|
|
6
|
+
* that component's, the application's code, and a component the review saw rendered is one it audited.
|
|
7
|
+
*/
|
|
8
|
+
export const REGISTERED_COMPONENT_ROOT_ATTRIBUTE = 'data-registered-component';
|
|
9
|
+
/**
|
|
10
|
+
* Box-less in a flex or grid parent (`contents`: its children are the items, so gaps and placement survive), and a plain
|
|
11
|
+
* block in a `space-y-*` margin stack, where a `contents` box would hold no margin and the spacing before the component
|
|
12
|
+
* would vanish (the case `LoadingGate` measured on Wonder Todos). Carries no role: a `contents` element's own semantics
|
|
13
|
+
* are what some browsers drop, and this one has none to lose; the component's elements keep theirs.
|
|
14
|
+
*/
|
|
15
|
+
const REGISTERED_COMPONENT_ROOT_CLASS = "contents [:where([class*='space-y-'])>&]:block";
|
|
16
|
+
/**
|
|
17
|
+
* Marks the root of an application-registered component, by its ref. Only where the engine renders a ref the
|
|
18
|
+
* APPLICATION names: never around a framework slot an application overrides, because a wrapper there would strip the
|
|
19
|
+
* statics a compound component or a shell layout carries, and the ref and the props a Radix `asChild` merges in. Wraps its
|
|
20
|
+
* children untouched, so their own refs and props reach them as before.
|
|
21
|
+
*/
|
|
22
|
+
export const RegisteredComponentRoot = ({ componentRef, children }) => (_jsx("div", { className: REGISTERED_COMPONENT_ROOT_CLASS, [REGISTERED_COMPONENT_ROOT_ATTRIBUTE]: componentRef, children: children }));
|
|
23
|
+
//# sourceMappingURL=RegisteredComponentRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisteredComponentRoot.js","sourceRoot":"","sources":["../../../../src/core/components-registry/RegisteredComponentRoot.tsx"],"names":[],"mappings":";AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,2BAA2B,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,+BAA+B,GAAG,gDAAgD,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAqF,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACvJ,cAAK,SAAS,EAAE,+BAA+B,EAAQ,CAAC,mCAAmC,CAAC,EAAE,YAAY,YACvG,QAAQ,GACL,CACP,CAAC","sourcesContent":["import React from 'react';\n\n/**\n * The attribute that marks the root of a component an APPLICATION registered and the engine renders by its ref (a\n * launcher or utility-panel custom component, a settings target, a sidebar widget or section, a feature's unavailable\n * prompt). The built-application review reads it: an accessibility violation whose element sits inside a marked root is\n * that component's, the application's code, and a component the review saw rendered is one it audited.\n */\nexport const REGISTERED_COMPONENT_ROOT_ATTRIBUTE = 'data-registered-component';\n\n/**\n * Box-less in a flex or grid parent (`contents`: its children are the items, so gaps and placement survive), and a plain\n * block in a `space-y-*` margin stack, where a `contents` box would hold no margin and the spacing before the component\n * would vanish (the case `LoadingGate` measured on Wonder Todos). Carries no role: a `contents` element's own semantics\n * are what some browsers drop, and this one has none to lose; the component's elements keep theirs.\n */\nconst REGISTERED_COMPONENT_ROOT_CLASS = \"contents [:where([class*='space-y-'])>&]:block\";\n\n/**\n * Marks the root of an application-registered component, by its ref. Only where the engine renders a ref the\n * APPLICATION names: never around a framework slot an application overrides, because a wrapper there would strip the\n * statics a compound component or a shell layout carries, and the ref and the props a Radix `asChild` merges in. Wraps its\n * children untouched, so their own refs and props reach them as before.\n */\nexport const RegisteredComponentRoot: React.FC<{ readonly componentRef: string; readonly children?: React.ReactNode }> = ({ componentRef, children }) => (\n <div className={REGISTERED_COMPONENT_ROOT_CLASS} {...{ [REGISTERED_COMPONENT_ROOT_ATTRIBUTE]: componentRef }}>\n {children}\n </div>\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-framework-layouts.d.ts","sourceRoot":"","sources":["../../../../src/core/components-registry/register-framework-layouts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register-framework-layouts.d.ts","sourceRoot":"","sources":["../../../../src/core/components-registry/register-framework-layouts.ts"],"names":[],"mappings":"AA0GA,wBAAgB,wBAAwB,IAAI,IAAI,CAuF/C"}
|
|
@@ -80,9 +80,11 @@ import { PublicLayoutPreset_UserInvitation_Default } from '../../components/auth
|
|
|
80
80
|
import { PublicLayoutPreset_UserPasswordLost_Default } from '../../components/auth/Auth_PasswordLost.js';
|
|
81
81
|
import { PublicLayoutPreset_UserRegister_Default } from '../../components/auth/Auth_Register.js';
|
|
82
82
|
import { PublicLayoutPreset_OAuthConsent_Default } from '../../components/auth/Auth_OAuthConsent.js';
|
|
83
|
+
import { PublicLayoutPreset_OAuthDeviceVerification_Default } from '../../components/auth/Auth_OAuthDeviceVerification.js';
|
|
83
84
|
import { PublicLayoutPreset_OAuthLoggedOut_Default } from '../../components/auth/Auth_OAuthLoggedOut.js';
|
|
84
85
|
import { PublicLayoutPreset_OAuthLogoutConfirm_Default } from '../../components/auth/Auth_OAuthLogoutConfirm.js';
|
|
85
86
|
import { PublicLayoutPreset_ChatIdentityLink_Default } from '../../components/auth/Auth_ChatIdentityLink.js';
|
|
87
|
+
import { PublicLayoutPreset_DecisionEmailAnswer_Default } from '../../components/auth/Auth_DecisionEmailAnswer.js';
|
|
86
88
|
export function registerFrameworkLayouts() {
|
|
87
89
|
// === Charts (lazy-loaded) ===
|
|
88
90
|
ComponentRegistryService.register(FrontendComponentType.HIGH_LEVEL_VIEWS_CHART_ECHARTS, CorePresetNames.DEFAULT, LazyChartView, { isConfigurable: false });
|
|
@@ -112,6 +114,8 @@ export function registerFrameworkLayouts() {
|
|
|
112
114
|
ComponentRegistryService.register(FrontendComponentType.PUBLIC_LAYOUTS_OAUTH_LOGGED_OUT, CorePresetNames.DEFAULT, PublicLayoutPreset_OAuthLoggedOut_Default, { isConfigurable: true });
|
|
113
115
|
ComponentRegistryService.register(FrontendComponentType.PUBLIC_LAYOUTS_OAUTH_LOGOUT_CONFIRM, CorePresetNames.DEFAULT, PublicLayoutPreset_OAuthLogoutConfirm_Default, { isConfigurable: true });
|
|
114
116
|
ComponentRegistryService.register(FrontendComponentType.PUBLIC_LAYOUTS_CHAT_IDENTITY_LINK, CorePresetNames.DEFAULT, PublicLayoutPreset_ChatIdentityLink_Default, { isConfigurable: true });
|
|
117
|
+
ComponentRegistryService.register(FrontendComponentType.PUBLIC_LAYOUTS_DECISION_EMAIL_ANSWER, CorePresetNames.DEFAULT, PublicLayoutPreset_DecisionEmailAnswer_Default, { isConfigurable: true });
|
|
118
|
+
ComponentRegistryService.register(FrontendComponentType.PUBLIC_LAYOUTS_OAUTH_DEVICE_VERIFICATION, CorePresetNames.DEFAULT, PublicLayoutPreset_OAuthDeviceVerification_Default, { isConfigurable: true });
|
|
115
119
|
// === Resource Layouts ===
|
|
116
120
|
ComponentRegistryService.register(FrontendComponentType.RESOURCES_LAYOUTS_BREADCRUMB, CorePresetNames.DEFAULT, ResourceLayoutPreset_Breadcrumb_Default, { isConfigurable: true });
|
|
117
121
|
ComponentRegistryService.register(FrontendComponentType.RESOURCES_LAYOUTS_CONTAINER_DIALOGS, CorePresetNames.DEFAULT, ResourceLayoutPreset_ContainerDialogs_Default, { isConfigurable: true });
|