@open-tender/utils 0.3.2 → 0.3.4

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/.DS_Store ADDED
Binary file
@@ -4,6 +4,8 @@ export declare const useCartPoints: (cart: Cart | null, check: CheckoutCheck | n
4
4
  cartDiff: number;
5
5
  cartWithPoints: CartItemWithPoints[];
6
6
  points: import("@open-tender/types").CheckoutConfigLoyalty | null | undefined;
7
+ pointsBalance: number;
8
+ pointsRemaining: number;
7
9
  pointsApplied: number;
8
10
  pointsName: string | null;
9
11
  pointsObj: CheckoutPoints | null;
@@ -6,6 +6,8 @@ const useCartPoints = (cart, check, form, updatePoints) => {
6
6
  var _a;
7
7
  const [cartLength, setCartLength] = (0, react_1.useState)((cart === null || cart === void 0 ? void 0 : cart.length) || 0);
8
8
  const { points } = (check === null || check === void 0 ? void 0 : check.config) || {};
9
+ const pointsBalance = points ? parseInt(points.balance) : 0;
10
+ const pointsRemaining = points ? parseInt(points.remaining) : 0;
9
11
  const { cart: items = [] } = check || {};
10
12
  const itemsPoints = items.length
11
13
  ? items.reduce((obj, i, index) => {
@@ -61,6 +63,8 @@ const useCartPoints = (cart, check, form, updatePoints) => {
61
63
  cartDiff,
62
64
  cartWithPoints,
63
65
  points,
66
+ pointsBalance,
67
+ pointsRemaining,
64
68
  pointsApplied,
65
69
  pointsName,
66
70
  pointsObj,
@@ -29,15 +29,15 @@ export declare const updateTenders: (tenders: CheckoutTenders, total: Money) =>
29
29
  tender_type: import("@open-tender/types").TenderType;
30
30
  } | {
31
31
  amount: string;
32
- approved_contact: boolean;
33
- domain: string | null;
32
+ approved_contact?: boolean | undefined;
33
+ domain?: string | null | undefined;
34
34
  house_account_id: number;
35
35
  name: string;
36
- order_type: import("@open-tender/types").OrderType | null;
37
- pin: string;
38
- revenue_centers: number[];
39
- service_type: import("@open-tender/types").ServiceType | null;
40
- tender_type: import("@open-tender/types").TenderType;
36
+ order_type?: import("@open-tender/types").OrderType | null | undefined;
37
+ pin?: string | undefined;
38
+ revenue_centers?: number[] | undefined;
39
+ service_type?: import("@open-tender/types").ServiceType | null | undefined;
40
+ tender_type?: import("@open-tender/types").TenderType | undefined;
41
41
  } | {
42
42
  amount: string;
43
43
  tender_type: import("@open-tender/types").TenderType;
@@ -4,6 +4,8 @@ export declare const useCartPoints: (cart: Cart | null, check: CheckoutCheck | n
4
4
  cartDiff: number;
5
5
  cartWithPoints: CartItemWithPoints[];
6
6
  points: import("@open-tender/types").CheckoutConfigLoyalty | null | undefined;
7
+ pointsBalance: number;
8
+ pointsRemaining: number;
7
9
  pointsApplied: number;
8
10
  pointsName: string | null;
9
11
  pointsObj: CheckoutPoints | null;
@@ -3,6 +3,8 @@ export const useCartPoints = (cart, check, form, updatePoints) => {
3
3
  var _a;
4
4
  const [cartLength, setCartLength] = useState((cart === null || cart === void 0 ? void 0 : cart.length) || 0);
5
5
  const { points } = (check === null || check === void 0 ? void 0 : check.config) || {};
6
+ const pointsBalance = points ? parseInt(points.balance) : 0;
7
+ const pointsRemaining = points ? parseInt(points.remaining) : 0;
6
8
  const { cart: items = [] } = check || {};
7
9
  const itemsPoints = items.length
8
10
  ? items.reduce((obj, i, index) => {
@@ -58,6 +60,8 @@ export const useCartPoints = (cart, check, form, updatePoints) => {
58
60
  cartDiff,
59
61
  cartWithPoints,
60
62
  points,
63
+ pointsBalance,
64
+ pointsRemaining,
61
65
  pointsApplied,
62
66
  pointsName,
63
67
  pointsObj,
@@ -29,15 +29,15 @@ export declare const updateTenders: (tenders: CheckoutTenders, total: Money) =>
29
29
  tender_type: import("@open-tender/types").TenderType;
30
30
  } | {
31
31
  amount: string;
32
- approved_contact: boolean;
33
- domain: string | null;
32
+ approved_contact?: boolean | undefined;
33
+ domain?: string | null | undefined;
34
34
  house_account_id: number;
35
35
  name: string;
36
- order_type: import("@open-tender/types").OrderType | null;
37
- pin: string;
38
- revenue_centers: number[];
39
- service_type: import("@open-tender/types").ServiceType | null;
40
- tender_type: import("@open-tender/types").TenderType;
36
+ order_type?: import("@open-tender/types").OrderType | null | undefined;
37
+ pin?: string | undefined;
38
+ revenue_centers?: number[] | undefined;
39
+ service_type?: import("@open-tender/types").ServiceType | null | undefined;
40
+ tender_type?: import("@open-tender/types").TenderType | undefined;
41
41
  } | {
42
42
  amount: string;
43
43
  tender_type: import("@open-tender/types").TenderType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -54,7 +54,7 @@
54
54
  "typescript": "^4.8.2"
55
55
  },
56
56
  "peerDependencies": {
57
- "@open-tender/types": "^0.2.115",
57
+ "@open-tender/types": "^0.3.10",
58
58
  "@reduxjs/toolkit": "^1.8.5",
59
59
  "react": "^18.2.0"
60
60
  },