@jsdev_ninja/core 0.20.0 → 0.22.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.
@@ -1723,11 +1723,14 @@ export declare const OrderSchema: z.ZodObject<{
1723
1723
  deliveryPrice: z.ZodOptional<z.ZodNumber>;
1724
1724
  freeDeliveryPrice: z.ZodOptional<z.ZodNumber>;
1725
1725
  isVatIncludedInPrice: z.ZodOptional<z.ZodBoolean>;
1726
+ freeShipping: z.ZodOptional<z.ZodBoolean>;
1726
1727
  }, "strip", z.ZodTypeAny, {
1728
+ freeShipping?: boolean | undefined;
1727
1729
  deliveryPrice?: number | undefined;
1728
1730
  freeDeliveryPrice?: number | undefined;
1729
1731
  isVatIncludedInPrice?: boolean | undefined;
1730
1732
  }, {
1733
+ freeShipping?: boolean | undefined;
1731
1734
  deliveryPrice?: number | undefined;
1732
1735
  freeDeliveryPrice?: number | undefined;
1733
1736
  isVatIncludedInPrice?: boolean | undefined;
@@ -2663,6 +2666,7 @@ export declare const OrderSchema: z.ZodObject<{
2663
2666
  companyNumber?: string | undefined;
2664
2667
  createdBy?: "user" | "admin" | undefined;
2665
2668
  storeOptions?: {
2669
+ freeShipping?: boolean | undefined;
2666
2670
  deliveryPrice?: number | undefined;
2667
2671
  freeDeliveryPrice?: number | undefined;
2668
2672
  isVatIncludedInPrice?: boolean | undefined;
@@ -3076,6 +3080,7 @@ export declare const OrderSchema: z.ZodObject<{
3076
3080
  companyNumber?: string | undefined;
3077
3081
  createdBy?: "user" | "admin" | undefined;
3078
3082
  storeOptions?: {
3083
+ freeShipping?: boolean | undefined;
3079
3084
  deliveryPrice?: number | undefined;
3080
3085
  freeDeliveryPrice?: number | undefined;
3081
3086
  isVatIncludedInPrice?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../lib/entities/Order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKF,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -45,6 +45,10 @@ export const OrderSchema = z.object({
45
45
  deliveryPrice: z.number().optional(),
46
46
  freeDeliveryPrice: z.number().optional(),
47
47
  isVatIncludedInPrice: z.boolean().optional(),
48
+ // True when the ordering organization is exempt from delivery fees
49
+ // ("פטור מדמי משלוח"). Persisted so any later recompute (admin edit,
50
+ // invoice generation) keeps the exemption.
51
+ freeShipping: z.boolean().optional(),
48
52
  })
49
53
  .optional(),
50
54
  originalAmount: z.number().positive().optional(), // what client pay
@@ -1,9 +1,15 @@
1
1
  import { TCart, TDiscount } from "../entities";
2
- export declare function getCartCost({ cart, discounts, deliveryPrice, freeDeliveryPrice, isVatIncludedInPrice, }: {
2
+ export declare function getCartCost({ cart, discounts, deliveryPrice, freeDeliveryPrice, freeShipping, isVatIncludedInPrice, }: {
3
3
  cart: TCart["items"];
4
4
  discounts: TDiscount[];
5
5
  deliveryPrice?: number;
6
6
  freeDeliveryPrice?: number;
7
+ /**
8
+ * When true, the customer is exempt from delivery fees regardless of the
9
+ * store's free-delivery threshold (e.g. an organization flagged with
10
+ * `freeShipping`). Forces `deliveryPrice` to 0.
11
+ */
12
+ freeShipping?: boolean;
7
13
  isVatIncludedInPrice?: boolean;
8
14
  }): {
9
15
  discount: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAY,MAAM,aAAa,CAAC;AAmCzD,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,aAAiB,EACjB,iBAAqB,EACrB,oBAA4B,GAC5B,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqFA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAY,MAAM,aAAa,CAAC;AAmCzD,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,aAAiB,EACjB,iBAAqB,EACrB,YAAoB,EACpB,oBAA4B,GAC5B,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwFA"}
@@ -26,7 +26,7 @@ function getPriceAfterDiscount(product, isVatIncludedInPrice) {
26
26
  return price;
27
27
  }
28
28
  // main
29
- export function getCartCost({ cart, discounts, deliveryPrice = 0, freeDeliveryPrice = 0, isVatIncludedInPrice = false, }) {
29
+ export function getCartCost({ cart, discounts, deliveryPrice = 0, freeDeliveryPrice = 0, freeShipping = false, isVatIncludedInPrice = false, }) {
30
30
  // Convert cart items to the format expected by the discount engine
31
31
  // const cartForEngine = cart.map((item) => ({
32
32
  // amount: item.amount,
@@ -89,7 +89,8 @@ export function getCartCost({ cart, discounts, deliveryPrice = 0, freeDeliveryPr
89
89
  productsCost: 0,
90
90
  deliveryPrice: deliveryPrice,
91
91
  });
92
- if (cartDetails.deliveryPrice && cartDetails.productsCost >= freeDeliveryPrice) {
92
+ if (freeShipping ||
93
+ (cartDetails.deliveryPrice && cartDetails.productsCost >= freeDeliveryPrice)) {
93
94
  cartDetails.deliveryPrice = 0;
94
95
  }
95
96
  else {