ordering-ui-react-native 0.21.51 → 0.21.52-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 (167) hide show
  1. package/package.json +8 -8
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/ProductList.tsx +72 -27
  12. package/themes/business/src/components/BusinessProductList/index.tsx +57 -25
  13. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  14. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  15. package/themes/business/src/components/Home/index.tsx +5 -1
  16. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  17. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  18. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  19. package/themes/business/src/components/MapView/index.tsx +30 -15
  20. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  21. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  22. package/themes/business/src/components/OrderDetails/Delivery.tsx +42 -23
  23. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  24. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +36 -22
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  26. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  27. package/themes/business/src/components/OrdersOption/index.tsx +263 -135
  28. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  29. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
  30. package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
  31. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  32. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  33. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  34. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  35. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  36. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  37. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/Sessions/index.tsx +187 -0
  41. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  42. package/themes/business/src/components/StoresList/index.tsx +5 -3
  43. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  44. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  45. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  46. package/themes/business/src/components/shared/OInput.tsx +2 -0
  47. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  48. package/themes/business/src/hooks/useLocation.tsx +5 -4
  49. package/themes/business/src/types/index.tsx +23 -5
  50. package/themes/business/src/utils/index.tsx +5 -0
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +6 -2
  60. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  61. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  62. package/themes/original/src/components/AddressList/index.tsx +8 -7
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
  66. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  67. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  68. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +316 -0
  70. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +94 -0
  71. package/themes/original/src/components/BusinessListingSearch/index.tsx +48 -359
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -16
  73. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +25 -13
  77. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  78. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +19 -7
  82. package/themes/original/src/components/CartContent/index.tsx +58 -44
  83. package/themes/original/src/components/Checkout/index.tsx +106 -64
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  87. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  88. package/themes/original/src/components/Favorite/index.tsx +1 -5
  89. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  90. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  91. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  92. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  93. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  94. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  95. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  96. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +9 -11
  97. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  98. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  99. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  100. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  101. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  102. package/themes/original/src/components/Help/index.tsx +2 -0
  103. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  104. package/themes/original/src/components/Home/index.tsx +2 -10
  105. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
  106. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  107. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  108. package/themes/original/src/components/Messages/index.tsx +8 -7
  109. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  110. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  111. package/themes/original/src/components/MultiCheckout/index.tsx +124 -63
  112. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  113. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
  114. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  115. package/themes/original/src/components/NavBar/index.tsx +4 -2
  116. package/themes/original/src/components/NetworkError/index.tsx +2 -8
  117. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  118. package/themes/original/src/components/Notifications/index.tsx +2 -4
  119. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  120. package/themes/original/src/components/OrderDetails/index.tsx +5 -7
  121. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  122. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  123. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  124. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  125. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  126. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  127. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  128. package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
  129. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  130. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  131. package/themes/original/src/components/ProductForm/ActionButton.tsx +19 -19
  132. package/themes/original/src/components/ProductForm/index.tsx +123 -112
  133. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  134. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  135. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  136. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  137. package/themes/original/src/components/Promotions/index.tsx +6 -9
  138. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  139. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  140. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  141. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  142. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  143. package/themes/original/src/components/Sessions/index.tsx +3 -3
  144. package/themes/original/src/components/SignupForm/index.tsx +65 -67
  145. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
  146. package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
  147. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  148. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  149. package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
  150. package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
  151. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  152. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  153. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +3 -5
  154. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  155. package/themes/original/src/components/UserFormDetails/index.tsx +88 -91
  156. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  157. package/themes/original/src/components/UserProfile/index.tsx +2 -1
  158. package/themes/original/src/components/Wallets/index.tsx +7 -4
  159. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  160. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  161. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  162. package/themes/original/src/components/shared/OButton.tsx +8 -7
  163. package/themes/original/src/components/shared/OInput.tsx +1 -4
  164. package/themes/original/src/layouts/Container.tsx +4 -2
  165. package/themes/original/src/types/index.tsx +6 -1
  166. package/themes/original/src/utils/index.tsx +12 -1
  167. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
- import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler } from 'react-native'
2
+ import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView, Keyboard, KeyboardEvent, BackHandler, ScrollView } from 'react-native'
3
3
  import { IOScrollView } from 'react-native-intersection-observer'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native';
@@ -148,7 +148,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
148
148
  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) || []
149
149
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
150
150
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
151
- const filtProductsHeight = Platform.OS === 'ios' ? 165 : 100
151
+ const filtProductsHeight = Platform.OS === 'ios' ? 65 : 30
152
152
  const viewOrderButtonVisible = !loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0
153
153
 
154
154
  const onRedirect = (route: string, params?: any) => {
@@ -190,13 +190,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
190
190
  setOpenService(true)
191
191
  return
192
192
  }
