@squide/firefly 13.0.0 → 13.0.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 (69) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/AppRouter.js +17 -17
  3. package/dist/AppRouter.js.map +1 -1
  4. package/dist/AppRouterContext.js +8 -8
  5. package/dist/AppRouterContext.js.map +1 -1
  6. package/dist/AppRouterReducer.js +47 -47
  7. package/dist/AppRouterReducer.js.map +1 -1
  8. package/dist/FireflyProvider.js +3 -3
  9. package/dist/FireflyProvider.js.map +1 -1
  10. package/dist/FireflyRuntime.js +11 -11
  11. package/dist/FireflyRuntime.js.map +1 -1
  12. package/dist/RootRoute.js +10 -10
  13. package/dist/RootRoute.js.map +1 -1
  14. package/dist/honeycomb/activeSpan.js +6 -6
  15. package/dist/honeycomb/activeSpan.js.map +1 -1
  16. package/dist/honeycomb/canRegisterHoneycombInstrumentation.d.ts +1 -0
  17. package/dist/honeycomb/canRegisterHoneycombInstrumentation.js +11 -0
  18. package/dist/honeycomb/canRegisterHoneycombInstrumentation.js.map +1 -0
  19. package/dist/honeycomb/initializeHoneycomb.d.ts +2 -0
  20. package/dist/honeycomb/initializeHoneycomb.js +25 -0
  21. package/dist/honeycomb/initializeHoneycomb.js.map +1 -0
  22. package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +1 -2
  23. package/dist/honeycomb/registerHoneycombInstrumentation.js +104 -99
  24. package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
  25. package/dist/honeycomb/tracer.js +2 -2
  26. package/dist/honeycomb/tracer.js.map +1 -1
  27. package/dist/honeycomb/utils.js +12 -12
  28. package/dist/honeycomb/utils.js.map +1 -1
  29. package/dist/initializeFirefly.js +19 -18
  30. package/dist/initializeFirefly.js.map +1 -1
  31. package/dist/useAppRouterStore.js +2 -2
  32. package/dist/useAppRouterStore.js.map +1 -1
  33. package/dist/useCanFetchProtectedData.js +2 -2
  34. package/dist/useCanFetchProtectedData.js.map +1 -1
  35. package/dist/useCanFetchPublicData.js +2 -2
  36. package/dist/useCanFetchPublicData.js.map +1 -1
  37. package/dist/useCanRegisterDeferredRegistrations.js +2 -2
  38. package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
  39. package/dist/useCanUpdateDeferredRegistrations.js +2 -2
  40. package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
  41. package/dist/useDeferredRegistrations.js +13 -13
  42. package/dist/useDeferredRegistrations.js.map +1 -1
  43. package/dist/useExecuteOnce.js +3 -3
  44. package/dist/useExecuteOnce.js.map +1 -1
  45. package/dist/useIsActiveRouteProtected.js +5 -5
  46. package/dist/useIsActiveRouteProtected.js.map +1 -1
  47. package/dist/useIsBootstrapping.js +2 -2
  48. package/dist/useIsBootstrapping.js.map +1 -1
  49. package/dist/useNavigationItems.js +4 -4
  50. package/dist/useNavigationItems.js.map +1 -1
  51. package/dist/useProtectedDataHandler.js +4 -4
  52. package/dist/useProtectedDataHandler.js.map +1 -1
  53. package/dist/useProtectedDataQueries.js +20 -20
  54. package/dist/useProtectedDataQueries.js.map +1 -1
  55. package/dist/usePublicDataHandler.js +4 -4
  56. package/dist/usePublicDataHandler.js.map +1 -1
  57. package/dist/usePublicDataQueries.js +19 -19
  58. package/dist/usePublicDataQueries.js.map +1 -1
  59. package/dist/useRegisterDeferredRegistrations.js +4 -4
  60. package/dist/useRegisterDeferredRegistrations.js.map +1 -1
  61. package/dist/useStrictRegistrationMode.js +12 -12
  62. package/dist/useStrictRegistrationMode.js.map +1 -1
  63. package/dist/useUpdateDeferredRegistrations.js +6 -6
  64. package/dist/useUpdateDeferredRegistrations.js.map +1 -1
  65. package/package.json +16 -21
  66. package/src/honeycomb/canRegisterHoneycombInstrumentation.ts +5 -0
  67. package/src/honeycomb/initializeHoneycomb.ts +22 -0
  68. package/src/honeycomb/registerHoneycombInstrumentation.ts +43 -50
  69. package/src/initializeFirefly.ts +12 -9
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/tracer.js","sources":["webpack://@squide/firefly/./src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;;;AAA2C;AAEpC,SAASC;IACZ,2DAA2D;IAC3D,OAAOD,uEAAe,CAAC;AAC3B"}
1
+ {"version":3,"file":"honeycomb/tracer.js","sources":["webpack://@squide/firefly/./src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;;;AAA2C;AAEpC,SAASC;IACZ,2DAA2D;IAC3D,OAAOD,eAAe,CAAC;AAC3B"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__ from "@opentelemetry/api";
2
- import * as __WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__ from "./activeSpan.js";
1
+ import { SpanKind, SpanStatusCode, context as api_context, trace } from "@opentelemetry/api";
2
+ import { popActiveSpan, setActiveSpan } from "./activeSpan.js";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "@opentelemetry/api"
5
5
 
@@ -10,37 +10,37 @@ import * as __WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__ from "./activeSp
10
10
 
11
11
  function startSpan(factory) {
12
12
  return factory({
13
- kind: __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.SpanKind.CLIENT
13
+ kind: SpanKind.CLIENT
14
14
  });
15
15
  }
16
16
  function startChildSpan(parent, factory) {
17
- const context = __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.trace.setSpan(__WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.context.active(), parent);
17
+ const context = trace.setSpan(api_context.active(), parent);
18
18
  return factory({
19
- kind: __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.SpanKind.CLIENT
19
+ kind: SpanKind.CLIENT
20
20
  }, context);
21
21
  }
22
22
  function startActiveSpan(factory) {
23
23
  const { name, span } = factory({
24
- kind: __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.SpanKind.CLIENT
24
+ kind: SpanKind.CLIENT
25
25
  });
26
- return (0,__WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__.setActiveSpan)(name, span);
26
+ return setActiveSpan(name, span);
27
27
  }
28
28
  function startActiveChildSpan(parent, factory) {
29
- const context = __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.trace.setSpan(__WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.context.active(), parent);
29
+ const context = trace.setSpan(api_context.active(), parent);
30
30
  const { name, span } = factory({
31
- kind: __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.SpanKind.CLIENT
31
+ kind: SpanKind.CLIENT
32
32
  }, context);
33
- return (0,__WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__.setActiveSpan)(name, span);
33
+ return setActiveSpan(name, span);
34
34
  }
35
35
  function endActiveSpan(span) {
36
36
  span.instance.end();
37
- (0,__WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__.popActiveSpan)(span);
37
+ popActiveSpan(span);
38
38
  }
39
39
  function traceError(span, error, options = {}) {
40
40
  const { time } = options;
41
41
  span.recordException(error, time);
42
42
  span.setStatus({
43
- code: __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__.SpanStatusCode.ERROR
43
+ code: SpanStatusCode.ERROR
44
44
  });
45
45
  }
46
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/utils.js","sources":["webpack://@squide/firefly/./src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;;;;AAAqL;AACrG;AAIzE,SAASQ,UAAUC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,uEAAe;IAAC;AAC3C;AAIO,SAASM,eAAeC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,qEAAiB,CAACF,sEAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,uEAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,gBAAgBH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,uEAAe;IAAC;IAEvD,OAAOG,qEAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,qBAAqBJ,MAAY,EAAEF,OAAoC;IACnF,MAAMT,UAAUG,qEAAiB,CAACF,sEAAkB,IAAIU;IAExD,MAAM,EAAEE,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,uEAAe;IAAC,GAAGJ;IAE1D,OAAOO,qEAAaA,CAACM,MAAMC;AAC/B;AAEO,SAASE,cAAcF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,qEAAaA,CAACQ;AAClB;AAMO,SAASG,WAAWH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,4EAAoB;IAC9B;AACJ"}
1
+ {"version":3,"file":"honeycomb/utils.js","sources":["webpack://@squide/firefly/./src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;;;;AAAqL;AACrG;AAIzE,SAASQ,UAAUC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,eAAe;IAAC;AAC3C;AAIO,SAASM,eAAeC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,gBAAgBH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC;IAEvD,OAAOG,aAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,qBAAqBJ,MAAY,EAAEF,OAAoC;IACnF,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,MAAM,EAAEE,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;IAE1D,OAAOO,aAAaA,CAACM,MAAMC;AAC/B;AAEO,SAASE,cAAcF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,aAAaA,CAACQ;AAClB;AAMO,SAASG,WAAWH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,oBAAoB;IAC9B;AACJ"}
@@ -1,8 +1,8 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
- import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
3
- import * as __WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__ from "@squide/msw";
4
- import * as __WEBPACK_EXTERNAL_MODULE__FireflyRuntime_js_318ddfd4__ from "./FireflyRuntime.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentation_js_7e4b567c__ from "./honeycomb/registerHoneycombInstrumentation.js";
1
+ import { isFunction, registerLocalModules } from "@squide/core";
2
+ import { registerRemoteModules } from "@squide/module-federation";
3
+ import { setMswAsReady } from "@squide/msw";
4
+ import { FireflyRuntime } from "./FireflyRuntime.js";
5
+ import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
6
6
 
7
7
  ;// CONCATENATED MODULE: external "@squide/core"
8
8
 
@@ -12,7 +12,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentatio
12
12
 
13
13
  ;// CONCATENATED MODULE: external "./FireflyRuntime.js"
14
14
 
15
- ;// CONCATENATED MODULE: external "./honeycomb/registerHoneycombInstrumentation.js"
15
+ ;// CONCATENATED MODULE: external "./honeycomb/initializeHoneycomb.js"
16
16
 
17
17
  ;// CONCATENATED MODULE: ./src/initializeFirefly.ts
18
18
 
@@ -34,19 +34,19 @@ function bootstrap(runtime, options = {}) {
34
34
  const { localModules = [], remotes = [], startMsw, onError, context } = options;
35
35
  runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);
36
36
  Promise.allSettled([
37
- (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.registerLocalModules)(localModules, runtime, {
37
+ registerLocalModules(localModules, runtime, {
38
38
  context
39
39
  }),
40
- (0,__WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__.registerRemoteModules)(remotes, runtime, {
40
+ registerRemoteModules(remotes, runtime, {
41
41
  context
42
42
  })
43
43
  ]).then((results)=>{
44
44
  if (runtime.isMswEnabled) {
45
- if (!(0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.isFunction)(startMsw)) {
45
+ if (!isFunction(startMsw)) {
46
46
  throw new Error("[squide] When MSW is enabled, the \"startMsw\" function must be provided.");
47
47
  }
48
48
  startMsw(runtime).then(()=>{
49
- (0,__WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__.setMswAsReady)();
49
+ setMswAsReady();
50
50
  }).catch((error)=>{
51
51
  runtime.logger.debug("[squide] An error occured while starting MSW.", error);
52
52
  });
@@ -59,23 +59,24 @@ function bootstrap(runtime, options = {}) {
59
59
  }
60
60
  let hasExecuted = false;
61
61
  function initializeFirefly(options = {}) {
62
- const { mode, useMsw, loggers, plugins } = options;
62
+ const { mode, useMsw, loggers, plugins, onError } = options;
63
63
  if (hasExecuted) {
64
64
  throw new Error("[squide] A squide application can only be initialized once. Did you call the \"initializeSquide\" function twice?");
65
65
  }
66
66
  hasExecuted = true;
67
- const runtime = new __WEBPACK_EXTERNAL_MODULE__FireflyRuntime_js_318ddfd4__.FireflyRuntime({
67
+ const runtime = new FireflyRuntime({
68
68
  mode,
69
69
  useMsw,
70
70
  loggers,
71
71
  plugins
72
72
  });
73
- if ((0,__WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentation_js_7e4b567c__.canRegisterHoneycombInstrumentation)()) {
74
- (0,__WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentation_js_7e4b567c__.registerHoneycombInstrumentation)(runtime);
75
- } else {
76
- runtime.logger.debug("[squide] Cannot register Honeycomb instrumentation because the host application is not using the \"@workleap/honeycomb\" package.");
77
- }
78
- bootstrap(runtime, options);
73
+ initializeHoneycomb(runtime).catch((error)=>{
74
+ if (onError) {
75
+ onError(error);
76
+ }
77
+ }).finally(()=>{
78
+ bootstrap(runtime, options);
79
+ });
79
80
  return runtime;
80
81
  }
81
82
  function __resetHasExecuteGuard() {
@@ -1 +1 @@
1
- {"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { canRegisterHoneycombInstrumentation, registerHoneycombInstrumentation } from \"./honeycomb/registerHoneycombInstrumentation.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n if (canRegisterHoneycombInstrumentation()) {\n registerHoneycombInstrumentation(runtime);\n } else {\n runtime.logger.debug(\"[squide] Cannot register Honeycomb instrumentation because the host application is not using the \\\"@workleap/honeycomb\\\" package.\");\n }\n\n bootstrap(runtime, options);\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","canRegisterHoneycombInstrumentation","registerHoneycombInstrumentation","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AACsC;AACsD;AAEjI,MAAMO,uCAAuC,mCAAmC;AAavF,SAASC,4BAA4BC,OAAwC,EAAEC,OAAsC;IACjH,IAAID,SAAS;QACT,IAAIA,QAAQ,MAAM,KAAK,aAAa;YAChCA,QAAQ,KAAK,CAAC,OAAO,CAACE,CAAAA;gBAClBD,QAAQC;YACZ;QACJ;IACJ;AACJ;AAEO,SAASC,UAAiGC,OAAiB,EAAEC,UAA+D,CAAC,CAAC;IACjM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,QAAQ,EACRP,OAAO,EACPQ,OAAO,EACV,GAAGJ;IAEJD,QAAQ,QAAQ,CAAC,QAAQ,CAACN;IAE1BY,QAAQ,UAAU,CAAC;QACflB,0EAAoBA,CAA4Bc,cAAcF,SAAS;YAAEK;QAAQ;QACjFhB,wFAAqBA,CAACc,SAASH,SAAS;YAAEK;QAAQ;KACrD,EAAE,IAAI,CAACT,CAAAA;QACJ,IAAII,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACb,gEAAUA,CAACiB,WAAW;gBACvB,MAAM,IAAIG,MAAM;YACpB;YAEAH,SAASJ,SACJ,IAAI,CAAC;gBACFV,kEAAaA;YACjB,GACC,KAAK,CAAC,CAACkB;gBACJR,QAAQ,MAAM,CAAC,KAAK,CAAC,iDAAiDQ;YAC1E;QACR;QAEA,IAAIX,SAAS;YACTF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;YACxCF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;QAC5C;IACJ;AACJ;AAEA,IAAIY,cAAc;AAEX,SAASC,kBAAuDT,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFU,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACV,GAAGb;IAEJ,IAAIQ,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,MAAMT,UAAU,IAAIT,sEAAcA,CAAC;QAC/BoB;QACAC;QACAC;QACAC;IACJ;IAEA,IAAItB,2HAAmCA,IAAI;QACvCC,wHAAgCA,CAACO;IACrC,OAAO;QACHA,QAAQ,MAAM,CAAC,KAAK,CAAC;IACzB;IAEAD,UAAUC,SAASC;IAEnB,OAAOD;AACX;AAEO,SAASe;IACZN,cAAc;AAClB"}
1
+ {"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(runtime, options);\n });\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AACsC;AACT;AAElE,MAAMM,uCAAuC,mCAAmC;AAavF,SAASC,4BAA4BC,OAAwC,EAAEC,OAAsC;IACjH,IAAID,SAAS;QACT,IAAIA,QAAQ,MAAM,KAAK,aAAa;YAChCA,QAAQ,KAAK,CAAC,OAAO,CAACE,CAAAA;gBAClBD,QAAQC;YACZ;QACJ;IACJ;AACJ;AAEO,SAASC,UAAiGC,OAAiB,EAAEC,UAA+D,CAAC,CAAC;IACjM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,QAAQ,EACRP,OAAO,EACPQ,OAAO,EACV,GAAGJ;IAEJD,QAAQ,QAAQ,CAAC,QAAQ,CAACN;IAE1BY,QAAQ,UAAU,CAAC;QACfjB,oBAAoBA,CAA4Ba,cAAcF,SAAS;YAAEK;QAAQ;QACjFf,qBAAqBA,CAACa,SAASH,SAAS;YAAEK;QAAQ;KACrD,EAAE,IAAI,CAACT,CAAAA;QACJ,IAAII,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACZ,UAAUA,CAACgB,WAAW;gBACvB,MAAM,IAAIG,MAAM;YACpB;YAEAH,SAASJ,SACJ,IAAI,CAAC;gBACFT,aAAaA;YACjB,GACC,KAAK,CAAC,CAACiB;gBACJR,QAAQ,MAAM,CAAC,KAAK,CAAC,iDAAiDQ;YAC1E;QACR;QAEA,IAAIX,SAAS;YACTF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;YACxCF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;QAC5C;IACJ;AACJ;AAEA,IAAIY,cAAc;AAEX,SAASC,kBAAuDT,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFU,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPjB,OAAO,EACV,GAAGI;IAEJ,IAAIQ,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,MAAMT,UAAU,IAAIR,cAAcA,CAAC;QAC/BmB;QACAC;QACAC;QACAC;IACJ;IAEArB,mBAAmBA,CAACO,SACf,KAAK,CAAC,CAACQ;QACJ,IAAIX,SAAS;YACTA,QAAQW;QACZ;IACJ,GACC,OAAO,CAAC;QACLT,UAAUC,SAASC;IACvB;IAEJ,OAAOD;AACX;AAEO,SAASe;IACZN,cAAc;AAClB"}
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
1
+ import { useRuntime } from "@squide/core";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "@squide/core"
4
4
 
5
5
  ;// CONCATENATED MODULE: ./src/useAppRouterStore.ts
6
6
 
7
7
  function useAppRouterStore() {
8
- const runtime = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useRuntime)();
8
+ const runtime = useRuntime();
9
9
  return runtime.appRouterStore;
10
10
  }
11
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"useAppRouterStore.js","sources":["webpack://@squide/firefly/./src/useAppRouterStore.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport function useAppRouterStore() {\n const runtime = useRuntime() as FireflyRuntime;\n\n return runtime.appRouterStore;\n}\n"],"names":["useRuntime","useAppRouterStore","runtime"],"mappings":";;;;;AAA0C;AAGnC,SAASC;IACZ,MAAMC,UAAUF,gEAAUA;IAE1B,OAAOE,QAAQ,cAAc;AACjC"}
1
+ {"version":3,"file":"useAppRouterStore.js","sources":["webpack://@squide/firefly/./src/useAppRouterStore.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport function useAppRouterStore() {\n const runtime = useRuntime() as FireflyRuntime;\n\n return runtime.appRouterStore;\n}\n"],"names":["useRuntime","useAppRouterStore","runtime"],"mappings":";;;;;AAA0C;AAGnC,SAASC;IACZ,MAAMC,UAAUF,UAAUA;IAE1B,OAAOE,QAAQ,cAAc;AACjC"}
@@ -1,4 +1,4 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
4
 
@@ -12,7 +12,7 @@ function canFetchProtectedData(waitForMsw, areModulesRegistered, areModulesReady
12
12
  (areModulesRegistered || areModulesReady) && activeRouteVisibility === "protected" && (!waitForMsw || isMswReady));
13
13
  }
14
14
  function useCanFetchProtectedData() {
15
- const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isProtectedDataReady, activeRouteVisibility } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
15
+ const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isProtectedDataReady, activeRouteVisibility } = useAppRouterState();
16
16
  // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.
17
17
  return isProtectedDataReady || canFetchProtectedData(waitForMsw, areModulesRegistered, areModulesReady, activeRouteVisibility, isMswReady);
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useCanFetchProtectedData.js","sources":["webpack://@squide/firefly/./src/useCanFetchProtectedData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { ActiveRouteVisiblity } from \"./AppRouterReducer.ts\";\n\n// This function is exported for external integration, like the integration\n// with the Platform Widgets. Do not remove.\nexport function canFetchProtectedData(\n waitForMsw: boolean,\n areModulesRegistered: boolean,\n areModulesReady: boolean,\n activeRouteVisibility: ActiveRouteVisiblity,\n isMswReady: boolean\n) {\n return (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Only fetch the protected data for protected routes, aka do not fetch the protected data for public routes.\n && activeRouteVisibility === \"protected\"\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n );\n}\n\nexport function useCanFetchProtectedData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isProtectedDataReady,\n activeRouteVisibility\n } = useAppRouterState();\n\n // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.\n return isProtectedDataReady || canFetchProtectedData(\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n activeRouteVisibility,\n isMswReady\n );\n}\n"],"names":["useAppRouterState","canFetchProtectedData","waitForMsw","areModulesRegistered","areModulesReady","activeRouteVisibility","isMswReady","useCanFetchProtectedData","isProtectedDataReady"],"mappings":";;;;;AAA0D;AAG1D,2EAA2E;AAC3E,4CAA4C;AACrC,SAASC,sBACZC,UAAmB,EACnBC,oBAA6B,EAC7BC,eAAwB,EACxBC,qBAA2C,EAC3CC,UAAmB;IAEnB,OACI,oIAAoI;IACpI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEpCC,0BAA0B,eAEzB,EAACH,cAAcI,UAAS;AAEpC;AAEO,SAASC;IACZ,MAAM,EACFL,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfE,UAAU,EACVE,oBAAoB,EACpBH,qBAAqB,EACxB,GAAGL,+EAAiBA;IAErB,2IAA2I;IAC3I,OAAOQ,wBAAwBP,sBAC3BC,YACAC,sBACAC,iBACAC,uBACAC;AAER"}
1
+ {"version":3,"file":"useCanFetchProtectedData.js","sources":["webpack://@squide/firefly/./src/useCanFetchProtectedData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { ActiveRouteVisiblity } from \"./AppRouterReducer.ts\";\n\n// This function is exported for external integration, like the integration\n// with the Platform Widgets. Do not remove.\nexport function canFetchProtectedData(\n waitForMsw: boolean,\n areModulesRegistered: boolean,\n areModulesReady: boolean,\n activeRouteVisibility: ActiveRouteVisiblity,\n isMswReady: boolean\n) {\n return (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Only fetch the protected data for protected routes, aka do not fetch the protected data for public routes.\n && activeRouteVisibility === \"protected\"\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n );\n}\n\nexport function useCanFetchProtectedData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isProtectedDataReady,\n activeRouteVisibility\n } = useAppRouterState();\n\n // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.\n return isProtectedDataReady || canFetchProtectedData(\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n activeRouteVisibility,\n isMswReady\n );\n}\n"],"names":["useAppRouterState","canFetchProtectedData","waitForMsw","areModulesRegistered","areModulesReady","activeRouteVisibility","isMswReady","useCanFetchProtectedData","isProtectedDataReady"],"mappings":";;;;;AAA0D;AAG1D,2EAA2E;AAC3E,4CAA4C;AACrC,SAASC,sBACZC,UAAmB,EACnBC,oBAA6B,EAC7BC,eAAwB,EACxBC,qBAA2C,EAC3CC,UAAmB;IAEnB,OACI,oIAAoI;IACpI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEpCC,0BAA0B,eAEzB,EAACH,cAAcI,UAAS;AAEpC;AAEO,SAASC;IACZ,MAAM,EACFL,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfE,UAAU,EACVE,oBAAoB,EACpBH,qBAAqB,EACxB,GAAGL,iBAAiBA;IAErB,2IAA2I;IAC3I,OAAOQ,wBAAwBP,sBAC3BC,YACAC,sBACAC,iBACAC,uBACAC;AAER"}
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
4
 
5
5
  ;// CONCATENATED MODULE: ./src/useCanFetchPublicData.ts
6
6
 
7
7
  function useCanFetchPublicData() {
8
- const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isPublicDataReady } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
8
+ const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isPublicDataReady } = useAppRouterState();
9
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
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
11
  // depends on the protected data.
@@ -1 +1 @@
1
- {"version":3,"file":"useCanFetchPublicData.js","sources":["webpack://@squide/firefly/./src/useCanFetchPublicData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanFetchPublicData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isPublicDataReady\n } = useAppRouterState();\n\n return (\n // Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.\n isPublicDataReady\n || (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n )\n );\n}\n"],"names":["useAppRouterState","useCanFetchPublicData","waitForMsw","areModulesRegistered","areModulesReady","isMswReady","isPublicDataReady"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACpB,GAAGN,+EAAiBA;IAErB,OACI,wIAAwI;IACxIM,qBAEI,qIAAqI;IACrI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEnC,EAACF,cAAcG,UAAS;AAGxC"}
1
+ {"version":3,"file":"useCanFetchPublicData.js","sources":["webpack://@squide/firefly/./src/useCanFetchPublicData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanFetchPublicData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isPublicDataReady\n } = useAppRouterState();\n\n return (\n // Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.\n isPublicDataReady\n || (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n )\n );\n}\n"],"names":["useAppRouterState","useCanFetchPublicData","waitForMsw","areModulesRegistered","areModulesReady","isMswReady","isPublicDataReady"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACpB,GAAGN,iBAAiBA;IAErB,OACI,wIAAwI;IACxIM,qBAEI,qIAAqI;IACrI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEnC,EAACF,cAAcG,UAAS;AAGxC"}
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
4
 
5
5
  ;// CONCATENATED MODULE: ./src/useCanRegisterDeferredRegistrations.ts
6
6
 
7
7
  function useCanRegisterDeferredRegistrations() {
8
- const { waitForPublicData, waitForProtectedData, areModulesReady, areModulesRegistered, isPublicDataReady, isProtectedDataReady, activeRouteVisibility, isUnauthorized } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
8
+ const { waitForPublicData, waitForProtectedData, areModulesReady, areModulesRegistered, isPublicDataReady, isProtectedDataReady, activeRouteVisibility, isUnauthorized } = useAppRouterState();
9
9
  return !isUnauthorized && areModulesRegistered && !areModulesReady && (!waitForPublicData || isPublicDataReady) && (!waitForProtectedData || activeRouteVisibility === "public" || isProtectedDataReady);
10
10
  }
11
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"useCanRegisterDeferredRegistrations.js","sources":["webpack://@squide/firefly/./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,+EAAiBA;IAErB,OACI,CAACS,kBAEEJ,wBAAwB,CAACD,mBAGxB,EAACF,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;AAE9F"}
1
+ {"version":3,"file":"useCanRegisterDeferredRegistrations.js","sources":["webpack://@squide/firefly/./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,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
4
 
5
5
  ;// CONCATENATED MODULE: ./src/useCanUpdateDeferredRegistrations.ts
6
6
 
7
7
  function useCanUpdateDeferredRegistrations() {
8
- const { areModulesReady, publicDataUpdatedAt, protectedDataUpdatedAt, deferredRegistrationsUpdatedAt } = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
8
+ const { areModulesReady, publicDataUpdatedAt, protectedDataUpdatedAt, deferredRegistrationsUpdatedAt } = useAppRouterState();
9
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
10
  // registered, the modules will be marked as ready).
11
11
  areModulesReady && deferredRegistrationsUpdatedAt && (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt || protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt));
@@ -1 +1 @@
1
- {"version":3,"file":"useCanUpdateDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useCanUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanUpdateDeferredRegistrations() {\n const {\n areModulesReady,\n publicDataUpdatedAt,\n protectedDataUpdatedAt,\n deferredRegistrationsUpdatedAt\n } = useAppRouterState();\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 )\n );\n}\n"],"names":["useAppRouterState","useCanUpdateDeferredRegistrations","areModulesReady","publicDataUpdatedAt","protectedDataUpdatedAt","deferredRegistrationsUpdatedAt"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,eAAe,EACfC,mBAAmB,EACnBC,sBAAsB,EACtBC,8BAA8B,EACjC,GAAGL,+EAAiBA;IAErB,OACI,yIAAyI;IACzI,oDAAoD;IACpDE,mBAEGG,kCAGC,CAACF,uBAAuBA,sBAAsBE,kCAC7CD,0BAA0BA,yBAAyBC,8BAA8B;AAG9F"}
1
+ {"version":3,"file":"useCanUpdateDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useCanUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanUpdateDeferredRegistrations() {\n const {\n areModulesReady,\n publicDataUpdatedAt,\n protectedDataUpdatedAt,\n deferredRegistrationsUpdatedAt\n } = useAppRouterState();\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 )\n );\n}\n"],"names":["useAppRouterState","useCanUpdateDeferredRegistrations","areModulesReady","publicDataUpdatedAt","protectedDataUpdatedAt","deferredRegistrationsUpdatedAt"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,eAAe,EACfC,mBAAmB,EACnBC,sBAAsB,EACtBC,8BAA8B,EACjC,GAAGL,iBAAiBA;IAErB,OACI,yIAAyI;IACzI,oDAAoD;IACpDE,mBAEGG,kCAGC,CAACF,uBAAuBA,sBAAsBE,kCAC7CD,0BAA0BA,yBAAyBC,8BAA8B;AAG9F"}
@@ -1,9 +1,9 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core";
2
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
- import * as __WEBPACK_EXTERNAL_MODULE__useCanRegisterDeferredRegistrations_js_257f17d4__ from "./useCanRegisterDeferredRegistrations.js";
4
- import * as __WEBPACK_EXTERNAL_MODULE__useCanUpdateDeferredRegistrations_js_12932b2c__ from "./useCanUpdateDeferredRegistrations.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__useRegisterDeferredRegistrations_js_eed558b9__ from "./useRegisterDeferredRegistrations.js";
6
- import * as __WEBPACK_EXTERNAL_MODULE__useUpdateDeferredRegistrations_js_80de5337__ from "./useUpdateDeferredRegistrations.js";
1
+ import { useRuntime } from "@squide/core";
2
+ import { useEffect } from "react";
3
+ import { useCanRegisterDeferredRegistrations } from "./useCanRegisterDeferredRegistrations.js";
4
+ import { useCanUpdateDeferredRegistrations } from "./useCanUpdateDeferredRegistrations.js";
5
+ import { useRegisterDeferredRegistrations } from "./useRegisterDeferredRegistrations.js";
6
+ import { useUpdateDeferredRegistrations } from "./useUpdateDeferredRegistrations.js";
7
7
 
8
8
  ;// CONCATENATED MODULE: external "@squide/core"
9
9
 
@@ -28,12 +28,12 @@ function hasError({ localModuleErrors, remoteModuleErrors }) {
28
28
  return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;
29
29
  }
30
30
  function useDeferredRegistrations(data, { onError } = {}) {
31
- const runtime = (0,__WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__.useRuntime)();
32
- const canRegisterDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useCanRegisterDeferredRegistrations_js_257f17d4__.useCanRegisterDeferredRegistrations)();
33
- const canUpdateDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useCanUpdateDeferredRegistrations_js_12932b2c__.useCanUpdateDeferredRegistrations)();
34
- const registerDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useRegisterDeferredRegistrations_js_eed558b9__.useRegisterDeferredRegistrations)();
35
- const updateDeferredRegistrations = (0,__WEBPACK_EXTERNAL_MODULE__useUpdateDeferredRegistrations_js_80de5337__.useUpdateDeferredRegistrations)();
36
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
31
+ const runtime = useRuntime();
32
+ const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();
33
+ const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();
34
+ const registerDeferredRegistrations = useRegisterDeferredRegistrations();
35
+ const updateDeferredRegistrations = useUpdateDeferredRegistrations();
36
+ useEffect(()=>{
37
37
  if (canRegisterDeferredRegistrations) {
38
38
  const register = async ()=>{
39
39
  const errors = await registerDeferredRegistrations(data, runtime);
@@ -50,7 +50,7 @@ function useDeferredRegistrations(data, { onError } = {}) {
50
50
  onError,
51
51
  runtime
52
52
  ]);
53
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
53
+ useEffect(()=>{
54
54
  if (canUpdateDeferredRegistrations) {
55
55
  const update = async ()=>{
56
56
  const errors = await updateDeferredRegistrations(data, runtime);
@@ -1 +1 @@
1
- {"version":3,"file":"useDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect } from \"react\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport interface DeferredRegistrationsErrorsObject {\n localModuleErrors: ModuleRegistrationError[];\n remoteModuleErrors: ModuleRegistrationError[];\n}\n\nexport type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nfunction hasError({ localModuleErrors, remoteModuleErrors }: DeferredRegistrationsErrorsObject) {\n return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;\n}\n\nexport function useDeferredRegistrations(data: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime();\n\n const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();\n const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();\n\n const registerDeferredRegistrations = useRegisterDeferredRegistrations();\n const updateDeferredRegistrations = useUpdateDeferredRegistrations();\n\n useEffect(() => {\n if (canRegisterDeferredRegistrations) {\n const register = async () => {\n const errors = await registerDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError, runtime]);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n const update = async () => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [canUpdateDeferredRegistrations, updateDeferredRegistrations, data, onError, runtime]);\n}\n"],"names":["useRuntime","useEffect","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","hasError","localModuleErrors","remoteModuleErrors","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AACtC;AAC6D;AACJ;AACF;AACJ;AAarF,SAASM,SAAS,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAqC;IAC1F,OAAOD,kBAAkB,MAAM,GAAG,KAAKC,mBAAmB,MAAM,GAAG;AACvE;AAEO,SAASC,yBAAyBC,IAAa,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACrG,MAAMC,UAAUZ,gEAAUA;IAE1B,MAAMa,mCAAmCX,oHAAmCA;IAC5E,MAAMY,iCAAiCX,gHAAiCA;IAExE,MAAMY,gCAAgCX,8GAAgCA;IACtE,MAAMY,8BAA8BX,0GAA8BA;IAElEJ,+CAASA,CAAC;QACN,IAAIY,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL,MAAME;gBAEzD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;QAASC;KAAQ;IAE5FX,+CAASA,CAAC;QACN,IAAIa,gCAAgC;YAChC,MAAMK,SAAS;gBACX,MAAMD,SAAS,MAAMF,4BAA4BN,MAAME;gBAEvD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAC;QACJ;IACJ,GAAG;QAACL;QAAgCE;QAA6BN;QAAMC;QAASC;KAAQ;AAC5F"}
1
+ {"version":3,"file":"useDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect } from \"react\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport interface DeferredRegistrationsErrorsObject {\n localModuleErrors: ModuleRegistrationError[];\n remoteModuleErrors: ModuleRegistrationError[];\n}\n\nexport type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nfunction hasError({ localModuleErrors, remoteModuleErrors }: DeferredRegistrationsErrorsObject) {\n return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;\n}\n\nexport function useDeferredRegistrations(data: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime();\n\n const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();\n const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();\n\n const registerDeferredRegistrations = useRegisterDeferredRegistrations();\n const updateDeferredRegistrations = useUpdateDeferredRegistrations();\n\n useEffect(() => {\n if (canRegisterDeferredRegistrations) {\n const register = async () => {\n const errors = await registerDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError, runtime]);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n const update = async () => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [canUpdateDeferredRegistrations, updateDeferredRegistrations, data, onError, runtime]);\n}\n"],"names":["useRuntime","useEffect","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","hasError","localModuleErrors","remoteModuleErrors","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AACtC;AAC6D;AACJ;AACF;AACJ;AAarF,SAASM,SAAS,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAqC;IAC1F,OAAOD,kBAAkB,MAAM,GAAG,KAAKC,mBAAmB,MAAM,GAAG;AACvE;AAEO,SAASC,yBAAyBC,IAAa,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACrG,MAAMC,UAAUZ,UAAUA;IAE1B,MAAMa,mCAAmCX,mCAAmCA;IAC5E,MAAMY,iCAAiCX,iCAAiCA;IAExE,MAAMY,gCAAgCX,gCAAgCA;IACtE,MAAMY,8BAA8BX,8BAA8BA;IAElEJ,SAASA,CAAC;QACN,IAAIY,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL,MAAME;gBAEzD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;QAASC;KAAQ;IAE5FX,SAASA,CAAC;QACN,IAAIa,gCAAgC;YAChC,MAAMK,SAAS;gBACX,MAAMD,SAAS,MAAMF,4BAA4BN,MAAME;gBAEvD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAC;QACJ;IACJ,GAAG;QAACL;QAAgCE;QAA6BN;QAAMC;QAASC;KAAQ;AAC5F"}
@@ -1,4 +1,4 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
1
+ import { useCallback, useRef } from "react";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "react"
4
4
 
@@ -7,8 +7,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
7
7
  // Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events
8
8
  // and it messed with the events dispatch order.
9
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)(()=>{
10
+ const triggered = useRef(false);
11
+ const onceFct = useCallback(()=>{
12
12
  if (!triggered.current) {
13
13
  const result = fct();
14
14
  if (result) {
@@ -1 +1 @@
1
- {"version":3,"file":"useExecuteOnce.js","sources":["webpack://@squide/firefly/./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 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,4CAAMA,CAAC;IAEzB,MAAMK,UAAUN,iDAAWA,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;QACRE;IACJ;IAEA,OAAOA;AACX"}
1
+ {"version":3,"file":"useExecuteOnce.js","sources":["webpack://@squide/firefly/./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 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;QACRE;IACJ;IAEA,OAAOA;AACX"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__ from "@squide/react-router";
2
- import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router";
1
+ import { useIsRouteProtected, useRouteMatch } from "@squide/react-router";
2
+ import { useLocation } from "react-router";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "@squide/react-router"
5
5
 
@@ -10,12 +10,12 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router
10
10
 
11
11
  function useIsActiveRouteProtected(areModulesReady) {
12
12
  // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.
13
- const location = (0,__WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__.useLocation)();
13
+ const location = useLocation();
14
14
  // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.
15
- const activeRoute = (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useRouteMatch)(location, {
15
+ const activeRoute = useRouteMatch(location, {
16
16
  throwWhenThereIsNoMatch: areModulesReady
17
17
  });
18
- return (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useIsRouteProtected)(activeRoute);
18
+ return useIsRouteProtected(activeRoute);
19
19
  }
20
20
 
21
21
  export { useIsActiveRouteProtected };
@@ -1 +1 @@
1
- {"version":3,"file":"useIsActiveRouteProtected.js","sources":["webpack://@squide/firefly/./src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean) {\n // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.\n const location = useLocation();\n\n // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.\n const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC/B;AAEpC,SAASG,0BAA0BC,eAAwB;IAC9D,qJAAqJ;IACrJ,MAAMC,WAAWH,iEAAWA;IAE5B,wJAAwJ;IACxJ,MAAMI,cAAcL,2EAAaA,CAACI,UAAU;QAAE,yBAAyBD;IAAgB;IAEvF,OAAOJ,iFAAmBA,CAACM;AAC/B"}
1
+ {"version":3,"file":"useIsActiveRouteProtected.js","sources":["webpack://@squide/firefly/./src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean) {\n // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.\n const location = useLocation();\n\n // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.\n const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC/B;AAEpC,SAASG,0BAA0BC,eAAwB;IAC9D,qJAAqJ;IACrJ,MAAMC,WAAWH,WAAWA;IAE5B,wJAAwJ;IACxJ,MAAMI,cAAcL,aAAaA,CAACI,UAAU;QAAE,yBAAyBD;IAAgB;IAEvF,OAAOJ,mBAAmBA,CAACM;AAC/B"}
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useAppRouterState } from "./AppRouterContext.js";
2
2
 
3
3
  ;// CONCATENATED MODULE: external "./AppRouterContext.js"
4
4
 
5
5
  ;// CONCATENATED MODULE: ./src/useIsBootstrapping.ts
6
6
 
7
7
  function useIsBootstrapping() {
8
- const state = (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
8
+ const state = useAppRouterState();
9
9
  return isBootstrapping(state);
10
10
  }
11
11
  function isBootstrapping(state) {
@@ -1 +1 @@
1
- {"version":3,"file":"useIsBootstrapping.js","sources":["webpack://@squide/firefly/./src/useIsBootstrapping.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport function useIsBootstrapping() {\n const state = useAppRouterState();\n\n return isBootstrapping(state);\n}\n\nexport function isBootstrapping(state: AppRouterState) {\n const {\n waitForMsw,\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n isMswReady,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = state;\n\n const isAppReady = (\n !isUnauthorized\n // Wait until the modules has been registered and the deferred registrations has been registered if any.\n && areModulesReady\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the initial data is ready.\n && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n\n // When an API request returns a 401, the bootstrapping should be bypassed to render the login page.\n const flush = (\n // Only applicable when there's a unauthorized request while fetching the initial data.\n isUnauthorized\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the public data is ready.\n && (!waitForMsw || isMswReady)\n // If the application is loading public data, we want to wait for this data to be ready to prevent a re-render.\n && (!waitForPublicData || isPublicDataReady)\n );\n\n return !isAppReady && !flush;\n}\n"],"names":["useAppRouterState","useIsBootstrapping","state","isBootstrapping","waitForMsw","waitForPublicData","waitForProtectedData","areModulesReady","isMswReady","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized","isAppReady","flush"],"mappings":";;;;;AAA0D;AAGnD,SAASC;IACZ,MAAMC,QAAQF,+EAAiBA;IAE/B,OAAOG,gBAAgBD;AAC3B;AAEO,SAASC,gBAAgBD,KAAqB;IACjD,MAAM,EACFE,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGV;IAEJ,MAAMW,aACF,CAACD,kBAEEL,mBAEC,EAACH,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;IAG1F,oGAAoG;IACpG,MAAMI,QACF,uFAAuF;IACvFF,kBAEI,EAACR,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB;IAG9C,OAAO,CAACI,cAAc,CAACC;AAC3B"}
1
+ {"version":3,"file":"useIsBootstrapping.js","sources":["webpack://@squide/firefly/./src/useIsBootstrapping.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport function useIsBootstrapping() {\n const state = useAppRouterState();\n\n return isBootstrapping(state);\n}\n\nexport function isBootstrapping(state: AppRouterState) {\n const {\n waitForMsw,\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n isMswReady,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = state;\n\n const isAppReady = (\n !isUnauthorized\n // Wait until the modules has been registered and the deferred registrations has been registered if any.\n && areModulesReady\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the initial data is ready.\n && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n\n // When an API request returns a 401, the bootstrapping should be bypassed to render the login page.\n const flush = (\n // Only applicable when there's a unauthorized request while fetching the initial data.\n isUnauthorized\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the public data is ready.\n && (!waitForMsw || isMswReady)\n // If the application is loading public data, we want to wait for this data to be ready to prevent a re-render.\n && (!waitForPublicData || isPublicDataReady)\n );\n\n return !isAppReady && !flush;\n}\n"],"names":["useAppRouterState","useIsBootstrapping","state","isBootstrapping","waitForMsw","waitForPublicData","waitForProtectedData","areModulesReady","isMswReady","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized","isAppReady","flush"],"mappings":";;;;;AAA0D;AAGnD,SAASC;IACZ,MAAMC,QAAQF,iBAAiBA;IAE/B,OAAOG,gBAAgBD;AAC3B;AAEO,SAASC,gBAAgBD,KAAqB;IACjD,MAAM,EACFE,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGV;IAEJ,MAAMW,aACF,CAACD,kBAEEL,mBAEC,EAACH,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;IAG1F,oGAAoG;IACpG,MAAMI,QACF,uFAAuF;IACvFF,kBAEI,EAACR,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB;IAG9C,OAAO,CAACI,cAAc,CAACC;AAC3B"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__ from "@squide/react-router";
2
- import * as __WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__ from "./AppRouterContext.js";
1
+ import { useRuntimeNavigationItems } from "@squide/react-router";
2
+ import { useAppRouterState } from "./AppRouterContext.js";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "@squide/react-router"
5
5
 
@@ -17,8 +17,8 @@ function useNavigationItems(options) {
17
17
  // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.
18
18
  // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the "runtime" changes, or
19
19
  // even introducing new module states.
20
- (0,__WEBPACK_EXTERNAL_MODULE__AppRouterContext_js_3c4a3c33__.useAppRouterState)();
21
- return (0,__WEBPACK_EXTERNAL_MODULE__squide_react_router_299a4bef__.useRuntimeNavigationItems)(options);
20
+ useAppRouterState();
21
+ return useRuntimeNavigationItems(options);
22
22
  }
23
23
 
24
24
  export { useNavigationItems };
@@ -1 +1 @@
1
- {"version":3,"file":"useNavigationItems.js","sources":["webpack://@squide/firefly/./src/useNavigationItems.ts"],"sourcesContent":["import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from \"@squide/react-router\";\nimport { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport type UseNavigationItemsOptions = UseRuntimeNavigationItemsOptions;\n\nexport function useNavigationItems(options?: UseNavigationItemsOptions) {\n // This is not the most sophisticated strategy but it seems to be good enough for now.\n // The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could\n // be updated when the global data is updated. If the deferred registrations are updated, it means that the registered\n // navigation items might have been updated and a re-render must happens to display the new navigation items.\n // Since the \"deferredRegistrationsUpdatedAt\" state value of the AppRouterReducer is updated everytime the deferred registrations\n // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.\n // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the \"runtime\" changes, or\n // even introducing new module states.\n useAppRouterState();\n\n return useRuntimeNavigationItems(options);\n}\n"],"names":["useRuntimeNavigationItems","useAppRouterState","useNavigationItems","options"],"mappings":";;;;;;;;AAAwG;AAC9C;AAInD,SAASE,mBAAmBC,OAAmC;IAClE,sFAAsF;IACtF,uHAAuH;IACvH,sHAAsH;IACtH,6GAA6G;IAC7G,iIAAiI;IACjI,qHAAqH;IACrH,yIAAyI;IACzI,sCAAsC;IACtCF,+EAAiBA;IAEjB,OAAOD,uFAAyBA,CAACG;AACrC"}
1
+ {"version":3,"file":"useNavigationItems.js","sources":["webpack://@squide/firefly/./src/useNavigationItems.ts"],"sourcesContent":["import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from \"@squide/react-router\";\nimport { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport type UseNavigationItemsOptions = UseRuntimeNavigationItemsOptions;\n\nexport function useNavigationItems(options?: UseNavigationItemsOptions) {\n // This is not the most sophisticated strategy but it seems to be good enough for now.\n // The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could\n // be updated when the global data is updated. If the deferred registrations are updated, it means that the registered\n // navigation items might have been updated and a re-render must happens to display the new navigation items.\n // Since the \"deferredRegistrationsUpdatedAt\" state value of the AppRouterReducer is updated everytime the deferred registrations\n // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.\n // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the \"runtime\" changes, or\n // even introducing new module states.\n useAppRouterState();\n\n return useRuntimeNavigationItems(options);\n}\n"],"names":["useRuntimeNavigationItems","useAppRouterState","useNavigationItems","options"],"mappings":";;;;;;;;AAAwG;AAC9C;AAInD,SAASE,mBAAmBC,OAAmC;IAClE,sFAAsF;IACtF,uHAAuH;IACvH,sHAAsH;IACtH,6GAA6G;IAC7G,iIAAiI;IACjI,qHAAqH;IACrH,yIAAyI;IACzI,sCAAsC;IACtCF,iBAAiBA;IAEjB,OAAOD,yBAAyBA,CAACG;AACrC"}
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
- import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__ from "./useCanFetchProtectedData.js";
1
+ import { useEffect } from "react";
2
+ import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
3
3
 
4
4
  ;// CONCATENATED MODULE: external "react"
5
5
 
@@ -9,8 +9,8 @@ import * as __WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__ fr
9
9
 
10
10
 
11
11
  function useProtectedDataHandler(handler) {
12
- const canFetchProtectedData = (0,__WEBPACK_EXTERNAL_MODULE__useCanFetchProtectedData_js_52158d16__.useCanFetchProtectedData)();
13
- (0,__WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
12
+ const canFetchProtectedData = useCanFetchProtectedData();
13
+ useEffect(()=>{
14
14
  if (canFetchProtectedData) {
15
15
  handler();
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useProtectedDataHandler.js","sources":["webpack://@squide/firefly/./src/useProtectedDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\n\nexport function useProtectedDataHandler(handler: () => void) {\n const canFetchProtectedData = useCanFetchProtectedData();\n\n useEffect(() => {\n if (canFetchProtectedData) {\n handler();\n }\n }, [canFetchProtectedData, handler]);\n}\n"],"names":["useEffect","useCanFetchProtectedData","useProtectedDataHandler","handler","canFetchProtectedData"],"mappings":";;;;;;;;AAAkC;AACuC;AAElE,SAASE,wBAAwBC,OAAmB;IACvD,MAAMC,wBAAwBH,8FAAwBA;IAEtDD,+CAASA,CAAC;QACN,IAAII,uBAAuB;YACvBD;QACJ;IACJ,GAAG;QAACC;QAAuBD;KAAQ;AACvC"}
1
+ {"version":3,"file":"useProtectedDataHandler.js","sources":["webpack://@squide/firefly/./src/useProtectedDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\n\nexport function useProtectedDataHandler(handler: () => void) {\n const canFetchProtectedData = useCanFetchProtectedData();\n\n useEffect(() => {\n if (canFetchProtectedData) {\n handler();\n }\n }, [canFetchProtectedData, handler]);\n}\n"],"names":["useEffect","useCanFetchProtectedData","useProtectedDataHandler","handler","canFetchProtectedData"],"mappings":";;;;;;;;AAAkC;AACuC;AAElE,SAASE,wBAAwBC,OAAmB;IACvD,MAAMC,wBAAwBH,wBAAwBA;IAEtDD,SAASA,CAAC;QACN,IAAII,uBAAuB;YACvBD;QACJ;IACJ,GAAG;QAACC;QAAuBD;KAAQ;AACvC"}