ordering-ui-react-native 0.16.59 → 0.16.60-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/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 +40 -32
  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 +12 -1
  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 +76 -77
  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/UserFormDetails/index.tsx +5 -2
  53. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  54. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  55. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  56. package/themes/business/src/components/shared/OLink.tsx +33 -13
  57. package/themes/business/src/components/shared/OText.tsx +8 -2
  58. package/themes/business/src/types/index.tsx +25 -11
  59. package/themes/business/src/utils/index.tsx +10 -0
  60. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  62. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  64. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  65. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  66. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  67. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  68. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  69. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  70. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/types/index.d.ts +2 -0
  73. package/themes/original/index.tsx +8 -0
  74. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  75. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  76. package/themes/original/src/components/AddressList/index.tsx +1 -1
  77. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  78. package/themes/original/src/components/BusinessBasicInformation/index.tsx +53 -37
  79. package/themes/original/src/components/BusinessController/index.tsx +112 -48
  80. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  81. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  82. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  83. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  84. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  85. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  86. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  87. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  88. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  89. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  90. package/themes/original/src/components/BusinessProductsList/index.tsx +59 -61
  91. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  92. package/themes/original/src/components/BusinessProductsListing/index.tsx +177 -93
  93. package/themes/original/src/components/BusinessProductsListing/styles.tsx +14 -12
  94. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  95. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +112 -107
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  98. package/themes/original/src/components/BusinessesListing/index.tsx +16 -9
  99. package/themes/original/src/components/Cart/index.tsx +77 -24
  100. package/themes/original/src/components/Cart/styles.tsx +4 -0
  101. package/themes/original/src/components/CartContent/index.tsx +77 -18
  102. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  103. package/themes/original/src/components/Checkout/index.tsx +115 -118
  104. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  105. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  106. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  107. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  108. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  109. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  110. package/themes/original/src/components/FloatingButton/index.tsx +0 -1
  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/HelpAccountAndPayment/index.tsx +25 -10
  116. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  117. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  118. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  119. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  120. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  121. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  122. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  123. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  126. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +96 -65
  129. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  130. package/themes/original/src/components/MyOrders/index.tsx +89 -25
  131. package/themes/original/src/components/NavBar/index.tsx +11 -5
  132. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  133. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  134. package/themes/original/src/components/Notifications/index.tsx +148 -0
  135. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  136. package/themes/original/src/components/OrderDetails/index.tsx +114 -15
  137. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  138. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  139. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  140. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  141. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  142. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  143. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  144. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +95 -55
  148. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  149. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  150. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  153. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  154. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  155. package/themes/original/src/components/ProductForm/index.tsx +379 -396
  156. package/themes/original/src/components/ProductForm/styles.tsx +7 -12
  157. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  158. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  159. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  160. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  161. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  162. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  163. package/themes/original/src/components/Promotions/index.tsx +232 -219
  164. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  165. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  166. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  167. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  168. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  169. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  170. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  171. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  172. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  173. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  174. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  175. package/themes/original/src/components/SingleOrderCard/index.tsx +240 -130
  176. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  177. package/themes/original/src/components/SingleProductCard/index.tsx +116 -72
  178. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  179. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  180. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  181. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  182. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  183. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  184. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  185. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  186. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  187. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  188. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +176 -164
  192. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  195. package/themes/original/src/components/shared/OBottomPopup.tsx +11 -7
  196. package/themes/original/src/components/shared/OButton.tsx +8 -3
  197. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  198. package/themes/original/src/components/shared/OInput.tsx +10 -1
  199. package/themes/original/src/layouts/Container.tsx +13 -9
  200. package/themes/original/src/types/index.tsx +65 -8
  201. package/themes/original/src/utils/index.tsx +103 -58
  202. 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, 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 {
@@ -40,7 +41,9 @@ const CartUI = (props: any) => {
40
41
  commentState,
41
42
  onNavigationRedirect,
42
43
  handleRemoveOfferClick,
43
- isMultiCheckout
44
+ isMultiCheckout,
45
+ hideDeliveryFee,
46
+ hideDriverTip
44
47
  } = props
45
48
 
46
49
  const theme = useTheme();
@@ -60,11 +63,13 @@ const CartUI = (props: any) => {
60
63
 
61
64
  const isCartPending = cart?.status === 2
62
65
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
63
- const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
64
-
65
66
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
66
67
  const businessId = business?.business_id ?? null
67
- const placeSpotTypes = [3, 4]
68
+ const placeSpotTypes = [4]
69
+
70
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
71
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
72
+ : configs?.driver_tip_options?.value || []
68
73
 
69
74
  const momentFormatted = !orderState?.option?.moment
70
75
  ? t('RIGHT_NOW', 'Right Now')
@@ -98,18 +103,34 @@ const CartUI = (props: any) => {
98
103
  const handleUpsellingPage = () => {
99
104
  setOpenUpselling(false)
100
105
  setCanOpenUpselling(false)
101
- if (isCheckoutMultiBusinessEnabled) {
102
- props.onNavigationRedirect('CheckoutNavigator', {
103
- screen: 'MultiCheckout'
104
- })
105
- } else {
106
- props.onNavigationRedirect('CheckoutNavigator', {
106
+ const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
107
+ if (cartsAvailable.length === 1) {
108
+ onNavigationRedirect('CheckoutNavigator', {
107
109
  screen: 'CheckoutPage',
108
- cartUuid: cart?.uuid,
109
- businessLogo: cart?.business?.logo,
110
- businessName: cart?.business?.name,
111
- cartTotal: cart?.total
110
+ cartUuid: cartsAvailable[0]?.uuid,
111
+ businessLogo: cartsAvailable[0]?.business?.logo,
112
+ businessName: cartsAvailable[0]?.business?.name,
113
+ cartTotal: cartsAvailable[0]?.total
114
+ })
115
+ } else {
116
+ const groupKeys: any = {}
117
+ cartsAvailable.forEach((_cart: any) => {
118
+ groupKeys[_cart?.group?.uuid]
119
+ ? groupKeys[_cart?.group?.uuid] += 1
120
+ : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
112
121
  })
122
+
123
+ if (
124
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
125
+ Object.keys(groupKeys).length > 1
126
+ ) {
127
+ onNavigationRedirect('CheckoutNavigator', { screen: 'MultiCart' })
128
+ } else {
129
+ onNavigationRedirect('CheckoutNavigator', {
130
+ screen: 'MultiCheckout',
131
+ cartUuid: cartsAvailable[0]?.group?.uuid
132
+ })
133
+ }
113
134
  }
114
135
  }
115
136
 
@@ -148,6 +169,12 @@ const CartUI = (props: any) => {
148
169
  }
149
170
  }
150
171
 
172
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
173
+ if (item?.type === 1)
174
+ return acc = acc + item?.summary?.tax
175
+ return acc = acc
176
+ }, cart?.subtotal)
177
+
151
178
  return (
152
179
  <CContainer>
153
180
  {openUpselling && (
@@ -172,7 +199,7 @@ const CartUI = (props: any) => {
172
199
  onNavigationRedirect={props.onNavigationRedirect}
173
200
  handleChangeStore={() => setOpenChangeStore(true)}
174
201
  handleClickCheckout={() => setOpenUpselling(true)}
175
- checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
202
+ checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
176
203
  isMultiCheckout={isMultiCheckout}
177
204
  >
178
205
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
@@ -295,7 +322,7 @@ const CartUI = (props: any) => {
295
322
  </OSTable>
296
323
  ))
297
324
  }
298
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
325
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
299
326
  <OSTable>
300
327
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
301
328
  <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
@@ -322,7 +349,7 @@ const CartUI = (props: any) => {
322
349
  </OSTable>
323
350
  ))
324
351
  }
325
- {cart?.driver_tip > 0 && (
352
+ {cart?.driver_tip > 0 && !hideDriverTip && (
326
353
  <OSTable>
327
354
  <OText size={12} lineHeight={18}>
328
355
  {t('DRIVER_TIP', 'Driver tip')}
@@ -355,12 +382,38 @@ const CartUI = (props: any) => {
355
382
  </OSTable>
356
383
  )}
357
384
 
385
+ {isMultiCheckout &&
386
+ cart &&
387
+ cart?.valid &&
388
+ orderState?.options?.type === 1 &&
389
+ cart?.status !== 2 &&
390
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
391
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
392
+ (
393
+ <DriverTipsContainer>
394
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
395
+ {t('DRIVER_TIPS', 'Driver Tips')}
396
+ </OText>
397
+ <DriverTips
398
+ uuid={cart?.uuid}
399
+ businessId={cart?.business_id}
400
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
401
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
402
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
403
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
404
+ ? cart?.driver_tip
405
+ : cart?.driver_tip_rate}
406
+ useOrderContext
407
+ />
408
+ </DriverTipsContainer>
409
+ )}
410
+
358
411
  <OSTotal>
359
412
  <OSTable style={{ marginTop: 15 }}>
360
- <OText size={14} lineHeight={21} weight={'600'}>
413
+ <OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
361
414
  {t('TOTAL', 'Total')}
362
415
  </OText>
363
- <OText size={14} lineHeight={21} weight={'600'}>
416
+ <OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
364
417
  {parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
365
418
  </OText>
366
419
  </OSTable>
@@ -423,15 +476,15 @@ const CartUI = (props: any) => {
423
476
  {cart?.valid_products ? (
424
477
  <CheckoutAction>
425
478
  <OButton
426
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
479
+ text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
427
480
  !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
428
481
  ) : !cart?.valid_address ? (
429
482
  `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
430
483
  ) : (
431
484
  `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
432
485
  )}
433
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
434
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
486
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
487
+ isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
435
488
  borderColor={theme.colors.primary}
436
489
  imgRightSrc={null}
437
490
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
@@ -446,7 +499,7 @@ const CartUI = (props: any) => {
446
499
  </OText>
447
500
  </View>
448
501
  )}
449
- </>
502
+ </>
450
503
  )}
451
504
  </BusinessItemAccordion>
452
505
 
@@ -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,42 +1,79 @@
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, useConfig } from 'ordering-components/native';
3
4
  import { useTheme } from 'styled-components/native';
4
- import { CCContainer, CCNotCarts, CCList } from './styles';
5
+ import { CCContainer, CCNotCarts, CCList, CheckoutAction } 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();
18
19
  const [, t] = useLanguage()
20
+ const [{ configs }] = useConfig()
19
21
  const [isCartsLoading, setIsCartsLoading] = useState(false)
20
22
 
23
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
24
+ const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
25
+ const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
26
+
27
+ const handleCheckoutRedirect = () => {
28
+ if (cartsAvailable.length === 1) {
29
+ onNavigationRedirect('CheckoutNavigator', {
30
+ screen: 'CheckoutPage',
31
+ cartUuid: cartsAvailable[0]?.uuid,
32
+ businessLogo: cartsAvailable[0]?.business?.logo,
33
+ businessName: cartsAvailable[0]?.business?.name,
34
+ cartTotal: cartsAvailable[0]?.total
35
+ })
36
+ } else {
37
+ const groupKeys: any = {}
38
+ cartsAvailable.forEach((_cart: any) => {
39
+ groupKeys[_cart?.group?.uuid]
40
+ ? groupKeys[_cart?.group?.uuid] += 1
41
+ : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
42
+ })
43
+
44
+ if (
45
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
46
+ Object.keys(groupKeys).length > 1
47
+ ) {
48
+ onNavigationRedirect('CheckoutNavigator', { screen: 'MultiCart' })
49
+ } else {
50
+ onNavigationRedirect('CheckoutNavigator', {
51
+ screen: 'MultiCheckout',
52
+ cartUuid: cartsAvailable[0]?.group?.uuid
53
+ })
54
+ }
55
+ }
56
+ }
57
+
21
58
  return (
22
- <CCContainer>
59
+ <CCContainer
60
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
61
+ >
23
62
  {isOrderStateCarts && carts?.length > 0 && (
24
63
  <>
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
64
  {carts.map((cart: any, i: number) => (
29
65
  <CCList key={i} style={{ overflow: 'visible' }}>
30
66
  {cart.products.length > 0 && (
31
67
  <>
32
68
  <Cart
33
- singleBusiness={props.singleBusiness}
34
- isFranchiseApp={props.isFranchiseApp}
69
+ singleBusiness={props.singleBusiness}
70
+ isFranchiseApp={props.isFranchiseApp}
35
71
  cart={cart}
36
- cartuuid={cart.uuid}
72
+ cartuuid={cart.uuid}
37
73
  onNavigationRedirect={props.onNavigationRedirect}
38
74
  isCartsLoading={isCartsLoading}
39
75
  setIsCartsLoading={setIsCartsLoading}
76
+ isMultiCheckout={isMultiCheckout}
40
77
  hideUpselling
41
78
  />
42
79
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
@@ -44,18 +81,40 @@ export const CartContent = (props: any) => {
44
81
  )}
45
82
  </CCList>
46
83
  ))}
84
+ {isMultiCheckout && (
85
+ <CheckoutAction style={{ marginTop: 0 }}>
86
+ <OButton
87
+ text={t('CHECKOUT', 'Checkout')}
88
+ bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
89
+ isDisabled={!cartsAvailable.length}
90
+ borderColor={theme.colors.primary}
91
+ imgRightSrc={null}
92
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
93
+ onClick={() => handleCheckoutRedirect()}
94
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
95
+ />
96
+ </CheckoutAction>
97
+ )}
47
98
  </>
48
99
  )}
49
100
  {(!carts || carts?.length === 0) && (
50
101
  <CCNotCarts>
51
- {/* <OIcon
52
- url={props.icon}
53
- width={200}
54
- height={122}
55
- /> */}
56
102
  <OText size={24} style={{ textAlign: 'center' }}>
57
103
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
58
104
  </OText>
105
+ <OButton
106
+ text={t('START_SHOPPING', 'Start shopping')}
107
+ bgColor={theme.colors.primary}
108
+ borderColor={theme.colors.primary}
109
+ textStyle={{
110
+ color: theme.colors.white,
111
+ fontSize: 14,
112
+ paddingRight: 0
113
+ }}
114
+ style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
115
+ imgRightSrc={null}
116
+ onClick={() => onNavigationRedirect('BusinessList')}
117
+ />
59
118
  </CCNotCarts>
60
119
  )}
61
120
  <Spinner visible={isCartsLoading} />
@@ -1,7 +1,7 @@
1
1
  import styled from 'styled-components/native';
2
2
 
3
3
  export const CCContainer = styled.View`
4
- padding: 20px 40px;
4
+ padding-vertical: 20px;
5
5
  `
6
6
 
7
7
  export const CCNotCarts = styled.View`
@@ -17,3 +17,13 @@ export const CCNotCarts = styled.View`
17
17
  export const CCList = styled.ScrollView`
18
18
  padding: 10px 0px;
19
19
  `
20
+
21
+ export const CheckoutAction = styled.View`
22
+ width: 100%;
23
+ display: flex;
24
+ justify-content: center;
25
+ flex-direction: column;
26
+ align-items: center;
27
+ margin-top: 10px;
28
+ margin-bottom: 10px;
29
+ `