ordering-ui-react-native 0.16.80 → 0.16.81-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 (216) hide show
  1. package/package.json +5 -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 +1 -21
  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/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  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 +22 -9
  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 +236 -80
  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/Delivery.tsx +4 -3
  31. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +97 -50
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  33. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  34. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  35. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  36. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  37. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  40. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  44. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  46. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  47. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  48. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  49. package/themes/business/src/components/ProductItemAccordion/index.tsx +30 -5
  50. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  51. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  52. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  53. package/themes/business/src/components/shared/OLink.tsx +33 -13
  54. package/themes/business/src/components/shared/OText.tsx +8 -2
  55. package/themes/business/src/types/index.tsx +36 -3
  56. package/themes/business/src/utils/index.tsx +53 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  61. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  62. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  63. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  64. package/themes/kiosk/src/components/LoginForm/index.tsx +476 -153
  65. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  66. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  67. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  69. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  70. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  71. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  72. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  73. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  74. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  75. package/themes/kiosk/src/types/index.d.ts +14 -0
  76. package/themes/kiosk/src/utils/index.tsx +15 -0
  77. package/themes/original/index.tsx +8 -0
  78. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  79. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  80. package/themes/original/src/components/AddressList/index.tsx +18 -18
  81. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +124 -78
  84. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  85. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  86. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +102 -155
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +11 -8
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +562 -495
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  102. package/themes/original/src/components/Cart/index.tsx +75 -41
  103. package/themes/original/src/components/CartContent/index.tsx +80 -18
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +101 -106
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +13 -12
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +42 -26
  134. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +153 -77
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +7 -6
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  150. package/themes/original/src/components/OrderProgress/index.tsx +81 -105
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +93 -97
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +86 -92
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +1 -1
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +16 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +78 -66
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +112 -77
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  198. package/themes/original/src/components/UserFormDetails/index.tsx +50 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  204. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  205. package/themes/original/src/components/Wallets/index.tsx +177 -164
  206. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  207. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  208. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  209. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  210. package/themes/original/src/components/shared/OButton.tsx +9 -4
  211. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  212. package/themes/original/src/components/shared/OInput.tsx +10 -1
  213. package/themes/original/src/layouts/Container.tsx +13 -9
  214. package/themes/original/src/types/index.tsx +42 -7
  215. package/themes/original/src/utils/index.tsx +322 -58
  216. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,242 +1,271 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Platform, StyleSheet, View } from 'react-native'
2
+ import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
- UpsellingPage as UpsellingPageController,
5
- useUtils,
6
- useLanguage,
7
- useOrder
4
+ UpsellingPage as UpsellingPageController,
5
+ useUtils,
6
+ useLanguage,
7
+ useOrder,
8
+ useConfig
8
9
  } from 'ordering-components/native'
9
10
  import { useTheme } from 'styled-components/native';
10
11
  import { OText, OIcon, OBottomPopup, OButton } from '../shared'
11
12
  import { UpsellingProductsParams } from '../../types'
12
13
  import {
13
- Container,
14
- UpsellingContainer,
15
- Item,
16
- Details,
17
- AddButton,
18
- TopBar,
19
- TopActions
14
+ Container,
15
+ UpsellingContainer,
16
+ Item,
17
+ Details,
18
+ AddButton,
19
+ CartList,
20
+ CartDivider
20
21
  } from './styles'
21
22
  import { OrderSummary } from '../OrderSummary';
23
+ import { Cart } from '../Cart';
22
24
  import { ScrollView } from 'react-native-gesture-handler';
23
25
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
24
26
 
