ordering-ui-react-native 0.16.62 → 0.16.63-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 (207) hide show
  1. package/package.json +6 -5
  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/BusinessInformation/index.tsx +19 -4
  6. package/src/components/BusinessInformation/styles.tsx +2 -2
  7. package/src/components/BusinessProductsList/index.tsx +10 -10
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +2 -1
  10. package/src/components/LanguageSelector/index.tsx +21 -16
  11. package/src/components/Messages/index.tsx +2 -2
  12. package/src/components/NotificationSetting/index.tsx +85 -0
  13. package/src/components/OrdersOption/index.tsx +54 -56
  14. package/src/components/PaymentOptions/index.tsx +298 -345
  15. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  16. package/src/components/SingleProductReview/index.tsx +7 -4
  17. package/src/components/StripeElementsForm/index.tsx +25 -16
  18. package/src/components/VerifyPhone/styles.tsx +1 -2
  19. package/src/components/shared/OBottomPopup.tsx +6 -2
  20. package/src/components/shared/OToast.tsx +4 -4
  21. package/src/index.tsx +2 -0
  22. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  23. package/src/utils/index.tsx +2 -1
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  26. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  27. package/themes/business/src/components/Chat/index.tsx +40 -32
  28. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  29. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  30. package/themes/business/src/components/MapView/index.tsx +12 -1
  31. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  32. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  35. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  36. package/themes/business/src/components/OrdersOption/index.tsx +76 -77
  37. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  38. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  41. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  45. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  46. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  48. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  51. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  52. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  53. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  54. package/themes/business/src/components/shared/OLink.tsx +33 -13
  55. package/themes/business/src/components/shared/OText.tsx +8 -2
  56. package/themes/business/src/types/index.tsx +24 -11
  57. package/themes/business/src/utils/index.tsx +10 -0
  58. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  60. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  62. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  63. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  64. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  65. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  66. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  67. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  68. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  69. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +8 -0
  72. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  73. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  74. package/themes/original/src/components/AddressList/index.tsx +18 -18
  75. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  76. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  77. package/themes/original/src/components/BusinessBasicInformation/index.tsx +53 -37
  78. package/themes/original/src/components/BusinessController/index.tsx +106 -48
  79. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  80. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  81. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  82. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  83. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  84. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  85. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  86. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  87. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  88. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  89. package/themes/original/src/components/BusinessProductsList/index.tsx +55 -61
  90. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  91. package/themes/original/src/components/BusinessProductsListing/index.tsx +175 -94
  92. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  93. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -103
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  97. package/themes/original/src/components/BusinessesListing/index.tsx +14 -8
  98. package/themes/original/src/components/Cart/index.tsx +77 -24
  99. package/themes/original/src/components/Cart/styles.tsx +4 -0
  100. package/themes/original/src/components/CartContent/index.tsx +77 -18
  101. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  102. package/themes/original/src/components/Checkout/index.tsx +110 -114
  103. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  104. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  106. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  107. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  108. package/themes/original/src/components/Favorite/index.tsx +7 -4
  109. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  110. package/themes/original/src/components/FavoriteList/index.tsx +69 -45
  111. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  112. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  113. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  114. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  115. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  116. package/themes/original/src/components/Help/index.tsx +7 -7
  117. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  118. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  119. package/themes/original/src/components/HelpGuide/index.tsx +12 -11
  120. package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
  121. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  122. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  123. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  124. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  125. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  126. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  127. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  128. package/themes/original/src/components/MessageListing/index.tsx +7 -7
  129. package/themes/original/src/components/Messages/index.tsx +35 -20
  130. package/themes/original/src/components/MomentOption/index.tsx +17 -11
  131. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  133. package/themes/original/src/components/MultiCheckout/index.tsx +96 -76
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +34 -16
  135. package/themes/original/src/components/MyOrders/index.tsx +89 -25
  136. package/themes/original/src/components/NavBar/index.tsx +7 -6
  137. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  138. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  139. package/themes/original/src/components/Notifications/index.tsx +144 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  141. package/themes/original/src/components/OrderDetails/index.tsx +114 -15
  142. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  143. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  144. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  145. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  146. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  149. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  150. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  151. package/themes/original/src/components/OrdersOption/index.tsx +97 -55
  152. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  153. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  154. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  156. package/themes/original/src/components/PlaceSpot/index.tsx +249 -47
  157. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  158. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  159. package/themes/original/src/components/ProductForm/index.tsx +226 -257
  160. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
  163. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +0 -1
  164. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  165. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  166. package/themes/original/src/components/Promotions/index.tsx +234 -220
  167. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  168. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  169. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  170. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  171. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  172. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  173. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  174. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  175. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  176. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  177. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  178. package/themes/original/src/components/SingleOrderCard/index.tsx +129 -54
  179. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  180. package/themes/original/src/components/SingleProductCard/index.tsx +106 -69
  181. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  182. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  183. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  184. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  185. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  186. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  187. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  188. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  189. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  190. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  191. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  192. package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
  193. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  194. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  195. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  196. package/themes/original/src/components/Wallets/index.tsx +176 -164
  197. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  198. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  199. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  200. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  201. package/themes/original/src/components/shared/OButton.tsx +9 -4
  202. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  203. package/themes/original/src/components/shared/OInput.tsx +10 -1
  204. package/themes/original/src/layouts/Container.tsx +13 -9
  205. package/themes/original/src/types/index.tsx +55 -5
  206. package/themes/original/src/utils/index.tsx +103 -58
  207. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,4 +1,17 @@
