@open-tender/cloud 0.1.80 → 0.1.82

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.
Files changed (43) hide show
  1. package/dist/cjs/app/hooks.d.ts +1 -0
  2. package/dist/cjs/app/store.d.ts +3 -0
  3. package/dist/cjs/app/store.js +1 -0
  4. package/dist/cjs/services/api.d.ts +2 -1
  5. package/dist/cjs/services/api.js +3 -0
  6. package/dist/cjs/slices/allergens.d.ts +1 -0
  7. package/dist/cjs/slices/announcements.d.ts +2 -0
  8. package/dist/cjs/slices/config.d.ts +1 -0
  9. package/dist/cjs/slices/customer/loyalty.d.ts +1 -0
  10. package/dist/cjs/slices/customer/order.d.ts +1 -0
  11. package/dist/cjs/slices/customer/tpls.d.ts +3 -0
  12. package/dist/cjs/slices/groupOrder.d.ts +4 -0
  13. package/dist/cjs/slices/index.d.ts +1 -0
  14. package/dist/cjs/slices/index.js +1 -0
  15. package/dist/cjs/slices/order.d.ts +3 -0
  16. package/dist/cjs/slices/signUp.js +4 -5
  17. package/dist/cjs/slices/tags.d.ts +1 -0
  18. package/dist/cjs/slices/terms.d.ts +20 -0
  19. package/dist/cjs/slices/terms.js +51 -0
  20. package/dist/cjs/slices/types.d.ts +1 -0
  21. package/dist/cjs/slices/types.js +1 -0
  22. package/dist/esm/app/hooks.d.ts +1 -0
  23. package/dist/esm/app/store.d.ts +3 -0
  24. package/dist/esm/app/store.js +2 -1
  25. package/dist/esm/services/api.d.ts +2 -1
  26. package/dist/esm/services/api.js +3 -0
  27. package/dist/esm/slices/allergens.d.ts +1 -0
  28. package/dist/esm/slices/announcements.d.ts +2 -0
  29. package/dist/esm/slices/config.d.ts +1 -0
  30. package/dist/esm/slices/customer/loyalty.d.ts +1 -0
  31. package/dist/esm/slices/customer/order.d.ts +1 -0
  32. package/dist/esm/slices/customer/tpls.d.ts +3 -0
  33. package/dist/esm/slices/groupOrder.d.ts +4 -0
  34. package/dist/esm/slices/index.d.ts +1 -0
  35. package/dist/esm/slices/index.js +1 -0
  36. package/dist/esm/slices/order.d.ts +3 -0
  37. package/dist/esm/slices/signUp.js +4 -5
  38. package/dist/esm/slices/tags.d.ts +1 -0
  39. package/dist/esm/slices/terms.d.ts +20 -0
  40. package/dist/esm/slices/terms.js +47 -0
  41. package/dist/esm/slices/types.d.ts +1 -0
  42. package/dist/esm/slices/types.js +1 -0
  43. package/package.json +3 -3
@@ -55,6 +55,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
55
55
  sidebarModal: import("..").SidebarModalState;
56
56
  signUp: import("..").SignUpState;
57
57
  tags: import("..").TagsState;
58
+ terms: import("..").TermsSlice;
58
59
  validTimes: import("..").ValidTimesState;
59
60
  verifyAccount: import("..").VerifyAccountState;
60
61
  }>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
@@ -54,6 +54,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
54
54
  sidebarModal: import("../slices").SidebarModalState;
55
55
  signUp: import("../slices").SignUpState;
56
56
  tags: import("../slices").TagsState;
57
+ terms: import("../slices").TermsSlice;
57
58
  validTimes: import("../slices").ValidTimesState;
58
59
  verifyAccount: import("../slices").VerifyAccountState;
59
60
  }>, import("redux").AnyAction>;
@@ -113,6 +114,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
113
114
  sidebarModal: import("../slices").SidebarModalState;
114
115
  signUp: import("../slices").SignUpState;
115
116
  tags: import("../slices").TagsState;
117
+ terms: import("../slices").TermsSlice;
116
118
  validTimes: import("../slices").ValidTimesState;
117
119
  verifyAccount: import("../slices").VerifyAccountState;
118
120
  }, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
@@ -170,6 +172,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
170
172
  sidebarModal: import("../slices").SidebarModalState;
171
173
  signUp: import("../slices").SignUpState;
172
174
  tags: import("../slices").TagsState;
175
+ terms: import("../slices").TermsSlice;
173
176
  validTimes: import("../slices").ValidTimesState;
174
177
  verifyAccount: import("../slices").VerifyAccountState;
175
178
  }>, import("redux").AnyAction, undefined>]>>;
@@ -40,6 +40,7 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
40
40
  [types_1.ReducerType.SidebarModal]: slices_1.sidebarModalReducer,
41
41
  [types_1.ReducerType.SignUp]: slices_1.signUpReducer,
42
42
  [types_1.ReducerType.Tags]: slices_1.tagsReducer,
