ordering-ui-react-native 0.16.84 → 0.16.85-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 (214) 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 +8 -8
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +1 -21
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  13. package/src/components/SingleProductReview/index.tsx +7 -4
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/components/shared/OToast.tsx +4 -4
  16. package/src/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  18. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  19. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  20. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  21. package/themes/business/src/components/Chat/index.tsx +31 -31
  22. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  23. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  24. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  25. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  26. package/themes/business/src/components/LoginForm/index.tsx +236 -80
  27. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  28. package/themes/business/src/components/MapView/index.tsx +19 -8
  29. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  30. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  31. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  32. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  34. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  35. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  36. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  37. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  38. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  41. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  45. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  46. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  48. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  51. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  52. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  53. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  54. package/themes/business/src/components/shared/OLink.tsx +33 -13
  55. package/themes/business/src/components/shared/OModal.tsx +16 -9
  56. package/themes/business/src/components/shared/OText.tsx +8 -2
  57. package/themes/business/src/types/index.tsx +35 -3
  58. package/themes/business/src/utils/index.tsx +53 -0
  59. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  61. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  63. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  64. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  65. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  66. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  67. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  68. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  69. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  70. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  71. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  72. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  74. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  75. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  76. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  77. package/themes/kiosk/src/types/index.d.ts +13 -0
  78. package/themes/kiosk/src/utils/index.tsx +15 -0
  79. package/themes/original/index.tsx +8 -0
  80. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  81. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  82. package/themes/original/src/components/AddressList/index.tsx +18 -18
  83. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  84. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  85. package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
  86. package/themes/original/src/components/BusinessController/index.tsx +100 -47
  87. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  88. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  89. package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -3
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +93 -42
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
  92. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +10 -8
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +564 -495
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  102. package/themes/original/src/components/Cart/index.tsx +83 -42
  103. package/themes/original/src/components/CartContent/index.tsx +77 -15
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +74 -86
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +26 -10
  134. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +179 -77
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +6 -11
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +44 -42
  150. package/themes/original/src/components/OrderProgress/index.tsx +82 -106
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +9 -3
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +29 -20
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +79 -84
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +78 -66
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +106 -47
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +243 -218
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +61 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/Wallets/index.tsx +96 -93
  204. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  205. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  206. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  208. package/themes/original/src/components/shared/OButton.tsx +1 -1
  209. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  210. package/themes/original/src/components/shared/OInput.tsx +10 -1
  211. package/themes/original/src/layouts/Container.tsx +13 -9
  212. package/themes/original/src/types/index.tsx +36 -5
  213. package/themes/original/src/utils/index.tsx +321 -58
  214. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager } from 'react-native';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, Vibration } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
4
  import Picker from 'react-native-country-picker-modal';
5
5
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
@@ -87,7 +87,8 @@ const CheckoutUI = (props: any) => {
87
87
  instructionsOptions,
88
88
  handleChangeDeliveryOption,
89
89
  currency,
90
- merchantId
90
+ merchantId,
91
+ setPlaceSpotNumber
91
92
  } = props
92
93
 
93
94
  const theme = useTheme();
@@ -118,9 +119,11 @@ const CheckoutUI = (props: any) => {
118
119
  paddingHorizontal: 40,
119
120
  width: '100%'
120
121
  },
121
- wrapperNavbar: Platform.OS === 'ios'
122
- ? { paddingVertical: 0, paddingHorizontal: 40 }
123
- : { paddingVertical: 20, paddingHorizontal: 40 }
122
+ wrapperNavbar: {
123
+ paddingVertical: 0,
124
+ paddingHorizontal: 40,
125
+ marginVertical: 2
126
+ }
124
127
  })
125
128
 
126
129
  const [, { showToast }] = useToast();
