@hortiview/modulebase 1.1.2-alpha.a0b1047e.1 → 1.1.2-alpha.a87fc893.1

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 (92) hide show
  1. package/{dist/ModuleCore-DRMqZO8r.js → ModuleCore-C4Z4zObE.js} +3030 -3110
  2. package/{dist/api-COabZnyn.js → api-CikhPcJj.js} +10 -10
  3. package/{dist/chunk-EVOBXE3Y-B43QN6RE.js → chunk-KS7C4IRE-CT7Z8Xx_.js} +3866 -3585
  4. package/components/ModuleBase.js +30 -0
  5. package/{dist/components → components}/ModuleCore.js +2 -3
  6. package/{dist/constants.js → constants.js} +8 -8
  7. package/{dist/hooks → hooks}/useCustom.js +9 -9
  8. package/{dist/hooks → hooks}/useCustomMutation.js +6 -6
  9. package/{dist/hooks → hooks}/useEntity.js +5 -5
  10. package/hooks/useOffline.js +57 -0
  11. package/{dist/hooks → hooks}/useOption.js +6 -6
  12. package/{dist/hooks → hooks}/useSignalRMessages.js +1 -1
  13. package/{dist/hooks → hooks}/useStores.js +1 -1
  14. package/{dist/isTypedArray-SkhznY1k.js → isTypedArray-T1_r8YHg.js} +33 -33
  15. package/{dist/lib → lib}/components/ModuleBase.d.ts +1 -1
  16. package/{dist/lib → lib}/components/ModuleCore.d.ts +1 -2
  17. package/{dist/lib → lib}/hooks/useCustom.d.ts +1 -1
  18. package/{dist/lib → lib}/hooks/useCustomMutation.d.ts +1 -1
  19. package/{dist/lib → lib}/hooks/useOffline.d.ts +5 -5
  20. package/lib/provider/SignalR/SignalRModuleContext.d.ts +4 -0
  21. package/lib/provider/SignalR/SignalRProvider.d.ts +9 -0
  22. package/lib/types/BaseProps.d.ts +98 -0
  23. package/lib/utils/IndexedDbService.d.ts +6 -0
  24. package/main.js +228 -0
  25. package/{dist/module-router.js → module-router.js} +813 -847
  26. package/{dist/omit-DYPaIq41.js → omit-CiJPWayj.js} +66 -66
  27. package/package.json +22 -56
  28. package/provider/SignalR/SignalRModuleContext.js +6205 -0
  29. package/provider/SignalR/SignalRProvider.js +35 -0
  30. package/{dist/stores → stores}/BasePropsStore.js +1 -0
  31. package/{dist/stores → stores}/EnvironmentStore.js +5 -5
  32. package/{dist/types → types}/Entities.js +5 -5
  33. package/{dist/useCustomMutation-9VUQ7NbQ.js → useCustomMutation-BX8lKAYe.js} +10 -10
  34. package/{dist/useQuery-DUDyh33-.js → useQuery-URJEw3ly.js} +128 -126
  35. package/utils/IndexedDbService.js +43 -0
  36. package/{dist/utils → utils}/api.js +1 -1
  37. package/{dist/utils → utils}/baseFetches.js +1 -1
  38. package/README.md +0 -9
  39. package/dist/components/ModuleBase.js +0 -21
  40. package/dist/hooks/useOffline.js +0 -57
  41. package/dist/lib/provider/SignalR/SignalRProvider.d.ts +0 -13
  42. package/dist/lib/types/BaseProps.d.ts +0 -48
  43. package/dist/lib/utils/IndexedDbService.d.ts +0 -33
  44. package/dist/main.js +0 -228
  45. package/dist/provider/SignalR/SignalRProvider.js +0 -5979
  46. package/dist/utils/IndexedDbService.js +0 -43
  47. package/{dist/IsRestoringProvider-SzKJZczp.js → IsRestoringProvider-SzKJZczp.js} +0 -0
  48. package/{dist/_commonjsHelpers-ByX85dGu.js → _commonjsHelpers-ByX85dGu.js} +0 -0
  49. package/{dist/assets → assets}/ModuleCore.css +0 -0
  50. package/{dist/enum → enum}/ActionStorage.js +0 -0
  51. package/{dist/hooks → hooks}/useBreadcrumbTranslation.js +0 -0
  52. package/{dist/lib → lib}/constants.d.ts +8 -8
  53. /package/{dist/lib → lib}/enum/ActionStorage.d.ts +0 -0
  54. /package/{dist/lib → lib}/hooks/useBreadcrumbTranslation.d.ts +0 -0
  55. /package/{dist/lib → lib}/hooks/useEntity.d.ts +0 -0
  56. /package/{dist/lib → lib}/hooks/useOption.d.ts +0 -0
  57. /package/{dist/lib → lib}/hooks/useSignalRMessages.d.ts +0 -0
  58. /package/{dist/lib → lib}/hooks/useStores.d.ts +0 -0
  59. /package/{dist/lib → lib}/main.d.ts +0 -0
  60. /package/{dist/lib → lib}/module-router.d.ts +0 -0
  61. /package/{dist/lib → lib}/provider/SignalR/signalR.d.ts +0 -0
  62. /package/{dist/lib → lib}/stores/BasePropsStore.d.ts +0 -0
  63. /package/{dist/lib → lib}/stores/EnvironmentStore.d.ts +0 -0
  64. /package/{dist/lib → lib}/types/ActionStorage.d.ts +0 -0
  65. /package/{dist/lib → lib}/types/AppInsights.d.ts +0 -0
  66. /package/{dist/lib → lib}/types/CommonOptions.d.ts +0 -0
  67. /package/{dist/lib → lib}/types/Entities.d.ts +0 -0
  68. /package/{dist/lib → lib}/types/Environment.d.ts +0 -0
  69. /package/{dist/lib → lib}/types/EnvironmentVariable.d.ts +0 -0
  70. /package/{dist/lib → lib}/types/ModuleApi.d.ts +0 -0
  71. /package/{dist/lib → lib}/types/Requests.d.ts +0 -0
  72. /package/{dist/lib → lib}/types/ServiceBus.d.ts +0 -0
  73. /package/{dist/lib → lib}/types/SystemMessage.d.ts +0 -0
  74. /package/{dist/lib → lib}/utils/api.d.ts +0 -0
  75. /package/{dist/lib → lib}/utils/baseFetches.d.ts +0 -0
  76. /package/{dist/lib → lib}/utils/fetches.d.ts +0 -0
  77. /package/{dist/lib → lib}/utils/helper.d.ts +0 -0
  78. /package/{dist/provider → provider}/SignalR/signalR.js +0 -0
  79. /package/{dist/react-c9FSfB30.js → react-c9FSfB30.js} +0 -0
  80. /package/{dist/types → types}/ActionStorage.js +0 -0
  81. /package/{dist/types → types}/AppInsights.js +0 -0
  82. /package/{dist/types → types}/BaseProps.js +0 -0
  83. /package/{dist/types → types}/CommonOptions.js +0 -0
  84. /package/{dist/types → types}/Environment.js +0 -0
  85. /package/{dist/types → types}/EnvironmentVariable.js +0 -0
  86. /package/{dist/types → types}/ModuleApi.js +0 -0
  87. /package/{dist/types → types}/Requests.js +0 -0
  88. /package/{dist/types → types}/ServiceBus.js +0 -0
  89. /package/{dist/types → types}/SystemMessage.js +0 -0
  90. /package/{dist/utils → utils}/fetches.js +0 -0
  91. /package/{dist/utils → utils}/helper.js +0 -0
  92. /package/{dist/vite-env.d.js → vite-env.d.js} +0 -0
