@open-tender/store 1.1.89 → 1.1.90
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
@@ -62,42 +62,18 @@ export declare const selectCustomerLoyalty: ((state: {
|
|
|
62
62
|
sidebar: import("./sidebar").SidebarState;
|
|
63
63
|
surcharges: import("./surcharges").SurchargesState;
|
|
64
64
|
taxes: import("./taxes").TaxesState;
|
|
65
|
-
}) => {
|
|
66
|
-
name: string;
|
|
67
|
-
credit: `${number}.${number}` | null;
|
|
68
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
69
|
-
progress: `${number}.${number}` | null;
|
|
70
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
71
|
-
} | null) & {
|
|
65
|
+
}) => LoyaltyProgramSummary | null) & {
|
|
72
66
|
clearCache: () => void;
|
|
73
67
|
resultsCount: () => number;
|
|
74
68
|
resetResultsCount: () => void;
|
|
75
69
|
} & {
|
|
76
|
-
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) =>
|
|
77
|
-
|
|
78
|
-
credit: `${number}.${number}` | null;
|
|
79
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
80
|
-
progress: `${number}.${number}` | null;
|
|
81
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
82
|
-
} | null;
|
|
83
|
-
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => {
|
|
84
|
-
name: string;
|
|
85
|
-
credit: `${number}.${number}` | null;
|
|
86
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
87
|
-
progress: `${number}.${number}` | null;
|
|
88
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
89
|
-
} | null) & {
|
|
70
|
+
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null;
|
|
71
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null) & {
|
|
90
72
|
clearCache: () => void;
|
|
91
73
|
resultsCount: () => number;
|
|
92
74
|
resetResultsCount: () => void;
|
|
93
75
|
};
|
|
94
|
-
lastResult: () =>
|
|
95
|
-
name: string;
|
|
96
|
-
credit: `${number}.${number}` | null;
|
|
97
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
98
|
-
progress: `${number}.${number}` | null;
|
|
99
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
100
|
-
} | null;
|
|
76
|
+
lastResult: () => LoyaltyProgramSummary | null;
|
|
101
77
|
dependencies: [(state: AppState) => import("@open-tender/types").LoyaltyProgram];
|
|
102
78
|
recomputations: () => number;
|
|
103
79
|
resetRecomputations: () => void;
|
|
@@ -92,9 +92,19 @@ exports.selectCustomerLoyalty = (0, toolkit_1.createSelector)(function (state) {
|
|
|
92
92
|
if (!loyaltyProgram)
|
|
93
93
|
return null;
|
|
94
94
|
var name = loyaltyProgram.name, perk = loyaltyProgram.perk, status = loyaltyProgram.status;
|
|
95
|
-
var _a = perk || {}, _b = _a.
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
|
|
95
|
+
var _a = perk || {}, _b = _a.loyalty_perk, loyalty_perk = _b === void 0 ? null : _b, _c = _a.credit, credit = _c === void 0 ? null : _c, _d = _a.thresholds, thresholds = _d === void 0 ? [] : _d;
|
|
96
|
+
var isPoints = loyalty_perk === 'BANKABLE_POINTS';
|
|
97
|
+
var points = isPoints && credit ? parseInt(credit) : null;
|
|
98
|
+
var _e = status || {}, _f = _e.progress, progress = _f === void 0 ? null : _f, _g = _e.tiers, tiers = _g === void 0 ? [] : _g;
|
|
99
|
+
var tier = tiers.find(function (i) { return i.is_current_tier; }) || null;
|
|
100
|
+
return {
|
|
101
|
+
name: name,
|
|
102
|
+
perkType: loyalty_perk,
|
|
103
|
+
points: points,
|
|
104
|
+
credit: isPoints ? null : credit,
|
|
105
|
+
thresholds: thresholds,
|
|
106
|
+
progress: isPoints && progress ? parseInt(progress) : progress,
|
|
107
|
+
tier: tier
|
|
108
|
+
};
|
|
99
109
|
});
|
|
100
110
|
exports.customerReducer = CustomerSlice.reducer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
@@ -62,42 +62,18 @@ export declare const selectCustomerLoyalty: ((state: {
|
|
|
62
62
|
sidebar: import("./sidebar").SidebarState;
|
|
63
63
|
surcharges: import("./surcharges").SurchargesState;
|
|
64
64
|
taxes: import("./taxes").TaxesState;
|
|
65
|
-
}) => {
|
|
66
|
-
name: string;
|
|
67
|
-
credit: `${number}.${number}` | null;
|
|
68
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
69
|
-
progress: `${number}.${number}` | null;
|
|
70
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
71
|
-
} | null) & {
|
|
65
|
+
}) => LoyaltyProgramSummary | null) & {
|
|
72
66
|
clearCache: () => void;
|
|
73
67
|
resultsCount: () => number;
|
|
74
68
|
resetResultsCount: () => void;
|
|
75
69
|
} & {
|
|
76
|
-
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) =>
|
|
77
|
-
|
|
78
|
-
credit: `${number}.${number}` | null;
|
|
79
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
80
|
-
progress: `${number}.${number}` | null;
|
|
81
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
82
|
-
} | null;
|
|
83
|
-
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => {
|
|
84
|
-
name: string;
|
|
85
|
-
credit: `${number}.${number}` | null;
|
|
86
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
87
|
-
progress: `${number}.${number}` | null;
|
|
88
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
89
|
-
} | null) & {
|
|
70
|
+
resultFunc: (resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null;
|
|
71
|
+
memoizedResultFunc: ((resultFuncArgs_0: import("@open-tender/types").LoyaltyProgram) => LoyaltyProgramSummary | null) & {
|
|
90
72
|
clearCache: () => void;
|
|
91
73
|
resultsCount: () => number;
|
|
92
74
|
resetResultsCount: () => void;
|
|
93
75
|
};
|
|
94
|
-
lastResult: () =>
|
|
95
|
-
name: string;
|
|
96
|
-
credit: `${number}.${number}` | null;
|
|
97
|
-
thresholds: import("@open-tender/types").LoyaltyThresholds;
|
|
98
|
-
progress: `${number}.${number}` | null;
|
|
99
|
-
tier: import("@open-tender/types").LoyaltyTier | undefined;
|
|
100
|
-
} | null;
|
|
76
|
+
lastResult: () => LoyaltyProgramSummary | null;
|
|
101
77
|
dependencies: [(state: AppState) => import("@open-tender/types").LoyaltyProgram];
|
|
102
78
|
recomputations: () => number;
|
|
103
79
|
resetRecomputations: () => void;
|
|
@@ -82,9 +82,19 @@ export var selectCustomerLoyalty = createSelector(function (state) {
|
|
|
82
82
|
if (!loyaltyProgram)
|
|
83
83
|
return null;
|
|
84
84
|
var name = loyaltyProgram.name, perk = loyaltyProgram.perk, status = loyaltyProgram.status;
|
|
85
|
-
var _a = perk || {}, _b = _a.
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
|
|
85
|
+
var _a = perk || {}, _b = _a.loyalty_perk, loyalty_perk = _b === void 0 ? null : _b, _c = _a.credit, credit = _c === void 0 ? null : _c, _d = _a.thresholds, thresholds = _d === void 0 ? [] : _d;
|
|
86
|
+
var isPoints = loyalty_perk === 'BANKABLE_POINTS';
|
|
87
|
+
var points = isPoints && credit ? parseInt(credit) : null;
|
|
88
|
+
var _e = status || {}, _f = _e.progress, progress = _f === void 0 ? null : _f, _g = _e.tiers, tiers = _g === void 0 ? [] : _g;
|
|
89
|
+
var tier = tiers.find(function (i) { return i.is_current_tier; }) || null;
|
|
90
|
+
return {
|
|
91
|
+
name: name,
|
|
92
|
+
perkType: loyalty_perk,
|
|
93
|
+
points: points,
|
|
94
|
+
credit: isPoints ? null : credit,
|
|
95
|
+
thresholds: thresholds,
|
|
96
|
+
progress: isPoints && progress ? parseInt(progress) : progress,
|
|
97
|
+
tier: tier
|
|
98
|
+
};
|
|
89
99
|
});
|
|
90
100
|
export var customerReducer = CustomerSlice.reducer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.90",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
64
|
+
"@open-tender/types": "^0.4.60",
|
|
65
65
|
"@open-tender/ui": "^0.3.75",
|
|
66
66
|
"@open-tender/utils": "^0.4.39",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|