1
- import React, { useEffect, useRef, useCallback } from 'react';
1
+ import React, { useEffect, useRef, useState, useCallback } from 'react';
2
+ import {
3
+ View,
4
+ Keyboard,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ Dimensions,
9
+ I18nManager,
10
+ SafeAreaView,
11
+ Platform,
12
+ Button,
13
+ Vibration
14
+ } from 'react-native';
2
15
  import {
3
16
  ProductForm as ProductOptions,
4
17
  useSession,
@@ -15,17 +28,10 @@ import Swiper from 'react-native-swiper'
15
28
  import FastImage from 'react-native-fast-image';
16
29
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
17
30
  import YoutubePlayer from "react-native-youtube-iframe"
18
- import { TextInput } from 'react-native'
19
- import {
20
- Grayscale
21
- } from 'react-native-color-matrix-image-filters'
22
-
23
- import { View, TouchableOpacity, StyleSheet, Dimensions, I18nManager, SafeAreaView, Platform, Button } from 'react-native';
24
31
 
25
32
  import {
26
33
  WrapHeader,
27
34
  TopHeader,
28
- WrapContent,
29
35
  ProductTitle,
30
36
  ProductDescription,
31
37
  ProductEditions,
@@ -45,8 +51,7 @@ import { ScrollView } from 'react-native-gesture-handler';
45
51
  import { ProductOptionSubOption } from '../ProductOptionSubOption';
46
52
  import { NotFoundSource } from '../NotFoundSource';
47
53
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
48
- import { useState } from 'react';
49
- const windowHeight = Dimensions.get('window').height;
54
+ import NavBar from '../NavBar';
50
55
  const windowWidth = Dimensions.get('window').width;
51
56
 
52
57
  export const ProductOptionsUI = (props: any) => {
@@ -66,11 +71,14 @@ export const ProductOptionsUI = (props: any) => {
66
71
  handleChangeSuboptionState,
67
72
  handleChangeCommentState,
68
73
  productObject,
74
+ productAddedToCartLength
69
75
  } = props;
70
76
 
71
77
  const theme = useTheme();
72
78
  const [, { showToast }] = useToast()
73
79
 
80
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
81
+
74
82
  const styles = StyleSheet.create({
75
83
  mainContainer: {
76
84
 
@@ -122,6 +130,7 @@ export const ProductOptionsUI = (props: any) => {
122
130
  },
123
131
  slide1: {
124
132
  flex: 1,
133
+ alignItems: 'center'
125
134
  },
126
135
  mainSwiper: {
127
136
  height: 258,
@@ -158,6 +167,10 @@ export const ProductOptionsUI = (props: any) => {
158
167
  justifyContent: 'space-between',
159
168
  width: '100%',
160
169
  marginTop: 10
170
+ },
171
+ wrapperNavbar: {
172
+ paddingHorizontal: 40,
173
+ paddingTop: 0,
161
174
  }
162
175
  });
163
176
 
@@ -169,7 +182,7 @@ export const ProductOptionsUI = (props: any) => {
169
182
  const [gallery, setGallery] = useState([])
170
183
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
171
184
  const [indexGallery, setIndexGallery] = useState(0)
172
- const [selOpt, setSelectedOpt] = useState(0);
185
+ const [selOpt, setSelectedOpt] = useState(-1);
173
186
  const [isHaveWeight, setIsHaveWeight] = useState(false)
174
187
  const [playing, setPlaying] = useState(false);
175
188
  const [qtyBy, setQtyBy] = useState({
@@ -183,6 +196,7 @@ export const ProductOptionsUI = (props: any) => {
183
196
  const [headerRefHeight, setHeaderRefHeight] = useState(0)
184
197
  const [summaryRefHeight, setSummaryRefHeight] = useState(0)
185
198
  const [isScrollAvailable, setIsScrollAvailable] = useState(null)
199
+ const [editionsLayoutY, setEditionsLayoutY] = useState(null)
186
200
 
187
201
  const isError = (id: number) => {
188
202
  let bgColor = theme.colors.white;
@@ -199,11 +213,12 @@ export const ProductOptionsUI = (props: any) => {
199
213
  };
200
214
 
201
215
  const handleSaveProduct = () => {
216
+ Vibration.vibrate()
202
217
  if (!productCart.quantity) {
203
218
  showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
204
219
  return
205
220
  }
206
- const isErrors = Object.values(errors).length > 0;
221
+ const isErrors = Object.values(errors)?.length > 0;
207
222
  if (!isErrors) {
208
223
  handleSave && handleSave();
209
224
  return;
@@ -222,7 +237,7 @@ export const ProductOptionsUI = (props: any) => {
222
237
  };
223
238
 
224
239
  const handleChangeMainIndex = (index: number) => {
225
- if (index < 0 || index > gallery.length - 1) {
240
+ if (index < 0 || index > gallery?.length - 1) {
226
241
  setThumbsSwiper(0)
227
242
  return
228
243
  }
@@ -265,7 +280,7 @@ export const ProductOptionsUI = (props: any) => {
265
280
  }
266
281
 
267
282
  const scrollDown = (id: any) => {
268
- const isErrors = Object.values(errors).length > 0
283
+ const isErrors = Object.values(errors)?.length > 0
269
284
  if (!isErrors) {
270
285
  return
271
286
  }
@@ -289,7 +304,8 @@ export const ProductOptionsUI = (props: any) => {
289
304
  const saveErrors =
290
305
  orderState.loading ||
291
306
  maxProductQuantity === 0 ||
292
- Object.keys(errors).length > 0;
307
+ Object.keys(errors)?.length > 0;
308
+
293
309
 
294
310
  const ExtraOptions = ({ eID, options }: any) => (
295
311
  <>
@@ -298,19 +314,25 @@ export const ProductOptionsUI = (props: any) => {
298
314
  {respect_to == null && suboptions?.length > 0 && (
299
315
  <TouchableOpacity
300
316
  key={`eopt_key_${id}`}
301
- onPress={() => setSelectedOpt(id)}
317
+ onPress={() => {
318
+ setSelectedOpt(id)
319
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
320
+ y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
321
+ animated: true
322
+ })
323
+ }}
302
324
  style={[
303
325
  styles.extraItem,
304
326
  {
305
327
  borderBottomColor:
306
- selOpt == id ? theme.colors.textNormal : theme.colors.border,
328
+ selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
307
329
  },
308
330
  ]}>
309
331
  <OText
310
332
  color={
311
333
  selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
312
334
  }
313
- size={selOpt == id ? 14 : 12}
335
+ size={12}
314
336
  weight={selOpt == id ? '600' : 'normal'}
315
337
  style={{ maxWidth: 150 }}
316
338
  numberOfLines={1}>
@@ -323,6 +345,14 @@ export const ProductOptionsUI = (props: any) => {
323
345
  </>
324
346
  );
325
347
 
348
+ const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
349
+
350
+ const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
351
+ if (_topOption) {
352
+ const _topOptionId = Number(_topOption.replace('id:', ''))
353
+ }
354
+ }
355
+
326
356
  const handleGoBack = navigation?.canGoBack()
327
357
  ? () => navigation.goBack()
328
358
  : () => navigation.navigate('Business', { store: props.businessSlug })
@@ -337,15 +367,18 @@ export const ProductOptionsUI = (props: any) => {
337
367
  useEffect(() => {
338
368
  const imageList: any = []
339
369
  const videoList: any = []
340
- product?.images && imageList.push(product.images)
341
- if (product?.gallery && product?.gallery.length > 0) {
370
+ imageList.push(product?.images?.length > 0
371
+ ? product.images
372
+ : theme?.images?.dummies?.product)
373
+
374
+ if (product?.gallery && product?.gallery?.length > 0) {
342
375
  for (const img of product?.gallery) {
343
376
  if (img?.file) {
344
377
  imageList.push(img?.file)
345
378
  }
346
379
  if (img?.video) {
347
380
  const keys = img?.video.split('/')
348
- let _videoId = keys[keys.length - 1]
381
+ let _videoId = keys[keys?.length - 1]
349
382
 
350
383
  if (_videoId.includes('watch')) {
351
384
  const __url = _videoId.split('=')[1]
@@ -360,7 +393,7 @@ export const ProductOptionsUI = (props: any) => {
360
393
  } else if (_videoId.search(/\?/i) >= 0) {
361
394
  _videoId = _videoId.split('?')[0]
362
395
  }
363
- if ((_videoId.length === 11)) {
396
+ if ((_videoId?.length === 11)) {
364
397
  videoList.push(_videoId)
365
398
  }
366
399
  }
@@ -395,20 +428,20 @@ export const ProductOptionsUI = (props: any) => {
395
428
  ? t('UPDATE', 'Update')
396
429
  : t('ADD', 'Add')
397
430
  }`}
398
- isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
431
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
399
432
  textStyle={{
400
433
  color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
401
434
  fontSize: orderState.loading || editMode ? 10 : 14
402
435
  }}
403
436
  style={{
404
- backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
405
- borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
437
+ backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
438
+ borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
406
439
  opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
407
440
  borderRadius: 7.6,
408
441
  height: 44,
409
442
  shadowOpacity: 0,
410
443
  borderWidth: 1,
411
- marginTop: isHaveWeight ? 10: 0
444
+ marginTop: isHaveWeight ? 10 : 0
412
445
  }}
413
446
  />
414
447
  )}
@@ -446,18 +479,32 @@ export const ProductOptionsUI = (props: any) => {
446
479
  )
447
480
  }
448
481
 
482
+ useEffect(() => {
483
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
484
+ scrollViewRef.current.scrollToEnd({ animated: true })
485
+ })
486
+ return () => {
487
+ keyboardDidShowListener.remove()
488
+ }
489
+ }, [])
490
+
449
491
  return (
450
492
  <SafeAreaView style={{ flex: 1 }}>
451
- <TopHeader>
452
- <TopActions onPress={() => handleGoBack()}>
453
- <OIcon src={theme.images.general.arrow_left} width={30} />
454
- </TopActions>
455
- </TopHeader>
493
+ <View style={styles.wrapperNavbar}>
494
+ <NavBar
495
+ onActionLeft={() => handleGoBack()}
496
+ showCall={false}
497
+ btnStyle={{ paddingLeft: 0 }}
498
+ paddingTop={4}
499
+ />
500
+ </View>
456
501
  {!error && (
457
502
  <ScrollView
458
503
  ref={scrollViewRef}
459
504
  contentContainerStyle={{ paddingBottom: 80 }}
460
- stickyHeaderIndices={[2]}>
505
+ stickyHeaderIndices={[2]}
506
+ onScroll={handleScroll}
507
+ >
461
508
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
462
509
  {loading && !product ? (
463
510
  <View style={styles.productHeaderSkeleton}>
@@ -499,23 +546,24 @@ export const ProductOptionsUI = (props: any) => {
499
546
  </View>
500
547
  }
501
548
  >
502
- {gallery && gallery.length > 0 && gallery.map((img, i) => (
549
+ {gallery && gallery?.length > 0 && gallery.map((img, i) => (
503
550
  <View
504
551
  style={styles.slide1}
505
552
  key={i}
506
553
  >
507
- {img.includes('image') ? (
554
+ {(String(img).includes('http') || typeof img === 'number') ? (
508
555
  <FastImage
509
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
510
- source={{
556
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
557
+ source={typeof img !== 'number' ? {
511
558
  uri: optimizeImage(img, 'h_1024,c_limit'),
512
559
  priority: FastImage.priority.normal,
513
- }}
560
+ } : img}
514
561
  />
515
562
  ) : (
516
563
  <>
517
564
  <YoutubePlayer
518
- height={300}
565
+ height={'100%'}
566
+ width={'100%'}
519
567
  play={playing}
520
568
  videoId={img}
521
569
  onChangeState={onStateChange}
@@ -533,7 +581,7 @@ export const ProductOptionsUI = (props: any) => {
533
581
  paddingVertical: 15
534
582
  }}
535
583
  >
536
- {gallery.length > 0 && gallery.map((img, index) => (
584
+ {gallery?.length > 1 && gallery.map((img, index) => (
537
585
  <TouchableOpacity
538
586
  key={index}
539
587
  onPress={() => handleClickThumb(index)}
@@ -546,7 +594,7 @@ export const ProductOptionsUI = (props: any) => {
546
594
  opacity: index === thumbsSwiper ? 1 : 0.8
547
595
  }}
548
596
  >
549
- {img.includes('image') ? (
597
+ {String(img).includes('http') ? (
550
598
  <OIcon
551
599
  url={img}
552
600
  style={{
@@ -561,7 +609,7 @@ export const ProductOptionsUI = (props: any) => {
561
609
  />
562
610
  ) : (
563
611
  <OIcon
564
- url={'http://img.youtube.com/vi/' + img + '/0.jpg'}
612
+ url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
565
613
  style={{
566
614
  borderColor: theme.colors.lightGray,
567
615
  borderRadius: 8,
@@ -581,7 +629,10 @@ export const ProductOptionsUI = (props: any) => {
581
629
  </>
582
630
  )}
583
631
  </WrapHeader>
584
- <ProductSummary onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}>
632
+ <ProductSummary
633
+ ph={isChewLayout ? 20 : 40}
634
+ onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
635
+ >
585
636
  <ProductTitle>
586
637
  {loading && !product ? (
587
638
  <Placeholder Animation={Fade}>
@@ -677,45 +728,40 @@ export const ProductOptionsUI = (props: any) => {
677
728
  <ExtraOptionWrap
678
729
  horizontal
679
730
  showsHorizontalScrollIndicator={false}
680
- style={{ marginBottom: 20 }}
681
- contentContainerStyle={{ paddingHorizontal: 33, backgroundColor: theme.colors.white }}
731
+ style={{
732
+ marginBottom: 20,
733
+ borderBottomWidth: 1,
734
+ borderBottomColor: theme.colors.border,
735
+ marginHorizontal: isChewLayout ? 20 : 30,
736
+ backgroundColor: theme.colors.backgroundPage,
737
+ }}
682
738
  >
683
- <TouchableOpacity
684
- key={`eopt_all_0`}
685
- onPress={() => setSelectedOpt(0)}
686
- style={[
687
- styles.extraItem,
688
- {
689
- borderBottomColor: selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
690
- },
691
- ]}>
692
- <OText
693
- color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
694
- size={selOpt == 0 ? 14 : 12}
695
- weight={selOpt == 0 ? '600' : 'normal'}>
696
- {t('ALL', 'All')}
697
- </OText>
698
- </TouchableOpacity>
699
- {product?.ingredients.length > 0 && (
739
+ {product?.ingredients?.length > 0 && (
700
740
  <TouchableOpacity
701
- key={`eopt_all_00`}
702
- onPress={() => setSelectedOpt(-1)}
741
+ key={`eopt_key_01`}
742
+ onPress={() => {
743
+ setSelectedOpt(0)
744
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
745
+ y: optionLayout[`id:0`]?.y + editionsLayoutY - 50,
746
+ animated: true
747
+ })
748
+ }}
703
749
  style={[
704
750
  styles.extraItem,
705
751
  {
706
752
  borderBottomColor:
707
- selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
753
+ selOpt == 0 ? theme.colors.textNormal : theme.colors.backgroundPage,
708
754
  },
709
755
  ]}>
710
756
  <OText
711
- color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
712
- size={selOpt == -1 ? 14 : 12}
713
- weight={selOpt == -1 ? '600' : 'normal'}>
757
+ color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
758
+ size={12}
759
+ weight={selOpt == 0 ? '600' : 'normal'}>
714
760
  {t('INGREDIENTS', 'Ingredients')}
715
761
  </OText>
716
762
  </TouchableOpacity>
717
763
  )}
718
- {product?.extras.map((extra: any) =>
764
+ {product?.extras?.map((extra: any) =>
719
765
  <ExtraOptions key={extra.id} options={extra.options} />
720
766
  )}
721
767
  </ExtraOptionWrap>
@@ -759,184 +805,94 @@ export const ProductOptionsUI = (props: any) => {
759
805
  ))}
760
806
  </>
761
807
  ) : (
762
- <ProductEditions>
763
- {selOpt == 0 ? (
764
- <>
765
- {product?.ingredients.length > 0 && (
766
- <View style={styles.optionContainer}>
767
- <SectionTitle>
768
- <OText size={16}>
769
- {t('INGREDIENTS', 'Ingredients')}
770
- </OText>
771
- </SectionTitle>
772
- <WrapperIngredients>
773
- {product?.ingredients.map((ingredient: any) => (
774
- <ProductIngredient
775
- key={ingredient.id}
776
- ingredient={ingredient}
777
- state={
778
- productCart.ingredients[`id:${ingredient.id}`]
779
- }
780
- onChange={handleChangeIngredientState}
781
- isSoldOut={isSoldOut}
782
- />
783
- ))}
784
- </WrapperIngredients>
785
- </View>
786
- )}
787
- {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
788
- extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
789
- const currentState =
790
- productCart.options[`id:${option.id}`] || {};
791
- return (
792
- <React.Fragment key={`popt_${option.id}`}>
793
- {showOption(option) && (
794
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
795
- <ProductOption
796
- option={option}
797
- currentState={currentState}
798
- error={errors[`id:${option.id}`]}>
799
- <WrapperSubOption
800
- style={{
801
- backgroundColor: isError(option.id),
802
- borderRadius: 7.6
803
- }}>
804
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
805
- (suboption: any) => {
806
- const currentState =
807
- productCart.options[
808
- `id:${option.id}`
809
- ]?.suboptions[
810
- `id:${suboption.id}`
811
- ] || {};
812
- const balance =
813
- productCart.options[
814
- `id:${option.id}`
815
- ]?.balance || 0;
816
- return (
817
- <ProductOptionSubOption
818
- key={suboption.id}
819
- isSoldOut={isSoldOut}
820
- onChange={
821
- handleChangeSuboptionState
822
- }
823
- balance={balance}
824
- option={option}
825
- suboption={suboption}
826
- state={currentState}
827
- disabled={
828
- isSoldOut ||
829
- maxProductQuantity <= 0
830
- }
831
- setIsScrollAvailable={setIsScrollAvailable}
832
- error={errors[`id:${option.id}`]}
833
- />
834
- );
835
- },
836
- )}
837
- </WrapperSubOption>
838
- </ProductOption>
839
- </View>
840
- )}
841
- </React.Fragment>
842
- );
843
- }),
844
- )}
845
- </>
846
- ) : (
847
- <>
848
- {selOpt == -1 ? (
849
- <View style={styles.optionContainer}>
850
- <SectionTitle>
851
- <OText size={16}>
852
- {t('INGREDIENTS', 'Ingredients')}
853
- </OText>
854
- </SectionTitle>
855
- <WrapperIngredients>
856
- {product?.ingredients.map((ingredient: any) => (
857
- <ProductIngredient
858
- key={ingredient.id}
859
- ingredient={ingredient}
860
- state={
861
- productCart.ingredients[`id:${ingredient.id}`]
862
- }
863
- onChange={handleChangeIngredientState}
864
- isSoldOut={isSoldOut}
865
- />
866
- ))}
867
- </WrapperIngredients>
868
- </View>
869
- ) : (
870
- <>
871
- {product?.extras.map((extra: any) =>
872
- extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
873
- if (
874
- option.id == selOpt ||
875
- (hasRespected(
876
- extra.options,
877
- option.respect_to,
878
- ) &&
879
- showOption(option))
880
- ) {
881
- const currentState =
882
- productCart.options[`id:${option.id}`] || {};
883
- return (
884
- <React.Fragment key={option.id}>
885
- {showOption(option) && (
886
- <View style={styles.optionContainer}>
887
- <ProductOption
888
- option={option}
889
- currentState={currentState}
890
- error={errors[`id:${option.id}`]}>
891
- <WrapperSubOption
892
- style={{
893
- backgroundColor: isError(
894
- option.id,
895
- ),
896
- }}>
897
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
898
- (suboption: any) => {
899
- const currentState =
900
- productCart.options[
901
- `id:${option.id}`
902
- ]?.suboptions[
903
- `id:${suboption.id}`
904
- ] || {};
905
- const balance =
906
- productCart.options[
907
- `id:${option.id}`
908
- ]?.balance || 0;
909
- return (
910
- <ProductOptionSubOption
911
- key={suboption.id}
912
- onChange={
913
- handleChangeSuboptionState
914
- }
915
- balance={balance}
916
- option={option}
917
- suboption={suboption}
918
- state={currentState}
919
- disabled={
920
- isSoldOut ||
921
- maxProductQuantity <= 0
922
- }
923
- />
924
- );
925
- },
926
- )}
927
- </WrapperSubOption>
928
- </ProductOption>
929
- </View>
930
- )}
931
- </React.Fragment>
932
- );
808
+ <ProductEditions
809
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
810
+ onLayout={(event: any) => {
811
+ setEditionsLayoutY(event.nativeEvent.layout?.y)
812
+ }}
813
+ >
814
+ <>
815
+ {product?.ingredients?.length > 0 && (
816
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
817
+ <SectionTitle>
818
+ <OText size={16}>
819
+ {t('INGREDIENTS', 'Ingredients')}
820
+ </OText>
821
+ </SectionTitle>
822
+ <WrapperIngredients>
823
+ {product?.ingredients.map((ingredient: any) => (
824
+ <ProductIngredient
825
+ key={ingredient.id}
826
+ ingredient={ingredient}
827
+ state={
828
+ productCart.ingredients[`id:${ingredient.id}`]
933
829
  }
934
- }),
935
- )}
936
- </>
937
- )}
938
- </>
939
- )}
830
+ onChange={handleChangeIngredientState}
831
+ isSoldOut={isSoldOut}
832
+ />
833
+ ))}
834
+ </WrapperIngredients>
835
+ </View>
836
+ )}
837
+ {product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
838
+ extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
839
+ const currentState =
840
+ productCart.options[`id:${option.id}`] || {};
841
+ return (
842
+ <React.Fragment key={`popt_${option.id}`}>
843
+ {showOption(option) && (
844
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
845
+ <ProductOption
846
+ option={option}
847
+ currentState={currentState}
848
+ error={errors[`id:${option.id}`]}>
849
+ <WrapperSubOption
850
+ style={{
851
+ backgroundColor: isError(option.id),
852
+ borderRadius: 7.6
853
+ }}>
854
+ {option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
855
+ (suboption: any) => {
856
+ const currentState =
857
+ productCart.options[
858
+ `id:${option.id}`
859
+ ]?.suboptions[
860
+ `id:${suboption.id}`
861
+ ] || {};
862
+ const balance =
863
+ productCart.options[
864
+ `id:${option.id}`
865
+ ]?.balance || 0;
866
+ return (
867
+ <ProductOptionSubOption
868
+ key={suboption.id}
869
+ isSoldOut={isSoldOut}
870
+ onChange={
871
+ handleChangeSuboptionState
872
+ }
873
+ balance={balance}
874
+ option={option}
875
+ suboption={suboption}
876
+ state={currentState}
877
+ disabled={
878
+ isSoldOut ||
879
+ maxProductQuantity <= 0
880
+ }
881
+ setIsScrollAvailable={setIsScrollAvailable}
882
+ error={errors[`id:${option.id}`]}
883
+ />
884
+ );
885
+ },
886
+ )}
887
+ </WrapperSubOption>
888
+ </ProductOption>
889
+ </View>
890
+ )}
891
+ </React.Fragment>
892
+ );
893
+ }),
894
+ )}
895
+ </>
940
896
  {!product?.hide_special_instructions && (
941
897
  <ProductComment>
942
898
  <SectionTitle>
@@ -960,7 +916,7 @@ export const ProductOptionsUI = (props: any) => {
960
916
  )}
961
917
  </ProductEditions>
962
918
  )}
963
- {!!error && error.length > 0 && (
919
+ {!!error && error?.length > 0 && (
964
920
  <NotFoundSource content={error[0]?.message || error[0]} />
965
921
  )}
966
922
  </ScrollView>
@@ -972,18 +928,18 @@ export const ProductOptionsUI = (props: any) => {
972
928
  <OText size={16} lineHeight={24} weight={'600'}>
973
929
  {productCart.total ? parsePrice(productCart?.total) : ''}
974
930
  </OText>
975
- {product?.minimum_per_order && productCart?.quantity < product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
976
- {product?.maximum_per_order && productCart?.quantity > product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
931
+ {product?.minimum_per_order && (productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order && productCart?.quantity !== 1 && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
932
+ {product?.maximum_per_order && (productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
977
933
  </View>
978
934
  {productCart && !isSoldOut && maxProductQuantity > 0 && (
979
935
  <>
980
936
  <View style={styles.quantityControl}>
981
937
  <TouchableOpacity
982
938
  onPress={decrement}
983
- disabled={productCart.quantity === 1 || isSoldOut}>
939
+ disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || ((productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order)}>
984
940
  <OIcon
985
941
  src={theme.images.general.minus}
986
- width={16}
942
+ width={20}
987
943
  color={
988
944
  productCart.quantity === 1 || isSoldOut
989
945
  ? theme.colors.backgroundGray
@@ -1004,7 +960,8 @@ export const ProductOptionsUI = (props: any) => {
1004
960
  borderRadius: 8,
1005
961
  borderColor: theme.colors.inputBorderColor,
1006
962
  height: 44,
1007
- marginHorizontal: 10
963
+ marginHorizontal: 10,
964
+ fontSize: 16
1008
965
  }}
1009
966
  />
1010
967
  )}
@@ -1021,15 +978,17 @@ export const ProductOptionsUI = (props: any) => {
1021
978
  onPress={increment}
1022
979
  disabled={
1023
980
  maxProductQuantity <= 0 ||
1024
- productCart.quantity >= maxProductQuantity ||
981
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
982
+ ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1025
983
  isSoldOut
1026
984
  }>
1027
985
  <OIcon
1028
986
  src={theme.images.general.plus}
1029
- width={16}
987
+ width={20}
1030
988
  color={
1031
989
  maxProductQuantity <= 0 ||
1032
- productCart.quantity >= maxProductQuantity ||
990
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
991
+ ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1033
992
  isSoldOut
1034
993
  ? theme.colors.backgroundGray
1035
994
  : theme.colors.backgroundDark
@@ -1084,8 +1043,18 @@ export const ProductOptionsUI = (props: any) => {
1084
1043
  export const ProductForm = (props: any) => {
1085
1044
  const productOptionsProps = {
1086
1045
  ...props,
1087
- UIComponent: ProductOptionsUI,
1088
- };
1046
+ productCart: {
1047
+ ...props.productCart,
1048
+ quantity: props.productCart?.code
1049
+ ? props.productCart?.quantity
1050
+ : props?.product?.minimum_per_order || 1
1051
+ },
1052
+ UIComponent: ProductOptionsUI
1053
+ }
1089
1054
 
1090
- return <ProductOptions {...productOptionsProps} />;
1055
+ return <ProductOptions {...productOptionsProps} />
1091
1056
  };
1057
+
1058
+ ProductForm.defaultProps = {
1059
+ productAddedToCartLength: 0
1060
+ }