@wildo-ai/saas-frontend-lib 1.1.13 → 1.1.15

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.
Files changed (143) hide show
  1. package/dist/esm/components/ai-elements/meta/agent-wrappers.d.ts +1 -0
  2. package/dist/esm/components/ai-elements/meta/agent-wrappers.d.ts.map +1 -1
  3. package/dist/esm/components/ai-elements/meta/agent-wrappers.js.map +1 -1
  4. package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts +38 -0
  5. package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts.map +1 -0
  6. package/dist/esm/components/compliance/EmbeddedSigningFrame.js +106 -0
  7. package/dist/esm/components/compliance/EmbeddedSigningFrame.js.map +1 -0
  8. package/dist/esm/components/data-display/DisplayValueDispatcher.d.ts.map +1 -1
  9. package/dist/esm/components/data-display/DisplayValueDispatcher.js +17 -1
  10. package/dist/esm/components/data-display/DisplayValueDispatcher.js.map +1 -1
  11. package/dist/esm/components/data-display/ResourceAutomaticDisplayer.d.ts.map +1 -1
  12. package/dist/esm/components/data-display/ResourceAutomaticDisplayer.js +22 -0
  13. package/dist/esm/components/data-display/ResourceAutomaticDisplayer.js.map +1 -1
  14. package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.d.ts.map +1 -1
  15. package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js +5 -2
  16. package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js.map +1 -1
  17. package/dist/esm/components/flows-actors/agent-config.labels.d.ts.map +1 -1
  18. package/dist/esm/components/flows-actors/agent-config.labels.js +2 -0
  19. package/dist/esm/components/flows-actors/agent-config.labels.js.map +1 -1
  20. package/dist/esm/components/flows-actors/approval.d.ts +7 -1
  21. package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
  22. package/dist/esm/components/flows-actors/approval.js +22 -5
  23. package/dist/esm/components/flows-actors/approval.js.map +1 -1
  24. package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
  25. package/dist/esm/components/form/automated/ResourceAutomatedForm.js +20 -1
  26. package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
  27. package/dist/esm/components/form/chromes/FormFieldChrome.js +1 -1
  28. package/dist/esm/components/form/chromes/FormFieldChrome.js.map +1 -1
  29. package/dist/esm/components/form/chromes/field-control-aria.d.ts +8 -1
  30. package/dist/esm/components/form/chromes/field-control-aria.d.ts.map +1 -1
  31. package/dist/esm/components/form/chromes/field-control-aria.js +19 -2
  32. package/dist/esm/components/form/chromes/field-control-aria.js.map +1 -1
  33. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts +5 -0
  34. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts.map +1 -1
  35. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js +6 -2
  36. package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js.map +1 -1
  37. package/dist/esm/components/resources/ResourceCollectionBody_Table.d.ts.map +1 -1
  38. package/dist/esm/components/resources/ResourceCollectionBody_Table.js +8 -1
  39. package/dist/esm/components/resources/ResourceCollectionBody_Table.js.map +1 -1
  40. package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
  41. package/dist/esm/components/resources/ResourceLayout_DangerZone.js +2 -2
  42. package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
  43. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +2 -2
  44. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
  45. package/dist/esm/components/resources/ResourceListItemRenderer.d.ts.map +1 -1
  46. package/dist/esm/components/resources/ResourceListItemRenderer.js +6 -1
  47. package/dist/esm/components/resources/ResourceListItemRenderer.js.map +1 -1
  48. package/dist/esm/components/resources/skeleton/DisplayLayout.js +2 -2
  49. package/dist/esm/components/resources/skeleton/DisplayLayout.js.map +1 -1
  50. package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.d.ts.map +1 -1
  51. package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js +71 -16
  52. package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js.map +1 -1
  53. package/dist/esm/components/sections/surface.d.ts +12 -0
  54. package/dist/esm/components/sections/surface.d.ts.map +1 -1
  55. package/dist/esm/components/sections/surface.js +14 -0
  56. package/dist/esm/components/sections/surface.js.map +1 -1
  57. package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.d.ts.map +1 -1
  58. package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js +3 -2
  59. package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js.map +1 -1
  60. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts +15 -0
  61. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts.map +1 -1
  62. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js +29 -0
  63. package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js.map +1 -1
  64. package/dist/esm/core/app-shell/shell-motion/use-shell-motion.d.ts.map +1 -1
  65. package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js +2 -2
  66. package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js.map +1 -1
  67. package/dist/esm/core/branding/useBrandPresentation.d.ts.map +1 -1
  68. package/dist/esm/core/branding/useBrandPresentation.js +17 -6
  69. package/dist/esm/core/branding/useBrandPresentation.js.map +1 -1
  70. package/dist/esm/core/events/events.frontend.schemas.d.ts +40 -0
  71. package/dist/esm/core/events/events.frontend.schemas.d.ts.map +1 -1
  72. package/dist/esm/core/events/events.frontend.schemas.js +24 -1
  73. package/dist/esm/core/events/events.frontend.schemas.js.map +1 -1
  74. package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.d.ts.map +1 -1
  75. package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js +11 -1
  76. package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js.map +1 -1
  77. package/dist/esm/core/i18n/I18nContext.d.ts.map +1 -1
  78. package/dist/esm/core/i18n/I18nContext.js +8 -2
  79. package/dist/esm/core/i18n/I18nContext.js.map +1 -1
  80. package/dist/esm/core/i18n/component-label-resolution.utils.d.ts.map +1 -1
  81. package/dist/esm/core/i18n/component-label-resolution.utils.js +6 -1
  82. package/dist/esm/core/i18n/component-label-resolution.utils.js.map +1 -1
  83. package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts +0 -15
  84. package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts.map +1 -1
  85. package/dist/esm/core/monitoring/analytics/AnalyticsContext.js +102 -5
  86. package/dist/esm/core/monitoring/analytics/AnalyticsContext.js.map +1 -1
  87. package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.d.ts.map +1 -1
  88. package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js +12 -3
  89. package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js.map +1 -1
  90. package/dist/esm/core/navigation/NavigationContext.d.ts.map +1 -1
  91. package/dist/esm/core/navigation/NavigationContext.js +60 -17
  92. package/dist/esm/core/navigation/NavigationContext.js.map +1 -1
  93. package/dist/esm/core/navigation/launcher-resolution.d.ts +29 -0
  94. package/dist/esm/core/navigation/launcher-resolution.d.ts.map +1 -1
  95. package/dist/esm/core/navigation/launcher-resolution.js +31 -0
  96. package/dist/esm/core/navigation/launcher-resolution.js.map +1 -1
  97. package/dist/esm/core/navigation/navigation-controller-internals.d.ts +48 -0
  98. package/dist/esm/core/navigation/navigation-controller-internals.d.ts.map +1 -1
  99. package/dist/esm/core/navigation/navigation-controller-internals.js +56 -3
  100. package/dist/esm/core/navigation/navigation-controller-internals.js.map +1 -1
  101. package/dist/esm/core/navigation/useNavigationRouterSync.d.ts.map +1 -1
  102. package/dist/esm/core/navigation/useNavigationRouterSync.js +30 -2
  103. package/dist/esm/core/navigation/useNavigationRouterSync.js.map +1 -1
  104. package/dist/esm/core/resources/resource-read-cache.frontend.service.d.ts +6 -1
  105. package/dist/esm/core/resources/resource-read-cache.frontend.service.d.ts.map +1 -1
  106. package/dist/esm/core/resources/resource-read-cache.frontend.service.js +11 -1
  107. package/dist/esm/core/resources/resource-read-cache.frontend.service.js.map +1 -1
  108. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts +44 -0
  109. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts.map +1 -0
  110. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js +63 -0
  111. package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js.map +1 -0
  112. package/dist/esm/core/resources/useOperationDirectExecution.d.ts.map +1 -1
  113. package/dist/esm/core/resources/useOperationDirectExecution.js +45 -6
  114. package/dist/esm/core/resources/useOperationDirectExecution.js.map +1 -1
  115. package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
  116. package/dist/esm/core/runtime/AppRouter.js +18 -1
  117. package/dist/esm/core/runtime/AppRouter.js.map +1 -1
  118. package/dist/esm/core/runtime/ApplicationMainContext.d.ts +1 -1
  119. package/dist/esm/core/runtime/ApplicationMainContext.d.ts.map +1 -1
  120. package/dist/esm/core/runtime/ApplicationMainContext.js +12 -3
  121. package/dist/esm/core/runtime/ApplicationMainContext.js.map +1 -1
  122. package/dist/esm/core/security/UserOrgsContext.d.ts +6 -1
  123. package/dist/esm/core/security/UserOrgsContext.d.ts.map +1 -1
  124. package/dist/esm/core/security/UserOrgsContext.js +87 -10
  125. package/dist/esm/core/security/UserOrgsContext.js.map +1 -1
  126. package/dist/esm/core/security/consent-gate.frontend.utils.d.ts +17 -5
  127. package/dist/esm/core/security/consent-gate.frontend.utils.d.ts.map +1 -1
  128. package/dist/esm/core/security/consent-gate.frontend.utils.js +16 -7
  129. package/dist/esm/core/security/consent-gate.frontend.utils.js.map +1 -1
  130. package/dist/esm/core/security/useConsentGateBehavior.js +1 -1
  131. package/dist/esm/core/security/useConsentGateBehavior.js.map +1 -1
  132. package/dist/esm/core/security/useGrantedConsentPurposes.js +1 -1
  133. package/dist/esm/core/security/useGrantedConsentPurposes.js.map +1 -1
  134. package/dist/esm/core/ui/inner-control-activation.utils.d.ts +16 -0
  135. package/dist/esm/core/ui/inner-control-activation.utils.d.ts.map +1 -0
  136. package/dist/esm/core/ui/inner-control-activation.utils.js +44 -0
  137. package/dist/esm/core/ui/inner-control-activation.utils.js.map +1 -0
  138. package/dist/esm/index.d.ts +1 -0
  139. package/dist/esm/index.d.ts.map +1 -1
  140. package/dist/esm/index.js +1 -0
  141. package/dist/esm/index.js.map +1 -1
  142. package/dist/tsconfig.build.tsbuildinfo +1 -1
  143. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationMainContext.js","sourceRoot":"","sources":["../../../../src/core/runtime/ApplicationMainContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAC;AACjG,OAAO,EAAiC,eAAe,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5H,OAAO,EASL,0BAA0B,GAK3B,MAAM,uBAAuB,CAAC;AAE/B,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,oHAAoH;AACpH,mGAAmG;AACnG,uFAAuF;AACvF,sDAAsD;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qDAAqD,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mEAAmE,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2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AsB,cACrB,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,mBAAmB,CAAC,kBAAkB,YAuBnF,KAAC,gCAAgC,cACjC,KAAC,wBAAwB,cAWrB,KAAC,kBAAkB,cACjB,MAAC,mBAAmB,IAAC,UAAU,EAAE,MAAM,CAAC,UAAU,aAChD,KAAC,oBAAoB,KAAG,EACxB,KAAC,kBAAkB,KAAG,EAQtB,KAAC,wBAAwB,KAAG,EAC5B,KAAC,qBAAqB,KAAG,EAczB,KAAC,OAAO,KAAG,EACX,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,IACd,GACH,GACE,GACQ,GACV,GACJ,GACJ,GACV,GACD,GACM,GACI,GACZ,GACH,CACpB,CAAC;AACJ,CAAC","sourcesContent":["import { withPageApiBaseUrl } from '~wildo-frontend-lib/core/runtime/page-api-base-url.frontend';\nimport { ComponentPresetDefinitionType, CorePresetNames, FrontendComponentType } from '@wildo-ai/presets-components-models';\nimport {\n AppConfiguration_Shared,\n AppConfiguration_Shared_Auth,\n AppConfiguration_Shared_Compliance,\n AppConfiguration_Shared_AppIdentity,\n AppConfiguration_Shared_AppPreferencesLanguage,\n AppConfiguration_Shared_Runtime,\n ResourceConfiguration_InitializationFactory,\n ResourceRelationship,\n mergeFeatureConfigurations,\n type CustomFeatureConfigurationInput,\n type NotificationBadgeDefinition,\n type RolesConfiguration,\n type UserPreferences,\n} from '@wildo-ai/saas-models';\nimport type { AppConfiguration_Frontend } from '~wildo-frontend-lib/core/config/app-configuration-frontend.schemas';\nimport React, { useCallback, useEffect, useState, useRef, useMemo } from 'react';\nimport { createBrowserRouter } from 'react-router';\n// The DOM `RouterProvider` wires `react-dom`'s `flushSync` in; React Router 7 publishes it from the `/dom` subpath.\n// It is rendered WITHOUT `useTransitions`: left undefined, every router state update is wrapped in\n// `React.startTransition`, which is what v6's `future.v7_startTransition` did and what\n// `useSynchronousBrowserLocation` is written against.\nimport { RouterProvider } from 'react-router/dom';\nimport { ErrorBoundary } from '~wildo-frontend-lib/core/errors/ErrorBoundary';\nimport { ErrorProvider } from '~wildo-frontend-lib/core/errors/ErrorContext';\nimport { RouterErrorBoundary } from '~wildo-frontend-lib/core/errors/RouterErrorBoundary';\nimport { ErrorManagementService } from '~wildo-frontend-lib/core/errors/error-management.frontend.service';\nimport { I18nProvider } from '~wildo-frontend-lib/core/i18n/I18nContext';\nimport { LoadingProvider } from '~wildo-frontend-lib/core/loading/LoadingContext';\nimport { AppLoadingGate } from '~wildo-frontend-lib/core/loading/AppLoadingGate';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { WildoBackendHttpClient } from '~wildo-frontend-lib/core/requests/wildo-http-client.frontend.service';\nimport { ResourceRegistryProvider } from '~wildo-frontend-lib/core/resources/ResourceRegistryContext';\nimport { AuthSessionProvider } from '~wildo-frontend-lib/core/security/AuthSessionContext';\nimport { AnonymousSessionProvider } from '~wildo-frontend-lib/core/security/AnonymousSessionContext';\nimport { StepUpAuthProvider } from '~wildo-frontend-lib/core/security/StepUpAuthContext';\nimport { ApplicationRoleTablesProvider } from '~wildo-frontend-lib/core/security/ApplicationRoleTablesContext';\nimport { UserOrgsProvider } from '~wildo-frontend-lib/core/security/UserOrgsContext';\nimport { GlobalErrorHandler } from '~wildo-frontend-lib/core/errors/GlobalErrorHandler';\nimport { AppRouter } from './AppRouter';\nimport { StartupFailureScreen } from './StartupFailureScreen';\nimport { UIProvider } from '~wildo-frontend-lib/core/ui/UIContext';\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport { InitializationStatus, MainContextInitComponents } from './runtime.frontend.schemas';\nimport { ApplicationServices, startApplicationService } from './start-application.frontend.service';\nimport type { GeneratedAppProviderModules } from '@wildo-ai/external-connectors-public/app';\n\nimport { EventBusProvider } from '~wildo-frontend-lib/core/events/EventBusContext';\nimport { NotificationProvider } from '~wildo-frontend-lib/core/events/NotificationContext';\nimport { AppCelebrationOverlay } from '~wildo-frontend-lib/components/feedback/celebration-overlay';\nimport { Toaster } from '~wildo-frontend-lib/components/feedback/toast';\nimport { IconRegistryBridge } from '~wildo-frontend-lib/core/icons/IconRegistryBridge';\nimport { NavigationProvider } from '~wildo-frontend-lib/core/navigation/NavigationContext';\nimport { FlowsActorsProvider } from '~wildo-frontend-lib/core/flows-actors/FlowsActorsContext';\nimport { WebSocketProvider } from '~wildo-frontend-lib/core/requests/websockets/WebSocketContext';\nimport type { FrontendConfigOverrides } from './app-config-overrides.frontend.definitions';\nimport type { ResourceUIBehavior } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { WebSocketEventBridge } from '~wildo-frontend-lib/core/requests/websockets/WebSocketEventBridge';\nimport { ConnectionStatusNotifier } from '~wildo-frontend-lib/core/requests/websockets/ConnectionStatusNotifier';\nimport { RMMWebSocketBridge } from '~wildo-frontend-lib/core/resources/rmm/RMMWebSocketBridge';\nimport { AnalyticsScopeBridge } from '~wildo-frontend-lib/core/monitoring/analytics/AnalyticsScopeBridge';\nimport { ResourceReadCacheBridge } from '~wildo-frontend-lib/core/resources/ResourceReadCacheBridge';\nimport { NotificationBadgeMemoryBoundary } from '~wildo-frontend-lib/core/requests/websockets/useNotificationBadges';\nimport { HotkeyRegistryProvider } from '~wildo-frontend-lib/core/hotkey/HotkeyRegistryContext';\nimport { DefaultHotkeyHandler } from '~wildo-frontend-lib/core/hotkey/DefaultHotkeyHandler';\nimport { HotkeyShortcutsHelpDialog } from '~wildo-frontend-lib/core/hotkey/HotkeyShortcutsHelpDialog';\nimport { AppScopeProvider } from '~wildo-frontend-lib/core/scope/AppScopeContext';\nimport { AppModeProvider } from '~wildo-frontend-lib/core/mode/AppModeContext';\nimport { ScopedResourceRegistryProvider } from '~wildo-frontend-lib/core/resources/ScopedResourceRegistryProvider';\nimport { AnalyticsContextProvider } from '~wildo-frontend-lib/core/monitoring/analytics/AnalyticsContext';\nimport { ConsentBasedProviderSdksProvider } from '~wildo-frontend-lib/core/external-providers/ConsentBasedProviderSdks';\nimport { BillingProvider } from '~wildo-frontend-lib/core/billing/BillingContext';\nimport { BillingErrorNotifier } from '~wildo-frontend-lib/core/billing/BillingErrorNotifier';\nimport { FeaturesProvider } from '~wildo-frontend-lib/core/features/FeaturesContext';\nimport { OrganizationBrandingPublisher } from '~wildo-frontend-lib/core/branding/OrganizationBrandingPublisher';\nimport { GuidanceContextProvider } from '~wildo-frontend-lib/core/guidance/GuidanceContext';\nimport { EphemeralSessionTokenStorage } from '~wildo-frontend-lib/core/security/session-token-storage.frontend.service';\nimport { RMMRegistryProvider } from '~wildo-frontend-lib/core/resources/rmm/RMMRegistryContext';\nimport { LoadingSpinner } from '~wildo-frontend-lib/components/feedback/loading-spinner';\nimport { ApplicationContext } from './ApplicationContext.shared';\nimport { ComponentRegistryService } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.service';\nimport type { ComponentRegistrationRequirement } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.schemas';\nimport { useApplication } from '~wildo-frontend-lib/core/runtime/useApplication';\nimport { useEventBus } from '~wildo-frontend-lib/core/events/useEventBus';\nimport { FrontendEvents, type FrontendEventPayloads } from '~wildo-frontend-lib/core/events/events.frontend.schemas';\n\n\n/**\n * Application Main Context\n * Main provider that wraps all other providers and manages global application state\n */\n\n// Type for merged frontend component variant definitions\nexport type MergedFrontendComponentPresetDefinitions = {\n [K in FrontendComponentType]: ComponentPresetDefinitionType<K>[]\n};\n\nexport interface InitializationApplicationConfig {\n apiBaseUrl: string;\n}\n\nexport interface ApplicationMainProviderOptions {\n /** Browser provider CODE, joined with this service's bootstrap DATA during startup. */\n frontendProviderModules?: GeneratedAppProviderModules;\n apiBaseUrl?: string;\n /**\n * Environment variables from the consuming app.\n * Required because pre-compiled libraries don't have access to import.meta.env.\n * Pass import.meta.env from your app.\n */\n env: Record<string, string | undefined>;\n\n /**\n * Custom shared resources configuration factory map from custom-shared-lib.\n * Required for custom resources to be registered in the frontend ResourceRegistryContext.\n */\n customShared_ResourcesConfigurationsFactoryMap?: { [key: string]: ResourceConfiguration_InitializationFactory<any, any, any> };\n\n /**\n * Custom shared resource field identifiers from custom-shared-lib.\n */\n customShared_ResourceFieldIdentifier?: { [key: string]: string };\n\n /**\n * Custom shared resource relationships from custom-shared-lib.\n */\n customShared_ResourcesRelationships?: ResourceRelationship[];\n\n /**\n * Resource types to leave OUT of the registry, even though the core factory map declares them.\n *\n * Forwarded to `initializeResources`, which has always supported it. An APPLICATION normally passes\n * nothing — it wants the whole core vocabulary — so this exists for the other Wildo frontends: the\n * application-creation workbench observes an application's structure and must not register that\n * application's billing, subscription, milestone, user and organization resources.\n */\n excludedResourceTypes?: ReadonlySet<string>;\n\n /** Feature configuration from custom-shared-lib (merged with core + platform features at runtime) */\n featureConfiguration?: CustomFeatureConfigurationInput;\n\n /**\n * The application's declared custom roles (`sharedRegistry.customRoles`), so every frontend role check decides\n * against the same complete role tables the backend authorizes with (`ApplicationRoleTablesContext`).\n *\n * Required as a KEY, deliberately: with it the shell treats a role neither table knows as inert, as the backend\n * does, so an application that declared custom roles and forgot to pass them would silently hide from those roles'\n * holders the rows and actions they may use. `undefined` states that the application declares none (#2376 review).\n */\n customRoles: RolesConfiguration | undefined;\n\n /** Product catalog definitions from custom-shared-lib */\n productDefinitions?: import('@wildo-ai/saas-models').ProductDefinition[];\n\n /**\n * Final frontend resource configuration preset.\n *\n * Controls how each resource and its operations appear in the frontend:\n * labels, sections, views, empty state, guidance (resource-level) and\n * addressability, sidebar placement, layout presets (operation-level).\n *\n * Apps must pass one already-composed object. In Wonder Todos, the engine\n * module owns the framework base preset and layers any app-shell\n * overrides before the final aggregated module registry reaches startup.\n */\n resourceUIBehavior?: ResourceUIBehavior;\n\n /**\n * App-declared notification badge definitions (R8) — merged with the\n * framework's core definitions in the frontend registry so `NavigationItemBadge`\n * can resolve an app badge. Mirror the backend init config.\n */\n notificationBadgeDefinitions?: NotificationBadgeDefinition[];\n\n /**\n * SHELL COMPANIONS — components the signed-in shell mounts ONCE, for as long as it is on screen,\n * whatever page is open. They render nothing of their own; they exist for application-wide effects\n * that must live exactly as long as the shell does. The case that asked for it: a\n * `FRONTEND_PRODUCED` notification badge, whose producer (`usePublishNotificationBadgeCount`) must be\n * mounted wherever the navigation drawing the badge is, and the navigation is on every page.\n *\n * Mounted inside every provider and inside the consent and document-acceptance gates, so a companion\n * never reads before a person has agreed to what the application does. Not a place for UI: a\n * companion that renders visible content has no layout slot and will land wherever the gate puts it.\n */\n shellCompanions?: readonly React.ComponentType[];\n\n /**\n * Base frontend configuration — provided by the app via the preset layer.\n * No implicit framework defaults: apps must explicitly provide this.\n */\n baseFrontendConfig: AppConfiguration_Frontend;\n\n /** Per-section frontend config overrides (factories or partial values) */\n frontendConfigOverrides?: FrontendConfigOverrides;\n\n /** Component loader — required. Called during app init to register component presets. */\n componentLoader: () => Promise<void>;\n}\n\nexport interface ApplicationMainProviderProps {\n // children: ReactNode;\n options: ApplicationMainProviderOptions;\n}\n\n/**\n * Exact preset dependencies of the two mutually exclusive SaaS shell roots.\n * The full framework completeness audit remains a separate developer tool;\n * startup needs only the components that this composition unconditionally\n * delegates its root layout to.\n */\nconst SAAS_APPLICATION_REQUIRED_COMPONENTS: readonly ComponentRegistrationRequirement[] = [\n {\n componentType: FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER,\n preset: CorePresetNames.DEFAULT,\n },\n {\n componentType: FrontendComponentType.PUBLIC_LAYOUTS_MAIN_CONTAINER,\n preset: CorePresetNames.DEFAULT,\n },\n];\n\n/** Translate SaaS application/event contexts into the focused UI runtime binding. */\nfunction SaaSUIRuntimeProvider({ children }: { children: React.ReactNode }): React.ReactElement {\n const { frontendConfiguration, markComponentInitialized } = useApplication();\n const { on } = useEventBus();\n const subscribeToUserPreferences = useCallback(\n (listener: (preferences: UserPreferences['ui'] | null) => void): (() => void) =>\n on(FrontendEvents.USER_PREFERENCES_CHANGED, (payload: FrontendEventPayloads[FrontendEvents.USER_PREFERENCES_CHANGED]) => {\n /*\n * A payload WITHOUT the key is no news about UI preferences, and must not clear them. The event\n * carries independent fields, each present only when its sender has something to say: a member\n * whose preferences record has no `ui` block (`emitPreferencesChanged` then omits the key) used to\n * reach `UIProvider` as `null` and wipe what the person had set (found by #2242). `null` WITH the\n * key is the sign-out clearing and still clears. Same contract as `I18nContext`'s handler.\n */\n if (!Object.prototype.hasOwnProperty.call(payload, 'uiPreferences')) return;\n listener(payload.uiPreferences ?? null);\n }),\n [on],\n );\n // The current organization's branding in effect (#2306), published from inside the organization and feature contexts.\n const subscribeToOrganizationBranding = useCallback(\n (listener: (branding: { readonly primaryColor: string | null; readonly secondaryColor: string | null; readonly logoUrl: string | null; readonly productName: string | null }) => void): (() => void) =>\n on(FrontendEvents.ORGANIZATION_BRANDING_CHANGED, (payload: FrontendEventPayloads[FrontendEvents.ORGANIZATION_BRANDING_CHANGED]) => {\n listener({ primaryColor: payload.primaryColor ?? null, secondaryColor: payload.secondaryColor ?? null, logoUrl: payload.logoUrl ?? null, productName: payload.productName ?? null });\n }),\n [on],\n );\n const markInitialized = useCallback(\n (): void => markComponentInitialized(MainContextInitComponents.UI),\n [markComponentInitialized],\n );\n return (\n <UIProvider\n frontendConfiguration={frontendConfiguration}\n subscribeToUserPreferences={subscribeToUserPreferences}\n subscribeToOrganizationBranding={subscribeToOrganizationBranding}\n markInitialized={markInitialized}\n >\n {children}\n </UIProvider>\n );\n}\n\ninterface InitializationIssueLike {\n path?: unknown[];\n message?: string;\n}\n\ninterface InitializationUnresolvedForeignKeyLike {\n resourceType?: unknown;\n fieldName?: unknown;\n}\n\ninterface InitializationDiagnosticsLike {\n phase?: unknown;\n apiBaseUrl?: unknown;\n frontendServiceName?: unknown;\n errorName?: unknown;\n errorMessage?: unknown;\n stack?: unknown;\n causeMessage?: unknown;\n wildoError?: unknown;\n}\n\ninterface FormattedInitializationError {\n title: string;\n description: string;\n highlights: string[];\n technicalDetails: string;\n remainingIssueCount: number;\n contextRows: Array<{ label: string; value: string }>;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction formatUnknownValue(value: unknown): string {\n if (typeof value === 'string') {\n return value;\n }\n\n if (value instanceof Error) {\n return value.message;\n }\n\n if (value === undefined) {\n return 'undefined';\n }\n\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n\n/**\n * invented-display-text: the STARTUP-FAILURE screen, which renders because initialization did not\n * complete — so the label bundle is precisely what is not available. Every label beside this one is\n * a literal ('Application', 'Failed step', 'Frontend service') for the same reason, and this file\n * imports no `useI18n`. A diagnostic that needs the thing that failed is not a diagnostic.\n */\n// invented-display-text: startup-failure screen — see above.\nfunction titleCaseFromIdentifier(value: string): string {\n return value\n .split(/[\\s_-]+/)\n .filter(Boolean)\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(' ');\n}\n\nfunction formatInitializationPhase(phase: unknown): string | undefined {\n if (typeof phase !== 'string' || phase.trim().length === 0) {\n return undefined;\n }\n\n // invented-display-text: startup-failure screen — see `titleCaseFromIdentifier`.\n return titleCaseFromIdentifier(phase.trim());\n}\n\nfunction extractInitializationDiagnostics(rawError: unknown): InitializationDiagnosticsLike | undefined {\n if (!isRecord(rawError) || !isRecord(rawError.initializationDiagnostics)) {\n return undefined;\n }\n\n return rawError.initializationDiagnostics;\n}\n\nfunction extractWildoError(rawError: unknown, diagnostics?: InitializationDiagnosticsLike): Record<string, unknown> | undefined {\n if (diagnostics && isRecord(diagnostics.wildoError)) {\n return diagnostics.wildoError;\n }\n\n if (isRecord(rawError) && isRecord(rawError.wildoError)) {\n return rawError.wildoError;\n }\n\n return undefined;\n}\n\nfunction extractInitializationIssueArray(candidate: unknown): InitializationIssueLike[] | null {\n if (typeof candidate !== 'string') {\n return null;\n }\n\n try {\n const parsed = JSON.parse(candidate) as unknown;\n if (!Array.isArray(parsed)) {\n return null;\n }\n\n const issues = parsed.filter(\n (issue): issue is InitializationIssueLike =>\n typeof issue === 'object' && issue !== null,\n );\n\n return issues.length > 0 ? issues : null;\n } catch {\n return null;\n }\n}\n\nfunction extractPrimaryInitializationMessage(\n rawError: unknown,\n diagnostics?: InitializationDiagnosticsLike,\n wildoError?: Record<string, unknown>,\n): string {\n if (diagnostics && typeof diagnostics.errorMessage === 'string' && diagnostics.errorMessage.trim().length > 0) {\n return diagnostics.errorMessage;\n }\n\n if (wildoError && isRecord(wildoError.context) && typeof wildoError.context.message === 'string') {\n return wildoError.context.message;\n }\n\n if (rawError instanceof Error) {\n return rawError.message;\n }\n\n if (typeof rawError === 'string') {\n return rawError;\n }\n\n return formatUnknownValue(rawError);\n}\n\nfunction buildInitializationHighlights(wildoContext: Record<string, unknown> | undefined): string[] {\n if (!wildoContext) {\n return [];\n }\n\n const highlights: string[] = [];\n\n if (Array.isArray(wildoContext.unresolvedFKFields)) {\n for (const entry of wildoContext.unresolvedFKFields as InitializationUnresolvedForeignKeyLike[]) {\n const resourceType = typeof entry?.resourceType === 'string' ? entry.resourceType : 'unknown-resource';\n const fieldName = typeof entry?.fieldName === 'string' ? entry.fieldName : 'unknown-field';\n highlights.push(`${resourceType}.${fieldName}: foreign key cannot be resolved to a resource type`);\n }\n }\n\n if (typeof wildoContext.message === 'string') {\n const lines = wildoContext.message\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0 && !line.startsWith('[ResourcesRegistry]') && !line.startsWith('Fix:'));\n\n for (const line of lines) {\n if (line.startsWith('- ')) {\n highlights.push(line.slice(2));\n } else if (!highlights.includes(line)) {\n highlights.push(line);\n }\n }\n }\n\n const contextualEntries: Array<[string, unknown]> = [\n ['Resource type', wildoContext.resourceType],\n ['Foreign key field', wildoContext.foreignKeyField],\n ['Method', wildoContext.method],\n ['Existing type', wildoContext.existingType],\n ['New type', wildoContext.newType],\n ];\n\n for (const [label, value] of contextualEntries) {\n if (typeof value === 'string' && value.trim().length > 0) {\n highlights.push(`${label}: ${value}`);\n }\n }\n\n return Array.from(new Set(highlights)).slice(0, 6);\n}\n\nfunction buildInitializationContextRows(params: {\n diagnostics?: InitializationDiagnosticsLike;\n wildoError?: Record<string, unknown>;\n startupAppName: string;\n}): Array<{ label: string; value: string }> {\n const rows: Array<{ label: string; value: string }> = [\n { label: 'Application', value: params.startupAppName },\n ];\n\n const phase = formatInitializationPhase(params.diagnostics?.phase);\n if (phase) {\n rows.push({ label: 'Failed step', value: phase });\n }\n\n if (typeof params.diagnostics?.frontendServiceName === 'string' && params.diagnostics.frontendServiceName.trim().length > 0) {\n rows.push({ label: 'Frontend service', value: params.diagnostics.frontendServiceName });\n }\n\n if (typeof params.diagnostics?.apiBaseUrl === 'string' && params.diagnostics.apiBaseUrl.trim().length > 0) {\n rows.push({ label: 'API base URL', value: params.diagnostics.apiBaseUrl });\n }\n\n if (typeof params.wildoError?.customMessageReference === 'string' && params.wildoError.customMessageReference.trim().length > 0) {\n rows.push({ label: 'Error reference', value: params.wildoError.customMessageReference });\n }\n\n if (typeof params.wildoError?.type === 'string' && params.wildoError.type.trim().length > 0) {\n rows.push({ label: 'Error type', value: params.wildoError.type });\n }\n\n return rows;\n}\n\nfunction formatInitializationIssuePath(path: unknown[] | undefined): string {\n if (!path || path.length === 0) {\n return 'root';\n }\n\n return path\n .map((segment) => typeof segment === 'string' ? segment : String(segment))\n .join(' > ');\n}\n\nfunction formatInitializationError(rawError: unknown, startupAppName: string): FormattedInitializationError {\n const diagnostics = extractInitializationDiagnostics(rawError);\n const wildoError = extractWildoError(rawError, diagnostics);\n const primaryMessage = extractPrimaryInitializationMessage(rawError, diagnostics, wildoError);\n const issueArray = extractInitializationIssueArray(primaryMessage);\n const technicalDetails = formatUnknownValue(\n diagnostics ? {\n ...diagnostics,\n rawError: rawError instanceof Error ? {\n name: rawError.name,\n message: rawError.message,\n stack: rawError.stack,\n } : rawError,\n } : rawError,\n );\n\n if (issueArray) {\n const highlights = issueArray.slice(0, 6).map((issue) => {\n const location = formatInitializationIssuePath(issue.path);\n const message = issue.message ?? 'Invalid configuration value';\n return `${location}: ${message}`;\n });\n\n return {\n title: 'Application configuration is invalid',\n description: `Startup stopped because the frontend configuration failed validation in ${issueArray.length} place${issueArray.length === 1 ? '' : 's'}.`,\n highlights,\n technicalDetails: JSON.stringify(issueArray, null, 2),\n remainingIssueCount: Math.max(issueArray.length - highlights.length, 0),\n contextRows: buildInitializationContextRows({ diagnostics, wildoError, startupAppName }),\n };\n }\n\n const wildoContext = wildoError && isRecord(wildoError.context) ? wildoError.context : undefined;\n const highlights = buildInitializationHighlights(wildoContext);\n const phase = formatInitializationPhase(diagnostics?.phase);\n const shouldTreatAsConfigurationError = primaryMessage === 'configuration'\n || typeof wildoError?.customMessageReference === 'string' && wildoError.customMessageReference === 'configuration';\n\n const descriptionParts = [\n phase ? `Startup stopped during ${phase}.` : undefined,\n primaryMessage && primaryMessage !== 'configuration' ? primaryMessage : undefined,\n !primaryMessage || primaryMessage === 'configuration'\n ? 'Open the technical details to inspect the full startup diagnostics.'\n : undefined,\n ].filter((part): part is string => Boolean(part));\n\n return {\n title: shouldTreatAsConfigurationError ? 'Application configuration is invalid' : 'Application initialization failed',\n description: descriptionParts.join(' '),\n highlights,\n technicalDetails,\n remainingIssueCount: 0,\n contextRows: buildInitializationContextRows({ diagnostics, wildoError, startupAppName }),\n };\n}\n\n// ApplicationMainProvider component - exported directly for Fast Refresh compatibility\nexport function ApplicationMainProvider({\n // children,\n options,\n}: ApplicationMainProviderProps): React.ReactElement {\n const mergedFeatureConfiguration = useMemo(\n () => mergeFeatureConfigurations(options.featureConfiguration),\n [options.featureConfiguration]\n );\n\n const logger = useMemo(() => LoggerFrontendService.getLogger(), []);\n const logDebug = useMemo(() => {\n const debugFn = logger.debugByType('ApplicationMainContext');\n logger.setDebugTypeLogging('ApplicationMainContext', false); // Enable debug logging for initialization\n return debugFn;\n }, [logger]);\n\n const [isInitialized, setIsInitialized] = useState(false);\n const [initError, setInitError] = useState<unknown | null>(null);\n const [applicationServices, setApplicationServices] = useState<ApplicationServices | null>(null);\n const [config, setConfig] = useState<InitializationApplicationConfig | null>(null);\n const [initializationStatus, setInitializationStatus] = useState<InitializationStatus>({\n [MainContextInitComponents.MAIN_CONTEXT]: false,\n [MainContextInitComponents.UI]: false,\n [MainContextInitComponents.LOADER]: false,\n [MainContextInitComponents.ERRORS]: false,\n [MainContextInitComponents.ROUTER]: false,\n [MainContextInitComponents.I18N]: false,\n [MainContextInitComponents.APP_MAIN_CONTAINER]: false,\n [MainContextInitComponents.PUBLIC_APP_CONTAINER]: false\n });\n\n\n const checkAllComponentsInitialized = useCallback((status: InitializationStatus): boolean => {\n // Required: main context, UI, and the two root shell containers.\n return status[MainContextInitComponents.MAIN_CONTEXT] &&\n status[MainContextInitComponents.UI] &&\n status[MainContextInitComponents.APP_MAIN_CONTAINER] &&\n status[MainContextInitComponents.PUBLIC_APP_CONTAINER];\n }, []);\n\n // Function to mark components as initialized\n const markComponentInitialized = useCallback((component: MainContextInitComponents) => {\n setInitializationStatus(prev => {\n const newStatus = { ...prev, [component]: true };\n\n // Debug logging for initialization tracking\n const missingComponents = Object.entries(newStatus)\n .filter(([_, isInit]) => !isInit)\n .map(([name]) => name);\n\n logDebug(`Component initialized: ${component}`, {\n newStatus,\n allComponentsReady: checkAllComponentsInitialized(newStatus),\n missingComponents\n });\n\n // Check if all required components are initialized\n if (checkAllComponentsInitialized(newStatus)) {\n logDebug('All components initialized, setting isInitialized=true');\n setIsInitialized(true);\n }\n\n return newStatus;\n });\n }, [checkAllComponentsInitialized, logDebug]);\n\n // Track initialization to prevent re-initialization on hot reload\n const initializationStartedRef = useRef(false);\n\n // Track if initialization has already failed to prevent retry loops\n const initializationFailedRef = useRef(false);\n\n // Holds the single browser router instance (created once, after the bootstrap\n // gate below). Declared here at the top so the hook call is unconditional —\n // the actual creation happens past the `!applicationServices` early return,\n // where it must NOT be a hook. See the create-once comment at the router site.\n const routerRef = useRef<ReturnType<typeof createBrowserRouter> | null>(null);\n\n const startupAppName = useMemo(\n () => {\n const candidate = options.env.VITE_APP_NAME?.trim();\n return candidate && candidate.length > 0 ? candidate : 'Application';\n },\n [options.env],\n );\n const formattedInitError = useMemo(\n () => initError ? formatInitializationError(initError, startupAppName) : null,\n [initError, startupAppName],\n );\n\n useEffect(() => {\n logDebug('useEffect triggered', {\n initializationStartedRef: initializationStartedRef.current,\n initializationFailedRef: initializationFailedRef.current,\n hasApplicationServices: !!applicationServices,\n isInitialized,\n currentInitializationStatus: initializationStatus\n });\n\n // If services exist but initialization status wasn't set, restore it\n // This happens on hot reload when the component remounts but services are already initialized\n if (applicationServices && !isInitialized) {\n logDebug('Services exist but not initialized, restoring core components');\n markComponentInitialized(MainContextInitComponents.MAIN_CONTEXT);\n markComponentInitialized(MainContextInitComponents.LOADER);\n markComponentInitialized(MainContextInitComponents.ERRORS);\n markComponentInitialized(MainContextInitComponents.ROUTER);\n\n // On hot reload: Mark container components as initialized\n // They will mark themselves when rendered, but we need to allow rendering to proceed\n // This is safe because markComponentInitialized is idempotent and components will\n // call it again when they render, ensuring the status stays correct\n markComponentInitialized(MainContextInitComponents.APP_MAIN_CONTAINER);\n markComponentInitialized(MainContextInitComponents.PUBLIC_APP_CONTAINER);\n\n logDebug('Marked container components for hot reload (they will re-mark themselves when rendered)');\n return;\n }\n\n // Prevent re-initialization if already started or failed\n if (initializationStartedRef.current || initializationFailedRef.current) {\n logDebug('Skipping initialization (already started/failed)');\n\n // If already failed, don't retry automatically\n if (initializationFailedRef.current && !initError) {\n setInitError('Initialization previously failed. Click Retry to try again.');\n }\n return;\n }\n\n\n const initializeApp = async () => {\n // Mark initialization as started immediately\n initializationStartedRef.current = true;\n try {\n // Initialize global error handlers (must be done early)\n ErrorManagementService.initializeGlobalErrorHandlers();\n\n // Inject env vars from the consuming app (required for pre-compiled libraries). On an organization's custom\n // domain (#2974) the API is served on the page's own host, so every client reading the loader calls it there.\n envLoader.injectEnvironmentVariables(withPageApiBaseUrl(options.env, window.location));\n\n const envConfig = envLoader.loadEnvironmentConfig();\n\n const finalConfig: InitializationApplicationConfig = {\n apiBaseUrl: options.apiBaseUrl ?? envConfig.apiBaseUrl,\n };\n\n setConfig(finalConfig);\n\n const services = await startApplicationService.initializeApplication({\n config: finalConfig,\n autoAuth: false,\n frontendProviderModules: options.frontendProviderModules,\n customShared_ResourcesConfigurationsFactoryMap: options.customShared_ResourcesConfigurationsFactoryMap,\n customShared_ResourceFieldIdentifier: options.customShared_ResourceFieldIdentifier,\n customShared_ResourcesRelationships: options.customShared_ResourcesRelationships,\n excludedResourceTypes: options.excludedResourceTypes,\n resourceUIBehavior: options.resourceUIBehavior,\n notificationBadgeDefinitions: options.notificationBadgeDefinitions,\n baseFrontendConfig: options.baseFrontendConfig,\n frontendConfigOverrides: options.frontendConfigOverrides,\n featureConfiguration: mergedFeatureConfiguration,\n componentLoader: async () => {\n await options.componentLoader();\n // Keep the strict host gate inside the component-registration\n // startup phase. A missing shell preset therefore prevents the\n // service's success callback as well as every React child mount.\n ComponentRegistryService.assertRequiredRegistrations(\n 'SaaS application',\n SAAS_APPLICATION_REQUIRED_COMPONENTS,\n );\n },\n onInitialized: () => {\n logDebug('Application initialized successfully');\n },\n onError: (error: Error) => {\n logger.error('Application initialization failed', { error: error.message, details: error });\n setInitError(error);\n }\n });\n\n // The startup service has a legitimate already-initialized fast path\n // that does not call the loader again. Re-assert before publishing its\n // services so HMR/remount paths retain the same fail-closed guarantee.\n ComponentRegistryService.assertRequiredRegistrations(\n 'SaaS application',\n SAAS_APPLICATION_REQUIRED_COMPONENTS,\n );\n\n setApplicationServices(services);\n\n // Mark main context and core components as initialized\n markComponentInitialized(MainContextInitComponents.MAIN_CONTEXT);\n markComponentInitialized(MainContextInitComponents.LOADER);\n markComponentInitialized(MainContextInitComponents.ERRORS);\n markComponentInitialized(MainContextInitComponents.ROUTER);\n // Note: I18N will be marked as initialized by I18nProvider when translations are loaded\n // TODO: PUBLIC_APP_CONTAINER will be marked by its component when created\n\n // In cases where the underlying service was already initialized\n // (e.g., HMR/StrictMode), the onInitialized callback may not fire.\n // Note: Don't set isInitialized here anymore - wait for all components\n\n } catch (error) {\n // Mark as failed to prevent retry loops\n initializationFailedRef.current = true;\n\n const errorMessage = error instanceof Error ? error.message : 'Unknown initialization error';\n setInitError(error);\n logger.error('Application initialization failed', { error: errorMessage, details: error });\n }\n };\n\n initializeApp();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // logDebug and logger are stable references, markComponentInitialized is memoized\n }, [options, applicationServices, isInitialized]);\n\n // Manual retry handler - resets failed state and reloads the page\n const handleManualRetry = useCallback(() => {\n // Reset the failed state before reloading to allow a fresh initialization attempt\n initializationFailedRef.current = false;\n initializationStartedRef.current = false;\n window.location.reload();\n }, []);\n\n // W7.3b: Detect one-off session entry at mount time.\n // When the tab opens on a one-off URL, AuthSessionProvider uses ephemeral (in-memory)\n // storage so the persistent session in other tabs is never touched.\n // The ref captures the initial URL — subsequent navigations within the same tab\n // (e.g., after the exchange redirects to home) do not change the storage strategy.\n // IMPORTANT: Must be above early returns to satisfy Rules of Hooks.\n const isOneOffSessionEntryRef = useRef(\n window.location.pathname.startsWith('/one-off-session/')\n );\n const sessionTokenStorage = useMemo(\n () => isOneOffSessionEntryRef.current ? new EphemeralSessionTokenStorage() : undefined,\n []\n );\n\n // Handle initialization error - early return before any providers (plain Tailwind, no useUI)\n if (initError && formattedInitError) {\n // OUTSIDE DEVELOPMENT a person gets a generic screen and a retry, and nothing derived from the failure:\n // no error-derived headline, no configuration issues, no context rows, no diagnostics JSON, no stack.\n // The full diagnostics are already in the logger (see the initialization catch above), which is where\n // OWASP's Error Handling guidance puts them. The card below stays for developers (#1181).\n //\n // The mode is read WITHOUT loading the configuration (`readEnvironmentMode`, not `isDevelopment`): a\n // missing or invalid `VITE_*` variable is one of the failures this very branch exists to report, and\n // `isDevelopment()` would re-throw it mid-render — there is no error boundary above this provider, so\n // the failure screen would become a blank page.\n //\n // The predicate is `=== 'development'` rather than `!isProduction()`, deliberately: `staging` and\n // `test` are hosts that real people reach, and OWASP's guidance is about who is LOOKING, not about how\n // the deployment is labelled. Only a developer's own machine gets the diagnostics. An unestablished\n // mode falls on the same side — unknown is not development.\n if (envLoader.readEnvironmentMode() !== 'development') {\n return <StartupFailureScreen onRetry={handleManualRetry} />;\n }\n\n return (\n <div className=\"min-h-screen w-screen bg-background px-6 py-10 md:px-10\">\n <div className=\"mx-auto flex min-h-[calc(100vh-5rem)] max-w-5xl items-center justify-center\">\n <div\n role=\"alert\"\n className=\"w-full overflow-hidden rounded-2xl border border-border bg-card shadow-sm\"\n >\n <div className=\"border-b border-border bg-muted/40 px-6 py-5 md:px-8\">\n <div className=\"flex items-start gap-4\">\n <div className=\"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-destructive/12 text-xl text-destructive\">\n !\n </div>\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium uppercase tracking-wide text-destructive\">\n Initialization failed\n </p>\n <h1 className=\"mt-1 text-2xl font-semibold text-foreground\">\n {formattedInitError.title}\n </h1>\n <p className=\"mt-2 max-w-3xl text-sm leading-6 text-muted-foreground\">\n {formattedInitError.description}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"space-y-6 px-6 py-6 md:px-8\">\n {formattedInitError.contextRows.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {formattedInitError.contextRows.map((row) => (\n <div\n key={`${row.label}:${row.value}`}\n className=\"rounded-xl border border-border bg-muted/20 px-4 py-3\"\n >\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-muted-foreground\">\n {row.label}\n </p>\n <p className=\"mt-1 break-all font-mono text-xs leading-5 text-foreground\">\n {row.value}\n </p>\n </div>\n ))}\n </div>\n ) : null}\n\n {formattedInitError.highlights.length > 0 ? (\n <div className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n What needs attention\n </h2>\n <div className=\"grid gap-2\">\n {formattedInitError.highlights.map((highlight) => (\n <div\n key={highlight}\n className=\"rounded-lg border border-border bg-muted/30 px-3 py-2 font-mono text-xs leading-5 text-foreground\"\n >\n {highlight}\n </div>\n ))}\n </div>\n {formattedInitError.remainingIssueCount > 0 ? (\n <p className=\"text-xs text-muted-foreground\">\n And {formattedInitError.remainingIssueCount} more issue{formattedInitError.remainingIssueCount === 1 ? '' : 's'} in the technical details below.\n </p>\n ) : null}\n </div>\n ) : null}\n\n <div className=\"rounded-xl border border-border bg-muted/20 p-4\">\n <p className=\"text-sm text-muted-foreground\">\n The application will not automatically retry. Fix the underlying issue, then reload the app to start a fresh initialization attempt.\n </p>\n <div className=\"mt-4 flex flex-wrap gap-3\">\n <button\n onClick={handleManualRetry}\n className=\"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90\"\n >\n Retry initialization\n </button>\n </div>\n </div>\n\n <details className=\"group rounded-xl border border-border bg-background\">\n <summary className=\"cursor-pointer list-none px-4 py-3 text-sm font-medium text-foreground\">\n <span className=\"group-open:hidden\">Show technical details</span>\n <span className=\"hidden group-open:inline\">Hide technical details</span>\n </summary>\n <div className=\"border-t border-border px-4 py-4\">\n <pre className=\"max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/30 p-4 font-mono text-xs leading-5 text-foreground\">\n {formattedInitError.technicalDetails}\n </pre>\n </div>\n </details>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n // Handle bootstrap loading before the provider tree can safely mount.\n // Once services/config exist, render the full tree so UIProvider and the shell\n // containers can complete their own initialization work and report readiness.\n if (!applicationServices || !config) {\n const missingComponents = Object.entries(initializationStatus)\n .filter(([_, isInit]) => !isInit)\n .map(([name]) => name);\n\n logDebug('Still loading', {\n isInitialized,\n hasApplicationServices: !!applicationServices,\n hasConfig: !!config,\n initializationStatus,\n missingComponents\n });\n\n // Pre-bootstrap loader (config/services not ready yet). Intentionally the\n // SAME minimal presentation as the Tier-1 `AppLoadingGate` \"simple loading\"\n // overlay — a centered, recipe-coloured `LoadingSpinner` on `bg-background`,\n // with no card chrome / circular badge / forced `text-primary`. The earlier\n // bespoke card duplicated the spinner SVG and hardcoded the primary colour,\n // so the very first paint looked unlike every subsequent loading state.\n return (\n <div className=\"flex min-h-screen w-screen items-center justify-center bg-background\">\n <LoadingSpinner size={48} />\n </div>\n );\n }\n\n // Route element - contains providers specific to the main app content\n // NavigationProvider must be inside RouterProvider (needs useNavigate) but wraps content\n // Note: ResourceRegistryProvider is moved outside router to wrap WebSocketEventBridge\n // AuthSessionProvider manages auth/session/WebSocket, AppScopeProvider owns primary/custom scope,\n // and UserOrgsProvider consumes AppScope for its org-facing facade APIs.\n // GlobalErrorHandler subscribes to ERROR_OCCURED events and handles auth errors (logout)\n const routeElement = (\n <ErrorBoundary>\n <LoadingProvider>\n <AppLoadingGate>\n <AnonymousSessionProvider>\n <AuthSessionProvider tokenStorage={sessionTokenStorage}>\n {/* GlobalErrorHandler must be inside AuthSessionProvider to access logout */}\n <GlobalErrorHandler />\n <StepUpAuthProvider>\n {/* AppScopeProvider manages primary + custom scope state */}\n <AppScopeProvider>\n {/* Cache coverage must observe the same organization scope as the routed application. */}\n <ResourceReadCacheBridge />\n {/* Remembered badge counts end where the user or organization changes, as cached reads do. */}\n <NotificationBadgeMemoryBoundary />\n <AnalyticsScopeBridge />\n <ApplicationRoleTablesProvider customRoles={options.customRoles}>\n <UserOrgsProvider>\n {/* AppModeProvider manages active mode — inside scope, wraps billing */}\n <AppModeProvider>\n <BillingProvider productDefinitions={options.productDefinitions}>\n <BillingErrorNotifier />\n <FeaturesProvider featureConfiguration={mergedFeatureConfiguration}>\n <OrganizationBrandingPublisher />\n <ScopedResourceRegistryProvider>\n <GuidanceContextProvider>\n <FlowsActorsProvider>\n <NavigationProvider>\n {/* DefaultHotkeyHandler registers application-level keyboard shortcuts */}\n <DefaultHotkeyHandler />\n <HotkeyShortcutsHelpDialog />\n <AppRouter />\n </NavigationProvider>\n </FlowsActorsProvider>\n </GuidanceContextProvider>\n </ScopedResourceRegistryProvider>\n </FeaturesProvider>\n </BillingProvider>\n </AppModeProvider>\n </UserOrgsProvider>\n </ApplicationRoleTablesProvider>\n </AppScopeProvider>\n </StepUpAuthProvider>\n </AuthSessionProvider>\n </AnonymousSessionProvider>\n </AppLoadingGate>\n </LoadingProvider>\n </ErrorBoundary>\n );\n\n // Create the router exactly ONCE, then reuse it across re-renders.\n //\n // `createBrowserRouter` must never run in render: a fresh router instance makes\n // `RouterProvider` remount the ENTIRE route tree (every provider below,\n // including `NavigationProvider`), discarding their state. During bootstrap\n // `ApplicationMainProvider` re-renders several times (services set, config set,\n // primary scope resolving async on deep-link), so an in-render router recreated\n // the whole tree each wave — wiping navigation/overlay state established from\n // the URL. That is why a cold deep-link to an overlay-reconstructed surface\n // (e.g. `/settings`) lost its overlay while in-session navigation (no further\n // re-renders) kept it. This code path is reached only after the\n // `!applicationServices || !config` gate above, and `routeElement`'s only props\n // (`sessionTokenStorage`, `options.productDefinitions`, `mergedFeatureConfiguration`)\n // are all stable post-init, so capturing the route element once is correct.\n // `routerRef` is declared at the top of the component (unconditional hook);\n // here we only populate it, which is safe after the bootstrap early-return.\n if (routerRef.current === null) {\n // React Router 7 made every v6 `future.v7_*` flag (relative splat paths, fetcher persistence,\n // upper-case form methods, partial hydration, no revalidation after an action error) its fixed\n // behaviour, so the router takes no future flags: this app opted into all five while on v6.\n routerRef.current = createBrowserRouter([\n { path: '/*', element: routeElement, errorElement: <RouterErrorBoundary /> }\n ]);\n }\n const router = routerRef.current;\n\n // Wrap RouterProvider with providers that both route element and error boundary need.\n // This ensures RouterErrorBoundary has access to I18nProvider, IconRegistryProvider, etc.\n // ResourceRegistryProvider must wrap WebSocketEventBridge since it uses useResourceRegistry()\n return (\n <EventBusProvider>\n <WebSocketProvider>\n <ApplicationContext.Provider value={{\n appConfig: applicationServices.appConfigFromBackend,\n appIdentity: applicationServices.appConfigFromBackend.appIdentity,\n appPreferences: applicationServices.appConfigFromBackend.appPreferences,\n runtime: applicationServices.appConfigFromBackend.runtime,\n auth: applicationServices.appConfigFromBackend.auth,\n compliance: applicationServices.appConfigFromBackend.compliance,\n frontendConfiguration: applicationServices.frontendConfiguration,\n logger: applicationServices.logger,\n httpClient: applicationServices.httpClient,\n frontendProviderRegistry: applicationServices.frontendProviderRegistry,\n providerComponentRegistry: applicationServices.providerComponentRegistry,\n ...(options.shellCompanions ? { shellCompanions: options.shellCompanions } : {}),\n isInitialized: isInitialized,\n version: applicationServices.appConfigFromBackend.appIdentity?.version ?? '1.0.0',\n initializationStatus,\n markComponentInitialized\n }}>\n <SaaSUIRuntimeProvider>\n <ErrorProvider>\n <I18nProvider>\n <NotificationProvider>\n <HotkeyRegistryProvider>\n <ResourceRegistryProvider resourcesRepository={applicationServices.resourceRepository}>\n {/*\n AnalyticsContextProvider sits BELOW ResourceRegistryProvider, deliberately, and a\n pin in `ApplicationMainProvider.composition-characterization` holds it there.\n\n The provider fetches the achieved value moments only where this consumer can REACH\n the progression store — `useResourceReachability(USER_PROGRESSION_STATE)`, the #268\n rule #1069 applied here. That hook reads the registry from context, and an ABSENT\n registry is read as ignorance (fetch), so that tests mounting the provider alone keep\n working. Mounted above the registry, the provider could only ever see \"absent\": the\n gate #1069 added was inert by construction, its pin passed because the pin mounted a\n registry the shell never did, and every consumer whose registry excludes the store —\n the application-creation workbench, served by the companion — kept fetching a route\n it does not serve, 404 and a \"no record\" toast on every load (measured 2026-09-21).\n\n Nothing between the two providers consumes analytics: `useAnalytics` is reached only\n from `useFeatureAvailability` and `AnalyticsEventBridge`, both under the router.\n */}\n {/*\n The consent-based provider phase (#1704) wraps analytics: it starts a vendor that rests\n on a consent purpose once the signed-in person grants it, stops it on withdrawal or\n sign-out, and publishes what is running — which is what AnalyticsContext dispatches to.\n */}\n <ConsentBasedProviderSdksProvider>\n <AnalyticsContextProvider>\n {/*\n IconRegistryBridge sits BELOW ResourceRegistryProvider + UIProvider\n so it can compute `customRegistry` from `useResourceRegistry()` +\n `useUI()` and pass it to the inner `IconRegistryProvider`. This\n replaces the prior pattern where `resources-repository` mutated\n `CoreIconRegistry` as a side effect — fragile because the mutation\n had to land BEFORE the `IconRegistryProvider` snapshot, which\n wasn't guaranteed when the provider sat above the registry. See\n IconRegistryBridge.tsx for the data-flow rationale.\n */}\n <IconRegistryBridge>\n <RMMRegistryProvider apiBaseUrl={config.apiBaseUrl}>\n <WebSocketEventBridge />\n <RMMWebSocketBridge />\n {/*\n Debounced connectivity notifier: surfaces AT MOST ONE\n persistent, self-dismissing toast per outage (after a\n 3s grace), replacing the former per-reconnection-attempt\n error toasts. Headless; must sit under WebSocket/I18n/\n Notification providers (all above) and beside <Toaster/>.\n */}\n <ConnectionStatusNotifier />\n <AppCelebrationOverlay />\n {/*\n Global toast host. `NotificationProvider` (above) calls\n `toast.*()` (Sonner) for every resource/custom notification —\n success, error, warning, info — per NOTIFICATION_DISPLAY_POLICY.\n Sonner's `toast()` is a module-level singleton that no-ops\n unless a `<Toaster>` is mounted in the DOM. Without this mount,\n EVERY toast app-wide was silently dropped — most visibly, form\n submission failures showed no error at all. It sits beside\n `AppCelebrationOverlay` (the other root-level feedback surface),\n inside `UIProvider` for theming. Its portal renders at\n `z-(--z-transient)` (=`--z-toast`, 500), above modal/overlay\n surfaces, so toasts raised from inside a dialog stay visible.\n */}\n <Toaster />\n <RouterProvider router={router} />\n </RMMRegistryProvider>\n </IconRegistryBridge>\n </AnalyticsContextProvider>\n </ConsentBasedProviderSdksProvider>\n </ResourceRegistryProvider>\n </HotkeyRegistryProvider>\n </NotificationProvider>\n </I18nProvider>\n </ErrorProvider>\n </SaaSUIRuntimeProvider>\n </ApplicationContext.Provider>\n </WebSocketProvider>\n </EventBusProvider>\n );\n}\n\n// useApplication hook is now in separate file: ./useApplication.ts\n// This separation is required for React Fast Refresh compatibility\n"]}
