@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,5 +1,64 @@
1
- export { FireflyRuntime } from './chunk-CFNKNPS3.js';
2
- import './chunk-JFMSLZ74.js';
3
- import './chunk-TURKCH7J.js';
4
- import './chunk-H2ILEMPE.js';
5
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_msw__ from "@squide/msw";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router__ from "@squide/react-router";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js__ from "./AppRouterReducer.js";
4
+
5
+ ;// CONCATENATED MODULE: external "@squide/msw"
6
+
7
+ ;// CONCATENATED MODULE: external "@squide/react-router"
8
+
9
+ ;// CONCATENATED MODULE: external "./AppRouterReducer.js"
10
+
11
+ ;// CONCATENATED MODULE: ./src/FireflyRuntime.tsx?__rslib_entry__
12
+
13
+
14
+
15
+ class FireflyRuntime extends __WEBPACK_EXTERNAL_MODULE__squide_react_router__.ReactRouterRuntime {
16
+ #useMsw;
17
+ constructor({ plugins, useMsw, ...options } = {}){
18
+ if (useMsw) {
19
+ super({
20
+ plugins: [
21
+ ...plugins ?? [],
22
+ (runtime)=>new __WEBPACK_EXTERNAL_MODULE__squide_msw__.MswPlugin(runtime)
23
+ ],
24
+ ...options
25
+ });
26
+ this.#useMsw = true;
27
+ } else {
28
+ super({
29
+ plugins,
30
+ ...options
31
+ });
32
+ this.#useMsw = false;
33
+ }
34
+ }
35
+ registerRequestHandlers(handlers) {
36
+ const mswPlugin = this.getPlugin(__WEBPACK_EXTERNAL_MODULE__squide_msw__.MswPluginName);
37
+ if (!mswPlugin) {
38
+ throw new Error("[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \"useMsw\" option?");
39
+ }
40
+ if ((0,__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js__.getAreModulesRegistered)()) {
41
+ throw new Error("[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.");
42
+ }
43
+ mswPlugin.registerRequestHandlers(handlers);
44
+ }
45
+ // Must define a return type otherwise we get an "error TS2742: The inferred type of 'requestHandlers' cannot be named" error.
46
+ get requestHandlers() {
47
+ const mswPlugin = this.getPlugin(__WEBPACK_EXTERNAL_MODULE__squide_msw__.MswPluginName);
48
+ if (!mswPlugin) {
49
+ throw new Error("[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \"useMsw\" option?");
50
+ }
51
+ return mswPlugin.requestHandlers;
52
+ }
53
+ registerRoute(route, options = {}) {
54
+ if ((0,__WEBPACK_EXTERNAL_MODULE__AppRouterReducer_js__.getAreModulesRegistered)()) {
55
+ throw new Error("[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.");
56
+ }
57
+ super.registerRoute(route, options);
58
+ }
59
+ get isMswEnabled() {
60
+ return this.#useMsw;
61
+ }
62
+ }
63
+
64
+ export { FireflyRuntime };
@@ -1,8 +1,6 @@
1
- declare class GlobalDataQueriesError extends Error {
1
+ export declare class GlobalDataQueriesError extends Error {
2
2
  #private;
3
3
  constructor(message: string, errors: Error[]);
4
4
  get errors(): Error[];
5
5
  }
6
- declare function isGlobalDataQueriesError(error?: unknown): error is GlobalDataQueriesError;
7
-
8
- export { GlobalDataQueriesError, isGlobalDataQueriesError };
6
+ export declare function isGlobalDataQueriesError(error?: unknown): error is GlobalDataQueriesError;
@@ -1 +1,17 @@
1
- export { GlobalDataQueriesError, isGlobalDataQueriesError } from './chunk-HE5HKFL3.js';
1
+
2
+ ;// CONCATENATED MODULE: ./src/GlobalDataQueriesError.ts?__rslib_entry__
3
+ class GlobalDataQueriesError extends Error {
4
+ #errors;
5
+ constructor(message, errors){
6
+ super(message);
7
+ this.#errors = errors;
8
+ }
9
+ get errors() {
10
+ return this.#errors;
11
+ }
12
+ }
13
+ function isGlobalDataQueriesError(error) {
14
+ return error !== undefined && error !== null && error instanceof GlobalDataQueriesError;
15
+ }
16
+
17
+ export { GlobalDataQueriesError, isGlobalDataQueriesError };
@@ -1,5 +1 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function RootRoute(): react_jsx_runtime.JSX.Element;
4
-
5
- export { RootRoute };
1
+ export declare function RootRoute(): import("react/jsx-runtime").JSX.Element;
package/dist/RootRoute.js CHANGED
@@ -1,3 +1,46 @@
1
- export { RootRoute } from './chunk-PMVN3U47.js';
2
- import './chunk-PP3MRMJJ.js';
3
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom__ from "react-router-dom";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__ from "./AppRouterContext.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__useIsActiveRouteProtected_js__ from "./useIsActiveRouteProtected.js";
6
+
7
+ ;// CONCATENATED MODULE: external "react/jsx-runtime"
8
+
9
+ ;// CONCATENATED MODULE: external "react"
10
+
11
+ ;// CONCATENATED MODULE: external "react-router-dom"
12
+
13
+ ;// CONCATENATED MODULE: external "./AppRouterContext.js"
14
+
15
+ ;// CONCATENATED MODULE: external "./useIsActiveRouteProtected.js"
16
+
17
+ ;// CONCATENATED MODULE: ./src/RootRoute.tsx?__rslib_entry__
18
+
19
+
20
+
21
+
22
+
23
+ function RootRoute() {
24
+ const state = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__.useAppRouterState)();
25
+ const isActiveRouteProtected = (0,__WEBPACK_EXTERNAL_MODULE__useIsActiveRouteProtected_js__.useIsActiveRouteProtected)(state.areModulesReady);
26
+ const dispatch = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__.useAppRouterDispatcher)();
27
+ (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
28
+ // Dispatching the active route visibility must be done in a route because React Router's useLocation
29
+ // hook throws if it's not called from a child of the router component.
30
+ if (isActiveRouteProtected) {
31
+ dispatch({
32
+ type: "active-route-is-protected"
33
+ });
34
+ } else {
35
+ dispatch({
36
+ type: "active-route-is-public"
37
+ });
38
+ }
39
+ }, [
40
+ isActiveRouteProtected,
41
+ dispatch
42
+ ]);
43
+ return /*#__PURE__*/ (0,__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.Outlet, {});
44
+ }
45
+
46
+ export { RootRoute };
@@ -1,20 +1,15 @@
1
- import { RegisterModulesOptions, ModuleRegisterFunction, ModuleRegistrationError } from '@squide/core';
2
- import { RemoteDefinition, RemoteModuleRegistrationError } from '@squide/module-federation';
3
- import { FireflyRuntime } from './FireflyRuntime.js';
4
- import '@squide/react-router';
5
- import 'msw';
6
-
7
- declare const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
8
- type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;
9
- interface BootstrapAppOptions<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext> {
1
+ import { type ModuleRegisterFunction, type ModuleRegistrationError, type RegisterModulesOptions } from "@squide/core";
2
+ import { type RemoteDefinition, type RemoteModuleRegistrationError } from "@squide/module-federation";
3
+ import type { FireflyRuntime } from "./FireflyRuntime.tsx";
4
+ export declare const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
5
+ export type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;
6
+ export interface BootstrapAppOptions<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext> {
10
7
  localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];
11
8
  remotes?: RemoteDefinition[];
12
9
  startMsw?: StartMswFunction<TRuntime>;
13
10
  }
