@open-tender/cloud 0.3.4 → 0.3.6
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.
|
@@ -169,6 +169,9 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
169
169
|
}> & {
|
|
170
170
|
clearCache: () => void;
|
|
171
171
|
};
|
|
172
|
-
export declare const selectCustomerPoints: (orderType: OrderType | null) => (state: AppState) =>
|
|
172
|
+
export declare const selectCustomerPoints: (orderType: OrderType | null) => (state: AppState) => {
|
|
173
|
+
name: string | null;
|
|
174
|
+
points: `${number}.${number}` | null;
|
|
175
|
+
} | null;
|
|
173
176
|
export declare const selectPointsProgram: (state: AppState) => import("@open-tender/types").LoyaltyProgram | null;
|
|
174
177
|
export declare const customerLoyaltyReducer: import("redux").Reducer<CustomerLoyaltyState, import("redux").AnyAction>;
|
|
@@ -87,9 +87,11 @@ const selectCustomerPointsProgram = (orderType) => (0, toolkit_1.createSelector)
|
|
|
87
87
|
});
|
|
88
88
|
exports.selectCustomerPointsProgram = selectCustomerPointsProgram;
|
|
89
89
|
const selectCustomerPoints = (orderType) => (state) => {
|
|
90
|
-
var _a;
|
|
91
90
|
const program = (0, exports.selectCustomerPointsProgram)(orderType)(state);
|
|
92
|
-
|
|
91
|
+
if (!program || !program.perk)
|
|
92
|
+
return null;
|
|
93
|
+
const { spend_name, perk } = program;
|
|
94
|
+
return { name: spend_name, points: perk.credit };
|
|
93
95
|
};
|
|
94
96
|
exports.selectCustomerPoints = selectCustomerPoints;
|
|
95
97
|
const selectPointsProgram = (state) => {
|
|
@@ -169,6 +169,9 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
169
169
|
}> & {
|
|
170
170
|
clearCache: () => void;
|
|
171
171
|
};
|
|
172
|
-
export declare const selectCustomerPoints: (orderType: OrderType | null) => (state: AppState) =>
|
|
172
|
+
export declare const selectCustomerPoints: (orderType: OrderType | null) => (state: AppState) => {
|
|
173
|
+
name: string | null;
|
|
174
|
+
points: `${number}.${number}` | null;
|
|
175
|
+
} | null;
|
|
173
176
|
export declare const selectPointsProgram: (state: AppState) => import("@open-tender/types").LoyaltyProgram | null;
|
|
174
177
|
export declare const customerLoyaltyReducer: import("redux").Reducer<CustomerLoyaltyState, import("redux").AnyAction>;
|
|
@@ -81,9 +81,11 @@ export const selectCustomerPointsProgram = (orderType) => createSelector((state)
|
|
|
81
81
|
return programs.length ? programs[0] : null;
|
|
82
82
|
});
|
|
83
83
|
export const selectCustomerPoints = (orderType) => (state) => {
|
|
84
|
-
var _a;
|
|
85
84
|
const program = selectCustomerPointsProgram(orderType)(state);
|
|
86
|
-
|
|
85
|
+
if (!program || !program.perk)
|
|
86
|
+
return null;
|
|
87
|
+
const { spend_name, perk } = program;
|
|
88
|
+
return { name: spend_name, points: perk.credit };
|
|
87
89
|
};
|
|
88
90
|
export const selectPointsProgram = (state) => {
|
|
89
91
|
const { orderType } = state.order;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types 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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"typescript": "^4.8.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@open-tender/types": "^0.3.
|
|
52
|
+
"@open-tender/types": "^0.3.16",
|
|
53
53
|
"@open-tender/utils": "^0.3.10",
|
|
54
54
|
"@reduxjs/toolkit": "^1.8.5",
|
|
55
55
|
"react": "^18.2.0"
|