@squide/firefly 13.0.1 → 13.0.3

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 (62) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/AppRouter.js +17 -17
  3. package/dist/AppRouter.js.map +1 -1
  4. package/dist/AppRouterContext.js +8 -8
  5. package/dist/AppRouterContext.js.map +1 -1
  6. package/dist/AppRouterReducer.js +47 -47
  7. package/dist/AppRouterReducer.js.map +1 -1
  8. package/dist/FireflyProvider.js +3 -3
  9. package/dist/FireflyProvider.js.map +1 -1
  10. package/dist/FireflyRuntime.js +11 -11
  11. package/dist/FireflyRuntime.js.map +1 -1
  12. package/dist/RootRoute.js +10 -10
  13. package/dist/RootRoute.js.map +1 -1
  14. package/dist/honeycomb/activeSpan.js +6 -6
  15. package/dist/honeycomb/activeSpan.js.map +1 -1
  16. package/dist/honeycomb/initializeHoneycomb.js +2 -2
  17. package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
  18. package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +1 -1
  19. package/dist/honeycomb/registerHoneycombInstrumentation.js +97 -73
  20. package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
  21. package/dist/honeycomb/tracer.js +2 -2
  22. package/dist/honeycomb/tracer.js.map +1 -1
  23. package/dist/honeycomb/utils.js +12 -12
  24. package/dist/honeycomb/utils.js.map +1 -1
  25. package/dist/initializeFirefly.js +11 -11
  26. package/dist/initializeFirefly.js.map +1 -1
  27. package/dist/useAppRouterStore.js +2 -2
  28. package/dist/useAppRouterStore.js.map +1 -1
  29. package/dist/useCanFetchProtectedData.js +2 -2
  30. package/dist/useCanFetchProtectedData.js.map +1 -1
  31. package/dist/useCanFetchPublicData.js +2 -2
  32. package/dist/useCanFetchPublicData.js.map +1 -1
  33. package/dist/useCanRegisterDeferredRegistrations.js +2 -2
  34. package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
  35. package/dist/useCanUpdateDeferredRegistrations.js +2 -2
  36. package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
  37. package/dist/useDeferredRegistrations.js +13 -13
  38. package/dist/useDeferredRegistrations.js.map +1 -1
  39. package/dist/useExecuteOnce.js +3 -3
  40. package/dist/useExecuteOnce.js.map +1 -1
  41. package/dist/useIsActiveRouteProtected.js +5 -5
  42. package/dist/useIsActiveRouteProtected.js.map +1 -1
  43. package/dist/useIsBootstrapping.js +2 -2
  44. package/dist/useIsBootstrapping.js.map +1 -1
  45. package/dist/useNavigationItems.js +4 -4
  46. package/dist/useNavigationItems.js.map +1 -1
  47. package/dist/useProtectedDataHandler.js +4 -4
  48. package/dist/useProtectedDataHandler.js.map +1 -1
  49. package/dist/useProtectedDataQueries.js +20 -20
  50. package/dist/useProtectedDataQueries.js.map +1 -1
  51. package/dist/usePublicDataHandler.js +4 -4
  52. package/dist/usePublicDataHandler.js.map +1 -1
  53. package/dist/usePublicDataQueries.js +19 -19
  54. package/dist/usePublicDataQueries.js.map +1 -1
  55. package/dist/useRegisterDeferredRegistrations.js +4 -4
  56. package/dist/useRegisterDeferredRegistrations.js.map +1 -1
  57. package/dist/useStrictRegistrationMode.js +12 -12
  58. package/dist/useStrictRegistrationMode.js.map +1 -1
  59. package/dist/useUpdateDeferredRegistrations.js +6 -6
  60. package/dist/useUpdateDeferredRegistrations.js.map +1 -1
  61. package/package.json +16 -16
  62. package/src/honeycomb/registerHoneycombInstrumentation.ts +35 -16
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
4
 
5
5
  ;// CONCATENATED MODULE: ./src/useIsBootstrapping.ts
6
6
 
7
7
  function useIsBootstrapping() {
8
- const state = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
8
+ const state = useAppRouterState();
9
9
  return isBootstrapping(state);
10
10
  }
