@jsdev_ninja/core 0.13.24 → 0.13.26

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.
@@ -13,29 +13,29 @@ export declare const ProfileSchema: z.ZodObject<{
13
13
  email: z.ZodString;
14
14
  phoneNumber: z.ZodOptional<z.ZodString>;
15
15
  address: z.ZodOptional<z.ZodObject<{
16
- country: z.ZodString;
17
- city: z.ZodString;
18
- street: z.ZodString;
19
- streetNumber: z.ZodString;
20
- floor: z.ZodString;
21
- apartmentEnterNumber: z.ZodString;
22
- apartmentNumber: z.ZodString;
16
+ country: z.ZodOptional<z.ZodString>;
17
+ city: z.ZodOptional<z.ZodString>;
18
+ street: z.ZodOptional<z.ZodString>;
19
+ streetNumber: z.ZodOptional<z.ZodString>;
20
+ floor: z.ZodOptional<z.ZodString>;
21
+ apartmentEnterNumber: z.ZodOptional<z.ZodString>;
22
+ apartmentNumber: z.ZodOptional<z.ZodString>;
23
23
  }, "strip", z.ZodTypeAny, {
24
- country: string;
25
- city: string;
26
- street: string;
27
- streetNumber: string;
28
- floor: string;
29
- apartmentEnterNumber: string;
30
- apartmentNumber: string;
24
+ country?: string | undefined;
25
+ city?: string | undefined;
26
+ street?: string | undefined;
27
+ streetNumber?: string | undefined;
28
+ floor?: string | undefined;
29
+ apartmentEnterNumber?: string | undefined;
30
+ apartmentNumber?: string | undefined;
31
31
  }, {
32
- country: string;
33
- city: string;
34
- street: string;
35
- streetNumber: string;
36
- floor: string;
37
- apartmentEnterNumber: string;
38
- apartmentNumber: string;
32
+ country?: string | undefined;
33
+ city?: string | undefined;
34
+ street?: string | undefined;
35
+ streetNumber?: string | undefined;
36
+ floor?: string | undefined;
37
+ apartmentEnterNumber?: string | undefined;
38
+ apartmentNumber?: string | undefined;
39
39
  }>>;
40
40
  isAnonymous: z.ZodBoolean;
41
41
  createdDate: z.ZodNumber;
@@ -58,13 +58,13 @@ export declare const ProfileSchema: z.ZodObject<{
58
58
  companyName?: string | undefined;
59
59
  phoneNumber?: string | undefined;
60
60
  address?: {
61
- country: string;
62
- city: string;
63
- street: string;
64
- streetNumber: string;
65
- floor: string;
66
- apartmentEnterNumber: string;
67
- apartmentNumber: string;
61
+ country?: string | undefined;
62
+ city?: string | undefined;
63
+ street?: string | undefined;
64
+ streetNumber?: string | undefined;
65
+ floor?: string | undefined;
66
+ apartmentEnterNumber?: string | undefined;
67
+ apartmentNumber?: string | undefined;
68
68
  } | undefined;
69
69
  organizationId?: string | null | undefined;
70
70
  }, {
@@ -83,13 +83,13 @@ export declare const ProfileSchema: z.ZodObject<{
83
83
  companyName?: string | undefined;
84
84
  phoneNumber?: string | undefined;
85
85
  address?: {
86
- country: string;
87
- city: string;
88
- street: string;
89
- streetNumber: string;
90
- floor: string;
91
- apartmentEnterNumber: string;
92
- apartmentNumber: string;
86
+ country?: string | undefined;
87
+ city?: string | undefined;
88
+ street?: string | undefined;
89
+ streetNumber?: string | undefined;
90
+ floor?: string | undefined;
91
+ apartmentEnterNumber?: string | undefined;
92
+ apartmentNumber?: string | undefined;
93
93
  } | undefined;
94
94
  organizationId?: string | null | undefined;
95
95
  }>;
@@ -20,28 +20,28 @@ export declare const StoreSchema: z.ZodObject<{
20
20
  name: string;
21
21
  tenantId: string;
22
22
  paymentType: "external" | "j5";
23
+ isVatIncludedInPrice: boolean;
23
24
  urls: string[];
24
25
  logoUrl: string;
25
26
  allowAnonymousClients: boolean;
26
- isVatIncludedInPrice: boolean;
27
27
  clientTypes: ("company" | "individual")[];
28
28
  deliveryPrice?: number | undefined;
29
- minimumOrder?: number | undefined;
30
29
  freeDeliveryPrice?: number | undefined;
30
+ minimumOrder?: number | undefined;
31
31
  }, {
32
32
  id: string;
33
33
  companyId: string;
34
34
  name: string;
35
35
  tenantId: string;
36
36
  paymentType: "external" | "j5";
37
+ isVatIncludedInPrice: boolean;
37
38
  urls: string[];
38
39
  logoUrl: string;
39
40
  allowAnonymousClients: boolean;
40
- isVatIncludedInPrice: boolean;
41
41
  clientTypes: ("company" | "individual")[];
42
42
  deliveryPrice?: number | undefined;
43
- minimumOrder?: number | undefined;
44
43
  freeDeliveryPrice?: number | undefined;
44
+ minimumOrder?: number | undefined;
45
45
  }>;
46
46
  export type TStore = z.infer<typeof StoreSchema>;
47
47
  //# sourceMappingURL=Store.d.ts.map
@@ -19,11 +19,11 @@ export const storeCollections = {
19
19
  export const FirestoreApi = {
20
20
  systemCollections,
21
21
  storeCollections,
22
- // for client
22
+ // for client and server
23
23
  getPath: ({ companyId, storeId, collectionName, id, }) => {
24
24
  return `${companyId}/${storeId}/${collectionName}${id ? `/${id}` : ""}`;
25
25
  },
26
- // for backend
26
+ // for firestore events
27
27
  getDocPath: (collectionName) => {
28
28
  return `{companyId}/{storeId}/${collectionName}/{id}`;
29
29
  },
@@ -1,8 +1,10 @@
1
- import { TCart, TDiscount, TStore } from "../entities";
2
- export declare function getCartCost({ cart, discounts, store, }: {
1
+ import { TCart, TDiscount } from "../entities";
2
+ export declare function getCartCost({ cart, discounts, deliveryPrice, freeDeliveryPrice, isVatIncludedInPrice, }: {
3
3
  cart: TCart["items"];
4
4
  discounts: TDiscount[];
5
- store: TStore;
5
+ deliveryPrice?: number;
6
+ freeDeliveryPrice?: number;
7
+ isVatIncludedInPrice?: boolean;
6
8
  }): {
7
9
  discount: number;
8
10
  cost: 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,EAAE,MAAM,aAAa,CAAC;AA8BjE,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,KAAK,GACL,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsFA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AA8BjE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFA"}
@@ -23,8 +23,7 @@ function getPriceAfterDiscount(product) {
23
23
  return product.price;
24
24
  }
25
25
  // main
26
- export function getCartCost({ cart, discounts, store, }) {
27
- const { isVatIncludedInPrice } = store;
26
+ export function getCartCost({ cart, discounts, deliveryPrice = 0, freeDeliveryPrice = 0, isVatIncludedInPrice = false, }) {
28
27
  // Convert cart items to the format expected by the discount engine
29
28
  const cartForEngine = cart.map((item) => ({
30
29
  amount: item.amount,
@@ -83,9 +82,9 @@ export function getCartCost({ cart, discounts, store, }) {
83
82
  finalCost: 0,
84
83
  vat: 0,
85
84
  productsCost: 0,
86
- deliveryPrice: store?.deliveryPrice ?? 0,
85
+ deliveryPrice: deliveryPrice,
87
86
  });
88
- if (cartDetails.deliveryPrice && cartDetails.productsCost >= (store.freeDeliveryPrice ?? 0)) {
87
+ if (cartDetails.deliveryPrice && cartDetails.productsCost >= freeDeliveryPrice) {
89
88
  cartDetails.deliveryPrice = 0;
90
89
  }
91
90
  else {