@open-tender/store 1.0.19 → 1.0.20
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/app/hooks.d.ts +1 -0
- package/dist/cjs/app/store.d.ts +4 -0
- package/dist/cjs/app/store.js +2 -1
- package/dist/cjs/services/api.d.ts +2 -1
- package/dist/cjs/services/api.js +4 -0
- package/dist/cjs/slices/customer.d.ts +37 -0
- package/dist/cjs/slices/customer.js +88 -0
- package/dist/cjs/slices/customerIdentify.d.ts +1 -1
- package/dist/cjs/slices/customerIdentify.js +2 -2
- package/dist/cjs/slices/index.d.ts +1 -0
- package/dist/cjs/slices/index.js +1 -0
- package/dist/cjs/slices/kiosk.d.ts +2 -0
- package/dist/cjs/slices/menuPages.d.ts +1 -0
- package/dist/cjs/slices/order.d.ts +4 -0
- package/dist/cjs/slices/types.d.ts +1 -0
- package/dist/cjs/slices/types.js +1 -0
- package/dist/esm/app/hooks.d.ts +1 -0
- package/dist/esm/app/store.d.ts +4 -0
- package/dist/esm/app/store.js +3 -2
- package/dist/esm/services/api.d.ts +2 -1
- package/dist/esm/services/api.js +4 -0
- package/dist/esm/slices/customer.d.ts +37 -0
- package/dist/esm/slices/customer.js +78 -0
- package/dist/esm/slices/customerIdentify.d.ts +1 -1
- package/dist/esm/slices/customerIdentify.js +1 -1
- package/dist/esm/slices/index.d.ts +1 -0
- package/dist/esm/slices/index.js +1 -0
- package/dist/esm/slices/kiosk.d.ts +2 -0
- package/dist/esm/slices/menuPages.d.ts +1 -0
- package/dist/esm/slices/order.d.ts +4 -0
- package/dist/esm/slices/types.d.ts +1 -0
- package/dist/esm/slices/types.js +1 -0
- package/package.json +3 -3
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
|
6
6
|
cartSummary: import("..").CartSummaryState;
|
|
7
7
|
checkout: import("..").CheckoutState;
|
|
8
8
|
config: import("..").ConfigState;
|
|
9
|
+
customer: import("..").CustomerState;
|
|
9
10
|
customerIdentify: import("..").CustomerIdentifyState;
|
|
10
11
|
discounts: import("..").DiscountsState;
|
|
11
12
|
errorAlerts: import("..").ErrorAlertsState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
5
5
|
cartSummary: import("../slices").CartSummaryState;
|
|
6
6
|
checkout: import("../slices").CheckoutState;
|
|
7
7
|
config: import("../slices").ConfigState;
|
|
8
|
+
customer: import("../slices").CustomerState;
|
|
8
9
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
9
10
|
discounts: import("../slices").DiscountsState;
|
|
10
11
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
@@ -29,6 +30,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
29
30
|
cartSummary: import("../slices").CartSummaryState | undefined;
|
|
30
31
|
checkout: import("../slices").CheckoutState | undefined;
|
|
31
32
|
config: import("../slices").ConfigState | undefined;
|
|
33
|
+
customer: import("../slices").CustomerState | undefined;
|
|
32
34
|
customerIdentify: import("../slices").CustomerIdentifyState | undefined;
|
|
33
35
|
discounts: import("../slices").DiscountsState | undefined;
|
|
34
36
|
errorAlerts: import("../slices").ErrorAlertsState | undefined;
|
|
@@ -55,6 +57,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
55
57
|
cartSummary: import("../slices").CartSummaryState;
|
|
56
58
|
checkout: import("../slices").CheckoutState;
|
|
57
59
|
config: import("../slices").ConfigState;
|
|
60
|
+
customer: import("../slices").CustomerState;
|
|
58
61
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
59
62
|
discounts: import("../slices").DiscountsState;
|
|
60
63
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
@@ -80,6 +83,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
80
83
|
cartSummary: import("../slices").CartSummaryState;
|
|
81
84
|
checkout: import("../slices").CheckoutState;
|
|
82
85
|
config: import("../slices").ConfigState;
|
|
86
|
+
customer: import("../slices").CustomerState;
|
|
83
87
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
84
88
|
discounts: import("../slices").DiscountsState;
|
|
85
89
|
errorAlerts: import("../slices").ErrorAlertsState;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -9,7 +9,8 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
9
9
|
cartSummary: slices_1.cartSummaryReducer,
|
|
10
10
|
checkout: slices_1.checkoutReducer,
|
|
11
11
|
config: slices_1.configReducer,
|
|
12
|
-
|
|
12
|
+
customer: slices_1.customerReducer,
|
|
13
|
+
customerIdentify: slices_1.customerIdentifyReducer,
|
|
13
14
|
discounts: slices_1.discountsReducer,
|
|
14
15
|
errorAlerts: slices_1.errorAlertsReducer,
|
|
15
16
|
kds: slices_1.kdsReducer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrivals, CustomerIdentifier, CustomerIdentify, Menu, Order, Orders, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender, OrderCreatePos } from '@open-tender/types';
|
|
1
|
+
import { Arrivals, CustomerIdentifier, CustomerIdentify, Menu, Order, Orders, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender, OrderCreatePos, CustomerEndpoints } from '@open-tender/types';
|
|
2
2
|
import { CashEvent, CashSummary, DeviceRead, Discount, Discounts, Employee, Employees, PosSettingType, ErrorAlert, ErrorAlerts, GiftCardBalance, GiftCardCredit, InternalSettings, KioskConfig, LevelUp, MenuColors, MenuPages, OfflineAuths, OfflineAuthsResult, Punch, Refund, Settings, Store, Surcharges, Taxes, Tender } from '../types';
|
|
3
3
|
import { OrdersParams } from '../slices';
|
|
4
4
|
export interface InitAPI {
|
|
@@ -61,6 +61,7 @@ declare class PosAPI {
|
|
|
61
61
|
postChipDNACancel(): Promise<null>;
|
|
62
62
|
postChipDNATmsUpdate(): Promise<null>;
|
|
63
63
|
postIdentifyCustomer(data: CustomerIdentifier): Promise<CustomerIdentify>;
|
|
64
|
+
getCustomer(customerId: number, endpoints: CustomerEndpoints): Promise<any>;
|
|
64
65
|
postOrderValidate(order: OrderCreatePos): Promise<Order>;
|
|
65
66
|
postOrder(order: OrderCreatePos): Promise<Order>;
|
|
66
67
|
deleteOrder(order: OrderCreatePos): Promise<Order>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -288,6 +288,10 @@ var PosAPI = /** @class */ (function () {
|
|
|
288
288
|
PosAPI.prototype.postIdentifyCustomer = function (data) {
|
|
289
289
|
return this.request("/identify-customer", 'POST', data);
|
|
290
290
|
};
|
|
291
|
+
PosAPI.prototype.getCustomer = function (customerId, endpoints) {
|
|
292
|
+
var query = "endpoints=".concat(endpoints.join(','));
|
|
293
|
+
return this.request("/customer/".concat(customerId, "?").concat(query));
|
|
294
|
+
};
|
|
291
295
|
PosAPI.prototype.postOrderValidate = function (order) {
|
|
292
296
|
return this.request("/orders/validate", 'POST', order);
|
|
293
297
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerState {
|
|
4
|
+
account: Customer | null;
|
|
5
|
+
giftCards: GiftCards;
|
|
6
|
+
favorites: Favorites;
|
|
7
|
+
loyalty: LoyaltyPrograms;
|
|
8
|
+
rewards: Discounts;
|
|
9
|
+
orders: Orders;
|
|
10
|
+
loading: RequestStatus;
|
|
11
|
+
error: RequestError;
|
|
12
|
+
}
|
|
13
|
+
export declare enum CustomerActionType {
|
|
14
|
+
FetchCustomer = "Customer/fetchCustomer"
|
|
15
|
+
}
|
|
16
|
+
export declare const fetchCustomer: import("@reduxjs/toolkit").AsyncThunk<CustomerEntities, {
|
|
17
|
+
customerId: number;
|
|
18
|
+
endpoints: CustomerEndpoints;
|
|
19
|
+
}, {
|
|
20
|
+
state: AppState;
|
|
21
|
+
rejectValue: RequestError;
|
|
22
|
+
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
|
|
23
|
+
extra?: unknown;
|
|
24
|
+
serializedErrorType?: unknown;
|
|
25
|
+
pendingMeta?: unknown;
|
|
26
|
+
fulfilledMeta?: unknown;
|
|
27
|
+
rejectedMeta?: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const resetCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customer/resetCustomer">;
|
|
30
|
+
export declare const selectCustomer: (state: AppState) => CustomerState;
|
|
31
|
+
export declare const selectCustomerAccount: (state: AppState) => Customer | null;
|
|
32
|
+
export declare const selectCustomerGiftCards: (state: AppState) => GiftCards;
|
|
33
|
+
export declare const selectCustomerFavorites: (state: AppState) => Favorites;
|
|
34
|
+
export declare const selectCustomerLoyalty: (state: AppState) => LoyaltyPrograms;
|
|
35
|
+
export declare const selectCustomerRewards: (state: AppState) => Discounts;
|
|
36
|
+
export declare const selectCustomerOrders: (state: AppState) => Orders;
|
|
37
|
+
export declare const customerReducer: import("redux").Reducer<CustomerState>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customerReducer = exports.selectCustomerOrders = exports.selectCustomerRewards = exports.selectCustomerLoyalty = exports.selectCustomerFavorites = exports.selectCustomerGiftCards = exports.selectCustomerAccount = exports.selectCustomer = exports.resetCustomer = exports.fetchCustomer = exports.CustomerActionType = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
var types_1 = require("./types");
|
|
7
|
+
var initialState = {
|
|
8
|
+
account: null,
|
|
9
|
+
giftCards: [],
|
|
10
|
+
favorites: [],
|
|
11
|
+
loyalty: [],
|
|
12
|
+
rewards: [],
|
|
13
|
+
orders: [],
|
|
14
|
+
loading: 'idle',
|
|
15
|
+
error: null
|
|
16
|
+
};
|
|
17
|
+
var CustomerActionType;
|
|
18
|
+
(function (CustomerActionType) {
|
|
19
|
+
CustomerActionType["FetchCustomer"] = "Customer/fetchCustomer";
|
|
20
|
+
})(CustomerActionType || (exports.CustomerActionType = CustomerActionType = {}));
|
|
21
|
+
exports.fetchCustomer = (0, toolkit_1.createAsyncThunk)(CustomerActionType.FetchCustomer, function (_a, _b) {
|
|
22
|
+
var customerId = _a.customerId, endpoints = _a.endpoints;
|
|
23
|
+
var getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
24
|
+
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
25
|
+
var api, err_1;
|
|
26
|
+
return tslib_1.__generator(this, function (_c) {
|
|
27
|
+
switch (_c.label) {
|
|
28
|
+
case 0:
|
|
29
|
+
_c.trys.push([0, 2, , 3]);
|
|
30
|
+
api = getState().config.api;
|
|
31
|
+
return [4 /*yield*/, api.getCustomer(customerId, endpoints)];
|
|
32
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
33
|
+
case 2:
|
|
34
|
+
err_1 = _c.sent();
|
|
35
|
+
return [2 /*return*/, rejectWithValue(err_1)];
|
|
36
|
+
case 3: return [2 /*return*/];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
var CustomerSlice = (0, toolkit_1.createSlice)({
|
|
42
|
+
name: types_1.ReducerType.Customer,
|
|
43
|
+
initialState: initialState,
|
|
44
|
+
reducers: {
|
|
45
|
+
resetCustomer: function () { return initialState; }
|
|
46
|
+
},
|
|
47
|
+
extraReducers: function (builder) {
|
|
48
|
+
builder
|
|
49
|
+
.addCase(exports.fetchCustomer.fulfilled, function (state, action) {
|
|
50
|
+
var _a = action.payload, _b = _a.ACCOUNT, ACCOUNT = _b === void 0 ? null : _b, _c = _a.GIFT_CARDS, GIFT_CARDS = _c === void 0 ? [] : _c, _d = _a.FAVORITES, FAVORITES = _d === void 0 ? [] : _d, _e = _a.LOYALTY, LOYALTY = _e === void 0 ? [] : _e, _f = _a.REWARDS, REWARDS = _f === void 0 ? [] : _f, _g = _a.ORDERS, ORDERS = _g === void 0 ? [] : _g;
|
|
51
|
+
state.account = ACCOUNT;
|
|
52
|
+
state.giftCards = GIFT_CARDS;
|
|
53
|
+
state.favorites = FAVORITES;
|
|
54
|
+
state.loyalty = LOYALTY;
|
|
55
|
+
state.rewards = REWARDS;
|
|
56
|
+
state.orders = ORDERS;
|
|
57
|
+
state.loading = 'idle';
|
|
58
|
+
state.error = null;
|
|
59
|
+
})
|
|
60
|
+
.addCase(exports.fetchCustomer.pending, function (state) {
|
|
61
|
+
state.loading = 'pending';
|
|
62
|
+
})
|
|
63
|
+
.addCase(exports.fetchCustomer.rejected, function (state, action) {
|
|
64
|
+
state.error = action.payload;
|
|
65
|
+
state.loading = 'idle';
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
exports.resetCustomer = CustomerSlice.actions.resetCustomer;
|
|
70
|
+
var selectCustomer = function (state) { return state.customer; };
|
|
71
|
+
exports.selectCustomer = selectCustomer;
|
|
72
|
+
var selectCustomerAccount = function (state) { return state.customer.account; };
|
|
73
|
+
exports.selectCustomerAccount = selectCustomerAccount;
|
|
74
|
+
var selectCustomerGiftCards = function (state) {
|
|
75
|
+
return state.customer.giftCards;
|
|
76
|
+
};
|
|
77
|
+
exports.selectCustomerGiftCards = selectCustomerGiftCards;
|
|
78
|
+
var selectCustomerFavorites = function (state) {
|
|
79
|
+
return state.customer.favorites;
|
|
80
|
+
};
|
|
81
|
+
exports.selectCustomerFavorites = selectCustomerFavorites;
|
|
82
|
+
var selectCustomerLoyalty = function (state) { return state.customer.loyalty; };
|
|
83
|
+
exports.selectCustomerLoyalty = selectCustomerLoyalty;
|
|
84
|
+
var selectCustomerRewards = function (state) { return state.customer.rewards; };
|
|
85
|
+
exports.selectCustomerRewards = selectCustomerRewards;
|
|
86
|
+
var selectCustomerOrders = function (state) { return state.customer.orders; };
|
|
87
|
+
exports.selectCustomerOrders = selectCustomerOrders;
|
|
88
|
+
exports.customerReducer = CustomerSlice.reducer;
|
|
@@ -21,4 +21,4 @@ export declare const fetchCustomerIdentify: import("@reduxjs/toolkit").AsyncThun
|
|
|
21
21
|
export declare const resetCustomerIdentify: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customerIdentify/resetCustomerIdentify">;
|
|
22
22
|
export declare const selectCustomerIdentify: (state: AppState) => CustomerIdentifyState;
|
|
23
23
|
export declare const selectCustomerIdentified: (state: AppState) => CustomerIdentify | null;
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const customerIdentifyReducer: import("redux").Reducer<CustomerIdentifyState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.customerIdentifyReducer = exports.selectCustomerIdentified = exports.selectCustomerIdentify = exports.resetCustomerIdentify = exports.fetchCustomerIdentify = exports.CustomerIdentifyActionType = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
var types_1 = require("./types");
|
|
@@ -63,4 +63,4 @@ var selectCustomerIdentified = function (state) {
|
|
|
63
63
|
return state.customerIdentify.data;
|
|
64
64
|
};
|
|
65
65
|
exports.selectCustomerIdentified = selectCustomerIdentified;
|
|
66
|
-
exports.
|
|
66
|
+
exports.customerIdentifyReducer = customerIdentifySlice.reducer;
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./arrivals"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./cartSummary"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./checkout"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./config"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./customer"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./customerIdentify"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./discounts"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./errorAlerts"), exports);
|
|
@@ -47,6 +47,7 @@ export declare const selectKioskConfig: ((state: {
|
|
|
47
47
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
48
48
|
checkout: import("./checkout").CheckoutState;
|
|
49
49
|
config: import("./config").ConfigState;
|
|
50
|
+
customer: import("./customer").CustomerState;
|
|
50
51
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
51
52
|
discounts: import("./discounts").DiscountsState;
|
|
52
53
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -92,6 +93,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
|
92
93
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
93
94
|
checkout: import("./checkout").CheckoutState;
|
|
94
95
|
config: import("./config").ConfigState;
|
|
96
|
+
customer: import("./customer").CustomerState;
|
|
95
97
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
96
98
|
discounts: import("./discounts").DiscountsState;
|
|
97
99
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -26,6 +26,7 @@ export declare const selectMenuPagesFiltered: ((state: {
|
|
|
26
26
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
27
27
|
checkout: import("./checkout").CheckoutState;
|
|
28
28
|
config: import("./config").ConfigState;
|
|
29
|
+
customer: import("./customer").CustomerState;
|
|
29
30
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
30
31
|
discounts: import("./discounts").DiscountsState;
|
|
31
32
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -47,6 +47,7 @@ export declare const selectCartIds: ((state: {
|
|
|
47
47
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
48
48
|
checkout: import("./checkout").CheckoutState;
|
|
49
49
|
config: import("./config").ConfigState;
|
|
50
|
+
customer: import("./customer").CustomerState;
|
|
50
51
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
51
52
|
discounts: import("./discounts").DiscountsState;
|
|
52
53
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -92,6 +93,7 @@ export declare const selectCartQuantity: ((state: {
|
|
|
92
93
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
93
94
|
checkout: import("./checkout").CheckoutState;
|
|
94
95
|
config: import("./config").ConfigState;
|
|
96
|
+
customer: import("./customer").CustomerState;
|
|
95
97
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
96
98
|
discounts: import("./discounts").DiscountsState;
|
|
97
99
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -137,6 +139,7 @@ export declare const selectCartTotal: ((state: {
|
|
|
137
139
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
138
140
|
checkout: import("./checkout").CheckoutState;
|
|
139
141
|
config: import("./config").ConfigState;
|
|
142
|
+
customer: import("./customer").CustomerState;
|
|
140
143
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
141
144
|
discounts: import("./discounts").DiscountsState;
|
|
142
145
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -182,6 +185,7 @@ export declare const selectCartTotals: ((state: {
|
|
|
182
185
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
183
186
|
checkout: import("./checkout").CheckoutState;
|
|
184
187
|
config: import("./config").ConfigState;
|
|
188
|
+
customer: import("./customer").CustomerState;
|
|
185
189
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
186
190
|
discounts: import("./discounts").DiscountsState;
|
|
187
191
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -9,6 +9,7 @@ var ReducerType;
|
|
|
9
9
|
ReducerType["Checkout"] = "checkout";
|
|
10
10
|
ReducerType["CompletedOrders"] = "completedOrders";
|
|
11
11
|
ReducerType["Config"] = "config";
|
|
12
|
+
ReducerType["Customer"] = "customer";
|
|
12
13
|
ReducerType["CustomerIdentify"] = "customerIdentify";
|
|
13
14
|
ReducerType["Discounts"] = "discounts";
|
|
14
15
|
ReducerType["ErrorAlerts"] = "errorAlerts";
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
|
6
6
|
cartSummary: import("..").CartSummaryState;
|
|
7
7
|
checkout: import("..").CheckoutState;
|
|
8
8
|
config: import("..").ConfigState;
|
|
9
|
+
customer: import("..").CustomerState;
|
|
9
10
|
customerIdentify: import("..").CustomerIdentifyState;
|
|
10
11
|
discounts: import("..").DiscountsState;
|
|
11
12
|
errorAlerts: import("..").ErrorAlertsState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
5
5
|
cartSummary: import("../slices").CartSummaryState;
|
|
6
6
|
checkout: import("../slices").CheckoutState;
|
|
7
7
|
config: import("../slices").ConfigState;
|
|
8
|
+
customer: import("../slices").CustomerState;
|
|
8
9
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
9
10
|
discounts: import("../slices").DiscountsState;
|
|
10
11
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
@@ -29,6 +30,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
29
30
|
cartSummary: import("../slices").CartSummaryState | undefined;
|
|
30
31
|
checkout: import("../slices").CheckoutState | undefined;
|
|
31
32
|
config: import("../slices").ConfigState | undefined;
|
|
33
|
+
customer: import("../slices").CustomerState | undefined;
|
|
32
34
|
customerIdentify: import("../slices").CustomerIdentifyState | undefined;
|
|
33
35
|
discounts: import("../slices").DiscountsState | undefined;
|
|
34
36
|
errorAlerts: import("../slices").ErrorAlertsState | undefined;
|
|
@@ -55,6 +57,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
55
57
|
cartSummary: import("../slices").CartSummaryState;
|
|
56
58
|
checkout: import("../slices").CheckoutState;
|
|
57
59
|
config: import("../slices").ConfigState;
|
|
60
|
+
customer: import("../slices").CustomerState;
|
|
58
61
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
59
62
|
discounts: import("../slices").DiscountsState;
|
|
60
63
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
@@ -80,6 +83,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
80
83
|
cartSummary: import("../slices").CartSummaryState;
|
|
81
84
|
checkout: import("../slices").CheckoutState;
|
|
82
85
|
config: import("../slices").ConfigState;
|
|
86
|
+
customer: import("../slices").CustomerState;
|
|
83
87
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
84
88
|
discounts: import("../slices").DiscountsState;
|
|
85
89
|
errorAlerts: import("../slices").ErrorAlertsState;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { alertsReducer, arrivalsReducer, cartSummaryReducer, checkoutReducer, configReducer,
|
|
2
|
+
import { alertsReducer, arrivalsReducer, cartSummaryReducer, checkoutReducer, configReducer, customerReducer, customerIdentifyReducer, discountsReducer, errorAlertsReducer, kdsReducer, kioskReducer, menuReducer, menuPagesReducer, modalReducer, notificationsReducer, offlineAuthsReducer, orderReducer, posReducer, punchesReducer, refundReducer, settingsReducer, sidebarReducer, surchargesReducer, taxesReducer } from '../slices';
|
|
3
3
|
export var appReducer = combineReducers({
|
|
4
4
|
alerts: alertsReducer,
|
|
5
5
|
arrivals: arrivalsReducer,
|
|
6
6
|
cartSummary: cartSummaryReducer,
|
|
7
7
|
checkout: checkoutReducer,
|
|
8
8
|
config: configReducer,
|
|
9
|
-
|
|
9
|
+
customer: customerReducer,
|
|
10
|
+
customerIdentify: customerIdentifyReducer,
|
|
10
11
|
discounts: discountsReducer,
|
|
11
12
|
errorAlerts: errorAlertsReducer,
|
|
12
13
|
kds: kdsReducer,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrivals, CustomerIdentifier, CustomerIdentify, Menu, Order, Orders, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender, OrderCreatePos } from '@open-tender/types';
|
|
1
|
+
import { Arrivals, CustomerIdentifier, CustomerIdentify, Menu, Order, Orders, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender, OrderCreatePos, CustomerEndpoints } from '@open-tender/types';
|
|
2
2
|
import { CashEvent, CashSummary, DeviceRead, Discount, Discounts, Employee, Employees, PosSettingType, ErrorAlert, ErrorAlerts, GiftCardBalance, GiftCardCredit, InternalSettings, KioskConfig, LevelUp, MenuColors, MenuPages, OfflineAuths, OfflineAuthsResult, Punch, Refund, Settings, Store, Surcharges, Taxes, Tender } from '../types';
|
|
3
3
|
import { OrdersParams } from '../slices';
|
|
4
4
|
export interface InitAPI {
|
|
@@ -61,6 +61,7 @@ declare class PosAPI {
|
|
|
61
61
|
postChipDNACancel(): Promise<null>;
|
|
62
62
|
postChipDNATmsUpdate(): Promise<null>;
|
|
63
63
|
postIdentifyCustomer(data: CustomerIdentifier): Promise<CustomerIdentify>;
|
|
64
|
+
getCustomer(customerId: number, endpoints: CustomerEndpoints): Promise<any>;
|
|
64
65
|
postOrderValidate(order: OrderCreatePos): Promise<Order>;
|
|
65
66
|
postOrder(order: OrderCreatePos): Promise<Order>;
|
|
66
67
|
deleteOrder(order: OrderCreatePos): Promise<Order>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -286,6 +286,10 @@ var PosAPI = /** @class */ (function () {
|
|
|
286
286
|
PosAPI.prototype.postIdentifyCustomer = function (data) {
|
|
287
287
|
return this.request("/identify-customer", 'POST', data);
|
|
288
288
|
};
|
|
289
|
+
PosAPI.prototype.getCustomer = function (customerId, endpoints) {
|
|
290
|
+
var query = "endpoints=".concat(endpoints.join(','));
|
|
291
|
+
return this.request("/customer/".concat(customerId, "?").concat(query));
|
|
292
|
+
};
|
|
289
293
|
PosAPI.prototype.postOrderValidate = function (order) {
|
|
290
294
|
return this.request("/orders/validate", 'POST', order);
|
|
291
295
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerState {
|
|
4
|
+
account: Customer | null;
|
|
5
|
+
giftCards: GiftCards;
|
|
6
|
+
favorites: Favorites;
|
|
7
|
+
loyalty: LoyaltyPrograms;
|
|
8
|
+
rewards: Discounts;
|
|
9
|
+
orders: Orders;
|
|
10
|
+
loading: RequestStatus;
|
|
11
|
+
error: RequestError;
|
|
12
|
+
}
|
|
13
|
+
export declare enum CustomerActionType {
|
|
14
|
+
FetchCustomer = "Customer/fetchCustomer"
|
|
15
|
+
}
|
|
16
|
+
export declare const fetchCustomer: import("@reduxjs/toolkit").AsyncThunk<CustomerEntities, {
|
|
17
|
+
customerId: number;
|
|
18
|
+
endpoints: CustomerEndpoints;
|
|
19
|
+
}, {
|
|
20
|
+
state: AppState;
|
|
21
|
+
rejectValue: RequestError;
|
|
22
|
+
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
|
|
23
|
+
extra?: unknown;
|
|
24
|
+
serializedErrorType?: unknown;
|
|
25
|
+
pendingMeta?: unknown;
|
|
26
|
+
fulfilledMeta?: unknown;
|
|
27
|
+
rejectedMeta?: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const resetCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customer/resetCustomer">;
|
|
30
|
+
export declare const selectCustomer: (state: AppState) => CustomerState;
|
|
31
|
+
export declare const selectCustomerAccount: (state: AppState) => Customer | null;
|
|
32
|
+
export declare const selectCustomerGiftCards: (state: AppState) => GiftCards;
|
|
33
|
+
export declare const selectCustomerFavorites: (state: AppState) => Favorites;
|
|
34
|
+
export declare const selectCustomerLoyalty: (state: AppState) => LoyaltyPrograms;
|
|
35
|
+
export declare const selectCustomerRewards: (state: AppState) => Discounts;
|
|
36
|
+
export declare const selectCustomerOrders: (state: AppState) => Orders;
|
|
37
|
+
export declare const customerReducer: import("redux").Reducer<CustomerState>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { ReducerType } from './types';
|
|
4
|
+
var initialState = {
|
|
5
|
+
account: null,
|
|
6
|
+
giftCards: [],
|
|
7
|
+
favorites: [],
|
|
8
|
+
loyalty: [],
|
|
9
|
+
rewards: [],
|
|
10
|
+
orders: [],
|
|
11
|
+
loading: 'idle',
|
|
12
|
+
error: null
|
|
13
|
+
};
|
|
14
|
+
export var CustomerActionType;
|
|
15
|
+
(function (CustomerActionType) {
|
|
16
|
+
CustomerActionType["FetchCustomer"] = "Customer/fetchCustomer";
|
|
17
|
+
})(CustomerActionType || (CustomerActionType = {}));
|
|
18
|
+
export var fetchCustomer = createAsyncThunk(CustomerActionType.FetchCustomer, function (_a, _b) {
|
|
19
|
+
var customerId = _a.customerId, endpoints = _a.endpoints;
|
|
20
|
+
var getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
21
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
22
|
+
var api, err_1;
|
|
23
|
+
return __generator(this, function (_c) {
|
|
24
|
+
switch (_c.label) {
|
|
25
|
+
case 0:
|
|
26
|
+
_c.trys.push([0, 2, , 3]);
|
|
27
|
+
api = getState().config.api;
|
|
28
|
+
return [4 /*yield*/, api.getCustomer(customerId, endpoints)];
|
|
29
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
30
|
+
case 2:
|
|
31
|
+
err_1 = _c.sent();
|
|
32
|
+
return [2 /*return*/, rejectWithValue(err_1)];
|
|
33
|
+
case 3: return [2 /*return*/];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
var CustomerSlice = createSlice({
|
|
39
|
+
name: ReducerType.Customer,
|
|
40
|
+
initialState: initialState,
|
|
41
|
+
reducers: {
|
|
42
|
+
resetCustomer: function () { return initialState; }
|
|
43
|
+
},
|
|
44
|
+
extraReducers: function (builder) {
|
|
45
|
+
builder
|
|
46
|
+
.addCase(fetchCustomer.fulfilled, function (state, action) {
|
|
47
|
+
var _a = action.payload, _b = _a.ACCOUNT, ACCOUNT = _b === void 0 ? null : _b, _c = _a.GIFT_CARDS, GIFT_CARDS = _c === void 0 ? [] : _c, _d = _a.FAVORITES, FAVORITES = _d === void 0 ? [] : _d, _e = _a.LOYALTY, LOYALTY = _e === void 0 ? [] : _e, _f = _a.REWARDS, REWARDS = _f === void 0 ? [] : _f, _g = _a.ORDERS, ORDERS = _g === void 0 ? [] : _g;
|
|
48
|
+
state.account = ACCOUNT;
|
|
49
|
+
state.giftCards = GIFT_CARDS;
|
|
50
|
+
state.favorites = FAVORITES;
|
|
51
|
+
state.loyalty = LOYALTY;
|
|
52
|
+
state.rewards = REWARDS;
|
|
53
|
+
state.orders = ORDERS;
|
|
54
|
+
state.loading = 'idle';
|
|
55
|
+
state.error = null;
|
|
56
|
+
})
|
|
57
|
+
.addCase(fetchCustomer.pending, function (state) {
|
|
58
|
+
state.loading = 'pending';
|
|
59
|
+
})
|
|
60
|
+
.addCase(fetchCustomer.rejected, function (state, action) {
|
|
61
|
+
state.error = action.payload;
|
|
62
|
+
state.loading = 'idle';
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export var resetCustomer = CustomerSlice.actions.resetCustomer;
|
|
67
|
+
export var selectCustomer = function (state) { return state.customer; };
|
|
68
|
+
export var selectCustomerAccount = function (state) { return state.customer.account; };
|
|
69
|
+
export var selectCustomerGiftCards = function (state) {
|
|
70
|
+
return state.customer.giftCards;
|
|
71
|
+
};
|
|
72
|
+
export var selectCustomerFavorites = function (state) {
|
|
73
|
+
return state.customer.favorites;
|
|
74
|
+
};
|
|
75
|
+
export var selectCustomerLoyalty = function (state) { return state.customer.loyalty; };
|
|
76
|
+
export var selectCustomerRewards = function (state) { return state.customer.rewards; };
|
|
77
|
+
export var selectCustomerOrders = function (state) { return state.customer.orders; };
|
|
78
|
+
export var customerReducer = CustomerSlice.reducer;
|
|
@@ -21,4 +21,4 @@ export declare const fetchCustomerIdentify: import("@reduxjs/toolkit").AsyncThun
|
|
|
21
21
|
export declare const resetCustomerIdentify: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customerIdentify/resetCustomerIdentify">;
|
|
22
22
|
export declare const selectCustomerIdentify: (state: AppState) => CustomerIdentifyState;
|
|
23
23
|
export declare const selectCustomerIdentified: (state: AppState) => CustomerIdentify | null;
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const customerIdentifyReducer: import("redux").Reducer<CustomerIdentifyState>;
|
|
@@ -58,4 +58,4 @@ export var selectCustomerIdentify = function (state) {
|
|
|
58
58
|
export var selectCustomerIdentified = function (state) {
|
|
59
59
|
return state.customerIdentify.data;
|
|
60
60
|
};
|
|
61
|
-
export var
|
|
61
|
+
export var customerIdentifyReducer = customerIdentifySlice.reducer;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -47,6 +47,7 @@ export declare const selectKioskConfig: ((state: {
|
|
|
47
47
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
48
48
|
checkout: import("./checkout").CheckoutState;
|
|
49
49
|
config: import("./config").ConfigState;
|
|
50
|
+
customer: import("./customer").CustomerState;
|
|
50
51
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
51
52
|
discounts: import("./discounts").DiscountsState;
|
|
52
53
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -92,6 +93,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
|
92
93
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
93
94
|
checkout: import("./checkout").CheckoutState;
|
|
94
95
|
config: import("./config").ConfigState;
|
|
96
|
+
customer: import("./customer").CustomerState;
|
|
95
97
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
96
98
|
discounts: import("./discounts").DiscountsState;
|
|
97
99
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -26,6 +26,7 @@ export declare const selectMenuPagesFiltered: ((state: {
|
|
|
26
26
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
27
27
|
checkout: import("./checkout").CheckoutState;
|
|
28
28
|
config: import("./config").ConfigState;
|
|
29
|
+
customer: import("./customer").CustomerState;
|
|
29
30
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
30
31
|
discounts: import("./discounts").DiscountsState;
|
|
31
32
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -47,6 +47,7 @@ export declare const selectCartIds: ((state: {
|
|
|
47
47
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
48
48
|
checkout: import("./checkout").CheckoutState;
|
|
49
49
|
config: import("./config").ConfigState;
|
|
50
|
+
customer: import("./customer").CustomerState;
|
|
50
51
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
51
52
|
discounts: import("./discounts").DiscountsState;
|
|
52
53
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -92,6 +93,7 @@ export declare const selectCartQuantity: ((state: {
|
|
|
92
93
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
93
94
|
checkout: import("./checkout").CheckoutState;
|
|
94
95
|
config: import("./config").ConfigState;
|
|
96
|
+
customer: import("./customer").CustomerState;
|
|
95
97
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
96
98
|
discounts: import("./discounts").DiscountsState;
|
|
97
99
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -137,6 +139,7 @@ export declare const selectCartTotal: ((state: {
|
|
|
137
139
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
138
140
|
checkout: import("./checkout").CheckoutState;
|
|
139
141
|
config: import("./config").ConfigState;
|
|
142
|
+
customer: import("./customer").CustomerState;
|
|
140
143
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
141
144
|
discounts: import("./discounts").DiscountsState;
|
|
142
145
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
@@ -182,6 +185,7 @@ export declare const selectCartTotals: ((state: {
|
|
|
182
185
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
183
186
|
checkout: import("./checkout").CheckoutState;
|
|
184
187
|
config: import("./config").ConfigState;
|
|
188
|
+
customer: import("./customer").CustomerState;
|
|
185
189
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
186
190
|
discounts: import("./discounts").DiscountsState;
|
|
187
191
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -6,6 +6,7 @@ export var ReducerType;
|
|
|
6
6
|
ReducerType["Checkout"] = "checkout";
|
|
7
7
|
ReducerType["CompletedOrders"] = "completedOrders";
|
|
8
8
|
ReducerType["Config"] = "config";
|
|
9
|
+
ReducerType["Customer"] = "customer";
|
|
9
10
|
ReducerType["CustomerIdentify"] = "customerIdentify";
|
|
10
11
|
ReducerType["Discounts"] = "discounts";
|
|
11
12
|
ReducerType["ErrorAlerts"] = "errorAlerts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
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",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@emotion/react": "^11.11.1",
|
|
61
|
-
"@open-tender/types": "^0.4.
|
|
61
|
+
"@open-tender/types": "^0.4.32",
|
|
62
62
|
"@open-tender/ui": "^0.1.22",
|
|
63
|
-
"@open-tender/utils": "^0.4.
|
|
63
|
+
"@open-tender/utils": "^0.4.10",
|
|
64
64
|
"@reduxjs/toolkit": "^2.0.1",
|
|
65
65
|
"date-fns": "2.30.0",
|
|
66
66
|
"date-fns-tz": "^2.0.0",
|