@jsdev_ninja/core 0.14.8 → 0.14.9
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 +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.es.js +52 -45
- 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/Budget.d.ts +10 -4
- package/dist/lib/entities/Budget.d.ts.map +1 -1
- package/dist/lib/entities/Budget.js +9 -5
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -105,7 +105,7 @@ const p = b.arrayToEnum([
|
|
|
105
105
|
"not_multiple_of",
|
|
106
106
|
"not_finite"
|
|
107
107
|
]), ut = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
108
|
-
class
|
|
108
|
+
class N extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
111
111
|
}
|
|
@@ -142,7 +142,7 @@ class A extends Error {
|
|
|
142
142
|
return a(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 A 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) {
|
|
@@ -342,7 +342,7 @@ const $e = (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
|
};
|
|
@@ -580,13 +580,13 @@ class _ {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
const mt = /^c[^\s-]{8,}$/i, pt = /^[0-9a-z]+$/, ft = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ht = /^[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, gt = /^[a-z0-9_-]{21}$/i, yt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, vt = /^[-+]?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)?)??$/, _t = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, bt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
|
-
let
|
|
584
|
-
const 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])$/, kt = /^(?:(?: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])$/, wt = /^(([0-9a-fA-F]{1,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,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])$/, St = /^([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}(=)?))?$/, Le = "((\\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])))",
|
|
583
|
+
let Ae;
|
|
584
|
+
const 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])$/, kt = /^(?:(?: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])$/, 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]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1-9]?[0-9])$/, St = /^([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}(=)?))?$/, Le = "((\\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])))", Nt = new RegExp(`^${Le}$`);
|
|
585
585
|
function qe(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 At(n) {
|
|
590
590
|
return new RegExp(`^${qe(n)}$`);
|
|
591
591
|
}
|
|
592
592
|
function Be(n) {
|
|
@@ -610,7 +610,7 @@ function jt(n, e) {
|
|
|
610
610
|
function Zt(n, e) {
|
|
611
611
|
return !!((e === "v4" || !e) && kt.test(n) || (e === "v6" || !e) && Tt.test(n));
|
|
612
612
|
}
|
|
613
|
-
class
|
|
613
|
+
class A extends _ {
|
|
614
614
|
_parse(e) {
|
|
615
615
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
616
616
|
const i = this._getOrReturnCtx(e);
|
|
@@ -665,7 +665,7 @@ class N extends _ {
|
|
|
665
665
|
message: i.message
|
|
666
666
|
}), r.dirty());
|
|
667
667
|
else if (i.kind === "emoji")
|
|
668
|
-
|
|
668
|
+
Ae || (Ae = new RegExp(bt, "u")), Ae.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
669
669
|
validation: "emoji",
|
|
670
670
|
code: u.invalid_string,
|
|
671
671
|
message: i.message
|
|
@@ -730,11 +730,11 @@ class N extends _ {
|
|
|
730
730
|
code: u.invalid_string,
|
|
731
731
|
validation: "datetime",
|
|
732
732
|
message: i.message
|
|
733
|
-
}), r.dirty()) : i.kind === "date" ?
|
|
733
|
+
}), r.dirty()) : i.kind === "date" ? Nt.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
734
734
|
code: u.invalid_string,
|
|
735
735
|
validation: "date",
|
|
736
736
|
message: i.message
|
|
737
|
-
}), r.dirty()) : i.kind === "time" ?
|
|
737
|
+
}), r.dirty()) : i.kind === "time" ? At(i).test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
|
|
738
738
|
code: u.invalid_string,
|
|
739
739
|
validation: "time",
|
|
740
740
|
message: i.message
|
|
@@ -773,7 +773,7 @@ class N extends _ {
|
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
_addCheck(e) {
|
|
776
|
-
return new
|
|
776
|
+
return new A({
|
|
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 A({
|
|
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 A({
|
|
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 A({
|
|
926
926
|
...this._def,
|
|
927
927
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
928
928
|
});
|
|
@@ -988,9 +988,9 @@ class N extends _ {
|
|
|
988
988
|
return e;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
|
|
991
|
+
A.create = (n) => {
|
|
992
992
|
var e;
|
|
993
|
-
return new
|
|
993
|
+
return new A({
|
|
994
994
|
checks: [],
|
|
995
995
|
typeName: g.ZodString,
|
|
996
996
|
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -1897,7 +1897,7 @@ class oe extends _ {
|
|
|
1897
1897
|
for (const o of i)
|
|
1898
1898
|
if (o.result.status === "dirty")
|
|
1899
1899
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1900
|
-
const c = i.map((o) => new
|
|
1900
|
+
const c = i.map((o) => new N(o.ctx.common.issues));
|
|
1901
1901
|
return m(t, {
|
|
1902
1902
|
code: u.invalid_union,
|
|
1903
1903
|
unionErrors: c
|
|
@@ -1944,7 +1944,7 @@ class oe extends _ {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
if (i)
|
|
1946
1946
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
1947
|
-
const o = c.map((l) => new
|
|
1947
|
+
const o = c.map((l) => new N(l));
|
|
1948
1948
|
return m(t, {
|
|
1949
1949
|
code: u.invalid_union,
|
|
1950
1950
|
unionErrors: o
|
|
@@ -2171,7 +2171,7 @@ class ue extends _ {
|
|
|
2171
2171
|
typeName: g.ZodRecord,
|
|
2172
2172
|
...v(r)
|
|
2173
2173
|
}) : new ue({
|
|
2174
|
-
keyType:
|
|
2174
|
+
keyType: A.create(),
|
|
2175
2175
|
valueType: e,
|
|
2176
2176
|
typeName: g.ZodRecord,
|
|
2177
2177
|
...v(t)
|
|
@@ -2338,7 +2338,7 @@ class Y extends _ {
|
|
|
2338
2338
|
if (this._def.returns instanceof J) {
|
|
2339
2339
|
const o = this;
|
|
2340
2340
|
return I(async function(...l) {
|
|
2341
|
-
const d = new
|
|
2341
|
+
const d = new N([]), f = await o._def.args.parseAsync(l, i).catch((w) => {
|
|
2342
2342
|
throw d.addIssue(r(l, w)), d;
|
|
2343
2343
|
}), x = await Reflect.apply(c, this, f);
|
|
2344
2344
|
return await o._def.returns._def.type.parseAsync(x, i).catch((w) => {
|
|
@@ -2350,10 +2350,10 @@ class Y extends _ {
|
|
|
2350
2350
|
return I(function(...l) {
|
|
2351
2351
|
const d = o._def.args.safeParse(l, i);
|
|
2352
2352
|
if (!d.success)
|
|
2353
|
-
throw new
|
|
2353
|
+
throw new N([r(l, d.error)]);
|
|
2354
2354
|
const f = Reflect.apply(c, this, d.data), x = o._def.returns.safeParse(f, i);
|
|
2355
2355
|
if (!x.success)
|
|
2356
|
-
throw new
|
|
2356
|
+
throw new N([a(f, x.error)]);
|
|
2357
2357
|
return x.data;
|
|
2358
2358
|
});
|
|
2359
2359
|
}
|
|
@@ -2704,7 +2704,7 @@ class fe extends _ {
|
|
|
2704
2704
|
status: "valid",
|
|
2705
2705
|
value: i.status === "valid" ? i.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 fe extends _ {
|
|
|
2712
2712
|
status: "valid",
|
|
2713
2713
|
value: a.status === "valid" ? a.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
|
})
|
|
@@ -2844,8 +2844,8 @@ var g;
|
|
|
2844
2844
|
})(g || (g = {}));
|
|
2845
2845
|
const Et = (n, e = {
|
|
2846
2846
|
message: `Input not instance of ${n.name}`
|
|
2847
|
-
}) => Qe((t) => t instanceof n, e), Ye =
|
|
2848
|
-
string: (n) =>
|
|
2847
|
+
}) => Qe((t) => t instanceof n, e), Ye = A.create, Xe = M.create, Rt = we.create, $t = V.create, Ge = se.create, Mt = q.create, Vt = be.create, zt = ae.create, Ft = ie.create, Ut = G.create, Lt = U.create, qt = $.create, Bt = xe.create, Wt = C.create, Qt = k.create, Yt = k.strictCreate, Xt = oe.create, Gt = Te.create, Jt = ce.create, Ht = D.create, Kt = ue.create, en = ke.create, tn = B.create, nn = Y.create, rn = de.create, sn = le.create, an = z.create, on = me.create, cn = J.create, Ve = j.create, un = Z.create, dn = F.create, ln = j.createWithPreprocess, mn = ge.create, pn = () => Ye().optional(), fn = () => Xe().optional(), hn = () => Ge().optional(), gn = {
|
|
2848
|
+
string: (n) => A.create({ ...n, coerce: !0 }),
|
|
2849
2849
|
number: (n) => M.create({ ...n, coerce: !0 }),
|
|
2850
2850
|
boolean: (n) => se.create({
|
|
2851
2851
|
...n,
|
|
@@ -2880,7 +2880,7 @@ var s = /* @__PURE__ */ Object.freeze({
|
|
|
2880
2880
|
getParsedType: E,
|
|
2881
2881
|
ZodType: _,
|
|
2882
2882
|
datetimeRegex: Be,
|
|
2883
|
-
ZodString:
|
|
2883
|
+
ZodString: A,
|
|
2884
2884
|
ZodNumber: M,
|
|
2885
2885
|
ZodBigInt: V,
|
|
2886
2886
|
ZodBoolean: se,
|
|
@@ -2968,7 +2968,7 @@ var s = /* @__PURE__ */ Object.freeze({
|
|
|
2968
2968
|
NEVER: yn,
|
|
2969
2969
|
ZodIssueCode: u,
|
|
2970
2970
|
quotelessJson: ut,
|
|
2971
|
-
ZodError:
|
|
2971
|
+
ZodError: N
|
|
2972
2972
|
});
|
|
2973
2973
|
const Se = s.object({
|
|
2974
2974
|
country: s.string().optional(),
|
|
@@ -3308,7 +3308,7 @@ const ne = s.object({
|
|
|
3308
3308
|
variant: In,
|
|
3309
3309
|
conditions: Sn
|
|
3310
3310
|
});
|
|
3311
|
-
class
|
|
3311
|
+
class Nn {
|
|
3312
3312
|
canApply(e, t) {
|
|
3313
3313
|
if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
|
|
3314
3314
|
const { productsId: r, requiredQuantity: a } = e.variant;
|
|
@@ -3376,7 +3376,7 @@ class nt {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
}
|
|
3378
3378
|
Re(nt, "strategies", /* @__PURE__ */ new Map([
|
|
3379
|
-
["bundle", new
|
|
3379
|
+
["bundle", new Nn()]
|
|
3380
3380
|
]));
|
|
3381
3381
|
class Jn {
|
|
3382
3382
|
static calculateDiscounts(e, t, r) {
|
|
@@ -3455,10 +3455,10 @@ function er(n, e) {
|
|
|
3455
3455
|
const t = n - e;
|
|
3456
3456
|
return rt(t / n * 100);
|
|
3457
3457
|
}
|
|
3458
|
-
const
|
|
3458
|
+
const An = s.object({
|
|
3459
3459
|
id: s.string(),
|
|
3460
3460
|
name: s.string()
|
|
3461
|
-
}), tr =
|
|
3461
|
+
}), tr = An.omit({ id: !0 }), st = s.object({
|
|
3462
3462
|
type: s.literal("Supplier"),
|
|
3463
3463
|
id: s.string(),
|
|
3464
3464
|
name: s.string(),
|
|
@@ -3540,21 +3540,28 @@ const Nn = s.object({
|
|
|
3540
3540
|
timestamp: s.number()
|
|
3541
3541
|
})
|
|
3542
3542
|
]), jn = s.enum([
|
|
3543
|
-
"
|
|
3543
|
+
"delivery_note",
|
|
3544
3544
|
"payment_received",
|
|
3545
|
-
"order_cancelled",
|
|
3546
|
-
"order_refunded",
|
|
3547
3545
|
"credit_note",
|
|
3548
|
-
"debit_note"
|
|
3546
|
+
"debit_note",
|
|
3547
|
+
"order_created",
|
|
3548
|
+
// legacy — no longer used for new transactions
|
|
3549
|
+
"order_cancelled",
|
|
3550
|
+
// legacy
|
|
3551
|
+
"order_refunded"
|
|
3552
|
+
// legacy
|
|
3549
3553
|
]), Zn = s.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ir = s.object({
|
|
3550
3554
|
id: s.string(),
|
|
3551
3555
|
type: jn,
|
|
3552
|
-
// positive = debt added (
|
|
3556
|
+
// positive = debt added (delivery note / debit note), negative = debt reduced (payment / credit)
|
|
3553
3557
|
debt: s.number(),
|
|
3554
3558
|
runningBalance: s.number(),
|
|
3555
3559
|
// order reference
|
|
3556
3560
|
orderId: s.string().nullable(),
|
|
3557
3561
|
orderTotal: s.number().nullable(),
|
|
3562
|
+
// delivery note reference (for delivery_note type)
|
|
3563
|
+
deliveryNoteId: s.string().nullable(),
|
|
3564
|
+
deliveryNoteNumber: s.string().nullable(),
|
|
3558
3565
|
// billing account snapshot (if order had one)
|
|
3559
3566
|
billingAccountId: s.string().nullable(),
|
|
3560
3567
|
billingAccountName: s.string().nullable(),
|
|
@@ -3577,7 +3584,7 @@ const Nn = s.object({
|
|
|
3577
3584
|
companyId: s.string(),
|
|
3578
3585
|
storeId: s.string(),
|
|
3579
3586
|
totalDebits: s.number(),
|
|
3580
|
-
// sum of
|
|
3587
|
+
// sum of delivery note amounts
|
|
3581
3588
|
totalCredits: s.number(),
|
|
3582
3589
|
// sum of payments received
|
|
3583
3590
|
balance: s.number(),
|
|
@@ -3618,13 +3625,13 @@ function cr({
|
|
|
3618
3625
|
const { product: d, amount: f, finalPrice: x, finalDiscount: T } = l;
|
|
3619
3626
|
let w = 0;
|
|
3620
3627
|
if (d.vat) {
|
|
3621
|
-
let
|
|
3628
|
+
let Ne = 0;
|
|
3622
3629
|
if (a) {
|
|
3623
3630
|
const at = Number((x / (1 + De.VAT / 100)).toFixed(2)), it = x - at;
|
|
3624
|
-
w = Number(it.toFixed(2)), w = w * f,
|
|
3631
|
+
w = Number(it.toFixed(2)), w = w * f, Ne = Number(w.toFixed(2));
|
|
3625
3632
|
} else
|
|
3626
|
-
w = x * De.VAT / 100, w = w * f,
|
|
3627
|
-
o.vat = Number((o.vat +
|
|
3633
|
+
w = x * De.VAT / 100, w = w * f, Ne = Number(w.toFixed(2));
|
|
3634
|
+
o.vat = Number((o.vat + Ne).toFixed(2));
|
|
3628
3635
|
}
|
|
3629
3636
|
const H = Number(x.toFixed(2));
|
|
3630
3637
|
return o.cost += f * H, o.discount += T && f * T, o.finalCost += f * H + (a ? 0 : w), o.productsCost += f * H + (a ? 0 : w), o.cost = Number(o.cost.toFixed(2)), o.discount = Number(o.discount.toFixed(2)), o.finalCost = Number(o.finalCost.toFixed(2)), o.productsCost = Number(o.productsCost.toFixed(2)), o;
|
|
@@ -3704,7 +3711,7 @@ export {
|
|
|
3704
3711
|
or as BudgetAccountSchema,
|
|
3705
3712
|
ir as BudgetTransactionSchema,
|
|
3706
3713
|
jn as BudgetTransactionTypeSchema,
|
|
3707
|
-
|
|
3714
|
+
Nn as BundleDiscountStrategy,
|
|
3708
3715
|
et as CalculatedDataSchema,
|
|
3709
3716
|
Ke as CartItemProductSchema,
|
|
3710
3717
|
qn as CartSchema,
|
|
@@ -3730,7 +3737,7 @@ export {
|
|
|
3730
3737
|
rr as NewSupplierInvoiceSchema,
|
|
3731
3738
|
nr as NewSupplierSchema,
|
|
3732
3739
|
Yn as OrderSchema,
|
|
3733
|
-
|
|
3740
|
+
An as OrganizationGroupSchema,
|
|
3734
3741
|
xn as OrganizationSchema,
|
|
3735
3742
|
Zn as PaymentMethodSchema,
|
|
3736
3743
|
Ie as PaymentTypeSchema,
|