ordering-ui-react-native 0.15.44 → 0.15.47

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.44",
3
+ "version": "0.15.47",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -99,7 +99,6 @@ export const PreviousOrders = (props: any) => {
99
99
  },
100
100
  });
101
101
 
102
-
103
102
  const getDelayMinutes = (order: any) => {
104
103
  // targetMin = delivery_datetime + eta_time - now()
105
104
  const offset = 300
@@ -108,7 +107,7 @@ export const PreviousOrders = (props: any) => {
108
107
  ? parseDate(order?.delivery_datetime_utc)
109
108
  : parseDate(cdtToutc)
110
109
  const _eta = order?.eta_time
111
- return moment(_delivery.replace('AM', '')).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
110
+ return moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'minutes')
112
111
  }
113
112
 
114
113
  const displayDelayedTime = (order: any) => {
@@ -116,10 +115,10 @@ export const PreviousOrders = (props: any) => {
116
115
  // get day, hour and minutes
117
116
  const sign = tagetedMin >= 0 ? '' : '- '
118
117
  tagetedMin = Math.abs(tagetedMin)
119
- let day = Math.floor(tagetedMin / 1440)
118
+ let day: string | number = Math.floor(tagetedMin / 1440)
120
119
  const restMinOfTargetedMin = tagetedMin - 1440 * day
121
- let restHours = Math.floor(restMinOfTargetedMin / 60)
122
- let restMins = restMinOfTargetedMin - 60 * restHours
120
+ let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
121
+ let restMins: string | number = restMinOfTargetedMin - 60 * restHours
123
122
  // make standard time format
124
123
  day = day === 0 ? '' : day + 'day '
125
124
  restHours = restHours < 10 ? '0' + restHours : restHours
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
446
446
  </WrapperIngredients>
447
447
  </View>
448
448
  )}
