ordering-ui-react-native 0.14.30 → 0.14.32-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 (62) hide show
  1. package/package.json +2 -2
  2. package/src/components/BusinessItemAccordion/index.tsx +2 -2
  3. package/src/components/BusinessProductsListing/index.tsx +10 -26
  4. package/src/components/Cart/index.tsx +136 -62
  5. package/src/components/Cart/styles.tsx +7 -0
  6. package/src/components/Checkout/index.tsx +10 -6
  7. package/src/components/LogoutButton/index.tsx +14 -0
  8. package/src/components/OrderDetails/index.tsx +102 -34
  9. package/src/components/OrderDetails/styles.tsx +7 -0
  10. package/src/components/OrderSummary/index.tsx +142 -58
  11. package/src/components/OrderSummary/styles.tsx +10 -2
  12. package/src/components/ProductForm/index.tsx +47 -10
  13. package/src/components/ProductForm/styles.tsx +1 -1
  14. package/src/components/SingleProductCard/index.tsx +1 -1
  15. package/src/components/TaxInformation/index.tsx +58 -26
  16. package/src/components/UpsellingProducts/index.tsx +13 -31
  17. package/src/components/VerifyPhone/styles.tsx +1 -2
  18. package/src/navigators/HomeNavigator.tsx +6 -0
  19. package/src/pages/ProductDetails.tsx +55 -0
  20. package/src/types/index.tsx +2 -0
  21. package/src/types/react-native-color-matrix-image-filters/index.d.ts +1 -0
  22. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  23. package/themes/doordash/src/components/ProductForm/index.tsx +41 -2
  24. package/themes/doordash/src/components/ProductForm/styles.tsx +1 -1
  25. package/themes/instacart/src/components/ProductForm/index.tsx +40 -1
  26. package/themes/instacart/src/components/ProductForm/styles.tsx +1 -1
  27. package/themes/kiosk/src/components/Cart/index.tsx +14 -21
  28. package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
  29. package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
  30. package/themes/kiosk/src/components/Intro/index.tsx +4 -4
  31. package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
  32. package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
  33. package/themes/original/index.tsx +4 -0
  34. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  35. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
  36. package/themes/original/src/components/BusinessPreorder/index.tsx +37 -34
  37. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  38. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -0
  39. package/themes/original/src/components/BusinessProductsListing/index.tsx +16 -47
  40. package/themes/original/src/components/BusinessesListing/index.tsx +100 -75
  41. package/themes/original/src/components/Cart/index.tsx +10 -31
  42. package/themes/original/src/components/Checkout/index.tsx +2 -0
  43. package/themes/original/src/components/Checkout/styles.tsx +1 -0
  44. package/themes/original/src/components/DriverTips/index.tsx +3 -3
  45. package/themes/original/src/components/DriverTips/styles.tsx +5 -5
  46. package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
  47. package/themes/original/src/components/Help/index.tsx +1 -1
  48. package/themes/original/src/components/Home/index.tsx +5 -3
  49. package/themes/original/src/components/LoginForm/index.tsx +50 -49
  50. package/themes/original/src/components/MessageListing/index.tsx +4 -2
  51. package/themes/original/src/components/OrderDetails/index.tsx +3 -1
  52. package/themes/original/src/components/OrderSummary/index.tsx +11 -30
  53. package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -6
  54. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -0
  55. package/themes/original/src/components/ProductForm/index.tsx +113 -88
  56. package/themes/original/src/components/ProductForm/styles.tsx +10 -3
  57. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  58. package/themes/original/src/components/SingleProductCard/index.tsx +22 -13
  59. package/themes/original/src/components/SingleProductCard/styles.tsx +6 -0
  60. package/themes/original/src/components/UpsellingProducts/index.tsx +85 -83
  61. package/themes/original/src/types/index.tsx +7 -1
  62. package/themes/uber-eats/src/components/ProductForm/index.tsx +43 -2
@@ -436,59 +436,60 @@ const LoginFormUI = (props: LoginParams) => {
436
436
  </>
437
437
  )}
438
438
 
