ordering-ui-react-native 0.16.91 → 0.16.92-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 (206) 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 +19 -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/VerifyPhone/styles.tsx +1 -2
  13. package/src/components/shared/OToast.tsx +4 -4
  14. package/src/utils/index.tsx +2 -1
  15. package/themes/business/index.tsx +2 -0
  16. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  17. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  18. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  19. package/themes/business/src/components/Chat/index.tsx +30 -30
  20. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  21. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  22. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  23. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  24. package/themes/business/src/components/LoginForm/index.tsx +239 -80
  25. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  26. package/themes/business/src/components/MapView/index.tsx +18 -7
  27. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  34. package/themes/business/src/components/OrdersOption/index.tsx +33 -75
  35. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +1 -1
  36. package/themes/business/src/components/PreviousMessages/index.tsx +16 -18
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  38. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  39. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +54 -27
  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 +53 -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 +1 -0
  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 +10 -8
  70. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  71. package/themes/original/src/components/AddressList/index.tsx +27 -22
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  73. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -4
  76. package/themes/original/src/components/BusinessController/index.tsx +100 -47
  77. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  78. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  79. package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -3
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +86 -33
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  83. package/themes/original/src/components/BusinessProductsList/index.tsx +10 -8
  84. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  85. package/themes/original/src/components/BusinessProductsListing/index.tsx +566 -490
  86. package/themes/original/src/components/BusinessProductsListing/styles.tsx +6 -12
  87. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  88. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +115 -82
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  91. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  92. package/themes/original/src/components/Cart/index.tsx +90 -43
  93. package/themes/original/src/components/CartContent/index.tsx +77 -15
  94. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  95. package/themes/original/src/components/Checkout/index.tsx +288 -175
  96. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  97. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  98. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  100. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  101. package/themes/original/src/components/Favorite/index.tsx +7 -4
  102. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  103. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  104. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  105. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  106. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  107. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  108. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  109. package/themes/original/src/components/Help/index.tsx +8 -8
  110. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  111. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  112. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  113. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  114. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  115. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  116. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  117. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  118. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  119. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  120. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  121. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  122. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  123. package/themes/original/src/components/Messages/index.tsx +31 -10
  124. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  125. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  126. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  127. package/themes/original/src/components/MultiCheckout/index.tsx +210 -79
  128. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  129. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  130. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  131. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  132. package/themes/original/src/components/NavBar/index.tsx +6 -11
  133. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  134. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  135. package/themes/original/src/components/Notifications/index.tsx +144 -0
  136. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  137. package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +110 -221
  139. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  140. package/themes/original/src/components/OrderItAgain/index.tsx +44 -42
  141. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  142. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  143. package/themes/original/src/components/OrderSummary/index.tsx +52 -17
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +9 -3
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +29 -20
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +76 -83
  148. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  149. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  150. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  151. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  152. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  153. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  154. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  155. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  156. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  157. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  158. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  159. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  160. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  161. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  162. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  163. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  164. package/themes/original/src/components/Promotions/index.tsx +234 -220
  165. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  166. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  167. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  168. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  169. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  170. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  171. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  172. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  173. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  174. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  175. package/themes/original/src/components/Sessions/index.tsx +11 -8
  176. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  177. package/themes/original/src/components/SignupForm/index.tsx +79 -66
  178. package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
  179. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  180. package/themes/original/src/components/SingleProductCard/index.tsx +104 -45
  181. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  182. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  183. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  184. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  186. package/themes/original/src/components/UpsellingProducts/index.tsx +237 -218
  187. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  188. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  189. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  190. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  191. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  192. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  193. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  194. package/themes/original/src/components/Wallets/index.tsx +20 -21
  195. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  196. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  197. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  198. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  199. package/themes/original/src/components/shared/OButton.tsx +6 -2
  200. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  201. package/themes/original/src/components/shared/OInput.tsx +10 -1
  202. package/themes/original/src/components/shared/OModal.tsx +3 -3
  203. package/themes/original/src/layouts/Container.tsx +13 -9
  204. package/themes/original/src/types/index.tsx +37 -5
  205. package/themes/original/src/utils/index.tsx +321 -58
  206. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -46,6 +46,12 @@ export const BusinessItemAccordion = (props: any) => {
46
46
  }
47
47
  }, [orderState?.carts, isClosed])
48
48
 
