ordering-ui-react-native 0.15.97 → 0.15.98-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 (231) hide show
  1. package/package.json +8 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +145 -61
  26. package/src/components/SingleProductReview/index.tsx +1 -1
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +6 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/theme.json +0 -1
  45. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  46. package/src/types/index.tsx +15 -9
  47. package/src/utils/index.tsx +1 -2
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  50. package/themes/business/src/components/Chat/index.tsx +14 -6
  51. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  52. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  53. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  54. package/themes/business/src/components/LoginForm/index.tsx +110 -74
  55. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  56. package/themes/business/src/components/MapView/index.tsx +1 -1
  57. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  58. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  61. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  62. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  63. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  64. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  66. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  67. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  71. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  72. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  73. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  74. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  75. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  76. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  77. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  78. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  79. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  80. package/themes/business/src/components/shared/OModal.tsx +41 -38
  81. package/themes/business/src/types/index.tsx +14 -9
  82. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  83. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  84. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  86. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  87. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  88. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  89. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +70 -31
  90. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  91. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  92. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  93. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  94. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  95. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  96. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  97. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  98. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  99. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  100. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  101. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  102. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  103. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  104. package/themes/kiosk/src/types/index.d.ts +3 -0
  105. package/themes/original/index.tsx +22 -0
  106. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  107. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  108. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  109. package/themes/original/src/components/AddressList/index.tsx +2 -2
  110. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  111. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  112. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  113. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  114. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  115. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  116. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  117. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  118. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  119. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  120. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  121. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  122. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  123. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  124. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  125. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  126. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  127. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  128. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  129. package/themes/original/src/components/BusinessProductsListing/index.tsx +296 -178
  130. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  131. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  132. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  133. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  134. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  135. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  136. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  137. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  138. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  139. package/themes/original/src/components/Cart/index.tsx +82 -37
  140. package/themes/original/src/components/Cart/styles.tsx +4 -0
  141. package/themes/original/src/components/CartContent/index.tsx +22 -16
  142. package/themes/original/src/components/Checkout/index.tsx +107 -67
  143. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  144. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  145. package/themes/original/src/components/Favorite/index.tsx +92 -0
  146. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  147. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  148. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  149. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  150. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  151. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  152. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  153. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  154. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  155. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  156. package/themes/original/src/components/LoginForm/index.tsx +86 -43
  157. package/themes/original/src/components/Messages/index.tsx +17 -17
  158. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  159. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  160. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  161. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  162. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  163. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  164. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  165. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  166. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  167. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  168. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  169. package/themes/original/src/components/NavBar/index.tsx +11 -5
  170. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  171. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  172. package/themes/original/src/components/OrderDetails/index.tsx +138 -58
  173. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  174. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  175. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  176. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  177. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  178. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  179. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  180. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  181. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  182. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  183. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  184. package/themes/original/src/components/OrdersOption/index.tsx +140 -46
  185. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  186. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  187. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  188. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  189. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  190. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  191. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  192. package/themes/original/src/components/ProductForm/index.tsx +694 -647
  193. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  194. package/themes/original/src/components/ProductItemAccordion/index.tsx +38 -25
  195. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  196. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  197. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  198. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  199. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  200. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  201. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  202. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  203. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  204. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  205. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  206. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  207. package/themes/original/src/components/SignupForm/index.tsx +307 -159
  208. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  209. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  210. package/themes/original/src/components/SingleProductCard/index.tsx +204 -95
  211. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  212. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  213. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  214. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  215. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  216. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  217. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  218. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  219. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  220. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  221. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  222. package/themes/original/src/components/Wallets/index.tsx +176 -162
  223. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  224. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  225. package/themes/original/src/components/shared/OButton.tsx +10 -3
  226. package/themes/original/src/components/shared/OInput.tsx +3 -2
  227. package/themes/original/src/components/shared/OModal.tsx +4 -2
  228. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  229. package/themes/original/src/types/index.tsx +200 -47
  230. package/themes/original/src/utils/index.tsx +77 -0
  231. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,41 +1,59 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import {
3
3
  useLanguage,
4
4
  useConfig,
5
5
  useOrder,
6
6
  useUtils,
7
+ useSession,
8
+ SingleProductCard as SingleProductCardController
7
9
  } from 'ordering-components/native';
8
10
  import { useTheme } from 'styled-components/native';
9
11
  import { SingleProductCardParams } from '../../types';
10
12
  import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