439
- <View
440
- style={{
441
- flexDirection: 'row',
442
- width: '100%',
443
- justifyContent: 'space-between',
444
- alignItems: 'center',
445
- marginVertical: 15
446
- }}>
447
- <View style={loginStyle.line} />
448
- <OText
449
- size={14}
450
- mBottom={10}
451
- style={{ paddingHorizontal: 19 }}
452
- color={theme.colors.disabled}>
453
- {t('OR', 'or')}
454
- </OText>
455
- <View style={loginStyle.line} />
456
- </View>
457
-
458
439
  {configs && Object.keys(configs).length > 0 ? (
459
440
  (((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
460
441
  (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null)) &&
461
442
  (
462
- <ButtonsWrapper>
463
- <SocialButtons>
464
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
465
- configs?.facebook_id?.value && (
466
- <FacebookLogin
467
- notificationState={notificationState}
468
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
469
- handleLoading={(val: boolean) => setIsFBLoading(val)}
470
- handleSuccessFacebookLogin={handleSuccessFacebook}
471
- />
472
- )}
473
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
474
- <GoogleLogin
475
- notificationState={notificationState}
476
- webClientId={configs?.google_login_client_id?.value}
477
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
478
- handleLoading={(val: boolean) => setIsFBLoading(val)}
479
- handleSuccessGoogleLogin={handleSuccessFacebook}
480
- />
481
- )}
482
- {(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
483
- <AppleLogin
484
- notificationState={notificationState}
485
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
486
- handleLoading={(val: boolean) => setIsFBLoading(val)}
487
- handleSuccessAppleLogin={handleSuccessFacebook}
488
- />
489
- )}
490
- </SocialButtons>
491
- </ButtonsWrapper>
443
+ <>
444
+ <View
445
+ style={{
446
+ flexDirection: 'row',
447
+ width: '100%',
448
+ justifyContent: 'space-between',
449
+ alignItems: 'center',
450
+ marginVertical: 15
451
+ }}>
452
+ <View style={loginStyle.line} />
453
+ <OText
454
+ size={14}
455
+ mBottom={10}
456
+ style={{ paddingHorizontal: 19 }}
457
+ color={theme.colors.disabled}>
458
+ {t('OR', 'or')}
459
+ </OText>
460
+ <View style={loginStyle.line} />
461
+ </View>
462
+ <ButtonsWrapper>
463
+ <SocialButtons>
464
+ {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
465
+ configs?.facebook_id?.value && (
466
+ <FacebookLogin
467
+ notificationState={notificationState}
468
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
469
+ handleLoading={(val: boolean) => setIsFBLoading(val)}
470
+ handleSuccessFacebookLogin={handleSuccessFacebook}
471
+ />
472
+ )}
473
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
474
+ <GoogleLogin
475
+ notificationState={notificationState}
476
+ webClientId={configs?.google_login_client_id?.value}
477
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
478
+ handleLoading={(val: boolean) => setIsFBLoading(val)}
479
+ handleSuccessGoogleLogin={handleSuccessFacebook}
480
+ />
481
+ )}
482
+ {(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
483
+ <AppleLogin
484
+ notificationState={notificationState}
485
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
486
+ handleLoading={(val: boolean) => setIsFBLoading(val)}
487
+ handleSuccessAppleLogin={handleSuccessFacebook}
488
+ />
489
+ )}
490
+ </SocialButtons>
491
+ </ButtonsWrapper>
492
+ </>
492
493
  )
493
494
  ) : (
494
495
  <SkeletonWrapper>
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller } from 'ordering-components/native'
2
+ import { useLanguage, useOrder, ToastType, useToast, OrderList, OrderDetails as OrderDetailsConTableoller, useBusiness } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
5
5
  import { OText, OModal } from '../shared'
@@ -214,6 +214,7 @@ const OrderMessageUI = (props: any) => {
214
214
  }
215
215
 
