ordering-ui-react-native 0.17.97 → 0.17.98-release

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 (224) hide show
  1. package/package.json +9 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  35. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  36. package/themes/business/src/components/OrdersOption/index.tsx +60 -47
  37. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  38. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  39. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  40. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  41. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  42. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  43. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  46. package/themes/business/src/components/StoresList/index.tsx +3 -4
  47. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  49. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  50. package/themes/business/src/components/shared/OModal.tsx +16 -9
  51. package/themes/business/src/types/index.tsx +24 -10
  52. package/themes/business/src/utils/index.tsx +29 -2
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  57. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +7 -3
  65. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  66. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  67. package/themes/original/src/components/AddressList/index.tsx +5 -8
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  73. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  74. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +21 -23
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +137 -32
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +36 -403
  94. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  95. package/themes/original/src/components/Cart/index.tsx +44 -81
  96. package/themes/original/src/components/CartContent/index.tsx +70 -30
  97. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  98. package/themes/original/src/components/Checkout/index.tsx +262 -35
  99. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  100. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  101. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  102. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  103. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  104. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  105. package/themes/original/src/components/Favorite/index.tsx +1 -5
  106. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  108. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  110. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  111. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  112. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  113. package/themes/original/src/components/Home/index.tsx +13 -4
  114. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  117. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  118. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  119. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  120. package/themes/original/src/components/Messages/index.tsx +15 -4
  121. package/themes/original/src/components/MomentOption/index.tsx +41 -36
  122. package/themes/original/src/components/MomentOption/styles.tsx +0 -15
  123. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  125. package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  128. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  129. package/themes/original/src/components/NavBar/index.tsx +20 -13
  130. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  131. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  132. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  133. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  134. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  135. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  136. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  137. package/themes/original/src/components/OrderSummary/index.tsx +59 -56
  138. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  139. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  140. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  141. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  142. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  143. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  144. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  145. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  146. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  147. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  148. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  149. package/themes/original/src/components/ProductForm/index.tsx +65 -34
  150. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  151. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  152. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  153. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  154. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  155. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  156. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  157. package/themes/original/src/components/Promotions/index.tsx +2 -2
  158. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  159. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  160. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  161. package/themes/original/src/components/ServiceForm/index.tsx +40 -20
  162. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  165. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  167. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  168. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +3 -8
  172. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  173. package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
  174. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  175. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  176. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  177. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  178. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  179. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  180. package/themes/original/src/components/Wallets/index.tsx +51 -61
  181. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  182. package/themes/original/src/components/shared/OButton.tsx +3 -3
  183. package/themes/original/src/components/shared/OInput.tsx +4 -5
  184. package/themes/original/src/components/shared/OModal.tsx +3 -3
  185. package/themes/original/src/config/constants.tsx +0 -10
  186. package/themes/original/src/types/index.tsx +31 -15
  187. package/themes/original/src/utils/index.tsx +180 -13
  188. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  189. package/src/navigators/BottomNavigator.tsx +0 -117
  190. package/src/navigators/CheckoutNavigator.tsx +0 -66
  191. package/src/navigators/HomeNavigator.tsx +0 -202
  192. package/src/navigators/NavigationRef.tsx +0 -7
  193. package/src/navigators/RootNavigator.tsx +0 -269
  194. package/src/pages/Account.tsx +0 -34
  195. package/src/pages/AddressForm.tsx +0 -62
  196. package/src/pages/AddressList.tsx +0 -24
  197. package/src/pages/BusinessProductsList.tsx +0 -81
  198. package/src/pages/BusinessesListing.tsx +0 -43
  199. package/src/pages/CartList.tsx +0 -49
  200. package/src/pages/Checkout.tsx +0 -101
  201. package/src/pages/ForgotPassword.tsx +0 -24
  202. package/src/pages/Help.tsx +0 -23
  203. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  204. package/src/pages/HelpGuide.tsx +0 -23
  205. package/src/pages/HelpOrder.tsx +0 -23
  206. package/src/pages/Home.tsx +0 -36
  207. package/src/pages/IntroductoryTutorial.tsx +0 -170
  208. package/src/pages/Login.tsx +0 -47
  209. package/src/pages/MomentOption.tsx +0 -30
  210. package/src/pages/MultiCheckout.tsx +0 -31
  211. package/src/pages/MultiOrdersDetails.tsx +0 -27
  212. package/src/pages/MyOrders.tsx +0 -40
  213. package/src/pages/NetworkError.tsx +0 -24
  214. package/src/pages/NotFound.tsx +0 -22
  215. package/src/pages/OrderDetails.tsx +0 -25
  216. package/src/pages/ProductDetails.tsx +0 -55
  217. package/src/pages/Profile.tsx +0 -36
  218. package/src/pages/ReviewDriver.tsx +0 -30
  219. package/src/pages/ReviewOrder.tsx +0 -32
  220. package/src/pages/ReviewProducts.tsx +0 -30
  221. package/src/pages/Sessions.tsx +0 -22
  222. package/src/pages/Signup.tsx +0 -53
  223. package/src/pages/SpinnerLoader.tsx +0 -10
  224. package/src/pages/Splash.tsx +0 -21
