ordering-ui-react-native 0.12.14 → 0.12.18

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 (105) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressList/index.tsx +3 -1
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
  4. package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
  5. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
  6. package/themes/business/src/components/OrdersOption/index.tsx +19 -15
  7. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
  8. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
  9. package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
  10. package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
  11. package/themes/business/src/components 2/Chat/index.tsx +1152 -0
  12. package/themes/business/src/components 2/Chat/styles.tsx +12 -0
  13. package/themes/business/src/components 2/Contacts/index.tsx +299 -0
  14. package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
  15. package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
  16. package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
  17. package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
  18. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
  19. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
  20. package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
  21. package/themes/business/src/components 2/Home/index.tsx +111 -0
  22. package/themes/business/src/components 2/Home/styles.tsx +27 -0
  23. package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
  24. package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
  25. package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
  26. package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
  27. package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
  28. package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
  29. package/themes/business/src/components 2/MapView/index.tsx +317 -0
  30. package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
  31. package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
  32. package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
  33. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
  34. package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
  35. package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
  36. package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
  37. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
  38. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
  39. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
  40. package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
  41. package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
  42. package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
  43. package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
  44. package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
  45. package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
  46. package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
  47. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
  48. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
  49. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
  50. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
  51. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
  52. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
  53. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
  54. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
  55. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
  56. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
  57. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
  58. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
  59. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
  60. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
  61. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
  62. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
  63. package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
  64. package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
  65. package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
  66. package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
  67. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
  68. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
  69. package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
  70. package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
  71. package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
  72. package/themes/business/src/components 2/StoresList/index.tsx +208 -0
  73. package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
  74. package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
  75. package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
  76. package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
  77. package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
  78. package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
  79. package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
  80. package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
  81. package/themes/business/src/components 2/shared/OButton.tsx +149 -0
  82. package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
  83. package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
  84. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
  85. package/themes/business/src/components 2/shared/OFab.tsx +54 -0
  86. package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
  87. package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
  88. package/themes/business/src/components 2/shared/OInput.tsx +144 -0
  89. package/themes/business/src/components 2/shared/OLink.tsx +76 -0
  90. package/themes/business/src/components 2/shared/OModal.tsx +275 -0
  91. package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
  92. package/themes/business/src/components 2/shared/OText.tsx +55 -0
  93. package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
  94. package/themes/business/src/components 2/shared/OToast.tsx +92 -0
  95. package/themes/business/src/components 2/shared/index.tsx +27 -0
  96. package/themes/business/src/types/index.tsx +4 -1
  97. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
  98. package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
  99. package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
  100. package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
  101. package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
  102. package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
  103. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  104. package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
  105. package/themes/original/src/components/OrderProgress/index.tsx +32 -18