@@ -150,11 +153,16 @@ const CheckoutUI = (props: any) => {
150
153
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
151
154
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
152
155
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
156
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
153
157
 
154
158
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
159
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
160
+ if (item?.type === 1)
161
+ return acc = acc + item?.summary?.tax
162
+ return acc = acc
163
+ }, cart?.subtotal)
155
164
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
156
- placing || errorCash || cart?.subtotal < cart?.minimum ||
157
- // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
165
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
158
166
  (options.type === 1 &&
159
167
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
160
168
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -180,8 +188,9 @@ const CheckoutUI = (props: any) => {
180
188
  }
181
189
  }
182
190
 
183
- const handlePlaceOrder = (confirmPayment: any) => {
184
- if (!userErrors.length && !requiredFields?.length) {
191
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
192
+ if (!userErrors.length && !requiredFields?.length || forcePlace) {
193
+ Vibration.vibrate()
185
194
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
186
195
  return
187
196
  }
@@ -197,6 +206,11 @@ const CheckoutUI = (props: any) => {
197
206
  setIsUserDetailsEdit(true)
198
207
  }
199
208
 
209
+ const handlePlaceOrderAsGuest = () => {
210
+ setIsOpen(false)
211
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
212
+ }
213
+
200
214
  const handlePaymentMethodClick = (paymethod: any) => {
201
215
  setShowGateway({ closedByUser: false, open: true })
202
216
  setWebviewPaymethod(paymethod)
@@ -260,10 +274,6 @@ const CheckoutUI = (props: any) => {
260
274
  }
261
275
  }, [errors])
262
276
 
263
- // useEffect(() => {
264
- // handlePaymethodChange(null)
265
- // }, [cart?.total])
266
-
267
277
  useEffect(() => {
268
278
  if (cart?.products?.length === 0) {
269
279
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
@@ -274,6 +284,21 @@ const CheckoutUI = (props: any) => {
274
284
  onFailPaypal()
275
285
  }, [showGateway.closedByUser])
276
286
 
287
+ const HeaderTitle = (props: any) => {
288
+ const { text } = props
289
+ return (
290
+ <OText
291
+ size={16}
292
+ lineHeight={24}
293
+ weight={'500'}
294
+ mBottom={props.mb ?? 10}
295
+ color={theme.colors.textNormal}
296
+ >
297
+ {text}
298
+ </OText>
299
+ )
300
+ }
301
+
277
302
  return (
278
303
  <>
279
304
  <Container noPadding>
@@ -283,8 +308,7 @@ const CheckoutUI = (props: any) => {
283
308
  titleAlign={'center'}
284
309
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
285
310
  showCall={false}
286
- btnStyle={{ paddingLeft: 0 }}
287
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
311
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
288
312
  titleWrapStyle={{ paddingHorizontal: 0 }}
289
313
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
290
314
  />
@@ -292,13 +316,20 @@ const CheckoutUI = (props: any) => {
292
316
  <ChContainer style={styles.pagePadding}>
293
317
  <ChSection style={{ paddingTop: 0 }}>
294
318
  <ChHeader>
295
- {/* <OrderTypeSelector configTypes={configTypes} /> */}
296
- <CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
297
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(options?.type || 1), 'Delivery')}</OText>
319
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
320
+ <OText
321
+ size={12}
322
+ numberOfLines={1}
323
+ ellipsizeMode={'tail'}
324
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
325
+ >
326
+ {t(getTypesText(options?.type || 1), 'Delivery')}
327
+ </OText>
298
328
  <OIcon
299
329
  src={theme.images.general.arrow_down}
300
330
  width={10}
301
331
  style={{ marginStart: 8 }}
332
+ {...(isChewLayout && { color: 'white' })}
302
333
  />
303
334
  </CHMomentWrapper>
304
335
  <CHMomentWrapper
@@ -341,9 +372,7 @@ const CheckoutUI = (props: any) => {
341
372
  Object.values(businessDetails?.business).length > 0 &&
342
373
  (
343
374
  <>
344
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
345
- {t('BUSINESS_DETAILS', 'Business Details')}
346
- </OText>
375
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
347
376
  <View>
348
377
  <OText size={12} lineHeight={18} weight={'400'}>
349
378
  {businessDetails?.business?.name}
@@ -362,9 +391,7 @@ const CheckoutUI = (props: any) => {
362
391
  )}
363
392
  {businessDetails?.error && businessDetails?.error?.length > 0 && (
364
393
  <View>
365
- <OText size={16} lineHeight={24} weight={'500'}>
366
- {t('BUSINESS_DETAILS', 'Business Details')}
367
- </OText>
394
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
368
395
  <NotFoundSource
369
396
  content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
370
397
  />
@@ -386,6 +413,7 @@ const CheckoutUI = (props: any) => {
386
413
  ) : (
387
414
  <UserDetails
388
415
  isUserDetailsEdit={isUserDetailsEdit}
416
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
389
417
  cartStatus={cart?.status}
390
418
  businessId={cart?.business_id}
391
419
  useValidationFields
@@ -410,8 +438,8 @@ const CheckoutUI = (props: any) => {
410
438
  </Placeholder>
411
439
  </View>
412
440
  ) : (
413
- <>
414
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
441
+ <ChSection>
442
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
415
443
  <View
416
444
  style={{
417
445
  backgroundColor: theme.colors.inputDisabled,
@@ -430,7 +458,7 @@ const CheckoutUI = (props: any) => {
430
458
  <OText
431
459
  size={14}
432
460
  >
433
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
461
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
434
462
  </OText>
435
463
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
436
464
  </DeliveryOptionItem>
@@ -457,7 +485,7 @@ const CheckoutUI = (props: any) => {
457
485
  />
458
486
  </View>
459
487
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
460
- </>
488
+ </ChSection>
461
489
  )}
462
490
 
463
491
  </DeliveryOptionsContainer>
@@ -479,29 +507,6 @@ const CheckoutUI = (props: any) => {
479
507
  </ChSection>
480
508
  )}
481
509
 
482
- {/* <ChSection>
483
- <ChTotal>
484
- {
485
- (
486
- <>
487
- <OIcon
488
- url={businessLogo || businessDetails?.business?.logo}
489
- width={80}
490
- height={80}
491
- borderRadius={80}
492
- />
493
- <View style={{ marginLeft: 10, width: '85%' }}>
494
- <OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
495
- {businessName || businessDetails?.business?.name}
496
- </OText>
497
- <OText size={22}>
498
- {cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
499
- </OText>
500
- </View>
501
- </>
502
- )}
503
- </ChTotal>
504
- </ChSection> */}
505
510
  <ChSection>
506
511
  <ChAddress>
507
512
  {(businessDetails?.loading || cartState.loading) ? (
@@ -518,6 +523,7 @@ const CheckoutUI = (props: any) => {
518
523
  uuid={cartUuid}
519
524
  apiKey={configs?.google_maps_api_key?.value}
520
525
  mapConfigs={mapConfigs}
526
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
521
527
  />
522
528
  )}
523
529
  </ChAddress>
@@ -534,19 +540,18 @@ const CheckoutUI = (props: any) => {
534
540
  (
535
541
  <ChSection>
536
542
  <ChDriverTips>
537
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
538
- {t('DRIVER_TIPS', 'Driver Tips')}
539
- </OText>
543
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
540
544
  <DriverTips
541
545
  uuid={cartUuid}
542
546
  businessId={cart?.business_id}
543
- driverTipsOptions={driverTipsOptions}
544
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
547
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
548
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
545
549
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
546
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
550
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
547
551
  ? cart?.driver_tip
548
552
  : cart?.driver_tip_rate}
549
553
  useOrderContext
554
+ cart={cart}
550
555
  />
551
556
  </ChDriverTips>
552
557
  </ChSection>
@@ -555,9 +560,7 @@ const CheckoutUI = (props: any) => {
555
560
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
556
561
  <ChSection>
557
562
  <ChPaymethods>
558
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
559
- {t('PAYMENT_METHOD', 'Payment Method')}
560
- </OText>
563
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
561
564
  {!cartState.loading && cart?.status === 4 && (
562
565
  <OText
563
566
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -605,6 +608,7 @@ const CheckoutUI = (props: any) => {
605
608
  isInputMode
606
609
  cart={cart}
607
610
  spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
611
+ setPlaceSpotNumber={setPlaceSpotNumber}
608
612
  vehicleDefault={cart?.vehicle}
609
613
  />
610
614
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
@@ -622,19 +626,12 @@ const CheckoutUI = (props: any) => {
622
626
  ) : (
623
627
  <>
624
628
  <CartHeader>
625
- <OText
626
- size={16}
627
- lineHeight={24}
628
- color={theme.colors.textNormal}
629
- style={{ fontWeight: '500' }}
630
- >
631
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
632
- </OText>
629
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
633
630
  <TouchableOpacity
634
631
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
635
632
  >
636
633
  <OText
637
- size={10}
634
+ size={12}
638
635
  lineHeight={15}
639
636
  color={theme.colors.primary}
640
637
  style={{ textDecorationLine: 'underline' }}
@@ -651,7 +648,7 @@ const CheckoutUI = (props: any) => {
651
648
  <OText
652
649
  size={12}
653
650
  lineHeight={18}
654
- color={theme.colors.textSecondary}
651
+ color={theme.colors.primary}
655
652
  style={{ textDecorationLine: 'underline' }}
656
653
  >
657
654
  {t('CHANGE_STORE', 'Change store')}
@@ -742,7 +739,11 @@ const CheckoutUI = (props: any) => {
742
739
  togglePhoneUpdate={togglePhoneUpdate}
743
740
  requiredFields={requiredFields}
744
741
  hideUpdateButton
745
- onClose={() => setIsOpen(false)}
742
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
743
+ onClose={() => {
744
+ setIsOpen(false)
745
+ handlePlaceOrder(null, true)
746
+ }}
746
747
  />
747
748
  </View>
748
749
  </OModal>
@@ -750,10 +751,10 @@ const CheckoutUI = (props: any) => {
750
751
  </Container>
751
752
  {!cartState.loading && cart && cart?.status !== 2 && (
752
753
  <FloatingButton
753
- handleClick={() => handlePlaceOrder(null)}
754
+ handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
754
755
  isSecondaryBtn={isDisabledButtonPlace}
755
756
  disabled={isDisabledButtonPlace}
756
- btnText={cart?.subtotal >= cart?.minimum
757
+ btnText={subtotalWithTaxes >= cart?.minimum
757
758
  ? (
758
759
  placing
759
760
  ? t('PLACING', 'Placing')
@@ -780,19 +781,6 @@ const CheckoutUI = (props: any) => {
780
781
  setShowGateway={setShowGateway}
781
782
  />
782
783
  )}
783
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
784
- <PaymentOptionsWebView
785
- onNavigationRedirect={onNavigationRedirect}
786
- uri={`https://test-square-f50f7.web.app`}
787
- user={user}
788
- token={token}
789
- cart={cart}
790
- currency={currency}
791
- webviewPaymethod={webviewPaymethod}
792
- setShowGateway={setShowGateway}
793
- locationId={'L1NGAY5M6KJRX'}
794
- />
795
- )}
796
784
  </>
797
785
  )
798
786
  }
@@ -6,7 +6,7 @@ export const ChContainer = styled.View`
6
6
  `
7
7
 
8
8
  export const ChSection = styled.View`
9
- padding-top: 30px;
9
+ padding-top: 20px;
10
10
  `
11
11
 
12
12
  export const ChHeader = styled.View`
@@ -40,7 +40,9 @@ export const ChMoment = styled(ChAddress)`
40
40
  `
41
41
 
42
42
  export const CHMomentWrapper = styled.TouchableOpacity`
43
- background-color: ${(props: any) => props.theme.colors.backgroundGray100};
43
+ background-color: ${(props: any) => props.isCustomColor
44
+ ? props.theme.colors.primary
45
+ : props.theme.colors.backgroundGray100};
44
46
  border-radius: 7.6px;
45
47
  font-size: 12px;
46
48
  max-width: 240px;
@@ -0,0 +1,89 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { StyleSheet, useWindowDimensions, Keyboard, View } from 'react-native';
3
+ import { useLanguage, useOrder } from 'ordering-components/native';
4
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
+ import { useTheme } from 'styled-components/native';
6
+
7
+ import { OButton, OIcon, OText } from '../shared';
8
+
9
+ import { CityElement, Container } from './styles'
10
+
11
+ export const CitiesControl = (props: any) => {
12
+ const {
13
+ cities,
14
+ onClose,
15
+ handleChangeCity
16
+ } = props;
17
+
18
+ const theme = useTheme();
19
+ const [, t] = useLanguage();
20
+ const [orderState] = useOrder();
21
+ const { height } = useWindowDimensions();
22
+ const { top, bottom } = useSafeAreaInsets();
23
+
24
+ const [isKeyboardShow, setIsKeyboardShow] = useState(false);
25
+ const [cityState, setCityState] = useState(orderState?.options?.city_id)
26
+
27
+ const handleClick = () => {
28
+ cityState !== orderState?.options?.city_id && handleChangeCity(cityState)
29
+ onClose && onClose()
30
+ }
31
+
32
+ useEffect(() => {
33
+ const keyboardDidShowListener = Keyboard.addListener(
34
+ 'keyboardDidShow',
35
+ () => setIsKeyboardShow(true)
36
+ );
37
+ const keyboardDidHideListener = Keyboard.addListener(
38
+ 'keyboardDidHide',
39
+ () => setIsKeyboardShow(false)
40
+ );
41
+ return () => {
42
+ keyboardDidShowListener.remove();
43
+ keyboardDidHideListener.remove();
44
+ };
45
+ }, []);
46
+
47
+ return (
48
+ <Container height={height - top - bottom - 60 - (isKeyboardShow ? 250 : 0)}>
49
+ <View>
50
+ {cities?.map((city: any) => (
51
+ <CityElement
52
+ key={city?.id}
53
+ activeOpacity={1}
54
+ disabled={orderState?.loading}
55
+ onPress={() => setCityState(city?.id === cityState ? null : city?.id)}
56
+ >
57
+ <OIcon
58
+ src={cityState === city?.id
59
+ ? theme.images.general.option_checked
60
+ : theme.images.general.option_normal}
61
+ width={16}
62
+ style={{ marginEnd: 24 }}
63
+ />
64
+ <OText color={theme.colors.black}>
65
+ {city?.name}
66
+ </OText>
67
+ </CityElement>
68
+ ))}
69
+ </View>
70
+ <OButton
71
+ text={t('CONTINUE', 'Continue')}
72
+ bgColor={theme.colors.primary}
73
+ borderColor={theme.colors.primary}
74
+ style={styles.btnStyle}
75
+ textStyle={{ color: 'white' }}
76
+ onClick={() => handleClick()}
77
+ />
78
+ </Container>
79
+ )
80
+ }
81
+
82
+ const styles = StyleSheet.create({
83
+ btnStyle: {
84
+ marginTop: 20,
85
+ borderRadius: 8,
86
+ shadowOpacity: 0,
87
+ height: 44
88
+ },
89
+ })
@@ -0,0 +1,17 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const Container = styled.View`
4
+ width: 100%;
5
+ padding: 0 40px;
6
+ justify-content: space-between;
7
+ padding-bottom: 12px;
8
+
9
+ ${(props: any) => props.height && css`
10
+ height: ${props.height}px;
11
+ `}
12
+ `
13
+
14
+ export const CityElement = styled.TouchableOpacity`
15
+ padding: 10px;
16
+ flex-direction: row;
17
+ `
@@ -22,21 +22,25 @@ const DriverTipsUI = (props: any) => {
22
22
  const {
23
23
  driverTip,
24
24
  driverTipsOptions,
25
- optionSelected,
26
- isFixedPrice,
25
+ isMulti,
26
+ cart,
27
+ carts,
27
28
  isDriverTipUseCustom,
28
- handlerChangeOption
29
+ handlerChangeOption,
30
+ isFixedPrice
29
31
  } = props;
30
32
 
31
33
  const [{ parsePrice }] = useUtils();
34
+ const theme = useTheme();
32
35
  const [, t] = useLanguage();
33
36
  const [{ configs }] = useConfig();
34
-
35
- const theme = useTheme();
37
+ const [customTip, setCustomTip] = useState((!isMulti && isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
38
+ const currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0
39
+ const [value, setvalue] = useState('');
36
40
 
37
41
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
42
+ semicircle: {
43
+ borderRadius: 8
40
44
  },
41
45
  inputStyle: {
42
46
  flex: 1,
@@ -48,53 +52,63 @@ const DriverTipsUI = (props: any) => {
48
52
  }
49
53
  })
50
54
 
51
- const [value, setvalue] = useState('');
52
-
53
- const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
55
+ const placeholderCurrency = !isFixedPrice ? `0%` : (configs?.currency_position?.value || 'left') === 'left'
54
56
  ? `${configs?.format_number_currency?.value}0`
55
57
  : `0${configs?.format_number_currency?.value}`
56
58
 
57
59
  const handleChangeDriverTip = (val: any) => {
58
60
  const tip = Number(val)
59
61
  if ((isNaN(tip) || tip < 0)) {
60
- setvalue(value)
61
- return
62
+ setvalue(value)
63
+ return
62
64
  }
63
65
  setvalue(val)
64
66
  }
65
-
67
+
68
+ const multiCartTipsAmmout = carts?.reduce((total: any, cart: any) => {
69
+ return total + parseFloat(cart?.driver_tip || 0)
70
+ }, 0)
71
+
66
72
  return (
67
73
  <DTContainer>
68
74
  <DTLabel>
69
75
  {t('CUSTOM_DRIVER_TIP_MESSAGE', '100% of these tips go directly to your driver')}
70
76
  </DTLabel>
71
77
  <DTWrapperTips>
72
- {!isDriverTipUseCustom && driverTipsOptions.map((option: any, i: number) => (
78
+ {driverTipsOptions.map((option: any, i: number) => (
73
79
  <TouchableOpacity
74
80
  key={i}
75
- onPress={() => handlerChangeOption(option)}
81
+ onPress={() => {
82
+ handlerChangeOption(option)
83
+ setCustomTip(false)
84
+ }}
76
85
  >
77
86
  <DTCard
78
- style={style.circle}
79
- isActive={option === optionSelected}
87
+ style={style.semicircle}
88
+ isActive={(option === driverTip && !customTip)}
80
89
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
90
+ <OText size={12} numberOfLines={2} color={(option === driverTip && !customTip) ? '#FFF' : theme.colors.textSecondary}>
82
91
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
92
  </OText>
84
93
  </DTCard>
85
94
  </TouchableOpacity>
86
95
  ))}
96
+ {isDriverTipUseCustom && (
97
+ <TouchableOpacity
98
+ onPress={() => setCustomTip(true)}
99
+ >
100
+ <DTCard
101
+ style={style.semicircle}
102
+ isActive={customTip}
103
+ >
104
+ <OText size={12} numberOfLines={2} color={customTip ? '#FFF' : theme.colors.textSecondary}>
105
+ {t('CUSTOM_TIP', 'Custom')}
106
+ </OText>
107
+ </DTCard>
108
+ </TouchableOpacity>
109
+ )}
87
110
  </DTWrapperTips>
88
- {(!isDriverTipUseCustom && !driverTipsOptions.includes(driverTip) && driverTip > 0) && (
89
- <OText
90
- color={theme.colors.error}
91
- size={16}
92
- style={{ marginTop: 10, textAlign: 'center' }}
93
- >
94
- {t('CUSTOM_DRIVER_TIP_AMOUNT', 'The driver\'s current tip comes from a custom option')}
95
- </OText>
96
- )}
97
- {isDriverTipUseCustom && (
111
+ {customTip && (
98
112
  <DTForm>
99
113
  <DTWrapperInput>
100
114
  <OInput
@@ -120,17 +134,18 @@ const DriverTipsUI = (props: any) => {
120
134
  }}
121
135
  />
122
136
  </DTWrapperInput>
123
- {parseFloat(driverTip || 0) > 0 && (
124
- <OText
125
- color={theme.colors.error}
126
- size={16}
127
- style={{ marginTop: 10, textAlign: 'center' }}
128
- >
129
- {t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}: {parsePrice(driverTip)}
130
- </OText>
131
- )}
132
137
  </DTForm>
133
138
  )}
139
+ {currentTip && (
140
+ <OText
141
+ color={theme.colors.primary}
142
+ size={16}
143
+ style={{ marginTop: 10, textAlign: 'center' }}
144
+ >
145
+ {t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
146
+ ` (${driverTip}%)`}: {isFixedPrice ? parsePrice(multiCartTipsAmmout ?? driverTip) : parsePrice(multiCartTipsAmmout ?? cart?.driver_tip)}
147
+ </OText>
148
+ )}
134
149
  </DTContainer>
135
150
  )
136
151
  }
@@ -26,11 +26,12 @@ export const DTCard = styled.View`
26
26
  text-transform: capitalize;
27
27
  min-height: 55px;
28
28
  min-width: 55px;
29
- max-width: 55px;
29
+ max-width: 80px;
30
30
  max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
34
+ padding-horizontal: 10px;
34
35
 
35
36
  ${(props: any) => props.isActive && css`
36
37
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { useLanguage, useOrder } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native'
4
+ import { Platform } from 'react-native'
4
5
  import { FavoriteList } from '../FavoriteList'
5
6
  import NavBar from '../NavBar'
6
7
  import { OText } from '../shared'
@@ -33,7 +34,9 @@ export const Favorite = (props: any) => {
33
34
  }
34
35
 
35
36
  return (
36
- <Container>
37
+ <Container
38
+ pdng={Platform.OS === 'ios' ? '10px' : '20px'}
39
+ >
37
40
  <NavBar
38
41
  title={t('FAVORITE', 'Favorite')}
39
42
  titleAlign={'center'}
@@ -51,9 +54,9 @@ export const Favorite = (props: any) => {
51
54
  >
52
55
  <OText
53
56
  color={menu.key === tabSelected ? theme.colors.textNormal : theme.colors.disabled}
54
- size={14}
55
- weight={menu.key === tabSelected ? '500' : '400'}
56
- style={{ marginBottom: 12 }}
57
+ size={14}
58
+ weight={menu.key === tabSelected ? '500' : '400'}
59
+ style={{ marginBottom: 12 }}
57
60
  >
58
61
  {menu.name}
59
62
  </OText>
@@ -18,5 +18,5 @@ export const Tab = styled.TouchableOpacity`
18
18
  export const Container = styled.View`
19
19
  padding-horizontal: 40px;
20
20
  padding-bottom: 20px;
21
- padding-top: 30px;
21
+ padding-top: ${(props: any) => props.pdng};
22
22
  `