49
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
50
+ if (item?.type === 1)
51
+ return acc = acc + item?.summary?.tax
52
+ return acc = acc
53
+ }, cart?.subtotal)
54
+
49
55
  return (
50
56
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
51
57
  <BIHeader
@@ -102,7 +108,7 @@ export const BusinessItemAccordion = (props: any) => {
102
108
  <OText
103
109
  size={12}
104
110
  lineHeight={18}
105
- color={theme.colors.textSecondary}
111
+ color={theme.colors.primary}
106
112
  style={{ textDecorationLine: 'underline' }}
107
113
  >
108
114
  {t('CHANGE_STORE', 'Change store')}
@@ -149,9 +155,9 @@ export const BusinessItemAccordion = (props: any) => {
149
155
  <OButton
150
156
  onClick={handleClickCheckout}
151
157
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
- style={{ width: 160, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
158
+ style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
159
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
160
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
161
  borderColor={theme.colors.primary}
156
162
  isDisabled={checkoutButtonDisabled}
157
163
  />
@@ -25,7 +25,8 @@ import {
25
25
  BrandItem,
26
26
  PriceFilterWrapper,
27
27
  OptionTitle,
28
- BContainer
28
+ BContainer,
29
+ WrapperButtons
29
30
  } from './styles'
30
31
  import FastImage from 'react-native-fast-image'
31
32
  import { convertHoursToMinutes } from '../../utils'
@@ -51,7 +52,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
51
52
  brandList,
52
53
  onNavigationRedirect,
53
54
  handleUpdateBusinessList,
54
- handleUpdateProducts
55
+ handleUpdateProducts,
56
+ brandId
55
57
  } = props
56
58
 
57
59
  const screenHeight = Dimensions.get('window').height;
@@ -74,6 +76,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
74
76
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
75
77
  ]
76
78
 
79
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
80
+
77
81
  const priceList = [
78
82
  { level: '1', content: '$' },
79
83
  { level: '2', content: '$$' },
@@ -95,7 +99,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
95
99
  width: '100%'
96
100
  },
97
101
  searchInput: {
98
- fontSize: 10,
102
+ fontSize: 12,
99
103
  },
100
104
  productsContainer: {
101
105
  marginTop: 20
@@ -134,7 +138,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
134
138
  borderWidth: 0
135
139
  },
136
140
  applyButton: {
137
- paddingHorizontal: 40,
141
+ paddingHorizontal: 10,
138
142
  width: '100%',
139
143
  marginTop: 20
140
144
  }
@@ -145,10 +149,14 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
145
149
  }
146
150
 
147
151
  const handleCloseFilters = () => {
148
- setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
152
+ clearFilters()
149
153
  setOpenFilters(false)
150
154
  }
151
155
 
156
+ const clearFilters = () => {
157
+ setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
158
+ }
159
+
152
160
  const handleChangeActiveBusinessType = (type: any) => {
153
161
  if (type?.id === null) {
154
162
  handleChangeFilters('business_types', [])
@@ -183,7 +191,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
183
191
 
184
192
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
185
193
 
186
- const onProductClick = (business: any, categoryId: any, productId: any) => {
194
+
195
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
187
196
  if (!isInteger(business?.id) ||
188
197
  !isInteger(categoryId) ||
189
198
  !isInteger(productId) ||
@@ -191,17 +200,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
191
200
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
192
201
  return
193
202
  }
194
-
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
195
205
  navigation.navigate('ProductDetails', {
196
206
  isRedirect: 'business',
197
207
  businessId: business?.id,
198
208
  categoryId: categoryId,
199
209
  productId: productId,
210
+ product: product,
200
211
  business: {
201
212
  store: business.slug,
202
213
  header: business.header,
203
214
  logo: business.logo,
204
- }
215
+ },
216
+ productAddedToCartLength
205
217
  })
206
218
  }
207
219
 
@@ -221,17 +233,23 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
221
233
  }, [isFocused])
222
234
 
223
235
  return (
224
- <BContainer>
236
+ <BContainer
237
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
238
+ >
225
239
  <SearchWrapper>
226
240
  <SearchBar
227
241
  lazyLoad
228
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
229
- 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')}
230
245
  onSearch={(val: string) => handleChangeTermValue(val)}
231
246
  value={termValue}
232
247
  iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
233
248
  />
234
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>
235
253
  {
236
254
  noResults && (
237
255
  <View>
@@ -248,26 +266,41 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
248
266
  onNavigationRedirect={onNavigationRedirect}
249
267
  BusinessControllerSkeletons={BusinessControllerSkeletons}
250
268
  businessPaginationProps={paginationProps}
269
+ franchiseId={brandId}
270
+ hideBackBtn
271
+ titleStyle={{
272
+ paddingHorizontal: 0,
273
+ marginTop: 0,
274
+ marginLeft: 0
275
+ }}
251
276
  />
252
277
  )}
253
278
 
254
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
255
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
256
- {t('BUSINESSES', 'Businesses')}
257
- </OText>
258
- </OptionTitle>
259
- <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}>
260
287
  {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
261
- <BusinessController
288
+ <View
262
289
  key={business.id}
263
- business={business}
264
- isBusinessOpen={business.open}
265
- enableIntersection={false}
266
- handleCustomClick={() => onBusinessClick(business)}
267
- handleUpdateBusinessList={handleUpdateBusinessList}
268
- orderType={orderState?.options?.type}
269
- style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
270
- />
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>
271
304
  ))}
