ordering-ui-react-native 0.16.67 → 0.16.68-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 +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessInformation/index.tsx +19 -4
  6. package/src/components/BusinessInformation/styles.tsx +2 -2
  7. package/src/components/BusinessProductsList/index.tsx +10 -10
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +2 -1
  10. package/src/components/LanguageSelector/index.tsx +21 -16
  11. package/src/components/Messages/index.tsx +2 -2
  12. package/src/components/NotificationSetting/index.tsx +85 -0
  13. package/src/components/OrdersOption/index.tsx +54 -56
  14. package/src/components/PaymentOptions/index.tsx +298 -345
  15. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  16. package/src/components/SingleProductReview/index.tsx +7 -4
  17. package/src/components/StripeElementsForm/index.tsx +25 -16
  18. package/src/components/VerifyPhone/styles.tsx +1 -2
  19. package/src/components/shared/OBottomPopup.tsx +6 -2
  20. package/src/components/shared/OToast.tsx +4 -4
  21. package/src/index.tsx +2 -0
  22. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  23. package/src/utils/index.tsx +2 -1
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  26. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  27. package/themes/business/src/components/Chat/index.tsx +31 -31
  28. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  29. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  30. package/themes/business/src/components/MapView/index.tsx +14 -3
  31. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  32. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  35. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  36. package/themes/business/src/components/OrdersOption/index.tsx +74 -76
  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 +440 -245
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  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/OText.tsx +8 -2
  56. package/themes/business/src/types/index.tsx +22 -10
  57. package/themes/business/src/utils/index.tsx +10 -0
  58. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  60. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  62. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  63. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  64. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  65. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  66. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  67. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  68. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  69. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +8 -0
  72. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  73. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  74. package/themes/original/src/components/AddressList/index.tsx +18 -18
  75. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  76. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +49 -33
  78. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  79. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  80. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  81. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  82. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  83. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  84. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  85. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  86. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  87. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  88. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  89. package/themes/original/src/components/BusinessProductsList/index.tsx +54 -60
  90. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  91. package/themes/original/src/components/BusinessProductsListing/index.tsx +561 -477
  92. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  93. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +93 -98
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  97. package/themes/original/src/components/BusinessesListing/index.tsx +13 -8
  98. package/themes/original/src/components/Cart/index.tsx +63 -38
  99. package/themes/original/src/components/CartContent/index.tsx +80 -18
  100. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  101. package/themes/original/src/components/Checkout/index.tsx +110 -114
  102. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  103. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  104. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  105. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  106. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  107. package/themes/original/src/components/Favorite/index.tsx +7 -4
  108. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  109. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  110. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  111. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  112. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  113. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  114. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  115. package/themes/original/src/components/Help/index.tsx +7 -7
  116. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  117. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpGuide/index.tsx +12 -11
  119. package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
  120. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  121. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  122. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  124. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  125. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  126. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  127. package/themes/original/src/components/MessageListing/index.tsx +7 -7
  128. package/themes/original/src/components/Messages/index.tsx +35 -20
  129. package/themes/original/src/components/MomentOption/index.tsx +17 -11
  130. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  132. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  133. package/themes/original/src/components/MultiOrdersDetails/index.tsx +60 -33
  134. package/themes/original/src/components/MyOrders/index.tsx +86 -20
  135. package/themes/original/src/components/NavBar/index.tsx +7 -6
  136. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  137. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  138. package/themes/original/src/components/Notifications/index.tsx +144 -0
  139. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  140. package/themes/original/src/components/OrderDetails/index.tsx +114 -15
  141. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  142. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  143. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  144. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  145. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  146. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  147. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  150. package/themes/original/src/components/OrdersOption/index.tsx +97 -55
  151. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  152. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  153. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  154. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  155. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  156. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  157. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  158. package/themes/original/src/components/ProductForm/index.tsx +212 -253
  159. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  160. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  161. package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
  162. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  163. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  164. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  165. package/themes/original/src/components/Promotions/index.tsx +234 -220
  166. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  167. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  168. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  169. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  170. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  171. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  172. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  173. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  174. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  175. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  176. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +129 -54
  178. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  179. package/themes/original/src/components/SingleProductCard/index.tsx +101 -85
  180. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  181. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  182. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  183. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  184. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  187. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  188. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  189. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  190. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  191. package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
  192. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  193. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  194. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  195. package/themes/original/src/components/Wallets/index.tsx +176 -164
  196. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  197. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  198. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  199. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  200. package/themes/original/src/components/shared/OButton.tsx +9 -4
  201. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  202. package/themes/original/src/components/shared/OInput.tsx +10 -1
  203. package/themes/original/src/layouts/Container.tsx +13 -9
  204. package/themes/original/src/types/index.tsx +55 -5
  205. package/themes/original/src/utils/index.tsx +103 -58
  206. 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'
