@open-tender/cloud 0.1.64 → 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 +1 -0
- package/dist/cjs/app/store.d.ts +3 -0
- package/dist/cjs/services/api.d.ts +1 -0
- package/dist/cjs/services/api.js +3 -0
- package/dist/cjs/slices/allergens.d.ts +1 -0
- package/dist/cjs/slices/config.d.ts +1 -0
- 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 +1 -0
- package/dist/cjs/slices/customer/tpls.d.ts +23 -0
- package/dist/cjs/slices/customer/tpls.js +57 -0
- package/dist/cjs/slices/order.d.ts +3 -0
- package/dist/cjs/slices/tags.d.ts +1 -0
- package/dist/cjs/slices/types.d.ts +1 -0
- package/dist/cjs/slices/types.js +1 -0
- package/dist/esm/app/hooks.d.ts +1 -0
- package/dist/esm/app/store.d.ts +3 -0
- package/dist/esm/services/api.d.ts +1 -0
- package/dist/esm/services/api.js +3 -0
- package/dist/esm/slices/allergens.d.ts +1 -0
- package/dist/esm/slices/config.d.ts +1 -0
- 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 +1 -0
- package/dist/esm/slices/customer/tpls.d.ts +23 -0
- package/dist/esm/slices/customer/tpls.js +53 -0
- package/dist/esm/slices/order.d.ts +3 -0
- package/dist/esm/slices/tags.d.ts +1 -0
- package/dist/esm/slices/types.d.ts +1 -0
- package/dist/esm/slices/types.js +1 -0
- package/package.json +1 -1
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;
|
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;
|
|
@@ -78,6 +79,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
78
79
|
rewards: import("../slices").CustomerRewardsState;
|
|
79
80
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
80
81
|
thanx: import("../slices").CustomerThanxState;
|
|
82
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
81
83
|
}>;
|
|
82
84
|
signUp: import("../slices").SignUpState;
|
|
83
85
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -133,6 +135,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
133
135
|
rewards: import("../slices").CustomerRewardsState;
|
|
134
136
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
135
137
|
thanx: import("../slices").CustomerThanxState;
|
|
138
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
136
139
|
}>;
|
|
137
140
|
signUp: import("../slices").SignUpState;
|
|
138
141
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -153,6 +153,7 @@ declare class OpenTenderAPI {
|
|
|
153
153
|
getCustomerLoyalty(token: string): Promise<unknown>;
|
|
154
154
|
getCustomerThanx(token: string): Promise<unknown>;
|
|
155
155
|
getThanxCardSignature(token: string, acct: string): Promise<unknown>;
|
|
156
|
+
getCustomerTpls(token: string): Promise<unknown>;
|
|
156
157
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
157
158
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
158
159
|
}
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -675,6 +675,9 @@ class OpenTenderAPI {
|
|
|
675
675
|
getThanxCardSignature(token, acct) {
|
|
676
676
|
return this.request(`/customer/thanx-card-signature?acct=${acct}`, 'GET', null, null, token);
|
|
677
677
|
}
|
|
678
|
+
getCustomerTpls(token) {
|
|
679
|
+
return this.request(`/customer/tpls`, 'GET', null, null, token);
|
|
680
|
+
}
|
|
678
681
|
getCustomerHouseAccounts(token) {
|
|
679
682
|
return this.request(`/customer/house-accounts`, 'GET', null, null, token);
|
|
680
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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -211,6 +212,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
211
212
|
rewards: import("./customer").CustomerRewardsState;
|
|
212
213
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
213
214
|
thanx: import("./customer").CustomerThanxState;
|
|
215
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
214
216
|
}>;
|
|
215
217
|
signUp: import("./signUp").SignUpState;
|
|
216
218
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -277,6 +279,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
277
279
|
rewards: import("./customer").CustomerRewardsState;
|
|
278
280
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
279
281
|
thanx: import("./customer").CustomerThanxState;
|
|
282
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
280
283
|
}>;
|
|
281
284
|
signUp: import("./signUp").SignUpState;
|
|
282
285
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -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;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -53,6 +53,7 @@ var ReducerType;
|
|
|
53
53
|
ReducerType["SignUp"] = "signUp";
|
|
54
54
|
ReducerType["Tags"] = "tags";
|
|
55
55
|
ReducerType["Thanx"] = "thanx";
|
|
56
|
+
ReducerType["Tpls"] = "tpls";
|
|
56
57
|
ReducerType["ValidTimes"] = "validTimes";
|
|
57
58
|
ReducerType["VerifyAccount"] = "verifyAccount";
|
|
58
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;
|
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;
|
|
@@ -78,6 +79,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
78
79
|
rewards: import("../slices").CustomerRewardsState;
|
|
79
80
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
80
81
|
thanx: import("../slices").CustomerThanxState;
|
|
82
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
81
83
|
}>;
|
|
82
84
|
signUp: import("../slices").SignUpState;
|
|
83
85
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -133,6 +135,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
133
135
|
rewards: import("../slices").CustomerRewardsState;
|
|
134
136
|
qrcode: import("../slices").CustomerQRCodeState;
|
|
135
137
|
thanx: import("../slices").CustomerThanxState;
|
|
138
|
+
tpls: import("../slices/customer/tpls").CustomerTplsState;
|
|
136
139
|
}>;
|
|
137
140
|
signUp: import("../slices").SignUpState;
|
|
138
141
|
revenueCenters: import("../slices").RevenueCentersState;
|
|
@@ -153,6 +153,7 @@ declare class OpenTenderAPI {
|
|
|
153
153
|
getCustomerLoyalty(token: string): Promise<unknown>;
|
|
154
154
|
getCustomerThanx(token: string): Promise<unknown>;
|
|
155
155
|
getThanxCardSignature(token: string, acct: string): Promise<unknown>;
|
|
156
|
+
getCustomerTpls(token: string): Promise<unknown>;
|
|
156
157
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
157
158
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
158
159
|
}
|
package/dist/esm/services/api.js
CHANGED
|
@@ -673,6 +673,9 @@ class OpenTenderAPI {
|
|
|
673
673
|
getThanxCardSignature(token, acct) {
|
|
674
674
|
return this.request(`/customer/thanx-card-signature?acct=${acct}`, 'GET', null, null, token);
|
|
675
675
|
}
|
|
676
|
+
getCustomerTpls(token) {
|
|
677
|
+
return this.request(`/customer/tpls`, 'GET', null, null, token);
|
|
678
|
+
}
|
|
676
679
|
getCustomerHouseAccounts(token) {
|
|
677
680
|
return this.request(`/customer/house-accounts`, 'GET', null, null, token);
|
|
678
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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -211,6 +212,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
211
212
|
rewards: import("./customer").CustomerRewardsState;
|
|
212
213
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
213
214
|
thanx: import("./customer").CustomerThanxState;
|
|
215
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
214
216
|
}>;
|
|
215
217
|
signUp: import("./signUp").SignUpState;
|
|
216
218
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -277,6 +279,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
277
279
|
rewards: import("./customer").CustomerRewardsState;
|
|
278
280
|
qrcode: import("./customer").CustomerQRCodeState;
|
|
279
281
|
thanx: import("./customer").CustomerThanxState;
|
|
282
|
+
tpls: import("./customer/tpls").CustomerTplsState;
|
|
280
283
|
}>;
|
|
281
284
|
signUp: import("./signUp").SignUpState;
|
|
282
285
|
revenueCenters: import("./revenueCenters").RevenueCentersState;
|
|
@@ -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;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -50,6 +50,7 @@ export var ReducerType;
|
|
|
50
50
|
ReducerType["SignUp"] = "signUp";
|
|
51
51
|
ReducerType["Tags"] = "tags";
|
|
52
52
|
ReducerType["Thanx"] = "thanx";
|
|
53
|
+
ReducerType["Tpls"] = "tpls";
|
|
53
54
|
ReducerType["ValidTimes"] = "validTimes";
|
|
54
55
|
ReducerType["VerifyAccount"] = "verifyAccount";
|
|
55
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",
|