ordering-ui-react-native 0.17.41 → 0.17.42-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 (212) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/StripeMethodForm/index.tsx +136 -102
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +4 -4
  9. package/src/types/index.tsx +5 -0
  10. package/src/utils/index.tsx +7 -1
  11. package/themes/business/index.tsx +2 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  13. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  14. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  15. package/themes/business/src/components/Chat/index.tsx +125 -113
  16. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  17. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  18. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  19. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  20. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  21. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +49 -50
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +92 -49
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  27. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  28. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  29. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  30. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  31. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  33. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  34. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  35. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  36. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  37. package/themes/business/src/components/ReviewCustomer/index.tsx +35 -18
  38. package/themes/business/src/components/StoresList/index.tsx +2 -2
  39. package/themes/business/src/components/shared/OLink.tsx +33 -13
  40. package/themes/business/src/components/shared/OModal.tsx +16 -9
  41. package/themes/business/src/components/shared/OText.tsx +8 -2
  42. package/themes/business/src/types/index.tsx +32 -2
  43. package/themes/business/src/utils/index.tsx +44 -1
  44. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  45. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  46. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  50. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  51. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  52. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  57. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  58. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  61. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  62. package/themes/kiosk/src/types/index.d.ts +13 -0
  63. package/themes/kiosk/src/utils/index.tsx +15 -0
  64. package/themes/original/index.tsx +6 -0
  65. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  66. package/themes/original/src/components/AddressForm/index.tsx +79 -44
  67. package/themes/original/src/components/AddressList/index.tsx +26 -21
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  69. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  70. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +159 -90
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  73. package/themes/original/src/components/BusinessController/index.tsx +141 -67
  74. package/themes/original/src/components/BusinessController/styles.tsx +22 -2
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  79. package/themes/original/src/components/BusinessListingSearch/index.tsx +351 -326
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -524
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -4
  86. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +106 -79
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +102 -69
  92. package/themes/original/src/components/CartContent/index.tsx +115 -19
  93. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  94. package/themes/original/src/components/Checkout/index.tsx +375 -179
  95. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  96. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  97. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  98. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  100. package/themes/original/src/components/Favorite/index.tsx +8 -9
  101. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  102. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  103. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  104. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  105. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  106. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  108. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  112. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  114. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  115. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  116. package/themes/original/src/components/Help/index.tsx +8 -8
  117. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  118. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  119. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  120. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  121. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  122. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  123. package/themes/original/src/components/Home/index.tsx +13 -4
  124. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +139 -75
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +71 -28
  128. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  129. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  130. package/themes/original/src/components/Messages/index.tsx +32 -10
  131. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  132. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  134. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  139. package/themes/original/src/components/MyOrders/index.tsx +53 -51
  140. package/themes/original/src/components/NavBar/index.tsx +18 -18
  141. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  142. package/themes/original/src/components/Notifications/index.tsx +46 -50
  143. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  144. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +199 -359
  147. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  148. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  149. package/themes/original/src/components/OrderProgress/index.tsx +93 -114
  150. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  151. package/themes/original/src/components/OrderSummary/index.tsx +87 -59
  152. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  154. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  155. package/themes/original/src/components/OrdersOption/index.tsx +70 -65
  156. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  157. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -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 +64 -7
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -4
  164. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  165. package/themes/original/src/components/ProductForm/index.tsx +116 -37
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -13
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +19 -11
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +74 -19
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +42 -19
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  189. package/themes/original/src/components/SingleProductCard/index.tsx +72 -34
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +22 -4
  191. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  192. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  194. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  195. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  196. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  197. package/themes/original/src/components/UserFormDetails/index.tsx +47 -7
  198. package/themes/original/src/components/UserProfile/index.tsx +5 -7
  199. package/themes/original/src/components/UserProfileForm/index.tsx +25 -28
  200. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  201. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  202. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  203. package/themes/original/src/components/Wallets/index.tsx +67 -24
  204. package/themes/original/src/components/Wallets/styles.tsx +5 -4
  205. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  206. package/themes/original/src/components/shared/OButton.tsx +6 -2
  207. package/themes/original/src/components/shared/OInput.tsx +16 -2
  208. package/themes/original/src/components/shared/OModal.tsx +3 -3
  209. package/themes/original/src/layouts/Container.tsx +1 -1
  210. package/themes/original/src/types/index.tsx +38 -9
  211. package/themes/original/src/utils/index.tsx +364 -58
  212. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -9,7 +9,8 @@ import {
9
9
  I18nManager,
10
10
  SafeAreaView,
11
11
  Platform,
12
- Button
12
+ Button,
13
+ Vibration
13
14
  } from 'react-native';
