ordering-ui-react-native 0.16.65 → 0.16.66

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.16.65",
3
+ "version": "0.16.66",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -8,7 +8,7 @@ import {
8
8
  useValidationFields,
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
- import { CContainer, CheckoutAction, Divider } from './styles';
11
+ import { CContainer, CheckoutAction, Divider, DriverTipsContainer } from './styles';
12
12
 
13
13
  import { OSBill, OSTable, OSCoupon, OSTotal, OSRow } from '../OrderSummary/styles';
14
14
 
@@ -25,6 +25,7 @@ import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
26
  import { OAlert } from '../../../../../src/components/shared'
27
27
  import { PlaceSpot } from '../PlaceSpot'
28
+ import { DriverTips } from '../DriverTips'
28
29
 
29
30
  const CartUI = (props: any) => {
30
31
  const {
@@ -66,6 +67,10 @@ const CartUI = (props: any) => {
66
67
  const businessId = business?.business_id ?? null
67
68
  const placeSpotTypes = [4]
68
69
 
70
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
71
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
72
+ : configs?.driver_tip_options?.value || []
73
+
69
74
  const momentFormatted = !orderState?.option?.moment
70
75
  ? t('RIGHT_NOW', 'Right Now')
71
76
  : parseDate(orderState?.option?.moment, { outputFormat: 'YYYY-MM-DD HH:mm' })
@@ -355,6 +360,32 @@ const CartUI = (props: any) => {
355
360
  </OSTable>
356
361
  )}
357
362
 
363
+ {isMultiCheckout &&
364
+ cart &&
365
+ cart?.valid &&
366
+ orderState?.options?.type === 1 &&
367
+ cart?.status !== 2 &&
368
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
369
+ driverTipsOptions && driverTipsOptions?.length > 0 &&
370
+ (
371
+ <DriverTipsContainer>
372
+ <OText size={14} lineHeight={20} color={theme.colors.textNormal}>
373
+ {t('DRIVER_TIPS', 'Driver Tips')}
374
+ </OText>
375
+ <DriverTips
376
+ uuid={cart?.uuid}
377
+ businessId={cart?.business_id}
378
+ driverTipsOptions={driverTipsOptions}
379
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)}
380
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
381
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1 || !!parseInt(configs?.driver_tip_use_custom?.value, 10)
382
+ ? cart?.driver_tip
383
+ : cart?.driver_tip_rate}
384
+ useOrderContext
385
+ />
386
+ </DriverTipsContainer>
387
+ )}
388
+
358
389
  <OSTotal>
359
390
  <OSTable style={{ marginTop: 15 }}>
360
391
  <OText size={14} lineHeight={21} weight={'600'}>
@@ -33,3 +33,7 @@ export const Divider = styled.View`
33
33
  margin-top: 5px;
34
34
  margin-bottom: 10px;
35
35
  `
36
+
37
+ export const DriverTipsContainer = styled.View`
38
+ padding: 5px 0;
39
+ `