@m4l/core 2.0.1 → 2.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 (40) hide show
  1. package/contexts/AuthContext/index.db46edbc.js +150 -0
  2. package/contexts/DomainContext/{index-D24R5afH.js → index.2ed56159.js} +5 -7
  3. package/contexts/DomainCountryContext/index.506456a3.js +57 -0
  4. package/contexts/FlagsContext/{index-DcIX8FKd.js → index.5b096265.js} +1 -1
  5. package/contexts/ModuleDictionaryContext/index.a64207d4.js +81 -0
  6. package/contexts/ModulePrivilegesContext/index.79c3cc04.js +62 -0
  7. package/contexts/ModuleSkeletonContext/index.f6150fb9.js +30 -0
  8. package/contexts/NetworkContext/{index-C8wX3ESG.js → index.ec7405cd.js} +2 -2
  9. package/hooks/useAuth/index.4154d394.js +21 -0
  10. package/hooks/useBase/index.4375dcef.js +11 -0
  11. package/hooks/useDomain/{index-Bct5KNcv.js → index.be2722d9.js} +4 -3
  12. package/hooks/useEnvironment/index.25f83176.js +11 -0
  13. package/hooks/useFlagsStore/{index-EagkUnqK.js → index.f7c613ac.js} +4 -3
  14. package/hooks/useHostTools/index.66d9a667.js +11 -0
  15. package/hooks/useModuleDictionary/{index-C1BKVxpe.js → index.9004a259.js} +1 -1
  16. package/hooks/useModulePrivileges/{index-D14YH0TD.js → index.6ebd7c42.js} +1 -1
  17. package/hooks/useModuleSkeleton/{index-CBPHGKDR.js → index.1cdf5081.js} +1 -1
  18. package/hooks/useNetwork/index.3d79002b.js +11 -0
  19. package/hooks/usePaginate/{index-CUbw1Kpb.js → index.1306b0de.js} +2 -3
  20. package/hooks/usePropageteMF/{index-DEVKsg4w.js → index.c440b829.js} +1 -1
  21. package/index.js +75 -66
  22. package/{node_modules-C59GSzS1.js → node_modules.04fac7e9.js} +60 -36
  23. package/package.json +1 -1
  24. package/utils/{axiosOperation-CEky_K0E.js → axiosOperation.ac6c8eef.js} +1 -1
  25. package/utils/{index-BNOjc4WT.js → index.2f5ce5aa.js} +14 -10
  26. package/contexts/AuthContext/index-cvUlEja1.js +0 -136
  27. package/contexts/DomainCountryContext/index-Gjy6Za6i.js +0 -46
  28. package/contexts/ModuleDictionaryContext/index-kBzBlTUI.js +0 -71
  29. package/contexts/ModulePrivilegesContext/index-DsoWo0kK.js +0 -53
  30. package/contexts/ModuleSkeletonContext/index-CkhzuYKp.js +0 -20
  31. package/hooks/useAuth/index-BmbX0ftD.js +0 -10
  32. package/hooks/useBase/index-gThCdRe-.js +0 -10
  33. package/hooks/useEnvironment/index-D1xRKaoe.js +0 -10
  34. package/hooks/useHostTools/index-CL3d7qFm.js +0 -10
  35. package/hooks/useNetwork/index--IzMsMJ2.js +0 -10
  36. /package/contexts/BaseContext/{index-BZehLjuv.js → index.f9cdc955.js} +0 -0
  37. /package/contexts/EnvironmentContext/{index-CQz-FvKh.js → index.b33784cd.js} +0 -0
  38. /package/contexts/HostToolsContext/{index-DikGcxz8.js → index.499db832.js} +0 -0
  39. /package/hooks/useLocalStorage/{index-CsLmjbAr.js → index.91bc0791.js} +0 -0
  40. /package/types/{index-TbOJOhBX.js → index.42c24946.js} +0 -0
