@open-tender/store 1.0.33 → 1.0.35

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.
@@ -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;
@@ -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;
@@ -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>;
@@ -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));
@@ -2,11 +2,12 @@ import { AppState } from '../app';
2
2
  import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
3
3
  export interface CustomerState {
4
4
  account: Customer | null;
5
- giftCards: GiftCards;
5
+ deals: Discounts;
6
6
  favorites: Favorites;
7
+ giftCards: GiftCards;
7
8
  loyalty: LoyaltyPrograms;
8
- rewards: Discounts;
9
9
  orders: Orders;
10
+ rewards: Discounts;
10
11
  loading: RequestStatus;
11
12
  error: RequestError;
12
13
  }
@@ -29,9 +30,10 @@ export declare const fetchCustomer: import("@reduxjs/toolkit").AsyncThunk<Custom
29
30
  export declare const resetCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customer/resetCustomer">;
30
31
  export declare const selectCustomer: (state: AppState) => CustomerState;
31
32
  export declare const selectCustomerAccount: (state: AppState) => Customer | null;
32
- export declare const selectCustomerGiftCards: (state: AppState) => GiftCards;
33
+ export declare const selectCustomerDeals: (state: AppState) => Discounts;
33
34
  export declare const selectCustomerFavorites: (state: AppState) => Favorites;
35
+ export declare const selectCustomerGiftCards: (state: AppState) => GiftCards;
34
36
  export declare const selectCustomerLoyalty: (state: AppState) => LoyaltyPrograms;
35
- export declare const selectCustomerRewards: (state: AppState) => Discounts;
36
37
  export declare const selectCustomerOrders: (state: AppState) => Orders;
38
+ export declare const selectCustomerRewards: (state: AppState) => Discounts;
37
39
  export declare const customerReducer: import("redux").Reducer<CustomerState>;
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
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;
3
+ exports.customerReducer = exports.selectCustomerRewards = exports.selectCustomerOrders = exports.selectCustomerLoyalty = exports.selectCustomerGiftCards = exports.selectCustomerFavorites = exports.selectCustomerDeals = exports.selectCustomerAccount = exports.selectCustomer = exports.resetCustomer = exports.fetchCustomer = exports.CustomerActionType = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var toolkit_1 = require("@reduxjs/toolkit");
6
6
  var types_1 = require("./types");
7
7
  var initialState = {
8
8
  account: null,
9
- giftCards: [],
9
+ deals: [],
10
10
  favorites: [],
11
+ giftCards: [],
11
12
  loyalty: [],
12
- rewards: [],
13
13
  orders: [],
14
+ rewards: [],
14
15
  loading: 'idle',
15
16
  error: null
16
17
  };