43
+ [types_1.ReducerType.Terms]: slices_1.termsReducer,
43
44
  [types_1.ReducerType.ValidTimes]: slices_1.validTimesReducer,
44
45
  [types_1.ReducerType.VerifyAccount]: slices_1.verifyAccountReducer
45
46
  });
@@ -1,4 +1,4 @@
1
- import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OneTimePasscode, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
1
+ import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OneTimePasscode, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday } from '@open-tender/types';
2
2
  declare class OpenTenderAPI {
3
3
  brandId?: string;
4
4
  clientId?: string;
@@ -67,6 +67,7 @@ declare class OpenTenderAPI {
67
67
  getMenuItems(revenueCenterId: number, serviceType: ServiceType): Promise<unknown>;
68
68
  getMenuDisplay(revenueCenterId: number, serviceType: ServiceType, weekday: Weekday, minutes: number): Promise<unknown>;
69
69
  getMenuPages(): Promise<unknown>;
70
+ getTerms(): Promise<TPLSTerms | null | undefined>;
70
71
  getDeals(customerId: number): Promise<unknown>;
71
72
  getAnnouncements(page: string): Promise<unknown>;
72
73
  getAnnouncementPage(page: string): Promise<unknown>;
@@ -357,6 +357,9 @@ class OpenTenderAPI {
357
357
  getMenuPages() {
358
358
  return this.request(`/menu-pages`);
359
359
  }
360
+ getTerms() {
361
+ return this.request(`/terms`);
362
+ }
360
363
  getDeals(customerId) {
361
364
  const params = customerId ? `&customer_id=${customerId}` : '';
362
365
  return this.request(`/deals?with_related=true${params}`);
@@ -82,6 +82,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
82
82
  sidebarModal: import("./sidebarModal").SidebarModalState;
83
83
  signUp: import("./signUp").SignUpState;
84
84
  tags: import("./tags").TagsState;
85
+ terms: import("./terms").TermsSlice;
85
86
  validTimes: import("./validTimes").ValidTimesState;
86
87
  verifyAccount: import("./verifyAccount").VerifyAccountState;
87
88
  }) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
@@ -79,6 +79,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
79
79
  sidebarModal: import("./sidebarModal").SidebarModalState;
80
80
  signUp: import("./signUp").SignUpState;
81
81
  tags: import("./tags").TagsState;
82
+ terms: import("./terms").TermsSlice;
82
83
  validTimes: import("./validTimes").ValidTimesState;
83
84
  verifyAccount: import("./verifyAccount").VerifyAccountState;
84
85
  }) => {
@@ -155,6 +156,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
155
156
  sidebarModal: import("./sidebarModal").SidebarModalState;
156
157
  signUp: import("./signUp").SignUpState;
157
158
  tags: import("./tags").TagsState;
159
+ terms: import("./terms").TermsSlice;
158
160
  validTimes: import("./validTimes").ValidTimesState;
159
161
  verifyAccount: import("./verifyAccount").VerifyAccountState;
160
162
  }) => boolean) & import("reselect").OutputSelectorFields<(args_0: {
@@ -138,6 +138,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
138
138
  sidebarModal: import("./sidebarModal").SidebarModalState;
139
139
  signUp: import("./signUp").SignUpState;
140
140
  tags: import("./tags").TagsState;
141
+ terms: import("./terms").TermsSlice;
141
142
  validTimes: import("./validTimes").ValidTimesState;
142
143
  verifyAccount: import("./verifyAccount").VerifyAccountState;
143
144
  }) => {
@@ -83,6 +83,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
83
83
  sidebarModal: import("..").SidebarModalState;
84
84
  signUp: import("..").SignUpState;
85
85
  tags: import("..").TagsState;
86
+ terms: import("..").TermsSlice;
86
87
  validTimes: import("..").ValidTimesState;
87
88
  verifyAccount: import("..").VerifyAccountState;
88
89
  }) => import("@open-tender/types").CustomerLoyalty | null) & import("reselect").OutputSelectorFields<(args_0: {
@@ -88,6 +88,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
88
88
  sidebarModal: import("..").SidebarModalState;
89
89
  signUp: import("..").SignUpState;
90
90
  tags: import("..").TagsState;
91
+ terms: import("..").TermsSlice;
91
92
  validTimes: import("..").ValidTimesState;
92
93
  verifyAccount: import("..").VerifyAccountState;
93
94
  }) => {
@@ -75,6 +75,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
75
75
  sidebarModal: import("..").SidebarModalState;
76
76
  signUp: import("..").SignUpState;
77
77
  tags: import("..").TagsState;
78
+ terms: import("..").TermsSlice;
78
79
  validTimes: import("..").ValidTimesState;
79
80
  verifyAccount: import("..").VerifyAccountState;
80
81
  }) => number | null) & import("reselect").OutputSelectorFields<(args_0: import("@open-tender/types").TPLSPoints | null | undefined) => number | null, {
@@ -137,6 +138,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
137
138
  sidebarModal: import("..").SidebarModalState;
138
139
  signUp: import("..").SignUpState;
139
140
  tags: import("..").TagsState;
141
+ terms: import("..").TermsSlice;
140
142
  validTimes: import("..").ValidTimesState;
141
143
  verifyAccount: import("..").VerifyAccountState;
142
144
  }) => import("@open-tender/types").TPLSRewards) & import("reselect").OutputSelectorFields<(args_0: import("@open-tender/types").TPLSRewards | undefined) => import("@open-tender/types").TPLSRewards, {
@@ -199,6 +201,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
199
201
  sidebarModal: import("..").SidebarModalState;
200
202
  signUp: import("..").SignUpState;
201
203
  tags: import("..").TagsState;
204
+ terms: import("..").TermsSlice;
202
205
  validTimes: import("..").ValidTimesState;
203
206
  verifyAccount: import("..").VerifyAccountState;
204
207
  }) => import("@open-tender/types").TPLSProgress | null) & import("reselect").OutputSelectorFields<(args_0: import("@open-tender/types").TPLSProgress | null | undefined) => import("@open-tender/types").TPLSProgress | null, {
@@ -161,6 +161,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
161
161
  sidebarModal: import("./sidebarModal").SidebarModalState;
162
162
  signUp: import("./signUp").SignUpState;
163
163
  tags: import("./tags").TagsState;
164
+ terms: import("./terms").TermsSlice;
164
165
  validTimes: import("./validTimes").ValidTimesState;
165
166
  verifyAccount: import("./verifyAccount").VerifyAccountState;
166
167
  }) => number | null) & import("reselect").OutputSelectorFields<(args_0: {
@@ -226,6 +227,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
226
227
  sidebarModal: import("./sidebarModal").SidebarModalState;
227
228
  signUp: import("./signUp").SignUpState;
228
229
  tags: import("./tags").TagsState;
230
+ terms: import("./terms").TermsSlice;
229
231
  validTimes: import("./validTimes").ValidTimesState;
230
232
  verifyAccount: import("./verifyAccount").VerifyAccountState;
231
233
  }) => boolean | null) & import("reselect").OutputSelectorFields<(args_0: {
@@ -293,6 +295,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
293
295
  sidebarModal: import("./sidebarModal").SidebarModalState;
294
296
  signUp: import("./signUp").SignUpState;
295
297
  tags: import("./tags").TagsState;
298
+ terms: import("./terms").TermsSlice;
296
299
  validTimes: import("./validTimes").ValidTimesState;
297
300
  verifyAccount: import("./verifyAccount").VerifyAccountState;
298
301
  }) => {
@@ -369,6 +372,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
369
372
  sidebarModal: import("./sidebarModal").SidebarModalState;
370
373
  signUp: import("./signUp").SignUpState;
371
374
  tags: import("./tags").TagsState;
375
+ terms: import("./terms").TermsSlice;
372
376
  validTimes: import("./validTimes").ValidTimesState;
373
377
  verifyAccount: import("./verifyAccount").VerifyAccountState;
374
378
  }) => {
@@ -33,5 +33,6 @@ export * from './sidebar';
33
33
  export * from './sidebarModal';
34
34
  export * from './signUp';
35
35
  export * from './tags';
36
+ export * from './terms';
36
37
  export * from './validTimes';
37
38
  export * from './verifyAccount';
@@ -36,5 +36,6 @@ tslib_1.__exportStar(require("./sidebar"), exports);
36
36
  tslib_1.__exportStar(require("./sidebarModal"), exports);
37
37
  tslib_1.__exportStar(require("./signUp"), exports);
38
38
  tslib_1.__exportStar(require("./tags"), exports);
39
+ tslib_1.__exportStar(require("./terms"), exports);
39
40
  tslib_1.__exportStar(require("./validTimes"), exports);
40
41
  tslib_1.__exportStar(require("./verifyAccount"), exports);
@@ -183,6 +183,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
183
183
  sidebarModal: import("./sidebarModal").SidebarModalState;
184
184
  signUp: import("./signUp").SignUpState;
185
185
  tags: import("./tags").TagsState;
186
+ terms: import("./terms").TermsSlice;
186
187
  validTimes: import("./validTimes").ValidTimesState;
187
188
  verifyAccount: import("./verifyAccount").VerifyAccountState;
188
189
  }) => {
@@ -256,6 +257,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
256
257
  sidebarModal: import("./sidebarModal").SidebarModalState;
257
258
  signUp: import("./signUp").SignUpState;
258
259
  tags: import("./tags").TagsState;
260
+ terms: import("./terms").TermsSlice;
259
261
  validTimes: import("./validTimes").ValidTimesState;
260
262
  verifyAccount: import("./verifyAccount").VerifyAccountState;
261
263
  }) => number[]) & import("reselect").OutputSelectorFields<(args_0: Cart | null) => number[], {
@@ -324,6 +326,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
324
326
  sidebarModal: import("./sidebarModal").SidebarModalState;
325
327
  signUp: import("./signUp").SignUpState;
326
328
  tags: import("./tags").TagsState;
329
+ terms: import("./terms").TermsSlice;
327
330
  validTimes: import("./validTimes").ValidTimesState;
328
331
  verifyAccount: import("./verifyAccount").VerifyAccountState;
329
332
  }) => {
@@ -14,14 +14,13 @@ var SignUpActionType;
14
14
  SignUpActionType["SignUpCustomer"] = "signUp/signUpCustomer";
15
15
  })(SignUpActionType = exports.SignUpActionType || (exports.SignUpActionType = {}));
