@squide/firefly 9.3.0 → 9.3.2

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 (67) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/AppRouter.d.ts +8 -12
  3. package/dist/AppRouter.js +66 -8
  4. package/dist/AppRouterContext.d.ts +5 -9
  5. package/dist/AppRouterContext.js +28 -1
  6. package/dist/AppRouterReducer.d.ts +23 -26
  7. package/dist/AppRouterReducer.js +337 -4
  8. package/dist/FireflyRuntime.d.ts +5 -8
  9. package/dist/FireflyRuntime.js +64 -5
  10. package/dist/GlobalDataQueriesError.d.ts +2 -4
  11. package/dist/GlobalDataQueriesError.js +17 -1
  12. package/dist/RootRoute.d.ts +1 -5
  13. package/dist/RootRoute.js +46 -3
  14. package/dist/boostrap.d.ts +8 -13
  15. package/dist/boostrap.js +52 -1
  16. package/dist/index.d.ts +23 -28
  17. package/dist/index.js +49 -25
  18. package/dist/useCanFetchProtectedData.d.ts +1 -3
  19. package/dist/useCanFetchProtectedData.js +15 -2
  20. package/dist/useCanFetchPublicData.d.ts +1 -3
  21. package/dist/useCanFetchPublicData.js +15 -2
  22. package/dist/useCanRegisterDeferredRegistrations.d.ts +1 -3
  23. package/dist/useCanRegisterDeferredRegistrations.js +12 -2
  24. package/dist/useCanUpdateDeferredRegistrations.d.ts +1 -3
  25. package/dist/useCanUpdateDeferredRegistrations.js +14 -2
  26. package/dist/useDeferredRegistrations.d.ts +5 -8
  27. package/dist/useDeferredRegistrations.js +72 -6
  28. package/dist/useExecuteOnce.d.ts +1 -3
  29. package/dist/useExecuteOnce.js +27 -1
  30. package/dist/useIsActiveRouteProtected.d.ts +1 -3
  31. package/dist/useIsActiveRouteProtected.js +21 -1
  32. package/dist/useIsBootstrapping.d.ts +3 -7
  33. package/dist/useIsBootstrapping.js +20 -2
  34. package/dist/useNavigationItems.d.ts +3 -7
  35. package/dist/useNavigationItems.js +24 -2
  36. package/dist/useProtectedDataQueries.d.ts +6 -8
  37. package/dist/useProtectedDataQueries.js +124 -5
  38. package/dist/usePublicDataQueries.d.ts +5 -7
  39. package/dist/usePublicDataQueries.js +109 -5
  40. package/dist/useRegisterDeferredRegistrations.d.ts +4 -9
  41. package/dist/useRegisterDeferredRegistrations.js +17 -1
  42. package/dist/useStrictRegistrationMode.d.ts +1 -3
  43. package/dist/useStrictRegistrationMode.js +38 -1
  44. package/dist/useUpdateDeferredRegistrations.d.ts +4 -9
  45. package/dist/useUpdateDeferredRegistrations.js +28 -2
  46. package/package.json +29 -26
  47. package/dist/chunk-4RUCDAUT.js +0 -18
  48. package/dist/chunk-BFHHJOJT.js +0 -41
  49. package/dist/chunk-CFNKNPS3.js +0 -54
  50. package/dist/chunk-CTLPFYLM.js +0 -65
  51. package/dist/chunk-G32YX2KR.js +0 -22
  52. package/dist/chunk-GXSW4CZS.js +0 -9
  53. package/dist/chunk-H2ILEMPE.js +0 -28
  54. package/dist/chunk-HE5HKFL3.js +0 -16
  55. package/dist/chunk-IGJHKH2A.js +0 -48
  56. package/dist/chunk-IOMSOUAL.js +0 -20
  57. package/dist/chunk-JFMSLZ74.js +0 -253
  58. package/dist/chunk-L44KFU57.js +0 -34
  59. package/dist/chunk-MKTGJHQR.js +0 -71
  60. package/dist/chunk-N2GOIQ5E.js +0 -14
  61. package/dist/chunk-PMVN3U47.js +0 -21
  62. package/dist/chunk-PP3MRMJJ.js +0 -11
  63. package/dist/chunk-TURKCH7J.js +0 -20
  64. package/dist/chunk-WOPD33CM.js +0 -25
  65. package/dist/chunk-WVRMJZV6.js +0 -18
  66. package/dist/chunk-XDWYPVAJ.js +0 -21
  67. package/dist/chunk-YRWFYWK4.js +0 -11