449
- {product?.extras.map((extra: any) => extra.options.map((option: any) => {
449
+ {product?.extras.map((extra: any) => extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
450
450
  const currentState = productCart.options[`id:${option.id}`] || {}
451
451
  return (
452
452
  <React.Fragment key={option.id}>
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
460
460
  >
461
461
  <WrapperSubOption style={{ backgroundColor: isError(option.id) }}>
462
462
  {
463
- option.suboptions.map((suboption: any) => {
463
+ option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => {
464
464
  const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {}
465
465
  const balance = productCart.options[`id:${option.id}`]?.balance || 0
466
466
  return (
@@ -44,6 +44,12 @@ import { ProductForm } from './src/components/ProductForm';
44
44
  import { UpsellingProducts } from './src/components/UpsellingProducts';
45
45
  import { UserVerification } from './src/components/UserVerification';
46
46
  import { BusinessListingSearch } from './src/components/BusinessListingSearch';
47
+ import { LastOrders } from './src/components/LastOrders';
48
+ import NavBar from './src/components/NavBar';
49
+ import { BusinessTypeFilter } from './src/components/BusinessTypeFilter';
50
+ import { BusinessController } from './src/components/BusinessController';
51
+ import { BusinessFeaturedController } from './src/components/BusinessFeaturedController';
52
+ import { HighestRatedBusinesses } from './src/components/HighestRatedBusinesses';
47
53
 
48
54
  import { Toast } from './src/components/shared/OToast';
49
55
  import {
@@ -60,7 +66,7 @@ import {
60
66
  OAlert,
61
67
  OModal,
62
68
  OBottomPopup,
63
- HeaderTitle
69
+ HeaderTitle
64
70
  } from './src/components/shared';
65
71
 
66
72
  import { Container } from './src/layouts/Container';
@@ -119,6 +125,11 @@ export {
119
125
  BusinessProductsList,
120
126
  FloatingButton,
121
127
  SearchBar,
128
+ LastOrders,
129
+ BusinessTypeFilter,
130
+ BusinessController,
131
+ BusinessFeaturedController,
132
+ HighestRatedBusinesses,
122
133
 
123
134
  // OComponents
124
135
  Toast,
@@ -135,11 +146,12 @@ export {
135
146
  OAlert,
136
147
  OModal,
137
148
  OBottomPopup,
138
- HeaderTitle,
149
+ HeaderTitle,
139
150
 
140
151
  // layout
141
152
  Container,
142
153
  SafeAreaContainer,
154
+ NavBar,
143
155
 
144
156
  // utils
145
157
  _retrieveStoreData,
@@ -4,9 +4,7 @@ import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OIcon, OText, OModal } from '../shared';
6
6
  import { BusinessBasicInformationParams } from '../../types';
7
- import { convertHoursToMinutes, shape } from '../../utils';
8
- import { BusinessInformation } from '../BusinessInformation';
9
- import { BusinessReviews } from '../BusinessReviews';
7
+ import { convertHoursToMinutes } from '../../utils';
10
8
  import dayjs from 'dayjs';
11
9
  import timezone from 'dayjs/plugin/timezone';
12
10
  import isBetween from 'dayjs/plugin/isBetween';
@@ -28,6 +26,9 @@ import {
28
26
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
29
27
  const types = ['food', 'laundry', 'alcohol', 'groceries'];
30
28
 
29
+ let BusinessInformation: null | React.ElementType = null
30
+ let BusinessReviews: null | React.ElementType = null
31
+
31
32
  export const BusinessBasicInformation = (
32
33
  props: BusinessBasicInformationParams,
33
34
  ) => {
@@ -40,6 +41,25 @@ export const BusinessBasicInformation = (
40
41
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
41
42
  const [openBusinessInformation, setOpenBusinessInformation] = useState(false);
42
43
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
44
+ const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
45
+ const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
46
+
47
+ const handleClickBusinessInformation = () => {
48
+ if (!businessInformationObtained) {
49
+ BusinessInformation = require('../BusinessInformation').BusinessInformation
50
+ setBusinessInformationObtained(true)
51
+ }
52
+ setOpenBusinessInformation(true)
53
+ }
54
+
55
+ const handleClickBusinessReviews = () => {
56
+ if (!businessReviewsObtained) {
57
+ BusinessReviews = require('../BusinessReviews').BusinessReviews
58
+ setBusinessReviewsObtainedbtained(true)
59
+ }
60
+ setOpenBusinessReviews(true)
61
+ }
62
+
43
63
  const getBusinessType = () => {
44
64
  if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
45
65
  const _types: any = [];
@@ -53,7 +73,7 @@ export const BusinessBasicInformation = (
53
73
  return _types.join(', ');
54
74
  };
55
75
 
56
-
76
+
57
77
  useEffect(() => {
58
78
  if (businessState?.loading) return
59
79
  let timeout: any = null
@@ -67,16 +87,16 @@ export const BusinessBasicInformation = (
67
87
  })
68
88
  }
69
89
  if (lapse) {
70
- const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
71
- const timeToClose = (to.unix() - currentDate.unix()) * 1000
72
- timeout = setTimeout(() => {
73
- navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })
74
- }, timeToClose)
90
+ const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
91
+ const timeToClose = (to.unix() - currentDate.unix()) * 1000
92
+ timeout = setTimeout(() => {
93
+ navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })
94
+ }, timeToClose)
75
95
  }
76
96
  return () => {
77
- timeout && clearTimeout(timeout)
97
+ timeout && clearTimeout(timeout)
78
98
  }
79
- }, [businessState?.business])
99
+ }, [businessState?.business])
80
100
 
81
101
  return (
82
102
  <BusinessContainer>
@@ -92,7 +112,7 @@ export const BusinessBasicInformation = (
92
112
  optimizeImage(businessState?.business?.header, 'h_250,c_limit'),
93
113
  }}>
94
114
  {!isBusinessInfoShow && (
95
- <WrapBusinessInfo onPress={() => setOpenBusinessInformation(true)}>
115
+ <WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
96
116
  <OIcon src={theme.images.general.info} width={24} />
97
117
  </WrapBusinessInfo>
98
118
  )}
@@ -203,17 +223,17 @@ export const BusinessBasicInformation = (
203
223
  <WrapReviews>
204
224
  {!isBusinessInfoShow && (
205
225
  <>
206
- { isPreOrder && (
226
+ {isPreOrder && (
207
227
  <>
208
- <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
209
- <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
210
- {t('PRE_ORDER', 'Preorder')}
211
- </OText>
212
- </TouchableOpacity>
213
- <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
228
+ <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
229
+ <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
230
+ {t('PRE_ORDER', 'Preorder')}
231
+ </OText>
232
+ </TouchableOpacity>
233
+ <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
214
234
  </>
215
235
  )}
216
- <TouchableOpacity onPress={() => setOpenBusinessReviews(true)}>
236
+ <TouchableOpacity onPress={() => handleClickBusinessReviews()}>
217
237
  <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
218
238
  {t('REVIEWS', 'Reviews')}
219
239
  </OText>
@@ -222,28 +242,37 @@ export const BusinessBasicInformation = (
222
242
  )}
223
243
  </WrapReviews>
224
244
  </BusinessInfo>
225
- <OModal
226
- titleSectionStyle={styles.modalTitleSectionStyle}
227
- open={openBusinessInformation}
228
- onClose={() => setOpenBusinessInformation(false)}
229
- isNotDecoration>
230
- <BusinessInformation
231
- businessState={businessState}
232
- business={business}
233
- />
234
- </OModal>
235
- <OModal
236
- entireModal
237
- titleSectionStyle={styles.modalTitleSectionStyle}
238
- open={openBusinessReviews}
239
- onClose={() => setOpenBusinessReviews(false)}
240
- isNotDecoration>
241
- <BusinessReviews
242
- businessState={businessState}
243
- businessId={business.id}
244
- reviews={business.reviews?.reviews}
245
- />
246
- </OModal>
245
+ {businessInformationObtained ? (
246
+ <OModal
247
+ titleSectionStyle={styles.modalTitleSectionStyle}
248
+ open={openBusinessInformation}
249
+ onClose={() => setOpenBusinessInformation(false)}
250
+ isNotDecoration>
251
+ {BusinessInformation && (
252
+ <BusinessInformation
253
+ businessState={businessState}
254
+ business={business}
255
+ />
256
+ )}
257
+ </OModal>
258
+ ) : null}
259
+ {businessReviewsObtained ? (
260
+ <OModal
261
+ entireModal
262
+ titleSectionStyle={styles.modalTitleSectionStyle}
263
+ open={openBusinessReviews}
264
+ onClose={() => setOpenBusinessReviews(false)}
265
+ isNotDecoration
266
+ >
267
+ {BusinessReviews && (
268
+ <BusinessReviews
269
+ businessState={businessState}
270
+ businessId={business.id}
271
+ reviews={business.reviews?.reviews}
272
+ />
273
+ )}
274
+ </OModal>
275
+ ) : null}
247
276
  </BusinessContainer>
248
277
  );
249
278
  };
@@ -377,7 +377,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
377
377
  />
378
378
  </MenuWrapper>
379
379
  )}
380
- {isPreOrderSetting && (
380
+ {isPreOrderSetting && showOrderTime && (
381
381
  <OrderTimeWrapper>
382
382
  <OText
383
383
  size={16}
@@ -44,11 +44,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
44
44
  borderTopStartRadius: 4,
45
45
  borderTopEndRadius: 4,
46
46
  backgroundColor: theme.colors.textPrimary,
47
- },
48
- tabDeactived: {
47
+ },
48
+ tabDeactived: {
49
49
  marginTop: 10,
50
50
  height: 4
51
- }
51
+ }
52
52
  });
53
53
 
54
54
  const handleCategoryScroll = (category: any) => {
@@ -112,7 +112,9 @@ const BusinessProductsCategoriesUI = (props: any) => {
112
112
  categories.map((category: any) => (
113
113
  <Tab
114
114
  key={category.id}
115
- onPress={() => handleCategoryScroll(category)}
115
+ onPress={() => requestAnimationFrame(() => {
116
+ handleCategoryScroll(category)
117
+ })}
116
118
  style={[
117
119
  category.id === 'featured' && !featured && styles.featuredStyle,
118
120
  {
@@ -45,7 +45,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
45
45
  }
46
46
 
47
47
  return (
48
- <ProductsContainer>
48
+ <ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
49
49
  {category.id &&
50
50
  categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
51
51
  <SingleProductCard
@@ -312,16 +312,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
312
312
  {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
313
313
  <FloatingButton
314
314
  btnText={
315
- currentCart?.subtotal >= currentCart?.minimum
316
- ? t('VIEW_ORDER', 'View Order')
317
- : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
315
+ openUpselling
316
+ ? t('LOADING', 'Loading')
317
+ : currentCart?.subtotal >= currentCart?.minimum
318
+ ? t('VIEW_ORDER', 'View Order')
319
+ : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
318
320
  }
319
- isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
321
+ isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum || openUpselling}
320
322
  btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
321
323
  btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && currentCart?.products?.length > 0}
322
324
  btnLeftValue={currentCart?.products?.length}
323
325
  btnRightValue={parsePrice(currentCart?.total)}
324
- disabled={currentCart?.subtotal < currentCart?.minimum}
326
+ disabled={currentCart?.subtotal < currentCart?.minimum || openUpselling}
325
327
  handleClick={() => setOpenUpselling(true)}
326
328
  />
327
329
  )}
@@ -446,8 +446,6 @@ const CartUI = (props: any) => {
446
446
  open={openTaxModal.open}
447
447
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
448
448
  entireModal
449
- title={`${openTaxModal.data?.name ||
450
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
451
449
  >
452
450
  <TaxInformation
453
451
  type={openTaxModal.type}
@@ -554,11 +554,12 @@ const CheckoutUI = (props: any) => {
554
554
  </ChSection>
555
555
  )}
556
556
 
557
- {!cartState.loading && cart && isWalletEnabled && (
557
+ {!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
558
558
  <WalletPaymentOptionContainer>
559
559
  <PaymentOptionWallet
560
560
  cart={cart}
561
561
  businessId={cart?.business_id}
562
+ businessConfigs={businessDetails?.business?.configs}
562
563
  />
563
564
  </WalletPaymentOptionContainer>
564
565
  )}
@@ -1025,8 +1025,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1025
1025
  open={openTaxModal.open}
1026
1026
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1027
1027
  entireModal
1028
- title={`${openTaxModal.data?.name ||
1029
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
1030
1028
  >
1031
1029
  <TaxInformation
1032
1030
  type={openTaxModal.type}
@@ -98,7 +98,7 @@ const OrderProgressUI = (props: any) => {
98
98
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
99
99
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
100
100
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
101
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
101
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
102
102
  ]
103
103
 
104
104
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -131,7 +131,7 @@ const OrderProgressUI = (props: any) => {
131
131
 
132
132
  useEffect(() => {
133
133
  if (isFocused) {
134
- loadOrders()
134
+ loadOrders(false, false, false, true)
135
135
  }
136
136
  }, [isFocused])
137
137
 
@@ -20,6 +20,7 @@ import { OText } from '../shared'
20
20
 
21
21
  const PaymentOptionWalletUI = (props: any) => {
22
22
  const {
23
+ businessConfigs,
23
24
  businessId,
24
25
  walletsState,
25
26
  selectWallet,
@@ -37,6 +38,9 @@ const PaymentOptionWalletUI = (props: any) => {
37
38
  const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
38
39
  const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
39
40
 
41
+ const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
42
+ const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
43
+
40
44
  const styles = StyleSheet.create({
41
45
  checkBoxStyle: {
42
46
  width: 25,
@@ -53,11 +57,11 @@ const PaymentOptionWalletUI = (props: any) => {
53
57
  const walletName: any = {
54
58
  cash: {
55
59
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
56
- isActive: isWalletCashEnabled
60
+ isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
57
61
  },
58
62
  credit_point: {
59
63
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
60
- isActive: isWalletPointsEnabled
64
+ isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
61
65
  }
62
66
  }
63
67
 
@@ -126,7 +126,9 @@ const PaymentOptionsUI = (props: any) => {
126
126
 
127
127
  useEffect(() => {
128
128
  if (props.paySelected && props.paySelected?.data) {
129
- setPaymethodData && setPaymethodData(props.paySelected?.data)
129
+ requestAnimationFrame(() => {
130
+ setPaymethodData && setPaymethodData(props.paySelected?.data)
131
+ })
130
132
  }
131
133
  }, [props.paySelected])
132
134
 
@@ -143,18 +143,20 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
143
143
  </OText>
144
144
  </Information>
145
145
  <Status>
146
- <OButton
147
- text={t('REORDER', 'Reorder')}
148
- imgRightSrc={''}
149
- textStyle={styles.buttonText}
150
- style={
151
- reorderLoading && order.id === reorderSelected
152
- ? styles.reorderLoading
153
- : styles.reorderbutton
154
- }
155
- onClick={() => handleReorderClick(order.id)}
156
- isLoading={reorderLoading && order.id === reorderSelected}
157
- />
146
+ {order.cart && (
147
+ <OButton
148
+ text={t('REORDER', 'Reorder')}
149
+ imgRightSrc={''}
150
+ textStyle={styles.buttonText}
151
+ style={
152
+ reorderLoading && order.id === reorderSelected
153
+ ? styles.reorderLoading
154
+ : styles.reorderbutton
155
+ }
156
+ onClick={() => handleReorderClick(order.id)}
157
+ isLoading={reorderLoading && order.id === reorderSelected}
158
+ />
159
+ )}
158
160
  {allowedOrderStatus.includes(parseInt(order?.status)) &&
159
161
  !order.review && (
160
162
  <TouchableOpacity
@@ -695,7 +695,7 @@ export const ProductOptionsUI = (props: any) => {
695
695
  </View>
696
696
  )}
697
697
  {product?.extras.map((extra: any) =>
698
- extra.options.map((option: any) => {
698
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
699
699
  const currentState =
700
700
  productCart.options[`id:${option.id}`] || {};
701
701
  return (
@@ -711,7 +711,7 @@ export const ProductOptionsUI = (props: any) => {
711
711
  backgroundColor: isError(option.id),
712
712
  borderRadius: 7.6
713
713
  }}>
714
- {option.suboptions.map(
714
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
715
715
  (suboption: any) => {
716
716
  const currentState =
717
717
  productCart.options[
@@ -779,7 +779,7 @@ export const ProductOptionsUI = (props: any) => {
779
779
  ) : (
780
780
  <>
781
781
  {product?.extras.map((extra: any) =>
782
- extra.options.map((option: any) => {
782
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
783
783
  if (
784
784
  option.id == selOpt ||
785
785
  (hasRespected(
@@ -804,7 +804,7 @@ export const ProductOptionsUI = (props: any) => {
804
804
  option.id,
805
805
  ),
806
806
  }}>
807
- {option.suboptions.map(
807
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
808
808
  (suboption: any) => {
809
809
  const currentState =
810
810
  productCart.options[
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage } from 'ordering-components/native'
2
+ import { useLanguage, useUtils } from 'ordering-components/native'
3
3
  import { SingleProductCard } from '../SingleProductCard'
4
4
  import { TaxInformationContainer, ProductContainer } from './styles'
5
5
  import { OText } from '../shared'
@@ -13,8 +13,9 @@ interface taxInformationParams {
13
13
  fixed?: number,
14
14
  percentage?: number,
15
15
  id: number,
16
- discounts?: any
17
- } | null,
16
+ discounts?: any,
17
+ rate_type?: number
18
+ },
18
19
  products: Array<any>,
19
20
  type: string
20
21
  }
@@ -27,6 +28,7 @@ export const TaxInformation = (props: taxInformationParams) => {
27
28
  } = props
28
29
 
29
30
  const [, t] = useLanguage()
31
+ const [{ parsePrice }] = useUtils()
30
32
 
31
33
  const includedOnPriceString = data?.type === 1 ? `(${t('INCLUDED_ON_PRICE', 'Included on price')})` : `(${t('NOT_INCLUDED_ON_PRICE', 'Not included on price')})`
32
34
  const offersHideArray = ['offer_target_2', 'offer_target_3']
@@ -56,8 +58,12 @@ export const TaxInformation = (props: taxInformationParams) => {
56
58
 
57
59
  return (
58
60
  <TaxInformationContainer>
61
+ <OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
62
+ {`${data?.name ||
63
+ t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${data?.rate_type !== 2 ? `(${typeof data?.rate === 'number' ? `${data?.rate}%` : `${parsePrice(data?.fixed ?? 0)} + ${data?.percentage}%`})` : ''} `}
64
+ </OText>
59
65
  {!!data?.description ? (
60
- <OText size={24} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
66
+ <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
61
67
  {t('DESCRIPTION', 'Description')}: {data?.description} {data?.type && !type?.includes('offer') && includedOnPriceString}
62
68
  </OText>
63
69
  ) : (