@@ -24,6 +24,7 @@ import { DriverTips } from '../DriverTips';
24
24
  import { NotFoundSource } from '../NotFoundSource';
25
25
  import { UserDetails } from '../UserDetails';
26
26
  import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
+ import { PlaceSpot } from '../PlaceSpot'
27
28
 
28
29
  import {
29
30
  ChContainer,
@@ -86,7 +87,8 @@ const CheckoutUI = (props: any) => {
86
87
  instructionsOptions,
87
88
  handleChangeDeliveryOption,
88
89
  currency,
89
- merchantId
90
+ merchantId,
91
+ setPlaceSpotNumber
90
92
  } = props
91
93
 
92
94
  const theme = useTheme();
@@ -105,8 +107,7 @@ const CheckoutUI = (props: any) => {
105
107
  padding: 20
106
108
  },
107
109
  pagePadding: {
108
- paddingLeft: 40,
109
- paddingRight: 40
110
+ paddingHorizontal: 40
110
111
  },
111
112
  icon: {
112
113
  top: 15,
@@ -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();
@@ -143,16 +146,23 @@ const CheckoutUI = (props: any) => {
143
146
  const [isOpen, setIsOpen] = useState(false)
144
147
  const [requiredFields, setRequiredFields] = useState<any>([])
145
148
 
146
- const placeSpotTypes = [4]
149
+ const placeSpotTypes = [3, 4, 5]
150
+ const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
147
151
  const businessConfigs = businessDetails?.business?.configs ?? []
148
152
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
149
153
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
150
154
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
151
155
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
156
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
152
157
 
153
158
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
154
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
155
- cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
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)
164
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
165
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
156
166
  (options.type === 1 &&
157
167
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
158
168
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -178,8 +188,9 @@ const CheckoutUI = (props: any) => {
178
188
  }
179
189
  }
180
190
 
181
- const handlePlaceOrder = (confirmPayment: any) => {
182
- if (!userErrors.length && !requiredFields?.length) {
191
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
192
+ if (!userErrors.length && !requiredFields?.length || forcePlace) {
193
+ Vibration.vibrate()
183
194
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
184
195
  return
185
196
  }
@@ -258,10 +269,6 @@ const CheckoutUI = (props: any) => {
258
269
  }
259
270
  }, [errors])
260
271
 
261
- // useEffect(() => {
262
- // handlePaymethodChange(null)
263
- // }, [cart?.total])
264
-
265
272
  useEffect(() => {
266
273
  if (cart?.products?.length === 0) {
267
274
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
@@ -272,6 +279,21 @@ const CheckoutUI = (props: any) => {
272
279
  onFailPaypal()
273
280
  }, [showGateway.closedByUser])
274
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
+
275
297
  return (
276
298
  <>
277
299
  <Container noPadding>
@@ -282,7 +304,6 @@ const CheckoutUI = (props: any) => {
282
304
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
283
305
  showCall={false}
284
306
  btnStyle={{ paddingLeft: 0 }}
285
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
286
307
  titleWrapStyle={{ paddingHorizontal: 0 }}
287
308
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
288
309
  />
@@ -290,13 +311,20 @@ const CheckoutUI = (props: any) => {
290
311
  <ChContainer style={styles.pagePadding}>
291
312
  <ChSection style={{ paddingTop: 0 }}>
292
313
  <ChHeader>
293
- {/* <OrderTypeSelector configTypes={configTypes} /> */}
294
- <CHMomentWrapper onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
295
- <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>
296
323
  <OIcon
297
324
  src={theme.images.general.arrow_down}
298
325
  width={10}
299
326
  style={{ marginStart: 8 }}
327
+ {...(isChewLayout && { color: 'white' })}
300
328
  />
301
329
  </CHMomentWrapper>
302
330
  <CHMomentWrapper
@@ -327,10 +355,10 @@ const CheckoutUI = (props: any) => {
327
355
  !businessDetails?.error &&
328
356
  (
329
357
  <Placeholder Animation={Fade}>
330
- <PlaceholderLine height={20} width={70} />
331
- <PlaceholderLine height={10} width={60} />
332
- <PlaceholderLine height={10} width={60} />
333
- <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 }} />
334
362
  </Placeholder>
335
363
  )}
336
364
  {
@@ -339,9 +367,7 @@ const CheckoutUI = (props: any) => {
339
367
  Object.values(businessDetails?.business).length > 0 &&
340
368
  (
341
369
  <>
342
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
343
- {t('BUSINESS_DETAILS', 'Business Details')}
344
- </OText>
370
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
345
371
  <View>
346
372
  <OText size={12} lineHeight={18} weight={'400'}>
347
373
  {businessDetails?.business?.name}
@@ -360,9 +386,7 @@ const CheckoutUI = (props: any) => {
360
386
  )}
361
387
  {businessDetails?.error && businessDetails?.error?.length > 0 && (
362
388
  <View>
363
- <OText size={16} lineHeight={24} weight={'500'}>
364
- {t('BUSINESS_DETAILS', 'Business Details')}
365
- </OText>
389
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
366
390
  <NotFoundSource
367
391
  content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
368
392
  />
@@ -376,14 +400,15 @@ const CheckoutUI = (props: any) => {
376
400
  <ChUserDetails>
377
401
  {cartState.loading ? (
378
402
  <Placeholder Animation={Fade}>
379
- <PlaceholderLine height={20} width={70} />
380
- <PlaceholderLine height={10} width={60} />
381
- <PlaceholderLine height={10} width={60} />
382
- <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 }} />
383
407
  </Placeholder>
384
408
  ) : (
385
409
  <UserDetails
386
410
  isUserDetailsEdit={isUserDetailsEdit}
411
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
387
412
  cartStatus={cart?.status}
388
413
  businessId={cart?.business_id}
389
414
  useValidationFields
@@ -403,13 +428,13 @@ const CheckoutUI = (props: any) => {
403
428
  {cartState.loading || deliveryOptionSelected === undefined ? (
404
429
  <View style={{ height: 110 }}>
405
430
  <Placeholder Animation={Fade}>
406
- <PlaceholderLine height={20} width={70} />
407
- <PlaceholderLine height={40} width={100} />
431
+ <PlaceholderLine height={20} />
432
+ <PlaceholderLine height={40} />
408
433
  </Placeholder>
409
434
  </View>
410
435
  ) : (
411
- <>
412
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
436
+ <ChSection>
437
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
413
438
  <View
414
439
  style={{
415
440
  backgroundColor: theme.colors.inputDisabled,
@@ -428,7 +453,7 @@ const CheckoutUI = (props: any) => {
428
453
  <OText
429
454
  size={14}
430
455
  >
431
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
456
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
432
457
  </OText>
433
458
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
434
459
  </DeliveryOptionItem>
@@ -455,7 +480,7 @@ const CheckoutUI = (props: any) => {
455
480
  />
456
481
  </View>
457
482
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
458
- </>
483
+ </ChSection>
459
484
  )}
460
485
 
461
486
  </DeliveryOptionsContainer>
@@ -477,29 +502,6 @@ const CheckoutUI = (props: any) => {
477
502
  </ChSection>
478
503
  )}
479
504
 
480
- {/* <ChSection>
481
- <ChTotal>
482
- {
483
- (
484
- <>
485
- <OIcon
486
- url={businessLogo || businessDetails?.business?.logo}
487
- width={80}
488
- height={80}
489
- borderRadius={80}
490
- />
491
- <View style={{ marginLeft: 10, width: '85%' }}>
492
- <OText size={22} numberOfLines={2} ellipsizeMode='tail' style={{ width: '85%' }}>
493
- {businessName || businessDetails?.business?.name}
494
- </OText>
495
- <OText size={22}>
496
- {cart?.total >= 1 && parsePrice(cart?.total) || cartTotal >= 1 && parsePrice(cartTotal)}
497
- </OText>
498
- </View>
499
- </>
500
- )}
501
- </ChTotal>
502
- </ChSection> */}
503
505
  <ChSection>
504
506
  <ChAddress>
505
507
  {(businessDetails?.loading || cartState.loading) ? (
@@ -516,6 +518,7 @@ const CheckoutUI = (props: any) => {
516
518
  uuid={cartUuid}
517
519
  apiKey={configs?.google_maps_api_key?.value}
518
520
  mapConfigs={mapConfigs}
521
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
519
522
  />
520
523
  )}
521
524
  </ChAddress>
@@ -532,13 +535,11 @@ const CheckoutUI = (props: any) => {
532
535
  (
533
536
  <ChSection>
534
537
  <ChDriverTips>
535
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
536
- {t('DRIVER_TIPS', 'Driver Tips')}
537
- </OText>
538
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
538
539
  <DriverTips
539
540
  uuid={cartUuid}
540
541
  businessId={cart?.business_id}
541
- driverTipsOptions={driverTipsOptions}
542
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
542
543
  isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
543
544
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
544
545
  driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
@@ -553,9 +554,7 @@ const CheckoutUI = (props: any) => {
553
554
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
554
555
  <ChSection>
555
556
  <ChPaymethods>
556
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
557
- {t('PAYMENT_METHOD', 'Payment Method')}
558
- </OText>
557
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
559
558
  {!cartState.loading && cart?.status === 4 && (
560
559
  <OText
561
560
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -595,6 +594,21 @@ const CheckoutUI = (props: any) => {
595
594
  )}
596
595
 
597
596
 
597
+ {!cartState.loading && placeSpotsEnabled && (
598
+ <>
599
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
600
+ <PlaceSpot
601
+ isCheckout
602
+ isInputMode
603
+ cart={cart}
604
+ spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
605
+ setPlaceSpotNumber={setPlaceSpotNumber}
606
+ vehicleDefault={cart?.vehicle}
607
+ />
608
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
609
+ </>
610
+ )}
611
+
598
612
  {!cartState.loading && cart && (
599
613
  <ChSection>
600
614
  <ChCart>
@@ -606,19 +620,12 @@ const CheckoutUI = (props: any) => {
606
620
  ) : (
607
621
  <>
608
622
  <CartHeader>
609
- <OText
610
- size={16}
611
- lineHeight={24}
612
- color={theme.colors.textNormal}
613
- style={{ fontWeight: '500' }}
614
- >
615
- {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
616
- </OText>
623
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
617
624
  <TouchableOpacity
618
625
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
619
626
  >
620
627
  <OText
621
- size={10}
628
+ size={12}
622
629
  lineHeight={15}
623
630
  color={theme.colors.primary}
624
631
  style={{ textDecorationLine: 'underline' }}
@@ -635,7 +642,7 @@ const CheckoutUI = (props: any) => {
635
642
  <OText
636
643
  size={12}
637
644
  lineHeight={18}
638
- color={theme.colors.textSecondary}
645
+ color={theme.colors.primary}
639
646
  style={{ textDecorationLine: 'underline' }}
640
647
  >
641
648
  {t('CHANGE_STORE', 'Change store')}
@@ -683,14 +690,6 @@ const CheckoutUI = (props: any) => {
683
690
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
684
691
  </OText>
685
692
  )}
686
- {placeSpotTypes.includes(options?.type) && !cart?.place && (
687
- <OText
688
- color={theme.colors.error}
689
- size={12}
690
- >
691
- {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
692
- </OText>
693
- )}
694
693
  {options.type === 1 &&
695
694
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
696
695
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -734,7 +733,10 @@ const CheckoutUI = (props: any) => {
734
733
  togglePhoneUpdate={togglePhoneUpdate}
735
734
  requiredFields={requiredFields}
736
735
  hideUpdateButton
737
- onClose={() => setIsOpen(false)}
736
+ onClose={() => {
737
+ setIsOpen(false)
738
+ handlePlaceOrder(null, true)
739
+ }}
738
740
  />
739
741
  </View>
740
742
  </OModal>
@@ -742,10 +744,10 @@ const CheckoutUI = (props: any) => {
742
744
  </Container>
743
745
  {!cartState.loading && cart && cart?.status !== 2 && (
744
746
  <FloatingButton
745
- handleClick={() => handlePlaceOrder(null)}
747
+ handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
746
748
  isSecondaryBtn={isDisabledButtonPlace}
747
749
  disabled={isDisabledButtonPlace}
748
- btnText={cart?.subtotal >= cart?.minimum
750
+ btnText={subtotalWithTaxes >= cart?.minimum
749
751
  ? (
750
752
  placing
751
753
  ? t('PLACING', 'Placing')
@@ -772,19 +774,6 @@ const CheckoutUI = (props: any) => {
772
774
  setShowGateway={setShowGateway}
773
775
  />
774
776
  )}
775
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
776
- <PaymentOptionsWebView
777
- onNavigationRedirect={onNavigationRedirect}
778
- uri={`https://test-square-f50f7.web.app`}
779
- user={user}
780
- token={token}
781
- cart={cart}
782
- currency={currency}
783
- webviewPaymethod={webviewPaymethod}
784
- setShowGateway={setShowGateway}
785
- locationId={'L1NGAY5M6KJRX'}
786
- />
787
- )}
788
777
  </>
789
778
  )
790
779
  }
@@ -810,16 +799,23 @@ export const Checkout = (props: any) => {
810
799
 
811
800
  const getOrder = async (cartId: any) => {
812
801
  try {
813
- setCartState({ ...cartState, loading: true })
814
- const url = `${ordering.root}/carts/${cartId}`
815
- const response = await fetch(url, {
816
- method: 'GET',
817
- headers: {
818
- 'Content-Type': 'application/json',
819
- Authorization: `Bearer ${token}`
820
- }
821
- })
822
- 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
+ }
823
819
 
824
820
  let publicKey = null
825
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
+ `