@jsdev_ninja/core 0.12.10 → 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.
Files changed (38) hide show
  1. package/dist/core.cjs.js +1 -1
  2. package/dist/core.cjs.js.map +1 -1
  3. package/dist/core.es.js +93 -78
  4. package/dist/core.es.js.map +1 -1
  5. package/dist/core.umd.js +1 -1
  6. package/dist/core.umd.js.map +1 -1
  7. package/dist/entities/Cart.d.ts +90 -90
  8. package/dist/entities/Discount/engine.d.ts.map +1 -1
  9. package/dist/entities/Discount/engine.js +15 -10
  10. package/dist/entities/Order.d.ts +82 -72
  11. package/dist/entities/Order.d.ts.map +1 -1
  12. package/dist/entities/Order.js +2 -1
  13. package/dist/entities/Organization.d.ts +34 -0
  14. package/dist/entities/Organization.d.ts.map +1 -0
  15. package/dist/entities/Organization.js +9 -0
  16. package/dist/entities/Product.d.ts +42 -42
  17. package/dist/entities/Product.js +3 -3
  18. package/dist/entities/Profile.d.ts +3 -0
  19. package/dist/entities/Profile.d.ts.map +1 -1
  20. package/dist/entities/Profile.js +4 -1
  21. package/dist/entities/Store.d.ts +2 -2
  22. package/dist/entities/index.d.ts +1 -0
  23. package/dist/entities/index.d.ts.map +1 -1
  24. package/dist/entities/index.js +1 -0
  25. package/dist/firebase-api/index.d.ts +3 -0
  26. package/dist/firebase-api/index.d.ts.map +1 -1
  27. package/dist/firebase-api/index.js +1 -0
  28. package/dist/tsconfig.app.tsbuildinfo +1 -1
  29. package/dist/utils/index.d.ts +8 -8
  30. package/dist/utils/index.js +3 -3
  31. package/lib/entities/Discount/engine.ts +134 -125
  32. package/lib/entities/Order.ts +1 -0
  33. package/lib/entities/Organization.ts +14 -0
  34. package/lib/entities/Product.ts +3 -3
  35. package/lib/entities/Profile.ts +1 -0
  36. package/lib/entities/index.ts +1 -0
  37. package/lib/firebase-api/index.ts +1 -0
  38. 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 z.create(this, this._def);
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]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A-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}(=)?))?$/, 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])))", kt = new RegExp(`^${Le}$`);
585
- function ze(r) {
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}(:[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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(`^${ze(r)}$`);
590
+ return new RegExp(`^${Le(r)}$`);
591
591
  }
592
592
  function Ue(r) {
593
- let e = `${Le}T${ze(r)}`;
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 z ? z.create(Q(r.unwrap())) : r instanceof R ? R.create(r.items.map((e) => Q(e))) : r;
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 L ? 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 z ? [null, ...P(r.unwrap())] : r instanceof Ee || r instanceof pe ? P(r.unwrap()) : r instanceof me ? P(r._def.innerType) : [];
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 L({
2430
+ return new z({
2431
2431
  values: r,
2432
2432
  typeName: y.ZodEnum,
2433
2433
  ...v(e)
2434
2434
  });
2435
2435
  }
2436
- class L extends _ {
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 L.create(e, {
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 L.create(this.options.filter((n) => !e.includes(n)), {
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
- L.create = Be;
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 z extends _ {
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
- z.create = (r, e) => new z({
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, Lt = Z.create, zt = 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 = L.create, tr = fe.create, rr = X.create, $e = O.create, nr = j.create, sr = z.create, ar = O.createWithPreprocess, ir = ye.create, or = () => qe().optional(), cr = () => Qe().optional(), dr = () => Je().optional(), ur = {
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: L,
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: z,
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: Lt,
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: zt,
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: "שדה חובה" }), Ir = i.string().regex(/^\d+$/, "Must be a numeric string"), Sr = i.object({ url: i.string().url(), id: i.string() });
2982
- function Cr(r) {
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
- }), Ar = i.array(re), Ye = i.object({
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
- }), Nr = Ye.extend({
2998
+ }), Zr = Ye.extend({
2999
2999
  index: i.number(),
3000
3000
  depth: i.number(),
3001
3001
  collapsed: i.boolean().optional(),
@@ -3042,7 +3042,7 @@ const re = i.object({
3042
3042
  updated_at: i.number(),
3043
3043
  categoryIds: i.array(i.string().nonempty()),
3044
3044
  // @deprecated
3045
- categoryList: i.array(Re),
3045
+ categoryList: i.array(Re).optional(),
3046
3046
  // @deprecated
3047
3047
  categories: i.object({
3048
3048
  lvl0: i.array(i.string()),
@@ -3050,10 +3050,10 @@ const re = i.object({
3050
3050
  lvl2: i.array(i.string()),
3051
3051
  lvl3: i.array(i.string()),
3052
3052
  lvl4: i.array(i.string())
3053
- }),
3053
+ }).optional(),
3054
3054
  // @deprecated
3055
- categoryNames: i.array(i.string())
3056
- }), Zr = He.extend({
3055
+ categoryNames: i.array(i.string()).optional()
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
- }), Or = i.object({
3064
+ }), jr = i.object({
3065
3065
  type: i.literal("Cart"),
3066
3066
  id: i.string().uuid(),
3067
3067
  companyId: i.string().uuid(),
@@ -3069,18 +3069,20 @@ 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
- }), jr = i.object({
3072
+ }), Er = i.object({
3073
3073
  id: i.string(),
3074
3074
  name: i.string(),
3075
3075
  websiteDomains: i.array(i.string())
3076
- }), Er = i.object({
3076
+ }), Rr = i.object({
3077
3077
  type: i.literal("FavoriteProduct"),
3078
3078
  id: i.string().uuid(),
3079
3079
  companyId: i.string().uuid(),
3080
3080
  storeId: i.string().uuid(),
3081
3081
  userId: i.string().uuid(),
3082
3082
  productId: i.string().uuid()
3083
- }), Xe = i.enum(["default", "delayed"]), hr = i.object({
3083
+ }), Xe = i.enum(["default", "delayed"], {
3084
+ description: "delayed is J5 transaction"
3085
+ }), hr = i.object({
3084
3086
  type: i.literal("Profile"),
3085
3087
  id: M,
3086
3088
  companyId: M,
@@ -3095,9 +3097,10 @@ const re = i.object({
3095
3097
  isAnonymous: i.boolean(),
3096
3098
  createdDate: i.number(),
3097
3099
  lastActivityDate: i.number(),
3098
- paymentType: Xe
3100
+ paymentType: Xe,
3101
+ organizationId: i.string().optional()
3099
3102
  });
3100
- function Rr() {
3103
+ function Pr() {
3101
3104
  return {
3102
3105
  type: "Profile",
3103
3106
  id: "",
@@ -3123,7 +3126,7 @@ function Rr() {
3123
3126
  paymentType: Xe.Values.default
3124
3127
  };
3125
3128
  }
3126
- const Pr = i.object({
3129
+ const Dr = i.object({
3127
3130
  type: i.literal("Order"),
3128
3131
  id: M,
3129
3132
  companyId: M,
@@ -3150,18 +3153,19 @@ const Pr = i.object({
3150
3153
  items: i.array(Ge),
3151
3154
  cartDiscount: i.number(),
3152
3155
  cartTotal: i.number(),
3153
- cartVat: i.number()
3156
+ cartVat: i.number(),
3157
+ deliveryPrice: i.number().optional()
3154
3158
  }),
3155
3159
  originalAmount: i.number().positive().optional(),
3156
3160
  // what client pay
3157
3161
  actualAmount: i.number().positive().optional(),
3158
3162
  // what store charge
3159
3163
  date: i.number(),
3160
- deliveryDate: i.coerce.number().optional(),
3164
+ deliveryDate: i.coerce.number(),
3161
3165
  client: hr.required({}),
3162
3166
  nameOnInvoice: i.string().optional(),
3163
3167
  clientComment: i.string().optional()
3164
- }), mr = i.enum(["individual", "company"]), Dr = i.object({
3168
+ }), mr = i.enum(["individual", "company"]), Mr = i.object({
3165
3169
  id: i.string(),
3166
3170
  companyId: i.string(),
3167
3171
  name: i.string(),
@@ -3189,7 +3193,7 @@ const Pr = i.object({
3189
3193
  bundlePrice: i.number().positive()
3190
3194
  // Total price for the bundle (e.g., $25)
3191
3195
  })
3192
- ]), Mr = i.object({
3196
+ ]), $r = i.object({
3193
3197
  type: i.literal("Discount"),
3194
3198
  storeId: i.string().min(1),
3195
3199
  companyId: i.string().min(1),
@@ -3290,7 +3294,10 @@ class vr {
3290
3294
  affectedItems: S.affectedItems
3291
3295
  }), s.appliedDiscounts = o);
3292
3296
  }
3293
- const c = this.calculateFinalPrices(e, o), d = o.reduce((b, w) => b + w.discountAmount, 0);
3297
+ const c = this.calculateFinalPrices(e, o), d = o.reduce(
3298
+ (b, w) => b + w.discountAmount,
3299
+ 0
3300
+ );
3294
3301
  return {
3295
3302
  items: c,
3296
3303
  totalDiscount: Number(d.toFixed(2)),
@@ -3308,7 +3315,9 @@ class vr {
3308
3315
  const s = t.filter(
3309
3316
  (d) => d.affectedItems.some((l) => l.productId === n.product.id)
3310
3317
  ), a = s.reduce((d, l) => {
3311
- const m = l.affectedItems.find((b) => b.productId === n.product.id);
3318
+ const m = l.affectedItems.find(
3319
+ (b) => b.productId === n.product.id
3320
+ );
3312
3321
  return d + ((m == null ? void 0 : m.discountAmount) || 0);
3313
3322
  }, 0), o = a / n.amount, c = n.product.price - o;
3314
3323
  return {
@@ -3332,25 +3341,30 @@ class vr {
3332
3341
  function et(r) {
3333
3342
  return Number(r.toFixed(2));
3334
3343
  }
3335
- function $r(r) {
3344
+ function Vr(r) {
3336
3345
  return r.toFixed(2);
3337
3346
  }
3338
- function Vr(r) {
3347
+ function Fr(r) {
3339
3348
  return Math.max(0, et(r));
3340
3349
  }
3341
- function Fr(r, e) {
3350
+ function zr(r, e) {
3342
3351
  if (r <= 0) return 0;
3343
3352
  const t = r - e;
3344
3353
  return et(t / r * 100);
3345
3354
  }
3346
- const Ae = {
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 = {
3347
3361
  VAT: 18
3348
3362
  };
3349
- function _r(r) {
3363
+ function br(r) {
3350
3364
  var e, t;
3351
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;
3352
3366
  }
3353
- function br(r) {
3367
+ function xr(r) {
3354
3368
  var e, t;
3355
3369
  if (((e = r.discount) == null ? void 0 : e.type) === "percent") {
3356
3370
  const n = r.price * r.discount.value / 100;
@@ -3358,7 +3372,7 @@ function br(r) {
3358
3372
  }
3359
3373
  return ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.price - r.discount.value : r.price;
3360
3374
  }
3361
- function Lr({
3375
+ function Ur({
3362
3376
  cart: r,
3363
3377
  discounts: e,
3364
3378
  store: t
@@ -3369,16 +3383,14 @@ function Lr({
3369
3383
  id: d.product.id,
3370
3384
  price: d.product.price
3371
3385
  }
3372
- })), a = vr.calculateDiscounts(s, e);
3373
- console.log("discountResult", a);
3374
- const o = r.map((d, l) => {
3386
+ })), a = vr.calculateDiscounts(s, e), o = r.map((d, l) => {
3375
3387
  const m = a.items[l];
3376
3388
  return {
3377
3389
  amount: d.amount,
3378
3390
  product: { ...d.product },
3379
3391
  originalPrice: d.product.price,
3380
- finalPrice: m ? m.finalPrice : br(d.product),
3381
- finalDiscount: m ? m.finalDiscount : _r(d.product)
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 xr = {
3422
+ const kr = {
3411
3423
  stores: "STORES",
3412
3424
  companies: "COMPANIES"
3413
- }, kr = {
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
- }, wr = {
3425
- systemCollections: xr,
3426
- storeCollections: kr,
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
- }, zr = {
3437
- firestore: wr
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
- Or as CartSchema,
3457
+ jr as CartSchema,
3445
3458
  Re as CategorySchema,
3446
- jr as CompanySchema,
3459
+ Er as CompanySchema,
3447
3460
  pr as DiscountConditionsSchema,
3448
3461
  vr as DiscountEngine,
3449
- Mr as DiscountSchema,
3462
+ $r as DiscountSchema,
3450
3463
  Ke as DiscountStrategyFactory,
3451
3464
  yr as DiscountVariantSchema,
3452
- Er as FavoriteProductSchema,
3453
- Sr as FileSchema,
3454
- zr as FirebaseAPI,
3465
+ Rr as FavoriteProductSchema,
3466
+ Cr as FileSchema,
3467
+ Br as FirebaseAPI,
3455
3468
  re as LocaleSchema,
3456
- Ar as LocaleValueSchema,
3457
- Zr as NewProductSchema,
3458
- Pr as OrderSchema,
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
- Dr as StoreSchema,
3463
- Nr as TFlattenCategorySchema,
3464
- Fr as calculatePercentageDiscount,
3477
+ Mr as StoreSchema,
3478
+ Zr as TFlattenCategorySchema,
3479
+ zr as calculatePercentageDiscount,
3465
3480
  mr as clientTypesSchema,
3466
- Rr as createEmptyProfile,
3467
- Vr as ensureNonNegative,
3481
+ Pr as createEmptyProfile,
3482
+ Fr as ensureNonNegative,
3468
3483
  et as formatCurrency,
3469
- $r as formatCurrencyString,
3470
- Lr as getCartCost,
3471
- Cr as isFile,
3484
+ Vr as formatCurrencyString,
3485
+ Ur as getCartCost,
3486
+ Ar as isFile,
3472
3487
  M as notEmptyTextSchema,
3473
- Ir as numericTextSchema
3488
+ Sr as numericTextSchema
3474
3489
  };
3475
3490
  //# sourceMappingURL=core.es.js.map