ordering-ui-react-native 0.17.4-release → 0.17.5-release
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
|
@@ -6,6 +6,7 @@ import { Platform, View } from 'react-native';
|
|
|
6
6
|
import { StripeMethodFormParams } from '../../types';
|
|
7
7
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
8
8
|
import { android_app_id } from '../../config.json'
|
|
9
|
+
|
|
9
10
|
export const StripeMethodForm = (props: StripeMethodFormParams) => {
|
|
10
11
|
const {
|
|
11
12
|
cart,
|
|
@@ -96,21 +97,12 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
const { error, paymentMethod } = await presentApplePay({
|
|
99
|
-
cartItems:
|
|
100
|
+
cartItems: [{
|
|
101
|
+
label: t('CART', 'Cart'),
|
|
102
|
+
amount: cart?.balance?.toString() ?? cart?.total?.toString?.()
|
|
103
|
+
}],
|
|
100
104
|
country: 'US',
|
|
101
105
|
currency: configs?.stripe_currency?.value ?? 'USD',
|
|
102
|
-
shippingMethods: [
|
|
103
|
-
{
|
|
104
|
-
amount: cart?.balance?.toString() ?? cart?.total?.toString?.(),
|
|
105
|
-
identifier: 'standard',
|
|
106
|
-
label: 'Courier',
|
|
107
|
-
detail: 'Delivery',
|
|
108
|
-
type: 'final',
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
|
|
112
|
-
requiredShippingAddressFields: ['emailAddress', 'phoneNumber'],
|
|
113
|
-
requiredBillingContactFields: ['phoneNumber', 'name'],
|
|
114
106
|
});
|
|
115
107
|
if (error) {
|
|
116
108
|
setErrors(error.code + ' - ' + error.message);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
1
|
import moment from 'moment'
|
|
3
|
-
import {
|
|
2
|
+
import { NewOrderNotification as NewOrderNotificationController, useApi, useEvent, useLanguage, useSession } from 'ordering-components/native'
|
|
3
|
+
import React, { useEffect, useState } from 'react'
|
|
4
|
+
import { Dimensions, Modal, StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
4
5
|
import Sound from 'react-native-sound'
|
|
5
6
|
import Icon from 'react-native-vector-icons/Feather'
|
|
6
7
|
import { useTheme } from 'styled-components/native'
|
|
7
|
-
import { useEvent, useLanguage, useSession, useApi, NewOrderNotification as NewOrderNotificationController } from 'ordering-components/native'
|
|
8
8
|
|
|
9
|
-
import { OText, OIcon } from '../shared'
|
|
10
|
-
import { NotificationContainer } from './styles'
|
|
11
9
|
import { useLocation } from '../../hooks/useLocation'
|
|
10
|
+
import { OIcon, OText } from '../shared'
|
|
11
|
+
import { NotificationContainer } from './styles'
|
|
12
12
|
|
|
13
|
-
Sound.setCategory('Playback')
|
|
13
|
+
Sound.setCategory('Playback', true)
|
|
14
|
+
Sound.setMode('Default')
|
|
14
15
|
|
|
15
16
|
const windowWidth = Dimensions.get('screen').width
|
|
16
17
|
|
|
@@ -57,14 +58,16 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
57
58
|
const handlePlayNotificationSound = (eventObj: any = null) => {
|
|
58
59
|
setCurrentEvent(eventObj)
|
|
59
60
|
let times = 1
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
notificationSound.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
_timeout = setInterval(() => {
|
|
62
|
+
if (times <= SOUND_LOOP) {
|
|
63
|
+
notificationSound.play()
|
|
64
|
+
times++
|
|
65
|
+
} else {
|
|
66
|
+
clearInterval(_timeout)
|
|
67
|
+
times = 1
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
}, 2500)
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
const handleEventNotification = async (evtType: number, value: any) => {
|
|
@@ -88,7 +91,7 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
88
91
|
if (evtType === 3 || value.author_id === user.id) return
|
|
89
92
|
handlePlayNotificationSound({
|
|
90
93
|
evt: evtType,
|
|
91
|
-
orderId: value?.order_id
|
|
94
|
+
orderId: value?.driver ? value?.order_id : evtList[evtType].event === 'messages' ? value?.order?.id : value?.id
|
|
92
95
|
})
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -12,7 +12,7 @@ export const OrderEta = (props: any) => {
|
|
|
12
12
|
const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
|
|
13
13
|
|
|
14
14
|
const getEstimatedDeliveryTime = () => {
|
|
15
|
-
let _estimatedTime
|
|
15
|
+
let _estimatedTime = null
|
|
16
16
|
let totalEta = 0
|
|
17
17
|
const _delivery = order?.delivery_datetime_utc
|
|
18
18
|
? order?.delivery_datetime_utc
|
|
@@ -40,7 +40,8 @@ export const OrderEta = (props: any) => {
|
|
|
40
40
|
} else {
|
|
41
41
|
_estimatedTime = moment.utc(_delivery).add(order?.eta_time, 'minutes')
|
|
42
42
|
}
|
|
43
|
-
_estimatedTime =
|
|
43
|
+
if (order?.delivered_in) { _estimatedTime = moment.utc(_delivery).add(order?.delivered_in, 'minutes')}
|
|
44
|
+
_estimatedTime = outputFormat ? moment(_estimatedTime).local().format(outputFormat) : parseDate(_estimatedTime, { utc: false })
|
|
44
45
|
setEstimatedDeliveryTime(_estimatedTime)
|
|
45
46
|
}
|
|
46
47
|
|