ordering-ui-react-native 0.12.18 → 0.12.19
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/src/config.json +2 -2
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
- package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
- package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
- package/themes/business/src/components 2/Chat/index.tsx +0 -1152
- package/themes/business/src/components 2/Chat/styles.tsx +0 -12
- package/themes/business/src/components 2/Contacts/index.tsx +0 -299
- package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
- package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
- package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
- package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
- package/themes/business/src/components 2/Home/index.tsx +0 -111
- package/themes/business/src/components 2/Home/styles.tsx +0 -27
- package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
- package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
- package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
- package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
- package/themes/business/src/components 2/MapView/index.tsx +0 -317
- package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
- package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
- package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
- package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
- package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
- package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
- package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
- package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
- package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
- package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
- package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
- package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
- package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
- package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
- package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
- package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
- package/themes/business/src/components 2/StoresList/index.tsx +0 -208
- package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
- package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
- package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
- package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
- package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
- package/themes/business/src/components 2/shared/OButton.tsx +0 -149
- package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
- package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
- package/themes/business/src/components 2/shared/OFab.tsx +0 -54
- package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
- package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
- package/themes/business/src/components 2/shared/OInput.tsx +0 -144
- package/themes/business/src/components 2/shared/OLink.tsx +0 -76
- package/themes/business/src/components 2/shared/OModal.tsx +0 -275
- package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
- package/themes/business/src/components 2/shared/OText.tsx +0 -55
- package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
- package/themes/business/src/components 2/shared/OToast.tsx +0 -92
- package/themes/business/src/components 2/shared/index.tsx +0 -27
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const FiltersTab = styled.View`
|
|
4
|
-
margin-bottom: 20px;
|
|
5
|
-
`;
|
|
6
|
-
|
|
7
|
-
export const TabsContainer = styled.View`
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: row;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
border-bottom-width: 1px;
|
|
12
|
-
border-bottom-color: #e9ecef;
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export const TagsContainer = styled.ScrollView`
|
|
16
|
-
margin-bottom: 10px;
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
export const Tag = styled.Pressable`
|
|
20
|
-
background-color: ${({ isSelected }: { isSelected: string }) => isSelected};
|
|
21
|
-
justify-content: center;
|
|
22
|
-
align-items: center;
|
|
23
|
-
min-height: 34px;
|
|
24
|
-
padding: 4px 10px;
|
|
25
|
-
border-radius: 50px;
|
|
26
|
-
margin-right: 15px;
|
|
27
|
-
`;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import { useEvent, useLanguage, useUtils, useSession, useApi } from 'ordering-components/native'
|
|
3
|
-
import { View, Modal, StyleSheet, TouchableOpacity, Dimensions } from 'react-native'
|
|
4
|
-
import { OText, OIcon } from '../shared'
|
|
5
|
-
import { useTheme } from 'styled-components/native'
|
|
6
|
-
import Icon from 'react-native-vector-icons/Feather'
|
|
7
|
-
import { NotificationContainer } from './styles'
|
|
8
|
-
import Sound from 'react-native-sound'
|
|
9
|
-
import moment from 'moment'
|
|
10
|
-
import { useLocation } from '../../hooks/useLocation'
|
|
11
|
-
Sound.setCategory('Playback')
|
|
12
|
-
|
|
13
|
-
const windowWidth = Dimensions.get('screen').width
|
|
14
|
-
|
|
15
|
-
export const NewOrderNotification = (props: any) => {
|
|
16
|
-
const [events] = useEvent()
|
|
17
|
-
const theme = useTheme()
|
|
18
|
-
const [, t] = useLanguage()
|
|
19
|
-
const [{ user, token }] = useSession()
|
|
20
|
-
const [ordering] = useApi()
|
|
21
|
-
const [{ getTimeAgo }] = useUtils()
|
|
22
|
-
const { getCurrentLocation } = useLocation();
|
|
23
|
-
const [modalOpen, setModalOpen] = useState(false)
|
|
24
|
-
const [newOrderId, setNewOrderId] = useState(null)
|
|
25
|
-
const [soundTimeout, setSoundTimeout] = useState<any>(null)
|
|
26
|
-
|
|
27
|
-
const notificationSound = new Sound(theme.sounds.notification, error => {
|
|
28
|
-
if (error) {
|
|
29
|
-
console.log('failed to load the sound', error);
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
console.log('loaded successfully');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const handlePlayNotificationSound = () => {
|
|
37
|
-
let times = 0
|
|
38
|
-
const _timeout = setInterval(function () {
|
|
39
|
-
notificationSound.play(success => {
|
|
40
|
-
if (success) {
|
|
41
|
-
console.log('successfully finished playing');
|
|
42
|
-
times = times + 1
|
|
43
|
-
} else {
|
|
44
|
-
console.log('playback failed due to audio decoding errors');
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
setSoundTimeout(_timeout)
|
|
48
|
-
if (times === 3) {
|
|
49
|
-
clearInterval(_timeout)
|
|
50
|
-
clearInterval(soundTimeout)
|
|
51
|
-
}
|
|
52
|
-
}, 2500)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const handleCloseModal = () => {
|
|
56
|
-
clearInterval(soundTimeout)
|
|
57
|
-
setModalOpen(false)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const handleNotification = useCallback((order: any) => {
|
|
61
|
-
clearInterval(soundTimeout)
|
|
62
|
-
handlePlayNotificationSound()
|
|
63
|
-
setNewOrderId(order.id)
|
|
64
|
-
setModalOpen(true)
|
|
65
|
-
}, [newOrderId, notificationSound, soundTimeout])
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
events.on('order_added', handleNotification)
|
|
69
|
-
return () => {
|
|
70
|
-
events.off('order_added', handleNotification)
|
|
71
|
-
}
|
|
72
|
-
}, [handleNotification])
|
|
73
|
-
|
|
74
|
-
const handleUpdateOrder = useCallback(async (order: any) => {
|
|
75
|
-
if (order?.driver) {
|
|
76
|
-
const location = await getCurrentLocation()
|
|
77
|
-
await fetch(`${ordering.root}/users/${user.id}/locations`, {
|
|
78
|
-
method: 'POST',
|
|
79
|
-
body: JSON.stringify({
|
|
80
|
-
location: JSON.stringify({location: `{lat: ${location.latitude}, lng: ${location.longitude}}`})
|
|
81
|
-
}),
|
|
82
|
-
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` }
|
|
83
|
-
})
|
|
84
|
-
const assignedTimeDiff = moment.utc(order?.driver?.last_order_assigned_at).local().fromNow()
|
|
85
|
-
if (assignedTimeDiff === 'a few seconds ago') {
|
|
86
|
-
clearInterval(soundTimeout)
|
|
87
|
-
handlePlayNotificationSound()
|
|
88
|
-
setNewOrderId(order.id)
|
|
89
|
-
setModalOpen(true)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, [newOrderId, notificationSound, soundTimeout])
|
|
93
|
-
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (user?.level !== 4) return
|
|
96
|
-
events.on('order_updated', handleUpdateOrder)
|
|
97
|
-
return () => {
|
|
98
|
-
events.off('order_updated', handleUpdateOrder)
|
|
99
|
-
}
|
|
100
|
-
}, [handleUpdateOrder, user])
|
|
101
|
-
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
notificationSound.setVolume(1);
|
|
104
|
-
return () => {
|
|
105
|
-
notificationSound.release();
|
|
106
|
-
}
|
|
107
|
-
}, [])
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<>
|
|
111
|
-
<Modal
|
|
112
|
-
animationType='slide'
|
|
113
|
-
transparent={true}
|
|
114
|
-
visible={modalOpen}
|
|
115
|
-
>
|
|
116
|
-
<NotificationContainer>
|
|
117
|
-
<View style={styles.modalView}>
|
|
118
|
-
<TouchableOpacity
|
|
119
|
-
style={styles.wrapperIcon}
|
|
120
|
-
onPress={() => handleCloseModal()}
|
|
121
|
-
>
|
|
122
|
-
<Icon
|
|
123
|
-
name="x"
|
|
124
|
-
size={30}
|
|
125
|
-
/>
|
|
126
|
-
</TouchableOpacity>
|
|
127
|
-
<OText
|
|
128
|
-
size={18}
|
|
129
|
-
color={theme.colors.textGray}
|
|
130
|
-
weight={600}
|
|
131
|
-
>
|
|
132
|
-
{t('NEW_ORDRES_RECEIVED', 'New orders have been received!')}
|
|
133
|
-
</OText>
|
|
134
|
-
<OIcon
|
|
135
|
-
src={theme.images.general.newOrder}
|
|
136
|
-
width={250}
|
|
137
|
-
height={200}
|
|
138
|
-
/>
|
|
139
|
-
<OText
|
|
140
|
-
color={theme.colors.textGray}
|
|
141
|
-
mBottom={15}
|
|
142
|
-
>
|
|
143
|
-
{t('ORDER_N_ORDERED', 'Order #_order_id_ has been ordered.').replace('_order_id_', newOrderId)}
|
|
144
|
-
</OText>
|
|
145
|
-
</View>
|
|
146
|
-
</NotificationContainer>
|
|
147
|
-
</Modal>
|
|
148
|
-
</>
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const styles = StyleSheet.create({
|
|
153
|
-
modalView: {
|
|
154
|
-
backgroundColor: '#FFF',
|
|
155
|
-
alignItems: 'center',
|
|
156
|
-
borderRadius: 8,
|
|
157
|
-
paddingHorizontal: 20,
|
|
158
|
-
paddingTop: 65,
|
|
159
|
-
paddingBottom: 20,
|
|
160
|
-
maxWidth: windowWidth - 60,
|
|
161
|
-
},
|
|
162
|
-
wrapperIcon: {
|
|
163
|
-
position: 'absolute',
|
|
164
|
-
right: 20,
|
|
165
|
-
top: 20
|
|
166
|
-
}
|
|
167
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { OButton, OIcon, OText } from '../shared';
|
|
4
|
-
import { NotFoundSourceParams } from '../../types';
|
|
5
|
-
import { useTheme } from 'styled-components/native';
|
|
6
|
-
import { NotFound, NotFoundImage } from './styles';
|
|
7
|
-
|
|
8
|
-
export const NotFoundSource = (props: NotFoundSourceParams) => {
|
|
9
|
-
const { image, content, btnTitle, conditioned, onClickButton } = props;
|
|
10
|
-
const theme = useTheme();
|
|
11
|
-
|
|
12
|
-
const errorImage = image || theme.images.general.notFound;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<NotFound>
|
|
16
|
-
{errorImage && (
|
|
17
|
-
<NotFoundImage>
|
|
18
|
-
<OIcon src={errorImage} width={260} height={220} />
|
|
19
|
-
</NotFoundImage>
|
|
20
|
-
)}
|
|
21
|
-
{content && conditioned && !errorImage && (
|
|
22
|
-
<OText
|
|
23
|
-
color={theme.colors.textSecondary}
|
|
24
|
-
size={18}
|
|
25
|
-
style={{ textAlign: 'center' }}>
|
|
26
|
-
{content}
|
|
27
|
-
</OText>
|
|
28
|
-
)}
|
|
29
|
-
{content && !conditioned && (
|
|
30
|
-
<OText
|
|
31
|
-
color={theme.colors.textSecondary}
|
|
32
|
-
size={18}
|
|
33
|
-
style={{ textAlign: 'center' }}>
|
|
34
|
-
{content}
|
|
35
|
-
</OText>
|
|
36
|
-
)}
|
|
37
|
-
{!onClickButton && props.children && props.children}
|
|
38
|
-
{onClickButton && (
|
|
39
|
-
<View style={{ marginTop: 10, width: '100%' }}>
|
|
40
|
-
<OButton
|
|
41
|
-
style={{ width: '100%', height: 50, borderRadius: 7.6 }}
|
|
42
|
-
bgColor={theme.colors.primary}
|
|
43
|
-
borderColor={theme.colors.primary}
|
|
44
|
-
onClick={() => onClickButton()}
|
|
45
|
-
text={btnTitle}
|
|
46
|
-
textStyle={{ color: theme.colors.white }}
|
|
47
|
-
/>
|
|
48
|
-
</View>
|
|
49
|
-
)}
|
|
50
|
-
</NotFound>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const NotFound = styled.View`
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
align-items: center;
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: auto;
|
|
10
|
-
margin: 30px auto;
|
|
11
|
-
padding: 10px;
|
|
12
|
-
background-color: #f7f7f7;
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
export const NotFoundImage = styled.View`
|
|
16
|
-
max-width: 300px;
|
|
17
|
-
`;
|