@jsdev_ninja/core 0.14.7 → 0.14.8
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 +149 -98
- 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 +91 -0
- package/dist/lib/entities/Budget.d.ts.map +1 -0
- package/dist/lib/entities/Budget.js +43 -0
- package/dist/lib/entities/index.d.ts +1 -0
- package/dist/lib/entities/index.d.ts.map +1 -1
- package/dist/lib/entities/index.js +1 -0
- package/dist/lib/firebase-api/index.d.ts +6 -0
- package/dist/lib/firebase-api/index.d.ts.map +1 -1
- package/dist/lib/firebase-api/index.js +2 -0
- 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 A extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
111
111
|
}
|
|
@@ -142,7 +142,7 @@ class N extends Error {
|
|
|
142
142
|
return a(this), r;
|
|
143
143
|
}
|
|
144
144
|
static assert(e) {
|
|
145
|
-
if (!(e instanceof
|
|
145
|
+
if (!(e instanceof A))
|
|
146
146
|
throw new Error(`Not a ZodError: ${e}`);
|
|
147
147
|
}
|
|
148
148
|
toString() {
|
|
@@ -164,7 +164,7 @@ class N extends Error {
|
|
|
164
164
|
return this.flatten();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
A.create = (n) => new A(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 A(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])$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[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])$/, 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 Ne;
|
|
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}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-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])))", At = 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 Nt(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 N 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 A extends _ {
|
|
|
665
665
|
message: i.message
|
|
666
666
|
}), r.dirty());
|
|
667
667
|
else if (i.kind === "emoji")
|
|
668
|
-
|
|
668
|
+
Ne || (Ne = new RegExp(bt, "u")), Ne.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 A 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" ? At.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" ? Nt(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 A extends _ {
|
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
_addCheck(e) {
|
|
776
|
-
return new
|
|
776
|
+
return new N({
|
|
777
777
|
...this._def,
|
|
778
778
|
checks: [...this._def.checks, e]
|
|
779
779
|
});
|
|
@@ -910,19 +910,19 @@ class A extends _ {
|
|
|
910
910
|
return this.min(1, h.errToObj(e));
|
|
911
911
|
}
|
|
912
912
|
trim() {
|
|
913
|
-
return new
|
|
913
|
+
return new N({
|
|
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 N({
|
|
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 N({
|
|
926
926
|
...this._def,
|
|
927
927
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
928
928
|
});
|
|
@@ -988,9 +988,9 @@ class A extends _ {
|
|
|
988
988
|
return e;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
|
|
991
|
+
N.create = (n) => {
|
|
992
992
|
var e;
|
|
993
|
-
return new
|
|
993
|
+
return new N({
|
|
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 A(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 A(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: N.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 A([]), 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 A([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 A([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 A(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 A(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 = N.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) => N.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: N,
|
|
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: A
|
|
2972
2972
|
});
|
|
2973
2973
|
const Se = s.object({
|
|
2974
2974
|
country: s.string().optional(),
|
|
@@ -2978,14 +2978,14 @@ const Se = s.object({
|
|
|
2978
2978
|
floor: s.string().optional(),
|
|
2979
2979
|
apartmentEnterNumber: s.string().optional(),
|
|
2980
2980
|
apartmentNumber: s.string().optional()
|
|
2981
|
-
}), R = s.string().min(1, { message: "שדה חובה" }),
|
|
2982
|
-
function
|
|
2981
|
+
}), R = s.string().min(1, { message: "שדה חובה" }), Mn = s.string().regex(/^\d+$/, "Must be a numeric string"), Vn = s.object({ url: s.string().url(), id: s.string() });
|
|
2982
|
+
function zn(n) {
|
|
2983
2983
|
return !!(n != null && n.url);
|
|
2984
2984
|
}
|
|
2985
2985
|
const ne = s.object({
|
|
2986
2986
|
lang: s.enum(["he"]),
|
|
2987
2987
|
value: s.string()
|
|
2988
|
-
}),
|
|
2988
|
+
}), Fn = s.array(ne), Je = s.object({
|
|
2989
2989
|
id: s.string().min(1),
|
|
2990
2990
|
companyId: s.string().min(1),
|
|
2991
2991
|
storeId: s.string().min(1),
|
|
@@ -2995,7 +2995,7 @@ const ne = s.object({
|
|
|
2995
2995
|
depth: s.number()
|
|
2996
2996
|
}), Ee = Je.extend({
|
|
2997
2997
|
children: s.lazy(() => Ee.array())
|
|
2998
|
-
}),
|
|
2998
|
+
}), Un = Je.extend({
|
|
2999
2999
|
index: s.number(),
|
|
3000
3000
|
depth: s.number(),
|
|
3001
3001
|
collapsed: s.boolean().optional(),
|
|
@@ -3057,7 +3057,7 @@ const ne = s.object({
|
|
|
3057
3057
|
}).optional(),
|
|
3058
3058
|
// @deprecated
|
|
3059
3059
|
categoryNames: s.array(s.string()).optional()
|
|
3060
|
-
}),
|
|
3060
|
+
}), Ln = He.extend({
|
|
3061
3061
|
image: s.instanceof(File).optional()
|
|
3062
3062
|
}), Ke = s.object({
|
|
3063
3063
|
product: He,
|
|
@@ -3065,7 +3065,7 @@ const ne = s.object({
|
|
|
3065
3065
|
finalPrice: s.number().optional(),
|
|
3066
3066
|
finalDiscount: s.number().optional(),
|
|
3067
3067
|
amount: s.number().positive({ message: "Quantity must be a positive number." })
|
|
3068
|
-
}),
|
|
3068
|
+
}), qn = s.object({
|
|
3069
3069
|
type: s.literal("Cart"),
|
|
3070
3070
|
id: s.string().uuid(),
|
|
3071
3071
|
companyId: s.string().uuid(),
|
|
@@ -3073,11 +3073,11 @@ const ne = s.object({
|
|
|
3073
3073
|
userId: s.string().uuid(),
|
|
3074
3074
|
status: s.enum(["active", "draft", "completed"]),
|
|
3075
3075
|
items: s.array(Ke)
|
|
3076
|
-
}),
|
|
3076
|
+
}), Bn = s.object({
|
|
3077
3077
|
id: s.string(),
|
|
3078
3078
|
name: s.string(),
|
|
3079
3079
|
websiteDomains: s.array(s.string())
|
|
3080
|
-
}),
|
|
3080
|
+
}), Wn = s.object({
|
|
3081
3081
|
type: s.literal("FavoriteProduct"),
|
|
3082
3082
|
id: s.string().uuid(),
|
|
3083
3083
|
companyId: s.string().uuid(),
|
|
@@ -3169,7 +3169,7 @@ const ne = s.object({
|
|
|
3169
3169
|
companyNumber: s.string().optional(),
|
|
3170
3170
|
address: Se.optional(),
|
|
3171
3171
|
groupId: s.string().optional()
|
|
3172
|
-
}),
|
|
3172
|
+
}), Qn = xn.omit({ id: !0 }), kn = s.object({
|
|
3173
3173
|
doc_uuid: s.string().uuid("Document UUID must be a valid UUID"),
|
|
3174
3174
|
pdf_link: s.string().url("PDF link must be a valid URL"),
|
|
3175
3175
|
pdf_link_copy: s.string().url("PDF copy link must be a valid URL"),
|
|
@@ -3209,7 +3209,7 @@ const ne = s.object({
|
|
|
3209
3209
|
total: s.number().min(1, "Total is required").optional(),
|
|
3210
3210
|
vat: s.number().min(1, "VAT is required").optional(),
|
|
3211
3211
|
link: s.string().url("Link must be a valid URL").optional()
|
|
3212
|
-
}),
|
|
3212
|
+
}), Yn = s.object({
|
|
3213
3213
|
type: s.literal("Order"),
|
|
3214
3214
|
createdBy: s.enum(["user", "admin"]).optional(),
|
|
3215
3215
|
id: R,
|
|
@@ -3265,7 +3265,7 @@ const ne = s.object({
|
|
|
3265
3265
|
invoice: wn.optional(),
|
|
3266
3266
|
ezInvoice: kn.optional(),
|
|
3267
3267
|
ezDeliveryNote: _n.optional()
|
|
3268
|
-
}), Tn = s.enum(["individual", "company"]),
|
|
3268
|
+
}), Tn = s.enum(["individual", "company"]), Xn = s.object({
|
|
3269
3269
|
id: s.string(),
|
|
3270
3270
|
companyId: s.string(),
|
|
3271
3271
|
name: s.string(),
|
|
@@ -3296,7 +3296,7 @@ const ne = s.object({
|
|
|
3296
3296
|
bundlePrice: s.number().positive()
|
|
3297
3297
|
// Total price for the bundle (e.g., $25)
|
|
3298
3298
|
})
|
|
3299
|
-
]),
|
|
3299
|
+
]), Gn = s.object({
|
|
3300
3300
|
type: s.literal("Discount"),
|
|
3301
3301
|
storeId: s.string().min(1),
|
|
3302
3302
|
companyId: s.string().min(1),
|
|
@@ -3308,7 +3308,7 @@ const ne = s.object({
|
|
|
3308
3308
|
variant: In,
|
|
3309
3309
|
conditions: Sn
|
|
3310
3310
|
});
|
|
3311
|
-
class
|
|
3311
|
+
class An {
|
|
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,9 +3376,9 @@ class nt {
|
|
|
3376
3376
|
}
|
|
3377
3377
|
}
|
|
3378
3378
|
Re(nt, "strategies", /* @__PURE__ */ new Map([
|
|
3379
|
-
["bundle", new
|
|
3379
|
+
["bundle", new An()]
|
|
3380
3380
|
]));
|
|
3381
|
-
class
|
|
3381
|
+
class Jn {
|
|
3382
3382
|
static calculateDiscounts(e, t, r) {
|
|
3383
3383
|
var d, f;
|
|
3384
3384
|
const a = {
|
|
@@ -3444,27 +3444,27 @@ class Xn {
|
|
|
3444
3444
|
function rt(n) {
|
|
3445
3445
|
return Number(n.toFixed(2));
|
|
3446
3446
|
}
|
|
3447
|
-
function
|
|
3447
|
+
function Hn(n) {
|
|
3448
3448
|
return n.toFixed(2);
|
|
3449
3449
|
}
|
|
3450
|
-
function
|
|
3450
|
+
function Kn(n) {
|
|
3451
3451
|
return Math.max(0, rt(n));
|
|
3452
3452
|
}
|
|
3453
|
-
function
|
|
3453
|
+
function er(n, e) {
|
|
3454
3454
|
if (n <= 0) return 0;
|
|
3455
3455
|
const t = n - e;
|
|
3456
3456
|
return rt(t / n * 100);
|
|
3457
3457
|
}
|
|
3458
|
-
const
|
|
3458
|
+
const Nn = s.object({
|
|
3459
3459
|
id: s.string(),
|
|
3460
3460
|
name: s.string()
|
|
3461
|
-
}),
|
|
3461
|
+
}), tr = Nn.omit({ id: !0 }), st = s.object({
|
|
3462
3462
|
type: s.literal("Supplier"),
|
|
3463
3463
|
id: s.string(),
|
|
3464
3464
|
name: s.string(),
|
|
3465
3465
|
code: s.string()
|
|
3466
3466
|
// supplier code number
|
|
3467
|
-
}),
|
|
3467
|
+
}), nr = st.omit({ id: !0 }), Cn = s.object({
|
|
3468
3468
|
type: s.literal("SupplierInvoice"),
|
|
3469
3469
|
id: s.string(),
|
|
3470
3470
|
supplier: st,
|
|
@@ -3505,7 +3505,7 @@ const An = s.object({
|
|
|
3505
3505
|
total: s.number().optional(),
|
|
3506
3506
|
totalBeforeVat: s.number().optional(),
|
|
3507
3507
|
vat: s.number().optional()
|
|
3508
|
-
}),
|
|
3508
|
+
}), rr = Cn.omit({ id: !0 }), sr = s.object({
|
|
3509
3509
|
type: s.literal("ChatSession"),
|
|
3510
3510
|
id: s.string(),
|
|
3511
3511
|
storeId: s.string(),
|
|
@@ -3517,7 +3517,7 @@ const An = s.object({
|
|
|
3517
3517
|
updatedAt: s.number(),
|
|
3518
3518
|
messageCount: s.number(),
|
|
3519
3519
|
status: s.enum(["active", "archived"])
|
|
3520
|
-
}),
|
|
3520
|
+
}), ar = s.discriminatedUnion("type", [
|
|
3521
3521
|
s.object({
|
|
3522
3522
|
type: s.literal("message"),
|
|
3523
3523
|
id: s.string(),
|
|
@@ -3539,14 +3539,59 @@ const An = s.object({
|
|
|
3539
3539
|
result: s.any(),
|
|
3540
3540
|
timestamp: s.number()
|
|
3541
3541
|
})
|
|
3542
|
-
]),
|
|
3542
|
+
]), jn = s.enum([
|
|
3543
|
+
"order_created",
|
|
3544
|
+
"payment_received",
|
|
3545
|
+
"order_cancelled",
|
|
3546
|
+
"order_refunded",
|
|
3547
|
+
"credit_note",
|
|
3548
|
+
"debit_note"
|
|
3549
|
+
]), Zn = s.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ir = s.object({
|
|
3550
|
+
id: s.string(),
|
|
3551
|
+
type: jn,
|
|
3552
|
+
// positive = debt added (order/debit note), negative = debt reduced (payment/cancellation)
|
|
3553
|
+
debt: s.number(),
|
|
3554
|
+
runningBalance: s.number(),
|
|
3555
|
+
// order reference
|
|
3556
|
+
orderId: s.string().nullable(),
|
|
3557
|
+
orderTotal: s.number().nullable(),
|
|
3558
|
+
// billing account snapshot (if order had one)
|
|
3559
|
+
billingAccountId: s.string().nullable(),
|
|
3560
|
+
billingAccountName: s.string().nullable(),
|
|
3561
|
+
billingAccountNumber: s.string().nullable(),
|
|
3562
|
+
// payment details (for payment_received type — entered by admin)
|
|
3563
|
+
paymentReference: s.string().nullable(),
|
|
3564
|
+
// check number, bank transfer ref, etc.
|
|
3565
|
+
paymentDate: s.number().nullable(),
|
|
3566
|
+
// timestamp
|
|
3567
|
+
paymentMethod: Zn.nullable(),
|
|
3568
|
+
note: s.string().nullable(),
|
|
3569
|
+
createdAt: s.number(),
|
|
3570
|
+
createdBy: s.string()
|
|
3571
|
+
// userId or "system"
|
|
3572
|
+
}), or = s.object({
|
|
3573
|
+
id: s.string(),
|
|
3574
|
+
// organizationId
|
|
3575
|
+
organizationId: s.string(),
|
|
3576
|
+
organizationName: s.string(),
|
|
3577
|
+
companyId: s.string(),
|
|
3578
|
+
storeId: s.string(),
|
|
3579
|
+
totalDebits: s.number(),
|
|
3580
|
+
// sum of order amounts
|
|
3581
|
+
totalCredits: s.number(),
|
|
3582
|
+
// sum of payments received
|
|
3583
|
+
balance: s.number(),
|
|
3584
|
+
// totalDebits - totalCredits (positive = owes money)
|
|
3585
|
+
currency: s.literal("ILS"),
|
|
3586
|
+
updatedAt: s.number()
|
|
3587
|
+
}), De = {
|
|
3543
3588
|
VAT: 18
|
|
3544
3589
|
};
|
|
3545
|
-
function
|
|
3590
|
+
function On(n, e) {
|
|
3546
3591
|
var t, r;
|
|
3547
3592
|
return ((t = n.discount) == null ? void 0 : t.type) === "percent" ? n.price * (n.discount.value ?? 100) / 100 : ((r = n.discount) == null ? void 0 : r.type) === "number" ? n.discount.value ?? 0 : 0;
|
|
3548
3593
|
}
|
|
3549
|
-
function
|
|
3594
|
+
function Dn(n, e) {
|
|
3550
3595
|
var r, a;
|
|
3551
3596
|
const t = e && n.vat ? n.price + n.price * De.VAT / 100 : n.price;
|
|
3552
3597
|
if (((r = n.discount) == null ? void 0 : r.type) === "percent") {
|
|
@@ -3555,7 +3600,7 @@ function Zn(n, e) {
|
|
|
3555
3600
|
}
|
|
3556
3601
|
return ((a = n.discount) == null ? void 0 : a.type) === "number" ? t - n.discount.value : t;
|
|
3557
3602
|
}
|
|
3558
|
-
function
|
|
3603
|
+
function cr({
|
|
3559
3604
|
cart: n,
|
|
3560
3605
|
discounts: e,
|
|
3561
3606
|
deliveryPrice: t = 0,
|
|
@@ -3566,20 +3611,20 @@ function sr({
|
|
|
3566
3611
|
amount: o.amount,
|
|
3567
3612
|
product: { ...o.product },
|
|
3568
3613
|
originalPrice: o.product.price,
|
|
3569
|
-
finalPrice:
|
|
3570
|
-
finalDiscount:
|
|
3614
|
+
finalPrice: Dn(o.product, a),
|
|
3615
|
+
finalDiscount: On(o.product)
|
|
3571
3616
|
})), c = i.reduce(
|
|
3572
3617
|
(o, l) => {
|
|
3573
3618
|
const { product: d, amount: f, finalPrice: x, finalDiscount: T } = l;
|
|
3574
3619
|
let w = 0;
|
|
3575
3620
|
if (d.vat) {
|
|
3576
|
-
let
|
|
3621
|
+
let Ae = 0;
|
|
3577
3622
|
if (a) {
|
|
3578
3623
|
const at = Number((x / (1 + De.VAT / 100)).toFixed(2)), it = x - at;
|
|
3579
|
-
w = Number(it.toFixed(2)), w = w * f,
|
|
3624
|
+
w = Number(it.toFixed(2)), w = w * f, Ae = Number(w.toFixed(2));
|
|
3580
3625
|
} else
|
|
3581
|
-
w = x * De.VAT / 100, w = w * f,
|
|
3582
|
-
o.vat = Number((o.vat +
|
|
3626
|
+
w = x * De.VAT / 100, w = w * f, Ae = Number(w.toFixed(2));
|
|
3627
|
+
o.vat = Number((o.vat + Ae).toFixed(2));
|
|
3583
3628
|
}
|
|
3584
3629
|
const H = Number(x.toFixed(2));
|
|
3585
3630
|
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;
|
|
@@ -3595,10 +3640,10 @@ function sr({
|
|
|
3595
3640
|
);
|
|
3596
3641
|
return c.deliveryPrice && c.productsCost >= r ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, { items: i, ...c };
|
|
3597
3642
|
}
|
|
3598
|
-
const
|
|
3643
|
+
const Pn = {
|
|
3599
3644
|
stores: "STORES",
|
|
3600
3645
|
companies: "COMPANIES"
|
|
3601
|
-
},
|
|
3646
|
+
}, En = {
|
|
3602
3647
|
products: "products",
|
|
3603
3648
|
"favorite-products": "favorite-products",
|
|
3604
3649
|
profiles: "profiles",
|
|
@@ -3617,10 +3662,12 @@ const On = {
|
|
|
3617
3662
|
supplierInvoices: "supplierInvoices",
|
|
3618
3663
|
chatSessions: "chatSessions",
|
|
3619
3664
|
chatSessionMessages: "chatSessionMessages",
|
|
3620
|
-
contactSubmissions: "contactSubmissions"
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3665
|
+
contactSubmissions: "contactSubmissions",
|
|
3666
|
+
budgetAccounts: "budgetAccounts",
|
|
3667
|
+
budgetTransactions: "budgetTransactions"
|
|
3668
|
+
}, Rn = {
|
|
3669
|
+
systemCollections: Pn,
|
|
3670
|
+
storeCollections: En,
|
|
3624
3671
|
// for client and server
|
|
3625
3672
|
getPath: ({
|
|
3626
3673
|
companyId: n,
|
|
@@ -3639,14 +3686,14 @@ const On = {
|
|
|
3639
3686
|
// for firestore events
|
|
3640
3687
|
getDocPath: (n) => `{companyId}/{storeId}/${n}/{id}`,
|
|
3641
3688
|
getSubDocPath: (n, e, t) => `{companyId}/{storeId}/${n}/${e}/${t}/{id}`
|
|
3642
|
-
},
|
|
3643
|
-
firestore:
|
|
3689
|
+
}, ur = {
|
|
3690
|
+
firestore: Rn
|
|
3644
3691
|
}, ze = {
|
|
3645
3692
|
round: (n, e = 2) => {
|
|
3646
3693
|
const t = 10 ** e;
|
|
3647
3694
|
return Math.round((n + Number.EPSILON) * t) / t;
|
|
3648
3695
|
}
|
|
3649
|
-
},
|
|
3696
|
+
}, dr = {
|
|
3650
3697
|
calcSalePriceFromMargin: (n, e) => n <= 0 || e <= 0 || n >= 100 ? e : ze.round(e / (1 - n / 100)),
|
|
3651
3698
|
calcMarginFromSalePrice: (n, e) => n <= 0 || e <= 0 ? 0 : ze.round((n - e) / n * 100)
|
|
3652
3699
|
};
|
|
@@ -3654,51 +3701,55 @@ export {
|
|
|
3654
3701
|
Se as AddressSchema,
|
|
3655
3702
|
Je as BaseCategorySchema,
|
|
3656
3703
|
tt as BillingAccountSchema,
|
|
3657
|
-
|
|
3704
|
+
or as BudgetAccountSchema,
|
|
3705
|
+
ir as BudgetTransactionSchema,
|
|
3706
|
+
jn as BudgetTransactionTypeSchema,
|
|
3707
|
+
An as BundleDiscountStrategy,
|
|
3658
3708
|
et as CalculatedDataSchema,
|
|
3659
3709
|
Ke as CartItemProductSchema,
|
|
3660
|
-
|
|
3710
|
+
qn as CartSchema,
|
|
3661
3711
|
Ee as CategorySchema,
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3712
|
+
ar as ChatSessionMessageSchema,
|
|
3713
|
+
sr as ChatSessionSchema,
|
|
3714
|
+
Bn as CompanySchema,
|
|
3665
3715
|
bn as DeliveryNoteSchema,
|
|
3666
3716
|
Sn as DiscountConditionsSchema,
|
|
3667
|
-
|
|
3668
|
-
|
|
3717
|
+
Jn as DiscountEngine,
|
|
3718
|
+
Gn as DiscountSchema,
|
|
3669
3719
|
nt as DiscountStrategyFactory,
|
|
3670
3720
|
In as DiscountVariantSchema,
|
|
3671
3721
|
_n as EzDeliveryNoteSchema,
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3722
|
+
Wn as FavoriteProductSchema,
|
|
3723
|
+
Vn as FileSchema,
|
|
3724
|
+
ur as FirebaseAPI,
|
|
3675
3725
|
ne as LocaleSchema,
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3726
|
+
Fn as LocaleValueSchema,
|
|
3727
|
+
tr as NewOrganizationGroupSchema,
|
|
3728
|
+
Qn as NewOrganizationSchema,
|
|
3729
|
+
Ln as NewProductSchema,
|
|
3730
|
+
rr as NewSupplierInvoiceSchema,
|
|
3731
|
+
nr as NewSupplierSchema,
|
|
3732
|
+
Yn as OrderSchema,
|
|
3733
|
+
Nn as OrganizationGroupSchema,
|
|
3684
3734
|
xn as OrganizationSchema,
|
|
3735
|
+
Zn as PaymentMethodSchema,
|
|
3685
3736
|
Ie as PaymentTypeSchema,
|
|
3686
3737
|
He as ProductSchema,
|
|
3687
3738
|
vn as ProfileSchema,
|
|
3688
|
-
|
|
3739
|
+
Xn as StoreSchema,
|
|
3689
3740
|
Cn as SupplierInvoiceSchema,
|
|
3690
3741
|
st as SupplierSchema,
|
|
3691
|
-
|
|
3692
|
-
|
|
3742
|
+
Un as TFlattenCategorySchema,
|
|
3743
|
+
er as calculatePercentageDiscount,
|
|
3693
3744
|
Tn as clientTypesSchema,
|
|
3694
|
-
|
|
3745
|
+
Kn as ensureNonNegative,
|
|
3695
3746
|
rt as formatCurrency,
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3747
|
+
Hn as formatCurrencyString,
|
|
3748
|
+
cr as getCartCost,
|
|
3749
|
+
zn as isFile,
|
|
3699
3750
|
ze as math,
|
|
3700
3751
|
R as notEmptyTextSchema,
|
|
3701
|
-
|
|
3702
|
-
|
|
3752
|
+
Mn as numericTextSchema,
|
|
3753
|
+
dr as storeCalculator
|
|
3703
3754
|
};
|
|
3704
3755
|
//# sourceMappingURL=core.es.js.map
|