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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +19 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +10 -10
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +2 -1
  9. package/src/components/LanguageSelector/index.tsx +21 -16
  10. package/src/components/Messages/index.tsx +2 -2
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptions/index.tsx +298 -345
  13. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  14. package/src/components/SingleProductReview/index.tsx +7 -4
  15. package/src/components/StripeElementsForm/index.tsx +25 -16
  16. package/src/components/VerifyPhone/styles.tsx +1 -2
  17. package/src/components/shared/OToast.tsx +4 -4
  18. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  19. package/src/utils/index.tsx +2 -1
  20. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +260 -238
  21. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  22. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  23. package/themes/business/src/components/Chat/index.tsx +31 -31
  24. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  25. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  26. package/themes/business/src/components/MapView/index.tsx +14 -3
  27. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +70 -43
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  31. package/themes/business/src/components/OrdersOption/index.tsx +63 -73
  32. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  33. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  34. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  35. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  36. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  37. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  40. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  41. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  42. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  43. package/themes/business/src/components/PreviousOrders/index.tsx +440 -245
  44. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  45. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  46. package/themes/business/src/components/ReviewCustomer/index.tsx +39 -15
  47. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  48. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  49. package/themes/business/src/components/shared/OLink.tsx +33 -13
  50. package/themes/business/src/components/shared/OText.tsx +8 -2
  51. package/themes/business/src/types/index.tsx +14 -3
  52. package/themes/business/src/utils/index.tsx +10 -0
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  57. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  59. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  60. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  61. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  64. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  65. package/themes/kiosk/src/types/index.d.ts +2 -0
  66. package/themes/original/index.tsx +6 -0
  67. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  68. package/themes/original/src/components/AddressForm/index.tsx +153 -137
  69. package/themes/original/src/components/AddressList/index.tsx +18 -18
  70. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/BusinessBasicInformation/index.tsx +49 -25
  73. package/themes/original/src/components/BusinessController/index.tsx +101 -70
  74. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  75. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  77. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  78. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -142
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  82. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  83. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +41 -62
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +561 -479
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  88. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +93 -99
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  92. package/themes/original/src/components/BusinessesListing/index.tsx +8 -8
  93. package/themes/original/src/components/Cart/index.tsx +75 -42
  94. package/themes/original/src/components/CartContent/index.tsx +80 -18
  95. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  96. package/themes/original/src/components/Checkout/index.tsx +92 -105
  97. package/themes/original/src/components/Checkout/styles.tsx +4 -3
  98. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  99. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  100. package/themes/original/src/components/DriverTips/index.tsx +47 -37
  101. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  102. package/themes/original/src/components/Favorite/index.tsx +7 -4
  103. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  104. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  105. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  106. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  107. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  108. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  109. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  110. package/themes/original/src/components/Help/index.tsx +7 -7
  111. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +14 -20
  112. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  113. package/themes/original/src/components/HelpGuide/index.tsx +12 -11
  114. package/themes/original/src/components/HelpGuide/styles.tsx +5 -0
  115. package/themes/original/src/components/HelpOrder/index.tsx +12 -20
  116. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  117. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  118. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  119. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  120. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  121. package/themes/original/src/components/LoginForm/index.tsx +98 -41
  122. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  123. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  124. package/themes/original/src/components/Messages/index.tsx +35 -20
  125. package/themes/original/src/components/MomentOption/index.tsx +17 -11
  126. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  128. package/themes/original/src/components/MultiCheckout/index.tsx +158 -77
  129. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  130. package/themes/original/src/components/MultiOrdersDetails/index.tsx +85 -34
  131. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  132. package/themes/original/src/components/MyOrders/index.tsx +86 -20
  133. package/themes/original/src/components/NavBar/index.tsx +7 -6
  134. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  135. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  136. package/themes/original/src/components/Notifications/index.tsx +144 -0
  137. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +100 -215
  139. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  140. package/themes/original/src/components/OrderItAgain/index.tsx +46 -43
  141. package/themes/original/src/components/OrderProgress/index.tsx +79 -100
  142. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  143. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +13 -6
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +94 -98
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  147. package/themes/original/src/components/OrdersOption/index.tsx +97 -88
  148. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  149. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  150. package/themes/original/src/components/PaymentOptions/index.tsx +1 -2
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PlaceSpot/index.tsx +22 -8
  153. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  154. package/themes/original/src/components/ProductForm/index.tsx +212 -253
  155. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  157. package/themes/original/src/components/ProductOptionSubOption/index.tsx +17 -9
  158. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  159. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  160. package/themes/original/src/components/ProfessionalProfile/index.tsx +19 -8
  161. package/themes/original/src/components/Promotions/index.tsx +234 -220
  162. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  163. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  164. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  165. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  166. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  167. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  168. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  169. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  170. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  171. package/themes/original/src/components/ServiceForm/index.tsx +328 -264
  172. package/themes/original/src/components/SignupForm/index.tsx +134 -89
  173. package/themes/original/src/components/SingleOrderCard/index.tsx +129 -54
  174. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  175. package/themes/original/src/components/SingleProductCard/index.tsx +85 -82
  176. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -9
  177. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  178. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  179. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  180. package/themes/original/src/components/StripeElementsForm/index.tsx +13 -2
  181. package/themes/original/src/components/UpsellingProducts/index.tsx +244 -215
  182. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  183. package/themes/original/src/components/UserDetails/index.tsx +5 -3
  184. package/themes/original/src/components/UserFormDetails/index.tsx +6 -48
  185. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  186. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  187. package/themes/original/src/components/UserProfileForm/index.tsx +19 -28
  188. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  189. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  190. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  191. package/themes/original/src/components/Wallets/index.tsx +176 -164
  192. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  193. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  194. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  195. package/themes/original/src/components/shared/OBottomPopup.tsx +6 -4
  196. package/themes/original/src/components/shared/OButton.tsx +9 -4
  197. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  198. package/themes/original/src/components/shared/OInput.tsx +10 -1
  199. package/themes/original/src/layouts/Container.tsx +13 -9
  200. package/themes/original/src/types/index.tsx +35 -5
  201. package/themes/original/src/utils/index.tsx +305 -58
  202. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,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?.toLowerCase() === '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
 
