ordering-ui-react-native 0.18.2 → 0.18.3-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 (263) 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 +19 -17
  16. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  17. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  18. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  19. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  20. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  21. package/themes/business/src/components/Chat/index.tsx +163 -123
  22. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  23. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  24. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  25. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  26. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  27. package/themes/business/src/components/MapView/index.tsx +14 -10
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
  35. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
  36. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  37. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  38. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  39. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  40. package/themes/business/src/components/OrdersOption/index.tsx +43 -32
  41. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  42. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  43. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  44. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  45. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  46. package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
  47. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  48. package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
  49. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  50. package/themes/business/src/components/StoresList/index.tsx +6 -5
  51. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OModal.tsx +16 -9
  55. package/themes/business/src/types/index.tsx +8 -0
  56. package/themes/business/src/utils/index.tsx +4 -4
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/original/index.tsx +7 -3
  69. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  70. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  71. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  72. package/themes/original/src/components/AddressList/index.tsx +5 -8
  73. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  74. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  75. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  76. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  78. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  79. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  80. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  81. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  82. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  83. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  84. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  86. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  87. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  88. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
  90. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  91. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  92. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  93. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  96. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  99. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  106. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  107. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  108. package/themes/original/src/components/Cart/index.tsx +49 -47
  109. package/themes/original/src/components/CartContent/index.tsx +99 -38
  110. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  111. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  112. package/themes/original/src/components/Checkout/index.tsx +324 -43
  113. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  114. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  115. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  116. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  117. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  118. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  119. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  120. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  121. package/themes/original/src/components/Favorite/index.tsx +4 -9
  122. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  123. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  124. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  125. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  126. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  127. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  128. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  129. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  131. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  132. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  133. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  134. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  135. package/themes/original/src/components/Home/index.tsx +14 -5
  136. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  137. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  138. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  139. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  140. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  141. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  142. package/themes/original/src/components/Messages/index.tsx +15 -4
  143. package/themes/original/src/components/Messages/styles.tsx +1 -1
  144. package/themes/original/src/components/MomentOption/index.tsx +9 -10
  145. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  146. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  148. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  149. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  150. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  151. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  152. package/themes/original/src/components/NavBar/index.tsx +20 -13
  153. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  154. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  155. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  156. package/themes/original/src/components/Notifications/index.tsx +4 -8
  157. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  158. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  159. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  160. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  161. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  162. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  163. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  164. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  165. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  166. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  168. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  170. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  171. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  172. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  173. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  174. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  175. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  177. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  179. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  180. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  181. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  182. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  183. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  184. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  185. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  186. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  187. package/themes/original/src/components/Promotions/index.tsx +6 -6
  188. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  189. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  190. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  191. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  192. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  193. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  194. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  195. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  196. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  197. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  198. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  199. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  200. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  201. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  202. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  203. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  204. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  205. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  206. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  208. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  209. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  210. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  211. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  212. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  213. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  214. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  215. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  216. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  217. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  218. package/themes/original/src/components/Wallets/index.tsx +48 -60
  219. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  220. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  221. package/themes/original/src/components/shared/OButton.tsx +3 -3
  222. package/themes/original/src/components/shared/OInput.tsx +4 -5
  223. package/themes/original/src/components/shared/OModal.tsx +15 -17
  224. package/themes/original/src/layouts/Container.tsx +5 -3
  225. package/themes/original/src/types/index.tsx +28 -6
  226. package/themes/original/src/utils/index.tsx +180 -13
  227. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  228. package/src/navigators/BottomNavigator.tsx +0 -117
  229. package/src/navigators/CheckoutNavigator.tsx +0 -66
  230. package/src/navigators/HomeNavigator.tsx +0 -202
  231. package/src/navigators/NavigationRef.tsx +0 -7
  232. package/src/navigators/RootNavigator.tsx +0 -269
  233. package/src/pages/Account.tsx +0 -34
  234. package/src/pages/AddressForm.tsx +0 -62
  235. package/src/pages/AddressList.tsx +0 -24
  236. package/src/pages/BusinessProductsList.tsx +0 -81
  237. package/src/pages/BusinessesListing.tsx +0 -43
  238. package/src/pages/CartList.tsx +0 -49
  239. package/src/pages/Checkout.tsx +0 -101
  240. package/src/pages/ForgotPassword.tsx +0 -24
  241. package/src/pages/Help.tsx +0 -23
  242. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  243. package/src/pages/HelpGuide.tsx +0 -23
  244. package/src/pages/HelpOrder.tsx +0 -23
  245. package/src/pages/Home.tsx +0 -36
  246. package/src/pages/IntroductoryTutorial.tsx +0 -170
  247. package/src/pages/Login.tsx +0 -47
  248. package/src/pages/MomentOption.tsx +0 -30
  249. package/src/pages/MultiCheckout.tsx +0 -31
  250. package/src/pages/MultiOrdersDetails.tsx +0 -27
  251. package/src/pages/MyOrders.tsx +0 -40
  252. package/src/pages/NetworkError.tsx +0 -24
  253. package/src/pages/NotFound.tsx +0 -22
  254. package/src/pages/OrderDetails.tsx +0 -25
  255. package/src/pages/ProductDetails.tsx +0 -55
  256. package/src/pages/Profile.tsx +0 -36
  257. package/src/pages/ReviewDriver.tsx +0 -30
  258. package/src/pages/ReviewOrder.tsx +0 -32
  259. package/src/pages/ReviewProducts.tsx +0 -30
  260. package/src/pages/Sessions.tsx +0 -22
  261. package/src/pages/Signup.tsx +0 -53
  262. package/src/pages/SpinnerLoader.tsx +0 -10
  263. package/src/pages/Splash.tsx +0 -21
