@open-tender/cloud 0.4.28 → 0.4.30

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 (279) hide show
  1. package/LICENSE.md +21 -21
  2. package/README.md +3 -3
  3. package/dist/cjs/app/hooks.d.ts +66 -66
  4. package/dist/cjs/app/hooks.js +8 -8
  5. package/dist/cjs/app/index.d.ts +2 -2
  6. package/dist/cjs/app/index.js +5 -5
  7. package/dist/cjs/app/store.d.ts +194 -194
  8. package/dist/cjs/app/store.js +64 -64
  9. package/dist/cjs/index.d.ts +5 -5
  10. package/dist/cjs/index.js +11 -11
  11. package/dist/cjs/services/api.d.ts +171 -171
  12. package/dist/cjs/services/api.js +729 -721
  13. package/dist/cjs/services/errors.d.ts +50 -50
  14. package/dist/cjs/services/errors.js +53 -53
  15. package/dist/cjs/services/index.d.ts +3 -3
  16. package/dist/cjs/services/index.js +7 -7
  17. package/dist/cjs/slices/alerts.d.ts +5 -5
  18. package/dist/cjs/slices/alerts.js +29 -29
  19. package/dist/cjs/slices/allergens.d.ts +100 -100
  20. package/dist/cjs/slices/allergens.js +83 -83
  21. package/dist/cjs/slices/announcements.d.ts +178 -178
  22. package/dist/cjs/slices/announcements.js +81 -81
  23. package/dist/cjs/slices/checkout.d.ts +58 -58
  24. package/dist/cjs/slices/checkout.js +311 -311
  25. package/dist/cjs/slices/completedOrders.d.ts +31 -31
  26. package/dist/cjs/slices/completedOrders.js +61 -61
  27. package/dist/cjs/slices/config.d.ts +313 -313
  28. package/dist/cjs/slices/config.js +195 -195
  29. package/dist/cjs/slices/confirmation.d.ts +8 -8
  30. package/dist/cjs/slices/confirmation.js +23 -23
  31. package/dist/cjs/slices/customer/account.d.ts +128 -128
  32. package/dist/cjs/slices/customer/account.js +351 -351
  33. package/dist/cjs/slices/customer/addresses.d.ts +55 -55
  34. package/dist/cjs/slices/customer/addresses.js +132 -132
  35. package/dist/cjs/slices/customer/allergens.d.ts +37 -37
  36. package/dist/cjs/slices/customer/allergens.js +94 -94
  37. package/dist/cjs/slices/customer/communicationPreferences.d.ts +69 -69
  38. package/dist/cjs/slices/customer/communicationPreferences.js +164 -164
  39. package/dist/cjs/slices/customer/creditCards.d.ts +136 -136
  40. package/dist/cjs/slices/customer/creditCards.js +170 -170
  41. package/dist/cjs/slices/customer/favorites.d.ts +68 -68
  42. package/dist/cjs/slices/customer/favorites.js +173 -173
  43. package/dist/cjs/slices/customer/fcmToken.d.ts +49 -49
  44. package/dist/cjs/slices/customer/fcmToken.js +110 -110
  45. package/dist/cjs/slices/customer/giftCards.d.ts +98 -98
  46. package/dist/cjs/slices/customer/giftCards.js +222 -222
  47. package/dist/cjs/slices/customer/groupOrders.d.ts +118 -118
  48. package/dist/cjs/slices/customer/groupOrders.js +262 -262
  49. package/dist/cjs/slices/customer/history.d.ts +23 -23
  50. package/dist/cjs/slices/customer/history.js +57 -57
  51. package/dist/cjs/slices/customer/houseAccounts.d.ts +26 -26
  52. package/dist/cjs/slices/customer/houseAccounts.js +67 -67
  53. package/dist/cjs/slices/customer/index.d.ts +42 -42
  54. package/dist/cjs/slices/customer/index.js +68 -68
  55. package/dist/cjs/slices/customer/loyalty.d.ts +248 -248
  56. package/dist/cjs/slices/customer/loyalty.js +110 -110
  57. package/dist/cjs/slices/customer/order.d.ts +115 -115
  58. package/dist/cjs/slices/customer/order.js +98 -98
  59. package/dist/cjs/slices/customer/orders.d.ts +27 -27
  60. package/dist/cjs/slices/customer/orders.js +69 -69
  61. package/dist/cjs/slices/customer/pointsShop.d.ts +35 -35
  62. package/dist/cjs/slices/customer/pointsShop.js +86 -86
  63. package/dist/cjs/slices/customer/qrCode.d.ts +23 -23
  64. package/dist/cjs/slices/customer/qrCode.js +57 -57
  65. package/dist/cjs/slices/customer/rewards.d.ts +26 -26
  66. package/dist/cjs/slices/customer/rewards.js +67 -67
  67. package/dist/cjs/slices/customer/thanx.d.ts +23 -23
  68. package/dist/cjs/slices/customer/thanx.js +56 -56
  69. package/dist/cjs/slices/customer/tpls.d.ts +235 -235
  70. package/dist/cjs/slices/customer/tpls.js +102 -102
  71. package/dist/cjs/slices/customer/tplsPointsShop.d.ts +38 -38
  72. package/dist/cjs/slices/customer/tplsPointsShop.js +88 -88
  73. package/dist/cjs/slices/deals.d.ts +25 -25
  74. package/dist/cjs/slices/deals.js +96 -96
  75. package/dist/cjs/slices/donations.d.ts +27 -27
  76. package/dist/cjs/slices/donations.js +57 -57
  77. package/dist/cjs/slices/geolocation.d.ts +11 -11
  78. package/dist/cjs/slices/geolocation.js +36 -36
  79. package/dist/cjs/slices/giftCards.d.ts +27 -27
  80. package/dist/cjs/slices/giftCards.js +58 -58
  81. package/dist/cjs/slices/groupOrder.d.ts +414 -414
  82. package/dist/cjs/slices/groupOrder.js +266 -266
  83. package/dist/cjs/slices/guest.d.ts +51 -51
  84. package/dist/cjs/slices/guest.js +89 -89
  85. package/dist/cjs/slices/index.d.ts +40 -40
  86. package/dist/cjs/slices/index.js +43 -43
  87. package/dist/cjs/slices/loader.d.ts +9 -9
  88. package/dist/cjs/slices/loader.js +25 -25
  89. package/dist/cjs/slices/menu.d.ts +31 -31
  90. package/dist/cjs/slices/menu.js +97 -97
  91. package/dist/cjs/slices/menuDisplay.d.ts +32 -32
  92. package/dist/cjs/slices/menuDisplay.js +59 -59
  93. package/dist/cjs/slices/menuItems.d.ts +26 -26
  94. package/dist/cjs/slices/menuItems.js +57 -57
  95. package/dist/cjs/slices/misc.d.ts +17 -17
  96. package/dist/cjs/slices/misc.js +51 -51
  97. package/dist/cjs/slices/modal.d.ts +5 -5
  98. package/dist/cjs/slices/modal.js +30 -30
  99. package/dist/cjs/slices/nav.d.ts +7 -7
  100. package/dist/cjs/slices/nav.js +23 -23
  101. package/dist/cjs/slices/navSite.d.ts +7 -7
  102. package/dist/cjs/slices/navSite.js +23 -23
  103. package/dist/cjs/slices/notifications.d.ts +5 -5
  104. package/dist/cjs/slices/notifications.js +27 -27
  105. package/dist/cjs/slices/oneTimePasscode.d.ts +40 -40
  106. package/dist/cjs/slices/oneTimePasscode.js +91 -91
  107. package/dist/cjs/slices/order.d.ts +369 -363
  108. package/dist/cjs/slices/order.js +528 -528
  109. package/dist/cjs/slices/orderFulfillment.d.ts +37 -37
  110. package/dist/cjs/slices/orderFulfillment.js +77 -77
  111. package/dist/cjs/slices/orderRating.d.ts +52 -52
  112. package/dist/cjs/slices/orderRating.js +105 -105
  113. package/dist/cjs/slices/posts.d.ts +24 -24
  114. package/dist/cjs/slices/posts.js +55 -55
  115. package/dist/cjs/slices/pushNotifications.d.ts +9 -9
  116. package/dist/cjs/slices/pushNotifications.js +29 -29
  117. package/dist/cjs/slices/qr.d.ts +11 -11
  118. package/dist/cjs/slices/qr.js +34 -34
  119. package/dist/cjs/slices/quote.d.ts +101 -101
  120. package/dist/cjs/slices/quote.js +65 -65
  121. package/dist/cjs/slices/resetPassword.d.ts +41 -41
  122. package/dist/cjs/slices/resetPassword.js +80 -80
  123. package/dist/cjs/slices/revenueCenters.d.ts +35 -35
  124. package/dist/cjs/slices/revenueCenters.js +95 -95
  125. package/dist/cjs/slices/sidebar.d.ts +7 -7
  126. package/dist/cjs/slices/sidebar.js +23 -23
  127. package/dist/cjs/slices/sidebarModal.d.ts +7 -7
  128. package/dist/cjs/slices/sidebarModal.js +23 -23
  129. package/dist/cjs/slices/signUp.d.ts +25 -25
  130. package/dist/cjs/slices/signUp.js +60 -60
  131. package/dist/cjs/slices/tags.d.ts +100 -100
  132. package/dist/cjs/slices/tags.js +90 -90
  133. package/dist/cjs/slices/terms.d.ts +20 -20
  134. package/dist/cjs/slices/terms.js +51 -51
  135. package/dist/cjs/slices/types.d.ts +61 -61
  136. package/dist/cjs/slices/types.js +65 -65
  137. package/dist/cjs/slices/validTimes.d.ts +23 -23
  138. package/dist/cjs/slices/validTimes.js +57 -57
  139. package/dist/cjs/slices/verifyAccount.d.ts +23 -23
  140. package/dist/cjs/slices/verifyAccount.js +54 -54
  141. package/dist/esm/app/hooks.d.ts +66 -66
  142. package/dist/esm/app/hooks.js +4 -4
  143. package/dist/esm/app/index.d.ts +2 -2
  144. package/dist/esm/app/index.js +2 -2
  145. package/dist/esm/app/store.d.ts +194 -194
  146. package/dist/esm/app/store.js +61 -61
  147. package/dist/esm/index.d.ts +5 -5
  148. package/dist/esm/index.js +5 -5
  149. package/dist/esm/services/api.d.ts +171 -171
  150. package/dist/esm/services/api.js +727 -719
  151. package/dist/esm/services/errors.d.ts +50 -50
  152. package/dist/esm/services/errors.js +50 -50
  153. package/dist/esm/services/index.d.ts +3 -3
  154. package/dist/esm/services/index.js +3 -3
  155. package/dist/esm/slices/alerts.d.ts +5 -5
  156. package/dist/esm/slices/alerts.js +24 -24
  157. package/dist/esm/slices/allergens.d.ts +100 -100
  158. package/dist/esm/slices/allergens.js +77 -77
  159. package/dist/esm/slices/announcements.d.ts +178 -178
  160. package/dist/esm/slices/announcements.js +75 -75
  161. package/dist/esm/slices/checkout.d.ts +58 -58
  162. package/dist/esm/slices/checkout.js +303 -303
  163. package/dist/esm/slices/completedOrders.d.ts +31 -31
  164. package/dist/esm/slices/completedOrders.js +57 -57
  165. package/dist/esm/slices/config.d.ts +313 -313
  166. package/dist/esm/slices/config.js +168 -168
  167. package/dist/esm/slices/confirmation.d.ts +8 -8
  168. package/dist/esm/slices/confirmation.js +18 -18
  169. package/dist/esm/slices/customer/account.d.ts +128 -128
  170. package/dist/esm/slices/customer/account.js +344 -344
  171. package/dist/esm/slices/customer/addresses.d.ts +55 -55
  172. package/dist/esm/slices/customer/addresses.js +127 -127
  173. package/dist/esm/slices/customer/allergens.d.ts +37 -37
  174. package/dist/esm/slices/customer/allergens.js +89 -89
  175. package/dist/esm/slices/customer/communicationPreferences.d.ts +69 -69
  176. package/dist/esm/slices/customer/communicationPreferences.js +159 -159
  177. package/dist/esm/slices/customer/creditCards.d.ts +136 -136
  178. package/dist/esm/slices/customer/creditCards.js +165 -165
  179. package/dist/esm/slices/customer/favorites.d.ts +68 -68
  180. package/dist/esm/slices/customer/favorites.js +168 -168
  181. package/dist/esm/slices/customer/fcmToken.d.ts +49 -49
  182. package/dist/esm/slices/customer/fcmToken.js +106 -106
  183. package/dist/esm/slices/customer/giftCards.d.ts +98 -98
  184. package/dist/esm/slices/customer/giftCards.js +217 -217
  185. package/dist/esm/slices/customer/groupOrders.d.ts +118 -118
  186. package/dist/esm/slices/customer/groupOrders.js +256 -256
  187. package/dist/esm/slices/customer/history.d.ts +23 -23
  188. package/dist/esm/slices/customer/history.js +53 -53
  189. package/dist/esm/slices/customer/houseAccounts.d.ts +26 -26
  190. package/dist/esm/slices/customer/houseAccounts.js +62 -62
  191. package/dist/esm/slices/customer/index.d.ts +42 -42
  192. package/dist/esm/slices/customer/index.js +64 -64
  193. package/dist/esm/slices/customer/loyalty.d.ts +248 -248
  194. package/dist/esm/slices/customer/loyalty.js +102 -102
  195. package/dist/esm/slices/customer/order.d.ts +115 -115
  196. package/dist/esm/slices/customer/order.js +94 -94
  197. package/dist/esm/slices/customer/orders.d.ts +27 -27
  198. package/dist/esm/slices/customer/orders.js +63 -63
  199. package/dist/esm/slices/customer/pointsShop.d.ts +35 -35
  200. package/dist/esm/slices/customer/pointsShop.js +82 -82
  201. package/dist/esm/slices/customer/qrCode.d.ts +23 -23
  202. package/dist/esm/slices/customer/qrCode.js +53 -53
  203. package/dist/esm/slices/customer/rewards.d.ts +26 -26
  204. package/dist/esm/slices/customer/rewards.js +62 -62
  205. package/dist/esm/slices/customer/thanx.d.ts +23 -23
  206. package/dist/esm/slices/customer/thanx.js +52 -52
  207. package/dist/esm/slices/customer/tpls.d.ts +235 -235
  208. package/dist/esm/slices/customer/tpls.js +98 -98
  209. package/dist/esm/slices/customer/tplsPointsShop.d.ts +38 -38
  210. package/dist/esm/slices/customer/tplsPointsShop.js +84 -84
  211. package/dist/esm/slices/deals.d.ts +25 -25
  212. package/dist/esm/slices/deals.js +90 -90
  213. package/dist/esm/slices/donations.d.ts +27 -27
  214. package/dist/esm/slices/donations.js +53 -53
  215. package/dist/esm/slices/geolocation.d.ts +11 -11
  216. package/dist/esm/slices/geolocation.js +30 -30
  217. package/dist/esm/slices/giftCards.d.ts +27 -27
  218. package/dist/esm/slices/giftCards.js +54 -54
  219. package/dist/esm/slices/groupOrder.d.ts +414 -414
  220. package/dist/esm/slices/groupOrder.js +259 -259
  221. package/dist/esm/slices/guest.d.ts +51 -51
  222. package/dist/esm/slices/guest.js +84 -84
  223. package/dist/esm/slices/index.d.ts +40 -40
  224. package/dist/esm/slices/index.js +40 -40
  225. package/dist/esm/slices/loader.d.ts +9 -9
  226. package/dist/esm/slices/loader.js +21 -21
  227. package/dist/esm/slices/menu.d.ts +31 -31
  228. package/dist/esm/slices/menu.js +90 -90
  229. package/dist/esm/slices/menuDisplay.d.ts +32 -32
  230. package/dist/esm/slices/menuDisplay.js +55 -55
  231. package/dist/esm/slices/menuItems.d.ts +26 -26
  232. package/dist/esm/slices/menuItems.js +52 -52
  233. package/dist/esm/slices/misc.d.ts +17 -17
  234. package/dist/esm/slices/misc.js +41 -41
  235. package/dist/esm/slices/modal.d.ts +5 -5
  236. package/dist/esm/slices/modal.js +25 -25
  237. package/dist/esm/slices/nav.d.ts +7 -7
  238. package/dist/esm/slices/nav.js +19 -19
  239. package/dist/esm/slices/navSite.d.ts +7 -7
  240. package/dist/esm/slices/navSite.js +19 -19
  241. package/dist/esm/slices/notifications.d.ts +5 -5
  242. package/dist/esm/slices/notifications.js +22 -22
  243. package/dist/esm/slices/oneTimePasscode.d.ts +40 -40
  244. package/dist/esm/slices/oneTimePasscode.js +86 -86
  245. package/dist/esm/slices/order.d.ts +369 -363
  246. package/dist/esm/slices/order.js +508 -508
  247. package/dist/esm/slices/orderFulfillment.d.ts +37 -37
  248. package/dist/esm/slices/orderFulfillment.js +73 -73
  249. package/dist/esm/slices/orderRating.d.ts +52 -52
  250. package/dist/esm/slices/orderRating.js +101 -101
  251. package/dist/esm/slices/posts.d.ts +24 -24
  252. package/dist/esm/slices/posts.js +51 -51
  253. package/dist/esm/slices/pushNotifications.d.ts +9 -9
  254. package/dist/esm/slices/pushNotifications.js +23 -23
  255. package/dist/esm/slices/qr.d.ts +11 -11
  256. package/dist/esm/slices/qr.js +29 -29
  257. package/dist/esm/slices/quote.d.ts +101 -101
  258. package/dist/esm/slices/quote.js +61 -61
  259. package/dist/esm/slices/resetPassword.d.ts +41 -41
  260. package/dist/esm/slices/resetPassword.js +76 -76
  261. package/dist/esm/slices/revenueCenters.d.ts +35 -35
  262. package/dist/esm/slices/revenueCenters.js +89 -89
  263. package/dist/esm/slices/sidebar.d.ts +7 -7
  264. package/dist/esm/slices/sidebar.js +19 -19
  265. package/dist/esm/slices/sidebarModal.d.ts +7 -7
  266. package/dist/esm/slices/sidebarModal.js +19 -19
  267. package/dist/esm/slices/signUp.d.ts +25 -25
  268. package/dist/esm/slices/signUp.js +56 -56
  269. package/dist/esm/slices/tags.d.ts +100 -100
  270. package/dist/esm/slices/tags.js +84 -84
  271. package/dist/esm/slices/terms.d.ts +20 -20
  272. package/dist/esm/slices/terms.js +47 -47
  273. package/dist/esm/slices/types.d.ts +61 -61
  274. package/dist/esm/slices/types.js +62 -62
  275. package/dist/esm/slices/validTimes.d.ts +23 -23
  276. package/dist/esm/slices/validTimes.js +52 -52
  277. package/dist/esm/slices/verifyAccount.d.ts +23 -23
  278. package/dist/esm/slices/verifyAccount.js +50 -50
  279. package/package.json +58 -62