16
16
  exports.signUpCustomer = (0, toolkit_1.createAsyncThunk)(SignUpActionType.SignUpCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
17
- var _a, _b;
18
17
  try {
19
18
  const api = getState().config.api;
20
19
  const response = yield api.postSignUp(data);
21
- dispatch((0, customer_1.loginCustomer)({
22
- email: (_a = data.email) !== null && _a !== void 0 ? _a : '',
23
- password: (_b = data.password) !== null && _b !== void 0 ? _b : ''
24
- }));
20
+ const { email, password } = data;
21
+ if (email && password) {
22
+ dispatch((0, customer_1.loginCustomer)({ email, password }));
23
+ }
25
24
  if (callback)
26
25
  callback(response);
27
26
  return;
@@ -82,6 +82,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
82
82
  sidebarModal: import("./sidebarModal").SidebarModalState;
83
83
  signUp: import("./signUp").SignUpState;
84
84
  tags: TagsState;
85
+ terms: import("./terms").TermsSlice;
85
86
  validTimes: import("./validTimes").ValidTimesState;
86
87
  verifyAccount: import("./verifyAccount").VerifyAccountState;
87
88
  }) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
@@ -0,0 +1,20 @@
1
+ import { RequestError, RequestStatus, TPLSTerms } from '@open-tender/types';
2
+ import { AppState } from '../app';
3
+ export interface TermsSlice {
4
+ terms: TPLSTerms | null;
5
+ loading: RequestStatus;
6
+ error: RequestError;
7
+ }
8
+ export declare const fetchTerms: import("@reduxjs/toolkit").AsyncThunk<TPLSTerms, void, {
9
+ state: AppState;
10
+ rejectValue: RequestError;
11
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
12
+ extra?: unknown;
13
+ serializedErrorType?: unknown;
14
+ pendingMeta?: unknown;
15
+ fulfilledMeta?: unknown;
16
+ rejectedMeta?: unknown;
17
+ }>;
18
+ export declare const resetTerms: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"terms/resetTerms">;
19
+ export declare const selectTerms: (state: AppState) => TermsSlice;
20
+ export declare const termsReducer: import("redux").Reducer<TermsSlice, import("redux").AnyAction>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.termsReducer = exports.selectTerms = exports.resetTerms = exports.fetchTerms = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const initialState = {
7
+ terms: null,
8
+ loading: 'idle',
9
+ error: null
10
+ };
11
+ exports.fetchTerms = (0, toolkit_1.createAsyncThunk)('terms/getTerms', (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
12
+ const { api } = getState().config;
13
+ if (!api)
14
+ return;
15
+ try {
16
+ const api = getState().config.api;
17
+ if (!api)
18
+ return null;
19
+ return yield api.getTerms();
20
+ }
21
+ catch (err) {
22
+ const error = err;
23
+ return rejectWithValue(error);
24
+ }
25
+ }));
26
+ const termsSlice = (0, toolkit_1.createSlice)({
27
+ name: 'terms',
28
+ initialState: initialState,
29
+ reducers: {
30
+ resetTerms: () => initialState
31
+ },
32
+ extraReducers: builder => {
33
+ builder
34
+ .addCase(exports.fetchTerms.fulfilled, (state, action) => {
35
+ state.terms = action.payload;
36
+ state.loading = 'idle';
37
+ state.error = null;
38
+ })
39
+ .addCase(exports.fetchTerms.pending, state => {
40
+ state.loading = 'pending';
41
+ })
42
+ .addCase(exports.fetchTerms.rejected, (state, action) => {
43
+ state.loading = 'idle';
44
+ state.error = action.payload;
45
+ });
46
+ }
47
+ });
48
+ exports.resetTerms = termsSlice.actions.resetTerms;
49
+ const selectTerms = (state) => state.terms;
50
+ exports.selectTerms = selectTerms;
51
+ exports.termsReducer = termsSlice.reducer;
@@ -49,6 +49,7 @@ export declare enum ReducerType {
49
49
  SidebarModal = "sidebarModal",
50
50
  SignUp = "signUp",
51
51
  Tags = "tags",
52
+ Terms = "terms",
52
53
  Thanx = "thanx",
53
54
  Tpls = "tpls",
54
55
  ValidTimes = "validTimes",
@@ -53,6 +53,7 @@ var ReducerType;
53
53
  ReducerType["SidebarModal"] = "sidebarModal";
54
54
  ReducerType["SignUp"] = "signUp";
55
55
  ReducerType["Tags"] = "tags";
56
+ ReducerType["Terms"] = "terms";
56
57
  ReducerType["Thanx"] = "thanx";
57
58
  ReducerType["Tpls"] = "tpls";
58
59
  ReducerType["ValidTimes"] = "validTimes";
@@ -55,6 +55,7 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
55
55
  sidebarModal: import("..").SidebarModalState;
56
56
  signUp: import("..").SignUpState;
57
57
  tags: import("..").TagsState;
58
+ terms: import("..").TermsSlice;
58
59
  validTimes: import("..").ValidTimesState;
59
60
  verifyAccount: import("..").VerifyAccountState;
60
61
  }>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
