@squide/firefly 9.3.4 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +66 -55
  2. package/README.md +2 -2
  3. package/dist/AppRouter.d.ts +1 -1
  4. package/dist/AppRouter.js +6 -6
  5. package/dist/AppRouter.js.map +1 -1
  6. package/dist/AppRouterContext.js +4 -4
  7. package/dist/AppRouterContext.js.map +1 -1
  8. package/dist/AppRouterReducer.js +30 -30
  9. package/dist/AppRouterReducer.js.map +1 -1
  10. package/dist/FireflyRuntime.js +8 -8
  11. package/dist/FireflyRuntime.js.map +1 -1
  12. package/dist/RootRoute.js +3 -3
  13. package/dist/RootRoute.js.map +1 -1
  14. package/dist/boostrap.d.ts +1 -1
  15. package/dist/boostrap.js +16 -16
  16. package/dist/boostrap.js.map +1 -1
  17. package/dist/index.js +4 -4
  18. package/dist/useDeferredRegistrations.js +3 -3
  19. package/dist/useDeferredRegistrations.js.map +1 -1
  20. package/dist/useIsActiveRouteProtected.js +7 -7
  21. package/dist/useIsActiveRouteProtected.js.map +1 -1
  22. package/dist/useNavigationItems.js +3 -3
  23. package/dist/useNavigationItems.js.map +1 -1
  24. package/dist/useProtectedDataQueries.js +3 -3
  25. package/dist/useProtectedDataQueries.js.map +1 -1
  26. package/dist/usePublicDataQueries.js +3 -3
  27. package/dist/usePublicDataQueries.js.map +1 -1
  28. package/dist/useRegisterDeferredRegistrations.js +3 -3
  29. package/dist/useRegisterDeferredRegistrations.js.map +1 -1
  30. package/dist/useStrictRegistrationMode.js +12 -12
  31. package/dist/useStrictRegistrationMode.js.map +1 -1
  32. package/dist/useUpdateDeferredRegistrations.js +3 -3
  33. package/dist/useUpdateDeferredRegistrations.js.map +1 -1
  34. package/package.json +13 -13
  35. package/src/AppRouter.tsx +1 -1
  36. package/src/RootRoute.tsx +1 -1
  37. package/src/boostrap.ts +7 -7
  38. package/src/useIsActiveRouteProtected.ts +1 -1
  39. package/src/useProtectedDataQueries.ts +1 -1
  40. package/src/usePublicDataQueries.ts +1 -1
@@ -1,15 +1,15 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__ from "../../core/src/index.js";
2
- import * as __WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__ from "../../module-federation/src/index.js";
3
- import * as __WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__ from "../../msw/src/index.js";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__ from "@squide/msw";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__ from "./useExecuteOnce.js";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__useIsBootstrapping_js_642a9b43__ from "./useIsBootstrapping.js";
7
7
 
8
- ;// CONCATENATED MODULE: external "../../core/src/index.js"
8
+ ;// CONCATENATED MODULE: external "@squide/core"
9
9
 
10
- ;// CONCATENATED MODULE: external "../../module-federation/src/index.js"
10
+ ;// CONCATENATED MODULE: external "@squide/module-federation"
11
11
 
12
- ;// CONCATENATED MODULE: external "../../msw/src/index.js"
12
+ ;// CONCATENATED MODULE: external "@squide/msw"
13
13
 
14
14
  ;// CONCATENATED MODULE: external "react"
15
15
 
@@ -138,17 +138,17 @@ function reducer(state, action) {
138
138
  return newState;
139
139
  }
140
140
  function getAreModulesRegistered() {
141
- const localModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.getLocalModuleRegistrationStatus)();
142
- const remoteModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.getRemoteModuleRegistrationStatus)();
143
- return (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.areModulesRegistered)(localModuleStatus, remoteModuleStatus);
141
+ const localModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.getLocalModuleRegistrationStatus)();
142
+ const remoteModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.getRemoteModuleRegistrationStatus)();
143
+ return (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.areModulesRegistered)(localModuleStatus, remoteModuleStatus);
144
144
  }
145
145
  function getAreModulesReady() {
146
- const localModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.getLocalModuleRegistrationStatus)();
147
- const remoteModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.getRemoteModuleRegistrationStatus)();
148
- return (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.areModulesReady)(localModuleStatus, remoteModuleStatus);
146
+ const localModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.getLocalModuleRegistrationStatus)();
147
+ const remoteModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.getRemoteModuleRegistrationStatus)();
148
+ return (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.areModulesReady)(localModuleStatus, remoteModuleStatus);
149
149
  }
150
150
  function useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areModulesReadyValue, dispatch) {
151
- const logger = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useLogger)();
151
+ const logger = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useLogger)();
152
152
  const dispatchModulesRegistered = (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
153
153
  if (getAreModulesRegistered()) {
154
154
  dispatch({
@@ -177,18 +177,18 @@ function useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areMod
177
177
  ]));
178
178
  return (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
179
179
  if (!areModulesRegisteredValue) {
180
- (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.addLocalModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
181
- (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.addRemoteModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
180
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.addLocalModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
181
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.addRemoteModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
182
182
  }
183
183
  if (!areModulesReadyValue) {
184
- (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.addLocalModuleRegistrationStatusChangedListener)(dispatchModulesReady);
185
- (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.addRemoteModuleRegistrationStatusChangedListener)(dispatchModulesReady);
184
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.addLocalModuleRegistrationStatusChangedListener)(dispatchModulesReady);
185
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.addRemoteModuleRegistrationStatusChangedListener)(dispatchModulesReady);
186
186
  }
187
187
  return ()=>{
188
- (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.removeLocalModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
189
- (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.removeRemoteModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
190
- (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.removeLocalModuleRegistrationStatusChangedListener)(dispatchModulesReady);
191
- (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.removeRemoteModuleRegistrationStatusChangedListener)(dispatchModulesReady);
188
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.removeLocalModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
189
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.removeRemoteModuleRegistrationStatusChangedListener)(dispatchModulesRegistered);
190
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.removeLocalModuleRegistrationStatusChangedListener)(dispatchModulesReady);
191
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.removeRemoteModuleRegistrationStatusChangedListener)(dispatchModulesReady);
192
192
  };
193
193
  }, [
194
194
  areModulesRegisteredValue,
@@ -198,9 +198,9 @@ function useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areMod
198
198
  ]);
199
199
  }
200
200
  function useMswStatusDispatcher(isMswReadyValue, dispatch) {
201
- const logger = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useLogger)();
201
+ const logger = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useLogger)();
202
202
  const dispatchMswReady = (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
203
- if ((0,__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.isMswReady)()) {
203
+ if ((0,__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.isMswReady)()) {
204
204
  dispatch({
205
205
  type: "msw-ready"
206
206
  });
@@ -214,10 +214,10 @@ function useMswStatusDispatcher(isMswReadyValue, dispatch) {
214
214
  ]));
215
215
  (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
216
216
  if (!isMswReadyValue) {
217
- (0,__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.addMswStateChangedListener)(dispatchMswReady);
217
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.addMswStateChangedListener)(dispatchMswReady);
218
218
  }
219
219
  return ()=>{
220
- (0,__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.removeMswStateChangedListener)(dispatchMswReady);
220
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.removeMswStateChangedListener)(dispatchMswReady);
221
221
  };