@@ -1,90 +1,90 @@
1
- import { __awaiter } from "tslib";
2
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
- import { ReducerType } from './types';
4
- import { getMinutesfromDate, time24ToMinutes } from '@open-tender/utils';
5
- const initialState = {
6
- entities: [],
7
- selected: null,
8
- error: null,
9
- loading: 'idle'
10
- };
11
- export var DealsActionType;
12
- (function (DealsActionType) {
13
- DealsActionType["FetchDeals"] = "deals/fetchDeals";
14
- })(DealsActionType || (DealsActionType = {}));
15
- export const fetchDeals = createAsyncThunk(DealsActionType.FetchDeals, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
16
- const { api } = getState().config;
17
- if (!api)
18
- return;
19
- try {
20
- const { profile } = getState().customer.account;
21
- const { customer_id = null } = profile || {};
22
- return yield api.getDeals(customer_id);
23
- }
24
- catch (err) {
25
- return rejectWithValue(err);
26
- }
27
- }));
28
- const dealsSlice = createSlice({
29
- name: ReducerType.Deals,
30
- initialState,
31
- reducers: {
32
- resetDeals: () => initialState,
33
- setSelectedDeals: (state, action) => {
34
- state.selected = action.payload;
35
- }
36
- },
37
- extraReducers: builder => {
38
- builder
39
- .addCase(fetchDeals.fulfilled, (state, action) => {
40
- state.entities = action.payload;
41
- state.loading = 'idle';
42
- state.error = null;
43
- })
44
- .addCase(fetchDeals.pending, state => {
45
- state.loading = 'pending';
46
- })
47
- .addCase(fetchDeals.rejected, (state, action) => {
48
- state.error = action.payload;
49
- state.loading = 'idle';
50
- });
51
- }
52
- });
53
- export const { resetDeals, setSelectedDeals } = dealsSlice.actions;
54
- export const selectDeals = (state) => state.deals;
55
- export const selectEligibleDeals = (state) => {
56
- const { brand } = state.config || {};
57
- if (!brand || !brand.has_deals)
58
- return [];
59
- let { entities: deals } = state.deals;
60
- const { orderType, serviceType, revenueCenter } = state.order;
61
- if (orderType) {
62
- deals = deals.filter(i => !i.order_type || i.order_type === orderType);
63
- }
64
- if (serviceType) {
65
- deals = deals.filter(i => !i.service_type || i.service_type === serviceType);
66
- }
67
- if (revenueCenter) {
68
- const { revenue_center_id } = revenueCenter;
69
- deals = deals.filter(i => {
70
- var _a;
71
- return !((_a = i.revenue_centers) === null || _a === void 0 ? void 0 : _a.length) ||
72
- i.revenue_centers
73
- .map(r => r.revenue_center_id)
74
- .includes(revenue_center_id);
75
- });
76
- }
77
- const minutes = getMinutesfromDate(new Date());
78
- deals = deals.filter(i => {
79
- if (!i.dayparts.length)
80
- return true;
81
- const validDayparts = i.dayparts.filter(d => {
82
- const start = time24ToMinutes(d.start_time);
83
- const end = time24ToMinutes(d.end_time);
84
- return start <= minutes && minutes <= end;
85
- });
86
- return validDayparts.length > 0;
87
- });
88
- return deals;
89
- };
90
- export const dealsReducer = dealsSlice.reducer;
1
+ import { __awaiter } from "tslib";
2
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
+ import { ReducerType } from './types';
4
+ import { getMinutesfromDate, time24ToMinutes } from '@open-tender/utils';
5
+ const initialState = {
6
+ entities: [],
7
+ selected: null,
8
+ error: null,
9
+ loading: 'idle'
10
+ };
11
+ export var DealsActionType;
12
+ (function (DealsActionType) {
13
+ DealsActionType["FetchDeals"] = "deals/fetchDeals";
14
+ })(DealsActionType || (DealsActionType = {}));
15
+ export const fetchDeals = createAsyncThunk(DealsActionType.FetchDeals, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const { api } = getState().config;
17
+ if (!api)
18
+ return;
19
+ try {
20
+ const { profile } = getState().customer.account;
21
+ const { customer_id = null } = profile || {};
22
+ return yield api.getDeals(customer_id);
23
+ }
24
+ catch (err) {
25
+ return rejectWithValue(err);
26
+ }
27
+ }));
28
+ const dealsSlice = createSlice({
29
+ name: ReducerType.Deals,
30
+ initialState,
31
+ reducers: {
32
+ resetDeals: () => initialState,
33
+ setSelectedDeals: (state, action) => {
34
+ state.selected = action.payload;
35
+ }
36
+ },
37
+ extraReducers: builder => {
38
+ builder
39
+ .addCase(fetchDeals.fulfilled, (state, action) => {
40
+ state.entities = action.payload;
41
+ state.loading = 'idle';
42
+ state.error = null;
43
+ })
44
+ .addCase(fetchDeals.pending, state => {
45
+ state.loading = 'pending';
46
+ })
47
+ .addCase(fetchDeals.rejected, (state, action) => {
48
+ state.error = action.payload;
49
+ state.loading = 'idle';
50
+ });
51
+ }
52
+ });
53
+ export const { resetDeals, setSelectedDeals } = dealsSlice.actions;
54
+ export const selectDeals = (state) => state.deals;
55
+ export const selectEligibleDeals = (state) => {
56
+ const { brand } = state.config || {};
57
+ if (!brand || !brand.has_deals)
58
+ return [];
59
+ let { entities: deals } = state.deals;
60
+ const { orderType, serviceType, revenueCenter } = state.order;
61
+ if (orderType) {
62
+ deals = deals.filter(i => !i.order_type || i.order_type === orderType);
63
+ }
64
+ if (serviceType) {
65
+ deals = deals.filter(i => !i.service_type || i.service_type === serviceType);
66
+ }
67
+ if (revenueCenter) {
68
+ const { revenue_center_id } = revenueCenter;
69
+ deals = deals.filter(i => {
70
+ var _a;
71
+ return !((_a = i.revenue_centers) === null || _a === void 0 ? void 0 : _a.length) ||
72
+ i.revenue_centers
73
+ .map(r => r.revenue_center_id)
74
+ .includes(revenue_center_id);
75
+ });
76
+ }
77
+ const minutes = getMinutesfromDate(new Date());
78
+ deals = deals.filter(i => {
79
+ if (!i.dayparts.length)
80
+ return true;
81
+ const validDayparts = i.dayparts.filter(d => {
82
+ const start = time24ToMinutes(d.start_time);
83
+ const end = time24ToMinutes(d.end_time);
84
+ return start <= minutes && minutes <= end;
85
+ });
86
+ return validDayparts.length > 0;
87
+ });
88
+ return deals;
89
+ };
90
+ export const dealsReducer = dealsSlice.reducer;
@@ -1,27 +1,27 @@
1
- import { AppState } from '../app';
2
- import { Donation, DonationPurchase, RequestError, RequestStatus } from '@open-tender/types';
3
- export interface DonationState {
4
- donation: Donation | null;
5
- error: RequestError | Record<string, any>;
6
- loading: RequestStatus;
7
- success: boolean;
8
- }
9
- export declare enum DonationActionType {
10
- PurchaseDonation = "donations/purchaseDonation"
11
- }
12
- export declare const purchaseDonation: import("@reduxjs/toolkit").AsyncThunk<Donation, {
13
- data: DonationPurchase;
14
- callback?: (() => void) | undefined;
15
- }, {
16
- state: AppState;
17
- rejectValue: RequestError;
18
- dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
19
- extra?: unknown;
20
- serializedErrorType?: unknown;
21
- pendingMeta?: unknown;
22
- fulfilledMeta?: unknown;
23
- rejectedMeta?: unknown;
24
- }>;
25
- export declare const resetDonation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"donations/resetDonation">;
26
- export declare const selectDonation: (state: AppState) => DonationState;
27
- export declare const donationsReducer: import("redux").Reducer<DonationState, import("redux").AnyAction>;
1
+ import { AppState } from '../app';
2
+ import { Donation, DonationPurchase, RequestError, RequestStatus } from '@open-tender/types';
3
+ export interface DonationState {
4
+ donation: Donation | null;
5
+ error: RequestError | Record<string, any>;
6
+ loading: RequestStatus;
7
+ success: boolean;
8
+ }
9
+ export declare enum DonationActionType {
10
+ PurchaseDonation = "donations/purchaseDonation"
11
+ }
12
+ export declare const purchaseDonation: import("@reduxjs/toolkit").AsyncThunk<Donation, {
13
+ data: DonationPurchase;
14
+ callback?: (() => void) | undefined;
15
+ }, {
16
+ state: AppState;
17
+ rejectValue: RequestError;
18
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
19
+ extra?: unknown;
20
+ serializedErrorType?: unknown;
21
+ pendingMeta?: unknown;
22
+ fulfilledMeta?: unknown;
23
+ rejectedMeta?: unknown;
24
+ }>;
25
+ export declare const resetDonation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"donations/resetDonation">;
26
+ export declare const selectDonation: (state: AppState) => DonationState;
27
+ export declare const donationsReducer: import("redux").Reducer<DonationState, import("redux").AnyAction>;
@@ -1,53 +1,53 @@
1
- import { __awaiter } from "tslib";
2
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
- import { ReducerType } from './types';
4
- const initialState = {
5
- donation: null,
6
- success: false,
7
- error: null,
8
- loading: 'idle'
9
- };
10
- export var DonationActionType;
11
- (function (DonationActionType) {
12
- DonationActionType["PurchaseDonation"] = "donations/purchaseDonation";
13
- })(DonationActionType || (DonationActionType = {}));
14
- export const purchaseDonation = createAsyncThunk(DonationActionType.PurchaseDonation, (requestData, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
15
- const { api } = getState().config;
16
- if (!api)
17
- return;
18
- try {
19
- const donation = yield api.postPurchaseDonation(requestData.data);
20
- if (requestData.callback)
21
- requestData.callback();
22
- return donation;
23
- }
24
- catch (err) {
25
- return rejectWithValue(err);
26
- }
27
- }));
28
- const donationsSlice = createSlice({
29
- name: ReducerType.Donations,
30
- initialState,
31
- reducers: {
32
- resetDonation: () => initialState
33
- },
34
- extraReducers: builder => {
35
- builder
36
- .addCase(purchaseDonation.fulfilled, (state, action) => {
37
- state.donation = action.payload;
38
- state.success = true;
39
- state.loading = 'idle';
40
- state.error = null;
41
- })
42
- .addCase(purchaseDonation.pending, state => {
43
- state.loading = 'pending';
44
- })
45
- .addCase(purchaseDonation.rejected, (state, action) => {
46
- state.error = action.payload;
47
- state.loading = 'idle';
48
- });
49
- }
50
- });
51
- export const { resetDonation } = donationsSlice.actions;
52
- export const selectDonation = (state) => state.donations;
53
- export const donationsReducer = donationsSlice.reducer;
1
+ import { __awaiter } from "tslib";
2
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
+ import { ReducerType } from './types';
4
+ const initialState = {
5
+ donation: null,
6
+ success: false,
7
+ error: null,
8
+ loading: 'idle'
9
+ };
10
+ export var DonationActionType;
11
+ (function (DonationActionType) {
12
+ DonationActionType["PurchaseDonation"] = "donations/purchaseDonation";
13
+ })(DonationActionType || (DonationActionType = {}));
14
+ export const purchaseDonation = createAsyncThunk(DonationActionType.PurchaseDonation, (requestData, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const { api } = getState().config;
16
+ if (!api)
17
+ return;
18
+ try {
19
+ const donation = yield api.postPurchaseDonation(requestData.data);
20
+ if (requestData.callback)
21
+ requestData.callback();
22
+ return donation;
23
+ }
24
+ catch (err) {
25
+ return rejectWithValue(err);
26
+ }
27
+ }));
28
+ const donationsSlice = createSlice({
29
+ name: ReducerType.Donations,
30
+ initialState,
31
+ reducers: {
32
+ resetDonation: () => initialState
33
+ },
34
+ extraReducers: builder => {
35
+ builder
36
+ .addCase(purchaseDonation.fulfilled, (state, action) => {
37
+ state.donation = action.payload;
38
+ state.success = true;
39
+ state.loading = 'idle';
40
+ state.error = null;
41
+ })
42
+ .addCase(purchaseDonation.pending, state => {
43
+ state.loading = 'pending';
44
+ })
45
+ .addCase(purchaseDonation.rejected, (state, action) => {
46
+ state.error = action.payload;
47
+ state.loading = 'idle';
48
+ });
49
+ }
50
+ });
51
+ export const { resetDonation } = donationsSlice.actions;
52
+ export const selectDonation = (state) => state.donations;
53
+ export const donationsReducer = donationsSlice.reducer;
@@ -1,11 +1,11 @@
1
- import { LatLng, RequestError } from '@open-tender/types';
2
- import { AppState } from '../app';
3
- export interface GeoLocationState {
4
- latLng: LatLng | null;
5
- error: RequestError;
6
- loading: boolean;
7
- }
8
- export declare const resetGeolocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/resetGeolocation">, setGeoLatLng: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoLatLng">, setGeoError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoError">, setGeoLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/setGeoLoading">;
9
- export declare const selectGeo: (state: AppState) => GeoLocationState;
10
- export declare const selectGeoLatLng: (state: AppState) => LatLng | null;
11
- export declare const geolocationReducer: import("redux").Reducer<GeoLocationState, import("redux").AnyAction>;
1
+ import { LatLng, RequestError } from '@open-tender/types';
2
+ import { AppState } from '../app';
3
+ export interface GeoLocationState {
4
+ latLng: LatLng | null;
5
+ error: RequestError;
6
+ loading: boolean;
7
+ }
8
+ export declare const resetGeolocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/resetGeolocation">, setGeoLatLng: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoLatLng">, setGeoError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "geolocation/setGeoError">, setGeoLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"geolocation/setGeoLoading">;
9
+ export declare const selectGeo: (state: AppState) => GeoLocationState;
10
+ export declare const selectGeoLatLng: (state: AppState) => LatLng | null;
11
+ export declare const geolocationReducer: import("redux").Reducer<GeoLocationState, import("redux").AnyAction>;
@@ -1,30 +1,30 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- const initialState = {
3
- latLng: null,
4
- error: null,
5
- loading: false
6
- };
7
- const geolocationSlice = createSlice({
8
- name: 'geolocation',
9
- initialState,
10
- reducers: {
11
- resetGeolocation: () => initialState,
12
- setGeoLatLng: (state, action) => {
13
- state.latLng = action.payload;
14
- state.error = null;
15
- state.loading = false;
16
- },
17
- setGeoError: (state, action) => {
18
- state.latLng = null;
19
- state.error = action.payload;
20
- state.loading = false;
21
- },
22
- setGeoLoading: state => {
23
- state.loading = true;
24
- }
25
- }
26
- });
27
- export const { resetGeolocation, setGeoLatLng, setGeoError, setGeoLoading } = geolocationSlice.actions;
28
- export const selectGeo = (state) => state.geolocation;
29
- export const selectGeoLatLng = (state) => state.geolocation.latLng;
30
- export const geolocationReducer = geolocationSlice.reducer;
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ const initialState = {
3
+ latLng: null,
4
+ error: null,
5
+ loading: false
6
+ };
7
+ const geolocationSlice = createSlice({
8
+ name: 'geolocation',
9
+ initialState,
10
+ reducers: {
11
+ resetGeolocation: () => initialState,
12
+ setGeoLatLng: (state, action) => {
13
+ state.latLng = action.payload;
14
+ state.error = null;
15
+ state.loading = false;
16
+ },
17
+ setGeoError: (state, action) => {
18
+ state.latLng = null;
19
+ state.error = action.payload;
20
+ state.loading = false;
21
+ },
22
+ setGeoLoading: state => {
23
+ state.loading = true;
24
+ }
25
+ }
26
+ });
27
+ export const { resetGeolocation, setGeoLatLng, setGeoError, setGeoLoading } = geolocationSlice.actions;
28
+ export const selectGeo = (state) => state.geolocation;
29
+ export const selectGeoLatLng = (state) => state.geolocation.latLng;
30
+ export const geolocationReducer = geolocationSlice.reducer;
@@ -1,27 +1,27 @@
1
- import { AppState } from '../app';
2
- import { GiftCardsPurchase, GiftCardsPurchased, RequestError, RequestStatus } from '@open-tender/types';
3
- export interface GiftCardsState {
4
- loading: RequestStatus;
5
- error: RequestError;
6
- success: boolean;
7
- giftCards: GiftCardsPurchased;
8
- }
9
- export declare enum GiftCardsActionType {
10
- PurchaseGiftCards = "giftCards/purchaseGiftCards"
11
- }
12
- export declare const purchaseGiftCards: import("@reduxjs/toolkit").AsyncThunk<GiftCardsPurchased, {
13
- data: GiftCardsPurchase;
14
- callback?: (() => void) | undefined;
15
- }, {
16
- state: AppState;
17
- rejectValue: RequestError;
18
- dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
19
- extra?: unknown;
20
- serializedErrorType?: unknown;
21
- pendingMeta?: unknown;
22
- fulfilledMeta?: unknown;
23
- rejectedMeta?: unknown;
24
- }>;
25
- export declare const resetGiftCards: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"giftCards/resetGiftCards">;
26
- export declare const selectGiftCards: (state: AppState) => GiftCardsState;
27
- export declare const giftCardsReducer: import("redux").Reducer<GiftCardsState, import("redux").AnyAction>;
1
+ import { AppState } from '../app';
2
+ import { GiftCardsPurchase, GiftCardsPurchased, RequestError, RequestStatus } from '@open-tender/types';
3
+ export interface GiftCardsState {
4
+ loading: RequestStatus;
5
+ error: RequestError;
6
+ success: boolean;
7
+ giftCards: GiftCardsPurchased;
8
+ }
9
+ export declare enum GiftCardsActionType {
10
+ PurchaseGiftCards = "giftCards/purchaseGiftCards"
11
+ }
12
+ export declare const purchaseGiftCards: import("@reduxjs/toolkit").AsyncThunk<GiftCardsPurchased, {
13
+ data: GiftCardsPurchase;
14
+ callback?: (() => void) | undefined;
15
+ }, {
16
+ state: AppState;
17
+ rejectValue: RequestError;
18
+ dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
19
+ extra?: unknown;
20
+ serializedErrorType?: unknown;
21
+ pendingMeta?: unknown;
22
+ fulfilledMeta?: unknown;
23
+ rejectedMeta?: unknown;
24
+ }>;
25
+ export declare const resetGiftCards: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"giftCards/resetGiftCards">;
26
+ export declare const selectGiftCards: (state: AppState) => GiftCardsState;
27
+ export declare const giftCardsReducer: import("redux").Reducer<GiftCardsState, import("redux").AnyAction>;
@@ -1,54 +1,54 @@
1
- import { __awaiter } from "tslib";
2
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
- import { ReducerType } from './types';
4
- const initialState = {
5
- loading: 'idle',
6
- error: null,
7
- success: false,
8
- giftCards: []
9
- };
10
- export var GiftCardsActionType;
11
- (function (GiftCardsActionType) {
12
- GiftCardsActionType["PurchaseGiftCards"] = "giftCards/purchaseGiftCards";
13
- })(GiftCardsActionType || (GiftCardsActionType = {}));
14
- export const purchaseGiftCards = createAsyncThunk(GiftCardsActionType.PurchaseGiftCards, ({ data, callback }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
15
- const { api } = getState().config;
16
- if (!api)
17
- return;
18
- try {
19
- const giftCards = yield api.postPurchaseGiftCards(data);
20
- if (callback)
21
- callback();
22
- return giftCards;
23
- }
24
- catch (err) {
25
- return rejectWithValue(err);
26
- }
27
- }));
28
- const giftCardsSlice = createSlice({
29
- name: ReducerType.GiftCards,
30
- initialState,
31
- reducers: {
32
- resetGiftCards: () => initialState
33
- },
34
- extraReducers: builder => {
35
- builder
36
- .addCase(purchaseGiftCards.fulfilled, (state, action) => {
37
- state.success = true;
38
- state.giftCards = action.payload;
39
- state.loading = 'idle';
40
- state.error = null;
41
- })
42
- .addCase(purchaseGiftCards.pending, state => {
43
- state.loading = 'pending';
44
- })
45
- .addCase(purchaseGiftCards.rejected, (state, action) => {
46
- state.loading = 'idle';
47
- state.success = false;
48
- state.error = action.payload;
49
- });
50
- }
51
- });
52
- export const { resetGiftCards } = giftCardsSlice.actions;
53
- export const selectGiftCards = (state) => state.giftCards;
54
- export const giftCardsReducer = giftCardsSlice.reducer;
1
+ import { __awaiter } from "tslib";
2
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
+ import { ReducerType } from './types';
4
+ const initialState = {
5
+ loading: 'idle',
6
+ error: null,
7
+ success: false,
8
+ giftCards: []
9
+ };
10
+ export var GiftCardsActionType;
11
+ (function (GiftCardsActionType) {
12
+ GiftCardsActionType["PurchaseGiftCards"] = "giftCards/purchaseGiftCards";
13
+ })(GiftCardsActionType || (GiftCardsActionType = {}));
14
+ export const purchaseGiftCards = createAsyncThunk(GiftCardsActionType.PurchaseGiftCards, ({ data, callback }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const { api } = getState().config;
16
+ if (!api)
17
+ return;
18
+ try {
19
+ const giftCards = yield api.postPurchaseGiftCards(data);
20
+ if (callback)
21
+ callback();
22
+ return giftCards;
23
+ }
24
+ catch (err) {
25
+ return rejectWithValue(err);
26
+ }
27
+ }));
28
+ const giftCardsSlice = createSlice({
29
+ name: ReducerType.GiftCards,
30
+ initialState,
31
+ reducers: {
32
+ resetGiftCards: () => initialState
33
+ },
34
+ extraReducers: builder => {
35
+ builder
36
+ .addCase(purchaseGiftCards.fulfilled, (state, action) => {
37
+ state.success = true;
38
+ state.giftCards = action.payload;
39
+ state.loading = 'idle';
40
+ state.error = null;
41
+ })
42
+ .addCase(purchaseGiftCards.pending, state => {
43
+ state.loading = 'pending';
44
+ })
45
+ .addCase(purchaseGiftCards.rejected, (state, action) => {
46
+ state.loading = 'idle';
47
+ state.success = false;
48
+ state.error = action.payload;
49
+ });
50
+ }
51
+ });
52
+ export const { resetGiftCards } = giftCardsSlice.actions;
53
+ export const selectGiftCards = (state) => state.giftCards;
54
+ export const giftCardsReducer = giftCardsSlice.reducer;