ordering-ui-react-native 0.15.51 → 0.15.54
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/themes/business/src/components/OrderDetails/Delivery.tsx +9 -9
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/SignupForm/index.tsx +70 -2
- package/themes/original/src/types/index.tsx +2 -0
package/package.json
CHANGED
|
@@ -101,9 +101,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
const handleOpenMapView = async () => {
|
|
104
|
-
if (permissions
|
|
104
|
+
if (permissions?.locationStatus === 'granted') {
|
|
105
105
|
setOpenModalForMapView(!openModalForMapView);
|
|
106
|
-
} else if (permissions
|
|
106
|
+
} else if (permissions?.locationStatus === 'blocked') {
|
|
107
107
|
// redirectToSettings();
|
|
108
108
|
showToast(
|
|
109
109
|
ToastType.Error,
|
|
@@ -141,9 +141,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
141
141
|
handleArrowBack()
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
const handleAcceptLogisticOrder = (order
|
|
144
|
+
const handleAcceptLogisticOrder = (order: any) => {
|
|
145
145
|
handleClickLogisticOrder?.(1, order?.logistic_order_id)
|
|
146
|
-
if(order?.order_group){
|
|
146
|
+
if (order?.order_group) {
|
|
147
147
|
handleArrowBack()
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -166,10 +166,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
166
166
|
];
|
|
167
167
|
|
|
168
168
|
useEffect(() => {
|
|
169
|
-
if (permissions
|
|
169
|
+
if (permissions?.locationStatus !== 'granted' && openModalForMapView) {
|
|
170
170
|
setOpenModalForMapView(false);
|
|
171
171
|
}
|
|
172
|
-
}, [permissions
|
|
172
|
+
}, [permissions?.locationStatus]);
|
|
173
173
|
|
|
174
174
|
useEffect(() => {
|
|
175
175
|
if (openModalForAccept) {
|
|
@@ -215,8 +215,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
215
215
|
}, [messagesReadList]);
|
|
216
216
|
|
|
217
217
|
useEffect(() => {
|
|
218
|
-
forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp': 'forceDelivery')
|
|
219
|
-
},[forceUpdate])
|
|
218
|
+
forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp' : 'forceDelivery')
|
|
219
|
+
}, [forceUpdate])
|
|
220
220
|
|
|
221
221
|
const styles = StyleSheet.create({
|
|
222
222
|
btnPickUp: {
|
|
@@ -254,7 +254,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
254
254
|
);
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
const OrderDetailsInformation = (props
|
|
257
|
+
const OrderDetailsInformation = (props: { order: any, isOrderGroup?: boolean, lastOrder?: boolean }) => {
|
|
258
258
|
const {
|
|
259
259
|
order,
|
|
260
260
|
isOrderGroup,
|
|
@@ -248,7 +248,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
248
248
|
style={{ borderRadius: 7.6 }}
|
|
249
249
|
/>
|
|
250
250
|
)}
|
|
251
|
-
<OText>{openDescription?.description}</OText>
|
|
251
|
+
<OText mBottom={40}>{openDescription?.description}</OText>
|
|
252
252
|
</ScrollView>
|
|
253
253
|
</OModal>
|
|
254
254
|
</ProductsContainer>
|
|
@@ -3,14 +3,20 @@ import { TouchableOpacity } from 'react-native';
|
|
|
3
3
|
import { LogoutAction } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { OIcon, OText } from '../shared';
|
|
6
|
+
import { _retrieveStoreData } from '../../providers/StoreUtil';
|
|
6
7
|
|
|
7
8
|
const LogoutButtonUI = (props: any) => {
|
|
8
9
|
const { handleLogoutClick, text, color, iconSize } = props
|
|
9
10
|
const theme = useTheme();
|
|
10
11
|
|
|
12
|
+
const handleClick = async () => {
|
|
13
|
+
const data = await _retrieveStoreData('notification_state');
|
|
14
|
+
handleLogoutClick(data)
|
|
15
|
+
};
|
|
16
|
+
|
|
11
17
|
return (
|
|
12
18
|
<TouchableOpacity
|
|
13
|
-
onPress={() =>
|
|
19
|
+
onPress={() => handleClick()}
|
|
14
20
|
style={{ flexDirection: 'row', alignItems: 'center' }}
|
|
15
21
|
>
|
|
16
22
|
<OIcon
|
|
@@ -112,7 +112,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
112
112
|
{cart?.products?.length > 0 && (
|
|
113
113
|
<>
|
|
114
114
|
<OSProductList>
|
|
115
|
-
{cart?.products
|
|
115
|
+
{cart?.products?.map((product: any) => (
|
|
116
116
|
<ProductItemAccordion
|
|
117
117
|
key={product.code}
|
|
118
118
|
product={product}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { View, Pressable, StyleSheet, Linking, Platform } from 'react-native';
|
|
2
|
+
import { View, Pressable, StyleSheet, Linking, Platform, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
4
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
5
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
6
6
|
import CheckBox from '@react-native-community/checkbox';
|
|
7
7
|
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
8
8
|
import { FacebookLogin } from '../FacebookLogin';
|
|
9
|
+
import Recaptcha from 'react-native-recaptcha-that-works'
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
SignupForm as SignUpController,
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
LoginWith as SignupWith,
|
|
24
25
|
OTab,
|
|
25
26
|
OTabs,
|
|
27
|
+
RecaptchaButton
|
|
26
28
|
} from '../LoginForm/styles';
|
|
27
29
|
|
|
28
30
|
import NavBar from '../NavBar';
|
|
@@ -63,7 +65,9 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
63
65
|
handleSendVerifyCode,
|
|
64
66
|
handleCheckPhoneCode,
|
|
65
67
|
notificationState,
|
|
66
|
-
handleChangePromotions
|
|
68
|
+
handleChangePromotions,
|
|
69
|
+
enableReCaptcha,
|
|
70
|
+
handleReCaptcha
|
|
67
71
|
} = props;
|
|
68
72
|
|
|
69
73
|
const theme = useTheme();
|
|
@@ -117,6 +121,8 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
117
121
|
cellphone: null,
|
|
118
122
|
},
|
|
119
123
|
});
|
|
124
|
+
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
125
|
+
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
120
126
|
|
|
121
127
|
const nameRef = useRef<any>(null);
|
|
122
128
|
const lastnameRef = useRef<any>(null);
|
|
@@ -125,6 +131,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
125
131
|
const emailRef = useRef<any>(null);
|
|
126
132
|
const phoneRef = useRef<any>(null);
|
|
127
133
|
const passwordRef = useRef<any>(null);
|
|
134
|
+
const recaptchaRef = useRef<any>({});
|
|
128
135
|
|
|
129
136
|
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
130
137
|
|
|
@@ -286,6 +293,33 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
286
293
|
}
|
|
287
294
|
}
|
|
288
295
|
|
|
296
|
+
const handleOpenRecaptcha = () => {
|
|
297
|
+
setRecaptchaVerified(false)
|
|
298
|
+
if (!recaptchaConfig?.siteKey) {
|
|
299
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
300
|
+
return
|
|
301
|
+
}
|
|
302
|
+
if (!recaptchaConfig?.baseUrl) {
|
|
303
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
|
|
304
|
+
return
|
|
305
|
+
}
|
|
306
|
+
recaptchaRef.current.open()
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const onRecaptchaVerify = (token: any) => {
|
|
310
|
+
setRecaptchaVerified(true)
|
|
311
|
+
handleReCaptcha(token)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
316
|
+
setRecaptchaConfig({
|
|
317
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
318
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
}, [configs, enableReCaptcha])
|
|
322
|
+
|
|
289
323
|
useEffect(() => {
|
|
290
324
|
if (!formState.loading && formState.result?.error) {
|
|
291
325
|
formState.result?.result &&
|
|
@@ -467,6 +501,39 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
467
501
|
</View>
|
|
468
502
|
)}
|
|
469
503
|
|
|
504
|
+
{enableReCaptcha && (
|
|
505
|
+
<>
|
|
506
|
+
<TouchableOpacity
|
|
507
|
+
onPress={handleOpenRecaptcha}
|
|
508
|
+
style={{ marginHorizontal: 4, marginBottom: 10 }}
|
|
509
|
+
>
|
|
510
|
+
<RecaptchaButton>
|
|
511
|
+
{recaptchaVerified ? (
|
|
512
|
+
<MaterialCommunityIcons
|
|
513
|
+
name="checkbox-marked"
|
|
514
|
+
size={23}
|
|
515
|
+
color={theme.colors.primary}
|
|
516
|
+
/>
|
|
517
|
+
) : (
|
|
518
|
+
<MaterialCommunityIcons
|
|
519
|
+
name="checkbox-blank-outline"
|
|
520
|
+
size={23}
|
|
521
|
+
color={theme.colors.disabled}
|
|
522
|
+
/>
|
|
523
|
+
)}
|
|
524
|
+
<OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
|
|
525
|
+
</RecaptchaButton>
|
|
526
|
+
</TouchableOpacity>
|
|
527
|
+
<Recaptcha
|
|
528
|
+
ref={recaptchaRef}
|
|
529
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
530
|
+
baseUrl={recaptchaConfig?.baseUrl}
|
|
531
|
+
onVerify={onRecaptchaVerify}
|
|
532
|
+
onExpire={() => setRecaptchaVerified(false)}
|
|
533
|
+
/>
|
|
534
|
+
</>
|
|
535
|
+
)}
|
|
536
|
+
|
|
470
537
|
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
|
|
471
538
|
<Controller
|
|
472
539
|
control={control}
|
|
@@ -736,6 +803,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
736
803
|
export const SignupForm = (props: any) => {
|
|
737
804
|
const signupProps = {
|
|
738
805
|
...props,
|
|
806
|
+
isRecaptchaEnable: true,
|
|
739
807
|
UIComponent: SignupFormUI,
|
|
740
808
|
};
|
|
741
809
|
return <SignUpController {...signupProps} />;
|