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
@@ -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, DriverTipsContainer } from './styles';
11
+ import { CContainer, CheckoutAction, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -41,7 +41,9 @@ const CartUI = (props: any) => {
41
41
  commentState,
42
42
  onNavigationRedirect,
43
43
  handleRemoveOfferClick,
44
- isMultiCheckout
44
+ isMultiCheckout,
45
+ hideDeliveryFee,
46
+ hideDriverTip
45
47
  } = props
46
48
 
47
49
  const theme = useTheme();
@@ -61,8 +63,6 @@ const CartUI = (props: any) => {
61
63
 
62
64
  const isCartPending = cart?.status === 2
63
65
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
64
- const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
65
-
66
66
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
67
67
  const businessId = business?.business_id ?? null
68
68
  const placeSpotTypes = [4]
@@ -100,21 +100,41 @@ const CartUI = (props: any) => {
100
100
  }
101
101
  }
102
102
 
103
- const handleUpsellingPage = () => {
103
+ const handleUpsellingPage = (individualCart : any) => {
104
104
  setOpenUpselling(false)
105
105
  setCanOpenUpselling(false)
106
- if (isCheckoutMultiBusinessEnabled) {
107
- props.onNavigationRedirect('CheckoutNavigator', {
108
- screen: 'MultiCheckout'
109
- })
110
- } else {
111
- props.onNavigationRedirect('CheckoutNavigator', {
106
+ const cartsAvailable: any = Object.values(orderState?.carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
107
+ if (cartsAvailable.length === 1 || !isMultiCheckout) {
108
+ const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
109
+ onNavigationRedirect('CheckoutNavigator', {
112
110
  screen: 'CheckoutPage',
113
111
  cartUuid: cart?.uuid,
114
112
  businessLogo: cart?.business?.logo,
115
113
  businessName: cart?.business?.name,
116
114
  cartTotal: cart?.total
117
115
  })
116
+ } else {
117
+ const groupKeys: any = {}
118
+ cartsAvailable.forEach((_cart: any) => {
119
+ groupKeys[_cart?.group?.uuid]
120
+ ? groupKeys[_cart?.group?.uuid] += 1
121
+ : groupKeys[_cart?.group?.uuid ?? 'null'] = 1
122
+ })
123
+
124
+ if (
125
+ (Object.keys(groupKeys).length === 1 && Object.keys(groupKeys)[0] === 'null') ||
126
+ Object.keys(groupKeys).length > 1
127
+ ) {
128
+ onNavigationRedirect('CheckoutNavigator', {
129
+ screen: 'MultiCheckout',
130
+ checkCarts: true
131
+ })
132
+ } else {
133
+ onNavigationRedirect('CheckoutNavigator', {
134
+ screen: 'MultiCheckout',
135
+ cartUuid: cartsAvailable[0]?.group?.uuid
136
+ })
137
+ }
118
138
  }
119
139
  }
120
140
 
@@ -153,6 +173,12 @@ const CartUI = (props: any) => {
153
173
  }
154
174
  }
155
175
 
176
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
177
+ if (item?.type === 1)
178
+ return acc = acc + item?.summary?.tax
179
+ return acc = acc
180
+ }, cart?.subtotal)
181
+
156
182
  return (
157
183
  <CContainer>
158
184
  {openUpselling && (
@@ -177,7 +203,7 @@ const CartUI = (props: any) => {
177
203
  onNavigationRedirect={props.onNavigationRedirect}
178
204
  handleChangeStore={() => setOpenChangeStore(true)}
179
205
  handleClickCheckout={() => setOpenUpselling(true)}
180
- checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
206
+ checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
181
207
  isMultiCheckout={isMultiCheckout}
182
208
  >
183
209
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
@@ -290,9 +316,11 @@ const CartUI = (props: any) => {
290
316
  <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => setOpenTaxModal({ open: true, data: offer, type: 'offer_target_3' })}>
291
317
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
292
318
  </TouchableOpacity>
293
- <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
294
- <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
295
- </TouchableOpacity>
319
+ {!offer?.type && (
320
+ <TouchableOpacity style={{ marginLeft: 3 }} onPress={() => onRemoveOffer(offer?.id)}>
321
+ <AntIcon name='closecircle' size={16} color={theme.colors.primary} />
322
+ </TouchableOpacity>
323
+ )}
296
324
  </OSRow>
297
325
  <OText size={12} lineHeight={18}>
298
326
  - {parsePrice(offer?.summary?.discount)}
@@ -300,10 +328,10 @@ const CartUI = (props: any) => {
300
328
  </OSTable>
301
329
  ))
302
330
  }
303
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
331
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
304
332
  <OSTable>
305
333
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
306
- <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price)}</OText>
334
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount ?? cart?.delivery_price)}</OText>
307
335
  </OSTable>
308
336
  )}
309
337
  {
@@ -327,7 +355,13 @@ const CartUI = (props: any) => {
327
355
  </OSTable>
328
356
  ))
329
357
  }
