ordering-ui-react-native 0.17.84 → 0.17.85

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.84",
3
+ "version": "0.17.85",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -41,7 +41,10 @@ const CartUI = (props: any) => {
41
41
  commentState,
42
42
  onNavigationRedirect,
43
43
  handleRemoveOfferClick,
44
- isMultiCheckout
44
+ isMultiCheckout,
45
+ hideDeliveryFee,
46
+ hideDriverTip,
47
+ showGeneralBtn
45
48
  } = props
46
49
 
47
50
  const theme = useTheme();
@@ -191,6 +194,26 @@ const CartUI = (props: any) => {
191
194
 
192
195
  return (
193
196
  <CContainer>
197
+ {showGeneralBtn && cart?.valid_products &&(
198
+ <CheckoutAction style={{ marginTop: 0 }}>
199
+ <OButton
200
+ text={(subtotalWithTaxes >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
201
+ !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
202
+ ) : !cart?.valid_address ? (
203
+ `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
204
+ ) : (
205
+ `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
206
+ )}
207
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
208
+ isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
209
+ borderColor={theme.colors.primary}
210
+ imgRightSrc={null}
211
+ textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
212
+ onClick={() => handleUpsellingPage()}
213
+ style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
214
+ />
215
+ </CheckoutAction>
216
+ )}
194
217
  {openUpselling && (
195
218
  <UpsellingProducts
196
219
  handleUpsellingPage={handleUpsellingPage}
@@ -337,7 +360,7 @@ const CartUI = (props: any) => {
337
360
  </OSTable>
338
361
  ))
339
362
  }
340
- {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
363
+ {orderState?.options?.type === 1 && cart?.delivery_price > 0 && !hideDeliveryFee && (
341
364
  <OSTable>
342
365
  <OText size={12} lineHeight={18}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
343
366
  <OText size={12} lineHeight={18}>{parsePrice(cart?.delivery_price_with_discount ?? cart?.delivery_price)}</OText>
@@ -364,7 +387,7 @@ const CartUI = (props: any) => {
364
387
  </OSTable>
365
388
  ))
366
389
  }
367
- {cart?.driver_tip > 0 && (
390
+ {cart?.driver_tip > 0 && !hideDriverTip && (
368
391
  <OSTable>
369
392
  <OText size={12} lineHeight={18}>
370
393
  {t('DRIVER_TIP', 'Driver tip')}
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { View } from 'react-native';
3
- import { useLanguage } from 'ordering-components/native';
3
+ import { useLanguage, useConfig } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { CCContainer, CCNotCarts, CCList } from './styles';
6
6
 
@@ -17,9 +17,11 @@ export const CartContent = (props: any) => {
17
17
 
18
18
  const theme = useTheme();
19
19
  const [, t] = useLanguage()
20
+ const [{ configs }] = useConfig()
20
21
  const [isCartsLoading, setIsCartsLoading] = useState(false)
21
22
 
22
23
  const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
24
+ const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
23
25
 
24
26
  return (
25
27
  <CCContainer
@@ -32,6 +34,7 @@ export const CartContent = (props: any) => {
32
34
  {cart.products.length > 0 && (
33
35
  <>
34
36
  <Cart
37
+ showGeneralBtn={i === 0 && isMultiCheckout}
35
38
  singleBusiness={props.singleBusiness}
36
39
  isFranchiseApp={props.isFranchiseApp}
37
40
  cart={cart}
@@ -39,6 +42,7 @@ export const CartContent = (props: any) => {
39
42
  onNavigationRedirect={props.onNavigationRedirect}
40
43
  isCartsLoading={isCartsLoading}
41
44
  setIsCartsLoading={setIsCartsLoading}
45
+ isMultiCheckout={isMultiCheckout}
42
46
  hideUpselling
43
47
  />
44
48
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
@@ -246,6 +246,8 @@ const MultiCheckoutUI = (props: any) => {
246
246
  cart={cart}
247
247
  cartuuid={cart.uuid}
248
248
  isMultiCheckout
249
+ hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
250
+ hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
249
251
  onNavigationRedirect={(route: string, params: any) => props.navigation.navigate(route, params)}
250
252
  />
251
253
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
@@ -273,6 +275,17 @@ const MultiCheckoutUI = (props: any) => {
273
275
  <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>{parsePrice(totalCartsFee)}</OText>
274
276
  </View>
275
277
  )}
278
+ {openCarts.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
279
+ configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
280
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
281
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
282
+ {t('DRIVER_TIP', 'Driver tip')}
283
+ </OText>
284
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
285
+ {parsePrice(openCarts.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
286
+ </OText>
287
+ </View>
288
+ )}
276
289
  <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
277
290
  <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
278
291
  {t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}