@@ -4,11 +4,6 @@ export const BContainer = styled.View`
4
4
  padding: 20px 40px;
5
5
  `
6
6
 
7
- export const WrapHeader = styled.View`
8
- width: 100%;
9
- padding-vertical: 20px;
10
- `
11
-
12
7
  export const SearchWrapper = styled.View`
13
8
 
14
9
  `
@@ -53,12 +48,6 @@ export const SingleBusinessContainer = styled.View`
53
48
  justify-content: space-between;
54
49
  `
55
50
 
56
- export const LoadMoreBusinessContainer = styled.View`
57
- align-items: center;
58
- justify-content: center;
59
- margin-left: 20px;
60
- `
61
-
62
51
  export const TagsContainer = styled.View`
63
52
  padding-bottom: 10px;
64
53
  `
@@ -80,13 +69,6 @@ export const PriceFilterWrapper = styled.View`
80
69
  margin-bottom: 20px;
81
70
  `
82
71
 
83
- export const OptionTitle = styled.View`
84
- margin-top: 24px;
85
- ${(props: any) => props.titleContent && css`
86
- margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
87
- `}
88
- `
89
-
90
72
  export const WrapperButtons = styled.View`
91
73
  flex-direction: row;
92
74
  width: 100%;
@@ -1,7 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useFocusEffect } from '@react-navigation/native'
2
3
  import { TouchableOpacity, StyleSheet, View, Dimensions, Platform } from 'react-native'
3
4
  import { useLanguage, useUtils, useConfig, useOrder, MomentOption } from 'ordering-components/native'
4
- import { OButton, OText } from '../shared'
5
+ import { OButton, OIcon, OText } from '../shared'
5
6
  import { useTheme } from 'styled-components/native'
6
7
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
7
8
  import FastImage from 'react-native-fast-image'
@@ -37,7 +38,10 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
37
38
  handleChangeDate,
38
39
  handleChangeTime,
39
40
  handleAsap,
40
- isAsap
41
+ getActualSchedule,
42
+ isAsap,
43
+ cateringPreorder,
44
+ preorderLeadTime
41
45
  } = props
42
46
 
43
47
  const theme = useTheme()
@@ -52,6 +56,8 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
52
56
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
53
57
  const [isEnabled, setIsEnabled] = useState(false)
54
58
  const { top } = useSafeAreaInsets()
59
+ const is12hours = configs?.general_hour_format?.value?.includes('hh:mm')
60
+
55
61
  const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
62
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
57
63
  const styles = StyleSheet.create({
@@ -165,7 +171,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
165
171
  if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
166
172
  let hour = ''
167
173
  let meridian = ''
168
- if (configs?.format_time?.value === '12') {
174
+ if (is12hours) {
169
175
  if (i === 0) {
170
176
  hour = '12'
171
177
  meridian = ' ' + t('AM', 'AM')
@@ -252,10 +258,45 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
252
258
 
253
259
  useEffect(() => {
254
260
  if (selectDate === null) return
255
- const selectedMenu = Object.keys(menu).length > 0 ? (menu?.use_business_schedule ? business : menu) : business
256
- const _times = getTimes(selectDate, selectedMenu)
257
- setTimeList(_times)
258
- }, [selectDate, menu])
261
+ if (cateringPreorder) {
262
+ let _timeLists = []
263
+ const schedule = business && getActualSchedule()
264
+ if (!schedule && cateringPreorder && Object.keys(business)?.length > 0) {
265
+ return
266
+ }
267
+ _timeLists = hoursList
268
+ .filter(hour => ((Object.keys(business || {})?.length === 0) || schedule?.lapses?.some((lapse: any) =>
269
+ moment(dateSelected + ` ${hour.startTime}`) >= moment(dateSelected + ` ${lapse.open.hour}:${lapse.open.minute}`).add(preorderLeadTime, 'minutes') && moment(dateSelected + ` ${hour.endTime}`) <= moment(dateSelected + ` ${lapse.close.hour}:${lapse.close.minute}`))) &&
270
+ moment(dateSelected + ` ${hour.startTime}`) < moment(dateSelected + ` ${hour.endTime}`) &&
271
+ (moment().add(preorderLeadTime, 'minutes') < moment(dateSelected + ` ${hour.startTime}`) || !cateringPreorder))
272
+ .map(hour => {
273
+ return {
274
+ value: hour.startTime,
275
+ text: is12hours ? (
276
+ hour.startTime.includes('12')
277
+ ? `${hour.startTime}PM`
278
+ : parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
279
+ ) : (
280
+ parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
281
+ ),
282
+ endText: is12hours ? (
283
+ hour.endTime.includes('12')
284
+ ? `${hour.endTime}PM`
285
+ : parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'hh:mma' })
286
+ ) : (
287
+ parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'HH:mm' })
288
+ )
289
+ }
290
+ })
291
+ if (_timeLists?.length > 0) {
292
+ setTimeList(_timeLists)
293
+ }
294
+ } else {
295
+ const selectedMenu = Object.keys(menu).length > 0 ? (menu?.use_business_schedule ? business : menu) : business
296
+ const _times = getTimes(selectDate, selectedMenu)
297
+ setTimeList(_times)
298
+ }
299
+ }, [selectDate, menu, business, cateringPreorder, hoursList, dateSelected])
259
300
 
260
301
  useEffect(() => {
261
302
  if (selectedPreorderType === 0 && Object.keys(menu).length > 0) setMenu({})
@@ -263,15 +304,18 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
263
304
 
264
305
  useEffect(() => {
265
306
  if (dateSelected) {
307
+
266
308
  const dateParts = dateSelected.split('-')
267
309
  const _dateSelected = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
268
310
  setSelectedDate(_dateSelected)
269
311
  }
270
312
  }, [dateSelected])
271
313
 
272
- useEffect(() => {
273
- handleAsap && handleAsap()
274
- }, [])
314
+ useFocusEffect(
315
+ React.useCallback(() => {
316
+ handleAsap && handleAsap()
317
+ }, [])
318
+ )
275
319
 
276
320
  return (
277
321
  <>
@@ -302,7 +346,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
302
346
  />
303
347
  </View>
304
348
  </BusinessInfoWrapper>
305
- {isPreOrderSetting && (
349
+ {isPreOrderSetting && !cateringPreorder && (
306
350
  <PreorderTypeWrapper>
307
351
  <OText
308
352
  size={16}
@@ -415,19 +459,36 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
415
459
  />
416
460
  )}
417
461
  </View>
418
- <TimeListWrapper nestedScrollEnabled={true}>
419
- {(isEnabled && timeList?.length > 0) ? (
462
+ <TimeListWrapper nestedScrollEnabled={true} cateringPreorder={cateringPreorder}>
463
+ {((isEnabled || cateringPreorder) && timeList?.length > 0) ? (
420
464
  <TimeContentWrapper>
421
465
  {timeList.map((time: any, i: number) => (
422
466
  <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
- <TimeItem active={timeSelected === time.value}>
467
+ <TimeItem active={timeSelected === time.value} cateringPreorder={cateringPreorder}>
468
+ {cateringPreorder && (
469
+ <>
470
+ {timeSelected === time.value ? (
471
+ <OIcon
472
+ src={theme.images.general.option_checked}
473
+ width={18}
474
+ style={{ marginEnd: 24, bottom: 2 }}
475
+ />
476
+ ) : (
477
+ <OIcon
478
+ src={theme.images.general.option_normal}
479
+ width={18}
480
+ style={{ marginEnd: 24, bottom: 2 }}
481
+ />
482
+ )}
483
+ </>
484
+ )}
424
485
  <OText
425
- size={14}
486
+ size={cateringPreorder ? 18 : 16}
426
487
  color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
488
  style={{
428
489
  lineHeight: 24
429
490
  }}
430
- >{time.text}</OText>
491
+ >{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
431
492
  </TimeItem>
432
493
  </TouchableOpacity>
433
494
  ))}
@@ -461,7 +522,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
461
522
  marginBottom: 12,
462
523
  textAlign: 'center'
463
524
  }}
464
- >
525
+ >
465
526
  {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
466
527
  </OText>
467
528
  )}
@@ -480,7 +541,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
480
541
 
481
542
  export const BusinessPreorder = (props: any) => {
482
543
  const [{ configs }] = useConfig()
483
-
544
+ const [orderState] = useOrder()
484
545
  const limitDays = parseInt(configs?.max_days_preorder?.value, 10)
485
546
 
486
547
  const currentDate = new Date()
@@ -492,10 +553,33 @@ export const BusinessPreorder = (props: any) => {
492
553
  currentDate.setHours(23)
493
554
  currentDate.setMinutes(59)
494
555
 
556
+ const cateringTypeString = orderState?.options?.type === 7
557
+ ? 'catering_delivery'
558
+ : orderState?.options?.type === 8
559
+ ? 'catering_pickup'
560
+ : null
561
+
562
+ const splitCateringValue = (configName : string) =>
563
+ Object.values(props?.business?.configs || {})
564
+ ?.find(config => config?.key === configName)
565
+ ?.value?.split('|')
566
+ ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
567
+ const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
568
+ const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
569
+ const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
570
+ const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
571
+ const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
572
+
495
573
  const businessPreorderProps = {
496
574
  ...props,
497
575
  UIComponent: BusinessPreorderUI,
498
- maxDate: currentDate
576
+ maxDate: currentDate,
577
+ preorderLeadTime,
578
+ preorderSlotInterval,
579
+ preorderTimeRange,
580
+ preorderMaximumDays,
581
+ preorderMinimumDays,
582
+ cateringPreorder: !!cateringTypeString
499
583
  }
500
584
  return <MomentOption {...businessPreorderProps} />
501
585
  }
@@ -107,8 +107,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
107
107
  </Placeholder>
108
108
  )}
109
109
  {!loading &&
110
- categories &&
111
- categories.length &&
110
+ categories?.length > 0 &&
112
111
  categories.map((category: any) => (
113
112
  <Tab
114
113
  key={category.id}
@@ -9,7 +9,7 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
9
9
  import { View, ScrollView } from 'react-native';
10
10
  import { StyleSheet } from 'react-native';
11
11
  import { useTheme } from 'styled-components/native';
12
- import { shape } from '../../utils'
12
+ import { lightenDarkenColor, shape } from '../../utils'
13
13
  import { CategoryDescriptionMemoized } from './CategoryDescription';
14
14
  import { OrderItAgain } from '../OrderItAgain'
15
15
  import { SubcategoriesComponentMemoized } from './SubcategoriesComponent';
@@ -39,7 +39,8 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
39
39
  handleUpdateProducts,
40
40
  previouslyProducts,
41
41
  isFiltMode,
42
- navigation
42
+ navigation,
43
+ businessSingleId
43
44
  } = props;
44
45
 
45
46
  const [, t] = useLanguage();
@@ -92,6 +93,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
92
93
  handleUpdateProducts={handleUpdateProducts}
93
94
  currentCart={currentCart}
94
95
  searchValue={searchValue}
96
+ businessSingleId={businessSingleId}
95
97
  />
96
98
  )}
97
99
  {category.id &&
@@ -104,7 +106,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
104
106
  <SingleProductCard
105
107
  key={'prod_' + product.id + `_${i}`}
106
108
  isSoldOut={product.inventoried && !product.quantity}
107
- enableIntersection={!isFiltMode && categoryState.products?.length < 80}
109
+ // enableIntersection={!isFiltMode}
108
110
  product={product}
109
111
  businessId={businessId}
110
112
  categoryState={categoryState}
@@ -112,6 +114,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
112
114
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
113
115
  handleUpdateProducts={handleUpdateProducts}
114
116
  navigation={navigation}
117
+ businessSingleId={businessSingleId}
115
118
  />
116
119
  ))
117
120
  }
@@ -132,13 +135,14 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
132
135
  key={'feat_' + product.id + `_${i}`}
133
136
  isSoldOut={product.inventoried && !product.quantity}
134
137
  product={product}
135
- enableIntersection={!isFiltMode && categoryState.products?.length < 80}
138
+ // enableIntersection={!isFiltMode}
136
139
  businessId={businessId}
137
140
  categoryState={categoryState}
138
141
  onProductClick={onProductClick}
139
142
  handleUpdateProducts={handleUpdateProducts}
140
143
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
141
144
  navigation={navigation}
145
+ businessSingleId={businessSingleId}
142
146
  />
143
147
  ),
144
148
  )}
@@ -182,13 +186,15 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
182
186
  {category?.ribbon?.enabled && (
183
187
  <RibbonBox
184
188
  bgColor={category?.ribbon?.color}
189
+ colorText={lightenDarkenColor(category?.ribbon?.color)}
190
+ borderRibbon={lightenDarkenColor(category?.ribbon?.color)}
185
191
  isRoundRect={category?.ribbon?.shape === shape?.rectangleRound}
186
192
  isCapsule={category?.ribbon?.shape === shape?.capsuleShape}
187
193
  >
188
194
  <OText
189
195
  size={10}
190
196
  weight={'400'}
191
- color={theme.colors.white}
197
+ color={lightenDarkenColor(category?.ribbon?.color) ? theme.colors.black : theme.colors.white}
192
198
  numberOfLines={2}
193
199
  ellipsizeMode='tail'
194
200
  lineHeight={13}
@@ -231,7 +237,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
231
237
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
232
238
  <SingleProductCard
233
239
  key={`${product?.id}_${i}`}
234
- enableIntersection={!isFiltMode && categoryState.products?.length < 80}
240
+ enableIntersection={!isFiltMode}
235
241
  isSoldOut={product.inventoried && !product.quantity}
236
242
  businessId={businessId}
237
243
  product={product}
@@ -240,6 +246,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
240
246
  handleUpdateProducts={handleUpdateProducts}
241
247
  navigation={navigation}
242
248
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
249
+ businessSingleId={businessSingleId}
243
250
  />
244
251
  ))}
245
252
  </>
@@ -302,10 +309,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
302
309
  ? t('SEARCH_REDIRECT', 'Go to Businesses')
303
310
  : t('CLEAR_FILTERS', 'Clear filters')
304
311
  }
305
- onClickButton={() =>
312
+ onClickButton={!businessSingleId ? () =>
306
313
  !searchValue
307
314
  ? handleSearchRedirect && handleSearchRedirect()
308
315
  : handleCancelSearch && handleCancelSearch()
316
+ : null
309
317
  }
310
318
  />
311
319
  </WrapperNotFound>
@@ -18,18 +18,23 @@ export const RibbonBox = styled.View`
18
18
  background-color: ${(props: any) => props.theme.colors.primary};
