ordering-ui-react-native 0.16.85 → 0.16.86-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 (215) hide show
  1. package/package.json +5 -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 +8 -8
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/LanguageSelector/index.tsx +21 -16
  9. package/src/components/Messages/index.tsx +2 -2
  10. package/src/components/OrderCreating/index.tsx +1 -21
  11. package/src/components/OrdersOption/index.tsx +54 -56
  12. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  13. package/src/components/SingleProductReview/index.tsx +7 -4
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/components/shared/OToast.tsx +4 -4
  16. package/src/utils/index.tsx +2 -1
  17. package/themes/business/index.tsx +2 -0
  18. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  19. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  20. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  21. package/themes/business/src/components/Chat/index.tsx +31 -31
  22. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  23. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  24. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  25. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  26. package/themes/business/src/components/LoginForm/index.tsx +236 -80
  27. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  28. package/themes/business/src/components/MapView/index.tsx +19 -8
  29. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  30. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  31. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  32. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  34. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  35. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  36. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  37. package/themes/business/src/components/OrdersOption/index.tsx +79 -87
  38. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  39. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  40. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  42. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  44. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  45. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  46. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  47. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  48. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  49. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  50. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  51. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  52. package/themes/business/src/components/ReviewCustomer/index.tsx +54 -27
  53. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  54. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  55. package/themes/business/src/components/shared/OLink.tsx +33 -13
  56. package/themes/business/src/components/shared/OModal.tsx +16 -9
  57. package/themes/business/src/components/shared/OText.tsx +8 -2
  58. package/themes/business/src/types/index.tsx +35 -3
  59. package/themes/business/src/utils/index.tsx +53 -0
  60. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  62. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  64. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  65. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  66. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  67. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  68. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  69. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  70. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  71. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  72. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  73. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  74. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  75. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  76. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  77. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  78. package/themes/kiosk/src/types/index.d.ts +13 -0
  79. package/themes/kiosk/src/utils/index.tsx +15 -0
  80. package/themes/original/index.tsx +8 -0
  81. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  82. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  83. package/themes/original/src/components/AddressList/index.tsx +18 -18
  84. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  85. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  86. package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
  87. package/themes/original/src/components/BusinessController/index.tsx +100 -47
  88. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  89. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  90. package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -3
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -34
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  94. package/themes/original/src/components/BusinessProductsList/index.tsx +10 -8
  95. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +564 -495
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  102. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  103. package/themes/original/src/components/Cart/index.tsx +83 -42
  104. package/themes/original/src/components/CartContent/index.tsx +77 -15
  105. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  106. package/themes/original/src/components/Checkout/index.tsx +75 -86
  107. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  108. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  109. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  110. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  111. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  112. package/themes/original/src/components/Favorite/index.tsx +7 -4
  113. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  114. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  115. package/themes/original/src/components/FloatingButton/index.tsx +1 -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/GPSButton/styles.ts +3 -3
  119. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  120. package/themes/original/src/components/Help/index.tsx +8 -8
  121. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  122. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  123. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  124. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  125. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  126. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  127. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  128. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  129. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  130. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  131. package/themes/original/src/components/LoginForm/index.tsx +28 -8
  132. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  133. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  134. package/themes/original/src/components/Messages/index.tsx +26 -10
  135. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  136. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  137. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  138. package/themes/original/src/components/MultiCheckout/index.tsx +179 -77
  139. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  140. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  141. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  142. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  143. package/themes/original/src/components/NavBar/index.tsx +6 -11
  144. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  145. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  146. package/themes/original/src/components/Notifications/index.tsx +144 -0
  147. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  148. package/themes/original/src/components/OrderDetails/index.tsx +108 -218
  149. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  150. package/themes/original/src/components/OrderItAgain/index.tsx +44 -42
  151. package/themes/original/src/components/OrderProgress/index.tsx +74 -104
  152. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  153. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  154. package/themes/original/src/components/OrderTypeSelector/index.tsx +9 -3
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +29 -20
  156. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  157. package/themes/original/src/components/OrdersOption/index.tsx +76 -83
  158. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  159. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  160. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  162. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  164. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  165. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  166. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  167. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  168. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  169. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  170. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  171. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  172. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  173. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  174. package/themes/original/src/components/Promotions/index.tsx +234 -220
  175. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  176. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  177. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  178. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  179. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  180. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  181. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  182. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  183. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  184. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  185. package/themes/original/src/components/Sessions/index.tsx +11 -8
  186. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  187. package/themes/original/src/components/SignupForm/index.tsx +78 -66
  188. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  189. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  190. package/themes/original/src/components/SingleProductCard/index.tsx +104 -45
  191. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  192. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  193. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  194. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  195. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  196. package/themes/original/src/components/UpsellingProducts/index.tsx +243 -218
  197. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  198. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  199. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  200. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  201. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  202. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  203. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  204. package/themes/original/src/components/Wallets/index.tsx +96 -93
  205. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  206. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  207. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  208. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  209. package/themes/original/src/components/shared/OButton.tsx +1 -1
  210. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  211. package/themes/original/src/components/shared/OInput.tsx +10 -1
  212. package/themes/original/src/layouts/Container.tsx +13 -9
  213. package/themes/original/src/types/index.tsx +36 -5
  214. package/themes/original/src/utils/index.tsx +321 -58
  215. 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,
