@open-tender/store 0.3.95 → 0.4.0

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.
@@ -15,7 +15,6 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
15
15
  notifications: import("..").Notifications;
16
16
  offlineAuths: import("..").OfflineAuthsState;
17
17
  order: import("..").OrderState;
18
- orders: import("..").OrdersState;
19
18
  pos: import("..").PosState;
20
19
  punches: import("..").PunchesState;
21
20
  refund: import("..").RefundState;
@@ -14,7 +14,6 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
14
14
  notifications: import("..").Notifications;
15
15
  offlineAuths: import("../slices").OfflineAuthsState;
16
16
  order: import("../slices").OrderState;
17
- orders: import("../slices").OrdersState;
18
17
  pos: import("../slices").PosState;
19
18
  punches: import("../slices").PunchesState;
20
19
  refund: import("../slices").RefundState;
@@ -39,7 +38,6 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
39
38
  notifications: import("..").Notifications;
40
39
  offlineAuths: import("../slices").OfflineAuthsState;
41
40
  order: import("../slices").OrderState;
42
- orders: import("../slices").OrdersState;
43
41
  pos: import("../slices").PosState;
44
42
  punches: import("../slices").PunchesState;
45
43
  refund: import("../slices").RefundState;
@@ -62,7 +60,6 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
62
60
  notifications: import("..").Notifications;
63
61
  offlineAuths: import("../slices").OfflineAuthsState;
64
62
  order: import("../slices").OrderState;
65
- orders: import("../slices").OrdersState;
66
63
  pos: import("../slices").PosState;
67
64
  punches: import("../slices").PunchesState;
68
65
  refund: import("../slices").RefundState;
@@ -18,7 +18,6 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
18
18
  notifications: slices_1.notificationsReducer,
19
19
  offlineAuths: slices_1.offlineAuthsReducer,
20
20
  order: slices_1.orderReducer,
21
- orders: slices_1.ordersReducer,
22
21
  pos: slices_1.posReducer,
23
22
  punches: slices_1.punchesReducer,
24
23
  refund: slices_1.refundReducer,
@@ -12,7 +12,6 @@ export * from './modal';
12
12
  export * from './notifications';
13
13
  export * from './offlineAuths';
14
14
  export * from './order';
15
- export * from './orders';
16
15
  export * from './pos';
17
16
  export * from './punches';
18
17
  export * from './refund';
@@ -15,7 +15,6 @@ tslib_1.__exportStar(require("./modal"), exports);
15
15
  tslib_1.__exportStar(require("./notifications"), exports);
16
16
  tslib_1.__exportStar(require("./offlineAuths"), exports);
17
17
  tslib_1.__exportStar(require("./order"), exports);
18
- tslib_1.__exportStar(require("./orders"), exports);
19
18
  tslib_1.__exportStar(require("./pos"), exports);
20
19
  tslib_1.__exportStar(require("./punches"), exports);
21
20
  tslib_1.__exportStar(require("./refund"), exports);
