@open-tender/cloud 0.5.34 → 0.5.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app/hooks.d.ts +1 -0
- package/dist/cjs/app/store.d.ts +3 -0
- package/dist/cjs/app/store.js +1 -0
- package/dist/cjs/services/api.d.ts +3 -0
- package/dist/cjs/services/api.js +9 -0
- package/dist/cjs/slices/allergens.d.ts +1 -0
- package/dist/cjs/slices/announcements.d.ts +2 -0
- package/dist/cjs/slices/config.d.ts +3 -0
- package/dist/cjs/slices/customer/creditCards.d.ts +1 -0
- package/dist/cjs/slices/customer/loyalty.d.ts +3 -0
- package/dist/cjs/slices/customer/order.d.ts +1 -0
- package/dist/cjs/slices/customer/tpls.d.ts +3 -0
- package/dist/cjs/slices/groupOrder.d.ts +4 -0
- package/dist/cjs/slices/index.d.ts +1 -0
- package/dist/cjs/slices/index.js +1 -0
- package/dist/cjs/slices/order.d.ts +3 -0
- package/dist/cjs/slices/quote.d.ts +1 -0
- package/dist/cjs/slices/states.d.ts +44 -0
- package/dist/cjs/slices/states.js +114 -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/app/store.js +2 -1
- package/dist/esm/services/api.d.ts +3 -0
- package/dist/esm/services/api.js +9 -0
- package/dist/esm/slices/allergens.d.ts +1 -0
- package/dist/esm/slices/announcements.d.ts +2 -0
- package/dist/esm/slices/config.d.ts +3 -0
- package/dist/esm/slices/customer/creditCards.d.ts +1 -0
- package/dist/esm/slices/customer/loyalty.d.ts +3 -0
- package/dist/esm/slices/customer/order.d.ts +1 -0
- package/dist/esm/slices/customer/tpls.d.ts +3 -0
- package/dist/esm/slices/groupOrder.d.ts +4 -0
- package/dist/esm/slices/index.d.ts +1 -0
- package/dist/esm/slices/index.js +1 -0
- package/dist/esm/slices/order.d.ts +3 -0
- package/dist/esm/slices/quote.d.ts +1 -0
- package/dist/esm/slices/states.d.ts +44 -0
- package/dist/esm/slices/states.js +110 -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
|
@@ -59,6 +59,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
59
59
|
sidebar: import("..").SidebarState;
|
|
60
60
|
sidebarModal: import("..").SidebarModalState;
|
|
61
61
|
signUp: import("..").SignUpState;
|
|
62
|
+
states: import("..").StatesSlice;
|
|
62
63
|
tags: import("..").TagsState;
|
|
63
64
|
terms: import("..").TermsSlice;
|
|
64
65
|
Unsubscribe: import("..").UnsubscribeState;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
58
58
|
sidebar: import("../slices").SidebarState;
|
|
59
59
|
sidebarModal: import("../slices").SidebarModalState;
|
|
60
60
|
signUp: import("../slices").SignUpState;
|
|
61
|
+
states: import("../slices").StatesSlice;
|
|
61
62
|
tags: import("../slices").TagsState;
|
|
62
63
|
terms: import("../slices").TermsSlice;
|
|
63
64
|
Unsubscribe: import("../slices").UnsubscribeState;
|
|
@@ -124,6 +125,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
124
125
|
sidebar: import("../slices").SidebarState;
|
|
125
126
|
sidebarModal: import("../slices").SidebarModalState;
|
|
126
127
|
signUp: import("../slices").SignUpState;
|
|
128
|
+
states: import("../slices").StatesSlice;
|
|
127
129
|
tags: import("../slices").TagsState;
|
|
128
130
|
terms: import("../slices").TermsSlice;
|
|
129
131
|
Unsubscribe: import("../slices").UnsubscribeState;
|
|
@@ -188,6 +190,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
188
190
|
sidebar: import("../slices").SidebarState;
|
|
189
191
|
sidebarModal: import("../slices").SidebarModalState;
|
|
190
192
|
signUp: import("../slices").SignUpState;
|
|
193
|
+
states: import("../slices").StatesSlice;
|
|
191
194
|
tags: import("../slices").TagsState;
|
|
192
195
|
terms: import("../slices").TermsSlice;
|
|
193
196
|
Unsubscribe: import("../slices").UnsubscribeState;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -42,6 +42,7 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
42
42
|
[types_1.ReducerType.Sidebar]: slices_1.sidebarReducer,
|
|
43
43
|
[types_1.ReducerType.SidebarModal]: slices_1.sidebarModalReducer,
|
|
44
44
|
[types_1.ReducerType.SignUp]: slices_1.signUpReducer,
|
|
45
|
+
[types_1.ReducerType.States]: slices_1.statesReducer,
|
|
45
46
|
[types_1.ReducerType.Tags]: slices_1.tagsReducer,
|
|
46
47
|
[types_1.ReducerType.Terms]: slices_1.termsReducer,
|
|
47
48
|
[types_1.ReducerType.Unsubscribe]: slices_1.unsubscribeReducer,
|
|
@@ -171,5 +171,8 @@ declare class OpenTenderAPI {
|
|
|
171
171
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
172
172
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
173
173
|
postClaimRewardCode(token: string, rewardCode: string): Promise<unknown>;
|
|
174
|
+
getStates(): Promise<unknown>;
|
|
175
|
+
getCitiesByState(state: string): Promise<unknown>;
|
|
176
|
+
getHomeStoresByCity(city: string): Promise<unknown>;
|
|
174
177
|
}
|
|
175
178
|
export default OpenTenderAPI;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -750,5 +750,14 @@ class OpenTenderAPI {
|
|
|
750
750
|
postClaimRewardCode(token, rewardCode) {
|
|
751
751
|
return this.request(`/claim-reward-code`, 'POST', { reward_code: rewardCode }, null, token);
|
|
752
752
|
}
|
|
753
|
+
getStates() {
|
|
754
|
+
return this.request(`/states-by-rc`);
|
|
755
|
+
}
|
|
756
|
+
getCitiesByState(state) {
|
|
757
|
+
return this.request(`/cities-by-rc-state?state=${state}`);
|
|
758
|
+
}
|
|
759
|
+
getHomeStoresByCity(city) {
|
|
760
|
+
return this.request(`/home-store-by-city?city=${city}`);
|
|
761
|
+
}
|
|
753
762
|
}
|
|
754
763
|
exports.default = OpenTenderAPI;
|
|
@@ -86,6 +86,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
86
86
|
sidebar: import("./sidebar").SidebarState;
|
|
87
87
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
88
88
|
signUp: import("./signUp").SignUpState;
|
|
89
|
+
states: import("./states").StatesSlice;
|
|
89
90
|
tags: import("./tags").TagsState;
|
|
90
91
|
terms: import("./terms").TermsSlice;
|
|
91
92
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -83,6 +83,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
|
|
|
83
83
|
sidebar: import("./sidebar").SidebarState;
|
|
84
84
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
85
85
|
signUp: import("./signUp").SignUpState;
|
|
86
|
+
states: import("./states").StatesSlice;
|
|
86
87
|
tags: import("./tags").TagsState;
|
|
87
88
|
terms: import("./terms").TermsSlice;
|
|
88
89
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -166,6 +167,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
|
|
|
166
167
|
sidebar: import("./sidebar").SidebarState;
|
|
167
168
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
168
169
|
signUp: import("./signUp").SignUpState;
|
|
170
|
+
states: import("./states").StatesSlice;
|
|
169
171
|
tags: import("./tags").TagsState;
|
|
170
172
|
terms: import("./terms").TermsSlice;
|
|
171
173
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -148,6 +148,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
148
148
|
sidebar: import("./sidebar").SidebarState;
|
|
149
149
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
150
150
|
signUp: import("./signUp").SignUpState;
|
|
151
|
+
states: import("./states").StatesSlice;
|
|
151
152
|
tags: import("./tags").TagsState;
|
|
152
153
|
terms: import("./terms").TermsSlice;
|
|
153
154
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -226,6 +227,7 @@ export declare const selectShowLoyalty: ((state: import("redux").EmptyObject & {
|
|
|
226
227
|
sidebar: import("./sidebar").SidebarState;
|
|
227
228
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
228
229
|
signUp: import("./signUp").SignUpState;
|
|
230
|
+
states: import("./states").StatesSlice;
|
|
229
231
|
tags: import("./tags").TagsState;
|
|
230
232
|
terms: import("./terms").TermsSlice;
|
|
231
233
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -303,6 +305,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
|
|
|
303
305
|
sidebar: import("./sidebar").SidebarState;
|
|
304
306
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
305
307
|
signUp: import("./signUp").SignUpState;
|
|
308
|
+
states: import("./states").StatesSlice;
|
|
306
309
|
tags: import("./tags").TagsState;
|
|
307
310
|
terms: import("./terms").TermsSlice;
|
|
308
311
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -125,6 +125,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
|
|
|
125
125
|
sidebar: import("..").SidebarState;
|
|
126
126
|
sidebarModal: import("..").SidebarModalState;
|
|
127
127
|
signUp: import("..").SignUpState;
|
|
128
|
+
states: import("..").StatesSlice;
|
|
128
129
|
tags: import("..").TagsState;
|
|
129
130
|
terms: import("..").TermsSlice;
|
|
130
131
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -82,6 +82,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
|
|
|
82
82
|
sidebar: import("..").SidebarState;
|
|
83
83
|
sidebarModal: import("..").SidebarModalState;
|
|
84
84
|
signUp: import("..").SignUpState;
|
|
85
|
+
states: import("..").StatesSlice;
|
|
85
86
|
tags: import("..").TagsState;
|
|
86
87
|
terms: import("..").TermsSlice;
|
|
87
88
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -163,6 +164,7 @@ export declare const selectHasPointsShop: ((state: import("redux").EmptyObject &
|
|
|
163
164
|
sidebar: import("..").SidebarState;
|
|
164
165
|
sidebarModal: import("..").SidebarModalState;
|
|
165
166
|
signUp: import("..").SignUpState;
|
|
167
|
+
states: import("..").StatesSlice;
|
|
166
168
|
tags: import("..").TagsState;
|
|
167
169
|
terms: import("..").TermsSlice;
|
|
168
170
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -234,6 +236,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
234
236
|
sidebar: import("..").SidebarState;
|
|
235
237
|
sidebarModal: import("..").SidebarModalState;
|
|
236
238
|
signUp: import("..").SignUpState;
|
|
239
|
+
states: import("..").StatesSlice;
|
|
237
240
|
tags: import("..").TagsState;
|
|
238
241
|
terms: import("..").TermsSlice;
|
|
239
242
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -92,6 +92,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
92
92
|
sidebar: import("..").SidebarState;
|
|
93
93
|
sidebarModal: import("..").SidebarModalState;
|
|
94
94
|
signUp: import("..").SignUpState;
|
|
95
|
+
states: import("..").StatesSlice;
|
|
95
96
|
tags: import("..").TagsState;
|
|
96
97
|
terms: import("..").TermsSlice;
|
|
97
98
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -90,6 +90,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
|
|
|
90
90
|
sidebar: import("..").SidebarState;
|
|
91
91
|
sidebarModal: import("..").SidebarModalState;
|
|
92
92
|
signUp: import("..").SignUpState;
|
|
93
|
+
states: import("..").StatesSlice;
|
|
93
94
|
tags: import("..").TagsState;
|
|
94
95
|
terms: import("..").TermsSlice;
|
|
95
96
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -159,6 +160,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
|
|
|
159
160
|
sidebar: import("..").SidebarState;
|
|
160
161
|
sidebarModal: import("..").SidebarModalState;
|
|
161
162
|
signUp: import("..").SignUpState;
|
|
163
|
+
states: import("..").StatesSlice;
|
|
162
164
|
tags: import("..").TagsState;
|
|
163
165
|
terms: import("..").TermsSlice;
|
|
164
166
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -228,6 +230,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
|
|
|
228
230
|
sidebar: import("..").SidebarState;
|
|
229
231
|
sidebarModal: import("..").SidebarModalState;
|
|
230
232
|
signUp: import("..").SignUpState;
|
|
233
|
+
states: import("..").StatesSlice;
|
|
231
234
|
tags: import("..").TagsState;
|
|
232
235
|
terms: import("..").TermsSlice;
|
|
233
236
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -165,6 +165,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
|
|
|
165
165
|
sidebar: import("./sidebar").SidebarState;
|
|
166
166
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
167
167
|
signUp: import("./signUp").SignUpState;
|
|
168
|
+
states: import("./states").StatesSlice;
|
|
168
169
|
tags: import("./tags").TagsState;
|
|
169
170
|
terms: import("./terms").TermsSlice;
|
|
170
171
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -237,6 +238,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
|
|
|
237
238
|
sidebar: import("./sidebar").SidebarState;
|
|
238
239
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
239
240
|
signUp: import("./signUp").SignUpState;
|
|
241
|
+
states: import("./states").StatesSlice;
|
|
240
242
|
tags: import("./tags").TagsState;
|
|
241
243
|
terms: import("./terms").TermsSlice;
|
|
242
244
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -311,6 +313,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
|
|
|
311
313
|
sidebar: import("./sidebar").SidebarState;
|
|
312
314
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
313
315
|
signUp: import("./signUp").SignUpState;
|
|
316
|
+
states: import("./states").StatesSlice;
|
|
314
317
|
tags: import("./tags").TagsState;
|
|
315
318
|
terms: import("./terms").TermsSlice;
|
|
316
319
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -394,6 +397,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
|
|
|
394
397
|
sidebar: import("./sidebar").SidebarState;
|
|
395
398
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
396
399
|
signUp: import("./signUp").SignUpState;
|
|
400
|
+
states: import("./states").StatesSlice;
|
|
397
401
|
tags: import("./tags").TagsState;
|
|
398
402
|
terms: import("./terms").TermsSlice;
|
|
399
403
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -38,6 +38,7 @@ tslib_1.__exportStar(require("./rewardCode"), exports);
|
|
|
38
38
|
tslib_1.__exportStar(require("./sidebar"), exports);
|
|
39
39
|
tslib_1.__exportStar(require("./sidebarModal"), exports);
|
|
40
40
|
tslib_1.__exportStar(require("./signUp"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./states"), exports);
|
|
41
42
|
tslib_1.__exportStar(require("./tags"), exports);
|
|
42
43
|
tslib_1.__exportStar(require("./terms"), exports);
|
|
43
44
|
tslib_1.__exportStar(require("./unsubscribe"), exports);
|
|
@@ -193,6 +193,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
193
193
|
sidebar: import("./sidebar").SidebarState;
|
|
194
194
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
195
195
|
signUp: import("./signUp").SignUpState;
|
|
196
|
+
states: import("./states").StatesSlice;
|
|
196
197
|
tags: import("./tags").TagsState;
|
|
197
198
|
terms: import("./terms").TermsSlice;
|
|
198
199
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -273,6 +274,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
273
274
|
sidebar: import("./sidebar").SidebarState;
|
|
274
275
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
275
276
|
signUp: import("./signUp").SignUpState;
|
|
277
|
+
states: import("./states").StatesSlice;
|
|
276
278
|
tags: import("./tags").TagsState;
|
|
277
279
|
terms: import("./terms").TermsSlice;
|
|
278
280
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -348,6 +350,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
348
350
|
sidebar: import("./sidebar").SidebarState;
|
|
349
351
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
350
352
|
signUp: import("./signUp").SignUpState;
|
|
353
|
+
states: import("./states").StatesSlice;
|
|
351
354
|
tags: import("./tags").TagsState;
|
|
352
355
|
terms: import("./terms").TermsSlice;
|
|
353
356
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -78,6 +78,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
|
|
|
78
78
|
sidebar: import("./sidebar").SidebarState;
|
|
79
79
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
80
80
|
signUp: import("./signUp").SignUpState;
|
|
81
|
+
states: import("./states").StatesSlice;
|
|
81
82
|
tags: import("./tags").TagsState;
|
|
82
83
|
terms: import("./terms").TermsSlice;
|
|
83
84
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface StatesSlice {
|
|
4
|
+
states: string[];
|
|
5
|
+
cities: string[];
|
|
6
|
+
homeStores: Array<[string, string]>;
|
|
7
|
+
statesLoading: RequestStatus;
|
|
8
|
+
citiesLoading: RequestStatus;
|
|
9
|
+
homeStoresLoading: RequestStatus;
|
|
10
|
+
error: RequestError;
|
|
11
|
+
}
|
|
12
|
+
export declare const fetchStates: import("@reduxjs/toolkit").AsyncThunk<string[], void, {
|
|
13
|
+
state: AppState;
|
|
14
|
+
rejectValue: RequestError;
|
|
15
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
16
|
+
extra?: unknown;
|
|
17
|
+
serializedErrorType?: unknown;
|
|
18
|
+
pendingMeta?: unknown;
|
|
19
|
+
fulfilledMeta?: unknown;
|
|
20
|
+
rejectedMeta?: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const fetchCitiesByState: import("@reduxjs/toolkit").AsyncThunk<string[], string, {
|
|
23
|
+
state: AppState;
|
|
24
|
+
rejectValue: RequestError;
|
|
25
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
26
|
+
extra?: unknown;
|
|
27
|
+
serializedErrorType?: unknown;
|
|
28
|
+
pendingMeta?: unknown;
|
|
29
|
+
fulfilledMeta?: unknown;
|
|
30
|
+
rejectedMeta?: unknown;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const fetchHomeStoresByCity: import("@reduxjs/toolkit").AsyncThunk<[string, string][], string, {
|
|
33
|
+
state: AppState;
|
|
34
|
+
rejectValue: RequestError;
|
|
35
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
36
|
+
extra?: unknown;
|
|
37
|
+
serializedErrorType?: unknown;
|
|
38
|
+
pendingMeta?: unknown;
|
|
39
|
+
fulfilledMeta?: unknown;
|
|
40
|
+
rejectedMeta?: unknown;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const resetStates: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"states/resetStates">;
|
|
43
|
+
export declare const selectStates: (state: AppState) => StatesSlice;
|
|
44
|
+
export declare const statesReducer: import("redux").Reducer<StatesSlice, import("redux").AnyAction>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statesReducer = exports.selectStates = exports.resetStates = exports.fetchHomeStoresByCity = exports.fetchCitiesByState = exports.fetchStates = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
states: [],
|
|
8
|
+
cities: [],
|
|
9
|
+
homeStores: [],
|
|
10
|
+
statesLoading: 'idle',
|
|
11
|
+
citiesLoading: 'idle',
|
|
12
|
+
homeStoresLoading: 'idle',
|
|
13
|
+
error: null
|
|
14
|
+
};
|
|
15
|
+
exports.fetchStates = (0, toolkit_1.createAsyncThunk)('states/fetchStates', (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const { api } = getState().config;
|
|
17
|
+
if (!api)
|
|
18
|
+
return;
|
|
19
|
+
try {
|
|
20
|
+
const api = getState().config.api;
|
|
21
|
+
if (!api)
|
|
22
|
+
return null;
|
|
23
|
+
const { data } = yield api.getStates();
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
const error = err;
|
|
28
|
+
return rejectWithValue(error);
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
exports.fetchCitiesByState = (0, toolkit_1.createAsyncThunk)('states/fetchCitiesByState', (state, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const { api } = getState().config;
|
|
33
|
+
if (!api)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
const api = getState().config.api;
|
|
37
|
+
if (!api)
|
|
38
|
+
return null;
|
|
39
|
+
const { data } = yield api.getCitiesByState(state);
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
const error = err;
|
|
44
|
+
return rejectWithValue(error);
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
exports.fetchHomeStoresByCity = (0, toolkit_1.createAsyncThunk)('states/fetchHomeStoresByCity', (city, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
const { api } = getState().config;
|
|
49
|
+
if (!api)
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
const api = getState().config.api;
|
|
53
|
+
if (!api)
|
|
54
|
+
return null;
|
|
55
|
+
const { data } = yield api.getHomeStoresByCity(city);
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
const error = err;
|
|
60
|
+
return rejectWithValue(error);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
const statesSlice = (0, toolkit_1.createSlice)({
|
|
64
|
+
name: 'states',
|
|
65
|
+
initialState: initialState,
|
|
66
|
+
reducers: {
|
|
67
|
+
resetStates: () => initialState
|
|
68
|
+
},
|
|
69
|
+
extraReducers: builder => {
|
|
70
|
+
builder
|
|
71
|
+
.addCase(exports.fetchStates.fulfilled, (state, action) => {
|
|
72
|
+
state.states = action.payload || [];
|
|
73
|
+
state.statesLoading = 'idle';
|
|
74
|
+
state.error = null;
|
|
75
|
+
})
|
|
76
|
+
.addCase(exports.fetchStates.pending, state => {
|
|
77
|
+
state.statesLoading = 'pending';
|
|
78
|
+
})
|
|
79
|
+
.addCase(exports.fetchStates.rejected, (state, action) => {
|
|
80
|
+
state.statesLoading = 'idle';
|
|
81
|
+
state.error = action.payload;
|
|
82
|
+
});
|
|
83
|
+
builder
|
|
84
|
+
.addCase(exports.fetchCitiesByState.fulfilled, (state, action) => {
|
|
85
|
+
state.cities = action.payload || [];
|
|
86
|
+
state.citiesLoading = 'idle';
|
|
87
|
+
state.error = null;
|
|
88
|
+
})
|
|
89
|
+
.addCase(exports.fetchCitiesByState.pending, state => {
|
|
90
|
+
state.citiesLoading = 'pending';
|
|
91
|
+
})
|
|
92
|
+
.addCase(exports.fetchCitiesByState.rejected, (state, action) => {
|
|
93
|
+
state.citiesLoading = 'idle';
|
|
94
|
+
state.error = action.payload;
|
|
95
|
+
});
|
|
96
|
+
builder
|
|
97
|
+
.addCase(exports.fetchHomeStoresByCity.fulfilled, (state, action) => {
|
|
98
|
+
state.homeStores = action.payload || [];
|
|
99
|
+
state.homeStoresLoading = 'idle';
|
|
100
|
+
state.error = null;
|
|
101
|
+
})
|
|
102
|
+
.addCase(exports.fetchHomeStoresByCity.pending, state => {
|
|
103
|
+
state.homeStoresLoading = 'pending';
|
|
104
|
+
})
|
|
105
|
+
.addCase(exports.fetchHomeStoresByCity.rejected, (state, action) => {
|
|
106
|
+
state.homeStoresLoading = 'idle';
|
|
107
|
+
state.error = action.payload;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
exports.resetStates = statesSlice.actions.resetStates;
|
|
112
|
+
const selectStates = (state) => state.states;
|
|
113
|
+
exports.selectStates = selectStates;
|
|
114
|
+
exports.statesReducer = statesSlice.reducer;
|
|
@@ -86,6 +86,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
86
86
|
sidebar: import("./sidebar").SidebarState;
|
|
87
87
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
88
88
|
signUp: import("./signUp").SignUpState;
|
|
89
|
+
states: import("./states").StatesSlice;
|
|
89
90
|
tags: TagsState;
|
|
90
91
|
terms: import("./terms").TermsSlice;
|
|
91
92
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -56,6 +56,7 @@ var ReducerType;
|
|
|
56
56
|
ReducerType["Sidebar"] = "sidebar";
|
|
57
57
|
ReducerType["SidebarModal"] = "sidebarModal";
|
|
58
58
|
ReducerType["SignUp"] = "signUp";
|
|
59
|
+
ReducerType["States"] = "states";
|
|
59
60
|
ReducerType["Tags"] = "tags";
|
|
60
61
|
ReducerType["Terms"] = "terms";
|
|
61
62
|
ReducerType["Thanx"] = "thanx";
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
59
59
|
sidebar: import("..").SidebarState;
|
|
60
60
|
sidebarModal: import("..").SidebarModalState;
|
|
61
61
|
signUp: import("..").SignUpState;
|
|
62
|
+
states: import("..").StatesSlice;
|
|
62
63
|
tags: import("..").TagsState;
|
|
63
64
|
terms: import("..").TermsSlice;
|
|
64
65
|
Unsubscribe: import("..").UnsubscribeState;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
58
58
|
sidebar: import("../slices").SidebarState;
|
|
59
59
|
sidebarModal: import("../slices").SidebarModalState;
|
|
60
60
|
signUp: import("../slices").SignUpState;
|
|
61
|
+
states: import("../slices").StatesSlice;
|
|
61
62
|
tags: import("../slices").TagsState;
|
|
62
63
|
terms: import("../slices").TermsSlice;
|
|
63
64
|
Unsubscribe: import("../slices").UnsubscribeState;
|
|
@@ -124,6 +125,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
124
125
|
sidebar: import("../slices").SidebarState;
|
|
125
126
|
sidebarModal: import("../slices").SidebarModalState;
|
|
126
127
|
signUp: import("../slices").SignUpState;
|
|
128
|
+
states: import("../slices").StatesSlice;
|
|
127
129
|
tags: import("../slices").TagsState;
|
|
128
130
|
terms: import("../slices").TermsSlice;
|
|
129
131
|
Unsubscribe: import("../slices").UnsubscribeState;
|
|
@@ -188,6 +190,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
|
|
|
188
190
|
sidebar: import("../slices").SidebarState;
|
|
189
191
|
sidebarModal: import("../slices").SidebarModalState;
|
|
190
192
|
signUp: import("../slices").SignUpState;
|
|
193
|
+
states: import("../slices").StatesSlice;
|
|
191
194
|
tags: import("../slices").TagsState;
|
|
192
195
|
terms: import("../slices").TermsSlice;
|
|
193
196
|
Unsubscribe: import("../slices").UnsubscribeState;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
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, pushNotificationsReducer, qrReducer, quoteReducer, resetPasswordReducer, revenueCentersReducer, rewardCodeReducer, sidebarModalReducer, sidebarReducer, signUpReducer, tagsReducer, termsReducer, unsubscribeReducer, validTimesReducer, verifyAccountReducer } from '../slices';
|
|
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, pushNotificationsReducer, qrReducer, quoteReducer, resetPasswordReducer, revenueCentersReducer, rewardCodeReducer, sidebarModalReducer, sidebarReducer, signUpReducer, statesReducer, tagsReducer, termsReducer, unsubscribeReducer, validTimesReducer, verifyAccountReducer } from '../slices';
|
|
3
3
|
import { ReducerType } from '../slices/types';
|
|
4
4
|
export const appReducer = combineReducers({
|
|
5
5
|
[ReducerType.Alerts]: alertsReducer,
|
|
@@ -39,6 +39,7 @@ export const appReducer = combineReducers({
|
|
|
39
39
|
[ReducerType.Sidebar]: sidebarReducer,
|
|
40
40
|
[ReducerType.SidebarModal]: sidebarModalReducer,
|
|
41
41
|
[ReducerType.SignUp]: signUpReducer,
|
|
42
|
+
[ReducerType.States]: statesReducer,
|
|
42
43
|
[ReducerType.Tags]: tagsReducer,
|
|
43
44
|
[ReducerType.Terms]: termsReducer,
|
|
44
45
|
[ReducerType.Unsubscribe]: unsubscribeReducer,
|
|
@@ -171,5 +171,8 @@ declare class OpenTenderAPI {
|
|
|
171
171
|
getCustomerHouseAccounts(token: string): Promise<unknown>;
|
|
172
172
|
putCustomerOrderRating(token: string, orderId: number, data: any): Promise<unknown>;
|
|
173
173
|
postClaimRewardCode(token: string, rewardCode: string): Promise<unknown>;
|
|
174
|
+
getStates(): Promise<unknown>;
|
|
175
|
+
getCitiesByState(state: string): Promise<unknown>;
|
|
176
|
+
getHomeStoresByCity(city: string): Promise<unknown>;
|
|
174
177
|
}
|
|
175
178
|
export default OpenTenderAPI;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -748,5 +748,14 @@ class OpenTenderAPI {
|
|
|
748
748
|
postClaimRewardCode(token, rewardCode) {
|
|
749
749
|
return this.request(`/claim-reward-code`, 'POST', { reward_code: rewardCode }, null, token);
|
|
750
750
|
}
|
|
751
|
+
getStates() {
|
|
752
|
+
return this.request(`/states-by-rc`);
|
|
753
|
+
}
|
|
754
|
+
getCitiesByState(state) {
|
|
755
|
+
return this.request(`/cities-by-rc-state?state=${state}`);
|
|
756
|
+
}
|
|
757
|
+
getHomeStoresByCity(city) {
|
|
758
|
+
return this.request(`/home-store-by-city?city=${city}`);
|
|
759
|
+
}
|
|
751
760
|
}
|
|
752
761
|
export default OpenTenderAPI;
|
|
@@ -86,6 +86,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
|
|
|
86
86
|
sidebar: import("./sidebar").SidebarState;
|
|
87
87
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
88
88
|
signUp: import("./signUp").SignUpState;
|
|
89
|
+
states: import("./states").StatesSlice;
|
|
89
90
|
tags: import("./tags").TagsState;
|
|
90
91
|
terms: import("./terms").TermsSlice;
|
|
91
92
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -83,6 +83,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
|
|
|
83
83
|
sidebar: import("./sidebar").SidebarState;
|
|
84
84
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
85
85
|
signUp: import("./signUp").SignUpState;
|
|
86
|
+
states: import("./states").StatesSlice;
|
|
86
87
|
tags: import("./tags").TagsState;
|
|
87
88
|
terms: import("./terms").TermsSlice;
|
|
88
89
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -166,6 +167,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
|
|
|
166
167
|
sidebar: import("./sidebar").SidebarState;
|
|
167
168
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
168
169
|
signUp: import("./signUp").SignUpState;
|
|
170
|
+
states: import("./states").StatesSlice;
|
|
169
171
|
tags: import("./tags").TagsState;
|
|
170
172
|
terms: import("./terms").TermsSlice;
|
|
171
173
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -148,6 +148,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
|
|
|
148
148
|
sidebar: import("./sidebar").SidebarState;
|
|
149
149
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
150
150
|
signUp: import("./signUp").SignUpState;
|
|
151
|
+
states: import("./states").StatesSlice;
|
|
151
152
|
tags: import("./tags").TagsState;
|
|
152
153
|
terms: import("./terms").TermsSlice;
|
|
153
154
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -226,6 +227,7 @@ export declare const selectShowLoyalty: ((state: import("redux").EmptyObject & {
|
|
|
226
227
|
sidebar: import("./sidebar").SidebarState;
|
|
227
228
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
228
229
|
signUp: import("./signUp").SignUpState;
|
|
230
|
+
states: import("./states").StatesSlice;
|
|
229
231
|
tags: import("./tags").TagsState;
|
|
230
232
|
terms: import("./terms").TermsSlice;
|
|
231
233
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -303,6 +305,7 @@ export declare const selectBottomTabsTitles: ((state: import("redux").EmptyObjec
|
|
|
303
305
|
sidebar: import("./sidebar").SidebarState;
|
|
304
306
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
305
307
|
signUp: import("./signUp").SignUpState;
|
|
308
|
+
states: import("./states").StatesSlice;
|
|
306
309
|
tags: import("./tags").TagsState;
|
|
307
310
|
terms: import("./terms").TermsSlice;
|
|
308
311
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -125,6 +125,7 @@ export declare const selectCustomerCreditCardsForPayment: ((state: import("redux
|
|
|
125
125
|
sidebar: import("..").SidebarState;
|
|
126
126
|
sidebarModal: import("..").SidebarModalState;
|
|
127
127
|
signUp: import("..").SignUpState;
|
|
128
|
+
states: import("..").StatesSlice;
|
|
128
129
|
tags: import("..").TagsState;
|
|
129
130
|
terms: import("..").TermsSlice;
|
|
130
131
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -82,6 +82,7 @@ export declare const selectCustomerLoyaltyProgram: ((state: import("redux").Empt
|
|
|
82
82
|
sidebar: import("..").SidebarState;
|
|
83
83
|
sidebarModal: import("..").SidebarModalState;
|
|
84
84
|
signUp: import("..").SignUpState;
|
|
85
|
+
states: import("..").StatesSlice;
|
|
85
86
|
tags: import("..").TagsState;
|
|
86
87
|
terms: import("..").TermsSlice;
|
|
87
88
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -163,6 +164,7 @@ export declare const selectHasPointsShop: ((state: import("redux").EmptyObject &
|
|
|
163
164
|
sidebar: import("..").SidebarState;
|
|
164
165
|
sidebarModal: import("..").SidebarModalState;
|
|
165
166
|
signUp: import("..").SignUpState;
|
|
167
|
+
states: import("..").StatesSlice;
|
|
166
168
|
tags: import("..").TagsState;
|
|
167
169
|
terms: import("..").TermsSlice;
|
|
168
170
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -234,6 +236,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
|
|
|
234
236
|
sidebar: import("..").SidebarState;
|
|
235
237
|
sidebarModal: import("..").SidebarModalState;
|
|
236
238
|
signUp: import("..").SignUpState;
|
|
239
|
+
states: import("..").StatesSlice;
|
|
237
240
|
tags: import("..").TagsState;
|
|
238
241
|
terms: import("..").TermsSlice;
|
|
239
242
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -92,6 +92,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
|
|
|
92
92
|
sidebar: import("..").SidebarState;
|
|
93
93
|
sidebarModal: import("..").SidebarModalState;
|
|
94
94
|
signUp: import("..").SignUpState;
|
|
95
|
+
states: import("..").StatesSlice;
|
|
95
96
|
tags: import("..").TagsState;
|
|
96
97
|
terms: import("..").TermsSlice;
|
|
97
98
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -90,6 +90,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
|
|
|
90
90
|
sidebar: import("..").SidebarState;
|
|
91
91
|
sidebarModal: import("..").SidebarModalState;
|
|
92
92
|
signUp: import("..").SignUpState;
|
|
93
|
+
states: import("..").StatesSlice;
|
|
93
94
|
tags: import("..").TagsState;
|
|
94
95
|
terms: import("..").TermsSlice;
|
|
95
96
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -159,6 +160,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
|
|
|
159
160
|
sidebar: import("..").SidebarState;
|
|
160
161
|
sidebarModal: import("..").SidebarModalState;
|
|
161
162
|
signUp: import("..").SignUpState;
|
|
163
|
+
states: import("..").StatesSlice;
|
|
162
164
|
tags: import("..").TagsState;
|
|
163
165
|
terms: import("..").TermsSlice;
|
|
164
166
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -228,6 +230,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
|
|
|
228
230
|
sidebar: import("..").SidebarState;
|
|
229
231
|
sidebarModal: import("..").SidebarModalState;
|
|
230
232
|
signUp: import("..").SignUpState;
|
|
233
|
+
states: import("..").StatesSlice;
|
|
231
234
|
tags: import("..").TagsState;
|
|
232
235
|
terms: import("..").TermsSlice;
|
|
233
236
|
Unsubscribe: import("..").UnsubscribeState;
|
|
@@ -165,6 +165,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
|
|
|
165
165
|
sidebar: import("./sidebar").SidebarState;
|
|
166
166
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
167
167
|
signUp: import("./signUp").SignUpState;
|
|
168
|
+
states: import("./states").StatesSlice;
|
|
168
169
|
tags: import("./tags").TagsState;
|
|
169
170
|
terms: import("./terms").TermsSlice;
|
|
170
171
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -237,6 +238,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
|
|
|
237
238
|
sidebar: import("./sidebar").SidebarState;
|
|
238
239
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
239
240
|
signUp: import("./signUp").SignUpState;
|
|
241
|
+
states: import("./states").StatesSlice;
|
|
240
242
|
tags: import("./tags").TagsState;
|
|
241
243
|
terms: import("./terms").TermsSlice;
|
|
242
244
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -311,6 +313,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
|
|
|
311
313
|
sidebar: import("./sidebar").SidebarState;
|
|
312
314
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
313
315
|
signUp: import("./signUp").SignUpState;
|
|
316
|
+
states: import("./states").StatesSlice;
|
|
314
317
|
tags: import("./tags").TagsState;
|
|
315
318
|
terms: import("./terms").TermsSlice;
|
|
316
319
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -394,6 +397,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
|
|
|
394
397
|
sidebar: import("./sidebar").SidebarState;
|
|
395
398
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
396
399
|
signUp: import("./signUp").SignUpState;
|
|
400
|
+
states: import("./states").StatesSlice;
|
|
397
401
|
tags: import("./tags").TagsState;
|
|
398
402
|
terms: import("./terms").TermsSlice;
|
|
399
403
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -193,6 +193,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
|
|
|
193
193
|
sidebar: import("./sidebar").SidebarState;
|
|
194
194
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
195
195
|
signUp: import("./signUp").SignUpState;
|
|
196
|
+
states: import("./states").StatesSlice;
|
|
196
197
|
tags: import("./tags").TagsState;
|
|
197
198
|
terms: import("./terms").TermsSlice;
|
|
198
199
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -273,6 +274,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
|
|
|
273
274
|
sidebar: import("./sidebar").SidebarState;
|
|
274
275
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
275
276
|
signUp: import("./signUp").SignUpState;
|
|
277
|
+
states: import("./states").StatesSlice;
|
|
276
278
|
tags: import("./tags").TagsState;
|
|
277
279
|
terms: import("./terms").TermsSlice;
|
|
278
280
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -348,6 +350,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
|
|
|
348
350
|
sidebar: import("./sidebar").SidebarState;
|
|
349
351
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
350
352
|
signUp: import("./signUp").SignUpState;
|
|
353
|
+
states: import("./states").StatesSlice;
|
|
351
354
|
tags: import("./tags").TagsState;
|
|
352
355
|
terms: import("./terms").TermsSlice;
|
|
353
356
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -78,6 +78,7 @@ export declare const selectQuote: ((state: import("redux").EmptyObject & {
|
|
|
78
78
|
sidebar: import("./sidebar").SidebarState;
|
|
79
79
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
80
80
|
signUp: import("./signUp").SignUpState;
|
|
81
|
+
states: import("./states").StatesSlice;
|
|
81
82
|
tags: import("./tags").TagsState;
|
|
82
83
|
terms: import("./terms").TermsSlice;
|
|
83
84
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface StatesSlice {
|
|
4
|
+
states: string[];
|
|
5
|
+
cities: string[];
|
|
6
|
+
homeStores: Array<[string, string]>;
|
|
7
|
+
statesLoading: RequestStatus;
|
|
8
|
+
citiesLoading: RequestStatus;
|
|
9
|
+
homeStoresLoading: RequestStatus;
|
|
10
|
+
error: RequestError;
|
|
11
|
+
}
|
|
12
|
+
export declare const fetchStates: import("@reduxjs/toolkit").AsyncThunk<string[], void, {
|
|
13
|
+
state: AppState;
|
|
14
|
+
rejectValue: RequestError;
|
|
15
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
16
|
+
extra?: unknown;
|
|
17
|
+
serializedErrorType?: unknown;
|
|
18
|
+
pendingMeta?: unknown;
|
|
19
|
+
fulfilledMeta?: unknown;
|
|
20
|
+
rejectedMeta?: unknown;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const fetchCitiesByState: import("@reduxjs/toolkit").AsyncThunk<string[], string, {
|
|
23
|
+
state: AppState;
|
|
24
|
+
rejectValue: RequestError;
|
|
25
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
26
|
+
extra?: unknown;
|
|
27
|
+
serializedErrorType?: unknown;
|
|
28
|
+
pendingMeta?: unknown;
|
|
29
|
+
fulfilledMeta?: unknown;
|
|
30
|
+
rejectedMeta?: unknown;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const fetchHomeStoresByCity: import("@reduxjs/toolkit").AsyncThunk<[string, string][], string, {
|
|
33
|
+
state: AppState;
|
|
34
|
+
rejectValue: RequestError;
|
|
35
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
36
|
+
extra?: unknown;
|
|
37
|
+
serializedErrorType?: unknown;
|
|
38
|
+
pendingMeta?: unknown;
|
|
39
|
+
fulfilledMeta?: unknown;
|
|
40
|
+
rejectedMeta?: unknown;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const resetStates: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"states/resetStates">;
|
|
43
|
+
export declare const selectStates: (state: AppState) => StatesSlice;
|
|
44
|
+
export declare const statesReducer: import("redux").Reducer<StatesSlice, import("redux").AnyAction>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
const initialState = {
|
|
4
|
+
states: [],
|
|
5
|
+
cities: [],
|
|
6
|
+
homeStores: [],
|
|
7
|
+
statesLoading: 'idle',
|
|
8
|
+
citiesLoading: 'idle',
|
|
9
|
+
homeStoresLoading: 'idle',
|
|
10
|
+
error: null
|
|
11
|
+
};
|
|
12
|
+
export const fetchStates = createAsyncThunk('states/fetchStates', (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const { api } = getState().config;
|
|
14
|
+
if (!api)
|
|
15
|
+
return;
|
|
16
|
+
try {
|
|
17
|
+
const api = getState().config.api;
|
|
18
|
+
if (!api)
|
|
19
|
+
return null;
|
|
20
|
+
const { data } = yield api.getStates();
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const error = err;
|
|
25
|
+
return rejectWithValue(error);
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
export const fetchCitiesByState = createAsyncThunk('states/fetchCitiesByState', (state, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const { api } = getState().config;
|
|
30
|
+
if (!api)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
const api = getState().config.api;
|
|
34
|
+
if (!api)
|
|
35
|
+
return null;
|
|
36
|
+
const { data } = yield api.getCitiesByState(state);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const error = err;
|
|
41
|
+
return rejectWithValue(error);
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
export const fetchHomeStoresByCity = createAsyncThunk('states/fetchHomeStoresByCity', (city, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
const { api } = getState().config;
|
|
46
|
+
if (!api)
|
|
47
|
+
return;
|
|
48
|
+
try {
|
|
49
|
+
const api = getState().config.api;
|
|
50
|
+
if (!api)
|
|
51
|
+
return null;
|
|
52
|
+
const { data } = yield api.getHomeStoresByCity(city);
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
const error = err;
|
|
57
|
+
return rejectWithValue(error);
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
const statesSlice = createSlice({
|
|
61
|
+
name: 'states',
|
|
62
|
+
initialState: initialState,
|
|
63
|
+
reducers: {
|
|
64
|
+
resetStates: () => initialState
|
|
65
|
+
},
|
|
66
|
+
extraReducers: builder => {
|
|
67
|
+
builder
|
|
68
|
+
.addCase(fetchStates.fulfilled, (state, action) => {
|
|
69
|
+
state.states = action.payload || [];
|
|
70
|
+
state.statesLoading = 'idle';
|
|
71
|
+
state.error = null;
|
|
72
|
+
})
|
|
73
|
+
.addCase(fetchStates.pending, state => {
|
|
74
|
+
state.statesLoading = 'pending';
|
|
75
|
+
})
|
|
76
|
+
.addCase(fetchStates.rejected, (state, action) => {
|
|
77
|
+
state.statesLoading = 'idle';
|
|
78
|
+
state.error = action.payload;
|
|
79
|
+
});
|
|
80
|
+
builder
|
|
81
|
+
.addCase(fetchCitiesByState.fulfilled, (state, action) => {
|
|
82
|
+
state.cities = action.payload || [];
|
|
83
|
+
state.citiesLoading = 'idle';
|
|
84
|
+
state.error = null;
|
|
85
|
+
})
|
|
86
|
+
.addCase(fetchCitiesByState.pending, state => {
|
|
87
|
+
state.citiesLoading = 'pending';
|
|
88
|
+
})
|
|
89
|
+
.addCase(fetchCitiesByState.rejected, (state, action) => {
|
|
90
|
+
state.citiesLoading = 'idle';
|
|
91
|
+
state.error = action.payload;
|
|
92
|
+
});
|
|
93
|
+
builder
|
|
94
|
+
.addCase(fetchHomeStoresByCity.fulfilled, (state, action) => {
|
|
95
|
+
state.homeStores = action.payload || [];
|
|
96
|
+
state.homeStoresLoading = 'idle';
|
|
97
|
+
state.error = null;
|
|
98
|
+
})
|
|
99
|
+
.addCase(fetchHomeStoresByCity.pending, state => {
|
|
100
|
+
state.homeStoresLoading = 'pending';
|
|
101
|
+
})
|
|
102
|
+
.addCase(fetchHomeStoresByCity.rejected, (state, action) => {
|
|
103
|
+
state.homeStoresLoading = 'idle';
|
|
104
|
+
state.error = action.payload;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export const { resetStates } = statesSlice.actions;
|
|
109
|
+
export const selectStates = (state) => state.states;
|
|
110
|
+
export const statesReducer = statesSlice.reducer;
|
|
@@ -86,6 +86,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
|
|
|
86
86
|
sidebar: import("./sidebar").SidebarState;
|
|
87
87
|
sidebarModal: import("./sidebarModal").SidebarModalState;
|
|
88
88
|
signUp: import("./signUp").SignUpState;
|
|
89
|
+
states: import("./states").StatesSlice;
|
|
89
90
|
tags: TagsState;
|
|
90
91
|
terms: import("./terms").TermsSlice;
|
|
91
92
|
Unsubscribe: import("./unsubscribe").UnsubscribeState;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -53,6 +53,7 @@ export var ReducerType;
|
|
|
53
53
|
ReducerType["Sidebar"] = "sidebar";
|
|
54
54
|
ReducerType["SidebarModal"] = "sidebarModal";
|
|
55
55
|
ReducerType["SignUp"] = "signUp";
|
|
56
|
+
ReducerType["States"] = "states";
|
|
56
57
|
ReducerType["Tags"] = "tags";
|
|
57
58
|
ReducerType["Terms"] = "terms";
|
|
58
59
|
ReducerType["Thanx"] = "thanx";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.35",
|
|
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",
|