ordering-ui-react-native 0.17.52 → 0.17.53

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.17.52",
3
+ "version": "0.17.53",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -153,7 +153,7 @@ const AddressFormUI = (props: AddressFormParams) => {
153
153
  'true';
154
154
  const maxLimitLocation =
155
155
  configState?.configs?.meters_to_change_address?.value;
156
-
156
+ const countryCode = configState?.configs?.country_autocomplete?.value
157
157
  const continueAsGuest = () => navigation.navigate('BusinessList', { isGuestUser: true });
158
158
  const goToBack = () => navigation?.canGoBack() && navigation.goBack();
159
159
 
@@ -543,7 +543,10 @@ const AddressFormUI = (props: AddressFormParams) => {
543
543
  onPress={(data, details: any) => {
544
544
  handleChangeAddress(data, details);
545
545
  }}
546
- query={{ key: googleMapsApiKey }}
546
+ query={{
547
+ key: googleMapsApiKey,
548
+ components: countryCode && countryCode !== '*' ? `country:${countryCode}` : ''
549
+ }}
547
550
  fetchDetails
548
551
  ref={googleInput}
549
552
  textInputProps={{
@@ -251,7 +251,11 @@ export const BusinessBasicInformation = (
251
251
  )}
252
252
  {isChewLayout && (
253
253
  <TouchableOpacity onPress={() => handleClickBusinessInformation()}>
254
- <OText style={{ textDecorationColor: theme.colors.black, textDecorationLine: 'underline' }}>
254
+ <OText
255
+ color={theme.colors.primary}
256
+ style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
257
+ size={12}
258
+ >
255
259
  {t('SEE_MORE_DESCRIPTION', 'See more')}
256
260
  </OText>
257
261
  </TouchableOpacity>
@@ -416,7 +420,11 @@ export const BusinessBasicInformation = (
416
420
  {isPreOrder && (!business?.professionals || business?.professionals?.length === 0) && (
417
421
  <>
418
422
  <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
419
- <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
423
+ <OText
424
+ color={theme.colors.primary}
425
+ style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
426
+ size={12}
427
+ >
420
428
  {t('PREORDER', 'Preorder')}
421
429
  </OText>
422
430
  </TouchableOpacity>
@@ -424,7 +432,11 @@ export const BusinessBasicInformation = (
424
432
  </>
425
433
  )}
426
434
  <TouchableOpacity onPress={() => handleClickBusinessReviews()}>
427
- <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
435
+ <OText
436
+ color={theme.colors.primary}
437
+ style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
438
+ size={12}
439
+ >
428
440
  {t('REVIEWS', 'Reviews')}
429
441
  </OText>
430
442
  </TouchableOpacity>
@@ -46,6 +46,12 @@ export const BusinessItemAccordion = (props: any) => {
46
46
  }
47
47
  }, [orderState?.carts, isClosed])
48
48
 
49
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
50
+ if (item?.type === 1)
51
+ return acc = acc + item?.summary?.tax
52
+ return acc = acc
53
+ }, cart?.subtotal)
54
+
49
55
  return (
50
56
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
51
57
  <BIHeader
@@ -102,7 +108,7 @@ export const BusinessItemAccordion = (props: any) => {
102
108
  <OText
103
109
  size={12}
104
110
  lineHeight={18}
105
- color={theme.colors.textSecondary}
111
+ color={theme.colors.primary}
106
112
  style={{ textDecorationLine: 'underline' }}
107
113
  >
108
114
  {t('CHANGE_STORE', 'Change store')}
@@ -151,7 +157,7 @@ export const BusinessItemAccordion = (props: any) => {
151
157
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
158
  style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
159
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
160
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
161
  borderColor={theme.colors.primary}
156
162
  isDisabled={checkoutButtonDisabled}
157
163
  />
@@ -154,6 +154,12 @@ const CartUI = (props: any) => {
154
154
  }
155
155
  }
156
156
 
157
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
158
+ if (item?.type === 1)
159
+ return acc = acc + item?.summary?.tax
160
+ return acc = acc
161
+ }, cart?.subtotal)
162
+
157
163
  return (
158
164
  <CContainer>
159
165
  {openUpselling && (
@@ -178,7 +184,7 @@ const CartUI = (props: any) => {
178
184
  onNavigationRedirect={props.onNavigationRedirect}
179
185
  handleChangeStore={() => setOpenChangeStore(true)}
180
186
  handleClickCheckout={() => setOpenUpselling(true)}
181
- checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
187
+ checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
182
188
  isMultiCheckout={isMultiCheckout}
183
189
  >
184
190
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
@@ -369,22 +375,22 @@ const CartUI = (props: any) => {
369
375
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
370
376
  driverTipsOptions && driverTipsOptions?.length > 0 &&
371
377
  (
372
- <DriverTipsContainer>
373
- <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
374
- {t('DRIVER_TIPS', 'Driver Tips')}
375
- </OText>
376
- <DriverTips
377
- uuid={cart?.uuid}
378
- businessId={cart?.business_id}
379
- driverTipsOptions={driverTipsOptions}
380
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
381
- isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
382
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
383
- ? cart?.driver_tip
384
- : cart?.driver_tip_rate}
385
- useOrderContext
386
- />
387
- </DriverTipsContainer>
378
+ <DriverTipsContainer>
379
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
380
+ {t('DRIVER_TIPS', 'Driver Tips')}
381
+ </OText>
382
+ <DriverTips
383
+ uuid={cart?.uuid}
384
+ businessId={cart?.business_id}
385
+ driverTipsOptions={driverTipsOptions}
386
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
387
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
388
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
389
+ ? cart?.driver_tip
390
+ : cart?.driver_tip_rate}
391
+ useOrderContext
392
+ />
393
+ </DriverTipsContainer>
388
394
  )}
389
395
 
390
396
  <OSTotal>
@@ -455,15 +461,15 @@ const CartUI = (props: any) => {
455
461
  {cart?.valid_products ? (
456
462
  <CheckoutAction>
457
463
  <OButton
458
- text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
464
+ text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
459
465
  !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
460
466
  ) : !cart?.valid_address ? (
461
467
  `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
462
468
  ) : (
463
469
  `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
464
470
  )}
465
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
466
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
471
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
472
+ isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
467
473
  borderColor={theme.colors.primary}
468
474
  imgRightSrc={null}
469
475
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
@@ -154,8 +154,13 @@ const CheckoutUI = (props: any) => {
154
154
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
155
155
 
156
156
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
157
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
158
+ if (item?.type === 1)
159
+ return acc = acc + item?.summary?.tax
160
+ return acc = acc
161
+ }, cart?.subtotal)
157
162
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
158
- placing || errorCash || cart?.subtotal < cart?.minimum ||
163
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
159
164
  // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
160
165
  (options.type === 1 &&
161
166
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
@@ -634,7 +639,7 @@ const CheckoutUI = (props: any) => {
634
639
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
635
640
  >
636
641
  <OText
637
- size={10}
642
+ size={12}
638
643
  lineHeight={15}
639
644
  color={theme.colors.primary}
640
645
  style={{ textDecorationLine: 'underline' }}
@@ -651,7 +656,7 @@ const CheckoutUI = (props: any) => {
651
656
  <OText
652
657
  size={12}
653
658
  lineHeight={18}
654
- color={theme.colors.textSecondary}
659
+ color={theme.colors.primary}
655
660
  style={{ textDecorationLine: 'underline' }}
656
661
  >
657
662
  {t('CHANGE_STORE', 'Change store')}
@@ -756,7 +761,7 @@ const CheckoutUI = (props: any) => {
756
761
  handleClick={() => handlePlaceOrder(null)}
757
762
  isSecondaryBtn={isDisabledButtonPlace}
758
763
  disabled={isDisabledButtonPlace}
759
- btnText={cart?.subtotal >= cart?.minimum
764
+ btnText={subtotalWithTaxes >= cart?.minimum
760
765
  ? (
761
766
  placing
762
767
  ? t('PLACING', 'Placing')
@@ -622,7 +622,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
622
622
  onPress={() => handleClickOrderReview(order)}
623
623
  >
624
624
  <OText
625
- size={10}
625
+ size={12}
626
626
  lineHeight={15}
627
627
  color={theme.colors.primary}
628
628
  style={{ textDecorationLine: 'underline' }}
@@ -638,7 +638,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
638
638
 
639
639
  >
640
640
  <OText
641
- size={10}
641
+ size={12}
642
642
  lineHeight={15}
643
643
  color={theme.colors.primary}
644
644
  style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
@@ -126,6 +126,7 @@ export const ProductOptionsUI = (props: any) => {
126
126
  },
127
127
  slide1: {
128
128
  flex: 1,
129
+ alignItems: 'center'
129
130
  },
130
131
  mainSwiper: {
131
132
  height: 258,
@@ -186,7 +186,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
186
186
  <NavBar
187
187
  title={t('REVIEW_DRIVER', 'Review driver')}
188
188
  titleAlign={'center'}
189
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
189
+ onActionLeft={() => onNavigationRedirect('BottomTab')}
190
190
  showCall={false}
191
191
  btnStyle={{ paddingLeft: 0 }}
192
192
  style={{ flexDirection: 'column', alignItems: 'flex-start' }}
@@ -67,7 +67,7 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
67
67
  <NavBar
68
68
  title={t('REVIEW_PRODUCT', 'Review product')}
69
69
  titleAlign={'center'}
70
- onActionLeft={() => onNavigationRedirect('MyOrders')}
70
+ onActionLeft={() => onNavigationRedirect('BottomTab')}
71
71
  showCall={false}
72
72
  btnStyle={{ paddingLeft: 0 }}
73
73
  style={{ flexDirection: 'column', alignItems: 'flex-start' }}
@@ -163,7 +163,7 @@ const ProfileListUI = (props: ProfileParams) => {
163
163
  }, [removeAccountState])
164
164
 
165
165
  return (
166
- <View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
166
+ <View style={{ flex: 1, height: height - top - bottom - 42, paddingTop: 20 }}>
167
167
  {/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
168
168
  {t('PROFILE', 'Profile')}
169
169
  </OText> */}
@@ -183,7 +183,7 @@ const ProfileListUI = (props: ProfileParams) => {
183
183
  <View style={{ flexBasis: '70%' }}>
184
184
  <OText size={20} lineHeight={30} weight={Platform.OS === 'ios' ? '500' : 'bold'} color={theme.colors.textNormal}>{user?.name} {user?.lastname}</OText>
185
185
  <TouchableOpacity onPress={() => navigation.navigate('ProfileForm', { ...detailProps })}>
186
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>{t('VIEW_ACCOUNT', 'View account')}</OText>
186
+ <OText size={12} lineHeight={18} color={theme.colors.primary} style={{ textDecorationLine: 'underline' }}>{t('VIEW_ACCOUNT', 'View account')}</OText>
187
187
  </TouchableOpacity>
188
188
  </View>
189
189
  </CenterView>