@open-tender/store 1.1.236 → 1.1.237
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/cjs/slices/customer.d.ts +137 -15
- package/dist/cjs/slices/customer.js +26 -20
- package/dist/esm/slices/customer.d.ts +137 -15
- package/dist/esm/slices/customer.js +27 -20
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Allergens, Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, LoyaltyProgramSummary, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Allergens, Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, LoyaltyProgramSummary, Orders, OrderType, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
@@ -88,21 +88,143 @@ export declare const selectCustomerLoyaltySummary: ((state: {
|
|
|
88
88
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
89
89
|
};
|
|
90
90
|
export declare const selectCustomerLoyalty: (state: AppState) => LoyaltyPrograms;
|
|
91
|
-
export declare const selectCustomerLoyaltyProgram: (state:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
export declare const selectCustomerLoyaltyProgram: ((state: {
|
|
92
|
+
alerts: import("@open-tender/types").Alerts;
|
|
93
|
+
allergens: import("./allergens").AllergensState;
|
|
94
|
+
arrivals: import("./arrivals").ArrivalsState;
|
|
95
|
+
cartSummary: import("./cartSummary").CartSummaryState;
|
|
96
|
+
checkout: import("./checkout").CheckoutState;
|
|
97
|
+
config: import("./config").ConfigState;
|
|
98
|
+
customer: CustomerState;
|
|
99
|
+
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
100
|
+
deals: import("./deals").DealsState;
|
|
101
|
+
discounts: import("./discounts").DiscountsState;
|
|
102
|
+
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
103
|
+
kds: import("./kds").KdsState;
|
|
104
|
+
kiosk: import("./kiosk").KioskState;
|
|
105
|
+
menu: import("./menu").MenuState;
|
|
106
|
+
menuPages: import("./menuPages").MenuPagesState;
|
|
107
|
+
modal: import("./modal").ModalState;
|
|
108
|
+
notifications: import("@open-tender/types").Notifications;
|
|
109
|
+
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
110
|
+
order: import("./order").OrderState;
|
|
111
|
+
pos: import("./pos").PosState;
|
|
112
|
+
punches: import("./punches").PunchesState;
|
|
113
|
+
refund: import("./refund").RefundState;
|
|
114
|
+
sendReceipt: import("./sendReceipt").SendReceiptState;
|
|
115
|
+
settings: import("./settings").SettingsState;
|
|
116
|
+
sidebar: import("./sidebar").SidebarState;
|
|
117
|
+
surcharges: import("./surcharges").SurchargesState;
|
|
118
|
+
taxes: import("./taxes").TaxesState;
|
|
119
|
+
idle: import("./idle").IdleState;
|
|
120
|
+
tags: import("./tags").TagsState;
|
|
121
|
+
}) => {
|
|
122
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
123
|
+
loading: RequestStatus;
|
|
124
|
+
error: RequestError;
|
|
125
|
+
}) & {
|
|
126
|
+
clearCache: () => void;
|
|
127
|
+
resultsCount: () => number;
|
|
128
|
+
resetResultsCount: () => void;
|
|
129
|
+
} & {
|
|
130
|
+
resultFunc: (resultFuncArgs_0: {
|
|
131
|
+
entities: LoyaltyPrograms;
|
|
132
|
+
loading: RequestStatus;
|
|
133
|
+
error: RequestError;
|
|
134
|
+
}) => {
|
|
135
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
136
|
+
loading: RequestStatus;
|
|
137
|
+
error: RequestError;
|
|
138
|
+
};
|
|
139
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
140
|
+
entities: LoyaltyPrograms;
|
|
141
|
+
loading: RequestStatus;
|
|
142
|
+
error: RequestError;
|
|
143
|
+
}) => {
|
|
144
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
145
|
+
loading: RequestStatus;
|
|
146
|
+
error: RequestError;
|
|
147
|
+
}) & {
|
|
148
|
+
clearCache: () => void;
|
|
149
|
+
resultsCount: () => number;
|
|
150
|
+
resetResultsCount: () => void;
|
|
151
|
+
};
|
|
152
|
+
lastResult: () => {
|
|
153
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
154
|
+
loading: RequestStatus;
|
|
155
|
+
error: RequestError;
|
|
156
|
+
};
|
|
157
|
+
dependencies: [(state: AppState) => {
|
|
158
|
+
entities: LoyaltyPrograms;
|
|
159
|
+
loading: RequestStatus;
|
|
160
|
+
error: RequestError;
|
|
161
|
+
}];
|
|
162
|
+
recomputations: () => number;
|
|
163
|
+
resetRecomputations: () => void;
|
|
164
|
+
dependencyRecomputations: () => number;
|
|
165
|
+
resetDependencyRecomputations: () => void;
|
|
166
|
+
} & {
|
|
167
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
168
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
169
|
+
};
|
|
170
|
+
export declare const selectCustomerPointsProgram: (orderType: OrderType | null) => ((state: {
|
|
171
|
+
alerts: import("@open-tender/types").Alerts;
|
|
172
|
+
allergens: import("./allergens").AllergensState;
|
|
173
|
+
arrivals: import("./arrivals").ArrivalsState;
|
|
174
|
+
cartSummary: import("./cartSummary").CartSummaryState;
|
|
175
|
+
checkout: import("./checkout").CheckoutState;
|
|
176
|
+
config: import("./config").ConfigState;
|
|
177
|
+
customer: CustomerState;
|
|
178
|
+
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
179
|
+
deals: import("./deals").DealsState;
|
|
180
|
+
discounts: import("./discounts").DiscountsState;
|
|
181
|
+
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
182
|
+
kds: import("./kds").KdsState;
|
|
183
|
+
kiosk: import("./kiosk").KioskState;
|
|
184
|
+
menu: import("./menu").MenuState;
|
|
185
|
+
menuPages: import("./menuPages").MenuPagesState;
|
|
186
|
+
modal: import("./modal").ModalState;
|
|
187
|
+
notifications: import("@open-tender/types").Notifications;
|
|
188
|
+
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
189
|
+
order: import("./order").OrderState;
|
|
190
|
+
pos: import("./pos").PosState;
|
|
191
|
+
punches: import("./punches").PunchesState;
|
|
192
|
+
refund: import("./refund").RefundState;
|
|
193
|
+
sendReceipt: import("./sendReceipt").SendReceiptState;
|
|
194
|
+
settings: import("./settings").SettingsState;
|
|
195
|
+
sidebar: import("./sidebar").SidebarState;
|
|
196
|
+
surcharges: import("./surcharges").SurchargesState;
|
|
197
|
+
taxes: import("./taxes").TaxesState;
|
|
198
|
+
idle: import("./idle").IdleState;
|
|
199
|
+
tags: import("./tags").TagsState;
|
|
200
|
+
}) => import("@open-tender/types").LoyaltyProgram | null) & {
|
|
201
|
+
clearCache: () => void;
|
|
202
|
+
resultsCount: () => number;
|
|
203
|
+
resetResultsCount: () => void;
|
|
204
|
+
} & {
|
|
205
|
+
resultFunc: (resultFuncArgs_0: {
|
|
206
|
+
loyaltyPrograms: LoyaltyPrograms;
|
|
207
|
+
}) => import("@open-tender/types").LoyaltyProgram | null;
|
|
208
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
209
|
+
loyaltyPrograms: LoyaltyPrograms;
|
|
210
|
+
}) => import("@open-tender/types").LoyaltyProgram | null) & {
|
|
211
|
+
clearCache: () => void;
|
|
212
|
+
resultsCount: () => number;
|
|
213
|
+
resetResultsCount: () => void;
|
|
214
|
+
};
|
|
215
|
+
lastResult: () => import("@open-tender/types").LoyaltyProgram | null;
|
|
216
|
+
dependencies: [(state: AppState) => {
|
|
217
|
+
loyaltyPrograms: LoyaltyPrograms;
|
|
218
|
+
}];
|
|
219
|
+
recomputations: () => number;
|
|
220
|
+
resetRecomputations: () => void;
|
|
221
|
+
dependencyRecomputations: () => number;
|
|
222
|
+
resetDependencyRecomputations: () => void;
|
|
223
|
+
} & {
|
|
224
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
225
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
103
226
|
};
|
|
104
|
-
export declare const
|
|
105
|
-
export declare const selectCustomerPoints: (state: AppState) => {
|
|
227
|
+
export declare const selectCustomerPoints: (orderType: OrderType | null) => (state: AppState) => {
|
|
106
228
|
name: string;
|
|
107
229
|
points: `${number}.${number}` | null;
|
|
108
230
|
} | null;
|
|
@@ -111,37 +111,43 @@ exports.selectCustomerLoyaltySummary = (0, toolkit_1.createSelector)(function (s
|
|
|
111
111
|
});
|
|
112
112
|
var selectCustomerLoyalty = function (state) { return state.customer.loyalty; };
|
|
113
113
|
exports.selectCustomerLoyalty = selectCustomerLoyalty;
|
|
114
|
-
|
|
115
|
-
var
|
|
116
|
-
|
|
114
|
+
exports.selectCustomerLoyaltyProgram = (0, toolkit_1.createSelector)(function (state) {
|
|
115
|
+
var _a = state.customer, entities = _a.loyalty, loading = _a.loading, error = _a.error;
|
|
116
|
+
return { entities: entities, loading: loading, error: error };
|
|
117
|
+
}, function (_a) {
|
|
118
|
+
var entities = _a.entities, loading = _a.loading, error = _a.error;
|
|
119
|
+
var programs = entities.filter(function (i) { return i.earn_order_type === null || i.earn_order_type === 'OLO'; });
|
|
117
120
|
var program = programs.length ? programs[0] : null;
|
|
118
|
-
return
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
return { program: program, loading: loading, error: error };
|
|
122
|
+
});
|
|
123
|
+
var selectCustomerPointsProgram = function (orderType) {
|
|
124
|
+
return (0, toolkit_1.createSelector)(function (state) {
|
|
125
|
+
var loyaltyPrograms = state.customer.loyalty;
|
|
126
|
+
return { loyaltyPrograms: loyaltyPrograms };
|
|
127
|
+
}, function (_a) {
|
|
128
|
+
var loyaltyPrograms = _a.loyaltyPrograms;
|
|
129
|
+
if (!loyaltyPrograms)
|
|
130
|
+
return null;
|
|
131
|
+
var programs = loyaltyPrograms.filter(function (i) {
|
|
132
|
+
var _a;
|
|
133
|
+
return ((_a = i.perk) === null || _a === void 0 ? void 0 : _a.loyalty_perk) === 'BANKABLE_POINTS' &&
|
|
134
|
+
(i.earn_order_type === null || i.earn_order_type === orderType);
|
|
135
|
+
});
|
|
136
|
+
return programs.length ? programs[0] : null;
|
|
130
137
|
});
|
|
131
|
-
return programs.length ? programs[0] : null;
|
|
132
138
|
};
|
|
133
139
|
exports.selectCustomerPointsProgram = selectCustomerPointsProgram;
|
|
134
|
-
var selectCustomerPoints = function (state) {
|
|
135
|
-
var program = (0, exports.selectCustomerPointsProgram)(state);
|
|
140
|
+
var selectCustomerPoints = function (orderType) { return function (state) {
|
|
141
|
+
var program = (0, exports.selectCustomerPointsProgram)(orderType)(state);
|
|
136
142
|
if (!program || !program.perk)
|
|
137
143
|
return null;
|
|
138
144
|
var spend_name = program.spend_name, perk = program.perk;
|
|
139
145
|
return { name: spend_name, points: perk.credit };
|
|
140
|
-
};
|
|
146
|
+
}; };
|
|
141
147
|
exports.selectCustomerPoints = selectCustomerPoints;
|
|
142
148
|
var selectPointsProgram = function (state) {
|
|
143
149
|
var orderType = state.order.orderType;
|
|
144
|
-
return orderType ? (0, exports.selectCustomerPointsProgram)(state) : null;
|
|
150
|
+
return orderType ? (0, exports.selectCustomerPointsProgram)(orderType)(state) : null;
|
|
145
151
|
};
|
|
146
152
|
exports.selectPointsProgram = selectPointsProgram;
|
|
147
153
|
exports.customerReducer = CustomerSlice.reducer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Allergens, Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, LoyaltyProgramSummary, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Allergens, Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, LoyaltyProgramSummary, Orders, OrderType, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
@@ -88,21 +88,143 @@ export declare const selectCustomerLoyaltySummary: ((state: {
|
|
|
88
88
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
89
89
|
};
|
|
90
90
|
export declare const selectCustomerLoyalty: (state: AppState) => LoyaltyPrograms;
|
|
91
|
-
export declare const selectCustomerLoyaltyProgram: (state:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
export declare const selectCustomerLoyaltyProgram: ((state: {
|
|
92
|
+
alerts: import("@open-tender/types").Alerts;
|
|
93
|
+
allergens: import("./allergens").AllergensState;
|
|
94
|
+
arrivals: import("./arrivals").ArrivalsState;
|
|
95
|
+
cartSummary: import("./cartSummary").CartSummaryState;
|
|
96
|
+
checkout: import("./checkout").CheckoutState;
|
|
97
|
+
config: import("./config").ConfigState;
|
|
98
|
+
customer: CustomerState;
|
|
99
|
+
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
100
|
+
deals: import("./deals").DealsState;
|
|
101
|
+
discounts: import("./discounts").DiscountsState;
|
|
102
|
+
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
103
|
+
kds: import("./kds").KdsState;
|
|
104
|
+
kiosk: import("./kiosk").KioskState;
|
|
105
|
+
menu: import("./menu").MenuState;
|
|
106
|
+
menuPages: import("./menuPages").MenuPagesState;
|
|
107
|
+
modal: import("./modal").ModalState;
|
|
108
|
+
notifications: import("@open-tender/types").Notifications;
|
|
109
|
+
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
110
|
+
order: import("./order").OrderState;
|
|
111
|
+
pos: import("./pos").PosState;
|
|
112
|
+
punches: import("./punches").PunchesState;
|
|
113
|
+
refund: import("./refund").RefundState;
|
|
114
|
+
sendReceipt: import("./sendReceipt").SendReceiptState;
|
|
115
|
+
settings: import("./settings").SettingsState;
|
|
116
|
+
sidebar: import("./sidebar").SidebarState;
|
|
117
|
+
surcharges: import("./surcharges").SurchargesState;
|
|
118
|
+
taxes: import("./taxes").TaxesState;
|
|
119
|
+
idle: import("./idle").IdleState;
|
|
120
|
+
tags: import("./tags").TagsState;
|
|
121
|
+
}) => {
|
|
122
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
123
|
+
loading: RequestStatus;
|
|
124
|
+
error: RequestError;
|
|
125
|
+
}) & {
|
|
126
|
+
clearCache: () => void;
|
|
127
|
+
resultsCount: () => number;
|
|
128
|
+
resetResultsCount: () => void;
|
|
129
|
+
} & {
|
|
130
|
+
resultFunc: (resultFuncArgs_0: {
|
|
131
|
+
entities: LoyaltyPrograms;
|
|
132
|
+
loading: RequestStatus;
|
|
133
|
+
error: RequestError;
|
|
134
|
+
}) => {
|
|
135
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
136
|
+
loading: RequestStatus;
|
|
137
|
+
error: RequestError;
|
|
138
|
+
};
|
|
139
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
140
|
+
entities: LoyaltyPrograms;
|
|
141
|
+
loading: RequestStatus;
|
|
142
|
+
error: RequestError;
|
|
143
|
+
}) => {
|
|
144
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
145
|
+
loading: RequestStatus;
|
|
146
|
+
error: RequestError;
|
|
147
|
+
}) & {
|
|
148
|
+
clearCache: () => void;
|
|
149
|
+
resultsCount: () => number;
|
|
150
|
+
resetResultsCount: () => void;
|
|
151
|
+
};
|
|
152
|
+
lastResult: () => {
|
|
153
|
+
program: import("@open-tender/types").LoyaltyProgram | null;
|
|
154
|
+
loading: RequestStatus;
|
|
155
|
+
error: RequestError;
|
|
156
|
+
};
|
|
157
|
+
dependencies: [(state: AppState) => {
|
|
158
|
+
entities: LoyaltyPrograms;
|
|
159
|
+
loading: RequestStatus;
|
|
160
|
+
error: RequestError;
|
|
161
|
+
}];
|
|
162
|
+
recomputations: () => number;
|
|
163
|
+
resetRecomputations: () => void;
|
|
164
|
+
dependencyRecomputations: () => number;
|
|
165
|
+
resetDependencyRecomputations: () => void;
|
|
166
|
+
} & {
|
|
167
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
168
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
169
|
+
};
|
|
170
|
+
export declare const selectCustomerPointsProgram: (orderType: OrderType | null) => ((state: {
|
|
171
|
+
alerts: import("@open-tender/types").Alerts;
|
|
172
|
+
allergens: import("./allergens").AllergensState;
|
|
173
|
+
arrivals: import("./arrivals").ArrivalsState;
|
|
174
|
+
cartSummary: import("./cartSummary").CartSummaryState;
|
|
175
|
+
checkout: import("./checkout").CheckoutState;
|
|
176
|
+
config: import("./config").ConfigState;
|
|
177
|
+
customer: CustomerState;
|
|
178
|
+
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
179
|
+
deals: import("./deals").DealsState;
|
|
180
|
+
discounts: import("./discounts").DiscountsState;
|
|
181
|
+
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
182
|
+
kds: import("./kds").KdsState;
|
|
183
|
+
kiosk: import("./kiosk").KioskState;
|
|
184
|
+
menu: import("./menu").MenuState;
|
|
185
|
+
menuPages: import("./menuPages").MenuPagesState;
|
|
186
|
+
modal: import("./modal").ModalState;
|
|
187
|
+
notifications: import("@open-tender/types").Notifications;
|
|
188
|
+
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
189
|
+
order: import("./order").OrderState;
|
|
190
|
+
pos: import("./pos").PosState;
|
|
191
|
+
punches: import("./punches").PunchesState;
|
|
192
|
+
refund: import("./refund").RefundState;
|
|
193
|
+
sendReceipt: import("./sendReceipt").SendReceiptState;
|
|
194
|
+
settings: import("./settings").SettingsState;
|
|
195
|
+
sidebar: import("./sidebar").SidebarState;
|
|
196
|
+
surcharges: import("./surcharges").SurchargesState;
|
|
197
|
+
taxes: import("./taxes").TaxesState;
|
|
198
|
+
idle: import("./idle").IdleState;
|
|
199
|
+
tags: import("./tags").TagsState;
|
|
200
|
+
}) => import("@open-tender/types").LoyaltyProgram | null) & {
|
|
201
|
+
clearCache: () => void;
|
|
202
|
+
resultsCount: () => number;
|
|
203
|
+
resetResultsCount: () => void;
|
|
204
|
+
} & {
|
|
205
|
+
resultFunc: (resultFuncArgs_0: {
|
|
206
|
+
loyaltyPrograms: LoyaltyPrograms;
|
|
207
|
+
}) => import("@open-tender/types").LoyaltyProgram | null;
|
|
208
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
209
|
+
loyaltyPrograms: LoyaltyPrograms;
|
|
210
|
+
}) => import("@open-tender/types").LoyaltyProgram | null) & {
|
|
211
|
+
clearCache: () => void;
|
|
212
|
+
resultsCount: () => number;
|
|
213
|
+
resetResultsCount: () => void;
|
|
214
|
+
};
|
|
215
|
+
lastResult: () => import("@open-tender/types").LoyaltyProgram | null;
|
|
216
|
+
dependencies: [(state: AppState) => {
|
|
217
|
+
loyaltyPrograms: LoyaltyPrograms;
|
|
218
|
+
}];
|
|
219
|
+
recomputations: () => number;
|
|
220
|
+
resetRecomputations: () => void;
|
|
221
|
+
dependencyRecomputations: () => number;
|
|
222
|
+
resetDependencyRecomputations: () => void;
|
|
223
|
+
} & {
|
|
224
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
225
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
103
226
|
};
|
|
104
|
-
export declare const
|
|
105
|
-
export declare const selectCustomerPoints: (state: AppState) => {
|
|
227
|
+
export declare const selectCustomerPoints: (orderType: OrderType | null) => (state: AppState) => {
|
|
106
228
|
name: string;
|
|
107
229
|
points: `${number}.${number}` | null;
|
|
108
230
|
} | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
2
|
import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { ReducerType } from './types';
|
|
4
4
|
var initialState = {
|
|
@@ -100,33 +100,40 @@ export var selectCustomerLoyaltySummary = createSelector(function (state) {
|
|
|
100
100
|
};
|
|
101
101
|
});
|
|
102
102
|
export var selectCustomerLoyalty = function (state) { return state.customer.loyalty; };
|
|
103
|
-
export var selectCustomerLoyaltyProgram = function (state) {
|
|
104
|
-
var
|
|
105
|
-
|
|
103
|
+
export var selectCustomerLoyaltyProgram = createSelector(function (state) {
|
|
104
|
+
var _a = state.customer, entities = _a.loyalty, loading = _a.loading, error = _a.error;
|
|
105
|
+
return { entities: entities, loading: loading, error: error };
|
|
106
|
+
}, function (_a) {
|
|
107
|
+
var entities = _a.entities, loading = _a.loading, error = _a.error;
|
|
108
|
+
var programs = entities.filter(function (i) { return i.earn_order_type === null || i.earn_order_type === 'OLO'; });
|
|
106
109
|
var program = programs.length ? programs[0] : null;
|
|
107
|
-
return
|
|
108
|
-
};
|
|
109
|
-
export var selectCustomerPointsProgram = function (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
return { program: program, loading: loading, error: error };
|
|
111
|
+
});
|
|
112
|
+
export var selectCustomerPointsProgram = function (orderType) {
|
|
113
|
+
return createSelector(function (state) {
|
|
114
|
+
var loyaltyPrograms = state.customer.loyalty;
|
|
115
|
+
return { loyaltyPrograms: loyaltyPrograms };
|
|
116
|
+
}, function (_a) {
|
|
117
|
+
var loyaltyPrograms = _a.loyaltyPrograms;
|
|
118
|
+
if (!loyaltyPrograms)
|
|
119
|
+
return null;
|
|
120
|
+
var programs = loyaltyPrograms.filter(function (i) {
|
|
121
|
+
var _a;
|
|
122
|
+
return ((_a = i.perk) === null || _a === void 0 ? void 0 : _a.loyalty_perk) === 'BANKABLE_POINTS' &&
|
|
123
|
+
(i.earn_order_type === null || i.earn_order_type === orderType);
|
|
124
|
+
});
|
|
125
|
+
return programs.length ? programs[0] : null;
|
|
118
126
|
});
|
|
119
|
-
return programs.length ? programs[0] : null;
|
|
120
127
|
};
|
|
121
|
-
export var selectCustomerPoints = function (state) {
|
|
122
|
-
var program = selectCustomerPointsProgram(state);
|
|
128
|
+
export var selectCustomerPoints = function (orderType) { return function (state) {
|
|
129
|
+
var program = selectCustomerPointsProgram(orderType)(state);
|
|
123
130
|
if (!program || !program.perk)
|
|
124
131
|
return null;
|
|
125
132
|
var spend_name = program.spend_name, perk = program.perk;
|
|
126
133
|
return { name: spend_name, points: perk.credit };
|
|
127
|
-
};
|
|
134
|
+
}; };
|
|
128
135
|
export var selectPointsProgram = function (state) {
|
|
129
136
|
var orderType = state.order.orderType;
|
|
130
|
-
return orderType ? selectCustomerPointsProgram(state) : null;
|
|
137
|
+
return orderType ? selectCustomerPointsProgram(orderType)(state) : null;
|
|
131
138
|
};
|
|
132
139
|
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.237",
|
|
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",
|