ordering-ui-react-native 0.16.70 → 0.16.71-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 (202) hide show
  1. package/package.json +6 -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 +10 -10
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +2 -1
  9. package/src/components/LanguageSelector/index.tsx +21 -16
  10. package/src/components/Messages/index.tsx +2 -2
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptions/index.tsx +298 -345
  13. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  14. package/src/components/SingleProductReview/index.tsx +7 -4
  15. package/src/components/StripeElementsForm/index.tsx +25 -16
  16. package/src/components/VerifyPhone/styles.tsx +1 -2
  17. package/src/components/shared/OToast.tsx +4 -4
  18. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  19. package/src/utils/index.tsx +2 -1
  20. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  21. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  22. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  23. package/themes/business/src/components/Chat/index.tsx +31 -31
  24. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  25. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  26. package/themes/business/src/components/MapView/index.tsx +14 -3
  27. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  31. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  32. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  33. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  34. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  35. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  36. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  37. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  40. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  41. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  42. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  43. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  44. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  45. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  46. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  47. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  48. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  49. package/themes/business/src/components/shared/OLink.tsx +33 -13
  50. package/themes/business/src/components/shared/OText.tsx +8 -2
  51. package/themes/business/src/types/index.tsx +14 -3
  52. package/themes/business/src/utils/index.tsx +10 -0
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  57. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  59. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  60. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  61. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  64. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  65. package/themes/kiosk/src/types/index.d.ts +2 -0
  66. package/themes/original/index.tsx +6 -0
  67. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  68. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  69. package/themes/original/src/components/AddressList/index.tsx +18 -18
  70. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/BusinessBasicInformation/index.tsx +49 -25
  73. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  74. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  75. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  77. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  78. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  82. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  83. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +41 -62
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +561 -479
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  88. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +93 -99
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  92. package/themes/original/src/components/BusinessesListing/index.tsx +8 -8
  93. package/themes/original/src/components/Cart/index.tsx +75 -42
  94. package/themes/original/src/components/CartContent/index.tsx +80 -18
  95. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  96. package/themes/original/src/components/Checkout/index.tsx +92 -105
  97. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  98. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  99. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  100. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  101. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  102. package/themes/original/src/components/Favorite/index.tsx +7 -4
  103. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  104. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  105. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  106. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  107. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  108. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  109. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  110. package/themes/original/src/components/Help/index.tsx +7 -7
  111. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  112. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  113. package/themes/original/src/components/HelpGuide/index.tsx +12 -11
  114. package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
  115. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  116. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  117. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  118. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  119. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  120. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  121. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  122. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  123. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +17 -11
  126. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  129. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  130. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  131. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  132. package/themes/original/src/components/MyOrders/index.tsx +86 -20
  133. package/themes/original/src/components/NavBar/index.tsx +7 -6
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +144 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +100 -215
  139. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  140. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  141. package/themes/original/src/components/OrderProgress/index.tsx +79 -100
  142. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  143. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +97 -88
  148. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  149. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  150. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PlaceSpot/index.tsx +22 -8
  153. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  154. package/themes/original/src/components/ProductForm/index.tsx +212 -253
  155. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  157. package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
  158. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  159. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  160. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  161. package/themes/original/src/components/Promotions/index.tsx +234 -220
  162. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  163. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  164. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  165. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  166. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  167. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  168. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  169. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  170. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  171. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  172. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +129 -54
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  175. package/themes/original/src/components/SingleProductCard/index.tsx +85 -82
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  177. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  178. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  179. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  180. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  181. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  182. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  183. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  184. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  185. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  186. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  187. package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
  188. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +176 -164
  192. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  195. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  196. package/themes/original/src/components/shared/OButton.tsx +9 -4
  197. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  198. package/themes/original/src/components/shared/OInput.tsx +10 -1
  199. package/themes/original/src/layouts/Container.tsx +13 -9
  200. package/themes/original/src/types/index.tsx +35 -5
  201. package/themes/original/src/utils/index.tsx +305 -58
  202. 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();
@@ -106,8 +107,7 @@ const CheckoutUI = (props: any) => {
106
107
  padding: 20
107
108
  },
108
109
  pagePadding: {
109
- paddingLeft: 40,
110
- paddingRight: 40
110
+ paddingHorizontal: 40
111
111
  },