@@ -0,0 +1,30 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useEffect as s } from "react";
3
+ import { c as u, R as c, O as l, u as m } from "../chunk-KS7C4IRE-CT7Z8Xx_.js";
4
+ import { SignalRProvider as d } from "../provider/SignalR/SignalRProvider.js";
5
+ import { useBasePropsStore as f } from "../stores/BasePropsStore.js";
6
+ import { M as p } from "../ModuleCore-C4Z4zObE.js";
7
+ const v = () => {
8
+ const e = f((o) => o.currentNavigationPath), r = m();
9
+ s(() => {
10
+ e && r(e, { replace: !0 });
11
+ }, [e, r]);
12
+ }, g = () => (v(), /* @__PURE__ */ t(l, {})), b = ({
13
+ env: e = void 0,
14
+ props: r,
15
+ queryClient: o,
16
+ routes: a,
17
+ useSignalR: i = !1
18
+ }) => {
19
+ const n = u([
20
+ {
21
+ children: a,
22
+ element: /* @__PURE__ */ t(g, {}),
23
+ path: r.basePath
24
+ }
25
+ ]);
26
+ return /* @__PURE__ */ t(p, { props: r, env: e, queryClient: o, children: /* @__PURE__ */ t(d, { enabled: i, children: /* @__PURE__ */ t(c, { router: n }) }) });
27
+ };
28
+ export {
29
+ b as ModuleBase
30
+ };
@@ -1,11 +1,10 @@
1
1
  import "react/jsx-runtime";