@@ -47,13 +48,14 @@ var CustomerSlice = (0, toolkit_1.createSlice)({
47
48
  extraReducers: function (builder) {
48
49
  builder
49
50
  .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
+ 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;
51
52
  state.account = ACCOUNT;
52
- state.giftCards = GIFT_CARDS;
53
+ state.deals = DEALS;
53
54
  state.favorites = FAVORITES;
55
+ state.giftCards = GIFT_CARDS;
54
56
  state.loyalty = LOYALTY;
55
- state.rewards = REWARDS;
56
57
  state.orders = ORDERS;
58
+ state.rewards = REWARDS;
57
59
  state.loading = 'idle';
58
60
  state.error = null;
59
61
  })
@@ -71,18 +73,20 @@ var selectCustomer = function (state) { return state.customer; };
71
73
  exports.selectCustomer = selectCustomer;
72
74
  var selectCustomerAccount = function (state) { return state.customer.account; };
73
75
  exports.selectCustomerAccount = selectCustomerAccount;
74
- var selectCustomerGiftCards = function (state) {
75
- return state.customer.giftCards;
76
- };
77
- exports.selectCustomerGiftCards = selectCustomerGiftCards;
76
+ var selectCustomerDeals = function (state) { return state.customer.deals; };
77
+ exports.selectCustomerDeals = selectCustomerDeals;
78
78
  var selectCustomerFavorites = function (state) {
79
79
  return state.customer.favorites;
80
80
  };
81
81
  exports.selectCustomerFavorites = selectCustomerFavorites;
82
+ var selectCustomerGiftCards = function (state) {
83
+ return state.customer.giftCards;
84
+ };
85
+ exports.selectCustomerGiftCards = selectCustomerGiftCards;
82
86
  var selectCustomerLoyalty = function (state) { return state.customer.loyalty; };
83
87
  exports.selectCustomerLoyalty = selectCustomerLoyalty;
84
- var selectCustomerRewards = function (state) { return state.customer.rewards; };
85
- exports.selectCustomerRewards = selectCustomerRewards;
86
88
  var selectCustomerOrders = function (state) { return state.customer.orders; };
87
89
  exports.selectCustomerOrders = selectCustomerOrders;
90
+ var selectCustomerRewards = function (state) { return state.customer.rewards; };
91
+ exports.selectCustomerRewards = selectCustomerRewards;
88
92
  exports.customerReducer = CustomerSlice.reducer;
@@ -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;
@@ -5,6 +5,7 @@ export * from './checkout';
5
5
  export * from './config';
6
6
  export * from './customer';
7
7
  export * from './customerIdentify';
8
+ export * from './deals';
8
9
  export * from './discounts';
9
10
  export * from './errorAlerts';
10
11
  export * from './kds';
@@ -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);
@@ -49,6 +49,7 @@ export declare const selectKioskConfig: ((state: {
49
49
  config: import("./config").ConfigState;
50
50
  customer: import("./customer").CustomerState;
51
51
  customerIdentify: import("./customerIdentify").CustomerIdentifyState;
52
+ deals: import("./deals").DealsState;
52
53
  discounts: import("./discounts").DiscountsState;
53
54
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
54
55
  kds: import("./kds").KdsState;
@@ -95,6 +96,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
95
96
  config: import("./config").ConfigState;
96
97
  customer: import("./customer").CustomerState;
97
98
  customerIdentify: import("./customerIdentify").CustomerIdentifyState;
99
+ deals: import("./deals").DealsState;
98
100
  discounts: import("./discounts").DiscountsState;
99
101
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
100
102
  kds: import("./kds").KdsState;
@@ -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;
@@ -7,6 +7,7 @@ export declare enum ReducerType {
7
7
  Config = "config",
8
8
  Customer = "customer",
9
9
  CustomerIdentify = "customerIdentify",
10
+ Deals = "deals",
10
11
  Discounts = "discounts",
11
12
  ErrorAlerts = "errorAlerts",
12
13
  Kds = "kds",
@@ -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";
@@ -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;
@@ -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;
@@ -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>;
@@ -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));
@@ -2,11 +2,12 @@ import { AppState } from '../app';
2
2
  import { Customer, CustomerEndpoints, CustomerEntities, Discounts, Favorites, GiftCards, LoyaltyPrograms, Orders, RequestError, RequestStatus } from '@open-tender/types';
3
3
  export interface CustomerState {
4
4
  account: Customer | null;
5
- giftCards: GiftCards;
5
+ deals: Discounts;
6
6
  favorites: Favorites;
7
+ giftCards: GiftCards;
7
8
  loyalty: LoyaltyPrograms;
8
- rewards: Discounts;
9
9
  orders: Orders;
10
+ rewards: Discounts;
10
11
  loading: RequestStatus;
11
12
  error: RequestError;
12
13
  }
@@ -29,9 +30,10 @@ export declare const fetchCustomer: import("@reduxjs/toolkit").AsyncThunk<Custom
29
30
  export declare const resetCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customer/resetCustomer">;
30
31
  export declare const selectCustomer: (state: AppState) => CustomerState;
31
32
  export declare const selectCustomerAccount: (state: AppState) => Customer | null;
32
- export declare const selectCustomerGiftCards: (state: AppState) => GiftCards;
33
+ export declare const selectCustomerDeals: (state: AppState) => Discounts;
33
34
  export declare const selectCustomerFavorites: (state: AppState) => Favorites;
35
+ export declare const selectCustomerGiftCards: (state: AppState) => GiftCards;
34
36
  export declare const selectCustomerLoyalty: (state: AppState) => LoyaltyPrograms;
35
- export declare const selectCustomerRewards: (state: AppState) => Discounts;
36
37
  export declare const selectCustomerOrders: (state: AppState) => Orders;
38
+ export declare const selectCustomerRewards: (state: AppState) => Discounts;
37
39
  export declare const customerReducer: import("redux").Reducer<CustomerState>;
@@ -3,11 +3,12 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
3
  import { ReducerType } from './types';
4
4
  var initialState = {
5
5
  account: null,
6
- giftCards: [],
6
+ deals: [],
7
7
  favorites: [],
8
+ giftCards: [],
8
9
  loyalty: [],
9
- rewards: [],
10
10
  orders: [],
11
+ rewards: [],
11
12
  loading: 'idle',
12
13
  error: null
13
14
  };
@@ -44,13 +45,14 @@ var CustomerSlice = createSlice({
44
45
  extraReducers: function (builder) {
45
46
  builder
46
47
  .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
+ 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;
48
49
  state.account = ACCOUNT;
49
- state.giftCards = GIFT_CARDS;
50
+ state.deals = DEALS;
50
51
  state.favorites = FAVORITES;
52
+ state.giftCards = GIFT_CARDS;
51
53
  state.loyalty = LOYALTY;
52
- state.rewards = REWARDS;
53
54
  state.orders = ORDERS;
55
+ state.rewards = REWARDS;
54
56
  state.loading = 'idle';
55
57
  state.error = null;
56
58
  })
@@ -66,13 +68,14 @@ var CustomerSlice = createSlice({
66
68
  export var resetCustomer = CustomerSlice.actions.resetCustomer;
67
69
  export var selectCustomer = function (state) { return state.customer; };
68
70
  export var selectCustomerAccount = function (state) { return state.customer.account; };
69
- export var selectCustomerGiftCards = function (state) {
70
- return state.customer.giftCards;
71
- };
71
+ export var selectCustomerDeals = function (state) { return state.customer.deals; };
72
72
  export var selectCustomerFavorites = function (state) {
73
73
  return state.customer.favorites;
74
74
  };
75
+ export var selectCustomerGiftCards = function (state) {
76
+ return state.customer.giftCards;
77
+ };
75
78
  export var selectCustomerLoyalty = function (state) { return state.customer.loyalty; };
76
- export var selectCustomerRewards = function (state) { return state.customer.rewards; };
77
79
  export var selectCustomerOrders = function (state) { return state.customer.orders; };
80
+ export var selectCustomerRewards = function (state) { return state.customer.rewards; };
78
81
  export var customerReducer = CustomerSlice.reducer;
@@ -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;
@@ -5,6 +5,7 @@ export * from './checkout';
5
5
  export * from './config';
6
6
  export * from './customer';
7
7
  export * from './customerIdentify';
8
+ export * from './deals';
8
9
  export * from './discounts';
9
10
  export * from './errorAlerts';
10
11
  export * from './kds';
@@ -5,6 +5,7 @@ export * from './checkout';
5
5
  export * from './config';
6
6
  export * from './customer';
7
7
  export * from './customerIdentify';
8
+ export * from './deals';
8
9
  export * from './discounts';
9
10
  export * from './errorAlerts';
10
11
  export * from './kds';
@@ -49,6 +49,7 @@ export declare const selectKioskConfig: ((state: {
49
49
  config: import("./config").ConfigState;
50
50
  customer: import("./customer").CustomerState;
51
51
  customerIdentify: import("./customerIdentify").CustomerIdentifyState;
52
+ deals: import("./deals").DealsState;
52
53
  discounts: import("./discounts").DiscountsState;
53
54
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
54
55
  kds: import("./kds").KdsState;
@@ -95,6 +96,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
95
96
  config: import("./config").ConfigState;
96
97
  customer: import("./customer").CustomerState;
97
98
  customerIdentify: import("./customerIdentify").CustomerIdentifyState;
99
+ deals: import("./deals").DealsState;
98
100
  discounts: import("./discounts").DiscountsState;
99
101
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
100
102
  kds: import("./kds").KdsState;
@@ -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;
@@ -7,6 +7,7 @@ export declare enum ReducerType {
7
7
  Config = "config",
8
8
  Customer = "customer",
9
9
  CustomerIdentify = "customerIdentify",
10
+ Deals = "deals",
10
11
  Discounts = "discounts",
11
12
  ErrorAlerts = "errorAlerts",
12
13
  Kds = "kds",
@@ -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.33",
3
+ "version": "1.0.35",
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.34",
61
+ "@open-tender/types": "^0.4.35",
62
62
  "@open-tender/ui": "^0.1.22",
63
- "@open-tender/utils": "^0.4.14",
63
+ "@open-tender/utils": "^0.4.15",
64
64
  "@reduxjs/toolkit": "^2.0.1",
65
65
  "date-fns": "2.30.0",
66
66
  "date-fns-tz": "^2.0.0",