ordering-ui-react-native 0.16.25 → 0.16.26-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 (198) hide show
  1. package/package.json +7 -4
  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/BusinessInformation/index.tsx +33 -4
  8. package/src/components/BusinessInformation/styles.tsx +2 -2
  9. package/src/components/BusinessProductsList/index.tsx +10 -10
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +15 -0
  14. package/src/components/Messages/index.tsx +2 -2
  15. package/src/components/NotificationSetting/index.tsx +85 -0
  16. package/src/components/OrderDetails/index.tsx +2 -20
  17. package/src/components/OrdersOption/index.tsx +54 -56
  18. package/src/components/PaymentOptions/index.tsx +335 -365
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +15 -0
  24. package/src/components/SingleProductReview/index.tsx +8 -5
  25. package/src/components/StripeElementsForm/index.tsx +25 -16
  26. package/src/components/VerifyPhone/styles.tsx +1 -2
  27. package/src/components/shared/OBottomPopup.tsx +6 -2
  28. package/src/index.tsx +2 -0
  29. package/src/pages/BusinessesListing.tsx +7 -6
  30. package/src/pages/OrderDetails.tsx +1 -1
  31. package/src/pages/ReviewDriver.tsx +2 -2
  32. package/src/pages/ReviewOrder.tsx +2 -2
  33. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  34. package/src/utils/index.tsx +0 -1
  35. package/themes/business/index.tsx +4 -0
  36. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  37. package/themes/business/src/components/Chat/index.tsx +42 -34
  38. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  39. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  40. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  41. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  42. package/themes/business/src/components/MapView/index.tsx +12 -1
  43. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  44. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  46. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  47. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  48. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  49. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  50. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  52. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  54. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  55. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  56. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  57. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  58. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  59. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  60. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  61. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  62. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  63. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  64. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  65. package/themes/business/src/components/shared/OModal.tsx +40 -37
  66. package/themes/business/src/types/index.tsx +15 -9
  67. package/themes/business/src/utils/index.tsx +10 -0
  68. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  69. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  70. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  71. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  72. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  73. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  74. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  75. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  76. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  77. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  78. package/themes/kiosk/src/types/index.d.ts +2 -0
  79. package/themes/original/index.tsx +12 -0
  80. package/themes/original/src/components/AddressForm/index.tsx +139 -135
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +311 -161
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  86. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -4
  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 +81 -128
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +289 -175
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
  99. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  101. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  103. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  106. package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
  107. package/themes/original/src/components/Cart/index.tsx +42 -10
  108. package/themes/original/src/components/Cart/styles.tsx +4 -0
  109. package/themes/original/src/components/CartContent/index.tsx +22 -16
  110. package/themes/original/src/components/Checkout/index.tsx +93 -53
  111. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  112. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  113. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  114. package/themes/original/src/components/Favorite/index.tsx +1 -0
  115. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  116. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  117. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  118. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  119. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  120. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  121. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  122. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  124. package/themes/original/src/components/LoginForm/index.tsx +82 -44
  125. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  126. package/themes/original/src/components/Messages/index.tsx +17 -17
  127. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  128. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  129. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  130. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  132. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  133. package/themes/original/src/components/NavBar/index.tsx +15 -9
  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 +148 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  138. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  139. package/themes/original/src/components/OrderDetails/index.tsx +190 -35
  140. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  141. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  142. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  143. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  144. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  145. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  146. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  147. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
  148. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
  149. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  152. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  153. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  154. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  155. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  156. package/themes/original/src/components/ProductForm/index.tsx +710 -653
  157. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  158. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  159. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  160. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  161. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  162. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  163. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  164. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  165. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  166. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  167. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  168. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  169. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  170. package/themes/original/src/components/ServiceForm/index.tsx +631 -0
  171. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  172. package/themes/original/src/components/SignupForm/index.tsx +350 -206
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  175. package/themes/original/src/components/SingleProductCard/index.tsx +207 -107
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -10
  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/StripeElementsForm/index.tsx +15 -7
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  181. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  182. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  183. package/themes/original/src/components/UserProfile/index.tsx +54 -29
  184. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  185. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  186. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  187. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  188. package/themes/original/src/components/Wallets/index.tsx +174 -162
  189. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  190. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  191. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  192. package/themes/original/src/components/shared/OButton.tsx +10 -3
  193. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  194. package/themes/original/src/components/shared/OInput.tsx +3 -2
  195. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  196. package/themes/original/src/types/index.tsx +121 -30
  197. package/themes/original/src/utils/index.tsx +77 -0
  198. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,38 +1,63 @@
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
+ ToastType,
9
+ useToast,
7
10
  SingleProductCard as SingleProductCardController
