@open-tender/store 1.0.34 → 1.0.36
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 +1 -0
- package/dist/cjs/services/api.d.ts +1 -0
- package/dist/cjs/services/api.js +3 -0
- package/dist/cjs/slices/deals.d.ts +23 -0
- package/dist/cjs/slices/deals.js +60 -0
- package/dist/cjs/slices/index.d.ts +1 -0
- package/dist/cjs/slices/index.js +1 -0
- package/dist/cjs/slices/kiosk.d.ts +7 -6
- 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 +2 -1
- package/dist/esm/services/api.d.ts +1 -0
- package/dist/esm/services/api.js +3 -0
- package/dist/esm/slices/deals.d.ts +23 -0
- package/dist/esm/slices/deals.js +56 -0
- package/dist/esm/slices/index.d.ts +1 -0
- package/dist/esm/slices/index.js +1 -0
- package/dist/esm/slices/kiosk.d.ts +7 -6
- 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 +4 -4
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
|
8
8
|
config: import("..").ConfigState;
|
|
9
9
|
customer: import("..").CustomerState;
|
|
10
10
|
customerIdentify: import("..").CustomerIdentifyState;
|
|
11
|
+
deals: import("..").DealsState;
|
|
11
12
|
discounts: import("..").DiscountsState;
|
|
12
13
|
errorAlerts: import("..").ErrorAlertsState;
|
|
13
14
|
kds: import("..").KdsState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
7
7
|
config: import("../slices").ConfigState;
|
|
8
8
|
customer: import("../slices").CustomerState;
|
|
9
9
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
10
|
+
deals: import("../slices").DealsState;
|
|
10
11
|
discounts: import("../slices").DiscountsState;
|
|
11
12
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
12
13
|
kds: import("../slices").KdsState;
|
|
@@ -32,6 +33,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
32
33
|
config: import("../slices").ConfigState | undefined;
|
|
33
34
|
customer: import("../slices").CustomerState | undefined;
|
|
34
35
|
customerIdentify: import("../slices").CustomerIdentifyState | undefined;
|
|
36
|
+
deals: import("../slices").DealsState | undefined;
|
|
35
37
|
discounts: import("../slices").DiscountsState | undefined;
|
|
36
38
|
errorAlerts: import("../slices").ErrorAlertsState | undefined;
|
|
37
39
|
kds: import("../slices").KdsState | undefined;
|
|
@@ -59,6 +61,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
59
61
|
config: import("../slices").ConfigState;
|
|
60
62
|
customer: import("../slices").CustomerState;
|
|
61
63
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
64
|
+
deals: import("../slices").DealsState;
|
|
62
65
|
discounts: import("../slices").DiscountsState;
|
|
63
66
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
64
67
|
kds: import("../slices").KdsState;
|
|
@@ -85,6 +88,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
85
88
|
config: import("../slices").ConfigState;
|
|
86
89
|
customer: import("../slices").CustomerState;
|
|
87
90
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
91
|
+
deals: import("../slices").DealsState;
|
|
88
92
|
discounts: import("../slices").DiscountsState;
|
|
89
93
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
90
94
|
kds: import("../slices").KdsState;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
11
11
|
config: slices_1.configReducer,
|
|
12
12
|
customer: slices_1.customerReducer,
|
|
13
13
|
customerIdentify: slices_1.customerIdentifyReducer,
|
|
14
|
+
deals: slices_1.dealsReducer,
|
|
14
15
|
discounts: slices_1.discountsReducer,
|
|
15
16
|
errorAlerts: slices_1.errorAlertsReducer,
|
|
16
17
|
kds: slices_1.kdsReducer,
|
|
@@ -47,6 +47,7 @@ declare class PosAPI {
|
|
|
47
47
|
getMenu(revenueCenterId: number, serviceType: ServiceType, requestedAt: RequestedAt): Promise<Menu>;
|
|
48
48
|
getMenuColors(): Promise<MenuColors>;
|
|
49
49
|
getMenuPages(): Promise<MenuPages>;
|
|
50
|
+
getDeals(): Promise<Discounts>;
|
|
50
51
|
getSurcharges(serviceType: ServiceType): Promise<Surcharges>;
|
|
51
52
|
getDiscounts(serviceType: ServiceType, orderType: OrderType): Promise<Discounts>;
|
|
52
53
|
getDiscount(name: string): Promise<Discount>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -233,6 +233,9 @@ var PosAPI = /** @class */ (function () {
|
|
|
233
233
|
PosAPI.prototype.getMenuPages = function () {
|
|
234
234
|
return this.request("/menu-pages");
|
|
235
235
|
};
|
|
236
|
+
PosAPI.prototype.getDeals = function () {
|
|
237
|
+
return this.request("/deals");
|
|
238
|
+
};
|
|
236
239
|
PosAPI.prototype.getSurcharges = function (serviceType) {
|
|
237
240
|
var query = serviceType ? "?service_type=".concat(serviceType) : '';
|
|
238
241
|
return this.request("/surcharges".concat(query));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
import { Discounts, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface DealsState {
|
|
4
|
+
entities: Discounts;
|
|
5
|
+
loading: RequestStatus;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
}
|
|
8
|
+
export declare enum DealsActionType {
|
|
9
|
+
GetDeals = "deals/fetchDeals"
|
|
10
|
+
}
|
|
11
|
+
export declare const fetchDeals: import("@reduxjs/toolkit").AsyncThunk<Discounts, void, {
|
|
12
|
+
state: AppState;
|
|
13
|
+
rejectValue: RequestError;
|
|
14
|
+
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
|
|
15
|
+
extra?: unknown;
|
|
16
|
+
serializedErrorType?: unknown;
|
|
17
|
+
pendingMeta?: unknown;
|
|
18
|
+
fulfilledMeta?: unknown;
|
|
19
|
+
rejectedMeta?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const resetDeals: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"deals/resetDeals">;
|
|
22
|
+
export declare const selectDeals: (state: AppState) => DealsState;
|
|
23
|
+
export declare const dealsReducer: import("redux").Reducer<DealsState>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dealsReducer = exports.selectDeals = exports.resetDeals = exports.fetchDeals = exports.DealsActionType = 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
|
+
entities: [],
|
|
9
|
+
loading: 'idle',
|
|
10
|
+
error: null
|
|
11
|
+
};
|
|
12
|
+
var DealsActionType;
|
|
13
|
+
(function (DealsActionType) {
|
|
14
|
+
DealsActionType["GetDeals"] = "deals/fetchDeals";
|
|
15
|
+
})(DealsActionType || (exports.DealsActionType = DealsActionType = {}));
|
|
16
|
+
exports.fetchDeals = (0, toolkit_1.createAsyncThunk)(DealsActionType.GetDeals, function (_, _a) {
|
|
17
|
+
var getState = _a.getState, rejectWithValue = _a.rejectWithValue;
|
|
18
|
+
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
19
|
+
var api, err_1;
|
|
20
|
+
return tslib_1.__generator(this, function (_b) {
|
|
21
|
+
switch (_b.label) {
|
|
22
|
+
case 0:
|
|
23
|
+
_b.trys.push([0, 2, , 3]);
|
|
24
|
+
api = getState().config.api;
|
|
25
|
+
return [4 /*yield*/, api.getDeals()];
|
|
26
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
27
|
+
case 2:
|
|
28
|
+
err_1 = _b.sent();
|
|
29
|
+
return [2 /*return*/, rejectWithValue(err_1)];
|
|
30
|
+
case 3: return [2 /*return*/];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var dealsSlice = (0, toolkit_1.createSlice)({
|
|
36
|
+
name: types_1.ReducerType.Deals,
|
|
37
|
+
initialState: initialState,
|
|
38
|
+
reducers: {
|
|
39
|
+
resetDeals: function () { return initialState; }
|
|
40
|
+
},
|
|
41
|
+
extraReducers: function (builder) {
|
|
42
|
+
builder
|
|
43
|
+
.addCase(exports.fetchDeals.fulfilled, function (state, action) {
|
|
44
|
+
state.entities = action.payload;
|
|
45
|
+
state.loading = 'idle';
|
|
46
|
+
state.error = null;
|
|
47
|
+
})
|
|
48
|
+
.addCase(exports.fetchDeals.pending, function (state) {
|
|
49
|
+
state.loading = 'pending';
|
|
50
|
+
})
|
|
51
|
+
.addCase(exports.fetchDeals.rejected, function (state, action) {
|
|
52
|
+
state.error = action.payload;
|
|
53
|
+
state.loading = 'idle';
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
exports.resetDeals = dealsSlice.actions.resetDeals;
|
|
58
|
+
var selectDeals = function (state) { return state.deals; };
|
|
59
|
+
exports.selectDeals = selectDeals;
|
|
60
|
+
exports.dealsReducer = dealsSlice.reducer;
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -8,6 +8,7 @@ tslib_1.__exportStar(require("./checkout"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./config"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./customer"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./customerIdentify"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./deals"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./discounts"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./errorAlerts"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./kds"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AppConfig } from '@open-tender/ui';
|
|
2
|
-
import {
|
|
2
|
+
import { AppTheme, Devices, KioskBrand, KioskContent, KioskDisplaySettings, KioskStyles, RequestError, RequestStatus, Store } from '@open-tender/types';
|
|
3
3
|
import { AppState } from '../app';
|
|
4
|
-
import { AppTheme } from '@open-tender/types';
|
|
5
4
|
export interface KioskApp {
|
|
6
5
|
apiUrl: string;
|
|
7
6
|
}
|
|
@@ -42,13 +41,14 @@ export declare const selectKioskVersion: (state: AppState) => string | null | un
|
|
|
42
41
|
export declare const selectKioskStore: (state: AppState) => Store | null;
|
|
43
42
|
export declare const selectKioskBrand: (state: AppState) => KioskBrand | null;
|
|
44
43
|
export declare const selectKioskConfig: ((state: {
|
|
45
|
-
alerts: import("
|
|
44
|
+
alerts: import("..").Alerts;
|
|
46
45
|
arrivals: import("./arrivals").ArrivalsState;
|
|
47
46
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
48
47
|
checkout: import("./checkout").CheckoutState;
|
|
49
48
|
config: import("./config").ConfigState;
|
|
50
49
|
customer: import("./customer").CustomerState;
|
|
51
50
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
51
|
+
deals: import("./deals").DealsState;
|
|
52
52
|
discounts: import("./discounts").DiscountsState;
|
|
53
53
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
54
54
|
kds: import("./kds").KdsState;
|
|
@@ -56,7 +56,7 @@ export declare const selectKioskConfig: ((state: {
|
|
|
56
56
|
menu: import("./menu").MenuState;
|
|
57
57
|
menuPages: import("./menuPages").MenuPagesState;
|
|
58
58
|
modal: import("./modal").ModalState;
|
|
59
|
-
notifications: import("
|
|
59
|
+
notifications: import("..").Notifications;
|
|
60
60
|
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
61
61
|
order: import("./order").OrderState;
|
|
62
62
|
pos: import("./pos").PosState;
|
|
@@ -88,13 +88,14 @@ export declare const selectKioskConfig: ((state: {
|
|
|
88
88
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
89
89
|
};
|
|
90
90
|
export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
91
|
-
alerts: import("
|
|
91
|
+
alerts: import("..").Alerts;
|
|
92
92
|
arrivals: import("./arrivals").ArrivalsState;
|
|
93
93
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
94
94
|
checkout: import("./checkout").CheckoutState;
|
|
95
95
|
config: import("./config").ConfigState;
|
|
96
96
|
customer: import("./customer").CustomerState;
|
|
97
97
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
98
|
+
deals: import("./deals").DealsState;
|
|
98
99
|
discounts: import("./discounts").DiscountsState;
|
|
99
100
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
100
101
|
kds: import("./kds").KdsState;
|
|
@@ -102,7 +103,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
|
102
103
|
menu: import("./menu").MenuState;
|
|
103
104
|
menuPages: import("./menuPages").MenuPagesState;
|
|
104
105
|
modal: import("./modal").ModalState;
|
|
105
|
-
notifications: import("
|
|
106
|
+
notifications: import("..").Notifications;
|
|
106
107
|
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
107
108
|
order: import("./order").OrderState;
|
|
108
109
|
pos: import("./pos").PosState;
|
|
@@ -28,6 +28,7 @@ export declare const selectMenuPagesFiltered: ((state: {
|
|
|
28
28
|
config: import("./config").ConfigState;
|
|
29
29
|
customer: import("./customer").CustomerState;
|
|
30
30
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
31
|
+
deals: import("./deals").DealsState;
|
|
31
32
|
discounts: import("./discounts").DiscountsState;
|
|
32
33
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
33
34
|
kds: import("./kds").KdsState;
|
|
@@ -71,6 +71,7 @@ export declare const selectCartIds: ((state: {
|
|
|
71
71
|
config: import("./config").ConfigState;
|
|
72
72
|
customer: import("./customer").CustomerState;
|
|
73
73
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
74
|
+
deals: import("./deals").DealsState;
|
|
74
75
|
discounts: import("./discounts").DiscountsState;
|
|
75
76
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
76
77
|
kds: import("./kds").KdsState;
|
|
@@ -117,6 +118,7 @@ export declare const selectCartQuantity: ((state: {
|
|
|
117
118
|
config: import("./config").ConfigState;
|
|
118
119
|
customer: import("./customer").CustomerState;
|
|
119
120
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
121
|
+
deals: import("./deals").DealsState;
|
|
120
122
|
discounts: import("./discounts").DiscountsState;
|
|
121
123
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
122
124
|
kds: import("./kds").KdsState;
|
|
@@ -163,6 +165,7 @@ export declare const selectCartTotal: ((state: {
|
|
|
163
165
|
config: import("./config").ConfigState;
|
|
164
166
|
customer: import("./customer").CustomerState;
|
|
165
167
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
168
|
+
deals: import("./deals").DealsState;
|
|
166
169
|
discounts: import("./discounts").DiscountsState;
|
|
167
170
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
168
171
|
kds: import("./kds").KdsState;
|
|
@@ -209,6 +212,7 @@ export declare const selectCartTotals: ((state: {
|
|
|
209
212
|
config: import("./config").ConfigState;
|
|
210
213
|
customer: import("./customer").CustomerState;
|
|
211
214
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
215
|
+
deals: import("./deals").DealsState;
|
|
212
216
|
discounts: import("./discounts").DiscountsState;
|
|
213
217
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
214
218
|
kds: import("./kds").KdsState;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -11,6 +11,7 @@ var ReducerType;
|
|
|
11
11
|
ReducerType["Config"] = "config";
|
|
12
12
|
ReducerType["Customer"] = "customer";
|
|
13
13
|
ReducerType["CustomerIdentify"] = "customerIdentify";
|
|
14
|
+
ReducerType["Deals"] = "deals";
|
|
14
15
|
ReducerType["Discounts"] = "discounts";
|
|
15
16
|
ReducerType["ErrorAlerts"] = "errorAlerts";
|
|
16
17
|
ReducerType["Kds"] = "kds";
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
|
8
8
|
config: import("..").ConfigState;
|
|
9
9
|
customer: import("..").CustomerState;
|
|
10
10
|
customerIdentify: import("..").CustomerIdentifyState;
|
|
11
|
+
deals: import("..").DealsState;
|
|
11
12
|
discounts: import("..").DiscountsState;
|
|
12
13
|
errorAlerts: import("..").ErrorAlertsState;
|
|
13
14
|
kds: import("..").KdsState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
7
7
|
config: import("../slices").ConfigState;
|
|
8
8
|
customer: import("../slices").CustomerState;
|
|
9
9
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
10
|
+
deals: import("../slices").DealsState;
|
|
10
11
|
discounts: import("../slices").DiscountsState;
|
|
11
12
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
12
13
|
kds: import("../slices").KdsState;
|
|
@@ -32,6 +33,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
32
33
|
config: import("../slices").ConfigState | undefined;
|
|
33
34
|
customer: import("../slices").CustomerState | undefined;
|
|
34
35
|
customerIdentify: import("../slices").CustomerIdentifyState | undefined;
|
|
36
|
+
deals: import("../slices").DealsState | undefined;
|
|
35
37
|
discounts: import("../slices").DiscountsState | undefined;
|
|
36
38
|
errorAlerts: import("../slices").ErrorAlertsState | undefined;
|
|
37
39
|
kds: import("../slices").KdsState | undefined;
|
|
@@ -59,6 +61,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
59
61
|
config: import("../slices").ConfigState;
|
|
60
62
|
customer: import("../slices").CustomerState;
|
|
61
63
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
64
|
+
deals: import("../slices").DealsState;
|
|
62
65
|
discounts: import("../slices").DiscountsState;
|
|
63
66
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
64
67
|
kds: import("../slices").KdsState;
|
|
@@ -85,6 +88,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
85
88
|
config: import("../slices").ConfigState;
|
|
86
89
|
customer: import("../slices").CustomerState;
|
|
87
90
|
customerIdentify: import("../slices").CustomerIdentifyState;
|
|
91
|
+
deals: import("../slices").DealsState;
|
|
88
92
|
discounts: import("../slices").DiscountsState;
|
|
89
93
|
errorAlerts: import("../slices").ErrorAlertsState;
|
|
90
94
|
kds: import("../slices").KdsState;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
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';
|
|
2
|
+
import { alertsReducer, arrivalsReducer, cartSummaryReducer, checkoutReducer, configReducer, customerReducer, customerIdentifyReducer, dealsReducer, 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,
|
|
@@ -8,6 +8,7 @@ export var appReducer = combineReducers({
|
|
|
8
8
|
config: configReducer,
|
|
9
9
|
customer: customerReducer,
|
|
10
10
|
customerIdentify: customerIdentifyReducer,
|
|
11
|
+
deals: dealsReducer,
|
|
11
12
|
discounts: discountsReducer,
|
|
12
13
|
errorAlerts: errorAlertsReducer,
|
|
13
14
|
kds: kdsReducer,
|
|
@@ -47,6 +47,7 @@ declare class PosAPI {
|
|
|
47
47
|
getMenu(revenueCenterId: number, serviceType: ServiceType, requestedAt: RequestedAt): Promise<Menu>;
|
|
48
48
|
getMenuColors(): Promise<MenuColors>;
|
|
49
49
|
getMenuPages(): Promise<MenuPages>;
|
|
50
|
+
getDeals(): Promise<Discounts>;
|
|
50
51
|
getSurcharges(serviceType: ServiceType): Promise<Surcharges>;
|
|
51
52
|
getDiscounts(serviceType: ServiceType, orderType: OrderType): Promise<Discounts>;
|
|
52
53
|
getDiscount(name: string): Promise<Discount>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -231,6 +231,9 @@ var PosAPI = /** @class */ (function () {
|
|
|
231
231
|
PosAPI.prototype.getMenuPages = function () {
|
|
232
232
|
return this.request("/menu-pages");
|
|
233
233
|
};
|
|
234
|
+
PosAPI.prototype.getDeals = function () {
|
|
235
|
+
return this.request("/deals");
|
|
236
|
+
};
|
|
234
237
|
PosAPI.prototype.getSurcharges = function (serviceType) {
|
|
235
238
|
var query = serviceType ? "?service_type=".concat(serviceType) : '';
|
|
236
239
|
return this.request("/surcharges".concat(query));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
import { Discounts, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface DealsState {
|
|
4
|
+
entities: Discounts;
|
|
5
|
+
loading: RequestStatus;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
}
|
|
8
|
+
export declare enum DealsActionType {
|
|
9
|
+
GetDeals = "deals/fetchDeals"
|
|
10
|
+
}
|
|
11
|
+
export declare const fetchDeals: import("@reduxjs/toolkit").AsyncThunk<Discounts, void, {
|
|
12
|
+
state: AppState;
|
|
13
|
+
rejectValue: RequestError;
|
|
14
|
+
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
|
|
15
|
+
extra?: unknown;
|
|
16
|
+
serializedErrorType?: unknown;
|
|
17
|
+
pendingMeta?: unknown;
|
|
18
|
+
fulfilledMeta?: unknown;
|
|
19
|
+
rejectedMeta?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const resetDeals: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"deals/resetDeals">;
|
|
22
|
+
export declare const selectDeals: (state: AppState) => DealsState;
|
|
23
|
+
export declare const dealsReducer: import("redux").Reducer<DealsState>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { ReducerType } from './types';
|
|
4
|
+
var initialState = {
|
|
5
|
+
entities: [],
|
|
6
|
+
loading: 'idle',
|
|
7
|
+
error: null
|
|
8
|
+
};
|
|
9
|
+
export var DealsActionType;
|
|
10
|
+
(function (DealsActionType) {
|
|
11
|
+
DealsActionType["GetDeals"] = "deals/fetchDeals";
|
|
12
|
+
})(DealsActionType || (DealsActionType = {}));
|
|
13
|
+
export var fetchDeals = createAsyncThunk(DealsActionType.GetDeals, function (_, _a) {
|
|
14
|
+
var getState = _a.getState, rejectWithValue = _a.rejectWithValue;
|
|
15
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
16
|
+
var api, err_1;
|
|
17
|
+
return __generator(this, function (_b) {
|
|
18
|
+
switch (_b.label) {
|
|
19
|
+
case 0:
|
|
20
|
+
_b.trys.push([0, 2, , 3]);
|
|
21
|
+
api = getState().config.api;
|
|
22
|
+
return [4 /*yield*/, api.getDeals()];
|
|
23
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
24
|
+
case 2:
|
|
25
|
+
err_1 = _b.sent();
|
|
26
|
+
return [2 /*return*/, rejectWithValue(err_1)];
|
|
27
|
+
case 3: return [2 /*return*/];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
var dealsSlice = createSlice({
|
|
33
|
+
name: ReducerType.Deals,
|
|
34
|
+
initialState: initialState,
|
|
35
|
+
reducers: {
|
|
36
|
+
resetDeals: function () { return initialState; }
|
|
37
|
+
},
|
|
38
|
+
extraReducers: function (builder) {
|
|
39
|
+
builder
|
|
40
|
+
.addCase(fetchDeals.fulfilled, function (state, action) {
|
|
41
|
+
state.entities = action.payload;
|
|
42
|
+
state.loading = 'idle';
|
|
43
|
+
state.error = null;
|
|
44
|
+
})
|
|
45
|
+
.addCase(fetchDeals.pending, function (state) {
|
|
46
|
+
state.loading = 'pending';
|
|
47
|
+
})
|
|
48
|
+
.addCase(fetchDeals.rejected, function (state, action) {
|
|
49
|
+
state.error = action.payload;
|
|
50
|
+
state.loading = 'idle';
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export var resetDeals = dealsSlice.actions.resetDeals;
|
|
55
|
+
export var selectDeals = function (state) { return state.deals; };
|
|
56
|
+
export var dealsReducer = dealsSlice.reducer;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AppConfig } from '@open-tender/ui';
|
|
2
|
-
import {
|
|
2
|
+
import { AppTheme, Devices, KioskBrand, KioskContent, KioskDisplaySettings, KioskStyles, RequestError, RequestStatus, Store } from '@open-tender/types';
|
|
3
3
|
import { AppState } from '../app';
|
|
4
|
-
import { AppTheme } from '@open-tender/types';
|
|
5
4
|
export interface KioskApp {
|
|
6
5
|
apiUrl: string;
|
|
7
6
|
}
|
|
@@ -42,13 +41,14 @@ export declare const selectKioskVersion: (state: AppState) => string | null | un
|
|
|
42
41
|
export declare const selectKioskStore: (state: AppState) => Store | null;
|
|
43
42
|
export declare const selectKioskBrand: (state: AppState) => KioskBrand | null;
|
|
44
43
|
export declare const selectKioskConfig: ((state: {
|
|
45
|
-
alerts: import("
|
|
44
|
+
alerts: import("..").Alerts;
|
|
46
45
|
arrivals: import("./arrivals").ArrivalsState;
|
|
47
46
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
48
47
|
checkout: import("./checkout").CheckoutState;
|
|
49
48
|
config: import("./config").ConfigState;
|
|
50
49
|
customer: import("./customer").CustomerState;
|
|
51
50
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
51
|
+
deals: import("./deals").DealsState;
|
|
52
52
|
discounts: import("./discounts").DiscountsState;
|
|
53
53
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
54
54
|
kds: import("./kds").KdsState;
|
|
@@ -56,7 +56,7 @@ export declare const selectKioskConfig: ((state: {
|
|
|
56
56
|
menu: import("./menu").MenuState;
|
|
57
57
|
menuPages: import("./menuPages").MenuPagesState;
|
|
58
58
|
modal: import("./modal").ModalState;
|
|
59
|
-
notifications: import("
|
|
59
|
+
notifications: import("..").Notifications;
|
|
60
60
|
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
61
61
|
order: import("./order").OrderState;
|
|
62
62
|
pos: import("./pos").PosState;
|
|
@@ -88,13 +88,14 @@ export declare const selectKioskConfig: ((state: {
|
|
|
88
88
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
89
89
|
};
|
|
90
90
|
export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
91
|
-
alerts: import("
|
|
91
|
+
alerts: import("..").Alerts;
|
|
92
92
|
arrivals: import("./arrivals").ArrivalsState;
|
|
93
93
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
94
94
|
checkout: import("./checkout").CheckoutState;
|
|
95
95
|
config: import("./config").ConfigState;
|
|
96
96
|
customer: import("./customer").CustomerState;
|
|
97
97
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
98
|
+
deals: import("./deals").DealsState;
|
|
98
99
|
discounts: import("./discounts").DiscountsState;
|
|
99
100
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
100
101
|
kds: import("./kds").KdsState;
|
|
@@ -102,7 +103,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
|
102
103
|
menu: import("./menu").MenuState;
|
|
103
104
|
menuPages: import("./menuPages").MenuPagesState;
|
|
104
105
|
modal: import("./modal").ModalState;
|
|
105
|
-
notifications: import("
|
|
106
|
+
notifications: import("..").Notifications;
|
|
106
107
|
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
107
108
|
order: import("./order").OrderState;
|
|
108
109
|
pos: import("./pos").PosState;
|
|
@@ -28,6 +28,7 @@ export declare const selectMenuPagesFiltered: ((state: {
|
|
|
28
28
|
config: import("./config").ConfigState;
|
|
29
29
|
customer: import("./customer").CustomerState;
|
|
30
30
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
31
|
+
deals: import("./deals").DealsState;
|
|
31
32
|
discounts: import("./discounts").DiscountsState;
|
|
32
33
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
33
34
|
kds: import("./kds").KdsState;
|
|
@@ -71,6 +71,7 @@ export declare const selectCartIds: ((state: {
|
|
|
71
71
|
config: import("./config").ConfigState;
|
|
72
72
|
customer: import("./customer").CustomerState;
|
|
73
73
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
74
|
+
deals: import("./deals").DealsState;
|
|
74
75
|
discounts: import("./discounts").DiscountsState;
|
|
75
76
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
76
77
|
kds: import("./kds").KdsState;
|
|
@@ -117,6 +118,7 @@ export declare const selectCartQuantity: ((state: {
|
|
|
117
118
|
config: import("./config").ConfigState;
|
|
118
119
|
customer: import("./customer").CustomerState;
|
|
119
120
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
121
|
+
deals: import("./deals").DealsState;
|
|
120
122
|
discounts: import("./discounts").DiscountsState;
|
|
121
123
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
122
124
|
kds: import("./kds").KdsState;
|
|
@@ -163,6 +165,7 @@ export declare const selectCartTotal: ((state: {
|
|
|
163
165
|
config: import("./config").ConfigState;
|
|
164
166
|
customer: import("./customer").CustomerState;
|
|
165
167
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
168
|
+
deals: import("./deals").DealsState;
|
|
166
169
|
discounts: import("./discounts").DiscountsState;
|
|
167
170
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
168
171
|
kds: import("./kds").KdsState;
|
|
@@ -209,6 +212,7 @@ export declare const selectCartTotals: ((state: {
|
|
|
209
212
|
config: import("./config").ConfigState;
|
|
210
213
|
customer: import("./customer").CustomerState;
|
|
211
214
|
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
215
|
+
deals: import("./deals").DealsState;
|
|
212
216
|
discounts: import("./discounts").DiscountsState;
|
|
213
217
|
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
214
218
|
kds: import("./kds").KdsState;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -8,6 +8,7 @@ export var ReducerType;
|
|
|
8
8
|
ReducerType["Config"] = "config";
|
|
9
9
|
ReducerType["Customer"] = "customer";
|
|
10
10
|
ReducerType["CustomerIdentify"] = "customerIdentify";
|
|
11
|
+
ReducerType["Deals"] = "deals";
|
|
11
12
|
ReducerType["Discounts"] = "discounts";
|
|
12
13
|
ReducerType["ErrorAlerts"] = "errorAlerts";
|
|
13
14
|
ReducerType["Kds"] = "kds";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.36",
|
|
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.
|
|
62
|
-
"@open-tender/ui": "^0.1.
|
|
63
|
-
"@open-tender/utils": "^0.4.
|
|
61
|
+
"@open-tender/types": "^0.4.37",
|
|
62
|
+
"@open-tender/ui": "^0.1.23",
|
|
63
|
+
"@open-tender/utils": "^0.4.18",
|
|
64
64
|
"@reduxjs/toolkit": "^2.0.1",
|
|
65
65
|
"date-fns": "2.30.0",
|
|
66
66
|
"date-fns-tz": "^2.0.0",
|