ordering-ui-react-native 0.15.55 → 0.15.58

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 (26) hide show
  1. package/package.json +1 -1
  2. package/src/components/OrderDetails/index.tsx +2 -2
  3. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  4. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -91
  5. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  6. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  7. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  8. package/themes/kiosk/src/components/OrderDetails/index.tsx +134 -39
  9. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  10. package/themes/kiosk/src/types/index.d.ts +2 -0
  11. package/themes/original/index.tsx +151 -0
  12. package/themes/original/src/components/AddressList/index.tsx +1 -1
  13. package/themes/original/src/components/AppleLogin/index.tsx +58 -21
  14. package/themes/original/src/components/BusinessProductsList/index.tsx +104 -18
  15. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -1
  16. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -0
  17. package/themes/original/src/components/BusinessesListing/index.tsx +1 -1
  18. package/themes/original/src/components/Home/index.tsx +1 -1
  19. package/themes/original/src/components/PhoneInputNumber/index.tsx +10 -4
  20. package/themes/original/src/components/SignupForm/index.tsx +41 -13
  21. package/themes/original/src/components/UserFormDetails/index.tsx +13 -2
  22. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  23. package/themes/original/src/config/constants.tsx +6 -6
  24. package/themes/original/src/types/index.tsx +6 -1
  25. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  26. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.55",
3
+ "version": "0.15.58",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -514,7 +514,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
514
514
  </Table>
515
515
  )}