package/index.js CHANGED
@@ -1,76 +1,85 @@
1
- import { C as r, E as a } from "./types/index-TbOJOhBX.js";
2
- import { B as s, a as i } from "./contexts/BaseContext/index-BZehLjuv.js";
3
- import { E as u, a as x } from "./contexts/EnvironmentContext/index-CQz-FvKh.js";
4
- import { H as p, a as l } from "./contexts/HostToolsContext/index-DikGcxz8.js";
5
- import { N as d, a as v } from "./contexts/NetworkContext/index-C8wX3ESG.js";
6
- import { A as P, a as C } from "./contexts/AuthContext/index-cvUlEja1.js";
7
- import { F as D, a as S } from "./contexts/FlagsContext/index-DcIX8FKd.js";
8
- import { D as y, a as F } from "./contexts/DomainContext/index-D24R5afH.js";
9
- import { M as k, a as h } from "./contexts/ModuleDictionaryContext/index-kBzBlTUI.js";
10
- import { M as L, a as A } from "./contexts/ModulePrivilegesContext/index-DsoWo0kK.js";
11
- import { M as N, a as w } from "./contexts/ModuleSkeletonContext/index-CkhzuYKp.js";
12
- import { D as W, a as O } from "./contexts/DomainCountryContext/index-Gjy6Za6i.js";
13
- import { u as j } from "./hooks/useBase/index-gThCdRe-.js";
14
- import { u as z } from "./hooks/useEnvironment/index-D1xRKaoe.js";
15
- import { a as I, u as J } from "./hooks/useFlagsStore/index-EagkUnqK.js";
16
- import { u as Q } from "./hooks/useHostTools/index-CL3d7qFm.js";
17
- import { u as U, a as V } from "./hooks/useDomain/index-Bct5KNcv.js";
18
- import { a as Y, u as Z } from "./hooks/useLocalStorage/index-CsLmjbAr.js";
19
- import { u as $ } from "./hooks/useModuleDictionary/index-C1BKVxpe.js";
20
- import { u as eo } from "./hooks/useModulePrivileges/index-D14YH0TD.js";
21
- import { u as ao } from "./hooks/useModuleSkeleton/index-CBPHGKDR.js";
22
- import { u as so } from "./hooks/useNetwork/index--IzMsMJ2.js";
23
- import { i as no, u as uo } from "./hooks/usePaginate/index-CUbw1Kpb.js";
24
- import { u as mo } from "./hooks/usePropageteMF/index-DEVKsg4w.js";
25
- import { u as lo } from "./hooks/useAuth/index-BmbX0ftD.js";
26
- import { e as vo, g as go, a as Po, s as Co, v as Mo } from "./utils/index-BNOjc4WT.js";
27
- import { a as So } from "./utils/axiosOperation-CEky_K0E.js";
1
+ import "react";
2
+ import { B as p, a as l } from "./contexts/BaseContext/index.f9cdc955.js";
3
+ import { E as d, a as v } from "./contexts/EnvironmentContext/index.b33784cd.js";
4
+ import { F as P, a as C } from "./contexts/FlagsContext/index.5b096265.js";
5
+ import "zustand";
6
+ import { H as D, a as S } from "./contexts/HostToolsContext/index.499db832.js";
7
+ import { D as y, a as F } from "./contexts/DomainContext/index.2ed56159.js";
8
+ import { M as k, a as h } from "./contexts/ModuleDictionaryContext/index.a64207d4.js";
9
+ import { M as L, a as A } from "./contexts/ModulePrivilegesContext/index.79c3cc04.js";
10
+ import { M as N, a as w } from "./contexts/ModuleSkeletonContext/index.f6150fb9.js";
11
+ import { N as W, a as O } from "./contexts/NetworkContext/index.ec7405cd.js";
12
+ import { D as j, a as q } from "./contexts/DomainCountryContext/index.506456a3.js";
13
+ import { A as G, a as I } from "./contexts/AuthContext/index.db46edbc.js";
14
+ import { u as K } from "./hooks/useBase/index.4375dcef.js";
15
+ import { u as R } from "./hooks/useEnvironment/index.25f83176.js";
16
+ import { a as V, u as X } from "./hooks/useFlagsStore/index.f7c613ac.js";
17
+ import { u as Z } from "./hooks/useHostTools/index.66d9a667.js";
18
+ import { u as $, a as oo } from "./hooks/useDomain/index.be2722d9.js";
19
+ import { a as ro, u as to } from "./hooks/useLocalStorage/index.91bc0791.js";
20
+ import { u as so } from "./hooks/useModuleDictionary/index.9004a259.js";
21
+ import { u as mo } from "./hooks/useModulePrivileges/index.6ebd7c42.js";
22
+ import { u as uo } from "./hooks/useModuleSkeleton/index.1cdf5081.js";
23
+ import { u as po } from "./hooks/useNetwork/index.3d79002b.js";
24
+ import { i as fo, u as vo } from "./hooks/usePaginate/index.1306b0de.js";
25
+ import { u as Po } from "./hooks/usePropageteMF/index.c440b829.js";
26
+ import { u as Mo } from "./hooks/useAuth/index.4154d394.js";
27
+ import { C as So, E as co } from "./types/index.42c24946.js";
28
+ import { e as Fo, g as Eo, a as ko, s as ho, v as Bo } from "./utils/index.2f5ce5aa.js";
29
+ import { a as Ao } from "./utils/axiosOperation.ac6c8eef.js";
30
+ import "react/jsx-runtime";
31
+ import "zustand/middleware";
32
+ import "./node_modules.04fac7e9.js";
33
+ import "axios";
34
+ import "qs";
35
+ import "camelcase-keys";
36
+ import "snakecase-keys";
28
37
  export {
29
- P as AuthContext,
30
- C as AuthProvider,
31
- s as BaseContext,
32
- i as BaseProvider,
33
- r as CommonFlags,
38
+ G as AuthContext,
39
+ I as AuthProvider,
40
+ p as BaseContext,
41
+ l as BaseProvider,
42
+ So as CommonFlags,
34
43
  y as DomainContext,
35
- W as DomainCountryContext,
36
- O as DomainCountryProvider,
44
+ j as DomainCountryContext,
45
+ q as DomainCountryProvider,
37
46
  F as DomainProvider,
38
- a as EmitEvents,
39
- u as EnvironmentContext,
40
- x as EnvironmentProvider,
41
- D as FlagsContext,
42
- S as FlagsProvider,
43
- p as HostToolsContext,
44
- l as HostToolsProvider,
47
+ co as EmitEvents,
48
+ d as EnvironmentContext,
49
+ v as EnvironmentProvider,
50
+ P as FlagsContext,
51
+ C as FlagsProvider,
52
+ D as HostToolsContext,
53
+ S as HostToolsProvider,
45
54
  k as ModuleDictionaryContext,
46
55
  h as ModuleDictionaryProvider,
47
56
  L as ModulePrivilegesContext,
48
57
  A as ModulePrivilegesProvider,
49
58
  N as ModuleSkeletonContext,
50
59
  w as ModuleSkeletonProvider,
51
- d as NetworkContext,
52
- v as NetworkProvider,
53
- So as axiosOperation,
54
- vo as evaluateWithContext,
55
- go as getLocalStorage,
56
- Po as getPropertyByString,
57
- no as initialPagerState,
58
- Co as setLocalStorage,
59
- lo as useAuth,
60
- j as useBase,
61
- U as useDomain,
62
- V as useDomainCountry,
63
- z as useEnvironment,
64
- I as useFlagsPresent,
65
- J as useFlagsStore,
66
- Q as useHostTools,
67
- Y as useLocalStorage,
68
- Z as useLocalStorageWithListener,
69
- $ as useModuleDictionary,
70
- eo as useModulePrivileges,
71
- ao as useModuleSkeleton,
72
- so as useNetwork,
73
- uo as usePaginate,
74
- mo as usePropageteMF,
75
- Mo as voidFunction
60
+ W as NetworkContext,
61
+ O as NetworkProvider,
62
+ Ao as axiosOperation,
63
+ Fo as evaluateWithContext,
64
+ Eo as getLocalStorage,
65
+ ko as getPropertyByString,
66
+ fo as initialPagerState,
67
+ ho as setLocalStorage,
68
+ Mo as useAuth,
69
+ K as useBase,
70
+ $ as useDomain,
71
+ oo as useDomainCountry,
72
+ R as useEnvironment,
73
+ V as useFlagsPresent,
74
+ X as useFlagsStore,
75
+ Z as useHostTools,
76
+ ro as useLocalStorage,
77
+ to as useLocalStorageWithListener,
78
+ so as useModuleDictionary,
79
+ mo as useModulePrivileges,
80
+ uo as useModuleSkeleton,
81
+ po as useNetwork,
82
+ vo as usePaginate,
83
+ Po as usePropageteMF,
84
+ Bo as voidFunction
76
85
  };