112
112
  icon: {
113
113
  top: 15,
@@ -119,9 +119,11 @@ const CheckoutUI = (props: any) => {
119
119
  paddingHorizontal: 40,
120
120
  width: '100%'
121
121
  },
122
- wrapperNavbar: Platform.OS === 'ios'
123
- ? { paddingVertical: 0, paddingHorizontal: 40 }
124
- : { paddingVertical: 20, paddingHorizontal: 40 }
122
+ wrapperNavbar: {
123
+ paddingVertical: 0,
124
+ paddingHorizontal: 40,
125
+ marginVertical: 2
126
+ }
125
127
  })
126
128
 
127
129
  const [, { showToast }] = useToast();
@@ -151,11 +153,16 @@ const CheckoutUI = (props: any) => {
151
153
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
152
154
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
153
155
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
156
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
154
157
 
155
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)
156
164
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
157
- placing || errorCash || cart?.subtotal < cart?.minimum ||
158
- // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
165
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
159
166
  (options.type === 1 &&
160
167
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
161
168
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -181,8 +188,9 @@ const CheckoutUI = (props: any) => {
181
188
  }
182
189
  }
183
190
 
184
- const handlePlaceOrder = (confirmPayment: any) => {
185
- if (!userErrors.length && !requiredFields?.length) {
191
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
192
+ if (!userErrors.length && !requiredFields?.length || forcePlace) {
193
+ Vibration.vibrate()
186
194
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
187
195
  return
188
196
  }
@@ -261,10 +269,6 @@ const CheckoutUI = (props: any) => {
261
269
  }
262
270
  }, [errors])
263
271
 