272
305
  {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
273
306
  <LoadMoreBusinessContainer>
@@ -336,7 +369,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
336
369
  product={product}
337
370
  enableIntersection={false}
338
371
  businessId={business?.id}
339
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
372
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
340
373
  productAddedToCartLength={0}
341
374
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
342
375
  style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
@@ -482,22 +515,28 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
482
515
  </PriceFilterWrapper>
483
516
  {orderState?.options?.type === 1 && (
484
517
  <MaxSectionItem
518
+ filters={filters}
485
519
  title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
486
520
  options={maxDeliveryFeeOptions}
487
521
  filter='max_delivery_price'
522
+ handleChangeFilters={handleChangeFilters}
488
523
  />
489
524
  )}
490
525
  {[1, 2].includes(orderState?.options?.type) && (
491
526
  <MaxSectionItem
527
+ filters={filters}
492
528
  title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
493
529
  options={maxTimeOptions}
494
530
  filter='max_eta'
531
+ handleChangeFilters={handleChangeFilters}
495
532
  />
496
533
  )}
497
534
  <MaxSectionItem
535
+ filters={filters}
498
536
  title={t('MAX_DISTANCE', 'Max distance')}
499
537
  options={maxDistanceOptions}
500
538
  filter='max_distance'
539
+ handleChangeFilters={handleChangeFilters}
501
540
  />
502
541
  {businessTypes?.length > 0 && (
503
542
  <TagsContainer>
@@ -517,12 +556,26 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
517
556
  </TagsContainer>
518
557
  )}
519
558
  </ScrollView>
520
- <OButton
521
- text={t('APPLY', 'Apply')}
522
- parentStyle={styles.applyButton}
523
- textStyle={{ color: '#fff' }}
524
- onClick={() => handleApplyFilters()}
525
- />
559
+ <WrapperButtons>
560
+ <View style={{ width: '50%' }}>
561
+ <OButton
562
+ text={t('APPLY', 'Apply')}
563
+ parentStyle={styles.applyButton}
564
+ textStyle={{ color: '#fff' }}
565
+ onClick={() => handleApplyFilters()}
566
+ />
567
+ </View>
568
+ <View style={{ width: '50%' }}>
569
+ <OButton
570
+ text={t('CLEAR_FILTERS', 'Clear')}
571
+ bgColor={theme.colors.white}
572
+ borderColor={theme.colors.primary}
573
+ parentStyle={styles.applyButton}
574
+ textStyle={{ color: theme.colors.primary }}
575
+ onClick={() => clearFilters()}
576
+ />
577
+ </View>
578
+ </WrapperButtons>
526
579
  </OModal>
527
580
  </BContainer>
528
581
  )
@@ -86,3 +86,9 @@ export const OptionTitle = styled.View`
86
86
  margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
87
87
  `}
88
88
  `
89
+
90
+ export const WrapperButtons = styled.View`
91
+ flex-direction: row;
92
+ width: 100%;
93
+ justify-content: space-between;
94
+ `
@@ -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
  }
@@ -166,14 +166,16 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
166
166
  style={bpStyles.catWrap}
167
167
  onLayout={(event: any) => handleOnLayout(event, category.id)}
168
168
  >
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>
169
+ {!!category.image && (
170
+ <View style={bpStyles.catIcon}>
171
+ <OIcon
172
+ url={optimizeImage(category.image, 'h_250,c_limit')}
173
+ width={41}
174
+ height={41}
175
+ style={{ borderRadius: 7.6 }}
176
+ />
177
+ </View>
178
+ )}
177
179
  <OText size={16} weight="600">
178
180
  {category.name}
179
181
  </OText>
@@ -18,15 +18,12 @@ 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
  `}