@squide/firefly 16.2.1 → 17.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 (84) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/AppRouter.js +0 -9
  3. package/dist/AppRouter.js.map +1 -1
  4. package/dist/AppRouterContext.js +0 -3
  5. package/dist/AppRouterContext.js.map +1 -1
  6. package/dist/AppRouterReducer.d.ts +17 -0
  7. package/dist/AppRouterReducer.js +0 -6
  8. package/dist/AppRouterReducer.js.map +1 -1
  9. package/dist/AppRouterStore.js +0 -2
  10. package/dist/AppRouterStore.js.map +1 -1
  11. package/dist/FireflyPlugin.js +0 -2
  12. package/dist/FireflyPlugin.js.map +1 -1
  13. package/dist/FireflyProvider.js +0 -3
  14. package/dist/FireflyProvider.js.map +1 -1
  15. package/dist/FireflyRuntime.js +0 -6
  16. package/dist/FireflyRuntime.js.map +1 -1
  17. package/dist/GlobalDataQueriesError.js +0 -2
  18. package/dist/GlobalDataQueriesError.js.map +1 -1
  19. package/dist/RootRoute.js +0 -6
  20. package/dist/RootRoute.js.map +1 -1
  21. package/dist/honeycomb/activeSpan.js +0 -4
  22. package/dist/honeycomb/activeSpan.js.map +1 -1
  23. package/dist/honeycomb/createTraceContextId.js +0 -2
  24. package/dist/honeycomb/createTraceContextId.js.map +1 -1
  25. package/dist/honeycomb/initializeHoneycomb.js +0 -2
  26. package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
  27. package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +2 -2
  28. package/dist/honeycomb/registerHoneycombInstrumentation.js +13 -26
  29. package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
  30. package/dist/honeycomb/tracer.js +0 -2
  31. package/dist/honeycomb/tracer.js.map +1 -1
  32. package/dist/honeycomb/utils.js +0 -3
  33. package/dist/honeycomb/utils.js.map +1 -1
  34. package/dist/index.js +4 -11
  35. package/dist/index.js.map +1 -1
  36. package/dist/initializeFirefly.d.ts +5 -0
  37. package/dist/initializeFirefly.js +0 -8
  38. package/dist/initializeFirefly.js.map +1 -1
  39. package/dist/internal.js +5 -13
  40. package/dist/internal.js.map +1 -1
  41. package/dist/useAppRouterStore.js +0 -2
  42. package/dist/useAppRouterStore.js.map +1 -1
  43. package/dist/useCanFetchProtectedData.js +0 -2
  44. package/dist/useCanFetchProtectedData.js.map +1 -1
  45. package/dist/useCanFetchPublicData.js +0 -2
  46. package/dist/useCanFetchPublicData.js.map +1 -1
  47. package/dist/useCanRegisterDeferredRegistrations.js +0 -2
  48. package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
  49. package/dist/useCanUpdateDeferredRegistrations.js +0 -2
  50. package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
  51. package/dist/useDeferredRegistrations.js +0 -7
  52. package/dist/useDeferredRegistrations.js.map +1 -1
  53. package/dist/useExecuteOnce.js +0 -2
  54. package/dist/useExecuteOnce.js.map +1 -1
  55. package/dist/useIsActiveRouteProtected.js +0 -3
  56. package/dist/useIsActiveRouteProtected.js.map +1 -1
  57. package/dist/useIsBootstrapping.js +0 -2
  58. package/dist/useIsBootstrapping.js.map +1 -1
  59. package/dist/useNavigationItems.js +0 -3
  60. package/dist/useNavigationItems.js.map +1 -1
  61. package/dist/useProtectedDataHandler.js +0 -3
  62. package/dist/useProtectedDataHandler.js.map +1 -1
  63. package/dist/useProtectedDataQueries.d.ts +6 -0
  64. package/dist/useProtectedDataQueries.js +0 -8
  65. package/dist/useProtectedDataQueries.js.map +1 -1
  66. package/dist/usePublicDataHandler.js +0 -3
  67. package/dist/usePublicDataHandler.js.map +1 -1
  68. package/dist/usePublicDataQueries.d.ts +6 -0
  69. package/dist/usePublicDataQueries.js +0 -8
  70. package/dist/usePublicDataQueries.js.map +1 -1
  71. package/dist/useRegisterDeferredRegistrations.js +0 -3
  72. package/dist/useRegisterDeferredRegistrations.js.map +1 -1
  73. package/dist/useStrictRegistrationMode.js +0 -3
  74. package/dist/useStrictRegistrationMode.js.map +1 -1
  75. package/dist/useUpdateDeferredRegistrations.d.ts +6 -0
  76. package/dist/useUpdateDeferredRegistrations.js +0 -4
  77. package/dist/useUpdateDeferredRegistrations.js.map +1 -1
  78. package/package.json +24 -23
  79. package/src/AppRouterReducer.ts +18 -0
  80. package/src/honeycomb/registerHoneycombInstrumentation.ts +30 -42
  81. package/src/initializeFirefly.ts +6 -0
  82. package/src/useProtectedDataQueries.ts +7 -0
  83. package/src/usePublicDataQueries.ts +7 -0
  84. package/src/useUpdateDeferredRegistrations.ts +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useCanRegisterDeferredRegistrations.js","sources":["../src/useCanRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanRegisterDeferredRegistrations() {\n const {\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n areModulesRegistered,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = useAppRouterState();\n\n return (\n !isUnauthorized\n // Wait for the modules to be registered but make sure the deferred registrations has not been registered yet (updates are handled by another hook).\n && areModulesRegistered && !areModulesReady\n // && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready since the deferred registrations will probably need that data.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n}\n"],"names":["useAppRouterState","useCanRegisterDeferredRegistrations","waitForPublicData","waitForProtectedData","areModulesReady","areModulesRegistered","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGT,iBAAiBA;IAErB,OACI,CAACS,kBAEEJ,wBAAwB,CAACD,mBAGxB,EAACF,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;AAE9F"}
1
+ {"version":3,"file":"useCanRegisterDeferredRegistrations.js","sources":["../src/useCanRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanRegisterDeferredRegistrations() {\n const {\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n areModulesRegistered,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = useAppRouterState();\n\n return (\n !isUnauthorized\n // Wait for the modules to be registered but make sure the deferred registrations has not been registered yet (updates are handled by another hook).\n && areModulesRegistered && !areModulesReady\n // && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready since the deferred registrations will probably need that data.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n}\n"],"names":["useAppRouterState","useCanRegisterDeferredRegistrations","waitForPublicData","waitForProtectedData","areModulesReady","areModulesRegistered","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized"],"mappings":";;;AAA0D;AAEnD,SAASC,mCAAmCA;IAC/C,MAAM,EACFC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGT,iBAAiBA;IAErB,OACI,CAACS,kBAEEJ,wBAAwB,CAACD,mBAGxB,EAACF,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;AAE9F"}
@@ -1,8 +1,6 @@
1
1
  import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
- ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
3
 
5
- ;// CONCATENATED MODULE: ./src/useCanUpdateDeferredRegistrations.ts
6
4
 
7
5
  function useCanUpdateDeferredRegistrations() {
8
6
  const { areModulesReady } = useAppRouterState();
@@ -1 +1 @@
1
- {"version":3,"file":"useCanUpdateDeferredRegistrations.js","sources":["../src/useCanUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanUpdateDeferredRegistrations() {\n const {\n areModulesReady\n // publicDataUpdatedAt,\n // protectedDataUpdatedAt,\n // featureFlagsUpdatedAt,\n // deferredRegistrationsUpdatedAt\n } = useAppRouterState();\n\n return areModulesReady;\n\n // return !!(\n // // Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are\n // // registered, the modules will be marked as ready).\n // areModulesReady\n // // Make sure the apps is actually having deferred registrations.\n // // && deferredRegistrationsUpdatedAt\n // // // If either the public data or the protected data has been updated, update the deferred registrations.\n // // && (\n // // (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt) ||\n // // (protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt) ||\n // // (featureFlagsUpdatedAt && featureFlagsUpdatedAt > deferredRegistrationsUpdatedAt)\n // // )\n // );\n}\n"],"names":["useAppRouterState","useCanUpdateDeferredRegistrations","areModulesReady"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,eAAe,EAKlB,GAAGF,iBAAiBA;IAErB,OAAOE;AAEP,aAAa;AACb,gJAAgJ;AAChJ,2DAA2D;AAC3D,sBAAsB;AACtB,uEAAuE;AACvE,2CAA2C;AAC3C,iHAAiH;AACjH,cAAc;AACd,8FAA8F;AAC9F,oGAAoG;AACpG,+FAA+F;AAC/F,WAAW;AACX,KAAK;AACT"}
1
+ {"version":3,"file":"useCanUpdateDeferredRegistrations.js","sources":["../src/useCanUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanUpdateDeferredRegistrations() {\n const {\n areModulesReady\n // publicDataUpdatedAt,\n // protectedDataUpdatedAt,\n // featureFlagsUpdatedAt,\n // deferredRegistrationsUpdatedAt\n } = useAppRouterState();\n\n return areModulesReady;\n\n // return !!(\n // // Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are\n // // registered, the modules will be marked as ready).\n // areModulesReady\n // // Make sure the apps is actually having deferred registrations.\n // // && deferredRegistrationsUpdatedAt\n // // // If either the public data or the protected data has been updated, update the deferred registrations.\n // // && (\n // // (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt) ||\n // // (protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt) ||\n // // (featureFlagsUpdatedAt && featureFlagsUpdatedAt > deferredRegistrationsUpdatedAt)\n // // )\n // );\n}\n"],"names":["useAppRouterState","useCanUpdateDeferredRegistrations","areModulesReady"],"mappings":";;;AAA0D;AAEnD,SAASC,iCAAiCA;IAC7C,MAAM,EACFC,eAAe,EAKlB,GAAGF,iBAAiBA;IAErB,OAAOE;AAEP,aAAa;AACb,gJAAgJ;AAChJ,2DAA2D;AAC3D,sBAAsB;AACtB,uEAAuE;AACvE,2CAA2C;AAC3C,iHAAiH;AACjH,cAAc;AACd,8FAA8F;AAC9F,oGAAoG;AACpG,+FAA+F;AAC/F,WAAW;AACX,KAAK;AACT"}
@@ -5,19 +5,12 @@ import { useCanUpdateDeferredRegistrations } from "./useCanUpdateDeferredRegistr
5
5
  import { useRegisterDeferredRegistrations } from "./useRegisterDeferredRegistrations.js";
6
6
  import { useUpdateDeferredRegistrations } from "./useUpdateDeferredRegistrations.js";
7
7
 
8
- ;// CONCATENATED MODULE: external "@squide/core"
9
8
 
10
- ;// CONCATENATED MODULE: external "react"
11
9
 
12
- ;// CONCATENATED MODULE: external "./useCanRegisterDeferredRegistrations.js"
13
10
 
14
- ;// CONCATENATED MODULE: external "./useCanUpdateDeferredRegistrations.js"
15
11
 
16
- ;// CONCATENATED MODULE: external "./useRegisterDeferredRegistrations.js"
17
12
 
18
- ;// CONCATENATED MODULE: external "./useUpdateDeferredRegistrations.js"
19
13
 
20
- ;// CONCATENATED MODULE: ./src/useDeferredRegistrations.ts
21
14
 
22
15
 
23
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"useDeferredRegistrations.js","sources":["../src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect, useRef } from \"react\";\nimport { FireflyRuntime } from \"./FireflyRuntime.tsx\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport type DeferredRegistrationsErrorCallback = (errors: ModuleRegistrationError[]) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nexport function useDeferredRegistrations(data?: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime() as FireflyRuntime;\n // const isExecutedBecauseModulesAreNowReadyRef = useRef(true);\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);\n\n if (errors.length > 0 && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError]);\n\n const isInitialUpdateDeferredRegistrationsExecution = useRef(true);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n // HACK: Skipping the first execution successfully passing the gate because this is due to\n // the modules being ready, and it's most certainly the same data that has been forwarded earlier to the deferred registration.\n // Ideally, instead of this hacky ref, it would be a ref tracking the previous data object, and the deferred registration would\n // only be updated if the current data object != than the previous data object. Sadly, it is not possible because\n // of the feature flags.\n if (isInitialUpdateDeferredRegistrationsExecution.current) {\n isInitialUpdateDeferredRegistrationsExecution.current = false;\n return;\n }\n\n const update = async () => {\n const errors = await updateDeferredRegistrations(data);\n\n if (errors.length > 0 && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [\n canUpdateDeferredRegistrations,\n updateDeferredRegistrations,\n data,\n onError,\n // Trigger this closure when the feature flags changed. Using the timestamp because the\n // actual feature flags are not forwarded to the deferred registrations.\n runtime.appRouterStore.state.featureFlagsUpdatedAt\n ]);\n}\n"],"names":["useRuntime","useEffect","useRef","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","isInitialUpdateDeferredRegistrationsExecution","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AAC9B;AAEqD;AACJ;AACF;AACJ;AAQ9E,SAASO,yBAAyBC,IAAc,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACtG,MAAMC,UAAUV,UAAUA;IAC1B,+DAA+D;IAE/D,MAAMW,mCAAmCR,mCAAmCA;IAC5E,MAAMS,iCAAiCR,iCAAiCA;IAExE,MAAMS,gCAAgCR,gCAAgCA;IACtE,MAAMS,8BAA8BR,8BAA8BA;IAElEL,SAASA,CAAC;QACN,IAAIU,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL;gBAEnD,IAAIQ,OAAO,MAAM,GAAG,KAAKP,SAAS;oBAC9BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;KAAQ;IAEnF,MAAMQ,gDAAgDf,MAAMA,CAAC;IAE7DD,SAASA,CAAC;QACN,IAAIW,gCAAgC;YAChC,0FAA0F;YAC1F,+HAA+H;YAC/H,+HAA+H;YAC/H,iHAAiH;YACjH,wBAAwB;YACxB,IAAIK,8CAA8C,OAAO,EAAE;gBACvDA,8CAA8C,OAAO,GAAG;gBACxD;YACJ;YAEA,MAAMC,SAAS;gBACX,MAAMF,SAAS,MAAMF,4BAA4BN;gBAEjD,IAAIQ,OAAO,MAAM,GAAG,KAAKP,SAAS;oBAC9BA,QAAQO;gBACZ;YACJ;YAEAE;QACJ;IACJ,GAAG;QACCN;QACAE;QACAN;QACAC;QACA,uFAAuF;QACvF,wEAAwE;QACxEC,QAAQ,cAAc,CAAC,KAAK,CAAC,qBAAqB;KACrD;AACL"}
1
+ {"version":3,"file":"useDeferredRegistrations.js","sources":["../src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect, useRef } from \"react\";\nimport { FireflyRuntime } from \"./FireflyRuntime.tsx\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport type DeferredRegistrationsErrorCallback = (errors: ModuleRegistrationError[]) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nexport function useDeferredRegistrations(data?: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime() as FireflyRuntime;\n // const isExecutedBecauseModulesAreNowReadyRef = useRef(true);\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);\n\n if (errors.length > 0 && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError]);\n\n const isInitialUpdateDeferredRegistrationsExecution = useRef(true);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n // HACK: Skipping the first execution successfully passing the gate because this is due to\n // the modules being ready, and it's most certainly the same data that has been forwarded earlier to the deferred registration.\n // Ideally, instead of this hacky ref, it would be a ref tracking the previous data object, and the deferred registration would\n // only be updated if the current data object != than the previous data object. Sadly, it is not possible because\n // of the feature flags.\n if (isInitialUpdateDeferredRegistrationsExecution.current) {\n isInitialUpdateDeferredRegistrationsExecution.current = false;\n return;\n }\n\n const update = async () => {\n const errors = await updateDeferredRegistrations(data);\n\n if (errors.length > 0 && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [\n canUpdateDeferredRegistrations,\n updateDeferredRegistrations,\n data,\n onError,\n // Trigger this closure when the feature flags changed. Using the timestamp because the\n // actual feature flags are not forwarded to the deferred registrations.\n runtime.appRouterStore.state.featureFlagsUpdatedAt\n ]);\n}\n"],"names":["useRuntime","useEffect","useRef","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","isInitialUpdateDeferredRegistrationsExecution","update"],"mappings":";;;;;;;;;;;;;AAAwE;AAC9B;AAEqD;AACJ;AACF;AACJ;AAQ9E,SAASO,wBAAwBA,CAACC,IAAc,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACtG,MAAMC,UAAUV,UAAUA;IAC1B,+DAA+D;IAE/D,MAAMW,mCAAmCR,mCAAmCA;IAC5E,MAAMS,iCAAiCR,iCAAiCA;IAExE,MAAMS,gCAAgCR,gCAAgCA;IACtE,MAAMS,8BAA8BR,8BAA8BA;IAElEL,SAASA,CAAC;QACN,IAAIU,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL;gBAEnD,IAAIQ,OAAO,MAAM,GAAG,KAAKP,SAAS;oBAC9BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;KAAQ;IAEnF,MAAMQ,gDAAgDf,MAAMA,CAAC;IAE7DD,SAASA,CAAC;QACN,IAAIW,gCAAgC;YAChC,0FAA0F;YAC1F,+HAA+H;YAC/H,+HAA+H;YAC/H,iHAAiH;YACjH,wBAAwB;YACxB,IAAIK,8CAA8C,OAAO,EAAE;gBACvDA,8CAA8C,OAAO,GAAG;gBACxD;YACJ;YAEA,MAAMC,SAAS;gBACX,MAAMF,SAAS,MAAMF,4BAA4BN;gBAEjD,IAAIQ,OAAO,MAAM,GAAG,KAAKP,SAAS;oBAC9BA,QAAQO;gBACZ;YACJ;YAEAE;QACJ;IACJ,GAAG;QACCN;QACAE;QACAN;QACAC;QACA,uFAAuF;QACvF,wEAAwE;QACxEC,QAAQ,cAAc,CAAC,KAAK,CAAC,qBAAqB;KACrD;AACL"}
@@ -1,8 +1,6 @@
1
1
  import { useCallback, useRef } from "react";
2
2
 
3
- ;// CONCATENATED MODULE: external "react"
4
3
 
5
- ;// CONCATENATED MODULE: ./src/useExecuteOnce.ts
6
4
 
7
5
  // Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events
8
6
  // and it messed with the events dispatch order.
@@ -1 +1 @@
1
- {"version":3,"file":"useExecuteOnce.js","sources":["../src/useExecuteOnce.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\n// Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events\n// and it messed with the events dispatch order.\nexport function useExecuteOnce(fct: () => boolean, inline: boolean = false) {\n const triggered = useRef(false);\n\n const onceFct = useCallback(() => {\n if (!triggered.current) {\n const result = fct();\n\n if (result) {\n triggered.current = true;\n }\n }\n }, [fct]);\n\n if (inline) {\n // eslint-disable-next-line react-hooks/refs\n onceFct();\n }\n\n return onceFct;\n}\n"],"names":["useCallback","useRef","useExecuteOnce","fct","inline","triggered","onceFct","result"],"mappings":";;;;;AAA4C;AAE5C,oGAAoG;AACpG,gDAAgD;AACzC,SAASE,eAAeC,GAAkB,EAAEC,SAAkB,KAAK;IACtE,MAAMC,YAAYJ,MAAMA,CAAC;IAEzB,MAAMK,UAAUN,WAAWA,CAAC;QACxB,IAAI,CAACK,UAAU,OAAO,EAAE;YACpB,MAAME,SAASJ;YAEf,IAAII,QAAQ;gBACRF,UAAU,OAAO,GAAG;YACxB;QACJ;IACJ,GAAG;QAACF;KAAI;IAER,IAAIC,QAAQ;QACR,4CAA4C;QAC5CE;IACJ;IAEA,OAAOA;AACX"}
1
+ {"version":3,"file":"useExecuteOnce.js","sources":["../src/useExecuteOnce.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\n// Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events\n// and it messed with the events dispatch order.\nexport function useExecuteOnce(fct: () => boolean, inline: boolean = false) {\n const triggered = useRef(false);\n\n const onceFct = useCallback(() => {\n if (!triggered.current) {\n const result = fct();\n\n if (result) {\n triggered.current = true;\n }\n }\n }, [fct]);\n\n if (inline) {\n // eslint-disable-next-line react-hooks/refs\n onceFct();\n }\n\n return onceFct;\n}\n"],"names":["useCallback","useRef","useExecuteOnce","fct","inline","triggered","onceFct","result"],"mappings":";;;AAA4C;AAE5C,oGAAoG;AACpG,gDAAgD;AACzC,SAASE,cAAcA,CAACC,GAAkB,EAAEC,SAAkB,KAAK;IACtE,MAAMC,YAAYJ,MAAMA,CAAC;IAEzB,MAAMK,UAAUN,WAAWA,CAAC;QACxB,IAAI,CAACK,UAAU,OAAO,EAAE;YACpB,MAAME,SAASJ;YAEf,IAAII,QAAQ;gBACRF,UAAU,OAAO,GAAG;YACxB;QACJ;IACJ,GAAG;QAACF;KAAI;IAER,IAAIC,QAAQ;QACR,4CAA4C;QAC5CE;IACJ;IAEA,OAAOA;AACX"}
@@ -1,11 +1,8 @@
1
1
  import { useIsRouteProtected, useRouteMatch } from "@squide/react-router";
2
2
  import { useLocation } from "react-router";
3
3
 
4
- ;// CONCATENATED MODULE: external "@squide/react-router"
5
4
 
6
- ;// CONCATENATED MODULE: external "react-router"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/useIsActiveRouteProtected.ts
9
6
 
10
7
 
11
8
  function useIsActiveRouteProtected(areModulesReady, options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"useIsActiveRouteProtected.js","sources":["../src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport interface UseIsActiveRouteProtectedOptions {\n throwWhenThereIsNoMatch?: boolean;\n}\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean, options: UseIsActiveRouteProtectedOptions = {}) {\n const {\n throwWhenThereIsNoMatch = true\n } = options;\n\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: throwWhenThereIsNoMatch && areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","options","throwWhenThereIsNoMatch","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC/B;AAMpC,SAASG,0BAA0BC,eAAwB,EAAEC,UAA4C,CAAC,CAAC;IAC9G,MAAM,EACFC,0BAA0B,IAAI,EACjC,GAAGD;IAEJ,qJAAqJ;IACrJ,MAAME,WAAWL,WAAWA;IAE5B,wJAAwJ;IACxJ,MAAMM,cAAcP,aAAaA,CAACM,UAAU;QAAE,yBAAyBD,2BAA2BF;IAAgB;IAElH,OAAOJ,mBAAmBA,CAACQ;AAC/B"}
1
+ {"version":3,"file":"useIsActiveRouteProtected.js","sources":["../src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport interface UseIsActiveRouteProtectedOptions {\n throwWhenThereIsNoMatch?: boolean;\n}\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean, options: UseIsActiveRouteProtectedOptions = {}) {\n const {\n throwWhenThereIsNoMatch = true\n } = options;\n\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: throwWhenThereIsNoMatch && areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","options","throwWhenThereIsNoMatch","location","activeRoute"],"mappings":";;;;;AAA0E;AAC/B;AAMpC,SAASG,yBAAyBA,CAACC,eAAwB,EAAEC,UAA4C,CAAC,CAAC;IAC9G,MAAM,EACFC,0BAA0B,IAAI,EACjC,GAAGD;IAEJ,qJAAqJ;IACrJ,MAAME,WAAWL,WAAWA;IAE5B,wJAAwJ;IACxJ,MAAMM,cAAcP,aAAaA,CAACM,UAAU;QAAE,yBAAyBD,2BAA2BF;IAAgB;IAElH,OAAOJ,mBAAmBA,CAACQ;AAC/B"}
@@ -1,8 +1,6 @@
1
1
  import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
- ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
3
 
5
- ;// CONCATENATED MODULE: ./src/useIsBootstrapping.ts
6
4
 
7
5
  function useIsBootstrapping() {
8
6
  const state = useAppRouterState();
@@ -1 +1 @@
1
- {"version":3,"file":"useIsBootstrapping.js","sources":["../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
+ {"version":3,"file":"useIsBootstrapping.js","sources":["../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,kBAAkBA;IAC9B,MAAMC,QAAQF,iBAAiBA;IAE/B,OAAOG,eAAeA,CAACD;AAC3B;AAEO,SAASC,eAAeA,CAACD,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,11 +1,8 @@
1
1
  import { useRuntimeNavigationItems } from "@squide/react-router";
2
2
  import { useAppRouterState } from "./AppRouterContext.js";
3
3
 
4
- ;// CONCATENATED MODULE: external "@squide/react-router"
5
4
 
6
- ;// CONCATENATED MODULE: external "./AppRouterContext.js"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/useNavigationItems.ts
9
6
 
10
7
 
11
8
  function useNavigationItems(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigationItems.js","sources":["../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
+ {"version":3,"file":"useNavigationItems.js","sources":["../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,kBAAkBA,CAACC,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,11 +1,8 @@
1
1
  import { useEffect } from "react";
2
2
  import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
3
3
 
4
- ;// CONCATENATED MODULE: external "react"
5
4
 
6
- ;// CONCATENATED MODULE: external "./useCanFetchProtectedData.js"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/useProtectedDataHandler.ts
9
6
 
10
7
 
11
8
  function useProtectedDataHandler(handler) {
@@ -1 +1 @@
1
- {"version":3,"file":"useProtectedDataHandler.js","sources":["../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
+ {"version":3,"file":"useProtectedDataHandler.js","sources":["../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,uBAAuBA,CAACC,OAAmB;IACvD,MAAMC,wBAAwBH,wBAAwBA;IAEtDD,SAASA,CAAC;QACN,IAAII,uBAAuB;YACvBD;QACJ;IACJ,GAAG;QAACC;QAAuBD;KAAQ;AACvC"}
@@ -1,6 +1,12 @@
1
1
  import { type QueriesOptions, type QueriesResults, type UseQueryResult } from "@tanstack/react-query";
2
2
  export declare const ProtectedDataFetchStartedEvent = "squide-protected-data-fetch-started";
3
3
  export declare const ProtectedDataFetchFailedEvent = "squide-protected-data-fetch-failed";
4
+ declare module "@squide/core" {
5
+ interface EventMap {
6
+ "squide-protected-data-fetch-started": void;
7
+ "squide-protected-data-fetch-failed": Error[];
8
+ }
9
+ }
4
10
  export type IsUnauthorizedErrorCallback = (error: unknown) => boolean;
5
11
  type MapUseQueryResultToData<T> = {
6
12
  [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never;
@@ -6,21 +6,13 @@ import { GlobalDataQueriesError } from "./GlobalDataQueriesError.js";
6
6
  import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
7
7
  import { useExecuteOnce } from "./useExecuteOnce.js";
8
8
 
9
- ;// CONCATENATED MODULE: external "@squide/core"
10
9
 
11
- ;// CONCATENATED MODULE: external "@tanstack/react-query"
12
10
 
13
- ;// CONCATENATED MODULE: external "react"
14
11
 
15
- ;// CONCATENATED MODULE: external "./AppRouterContext.js"
16
12
 
17
- ;// CONCATENATED MODULE: external "./GlobalDataQueriesError.js"
18
13
 
19
- ;// CONCATENATED MODULE: external "./useCanFetchProtectedData.js"
20
14
 
21
- ;// CONCATENATED MODULE: external "./useExecuteOnce.js"
22
15
 
23
- ;// CONCATENATED MODULE: ./src/useProtectedDataQueries.ts
24
16
 
25
17
 
26
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"useProtectedDataQueries.js","sources":["../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
+ {"version":3,"file":"useProtectedDataQueries.js","sources":["../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\ndeclare module \"@squide/core\" {\n interface EventMap {\n \"squide-protected-data-fetch-started\": void;\n \"squide-protected-data-fetch-failed\": Error[];\n }\n}\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,8BAA8BA,GAAG,sCAAsC;AAC7E,MAAMC,6BAA6BA,GAAG,qCAAqC;AAelF,8DAA8D;AACvD,SAASC,uBAAuBA,CAAuBC,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,8BAA8BA;YAEhD,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,6BAA6BA,EAAEa;gBAEjD,MAAM,IAAIjB,sBAAsBA,CAAC,kDAAkDiB;YACvF;QACJ;IACJ,GAAG;QAACF;QAAWE;QAAeE;QAAsBC;QAAgBb;QAAqBG;QAAUD;KAAS;IAE5G,OAAOO;AACX"}
@@ -1,11 +1,8 @@
1
1
  import { useEffect } from "react";
2
2
  import { useCanFetchPublicData } from "./useCanFetchPublicData.js";
3
3
 
4
- ;// CONCATENATED MODULE: external "react"
5
4
 
6
- ;// CONCATENATED MODULE: external "./useCanFetchPublicData.js"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/usePublicDataHandler.ts
9
6
 
10
7
 
11
8
  function usePublicDataHandler(handler) {
@@ -1 +1 @@
1
- {"version":3,"file":"usePublicDataHandler.js","sources":["../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
+ {"version":3,"file":"usePublicDataHandler.js","sources":["../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,oBAAoBA,CAACC,OAAmB;IACpD,MAAMC,qBAAqBH,qBAAqBA;IAEhDD,SAASA,CAAC;QACN,IAAII,oBAAoB;YACpBD;QACJ;IACJ,GAAG;QAACC;QAAoBD;KAAQ;AACpC"}
@@ -1,6 +1,12 @@
1
1
  import { type QueriesOptions, type QueriesResults, type UseQueryResult } from "@tanstack/react-query";
2
2
  export declare const PublicDataFetchStartedEvent = "squide-public-data-fetch-started";
3
3
  export declare const PublicDataFetchFailedEvent = "squide-public-data-fetch-failed";
4
+ declare module "@squide/core" {
5
+ interface EventMap {
6
+ "squide-public-data-fetch-started": void;
7
+ "squide-public-data-fetch-failed": Error[];
8
+ }
9
+ }
4
10
  type MapUseQueryResultToData<T> = {
5
11
  [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never;
6
12
  };
@@ -6,21 +6,13 @@ import { GlobalDataQueriesError } from "./GlobalDataQueriesError.js";
6
6
  import { useCanFetchPublicData } from "./useCanFetchPublicData.js";
7
7
  import { useExecuteOnce } from "./useExecuteOnce.js";
8
8
 
9
- ;// CONCATENATED MODULE: external "@squide/core"
10
9
 
11
- ;// CONCATENATED MODULE: external "@tanstack/react-query"
12
10
 
13
- ;// CONCATENATED MODULE: external "react"
14
11
 
15
- ;// CONCATENATED MODULE: external "./AppRouterContext.js"
16
12
 
17
- ;// CONCATENATED MODULE: external "./GlobalDataQueriesError.js"
18
13
 
19
- ;// CONCATENATED MODULE: external "./useCanFetchPublicData.js"
20
14
 
21
- ;// CONCATENATED MODULE: external "./useExecuteOnce.js"
22
15
 
23
- ;// CONCATENATED MODULE: ./src/usePublicDataQueries.ts
24
16
 
25
17
 
26
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"usePublicDataQueries.js","sources":["../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
+ {"version":3,"file":"usePublicDataQueries.js","sources":["../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\ndeclare module \"@squide/core\" {\n interface EventMap {\n \"squide-public-data-fetch-started\": void;\n \"squide-public-data-fetch-failed\": Error[];\n }\n}\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,2BAA2BA,GAAG,mCAAmC;AACvE,MAAMC,0BAA0BA,GAAG,kCAAkC;AAa5E,8DAA8D;AACvD,SAASC,oBAAoBA,CAAuBC,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,2BAA2BA;YAE7C,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,0BAA0BA,EAAEY;YAE9C,MAAM,IAAIhB,sBAAsBA,CAAC,+CAA+CgB;QACpF;IACJ,GAAG;QAACF;QAAWE;QAAeR;KAAS;IAEvC,OAAOO;AACX"}
@@ -1,11 +1,8 @@
1
1
  import { useRuntime } from "@squide/core";
2
2
  import { useCallback } from "react";
3
3
 
4
- ;// CONCATENATED MODULE: external "@squide/core"
5
4
 
6
- ;// CONCATENATED MODULE: external "react"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/useRegisterDeferredRegistrations.ts
9
6
 
10
7
 
11
8
  function useRegisterDeferredRegistrations() {
@@ -1 +1 @@
1
- {"version":3,"file":"useRegisterDeferredRegistrations.js","sources":["../src/useRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\n\nexport function useRegisterDeferredRegistrations() {\n const runtime = useRuntime();\n\n return useCallback(<TData = unknown>(data?: TData) => {\n return runtime.moduleManager.registerDeferredRegistrations(data);\n }, [runtime]);\n}\n"],"names":["useRuntime","useCallback","useRegisterDeferredRegistrations","runtime","data"],"mappings":";;;;;;;;AAA0C;AACN;AAE7B,SAASE;IACZ,MAAMC,UAAUH,UAAUA;IAE1B,OAAOC,WAAWA,CAAC,CAAkBG;QACjC,OAAOD,QAAQ,aAAa,CAAC,6BAA6B,CAACC;IAC/D,GAAG;QAACD;KAAQ;AAChB"}
1
+ {"version":3,"file":"useRegisterDeferredRegistrations.js","sources":["../src/useRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\n\nexport function useRegisterDeferredRegistrations() {\n const runtime = useRuntime();\n\n return useCallback(<TData = unknown>(data?: TData) => {\n return runtime.moduleManager.registerDeferredRegistrations(data);\n }, [runtime]);\n}\n"],"names":["useRuntime","useCallback","useRegisterDeferredRegistrations","runtime","data"],"mappings":";;;;;AAA0C;AACN;AAE7B,SAASE,gCAAgCA;IAC5C,MAAMC,UAAUH,UAAUA;IAE1B,OAAOC,WAAWA,CAAC,CAAkBG;QACjC,OAAOD,QAAQ,aAAa,CAAC,6BAA6B,CAACC;IAC/D,GAAG;QAACD;KAAQ;AAChB"}
@@ -1,11 +1,8 @@
1
1
  import { useRuntime } from "@squide/core";
2
2
  import { useCallback, useEffect, useSyncExternalStore } from "react";
3
3
 
4
- ;// CONCATENATED MODULE: external "@squide/core"
5
4
 
6
- ;// CONCATENATED MODULE: external "react"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/useStrictRegistrationMode.ts
9
6
 
10
7
 
11
8
  function useStrictRegistrationMode(options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"useStrictRegistrationMode.js","sources":["../src/useStrictRegistrationMode.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback, useEffect, useSyncExternalStore } from \"react\";\n\nexport interface UseStrictRegistrationModeOptions {\n isEnabled?: boolean;\n}\n\nexport function useStrictRegistrationMode(options: UseStrictRegistrationModeOptions = {}) {\n const {\n isEnabled = true\n } = options;\n\n const runtime = useRuntime();\n\n const subscribe = useCallback((callback: () => void) => {\n runtime.moduleManager.registerModulesReadyListener(callback);\n\n return () => {\n runtime.moduleManager.removeModulesReadyListener(callback);\n };\n }, [runtime]);\n\n // This listener is only executed if the modules are ready.\n const areModulesReady = useSyncExternalStore(subscribe, () => runtime.moduleManager.getAreModulesReady());\n\n useEffect(() => {\n if (areModulesReady && isEnabled) {\n runtime._validateRegistrations();\n }\n }, [runtime, areModulesReady, isEnabled]);\n}\n"],"names":["useRuntime","useCallback","useEffect","useSyncExternalStore","useStrictRegistrationMode","options","isEnabled","runtime","subscribe","callback","areModulesReady"],"mappings":";;;;;;;;AAA0C;AAC2B;AAM9D,SAASI,0BAA0BC,UAA4C,CAAC,CAAC;IACpF,MAAM,EACFC,YAAY,IAAI,EACnB,GAAGD;IAEJ,MAAME,UAAUP,UAAUA;IAE1B,MAAMQ,YAAYP,WAAWA,CAAC,CAACQ;QAC3BF,QAAQ,aAAa,CAAC,4BAA4B,CAACE;QAEnD,OAAO;YACHF,QAAQ,aAAa,CAAC,0BAA0B,CAACE;QACrD;IACJ,GAAG;QAACF;KAAQ;IAEZ,2DAA2D;IAC3D,MAAMG,kBAAkBP,oBAAoBA,CAACK,WAAW,IAAMD,QAAQ,aAAa,CAAC,kBAAkB;IAEtGL,SAASA,CAAC;QACN,IAAIQ,mBAAmBJ,WAAW;YAC9BC,QAAQ,sBAAsB;QAClC;IACJ,GAAG;QAACA;QAASG;QAAiBJ;KAAU;AAC5C"}
1
+ {"version":3,"file":"useStrictRegistrationMode.js","sources":["../src/useStrictRegistrationMode.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback, useEffect, useSyncExternalStore } from \"react\";\n\nexport interface UseStrictRegistrationModeOptions {\n isEnabled?: boolean;\n}\n\nexport function useStrictRegistrationMode(options: UseStrictRegistrationModeOptions = {}) {\n const {\n isEnabled = true\n } = options;\n\n const runtime = useRuntime();\n\n const subscribe = useCallback((callback: () => void) => {\n runtime.moduleManager.registerModulesReadyListener(callback);\n\n return () => {\n runtime.moduleManager.removeModulesReadyListener(callback);\n };\n }, [runtime]);\n\n // This listener is only executed if the modules are ready.\n const areModulesReady = useSyncExternalStore(subscribe, () => runtime.moduleManager.getAreModulesReady());\n\n useEffect(() => {\n if (areModulesReady && isEnabled) {\n runtime._validateRegistrations();\n }\n }, [runtime, areModulesReady, isEnabled]);\n}\n"],"names":["useRuntime","useCallback","useEffect","useSyncExternalStore","useStrictRegistrationMode","options","isEnabled","runtime","subscribe","callback","areModulesReady"],"mappings":";;;;;AAA0C;AAC2B;AAM9D,SAASI,yBAAyBA,CAACC,UAA4C,CAAC,CAAC;IACpF,MAAM,EACFC,YAAY,IAAI,EACnB,GAAGD;IAEJ,MAAME,UAAUP,UAAUA;IAE1B,MAAMQ,YAAYP,WAAWA,CAAC,CAACQ;QAC3BF,QAAQ,aAAa,CAAC,4BAA4B,CAACE;QAEnD,OAAO;YACHF,QAAQ,aAAa,CAAC,0BAA0B,CAACE;QACrD;IACJ,GAAG;QAACF;KAAQ;IAEZ,2DAA2D;IAC3D,MAAMG,kBAAkBP,oBAAoBA,CAACK,WAAW,IAAMD,QAAQ,aAAa,CAAC,kBAAkB;IAEtGL,SAASA,CAAC;QACN,IAAIQ,mBAAmBJ,WAAW;YAC9BC,QAAQ,sBAAsB;QAClC;IACJ,GAAG;QAACA;QAASG;QAAiBJ;KAAU;AAC5C"}
@@ -1,3 +1,9 @@
1
1
  export declare const DeferredRegistrationsUpdateStartedEvent = "squide-deferred-registrations-update-started";
2
2
  export declare const DeferredRegistrationsUpdateCompletedEvent = "squide-deferred-registrations-update-completed-started";
3
+ declare module "@squide/core" {
4
+ interface EventMap {
5
+ "squide-deferred-registrations-update-started": void;
6
+ "squide-deferred-registrations-update-completed-started": void;
7
+ }
8
+ }
3
9
  export declare function useUpdateDeferredRegistrations(): <TData = unknown>(data?: TData) => Promise<import("@squide/core").ModuleRegistrationError[]>;
@@ -2,13 +2,9 @@ import { useRuntime } from "@squide/core";
2
2
  import { useCallback } from "react";
3
3
  import { useAppRouterDispatcher } from "./AppRouterContext.js";
4
4
 
5
- ;// CONCATENATED MODULE: external "@squide/core"
6
5
 
7
- ;// CONCATENATED MODULE: external "react"
8
6
 
9
- ;// CONCATENATED MODULE: external "./AppRouterContext.js"
10
7
 
11
- ;// CONCATENATED MODULE: ./src/useUpdateDeferredRegistrations.ts
12
8
 
13
9
 
14
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"useUpdateDeferredRegistrations.js","sources":["../src/useUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\n\nexport const DeferredRegistrationsUpdateStartedEvent = \"squide-deferred-registrations-update-started\";\nexport const DeferredRegistrationsUpdateCompletedEvent = \"squide-deferred-registrations-update-completed-started\";\n\nexport function useUpdateDeferredRegistrations() {\n const runtime = useRuntime();\n const dispatch = useAppRouterDispatcher();\n\n return useCallback(async <TData = unknown>(data?: TData) => {\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateStartedEvent);\n\n const errors = await runtime.moduleManager.updateDeferredRegistrations(data);\n\n dispatch({ type: \"deferred-registrations-updated\" });\n\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateCompletedEvent);\n\n return errors;\n }, [runtime, dispatch]);\n}\n"],"names":["useRuntime","useCallback","useAppRouterDispatcher","DeferredRegistrationsUpdateStartedEvent","DeferredRegistrationsUpdateCompletedEvent","useUpdateDeferredRegistrations","runtime","dispatch","data","errors"],"mappings":";;;;;;;;;;;AAA0C;AACN;AAC2B;AAExD,MAAMG,0CAA0C,+CAA+C;AAC/F,MAAMC,4CAA4C,yDAAyD;AAE3G,SAASC;IACZ,MAAMC,UAAUN,UAAUA;IAC1B,MAAMO,WAAWL,sBAAsBA;IAEvC,OAAOD,WAAWA,CAAC,OAAwBO;QACvCF,QAAQ,QAAQ,CAAC,QAAQ,CAACH;QAE1B,MAAMM,SAAS,MAAMH,QAAQ,aAAa,CAAC,2BAA2B,CAACE;QAEvED,SAAS;YAAE,MAAM;QAAiC;QAElDD,QAAQ,QAAQ,CAAC,QAAQ,CAACF;QAE1B,OAAOK;IACX,GAAG;QAACH;QAASC;KAAS;AAC1B"}
1
+ {"version":3,"file":"useUpdateDeferredRegistrations.js","sources":["../src/useUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\n\nexport const DeferredRegistrationsUpdateStartedEvent = \"squide-deferred-registrations-update-started\";\nexport const DeferredRegistrationsUpdateCompletedEvent = \"squide-deferred-registrations-update-completed-started\";\n\ndeclare module \"@squide/core\" {\n interface EventMap {\n \"squide-deferred-registrations-update-started\": void;\n \"squide-deferred-registrations-update-completed-started\": void;\n }\n}\n\nexport function useUpdateDeferredRegistrations() {\n const runtime = useRuntime();\n const dispatch = useAppRouterDispatcher();\n\n return useCallback(async <TData = unknown>(data?: TData) => {\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateStartedEvent);\n\n const errors = await runtime.moduleManager.updateDeferredRegistrations(data);\n\n dispatch({ type: \"deferred-registrations-updated\" });\n\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateCompletedEvent);\n\n return errors;\n }, [runtime, dispatch]);\n}\n"],"names":["useRuntime","useCallback","useAppRouterDispatcher","DeferredRegistrationsUpdateStartedEvent","DeferredRegistrationsUpdateCompletedEvent","useUpdateDeferredRegistrations","runtime","dispatch","data","errors"],"mappings":";;;;;;;AAA0C;AACN;AAC2B;AAExD,MAAMG,uCAAuCA,GAAG,+CAA+C;AAC/F,MAAMC,yCAAyCA,GAAG,yDAAyD;AAS3G,SAASC,8BAA8BA;IAC1C,MAAMC,UAAUN,UAAUA;IAC1B,MAAMO,WAAWL,sBAAsBA;IAEvC,OAAOD,WAAWA,CAAC,OAAwBO;QACvCF,QAAQ,QAAQ,CAAC,QAAQ,CAACH,uCAAuCA;QAEjE,MAAMM,SAAS,MAAMH,QAAQ,aAAa,CAAC,2BAA2B,CAACE;QAEvED,SAAS;YAAE,MAAM;QAAiC;QAElDD,QAAQ,QAAQ,CAAC,QAAQ,CAACF,yCAAyCA;QAEnE,OAAOK;IACX,GAAG;QAACH;QAASC;KAAS;AAC1B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@squide/firefly",
3
3
  "author": "Workleap",
4
- "version": "16.2.1",
4
+ "version": "17.0.0",
5
5
  "description": "Squide bundle for the firefly technology stack.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -32,13 +32,13 @@
32
32
  "CHANGELOG.md"
33
33
  ],
34
34
  "peerDependencies": {
35
- "@opentelemetry/api": "^1.9.0",
36
- "@tanstack/react-query": "^5.90.21",
35
+ "@opentelemetry/api": "^1.9.1",
36
+ "@tanstack/react-query": "^5.96.0",
37
37
  "launchdarkly-js-client-sdk": "^3.9.0",
38
- "msw": "^2.12.10",
38
+ "msw": "^2.12.14",
39
39
  "react": "^18.0.0 || ^19.0.0",
40
40
  "react-dom": "^18.0.0 || ^19.0.0",
41
- "react-router": "^7.13.1"
41
+ "react-router": "^7.13.2"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@opentelemetry/api": {
@@ -46,33 +46,34 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@workleap-telemetry/core": "^2.0.0",
50
- "@workleap/logging": "^1.3.6",
49
+ "@workleap-telemetry/core": "^2.0.1",
50
+ "@workleap/logging": "^1.3.7",
51
51
  "uuid": "^13.0.0",
52
- "@squide/env-vars": "^1.4.19",
53
- "@squide/launch-darkly": "^1.0.10",
54
- "@squide/msw": "^4.0.17",
55
- "@squide/core": "^6.1.14",
56
- "@squide/react-router": "^8.1.17"
52
+ "@squide/core": "^7.0.0",
53
+ "@squide/env-vars": "^1.4.21",
54
+ "@squide/launch-darkly": "^1.0.13",
55
+ "@squide/msw": "^4.0.19",
56
+ "@squide/react-router": "^8.1.19"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@eslint/js": "9.39.2",
60
- "@rsbuild/core": "1.7.3",
61
- "@rslib/core": "0.19.6",
60
+ "@rsbuild/core": "1.7.5",
61
+ "@rslib/core": "0.20.2",
62
62
  "@testing-library/react": "16.3.2",
63
+ "@types/node": "25.5.0",
63
64
  "@types/react": "19.2.14",
64
65
  "@types/react-dom": "19.2.3",
65
- "@typescript-eslint/parser": "8.56.1",
66
- "@typescript/native-preview": "7.0.0-dev.20260303.1",
67
- "@vitejs/plugin-react": "5.1.4",
68
- "@workleap/eslint-configs": "1.1.13",
69
- "@workleap/rslib-configs": "1.1.7",
70
- "@workleap/typescript-configs": "3.0.7",
66
+ "@typescript-eslint/parser": "8.58.0",
67
+ "@typescript/native-preview": "7.0.0-dev.20260331.1",
68
+ "@vitejs/plugin-react": "6.0.1",
69
+ "@workleap/eslint-configs": "2.0.1",
70
+ "@workleap/rslib-configs": "1.1.11",
71
+ "@workleap/typescript-configs": "4.0.0",
71
72
  "eslint": "9.39.2",
72
- "happy-dom": "20.8.3",
73
- "typescript": "5.9.3",
73
+ "happy-dom": "20.8.9",
74
+ "typescript": "6.0.2",
74
75
  "typescript-eslint": "8.54.0",
75
- "vitest": "4.0.18"
76
+ "vitest": "4.1.2"
76
77
  },
77
78
  "sideEffects": false,
78
79
  "scripts": {
@@ -56,6 +56,24 @@ export const ProtectedDataUpdatedEvent = "squide-protected-data-updated";
56
56
  export const DeferredRegistrationsUpdatedEvent = "squide-deferred-registrations-updated";
57
57
  export const ApplicationBoostrappedEvent = "squide-app-boostrapped";
58
58
 
59
+ declare module "@squide/core" {
60
+ interface EventMap {
61
+ "squide-modules-registered": AppRouterWaitState;
62
+ "squide-modules-ready": AppRouterWaitState;
63
+ "squide-msw-ready": AppRouterWaitState;
64
+ "squide-active-route-is-public": AppRouterWaitState;
65
+ "squide-active-route-is-protected": AppRouterWaitState;
66
+ "squide-public-data-ready": AppRouterWaitState;
67
+ "squide-protected-data-ready": AppRouterWaitState;
68
+ "squide-public-data-updated": AppRouterWaitState;
69
+ "squide-protected-data-updated": AppRouterWaitState;
70
+ "squide-deferred-registrations-updated": AppRouterWaitState;
71
+ "squide-feature-flags-updated": AppRouterWaitState;
72
+ "squide-is-unauthorized": AppRouterWaitState;
73
+ "squide-app-boostrapped": AppRouterWaitState;
74
+ }
75
+ }
76
+
59
77
  export interface AppRouterAction {
60
78
  type: AppRouterActionType;
61
79
  payload?: unknown;