11
11
  function isBootstrapping(state) {
@@ -1 +1 @@
1
- {"version":3,"file":"useIsBootstrapping.js","sources":["webpack://@squide/firefly/./src/useIsBootstrapping.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport function useIsBootstrapping() {\n const state = useAppRouterState();\n\n return isBootstrapping(state);\n}\n\nexport function isBootstrapping(state: AppRouterState) {\n const {\n waitForMsw,\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n isMswReady,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = state;\n\n const isAppReady = (\n !isUnauthorized\n // Wait until the modules has been registered and the deferred registrations has been registered if any.\n && areModulesReady\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the initial data is ready.\n && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n\n // When an API request returns a 401, the bootstrapping should be bypassed to render the login page.\n const flush = (\n // Only applicable when there's a unauthorized request while fetching the initial data.\n isUnauthorized\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the public data is ready.\n && (!waitForMsw || isMswReady)\n // If the application is loading public data, we want to wait for this data to be ready to prevent a re-render.\n && (!waitForPublicData || isPublicDataReady)\n );\n\n return !isAppReady && !flush;\n}\n"],"names":["useAppRouterState","useIsBootstrapping","state","isBootstrapping","waitForMsw","waitForPublicData","waitForProtectedData","areModulesReady","isMswReady","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized","isAppReady","flush"],"mappings":";;;;;AAA0D;AAGnD,SAASC;IACZ,MAAMC,QAAQF,+EAAiBA;IAE/B,OAAOG,gBAAgBD;AAC3B;AAEO,SAASC,gBAAgBD,KAAqB;IACjD,MAAM,EACFE,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGV;IAEJ,MAAMW,aACF,CAACD,kBAEEL,mBAEC,EAACH,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;IAG1F,oGAAoG;IACpG,MAAMI,QACF,uFAAuF;IACvFF,kBAEI,EAACR,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB;IAG9C,OAAO,CAACI,cAAc,CAACC;AAC3B"}
1
+ {"version":3,"file":"useIsBootstrapping.js","sources":["webpack://@squide/firefly/./src/useIsBootstrapping.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport function useIsBootstrapping() {\n const state = useAppRouterState();\n\n return isBootstrapping(state);\n}\n\nexport function isBootstrapping(state: AppRouterState) {\n const {\n waitForMsw,\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n isMswReady,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = state;\n\n const isAppReady = (\n !isUnauthorized\n // Wait until the modules has been registered and the deferred registrations has been registered if any.\n && areModulesReady\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the initial data is ready.\n && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n\n // When an API request returns a 401, the bootstrapping should be bypassed to render the login page.\n const flush = (\n // Only applicable when there's a unauthorized request while fetching the initial data.\n isUnauthorized\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the public data is ready.\n && (!waitForMsw || isMswReady)\n // If the application is loading public data, we want to wait for this data to be ready to prevent a re-render.\n && (!waitForPublicData || isPublicDataReady)\n );\n\n return !isAppReady && !flush;\n}\n"],"names":["useAppRouterState","useIsBootstrapping","state","isBootstrapping","waitForMsw","waitForPublicData","waitForProtectedData","areModulesReady","isMswReady","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized","isAppReady","flush"],"mappings":";;;;;AAA0D;AAGnD,SAASC;IACZ,MAAMC,QAAQF,iBAAiBA;IAE/B,OAAOG,gBAAgBD;AAC3B;AAEO,SAASC,gBAAgBD,KAAqB;IACjD,MAAM,EACFE,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGV;IAEJ,MAAMW,aACF,CAACD,kBAEEL,mBAEC,EAACH,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;IAG1F,oGAAoG;IACpG,MAAMI,QACF,uFAAuF;IACvFF,kBAEI,EAACR,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB;IAG9C,OAAO,CAACI,cAAc,CAACC;AAC3B"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__ from "@squide/react-router";
2
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useRuntimeNavigationItems } from "@squide/react-router";
2
+ import { useAppRouterState } from "./AppRouterContext.js";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "@squide/react-router"
5
5
 
@@ -17,8 +17,8 @@ function useNavigationItems(options) {
17
17
  // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.
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
- (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
21
- return (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useRuntimeNavigationItems)(options);
20
+ useAppRouterState();
21
+ return 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,uFAAyBA,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,iBAAiBA;IAEjB,OAAOD,yBAAyBA,CAACG;AACrC"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
- import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__ from "./useCanFetchProtectedData.js";
1
+ import { useEffect } from "react";
2
+ import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "react"
5
5
 
@@ -9,8 +9,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__ fr
9
9
 
10
10
 
11
11
  function useProtectedDataHandler(handler) {
12
- const canFetchProtectedData = (0,__WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__.useCanFetchProtectedData)();
13
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
12
+ const canFetchProtectedData = useCanFetchProtectedData();
13
+ useEffect(()=>{
14
14
  if (canFetchProtectedData) {
15
15
  handler();
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useProtectedDataHandler.js","sources":["webpack://@squide/firefly/./src/useProtectedDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\n\nexport function useProtectedDataHandler(handler: () => void) {\n const canFetchProtectedData = useCanFetchProtectedData();\n\n useEffect(() => {\n if (canFetchProtectedData) {\n handler();\n }\n }, [canFetchProtectedData, handler]);\n}\n"],"names":["useEffect","useCanFetchProtectedData","useProtectedDataHandler","handler","canFetchProtectedData"],"mappings":";;;;;;;;AAAkC;AACuC;AAElE,SAASE,wBAAwBC,OAAmB;IACvD,MAAMC,wBAAwBH,8FAAwBA;IAEtDD,+CAASA,CAAC;QACN,IAAII,uBAAuB;YACvBD;QACJ;IACJ,GAAG;QAACC;QAAuBD;KAAQ;AACvC"}
1
+ {"version":3,"file":"useProtectedDataHandler.js","sources":["webpack://@squide/firefly/./src/useProtectedDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\n\nexport function useProtectedDataHandler(handler: () => void) {\n const canFetchProtectedData = useCanFetchProtectedData();\n\n useEffect(() => {\n if (canFetchProtectedData) {\n handler();\n }\n }, [canFetchProtectedData, handler]);\n}\n"],"names":["useEffect","useCanFetchProtectedData","useProtectedDataHandler","handler","canFetchProtectedData"],"mappings":";;;;;;;;AAAkC;AACuC;AAElE,SAASE,wBAAwBC,OAAmB;IACvD,MAAMC,wBAAwBH,wBAAwBA;IAEtDD,SAASA,CAAC;QACN,IAAII,uBAAuB;YACvBD;QACJ;IACJ,GAAG;QAACC;QAAuBD;KAAQ;AACvC"}
@@ -1,10 +1,10 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
- import * as __WEBPACK_EXTERNAL_MODULE__tanstack_react_query_db705f77__ from "@tanstack/react-query";
3
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__GlobalDataQueriesError_js_0c24ca62__ from "./GlobalDataQueriesError.js";
6
- import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__ from "./useCanFetchProtectedData.js";
7
- import * as __WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__ from "./useExecuteOnce.js";
1
+ import { useEventBus } from "@squide/core";
2
+ import { useQueries } from "@tanstack/react-query";
3
+ import { useCallback, useEffect, useRef } from "react";
4
+ import { useAppRouterDispatcher, useAppRouterState } from "./AppRouterContext.js";
5
+ import { GlobalDataQueriesError } from "./GlobalDataQueriesError.js";
6
+ import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
7
+ import { useExecuteOnce } from "./useExecuteOnce.js";
8
8
 
9
9
  ;// CONCATENATED MODULE: external "@squide/core"
10
10
 
@@ -32,10 +32,10 @@ const ProtectedDataFetchStartedEvent = "squide-protected-data-fetch-started";
32
32
  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
- const canFetchProtectedData = (0,__WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__.useCanFetchProtectedData)();
36
- const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useEventBus)();
37
- const dispatch = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterDispatcher)();
38
- const combineResults = (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)((results)=>{
35
+ const canFetchProtectedData = useCanFetchProtectedData();
36
+ const eventBus = useEventBus();
37
+ const dispatch = useAppRouterDispatcher();
38
+ const combineResults = useCallback((results)=>{
39
39
  const errors = results.filter((x)=>x.error).map((x)=>x.error);
40
40
  const hasErrors = errors.length > 0;
41
41
  return {
@@ -45,15 +45,15 @@ function useProtectedDataQueries(queries, isUnauthorizedError) {
45
45
  isReady: !hasErrors && !results.some((x)=>x.isPending)
46
46
  };
47
47
  }, []);
48
- const { data, errors: queriesErrors, hasErrors, isReady } = (0,__WEBPACK_EXTERNAL_MODULE__tanstack_react_query_db705f77__.useQueries)({
48
+ const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({
49
49
  queries: queries.map((x)=>({
50
50
  enabled: canFetchProtectedData,
51
51
  ...x
52
52
  })),
53
53
  combine: combineResults
54
54
  });
55
- const { isProtectedDataReady, isUnauthorized } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
56
- (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
55
+ const { isProtectedDataReady, isUnauthorized } = useAppRouterState();
56
+ useExecuteOnce(useCallback(()=>{
57
57
  if (canFetchProtectedData) {
58
58
  eventBus.dispatch(ProtectedDataFetchStartedEvent);
59
59
  return true;
@@ -64,8 +64,8 @@ function useProtectedDataQueries(queries, isUnauthorizedError) {
64
64
  eventBus
65
65
  ]), true);
66
66
  // Using a ref seems to be the only way to prevent starting two deferred registrations scope.
67
- const isReadyRef = (0,__WEBPACK_EXTERNAL_MODULE_react__.useRef)(false);
68
- const dispatchReady = (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
67
+ const isReadyRef = useRef(false);
68
+ const dispatchReady = useExecuteOnce(useCallback(()=>{
69
69
  if (isReady) {
70
70
  isReadyRef.current = true;
71
71
  dispatch({
@@ -78,13 +78,13 @@ function useProtectedDataQueries(queries, isUnauthorizedError) {
78
78
  isReady,
79
79
  dispatch
80
80
  ]));
81
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
81
+ useEffect(()=>{
82
82
  // State update must be executed in useEffect.
83
83
  dispatchReady();
84
84
  }, [
85
85
  dispatchReady
86
86
  ]);
87
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
87
+ useEffect(()=>{
88
88
  if (isReadyRef.current && data) {
89
89
  dispatch({
90
90
  type: "protected-data-updated"
@@ -94,7 +94,7 @@ function useProtectedDataQueries(queries, isUnauthorizedError) {
94
94
  data,
95
95
  dispatch
96
96
  ]);
97
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
97
+ useEffect(()=>{
98
98
  if (hasErrors) {
99
99
  if (!isProtectedDataReady && !isUnauthorized && queriesErrors.some((x)=>isUnauthorizedError(x))) {
100
100
  // Will transition the state to allow the routes to render even if the bootstrapping is not complete, because otherwise
@@ -106,7 +106,7 @@ function useProtectedDataQueries(queries, isUnauthorizedError) {
106
106
  // Otherwise, when a user is logged off, a refetch might throws a 401.
107
107
  if (!queriesErrors.every((x)=>isUnauthorizedError(x))) {
108
108
  eventBus.dispatch(ProtectedDataFetchFailedEvent, queriesErrors);
109
- throw new __WEBPACK_EXTERNAL_MODULE__GlobalDataQueriesError_js_0c24ca62__.GlobalDataQueriesError("[squide] Global protected data queries failed.", queriesErrors);
109
+ throw new GlobalDataQueriesError("[squide] Global protected data queries failed.", queriesErrors);
110
110
  }
111
111
  }
112
112
  }, [
@@ -1 +1 @@
1
- {"version":3,"file":"useProtectedDataQueries.js","sources":["webpack://@squide/firefly/./src/useProtectedDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const ProtectedDataFetchStartedEvent = \"squide-protected-data-fetch-started\";\nexport const ProtectedDataFetchFailedEvent = \"squide-protected-data-fetch-failed\";\n\nexport type IsUnauthorizedErrorCallback = (error: unknown) => boolean;\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useProtectedDataQueries<T extends Array<any>>(queries: QueriesOptions<T>, isUnauthorizedError: IsUnauthorizedErrorCallback): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchProtectedData = useCanFetchProtectedData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchProtectedData,\n ...x\n })),\n combine: combineResults\n });\n\n const { isProtectedDataReady, isUnauthorized } = useAppRouterState();\n\n useExecuteOnce(useCallback(() => {\n if (canFetchProtectedData) {\n eventBus.dispatch(ProtectedDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchProtectedData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"protected-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"protected-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n if (!isProtectedDataReady && !isUnauthorized && queriesErrors.some(x => isUnauthorizedError(x))) {\n // Will transition the state to allow the routes to render even if the bootstrapping is not complete, because otherwise\n // a login page for example could not be rendered.\n dispatch({ type: \"is-unauthorized\" });\n }\n\n // Otherwise, when a user is logged off, a refetch might throws a 401.\n if (!queriesErrors.every(x => isUnauthorizedError(x))) {\n eventBus.dispatch(ProtectedDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global protected data queries failed.\", queriesErrors);\n }\n }\n }, [hasErrors, queriesErrors, isProtectedDataReady, isUnauthorized, isUnauthorizedError, dispatch, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","useAppRouterState","GlobalDataQueriesError","useCanFetchProtectedData","useExecuteOnce","ProtectedDataFetchStartedEvent","ProtectedDataFetchFailedEvent","useProtectedDataQueries","queries","isUnauthorizedError","canFetchProtectedData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isProtectedDataReady","isUnauthorized","isReadyRef","dispatchReady"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA2C;AACuE;AAC3D;AAC2B;AACb;AACI;AACpB;AAE9C,MAAMU,iCAAiC,sCAAsC;AAC7E,MAAMC,gCAAgC,qCAAqC;AAQlF,8DAA8D;AACvD,SAASC,wBAA8CC,OAA0B,EAAEC,mBAAgD;IACtI,MAAMC,wBAAwBP,8FAAwBA;IACtD,MAAMQ,WAAWhB,iEAAWA;IAE5B,MAAMiB,WAAWZ,oFAAsBA;IAEvC,MAAMa,iBAAiBhB,iDAAWA,CAAC,CAACiB;QAChC,MAAMC,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,KAAK,EAAE,GAAG,CAACA,CAAAA,IAAKA,EAAE,KAAK;QAC5D,MAAMC,YAAYF,OAAO,MAAM,GAAG;QAElC,OAAO;YACH,MAAMD,QAAQ,GAAG,CAACE,CAAAA,IAAKA,EAAE,IAAI;YAC7BD;YACAE;YACA,SAAS,CAACA,aAAa,CAACH,QAAQ,IAAI,CAACE,CAAAA,IAAKA,EAAE,SAAS;QACzD;IACJ,GAAG,EAAE;IAEL,MAAM,EAAEE,IAAI,EAAE,QAAQC,aAAa,EAAEF,SAAS,EAAEG,OAAO,EAAE,GAAGxB,yEAAUA,CAAC;QACnE,SAASY,QAAQ,GAAG,CAACQ,CAAAA,IAAM;gBACvB,SAASN;gBACT,GAAGM,CAAC;YACR;QACA,SAASH;IACb;IAEA,MAAM,EAAEQ,oBAAoB,EAAEC,cAAc,EAAE,GAAGrB,+EAAiBA;IAElEG,0EAAcA,CAACP,iDAAWA,CAAC;QACvB,IAAIa,uBAAuB;YACvBC,SAAS,QAAQ,CAACN;YAElB,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACK;QAAuBC;KAAS,GAAG;IAEvC,6FAA6F;IAC7F,MAAMY,aAAaxB,4CAAMA,CAAC;IAE1B,MAAMyB,gBAAgBpB,0EAAcA,CAACP,iDAAWA,CAAC;QAC7C,IAAIuB,SAAS;YACTG,WAAW,OAAO,GAAG;YAErBX,SAAS;gBAAE,MAAM;YAAuB;YAExC,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACQ;QAASR;KAAS;IAEtBd,+CAASA,CAAC;QACN,8CAA8C;QAC9C0B;IACJ,GAAG;QAACA;KAAc;IAElB1B,+CAASA,CAAC;QACN,IAAIyB,WAAW,OAAO,IAAIL,MAAM;YAC5BN,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACM;QAAMN;KAAS;IAEnBd,+CAASA,CAAC;QACN,IAAImB,WAAW;YACX,IAAI,CAACI,wBAAwB,CAACC,kBAAkBH,cAAc,IAAI,CAACH,CAAAA,IAAKP,oBAAoBO,KAAK;gBAC7F,uHAAuH;gBACvH,kDAAkD;gBAClDJ,SAAS;oBAAE,MAAM;gBAAkB;YACvC;YAEA,sEAAsE;YACtE,IAAI,CAACO,cAAc,KAAK,CAACH,CAAAA,IAAKP,oBAAoBO,KAAK;gBACnDL,SAAS,QAAQ,CAACL,+BAA+Ba;gBAEjD,MAAM,IAAIjB,sFAAsBA,CAAC,kDAAkDiB;YACvF;QACJ;IACJ,GAAG;QAACF;QAAWE;QAAeE;QAAsBC;QAAgBb;QAAqBG;QAAUD;KAAS;IAE5G,OAAOO;AACX"}
1
+ {"version":3,"file":"useProtectedDataQueries.js","sources":["webpack://@squide/firefly/./src/useProtectedDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const ProtectedDataFetchStartedEvent = \"squide-protected-data-fetch-started\";\nexport const ProtectedDataFetchFailedEvent = \"squide-protected-data-fetch-failed\";\n\nexport type IsUnauthorizedErrorCallback = (error: unknown) => boolean;\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useProtectedDataQueries<T extends Array<any>>(queries: QueriesOptions<T>, isUnauthorizedError: IsUnauthorizedErrorCallback): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchProtectedData = useCanFetchProtectedData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchProtectedData,\n ...x\n })),\n combine: combineResults\n });\n\n const { isProtectedDataReady, isUnauthorized } = useAppRouterState();\n\n useExecuteOnce(useCallback(() => {\n if (canFetchProtectedData) {\n eventBus.dispatch(ProtectedDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchProtectedData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"protected-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"protected-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n if (!isProtectedDataReady && !isUnauthorized && queriesErrors.some(x => isUnauthorizedError(x))) {\n // Will transition the state to allow the routes to render even if the bootstrapping is not complete, because otherwise\n // a login page for example could not be rendered.\n dispatch({ type: \"is-unauthorized\" });\n }\n\n // Otherwise, when a user is logged off, a refetch might throws a 401.\n if (!queriesErrors.every(x => isUnauthorizedError(x))) {\n eventBus.dispatch(ProtectedDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global protected data queries failed.\", queriesErrors);\n }\n }\n }, [hasErrors, queriesErrors, isProtectedDataReady, isUnauthorized, isUnauthorizedError, dispatch, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","useAppRouterState","GlobalDataQueriesError","useCanFetchProtectedData","useExecuteOnce","ProtectedDataFetchStartedEvent","ProtectedDataFetchFailedEvent","useProtectedDataQueries","queries","isUnauthorizedError","canFetchProtectedData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isProtectedDataReady","isUnauthorized","isReadyRef","dispatchReady"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA2C;AACuE;AAC3D;AAC2B;AACb;AACI;AACpB;AAE9C,MAAMU,iCAAiC,sCAAsC;AAC7E,MAAMC,gCAAgC,qCAAqC;AAQlF,8DAA8D;AACvD,SAASC,wBAA8CC,OAA0B,EAAEC,mBAAgD;IACtI,MAAMC,wBAAwBP,wBAAwBA;IACtD,MAAMQ,WAAWhB,WAAWA;IAE5B,MAAMiB,WAAWZ,sBAAsBA;IAEvC,MAAMa,iBAAiBhB,WAAWA,CAAC,CAACiB;QAChC,MAAMC,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,KAAK,EAAE,GAAG,CAACA,CAAAA,IAAKA,EAAE,KAAK;QAC5D,MAAMC,YAAYF,OAAO,MAAM,GAAG;QAElC,OAAO;YACH,MAAMD,QAAQ,GAAG,CAACE,CAAAA,IAAKA,EAAE,IAAI;YAC7BD;YACAE;YACA,SAAS,CAACA,aAAa,CAACH,QAAQ,IAAI,CAACE,CAAAA,IAAKA,EAAE,SAAS;QACzD;IACJ,GAAG,EAAE;IAEL,MAAM,EAAEE,IAAI,EAAE,QAAQC,aAAa,EAAEF,SAAS,EAAEG,OAAO,EAAE,GAAGxB,UAAUA,CAAC;QACnE,SAASY,QAAQ,GAAG,CAACQ,CAAAA,IAAM;gBACvB,SAASN;gBACT,GAAGM,CAAC;YACR;QACA,SAASH;IACb;IAEA,MAAM,EAAEQ,oBAAoB,EAAEC,cAAc,EAAE,GAAGrB,iBAAiBA;IAElEG,cAAcA,CAACP,WAAWA,CAAC;QACvB,IAAIa,uBAAuB;YACvBC,SAAS,QAAQ,CAACN;YAElB,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACK;QAAuBC;KAAS,GAAG;IAEvC,6FAA6F;IAC7F,MAAMY,aAAaxB,MAAMA,CAAC;IAE1B,MAAMyB,gBAAgBpB,cAAcA,CAACP,WAAWA,CAAC;QAC7C,IAAIuB,SAAS;YACTG,WAAW,OAAO,GAAG;YAErBX,SAAS;gBAAE,MAAM;YAAuB;YAExC,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACQ;QAASR;KAAS;IAEtBd,SAASA,CAAC;QACN,8CAA8C;QAC9C0B;IACJ,GAAG;QAACA;KAAc;IAElB1B,SAASA,CAAC;QACN,IAAIyB,WAAW,OAAO,IAAIL,MAAM;YAC5BN,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACM;QAAMN;KAAS;IAEnBd,SAASA,CAAC;QACN,IAAImB,WAAW;YACX,IAAI,CAACI,wBAAwB,CAACC,kBAAkBH,cAAc,IAAI,CAACH,CAAAA,IAAKP,oBAAoBO,KAAK;gBAC7F,uHAAuH;gBACvH,kDAAkD;gBAClDJ,SAAS;oBAAE,MAAM;gBAAkB;YACvC;YAEA,sEAAsE;YACtE,IAAI,CAACO,cAAc,KAAK,CAACH,CAAAA,IAAKP,oBAAoBO,KAAK;gBACnDL,SAAS,QAAQ,CAACL,+BAA+Ba;gBAEjD,MAAM,IAAIjB,sBAAsBA,CAAC,kDAAkDiB;YACvF;QACJ;IACJ,GAAG;QAACF;QAAWE;QAAeE;QAAsBC;QAAgBb;QAAqBG;QAAUD;KAAS;IAE5G,OAAOO;AACX"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
- import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchPublicData_js_b8d90132__ from "./useCanFetchPublicData.js";
1
+ import { useEffect } from "react";
2
+ import { useCanFetchPublicData } from "./useCanFetchPublicData.js";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "react"
5
5
 
@@ -9,8 +9,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchPublicData_js_b8d90132__ from
9
9
 
10
10
 
11
11
  function usePublicDataHandler(handler) {
12
- const canFetchPublicData = (0,__WEBPACK_EXTERNAL_MODULE__useCanFetchPublicData_js_b8d90132__.useCanFetchPublicData)();
13
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
12
+ const canFetchPublicData = useCanFetchPublicData();
13
+ useEffect(()=>{
14
14
  if (canFetchPublicData) {
15
15
  handler();
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"usePublicDataHandler.js","sources":["webpack://@squide/firefly/./src/usePublicDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\n\nexport function usePublicDataHandler(handler: () => void) {\n const canFetchPublicData = useCanFetchPublicData();\n\n useEffect(() => {\n if (canFetchPublicData) {\n handler();\n }\n }, [canFetchPublicData, handler]);\n}\n"],"names":["useEffect","useCanFetchPublicData","usePublicDataHandler","handler","canFetchPublicData"],"mappings":";;;;;;;;AAAkC;AACiC;AAE5D,SAASE,qBAAqBC,OAAmB;IACpD,MAAMC,qBAAqBH,wFAAqBA;IAEhDD,+CAASA,CAAC;QACN,IAAII,oBAAoB;YACpBD;QACJ;IACJ,GAAG;QAACC;QAAoBD;KAAQ;AACpC"}
1
+ {"version":3,"file":"usePublicDataHandler.js","sources":["webpack://@squide/firefly/./src/usePublicDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\n\nexport function usePublicDataHandler(handler: () => void) {\n const canFetchPublicData = useCanFetchPublicData();\n\n useEffect(() => {\n if (canFetchPublicData) {\n handler();\n }\n }, [canFetchPublicData, handler]);\n}\n"],"names":["useEffect","useCanFetchPublicData","usePublicDataHandler","handler","canFetchPublicData"],"mappings":";;;;;;;;AAAkC;AACiC;AAE5D,SAASE,qBAAqBC,OAAmB;IACpD,MAAMC,qBAAqBH,qBAAqBA;IAEhDD,SAASA,CAAC;QACN,IAAII,oBAAoB;YACpBD;QACJ;IACJ,GAAG;QAACC;QAAoBD;KAAQ;AACpC"}
@@ -1,10 +1,10 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
- import * as __WEBPACK_EXTERNAL_MODULE__tanstack_react_query_db705f77__ from "@tanstack/react-query";
3
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
4
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__GlobalDataQueriesError_js_0c24ca62__ from "./GlobalDataQueriesError.js";
6
- import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchPublicData_js_b8d90132__ from "./useCanFetchPublicData.js";
7
- import * as __WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__ from "./useExecuteOnce.js";
1
+ import { useEventBus } from "@squide/core";
2
+ import { useQueries } from "@tanstack/react-query";
3
+ import { useCallback, useEffect, useRef } from "react";
4
+ import { useAppRouterDispatcher } from "./AppRouterContext.js";
5
+ import { GlobalDataQueriesError } from "./GlobalDataQueriesError.js";
6
+ import { useCanFetchPublicData } from "./useCanFetchPublicData.js";
7
+ import { useExecuteOnce } from "./useExecuteOnce.js";
8
8
 
9
9
  ;// CONCATENATED MODULE: external "@squide/core"
10
10
 
@@ -32,10 +32,10 @@ const PublicDataFetchStartedEvent = "squide-public-data-fetch-started";
32
32
  const PublicDataFetchFailedEvent = "squide-public-data-fetch-failed";
33
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
34
  function usePublicDataQueries(queries) {
35
- const canFetchPublicData = (0,__WEBPACK_EXTERNAL_MODULE__useCanFetchPublicData_js_b8d90132__.useCanFetchPublicData)();
36
- const eventBus = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useEventBus)();
37
- const dispatch = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterDispatcher)();
38
- const combineResults = (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)((results)=>{
35
+ const canFetchPublicData = useCanFetchPublicData();
36
+ const eventBus = useEventBus();
37
+ const dispatch = useAppRouterDispatcher();
38
+ const combineResults = useCallback((results)=>{
39
39
  const errors = results.filter((x)=>x.error).map((x)=>x.error);
40
40
  const hasErrors = errors.length > 0;
41
41
  return {
@@ -45,14 +45,14 @@ function usePublicDataQueries(queries) {
45
45
  isReady: !hasErrors && !results.some((x)=>x.isPending)
46
46
  };
47
47
  }, []);
48
- const { data, errors: queriesErrors, hasErrors, isReady } = (0,__WEBPACK_EXTERNAL_MODULE__tanstack_react_query_db705f77__.useQueries)({
48
+ const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({
49
49
  queries: queries.map((x)=>({
50
50
  enabled: canFetchPublicData,
51
51
  ...x
52
52
  })),
53
53
  combine: combineResults
54
54
  });
55
- (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
55
+ useExecuteOnce(useCallback(()=>{
56
56
  if (canFetchPublicData) {
57
57
  eventBus.dispatch(PublicDataFetchStartedEvent);
58
58
  return true;
@@ -63,8 +63,8 @@ function usePublicDataQueries(queries) {
63
63
  eventBus
64
64
  ]), true);
65
65
  // Using a ref seems to be the only way to prevent starting two deferred registrations scope.
66
- const isReadyRef = (0,__WEBPACK_EXTERNAL_MODULE_react__.useRef)(false);
67
- const dispatchReady = (0,__WEBPACK_EXTERNAL_MODULE__useExecuteOnce_js_e1f8f91b__.useExecuteOnce)((0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
66
+ const isReadyRef = useRef(false);
67
+ const dispatchReady = useExecuteOnce(useCallback(()=>{
68
68
  if (isReady) {
69
69
  isReadyRef.current = true;
70
70
  dispatch({
@@ -77,13 +77,13 @@ function usePublicDataQueries(queries) {
77
77
  isReady,
78
78
  dispatch
79
79
  ]));
80
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
80
+ useEffect(()=>{
81
81
  // State update must be executed in useEffect.
82
82
  dispatchReady();
83
83
  }, [
84
84
  dispatchReady
85
85
  ]);
86
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
86
+ useEffect(()=>{
87
87
  if (isReadyRef.current && data) {
88
88
  dispatch({
89
89
  type: "public-data-updated"
@@ -93,10 +93,10 @@ function usePublicDataQueries(queries) {
93
93
  data,
94
94
  dispatch
95
95
  ]);
96
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
96
+ useEffect(()=>{
97
97
  if (hasErrors) {
98
98
  eventBus.dispatch(PublicDataFetchFailedEvent, queriesErrors);
99
- throw new __WEBPACK_EXTERNAL_MODULE__GlobalDataQueriesError_js_0c24ca62__.GlobalDataQueriesError("[squide] Global public data queries failed.", queriesErrors);
99
+ throw new GlobalDataQueriesError("[squide] Global public data queries failed.", queriesErrors);
100
100
  }
101
101
  }, [
102
102
  hasErrors,
@@ -1 +1 @@
1
- {"version":3,"file":"usePublicDataQueries.js","sources":["webpack://@squide/firefly/./src/usePublicDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const PublicDataFetchStartedEvent = \"squide-public-data-fetch-started\";\nexport const PublicDataFetchFailedEvent = \"squide-public-data-fetch-failed\";\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function usePublicDataQueries<T extends Array<any>>(queries: QueriesOptions<T>): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchPublicData = useCanFetchPublicData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchPublicData,\n ...x\n })),\n combine: combineResults\n });\n\n useExecuteOnce(useCallback(() => {\n if (canFetchPublicData) {\n eventBus.dispatch(PublicDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchPublicData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"public-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"public-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n eventBus.dispatch(PublicDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global public data queries failed.\", queriesErrors);\n }\n }, [hasErrors, queriesErrors, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","GlobalDataQueriesError","useCanFetchPublicData","useExecuteOnce","PublicDataFetchStartedEvent","PublicDataFetchFailedEvent","usePublicDataQueries","queries","canFetchPublicData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isReadyRef","dispatchReady"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA2C;AACuE;AAC3D;AACQ;AACM;AACF;AACd;AAE9C,MAAMS,8BAA8B,mCAAmC;AACvE,MAAMC,6BAA6B,kCAAkC;AAM5E,8DAA8D;AACvD,SAASC,qBAA2CC,OAA0B;IACjF,MAAMC,qBAAqBN,wFAAqBA;IAChD,MAAMO,WAAWd,iEAAWA;IAE5B,MAAMe,WAAWV,oFAAsBA;IAEvC,MAAMW,iBAAiBd,iDAAWA,CAAC,CAACe;QAChC,MAAMC,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,KAAK,EAAE,GAAG,CAACA,CAAAA,IAAKA,EAAE,KAAK;QAC5D,MAAMC,YAAYF,OAAO,MAAM,GAAG;QAElC,OAAO;YACH,MAAMD,QAAQ,GAAG,CAACE,CAAAA,IAAKA,EAAE,IAAI;YAC7BD;YACAE;YACA,SAAS,CAACA,aAAa,CAACH,QAAQ,IAAI,CAACE,CAAAA,IAAKA,EAAE,SAAS;QACzD;IACJ,GAAG,EAAE;IAEL,MAAM,EAAEE,IAAI,EAAE,QAAQC,aAAa,EAAEF,SAAS,EAAEG,OAAO,EAAE,GAAGtB,yEAAUA,CAAC;QACnE,SAASW,QAAQ,GAAG,CAACO,CAAAA,IAAM;gBACvB,SAASN;gBACT,GAAGM,CAAC;YACR;QACA,SAASH;IACb;IAEAR,0EAAcA,CAACN,iDAAWA,CAAC;QACvB,IAAIW,oBAAoB;YACpBC,SAAS,QAAQ,CAACL;YAElB,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACI;QAAoBC;KAAS,GAAG;IAEpC,6FAA6F;IAC7F,MAAMU,aAAapB,4CAAMA,CAAC;IAE1B,MAAMqB,gBAAgBjB,0EAAcA,CAACN,iDAAWA,CAAC;QAC7C,IAAIqB,SAAS;YACTC,WAAW,OAAO,GAAG;YAErBT,SAAS;gBAAE,MAAM;YAAoB;YAErC,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACQ;QAASR;KAAS;IAEtBZ,+CAASA,CAAC;QACN,8CAA8C;QAC9CsB;IACJ,GAAG;QAACA;KAAc;IAElBtB,+CAASA,CAAC;QACN,IAAIqB,WAAW,OAAO,IAAIH,MAAM;YAC5BN,SAAS;gBAAE,MAAM;YAAsB;QAC3C;IACJ,GAAG;QAACM;QAAMN;KAAS;IAEnBZ,+CAASA,CAAC;QACN,IAAIiB,WAAW;YACXN,SAAS,QAAQ,CAACJ,4BAA4BY;YAE9C,MAAM,IAAIhB,sFAAsBA,CAAC,+CAA+CgB;QACpF;IACJ,GAAG;QAACF;QAAWE;QAAeR;KAAS;IAEvC,OAAOO;AACX"}
1
+ {"version":3,"file":"usePublicDataQueries.js","sources":["webpack://@squide/firefly/./src/usePublicDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const PublicDataFetchStartedEvent = \"squide-public-data-fetch-started\";\nexport const PublicDataFetchFailedEvent = \"squide-public-data-fetch-failed\";\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function usePublicDataQueries<T extends Array<any>>(queries: QueriesOptions<T>): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchPublicData = useCanFetchPublicData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchPublicData,\n ...x\n })),\n combine: combineResults\n });\n\n useExecuteOnce(useCallback(() => {\n if (canFetchPublicData) {\n eventBus.dispatch(PublicDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchPublicData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"public-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"public-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n eventBus.dispatch(PublicDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global public data queries failed.\", queriesErrors);\n }\n }, [hasErrors, queriesErrors, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","GlobalDataQueriesError","useCanFetchPublicData","useExecuteOnce","PublicDataFetchStartedEvent","PublicDataFetchFailedEvent","usePublicDataQueries","queries","canFetchPublicData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isReadyRef","dispatchReady"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAA2C;AACuE;AAC3D;AACQ;AACM;AACF;AACd;AAE9C,MAAMS,8BAA8B,mCAAmC;AACvE,MAAMC,6BAA6B,kCAAkC;AAM5E,8DAA8D;AACvD,SAASC,qBAA2CC,OAA0B;IACjF,MAAMC,qBAAqBN,qBAAqBA;IAChD,MAAMO,WAAWd,WAAWA;IAE5B,MAAMe,WAAWV,sBAAsBA;IAEvC,MAAMW,iBAAiBd,WAAWA,CAAC,CAACe;QAChC,MAAMC,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,KAAK,EAAE,GAAG,CAACA,CAAAA,IAAKA,EAAE,KAAK;QAC5D,MAAMC,YAAYF,OAAO,MAAM,GAAG;QAElC,OAAO;YACH,MAAMD,QAAQ,GAAG,CAACE,CAAAA,IAAKA,EAAE,IAAI;YAC7BD;YACAE;YACA,SAAS,CAACA,aAAa,CAACH,QAAQ,IAAI,CAACE,CAAAA,IAAKA,EAAE,SAAS;QACzD;IACJ,GAAG,EAAE;IAEL,MAAM,EAAEE,IAAI,EAAE,QAAQC,aAAa,EAAEF,SAAS,EAAEG,OAAO,EAAE,GAAGtB,UAAUA,CAAC;QACnE,SAASW,QAAQ,GAAG,CAACO,CAAAA,IAAM;gBACvB,SAASN;gBACT,GAAGM,CAAC;YACR;QACA,SAASH;IACb;IAEAR,cAAcA,CAACN,WAAWA,CAAC;QACvB,IAAIW,oBAAoB;YACpBC,SAAS,QAAQ,CAACL;YAElB,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACI;QAAoBC;KAAS,GAAG;IAEpC,6FAA6F;IAC7F,MAAMU,aAAapB,MAAMA,CAAC;IAE1B,MAAMqB,gBAAgBjB,cAAcA,CAACN,WAAWA,CAAC;QAC7C,IAAIqB,SAAS;YACTC,WAAW,OAAO,GAAG;YAErBT,SAAS;gBAAE,MAAM;YAAoB;YAErC,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACQ;QAASR;KAAS;IAEtBZ,SAASA,CAAC;QACN,8CAA8C;QAC9CsB;IACJ,GAAG;QAACA;KAAc;IAElBtB,SAASA,CAAC;QACN,IAAIqB,WAAW,OAAO,IAAIH,MAAM;YAC5BN,SAAS;gBAAE,MAAM;YAAsB;QAC3C;IACJ,GAAG;QAACM;QAAMN;KAAS;IAEnBZ,SAASA,CAAC;QACN,IAAIiB,WAAW;YACXN,SAAS,QAAQ,CAACJ,4BAA4BY;YAE9C,MAAM,IAAIhB,sBAAsBA,CAAC,+CAA+CgB;QACpF;IACJ,GAAG;QAACF;QAAWE;QAAeR;KAAS;IAEvC,OAAOO;AACX"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
2
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
1
+ import { registerDeferredRegistrations } from "@squide/module-federation";
2
+ import { useCallback } from "react";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "@squide/module-federation"
5
5
 
@@ -9,8 +9,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
9
9
 
10
10
 
11
11
  function useRegisterDeferredRegistrations() {
12
- return (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)((data, runtime)=>{
13
- return (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.registerDeferredRegistrations)(data, runtime);
12
+ return useCallback((data, runtime)=>{
13
+ return registerDeferredRegistrations(data, runtime);
14
14
  }, []);
15
15
  }
16
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"useRegisterDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useRegisterDeferredRegistrations.ts"],"sourcesContent":["import type { Runtime } from \"@squide/core\";\nimport { registerDeferredRegistrations } from \"@squide/module-federation\";\nimport { useCallback } from \"react\";\n\nexport function useRegisterDeferredRegistrations() {\n return useCallback(<TData = unknown, TRuntime extends Runtime = Runtime>(data: TData, runtime: TRuntime) => {\n return registerDeferredRegistrations(data, runtime);\n }, []);\n}\n"],"names":["registerDeferredRegistrations","useCallback","useRegisterDeferredRegistrations","data","runtime"],"mappings":";;;;;;;;AAC0E;AACtC;AAE7B,SAASE;IACZ,OAAOD,iDAAWA,CAAC,CAAsDE,MAAaC;QAClF,OAAOJ,gGAA6BA,CAACG,MAAMC;IAC/C,GAAG,EAAE;AACT"}
1
+ {"version":3,"file":"useRegisterDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useRegisterDeferredRegistrations.ts"],"sourcesContent":["import type { Runtime } from \"@squide/core\";\nimport { registerDeferredRegistrations } from \"@squide/module-federation\";\nimport { useCallback } from \"react\";\n\nexport function useRegisterDeferredRegistrations() {\n return useCallback(<TData = unknown, TRuntime extends Runtime = Runtime>(data: TData, runtime: TRuntime) => {\n return registerDeferredRegistrations(data, runtime);\n }, []);\n}\n"],"names":["registerDeferredRegistrations","useCallback","useRegisterDeferredRegistrations","data","runtime"],"mappings":";;;;;;;;AAC0E;AACtC;AAE7B,SAASE;IACZ,OAAOD,WAAWA,CAAC,CAAsDE,MAAaC;QAClF,OAAOJ,6BAA6BA,CAACG,MAAMC;IAC/C,GAAG,EAAE;AACT"}
@@ -1,6 +1,6 @@
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_react__ from "react";
1
+ import { addLocalModuleRegistrationStatusChangedListener, getLocalModuleRegistrationStatus, removeLocalModuleRegistrationStatusChangedListener, useRuntime } from "@squide/core";
2
+ import { addRemoteModuleRegistrationStatusChangedListener, areModulesReady, getRemoteModuleRegistrationStatus, removeRemoteModuleRegistrationStatusChangedListener } from "@squide/module-federation";
3
+ import { useEffect, useSyncExternalStore } from "react";
4
4
 
5
5
  ;// CONCATENATED MODULE: external "@squide/core"
6
6
 
@@ -13,19 +13,19 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
13
13
 
14
14
 
15
15
  function subscribeToLocalModuleRegistrationStatusChanged(callback) {
16
- (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.addLocalModuleRegistrationStatusChangedListener)(callback);
17
- return ()=>(0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.removeLocalModuleRegistrationStatusChangedListener)(callback);
16
+ addLocalModuleRegistrationStatusChangedListener(callback);
17
+ return ()=>removeLocalModuleRegistrationStatusChangedListener(callback);
18
18
  }
19
19
  function subscribeToRemoteModuleRegistrationStatusChanged(callback) {
20
- (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.addRemoteModuleRegistrationStatusChangedListener)(callback);
21
- return ()=>(0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.removeRemoteModuleRegistrationStatusChangedListener)(callback);
20
+ addRemoteModuleRegistrationStatusChangedListener(callback);
21
+ return ()=>removeRemoteModuleRegistrationStatusChangedListener(callback);
22
22
  }
23
23
  function useStrictRegistrationMode() {
24
- const runtime = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useRuntime)();
25
- const localModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE_react__.useSyncExternalStore)(subscribeToLocalModuleRegistrationStatusChanged, __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.getLocalModuleRegistrationStatus);
26
- const remoteModuleStatus = (0,__WEBPACK_EXTERNAL_MODULE_react__.useSyncExternalStore)(subscribeToRemoteModuleRegistrationStatusChanged, __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.getRemoteModuleRegistrationStatus);
27
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
28
- if ((0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.areModulesReady)(localModuleStatus, remoteModuleStatus)) {
24
+ const runtime = useRuntime();
25
+ const localModuleStatus = useSyncExternalStore(subscribeToLocalModuleRegistrationStatusChanged, getLocalModuleRegistrationStatus);
26
+ const remoteModuleStatus = useSyncExternalStore(subscribeToRemoteModuleRegistrationStatusChanged, getRemoteModuleRegistrationStatus);
27
+ useEffect(()=>{
28
+ if (areModulesReady(localModuleStatus, remoteModuleStatus)) {
29
29
  runtime._validateRegistrations();
30
30
  }
31
31
  }, [
@@ -1 +1 @@
1
- {"version":3,"file":"useStrictRegistrationMode.js","sources":["webpack://@squide/firefly/./src/useStrictRegistrationMode.ts"],"sourcesContent":["import { addLocalModuleRegistrationStatusChangedListener, getLocalModuleRegistrationStatus, removeLocalModuleRegistrationStatusChangedListener, useRuntime } from \"@squide/core\";\nimport { addRemoteModuleRegistrationStatusChangedListener, areModulesReady, getRemoteModuleRegistrationStatus, removeRemoteModuleRegistrationStatusChangedListener } from \"@squide/module-federation\";\nimport { useEffect, useSyncExternalStore } from \"react\";\n\nfunction subscribeToLocalModuleRegistrationStatusChanged(callback: () => void) {\n addLocalModuleRegistrationStatusChangedListener(callback);\n\n return () => removeLocalModuleRegistrationStatusChangedListener(callback);\n}\n\nfunction subscribeToRemoteModuleRegistrationStatusChanged(callback: () => void) {\n addRemoteModuleRegistrationStatusChangedListener(callback);\n\n return () => removeRemoteModuleRegistrationStatusChangedListener(callback);\n}\n\nexport function useStrictRegistrationMode() {\n const runtime = useRuntime();\n\n const localModuleStatus = useSyncExternalStore(subscribeToLocalModuleRegistrationStatusChanged, getLocalModuleRegistrationStatus);\n const remoteModuleStatus = useSyncExternalStore(subscribeToRemoteModuleRegistrationStatusChanged, getRemoteModuleRegistrationStatus);\n\n useEffect(() => {\n if (areModulesReady(localModuleStatus, remoteModuleStatus)) {\n runtime._validateRegistrations();\n }\n }, [runtime, localModuleStatus, remoteModuleStatus]);\n}\n"],"names":["addLocalModuleRegistrationStatusChangedListener","getLocalModuleRegistrationStatus","removeLocalModuleRegistrationStatusChangedListener","useRuntime","addRemoteModuleRegistrationStatusChangedListener","areModulesReady","getRemoteModuleRegistrationStatus","removeRemoteModuleRegistrationStatusChangedListener","useEffect","useSyncExternalStore","subscribeToLocalModuleRegistrationStatusChanged","callback","subscribeToRemoteModuleRegistrationStatusChanged","useStrictRegistrationMode","runtime","localModuleStatus","remoteModuleStatus"],"mappings":";;;;;;;;;;;AAAiL;AACqB;AAC9I;AAExD,SAASU,gDAAgDC,QAAoB;IACzEX,qGAA+CA,CAACW;IAEhD,OAAO,IAAMT,wGAAkDA,CAACS;AACpE;AAEA,SAASC,iDAAiDD,QAAoB;IAC1EP,mHAAgDA,CAACO;IAEjD,OAAO,IAAMJ,sHAAmDA,CAACI;AACrE;AAEO,SAASE;IACZ,MAAMC,UAAUX,gEAAUA;IAE1B,MAAMY,oBAAoBN,0DAAoBA,CAACC,iDAAiDT,kFAAgCA;IAChI,MAAMe,qBAAqBP,0DAAoBA,CAACG,kDAAkDN,gGAAiCA;IAEnIE,+CAASA,CAAC;QACN,IAAIH,kFAAeA,CAACU,mBAAmBC,qBAAqB;YACxDF,QAAQ,sBAAsB;QAClC;IACJ,GAAG;QAACA;QAASC;QAAmBC;KAAmB;AACvD"}
1
+ {"version":3,"file":"useStrictRegistrationMode.js","sources":["webpack://@squide/firefly/./src/useStrictRegistrationMode.ts"],"sourcesContent":["import { addLocalModuleRegistrationStatusChangedListener, getLocalModuleRegistrationStatus, removeLocalModuleRegistrationStatusChangedListener, useRuntime } from \"@squide/core\";\nimport { addRemoteModuleRegistrationStatusChangedListener, areModulesReady, getRemoteModuleRegistrationStatus, removeRemoteModuleRegistrationStatusChangedListener } from \"@squide/module-federation\";\nimport { useEffect, useSyncExternalStore } from \"react\";\n\nfunction subscribeToLocalModuleRegistrationStatusChanged(callback: () => void) {\n addLocalModuleRegistrationStatusChangedListener(callback);\n\n return () => removeLocalModuleRegistrationStatusChangedListener(callback);\n}\n\nfunction subscribeToRemoteModuleRegistrationStatusChanged(callback: () => void) {\n addRemoteModuleRegistrationStatusChangedListener(callback);\n\n return () => removeRemoteModuleRegistrationStatusChangedListener(callback);\n}\n\nexport function useStrictRegistrationMode() {\n const runtime = useRuntime();\n\n const localModuleStatus = useSyncExternalStore(subscribeToLocalModuleRegistrationStatusChanged, getLocalModuleRegistrationStatus);\n const remoteModuleStatus = useSyncExternalStore(subscribeToRemoteModuleRegistrationStatusChanged, getRemoteModuleRegistrationStatus);\n\n useEffect(() => {\n if (areModulesReady(localModuleStatus, remoteModuleStatus)) {\n runtime._validateRegistrations();\n }\n }, [runtime, localModuleStatus, remoteModuleStatus]);\n}\n"],"names":["addLocalModuleRegistrationStatusChangedListener","getLocalModuleRegistrationStatus","removeLocalModuleRegistrationStatusChangedListener","useRuntime","addRemoteModuleRegistrationStatusChangedListener","areModulesReady","getRemoteModuleRegistrationStatus","removeRemoteModuleRegistrationStatusChangedListener","useEffect","useSyncExternalStore","subscribeToLocalModuleRegistrationStatusChanged","callback","subscribeToRemoteModuleRegistrationStatusChanged","useStrictRegistrationMode","runtime","localModuleStatus","remoteModuleStatus"],"mappings":";;;;;;;;;;;AAAiL;AACqB;AAC9I;AAExD,SAASU,gDAAgDC,QAAoB;IACzEX,+CAA+CA,CAACW;IAEhD,OAAO,IAAMT,kDAAkDA,CAACS;AACpE;AAEA,SAASC,iDAAiDD,QAAoB;IAC1EP,gDAAgDA,CAACO;IAEjD,OAAO,IAAMJ,mDAAmDA,CAACI;AACrE;AAEO,SAASE;IACZ,MAAMC,UAAUX,UAAUA;IAE1B,MAAMY,oBAAoBN,oBAAoBA,CAACC,iDAAiDT,gCAAgCA;IAChI,MAAMe,qBAAqBP,oBAAoBA,CAACG,kDAAkDN,iCAAiCA;IAEnIE,SAASA,CAAC;QACN,IAAIH,eAAeA,CAACU,mBAAmBC,qBAAqB;YACxDF,QAAQ,sBAAsB;QAClC;IACJ,GAAG;QAACA;QAASC;QAAmBC;KAAmB;AACvD"}
@@ -1,6 +1,6 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
2
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { updateDeferredRegistrations } from "@squide/module-federation";
2
+ import { useCallback } from "react";
3
+ import { useAppRouterDispatcher } from "./AppRouterContext.js";
4
4
 
5
5
  ;// CONCATENATED MODULE: external "@squide/module-federation"
6
6
 
@@ -13,9 +13,9 @@ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./Ap
13
13
 
14
14
 
15
15
  function useUpdateDeferredRegistrations() {
16
- const dispatch = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterDispatcher)();
17
- return (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(async (data, runtime)=>{
18
- const errors = await (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.updateDeferredRegistrations)(data, runtime);
16
+ const dispatch = useAppRouterDispatcher();
17
+ return useCallback(async (data, runtime)=>{
18
+ const errors = await updateDeferredRegistrations(data, runtime);
19
19
  dispatch({
20
20
  type: "deferred-registrations-updated"
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useUpdateDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useUpdateDeferredRegistrations.ts"],"sourcesContent":["import type { Runtime } from \"@squide/core\";\nimport { updateDeferredRegistrations } from \"@squide/module-federation\";\nimport { useCallback } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\n\nexport function useUpdateDeferredRegistrations() {\n const dispatch = useAppRouterDispatcher();\n\n return useCallback(async <TData = unknown, TRuntime extends Runtime = Runtime>(data: TData, runtime: TRuntime) => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n dispatch({ type: \"deferred-registrations-updated\" });\n\n return errors;\n }, [dispatch]);\n}\n"],"names":["updateDeferredRegistrations","useCallback","useAppRouterDispatcher","useUpdateDeferredRegistrations","dispatch","data","runtime","errors"],"mappings":";;;;;;;;;;;AACwE;AACpC;AAC2B;AAExD,SAASG;IACZ,MAAMC,WAAWF,oFAAsBA;IAEvC,OAAOD,iDAAWA,CAAC,OAA4DI,MAAaC;QACxF,MAAMC,SAAS,MAAMP,8FAA2BA,CAACK,MAAMC;QAEvDF,SAAS;YAAE,MAAM;QAAiC;QAElD,OAAOG;IACX,GAAG;QAACH;KAAS;AACjB"}
1
+ {"version":3,"file":"useUpdateDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useUpdateDeferredRegistrations.ts"],"sourcesContent":["import type { Runtime } from \"@squide/core\";\nimport { updateDeferredRegistrations } from \"@squide/module-federation\";\nimport { useCallback } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\n\nexport function useUpdateDeferredRegistrations() {\n const dispatch = useAppRouterDispatcher();\n\n return useCallback(async <TData = unknown, TRuntime extends Runtime = Runtime>(data: TData, runtime: TRuntime) => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n dispatch({ type: \"deferred-registrations-updated\" });\n\n return errors;\n }, [dispatch]);\n}\n"],"names":["updateDeferredRegistrations","useCallback","useAppRouterDispatcher","useUpdateDeferredRegistrations","dispatch","data","runtime","errors"],"mappings":";;;;;;;;;;;AACwE;AACpC;AAC2B;AAExD,SAASG;IACZ,MAAMC,WAAWF,sBAAsBA;IAEvC,OAAOD,WAAWA,CAAC,OAA4DI,MAAaC;QACxF,MAAMC,SAAS,MAAMP,2BAA2BA,CAACK,MAAMC;QAEvDF,SAAS;YAAE,MAAM;QAAiC;QAElD,OAAOG;IACX,GAAG;QAACH;KAAS;AACjB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@squide/firefly",
3
3
  "author": "Workleap",
4
- "version": "13.0.1",
4
+ "version": "13.0.3",
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": {
@@ -29,34 +29,34 @@
29
29
  ],
30
30
  "peerDependencies": {
31
31
  "@opentelemetry/api": "^1.9.0",
32
- "@tanstack/react-query": "^5.77.2",
33
- "msw": "^2.8.4",
32
+ "@tanstack/react-query": "^5.81.2",
33
+ "msw": "^2.10.2",
34
34
  "react": "^18.0.0 || ^19.0.0",
35
35
  "react-dom": "^18.0.0 || ^19.0.0",
36
- "react-router": "^7.6.1"
36
+ "react-router": "^7.6.2"
37
37
  },
38
38
  "dependencies": {
39
39
  "uuid": "^11.1.0",
40
- "@squide/core": "5.4.8",
41
- "@squide/module-federation": "6.2.8",
42
- "@squide/msw": "3.2.8",
43
- "@squide/react-router": "7.0.6"
40
+ "@squide/core": "5.4.9",
41
+ "@squide/module-federation": "6.2.9",
42
+ "@squide/msw": "3.2.9",
43
+ "@squide/react-router": "7.0.7"
44
44
  },
45
45
  "devDependencies": {
46
- "@rsbuild/core": "1.3.21",
47
- "@rslib/core": "0.8.0",
46
+ "@rsbuild/core": "1.4.0",
47
+ "@rslib/core": "0.10.3",
48
48
  "@testing-library/react": "16.3.0",
49
- "@types/react": "19.1.5",
50
- "@types/react-dom": "19.1.5",
51
- "@typescript-eslint/parser": "8.32.1",
52
- "@vitejs/plugin-react": "4.5.0",
49
+ "@types/react": "19.1.8",
50
+ "@types/react-dom": "19.1.6",
51
+ "@typescript-eslint/parser": "8.35.0",
52
+ "@vitejs/plugin-react": "4.6.0",
53
53
  "@workleap/eslint-plugin": "3.4.2",
54
54
  "@workleap/rslib-configs": "1.0.6",
55
55
  "@workleap/typescript-configs": "3.0.4",
56
56
  "eslint": "8.57.0",
57
- "happy-dom": "17.4.7",
57
+ "happy-dom": "18.0.1",
58
58
  "typescript": "5.8.3",
59
- "vitest": "3.1.4"
59
+ "vitest": "3.2.4"
60
60
  },
61
61
  "sideEffects": false,
62
62
  "engines": {