ordering-ui-react-native 0.16.99 → 0.17.0-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 (209) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +11 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +1 -1
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/OrderCreating/index.tsx +1 -21
  9. package/src/components/OrdersOption/index.tsx +54 -56
  10. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  11. package/src/components/SingleProductReview/index.tsx +7 -4
  12. package/src/components/StripeMethodForm/index.tsx +1 -1
  13. package/src/components/VerifyPhone/styles.tsx +1 -2
  14. package/src/components/shared/OToast.tsx +4 -4
  15. package/src/utils/index.tsx +7 -1
  16. package/themes/business/index.tsx +2 -0
  17. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  18. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  19. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  20. package/themes/business/src/components/Chat/index.tsx +118 -107
  21. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  22. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  23. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  24. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  25. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  26. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  27. package/themes/business/src/components/MapView/index.tsx +18 -7
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +33 -43
  29. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  30. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  31. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  32. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  33. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  34. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  35. package/themes/business/src/components/OrdersOption/index.tsx +33 -75
  36. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  37. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  38. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  39. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  40. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  41. package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
  42. package/themes/business/src/components/StoresList/index.tsx +2 -2
  43. package/themes/business/src/components/shared/OLink.tsx +33 -13
  44. package/themes/business/src/components/shared/OModal.tsx +16 -9
  45. package/themes/business/src/components/shared/OText.tsx +8 -2
  46. package/themes/business/src/types/index.tsx +33 -2
  47. package/themes/business/src/utils/index.tsx +51 -0
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  52. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  53. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  54. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  55. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  56. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  60. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  61. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  62. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  65. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  66. package/themes/kiosk/src/types/index.d.ts +13 -0
  67. package/themes/kiosk/src/utils/index.tsx +15 -0
  68. package/themes/original/index.tsx +8 -0
  69. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  70. package/themes/original/src/components/AddressForm/index.tsx +152 -117
  71. package/themes/original/src/components/AddressList/index.tsx +26 -21
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  77. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  81. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  82. package/themes/original/src/components/BusinessItemAccordion/index.tsx +24 -23
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
  84. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -490
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  91. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  94. package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
  95. package/themes/original/src/components/Cart/index.tsx +87 -43
  96. package/themes/original/src/components/CartContent/index.tsx +77 -15
  97. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  98. package/themes/original/src/components/Checkout/index.tsx +294 -175
  99. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  100. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  101. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  102. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  103. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  104. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  105. package/themes/original/src/components/Favorite/index.tsx +7 -4
  106. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  107. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  108. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  109. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  110. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  111. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  112. package/themes/original/src/components/Help/index.tsx +8 -8
  113. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  114. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  115. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  116. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  117. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  118. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  119. package/themes/original/src/components/Home/index.tsx +13 -4
  120. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  121. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  123. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  124. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  125. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  126. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  127. package/themes/original/src/components/Messages/index.tsx +32 -10
  128. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  129. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
  131. package/themes/original/src/components/MultiCheckout/index.tsx +247 -83
  132. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  133. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  134. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  135. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  136. package/themes/original/src/components/NavBar/index.tsx +6 -11
  137. package/themes/original/src/components/NotFoundSource/index.tsx +1 -1
  138. package/themes/original/src/components/Notifications/index.tsx +144 -0
  139. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  140. package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +110 -221
  142. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  143. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  144. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  145. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  146. package/themes/original/src/components/OrderSummary/index.tsx +66 -29
  147. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  150. package/themes/original/src/components/OrdersOption/index.tsx +76 -83
  151. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  152. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  153. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  154. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  155. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  156. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  157. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +240 -261
  160. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  163. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  164. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  165. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  166. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  167. package/themes/original/src/components/Promotions/index.tsx +234 -220
  168. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  169. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  170. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  171. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  172. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  173. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  174. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  175. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  176. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  177. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  178. package/themes/original/src/components/Sessions/index.tsx +11 -8
  179. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  180. package/themes/original/src/components/SignupForm/index.tsx +79 -66
  181. package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
  182. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  183. package/themes/original/src/components/SingleProductCard/index.tsx +111 -49
  184. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
  185. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  186. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  187. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  188. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  189. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  190. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  191. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  192. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  193. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  194. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  195. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  196. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  197. package/themes/original/src/components/Wallets/index.tsx +20 -19
  198. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  199. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  200. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  201. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  202. package/themes/original/src/components/shared/OButton.tsx +6 -2
  203. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  204. package/themes/original/src/components/shared/OInput.tsx +10 -1
  205. package/themes/original/src/components/shared/OModal.tsx +3 -3
  206. package/themes/original/src/layouts/Container.tsx +13 -9
  207. package/themes/original/src/types/index.tsx +45 -7
  208. package/themes/original/src/utils/index.tsx +364 -58
  209. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
