@m4l/core 2.0.3 → 2.0.4

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 (58) hide show
  1. package/contexts/AuthContext/constants.d.ts +5 -0
  2. package/contexts/AuthContext/index.d.ts +1 -1
  3. package/contexts/AuthContext/index.dd2ed9e6.js +137 -0
  4. package/contexts/AuthContext/types.d.ts +17 -18
  5. package/contexts/BaseContext/index.d.ts +1 -0
  6. package/contexts/DomainContext/{index-D24R5afH.js → index.2ed56159.js} +5 -7
  7. package/contexts/DomainContext/index.d.ts +1 -0
  8. package/contexts/DomainCountryContext/{index-Gjy6Za6i.js → index.3cdf9462.js} +3 -3
  9. package/contexts/DomainCountryContext/index.d.ts +1 -0
  10. package/contexts/EnvironmentContext/index.d.ts +1 -0
  11. package/contexts/FlagsContext/{index-DcIX8FKd.js → index.5b096265.js} +1 -1
  12. package/contexts/FlagsContext/index.d.ts +1 -0
  13. package/contexts/HostToolsContext/index.d.ts +1 -0
  14. package/contexts/ModuleDictionaryContext/index.63e1dbbd.js +74 -0
  15. package/contexts/ModuleDictionaryContext/index.d.ts +1 -0
  16. package/contexts/ModulePrivilegesContext/{index-DsoWo0kK.js → index.1274092a.js} +4 -5
  17. package/contexts/ModulePrivilegesContext/index.d.ts +1 -0
  18. package/contexts/ModuleSkeletonContext/{index-CkhzuYKp.js → index.9267d86a.js} +1 -1
  19. package/contexts/ModuleSkeletonContext/index.d.ts +1 -0
  20. package/contexts/NetworkContext/index.d.ts +1 -0
  21. package/contexts/NetworkContext/{index-C8wX3ESG.js → index.ec7405cd.js} +2 -2
  22. package/contexts/index.d.ts +1 -1
  23. package/hooks/useAuth/index.94b696a7.js +11 -0
  24. package/hooks/useAuth/useAuth.d.ts +1 -1
  25. package/hooks/useBase/index.4375dcef.js +11 -0
  26. package/hooks/useDomain/{index-Bct5KNcv.js → index.dd6909f6.js} +4 -3
  27. package/hooks/useEnvironment/index.25f83176.js +11 -0
  28. package/hooks/useFlagsStore/{index-EagkUnqK.js → index.f7c613ac.js} +4 -3
  29. package/hooks/useHostTools/index.66d9a667.js +11 -0
  30. package/hooks/useModuleDictionary/{index-C1BKVxpe.js → index.80b52ae5.js} +1 -1
  31. package/hooks/useModulePrivileges/{index-D14YH0TD.js → index.e93abed8.js} +1 -1
  32. package/hooks/useModuleSkeleton/{index-CBPHGKDR.js → index.a8238d1d.js} +1 -1
  33. package/hooks/useNetwork/index.3d79002b.js +11 -0
  34. package/hooks/usePaginate/{index-DOOXkJPW.js → index.0a5d70e5.js} +2 -5
  35. package/hooks/usePaginate/index.d.ts +1 -0
  36. package/hooks/usePropageteMF/{index-DEVKsg4w.js → index.c440b829.js} +1 -1
  37. package/index.js +83 -74
  38. package/{node_modules-C59GSzS1.js → node_modules.04fac7e9.js} +60 -36
  39. package/package.json +1 -1
  40. package/types/dictionary.d.ts +1 -1
  41. package/types/index.d.ts +1 -0
  42. package/utils/{axiosOperation-CEky_K0E.js → axiosOperation.ac6c8eef.js} +1 -1
  43. package/utils/getPropertyByString/index.d.ts +3 -1
  44. package/utils/index.54ccec2f.js +61 -0
  45. package/vite-env.d.ts +4 -4
  46. package/contexts/AuthContext/index-cvUlEja1.js +0 -136
  47. package/contexts/ModuleDictionaryContext/index-kBzBlTUI.js +0 -71
  48. package/hooks/useAuth/index-BmbX0ftD.js +0 -10
  49. package/hooks/useBase/index-gThCdRe-.js +0 -10
  50. package/hooks/useEnvironment/index-D1xRKaoe.js +0 -10
  51. package/hooks/useHostTools/index-CL3d7qFm.js +0 -10
  52. package/hooks/useNetwork/index--IzMsMJ2.js +0 -10
  53. package/utils/index-BNOjc4WT.js +0 -61
  54. /package/contexts/BaseContext/{index-BZehLjuv.js → index.f9cdc955.js} +0 -0
  55. /package/contexts/EnvironmentContext/{index-CQz-FvKh.js → index.b33784cd.js} +0 -0
  56. /package/contexts/HostToolsContext/{index-DikGcxz8.js → index.499db832.js} +0 -0
  57. /package/hooks/useLocalStorage/{index-CsLmjbAr.js → index.91bc0791.js} +0 -0
  58. /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-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";
