@jsdev_ninja/core 0.14.8 → 0.15.0

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.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 A extends Error {
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 A))
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
- A.create = (n) => new A(n);
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 A(n.common.issues);
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 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}:){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]))$/, Tt = /^(([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])$/, 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}$`);
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]{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]))$/, Tt = /^(([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])$/, 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 Nt(n) {
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 N extends _ {
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
- Ne || (Ne = new RegExp(bt, "u")), Ne.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
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" ? At.test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
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" ? Nt(i).test(e.data) || (a = this._getOrReturnCtx(e, a), m(a, {
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 N({
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 N({
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 N({
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 N({
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
- N.create = (n) => {
991
+ A.create = (n) => {
992
992
  var e;
993
- return new N({
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 A(o.ctx.common.issues));
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 A(l));
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: N.create(),
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 A([]), f = await o._def.args.parseAsync(l, i).catch((w) => {
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 A([r(l, d.error)]);
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 A([a(f, x.error)]);
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 A(r.common.issues);
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 A(r.common.issues);
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 = 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 }),
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: N,
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: A
2971
+ ZodError: N
2972
2972
  });
2973
2973
  const Se = s.object({
2974
2974
  country: s.string().optional(),
@@ -3102,7 +3102,10 @@ const ne = s.object({
3102
3102
  lastActivityDate: s.number(),
3103
3103
  //todo
3104
3104
  paymentType: Ie.optional(),
3105
- organizationId: s.string().optional().nullable()
3105
+ /** @deprecated Use organizationIds instead */
3106
+ organizationId: s.string().optional().nullable(),
3107
+ /** Array of organization IDs this user belongs to */
3108
+ organizationIds: s.array(s.string()).optional()
3106
3109
  }), et = s.object({
3107
3110
  _COMMENT: s.string().optional(),
3108
3111
  transaction_id: s.string(),
@@ -3308,7 +3311,7 @@ const ne = s.object({
3308
3311
  variant: In,
3309
3312
  conditions: Sn
3310
3313
  });
3311
- class An {
3314
+ class Nn {
3312
3315
  canApply(e, t) {
3313
3316
  if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
3314
3317
  const { productsId: r, requiredQuantity: a } = e.variant;
@@ -3376,7 +3379,7 @@ class nt {
3376
3379
  }
3377
3380
  }
3378
3381
  Re(nt, "strategies", /* @__PURE__ */ new Map([
3379
- ["bundle", new An()]
3382
+ ["bundle", new Nn()]
3380
3383
  ]));
3381
3384
  class Jn {
3382
3385
  static calculateDiscounts(e, t, r) {
@@ -3455,10 +3458,10 @@ function er(n, e) {
3455
3458
  const t = n - e;
3456
3459
  return rt(t / n * 100);
3457
3460
  }
3458
- const Nn = s.object({
3461
+ const An = s.object({
3459
3462
  id: s.string(),
3460
3463
  name: s.string()
3461
- }), tr = Nn.omit({ id: !0 }), st = s.object({
3464
+ }), tr = An.omit({ id: !0 }), st = s.object({
3462
3465
  type: s.literal("Supplier"),
3463
3466
  id: s.string(),
3464
3467
  name: s.string(),
@@ -3540,21 +3543,28 @@ const Nn = s.object({
3540
3543
  timestamp: s.number()
3541
3544
  })
3542
3545
  ]), jn = s.enum([
3543
- "order_created",
3546
+ "delivery_note",
3544
3547
  "payment_received",
3545
- "order_cancelled",
3546
- "order_refunded",
3547
3548
  "credit_note",
3548
- "debit_note"
3549
+ "debit_note",
3550
+ "order_created",
3551
+ // legacy — no longer used for new transactions
3552
+ "order_cancelled",
3553
+ // legacy
3554
+ "order_refunded"
3555
+ // legacy
3549
3556
  ]), Zn = s.enum(["check", "bank_transfer", "cash", "credit_card", "other"]), ir = s.object({
3550
3557
  id: s.string(),
3551
3558
  type: jn,
3552
- // positive = debt added (order/debit note), negative = debt reduced (payment/cancellation)
3559
+ // positive = debt added (delivery note / debit note), negative = debt reduced (payment / credit)
3553
3560
  debt: s.number(),
3554
3561
  runningBalance: s.number(),
3555
3562
  // order reference
3556
3563
  orderId: s.string().nullable(),
3557
3564
  orderTotal: s.number().nullable(),
3565
+ // delivery note reference (for delivery_note type)
3566
+ deliveryNoteId: s.string().nullable(),
3567
+ deliveryNoteNumber: s.string().nullable(),
3558
3568
  // billing account snapshot (if order had one)
3559
3569
  billingAccountId: s.string().nullable(),
3560
3570
  billingAccountName: s.string().nullable(),
@@ -3577,7 +3587,7 @@ const Nn = s.object({
3577
3587
  companyId: s.string(),
3578
3588
  storeId: s.string(),
3579
3589
  totalDebits: s.number(),
3580
- // sum of order amounts
3590
+ // sum of delivery note amounts
3581
3591
  totalCredits: s.number(),
3582
3592
  // sum of payments received
3583
3593
  balance: s.number(),
@@ -3618,13 +3628,13 @@ function cr({
3618
3628
  const { product: d, amount: f, finalPrice: x, finalDiscount: T } = l;
3619
3629
  let w = 0;
3620
3630
  if (d.vat) {
3621
- let Ae = 0;
3631
+ let Ne = 0;
3622
3632
  if (a) {
3623
3633
  const at = Number((x / (1 + De.VAT / 100)).toFixed(2)), it = x - at;
3624
- w = Number(it.toFixed(2)), w = w * f, Ae = Number(w.toFixed(2));
3634
+ w = Number(it.toFixed(2)), w = w * f, Ne = Number(w.toFixed(2));
3625
3635
  } else
3626
- w = x * De.VAT / 100, w = w * f, Ae = Number(w.toFixed(2));
3627
- o.vat = Number((o.vat + Ae).toFixed(2));
3636
+ w = x * De.VAT / 100, w = w * f, Ne = Number(w.toFixed(2));
3637
+ o.vat = Number((o.vat + Ne).toFixed(2));
3628
3638
  }
3629
3639
  const H = Number(x.toFixed(2));
3630
3640
  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 +3714,7 @@ export {
3704
3714
  or as BudgetAccountSchema,
3705
3715
  ir as BudgetTransactionSchema,
3706
3716
  jn as BudgetTransactionTypeSchema,
3707
- An as BundleDiscountStrategy,
3717
+ Nn as BundleDiscountStrategy,
3708
3718
  et as CalculatedDataSchema,
3709
3719
  Ke as CartItemProductSchema,
3710
3720
  qn as CartSchema,
@@ -3730,7 +3740,7 @@ export {
3730
3740
  rr as NewSupplierInvoiceSchema,
3731
3741
  nr as NewSupplierSchema,
3732
3742
  Yn as OrderSchema,
3733
- Nn as OrganizationGroupSchema,
3743
+ An as OrganizationGroupSchema,
3734
3744
  xn as OrganizationSchema,
3735
3745
  Zn as PaymentMethodSchema,
3736
3746
  Ie as PaymentTypeSchema,