264
- // useEffect(() => {
265
- // handlePaymethodChange(null)
266
- // }, [cart?.total])
267
-
268
272
  useEffect(() => {
269
273
  if (cart?.products?.length === 0) {
270
274
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
@@ -275,6 +279,21 @@ const CheckoutUI = (props: any) => {
275
279
  onFailPaypal()
276
280
  }, [showGateway.closedByUser])
277
281
 
282
+ const HeaderTitle = (props: any) => {
283
+ const { text } = props
284
+ return (
285
+ <OText
286
+ size={16}
287
+ lineHeight={24}
288
+ weight={'500'}
289
+ mBottom={props.mb ?? 10}
290
+ color={theme.colors.textNormal}
291
+ >
292
+ {text}
293
+ </OText>
294
+ )
295
+ }
296
+
278
297
  return (
279
298
  <>
280
299
  <Container noPadding>
@@ -285,7 +304,6 @@ const CheckoutUI = (props: any) => {
285
304
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
286
305
  showCall={false}
287
306
  btnStyle={{ paddingLeft: 0 }}
288
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
289
307
  titleWrapStyle={{ paddingHorizontal: 0 }}
290
308
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
291
309
  />
@@ -293,13 +311,20 @@ const CheckoutUI = (props: any) => {
293
311
  <ChContainer style={styles.pagePadding}>
294
312
  <ChSection style={{ paddingTop: 0 }}>
295
313
  <ChHeader>
296
- {/* <OrderTypeSelector configTypes={configTypes} /> */}
297
- <CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
298
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(options?.type || 1), 'Delivery')}</OText>
314
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
315
+ <OText
316
+ size={12}
317
+ numberOfLines={1}
318
+ ellipsizeMode={'tail'}
319
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
320
+ >
321
+ {t(getTypesText(options?.type || 1), 'Delivery')}
322
+ </OText>
299
323
  <OIcon
300
324
  src={theme.images.general.arrow_down}
301
325
  width={10}
302
326
  style={{ marginStart: 8 }}
327
+ {...(isChewLayout && { color: 'white' })}
303
328
  />
304
329
  </CHMomentWrapper>
305
330
  <CHMomentWrapper
@@ -330,10 +355,10 @@ const CheckoutUI = (props: any) => {
330
355
  !businessDetails?.error &&
331
356
  (
332
357
  <Placeholder Animation={Fade}>
333
- <PlaceholderLine height={20} width={70} />
334
- <PlaceholderLine height={10} width={60} />
335
- <PlaceholderLine height={10} width={60} />
336
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
358
+ <PlaceholderLine height={20} />
359
+ <PlaceholderLine height={12} />
360
+ <PlaceholderLine height={12} />
361
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
337
362
  </Placeholder>
338
363
  )}
339
364
  {
@@ -342,9 +367,7 @@ const CheckoutUI = (props: any) => {
342
367
  Object.values(businessDetails?.business).length > 0 &&
343
368
  (
344
369
  <>
345
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
346
- {t('BUSINESS_DETAILS', 'Business Details')}
347
- </OText>
370
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
348
371
  <View>
349
372
  <OText size={12} lineHeight={18} weight={'400'}>
350
373
  {businessDetails?.business?.name}
@@ -363,9 +386,7 @@ const CheckoutUI = (props: any) => {
363
386
  )}
364
387
  {businessDetails?.error && businessDetails?.error?.length > 0 && (
365
388
  <View>
366
- <OText size={16} lineHeight={24} weight={'500'}>
367
- {t('BUSINESS_DETAILS', 'Business Details')}
368
- </OText>
389
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
369
390
  <NotFoundSource
370
391
  content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
371
392
  />
@@ -379,14 +400,15 @@ const CheckoutUI = (props: any) => {
379
400
  <ChUserDetails>
380
401
  {cartState.loading ? (
381
402
  <Placeholder Animation={Fade}>
382
- <PlaceholderLine height={20} width={70} />
383
- <PlaceholderLine height={10} width={60} />
384
- <PlaceholderLine height={10} width={60} />
385
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
403
+ <PlaceholderLine height={20} />
404
+ <PlaceholderLine height={12} />
405
+ <PlaceholderLine height={12} />
406
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
386
407
  </Placeholder>
387
408
  ) : (
388
409
  <UserDetails
389
410
  isUserDetailsEdit={isUserDetailsEdit}
411
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
390
412
  cartStatus={cart?.status}
391
413
  businessId={cart?.business_id}
392
414
  useValidationFields
@@ -406,13 +428,13 @@ const CheckoutUI = (props: any) => {
406
428
  {cartState.loading || deliveryOptionSelected === undefined ? (
407
429
  <View style={{ height: 110 }}>
408
430
  <Placeholder Animation={Fade}>
409
- <PlaceholderLine height={20} width={70} />
410
- <PlaceholderLine height={40} width={100} />
431
+ <PlaceholderLine height={20} />
432
+ <PlaceholderLine height={40} />
411
433
  </Placeholder>
412
434
  </View>
413
435
  ) : (
414
- <>
415
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
436
+ <ChSection>
437
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
416
438
  <View
417
439
  style={{
418
440
  backgroundColor: theme.colors.inputDisabled,
@@ -431,7 +453,7 @@ const CheckoutUI = (props: any) => {
431
453
  <OText
432
454
  size={14}
433
455
  >
434
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
456
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
435
457
  </OText>
436
458
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
437
459
  </DeliveryOptionItem>
@@ -458,7 +480,7 @@ const CheckoutUI = (props: any) => {
458
480
  />
459
481
  </View>
460
482
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
461
- </>
483
+ </ChSection>
462
484
  )}
463
485
 
464
486
  </DeliveryOptionsContainer>
@@ -480,29 +502,6 @@ const CheckoutUI = (props: any) => {
480
502
  </ChSection>
481
503
  )}
482
504
 
483
- {/* <ChSection>
484
- <ChTotal>
485
- {
486
- (
487
- <>
488
- <OIcon
489
- url={businessLogo || businessDetails?.business?.logo}
490
- width={80}
491
- height={80}
492
- borderRadius={80}
493
- />
494
- <View style={{ marginLeft: 10, width: '85%' }}>
495
- <OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
496
- {businessName || businessDetails?.business?.name}
497
- </OText>
498
- <OText size={22}>
499
- {cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
500
- </OText>
501
- </View>
502
- </>
503
- )}
504
- </ChTotal>
505
- </ChSection> */}
506
505
  <ChSection>
507
506
  <ChAddress>
508
507
  {(businessDetails?.loading || cartState.loading) ? (
@@ -519,6 +518,7 @@ const CheckoutUI = (props: any) => {
519
518
  uuid={cartUuid}
520
519
  apiKey={configs?.google_maps_api_key?.value}
521
520
  mapConfigs={mapConfigs}
521
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
522
522
  />
523
523
  )}
524
524
  </ChAddress>
@@ -535,13 +535,11 @@ const CheckoutUI = (props: any) => {
535
535
  (
536
536
  <ChSection>
537
537
  <ChDriverTips>
538
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
539
- {t('DRIVER_TIPS', 'Driver Tips')}
540
- </OText>
538
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
541
539
  <DriverTips
542
540
  uuid={cartUuid}
543
541
  businessId={cart?.business_id}
544
- driverTipsOptions={driverTipsOptions}
542
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
545
543
  isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
546
544
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
547
545
  driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
@@ -556,9 +554,7 @@ const CheckoutUI = (props: any) => {
556
554
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
557
555
  <ChSection>
558
556
  <ChPaymethods>
559
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
560
- {t('PAYMENT_METHOD', 'Payment Method')}
561
- </OText>
557
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
562
558
  {!cartState.loading && cart?.status === 4 && (
563
559
  <OText
564
560
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -606,6 +602,7 @@ const CheckoutUI = (props: any) => {
606
602
  isInputMode
607
603
  cart={cart}
608
604
  spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
605
+ setPlaceSpotNumber={setPlaceSpotNumber}
609
606
  vehicleDefault={cart?.vehicle}
610
607
  />
611
608
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
@@ -623,19 +620,12 @@ const CheckoutUI = (props: any) => {
623
620
  ) : (
624
621
  <>
625
622
  <CartHeader>
626
- <OText
627
- size={16}
628
- lineHeight={24}
629
- color={theme.colors.textNormal}
630
- style={{ fontWeight: '500' }}
631
- >
632
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
633
- </OText>
623
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
634
624
  <TouchableOpacity
635
625
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
636
626
  >
637
627
  <OText
638
- size={10}
628
+ size={12}
639
629
  lineHeight={15}
640
630
  color={theme.colors.primary}
641
631
  style={{ textDecorationLine: 'underline' }}
@@ -652,7 +642,7 @@ const CheckoutUI = (props: any) => {
652
642
  <OText
653
643
  size={12}
654
644
  lineHeight={18}
655
- color={theme.colors.textSecondary}
645
+ color={theme.colors.primary}
656
646
  style={{ textDecorationLine: 'underline' }}
657
647
  >
658
648
  {t('CHANGE_STORE', 'Change store')}
@@ -743,7 +733,10 @@ const CheckoutUI = (props: any) => {
743
733
  togglePhoneUpdate={togglePhoneUpdate}
744
734
  requiredFields={requiredFields}
745
735
  hideUpdateButton
746
- onClose={() => setIsOpen(false)}
736
+ onClose={() => {
737
+ setIsOpen(false)
738
+ handlePlaceOrder(null, true)
739
+ }}
747
740
  />
748
741
  </View>
749
742
  </OModal>
@@ -751,10 +744,10 @@ const CheckoutUI = (props: any) => {
751
744
  </Container>
752
745
  {!cartState.loading && cart && cart?.status !== 2 && (
753
746
  <FloatingButton
754
- handleClick={() => handlePlaceOrder(null)}
747
+ handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
755
748
  isSecondaryBtn={isDisabledButtonPlace}
756
749
  disabled={isDisabledButtonPlace}
757
- btnText={cart?.subtotal >= cart?.minimum
750
+ btnText={subtotalWithTaxes >= cart?.minimum
758
751
  ? (
759
752
  placing
760
753
  ? t('PLACING', 'Placing')
@@ -781,19 +774,6 @@ const CheckoutUI = (props: any) => {
781
774
  setShowGateway={setShowGateway}
782
775
  />
783
776
  )}
784
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
785
- <PaymentOptionsWebView
786
- onNavigationRedirect={onNavigationRedirect}
787
- uri={`https://test-square-f50f7.web.app`}
788
- user={user}
789
- token={token}
790
- cart={cart}
791
- currency={currency}
792
- webviewPaymethod={webviewPaymethod}
793
- setShowGateway={setShowGateway}
794
- locationId={'L1NGAY5M6KJRX'}
795
- />
796
- )}
797
777
  </>
798
778
  )
799
779
  }
@@ -819,16 +799,23 @@ export const Checkout = (props: any) => {
819
799
 
820
800
  const getOrder = async (cartId: any) => {
821
801
  try {
822
- setCartState({ ...cartState, loading: true })
823
- const url = `${ordering.root}/carts/${cartId}`
824
- const response = await fetch(url, {
825
- method: 'GET',
826
- headers: {
827
- 'Content-Type': 'application/json',
828
- Authorization: `Bearer ${token}`
829
- }
830
- })
831
- const { result } = await response.json();
802
+ let result: any = {}
803
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
804
+ if (cart) {
805
+ result = { ...cart }
806
+ } else {
807
+ setCartState({ ...cartState, loading: true })
808
+ const url = `${ordering.root}/carts/${cartId}`
809
+ const response = await fetch(url, {
810
+ method: 'GET',
811
+ headers: {
812
+ 'Content-Type': 'application/json',
813
+ Authorization: `Bearer ${token}`
814
+ }
815
+ })
816
+ const content = await response.json();
817
+ result = content.result
818
+ }
832
819
 
833
820
  let publicKey = null
834
821
  try {
@@ -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;
@@ -76,7 +78,6 @@ export const ChCart = styled(ChPaymethods)``
76
78
 
77
79
  export const WalletPaymentOptionContainer = styled(ChPaymethods)`
78
80
  padding-bottom: 0;
79
- margin-left: -20px;
80
81
  `
81
82
 
82
83
  export const ChPlaceOrderBtn = styled.View`
@@ -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,24 @@ const DriverTipsUI = (props: any) => {
22
22
  const {
23
23
  driverTip,
24
24
  driverTipsOptions,
25
- optionSelected,
26
- isFixedPrice,
25
+ isMulti,
26
+ cart,
27
27
  isDriverTipUseCustom,
28
- handlerChangeOption
28
+ handlerChangeOption,
29
+ isFixedPrice
29
30
  } = props;
30
31
 
31
32
  const [{ parsePrice }] = useUtils();
33
+ const theme = useTheme();
32
34
  const [, t] = useLanguage();
33
35
  const [{ configs }] = useConfig();
34
-
35
- const theme = useTheme();
36
+ const [customTip, setCustomTip] = useState((!isMulti && isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) ?? false)
37
+ const currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0
38
+ const [value, setvalue] = useState('');
36
39
 
37
40
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
41
+ semicircle: {
42
+ borderRadius: 8
40
43
  },
41
44
  inputStyle: {
42
45
  flex: 1,
@@ -48,53 +51,59 @@ const DriverTipsUI = (props: any) => {
48
51
  }
49
52
  })
50
53
 
51
- const [value, setvalue] = useState('');
52
-
53
- const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
54
+ const placeholderCurrency = !isFixedPrice ? `0%` : (configs?.currency_position?.value || 'left') === 'left'
54
55
  ? `${configs?.format_number_currency?.value}0`
55
56
  : `0${configs?.format_number_currency?.value}`
56
57
 
57
58
  const handleChangeDriverTip = (val: any) => {
58
59
  const tip = Number(val)
59
60
  if ((isNaN(tip) || tip < 0)) {
60
- setvalue(value)
61
- return
61
+ setvalue(value)
62
+ return
62
63
  }
63
64
  setvalue(val)
64
65
  }
65
-
66
+
66
67
  return (
67
68
  <DTContainer>
68
69
  <DTLabel>
69
70
  {t('CUSTOM_DRIVER_TIP_MESSAGE', '100% of these tips go directly to your driver')}
70
71
  </DTLabel>
71
72
  <DTWrapperTips>
72
- {!isDriverTipUseCustom && driverTipsOptions.map((option: any, i: number) => (
73
+ {driverTipsOptions.map((option: any, i: number) => (
73
74
  <TouchableOpacity
74
75
  key={i}
75
- onPress={() => handlerChangeOption(option)}
76
+ onPress={() => {
77
+ handlerChangeOption(option)
78
+ setCustomTip(false)
79
+ }}
76
80
  >
77
81
  <DTCard
78
- style={style.circle}
79
- isActive={option === optionSelected}
82
+ style={style.semicircle}
83
+ isActive={(option === driverTip && !customTip)}
80
84
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
85
+ <OText size={12} numberOfLines={2} color={(option === driverTip && !customTip) ? '#FFF' : theme.colors.textSecondary}>
82
86
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
87
  </OText>
84
88
  </DTCard>
85
89
  </TouchableOpacity>
86
90
  ))}
91
+ {isDriverTipUseCustom && (
92
+ <TouchableOpacity
93
+ onPress={() => setCustomTip(true)}
94
+ >
95
+ <DTCard
96
+ style={style.semicircle}
97
+ isActive={customTip}
98
+ >
99
+ <OText size={12} numberOfLines={2} color={customTip ? '#FFF' : theme.colors.textSecondary}>
100
+ {t('CUSTOM_TIP', 'Custom')}
101
+ </OText>
102
+ </DTCard>
103
+ </TouchableOpacity>
104
+ )}
87
105
  </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 && (
106
+ {customTip && (
98
107
  <DTForm>
99
108
  <DTWrapperInput>
100
109
  <OInput
@@ -120,17 +129,18 @@ const DriverTipsUI = (props: any) => {
120
129
  }}
121
130
  />
122
131
  </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
132
  </DTForm>
133
133
  )}
134
+ {currentTip && (
135
+ <OText
136
+ color={theme.colors.primary}
137
+ size={16}
138
+ style={{ marginTop: 10, textAlign: 'center' }}
139
+ >
140
+ {t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount')}{!isFixedPrice &&
141
+ ` (${driverTip}%)`}: {isFixedPrice ? parsePrice(driverTip) : parsePrice(cart?.driver_tip)}
142
+ </OText>
143
+ )}
134
144
  </DTContainer>
135
145
  )
136
146
  }