ordering-ui-react-native 0.14.95 → 0.14.97-release
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 +6 -3
- package/src/DeliveryApp.tsx +32 -1
- package/src/components/BusinessTypeFilter/index.tsx +9 -2
- package/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Cart/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +0 -1
- package/src/components/Home/index.tsx +3 -5
- package/src/components/LanguageSelector/index.tsx +65 -97
- package/src/components/LanguageSelector/styles.tsx +4 -17
- package/src/components/Messages/index.tsx +38 -30
- package/src/components/MomentOption/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +26 -5
- package/src/components/PaymentOptions/index.tsx +7 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/ProductForm/index.tsx +1 -1
- package/src/components/ProductForm/styles.tsx +1 -0
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UserProfileForm/index.tsx +35 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/config.json +0 -2
- package/src/pages/Checkout.tsx +1 -1
- package/src/types/index.tsx +2 -9
- package/src/utils/index.tsx +2 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/Chat/index.tsx +32 -31
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +70 -116
- package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
- package/themes/business/src/components/PreviousOrders/index.tsx +80 -23
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
- package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
- package/themes/kiosk/src/components/Cart/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
- package/themes/original/index.tsx +28 -2
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +27 -1
- package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +100 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +36 -22
- package/themes/original/src/components/BusinessMenuList/index.tsx +14 -5
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
- package/themes/original/src/components/BusinessProductsList/index.tsx +52 -8
- package/themes/original/src/components/BusinessProductsListing/index.tsx +21 -15
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +2 -13
- package/themes/original/src/components/BusinessesListing/index.tsx +41 -58
- package/themes/original/src/components/Cart/index.tsx +41 -8
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +56 -32
- package/themes/original/src/components/Checkout/styles.tsx +7 -0
- package/themes/original/src/components/CouponControl/index.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +105 -90
- package/themes/original/src/components/LoginForm/index.tsx +83 -68
- package/themes/original/src/components/Messages/index.tsx +52 -45
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +127 -152
- package/themes/original/src/components/MomentOption/styles.tsx +42 -18
- package/themes/original/src/components/OrderDetails/index.tsx +103 -124
- package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +5 -6
- package/themes/original/src/components/OrderSummary/index.tsx +34 -1
- package/themes/original/src/components/OrdersOption/index.tsx +15 -46
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
- package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
- package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
- package/themes/original/src/components/ProductForm/index.tsx +153 -104
- package/themes/original/src/components/ProductForm/styles.tsx +5 -3
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +6 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SearchBar/index.tsx +4 -10
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/components/SingleProductCard/index.tsx +7 -22
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
- package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
- package/themes/original/src/components/UserProfile/index.tsx +16 -11
- package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/shared/HeaderTitle.tsx +20 -0
- package/themes/original/src/components/shared/OInput.tsx +1 -2
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/types/index.tsx +25 -28
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -163
- package/themes/original/src/components/BusinessListingSearch/index.tsx +0 -469
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -76
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
BusinessList as BusinessesListingController,
|
|
4
4
|
useLanguage,
|
|
5
|
-
|
|
5
|
+
useOrder
|
|
6
6
|
} from 'ordering-components/native';
|
|
7
7
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
8
8
|
import { View, ScrollView, Platform, Dimensions } from 'react-native';
|
|
@@ -18,116 +18,131 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
|
|
|
18
18
|
const {
|
|
19
19
|
businessesList,
|
|
20
20
|
onBusinessClick,
|
|
21
|
-
navigation
|
|
21
|
+
navigation,
|
|
22
|
+
isLoading,
|
|
23
|
+
getBusinesses
|
|
22
24
|
} = props;
|
|
23
25
|
|
|
24
26
|
const [, t] = useLanguage()
|
|
25
|
-
|
|
27
|
+
const [orderState] = useOrder()
|
|
26
28
|
|
|
27
29
|
const windowWidth = Dimensions.get('window').width;
|
|
28
30
|
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (businessesList?.loading || !isLoading) return
|
|
33
|
+
getBusinesses(true)
|
|
34
|
+
}, [isLoading])
|
|
35
|
+
|
|
29
36
|
return (
|
|
30
37
|
<>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
justifyContent: 'space-between',
|
|
64
|
-
}}>
|
|
65
|
-
<PlaceholderLine
|
|
66
|
-
height={15}
|
|
67
|
-
width={40}
|
|
68
|
-
style={{ marginBottom: 15 }}
|
|
69
|
-
/>
|
|
70
|
-
<PlaceholderLine
|
|
71
|
-
height={15}
|
|
72
|
-
width={20}
|
|
73
|
-
style={{ marginBottom: 15 }}
|
|
74
|
-
/>
|
|
75
|
-
</View>
|
|
38
|
+
|
|
39
|
+
{businessesList.loading ? (
|
|
40
|
+
<>
|
|
41
|
+
<ScrollView
|
|
42
|
+
showsHorizontalScrollIndicator={false}
|
|
43
|
+
nestedScrollEnabled
|
|
44
|
+
horizontal
|
|
45
|
+
style={{ height: 300, paddingHorizontal: 40 }}
|
|
46
|
+
>
|
|
47
|
+
{[
|
|
48
|
+
...Array(10).keys()
|
|
49
|
+
].map((item, i) => (
|
|
50
|
+
<Placeholder
|
|
51
|
+
Animation={Fade}
|
|
52
|
+
key={i}
|
|
53
|
+
style={{
|
|
54
|
+
marginTop: 20,
|
|
55
|
+
width: windowWidth - 100,
|
|
56
|
+
paddingHorizontal: 5,
|
|
57
|
+
height: '100%'
|
|
58
|
+
}}>
|
|
59
|
+
<View style={{ width: '100%' }}>
|
|
60
|
+
<PlaceholderLine
|
|
61
|
+
height={150}
|
|
62
|
+
style={{ marginBottom: 20, borderRadius: 8 }}
|
|
63
|
+
/>
|
|
64
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
65
|
+
<View
|
|
66
|
+
style={{
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
justifyContent: 'space-between',
|
|
69
|
+
}}>
|
|
76
70
|
<PlaceholderLine
|
|
77
71
|
height={15}
|
|
78
|
-
width={
|
|
79
|
-
style={{ marginBottom:
|
|
72
|
+
width={40}
|
|
73
|
+
style={{ marginBottom: 15 }}
|
|
80
74
|
/>
|
|
81
75
|
<PlaceholderLine
|
|
82
76
|
height={15}
|
|
83
|
-
width={
|
|
84
|
-
style={{ marginBottom:
|
|
77
|
+
width={20}
|
|
78
|
+
style={{ marginBottom: 15 }}
|
|
85
79
|
/>
|
|
86
80
|
</View>
|
|
81
|
+
<PlaceholderLine
|
|
82
|
+
height={15}
|
|
83
|
+
width={30}
|
|
84
|
+
style={{ marginBottom: 10 }}
|
|
85
|
+
/>
|
|
86
|
+
<PlaceholderLine
|
|
87
|
+
height={15}
|
|
88
|
+
width={80}
|
|
89
|
+
style={{ marginBottom: 10 }}
|
|
90
|
+
/>
|
|
87
91
|
</View>
|
|
88
|
-
</
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
92
|
+
</View>
|
|
93
|
+
</Placeholder>
|
|
94
|
+
))}
|
|
95
|
+
</ScrollView>
|
|
96
|
+
</>
|
|
97
|
+
) : (
|
|
98
|
+
<>
|
|
99
|
+
{businessesList.businesses.length > 0 && (
|
|
100
|
+
<ListWrapper>
|
|
101
|
+
<OText size={16} mBottom={5} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('HIGHEST_RATED', 'Highest rated')}</OText>
|
|
102
|
+
<OText size={12}>{t('TOP_RATINGS_AND_GREAT_SERVICE', 'Top ratings and great service')}</OText>
|
|
103
|
+
<ScrollView
|
|
104
|
+
showsHorizontalScrollIndicator={false}
|
|
105
|
+
nestedScrollEnabled
|
|
106
|
+
horizontal
|
|
107
|
+
style={{ height: 300 }}
|
|
108
|
+
>
|
|
109
|
+
{
|
|
110
|
+
businessesList.businesses?.map(
|
|
111
|
+
(business: any) => (
|
|
112
|
+
<View
|
|
113
|
+
key={business.id}
|
|
114
|
+
style={{
|
|
115
|
+
width: windowWidth - 100,
|
|
116
|
+
paddingHorizontal: 5,
|
|
117
|
+
height: '100%'
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<BusinessController
|
|
121
|
+
business={business}
|
|
122
|
+
isBusinessOpen={business?.open}
|
|
123
|
+
handleCustomClick={onBusinessClick}
|
|
124
|
+
orderType={orderState?.options?.type}
|
|
125
|
+
navigation={navigation}
|
|
126
|
+
/>
|
|
127
|
+
</View>
|
|
128
|
+
)
|
|
112
129
|
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)}
|
|
117
|
-
</>
|
|
130
|
+
}
|
|
131
|
+
</ScrollView>
|
|
132
|
+
</ListWrapper>
|
|
118
133
|
)}
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
121
136
|
</>
|
|
122
137
|
)
|
|
123
138
|
}
|
|
124
139
|
|
|
125
140
|
export const HighestRatedBusinesses = (props: any) => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
141
|
+
const highestRatedBusinessesProps = {
|
|
142
|
+
...props,
|
|
143
|
+
UIComponent: HighestRatedBusinessesUI,
|
|
129
144
|
initialOrderByValue: 'rating'
|
|
130
|
-
|
|
145
|
+
};
|
|
131
146
|
|
|
132
|
-
|
|
147
|
+
return <BusinessesListingController {...highestRatedBusinessesProps} />;
|
|
133
148
|
};
|
|
@@ -67,7 +67,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
67
67
|
const [, t] = useLanguage();
|
|
68
68
|
const [{ configs }] = useConfig();
|
|
69
69
|
const [, { login }] = useSession();
|
|
70
|
-
const { control, handleSubmit, errors } = useForm();
|
|
70
|
+
const { control, handleSubmit, errors, reset, register, setValue } = useForm();
|
|
71
71
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
72
72
|
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
73
73
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
@@ -91,7 +91,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
91
91
|
inputStyle: {
|
|
92
92
|
marginBottom: 28,
|
|
93
93
|
borderWidth: 1,
|
|
94
|
-
borderColor: theme.colors.border,
|
|
94
|
+
// borderColor: theme.colors.border,
|
|
95
95
|
borderRadius: 7.6,
|
|
96
96
|
},
|
|
97
97
|
line: {
|
|
@@ -189,33 +189,21 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
189
189
|
}, [verifyPhoneState]);
|
|
190
190
|
|
|
191
191
|
useEffect(() => {
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
208
|
-
'The field Mobile phone is required.',
|
|
209
|
-
),
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
list.map((item: any, i: number) => {
|
|
213
|
-
stringError +=
|
|
214
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
215
|
-
});
|
|
216
|
-
showToast(ToastType.Error, stringError);
|
|
217
|
-
}
|
|
218
|
-
}, [errors]);
|
|
192
|
+
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
193
|
+
else setValue('cellphone', '')
|
|
194
|
+
}, [phoneInputData?.phone?.cellphone])
|
|
195
|
+
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
register('cellphone', {
|
|
198
|
+
required: loginTab === 'cellphone'
|
|
199
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
200
|
+
: null
|
|
201
|
+
})
|
|
202
|
+
}, [register])
|
|
203
|
+
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
reset()
|
|
206
|
+
}, [loginTab])
|
|
219
207
|
|
|
220
208
|
return (
|
|
221
209
|
<Container>
|
|
@@ -284,43 +272,58 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
284
272
|
{(useLoginByCellphone || useLoginByEmail) && (
|
|
285
273
|
<FormInput>
|
|
286
274
|
{useLoginByEmail && loginTab === 'email' && (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
handleChangeInputEmail(e, onChange);
|
|
296
|
-
}}
|
|
297
|
-
value={value}
|
|
298
|
-
autoCapitalize="none"
|
|
299
|
-
autoCorrect={false}
|
|
300
|
-
type="email-address"
|
|
301
|
-
autoCompleteType="email"
|
|
302
|
-
returnKeyType="next"
|
|
303
|
-
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
304
|
-
blurOnSubmit={false}
|
|
305
|
-
forwardRef={emailRef}
|
|
306
|
-
/>
|
|
275
|
+
<>
|
|
276
|
+
{errors?.email && (
|
|
277
|
+
<OText
|
|
278
|
+
size={14}
|
|
279
|
+
color={theme.colors.danger5}
|
|
280
|
+
weight={'normal'}>
|
|
281
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
282
|
+
</OText>
|
|
307
283
|
)}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
284
|
+
<Controller
|
|
285
|
+
control={control}
|
|
286
|
+
render={({ onChange, value }: any) => (
|
|
287
|
+
<OInput
|
|
288
|
+
placeholder={t('EMAIL', 'Email')}
|
|
289
|
+
style={loginStyle.inputStyle}
|
|
290
|
+
icon={theme.images.general.email}
|
|
291
|
+
onChange={(e: any) => {
|
|
292
|
+
handleChangeInputEmail(e, onChange);
|
|
293
|
+
}}
|
|
294
|
+
value={value}
|
|
295
|
+
autoCapitalize="none"
|
|
296
|
+
autoCorrect={false}
|
|
297
|
+
type="email-address"
|
|
298
|
+
autoCompleteType="email"
|
|
299
|
+
returnKeyType="next"
|
|
300
|
+
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
301
|
+
blurOnSubmit={false}
|
|
302
|
+
forwardRef={emailRef}
|
|
303
|
+
borderColor={errors?.email ? theme.colors.danger5 : theme.colors.border}
|
|
304
|
+
/>
|
|
305
|
+
)}
|
|
306
|
+
name="email"
|
|
307
|
+
rules={{
|
|
308
|
+
required: {
|
|
309
|
+
value: true,
|
|
310
|
+
message: t(
|
|
311
|
+
'VALIDATION_ERROR_EMAIL_REQUIRED',
|
|
312
|
+
'The field Email is required',
|
|
313
|
+
).replace('_attribute_', t('EMAIL', 'Email'))
|
|
314
|
+
},
|
|
315
|
+
pattern: {
|
|
316
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
317
|
+
message: t(
|
|
318
|
+
'INVALID_ERROR_EMAIL',
|
|
319
|
+
'Invalid email address',
|
|
320
|
+
).replace('_attribute_', t('EMAIL', 'Email')),
|
|
321
|
+
}
|
|
322
|
+
}}
|
|
323
|
+
defaultValue=""
|
|
324
|
+
/>
|
|
325
|
+
</>
|
|
326
|
+
|
|
324
327
|
)}
|
|
325
328
|
{useLoginByCellphone && loginTab === 'cellphone' && (
|
|
326
329
|
<View style={{ marginBottom: 28 }}>
|
|
@@ -331,10 +334,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
331
334
|
returnKeyType: 'next',
|
|
332
335
|
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
333
336
|
}}
|
|
337
|
+
isStartValidation={errors?.cellphone}
|
|
334
338
|
/>
|
|
335
339
|
</View>
|
|
336
340
|
)}
|
|
337
|
-
|
|
341
|
+
{errors?.password && (
|
|
342
|
+
<OText
|
|
343
|
+
size={14}
|
|
344
|
+
color={theme.colors.danger5}
|
|
345
|
+
weight={'normal'}>
|
|
346
|
+
{errors?.password?.message}{errors?.password?.type === 'required' && '*'}
|
|
347
|
+
</OText>
|
|
348
|
+
)}
|
|
338
349
|
<Controller
|
|
339
350
|
control={control}
|
|
340
351
|
render={({ onChange, value }: any) => (
|
|
@@ -366,14 +377,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
366
377
|
returnKeyType="done"
|
|
367
378
|
onSubmitEditing={handleSubmit(onSubmit)}
|
|
368
379
|
blurOnSubmit
|
|
380
|
+
borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
|
|
369
381
|
/>
|
|
370
382
|
)}
|
|
371
383
|
name="password"
|
|
372
384
|
rules={{
|
|
373
|
-
required:
|
|
385
|
+
required: {
|
|
386
|
+
value: true,
|
|
387
|
+
message: t(
|
|
374
388
|
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
375
389
|
'The field Password is required',
|
|
376
|
-
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
390
|
+
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
391
|
+
}
|
|
377
392
|
}}
|
|
378
393
|
defaultValue=""
|
|
379
394
|
/>
|
|
@@ -35,6 +35,8 @@ const ORDER_STATUS: any = {
|
|
|
35
35
|
19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
|
|
36
36
|
20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
|
|
37
37
|
21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
|
|
38
|
+
22: 'ORDER_LOOKING_FOR_DRIVER',
|
|
39
|
+
23: 'ORDER_DRIVER_ON_WAY'
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
const filterSpecialStatus = ['prepared_in', 'delivered_in']
|
|
@@ -95,28 +97,18 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
const handleImagePicker = () => {
|
|
98
|
-
launchImageLibrary({ mediaType: 'photo', maxHeight:
|
|
99
|
-
if (response
|
|
100
|
-
|
|
101
|
-
} else if (response
|
|
102
|
-
console.log('ImagePicker Error: ', response.errorMessage);
|
|
100
|
+
launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
|
|
101
|
+
if (response?.didCancel) {
|
|
102
|
+
showToast(ToastType.Error, t('IMAGE_CANCELLED', 'User cancelled image picker'));
|
|
103
|
+
} else if (response?.errorMessage) {
|
|
103
104
|
showToast(ToastType.Error, response.errorMessage);
|
|
104
105
|
} else {
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} else {
|
|
110
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
111
|
-
}
|
|
106
|
+
if (response?.assets?.length > 0) {
|
|
107
|
+
const image = response?.assets[0]
|
|
108
|
+
const url = `data:${image.type};base64,${image.base64}`
|
|
109
|
+
setImage && setImage(url);
|
|
112
110
|
} else {
|
|
113
|
-
|
|
114
|
-
const image = response?.assets[0]
|
|
115
|
-
const url = `data:${image.type};base64,${image.base64}`
|
|
116
|
-
setImage && setImage(url);
|
|
117
|
-
} else {
|
|
118
|
-
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
119
|
-
}
|
|
111
|
+
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
114
|
});
|
|
@@ -235,7 +227,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
235
227
|
{image && (
|
|
236
228
|
<TouchableOpacity
|
|
237
229
|
style={{ position: 'absolute', top: -5, right: -5, borderColor: theme.colors.backgroundDark, backgroundColor: theme.colors.white, borderRadius: 25 }}
|
|
238
|
-
onPress={
|
|
230
|
+
onPress={removeImage}
|
|
239
231
|
>
|
|
240
232
|
<MaterialCommunityIcon name='close-circle-outline' color={theme.colors.backgroundDark} size={24} />
|
|
241
233
|
</TouchableOpacity>
|
|
@@ -340,30 +332,34 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
340
332
|
)
|
|
341
333
|
)
|
|
342
334
|
|
|
343
|
-
const renderSend = (props: any) =>
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
335
|
+
const renderSend = (props: any) => {
|
|
336
|
+
const isDisabled = (sendMessage?.loading || (message === '' && !image) || messages?.loading)
|
|
337
|
+
return (
|
|
338
|
+
<Send
|
|
339
|
+
{...props}
|
|
340
|
+
disabled={isDisabled}
|
|
341
|
+
alwaysShowSend
|
|
342
|
+
containerStyle={styles.containerSend}
|
|
343
|
+
>
|
|
344
|
+
<OIconButton
|
|
345
|
+
onClick={onSubmit}
|
|
346
|
+
style={{
|
|
347
|
+
height: 44,
|
|
348
|
+
width: 44,
|
|
349
|
+
borderRadius: 7.6,
|
|
350
|
+
opacity: isDisabled ? 0.2 : 1,
|
|
351
|
+
borderColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
|
|
352
|
+
backgroundColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
|
|
353
|
+
}}
|
|
354
|
+
iconStyle={{ marginTop: 3, marginRight: 2 }}
|
|
355
|
+
icon={theme.images.general.enter}
|
|
356
|
+
iconColor={isDisabled ? '#000' : '#fff'}
|
|
357
|
+
disabled={isDisabled}
|
|
358
|
+
disabledColor={theme.colors.secondary}
|
|
359
|
+
/>
|
|
360
|
+
</Send>
|
|
361
|
+
)
|
|
362
|
+
}
|
|
367
363
|
|
|
368
364
|
const renderBubble = (props: any) => (
|
|
369
365
|
<Bubble
|
|
@@ -543,9 +539,20 @@ const styles = StyleSheet.create({
|
|
|
543
539
|
})
|
|
544
540
|
|
|
545
541
|
export const Messages = (props: MessagesParams) => {
|
|
542
|
+
const [allMessages, setAllMessages] = useState(props.messages)
|
|
543
|
+
|
|
544
|
+
useEffect(() => {
|
|
545
|
+
setAllMessages(props.messages)
|
|
546
|
+
}, [props.messages])
|
|
547
|
+
|
|
546
548
|
const MessagesProps = {
|
|
547
549
|
...props,
|
|
548
|
-
UIComponent: MessagesUI
|
|
550
|
+
UIComponent: MessagesUI,
|
|
551
|
+
messages: allMessages,
|
|
552
|
+
setMessages: (values: any) => {
|
|
553
|
+
props.setMessages && props.setMessages(values)
|
|
554
|
+
setAllMessages(values)
|
|
555
|
+
}
|
|
549
556
|
}
|
|
550
557
|
return <MessagesController {...MessagesProps} />
|
|
551
558
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
import styled, { css } from 'styled-components/native'
|
|
3
2
|
|
|
4
|
-
|
|
5
3
|
export const Wrapper = styled.View`
|
|
6
4
|
flex: 1;
|
|
7
5
|
background-color: ${(props: any) => props.theme.colors.white};
|
|
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
|
|
|
39
37
|
${({ active }: any) => active && css`
|
|
40
38
|
background-color: ${(props: any) => props.theme.colors.whiteGray};
|
|
41
39
|
`}
|
|
42
|
-
`
|
|
40
|
+
`
|