1
+ {"version":3,"file":"ApplicationMainContext.js","sourceRoot":"","sources":["../../../../src/core/runtime/ApplicationMainContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAC;AACjG,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AE,MAAM,GAAI,IACd,GACH,GACE,GACQ,GACV,GACJ,GACJ,GACV,GACD,GACM,GACI,GACZ,GACH,CACpB,CAAC;AACJ,CAAC","sourcesContent":["import { withPageApiBaseUrl } from '~wildo-frontend-lib/core/runtime/page-api-base-url.frontend';\nimport { ComponentPresetDefinitionType, CorePresetNames, FrontendComponentType } from '@wildo-ai/presets-components-models';\nimport {\n AppConfiguration_Shared,\n AppConfiguration_Shared_Auth,\n AppConfiguration_Shared_Compliance,\n AppConfiguration_Shared_AppIdentity,\n AppConfiguration_Shared_AppPreferencesLanguage,\n AppConfiguration_Shared_Runtime,\n ResourceConfiguration_InitializationFactory,\n ResourceRelationship,\n mergeFeatureConfigurations,\n SIGNING_RETURN_PAGE_PATH,\n type CustomFeatureConfigurationInput,\n type NotificationBadgeDefinition,\n type RolesConfiguration,\n type UserPreferences,\n} from '@wildo-ai/saas-models';\nimport type { AppConfiguration_Frontend } from '~wildo-frontend-lib/core/config/app-configuration-frontend.schemas';\nimport React, { useCallback, useEffect, useState, useRef, useMemo } from 'react';\nimport { createBrowserRouter } from 'react-router';\n// The DOM `RouterProvider` wires `react-dom`'s `flushSync` in; React Router 7 publishes it from the `/dom` subpath.\n// It is rendered WITHOUT `useTransitions`: left undefined, every router state update is wrapped in\n// `React.startTransition`, which is what v6's `future.v7_startTransition` did and what\n// `useSynchronousBrowserLocation` is written against.\nimport { RouterProvider } from 'react-router/dom';\nimport { ErrorBoundary } from '~wildo-frontend-lib/core/errors/ErrorBoundary';\nimport { ErrorProvider } from '~wildo-frontend-lib/core/errors/ErrorContext';\nimport { RouterErrorBoundary } from '~wildo-frontend-lib/core/errors/RouterErrorBoundary';\nimport { ErrorManagementService } from '~wildo-frontend-lib/core/errors/error-management.frontend.service';\nimport { I18nProvider } from '~wildo-frontend-lib/core/i18n/I18nContext';\nimport { LoadingProvider } from '~wildo-frontend-lib/core/loading/LoadingContext';\nimport { AppLoadingGate } from '~wildo-frontend-lib/core/loading/AppLoadingGate';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { WildoBackendHttpClient } from '~wildo-frontend-lib/core/requests/wildo-http-client.frontend.service';\nimport { ResourceRegistryProvider } from '~wildo-frontend-lib/core/resources/ResourceRegistryContext';\nimport { AuthSessionProvider } from '~wildo-frontend-lib/core/security/AuthSessionContext';\nimport { AnonymousSessionProvider } from '~wildo-frontend-lib/core/security/AnonymousSessionContext';\nimport { StepUpAuthProvider } from '~wildo-frontend-lib/core/security/StepUpAuthContext';\nimport { ApplicationRoleTablesProvider } from '~wildo-frontend-lib/core/security/ApplicationRoleTablesContext';\nimport { UserOrgsProvider } from '~wildo-frontend-lib/core/security/UserOrgsContext';\nimport { GlobalErrorHandler } from '~wildo-frontend-lib/core/errors/GlobalErrorHandler';\nimport { AppRouter } from './AppRouter';\nimport { StartupFailureScreen } from './StartupFailureScreen';\nimport { UIProvider } from '~wildo-frontend-lib/core/ui/UIContext';\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport { InitializationStatus, MainContextInitComponents } from './runtime.frontend.schemas';\nimport { ApplicationServices, startApplicationService } from './start-application.frontend.service';\nimport type { GeneratedAppProviderModules } from '@wildo-ai/external-connectors-public/app';\n\nimport { EventBusProvider } from '~wildo-frontend-lib/core/events/EventBusContext';\nimport { NotificationProvider } from '~wildo-frontend-lib/core/events/NotificationContext';\nimport { AppCelebrationOverlay } from '~wildo-frontend-lib/components/feedback/celebration-overlay';\nimport { Toaster } from '~wildo-frontend-lib/components/feedback/toast';\nimport { IconRegistryBridge } from '~wildo-frontend-lib/core/icons/IconRegistryBridge';\nimport { NavigationProvider } from '~wildo-frontend-lib/core/navigation/NavigationContext';\nimport { FlowsActorsProvider } from '~wildo-frontend-lib/core/flows-actors/FlowsActorsContext';\nimport { WebSocketProvider } from '~wildo-frontend-lib/core/requests/websockets/WebSocketContext';\nimport type { FrontendConfigOverrides } from './app-config-overrides.frontend.definitions';\nimport type { ResourceUIBehavior } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { WebSocketEventBridge } from '~wildo-frontend-lib/core/requests/websockets/WebSocketEventBridge';\nimport { ConnectionStatusNotifier } from '~wildo-frontend-lib/core/requests/websockets/ConnectionStatusNotifier';\nimport { RMMWebSocketBridge } from '~wildo-frontend-lib/core/resources/rmm/RMMWebSocketBridge';\nimport { AnalyticsScopeBridge } from '~wildo-frontend-lib/core/monitoring/analytics/AnalyticsScopeBridge';\nimport { ResourceReadCacheBridge } from '~wildo-frontend-lib/core/resources/ResourceReadCacheBridge';\nimport { NotificationBadgeMemoryBoundary } from '~wildo-frontend-lib/core/requests/websockets/useNotificationBadges';\nimport { HotkeyRegistryProvider } from '~wildo-frontend-lib/core/hotkey/HotkeyRegistryContext';\nimport { DefaultHotkeyHandler } from '~wildo-frontend-lib/core/hotkey/DefaultHotkeyHandler';\nimport { HotkeyShortcutsHelpDialog } from '~wildo-frontend-lib/core/hotkey/HotkeyShortcutsHelpDialog';\nimport { AppScopeProvider } from '~wildo-frontend-lib/core/scope/AppScopeContext';\nimport { AppModeProvider } from '~wildo-frontend-lib/core/mode/AppModeContext';\nimport { ScopedResourceRegistryProvider } from '~wildo-frontend-lib/core/resources/ScopedResourceRegistryProvider';\nimport { AnalyticsContextProvider } from '~wildo-frontend-lib/core/monitoring/analytics/AnalyticsContext';\nimport { ConsentBasedProviderSdksProvider } from '~wildo-frontend-lib/core/external-providers/ConsentBasedProviderSdks';\nimport { BillingProvider } from '~wildo-frontend-lib/core/billing/BillingContext';\nimport { BillingErrorNotifier } from '~wildo-frontend-lib/core/billing/BillingErrorNotifier';\nimport { FeaturesProvider } from '~wildo-frontend-lib/core/features/FeaturesContext';\nimport { OrganizationBrandingPublisher } from '~wildo-frontend-lib/core/branding/OrganizationBrandingPublisher';\nimport { GuidanceContextProvider } from '~wildo-frontend-lib/core/guidance/GuidanceContext';\nimport { EphemeralSessionTokenStorage } from '~wildo-frontend-lib/core/security/session-token-storage.frontend.service';\nimport { RMMRegistryProvider } from '~wildo-frontend-lib/core/resources/rmm/RMMRegistryContext';\nimport { LoadingSpinner } from '~wildo-frontend-lib/components/feedback/loading-spinner';\nimport { ApplicationContext } from './ApplicationContext.shared';\nimport { ComponentRegistryService } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.service';\nimport type { ComponentRegistrationRequirement } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.schemas';\nimport { useApplication } from '~wildo-frontend-lib/core/runtime/useApplication';\nimport { useEventBus } from '~wildo-frontend-lib/core/events/useEventBus';\nimport { FrontendEvents, type FrontendEventPayloads } from '~wildo-frontend-lib/core/events/events.frontend.schemas';\n\n\n/**\n * Application Main Context\n * Main provider that wraps all other providers and manages global application state\n */\n\n// Type for merged frontend component variant definitions\nexport type MergedFrontendComponentPresetDefinitions = {\n [K in FrontendComponentType]: ComponentPresetDefinitionType<K>[]\n};\n\nexport interface InitializationApplicationConfig {\n apiBaseUrl: string;\n}\n\nexport interface ApplicationMainProviderOptions {\n /** Browser provider CODE, joined with this service's bootstrap DATA during startup. */\n frontendProviderModules?: GeneratedAppProviderModules;\n apiBaseUrl?: string;\n /**\n * Environment variables from the consuming app.\n * Required because pre-compiled libraries don't have access to import.meta.env.\n * Pass import.meta.env from your app.\n */\n env: Record<string, string | undefined>;\n\n /**\n * Custom shared resources configuration factory map from custom-shared-lib.\n * Required for custom resources to be registered in the frontend ResourceRegistryContext.\n */\n customShared_ResourcesConfigurationsFactoryMap?: { [key: string]: ResourceConfiguration_InitializationFactory<any, any, any> };\n\n /**\n * Custom shared resource field identifiers from custom-shared-lib.\n */\n customShared_ResourceFieldIdentifier?: { [key: string]: string };\n\n /**\n * Custom shared resource relationships from custom-shared-lib.\n */\n customShared_ResourcesRelationships?: ResourceRelationship[];\n\n /**\n * Resource types to leave OUT of the registry, even though the core factory map declares them.\n *\n * Forwarded to `initializeResources`, which has always supported it. An APPLICATION normally passes\n * nothing — it wants the whole core vocabulary — so this exists for the other Wildo frontends: the\n * application-creation workbench observes an application's structure and must not register that\n * application's billing, subscription, milestone, user and organization resources.\n */\n excludedResourceTypes?: ReadonlySet<string>;\n\n /** Feature configuration from custom-shared-lib (merged with core + platform features at runtime) */\n featureConfiguration?: CustomFeatureConfigurationInput;\n\n /**\n * The application's declared custom roles (`sharedRegistry.customRoles`), so every frontend role check decides\n * against the same complete role tables the backend authorizes with (`ApplicationRoleTablesContext`).\n *\n * Required as a KEY, deliberately: with it the shell treats a role neither table knows as inert, as the backend\n * does, so an application that declared custom roles and forgot to pass them would silently hide from those roles'\n * holders the rows and actions they may use. `undefined` states that the application declares none (#2376 review).\n */\n customRoles: RolesConfiguration | undefined;\n\n /** Product catalog definitions from custom-shared-lib */\n productDefinitions?: import('@wildo-ai/saas-models').ProductDefinition[];\n\n /**\n * Final frontend resource configuration preset.\n *\n * Controls how each resource and its operations appear in the frontend:\n * labels, sections, views, empty state, guidance (resource-level) and\n * addressability, sidebar placement, layout presets (operation-level).\n *\n * Apps must pass one already-composed object. In Wonder Todos, the engine\n * module owns the framework base preset and layers any app-shell\n * overrides before the final aggregated module registry reaches startup.\n */\n resourceUIBehavior?: ResourceUIBehavior;\n\n /**\n * App-declared notification badge definitions (R8) — merged with the\n * framework's core definitions in the frontend registry so `NavigationItemBadge`\n * can resolve an app badge. Mirror the backend init config.\n */\n notificationBadgeDefinitions?: NotificationBadgeDefinition[];\n\n /**\n * SHELL COMPANIONS — components the signed-in shell mounts ONCE, for as long as it is on screen,\n * whatever page is open. They render nothing of their own; they exist for application-wide effects\n * that must live exactly as long as the shell does. The case that asked for it: a\n * `FRONTEND_PRODUCED` notification badge, whose producer (`usePublishNotificationBadgeCount`) must be\n * mounted wherever the navigation drawing the badge is, and the navigation is on every page.\n *\n * Mounted inside every provider and inside the consent and document-acceptance gates, so a companion\n * never reads before a person has agreed to what the application does. Not a place for UI: a\n * companion that renders visible content has no layout slot and will land wherever the gate puts it.\n */\n shellCompanions?: readonly React.ComponentType[];\n\n /**\n * Base frontend configuration — provided by the app via the preset layer.\n * No implicit framework defaults: apps must explicitly provide this.\n */\n baseFrontendConfig: AppConfiguration_Frontend;\n\n /** Per-section frontend config overrides (factories or partial values) */\n frontendConfigOverrides?: FrontendConfigOverrides;\n\n /** Component loader — required. Called during app init to register component presets. */\n componentLoader: () => Promise<void>;\n}\n\nexport interface ApplicationMainProviderProps {\n // children: ReactNode;\n options: ApplicationMainProviderOptions;\n}\n\n/**\n * Exact preset dependencies of the two mutually exclusive SaaS shell roots.\n * The full framework completeness audit remains a separate developer tool;\n * startup needs only the components that this composition unconditionally\n * delegates its root layout to.\n */\nconst SAAS_APPLICATION_REQUIRED_COMPONENTS: readonly ComponentRegistrationRequirement[] = [\n {\n componentType: FrontendComponentType.APP_LAYOUTS_MAIN_CONTAINER,\n preset: CorePresetNames.DEFAULT,\n },\n {\n componentType: FrontendComponentType.PUBLIC_LAYOUTS_MAIN_CONTAINER,\n preset: CorePresetNames.DEFAULT,\n },\n];\n\n/** Translate SaaS application/event contexts into the focused UI runtime binding. */\nfunction SaaSUIRuntimeProvider({ children }: { children: React.ReactNode }): React.ReactElement {\n const { frontendConfiguration, markComponentInitialized } = useApplication();\n const { on } = useEventBus();\n const subscribeToUserPreferences = useCallback(\n (listener: (preferences: UserPreferences['ui'] | null) => void): (() => void) =>\n on(FrontendEvents.USER_PREFERENCES_CHANGED, (payload: FrontendEventPayloads[FrontendEvents.USER_PREFERENCES_CHANGED]) => {\n /*\n * A payload WITHOUT the key is no news about UI preferences, and must not clear them. The event\n * carries independent fields, each present only when its sender has something to say: a member\n * whose preferences record has no `ui` block (`emitPreferencesChanged` then omits the key) used to\n * reach `UIProvider` as `null` and wipe what the person had set (found by #2242). `null` WITH the\n * key is the sign-out clearing and still clears. Same contract as `I18nContext`'s handler.\n */\n if (!Object.prototype.hasOwnProperty.call(payload, 'uiPreferences')) return;\n listener(payload.uiPreferences ?? null);\n }),\n [on],\n );\n // The current organization's branding in effect (#2306), published from inside the organization and feature contexts.\n const subscribeToOrganizationBranding = useCallback(\n (listener: (branding: { readonly primaryColor: string | null; readonly secondaryColor: string | null; readonly logoUrl: string | null; readonly productName: string | null }) => void): (() => void) =>\n on(FrontendEvents.ORGANIZATION_BRANDING_CHANGED, (payload: FrontendEventPayloads[FrontendEvents.ORGANIZATION_BRANDING_CHANGED]) => {\n listener({ primaryColor: payload.primaryColor ?? null, secondaryColor: payload.secondaryColor ?? null, logoUrl: payload.logoUrl ?? null, productName: payload.productName ?? null });\n }),\n [on],\n );\n const markInitialized = useCallback(\n (): void => markComponentInitialized(MainContextInitComponents.UI),\n [markComponentInitialized],\n );\n return (\n <UIProvider\n frontendConfiguration={frontendConfiguration}\n subscribeToUserPreferences={subscribeToUserPreferences}\n subscribeToOrganizationBranding={subscribeToOrganizationBranding}\n markInitialized={markInitialized}\n >\n {children}\n </UIProvider>\n );\n}\n\ninterface InitializationIssueLike {\n path?: unknown[];\n message?: string;\n}\n\ninterface InitializationUnresolvedForeignKeyLike {\n resourceType?: unknown;\n fieldName?: unknown;\n}\n\ninterface InitializationDiagnosticsLike {\n phase?: unknown;\n apiBaseUrl?: unknown;\n frontendServiceName?: unknown;\n errorName?: unknown;\n errorMessage?: unknown;\n stack?: unknown;\n causeMessage?: unknown;\n wildoError?: unknown;\n}\n\ninterface FormattedInitializationError {\n title: string;\n description: string;\n highlights: string[];\n technicalDetails: string;\n remainingIssueCount: number;\n contextRows: Array<{ label: string; value: string }>;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction formatUnknownValue(value: unknown): string {\n if (typeof value === 'string') {\n return value;\n }\n\n if (value instanceof Error) {\n return value.message;\n }\n\n if (value === undefined) {\n return 'undefined';\n }\n\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n\n/**\n * invented-display-text: the STARTUP-FAILURE screen, which renders because initialization did not\n * complete — so the label bundle is precisely what is not available. Every label beside this one is\n * a literal ('Application', 'Failed step', 'Frontend service') for the same reason, and this file\n * imports no `useI18n`. A diagnostic that needs the thing that failed is not a diagnostic.\n */\n// invented-display-text: startup-failure screen — see above.\nfunction titleCaseFromIdentifier(value: string): string {\n return value\n .split(/[\\s_-]+/)\n .filter(Boolean)\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(' ');\n}\n\nfunction formatInitializationPhase(phase: unknown): string | undefined {\n if (typeof phase !== 'string' || phase.trim().length === 0) {\n return undefined;\n }\n\n // invented-display-text: startup-failure screen — see `titleCaseFromIdentifier`.\n return titleCaseFromIdentifier(phase.trim());\n}\n\nfunction extractInitializationDiagnostics(rawError: unknown): InitializationDiagnosticsLike | undefined {\n if (!isRecord(rawError) || !isRecord(rawError.initializationDiagnostics)) {\n return undefined;\n }\n\n return rawError.initializationDiagnostics;\n}\n\nfunction extractWildoError(rawError: unknown, diagnostics?: InitializationDiagnosticsLike): Record<string, unknown> | undefined {\n if (diagnostics && isRecord(diagnostics.wildoError)) {\n return diagnostics.wildoError;\n }\n\n if (isRecord(rawError) && isRecord(rawError.wildoError)) {\n return rawError.wildoError;\n }\n\n return undefined;\n}\n\nfunction extractInitializationIssueArray(candidate: unknown): InitializationIssueLike[] | null {\n if (typeof candidate !== 'string') {\n return null;\n }\n\n try {\n const parsed = JSON.parse(candidate) as unknown;\n if (!Array.isArray(parsed)) {\n return null;\n }\n\n const issues = parsed.filter(\n (issue): issue is InitializationIssueLike =>\n typeof issue === 'object' && issue !== null,\n );\n\n return issues.length > 0 ? issues : null;\n } catch {\n return null;\n }\n}\n\nfunction extractPrimaryInitializationMessage(\n rawError: unknown,\n diagnostics?: InitializationDiagnosticsLike,\n wildoError?: Record<string, unknown>,\n): string {\n if (diagnostics && typeof diagnostics.errorMessage === 'string' && diagnostics.errorMessage.trim().length > 0) {\n return diagnostics.errorMessage;\n }\n\n if (wildoError && isRecord(wildoError.context) && typeof wildoError.context.message === 'string') {\n return wildoError.context.message;\n }\n\n if (rawError instanceof Error) {\n return rawError.message;\n }\n\n if (typeof rawError === 'string') {\n return rawError;\n }\n\n return formatUnknownValue(rawError);\n}\n\nfunction buildInitializationHighlights(wildoContext: Record<string, unknown> | undefined): string[] {\n if (!wildoContext) {\n return [];\n }\n\n const highlights: string[] = [];\n\n if (Array.isArray(wildoContext.unresolvedFKFields)) {\n for (const entry of wildoContext.unresolvedFKFields as InitializationUnresolvedForeignKeyLike[]) {\n const resourceType = typeof entry?.resourceType === 'string' ? entry.resourceType : 'unknown-resource';\n const fieldName = typeof entry?.fieldName === 'string' ? entry.fieldName : 'unknown-field';\n highlights.push(`${resourceType}.${fieldName}: foreign key cannot be resolved to a resource type`);\n }\n }\n\n if (typeof wildoContext.message === 'string') {\n const lines = wildoContext.message\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0 && !line.startsWith('[ResourcesRegistry]') && !line.startsWith('Fix:'));\n\n for (const line of lines) {\n if (line.startsWith('- ')) {\n highlights.push(line.slice(2));\n } else if (!highlights.includes(line)) {\n highlights.push(line);\n }\n }\n }\n\n const contextualEntries: Array<[string, unknown]> = [\n ['Resource type', wildoContext.resourceType],\n ['Foreign key field', wildoContext.foreignKeyField],\n ['Method', wildoContext.method],\n ['Existing type', wildoContext.existingType],\n ['New type', wildoContext.newType],\n ];\n\n for (const [label, value] of contextualEntries) {\n if (typeof value === 'string' && value.trim().length > 0) {\n highlights.push(`${label}: ${value}`);\n }\n }\n\n return Array.from(new Set(highlights)).slice(0, 6);\n}\n\nfunction buildInitializationContextRows(params: {\n diagnostics?: InitializationDiagnosticsLike;\n wildoError?: Record<string, unknown>;\n startupAppName: string;\n}): Array<{ label: string; value: string }> {\n const rows: Array<{ label: string; value: string }> = [\n { label: 'Application', value: params.startupAppName },\n ];\n\n const phase = formatInitializationPhase(params.diagnostics?.phase);\n if (phase) {\n rows.push({ label: 'Failed step', value: phase });\n }\n\n if (typeof params.diagnostics?.frontendServiceName === 'string' && params.diagnostics.frontendServiceName.trim().length > 0) {\n rows.push({ label: 'Frontend service', value: params.diagnostics.frontendServiceName });\n }\n\n if (typeof params.diagnostics?.apiBaseUrl === 'string' && params.diagnostics.apiBaseUrl.trim().length > 0) {\n rows.push({ label: 'API base URL', value: params.diagnostics.apiBaseUrl });\n }\n\n if (typeof params.wildoError?.customMessageReference === 'string' && params.wildoError.customMessageReference.trim().length > 0) {\n rows.push({ label: 'Error reference', value: params.wildoError.customMessageReference });\n }\n\n if (typeof params.wildoError?.type === 'string' && params.wildoError.type.trim().length > 0) {\n rows.push({ label: 'Error type', value: params.wildoError.type });\n }\n\n return rows;\n}\n\nfunction formatInitializationIssuePath(path: unknown[] | undefined): string {\n if (!path || path.length === 0) {\n return 'root';\n }\n\n return path\n .map((segment) => typeof segment === 'string' ? segment : String(segment))\n .join(' > ');\n}\n\nfunction formatInitializationError(rawError: unknown, startupAppName: string): FormattedInitializationError {\n const diagnostics = extractInitializationDiagnostics(rawError);\n const wildoError = extractWildoError(rawError, diagnostics);\n const primaryMessage = extractPrimaryInitializationMessage(rawError, diagnostics, wildoError);\n const issueArray = extractInitializationIssueArray(primaryMessage);\n const technicalDetails = formatUnknownValue(\n diagnostics ? {\n ...diagnostics,\n rawError: rawError instanceof Error ? {\n name: rawError.name,\n message: rawError.message,\n stack: rawError.stack,\n } : rawError,\n } : rawError,\n );\n\n if (issueArray) {\n const highlights = issueArray.slice(0, 6).map((issue) => {\n const location = formatInitializationIssuePath(issue.path);\n const message = issue.message ?? 'Invalid configuration value';\n return `${location}: ${message}`;\n });\n\n return {\n title: 'Application configuration is invalid',\n description: `Startup stopped because the frontend configuration failed validation in ${issueArray.length} place${issueArray.length === 1 ? '' : 's'}.`,\n highlights,\n technicalDetails: JSON.stringify(issueArray, null, 2),\n remainingIssueCount: Math.max(issueArray.length - highlights.length, 0),\n contextRows: buildInitializationContextRows({ diagnostics, wildoError, startupAppName }),\n };\n }\n\n const wildoContext = wildoError && isRecord(wildoError.context) ? wildoError.context : undefined;\n const highlights = buildInitializationHighlights(wildoContext);\n const phase = formatInitializationPhase(diagnostics?.phase);\n const shouldTreatAsConfigurationError = primaryMessage === 'configuration'\n || typeof wildoError?.customMessageReference === 'string' && wildoError.customMessageReference === 'configuration';\n\n const descriptionParts = [\n phase ? `Startup stopped during ${phase}.` : undefined,\n primaryMessage && primaryMessage !== 'configuration' ? primaryMessage : undefined,\n !primaryMessage || primaryMessage === 'configuration'\n ? 'Open the technical details to inspect the full startup diagnostics.'\n : undefined,\n ].filter((part): part is string => Boolean(part));\n\n return {\n title: shouldTreatAsConfigurationError ? 'Application configuration is invalid' : 'Application initialization failed',\n description: descriptionParts.join(' '),\n highlights,\n technicalDetails,\n remainingIssueCount: 0,\n contextRows: buildInitializationContextRows({ diagnostics, wildoError, startupAppName }),\n };\n}\n\n// ApplicationMainProvider component - exported directly for Fast Refresh compatibility\nexport function ApplicationMainProvider(props: ApplicationMainProviderProps): React.ReactElement {\n // Embedded signing: the vendor sends a signing frame back to this page once the person is done, and the frame that\n // loaded it only needs to see it arrive. The application must not boot inside that frame: a second instance would\n // restore the session, refresh its tokens (a rotated refresh token the parent then reuses revokes the session) and\n // open a WebSocket, all in a frame about to be removed. So the page renders nothing, before any provider mounts.\n if (window.location.pathname === SIGNING_RETURN_PAGE_PATH) return <></>;\n return <ApplicationMainProviderRoot {...props} />;\n}\n\nfunction ApplicationMainProviderRoot({\n // children,\n options,\n}: ApplicationMainProviderProps): React.ReactElement {\n const mergedFeatureConfiguration = useMemo(\n () => mergeFeatureConfigurations(options.featureConfiguration),\n [options.featureConfiguration]\n );\n\n const logger = useMemo(() => LoggerFrontendService.getLogger(), []);\n const logDebug = useMemo(() => {\n const debugFn = logger.debugByType('ApplicationMainContext');\n logger.setDebugTypeLogging('ApplicationMainContext', false); // Enable debug logging for initialization\n return debugFn;\n }, [logger]);\n\n const [isInitialized, setIsInitialized] = useState(false);\n const [initError, setInitError] = useState<unknown | null>(null);\n const [applicationServices, setApplicationServices] = useState<ApplicationServices | null>(null);\n const [config, setConfig] = useState<InitializationApplicationConfig | null>(null);\n const [initializationStatus, setInitializationStatus] = useState<InitializationStatus>({\n [MainContextInitComponents.MAIN_CONTEXT]: false,\n [MainContextInitComponents.UI]: false,\n [MainContextInitComponents.LOADER]: false,\n [MainContextInitComponents.ERRORS]: false,\n [MainContextInitComponents.ROUTER]: false,\n [MainContextInitComponents.I18N]: false,\n [MainContextInitComponents.APP_MAIN_CONTAINER]: false,\n [MainContextInitComponents.PUBLIC_APP_CONTAINER]: false\n });\n\n\n const checkAllComponentsInitialized = useCallback((status: InitializationStatus): boolean => {\n // Required: main context, UI, and the two root shell containers.\n return status[MainContextInitComponents.MAIN_CONTEXT] &&\n status[MainContextInitComponents.UI] &&\n status[MainContextInitComponents.APP_MAIN_CONTAINER] &&\n status[MainContextInitComponents.PUBLIC_APP_CONTAINER];\n }, []);\n\n // Function to mark components as initialized\n const markComponentInitialized = useCallback((component: MainContextInitComponents) => {\n setInitializationStatus(prev => {\n const newStatus = { ...prev, [component]: true };\n\n // Debug logging for initialization tracking\n const missingComponents = Object.entries(newStatus)\n .filter(([_, isInit]) => !isInit)\n .map(([name]) => name);\n\n logDebug(`Component initialized: ${component}`, {\n newStatus,\n allComponentsReady: checkAllComponentsInitialized(newStatus),\n missingComponents\n });\n\n // Check if all required components are initialized\n if (checkAllComponentsInitialized(newStatus)) {\n logDebug('All components initialized, setting isInitialized=true');\n setIsInitialized(true);\n }\n\n return newStatus;\n });\n }, [checkAllComponentsInitialized, logDebug]);\n\n // Track initialization to prevent re-initialization on hot reload\n const initializationStartedRef = useRef(false);\n\n // Track if initialization has already failed to prevent retry loops\n const initializationFailedRef = useRef(false);\n\n // Holds the single browser router instance (created once, after the bootstrap\n // gate below). Declared here at the top so the hook call is unconditional —\n // the actual creation happens past the `!applicationServices` early return,\n // where it must NOT be a hook. See the create-once comment at the router site.\n const routerRef = useRef<ReturnType<typeof createBrowserRouter> | null>(null);\n\n const startupAppName = useMemo(\n () => {\n const candidate = options.env.VITE_APP_NAME?.trim();\n return candidate && candidate.length > 0 ? candidate : 'Application';\n },\n [options.env],\n );\n const formattedInitError = useMemo(\n () => initError ? formatInitializationError(initError, startupAppName) : null,\n [initError, startupAppName],\n );\n\n useEffect(() => {\n logDebug('useEffect triggered', {\n initializationStartedRef: initializationStartedRef.current,\n initializationFailedRef: initializationFailedRef.current,\n hasApplicationServices: !!applicationServices,\n isInitialized,\n currentInitializationStatus: initializationStatus\n });\n\n // If services exist but initialization status wasn't set, restore it\n // This happens on hot reload when the component remounts but services are already initialized\n if (applicationServices && !isInitialized) {\n logDebug('Services exist but not initialized, restoring core components');\n markComponentInitialized(MainContextInitComponents.MAIN_CONTEXT);\n markComponentInitialized(MainContextInitComponents.LOADER);\n markComponentInitialized(MainContextInitComponents.ERRORS);\n markComponentInitialized(MainContextInitComponents.ROUTER);\n\n // On hot reload: Mark container components as initialized\n // They will mark themselves when rendered, but we need to allow rendering to proceed\n // This is safe because markComponentInitialized is idempotent and components will\n // call it again when they render, ensuring the status stays correct\n markComponentInitialized(MainContextInitComponents.APP_MAIN_CONTAINER);\n markComponentInitialized(MainContextInitComponents.PUBLIC_APP_CONTAINER);\n\n logDebug('Marked container components for hot reload (they will re-mark themselves when rendered)');\n return;\n }\n\n // Prevent re-initialization if already started or failed\n if (initializationStartedRef.current || initializationFailedRef.current) {\n logDebug('Skipping initialization (already started/failed)');\n\n // If already failed, don't retry automatically\n if (initializationFailedRef.current && !initError) {\n setInitError('Initialization previously failed. Click Retry to try again.');\n }\n return;\n }\n\n\n const initializeApp = async () => {\n // Mark initialization as started immediately\n initializationStartedRef.current = true;\n try {\n // Initialize global error handlers (must be done early)\n ErrorManagementService.initializeGlobalErrorHandlers();\n\n // Inject env vars from the consuming app (required for pre-compiled libraries). On an organization's custom\n // domain (#2974) the API is served on the page's own host, so every client reading the loader calls it there.\n envLoader.injectEnvironmentVariables(withPageApiBaseUrl(options.env, window.location));\n\n const envConfig = envLoader.loadEnvironmentConfig();\n\n const finalConfig: InitializationApplicationConfig = {\n apiBaseUrl: options.apiBaseUrl ?? envConfig.apiBaseUrl,\n };\n\n setConfig(finalConfig);\n\n const services = await startApplicationService.initializeApplication({\n config: finalConfig,\n autoAuth: false,\n frontendProviderModules: options.frontendProviderModules,\n customShared_ResourcesConfigurationsFactoryMap: options.customShared_ResourcesConfigurationsFactoryMap,\n customShared_ResourceFieldIdentifier: options.customShared_ResourceFieldIdentifier,\n customShared_ResourcesRelationships: options.customShared_ResourcesRelationships,\n excludedResourceTypes: options.excludedResourceTypes,\n resourceUIBehavior: options.resourceUIBehavior,\n notificationBadgeDefinitions: options.notificationBadgeDefinitions,\n baseFrontendConfig: options.baseFrontendConfig,\n frontendConfigOverrides: options.frontendConfigOverrides,\n featureConfiguration: mergedFeatureConfiguration,\n componentLoader: async () => {\n await options.componentLoader();\n // Keep the strict host gate inside the component-registration\n // startup phase. A missing shell preset therefore prevents the\n // service's success callback as well as every React child mount.\n ComponentRegistryService.assertRequiredRegistrations(\n 'SaaS application',\n SAAS_APPLICATION_REQUIRED_COMPONENTS,\n );\n },\n onInitialized: () => {\n logDebug('Application initialized successfully');\n },\n onError: (error: Error) => {\n logger.error('Application initialization failed', { error: error.message, details: error });\n setInitError(error);\n }\n });\n\n // The startup service has a legitimate already-initialized fast path\n // that does not call the loader again. Re-assert before publishing its\n // services so HMR/remount paths retain the same fail-closed guarantee.\n ComponentRegistryService.assertRequiredRegistrations(\n 'SaaS application',\n SAAS_APPLICATION_REQUIRED_COMPONENTS,\n );\n\n setApplicationServices(services);\n\n // Mark main context and core components as initialized\n markComponentInitialized(MainContextInitComponents.MAIN_CONTEXT);\n markComponentInitialized(MainContextInitComponents.LOADER);\n markComponentInitialized(MainContextInitComponents.ERRORS);\n markComponentInitialized(MainContextInitComponents.ROUTER);\n // Note: I18N will be marked as initialized by I18nProvider when translations are loaded\n // TODO: PUBLIC_APP_CONTAINER will be marked by its component when created\n\n // In cases where the underlying service was already initialized\n // (e.g., HMR/StrictMode), the onInitialized callback may not fire.\n // Note: Don't set isInitialized here anymore - wait for all components\n\n } catch (error) {\n // Mark as failed to prevent retry loops\n initializationFailedRef.current = true;\n\n const errorMessage = error instanceof Error ? error.message : 'Unknown initialization error';\n setInitError(error);\n logger.error('Application initialization failed', { error: errorMessage, details: error });\n }\n };\n\n initializeApp();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // logDebug and logger are stable references, markComponentInitialized is memoized\n }, [options, applicationServices, isInitialized]);\n\n // Manual retry handler - resets failed state and reloads the page\n const handleManualRetry = useCallback(() => {\n // Reset the failed state before reloading to allow a fresh initialization attempt\n initializationFailedRef.current = false;\n initializationStartedRef.current = false;\n window.location.reload();\n }, []);\n\n // W7.3b: Detect one-off session entry at mount time.\n // When the tab opens on a one-off URL, AuthSessionProvider uses ephemeral (in-memory)\n // storage so the persistent session in other tabs is never touched.\n // The ref captures the initial URL — subsequent navigations within the same tab\n // (e.g., after the exchange redirects to home) do not change the storage strategy.\n // IMPORTANT: Must be above early returns to satisfy Rules of Hooks.\n const isOneOffSessionEntryRef = useRef(\n window.location.pathname.startsWith('/one-off-session/')\n );\n const sessionTokenStorage = useMemo(\n () => isOneOffSessionEntryRef.current ? new EphemeralSessionTokenStorage() : undefined,\n []\n );\n\n // Handle initialization error - early return before any providers (plain Tailwind, no useUI)\n if (initError && formattedInitError) {\n // OUTSIDE DEVELOPMENT a person gets a generic screen and a retry, and nothing derived from the failure:\n // no error-derived headline, no configuration issues, no context rows, no diagnostics JSON, no stack.\n // The full diagnostics are already in the logger (see the initialization catch above), which is where\n // OWASP's Error Handling guidance puts them. The card below stays for developers (#1181).\n //\n // The mode is read WITHOUT loading the configuration (`readEnvironmentMode`, not `isDevelopment`): a\n // missing or invalid `VITE_*` variable is one of the failures this very branch exists to report, and\n // `isDevelopment()` would re-throw it mid-render — there is no error boundary above this provider, so\n // the failure screen would become a blank page.\n //\n // The predicate is `=== 'development'` rather than `!isProduction()`, deliberately: `staging` and\n // `test` are hosts that real people reach, and OWASP's guidance is about who is LOOKING, not about how\n // the deployment is labelled. Only a developer's own machine gets the diagnostics. An unestablished\n // mode falls on the same side — unknown is not development.\n if (envLoader.readEnvironmentMode() !== 'development') {\n return <StartupFailureScreen onRetry={handleManualRetry} />;\n }\n\n return (\n <div className=\"min-h-screen w-screen bg-background px-6 py-10 md:px-10\">\n <div className=\"mx-auto flex min-h-[calc(100vh-5rem)] max-w-5xl items-center justify-center\">\n <div\n role=\"alert\"\n className=\"w-full overflow-hidden rounded-2xl border border-border bg-card shadow-sm\"\n >\n <div className=\"border-b border-border bg-muted/40 px-6 py-5 md:px-8\">\n <div className=\"flex items-start gap-4\">\n <div className=\"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-destructive/12 text-xl text-destructive\">\n !\n </div>\n <div className=\"min-w-0\">\n <p className=\"text-sm font-medium uppercase tracking-wide text-destructive\">\n Initialization failed\n </p>\n <h1 className=\"mt-1 text-2xl font-semibold text-foreground\">\n {formattedInitError.title}\n </h1>\n <p className=\"mt-2 max-w-3xl text-sm leading-6 text-muted-foreground\">\n {formattedInitError.description}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"space-y-6 px-6 py-6 md:px-8\">\n {formattedInitError.contextRows.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2 xl:grid-cols-3\">\n {formattedInitError.contextRows.map((row) => (\n <div\n key={`${row.label}:${row.value}`}\n className=\"rounded-xl border border-border bg-muted/20 px-4 py-3\"\n >\n <p className=\"text-[11px] font-medium uppercase tracking-wide text-muted-foreground\">\n {row.label}\n </p>\n <p className=\"mt-1 break-all font-mono text-xs leading-5 text-foreground\">\n {row.value}\n </p>\n </div>\n ))}\n </div>\n ) : null}\n\n {formattedInitError.highlights.length > 0 ? (\n <div className=\"space-y-3\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n What needs attention\n </h2>\n <div className=\"grid gap-2\">\n {formattedInitError.highlights.map((highlight) => (\n <div\n key={highlight}\n className=\"rounded-lg border border-border bg-muted/30 px-3 py-2 font-mono text-xs leading-5 text-foreground\"\n >\n {highlight}\n </div>\n ))}\n </div>\n {formattedInitError.remainingIssueCount > 0 ? (\n <p className=\"text-xs text-muted-foreground\">\n And {formattedInitError.remainingIssueCount} more issue{formattedInitError.remainingIssueCount === 1 ? '' : 's'} in the technical details below.\n </p>\n ) : null}\n </div>\n ) : null}\n\n <div className=\"rounded-xl border border-border bg-muted/20 p-4\">\n <p className=\"text-sm text-muted-foreground\">\n The application will not automatically retry. Fix the underlying issue, then reload the app to start a fresh initialization attempt.\n </p>\n <div className=\"mt-4 flex flex-wrap gap-3\">\n <button\n onClick={handleManualRetry}\n className=\"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90\"\n >\n Retry initialization\n </button>\n </div>\n </div>\n\n <details className=\"group rounded-xl border border-border bg-background\">\n <summary className=\"cursor-pointer list-none px-4 py-3 text-sm font-medium text-foreground\">\n <span className=\"group-open:hidden\">Show technical details</span>\n <span className=\"hidden group-open:inline\">Hide technical details</span>\n </summary>\n <div className=\"border-t border-border px-4 py-4\">\n <pre className=\"max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/30 p-4 font-mono text-xs leading-5 text-foreground\">\n {formattedInitError.technicalDetails}\n </pre>\n </div>\n </details>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n // Handle bootstrap loading before the provider tree can safely mount.\n // Once services/config exist, render the full tree so UIProvider and the shell\n // containers can complete their own initialization work and report readiness.\n if (!applicationServices || !config) {\n const missingComponents = Object.entries(initializationStatus)\n .filter(([_, isInit]) => !isInit)\n .map(([name]) => name);\n\n logDebug('Still loading', {\n isInitialized,\n hasApplicationServices: !!applicationServices,\n hasConfig: !!config,\n initializationStatus,\n missingComponents\n });\n\n // Pre-bootstrap loader (config/services not ready yet). Intentionally the\n // SAME minimal presentation as the Tier-1 `AppLoadingGate` \"simple loading\"\n // overlay — a centered, recipe-coloured `LoadingSpinner` on `bg-background`,\n // with no card chrome / circular badge / forced `text-primary`. The earlier\n // bespoke card duplicated the spinner SVG and hardcoded the primary colour,\n // so the very first paint looked unlike every subsequent loading state.\n return (\n <div className=\"flex min-h-screen w-screen items-center justify-center bg-background\">\n <LoadingSpinner size={48} />\n </div>\n );\n }\n\n // Route element - contains providers specific to the main app content\n // NavigationProvider must be inside RouterProvider (needs useNavigate) but wraps content\n // Note: ResourceRegistryProvider is moved outside router to wrap WebSocketEventBridge\n // AuthSessionProvider manages auth/session/WebSocket, AppScopeProvider owns primary/custom scope,\n // and UserOrgsProvider consumes AppScope for its org-facing facade APIs.\n // GlobalErrorHandler subscribes to ERROR_OCCURED events and handles auth errors (logout)\n const routeElement = (\n <ErrorBoundary>\n <LoadingProvider>\n <AppLoadingGate>\n <AnonymousSessionProvider>\n <AuthSessionProvider tokenStorage={sessionTokenStorage}>\n {/* GlobalErrorHandler must be inside AuthSessionProvider to access logout */}\n <GlobalErrorHandler />\n <StepUpAuthProvider>\n {/* AppScopeProvider manages primary + custom scope state */}\n <AppScopeProvider>\n {/* Cache coverage must observe the same organization scope as the routed application. */}\n <ResourceReadCacheBridge />\n {/* Remembered badge counts end where the user or organization changes, as cached reads do. */}\n <NotificationBadgeMemoryBoundary />\n <AnalyticsScopeBridge />\n <ApplicationRoleTablesProvider customRoles={options.customRoles}>\n <UserOrgsProvider>\n {/* AppModeProvider manages active mode — inside scope, wraps billing */}\n <AppModeProvider>\n <BillingProvider productDefinitions={options.productDefinitions}>\n <BillingErrorNotifier />\n <FeaturesProvider featureConfiguration={mergedFeatureConfiguration}>\n <OrganizationBrandingPublisher />\n <ScopedResourceRegistryProvider>\n <GuidanceContextProvider>\n <FlowsActorsProvider>\n <NavigationProvider>\n {/* DefaultHotkeyHandler registers application-level keyboard shortcuts */}\n <DefaultHotkeyHandler />\n <HotkeyShortcutsHelpDialog />\n <AppRouter />\n </NavigationProvider>\n </FlowsActorsProvider>\n </GuidanceContextProvider>\n </ScopedResourceRegistryProvider>\n </FeaturesProvider>\n </BillingProvider>\n </AppModeProvider>\n </UserOrgsProvider>\n </ApplicationRoleTablesProvider>\n </AppScopeProvider>\n </StepUpAuthProvider>\n </AuthSessionProvider>\n </AnonymousSessionProvider>\n </AppLoadingGate>\n </LoadingProvider>\n </ErrorBoundary>\n );\n\n // Create the router exactly ONCE, then reuse it across re-renders.\n //\n // `createBrowserRouter` must never run in render: a fresh router instance makes\n // `RouterProvider` remount the ENTIRE route tree (every provider below,\n // including `NavigationProvider`), discarding their state. During bootstrap\n // `ApplicationMainProvider` re-renders several times (services set, config set,\n // primary scope resolving async on deep-link), so an in-render router recreated\n // the whole tree each wave — wiping navigation/overlay state established from\n // the URL. That is why a cold deep-link to an overlay-reconstructed surface\n // (e.g. `/settings`) lost its overlay while in-session navigation (no further\n // re-renders) kept it. This code path is reached only after the\n // `!applicationServices || !config` gate above, and `routeElement`'s only props\n // (`sessionTokenStorage`, `options.productDefinitions`, `mergedFeatureConfiguration`)\n // are all stable post-init, so capturing the route element once is correct.\n // `routerRef` is declared at the top of the component (unconditional hook);\n // here we only populate it, which is safe after the bootstrap early-return.\n if (routerRef.current === null) {\n // React Router 7 made every v6 `future.v7_*` flag (relative splat paths, fetcher persistence,\n // upper-case form methods, partial hydration, no revalidation after an action error) its fixed\n // behaviour, so the router takes no future flags: this app opted into all five while on v6.\n routerRef.current = createBrowserRouter([\n { path: '/*', element: routeElement, errorElement: <RouterErrorBoundary /> }\n ]);\n }\n const router = routerRef.current;\n\n // Wrap RouterProvider with providers that both route element and error boundary need.\n // This ensures RouterErrorBoundary has access to I18nProvider, IconRegistryProvider, etc.\n // ResourceRegistryProvider must wrap WebSocketEventBridge since it uses useResourceRegistry()\n return (\n <EventBusProvider>\n <WebSocketProvider>\n <ApplicationContext.Provider value={{\n appConfig: applicationServices.appConfigFromBackend,\n appIdentity: applicationServices.appConfigFromBackend.appIdentity,\n appPreferences: applicationServices.appConfigFromBackend.appPreferences,\n runtime: applicationServices.appConfigFromBackend.runtime,\n auth: applicationServices.appConfigFromBackend.auth,\n compliance: applicationServices.appConfigFromBackend.compliance,\n frontendConfiguration: applicationServices.frontendConfiguration,\n logger: applicationServices.logger,\n httpClient: applicationServices.httpClient,\n frontendProviderRegistry: applicationServices.frontendProviderRegistry,\n providerComponentRegistry: applicationServices.providerComponentRegistry,\n ...(options.shellCompanions ? { shellCompanions: options.shellCompanions } : {}),\n isInitialized: isInitialized,\n version: applicationServices.appConfigFromBackend.appIdentity?.version ?? '1.0.0',\n initializationStatus,\n markComponentInitialized\n }}>\n <SaaSUIRuntimeProvider>\n <ErrorProvider>\n <I18nProvider>\n <NotificationProvider>\n <HotkeyRegistryProvider>\n <ResourceRegistryProvider resourcesRepository={applicationServices.resourceRepository}>\n {/*\n AnalyticsContextProvider sits BELOW ResourceRegistryProvider, deliberately, and a\n pin in `ApplicationMainProvider.composition-characterization` holds it there.\n\n The provider fetches the achieved value moments only where this consumer can REACH\n the progression store — `useResourceReachability(USER_PROGRESSION_STATE)`, the #268\n rule #1069 applied here. That hook reads the registry from context, and an ABSENT\n registry is read as ignorance (fetch), so that tests mounting the provider alone keep\n working. Mounted above the registry, the provider could only ever see \"absent\": the\n gate #1069 added was inert by construction, its pin passed because the pin mounted a\n registry the shell never did, and every consumer whose registry excludes the store —\n the application-creation workbench, served by the companion — kept fetching a route\n it does not serve, 404 and a \"no record\" toast on every load (measured 2026-09-21).\n\n Nothing between the two providers consumes analytics: `useAnalytics` is reached only\n from `useFeatureAvailability` and `AnalyticsEventBridge`, both under the router.\n */}\n {/*\n The consent-based provider phase (#1704) wraps analytics: it starts a vendor that rests\n on a consent purpose once the signed-in person grants it, stops it on withdrawal or\n sign-out, and publishes what is running — which is what AnalyticsContext dispatches to.\n */}\n <ConsentBasedProviderSdksProvider>\n <AnalyticsContextProvider>\n {/*\n IconRegistryBridge sits BELOW ResourceRegistryProvider + UIProvider\n so it can compute `customRegistry` from `useResourceRegistry()` +\n `useUI()` and pass it to the inner `IconRegistryProvider`. This\n replaces the prior pattern where `resources-repository` mutated\n `CoreIconRegistry` as a side effect — fragile because the mutation\n had to land BEFORE the `IconRegistryProvider` snapshot, which\n wasn't guaranteed when the provider sat above the registry. See\n IconRegistryBridge.tsx for the data-flow rationale.\n */}\n <IconRegistryBridge>\n <RMMRegistryProvider apiBaseUrl={config.apiBaseUrl}>\n <WebSocketEventBridge />\n <RMMWebSocketBridge />\n {/*\n Debounced connectivity notifier: surfaces AT MOST ONE\n persistent, self-dismissing toast per outage (after a\n 3s grace), replacing the former per-reconnection-attempt\n error toasts. Headless; must sit under WebSocket/I18n/\n Notification providers (all above) and beside <Toaster/>.\n */}\n <ConnectionStatusNotifier />\n <AppCelebrationOverlay />\n {/*\n Global toast host. `NotificationProvider` (above) calls\n `toast.*()` (Sonner) for every resource/custom notification —\n success, error, warning, info — per NOTIFICATION_DISPLAY_POLICY.\n Sonner's `toast()` is a module-level singleton that no-ops\n unless a `<Toaster>` is mounted in the DOM. Without this mount,\n EVERY toast app-wide was silently dropped — most visibly, form\n submission failures showed no error at all. It sits beside\n `AppCelebrationOverlay` (the other root-level feedback surface),\n inside `UIProvider` for theming. Its portal renders at\n `z-(--z-transient)` (=`--z-toast`, 500), above modal/overlay\n surfaces, so toasts raised from inside a dialog stay visible.\n */}\n <Toaster />\n <RouterProvider router={router} />\n </RMMRegistryProvider>\n </IconRegistryBridge>\n </AnalyticsContextProvider>\n </ConsentBasedProviderSdksProvider>\n </ResourceRegistryProvider>\n </HotkeyRegistryProvider>\n </NotificationProvider>\n </I18nProvider>\n </ErrorProvider>\n </SaaSUIRuntimeProvider>\n </ApplicationContext.Provider>\n </WebSocketProvider>\n </EventBusProvider>\n );\n}\n\n// useApplication hook is now in separate file: ./useApplication.ts\n// This separation is required for React Fast Refresh compatibility\n"]}
@@ -54,7 +54,12 @@ export interface UserOrgsContextType {
54
54
  * self-preferences UPDATE door or the write fails — a consent surface must say it could not save,
55
55
  * never behave as though it had.
56
56
  */
57
- recordConsentDecision: (grantedPurposes: readonly ConsentPurpose[]) => Promise<UserPrivacy>;
57
+ /**
58
+ * `offeredPurposes`: what the deciding surface put in front of the person (#3929). A consent covers the purposes the
59
+ * person was shown, so the server adds these to the purposes they have answered, and the consent gate stops asking
60
+ * for them. Every surface knows it: it is the `offered` set it composed the decision from.
61
+ */
62
+ recordConsentDecision: (grantedPurposes: readonly ConsentPurpose[], offeredPurposes: readonly ConsentPurpose[]) => Promise<UserPrivacy>;
58
63
  }
59
64
  /**
60
65
  * UserOrgs Context
@@ -1 +1 @@
1
- {"version":3,"file":"UserOrgsContext.d.ts","sourceRoot":"","sources":["../../../../src/core/security/UserOrgsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2B,SAAS,EAAuD,MAAM,OAAO,CAAC;AACvH,OAAO,EACL,WAAW,EACX,mBAAmB,EAMnB,6BAA6B,EAC7B,WAAW,EAKX,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EACL,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA+BlD;;;;GAIG;AAEH,MAAM,WAAW,mBAAmB;IAElC,IAAI,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;IAChD,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtE,wBAAwB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,0BAA0B,CAAC,CAAC;IACxF,YAAY,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,cAAc,CAAC,CAAC;IAChE,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtE,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACtE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IA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AsB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;;;;OAMG;IACH,uBAAuB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7D,sBAAsB,EAAE,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACzD,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAG1C,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAErC;;;;;;;;;;;;OAYG;IACH;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,EAAE,eAAe,EAAE,SAAS,cAAc,EAAE,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CACzI;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAA6D,CAAC;AAEzI,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CA8lC9D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useState, useMemo, useEffect, useCallback, useRef, useContext } from 'react';
3
- import { CoreResourceType, ResourcesConfig_OperationPathUtils, CoreResourceOperation, ResourceOperationVariantType, OPERATION_VARIANT_KEY, SessionType, normalizeConsentPurposes, UserSelf_Operations, } from '@wildo-ai/saas-models';
3
+ import { CoreResourceType, ResourcesConfig_OperationPathUtils, CoreResourceOperation, ResourceOperationVariantType, OPERATION_VARIANT_KEY, SessionType, normalizeConsentPurposes, isReadShapedOperation, UserSelf_Operations, } from '@wildo-ai/saas-models';
4
4
  import { useResourceRegistry } from '../../core/resources/useResourceRegistry.js';
5
5
  import { LoggerFrontendService } from '../../core/monitoring/logger.frontend.service.js';
6
6
  import { useEventBus } from '../../core/events/useEventBus.js';
@@ -41,7 +41,7 @@ const RESTORE_RETRY_MAX_DELAY_MS = 30_000;
41
41
  export const UserOrgsContext = createContext(undefined);
42
42
  export const UserOrgsProvider = ({ children }) => {
43
43
  const { doOperation, registry } = useResourceRegistry();
44
- const { emit } = useEventBus();
44
+ const { emit, on } = useEventBus();
45
45
  // Consume auth session context
46
46
  const authSession = useAuthSession();
47
47
  const { auth, tokenStorage, identifyByEmail, authenticateWithPassword, authenticate, getSessionState, isAuthenticated, logout: authLogout, endSession, getSessionEstablishment, getSessionEndReason, initiateOAuth2Login, handleAuthCodeExchange, markSessionRestored, setSessionRestoring, connectWebSocket, } = authSession;
@@ -65,6 +65,13 @@ export const UserOrgsProvider = ({ children }) => {
65
65
  const [organizations, setOrganizations] = useState([]);
66
66
  const [permissions, setPermissions] = useState(null);
67
67
  const [privacy, setPrivacy] = useState(null);
68
+ /**
69
+ * The latest request that may set the person's preferences in state: `recordConsentDecision`'s write and
70
+ * `refreshOwnPreferences`' read each take a number, and only the latest one applies its answer (#1973 review). Two
71
+ * requests resolving in the reverse order would otherwise let an older grant land after a newer withdrawal and start a
72
+ * consent-based provider again, which is the open direction for a consent control.
73
+ */
74
+ const preferencesRequestRef = useRef(0);
68
75
  /**
69
76
  * The TENANT's half of the payload, derived from its preferences record rather than passed
70
77
  * alongside it (#410).
@@ -768,7 +775,8 @@ export const UserOrgsProvider = ({ children }) => {
768
775
  // Depend on the builder alone: the whole AppScope value changes with every custom scope value, and through
769
776
  // this callback it would re-render every `useUserOrgs` consumer.
770
777
  const buildScopeContextualParameters = appScope.buildContextualParameters;
771
- const recordConsentDecision = useCallback(async (grantedPurposes) => {
778
+ const recordConsentDecision = useCallback(async (grantedPurposes, offeredPurposes) => {
779
+ const request = ++preferencesRequestRef.current;
772
780
  const operation = registry.resourceConfigurations[CoreResourceType.USER_SELF_PREFERENCES]?.operations.find((candidate) => candidate.operationIdentifier === CoreResourceOperation.UPDATE
773
781
  && candidate.isOperationDefault === true
774
782
  && candidate.isBulkOperation !== true
@@ -784,19 +792,24 @@ export const UserOrgsProvider = ({ children }) => {
784
792
  contextualParameters: buildScopeContextualParameters(),
785
793
  requestData: {
786
794
  // The client instant is only a CLAIM that this write is a decision; the server replaces it.
787
- privacy: { consentedPurposes: normalizeConsentPurposes(grantedPurposes), consentDecidedAt: new Date() },
795
+ // What was shown is a claim too; the server adds it to what the person has answered (`buildConsentDecisionPatch`).
796
+ privacy: { consentedPurposes: normalizeConsentPurposes(grantedPurposes), offeredPurposes: normalizeConsentPurposes(offeredPurposes), consentDecidedAt: new Date() },
788
797
  },
789
798
  });
790
799
  const storedPrivacy = updated?.privacy;
791
800
  if (!storedPrivacy) {
792
801
  throw new Error('Consent decision was written but the response carried no privacy block');
793
802
  }
794
- setPrivacy(storedPrivacy);
795
- // Updating the user's preferences record re-emits USER_PREFERENCES_CHANGED through the effect
796
- // above, which is how the analytics provider learns the new set without a second channel.
797
- setUser((previous) => previous
798
- ? { ...previous, userSelfPreferences: { ...(previous.userSelfPreferences ?? {}), privacy: storedPrivacy } }
799
- : previous);
803
+ // A later preferences request owns the STATE (see `preferencesRequestRef`); this decision is stored all the same, is
804
+ // returned to its caller, and still re-loads the organizations below, which do not depend on who owns the state.
805
+ if (request === preferencesRequestRef.current) {
806
+ setPrivacy(storedPrivacy);
807
+ // Updating the user's preferences record re-emits USER_PREFERENCES_CHANGED through the effect
808
+ // above, which is how the analytics provider learns the new set without a second channel.
809
+ setUser((previous) => previous
810
+ ? { ...previous, userSelfPreferences: { ...(previous.userSelfPreferences ?? {}), privacy: storedPrivacy } }
811
+ : previous);
812
+ }
800
813
  // While a required purpose was missing the backend refused this person's organization reads, so
801
814
  // session restore may have loaded none (#534 re-review N1). Re-load them now that the decision is
802
815
  // stored; a failure leaves the decision recorded and is retried on the next restore.
@@ -807,6 +820,70 @@ export const UserOrgsProvider = ({ children }) => {
807
820
  }
808
821
  return storedPrivacy;
809
822
  }, [buildScopeContextualParameters, doOperation, registry, organizations.length, refreshOrganizations]);
823
+ /**
824
+ * Take in the person's own preferences after a write made by a surface OTHER than `recordConsentDecision` (#1973).
825
+ *
826
+ * The Preferences page is the generic resource form over `userSelfPreferences`, and it writes through the ordinary
827
+ * UPDATE, not through this provider. Until this existed nothing told the provider about that write, so `privacy`
828
+ * kept the value the page loaded with: an ANALYTICS grant made there did not start the consent-based providers
829
+ * (`ConsentBasedProviderSdksProvider` reads `privacy` through `useGrantedConsentPurposes`), and a WITHDRAWAL did not
830
+ * stop a provider already running, which kept capturing and kept its browser storage until a reload or a sign-out.
831
+ * Measured in a real browser against Wonder Todos with PostHog, 2026-11-16.
832
+ *
833
+ * The record is READ again rather than taken from the event: the event carries the operation, not the stored row,
834
+ * and the server's answer is what decided (`consentDecidedAt` is the server's instant, never the client's claim). The
835
+ * same two updates `recordConsentDecision` makes then follow: `privacy`, and the person's preferences, whose effect
836
+ * re-emits `USER_PREFERENCES_CHANGED` to the language, regional and theme contexts too.
837
+ */
838
+ const refreshOwnPreferences = useCallback(async () => {
839
+ const readOperation = findDefaultApiReadOperation(registry.resourceConfigurations[CoreResourceType.USER_SELF_PREFERENCES]);
840
+ if (!readOperation)
841
+ return;
842
+ const request = ++preferencesRequestRef.current;
843
+ /*
844
+ * Announced with its number, and settled with the same one below (#3928): what the analytics provider holds because
845
+ * of the write waits for THIS answer. A privacy announcement from anywhere else (this provider re-announcing the
846
+ * pre-write record when its organizations change, or an earlier write's read landing late) says nothing about the
847
+ * consent the write left.
848
+ */
849
+ emit(FrontendEvents.OWN_PREFERENCES_REREAD_STARTED, { readId: request });
850
+ let stored;
851
+ try {
852
+ stored = await doOperation(ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(readOperation),
853
+ // Above `ScopedResourceRegistryProvider`, so the user id the route is addressed by is supplied here, as in
854
+ // `recordConsentDecision`.
855
+ { contextualParameters: buildScopeContextualParameters() });
856
+ }
857
+ catch (error) {
858
+ // The consent this write left is unknown: whoever waits on this read is told so, then the caller logs the failure.
859
+ if (request === preferencesRequestRef.current)
860
+ emit(FrontendEvents.OWN_PREFERENCES_REREAD_SETTLED, { readId: request, privacy: null });
861
+ throw error;
862
+ }
863
+ // An older answer than a request started since: the newer one decides (see `preferencesRequestRef`), and settles.
864
+ if (request !== preferencesRequestRef.current)
865
+ return;
866
+ if (!stored) {
867
+ emit(FrontendEvents.OWN_PREFERENCES_REREAD_SETTLED, { readId: request, privacy: null });
868
+ return;
869
+ }
870
+ // A record with no privacy block grants nothing: an absent decision must stop a running consent-based provider, not
871
+ // keep the grant this page held before (#1973 review). `consentDecidedAt` stays absent, as it is on such a record.
872
+ const storedPrivacy = stored.privacy ?? { consentedPurposes: [], offeredPurposes: [] };
873
+ setPrivacy(storedPrivacy);
874
+ const storedRecord = stored;
875
+ setUser((previous) => previous
876
+ ? { ...previous, userSelfPreferences: { ...(previous.userSelfPreferences ?? {}), ...storedRecord, privacy: storedPrivacy } }
877
+ : previous);
878
+ // Before the re-render that re-announces the record: a vendor call this write held is decided against what it left.
879
+ emit(FrontendEvents.OWN_PREFERENCES_REREAD_SETTLED, { readId: request, privacy: storedPrivacy });
880
+ }, [buildScopeContextualParameters, doOperation, emit, registry]);
881
+ useEffect(() => on(FrontendEvents.RESOURCE_OPERATION_EXECUTED, () => {
882
+ void refreshOwnPreferences().catch((error) => {
883
+ logger.warn('The preferences could not be read again after they were written', { error });
884
+ });
885
+ }, (payload) => payload.resourceType === CoreResourceType.USER_SELF_PREFERENCES
886
+ && !isReadShapedOperation(payload.operation ?? { operationIdentifier: payload.operationIdentifier })), [on, refreshOwnPreferences]);
810
887
  /**
811
888
  * Logout wrapper that also clears user/org data
812
889
  */