ordering-ui-react-native 0.16.71 → 0.16.72-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/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/Checkout/index.tsx +2 -1
  9. package/src/components/LanguageSelector/index.tsx +21 -16
  10. package/src/components/Messages/index.tsx +2 -2
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptions/index.tsx +298 -345
  13. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  14. package/src/components/SingleProductReview/index.tsx +7 -4
  15. package/src/components/StripeElementsForm/index.tsx +25 -16
  16. package/src/components/VerifyPhone/styles.tsx +1 -2
  17. package/src/components/shared/OToast.tsx +4 -4
  18. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  19. package/src/utils/index.tsx +2 -1
  20. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  21. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  22. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  23. package/themes/business/src/components/Chat/index.tsx +31 -31
  24. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  25. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  26. package/themes/business/src/components/MapView/index.tsx +14 -3
  27. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  31. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  32. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  33. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  34. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  35. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  36. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  37. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  40. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  41. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  42. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  43. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  44. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  45. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  46. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  47. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  48. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  49. package/themes/business/src/components/shared/OLink.tsx +33 -13
  50. package/themes/business/src/components/shared/OText.tsx +8 -2
  51. package/themes/business/src/types/index.tsx +14 -3
  52. package/themes/business/src/utils/index.tsx +10 -0
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  57. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  59. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  60. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  61. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  64. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  65. package/themes/kiosk/src/types/index.d.ts +2 -0
  66. package/themes/original/index.tsx +6 -0
  67. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  68. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  69. package/themes/original/src/components/AddressList/index.tsx +18 -18
  70. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/BusinessBasicInformation/index.tsx +47 -22
  73. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  74. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  75. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  77. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  78. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  82. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  83. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +41 -62
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +560 -496
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  88. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +83 -92
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  92. package/themes/original/src/components/BusinessesListing/index.tsx +7 -6
  93. package/themes/original/src/components/Cart/index.tsx +75 -42
  94. package/themes/original/src/components/CartContent/index.tsx +80 -18
  95. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  96. package/themes/original/src/components/Checkout/index.tsx +92 -105
  97. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  98. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  99. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  100. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  101. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  102. package/themes/original/src/components/Favorite/index.tsx +7 -4
  103. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  104. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  105. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  106. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  107. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  108. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  109. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  110. package/themes/original/src/components/Help/index.tsx +7 -7
  111. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  112. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  113. package/themes/original/src/components/HelpGuide/index.tsx +12 -11
  114. package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
  115. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  116. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  117. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  118. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  119. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  120. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  121. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  122. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  123. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +17 -11
  126. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  129. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  130. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  131. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  132. package/themes/original/src/components/MyOrders/index.tsx +86 -20
  133. package/themes/original/src/components/NavBar/index.tsx +7 -6
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +144 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +100 -215
  139. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  140. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  141. package/themes/original/src/components/OrderProgress/index.tsx +79 -100
  142. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  143. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +97 -88
  148. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  149. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  150. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PlaceSpot/index.tsx +22 -8
  153. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  154. package/themes/original/src/components/ProductForm/index.tsx +212 -253
  155. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  157. package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
  158. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  159. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  160. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  161. package/themes/original/src/components/Promotions/index.tsx +234 -220
  162. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  163. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  164. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  165. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  166. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  167. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  168. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  169. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  170. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  171. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  172. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  175. package/themes/original/src/components/SingleProductCard/index.tsx +84 -80
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  177. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  178. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  179. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  180. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  181. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  182. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  183. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  184. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  185. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  186. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  187. package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
  188. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +176 -164
  192. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  195. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  196. package/themes/original/src/components/shared/OButton.tsx +9 -4
  197. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  198. package/themes/original/src/components/shared/OInput.tsx +10 -1
  199. package/themes/original/src/layouts/Container.tsx +13 -9
  200. package/themes/original/src/types/index.tsx +35 -5
  201. package/themes/original/src/utils/index.tsx +305 -58
  202. 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()
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()
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()}
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}>
@@ -10,7 +10,6 @@ import { OText, OButton, OInput } from '../shared';
10
10
 
11
11
  import { PhoneInputNumber } from '../PhoneInputNumber';