11
- import { StyleSheet } from 'react-native';
12
- import { OText, OIcon } from '../shared';
13
+ import { StyleSheet, View, TouchableOpacity, Image, Animated } from 'react-native';
14
+ import { InView } from 'react-native-intersection-observer'
15
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
16
+ import { OButton, OIcon, OText } from '../shared';
13
17
  import FastImage from 'react-native-fast-image'
18
+ import IconAntDesign from 'react-native-vector-icons/AntDesign'
14
19
  import { shape } from '../../utils';
15
20
 
16
- function SingleProductCardPropsAreEqual(prevProps : any, nextProps : any) {
17
- return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
18
- prevProps.isSoldOut === nextProps.isSoldOut &&
19
- prevProps.productAddedToCartLength === nextProps.productAddedToCartLength
21
+ function SingleProductCardPropsAreEqual(prevProps: any, nextProps: any) {
22
+ return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
23
+ prevProps.isSoldOut === nextProps.isSoldOut &&
24
+ prevProps.productAddedToCartLength === nextProps.productAddedToCartLength &&
25
+ prevProps.categoryState === nextProps.categoryState
20
26
  }
21
27
 
22
- export const SingleProductCard = React.memo((props: SingleProductCardParams) => {
28
+ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
23
29
  const {
24
30
  product,
25
31
  isSoldOut,
26
32
  onProductClick,
27
33
  productAddedToCartLength,
28
- style
34
+ style,
35
+ handleFavoriteProduct,
36
+ enableIntersection,
37
+ navigation,
38
+ businessId,
39
+ isPreviously
29
40
  } = props;
30
41
 
31
42
  const theme = useTheme();
43
+ const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
32
44
 
33
45
  const styles = StyleSheet.create({
34
46
  container: {
35
47
  borderWidth: 1,
36
48
  borderRadius: 7.6,
37
49
  borderColor: theme.colors.border,
38
- marginBottom: 28,
50
+ marginBottom: 25,
51
+ minHeight: hideAddButton ? 100 : 165
52
+ },
53
+ titleWrapper: {
54
+ flexDirection: 'row',
55
+ alignItems: 'center',
56
+ justifyContent: 'space-between'
39
57
  },
40
58
  line18: {
41
59
  lineHeight: 18,
@@ -56,8 +74,8 @@ export const SingleProductCard = React.memo((props: SingleProductCardParams) =>
56
74
  },
57
75
  quantityContainer: {
58
76
  position: 'absolute',
59
- left: '100%',
60
- bottom: '100%',
77
+ right: 0,
78
+ top: 0,
61
79
  width: 25,
62
80
  height: 25,
63
81
  textAlign: 'center',
@@ -73,11 +91,12 @@ export const SingleProductCard = React.memo((props: SingleProductCardParams) =>
73
91
  }
74
92
  });
75
93
 
76
-
77
94
  const [, t] = useLanguage();
78
95
  const [stateConfig] = useConfig();
79
- const [{ parsePrice, optimizeImage }] = useUtils();
80
- const [orderState] = useOrder();
96
+ const [{ auth }] = useSession()
97
+ const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
98
+ const [orderState] = useOrder()
99
+ const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
81
100
 
82
101
  const editMode = typeof product?.code !== 'undefined';
83
102
 
@@ -102,88 +121,178 @@ export const SingleProductCard = React.memo((props: SingleProductCardParams) =>
102
121
  maxCartProductConfig,
103
122
  maxCartProductInventory,
104
123
  );
124
+
125
+ const handleChangeFavorite = () => {
126
+ if (auth) {
127
+ handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
128
+ } else {
129
+ navigation && navigation.navigate('Login');
130
+ }
131
+ }
132
+
133
+ const handleChangeIntersection = () => {
134
+ if (enableIntersection) {
135
+ setIsIntersectionObserver(true);
136
+ }
137
+ }
138
+
105
139
  return (
106
- <CardContainer
107
- style={[
108
- styles.container,
109
- (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
110
- (style && { ...style }),
111
- ]}
112
- onPress={() => onProductClick?.(product)}>
113
- {productAddedToCartLength > 0 && (
114
- <QuantityContainer style={[styles.quantityContainer, {
115
- transform: [{ translateX: 10 }, { translateY: -10 }],
116
- }]}>
117
- <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
118
- </QuantityContainer>
119
- )}
120
- <CardInfo>
121
- <OText
122
- size={12}
123
- weight={'500'}
124
- numberOfLines={1}
125
- ellipsizeMode="tail"
126
- style={styles.line18}>
127
- {product?.name}
128
- </OText>
129
- <PricesContainer>
130
- <OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
131
- {product?.offer_price !== null && product?.in_offer && (
132
- <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
140
+ <InView style={{ minHeight: hideAddButton ? 125 : 190 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
141
+ {isIntersectionObserver ? (
142
+ <CardContainer
143
+ showAddButton={!hideAddButton}
144
+ style={[
145
+ styles.container,
146
+ (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
147
+ (style && { ...style }),
148
+ ]}
149
+ onPress={() => onProductClick?.(product)}
150
+ >
151
+ <View style={{ flexDirection: 'row' }}>
152
+ {productAddedToCartLength > 0 && (
153
+ <QuantityContainer style={[styles.quantityContainer, {
154
+ transform: [{ translateX: 25 }, { translateY: hideAddButton ? -25 : -55 }],
155
+ }]}>
156
+ <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
157
+ </QuantityContainer>
158
+ )}
159
+ <CardInfo>
160
+ <View style={styles.titleWrapper}>
161
+ <OText
162
+ size={12}
163
+ weight={'500'}
164
+ numberOfLines={1}
165
+ ellipsizeMode="tail"
166
+ style={{ ...styles.line18, flex: 1 }}>
167
+ {product?.name}
168
+ </OText>
169
+ {!isPreviously && (
170
+ <TouchableOpacity
171
+ onPress={handleChangeFavorite}
172
+ >
173
+ <IconAntDesign
174
+ name={product?.favorite ? 'heart' : 'hearto'}
175
+ color={theme.colors.danger5}
176
+ size={18}
177
+ />
178
+ </TouchableOpacity>
179
+ )}
180
+ </View>
181
+ <PricesContainer>
182
+ {!!product?.price && (
183
+ <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
184
+ )}
185
+ {product?.offer_price !== null && !!product?.in_offer && (
186
+ <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
187
+ )}
188
+ </PricesContainer>
189
+ <OText
190
+ size={10}
191
+ numberOfLines={!isPreviously ? 2 : 1}
192
+ ellipsizeMode="tail"
193
+ color={theme.colors.textSecondary}
194
+ style={styles.line15}>
195
+ {product?.description}
196
+ </OText>
197
+ {isPreviously && (
198
+ <OText
199
+ size={10}
200
+ numberOfLines={1}
201
+ ellipsizeMode="tail"
202
+ color={theme.colors.primary}
203
+ style={styles.line15}>
204
+ {t('LAST_ORDERED_ON', 'Last ordered on')} {parseDate(product?.last_ordered_date, { outputFormat: 'MMM DD, YYYY' })}
205
+ </OText>
206
+ )}
207
+ </CardInfo>
208
+ <LogoWrapper>
209
+ {!!product?.ribbon?.enabled && (
210
+ <RibbonBox
211
+ bgColor={product?.ribbon?.color}
212
+ isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
213
+ isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
214
+ >
215
+ <OText
216
+ size={10}
217
+ weight={'400'}
218
+ color={theme.colors.white}
219
+ numberOfLines={2}
220
+ ellipsizeMode='tail'
221
+ lineHeight={13}
222
+ >
223
+ {product?.ribbon?.text}
224
+ </OText>
225
+ </RibbonBox>
226
+ )}
227
+ {product?.images ? (
228
+ <FastImage
229
+ style={styles.productStyle}
230
+ source={{
231
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
232
+ priority: FastImage.priority.normal,
233
+ }}
234
+ resizeMode={FastImage.resizeMode.cover}
235
+ />
236
+ ) : (
237
+ <OIcon
238
+ src={theme?.images?.dummies?.product}
239
+ style={styles.productStyle}
240
+ />
241
+ )}
242
+ </LogoWrapper>
243
+
244
+ {(isSoldOut || maxProductQuantity <= 0) && (
245
+ <SoldOut>
246
+ <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
247
+ {t('SOLD_OUT', 'SOLD OUT')}
248
+ </OText>
249
+ </SoldOut>
250
+ )}
251
+ </View>
252
+ {!hideAddButton && (
253
+ <OButton
254
+ onClick={() => onProductClick?.(product)}
255
+ style={{
256
+ width: '100%',
257
+ borderRadius: 7.6,
258
+ marginTop: 10,
259
+
260
+ }}
261
+ bgColor={isSoldOut ? '#B8B8B8' : theme?.colors?.white}
262
+ borderColor={theme?.colors.primary}
263
+ textStyle={{ color: theme.colors.primary }}
264
+ text={t('ADD', 'Add')}
265
+ />
133
266
  )}
134
- </PricesContainer>
135
- <OText
136
- size={10}
137
- numberOfLines={2}
138
- ellipsizeMode="tail"
139
- color={theme.colors.textSecondary}
140
- style={styles.line15}>
141
- {product?.description}
142
- </OText>
143
- </CardInfo>
144
- <LogoWrapper>
145
- {product?.ribbon?.enabled && (
146
- <RibbonBox
147
- bgColor={product?.ribbon?.color}
148
- isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
149
- isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
150
- >
151
- <OText
152
- size={10}
153
- weight={'400'}
154
- color={theme.colors.white}
155
- numberOfLines={2}
156
- ellipsizeMode='tail'
157
- lineHeight={13}
158
- >
159
- {product?.ribbon?.text}
160
- </OText>
161
- </RibbonBox>
162
- )}
163
- {product?.images ? (
164
- <FastImage
165
- style={styles.productStyle}
166
- source={{
167
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
168
- priority: FastImage.priority.normal,
169
- }}
170
- resizeMode={FastImage.resizeMode.cover}
171
- />
172
- ) : (
173
- <OIcon
174
- src={theme?.images?.dummies?.product}
175
- style={styles.productStyle}
176
- />
177
- )}
178
- </LogoWrapper>
179
-
180
- {(isSoldOut || maxProductQuantity <= 0) && (
181
- <SoldOut>
182
- <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
183
- {t('SOLD_OUT', 'SOLD OUT')}
184
- </OText>
185
- </SoldOut>
267
+ </CardContainer>
268
+ ) : (
269
+ <View style={{ marginBottom: 28, padding: 12, height: hideAddButton ? 125 : 165 }}>
270
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
271
+ <View style={{ flexDirection: 'row' }}>
272
+ <Placeholder style={{ paddingVertical: 10, flex: 1 }}>
273
+ <PlaceholderLine width={60} style={{ marginBottom: 15 }} />
274
+ <PlaceholderLine width={20} />
275
+ </Placeholder>
276
+ <PlaceholderLine
277
+ width={24}
278
+ height={70}
279
+ style={{ marginLeft: 10, marginBottom: 10 }}
280
+ />
281
+ </View>
282
+ <PlaceholderLine
283
+ height={52}
284
+ />
285
+ </Placeholder>
286
+ </View>
186
287
  )}
187
- </CardContainer>
288
+ </InView>
188
289
  );
189
290
  }, SingleProductCardPropsAreEqual);
291
+
292
+ export const SingleProductCard = (props: SingleProductCardParams) => {
293
+ const singleProductCardProps = {
294
+ ...props,
295
+ UIComponent: SingleProductCardUI
296
+ }
297
+ return <SingleProductCardController {...singleProductCardProps} />
298
+ }
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const CardContainer = styled.TouchableOpacity`
4
4
  flex: 1;
5
- flex-direction: row;
5
+ flex-direction: ${(props : any) => props.showAddButton ? 'column' : 'row'};
6
6
  justify-content: space-between;
7
7
  align-items: center;
8
8
  padding: 12px;
@@ -23,7 +23,7 @@ export const SoldOut = styled.View`
23
23
  `
24
24
 
25
25
  export const QuantityContainer = styled.View`
26
- background: ${({ theme } : any) => theme.colors.primary};
26
+ background: ${({ theme }: any) => theme.colors.primary};
27
27
  align-items: center;
28
28
  justify-content: center;
29
29
  `
@@ -27,7 +27,8 @@ const StripeElementsFormUI = (props: any) => {
27
27
  paymethod,
28
28
  onCancel,
29
29
  cart,
30
- merchantId
30
+ merchantId,
31
+ businessIds
31
32
  } = props;
32
33
 
33
34
  const theme = useTheme();
@@ -60,17 +61,25 @@ const StripeElementsFormUI = (props: any) => {
60
61
  }
61
62
 
62
63
  if (user?.address) {
63
- billingDetails.addressLine1 = user?.address
64
+ billingDetails.address = {
65
+ line1: user?.address
66
+ }
64
67
  }
65
68
 
66
69
  const createPayMethod = async () => {
67
- const params: any = { type: 'Card' }
70
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
68
71
  if (Object.keys(billingDetails).length > 0) {
69
- params.billingDetails = billingDetails
72
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
70
73
  }
71
74
  try {
72
75
  setCreatePmLoading(true)
73
- const { paymentMethod } = await createPaymentMethod(params);
76
+ const { paymentMethod, error } = await createPaymentMethod(params);
77
+
78
+ if (error) {
79
+ setErrors(error?.message);
80
+ setCreatePmLoading(false)
81
+ return
82
+ }
74
83
 
75
84
  setCreatePmLoading(false)
76
85
  handleSource && handleSource({
@@ -93,22 +102,29 @@ const StripeElementsFormUI = (props: any) => {
93
102
  setErrors(error?.message || error?.toString());
94
103
  }
95
104
  }
96
-
105
+
97
106
  const handleSaveCard = async () => {
98
107
  setErrors('');
99
108
  if (!requirements) {
100
109
  createPayMethod();
101
110
  return
102
111
  }
103
- const params: any = { type: 'Card' }
112
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
104
113
  if (Object.keys(billingDetails).length > 0) {
105
- params.billingDetails = billingDetails
114
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
106
115
  }
107
116
  try {
108
117
  const { setupIntent, error } = await confirmSetupIntent(requirements, params);
109
118
 
110
119
  if (setupIntent?.status === 'Succeeded') {
111
- stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
120
+ if (businessIds) {
121
+ businessIds.forEach((_businessId: any, index: any) => {
122
+ const _isNewCard = index === 0
123
+ stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
124
+ })
125
+ } else {
126
+ stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
127
+ }
112
128
  }
113
129
 
114
130
  if (error) {
@@ -40,7 +40,7 @@ export const StripeElementsForm = (props: any) => {
40
40
  }
41
41
  }
42
42
 
43
- const stripeTokenHandler = async (tokenId: string, user: any, businessId: string) => {
43
+ const stripeTokenHandler = async (tokenId: string, user: any, businessId: string, isNewCard: any = true) => {
44
44
  try {
45
45
  setState({
46
46
  ...state,
@@ -60,7 +60,7 @@ export const StripeElementsForm = (props: any) => {
60
60
  })
61
61
  })
62
62
  const response = await result.json();
63
- props.onSelectCard && props.onSelectCard(response.result);
63
+ isNewCard && props.onSelectCard && props.onSelectCard(response.result);
64
64
  setState({
65
65
  ...state,
66
66
  loadingAdd: false
@@ -1,5 +1,5 @@
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
4
  UpsellingPage as UpsellingPageController,
5
5
  useUtils,
@@ -21,6 +21,7 @@ import {
21
21
  import { OrderSummary } from '../OrderSummary';
22
22
  import { ScrollView } from 'react-native-gesture-handler';
23
23
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
24
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
24
25
 
25
26
  const UpsellingProductsUI = (props: UpsellingProductsParams) => {
26
27
  const {
@@ -161,11 +162,14 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
161
162
  <>
162
163
  <View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 70 }}>
163
164
  <OButton
164
- imgLeftSrc={theme.images.general.arrow_left}
165
165
  imgRightSrc={null}
166
166
  style={styles.btnBackArrow}
167
167
  onClick={() => onGoBack()}
168
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
168
+ icon={AntDesignIcon}
169
+ iconProps={{
170
+ name: 'arrowleft',
171
+ size: 26
172
+ }}
169
173
  />
170
174
  </View>
171
175
  <ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>
@@ -23,6 +23,8 @@ const UserDetailsUI = (props: any) => {
23
23
  isEdit,
24
24
  formState,
25
25
  cleanFormState,
26
+ requiredFields,
27
+ onClose,
26
28
  cartStatus,
27
29
  toggleIsEdit,
28
30
  validationFields,
@@ -30,12 +32,9 @@ const UserDetailsUI = (props: any) => {
30
32
  phoneUpdate,
31
33
  togglePhoneUpdate,
32
34
  isCheckout,
33
- checkPhoneCodeState,
34
35
  handleSendVerifyCode,
35
- handleCheckPhoneCode,
36
36
  verifyPhoneState,
37
- isVerifiedPhone,
38
- setCheckPhoneCodeState
37
+ setFormState
39
38
  } = props
40
39
 
41
40
  const theme = useTheme();
@@ -47,7 +46,9 @@ const UserDetailsUI = (props: any) => {
47
46
  const userData = props.userData || (!formState.result.error && formState.result?.result) || user
48
47
 
49
48
  const [isModalVisible, setIsModalVisible] = useState(false);
49
+ const [isSubmit, setIsSubmit] = useState(false)
50
50
  const [willVerifyOtpState, setWillVerifyOtpState] = useState(false);
51
+ const [checkPhoneCodeState, setCheckPhoneCodeState] = useState({ loading: false, result: { error: false } })
51
52
  const [phoneInputData, setPhoneInputData] = useState({
52
53
  error: '',
53
54
  phone: {
@@ -56,7 +57,6 @@ const UserDetailsUI = (props: any) => {
56
57
  },
57
58
  });
58
59
 
59
-
60
60
  useEffect(() => {
61
61
  if (isUserDetailsEdit) {
62
62
  !isEdit && toggleIsEdit()
@@ -68,6 +68,12 @@ const UserDetailsUI = (props: any) => {
68
68
  cleanFormState({ changes: {} })
69
69
  }
70
70
 
71
+ useEffect(() => {
72
+ if (isSubmit && !isEdit && requiredFields) {
73
+ onClose && onClose()
74
+ }
75
+ }, [isSubmit, requiredFields, isEdit])
76
+
71
77
  useEffect(() => {
72
78
  if (user?.cellphone && !user?.country_phone_code) {
73
79
  togglePhoneUpdate(true)
@@ -94,6 +100,18 @@ const UserDetailsUI = (props: any) => {
94
100
  }
95
101
  }
96
102
 
103
+ const handleSendPhoneCode = (values: any) => {
104
+ setWillVerifyOtpState(false)
105
+ setIsModalVisible(false)
106
+ setFormState({
107
+ ...formState,
108
+ changes: {
109
+ ...formState?.changes,
110
+ verification_code: values?.code
111
+ }
112
+ })
113
+ }
114
+
97
115
  useEffect(() => {
98
116
  if (willVerifyOtpState) handleVerifyCodeClick()
99
117
  }, [willVerifyOtpState])
@@ -120,10 +138,6 @@ const UserDetailsUI = (props: any) => {
120
138
  }
121
139
  }, [verifyPhoneState])
122
140
 
123
- useEffect(() => {
124
- if (isVerifiedPhone) setIsModalVisible(false)
125
- }, [isVerifiedPhone])
126
-
127
141
  return (
128
142
  <>
129
143
  {(validationFields.loading || formState.loading) && (
@@ -138,10 +152,10 @@ const UserDetailsUI = (props: any) => {
138
152
  {!(validationFields.loading || formState.loading) && (
139
153
  <UDContainer>
140
154
  <UDHeader>
141
- <OText size={16} lineHeight={24} weight={'500'}>
155
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
142
156
  {t('CUSTOMER_DETAILS', 'Customer Details')}
143
157
  </OText>
144
- {cartStatus !== 2 && (
158
+ {cartStatus !== 2 && !requiredFields && (
145
159
  !isEdit ? (
146
160
  <EditBtn onPress={() => toggleIsEdit()} activeOpacity={0.7}>
147
161
  <OIcon
@@ -192,6 +206,7 @@ const UserDetailsUI = (props: any) => {
192
206
  togglePhoneUpdate={togglePhoneUpdate}
193
207
  isCheckout={isCheckout}
194
208
  setWillVerifyOtpState={setWillVerifyOtpState}
209
+ setIsSubmit={setIsSubmit}
195
210
  />
196
211
  )}
197
212
  </UDContainer>
@@ -202,13 +217,12 @@ const UserDetailsUI = (props: any) => {
202
217
  entireModal
203
218
  >
204
219
  <VerifyPhone
205
- phone={phoneInputData.phone}
206
- verifyPhoneState={verifyPhoneState}
207
- checkPhoneCodeState={checkPhoneCodeState}
208
- handleCheckPhoneCode={handleCheckPhoneCode}
209
- setCheckPhoneCodeState={setCheckPhoneCodeState}
210
- handleVerifyCodeClick={handleVerifyCodeClick}
211
- onClose={() => setIsModalVisible(false)}
220
+ phone={phoneInputData.phone}
221
+ verifyPhoneState={verifyPhoneState}
222
+ checkPhoneCodeState={checkPhoneCodeState}
223
+ handleCheckPhoneCode={handleSendPhoneCode}
224
+ handleVerifyCodeClick={handleVerifyCodeClick}
225
+ onClose={() => setIsModalVisible(false)}
212
226
  />
213
227
  </OModal>
214
228
  <Spinner visible={verifyPhoneState?.loading} />