193
- onRedirect('ProductDetails', {
194
- product: product,
195
- businessSlug: business.slug,
196
- businessId: business.id || product?.category?.business_id,
197
- productAddedToCartLength,
198
- isRedirect: false
199
- })
193
+ if (product?.enabled) {
194
+ onRedirect('ProductDetails', {
195
+ product: product,
196
+ businessSlug: business.slug,
197
+ businessId: business.id || product?.category?.business_id,
198
+ productAddedToCartLength,
199
+ isRedirect: false
200
+ })
201
+ } else {
202
+ showToast(ToastType.Error, t('PRODUCT_NOT_FOUND', 'Product not found'))
203
+ }
200
204
  }
201
205
  events.emit('product_clicked', product)
202
206
  }
@@ -377,6 +381,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
377
381
  setViewedCategory(_viewedCategory)
378
382
  events.emit('product_list_viewed', _viewedCategory)
379
383
  }
384
+ } else {
385
+ if (business.categories) {
386
+ const categoryAll: any = {}
387
+ categoryAll.business_id = business.id
388
+ categoryAll.id = null
389
+ categoryAll.name = 'All'
390
+ events.emit('product_list_viewed', categoryAll)
391
+ }
380
392
  }
381
393
  }, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
382
394
 
@@ -491,8 +503,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
491
503
  {business?.categories?.length > 0 && isOpenFiltProducts && (
492
504
  <FiltProductsContainer
493
505
  style={{
494
- height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 55 : 0),
495
- top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight,
506
+ height: Dimensions.get('window').height - filtProductsHeight - keyboardHeight - (keyboardHeight > 0 && viewOrderButtonVisible ? 10 : 0),
507
+ top: Platform.OS === 'ios' ? viewOrderButtonVisible ? (searchBarHeight - 10) + insets.top + 10 : (searchBarHeight - 10) + insets.top : searchBarHeight,
496
508
  }}
497
509
  contentContainerStyle={{ flexGrow: 1 }}
498
510
  >
@@ -530,7 +542,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
530
542
  </View>
531
543
  </FiltProductsContainer>
532
544
  )}
533
- <IOScrollView
545
+ <ScrollView
534
546
  stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