@@ -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}>
@@ -345,15 +367,18 @@ export const ProductOptionsUI = (props: any) => {
345
367
  useEffect(() => {
346
368
  const imageList: any = []
347
369
  const videoList: any = []
348
- product?.images && imageList.push(product.images)
349
- 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) {
350
375
  for (const img of product?.gallery) {
351
376
  if (img?.file) {
352
377
  imageList.push(img?.file)
353
378
  }
354
379
  if (img?.video) {
355
380
  const keys = img?.video.split('/')
356
- let _videoId = keys[keys.length - 1]
381
+ let _videoId = keys[keys?.length - 1]
357
382
 
358
383
  if (_videoId.includes('watch')) {
359
384
  const __url = _videoId.split('=')[1]
@@ -368,7 +393,7 @@ export const ProductOptionsUI = (props: any) => {
368
393
  } else if (_videoId.search(/\?/i) >= 0) {
369
394
  _videoId = _videoId.split('?')[0]
370
395
  }
371
- if ((_videoId.length === 11)) {
396
+ if ((_videoId?.length === 11)) {
372
397
  videoList.push(_videoId)
373
398
  }
374
399
  }
@@ -403,14 +428,14 @@ export const ProductOptionsUI = (props: any) => {
403
428
  ? t('UPDATE', 'Update')
404
429
  : t('ADD', 'Add')
405
430
  }`}
406
- 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))}
407
432
  textStyle={{
408
433
  color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
409
434
  fontSize: orderState.loading || editMode ? 10 : 14
410
435
  }}
411
436
  style={{
412
- 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,
413
- 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,
414
439
  opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
415
440
  borderRadius: 7.6,
416
441
  height: 44,
@@ -454,19 +479,32 @@ export const ProductOptionsUI = (props: any) => {
454
479
  )
455
480
  }
456
481
 
482
+ useEffect(() => {
483
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
484
+ scrollViewRef.current.scrollToEnd({ animated: true })
485
+ })
486
+ return () => {
487
+ keyboardDidShowListener.remove()
488
+ }
489
+ }, [])
490
+
457
491
  return (
458
492
  <SafeAreaView style={{ flex: 1 }}>
459
- <TopHeader>
460
- <TopActions onPress={() => handleGoBack()}>
461
- <OIcon src={theme.images.general.arrow_left} width={30} />
462
- </TopActions>
463
- </TopHeader>
493
+ <View style={styles.wrapperNavbar}>
494
+ <NavBar
495
+ onActionLeft={() => handleGoBack()}
496
+ showCall={false}
497
+ btnStyle={{ paddingLeft: 0 }}
498
+ paddingTop={4}
499
+ />
500
+ </View>
464
501
  {!error && (
465
502
  <ScrollView
466
503
  ref={scrollViewRef}
467
504
  contentContainerStyle={{ paddingBottom: 80 }}
468
505
  stickyHeaderIndices={[2]}
469
- onScroll={handleScroll}>
506
+ onScroll={handleScroll}
507
+ >
470
508
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
471
509
  {loading && !product ? (
472
510
  <View style={styles.productHeaderSkeleton}>
@@ -508,23 +546,24 @@ export const ProductOptionsUI = (props: any) => {
508
546
  </View>
509
547
  }
510
548
  >
511
- {gallery && gallery.length > 0 && gallery.map((img, i) => (
549
+ {gallery && gallery?.length > 0 && gallery.map((img, i) => (
512
550
  <View
513
551
  style={styles.slide1}
514
552
  key={i}
515
553
  >
516
- {img.includes('image') ? (
554
+ {(String(img).includes('http') || typeof img === 'number') ? (
517
555
  <FastImage
518
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
519
- source={{
556
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
557
+ source={typeof img !== 'number' ? {
520
558
  uri: optimizeImage(img, 'h_1024,c_limit'),
521
559
  priority: FastImage.priority.normal,
522
- }}
560
+ } : img}
523
561
  />
524
562
  ) : (
525
563
  <>
526
564
  <YoutubePlayer
527
- height={300}
565
+ height={'100%'}
566
+ width={'100%'}
528
567
  play={playing}
529
568
  videoId={img}
530
569
  onChangeState={onStateChange}
@@ -542,7 +581,7 @@ export const ProductOptionsUI = (props: any) => {
542
581
  paddingVertical: 15
543
582
  }}
544
583
  >
545
- {gallery.length > 0 && gallery.map((img, index) => (
584
+ {gallery?.length > 1 && gallery.map((img, index) => (
546
585
  <TouchableOpacity
547
586
  key={index}
548
587
  onPress={() => handleClickThumb(index)}
@@ -555,7 +594,7 @@ export const ProductOptionsUI = (props: any) => {
555
594
  opacity: index === thumbsSwiper ? 1 : 0.8
556
595
  }}
557
596
  >
558
- {img.includes('image') ? (
597
+ {String(img).includes('http') ? (
559
598
  <OIcon
560
599
  url={img}
561
600
  style={{
@@ -570,7 +609,7 @@ export const ProductOptionsUI = (props: any) => {
570
609
  />
571
610
  ) : (
572
611
  <OIcon
573
- url={'http://img.youtube.com/vi/' + img + '/0.jpg'}
612
+ url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
574
613
  style={{
575
614
  borderColor: theme.colors.lightGray,
576
615
  borderRadius: 8,
@@ -590,7 +629,10 @@ export const ProductOptionsUI = (props: any) => {
590
629
  </>
591
630
  )}
592
631
  </WrapHeader>
593
- <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
+ >
594
636
  <ProductTitle>
595
637
  {loading && !product ? (
596
638
  <Placeholder Animation={Fade}>
@@ -686,45 +728,40 @@ export const ProductOptionsUI = (props: any) => {
686
728
  <ExtraOptionWrap
687
729
  horizontal
688
730
  showsHorizontalScrollIndicator={false}
689
- style={{ marginBottom: 20 }}
690
- 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
+ }}
691
738
  >
692
- <TouchableOpacity
693
- key={`eopt_key_00`}
694
- onPress={() => setSelectedOpt(-1)}
695
- style={[
696
- styles.extraItem,
697
- {
698
- borderBottomColor: selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
699
- },
700
- ]}>
701
- <OText
702
- color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
703
- size={selOpt == -1 ? 14 : 12}
704
- weight={selOpt == -1 ? '600' : 'normal'}>
705
- {t('ALL', 'All')}
706
- </OText>
707
- </TouchableOpacity>
708
- {product?.ingredients.length > 0 && (
739
+ {product?.ingredients?.length > 0 && (
709
740
  <TouchableOpacity
710
741
  key={`eopt_key_01`}
711
- onPress={() => setSelectedOpt(0)}
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
+ }}
712
749
  style={[
713
750
  styles.extraItem,
714
751
  {
715
752
  borderBottomColor:
716
- selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
753
+ selOpt == 0 ? theme.colors.textNormal : theme.colors.backgroundPage,
717
754
  },
718
755
  ]}>
719
756
  <OText
720
757
  color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
721
- size={selOpt == 0 ? 14 : 12}
758
+ size={12}
722
759
  weight={selOpt == 0 ? '600' : 'normal'}>
723
760
  {t('INGREDIENTS', 'Ingredients')}
724
761
  </OText>
725
762
  </TouchableOpacity>
726
763
  )}
727
- {product?.extras.map((extra: any) =>
764
+ {product?.extras?.map((extra: any) =>
728
765
  <ExtraOptions key={extra.id} options={extra.options} />
729
766
  )}
730
767
  </ExtraOptionWrap>
@@ -768,184 +805,94 @@ export const ProductOptionsUI = (props: any) => {
768
805
  ))}
769
806
  </>
770
807
  ) : (
771
- <ProductEditions>
772
- {selOpt === -1 ? (
773
- <>
774
- {product?.ingredients.length > 0 && (
775
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
776
- <SectionTitle>
777
- <OText size={16}>
778
- {t('INGREDIENTS', 'Ingredients')}
779
- </OText>
780
- </SectionTitle>
781
- <WrapperIngredients>
782
- {product?.ingredients.map((ingredient: any) => (
783
- <ProductIngredient
784
- key={ingredient.id}
785
- ingredient={ingredient}
786
- state={
787
- productCart.ingredients[`id:${ingredient.id}`]
788
- }
789
- onChange={handleChangeIngredientState}
790
- isSoldOut={isSoldOut}
791
- />
792
- ))}
793
- </WrapperIngredients>
794
- </View>
795
- )}
796
- {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
797
- extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
798
- const currentState =
799
- productCart.options[`id:${option.id}`] || {};
800
- return (
801
- <React.Fragment key={`popt_${option.id}`}>
802
- {showOption(option) && (
803
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
804
- <ProductOption
805
- option={option}
806
- currentState={currentState}
807
- error={errors[`id:${option.id}`]}>
808
- <WrapperSubOption
809
- style={{
810
- backgroundColor: isError(option.id),
811
- borderRadius: 7.6
812
- }}>
813
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
814
- (suboption: any) => {
815
- const currentState =
816
- productCart.options[
817
- `id:${option.id}`
818
- ]?.suboptions[
819
- `id:${suboption.id}`
820
- ] || {};
821
- const balance =
822
- productCart.options[
823
- `id:${option.id}`
824
- ]?.balance || 0;
825
- return (
826
- <ProductOptionSubOption
827
- key={suboption.id}
828
- isSoldOut={isSoldOut}
829
- onChange={
830
- handleChangeSuboptionState
831
- }
832
- balance={balance}
833
- option={option}
834
- suboption={suboption}
835
- state={currentState}
836
- disabled={
837
- isSoldOut ||
838
- maxProductQuantity <= 0
839
- }
840
- setIsScrollAvailable={setIsScrollAvailable}
841
- error={errors[`id:${option.id}`]}
842
- />
843
- );
844
- },
845
- )}
846
- </WrapperSubOption>
847
- </ProductOption>
848
- </View>
849
- )}
850
- </React.Fragment>
851
- );
852
- }),
853
- )}
854
- </>
855
- ) : (
856
- <>
857
- {selOpt === 0 ? (
858
- <View style={styles.optionContainer}>
859
- <SectionTitle>
860
- <OText size={16}>
861
- {t('INGREDIENTS', 'Ingredients')}
862
- </OText>
863
- </SectionTitle>
864
- <WrapperIngredients>
865
- {product?.ingredients.map((ingredient: any) => (
866
- <ProductIngredient
867
- key={ingredient.id}
868
- ingredient={ingredient}
869
- state={
870
- productCart.ingredients[`id:${ingredient.id}`]
871
- }
872
- onChange={handleChangeIngredientState}
873
- isSoldOut={isSoldOut}
874
- />
875
- ))}
876
- </WrapperIngredients>
877
- </View>
878
- ) : (
879
- <>
880
- {product?.extras.map((extra: any) =>
881
- extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
882
- if (
883
- option.id == selOpt ||
884
- (hasRespected(
885
- extra.options,
886
- option.respect_to,
887
- ) &&
888
- showOption(option))
889
- ) {
890
- const currentState =
891
- productCart.options[`id:${option.id}`] || {};
892
- return (
893
- <React.Fragment key={option.id}>
894
- {showOption(option) && (
895
- <View style={styles.optionContainer}>
896
- <ProductOption
897
- option={option}
898
- currentState={currentState}
899
- error={errors[`id:${option.id}`]}>
900
- <WrapperSubOption
901
- style={{
902
- backgroundColor: isError(
903
- option.id,
904
- ),
905
- }}>
906
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
907
- (suboption: any) => {
908
- const currentState =
909
- productCart.options[
910
- `id:${option.id}`
911
- ]?.suboptions[
912
- `id:${suboption.id}`
913
- ] || {};
914
- const balance =
915
- productCart.options[
916
- `id:${option.id}`
917
- ]?.balance || 0;
918
- return (
919
- <ProductOptionSubOption
920
- key={suboption.id}
921
- onChange={
922
- handleChangeSuboptionState
923
- }
924
- balance={balance}
925
- option={option}
926
- suboption={suboption}
927
- state={currentState}
928
- disabled={
929
- isSoldOut ||
930
- maxProductQuantity <= 0
931
- }
932
- />
933
- );
934
- },
935
- )}
936
- </WrapperSubOption>
937
- </ProductOption>
938
- </View>
939
- )}
940
- </React.Fragment>
941
- );
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}`]
942
829
  }
943
- }),
944
- )}
945
- </>
946
- )}
947
- </>
948
- )}
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
+ </>
949
896
  {!product?.hide_special_instructions && (
950
897
  <ProductComment>
951
898
  <SectionTitle>
@@ -969,7 +916,7 @@ export const ProductOptionsUI = (props: any) => {
969
916
  )}
970
917
  </ProductEditions>
971
918
  )}
