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,301 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, Animated } from 'react-native';
3
+ import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';
4
+ import { useUtils, useLanguage } from 'ordering-components/native';
5
+ import { useTheme } from 'styled-components/native';
6
+ import {
7
+ Accordion,
8
+ AccordionSection,
9
+ // ProductInfo,
10
+ // ProductQuantity,
11
+ ContentInfo,
12
+ // ProductImage,
13
+ AccordionContent,
14
+ ProductOptionsList,
15
+ ProductOption,
16
+ ProductSubOption,
17
+ ProductComment,
18
+ } from './styles';
19
+ import { OText, OAlert } from '../shared';
20
+ import { ProductItemAccordionParams } from '../../types';
21
+
22
+ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
23
+ const {
24
+ isClickableEvent,
25
+ isCartPending,
26
+ isCartProduct,
27
+ product,
28
+ getProductMax,
29
+ onDeleteProduct,
30
+ onEditProduct,
31
+ } = props;
32
+
33
+ const [, t] = useLanguage();
34
+ const theme = useTheme();
35
+ const [{ parsePrice }] = useUtils();
36
+
37
+ const [isActive, setActiveState] = useState(false);
38
+
39
+ const productInfo = () => {
40
+ if (isCartProduct) {
41
+ const ingredients = JSON.parse(
42
+ JSON.stringify(Object.values(product.ingredients ?? {})),
43
+ );
44
+ let options = JSON.parse(
45
+ JSON.stringify(Object.values(product.options ?? {})),
46
+ );
47
+
48
+ options = options.map((option: any) => {
49
+ option.suboptions = Object.values(option.suboptions ?? {});
50
+ return option;
51
+ });
52
+ console.log(productInfo, ingredients, options)
53
+ return {
54
+ ...productInfo,
55
+ ingredients,
56
+ options,
57
+ };
58
+ }
59
+
60
+ return product;
61
+ };
62
+
63
+ const parseOptions = typeof productInfo().options === 'string' ? JSON.parse(productInfo().options) : productInfo().options
64
+
65
+ const getProductPrice = (product: any) => {
66
+ let subOptionPrice = 0;
67
+ if (product?.options?.length > 0 && product?.options?.suboptions?.length > 0) {
68
+ for (const option of product?.options) {
69
+ for (const suboption of option?.suboptions) {
70
+ subOptionPrice += suboption.quantity * suboption.price;
71
+ }
72
+ }
73
+ }
74
+
75
+ const price = product.quantity * (product.price + subOptionPrice);
76
+ return parseFloat(price.toFixed(2));
77
+ };
78
+
79
+ const getFormattedSubOptionName = ({ quantity, name, position, price }: any) => {
80
+ if (name !== 'No') {
81
+ const pos = position ? `(${position})` : '';
82
+ return `${quantity} x ${name} ${pos} +${price}`
83
+ } else {
84
+ return 'No';
85
+ }
86
+ };
87
+
88
+ /*useEffect(() => {
89
+ toggleAccordion()
90
+ }, [isActive])*/
91
+
92
+ const productOptions =
93
+ getProductMax &&
94
+ [...Array(getProductMax(product) + 1)].map((_: any, opt: number) => {
95
+ return {
96
+ label: opt === 0 ? t('REMOVE', 'Remove') : opt.toString(),
97
+ value: opt.toString(),
98
+ };
99
+ });
100
+
101
+ useEffect(() => {
102
+ if (
103
+ productInfo?.()?.ingredients?.length > 0 ||
104
+ productInfo?.()?.options?.length > 0 ||
105
+ product.comment !== ''
106
+ ) {
107
+ setActiveState(true);
108
+ }
109
+ }, []);
110
+
111
+ return (
112
+ <AccordionSection>
113
+ <Accordion
114
+ isValid={product?.valid ?? true}
115
+ onPress={() =>
116
+ (!product?.valid_menu && isCartProduct) || isClickableEvent ? {} : setActiveState(!isActive)
117
+ }
118
+ activeOpacity={1}>
119
+ <View
120
+ style={{
121
+ flexDirection: 'row',
122
+ alignItems: 'center',
123
+ }}>
124
+ <ContentInfo>
125
+ <View style={{ flexDirection: 'row' }}>
126
+ <OText color={theme.colors.quantityProduct} space>
127
+ {product?.quantity}
128
+ </OText>
129
+
130
+ <View style={{ width: 200 }}>
131
+ <OText
132
+ numberOfLines={2}
133
+ ellipsizeMode="tail"
134
+ size={12}
135
+ color={theme.colors.textGray}
136
+ style={{ marginLeft: 5 }}>
137
+ {product?.name}
138
+ </OText>
139
+ </View>
140
+ </View>
141
+
142
+ <View
143
+ style={{
144
+ display: 'flex',
145
+ flexDirection: 'column',
146
+ flex: 1,
147
+ alignItems: 'flex-end',
148
+ }}>
149
+ <View style={{ flexDirection: 'row' }}>
150
+ <OText size={12} color={theme.colors.textGray}>
151
+ {parsePrice(getProductPrice(product))}
152
+ </OText>
153
+
154
+ {(
155
+ productInfo?.()?.ingredients?.length > 0 ||
156
+ productInfo?.()?.options?.length > 0 ||
157
+ product.comment
158
+ ) && !isClickableEvent && (
159
+ <MaterialCommunityIcon name="chevron-down" size={12} />
160
+ )}
161
+ </View>
162
+
163
+ <View
164
+ style={{
165
+ display: 'flex',
166
+ flexDirection: 'row',
167
+ justifyContent: 'flex-start',
168
+ }}>
169
+ {onEditProduct &&
170
+ isCartProduct &&
171
+ !isCartPending &&
172
+ product?.valid_menu && (
173
+ <MaterialCommunityIcon
174
+ name="pencil-outline"
175
+ size={26}
176
+ color={theme.colors.green}
177
+ onPress={() => onEditProduct(product)}
178
+ />
179
+ )}
180
+
181
+ {onDeleteProduct && isCartProduct && !isCartPending && (
182
+ <OAlert
183
+ title={t('DELETE_PRODUCT', 'Delete Product')}
184
+ message={t(
185
+ 'QUESTION_DELETE_PRODUCT',
186
+ 'Are you sure that you want to delete the product?',
187
+ )}
188
+ onAccept={() => onDeleteProduct(product)}>
189
+ <MaterialCommunityIcon
190
+ name="trash-can-outline"
191
+ size={26}
192
+ color={theme.ecolors.red}
193
+ />
194
+ </OAlert>
195
+ )}
196
+ </View>
197
+ </View>
198
+ </ContentInfo>
199
+ </View>
200
+
201
+ {((isCartProduct &&
202
+ !isCartPending &&
203
+ product?.valid_menu &&
204
+ !product?.valid_quantity) ||
205
+ (!product?.valid_menu && isCartProduct && !isCartPending)) && (
206
+ <OText
207
+ size={24}
208
+ color={theme.colors.red}
209
+ style={{ textAlign: 'center', marginTop: 10 }}>
210
+ {t('NOT_AVAILABLE', 'Not available')}
211
+ </OText>
212
+ )}
213
+ </Accordion>
214
+
215
+ <View style={{ display: isActive ? 'flex' : 'none' }}>
216
+ <Animated.View>
217
+ <AccordionContent>
218
+ {productInfo?.()?.ingredients?.length > 0 &&
219
+ productInfo?.()?.ingredients?.some(
220
+ (ingredient: any) => !ingredient.selected,
221
+ ) && (
222
+ <ProductOptionsList>
223
+ <OText
224
+ size={12}
225
+ weight="500"
226
+ color={theme.colors.unselectText}>
227
+ {t('INGREDIENTS', 'Ingredients')}:
228
+ </OText>
229
+
230
+ {productInfo?.()?.ingredients?.map(
231
+ (ingredient: any) =>
232
+ !ingredient.selected && (
233
+ <OText
234
+ size={12}
235
+ key={ingredient.id}
236
+ style={{ marginLeft: 10 }}
237
+ color={theme.colors.unselectText}>
238
+ {t('NO', 'No')} {ingredient.name}
239
+ </OText>
240
+ ),
241
+ )}
242
+ </ProductOptionsList>
243
+ )}
244
+
245
+ {parseOptions?.length > 0 && (
246
+ <ProductOptionsList>
247
+ {parseOptions?.map((option: any, i: number) => (
248
+ <ProductOption key={option.id + i}>
249
+ <OText
250
+ size={12}
251
+ weight="500"
252
+ color={theme.colors.unselectText}>
253
+ {t(option?.name.toUpperCase(), option?.name)}
254
+ </OText>
255
+
256
+ {option.suboptions.map((suboption: any) => (
257
+ <ProductSubOption key={suboption.id}>
258
+ <OText
259
+ size={12}
260
+ mLeft={10}
261
+ color={theme.colors.unselectText}>
262
+ {getFormattedSubOptionName({
263
+ quantity: suboption.quantity,
264
+ name: suboption.name,
265
+ position:
266
+ suboption.position !== 'whole'
267
+ ? t(
268
+ suboption.position.toUpperCase(),
269
+ suboption.position,
270
+ )
271
+ : '',
272
+ price: parsePrice(suboption.price),
273
+ })}
274
+ </OText>
275
+ </ProductSubOption>
276
+ ))}
277
+ </ProductOption>
278
+ ))}
279
+ </ProductOptionsList>
280
+ )}
281
+
282
+ {product.comment && (
283
+ <ProductComment>
284
+ <OText
285
+ size={12}
286
+ weight={600}
287
+ space
288
+ color={theme.colors.unselectText}>
289
+ {t('COMMENT', 'Comment')}
290
+ </OText>
291
+ <OText size={12} mLeft={10} color={theme.colors.unselectText}>
292
+ {product.comment}
293
+ </OText>
294
+ </ProductComment>
295
+ )}
296
+ </AccordionContent>
297
+ </Animated.View>
298
+ </View>
299
+ </AccordionSection>
300
+ );
301
+ };
@@ -0,0 +1,61 @@
1
+ import styled, { css } from 'styled-components/native';
2
+
3
+ export const AccordionSection = styled.View`
4
+ background: #fff;
5
+ padding-vertical: 10px;
6
+ border-bottom-width: 1px;
7
+ border-bottom-color: #d9d9d9;
8
+ `;
9
+
10
+ export const Accordion = styled.TouchableOpacity`
11
+ flex-direction: column;
12
+ justify-content: space-between;
13
+ align-items: center;
14
+
15
+ ${(props: any) =>
16
+ !props.isValid &&
17
+ css`
18
+ background-color: rgba(0, 0, 0, 0.1);
19
+ `}
20
+ `;
21
+
22
+ export const ProductInfo = styled.View`
23
+ width: 15%;
24
+ `;
25
+
26
+ export const ProductQuantity = styled.View``;
27
+
28
+ export const ContentInfo = styled.View`
29
+ flex-direction: row;
30
+ justify-content: space-between;
31
+ align-items: flex-start;
32
+ overflow: hidden;
33
+ width: 100%;
34
+ `;
35
+
36
+ export const ProductImage = styled.View`
37
+ margin-right: 5px;
38
+ `;
39
+
40
+ export const AccordionContent = styled.View``;
41
+
42
+ export const ProductOptionsList = styled.View`
43
+ margin-top: 10px;
44
+ margin-left: 18px;
45
+ `;
46
+
47
+ export const ProductOption = styled.View`
48
+ flex-direction: column;
49
+ flex-wrap: wrap;
50
+ `;
51
+
52
+ export const ProductSubOption = styled.View`
53
+ flex-direction: row;
54
+ margin-left: 3px;
55
+ `;
56
+
57
+ export const ProductComment = styled.View`
58
+ flex-direction: column;
59
+ flex-wrap: wrap;
60
+ margin-left: 18px;
61
+ `;
@@ -0,0 +1,112 @@
1
+ import React, { useRef } from 'react';
2
+ import { StyleSheet, View, TouchableOpacity } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/Feather';
4
+ import { useLanguage } from 'ordering-components/native';
5
+ import { useTheme } from 'styled-components/native';
6
+ import { OInput, OButton, OIconButton } from '../shared';
7
+
8
+ export const SearchBar = (props: any) => {
9
+ const {
10
+ searchValue,
11
+ placeholder,
12
+ onSearch,
13
+ onCancel,
14
+ lazyLoad,
15
+ isCancelButtonShow,
16
+ isCancelXButtonShow,
17
+ noBorderShow,
18
+ borderStyle,
19
+ } = props;
20
+
21
+ const [, t] = useLanguage();
22
+ const theme = useTheme();
23
+ const inputRef = useRef<any>();
24
+
25
+ const handleClear = () => {
26
+ onSearch('');
27
+ };
28
+
29
+ const handleActiveInput = () => {
30
+ inputRef.current.focus();
31
+ };
32
+
33
+ let timeout: null | any = null;
34
+ const onChangeSearch = (e: any) => {
35
+ if (!lazyLoad) {
36
+ onSearch(e);
37
+ } else {
38
+ clearTimeout(timeout);
39
+ timeout = setTimeout(function () {
40
+ onSearch(e);
41
+ }, 750);
42
+ }
43
+ };
44
+
45
+ const styles = StyleSheet.create({
46
+ container: {
47
+ width: 225,
48
+ flexDirection: 'row',
49
+ alignItems: 'center',
50
+ borderRadius: 7.6,
51
+ backgroundColor: theme.colors.inputDisabled,
52
+ },
53
+ borderStyle: {
54
+ borderColor: theme.colors.primary,
55
+ borderWidth: 1,
56
+ borderRadius: 10,
57
+ },
58
+ inputStyle: {
59
+ borderRadius: 7.6,
60
+ backgroundColor: theme.colors.transparent,
61
+ borderColor: theme.colors.transparent,
62
+ borderWidth: 0,
63
+ },
64
+ buttonStyle: {
65
+ maxHeight: 20,
66
+ },
67
+ });
68
+
69
+ return (
70
+ <View style={[styles.container]}>
71
+ <OInput
72
+ forwardRef={inputRef}
73
+ value={searchValue}
74
+ onChange={onChangeSearch}
75
+ style={styles.inputStyle}
76
+ placeholder={placeholder}
77
+ placeholderTextColor={theme.colors.arrowColor}
78
+ selectionColor={theme.colors.primary}
79
+ color={theme.colors.textGray}
80
+ returnKeyType="done"
81
+ blurOnSubmit
82
+ />
83
+
84
+ {isCancelButtonShow && (
85
+ <OButton
86
+ imgRightSrc=""
87
+ text={t('CANCEL', 'Cancel')}
88
+ bgColor={theme.colors.clear}
89
+ borderColor={theme.colors.lightGray}
90
+ style={styles.buttonStyle}
91
+ onClick={onCancel || handleClear}
92
+ />
93
+ )}
94
+
95
+ {isCancelXButtonShow && (
96
+ <TouchableOpacity onPress={onCancel || handleClear}>
97
+ <Icon name="x-circle" size={22} color={theme.colors.unselectText} />
98
+ </TouchableOpacity>
99
+ )}
100
+
101
+ <OIconButton
102
+ icon={theme.images.general.search}
103
+ borderColor={theme.colors.clear}
104
+ iconStyle={{ width: 25, height: 25 }}
105
+ style={{ maxWidth: 40 }}
106
+ onClick={() => {
107
+ handleActiveInput();
108
+ }}
109
+ />
110
+ </View>
111
+ );
112
+ };