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.
Files changed (91) hide show
  1. package/package.json +1 -1
  2. package/src/config.json +2 -2
  3. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
  4. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
  5. package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
  6. package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
  7. package/themes/business/src/components 2/Chat/index.tsx +0 -1152
  8. package/themes/business/src/components 2/Chat/styles.tsx +0 -12
  9. package/themes/business/src/components 2/Contacts/index.tsx +0 -299
  10. package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
  11. package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
  12. package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
  13. package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
  14. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
  15. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
  16. package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
  17. package/themes/business/src/components 2/Home/index.tsx +0 -111
  18. package/themes/business/src/components 2/Home/styles.tsx +0 -27
  19. package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
  20. package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
  21. package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
  22. package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
  23. package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
  24. package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
  25. package/themes/business/src/components 2/MapView/index.tsx +0 -317
  26. package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
  27. package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
  28. package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
  29. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
  30. package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
  31. package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
  32. package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
  33. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
  34. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
  35. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
  36. package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
  37. package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
  38. package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
  39. package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
  40. package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
  41. package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
  42. package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
  43. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
  44. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
  45. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
  46. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
  47. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
  48. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
  49. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
  50. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
  51. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
  52. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
  53. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
  54. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
  55. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
  56. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
  57. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
  58. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
  59. package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
  60. package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
  61. package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
  62. package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
  63. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
  64. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
  65. package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
  66. package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
  67. package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
  68. package/themes/business/src/components 2/StoresList/index.tsx +0 -208
  69. package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
  70. package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
  71. package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
  72. package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
  73. package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
  74. package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
  75. package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
  76. package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
  77. package/themes/business/src/components 2/shared/OButton.tsx +0 -149
  78. package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
  79. package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
  80. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
  81. package/themes/business/src/components 2/shared/OFab.tsx +0 -54
  82. package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
  83. package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
  84. package/themes/business/src/components 2/shared/OInput.tsx +0 -144
  85. package/themes/business/src/components 2/shared/OLink.tsx +0 -76
  86. package/themes/business/src/components 2/shared/OModal.tsx +0 -275
  87. package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
  88. package/themes/business/src/components 2/shared/OText.tsx +0 -55
  89. package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
  90. package/themes/business/src/components 2/shared/OToast.tsx +0 -92
  91. 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,8 +0,0 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const NotificationContainer = styled.SafeAreaView`
4
- flex: 1;
5
- justify-content: center;
6
- align-items: center;
7
- background-color: rgba(0, 0, 0, 0.4);
8
- `
@@ -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
- `;