@@ -133,27 +133,27 @@ var makeNetOrder = function (order, refunds) {
133
133
  // copy = adjustAmounts(copy, lookup, 'discounts')
134
134
  // copy = adjustAmounts(copy, lookup, 'taxes')
135
135
  // copy = adjustAmounts(copy, lookup, 'tenders', 'tender_index')
136
- order.gift_cards.forEach(function (i) {
136
+ copy.gift_cards.forEach(function (i) {
137
137
  var amount = i.code ? lookup.gift_cards[i.code] : null;
138
138
  if (amount)
139
139
  i.amount = adjustAmount(i.amount, amount);
140
140
  });
141
- order.surcharges.forEach(function (i) {
141
+ copy.surcharges.forEach(function (i) {
142
142
  var amount = lookup.surcharges[i.id];
143
143
  if (amount)
144
144
  i.amount = adjustAmount(i.amount, amount);
145
145
  });
146
- order.discounts.forEach(function (i) {
146
+ copy.discounts.forEach(function (i) {
147
147
  var amount = lookup.discounts[i.id];
148
148
  if (amount)
149
149
  i.amount = adjustAmount(i.amount, amount);
150
150
  });
151
- order.taxes.forEach(function (i) {
151
+ copy.taxes.forEach(function (i) {
152
152
  var amount = lookup.taxes[i.id];
153
153
  if (amount)
154
154
  i.amount = adjustAmount(i.amount, amount);
155
155
  });
156
- order.tenders.forEach(function (i, idx) {
156
+ copy.tenders.forEach(function (i, idx) {
157
157
  var amount = lookup.tenders[i.tender_index || idx];
158
158
  if (amount)
159
159
  i.amount = adjustAmount(i.amount, amount);
@@ -15,7 +15,6 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
15
15
  notifications: import("..").Notifications;
16
16
  offlineAuths: import("..").OfflineAuthsState;
17
17
  order: import("..").OrderState;
18
- orders: import("..").OrdersState;
19
18
  pos: import("..").PosState;
20
19
  punches: import("..").PunchesState;
21
20
  refund: import("..").RefundState;
@@ -14,7 +14,6 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
14
14
  notifications: import("..").Notifications;
15
15
  offlineAuths: import("../slices").OfflineAuthsState;
16
16
  order: import("../slices").OrderState;
17
- orders: import("../slices").OrdersState;
18
17
  pos: import("../slices").PosState;
19
18
  punches: import("../slices").PunchesState;
20
19
  refund: import("../slices").RefundState;
@@ -39,7 +38,6 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
39
38
  notifications: import("..").Notifications;
40
39
  offlineAuths: import("../slices").OfflineAuthsState;
41
40
  order: import("../slices").OrderState;
42
- orders: import("../slices").OrdersState;
43
41
  pos: import("../slices").PosState;
44
42
  punches: import("../slices").PunchesState;
45
43
  refund: import("../slices").RefundState;
@@ -62,7 +60,6 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
62
60
  notifications: import("..").Notifications;
63
61
  offlineAuths: import("../slices").OfflineAuthsState;
64
62
  order: import("../slices").OrderState;
65
- orders: import("../slices").OrdersState;
66
63
  pos: import("../slices").PosState;
67
64
  punches: import("../slices").PunchesState;
68
65
  refund: import("../slices").RefundState;
@@ -1,5 +1,5 @@
1
1
  import { combineReducers, configureStore } from '@reduxjs/toolkit';
2
- import { alertsReducer, arrivalsReducer, checkoutReducer, completedOrdersReducer, configReducer, discountsReducer, errorAlertsReducer, kdsReducer, menuReducer, menuPagesReducer, modalReducer, notificationsReducer, offlineAuthsReducer, orderReducer, ordersReducer, posReducer, punchesReducer, refundReducer, settingsReducer, sidebarReducer, surchargesReducer, taxesReducer } from '../slices';
2
+ import { alertsReducer, arrivalsReducer, checkoutReducer, completedOrdersReducer, configReducer, discountsReducer, errorAlertsReducer, kdsReducer, 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,
@@ -15,7 +15,6 @@ export var appReducer = combineReducers({
15
15
  notifications: notificationsReducer,
16
16
  offlineAuths: offlineAuthsReducer,
17
17
  order: orderReducer,
18
- orders: ordersReducer,
19
18
  pos: posReducer,
20
19
  punches: punchesReducer,
21
20
  refund: refundReducer,
@@ -12,7 +12,6 @@ export * from './modal';
12
12
  export * from './notifications';
13
13
  export * from './offlineAuths';
14
14
  export * from './order';
15
- export * from './orders';
16
15
  export * from './pos';
17
16
  export * from './punches';
18
17
  export * from './refund';
@@ -12,7 +12,6 @@ export * from './modal';
12
12
  export * from './notifications';
13
13
  export * from './offlineAuths';
14
14
  export * from './order';
15
- export * from './orders';
16
15
  export * from './pos';
17
16
  export * from './punches';
18
17
  export * from './refund';
@@ -127,27 +127,27 @@ export var makeNetOrder = function (order, refunds) {
127
127
  // copy = adjustAmounts(copy, lookup, 'discounts')
128
128
  // copy = adjustAmounts(copy, lookup, 'taxes')
129
129
  // copy = adjustAmounts(copy, lookup, 'tenders', 'tender_index')
130
- order.gift_cards.forEach(function (i) {
130
+ copy.gift_cards.forEach(function (i) {
131
131
  var amount = i.code ? lookup.gift_cards[i.code] : null;
132
132
  if (amount)
133
133
  i.amount = adjustAmount(i.amount, amount);
134
134
  });
135
- order.surcharges.forEach(function (i) {
135
+ copy.surcharges.forEach(function (i) {
136
136
  var amount = lookup.surcharges[i.id];
137
137
  if (amount)
138
138
  i.amount = adjustAmount(i.amount, amount);
139
139
  });
140
- order.discounts.forEach(function (i) {
140
+ copy.discounts.forEach(function (i) {
141
141
  var amount = lookup.discounts[i.id];
142
142
  if (amount)
143
143
  i.amount = adjustAmount(i.amount, amount);
144
144
  });
145
- order.taxes.forEach(function (i) {
145
+ copy.taxes.forEach(function (i) {
146
146
  var amount = lookup.taxes[i.id];
147
147
  if (amount)
148
148
  i.amount = adjustAmount(i.amount, amount);
149
149
  });
150
- order.tenders.forEach(function (i, idx) {
150
+ copy.tenders.forEach(function (i, idx) {
151
151
  var amount = lookup.tenders[i.tender_index || idx];
152
152
  if (amount)
153
153
  i.amount = adjustAmount(i.amount, amount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.3.95",
3
+ "version": "0.4.0",
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",
@@ -1,21 +0,0 @@
1
- import { FetchOrdersArgs, Orders, RequestError, RequestStatus } from '../types';
2
- import { AppState } from '../app';
3
- export interface OrdersState {
4
- entities: Orders;
5
- loading: RequestStatus;
6
- error: RequestError;
7
- current: any;
8
- refund: any;
9
- }
10
- export declare enum OrdersActionType {
11
- FetchOrders = "orders/fetchOrders"
12
- }
13
- export declare const fetchOrders: import("@reduxjs/toolkit").AsyncThunk<Orders, FetchOrdersArgs, {
14
- state: AppState;
15
- rejectValue: RequestError;
16
- }>;
17
- export declare const resetOrders: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setOrdersCurrent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setOrdersRefund: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
18
- export declare const selectOrders: (state: AppState) => OrdersState;
19
- export declare const selectOrdersCurrent: (state: AppState) => any;
20
- export declare const selectOrdersRefund: (state: AppState) => any;
21
- export declare const ordersReducer: import("redux").Reducer<OrdersState, import("redux").AnyAction>;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ordersReducer = exports.selectOrdersRefund = exports.selectOrdersCurrent = exports.selectOrders = exports.setOrdersRefund = exports.setOrdersCurrent = exports.resetOrders = exports.fetchOrders = exports.OrdersActionType = void 0;
5
- var tslib_1 = require("tslib");
6
- var toolkit_1 = require("@reduxjs/toolkit");
7
- var types_1 = require("./types");
8
- var utils_1 = require("../utils");
9
- var initialState = {
10
- entities: [],
11
- loading: 'idle',
12
- error: null,
13
- current: null,
14
- refund: null
15
- };
16
- var OrdersActionType;
17
- (function (OrdersActionType) {
18
- OrdersActionType["FetchOrders"] = "orders/fetchOrders";
19
- })(OrdersActionType = exports.OrdersActionType || (exports.OrdersActionType = {}));
20
- exports.fetchOrders = (0, toolkit_1.createAsyncThunk)(OrdersActionType.FetchOrders, function (params, _a) {
21
- var getState = _a.getState, rejectWithValue = _a.rejectWithValue;
22
- return tslib_1.__awaiter(void 0, void 0, void 0, function () {
23
- var api, args, err_1;
24
- return tslib_1.__generator(this, function (_b) {
25
- switch (_b.label) {
26
- case 0:
27
- _b.trys.push([0, 2, , 3]);
28
- api = getState().config.api;
29
- args = (0, utils_1.makeFetchOrdersArgs)(params);
30
- return [4 /*yield*/, api.getOrders(args)];
31
- case 1: return [2 /*return*/, _b.sent()];
32
- case 2:
33
- err_1 = _b.sent();
34
- return [2 /*return*/, rejectWithValue(err_1)];
35
- case 3: return [2 /*return*/];
36
- }
37
- });
38
- });
39
- });
40
- var ordersSlice = (0, toolkit_1.createSlice)({
41
- name: types_1.ReducerType.Orders,
42
- initialState: initialState,
43
- reducers: {
44
- resetOrders: function () { return initialState; },
45
- setOrdersCurrent: function (state, action) {
46
- state.current = action.payload;
47
- },
48
- setOrdersRefund: function (state, action) {
49
- state.refund = action.payload;
50
- }
51
- },
52
- extraReducers: function (builder) {
53
- builder
54
- .addCase(exports.fetchOrders.fulfilled, function (state, action) {
55
- state.entities = action.payload;
56
- state.loading = 'idle';
57
- state.error = null;
58
- })
59
- .addCase(exports.fetchOrders.pending, function (state) {
60
- state.loading = 'pending';
61
- })
62
- .addCase(exports.fetchOrders.rejected, function (state, action) {
63
- state.error = action.payload;
64
- state.loading = 'idle';
65
- });
66
- }
67
- });
68
- exports.resetOrders = (_a = ordersSlice.actions, _a.resetOrders), exports.setOrdersCurrent = _a.setOrdersCurrent, exports.setOrdersRefund = _a.setOrdersRefund;
69
- var selectOrders = function (state) { return state.orders; };
70
- exports.selectOrders = selectOrders;
71
- var selectOrdersCurrent = function (state) { return state.orders.current; };
72
- exports.selectOrdersCurrent = selectOrdersCurrent;
73
- var selectOrdersRefund = function (state) { return state.orders.refund; };
74
- exports.selectOrdersRefund = selectOrdersRefund;
75
- exports.ordersReducer = ordersSlice.reducer;
@@ -1,21 +0,0 @@
1
- import { FetchOrdersArgs, Orders, RequestError, RequestStatus } from '../types';
2
- import { AppState } from '../app';
3
- export interface OrdersState {
4
- entities: Orders;
5
- loading: RequestStatus;
6
- error: RequestError;
7
- current: any;
8
- refund: any;
9
- }
10
- export declare enum OrdersActionType {
11
- FetchOrders = "orders/fetchOrders"
12
- }
13
- export declare const fetchOrders: import("@reduxjs/toolkit").AsyncThunk<Orders, FetchOrdersArgs, {
14
- state: AppState;
15
- rejectValue: RequestError;
16
- }>;
17
- export declare const resetOrders: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setOrdersCurrent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setOrdersRefund: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
18
- export declare const selectOrders: (state: AppState) => OrdersState;
19
- export declare const selectOrdersCurrent: (state: AppState) => any;
20
- export declare const selectOrdersRefund: (state: AppState) => any;
21
- export declare const ordersReducer: import("redux").Reducer<OrdersState, import("redux").AnyAction>;
@@ -1,69 +0,0 @@
1
- var _a;
2
- import { __awaiter, __generator } from "tslib";
3
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
4
- import { ReducerType } from './types';
5
- import { makeFetchOrdersArgs } from '../utils';
6
- var initialState = {
7
- entities: [],
8
- loading: 'idle',
9
- error: null,
10
- current: null,
11
- refund: null
12
- };
13
- export var OrdersActionType;
14
- (function (OrdersActionType) {
15
- OrdersActionType["FetchOrders"] = "orders/fetchOrders";
16
- })(OrdersActionType || (OrdersActionType = {}));
17
- export var fetchOrders = createAsyncThunk(OrdersActionType.FetchOrders, function (params, _a) {
18
- var getState = _a.getState, rejectWithValue = _a.rejectWithValue;
19
- return __awaiter(void 0, void 0, void 0, function () {
20
- var api, args, err_1;
21
- return __generator(this, function (_b) {
22
- switch (_b.label) {
23
- case 0:
24
- _b.trys.push([0, 2, , 3]);
25
- api = getState().config.api;
26
- args = makeFetchOrdersArgs(params);
27
- return [4 /*yield*/, api.getOrders(args)];
28
- case 1: return [2 /*return*/, _b.sent()];
29
- case 2:
30
- err_1 = _b.sent();
31
- return [2 /*return*/, rejectWithValue(err_1)];
32
- case 3: return [2 /*return*/];
33
- }
34
- });
35
- });
36
- });
37
- var ordersSlice = createSlice({
38
- name: ReducerType.Orders,
39
- initialState: initialState,
40
- reducers: {
41
- resetOrders: function () { return initialState; },
42
- setOrdersCurrent: function (state, action) {
43
- state.current = action.payload;
44
- },
45
- setOrdersRefund: function (state, action) {
46
- state.refund = action.payload;
47
- }
48
- },
49
- extraReducers: function (builder) {
50
- builder
51
- .addCase(fetchOrders.fulfilled, function (state, action) {
52
- state.entities = action.payload;
53
- state.loading = 'idle';
54
- state.error = null;
55
- })
56
- .addCase(fetchOrders.pending, function (state) {
57
- state.loading = 'pending';
58
- })
59
- .addCase(fetchOrders.rejected, function (state, action) {
60
- state.error = action.payload;
61
- state.loading = 'idle';
62
- });
63
- }
64
- });
65
- export var resetOrders = (_a = ordersSlice.actions, _a.resetOrders), setOrdersCurrent = _a.setOrdersCurrent, setOrdersRefund = _a.setOrdersRefund;
66
- export var selectOrders = function (state) { return state.orders; };
67
- export var selectOrdersCurrent = function (state) { return state.orders.current; };
68
- export var selectOrdersRefund = function (state) { return state.orders.refund; };
69
- export var ordersReducer = ordersSlice.reducer;