@jsdev_ninja/core 0.13.26 → 0.13.28
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/dist/core.cjs.js +1 -1
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.es.js +149 -145
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/Order.d.ts +3 -0
- package/dist/lib/entities/Order.d.ts.map +1 -1
- package/dist/lib/entities/Order.js +1 -0
- package/dist/lib/entities/Store.d.ts +46 -0
- package/dist/lib/entities/Store.d.ts.map +1 -1
- package/dist/lib/entities/Store.js +3 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +9 -2
- package/eslint.config.js +0 -28
- package/index.html +0 -13
- package/lib/entities/Address.ts +0 -13
- package/lib/entities/Atoms.ts +0 -11
- package/lib/entities/Cart.ts +0 -24
- package/lib/entities/Category.ts +0 -35
- package/lib/entities/Company.ts +0 -9
- package/lib/entities/DeliveryNote.ts +0 -70
- package/lib/entities/Discount/__tests__/engine.test.ts +0 -337
- package/lib/entities/Discount/__tests__/factory.test.ts +0 -91
- package/lib/entities/Discount/__tests__/integration.test.ts +0 -132
- package/lib/entities/Discount/__tests__/simple.test.ts +0 -215
- package/lib/entities/Discount/__tests__/utils.test.ts +0 -69
- package/lib/entities/Discount/engine.ts +0 -138
- package/lib/entities/Discount/factory.ts +0 -25
- package/lib/entities/Discount/index.ts +0 -10
- package/lib/entities/Discount/strategies/BundleStrategy.ts +0 -119
- package/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.ts +0 -295
- package/lib/entities/Discount/strategy.ts +0 -6
- package/lib/entities/Discount/types.ts +0 -68
- package/lib/entities/Discount/utils.ts +0 -42
- package/lib/entities/FavoriteProduct.ts +0 -12
- package/lib/entities/Invoice.ts +0 -57
- package/lib/entities/Locale.ts +0 -8
- package/lib/entities/Order.ts +0 -66
- package/lib/entities/Organization.ts +0 -23
- package/lib/entities/Product.ts +0 -68
- package/lib/entities/Profile.ts +0 -56
- package/lib/entities/Store.ts +0 -23
- package/lib/entities/index.ts +0 -14
- package/lib/firebase-api/app.ts +0 -18
- package/lib/firebase-api/index.ts +0 -46
- package/lib/index.tsx +0 -3
- package/lib/utils/index.ts +0 -127
- package/src/main.tsx +0 -1
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -20
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -27
- package/vitest.config.ts +0 -10
package/dist/core.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Re = (n, e, t) =>
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var ot = (n, e, t) => e in n ? it(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var Re = (n, e, t) => ot(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
var x;
|
|
5
5
|
(function(n) {
|
|
6
6
|
n.assertEqual = (s) => s;
|
|
@@ -104,8 +104,8 @@ const f = x.arrayToEnum([
|
|
|
104
104
|
"invalid_intersection_types",
|
|
105
105
|
"not_multiple_of",
|
|
106
106
|
"not_finite"
|
|
107
|
-
]),
|
|
108
|
-
class
|
|
107
|
+
]), ct = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
108
|
+
class N extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
111
111
|
}
|
|
@@ -142,7 +142,7 @@ class S extends Error {
|
|
|
142
142
|
return s(this), r;
|
|
143
143
|
}
|
|
144
144
|
static assert(e) {
|
|
145
|
-
if (!(e instanceof
|
|
145
|
+
if (!(e instanceof N))
|
|
146
146
|
throw new Error(`Not a ZodError: ${e}`);
|
|
147
147
|
}
|
|
148
148
|
toString() {
|
|
@@ -164,7 +164,7 @@ class S extends Error {
|
|
|
164
164
|
return this.flatten();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
N.create = (n) => new N(n);
|
|
168
168
|
const X = (n, e) => {
|
|
169
169
|
let t;
|
|
170
170
|
switch (n.code) {
|
|
@@ -222,7 +222,7 @@ const X = (n, e) => {
|
|
|
222
222
|
return { message: t };
|
|
223
223
|
};
|
|
224
224
|
let Fe = X;
|
|
225
|
-
function
|
|
225
|
+
function dt(n) {
|
|
226
226
|
Fe = n;
|
|
227
227
|
}
|
|
228
228
|
function ve() {
|
|
@@ -248,7 +248,7 @@ const _e = (n) => {
|
|
|
248
248
|
path: a,
|
|
249
249
|
message: c
|
|
250
250
|
};
|
|
251
|
-
},
|
|
251
|
+
}, ut = [];
|
|
252
252
|
function m(n, e) {
|
|
253
253
|
const t = ve(), r = _e({
|
|
254
254
|
issueData: e,
|
|
@@ -342,7 +342,7 @@ const Me = (n, e) => {
|
|
|
342
342
|
get error() {
|
|
343
343
|
if (this._error)
|
|
344
344
|
return this._error;
|
|
345
|
-
const t = new
|
|
345
|
+
const t = new N(n.common.issues);
|
|
346
346
|
return this._error = t, this._error;
|
|
347
347
|
}
|
|
348
348
|
};
|
|
@@ -579,14 +579,14 @@ class _ {
|
|
|
579
579
|
return this.safeParse(null).success;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
let
|
|
584
|
-
const
|
|
582
|
+
const lt = /^c[^\s-]{8,}$/i, mt = /^[0-9a-z]+$/, ft = /^[0-9A-HJKMNP-TV-Z]{26}$/i, pt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ht = /^[a-z0-9_-]{21}$/i, gt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, yt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, vt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _t = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
|
+
let Se;
|
|
584
|
+
const bt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, xt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, kt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, wt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Tt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, It = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ue = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", At = new RegExp(`^${Ue}$`);
|
|
585
585
|
function Le(n) {
|
|
586
586
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
587
587
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function Nt(n) {
|
|
590
590
|
return new RegExp(`^${Le(n)}$`);
|
|
591
591
|
}
|
|
592
592
|
function qe(n) {
|
|
@@ -595,10 +595,10 @@ function qe(n) {
|
|
|
595
595
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
596
596
|
}
|
|
597
597
|
function St(n, e) {
|
|
598
|
-
return !!((e === "v4" || !e) &&
|
|
598
|
+
return !!((e === "v4" || !e) && bt.test(n) || (e === "v6" || !e) && kt.test(n));
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
if (!
|
|
600
|
+
function Ct(n, e) {
|
|
601
|
+
if (!gt.test(n))
|
|
602
602
|
return !1;
|
|
603
603
|
try {
|
|
604
604
|
const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
|
|
@@ -607,10 +607,10 @@ function Nt(n, e) {
|
|
|
607
607
|
return !1;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return !!((e === "v4" || !e) &&
|
|
610
|
+
function Zt(n, e) {
|
|
611
|
+
return !!((e === "v4" || !e) && xt.test(n) || (e === "v6" || !e) && wt.test(n));
|
|
612
612
|
}
|
|
613
|
-
class
|
|
613
|
+
class S extends _ {
|
|
614
614
|
_parse(e) {
|
|
615
615
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
616
616
|
const a = this._getOrReturnCtx(e);
|
|
@@ -659,43 +659,43 @@ class N extends _ {
|
|
|
659
659
|
message: a.message
|
|
660
660
|
}), r.dirty());
|
|
661
661
|
} else if (a.kind === "email")
|
|
662
|
-
|
|
662
|
+
vt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
663
663
|
validation: "email",
|
|
664
664
|
code: u.invalid_string,
|
|
665
665
|
message: a.message
|
|
666
666
|
}), r.dirty());
|
|
667
667
|
else if (a.kind === "emoji")
|
|
668
|
-
|
|
668
|
+
Se || (Se = new RegExp(_t, "u")), Se.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
669
669
|
validation: "emoji",
|
|
670
670
|
code: u.invalid_string,
|
|
671
671
|
message: a.message
|
|
672
672
|
}), r.dirty());
|
|
673
673
|
else if (a.kind === "uuid")
|
|
674
|
-
|
|
674
|
+
pt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
675
675
|
validation: "uuid",
|
|
676
676
|
code: u.invalid_string,
|
|
677
677
|
message: a.message
|
|
678
678
|
}), r.dirty());
|
|
679
679
|
else if (a.kind === "nanoid")
|
|
680
|
-
|
|
680
|
+
ht.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
681
681
|
validation: "nanoid",
|
|
682
682
|
code: u.invalid_string,
|
|
683
683
|
message: a.message
|
|
684
684
|
}), r.dirty());
|
|
685
685
|
else if (a.kind === "cuid")
|
|
686
|
-
|
|
686
|
+
lt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
687
687
|
validation: "cuid",
|
|
688
688
|
code: u.invalid_string,
|
|
689
689
|
message: a.message
|
|
690
690
|
}), r.dirty());
|
|
691
691
|
else if (a.kind === "cuid2")
|
|
692
|
-
|
|
692
|
+
mt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
693
693
|
validation: "cuid2",
|
|
694
694
|
code: u.invalid_string,
|
|
695
695
|
message: a.message
|
|
696
696
|
}), r.dirty());
|
|
697
697
|
else if (a.kind === "ulid")
|
|
698
|
-
|
|
698
|
+
ft.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
699
699
|
validation: "ulid",
|
|
700
700
|
code: u.invalid_string,
|
|
701
701
|
message: a.message
|
|
@@ -730,15 +730,15 @@ class N extends _ {
|
|
|
730
730
|
code: u.invalid_string,
|
|
731
731
|
validation: "datetime",
|
|
732
732
|
message: a.message
|
|
733
|
-
}), r.dirty()) : a.kind === "date" ?
|
|
733
|
+
}), r.dirty()) : a.kind === "date" ? At.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
734
734
|
code: u.invalid_string,
|
|
735
735
|
validation: "date",
|
|
736
736
|
message: a.message
|
|
737
|
-
}), r.dirty()) : a.kind === "time" ?
|
|
737
|
+
}), r.dirty()) : a.kind === "time" ? Nt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
738
738
|
code: u.invalid_string,
|
|
739
739
|
validation: "time",
|
|
740
740
|
message: a.message
|
|
741
|
-
}), r.dirty()) : a.kind === "duration" ?
|
|
741
|
+
}), r.dirty()) : a.kind === "duration" ? yt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
742
742
|
validation: "duration",
|
|
743
743
|
code: u.invalid_string,
|
|
744
744
|
message: a.message
|
|
@@ -746,19 +746,19 @@ class N extends _ {
|
|
|
746
746
|
validation: "ip",
|
|
747
747
|
code: u.invalid_string,
|
|
748
748
|
message: a.message
|
|
749
|
-
}), r.dirty()) : a.kind === "jwt" ?
|
|
749
|
+
}), r.dirty()) : a.kind === "jwt" ? Ct(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
750
750
|
validation: "jwt",
|
|
751
751
|
code: u.invalid_string,
|
|
752
752
|
message: a.message
|
|
753
|
-
}), r.dirty()) : a.kind === "cidr" ?
|
|
753
|
+
}), r.dirty()) : a.kind === "cidr" ? Zt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
754
754
|
validation: "cidr",
|
|
755
755
|
code: u.invalid_string,
|
|
756
756
|
message: a.message
|
|
757
|
-
}), r.dirty()) : a.kind === "base64" ?
|
|
757
|
+
}), r.dirty()) : a.kind === "base64" ? Tt.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
758
758
|
validation: "base64",
|
|
759
759
|
code: u.invalid_string,
|
|
760
760
|
message: a.message
|
|
761
|
-
}), r.dirty()) : a.kind === "base64url" ?
|
|
761
|
+
}), r.dirty()) : a.kind === "base64url" ? It.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
762
762
|
validation: "base64url",
|
|
763
763
|
code: u.invalid_string,
|
|
764
764
|
message: a.message
|
|
@@ -773,7 +773,7 @@ class N extends _ {
|
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
_addCheck(e) {
|
|
776
|
-
return new
|
|
776
|
+
return new S({
|
|
777
777
|
...this._def,
|
|
778
778
|
checks: [...this._def.checks, e]
|
|
779
779
|
});
|
|
@@ -910,19 +910,19 @@ class N extends _ {
|
|
|
910
910
|
return this.min(1, h.errToObj(e));
|
|
911
911
|
}
|
|
912
912
|
trim() {
|
|
913
|
-
return new
|
|
913
|
+
return new S({
|
|
914
914
|
...this._def,
|
|
915
915
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
916
916
|
});
|
|
917
917
|
}
|
|
918
918
|
toLowerCase() {
|
|
919
|
-
return new
|
|
919
|
+
return new S({
|
|
920
920
|
...this._def,
|
|
921
921
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
922
922
|
});
|
|
923
923
|
}
|
|
924
924
|
toUpperCase() {
|
|
925
|
-
return new
|
|
925
|
+
return new S({
|
|
926
926
|
...this._def,
|
|
927
927
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
928
928
|
});
|
|
@@ -988,16 +988,16 @@ class N extends _ {
|
|
|
988
988
|
return e;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
|
|
991
|
+
S.create = (n) => {
|
|
992
992
|
var e;
|
|
993
|
-
return new
|
|
993
|
+
return new S({
|
|
994
994
|
checks: [],
|
|
995
995
|
typeName: g.ZodString,
|
|
996
996
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
997
997
|
...v(n)
|
|
998
998
|
});
|
|
999
999
|
};
|
|
1000
|
-
function
|
|
1000
|
+
function Dt(n, e) {
|
|
1001
1001
|
const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = parseInt(n.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
1002
1002
|
return a % o / Math.pow(10, s);
|
|
1003
1003
|
}
|
|
@@ -1036,7 +1036,7 @@ class V extends _ {
|
|
|
1036
1036
|
inclusive: a.inclusive,
|
|
1037
1037
|
exact: !1,
|
|
1038
1038
|
message: a.message
|
|
1039
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1039
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Dt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), m(r, {
|
|
1040
1040
|
code: u.not_multiple_of,
|
|
1041
1041
|
multipleOf: a.value,
|
|
1042
1042
|
message: a.message
|
|
@@ -1897,7 +1897,7 @@ class ce extends _ {
|
|
|
1897
1897
|
for (const c of a)
|
|
1898
1898
|
if (c.result.status === "dirty")
|
|
1899
1899
|
return t.common.issues.push(...c.ctx.common.issues), c.result;
|
|
1900
|
-
const o = a.map((c) => new
|
|
1900
|
+
const o = a.map((c) => new N(c.ctx.common.issues));
|
|
1901
1901
|
return m(t, {
|
|
1902
1902
|
code: u.invalid_union,
|
|
1903
1903
|
unionErrors: o
|
|
@@ -1944,7 +1944,7 @@ class ce extends _ {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
if (a)
|
|
1946
1946
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1947
|
-
const c = o.map((l) => new
|
|
1947
|
+
const c = o.map((l) => new N(l));
|
|
1948
1948
|
return m(t, {
|
|
1949
1949
|
code: u.invalid_union,
|
|
1950
1950
|
unionErrors: c
|
|
@@ -2171,7 +2171,7 @@ class ue extends _ {
|
|
|
2171
2171
|
typeName: g.ZodRecord,
|
|
2172
2172
|
...v(r)
|
|
2173
2173
|
}) : new ue({
|
|
2174
|
-
keyType:
|
|
2174
|
+
keyType: S.create(),
|
|
2175
2175
|
valueType: e,
|
|
2176
2176
|
typeName: g.ZodRecord,
|
|
2177
2177
|
...v(t)
|
|
@@ -2338,7 +2338,7 @@ class J extends _ {
|
|
|
2338
2338
|
if (this._def.returns instanceof G) {
|
|
2339
2339
|
const c = this;
|
|
2340
2340
|
return I(async function(...l) {
|
|
2341
|
-
const d = new
|
|
2341
|
+
const d = new N([]), p = await c._def.args.parseAsync(l, a).catch((A) => {
|
|
2342
2342
|
throw d.addIssue(r(l, A)), d;
|
|
2343
2343
|
}), b = await Reflect.apply(o, this, p);
|
|
2344
2344
|
return await c._def.returns._def.type.parseAsync(b, a).catch((A) => {
|
|
@@ -2350,10 +2350,10 @@ class J extends _ {
|
|
|
2350
2350
|
return I(function(...l) {
|
|
2351
2351
|
const d = c._def.args.safeParse(l, a);
|
|
2352
2352
|
if (!d.success)
|
|
2353
|
-
throw new
|
|
2353
|
+
throw new N([r(l, d.error)]);
|
|
2354
2354
|
const p = Reflect.apply(o, this, d.data), b = c._def.returns.safeParse(p, a);
|
|
2355
2355
|
if (!b.success)
|
|
2356
|
-
throw new
|
|
2356
|
+
throw new N([s(p, b.error)]);
|
|
2357
2357
|
return b.data;
|
|
2358
2358
|
});
|
|
2359
2359
|
}
|
|
@@ -2704,7 +2704,7 @@ class he extends _ {
|
|
|
2704
2704
|
status: "valid",
|
|
2705
2705
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2706
2706
|
get error() {
|
|
2707
|
-
return new
|
|
2707
|
+
return new N(r.common.issues);
|
|
2708
2708
|
},
|
|
2709
2709
|
input: r.data
|
|
2710
2710
|
})
|
|
@@ -2712,7 +2712,7 @@ class he extends _ {
|
|
|
2712
2712
|
status: "valid",
|
|
2713
2713
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2714
2714
|
get error() {
|
|
2715
|
-
return new
|
|
2715
|
+
return new N(r.common.issues);
|
|
2716
2716
|
},
|
|
2717
2717
|
input: r.data
|
|
2718
2718
|
})
|
|
@@ -2745,7 +2745,7 @@ Te.create = (n) => new Te({
|
|
|
2745
2745
|
typeName: g.ZodNaN,
|
|
2746
2746
|
...v(n)
|
|
2747
2747
|
});
|
|
2748
|
-
const
|
|
2748
|
+
const jt = Symbol("zod_brand");
|
|
2749
2749
|
class Ee extends _ {
|
|
2750
2750
|
_parse(e) {
|
|
2751
2751
|
const { ctx: t } = this._processInputParams(e), r = t.data;
|
|
@@ -2835,17 +2835,17 @@ function We(n, e = {}, t) {
|
|
|
2835
2835
|
}
|
|
2836
2836
|
}) : H.create();
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2838
|
+
const Ot = {
|
|
2839
2839
|
object: k.lazycreate
|
|
2840
2840
|
};
|
|
2841
2841
|
var g;
|
|
2842
2842
|
(function(n) {
|
|
2843
2843
|
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2844
2844
|
})(g || (g = {}));
|
|
2845
|
-
const
|
|
2845
|
+
const Et = (n, e = {
|
|
2846
2846
|
message: `Input not instance of ${n.name}`
|
|
2847
|
-
}) => We((t) => t instanceof n, e), Qe =
|
|
2848
|
-
string: (n) =>
|
|
2847
|
+
}) => We((t) => t instanceof n, e), Qe = S.create, Ye = V.create, Pt = Te.create, Rt = F.create, Je = ae.create, Mt = B.create, $t = xe.create, Vt = ie.create, Ft = oe.create, zt = H.create, Ut = L.create, Lt = $.create, qt = ke.create, Bt = C.create, Wt = k.create, Qt = k.strictCreate, Yt = ce.create, Jt = Ie.create, Xt = de.create, Ht = E.create, Gt = ue.create, Kt = we.create, en = W.create, tn = J.create, nn = le.create, rn = me.create, sn = z.create, an = fe.create, on = G.create, Ve = Z.create, cn = j.create, dn = U.create, un = Z.createWithPreprocess, ln = ye.create, mn = () => Qe().optional(), fn = () => Ye().optional(), pn = () => Je().optional(), hn = {
|
|
2848
|
+
string: (n) => S.create({ ...n, coerce: !0 }),
|
|
2849
2849
|
number: (n) => V.create({ ...n, coerce: !0 }),
|
|
2850
2850
|
boolean: (n) => ae.create({
|
|
2851
2851
|
...n,
|
|
@@ -2853,14 +2853,14 @@ const Ot = (n, e = {
|
|
|
2853
2853
|
}),
|
|
2854
2854
|
bigint: (n) => F.create({ ...n, coerce: !0 }),
|
|
2855
2855
|
date: (n) => B.create({ ...n, coerce: !0 })
|
|
2856
|
-
},
|
|
2856
|
+
}, gn = y;
|
|
2857
2857
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2858
2858
|
__proto__: null,
|
|
2859
2859
|
defaultErrorMap: X,
|
|
2860
|
-
setErrorMap:
|
|
2860
|
+
setErrorMap: dt,
|
|
2861
2861
|
getErrorMap: ve,
|
|
2862
2862
|
makeIssue: _e,
|
|
2863
|
-
EMPTY_PATH:
|
|
2863
|
+
EMPTY_PATH: ut,
|
|
2864
2864
|
addIssueToContext: m,
|
|
2865
2865
|
ParseStatus: T,
|
|
2866
2866
|
INVALID: y,
|
|
@@ -2880,7 +2880,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2880
2880
|
getParsedType: R,
|
|
2881
2881
|
ZodType: _,
|
|
2882
2882
|
datetimeRegex: qe,
|
|
2883
|
-
ZodString:
|
|
2883
|
+
ZodString: S,
|
|
2884
2884
|
ZodNumber: V,
|
|
2885
2885
|
ZodBigInt: F,
|
|
2886
2886
|
ZodBoolean: ae,
|
|
@@ -2914,63 +2914,63 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2914
2914
|
ZodDefault: pe,
|
|
2915
2915
|
ZodCatch: he,
|
|
2916
2916
|
ZodNaN: Te,
|
|
2917
|
-
BRAND:
|
|
2917
|
+
BRAND: jt,
|
|
2918
2918
|
ZodBranded: Ee,
|
|
2919
2919
|
ZodPipeline: ye,
|
|
2920
2920
|
ZodReadonly: ge,
|
|
2921
2921
|
custom: We,
|
|
2922
2922
|
Schema: _,
|
|
2923
2923
|
ZodSchema: _,
|
|
2924
|
-
late:
|
|
2924
|
+
late: Ot,
|
|
2925
2925
|
get ZodFirstPartyTypeKind() {
|
|
2926
2926
|
return g;
|
|
2927
2927
|
},
|
|
2928
|
-
coerce:
|
|
2929
|
-
any:
|
|
2930
|
-
array:
|
|
2931
|
-
bigint:
|
|
2928
|
+
coerce: hn,
|
|
2929
|
+
any: zt,
|
|
2930
|
+
array: Bt,
|
|
2931
|
+
bigint: Rt,
|
|
2932
2932
|
boolean: Je,
|
|
2933
|
-
date:
|
|
2934
|
-
discriminatedUnion:
|
|
2933
|
+
date: Mt,
|
|
2934
|
+
discriminatedUnion: Jt,
|
|
2935
2935
|
effect: Ve,
|
|
2936
|
-
enum:
|
|
2937
|
-
function:
|
|
2938
|
-
instanceof:
|
|
2939
|
-
intersection:
|
|
2940
|
-
lazy:
|
|
2941
|
-
literal:
|
|
2942
|
-
map:
|
|
2943
|
-
nan:
|
|
2944
|
-
nativeEnum:
|
|
2945
|
-
never:
|
|
2946
|
-
null:
|
|
2947
|
-
nullable:
|
|
2936
|
+
enum: sn,
|
|
2937
|
+
function: tn,
|
|
2938
|
+
instanceof: Et,
|
|
2939
|
+
intersection: Xt,
|
|
2940
|
+
lazy: nn,
|
|
2941
|
+
literal: rn,
|
|
2942
|
+
map: Kt,
|
|
2943
|
+
nan: Pt,
|
|
2944
|
+
nativeEnum: an,
|
|
2945
|
+
never: Lt,
|
|
2946
|
+
null: Ft,
|
|
2947
|
+
nullable: dn,
|
|
2948
2948
|
number: Ye,
|
|
2949
|
-
object:
|
|
2950
|
-
oboolean:
|
|
2951
|
-
onumber:
|
|
2952
|
-
optional:
|
|
2953
|
-
ostring:
|
|
2954
|
-
pipeline:
|
|
2955
|
-
preprocess:
|
|
2956
|
-
promise:
|
|
2957
|
-
record:
|
|
2958
|
-
set:
|
|
2959
|
-
strictObject:
|
|
2949
|
+
object: Wt,
|
|
2950
|
+
oboolean: pn,
|
|
2951
|
+
onumber: fn,
|
|
2952
|
+
optional: cn,
|
|
2953
|
+
ostring: mn,
|
|
2954
|
+
pipeline: ln,
|
|
2955
|
+
preprocess: un,
|
|
2956
|
+
promise: on,
|
|
2957
|
+
record: Gt,
|
|
2958
|
+
set: en,
|
|
2959
|
+
strictObject: Qt,
|
|
2960
2960
|
string: Qe,
|
|
2961
|
-
symbol:
|
|
2961
|
+
symbol: $t,
|
|
2962
2962
|
transformer: Ve,
|
|
2963
|
-
tuple:
|
|
2964
|
-
undefined:
|
|
2965
|
-
union:
|
|
2966
|
-
unknown:
|
|
2967
|
-
void:
|
|
2968
|
-
NEVER:
|
|
2963
|
+
tuple: Ht,
|
|
2964
|
+
undefined: Vt,
|
|
2965
|
+
union: Yt,
|
|
2966
|
+
unknown: Ut,
|
|
2967
|
+
void: qt,
|
|
2968
|
+
NEVER: gn,
|
|
2969
2969
|
ZodIssueCode: u,
|
|
2970
|
-
quotelessJson:
|
|
2971
|
-
ZodError:
|
|
2970
|
+
quotelessJson: ct,
|
|
2971
|
+
ZodError: N
|
|
2972
2972
|
});
|
|
2973
|
-
const
|
|
2973
|
+
const Xe = i.object({
|
|
2974
2974
|
country: i.string().optional(),
|
|
2975
2975
|
city: i.string().optional(),
|
|
2976
2976
|
street: i.string().optional(),
|
|
@@ -2985,7 +2985,7 @@ function Rn(n) {
|
|
|
2985
2985
|
const re = i.object({
|
|
2986
2986
|
lang: i.enum(["he"]),
|
|
2987
2987
|
value: i.string()
|
|
2988
|
-
}), Mn = i.array(re),
|
|
2988
|
+
}), Mn = i.array(re), He = i.object({
|
|
2989
2989
|
id: i.string().min(1),
|
|
2990
2990
|
companyId: i.string().min(1),
|
|
2991
2991
|
storeId: i.string().min(1),
|
|
@@ -2993,14 +2993,14 @@ const re = i.object({
|
|
|
2993
2993
|
tag: i.string().optional(),
|
|
2994
2994
|
locales: i.array(re),
|
|
2995
2995
|
depth: i.number()
|
|
2996
|
-
}), Pe =
|
|
2996
|
+
}), Pe = He.extend({
|
|
2997
2997
|
children: i.lazy(() => Pe.array())
|
|
2998
|
-
}), $n =
|
|
2998
|
+
}), $n = He.extend({
|
|
2999
2999
|
index: i.number(),
|
|
3000
3000
|
depth: i.number(),
|
|
3001
3001
|
collapsed: i.boolean().optional(),
|
|
3002
3002
|
children: i.array(Pe)
|
|
3003
|
-
}), ee = i.string().min(1),
|
|
3003
|
+
}), ee = i.string().min(1), Ge = i.object({
|
|
3004
3004
|
type: i.literal("Product"),
|
|
3005
3005
|
storeId: ee,
|
|
3006
3006
|
companyId: ee,
|
|
@@ -3053,10 +3053,10 @@ const re = i.object({
|
|
|
3053
3053
|
}).optional(),
|
|
3054
3054
|
// @deprecated
|
|
3055
3055
|
categoryNames: i.array(i.string()).optional()
|
|
3056
|
-
}), Vn =
|
|
3056
|
+
}), Vn = Ge.extend({
|
|
3057
3057
|
image: i.instanceof(File).optional()
|
|
3058
|
-
}),
|
|
3059
|
-
product:
|
|
3058
|
+
}), Ke = i.object({
|
|
3059
|
+
product: Ge,
|
|
3060
3060
|
originalPrice: i.number().optional(),
|
|
3061
3061
|
finalPrice: i.number().optional(),
|
|
3062
3062
|
finalDiscount: i.number().optional(),
|
|
@@ -3068,7 +3068,7 @@ const re = i.object({
|
|
|
3068
3068
|
storeId: i.string().uuid(),
|
|
3069
3069
|
userId: i.string().uuid(),
|
|
3070
3070
|
status: i.enum(["active", "draft", "completed"]),
|
|
3071
|
-
items: i.array(
|
|
3071
|
+
items: i.array(Ke)
|
|
3072
3072
|
}), zn = i.object({
|
|
3073
3073
|
id: i.string(),
|
|
3074
3074
|
name: i.string(),
|
|
@@ -3080,7 +3080,7 @@ const re = i.object({
|
|
|
3080
3080
|
storeId: i.string().uuid(),
|
|
3081
3081
|
userId: i.string().uuid(),
|
|
3082
3082
|
productId: i.string().uuid()
|
|
3083
|
-
}),
|
|
3083
|
+
}), et = i.enum(["default", "delayed"], {
|
|
3084
3084
|
description: "delayed is J5 transaction"
|
|
3085
3085
|
}), yn = i.object({
|
|
3086
3086
|
type: i.literal("Profile"),
|
|
@@ -3093,11 +3093,11 @@ const re = i.object({
|
|
|
3093
3093
|
displayName: M,
|
|
3094
3094
|
email: i.string().email(),
|
|
3095
3095
|
phoneNumber: i.string().optional(),
|
|
3096
|
-
address:
|
|
3096
|
+
address: Xe.optional(),
|
|
3097
3097
|
isAnonymous: i.boolean(),
|
|
3098
3098
|
createdDate: i.number(),
|
|
3099
3099
|
lastActivityDate: i.number(),
|
|
3100
|
-
paymentType:
|
|
3100
|
+
paymentType: et,
|
|
3101
3101
|
organizationId: i.string().optional().nullable()
|
|
3102
3102
|
});
|
|
3103
3103
|
function Ln() {
|
|
@@ -3123,10 +3123,10 @@ function Ln() {
|
|
|
3123
3123
|
createdDate: 0,
|
|
3124
3124
|
lastActivityDate: 0,
|
|
3125
3125
|
isAnonymous: !0,
|
|
3126
|
-
paymentType:
|
|
3126
|
+
paymentType: et.Values.default
|
|
3127
3127
|
};
|
|
3128
3128
|
}
|
|
3129
|
-
const
|
|
3129
|
+
const tt = i.object({
|
|
3130
3130
|
_COMMENT: i.string().optional(),
|
|
3131
3131
|
transaction_id: i.string(),
|
|
3132
3132
|
date: i.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
|
|
@@ -3146,7 +3146,7 @@ const et = i.object({
|
|
|
3146
3146
|
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3147
3147
|
success: i.boolean(),
|
|
3148
3148
|
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3149
|
-
calculatedData:
|
|
3149
|
+
calculatedData: tt,
|
|
3150
3150
|
warning: i.string().optional(),
|
|
3151
3151
|
date: i.number().optional()
|
|
3152
3152
|
}), _n = i.object({
|
|
@@ -3178,7 +3178,7 @@ const et = i.object({
|
|
|
3178
3178
|
total: i.number().min(1, "Total is required").optional(),
|
|
3179
3179
|
vat: i.number().min(1, "VAT is required").optional(),
|
|
3180
3180
|
link: i.string().url("Link must be a valid URL").optional()
|
|
3181
|
-
}),
|
|
3181
|
+
}), nt = i.object({
|
|
3182
3182
|
number: i.string(),
|
|
3183
3183
|
name: i.string(),
|
|
3184
3184
|
id: i.string()
|
|
@@ -3187,7 +3187,7 @@ const et = i.object({
|
|
|
3187
3187
|
name: i.string(),
|
|
3188
3188
|
discountPercentage: i.number().positive().min(0).max(100).optional(),
|
|
3189
3189
|
nameOnInvoice: i.string().optional(),
|
|
3190
|
-
billingAccounts: i.array(
|
|
3190
|
+
billingAccounts: i.array(nt),
|
|
3191
3191
|
paymentType: i.enum(["default", "delayed"])
|
|
3192
3192
|
}), qn = bn.omit({ id: !0 }), xn = i.object({
|
|
3193
3193
|
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
@@ -3197,7 +3197,7 @@ const et = i.object({
|
|
|
3197
3197
|
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3198
3198
|
success: i.boolean(),
|
|
3199
3199
|
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3200
|
-
calculatedData:
|
|
3200
|
+
calculatedData: tt,
|
|
3201
3201
|
warning: i.string().optional(),
|
|
3202
3202
|
date: i.number().optional()
|
|
3203
3203
|
}), kn = i.object({
|
|
@@ -3231,6 +3231,7 @@ const et = i.object({
|
|
|
3231
3231
|
link: i.string().url("Link must be a valid URL").optional()
|
|
3232
3232
|
}), Bn = i.object({
|
|
3233
3233
|
type: i.literal("Order"),
|
|
3234
|
+
createdBy: i.enum(["user", "admin"]).optional(),
|
|
3234
3235
|
id: M,
|
|
3235
3236
|
companyId: M,
|
|
3236
3237
|
storeId: M,
|
|
@@ -3254,7 +3255,7 @@ const et = i.object({
|
|
|
3254
3255
|
//todo check if hyp support partial refund
|
|
3255
3256
|
cart: i.object({
|
|
3256
3257
|
id: i.string(),
|
|
3257
|
-
items: i.array(
|
|
3258
|
+
items: i.array(Ke),
|
|
3258
3259
|
cartDiscount: i.number(),
|
|
3259
3260
|
cartTotal: i.number(),
|
|
3260
3261
|
cartVat: i.number(),
|
|
@@ -3278,7 +3279,7 @@ const et = i.object({
|
|
|
3278
3279
|
nameOnInvoice: i.string().optional(),
|
|
3279
3280
|
clientComment: i.string().optional(),
|
|
3280
3281
|
organizationId: i.string().optional(),
|
|
3281
|
-
billingAccount:
|
|
3282
|
+
billingAccount: nt.optional(),
|
|
3282
3283
|
deliveryNote: _n.optional(),
|
|
3283
3284
|
invoice: kn.optional(),
|
|
3284
3285
|
ezInvoice: xn.optional(),
|
|
@@ -3297,7 +3298,10 @@ const et = i.object({
|
|
|
3297
3298
|
clientTypes: i.array(wn),
|
|
3298
3299
|
minimumOrder: i.number().optional(),
|
|
3299
3300
|
freeDeliveryPrice: i.number().optional(),
|
|
3300
|
-
deliveryPrice: i.number().optional()
|
|
3301
|
+
deliveryPrice: i.number().optional(),
|
|
3302
|
+
address: Xe.optional(),
|
|
3303
|
+
companyNumber: i.string().optional()
|
|
3304
|
+
// חפ של החברה
|
|
3301
3305
|
}), Tn = i.object({
|
|
3302
3306
|
minSpend: i.number().positive().optional(),
|
|
3303
3307
|
stackable: i.boolean().default(!1)
|
|
@@ -3376,7 +3380,7 @@ class An {
|
|
|
3376
3380
|
});
|
|
3377
3381
|
}
|
|
3378
3382
|
}
|
|
3379
|
-
class
|
|
3383
|
+
class rt {
|
|
3380
3384
|
static getStrategy(e) {
|
|
3381
3385
|
return this.strategies.get(e.variant.variantType) || null;
|
|
3382
3386
|
}
|
|
@@ -3390,10 +3394,10 @@ class nt {
|
|
|
3390
3394
|
this.strategies.clear();
|
|
3391
3395
|
}
|
|
3392
3396
|
}
|
|
3393
|
-
Re(
|
|
3397
|
+
Re(rt, "strategies", /* @__PURE__ */ new Map([
|
|
3394
3398
|
["bundle", new An()]
|
|
3395
3399
|
]));
|
|
3396
|
-
class
|
|
3400
|
+
class Nn {
|
|
3397
3401
|
static calculateDiscounts(e, t, r) {
|
|
3398
3402
|
var d, p;
|
|
3399
3403
|
const s = {
|
|
@@ -3402,7 +3406,7 @@ class Sn {
|
|
|
3402
3406
|
appliedDiscounts: []
|
|
3403
3407
|
}, a = this.filterActiveDiscounts(t), o = [];
|
|
3404
3408
|
for (const b of a) {
|
|
3405
|
-
const w =
|
|
3409
|
+
const w = rt.getStrategy(b);
|
|
3406
3410
|
if (!w || !w.canApply(b, s) || !((d = b.conditions) != null && d.stackable) && o.length > 0) continue;
|
|
3407
3411
|
const A = w.calculate(b, s);
|
|
3408
3412
|
A.applicable && (o.push({
|
|
@@ -3456,24 +3460,24 @@ class Sn {
|
|
|
3456
3460
|
return this.filterActiveDiscounts(e);
|
|
3457
3461
|
}
|
|
3458
3462
|
}
|
|
3459
|
-
function
|
|
3463
|
+
function st(n) {
|
|
3460
3464
|
return Number(n.toFixed(2));
|
|
3461
3465
|
}
|
|
3462
3466
|
function Yn(n) {
|
|
3463
3467
|
return n.toFixed(2);
|
|
3464
3468
|
}
|
|
3465
3469
|
function Jn(n) {
|
|
3466
|
-
return Math.max(0,
|
|
3470
|
+
return Math.max(0, st(n));
|
|
3467
3471
|
}
|
|
3468
3472
|
function Xn(n, e) {
|
|
3469
3473
|
if (n <= 0) return 0;
|
|
3470
3474
|
const t = n - e;
|
|
3471
|
-
return
|
|
3475
|
+
return st(t / n * 100);
|
|
3472
3476
|
}
|
|
3473
3477
|
const Ce = {
|
|
3474
3478
|
VAT: 18
|
|
3475
3479
|
};
|
|
3476
|
-
function
|
|
3480
|
+
function Sn(n) {
|
|
3477
3481
|
var e, t;
|
|
3478
3482
|
return ((e = n.discount) == null ? void 0 : e.type) === "percent" ? n.price * (n.discount.value ?? 100) / 100 : ((t = n.discount) == null ? void 0 : t.type) === "number" ? n.discount.value ?? 0 : 0;
|
|
3479
3483
|
}
|
|
@@ -3498,27 +3502,27 @@ function Hn({
|
|
|
3498
3502
|
id: d.product.id,
|
|
3499
3503
|
price: d.product.price
|
|
3500
3504
|
}
|
|
3501
|
-
})), o =
|
|
3505
|
+
})), o = Nn.calculateDiscounts(a, e), c = n.map((d, p) => {
|
|
3502
3506
|
const b = o.items[p];
|
|
3503
3507
|
return {
|
|
3504
3508
|
amount: d.amount,
|
|
3505
3509
|
product: { ...d.product },
|
|
3506
3510
|
originalPrice: d.product.price,
|
|
3507
3511
|
finalPrice: b ? b.finalPrice : Cn(d.product),
|
|
3508
|
-
finalDiscount: b ? b.finalDiscount :
|
|
3512
|
+
finalDiscount: b ? b.finalDiscount : Sn(d.product)
|
|
3509
3513
|
};
|
|
3510
3514
|
}), l = c.reduce(
|
|
3511
3515
|
(d, p) => {
|
|
3512
3516
|
const { product: b, amount: w, finalPrice: A, finalDiscount: K } = p;
|
|
3513
3517
|
let D = 0;
|
|
3514
3518
|
if (b.vat) {
|
|
3515
|
-
let
|
|
3519
|
+
let Ne = 0;
|
|
3516
3520
|
if (s) {
|
|
3517
|
-
const
|
|
3518
|
-
D = Number(
|
|
3521
|
+
const at = A * (Ce.VAT / (100 + Ce.VAT));
|
|
3522
|
+
D = Number(at.toFixed(2)), D = D * w, Ne = Number(D.toFixed(2));
|
|
3519
3523
|
} else
|
|
3520
|
-
D = A * Ce.VAT / 100, D = D * w,
|
|
3521
|
-
d.vat = Number((d.vat +
|
|
3524
|
+
D = A * Ce.VAT / 100, D = D * w, Ne = Number(D.toFixed(2));
|
|
3525
|
+
d.vat = Number((d.vat + Ne).toFixed(2));
|
|
3522
3526
|
}
|
|
3523
3527
|
const Ae = Number(A.toFixed(2));
|
|
3524
3528
|
return d.cost += w * Ae, d.discount += K && w * K, d.finalCost += w * Ae + (s ? 0 : D), d.productsCost += w * Ae + (s ? 0 : D), d.cost = Number(d.cost.toFixed(2)), d.discount = Number(d.discount.toFixed(2)), d.finalCost = Number(d.finalCost.toFixed(2)), d.productsCost = Number(d.productsCost.toFixed(2)), d;
|
|
@@ -3566,20 +3570,20 @@ const Zn = {
|
|
|
3566
3570
|
firestore: jn
|
|
3567
3571
|
};
|
|
3568
3572
|
export {
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3573
|
+
Xe as AddressSchema,
|
|
3574
|
+
He as BaseCategorySchema,
|
|
3575
|
+
nt as BillingAccountSchema,
|
|
3572
3576
|
An as BundleDiscountStrategy,
|
|
3573
|
-
|
|
3574
|
-
|
|
3577
|
+
tt as CalculatedDataSchema,
|
|
3578
|
+
Ke as CartItemProductSchema,
|
|
3575
3579
|
Fn as CartSchema,
|
|
3576
3580
|
Pe as CategorySchema,
|
|
3577
3581
|
zn as CompanySchema,
|
|
3578
3582
|
_n as DeliveryNoteSchema,
|
|
3579
3583
|
Tn as DiscountConditionsSchema,
|
|
3580
|
-
|
|
3584
|
+
Nn as DiscountEngine,
|
|
3581
3585
|
Qn as DiscountSchema,
|
|
3582
|
-
|
|
3586
|
+
rt as DiscountStrategyFactory,
|
|
3583
3587
|
In as DiscountVariantSchema,
|
|
3584
3588
|
vn as EzDeliveryNoteSchema,
|
|
3585
3589
|
Un as FavoriteProductSchema,
|
|
@@ -3591,8 +3595,8 @@ export {
|
|
|
3591
3595
|
Vn as NewProductSchema,
|
|
3592
3596
|
Bn as OrderSchema,
|
|
3593
3597
|
bn as OrganizationSchema,
|
|
3594
|
-
|
|
3595
|
-
|
|
3598
|
+
Ge as ProductSchema,
|
|
3599
|
+
et as ProfilePaymentTypeSchema,
|
|
3596
3600
|
yn as ProfileSchema,
|
|
3597
3601
|
Wn as StoreSchema,
|
|
3598
3602
|
$n as TFlattenCategorySchema,
|
|
@@ -3600,7 +3604,7 @@ export {
|
|
|
3600
3604
|
wn as clientTypesSchema,
|
|
3601
3605
|
Ln as createEmptyProfile,
|
|
3602
3606
|
Jn as ensureNonNegative,
|
|
3603
|
-
|
|
3607
|
+
st as formatCurrency,
|
|
3604
3608
|
Yn as formatCurrencyString,
|
|
3605
3609
|
Hn as getCartCost,
|
|
3606
3610
|
Rn as isFile,
|