@@ -1,5 +1,6 @@
1
1
  function s(e) {
2
- for (var t = arguments.length, r = Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++) r[n - 1] = arguments[n];
2
+ for (var t = arguments.length, r = Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
3
+ r[n - 1] = arguments[n];
3
4
  if (process.env.NODE_ENV !== "production") {
4
5
  var o = ve[e], i = o ? typeof o == "function" ? o.apply(null, r) : o : "unknown error nr: " + e;
5
6
  throw Error("[Immer] " + i);
@@ -14,9 +15,11 @@ function O(e) {
14
15
  function b(e) {
15
16
  var t;
16
17
  return !!e && (function(r) {
17
- if (!r || typeof r != "object") return !1;
18
+ if (!r || typeof r != "object")
19
+ return !1;
18
20
  var n = Object.getPrototypeOf(r);
19
- if (n === null) return !0;
21
+ if (n === null)
22
+ return !0;
20
23
  var o = Object.hasOwnProperty.call(n, "constructor") && n.constructor;
21
24
  return o === Object || typeof o == "function" && Function.toString.call(o) === he;
22
25
  }(e) || Array.isArray(e) || !!e[ne] || !!(!((t = e.constructor) === null || t === void 0) && t[ne]) || V(e) || U(e));
@@ -55,7 +58,8 @@ function m(e) {
55
58
  return e.o || e.t;
56
59
  }
57
60
  function W(e) {
58
- if (Array.isArray(e)) return Array.prototype.slice.call(e);
61
+ if (Array.isArray(e))
62
+ return Array.prototype.slice.call(e);
59
63
  var t = me(e);
60
64
  delete t[p];
61
65
  for (var r = q(t), n = 0; n < r.length; n++) {
@@ -104,13 +108,17 @@ function A(e, t) {
104
108
  return t.h.O || v("ES5").S(t, e, n), n ? (r[p].P && (j(t), s(4)), b(e) && (e = I(t, e), t.l || _(t, e)), t.u && v("Patches").M(r[p].t, e, t.u, t.s)) : e = I(t, r, []), j(t), t.u && t.v(t.u, t.s), e !== ie ? e : void 0;
105
109
  }
106
110
  function I(e, t, r) {
107
- if (G(t)) return t;
111
+ if (G(t))
112
+ return t;
108
113
  var n = t[p];
109
- if (!n) return S(t, function(a, c) {
110
- return Z(e, n, t, a, c, r);
111
- }, !0), t;
112
- if (n.A !== e) return t;
113
- if (!n.P) return _(e, n.t, !0), n.t;
114
+ if (!n)
115
+ return S(t, function(a, c) {
116
+ return Z(e, n, t, a, c, r);
117
+ }, !0), t;
118
+ if (n.A !== e)
119
+ return t;
120
+ if (!n.P)
121
+ return _(e, n.t, !0), n.t;
114
122
  if (!n.I) {
115
123
  n.I = !0, n.A._--;
116
124
  var o = n.i === 4 || n.i === 5 ? n.o = W(n.k) : n.o, i = o, u = !1;
@@ -123,11 +131,14 @@ function I(e, t, r) {
123
131
  function Z(e, t, r, n, o, i, u) {
124
132
  if (process.env.NODE_ENV !== "production" && o === r && s(5), O(o)) {
125
133
  var a = I(e, o, i && t && t.i !== 3 && !F(t.R, n) ? i.concat(n) : void 0);
126
- if (oe(r, n, a), !O(a)) return;
134
+ if (oe(r, n, a), !O(a))
135
+ return;
127
136
  e.m = !1;
128
- } else u && r.add(o);
137
+ } else
138
+ u && r.add(o);
129
139
  if (b(o) && !G(o)) {
130
- if (!e.h.D && e._ < 1) return;
140
+ if (!e.h.D && e._ < 1)
141
+ return;
131
142
  I(e, o), t && t.A.l || _(e, o);
132
143
  }
133
144
  }
@@ -139,11 +150,13 @@ function z(e, t) {
139
150
  return (r ? m(r) : e)[t];
140
151
  }
141
152
  function B(e, t) {
142
- if (t in e) for (var r = Object.getPrototypeOf(e); r; ) {
143
- var n = Object.getOwnPropertyDescriptor(r, t);
144
- if (n) return n;
145
- r = Object.getPrototypeOf(r);
146
- }
153
+ if (t in e)
154
+ for (var r = Object.getPrototypeOf(e); r; ) {
155
+ var n = Object.getOwnPropertyDescriptor(r, t);
156
+ if (n)
157
+ return n;
158
+ r = Object.getPrototypeOf(r);
159
+ }
147
160
  }
148
161
  function T(e) {
149
162
  e.P || (e.P = !0, e.l && T(e.l));
@@ -162,12 +175,15 @@ function C(e, t, r) {
162
175
  }
163
176
  function pe(e) {
164
177
  return O(e) || s(22, e), function t(r) {
165
- if (!b(r)) return r;
178
+ if (!b(r))
179
+ return r;
166
180
  var n, o = r[p], i = w(r);
167
181
  if (o) {
168
- if (!o.P && (o.i < 4 || !v("ES5").K(o))) return o.t;
182
+ if (!o.P && (o.i < 4 || !v("ES5").K(o)))
183
+ return o.t;
169
184
  o.I = !0, n = ee(r, i), o.I = !1;
170
- } else n = ee(r, i);
185
+ } else
186
+ n = ee(r, i);
171
187
  return S(n, function(u, a) {
172
188
  o && fe(o.t, u) === a || oe(n, u, t(a));
173
189
  }), i === 3 ? new Set(n) : n;
@@ -204,12 +220,14 @@ var te, P, X = typeof Symbol < "u" && typeof Symbol("x") == "symbol", de = typeo
204
220
  t[r] = Object.getOwnPropertyDescriptor(e, r);
205
221
  }), t;
206
222
  }, be = {}, K = { get: function(e, t) {
207
- if (t === p) return e;
223
+ if (t === p)
224
+ return e;
208
225
  var r = m(e);
209
- if (!F(r, t)) return function(o, i, u) {
210
- var a, c = B(i, u);
211
- return c ? "value" in c ? c.value : (a = c.get) === null || a === void 0 ? void 0 : a.call(o.k) : void 0;
212
- }(e, r, t);
226
+ if (!F(r, t))
227
+ return function(o, i, u) {
228
+ var a, c = B(i, u);
229
+ return c ? "value" in c ? c.value : (a = c.get) === null || a === void 0 ? void 0 : a.call(o.k) : void 0;
230
+ }(e, r, t);
213
231
  var n = r[t];
214
232
  return e.I || !b(n) ? n : n === z(e.t, t) ? (R(e), e.o[t] = C(e.A.h, n, e)) : n;
215
233
  }, has: function(e, t) {
@@ -218,11 +236,14 @@ var te, P, X = typeof Symbol < "u" && typeof Symbol("x") == "symbol", de = typeo
218
236
  return Reflect.ownKeys(m(e));
219
237
  }, set: function(e, t, r) {
220
238
  var n = B(m(e), t);
221
- if (n?.set) return n.set.call(e.k, r), !0;
239
+ if (n?.set)
240
+ return n.set.call(e.k, r), !0;
222
241
  if (!e.P) {
223
242
  var o = z(m(e), t), i = o?.[p];
224
- if (i && i.t === r) return e.o[t] = r, e.R[t] = !1, !0;
225
- if (ce(r, o) && (r !== void 0 || F(e.t, t))) return !0;
243
+ if (i && i.t === r)
244
+ return e.o[t] = r, e.R[t] = !1, !0;
245
+ if (ce(r, o) && (r !== void 0 || F(e.t, t)))
246
+ return !0;
226
247
  R(e), T(e);
227
248
  }
228
249
  return e.o[t] === r && (r !== void 0 || t in e.o) || Number.isNaN(r) && Number.isNaN(e.o[t]) || (e.o[t] = r, e.R[t] = !0), !0;
@@ -258,7 +279,8 @@ var ge = function() {
258
279
  return function(h) {
259
280
  var ue = this;
260
281
  h === void 0 && (h = a);
261
- for (var x = arguments.length, J = Array(x > 1 ? x - 1 : 0), E = 1; E < x; E++) J[E - 1] = arguments[E];
282
+ for (var x = arguments.length, J = Array(x > 1 ? x - 1 : 0), E = 1; E < x; E++)
283
+ J[E - 1] = arguments[E];
262
284
  return c.produce(h, function(ae) {
263
285
  var L;
264
286
  return (L = i).call.apply(L, [ue, ae].concat(J));
@@ -288,12 +310,14 @@ var ge = function() {
288
310
  }
289
311
  s(21, o);
290
312
  }, this.produceWithPatches = function(o, i) {
291
- if (typeof o == "function") return function(f) {
292
- for (var l = arguments.length, g = Array(l > 1 ? l - 1 : 0), y = 1; y < l; y++) g[y - 1] = arguments[y];
293
- return n.produceWithPatches(f, function(D) {
294
- return o.apply(void 0, [D].concat(g));
295
- });
296
- };
313
+ if (typeof o == "function")
314
+ return function(f) {
315
+ for (var l = arguments.length, g = Array(l > 1 ? l - 1 : 0), y = 1; y < l; y++)
316
+ g[y - 1] = arguments[y];
317
+ return n.produceWithPatches(f, function(D) {
318
+ return o.apply(void 0, [D].concat(g));
319
+ });
320
+ };
297
321
  var u, a, c = n.produce(o, i, function(f, l) {
298
322
  u = f, a = l;
299
323
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "private": false,
@@ -2,7 +2,7 @@ import R from "axios";
2
2
  import b from "qs";
3
3
  import j from "camelcase-keys";
4
4
  import v from "snakecase-keys";
5
- import { E as h } from "../types/index-TbOJOhBX.js";
5
+ import { E as h } from "../types/index.42c24946.js";
6
6
  function x(e, t, a, i, o, s) {
7
7
  const { toast: r } = a;
8
8
  return i === "json" ? t && t.data && typeof t.data == "object" ? t.data.error && t.data.error?.code && t.data.error?.msg !== void 0 ? Promise.reject({ ...t.data.error, status: t.status }) : (t.data.message && o && r({ title: t.data.message }, { type: "success", autoClose: 1e4 }), s ? j(t.data, { deep: !0 }) : t.data) : Promise.reject({
@@ -1,6 +1,10 @@
1
- function l() {
1
+ import "axios";
2
+ import "qs";
3
+ import "camelcase-keys";
4
+ import "snakecase-keys";
5
+ function y() {
2
6
  }
3
- function u(n, e) {
7
+ function p(n, e) {
4
8
  const r = e.split(".");
5
9
  let t = n;
6
10
  for (const o of r) {
@@ -23,7 +27,7 @@ function u(n, e) {
23
27
  }
24
28
  return t;
25
29
  }
26
- function g(n, e) {
30
+ function d(n, e) {
27
31
  try {
28
32
  const t = new Function(...Object.keys(n), `return \`${e}\``)(...Object.values(n));
29
33
  return String(t).replace(/`/g, "");
@@ -31,7 +35,7 @@ function g(n, e) {
31
35
  return console.error(`Error evaluating expression: ${r}`), "";
32
36
  }
33
37
  }
34
- function f(n, e) {
38
+ function m(n, e) {
35
39
  try {
36
40
  const r = window.localStorage.getItem(n);
37
41
  return r !== null ? typeof e == "string" ? r : JSON.parse(r) : e;
@@ -39,7 +43,7 @@ function f(n, e) {
39
43
  return e;
40
44
  }
41
45
  }
42
- function y(n, e, r = !1) {
46
+ function v(n, e, r = !1) {
43
47
  try {
44
48
  let t = null;
45
49
  if (typeof e == "string") {
@@ -53,9 +57,9 @@ function y(n, e, r = !1) {
53
57
  }
54
58
  }
55
59
  export {
56
- u as a,
57
- g as e,
58
- f as g,
59
- y as s,
60
- l as v
60
+ p as a,
61
+ d as e,
62
+ m as g,
63
+ v as s,
64
+ y as v
61
65
  };
@@ -1,136 +0,0 @@
1
- import { createContext as T, useReducer as y, useEffect as d } from "react";
2
- import { E } from "../../types/index-TbOJOhBX.js";
3
- import { jsx as v } from "react/jsx-runtime";
4
- import { u as D } from "../../hooks/useHostTools/index-CL3d7qFm.js";
5
- import { u as N } from "../../hooks/useNetwork/index--IzMsMJ2.js";
6
- import { u as O } from "../../hooks/useEnvironment/index-D1xRKaoe.js";
7
- import { u as S } from "../../hooks/useLocalStorage/index-CsLmjbAr.js";
8
- import { g as U, s as u } from "../../utils/index-BNOjc4WT.js";
9
- var s = /* @__PURE__ */ ((t) => (t.Initial = "INITIALIZE", t.Login = "LOGIN", t.Logout = "LOGOUT", t))(s || {});
10
- const w = {
11
- isAuthenticated: !1,
12
- isInitialized: !1,
13
- user: null
14
- }, _ = (t, e) => {
15
- switch (e.type) {
16
- case "INITIALIZE":
17
- return {
18
- isAuthenticated: e.payload.isAuthenticated,
19
- isInitialized: !0,
20
- user: e.payload.user
21
- };
22
- case "LOGIN":
23
- return {
24
- ...t,
25
- isAuthenticated: !0,
26
- user: e.payload.user
27
- };
28
- case "LOGOUT":
29
- return {
30
- ...t,
31
- isAuthenticated: !1,
32
- user: null
33
- };
34
- default:
35
- return t;
36
- }
37
- }, P = T(null);
38
- function x(t) {
39
- t({
40
- type: s.Initial,
41
- payload: {
42
- isAuthenticated: !1,
43
- user: null
44
- }
45
- });
46
- }
47
- function M(t) {
48
- const {
49
- children: e
50
- } = t, [m, n] = y(_, w), {
51
- events_add_listener: h
52
- } = D(), {
53
- networkOperation: r
54
- } = N(), {
55
- domain_token: f
56
- } = O(), [I, l] = S(
57
- // Variable para saber si ha cambiado la session en otro navegador
58
- "vSession",
59
- (/* @__PURE__ */ new Date()).getTime() + ""
60
- );
61
- d(() => {
62
- (async () => {
63
- r({
64
- method: "GET",
65
- endPoint: "auth/login",
66
- parms: {
67
- user_data: !0
68
- },
69
- checkUnAuthorized: !1
70
- }).then((i) => {
71
- n({
72
- type: s.Initial,
73
- payload: {
74
- isAuthenticated: !0,
75
- user: i.user
76
- }
77
- }), U("userData", {
78
- email: i.user.email,
79
- remember: !0
80
- })?.email !== i.user.email && u("userData", {
81
- email: i.user.email
82
- }, !0);
83
- }).catch(() => {
84
- x(n);
85
- });
86
- })();
87
- }, [I]);
88
- const g = async (a, i, o) => {
89
- await r({
90
- endPoint: "auth/login",
91
- method: "POST",
92
- data: {
93
- email: a,
94
- password: i,
95
- domain_token: f
96
- }
97
- }).then((L) => {
98
- const A = L.data;
99
- o ? u("userData", {
100
- email: a,
101
- remember: o
102
- }) : u("userData", {
103
- email: "",
104
- remember: o
105
- }), n({
106
- type: s.Login,
107
- payload: {
108
- user: A
109
- }
110
- }), l((/* @__PURE__ */ new Date()).getTime() + "");
111
- });
112
- }, c = async (a) => {
113
- a && await r({
114
- endPoint: "auth/logout",
115
- method: "POST"
116
- }), n({
117
- type: s.Logout
118
- }), l((/* @__PURE__ */ new Date()).getTime() + "");
119
- }, p = () => {
120
- c(!1);
121
- };
122
- return d(function() {
123
- h(E.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, p);
124
- }, []), /* @__PURE__ */ v(P.Provider, {
125
- value: {
126
- ...m,
127
- login: g,
128
- logout: c
129
- },
130
- children: e
131
- });
132
- }
133
- export {
134
- P as A,
135
- M as a
136
- };
@@ -1,46 +0,0 @@
1
- import { createContext as d, useState as y, useCallback as T } from "react";
2
- import { E as r } from "../../types/index-TbOJOhBX.js";
3
- import { jsx as f } from "react/jsx-runtime";
4
- import { u as D } from "../../hooks/useHostTools/index-CL3d7qFm.js";
5
- import { u as M } from "../../hooks/usePropageteMF/index-DEVKsg4w.js";
6
- const N = d(null);
7
- function A(e) {
8
- const {
9
- children: s,
10
- isMicroFrontEnd: t,
11
- id: i,
12
- currency: a,
13
- currency_decimal_digits: m,
14
- decimal_symbol: c,
15
- thousands_symbol: u
16
- } = e, {
17
- events_emit: _
18
- } = D(), [l, C] = y({
19
- id: i,
20
- currency: a,
21
- currency_decimal_digits: m,
22
- decimal_symbol: c,
23
- thousands_symbol: u
24
- }), n = (o) => {
25
- C(o);
26
- };
27
- M({
28
- isMicroFrontEnd: t,
29
- event: r.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE,
30
- setHandler: n
31
- });
32
- const E = T((o) => {
33
- t || (n(o), _(r.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE, o));
34
- }, []);
35
- return /* @__PURE__ */ f(N.Provider, {
36
- value: {
37
- ...l,
38
- changeDomainCountry: E
39
- },
40
- children: s
41
- });
42
- }
43
- export {
44
- N as D,
45
- A as a
46
- };
@@ -1,71 +0,0 @@
1
- import { createContext as F, useState as y, useEffect as A, useCallback as u } from "react";
2
- import { C as L } from "../../types/index-TbOJOhBX.js";
3
- import { jsx as M } from "react/jsx-runtime";
4
- import { u as N } from "../../hooks/useFlagsStore/index-EagkUnqK.js";
5
- import { u as P } from "../../hooks/useEnvironment/index-D1xRKaoe.js";
6
- import { u as _ } from "../../hooks/useHostTools/index-CL3d7qFm.js";
7
- import { u as x } from "../../hooks/useNetwork/index--IzMsMJ2.js";
8
- const E = F(null);
9
- function S(l) {
10
- const {
11
- children: c,
12
- componentsDictionary: m,
13
- moduleId: s,
14
- moduleNameField: i = "module_name",
15
- currentLang: d = "en",
16
- isAuth: a = !0
17
- } = l, f = N((t) => t.flagsActions.addFlag), [e, p] = y(void 0), {
18
- domain_token: g
19
- } = P(), {
20
- startProgress: D,
21
- stopProgress: h
22
- } = _(), {
23
- networkOperation: v
24
- } = x();
25
- A(() => {
26
- let t = !0;
27
- return D(), v({
28
- method: "GET",
29
- endPoint: a ? `dictionaries/${s}` : `na/dictionaries/${s}`,
30
- parms: {
31
- comps: m,
32
- // lang: 'en',
33
- ...a ? {} : {
34
- domain_token: g
35
- }
36
- }
37
- // isRemote: false
38
- }).then((o) => {
39
- t && (p({
40
- ...o
41
- }), f(L.FLAG_DICTIONARY_LOADED));
42
- }).finally(() => {
43
- h();
44
- }), function() {
45
- t = !1;
46
- };
47
- }, [d]);
48
- const n = u((t) => {
49
- if (e === void 0) return "";
50
- if (t === "") return "No key";
51
- let o;
52
- const r = t.split(".");
53
- try {
54
- r.length === 1 && (o = e.data[t]), r.length === 2 && (o = e[r[0]][r[1]]);
55
- } catch {
56
- }
57
- return o || `N_D:[${t}]`;
58
- }, [e]), C = u(() => n(i), [i, n]);
59
- return /* @__PURE__ */ M(E.Provider, {
60
- value: {
61
- moduleDictionary: e,
62
- getLabel: n,
63
- getModuleLabel: C
64
- },
65
- children: c
66
- });
67
- }
68
- export {
69
- E as M,
70
- S as a
71
- };