1
+ import { C as p, E as l } from "./types/index.42c24946.js";
2
+ import { B as d, a as v } from "./contexts/BaseContext/index.f9cdc955.js";
3
+ import { E as P, a as C } from "./contexts/EnvironmentContext/index.b33784cd.js";
4
+ import { H as D, a as S } from "./contexts/HostToolsContext/index.499db832.js";
5
+ import { N as y, a as F } from "./contexts/NetworkContext/index.ec7405cd.js";
6
+ import { F as k, a as h } from "./contexts/FlagsContext/index.5b096265.js";
7
+ import { D as L, a as A } from "./contexts/DomainContext/index.2ed56159.js";
8
+ import { M as N, a as w } from "./contexts/ModuleDictionaryContext/index.63e1dbbd.js";
9
+ import { M as W, a as O } from "./contexts/ModulePrivilegesContext/index.1274092a.js";
10
+ import { M as j, a as q } from "./contexts/ModuleSkeletonContext/index.9267d86a.js";
11
+ import { D as G, a as I } from "./contexts/DomainCountryContext/index.3cdf9462.js";
12
+ import { A as K, a as Q } from "./contexts/AuthContext/index.dd2ed9e6.js";
13
+ import { u as U } from "./hooks/useBase/index.4375dcef.js";
14
+ import { u as X } from "./hooks/useEnvironment/index.25f83176.js";
15
+ import { a as Z, u as _ } from "./hooks/useFlagsStore/index.f7c613ac.js";
16
+ import { u as oo } from "./hooks/useHostTools/index.66d9a667.js";
17
+ import { u as ro, a as to } from "./hooks/useDomain/index.dd6909f6.js";
18
+ import { a as so, u as io } from "./hooks/useLocalStorage/index.91bc0791.js";
19
+ import { u as no } from "./hooks/useModuleDictionary/index.80b52ae5.js";
20
+ import { u as xo } from "./hooks/useModulePrivileges/index.e93abed8.js";
21
+ import { u as lo } from "./hooks/useModuleSkeleton/index.a8238d1d.js";
22
+ import { u as vo } from "./hooks/useNetwork/index.3d79002b.js";
23
+ import { i as Po, u as Co } from "./hooks/usePaginate/index.0a5d70e5.js";
24
+ import { u as Do } from "./hooks/usePropageteMF/index.c440b829.js";
25
+ import { u as co } from "./hooks/useAuth/index.94b696a7.js";
26
+ import { e as Fo, g as Eo, a as ko, s as ho, v as Bo } from "./utils/index.54ccec2f.js";
27
+ import { a as Ao } from "./utils/axiosOperation.ac6c8eef.js";
28
+ import "react";
29
+ import "react/jsx-runtime";
30
+ import "zustand";
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,
34
- y as DomainContext,
35
- W as DomainCountryContext,
36
- O as DomainCountryProvider,
37
- 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,
45
- k as ModuleDictionaryContext,
46
- h as ModuleDictionaryProvider,
47
- L as ModulePrivilegesContext,
48
- A as ModulePrivilegesProvider,
49
- N as ModuleSkeletonContext,
50
- 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
38
+ K as AuthContext,
39
+ Q as AuthProvider,
40
+ d as BaseContext,
41
+ v as BaseProvider,
42
+ p as CommonFlags,
43
+ L as DomainContext,
44
+ G as DomainCountryContext,
45
+ I as DomainCountryProvider,
46
+ A as DomainProvider,
47
+ l as EmitEvents,
48
+ P as EnvironmentContext,
49
+ C as EnvironmentProvider,
50
+ k as FlagsContext,
51
+ h as FlagsProvider,
52
+ D as HostToolsContext,
53
+ S as HostToolsProvider,
54
+ N as ModuleDictionaryContext,
55
+ w as ModuleDictionaryProvider,
56
+ W as ModulePrivilegesContext,
57
+ O as ModulePrivilegesProvider,
58
+ j as ModuleSkeletonContext,
59
+ q as ModuleSkeletonProvider,
60
+ y as NetworkContext,
61
+ F as NetworkProvider,
62
+ Ao as axiosOperation,
63
+ Fo as evaluateWithContext,
64
+ Eo as getLocalStorage,
65
+ ko as getPropertyByString,
66
+ Po as initialPagerState,
67
+ ho as setLocalStorage,
68
+ co as useAuth,
69
+ U as useBase,
70
+ ro as useDomain,
71
+ to as useDomainCountry,
72
+ X as useEnvironment,
73
+ Z as useFlagsPresent,
74
+ _ as useFlagsStore,
75
+ oo as useHostTools,
76
+ so as useLocalStorage,
77
+ io as useLocalStorageWithListener,
78
+ no as useModuleDictionary,
79
+ xo as useModulePrivileges,
80
+ lo as useModuleSkeleton,
81
+ vo as useNetwork,
82
+ Co as usePaginate,
83
+ Do 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.3",
3
+ "version": "2.0.4",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "private": false,
@@ -1,4 +1,4 @@
1
- export declare type GetLabelType = (key: string) => string;
1
+ export declare type GetLabelType = (key: string, ...args: string[]) => string;
2
2
  export interface ComponentDictionary {
3
3
  [key: string]: string;
4
4
  }