@@ -1,12 +1,7 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const BContainer = styled.View`
4
- padding: 20px 40px;
5
- `
6
-
7
- export const WrapHeader = styled.View`
8
- width: 100%;
9
- padding-vertical: 20px;
4
+ padding: 20px;
10
5
  `
11
6
 
12
7
  export const SearchWrapper = styled.View`
@@ -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,13 +56,15 @@ 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({
58
64
  container: {
59
65
  height: windowHeight,
60
66
  paddingVertical: 30,
61
- paddingHorizontal: 40
67
+ paddingHorizontal: 20
62
68
  },
63
69
  businessLogo: {
64
70
  backgroundColor: 'white',
@@ -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,23 +304,25 @@ 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
  <>
278
- <PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal: 40 }}>
322
+ <PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal: 20 }}>
279
323
  <TouchableOpacity onPress={() => goToBack && goToBack()} style={{ marginBottom: 12 }}>
280
324
  <IconAntDesign
281
325
  name='close'
282
- color={theme.colors.textThird}
283
326
  size={24}
284
327
  style={{ marginLeft: -4 }}
285
328
  />
@@ -302,7 +345,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
302
345
  />
303
346
  </View>
304
347
  </BusinessInfoWrapper>
305
- {isPreOrderSetting && (
348
+ {isPreOrderSetting && !cateringPreorder && (
306
349
  <PreorderTypeWrapper>
307
350
  <OText
308
351
  size={16}
@@ -415,19 +458,36 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
415
458
  />
416
459
  )}
417
460
  </View>
418
- <TimeListWrapper nestedScrollEnabled={true}>
419
- {(isEnabled && timeList?.length > 0) ? (
461
+ <TimeListWrapper nestedScrollEnabled={true} cateringPreorder={cateringPreorder}>
462
+ {((isEnabled || cateringPreorder) && timeList?.length > 0) ? (
420
463
  <TimeContentWrapper>
421
464
  {timeList.map((time: any, i: number) => (
422
465
  <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
- <TimeItem active={timeSelected === time.value}>
466
+ <TimeItem active={timeSelected === time.value} cateringPreorder={cateringPreorder}>
467
+ {cateringPreorder && (
468
+ <>
469
+ {timeSelected === time.value ? (
470
+ <OIcon
471
+ src={theme.images.general.option_checked}
472
+ width={18}
473
+ style={{ marginEnd: 24, bottom: 2 }}
474
+ />
475
+ ) : (
476
+ <OIcon
477
+ src={theme.images.general.option_normal}
478
+ width={18}
479
+ style={{ marginEnd: 24, bottom: 2 }}
480
+ />
481
+ )}
482
+ </>
483
+ )}
424
484
  <OText
425
- size={14}
485
+ size={cateringPreorder ? 18 : 16}
426
486
  color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
487
  style={{
428
488
  lineHeight: 24
429
489
  }}
430
- >{time.text}</OText>
490
+ >{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
431
491
  </TimeItem>
432
492
  </TouchableOpacity>
433
493
  ))}
@@ -461,7 +521,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
461
521
  marginBottom: 12,
462
522
  textAlign: 'center'
463
523
  }}
464
- >
524
+ >
465
525
  {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
466
526
  </OText>
467
527
  )}
@@ -480,7 +540,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
480
540
 
481
541
  export const BusinessPreorder = (props: any) => {
482
542
  const [{ configs }] = useConfig()
483
-
543
+ const [orderState] = useOrder()
484
544
  const limitDays = parseInt(configs?.max_days_preorder?.value, 10)
485
545
 
486
546
  const currentDate = new Date()
@@ -492,10 +552,33 @@ export const BusinessPreorder = (props: any) => {
492
552
  currentDate.setHours(23)
493
553
  currentDate.setMinutes(59)
494
554
 
555
+ const cateringTypeString = orderState?.options?.type === 7
556
+ ? 'catering_delivery'
557
+ : orderState?.options?.type === 8
558
+ ? 'catering_pickup'
559
+ : null
560
+
561
+ const splitCateringValue = (configName : string) =>
562
+ Object.values(props?.business?.configs || {})
563
+ ?.find(config => config?.key === configName)
564
+ ?.value?.split('|')
565
+ ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
566
+ const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
567
+ const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
568
+ const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
569
+ const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
570
+ const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
571
+
495
572
  const businessPreorderProps = {
496
573
  ...props,
497
574
  UIComponent: BusinessPreorderUI,
498
- maxDate: currentDate
575
+ maxDate: currentDate,
576
+ preorderLeadTime,
577
+ preorderSlotInterval,
578
+ preorderTimeRange,
579
+ preorderMaximumDays,
580
+ preorderMinimumDays,
581
+ cateringPreorder: !!cateringTypeString
499
582
  }
500
583
  return <MomentOption {...businessPreorderProps} />
501
584
  }
@@ -21,6 +21,10 @@ export const OrderTimeWrapper = styled.View`
21
21
  export const TimeListWrapper = styled.ScrollView`
22
22
  margin-top: 30px;
23
23
  max-height: 160px;
24
+ ${({ cateringPreorder }: any) => cateringPreorder && css`
25
+ max-height: 210px;
26
+ height: 210px;
27
+ `}
24
28
  `
25
29
 
26
30
  export const TimeContentWrapper = styled.View`
@@ -38,6 +42,16 @@ export const TimeItem = styled.View`
38
42
  justify-content: center;
39
43
  align-items: center;
40
44
  margin: 10px 0px;
45
+ ${({ cateringPreorder }: any) => cateringPreorder && css`
46
+ background: #fff;
47
+ width: 100%;
48
+ min-width: 100%;
49
+ height: 50px;
50
+ flex-direction: row;
51
+ justify-content: flex-start;
52
+ padding-left: 10px;
53
+ margin: 0;
54
+ `}
41
55
  ${({ active }: any) => active && css`
42
56
  background: #F5F9FF;
43
57
  `}
@@ -92,7 +92,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
92
92
  ref={tabsRef}
93
93
  horizontal
94
94
  style={{ ...styles.container, borderBottomWidth: loading ? 0 : 1 }}
95
- contentContainerStyle={{ paddingHorizontal: 40 }}
95
+ contentContainerStyle={{ paddingHorizontal: 20 }}
96
96
  showsHorizontalScrollIndicator={false}
97
97
  onScroll={(e: any) => setScrollOffsetX(e.nativeEvent.contentOffset.x)}
98
98
  scrollEventThrottle={16}
@@ -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
  }