14
15
  import {
15
16
  ProductForm as ProductOptions,
@@ -18,8 +19,11 @@ import {
18
19
  useOrder,
19
20
  useUtils,
20
21
  ToastType,
21
- useToast
22
+ useToast,
23
+ useConfig,
24
+ useEvent
22
25
  } from 'ordering-components/native';
26
+ import uuid from 'react-native-uuid';
23
27
  import { useTheme } from 'styled-components/native';
24
28
  import { ProductIngredient } from '../ProductIngredient';
25
29
  import { ProductOption } from '../ProductOption';
@@ -27,6 +31,7 @@ import Swiper from 'react-native-swiper'
27
31
  import FastImage from 'react-native-fast-image';
28
32
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
29
33
  import YoutubePlayer from "react-native-youtube-iframe"
34
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
30
35
 
31
36
  import {
32
37
  WrapHeader,
@@ -50,6 +55,8 @@ import { ScrollView } from 'react-native-gesture-handler';
50
55
  import { ProductOptionSubOption } from '../ProductOptionSubOption';
51
56
  import { NotFoundSource } from '../NotFoundSource';
52
57
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
58
+ import NavBar from '../NavBar';
59
+ import { orderTypeList } from '../../utils';
53
60
  const windowWidth = Dimensions.get('window').width;
54
61
 
55
62
  export const ProductOptionsUI = (props: any) => {
@@ -69,11 +76,16 @@ export const ProductOptionsUI = (props: any) => {
69
76
  handleChangeSuboptionState,
70
77
  handleChangeCommentState,
71
78
  productObject,
72
- productAddedToCartLength
79
+ productAddedToCartLength,
80
+ actionStatus,
81
+ handleCreateGuestUser
73
82
  } = props;
74
83
 
75
84
  const theme = useTheme();
76
85
  const [, { showToast }] = useToast()
86
+ const [events] = useEvent()
87
+
88
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
77
89
 
78
90
  const styles = StyleSheet.create({
79
91
  mainContainer: {
@@ -126,6 +138,7 @@ export const ProductOptionsUI = (props: any) => {
126
138
  },
127
139
  slide1: {
128
140
  flex: 1,
141
+ alignItems: 'center'
129
142
  },
130
143
  mainSwiper: {
131
144
  height: 258,
@@ -162,6 +175,10 @@ export const ProductOptionsUI = (props: any) => {
162
175
  justifyContent: 'space-between',
163
176
  width: '100%',
164
177
  marginTop: 10
178
+ },
179
+ wrapperNavbar: {
180
+ paddingHorizontal: 40,
181
+ paddingTop: 0,
165
182
  }
166
183
  });
167
184
 
@@ -169,6 +186,7 @@ export const ProductOptionsUI = (props: any) => {
169
186
  const [, t] = useLanguage();
170
187
  const [orderState] = useOrder();
171
188
  const [{ auth }] = useSession();
189
+ const [{ configs }] = useConfig()
172
190
  const { product, loading, error } = productObject;
173
191
  const [gallery, setGallery] = useState([])
174
192
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
@@ -188,6 +206,19 @@ export const ProductOptionsUI = (props: any) => {
188
206
  const [summaryRefHeight, setSummaryRefHeight] = useState(0)
189
207
  const [isScrollAvailable, setIsScrollAvailable] = useState(null)
190
208
  const [editionsLayoutY, setEditionsLayoutY] = useState(null)
209
+ const [viewedProduct, setViewedProduct] = useState<any>(null)
210
+ const [showTitle, setShowTitle] = useState(false)
211
+
212
+ const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
213
+ const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
214
+
215
+ const vibrateApp = (impact?: string) => {
216
+ const options = {
217
+ enableVibrateFallback: true,
218
+ ignoreAndroidSystemSettings: false
219
+ };
220
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
221
+ }
191
222
 
192
223
  const isError = (id: number) => {
193
224
  let bgColor = theme.colors.white;
@@ -204,11 +235,12 @@ export const ProductOptionsUI = (props: any) => {
204
235
  };
205
236
 
206
237
  const handleSaveProduct = () => {
238
+ Vibration.vibrate()
207
239
  if (!productCart.quantity) {
208
240
  showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
209
241
  return
210
242
  }
211
- const isErrors = Object.values(errors).length > 0;
243
+ const isErrors = Object.values(errors)?.length > 0;
212
244
  if (!isErrors) {
213
245
  handleSave && handleSave();
214
246
  return;
@@ -227,7 +259,7 @@ export const ProductOptionsUI = (props: any) => {
227
259
  };
228
260
 
229
261
  const handleChangeMainIndex = (index: number) => {
230
- if (index < 0 || index > gallery.length - 1) {
262
+ if (index < 0 || index > gallery?.length - 1) {
231
263
  setThumbsSwiper(0)
232
264
  return
233
265
  }
@@ -270,7 +302,7 @@ export const ProductOptionsUI = (props: any) => {
270
302
  }
271
303
 
272
304
  const scrollDown = (id: any) => {
273
- const isErrors = Object.values(errors).length > 0
305
+ const isErrors = Object.values(errors)?.length > 0
274
306
  if (!isErrors) {
275
307
  return
276
308
  }
@@ -284,6 +316,11 @@ export const ProductOptionsUI = (props: any) => {
284
316
  }
285
317
  }
286
318
 
319
+ const handleUpdateGuest = () => {
320
+ const guestToken = uuid.v4()
321
+ if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
322
+ }
323
+
287
324
  const handleOnLayout = (event: any, optionId: any) => {
288
325
  const _optionLayout = { ...optionLayout }
289
326
  const optionKey = 'id:' + optionId
@@ -294,9 +331,9 @@ export const ProductOptionsUI = (props: any) => {
294
331
  const saveErrors =
295
332
  orderState.loading ||
296
333
  maxProductQuantity === 0 ||
297
- Object.keys(errors).length > 0;
334
+ Object.keys(errors)?.length > 0;
335
+
298
336
 
299
-
300
337
  const ExtraOptions = ({ eID, options }: any) => (
301
338
  <>
302
339
  {options.map(({ id, name, respect_to, suboptions }: any) => (
@@ -336,7 +373,7 @@ export const ProductOptionsUI = (props: any) => {
336
373
  );
337
374
 
338
375
  const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
339
-
376
+ setShowTitle(contentOffset.y > 30)
340
377
  const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
341
378
  if (_topOption) {
342
379
  const _topOptionId = Number(_topOption.replace('id:', ''))
@@ -357,15 +394,18 @@ export const ProductOptionsUI = (props: any) => {
357
394
  useEffect(() => {
358
395
  const imageList: any = []
359
396
  const videoList: any = []
360
- product?.images?.length > 0 ? imageList.push(product.images) : imageList.push(theme?.images?.dummies?.product)
361
- if (product?.gallery && product?.gallery.length > 0) {
397
+ imageList.push(product?.images?.length > 0
398
+ ? product.images
399
+ : theme?.images?.dummies?.product)
400
+
401
+ if (product?.gallery && product?.gallery?.length > 0) {
362
402
  for (const img of product?.gallery) {
363
403
  if (img?.file) {
364
404
  imageList.push(img?.file)
365
405
  }
366
406
  if (img?.video) {
367
407
  const keys = img?.video.split('/')
368
- let _videoId = keys[keys.length - 1]
408
+ let _videoId = keys[keys?.length - 1]
369
409
 
370
410
  if (_videoId.includes('watch')) {
371
411
  const __url = _videoId.split('=')[1]
@@ -380,7 +420,7 @@ export const ProductOptionsUI = (props: any) => {
380
420
  } else if (_videoId.search(/\?/i) >= 0) {
381
421
  _videoId = _videoId.split('?')[0]
382
422
  }
383
- if ((_videoId.length === 11)) {
423
+ if ((_videoId?.length === 11)) {
384
424
  videoList.push(_videoId)
385
425
  }
386
426
  }
@@ -459,9 +499,22 @@ export const ProductOptionsUI = (props: any) => {
459
499
  height: 44,
460
500
  borderColor: theme.colors.primary,
461
501
  backgroundColor: theme.colors.white,
502
+ paddingLeft: 0,
503
+ paddingRight: 0
462
504
  }}
463
505
  />
464
506
  )}
507
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
508
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
509
+ {actionStatus?.loading ? (
510
+ <Placeholder Animation={Fade}>
511
+ <PlaceholderLine width={60} height={20} />
512
+ </Placeholder>
513
+ ) : (
514
+ <OText color={theme.colors.primary} size={13}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
515
+ )}
516
+ </TouchableOpacity>
517
+ )}
465
518
  </View>
466
519
  )
467
520
  }
@@ -475,14 +528,34 @@ export const ProductOptionsUI = (props: any) => {
475
528
  }
476
529
  }, [])
477
530
 
531
+ useEffect(() => {
532
+ if (!product?.id || product?.id === viewedProduct?.id) return
533
+ setViewedProduct(product)
534
+ events.emit('product_viewed', product)
535
+ }, [product?.id, viewedProduct])
478
536
 
479
537
  return (
480
538
  <SafeAreaView style={{ flex: 1 }}>
481
- <TopHeader>
482
- <TopActions onPress={() => handleGoBack()}>
483
- <IconAntDesign name='arrowleft' size={26} />
484
- </TopActions>
485
- </TopHeader>
539
+ <View style={styles.wrapperNavbar}>
540
+ <TopHeader>
541
+ <>
542
+ <TopActions onPress={() => handleGoBack()}>
543
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
544
+ </TopActions>
545
+ {showTitle && (
546
+ <OText
547
+ size={16}
548
+ style={{ flex: 1, textAlign: 'center' }}
549
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
550
+ numberOfLines={2}
551
+ ellipsizeMode='tail'
552
+ >
553
+ {product?.name}
554
+ </OText>
555
+ )}
556
+ </>
557
+ </TopHeader>
558
+ </View>
486
559
  {!error && (
487
560
  <ScrollView
488
561
  ref={scrollViewRef}
@@ -531,14 +604,14 @@ export const ProductOptionsUI = (props: any) => {
531
604
  </View>
532
605
  }
533
606
  >
534
- {gallery && gallery.length > 0 && gallery.map((img, i) => (
607
+ {gallery && gallery?.length > 0 && gallery.map((img, i) => (
535
608
  <View
536
609
  style={styles.slide1}
537
610
  key={i}
538
611
  >
539
- {String(img).includes('image') || typeof img === 'number' ? (
612
+ {(String(img).includes('http') || typeof img === 'number') ? (
540
613
  <FastImage
541
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 3 / 2 }}
614
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
542
615
  source={typeof img !== 'number' ? {
543
616
  uri: optimizeImage(img, 'h_1024,c_limit'),
544
617
  priority: FastImage.priority.normal,
@@ -547,7 +620,8 @@ export const ProductOptionsUI = (props: any) => {
547
620
  ) : (
548
621
  <>
549
622
  <YoutubePlayer
550
- height={300}
623
+ height={'100%'}
624
+ width={'100%'}
551
625
  play={playing}
552
626
  videoId={img}
553
627
  onChangeState={onStateChange}
@@ -565,7 +639,7 @@ export const ProductOptionsUI = (props: any) => {
565
639
  paddingVertical: 15
566
640
  }}
567
641
  >
568
- {gallery.length > 0 && gallery.map((img, index) => (
642
+ {gallery?.length > 1 && gallery.map((img, index) => (
569
643
  <TouchableOpacity
570
644
  key={index}
571
645
  onPress={() => handleClickThumb(index)}
@@ -578,7 +652,7 @@ export const ProductOptionsUI = (props: any) => {
578
652
  opacity: index === thumbsSwiper ? 1 : 0.8
579
653
  }}
580
654
  >
581
- {String(img).includes('image') ? (
655
+ {String(img).includes('http') ? (
582
656
  <OIcon
583
657
  url={img}
584
658
  style={{
@@ -593,7 +667,7 @@ export const ProductOptionsUI = (props: any) => {
593
667
  />
594
668
  ) : (
595
669
  <OIcon
596
- url={'http://img.youtube.com/vi/' + img + '/0.jpg'}
670
+ url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
597
671
  style={{
598
672
  borderColor: theme.colors.lightGray,
599
673
  borderRadius: 8,
@@ -613,7 +687,10 @@ export const ProductOptionsUI = (props: any) => {
613
687
  </>
614
688
  )}
615
689
  </WrapHeader>
616
- <ProductSummary onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}>
690
+ <ProductSummary
691
+ ph={isChewLayout ? 20 : 40}
692
+ onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
693
+ >
617
694
  <ProductTitle>
618
695
  {loading && !product ? (
619
696
  <Placeholder Animation={Fade}>
@@ -713,11 +790,11 @@ export const ProductOptionsUI = (props: any) => {
713
790
  marginBottom: 20,
714
791
  borderBottomWidth: 1,
715
792
  borderBottomColor: theme.colors.border,
716
- marginHorizontal: 30,
793
+ marginHorizontal: isChewLayout ? 20 : 30,
717
794
  backgroundColor: theme.colors.backgroundPage,
718
795
  }}
719
796
  >
720
- {product?.ingredients.length > 0 && (
797
+ {product?.ingredients?.length > 0 && (
721
798
  <TouchableOpacity
722
799
  key={`eopt_key_01`}
723
800
  onPress={() => {
@@ -742,7 +819,7 @@ export const ProductOptionsUI = (props: any) => {
742
819
  </OText>
743
820
  </TouchableOpacity>
744
821
  )}
745
- {product?.extras.map((extra: any) =>
822
+ {product?.extras?.map((extra: any) =>
746
823
  <ExtraOptions key={extra.id} options={extra.options} />
747
824
  )}
748
825
  </ExtraOptionWrap>
@@ -787,12 +864,13 @@ export const ProductOptionsUI = (props: any) => {
787
864
  </>
788
865
  ) : (
789
866
  <ProductEditions
867
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
790
868
  onLayout={(event: any) => {
791
869
  setEditionsLayoutY(event.nativeEvent.layout?.y)
792
870
  }}
793
871
  >
794
872
  <>
795
- {product?.ingredients.length > 0 && (
873
+ {product?.ingredients?.length > 0 && (
796
874
  <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
797
875
  <SectionTitle>
798
876
  <OText size={16}>
@@ -814,8 +892,8 @@ export const ProductOptionsUI = (props: any) => {
814
892
  </WrapperIngredients>
815
893
  </View>
816
894
  )}
817
- {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
818
- extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
895
+ {product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
896
+ extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
819
897
  const currentState =
820
898
  productCart.options[`id:${option.id}`] || {};
821
899
  return (
@@ -831,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
831
909
  backgroundColor: isError(option.id),
832
910
  borderRadius: 7.6
833
911
  }}>
834
- {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
912
+ {option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
835
913
  (suboption: any) => {
836
914
  const currentState =
837
915
  productCart.options[
@@ -896,7 +974,7 @@ export const ProductOptionsUI = (props: any) => {
896
974
  )}
897
975
  </ProductEditions>
898
976
  )}
899
- {!!error && error.length > 0 && (
977
+ {!!error && error?.length > 0 && (
900
978
  <NotFoundSource content={error[0]?.message || error[0]} />
901
979
  )}
902
980
  </ScrollView>
@@ -919,7 +997,7 @@ export const ProductOptionsUI = (props: any) => {
919
997
  disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || ((productCart?.quantity + productAddedToCartLength) <= product?.minimum_per_order)}>
920
998
  <OIcon
921
999
  src={theme.images.general.minus}
922
- width={16}
1000
+ width={20}
923
1001
  color={
924
1002
  productCart.quantity === 1 || isSoldOut
925
1003
  ? theme.colors.backgroundGray
@@ -940,7 +1018,8 @@ export const ProductOptionsUI = (props: any) => {
940
1018
  borderRadius: 8,
941
1019
  borderColor: theme.colors.inputBorderColor,
942
1020
  height: 44,
943
- marginHorizontal: 10
1021
+ marginHorizontal: 10,
1022
+ fontSize: 16
944
1023
  }}
945
1024
  />
946
1025
  )}
@@ -963,7 +1042,7 @@ export const ProductOptionsUI = (props: any) => {
963
1042
  }>
964
1043
  <OIcon
965
1044
  src={theme.images.general.plus}
966
- width={16}
1045
+ width={20}
967
1046
  color={
968
1047
  maxProductQuantity <= 0 ||
969
1048
  (productCart?.quantity + productAddedToCartLength) >= maxProductQuantity ||
@@ -8,8 +8,8 @@ export const WrapHeader = styled.View`
8
8
  export const TopActions = styled.TouchableOpacity`
9
9
  height: 60px;
10
10
  justify-content: center;
11
- padding-horizontal: 30px;
12
- width: 100px;
11
+ min-width: 30px;
12
+ padding-right: 15px;
13
13
  `;
14
14
 
15
15
  export const TopHeader = styled.View`
@@ -44,12 +44,10 @@ export const ProductTitle = styled.View`
44
44
  padding-bottom: 7px;
45
45
  `
46
46
 
47
- export const ProductDescription = styled.View`
48
- margin-bottom: 20px;
49
- `
47
+ export const ProductDescription = styled.View``
50
48
 
51
49
  export const ProductEditions = styled.View`
52
- padding: 0 40px;
50
+ padding-vertical: 0;
53
51
  `
54
52
 
55
53
  export const SectionTitle = styled.View`
@@ -96,7 +94,7 @@ export const WeightUnitItem = styled.View`
96
94
  `}
97
95
  `
98
96
  export const ProductSummary = styled.View`
99
- padding: 26px 40px;
97
+ padding: 26px ${(props: any) => props.ph}px 0;
100
98
  position: relative;
101
99
  background-color: white;
102
100
  z-index: 100;
@@ -27,6 +27,7 @@ import { ProductItemAccordionParams } from '../../types'
27
27
  export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
28
28
 
29
29
  const {
30
+ isDisabledEdit,
30
31
  isCartPending,
31
32
  isCartProduct,
32
33
  product,
@@ -203,7 +204,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
203
204
  </View>
204
205
  ) : (
205
206
  <>
206
- {isCartProduct && !isCartPending && getProductMax && (
207
+ {!isDisabledEdit && isCartProduct && !isCartPending && getProductMax && (
207
208
  <ProductInfo>
208
209
  <RNPickerSelect
209
210
  items={productOptions}
@@ -225,23 +226,23 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
225
226
  </ProductQuantity>
226
227
  )}
227
228
  <View style={{ flex: 1 }}>
228
- <OText size={12} lineHeight={18} weight={'400'}>{product.name}</OText>
229
+ <OText size={12} lineHeight={18} weight={'400'} mLeft={8}>{product.name}</OText>
229
230
  </View>
230
231
  </>
231
232
  )}
232
233
  <View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end', maxWidth: 100 }}>
233
234
  <View style={{ flexDirection: 'row' }}>
234
235
  <OText size={12} lineHeight={18} weight={'400'}>{parsePrice(product.total || product.price)}</OText>
235
- {(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || product.comment) && (
236
+ {(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || !!product.comment) && (
236
237
  <MaterialCommunityIcon name='chevron-down' size={18} />
237
238
  )}
238
239
  </View>
239
- <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'flex-start' }}>
240
- {onEditProduct && isCartProduct && !isCartPending && product?.valid_menu && (
241
- <TouchableOpacity onPress={() => handleEditProduct(product)} style={{ marginEnd: 7 }}>
242
- <OIcon
243
- src={theme.images.general.pencil}
244
- width={16}
240
+ <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', height: 20 }}>
241
+ {!isDisabledEdit && onEditProduct && isCartProduct && !isCartPending && product?.valid_menu && (
242
+ <TouchableOpacity onPress={() => handleEditProduct(product)} style={{ marginRight: 5 }}>
243
+ <MaterialCommunityIcon
244
+ name='pencil-outline'
245
+ size={20}
245
246
  color={theme.colors.textSecondary}
246
247
  />
247
248
  </TouchableOpacity>
@@ -252,9 +253,9 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
252
253
  message={t('QUESTION_DELETE_PRODUCT', 'Are you sure that you want to delete the product?')}
253
254
  onAccept={() => onDeleteProduct(product)}
254
255
  >
255
- <OIcon
256
- src={theme.images.general.trash}
257
- width={17}
256
+ <MaterialCommunityIcon
257
+ name='trash-can-outline'
258
+ size={20}
258
259
  color={theme.colors.textSecondary}
259
260
  />
260
261
  </OAlert>
@@ -305,7 +306,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
305
306
  ))}
306
307
  </ProductOptionsList>
307
308
  )}
308
- {product.comment && (
309
+ {!!product.comment && (
309
310
  <ProductComment>
310
311
  <OText size={10} color={theme.colors.textSecondary}>{t('SPECIAL_COMMENT', 'Special Comment')}</OText>
311
312
  <OText size={10} color={theme.colors.textThird}>{product.comment}</OText>
@@ -6,6 +6,7 @@ import {
6
6
  } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native';
8
8
  import { StyleSheet, View } from 'react-native'
9
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
9
10
 
10
11
  import {
11
12
  Container,
@@ -31,15 +32,18 @@ export const ProductOptionSubOptionUI = (props: any) => {
31
32
  setIsScrollAvailable
32
33
  } = props
33
34
 
34
- const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
35
+ const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max || state.quantity === suboption?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
35
36
  const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
36
-
37
+
37
38
  const theme = useTheme();
38
39
  const [, t] = useLanguage()
39
40
  const [{ parsePrice }] = useUtils()
40
41
  const [showMessage, setShowMessage] = useState(false)
41
42
  const [isDirty, setIsDirty] = useState(false)
42
43
 
44
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
45
+ const iconsSize = isChewLayout ? 20 : 16
46
+
43
47
  const handleSuboptionClick = () => {
44
48
  toggleSelect()
45
49
  setIsDirty(true)
@@ -64,7 +68,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
64
68
 
65
69
  return (
66
70
  <View>
67
- <Container onPress={() => handleSuboptionClick()}>
71
+ <Container onPress={!(option?.with_half_option || option?.allow_suboption_quantity) ? () => handleSuboptionClick() : null}>
68
72
  <IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
69
73
  {((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
70
74
  state?.selected ? (
@@ -87,9 +91,9 @@ export const ProductOptionSubOptionUI = (props: any) => {
87
91
  {option?.allow_suboption_quantity && state?.selected && (
88
92
  <>
89
93
  <Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
90
- <OIcon
91
- src={theme.images.general.minus}
92
- width={16}
94
+ <IconAntDesign
95
+ name='minuscircleo'
96
+ size={iconsSize}
93
97
  color={state.quantity === 0 || disabled ? theme.colors.disabled : theme.colors.primary}
94
98
  />
95
99
  </Checkbox>
@@ -97,9 +101,9 @@ export const ProductOptionSubOptionUI = (props: any) => {
97
101
  {state.quantity}
98
102
  </OText>
99
103
  <Checkbox disabled={disabled || disableIncrement} onPress={increment}>
100
- <OIcon
101
- src={theme.images.general.plus}
102
- width={16}
104
+ <IconAntDesign
105
+ name='pluscircleo'
106
+ size={iconsSize}
103
107
  color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
104
108
  />
105
109
  </Checkbox>
@@ -135,12 +139,16 @@ export const ProductOptionSubOptionUI = (props: any) => {
135
139
  )}
136
140
  </PositionControl>
137
141
  {price > 0 && (
138
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
142
+ <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ paddingRight: 10 }}>
139
143
  + {parsePrice(price)}
140
144
  </OText>
141
145
  )}
142
146
  </Container>
143
- {showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
147
+ {showMessage && (
148
+ <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>
149
+ {`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}
150
+ </OText>
151
+ )}
144
152
  </View>
145
153
  )
146
154
  }
@@ -4,12 +4,12 @@ export const Container = styled.TouchableOpacity`
4
4
  flex-direction: row;
5
5
  align-items: center;
6
6
  justify-content: space-between;
7
- padding: 10px;
8
7
  width: 100%;
9
8
  `
10
9
 
11
10
  export const IconControl = styled.TouchableOpacity`
12
11
  flex-direction: row;
12
+ padding: 10px;
13
13
  width: 45%;
14
14
  align-items: center;
15
15
  `
@@ -21,7 +21,6 @@ export const QuantityControl = styled.View`
21
21
  margin-horizontal: 5px;
22
22
  flex: 1;
23
23
  width: 60px;
24
-
25
24
  `
26
25
 
27
26
  export const PositionControl = styled.View`