25
27
  const UpsellingProductsUI = (props: UpsellingProductsParams) => {
26
- const {
27
- isCustomMode,
28
- upsellingProducts,
29
- business,
30
- handleUpsellingPage,
31
- handleCloseUpsellingPage,
32
- openUpselling,
33
- canOpenUpselling,
34
- setCanOpenUpselling,
35
- isFromCart,
36
- onNavigationRedirect,
37
- onGoBack
38
- } = props
28
+ const {
29
+ isCustomMode,
30
+ upsellingProducts,
31
+ business,
32
+ handleUpsellingPage,
33
+ handleCloseUpsellingPage,
34
+ openUpselling,
35
+ canOpenUpselling,
36
+ setCanOpenUpselling,
37
+ isFromCart,
38
+ onNavigationRedirect,
39
+ onGoBack
40
+ } = props
39
41
 
40
- const theme = useTheme();
42
+ const theme = useTheme();
41
43
 
42
- const styles = StyleSheet.create({
43
- imageStyle: {
44
- width: 73,
45
- height: 73,
46
- resizeMode: 'cover',
47
- borderRadius: 7.6,
48
- },
49
- closeUpsellingButton: {
50
- borderRadius: 7.6,
51
- borderColor: theme.colors.primary,
52
- backgroundColor: theme.colors.primary,
53
- borderWidth: 1,
54
- alignSelf: 'center',
55
- height: 44,
56
- shadowOpacity: 0,
57
- width: '80%',
58
- },
59
- cancelBtn: {
60
- paddingHorizontal: 18,
61
- borderWidth: 1,
62
- borderRadius: 7.6,
63
- borderColor: theme.colors.textSecondary,
64
- height: 38
65
- },
66
- headerItem: {
67
- flexDirection: 'row',
68
- alignItems: 'center',
69
- marginVertical: 2,
70
- marginHorizontal: 20,
71
- },
72
- btnBackArrow: {
73
- borderWidth: 0,
74
- backgroundColor: theme.colors.clear,
75
- shadowColor: theme.colors.clear,
76
- padding: 40,
77
- },
78
- })
44
+ const styles = StyleSheet.create({
45
+ imageStyle: {
46
+ width: 73,
47
+ height: 73,
48
+ resizeMode: 'cover',
49
+ borderRadius: 7.6,
50
+ },
51
+ closeUpsellingButton: {
52
+ borderRadius: 7.6,
53
+ borderColor: theme.colors.primary,
54
+ backgroundColor: theme.colors.primary,
55
+ borderWidth: 1,
56
+ alignSelf: 'center',
57
+ height: 44,
58
+ shadowOpacity: 0,
59
+ width: '80%',
60
+ },
61
+ cancelBtn: {
62
+ paddingHorizontal: 18,
63
+ borderWidth: 1,
64
+ borderRadius: 7.6,
65
+ borderColor: theme.colors.textSecondary,
66
+ height: 38
67
+ },
68
+ headerItem: {
69
+ flexDirection: 'row',
70
+ alignItems: 'center',
71
+ marginVertical: 2,
72
+ marginHorizontal: 20,
73
+ },
74
+ btnBackArrow: {
75
+ borderWidth: 0,
76
+ width: 26,
77
+ height: 26,
78
+ backgroundColor: theme.colors.clear,
79
+ borderColor: theme.colors.clear,
80
+ shadowColor: theme.colors.clear,
81
+ paddingLeft: 0,
82
+ paddingRight: 0,
83
+ marginLeft: 20,
84
+ marginBottom: 10
85
+ },
86
+ })
79
87
 
80
- const [modalIsOpen, setModalIsOpen] = useState(false)
81
- const [{ carts }] = useOrder()
82
- const [{ parsePrice }] = useUtils()
83
- const [, t] = useLanguage()
84
- const { bottom } = useSafeAreaInsets()
85
- const [isCheckout, setIsCheckout] = useState(false)
88
+ const [modalIsOpen, setModalIsOpen] = useState(false)
89
+ const [{ carts }] = useOrder()
90
+ const [{ parsePrice }] = useUtils()
91
+ const [{ configs }] = useConfig()
92
+ const [, t] = useLanguage()
93
+ const { bottom } = useSafeAreaInsets()
94
+ const [isCheckout, setIsCheckout] = useState(false)
95
+ const [isCartsLoading, setIsCartsLoading] = useState(false)
86
96
 
87
- const cart = carts?.[`businessId:${props.businessId}`] ?? {}
88
- const cartProducts = cart?.products?.length
89
- ? cart?.products.map((product: any) => product.id)
90
- : []
97
+ const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
98
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
99
+ const showCartList = isChewLayout
100
+ const commentDelayTime = isChewLayout ? 500 : null
91
101
 
92
- const productsList = !upsellingProducts.loading && !upsellingProducts.error
93
- ? upsellingProducts?.products?.length
94
- ? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
95
- : (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
96
- : []
102
+ const cart = carts?.[`businessId:${props.businessId}`] ?? {}
103
+ const cartList = (carts && Object.values(carts).filter((_cart: any) => _cart?.products?.length > 0 && _cart.uuid !== cart?.uuid)) || []
104
+ const cartProducts = cart?.products?.length
105
+ ? cart?.products.map((product: any) => product.id)
106
+ : []
97
107
 
98
- useEffect(() => {
99
- if (!isCustomMode && !props.products) {
100
- if (!upsellingProducts.loading) {
101
- if (upsellingProducts?.products?.length && !isFromCart) {
102
- setCanOpenUpselling && setCanOpenUpselling(true)
103
- } else {
104
- handleUpsellingPage && handleUpsellingPage()
105
- }
106
- }
107
- }
108
- }, [upsellingProducts.loading, upsellingProducts?.products.length])
108
+ const productsList = !upsellingProducts.loading && !upsellingProducts.error
109
+ ? upsellingProducts?.products?.length
110
+ ? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
111
+ : (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
112
+ : []
109
113
 
110
- const handleFormProduct = (product: any) => {
111
- onNavigationRedirect && onNavigationRedirect('ProductDetails', {
112
- product: product,
113
- businessId: product?.api?.businessId,
114
- businessSlug: business.slug,
115
- })
116
- }
114
+ useEffect(() => {
115
+ if (!isCustomMode && !props.products) {
116
+ if (!upsellingProducts.loading) {
117
+ if (upsellingProducts?.products?.length && !isFromCart) {
118
+ setCanOpenUpselling && setCanOpenUpselling(true)
119
+ } else {
120
+ handleUpsellingPage && handleUpsellingPage(cart)
121
+ }
122
+ }
123
+ }
124
+ }, [upsellingProducts.loading, upsellingProducts?.products.length])
117
125
 
118
- const UpsellingLayout = () => {
119
- return (
120
- <Container>
121
- <UpsellingContainer
122
- horizontal
123
- showsHorizontalScrollIndicator={false}
124
- contentContainerStyle={{ paddingHorizontal: Platform.OS === 'ios' ? 40 : 0 }}
125
- >
126
- {
127
- !upsellingProducts.loading && (
128
- <>
129
- {
130
- !upsellingProducts.error ? productsList.map((product: any, i: number) => (
131
- <Item key={`${product.id}_${i}`}>
132
- <View style={{ flexBasis: '57%' }}>
133
- <Details>
134
- <OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
135
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>{parsePrice(product.price)}</OText>
136
- </Details>
137
- <AddButton onPress={() => handleFormProduct(product)}>
138
- <OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
139
- </AddButton>
140
- </View>
141
- <View>
142
- <OIcon url={product.images} style={styles.imageStyle} />
143
- </View>
144
- </Item>
145
- )) : (
146
- <OText>
147
- {upsellingProducts.message}
148
- </OText>
149
- )
150
- }
151
- </>
152
- )
153
- }
154
- </UpsellingContainer>
155
- </Container>
156
- )
157
- }
126
+ const handleFormProduct = (product: any) => {
127
+ onNavigationRedirect && onNavigationRedirect('ProductDetails', {
128
+ product: product,
129
+ businessId: product?.api?.businessId,
130
+ businessSlug: business.slug,
131
+ })
132
+ }
158
133
 
159
- const UpsellingContent = () => {
160
- return (
161
- <>
162
- <View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 70 }}>
163
- <OButton
164
- imgLeftSrc={theme.images.general.arrow_left}
165
- imgRightSrc={null}
166
- style={styles.btnBackArrow}
167
- onClick={() => onGoBack()}
168
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
169
- />
170
- </View>
171
- <ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
172
- {productsList.length > 0 &&
173
- <View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
174
- <OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
175
- <UpsellingLayout />
176
- </View>
177
- }
178
- <View style={{ paddingHorizontal: 40 }}>
179
- <OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
180
- <OrderSummary
181
- cart={cart}
182
- isCartPending={cart?.status === 2}
183
- onNavigationRedirect={onNavigationRedirect}
184
- />
185
- </View>
186
- </ScrollView>
187
- <View
188
- style={{
189
- alignItems: 'center',
190
- bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
191
- }}
192
- >
193
- <OButton
194
- imgRightSrc=''
195
- text={t('CHECKOUT', 'Checkout')}
196
- style={{ ...styles.closeUpsellingButton }}
197
- textStyle={{ color: theme.colors.white, fontSize: 14 }}
198
- onClick={() => {
199
- handleUpsellingPage()
200
- setIsCheckout(true)
201
- }}
202
- />
203
- </View>
204
- </>
205
- )
206
- }
134
+ const UpsellingLayout = () => {
135
+ return (
136
+ <Container>
137
+ <UpsellingContainer
138
+ horizontal
139
+ showsHorizontalScrollIndicator={false}
140
+ contentContainerStyle={{ paddingHorizontal: Platform.OS === 'ios' ? 40 : 0 }}
141
+ >
142
+ {
143
+ !upsellingProducts.loading && (
144
+ <>
145
+ {
146
+ !upsellingProducts.error ? productsList.map((product: any, i: number) => (
147
+ <Item key={`${product.id}_${i}`}>
148
+ <View style={{ flexBasis: '57%' }}>
149
+ <Details>
150
+ <OText size={12} lineHeight={18} numberOfLines={1} ellipsizeMode='tail'>{product.name}</OText>
151
+ <OText size={12} lineHeight={18} color={theme.colors.textNormal}>{parsePrice(product.price)}</OText>
152
+ </Details>
153
+ <AddButton onPress={() => handleFormProduct(product)}>
154
+ <OText size={10} color={theme.colors.primary}>{t('ADD', 'Add')}</OText>
155
+ </AddButton>
156
+ </View>
157
+ <View>
158
+ <OIcon url={product?.images || theme?.images?.dummies?.product} style={styles.imageStyle} />
159
+ </View>
160
+ </Item>
161
+ )) : (
162
+ <OText>
163
+ {upsellingProducts.message}
164
+ </OText>
165
+ )
166
+ }
167
+ </>
168
+ )
169
+ }
170
+ </UpsellingContainer>
171
+ </Container>
172
+ )
173
+ }
207
174
 
208
- return (
209
- <>
210
- {isCustomMode ? (
211
- <UpsellingLayout />
212
- ) : (
213
- <>
214
- {props.isPage ? (
215
- <UpsellingContent />
216
- ) : (
217
- canOpenUpselling && !modalIsOpen && (
218
- <OBottomPopup
219
- title={''}
220
- open={openUpselling}
221
- onClose={() => handleUpsellingPage()}
222
- isStatusBar
223
- >
224
- <UpsellingContent />
225
- </OBottomPopup>
226
- )
227
- )}
228
- </>
229
- )}
230
- </>
231
- )
175
+ const UpsellingContent = () => {
176
+ return (
177
+ <>
178
+ <View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 14 }}>
179
+ <TouchableOpacity onPress={() => onGoBack()} style={styles.btnBackArrow}>
180
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
181
+ </TouchableOpacity>
182
+ </View>
183
+ <ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
184
+ {productsList.length > 0 &&
185
+ <View style={{ paddingHorizontal: 40, overflow: 'visible' }}>
186
+ <OText size={16} lineHeight={24} weight={'500'}>{t('WANT_SOMETHING_ELSE', 'Do you want something else?')}</OText>
187
+ <UpsellingLayout />
188
+ </View>
189
+ }
190
+ <View style={{ paddingHorizontal: 40 }}>
191
+ <OText size={20} lineHeight={30} weight={600} style={{ marginTop: 10, marginBottom: 17 }}>{t('YOUR_CART', 'Your cart')}</OText>
192
+ <OrderSummary
193
+ cart={cart}
194
+ commentDelayTime={commentDelayTime}
195
+ isCartPending={cart?.status === 2}
196
+ onNavigationRedirect={onNavigationRedirect}
197
+ />
198
+ </View>
199
+ {showCartList && cartList.map((cart: any, i: number) => (
200
+ <CartList key={i}>
201
+ <Cart
202
+ cart={cart}
203
+ cartuuid={cart.uuid}
204
+ hideUpselling
205
+ singleBusiness={props.singleBusiness}
206
+ isFranchiseApp={props.isFranchiseApp}
207
+ isCartsLoading={isCartsLoading}
208
+ setIsCartsLoading={setIsCartsLoading}
209
+ isMultiCheckout={isMultiCheckout}
210
+ onNavigationRedirect={props.onNavigationRedirect}
211
+ />
212
+ <CartDivider />
213
+ </CartList>
214
+ ))}
215
+ </ScrollView>
216
+ <View
217
+ style={{
218
+ alignItems: 'center',
219
+ bottom: props.isPage ? Platform.OS === 'ios' ? 0 : 20 : Platform.OS === 'ios' ? bottom + 59 : bottom + 125
220
+ }}
221
+ >
222
+ <OButton
223
+ imgRightSrc=''
224
+ text={t('CHECKOUT', 'Checkout')}
225
+ style={{ ...styles.closeUpsellingButton }}
226
+ textStyle={{ color: theme.colors.white, fontSize: 14 }}
227
+ onClick={() => {
228
+ handleUpsellingPage(cart)
229
+ setIsCheckout(true)
230
+ }}
231
+ />
232
+ </View>
233
+ </>
234
+ )
235
+ }
236
+
237
+ return (
238
+ <>
239
+ {isCustomMode ? (
240
+ <UpsellingLayout />
241
+ ) : (
242
+ <>
243
+ {props.isPage ? (
244
+ <UpsellingContent />
245
+ ) : (
246
+ canOpenUpselling && !modalIsOpen && (
247
+ <OBottomPopup
248
+ title={''}
249
+ open={openUpselling}
250
+ onClose={() => handleUpsellingPage(cart)}
251
+ isStatusBar
252
+ >
253
+ <UpsellingContent />
254
+ </OBottomPopup>
255
+ )
256
+ )}
257
+ </>
258
+ )}
259
+ </>
260
+ )
232
261
  }