972
- {!!error && error.length > 0 && (
919
+ {!!error && error?.length > 0 && (
973
920
  <NotFoundSource content={error[0]?.message || error[0]} />
974
921
  )}
975
922
  </ScrollView>
@@ -981,18 +928,18 @@ export const ProductOptionsUI = (props: any) => {
981
928
  <OText size={16} lineHeight={24} weight={'600'}>
982
929
  {productCart.total ? parsePrice(productCart?.total) : ''}
983
930
  </OText>
984
- {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>}
985
- {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>}
986
933
  </View>
987
934
  {productCart && !isSoldOut && maxProductQuantity > 0 && (
988
935
  <>
989
936
  <View style={styles.quantityControl}>
990
937
  <TouchableOpacity
991
938
  onPress={decrement}
992
- disabled={productCart.quantity === 1 || isSoldOut}>
939
+ disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || ((productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order)}>
993
940
  <OIcon
994
941
  src={theme.images.general.minus}
995
- width={16}
942
+ width={20}
996
943
  color={
997
944
  productCart.quantity === 1 || isSoldOut
998
945
  ? theme.colors.backgroundGray
@@ -1013,7 +960,8 @@ export const ProductOptionsUI = (props: any) => {
1013
960
  borderRadius: 8,
1014
961
  borderColor: theme.colors.inputBorderColor,
1015
962
  height: 44,
1016
- marginHorizontal: 10
963
+ marginHorizontal: 10,
964
+ fontSize: 16
1017
965
  }}
1018
966
  />
1019
967
  )}
@@ -1030,15 +978,17 @@ export const ProductOptionsUI = (props: any) => {
1030
978
  onPress={increment}
1031
979
  disabled={
1032
980
  maxProductQuantity <= 0 ||
1033
- productCart.quantity >= maxProductQuantity ||
981
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
982
+ ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1034
983
  isSoldOut
1035
984
  }>
1036
985
  <OIcon
1037
986
  src={theme.images.general.plus}
1038
- width={16}
987
+ width={20}
1039
988
  color={
1040
989
  maxProductQuantity <= 0 ||
1041
- productCart.quantity >= maxProductQuantity ||
990
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
991
+ ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1042
992
  isSoldOut
1043
993
  ? theme.colors.backgroundGray
1044
994
  : theme.colors.backgroundDark
@@ -1093,9 +1043,18 @@ export const ProductOptionsUI = (props: any) => {
1093
1043
  export const ProductForm = (props: any) => {
1094
1044
  const productOptionsProps = {
1095
1045
  ...props,
1096
- productCart: { quantity: props?.product?.minimum_per_order || 1 },
1097
- UIComponent: ProductOptionsUI,
1098
- };
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
+ }
1099
1054
 
1100
- return <ProductOptions {...productOptionsProps} />;
1055
+ return <ProductOptions {...productOptionsProps} />
1101
1056
  };
1057
+
1058
+ ProductForm.defaultProps = {
1059
+ productAddedToCartLength: 0
1060
+ }