8
11
  } from 'ordering-components/native';
9
12
  import { useTheme } from 'styled-components/native';
10
13
  import { SingleProductCardParams } from '../../types';
11
- import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
12
- import { StyleSheet, View, TouchableOpacity } from 'react-native';
13
- import { OText, OIcon } from '../shared';
14
+ import { CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
15
+ import { StyleSheet, View } from 'react-native';
16
+ import { InView } from 'react-native-intersection-observer'
17
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
18
+ import { OButton, OIcon, OText } from '../shared';
14
19
  import FastImage from 'react-native-fast-image'
15
- import IconAntDesign from 'react-native-vector-icons/AntDesign'
16
20
  import { shape } from '../../utils';
21
+ import { LottieAnimation } from '../LottieAnimation';
22
+ import { CardAnimation } from '../shared/CardAnimation'
17
23
 
18
- const SinguleProductCardUI = (props: SingleProductCardParams) => {
24
+ function SingleProductCardPropsAreEqual(prevProps: any, nextProps: any) {
25
+ return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
26
+ prevProps.isSoldOut === nextProps.isSoldOut &&
27
+ prevProps.productAddedToCartLength === nextProps.productAddedToCartLength &&
28
+ prevProps.categoryState === nextProps.categoryState
29
+ }
30
+
31
+ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
19
32
  const {
20
33
  product,
21
34
  isSoldOut,
22
35
  onProductClick,
23
36
  productAddedToCartLength,
24
37
  style,
25
- handleFavoriteProduct
38
+ handleFavoriteProduct,
39
+ enableIntersection,
40
+ navigation,
41
+ businessId,
42
+ isPreviously
26
43
  } = props;
27
44
 
28
45
  const theme = useTheme();
46
+ const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
29
47
 
30
48
  const styles = StyleSheet.create({
31
49
  container: {
32
50
  borderWidth: 1,
33
- borderRadius: 7.6,
34
51
  borderColor: theme.colors.border,
35
- marginBottom: 28,
52
+ marginBottom: 25,
53
+ minHeight: hideAddButton ? 100 : 165,
54
+ flex: 1,
55
+ flexDirection: hideAddButton ? 'row' : 'column',
56
+ justifyContent: 'space-between',
57
+ alignItems: 'center',
58
+ padding: 12,
59
+ borderRadius: 10,
60
+ position: 'relative'
36
61
  },
37
62
  titleWrapper: {
38
63
  flexDirection: 'row',
@@ -58,8 +83,8 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
58
83
  },
59
84
  quantityContainer: {
60
85
  position: 'absolute',
61
- left: '100%',
62
- bottom: '100%',
86
+ right: 0,
87
+ top: 0,
63
88
  width: 25,
64
89
  height: 25,
65
90
  textAlign: 'center',
@@ -75,11 +100,13 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
75
100
  }
76
101
  });
77
102
 
78
-
79
103
  const [, t] = useLanguage();
80
104
  const [stateConfig] = useConfig();
81
- const [{ parsePrice, optimizeImage }] = useUtils();
82
- const [orderState] = useOrder();
105
+ const [{ auth }] = useSession()
106
+ const [{ parsePrice, optimizeImage, parseDate }] = useUtils();
107
+ const [orderState] = useOrder()
108
+ const [, { showToast }] = useToast()
109
+ const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
83
110
 
84
111
  const editMode = typeof product?.code !== 'undefined';
85
112
 
@@ -106,110 +133,183 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
106
133
  );
107
134
 
108
135
  const handleChangeFavorite = () => {
109
- handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
136
+ if (auth) {
137
+ handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
138
+ } else {
139
+ navigation && navigation.navigate('Login');
140
+ }
141
+ }
142
+
143
+ const handleChangeIntersection = () => {
144
+ if (enableIntersection) {
145
+ setIsIntersectionObserver(true);
146
+ }
147
+ }
148
+
149
+ const handleClickproduct = () => {
150
+ if (productAddedToCartLength && product?.maximum_per_order && productAddedToCartLength >= product?.maximum_per_order) {
151
+ showToast(ToastType.Error, t('PRODUCT_ON_MAXIMUM_ORDER', 'The product is on maximum order'))
152
+ return
153
+ }
154
+ onProductClick?.(product)
110
155
  }
111
156
 
112
157
  return (
113
- <CardContainer
114
- style={[
115
- styles.container,
116
- (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
117
- (style && { ...style }),
118
- ]}
119
- onPress={() => onProductClick?.(product)}>
120
- {productAddedToCartLength > 0 && (
121
- <QuantityContainer style={[styles.quantityContainer, {
122
- transform: [{ translateX: 10 }, { translateY: -10 }],
123
- }]}>
124
- <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
125
- </QuantityContainer>
126
- )}
127
- <CardInfo>
128
- <View style={styles.titleWrapper}>
129
- <OText
130
- size={12}
131
- weight={'500'}
132
- numberOfLines={1}
133
- ellipsizeMode="tail"
134
- style={styles.line18}>
135
- {product?.name}
136
- </OText>
137
- <TouchableOpacity
138
- onPress={handleChangeFavorite}
139
- >
140
- <IconAntDesign
141
- name={product?.favorite ? 'heart' : 'hearto'}
142
- color={theme.colors.danger5}
143
- size={18}
158
+ <InView style={{ minHeight: hideAddButton ? 125 : 190 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
159
+ {isIntersectionObserver ? (
160
+ <CardAnimation
161
+ onClick={() => handleClickproduct()}
162
+ style={[
163
+ styles.container,
164
+ (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
165
+ (style && { ...style })
166
+ ]}
167
+ >
168
+ <View style={{ flexDirection: 'row' }}>
169
+ {productAddedToCartLength > 0 && (
170
+ <QuantityContainer style={[styles.quantityContainer, {
171
+ transform: [{ translateX: 25 }, { translateY: hideAddButton ? -25 : -55 }],
172
+ }]}>
173
+ <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
174
+ </QuantityContainer>
175
+ )}
176
+ <CardInfo>
177
+ <View style={styles.titleWrapper}>
178
+ <OText
179
+ size={12}
180
+ weight={'500'}
181
+ numberOfLines={1}
182
+ ellipsizeMode="tail"
183
+ style={{ ...styles.line18, flex: 1 }}>
184
+ {product?.name}
185
+ </OText>
186
+ {!isPreviously && (
187
+ <LottieAnimation
188
+ type='favorite'
189
+ onClick={handleChangeFavorite}
190
+ initialValue={product?.favorite ? 0.75 : 0}
191
+ toValue={product?.favorite ? 0 : 0.75}
192
+ disableAnimation={!auth}
193
+ iconProps={{ color: theme.colors.danger5, size: 18 }}
194
+ isActive={product?.favorite}
195
+ />
196
+ )}
197
+ </View>
198
+ <PricesContainer>
199
+ {!!product?.price && (
200
+ <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
201
+ )}
202
+ {product?.offer_price !== null && !!product?.in_offer && (
203
+ <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
204
+ )}
205
+ </PricesContainer>
206
+ <OText
207
+ size={10}
208
+ numberOfLines={!isPreviously ? 2 : 1}
209
+ ellipsizeMode="tail"
210
+ color={theme.colors.textSecondary}
211
+ style={styles.line15}>
212
+ {product?.description}
213
+ </OText>
214
+ {isPreviously && (
215
+ <OText
216
+ size={10}
217
+ numberOfLines={1}
218
+ ellipsizeMode="tail"
219
+ color={theme.colors.primary}
220
+ style={styles.line15}>
221
+ {t('LAST_ORDERED_ON', 'Last ordered on')} {parseDate(product?.last_ordered_date, { outputFormat: 'MMM DD, YYYY' })}
222
+ </OText>
223
+ )}
224
+ </CardInfo>
225
+ <LogoWrapper>
226
+ {!!product?.ribbon?.enabled && (
227
+ <RibbonBox
228
+ bgColor={product?.ribbon?.color}
229
+ isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
230
+ isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
231
+ >
232
+ <OText
233
+ size={10}
234
+ weight={'400'}
235
+ color={theme.colors.white}
236
+ numberOfLines={2}
237
+ ellipsizeMode='tail'
238
+ lineHeight={13}
239
+ >
240
+ {product?.ribbon?.text}
241
+ </OText>
242
+ </RibbonBox>
243
+ )}
244
+ {product?.images ? (
245
+ <FastImage
246
+ style={styles.productStyle}
247
+ source={{
248
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
249
+ priority: FastImage.priority.normal,
250
+ }}
251
+ resizeMode={FastImage.resizeMode.cover}
252
+ />
253
+ ) : (
254
+ <OIcon
255
+ src={theme?.images?.dummies?.product}
256
+ style={styles.productStyle}
257
+ />
258
+ )}
259
+ </LogoWrapper>
260
+
261
+ {(isSoldOut || maxProductQuantity <= 0) && (
262
+ <SoldOut>
263
+ <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
264
+ {t('SOLD_OUT', 'SOLD OUT')}
265
+ </OText>
266
+ </SoldOut>
267
+ )}
268
+ </View>
269
+ {!hideAddButton && (
270
+ <OButton
271
+ onClick={() => handleClickproduct()}
272
+ style={{
273
+ width: '100%',
274
+ borderRadius: 7.6,
275
+ marginTop: 10,
276
+
277
+ }}
278
+ bgColor={isSoldOut ? '#B8B8B8' : theme?.colors?.white}
279
+ borderColor={theme?.colors.primary}
280
+ textStyle={{ color: theme.colors.primary }}
281
+ text={t('ADD', 'Add')}
144
282
  />
145
- </TouchableOpacity>
146
- </View>
147
- <PricesContainer>
148
- <OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
149
- {product?.offer_price !== null && product?.in_offer && (
150
- <OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
151
283
  )}
152
- </PricesContainer>
153
- <OText
154
- size={10}
155
- numberOfLines={2}
156
- ellipsizeMode="tail"
157
- color={theme.colors.textSecondary}
158
- style={styles.line15}>
159
- {product?.description}
160
- </OText>
161
- </CardInfo>
162
- <LogoWrapper>
163
- {product?.ribbon?.enabled && (
164
- <RibbonBox
165
- bgColor={product?.ribbon?.color}
166
- isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
167
- isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
168
- >
169
- <OText
170
- size={10}
171
- weight={'400'}
172
- color={theme.colors.white}
173
- numberOfLines={2}
174
- ellipsizeMode='tail'
175
- lineHeight={13}
176
- >
177
- {product?.ribbon?.text}
178
- </OText>
179
- </RibbonBox>
180
- )}
181
- {product?.images ? (
182
- <FastImage
183
- style={styles.productStyle}
184
- source={{
185
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
186
- priority: FastImage.priority.normal,
187
- }}
188
- resizeMode={FastImage.resizeMode.cover}
189
- />
190
- ) : (
191
- <OIcon
192
- src={theme?.images?.dummies?.product}
193
- style={styles.productStyle}
194
- />
195
- )}
196
- </LogoWrapper>
197
-
198
- {(isSoldOut || maxProductQuantity <= 0) && (
199
- <SoldOut>
200
- <OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
201
- {t('SOLD_OUT', 'SOLD OUT')}
202
- </OText>
203
- </SoldOut>
284
+ </CardAnimation>
285
+ ) : (
286
+ <View style={{ marginBottom: 28, padding: 12, height: hideAddButton ? 125 : 165 }}>
287
+ <Placeholder style={{ padding: 5 }} Animation={Fade}>
288
+ <View style={{ flexDirection: 'row' }}>
289
+ <Placeholder style={{ paddingVertical: 10, flex: 1 }}>
290
+ <PlaceholderLine width={60} style={{ marginBottom: 15 }} />
291
+ <PlaceholderLine width={20} />
292
+ </Placeholder>
293
+ <PlaceholderLine
294
+ width={24}
295
+ height={70}
296
+ style={{ marginLeft: 10, marginBottom: 10 }}
297
+ />
298
+ </View>
299
+ <PlaceholderLine
300
+ height={52}
301
+ />
302
+ </Placeholder>
303
+ </View>
204
304
  )}
205
- </CardContainer>
305
+ </InView>
206
306
  );
207
- };
307
+ }, SingleProductCardPropsAreEqual);
208
308
 
209
309
  export const SingleProductCard = (props: SingleProductCardParams) => {
210
310
  const singleProductCardProps = {
211
311
  ...props,
212
- UIComponent: SinguleProductCardUI
312
+ UIComponent: SingleProductCardUI
213
313
  }
214
314
  return <SingleProductCardController {...singleProductCardProps} />
215
315
  }
@@ -1,14 +1,5 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const CardContainer = styled.TouchableOpacity`
4
- flex: 1;
5
- flex-direction: row;
6
- justify-content: space-between;
7
- align-items: center;
8
- padding: 12px;
9
- border-radius: 10px;
10
- position: relative;
11
- `
12
3
  export const CardInfo = styled.View`
13
4
  padding-start: 3px;
14
5
  flex: 1;
@@ -23,7 +14,7 @@ export const SoldOut = styled.View`
23
14
  `
24
15
 
25
16
  export const QuantityContainer = styled.View`
26
- background: ${({ theme } : any) => theme.colors.primary};
17
+ background: ${({ theme }: any) => theme.colors.primary};
27
18
  align-items: center;
28
19
  justify-content: center;
29
20
  `
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useLanguage } from 'ordering-components/native'
3
- import { OText, OButton, OInput } from '../shared'
2
+ import { useLanguage, useUtils } from 'ordering-components/native'
3
+ import { OText, OButton, OInput, OIcon } from '../shared'
4
4
  import { StyleSheet, TouchableOpacity, View } from 'react-native'
5
5
  import AntDesignIcons from 'react-native-vector-icons/AntDesign'
6
6
  import { useTheme } from 'styled-components/native'
@@ -14,7 +14,9 @@ import {
14
14
  LikeHandsActionContainer,
15
15
  LikeHandsButton,
16
16
  CommentsButtonGroup,
17
+ LogoWrapper,
17
18
  } from './styles'
19
+ import FastImage from 'react-native-fast-image'
18
20
 
19
21
  export const SingleProductReview = (props: SingleProductReviewParams) => {
20
22
  const {
@@ -25,6 +27,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
25
27
 
26
28
  const [, t] = useLanguage()
27
29
  const theme = useTheme()
30
+ const [{ optimizeImage }] = useUtils()
28
31
 
29
32
  const styles = StyleSheet.create({
30
33
  inputTextArea: {
@@ -40,6 +43,12 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
40
43
  justifyContent: 'center',
41
44
  marginVertical: 10,
42
45
  },
46
+ productStyle: {
47
+ width: 80,
48
+ height: 80,
49
+ marginLeft: 'auto',
50
+ marginRight: 'auto'
51
+ }
43
52
  })
44
53
 
45
54
  const [comments, setComments] = useState<Array<any>>([])
@@ -55,6 +64,12 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
55
64
  return found
56
65
  }
57
66
 
67
+ const handleChangeQualification = (index: number) => {
68
+ if (qualification === index) return
69
+ setQualification(index)
70
+ setComments([])
71
+ }
72
+
58
73
  const handleChangeComment = (commentItem: any) => {
59
74
  const found = comments.find((comment: any) => comment?.key === commentItem.key)
60
75
  if (found) {
@@ -100,16 +115,34 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
100
115
  return (
101
116
  <>
102
117
  <ProductContainer>
118
+ <LogoWrapper>
119
+ {product?.images ? (
120
+ <FastImage
121
+ style={styles.productStyle}
122
+ source={{
123
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
124
+ priority: FastImage.priority.normal,
125
+ }}
126
+ resizeMode={FastImage.resizeMode.cover}
127
+ />
128
+ ) : (
129
+ <OIcon
130
+ src={theme?.images?.dummies?.product}
131
+ width={80}
132
+ height={80}
133
+ />
134
+ )}
135
+ </LogoWrapper>
103
136
  <ProductHeader>
104
137
  <OText numberOfLines={1} style={{ flex: 1 }} color={theme.colors.textNormal}>{product?.name}</OText>
105
138
  <LikeHandsActionContainer>
106
139
  <LikeHandsButton
107
140
  isLike
108
- onPress={() => setQualification(5)}
141
+ onPress={() => handleChangeQualification(5)}
109
142
  >
110
143
  <AntDesignIcons name='like2' size={20} color={qualification === 5 ? theme.colors.primary : theme.colors.lightGray} />
111
144
  </LikeHandsButton>
112
- <LikeHandsButton onPress={() => setQualification(1)}>
145
+ <LikeHandsButton onPress={() => handleChangeQualification(1)}>
113
146
  <AntDesignIcons name='dislike2' size={20} color={qualification === 1 ? theme.colors.primary : theme.colors.lightGray} />
114
147
  </LikeHandsButton>
115
148
  </LikeHandsActionContainer>
@@ -129,7 +162,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
129
162
  style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
130
163
  imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
131
164
  imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
132
- onClick={() => handleChangeComment(commentItem) }
165
+ onClick={() => handleChangeComment(commentItem)}
133
166
  />
134
167
  ))}
135
168
  </CommentsButtonGroup>
@@ -15,6 +15,18 @@ export const LikeHandsActionContainer = styled.View`
15
15
  flex-direction: row;
16
16
  `
17
17
 
18
+ export const LogoWrapper = styled.View`
19
+ shadowRadius: 3;
20
+ shadowOffset: { width: 1, height: 4 };
21
+ elevation: 3;
22
+ borderRadius: 8;
23
+ shadowOpacity: 0.1;
24
+ overflow: hidden;
25
+ width: 80;
26
+ marginLeft: auto;
27
+ marginRight: auto;
28
+ `
29
+
18
30
  export const LikeHandsButton = styled.TouchableOpacity`
19
31
  ${(props: any) => props.isLike && css`
20
32
  margin-horizontal: 15px;
@@ -61,17 +61,25 @@ const StripeElementsFormUI = (props: any) => {
61
61
  }
62
62
 
63
63
  if (user?.address) {
64
- billingDetails.addressLine1 = user?.address
64
+ billingDetails.address = {
65
+ line1: user?.address
66
+ }
65
67
  }
66
68
 
67
69
  const createPayMethod = async () => {
68
- const params: any = { type: 'Card' }
70
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
69
71
  if (Object.keys(billingDetails).length > 0) {
70
- params.billingDetails = billingDetails
72
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
71
73
  }
72
74
  try {
73
75
  setCreatePmLoading(true)
74
- 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
+ }
75
83
 
76
84
  setCreatePmLoading(false)
77
85
  handleSource && handleSource({
@@ -94,16 +102,16 @@ const StripeElementsFormUI = (props: any) => {
94
102
  setErrors(error?.message || error?.toString());
95
103
  }
96
104
  }
97
-
105
+
98
106
  const handleSaveCard = async () => {
99
107
  setErrors('');
100
108
  if (!requirements) {
101
109
  createPayMethod();
102
110
  return
103
111
  }
104
- const params: any = { type: 'Card' }
112
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
105
113
  if (Object.keys(billingDetails).length > 0) {
106
- params.billingDetails = billingDetails
114
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
107
115
  }
108
116
  try {
109
117
  const { setupIntent, error } = await confirmSetupIntent(requirements, params);
@@ -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 {
@@ -71,9 +72,15 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
71
72
  },
72
73
  btnBackArrow: {
73
74
  borderWidth: 0,
75
+ width: 26,
76
+ height: 26,
74
77
  backgroundColor: theme.colors.clear,
78
+ borderColor: theme.colors.clear,
75
79
  shadowColor: theme.colors.clear,
76
- padding: 40,
80
+ paddingLeft: 0,
81
+ paddingRight: 0,
82
+ marginLeft: 20,
83
+ marginBottom: 10
77
84
  },
78
85
  })
79
86
 
@@ -139,7 +146,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
139
146
  </AddButton>
140
147
  </View>
141
148
  <View>
142
- <OIcon url={product.images} style={styles.imageStyle} />
149
+ <OIcon url={product?.images || theme?.images?.dummies?.product} style={styles.imageStyle} />
143
150
  </View>
144
151
  </Item>
145
152
  )) : (
@@ -161,11 +168,14 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
161
168
  <>
162
169
  <View style={{ ...styles.headerItem, flex: 1, marginTop: Platform.OS == 'ios' ? 35 : 70 }}>
163
170
  <OButton
164
- imgLeftSrc={theme.images.general.arrow_left}
165
171
  imgRightSrc={null}
166
172
  style={styles.btnBackArrow}
167
173
  onClick={() => onGoBack()}
168
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
174
+ icon={AntDesignIcon}
175
+ iconProps={{
176
+ name: 'arrowleft',
177
+ size: 26
178
+ }}
169
179
  />
170
180
  </View>
171
181
  <ScrollView style={{ marginTop: 10, marginBottom: props.isPage ? 40 : bottom + (Platform.OS == 'ios' ? 96 : 130) }} showsVerticalScrollIndicator={false}>