19
19
  padding: 2px 8px;
20
20
  max-width: 180px;
21
-
22
21
  ${(props: any) => props.bgColor && css`
23
22
  background-color: ${props.bgColor};
24
23
  `}
25
-
26
24
  ${(props: any) => props.isRoundRect && css`
27
25
  border-radius: 7.6px;
28
26
  `}
29
-
30
27
  ${(props: any) => props.isCapsule && css`
31
28
  border-radius: 50px;
32
29
  `}
30
+
31
+ ${(props: any) => props.colorText && css`
32
+ color: ${props.colorText ? 'black' : 'white'};
33
+ `}
34
+
35
+ ${(props: any) => props.borderRibbon && css`
36
+ border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
37
+ `}
33
38
  `
34
39
 
35
40
  export const SubCategoriesContainer = styled.View`
@@ -13,7 +13,7 @@ const UpsellingRedirectUI = (props: any) => {
13
13
  if (!upsellingProducts.loading) {
14
14
  if (upsellingProducts?.products?.length) {
15
15
  onRedirect &&
16
- onRedirect('UpsellingPage', props)
16
+ onRedirect('UpsellingPage', {...props, products: upsellingProducts?.products })
17
17
  } else {
18
18
  handleUpsellingPage && handleUpsellingPage()
19
19
  }