2
  import { TouchableOpacity, View } from 'react-native';
3
- import { useOrder, useLanguage, useUtils, useConfig } from 'ordering-components/native';
3
+ import { useOrder, useLanguage, useUtils, useConfig, useEvent } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  BIContainer,
@@ -22,7 +22,8 @@ export const BusinessItemAccordion = (props: any) => {
22
22
  handleClearProducts,
23
23
  handleClickCheckout,
24
24
  checkoutButtonDisabled,
25
- isMultiCheckout
25
+ isMultiCheckout,
26
+ isFromUpselling
26
27
  } = props
27
28
 
28
29
  const [orderState] = useOrder();
@@ -30,6 +31,7 @@ export const BusinessItemAccordion = (props: any) => {
30
31
  const [{ parsePrice }] = useUtils();
31
32
  const [{ configs }] = useConfig()
32
33
  const theme = useTheme();
34
+ const [events] = useEvent()
33
35
 
34
36
  const isCartPending = cart?.status === 2
35
37
  const isClosed = !cart?.valid_schedule
@@ -37,6 +39,7 @@ export const BusinessItemAccordion = (props: any) => {
37
39
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
38
40
 
39
41
  const [isActive, setActiveState] = useState(!!singleBusiness)
42
+ const [viewedCart, setViewedCart] = useState<any>(null)
40
43
 
41
44
  useEffect(() => {
42
45
  const cartsArray = Object.values(orderState?.carts)
@@ -46,6 +49,21 @@ export const BusinessItemAccordion = (props: any) => {
46
49
  }
47
50
  }, [orderState?.carts, isClosed])
48
51
 
52
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
53
+ if (item?.type === 1)
54
+ return acc = acc + item?.summary?.tax
55
+ return acc = acc
56
+ }, cart?.subtotal)
57
+
58
+ useEffect(() => {
59
+ if (isActive && !isFromUpselling) {
60
+ if (cart?.uuid !== viewedCart?.uuid) {
61
+ setViewedCart(cart)
62
+ events.emit('cart_viewed', cart)
63
+ }
64
+ }
65
+ }, [isActive, viewedCart])
66
+
49
67
  return (
50
68
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
51
69
  <BIHeader
@@ -56,23 +74,6 @@ export const BusinessItemAccordion = (props: any) => {
56
74
  <BIInfo>
57
75
  <BIContentInfo>
58
76
  <OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
59
- {/* {orderState?.options?.type === 1 ? (
60
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
61
- <MaterialCommunityIcon
62
- name='clock-outline'
63
- size={24}
64
- />
65
- <OText>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
66
- </View>
67
- ) : (
68
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
69
- <MaterialCommunityIcon
70
- name='clock-outline'
71
- size={24}
72
- />
73
- <OText>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
74
- </View>
75
- )} */}
76
77
  <View style={{ flexDirection: 'row' }}>
77
78
  {props.onNavigationRedirect && !isClosed && (
78
79
  <>
@@ -81,7 +82,7 @@ export const BusinessItemAccordion = (props: any) => {
81
82
  </TouchableOpacity>
82
83
  </>
83
84
  )}
84
- {!isCartPending && !isClosed && (
85
+ {!isCartPending && (
85
86
  <>
86
87
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
87
88
  <OAlert
@@ -102,7 +103,7 @@ export const BusinessItemAccordion = (props: any) => {
102
103
  <OText
103
104
  size={12}
104
105
  lineHeight={18}
105
- color={theme.colors.textSecondary}
106
+ color={theme.colors.primary}
106
107
  style={{ textDecorationLine: 'underline' }}
107
108
  >
108
109
  {t('CHANGE_STORE', 'Change store')}
@@ -149,9 +150,9 @@ export const BusinessItemAccordion = (props: any) => {
149
150
  <OButton
150
151
  onClick={handleClickCheckout}
151
152
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
154
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
156
  borderColor={theme.colors.primary}
156
157
  isDisabled={checkoutButtonDisabled}
157
158
  />
@@ -52,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
52
52
  brandList,
53
53
  onNavigationRedirect,
54
54
  handleUpdateBusinessList,
55
- handleUpdateProducts
55
+ handleUpdateProducts,
56
+ brandId
56
57
  } = props
57
58
 
58
59
  const screenHeight = Dimensions.get('window').height;
@@ -75,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
75
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
76
77
  ]
77
78
 
79
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
+
78
81
  const priceList = [
79
82
  { level: '1', content: '$' },
80
83
  { level: '2', content: '$$' },
@@ -96,7 +99,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
96
99
  width: '100%'
97
100
  },
98
101
  searchInput: {
99
- fontSize: 10,
102
+ fontSize: 12,
100
103
  },
101
104
  productsContainer: {
102
105
  marginTop: 20
@@ -188,7 +191,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
188
191
 
189
192
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
190
193
 
191
- const onProductClick = (business: any, categoryId: any, productId: any) => {
194
+
195
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
192
196
  if (!isInteger(business?.id) ||
193
197
  !isInteger(categoryId) ||
194
198
  !isInteger(productId) ||
@@ -196,17 +200,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
196
200
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
197
201
  return
198
202
  }
199
-
203
+ const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
204
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
200
205
  navigation.navigate('ProductDetails', {
201
206
  isRedirect: 'business',
202
207
  businessId: business?.id,
203
208
  categoryId: categoryId,
204
209
  productId: productId,
210
+ product: product,
205
211
  business: {
206
212
  store: business.slug,
207
213
  header: business.header,
208
214
  logo: business.logo,
209
- }
215
+ },
216
+ productAddedToCartLength
210
217
  })
211
218
  }
212
219
 
@@ -226,17 +233,23 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
226
233
  }, [isFocused])
227
234
 
228
235
  return (
229
- <BContainer>
236
+ <BContainer
237
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
238
+ >
230
239
  <SearchWrapper>
231
240
  <SearchBar
232
241
  lazyLoad
233
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
234
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
242
+ {...(isChewLayout && { height: 55 })}
243
+ inputStyle={{ ...styles.searchInput }}
244
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
235
245
  onSearch={(val: string) => handleChangeTermValue(val)}
236
246
  value={termValue}
237
247
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
238
248
  />
239
249
  </SearchWrapper>
250
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
251
+ {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
252
+ </OText>
240
253
  {
241
254
  noResults && (
242
255
  <View>
@@ -253,26 +266,41 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
253
266
  onNavigationRedirect={onNavigationRedirect}
254
267
  BusinessControllerSkeletons={BusinessControllerSkeletons}
255
268
  businessPaginationProps={paginationProps}
269
+ franchiseId={brandId}
270
+ hideBackBtn
271
+ titleStyle={{
272
+ paddingHorizontal: 0,
273
+ marginTop: 0,
274
+ marginLeft: 0
275
+ }}
256
276
  />
257
277
  )}
258
278
 
259
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
260
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
261
- {t('BUSINESSES', 'Businesses')}
262
- </OText>
263
- </OptionTitle>
264
- <ScrollView horizontal>
279
+ {businessesSearchList.businesses?.length > 0 && (
280
+ <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
282
+ {t('BUSINESSES', 'Businesses')}
283
+ </OText>
284
+ </OptionTitle>
285
+ )}
286
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
265
287
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
266
- <BusinessController
288
+ <View
267
289
  key={business.id}
268
- business={business}
269
- isBusinessOpen={business.open}
270
- enableIntersection={false}
271
- handleCustomClick={() => onBusinessClick(business)}
272
- handleUpdateBusinessList={handleUpdateBusinessList}
273
- orderType={orderState?.options?.type}
274
- style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
275
- />
290
+ style={{
291
+ width: screenWidth - 120,
292
+ marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
293
+ }}
294
+ >
295
+ <BusinessController
296
+ business={business}
297
+ isBusinessOpen={business.open}
298
+ enableIntersection={false}
299
+ handleCustomClick={() => onBusinessClick(business)}
300
+ handleUpdateBusinessList={handleUpdateBusinessList}
301
+ orderType={orderState?.options?.type}
302
+ />
303
+ </View>
276
304
  ))}
277
305
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
278
306
  <LoadMoreBusinessContainer>
@@ -341,7 +369,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
341
369
  product={product}
342
370
  enableIntersection={false}
343
371
  businessId={business?.id}
344
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
372
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
345
373
  productAddedToCartLength={0}
346
374
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
347
375
  style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { TouchableOpacity, StyleSheet, View, Dimensions, Platform } from 'react-native'
3
3
  import { useLanguage, useUtils, useConfig, useOrder, MomentOption } from 'ordering-components/native'
4
- import { OButton, OText } from '../shared'
4
+ import { OButton, OIcon, OText } from '../shared'
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
7
7
  import FastImage from 'react-native-fast-image'
@@ -37,7 +37,10 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
37
37
  handleChangeDate,
38
38
  handleChangeTime,
39
39
  handleAsap,
40
- isAsap
40
+ getActualSchedule,
41
+ isAsap,
42
+ cateringPreorder,
43
+ preorderLeadTime
41
44
  } = props
42
45
 
43
46
  const theme = useTheme()
@@ -52,6 +55,8 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
52
55
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
53
56
  const [isEnabled, setIsEnabled] = useState(false)
54
57
  const { top } = useSafeAreaInsets()
58
+ const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
59
+
55
60
  const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
61
  const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
57
62
  const styles = StyleSheet.create({
@@ -252,10 +257,45 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
252
257
 
253
258
  useEffect(() => {
254
259
  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])
260
+ if (cateringPreorder) {
261
+ let _timeLists = []
262
+ const schedule = business && getActualSchedule()
263
+ if (!schedule && cateringPreorder && Object.keys(business)?.length > 0) {
264
+ return
265
+ }
266
+ _timeLists = hoursList
267
+ .filter(hour => ((Object.keys(business || {})?.length === 0) || schedule?.lapses?.some((lapse: any) =>
268
+ 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}`))) &&
269
+ moment(dateSelected + ` ${hour.startTime}`) < moment(dateSelected + ` ${hour.endTime}`) &&
270
+ (moment().add(preorderLeadTime, 'minutes') < moment(dateSelected + ` ${hour.startTime}`) || !cateringPreorder))
271
+ .map(hour => {
272
+ return {
273
+ value: hour.startTime,
274
+ text: is12hours ? (
275
+ hour.startTime.includes('12')
276
+ ? `${hour.startTime}PM`
277
+ : parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
278
+ ) : (
279
+ parseTime(moment(hour.startTime, 'HH:mm'), { outputFormat: 'HH:mm' })
280
+ ),
281
+ endText: is12hours ? (
282
+ hour.endTime.includes('12')
283
+ ? `${hour.endTime}PM`
284
+ : parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'hh:mma' })
285
+ ) : (
286
+ parseTime(moment(hour.endTime, 'HH:mm'), { outputFormat: 'HH:mm' })
287
+ )
288
+ }
289
+ })
290
+ if (_timeLists?.length > 0) {
291
+ setTimeList(_timeLists)
292
+ }
293
+ } else {
294
+ const selectedMenu = Object.keys(menu).length > 0 ? (menu?.use_business_schedule ? business : menu) : business
295
+ const _times = getTimes(selectDate, selectedMenu)
296
+ setTimeList(_times)
297
+ }
298
+ }, [selectDate, menu, business, cateringPreorder, hoursList, dateSelected])
259
299
 
260
300
  useEffect(() => {
261
301
  if (selectedPreorderType === 0 && Object.keys(menu).length > 0) setMenu({})
@@ -263,6 +303,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
263
303
 
264
304
  useEffect(() => {
265
305
  if (dateSelected) {
306
+
266
307
  const dateParts = dateSelected.split('-')
267
308
  const _dateSelected = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
268
309
  setSelectedDate(_dateSelected)
@@ -302,7 +343,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
302
343
  />
303
344
  </View>
304
345
  </BusinessInfoWrapper>
305
- {isPreOrderSetting && (
346
+ {isPreOrderSetting && !cateringPreorder && (
306
347
  <PreorderTypeWrapper>
307
348
  <OText
308
349
  size={16}
@@ -415,19 +456,36 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
415
456
  />
416
457
  )}
417
458
  </View>
418
- <TimeListWrapper nestedScrollEnabled={true}>
419
- {(isEnabled && timeList?.length > 0) ? (
459
+ <TimeListWrapper nestedScrollEnabled={true} cateringPreorder={cateringPreorder}>
460
+ {((isEnabled || cateringPreorder) && timeList?.length > 0) ? (
420
461
  <TimeContentWrapper>
421
462
  {timeList.map((time: any, i: number) => (
422
463
  <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
- <TimeItem active={timeSelected === time.value}>
464
+ <TimeItem active={timeSelected === time.value} cateringPreorder={cateringPreorder}>
465
+ {cateringPreorder && (
466
+ <>
467
+ {timeSelected === time.value ? (
468
+ <OIcon
469
+ src={theme.images.general.option_checked}
470
+ width={18}
471
+ style={{ marginEnd: 24, bottom: 2 }}
472
+ />
473
+ ) : (
474
+ <OIcon
475
+ src={theme.images.general.option_normal}
476
+ width={18}
477
+ style={{ marginEnd: 24, bottom: 2 }}
478
+ />
479
+ )}
480
+ </>
481
+ )}
424
482
  <OText
425
- size={14}
483
+ size={cateringPreorder ? 18 : 16}
426
484
  color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
485
  style={{
428
486
  lineHeight: 24
429
487
  }}
430
- >{time.text}</OText>
488
+ >{time.text} {cateringPreorder && `- ${time.endText}`}</OText>
431
489
  </TimeItem>
432
490
  </TouchableOpacity>
433
491
  ))}
@@ -461,7 +519,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
461
519
  marginBottom: 12,
462
520
  textAlign: 'center'
463
521
  }}
464
- >
522
+ >
465
523
  {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
466
524
  </OText>
467
525
  )}
@@ -480,7 +538,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
480
538
 
481
539
  export const BusinessPreorder = (props: any) => {
482
540
  const [{ configs }] = useConfig()
483
-
541
+ const [orderState] = useOrder()
484
542
  const limitDays = parseInt(configs?.max_days_preorder?.value, 10)
485
543
 
486
544
  const currentDate = new Date()
@@ -492,10 +550,33 @@ export const BusinessPreorder = (props: any) => {
492
550
  currentDate.setHours(23)
493
551
  currentDate.setMinutes(59)
494
552
 
553
+ const cateringTypeString = orderState?.options?.type === 7
554
+ ? 'catering_delivery'
555
+ : orderState?.options?.type === 8
556
+ ? 'catering_pickup'
557
+ : null
558
+
559
+ const splitCateringValue = (configName : string) =>
560
+ Object.values(props?.business?.configs || {})
561
+ ?.find(config => config?.key === configName)
562
+ ?.value?.split('|')
563
+ ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
564
+ const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
565
+ const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
566
+ const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
567
+ const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
568
+ const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
569
+
495
570
  const businessPreorderProps = {
496
571
  ...props,
497
572
  UIComponent: BusinessPreorderUI,
498
- maxDate: currentDate
573
+ maxDate: currentDate,
574
+ preorderLeadTime,
575
+ preorderSlotInterval,
576
+ preorderTimeRange,
577
+ preorderMaximumDays,
578
+ preorderMinimumDays,
579
+ cateringPreorder: !!cateringTypeString
499
580
  }
500
581
  return <MomentOption {...businessPreorderProps} />
501
582
  }
@@ -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 &&
@@ -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
  }
@@ -139,6 +142,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
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
  )}
@@ -166,27 +170,31 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
166
170
  style={bpStyles.catWrap}
167
171
  onLayout={(event: any) => handleOnLayout(event, category.id)}
168
172
  >
169
- <View style={bpStyles.catIcon}>
170
- <OIcon
171
- url={optimizeImage(category.image, 'h_250,c_limit')}
172
- width={41}
173
- height={41}
174
- style={{ borderRadius: 7.6 }}
175
- />
176
- </View>
173
+ {!!category.image && (
174
+ <View style={bpStyles.catIcon}>
175
+ <OIcon
176
+ url={optimizeImage(category.image, 'h_250,c_limit')}
177
+ width={41}
178
+ height={41}
179
+ style={{ borderRadius: 7.6 }}
180
+ />
181
+ </View>
182
+ )}
177
183
  <OText size={16} weight="600">
178
184
  {category.name}
179
185
  </OText>
180
186
  {category?.ribbon?.enabled && (
181
187
  <RibbonBox
182
188
  bgColor={category?.ribbon?.color}
189
+ colorText={lightenDarkenColor(category?.ribbon?.color)}
190
+ borderRibbon={lightenDarkenColor(category?.ribbon?.color)}
183
191
  isRoundRect={category?.ribbon?.shape === shape?.rectangleRound}
184
192
  isCapsule={category?.ribbon?.shape === shape?.capsuleShape}
185
193
  >
186
194
  <OText
187
195
  size={10}
188
196
  weight={'400'}
189
- color={theme.colors.white}
197
+ color={lightenDarkenColor(category?.ribbon?.color) ? theme.colors.black : theme.colors.white}
190
198
  numberOfLines={2}
191
199
  ellipsizeMode='tail'
192
200
  lineHeight={13}
@@ -238,6 +246,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
238
246
  handleUpdateProducts={handleUpdateProducts}
239
247
  navigation={navigation}
240
248
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
249
+ businessSingleId={businessSingleId}
241
250
  />
242
251
  ))}
243
252
  </>
@@ -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`