12
12
  import { sortInputFields } from '../../utils';
13
- import CheckBox from '@react-native-community/checkbox';
14
13
 
15
14
  export const UserFormDetailsUI = (props: any) => {
16
15
  const {
@@ -18,7 +17,6 @@ export const UserFormDetailsUI = (props: any) => {
18
17
  formState,
19
18
  showField,
20
19
  requiredFields,
21
- onClose,
22
20
  setIsSubmit,
23
21
  cleanFormState,
24
22
  onCloseProfile,
@@ -29,12 +27,10 @@ export const UserFormDetailsUI = (props: any) => {
29
27
  phoneUpdate,
30
28
  hideUpdateButton,
31
29
  setWillVerifyOtpState,
32
- handleChangePromotions,
33
30
  } = props;
34
31
 
35
32
  const theme = useTheme();
36
33
 
37
-
38
34
  const styles = StyleSheet.create({
39
35
  btnOutline: {
40
36
  backgroundColor: '#FFF',
@@ -64,10 +60,6 @@ export const UserFormDetailsUI = (props: any) => {
64
60
  paddingStart: 0,
65
61
  paddingBottom: 0,
66
62
  marginBottom: -0,
67
- },
68
- checkBoxStyle: {
69
- width: 25,
70
- height: 25,
71
63
  }
72
64
  });
73
65
 
@@ -79,7 +71,7 @@ export const UserFormDetailsUI = (props: any) => {
79
71
  const [{ user }] = useSession();
80
72
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
81
73
  const [isValid, setIsValid] = useState(false)
82
- const [isChanged, setIsChanged] = useState(false)
74
+ const [isChanged, setIsChanged] = useState(false)
83
75
  const [phoneInputData, setPhoneInputData] = useState({
84
76
  error: '',
85
77
  phone: {
@@ -243,10 +235,10 @@ export const UserFormDetailsUI = (props: any) => {
243
235
 
244
236
  useEffect(() => {
245
237
  if (!requiredFields || formState?.changes?.length === 0) return
246
- const _isValid = requiredFields.every((key: any) => formState?.changes[key])
247
- setIsValid(_isValid)
248
- }, [formState?.changes, requiredFields])
249
-
238
+ const _isValid = requiredFields.every((key: any) => formState?.changes[key])
239
+ setIsValid(_isValid)
240
+ }, [formState?.changes, requiredFields])
241
+
250
242
  return (
251
243
  <>
252
244
  <UDForm>
@@ -333,7 +325,7 @@ export const UserFormDetailsUI = (props: any) => {
333
325
  ),
334
326
  )}
335
327
 
336
- {!!showInputPhoneNumber &&((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
328
+ {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
337
329
  <WrapperPhone>
338
330
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
339
331
  <PhoneInputNumber
@@ -395,39 +387,6 @@ export const UserFormDetailsUI = (props: any) => {
395
387
  defaultValue=''
396
388
  />
397
389
  )}
398
- {!requiredFields && (
399
- <Controller
400
- control={control}
401
- render={({ onChange, value }: any) => (
402
- <TouchableOpacity
403
- style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
404
- onPress={() => {
405
- onChange(!value)
406
- handleChangePromotions(!value)
407
- }}
408
- >
409
- <CheckBox
410
- value={value}
411
- boxType={'square'}
412
- tintColors={{
413
- true: theme.colors.primary,
414
- false: theme.colors.disabled
415
- }}
416
- tintColor={theme.colors.disabled}
417
- onCheckColor={theme.colors.primary}
418
- onTintColor={theme.colors.primary}
419
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
420
- />
421
- <OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
422
- </TouchableOpacity>
423
- )}
424
- name='promotions'
425
- defaultValue={formState?.result?.result
426
- ? !!formState?.result?.result?.settings?.notification?.newsletter
427
- : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
428
- />
429
- )}
430
-
431
390
  </UDWrapper>
432
391
  )}
433
392
  {validationFields?.loading && (
@@ -478,4 +437,3 @@ export const UserFormDetailsUI = (props: any) => {
478
437
  </>
479
438
  );
480
439
  };
481
-