535
547
  style={{
536
548
  ...styles.mainContainer,
@@ -658,7 +670,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
658
670
  {isOpenFiltProducts && (
659
671
  <BackgroundGray isIos={Platform.OS === 'ios'} />
660
672
  )}
661
- </IOScrollView>
673
+ </ScrollView>
662
674
  {viewOrderButtonVisible && (
663
675
  <View style={{ marginBottom: 0 }}>
664
676
  <FloatingButton
@@ -26,9 +26,9 @@ import { BusinessTypeFilterParams } from '../../types';
26
26
  const windowWidth = Dimensions.get('window').width;
27
27
 
28
28
  export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
29
- const {
30
- typesState,
31
- currentTypeSelected,
29
+ const {
30
+ typesState,
31
+ currentTypeSelected,
32
32
  handleChangeBusinessType,
33
33
  setBusinessTypes,
34
34
  isAppoint
@@ -38,13 +38,13 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
38
38
 
39
39
  const theme = useTheme();
40
40
  const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
41
- const defaultImage = (name : string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
41
+ const defaultImage = (name: string) => theme.images?.categories?.[name.toLowerCase().replace(' ', '')]
42
42
 
43
43
  useEffect(() => {
44
- if(typesState?.types?.length > 0){
45
- setBusinessTypes && setBusinessTypes(typesState?.types)
44
+ if (typesState?.types?.length > 0) {
45
+ setBusinessTypes && setBusinessTypes(typesState?.types)
46
46
  }
47
- }, [typesState])
47
+ }, [typesState])
48
48
 
49
49
  const handleChangeServiceType = (serviceId: any) => {
50
50
  if (serviceId === currentTypeSelected) {
@@ -119,10 +119,11 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
119
119
  <OButton
120
120
  key={i}
121
121
  bgColor={(currentTypeSelected === businessType?.id) ? theme.colors.primary : theme.colors.backgroundGray200}
122
+ borderColor={(currentTypeSelected === businessType?.id) ? theme.colors.primary : theme.colors.backgroundGray200}
122
123
  onClick={() => handleChangeServiceType(businessType?.id)}
123
124
  text={`${businessType?.name} ${(currentTypeSelected === businessType?.id) ? ' X' : ''}`}
124
125
  style={styles.businessType}
125
- textStyle={{ fontSize: 10, color: (currentTypeSelected === businessType?.id) ? theme.colors.backgroundLight : theme.colors.textNormal }}
126
+ textStyle={{ fontSize: 10, color: (currentTypeSelected === businessType?.id) ? theme.colors.white : theme.colors.textNormal }}
126
127
  />
127
128
  ))}
128
129
  </ServiceWrapper>
@@ -392,10 +392,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
392
392
  <OButton
393
393
  key={i}
394
394
  bgColor={(priceLevelSelected === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
395
+ borderColor={(priceLevelSelected === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
395
396
  onClick={() => handleChangePriceLevel(price?.level)}
396
397
  text={`${price.content} ${(priceLevelSelected === price?.level) ? ' X' : ''}`}
397
398
  style={styles.priceLevel}
398
- textStyle={{ fontSize: 10, color: (priceLevelSelected === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
399
+ textStyle={{ fontSize: 10, color: (priceLevelSelected === price?.level) ? theme.colors.backgroundLight : theme.colors.black }}
399
400
  />
400
401
  ))}
401
402
  </ScrollView>
@@ -168,7 +168,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
168
168
  setFeaturedBusinesses(ary);
169
169
  }
170
170
  resetInactivityTimeout()
171
- }, [businessesList.loading])
171
+ }, [businessesList.loading, businessesList?.businesses])
172
172
 
173
173
  const handleOnRefresh = () => {
174
174
  if (!businessesList.loading) {
@@ -1,4 +1,3 @@
1
-
2
1
  import React, { useState, useEffect } from 'react'
3
2
  import { useOrder, useSession, useLanguage, useConfig } from 'ordering-components/native';
4
3
 
@@ -121,7 +121,7 @@ const CartUI = (props: any) => {
121
121
  const cartsAvailable: any = Object.values(orderState?.carts)
122
122
  ?.filter((_cart: any) => _cart?.valid && _cart?.status !== 2 && _cart?.products?.length)
123
123
  ?.filter((_c: any) => !isProductCartParam ? _c.uuid !== individualCart?.uuid : _c)
124
- if (cartsAvailable.length === 1 || !isMultiCheckout) {
124
+ if (cartsAvailable.length === 1 || !isMultiCheckout || !cart?.business_id) {
125
125
  const cart = isMultiCheckout ? cartsAvailable[0] : individualCart
126
126
  onNavigationRedirect('CheckoutNavigator', {
127
127
  screen: 'CheckoutPage',
@@ -196,6 +196,18 @@ const CartUI = (props: any) => {
196
196
  return acc = acc
197
197
  }, cart?.subtotal)
198
198
 
199
+ const handleClickCheckout = () => {
200
+ if (cart?.business_id) {
201
+ setOpenUpselling(true)
202
+ } else {
203
+ onNavigationRedirect('CheckoutNavigator', {
204
+ screen: 'CheckoutPage',
205
+ cartUuid: cart?.uuid,
206
+ cartTotal: cart?.total
207
+ }, true)
208
+ }
209
+ }
210
+
199
211
  useEffect(() => {
200
212
  const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
201
213
  const currentDate = new Date()
@@ -211,7 +223,7 @@ const CartUI = (props: any) => {
211
223
 
212
224
  return (
213
225
  <CContainer>
214
- {openUpselling && (
226
+ {!!openUpselling && (
215
227
  <UpsellingProducts
216
228
  handleUpsellingPage={handleUpsellingPage}
217
229
  openUpselling={openUpselling}
@@ -232,7 +244,7 @@ const CartUI = (props: any) => {
232
244
  handleCartOpen={handleCartOpen}
233
245
  onNavigationRedirect={props.onNavigationRedirect}
234
246
  handleChangeStore={() => setOpenChangeStore(true)}
235
- handleClickCheckout={() => setOpenUpselling(true)}
247
+ handleClickCheckout={() => handleClickCheckout()}
236
248
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
237
249
  isMultiCheckout={isMultiCheckout}
238
250
  isFromUpselling={isFromUpselling}
@@ -532,7 +544,7 @@ const CartUI = (props: any) => {
532
544
  />
533
545
  </View>
534
546
  )}
535
- {!isMultiCheckout && (
547
+ {(!isMultiCheckout || !cart?.business_id) && (
536
548
  <>
537
549
  {cart?.valid_products ? (
538
550
  <CheckoutAction>
@@ -545,11 +557,11 @@ const CartUI = (props: any) => {
545
557
  `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
546
558
  )}
547
559
  bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
560
+ borderColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
548
561
  isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
549
- borderColor={theme.colors.primary}
550
562
  imgRightSrc={null}
551
- textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
552
- onClick={() => setOpenUpselling(true)}
563
+ textStyle={{ textAlign: 'center', flex: 1 }}
564
+ onClick={() => handleClickCheckout()}
553
565
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
554
566
  />
555
567
  </CheckoutAction>
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useState } from 'react';
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
@@ -13,7 +13,8 @@ export const CartContent = (props: any) => {
13
13
  const {
14
14
  onNavigationRedirect,
15
15
  singleBusiness,
16
- businessSlug
16
+ businessSlug,
17
+ navigation
17
18
  } = props
18
19
 
19
20
  const theme = useTheme();
@@ -22,7 +23,7 @@ export const CartContent = (props: any) => {
22
23
  const [{ parsePrice }] = useUtils();
23
24
  const [isCartsLoading, setIsCartsLoading] = useState(false)
24
25
  const [cartsOpened, setCartsOpened] = useState([])
25
- const [{ carts: cartsContext }] = useOrder();
26
+ const [{ carts: cartsContext }, { confirmCart }] = useOrder();
26
27
  const cartsList =
27
28
  (cartsContext &&
28
29
  Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
@@ -32,7 +33,7 @@ export const CartContent = (props: any) => {
32
33
  : cartsList
33
34
  const isOrderStateCarts = !!carts
34
35
  const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
35
- const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2)
36
+ const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2 && cart?.business_id)
36
37
  const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
37
38
  const totalCartsFee = cartsAvailable?.length && cartsAvailable
38
39
  ?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
@@ -71,7 +72,7 @@ export const CartContent = (props: any) => {
71
72
  }
72
73
  }
73
74
 
74
- const changeActiveState = useCallback((isClosed : boolean, uuid : string) => {
75
+ const changeActiveState = useCallback((isClosed: boolean, uuid: string) => {
75
76
  const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
76
77
  if (isActive || !isClosed) {
77
78
  setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
@@ -83,6 +84,20 @@ export const CartContent = (props: any) => {
83
84
  }
84
85
  }, [cartsOpened])
85
86
 
87
+ useEffect(() => {
88
+ const unsuscribe = navigation.addListener('focus', () => {
89
+ const cartsListBlockedByPaypal = carts?.filter((cart: any) => cart?.status === 2 && cart?.paymethod_data?.gateway === 'paypal')
90
+ if (cartsListBlockedByPaypal?.length > 0) {
91
+ cartsListBlockedByPaypal.map(async (cart: any) => {
92
+ await confirmCart(cart?.uuid)
93
+ })
94
+ }
95
+ })
96
+ return () => {
97
+ return unsuscribe()
98
+ }
99
+ }, [carts, navigation])
100
+
86
101
  return (
87
102
  <CCContainer
88
103
  style={{ paddingHorizontal: 20 }}
@@ -120,53 +135,52 @@ export const CartContent = (props: any) => {
120
135
  {isMultiCheckout && (
121
136
  <>
122
137
  {!!cartsAvailable.length && (
123
- <ChCartsTotal>
124
- {!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
125
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
126
- <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
127
- {t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
128
- </OText>
129
- <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
130
- {parsePrice(totalCartsFee)}
131
- </OText>
132
- </View>
133
- )}
134
- {cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
135
- configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
138
+ <>
139
+ <ChCartsTotal>
140
+ {!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
136
141
  <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
137
142
  <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
138
- {t('DRIVER_TIP', 'Driver tip')}
143
+ {t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
139
144
  </OText>
140
145
  <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
141
- {parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
146
+ {parsePrice(totalCartsFee)}
142
147
  </OText>
143
148
  </View>
144
149
  )}
145
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
146
- <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
147
- {t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
148
- </OText>
149
- <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
150
- </View>
151
- <View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
152
- <OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
153
- {t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
154
- </OText>
155
- </View>
156
- </ChCartsTotal>
150
+ {cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
151
+ configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
152
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
153
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
154
+ {t('DRIVER_TIP', 'Driver tip')}
155
+ </OText>
156
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
157
+ {parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
158
+ </OText>
159
+ </View>
160
+ )}
161
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
162
+ <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
163
+ {t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
164
+ </OText>
165
+ <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
166
+ </View>
167
+ <View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
168
+ <OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
169
+ {t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}
170
+ </OText>
171
+ </View>
172
+ </ChCartsTotal>
173
+ <CheckoutAction style={{ marginTop: 0 }}>
174
+ <OButton
175
+ text={t('CHECKOUT', 'Checkout')}
176
+ isDisabled={!cartsAvailable.length}
177
+ imgRightSrc={null}
178
+ onClick={() => handleCheckoutRedirect()}
179
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
180
+ />
181
+ </CheckoutAction>
182
+ </>
157
183
  )}
158
- <CheckoutAction style={{ marginTop: 0 }}>
159
- <OButton
160
- text={t('CHECKOUT', 'Checkout')}
161
- bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
162
- isDisabled={!cartsAvailable.length}
163
- borderColor={theme.colors.primary}
164
- imgRightSrc={null}
165
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
166
- onClick={() => handleCheckoutRedirect()}
167
- style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
168
- />
169
- </CheckoutAction>
170
184
  </>
171
185
  )}
172
186
  </>