@m4l/core 2.0.2 → 2.0.3

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