@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartDashboard.js","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/ChartDashboard.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,mEAAmE,CAAC;AAC5G,OAAO,EACL,mBAAmB,GAEpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,gDAAgD,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,gEAAgE,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,qEAAqE,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAC7G,OAAO,EAA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EAAE,iCACzC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,aAErD,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,EAAE,EAAC,KAAK,EAAC,UAAU,EAAE,iBAAiB,CAAC,OAAO,YACjD,OAAO,GACH,CACR,EACD,KAAC,UAAU,IACT,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,GAC3E,IACM,CACX,CAAC;AACJ,CAAC;AAED,sIAAsI;AACtI;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAA2J;IAE3J,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;IACjE,SAAS,kBAAkB;QACzB,OAAO,CACL,KAAC,eAAe,cACd,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAI,GACxD,CACnB,CAAC;IACJ,CAAC;IACD,OAAO,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/**\n * A declarative chart dashboard: charts that SEVERAL resources own, on one responsive grid (#2299).\n *\n * Charts are resource-scoped: each resource declares its `chartViews`, and the backend executes them with tenant scope\n * and authorization injected. Before this, a page combining them was hand-written per application (a grid of\n * `EmbedChart`s with a heading each). The dashboard is that page as data: a list of tiles, each naming the resource that\n * owns the chart and the chart view's ref.\n *\n * Each tile renders through `EmbedChart`, so it keeps everything a resource-owned chart does: the chart's feature\n * gate, the viewer's organization scope (from the host composite's context), and a failure that stays inside its card.\n * A tile the viewer may not read is not drawn at all ({@link viewerMayReadChart}).\n *\n * A tile may be a FIGURE as well as a drawing: a chart view whose chart is a `ChartType.KPI` (a count, a sum, a rate over\n * the whole scope, its query grouping by nothing) renders as one number (`ChartKpiFigure`). It is declared, fetched,\n * authorized and hidden exactly as a chart tile, because it IS a chart: one resource's declared aggregation (#2299).\n *\n * A dashboard given a `layoutRef` may be ARRANGED per organization (#2299): the organization's administrators reorder,\n * resize and hide its tiles, stored as the organization's `organizationDashboardLayouts` row for that ref, and every\n * member sees the arrangement. The arrangement only rearranges the declared tiles ({@link arrangeChartDashboardTiles}),\n * and the read gate runs after it, so no arrangement shows a chart its viewer may not read.\n */\n\nimport React, { useMemo } from 'react';\nimport { ChartDashboardTileRows, ChartDashboardTileSpan, ChartType } from '@wildo-ai/saas-models';\nimport { NavigationViewLabelFamily, TypographyVariant } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useViewerEffectiveRoles } from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport {\n defineCompositeView,\n type CompositeViewAuthoringConfig,\n} from '~wildo-frontend-lib/core/config/composite-view.schemas';\nimport { Text } from '~wildo-frontend-lib/components/typography/text';\nimport { EmbedChart } from '~wildo-frontend-lib/components/resources/embeds/ResourceEmbeds';\nimport { CompositeLayout } from '~wildo-frontend-lib/components/views/composite-view/CompositeLayout';\nimport { viewerMayReadChart } from './chart-dashboard.utils';\nimport { arrangeChartDashboardTiles, defaultChartDashboardTileHeight } from './chart-dashboard-layout.utils';\nimport { ChartDashboardLayoutReadState, useChartDashboardLayout } from './useChartDashboardLayout';\nimport { ChartDashboardLayoutControl } from './ChartDashboardLayoutEditor';\n\n/** @wildo_source:part:start saas.frontend.chart-dashboard facet:layer:frontend facet:family:view facet:audience:app-developer */\n/**\n * The most columns a dashboard's grid reaches, as its container widens. Every dashboard is one column in a narrow pane.\n */\nexport enum ChartDashboardColumns {\n /** Two columns from a medium container (42rem). */\n TWO = 'two',\n /**\n * Three narrow columns from a small container (28rem): small charts beside a large one, in a dashboard that shares\n * its row with something else (a block of counters, a list).\n */\n THREE = 'three',\n /** Two columns from a medium container (42rem), four from a wide one (64rem). The default. */\n FOUR = 'four',\n}\n\n/**\n * One tile of a {@link ChartDashboard}: a chart a resource declares in its `chartViews`. A chart whose `chartType` is\n * `ChartType.KPI` is a KPI tile: one figure under its title instead of a drawing.\n */\nexport interface ChartDashboardTile {\n /** The resource whose `chartViews` declares the chart. */\n resourceType: string;\n /** The chart view's `ref` on that resource (`InsertedChartDeclaration.ref`, usually `<chartDefinition>.ref`). */\n chartViewRef: string;\n /** Grid columns the tile spans (`ChartDashboardTileSpan`, `@wildo-ai/saas-models`). Default: `ONE`. */\n span?: ChartDashboardTileSpan;\n /** Grid rows the tile spans (`ChartDashboardTileRows`, `@wildo-ai/saas-models`). Default: `ONE`. */\n rows?: ChartDashboardTileRows;\n /**\n * Chart canvas height in px for the tile's declared `rows` (the canvas is sized by this, not by the tile). Default:\n * 280 for a one-row chart, 592 for a two-row one (two rows and the gap between them); a KPI tile takes the height of its\n * figure, and this only sizes its loading placeholder (default 64). When an organization's layout changes the tile's\n * rows, this height is doubled (plus the gap) or halved with them.\n */\n height?: number;\n}\n\nexport interface ChartDashboardProps {\n /** The tiles, in reading order. Tiles may name charts of any number of resources. */\n tiles: readonly ChartDashboardTile[];\n /** The most columns the grid reaches. Default: {@link ChartDashboardColumns.FOUR}. */\n columns?: ChartDashboardColumns;\n /**\n * The dashboard's name for an organization's stored arrangement of it (`organizationDashboardLayouts.dashboardRef`),\n * unique within the application, e.g. `'home-analytics'`. Given one, the organization's administrators may reorder,\n * resize and hide its tiles for every member, and go back to the declared layout; without one the dashboard is always\n * laid out as declared.\n */\n layoutRef?: string;\n className?: string;\n}\n\n/**\n * Lays charts from several resources on one responsive grid: one column in a narrow pane, then up to `columns`\n * ({@link ChartDashboardColumns}, four by default) as the container widens (container queries, so a dashboard in a\n * split pane is laid out for the pane). A tile may span two columns or the whole row, and two rows.\n *\n * Each tile is headed by the chart view's own title (`views.chart.resources.<resourceType>.<ref>.title`, the words\n * its route and launcher use) and drawn through `EmbedChart`: the chart's feature gate, the host composite's scope and\n * a failure kept inside the tile. A tile whose chart the viewer may not read — the backend's aggregation gate would\n * refuse it: no LIST role on its resource or on a resource it joins, or outside the chart's own `accessControl.roles`,\n * or only a role confined there to its holder's own or assigned rows (a chart reads every row in scope) — is not drawn,\n * and the grid closes up. A dashboard with nothing the viewer may read renders nothing.\n *\n * A KPI tile (a chart view whose chart is `ChartType.KPI`) shows one figure under that title, hidden by the same rule.\n *\n * With a `layoutRef`, the current organization's stored arrangement applies first (order, sizes, hidden tiles); the read\n * gate then applies to what is left. An administrator who may arrange it gets a \"customize\" button above the grid,\n * opening the layout editor, and keeps it even when every tile is hidden. The grid waits for the arrangement to be read,\n * and a read that fails shows the declared layout.\n *\n * Place it inside a composite view (`CompositeLayout`), or declare a whole view as one with\n * {@link defineChartDashboardView}.\n *\n * @example\n * ```tsx\n * <ChartDashboard\n * tiles={[\n * { resourceType: R.TODOS, chartViewRef: todosByStatusChartDefinition.ref },\n * { resourceType: R.TASKS, chartViewRef: todoTaskPriorityChartDefinition.ref },\n * { resourceType: R.TODOS, chartViewRef: todosCreatedTimelineChartDefinition.ref, span: ChartDashboardTileSpan.TWO },\n * ]}\n * />\n * ```\n */\nexport function ChartDashboard({ tiles, columns = ChartDashboardColumns.FOUR, layoutRef, className }: ChartDashboardProps): React.JSX.Element | null {\n const { registry } = useResourceRegistry();\n const viewer = useViewerEffectiveRoles();\n const layout = useChartDashboardLayout(layoutRef, viewer);\n const arrangedTiles = useMemo(\n () => arrangeChartDashboardTiles(tiles, layout.stored?.tiles).filter((entry) => !entry.hidden).map((entry) => entry.tile),\n [tiles, layout.stored],\n );\n const visibleTiles = useMemo(\n () => arrangedTiles.flatMap((tile) => {\n const chartView = registry.resourceConfigurations[tile.resourceType]?.frontendConfiguration?.chartViews\n ?.find((candidate) => candidate.ref === tile.chartViewRef);\n // An unknown chart is an authoring error, and `EmbedChart` throws it with the resource and ref named.\n if (chartView !== undefined && !viewerMayReadChart(chartView.chartDefinition, registry, viewer)) return [];\n return [{ tile, isFigure: chartView?.chartDefinition.chartType === ChartType.KPI }];\n }),\n [arrangedTiles, registry, viewer],\n );\n\n if (layout.readState === ChartDashboardLayoutReadState.LOADING) return null;\n // An administrator keeps the editor even when nothing is left to show: they may have hidden every tile.\n if (visibleTiles.length === 0 && !layout.canEdit) return null;\n const grid = GRID_CLASSES[columns];\n return (\n <div className={cn('@container flex w-full flex-col gap-element', className)} data-chart-dashboard>\n {layout.canEdit && <ChartDashboardLayoutControl tiles={tiles} layout={layout} />}\n {visibleTiles.length > 0 && (\n <div className={cn('grid grid-cols-1 gap-group', grid.columns)}>\n {visibleTiles.map(({ tile, isFigure }) => (\n <ChartDashboardTileCell key={`${tile.resourceType}:${tile.chartViewRef}`} tile={tile} isFigure={isFigure} grid={grid} />\n ))}\n </div>\n )}\n </div>\n );\n}\n/** @wildo_source:part:end saas.frontend.chart-dashboard */\n\n/**\n * The grid's column classes, and the span classes that go with them. A span applies only from the container width\n * where the grid has more than one column, so it is read from the same entry: a two-row tile in a one-column grid would\n * otherwise stretch over two rows of its own. Literal strings, so the stylesheet compiler sees every class.\n */\ninterface ChartDashboardGridClasses {\n columns: string;\n spanTwo: string;\n rowsTwo: string;\n}\n\nconst GRID_CLASSES: Record<ChartDashboardColumns, ChartDashboardGridClasses> = {\n [ChartDashboardColumns.TWO]: { columns: '@2xl:grid-cols-2', spanTwo: '@2xl:col-span-2', rowsTwo: '@2xl:row-span-2' },\n [ChartDashboardColumns.THREE]: { columns: '@md:grid-cols-3', spanTwo: '@md:col-span-2', rowsTwo: '@md:row-span-2' },\n [ChartDashboardColumns.FOUR]: { columns: '@2xl:grid-cols-2 @5xl:grid-cols-4', spanTwo: '@2xl:col-span-2', rowsTwo: '@2xl:row-span-2' },\n};\n\nfunction tileSpanClasses(tile: ChartDashboardTile, grid: ChartDashboardGridClasses): string {\n const span = tile.span ?? ChartDashboardTileSpan.ONE;\n return cn(\n span === ChartDashboardTileSpan.TWO && grid.spanTwo,\n span === ChartDashboardTileSpan.FULL && 'col-span-full',\n tile.rows === ChartDashboardTileRows.TWO && grid.rowsTwo,\n );\n}\n\nfunction ChartDashboardTileCell({ tile, isFigure, grid }: { tile: ChartDashboardTile; isFigure: boolean; grid: ChartDashboardGridClasses }): React.JSX.Element {\n const { tView } = useI18n();\n const heading = tView(NavigationViewLabelFamily.CHART, `resources.${tile.resourceType}.${tile.chartViewRef}`, 'title');\n return (\n <section\n className={cn('flex min-w-0 flex-col gap-element', tileSpanClasses(tile, grid))}\n data-chart-dashboard-tile={`${tile.resourceType}:${tile.chartViewRef}`}\n data-chart-dashboard-figure={isFigure ? '' : undefined}\n >\n {heading && (\n <Text as=\"div\" typography={TypographyVariant.EYEBROW}>\n {heading}\n </Text>\n )}\n <EmbedChart\n resourceType={tile.resourceType}\n viewRef={tile.chartViewRef}\n height={tile.height ?? defaultChartDashboardTileHeight(isFigure, tile.rows)}\n />\n </section>\n );\n}\n\n/** @wildo_source:part:start saas.frontend.chart-dashboard-view facet:layer:frontend facet:family:view facet:audience:app-developer */\n/**\n * A whole composite view that is a chart dashboard, declared as data — register it under the frontend domain module's\n * `compositeViews` like any app-level composite. The rest of the config is the composite view's\n * own (`sectionRefs`, `icon`, `requiredFeatures`, …).\n *\n * @example\n * ```ts\n * compositeViews: {\n * 'operations-dashboard': defineChartDashboardView({\n * tiles: [\n * { resourceType: R.CASES, chartViewRef: casesByStatusChart.ref },\n * { resourceType: R.INVOICES, chartViewRef: revenueByMonthChart.ref, span: ChartDashboardTileSpan.TWO },\n * { resourceType: R.SLA_BREACHES, chartViewRef: breachesByTeamChart.ref },\n * ],\n * }),\n * }\n * ```\n */\nexport function defineChartDashboardView(\n config: { tiles: readonly ChartDashboardTile[]; columns?: ChartDashboardColumns; layoutRef?: string } & Omit<CompositeViewAuthoringConfig, 'viewComponent'>,\n): CompositeViewAuthoringConfig {\n const { tiles, columns, layoutRef, ...compositeConfig } = config;\n function ChartDashboardView(): React.JSX.Element {\n return (\n <CompositeLayout>\n <ChartDashboard tiles={tiles} columns={columns} layoutRef={layoutRef} />\n </CompositeLayout>\n );\n }\n return defineCompositeView(ChartDashboardView, compositeConfig);\n}\n/** @wildo_source:part:end saas.frontend.chart-dashboard-view */\n"]}
|
|
1
|
+
{"version":3,"file":"ChartDashboard.js","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/ChartDashboard.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,mEAAmE,CAAC;AAC5G,OAAO,EACL,mBAAmB,GAEpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,gDAAgD,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,gEAAgE,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,qEAAqE,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAC7G,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MA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,CACV,KAAC,IAAI,IAAC,EAAE,EAAC,KAAK,EAAC,UAAU,EAAE,iBAAiB,CAAC,OAAO,YACjD,OAAO,GACH,CACR,EACD,KAAC,UAAU,IACT,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,GAC3E,IACM,CACX,CAAC;AACJ,CAAC;AAED,sIAAsI;AACtI;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAA2J;IAE3J,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GAAG,MAAM,CAAC;IACjE,SAAS,kBAAkB;QACzB,OAAO,CACL,KAAC,eAAe,cACd,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAI,GACxD,CACnB,CAAC;IACJ,CAAC;IACD,OAAO,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAClE,CAAC","sourcesContent":["/**\n * A declarative chart dashboard: charts that SEVERAL resources own, on one responsive grid (#2299).\n *\n * Charts are resource-scoped: each resource declares its `chartViews`, and the backend executes them with tenant scope\n * and authorization injected. Before this, a page combining them was hand-written per application (a grid of\n * `EmbedChart`s with a heading each). The dashboard is that page as data: a list of tiles, each naming the resource that\n * owns the chart and the chart view's ref.\n *\n * Each tile renders through `EmbedChart`, so it keeps everything a resource-owned chart does: the chart's feature\n * gate, the viewer's organization scope (from the host composite's context), and a failure that stays inside its card.\n * A tile the viewer may not read is not drawn at all ({@link viewerMayReadChart}).\n *\n * A tile may be a FIGURE as well as a drawing: a chart view whose chart is a `ChartType.KPI` (a count, a sum, a rate over\n * the whole scope, its query grouping by nothing) renders as one number (`ChartKpiFigure`). It is declared, fetched,\n * authorized and hidden exactly as a chart tile, because it IS a chart: one resource's declared aggregation (#2299).\n *\n * A dashboard given a `layoutRef` may be ARRANGED per organization (#2299): the organization's administrators reorder,\n * resize and hide its tiles, stored as the organization's `organizationDashboardLayouts` row for that ref, and every\n * member sees the arrangement. The arrangement only rearranges the declared tiles ({@link arrangeChartDashboardTiles}),\n * and the read gate runs after it, so no arrangement shows a chart its viewer may not read.\n */\n\nimport React, { useMemo } from 'react';\nimport { ChartDashboardTileRows, ChartDashboardTileSpan, ChartType } from '@wildo-ai/saas-models';\nimport { NavigationViewLabelFamily, TypographyVariant } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useViewerEffectiveRoles } from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport {\n defineCompositeView,\n type CompositeViewAuthoringConfig,\n} from '~wildo-frontend-lib/core/config/composite-view.schemas';\nimport { Text } from '~wildo-frontend-lib/components/typography/text';\nimport { EmbedChart } from '~wildo-frontend-lib/components/resources/embeds/ResourceEmbeds';\nimport { CompositeLayout } from '~wildo-frontend-lib/components/views/composite-view/CompositeLayout';\nimport { viewerMayReadChart } from '~wildo-frontend-lib/core/navigation/chart-read-gate';\nimport { arrangeChartDashboardTiles, defaultChartDashboardTileHeight } from './chart-dashboard-layout.utils';\nimport { ChartDashboardLayoutReadState, useChartDashboardLayout } from './useChartDashboardLayout';\nimport { ChartDashboardLayoutControl } from './ChartDashboardLayoutEditor';\n\n/** @wildo_source:part:start saas.frontend.chart-dashboard facet:layer:frontend facet:family:view facet:audience:app-developer */\n/**\n * The most columns a dashboard's grid reaches, as its container widens. Every dashboard is one column in a narrow pane.\n */\nexport enum ChartDashboardColumns {\n /** Two columns from a medium container (42rem). */\n TWO = 'two',\n /**\n * Three narrow columns from a small container (28rem): small charts beside a large one, in a dashboard that shares\n * its row with something else (a block of counters, a list).\n */\n THREE = 'three',\n /** Two columns from a medium container (42rem), four from a wide one (64rem). The default. */\n FOUR = 'four',\n}\n\n/**\n * One tile of a {@link ChartDashboard}: a chart a resource declares in its `chartViews`. A chart whose `chartType` is\n * `ChartType.KPI` is a KPI tile: one figure under its title instead of a drawing.\n */\nexport interface ChartDashboardTile {\n /** The resource whose `chartViews` declares the chart. */\n resourceType: string;\n /** The chart view's `ref` on that resource (`InsertedChartDeclaration.ref`, usually `<chartDefinition>.ref`). */\n chartViewRef: string;\n /** Grid columns the tile spans (`ChartDashboardTileSpan`, `@wildo-ai/saas-models`). Default: `ONE`. */\n span?: ChartDashboardTileSpan;\n /** Grid rows the tile spans (`ChartDashboardTileRows`, `@wildo-ai/saas-models`). Default: `ONE`. */\n rows?: ChartDashboardTileRows;\n /**\n * Chart canvas height in px for the tile's declared `rows` (the canvas is sized by this, not by the tile). Default:\n * 280 for a one-row chart, 592 for a two-row one (two rows and the gap between them); a KPI tile takes the height of its\n * figure, and this only sizes its loading placeholder (default 64). When an organization's layout changes the tile's\n * rows, this height is doubled (plus the gap) or halved with them.\n */\n height?: number;\n}\n\nexport interface ChartDashboardProps {\n /** The tiles, in reading order. Tiles may name charts of any number of resources. */\n tiles: readonly ChartDashboardTile[];\n /** The most columns the grid reaches. Default: {@link ChartDashboardColumns.FOUR}. */\n columns?: ChartDashboardColumns;\n /**\n * The dashboard's name for an organization's stored arrangement of it (`organizationDashboardLayouts.dashboardRef`),\n * unique within the application, e.g. `'home-analytics'`. Given one, the organization's administrators may reorder,\n * resize and hide its tiles for every member, and go back to the declared layout; without one the dashboard is always\n * laid out as declared.\n */\n layoutRef?: string;\n className?: string;\n}\n\n/**\n * Lays charts from several resources on one responsive grid: one column in a narrow pane, then up to `columns`\n * ({@link ChartDashboardColumns}, four by default) as the container widens (container queries, so a dashboard in a\n * split pane is laid out for the pane). A tile may span two columns or the whole row, and two rows.\n *\n * Each tile is headed by the chart view's own title (`views.chart.resources.<resourceType>.<ref>.title`, the words\n * its route and launcher use) and drawn through `EmbedChart`: the chart's feature gate, the host composite's scope and\n * a failure kept inside the tile. A tile whose chart the viewer may not read — the backend's aggregation gate would\n * refuse it: no LIST role (nor, beside `auditReads`, aggregate-reader role) on its resource or on a resource it joins,\n * or outside the chart's own `accessControl.roles`, or only a LIST role confined there to its holder's own or assigned\n * rows (a chart reads every row in scope) — is not drawn,\n * and the grid closes up. A dashboard with nothing the viewer may read renders nothing.\n *\n * A KPI tile (a chart view whose chart is `ChartType.KPI`) shows one figure under that title, hidden by the same rule.\n *\n * With a `layoutRef`, the current organization's stored arrangement applies first (order, sizes, hidden tiles); the read\n * gate then applies to what is left. An administrator who may arrange it gets a \"customize\" button above the grid,\n * opening the layout editor, and keeps it even when every tile is hidden. The grid waits for the arrangement to be read,\n * and a read that fails shows the declared layout.\n *\n * Place it inside a composite view (`CompositeLayout`), or declare a whole view as one with\n * {@link defineChartDashboardView}.\n *\n * @example\n * ```tsx\n * <ChartDashboard\n * tiles={[\n * { resourceType: R.TODOS, chartViewRef: todosByStatusChartDefinition.ref },\n * { resourceType: R.TASKS, chartViewRef: todoTaskPriorityChartDefinition.ref },\n * { resourceType: R.TODOS, chartViewRef: todosCreatedTimelineChartDefinition.ref, span: ChartDashboardTileSpan.TWO },\n * ]}\n * />\n * ```\n */\nexport function ChartDashboard({ tiles, columns = ChartDashboardColumns.FOUR, layoutRef, className }: ChartDashboardProps): React.JSX.Element | null {\n const { registry } = useResourceRegistry();\n const viewer = useViewerEffectiveRoles();\n const layout = useChartDashboardLayout(layoutRef, viewer);\n const arrangedTiles = useMemo(\n () => arrangeChartDashboardTiles(tiles, layout.stored?.tiles).filter((entry) => !entry.hidden).map((entry) => entry.tile),\n [tiles, layout.stored],\n );\n const visibleTiles = useMemo(\n () => arrangedTiles.flatMap((tile) => {\n const chartView = registry.resourceConfigurations[tile.resourceType]?.frontendConfiguration?.chartViews\n ?.find((candidate) => candidate.ref === tile.chartViewRef);\n // An unknown chart is an authoring error, and `EmbedChart` throws it with the resource and ref named.\n if (chartView !== undefined && !viewerMayReadChart(chartView.chartDefinition, registry, viewer)) return [];\n return [{ tile, isFigure: chartView?.chartDefinition.chartType === ChartType.KPI }];\n }),\n [arrangedTiles, registry, viewer],\n );\n\n if (layout.readState === ChartDashboardLayoutReadState.LOADING) return null;\n // An administrator keeps the editor even when nothing is left to show: they may have hidden every tile.\n if (visibleTiles.length === 0 && !layout.canEdit) return null;\n const grid = GRID_CLASSES[columns];\n return (\n <div className={cn('@container flex w-full flex-col gap-element', className)} data-chart-dashboard>\n {layout.canEdit && <ChartDashboardLayoutControl tiles={tiles} layout={layout} />}\n {visibleTiles.length > 0 && (\n <div className={cn('grid grid-cols-1 gap-group', grid.columns)}>\n {visibleTiles.map(({ tile, isFigure }) => (\n <ChartDashboardTileCell key={`${tile.resourceType}:${tile.chartViewRef}`} tile={tile} isFigure={isFigure} grid={grid} />\n ))}\n </div>\n )}\n </div>\n );\n}\n/** @wildo_source:part:end saas.frontend.chart-dashboard */\n\n/**\n * The grid's column classes, and the span classes that go with them. A span applies only from the container width\n * where the grid has more than one column, so it is read from the same entry: a two-row tile in a one-column grid would\n * otherwise stretch over two rows of its own. Literal strings, so the stylesheet compiler sees every class.\n */\ninterface ChartDashboardGridClasses {\n columns: string;\n spanTwo: string;\n rowsTwo: string;\n}\n\nconst GRID_CLASSES: Record<ChartDashboardColumns, ChartDashboardGridClasses> = {\n [ChartDashboardColumns.TWO]: { columns: '@2xl:grid-cols-2', spanTwo: '@2xl:col-span-2', rowsTwo: '@2xl:row-span-2' },\n [ChartDashboardColumns.THREE]: { columns: '@md:grid-cols-3', spanTwo: '@md:col-span-2', rowsTwo: '@md:row-span-2' },\n [ChartDashboardColumns.FOUR]: { columns: '@2xl:grid-cols-2 @5xl:grid-cols-4', spanTwo: '@2xl:col-span-2', rowsTwo: '@2xl:row-span-2' },\n};\n\nfunction tileSpanClasses(tile: ChartDashboardTile, grid: ChartDashboardGridClasses): string {\n const span = tile.span ?? ChartDashboardTileSpan.ONE;\n return cn(\n span === ChartDashboardTileSpan.TWO && grid.spanTwo,\n span === ChartDashboardTileSpan.FULL && 'col-span-full',\n tile.rows === ChartDashboardTileRows.TWO && grid.rowsTwo,\n );\n}\n\nfunction ChartDashboardTileCell({ tile, isFigure, grid }: { tile: ChartDashboardTile; isFigure: boolean; grid: ChartDashboardGridClasses }): React.JSX.Element {\n const { tView } = useI18n();\n const heading = tView(NavigationViewLabelFamily.CHART, `resources.${tile.resourceType}.${tile.chartViewRef}`, 'title');\n return (\n <section\n className={cn('flex min-w-0 flex-col gap-element', tileSpanClasses(tile, grid))}\n data-chart-dashboard-tile={`${tile.resourceType}:${tile.chartViewRef}`}\n data-chart-dashboard-figure={isFigure ? '' : undefined}\n >\n {heading && (\n <Text as=\"div\" typography={TypographyVariant.EYEBROW}>\n {heading}\n </Text>\n )}\n <EmbedChart\n resourceType={tile.resourceType}\n viewRef={tile.chartViewRef}\n height={tile.height ?? defaultChartDashboardTileHeight(isFigure, tile.rows)}\n />\n </section>\n );\n}\n\n/** @wildo_source:part:start saas.frontend.chart-dashboard-view facet:layer:frontend facet:family:view facet:audience:app-developer */\n/**\n * A whole composite view that is a chart dashboard, declared as data — register it under the frontend domain module's\n * `compositeViews` like any app-level composite. The rest of the config is the composite view's\n * own (`sectionRefs`, `icon`, `requiredFeatures`, …).\n *\n * @example\n * ```ts\n * compositeViews: {\n * 'operations-dashboard': defineChartDashboardView({\n * tiles: [\n * { resourceType: R.CASES, chartViewRef: casesByStatusChart.ref },\n * { resourceType: R.INVOICES, chartViewRef: revenueByMonthChart.ref, span: ChartDashboardTileSpan.TWO },\n * { resourceType: R.SLA_BREACHES, chartViewRef: breachesByTeamChart.ref },\n * ],\n * }),\n * }\n * ```\n */\nexport function defineChartDashboardView(\n config: { tiles: readonly ChartDashboardTile[]; columns?: ChartDashboardColumns; layoutRef?: string } & Omit<CompositeViewAuthoringConfig, 'viewComponent'>,\n): CompositeViewAuthoringConfig {\n const { tiles, columns, layoutRef, ...compositeConfig } = config;\n function ChartDashboardView(): React.JSX.Element {\n return (\n <CompositeLayout>\n <ChartDashboard tiles={tiles} columns={columns} layoutRef={layoutRef} />\n </CompositeLayout>\n );\n }\n return defineCompositeView(ChartDashboardView, compositeConfig);\n}\n/** @wildo_source:part:end saas.frontend.chart-dashboard-view */\n"]}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - after a save or a reset in this tab, every dashboard showing the same layout in the same organization reads it again.
|
|
16
16
|
*/
|
|
17
17
|
import { type OrganizationDashboardLayout, type OrganizationDashboardLayoutTile } from '@wildo-ai/saas-models';
|
|
18
|
-
import { type LauncherEffectiveRoles } from '../../../core/navigation/
|
|
18
|
+
import { type LauncherEffectiveRoles } from '../../../core/navigation/viewer-roles';
|
|
19
19
|
/** Where the read of a dashboard's layout stands. */
|
|
20
20
|
export declare enum ChartDashboardLayoutReadState {
|
|
21
21
|
/** The layout is being read; the dashboard waits. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChartDashboardLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/useChartDashboardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACrC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useChartDashboardLayout.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/useChartDashboardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACrC,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAM/F,qDAAqD;AACrD,oBAAY,6BAA6B;IACvC,qDAAqD;IACrD,OAAO,YAAY;IACnB,0GAA0G;IAC1G,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,6BAA6B,CAAC;IACzC,oGAAoG;IACpG,MAAM,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAChD,qGAAqG;IACrG,OAAO,EAAE,OAAO,CAAC;IACjB,yGAAyG;IACzG,IAAI,EAAE,CAAC,KAAK,EAAE,+BAA+B,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,qGAAqG;IACrG,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AA0CD,4GAA4G;AAC5G,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,sBAAsB,GAAG,0BAA0B,CA0FjI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChartDashboardLayout.js","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/useChartDashboardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,4BAA4B,EAC5B,kCAAkC,GAGnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAA+B,MAAM,yDAAyD,CAAC;AACjI,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AAEpG,MAAM,MAAM,GAA0B,qBAAqB,CAAC,SAAS,EAAE,CAAC;AACxE,MAAM,OAAO,GAAG,gBAAgB,CAAC,8BAA8B,CAAC;AAEhE,qDAAqD;AACrD,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,qDAAqD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EAAE,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC;IAEpG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACrD,CAAC","sourcesContent":["/**\n * The current organization's stored layout of one chart dashboard, and the doors to change it (#2299).\n *\n * Read through the `organizationDashboardLayouts` LIST, filtered by the dashboard's `layoutRef` (every member may read\n * it); written through its CREATE / UPDATE, and reset through its DELETE (the organization's administrators). The backend\n * decides every request and audits every write; this hook only asks the registry's own roles before OFFERING a write\n * (`canEdit`), so a member is never shown an editor whose save would be refused.\n *\n * Settling, and what each outcome means for the dashboard:\n * - no `layoutRef`, no organization, no LIST this frontend registers, or a viewer the LIST would refuse: SETTLED with no\n * layout, so the dashboard shows its declared tiles at once;\n * - a read in flight: LOADING. The dashboard waits rather than drawing the declared order and then jumping;\n * - a read that failed: SETTLED with no layout, logged. Presentation falls back to what the application declared, never\n * to an error;\n * - after a save or a reset in this tab, every dashboard showing the same layout in the same organization reads it again.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n type OrganizationDashboardLayout,\n type OrganizationDashboardLayoutTile,\n} from '@wildo-ai/saas-models';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport type { FrontendResourceConfiguration_Operation } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { viewerMayPerformOperation, type LauncherEffectiveRoles } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\n\nconst logger: LoggerFrontendService = LoggerFrontendService.getLogger();\nconst LAYOUTS = CoreResourceType.ORGANIZATION_DASHBOARD_LAYOUTS;\n\n/** Where the read of a dashboard's layout stands. */\nexport enum ChartDashboardLayoutReadState {\n /** The layout is being read; the dashboard waits. */\n LOADING = 'loading',\n /** Read, or nothing to read: `stored` is the organization's layout, or undefined for the declared one. */\n SETTLED = 'settled',\n}\n\nexport interface ChartDashboardLayoutHandle {\n readState: ChartDashboardLayoutReadState;\n /** The organization's stored layout of this dashboard; undefined when it keeps the declared one. */\n stored: OrganizationDashboardLayout | undefined;\n /** Whether the viewer may arrange this dashboard for the organization (create, update and reset). */\n canEdit: boolean;\n /** Store `tiles` as the organization's layout of this dashboard: CREATE the first time, UPDATE after. */\n save: (tiles: OrganizationDashboardLayoutTile[]) => Promise<void>;\n /** Delete the organization's layout, so the dashboard goes back to what the application declares. */\n reset: () => Promise<void>;\n}\n\n/** Every mounted reader of one (organization, layout), told to read again after a write in this tab. */\nconst layoutReaders = new Map<string, Set<() => void>>();\n\nfunction notifyLayoutReaders(key: string): void {\n layoutReaders.get(key)?.forEach((reread) => reread());\n}\n\nfunction findDefaultApiOperation(operations: readonly FrontendResourceConfiguration_Operation[] | undefined, verb: CoreResourceOperation): FrontendResourceConfiguration_Operation | undefined {\n return operations?.find((operation) => operation.operationIdentifier === verb\n && operation.isOperationDefault === true\n && operation.isBulkOperation !== true\n && operation.variantType === ResourceOperationVariantType.API_CALL);\n}\n\n/**\n * A refused write is followed by a re-read, so the next attempt targets what the store now holds: another administrator\n * may have created the row (this tab's CREATE then answers 409) or reset it (UPDATE answers 404) since it was read.\n */\nfunction rereadAndRethrow(key: string): (error: unknown) => never {\n return (error: unknown) => {\n notifyLayoutReaders(key);\n throw error;\n };\n}\n\n/** The rows of one LIST answer, from either the paginated or the bare-array shape. */\nfunction listRows(result: unknown): OrganizationDashboardLayout[] {\n if (Array.isArray(result)) return result as OrganizationDashboardLayout[];\n const data = (result as { data?: unknown } | null | undefined)?.data;\n return Array.isArray(data) ? data as OrganizationDashboardLayout[] : [];\n}\n\n/** One write's answer, whether bare or wrapped in `{ data }`. */\nfunction writtenRow(result: unknown): OrganizationDashboardLayout | undefined {\n if (!result || typeof result !== 'object' || Array.isArray(result)) return undefined;\n const wrapped = (result as { data?: unknown }).data;\n const row = (wrapped && typeof wrapped === 'object' && !Array.isArray(wrapped) ? wrapped : result) as Partial<OrganizationDashboardLayout>;\n return typeof row._id === 'string' && Array.isArray(row.tiles) ? row as OrganizationDashboardLayout : undefined;\n}\n\n/** See the module comment. `viewer` is the viewer's effective roles, as the dashboard's gate reads them. */\nexport function useChartDashboardLayout(layoutRef: string | undefined, viewer: LauncherEffectiveRoles): ChartDashboardLayoutHandle {\n const { registry, doOperation } = useResourceRegistry();\n const organizationId = useAppScopeSafe()?.currentOrganizationId ?? null;\n const configuration = registry.resourceConfigurations[LAYOUTS];\n const operations = configuration?.operations as readonly FrontendResourceConfiguration_Operation[] | undefined;\n const organizationFieldIdentifier = registry.resourceConfigurations[CoreResourceType.ORGANIZATIONS]?.resourceFieldIdentifier ?? 'organizationId';\n const layoutFieldIdentifier = configuration?.resourceFieldIdentifier;\n\n const doors = useMemo(() => ({\n list: findDefaultApiOperation(operations, CoreResourceOperation.LIST),\n create: findDefaultApiOperation(operations, CoreResourceOperation.CREATE),\n update: findDefaultApiOperation(operations, CoreResourceOperation.UPDATE),\n remove: findDefaultApiOperation(operations, CoreResourceOperation.DELETE),\n }), [operations]);\n const may = (operation: FrontendResourceConfiguration_Operation | undefined): boolean =>\n !!operation && viewerMayPerformOperation({ ...operation, resourceType: LAYOUTS }, viewer);\n const mayRead = !!layoutRef && organizationId !== null && may(doors.list);\n const canEdit = mayRead && may(doors.create) && may(doors.update) && may(doors.remove);\n\n const key = mayRead ? `${organizationId}|${layoutRef}` : null;\n const [answer, setAnswer] = useState<{ key: string; stored: OrganizationDashboardLayout | undefined } | null>(null);\n const [revision, setRevision] = useState(0);\n // The scoped `doOperation` changes identity with every scope change; the read uses the latest through a ref so a\n // settling scope does not cancel and resend it.\n const doOperationRef = useRef(doOperation);\n doOperationRef.current = doOperation;\n\n useEffect(() => {\n if (!key) return undefined;\n const reread = (): void => setRevision((current) => current + 1);\n const readers = layoutReaders.get(key) ?? new Set<() => void>();\n readers.add(reread);\n layoutReaders.set(key, readers);\n return () => {\n readers.delete(reread);\n if (readers.size === 0) layoutReaders.delete(key);\n };\n }, [key]);\n\n useEffect(() => {\n if (!key || !doors.list || organizationId === null || !layoutRef) return undefined;\n let cancelled = false;\n const settle = (stored: OrganizationDashboardLayout | undefined): void => {\n if (!cancelled) setAnswer({ key, stored });\n };\n doOperationRef.current(\n ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.list),\n { contextualParameters: { [organizationFieldIdentifier]: organizationId }, queryParameters: { dashboardRef: layoutRef, page: 1, limit: 1 } },\n { silent: true },\n )\n // The filter is the backend's; the row is checked again here, so a LIST that ignored it never applies another\n // dashboard's layout.\n .then((result) => settle(listRows(result).find((row) => row.dashboardRef === layoutRef)))\n .catch((error: unknown) => {\n logger.warn('Could not read the organization\\'s dashboard layout; showing the declared one', { layoutRef, organizationId, error });\n settle(undefined);\n });\n return () => { cancelled = true; };\n }, [key, doors.list, organizationId, layoutRef, organizationFieldIdentifier, revision]);\n\n const stored = key && answer?.key === key ? answer.stored : undefined;\n const readState = !key || answer?.key === key ? ChartDashboardLayoutReadState.SETTLED : ChartDashboardLayoutReadState.LOADING;\n\n const save = useCallback(async (tiles: OrganizationDashboardLayoutTile[]): Promise<void> => {\n if (!key || organizationId === null || !layoutRef || !doors.create || !doors.update || !layoutFieldIdentifier) return;\n const contextualParameters = { [organizationFieldIdentifier]: organizationId };\n const result = await (stored\n ? doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.update), {\n contextualParameters: { ...contextualParameters, [layoutFieldIdentifier]: stored._id },\n requestData: { tiles },\n })\n : doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.create), {\n contextualParameters,\n requestData: { dashboardRef: layoutRef, tiles },\n })).catch(rereadAndRethrow(key));\n const row = writtenRow(result);\n if (row) setAnswer({ key, stored: row });\n notifyLayoutReaders(key);\n }, [key, organizationId, layoutRef, doors.create, doors.update, layoutFieldIdentifier, organizationFieldIdentifier, stored]);\n\n const reset = useCallback(async (): Promise<void> => {\n if (!key || organizationId === null || !doors.remove || !layoutFieldIdentifier || !stored) return;\n await doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.remove), {\n contextualParameters: { [organizationFieldIdentifier]: organizationId, [layoutFieldIdentifier]: stored._id },\n }).catch(rereadAndRethrow(key));\n setAnswer({ key, stored: undefined });\n notifyLayoutReaders(key);\n }, [key, organizationId, doors.remove, layoutFieldIdentifier, organizationFieldIdentifier, stored]);\n\n return { readState, stored, canEdit, save, reset };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useChartDashboardLayout.js","sourceRoot":"","sources":["../../../../../src/components/views/chart-dashboard/useChartDashboardLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,4BAA4B,EAC5B,kCAAkC,GAGnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AAEpG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AAEpG,MAAM,MAAM,GAA0B,qBAAqB,CAAC,SAAS,EAAE,CAAC;AACxE,MAAM,OAAO,GAAG,gBAAgB,CAAC,8BAA8B,CAAC;AAEhE,qDAAqD;AACrD,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,qDAAqD;IACrD,oDAAmB,CAAA;IACnB,0GAA0G;IAC1G,oDA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EpG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACrD,CAAC","sourcesContent":["/**\n * The current organization's stored layout of one chart dashboard, and the doors to change it (#2299).\n *\n * Read through the `organizationDashboardLayouts` LIST, filtered by the dashboard's `layoutRef` (every member may read\n * it); written through its CREATE / UPDATE, and reset through its DELETE (the organization's administrators). The backend\n * decides every request and audits every write; this hook only asks the registry's own roles before OFFERING a write\n * (`canEdit`), so a member is never shown an editor whose save would be refused.\n *\n * Settling, and what each outcome means for the dashboard:\n * - no `layoutRef`, no organization, no LIST this frontend registers, or a viewer the LIST would refuse: SETTLED with no\n * layout, so the dashboard shows its declared tiles at once;\n * - a read in flight: LOADING. The dashboard waits rather than drawing the declared order and then jumping;\n * - a read that failed: SETTLED with no layout, logged. Presentation falls back to what the application declared, never\n * to an error;\n * - after a save or a reset in this tab, every dashboard showing the same layout in the same organization reads it again.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n type OrganizationDashboardLayout,\n type OrganizationDashboardLayoutTile,\n} from '@wildo-ai/saas-models';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport type { FrontendResourceConfiguration_Operation } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { viewerMayPerformOperation } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { type LauncherEffectiveRoles } from '~wildo-frontend-lib/core/navigation/viewer-roles';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\n\nconst logger: LoggerFrontendService = LoggerFrontendService.getLogger();\nconst LAYOUTS = CoreResourceType.ORGANIZATION_DASHBOARD_LAYOUTS;\n\n/** Where the read of a dashboard's layout stands. */\nexport enum ChartDashboardLayoutReadState {\n /** The layout is being read; the dashboard waits. */\n LOADING = 'loading',\n /** Read, or nothing to read: `stored` is the organization's layout, or undefined for the declared one. */\n SETTLED = 'settled',\n}\n\nexport interface ChartDashboardLayoutHandle {\n readState: ChartDashboardLayoutReadState;\n /** The organization's stored layout of this dashboard; undefined when it keeps the declared one. */\n stored: OrganizationDashboardLayout | undefined;\n /** Whether the viewer may arrange this dashboard for the organization (create, update and reset). */\n canEdit: boolean;\n /** Store `tiles` as the organization's layout of this dashboard: CREATE the first time, UPDATE after. */\n save: (tiles: OrganizationDashboardLayoutTile[]) => Promise<void>;\n /** Delete the organization's layout, so the dashboard goes back to what the application declares. */\n reset: () => Promise<void>;\n}\n\n/** Every mounted reader of one (organization, layout), told to read again after a write in this tab. */\nconst layoutReaders = new Map<string, Set<() => void>>();\n\nfunction notifyLayoutReaders(key: string): void {\n layoutReaders.get(key)?.forEach((reread) => reread());\n}\n\nfunction findDefaultApiOperation(operations: readonly FrontendResourceConfiguration_Operation[] | undefined, verb: CoreResourceOperation): FrontendResourceConfiguration_Operation | undefined {\n return operations?.find((operation) => operation.operationIdentifier === verb\n && operation.isOperationDefault === true\n && operation.isBulkOperation !== true\n && operation.variantType === ResourceOperationVariantType.API_CALL);\n}\n\n/**\n * A refused write is followed by a re-read, so the next attempt targets what the store now holds: another administrator\n * may have created the row (this tab's CREATE then answers 409) or reset it (UPDATE answers 404) since it was read.\n */\nfunction rereadAndRethrow(key: string): (error: unknown) => never {\n return (error: unknown) => {\n notifyLayoutReaders(key);\n throw error;\n };\n}\n\n/** The rows of one LIST answer, from either the paginated or the bare-array shape. */\nfunction listRows(result: unknown): OrganizationDashboardLayout[] {\n if (Array.isArray(result)) return result as OrganizationDashboardLayout[];\n const data = (result as { data?: unknown } | null | undefined)?.data;\n return Array.isArray(data) ? data as OrganizationDashboardLayout[] : [];\n}\n\n/** One write's answer, whether bare or wrapped in `{ data }`. */\nfunction writtenRow(result: unknown): OrganizationDashboardLayout | undefined {\n if (!result || typeof result !== 'object' || Array.isArray(result)) return undefined;\n const wrapped = (result as { data?: unknown }).data;\n const row = (wrapped && typeof wrapped === 'object' && !Array.isArray(wrapped) ? wrapped : result) as Partial<OrganizationDashboardLayout>;\n return typeof row._id === 'string' && Array.isArray(row.tiles) ? row as OrganizationDashboardLayout : undefined;\n}\n\n/** See the module comment. `viewer` is the viewer's effective roles, as the dashboard's gate reads them. */\nexport function useChartDashboardLayout(layoutRef: string | undefined, viewer: LauncherEffectiveRoles): ChartDashboardLayoutHandle {\n const { registry, doOperation } = useResourceRegistry();\n const organizationId = useAppScopeSafe()?.currentOrganizationId ?? null;\n const configuration = registry.resourceConfigurations[LAYOUTS];\n const operations = configuration?.operations as readonly FrontendResourceConfiguration_Operation[] | undefined;\n const organizationFieldIdentifier = registry.resourceConfigurations[CoreResourceType.ORGANIZATIONS]?.resourceFieldIdentifier ?? 'organizationId';\n const layoutFieldIdentifier = configuration?.resourceFieldIdentifier;\n\n const doors = useMemo(() => ({\n list: findDefaultApiOperation(operations, CoreResourceOperation.LIST),\n create: findDefaultApiOperation(operations, CoreResourceOperation.CREATE),\n update: findDefaultApiOperation(operations, CoreResourceOperation.UPDATE),\n remove: findDefaultApiOperation(operations, CoreResourceOperation.DELETE),\n }), [operations]);\n const may = (operation: FrontendResourceConfiguration_Operation | undefined): boolean =>\n !!operation && viewerMayPerformOperation({ ...operation, resourceType: LAYOUTS }, viewer);\n const mayRead = !!layoutRef && organizationId !== null && may(doors.list);\n const canEdit = mayRead && may(doors.create) && may(doors.update) && may(doors.remove);\n\n const key = mayRead ? `${organizationId}|${layoutRef}` : null;\n const [answer, setAnswer] = useState<{ key: string; stored: OrganizationDashboardLayout | undefined } | null>(null);\n const [revision, setRevision] = useState(0);\n // The scoped `doOperation` changes identity with every scope change; the read uses the latest through a ref so a\n // settling scope does not cancel and resend it.\n const doOperationRef = useRef(doOperation);\n doOperationRef.current = doOperation;\n\n useEffect(() => {\n if (!key) return undefined;\n const reread = (): void => setRevision((current) => current + 1);\n const readers = layoutReaders.get(key) ?? new Set<() => void>();\n readers.add(reread);\n layoutReaders.set(key, readers);\n return () => {\n readers.delete(reread);\n if (readers.size === 0) layoutReaders.delete(key);\n };\n }, [key]);\n\n useEffect(() => {\n if (!key || !doors.list || organizationId === null || !layoutRef) return undefined;\n let cancelled = false;\n const settle = (stored: OrganizationDashboardLayout | undefined): void => {\n if (!cancelled) setAnswer({ key, stored });\n };\n doOperationRef.current(\n ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.list),\n { contextualParameters: { [organizationFieldIdentifier]: organizationId }, queryParameters: { dashboardRef: layoutRef, page: 1, limit: 1 } },\n { silent: true },\n )\n // The filter is the backend's; the row is checked again here, so a LIST that ignored it never applies another\n // dashboard's layout.\n .then((result) => settle(listRows(result).find((row) => row.dashboardRef === layoutRef)))\n .catch((error: unknown) => {\n logger.warn('Could not read the organization\\'s dashboard layout; showing the declared one', { layoutRef, organizationId, error });\n settle(undefined);\n });\n return () => { cancelled = true; };\n }, [key, doors.list, organizationId, layoutRef, organizationFieldIdentifier, revision]);\n\n const stored = key && answer?.key === key ? answer.stored : undefined;\n const readState = !key || answer?.key === key ? ChartDashboardLayoutReadState.SETTLED : ChartDashboardLayoutReadState.LOADING;\n\n const save = useCallback(async (tiles: OrganizationDashboardLayoutTile[]): Promise<void> => {\n if (!key || organizationId === null || !layoutRef || !doors.create || !doors.update || !layoutFieldIdentifier) return;\n const contextualParameters = { [organizationFieldIdentifier]: organizationId };\n const result = await (stored\n ? doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.update), {\n contextualParameters: { ...contextualParameters, [layoutFieldIdentifier]: stored._id },\n requestData: { tiles },\n })\n : doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.create), {\n contextualParameters,\n requestData: { dashboardRef: layoutRef, tiles },\n })).catch(rereadAndRethrow(key));\n const row = writtenRow(result);\n if (row) setAnswer({ key, stored: row });\n notifyLayoutReaders(key);\n }, [key, organizationId, layoutRef, doors.create, doors.update, layoutFieldIdentifier, organizationFieldIdentifier, stored]);\n\n const reset = useCallback(async (): Promise<void> => {\n if (!key || organizationId === null || !doors.remove || !layoutFieldIdentifier || !stored) return;\n await doOperationRef.current(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(doors.remove), {\n contextualParameters: { [organizationFieldIdentifier]: organizationId, [layoutFieldIdentifier]: stored._id },\n }).catch(rereadAndRethrow(key));\n setAnswer({ key, stored: undefined });\n notifyLayoutReaders(key);\n }, [key, organizationId, doors.remove, layoutFieldIdentifier, organizationFieldIdentifier, stored]);\n\n return { readState, stored, canEdit, save, reset };\n}\n"]}
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* differs, so a dashboard can put a count, a sum or a rate beside its charts without a second mechanism.
|
|
8
8
|
*
|
|
9
9
|
* Rendered with the engine's typography and progress components, never ECharts: a figure has no axis to draw.
|
|
10
|
+
*
|
|
11
|
+
* A figure read at a glance carries what it is measured against, or a person cannot tell whether to act. So a KPI may
|
|
12
|
+
* declare a TARGET (a value, and which side of it is good), shown with whether the figure meets it, and a PERIOD (the
|
|
13
|
+
* last N days), shown as its caption and, when the chart compares, with the change since the N days before. The
|
|
14
|
+
* backend reads the previous window through the same gate as the figure.
|
|
15
|
+
* spec-cite: Stephen Few, "Dashboard Confusion" (2004), https://www.perceptualedge.com/articles/ie/dashboard_confusion.pdf: a dashboard's measures need context, such as a target or a comparison with an earlier period, to say whether they are good or bad.
|
|
10
16
|
* ────────────────────────────────────────────────────────────── */
|
|
11
17
|
import React from 'react';
|
|
12
18
|
import { type AggregationQueryResponse, type ChartDefinition, type ChartTypeConfig_Kpi } from '@wildo-ai/saas-models';
|
|
@@ -19,6 +25,33 @@ import { type AggregationQueryResponse, type ChartDefinition, type ChartTypeConf
|
|
|
19
25
|
export declare function resolveKpiFigure(definition: Pick<ChartDefinition, 'series'>, data: Pick<AggregationQueryResponse, 'data'>): number | null;
|
|
20
26
|
/** The figure written in the reader's locale, as its chart's `chartTypeConfig` says. `null` when there is no value. */
|
|
21
27
|
export declare function formatKpiFigure(value: number | null, config: ChartTypeConfig_Kpi | undefined, formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string): string | null;
|
|
28
|
+
/** The same figure over the period before, when the chart compares (`period.previous`); `null` when there is none. */
|
|
29
|
+
export declare function resolveKpiPreviousFigure(definition: Pick<ChartDefinition, 'series'>, data: Pick<AggregationQueryResponse, 'period'>): number | null;
|
|
30
|
+
/** Whether the figure meets its target: at or above it for {@link ChartKpiTargetDirection.AT_LEAST}, at or below otherwise. */
|
|
31
|
+
export declare function kpiMeetsTarget(value: number, target: NonNullable<ChartTypeConfig_Kpi['target']>): boolean;
|
|
32
|
+
/** Whether a KPI's change since the previous period is good, bad or neither, which colours its line. */
|
|
33
|
+
export declare enum KpiChangeTone {
|
|
34
|
+
/** Towards the side the target's direction calls good. */
|
|
35
|
+
GOOD = "good",
|
|
36
|
+
/** Away from it. */
|
|
37
|
+
BAD = "bad",
|
|
38
|
+
/** No target says which way is good, or nothing changed: shown uncoloured. */
|
|
39
|
+
NEUTRAL = "neutral"
|
|
40
|
+
}
|
|
41
|
+
/** Where a KPI stands against its target. */
|
|
42
|
+
export declare enum KpiTargetVerdict {
|
|
43
|
+
MET = "met",
|
|
44
|
+
MISSED = "missed",
|
|
45
|
+
/** The figure has no value, so it neither meets nor misses the target. */
|
|
46
|
+
UNKNOWN = "unknown"
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether a change is good, bad or neither: decided by the target's direction, the only statement of which way is good.
|
|
50
|
+
* Without a target, or with no change, it is neither, and the change is shown uncoloured.
|
|
51
|
+
*/
|
|
52
|
+
export declare function kpiChangeTone(change: number, target: ChartTypeConfig_Kpi['target']): KpiChangeTone;
|
|
53
|
+
/** Where a figure stands against its target, {@link KpiTargetVerdict.UNKNOWN} when the figure has no value. */
|
|
54
|
+
export declare function kpiTargetVerdict(value: number | null, target: NonNullable<ChartTypeConfig_Kpi['target']>): KpiTargetVerdict;
|
|
22
55
|
export interface ChartKpiFigureProps {
|
|
23
56
|
definition: ChartDefinition;
|
|
24
57
|
data: AggregationQueryResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartKpiFigure.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/chart-view/ChartKpiFigure.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ChartKpiFigure.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/chart-view/ChartKpiFigure.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;oEAeoE;AAEpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAO/B;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAMzI;AAED,uHAAuH;AACvH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,MAAM,EAAE,mBAAmB,GAAG,SAAS,EACvC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,KAAK,MAAM,GAC1E,MAAM,GAAG,IAAI,CAOf;AAED,sHAAsH;AACtH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,CAGnJ;AAED,+HAA+H;AAC/H,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,CAEzG;AAED,wGAAwG;AACxG,oBAAY,aAAa;IACvB,0DAA0D;IAC1D,IAAI,SAAS;IACb,oBAAoB;IACpB,GAAG,QAAQ;IACX,8EAA8E;IAC9E,OAAO,YAAY;CACpB;AAED,6CAA6C;AAC7C,oBAAY,gBAAgB;IAC1B,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,0EAA0E;IAC1E,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,GAAG,aAAa,CAGlG;AAED,+GAA+G;AAC/G,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,GAAG,gBAAgB,CAG3H;AAKD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,eAAe,CAAC;IAC5B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAqDtG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChartKpiValueFormat, } from '@wildo-ai/saas-models';
|
|
3
|
-
import { TypographyVariant } from '@wildo-ai/presets-components-models';
|
|
2
|
+
import { ChartKpiTargetDirection, ChartKpiValueFormat, } from '@wildo-ai/saas-models';
|
|
3
|
+
import { FrontendComponentType, TypographyVariant } from '@wildo-ai/presets-components-models';
|
|
4
4
|
import { cn } from '../../../core/ui/cn.js';
|
|
5
5
|
import { useI18n } from '../../../core/i18n/useI18n.js';
|
|
6
6
|
import { Text } from '../../../components/typography/text.js';
|
|
@@ -29,14 +29,73 @@ export function formatKpiFigure(value, config, formatNumber) {
|
|
|
29
29
|
? formatNumber(value / 100, { style: 'percent', maximumFractionDigits })
|
|
30
30
|
: formatNumber(value, { maximumFractionDigits });
|
|
31
31
|
}
|
|
32
|
+
/** The same figure over the period before, when the chart compares (`period.previous`); `null` when there is none. */
|
|
33
|
+
export function resolveKpiPreviousFigure(definition, data) {
|
|
34
|
+
const previous = data.period?.previous;
|
|
35
|
+
return previous ? resolveKpiFigure(definition, previous) : null;
|
|
36
|
+
}
|
|
37
|
+
/** Whether the figure meets its target: at or above it for {@link ChartKpiTargetDirection.AT_LEAST}, at or below otherwise. */
|
|
38
|
+
export function kpiMeetsTarget(value, target) {
|
|
39
|
+
return target.direction === ChartKpiTargetDirection.AT_LEAST ? value >= target.value : value <= target.value;
|
|
40
|
+
}
|
|
41
|
+
/** Whether a KPI's change since the previous period is good, bad or neither, which colours its line. */
|
|
42
|
+
export var KpiChangeTone;
|
|
43
|
+
(function (KpiChangeTone) {
|
|
44
|
+
/** Towards the side the target's direction calls good. */
|
|
45
|
+
KpiChangeTone["GOOD"] = "good";
|
|
46
|
+
/** Away from it. */
|
|
47
|
+
KpiChangeTone["BAD"] = "bad";
|
|
48
|
+
/** No target says which way is good, or nothing changed: shown uncoloured. */
|
|
49
|
+
KpiChangeTone["NEUTRAL"] = "neutral";
|
|
50
|
+
})(KpiChangeTone || (KpiChangeTone = {}));
|
|
51
|
+
/** Where a KPI stands against its target. */
|
|
52
|
+
export var KpiTargetVerdict;
|
|
53
|
+
(function (KpiTargetVerdict) {
|
|
54
|
+
KpiTargetVerdict["MET"] = "met";
|
|
55
|
+
KpiTargetVerdict["MISSED"] = "missed";
|
|
56
|
+
/** The figure has no value, so it neither meets nor misses the target. */
|
|
57
|
+
KpiTargetVerdict["UNKNOWN"] = "unknown";
|
|
58
|
+
})(KpiTargetVerdict || (KpiTargetVerdict = {}));
|
|
59
|
+
/**
|
|
60
|
+
* Whether a change is good, bad or neither: decided by the target's direction, the only statement of which way is good.
|
|
61
|
+
* Without a target, or with no change, it is neither, and the change is shown uncoloured.
|
|
62
|
+
*/
|
|
63
|
+
export function kpiChangeTone(change, target) {
|
|
64
|
+
if (!target || change === 0)
|
|
65
|
+
return KpiChangeTone.NEUTRAL;
|
|
66
|
+
return (change > 0) === (target.direction === ChartKpiTargetDirection.AT_LEAST) ? KpiChangeTone.GOOD : KpiChangeTone.BAD;
|
|
67
|
+
}
|
|
68
|
+
/** Where a figure stands against its target, {@link KpiTargetVerdict.UNKNOWN} when the figure has no value. */
|
|
69
|
+
export function kpiTargetVerdict(value, target) {
|
|
70
|
+
if (value === null)
|
|
71
|
+
return KpiTargetVerdict.UNKNOWN;
|
|
72
|
+
return kpiMeetsTarget(value, target) ? KpiTargetVerdict.MET : KpiTargetVerdict.MISSED;
|
|
73
|
+
}
|
|
32
74
|
/** The typographic sign for "no value". Not words, so nothing to translate: the figure is simply absent. */
|
|
33
75
|
const NO_VALUE = '—';
|
|
34
76
|
export function ChartKpiFigure({ definition, data, className }) {
|
|
35
|
-
const { formatNumber } = useI18n();
|
|
77
|
+
const { formatNumber, tComponent } = useI18n({ component: FrontendComponentType.HIGH_LEVEL_VIEWS_CHART });
|
|
78
|
+
// The figure's words are the chart component's own labels, read where they live (`components.HIGH_LEVEL_VIEWS_CHART.*`).
|
|
79
|
+
const t = (key, params) => tComponent(FrontendComponentType.HIGH_LEVEL_VIEWS_CHART, key, params);
|
|
36
80
|
const config = definition.chartTypeConfig;
|
|
37
81
|
const value = resolveKpiFigure(definition, data);
|
|
38
82
|
const written = formatKpiFigure(value, config, formatNumber);
|
|
39
83
|
const showProgress = config?.showProgress === true && config.valueFormat === ChartKpiValueFormat.PERCENT && value !== null;
|
|
40
|
-
|
|
84
|
+
const target = config?.target;
|
|
85
|
+
const period = config?.period;
|
|
86
|
+
const previous = period?.comparePrevious ? resolveKpiPreviousFigure(definition, data) : null;
|
|
87
|
+
const change = value !== null && previous !== null ? value - previous : null;
|
|
88
|
+
// The change, signed. A percentage's change is in PERCENTAGE POINTS (42% after 37% is +5 points), written as a number with its
|
|
89
|
+
// own label: written with a percent sign it would read as a relative change (which is 13.5% there).
|
|
90
|
+
const isPercent = config?.valueFormat === ChartKpiValueFormat.PERCENT;
|
|
91
|
+
const writtenChange = change === null ? null : formatNumber(change, { maximumFractionDigits: config?.maximumFractionDigits ?? 0, signDisplay: 'exceptZero' });
|
|
92
|
+
const changeTone = change === null ? KpiChangeTone.NEUTRAL : kpiChangeTone(change, target);
|
|
93
|
+
const targetVerdict = target ? kpiTargetVerdict(value, target) : null;
|
|
94
|
+
const writtenTarget = target ? formatKpiFigure(target.value, config, formatNumber) ?? '' : '';
|
|
95
|
+
return (_jsxs("div", { className: cn('chart-view flex min-w-0 flex-col justify-center gap-element', className), "data-chart-kpi": definition.ref, children: [_jsx(Text, { as: "span", typography: TypographyVariant.DATA, className: "text-3xl font-semibold text-foreground", children: written ?? NO_VALUE }), showProgress && _jsx(Progress, { value: Math.min(100, Math.max(0, value)), "aria-hidden": true, className: "h-1.5" }), period && (_jsx(Text, { as: "span", className: "text-xs text-muted-foreground", children: t('kpiPeriod', { count: period.lengthDays }) })), writtenChange !== null && period && (
|
|
96
|
+
// The words say the change and its sign; the colour only repeats whether it is good, so nothing rests on colour.
|
|
97
|
+
_jsx(Text, { as: "span", className: cn('text-sm', changeTone === KpiChangeTone.GOOD && 'text-success', changeTone === KpiChangeTone.BAD && 'text-destructive', changeTone === KpiChangeTone.NEUTRAL && 'text-muted-foreground'), "data-kpi-change": changeTone, children: t(isPercent ? 'kpiChangeFromPreviousPoints' : 'kpiChangeFromPrevious', { change: writtenChange, count: period.lengthDays }) })), target && targetVerdict && (
|
|
98
|
+
// One label per verdict, so a translation orders the target and the verdict as its language does.
|
|
99
|
+
_jsx(Text, { as: "span", className: cn('text-sm', targetVerdict === KpiTargetVerdict.MET && 'text-success', targetVerdict === KpiTargetVerdict.MISSED && 'text-destructive', targetVerdict === KpiTargetVerdict.UNKNOWN && 'text-muted-foreground'), "data-kpi-target": targetVerdict, children: t(targetVerdict === KpiTargetVerdict.MET ? 'kpiTargetMet' : targetVerdict === KpiTargetVerdict.MISSED ? 'kpiTargetMissed' : 'kpiTarget', { target: writtenTarget }) }))] }));
|
|
41
100
|
}
|
|
42
101
|
//# sourceMappingURL=ChartKpiFigure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartKpiFigure.js","sourceRoot":"","sources":["../../../../../src/components/views/chart-view/ChartKpiFigure.tsx"],"names":[],"mappings":";AAYA,OAAO,EACL,mBAAmB,GAIpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,gDAAgD,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,kDAAkD,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAA2C,EAAE,IAA4C;IACxH,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACpD,MAAM,GAAG,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAC9E,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACjE,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,C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,UAAU,CAAC,GAAG,aAE1H,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,UAAU,EAAE,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAC,wCAAwC,YACnG,OAAO,IAAI,QAAQ,GACf,EAEN,YAAY,IAAI,KAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,uBAAc,SAAS,EAAC,OAAO,GAAG,IACjG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/** ──────────────────────────────────────────────────────────────\n * ChartKpiFigure — a {@link ChartType.KPI} chart drawn as one figure (#2299)\n *\n * A KPI is a chart whose query groups by nothing: the aggregation answers one row, the whole scope's value of its\n * measures, and the chart's one series names the measure that IS the figure. It is fetched, authorized, scoped and\n * feature-gated exactly as every other chart (`ChartView` → `useChartData` → the aggregation gate); only the drawing\n * differs, so a dashboard can put a count, a sum or a rate beside its charts without a second mechanism.\n *\n * Rendered with the engine's typography and progress components, never ECharts: a figure has no axis to draw.\n * ────────────────────────────────────────────────────────────── */\n\nimport React from 'react';\nimport {\n ChartKpiValueFormat,\n type AggregationQueryResponse,\n type ChartDefinition,\n type ChartTypeConfig_Kpi,\n} from '@wildo-ai/saas-models';\nimport { TypographyVariant } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { Text } from '~wildo-frontend-lib/components/typography/text';\nimport { Progress } from '~wildo-frontend-lib/components/feedback/progress';\n\n/**\n * The figure a KPI chart answers: its one series' measure in the one row, or `null` when there is no value (an average,\n * a sum or a minimum of nothing — the aggregation answers `null` there, and a rate over an empty scope too). A count is\n * never `null`: the aggregation answers 0 for an empty scope. A value the wire carries as a numeric string is read as\n * its number; anything else is not a figure.\n */\nexport function resolveKpiFigure(definition: Pick<ChartDefinition, 'series'>, data: Pick<AggregationQueryResponse, 'data'>): number | null {\n const measureRef = definition.series[0]?.measureRef;\n const raw = measureRef === undefined ? undefined : data.data[0]?.[measureRef];\n if (raw === null || raw === undefined || raw === '') return null;\n const value = typeof raw === 'number' ? raw : typeof raw === 'string' ? Number(raw) : Number.NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/** The figure written in the reader's locale, as its chart's `chartTypeConfig` says. `null` when there is no value. */\nexport function formatKpiFigure(\n value: number | null,\n config: ChartTypeConfig_Kpi | undefined,\n formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string,\n): string | null {\n if (value === null) return null;\n const maximumFractionDigits = config?.maximumFractionDigits ?? 0;\n // A PERCENT value is already in percent units (`completed / total * 100`); `Intl` wants the fraction.\n return config?.valueFormat === ChartKpiValueFormat.PERCENT\n ? formatNumber(value / 100, { style: 'percent', maximumFractionDigits })\n : formatNumber(value, { maximumFractionDigits });\n}\n\n/** The typographic sign for \"no value\". Not words, so nothing to translate: the figure is simply absent. */\nconst NO_VALUE = '—';\n\nexport interface ChartKpiFigureProps {\n definition: ChartDefinition;\n data: AggregationQueryResponse;\n className?: string;\n}\n\nexport function ChartKpiFigure({ definition, data, className }: ChartKpiFigureProps): React.JSX.Element {\n const { formatNumber } = useI18n();\n const config = definition.chartTypeConfig as ChartTypeConfig_Kpi | undefined;\n const value = resolveKpiFigure(definition, data);\n const written = formatKpiFigure(value, config, formatNumber);\n const showProgress = config?.showProgress === true && config.valueFormat === ChartKpiValueFormat.PERCENT && value !== null;\n\n return (\n <div className={cn('chart-view flex min-w-0 flex-col justify-center gap-element', className)} data-chart-kpi={definition.ref}>\n {/* The theme's DATA voice: the face and figures a theme gives numbers. */}\n <Text as=\"span\" typography={TypographyVariant.DATA} className=\"text-3xl font-semibold text-foreground\">\n {written ?? NO_VALUE}\n </Text>\n {/* Repeats the figure above as a bar, so it is hidden from assistive technology: the figure already says it. */}\n {showProgress && <Progress value={Math.min(100, Math.max(0, value))} aria-hidden className=\"h-1.5\" />}\n </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AAgB,CAAC,GAAG,IAAI,cAAc,EAAE,aAAa,KAAK,gBAAgB,CAAC,MAAM,IAAI,kBAAkB,EAAE,aAAa,KAAK,gBAAgB,CAAC,OAAO,IAAI,uBAAuB,CAAC,qBACzM,aAAa,YAE7B,CAAC,CAAC,aAAa,KAAK,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,KAAK,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,GAC/J,CACR,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["/** ──────────────────────────────────────────────────────────────\n * ChartKpiFigure — a {@link ChartType.KPI} chart drawn as one figure (#2299)\n *\n * A KPI is a chart whose query groups by nothing: the aggregation answers one row, the whole scope's value of its\n * measures, and the chart's one series names the measure that IS the figure. It is fetched, authorized, scoped and\n * feature-gated exactly as every other chart (`ChartView` → `useChartData` → the aggregation gate); only the drawing\n * differs, so a dashboard can put a count, a sum or a rate beside its charts without a second mechanism.\n *\n * Rendered with the engine's typography and progress components, never ECharts: a figure has no axis to draw.\n *\n * A figure read at a glance carries what it is measured against, or a person cannot tell whether to act. So a KPI may\n * declare a TARGET (a value, and which side of it is good), shown with whether the figure meets it, and a PERIOD (the\n * last N days), shown as its caption and, when the chart compares, with the change since the N days before. The\n * backend reads the previous window through the same gate as the figure.\n * spec-cite: Stephen Few, \"Dashboard Confusion\" (2004), https://www.perceptualedge.com/articles/ie/dashboard_confusion.pdf: a dashboard's measures need context, such as a target or a comparison with an earlier period, to say whether they are good or bad.\n * ────────────────────────────────────────────────────────────── */\n\nimport React from 'react';\nimport {\n ChartKpiTargetDirection,\n ChartKpiValueFormat,\n type AggregationQueryResponse,\n type ChartDefinition,\n type ChartTypeConfig_Kpi,\n} from '@wildo-ai/saas-models';\nimport { FrontendComponentType, TypographyVariant } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { Text } from '~wildo-frontend-lib/components/typography/text';\nimport { Progress } from '~wildo-frontend-lib/components/feedback/progress';\n\n/**\n * The figure a KPI chart answers: its one series' measure in the one row, or `null` when there is no value (an average,\n * a sum or a minimum of nothing — the aggregation answers `null` there, and a rate over an empty scope too). A count is\n * never `null`: the aggregation answers 0 for an empty scope. A value the wire carries as a numeric string is read as\n * its number; anything else is not a figure.\n */\nexport function resolveKpiFigure(definition: Pick<ChartDefinition, 'series'>, data: Pick<AggregationQueryResponse, 'data'>): number | null {\n const measureRef = definition.series[0]?.measureRef;\n const raw = measureRef === undefined ? undefined : data.data[0]?.[measureRef];\n if (raw === null || raw === undefined || raw === '') return null;\n const value = typeof raw === 'number' ? raw : typeof raw === 'string' ? Number(raw) : Number.NaN;\n return Number.isFinite(value) ? value : null;\n}\n\n/** The figure written in the reader's locale, as its chart's `chartTypeConfig` says. `null` when there is no value. */\nexport function formatKpiFigure(\n value: number | null,\n config: ChartTypeConfig_Kpi | undefined,\n formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string,\n): string | null {\n if (value === null) return null;\n const maximumFractionDigits = config?.maximumFractionDigits ?? 0;\n // A PERCENT value is already in percent units (`completed / total * 100`); `Intl` wants the fraction.\n return config?.valueFormat === ChartKpiValueFormat.PERCENT\n ? formatNumber(value / 100, { style: 'percent', maximumFractionDigits })\n : formatNumber(value, { maximumFractionDigits });\n}\n\n/** The same figure over the period before, when the chart compares (`period.previous`); `null` when there is none. */\nexport function resolveKpiPreviousFigure(definition: Pick<ChartDefinition, 'series'>, data: Pick<AggregationQueryResponse, 'period'>): number | null {\n const previous = data.period?.previous;\n return previous ? resolveKpiFigure(definition, previous) : null;\n}\n\n/** Whether the figure meets its target: at or above it for {@link ChartKpiTargetDirection.AT_LEAST}, at or below otherwise. */\nexport function kpiMeetsTarget(value: number, target: NonNullable<ChartTypeConfig_Kpi['target']>): boolean {\n return target.direction === ChartKpiTargetDirection.AT_LEAST ? value >= target.value : value <= target.value;\n}\n\n/** Whether a KPI's change since the previous period is good, bad or neither, which colours its line. */\nexport enum KpiChangeTone {\n /** Towards the side the target's direction calls good. */\n GOOD = 'good',\n /** Away from it. */\n BAD = 'bad',\n /** No target says which way is good, or nothing changed: shown uncoloured. */\n NEUTRAL = 'neutral',\n}\n\n/** Where a KPI stands against its target. */\nexport enum KpiTargetVerdict {\n MET = 'met',\n MISSED = 'missed',\n /** The figure has no value, so it neither meets nor misses the target. */\n UNKNOWN = 'unknown',\n}\n\n/**\n * Whether a change is good, bad or neither: decided by the target's direction, the only statement of which way is good.\n * Without a target, or with no change, it is neither, and the change is shown uncoloured.\n */\nexport function kpiChangeTone(change: number, target: ChartTypeConfig_Kpi['target']): KpiChangeTone {\n if (!target || change === 0) return KpiChangeTone.NEUTRAL;\n return (change > 0) === (target.direction === ChartKpiTargetDirection.AT_LEAST) ? KpiChangeTone.GOOD : KpiChangeTone.BAD;\n}\n\n/** Where a figure stands against its target, {@link KpiTargetVerdict.UNKNOWN} when the figure has no value. */\nexport function kpiTargetVerdict(value: number | null, target: NonNullable<ChartTypeConfig_Kpi['target']>): KpiTargetVerdict {\n if (value === null) return KpiTargetVerdict.UNKNOWN;\n return kpiMeetsTarget(value, target) ? KpiTargetVerdict.MET : KpiTargetVerdict.MISSED;\n}\n\n/** The typographic sign for \"no value\". Not words, so nothing to translate: the figure is simply absent. */\nconst NO_VALUE = '—';\n\nexport interface ChartKpiFigureProps {\n definition: ChartDefinition;\n data: AggregationQueryResponse;\n className?: string;\n}\n\nexport function ChartKpiFigure({ definition, data, className }: ChartKpiFigureProps): React.JSX.Element {\n const { formatNumber, tComponent } = useI18n({ component: FrontendComponentType.HIGH_LEVEL_VIEWS_CHART });\n // The figure's words are the chart component's own labels, read where they live (`components.HIGH_LEVEL_VIEWS_CHART.*`).\n const t = (key: string, params?: Record<string, string | number>) => tComponent(FrontendComponentType.HIGH_LEVEL_VIEWS_CHART, key, params);\n const config = definition.chartTypeConfig as ChartTypeConfig_Kpi | undefined;\n const value = resolveKpiFigure(definition, data);\n const written = formatKpiFigure(value, config, formatNumber);\n const showProgress = config?.showProgress === true && config.valueFormat === ChartKpiValueFormat.PERCENT && value !== null;\n const target = config?.target;\n const period = config?.period;\n const previous = period?.comparePrevious ? resolveKpiPreviousFigure(definition, data) : null;\n const change = value !== null && previous !== null ? value - previous : null;\n // The change, signed. A percentage's change is in PERCENTAGE POINTS (42% after 37% is +5 points), written as a number with its\n // own label: written with a percent sign it would read as a relative change (which is 13.5% there).\n const isPercent = config?.valueFormat === ChartKpiValueFormat.PERCENT;\n const writtenChange = change === null ? null : formatNumber(change, { maximumFractionDigits: config?.maximumFractionDigits ?? 0, signDisplay: 'exceptZero' });\n const changeTone = change === null ? KpiChangeTone.NEUTRAL : kpiChangeTone(change, target);\n const targetVerdict = target ? kpiTargetVerdict(value, target) : null;\n const writtenTarget = target ? formatKpiFigure(target.value, config, formatNumber) ?? '' : '';\n\n return (\n <div className={cn('chart-view flex min-w-0 flex-col justify-center gap-element', className)} data-chart-kpi={definition.ref}>\n {/* The theme's DATA voice: the face and figures a theme gives numbers. */}\n <Text as=\"span\" typography={TypographyVariant.DATA} className=\"text-3xl font-semibold text-foreground\">\n {written ?? NO_VALUE}\n </Text>\n {/* Repeats the figure above as a bar, so it is hidden from assistive technology: the figure already says it. */}\n {showProgress && <Progress value={Math.min(100, Math.max(0, value))} aria-hidden className=\"h-1.5\" />}\n {period && (\n <Text as=\"span\" className=\"text-xs text-muted-foreground\">{t('kpiPeriod', { count: period.lengthDays })}</Text>\n )}\n {writtenChange !== null && period && (\n // The words say the change and its sign; the colour only repeats whether it is good, so nothing rests on colour.\n <Text\n as=\"span\"\n className={cn('text-sm', changeTone === KpiChangeTone.GOOD && 'text-success', changeTone === KpiChangeTone.BAD && 'text-destructive', changeTone === KpiChangeTone.NEUTRAL && 'text-muted-foreground')}\n data-kpi-change={changeTone}\n >\n {t(isPercent ? 'kpiChangeFromPreviousPoints' : 'kpiChangeFromPrevious', { change: writtenChange, count: period.lengthDays })}\n </Text>\n )}\n {target && targetVerdict && (\n // One label per verdict, so a translation orders the target and the verdict as its language does.\n <Text\n as=\"span\"\n className={cn('text-sm', targetVerdict === KpiTargetVerdict.MET && 'text-success', targetVerdict === KpiTargetVerdict.MISSED && 'text-destructive', targetVerdict === KpiTargetVerdict.UNKNOWN && 'text-muted-foreground')}\n data-kpi-target={targetVerdict}\n >\n {t(targetVerdict === KpiTargetVerdict.MET ? 'kpiTargetMet' : targetVerdict === KpiTargetVerdict.MISSED ? 'kpiTargetMissed' : 'kpiTarget', { target: writtenTarget })}\n </Text>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartView.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/chart-view/ChartView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;oEAQoE;AAEpE,OAAO,KAAuC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChartView.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/chart-view/ChartView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;oEAQoE;AAEpE,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAa,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoB/F,OAAO,KAAK,EACV,wBAAwB,EACxB,+BAA+B,EAChC,MAAM,6DAA6D,CAAC;AAYrE,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,kFAAkF;IAClF,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,+BAA+B,CAAC;IACpD,8DAA8D;IAC9D,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,+EAA+E;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,qFAAqF;IACrF,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,aAAa;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAmP9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/** ──────────────────────────────────────────────────────────────
|
|
3
3
|
* ChartView — ECharts-based chart component
|
|
4
4
|
*
|
|
@@ -9,6 +9,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* This file is lazy-loaded via React.lazy() in AppRouter.
|
|
10
10
|
* ────────────────────────────────────────────────────────────── */
|
|
11
11
|
import { useRef, useCallback, useMemo } from 'react';
|
|
12
|
+
import { CHART_VIEW_DEFAULT_HEIGHT } from './chart-view-defaults.js';
|
|
12
13
|
import { ChartType } from '@wildo-ai/saas-models';
|
|
13
14
|
import { FrontendComponentType } from '@wildo-ai/presets-components-models';
|
|
14
15
|
import { useUI } from '../../../core/ui/useUI.js';
|
|
@@ -20,17 +21,21 @@ import { useResolvedChartRuntimeDescriptor } from './chart-runtime.utils.js';
|
|
|
20
21
|
import { useChartTheme, getWildoThemeName } from './chart-theme-bridge.js';
|
|
21
22
|
import { buildDimensionEnumMeta } from './enum-color-bridge.js';
|
|
22
23
|
import { buildEChartsOption } from './option-builder/echarts-option-builder.js';
|
|
24
|
+
import { chartDefinitionLabelKeys, createChartLabelResolver, withSeriesLabelKeys } from './option-builder/builder-utils.js';
|
|
23
25
|
import { ChartLoadingSkeleton } from './ChartLoadingSkeleton.js';
|
|
24
26
|
import { ChartErrorState } from './ChartErrorState.js';
|
|
25
27
|
import { ChartEmptyState } from './ChartEmptyState.js';
|
|
26
28
|
import { ChartKpiFigure } from './ChartKpiFigure.js';
|
|
27
29
|
import { buildResolvedInsertedChartDescriptor, resolveInsertedChartView, } from '../../../core/config/chart-view.frontend.schemas.js';
|
|
28
30
|
import { useResourceRegistry } from '../../../core/resources/useResourceRegistry.js';
|
|
31
|
+
import { FrontendInsertedViewHostKind } from '../../../core/config/inserted-view.frontend.schemas.js';
|
|
32
|
+
import { buildChartMarkLabelKey, buildChartSeriesLabelKey, buildResourceViewTranslationRef } from '../../../core/navigation/view-title-resolution.js';
|
|
29
33
|
// Direct ECharts binding. Replaces `echarts-for-react`, whose `'finished'`-gated
|
|
30
34
|
// double-init hangs on ECharts 6.0.0 (see WildoEChart for the full analysis).
|
|
31
35
|
// ECharts stays behind this file's app-level React.lazy boundary via WildoEChart's
|
|
32
36
|
// static `echarts-setup` import.
|
|
33
37
|
import { WildoEChart } from './WildoEChart.js';
|
|
38
|
+
import { Text } from '../../../components/typography/text.js';
|
|
34
39
|
/**
|
|
35
40
|
* ChartView — renders an ECharts chart from a ChartDefinition.
|
|
36
41
|
*
|
|
@@ -40,11 +45,11 @@ import { WildoEChart } from './WildoEChart.js';
|
|
|
40
45
|
* 3. Build ECharts option from definition + data
|
|
41
46
|
* 4. Render with echarts-for-react
|
|
42
47
|
*/
|
|
43
|
-
export const ChartView = ({ viewRef, document: documentProp, viewDefinition: viewDefinitionProp, runtimeDescriptor, contextResourceIdentifiers, urlParamValues, inputs, className = '', width = '100%', height =
|
|
48
|
+
export const ChartView = ({ viewRef, document: documentProp, viewDefinition: viewDefinitionProp, runtimeDescriptor, contextResourceIdentifiers, urlParamValues, inputs, className = '', width = '100%', height = CHART_VIEW_DEFAULT_HEIGHT, localErrorOnly = false, }) => {
|
|
44
49
|
const { registry } = useResourceRegistry();
|
|
45
50
|
const { getChartStylePreset, isDark } = useUI();
|
|
46
51
|
const chartStylePreset = getChartStylePreset();
|
|
47
|
-
const { t, isReady, resolvedRegionalPreferences } = useI18n({ component: FrontendComponentType.HIGH_LEVEL_VIEWS_CHART });
|
|
52
|
+
const { t, tComponent, isReady, resolvedRegionalPreferences } = useI18n({ component: FrontendComponentType.HIGH_LEVEL_VIEWS_CHART });
|
|
48
53
|
const resizeObserverRef = useRef(null);
|
|
49
54
|
const echartsRef = useRef(null);
|
|
50
55
|
// Register/update chart theme with current style preset
|
|
@@ -66,7 +71,29 @@ export const ChartView = ({ viewRef, document: documentProp, viewDefinition: vie
|
|
|
66
71
|
explicitInputs: inputs,
|
|
67
72
|
urlParamValues,
|
|
68
73
|
});
|
|
69
|
-
const
|
|
74
|
+
const runtimeDefinition = runtime?.chartDefinition;
|
|
75
|
+
/*
|
|
76
|
+
* Each series is named by a LABEL (`resolveSeriesName`): the key the definition names in `nameKey`, else the series'
|
|
77
|
+
* own key under this chart view's label keys, which the labelling pipeline plans beside the chart's title. A chart
|
|
78
|
+
* drawn outside any resource view (a development preview) has no view keys, and its series show their refs.
|
|
79
|
+
*/
|
|
80
|
+
const identity = effectiveRuntimeDescriptor?.identity;
|
|
81
|
+
const seriesTranslationRef = identity?.hostKind === FrontendInsertedViewHostKind.RESOURCE
|
|
82
|
+
? buildResourceViewTranslationRef(identity.hostRef, identity.localRef)
|
|
83
|
+
: undefined;
|
|
84
|
+
const definition = useMemo(() => (runtimeDefinition && seriesTranslationRef
|
|
85
|
+
? withSeriesLabelKeys(runtimeDefinition, (seriesRef) => buildChartSeriesLabelKey(seriesTranslationRef, seriesRef), (markRef) => buildChartMarkLabelKey(seriesTranslationRef, markRef))
|
|
86
|
+
: runtimeDefinition), [runtimeDefinition, seriesTranslationRef]);
|
|
87
|
+
const seriesLabelKeys = useMemo(() => chartDefinitionLabelKeys(definition), [definition]);
|
|
88
|
+
const { isReady: isSeriesLabelsReady } = useI18n({ keys: seriesLabelKeys });
|
|
89
|
+
/*
|
|
90
|
+
* The builders' resolver (`createChartLabelResolver`): a bare ref is a chart component label, any other key a path
|
|
91
|
+
* from the root. The series keys are requested above only so they are loaded before the chart draws; they are read
|
|
92
|
+
* through the same `t`. Rebuilt when they settle, so the legend shows the words rather than the keys.
|
|
93
|
+
*/
|
|
94
|
+
const tChart = useMemo(() => createChartLabelResolver({ tComponent, t }),
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
[tComponent, t, isSeriesLabelsReady]);
|
|
70
97
|
// Fetch chart data
|
|
71
98
|
const { data, loading, error, refetch } = useChartData(definition, runtime?.executionChartRef, runtime?.resolvedInputs, runtime?.contextResourceIdentifiers, urlParamValues, localErrorOnly, resolvedRegionalPreferences.timezone);
|
|
72
99
|
// ResizeObserver for container.
|
|
@@ -140,8 +167,8 @@ export const ChartView = ({ viewRef, document: documentProp, viewDefinition: vie
|
|
|
140
167
|
// A KPI is a figure, not a drawing (#2299): it builds no ECharts option and renders `ChartKpiFigure` below.
|
|
141
168
|
const isKpi = definition?.chartType === ChartType.KPI;
|
|
142
169
|
const option = useMemo(() => (definition && !isKpi && data && data.data.length > 0)
|
|
143
|
-
? buildEChartsOption(definition, data, undefined, chartStylePreset,
|
|
144
|
-
: null, [definition, isKpi, data, chartStylePreset,
|
|
170
|
+
? buildEChartsOption(definition, data, undefined, chartStylePreset, tChart, dimensionEnumMeta, resolvedRegionalPreferences.locale)
|
|
171
|
+
: null, [definition, isKpi, data, chartStylePreset, tChart, dimensionEnumMeta, resolvedRegionalPreferences.locale]);
|
|
145
172
|
// Not found
|
|
146
173
|
if (!definition) {
|
|
147
174
|
return _jsx(ViewNotFound, { viewKind: "chart", viewRef: viewRef });
|
|
@@ -164,23 +191,26 @@ export const ChartView = ({ viewRef, document: documentProp, viewDefinition: vie
|
|
|
164
191
|
if (!option) {
|
|
165
192
|
return _jsx(ChartEmptyState, {});
|
|
166
193
|
}
|
|
167
|
-
if (!isReady || !isResourceLabelsReady)
|
|
194
|
+
if (!isReady || !isResourceLabelsReady || !isSeriesLabelsReady)
|
|
168
195
|
return null;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
196
|
+
// #4084: groups of a resource declaring `auditReads` too small to show carry no figures, and are drawn as no value
|
|
197
|
+
// (`measureValueOrNull`). The line says so, so a missing slice or bar is not read as an empty group.
|
|
198
|
+
const suppressedGroupCount = data?.queryMeta?.suppressedGroupCount ?? 0;
|
|
199
|
+
return (_jsxs("div", { ref: containerRefCallback, className: cn('chart-view', className), style: { width, height, position: 'relative', display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: { flex: 1, minHeight: 0 }, children: _jsx(WildoEChart
|
|
200
|
+
// Remount on dark-mode toggle: the theme name is stable but its content
|
|
201
|
+
// is re-registered, and ECharts bakes the theme at init time.
|
|
202
|
+
, { option: option, theme: getWildoThemeName(), style: { width: '100%', height: '100%' }, notMerge: true,
|
|
203
|
+
// lazyUpdate MUST stay false. With lazyUpdate={true}, ECharts 6 defers
|
|
204
|
+
// the setOption flush to its next animation frame (`_onframe`); ECharts
|
|
205
|
+
// 6.0.0 then crashes on that deferred path for cartesian charts —
|
|
206
|
+
// `CartesianAxisView.render` dereferences `axisModel.axis.axisBuilder
|
|
207
|
+
// .group` while `axisBuilder` is still undefined (ECharts 6 "promoted"
|
|
208
|
+
// axis-element building to the coordinate-system resize stage, but the
|
|
209
|
+
// deferred-flush ordering skips it). Symptom: `TypeError: Cannot read
|
|
210
|
+
// properties of undefined (reading 'group')`. A synchronous flush runs
|
|
211
|
+
// the full resize→render pipeline in order and renders cleanly with
|
|
212
|
+
// animation intact.
|
|
213
|
+
lazyUpdate: false, onChartReady: onChartReady }, isDark ? 'dark' : 'light') }), suppressedGroupCount > 0 && (_jsx(Text, { className: "text-xs text-muted-foreground", children: tComponent(FrontendComponentType.HIGH_LEVEL_VIEWS_CHART, 'suppressedGroupsNotice', { count: suppressedGroupCount }) }))] }));
|
|
184
214
|
};
|
|
185
215
|
export default ChartView;
|
|
186
216
|
//# sourceMappingURL=ChartView.js.map
|