2
- import { M as l, a as u } from "../ModuleCore-DRMqZO8r.js";
2
+ import { M as a } from "../ModuleCore-C4Z4zObE.js";
3
3
  import "react";
4
4
  import "../stores/BasePropsStore.js";
5
5
  import "../stores/EnvironmentStore.js";
6
6
  import "../utils/helper.js";
7
7
  import "../utils/IndexedDbService.js";
8
8
  export {
9
- l as ModuleCore,
10
- u as ModuleQueryClient
9
+ a as ModuleCore
11
10
  };
@@ -7,25 +7,25 @@ const a = [
7
7
  "currentNavigationPath"
8
8
  ], e = {
9
9
  /**
10
- * The server timed out waiting for the request.
10
+ * The server is not ready to handle the request.
11
11
  */
12
- RequestTimeout: 408,
12
+ BadGateway: 502,
13
13
  /**
14
- * The user has sent too many requests in a given amount of time ("rate limiting").
14
+ * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
15
15
  */
16
- TooManyRequests: 429,
16
+ GatewayTimeout: 504,
17
17
  /**
18
- * The server is not ready to handle the request.
18
+ * The server timed out waiting for the request.
19
19
  */
20
- BadGateway: 502,
20
+ RequestTimeout: 408,
21
21
  /**
22
22
  * The server is not available.
23
23
  */
24
24
  ServiceUnavailable: 503,
25
25
  /**
26
- * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
26
+ * The user has sent too many requests in a given amount of time ("rate limiting").
27
27
  */
28
- GatewayTimeout: 504
28
+ TooManyRequests: 429
29
29
  };
