@jsdev_ninja/core 0.13.31 → 0.13.33

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
@@ -37,14 +37,14 @@ var x;
37
37
  }
38
38
  n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
39
39
  })(x || (x = {}));
40
- var je;
40
+ var De;
41
41
  (function(n) {
42
42
  n.mergeShapes = (e, t) => ({
43
43
  ...e,
44
44
  ...t
45
45
  // second overwrites first
46
46
  });
47
- })(je || (je = {}));
47
+ })(De || (De = {}));
48
48
  const f = x.arrayToEnum([
49
49
  "string",
50
50
  "nan",
@@ -310,7 +310,7 @@ class T {
310
310
  }
311
311
  const y = Object.freeze({
312
312
  status: "aborted"
313
- }), Y = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), De = (n) => n.status === "aborted", Oe = (n) => n.status === "dirty", q = (n) => n.status === "valid", se = (n) => typeof Promise < "u" && n instanceof Promise;
313
+ }), Y = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), Oe = (n) => n.status === "aborted", Ee = (n) => n.status === "dirty", q = (n) => n.status === "valid", se = (n) => typeof Promise < "u" && n instanceof Promise;
314
314
  function be(n, e, t, r) {
315
315
  if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
316
316
  return e.get(n);
@@ -544,7 +544,7 @@ class _ {
544
544
  });
545
545
  }
546
546
  brand() {
547
- return new Re({
547
+ return new Pe({
548
548
  typeName: g.ZodBranded,
549
549
  type: this,
550
550
  ...v(this._def)
@@ -580,7 +580,7 @@ class _ {
580
580
  }
581
581
  }
582
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 Ce;
583
+ let Ze;
584
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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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}(=)?))?$/, qe = "((\\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(`^${qe}$`);
585
585
  function Be(n) {
586
586
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
@@ -665,7 +665,7 @@ class N extends _ {
665
665
  message: a.message
666
666
  }), r.dirty());
667
667
  else if (a.kind === "emoji")
668
- Ce || (Ce = new RegExp(_t, "u")), Ce.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
668
+ Ze || (Ze = new RegExp(_t, "u")), Ze.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
@@ -1960,7 +1960,7 @@ ce.create = (n, e) => new ce({
1960
1960
  typeName: g.ZodUnion,
1961
1961
  ...v(e)
1962
1962
  });
1963
- const R = (n) => n instanceof le ? R(n.schema) : n instanceof Z ? R(n.innerType()) : n instanceof me ? [n.value] : n instanceof z ? n.options : n instanceof fe ? x.objectValues(n.enum) : n instanceof pe ? R(n._def.innerType) : n instanceof ie ? [void 0] : n instanceof oe ? [null] : n instanceof D ? [void 0, ...R(n.unwrap())] : n instanceof U ? [null, ...R(n.unwrap())] : n instanceof Re || n instanceof ge ? R(n.unwrap()) : n instanceof he ? R(n._def.innerType) : [];
1963
+ const R = (n) => n instanceof le ? R(n.schema) : n instanceof Z ? R(n.innerType()) : n instanceof me ? [n.value] : n instanceof z ? n.options : n instanceof fe ? x.objectValues(n.enum) : n instanceof pe ? R(n._def.innerType) : n instanceof ie ? [void 0] : n instanceof oe ? [null] : n instanceof D ? [void 0, ...R(n.unwrap())] : n instanceof U ? [null, ...R(n.unwrap())] : n instanceof Pe || n instanceof ge ? R(n.unwrap()) : n instanceof he ? R(n._def.innerType) : [];
1964
1964
  class Ie extends _ {
1965
1965
  _parse(e) {
1966
1966
  const { ctx: t } = this._processInputParams(e);
@@ -2023,14 +2023,14 @@ class Ie extends _ {
2023
2023
  });
2024
2024
  }
2025
2025
  }
