ordering-ui-react-native 0.16.20 → 0.16.22-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 (204) hide show
  1. package/package.json +7 -4
  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/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +33 -4
  9. package/src/components/BusinessInformation/styles.tsx +2 -2
  10. package/src/components/BusinessProductsList/index.tsx +10 -10
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +2 -20
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/pages/BusinessesListing.tsx +7 -6
  32. package/src/pages/OrderDetails.tsx +1 -1
  33. package/src/pages/ReviewDriver.tsx +2 -2
  34. package/src/pages/ReviewOrder.tsx +2 -2
  35. package/src/theme.json +0 -1
  36. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  37. package/src/types/index.tsx +13 -9
  38. package/src/utils/index.tsx +0 -1
  39. package/themes/business/index.tsx +4 -0
  40. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  41. package/themes/business/src/components/Chat/index.tsx +42 -34
  42. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  43. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  44. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  45. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  46. package/themes/business/src/components/MapView/index.tsx +12 -1
  47. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  48. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  49. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  50. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  51. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  52. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  53. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  54. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  55. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  56. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  57. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  58. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  61. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  62. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  63. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  64. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  65. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  66. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  67. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  68. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  69. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  70. package/themes/business/src/components/shared/OModal.tsx +40 -37
  71. package/themes/business/src/types/index.tsx +15 -9
  72. package/themes/business/src/utils/index.tsx +10 -0
  73. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  74. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  75. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  76. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  77. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  78. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  79. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  80. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  81. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  82. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  83. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  84. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  85. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  86. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  87. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  88. package/themes/kiosk/src/types/index.d.ts +2 -0
  89. package/themes/original/index.tsx +12 -0
  90. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  91. package/themes/original/src/components/AddressList/index.tsx +1 -1
  92. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  93. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  94. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  95. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  96. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -6
  97. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  98. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  99. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  100. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  101. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  102. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  103. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  104. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  105. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  106. package/themes/original/src/components/BusinessProductsListing/index.tsx +287 -175
  107. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
  108. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  109. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  110. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  111. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  112. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
  113. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  114. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  115. package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
  116. package/themes/original/src/components/Cart/index.tsx +42 -10
  117. package/themes/original/src/components/Cart/styles.tsx +4 -0
  118. package/themes/original/src/components/CartContent/index.tsx +22 -16
  119. package/themes/original/src/components/Checkout/index.tsx +106 -66
  120. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  121. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  122. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  123. package/themes/original/src/components/Favorite/index.tsx +1 -0
  124. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  125. package/themes/original/src/components/FavoriteList/index.tsx +142 -93
  126. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  127. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  128. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  129. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  130. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  131. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  132. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  133. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  134. package/themes/original/src/components/LoginForm/index.tsx +82 -44
  135. package/themes/original/src/components/Messages/index.tsx +17 -17
  136. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  137. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  138. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  140. package/themes/original/src/components/MyOrders/index.tsx +68 -6
  141. package/themes/original/src/components/NavBar/index.tsx +15 -9
  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 +148 -0
  145. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  146. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +200 -42
  148. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  149. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  150. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  151. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  152. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  154. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
  156. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
  157. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  158. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  159. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  160. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  161. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  162. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  163. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  164. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  165. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  166. package/themes/original/src/components/ProductItemAccordion/index.tsx +198 -127
  167. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  168. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  169. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  170. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  171. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  172. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  173. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  174. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  175. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  176. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  177. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  178. package/themes/original/src/components/ServiceForm/index.tsx +631 -0
  179. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  180. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  181. package/themes/original/src/components/SingleOrderCard/index.tsx +214 -179
  182. package/themes/original/src/components/SingleProductCard/index.tsx +194 -108
  183. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  184. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  185. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  186. package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
  187. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  188. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  189. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  190. package/themes/original/src/components/UserProfile/index.tsx +57 -29
  191. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  192. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  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 +174 -162
  196. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  197. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  198. package/themes/original/src/components/shared/OButton.tsx +10 -3
  199. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  200. package/themes/original/src/components/shared/OInput.tsx +3 -2
  201. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  202. package/themes/original/src/types/index.tsx +124 -30
  203. package/themes/original/src/utils/index.tsx +77 -0
  204. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -8,7 +8,7 @@ import {
8
8
  useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
- import { CContainer, CheckoutAction, Divider } from './styles';
11
+ import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -25,6 +25,7 @@ import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
26
  import { OAlert } from '../../../../../src/components/shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
+ import { DriverTips } from '../DriverTips'
28
29
 
29
30
  const CartUI = (props: any) => {
30
31
  const {
@@ -60,11 +61,16 @@ const CartUI = (props: any) => {
60
61
 
61
62
  const isCartPending = cart?.status === 2
62
63
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
63
- const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
64
+ const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
65
+ const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
64
66
 
65
67
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
66
68
  const businessId = business?.business_id ?? null
67
- const placeSpotTypes = [3, 4]
69
+ const placeSpotTypes = [4]
70
+
71
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
72
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
73
+ : configs?.driver_tip_options?.value || []
68
74
 
69
75
  const momentFormatted = !orderState?.option?.moment
70
76
  ? t('RIGHT_NOW', 'Right Now')
@@ -98,11 +104,11 @@ const CartUI = (props: any) => {
98
104
  const handleUpsellingPage = () => {
99
105
  setOpenUpselling(false)
100
106
  setCanOpenUpselling(false)
101
- if (isCheckoutMultiBusinessEnabled) {
102
- props.onNavigationRedirect('CheckoutNavigator', {
103
- screen: 'MultiCheckout'
104
- })
105
- } else {
107
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
108
+ props.onNavigationRedirect('CheckoutNavigator', {
109
+ screen: 'MultiCheckout'
110
+ })
111
+ } else {
106
112
  props.onNavigationRedirect('CheckoutNavigator', {
107
113
  screen: 'CheckoutPage',
108
114
  cartUuid: cart?.uuid,
@@ -355,13 +361,39 @@ const CartUI = (props: any) => {
355
361
  </OSTable>
356
362
  )}
357
363
 
364
+ {isMultiCheckout &&
365
+ cart &&
366
+ cart?.valid &&
367
+ orderState?.options?.type === 1 &&
368
+ cart?.status !== 2 &&
369
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
370
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
371
+ (
372
+ <DriverTipsContainer>
373
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
374
+ {t('DRIVER_TIPS', 'Driver Tips')}
375
+ </OText>
376
+ <DriverTips
377
+ uuid={cart?.uuid}
378
+ businessId={cart?.business_id}
379
+ driverTipsOptions={driverTipsOptions}
380
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
381
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
382
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
383
+ ? cart?.driver_tip
384
+ : cart?.driver_tip_rate}
385
+ useOrderContext
386
+ />
387
+ </DriverTipsContainer>
388
+ )}
389
+
358
390
  <OSTotal>
359
391
  <OSTable style={{ marginTop: 15 }}>
360
392
  <OText size={14} lineHeight={21} weight={'600'}>
361
393
  {t('TOTAL', 'Total')}
362
394
  </OText>
363
395
  <OText size={14} lineHeight={21} weight={'600'}>
364
- {parsePrice(cart?.total >= 0 ? cart?.total : 0)}
396
+ {parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
365
397
  </OText>
366
398
  </OSTable>
367
399
  </OSTotal>
@@ -446,7 +478,7 @@ const CartUI = (props: any) => {
446
478
  </OText>
447
479
  </View>
448
480
  )}
449
- </>
481
+ </>
450
482
  )}
451
483
  </BusinessItemAccordion>
452
484
 
@@ -33,3 +33,7 @@ export const Divider = styled.View`
33
33
  margin-top: 5px;
34
34
  margin-bottom: 10px;
35
35
  `
36
+
37
+ export const DriverTipsContainer = styled.View`
38
+ padding: 5px 0;
39
+ `
@@ -1,17 +1,18 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { useLanguage, useOrder } from 'ordering-components/native';
1
+ import React, { useState } from 'react';
2
+ import { View } from 'react-native';
3
+ import { useLanguage } from 'ordering-components/native';
3
4
  import { useTheme } from 'styled-components/native';
4
5
  import { CCContainer, CCNotCarts, CCList } from './styles';
5
6
 
6
7
  import { Cart } from '../Cart';
7
- import { OIcon, OText } from '../shared';
8
+ import { OButton, OText } from '../shared';
8
9
  import Spinner from 'react-native-loading-spinner-overlay';
9
- import { View } from 'react-native';
10
10
 
11
11
  export const CartContent = (props: any) => {
12
12
  const {
13
13
  carts,
14
- isOrderStateCarts
14
+ isOrderStateCarts,
15
+ onNavigationRedirect
15
16
  } = props
16
17
 
17
18
  const theme = useTheme();
@@ -22,18 +23,15 @@ export const CartContent = (props: any) => {
22
23
  <CCContainer>
23
24
  {isOrderStateCarts && carts?.length > 0 && (
24
25
  <>
25
- {/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
- {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText> */}
28
26
  {carts.map((cart: any, i: number) => (
29
27
  <CCList key={i} style={{ overflow: 'visible' }}>
30
28
  {cart.products.length > 0 && (
31
29
  <>
32
30
  <Cart
33
- singleBusiness={props.singleBusiness}
34
- isFranchiseApp={props.isFranchiseApp}
31
+ singleBusiness={props.singleBusiness}
32
+ isFranchiseApp={props.isFranchiseApp}
35
33
  cart={cart}
36
- cartuuid={cart.uuid}
34
+ cartuuid={cart.uuid}
37
35
  onNavigationRedirect={props.onNavigationRedirect}
38
36
  isCartsLoading={isCartsLoading}
39
37
  setIsCartsLoading={setIsCartsLoading}
@@ -48,14 +46,22 @@ export const CartContent = (props: any) => {
48
46
  )}
49
47
  {(!carts || carts?.length === 0) && (
50
48
  <CCNotCarts>
51
- {/* <OIcon
52
- url={props.icon}
53
- width={200}
54
- height={122}
55
- /> */}
56
49
  <OText size={24} style={{ textAlign: 'center' }}>
57
50
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
58
51
  </OText>
52
+ <OButton
53
+ text={t('START_SHOPPING', 'Start shopping')}
54
+ bgColor={theme.colors.primary}
55
+ borderColor={theme.colors.primary}
56
+ textStyle={{
57
+ color: theme.colors.white,
58
+ fontSize: 14,
59
+ paddingRight: 0
60
+ }}
61
+ style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
62
+ imgRightSrc={null}
63
+ onClick={() => onNavigationRedirect('BusinessList')}
64
+ />
59
65
  </CCNotCarts>
60
66
  )}
61
67
  <Spinner visible={isCartsLoading} />
@@ -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,
@@ -105,8 +106,7 @@ const CheckoutUI = (props: any) => {
105
106
  padding: 20
106
107
  },
107
108
  pagePadding: {
108
- paddingLeft: 40,
109
- paddingRight: 40
109
+ paddingHorizontal: 40
110
110
  },
111
111
  icon: {
112
112
  top: 15,
@@ -114,6 +114,10 @@ const CheckoutUI = (props: any) => {
114
114
  position: 'absolute',
115
115
  fontSize: 20
116
116
  },
117
+ detailWrapper: {
118
+ paddingHorizontal: 40,
119
+ width: '100%'
120
+ },
117
121
  wrapperNavbar: Platform.OS === 'ios'
118
122
  ? { paddingVertical: 0, paddingHorizontal: 40 }
119
123
  : { paddingVertical: 20, paddingHorizontal: 40 }
@@ -136,16 +140,21 @@ const CheckoutUI = (props: any) => {
136
140
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
137
141
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
138
142
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
143
+ const [isOpen, setIsOpen] = useState(false)
144
+ const [requiredFields, setRequiredFields] = useState<any>([])
139
145
 
140
- const placeSpotTypes = [3, 4]
146
+ const placeSpotTypes = [3, 4, 5]
147
+ const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
141
148
  const businessConfigs = businessDetails?.business?.configs ?? []
142
149
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
143
150
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
144
151
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
152
+ const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
145
153
 
146
154
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
147
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
148
- cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
155
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
156
+ placing || errorCash || cart?.subtotal < cart?.minimum ||
157
+ // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
149
158
  (options.type === 1 &&
150
159
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
151
160
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -171,9 +180,13 @@ const CheckoutUI = (props: any) => {
171
180
  }
172
181
  }
173
182
 
174
- const handlePlaceOrder = () => {
175
- if (!userErrors.length) {
176
- handlerClickPlaceOrder && handlerClickPlaceOrder()
183
+ const handlePlaceOrder = (confirmPayment: any) => {
184
+ if (!userErrors.length && !requiredFields?.length) {
185
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
186
+ return
187
+ }
188
+ if (requiredFields?.length) {
189
+ setIsOpen(true)
177
190
  return
178
191
  }
179
192
  let stringError = ''
@@ -203,11 +216,12 @@ const CheckoutUI = (props: any) => {
203
216
  setUserErrors([])
204
217
  const errors = []
205
218
  const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
219
+ const _requiredFields: any = []
206
220
 
207
221
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
208
- if (field?.required && !notFields.includes(field.code)) {
222
+ if (field?.required && !notFields.includes(field.code) && field?.enabled) {
209
223
  if (!user[field?.code]) {
210
- errors.push(t(`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`, `The field ${field?.name} is required`))
224
+ _requiredFields.push(field?.code)
211
225
  }
212
226
  }
213
227
  })
@@ -218,8 +232,9 @@ const CheckoutUI = (props: any) => {
218
232
  validationFields?.fields?.checkout?.cellphone?.required) ||
219
233
  configs?.verification_phone_required?.value === '1')
220
234
  ) {
221
- errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
235
+ _requiredFields.push('cellphone')
222
236
  }
237
+ setRequiredFields(_requiredFields)
223
238
 
224
239
  if (phoneUpdate) {
225
240
  errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
@@ -314,10 +329,10 @@ const CheckoutUI = (props: any) => {
314
329
  !businessDetails?.error &&
315
330
  (
316
331
  <Placeholder Animation={Fade}>
317
- <PlaceholderLine height={20} width={70} />
318
- <PlaceholderLine height={10} width={60} />
319
- <PlaceholderLine height={10} width={60} />
320
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
332
+ <PlaceholderLine height={20} />
333
+ <PlaceholderLine height={12} />
334
+ <PlaceholderLine height={12} />
335
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
321
336
  </Placeholder>
322
337
  )}
323
338
  {
@@ -363,10 +378,10 @@ const CheckoutUI = (props: any) => {
363
378
  <ChUserDetails>
364
379
  {cartState.loading ? (
365
380
  <Placeholder Animation={Fade}>
366
- <PlaceholderLine height={20} width={70} />
367
- <PlaceholderLine height={10} width={60} />
368
- <PlaceholderLine height={10} width={60} />
369
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
381
+ <PlaceholderLine height={20} />
382
+ <PlaceholderLine height={12} />
383
+ <PlaceholderLine height={12} />
384
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
370
385
  </Placeholder>
371
386
  ) : (
372
387
  <UserDetails
@@ -390,8 +405,8 @@ const CheckoutUI = (props: any) => {
390
405
  {cartState.loading || deliveryOptionSelected === undefined ? (
391
406
  <View style={{ height: 110 }}>
392
407
  <Placeholder Animation={Fade}>
393
- <PlaceholderLine height={20} width={70} />
394
- <PlaceholderLine height={40} width={100} />
408
+ <PlaceholderLine height={20} />
409
+ <PlaceholderLine height={40} />
395
410
  </Placeholder>
396
411
  </View>
397
412
  ) : (
@@ -582,6 +597,20 @@ const CheckoutUI = (props: any) => {
582
597
  )}
583
598
 
584
599
 
600
+ {!cartState.loading && placeSpotsEnabled && (
601
+ <>
602
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
603
+ <PlaceSpot
604
+ isCheckout
605
+ isInputMode
606
+ cart={cart}
607
+ spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
608
+ vehicleDefault={cart?.vehicle}
609
+ />
610
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
611
+ </>
612
+ )}
613
+
585
614
  {!cartState.loading && cart && (
586
615
  <ChSection>
587
616
  <ChCart>
@@ -614,23 +643,26 @@ const CheckoutUI = (props: any) => {
614
643
  </OText>
615
644
  </TouchableOpacity>
616
645
  </CartHeader>
617
- <TouchableOpacity
618
- onPress={() => setOpenChangeStore(true)}
619
- style={{ alignSelf: 'flex-start' }}
620
- >
621
- <OText
622
- size={12}
623
- lineHeight={18}
624
- color={theme.colors.textSecondary}
625
- style={{ textDecorationLine: 'underline' }}
646
+ {isBusinessChangeEnabled && (
647
+ <TouchableOpacity
648
+ onPress={() => setOpenChangeStore(true)}
649
+ style={{ alignSelf: 'flex-start' }}
626
650
  >
627
- {t('CHANGE_STORE', 'Change store')}
628
- </OText>
629
- </TouchableOpacity>
651
+ <OText
652
+ size={12}
653
+ lineHeight={18}
654
+ color={theme.colors.textSecondary}
655
+ style={{ textDecorationLine: 'underline' }}
656
+ >
657
+ {t('CHANGE_STORE', 'Change store')}
658
+ </OText>
659
+ </TouchableOpacity>
660
+ )}
630
661
  <OrderSummary
631
662
  cart={cart}
632
663
  isCartPending={cart?.status === 2}
633
664
  onNavigationRedirect={onNavigationRedirect}
665
+ placeSpotTypes={placeSpotTypes}
634
666
  />
635
667
  </>
636
668
  )}
@@ -667,14 +699,6 @@ const CheckoutUI = (props: any) => {
667
699
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
668
700
  </OText>
669
701
  )}
670
- {placeSpotTypes.includes(options?.type) && !cart?.place && (
671
- <OText
672
- color={theme.colors.error}
673
- size={12}
674
- >
675
- {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
676
- </OText>
677
- )}
678
702
  {options.type === 1 &&
679
703
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
680
704
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -700,11 +724,33 @@ const CheckoutUI = (props: any) => {
700
724
  onClose={() => setOpenChangeStore(false)}
701
725
  />
702
726
  </OModal>
727
+ <OModal
728
+ open={isOpen}
729
+ onClose={() => setIsOpen(false)}
730
+ >
731
+ <View style={styles.detailWrapper}>
732
+ <UserDetails
733
+ isUserDetailsEdit
734
+ cartStatus={cart?.status}
735
+ businessId={cart?.business_id}
736
+ useValidationFields
737
+ useDefualtSessionManager
738
+ useSessionUser
739
+ isCheckout
740
+ isEdit
741
+ phoneUpdate={phoneUpdate}
742
+ togglePhoneUpdate={togglePhoneUpdate}
743
+ requiredFields={requiredFields}
744
+ hideUpdateButton
745
+ onClose={() => setIsOpen(false)}
746
+ />
747
+ </View>
748
+ </OModal>
703
749
  </ChContainer>
704
750
  </Container>
705
751
  {!cartState.loading && cart && cart?.status !== 2 && (
706
752
  <FloatingButton
707
- handleClick={() => handlePlaceOrder()}
753
+ handleClick={() => handlePlaceOrder(null)}
708
754
  isSecondaryBtn={isDisabledButtonPlace}
709
755
  disabled={isDisabledButtonPlace}
710
756
  btnText={cart?.subtotal >= cart?.minimum
@@ -718,7 +764,7 @@ const CheckoutUI = (props: any) => {
718
764
  : (`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`)
719
765
  }
720
766
  btnRightValueShow
721
- btnRightValue={parsePrice(cart?.total)}
767
+ btnRightValue={parsePrice(cart?.balance)}
722
768
  iosBottom={30}
723
769
  />
724
770
  )}
@@ -734,19 +780,6 @@ const CheckoutUI = (props: any) => {
734
780
  setShowGateway={setShowGateway}
735
781
  />
736
782
  )}
737
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
738
- <PaymentOptionsWebView
739
- onNavigationRedirect={onNavigationRedirect}
740
- uri={`https://test-square-f50f7.web.app`}
741
- user={user}
742
- token={token}
743
- cart={cart}
744
- currency={currency}
745
- webviewPaymethod={webviewPaymethod}
746
- setShowGateway={setShowGateway}
747
- locationId={'L1NGAY5M6KJRX'}
748
- />
749
- )}
750
783
  </>
751
784
  )
752
785
  }
@@ -772,16 +805,23 @@ export const Checkout = (props: any) => {
772
805
 
773
806
  const getOrder = async (cartId: any) => {
774
807
  try {
775
- setCartState({ ...cartState, loading: true })
776
- const url = `${ordering.root}/carts/${cartId}`
777
- const response = await fetch(url, {
778
- method: 'GET',
779
- headers: {
780
- 'Content-Type': 'application/json',
781
- Authorization: `Bearer ${token}`
782
- }
783
- })
784
- const { result } = await response.json();
808
+ let result: any = {}
809
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
810
+ if (cart) {
811
+ result = { ...cart }
812
+ } else {
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 content = await response.json();
823
+ result = content.result
824
+ }
785
825
 
786
826
  let publicKey = null
787
827
  try {
@@ -76,7 +76,6 @@ export const ChCart = styled(ChPaymethods)``
76
76
 
77
77
  export const WalletPaymentOptionContainer = styled(ChPaymethods)`
78
78
  padding-bottom: 0;
79
- margin-left: -20px;
80
79
  `
81
80
 
82
81
  export const ChPlaceOrderBtn = styled.View`
@@ -35,8 +35,8 @@ const DriverTipsUI = (props: any) => {
35
35
  const theme = useTheme();
36
36
 
37
37
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
38
+ semicircle: {
39
+ borderRadius: 8
40
40
  },
41
41
  inputStyle: {
42
42
  flex: 1,
@@ -75,10 +75,10 @@ const DriverTipsUI = (props: any) => {
75
75
  onPress={() => handlerChangeOption(option)}
76
76
  >
77
77
  <DTCard
78
- style={style.circle}
78
+ style={style.semicircle}
79
79
  isActive={option === optionSelected}
80
80
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
81
+ <OText size={12} numberOfLines={2} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
82
82
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
83
  </OText>
84
84
  </DTCard>
@@ -26,11 +26,12 @@ export const DTCard = styled.View`
26
26
  text-transform: capitalize;
27
27
  min-height: 55px;
28
28
  min-width: 55px;
29
- max-width: 55px;
29
+ max-width: 80px;
30
30
  max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
34
+ padding-horizontal: 10px;
34
35
 
35
36
  ${(props: any) => props.isActive && css`
36
37
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -75,6 +75,7 @@ export const Favorite = (props: any) => {
75
75
  <FavoriteList
76
76
  favoriteURL='favorite_products'
77
77
  originalURL='products'
78
+ onNavigationRedirect={onRedirect}
78
79
  isProduct
79
80
  />
80
81
  )}
@@ -18,4 +18,5 @@ export const Tab = styled.TouchableOpacity`
18
18
  export const Container = styled.View`
19
19
  padding-horizontal: 40px;
20
20
  padding-bottom: 20px;
21
+ padding-top: 30px;
21
22
  `