@squide/firefly 15.0.3 → 15.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @squide/firefly
2
2
 
3
+ ## 15.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#332](https://github.com/workleap/wl-squide/pull/332) [`eb933a7`](https://github.com/workleap/wl-squide/commit/eb933a72514ff3e01f5d3dafa17556e1a07471f6) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Bumpbed dependencies
8
+
9
+ - Updated dependencies [[`eb933a7`](https://github.com/workleap/wl-squide/commit/eb933a72514ff3e01f5d3dafa17556e1a07471f6)]:
10
+ - @squide/module-federation@7.0.4
11
+ - @squide/react-router@8.1.3
12
+ - @squide/core@6.1.3
13
+ - @squide/msw@4.0.4
14
+
15
+ ## 15.0.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [#330](https://github.com/workleap/wl-squide/pull/330) [`09ffa31`](https://github.com/workleap/wl-squide/commit/09ffa3167a82182e7f7793615402ce8b6702f77b) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Bump versions to test OIDC publishing
20
+
21
+ - Updated dependencies [[`09ffa31`](https://github.com/workleap/wl-squide/commit/09ffa3167a82182e7f7793615402ce8b6702f77b)]:
22
+ - @squide/core@6.1.2
23
+ - @squide/module-federation@7.0.3
24
+ - @squide/msw@4.0.3
25
+ - @squide/react-router@8.1.2
26
+
3
27
  ## 15.0.3
4
28
 
5
29
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AppRouterReducer.js","sources":["webpack://@squide/firefly/./src/AppRouterReducer.ts"],"sourcesContent":["import { addLocalModuleRegistrationStatusChangedListener, getLocalModuleRegistrationStatus, removeLocalModuleRegistrationStatusChangedListener, useEventBus, useLogger, useRuntime } from \"@squide/core\";\nimport { addRemoteModuleRegistrationStatusChangedListener, areModulesReady, areModulesRegistered, getRemoteModuleRegistrationStatus, removeRemoteModuleRegistrationStatusChangedListener } from \"@squide/module-federation\";\nimport { addMswStateChangedListener, isMswReady, removeMswStateChangedListener } from \"@squide/msw\";\nimport { useCallback, useEffect, useMemo, useReducer, type Dispatch } from \"react\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\nimport { useAppRouterStore } from \"./useAppRouterStore.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\nimport { isBootstrapping } from \"./useIsBootstrapping.ts\";\n\nexport type ActiveRouteVisiblity = \"unknown\" | \"public\" | \"protected\";\n\nexport interface AppRouterWaitState {\n waitForMsw: boolean;\n waitForPublicData: boolean;\n waitForProtectedData: boolean;\n}\n\nexport interface AppRouterState extends AppRouterWaitState {\n areModulesRegistered: boolean;\n areModulesReady: boolean;\n isMswReady: boolean;\n isPublicDataReady: boolean;\n isProtectedDataReady: boolean;\n publicDataUpdatedAt?: number;\n protectedDataUpdatedAt?: number;\n deferredRegistrationsUpdatedAt?: number;\n activeRouteVisibility: ActiveRouteVisiblity;\n isUnauthorized: boolean;\n}\n\nexport type AppRouterActionType =\n| \"modules-registered\"\n| \"modules-ready\"\n| \"msw-ready\"\n| \"public-data-ready\"\n| \"protected-data-ready\"\n| \"public-data-updated\"\n| \"protected-data-updated\"\n| \"deferred-registrations-updated\"\n| \"active-route-is-public\"\n| \"active-route-is-protected\"\n| \"is-unauthorized\";\n\n// The followings event const are a concatenation of \"squide-\" with AppRouterActionType.\n// They are dispatched by the useEnhancedReducerDispatch hook.\nexport const ModulesRegisteredEvent = \"squide-modules-registered\";\nexport const ModulesReadyEvent = \"squide-modules-ready\";\nexport const MswReadyEvent = \"squide-msw-ready\";\nexport const ActiveRouteIsPublicEvent = \"squide-active-route-is-public\";\nexport const ActiveRouteIsProtectedEvent = \"squide-active-route-is-protected\";\nexport const PublicDataReadyEvent = \"squide-public-data-ready\";\nexport const ProtectedDataReadyEvent = \"squide-protected-data-ready\";\nexport const PublicDataUpdatedEvent = \"squide-public-data-updated\";\nexport const ProtectedDataUpdatedEvent = \"squide-protected-data-updated\";\nexport const DeferredRegistrationsUpdatedEvent = \"squide-deferred-registrations-updated\";\nexport const ApplicationBoostrappedEvent = \"squide-app-boostrapped\";\n\nexport interface AppRouterAction {\n type: AppRouterActionType;\n payload?: unknown;\n}\n\nexport type AppRouterDispatch = Dispatch<AppRouterAction>;\n\nfunction reducer(state: AppRouterState, action: AppRouterAction) {\n let newState = state;\n\n switch (action.type) {\n case \"modules-registered\": {\n newState = {\n ...newState,\n areModulesRegistered: true\n };\n\n break;\n }\n case \"modules-ready\": {\n newState = {\n ...newState,\n areModulesReady: true,\n // Will be set even if the app is not using deferred registrations.\n deferredRegistrationsUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"msw-ready\": {\n newState = {\n ...newState,\n isMswReady: true\n };\n\n break;\n }\n case \"public-data-ready\": {\n newState = {\n ...newState,\n isPublicDataReady: true,\n publicDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"protected-data-ready\": {\n newState = {\n ...newState,\n isProtectedDataReady: true,\n protectedDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"public-data-updated\": {\n newState = {\n ...newState,\n publicDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"protected-data-updated\": {\n newState = {\n ...newState,\n protectedDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"deferred-registrations-updated\": {\n newState = {\n ...newState,\n deferredRegistrationsUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"active-route-is-public\": {\n newState = {\n ...newState,\n activeRouteVisibility: \"public\"\n };\n\n break;\n }\n case \"active-route-is-protected\": {\n newState = {\n ...newState,\n activeRouteVisibility: \"protected\"\n };\n\n break;\n }\n case \"is-unauthorized\": {\n newState = {\n ...newState,\n isUnauthorized: true\n };\n\n break;\n }\n default: {\n throw new Error(`[squide] The AppRouter component state reducer doesn't support action type \"${action.type}\".`);\n }\n }\n\n return newState;\n}\n\nexport function getAreModulesRegistered() {\n const localModuleStatus = getLocalModuleRegistrationStatus();\n const remoteModuleStatus = getRemoteModuleRegistrationStatus();\n\n return areModulesRegistered(localModuleStatus, remoteModuleStatus);\n}\n\nexport function getAreModulesReady() {\n const localModuleStatus = getLocalModuleRegistrationStatus();\n const remoteModuleStatus = getRemoteModuleRegistrationStatus();\n\n return areModulesReady(localModuleStatus, remoteModuleStatus);\n}\n\nexport function useModuleRegistrationStatusDispatcher(areModulesRegisteredValue: boolean, areModulesReadyValue: boolean, dispatch: AppRouterDispatch) {\n const logger = useLogger();\n\n const dispatchModulesRegistered = useExecuteOnce(useCallback(() => {\n if (getAreModulesRegistered()) {\n dispatch({ type: \"modules-registered\" });\n\n logger\n .withText(\"[squide] Modules are registered.\", {\n style: {\n color: \"green\"\n }\n })\n .information();\n\n return true;\n }\n\n return false;\n }, [dispatch, logger]));\n\n const dispatchModulesReady = useExecuteOnce(useCallback(() => {\n if (getAreModulesReady()) {\n dispatch({ type: \"modules-ready\" });\n\n logger\n .withText(\"[squide] Modules are ready.\", {\n style: {\n color: \"green\"\n }\n })\n .information();\n\n return true;\n }\n\n return false;\n }, [dispatch, logger]));\n\n return useEffect(() => {\n if (!areModulesRegisteredValue) {\n addLocalModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n addRemoteModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n }\n\n if (!areModulesReadyValue) {\n addLocalModuleRegistrationStatusChangedListener(dispatchModulesReady);\n addRemoteModuleRegistrationStatusChangedListener(dispatchModulesReady);\n }\n\n return () => {\n removeLocalModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n removeRemoteModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n\n removeLocalModuleRegistrationStatusChangedListener(dispatchModulesReady);\n removeRemoteModuleRegistrationStatusChangedListener(dispatchModulesReady);\n };\n }, [areModulesRegisteredValue, areModulesReadyValue, dispatchModulesRegistered, dispatchModulesReady]);\n}\n\nexport function useMswStatusDispatcher(isMswReadyValue: boolean, dispatch: AppRouterDispatch) {\n const logger = useLogger();\n\n const dispatchMswReady = useExecuteOnce(useCallback(() => {\n if (isMswReady()) {\n dispatch({ type: \"msw-ready\" });\n\n logger\n .withText(\"[squide] MSW is ready.\", {\n style: {\n color: \"green\"\n }\n })\n .information();\n\n return true;\n }\n\n return false;\n }, [dispatch, logger]));\n\n useEffect(() => {\n if (!isMswReadyValue) {\n addMswStateChangedListener(dispatchMswReady);\n }\n\n return () => {\n removeMswStateChangedListener(dispatchMswReady);\n };\n }, [isMswReadyValue, dispatchMswReady]);\n}\n\nfunction useBootstrappingCompletedDispatcher(waitState: AppRouterWaitState, state: AppRouterState) {\n const eventBus = useEventBus();\n\n const areModulesRegisteredValue = state.areModulesRegistered;\n const isBoostrapping = isBootstrapping(state);\n\n useExecuteOnce(useCallback(() => {\n if (areModulesRegisteredValue && !isBoostrapping) {\n eventBus.dispatch(ApplicationBoostrappedEvent, waitState);\n\n return true;\n }\n\n return false;\n }, [areModulesRegisteredValue, isBoostrapping, waitState, eventBus]), true);\n}\n\nlet dispatchProxyFactory: ((reactDispatch: AppRouterDispatch) => AppRouterDispatch) | undefined;\n\n// This function should only be used by tests.\nexport function __setAppReducerDispatchProxyFactory(factory: (reactDispatch: AppRouterDispatch) => AppRouterDispatch) {\n dispatchProxyFactory = factory;\n}\n\n// This function should only be used by tests.\nexport function __clearAppReducerDispatchProxy() {\n dispatchProxyFactory = undefined;\n}\n\nfunction useReducerDispatchProxy(reactDispatch: AppRouterDispatch) {\n return useMemo(() => {\n return dispatchProxyFactory ? dispatchProxyFactory(reactDispatch) : reactDispatch;\n }, [reactDispatch]);\n}\n\nfunction useEnhancedReducerDispatch(waitState: AppRouterWaitState, reducerDispatch: AppRouterDispatch) {\n const logger = useLogger();\n const appRouterStore = useAppRouterStore();\n const eventBus = useEventBus();\n\n return useCallback((action: AppRouterAction) => {\n logger\n .withText(\"[squide] The following action has been dispatched to the AppRouter reducer:\")\n .withObject(action)\n .debug();\n\n appRouterStore.dispatch({ ...action, payload: waitState });\n eventBus.dispatch(`squide-${action.type}`, waitState);\n\n reducerDispatch(action);\n }, [waitState, reducerDispatch, logger, appRouterStore, eventBus]);\n}\n\nexport function useAppRouterReducer(waitForPublicData: boolean, waitForProtectedData: boolean): [AppRouterState, AppRouterDispatch] {\n const runtime = useRuntime() as FireflyRuntime;\n const eventBus = useEventBus();\n const appRouterStore = useAppRouterStore();\n\n const isMswEnabled = runtime.isMswEnabled;\n\n const areModulesInitiallyRegistered = getAreModulesRegistered();\n const areModulesInitiallyReady = getAreModulesReady();\n const isMswInitiallyReady = isMswReady();\n\n const waitState = useMemo(() => ({\n waitForMsw: isMswEnabled,\n waitForPublicData,\n waitForProtectedData\n }), [isMswEnabled, waitForPublicData, waitForProtectedData]);\n\n const initialState = useMemo(() => ({\n waitForMsw: waitState.waitForMsw,\n waitForPublicData: waitState.waitForPublicData,\n waitForProtectedData: waitState.waitForProtectedData,\n // When the modules registration functions are awaited, the event listeners are registered after the modules are registered.\n areModulesRegistered: areModulesInitiallyRegistered,\n areModulesReady: areModulesInitiallyReady,\n isMswReady: isMswInitiallyReady,\n isPublicDataReady: false,\n isProtectedDataReady: false,\n activeRouteVisibility: \"unknown\",\n isUnauthorized: false\n } satisfies AppRouterState), [waitState, areModulesInitiallyRegistered, areModulesInitiallyReady, isMswInitiallyReady]);\n\n // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.\n // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.\n useExecuteOnce(useCallback(() => {\n if (areModulesInitiallyRegistered) {\n appRouterStore.dispatch({ type: \"modules-registered\", payload: waitState });\n eventBus.dispatch(ModulesRegisteredEvent, waitState);\n }\n\n return true;\n }, [areModulesInitiallyRegistered, appRouterStore, eventBus, waitState]), true);\n\n // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.\n // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.\n useExecuteOnce(useCallback(() => {\n if (areModulesInitiallyReady) {\n appRouterStore.dispatch({ type: \"modules-ready\", payload: waitState });\n eventBus.dispatch(ModulesReadyEvent, waitState);\n }\n\n return true;\n }, [areModulesInitiallyReady, appRouterStore, eventBus, waitState]), true);\n\n // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.\n // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.\n useExecuteOnce(useCallback(() => {\n if (isMswInitiallyReady) {\n appRouterStore.dispatch({ type: \"msw-ready\", payload: waitState });\n eventBus.dispatch(MswReadyEvent, waitState);\n }\n\n return true;\n }, [isMswInitiallyReady, appRouterStore, eventBus, waitState]), true);\n\n const [state, reactDispatch] = useReducer(reducer, initialState);\n\n const {\n areModulesRegistered: areModulesRegisteredValue,\n areModulesReady: areModulesReadyValue,\n isMswReady: isMswReadyValue\n } = state;\n\n // The dispatch proxy is strictly an utility allowing tests to mock the useReducer dispatch function. It's easier\n // than mocking the import from React.\n const dispatchProxy = useReducerDispatchProxy(reactDispatch);\n const dispatch = useEnhancedReducerDispatch(waitState, dispatchProxy);\n\n useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areModulesReadyValue, dispatch);\n useMswStatusDispatcher(isMswReadyValue, dispatch);\n useBootstrappingCompletedDispatcher(waitState, state);\n\n return [state, dispatch];\n}\n"],"names":["addLocalModuleRegistrationStatusChangedListener","getLocalModuleRegistrationStatus","removeLocalModuleRegistrationStatusChangedListener","useEventBus","useLogger","useRuntime","addRemoteModuleRegistrationStatusChangedListener","areModulesReady","areModulesRegistered","getRemoteModuleRegistrationStatus","removeRemoteModuleRegistrationStatusChangedListener","addMswStateChangedListener","isMswReady","removeMswStateChangedListener","useCallback","useEffect","useMemo","useReducer","useAppRouterStore","useExecuteOnce","isBootstrapping","ModulesRegisteredEvent","ModulesReadyEvent","MswReadyEvent","ActiveRouteIsPublicEvent","ActiveRouteIsProtectedEvent","PublicDataReadyEvent","ProtectedDataReadyEvent","PublicDataUpdatedEvent","ProtectedDataUpdatedEvent","DeferredRegistrationsUpdatedEvent","ApplicationBoostrappedEvent","reducer","state","action","newState","Date","Error","getAreModulesRegistered","localModuleStatus","remoteModuleStatus","getAreModulesReady","useModuleRegistrationStatusDispatcher","areModulesRegisteredValue","areModulesReadyValue","dispatch","logger","dispatchModulesRegistered","dispatchModulesReady","useMswStatusDispatcher","isMswReadyValue","dispatchMswReady","useBootstrappingCompletedDispatcher","waitState","eventBus","isBoostrapping","dispatchProxyFactory","__setAppReducerDispatchProxyFactory","factory","__clearAppReducerDispatchProxy","undefined","useReducerDispatchProxy","reactDispatch","useEnhancedReducerDispatch","reducerDispatch","appRouterStore","useAppRouterReducer","waitForPublicData","waitForProtectedData","runtime","isMswEnabled","areModulesInitiallyRegistered","areModulesInitiallyReady","isMswInitiallyReady","initialState","dispatchProxy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAyM;AACmB;AACxH;AACjB;AAExB;AACN;AACK;AAoC1D,wFAAwF;AACxF,8DAA8D;AACvD,MAAMqB,yBAAyB,4BAA4B;AAC3D,MAAMC,oBAAoB,uBAAuB;AACjD,MAAMC,gBAAgB,mBAAmB;AACzC,MAAMC,2BAA2B,gCAAgC;AACjE,MAAMC,8BAA8B,mCAAmC;AACvE,MAAMC,uBAAuB,2BAA2B;AACxD,MAAMC,0BAA0B,8BAA8B;AAC9D,MAAMC,yBAAyB,6BAA6B;AAC5D,MAAMC,4BAA4B,gCAAgC;AAClE,MAAMC,oCAAoC,wCAAwC;AAClF,MAAMC,8BAA8B,yBAAyB;AASpE,SAASC,QAAQC,KAAqB,EAAEC,MAAuB;IAC3D,IAAIC,WAAWF;IAEf,OAAQC,OAAO,IAAI;QACf,KAAK;YAAsB;gBACvBC,WAAW;oBACP,GAAGA,QAAQ;oBACX,sBAAsB;gBAC1B;gBAEA;YACJ;QACA,KAAK;YAAiB;gBAClBA,WAAW;oBACP,GAAGA,QAAQ;oBACX,iBAAiB;oBACjB,mEAAmE;oBACnE,gCAAgCC,KAAK,GAAG;gBAC5C;gB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B;QACzC;QAEA,OAAO;IACX,GAAG;QAACmB;QAA0BP;QAAgBX;QAAUD;KAAU,GAAG;IAErE,2IAA2I;IAC3I,6HAA6H;IAC7HlC,cAAcA,CAACL,WAAWA,CAAC;QACvB,IAAI2D,qBAAqB;YACrBR,eAAe,QAAQ,CAAC;gBAAE,MAAM;gBAAa,SAASZ;YAAU;YAChEC,SAAS,QAAQ,CAAC/B,eAAe8B;QACrC;QAEA,OAAO;IACX,GAAG;QAACoB;QAAqBR;QAAgBX;QAAUD;KAAU,GAAG;IAEhE,MAAM,CAACpB,OAAO6B,cAAc,GAAG7C,UAAUA,CAACe,SAAS0C;IAEnD,MAAM,EACF,sBAAsB/B,yBAAyB,EAC/C,iBAAiBC,oBAAoB,EACrC,YAAYM,eAAe,EAC9B,GAAGjB;IAEJ,iHAAiH;IACjH,sCAAsC;IACtC,MAAM0C,gBAAgBd,wBAAwBC;IAC9C,MAAMjB,WAAWkB,2BAA2BV,WAAWsB;IAEvDjC,sCAAsCC,2BAA2BC,sBAAsBC;IACvFI,uBAAuBC,iBAAiBL;IACxCO,oCAAoCC,WAAWpB;IAE/C,OAAO;QAACA;QAAOY;KAAS;AAC5B"}
1
+ {"version":3,"file":"AppRouterReducer.js","sources":["webpack://@squide/firefly/./src/AppRouterReducer.ts"],"sourcesContent":["import { addLocalModuleRegistrationStatusChangedListener, getLocalModuleRegistrationStatus, removeLocalModuleRegistrationStatusChangedListener, useEventBus, useLogger, useRuntime } from \"@squide/core\";\nimport { addRemoteModuleRegistrationStatusChangedListener, areModulesReady, areModulesRegistered, getRemoteModuleRegistrationStatus, removeRemoteModuleRegistrationStatusChangedListener } from \"@squide/module-federation\";\nimport { addMswStateChangedListener, isMswReady, removeMswStateChangedListener } from \"@squide/msw\";\nimport { useCallback, useEffect, useMemo, useReducer, type Dispatch } from \"react\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\nimport { useAppRouterStore } from \"./useAppRouterStore.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\nimport { isBootstrapping } from \"./useIsBootstrapping.ts\";\n\nexport type ActiveRouteVisiblity = \"unknown\" | \"public\" | \"protected\";\n\nexport interface AppRouterWaitState {\n waitForMsw: boolean;\n waitForPublicData: boolean;\n waitForProtectedData: boolean;\n}\n\nexport interface AppRouterState extends AppRouterWaitState {\n areModulesRegistered: boolean;\n areModulesReady: boolean;\n isMswReady: boolean;\n isPublicDataReady: boolean;\n isProtectedDataReady: boolean;\n publicDataUpdatedAt?: number;\n protectedDataUpdatedAt?: number;\n deferredRegistrationsUpdatedAt?: number;\n activeRouteVisibility: ActiveRouteVisiblity;\n isUnauthorized: boolean;\n}\n\nexport type AppRouterActionType =\n | \"modules-registered\"\n | \"modules-ready\"\n | \"msw-ready\"\n | \"public-data-ready\"\n | \"protected-data-ready\"\n | \"public-data-updated\"\n | \"protected-data-updated\"\n | \"deferred-registrations-updated\"\n | \"active-route-is-public\"\n | \"active-route-is-protected\"\n | \"is-unauthorized\";\n\n// The followings event const are a concatenation of \"squide-\" with AppRouterActionType.\n// They are dispatched by the useEnhancedReducerDispatch hook.\nexport const ModulesRegisteredEvent = \"squide-modules-registered\";\nexport const ModulesReadyEvent = \"squide-modules-ready\";\nexport const MswReadyEvent = \"squide-msw-ready\";\nexport const ActiveRouteIsPublicEvent = \"squide-active-route-is-public\";\nexport const ActiveRouteIsProtectedEvent = \"squide-active-route-is-protected\";\nexport const PublicDataReadyEvent = \"squide-public-data-ready\";\nexport const ProtectedDataReadyEvent = \"squide-protected-data-ready\";\nexport const PublicDataUpdatedEvent = \"squide-public-data-updated\";\nexport const ProtectedDataUpdatedEvent = \"squide-protected-data-updated\";\nexport const DeferredRegistrationsUpdatedEvent = \"squide-deferred-registrations-updated\";\nexport const ApplicationBoostrappedEvent = \"squide-app-boostrapped\";\n\nexport interface AppRouterAction {\n type: AppRouterActionType;\n payload?: unknown;\n}\n\nexport type AppRouterDispatch = Dispatch<AppRouterAction>;\n\nfunction reducer(state: AppRouterState, action: AppRouterAction) {\n let newState = state;\n\n switch (action.type) {\n case \"modules-registered\": {\n newState = {\n ...newState,\n areModulesRegistered: true\n };\n\n break;\n }\n case \"modules-ready\": {\n newState = {\n ...newState,\n areModulesReady: true,\n // Will be set even if the app is not using deferred registrations.\n deferredRegistrationsUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"msw-ready\": {\n newState = {\n ...newState,\n isMswReady: true\n };\n\n break;\n }\n case \"public-data-ready\": {\n newState = {\n ...newState,\n isPublicDataReady: true,\n publicDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"protected-data-ready\": {\n newState = {\n ...newState,\n isProtectedDataReady: true,\n protectedDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"public-data-updated\": {\n newState = {\n ...newState,\n publicDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"protected-data-updated\": {\n newState = {\n ...newState,\n protectedDataUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"deferred-registrations-updated\": {\n newState = {\n ...newState,\n deferredRegistrationsUpdatedAt: Date.now()\n };\n\n break;\n }\n case \"active-route-is-public\": {\n newState = {\n ...newState,\n activeRouteVisibility: \"public\"\n };\n\n break;\n }\n case \"active-route-is-protected\": {\n newState = {\n ...newState,\n activeRouteVisibility: \"protected\"\n };\n\n break;\n }\n case \"is-unauthorized\": {\n newState = {\n ...newState,\n isUnauthorized: true\n };\n\n break;\n }\n default: {\n throw new Error(`[squide] The AppRouter component state reducer doesn't support action type \"${action.type}\".`);\n }\n }\n\n return newState;\n}\n\nexport function getAreModulesRegistered() {\n const localModuleStatus = getLocalModuleRegistrationStatus();\n const remoteModuleStatus = getRemoteModuleRegistrationStatus();\n\n return areModulesRegistered(localModuleStatus, remoteModuleStatus);\n}\n\nexport function getAreModulesReady() {\n const localModuleStatus = getLocalModuleRegistrationStatus();\n const remoteModuleStatus = getRemoteModuleRegistrationStatus();\n\n return areModulesReady(localModuleStatus, remoteModuleStatus);\n}\n\nexport function useModuleRegistrationStatusDispatcher(areModulesRegisteredValue: boolean, areModulesReadyValue: boolean, dispatch: AppRouterDispatch) {\n const logger = useLogger();\n\n const dispatchModulesRegistered = useExecuteOnce(useCallback(() => {\n if (getAreModulesRegistered()) {\n dispatch({ type: \"modules-registered\" });\n\n logger\n .withText(\"[squide] Modules are registered.\", {\n style: {\n color: \"green\"\n }\n })\n .information();\n\n return true;\n }\n\n return false;\n }, [dispatch, logger]));\n\n const dispatchModulesReady = useExecuteOnce(useCallback(() => {\n if (getAreModulesReady()) {\n dispatch({ type: \"modules-ready\" });\n\n logger\n .withText(\"[squide] Modules are ready.\", {\n style: {\n color: \"green\"\n }\n })\n .information();\n\n return true;\n }\n\n return false;\n }, [dispatch, logger]));\n\n return useEffect(() => {\n if (!areModulesRegisteredValue) {\n addLocalModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n addRemoteModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n }\n\n if (!areModulesReadyValue) {\n addLocalModuleRegistrationStatusChangedListener(dispatchModulesReady);\n addRemoteModuleRegistrationStatusChangedListener(dispatchModulesReady);\n }\n\n return () => {\n removeLocalModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n removeRemoteModuleRegistrationStatusChangedListener(dispatchModulesRegistered);\n\n removeLocalModuleRegistrationStatusChangedListener(dispatchModulesReady);\n removeRemoteModuleRegistrationStatusChangedListener(dispatchModulesReady);\n };\n }, [areModulesRegisteredValue, areModulesReadyValue, dispatchModulesRegistered, dispatchModulesReady]);\n}\n\nexport function useMswStatusDispatcher(isMswReadyValue: boolean, dispatch: AppRouterDispatch) {\n const logger = useLogger();\n\n const dispatchMswReady = useExecuteOnce(useCallback(() => {\n if (isMswReady()) {\n dispatch({ type: \"msw-ready\" });\n\n logger\n .withText(\"[squide] MSW is ready.\", {\n style: {\n color: \"green\"\n }\n })\n .information();\n\n return true;\n }\n\n return false;\n }, [dispatch, logger]));\n\n useEffect(() => {\n if (!isMswReadyValue) {\n addMswStateChangedListener(dispatchMswReady);\n }\n\n return () => {\n removeMswStateChangedListener(dispatchMswReady);\n };\n }, [isMswReadyValue, dispatchMswReady]);\n}\n\nfunction useBootstrappingCompletedDispatcher(waitState: AppRouterWaitState, state: AppRouterState) {\n const eventBus = useEventBus();\n\n const areModulesRegisteredValue = state.areModulesRegistered;\n const isBoostrapping = isBootstrapping(state);\n\n useExecuteOnce(useCallback(() => {\n if (areModulesRegisteredValue && !isBoostrapping) {\n eventBus.dispatch(ApplicationBoostrappedEvent, waitState);\n\n return true;\n }\n\n return false;\n }, [areModulesRegisteredValue, isBoostrapping, waitState, eventBus]), true);\n}\n\nlet dispatchProxyFactory: ((reactDispatch: AppRouterDispatch) => AppRouterDispatch) | undefined;\n\n// This function should only be used by tests.\nexport function __setAppReducerDispatchProxyFactory(factory: (reactDispatch: AppRouterDispatch) => AppRouterDispatch) {\n dispatchProxyFactory = factory;\n}\n\n// This function should only be used by tests.\nexport function __clearAppReducerDispatchProxy() {\n dispatchProxyFactory = undefined;\n}\n\nfunction useReducerDispatchProxy(reactDispatch: AppRouterDispatch) {\n return useMemo(() => {\n return dispatchProxyFactory ? dispatchProxyFactory(reactDispatch) : reactDispatch;\n }, [reactDispatch]);\n}\n\nfunction useEnhancedReducerDispatch(waitState: AppRouterWaitState, reducerDispatch: AppRouterDispatch) {\n const logger = useLogger();\n const appRouterStore = useAppRouterStore();\n const eventBus = useEventBus();\n\n return useCallback((action: AppRouterAction) => {\n logger\n .withText(\"[squide] The following action has been dispatched to the AppRouter reducer:\")\n .withObject(action)\n .debug();\n\n appRouterStore.dispatch({ ...action, payload: waitState });\n eventBus.dispatch(`squide-${action.type}`, waitState);\n\n reducerDispatch(action);\n }, [waitState, reducerDispatch, logger, appRouterStore, eventBus]);\n}\n\nexport function useAppRouterReducer(waitForPublicData: boolean, waitForProtectedData: boolean): [AppRouterState, AppRouterDispatch] {\n const runtime = useRuntime() as FireflyRuntime;\n const eventBus = useEventBus();\n const appRouterStore = useAppRouterStore();\n\n const isMswEnabled = runtime.isMswEnabled;\n\n const areModulesInitiallyRegistered = getAreModulesRegistered();\n const areModulesInitiallyReady = getAreModulesReady();\n const isMswInitiallyReady = isMswReady();\n\n const waitState = useMemo(() => ({\n waitForMsw: isMswEnabled,\n waitForPublicData,\n waitForProtectedData\n }), [isMswEnabled, waitForPublicData, waitForProtectedData]);\n\n const initialState = useMemo(() => ({\n waitForMsw: waitState.waitForMsw,\n waitForPublicData: waitState.waitForPublicData,\n waitForProtectedData: waitState.waitForProtectedData,\n // When the modules registration functions are awaited, the event listeners are registered after the modules are registered.\n areModulesRegistered: areModulesInitiallyRegistered,\n areModulesReady: areModulesInitiallyReady,\n isMswReady: isMswInitiallyReady,\n isPublicDataReady: false,\n isProtectedDataReady: false,\n activeRouteVisibility: \"unknown\",\n isUnauthorized: false\n } satisfies AppRouterState), [waitState, areModulesInitiallyRegistered, areModulesInitiallyReady, isMswInitiallyReady]);\n\n // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.\n // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.\n useExecuteOnce(useCallback(() => {\n if (areModulesInitiallyRegistered) {\n appRouterStore.dispatch({ type: \"modules-registered\", payload: waitState });\n eventBus.dispatch(ModulesRegisteredEvent, waitState);\n }\n\n return true;\n }, [areModulesInitiallyRegistered, appRouterStore, eventBus, waitState]), true);\n\n // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.\n // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.\n useExecuteOnce(useCallback(() => {\n if (areModulesInitiallyReady) {\n appRouterStore.dispatch({ type: \"modules-ready\", payload: waitState });\n eventBus.dispatch(ModulesReadyEvent, waitState);\n }\n\n return true;\n }, [areModulesInitiallyReady, appRouterStore, eventBus, waitState]), true);\n\n // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.\n // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.\n useExecuteOnce(useCallback(() => {\n if (isMswInitiallyReady) {\n appRouterStore.dispatch({ type: \"msw-ready\", payload: waitState });\n eventBus.dispatch(MswReadyEvent, waitState);\n }\n\n return true;\n }, [isMswInitiallyReady, appRouterStore, eventBus, waitState]), true);\n\n const [state, reactDispatch] = useReducer(reducer, initialState);\n\n const {\n areModulesRegistered: areModulesRegisteredValue,\n areModulesReady: areModulesReadyValue,\n isMswReady: isMswReadyValue\n } = state;\n\n // The dispatch proxy is strictly an utility allowing tests to mock the useReducer dispatch function. It's easier\n // than mocking the import from React.\n const dispatchProxy = useReducerDispatchProxy(reactDispatch);\n const dispatch = useEnhancedReducerDispatch(waitState, dispatchProxy);\n\n useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areModulesReadyValue, dispatch);\n useMswStatusDispatcher(isMswReadyValue, dispatch);\n useBootstrappingCompletedDispatcher(waitState, state);\n\n return [state, dispatch];\n}\n"],"names":["addLocalModuleRegistrationStatusChangedListener","getLocalModuleRegistrationStatus","removeLocalModuleRegistrationStatusChangedListener","useEventBus","useLogger","useRuntime","addRemoteModuleRegistrationStatusChangedListener","areModulesReady","areModulesRegistered","getRemoteModuleRegistrationStatus","removeRemoteModuleRegistrationStatusChangedListener","addMswStateChangedListener","isMswReady","removeMswStateChangedListener","useCallback","useEffect","useMemo","useReducer","useAppRouterStore","useExecuteOnce","isBootstrapping","ModulesRegisteredEvent","ModulesReadyEvent","MswReadyEvent","ActiveRouteIsPublicEvent","ActiveRouteIsProtectedEvent","PublicDataReadyEvent","ProtectedDataReadyEvent","PublicDataUpdatedEvent","ProtectedDataUpdatedEvent","DeferredRegistrationsUpdatedEvent","ApplicationBoostrappedEvent","reducer","state","action","newState","Date","Error","getAreModulesRegistered","localModuleStatus","remoteModuleStatus","getAreModulesReady","useModuleRegistrationStatusDispatcher","areModulesRegisteredValue","areModulesReadyValue","dispatch","logger","dispatchModulesRegistered","dispatchModulesReady","useMswStatusDispatcher","isMswReadyValue","dispatchMswReady","useBootstrappingCompletedDispatcher","waitState","eventBus","isBoostrapping","dispatchProxyFactory","__setAppReducerDispatchProxyFactory","factory","__clearAppReducerDispatchProxy","undefined","useReducerDispatchProxy","reactDispatch","useEnhancedReducerDispatch","reducerDispatch","appRouterStore","useAppRouterReducer","waitForPublicData","waitForProtectedData","runtime","isMswEnabled","areModulesInitiallyRegistered","areModulesInitiallyReady","isMswInitiallyReady","initialState","dispatchProxy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAyM;AACmB;AACxH;AACjB;AAExB;AACN;AACK;AAoC1D,wFAAwF;AACxF,8DAA8D;AACvD,MAAMqB,yBAAyB,4BAA4B;AAC3D,MAAMC,oBAAoB,uBAAuB;AACjD,MAAMC,gBAAgB,mBAAmB;AACzC,MAAMC,2BAA2B,gCAAgC;AACjE,MAAMC,8BAA8B,mCAAmC;AACvE,MAAMC,uBAAuB,2BAA2B;AACxD,MAAMC,0BAA0B,8BAA8B;AAC9D,MAAMC,yBAAyB,6BAA6B;AAC5D,MAAMC,4BAA4B,gCAAgC;AAClE,MAAMC,oCAAoC,wCAAwC;AAClF,MAAMC,8BAA8B,yBAAyB;AASpE,SAASC,QAAQC,KAAqB,EAAEC,MAAuB;IAC3D,IAAIC,WAAWF;IAEf,OAAQC,OAAO,IAAI;QACf,KAAK;YAAsB;gBACvBC,WAAW;oBACP,GAAGA,QAAQ;oBACX,sBAAsB;gBAC1B;gBAEA;YACJ;QACA,KAAK;YAAiB;gBAClBA,WAAW;oBACP,GAAGA,QAAQ;oBACX,iBAAiB;oBACjB,mEAAmE;oBACnE,gCAAgCC,KAAK,GAAG;gBAC5C;gBAEA;YACJ;QACA,KAAK;YAAa;gBACdD,WAAW;oBACP,GAAGA,QAAQ;oBACX,YAAY;gBAChB;gBAEA;YACJ;QACA,KAAK;YAAqB;gBACtBA,WAAW;oBACP,GAAGA,QAAQ;oBACX,mBAAmB;oBACnB,qBAAqBC,KAAK,GAAG;gBACjC;gBAEA;YACJ;QACA,KAAK;YAAwB;gBACzBD,WAAW;oBACP,GAAGA,Q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8B;QACrC;QAEA,OAAO;IACX,GAAG;QAACoB;QAAqBR;QAAgBX;QAAUD;KAAU,GAAG;IAEhE,MAAM,CAACpB,OAAO6B,cAAc,GAAG7C,UAAUA,CAACe,SAAS0C;IAEnD,MAAM,EACF,sBAAsB/B,yBAAyB,EAC/C,iBAAiBC,oBAAoB,EACrC,YAAYM,eAAe,EAC9B,GAAGjB;IAEJ,iHAAiH;IACjH,sCAAsC;IACtC,MAAM0C,gBAAgBd,wBAAwBC;IAC9C,MAAMjB,WAAWkB,2BAA2BV,WAAWsB;IAEvDjC,sCAAsCC,2BAA2BC,sBAAsBC;IACvFI,uBAAuBC,iBAAiBL;IACxCO,oCAAoCC,WAAWpB;IAE/C,OAAO;QAACA;QAAOY;KAAS;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (runtime.honeycombInstrumentationClient) {\n try {\n // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries\n // if Honeycomb instrumentation is not registered by the hosting application.\n const mod = await import(\"./registerHoneycombInstrumentation.ts\");\n\n mod.registerHoneycombInstrumentation(runtime);\n } catch (error: unknown) {\n runtime.logger.error(\"[squide] Failed to register Honeycomb instrumentation. The \\\"./registerHoneycombInstrumentation.ts\\\" file cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.information(\"[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.\");\n }\n}\n\n\n"],"names":["initializeHoneycomb","runtime","mod","error"],"mappings":";;AAEO,eAAeA,oBAAoBC,OAAuB;IAC7D,IAAIA,QAAQ,8BAA8B,EAAE;QACxC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMC,MAAM,MAAM,+CAA+C;YAEjEA,IAAI,gCAAgC,CAACD;QACzC,EAAE,OAAOE,OAAgB;YACrBF,QAAQ,MAAM,CAAC,KAAK,CAAC;YAErB,MAAME;QACV;IACJ,OAAO;QACHF,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B;AACJ"}
1
+ {"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (runtime.honeycombInstrumentationClient) {\n try {\n // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries\n // if Honeycomb instrumentation is not registered by the hosting application.\n const mod = await import(\"./registerHoneycombInstrumentation.ts\");\n\n mod.registerHoneycombInstrumentation(runtime);\n } catch (error: unknown) {\n runtime.logger.error(\"[squide] Failed to register Honeycomb instrumentation. The \\\"./registerHoneycombInstrumentation.ts\\\" file cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.information(\"[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.\");\n }\n}\n"],"names":["initializeHoneycomb","runtime","mod","error"],"mappings":";;AAEO,eAAeA,oBAAoBC,OAAuB;IAC7D,IAAIA,QAAQ,8BAA8B,EAAE;QACxC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMC,MAAM,MAAM,+CAA+C;YAEjEA,IAAI,gCAAgC,CAACD;QACzC,EAAE,OAAOE,OAAgB;YACrBF,QAAQ,MAAM,CAAC,KAAK,CAAC;YAErB,MAAME;QACV;IACJ,OAAO;QACHF,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B;AACJ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@squide/firefly",
3
3
  "author": "Workleap",
4
- "version": "15.0.3",
4
+ "version": "15.0.5",
5
5
  "description": "Helpers to facilitate the creation of an application with the Squide firefly technology stack.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -24,46 +24,44 @@
24
24
  "files": [
25
25
  "src",
26
26
  "dist",
27
- "CHANGELOG.md",
28
- "README.md"
27
+ "CHANGELOG.md"
29
28
  ],
30
29
  "peerDependencies": {
31
30
  "@opentelemetry/api": "^1.9.0",
32
- "@tanstack/react-query": "^5.90.2",
33
- "msw": "^2.11.3",
31
+ "@tanstack/react-query": "^5.90.5",
32
+ "msw": "^2.11.6",
34
33
  "react": "^18.0.0 || ^19.0.0",
35
34
  "react-dom": "^18.0.0 || ^19.0.0",
36
- "react-router": "^7.9.3"
35
+ "react-router": "^7.9.4"
37
36
  },
38
37
  "dependencies": {
39
- "@workleap-telemetry/core": "^1.0.1",
40
- "@workleap/logging": "^1.3.0",
38
+ "@workleap-telemetry/core": "^1.0.3",
39
+ "@workleap/logging": "^1.3.1",
41
40
  "uuid": "^13.0.0",
42
- "@squide/core": "6.1.1",
43
- "@squide/module-federation": "7.0.2",
44
- "@squide/msw": "4.0.2",
45
- "@squide/react-router": "8.1.1"
41
+ "@squide/core": "6.1.3",
42
+ "@squide/module-federation": "7.0.4",
43
+ "@squide/msw": "4.0.4",
44
+ "@squide/react-router": "8.1.3"
46
45
  },
47
46
  "devDependencies": {
48
- "@rsbuild/core": "1.5.13",
49
- "@rslib/core": "0.15.0",
47
+ "@eslint/js": "9.38.0",
48
+ "@rsbuild/core": "1.5.17",
49
+ "@rslib/core": "0.16.1",
50
50
  "@testing-library/react": "16.3.0",
51
51
  "@types/react": "19.2.2",
52
- "@types/react-dom": "19.2.1",
53
- "@typescript-eslint/parser": "8.46.0",
52
+ "@types/react-dom": "19.2.2",
53
+ "@typescript-eslint/parser": "8.46.2",
54
54
  "@vitejs/plugin-react": "5.0.4",
55
- "@workleap/eslint-plugin": "3.5.0",
56
- "@workleap/rslib-configs": "1.1.0",
57
- "@workleap/typescript-configs": "3.0.4",
58
- "eslint": "8.57.0",
59
- "happy-dom": "19.0.2",
55
+ "@workleap/eslint-configs": "0.0.5",
56
+ "@workleap/rslib-configs": "1.1.3",
57
+ "@workleap/typescript-configs": "3.0.7",
58
+ "eslint": "9.38.0",
59
+ "happy-dom": "20.0.8",
60
60
  "typescript": "5.9.3",
61
- "vitest": "3.2.4"
61
+ "typescript-eslint": "8.46.2",
62
+ "vitest": "4.0.2"
62
63
  },
63
64
  "sideEffects": false,
64
- "engines": {
65
- "node": ">=21.1.0"
66
- },
67
65
  "scripts": {
68
66
  "build": "rslib build --config ./rslib.build.ts",
69
67
  "eslint": "eslint . --max-warnings=-0 --cache --cache-location node_modules/.cache/eslint",
@@ -29,17 +29,17 @@ export interface AppRouterState extends AppRouterWaitState {
29
29
  }
30
30
 
31
31
  export type AppRouterActionType =
32
- | "modules-registered"
33
- | "modules-ready"
34
- | "msw-ready"
35
- | "public-data-ready"
36
- | "protected-data-ready"
37
- | "public-data-updated"
38
- | "protected-data-updated"
39
- | "deferred-registrations-updated"
40
- | "active-route-is-public"
41
- | "active-route-is-protected"
42
- | "is-unauthorized";
32
+ | "modules-registered"
33
+ | "modules-ready"
34
+ | "msw-ready"
35
+ | "public-data-ready"
36
+ | "protected-data-ready"
37
+ | "public-data-updated"
38
+ | "protected-data-updated"
39
+ | "deferred-registrations-updated"
40
+ | "active-route-is-public"
41
+ | "active-route-is-protected"
42
+ | "is-unauthorized";
43
43
 
44
44
  // The followings event const are a concatenation of "squide-" with AppRouterActionType.
45
45
  // They are dispatched by the useEnhancedReducerDispatch hook.
@@ -17,5 +17,3 @@ export async function initializeHoneycomb(runtime: FireflyRuntime) {
17
17
  runtime.logger.information("[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.");
18
18
  }
19
19
  }
20
-
21
-