233
262
 
234
263
  export const UpsellingProducts = (props: UpsellingProductsParams) => {
235
- const upsellingProductsProps = {
236
- ...props,
237
- UIComponent: UpsellingProductsUI
238
- }
239
- return (
240
- <UpsellingPageController {...upsellingProductsProps} />
241
- )
264
+ const upsellingProductsProps = {
265
+ ...props,
266
+ UIComponent: UpsellingProductsUI
267
+ }
268
+ return (
269
+ <UpsellingPageController {...upsellingProductsProps} />
270
+ )
242
271
  }
@@ -47,4 +47,15 @@ export const TopBar = styled.View`
47
47
  export const TopActions = styled.TouchableOpacity`
48
48
  height: 44px;
49
49
  justify-content: center;
50
- `;
50
+ `;
51
+
52
+ export const CartList = styled.ScrollView`
53
+ padding: 10px 40px;
54
+ overflow: visible;
55
+ `
56
+
57
+ export const CartDivider = styled.View`
58
+ height: 8px;
59
+ background-color: ${(props: any) => props.theme.colors.backgroundGray100};
60
+ margin: 20px -40px 0;
61
+ `
@@ -152,9 +152,11 @@ const UserDetailsUI = (props: any) => {
152
152
  {!(validationFields.loading || formState.loading) && (
153
153
  <UDContainer>
154
154
  <UDHeader>
155
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
156
- {t('CUSTOMER_DETAILS', 'Customer Details')}
157
- </OText>
155
+ {props.HeaderTitle ?? (
156
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
157
+ {t('CUSTOMER_DETAILS', 'Customer Details')}
158
+ </OText>
159
+ )}
158
160
  {cartStatus !== 2 && !requiredFields && (
159
161
  !isEdit ? (
160
162
  <EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>