@jsdev_ninja/core 0.12.11 → 0.13.13
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 +85 -70
- 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/entities/Discount/engine.d.ts.map +1 -1
- package/dist/entities/Discount/engine.js +15 -10
- package/dist/entities/Order.d.ts +10 -0
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Order.js +1 -0
- package/dist/entities/Organization.d.ts +34 -0
- package/dist/entities/Organization.d.ts.map +1 -0
- package/dist/entities/Organization.js +9 -0
- package/dist/entities/Profile.d.ts +3 -0
- package/dist/entities/Profile.d.ts.map +1 -1
- package/dist/entities/Profile.js +1 -0
- package/dist/entities/Store.d.ts +2 -2
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +1 -0
- package/dist/firebase-api/index.d.ts +3 -0
- package/dist/firebase-api/index.d.ts.map +1 -1
- package/dist/firebase-api/index.js +1 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/lib/entities/Discount/engine.ts +134 -125
- package/lib/entities/Order.ts +1 -0
- package/lib/entities/Organization.ts +14 -0
- package/lib/entities/Profile.ts +1 -0
- package/lib/entities/index.ts +1 -0
- package/lib/firebase-api/index.ts +1 -0
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -509,7 +509,7 @@ class _ {
|
|
|
509
509
|
return j.create(this, this._def);
|
|
510
510
|
}
|
|
511
511
|
nullable() {
|
|
512
|
-
return
|
|
512
|
+
return L.create(this, this._def);
|
|
513
513
|
}
|
|
514
514
|
nullish() {
|
|
515
515
|
return this.nullable().optional();
|
|
@@ -581,16 +581,16 @@ class _ {
|
|
|
581
581
|
}
|
|
582
582
|
const ot = /^c[^\s-]{8,}$/i, ct = /^[0-9a-z]+$/, dt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ut = /^[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, lt = /^[a-z0-9_-]{21}$/i, ft = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ht = /^[-+]?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)?)??$/, mt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, pt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
583
|
let Ce;
|
|
584
|
-
const yt = /^(?:(?: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])$/, gt = /^(?:(?: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])$/, vt = /^(([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]))$/, _t = /^(([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])$/, bt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
585
|
-
function
|
|
584
|
+
const yt = /^(?:(?: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])$/, gt = /^(?:(?: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])$/, vt = /^(([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]))$/, _t = /^(([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])$/, bt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ze = "((\\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])))", kt = new RegExp(`^${ze}$`);
|
|
585
|
+
function Le(r) {
|
|
586
586
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
587
587
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
588
588
|
}
|
|
589
589
|
function wt(r) {
|
|
590
|
-
return new RegExp(`^${
|
|
590
|
+
return new RegExp(`^${Le(r)}$`);
|
|
591
591
|
}
|
|
592
592
|
function Ue(r) {
|
|
593
|
-
let e = `${
|
|
593
|
+
let e = `${ze}T${Le(r)}`;
|
|
594
594
|
const t = [];
|
|
595
595
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
596
596
|
}
|
|
@@ -1598,7 +1598,7 @@ function Q(r) {
|
|
|
1598
1598
|
} else return r instanceof Z ? new Z({
|
|
1599
1599
|
...r._def,
|
|
1600
1600
|
type: Q(r.element)
|
|
1601
|
-
}) : r instanceof j ? j.create(Q(r.unwrap())) : r instanceof
|
|
1601
|
+
}) : r instanceof j ? j.create(Q(r.unwrap())) : r instanceof L ? L.create(Q(r.unwrap())) : r instanceof R ? R.create(r.items.map((e) => Q(e))) : r;
|
|
1602
1602
|
}
|
|
1603
1603
|
class k extends _ {
|
|
1604
1604
|
constructor() {
|
|
@@ -1960,7 +1960,7 @@ oe.create = (r, e) => new oe({
|
|
|
1960
1960
|
typeName: y.ZodUnion,
|
|
1961
1961
|
...v(e)
|
|
1962
1962
|
});
|
|
1963
|
-
const P = (r) => r instanceof ue ? P(r.schema) : r instanceof O ? P(r.innerType()) : r instanceof le ? [r.value] : r instanceof
|
|
1963
|
+
const P = (r) => r instanceof ue ? P(r.schema) : r instanceof O ? P(r.innerType()) : r instanceof le ? [r.value] : r instanceof z ? r.options : r instanceof fe ? x.objectValues(r.enum) : r instanceof he ? P(r._def.innerType) : r instanceof ae ? [void 0] : r instanceof ie ? [null] : r instanceof j ? [void 0, ...P(r.unwrap())] : r instanceof L ? [null, ...P(r.unwrap())] : r instanceof Ee || r instanceof pe ? P(r.unwrap()) : r instanceof me ? P(r._def.innerType) : [];
|
|
1964
1964
|
class Te extends _ {
|
|
1965
1965
|
_parse(e) {
|
|
1966
1966
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2427,13 +2427,13 @@ le.create = (r, e) => new le({
|
|
|
2427
2427
|
...v(e)
|
|
2428
2428
|
});
|
|
2429
2429
|
function Be(r, e) {
|
|
2430
|
-
return new
|
|
2430
|
+
return new z({
|
|
2431
2431
|
values: r,
|
|
2432
2432
|
typeName: y.ZodEnum,
|
|
2433
2433
|
...v(e)
|
|
2434
2434
|
});
|
|
2435
2435
|
}
|
|
2436
|
-
class
|
|
2436
|
+
class z extends _ {
|
|
2437
2437
|
constructor() {
|
|
2438
2438
|
super(...arguments), ee.set(this, void 0);
|
|
2439
2439
|
}
|
|
@@ -2478,20 +2478,20 @@ class L extends _ {
|
|
|
2478
2478
|
return e;
|
|
2479
2479
|
}
|
|
2480
2480
|
extract(e, t = this._def) {
|
|
2481
|
-
return
|
|
2481
|
+
return z.create(e, {
|
|
2482
2482
|
...this._def,
|
|
2483
2483
|
...t
|
|
2484
2484
|
});
|
|
2485
2485
|
}
|
|
2486
2486
|
exclude(e, t = this._def) {
|
|
2487
|
-
return
|
|
2487
|
+
return z.create(this.options.filter((n) => !e.includes(n)), {
|
|
2488
2488
|
...this._def,
|
|
2489
2489
|
...t
|
|
2490
2490
|
});
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
2493
|
ee = /* @__PURE__ */ new WeakMap();
|
|
2494
|
-
|
|
2494
|
+
z.create = Be;
|
|
2495
2495
|
class fe extends _ {
|
|
2496
2496
|
constructor() {
|
|
2497
2497
|
super(...arguments), te.set(this, void 0);
|
|
@@ -2652,7 +2652,7 @@ j.create = (r, e) => new j({
|
|
|
2652
2652
|
typeName: y.ZodOptional,
|
|
2653
2653
|
...v(e)
|
|
2654
2654
|
});
|
|
2655
|
-
class
|
|
2655
|
+
class L extends _ {
|
|
2656
2656
|
_parse(e) {
|
|
2657
2657
|
return this._getType(e) === h.null ? I(null) : this._def.innerType._parse(e);
|
|
2658
2658
|
}
|
|
@@ -2660,7 +2660,7 @@ class z extends _ {
|
|
|
2660
2660
|
return this._def.innerType;
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
2663
|
-
|
|
2663
|
+
L.create = (r, e) => new L({
|
|
2664
2664
|
innerType: r,
|
|
2665
2665
|
typeName: y.ZodNullable,
|
|
2666
2666
|
...v(e)
|
|
@@ -2844,7 +2844,7 @@ var y;
|
|
|
2844
2844
|
})(y || (y = {}));
|
|
2845
2845
|
const Zt = (r, e = {
|
|
2846
2846
|
message: `Input not instance of ${r.name}`
|
|
2847
|
-
}) => We((t) => t instanceof r, e), qe = N.create, Qe = V.create, Ot = we.create, jt = F.create, Je = se.create, Et = W.create, Rt = be.create, Pt = ae.create, Dt = ie.create, Mt = G.create, $t = U.create, Vt = $.create, Ft = xe.create,
|
|
2847
|
+
}) => We((t) => t instanceof r, e), qe = N.create, Qe = V.create, Ot = we.create, jt = F.create, Je = se.create, Et = W.create, Rt = be.create, Pt = ae.create, Dt = ie.create, Mt = G.create, $t = U.create, Vt = $.create, Ft = xe.create, zt = Z.create, Lt = k.create, Ut = k.strictCreate, Bt = oe.create, Wt = Te.create, qt = ce.create, Qt = R.create, Jt = de.create, Yt = ke.create, Ht = q.create, Gt = Y.create, Xt = ue.create, Kt = le.create, er = z.create, tr = fe.create, rr = X.create, $e = O.create, nr = j.create, sr = L.create, ar = O.createWithPreprocess, ir = ye.create, or = () => qe().optional(), cr = () => Qe().optional(), dr = () => Je().optional(), ur = {
|
|
2848
2848
|
string: (r) => N.create({ ...r, coerce: !0 }),
|
|
2849
2849
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2850
2850
|
boolean: (r) => se.create({
|
|
@@ -2904,13 +2904,13 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2904
2904
|
ZodFunction: Y,
|
|
2905
2905
|
ZodLazy: ue,
|
|
2906
2906
|
ZodLiteral: le,
|
|
2907
|
-
ZodEnum:
|
|
2907
|
+
ZodEnum: z,
|
|
2908
2908
|
ZodNativeEnum: fe,
|
|
2909
2909
|
ZodPromise: X,
|
|
2910
2910
|
ZodEffects: O,
|
|
2911
2911
|
ZodTransformer: O,
|
|
2912
2912
|
ZodOptional: j,
|
|
2913
|
-
ZodNullable:
|
|
2913
|
+
ZodNullable: L,
|
|
2914
2914
|
ZodDefault: he,
|
|
2915
2915
|
ZodCatch: me,
|
|
2916
2916
|
ZodNaN: we,
|
|
@@ -2927,7 +2927,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2927
2927
|
},
|
|
2928
2928
|
coerce: ur,
|
|
2929
2929
|
any: Mt,
|
|
2930
|
-
array:
|
|
2930
|
+
array: zt,
|
|
2931
2931
|
bigint: jt,
|
|
2932
2932
|
boolean: Je,
|
|
2933
2933
|
date: Et,
|
|
@@ -2946,7 +2946,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2946
2946
|
null: Dt,
|
|
2947
2947
|
nullable: sr,
|
|
2948
2948
|
number: Qe,
|
|
2949
|
-
object:
|
|
2949
|
+
object: Lt,
|
|
2950
2950
|
oboolean: dr,
|
|
2951
2951
|
onumber: cr,
|
|
2952
2952
|
optional: nr,
|
|
@@ -2978,14 +2978,14 @@ const fr = i.object({
|
|
|
2978
2978
|
floor: i.string(),
|
|
2979
2979
|
apartmentEnterNumber: i.string(),
|
|
2980
2980
|
apartmentNumber: i.string()
|
|
2981
|
-
}), M = i.string().min(1, { message: "שדה חובה" }),
|
|
2982
|
-
function
|
|
2981
|
+
}), M = i.string().min(1, { message: "שדה חובה" }), Sr = i.string().regex(/^\d+$/, "Must be a numeric string"), Cr = i.object({ url: i.string().url(), id: i.string() });
|
|
2982
|
+
function Ar(r) {
|
|
2983
2983
|
return !!(r != null && r.url);
|
|
2984
2984
|
}
|
|
2985
2985
|
const re = i.object({
|
|
2986
2986
|
lang: i.enum(["he"]),
|
|
2987
2987
|
value: i.string()
|
|
2988
|
-
}),
|
|
2988
|
+
}), Nr = i.array(re), Ye = i.object({
|
|
2989
2989
|
id: i.string().min(1),
|
|
2990
2990
|
companyId: i.string().min(1),
|
|
2991
2991
|
storeId: i.string().min(1),
|
|
@@ -2995,7 +2995,7 @@ const re = i.object({
|
|
|
2995
2995
|
depth: i.number()
|
|
2996
2996
|
}), Re = Ye.extend({
|
|
2997
2997
|
children: i.lazy(() => Re.array())
|
|
2998
|
-
}),
|
|
2998
|
+
}), Zr = Ye.extend({
|
|
2999
2999
|
index: i.number(),
|
|
3000
3000
|
depth: i.number(),
|
|
3001
3001
|
collapsed: i.boolean().optional(),
|
|
@@ -3053,7 +3053,7 @@ const re = i.object({
|
|
|
3053
3053
|
}).optional(),
|
|
3054
3054
|
// @deprecated
|
|
3055
3055
|
categoryNames: i.array(i.string()).optional()
|
|
3056
|
-
}),
|
|
3056
|
+
}), Or = He.extend({
|
|
3057
3057
|
image: i.instanceof(File).optional()
|
|
3058
3058
|
}), Ge = i.object({
|
|
3059
3059
|
product: He,
|
|
@@ -3061,7 +3061,7 @@ const re = i.object({
|
|
|
3061
3061
|
finalPrice: i.number().optional(),
|
|
3062
3062
|
finalDiscount: i.number().optional(),
|
|
3063
3063
|
amount: i.number().positive({ message: "Quantity must be a positive number." })
|
|
3064
|
-
}),
|
|
3064
|
+
}), jr = i.object({
|
|
3065
3065
|
type: i.literal("Cart"),
|
|
3066
3066
|
id: i.string().uuid(),
|
|
3067
3067
|
companyId: i.string().uuid(),
|
|
@@ -3069,11 +3069,11 @@ const re = i.object({
|
|
|
3069
3069
|
userId: i.string().uuid(),
|
|
3070
3070
|
status: i.enum(["active", "draft", "completed"]),
|
|
3071
3071
|
items: i.array(Ge)
|
|
3072
|
-
}),
|
|
3072
|
+
}), Er = i.object({
|
|
3073
3073
|
id: i.string(),
|
|
3074
3074
|
name: i.string(),
|
|
3075
3075
|
websiteDomains: i.array(i.string())
|
|
3076
|
-
}),
|
|
3076
|
+
}), Rr = i.object({
|
|
3077
3077
|
type: i.literal("FavoriteProduct"),
|
|
3078
3078
|
id: i.string().uuid(),
|
|
3079
3079
|
companyId: i.string().uuid(),
|
|
@@ -3097,9 +3097,10 @@ const re = i.object({
|
|
|
3097
3097
|
isAnonymous: i.boolean(),
|
|
3098
3098
|
createdDate: i.number(),
|
|
3099
3099
|
lastActivityDate: i.number(),
|
|
3100
|
-
paymentType: Xe
|
|
3100
|
+
paymentType: Xe,
|
|
3101
|
+
organizationId: i.string().optional()
|
|
3101
3102
|
});
|
|
3102
|
-
function
|
|
3103
|
+
function Pr() {
|
|
3103
3104
|
return {
|
|
3104
3105
|
type: "Profile",
|
|
3105
3106
|
id: "",
|
|
@@ -3125,7 +3126,7 @@ function Rr() {
|
|
|
3125
3126
|
paymentType: Xe.Values.default
|
|
3126
3127
|
};
|
|
3127
3128
|
}
|
|
3128
|
-
const
|
|
3129
|
+
const Dr = i.object({
|
|
3129
3130
|
type: i.literal("Order"),
|
|
3130
3131
|
id: M,
|
|
3131
3132
|
companyId: M,
|
|
@@ -3152,7 +3153,8 @@ const Pr = i.object({
|
|
|
3152
3153
|
items: i.array(Ge),
|
|
3153
3154
|
cartDiscount: i.number(),
|
|
3154
3155
|
cartTotal: i.number(),
|
|
3155
|
-
cartVat: i.number()
|
|
3156
|
+
cartVat: i.number(),
|
|
3157
|
+
deliveryPrice: i.number().optional()
|
|
3156
3158
|
}),
|
|
3157
3159
|
originalAmount: i.number().positive().optional(),
|
|
3158
3160
|
// what client pay
|
|
@@ -3163,7 +3165,7 @@ const Pr = i.object({
|
|
|
3163
3165
|
client: hr.required({}),
|
|
3164
3166
|
nameOnInvoice: i.string().optional(),
|
|
3165
3167
|
clientComment: i.string().optional()
|
|
3166
|
-
}), mr = i.enum(["individual", "company"]),
|
|
3168
|
+
}), mr = i.enum(["individual", "company"]), Mr = i.object({
|
|
3167
3169
|
id: i.string(),
|
|
3168
3170
|
companyId: i.string(),
|
|
3169
3171
|
name: i.string(),
|
|
@@ -3191,7 +3193,7 @@ const Pr = i.object({
|
|
|
3191
3193
|
bundlePrice: i.number().positive()
|
|
3192
3194
|
// Total price for the bundle (e.g., $25)
|
|
3193
3195
|
})
|
|
3194
|
-
]),
|
|
3196
|
+
]), $r = i.object({
|
|
3195
3197
|
type: i.literal("Discount"),
|
|
3196
3198
|
storeId: i.string().min(1),
|
|
3197
3199
|
companyId: i.string().min(1),
|
|
@@ -3292,7 +3294,10 @@ class vr {
|
|
|
3292
3294
|
affectedItems: S.affectedItems
|
|
3293
3295
|
}), s.appliedDiscounts = o);
|
|
3294
3296
|
}
|
|
3295
|
-
const c = this.calculateFinalPrices(e, o), d = o.reduce(
|
|
3297
|
+
const c = this.calculateFinalPrices(e, o), d = o.reduce(
|
|
3298
|
+
(b, w) => b + w.discountAmount,
|
|
3299
|
+
0
|
|
3300
|
+
);
|
|
3296
3301
|
return {
|
|
3297
3302
|
items: c,
|
|
3298
3303
|
totalDiscount: Number(d.toFixed(2)),
|
|
@@ -3310,7 +3315,9 @@ class vr {
|
|
|
3310
3315
|
const s = t.filter(
|
|
3311
3316
|
(d) => d.affectedItems.some((l) => l.productId === n.product.id)
|
|
3312
3317
|
), a = s.reduce((d, l) => {
|
|
3313
|
-
const m = l.affectedItems.find(
|
|
3318
|
+
const m = l.affectedItems.find(
|
|
3319
|
+
(b) => b.productId === n.product.id
|
|
3320
|
+
);
|
|
3314
3321
|
return d + ((m == null ? void 0 : m.discountAmount) || 0);
|
|
3315
3322
|
}, 0), o = a / n.amount, c = n.product.price - o;
|
|
3316
3323
|
return {
|
|
@@ -3334,25 +3341,30 @@ class vr {
|
|
|
3334
3341
|
function et(r) {
|
|
3335
3342
|
return Number(r.toFixed(2));
|
|
3336
3343
|
}
|
|
3337
|
-
function
|
|
3344
|
+
function Vr(r) {
|
|
3338
3345
|
return r.toFixed(2);
|
|
3339
3346
|
}
|
|
3340
|
-
function
|
|
3347
|
+
function Fr(r) {
|
|
3341
3348
|
return Math.max(0, et(r));
|
|
3342
3349
|
}
|
|
3343
|
-
function
|
|
3350
|
+
function zr(r, e) {
|
|
3344
3351
|
if (r <= 0) return 0;
|
|
3345
3352
|
const t = r - e;
|
|
3346
3353
|
return et(t / r * 100);
|
|
3347
3354
|
}
|
|
3348
|
-
const
|
|
3355
|
+
const _r = i.object({
|
|
3356
|
+
id: i.string(),
|
|
3357
|
+
name: i.string(),
|
|
3358
|
+
discountPercentage: i.number().positive().min(0).max(100).optional(),
|
|
3359
|
+
nameOnInvoice: i.string().optional()
|
|
3360
|
+
}), Lr = _r.omit({ id: !0 }), Ae = {
|
|
3349
3361
|
VAT: 18
|
|
3350
3362
|
};
|
|
3351
|
-
function
|
|
3363
|
+
function br(r) {
|
|
3352
3364
|
var e, t;
|
|
3353
3365
|
return ((e = r.discount) == null ? void 0 : e.type) === "percent" ? r.price * (r.discount.value ?? 100) / 100 : ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.discount.value ?? 0 : 0;
|
|
3354
3366
|
}
|
|
3355
|
-
function
|
|
3367
|
+
function xr(r) {
|
|
3356
3368
|
var e, t;
|
|
3357
3369
|
if (((e = r.discount) == null ? void 0 : e.type) === "percent") {
|
|
3358
3370
|
const n = r.price * r.discount.value / 100;
|
|
@@ -3360,7 +3372,7 @@ function br(r) {
|
|
|
3360
3372
|
}
|
|
3361
3373
|
return ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.price - r.discount.value : r.price;
|
|
3362
3374
|
}
|
|
3363
|
-
function
|
|
3375
|
+
function Ur({
|
|
3364
3376
|
cart: r,
|
|
3365
3377
|
discounts: e,
|
|
3366
3378
|
store: t
|
|
@@ -3377,8 +3389,8 @@ function Lr({
|
|
|
3377
3389
|
amount: d.amount,
|
|
3378
3390
|
product: { ...d.product },
|
|
3379
3391
|
originalPrice: d.product.price,
|
|
3380
|
-
finalPrice: m ? m.finalPrice :
|
|
3381
|
-
finalDiscount: m ? m.finalDiscount :
|
|
3392
|
+
finalPrice: m ? m.finalPrice : xr(d.product),
|
|
3393
|
+
finalDiscount: m ? m.finalDiscount : br(d.product)
|
|
3382
3394
|
};
|
|
3383
3395
|
}), c = o.reduce(
|
|
3384
3396
|
(d, l) => {
|
|
@@ -3407,10 +3419,10 @@ function Lr({
|
|
|
3407
3419
|
);
|
|
3408
3420
|
return c.deliveryPrice && c.productsCost >= (t.freeDeliveryPrice ?? 0) ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, console.log("cartDetails", c), { items: o, ...c };
|
|
3409
3421
|
}
|
|
3410
|
-
const
|
|
3422
|
+
const kr = {
|
|
3411
3423
|
stores: "STORES",
|
|
3412
3424
|
companies: "COMPANIES"
|
|
3413
|
-
},
|
|
3425
|
+
}, wr = {
|
|
3414
3426
|
products: "products",
|
|
3415
3427
|
profiles: "profiles",
|
|
3416
3428
|
cart: "cart",
|
|
@@ -3420,10 +3432,11 @@ const xr = {
|
|
|
3420
3432
|
favorites: "favorites",
|
|
3421
3433
|
payments: "payments",
|
|
3422
3434
|
settings: "settings",
|
|
3423
|
-
discounts: "discounts"
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3435
|
+
discounts: "discounts",
|
|
3436
|
+
organizations: "organizations"
|
|
3437
|
+
}, Tr = {
|
|
3438
|
+
systemCollections: kr,
|
|
3439
|
+
storeCollections: wr,
|
|
3427
3440
|
// for client
|
|
3428
3441
|
getPath: ({
|
|
3429
3442
|
companyId: r,
|
|
@@ -3433,43 +3446,45 @@ const xr = {
|
|
|
3433
3446
|
}) => `${r}/${e}/${t}${n ? `/${n}` : ""}`,
|
|
3434
3447
|
// for backend
|
|
3435
3448
|
getDocPath: (r) => `{companyId}/{storeId}/${r}/{id}`
|
|
3436
|
-
},
|
|
3437
|
-
firestore:
|
|
3449
|
+
}, Br = {
|
|
3450
|
+
firestore: Tr
|
|
3438
3451
|
};
|
|
3439
3452
|
export {
|
|
3440
3453
|
fr as AddressSchema,
|
|
3441
3454
|
Ye as BaseCategorySchema,
|
|
3442
3455
|
gr as BundleDiscountStrategy,
|
|
3443
3456
|
Ge as CartItemProductSchema,
|
|
3444
|
-
|
|
3457
|
+
jr as CartSchema,
|
|
3445
3458
|
Re as CategorySchema,
|
|
3446
|
-
|
|
3459
|
+
Er as CompanySchema,
|
|
3447
3460
|
pr as DiscountConditionsSchema,
|
|
3448
3461
|
vr as DiscountEngine,
|
|
3449
|
-
|
|
3462
|
+
$r as DiscountSchema,
|
|
3450
3463
|
Ke as DiscountStrategyFactory,
|
|
3451
3464
|
yr as DiscountVariantSchema,
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3465
|
+
Rr as FavoriteProductSchema,
|
|
3466
|
+
Cr as FileSchema,
|
|
3467
|
+
Br as FirebaseAPI,
|
|
3455
3468
|
re as LocaleSchema,
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3469
|
+
Nr as LocaleValueSchema,
|
|
3470
|
+
Lr as NewOrganizationSchema,
|
|
3471
|
+
Or as NewProductSchema,
|
|
3472
|
+
Dr as OrderSchema,
|
|
3473
|
+
_r as OrganizationSchema,
|
|
3459
3474
|
He as ProductSchema,
|
|
3460
3475
|
Xe as ProfilePaymentTypeSchema,
|
|
3461
3476
|
hr as ProfileSchema,
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3477
|
+
Mr as StoreSchema,
|
|
3478
|
+
Zr as TFlattenCategorySchema,
|
|
3479
|
+
zr as calculatePercentageDiscount,
|
|
3465
3480
|
mr as clientTypesSchema,
|
|
3466
|
-
|
|
3467
|
-
|
|
3481
|
+
Pr as createEmptyProfile,
|
|
3482
|
+
Fr as ensureNonNegative,
|
|
3468
3483
|
et as formatCurrency,
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3484
|
+
Vr as formatCurrencyString,
|
|
3485
|
+
Ur as getCartCost,
|
|
3486
|
+
Ar as isFile,
|
|
3472
3487
|
M as notEmptyTextSchema,
|
|
3473
|
-
|
|
3488
|
+
Sr as numericTextSchema
|
|
3474
3489
|
};
|
|
3475
3490
|
//# sourceMappingURL=core.es.js.map
|