package/types/index.d.ts CHANGED
@@ -33,6 +33,7 @@ export declare type EnvironmentType = {
33
33
  host_api_local: string;
34
34
  host_static_assets: string;
35
35
  environment_assets: string;
36
+ host_api_icons?: string;
36
37
  };
37
38
  export declare type NetworkProps = {
38
39
  method: any;
@@ -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 +1,3 @@
1
- export declare function getPropertyByString(object: any, key: string): string | undefined | any[] | Record<any, any>;
1
+ declare type PropertyType = string | undefined | any[] | Record<any, any>;
2
+ export declare function getPropertyByString<T extends PropertyType = PropertyType>(object: any, key: string, defaultValue?: T): T;
3
+ export {};
@@ -0,0 +1,61 @@
1
+ function u() {
2
+ }
3
+ function g(n, r, e) {
4
+ const o = r.split(".");
5
+ let t = n;
6
+ for (const a of o) {
7
+ const c = a.match(/^(\w+)\[(\w+)\]$/);
8
+ if (c) {
9
+ const s = c[1], i = c[2];
10
+ if (t[s] && Array.isArray(t[s])) {
11
+ if (i === "lastIndex")
12
+ return t[s][t[s].length - 1];
13
+ {
14
+ const l = parseInt(i);
15
+ return t[s][l];
16
+ }
17
+ } else
18
+ return e;
19
+ } else if (t[a] !== void 0)
20
+ t = t[a];
21
+ else
22
+ return e;
23
+ }
24
+ return t;
25
+ }
26
+ function f(n, r) {
27
+ try {
28
+ const o = new Function(...Object.keys(n), `return \`${r}\``)(...Object.values(n));
29
+ return String(o).replace(/`/g, "");
30
+ } catch (e) {
31
+ return console.error(`Error evaluating expression: ${e}`), "";
32
+ }
33
+ }
34
+ function y(n, r) {
35
+ try {
36
+ const e = window.localStorage.getItem(n);
37
+ return e !== null ? typeof r == "string" ? e : JSON.parse(e) : r;
38
+ } catch {
39
+ return r;
40
+ }
41
+ }
42
+ function S(n, r, e = !1) {
43
+ try {
44
+ let o = null;
45
+ if (typeof r == "string") {
46
+ window.localStorage.setItem(n, r);
47
+ return;
48
+ }
49
+ e && (o = window.localStorage.getItem(n));
50
+ let t = o !== null ? JSON.parse(o) : {};
51
+ t = { ...t, ...r }, window.localStorage.setItem(n, JSON.stringify(t));
52
+ } catch {
53
+ }
54
+ }
55
+ export {
56
+ g as a,
57
+ f as e,
58
+ y as g,
59
+ S as s,
60
+ u as v
61
+ };
package/vite-env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vitest" />
3
- /// <reference types="vitest/globals" />
4
- /// <reference types="vitest/importMeta" />
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vitest" />
3
+ /// <reference types="vitest/globals" />
4
+ /// <reference types="vitest/importMeta" />
@@ -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,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
- };
@@ -1,10 +0,0 @@
1
- import { useContext as o } from "react";
2
- import { A as e } from "../../contexts/AuthContext/index-cvUlEja1.js";
3
- const n = () => {
4
- const t = o(e);
5
- if (!t) throw new Error("Auth context must be use inside AuthProvider");
6
- return t;
7
- };
8
- export {
9
- n as u
10
- };