@@ -1,14 +0,0 @@
1
- import { useAppRouterDispatcher } from './chunk-G32YX2KR.js';
2
- import { updateDeferredRegistrations } from '@squide/module-federation';
3
- import { useCallback } from 'react';
4
-
5
- function useUpdateDeferredRegistrations() {
6
- const dispatch = useAppRouterDispatcher();
7
- return useCallback(async (data, runtime) => {
8
- const errors = await updateDeferredRegistrations(data, runtime);
9
- dispatch({ type: "deferred-registrations-updated" });
10
- return errors;
11
- }, [dispatch]);
12
- }
13
-
14
- export { useUpdateDeferredRegistrations };
@@ -1,21 +0,0 @@
1
- import { useIsActiveRouteProtected } from './chunk-PP3MRMJJ.js';
2
- import { useAppRouterState, useAppRouterDispatcher } from './chunk-G32YX2KR.js';
3
- import { useEffect } from 'react';
4
- import { Outlet } from 'react-router-dom';
5
- import { jsx } from 'react/jsx-runtime';
6
-
7
- function RootRoute() {
8
- const state = useAppRouterState();
9
- const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);
10
- const dispatch = useAppRouterDispatcher();
11
- useEffect(() => {
12
- if (isActiveRouteProtected) {
13
- dispatch({ type: "active-route-is-protected" });
14
- } else {
15
- dispatch({ type: "active-route-is-public" });
16
- }
17
- }, [isActiveRouteProtected, dispatch]);
18
- return /* @__PURE__ */ jsx(Outlet, {});
19
- }
20
-
21
- export { RootRoute };
@@ -1,11 +0,0 @@
1
- import { useRouteMatch, useIsRouteProtected } from '@squide/react-router';
2
- import { useLocation } from 'react-router-dom';
3
-
4
- // src/useIsActiveRouteProtected.ts
5
- function useIsActiveRouteProtected(areModulesReady) {
6
- const location = useLocation();
7
- const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });
8
- return useIsRouteProtected(activeRoute);
9
- }
10
-
11
- export { useIsActiveRouteProtected };
@@ -1,20 +0,0 @@
1
- import { useRef, useCallback } from 'react';
2
-
3
- // src/useExecuteOnce.ts
4
- function useExecuteOnce(fct, inline = false) {
5
- const triggered = useRef(false);
6
- const onceFct = useCallback(() => {
7
- if (!triggered.current) {
8
- const result = fct();
9
- if (result) {
10
- triggered.current = true;
11
- }
12
- }
13
- }, [fct]);
14
- if (inline) {
15
- onceFct();
16
- }
17
- return onceFct;
18
- }
19
-
20
- export { useExecuteOnce };
@@ -1,25 +0,0 @@
1
- import { useRuntime, getLocalModuleRegistrationStatus, addLocalModuleRegistrationStatusChangedListener, removeLocalModuleRegistrationStatusChangedListener } from '@squide/core';
2
- import { getRemoteModuleRegistrationStatus, areModulesReady, addRemoteModuleRegistrationStatusChangedListener, removeRemoteModuleRegistrationStatusChangedListener } from '@squide/module-federation';
3
- import { useSyncExternalStore, useEffect } from 'react';
4
-
5
- // src/useStrictRegistrationMode.ts
6
- function subscribeToLocalModuleRegistrationStatusChanged(callback) {
7
- addLocalModuleRegistrationStatusChangedListener(callback);
8
- return () => removeLocalModuleRegistrationStatusChangedListener(callback);
9
- }
10
- function subscribeToRemoteModuleRegistrationStatusChanged(callback) {
11
- addRemoteModuleRegistrationStatusChangedListener(callback);
12
- return () => removeRemoteModuleRegistrationStatusChangedListener(callback);
13
- }
14
- function useStrictRegistrationMode() {
15
- const runtime = useRuntime();
16
- const localModuleStatus = useSyncExternalStore(subscribeToLocalModuleRegistrationStatusChanged, getLocalModuleRegistrationStatus);
17
- const remoteModuleStatus = useSyncExternalStore(subscribeToRemoteModuleRegistrationStatusChanged, getRemoteModuleRegistrationStatus);
18
- useEffect(() => {
19
- if (areModulesReady(localModuleStatus, remoteModuleStatus)) {
20
- runtime._validateRegistrations();
21
- }
22
- }, [runtime, localModuleStatus, remoteModuleStatus]);
23
- }
24
-
25
- export { useStrictRegistrationMode };
@@ -1,18 +0,0 @@
1
- import { useAppRouterState } from './chunk-G32YX2KR.js';
2
-
3
- // src/useCanUpdateDeferredRegistrations.ts
4
- function useCanUpdateDeferredRegistrations() {
5
- const {
6
- areModulesReady,
7
- publicDataUpdatedAt,
8
- protectedDataUpdatedAt,
9
- deferredRegistrationsUpdatedAt
10
- } = useAppRouterState();
11
- return (
12
- // Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are
13
- // registered, the modules will be marked as ready).
14
- areModulesReady && deferredRegistrationsUpdatedAt && (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt || protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt)
15
- );
16
- }
17
-
18
- export { useCanUpdateDeferredRegistrations };
@@ -1,21 +0,0 @@
1
- import { useAppRouterState } from './chunk-G32YX2KR.js';
2
-
3
- // src/useCanFetchProtectedData.ts
4
- function useCanFetchProtectedData() {
5
- const {
6
- waitForMsw,
7
- areModulesRegistered,
8
- areModulesReady,
9
- isMswReady,
10
- isProtectedDataReady,
11
- activeRouteVisibility
12
- } = useAppRouterState();
13
- return (
14
- // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.
15
- isProtectedDataReady || // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably
16
- // depends on the protected data.
17
- (areModulesRegistered || areModulesReady) && activeRouteVisibility === "protected" && (!waitForMsw || isMswReady)
18
- );
19
- }
20
-
21
- export { useCanFetchProtectedData };
@@ -1,11 +0,0 @@
1
- import { registerDeferredRegistrations } from '@squide/module-federation';
2
- import { useCallback } from 'react';
3
-
4
- // src/useRegisterDeferredRegistrations.ts
5
- function useRegisterDeferredRegistrations() {
6
- return useCallback((data, runtime) => {
7
- return registerDeferredRegistrations(data, runtime);
8
- }, []);
9
- }
10
-
11
- export { useRegisterDeferredRegistrations };