222
222
  }, [
223
223
  isMswReadyValue,
@@ -225,7 +225,7 @@ function useMswStatusDispatcher(isMswReadyValue, dispatch) {
225
225
  ]);
226
226
  }
227
227
  function useBootstrappingCompletedDispatcher(state) {
228
- const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useEventBus)();
228
+ const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useEventBus)();
229
229
  const areModulesRegisteredValue = state.areModulesRegistered;
230
230
  const isBoostrapping = (0,__WEBPACK_EXTERNAL_MODULE__useIsBootstrapping_js_642a9b43__.isApplicationBootstrapping)(state);
231
231
  (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
@@ -257,8 +257,8 @@ function useReducerDispatchProxy(reactDispatch) {
257
257
  ]);
258
258
  }
259
259
  function useEnhancedReducerDispatch(reducerDispatch) {
260
- const logger = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useLogger)();
261
- const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useEventBus)();
260
+ const logger = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useLogger)();
261
+ const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useEventBus)();
262
262
  return (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)((action)=>{
263
263
  logger.debug("[squide] The following action has been dispatched to the AppRouter reducer:", action);
264
264
  eventBus.dispatch(`squide-${action.type}`);
@@ -272,8 +272,8 @@ function useEnhancedReducerDispatch(reducerDispatch) {
272
272
  function useAppRouterReducer(waitForMsw, waitForPublicData, waitForProtectedData) {
273
273
  const areModulesInitiallyRegistered = getAreModulesRegistered();
274
274
  const areModulesInitiallyReady = getAreModulesReady();
275
- const isMswInitiallyReady = (0,__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.isMswReady)();
276
- const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useEventBus)();
275
+ const isMswInitiallyReady = (0,__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.isMswReady)();
276
+ const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useEventBus)();
277
277
  // When modules are initially registered, the reducer action will never be dispatched, therefore the event would not be dispatched as well.
278
278
  // To ensure the bootstrapping events sequencing, the event is manually dispatched when the modules are initially registered.
279
279
  (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
@@ -1 +1 @@
1
- {"version":3,"file":"AppRouterReducer.js","sources":["webpack://@squide/firefly/./src/AppRouterReducer.ts"],"sourcesContent":["import { addLocalModuleRegistrationStatusChangedListener, getLocalModuleRegistrationStatus, removeLocalModuleRegistrationStatusChangedListener, useEventBus, useLogger } 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 { useExecuteOnce } from \"./useExecuteOnce.ts\";\nimport { isApplicationBootstrapping } from \"./useIsBootstrapping.ts\";\n\nexport type ActiveRouteVisiblity = \"unknown\" | \"public\" | \"protected\";\n\nexport interface AppRouterState {\n waitForMsw: boolean;\n waitForPublicData: boolean;\n waitForProtectedData: boolean;\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 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}\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.debug(\"[squide] %cModules are registered%c.\", \"color: white; background-color: green;\", \"\");\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.debug(\"[squide] %cModules are ready%c.\", \"color: white; background-color: green;\", \"\");\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.debug(\"[squide] %cMSW is ready%c.\", \"color: white; background-color: green;\", \"\");\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\nexport function useBootstrappingCompletedDispatcher(state: AppRouterState) {\n const eventBus = useEventBus();\n\n const areModulesRegisteredValue = state.areModulesRegistered;\n const isBoostrapping = isApplicationBootstrapping(state);\n\n useExecuteOnce(useCallback(() => {\n if (areModulesRegisteredValue && !isBoostrapping) {\n eventBus.dispatch(ApplicationBoostrappedEvent);\n\n return true;\n }\n\n return false;\n }, [areModulesRegisteredValue, isBoostrapping, 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(reducerDispatch: AppRouterDispatch) {\n const logger = useLogger();\n const eventBus = useEventBus();\n\n return useCallback((action: AppRouterAction) => {\n logger.debug(\"[squide] The following action has been dispatched to the AppRouter reducer:\", action);\n eventBus.dispatch(`squide-${action.type}`);\n\n reducerDispatch(action);\n }, [reducerDispatch, logger, eventBus]);\n}\n\nexport function useAppRouterReducer(waitForMsw: boolean, waitForPublicData: boolean, waitForProtectedData: boolean): [AppRouterState, AppRouterDispatch] {\n const areModulesInitiallyRegistered = getAreModulesRegistered();\n const areModulesInitiallyReady = getAreModulesReady();\n const isMswInitiallyReady = isMswReady();\n\n const eventBus = useEventBus();\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 eventBus.dispatch(ModulesRegisteredEvent);\n }\n\n return true;\n }, [areModulesInitiallyRegistered, eventBus]), 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 eventBus.dispatch(ModulesReadyEvent);\n }\n\n return true;\n }, [areModulesInitiallyReady, eventBus]), 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 eventBus.dispatch(MswReadyEvent);\n }\n\n return true;\n }, [isMswInitiallyReady, eventBus]), true);\n\n const [state, reactDispatch] = useReducer(reducer, {\n waitForMsw,\n waitForPublicData,\n 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 });\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(dispatchProxy);\n\n useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areModulesReadyValue, dispatch);\n useMswStatusDispatcher(isMswReadyValue, dispatch);\n useBootstrappingCompletedDispatcher(state);\n\n return [state, dispatch];\n}\n"],"names":["addLocalModuleRegistrationStatusChangedListener","getLocalModuleRegistrationStatus","removeLocalModuleRegistrationStatusChangedListener","useEventBus","useLogger","addRemoteModuleRegistrationStatusChangedListener","areModulesReady","areModulesRegistered","getRemoteModuleRegistrationStatus","removeRemoteModuleRegistrationStatusChangedListener","addMswStateChangedListener","isMswReady","removeMswStateChangedListener","useCallback","useEffect","useMemo","useReducer","useExecuteOnce","isApplicationBootstrapping","ModulesRegisteredEvent","ModulesReadyEvent","MswReadyEvent","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","eventBus","isBoostrapping","dispatchProxyFactory","__setAppReducerDispatchProxyFactory","factory","__clearAppReducerDispatchProxy","undefined","useReducerDispatchProxy","reactDispatch","useEnhancedReducerDispatch","reducerDispatch","useAppRouterReducer","waitForMsw","waitForPublicData","waitForProtectedData","areModulesInitiallyRegistered","areModulesInitiallyReady","isMswInitiallyReady","dispatchProxy"],"mappings":";;;;;;;;;;;;;;;;;;;;AAA6L;AAC+B;AACxH;AACjB;AAC9B;AACgB;AAiCrE,wFAAwF;AACxF,8DAA8D;AACvD,MAAMmB,yBAAyB,4BAA4B;AAC3D,MAAMC,oBAAoB,uBAAuB;AACjD,MAAMC,gBAAgB,mBAAmB;AACzC,MAAMC,uBAAuB,2BAA2B;AACxD,MAAMC,0BAA0B,8BAA8B;AAC9D,MAAMC,yBAAyB,6BAA6B;AAC5D,MAAMC,4BAA4B,gCAAgC;AAClE,MAAMC,oCAAoC,wCAAwC;AAClF,MAAMC,8BAA8B,yBAAyB;AAQpE,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;oBAC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C,MAAM6B,sBAAsBvD,qEAAUA;IAEtC,MAAMsC,WAAW9C,uEAAWA;IAE5B,2IAA2I;IAC3I,6HAA6H;IAC7Hc,0EAAcA,CAACJ,iDAAWA,CAAC;QACvB,IAAImD,+BAA+B;YAC/Bf,SAAS,QAAQ,CAAC9B;QACtB;QAEA,OAAO;IACX,GAAG;QAAC6C;QAA+Bf;KAAS,GAAG;IAE/C,2IAA2I;IAC3I,6HAA6H;IAC7HhC,0EAAcA,CAACJ,iDAAWA,CAAC;QACvB,IAAIoD,0BAA0B;YAC1BhB,SAAS,QAAQ,CAAC7B;QACtB;QAEA,OAAO;IACX,GAAG;QAAC6C;QAA0BhB;KAAS,GAAG;IAE1C,2IAA2I;IAC3I,6HAA6H;IAC7HhC,0EAAcA,CAACJ,iDAAWA,CAAC;QACvB,IAAIqD,qBAAqB;YACrBjB,SAAS,QAAQ,CAAC5B;QACtB;QAEA,OAAO;IACX,GAAG;QAAC6C;QAAqBjB;KAAS,GAAG;IAErC,MAAM,CAACpB,OAAO4B,cAAc,GAAGzC,gDAAUA,CAACY,SAAS;QAC/CiC;QACAC;QACAC;QACA,4HAA4H;QAC5H,sBAAsBC;QACtB,iBAAiBC;QACjB,YAAYC;QACZ,mBAAmB;QACnB,sBAAsB;QACtB,uBAAuB;QACvB,gBAAgB;IACpB;IAEA,MAAM,EACF,sBAAsB3B,yBAAyB,EAC/C,iBAAiBC,oBAAoB,EACrC,YAAYM,eAAe,EAC9B,GAAGjB;IAEJ,iHAAiH;IACjH,sCAAsC;IACtC,MAAMsC,gBAAgBX,wBAAwBC;IAC9C,MAAMhB,WAAWiB,2BAA2BS;IAE5C7B,sCAAsCC,2BAA2BC,sBAAsBC;IACvFI,uBAAuBC,iBAAiBL;IACxCO,oCAAoCnB;IAEpC,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 } 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 { useExecuteOnce } from \"./useExecuteOnce.ts\";\nimport { isApplicationBootstrapping } from \"./useIsBootstrapping.ts\";\n\nexport type ActiveRouteVisiblity = \"unknown\" | \"public\" | \"protected\";\n\nexport interface AppRouterState {\n waitForMsw: boolean;\n waitForPublicData: boolean;\n waitForProtectedData: boolean;\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 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}\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.debug(\"[squide] %cModules are registered%c.\", \"color: white; background-color: green;\", \"\");\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.debug(\"[squide] %cModules are ready%c.\", \"color: white; background-color: green;\", \"\");\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.debug(\"[squide] %cMSW is ready%c.\", \"color: white; background-color: green;\", \"\");\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\nexport function useBootstrappingCompletedDispatcher(state: AppRouterState) {\n const eventBus = useEventBus();\n\n const areModulesRegisteredValue = state.areModulesRegistered;\n const isBoostrapping = isApplicationBootstrapping(state);\n\n useExecuteOnce(useCallback(() => {\n if (areModulesRegisteredValue && !isBoostrapping) {\n eventBus.dispatch(ApplicationBoostrappedEvent);\n\n return true;\n }\n\n return false;\n }, [areModulesRegisteredValue, isBoostrapping, 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(reducerDispatch: AppRouterDispatch) {\n const logger = useLogger();\n const eventBus = useEventBus();\n\n return useCallback((action: AppRouterAction) => {\n logger.debug(\"[squide] The following action has been dispatched to the AppRouter reducer:\", action);\n eventBus.dispatch(`squide-${action.type}`);\n\n reducerDispatch(action);\n }, [reducerDispatch, logger, eventBus]);\n}\n\nexport function useAppRouterReducer(waitForMsw: boolean, waitForPublicData: boolean, waitForProtectedData: boolean): [AppRouterState, AppRouterDispatch] {\n const areModulesInitiallyRegistered = getAreModulesRegistered();\n const areModulesInitiallyReady = getAreModulesReady();\n const isMswInitiallyReady = isMswReady();\n\n const eventBus = useEventBus();\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 eventBus.dispatch(ModulesRegisteredEvent);\n }\n\n return true;\n }, [areModulesInitiallyRegistered, eventBus]), 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 eventBus.dispatch(ModulesReadyEvent);\n }\n\n return true;\n }, [areModulesInitiallyReady, eventBus]), 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 eventBus.dispatch(MswReadyEvent);\n }\n\n return true;\n }, [isMswInitiallyReady, eventBus]), true);\n\n const [state, reactDispatch] = useReducer(reducer, {\n waitForMsw,\n waitForPublicData,\n 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 });\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(dispatchProxy);\n\n useModuleRegistrationStatusDispatcher(areModulesRegisteredValue, areModulesReadyValue, dispatch);\n useMswStatusDispatcher(isMswReadyValue, dispatch);\n useBootstrappingCompletedDispatcher(state);\n\n return [state, dispatch];\n}\n"],"names":["addLocalModuleRegistrationStatusChangedListener","getLocalModuleRegistrationStatus","removeLocalModuleRegistrationStatusChangedListener","useEventBus","useLogger","addRemoteModuleRegistrationStatusChangedListener","areModulesReady","areModulesRegistered","getRemoteModuleRegistrationStatus","removeRemoteModuleRegistrationStatusChangedListener","addMswStateChangedListener","isMswReady","removeMswStateChangedListener","useCallback","useEffect","useMemo","useReducer","useExecuteOnce","isApplicationBootstrapping","ModulesRegisteredEvent","ModulesReadyEvent","MswReadyEvent","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","eventBus","isBoostrapping","dispatchProxyFactory","__setAppReducerDispatchProxyFactory","factory","__clearAppReducerDispatchProxy","undefined","useReducerDispatchProxy","reactDispatch","useEnhancedReducerDispatch","reducerDispatch","useAppRouterReducer","waitForMsw","waitForPublicData","waitForProtectedData","areModulesInitiallyRegistered","areModulesInitiallyReady","isMswInitiallyReady","dispatchProxy"],"mappings":";;;;;;;;;;;;;;;;;;;;AAA6L;AAC+B;AACxH;AACjB;AAC9B;AACgB;AAiCrE,wFAAwF;AACxF,8DAA8D;AACvD,MAAMmB,yBAAyB,4BAA4B;AAC3D,MAAMC,oBAAoB,uBAAuB;AACjD,MAAMC,gBAAgB,mBAAmB;AACzC,MAAMC,uBAAuB,2BAA2B;AACxD,MAAMC,0BAA0B,8BAA8B;AAC9D,MAAMC,yBAAyB,6BAA6B;AAC5D,MAAMC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J,iHAAiH;IACjH,sCAAsC;IACtC,MAAMsC,gBAAgBX,wBAAwBC;IAC9C,MAAMhB,WAAWiB,2BAA2BS;IAE5C7B,sCAAsCC,2BAA2BC,sBAAsBC;IACvFI,uBAAuBC,iBAAiBL;IACxCO,oCAAoCnB;IAEpC,OAAO;QAACA;QAAOY;KAAS;AAC5B"}
@@ -1,10 +1,10 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__ from "../../msw/src/index.js";
2
- import * as __WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__ from "../../react-router/src/index.js";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__ from "@squide/msw";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__ from "@squide/react-router";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_6fa81ecc__ from "./AppRouterReducer.js";
4
4
 
5
- ;// CONCATENATED MODULE: external "../../msw/src/index.js"
5
+ ;// CONCATENATED MODULE: external "@squide/msw"
6
6
 
7
- ;// CONCATENATED MODULE: external "../../react-router/src/index.js"
7
+ ;// CONCATENATED MODULE: external "@squide/react-router"
8
8
 
9
9
  ;// CONCATENATED MODULE: external "./AppRouterReducer.js"
10
10
 
@@ -12,14 +12,14 @@ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js_6fa81ecc__ from "./Ap
12
12
 
13
13
 
14
14
 
15
- class FireflyRuntime extends __WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__.ReactRouterRuntime {
15
+ class FireflyRuntime extends __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.ReactRouterRuntime {
16
16
  #useMsw;
17
17
  constructor({ plugins, useMsw, ...options } = {}){
18
18
  if (useMsw) {
19
19
  super({
20
20
  plugins: [
21
21
  ...plugins ?? [],
22
- (runtime)=>new __WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.MswPlugin(runtime)
22
+ (runtime)=>new __WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.MswPlugin(runtime)
23
23
  ],
24
24
  ...options
25
25
  });
@@ -33,7 +33,7 @@ class FireflyRuntime extends __WEBPACK_EXTERNAL_MODULE__react_router_src_index_j
33
33
  }
34
34
  }
35
35
  registerRequestHandlers(handlers) {
36
- const mswPlugin = this.getPlugin(__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.MswPluginName);
36
+ const mswPlugin = this.getPlugin(__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.MswPluginName);
37
37
  if (!mswPlugin) {
38
38
  throw new Error("[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \"useMsw\" option?");
39
39
  }
@@ -44,7 +44,7 @@ class FireflyRuntime extends __WEBPACK_EXTERNAL_MODULE__react_router_src_index_j
44
44
  }
45
45
  // Must define a return type otherwise we get an "error TS2742: The inferred type of 'requestHandlers' cannot be named" error.
46
46
  get requestHandlers() {
47
- const mswPlugin = this.getPlugin(__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.MswPluginName);
47
+ const mswPlugin = this.getPlugin(__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.MswPluginName);
48
48
  if (!mswPlugin) {
49
49
  throw new Error("[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \"useMsw\" option?");
50
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FireflyRuntime.js","sources":["webpack://@squide/firefly/./src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeOptions } from \"@squide/core\";\nimport { MswPlugin, MswPluginName } from \"@squide/msw\";\nimport { ReactRouterRuntime, type Route } from \"@squide/react-router\";\nimport type { RequestHandler } from \"msw\";\nimport { getAreModulesRegistered } from \"./AppRouterReducer.ts\";\n\nexport interface FireflyRuntimeOptions extends RuntimeOptions {\n useMsw?: boolean;\n}\n\nexport class FireflyRuntime extends ReactRouterRuntime {\n readonly #useMsw: boolean;\n\n constructor({ plugins, useMsw, ...options }: FireflyRuntimeOptions = {}) {\n if (useMsw) {\n super({\n plugins: [\n ...(plugins ?? []),\n runtime => new MswPlugin(runtime)\n ],\n ...options\n });\n\n this.#useMsw = true;\n } else {\n super({\n plugins,\n ...options\n });\n\n this.#useMsw = false;\n }\n }\n\n registerRequestHandlers(handlers: RequestHandler[]) {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n mswPlugin.registerRequestHandlers(handlers);\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.requestHandlers;\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get isMswEnabled() {\n return this.#useMsw;\n }\n}\n"],"names":["MswPlugin","MswPluginName","ReactRouterRuntime","getAreModulesRegistered","FireflyRuntime","plugins","useMsw","options","runtime","handlers","mswPlugin","Error","route"],"mappings":";;;;;;;;;;;AACuD;AACe;AAEN;AAMzD,MAAMI,uBAAuBF,kFAAkBA;IACzC,OAAO,CAAU;IAE1B,YAAY,EAAEG,OAAO,EAAEC,MAAM,EAAE,GAAGC,SAAgC,GAAG,CAAC,CAAC,CAAE;QACrE,IAAID,QAAQ;YACR,KAAK,CAAC;gBACF,SAAS;uBACDD,WAAW,EAAE;oBACjBG,CAAAA,UAAW,IAAIR,gEAASA,CAACQ;iBAC5B;gBACD,GAAGD,OAAO;YACd;YAEA,IAAI,CAAC,OAAO,GAAG;QACnB,OAAO;YACH,KAAK,CAAC;gBACFF;gBACA,GAAGE,OAAO;YACd;YAEA,IAAI,CAAC,OAAO,GAAG;QACnB;IACJ;IAEA,wBAAwBE,QAA0B,EAAE;QAChD,MAAMC,YAAY,IAAI,CAAC,SAAS,CAACT,oEAAaA;QAE9C,IAAI,CAACS,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAIR,qFAAuBA,IAAI;YAC3B,MAAM,IAAIQ,MAAM;QACpB;QAEAD,UAAU,uBAAuB,CAACD;IACtC;IAEA,8HAA8H;IAC9H,IAAI,kBAAoC;QACpC,MAAMC,YAAY,IAAI,CAAC,SAAS,CAACT,oEAAaA;QAE9C,IAAI,CAACS,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOD,UAAU,eAAe;IACpC;IAEA,cAAcE,KAAY,EAAEL,UAAgC,CAAC,CAAC,EAAE;QAC5D,IAAIJ,qFAAuBA,IAAI;YAC3B,MAAM,IAAIQ,MAAM;QACpB;QAEA,KAAK,CAAC,cAAcC,OAAOL;IAC/B;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,OAAO;IACvB;AACJ"}
1
+ {"version":3,"file":"FireflyRuntime.js","sources":["webpack://@squide/firefly/./src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeOptions } from \"@squide/core\";\nimport { MswPlugin, MswPluginName } from \"@squide/msw\";\nimport { ReactRouterRuntime, type Route } from \"@squide/react-router\";\nimport type { RequestHandler } from \"msw\";\nimport { getAreModulesRegistered } from \"./AppRouterReducer.ts\";\n\nexport interface FireflyRuntimeOptions extends RuntimeOptions {\n useMsw?: boolean;\n}\n\nexport class FireflyRuntime extends ReactRouterRuntime {\n readonly #useMsw: boolean;\n\n constructor({ plugins, useMsw, ...options }: FireflyRuntimeOptions = {}) {\n if (useMsw) {\n super({\n plugins: [\n ...(plugins ?? []),\n runtime => new MswPlugin(runtime)\n ],\n ...options\n });\n\n this.#useMsw = true;\n } else {\n super({\n plugins,\n ...options\n });\n\n this.#useMsw = false;\n }\n }\n\n registerRequestHandlers(handlers: RequestHandler[]) {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n mswPlugin.registerRequestHandlers(handlers);\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.requestHandlers;\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get isMswEnabled() {\n return this.#useMsw;\n }\n}\n"],"names":["MswPlugin","MswPluginName","ReactRouterRuntime","getAreModulesRegistered","FireflyRuntime","plugins","useMsw","options","runtime","handlers","mswPlugin","Error","route"],"mappings":";;;;;;;;;;;AACuD;AACe;AAEN;AAMzD,MAAMI,uBAAuBF,4EAAkBA;IACzC,OAAO,CAAU;IAE1B,YAAY,EAAEG,OAAO,EAAEC,MAAM,EAAE,GAAGC,SAAgC,GAAG,CAAC,CAAC,CAAE;QACrE,IAAID,QAAQ;YACR,KAAK,CAAC;gBACF,SAAS;uBACDD,WAAW,EAAE;oBACjBG,CAAAA,UAAW,IAAIR,0DAASA,CAACQ;iBAC5B;gBACD,GAAGD,OAAO;YACd;YAEA,IAAI,CAAC,OAAO,GAAG;QACnB,OAAO;YACH,KAAK,CAAC;gBACFF;gBACA,GAAGE,OAAO;YACd;YAEA,IAAI,CAAC,OAAO,GAAG;QACnB;IACJ;IAEA,wBAAwBE,QAA0B,EAAE;QAChD,MAAMC,YAAY,IAAI,CAAC,SAAS,CAACT,8DAAaA;QAE9C,IAAI,CAACS,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAIR,qFAAuBA,IAAI;YAC3B,MAAM,IAAIQ,MAAM;QACpB;QAEAD,UAAU,uBAAuB,CAACD;IACtC;IAEA,8HAA8H;IAC9H,IAAI,kBAAoC;QACpC,MAAMC,YAAY,IAAI,CAAC,SAAS,CAACT,8DAAaA;QAE9C,IAAI,CAACS,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOD,UAAU,eAAe;IACpC;IAEA,cAAcE,KAAY,EAAEL,UAAgC,CAAC,CAAC,EAAE;QAC5D,IAAIJ,qFAAuBA,IAAI;YAC3B,MAAM,IAAIQ,MAAM;QACpB;QAEA,KAAK,CAAC,cAAcC,OAAOL;IAC/B;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,OAAO;IACvB;AACJ"}
package/dist/RootRoute.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
- import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__useIsActiveRouteProtected_js_d94f4832__ from "./useIsActiveRouteProtected.js";
6
6
 
@@ -8,7 +8,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__useIsActiveRouteProtected_js_d94f4832__ f
8
8
 
9
9
  ;// CONCATENATED MODULE: external "react"
10
10
 
11
- ;// CONCATENATED MODULE: external "react-router-dom"
11
+ ;// CONCATENATED MODULE: external "react-router"
12
12
 
13
13
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
14
14
 
@@ -40,7 +40,7 @@ function RootRoute() {
40
40
  isActiveRouteProtected,
41
41
  dispatch
42
42
  ]);
43
- return /*#__PURE__*/ (0,__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.Outlet, {});
43
+ return /*#__PURE__*/ (0,__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__.Outlet, {});
44
44
  }
45
45
 
46
46
  export { RootRoute };
@@ -1 +1 @@
1
- {"version":3,"file":"RootRoute.js","sources":["webpack://@squide/firefly/./src/RootRoute.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { Outlet } from \"react-router-dom\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { useIsActiveRouteProtected } from \"./useIsActiveRouteProtected.ts\";\n\nexport function RootRoute() {\n const state = useAppRouterState();\n const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);\n\n const dispatch = useAppRouterDispatcher();\n\n useEffect(() => {\n // Dispatching the active route visibility must be done in a route because React Router's useLocation\n // hook throws if it's not called from a child of the router component.\n if (isActiveRouteProtected) {\n dispatch({ type: \"active-route-is-protected\" });\n } else {\n dispatch({ type: \"active-route-is-public\" });\n }\n }, [isActiveRouteProtected, dispatch]);\n\n return (\n <Outlet />\n );\n}\n"],"names":["useEffect","Outlet","useAppRouterDispatcher","useAppRouterState","useIsActiveRouteProtected","RootRoute","state","isActiveRouteProtected","dispatch"],"mappings":";;;;;;;;;;;;;;;;;;AAAkC;AACQ;AACwC;AACP;AAEpE,SAASK;IACZ,MAAMC,QAAQH,+EAAiBA;IAC/B,MAAMI,yBAAyBH,gGAAyBA,CAACE,MAAM,eAAe;IAE9E,MAAME,WAAWN,oFAAsBA;IAEvCF,+CAASA,CAAC;QACN,qGAAqG;QACrG,uEAAuE;QACvE,IAAIO,wBAAwB;YACxBC,SAAS;gBAAE,MAAM;YAA4B;QACjD,OAAO;YACHA,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACD;QAAwBC;KAAS;IAErC,qBACI,+DAACP,4DAAMA;AAEf"}
1
+ {"version":3,"file":"RootRoute.js","sources":["webpack://@squide/firefly/./src/RootRoute.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { useIsActiveRouteProtected } from \"./useIsActiveRouteProtected.ts\";\n\nexport function RootRoute() {\n const state = useAppRouterState();\n const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);\n\n const dispatch = useAppRouterDispatcher();\n\n useEffect(() => {\n // Dispatching the active route visibility must be done in a route because React Router's useLocation\n // hook throws if it's not called from a child of the router component.\n if (isActiveRouteProtected) {\n dispatch({ type: \"active-route-is-protected\" });\n } else {\n dispatch({ type: \"active-route-is-public\" });\n }\n }, [isActiveRouteProtected, dispatch]);\n\n return (\n <Outlet />\n );\n}\n"],"names":["useEffect","Outlet","useAppRouterDispatcher","useAppRouterState","useIsActiveRouteProtected","RootRoute","state","isActiveRouteProtected","dispatch"],"mappings":";;;;;;;;;;;;;;;;;;AAAkC;AACI;AAC4C;AACP;AAEpE,SAASK;IACZ,MAAMC,QAAQH,+EAAiBA;IAC/B,MAAMI,yBAAyBH,gGAAyBA,CAACE,MAAM,eAAe;IAE9E,MAAME,WAAWN,oFAAsBA;IAEvCF,+CAASA,CAAC;QACN,qGAAqG;QACrG,uEAAuE;QACvE,IAAIO,wBAAwB;YACxBC,SAAS;gBAAE,MAAM;YAA4B;QACjD,OAAO;YACHA,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACD;QAAwBC;KAAS;IAErC,qBACI,+DAACP,wDAAMA;AAEf"}
@@ -12,4 +12,4 @@ export declare function bootstrap<TRuntime extends FireflyRuntime = FireflyRunti
12
12
  localModuleErrors: ModuleRegistrationError[];
13
13
  remoteModuleErrors: RemoteModuleRegistrationError[];
14
14
  }>;
15
- export declare function __resetBootstrapGuard(): void;
15
+ export declare function __resetHasExecuteGuard(): void;
package/dist/boostrap.js CHANGED
@@ -1,54 +1,54 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__ from "../../core/src/index.js";
2
- import * as __WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__ from "../../module-federation/src/index.js";
3
- import * as __WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__ from "../../msw/src/index.js";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__ from "@squide/msw";
4
4
 
5
- ;// CONCATENATED MODULE: external "../../core/src/index.js"
5
+ ;// CONCATENATED MODULE: external "@squide/core"
6
6
 
7
- ;// CONCATENATED MODULE: external "../../module-federation/src/index.js"
7
+ ;// CONCATENATED MODULE: external "@squide/module-federation"
8
8
 
9
- ;// CONCATENATED MODULE: external "../../msw/src/index.js"
9
+ ;// CONCATENATED MODULE: external "@squide/msw"
10
10
 
11
11
  ;// CONCATENATED MODULE: ./src/boostrap.ts?__rslib_entry__
12
12
 
13
13
 
14
14
 
15
15
  const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
16
- let isBootstrapped = false;
16
+ let hasExecuted = false;
17
17
  async function bootstrap(runtime, options = {}) {
18
18
  const { localModules = [], remotes = [], context, startMsw } = options;
19
- if (isBootstrapped) {
19
+ if (hasExecuted) {
20
20
  throw new Error("[squide] A squide application can only be bootstrapped once. Did you call the \"bootstrap\" function twice?");
21
21
  }
22
+ hasExecuted = true;
22
23
  runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);
23
24
  let localModuleErrors = [];
24
25
  let remoteModuleErrors = [];
25
- localModuleErrors = await (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.registerLocalModules)(localModules, runtime, {
26
+ localModuleErrors = await (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.registerLocalModules)(localModules, runtime, {
26
27
  context
27
28
  });
28
- remoteModuleErrors = await (0,__WEBPACK_EXTERNAL_MODULE__module_federation_src_index_js_e113b625__.registerRemoteModules)(remotes, runtime, {
29
+ remoteModuleErrors = await (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.registerRemoteModules)(remotes, runtime, {
29
30
  context
30
31
  });
31
32
  if (runtime.isMswEnabled) {
32
- if (!(0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.isFunction)(startMsw)) {
33
+ if (!(0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.isFunction)(startMsw)) {
33
34
  throw new Error("[squide] When MSW is enabled, the \"startMsw\" function must be provided.");
34
35
  }
35
36
  try {
36
37
  await startMsw(runtime);
37
- (0,__WEBPACK_EXTERNAL_MODULE__msw_src_index_js_df8c7d83__.setMswAsReady)();
38
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.setMswAsReady)();
38
39
  } catch (error) {
39
40
  runtime.logger.debug("[squide] An error occured while starting MSW.", error);
40
41
  }
41
42
  }
42
- isBootstrapped = true;
43
43
  return {
44
44
  localModuleErrors,
45
45
  remoteModuleErrors
46
46
  };
47
47
  }
48
- function __resetBootstrapGuard() {
49
- isBootstrapped = false;
48
+ function __resetHasExecuteGuard() {
49
+ hasExecuted = false;
50
50
  }
51
51
 
52
- export { ApplicationBootstrappingStartedEvent, __resetBootstrapGuard, bootstrap };
52
+ export { ApplicationBootstrappingStartedEvent, __resetHasExecuteGuard, bootstrap };
53
53
 
54
54
  //# sourceMappingURL=boostrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"boostrap.js","sources":["webpack://@squide/firefly/./src/boostrap.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type ModuleRegistrationError, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition, type RemoteModuleRegistrationError } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nlet isBootstrapped = false;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface BootstrapAppOptions<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext> {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<TRuntime>;\n}\n\nexport async function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: BootstrapAppOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n context,\n startMsw\n } = options;\n\n if (isBootstrapped) {\n throw new Error(\"[squide] A squide application can only be bootstrapped once. Did you call the \\\"bootstrap\\\" function twice?\");\n }\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n let localModuleErrors: ModuleRegistrationError[] = [];\n let remoteModuleErrors: RemoteModuleRegistrationError[] = [];\n\n localModuleErrors = await registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context });\n remoteModuleErrors = await registerRemoteModules(remotes, runtime, { context });\n\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n try {\n await startMsw(runtime);\n\n setMswAsReady();\n } catch (error: unknown) {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n }\n }\n\n isBootstrapped = true;\n\n return {\n localModuleErrors,\n remoteModuleErrors\n };\n}\n\nexport function __resetBootstrapGuard() {\n isBootstrapped = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","ApplicationBootstrappingStartedEvent","isBootstrapped","bootstrap","runtime","options","localModules","remotes","context","startMsw","Error","localModuleErrors","remoteModuleErrors","error","__resetBootstrapGuard"],"mappings":";;;;;;;;;;;AAAwJ;AAC3B;AACjF;AAGrC,MAAMI,uCAAuC,mCAAmC;AAEvF,IAAIC,iBAAiB;AAUd,eAAeC,UAAiGC,OAAiB,EAAEC,UAA0D,CAAC,CAAC;IAClM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,OAAO,EACPC,QAAQ,EACX,GAAGJ;IAEJ,IAAIH,gBAAgB;QAChB,MAAM,IAAIQ,MAAM;IACpB;IAEAN,QAAQ,QAAQ,CAAC,QAAQ,CAACH;IAE1B,IAAIU,oBAA+C,EAAE;IACrD,IAAIC,qBAAsD,EAAE;IAE5DD,oBAAoB,MAAMb,gFAAoBA,CAA4BQ,cAAcF,SAAS;QAAEI;IAAQ;IAC3GI,qBAAqB,MAAMb,8FAAqBA,CAACQ,SAASH,SAAS;QAAEI;IAAQ;IAE7E,IAAIJ,QAAQ,YAAY,EAAE;QACtB,IAAI,CAACP,sEAAUA,CAACY,WAAW;YACvB,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAI;YACA,MAAMD,SAASL;YAEfJ,wEAAaA;QACjB,EAAE,OAAOa,OAAgB;YACrBT,QAAQ,MAAM,CAAC,KAAK,CAAC,iDAAiDS;QAC1E;IACJ;IAEAX,iBAAiB;IAEjB,OAAO;QACHS;QACAC;IACJ;AACJ;AAEO,SAASE;IACZZ,iBAAiB;AACrB"}
1
+ {"version":3,"file":"boostrap.js","sources":["webpack://@squide/firefly/./src/boostrap.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type ModuleRegistrationError, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition, type RemoteModuleRegistrationError } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface BootstrapAppOptions<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext> {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<TRuntime>;\n}\n\nlet hasExecuted = false;\n\nexport async function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: BootstrapAppOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n context,\n startMsw\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be bootstrapped once. Did you call the \\\"bootstrap\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n let localModuleErrors: ModuleRegistrationError[] = [];\n let remoteModuleErrors: RemoteModuleRegistrationError[] = [];\n\n localModuleErrors = await registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context });\n remoteModuleErrors = await registerRemoteModules(remotes, runtime, { context });\n\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n try {\n await startMsw(runtime);\n\n setMswAsReady();\n } catch (error: unknown) {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n }\n }\n\n return {\n localModuleErrors,\n remoteModuleErrors\n };\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","ApplicationBootstrappingStartedEvent","hasExecuted","bootstrap","runtime","options","localModules","remotes","context","startMsw","Error","localModuleErrors","remoteModuleErrors","error","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;AAAwJ;AAC3B;AACjF;AAGrC,MAAMI,uCAAuC,mCAAmC;AAUvF,IAAIC,cAAc;AAEX,eAAeC,UAAiGC,OAAiB,EAAEC,UAA0D,CAAC,CAAC;IAClM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,OAAO,EACPC,QAAQ,EACX,GAAGJ;IAEJ,IAAIH,aAAa;QACb,MAAM,IAAIQ,MAAM;IACpB;IAEAR,cAAc;IAEdE,QAAQ,QAAQ,CAAC,QAAQ,CAACH;IAE1B,IAAIU,oBAA+C,EAAE;IACrD,IAAIC,qBAAsD,EAAE;IAE5DD,oBAAoB,MAAMb,0EAAoBA,CAA4BQ,cAAcF,SAAS;QAAEI;IAAQ;IAC3GI,qBAAqB,MAAMb,wFAAqBA,CAACQ,SAASH,SAAS;QAAEI;IAAQ;IAE7E,IAAIJ,QAAQ,YAAY,EAAE;QACtB,IAAI,CAACP,gEAAUA,CAACY,WAAW;YACvB,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAI;YACA,MAAMD,SAASL;YAEfJ,kEAAaA;QACjB,EAAE,OAAOa,OAAgB;YACrBT,QAAQ,MAAM,CAAC,KAAK,CAAC,iDAAiDS;QAC1E;IACJ;IAEA,OAAO;QACHF;QACAC;IACJ;AACJ;AAEO,SAASE;IACZZ,cAAc;AAClB"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export * from "../../core/src/index.js";
2
- export * from "../../module-federation/src/index.js";
3
- export * from "../../msw/src/index.js";
4
- export * from "../../react-router/src/index.js";
1
+ export * from "@squide/core";
2
+ export * from "@squide/module-federation";
3
+ export * from "@squide/msw";
4
+ export * from "@squide/react-router";
5
5
  export * from "./FireflyRuntime.js";
6
6
  export * from "./AppRouter.js";
7
7
  export * from "./AppRouterContext.js";
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__ from "../../core/src/index.js";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__useCanRegisterDeferredRegistrations_js_257f17d4__ from "./useCanRegisterDeferredRegistrations.js";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__useCanUpdateDeferredRegistrations_js_12932b2c__ from "./useCanUpdateDeferredRegistrations.js";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__useRegisterDeferredRegistrations_js_eed558b9__ from "./useRegisterDeferredRegistrations.js";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__useUpdateDeferredRegistrations_js_80de5337__ from "./useUpdateDeferredRegistrations.js";
7
7
 
8
- ;// CONCATENATED MODULE: external "../../core/src/index.js"
8
+ ;// CONCATENATED MODULE: external "@squide/core"
9
9
 
10
10
  ;// CONCATENATED MODULE: external "react"
11
11
 
@@ -28,7 +28,7 @@ function hasError({ localModuleErrors, remoteModuleErrors }) {
28
28
  return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;
29
29
  }
30
30
  function useDeferredRegistrations(data, { onError } = {}) {
31
- const runtime = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useRuntime)();
31
+ const runtime = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useRuntime)();
32
32
  const canRegisterDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useCanRegisterDeferredRegistrations_js_257f17d4__.useCanRegisterDeferredRegistrations)();
33
33
  const canUpdateDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useCanUpdateDeferredRegistrations_js_12932b2c__.useCanUpdateDeferredRegistrations)();
34
34
  const registerDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useRegisterDeferredRegistrations_js_eed558b9__.useRegisterDeferredRegistrations)();
@@ -1 +1 @@
1
- {"version":3,"file":"useDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect } from \"react\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport interface DeferredRegistrationsErrorsObject {\n localModuleErrors: ModuleRegistrationError[];\n remoteModuleErrors: ModuleRegistrationError[];\n}\n\nexport type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nfunction hasError({ localModuleErrors, remoteModuleErrors }: DeferredRegistrationsErrorsObject) {\n return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;\n}\n\nexport function useDeferredRegistrations(data: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime();\n\n const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();\n const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();\n\n const registerDeferredRegistrations = useRegisterDeferredRegistrations();\n const updateDeferredRegistrations = useUpdateDeferredRegistrations();\n\n useEffect(() => {\n if (canRegisterDeferredRegistrations) {\n const register = async () => {\n const errors = await registerDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError, runtime]);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n const update = async () => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [canUpdateDeferredRegistrations, updateDeferredRegistrations, data, onError, runtime]);\n}\n"],"names":["useRuntime","useEffect","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","hasError","localModuleErrors","remoteModuleErrors","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AACtC;AAC6D;AACJ;AACF;AACJ;AAarF,SAASM,SAAS,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAqC;IAC1F,OAAOD,kBAAkB,MAAM,GAAG,KAAKC,mBAAmB,MAAM,GAAG;AACvE;AAEO,SAASC,yBAAyBC,IAAa,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACrG,MAAMC,UAAUZ,sEAAUA;IAE1B,MAAMa,mCAAmCX,oHAAmCA;IAC5E,MAAMY,iCAAiCX,gHAAiCA;IAExE,MAAMY,gCAAgCX,8GAAgCA;IACtE,MAAMY,8BAA8BX,0GAA8BA;IAElEJ,+CAASA,CAAC;QACN,IAAIY,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL,MAAME;gBAEzD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;QAASC;KAAQ;IAE5FX,+CAASA,CAAC;QACN,IAAIa,gCAAgC;YAChC,MAAMK,SAAS;gBACX,MAAMD,SAAS,MAAMF,4BAA4BN,MAAME;gBAEvD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAC;QACJ;IACJ,GAAG;QAACL;QAAgCE;QAA6BN;QAAMC;QAASC;KAAQ;AAC5F"}
1
+ {"version":3,"file":"useDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect } from \"react\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport interface DeferredRegistrationsErrorsObject {\n localModuleErrors: ModuleRegistrationError[];\n remoteModuleErrors: ModuleRegistrationError[];\n}\n\nexport type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nfunction hasError({ localModuleErrors, remoteModuleErrors }: DeferredRegistrationsErrorsObject) {\n return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;\n}\n\nexport function useDeferredRegistrations(data: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime();\n\n const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();\n const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();\n\n const registerDeferredRegistrations = useRegisterDeferredRegistrations();\n const updateDeferredRegistrations = useUpdateDeferredRegistrations();\n\n useEffect(() => {\n if (canRegisterDeferredRegistrations) {\n const register = async () => {\n const errors = await registerDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError, runtime]);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n const update = async () => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [canUpdateDeferredRegistrations, updateDeferredRegistrations, data, onError, runtime]);\n}\n"],"names":["useRuntime","useEffect","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","hasError","localModuleErrors","remoteModuleErrors","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AACtC;AAC6D;AACJ;AACF;AACJ;AAarF,SAASM,SAAS,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAqC;IAC1F,OAAOD,kBAAkB,MAAM,GAAG,KAAKC,mBAAmB,MAAM,GAAG;AACvE;AAEO,SAASC,yBAAyBC,IAAa,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACrG,MAAMC,UAAUZ,gEAAUA;IAE1B,MAAMa,mCAAmCX,oHAAmCA;IAC5E,MAAMY,iCAAiCX,gHAAiCA;IAExE,MAAMY,gCAAgCX,8GAAgCA;IACtE,MAAMY,8BAA8BX,0GAA8BA;IAElEJ,+CAASA,CAAC;QACN,IAAIY,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL,MAAME;gBAEzD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;QAASC;KAAQ;IAE5FX,+CAASA,CAAC;QACN,IAAIa,gCAAgC;YAChC,MAAMK,SAAS;gBACX,MAAMD,SAAS,MAAMF,4BAA4BN,MAAME;gBAEvD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAC;QACJ;IACJ,GAAG;QAACL;QAAgCE;QAA6BN;QAAMC;QAASC;KAAQ;AAC5F"}
@@ -1,21 +1,21 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__ from "../../react-router/src/index.js";
2
- import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__ from "react-router-dom";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__ from "@squide/react-router";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router";
3
3
 
4
- ;// CONCATENATED MODULE: external "../../react-router/src/index.js"
4
+ ;// CONCATENATED MODULE: external "@squide/react-router"
5
5
 
6
- ;// CONCATENATED MODULE: external "react-router-dom"
6
+ ;// CONCATENATED MODULE: external "react-router"
7
7
 
8
8
  ;// CONCATENATED MODULE: ./src/useIsActiveRouteProtected.ts?__rslib_entry__
9
9
 
10
10
 
11
11
  function useIsActiveRouteProtected(areModulesReady) {
12
12
  // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.
13
- const location = (0,__WEBPACK_EXTERNAL_MODULE_react_router_dom_5358f3fe__.useLocation)();
13
+ const location = (0,__WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__.useLocation)();
14
14
  // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.
15
- const activeRoute = (0,__WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__.useRouteMatch)(location, {
15
+ const activeRoute = (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useRouteMatch)(location, {
16
16
  throwWhenThereIsNoMatch: areModulesReady
17
17
  });
18
- return (0,__WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__.useIsRouteProtected)(activeRoute);
18
+ return (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useIsRouteProtected)(activeRoute);
19
19
  }
20
20
 
21
21
  export { useIsActiveRouteProtected };
@@ -1 +1 @@
1
- {"version":3,"file":"useIsActiveRouteProtected.js","sources":["webpack://@squide/firefly/./src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router-dom\";\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean) {\n // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.\n const location = useLocation();\n\n // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.\n const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC3B;AAExC,SAASG,0BAA0BC,eAAwB;IAC9D,qJAAqJ;IACrJ,MAAMC,WAAWH,qEAAWA;IAE5B,wJAAwJ;IACxJ,MAAMI,cAAcL,iFAAaA,CAACI,UAAU;QAAE,yBAAyBD;IAAgB;IAEvF,OAAOJ,uFAAmBA,CAACM;AAC/B"}
1
+ {"version":3,"file":"useIsActiveRouteProtected.js","sources":["webpack://@squide/firefly/./src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean) {\n // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.\n const location = useLocation();\n\n // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.\n const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC/B;AAEpC,SAASG,0BAA0BC,eAAwB;IAC9D,qJAAqJ;IACrJ,MAAMC,WAAWH,iEAAWA;IAE5B,wJAAwJ;IACxJ,MAAMI,cAAcL,2EAAaA,CAACI,UAAU;QAAE,yBAAyBD;IAAgB;IAEvF,OAAOJ,iFAAmBA,CAACM;AAC/B"}
@@ -1,7 +1,7 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__ from "../../react-router/src/index.js";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__ from "@squide/react-router";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
3
3
 
4
- ;// CONCATENATED MODULE: external "../../react-router/src/index.js"
4
+ ;// CONCATENATED MODULE: external "@squide/react-router"
5
5
 
6
6
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
7
7
 
@@ -18,7 +18,7 @@ function useNavigationItems(options) {
18
18
  // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the "runtime" changes, or
19
19
  // even introducing new module states.
20
20
  (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
21
- return (0,__WEBPACK_EXTERNAL_MODULE__react_router_src_index_js_ff6a88b1__.useRuntimeNavigationItems)(options);
21
+ return (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useRuntimeNavigationItems)(options);
22
22
  }
23
23
 
24
24
  export { useNavigationItems };
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigationItems.js","sources":["webpack://@squide/firefly/./src/useNavigationItems.ts"],"sourcesContent":["import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from \"@squide/react-router\";\nimport { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport type UseNavigationItemsOptions = UseRuntimeNavigationItemsOptions;\n\nexport function useNavigationItems(options?: UseNavigationItemsOptions) {\n // This is not the most sophisticated strategy but it seems to be good enough for now.\n // The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could\n // be updated when the global data is updated. If the deferred registrations are updated, it means that the registered\n // navigation items might have been updated and a re-render must happens to display the new navigation items.\n // Since the \"deferredRegistrationsUpdatedAt\" state value of the AppRouterReducer is updated everytime the deferred registrations\n // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.\n // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the \"runtime\" changes, or\n // even introducing new module states.\n useAppRouterState();\n\n return useRuntimeNavigationItems(options);\n}\n"],"names":["useRuntimeNavigationItems","useAppRouterState","useNavigationItems","options"],"mappings":";;;;;;;;AAAwG;AAC9C;AAInD,SAASE,mBAAmBC,OAAmC;IAClE,sFAAsF;IACtF,uHAAuH;IACvH,sHAAsH;IACtH,6GAA6G;IAC7G,iIAAiI;IACjI,qHAAqH;IACrH,yIAAyI;IACzI,sCAAsC;IACtCF,+EAAiBA;IAEjB,OAAOD,6FAAyBA,CAACG;AACrC"}
1
+ {"version":3,"file":"useNavigationItems.js","sources":["webpack://@squide/firefly/./src/useNavigationItems.ts"],"sourcesContent":["import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from \"@squide/react-router\";\nimport { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport type UseNavigationItemsOptions = UseRuntimeNavigationItemsOptions;\n\nexport function useNavigationItems(options?: UseNavigationItemsOptions) {\n // This is not the most sophisticated strategy but it seems to be good enough for now.\n // The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could\n // be updated when the global data is updated. If the deferred registrations are updated, it means that the registered\n // navigation items might have been updated and a re-render must happens to display the new navigation items.\n // Since the \"deferredRegistrationsUpdatedAt\" state value of the AppRouterReducer is updated everytime the deferred registrations\n // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.\n // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the \"runtime\" changes, or\n // even introducing new module states.\n useAppRouterState();\n\n return useRuntimeNavigationItems(options);\n}\n"],"names":["useRuntimeNavigationItems","useAppRouterState","useNavigationItems","options"],"mappings":";;;;;;;;AAAwG;AAC9C;AAInD,SAASE,mBAAmBC,OAAmC;IAClE,sFAAsF;IACtF,uHAAuH;IACvH,sHAAsH;IACtH,6GAA6G;IAC7G,iIAAiI;IACjI,qHAAqH;IACrH,yIAAyI;IACzI,sCAAsC;IACtCF,+EAAiBA;IAEjB,OAAOD,uFAAyBA,CAACG;AACrC"}
@@ -1,4 +1,4 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__ from "../../core/src/index.js";
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE__tanstack_react_query_db705f77__ from "@tanstack/react-query";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
@@ -6,7 +6,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__GlobalDataQueriesError_js_0c24ca62__ from
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__ from "./useCanFetchProtectedData.js";
7
7
  import * as __WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__ from "./useExecuteOnce.js";
8
8
 
9
- ;// CONCATENATED MODULE: external "../../core/src/index.js"
9
+ ;// CONCATENATED MODULE: external "@squide/core"
10
10
 
11
11
  ;// CONCATENATED MODULE: external "@tanstack/react-query"
12
12
 
@@ -33,7 +33,7 @@ const ProtectedDataFetchFailedEvent = "squide-protected-data-fetch-failed";
33
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
34
  function useProtectedDataQueries(queries, isUnauthorizedError) {
35
35
  const canFetchProtectedData = (0,__WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__.useCanFetchProtectedData)();
36
- const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__core_src_index_js_d19dd8a6__.useEventBus)();
36
+ const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useEventBus)();
37
37
  const dispatch = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterDispatcher)();
38
38
  const combineResults = (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)((results)=>{
39
39
  const errors = results.filter((x)=>x.error).map((x)=>x.error);