@@ -6,8 +19,10 @@ import {
6
19
  useOrder,
7
20
  useUtils,
8
21
  ToastType,
9
- useToast
22
+ useToast,
23
+ useConfig
10
24
  } from 'ordering-components/native';
25
+ import uuid from 'react-native-uuid';
11
26
  import { useTheme } from 'styled-components/native';
12
27
  import { ProductIngredient } from '../ProductIngredient';
13
28
  import { ProductOption } from '../ProductOption';
@@ -15,17 +30,10 @@ import Swiper from 'react-native-swiper'
15
30
  import FastImage from 'react-native-fast-image';
16
31
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
17
32
  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
33
 
25
34
  import {
26
35
  WrapHeader,
27
36
  TopHeader,
28
- WrapContent,
29
37
  ProductTitle,
30
38
  ProductDescription,
31
39
  ProductEditions,
@@ -45,8 +53,8 @@ import { ScrollView } from 'react-native-gesture-handler';
45
53
  import { ProductOptionSubOption } from '../ProductOptionSubOption';
46
54
  import { NotFoundSource } from '../NotFoundSource';
47
55
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
48
- import { useState } from 'react';
49
- const windowHeight = Dimensions.get('window').height;
56
+ import NavBar from '../NavBar';
57
+ import { orderTypeList } from '../../utils';
50
58
  const windowWidth = Dimensions.get('window').width;
51
59
 
52
60
  export const ProductOptionsUI = (props: any) => {
@@ -66,11 +74,16 @@ export const ProductOptionsUI = (props: any) => {
66
74
  handleChangeSuboptionState,
67
75
  handleChangeCommentState,
68
76
  productObject,
77
+ productAddedToCartLength,
78
+ actionStatus,
79
+ handleCreateGuestUser
69
80
  } = props;
70
81
 
71
82
  const theme = useTheme();
72
83
  const [, { showToast }] = useToast()
73
84
 
85
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
86
+
74
87
  const styles = StyleSheet.create({
75
88
  mainContainer: {
76
89
 
@@ -122,6 +135,7 @@ export const ProductOptionsUI = (props: any) => {
122
135
  },
123
136
  slide1: {
124
137
  flex: 1,
138
+ alignItems: 'center'
125
139
  },
126
140
  mainSwiper: {
127
141
  height: 258,
@@ -158,6 +172,10 @@ export const ProductOptionsUI = (props: any) => {
158
172
  justifyContent: 'space-between',
159
173
  width: '100%',
160
174
  marginTop: 10
175
+ },
176
+ wrapperNavbar: {
177
+ paddingHorizontal: 40,
178
+ paddingTop: 0,
161
179
  }
162
180
  });
163
181
 
@@ -165,6 +183,7 @@ export const ProductOptionsUI = (props: any) => {
165
183
  const [, t] = useLanguage();
166
184
  const [orderState] = useOrder();
167
185
  const [{ auth }] = useSession();
186
+ const [{ configs }] = useConfig()
168
187
  const { product, loading, error } = productObject;
169
188
  const [gallery, setGallery] = useState([])
170
189
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
@@ -183,6 +202,10 @@ export const ProductOptionsUI = (props: any) => {
183
202
  const [headerRefHeight, setHeaderRefHeight] = useState(0)
184
203
  const [summaryRefHeight, setSummaryRefHeight] = useState(0)
185
204
  const [isScrollAvailable, setIsScrollAvailable] = useState(null)
205
+ const [editionsLayoutY, setEditionsLayoutY] = useState(null)
206
+
207
+ const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
208
+ const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
186
209
 
187
210
  const isError = (id: number) => {
188
211
  let bgColor = theme.colors.white;
@@ -199,11 +222,12 @@ export const ProductOptionsUI = (props: any) => {
199
222
  };
200
223
 
201
224
  const handleSaveProduct = () => {
225
+ Vibration.vibrate()
202
226
  if (!productCart.quantity) {
203
227
  showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
204
228
  return
205
229
  }
206
- const isErrors = Object.values(errors).length > 0;
230
+ const isErrors = Object.values(errors)?.length > 0;
207
231
  if (!isErrors) {
208
232
  handleSave && handleSave();
209
233
  return;
@@ -222,7 +246,7 @@ export const ProductOptionsUI = (props: any) => {
222
246
  };
223
247
 
224
248
  const handleChangeMainIndex = (index: number) => {
225
- if (index < 0 || index > gallery.length - 1) {
249
+ if (index < 0 || index > gallery?.length - 1) {
226
250
  setThumbsSwiper(0)
227
251
  return
228
252
  }
@@ -265,7 +289,7 @@ export const ProductOptionsUI = (props: any) => {
265
289
  }
266
290
 
267
291
  const scrollDown = (id: any) => {
268
- const isErrors = Object.values(errors).length > 0
292
+ const isErrors = Object.values(errors)?.length > 0
269
293
  if (!isErrors) {
270
294
  return
271
295
  }
@@ -279,6 +303,11 @@ export const ProductOptionsUI = (props: any) => {
279
303
  }
280
304
  }
281
305
 
306
+ const handleUpdateGuest = () => {
307
+ const guestToken = uuid.v4()
308
+ if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
309
+ }
310
+
282
311
  const handleOnLayout = (event: any, optionId: any) => {
283
312
  const _optionLayout = { ...optionLayout }
284
313
  const optionKey = 'id:' + optionId
@@ -289,7 +318,8 @@ export const ProductOptionsUI = (props: any) => {
289
318
  const saveErrors =
290
319
  orderState.loading ||
291
320
  maxProductQuantity === 0 ||
292
- Object.keys(errors).length > 0;
321
+ Object.keys(errors)?.length > 0;
322
+
293
323
 
294
324
  const ExtraOptions = ({ eID, options }: any) => (
295
325
  <>
@@ -298,19 +328,25 @@ export const ProductOptionsUI = (props: any) => {
298
328
  {respect_to == null && suboptions?.length > 0 && (
299
329
  <TouchableOpacity
300
330
  key={`eopt_key_${id}`}
301
- onPress={() => setSelectedOpt(id)}
331
+ onPress={() => {
332
+ setSelectedOpt(id)
333
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
334
+ y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
335
+ animated: true
336
+ })
337
+ }}
302
338
  style={[
303
339
  styles.extraItem,
304
340
  {
305
341
  borderBottomColor:
306
- selOpt == id ? theme.colors.textNormal : theme.colors.border,
342
+ selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
307
343
  },
308
344
  ]}>
309
345
  <OText
310
346
  color={
311
347
  selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
312
348
  }
313
- size={selOpt == id ? 14 : 12}
349
+ size={12}
314
350
  weight={selOpt == id ? '600' : 'normal'}
315
351
  style={{ maxWidth: 150 }}
316
352
  numberOfLines={1}>
@@ -345,15 +381,18 @@ export const ProductOptionsUI = (props: any) => {
345
381
  useEffect(() => {
346
382
  const imageList: any = []
347
383
  const videoList: any = []
348
- product?.images && imageList.push(product.images)
349
- if (product?.gallery && product?.gallery.length > 0) {
384
+ imageList.push(product?.images?.length > 0
385
+ ? product.images
386
+ : theme?.images?.dummies?.product)
387
+
388
+ if (product?.gallery && product?.gallery?.length > 0) {
350
389
  for (const img of product?.gallery) {
351
390
  if (img?.file) {
352
391
  imageList.push(img?.file)
353
392
  }
354
393
  if (img?.video) {
355
394
  const keys = img?.video.split('/')
356
- let _videoId = keys[keys.length - 1]
395
+ let _videoId = keys[keys?.length - 1]
357
396
 
358
397
  if (_videoId.includes('watch')) {
359
398
  const __url = _videoId.split('=')[1]
@@ -368,7 +407,7 @@ export const ProductOptionsUI = (props: any) => {
368
407
  } else if (_videoId.search(/\?/i) >= 0) {
369
408
  _videoId = _videoId.split('?')[0]
370
409
  }
371
- if ((_videoId.length === 11)) {
410
+ if ((_videoId?.length === 11)) {
372
411
  videoList.push(_videoId)
373
412
  }
374
413
  }
@@ -403,14 +442,14 @@ export const ProductOptionsUI = (props: any) => {
403
442
  ? t('UPDATE', 'Update')
404
443
  : t('ADD', 'Add')
405
444
  }`}
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))}
445
+ 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
446
  textStyle={{
408
447
  color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
409
448
  fontSize: orderState.loading || editMode ? 10 : 14
410
449
  }}
411
450
  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,
451
+ 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,
452
+ 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
453
  opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
415
454
  borderRadius: 7.6,
416
455
  height: 44,
@@ -447,26 +486,52 @@ export const ProductOptionsUI = (props: any) => {
447
486
  height: 44,
448
487
  borderColor: theme.colors.primary,
449
488
  backgroundColor: theme.colors.white,
489
+ paddingLeft: 0,
490
+ paddingRight: 0
450
491
  }}
451
492
  />
452
493
  )}
494
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
495
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
496
+ {actionStatus?.loading ? (
497
+ <Placeholder Animation={Fade}>
498
+ <PlaceholderLine width={60} height={20} />
499
+ </Placeholder>
500
+ ) : (
501
+ <OText color={theme.colors.primary} size={13}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
502
+ )}
503
+ </TouchableOpacity>
504
+ )}
453
505
  </View>
454
506
  )
455
507
  }
456
508
 
509
+ useEffect(() => {
510
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
511
+ scrollViewRef.current.scrollToEnd({ animated: true })
512
+ })
513
+ return () => {
514
+ keyboardDidShowListener.remove()
515
+ }
516
+ }, [])
517
+
457
518
  return (
458
519
  <SafeAreaView style={{ flex: 1 }}>
459
- <TopHeader>
460
- <TopActions onPress={() => handleGoBack()}>
461
- <IconAntDesign name='arrowleft' size={26} />
462
- </TopActions>
463
- </TopHeader>
520
+ <View style={styles.wrapperNavbar}>
521
+ <NavBar
522
+ onActionLeft={() => handleGoBack()}
523
+ showCall={false}
524
+ btnStyle={{ paddingLeft: 0 }}
525
+ paddingTop={4}
526
+ />
527
+ </View>
464
528
  {!error && (
465
529
  <ScrollView
466
530
  ref={scrollViewRef}
467
531
  contentContainerStyle={{ paddingBottom: 80 }}
468
532
  stickyHeaderIndices={[2]}
469
- onScroll={handleScroll}>
533
+ onScroll={handleScroll}
534
+ >
470
535
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
471
536
  {loading && !product ? (
472
537
  <View style={styles.productHeaderSkeleton}>
@@ -508,23 +573,24 @@ export const ProductOptionsUI = (props: any) => {
508
573
  </View>
509
574
  }
510
575
  >
511
- {gallery && gallery.length > 0 && gallery.map((img, i) => (
576
+ {gallery && gallery?.length > 0 && gallery.map((img, i) => (
512
577
  <View
513
578
  style={styles.slide1}
514
579
  key={i}
515
580
  >
516
- {img.includes('image') ? (
581
+ {(String(img).includes('http') || typeof img === 'number') ? (
517
582
  <FastImage
518
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
519
- source={{
583
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
584
+ source={typeof img !== 'number' ? {
520
585
  uri: optimizeImage(img, 'h_1024,c_limit'),
521
586
  priority: FastImage.priority.normal,
522
- }}
587
+ } : img}
523
588
  />
524
589
  ) : (
525
590
  <>
526
591
  <YoutubePlayer
527
- height={300}
592
+ height={'100%'}
593
+ width={'100%'}
528
594
  play={playing}
529
595
  videoId={img}
530
596
  onChangeState={onStateChange}
@@ -542,7 +608,7 @@ export const ProductOptionsUI = (props: any) => {
542
608
  paddingVertical: 15
543
609
  }}
544
610
  >
545
- {gallery.length > 0 && gallery.map((img, index) => (
611
+ {gallery?.length > 1 && gallery.map((img, index) => (
546
612
  <TouchableOpacity
547
613
  key={index}
548
614
  onPress={() => handleClickThumb(index)}
@@ -555,7 +621,7 @@ export const ProductOptionsUI = (props: any) => {
555
621
  opacity: index === thumbsSwiper ? 1 : 0.8
556
622
  }}
557
623
  >
558
- {img.includes('image') ? (
624
+ {String(img).includes('http') ? (
559
625
  <OIcon
560
626
  url={img}
561
627
  style={{
@@ -570,7 +636,7 @@ export const ProductOptionsUI = (props: any) => {
570
636
  />
571
637
  ) : (
572
638
  <OIcon
573
- url={'http://img.youtube.com/vi/' + img + '/0.jpg'}
639
+ url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
574
640
  style={{
575
641
  borderColor: theme.colors.lightGray,
576
642
  borderRadius: 8,
@@ -590,7 +656,10 @@ export const ProductOptionsUI = (props: any) => {
590
656
  </>
591
657
  )}
592
658
  </WrapHeader>
593
- <ProductSummary onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}>
659
+ <ProductSummary
660
+ ph={isChewLayout ? 20 : 40}
661
+ onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
662
+ >
594
663
  <ProductTitle>
595
664
  {loading && !product ? (
596
665
  <Placeholder Animation={Fade}>
@@ -686,45 +755,40 @@ export const ProductOptionsUI = (props: any) => {
686
755
  <ExtraOptionWrap
687
756
  horizontal
688
757
  showsHorizontalScrollIndicator={false}
689
- style={{ marginBottom: 20 }}
690
- contentContainerStyle={{ paddingHorizontal: 33, backgroundColor: theme.colors.white }}
758
+ style={{
759
+ marginBottom: 20,
760
+ borderBottomWidth: 1,
761
+ borderBottomColor: theme.colors.border,
762
+ marginHorizontal: isChewLayout ? 20 : 30,
763
+ backgroundColor: theme.colors.backgroundPage,
764
+ }}
691
765
  >
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 && (
766
+ {product?.ingredients?.length > 0 && (
709
767
  <TouchableOpacity
710
768
  key={`eopt_key_01`}
711
- onPress={() => setSelectedOpt(0)}
769
+ onPress={() => {
770
+ setSelectedOpt(0)
771
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
772
+ y: optionLayout[`id:0`]?.y + editionsLayoutY - 50,
773
+ animated: true
774
+ })
775
+ }}
712
776
  style={[
713
777
  styles.extraItem,
714
778
  {
715
779
  borderBottomColor:
716
- selOpt == 0 ? theme.colors.textNormal : theme.colors.border,
780
+ selOpt == 0 ? theme.colors.textNormal : theme.colors.backgroundPage,
717
781
  },
718
782
  ]}>
719
783
  <OText
720
784
  color={selOpt == 0 ? theme.colors.textNormal : theme.colors.textSecondary}
721
- size={selOpt == 0 ? 14 : 12}
785
+ size={12}
722
786
  weight={selOpt == 0 ? '600' : 'normal'}>
723
787
  {t('INGREDIENTS', 'Ingredients')}
724
788
  </OText>
725
789
  </TouchableOpacity>
726
790
  )}
727
- {product?.extras.map((extra: any) =>
791
+ {product?.extras?.map((extra: any) =>
728
792
  <ExtraOptions key={extra.id} options={extra.options} />
729
793
  )}
730
794
  </ExtraOptionWrap>
@@ -768,184 +832,94 @@ export const ProductOptionsUI = (props: any) => {
768
832
  ))}
769
833
  </>
770
834
  ) : (
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
- );
835
+ <ProductEditions
836
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
837
+ onLayout={(event: any) => {
838
+ setEditionsLayoutY(event.nativeEvent.layout?.y)
839
+ }}
840
+ >
841
+ <>
842
+ {product?.ingredients?.length > 0 && (
843
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
844
+ <SectionTitle>
845
+ <OText size={16}>
846
+ {t('INGREDIENTS', 'Ingredients')}
847
+ </OText>
848
+ </SectionTitle>
849
+ <WrapperIngredients>
850
+ {product?.ingredients.map((ingredient: any) => (
851
+ <ProductIngredient
852
+ key={ingredient.id}
853
+ ingredient={ingredient}
854
+ state={
855
+ productCart.ingredients[`id:${ingredient.id}`]
942
856
  }
943
- }),
944
- )}
945
- </>
946
- )}
947
- </>
948
- )}
857
+ onChange={handleChangeIngredientState}
858
+ isSoldOut={isSoldOut}
859
+ />
860
+ ))}
861
+ </WrapperIngredients>
862
+ </View>
863
+ )}
864
+ {product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
865
+ extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
866
+ const currentState =
867
+ productCart.options[`id:${option.id}`] || {};
868
+ return (
869
+ <React.Fragment key={`popt_${option.id}`}>
870
+ {showOption(option) && (
871
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
872
+ <ProductOption
873
+ option={option}
874
+ currentState={currentState}
875
+ error={errors[`id:${option.id}`]}>
876
+ <WrapperSubOption
877
+ style={{
878
+ backgroundColor: isError(option.id),
879
+ borderRadius: 7.6
880
+ }}>
881
+ {option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
882
+ (suboption: any) => {
883
+ const currentState =
884
+ productCart.options[
885
+ `id:${option.id}`
886
+ ]?.suboptions[
887
+ `id:${suboption.id}`
888
+ ] || {};
889
+ const balance =
890
+ productCart.options[
891
+ `id:${option.id}`
892
+ ]?.balance || 0;
893
+ return (
894
+ <ProductOptionSubOption
895
+ key={suboption.id}
896
+ isSoldOut={isSoldOut}
897
+ onChange={
898
+ handleChangeSuboptionState
899
+ }
900
+ balance={balance}
901
+ option={option}
902
+ suboption={suboption}
903
+ state={currentState}
904
+ disabled={
905
+ isSoldOut ||
906
+ maxProductQuantity <= 0
907
+ }
908
+ setIsScrollAvailable={setIsScrollAvailable}
909
+ error={errors[`id:${option.id}`]}
910
+ />
911
+ );
912
+ },
913
+ )}
914
+ </WrapperSubOption>
915
+ </ProductOption>
916
+ </View>
917
+ )}
918
+ </React.Fragment>
919
+ );
920
+ }),
921
+ )}
922
+ </>
949
923
  {!product?.hide_special_instructions && (
950
924
  <ProductComment>
951
925
  <SectionTitle>
@@ -969,7 +943,7 @@ export const ProductOptionsUI = (props: any) => {
969
943
  )}
970
944
  </ProductEditions>
971
945
  )}
972
- {!!error && error.length > 0 && (
946
+ {!!error && error?.length > 0 && (
973
947
  <NotFoundSource content={error[0]?.message || error[0]} />
974
948
  )}
975
949
  </ScrollView>
@@ -981,18 +955,18 @@ export const ProductOptionsUI = (props: any) => {
981
955
  <OText size={16} lineHeight={24} weight={'600'}>
982
956
  {productCart.total ? parsePrice(productCart?.total) : ''}
983
957
  </OText>
984
- {product?.minimum_per_order && productCart?.quantity <= 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>}
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>}
958
+ {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>}
959
+ {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
960
  </View>
987
961
  {productCart && !isSoldOut && maxProductQuantity > 0 && (
988
962
  <>
989
963
  <View style={styles.quantityControl}>
990
964
  <TouchableOpacity
991
965
  onPress={decrement}
992
- disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order)}>
966
+ disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || ((productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order)}>
993
967
  <OIcon
994
968
  src={theme.images.general.minus}
995
- width={16}
969
+ width={20}
996
970
  color={
997
971
  productCart.quantity === 1 || isSoldOut
998
972
  ? theme.colors.backgroundGray
@@ -1013,7 +987,8 @@ export const ProductOptionsUI = (props: any) => {
1013
987
  borderRadius: 8,
1014
988
  borderColor: theme.colors.inputBorderColor,
1015
989
  height: 44,
1016
- marginHorizontal: 10
990
+ marginHorizontal: 10,
991
+ fontSize: 16
1017
992
  }}
1018
993
  />
1019
994
  )}
@@ -1030,17 +1005,17 @@ export const ProductOptionsUI = (props: any) => {
1030
1005
  onPress={increment}
1031
1006
  disabled={
1032
1007
  maxProductQuantity <= 0 ||
1033
- productCart.quantity >= maxProductQuantity ||
1034
- (productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) ||
1008
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
1009
+ ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1035
1010
  isSoldOut
1036
1011
  }>
1037
1012
  <OIcon
1038
1013
  src={theme.images.general.plus}
1039
- width={16}
1014
+ width={20}
1040
1015
  color={
1041
1016
  maxProductQuantity <= 0 ||
1042
- productCart.quantity >= maxProductQuantity ||
1043
- (productCart.quantity >= product?.maximum_per_order && product?.maximum_per_order) ||
1017
+ (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
1018
+ ((productCart?.quantity + productAddedToCartLength) >= product?.maximum_per_order && product?.maximum_per_order) ||
1044
1019
  isSoldOut
1045
1020
  ? theme.colors.backgroundGray
1046
1021
  : theme.colors.backgroundDark
@@ -1095,9 +1070,18 @@ export const ProductOptionsUI = (props: any) => {
1095
1070
  export const ProductForm = (props: any) => {
1096
1071
  const productOptionsProps = {
1097
1072
  ...props,
1098
- productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
1099
- UIComponent: ProductOptionsUI,
1100
- };
1073
+ productCart: {
1074
+ ...props.productCart,
1075
+ quantity: props.productCart?.code
1076
+ ? props.productCart?.quantity
1077
+ : props?.product?.minimum_per_order || 1
1078
+ },
1079
+ UIComponent: ProductOptionsUI
1080
+ }
1101
1081
 
1102
- return <ProductOptions {...productOptionsProps} />;
1082
+ return <ProductOptions {...productOptionsProps} />
1103
1083
  };
1084
+
1085
+ ProductForm.defaultProps = {
1086
+ productAddedToCartLength: 0
1087
+ }