@open-tender/store 1.0.10 → 1.0.11

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.
@@ -6,6 +6,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
6
6
  cartSummary: import("..").CartSummaryState;
7
7
  checkout: import("..").CheckoutState;
8
8
  config: import("..").ConfigState;
9
+ customerIdentify: import("..").CustomerIdentifyState;
9
10
  discounts: import("..").DiscountsState;
10
11
  errorAlerts: import("..").ErrorAlertsState;
11
12
  kds: import("..").KdsState;
@@ -5,6 +5,7 @@ export declare const appReducer: import("redux").Reducer<{
5
5
  cartSummary: import("../slices").CartSummaryState;
6
6
  checkout: import("../slices").CheckoutState;
7
7
  config: import("../slices").ConfigState;
8
+ customerIdentify: import("../slices").CustomerIdentifyState;
8
9
  discounts: import("../slices").DiscountsState;
9
10
  errorAlerts: import("../slices").ErrorAlertsState;
10
11
  kds: import("../slices").KdsState;
@@ -28,6 +29,7 @@ export declare const appReducer: import("redux").Reducer<{
28
29
  cartSummary: import("../slices").CartSummaryState | undefined;
29
30
  checkout: import("../slices").CheckoutState | undefined;
30
31
  config: import("../slices").ConfigState | undefined;
32
+ customerIdentify: import("../slices").CustomerIdentifyState | undefined;
31
33
  discounts: import("../slices").DiscountsState | undefined;
32
34
  errorAlerts: import("../slices").ErrorAlertsState | undefined;
33
35
  kds: import("../slices").KdsState | undefined;
@@ -53,6 +55,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
53
55
  cartSummary: import("../slices").CartSummaryState;
54
56
  checkout: import("../slices").CheckoutState;
55
57
  config: import("../slices").ConfigState;
58
+ customerIdentify: import("../slices").CustomerIdentifyState;
56
59
  discounts: import("../slices").DiscountsState;
57
60
  errorAlerts: import("../slices").ErrorAlertsState;
58
61
  kds: import("../slices").KdsState;
@@ -77,6 +80,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
77
80
  cartSummary: import("../slices").CartSummaryState;
78
81
  checkout: import("../slices").CheckoutState;
79
82
  config: import("../slices").ConfigState;
83
+ customerIdentify: import("../slices").CustomerIdentifyState;
80
84
  discounts: import("../slices").DiscountsState;
81
85
  errorAlerts: import("../slices").ErrorAlertsState;
82
86
  kds: import("../slices").KdsState;
@@ -9,6 +9,7 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
9
9
  cartSummary: slices_1.cartSummaryReducer,
10
10
  checkout: slices_1.checkoutReducer,
11
11
  config: slices_1.configReducer,
12
+ customerIdentify: slices_1.CustomerIdentifyReducer,
12
13
  discounts: slices_1.discountsReducer,
13
14
  errorAlerts: slices_1.errorAlertsReducer,
14
15
  kds: slices_1.kdsReducer,
@@ -1,5 +1,5 @@
1
- import { Arrivals, CustomerCheckout, Menu, Order, Orders, OrderCreate, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender } from '@open-tender/types';
2
- import { CashEvent, CashSummary, CustomerIdentifier, DeviceRead, Discount, Discounts, Employee, Employees, PosSettingType, ErrorAlert, ErrorAlerts, GiftCardBalance, GiftCardCredit, InternalSettings, KioskConfig, LevelUp, MenuColors, MenuPages, OfflineAuths, OfflineAuthsResult, Punch, Refund, Settings, Store, Surcharges, Taxes, Tender } from '../types';
1
+ import { Arrivals, CustomerIdentifier, CustomerIdentify, Menu, Order, Orders, OrderCreate, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender } from '@open-tender/types';
2
+ import { CashEvent, CashSummary, DeviceRead, Discount, Discounts, Employee, Employees, PosSettingType, ErrorAlert, ErrorAlerts, GiftCardBalance, GiftCardCredit, InternalSettings, KioskConfig, LevelUp, MenuColors, MenuPages, OfflineAuths, OfflineAuthsResult, Punch, Refund, Settings, Store, Surcharges, Taxes, Tender } from '../types';
3
3
  import { OrdersParams } from '../slices';
4
4
  export interface InitAPI {
5
5
  apiUrl: string;
@@ -60,7 +60,7 @@ declare class PosAPI {
60
60
  postChipDNATender(orderId: string, data: CheckoutTender): Promise<unknown>;
61
61
  postChipDNACancel(): Promise<null>;
62
62
  postChipDNATmsUpdate(): Promise<null>;
63
- postIdentifyCustomer(data: CustomerIdentifier): Promise<CustomerCheckout>;
63
+ postIdentifyCustomer(data: CustomerIdentifier): Promise<CustomerIdentify>;
64
64
  postOrderValidate(order: OrderCreate): Promise<Order>;
65
65
  postOrder(order: OrderCreate): Promise<Order>;
66
66
  deleteOrder(order: OrderCreate): Promise<Order>;
@@ -1,12 +1,12 @@
1
1
  import { AppState } from '../app';
2
- import { CustomerCheckout, IdentifyCustomer, Money, Order, OrderCreateDiscounts, OrderCreateGiftCards, OrderCreatePoints, OrderCreateSurcharges, OrderTender, RequestError, RequestStatus, Taxes } from '@open-tender/types';
2
+ import { CustomerIdentifier, CustomerIdentify, Money, Order, OrderCreateDiscounts, OrderCreateGiftCards, OrderCreatePoints, OrderCreateSurcharges, OrderTender, RequestError, RequestStatus, Taxes } from '@open-tender/types';
3
3
  import { Tender } from '../types';
4
4
  export interface CheckoutState {
5
5
  activating: RequestStatus;
6
6
  authorizing: RequestStatus;
7
7
  check: Order | null;
8
8
  completedOrder: Order | null;
9
- customer: CustomerCheckout | null;
9
+ customer: CustomerIdentify | null;
10
10
  discounts: OrderCreateDiscounts;
11
11
  error: RequestError;
12
12
  giftCards: OrderCreateGiftCards;
@@ -76,7 +76,12 @@ export declare const updateCart: import("@reduxjs/toolkit").AsyncThunk<void, any
76
76
  fulfilledMeta?: unknown;
77
77
  rejectedMeta?: unknown;
78
78
  }>;
79
- export declare const identifyCustomer: import("@reduxjs/toolkit").AsyncThunk<void | CustomerCheckout, IdentifyCustomer, {
79
+ export interface IdentifyCustomer {
80
+ data: CustomerIdentifier;
81
+ callback?: () => void;
82
+ showError?: boolean;
83
+ }
84
+ export declare const identifyCustomer: import("@reduxjs/toolkit").AsyncThunk<void | CustomerIdentify, IdentifyCustomer, {
80
85
  state: AppState;
81
86
  rejectValue: RequestError;
82
87
  dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
@@ -139,7 +144,7 @@ export declare const activateGiftCards: import("@reduxjs/toolkit").AsyncThunk<an
139
144
  export declare const resetPosCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetPosCheckout">, resetPosCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetPosCheck">, handleCheckoutError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/handleCheckoutError">, addGiftCard: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addGiftCard">, removeGiftCard: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeGiftCard">, addSurcharge: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addSurcharge">, removeSurcharge: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeSurcharge">, addDiscount: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addDiscount">, removeDiscount: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeDiscount">, addTax: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addTax">, removeTax: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeTax">, addTip: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addTip">, removeTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/removeTip">, setTaxExempt: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setTaxExempt">, addCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addCustomer">, removeCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/removeCustomer">, setPendingDiscounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setPendingDiscounts">, setPoints: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setPoints">, setMadeFor: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setMadeFor">, setPhone: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setPhone">;
140
145
  export declare const selectPosCheckout: (state: AppState) => CheckoutState;
141
146
  export declare const selectPosCheck: (state: AppState) => Order | null;
142
- export declare const selectPosCustomer: (state: AppState) => CustomerCheckout | null;
147
+ export declare const selectPosCustomer: (state: AppState) => CustomerIdentify | null;
143
148
  export declare const selectPosCustomerName: (state: AppState) => string | null;
144
149
  export declare const selectPosCustomerNameShort: (state: AppState) => string | null;
145
150
  export declare const selectPosPendingDiscounts: (state: AppState) => boolean;
@@ -0,0 +1,24 @@
1
+ import { AppState } from '../app';
2
+ import { CustomerIdentifier, CustomerIdentify, RequestError, RequestStatus } from '@open-tender/types';
3
+ export interface CustomerIdentifyState {
4
+ data: CustomerIdentify | null;
5
+ loading: RequestStatus;
6
+ error: RequestError;
7
+ }
8
+ export declare enum CustomerIdentifyActionType {
9
+ FetchCustomerIdentify = "CustomerIdentify/fetchCustomerIdentify"
10
+ }
11
+ export declare const fetchCustomerIdentify: import("@reduxjs/toolkit").AsyncThunk<CustomerIdentify, CustomerIdentifier, {
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 resetCustomerIdentify: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customerIdentify/resetCustomerIdentify">;
22
+ export declare const selectCustomerIdentify: (state: AppState) => CustomerIdentifyState;
23
+ export declare const selectCustomerIdentified: (state: AppState) => CustomerIdentify | null;
24
+ export declare const CustomerIdentifyReducer: import("redux").Reducer<CustomerIdentifyState>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerIdentifyReducer = exports.selectCustomerIdentified = exports.selectCustomerIdentify = exports.resetCustomerIdentify = exports.fetchCustomerIdentify = exports.CustomerIdentifyActionType = 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
+ data: null,
9
+ loading: 'idle',
10
+ error: null
11
+ };
12
+ var CustomerIdentifyActionType;
13
+ (function (CustomerIdentifyActionType) {
14
+ CustomerIdentifyActionType["FetchCustomerIdentify"] = "CustomerIdentify/fetchCustomerIdentify";
15
+ })(CustomerIdentifyActionType || (exports.CustomerIdentifyActionType = CustomerIdentifyActionType = {}));
16
+ exports.fetchCustomerIdentify = (0, toolkit_1.createAsyncThunk)(CustomerIdentifyActionType.FetchCustomerIdentify, function (data, _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.postIdentifyCustomer(data)];
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 customerIdentifySlice = (0, toolkit_1.createSlice)({
36
+ name: types_1.ReducerType.CustomerIdentify,
37
+ initialState: initialState,
38
+ reducers: {
39
+ resetCustomerIdentify: function () { return initialState; }
40
+ },
41
+ extraReducers: function (builder) {
42
+ builder
43
+ .addCase(exports.fetchCustomerIdentify.fulfilled, function (state, action) {
44
+ state.data = action.payload;
45
+ state.loading = 'idle';
46
+ state.error = null;
47
+ })
48
+ .addCase(exports.fetchCustomerIdentify.pending, function (state) {
49
+ state.loading = 'pending';
50
+ })
51
+ .addCase(exports.fetchCustomerIdentify.rejected, function (state, action) {
52
+ state.error = action.payload;
53
+ state.loading = 'idle';
54
+ });
55
+ }
56
+ });
57
+ exports.resetCustomerIdentify = customerIdentifySlice.actions.resetCustomerIdentify;
58
+ var selectCustomerIdentify = function (state) {
59
+ return state.customerIdentify;
60
+ };
61
+ exports.selectCustomerIdentify = selectCustomerIdentify;
62
+ var selectCustomerIdentified = function (state) {
63
+ return state.customerIdentify.data;
64
+ };
65
+ exports.selectCustomerIdentified = selectCustomerIdentified;
66
+ exports.CustomerIdentifyReducer = customerIdentifySlice.reducer;
@@ -3,6 +3,7 @@ export * from './arrivals';
3
3
  export * from './cartSummary';
4
4
  export * from './checkout';
5
5
  export * from './config';
6
+ export * from './customerIdentify';
6
7
  export * from './discounts';
7
8
  export * from './errorAlerts';
8
9
  export * from './kds';
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./arrivals"), exports);
6
6
  tslib_1.__exportStar(require("./cartSummary"), exports);
7
7
  tslib_1.__exportStar(require("./checkout"), exports);
8
8
  tslib_1.__exportStar(require("./config"), exports);
9
+ tslib_1.__exportStar(require("./customerIdentify"), exports);
9
10
  tslib_1.__exportStar(require("./discounts"), exports);
10
11
  tslib_1.__exportStar(require("./errorAlerts"), exports);
11
12
  tslib_1.__exportStar(require("./kds"), exports);
@@ -47,6 +47,7 @@ export declare const selectKioskConfig: ((state: {
47
47
  cartSummary: import("./cartSummary").CartSummaryState;
48
48
  checkout: import("./checkout").CheckoutState;
49
49
  config: import("./config").ConfigState;
50
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
50
51
  discounts: import("./discounts").DiscountsState;
51
52
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
52
53
  kds: import("./kds").KdsState;
@@ -91,6 +92,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
91
92
  cartSummary: import("./cartSummary").CartSummaryState;
92
93
  checkout: import("./checkout").CheckoutState;
93
94
  config: import("./config").ConfigState;
95
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
94
96
  discounts: import("./discounts").DiscountsState;
95
97
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
96
98
  kds: import("./kds").KdsState;
@@ -26,6 +26,7 @@ export declare const selectMenuPagesFiltered: ((state: {
26
26
  cartSummary: import("./cartSummary").CartSummaryState;
27
27
  checkout: import("./checkout").CheckoutState;
28
28
  config: import("./config").ConfigState;
29
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
29
30
  discounts: import("./discounts").DiscountsState;
30
31
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
31
32
  kds: import("./kds").KdsState;
@@ -47,6 +47,7 @@ export declare const selectCartIds: ((state: {
47
47
  cartSummary: import("./cartSummary").CartSummaryState;
48
48
  checkout: import("./checkout").CheckoutState;
49
49
  config: import("./config").ConfigState;
50
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
50
51
  discounts: import("./discounts").DiscountsState;
51
52
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
52
53
  kds: import("./kds").KdsState;
@@ -91,6 +92,7 @@ export declare const selectCartQuantity: ((state: {
91
92
  cartSummary: import("./cartSummary").CartSummaryState;
92
93
  checkout: import("./checkout").CheckoutState;
93
94
  config: import("./config").ConfigState;
95
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
94
96
  discounts: import("./discounts").DiscountsState;
95
97
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
96
98
  kds: import("./kds").KdsState;
@@ -135,6 +137,7 @@ export declare const selectCartTotal: ((state: {
135
137
  cartSummary: import("./cartSummary").CartSummaryState;
136
138
  checkout: import("./checkout").CheckoutState;
137
139
  config: import("./config").ConfigState;
140
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
138
141
  discounts: import("./discounts").DiscountsState;
139
142
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
140
143
  kds: import("./kds").KdsState;
@@ -179,6 +182,7 @@ export declare const selectCartTotals: ((state: {
179
182
  cartSummary: import("./cartSummary").CartSummaryState;
180
183
  checkout: import("./checkout").CheckoutState;
181
184
  config: import("./config").ConfigState;
185
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
182
186
  discounts: import("./discounts").DiscountsState;
183
187
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
184
188
  kds: import("./kds").KdsState;
@@ -5,6 +5,7 @@ export declare enum ReducerType {
5
5
  Checkout = "checkout",
6
6
  CompletedOrders = "completedOrders",
7
7
  Config = "config",
8
+ CustomerIdentify = "customerIdentify",
8
9
  Discounts = "discounts",
9
10
  ErrorAlerts = "errorAlerts",
10
11
  Kds = "kds",
@@ -9,6 +9,7 @@ var ReducerType;
9
9
  ReducerType["Checkout"] = "checkout";
10
10
  ReducerType["CompletedOrders"] = "completedOrders";
11
11
  ReducerType["Config"] = "config";
12
+ ReducerType["CustomerIdentify"] = "customerIdentify";
12
13
  ReducerType["Discounts"] = "discounts";
13
14
  ReducerType["ErrorAlerts"] = "errorAlerts";
14
15
  ReducerType["Kds"] = "kds";
@@ -1,44 +1,5 @@
1
- import { DiscountType, ISOString, Money, OrderType, ServiceType, TenderType } from '@open-tender/types';
1
+ import { ISOString, Money, OrderType, ServiceType, TenderType } from '@open-tender/types';
2
2
  import { Address, Customer } from './customer';
3
- export interface CustomerIdentifier {
4
- card_token?: string;
5
- phone?: string;
6
- qr_code?: string;
7
- }
8
- export interface IdentifyCustomer {
9
- data: CustomerIdentifier;
10
- callback?: () => void;
11
- showError?: boolean;
12
- }
13
- export interface CustomerDiscount {
14
- customer_loyalty_id: number;
15
- loyalty_program_id: number;
16
- order_type: OrderType;
17
- amount: Money;
18
- name: string;
19
- discount_id: number;
20
- discount_type: DiscountType;
21
- description: string;
22
- before_surcharge: boolean;
23
- is_taxed: boolean;
24
- is_promo_code: boolean;
25
- is_auto: boolean;
26
- is_loyalty: boolean;
27
- }
28
- export type CustomerDiscounts = Array<CustomerDiscount>;
29
- export interface CustomerCheckoutCustomer {
30
- customer_id: number;
31
- email: string;
32
- first_name: string;
33
- last_name: string;
34
- phone: string;
35
- }
36
- export interface CustomerCheckout {
37
- customer: CustomerCheckoutCustomer;
38
- discounts: CustomerDiscounts;
39
- points: any;
40
- discount: any;
41
- }
42
3
  export interface SimpleCartOption {
43
4
  id: number;
44
5
  quantity: number;
@@ -6,6 +6,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
6
6
  cartSummary: import("..").CartSummaryState;
7
7
  checkout: import("..").CheckoutState;
8
8
  config: import("..").ConfigState;
9
+ customerIdentify: import("..").CustomerIdentifyState;
9
10
  discounts: import("..").DiscountsState;
10
11
  errorAlerts: import("..").ErrorAlertsState;
11
12
  kds: import("..").KdsState;
@@ -5,6 +5,7 @@ export declare const appReducer: import("redux").Reducer<{
5
5
  cartSummary: import("../slices").CartSummaryState;
6
6
  checkout: import("../slices").CheckoutState;
7
7
  config: import("../slices").ConfigState;
8
+ customerIdentify: import("../slices").CustomerIdentifyState;
8
9
  discounts: import("../slices").DiscountsState;
9
10
  errorAlerts: import("../slices").ErrorAlertsState;
10
11
  kds: import("../slices").KdsState;
@@ -28,6 +29,7 @@ export declare const appReducer: import("redux").Reducer<{
28
29
  cartSummary: import("../slices").CartSummaryState | undefined;
29
30
  checkout: import("../slices").CheckoutState | undefined;
30
31
  config: import("../slices").ConfigState | undefined;
32
+ customerIdentify: import("../slices").CustomerIdentifyState | undefined;
31
33
  discounts: import("../slices").DiscountsState | undefined;
32
34
  errorAlerts: import("../slices").ErrorAlertsState | undefined;
33
35
  kds: import("../slices").KdsState | undefined;
@@ -53,6 +55,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
53
55
  cartSummary: import("../slices").CartSummaryState;
54
56
  checkout: import("../slices").CheckoutState;
55
57
  config: import("../slices").ConfigState;
58
+ customerIdentify: import("../slices").CustomerIdentifyState;
56
59
  discounts: import("../slices").DiscountsState;
57
60
  errorAlerts: import("../slices").ErrorAlertsState;
58
61
  kds: import("../slices").KdsState;
@@ -77,6 +80,7 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<{
77
80
  cartSummary: import("../slices").CartSummaryState;
78
81
  checkout: import("../slices").CheckoutState;
79
82
  config: import("../slices").ConfigState;
83
+ customerIdentify: import("../slices").CustomerIdentifyState;
80
84
  discounts: import("../slices").DiscountsState;
81
85
  errorAlerts: import("../slices").ErrorAlertsState;
82
86
  kds: import("../slices").KdsState;
@@ -1,11 +1,12 @@
1
1
  import { combineReducers, configureStore } from '@reduxjs/toolkit';
2
- import { alertsReducer, arrivalsReducer, cartSummaryReducer, checkoutReducer, configReducer, 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, CustomerIdentifyReducer, discountsReducer, errorAlertsReducer, kdsReducer, kioskReducer, menuReducer, menuPagesReducer, modalReducer, notificationsReducer, offlineAuthsReducer, orderReducer, posReducer, punchesReducer, refundReducer, settingsReducer, sidebarReducer, surchargesReducer, taxesReducer } from '../slices';
3
3
  export var appReducer = combineReducers({
4
4
  alerts: alertsReducer,
5
5
  arrivals: arrivalsReducer,
6
6
  cartSummary: cartSummaryReducer,
7
7
  checkout: checkoutReducer,
8
8
  config: configReducer,
9
+ customerIdentify: CustomerIdentifyReducer,
9
10
  discounts: discountsReducer,
10
11
  errorAlerts: errorAlertsReducer,
11
12
  kds: kdsReducer,
@@ -1,5 +1,5 @@
1
- import { Arrivals, CustomerCheckout, Menu, Order, Orders, OrderCreate, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender } from '@open-tender/types';
2
- import { CashEvent, CashSummary, CustomerIdentifier, DeviceRead, Discount, Discounts, Employee, Employees, PosSettingType, ErrorAlert, ErrorAlerts, GiftCardBalance, GiftCardCredit, InternalSettings, KioskConfig, LevelUp, MenuColors, MenuPages, OfflineAuths, OfflineAuthsResult, Punch, Refund, Settings, Store, Surcharges, Taxes, Tender } from '../types';
1
+ import { Arrivals, CustomerIdentifier, CustomerIdentify, Menu, Order, Orders, OrderCreate, OrderTender, OrderType, ServiceType, SelectOptions, ItemTypes, OrderUpdate, TicketsUpdate, TicketUpdate, TicketStatusUpdate, RequestedAt, RevenueCenter, CheckoutTender } from '@open-tender/types';
2
+ import { CashEvent, CashSummary, DeviceRead, Discount, Discounts, Employee, Employees, PosSettingType, ErrorAlert, ErrorAlerts, GiftCardBalance, GiftCardCredit, InternalSettings, KioskConfig, LevelUp, MenuColors, MenuPages, OfflineAuths, OfflineAuthsResult, Punch, Refund, Settings, Store, Surcharges, Taxes, Tender } from '../types';
3
3
  import { OrdersParams } from '../slices';
4
4
  export interface InitAPI {
5
5
  apiUrl: string;
@@ -60,7 +60,7 @@ declare class PosAPI {
60
60
  postChipDNATender(orderId: string, data: CheckoutTender): Promise<unknown>;
61
61
  postChipDNACancel(): Promise<null>;
62
62
  postChipDNATmsUpdate(): Promise<null>;
63
- postIdentifyCustomer(data: CustomerIdentifier): Promise<CustomerCheckout>;
63
+ postIdentifyCustomer(data: CustomerIdentifier): Promise<CustomerIdentify>;
64
64
  postOrderValidate(order: OrderCreate): Promise<Order>;
65
65
  postOrder(order: OrderCreate): Promise<Order>;
66
66
  deleteOrder(order: OrderCreate): Promise<Order>;
@@ -1,12 +1,12 @@
1
1
  import { AppState } from '../app';
2
- import { CustomerCheckout, IdentifyCustomer, Money, Order, OrderCreateDiscounts, OrderCreateGiftCards, OrderCreatePoints, OrderCreateSurcharges, OrderTender, RequestError, RequestStatus, Taxes } from '@open-tender/types';
2
+ import { CustomerIdentifier, CustomerIdentify, Money, Order, OrderCreateDiscounts, OrderCreateGiftCards, OrderCreatePoints, OrderCreateSurcharges, OrderTender, RequestError, RequestStatus, Taxes } from '@open-tender/types';
3
3
  import { Tender } from '../types';
4
4
  export interface CheckoutState {
5
5
  activating: RequestStatus;
6
6
  authorizing: RequestStatus;
7
7
  check: Order | null;
8
8
  completedOrder: Order | null;
9
- customer: CustomerCheckout | null;
9
+ customer: CustomerIdentify | null;
10
10
  discounts: OrderCreateDiscounts;
11
11
  error: RequestError;
12
12
  giftCards: OrderCreateGiftCards;
@@ -76,7 +76,12 @@ export declare const updateCart: import("@reduxjs/toolkit").AsyncThunk<void, any
76
76
  fulfilledMeta?: unknown;
77
77
  rejectedMeta?: unknown;
78
78
  }>;
79
- export declare const identifyCustomer: import("@reduxjs/toolkit").AsyncThunk<void | CustomerCheckout, IdentifyCustomer, {
79
+ export interface IdentifyCustomer {
80
+ data: CustomerIdentifier;
81
+ callback?: () => void;
82
+ showError?: boolean;
83
+ }
84
+ export declare const identifyCustomer: import("@reduxjs/toolkit").AsyncThunk<void | CustomerIdentify, IdentifyCustomer, {
80
85
  state: AppState;
81
86
  rejectValue: RequestError;
82
87
  dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
@@ -139,7 +144,7 @@ export declare const activateGiftCards: import("@reduxjs/toolkit").AsyncThunk<an
139
144
  export declare const resetPosCheckout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetPosCheckout">, resetPosCheck: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/resetPosCheck">, handleCheckoutError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/handleCheckoutError">, addGiftCard: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addGiftCard">, removeGiftCard: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeGiftCard">, addSurcharge: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addSurcharge">, removeSurcharge: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeSurcharge">, addDiscount: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addDiscount">, removeDiscount: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeDiscount">, addTax: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addTax">, removeTax: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/removeTax">, addTip: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addTip">, removeTip: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/removeTip">, setTaxExempt: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setTaxExempt">, addCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/addCustomer">, removeCustomer: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"checkout/removeCustomer">, setPendingDiscounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setPendingDiscounts">, setPoints: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setPoints">, setMadeFor: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setMadeFor">, setPhone: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "checkout/setPhone">;
140
145
  export declare const selectPosCheckout: (state: AppState) => CheckoutState;
141
146
  export declare const selectPosCheck: (state: AppState) => Order | null;
142
- export declare const selectPosCustomer: (state: AppState) => CustomerCheckout | null;
147
+ export declare const selectPosCustomer: (state: AppState) => CustomerIdentify | null;
143
148
  export declare const selectPosCustomerName: (state: AppState) => string | null;
144
149
  export declare const selectPosCustomerNameShort: (state: AppState) => string | null;
145
150
  export declare const selectPosPendingDiscounts: (state: AppState) => boolean;
@@ -0,0 +1,24 @@
1
+ import { AppState } from '../app';
2
+ import { CustomerIdentifier, CustomerIdentify, RequestError, RequestStatus } from '@open-tender/types';
3
+ export interface CustomerIdentifyState {
4
+ data: CustomerIdentify | null;
5
+ loading: RequestStatus;
6
+ error: RequestError;
7
+ }
8
+ export declare enum CustomerIdentifyActionType {
9
+ FetchCustomerIdentify = "CustomerIdentify/fetchCustomerIdentify"
10
+ }
11
+ export declare const fetchCustomerIdentify: import("@reduxjs/toolkit").AsyncThunk<CustomerIdentify, CustomerIdentifier, {
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 resetCustomerIdentify: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customerIdentify/resetCustomerIdentify">;
22
+ export declare const selectCustomerIdentify: (state: AppState) => CustomerIdentifyState;
23
+ export declare const selectCustomerIdentified: (state: AppState) => CustomerIdentify | null;
24
+ export declare const CustomerIdentifyReducer: import("redux").Reducer<CustomerIdentifyState>;
@@ -0,0 +1,61 @@
1
+ import { __awaiter, __generator } from "tslib";
2
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
+ import { ReducerType } from './types';
4
+ var initialState = {
5
+ data: null,
6
+ loading: 'idle',
7
+ error: null
8
+ };
9
+ export var CustomerIdentifyActionType;
10
+ (function (CustomerIdentifyActionType) {
11
+ CustomerIdentifyActionType["FetchCustomerIdentify"] = "CustomerIdentify/fetchCustomerIdentify";
12
+ })(CustomerIdentifyActionType || (CustomerIdentifyActionType = {}));
13
+ export var fetchCustomerIdentify = createAsyncThunk(CustomerIdentifyActionType.FetchCustomerIdentify, function (data, _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.postIdentifyCustomer(data)];
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 customerIdentifySlice = createSlice({
33
+ name: ReducerType.CustomerIdentify,
34
+ initialState: initialState,
35
+ reducers: {
36
+ resetCustomerIdentify: function () { return initialState; }
37
+ },
38
+ extraReducers: function (builder) {
39
+ builder
40
+ .addCase(fetchCustomerIdentify.fulfilled, function (state, action) {
41
+ state.data = action.payload;
42
+ state.loading = 'idle';
43
+ state.error = null;
44
+ })
45
+ .addCase(fetchCustomerIdentify.pending, function (state) {
46
+ state.loading = 'pending';
47
+ })
48
+ .addCase(fetchCustomerIdentify.rejected, function (state, action) {
49
+ state.error = action.payload;
50
+ state.loading = 'idle';
51
+ });
52
+ }
53
+ });
54
+ export var resetCustomerIdentify = customerIdentifySlice.actions.resetCustomerIdentify;
55
+ export var selectCustomerIdentify = function (state) {
56
+ return state.customerIdentify;
57
+ };
58
+ export var selectCustomerIdentified = function (state) {
59
+ return state.customerIdentify.data;
60
+ };
61
+ export var CustomerIdentifyReducer = customerIdentifySlice.reducer;
@@ -3,6 +3,7 @@ export * from './arrivals';
3
3
  export * from './cartSummary';
4
4
  export * from './checkout';
5
5
  export * from './config';
6
+ export * from './customerIdentify';
6
7
  export * from './discounts';
7
8
  export * from './errorAlerts';
8
9
  export * from './kds';
@@ -3,6 +3,7 @@ export * from './arrivals';
3
3
  export * from './cartSummary';
4
4
  export * from './checkout';
5
5
  export * from './config';
6
+ export * from './customerIdentify';
6
7
  export * from './discounts';
7
8
  export * from './errorAlerts';
8
9
  export * from './kds';
@@ -47,6 +47,7 @@ export declare const selectKioskConfig: ((state: {
47
47
  cartSummary: import("./cartSummary").CartSummaryState;
48
48
  checkout: import("./checkout").CheckoutState;
49
49
  config: import("./config").ConfigState;
50
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
50
51
  discounts: import("./discounts").DiscountsState;
51
52
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
52
53
  kds: import("./kds").KdsState;
@@ -91,6 +92,7 @@ export declare const selectKioskConfigScreen: (screen: string) => ((state: {
91
92
  cartSummary: import("./cartSummary").CartSummaryState;
92
93
  checkout: import("./checkout").CheckoutState;
93
94
  config: import("./config").ConfigState;
95
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
94
96
  discounts: import("./discounts").DiscountsState;
95
97
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
96
98
  kds: import("./kds").KdsState;
@@ -26,6 +26,7 @@ export declare const selectMenuPagesFiltered: ((state: {
26
26
  cartSummary: import("./cartSummary").CartSummaryState;
27
27
  checkout: import("./checkout").CheckoutState;
28
28
  config: import("./config").ConfigState;
29
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
29
30
  discounts: import("./discounts").DiscountsState;
30
31
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
31
32
  kds: import("./kds").KdsState;
@@ -47,6 +47,7 @@ export declare const selectCartIds: ((state: {
47
47
  cartSummary: import("./cartSummary").CartSummaryState;
48
48
  checkout: import("./checkout").CheckoutState;
49
49
  config: import("./config").ConfigState;
50
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
50
51
  discounts: import("./discounts").DiscountsState;
51
52
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
52
53
  kds: import("./kds").KdsState;
@@ -91,6 +92,7 @@ export declare const selectCartQuantity: ((state: {
91
92
  cartSummary: import("./cartSummary").CartSummaryState;
92
93
  checkout: import("./checkout").CheckoutState;
93
94
  config: import("./config").ConfigState;
95
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
94
96
  discounts: import("./discounts").DiscountsState;
95
97
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
96
98
  kds: import("./kds").KdsState;
@@ -135,6 +137,7 @@ export declare const selectCartTotal: ((state: {
135
137
  cartSummary: import("./cartSummary").CartSummaryState;
136
138
  checkout: import("./checkout").CheckoutState;
137
139
  config: import("./config").ConfigState;
140
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
138
141
  discounts: import("./discounts").DiscountsState;
139
142
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
140
143
  kds: import("./kds").KdsState;
@@ -179,6 +182,7 @@ export declare const selectCartTotals: ((state: {
179
182
  cartSummary: import("./cartSummary").CartSummaryState;
180
183
  checkout: import("./checkout").CheckoutState;
181
184
  config: import("./config").ConfigState;
185
+ customerIdentify: import("./customerIdentify").CustomerIdentifyState;
182
186
  discounts: import("./discounts").DiscountsState;
183
187
  errorAlerts: import("./errorAlerts").ErrorAlertsState;
184
188
  kds: import("./kds").KdsState;
@@ -5,6 +5,7 @@ export declare enum ReducerType {
5
5
  Checkout = "checkout",
6
6
  CompletedOrders = "completedOrders",
7
7
  Config = "config",
8
+ CustomerIdentify = "customerIdentify",
8
9
  Discounts = "discounts",
9
10
  ErrorAlerts = "errorAlerts",
10
11
  Kds = "kds",
@@ -6,6 +6,7 @@ export var ReducerType;
6
6
  ReducerType["Checkout"] = "checkout";
7
7
  ReducerType["CompletedOrders"] = "completedOrders";
8
8
  ReducerType["Config"] = "config";
9
+ ReducerType["CustomerIdentify"] = "customerIdentify";
9
10
  ReducerType["Discounts"] = "discounts";
10
11
  ReducerType["ErrorAlerts"] = "errorAlerts";
11
12
  ReducerType["Kds"] = "kds";
@@ -1,44 +1,5 @@
1
- import { DiscountType, ISOString, Money, OrderType, ServiceType, TenderType } from '@open-tender/types';
1
+ import { ISOString, Money, OrderType, ServiceType, TenderType } from '@open-tender/types';
2
2
  import { Address, Customer } from './customer';
3
- export interface CustomerIdentifier {
4
- card_token?: string;
5
- phone?: string;
6
- qr_code?: string;
7
- }
8
- export interface IdentifyCustomer {
9
- data: CustomerIdentifier;
10
- callback?: () => void;
11
- showError?: boolean;
12
- }
13
- export interface CustomerDiscount {
14
- customer_loyalty_id: number;
15
- loyalty_program_id: number;
16
- order_type: OrderType;
17
- amount: Money;
18
- name: string;
19
- discount_id: number;
20
- discount_type: DiscountType;
21
- description: string;
22
- before_surcharge: boolean;
23
- is_taxed: boolean;
24
- is_promo_code: boolean;
25
- is_auto: boolean;
26
- is_loyalty: boolean;
27
- }
28
- export type CustomerDiscounts = Array<CustomerDiscount>;
29
- export interface CustomerCheckoutCustomer {
30
- customer_id: number;
31
- email: string;
32
- first_name: string;
33
- last_name: string;
34
- phone: string;
35
- }
36
- export interface CustomerCheckout {
37
- customer: CustomerCheckoutCustomer;
38
- discounts: CustomerDiscounts;
39
- points: any;
40
- discount: any;
41
- }
42
3
  export interface SimpleCartOption {
43
4
  id: number;
44
5
  quantity: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
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.21",
61
+ "@open-tender/types": "^0.4.23",
62
62
  "@open-tender/ui": "^0.1.21",
63
- "@open-tender/utils": "^0.4.6",
63
+ "@open-tender/utils": "^0.4.9",
64
64
  "@reduxjs/toolkit": "^2.0.1",
65
65
  "date-fns": "2.30.0",
66
66
  "date-fns-tz": "^2.0.0",