216
216
  export const OrderListing = (props: OrdersOptionParams) => {
217
+ const [businessState] = useBusiness();
217
218
  const OrderListingProps = {
218
219
  ...props,
219
220
  UIComponent: OrdersOptionUI,
@@ -224,6 +225,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
224
225
  pageSize: 10,
225
226
  controlType: 'infinity'
226
227
  },
228
+ businessId: businessState?.business?.id,
227
229
  profileMessages: true,
228
230
  orderBy: 'last_direct_message_at',
229
231
  orderDirection: 'asc'
@@ -287,6 +289,7 @@ export const MessageListing = (props: MessageListingParams) => {
287
289
  setSelectedOrderId={setSelectedOrderId}
288
290
  setOrderList={setOrderListStatus}
289
291
  setOpenMessges={setOpenMessges}
292
+ franchiseId={props.franchiseId}
290
293
  />
291
294
  {openMessages && seletedOrder && (
292
295
  <OModal
@@ -304,4 +307,3 @@ export const MessageListing = (props: MessageListingParams) => {
304
307
  </MessageListingWrapper>
305
308
  )
306
309
  }
307
-
@@ -611,7 +611,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
611
611
  <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
612
612
  {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
613
613
  </OText>
614
- <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.delivery_option?.name ?? t('EITHER_WAY', 'Either way')}</OText>
614
+ <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
615
+ {order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
616
+ </OText>
615
617
  </View>
616
618
  )}
617
619
  {order?.comment && (
@@ -20,7 +20,6 @@ import {
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
22
  import { OInput, OModal, OText } from '../shared';
23
- import { ProductForm } from '../ProductForm';
24
23
  import { verifyDecimals } from '../../utils';
25
24
  import AntIcon from 'react-native-vector-icons/AntDesign'
26
25
  import { TaxInformation } from '../TaxInformation';
@@ -35,7 +34,8 @@ const OrderSummaryUI = (props: any) => {
35
34
  isCartPending,
36
35
  isFromCheckout,
37
36
  commentState,
38
- handleChangeComment
37
+ handleChangeComment,
38
+ onNavigationRedirect
39
39
  } = props;
40
40
 
41
41
  const theme = useTheme()
@@ -44,8 +44,6 @@ const OrderSummaryUI = (props: any) => {
44
44
  const [orderState] = useOrder();
45
45
  const [{ parsePrice, parseNumber }] = useUtils();
46
46
  const [validationFields] = useValidationFields();
47
- const [openProduct, setModalIsOpen] = useState(false)
48
- const [curProduct, setCurProduct] = useState<any>(null)
49
47
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null })
50
48
 
51
49
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
@@ -55,14 +53,15 @@ const OrderSummaryUI = (props: any) => {
55
53
  }
56
54
 
57
55
  const handleEditProduct = (product: any) => {
58
- setCurProduct(product)
59
- setModalIsOpen(true)
60
- }
61
-
62
- const handlerProductAction = (product: any) => {
63
- if (Object.keys(product).length) {
64
- setModalIsOpen(false)
65
- }
56
+ onNavigationRedirect('ProductDetails', {
57
+ isCartProduct: true,
58
+ productCart: product,
59
+ businessSlug: cart?.business?.slug,
60
+ businessId: cart?.business_id,
61
+ categoryId: product?.category_id,
62
+ productId: product?.id,
63
+ isFromCheckout: isFromCheckout,
64
+ })
66
65
  }
67
66
 
68
67
  const getIncludedTaxes = () => {
@@ -242,24 +241,6 @@ const OrderSummaryUI = (props: any) => {
242
241
  )}
243
242
  </OSBill>
244
243
  )}
245
- <OModal
246
- open={openProduct}
247
- entireModal
248
- customClose
249
- onClose={() => setModalIsOpen(false)}
250
- >
251
- <ProductForm
252
- isCartProduct
253
- productCart={curProduct}
254
- businessSlug={cart?.business?.slug}
255
- businessId={cart?.business_id}
256
- categoryId={curProduct?.category_id}
257
- productId={curProduct?.id}
258
- onSave={handlerProductAction}
259
- onClose={() => setModalIsOpen(false)}
260
- isFromCheckout={isFromCheckout}
261
- />
262
- </OModal>
263
244
  <OModal
264
245
  open={openTaxModal.open}
265
246
  onClose={() => setOpenTaxModal({ open: false, data: null })}
@@ -7,6 +7,7 @@ import {
7
7
  PaymentOptionWallet as PaymentOptionWalletController,
8
8
  useLanguage,
9
9
  useUtils,
10
+ useOrder
10
11
  } from 'ordering-components/native'
11
12
 
12
13
  import {
@@ -18,7 +19,7 @@ import { OText } from '../shared'
18
19
 
19
20
  const PaymentOptionWalletUI = (props: any) => {
20
21
  const {
21
- cart,
22
+ businessId,
22
23
  walletsState,
23
24
  selectWallet,
24
25
  deletetWalletSelected
@@ -26,8 +27,11 @@ const PaymentOptionWalletUI = (props: any) => {
26
27
 
27
28
  const theme = useTheme()
28
29
  const [, t] = useLanguage()
30
+ const [{ carts }] = useOrder()
29
31
  const [{ parsePrice }] = useUtils()
30
32
 
33
+ const cart = carts?.[`businessId:${businessId}`] ?? {}
34
+
31
35
  const styles = StyleSheet.create({
32
36
  checkBoxStyle: {
33
37
  width: 25,
@@ -65,10 +69,10 @@ const PaymentOptionWalletUI = (props: any) => {
65
69
  };
66
70
 
67
71
  useEffect(() => {
68
- if (!walletsState.loading) {
72
+ if (!walletsState.loading && walletsState.result?.length) {
69
73
  setCheckedState(
70
- walletsState.result.map((wallet: any) => {
71
- return !!cart?.wallets?.find((w: any) => w.id === wallet.id)
74
+ walletsState.result?.map((wallet: any) => {
75
+ return !!cart?.payment_events?.find((w: any) => w.wallet_id === wallet.id)
72
76
  })
73
77
  )
74
78
  }
@@ -101,7 +105,7 @@ const PaymentOptionWalletUI = (props: any) => {
101
105
  onTintColor={theme.colors.primary}
102
106
  style={Platform.OS === 'ios' && styles.checkBoxStyle}
103
107
  />
104
- <View style={{ alignItems: 'baseline' }}>
108
+ <View style={{ alignItems: 'baseline', marginLeft: 5 }}>
105
109
  <View>
106
110
  <OText
107
111
  style={((cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0) ?{
@@ -114,7 +118,7 @@ const PaymentOptionWalletUI = (props: any) => {
114
118
  </View>
115
119
  </SectionLeft>
116
120
 
117
- <View style={{maxWidth: '40%', alignItems: 'flex-end' }}>
121
+ <View style={{maxWidth: '35%', alignItems: 'flex-end' }}>
118
122
  {wallet.type === 'cash' && (
119
123
  <OText>
120
124
  {parsePrice(wallet?.balance)}
@@ -17,6 +17,7 @@ export const Container = styled.View`
17
17
  `
18
18
 
19
19
  export const SectionLeft = styled.View`
20
+ margin-left: 20px;
20
21
  max-width: 55%;
21
22
  display: flex;
22
23
  flex-direction: row;
@@ -16,10 +16,9 @@ import {
16
16
  Grayscale
17
17
  } from 'react-native-color-matrix-image-filters'
18
18
 
19
- import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, AppRegistry, I18nManager } from 'react-native';
19
+ import { View, TouchableOpacity, StyleSheet, Dimensions, I18nManager, SafeAreaView } from 'react-native';
20
20
 
21
21
  import {
22
- ProductHeader,
23
22
  WrapHeader,
24
23
  TopHeader,
25
24
  WrapContent,
@@ -33,16 +32,15 @@ import {
33
32
  ProductActions,
34
33
  ExtraOptionWrap,
35
34
  WeightUnitSwitch,
36
- WeightUnitItem
35
+ WeightUnitItem,
36
+ TopActions
37
37
  } from './styles';
38
38
  import { OButton, OIcon, OInput, OText } from '../shared';
39
39
  import { ScrollView } from 'react-native-gesture-handler';
40
40
  import { ProductOptionSubOption } from '../ProductOptionSubOption';
41
41
  import { NotFoundSource } from '../NotFoundSource';
42
42
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
43
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
44
43
  import { useState } from 'react';
45
- import { useWindowDimensions } from 'react-native';
46
44
 
47
45
  const windowHeight = Dimensions.get('window').height;
48
46
  const windowWidth = Dimensions.get('window').width;
@@ -63,8 +61,6 @@ export const ProductOptionsUI = (props: any) => {
63
61
  handleChangeSuboptionState,
64
62
  handleChangeCommentState,
65
63
  productObject,
66
- onClose,
67
- isFromCheckout,
68
64
  } = props;
69
65
 
70
66
  const theme = useTheme();
@@ -97,7 +93,7 @@ export const ProductOptionsUI = (props: any) => {
97
93
  },
98
94
  btnBackArrow: {
99
95
  borderWidth: 0,
100
- backgroundColor: 'rgba(0,0,0,0.3)',
96
+ backgroundColor: '#FFF',
101
97
  borderRadius: 24,
102
98
  marginRight: 15,
103
99
  },
@@ -135,6 +131,20 @@ export const ProductOptionsUI = (props: any) => {
135
131
  },
136
132
  unitItem: {
137
133
  fontSize: 12
134
+ },
135
+ productTagWrapper: {
136
+ flexDirection: 'row',
137
+ alignItems: 'center'
138
+ },
139
+ productTagImageStyle: {
140
+ width: 32,
141
+ height: 32,
142
+ borderRadius: 8,
143
+ resizeMode: 'cover'
144
+ },
145
+ productTagNameStyle: {
146
+ paddingHorizontal: 6,
147
+ marginRight: 5
138
148
  }
139
149
  });
140
150
 
@@ -146,15 +156,13 @@ export const ProductOptionsUI = (props: any) => {
146
156
  const [gallery, setGallery] = useState([])
147
157
  const [thumbsSwiper, setThumbsSwiper] = useState(0)
148
158
 
149
- const { top, bottom } = useSafeAreaInsets();
150
- const { height } = useWindowDimensions();
151
159
  const [selOpt, setSelectedOpt] = useState(0);
152
160
  const [isHaveWeight, setIsHaveWeight] = useState(false)
153
161
  const [qtyBy, setQtyBy] = useState({
154
162
  weight_unit: false,
155
163
  pieces: true
156
164
  })
157
- const [pricePerWeightUnit, setPricePerWeightUnit] = useState(null)
165
+ const [pricePerWeightUnit, setPricePerWeightUnit] = useState<any>(null)
158
166
 
159
167
  const swiperRef: any = useRef(null)
160
168
 
@@ -173,10 +181,8 @@ export const ProductOptionsUI = (props: any) => {
173
181
  };
174
182
 
175
183
  const handleSaveProduct = () => {
176
- console.log('----- click handle ------')
177
184
  const isErrors = Object.values(errors).length > 0;
178
185
  if (!isErrors) {
179
- console.log('----- save handle ------')
180
186
  handleSave && handleSave();
181
187
  return;
182
188
  }
@@ -206,7 +212,6 @@ export const ProductOptionsUI = (props: any) => {
206
212
  }
207
213
 
208
214
  const handleRedirectLogin = () => {
209
- onClose();
210
215
  navigation.navigate('Login');
211
216
  };
212
217
 
@@ -284,14 +289,16 @@ export const ProductOptionsUI = (props: any) => {
284
289
  </>
285
290
  );
286
291
 
292
+ const handleGoBack = navigation?.canGoBack()
293
+ ? () => navigation.goBack()
294
+ : () => navigation.navigate('Business', { store: props.businessSlug })
295
+
287
296
  return (
288
- <>
297
+ <SafeAreaView style={{ flex: 1 }}>
289
298
  <TopHeader>
290
- <TouchableOpacity
291
- style={styles.headerItem}
292
- onPress={onClose}>
293
- <OIcon src={theme.images.general.close} width={16} />
294
- </TouchableOpacity>
299
+ <TopActions onPress={() => handleGoBack()}>
300
+ <OIcon src={theme.images.general.arrow_left} width={15} />
301
+ </TopActions>
295
302
  </TopHeader>
296
303
  <ScrollView>
297
304
  {!error && (
@@ -342,15 +349,13 @@ export const ProductOptionsUI = (props: any) => {
342
349
  style={styles.slide1}
343
350
  key={i}
344
351
  >
345
- <Grayscale amount={isSoldOut ? 1 : 0}>
346
- <FastImage
347
- style={{ height: '100%' }}
348
- source={{
349
- uri: optimizeImage(img, 'h_258,c_limit'),
350
- priority: FastImage.priority.normal,
351
- }}
352
- />
353
- </Grayscale>
352
+ <FastImage
353
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
354
+ source={{
355
+ uri: optimizeImage(img, 'h_258,c_limit'),
356
+ priority: FastImage.priority.normal,
357
+ }}
358
+ />
354
359
  </View>
355
360
  ))}
356
361
  </Swiper>
@@ -374,19 +379,18 @@ export const ProductOptionsUI = (props: any) => {
374
379
  opacity: index === thumbsSwiper ? 1 : 0.8
375
380
  }}
376
381
  >
377
- <Grayscale amount={isSoldOut ? 1 : 0}>
378
- <OIcon
379
- url={img}
380
- style={{
381
- borderColor: theme.colors.lightGray,
382
- borderRadius: 8,
383
- minHeight: '100%'
384
- }}
385
- width={56}
386
- height={56}
387
- cover
388
- />
389
- </Grayscale>
382
+ <OIcon
383
+ url={img}
384
+ style={{
385
+ borderColor: theme.colors.lightGray,
386
+ borderRadius: 8,
387
+ minHeight: '100%',
388
+ opacity: isSoldOut ? 0.5 : 1
389
+ }}
390
+ width={56}
391
+ height={56}
392
+ cover
393
+ />
390
394
  </View>
391
395
  </TouchableOpacity>
392
396
 
@@ -418,23 +422,12 @@ export const ProductOptionsUI = (props: any) => {
418
422
  style={{ flex: 1, marginBottom: 10 }}>
419
423
  {product?.name || productCart.name}
420
424
  </OText>
421
- {product?.calories && (
425
+ {!!product?.calories && (
422
426
  <OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
423
427
  </OText>
424
428
  )}
425
429
  </View>
426
- <View style={{ flexDirection: 'row', marginBottom: 10 }}>
427
- <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
428
- {product?.offer_price && (
429
- <OText style={{ fontSize: 14,
430
- color: '#808080',
431
- textDecorationLine: 'line-through',
432
- marginLeft: 7,
433
- marginRight: 7
434
- }}>{parsePrice(product?.offer_price)}</OText>
435
- )}
436
- </View>
437
- {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (product?.estimated_person)) && (
430
+ {((!!product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (!!product?.estimated_person)) && (
438
431
  <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
439
432
  {
440
433
  ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
@@ -449,11 +442,20 @@ export const ProductOptionsUI = (props: any) => {
449
442
  </OText>
450
443
  )}
451
444
  {isHaveWeight ? (
452
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
445
+ <OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
453
446
  ) : (
454
- <OText size={16} lineHeight={24} color={theme.colors.textNormal}>
455
- {productCart.price ? parsePrice(productCart.price) : ''}
456
- </OText>
447
+ <View style={{ flexDirection: 'row', marginBottom: 10 }}>
448
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
449
+ {product?.offer_price !== null && product?.in_offer && (
450
+ <OText style={{
451
+ fontSize: 14,
452
+ color: '#808080',
453
+ textDecorationLine: 'line-through',
454
+ marginLeft: 7,
455
+ marginRight: 7
456
+ }}>{parsePrice(product?.offer_price)}</OText>
457
+ )}
458
+ </View>
457
459
  )}
458
460
  </>
459
461
  )}
@@ -463,6 +465,31 @@ export const ProductOptionsUI = (props: any) => {
463
465
  {product?.description || productCart?.description}
464
466
  </OText>
465
467
  </ProductDescription>
468
+ <ScrollView
469
+ horizontal
470
+ showsHorizontalScrollIndicator={false}
471
+ contentContainerStyle={{ paddingBottom: 30 }}
472
+ >
473
+ {product?.tags?.map((tag: any) => (
474
+ <View
475
+ key={tag.id}
476
+ style={styles.productTagWrapper}
477
+ >
478
+ {!!tag?.image ? (
479
+ <OIcon
480
+ url={optimizeImage(tag?.image, 'h_40,c_limit')}
481
+ style={styles.productTagImageStyle}
482
+ />
483
+ ) : (
484
+ <OIcon
485
+ src={theme.images?.dummies?.product}
486
+ style={styles.productTagImageStyle}
487
+ />
488
+ )}
489
+ <OText color={theme.colors.textSecondary} size={12} style={styles.productTagNameStyle}>{tag.name}</OText>
490
+ </View>
491
+ ))}
492
+ </ScrollView>
466
493
  {loading && !product ? (
467
494
  <>
468
495
  {[...Array(2)].map((item, i) => (
@@ -731,16 +758,12 @@ export const ProductOptionsUI = (props: any) => {
731
758
  </WrapContent>
732
759
  </View>
733
760
  )}
734
- {error && error.length > 0 && (
761
+ {!!error && error.length > 0 && (
735
762
  <NotFoundSource content={error[0]?.message || error[0]} />
736
763
  )}
737
764
  </ScrollView>
738
765
  {!loading && !error && product && (
739
- <ProductActions
740
- style={{
741
- paddingBottom: Platform.OS === 'ios' ? bottom + 30 : bottom + 80
742
- }}
743
- >
766
+ <ProductActions>
744
767
  <OText size={16} lineHeight={24} weight={'600'}>
745
768
  {productCart.total ? parsePrice(productCart?.total) : ''}
746
769
  </OText>
@@ -762,7 +785,7 @@ export const ProductOptionsUI = (props: any) => {
762
785
  <OText
763
786
  size={12}
764
787
  lineHeight={18}
765
- style={{ minWidth: 29, textAlign: 'center' }}
788
+ style={{ minWidth: 40, textAlign: 'center' }}
766
789
  >
767
790
  {qtyBy?.pieces && productCart.quantity}
768
791
  {qtyBy?.weight_unit && productCart.quantity * product?.weight}
@@ -786,36 +809,38 @@ export const ProductOptionsUI = (props: any) => {
786
809
  }
787
810
  />
788
811
  </TouchableOpacity>
789
- <WeightUnitSwitch>
790
- <TouchableOpacity
791
- onPress={() => handleSwitchQtyUnit('pieces')}
792
- >
793
- <WeightUnitItem active={qtyBy?.pieces}>
794
- <OText
795
- size={12}
796
- lineHeight={18}
797
- color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
798
- >
799
- {t('PIECES', 'pieces')}
800
- </OText>
801
- </WeightUnitItem>
802
- </TouchableOpacity>
803
- <View style={{ alignItems: 'flex-start' }}>
812
+ {isHaveWeight && (
813
+ <WeightUnitSwitch>
804
814
  <TouchableOpacity
805
- onPress={() => handleSwitchQtyUnit('weight_unit')}
815
+ onPress={() => handleSwitchQtyUnit('pieces')}
806
816
  >
807
- <WeightUnitItem active={qtyBy?.weight_unit}>
817
+ <WeightUnitItem active={qtyBy?.pieces}>
808
818
  <OText
809
819
  size={12}
810
820
  lineHeight={18}
811
- color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
821
+ color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
812
822
  >
813
- {product?.weight_unit}
823
+ {t('PIECES', 'pcs')}
814
824
  </OText>
815
825
  </WeightUnitItem>
816
826
  </TouchableOpacity>
817
- </View>
818
- </WeightUnitSwitch>
827
+ <View style={{ alignItems: 'flex-start' }}>
828
+ <TouchableOpacity
829
+ onPress={() => handleSwitchQtyUnit('weight_unit')}
830
+ >
831
+ <WeightUnitItem active={qtyBy?.weight_unit}>
832
+ <OText
833
+ size={12}
834
+ lineHeight={18}
835
+ color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
836
+ >
837
+ {product?.weight_unit}
838
+ </OText>
839
+ </WeightUnitItem>
840
+ </TouchableOpacity>
841
+ </View>
842
+ </WeightUnitSwitch>
843
+ )}
819
844
  </View>
820
845
  )}
821
846
  <View
@@ -884,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
884
909
  </View>
885
910
  </ProductActions>
886
911
  )}
887
- </>
912
+ </SafeAreaView>
888
913
  );
889
914
  };
890
915