30
30
  export {
31
31
  a as REQUIRED_PROPS,
@@ -1,19 +1,19 @@
1
- import { u as i } from "../useQuery-DUDyh33-.js";
1
+ import { u as i } from "../useQuery-URJEw3ly.js";
2
2
  import { fetchFromCustomApi as n } from "../utils/fetches.js";
3
3
  import { universalSelector as p } from "../utils/helper.js";
4
4
  const C = ({
5
- endpoint: o,
6
- queryKey: t,
7
- token: u,
5
+ enabled: o = !0,
6
+ endpoint: t,
7
+ noAuth: u = !1,
8
+ queryKey: m,
8
9
  selector: r,
9
- enabled: m = !0,
10
- noAuth: s = !1,
10
+ token: s,
11
11
  ...f
12
12
  }) => i({
13
- queryKey: t,
14
- queryFn: () => n(o, u, s),
13
+ enabled: o,
14
+ queryFn: () => n(t, s, u),
15
+ queryKey: m,
15
16
  select: (e) => r ? r(e) : p(e),
16
- enabled: m,
17
17
  ...f
18
18
  });
19
19
  export {
@@ -1,14 +1,14 @@
1
- import { u as x } from "../useCustomMutation-9VUQ7NbQ.js";
1
+ import { u as x } from "../useCustomMutation-BX8lKAYe.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
- import "../provider/SignalR/SignalRProvider.js";
5
4
  import "../stores/BasePropsStore.js";
6
- import "../ModuleCore-DRMqZO8r.js";
5
+ import "../stores/EnvironmentStore.js";
6
+ import "../provider/SignalR/SignalRModuleContext.js";
7
+ import "../ModuleCore-C4Z4zObE.js";
7
8
  import "../utils/fetches.js";
8
9
  import "../types/Entities.js";
9
- import "../api-COabZnyn.js";
10
- import "../omit-DYPaIq41.js";
11
- import "../stores/EnvironmentStore.js";
10
+ import "../api-CikhPcJj.js";
11
+ import "../omit-CiJPWayj.js";
12
12
  export {
13
13
  x as useCustomMutation
14
14
  };
@@ -1,4 +1,4 @@
1
- import { u as p } from "../useQuery-DUDyh33-.js";
1
+ import { u as p } from "../useQuery-URJEw3ly.js";
2
2
  import { useMemo as g, useCallback as Q } from "react";
3
3
  import { useBasePropsStore as m } from "../stores/BasePropsStore.js";
4
4
  import { AllEntitiesTypeResultMap as v } from "../types/Entities.js";
@@ -27,14 +27,14 @@ const P = (t, e, o = !0, n = !1) => {
27
27
  }, [e, c, s, n]);
28
28
  }, F = (t, e, o, n, a, u = !0) => {
29
29
  const s = p({
30
- queryKey: y([e]),
31
- queryFn: () => a ? A(t ?? "", e ?? "") : D(t ?? "", e ?? ""),
32
30
  enabled: u && n && !!t && !!e && !!o,
31
+ queryFn: () => a ? A(t ?? "", e ?? "") : D(t ?? "", e ?? ""),
32
+ queryKey: y([e]),
33
33
  select: (r) => E(r)
34
34
  }), i = p({
35
- queryKey: y([e]),
36
- queryFn: () => q(t ?? "", e ?? ""),
37
35
  enabled: u && !n && !!t && !!e && !!o,
36
+ queryFn: () => q(t ?? "", e ?? ""),
37
+ queryKey: y([e]),
38
38
  select: (r) => E(r)
39
39
  });
40
40
  return n ? s : i;
@@ -0,0 +1,57 @@
1
+ import { u as c } from "../IsRestoringProvider-SzKJZczp.js";
2
+ import { useBasePropsStore as i } from "../stores/BasePropsStore.js";
3
+ import { fetchFromCustomApi as f, getFarmOrgEntities as m, getModuleDependedEntities as p } from "../utils/fetches.js";
4
+ import { getModuleQueryKey as o } from "../utils/helper.js";
5
+ import { useEntityId as d } from "./useEntity.js";
6
+ const I = () => {
7
+ const e = a();
8
+ return {
9
+ prefetch: h(),
10
+ prefetchCustom: e,
11
+ usePrefetchEntity: l
12
+ };
13
+ }, a = () => {
14
+ const e = c();
15
+ return async ({
16
+ endpoint: r,
17
+ noAuth: t = !1,
18
+ queryKey: u,
19
+ token: s
20
+ }) => {
21
+ await e.prefetchQuery({
22
+ queryFn: () => f(r, s, t),
23
+ queryKey: o(u)
24
+ });
25
+ };
26
+ }, h = () => {
27
+ const e = c();
28
+ return ({
29
+ queryFn: r,
30
+ queryKey: t
31
+ }) => e.prefetchQuery({
32
+ queryFn: r,
33
+ queryKey: o(t)
34
+ });
35
+ }, l = (e, ...r) => {
36
+ const { moduleId: t } = i(), u = c(), s = d(e);
37
+ if (!t) return "Prefetch failed: no moduleId";
38
+ r.forEach(async (y) => {
39
+ const n = s(y);
40
+ if (n) {
41
+ if (e !== "ModuleDepended") {
42
+ await u.prefetchQuery({
43
+ queryFn: () => m(t, n),
44
+ queryKey: o([n])
45
+ });
46
+ return;
47
+ }
48
+ await u.prefetchQuery({
49
+ queryFn: () => p(t, n),
50
+ queryKey: o([n])
51
+ });
52
+ }
53
+ });
54
+ };
55
+ export {
56
+ I as useOffline
57
+ };
@@ -1,22 +1,22 @@
1
- import { u as m } from "../useQuery-DUDyh33-.js";
2
- import { g as c } from "../api-COabZnyn.js";
1
+ import { u as m } from "../useQuery-URJEw3ly.js";
2
+ import { g as c } from "../api-CikhPcJj.js";
3
3
  import { useBasePropsStore as n } from "../stores/BasePropsStore.js";
4
4
  import { fetchFromCommonApi as i, fetchFromModuleApi as p } from "../utils/fetches.js";
5
5
  import { getModuleQueryKey as l, universalSelector as s } from "../utils/helper.js";
6
6
  const q = (e) => {
7
7
  const t = n((r) => r.commonOptions), o = n((r) => r.currentLanguageId), u = c(t, e);
8
8
  return m({
9
- queryKey: [e, o],
10
9
  queryFn: () => u ? Promise.resolve(u) : i(`${e}/dropdown`),
10
+ queryKey: [e, o],
11
11
  select: (r) => s(r)
12
12
  });
13
13
  }, F = (e = !0) => {
14
14
  const t = n((o) => o.moduleId);
15
15
  return m({
16
- queryKey: l([]),
16
+ enabled: e,
17
17
  queryFn: () => p(`ModuleDependencies/${t}`),
18
- select: (o) => s(o),
19
- enabled: e
18
+ queryKey: l([]),
19
+ select: (o) => s(o)
20
20
  });
21
21
  };
22
22
  export {
@@ -1,4 +1,4 @@
1
- import { SignalRModuleContext as i } from "../provider/SignalR/SignalRProvider.js";
1
+ import { SignalRModuleContext as i } from "../provider/SignalR/SignalRModuleContext.js";
2
2
  const s = (e) => {
3
3
  i.useSignalREffect(
4
4
  "ModuleApiPushNotification",
@@ -1,4 +1,4 @@
1
- import { o as r } from "../omit-DYPaIq41.js";
1
+ import { o as r } from "../omit-CiJPWayj.js";
2
2
  import { useBasePropsStore as e } from "../stores/BasePropsStore.js";
3
3
  import { useEnvironmentStore as t } from "../stores/EnvironmentStore.js";
4
4
  const i = () => {
@@ -1,6 +1,6 @@
1
1
  import { c as S } from "./_commonjsHelpers-ByX85dGu.js";
2
2
  var G, Qr;
3
- function $r() {
3
+ function Jr() {
4
4
  if (Qr) return G;
5
5
  Qr = 1;
6
6
  var r = Array.isArray;
@@ -87,7 +87,7 @@ var U, se;
87
87
  function It() {
88
88
  if (se) return U;
89
89
  se = 1;
90
- var r = $r(), e = Zr(), t = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, a = /^\w*$/;
90
+ var r = Jr(), e = Zr(), t = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, a = /^\w*$/;
91
91
  function n(i, u) {
92
92
  if (r(i))
93
93
  return !1;
@@ -119,16 +119,16 @@ function lt() {
119
119
  }
120
120
  return B = u, B;
121
121
  }
122
- var W, fe;
122
+ var $, fe;
123
123
  function At() {
124
- if (fe) return W;
124
+ if (fe) return $;
125
125
  fe = 1;
126
126
  var r = p(), e = r["__core-js_shared__"];
127
- return W = e, W;
127
+ return $ = e, $;
128
128
  }
129
- var J, he;
129
+ var W, he;
130
130
  function Ot() {
131
- if (he) return J;
131
+ if (he) return W;
132
132
  he = 1;
133
133
  var r = At(), e = (function() {
134
134
  var a = /[^.]+$/.exec(r && r.keys && r.keys.IE_PROTO || "");
@@ -137,11 +137,11 @@ function Ot() {
137
137
  function t(a) {
138
138
  return !!e && e in a;
139
139
  }
140
- return J = t, J;
140
+ return W = t, W;
141
141
  }
142
- var $, ve;
142
+ var J, ve;
143
143
  function gt() {
144
- if (ve) return $;
144
+ if (ve) return J;
145
145
  ve = 1;
146
146
  var r = Function.prototype, e = r.toString;
147
147
  function t(a) {
@@ -157,7 +157,7 @@ function gt() {
157
157
  }
158
158
  return "";
159
159
  }
160
- return $ = t, $;
160
+ return J = t, J;
161
161
  }
162
162
  var X, _e;
163
163
  function Pt() {
@@ -406,7 +406,7 @@ function O() {
406
406
  return gr = e, gr;
407
407
  }
408
408
  var br, Ge;
409
- function Wt() {
409
+ function $t() {
410
410
  if (Ge) return br;
411
411
  Ge = 1;
412
412
  var r = O();
@@ -417,7 +417,7 @@ function Wt() {
417
417
  return br = e, br;
418
418
  }
419
419
  var yr, Ee;
420
- function Jt() {
420
+ function Wt() {
421
421
  if (Ee) return yr;
422
422
  Ee = 1;
423
423
  var r = O();
@@ -427,7 +427,7 @@ function Jt() {
427
427
  return yr = e, yr;
428
428
  }
429
429
  var qr, He;
430
- function $t() {
430
+ function Jt() {
431
431
  if (He) return qr;
432
432
  He = 1;
433
433
  var r = O();
@@ -451,7 +451,7 @@ var Cr, Ne;
451
451
  function Zt() {
452
452
  if (Ne) return Cr;
453
453
  Ne = 1;
454
- var r = Vt(), e = Wt(), t = Jt(), a = $t(), n = Xt();
454
+ var r = Vt(), e = $t(), t = Wt(), a = Jt(), n = Xt();
455
455
  function i(u) {
456
456
  var s = -1, o = u == null ? 0 : u.length;
457
457
  for (this.clear(); ++s < o; ) {
@@ -520,7 +520,7 @@ var Ir, Ue;
520
520
  function ta() {
521
521
  if (Ue) return Ir;
522
522
  Ue = 1;
523
- var r = Xr(), e = ea(), t = $r(), a = Zr(), n = r ? r.prototype : void 0, i = n ? n.toString : void 0;
523
+ var r = Xr(), e = ea(), t = Jr(), a = Zr(), n = r ? r.prototype : void 0, i = n ? n.toString : void 0;
524
524
  function u(s) {
525
525
  if (typeof s == "string")
526
526
  return s;
@@ -547,16 +547,16 @@ var Or, Be;
547
547
  function na() {
548
548
  if (Be) return Or;
549
549
  Be = 1;
550
- var r = $r(), e = It(), t = ra(), a = aa();
550
+ var r = Jr(), e = It(), t = ra(), a = aa();
551
551
  function n(i, u) {
552
552
  return r(i) ? i : e(i, u) ? [i] : t(a(i));
553
553
  }
554
554
  return Or = n, Or;
555
555
  }
556
- var Pr, We;
556
+ var Pr, $e;
557
557
  function ia() {
558
- if (We) return Pr;
559
- We = 1;
558
+ if ($e) return Pr;
559
+ $e = 1;
560
560
  var r = Zr();
561
561
  function e(t) {
562
562
  if (typeof t == "string" || r(t))
@@ -566,10 +566,10 @@ function ia() {
566
566
  }
567
567
  return Pr = e, Pr;
568
568
  }
569
- var wr, Je;
569
+ var wr, We;
570
570
  function ya() {
571
- if (Je) return wr;
572
- Je = 1;
571
+ if (We) return wr;
572
+ We = 1;
573
573
  var r = na(), e = ia();
574
574
  function t(a, n) {
575
575
  n = r(n, a);
@@ -579,10 +579,10 @@ function ya() {
579
579
  }
580
580
  return wr = t, wr;
581
581
  }
582
- var Mr, $e;
582
+ var Mr, Je;
583
583
  function ua() {
584
- if ($e) return Mr;
585
- $e = 1;
584
+ if (Je) return Mr;
585
+ Je = 1;
586
586
  var r = Object.prototype;
587
587
  function e(t) {
588
588
  var a = t && t.constructor, n = typeof a == "function" && a.prototype || r;
@@ -743,16 +743,16 @@ function da() {
743
743
  }
744
744
  return Br = jt, Br;
745
745
  }
746
- var Wr, ht;
746
+ var $r, ht;
747
747
  function la() {
748
- if (ht) return Wr;
748
+ if (ht) return $r;
749
749
  ht = 1;
750
750
  function r(e) {
751
751
  return function(t) {
752
752
  return e(t);
753
753
  };
754
754
  }
755
- return Wr = r, Wr;
755
+ return $r = r, $r;
756
756
  }
757
757
  var y = { exports: {} };
758
758
  y.exports;
@@ -769,18 +769,18 @@ function ga() {
769
769
  r.exports = s;
770
770
  })(y, y.exports)), y.exports;
771
771
  }
772
- var Jr, _t;
772
+ var Wr, _t;
773
773
  function Sa() {
774
- if (_t) return Jr;
774
+ if (_t) return Wr;
775
775
  _t = 1;
776
776
  var r = da(), e = la(), t = ga(), a = t && t.isTypedArray, n = a ? e(a) : r;
777
- return Jr = n, Jr;
777
+ return Wr = n, Wr;
778
778
  }
779
779
  export {
780
780
  qa as a,
781
781
  ma as b,
782
782
  Ca as c,
783
- $r as d,
783
+ Jr as d,
784
784
  Ta as e,
785
785
  ja as f,
786
786
  Sa as g,
@@ -32,5 +32,5 @@ type ModuleBaseProps = {
32
32
  /**
33
33
  * Main component of the module. This component is used to create a module with a router and a signalR provider.
34
34
  */
35
- export declare const ModuleBase: ({ props, routes, env, useSignalR, queryClient, }: ModuleBaseProps) => import("react/jsx-runtime").JSX.Element;
35
+ export declare const ModuleBase: ({ env, props, queryClient, routes, useSignalR, }: ModuleBaseProps) => import("react").JSX.Element;
36
36
  export {};
@@ -1,7 +1,6 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  import { BaseProps } from '../types/BaseProps';
3
3
  import { EnvConfig } from '../types/Environment';
4
- export declare const ModuleQueryClient: QueryClient;
5
4
  type ModuleCoreProps = {
6
5
  /**
7
6
  * Properties that are passed to the Base component by the host application, {@link BaseProps}
@@ -28,5 +27,5 @@ type ModuleCoreProps = {
28
27
  /**
29
28
  * Minimal component to create a module with a query client and a signalR provider (to use module api)
30
29
  */
31
- export declare const ModuleCore: ({ props, env, queryClient, children, }: ModuleCoreProps) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const ModuleCore: ({ children, env, props, queryClient, }: ModuleCoreProps) => import("react").JSX.Element;
32
31
  export {};
@@ -5,5 +5,5 @@ type UseCustomParams<T> = Omit<Parameters<typeof useQuery>[0], 'queryFn' | 'sele
5
5
  selector?: (data: unknown) => T;
6
6
  noAuth?: boolean;
7
7
  };
8
- export declare const useCustom: <T>({ endpoint, queryKey, token, selector, enabled, noAuth, ...rest }: UseCustomParams<T>) => import('@tanstack/react-query').UseQueryResult<import('@tanstack/query-core').NoInfer<T>, unknown>;
8
+ export declare const useCustom: <T>({ enabled, endpoint, noAuth, queryKey, selector, token, ...rest }: UseCustomParams<T>) => import('@tanstack/react-query').UseQueryResult<NoInfer<T>, unknown>;
9
9
  export {};
@@ -11,4 +11,4 @@ export type CustomMutationInput<Input> = {
11
11
  input: Input;
12
12
  replaceEndpointWith?: string;
13
13
  };
14
- export declare const useCustomMutation: <Input, Output>({ endpoint, method, token, headers, noAuth, ...rest }: UseCustomMutationParams) => UseMutationResult<BaseResponse<Output>, Error, CustomMutationInput<Input>, unknown>;
14
+ export declare const useCustomMutation: <Input, Output>({ endpoint, headers, method, noAuth, token, ...rest }: UseCustomMutationParams) => UseMutationResult<BaseResponse<Output>, Error, CustomMutationInput<Input>, unknown>;
@@ -1,15 +1,15 @@
1
1
  import { HortiviewDataAreaEntity, HortiviewDataAreaGroup, ModuleDataAreaGroup } from '../types/Entities';
2
2
  export declare const useOffline: () => {
3
- prefetchCustom: <T>({ queryKey, endpoint, token, noAuth, }: {
3
+ prefetch: <T>({ queryFn, queryKey, }: {
4
+ queryKey: (string | undefined)[];
5
+ queryFn: () => Promise<T>;
6
+ }) => Promise<void>;
7
+ prefetchCustom: <T>({ endpoint, noAuth, queryKey, token, }: {
4
8
  queryKey: (string | undefined)[];
5
9
  endpoint: string;
6
10
  token?: string;
7
11
  noAuth?: boolean;
8
12
  selector?: (data: unknown) => T;
9
13
  }) => Promise<void>;
10
- prefetch: <T>({ queryKey, queryFn, }: {
11
- queryKey: (string | undefined)[];
12
- queryFn: () => Promise<T>;
13
- }) => Promise<void>;
14
14
  usePrefetchEntity: <K extends HortiviewDataAreaGroup | ModuleDataAreaGroup, E extends HortiviewDataAreaEntity<K>>(group: K, ...entities: E[]) => "Prefetch failed: no moduleId" | undefined;
15
15
  };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * SignalRProvider on behalf of the module
3
+ */
4
+ export declare const SignalRModuleContext: import('react-signalr/lib/signalr/types').Context<import('react-signalr/lib/signalr/types').Hub<string, string>>;
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+ /**
3
+ * SignalRProvider
4
+ * @param children
5
+ * @returns
6
+ */
7
+ export declare const SignalRProvider: ({ children, enabled, }: PropsWithChildren & {
8
+ enabled: boolean;
9
+ }) => import("react").JSX.Element;
@@ -0,0 +1,98 @@
1
+ import { ActionItem } from './ActionStorage';
2
+ import { AppInsightsEvent, AppInsightsException, AppInsightsProperties } from './AppInsights';
3
+ import { AllDropdownsData, CommonOption } from './CommonOptions';
4
+ import { EnvironmentVariable } from './EnvironmentVariable';
5
+ import { SystemMessage } from './SystemMessage';
6
+ /**
7
+ * Properties that are passed to the Base component by the host application
8
+ * @param alertRules rules for the alerting system, that are used to show alerts in the host application
9
+ * @param isOnline indicates if the host application is online or offline
10
+ * @param modulePermissionToken token for the module, to communicate with the module api
11
+ * @param moduleId id of the module
12
+ * @param organizationId id of the organization, where the module is used
13
+ * @param basePath base path of the module (that is part of the URL and will be used for routing)
14
+ * @param currentNavigationPath current path of the route, that is changed, when the host application navigates
15
+ * @param currentLanguage current language of the host application
16
+ * @param currentLanguageId current language id of the host application
17
+ * @param commonOptions common options that are used in the module, to show dropdowns with options
18
+ * @param environmentVariables environment variables that are used in the module, to show environment specific information
19
+ * @param refreshModulePermissionToken function to refresh the module permission token, that is used to communicate with the module api
20
+ * @param navigateInHortiview function to navigate to a specific route in the host application, that is used for routing in non-React remotes
21
+ * @param addBreadcrumbTranslation function to add a translation to the i18n instance of the host application, that is used for breadcrumb translations
22
+ * @param showSnackbar function to show a snackbar in the host application, that is used to show messages in the host application
23
+ * @param showMessage function to show a message in the host application, that is used to show messages in the host application
24
+ * @param pendingActions list of pending actions that are used in the module, to show pending actions in the host application
25
+ * @param getPendingActions function to get the list of pending actions, that are used in the module, to show pending actions in the host application
26
+ * @param resolveAction function to resolve a pending action, that is used in the module, to show pending actions in the host application
27
+ * @param startResolvingAction function to start resolving a pending action, that is used in the module, to show pending actions in the host application
28
+ * @param addAction function to add a pending action, that is used in the module, to show pending actions in the host application
29
+ * @param getActions function to get the list of actions, that is used in the module, to show actions in the host application
30
+ * @param getActionByKey function to get an action by key, that is used in the module, to show actions in the host application
31
+ * @param logEvent function to log an event to the host application, that is used for telemetry
32
+ * @param logError function to log an error to the host application, that is used for telemetry
33
+ * @param throwError function to throw an error in the host application, that is used for error handling
34
+ * @param config configuration object that is used to configure the module
35
+ */
36
+ export type BaseProps = {
37
+ alertRules?: string;
38
+ isOnline?: boolean;
39
+ modulePermissionToken?: string;
40
+ moduleId?: string;
41
+ organizationId?: string;
42
+ basePath: string;
43
+ currentNavigationPath?: string;
44
+ currentLanguage?: string;
45
+ currentLanguageId?: string;
46
+ commonOptions?: AllDropdownsData<CommonOption>['items'];
47
+ environmentVariables?: EnvironmentVariable[];
48
+ refreshModulePermissionToken?: () => Promise<string | undefined>;
49
+ /**
50
+ * Host navigation callback for non-React remotes.
51
+ *
52
+ * React modules should use React Router's `useNavigate` directly and prefer relative paths.
53
+ * Angular (or other non-React) modules should call this callback to ask the host shell to navigate.
54
+ *
55
+ * @example
56
+ * React module (recommended):
57
+ * ```tsx
58
+ * import { useNavigate } from 'react-router';
59
+ *
60
+ * const navigate = useNavigate();
61
+ *
62
+ * navigate('details/42'); // /farm/modules/{moduleId}/details/42
63
+ * navigate(''); // /farm/modules/{moduleId}
64
+ *
65
+ * // Avoid absolute paths in module-internal navigation:
66
+ * // navigate('/details/42')
67
+ * ```
68
+ *
69
+ * @example
70
+ * Angular module:
71
+ * ```ts
72
+ * // baseProps is provided by the host application
73
+ * baseProps.navigateInHortiview?.('details/42');
74
+ * baseProps.navigateInHortiview?.('');
75
+ * ```
76
+ *
77
+ * The host can normalize and prepend `basePath` as needed.
78
+ * @param path
79
+ * @returns
80
+ */
81
+ navigateInHortiview?: (path: string) => void;
82
+ addBreadcrumbTranslation?: (translation: {
83
+ key: string;
84
+ value: string;
85
+ }, hide?: boolean) => void;
86
+ showSnackbar?: (message: string, icon?: string) => void;
87
+ showMessage?: (message: SystemMessage) => void;
88
+ pendingActions?: ActionItem[];
89
+ getPendingActions?: () => ActionItem[];
90
+ resolveAction?: (key: string, result?: string) => void;
91
+ startResolvingAction?: (key: string) => void;
92
+ addAction?: (functionName: string, args: unknown[], key?: string) => void;
93
+ getActions?: () => ActionItem[];
94
+ getActionByKey?: (key: string) => ActionItem | undefined;
95
+ logEvent?: (event: AppInsightsEvent, customProperties?: AppInsightsProperties) => void;
96
+ logError?: (exception: AppInsightsException) => void;
97
+ throwError?: (message: string, code: number) => void;
98
+ };
@@ -0,0 +1,6 @@
1
+ import { Persister } from '@tanstack/react-query-persist-client';
2
+ /**
3
+ * Creates an Indexed DB persister
4
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
5
+ */
6
+ export declare const createIDBPersister: (idbValidKey?: IDBValidKey) => Persister;