@open-tender/store 1.1.223 → 1.1.225
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/components/CheckTotals.d.ts +2 -1
- package/dist/cjs/components/CheckTotals.js +2 -2
- package/dist/cjs/services/api.d.ts +2 -1
- package/dist/cjs/services/api.js +3 -0
- package/dist/cjs/slices/allergens.d.ts +88 -0
- package/dist/cjs/slices/allergens.js +83 -0
- package/dist/cjs/slices/customer.d.ts +3 -1
- package/dist/cjs/slices/customer.js +3 -1
- 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 -0
- package/dist/cjs/slices/menuPages.d.ts +1 -0
- package/dist/cjs/slices/order.d.ts +4 -0
- package/dist/cjs/slices/tags.d.ts +1 -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/components/CheckTotals.d.ts +2 -1
- package/dist/esm/components/CheckTotals.js +2 -2
- package/dist/esm/services/api.d.ts +2 -1
- package/dist/esm/services/api.js +3 -0
- package/dist/esm/slices/allergens.d.ts +88 -0
- package/dist/esm/slices/allergens.js +78 -0
- package/dist/esm/slices/customer.d.ts +3 -1
- package/dist/esm/slices/customer.js +3 -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 +7 -0
- package/dist/esm/slices/menuPages.d.ts +1 -0
- package/dist/esm/slices/order.d.ts +4 -0
- package/dist/esm/slices/tags.d.ts +1 -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
|
@@ -2,6 +2,7 @@ import { TypedUseSelectorHook } from 'react-redux';
|
|
|
2
2
|
import type { RootState } from './store';
|
|
3
3
|
export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
4
4
|
alerts: import("@open-tender/types").Alerts;
|
|
5
|
+
allergens: import("..").AllergensState;
|
|
5
6
|
arrivals: import("..").ArrivalsState;
|
|
6
7
|
cartSummary: import("..").CartSummaryState;
|
|
7
8
|
checkout: import("..").CheckoutState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Action, ThunkAction } from '@reduxjs/toolkit';
|
|
2
2
|
export declare const appReducer: import("redux").Reducer<{
|
|
3
3
|
alerts: import("@open-tender/types").Alerts;
|
|
4
|
+
allergens: import("../slices").AllergensState;
|
|
4
5
|
arrivals: import("../slices").ArrivalsState;
|
|
5
6
|
cartSummary: import("../slices").CartSummaryState;
|
|
6
7
|
checkout: import("../slices").CheckoutState;
|
|
@@ -30,6 +31,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
30
31
|
tags: import("../slices").TagsState;
|
|
31
32
|
}, import("redux").UnknownAction, Partial<{
|
|
32
33
|
alerts: import("@open-tender/types").Alerts | undefined;
|
|
34
|
+
allergens: import("../slices").AllergensState | undefined;
|
|
33
35
|
arrivals: import("../slices").ArrivalsState | undefined;
|
|
34
36
|
cartSummary: import("../slices").CartSummaryState | undefined;
|
|
35
37
|
checkout: import("../slices").CheckoutState | undefined;
|
|
@@ -61,6 +63,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
61
63
|
export type AppState = ReturnType<typeof appReducer>;
|
|
62
64
|
declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
63
65
|
alerts: import("@open-tender/types").Alerts;
|
|
66
|
+
allergens: import("../slices").AllergensState;
|
|
64
67
|
arrivals: import("../slices").ArrivalsState;
|
|
65
68
|
cartSummary: import("../slices").CartSummaryState;
|
|
66
69
|
checkout: import("../slices").CheckoutState;
|
|
@@ -91,6 +94,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
91
94
|
}, Action, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
92
95
|
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
93
96
|
alerts: import("@open-tender/types").Alerts;
|
|
97
|
+
allergens: import("../slices").AllergensState;
|
|
94
98
|
arrivals: import("../slices").ArrivalsState;
|
|
95
99
|
cartSummary: import("../slices").CartSummaryState;
|
|
96
100
|
checkout: import("../slices").CheckoutState;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -5,6 +5,7 @@ var toolkit_1 = require("@reduxjs/toolkit");
|
|
|
5
5
|
var slices_1 = require("../slices");
|
|
6
6
|
exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
7
7
|
alerts: slices_1.alertsReducer,
|
|
8
|
+
allergens: slices_1.allergensReducer,
|
|
8
9
|
arrivals: slices_1.arrivalsReducer,
|
|
9
10
|
cartSummary: slices_1.cartSummaryReducer,
|
|
10
11
|
checkout: slices_1.checkoutReducer,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Order } from '@open-tender/types';
|
|
2
2
|
import { CheckTotalsProps } from '@open-tender/ui';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
declare const CheckTotals: ({ check, children }: {
|
|
4
|
+
declare const CheckTotals: ({ check, isSummary, children }: {
|
|
5
5
|
check: Order;
|
|
6
|
+
isSummary?: boolean;
|
|
6
7
|
children: (props: CheckTotalsProps) => ReactNode;
|
|
7
8
|
}) => ReactNode;
|
|
8
9
|
export default CheckTotals;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var hooks_1 = require("../app/hooks");
|
|
4
4
|
var slices_1 = require("../slices");
|
|
5
5
|
var CheckTotals = function (_a) {
|
|
6
|
-
var check = _a.check, children = _a.children;
|
|
6
|
+
var check = _a.check, isSummary = _a.isSummary, children = _a.children;
|
|
7
7
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).checkTotals;
|
|
8
8
|
if (!config)
|
|
9
9
|
return null;
|
|
10
|
-
return children({ config: config, check: check });
|
|
10
|
+
return children({ config: config, check: check, isSummary: isSummary });
|
|
11
11
|
};
|
|
12
12
|
exports.default = CheckTotals;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrivals, CheckoutTender, CustomerEndpoints, CustomerIdentifier, CustomerIdentify, Discount, Discounts, ItemTypes, Menu, Order, Orders, OrderCreatePos, OrderTender, OrderUpdate, OrderType, RequestedAt, RevenueCenter, SelectOptions, ServiceType, TicketUpdate, TicketsUpdate, TicketStatusUpdate, EntityType, KioskConfig, Store, Settings, InternalSettings, GiftCardCredit, GiftCardBalance, Employee, Punch, Employees, CashEvent, CashSummary, ErrorAlerts, ErrorAlert, OfflineAuths, OfflineAuthsResult, MenuColors, MenuPages, Surcharges, Taxes, CheckoutTenderPos, Refund, DeviceRead, OrderCreateSendReceipt, Tags } from '@open-tender/types';
|
|
1
|
+
import { Arrivals, CheckoutTender, CustomerEndpoints, CustomerIdentifier, CustomerIdentify, Discount, Discounts, ItemTypes, Menu, Order, Orders, OrderCreatePos, OrderTender, OrderUpdate, OrderType, RequestedAt, RevenueCenter, SelectOptions, ServiceType, TicketUpdate, TicketsUpdate, TicketStatusUpdate, EntityType, KioskConfig, Store, Settings, InternalSettings, GiftCardCredit, GiftCardBalance, Employee, Punch, Employees, CashEvent, CashSummary, ErrorAlerts, ErrorAlert, OfflineAuths, OfflineAuthsResult, MenuColors, MenuPages, Surcharges, Taxes, CheckoutTenderPos, Refund, DeviceRead, OrderCreateSendReceipt, Tags, Allergens } from '@open-tender/types';
|
|
2
2
|
import { OrdersParams } from '../slices';
|
|
3
3
|
export interface InitAPI {
|
|
4
4
|
apiUrl: string;
|
|
@@ -80,5 +80,6 @@ declare class PosAPI {
|
|
|
80
80
|
postRefundValidate(orderId: string, refund: Refund): Promise<Order>;
|
|
81
81
|
postRefund(orderId: string, refund: Refund): Promise<Order>;
|
|
82
82
|
getTags(): Promise<Tags>;
|
|
83
|
+
getAllergens(): Promise<Allergens>;
|
|
83
84
|
}
|
|
84
85
|
export default PosAPI;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -375,6 +375,9 @@ var PosAPI = /** @class */ (function () {
|
|
|
375
375
|
PosAPI.prototype.getTags = function () {
|
|
376
376
|
return this.request("/tags");
|
|
377
377
|
};
|
|
378
|
+
PosAPI.prototype.getAllergens = function () {
|
|
379
|
+
return this.request("/allergens");
|
|
380
|
+
};
|
|
378
381
|
return PosAPI;
|
|
379
382
|
}());
|
|
380
383
|
exports.default = PosAPI;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Allergens, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface AllergensState {
|
|
4
|
+
entities: Allergens;
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
selectedAllergens: Allergens | null;
|
|
8
|
+
}
|
|
9
|
+
export declare enum AllergensActionType {
|
|
10
|
+
FetchAllergens = "allergens/fetchAllergens"
|
|
11
|
+
}
|
|
12
|
+
export interface AllergensPayload {
|
|
13
|
+
data: Allergens;
|
|
14
|
+
}
|
|
15
|
+
export declare const fetchAllergens: import("@reduxjs/toolkit").AsyncThunk<AllergensPayload, void, {
|
|
16
|
+
state: AppState;
|
|
17
|
+
rejectValue: RequestError;
|
|
18
|
+
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
|
|
19
|
+
extra?: unknown;
|
|
20
|
+
serializedErrorType?: unknown;
|
|
21
|
+
pendingMeta?: unknown;
|
|
22
|
+
fulfilledMeta?: unknown;
|
|
23
|
+
rejectedMeta?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const resetAllergens: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"allergens/resetAllergens">, setSelectedAllergens: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "allergens/setSelectedAllergens">;
|
|
26
|
+
export declare const selectAllergens: (state: AppState) => AllergensState;
|
|
27
|
+
export declare const selectSelectedAllergens: (state: AppState) => Allergens | null;
|
|
28
|
+
export declare const selectSelectedAllergenNames: ((state: {
|
|
29
|
+
alerts: import("@open-tender/types").Alerts;
|
|
30
|
+
allergens: AllergensState;
|
|
31
|
+
arrivals: import("./arrivals").ArrivalsState;
|
|
32
|
+
cartSummary: import("./cartSummary").CartSummaryState;
|
|
33
|
+
checkout: import("./checkout").CheckoutState;
|
|
34
|
+
config: import("./config").ConfigState;
|
|
35
|
+
customer: import("./customer").CustomerState;
|
|
36
|
+
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
37
|
+
deals: import("./deals").DealsState;
|
|
38
|
+
discounts: import("./discounts").DiscountsState;
|
|
39
|
+
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
40
|
+
kds: import("./kds").KdsState;
|
|
41
|
+
kiosk: import("./kiosk").KioskState;
|
|
42
|
+
menu: import("./menu").MenuState;
|
|
43
|
+
menuPages: import("./menuPages").MenuPagesState;
|
|
44
|
+
modal: import("./modal").ModalState;
|
|
45
|
+
notifications: import("@open-tender/types").Notifications;
|
|
46
|
+
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
47
|
+
order: import("./order").OrderState;
|
|
48
|
+
pos: import("./pos").PosState;
|
|
49
|
+
punches: import("./punches").PunchesState;
|
|
50
|
+
refund: import("./refund").RefundState;
|
|
51
|
+
sendReceipt: import("./sendReceipt").SendReceiptState;
|
|
52
|
+
settings: import("./settings").SettingsState;
|
|
53
|
+
sidebar: import("./sidebar").SidebarState;
|
|
54
|
+
surcharges: import("./surcharges").SurchargesState;
|
|
55
|
+
taxes: import("./taxes").TaxesState;
|
|
56
|
+
idle: import("./idle").IdleState;
|
|
57
|
+
tags: import("./tags").TagsState;
|
|
58
|
+
}) => string[]) & {
|
|
59
|
+
clearCache: () => void;
|
|
60
|
+
resultsCount: () => number;
|
|
61
|
+
resetResultsCount: () => void;
|
|
62
|
+
} & {
|
|
63
|
+
resultFunc: (resultFuncArgs_0: {
|
|
64
|
+
allergens: Allergens;
|
|
65
|
+
selectedAllergens: Allergens | null;
|
|
66
|
+
}) => string[];
|
|
67
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
68
|
+
allergens: Allergens;
|
|
69
|
+
selectedAllergens: Allergens | null;
|
|
70
|
+
}) => string[]) & {
|
|
71
|
+
clearCache: () => void;
|
|
72
|
+
resultsCount: () => number;
|
|
73
|
+
resetResultsCount: () => void;
|
|
74
|
+
};
|
|
75
|
+
lastResult: () => string[];
|
|
76
|
+
dependencies: [(state: AppState) => {
|
|
77
|
+
allergens: Allergens;
|
|
78
|
+
selectedAllergens: Allergens | null;
|
|
79
|
+
}];
|
|
80
|
+
recomputations: () => number;
|
|
81
|
+
resetRecomputations: () => void;
|
|
82
|
+
dependencyRecomputations: () => number;
|
|
83
|
+
resetDependencyRecomputations: () => void;
|
|
84
|
+
} & {
|
|
85
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
86
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
87
|
+
};
|
|
88
|
+
export declare const allergensReducer: import("redux").Reducer<AllergensState>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.allergensReducer = exports.selectSelectedAllergenNames = exports.selectSelectedAllergens = exports.selectAllergens = exports.setSelectedAllergens = exports.resetAllergens = exports.fetchAllergens = exports.AllergensActionType = void 0;
|
|
5
|
+
var tslib_1 = require("tslib");
|
|
6
|
+
var toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
var types_1 = require("./types");
|
|
8
|
+
var initialState = {
|
|
9
|
+
entities: [],
|
|
10
|
+
error: null,
|
|
11
|
+
loading: 'idle',
|
|
12
|
+
selectedAllergens: null
|
|
13
|
+
};
|
|
14
|
+
var AllergensActionType;
|
|
15
|
+
(function (AllergensActionType) {
|
|
16
|
+
AllergensActionType["FetchAllergens"] = "allergens/fetchAllergens";
|
|
17
|
+
})(AllergensActionType || (exports.AllergensActionType = AllergensActionType = {}));
|
|
18
|
+
exports.fetchAllergens = (0, toolkit_1.createAsyncThunk)(AllergensActionType.FetchAllergens, function (_1, _a) { return tslib_1.__awaiter(void 0, [_1, _a], void 0, function (_, _b) {
|
|
19
|
+
var api, data, err_1;
|
|
20
|
+
var getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
21
|
+
return tslib_1.__generator(this, function (_c) {
|
|
22
|
+
switch (_c.label) {
|
|
23
|
+
case 0:
|
|
24
|
+
_c.trys.push([0, 2, , 3]);
|
|
25
|
+
api = getState().config.api;
|
|
26
|
+
return [4 /*yield*/, api.getAllergens()];
|
|
27
|
+
case 1:
|
|
28
|
+
data = _c.sent();
|
|
29
|
+
return [2 /*return*/, { data: data }];
|
|
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
|
+
var allergensSlice = (0, toolkit_1.createSlice)({
|
|
38
|
+
name: types_1.ReducerType.Allergens,
|
|
39
|
+
initialState: initialState,
|
|
40
|
+
reducers: {
|
|
41
|
+
resetAllergens: function () { return initialState; },
|
|
42
|
+
setSelectedAllergens: function (state, action) {
|
|
43
|
+
state.selectedAllergens = action.payload;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
extraReducers: function (builder) {
|
|
47
|
+
builder
|
|
48
|
+
.addCase(exports.fetchAllergens.fulfilled, function (state, action) {
|
|
49
|
+
state.entities = action.payload.data;
|
|
50
|
+
state.loading = 'idle';
|
|
51
|
+
state.error = null;
|
|
52
|
+
})
|
|
53
|
+
.addCase(exports.fetchAllergens.pending, function (state) {
|
|
54
|
+
state.loading = 'pending';
|
|
55
|
+
})
|
|
56
|
+
.addCase(exports.fetchAllergens.rejected, function (state, action) {
|
|
57
|
+
state.error = action.payload;
|
|
58
|
+
state.loading = 'idle';
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
exports.resetAllergens = (_a = allergensSlice.actions, _a.resetAllergens), exports.setSelectedAllergens = _a.setSelectedAllergens;
|
|
63
|
+
var selectAllergens = function (state) { return state.allergens; };
|
|
64
|
+
exports.selectAllergens = selectAllergens;
|
|
65
|
+
var selectSelectedAllergens = function (state) {
|
|
66
|
+
return state.allergens.selectedAllergens;
|
|
67
|
+
};
|
|
68
|
+
exports.selectSelectedAllergens = selectSelectedAllergens;
|
|
69
|
+
exports.selectSelectedAllergenNames = (0, toolkit_1.createSelector)(function (state) {
|
|
70
|
+
var _a = state.allergens, allergens = _a.entities, selectedAllergens = _a.selectedAllergens;
|
|
71
|
+
return { allergens: allergens, selectedAllergens: selectedAllergens };
|
|
72
|
+
}, function (_a) {
|
|
73
|
+
var allergens = _a.allergens, selectedAllergens = _a.selectedAllergens;
|
|
74
|
+
if (!selectedAllergens)
|
|
75
|
+
return [];
|
|
76
|
+
var selected = selectedAllergens.map(function (i) {
|
|
77
|
+
var _a;
|
|
78
|
+
var allergen = allergens.find(function (a) { return a.allergen_id === i.allergen_id; });
|
|
79
|
+
return allergen ? (_a = allergen.name) !== null && _a !== void 0 ? _a : '' : '';
|
|
80
|
+
});
|
|
81
|
+
return selected;
|
|
82
|
+
});
|
|
83
|
+
exports.allergensReducer = allergensSlice.reducer;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Allergens, Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
5
5
|
deals: Discounts;
|
|
6
|
+
allergens: Allergens;
|
|
6
7
|
favorites: Favorites;
|
|
7
8
|
giftCards: GiftCards;
|
|
8
9
|
loyalty: LoyaltyPrograms;
|
|
@@ -37,6 +38,7 @@ export declare const selectCustomerOrders: (state: AppState) => Orders;
|
|
|
37
38
|
export declare const selectCustomerRewards: (state: AppState) => Discounts;
|
|
38
39
|
export declare const selectCustomerLoyalty: ((state: {
|
|
39
40
|
alerts: import("@open-tender/types").Alerts;
|
|
41
|
+
allergens: import("./allergens").AllergensState;
|
|
40
42
|
arrivals: import("./arrivals").ArrivalsState;
|
|
41
43
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
42
44
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -7,6 +7,7 @@ var types_1 = require("./types");
|
|
|
7
7
|
var initialState = {
|
|
8
8
|
account: null,
|
|
9
9
|
deals: [],
|
|
10
|
+
allergens: [],
|
|
10
11
|
favorites: [],
|
|
11
12
|
giftCards: [],
|
|
12
13
|
loyalty: [],
|
|
@@ -46,7 +47,7 @@ var CustomerSlice = (0, toolkit_1.createSlice)({
|
|
|
46
47
|
extraReducers: function (builder) {
|
|
47
48
|
builder
|
|
48
49
|
.addCase(exports.fetchCustomer.fulfilled, function (state, action) {
|
|
49
|
-
var _a = action.payload, _b = _a.ACCOUNT, ACCOUNT = _b === void 0 ? null : _b, _c = _a.DEALS, DEALS = _c === void 0 ? [] : _c, _d = _a.FAVORITES, FAVORITES = _d === void 0 ? [] : _d, _e = _a.GIFT_CARDS, GIFT_CARDS = _e === void 0 ? [] : _e, _f = _a.LOYALTY, LOYALTY = _f === void 0 ? [] : _f, _g = _a.ORDERS, ORDERS = _g === void 0 ? [] : _g, _h = _a.REWARDS, REWARDS = _h === void 0 ? [] : _h;
|
|
50
|
+
var _a = action.payload, _b = _a.ACCOUNT, ACCOUNT = _b === void 0 ? null : _b, _c = _a.DEALS, DEALS = _c === void 0 ? [] : _c, _d = _a.FAVORITES, FAVORITES = _d === void 0 ? [] : _d, _e = _a.GIFT_CARDS, GIFT_CARDS = _e === void 0 ? [] : _e, _f = _a.LOYALTY, LOYALTY = _f === void 0 ? [] : _f, _g = _a.ORDERS, ORDERS = _g === void 0 ? [] : _g, _h = _a.REWARDS, REWARDS = _h === void 0 ? [] : _h, _j = _a.ALLERGENS, ALLERGENS = _j === void 0 ? [] : _j;
|
|
50
51
|
state.account = ACCOUNT;
|
|
51
52
|
state.deals = DEALS;
|
|
52
53
|
state.favorites = FAVORITES;
|
|
@@ -54,6 +55,7 @@ var CustomerSlice = (0, toolkit_1.createSlice)({
|
|
|
54
55
|
state.loyalty = LOYALTY;
|
|
55
56
|
state.orders = ORDERS;
|
|
56
57
|
state.rewards = REWARDS;
|
|
58
|
+
state.allergens = ALLERGENS;
|
|
57
59
|
state.loading = 'idle';
|
|
58
60
|
state.error = null;
|
|
59
61
|
})
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./alerts"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./allergens"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./arrivals"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./cartSummary"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./checkout"), exports);
|
|
@@ -44,6 +44,7 @@ export declare const selectKioskDevices: (state: AppState) => Devices | null;
|
|
|
44
44
|
export declare const selectTerminalId: (state: AppState) => number | null;
|
|
45
45
|
export declare const selectStoreSettings: ((state: {
|
|
46
46
|
alerts: import("@open-tender/types").Alerts;
|
|
47
|
+
allergens: import("./allergens").AllergensState;
|
|
47
48
|
arrivals: import("./arrivals").ArrivalsState;
|
|
48
49
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
49
50
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -94,6 +95,7 @@ export declare const selectStoreSettings: ((state: {
|
|
|
94
95
|
};
|
|
95
96
|
export declare const selectKioskTerminal: ((state: {
|
|
96
97
|
alerts: import("@open-tender/types").Alerts;
|
|
98
|
+
allergens: import("./allergens").AllergensState;
|
|
97
99
|
arrivals: import("./arrivals").ArrivalsState;
|
|
98
100
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
99
101
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -144,6 +146,7 @@ export declare const selectKioskTerminal: ((state: {
|
|
|
144
146
|
};
|
|
145
147
|
export declare const selectKioskHasPrinter: ((state: {
|
|
146
148
|
alerts: import("@open-tender/types").Alerts;
|
|
149
|
+
allergens: import("./allergens").AllergensState;
|
|
147
150
|
arrivals: import("./arrivals").ArrivalsState;
|
|
148
151
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
149
152
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -194,6 +197,7 @@ export declare const selectKioskHasPrinter: ((state: {
|
|
|
194
197
|
};
|
|
195
198
|
export declare const selectKioskHasScanner: ((state: {
|
|
196
199
|
alerts: import("@open-tender/types").Alerts;
|
|
200
|
+
allergens: import("./allergens").AllergensState;
|
|
197
201
|
arrivals: import("./arrivals").ArrivalsState;
|
|
198
202
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
199
203
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -244,6 +248,7 @@ export declare const selectKioskHasScanner: ((state: {
|
|
|
244
248
|
};
|
|
245
249
|
export declare const selectKioskApi: ((state: {
|
|
246
250
|
alerts: import("@open-tender/types").Alerts;
|
|
251
|
+
allergens: import("./allergens").AllergensState;
|
|
247
252
|
arrivals: import("./arrivals").ArrivalsState;
|
|
248
253
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
249
254
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -294,6 +299,7 @@ export declare const selectKioskApi: ((state: {
|
|
|
294
299
|
};
|
|
295
300
|
export declare const selectKioskConfig: ((state: {
|
|
296
301
|
alerts: import("@open-tender/types").Alerts;
|
|
302
|
+
allergens: import("./allergens").AllergensState;
|
|
297
303
|
arrivals: import("./arrivals").ArrivalsState;
|
|
298
304
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
299
305
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -344,6 +350,7 @@ export declare const selectKioskConfig: ((state: {
|
|
|
344
350
|
};
|
|
345
351
|
export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
346
352
|
alerts: import("@open-tender/types").Alerts;
|
|
353
|
+
allergens: import("./allergens").AllergensState;
|
|
347
354
|
arrivals: import("./arrivals").ArrivalsState;
|
|
348
355
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
349
356
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -22,6 +22,7 @@ export declare const resetMenuPages: import("@reduxjs/toolkit").ActionCreatorWit
|
|
|
22
22
|
export declare const selectMenuPages: (state: AppState) => MenuPagesState;
|
|
23
23
|
export declare const selectMenuPagesFiltered: ((state: {
|
|
24
24
|
alerts: import("@open-tender/types").Alerts;
|
|
25
|
+
allergens: import("./allergens").AllergensState;
|
|
25
26
|
arrivals: import("./arrivals").ArrivalsState;
|
|
26
27
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
27
28
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -65,6 +65,7 @@ export declare const selectCurrentSection: (state: AppState) => string | null;
|
|
|
65
65
|
export declare const selectCart: (state: AppState) => Cart;
|
|
66
66
|
export declare const selectCartIds: ((state: {
|
|
67
67
|
alerts: import("@open-tender/types").Alerts;
|
|
68
|
+
allergens: import("./allergens").AllergensState;
|
|
68
69
|
arrivals: import("./arrivals").ArrivalsState;
|
|
69
70
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
70
71
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -115,6 +116,7 @@ export declare const selectCartIds: ((state: {
|
|
|
115
116
|
};
|
|
116
117
|
export declare const selectCartQuantity: ((state: {
|
|
117
118
|
alerts: import("@open-tender/types").Alerts;
|
|
119
|
+
allergens: import("./allergens").AllergensState;
|
|
118
120
|
arrivals: import("./arrivals").ArrivalsState;
|
|
119
121
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
120
122
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -165,6 +167,7 @@ export declare const selectCartQuantity: ((state: {
|
|
|
165
167
|
};
|
|
166
168
|
export declare const selectCartTotal: ((state: {
|
|
167
169
|
alerts: import("@open-tender/types").Alerts;
|
|
170
|
+
allergens: import("./allergens").AllergensState;
|
|
168
171
|
arrivals: import("./arrivals").ArrivalsState;
|
|
169
172
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
170
173
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -215,6 +218,7 @@ export declare const selectCartTotal: ((state: {
|
|
|
215
218
|
};
|
|
216
219
|
export declare const selectCartTotals: ((state: {
|
|
217
220
|
alerts: import("@open-tender/types").Alerts;
|
|
221
|
+
allergens: import("./allergens").AllergensState;
|
|
218
222
|
arrivals: import("./arrivals").ArrivalsState;
|
|
219
223
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
220
224
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -26,6 +26,7 @@ export declare const selectSelectedTags: (state: AppState) => Tags;
|
|
|
26
26
|
export declare const selectShowTagsModal: (state: AppState) => boolean;
|
|
27
27
|
export declare const selectSelectedTagNames: ((state: {
|
|
28
28
|
alerts: import("@open-tender/types").Alerts;
|
|
29
|
+
allergens: import("./allergens").AllergensState;
|
|
29
30
|
arrivals: import("./arrivals").ArrivalsState;
|
|
30
31
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
31
32
|
checkout: import("./checkout").CheckoutState;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.ReducerType = void 0;
|
|
|
4
4
|
var ReducerType;
|
|
5
5
|
(function (ReducerType) {
|
|
6
6
|
ReducerType["Alerts"] = "alerts";
|
|
7
|
+
ReducerType["Allergens"] = "allergens";
|
|
7
8
|
ReducerType["Arrivals"] = "arrivals";
|
|
8
9
|
ReducerType["CartSummary"] = "cartSummary";
|
|
9
10
|
ReducerType["Checkout"] = "checkout";
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { TypedUseSelectorHook } from 'react-redux';
|
|
|
2
2
|
import type { RootState } from './store';
|
|
3
3
|
export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
4
4
|
alerts: import("@open-tender/types").Alerts;
|
|
5
|
+
allergens: import("..").AllergensState;
|
|
5
6
|
arrivals: import("..").ArrivalsState;
|
|
6
7
|
cartSummary: import("..").CartSummaryState;
|
|
7
8
|
checkout: import("..").CheckoutState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Action, ThunkAction } from '@reduxjs/toolkit';
|
|
2
2
|
export declare const appReducer: import("redux").Reducer<{
|
|
3
3
|
alerts: import("@open-tender/types").Alerts;
|
|
4
|
+
allergens: import("../slices").AllergensState;
|
|
4
5
|
arrivals: import("../slices").ArrivalsState;
|
|
5
6
|
cartSummary: import("../slices").CartSummaryState;
|
|
6
7
|
checkout: import("../slices").CheckoutState;
|
|
@@ -30,6 +31,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
30
31
|
tags: import("../slices").TagsState;
|
|
31
32
|
}, import("redux").UnknownAction, Partial<{
|
|
32
33
|
alerts: import("@open-tender/types").Alerts | undefined;
|
|
34
|
+
allergens: import("../slices").AllergensState | undefined;
|
|
33
35
|
arrivals: import("../slices").ArrivalsState | undefined;
|
|
34
36
|
cartSummary: import("../slices").CartSummaryState | undefined;
|
|
35
37
|
checkout: import("../slices").CheckoutState | undefined;
|
|
@@ -61,6 +63,7 @@ export declare const appReducer: import("redux").Reducer<{
|
|
|
61
63
|
export type AppState = ReturnType<typeof appReducer>;
|
|
62
64
|
declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
63
65
|
alerts: import("@open-tender/types").Alerts;
|
|
66
|
+
allergens: import("../slices").AllergensState;
|
|
64
67
|
arrivals: import("../slices").ArrivalsState;
|
|
65
68
|
cartSummary: import("../slices").CartSummaryState;
|
|
66
69
|
checkout: import("../slices").CheckoutState;
|
|
@@ -91,6 +94,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
91
94
|
}, Action, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
92
95
|
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
93
96
|
alerts: import("@open-tender/types").Alerts;
|
|
97
|
+
allergens: import("../slices").AllergensState;
|
|
94
98
|
arrivals: import("../slices").ArrivalsState;
|
|
95
99
|
cartSummary: import("../slices").CartSummaryState;
|
|
96
100
|
checkout: import("../slices").CheckoutState;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { alertsReducer, arrivalsReducer, cartSummaryReducer, checkoutReducer, configReducer, customerReducer, customerIdentifyReducer, dealsReducer, discountsReducer, errorAlertsReducer, kdsReducer, kioskReducer, menuReducer, menuPagesReducer, modalReducer, notificationsReducer, offlineAuthsReducer, orderReducer, posReducer, punchesReducer, refundReducer, sendReceiptReducer, settingsReducer, sidebarReducer, surchargesReducer, taxesReducer, idleReducer, tagsReducer } 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, sendReceiptReducer, settingsReducer, sidebarReducer, surchargesReducer, taxesReducer, idleReducer, tagsReducer, allergensReducer } from '../slices';
|
|
3
3
|
export var appReducer = combineReducers({
|
|
4
4
|
alerts: alertsReducer,
|
|
5
|
+
allergens: allergensReducer,
|
|
5
6
|
arrivals: arrivalsReducer,
|
|
6
7
|
cartSummary: cartSummaryReducer,
|
|
7
8
|
checkout: checkoutReducer,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Order } from '@open-tender/types';
|
|
2
2
|
import { CheckTotalsProps } from '@open-tender/ui';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
declare const CheckTotals: ({ check, children }: {
|
|
4
|
+
declare const CheckTotals: ({ check, isSummary, children }: {
|
|
5
5
|
check: Order;
|
|
6
|
+
isSummary?: boolean;
|
|
6
7
|
children: (props: CheckTotalsProps) => ReactNode;
|
|
7
8
|
}) => ReactNode;
|
|
8
9
|
export default CheckTotals;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useAppSelector } from '../app/hooks';
|
|
2
2
|
import { selectKioskConfig } from '../slices';
|
|
3
3
|
var CheckTotals = function (_a) {
|
|
4
|
-
var check = _a.check, children = _a.children;
|
|
4
|
+
var check = _a.check, isSummary = _a.isSummary, children = _a.children;
|
|
5
5
|
var config = useAppSelector(selectKioskConfig).checkTotals;
|
|
6
6
|
if (!config)
|
|
7
7
|
return null;
|
|
8
|
-
return children({ config: config, check: check });
|
|
8
|
+
return children({ config: config, check: check, isSummary: isSummary });
|
|
9
9
|
};
|
|
10
10
|
export default CheckTotals;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arrivals, CheckoutTender, CustomerEndpoints, CustomerIdentifier, CustomerIdentify, Discount, Discounts, ItemTypes, Menu, Order, Orders, OrderCreatePos, OrderTender, OrderUpdate, OrderType, RequestedAt, RevenueCenter, SelectOptions, ServiceType, TicketUpdate, TicketsUpdate, TicketStatusUpdate, EntityType, KioskConfig, Store, Settings, InternalSettings, GiftCardCredit, GiftCardBalance, Employee, Punch, Employees, CashEvent, CashSummary, ErrorAlerts, ErrorAlert, OfflineAuths, OfflineAuthsResult, MenuColors, MenuPages, Surcharges, Taxes, CheckoutTenderPos, Refund, DeviceRead, OrderCreateSendReceipt, Tags } from '@open-tender/types';
|
|
1
|
+
import { Arrivals, CheckoutTender, CustomerEndpoints, CustomerIdentifier, CustomerIdentify, Discount, Discounts, ItemTypes, Menu, Order, Orders, OrderCreatePos, OrderTender, OrderUpdate, OrderType, RequestedAt, RevenueCenter, SelectOptions, ServiceType, TicketUpdate, TicketsUpdate, TicketStatusUpdate, EntityType, KioskConfig, Store, Settings, InternalSettings, GiftCardCredit, GiftCardBalance, Employee, Punch, Employees, CashEvent, CashSummary, ErrorAlerts, ErrorAlert, OfflineAuths, OfflineAuthsResult, MenuColors, MenuPages, Surcharges, Taxes, CheckoutTenderPos, Refund, DeviceRead, OrderCreateSendReceipt, Tags, Allergens } from '@open-tender/types';
|
|
2
2
|
import { OrdersParams } from '../slices';
|
|
3
3
|
export interface InitAPI {
|
|
4
4
|
apiUrl: string;
|
|
@@ -80,5 +80,6 @@ declare class PosAPI {
|
|
|
80
80
|
postRefundValidate(orderId: string, refund: Refund): Promise<Order>;
|
|
81
81
|
postRefund(orderId: string, refund: Refund): Promise<Order>;
|
|
82
82
|
getTags(): Promise<Tags>;
|
|
83
|
+
getAllergens(): Promise<Allergens>;
|
|
83
84
|
}
|
|
84
85
|
export default PosAPI;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -373,6 +373,9 @@ var PosAPI = /** @class */ (function () {
|
|
|
373
373
|
PosAPI.prototype.getTags = function () {
|
|
374
374
|
return this.request("/tags");
|
|
375
375
|
};
|
|
376
|
+
PosAPI.prototype.getAllergens = function () {
|
|
377
|
+
return this.request("/allergens");
|
|
378
|
+
};
|
|
376
379
|
return PosAPI;
|
|
377
380
|
}());
|
|
378
381
|
export default PosAPI;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Allergens, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface AllergensState {
|
|
4
|
+
entities: Allergens;
|
|
5
|
+
error: RequestError;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
selectedAllergens: Allergens | null;
|
|
8
|
+
}
|
|
9
|
+
export declare enum AllergensActionType {
|
|
10
|
+
FetchAllergens = "allergens/fetchAllergens"
|
|
11
|
+
}
|
|
12
|
+
export interface AllergensPayload {
|
|
13
|
+
data: Allergens;
|
|
14
|
+
}
|
|
15
|
+
export declare const fetchAllergens: import("@reduxjs/toolkit").AsyncThunk<AllergensPayload, void, {
|
|
16
|
+
state: AppState;
|
|
17
|
+
rejectValue: RequestError;
|
|
18
|
+
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
|
|
19
|
+
extra?: unknown;
|
|
20
|
+
serializedErrorType?: unknown;
|
|
21
|
+
pendingMeta?: unknown;
|
|
22
|
+
fulfilledMeta?: unknown;
|
|
23
|
+
rejectedMeta?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const resetAllergens: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"allergens/resetAllergens">, setSelectedAllergens: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "allergens/setSelectedAllergens">;
|
|
26
|
+
export declare const selectAllergens: (state: AppState) => AllergensState;
|
|
27
|
+
export declare const selectSelectedAllergens: (state: AppState) => Allergens | null;
|
|
28
|
+
export declare const selectSelectedAllergenNames: ((state: {
|
|
29
|
+
alerts: import("@open-tender/types").Alerts;
|
|
30
|
+
allergens: AllergensState;
|
|
31
|
+
arrivals: import("./arrivals").ArrivalsState;
|
|
32
|
+
cartSummary: import("./cartSummary").CartSummaryState;
|
|
33
|
+
checkout: import("./checkout").CheckoutState;
|
|
34
|
+
config: import("./config").ConfigState;
|
|
35
|
+
customer: import("./customer").CustomerState;
|
|
36
|
+
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
|
|
37
|
+
deals: import("./deals").DealsState;
|
|
38
|
+
discounts: import("./discounts").DiscountsState;
|
|
39
|
+
errorAlerts: import("./errorAlerts").ErrorAlertsState;
|
|
40
|
+
kds: import("./kds").KdsState;
|
|
41
|
+
kiosk: import("./kiosk").KioskState;
|
|
42
|
+
menu: import("./menu").MenuState;
|
|
43
|
+
menuPages: import("./menuPages").MenuPagesState;
|
|
44
|
+
modal: import("./modal").ModalState;
|
|
45
|
+
notifications: import("@open-tender/types").Notifications;
|
|
46
|
+
offlineAuths: import("./offlineAuths").OfflineAuthsState;
|
|
47
|
+
order: import("./order").OrderState;
|
|
48
|
+
pos: import("./pos").PosState;
|
|
49
|
+
punches: import("./punches").PunchesState;
|
|
50
|
+
refund: import("./refund").RefundState;
|
|
51
|
+
sendReceipt: import("./sendReceipt").SendReceiptState;
|
|
52
|
+
settings: import("./settings").SettingsState;
|
|
53
|
+
sidebar: import("./sidebar").SidebarState;
|
|
54
|
+
surcharges: import("./surcharges").SurchargesState;
|
|
55
|
+
taxes: import("./taxes").TaxesState;
|
|
56
|
+
idle: import("./idle").IdleState;
|
|
57
|
+
tags: import("./tags").TagsState;
|
|
58
|
+
}) => string[]) & {
|
|
59
|
+
clearCache: () => void;
|
|
60
|
+
resultsCount: () => number;
|
|
61
|
+
resetResultsCount: () => void;
|
|
62
|
+
} & {
|
|
63
|
+
resultFunc: (resultFuncArgs_0: {
|
|
64
|
+
allergens: Allergens;
|
|
65
|
+
selectedAllergens: Allergens | null;
|
|
66
|
+
}) => string[];
|
|
67
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
68
|
+
allergens: Allergens;
|
|
69
|
+
selectedAllergens: Allergens | null;
|
|
70
|
+
}) => string[]) & {
|
|
71
|
+
clearCache: () => void;
|
|
72
|
+
resultsCount: () => number;
|
|
73
|
+
resetResultsCount: () => void;
|
|
74
|
+
};
|
|
75
|
+
lastResult: () => string[];
|
|
76
|
+
dependencies: [(state: AppState) => {
|
|
77
|
+
allergens: Allergens;
|
|
78
|
+
selectedAllergens: Allergens | null;
|
|
79
|
+
}];
|
|
80
|
+
recomputations: () => number;
|
|
81
|
+
resetRecomputations: () => void;
|
|
82
|
+
dependencyRecomputations: () => number;
|
|
83
|
+
resetDependencyRecomputations: () => void;
|
|
84
|
+
} & {
|
|
85
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
86
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
87
|
+
};
|
|
88
|
+
export declare const allergensReducer: import("redux").Reducer<AllergensState>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { __awaiter, __generator } from "tslib";
|
|
3
|
+
import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
import { ReducerType } from './types';
|
|
5
|
+
var initialState = {
|
|
6
|
+
entities: [],
|
|
7
|
+
error: null,
|
|
8
|
+
loading: 'idle',
|
|
9
|
+
selectedAllergens: null
|
|
10
|
+
};
|
|
11
|
+
export var AllergensActionType;
|
|
12
|
+
(function (AllergensActionType) {
|
|
13
|
+
AllergensActionType["FetchAllergens"] = "allergens/fetchAllergens";
|
|
14
|
+
})(AllergensActionType || (AllergensActionType = {}));
|
|
15
|
+
export var fetchAllergens = createAsyncThunk(AllergensActionType.FetchAllergens, function (_1, _a) { return __awaiter(void 0, [_1, _a], void 0, function (_, _b) {
|
|
16
|
+
var api, data, err_1;
|
|
17
|
+
var getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
18
|
+
return __generator(this, function (_c) {
|
|
19
|
+
switch (_c.label) {
|
|
20
|
+
case 0:
|
|
21
|
+
_c.trys.push([0, 2, , 3]);
|
|
22
|
+
api = getState().config.api;
|
|
23
|
+
return [4 /*yield*/, api.getAllergens()];
|
|
24
|
+
case 1:
|
|
25
|
+
data = _c.sent();
|
|
26
|
+
return [2 /*return*/, { data: data }];
|
|
27
|
+
case 2:
|
|
28
|
+
err_1 = _c.sent();
|
|
29
|
+
return [2 /*return*/, rejectWithValue(err_1)];
|
|
30
|
+
case 3: return [2 /*return*/];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}); });
|
|
34
|
+
var allergensSlice = createSlice({
|
|
35
|
+
name: ReducerType.Allergens,
|
|
36
|
+
initialState: initialState,
|
|
37
|
+
reducers: {
|
|
38
|
+
resetAllergens: function () { return initialState; },
|
|
39
|
+
setSelectedAllergens: function (state, action) {
|
|
40
|
+
state.selectedAllergens = action.payload;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
extraReducers: function (builder) {
|
|
44
|
+
builder
|
|
45
|
+
.addCase(fetchAllergens.fulfilled, function (state, action) {
|
|
46
|
+
state.entities = action.payload.data;
|
|
47
|
+
state.loading = 'idle';
|
|
48
|
+
state.error = null;
|
|
49
|
+
})
|
|
50
|
+
.addCase(fetchAllergens.pending, function (state) {
|
|
51
|
+
state.loading = 'pending';
|
|
52
|
+
})
|
|
53
|
+
.addCase(fetchAllergens.rejected, function (state, action) {
|
|
54
|
+
state.error = action.payload;
|
|
55
|
+
state.loading = 'idle';
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export var resetAllergens = (_a = allergensSlice.actions, _a.resetAllergens), setSelectedAllergens = _a.setSelectedAllergens;
|
|
60
|
+
export var selectAllergens = function (state) { return state.allergens; };
|
|
61
|
+
export var selectSelectedAllergens = function (state) {
|
|
62
|
+
return state.allergens.selectedAllergens;
|
|
63
|
+
};
|
|
64
|
+
export var selectSelectedAllergenNames = createSelector(function (state) {
|
|
65
|
+
var _a = state.allergens, allergens = _a.entities, selectedAllergens = _a.selectedAllergens;
|
|
66
|
+
return { allergens: allergens, selectedAllergens: selectedAllergens };
|
|
67
|
+
}, function (_a) {
|
|
68
|
+
var allergens = _a.allergens, selectedAllergens = _a.selectedAllergens;
|
|
69
|
+
if (!selectedAllergens)
|
|
70
|
+
return [];
|
|
71
|
+
var selected = selectedAllergens.map(function (i) {
|
|
72
|
+
var _a;
|
|
73
|
+
var allergen = allergens.find(function (a) { return a.allergen_id === i.allergen_id; });
|
|
74
|
+
return allergen ? (_a = allergen.name) !== null && _a !== void 0 ? _a : '' : '';
|
|
75
|
+
});
|
|
76
|
+
return selected;
|
|
77
|
+
});
|
|
78
|
+
export var allergensReducer = allergensSlice.reducer;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
1
|
+
import { Allergens, Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyProgramSummary, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
export interface CustomerState {
|
|
4
4
|
account: Customer | null;
|
|
5
5
|
deals: Discounts;
|
|
6
|
+
allergens: Allergens;
|
|
6
7
|
favorites: Favorites;
|
|
7
8
|
giftCards: GiftCards;
|
|
8
9
|
loyalty: LoyaltyPrograms;
|
|
@@ -37,6 +38,7 @@ export declare const selectCustomerOrders: (state: AppState) => Orders;
|
|
|
37
38
|
export declare const selectCustomerRewards: (state: AppState) => Discounts;
|
|
38
39
|
export declare const selectCustomerLoyalty: ((state: {
|
|
39
40
|
alerts: import("@open-tender/types").Alerts;
|
|
41
|
+
allergens: import("./allergens").AllergensState;
|
|
40
42
|
arrivals: import("./arrivals").ArrivalsState;
|
|
41
43
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
42
44
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -4,6 +4,7 @@ import { ReducerType } from './types';
|
|
|
4
4
|
var initialState = {
|
|
5
5
|
account: null,
|
|
6
6
|
deals: [],
|
|
7
|
+
allergens: [],
|
|
7
8
|
favorites: [],
|
|
8
9
|
giftCards: [],
|
|
9
10
|
loyalty: [],
|
|
@@ -43,7 +44,7 @@ var CustomerSlice = createSlice({
|
|
|
43
44
|
extraReducers: function (builder) {
|
|
44
45
|
builder
|
|
45
46
|
.addCase(fetchCustomer.fulfilled, function (state, action) {
|
|
46
|
-
var _a = action.payload, _b = _a.ACCOUNT, ACCOUNT = _b === void 0 ? null : _b, _c = _a.DEALS, DEALS = _c === void 0 ? [] : _c, _d = _a.FAVORITES, FAVORITES = _d === void 0 ? [] : _d, _e = _a.GIFT_CARDS, GIFT_CARDS = _e === void 0 ? [] : _e, _f = _a.LOYALTY, LOYALTY = _f === void 0 ? [] : _f, _g = _a.ORDERS, ORDERS = _g === void 0 ? [] : _g, _h = _a.REWARDS, REWARDS = _h === void 0 ? [] : _h;
|
|
47
|
+
var _a = action.payload, _b = _a.ACCOUNT, ACCOUNT = _b === void 0 ? null : _b, _c = _a.DEALS, DEALS = _c === void 0 ? [] : _c, _d = _a.FAVORITES, FAVORITES = _d === void 0 ? [] : _d, _e = _a.GIFT_CARDS, GIFT_CARDS = _e === void 0 ? [] : _e, _f = _a.LOYALTY, LOYALTY = _f === void 0 ? [] : _f, _g = _a.ORDERS, ORDERS = _g === void 0 ? [] : _g, _h = _a.REWARDS, REWARDS = _h === void 0 ? [] : _h, _j = _a.ALLERGENS, ALLERGENS = _j === void 0 ? [] : _j;
|
|
47
48
|
state.account = ACCOUNT;
|
|
48
49
|
state.deals = DEALS;
|
|
49
50
|
state.favorites = FAVORITES;
|
|
@@ -51,6 +52,7 @@ var CustomerSlice = createSlice({
|
|
|
51
52
|
state.loyalty = LOYALTY;
|
|
52
53
|
state.orders = ORDERS;
|
|
53
54
|
state.rewards = REWARDS;
|
|
55
|
+
state.allergens = ALLERGENS;
|
|
54
56
|
state.loading = 'idle';
|
|
55
57
|
state.error = null;
|
|
56
58
|
})
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export declare const selectKioskDevices: (state: AppState) => Devices | null;
|
|
|
44
44
|
export declare const selectTerminalId: (state: AppState) => number | null;
|
|
45
45
|
export declare const selectStoreSettings: ((state: {
|
|
46
46
|
alerts: import("@open-tender/types").Alerts;
|
|
47
|
+
allergens: import("./allergens").AllergensState;
|
|
47
48
|
arrivals: import("./arrivals").ArrivalsState;
|
|
48
49
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
49
50
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -94,6 +95,7 @@ export declare const selectStoreSettings: ((state: {
|
|
|
94
95
|
};
|
|
95
96
|
export declare const selectKioskTerminal: ((state: {
|
|
96
97
|
alerts: import("@open-tender/types").Alerts;
|
|
98
|
+
allergens: import("./allergens").AllergensState;
|
|
97
99
|
arrivals: import("./arrivals").ArrivalsState;
|
|
98
100
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
99
101
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -144,6 +146,7 @@ export declare const selectKioskTerminal: ((state: {
|
|
|
144
146
|
};
|
|
145
147
|
export declare const selectKioskHasPrinter: ((state: {
|
|
146
148
|
alerts: import("@open-tender/types").Alerts;
|
|
149
|
+
allergens: import("./allergens").AllergensState;
|
|
147
150
|
arrivals: import("./arrivals").ArrivalsState;
|
|
148
151
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
149
152
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -194,6 +197,7 @@ export declare const selectKioskHasPrinter: ((state: {
|
|
|
194
197
|
};
|
|
195
198
|
export declare const selectKioskHasScanner: ((state: {
|
|
196
199
|
alerts: import("@open-tender/types").Alerts;
|
|
200
|
+
allergens: import("./allergens").AllergensState;
|
|
197
201
|
arrivals: import("./arrivals").ArrivalsState;
|
|
198
202
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
199
203
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -244,6 +248,7 @@ export declare const selectKioskHasScanner: ((state: {
|
|
|
244
248
|
};
|
|
245
249
|
export declare const selectKioskApi: ((state: {
|
|
246
250
|
alerts: import("@open-tender/types").Alerts;
|
|
251
|
+
allergens: import("./allergens").AllergensState;
|
|
247
252
|
arrivals: import("./arrivals").ArrivalsState;
|
|
248
253
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
249
254
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -294,6 +299,7 @@ export declare const selectKioskApi: ((state: {
|
|
|
294
299
|
};
|
|
295
300
|
export declare const selectKioskConfig: ((state: {
|
|
296
301
|
alerts: import("@open-tender/types").Alerts;
|
|
302
|
+
allergens: import("./allergens").AllergensState;
|
|
297
303
|
arrivals: import("./arrivals").ArrivalsState;
|
|
298
304
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
299
305
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -344,6 +350,7 @@ export declare const selectKioskConfig: ((state: {
|
|
|
344
350
|
};
|
|
345
351
|
export declare const selectKioskConfigScreen: (screen: string) => ((state: {
|
|
346
352
|
alerts: import("@open-tender/types").Alerts;
|
|
353
|
+
allergens: import("./allergens").AllergensState;
|
|
347
354
|
arrivals: import("./arrivals").ArrivalsState;
|
|
348
355
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
349
356
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -22,6 +22,7 @@ export declare const resetMenuPages: import("@reduxjs/toolkit").ActionCreatorWit
|
|
|
22
22
|
export declare const selectMenuPages: (state: AppState) => MenuPagesState;
|
|
23
23
|
export declare const selectMenuPagesFiltered: ((state: {
|
|
24
24
|
alerts: import("@open-tender/types").Alerts;
|
|
25
|
+
allergens: import("./allergens").AllergensState;
|
|
25
26
|
arrivals: import("./arrivals").ArrivalsState;
|
|
26
27
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
27
28
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -65,6 +65,7 @@ export declare const selectCurrentSection: (state: AppState) => string | null;
|
|
|
65
65
|
export declare const selectCart: (state: AppState) => Cart;
|
|
66
66
|
export declare const selectCartIds: ((state: {
|
|
67
67
|
alerts: import("@open-tender/types").Alerts;
|
|
68
|
+
allergens: import("./allergens").AllergensState;
|
|
68
69
|
arrivals: import("./arrivals").ArrivalsState;
|
|
69
70
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
70
71
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -115,6 +116,7 @@ export declare const selectCartIds: ((state: {
|
|
|
115
116
|
};
|
|
116
117
|
export declare const selectCartQuantity: ((state: {
|
|
117
118
|
alerts: import("@open-tender/types").Alerts;
|
|
119
|
+
allergens: import("./allergens").AllergensState;
|
|
118
120
|
arrivals: import("./arrivals").ArrivalsState;
|
|
119
121
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
120
122
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -165,6 +167,7 @@ export declare const selectCartQuantity: ((state: {
|
|
|
165
167
|
};
|
|
166
168
|
export declare const selectCartTotal: ((state: {
|
|
167
169
|
alerts: import("@open-tender/types").Alerts;
|
|
170
|
+
allergens: import("./allergens").AllergensState;
|
|
168
171
|
arrivals: import("./arrivals").ArrivalsState;
|
|
169
172
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
170
173
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -215,6 +218,7 @@ export declare const selectCartTotal: ((state: {
|
|
|
215
218
|
};
|
|
216
219
|
export declare const selectCartTotals: ((state: {
|
|
217
220
|
alerts: import("@open-tender/types").Alerts;
|
|
221
|
+
allergens: import("./allergens").AllergensState;
|
|
218
222
|
arrivals: import("./arrivals").ArrivalsState;
|
|
219
223
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
220
224
|
checkout: import("./checkout").CheckoutState;
|
|
@@ -26,6 +26,7 @@ export declare const selectSelectedTags: (state: AppState) => Tags;
|
|
|
26
26
|
export declare const selectShowTagsModal: (state: AppState) => boolean;
|
|
27
27
|
export declare const selectSelectedTagNames: ((state: {
|
|
28
28
|
alerts: import("@open-tender/types").Alerts;
|
|
29
|
+
allergens: import("./allergens").AllergensState;
|
|
29
30
|
arrivals: import("./arrivals").ArrivalsState;
|
|
30
31
|
cartSummary: import("./cartSummary").CartSummaryState;
|
|
31
32
|
checkout: import("./checkout").CheckoutState;
|
package/dist/esm/slices/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.225",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
65
|
-
"@open-tender/ui": "^0.4.
|
|
64
|
+
"@open-tender/types": "^0.4.96",
|
|
65
|
+
"@open-tender/ui": "^0.4.28",
|
|
66
66
|
"@open-tender/utils": "^0.4.69",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|
|
68
68
|
"date-fns": "2.30.0",
|