@open-tender/cloud 0.1.63 → 0.1.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app/hooks.d.ts +2 -0
- package/dist/cjs/app/store.d.ts +6 -0
- package/dist/cjs/app/store.js +2 -1
- package/dist/cjs/services/api.d.ts +3 -1
- package/dist/cjs/services/api.js +6 -0
- package/dist/cjs/slices/allergens.d.ts +2 -0
- package/dist/cjs/slices/config.d.ts +2 -0
- package/dist/cjs/slices/customer/account.d.ts +5 -3
- package/dist/cjs/slices/customer/account.js +31 -6
- package/dist/cjs/slices/customer/index.d.ts +1 -0
- package/dist/cjs/slices/customer/index.js +3 -1
- package/dist/cjs/slices/customer/order.d.ts +2 -0
- package/dist/cjs/slices/customer/tpls.d.ts +23 -0
- package/dist/cjs/slices/customer/tpls.js +57 -0
- package/dist/cjs/slices/index.d.ts +1 -0
- package/dist/cjs/slices/index.js +1 -0
- package/dist/cjs/slices/oneTimePasscode.d.ts +26 -0
- package/dist/cjs/slices/oneTimePasscode.js +65 -0
- package/dist/cjs/slices/order.d.ts +6 -0
- package/dist/cjs/slices/tags.d.ts +2 -0
- package/dist/cjs/slices/types.d.ts +2 -0
- package/dist/cjs/slices/types.js +2 -0
- package/dist/esm/app/hooks.d.ts +2 -0
- package/dist/esm/app/store.d.ts +6 -0
- package/dist/esm/app/store.js +3 -2
- package/dist/esm/services/api.d.ts +3 -1
- package/dist/esm/services/api.js +6 -0
- package/dist/esm/slices/allergens.d.ts +2 -0
- package/dist/esm/slices/config.d.ts +2 -0
- package/dist/esm/slices/customer/account.d.ts +5 -3
- package/dist/esm/slices/customer/account.js +31 -6
- package/dist/esm/slices/customer/index.d.ts +1 -0
- package/dist/esm/slices/customer/index.js +3 -1
- package/dist/esm/slices/customer/order.d.ts +2 -0
- package/dist/esm/slices/customer/tpls.d.ts +23 -0
- package/dist/esm/slices/customer/tpls.js +53 -0
- package/dist/esm/slices/index.d.ts +1 -0
- package/dist/esm/slices/index.js +1 -0
- package/dist/esm/slices/oneTimePasscode.d.ts +26 -0
- package/dist/esm/slices/oneTimePasscode.js +60 -0
- package/dist/esm/slices/order.d.ts +6 -0
- package/dist/esm/slices/tags.d.ts +2 -0
- package/dist/esm/slices/types.d.ts +2 -0
- package/dist/esm/slices/types.js +2 -0
- package/package.json +3 -3
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
22
22
|
rewards: import("..").CustomerRewardsState;
|
|
23
23
|
qrcode: import("..").CustomerQRCodeState;
|
|
24
24
|
thanx: import("..").CustomerThanxState;
|
|
25
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
25
26
|
}>;
|
|
26
27
|
signUp: import("..").SignUpState;
|
|
27
28
|
revenueCenters: import("..").RevenueCentersState;
|
|
@@ -54,5 +55,6 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
54
55
|
sidebarModal: import("..").SidebarModalState;
|
|
55
56
|
sidebar: import("..").SidebarState;
|
|
56
57
|
tags: import("..").TagsState;
|
|
58
|
+
oneTimePasscode: import("..").OneTimePasscodeState;
|
|
57
59
|
}>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
|
|
58
60
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
21
21
|
rewards: import("../slices").CustomerRewardsState;
|
|
22
22
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
23
23
|
thanx: import("../slices").CustomerThanxState;
|
|
24
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
24
25
|
}>;
|
|
25
26
|
signUp: import("../slices").SignUpState;
|
|
26
27
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -53,6 +54,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
53
54
|
sidebarModal: import("../slices").SidebarModalState;
|
|
54
55
|
sidebar: import("../slices").SidebarState;
|
|
55
56
|
tags: import("../slices").TagsState;
|
|
57
|
+
oneTimePasscode: import("../slices").OneTimePasscodeState;
|
|
56
58
|
}>, import("redux").AnyAction>;
|
|
57
59
|
export type AppState = ReturnType<typeof appReducer>;
|
|
58
60
|
declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("redux").EmptyObject & {
|
|
@@ -77,6 +79,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
77
79
|
rewards: import("../slices").CustomerRewardsState;
|
|
78
80
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
79
81
|
thanx: import("../slices").CustomerThanxState;
|
|
82
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
80
83
|
}>;
|
|
81
84
|
signUp: import("../slices").SignUpState;
|
|
82
85
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -109,6 +112,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
109
112
|
sidebarModal: import("../slices").SidebarModalState;
|
|
110
113
|
sidebar: import("../slices").SidebarState;
|
|
111
114
|
tags: import("../slices").TagsState;
|
|
115
|
+
oneTimePasscode: import("../slices").OneTimePasscodeState;
|
|
112
116
|
}, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
|
|
113
117
|
alerts: import("@open-tender/types").Alerts;
|
|
114
118
|
notifications: import("@open-tender/types").Notifications;
|
|
@@ -131,6 +135,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
131
135
|
rewards: import("../slices").CustomerRewardsState;
|
|
132
136
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
133
137
|
thanx: import("../slices").CustomerThanxState;
|
|
138
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
134
139
|
}>;
|
|
135
140
|
signUp: import("../slices").SignUpState;
|
|
136
141
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -163,6 +168,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
163
168
|
sidebarModal: import("../slices").SidebarModalState;
|
|
164
169
|
sidebar: import("../slices").SidebarState;
|
|
165
170
|
tags: import("../slices").TagsState;
|
|
171
|
+
oneTimePasscode: import("../slices").OneTimePasscodeState;
|
|
166
172
|
}>, import("redux").AnyAction, undefined>]>>;
|
|
167
173
|
export type AppDispatch = typeof store.dispatch;
|
|
168
174
|
export type RootState = ReturnType<typeof store.getState>;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -40,7 +40,8 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
40
40
|
[types_1.ReducerType.Posts]: slices_1.postsReducer,
|
|
41
41
|
[types_1.ReducerType.SidebarModal]: slices_1.sidebarModalReducer,
|
|
42
42
|
[types_1.ReducerType.Sidebar]: slices_1.sidebarReducer,
|
|
43
|
-
[types_1.ReducerType.Tags]: slices_1.tagsReducer
|
|
43
|
+
[types_1.ReducerType.Tags]: slices_1.tagsReducer,
|
|
44
|
+
[types_1.ReducerType.OneTimePasscode]: slices_1.oneTimePasscodeReducer
|
|
44
45
|
});
|
|
45
46
|
const rootReducer = (state, action) => {
|
|
46
47
|
if (action.type === 'clearState') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
|
|
1
|
+
import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OneTimePasscode, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
|
|
2
2
|
declare class OpenTenderAPI {
|
|
3
3
|
brandId?: string;
|
|
4
4
|
clientId?: string;
|
|
@@ -102,6 +102,7 @@ declare class OpenTenderAPI {
|
|
|
102
102
|
getSubscriber(email: string): Promise<unknown>;
|
|
103
103
|
postSubscriber(email: string): Promise<unknown>;
|
|
104
104
|
postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
|
|
105
|
+
postOneTimePasscode(data: OneTimePasscode): Promise<void | Auth | null | undefined>;
|
|
105
106
|
postThanxLogin(email: string, origin?: string): Promise<unknown>;
|
|
106
107
|
postThanxAuth(code: string, path: string, origin?: string): Promise<unknown>;
|
|
107
108
|
postLogin(email: string, password: string): Promise<unknown>;
|
|
@@ -152,6 +153,7 @@ declare class OpenTenderAPI {
|
|
|
152
153
|
getCustomerLoyalty(token: string): Promise<unknown>;
|
|
153
154
|
getCustomerThanx(token: string): Promise<unknown>;
|
|
154
155
|
getThanxCardSignature(token: string, acct: string): Promise<unknown>;
|
|
156
|
+
getCustomerTpls(token: string): Promise<unknown>;
|
|
155
157
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
156
158
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
157
159
|
}
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -498,6 +498,9 @@ class OpenTenderAPI {
|
|
|
498
498
|
postSignUp(data) {
|
|
499
499
|
return this.request(`/customer`, 'POST', data);
|
|
500
500
|
}
|
|
501
|
+
postOneTimePasscode(data) {
|
|
502
|
+
return this.request(`/customer/sign-in`, 'POST', data);
|
|
503
|
+
}
|
|
501
504
|
postThanxLogin(email, origin) {
|
|
502
505
|
const data = origin ? { email, origin } : { email };
|
|
503
506
|
return this.request('/thanx-login', 'POST', data);
|
|
@@ -672,6 +675,9 @@ class OpenTenderAPI {
|
|
|
672
675
|
getThanxCardSignature(token, acct) {
|
|
673
676
|
return this.request(`/customer/thanx-card-signature?acct=${acct}`, 'GET', null, null, token);
|
|
674
677
|
}
|
|
678
|
+
getCustomerTpls(token) {
|
|
679
|
+
return this.request(`/customer/tpls`, 'GET', null, null, token);
|
|
680
|
+
}
|
|
675
681
|
getCustomerHouseAccounts(token) {
|
|
676
682
|
return this.request(`/customer/house-accounts`, 'GET', null, null, token);
|
|
677
683
|
}
|
|
@@ -49,6 +49,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
49
49
|
rewards: import("./customer").CustomerRewardsState;
|
|
50
50
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
51
51
|
thanx: import("./customer").CustomerThanxState;
|
|
52
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
52
53
|
}>;
|
|
53
54
|
signUp: import("./signUp").SignUpState;
|
|
54
55
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -81,6 +82,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
81
82
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
82
83
|
sidebar: import("./sidebar").SidebarState;
|
|
83
84
|
tags: import("./tags").TagsState;
|
|
85
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
84
86
|
}) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
|
|
85
87
|
allergens: Allergens;
|
|
86
88
|
selectedAllergens: Allergens | null;
|
|
@@ -105,6 +105,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
105
105
|
rewards: import("./customer").CustomerRewardsState;
|
|
106
106
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
107
107
|
thanx: import("./customer").CustomerThanxState;
|
|
108
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
108
109
|
}>;
|
|
109
110
|
signUp: import("./signUp").SignUpState;
|
|
110
111
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -137,6 +138,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
137
138
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
138
139
|
sidebar: import("./sidebar").SidebarState;
|
|
139
140
|
tags: import("./tags").TagsState;
|
|
141
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
140
142
|
}) => {
|
|
141
143
|
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | null | undefined;
|
|
142
144
|
order_notifications: import("@open-tender/types").ConfigOrderNotifications | null | undefined;
|
|
@@ -14,7 +14,9 @@ export declare enum AccountActionType {
|
|
|
14
14
|
UpdateCustomer = "customer/updateCustomer",
|
|
15
15
|
VerifyCustomer = "customer/verifyCustomer",
|
|
16
16
|
LinkPosToken = "customer/linkPosToken",
|
|
17
|
-
DeleteCustomer = "customer/deleteCustomer"
|
|
17
|
+
DeleteCustomer = "customer/deleteCustomer",
|
|
18
|
+
LoginCustomerThanx = "customer/loginCustomerThanx",
|
|
19
|
+
AuthCustomerThanx = "customer/authCustomerThanx"
|
|
18
20
|
}
|
|
19
21
|
export declare const checkAuth: (err: RequestError, dispatch: ThunkDispatch<AppState, unknown, AnyAction>, rejectWithValue: () => any) => Promise<any>;
|
|
20
22
|
export declare const fetchCustomer: import("@reduxjs/toolkit").AsyncThunk<Customer, void, {
|
|
@@ -80,7 +82,7 @@ export declare const sendCustomerVerificationEmail: import("@reduxjs/toolkit").A
|
|
|
80
82
|
fulfilledMeta?: unknown;
|
|
81
83
|
rejectedMeta?: unknown;
|
|
82
84
|
}>;
|
|
83
|
-
export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<
|
|
85
|
+
export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
84
86
|
email: string;
|
|
85
87
|
origin?: string | undefined;
|
|
86
88
|
}, {
|
|
@@ -93,7 +95,7 @@ export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<n
|
|
|
93
95
|
fulfilledMeta?: unknown;
|
|
94
96
|
rejectedMeta?: unknown;
|
|
95
97
|
}>;
|
|
96
|
-
export declare const authCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<
|
|
98
|
+
export declare const authCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
97
99
|
code: any;
|
|
98
100
|
path: string | null;
|
|
99
101
|
origin: string | null;
|
|
@@ -39,6 +39,8 @@ var AccountActionType;
|
|
|
39
39
|
AccountActionType["VerifyCustomer"] = "customer/verifyCustomer";
|
|
40
40
|
AccountActionType["LinkPosToken"] = "customer/linkPosToken";
|
|
41
41
|
AccountActionType["DeleteCustomer"] = "customer/deleteCustomer";
|
|
42
|
+
AccountActionType["LoginCustomerThanx"] = "customer/loginCustomerThanx";
|
|
43
|
+
AccountActionType["AuthCustomerThanx"] = "customer/authCustomerThanx";
|
|
42
44
|
})(AccountActionType = exports.AccountActionType || (exports.AccountActionType = {}));
|
|
43
45
|
const checkAuth = (err, dispatch, rejectWithValue) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
44
46
|
if ((err === null || err === void 0 ? void 0 : err.status) === 401) {
|
|
@@ -171,13 +173,13 @@ exports.sendCustomerVerificationEmail = (0, toolkit_1.createAsyncThunk)(AccountA
|
|
|
171
173
|
return rejectWithValue(err);
|
|
172
174
|
}
|
|
173
175
|
}));
|
|
174
|
-
exports.loginCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.
|
|
176
|
+
exports.loginCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.LoginCustomerThanx, ({ email, origin }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
175
177
|
try {
|
|
176
178
|
const api = getState().config.api;
|
|
177
179
|
yield api.postThanxLogin(email, origin);
|
|
178
180
|
dispatch((0, order_2.setAlert)({ type: 'close' }));
|
|
179
181
|
dispatch((0, order_2.addMessage)('Thanks! Please check your email on this device.'));
|
|
180
|
-
return
|
|
182
|
+
return;
|
|
181
183
|
}
|
|
182
184
|
catch (err) {
|
|
183
185
|
const errr = err;
|
|
@@ -190,12 +192,13 @@ exports.loginCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.L
|
|
|
190
192
|
return rejectWithValue(errr);
|
|
191
193
|
}
|
|
192
194
|
}));
|
|
193
|
-
exports.authCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.
|
|
195
|
+
exports.authCustomerThanx = (0, toolkit_1.createAsyncThunk)(AccountActionType.AuthCustomerThanx, (data, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
194
196
|
try {
|
|
195
197
|
const api = getState().config.api;
|
|
196
198
|
const auth = yield api.postThanxAuth(data.code, data.path, data.origin);
|
|
197
|
-
dispatch((0, exports.
|
|
198
|
-
|
|
199
|
+
dispatch((0, exports.setCustomerAuth)(auth));
|
|
200
|
+
yield dispatch((0, exports.fetchCustomer)());
|
|
201
|
+
return;
|
|
199
202
|
}
|
|
200
203
|
catch (err) {
|
|
201
204
|
return rejectWithValue(err);
|
|
@@ -313,7 +316,29 @@ const accountSlice = (0, toolkit_1.createSlice)({
|
|
|
313
316
|
.addCase(exports.deleteCustomer.pending, state => {
|
|
314
317
|
state.loading = 'pending';
|
|
315
318
|
})
|
|
316
|
-
.addCase(exports.deleteCustomer.rejected, () => initialState)
|
|
319
|
+
.addCase(exports.deleteCustomer.rejected, () => initialState)
|
|
320
|
+
.addCase(exports.loginCustomerThanx.fulfilled, state => {
|
|
321
|
+
state.loading = 'idle';
|
|
322
|
+
state.error = null;
|
|
323
|
+
})
|
|
324
|
+
.addCase(exports.loginCustomerThanx.pending, state => {
|
|
325
|
+
state.loading = 'pending';
|
|
326
|
+
})
|
|
327
|
+
.addCase(exports.loginCustomerThanx.rejected, (state, action) => {
|
|
328
|
+
state.loading = 'idle';
|
|
329
|
+
state.error = action.payload;
|
|
330
|
+
})
|
|
331
|
+
.addCase(exports.authCustomerThanx.fulfilled, state => {
|
|
332
|
+
state.loading = 'idle';
|
|
333
|
+
state.error = null;
|
|
334
|
+
})
|
|
335
|
+
.addCase(exports.authCustomerThanx.pending, state => {
|
|
336
|
+
state.loading = 'pending';
|
|
337
|
+
})
|
|
338
|
+
.addCase(exports.authCustomerThanx.rejected, (state, action) => {
|
|
339
|
+
state.loading = 'idle';
|
|
340
|
+
state.error = action.payload;
|
|
341
|
+
});
|
|
317
342
|
}
|
|
318
343
|
});
|
|
319
344
|
_a = accountSlice.actions, exports.resetCustomer = _a.resetCustomer, exports.resetLoginError = _a.resetLoginError, exports.setCustomerAuth = _a.setCustomerAuth;
|
|
@@ -15,6 +15,7 @@ export declare const customerReducer: import("redux").Reducer<import("redux").Co
|
|
|
15
15
|
rewards: import("./rewards").CustomerRewardsState;
|
|
16
16
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
17
17
|
thanx: import("./thanx").CustomerThanxState;
|
|
18
|
+
tpls: import("./tpls").CustomerTplsState;
|
|
18
19
|
}>, import("redux").AnyAction>;
|
|
19
20
|
export * from './account';
|
|
20
21
|
export * from './allergens';
|
|
@@ -20,6 +20,7 @@ const orders_1 = require("./orders");
|
|
|
20
20
|
const qrCode_1 = require("./qrCode");
|
|
21
21
|
const rewards_1 = require("./rewards");
|
|
22
22
|
const thanx_1 = require("./thanx");
|
|
23
|
+
const tpls_1 = require("./tpls");
|
|
23
24
|
exports.customerReducer = (0, redux_1.combineReducers)({
|
|
24
25
|
[types_1.ReducerType.Account]: account_1.accountReducer,
|
|
25
26
|
[types_1.ReducerType.CustomerAllergens]: allergens_1.customerAllergensReducer,
|
|
@@ -36,7 +37,8 @@ exports.customerReducer = (0, redux_1.combineReducers)({
|
|
|
36
37
|
[types_1.ReducerType.HouseAccounts]: houseAccounts_1.customerHouseAccountsReducer,
|
|
37
38
|
[types_1.ReducerType.Rewards]: rewards_1.customerRewardsReducer,
|
|
38
39
|
[types_1.ReducerType.QRCode]: qrCode_1.customerQRCodeReducer,
|
|
39
|
-
[types_1.ReducerType.Thanx]: thanx_1.customerThanxReducer
|
|
40
|
+
[types_1.ReducerType.Thanx]: thanx_1.customerThanxReducer,
|
|
41
|
+
[types_1.ReducerType.Tpls]: tpls_1.customerTplsReducer
|
|
40
42
|
});
|
|
41
43
|
tslib_1.__exportStar(require("./account"), exports);
|
|
42
44
|
tslib_1.__exportStar(require("./allergens"), exports);
|
|
@@ -55,6 +55,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
55
55
|
rewards: import("./rewards").CustomerRewardsState;
|
|
56
56
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
57
57
|
thanx: import("./thanx").CustomerThanxState;
|
|
58
|
+
tpls: import("./tpls").CustomerTplsState;
|
|
58
59
|
}>;
|
|
59
60
|
signUp: import("..").SignUpState;
|
|
60
61
|
revenueCenters: import("..").RevenueCentersState;
|
|
@@ -87,6 +88,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
87
88
|
sidebarModal: import("..").SidebarModalState;
|
|
88
89
|
sidebar: import("..").SidebarState;
|
|
89
90
|
tags: import("..").TagsState;
|
|
91
|
+
oneTimePasscode: import("..").OneTimePasscodeState;
|
|
90
92
|
}) => {
|
|
91
93
|
order: Order | null;
|
|
92
94
|
loading: RequestStatus;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerTplsState {
|
|
4
|
+
tpls: any | null;
|
|
5
|
+
error: any;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
}
|
|
8
|
+
export declare enum CustomerTplsActionType {
|
|
9
|
+
FetchCustomerTpls = "customer/fetchCustomerTpls"
|
|
10
|
+
}
|
|
11
|
+
export declare const fetchCustomerTpls: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
12
|
+
state: AppState;
|
|
13
|
+
rejectValue: RequestError;
|
|
14
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
15
|
+
extra?: unknown;
|
|
16
|
+
serializedErrorType?: unknown;
|
|
17
|
+
pendingMeta?: unknown;
|
|
18
|
+
fulfilledMeta?: unknown;
|
|
19
|
+
rejectedMeta?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const resetCustomerTpls: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tpls/resetCustomerTpls">;
|
|
22
|
+
export declare const selectCustomerTpls: (state: AppState) => CustomerTplsState;
|
|
23
|
+
export declare const customerTplsReducer: import("redux").Reducer<CustomerTplsState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customerTplsReducer = exports.selectCustomerTpls = exports.resetCustomerTpls = exports.fetchCustomerTpls = exports.CustomerTplsActionType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const types_2 = require("@open-tender/types");
|
|
8
|
+
const account_1 = require("./account");
|
|
9
|
+
const initialState = {
|
|
10
|
+
tpls: null,
|
|
11
|
+
error: null,
|
|
12
|
+
loading: 'idle'
|
|
13
|
+
};
|
|
14
|
+
var CustomerTplsActionType;
|
|
15
|
+
(function (CustomerTplsActionType) {
|
|
16
|
+
CustomerTplsActionType["FetchCustomerTpls"] = "customer/fetchCustomerTpls";
|
|
17
|
+
})(CustomerTplsActionType = exports.CustomerTplsActionType || (exports.CustomerTplsActionType = {}));
|
|
18
|
+
exports.fetchCustomerTpls = (0, toolkit_1.createAsyncThunk)(CustomerTplsActionType.FetchCustomerTpls, (_, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
try {
|
|
20
|
+
const api = getState().config.api;
|
|
21
|
+
const token = (0, account_1.selectToken)(getState());
|
|
22
|
+
if (!token)
|
|
23
|
+
throw new Error(types_2.MISSING_CUSTOMER);
|
|
24
|
+
const resp = yield api.getCustomerTpls(token);
|
|
25
|
+
return resp;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
const error = err;
|
|
29
|
+
return (0, account_1.checkAuth)(error, dispatch, () => rejectWithValue(error));
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
const customerTplsSlice = (0, toolkit_1.createSlice)({
|
|
33
|
+
name: types_1.ReducerType.Tpls,
|
|
34
|
+
initialState,
|
|
35
|
+
reducers: {
|
|
36
|
+
resetCustomerTpls: () => initialState
|
|
37
|
+
},
|
|
38
|
+
extraReducers: builder => {
|
|
39
|
+
builder
|
|
40
|
+
.addCase(exports.fetchCustomerTpls.fulfilled, (state, action) => {
|
|
41
|
+
state.tpls = action.payload;
|
|
42
|
+
state.loading = 'idle';
|
|
43
|
+
state.error = null;
|
|
44
|
+
})
|
|
45
|
+
.addCase(exports.fetchCustomerTpls.pending, state => {
|
|
46
|
+
state.loading = 'pending';
|
|
47
|
+
})
|
|
48
|
+
.addCase(exports.fetchCustomerTpls.rejected, (state, action) => {
|
|
49
|
+
state.error = action.payload;
|
|
50
|
+
state.loading = 'idle';
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
exports.resetCustomerTpls = customerTplsSlice.actions.resetCustomerTpls;
|
|
55
|
+
const selectCustomerTpls = (state) => state.customer.tpls;
|
|
56
|
+
exports.selectCustomerTpls = selectCustomerTpls;
|
|
57
|
+
exports.customerTplsReducer = customerTplsSlice.reducer;
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -24,6 +24,7 @@ tslib_1.__exportStar(require("./modal"), exports);
|
|
|
24
24
|
tslib_1.__exportStar(require("./nav"), exports);
|
|
25
25
|
tslib_1.__exportStar(require("./navSite"), exports);
|
|
26
26
|
tslib_1.__exportStar(require("./notifications"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./oneTimePasscode"), exports);
|
|
27
28
|
tslib_1.__exportStar(require("./order"), exports);
|
|
28
29
|
tslib_1.__exportStar(require("./orderFulfillment"), exports);
|
|
29
30
|
tslib_1.__exportStar(require("./orderRating"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
import { OneTimePasscode, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface OneTimePasscodeState {
|
|
4
|
+
otpSent: boolean;
|
|
5
|
+
loading: RequestStatus;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
}
|
|
8
|
+
export declare enum OneTimePasscodeActionType {
|
|
9
|
+
OneTimePasscodeCustomer = "oneTimePasscode/oneTimePasscodeCustomer"
|
|
10
|
+
}
|
|
11
|
+
export declare const sendOneTimePasscode: import("@reduxjs/toolkit").AsyncThunk<boolean, {
|
|
12
|
+
data: OneTimePasscode;
|
|
13
|
+
callback?: (() => void) | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
state: AppState;
|
|
16
|
+
rejectValue: RequestError;
|
|
17
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
18
|
+
extra?: unknown;
|
|
19
|
+
serializedErrorType?: unknown;
|
|
20
|
+
pendingMeta?: unknown;
|
|
21
|
+
fulfilledMeta?: unknown;
|
|
22
|
+
rejectedMeta?: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const resetOneTimePasscode: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"oneTimePasscode/resetOneTimePasscode">, toggleOtpSent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "oneTimePasscode/toggleOtpSent">;
|
|
25
|
+
export declare const selectOneTimePasscode: (state: AppState) => OneTimePasscodeState;
|
|
26
|
+
export declare const oneTimePasscodeReducer: import("redux").Reducer<OneTimePasscodeState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.oneTimePasscodeReducer = exports.selectOneTimePasscode = exports.toggleOtpSent = exports.resetOneTimePasscode = exports.sendOneTimePasscode = exports.OneTimePasscodeActionType = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
const customer_1 = require("./customer");
|
|
9
|
+
const initialState = {
|
|
10
|
+
otpSent: false,
|
|
11
|
+
loading: 'idle',
|
|
12
|
+
error: null
|
|
13
|
+
};
|
|
14
|
+
var OneTimePasscodeActionType;
|
|
15
|
+
(function (OneTimePasscodeActionType) {
|
|
16
|
+
OneTimePasscodeActionType["OneTimePasscodeCustomer"] = "oneTimePasscode/oneTimePasscodeCustomer";
|
|
17
|
+
})(OneTimePasscodeActionType = exports.OneTimePasscodeActionType || (exports.OneTimePasscodeActionType = {}));
|
|
18
|
+
exports.sendOneTimePasscode = (0, toolkit_1.createAsyncThunk)(OneTimePasscodeActionType.OneTimePasscodeCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
try {
|
|
20
|
+
const api = getState().config.api;
|
|
21
|
+
const response = yield api.postOneTimePasscode(data);
|
|
22
|
+
if (data.one_time_passcode) {
|
|
23
|
+
dispatch((0, customer_1.setCustomerAuth)(response));
|
|
24
|
+
yield dispatch((0, customer_1.fetchCustomer)());
|
|
25
|
+
if (callback)
|
|
26
|
+
callback();
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
return rejectWithValue(err);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
const oneTimePasscodeSlice = (0, toolkit_1.createSlice)({
|
|
38
|
+
name: types_1.ReducerType.OneTimePasscode,
|
|
39
|
+
initialState,
|
|
40
|
+
reducers: {
|
|
41
|
+
resetOneTimePasscode: () => initialState,
|
|
42
|
+
toggleOtpSent: (state, action) => {
|
|
43
|
+
state.otpSent = action.payload;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
extraReducers: builder => {
|
|
47
|
+
builder
|
|
48
|
+
.addCase(exports.sendOneTimePasscode.fulfilled, (state, action) => {
|
|
49
|
+
state.otpSent = action.payload;
|
|
50
|
+
state.loading = 'idle';
|
|
51
|
+
state.error = null;
|
|
52
|
+
})
|
|
53
|
+
.addCase(exports.sendOneTimePasscode.pending, state => {
|
|
54
|
+
state.loading = 'pending';
|
|
55
|
+
})
|
|
56
|
+
.addCase(exports.sendOneTimePasscode.rejected, (state, action) => {
|
|
57
|
+
state.loading = 'idle';
|
|
58
|
+
state.error = action.payload;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
_a = oneTimePasscodeSlice.actions, exports.resetOneTimePasscode = _a.resetOneTimePasscode, exports.toggleOtpSent = _a.toggleOtpSent;
|
|
63
|
+
const selectOneTimePasscode = (state) => state.oneTimePasscode;
|
|
64
|
+
exports.selectOneTimePasscode = selectOneTimePasscode;
|
|
65
|
+
exports.oneTimePasscodeReducer = oneTimePasscodeSlice.reducer;
|
|
@@ -140,6 +140,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
140
140
|
rewards: import("./customer").CustomerRewardsState;
|
|
141
141
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
142
142
|
thanx: import("./customer").CustomerThanxState;
|
|
143
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
143
144
|
}>;
|
|
144
145
|
signUp: import("./signUp").SignUpState;
|
|
145
146
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -172,6 +173,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
172
173
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
173
174
|
sidebar: import("./sidebar").SidebarState;
|
|
174
175
|
tags: import("./tags").TagsState;
|
|
176
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
175
177
|
}) => {
|
|
176
178
|
orderMinimum: number | null;
|
|
177
179
|
orderMaximum: number | null;
|
|
@@ -210,6 +212,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
210
212
|
rewards: import("./customer").CustomerRewardsState;
|
|
211
213
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
212
214
|
thanx: import("./customer").CustomerThanxState;
|
|
215
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
213
216
|
}>;
|
|
214
217
|
signUp: import("./signUp").SignUpState;
|
|
215
218
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -242,6 +245,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
242
245
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
243
246
|
sidebar: import("./sidebar").SidebarState;
|
|
244
247
|
tags: import("./tags").TagsState;
|
|
248
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
245
249
|
}) => number[]) & import("reselect").OutputSelectorFields<(args_0: Cart | null) => number[], {
|
|
246
250
|
clearCache: () => void;
|
|
247
251
|
}> & {
|
|
@@ -275,6 +279,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
275
279
|
rewards: import("./customer").CustomerRewardsState;
|
|
276
280
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
277
281
|
thanx: import("./customer").CustomerThanxState;
|
|
282
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
278
283
|
}>;
|
|
279
284
|
signUp: import("./signUp").SignUpState;
|
|
280
285
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -307,6 +312,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
307
312
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
308
313
|
sidebar: import("./sidebar").SidebarState;
|
|
309
314
|
tags: import("./tags").TagsState;
|
|
315
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
310
316
|
}) => {
|
|
311
317
|
revenueCenterId: number | null;
|
|
312
318
|
serviceType: ServiceType | null;
|
|
@@ -49,6 +49,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
49
49
|
rewards: import("./customer").CustomerRewardsState;
|
|
50
50
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
51
51
|
thanx: import("./customer").CustomerThanxState;
|
|
52
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
52
53
|
}>;
|
|
53
54
|
signUp: import("./signUp").SignUpState;
|
|
54
55
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -81,6 +82,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
81
82
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
82
83
|
sidebar: import("./sidebar").SidebarState;
|
|
83
84
|
tags: TagsState;
|
|
85
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
84
86
|
}) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
|
|
85
87
|
tags: Tags;
|
|
86
88
|
selectedTags: Tags;
|
|
@@ -32,6 +32,7 @@ export declare enum ReducerType {
|
|
|
32
32
|
Nav = "nav",
|
|
33
33
|
NavSite = "navSite",
|
|
34
34
|
Notifications = "notifications",
|
|
35
|
+
OneTimePasscode = "oneTimePasscode",
|
|
35
36
|
Order = "order",
|
|
36
37
|
OrderFulfillment = "orderFulfillment",
|
|
37
38
|
OrderRating = "orderRating",
|
|
@@ -48,6 +49,7 @@ export declare enum ReducerType {
|
|
|
48
49
|
SignUp = "signUp",
|
|
49
50
|
Tags = "tags",
|
|
50
51
|
Thanx = "thanx",
|
|
52
|
+
Tpls = "tpls",
|
|
51
53
|
ValidTimes = "validTimes",
|
|
52
54
|
VerifyAccount = "verifyAccount"
|
|
53
55
|
}
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -36,6 +36,7 @@ var ReducerType;
|
|
|
36
36
|
ReducerType["Nav"] = "nav";
|
|
37
37
|
ReducerType["NavSite"] = "navSite";
|
|
38
38
|
ReducerType["Notifications"] = "notifications";
|
|
39
|
+
ReducerType["OneTimePasscode"] = "oneTimePasscode";
|
|
39
40
|
ReducerType["Order"] = "order";
|
|
40
41
|
ReducerType["OrderFulfillment"] = "orderFulfillment";
|
|
41
42
|
ReducerType["OrderRating"] = "orderRating";
|
|
@@ -52,6 +53,7 @@ var ReducerType;
|
|
|
52
53
|
ReducerType["SignUp"] = "signUp";
|
|
53
54
|
ReducerType["Tags"] = "tags";
|
|
54
55
|
ReducerType["Thanx"] = "thanx";
|
|
56
|
+
ReducerType["Tpls"] = "tpls";
|
|
55
57
|
ReducerType["ValidTimes"] = "validTimes";
|
|
56
58
|
ReducerType["VerifyAccount"] = "verifyAccount";
|
|
57
59
|
})(ReducerType = exports.ReducerType || (exports.ReducerType = {}));
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
22
22
|
rewards: import("..").CustomerRewardsState;
|
|
23
23
|
qrcode: import("..").CustomerQRCodeState;
|
|
24
24
|
thanx: import("..").CustomerThanxState;
|
|
25
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
25
26
|
}>;
|
|
26
27
|
signUp: import("..").SignUpState;
|
|
27
28
|
revenueCenters: import("..").RevenueCentersState;
|
|
@@ -54,5 +55,6 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
54
55
|
sidebarModal: import("..").SidebarModalState;
|
|
55
56
|
sidebar: import("..").SidebarState;
|
|
56
57
|
tags: import("..").TagsState;
|
|
58
|
+
oneTimePasscode: import("..").OneTimePasscodeState;
|
|
57
59
|
}>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
|
|
58
60
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
21
21
|
rewards: import("../slices").CustomerRewardsState;
|
|
22
22
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
23
23
|
thanx: import("../slices").CustomerThanxState;
|
|
24
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
24
25
|
}>;
|
|
25
26
|
signUp: import("../slices").SignUpState;
|
|
26
27
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -53,6 +54,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
53
54
|
sidebarModal: import("../slices").SidebarModalState;
|
|
54
55
|
sidebar: import("../slices").SidebarState;
|
|
55
56
|
tags: import("../slices").TagsState;
|
|
57
|
+
oneTimePasscode: import("../slices").OneTimePasscodeState;
|
|
56
58
|
}>, import("redux").AnyAction>;
|
|
57
59
|
export type AppState = ReturnType<typeof appReducer>;
|
|
58
60
|
declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("redux").EmptyObject & {
|
|
@@ -77,6 +79,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
77
79
|
rewards: import("../slices").CustomerRewardsState;
|
|
78
80
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
79
81
|
thanx: import("../slices").CustomerThanxState;
|
|
82
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
80
83
|
}>;
|
|
81
84
|
signUp: import("../slices").SignUpState;
|
|
82
85
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -109,6 +112,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
109
112
|
sidebarModal: import("../slices").SidebarModalState;
|
|
110
113
|
sidebar: import("../slices").SidebarState;
|
|
111
114
|
tags: import("../slices").TagsState;
|
|
115
|
+
oneTimePasscode: import("../slices").OneTimePasscodeState;
|
|
112
116
|
}, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
|
|
113
117
|
alerts: import("@open-tender/types").Alerts;
|
|
114
118
|
notifications: import("@open-tender/types").Notifications;
|
|
@@ -131,6 +135,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
131
135
|
rewards: import("../slices").CustomerRewardsState;
|
|
132
136
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
133
137
|
thanx: import("../slices").CustomerThanxState;
|
|
138
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
134
139
|
}>;
|
|
135
140
|
signUp: import("../slices").SignUpState;
|
|
136
141
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -163,6 +168,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
163
168
|
sidebarModal: import("../slices").SidebarModalState;
|
|
164
169
|
sidebar: import("../slices").SidebarState;
|
|
165
170
|
tags: import("../slices").TagsState;
|
|
171
|
+
oneTimePasscode: import("../slices").OneTimePasscodeState;
|
|
166
172
|
}>, import("redux").AnyAction, undefined>]>>;
|
|
167
173
|
export type AppDispatch = typeof store.dispatch;
|
|
168
174
|
export type RootState = ReturnType<typeof store.getState>;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { alertsReducer,
|
|
2
|
+
import { alertsReducer, allergensReducer, announcementsReducer, checkoutReducer, completedOrdersReducer, configReducer, confirmationReducer, customerReducer, dealsReducer, donationsReducer, geolocationReducer, giftCardsReducer, groupOrderReducer, guestReducer, loaderReducer, menuDisplayReducer, menuItemsReducer, menuReducer, miscReducer, modalReducer, navReducer, navSiteReducer, notificationsReducer, oneTimePasscodeReducer, orderFulfillmentReducer, orderRatingReducer, orderReducer, postsReducer, qrReducer, resetPasswordReducer, revenueCentersReducer, sidebarModalReducer, sidebarReducer, signUpReducer, tagsReducer, validTimesReducer, verifyAccountReducer } from '../slices';
|
|
3
3
|
import { ReducerType } from '../slices/types';
|
|
4
4
|
export const appReducer = combineReducers({
|
|
5
5
|
[ReducerType.Alerts]: alertsReducer,
|
|
@@ -37,7 +37,8 @@ export const appReducer = combineReducers({
|
|
|
37
37
|
[ReducerType.Posts]: postsReducer,
|
|
38
38
|
[ReducerType.SidebarModal]: sidebarModalReducer,
|
|
39
39
|
[ReducerType.Sidebar]: sidebarReducer,
|
|
40
|
-
[ReducerType.Tags]: tagsReducer
|
|
40
|
+
[ReducerType.Tags]: tagsReducer,
|
|
41
|
+
[ReducerType.OneTimePasscode]: oneTimePasscodeReducer
|
|
41
42
|
});
|
|
42
43
|
const rootReducer = (state, action) => {
|
|
43
44
|
if (action.type === 'clearState') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
|
|
1
|
+
import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OneTimePasscode, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
|
|
2
2
|
declare class OpenTenderAPI {
|
|
3
3
|
brandId?: string;
|
|
4
4
|
clientId?: string;
|
|
@@ -102,6 +102,7 @@ declare class OpenTenderAPI {
|
|
|
102
102
|
getSubscriber(email: string): Promise<unknown>;
|
|
103
103
|
postSubscriber(email: string): Promise<unknown>;
|
|
104
104
|
postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
|
|
105
|
+
postOneTimePasscode(data: OneTimePasscode): Promise<void | Auth | null | undefined>;
|
|
105
106
|
postThanxLogin(email: string, origin?: string): Promise<unknown>;
|
|
106
107
|
postThanxAuth(code: string, path: string, origin?: string): Promise<unknown>;
|
|
107
108
|
postLogin(email: string, password: string): Promise<unknown>;
|
|
@@ -152,6 +153,7 @@ declare class OpenTenderAPI {
|
|
|
152
153
|
getCustomerLoyalty(token: string): Promise<unknown>;
|
|
153
154
|
getCustomerThanx(token: string): Promise<unknown>;
|
|
154
155
|
getThanxCardSignature(token: string, acct: string): Promise<unknown>;
|
|
156
|
+
getCustomerTpls(token: string): Promise<unknown>;
|
|
155
157
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
156
158
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
157
159
|
}
|
package/dist/esm/services/api.js
CHANGED
|
@@ -496,6 +496,9 @@ class OpenTenderAPI {
|
|
|
496
496
|
postSignUp(data) {
|
|
497
497
|
return this.request(`/customer`, 'POST', data);
|
|
498
498
|
}
|
|
499
|
+
postOneTimePasscode(data) {
|
|
500
|
+
return this.request(`/customer/sign-in`, 'POST', data);
|
|
501
|
+
}
|
|
499
502
|
postThanxLogin(email, origin) {
|
|
500
503
|
const data = origin ? { email, origin } : { email };
|
|
501
504
|
return this.request('/thanx-login', 'POST', data);
|
|
@@ -670,6 +673,9 @@ class OpenTenderAPI {
|
|
|
670
673
|
getThanxCardSignature(token, acct) {
|
|
671
674
|
return this.request(`/customer/thanx-card-signature?acct=${acct}`, 'GET', null, null, token);
|
|
672
675
|
}
|
|
676
|
+
getCustomerTpls(token) {
|
|
677
|
+
return this.request(`/customer/tpls`, 'GET', null, null, token);
|
|
678
|
+
}
|
|
673
679
|
getCustomerHouseAccounts(token) {
|
|
674
680
|
return this.request(`/customer/house-accounts`, 'GET', null, null, token);
|
|
675
681
|
}
|
|
@@ -49,6 +49,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
49
49
|
rewards: import("./customer").CustomerRewardsState;
|
|
50
50
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
51
51
|
thanx: import("./customer").CustomerThanxState;
|
|
52
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
52
53
|
}>;
|
|
53
54
|
signUp: import("./signUp").SignUpState;
|
|
54
55
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -81,6 +82,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
81
82
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
82
83
|
sidebar: import("./sidebar").SidebarState;
|
|
83
84
|
tags: import("./tags").TagsState;
|
|
85
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
84
86
|
}) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
|
|
85
87
|
allergens: Allergens;
|
|
86
88
|
selectedAllergens: Allergens | null;
|
|
@@ -105,6 +105,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
105
105
|
rewards: import("./customer").CustomerRewardsState;
|
|
106
106
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
107
107
|
thanx: import("./customer").CustomerThanxState;
|
|
108
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
108
109
|
}>;
|
|
109
110
|
signUp: import("./signUp").SignUpState;
|
|
110
111
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -137,6 +138,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
137
138
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
138
139
|
sidebar: import("./sidebar").SidebarState;
|
|
139
140
|
tags: import("./tags").TagsState;
|
|
141
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
140
142
|
}) => {
|
|
141
143
|
accepts_marketing: import("@open-tender/types").ConfigAcceptMarketing | null | undefined;
|
|
142
144
|
order_notifications: import("@open-tender/types").ConfigOrderNotifications | null | undefined;
|
|
@@ -14,7 +14,9 @@ export declare enum AccountActionType {
|
|
|
14
14
|
UpdateCustomer = "customer/updateCustomer",
|
|
15
15
|
VerifyCustomer = "customer/verifyCustomer",
|
|
16
16
|
LinkPosToken = "customer/linkPosToken",
|
|
17
|
-
DeleteCustomer = "customer/deleteCustomer"
|
|
17
|
+
DeleteCustomer = "customer/deleteCustomer",
|
|
18
|
+
LoginCustomerThanx = "customer/loginCustomerThanx",
|
|
19
|
+
AuthCustomerThanx = "customer/authCustomerThanx"
|
|
18
20
|
}
|
|
19
21
|
export declare const checkAuth: (err: RequestError, dispatch: ThunkDispatch<AppState, unknown, AnyAction>, rejectWithValue: () => any) => Promise<any>;
|
|
20
22
|
export declare const fetchCustomer: import("@reduxjs/toolkit").AsyncThunk<Customer, void, {
|
|
@@ -80,7 +82,7 @@ export declare const sendCustomerVerificationEmail: import("@reduxjs/toolkit").A
|
|
|
80
82
|
fulfilledMeta?: unknown;
|
|
81
83
|
rejectedMeta?: unknown;
|
|
82
84
|
}>;
|
|
83
|
-
export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<
|
|
85
|
+
export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
84
86
|
email: string;
|
|
85
87
|
origin?: string | undefined;
|
|
86
88
|
}, {
|
|
@@ -93,7 +95,7 @@ export declare const loginCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<n
|
|
|
93
95
|
fulfilledMeta?: unknown;
|
|
94
96
|
rejectedMeta?: unknown;
|
|
95
97
|
}>;
|
|
96
|
-
export declare const authCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<
|
|
98
|
+
export declare const authCustomerThanx: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
97
99
|
code: any;
|
|
98
100
|
path: string | null;
|
|
99
101
|
origin: string | null;
|
|
@@ -35,6 +35,8 @@ export var AccountActionType;
|
|
|
35
35
|
AccountActionType["VerifyCustomer"] = "customer/verifyCustomer";
|
|
36
36
|
AccountActionType["LinkPosToken"] = "customer/linkPosToken";
|
|
37
37
|
AccountActionType["DeleteCustomer"] = "customer/deleteCustomer";
|
|
38
|
+
AccountActionType["LoginCustomerThanx"] = "customer/loginCustomerThanx";
|
|
39
|
+
AccountActionType["AuthCustomerThanx"] = "customer/authCustomerThanx";
|
|
38
40
|
})(AccountActionType || (AccountActionType = {}));
|
|
39
41
|
export const checkAuth = (err, dispatch, rejectWithValue) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
42
|
if ((err === null || err === void 0 ? void 0 : err.status) === 401) {
|
|
@@ -166,13 +168,13 @@ export const sendCustomerVerificationEmail = createAsyncThunk(AccountActionType.
|
|
|
166
168
|
return rejectWithValue(err);
|
|
167
169
|
}
|
|
168
170
|
}));
|
|
169
|
-
export const loginCustomerThanx = createAsyncThunk(AccountActionType.
|
|
171
|
+
export const loginCustomerThanx = createAsyncThunk(AccountActionType.LoginCustomerThanx, ({ email, origin }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
172
|
try {
|
|
171
173
|
const api = getState().config.api;
|
|
172
174
|
yield api.postThanxLogin(email, origin);
|
|
173
175
|
dispatch(setAlert({ type: 'close' }));
|
|
174
176
|
dispatch(addMessage('Thanks! Please check your email on this device.'));
|
|
175
|
-
return
|
|
177
|
+
return;
|
|
176
178
|
}
|
|
177
179
|
catch (err) {
|
|
178
180
|
const errr = err;
|
|
@@ -185,12 +187,13 @@ export const loginCustomerThanx = createAsyncThunk(AccountActionType.LoginCustom
|
|
|
185
187
|
return rejectWithValue(errr);
|
|
186
188
|
}
|
|
187
189
|
}));
|
|
188
|
-
export const authCustomerThanx = createAsyncThunk(AccountActionType.
|
|
190
|
+
export const authCustomerThanx = createAsyncThunk(AccountActionType.AuthCustomerThanx, (data, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
189
191
|
try {
|
|
190
192
|
const api = getState().config.api;
|
|
191
193
|
const auth = yield api.postThanxAuth(data.code, data.path, data.origin);
|
|
192
|
-
dispatch(
|
|
193
|
-
|
|
194
|
+
dispatch(setCustomerAuth(auth));
|
|
195
|
+
yield dispatch(fetchCustomer());
|
|
196
|
+
return;
|
|
194
197
|
}
|
|
195
198
|
catch (err) {
|
|
196
199
|
return rejectWithValue(err);
|
|
@@ -308,7 +311,29 @@ const accountSlice = createSlice({
|
|
|
308
311
|
.addCase(deleteCustomer.pending, state => {
|
|
309
312
|
state.loading = 'pending';
|
|
310
313
|
})
|
|
311
|
-
.addCase(deleteCustomer.rejected, () => initialState)
|
|
314
|
+
.addCase(deleteCustomer.rejected, () => initialState)
|
|
315
|
+
.addCase(loginCustomerThanx.fulfilled, state => {
|
|
316
|
+
state.loading = 'idle';
|
|
317
|
+
state.error = null;
|
|
318
|
+
})
|
|
319
|
+
.addCase(loginCustomerThanx.pending, state => {
|
|
320
|
+
state.loading = 'pending';
|
|
321
|
+
})
|
|
322
|
+
.addCase(loginCustomerThanx.rejected, (state, action) => {
|
|
323
|
+
state.loading = 'idle';
|
|
324
|
+
state.error = action.payload;
|
|
325
|
+
})
|
|
326
|
+
.addCase(authCustomerThanx.fulfilled, state => {
|
|
327
|
+
state.loading = 'idle';
|
|
328
|
+
state.error = null;
|
|
329
|
+
})
|
|
330
|
+
.addCase(authCustomerThanx.pending, state => {
|
|
331
|
+
state.loading = 'pending';
|
|
332
|
+
})
|
|
333
|
+
.addCase(authCustomerThanx.rejected, (state, action) => {
|
|
334
|
+
state.loading = 'idle';
|
|
335
|
+
state.error = action.payload;
|
|
336
|
+
});
|
|
312
337
|
}
|
|
313
338
|
});
|
|
314
339
|
export const { resetCustomer, resetLoginError, setCustomerAuth } = accountSlice.actions;
|
|
@@ -15,6 +15,7 @@ export declare const customerReducer: import("redux").Reducer<import("redux").Co
|
|
|
15
15
|
rewards: import("./rewards").CustomerRewardsState;
|
|
16
16
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
17
17
|
thanx: import("./thanx").CustomerThanxState;
|
|
18
|
+
tpls: import("./tpls").CustomerTplsState;
|
|
18
19
|
}>, import("redux").AnyAction>;
|
|
19
20
|
export * from './account';
|
|
20
21
|
export * from './allergens';
|
|
@@ -16,6 +16,7 @@ import { customerOrdersReducer } from './orders';
|
|
|
16
16
|
import { customerQRCodeReducer } from './qrCode';
|
|
17
17
|
import { customerRewardsReducer } from './rewards';
|
|
18
18
|
import { customerThanxReducer } from './thanx';
|
|
19
|
+
import { customerTplsReducer } from './tpls';
|
|
19
20
|
export const customerReducer = combineReducers({
|
|
20
21
|
[ReducerType.Account]: accountReducer,
|
|
21
22
|
[ReducerType.CustomerAllergens]: customerAllergensReducer,
|
|
@@ -32,7 +33,8 @@ export const customerReducer = combineReducers({
|
|
|
32
33
|
[ReducerType.HouseAccounts]: customerHouseAccountsReducer,
|
|
33
34
|
[ReducerType.Rewards]: customerRewardsReducer,
|
|
34
35
|
[ReducerType.QRCode]: customerQRCodeReducer,
|
|
35
|
-
[ReducerType.Thanx]: customerThanxReducer
|
|
36
|
+
[ReducerType.Thanx]: customerThanxReducer,
|
|
37
|
+
[ReducerType.Tpls]: customerTplsReducer
|
|
36
38
|
});
|
|
37
39
|
export * from './account';
|
|
38
40
|
export * from './allergens';
|
|
@@ -55,6 +55,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
55
55
|
rewards: import("./rewards").CustomerRewardsState;
|
|
56
56
|
qrcode: import("./qrCode").CustomerQRCodeState;
|
|
57
57
|
thanx: import("./thanx").CustomerThanxState;
|
|
58
|
+
tpls: import("./tpls").CustomerTplsState;
|
|
58
59
|
}>;
|
|
59
60
|
signUp: import("..").SignUpState;
|
|
60
61
|
revenueCenters: import("..").RevenueCentersState;
|
|
@@ -87,6 +88,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
87
88
|
sidebarModal: import("..").SidebarModalState;
|
|
88
89
|
sidebar: import("..").SidebarState;
|
|
89
90
|
tags: import("..").TagsState;
|
|
91
|
+
oneTimePasscode: import("..").OneTimePasscodeState;
|
|
90
92
|
}) => {
|
|
91
93
|
order: Order | null;
|
|
92
94
|
loading: RequestStatus;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppState } from '../../app';
|
|
2
|
+
import { RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface CustomerTplsState {
|
|
4
|
+
tpls: any | null;
|
|
5
|
+
error: any;
|
|
6
|
+
loading: RequestStatus;
|
|
7
|
+
}
|
|
8
|
+
export declare enum CustomerTplsActionType {
|
|
9
|
+
FetchCustomerTpls = "customer/fetchCustomerTpls"
|
|
10
|
+
}
|
|
11
|
+
export declare const fetchCustomerTpls: import("@reduxjs/toolkit").AsyncThunk<any, void, {
|
|
12
|
+
state: AppState;
|
|
13
|
+
rejectValue: RequestError;
|
|
14
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
15
|
+
extra?: unknown;
|
|
16
|
+
serializedErrorType?: unknown;
|
|
17
|
+
pendingMeta?: unknown;
|
|
18
|
+
fulfilledMeta?: unknown;
|
|
19
|
+
rejectedMeta?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const resetCustomerTpls: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"tpls/resetCustomerTpls">;
|
|
22
|
+
export declare const selectCustomerTpls: (state: AppState) => CustomerTplsState;
|
|
23
|
+
export declare const customerTplsReducer: import("redux").Reducer<CustomerTplsState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { ReducerType } from '../types';
|
|
4
|
+
import { MISSING_CUSTOMER } from '@open-tender/types';
|
|
5
|
+
import { checkAuth, selectToken } from './account';
|
|
6
|
+
const initialState = {
|
|
7
|
+
tpls: null,
|
|
8
|
+
error: null,
|
|
9
|
+
loading: 'idle'
|
|
10
|
+
};
|
|
11
|
+
export var CustomerTplsActionType;
|
|
12
|
+
(function (CustomerTplsActionType) {
|
|
13
|
+
CustomerTplsActionType["FetchCustomerTpls"] = "customer/fetchCustomerTpls";
|
|
14
|
+
})(CustomerTplsActionType || (CustomerTplsActionType = {}));
|
|
15
|
+
export const fetchCustomerTpls = createAsyncThunk(CustomerTplsActionType.FetchCustomerTpls, (_, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const api = getState().config.api;
|
|
18
|
+
const token = selectToken(getState());
|
|
19
|
+
if (!token)
|
|
20
|
+
throw new Error(MISSING_CUSTOMER);
|
|
21
|
+
const resp = yield api.getCustomerTpls(token);
|
|
22
|
+
return resp;
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
const error = err;
|
|
26
|
+
return checkAuth(error, dispatch, () => rejectWithValue(error));
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
const customerTplsSlice = createSlice({
|
|
30
|
+
name: ReducerType.Tpls,
|
|
31
|
+
initialState,
|
|
32
|
+
reducers: {
|
|
33
|
+
resetCustomerTpls: () => initialState
|
|
34
|
+
},
|
|
35
|
+
extraReducers: builder => {
|
|
36
|
+
builder
|
|
37
|
+
.addCase(fetchCustomerTpls.fulfilled, (state, action) => {
|
|
38
|
+
state.tpls = action.payload;
|
|
39
|
+
state.loading = 'idle';
|
|
40
|
+
state.error = null;
|
|
41
|
+
})
|
|
42
|
+
.addCase(fetchCustomerTpls.pending, state => {
|
|
43
|
+
state.loading = 'pending';
|
|
44
|
+
})
|
|
45
|
+
.addCase(fetchCustomerTpls.rejected, (state, action) => {
|
|
46
|
+
state.error = action.payload;
|
|
47
|
+
state.loading = 'idle';
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export const { resetCustomerTpls } = customerTplsSlice.actions;
|
|
52
|
+
export const selectCustomerTpls = (state) => state.customer.tpls;
|
|
53
|
+
export const customerTplsReducer = customerTplsSlice.reducer;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
import { OneTimePasscode, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
|
+
export interface OneTimePasscodeState {
|
|
4
|
+
otpSent: boolean;
|
|
5
|
+
loading: RequestStatus;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
}
|
|
8
|
+
export declare enum OneTimePasscodeActionType {
|
|
9
|
+
OneTimePasscodeCustomer = "oneTimePasscode/oneTimePasscodeCustomer"
|
|
10
|
+
}
|
|
11
|
+
export declare const sendOneTimePasscode: import("@reduxjs/toolkit").AsyncThunk<boolean, {
|
|
12
|
+
data: OneTimePasscode;
|
|
13
|
+
callback?: (() => void) | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
state: AppState;
|
|
16
|
+
rejectValue: RequestError;
|
|
17
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
18
|
+
extra?: unknown;
|
|
19
|
+
serializedErrorType?: unknown;
|
|
20
|
+
pendingMeta?: unknown;
|
|
21
|
+
fulfilledMeta?: unknown;
|
|
22
|
+
rejectedMeta?: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const resetOneTimePasscode: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"oneTimePasscode/resetOneTimePasscode">, toggleOtpSent: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "oneTimePasscode/toggleOtpSent">;
|
|
25
|
+
export declare const selectOneTimePasscode: (state: AppState) => OneTimePasscodeState;
|
|
26
|
+
export declare const oneTimePasscodeReducer: import("redux").Reducer<OneTimePasscodeState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { ReducerType } from './types';
|
|
4
|
+
import { fetchCustomer, setCustomerAuth } from './customer';
|
|
5
|
+
const initialState = {
|
|
6
|
+
otpSent: false,
|
|
7
|
+
loading: 'idle',
|
|
8
|
+
error: null
|
|
9
|
+
};
|
|
10
|
+
export var OneTimePasscodeActionType;
|
|
11
|
+
(function (OneTimePasscodeActionType) {
|
|
12
|
+
OneTimePasscodeActionType["OneTimePasscodeCustomer"] = "oneTimePasscode/oneTimePasscodeCustomer";
|
|
13
|
+
})(OneTimePasscodeActionType || (OneTimePasscodeActionType = {}));
|
|
14
|
+
export const sendOneTimePasscode = createAsyncThunk(OneTimePasscodeActionType.OneTimePasscodeCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const api = getState().config.api;
|
|
17
|
+
const response = yield api.postOneTimePasscode(data);
|
|
18
|
+
if (data.one_time_passcode) {
|
|
19
|
+
dispatch(setCustomerAuth(response));
|
|
20
|
+
yield dispatch(fetchCustomer());
|
|
21
|
+
if (callback)
|
|
22
|
+
callback();
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return rejectWithValue(err);
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
const oneTimePasscodeSlice = createSlice({
|
|
34
|
+
name: ReducerType.OneTimePasscode,
|
|
35
|
+
initialState,
|
|
36
|
+
reducers: {
|
|
37
|
+
resetOneTimePasscode: () => initialState,
|
|
38
|
+
toggleOtpSent: (state, action) => {
|
|
39
|
+
state.otpSent = action.payload;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
extraReducers: builder => {
|
|
43
|
+
builder
|
|
44
|
+
.addCase(sendOneTimePasscode.fulfilled, (state, action) => {
|
|
45
|
+
state.otpSent = action.payload;
|
|
46
|
+
state.loading = 'idle';
|
|
47
|
+
state.error = null;
|
|
48
|
+
})
|
|
49
|
+
.addCase(sendOneTimePasscode.pending, state => {
|
|
50
|
+
state.loading = 'pending';
|
|
51
|
+
})
|
|
52
|
+
.addCase(sendOneTimePasscode.rejected, (state, action) => {
|
|
53
|
+
state.loading = 'idle';
|
|
54
|
+
state.error = action.payload;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
export const { resetOneTimePasscode, toggleOtpSent } = oneTimePasscodeSlice.actions;
|
|
59
|
+
export const selectOneTimePasscode = (state) => state.oneTimePasscode;
|
|
60
|
+
export const oneTimePasscodeReducer = oneTimePasscodeSlice.reducer;
|
|
@@ -140,6 +140,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
140
140
|
rewards: import("./customer").CustomerRewardsState;
|
|
141
141
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
142
142
|
thanx: import("./customer").CustomerThanxState;
|
|
143
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
143
144
|
}>;
|
|
144
145
|
signUp: import("./signUp").SignUpState;
|
|
145
146
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -172,6 +173,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
172
173
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
173
174
|
sidebar: import("./sidebar").SidebarState;
|
|
174
175
|
tags: import("./tags").TagsState;
|
|
176
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
175
177
|
}) => {
|
|
176
178
|
orderMinimum: number | null;
|
|
177
179
|
orderMaximum: number | null;
|
|
@@ -210,6 +212,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
210
212
|
rewards: import("./customer").CustomerRewardsState;
|
|
211
213
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
212
214
|
thanx: import("./customer").CustomerThanxState;
|
|
215
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
213
216
|
}>;
|
|
214
217
|
signUp: import("./signUp").SignUpState;
|
|
215
218
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -242,6 +245,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
242
245
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
243
246
|
sidebar: import("./sidebar").SidebarState;
|
|
244
247
|
tags: import("./tags").TagsState;
|
|
248
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
245
249
|
}) => number[]) & import("reselect").OutputSelectorFields<(args_0: Cart | null) => number[], {
|
|
246
250
|
clearCache: () => void;
|
|
247
251
|
}> & {
|
|
@@ -275,6 +279,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
275
279
|
rewards: import("./customer").CustomerRewardsState;
|
|
276
280
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
277
281
|
thanx: import("./customer").CustomerThanxState;
|
|
282
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
278
283
|
}>;
|
|
279
284
|
signUp: import("./signUp").SignUpState;
|
|
280
285
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -307,6 +312,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
307
312
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
308
313
|
sidebar: import("./sidebar").SidebarState;
|
|
309
314
|
tags: import("./tags").TagsState;
|
|
315
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
310
316
|
}) => {
|
|
311
317
|
revenueCenterId: number | null;
|
|
312
318
|
serviceType: ServiceType | null;
|
|
@@ -49,6 +49,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
49
49
|
rewards: import("./customer").CustomerRewardsState;
|
|
50
50
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
51
51
|
thanx: import("./customer").CustomerThanxState;
|
|
52
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
52
53
|
}>;
|
|
53
54
|
signUp: import("./signUp").SignUpState;
|
|
54
55
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -81,6 +82,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
81
82
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
82
83
|
sidebar: import("./sidebar").SidebarState;
|
|
83
84
|
tags: TagsState;
|
|
85
|
+
oneTimePasscode: import("./oneTimePasscode").OneTimePasscodeState;
|
|
84
86
|
}) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
|
|
85
87
|
tags: Tags;
|
|
86
88
|
selectedTags: Tags;
|
|
@@ -32,6 +32,7 @@ export declare enum ReducerType {
|
|
|
32
32
|
Nav = "nav",
|
|
33
33
|
NavSite = "navSite",
|
|
34
34
|
Notifications = "notifications",
|
|
35
|
+
OneTimePasscode = "oneTimePasscode",
|
|
35
36
|
Order = "order",
|
|
36
37
|
OrderFulfillment = "orderFulfillment",
|
|
37
38
|
OrderRating = "orderRating",
|
|
@@ -48,6 +49,7 @@ export declare enum ReducerType {
|
|
|
48
49
|
SignUp = "signUp",
|
|
49
50
|
Tags = "tags",
|
|
50
51
|
Thanx = "thanx",
|
|
52
|
+
Tpls = "tpls",
|
|
51
53
|
ValidTimes = "validTimes",
|
|
52
54
|
VerifyAccount = "verifyAccount"
|
|
53
55
|
}
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -33,6 +33,7 @@ export var ReducerType;
|
|
|
33
33
|
ReducerType["Nav"] = "nav";
|
|
34
34
|
ReducerType["NavSite"] = "navSite";
|
|
35
35
|
ReducerType["Notifications"] = "notifications";
|
|
36
|
+
ReducerType["OneTimePasscode"] = "oneTimePasscode";
|
|
36
37
|
ReducerType["Order"] = "order";
|
|
37
38
|
ReducerType["OrderFulfillment"] = "orderFulfillment";
|
|
38
39
|
ReducerType["OrderRating"] = "orderRating";
|
|
@@ -49,6 +50,7 @@ export var ReducerType;
|
|
|
49
50
|
ReducerType["SignUp"] = "signUp";
|
|
50
51
|
ReducerType["Tags"] = "tags";
|
|
51
52
|
ReducerType["Thanx"] = "thanx";
|
|
53
|
+
ReducerType["Tpls"] = "tpls";
|
|
52
54
|
ReducerType["ValidTimes"] = "validTimes";
|
|
53
55
|
ReducerType["VerifyAccount"] = "verifyAccount";
|
|
54
56
|
})(ReducerType || (ReducerType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typescript": "^4.8.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@open-tender/types": "^0.2.
|
|
53
|
-
"@open-tender/utils": "^0.1.
|
|
52
|
+
"@open-tender/types": "^0.2.57",
|
|
53
|
+
"@open-tender/utils": "^0.1.126",
|
|
54
54
|
"@reduxjs/toolkit": "^1.8.5",
|
|
55
55
|
"react": "^18.2.0"
|
|
56
56
|
},
|