@m4l/core 0.1.57 → 1.0.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.
- package/contexts/DomainContext/index.2ed56159.js +56 -0
- package/contexts/DomainCountryContext/index.e7a82641.js +55 -0
- package/contexts/FlagsContext/index.5b096265.js +41 -0
- package/contexts/FlagsContext/index.d.ts +10 -2
- package/contexts/FlagsContext/store.d.ts +11 -0
- package/contexts/FlagsContext/types.d.ts +9 -0
- package/contexts/ModuleDictionaryContext/index.011db031.js +76 -0
- package/contexts/ModulePrivilegesContext/index.a45d4cf7.js +58 -0
- package/contexts/ModuleSkeletonContext/index.2cd78f14.js +28 -0
- package/hooks/index.d.ts +1 -1
- package/hooks/useDomain/{index.38a2a89e.js → index.b743be01.js} +2 -2
- package/hooks/useFlagsStore/index.d.ts +3 -0
- package/hooks/useFlagsStore/index.f7c613ac.js +18 -0
- package/hooks/useModuleDictionary/{index.3305a123.js → index.0a0998b6.js} +1 -1
- package/hooks/useModulePrivileges/{index.cbe0c72f.js → index.24c10523.js} +1 -1
- package/hooks/useModuleSkeleton/{index.739fd422.js → index.12ff3650.js} +1 -1
- package/index.js +52 -49
- package/node_modules.04fac7e9.js +401 -0
- package/package.json +4 -2
- package/utils/{index.c7370abf.js → index.6d56ba04.js} +14 -10
- package/vite-env.d.ts +4 -4
- package/contexts/DomainContext/index.b9fd4c7f.js +0 -57
- package/contexts/DomainCountryContext/index.3cdf9462.js +0 -46
- package/contexts/FlagsContext/index.5f795859.js +0 -24
- package/contexts/ModuleDictionaryContext/index.848a0393.js +0 -73
- package/contexts/ModulePrivilegesContext/index.f1988b13.js +0 -54
- package/contexts/ModuleSkeletonContext/index.45963775.js +0 -20
- package/hooks/useFlags/index.a986729d.js +0 -21
- package/hooks/useFlags/index.d.ts +0 -3
|
@@ -0,0 +1,401 @@
|
|
|
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];
|
|
4
|
+
if (process.env.NODE_ENV !== "production") {
|
|
5
|
+
var o = ve[e], i = o ? typeof o == "function" ? o.apply(null, r) : o : "unknown error nr: " + e;
|
|
6
|
+
throw Error("[Immer] " + i);
|
|
7
|
+
}
|
|
8
|
+
throw Error("[Immer] minified error nr: " + e + (r.length ? " " + r.map(function(u) {
|
|
9
|
+
return "'" + u + "'";
|
|
10
|
+
}).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
|
|
11
|
+
}
|
|
12
|
+
function O(e) {
|
|
13
|
+
return !!e && !!e[p];
|
|
14
|
+
}
|
|
15
|
+
function b(e) {
|
|
16
|
+
var t;
|
|
17
|
+
return !!e && (function(r) {
|
|
18
|
+
if (!r || typeof r != "object")
|
|
19
|
+
return !1;
|
|
20
|
+
var n = Object.getPrototypeOf(r);
|
|
21
|
+
if (n === null)
|
|
22
|
+
return !0;
|
|
23
|
+
var o = Object.hasOwnProperty.call(n, "constructor") && n.constructor;
|
|
24
|
+
return o === Object || typeof o == "function" && Function.toString.call(o) === he;
|
|
25
|
+
}(e) || Array.isArray(e) || !!e[ne] || !!(!((t = e.constructor) === null || t === void 0) && t[ne]) || V(e) || U(e));
|
|
26
|
+
}
|
|
27
|
+
function S(e, t, r) {
|
|
28
|
+
r === void 0 && (r = !1), w(e) === 0 ? (r ? Object.keys : q)(e).forEach(function(n) {
|
|
29
|
+
r && typeof n == "symbol" || t(n, e[n], e);
|
|
30
|
+
}) : e.forEach(function(n, o) {
|
|
31
|
+
return t(o, n, e);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function w(e) {
|
|
35
|
+
var t = e[p];
|
|
36
|
+
return t ? t.i > 3 ? t.i - 4 : t.i : Array.isArray(e) ? 1 : V(e) ? 2 : U(e) ? 3 : 0;
|
|
37
|
+
}
|
|
38
|
+
function F(e, t) {
|
|
39
|
+
return w(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
40
|
+
}
|
|
41
|
+
function fe(e, t) {
|
|
42
|
+
return w(e) === 2 ? e.get(t) : e[t];
|
|
43
|
+
}
|
|
44
|
+
function oe(e, t, r) {
|
|
45
|
+
var n = w(e);
|
|
46
|
+
n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
|
|
47
|
+
}
|
|
48
|
+
function ce(e, t) {
|
|
49
|
+
return e === t ? e !== 0 || 1 / e == 1 / t : e != e && t != t;
|
|
50
|
+
}
|
|
51
|
+
function V(e) {
|
|
52
|
+
return de && e instanceof Map;
|
|
53
|
+
}
|
|
54
|
+
function U(e) {
|
|
55
|
+
return ye && e instanceof Set;
|
|
56
|
+
}
|
|
57
|
+
function m(e) {
|
|
58
|
+
return e.o || e.t;
|
|
59
|
+
}
|
|
60
|
+
function W(e) {
|
|
61
|
+
if (Array.isArray(e))
|
|
62
|
+
return Array.prototype.slice.call(e);
|
|
63
|
+
var t = me(e);
|
|
64
|
+
delete t[p];
|
|
65
|
+
for (var r = q(t), n = 0; n < r.length; n++) {
|
|
66
|
+
var o = r[n], i = t[o];
|
|
67
|
+
i.writable === !1 && (i.writable = !0, i.configurable = !0), (i.get || i.set) && (t[o] = { configurable: !0, writable: !0, enumerable: i.enumerable, value: e[o] });
|
|
68
|
+
}
|
|
69
|
+
return Object.create(Object.getPrototypeOf(e), t);
|
|
70
|
+
}
|
|
71
|
+
function $(e, t) {
|
|
72
|
+
return t === void 0 && (t = !1), G(e) || O(e) || !b(e) || (w(e) > 1 && (e.set = e.add = e.clear = e.delete = se), Object.freeze(e), t && S(e, function(r, n) {
|
|
73
|
+
return $(n, !0);
|
|
74
|
+
}, !0)), e;
|
|
75
|
+
}
|
|
76
|
+
function se() {
|
|
77
|
+
s(2);
|
|
78
|
+
}
|
|
79
|
+
function G(e) {
|
|
80
|
+
return e == null || typeof e != "object" || Object.isFrozen(e);
|
|
81
|
+
}
|
|
82
|
+
function v(e) {
|
|
83
|
+
var t = be[e];
|
|
84
|
+
return t || s(18, e), t;
|
|
85
|
+
}
|
|
86
|
+
function Q() {
|
|
87
|
+
return process.env.NODE_ENV === "production" || P || s(0), P;
|
|
88
|
+
}
|
|
89
|
+
function k(e, t) {
|
|
90
|
+
t && (v("Patches"), e.u = [], e.s = [], e.v = t);
|
|
91
|
+
}
|
|
92
|
+
function j(e) {
|
|
93
|
+
M(e), e.p.forEach(le), e.p = null;
|
|
94
|
+
}
|
|
95
|
+
function M(e) {
|
|
96
|
+
e === P && (P = e.l);
|
|
97
|
+
}
|
|
98
|
+
function Y(e) {
|
|
99
|
+
return P = { p: [], l: P, h: e, m: !0, _: 0 };
|
|
100
|
+
}
|
|
101
|
+
function le(e) {
|
|
102
|
+
var t = e[p];
|
|
103
|
+
t.i === 0 || t.i === 1 ? t.j() : t.g = !0;
|
|
104
|
+
}
|
|
105
|
+
function A(e, t) {
|
|
106
|
+
t._ = t.p.length;
|
|
107
|
+
var r = t.p[0], n = e !== void 0 && e !== r;
|
|
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;
|
|
109
|
+
}
|
|
110
|
+
function I(e, t, r) {
|
|
111
|
+
if (G(t))
|
|
112
|
+
return t;
|
|
113
|
+
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;
|
|
122
|
+
if (!n.I) {
|
|
123
|
+
n.I = !0, n.A._--;
|
|
124
|
+
var o = n.i === 4 || n.i === 5 ? n.o = W(n.k) : n.o, i = o, u = !1;
|
|
125
|
+
n.i === 3 && (i = new Set(o), o.clear(), u = !0), S(i, function(a, c) {
|
|
126
|
+
return Z(e, n, o, a, c, r, u);
|
|
127
|
+
}), _(e, o, !1), r && e.u && v("Patches").N(n, r, e.u, e.s);
|
|
128
|
+
}
|
|
129
|
+
return n.o;
|
|
130
|
+
}
|
|
131
|
+
function Z(e, t, r, n, o, i, u) {
|
|
132
|
+
if (process.env.NODE_ENV !== "production" && o === r && s(5), O(o)) {
|
|
133
|
+
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;
|
|
136
|
+
e.m = !1;
|
|
137
|
+
} else
|
|
138
|
+
u && r.add(o);
|
|
139
|
+
if (b(o) && !G(o)) {
|
|
140
|
+
if (!e.h.D && e._ < 1)
|
|
141
|
+
return;
|
|
142
|
+
I(e, o), t && t.A.l || _(e, o);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function _(e, t, r) {
|
|
146
|
+
r === void 0 && (r = !1), !e.l && e.h.D && e.m && $(t, r);
|
|
147
|
+
}
|
|
148
|
+
function z(e, t) {
|
|
149
|
+
var r = e[p];
|
|
150
|
+
return (r ? m(r) : e)[t];
|
|
151
|
+
}
|
|
152
|
+
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
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function T(e) {
|
|
162
|
+
e.P || (e.P = !0, e.l && T(e.l));
|
|
163
|
+
}
|
|
164
|
+
function R(e) {
|
|
165
|
+
e.o || (e.o = W(e.t));
|
|
166
|
+
}
|
|
167
|
+
function C(e, t, r) {
|
|
168
|
+
var n = V(t) ? v("MapSet").F(t, r) : U(t) ? v("MapSet").T(t, r) : e.O ? function(o, i) {
|
|
169
|
+
var u = Array.isArray(o), a = { i: u ? 1 : 0, A: i ? i.A : Q(), P: !1, I: !1, R: {}, l: i, t: o, k: null, o: null, j: null, C: !1 }, c = a, f = K;
|
|
170
|
+
u && (c = [a], f = N);
|
|
171
|
+
var l = Proxy.revocable(c, f), g = l.revoke, y = l.proxy;
|
|
172
|
+
return a.k = y, a.j = g, y;
|
|
173
|
+
}(t, r) : v("ES5").J(t, r);
|
|
174
|
+
return (r ? r.A : Q()).p.push(n), n;
|
|
175
|
+
}
|
|
176
|
+
function pe(e) {
|
|
177
|
+
return O(e) || s(22, e), function t(r) {
|
|
178
|
+
if (!b(r))
|
|
179
|
+
return r;
|
|
180
|
+
var n, o = r[p], i = w(r);
|
|
181
|
+
if (o) {
|
|
182
|
+
if (!o.P && (o.i < 4 || !v("ES5").K(o)))
|
|
183
|
+
return o.t;
|
|
184
|
+
o.I = !0, n = ee(r, i), o.I = !1;
|
|
185
|
+
} else
|
|
186
|
+
n = ee(r, i);
|
|
187
|
+
return S(n, function(u, a) {
|
|
188
|
+
o && fe(o.t, u) === a || oe(n, u, t(a));
|
|
189
|
+
}), i === 3 ? new Set(n) : n;
|
|
190
|
+
}(e);
|
|
191
|
+
}
|
|
192
|
+
function ee(e, t) {
|
|
193
|
+
switch (t) {
|
|
194
|
+
case 2:
|
|
195
|
+
return new Map(e);
|
|
196
|
+
case 3:
|
|
197
|
+
return Array.from(e);
|
|
198
|
+
}
|
|
199
|
+
return W(e);
|
|
200
|
+
}
|
|
201
|
+
var te, P, X = typeof Symbol < "u" && typeof Symbol("x") == "symbol", de = typeof Map < "u", ye = typeof Set < "u", re = typeof Proxy < "u" && Proxy.revocable !== void 0 && typeof Reflect < "u", ie = X ? Symbol.for("immer-nothing") : ((te = {})["immer-nothing"] = !0, te), ne = X ? Symbol.for("immer-draftable") : "__$immer_draftable", p = X ? Symbol.for("immer-state") : "__$immer_state", ve = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function(e) {
|
|
202
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
203
|
+
}, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function(e) {
|
|
204
|
+
return "Cannot apply patch, path doesn't resolve: " + e;
|
|
205
|
+
}, 16: 'Sets cannot have "replace" patches.', 17: function(e) {
|
|
206
|
+
return "Unsupported patch operation: " + e;
|
|
207
|
+
}, 18: function(e) {
|
|
208
|
+
return "The plugin for '" + e + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + e + "()` when initializing your application.";
|
|
209
|
+
}, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function(e) {
|
|
210
|
+
return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + e + "'";
|
|
211
|
+
}, 22: function(e) {
|
|
212
|
+
return "'current' expects a draft, got: " + e;
|
|
213
|
+
}, 23: function(e) {
|
|
214
|
+
return "'original' expects a draft, got: " + e;
|
|
215
|
+
}, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" }, he = "" + Object.prototype.constructor, q = typeof Reflect < "u" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(e) {
|
|
216
|
+
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
217
|
+
} : Object.getOwnPropertyNames, me = Object.getOwnPropertyDescriptors || function(e) {
|
|
218
|
+
var t = {};
|
|
219
|
+
return q(e).forEach(function(r) {
|
|
220
|
+
t[r] = Object.getOwnPropertyDescriptor(e, r);
|
|
221
|
+
}), t;
|
|
222
|
+
}, be = {}, K = { get: function(e, t) {
|
|
223
|
+
if (t === p)
|
|
224
|
+
return e;
|
|
225
|
+
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);
|
|
231
|
+
var n = r[t];
|
|
232
|
+
return e.I || !b(n) ? n : n === z(e.t, t) ? (R(e), e.o[t] = C(e.A.h, n, e)) : n;
|
|
233
|
+
}, has: function(e, t) {
|
|
234
|
+
return t in m(e);
|
|
235
|
+
}, ownKeys: function(e) {
|
|
236
|
+
return Reflect.ownKeys(m(e));
|
|
237
|
+
}, set: function(e, t, r) {
|
|
238
|
+
var n = B(m(e), t);
|
|
239
|
+
if (n?.set)
|
|
240
|
+
return n.set.call(e.k, r), !0;
|
|
241
|
+
if (!e.P) {
|
|
242
|
+
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;
|
|
247
|
+
R(e), T(e);
|
|
248
|
+
}
|
|
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;
|
|
250
|
+
}, deleteProperty: function(e, t) {
|
|
251
|
+
return z(e.t, t) !== void 0 || t in e.t ? (e.R[t] = !1, R(e), T(e)) : delete e.R[t], e.o && delete e.o[t], !0;
|
|
252
|
+
}, getOwnPropertyDescriptor: function(e, t) {
|
|
253
|
+
var r = m(e), n = Reflect.getOwnPropertyDescriptor(r, t);
|
|
254
|
+
return n && { writable: !0, configurable: e.i !== 1 || t !== "length", enumerable: n.enumerable, value: r[t] };
|
|
255
|
+
}, defineProperty: function() {
|
|
256
|
+
s(11);
|
|
257
|
+
}, getPrototypeOf: function(e) {
|
|
258
|
+
return Object.getPrototypeOf(e.t);
|
|
259
|
+
}, setPrototypeOf: function() {
|
|
260
|
+
s(12);
|
|
261
|
+
} }, N = {};
|
|
262
|
+
S(K, function(e, t) {
|
|
263
|
+
N[e] = function() {
|
|
264
|
+
return arguments[0] = arguments[0][0], t.apply(this, arguments);
|
|
265
|
+
};
|
|
266
|
+
}), N.deleteProperty = function(e, t) {
|
|
267
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && s(13), N.set.call(this, e, t, void 0);
|
|
268
|
+
}, N.set = function(e, t, r) {
|
|
269
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && s(14), K.set.call(this, e[0], t, r, e[0]);
|
|
270
|
+
};
|
|
271
|
+
var ge = function() {
|
|
272
|
+
function e(r) {
|
|
273
|
+
var n = this;
|
|
274
|
+
this.O = re, this.D = !0, this.produce = function(o, i, u) {
|
|
275
|
+
if (typeof o == "function" && typeof i != "function") {
|
|
276
|
+
var a = i;
|
|
277
|
+
i = o;
|
|
278
|
+
var c = n;
|
|
279
|
+
return function(h) {
|
|
280
|
+
var ue = this;
|
|
281
|
+
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];
|
|
284
|
+
return c.produce(h, function(ae) {
|
|
285
|
+
var L;
|
|
286
|
+
return (L = i).call.apply(L, [ue, ae].concat(J));
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
var f;
|
|
291
|
+
if (typeof i != "function" && s(6), u !== void 0 && typeof u != "function" && s(7), b(o)) {
|
|
292
|
+
var l = Y(n), g = C(n, o, void 0), y = !0;
|
|
293
|
+
try {
|
|
294
|
+
f = i(g), y = !1;
|
|
295
|
+
} finally {
|
|
296
|
+
y ? j(l) : M(l);
|
|
297
|
+
}
|
|
298
|
+
return typeof Promise < "u" && f instanceof Promise ? f.then(function(h) {
|
|
299
|
+
return k(l, u), A(h, l);
|
|
300
|
+
}, function(h) {
|
|
301
|
+
throw j(l), h;
|
|
302
|
+
}) : (k(l, u), A(f, l));
|
|
303
|
+
}
|
|
304
|
+
if (!o || typeof o != "object") {
|
|
305
|
+
if ((f = i(o)) === void 0 && (f = o), f === ie && (f = void 0), n.D && $(f, !0), u) {
|
|
306
|
+
var D = [], H = [];
|
|
307
|
+
v("Patches").M(o, f, D, H), u(D, H);
|
|
308
|
+
}
|
|
309
|
+
return f;
|
|
310
|
+
}
|
|
311
|
+
s(21, o);
|
|
312
|
+
}, 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
|
+
};
|
|
321
|
+
var u, a, c = n.produce(o, i, function(f, l) {
|
|
322
|
+
u = f, a = l;
|
|
323
|
+
});
|
|
324
|
+
return typeof Promise < "u" && c instanceof Promise ? c.then(function(f) {
|
|
325
|
+
return [f, u, a];
|
|
326
|
+
}) : [c, u, a];
|
|
327
|
+
}, typeof r?.useProxies == "boolean" && this.setUseProxies(r.useProxies), typeof r?.autoFreeze == "boolean" && this.setAutoFreeze(r.autoFreeze);
|
|
328
|
+
}
|
|
329
|
+
var t = e.prototype;
|
|
330
|
+
return t.createDraft = function(r) {
|
|
331
|
+
b(r) || s(8), O(r) && (r = pe(r));
|
|
332
|
+
var n = Y(this), o = C(this, r, void 0);
|
|
333
|
+
return o[p].C = !0, M(n), o;
|
|
334
|
+
}, t.finishDraft = function(r, n) {
|
|
335
|
+
var o = r && r[p];
|
|
336
|
+
process.env.NODE_ENV !== "production" && (o && o.C || s(9), o.I && s(10));
|
|
337
|
+
var i = o.A;
|
|
338
|
+
return k(i, n), A(void 0, i);
|
|
339
|
+
}, t.setAutoFreeze = function(r) {
|
|
340
|
+
this.D = r;
|
|
341
|
+
}, t.setUseProxies = function(r) {
|
|
342
|
+
r && !re && s(20), this.O = r;
|
|
343
|
+
}, t.applyPatches = function(r, n) {
|
|
344
|
+
var o;
|
|
345
|
+
for (o = n.length - 1; o >= 0; o--) {
|
|
346
|
+
var i = n[o];
|
|
347
|
+
if (i.path.length === 0 && i.op === "replace") {
|
|
348
|
+
r = i.value;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
o > -1 && (n = n.slice(o + 1));
|
|
353
|
+
var u = v("Patches").$;
|
|
354
|
+
return O(r) ? u(r, n) : this.produce(r, function(a) {
|
|
355
|
+
return u(a, n);
|
|
356
|
+
});
|
|
357
|
+
}, e;
|
|
358
|
+
}(), d = new ge(), Oe = d.produce;
|
|
359
|
+
d.produceWithPatches.bind(d);
|
|
360
|
+
d.setAutoFreeze.bind(d);
|
|
361
|
+
d.setUseProxies.bind(d);
|
|
362
|
+
d.applyPatches.bind(d);
|
|
363
|
+
d.createDraft.bind(d);
|
|
364
|
+
d.finishDraft.bind(d);
|
|
365
|
+
const Pe = (e) => (t, r, n) => (n.setState = (o, i, ...u) => {
|
|
366
|
+
const a = typeof o == "function" ? Oe(o) : o;
|
|
367
|
+
return t(a, i, ...u);
|
|
368
|
+
}, e(n.setState, r, n)), we = Pe;
|
|
369
|
+
function Ne(e, t) {
|
|
370
|
+
if (Object.is(e, t))
|
|
371
|
+
return !0;
|
|
372
|
+
if (typeof e != "object" || e === null || typeof t != "object" || t === null)
|
|
373
|
+
return !1;
|
|
374
|
+
if (e instanceof Map && t instanceof Map) {
|
|
375
|
+
if (e.size !== t.size)
|
|
376
|
+
return !1;
|
|
377
|
+
for (const [n, o] of e)
|
|
378
|
+
if (!Object.is(o, t.get(n)))
|
|
379
|
+
return !1;
|
|
380
|
+
return !0;
|
|
381
|
+
}
|
|
382
|
+
if (e instanceof Set && t instanceof Set) {
|
|
383
|
+
if (e.size !== t.size)
|
|
384
|
+
return !1;
|
|
385
|
+
for (const n of e)
|
|
386
|
+
if (!t.has(n))
|
|
387
|
+
return !1;
|
|
388
|
+
return !0;
|
|
389
|
+
}
|
|
390
|
+
const r = Object.keys(e);
|
|
391
|
+
if (r.length !== Object.keys(t).length)
|
|
392
|
+
return !1;
|
|
393
|
+
for (let n = 0; n < r.length; n++)
|
|
394
|
+
if (!Object.prototype.hasOwnProperty.call(t, r[n]) || !Object.is(e[r[n]], t[r[n]]))
|
|
395
|
+
return !1;
|
|
396
|
+
return !0;
|
|
397
|
+
}
|
|
398
|
+
export {
|
|
399
|
+
we as i,
|
|
400
|
+
Ne as s
|
|
401
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
6
|
"private": false,
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"camelcase-keys": "^7.0.1",
|
|
34
|
-
"snakecase-keys": "5.1.2"
|
|
34
|
+
"snakecase-keys": "5.1.2",
|
|
35
|
+
"zustand": "4.3.6",
|
|
36
|
+
"immer": "^9.0.21"
|
|
35
37
|
}
|
|
36
38
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import "axios";
|
|
2
|
+
import "qs";
|
|
3
|
+
import "camelcase-keys";
|
|
4
|
+
import "snakecase-keys";
|
|
5
|
+
function y() {
|
|
2
6
|
}
|
|
3
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
m as a,
|
|
61
|
+
d as e,
|
|
62
|
+
p as g,
|
|
63
|
+
v as s,
|
|
64
|
+
y as v
|
|
61
65
|
};
|
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,57 +0,0 @@
|
|
|
1
|
-
import { createContext as f, useState as l, useEffect as p } from "react";
|
|
2
|
-
import { u as D } from "../../hooks/useFlags/index.a986729d.js";
|
|
3
|
-
import { u as v } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
4
|
-
import { u as y } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
5
|
-
import { C as r } from "../../types/index.42c24946.js";
|
|
6
|
-
import { jsx as $ } from "react/jsx-runtime";
|
|
7
|
-
const h = f(null);
|
|
8
|
-
function x(i) {
|
|
9
|
-
const {
|
|
10
|
-
children: _
|
|
11
|
-
} = i, {
|
|
12
|
-
domain_token: c,
|
|
13
|
-
host_static_assets: o,
|
|
14
|
-
environment_assets: n
|
|
15
|
-
} = v(), {
|
|
16
|
-
addFlag: s
|
|
17
|
-
} = D(), [u, t] = l(!1), [d, m] = l({
|
|
18
|
-
company_logo_small_url: "",
|
|
19
|
-
company_logo_normal_url: "",
|
|
20
|
-
name: "",
|
|
21
|
-
slogan: ""
|
|
22
|
-
}), {
|
|
23
|
-
networkOperation: g
|
|
24
|
-
} = y();
|
|
25
|
-
return p(() => {
|
|
26
|
-
let e = !0;
|
|
27
|
-
return g({
|
|
28
|
-
method: "GET",
|
|
29
|
-
endPoint: `na/info/${c}`
|
|
30
|
-
}).then((a) => {
|
|
31
|
-
e && (m({
|
|
32
|
-
...a.data,
|
|
33
|
-
company_logo_normal_url: a.data.company_logo_normal_url ?? `${o}/${n}/frontend/commons/assets/icons/isologo.svg`,
|
|
34
|
-
company_logo_small_url: a.data.company_logo_small_url ?? `${o}/${n}/frontend/commons/assets/icons/isotipo_m4l.svg`
|
|
35
|
-
}), s(r.FLAG_DOMAIN_LOADED), t(!0));
|
|
36
|
-
}).catch(() => {
|
|
37
|
-
m({
|
|
38
|
-
company_logo_normal_url: `${o}/${n}/frontend/commons/assets/icons/isologo.svg`,
|
|
39
|
-
company_logo_small_url: `${o}/${n}/frontend/commons/assets/icons/isotipo_m4l.svg`,
|
|
40
|
-
name: "Pending",
|
|
41
|
-
slogan: "Pending"
|
|
42
|
-
}), s(r.FLAG_DOMAIN_LOADED), t(!0);
|
|
43
|
-
}).finally(() => {
|
|
44
|
-
}), function() {
|
|
45
|
-
e = !1;
|
|
46
|
-
};
|
|
47
|
-
}, []), /* @__PURE__ */ $(h.Provider, {
|
|
48
|
-
value: {
|
|
49
|
-
...d
|
|
50
|
-
},
|
|
51
|
-
children: u && _
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
export {
|
|
55
|
-
h as D,
|
|
56
|
-
x as a
|
|
57
|
-
};
|
|
@@ -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.42c24946.js";
|
|
3
|
-
import { jsx as f } from "react/jsx-runtime";
|
|
4
|
-
import { u as D } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
5
|
-
import { u as M } from "../../hooks/usePropageteMF/index.c440b829.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,24 +0,0 @@
|
|
|
1
|
-
import { createContext as i, useState as l, useCallback as a } from "react";
|
|
2
|
-
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
-
const x = i(null);
|
|
4
|
-
function g({
|
|
5
|
-
children: n
|
|
6
|
-
}) {
|
|
7
|
-
const [s, r] = l([]), o = a(() => {
|
|
8
|
-
r([]);
|
|
9
|
-
}, []), c = a((e) => {
|
|
10
|
-
r((t) => t.findIndex((u) => u === e) < 0 ? [...t, e] : [...t]);
|
|
11
|
-
}, []);
|
|
12
|
-
return /* @__PURE__ */ f(x.Provider, {
|
|
13
|
-
value: {
|
|
14
|
-
flags: s,
|
|
15
|
-
addFlag: c,
|
|
16
|
-
clearFlags: o
|
|
17
|
-
},
|
|
18
|
-
children: n
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
x as F,
|
|
23
|
-
g as a
|
|
24
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { createContext as y, useState as F, useEffect as L, useCallback as u } from "react";
|
|
2
|
-
import { C as M } from "../../types/index.42c24946.js";
|
|
3
|
-
import { jsx as N } from "react/jsx-runtime";
|
|
4
|
-
import { u as P } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
|
-
import { u as _ } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
6
|
-
import { u as x } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
7
|
-
import { u as A } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
8
|
-
const E = y(null);
|
|
9
|
-
function j(l) {
|
|
10
|
-
const {
|
|
11
|
-
children: c,
|
|
12
|
-
componentsDictionary: m,
|
|
13
|
-
moduleId: i,
|
|
14
|
-
moduleNameField: s = "module_name",
|
|
15
|
-
currentLang: d = "en",
|
|
16
|
-
isAuth: a = !0
|
|
17
|
-
} = l, {
|
|
18
|
-
addFlag: f
|
|
19
|
-
} = P(), [e, p] = F(void 0), {
|
|
20
|
-
domain_token: g
|
|
21
|
-
} = _(), {
|
|
22
|
-
startProgress: D,
|
|
23
|
-
stopProgress: h
|
|
24
|
-
} = x(), {
|
|
25
|
-
networkOperation: v
|
|
26
|
-
} = A();
|
|
27
|
-
L(() => {
|
|
28
|
-
let t = !0;
|
|
29
|
-
return D(), v({
|
|
30
|
-
method: "GET",
|
|
31
|
-
endPoint: a ? `dictionaries/${i}` : `na/dictionaries/${i}`,
|
|
32
|
-
parms: {
|
|
33
|
-
comps: m,
|
|
34
|
-
...a ? {} : {
|
|
35
|
-
domain_token: g
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}).then((o) => {
|
|
39
|
-
t && (p({
|
|
40
|
-
...o
|
|
41
|
-
}), f(M.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)
|
|
50
|
-
return "";
|
|
51
|
-
if (t === "")
|
|
52
|
-
return "No key";
|
|
53
|
-
let o;
|
|
54
|
-
const r = t.split(".");
|
|
55
|
-
try {
|
|
56
|
-
r.length === 1 && (o = e.data[t]), r.length === 2 && (o = e[r[0]][r[1]]);
|
|
57
|
-
} catch {
|
|
58
|
-
}
|
|
59
|
-
return o || `N_D:[${t}]`;
|
|
60
|
-
}, [e]), C = u(() => n(s), [s, n]);
|
|
61
|
-
return /* @__PURE__ */ N(E.Provider, {
|
|
62
|
-
value: {
|
|
63
|
-
moduleDictionary: e,
|
|
64
|
-
getLabel: n,
|
|
65
|
-
getModuleLabel: C
|
|
66
|
-
},
|
|
67
|
-
children: c
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
E as M,
|
|
72
|
-
j as a
|
|
73
|
-
};
|