516
516
  {
517
- order?.taxes?.length === 0 && order?.tax_type === 2 && (
517
+ order?.taxes?.length === 0 && order?.tax_type === 2 && order?.summary?.tax > 0 && (
518
518
  <Table>
519
519
  <OText>
520
520
  {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
@@ -524,7 +524,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
524
524
  )
525
525
  }
526
526
  {
527
- order?.fees?.length === 0 && (
527
+ order?.fees?.length === 0 && order?.summary?.service_fee > 0 && (
528
528
  <Table>
529
529
  <OText>
530
530
  {t('SERVICE_FEE', 'Service fee')}
@@ -1,50 +1,55 @@
1
- import React, { useState, useEffect, useCallback } from 'react'
2
- import { useEvent, useLanguage, useUtils, useSession, useApi, NewOrderNotification as NewOrderNotificationController } from 'ordering-components/native'
1
+ import React, { useState, useEffect } from 'react'
2
+ import moment from 'moment'
3
3
  import { View, Modal, StyleSheet, TouchableOpacity, Dimensions } from 'react-native'
4
- import { OText, OIcon } from '../shared'
5
- import { useTheme } from 'styled-components/native'
4
+ import Sound from 'react-native-sound'
6
5
  import Icon from 'react-native-vector-icons/Feather'
6
+ import { useTheme } from 'styled-components/native'
7
+ import { useEvent, useLanguage, useSession, useApi, NewOrderNotification as NewOrderNotificationController } from 'ordering-components/native'
8
+
9
+ import { OText, OIcon } from '../shared'
7
10
  import { NotificationContainer } from './styles'
8
- import Sound from 'react-native-sound'
9
- import moment from 'moment'
10
11
  import { useLocation } from '../../hooks/useLocation'
11
- import { useFocusEffect } from '@react-navigation/core'
12
+
12
13
  Sound.setCategory('Playback')
13
14
 
14
15
  const windowWidth = Dimensions.get('screen').width
15
16
 
16
- const NewOrderNotificationUI = (props: any) => {
17
+ const NewOrderNotificationUI = () => {
17
18
  const [events] = useEvent()
18
19
  const theme = useTheme()
19
20
  const [, t] = useLanguage()
20
21
  const [{ user, token }] = useSession()
21
22
  const [ordering] = useApi()
22
- const [{ getTimeAgo }] = useUtils()
23
23
  const { getCurrentLocation } = useLocation();
24
- const [modalOpen, setModalOpen] = useState(false)
25
- const [newOrderId, setNewOrderId] = useState(null)
26
- const [messageOrderId, setMessageOrderId] = useState(null)
27
24
  const [soundTimeout, setSoundTimeout] = useState<any>(null)
28
- const [isFocused, setIsFocused] = useState(false)
29
- const [currentChange, setCurrentChange] = useState(1)
25
+ const [currentEvent, setCurrentEvent] = useState<any>(null)
26
+
27
+ const evtList: any = {
28
+ 1: {
29
+ event: 'messages',
30
+ message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
31
+ message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
32
+ },
33
+ 2: {
34
+ event: 'order_added',
35
+ message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
36
+ message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
37
+ },
38
+ 3: {
39
+ event: 'order_updated',
40
+ message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
41
+ message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
42
+ },
43
+ }
30
44
 
31
- const notificationSound = new Sound(theme.sounds.notification, error => {
32
- if (error) {
33
- console.log('failed to load the sound', error);
34
- return
35
- }
36
- console.log('loaded successfully');
37
- });
45
+ const notificationSound = new Sound(theme.sounds.notification, (e) => { console.log(e) });
38
46
 
39
47
  const handlePlayNotificationSound = () => {
40
48
  let times = 0
41
49
  const _timeout = setInterval(function () {
42
50
  notificationSound.play(success => {
43
51
  if (success) {
44
- console.log('successfully finished playing');
45
52
  times = times + 1
46
- } else {
47
- console.log('playback failed due to audio decoding errors');
48
53
  }
49
54
  })
50
55
  setSoundTimeout(_timeout)
@@ -57,39 +62,11 @@ const NewOrderNotificationUI = (props: any) => {
57
62
 
58
63
  const handleCloseModal = () => {
59
64
  clearInterval(soundTimeout)
60
- setModalOpen(false)
61
- setNewOrderId(null)
62
- setMessageOrderId(null)
63
- }
64
-
65
- const handleNotification = (order: any) => {
66
- setModalOpen(true)
67
- clearInterval(soundTimeout)
68
- setCurrentChange(1)
69
- handlePlayNotificationSound()
70
- setNewOrderId(order.id)
71
- }
72
-
73
- const handleMessageNotification = (message: any) => {
74
- const { order_id: orderId } = message;
75
- if (!modalOpen) setModalOpen(true)
76
- clearInterval(soundTimeout)
77
- setCurrentChange(2)
78
- handlePlayNotificationSound()
79
- setMessageOrderId(orderId)
65
+ setCurrentEvent({ evt: null })
80
66
  }
81
67
 
82
- useEffect(() => {
83
- events.on('order_added_noification', handleNotification)
84
- events.on('message_added_noification', handleMessageNotification)
85
- return () => {
86
- events.off('order_added_noification', handleNotification)
87
- events.off('message_added_noification', handleMessageNotification)
88
- }
89
- }, [])
90
-
91
- const handleUpdateOrder = useCallback(async (order: any) => {
92
- if (order?.driver) {
68
+ const handleEventNotification = async (evtType: number, value: any) => {
69
+ if (value?.driver) {
93
70
  const location = await getCurrentLocation()
94
71
  await fetch(`${ordering.root}/users/${user.id}/locations`, {
95
72
  method: 'POST',
@@ -98,25 +75,32 @@ const NewOrderNotificationUI = (props: any) => {
98
75
  }),
99
76
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
100
77
  })
101
- const assignedTimeDiff = moment.utc(order?.driver?.last_order_assigned_at).local().fromNow()
78
+ const assignedTimeDiff = moment.utc(value?.driver?.last_order_assigned_at).local().fromNow()
102
79
  if (assignedTimeDiff === 'a few seconds ago') {
103
- clearInterval(soundTimeout)
104
80
  handlePlayNotificationSound()
105
- setNewOrderId(order.id)
106
- if(isFocused){
107
- setModalOpen(true)
108
- }
81
+ clearInterval(soundTimeout)
82
+ setCurrentEvent({ evt: 2, orderId: value?.id })
109
83
  }
84
+ return
110
85
  }
111
- }, [newOrderId, notificationSound, soundTimeout])
86
+ handlePlayNotificationSound()
87
+ clearInterval(soundTimeout)
88
+ setCurrentEvent({
89
+ evt: evtType,
90
+ orderId: evtList[evtType].event === 'messages' ? value?.order_id : value?.id
91
+ })
92
+ }
112
93
 
113
94
  useEffect(() => {
114
- if (user?.level !== 4) return
115
- events.on('order_updated_noification', handleUpdateOrder)
95
+ events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
96
+ events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
97
+ events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
116
98
  return () => {
117
- events.off('order_updated_noification', handleUpdateOrder)
99
+ events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
100
+ events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
101
+ events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
118
102
  }
119
- }, [handleUpdateOrder, user])
103
+ }, [])
120
104
 
121
105
  useEffect(() => {
122
106
  notificationSound.setVolume(1);
@@ -125,21 +109,12 @@ const NewOrderNotificationUI = (props: any) => {
125
109
  }
126
110
  }, [])
127
111
 
128
- useFocusEffect(
129
- useCallback(() => {
130
- setIsFocused(true)
131
- return () => {
132
- setIsFocused(false)
133
- }
134
- }, [])
135
- )
136
-
137
112
  return (
138
113
  <>
139
114
  <Modal
140
115
  animationType='slide'
141
116
  transparent={true}
142
- visible={modalOpen}
117
+ visible={!!currentEvent?.orderId}
143
118
  >
144
119
  <NotificationContainer>
145
120
  <View style={styles.modalView}>
@@ -147,40 +122,26 @@ const NewOrderNotificationUI = (props: any) => {
147
122
  style={styles.wrapperIcon}
148
123
  onPress={() => handleCloseModal()}
149
124
  >
150
- <Icon
151
- name="x"
152
- size={30}
153
- />
125
+ <Icon name="x" size={30} />
154
126
  </TouchableOpacity>
155
127
  <OText
156
128
  size={18}
157
129
  color={theme.colors.textGray}
158
130
  weight={600}
159
131
  >
160
- {currentChange === 1 ? t('NEW_ORDRES_RECEIVED', 'New orders have been received!') : t('NEW_MESSAGES_RECEIVED', 'New messages have been received!')}
132
+ {evtList[currentEvent?.evt]?.message}
161
133
  </OText>
162
134
  <OIcon
163
135
  src={theme.images.general.newOrder}
164
136
  width={250}
165
137
  height={200}
166
138
  />
167
- {newOrderId !== null && (
168
- <OText
169
- color={theme.colors.textGray}
170
- mBottom={15}
171
- >
172
- {t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', newOrderId)}
173
- </OText>
174
- )}
175
-
176
- {messageOrderId !== null && (
177
- <OText
178
- color={theme.colors.textGray}
179
- mBottom={15}
180
- >
181
- {t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', messageOrderId)}
182
- </OText>
183
- )}
139
+ <OText
140
+ color={theme.colors.textGray}
141
+ mBottom={15}
142
+ >
143
+ {evtList[currentEvent?.evt]?.message2}
144
+ </OText>
184
145
  </View>
185
146
  </NotificationContainer>
186
147
  </Modal>
@@ -11,6 +11,7 @@ import {
11
11
  Table,
12
12
  OrderBill,
13
13
  Total,
14
+ OSRow,
14
15
  } from './styles';
15
16
 
16
17
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -75,6 +76,20 @@ export const OrderContentComponent = (props: OrderContent) => {
75
76
  }
76
77
  })
77
78
 
79
+ const getIncludedTaxes = () => {
80
+ if (order?.taxes?.length === 0) {
81
+ return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
82
+ } else {
83
+ return order?.taxes.reduce((taxIncluded: number, tax: any) => {
84
+ return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
85
+ }, 0)
86
+ }
87
+ }
88
+
89
+ const getIncludedTaxesDiscounts = () => {
90
+ return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
91
+ }
92
+
78
93
  return (
79
94
  <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
80
95
  {isOrderGroup && (
@@ -281,14 +296,14 @@ export const OrderContentComponent = (props: OrderContent) => {
281
296
  </OText>
282
297
  )}
283
298
  {((order?.delivery_option !== undefined && order?.delivery_type === 1) || !!order?.comment) && (
284
- <View style={{marginTop: 10}}>
299
+ <View style={{ marginTop: 10 }}>
285
300
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
286
301
  <OText>
287
302
  {order?.delivery_option?.name}
288
303
  </OText>
289
304
  )}
290
305
  {!!order?.comment && (
291
- <OText style={{fontStyle: 'italic', opacity: 0.6, marginBottom: 5}}>
306
+ <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 5 }}>
292
307
  {order?.comment}
293
308
  </OText>
294
309
  )}
@@ -323,84 +338,109 @@ export const OrderContentComponent = (props: OrderContent) => {
323
338
  <Table>
324
339
  <OText mBottom={4}>{t('SUBTOTAL', 'Subtotal')}</OText>
325
340
  <OText mBottom={4}>
326
- {parsePrice(
327
- order.tax_type === 1
328
- ? order?.summary?.subtotal + order?.summary?.tax ?? 0
329
- : order?.summary?.subtotal ?? 0,
330
- )}
341
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
331
342
  </OText>
332
343
  </Table>
333
-
334
- {order?.tax_type !== 1 && (
344
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
345
+ <Table>
346
+ {order?.offer_type === 1 ? (
347
+ <OText mBottom={4}>
348
+ {t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}{' '}
349
+ <OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
350
+ </OText>
351
+ ) : (
352
+ <OText mBottom={4}>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
353
+ )}
354
+ <OText>- {parsePrice(order?.summary?.discount ?? order?.discount)}</OText>
355
+ </Table>
356
+ )}
357
+ {
358
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
359
+ <Table key={offer.id}>
360
+ <OSRow>
361
+ <OText numberOfLines={1} mBottom={4}>
362
+ {offer.name}
363
+ {offer.rate_type === 1 && (
364
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
365
+ )}
366
+ </OText>
367
+ </OSRow>
368
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
369
+ </Table>
370
+ ))
371
+ }
372
+ {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
373
+ <Table>
374
+ <OText mBottom={4}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
375
+ {order?.tax_type === 1 ? (
376
+ <OText mBottom={4}>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
377
+ ) : (
378
+ <OText mBottom={4}>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
379
+ )}
380
+ </Table>
381
+ )}
382
+ {order?.taxes?.length === 0 && order?.tax_type === 2 && order?.summary?.tax > 0 && (
335
383
  <Table>
336
384
  <OText mBottom={4}>
337
- {t('TAX', 'Tax')}
338
- {`(${verifyDecimals(
339
- order?.summary?.tax_rate,
340
- parseNumber,
341
- )}%)`}
385
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
342
386
  </OText>
343
-
344
387
  <OText mBottom={4}>
345
388
  {parsePrice(order?.summary?.tax ?? 0)}
346
389
  </OText>
347
- </Table >
390
+ </Table>
348
391
  )}
349
-
350
392
  {
351
- order?.summary?.discount > 0 && (
393
+ order?.fees?.length === 0 && order?.summary?.service_fee > 0 && (
352
394
  <Table>
353
- {order?.offer_type === 1 ? (
354
- <OText mBottom={4}>
355
- <OText>{t('DISCOUNT', 'Discount')}</OText>
356
-
357
- <OText>
358
- {`(${verifyDecimals(
359
- order?.offer_rate,
360
- parsePrice,
361
- )}%)`}
362
- </OText>
363
- </OText>
364
- ) : (
365
- <OText mBottom={4}>{t('DISCOUNT', 'Discount')}</OText>
366
- )}
367
-
368
395
  <OText mBottom={4}>
369
- - {parsePrice(order?.summary?.discount)}
396
+ {t('SERVICE_FEE', 'Service fee')}
397
+ {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
370
398
  </OText>
399
+ <OText mBottom={4}>{parsePrice(order?.summary?.service_fee ?? 0)}</OText>
371
400
  </Table>
372
401
  )
373
402
  }
374
-
375
403
  {
376
- order?.summary?.subtotal_with_discount > 0 &&
377
- order?.summary?.discount > 0 &&
378
- order?.summary?.total >= 0 && (
379
- <Table>
380
- <OText mBottom={4}>
381
- {t(
382
- 'SUBTOTAL_WITH_DISCOUNT',
383
- 'Subtotal with discount',
384
- )}
385
- </OText>
386
- {order?.tax_type === 1 ? (
387
- <OText mBottom={4}>
388
- {parsePrice(
389
- order?.summary?.subtotal_with_discount +
390
- order?.summary?.tax ?? 0,
391
- )}
404
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
405
+ <Table key={tax.id}>
406
+ <OSRow>
407
+ <OText numberOfLines={1} mBottom={4}>
408
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
409
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
410
+ </OText>
411
+ </OSRow>
412
+ <OText mBottom={4}>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
413
+ </Table>
414
+ ))
415
+ }
416
+ {
417
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
418
+ <Table key={fee.id}>
419
+ <OSRow>
420
+ <OText numberOfLines={1} mBottom={4}>
421
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
422
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
392
423
  </OText>
393
- ) : (
394
- <OText mBottom={4}>
395
- {parsePrice(
396
- order?.summary?.subtotal_with_discount ?? 0,
424
+ </OSRow>
425
+ <OText mBottom={4}>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
426
+ </Table>
427
+ ))
428
+ }
429
+ {
430
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
431
+ <Table key={offer.id}>
432
+ <OSRow>
433
+ <OText numberOfLines={1} mBottom={4}>
434
+ {offer.name}
435
+ {offer.rate_type === 1 && (
436
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
397
437
  )}
398
438
  </OText>
399
- )}
439
+ </OSRow>
440
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
400
441
  </Table>
401
- )
442
+ ))
402
443
  }
403
-
404
444
  {
405
445
  order?.summary?.delivery_price > 0 && (
406
446
  <Table>
@@ -414,41 +454,35 @@ export const OrderContentComponent = (props: OrderContent) => {
414
454
  </Table>
415
455
  )
416
456
  }
417
-
418
- <Table>
419
- <OText mBottom={4}>
420
- {t('DRIVER_TIP', 'Driver tip')}{' '}
421
- {order?.summary?.driver_tip > 0 &&
422
- parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
423
- !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
424
- `(${verifyDecimals(
425
- order?.summary?.driver_tip,
426
- parseNumber,
427
- )}%)`}
428
- </OText>
429
-
430
- <OText mBottom={4}>
431
- {parsePrice(order?.summary?.driver_tip ?? 0)}
432
- </OText>
433
- </Table>
434
-
435
457
  {
436
- order?.summary?.service_fee > 0 && (
437
- <Table>
438
- <OText mBottom={4}>
439
- {t('SERVICE_FEE', 'Service Fee')}{' '}
440
- {`(${verifyDecimals(
441
- order?.summary?.service_fee,
442
- parseNumber,
443
- )}%)`}
444
- </OText>
445
-
446
- <OText mBottom={4}>
447
- {parsePrice(order?.summary?.service_fee)}
448
- </OText>
458
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
459
+ <Table key={offer.id}>
460
+ <OSRow>
461
+ <OText numberOfLines={1} mBottom={4}>
462
+ {offer.name}
463
+ {offer.rate_type === 1 && (
464
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
465
+ )}
466
+ </OText>
467
+ </OSRow>
468
+ <OText mBottom={4}>- {parsePrice(offer?.summary?.discount)}</OText>
449
469
  </Table>
450
- )
470
+ ))
451
471
  }
472
+ {order?.summary?.driver_tip > 0 && (
473
+ <Table>
474
+ <OText mBottom={4}>
475
+ {t('DRIVER_TIP', 'Driver tip')}
476
+ {order?.summary?.driver_tip > 0 &&
477
+ parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
478
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
479
+ (
480
+ `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
481
+ )}
482
+ </OText>
483
+ <OText mBottom={4}>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
484
+ </Table>
485
+ )}
452
486
 
453
487
  <Total style={{ paddingBottom: 10 }}>
454
488
  <Table>
@@ -460,7 +494,7 @@ export const OrderContentComponent = (props: OrderContent) => {
460
494
  mBottom={4}
461
495
  style={styles.textBold}
462
496
  color={theme.colors.primary}>
463
- {parsePrice(order?.summary?.total ?? 0)}
497
+ {parsePrice(order?.summary?.total ?? order?.total)}
464
498
  </OText>
465
499
  </Table>
466
500
  </Total>
@@ -91,3 +91,10 @@ export const AssignDriver = styled.View`
91
91
  padding-vertical: 10px;
92
92
  margin-bottom: 10px;
93
93
  `;
94
+
95
+ export const OSRow = styled.View`
96
+ flex-direction: row;
97
+ overflow: hidden;
98
+ width: 70%;
99
+ flex-wrap: wrap;
100
+ `