@@ -0,0 +1,12 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const Wrapper = styled.View`
4
+ flex: 1;
5
+ background-color: ${(props: any) => props.theme.colors.white};
6
+ `;
7
+
8
+ export const Header = styled.ScrollView``;
9
+
10
+ export const TitleHeader = styled.View`
11
+ margin-left: 11px;
12
+ `;
@@ -0,0 +1,299 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ StyleSheet,
4
+ TouchableOpacity,
5
+ ScrollView,
6
+ View,
7
+ Dimensions,
8
+ } from 'react-native';
9
+ import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
10
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
11
+ import { useTheme } from 'styled-components/native';
12
+ import {
13
+ Contacts as ContactsController,
14
+ useLanguage,
15
+ useUtils,
16
+ } from 'ordering-components/native';
17
+ import { Card, Logo, Information, Header, Badge, Stars } from './styles';
18
+ import { NotFoundSource } from '../NotFoundSource';
19
+ import { OIcon, OText, OButton } from '../shared';
20
+ import { ContactParams } from '../../types';
21
+
22
+ const ContactsUI = (props: ContactParams) => {
23
+ const {
24
+ contacts: { data, loading, error },
25
+ activeTag,
26
+ pagination,
27
+ getBusinesses,
28
+ getCustomers,
29
+ getDrivers,
30
+ loadMore,
31
+ onNavigationRedirect,
32
+ } = props;
33
+
34
+ const [, t] = useLanguage();
35
+ const theme = useTheme();
36
+ const [{ parseDate, optimizeImage }] = useUtils();
37
+
38
+ const [orientation, setOrientation] = useState(
39
+ Dimensions.get('window').width < Dimensions.get('window').height
40
+ ? 'Portrait'
41
+ : 'Landscape',
42
+ );
43
+
44
+ const handlePressOrder = (order: any) => {
45
+ const uuid = order?.id;
46
+ onNavigationRedirect &&
47
+ onNavigationRedirect('OrderMessage', { orderId: uuid });
48
+ };
49
+
50
+ useEffect(() => {
51
+ if (!loading) {
52
+ switch (activeTag) {
53
+ case 2:
54
+ getBusinesses && getBusinesses();
55
+ break;
56
+ case 3:
57
+ getCustomers && getCustomers();
58
+ break;
59
+ case 4:
60
+ getDrivers && getDrivers();
61
+ break;
62
+ }
63
+ }
64
+ }, [activeTag]);
65
+
66
+ Dimensions.addEventListener('change', ({ window: { width, height } }) => {
67
+ if (width < height) {
68
+ setOrientation('Portrait');
69
+ } else {
70
+ setOrientation('Landscape');
71
+ }
72
+ });
73
+
74
+ const styles = StyleSheet.create({
75
+ btnCard: {
76
+ flex: 1,
77
+ minHeight: 64,
78
+ marginBottom: 30,
79
+ },
80
+ icon: {
81
+ borderRadius: 7.6,
82
+ width: 73,
83
+ height: 73,
84
+ },
85
+ name: {
86
+ fontFamily: 'Poppins',
87
+ fontStyle: 'normal',
88
+ fontWeight: '600',
89
+ fontSize: 18,
90
+ color: theme.colors.textGray,
91
+ },
92
+ badge: {
93
+ fontFamily: 'Poppins',
94
+ fontStyle: 'normal',
95
+ fontWeight: 'normal',
96
+ fontSize: 14,
97
+ color: theme.colors.primary,
98
+ },
99
+ star: {
100
+ fontFamily: 'Poppins',
101
+ fontStyle: 'normal',
102
+ fontWeight: 'normal',
103
+ fontSize: 15,
104
+ color: theme.colors.unselectText,
105
+ },
106
+ order: {
107
+ fontFamily: 'Poppins',
108
+ fontStyle: 'normal',
109
+ fontWeight: 'normal',
110
+ color: theme.colors.orderTypeColor,
111
+ },
112
+ btn: {
113
+ borderRadius: 7.6,
114
+ height: 44,
115
+ marginBottom: 40,
116
+ marginTop: 5,
117
+ },
118
+ btnText: {
119
+ color: theme.colors.white,
120
+ fontFamily: 'Poppins',
121
+ fontStyle: 'normal',
122
+ fontWeight: 'normal',
123
+ fontSize: 18,
124
+ },
125
+ });
126
+
127
+ return (
128
+ <>
129
+ <ScrollView style={{ height: '80%' }}>
130
+ {data?.length > 0 &&
131
+ data?.map((contact: any) => (
132
+ <TouchableOpacity
133
+ key={contact?.id}
134
+ // onPress={() => handlePressOrder(contact)}
135
+ onPress={() => {}}
136
+ style={styles.btnCard}
137
+ activeOpacity={1}>
138
+ <Card key={contact?.id}>
139
+ <Logo>
140
+ <OIcon
141
+ url={optimizeImage(
142
+ contact?.logo || contact?.photo,
143
+ 'h_300,c_limit',
144
+ )}
145
+ style={styles.icon}
146
+ />
147
+ </Logo>
148
+
149
+ <Information>
150
+ <Header>
151
+ <OText numberOfLines={1} style={styles.name}>
152
+ {contact?.name + ' ' + (contact?.lastname ?? '')}
153
+ </OText>
154
+
155
+ {contact?.unread_count > 0 && (
156
+ <Badge>
157
+ <OText size={14} style={styles.badge}>
158
+ {contact?.unread_count}
159
+ </OText>
160
+ </Badge>
161
+ )}
162
+ </Header>
163
+
164
+ <Stars>
165
+ {[
166
+ ...Array(
167
+ Number.isInteger(contact?.qualification)
168
+ ? contact?.qualification ?? 3
169
+ : Math.floor(contact?.qualification) || 3,
170
+ ),
171
+ ].map((item, index) => (
172
+ <MaterialIcon
173
+ key={index}
174
+ name="star"
175
+ size={20}
176
+ color={theme.colors.arrowColor}
177
+ />
178
+ ))}
179
+
180
+ {[
181
+ ...Array(
182
+ (Number.isInteger(contact?.qualification)
183
+ ? contact?.qualification ?? 3
184
+ : Math.ceil(contact?.qualification) || 3) -
185
+ (Number.isInteger(contact?.qualification)
186
+ ? contact?.qualification ?? 3
187
+ : Math.floor(contact?.qualification) || 3),
188
+ ),
189
+ ].map((item, index) => (
190
+ <MaterialIcon
191
+ key={index}
192
+ name="star-half"
193
+ size={20}
194
+ color={theme.colors.arrowColor}
195
+ />
196
+ ))}
197
+
198
+ {[
199
+ ...Array(
200
+ 5 -
201
+ (Number.isInteger(contact?.qualification)
202
+ ? contact?.qualification ?? 3
203
+ : Math.ceil(contact?.qualification) || 3),
204
+ ),
205
+ ].map((item, index) => (
206
+ <MaterialIcon
207
+ key={index}
208
+ name="star-border"
209
+ size={20}
210
+ color={theme.colors.arrowColor}
211
+ />
212
+ ))}
213
+ </Stars>
214
+
215
+ <OText style={styles.order} numberOfLines={1} size={16}>
216
+ {contact?.level === 4
217
+ ? contact?.assigned_orders_count
218
+ : contact?.level === 3
219
+ ? contact?.assigned_orders_count || ''
220
+ : ''}{' '}
221
+ {t('ORDERS', 'Orders')}
222
+ </OText>
223
+ </Information>
224
+ </Card>
225
+ </TouchableOpacity>
226
+ ))}
227
+ </ScrollView>
228
+
229
+ {!loading && data?.length === 0 && (
230
+ <NotFoundSource
231
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
232
+ image={theme.images.general.notFound}
233
+ conditioned={false}
234
+ />
235
+ )}
236
+
237
+ {loading && (
238
+ <>
239
+ <View>
240
+ {[...Array(5)].map((item, i) => (
241
+ <Placeholder key={i} Animation={Fade}>
242
+ <View
243
+ style={{
244
+ width: '100%',
245
+ flexDirection: 'row',
246
+ marginBottom: 10,
247
+ }}>
248
+ <PlaceholderLine
249
+ width={orientation === 'Portrait' ? 22 : 11}
250
+ height={74}
251
+ style={{
252
+ marginRight: 20,
253
+ marginBottom: 20,
254
+ borderRadius: 7.6,
255
+ }}
256
+ />
257
+ <Placeholder>
258
+ <PlaceholderLine width={30} style={{ marginTop: 5 }} />
259
+ <PlaceholderLine width={50} />
260
+ <PlaceholderLine width={20} />
261
+ </Placeholder>
262
+ </View>
263
+ </Placeholder>
264
+ ))}
265
+ </View>
266
+ </>
267
+ )}
268
+
269
+ {!loading && pagination?.currentPage < pagination?.totalPages && (
270
+ <OButton
271
+ onClick={() => loadMore && loadMore(activeTag)}
272
+ text={t('LOAD_MORE', 'Load more')}
273
+ imgRightSrc={null}
274
+ textStyle={styles.btnText}
275
+ style={styles.btn}
276
+ bgColor={theme.colors.primary}
277
+ borderColor={theme.colors.primary}
278
+ />
279
+ )}
280
+ </>
281
+ );
282
+ };
283
+
284
+ export const Contacts = (props: ContactParams) => {
285
+ const contactProps = {
286
+ ...props,
287
+ firstFetch: 'businesses',
288
+ paginationSettings: {
289
+ page: 1,
290
+ pageSize: 6,
291
+ controlType: 'infinity',
292
+ },
293
+ orderBy: 'name',
294
+ orderDirection: 'asc',
295
+ UIComponent: ContactsUI,
296
+ };
297
+
298
+ return <ContactsController {...contactProps} />;
299
+ };
@@ -0,0 +1,42 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const Card = styled.View`
4
+ flex: 1;
5
+ flex-direction: row;
6
+ `;
7
+
8
+ export const Logo = styled.View`
9
+ align-items: center;
10
+ justify-content: center;
11
+ shadow-color: ${(props: any) => props.theme.colors.shadow};
12
+ elevation: 1;
13
+ width: 75px;
14
+ height: 75px;
15
+ border-radius: 7.6px;
16
+ `;
17
+
18
+ export const Information = styled.View`
19
+ justify-content: space-between;
20
+ align-items: flex-start;
21
+ margin-horizontal: 10px;
22
+ flex: 1;
23
+ min-height: 64px;
24
+ `;
25
+
26
+ export const Header = styled.View`
27
+ flex-direction: row;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ width: 100%;
31
+ `;
32
+
33
+ export const Badge = styled.View`
34
+ background-color: #e9f2fe;
35
+ border-radius: 4px;
36
+ padding: 1px 4px;
37
+ `;
38
+
39
+ export const Stars = styled.View`
40
+ display: flex;
41
+ flex-direction: row;
42
+ `;