ordering-ui-react-native 0.16.76 → 0.16.77-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 (215) 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/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +2 -2
  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/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  17. package/src/utils/index.tsx +2 -1
  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 +7 -5
  23. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  24. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  25. package/themes/business/src/components/LoginForm/index.tsx +332 -140
  26. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  27. package/themes/business/src/components/MapView/index.tsx +14 -3
  28. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  30. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  31. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  32. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  33. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  34. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  35. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  36. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  37. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  41. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  42. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  43. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  44. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  45. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  46. package/themes/business/src/components/ProductItemAccordion/index.tsx +24 -5
  47. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  48. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  49. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  50. package/themes/business/src/components/shared/OLink.tsx +33 -13
  51. package/themes/business/src/components/shared/OText.tsx +8 -2
  52. package/themes/business/src/types/index.tsx +29 -3
  53. package/themes/business/src/utils/index.tsx +26 -0
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  58. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  59. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  60. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +545 -112
  62. package/themes/kiosk/src/components/LoginForm/styles.tsx +18 -0
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  67. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  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/components/shared/OModal.tsx +14 -11
  71. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  72. package/themes/kiosk/src/types/index.d.ts +15 -0
  73. package/themes/kiosk/src/utils/index.tsx +15 -0
  74. package/themes/original/index.tsx +8 -0
  75. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  76. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  77. package/themes/original/src/components/AddressList/index.tsx +18 -18
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  79. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  80. package/themes/original/src/components/BusinessBasicInformation/index.tsx +47 -22
  81. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  82. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  83. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  84. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  85. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  86. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  87. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  88. package/themes/original/src/components/BusinessListingSearch/index.tsx +104 -155
  89. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  90. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  91. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  92. package/themes/original/src/components/BusinessProductsList/index.tsx +26 -52
  93. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  94. package/themes/original/src/components/BusinessProductsListing/index.tsx +563 -493
  95. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  96. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  97. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  100. package/themes/original/src/components/BusinessesListing/index.tsx +7 -6
  101. package/themes/original/src/components/Cart/index.tsx +75 -40
  102. package/themes/original/src/components/CartContent/index.tsx +80 -18
  103. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  104. package/themes/original/src/components/Checkout/index.tsx +102 -108
  105. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  106. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  107. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  108. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  109. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  110. package/themes/original/src/components/Favorite/index.tsx +7 -4
  111. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  112. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  113. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  114. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  115. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  116. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  117. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  118. package/themes/original/src/components/Help/index.tsx +8 -8
  119. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  120. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  121. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  122. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  123. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  124. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  125. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  126. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  127. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  128. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  129. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  130. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  131. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  132. package/themes/original/src/components/Messages/index.tsx +42 -26
  133. package/themes/original/src/components/MomentOption/index.tsx +23 -14
  134. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  135. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  136. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  137. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  139. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  140. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  141. package/themes/original/src/components/NavBar/index.tsx +7 -6
  142. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  143. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  144. package/themes/original/src/components/Notifications/index.tsx +144 -0
  145. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  146. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  147. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  148. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  149. package/themes/original/src/components/OrderProgress/index.tsx +81 -105
  150. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  151. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  152. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  153. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
  154. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  155. package/themes/original/src/components/OrdersOption/index.tsx +86 -92
  156. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  157. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
  161. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  162. package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
  163. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  164. package/themes/original/src/components/ProductForm/index.tsx +240 -254
  165. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  166. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  167. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  168. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  169. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  170. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  171. package/themes/original/src/components/ProfessionalProfile/index.tsx +20 -9
  172. package/themes/original/src/components/Promotions/index.tsx +234 -220
  173. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  174. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  175. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  176. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  177. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  178. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  179. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  180. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  181. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  182. package/themes/original/src/components/ServiceForm/index.tsx +360 -265
  183. package/themes/original/src/components/Sessions/index.tsx +11 -8
  184. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  185. package/themes/original/src/components/SignupForm/index.tsx +150 -100
  186. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  187. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  188. package/themes/original/src/components/SingleProductCard/index.tsx +116 -79
  189. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  190. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  191. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  192. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  194. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  195. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  196. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  197. package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
  198. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  199. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  200. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  201. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  202. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  203. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  204. package/themes/original/src/components/Wallets/index.tsx +177 -164
  205. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  206. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  207. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  208. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  209. package/themes/original/src/components/shared/OButton.tsx +9 -4
  210. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  211. package/themes/original/src/components/shared/OInput.tsx +10 -1
  212. package/themes/original/src/layouts/Container.tsx +13 -9
  213. package/themes/original/src/types/index.tsx +42 -7
  214. package/themes/original/src/utils/index.tsx +322 -58
  215. 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
  }
@@ -198,6 +206,11 @@ const CheckoutUI = (props: any) => {
198
206
  setIsUserDetailsEdit(true)
199
207
  }
200
208
 