2026
- function Ee(n, e) {
2026
+ function Re(n, e) {
2027
2027
  const t = P(n), r = P(e);
2028
2028
  if (n === e)
2029
2029
  return { valid: !0, data: n };
2030
2030
  if (t === f.object && r === f.object) {
2031
2031
  const s = x.objectKeys(e), a = x.objectKeys(n).filter((c) => s.indexOf(c) !== -1), o = { ...n, ...e };
2032
2032
  for (const c of a) {
2033
- const l = Ee(n[c], e[c]);
2033
+ const l = Re(n[c], e[c]);
2034
2034
  if (!l.valid)
2035
2035
  return { valid: !1 };
2036
2036
  o[c] = l.data;
@@ -2041,7 +2041,7 @@ function Ee(n, e) {
2041
2041
  return { valid: !1 };
2042
2042
  const s = [];
2043
2043
  for (let a = 0; a < n.length; a++) {
2044
- const o = n[a], c = e[a], l = Ee(o, c);
2044
+ const o = n[a], c = e[a], l = Re(o, c);
2045
2045
  if (!l.valid)
2046
2046
  return { valid: !1 };
2047
2047
  s.push(l.data);
@@ -2052,10 +2052,10 @@ function Ee(n, e) {
2052
2052
  class de extends _ {
2053
2053
  _parse(e) {
2054
2054
  const { status: t, ctx: r } = this._processInputParams(e), s = (a, o) => {
2055
- if (De(a) || De(o))
2055
+ if (Oe(a) || Oe(o))
2056
2056
  return y;
2057
- const c = Ee(a.value, o.value);
2058
- return c.valid ? ((Oe(a) || Oe(o)) && t.dirty(), { status: t.value, value: c.data }) : (m(r, {
2057
+ const c = Re(a.value, o.value);
2058
+ return c.valid ? ((Ee(a) || Ee(o)) && t.dirty(), { status: t.value, value: c.data }) : (m(r, {
2059
2059
  code: u.invalid_intersection_types
2060
2060
  }), y);
2061
2061
  };
@@ -2746,7 +2746,7 @@ Te.create = (n) => new Te({
2746
2746
  ...v(n)
2747
2747
  });
2748
2748
  const Dt = Symbol("zod_brand");
2749
- class Re extends _ {
2749
+ class Pe extends _ {
2750
2750
  _parse(e) {
2751
2751
  const { ctx: t } = this._processInputParams(e), r = t.data;
2752
2752
  return this._def.type._parse({
@@ -2866,15 +2866,15 @@ var i = /* @__PURE__ */ Object.freeze({
2866
2866
  INVALID: y,
2867
2867
  DIRTY: Y,
2868
2868
  OK: I,
2869
- isAborted: De,
2870
- isDirty: Oe,
2869
+ isAborted: Oe,
2870
+ isDirty: Ee,
2871
2871
  isValid: q,
2872
2872
  isAsync: se,
2873
2873
  get util() {
2874
2874
  return x;
2875
2875
  },
2876
2876
  get objectUtil() {
2877
- return je;
2877
+ return De;
2878
2878
  },
2879
2879
  ZodParsedType: f,
2880
2880
  getParsedType: P,
@@ -2915,7 +2915,7 @@ var i = /* @__PURE__ */ Object.freeze({
2915
2915
  ZodCatch: he,
2916
2916
  ZodNaN: Te,
2917
2917
  BRAND: Dt,
2918
- ZodBranded: Re,
2918
+ ZodBranded: Pe,
2919
2919
  ZodPipeline: ye,
2920
2920
  ZodReadonly: ge,
2921
2921
  custom: Ye,
@@ -2970,7 +2970,7 @@ var i = /* @__PURE__ */ Object.freeze({
2970
2970
  quotelessJson: ct,
2971
2971
  ZodError: S
2972
2972
  });
2973
- const Pe = i.object({
2973
+ const Ae = i.object({
2974
2974
  country: i.string().optional(),
2975
2975
  city: i.string().optional(),
2976
2976
  street: i.string().optional(),
@@ -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
- }), Ae = i.enum(["external", "j5", "none"]), yn = i.object({
3083
+ }), Se = i.enum(["external", "j5", "none"]), yn = i.object({
3084
3084
  type: i.literal("Profile"),
3085
3085
  id: M,
3086
3086
  companyId: M,
@@ -3091,11 +3091,11 @@ const re = i.object({
3091
3091
  displayName: M,
3092
3092
  email: i.string().email(),
3093
3093
  phoneNumber: i.string().optional(),
3094
- address: Pe.optional(),
3094
+ address: Ae.optional(),
3095
3095
  isAnonymous: i.boolean(),
3096
3096
  createdDate: i.number(),
3097
3097
  lastActivityDate: i.number(),
3098
- paymentType: Ae,
3098
+ paymentType: Se,
3099
3099
  organizationId: i.string().optional().nullable()
3100
3100
  }), tt = i.object({
3101
3101
  _COMMENT: i.string().optional(),
@@ -3159,7 +3159,9 @@ const re = i.object({
3159
3159
  discountPercentage: i.number().positive().min(0).max(100).optional(),
3160
3160
  nameOnInvoice: i.string().optional(),
3161
3161
  billingAccounts: i.array(nt),
3162
- paymentType: Ae
3162
+ paymentType: Se,
3163
+ companyNumber: i.string().optional(),
3164
+ address: Ae.optional()
3163
3165
  }), Ln = bn.omit({ id: !0 }), xn = i.object({
3164
3166
  doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
3165
3167
  pdf_link: i.string().url("PDF link must be a valid URL"),
@@ -3221,7 +3223,7 @@ const re = i.object({
3221
3223
  "completed",
3222
3224
  "refunded"
3223
3225
  ]),
3224
- paymentType: Ae.optional(),
3226
+ paymentType: Se.optional(),
3225
3227
  paymentStatus: i.enum(["pending", "pending_j5", "external", "completed", "failed", "refunded"]),
3226
3228
  //todo check if hyp support partial refund
3227
3229
  cart: i.object({
@@ -3245,8 +3247,10 @@ const re = i.object({
3245
3247
  date: i.number(),
3246
3248
  deliveryDate: i.coerce.number(),
3247
3249
  client: yn.optional(),
3248
- address: Pe.optional(),
3250
+ address: Ae.optional(),
3249
3251
  nameOnInvoice: i.string().optional(),
3252
+ emailOnInvoice: i.string().email().optional(),
3253
+ phoneNumberOnInvoice: i.string().optional(),
3250
3254
  clientComment: i.string().optional(),
3251
3255
  organizationId: i.string().optional(),
3252
3256
  billingAccount: nt.optional(),
@@ -3262,14 +3266,14 @@ const re = i.object({
3262
3266
  logoUrl: i.string(),
3263
3267
  tenantId: i.string(),
3264
3268
  // firebase auth tenantId
3265
- paymentType: Ae,
3269
+ paymentType: Se,
3266
3270
  allowAnonymousClients: i.boolean(),
3267
3271
  isVatIncludedInPrice: i.boolean(),
3268
3272
  clientTypes: i.array(wn),
3269
3273
  minimumOrder: i.number().optional(),
3270
3274
  freeDeliveryPrice: i.number().optional(),
3271
3275
  deliveryPrice: i.number().optional(),
3272
- address: Pe.optional(),
3276
+ address: Ae.optional(),
3273
3277
  companyNumber: i.string().optional()
3274
3278
  // חפ של החברה
3275
3279
  }), Tn = i.object({
@@ -3444,7 +3448,7 @@ function Xn(n, e) {
3444
3448
  const t = n - e;
3445
3449
  return st(t / n * 100);
3446
3450
  }
3447
- const Ze = {
3451
+ const je = {
3448
3452
  VAT: 18
3449
3453
  };
3450
3454
  function Nn(n) {
@@ -3486,16 +3490,16 @@ function Jn({
3486
3490
  const { product: b, amount: w, finalPrice: A, finalDiscount: K } = p;
3487
3491
  let j = 0;
3488
3492
  if (b.vat) {
3489
- let Ne = 0;
3493
+ let Ce = 0;
3490
3494
  if (s) {
3491
- const at = A * (Ze.VAT / (100 + Ze.VAT));
3492
- j = Number(at.toFixed(2)), j = j * w, Ne = Number(j.toFixed(2));
3495
+ const at = A * (je.VAT / (100 + je.VAT));
3496
+ j = Number(at.toFixed(2)), j = j * w, Ce = Number(j.toFixed(2));
3493
3497
  } else
3494
- j = A * Ze.VAT / 100, j = j * w, Ne = Number(j.toFixed(2));
3495
- d.vat = Number((d.vat + Ne).toFixed(2));
3498
+ j = A * je.VAT / 100, j = j * w, Ce = Number(j.toFixed(2));
3499
+ d.vat = Number((d.vat + Ce).toFixed(2));
3496
3500
  }
3497
- const Se = Number(A.toFixed(2));
3498
- return d.cost += w * Se, d.discount += K && w * K, d.finalCost += w * Se + (s ? 0 : j), d.productsCost += w * Se + (s ? 0 : j), 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;
3501
+ const Ne = Number(A.toFixed(2));
3502
+ return d.cost += w * Ne, d.discount += K && w * K, d.finalCost += w * Ne + (s ? 0 : j), d.productsCost += w * Ne + (s ? 0 : j), 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;
3499
3503
  },
3500
3504
  {
3501
3505
  discount: 0,
@@ -3540,7 +3544,7 @@ const Zn = {
3540
3544
  firestore: Dn
3541
3545
  };
3542
3546
  export {
3543
- Pe as AddressSchema,
3547
+ Ae as AddressSchema,
3544
3548
  Ge as BaseCategorySchema,
3545
3549
  nt as BillingAccountSchema,
3546
3550
  An as BundleDiscountStrategy,
@@ -3565,7 +3569,7 @@ export {
3565
3569
  Vn as NewProductSchema,
3566
3570
  qn as OrderSchema,
3567
3571
  bn as OrganizationSchema,
3568
- Ae as PaymentTypeSchema,
3572
+ Se as PaymentTypeSchema,
3569
3573
  Ke as ProductSchema,
3570
3574
  yn as ProfileSchema,
3571
3575
  Bn as StoreSchema,