ordering-ui-react-native 0.21.32 → 0.21.33-test
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 +1 -1
- package/themes/business/src/components/Chat/index.tsx +14 -23
- package/themes/business/src/components/NewOrderNotification/index.tsx +121 -105
- package/themes/business/src/components/OrdersOption/index.tsx +1 -82
- package/themes/original/src/components/BusinessInformation/index.tsx +0 -1
- package/themes/original/src/components/Checkout/index.tsx +1 -12
- package/themes/original/src/components/GoogleMap/index.tsx +4 -5
- package/themes/original/src/components/Messages/index.tsx +0 -1
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +2 -14
- package/themes/original/src/types/index.tsx +0 -1
package/package.json
CHANGED
|
@@ -386,30 +386,21 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
386
386
|
style={{ ...styles.firstMessageText, textAlign: 'center' }}
|
|
387
387
|
>
|
|
388
388
|
{
|
|
389
|
-
message.change?.attribute
|
|
390
|
-
?
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
389
|
+
message.change?.attribute !== 'driver_id'
|
|
390
|
+
?
|
|
391
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
|
|
392
|
+
? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
|
|
393
|
+
: `${message.change?.attribute !== 'logistic_status'
|
|
394
|
+
? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
|
|
395
|
+
: message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
|
|
396
|
+
? t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
397
|
+
: getLogisticTag(message.change.new)}`
|
|
398
|
+
}`
|
|
399
|
+
: message.change.new
|
|
399
400
|
?
|
|
400
|
-
`${
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
|
|
404
|
-
: message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
|
|
405
|
-
? t(ORDER_STATUS[parseInt(message.change.new, 10)])
|
|
406
|
-
: getLogisticTag(message.change.new)}`
|
|
407
|
-
}`
|
|
408
|
-
: message.change.new
|
|
409
|
-
?
|
|
410
|
-
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
411
|
-
:
|
|
412
|
-
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
|
|
401
|
+
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
|
402
|
+
:
|
|
403
|
+
`${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
|
|
413
404
|
}
|
|
414
405
|
</OText>
|
|
415
406
|
<OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
|
|
@@ -1,82 +1,102 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Modal,
|
|
4
|
+
View,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Dimensions,
|
|
7
|
+
TouchableOpacity
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { useTheme } from 'styled-components/native'
|
|
1
10
|
import moment from 'moment'
|
|
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'
|
|
5
|
-
import Sound from 'react-native-sound'
|
|
6
11
|
import Icon from 'react-native-vector-icons/Feather'
|
|
7
|
-
import
|
|
12
|
+
import SoundPlayer from 'react-native-sound-player'
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
NewOrderNotification as NewOrderNotificationController,
|
|
16
|
+
useApi,
|
|
17
|
+
useEvent,
|
|
18
|
+
useLanguage,
|
|
19
|
+
useSession
|
|
20
|
+
} from 'ordering-components/native'
|
|
8
21
|
|
|
9
|
-
import { useLocation } from '../../hooks/useLocation'
|
|
10
22
|
import { OIcon, OText } from '../shared'
|
|
11
23
|
import { NotificationContainer } from './styles'
|
|
24
|
+
import { useLocation } from '../../hooks/useLocation'
|
|
12
25
|
|
|
13
|
-
|
|
14
|
-
Sound.setMode('Default')
|
|
15
|
-
|
|
26
|
+
const DELAY_SOUND = 2500 // 2 sec
|
|
16
27
|
const windowWidth = Dimensions.get('screen').width
|
|
17
28
|
|
|
18
|
-
const
|
|
29
|
+
const SoundPlayerComponent = (props: any) => {
|
|
30
|
+
const { evtList, currentEvent, handleCloseEvents } = props
|
|
19
31
|
|
|
20
|
-
const NewOrderNotificationUI = (props: any) => {
|
|
21
|
-
const { isBusinessApp } = props
|
|
22
|
-
const [events] = useEvent()
|
|
23
32
|
const theme = useTheme()
|
|
24
|
-
const [,
|
|
25
|
-
const [{ user, token }] = useSession()
|
|
26
|
-
const [ordering] = useApi()
|
|
27
|
-
const { getCurrentLocation } = useLocation();
|
|
28
|
-
const [currentEvent, setCurrentEvent] = useState<any>(null)
|
|
29
|
-
|
|
30
|
-
const evtList: any = {
|
|
31
|
-
1: {
|
|
32
|
-
event: 'messages',
|
|
33
|
-
message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
|
|
34
|
-
message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
|
|
35
|
-
},
|
|
36
|
-
2: {
|
|
37
|
-
event: 'order_added',
|
|
38
|
-
message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
|
|
39
|
-
message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
|
|
40
|
-
},
|
|
41
|
-
3: {
|
|
42
|
-
event: 'order_updated',
|
|
43
|
-
message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
|
|
44
|
-
message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
|
|
45
|
-
},
|
|
46
|
-
}
|
|
33
|
+
const [count, setCount] = useState(0);
|
|
47
34
|
|
|
48
|
-
const
|
|
35
|
+
const URL_SOUND = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
|
|
49
36
|
|
|
50
|
-
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const id = setInterval(() => setCount(count + 1), 2500)
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
const playSound = async () => {
|
|
41
|
+
SoundPlayer.playUrl(URL_SOUND)
|
|
42
|
+
await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
|
|
43
|
+
SoundPlayer.stop()
|
|
44
|
+
}
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
notificationSound.stop()
|
|
57
|
-
setCurrentEvent(null)
|
|
58
|
-
clearInterval(_timeout)
|
|
59
|
-
}
|
|
46
|
+
playSound()
|
|
60
47
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (times === 3) {
|
|
65
|
-
times = 0
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
return
|
|
48
|
+
return () => {
|
|
49
|
+
SoundPlayer.stop()
|
|
50
|
+
clearInterval(id);
|
|
69
51
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
52
|
+
}, [count])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Modal
|
|
56
|
+
animationType='slide'
|
|
57
|
+
transparent={true}
|
|
58
|
+
visible={!!currentEvent?.orderId}
|
|
59
|
+
>
|
|
60
|
+
<NotificationContainer>
|
|
61
|
+
<View style={styles.modalView}>
|
|
62
|
+
<TouchableOpacity
|
|
63
|
+
style={styles.wrapperIcon}
|
|
64
|
+
onPress={() => handleCloseEvents()}
|
|
65
|
+
>
|
|
66
|
+
<Icon name="x" size={30} />
|
|
67
|
+
</TouchableOpacity>
|
|
68
|
+
<OText
|
|
69
|
+
size={18}
|
|
70
|
+
color={theme.colors.textGray}
|
|
71
|
+
weight={600}
|
|
72
|
+
>
|
|
73
|
+
{evtList(currentEvent)[currentEvent?.evt]?.message}
|
|
74
|
+
</OText>
|
|
75
|
+
<OIcon
|
|
76
|
+
src={theme.images.general.newOrder}
|
|
77
|
+
width={250}
|
|
78
|
+
height={200}
|
|
79
|
+
/>
|
|
80
|
+
<OText
|
|
81
|
+
color={theme.colors.textGray}
|
|
82
|
+
mBottom={15}
|
|
83
|
+
>
|
|
84
|
+
{evtList(currentEvent)[currentEvent?.evt]?.message2}
|
|
85
|
+
</OText>
|
|
86
|
+
</View>
|
|
87
|
+
</NotificationContainer>
|
|
88
|
+
</Modal>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const NewOrderNotificationUI = (props: any) => {
|
|
93
|
+
const { isBusinessApp, evtList } = props
|
|
94
|
+
|
|
95
|
+
const [events] = useEvent()
|
|
96
|
+
const [{ user, token }] = useSession()
|
|
97
|
+
const [ordering] = useApi()
|
|
98
|
+
const { getCurrentLocation } = useLocation()
|
|
99
|
+
const [currentEvent, setCurrentEvent] = useState<any>(null)
|
|
80
100
|
|
|
81
101
|
const handleEventNotification = async (evtType: number, value: any) => {
|
|
82
102
|
if (value?.driver) {
|
|
@@ -93,14 +113,18 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
93
113
|
const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
|
|
94
114
|
const assignedSecondsDiff = duration.asSeconds()
|
|
95
115
|
if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
|
|
96
|
-
|
|
116
|
+
setCurrentEvent({ evt: 2, orderId: value?.id })
|
|
97
117
|
}
|
|
98
118
|
}
|
|
99
|
-
if (evtType === 3 || value
|
|
100
|
-
|
|
119
|
+
if (evtType === 3 || value?.author_id === user.id) return
|
|
120
|
+
setCurrentEvent({
|
|
101
121
|
evt: evtType,
|
|
102
|
-
orderId: value?.driver
|
|
103
|
-
|
|
122
|
+
orderId: value?.driver
|
|
123
|
+
? value?.order_id
|
|
124
|
+
: evtList(currentEvent)[evtType].event === 'messages'
|
|
125
|
+
? value?.order?.id
|
|
126
|
+
: value?.order_id ?? value?.id
|
|
127
|
+
})
|
|
104
128
|
}
|
|
105
129
|
|
|
106
130
|
useEffect(() => {
|
|
@@ -120,48 +144,21 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
120
144
|
}, [])
|
|
121
145
|
|
|
122
146
|
useEffect(() => {
|
|
123
|
-
return () =>
|
|
147
|
+
return () => setCurrentEvent(null)
|
|
124
148
|
}, [])
|
|
125
149
|
|
|
126
150
|
return (
|
|
127
151
|
<>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<TouchableOpacity
|
|
136
|
-
style={styles.wrapperIcon}
|
|
137
|
-
onPress={() => handleCloseEvents()}
|
|
138
|
-
>
|
|
139
|
-
<Icon name="x" size={30} />
|
|
140
|
-
</TouchableOpacity>
|
|
141
|
-
<OText
|
|
142
|
-
size={18}
|
|
143
|
-
color={theme.colors.textGray}
|
|
144
|
-
weight={600}
|
|
145
|
-
>
|
|
146
|
-
{evtList[currentEvent?.evt]?.message}
|
|
147
|
-
</OText>
|
|
148
|
-
<OIcon
|
|
149
|
-
src={theme.images.general.newOrder}
|
|
150
|
-
width={250}
|
|
151
|
-
height={200}
|
|
152
|
-
/>
|
|
153
|
-
<OText
|
|
154
|
-
color={theme.colors.textGray}
|
|
155
|
-
mBottom={15}
|
|
156
|
-
>
|
|
157
|
-
{evtList[currentEvent?.evt]?.message2}
|
|
158
|
-
</OText>
|
|
159
|
-
</View>
|
|
160
|
-
</NotificationContainer>
|
|
161
|
-
</Modal>
|
|
152
|
+
{!!currentEvent ? (
|
|
153
|
+
<SoundPlayerComponent
|
|
154
|
+
evtList={evtList}
|
|
155
|
+
currentEvent={currentEvent}
|
|
156
|
+
handleCloseEvents={() => setCurrentEvent(null)}
|
|
157
|
+
/>
|
|
158
|
+
) : null}
|
|
162
159
|
</>
|
|
163
160
|
)
|
|
164
|
-
}
|
|
161
|
+
};
|
|
165
162
|
|
|
166
163
|
const styles = StyleSheet.create({
|
|
167
164
|
modalView: {
|
|
@@ -181,9 +178,28 @@ const styles = StyleSheet.create({
|
|
|
181
178
|
})
|
|
182
179
|
|
|
183
180
|
export const NewOrderNotification = (props: any) => {
|
|
181
|
+
const [, t] = useLanguage()
|
|
182
|
+
|
|
184
183
|
const newOrderNotificationProps = {
|
|
185
184
|
...props,
|
|
186
|
-
UIComponent: NewOrderNotificationUI
|
|
185
|
+
UIComponent: NewOrderNotificationUI,
|
|
186
|
+
evtList: (currentEvent: any) => ({
|
|
187
|
+
1: {
|
|
188
|
+
event: 'messages',
|
|
189
|
+
message: t('NEW_MESSAGES_RECEIVED', 'New messages have been received!'),
|
|
190
|
+
message2: t('ORDER_N_UNREAD_MESSAGES', 'Order #_order_id_ has unread messages.').replace('_order_id_', currentEvent?.orderId),
|
|
191
|
+
},
|
|
192
|
+
2: {
|
|
193
|
+
event: 'order_added',
|
|
194
|
+
message: t('NEW_ORDERS_RECEIVED', 'New orders have been received!'),
|
|
195
|
+
message2: t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', currentEvent?.orderId),
|
|
196
|
+
},
|
|
197
|
+
3: {
|
|
198
|
+
event: 'order_updated',
|
|
199
|
+
message: t('NEW_ORDERS_UPDATED', 'New orders have been updated!'),
|
|
200
|
+
message2: t('ORDER_N_UPDATED', 'Order #_order_id_ has been updated.').replace('_order_id_', currentEvent?.orderId),
|
|
201
|
+
},
|
|
202
|
+
})
|
|
187
203
|
};
|
|
188
204
|
|
|
189
205
|
return <NewOrderNotificationController {...newOrderNotificationProps} />;
|
|
@@ -6,11 +6,6 @@ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
|
6
6
|
import FeatherIcon from 'react-native-vector-icons/Feather';
|
|
7
7
|
import FontistoIcon from 'react-native-vector-icons/Fontisto'
|
|
8
8
|
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
9
|
-
import TrackPlayer, {
|
|
10
|
-
RepeatMode,
|
|
11
|
-
Capability,
|
|
12
|
-
AppKilledPlaybackBehavior
|
|
13
|
-
} from 'react-native-track-player';
|
|
14
9
|
|
|
15
10
|
import { useTheme } from 'styled-components/native';
|
|
16
11
|
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
@@ -112,79 +107,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
112
107
|
const HEIGHT_SCREEN = orientationState?.dimensions?.height
|
|
113
108
|
const IS_PORTRAIT = orientationState.orientation === PORTRAIT
|
|
114
109
|
|
|
115
|
-
const URL_SOUND = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
|
|
116
|
-
|
|
117
|
-
const setupPlayer = async (options: any) => {
|
|
118
|
-
const setup = async () => {
|
|
119
|
-
try {
|
|
120
|
-
await TrackPlayer.setupPlayer(options);
|
|
121
|
-
} catch (error) {
|
|
122
|
-
return (error as Error & { code?: string }).code;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
while ((await setup()) === 'android_cannot_setup_player_in_background') {
|
|
126
|
-
await new Promise<void>((resolve) => setTimeout(resolve, 1));
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const SetupService = async () => {
|
|
131
|
-
await setupPlayer({ autoHandleInterruptions: true });
|
|
132
|
-
await TrackPlayer.updateOptions({
|
|
133
|
-
android: {
|
|
134
|
-
appKilledPlaybackBehavior:
|
|
135
|
-
AppKilledPlaybackBehavior.StopPlaybackAndRemoveNotification,
|
|
136
|
-
},
|
|
137
|
-
capabilities: [
|
|
138
|
-
Capability.Play,
|
|
139
|
-
Capability.Pause,
|
|
140
|
-
Capability.SkipToNext,
|
|
141
|
-
Capability.SkipToPrevious,
|
|
142
|
-
Capability.SeekTo,
|
|
143
|
-
],
|
|
144
|
-
compactCapabilities: [
|
|
145
|
-
Capability.Play,
|
|
146
|
-
Capability.Pause,
|
|
147
|
-
Capability.SkipToNext,
|
|
148
|
-
],
|
|
149
|
-
progressUpdateEventInterval: 2,
|
|
150
|
-
});
|
|
151
|
-
await TrackPlayer.setRepeatMode(RepeatMode.Track);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const QueueInitialTracksService = async () => {
|
|
155
|
-
await TrackPlayer.add([
|
|
156
|
-
{
|
|
157
|
-
id: 'notification',
|
|
158
|
-
url: URL_SOUND,
|
|
159
|
-
title: 'notification'
|
|
160
|
-
},
|
|
161
|
-
]);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function useSetupPlayer() {
|
|
165
|
-
const [playerReady, setPlayerReady] = useState<boolean>(false)
|
|
166
|
-
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
let unmounted = false;
|
|
169
|
-
(async () => {
|
|
170
|
-
await SetupService()
|
|
171
|
-
if (unmounted) return
|
|
172
|
-
setPlayerReady(true)
|
|
173
|
-
const queue = await TrackPlayer.getQueue()
|
|
174
|
-
if (unmounted) return
|
|
175
|
-
if (queue.length <= 0) {
|
|
176
|
-
await QueueInitialTracksService()
|
|
177
|
-
}
|
|
178
|
-
})();
|
|
179
|
-
return () => {
|
|
180
|
-
unmounted = true;
|
|
181
|
-
};
|
|
182
|
-
}, []);
|
|
183
|
-
return playerReady;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const isPlayerReady = useSetupPlayer()
|
|
187
|
-
|
|
188
110
|
const preorderTypeList = [
|
|
189
111
|
{ key: null, name: t('SLA', 'SLA\'s') },
|
|
190
112
|
{ key: 'in_time', name: t('OK', 'Ok') },
|
|
@@ -780,10 +702,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
|
|
|
780
702
|
</View>
|
|
781
703
|
|
|
782
704
|
{isBusinessApp && (
|
|
783
|
-
<NewOrderNotification
|
|
784
|
-
isBusinessApp={isBusinessApp}
|
|
785
|
-
isPlayerReady={isPlayerReady}
|
|
786
|
-
/>
|
|
705
|
+
<NewOrderNotification isBusinessApp={isBusinessApp} />
|
|
787
706
|
)}
|
|
788
707
|
|
|
789
708
|
{(openSearchModal || openSLASettingModal) && (
|
|
@@ -106,7 +106,6 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
106
106
|
location={businessLocation.location}
|
|
107
107
|
markerTitle={businessState?.business?.name}
|
|
108
108
|
businessZones={businessState?.business?.zones}
|
|
109
|
-
delta={30}
|
|
110
109
|
/>
|
|
111
110
|
</WrapBusinessMap>
|
|
112
111
|
)}
|
|
@@ -192,7 +192,6 @@ const CheckoutUI = (props: any) => {
|
|
|
192
192
|
}, cart?.subtotal)
|
|
193
193
|
|
|
194
194
|
const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
195
|
-
const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required && !paymethodSelected?.data?.card?.zipcode
|
|
196
195
|
|
|
197
196
|
const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
|
|
198
197
|
placing || errorCash || subtotalWithTaxes < cart?.minimum ||
|
|
@@ -201,8 +200,7 @@ const CheckoutUI = (props: any) => {
|
|
|
201
200
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
202
201
|
validationFields?.fields?.checkout?.driver_tip?.required &&
|
|
203
202
|
(Number(cart?.driver_tip) <= 0)) ||
|
|
204
|
-
(validateCommentsCartField)
|
|
205
|
-
(validateZipcodeCard)
|
|
203
|
+
(validateCommentsCartField)
|
|
206
204
|
|| (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
|
|
207
205
|
|
|
208
206
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
@@ -898,15 +896,6 @@ const CheckoutUI = (props: any) => {
|
|
|
898
896
|
{t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
|
|
899
897
|
</OText>
|
|
900
898
|
)}
|
|
901
|
-
|
|
902
|
-
{validateZipcodeCard && (
|
|
903
|
-
<OText
|
|
904
|
-
color={theme.colors.error}
|
|
905
|
-
size={12}
|
|
906
|
-
>
|
|
907
|
-
{t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
|
|
908
|
-
</OText>
|
|
909
|
-
)}
|
|
910
899
|
</ChErrors>
|
|
911
900
|
</View>
|
|
912
901
|
)}
|
|
@@ -20,8 +20,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
20
20
|
handleToggleMap,
|
|
21
21
|
locations,
|
|
22
22
|
isIntGeoCoder,
|
|
23
|
-
businessZones
|
|
24
|
-
delta
|
|
23
|
+
businessZones
|
|
25
24
|
} = props
|
|
26
25
|
|
|
27
26
|
const [, t] = useLanguage()
|
|
@@ -32,8 +31,8 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
32
31
|
const [region, setRegion] = useState({
|
|
33
32
|
latitude: location.lat,
|
|
34
33
|
longitude: location.lng,
|
|
35
|
-
latitudeDelta:
|
|
36
|
-
longitudeDelta:
|
|
34
|
+
latitudeDelta: 0.0010,
|
|
35
|
+
longitudeDelta: 0.0010 * ASPECT_RATIO
|
|
37
36
|
})
|
|
38
37
|
const [MARKERS, SETMARKERS] = useState(locations)
|
|
39
38
|
let mapRef = useRef<any>(null)
|
|
@@ -266,7 +265,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
266
265
|
)}
|
|
267
266
|
{(businessZone.type === 5 && businessZone?.data?.distance) && (
|
|
268
267
|
<Circle
|
|
269
|
-
center={{ latitude: center.lat, longitude: center.lng}}
|
|
268
|
+
center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
|
|
270
269
|
radius={businessZone?.data.distance * units[businessZone?.data?.unit]}
|
|
271
270
|
fillColor={fillStyles.fillColor}
|
|
272
271
|
strokeColor={fillStyles.strokeColor}
|
|
@@ -152,7 +152,6 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
152
152
|
}
|
|
153
153
|
const newMessage: any = [];
|
|
154
154
|
messages.messages.map((message: any) => {
|
|
155
|
-
if (message.change?.attribute === 'driver_group_id') return
|
|
156
155
|
if (business && message.type !== 0 && (messagesToShow?.messages?.length || message?.can_see?.includes('2'))) {
|
|
157
156
|
newMessage.push({
|
|
158
157
|
_id: message?.id,
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
PaymentOptionStripe,
|
|
5
5
|
useSession,
|
|
6
6
|
useLanguage,
|
|
7
|
-
useValidationFields
|
|
8
7
|
} from 'ordering-components/native';
|
|
9
8
|
import { PlaceholderLine } from 'rn-placeholder';
|
|
10
9
|
import { useTheme } from 'styled-components/native';
|
|
@@ -41,13 +40,10 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
41
40
|
|
|
42
41
|
const [{ token }] = useSession();
|
|
43
42
|
const [, t] = useLanguage();
|
|
44
|
-
|
|
45
|
-
const validateZipcodeCard =
|
|
46
|
-
validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required
|
|
43
|
+
|
|
47
44
|
const paymethodsWithoutSaveCards = ['credomatic']
|
|
48
45
|
|
|
49
46
|
const handleCardSelected = (card: any) => {
|
|
50
|
-
if (!card?.zipcode && validateZipcodeCard) return
|
|
51
47
|
handleCardClick(card);
|
|
52
48
|
onSelectCard(card);
|
|
53
49
|
}
|
|
@@ -96,8 +92,7 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
96
92
|
style={styles.cardsList}
|
|
97
93
|
>
|
|
98
94
|
{cardsList.cards.map((card: any) => (
|
|
99
|
-
<OSItem key={card.id} isUnique={cardsList.cards.length}
|
|
100
|
-
{console.log(card?.zipcode && validateZipcodeCard)}
|
|
95
|
+
<OSItem key={card.id} isUnique={cardsList.cards.length}>
|
|
101
96
|
<OSItemContent onPress={() => handleCardSelected(card)}>
|
|
102
97
|
<View style={styles.viewStyle}>
|
|
103
98
|
{card.id === cardSelected?.id ? (
|
|
@@ -122,13 +117,6 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
122
117
|
XXXX-XXXX-XXXX-{card.last4}
|
|
123
118
|
</OText>
|
|
124
119
|
</View>
|
|
125
|
-
{!card?.zipcode && validateZipcodeCard && (
|
|
126
|
-
<View style={styles.viewStyle}>
|
|
127
|
-
<OText size={10} color={theme?.colors?.danger5}>
|
|
128
|
-
({t('MISSING_ZIPCODE', 'Missing zipcode')})
|
|
129
|
-
</OText>
|
|
130
|
-
</View>
|
|
131
|
-
)}
|
|
132
120
|
</OSItemContent>
|
|
133
121
|
<OSItemActions>
|
|
134
122
|
<OAlert
|