14
- declare function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options?: BootstrapAppOptions<TRuntime, TContext, TData>): Promise<{
11
+ export declare function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options?: BootstrapAppOptions<TRuntime, TContext, TData>): Promise<{
15
12
  localModuleErrors: ModuleRegistrationError[];
16
13
  remoteModuleErrors: RemoteModuleRegistrationError[];
17
14
  }>;
18
- declare function __resetBootstrapGuard(): void;
19
-
20
- export { ApplicationBootstrappingStartedEvent, type BootstrapAppOptions, type StartMswFunction, __resetBootstrapGuard, bootstrap };
15
+ export declare function __resetBootstrapGuard(): void;
package/dist/boostrap.js CHANGED
@@ -1 +1,52 @@
1
- export { ApplicationBootstrappingStartedEvent, __resetBootstrapGuard, bootstrap } from './chunk-IGJHKH2A.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_core__ from "@squide/core";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation__ from "@squide/module-federation";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_msw__ from "@squide/msw";
4
+
5
+ ;// CONCATENATED MODULE: external "@squide/core"
6
+
7
+ ;// CONCATENATED MODULE: external "@squide/module-federation"
8
+
9
+ ;// CONCATENATED MODULE: external "@squide/msw"
10
+
11
+ ;// CONCATENATED MODULE: ./src/boostrap.ts?__rslib_entry__
12
+
13
+
14
+
15
+ const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
16
+ let isBootstrapped = false;
17
+ async function bootstrap(runtime, options = {}) {
18
+ const { localModules = [], remotes = [], context, startMsw } = options;
19
+ if (isBootstrapped) {
20
+ throw new Error("[squide] A squide application can only be bootstrapped once. Did you call the \"bootstrap\" function twice?");
21
+ }
22
+ runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);
23
+ let localModuleErrors = [];
24
+ let remoteModuleErrors = [];
25
+ localModuleErrors = await (0,__WEBPACK_EXTERNAL_MODULE__squide_core__.registerLocalModules)(localModules, runtime, {
26
+ context
27
+ });
28
+ remoteModuleErrors = await (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation__.registerRemoteModules)(remotes, runtime, {
29
+ context
30
+ });
31
+ if (runtime.isMswEnabled) {
32
+ if (!(0,__WEBPACK_EXTERNAL_MODULE__squide_core__.isFunction)(startMsw)) {
33
+ throw new Error("[squide] When MSW is enabled, the \"startMsw\" function must be provided.");
34
+ }
35
+ try {
36
+ await startMsw(runtime);
37
+ (0,__WEBPACK_EXTERNAL_MODULE__squide_msw__.setMswAsReady)();
38
+ } catch (error) {
39
+ runtime.logger.debug("[squide] An error occured while starting MSW.", error);
40
+ }
41
+ }
42
+ isBootstrapped = true;
43
+ return {
44
+ localModuleErrors,
45
+ remoteModuleErrors
46
+ };
47
+ }
48
+ function __resetBootstrapGuard() {
49
+ isBootstrapped = false;
50
+ }
51
+
52
+ export { ApplicationBootstrappingStartedEvent, __resetBootstrapGuard, bootstrap };
package/dist/index.d.ts CHANGED
@@ -1,28 +1,23 @@
1
- export * from '@squide/core';
2
- export * from '@squide/module-federation';
3
- export * from '@squide/msw';
4
- export * from '@squide/react-router';
5
- export { FireflyRuntime, FireflyRuntimeOptions } from './FireflyRuntime.js';
6
- export { AppRouter, AppRouterProps, AppRouterRenderFunctionArgs, RenderRouterProviderFunction, RenderRouterProviderFunctionArgs } from './AppRouter.js';
7
- export { AppRouterDispatcherContext, AppRouterStateContext, useAppRouterDispatcher, useAppRouterState } from './AppRouterContext.js';
8
- export { ActiveRouteVisiblity, AppRouterAction, AppRouterActionType, AppRouterDispatch, AppRouterState, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent, __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, getAreModulesReady, getAreModulesRegistered, useAppRouterReducer, useBootstrappingCompletedDispatcher, useModuleRegistrationStatusDispatcher, useMswStatusDispatcher } from './AppRouterReducer.js';
9
- export { GlobalDataQueriesError, isGlobalDataQueriesError } from './GlobalDataQueriesError.js';
10
- export { useCanFetchProtectedData } from './useCanFetchProtectedData.js';
11
- export { useCanFetchPublicData } from './useCanFetchPublicData.js';
12
- export { useCanRegisterDeferredRegistrations } from './useCanRegisterDeferredRegistrations.js';
13
- export { useCanUpdateDeferredRegistrations } from './useCanUpdateDeferredRegistrations.js';
14
- export { DeferredRegistrationsErrorCallback, DeferredRegistrationsErrorsObject, UseDeferredRegistrationsOptions, useDeferredRegistrations } from './useDeferredRegistrations.js';
15
- export { useIsActiveRouteProtected } from './useIsActiveRouteProtected.js';
16
- export { isApplicationBootstrapping, useIsBootstrapping } from './useIsBootstrapping.js';
17
- export { UseNavigationItemsOptions, useNavigationItems } from './useNavigationItems.js';
18
- export { IsUnauthorizedErrorCallback, ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent, useProtectedDataQueries } from './useProtectedDataQueries.js';
19
- export { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent, usePublicDataQueries } from './usePublicDataQueries.js';
20
- export { useRegisterDeferredRegistrations } from './useRegisterDeferredRegistrations.js';
21
- export { useStrictRegistrationMode } from './useStrictRegistrationMode.js';
22
- export { useUpdateDeferredRegistrations } from './useUpdateDeferredRegistrations.js';
23
- export { ApplicationBootstrappingStartedEvent, BootstrapAppOptions, StartMswFunction, __resetBootstrapGuard, bootstrap } from './boostrap.js';
24
- import 'msw';
25
- import 'react/jsx-runtime';
26
- import 'react';
27
- import 'react-router-dom';
28
- import '@tanstack/react-query';
1
+ export * from "@squide/core";
2
+ export * from "@squide/module-federation";
3
+ export * from "@squide/msw";
4
+ export * from "@squide/react-router";
5
+ export * from "./FireflyRuntime.tsx";
6
+ export * from "./AppRouter.tsx";
7
+ export * from "./AppRouterContext.ts";
8
+ export * from "./AppRouterReducer.ts";
9
+ export * from "./GlobalDataQueriesError.ts";
10
+ export * from "./useCanFetchProtectedData.ts";
11
+ export * from "./useCanFetchPublicData.ts";
12
+ export * from "./useCanRegisterDeferredRegistrations.ts";
13
+ export * from "./useCanUpdateDeferredRegistrations.ts";
14
+ export * from "./useDeferredRegistrations.ts";
15
+ export * from "./useIsActiveRouteProtected.ts";
16
+ export * from "./useIsBootstrapping.ts";
17
+ export * from "./useNavigationItems.ts";
18
+ export * from "./useProtectedDataQueries.ts";
19
+ export * from "./usePublicDataQueries.ts";
20
+ export * from "./useRegisterDeferredRegistrations.ts";
21
+ export * from "./useStrictRegistrationMode.ts";
22
+ export * from "./useUpdateDeferredRegistrations.ts";
23
+ export * from "./boostrap.ts";
package/dist/index.js CHANGED
@@ -1,25 +1,49 @@
1
- export { useNavigationItems } from './chunk-GXSW4CZS.js';
2
- export { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent, useProtectedDataQueries } from './chunk-MKTGJHQR.js';
3
- export { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent, usePublicDataQueries } from './chunk-CTLPFYLM.js';
4
- export { useCanFetchProtectedData } from './chunk-XDWYPVAJ.js';
5
- export { useCanFetchPublicData } from './chunk-IOMSOUAL.js';
6
- export { useDeferredRegistrations } from './chunk-BFHHJOJT.js';
7
- export { useRegisterDeferredRegistrations } from './chunk-YRWFYWK4.js';
8
- export { useUpdateDeferredRegistrations } from './chunk-N2GOIQ5E.js';
9
- export { useCanRegisterDeferredRegistrations } from './chunk-4RUCDAUT.js';
10
- export { useCanUpdateDeferredRegistrations } from './chunk-WVRMJZV6.js';
11
- export { AppRouter } from './chunk-L44KFU57.js';
12
- export { useStrictRegistrationMode } from './chunk-WOPD33CM.js';
13
- export { FireflyRuntime } from './chunk-CFNKNPS3.js';
14
- export { ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent, __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, getAreModulesReady, getAreModulesRegistered, useAppRouterReducer, useBootstrappingCompletedDispatcher, useModuleRegistrationStatusDispatcher, useMswStatusDispatcher } from './chunk-JFMSLZ74.js';
15
- import './chunk-TURKCH7J.js';
16
- export { isApplicationBootstrapping, useIsBootstrapping } from './chunk-H2ILEMPE.js';
17
- export { GlobalDataQueriesError, isGlobalDataQueriesError } from './chunk-HE5HKFL3.js';
18
- import './chunk-PMVN3U47.js';
19
- export { useIsActiveRouteProtected } from './chunk-PP3MRMJJ.js';
20
- export { AppRouterDispatcherContext, AppRouterStateContext, useAppRouterDispatcher, useAppRouterState } from './chunk-G32YX2KR.js';
21
- export { ApplicationBootstrappingStartedEvent, __resetBootstrapGuard, bootstrap } from './chunk-IGJHKH2A.js';
22
- export * from '@squide/core';
23
- export * from '@squide/module-federation';
24
- export * from '@squide/msw';
25
- export * from '@squide/react-router';
1
+ export * from "@squide/core";
2
+ export * from "@squide/module-federation";
3
+ export * from "@squide/msw";
4
+ export * from "@squide/react-router";
5
+ export * from "./FireflyRuntime.js";
6
+ export * from "./AppRouter.js";
7
+ export * from "./AppRouterContext.js";
8
+ export * from "./AppRouterReducer.js";
9
+ export * from "./GlobalDataQueriesError.js";
10
+ export * from "./useCanFetchProtectedData.js";
11
+ export * from "./useCanFetchPublicData.js";
12
+ export * from "./useCanRegisterDeferredRegistrations.js";
13
+ export * from "./useCanUpdateDeferredRegistrations.js";
14
+ export * from "./useDeferredRegistrations.js";
15
+ export * from "./useIsActiveRouteProtected.js";
16
+ export * from "./useIsBootstrapping.js";
17
+ export * from "./useNavigationItems.js";
18
+ export * from "./useProtectedDataQueries.js";
19
+ export * from "./usePublicDataQueries.js";
20
+ export * from "./useRegisterDeferredRegistrations.js";
21
+ export * from "./useStrictRegistrationMode.js";
22
+ export * from "./useUpdateDeferredRegistrations.js";
23
+ export * from "./boostrap.js";
24
+
25
+ ;// CONCATENATED MODULE: ./src/index.ts?__rslib_entry__
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
@@ -1,3 +1 @@
1
- declare function useCanFetchProtectedData(): boolean;
2
-
3
- export { useCanFetchProtectedData };
1
+ export declare function useCanFetchProtectedData(): boolean;
@@ -1,2 +1,15 @@
1
- export { useCanFetchProtectedData } from './chunk-XDWYPVAJ.js';
2
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__ from "./AppRouterContext.js";
2
+
3
+ ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
+
5
+ ;// CONCATENATED MODULE: ./src/useCanFetchProtectedData.ts?__rslib_entry__
6
+
7
+ function useCanFetchProtectedData() {
8
+ const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isProtectedDataReady, activeRouteVisibility } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__.useAppRouterState)();
9
+ return(// Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.
10
+ isProtectedDataReady || // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably
11
+ // depends on the protected data.
12
+ (areModulesRegistered || areModulesReady) && activeRouteVisibility === "protected" && (!waitForMsw || isMswReady));
13
+ }
14
+
15
+ export { useCanFetchProtectedData };
@@ -1,3 +1 @@
1
- declare function useCanFetchPublicData(): boolean;
2
-
3
- export { useCanFetchPublicData };
1
+ export declare function useCanFetchPublicData(): boolean;
@@ -1,2 +1,15 @@
1
- export { useCanFetchPublicData } from './chunk-IOMSOUAL.js';
2
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__ from "./AppRouterContext.js";
2
+
3
+ ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
+
5
+ ;// CONCATENATED MODULE: ./src/useCanFetchPublicData.ts?__rslib_entry__
6
+
7
+ function useCanFetchPublicData() {
8
+ const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isPublicDataReady } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__.useAppRouterState)();
9
+ return(// Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.
10
+ isPublicDataReady || // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably
11
+ // depends on the protected data.
12
+ (areModulesRegistered || areModulesReady) && (!waitForMsw || isMswReady));
13
+ }
14
+
15
+ export { useCanFetchPublicData };
@@ -1,3 +1 @@
1
- declare function useCanRegisterDeferredRegistrations(): boolean;
2
-
3
- export { useCanRegisterDeferredRegistrations };
1
+ export declare function useCanRegisterDeferredRegistrations(): boolean;
@@ -1,2 +1,12 @@
1
- export { useCanRegisterDeferredRegistrations } from './chunk-4RUCDAUT.js';
2
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__ from "./AppRouterContext.js";
2
+
3
+ ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
+
5
+ ;// CONCATENATED MODULE: ./src/useCanRegisterDeferredRegistrations.ts?__rslib_entry__
6
+
7
+ function useCanRegisterDeferredRegistrations() {
8
+ const { waitForPublicData, waitForProtectedData, areModulesReady, areModulesRegistered, isPublicDataReady, isProtectedDataReady, activeRouteVisibility, isUnauthorized } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__.useAppRouterState)();
9
+ return !isUnauthorized && areModulesRegistered && !areModulesReady && (!waitForPublicData || isPublicDataReady) && (!waitForProtectedData || activeRouteVisibility === "public" || isProtectedDataReady);
10
+ }
11
+
12
+ export { useCanRegisterDeferredRegistrations };
@@ -1,3 +1 @@
1
- declare function useCanUpdateDeferredRegistrations(): boolean | 0 | undefined;
2
-
3
- export { useCanUpdateDeferredRegistrations };
1
+ export declare function useCanUpdateDeferredRegistrations(): boolean | 0 | undefined;
@@ -1,2 +1,14 @@
1
- export { useCanUpdateDeferredRegistrations } from './chunk-WVRMJZV6.js';
2
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__ from "./AppRouterContext.js";
2
+
3
+ ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
+
5
+ ;// CONCATENATED MODULE: ./src/useCanUpdateDeferredRegistrations.ts?__rslib_entry__
6
+
7
+ function useCanUpdateDeferredRegistrations() {
8
+ const { areModulesReady, publicDataUpdatedAt, protectedDataUpdatedAt, deferredRegistrationsUpdatedAt } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js__.useAppRouterState)();
9
+ return(// Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are
10
+ // registered, the modules will be marked as ready).
11
+ areModulesReady && deferredRegistrationsUpdatedAt && (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt || protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt));
12
+ }
13
+
14
+ export { useCanUpdateDeferredRegistrations };
@@ -1,13 +1,10 @@
1
- import { ModuleRegistrationError } from '@squide/core';
2
-
3
- interface DeferredRegistrationsErrorsObject {
1
+ import { type ModuleRegistrationError } from "@squide/core";
2
+ export interface DeferredRegistrationsErrorsObject {
4
3
  localModuleErrors: ModuleRegistrationError[];
5
4
  remoteModuleErrors: ModuleRegistrationError[];
6
5
  }
7
- type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;
8
- interface UseDeferredRegistrationsOptions {
6
+ export type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;
7
+ export interface UseDeferredRegistrationsOptions {
9
8
  onError?: DeferredRegistrationsErrorCallback;
10
9
  }
11
- declare function useDeferredRegistrations(data: unknown, { onError }?: UseDeferredRegistrationsOptions): void;
12
-
13
- export { type DeferredRegistrationsErrorCallback, type DeferredRegistrationsErrorsObject, type UseDeferredRegistrationsOptions, useDeferredRegistrations };
10
+ export declare function useDeferredRegistrations(data: unknown, { onError }?: UseDeferredRegistrationsOptions): void;
@@ -1,6 +1,72 @@
1
- export { useDeferredRegistrations } from './chunk-BFHHJOJT.js';
2
- import './chunk-YRWFYWK4.js';
3
- import './chunk-N2GOIQ5E.js';
4
- import './chunk-4RUCDAUT.js';
5
- import './chunk-WVRMJZV6.js';
6
- import './chunk-G32YX2KR.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE__squide_core__ from "@squide/core";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__useCanRegisterDeferredRegistrations_js__ from "./useCanRegisterDeferredRegistrations.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__useCanUpdateDeferredRegistrations_js__ from "./useCanUpdateDeferredRegistrations.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__useRegisterDeferredRegistrations_js__ from "./useRegisterDeferredRegistrations.js";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__useUpdateDeferredRegistrations_js__ from "./useUpdateDeferredRegistrations.js";
7
+
8
+ ;// CONCATENATED MODULE: external "@squide/core"
9
+
10
+ ;// CONCATENATED MODULE: external "react"
11
+
12
+ ;// CONCATENATED MODULE: external "./useCanRegisterDeferredRegistrations.js"
13
+
14
+ ;// CONCATENATED MODULE: external "./useCanUpdateDeferredRegistrations.js"
15
+
16
+ ;// CONCATENATED MODULE: external "./useRegisterDeferredRegistrations.js"
17
+
18
+ ;// CONCATENATED MODULE: external "./useUpdateDeferredRegistrations.js"
19
+
20
+ ;// CONCATENATED MODULE: ./src/useDeferredRegistrations.ts?__rslib_entry__
21
+
22
+
23
+
24
+
25
+
26
+
27
+ function hasError({ localModuleErrors, remoteModuleErrors }) {
28
+ return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;
29
+ }
30
+ function useDeferredRegistrations(data, { onError } = {}) {
31
+ const runtime = (0,__WEBPACK_EXTERNAL_MODULE__squide_core__.useRuntime)();
32
+ const canRegisterDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useCanRegisterDeferredRegistrations_js__.useCanRegisterDeferredRegistrations)();
33
+ const canUpdateDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useCanUpdateDeferredRegistrations_js__.useCanUpdateDeferredRegistrations)();
34
+ const registerDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useRegisterDeferredRegistrations_js__.useRegisterDeferredRegistrations)();
35
+ const updateDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useUpdateDeferredRegistrations_js__.useUpdateDeferredRegistrations)();
36
+ (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
37
+ if (canRegisterDeferredRegistrations) {
38
+ const register = async ()=>{
39
+ const errors = await registerDeferredRegistrations(data, runtime);
40
+ if (hasError(errors) && onError) {
41
+ onError(errors);
42
+ }
43
+ };
44
+ register();
45
+ }
46
+ }, [
47
+ canRegisterDeferredRegistrations,
48
+ registerDeferredRegistrations,
49
+ data,
50
+ onError,
51
+ runtime
52
+ ]);
53
+ (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
54
+ if (canUpdateDeferredRegistrations) {
55
+ const update = async ()=>{
56
+ const errors = await updateDeferredRegistrations(data, runtime);
57
+ if (hasError(errors) && onError) {
58
+ onError(errors);
59
+ }
60
+ };
61
+ update();
62
+ }
63
+ }, [
64
+ canUpdateDeferredRegistrations,
65
+ updateDeferredRegistrations,
66
+ data,
67
+ onError,
68
+ runtime
69
+ ]);
70
+ }
71
+
72
+ export { useDeferredRegistrations };
@@ -1,3 +1 @@
1
- declare function useExecuteOnce(fct: () => boolean, inline?: boolean): () => void;
2
-
3
- export { useExecuteOnce };
1
+ export declare function useExecuteOnce(fct: () => boolean, inline?: boolean): () => void;
@@ -1 +1,27 @@
1
- export { useExecuteOnce } from './chunk-TURKCH7J.js';
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
+
3
+ ;// CONCATENATED MODULE: external "react"
4
+
5
+ ;// CONCATENATED MODULE: ./src/useExecuteOnce.ts?__rslib_entry__
6
+
7
+ // Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events
8
+ // and it messed with the events dispatch order.
9
+ function useExecuteOnce(fct, inline = false) {
10
+ const triggered = (0,__WEBPACK_EXTERNAL_MODULE_react__.useRef)(false);
11
+ const onceFct = (0,__WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
12
+ if (!triggered.current) {
13
+ const result = fct();
14
+ if (result) {
15
+ triggered.current = true;
16
+ }
17
+ }
18
+ }, [
19
+ fct
20
+ ]);
21
+ if (inline) {
22
+ onceFct();
23
+ }
24
+ return onceFct;
25
+ }
26
+
27
+ export { useExecuteOnce };
@@ -1,3 +1 @@
1
- declare function useIsActiveRouteProtected(areModulesReady: boolean): boolean;
2
-
3
- export { useIsActiveRouteProtected };
1
+ export declare function useIsActiveRouteProtected(areModulesReady: boolean): boolean;