@@ -54,6 +54,7 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
54
54
  sidebarModal: import("../slices").SidebarModalState;
55
55
  signUp: import("../slices").SignUpState;
56
56
  tags: import("../slices").TagsState;
57
+ terms: import("../slices").TermsSlice;
57
58
  validTimes: import("../slices").ValidTimesState;
58
59
  verifyAccount: import("../slices").VerifyAccountState;
59
60
  }>, import("redux").AnyAction>;
@@ -113,6 +114,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
113
114
  sidebarModal: import("../slices").SidebarModalState;
114
115
  signUp: import("../slices").SignUpState;
115
116
  tags: import("../slices").TagsState;
117
+ terms: import("../slices").TermsSlice;
116
118
  validTimes: import("../slices").ValidTimesState;
117
119
  verifyAccount: import("../slices").VerifyAccountState;
118
120
  }, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<import("redux").CombinedState<{
@@ -170,6 +172,7 @@ declare const store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore
170
172
  sidebarModal: import("../slices").SidebarModalState;
171
173
  signUp: import("../slices").SignUpState;
172
174
  tags: import("../slices").TagsState;
175
+ terms: import("../slices").TermsSlice;
173
176
  validTimes: import("../slices").ValidTimesState;
174
177
  verifyAccount: import("../slices").VerifyAccountState;
175
178
  }>, import("redux").AnyAction, undefined>]>>;