209
+ const handlePlaceOrderAsGuest = () => {
210
+ setIsOpen(false)
211
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
212
+ }
213
+
201
214
  const handlePaymentMethodClick = (paymethod: any) => {
202
215
  setShowGateway({ closedByUser: false, open: true })
203
216
  setWebviewPaymethod(paymethod)
@@ -261,10 +274,6 @@ const CheckoutUI = (props: any) => {
261
274
  }
262
275
  }, [errors])
263
276
 
264
- // useEffect(() => {
265
- // handlePaymethodChange(null)
266
- // }, [cart?.total])
267
-
268
277
  useEffect(() => {
269
278
  if (cart?.products?.length === 0) {
270
279
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null })
@@ -275,6 +284,21 @@ const CheckoutUI = (props: any) => {
275
284
  onFailPaypal()
276
285
  }, [showGateway.closedByUser])
277
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
+
278
302
  return (
279
303
  <>
280
304
  <Container noPadding>
@@ -284,8 +308,7 @@ const CheckoutUI = (props: any) => {
284
308
  titleAlign={'center'}
285
309
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
286
310
  showCall={false}
287
- btnStyle={{ paddingLeft: 0 }}
288
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
311
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
289
312
  titleWrapStyle={{ paddingHorizontal: 0 }}
290
313
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
291
314
  />
@@ -293,13 +316,20 @@ const CheckoutUI = (props: any) => {
293
316
  <ChContainer style={styles.pagePadding}>
294
317
  <ChSection style={{ paddingTop: 0 }}>
295
318
  <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>
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>
299
328
  <OIcon
300
329
  src={theme.images.general.arrow_down}
301
330
  width={10}
302
331
  style={{ marginStart: 8 }}
332
+ {...(isChewLayout && { color: 'white' })}
303
333
  />
304
334
  </CHMomentWrapper>
305
335
  <CHMomentWrapper
@@ -330,10 +360,10 @@ const CheckoutUI = (props: any) => {
330
360
  !businessDetails?.error &&
331
361
  (
332
362
  <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 }} />
363
+ <PlaceholderLine height={20} />
364
+ <PlaceholderLine height={12} />
365
+ <PlaceholderLine height={12} />
366
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
337
367
  </Placeholder>
338
368
  )}
339
369
  {
@@ -342,9 +372,7 @@ const CheckoutUI = (props: any) => {
342
372
  Object.values(businessDetails?.business).length > 0 &&
343
373
  (
344
374
  <>
345
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
346
- {t('BUSINESS_DETAILS', 'Business Details')}
347
- </OText>
375
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
348
376
  <View>
349
377
  <OText size={12} lineHeight={18} weight={'400'}>
350
378
  {businessDetails?.business?.name}
@@ -363,9 +391,7 @@ const CheckoutUI = (props: any) => {
363
391
  )}
364
392
  {businessDetails?.error && businessDetails?.error?.length > 0 && (
365
393
  <View>
366
- <OText size={16} lineHeight={24} weight={'500'}>
367
- {t('BUSINESS_DETAILS', 'Business Details')}
368
- </OText>
394
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
369
395
  <NotFoundSource
370
396
  content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
371
397
  />
@@ -379,14 +405,15 @@ const CheckoutUI = (props: any) => {
379
405
  <ChUserDetails>
380
406
  {cartState.loading ? (
381
407
  <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 }} />
408
+ <PlaceholderLine height={20} />
409
+ <PlaceholderLine height={12} />
410
+ <PlaceholderLine height={12} />
411
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
386
412
  </Placeholder>
387
413
  ) : (
388
414
  <UserDetails
389
415
  isUserDetailsEdit={isUserDetailsEdit}
416
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
390
417
  cartStatus={cart?.status}
391
418
  businessId={cart?.business_id}
392
419
  useValidationFields
@@ -406,13 +433,13 @@ const CheckoutUI = (props: any) => {
406
433
  {cartState.loading || deliveryOptionSelected === undefined ? (
407
434
  <View style={{ height: 110 }}>
408
435
  <Placeholder Animation={Fade}>
409
- <PlaceholderLine height={20} width={70} />
410
- <PlaceholderLine height={40} width={100} />
436
+ <PlaceholderLine height={20} />
437
+ <PlaceholderLine height={40} />
411
438
  </Placeholder>
412
439
  </View>
413
440
  ) : (
414
- <>
415
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
441
+ <ChSection>
442
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
416
443
  <View
417
444
  style={{
418
445
  backgroundColor: theme.colors.inputDisabled,
@@ -431,7 +458,7 @@ const CheckoutUI = (props: any) => {
431
458
  <OText
432
459
  size={14}
433
460
  >
434
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
461
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
435
462
  </OText>
436
463
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
437
464
  </DeliveryOptionItem>
@@ -458,7 +485,7 @@ const CheckoutUI = (props: any) => {
458
485
  />
459
486
  </View>
460
487
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
461
- </>
488
+ </ChSection>
462
489
  )}
463
490
 
464
491
  </DeliveryOptionsContainer>
@@ -480,29 +507,6 @@ const CheckoutUI = (props: any) => {
480
507
  </ChSection>
481
508
  )}
482
509
 
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
510
  <ChSection>
507
511
  <ChAddress>
508
512
  {(businessDetails?.loading || cartState.loading) ? (
@@ -519,6 +523,7 @@ const CheckoutUI = (props: any) => {
519
523
  uuid={cartUuid}
520
524
  apiKey={configs?.google_maps_api_key?.value}
521
525
  mapConfigs={mapConfigs}
526
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
522
527
  />
523
528
  )}
524
529
  </ChAddress>
@@ -535,19 +540,18 @@ const CheckoutUI = (props: any) => {
535
540
  (
536
541
  <ChSection>
537
542
  <ChDriverTips>
538
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
539
- {t('DRIVER_TIPS', 'Driver Tips')}
540
- </OText>
543
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
541
544
  <DriverTips
542
545
  uuid={cartUuid}
543
546
  businessId={cart?.business_id}
544
- driverTipsOptions={driverTipsOptions}
545
- 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}
546
549
  isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
547
- 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
548
551
  ? cart?.driver_tip
549
552
  : cart?.driver_tip_rate}
550
553
  useOrderContext
554
+ cart={cart}
551
555
  />
552
556
  </ChDriverTips>
553
557
  </ChSection>
@@ -556,9 +560,7 @@ const CheckoutUI = (props: any) => {
556
560
  {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
557
561
  <ChSection>
558
562
  <ChPaymethods>
559
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
560
- {t('PAYMENT_METHOD', 'Payment Method')}
561
- </OText>
563
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
562
564
  {!cartState.loading && cart?.status === 4 && (
563
565
  <OText
564
566
  style={{ textAlign: 'center', marginTop: 20 }}
@@ -606,6 +608,7 @@ const CheckoutUI = (props: any) => {
606
608
  isInputMode
607
609
  cart={cart}
608
610
  spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
611
+ setPlaceSpotNumber={setPlaceSpotNumber}
609
612
  vehicleDefault={cart?.vehicle}
610
613
  />
611
614
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
@@ -623,19 +626,12 @@ const CheckoutUI = (props: any) => {
623
626
  ) : (
624
627
  <>
625
628
  <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>
629
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
634
630
  <TouchableOpacity
635
631
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
636
632
  >
637
633
  <OText
638
- size={10}
634
+ size={12}
639
635
  lineHeight={15}
640
636
  color={theme.colors.primary}
641
637
  style={{ textDecorationLine: 'underline' }}
@@ -652,7 +648,7 @@ const CheckoutUI = (props: any) => {
652
648
  <OText
653
649
  size={12}
654
650
  lineHeight={18}
655
- color={theme.colors.textSecondary}
651
+ color={theme.colors.primary}
656
652
  style={{ textDecorationLine: 'underline' }}
657
653
  >
658
654
  {t('CHANGE_STORE', 'Change store')}
@@ -743,7 +739,11 @@ const CheckoutUI = (props: any) => {
743
739
  togglePhoneUpdate={togglePhoneUpdate}
744
740
  requiredFields={requiredFields}
745
741
  hideUpdateButton
746
- onClose={() => setIsOpen(false)}
742
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
743
+ onClose={() => {
744
+ setIsOpen(false)
745
+ handlePlaceOrder(null, true)
746
+ }}
747
747
  />
748
748
  </View>
749
749
  </OModal>
@@ -751,10 +751,10 @@ const CheckoutUI = (props: any) => {
751
751
  </Container>
752
752
  {!cartState.loading && cart && cart?.status !== 2 && (
753
753
  <FloatingButton
754
- handleClick={() => handlePlaceOrder(null)}
754
+ handleClick={isDisabledButtonPlace ? () => Vibration.vibrate() : () => handlePlaceOrder(null)}
755
755
  isSecondaryBtn={isDisabledButtonPlace}
756
756
  disabled={isDisabledButtonPlace}
757
- btnText={cart?.subtotal >= cart?.minimum
757
+ btnText={subtotalWithTaxes >= cart?.minimum
758
758
  ? (
759
759
  placing
760
760
  ? t('PLACING', 'Placing')
@@ -781,19 +781,6 @@ const CheckoutUI = (props: any) => {
781
781
  setShowGateway={setShowGateway}
782
782
  />
783
783
  )}
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
784
  </>
798
785
  )
799
786
  }
@@ -819,16 +806,23 @@ export const Checkout = (props: any) => {
819
806
 
820
807
  const getOrder = async (cartId: any) => {
821
808
  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();
809
+ let result: any = {}
810
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
811
+ if (cart) {
812
+ result = { ...cart }
813
+ } else {
814
+ setCartState({ ...cartState, loading: true })
815
+ const url = `${ordering.root}/carts/${cartId}`
816
+ const response = await fetch(url, {
817
+ method: 'GET',
818
+ headers: {
819
+ 'Content-Type': 'application/json',
820
+ Authorization: `Bearer ${token}`
821
+ }
822
+ })
823
+ const content = await response.json();
824
+ result = content.result
825
+ }
832
826
 
833
827
  let publicKey = null
834
828
  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
+ `