330
- {cart?.driver_tip > 0 && (
358
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && cart?.delivery_price_with_discount >= 0 && !hideDeliveryFee && (
359
+ <OSTable>
360
+ <OText size={12} lineHeight={18}>{t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')}</OText>
361
+ <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount)}</OText>
362
+ </OSTable>
363
+ )}
364
+ {cart?.driver_tip > 0 && !hideDriverTip && (
331
365
  <OSTable>
332
366
  <OText size={12} lineHeight={18}>
333
367
  {t('DRIVER_TIP', 'Driver tip')}
@@ -360,7 +394,7 @@ const CartUI = (props: any) => {
360
394
  </OSTable>
361
395
  )}
362
396
 
363
- {isMultiCheckout &&
397
+ {!isMultiCheckout &&
364
398
  cart &&
365
399
  cart?.valid &&
366
400
  orderState?.options?.type === 1 &&
@@ -368,30 +402,31 @@ const CartUI = (props: any) => {
368
402
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
369
403
  driverTipsOptions && driverTipsOptions?.length > 0 &&
370
404
  (
371
- <DriverTipsContainer>
372
- <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
373
- {t('DRIVER_TIPS', 'Driver Tips')}
374
- </OText>
375
- <DriverTips
376
- uuid={cart?.uuid}
377
- businessId={cart?.business_id}
378
- driverTipsOptions={driverTipsOptions}
379
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
380
- isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
381
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
382
- ? cart?.driver_tip
383
- : cart?.driver_tip_rate}
384
- useOrderContext
385
- />
386
- </DriverTipsContainer>
405
+ <DriverTipsContainer>
406
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
407
+ {t('DRIVER_TIPS', 'Driver Tips')}
408
+ </OText>
409
+ <DriverTips
410
+ uuid={cart?.uuid}
411
+ businessId={cart?.business_id}
412
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
413
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
414
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
415
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
416
+ ? cart?.driver_tip
417
+ : cart?.driver_tip_rate}
418
+ useOrderContext
419
+ cart={cart}
420
+ />
421
+ </DriverTipsContainer>
387
422
  )}
388
423
 
389
424
  <OSTotal>
390
425
  <OSTable style={{ marginTop: 15 }}>
391
- <OText size={14} lineHeight={21} weight={'600'}>
426
+ <OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
392
427
  {t('TOTAL', 'Total')}
393
428
  </OText>
394
- <OText size={14} lineHeight={21} weight={'600'}>
429
+ <OText size={14} lineHeight={21} weight={'bold'} color={theme.colors.textNormal}>
395
430
  {parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
396
431
  </OText>
397
432
  </OSTable>
@@ -454,15 +489,15 @@ const CartUI = (props: any) => {
454
489
  {cart?.valid_products ? (
455
490
  <CheckoutAction>
456
491
  <OButton
457
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
492
+ text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
458
493
  !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
459
494
  ) : !cart?.valid_address ? (
460
495
  `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
461
496
  ) : (
462
497
  `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
463
498
  )}
464
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
465
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
499
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
500
+ isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
466
501
  borderColor={theme.colors.primary}
467
502
  imgRightSrc={null}
468
503
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
@@ -1,42 +1,82 @@
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', {
49
+ screen: 'MultiCheckout',
50
+ checkCarts: true
51
+ })
52
+ } else {
53
+ onNavigationRedirect('CheckoutNavigator', {
54
+ screen: 'MultiCheckout',
55
+ cartUuid: cartsAvailable[0]?.group?.uuid
56
+ })
57
+ }
58
+ }
59
+ }
60
+
21
61
  return (
22
- <CCContainer>
62
+ <CCContainer
63
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
64
+ >
23
65
  {isOrderStateCarts && carts?.length > 0 && (
24
66
  <>
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
67
  {carts.map((cart: any, i: number) => (
29
68
  <CCList key={i} style={{ overflow: 'visible' }}>
30
69
  {cart.products.length > 0 && (
31
70
  <>
32
71
  <Cart
33
- singleBusiness={props.singleBusiness}
34
- isFranchiseApp={props.isFranchiseApp}
72
+ singleBusiness={props.singleBusiness}
73
+ isFranchiseApp={props.isFranchiseApp}
35
74
  cart={cart}
36
- cartuuid={cart.uuid}
75
+ cartuuid={cart.uuid}
37
76
  onNavigationRedirect={props.onNavigationRedirect}
38
77
  isCartsLoading={isCartsLoading}
39
78
  setIsCartsLoading={setIsCartsLoading}
79
+ isMultiCheckout={isMultiCheckout}
40
80
  hideUpselling
41
81
  />
42
82
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
@@ -44,18 +84,40 @@ export const CartContent = (props: any) => {
44
84
  )}
45
85
  </CCList>
46
86
  ))}
87
+ {isMultiCheckout && (
88
+ <CheckoutAction style={{ marginTop: 0 }}>
89
+ <OButton
90
+ text={t('CHECKOUT', 'Checkout')}
91
+ bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
92
+ isDisabled={!cartsAvailable.length}
93
+ borderColor={theme.colors.primary}
94
+ imgRightSrc={null}
95
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
96
+ onClick={() => handleCheckoutRedirect()}
97
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
98
+ />
99
+ </CheckoutAction>
100
+ )}
47
101
  </>
48
102
  )}
49
103
  {(!carts || carts?.length === 0) && (
50
104
  <CCNotCarts>
51
- {/* <OIcon
52
- url={props.icon}
53
- width={200}
54
- height={122}
55
- /> */}
56
105
  <OText size={24} style={{ textAlign: 'center' }}>
57
106
  {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
58
107
  </OText>
108
+ <OButton
109
+ text={t('START_SHOPPING', 'Start shopping')}
110
+ bgColor={theme.colors.primary}
111
+ borderColor={theme.colors.primary}
112
+ textStyle={{
113
+ color: theme.colors.white,
114
+ fontSize: 14,
115
+ paddingRight: 0
116
+ }}
117
+ style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
118
+ imgRightSrc={null}
119
+ onClick={() => onNavigationRedirect('BusinessList')}
120
+ />
59
121
  </CCNotCarts>
60
122
  )}
61
123
  <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
+ `