@@ -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, qrReducer, resetPasswordReducer, revenueCentersReducer, sidebarModalReducer, sidebarReducer, signUpReducer, tagsReducer, 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, qrReducer, resetPasswordReducer, revenueCentersReducer, sidebarModalReducer, sidebarReducer, signUpReducer, tagsReducer, termsReducer, validTimesReducer, verifyAccountReducer } from '../slices';
3
3
  import { ReducerType } from '../slices/types';
4
4
  export const appReducer = combineReducers({
5
5
  [ReducerType.Alerts]: alertsReducer,
@@ -37,6 +37,7 @@ export const appReducer = combineReducers({
37
37
  [ReducerType.SidebarModal]: sidebarModalReducer,
38
38
  [ReducerType.SignUp]: signUpReducer,
39
39
  [ReducerType.Tags]: tagsReducer,
40
+ [ReducerType.Terms]: termsReducer,
40
41
  [ReducerType.ValidTimes]: validTimesReducer,
41
42
  [ReducerType.VerifyAccount]: verifyAccountReducer
42
43
  });
@@ -1,4 +1,4 @@
1
- import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OneTimePasscode, OrderType, RevenueCenterType, ServiceType, Weekday } from '@open-tender/types';
1
+ import { Auth, ConfigApp, Customer, CustomerCreate, GroupOrder, GroupOrdersExpanded, OneTimePasscode, OrderType, RevenueCenterType, ServiceType, TPLSTerms, Weekday } from '@open-tender/types';
2
2
  declare class OpenTenderAPI {
3
3
  brandId?: string;
4
4
  clientId?: string;
@@ -67,6 +67,7 @@ declare class OpenTenderAPI {
67
67
  getMenuItems(revenueCenterId: number, serviceType: ServiceType): Promise<unknown>;
68
68
  getMenuDisplay(revenueCenterId: number, serviceType: ServiceType, weekday: Weekday, minutes: number): Promise<unknown>;
69
69
  getMenuPages(): Promise<unknown>;
70
+ getTerms(): Promise<TPLSTerms | null | undefined>;
70
71
  getDeals(customerId: number): Promise<unknown>;
71
72
  getAnnouncements(page: string): Promise<unknown>;
72
73
  getAnnouncementPage(page: string): Promise<unknown>;
@@ -355,6 +355,9 @@ class OpenTenderAPI {
355
355
  getMenuPages() {
356
356
  return this.request(`/menu-pages`);
357
357
  }
358
+ getTerms() {
359
+ return this.request(`/terms`);
360
+ }
358
361
  getDeals(customerId) {
359
362
  const params = customerId ? `&customer_id=${customerId}` : '';
360
363
  return this.request(`/deals?with_related=true${params}`);
@@ -82,6 +82,7 @@ export declare const selectSelectedAllergenNames: ((state: import("redux").Empty
82
82
  sidebarModal: import("./sidebarModal").SidebarModalState;
83
83
  signUp: import("./signUp").SignUpState;
84
84
  tags: import("./tags").TagsState;
85
+ terms: import("./terms").TermsSlice;
85
86
  validTimes: import("./validTimes").ValidTimesState;
86
87
  verifyAccount: import("./verifyAccount").VerifyAccountState;
87
88
  }) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
@@ -79,6 +79,7 @@ export declare const selectAnnouncementsPage: (page: AnnouncementPageType) => ((
79
79
  sidebarModal: import("./sidebarModal").SidebarModalState;
80
80
  signUp: import("./signUp").SignUpState;
81
81
  tags: import("./tags").TagsState;
82
+ terms: import("./terms").TermsSlice;
82
83
  validTimes: import("./validTimes").ValidTimesState;
83
84
  verifyAccount: import("./verifyAccount").VerifyAccountState;
84
85
  }) => {
@@ -155,6 +156,7 @@ export declare const selectHasAnnouncementsPage: (page: AnnouncementPageType) =>
155
156
  sidebarModal: import("./sidebarModal").SidebarModalState;
156
157
  signUp: import("./signUp").SignUpState;
157
158
  tags: import("./tags").TagsState;
159
+ terms: import("./terms").TermsSlice;
158
160
  validTimes: import("./validTimes").ValidTimesState;
159
161
  verifyAccount: import("./verifyAccount").VerifyAccountState;
160
162
  }) => boolean) & import("reselect").OutputSelectorFields<(args_0: {
@@ -138,6 +138,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
138
138
  sidebarModal: import("./sidebarModal").SidebarModalState;
139
139
  signUp: import("./signUp").SignUpState;
140
140
  tags: import("./tags").TagsState;
141
+ terms: import("./terms").TermsSlice;
141
142
  validTimes: import("./validTimes").ValidTimesState;
142
143
  verifyAccount: import("./verifyAccount").VerifyAccountState;
143
144
  }) => {
@@ -83,6 +83,7 @@ export declare const selectCustomerPointsProgram: (orderType: OrderType | null)
83
83
  sidebarModal: import("..").SidebarModalState;
84
84
  signUp: import("..").SignUpState;
85
85
  tags: import("..").TagsState;
86
+ terms: import("..").TermsSlice;
86
87
  validTimes: import("..").ValidTimesState;
87
88
  verifyAccount: import("..").VerifyAccountState;
88
89
  }) => import("@open-tender/types").CustomerLoyalty | null) & import("reselect").OutputSelectorFields<(args_0: {
@@ -88,6 +88,7 @@ export declare const selectCustomerOrder: ((state: import("redux").EmptyObject &
88
88
  sidebarModal: import("..").SidebarModalState;
89
89
  signUp: import("..").SignUpState;
90
90
  tags: import("..").TagsState;
91
+ terms: import("..").TermsSlice;
91
92
  validTimes: import("..").ValidTimesState;
92
93
  verifyAccount: import("..").VerifyAccountState;
93
94
  }) => {
@@ -75,6 +75,7 @@ export declare const selectCustomerTplsPoints: ((state: import("redux").EmptyObj
75
75
  sidebarModal: import("..").SidebarModalState;
76
76
  signUp: import("..").SignUpState;
77
77
  tags: import("..").TagsState;
78
+ terms: import("..").TermsSlice;
78
79
  validTimes: import("..").ValidTimesState;
79
80
  verifyAccount: import("..").VerifyAccountState;
80
81
  }) => number | null) & import("reselect").OutputSelectorFields<(args_0: import("@open-tender/types").TPLSPoints | null | undefined) => number | null, {
@@ -137,6 +138,7 @@ export declare const selectCustomerTplsRewards: ((state: import("redux").EmptyOb
137
138
  sidebarModal: import("..").SidebarModalState;
138
139
  signUp: import("..").SignUpState;
139
140
  tags: import("..").TagsState;
141
+ terms: import("..").TermsSlice;
140
142
  validTimes: import("..").ValidTimesState;
141
143
  verifyAccount: import("..").VerifyAccountState;
142
144
  }) => import("@open-tender/types").TPLSRewards) & import("reselect").OutputSelectorFields<(args_0: import("@open-tender/types").TPLSRewards | undefined) => import("@open-tender/types").TPLSRewards, {
@@ -199,6 +201,7 @@ export declare const selectCustomerTplsProgress: ((state: import("redux").EmptyO
199
201
  sidebarModal: import("..").SidebarModalState;
200
202
  signUp: import("..").SignUpState;
201
203
  tags: import("..").TagsState;
204
+ terms: import("..").TermsSlice;
202
205
  validTimes: import("..").ValidTimesState;
203
206
  verifyAccount: import("..").VerifyAccountState;
204
207
  }) => import("@open-tender/types").TPLSProgress | null) & import("reselect").OutputSelectorFields<(args_0: import("@open-tender/types").TPLSProgress | null | undefined) => import("@open-tender/types").TPLSProgress | null, {
@@ -161,6 +161,7 @@ export declare const selectSpendingLimit: ((state: import("redux").EmptyObject &
161
161
  sidebarModal: import("./sidebarModal").SidebarModalState;
162
162
  signUp: import("./signUp").SignUpState;
163
163
  tags: import("./tags").TagsState;
164
+ terms: import("./terms").TermsSlice;
164
165
  validTimes: import("./validTimes").ValidTimesState;
165
166
  verifyAccount: import("./verifyAccount").VerifyAccountState;
166
167
  }) => number | null) & import("reselect").OutputSelectorFields<(args_0: {
@@ -226,6 +227,7 @@ export declare const selectGroupOrderClosed: ((state: import("redux").EmptyObjec
226
227
  sidebarModal: import("./sidebarModal").SidebarModalState;
227
228
  signUp: import("./signUp").SignUpState;
228
229
  tags: import("./tags").TagsState;
230
+ terms: import("./terms").TermsSlice;
229
231
  validTimes: import("./validTimes").ValidTimesState;
230
232
  verifyAccount: import("./verifyAccount").VerifyAccountState;
231
233
  }) => boolean | null) & import("reselect").OutputSelectorFields<(args_0: {
@@ -293,6 +295,7 @@ export declare const selectGroupOrderTests: ((state: import("redux").EmptyObject
293
295
  sidebarModal: import("./sidebarModal").SidebarModalState;
294
296
  signUp: import("./signUp").SignUpState;
295
297
  tags: import("./tags").TagsState;
298
+ terms: import("./terms").TermsSlice;
296
299
  validTimes: import("./validTimes").ValidTimesState;
297
300
  verifyAccount: import("./verifyAccount").VerifyAccountState;
298
301
  }) => {
@@ -369,6 +372,7 @@ export declare const selectGroupOrderPrepTimes: ((state: import("redux").EmptyOb
369
372
  sidebarModal: import("./sidebarModal").SidebarModalState;
370
373
  signUp: import("./signUp").SignUpState;
371
374
  tags: import("./tags").TagsState;
375
+ terms: import("./terms").TermsSlice;
372
376
  validTimes: import("./validTimes").ValidTimesState;
373
377
  verifyAccount: import("./verifyAccount").VerifyAccountState;
374
378
  }) => {
@@ -33,5 +33,6 @@ export * from './sidebar';
33
33
  export * from './sidebarModal';
34
34
  export * from './signUp';
35
35
  export * from './tags';
36
+ export * from './terms';
36
37
  export * from './validTimes';
37
38
  export * from './verifyAccount';
@@ -33,5 +33,6 @@ export * from './sidebar';
33
33
  export * from './sidebarModal';
34
34
  export * from './signUp';
35
35
  export * from './tags';
36
+ export * from './terms';
36
37
  export * from './validTimes';
37
38
  export * from './verifyAccount';
@@ -183,6 +183,7 @@ export declare const selectOrderLimits: ((state: import("redux").EmptyObject & {
183
183
  sidebarModal: import("./sidebarModal").SidebarModalState;
184
184
  signUp: import("./signUp").SignUpState;
185
185
  tags: import("./tags").TagsState;
186
+ terms: import("./terms").TermsSlice;
186
187
  validTimes: import("./validTimes").ValidTimesState;
187
188
  verifyAccount: import("./verifyAccount").VerifyAccountState;
188
189
  }) => {
@@ -256,6 +257,7 @@ export declare const selectCartIds: ((state: import("redux").EmptyObject & {
256
257
  sidebarModal: import("./sidebarModal").SidebarModalState;
257
258
  signUp: import("./signUp").SignUpState;
258
259
  tags: import("./tags").TagsState;
260
+ terms: import("./terms").TermsSlice;
259
261
  validTimes: import("./validTimes").ValidTimesState;
260
262
  verifyAccount: import("./verifyAccount").VerifyAccountState;
261
263
  }) => number[]) & import("reselect").OutputSelectorFields<(args_0: Cart | null) => number[], {
@@ -324,6 +326,7 @@ export declare const selectMenuVars: ((state: import("redux").EmptyObject & {
324
326
  sidebarModal: import("./sidebarModal").SidebarModalState;
325
327
  signUp: import("./signUp").SignUpState;
326
328
  tags: import("./tags").TagsState;
329
+ terms: import("./terms").TermsSlice;
327
330
  validTimes: import("./validTimes").ValidTimesState;
328
331
  verifyAccount: import("./verifyAccount").VerifyAccountState;
329
332
  }) => {
@@ -11,14 +11,13 @@ export var SignUpActionType;
11
11
  SignUpActionType["SignUpCustomer"] = "signUp/signUpCustomer";
12
12
  })(SignUpActionType || (SignUpActionType = {}));
13
13
  export const signUpCustomer = createAsyncThunk(SignUpActionType.SignUpCustomer, ({ data, callback }, { dispatch, getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
14
- var _a, _b;
15
14
  try {
16
15
  const api = getState().config.api;
17
16
  const response = yield api.postSignUp(data);
18
- dispatch(loginCustomer({
19
- email: (_a = data.email) !== null && _a !== void 0 ? _a : '',
20
- password: (_b = data.password) !== null && _b !== void 0 ? _b : ''
21
- }));
17
+ const { email, password } = data;
18
+ if (email && password) {
19
+ dispatch(loginCustomer({ email, password }));
20
+ }
22
21
  if (callback)
23
22
  callback(response);
24
23
  return;
@@ -82,6 +82,7 @@ export declare const selectSelectedTagNames: ((state: import("redux").EmptyObjec
82
82
  sidebarModal: import("./sidebarModal").SidebarModalState;
83
83
  signUp: import("./signUp").SignUpState;
84
84
  tags: TagsState;
85
+ terms: import("./terms").TermsSlice;
85
86
  validTimes: import("./validTimes").ValidTimesState;
86
87
  verifyAccount: import("./verifyAccount").VerifyAccountState;
87
88
  }) => string[]) & import("reselect").OutputSelectorFields<(args_0: {
@@ -0,0 +1,20 @@
1
+ import { RequestError, RequestStatus, TPLSTerms } from '@open-tender/types';
2
+ import { AppState } from '../app';
3
+ export interface TermsSlice {
4
+ terms: TPLSTerms | null;
5
+ loading: RequestStatus;
6
+ error: RequestError;
7
+ }
8
+ export declare const fetchTerms: import("@reduxjs/toolkit").AsyncThunk<TPLSTerms, void, {
9
+ state: AppState;
10
+ rejectValue: RequestError;
11
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
12
+ extra?: unknown;
13
+ serializedErrorType?: unknown;
14
+ pendingMeta?: unknown;
15
+ fulfilledMeta?: unknown;
16
+ rejectedMeta?: unknown;
17
+ }>;
18
+ export declare const resetTerms: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"terms/resetTerms">;
19
+ export declare const selectTerms: (state: AppState) => TermsSlice;
20
+ export declare const termsReducer: import("redux").Reducer<TermsSlice, import("redux").AnyAction>;
@@ -0,0 +1,47 @@
1
+ import { __awaiter } from "tslib";
2
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
+ const initialState = {
4
+ terms: null,
5
+ loading: 'idle',
6
+ error: null
7
+ };
8
+ export const fetchTerms = createAsyncThunk('terms/getTerms', (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
9
+ const { api } = getState().config;
10
+ if (!api)
11
+ return;
12
+ try {
13
+ const api = getState().config.api;
14
+ if (!api)
15
+ return null;
16
+ return yield api.getTerms();
17
+ }
18
+ catch (err) {
19
+ const error = err;
20
+ return rejectWithValue(error);
21
+ }
22
+ }));
23
+ const termsSlice = createSlice({
24
+ name: 'terms',
25
+ initialState: initialState,
26
+ reducers: {
27
+ resetTerms: () => initialState
28
+ },
29
+ extraReducers: builder => {
30
+ builder
31
+ .addCase(fetchTerms.fulfilled, (state, action) => {
32
+ state.terms = action.payload;
33
+ state.loading = 'idle';
34
+ state.error = null;
35
+ })
36
+ .addCase(fetchTerms.pending, state => {
37
+ state.loading = 'pending';
38
+ })
39
+ .addCase(fetchTerms.rejected, (state, action) => {
40
+ state.loading = 'idle';
41
+ state.error = action.payload;
42
+ });
43
+ }
44
+ });
45
+ export const { resetTerms } = termsSlice.actions;
46
+ export const selectTerms = (state) => state.terms;
47
+ export const termsReducer = termsSlice.reducer;
@@ -49,6 +49,7 @@ export declare enum ReducerType {
49
49
  SidebarModal = "sidebarModal",
50
50
  SignUp = "signUp",
51
51
  Tags = "tags",
52
+ Terms = "terms",
52
53
  Thanx = "thanx",
53
54
  Tpls = "tpls",
54
55
  ValidTimes = "validTimes",
@@ -50,6 +50,7 @@ export var ReducerType;
50
50
  ReducerType["SidebarModal"] = "sidebarModal";
51
51
  ReducerType["SignUp"] = "signUp";
52
52
  ReducerType["Tags"] = "tags";
53
+ ReducerType["Terms"] = "terms";
53
54
  ReducerType["Thanx"] = "thanx";
54
55
  ReducerType["Tpls"] = "tpls";
55
56
  ReducerType["ValidTimes"] = "validTimes";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.80",
3
+ "version": "0.1.82",
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",
@@ -50,11 +50,11 @@
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@open-tender/types": "^0.2.59",
53
- "@open-tender/utils": "^0.1.129",
53
+ "@open-tender/utils": "^0.1.138",
54
54
  "@reduxjs/toolkit": "^1.8.5",
55
55
  "react": "^18.2.0"
56
56
  },
57
57
  "dependencies": {
58
- "@open-tender/types": "^0.2.61"
58
+ "@open-tender/types": "^0.2.77"
59
59
  }
60
60
  }