ordering-ui-react-native 0.25.1 → 0.26.0
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/original/src/components/AddressForm/index.tsx +20 -0
- package/themes/original/src/components/LoginForm/Otp/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/index.tsx +883 -858
- package/themes/original/src/components/SignupForm/index.tsx +966 -943
|
@@ -11,24 +11,24 @@ import ReCaptcha from '@fatnlazycat/react-native-recaptcha-v3'
|
|
|
11
11
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
SignupForm as SignUpController,
|
|
15
|
+
useLanguage,
|
|
16
|
+
useConfig,
|
|
17
|
+
useSession,
|
|
18
|
+
ToastType,
|
|
19
|
+
useToast,
|
|
20
20
|
} from 'ordering-components/native';
|
|
21
21
|
import { useTheme } from 'styled-components/native';
|
|
22
22
|
import { FormSide, FormInput, SocialButtons } from './styles';
|
|
23
23
|
import { Otp } from '../LoginForm/Otp'
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
ButtonsWrapper,
|
|
27
|
+
LoginWith as SignupWith,
|
|
28
|
+
TabBtn,
|
|
29
|
+
OTab,
|
|
30
|
+
OTabs,
|
|
31
|
+
RecaptchaButton
|
|
32
32
|
} from '../LoginForm/styles';
|
|
33
33
|
|
|
34
34
|
import NavBar from '../NavBar';
|
|
@@ -41,984 +41,1007 @@ import { GoogleLogin } from '../GoogleLogin';
|
|
|
41
41
|
import { AppleLogin } from '../AppleLogin';
|
|
42
42
|
|
|
43
43
|
const notValidationFields = [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
'coupon',
|
|
45
|
+
'driver_tip',
|
|
46
|
+
'mobile_phone',
|
|
47
|
+
'address',
|
|
48
|
+
'address_notes',
|
|
49
49
|
];
|
|
50
50
|
|
|
51
51
|
const SignupFormUI = (props: SignupParams) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
52
|
+
const {
|
|
53
|
+
navigation,
|
|
54
|
+
loginButtonText,
|
|
55
|
+
signupButtonText,
|
|
56
|
+
onNavigationRedirect,
|
|
57
|
+
formState,
|
|
58
|
+
validationFields,
|
|
59
|
+
showField,
|
|
60
|
+
isRequiredField,
|
|
61
|
+
useChekoutFileds,
|
|
62
|
+
useSignupByEmail,
|
|
63
|
+
useSignupByCellphone,
|
|
64
|
+
handleSuccessSignup,
|
|
65
|
+
handleButtonSignupClick,
|
|
66
|
+
verifyPhoneState,
|
|
67
|
+
checkPhoneCodeState,
|
|
68
|
+
setCheckPhoneCodeState,
|
|
69
|
+
handleSendVerifyCode,
|
|
70
|
+
handleCheckPhoneCode,
|
|
71
|
+
notificationState,
|
|
72
|
+
handleChangePromotions,
|
|
73
|
+
enableReCaptcha,
|
|
74
|
+
handleReCaptcha,
|
|
75
|
+
generateOtpCode,
|
|
76
|
+
numOtpInputs,
|
|
77
|
+
setWillVerifyOtpState,
|
|
78
|
+
handleChangeInput,
|
|
79
|
+
willVerifyOtpState,
|
|
80
|
+
setOtpState,
|
|
81
|
+
setSignUpTab,
|
|
82
|
+
signUpTab,
|
|
83
|
+
useSignUpFullDetails,
|
|
84
|
+
useSignUpOtpEmail,
|
|
85
|
+
useSignUpOtpCellphone,
|
|
86
|
+
useSignUpOtpWhatsapp,
|
|
87
|
+
isGuest,
|
|
88
|
+
setCellphoneStartZero
|
|
89
|
+
} = props;
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
const theme = useTheme();
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
const style = StyleSheet.create({
|
|
94
|
+
btnOutline: {
|
|
95
|
+
backgroundColor: '#FFF',
|
|
96
|
+
color: theme.colors.primary,
|
|
97
|
+
},
|
|
98
|
+
inputStyle: {
|
|
99
|
+
marginBottom: 20,
|
|
100
|
+
borderWidth: 1,
|
|
101
|
+
borderRadius: 7.6,
|
|
102
|
+
},
|
|
103
|
+
wrappText: {
|
|
104
|
+
display: 'flex',
|
|
105
|
+
flexDirection: 'row',
|
|
106
|
+
justifyContent: 'space-between',
|
|
107
|
+
marginBottom: 30,
|
|
108
|
+
},
|
|
109
|
+
line: {
|
|
110
|
+
height: 1,
|
|
111
|
+
backgroundColor: theme.colors.border,
|
|
112
|
+
flexGrow: 1,
|
|
113
|
+
marginBottom: 7,
|
|
114
|
+
},
|
|
115
|
+
checkBoxStyle: {
|
|
116
|
+
width: 25,
|
|
117
|
+
height: 25,
|
|
118
|
+
}
|
|
119
|
+
});
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
const [, { showToast }] = useToast();
|
|
122
|
+
const [, t] = useLanguage();
|
|
123
|
+
const [, { login }] = useSession();
|
|
124
|
+
const [{ configs }] = useConfig();
|
|
125
|
+
const { control, handleSubmit, clearErrors, errors, register, unregister, setValue } = useForm();
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
const [passwordSee, setPasswordSee] = useState(false);
|
|
128
|
+
const [formValues, setFormValues] = useState(null);
|
|
129
|
+
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
130
|
+
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
131
|
+
const [isFBLoading, setIsFBLoading] = useState(false);
|
|
132
|
+
const [phoneInputData, setPhoneInputData] = useState({
|
|
133
|
+
error: '',
|
|
134
|
+
phone: {
|
|
135
|
+
country_phone_code: null,
|
|
136
|
+
cellphone: null,
|
|
137
|
+
country_code: null
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
const [alertState, setAlertState] = useState({ open: false, title: '', content: [] })
|
|
141
|
+
const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
|
|
142
|
+
const [recaptchaVerified, setRecaptchaVerified] = useState(false)
|
|
143
|
+
const [tabLayouts, setTabLayouts] = useState<any>({})
|
|
144
|
+
const [isCheckingCode, setCheckingCode] = useState(false)
|
|
145
|
+
const [otpError, setOtpError] = useState(null)
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
const tabsRef = useRef<any>(null)
|
|
148
|
+
const nameRef = useRef<any>(null);
|
|
149
|
+
const lastnameRef = useRef<any>(null);
|
|
150
|
+
const middleNameRef = useRef<any>(null);
|
|
151
|
+
const secondLastnameRef = useRef<any>(null);
|
|
152
|
+
const emailRef = useRef<any>(null);
|
|
153
|
+
const phoneRef = useRef<any>(null);
|
|
154
|
+
const passwordRef = useRef<any>(null);
|
|
155
|
+
const recaptchaRef = useRef<any>({});
|
|
156
|
+
const otpChannelRef = useRef<number>(2);
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
|
|
159
|
+
const googleLoginEnabled = configs?.google_login_enabled?.value === '1'
|
|
160
|
+
const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1'
|
|
161
|
+
const appleLoginEnabled = Platform.OS === 'ios' && configs?.apple_login_enabled?.value === '1'
|
|
160
162
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
const closeAlert = () => {
|
|
164
|
+
setAlertState({
|
|
165
|
+
open: false,
|
|
166
|
+
title: '',
|
|
167
|
+
content: []
|
|
168
|
+
})
|
|
169
|
+
}
|
|
168
170
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
const vibrateApp = (impact?: string) => {
|
|
172
|
+
const options = {
|
|
173
|
+
enableVibrateFallback: true,
|
|
174
|
+
ignoreAndroidSystemSettings: false
|
|
175
|
+
};
|
|
176
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
177
|
+
}
|
|
176
178
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
179
|
+
const handleRefs = (ref: any, code: string) => {
|
|
180
|
+
switch (code) {
|
|
181
|
+
case 'name': {
|
|
182
|
+
nameRef.current = ref;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case 'middle_name': {
|
|
186
|
+
middleNameRef.current = ref;
|
|
187
|
+
}
|
|
188
|
+
case 'lastname': {
|
|
189
|
+
lastnameRef.current = ref;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
case 'second_lastname': {
|
|
193
|
+
secondLastnameRef.current = ref;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case 'email': {
|
|
197
|
+
emailRef.current = ref;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
200
202
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
const handleOnLayout = (event: any, opc: string) => {
|
|
204
|
+
const _tabLayouts = { ...tabLayouts }
|
|
205
|
+
const categoryKey = opc
|
|
206
|
+
_tabLayouts[categoryKey] = event.nativeEvent.layout
|
|
207
|
+
setTabLayouts(_tabLayouts)
|
|
208
|
+
}
|
|
207
209
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
210
|
+
const handleFocusRef = (code: string) => {
|
|
211
|
+
switch (code) {
|
|
212
|
+
case 'name': {
|
|
213
|
+
nameRef?.current?.focus();
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case 'middle_name': {
|
|
217
|
+
middleNameRef?.current?.focus();
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
case 'lastname': {
|
|
221
|
+
lastnameRef?.current?.focus();
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
case 'second_lastname': {
|
|
225
|
+
secondLastnameRef?.current?.focus();
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case 'email': {
|
|
229
|
+
emailRef?.current?.focus();
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
232
234
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
235
|
+
const getNextFieldCode = (index: number) => {
|
|
236
|
+
const fields = sortInputFields({
|
|
237
|
+
values: validationFields?.fields?.checkout,
|
|
238
|
+
})?.filter(
|
|
239
|
+
(field: any) =>
|
|
240
|
+
!notValidationFields.includes(field.code) && showField(field.code),
|
|
241
|
+
);
|
|
242
|
+
return fields[index + 1]?.code;
|
|
243
|
+
};
|
|
242
244
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
const handleSuccessFacebook = (user: any) => {
|
|
246
|
+
login({
|
|
247
|
+
user,
|
|
248
|
+
token: user.session.access_token,
|
|
249
|
+
});
|
|
250
|
+
navigation.navigate('Home');
|
|
251
|
+
};
|
|
250
252
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
const handleSignUpTab = (tab: string) => {
|
|
254
|
+
setSignUpTab && setSignUpTab(tab)
|
|
255
|
+
clearErrors()
|
|
256
|
+
}
|
|
255
257
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
258
|
+
const onSubmit = (values?: any) => {
|
|
259
|
+
if (phoneInputData.error && signUpTab !== 'otpEmail') {
|
|
260
|
+
showToast(ToastType.Error, phoneInputData.error);
|
|
261
|
+
vibrateApp()
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (
|
|
265
|
+
!phoneInputData.phone.country_phone_code &&
|
|
266
|
+
!phoneInputData.phone.cellphone &&
|
|
267
|
+
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
268
|
+
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
269
|
+
configs?.verification_phone_required?.value === '1') &&
|
|
270
|
+
signUpTab !== 'otpEmail'
|
|
271
|
+
) {
|
|
272
|
+
showToast(
|
|
273
|
+
ToastType.Error,
|
|
274
|
+
t(
|
|
275
|
+
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
276
|
+
'The field Mobile phone is required.',
|
|
277
|
+
),
|
|
278
|
+
);
|
|
279
|
+
vibrateApp()
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (signUpTab === 'otpEmail' || signUpTab === 'otpCellphone') {
|
|
283
|
+
generateOtpCode && generateOtpCode({
|
|
284
|
+
...values,
|
|
285
|
+
...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && { ...phoneInputData.phone }),
|
|
286
|
+
country_code: phoneInputData.phone.country_code
|
|
287
|
+
}, otpChannelRef.current)
|
|
288
|
+
return
|
|
289
|
+
}
|
|
290
|
+
handleButtonSignupClick &&
|
|
291
|
+
handleButtonSignupClick({
|
|
292
|
+
...values,
|
|
293
|
+
...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && { ...phoneInputData.phone }),
|
|
294
|
+
country_code: phoneInputData.phone.country_code
|
|
295
|
+
});
|
|
296
|
+
if (!formState.loading && formState.result.result && !formState.result.error) {
|
|
297
|
+
handleSuccessSignup && handleSuccessSignup(formState.result.result);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
298
300
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
const handleSingUpOtp = (value: string) => {
|
|
302
|
+
setOtpState && setOtpState(value)
|
|
303
|
+
}
|
|
302
304
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
const handleVerifyCodeClick = (values: any) => {
|
|
306
|
+
const formData = values || formValues;
|
|
307
|
+
handleSendVerifyCode &&
|
|
308
|
+
handleSendVerifyCode({
|
|
309
|
+
...formData,
|
|
310
|
+
...phoneInputData.phone,
|
|
311
|
+
});
|
|
312
|
+
setIsLoadingVerifyModal(true);
|
|
313
|
+
};
|
|
312
314
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
315
|
+
// get object with rules for hook form inputs
|
|
316
|
+
const getInputRules = (field: any) => {
|
|
317
|
+
const rules: any = {
|
|
318
|
+
required: isRequiredField(field.code)
|
|
319
|
+
? t(
|
|
320
|
+
`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
|
|
321
|
+
`${field.name} is required`,
|
|
322
|
+
).replace('_attribute_', t(field.name, field.code))
|
|
323
|
+
: null,
|
|
324
|
+
};
|
|
325
|
+
if (field.code && field.code === 'email') {
|
|
326
|
+
rules.pattern = {
|
|
327
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
328
|
+
message: t('INVALID_ERROR_EMAIL', 'Invalid email address').replace(
|
|
329
|
+
'_attribute_',
|
|
330
|
+
t('EMAIL', 'Email'),
|
|
331
|
+
),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
return rules;
|
|
335
|
+
};
|
|
334
336
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
337
|
+
const handleChangeInputEmail = (value: string, onChange: any) => {
|
|
338
|
+
onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
|
|
339
|
+
};
|
|
338
340
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
const handleOpenTermsUrl = async (url: any) => {
|
|
342
|
+
const supported = await Linking.canOpenURL(url);
|
|
341
343
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
344
|
+
if (supported) {
|
|
345
|
+
await Linking.openURL(url);
|
|
346
|
+
} else {
|
|
347
|
+
showToast(ToastType.Error, t('VALIDATION_ERROR_ACTIVE_URL', 'The _attribute_ is not a valid URL.').replace('_attribute_', t('URL', 'URL')))
|
|
348
|
+
vibrateApp()
|
|
349
|
+
}
|
|
350
|
+
}
|
|
349
351
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
352
|
+
const handleOpenRecaptcha = () => {
|
|
353
|
+
setRecaptchaVerified(false)
|
|
354
|
+
if (!recaptchaConfig?.siteKey) {
|
|
355
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
|
|
356
|
+
vibrateApp()
|
|
357
|
+
return
|
|
358
|
+
}
|
|
359
|
+
if (!recaptchaConfig?.baseUrl) {
|
|
360
|
+
showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
|
|
361
|
+
vibrateApp()
|
|
362
|
+
return
|
|
363
|
+
}
|
|
364
|
+
recaptchaRef.current.open()
|
|
365
|
+
}
|
|
364
366
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
const onRecaptchaVerify = (token: any) => {
|
|
368
|
+
setRecaptchaVerified(true)
|
|
369
|
+
handleReCaptcha && handleReCaptcha({ code: token, version: recaptchaConfig?.version })
|
|
370
|
+
}
|
|
369
371
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
372
|
+
const handleChangePhoneNumber = (number: any, rawNumber: any) => {
|
|
373
|
+
setPhoneInputData({
|
|
374
|
+
...phoneInputData,
|
|
375
|
+
...number,
|
|
376
|
+
phone: {
|
|
377
|
+
...phoneInputData.phone,
|
|
378
|
+
...number.phone,
|
|
379
|
+
country_code: phoneInputData.phone.country_code
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
setCellphoneStartZero && setCellphoneStartZero(rawNumber?.number && rawNumber?.countryCallingCode ? rawNumber?.number : null)
|
|
383
|
+
}
|
|
382
384
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
385
|
+
useEffect(() => {
|
|
386
|
+
if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
|
|
387
|
+
if (configs?.security_recaptcha_type?.value === 'v3' &&
|
|
388
|
+
configs?.security_recaptcha_score_v3?.value > 0 &&
|
|
389
|
+
configs?.security_recaptcha_site_key_v3?.value
|
|
390
|
+
) {
|
|
391
|
+
setRecaptchaConfig({
|
|
392
|
+
version: 'v3',
|
|
393
|
+
siteKey: configs?.security_recaptcha_site_key_v3?.value || null,
|
|
394
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
395
|
+
})
|
|
396
|
+
return
|
|
397
|
+
}
|
|
398
|
+
if (configs?.security_recaptcha_site_key?.value) {
|
|
399
|
+
setRecaptchaConfig({
|
|
400
|
+
version: 'v2',
|
|
401
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
402
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}, [configs, enableReCaptcha])
|
|
405
407
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
if (!formState.loading && formState.result?.error) {
|
|
410
|
+
if (formState.result?.result?.[0] === 'ERROR_AUTH_VERIFICATION_CODE') {
|
|
411
|
+
setRecaptchaVerified(false)
|
|
412
|
+
setRecaptchaConfig({
|
|
413
|
+
version: 'v2',
|
|
414
|
+
siteKey: configs?.security_recaptcha_site_key?.value || null,
|
|
415
|
+
baseUrl: configs?.security_recaptcha_base_url?.value || null
|
|
416
|
+
})
|
|
417
|
+
showToast(ToastType.Info, t('TRY_AGAIN', 'Please try again'))
|
|
418
|
+
vibrateApp()
|
|
419
|
+
return
|
|
420
|
+
}
|
|
421
|
+
formState.result?.result && formState.result?.result[0]?.includes("_") ?
|
|
422
|
+
showToast(ToastType.Error, t(`${formState.result?.result[0]}`, 'Phone number already used')) :
|
|
423
|
+
showToast(ToastType.Error, formState.result?.result[0])
|
|
424
|
+
formState.result?.result && vibrateApp()
|
|
425
|
+
setIsLoadingVerifyModal(false);
|
|
426
|
+
}
|
|
427
|
+
}, [formState]);
|
|
426
428
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
useEffect(() => {
|
|
430
|
+
if (Object.keys(errors).length > 0) {
|
|
431
|
+
setIsLoadingVerifyModal(false);
|
|
432
|
+
vibrateApp()
|
|
433
|
+
}
|
|
434
|
+
}, [errors])
|
|
433
435
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
436
|
+
useEffect(() => {
|
|
437
|
+
if (signUpTab === 'default' || signUpTab === 'otpCellphone') {
|
|
438
|
+
register('cellphone', {
|
|
439
|
+
required: isRequiredField('cellphone')
|
|
440
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
441
|
+
: null
|
|
442
|
+
})
|
|
443
|
+
} else {
|
|
444
|
+
unregister('cellphone')
|
|
445
|
+
}
|
|
446
|
+
}, [signUpTab])
|
|
445
447
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
useEffect(() => {
|
|
449
|
+
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
450
|
+
else setValue('cellphone', '')
|
|
451
|
+
}, [phoneInputData?.phone?.cellphone])
|
|
450
452
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
453
|
+
useEffect(() => {
|
|
454
|
+
if (verifyPhoneState && !verifyPhoneState?.loading) {
|
|
455
|
+
if (verifyPhoneState.result?.error) {
|
|
456
|
+
const message =
|
|
457
|
+
typeof verifyPhoneState?.result?.result === 'string'
|
|
458
|
+
? verifyPhoneState?.result?.result
|
|
459
|
+
: verifyPhoneState?.result?.result[0];
|
|
460
|
+
verifyPhoneState.result?.result && showToast(ToastType.Error, message);
|
|
461
|
+
verifyPhoneState.result?.result && vibrateApp()
|
|
462
|
+
setIsLoadingVerifyModal(false);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
463
465
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
466
|
+
const okResult = verifyPhoneState.result?.result === 'OK';
|
|
467
|
+
if (okResult) {
|
|
468
|
+
!isModalVisible && setIsModalVisible(true);
|
|
469
|
+
setIsLoadingVerifyModal(false);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}, [verifyPhoneState]);
|
|
471
473
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
474
|
+
useEffect(() => {
|
|
475
|
+
setPhoneInputData({
|
|
476
|
+
...phoneInputData,
|
|
477
|
+
phone: {
|
|
478
|
+
...phoneInputData.phone,
|
|
479
|
+
country_code: configs?.default_country_code?.value
|
|
480
|
+
}
|
|
481
|
+
})
|
|
482
|
+
}, [configs])
|
|
481
483
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
484
|
+
useEffect(() => {
|
|
485
|
+
if (checkPhoneCodeState?.result?.error) {
|
|
486
|
+
const titleText = (
|
|
487
|
+
typeof checkPhoneCodeState?.result?.result === 'string'
|
|
488
|
+
? checkPhoneCodeState?.result?.result
|
|
489
|
+
: checkPhoneCodeState?.result?.result[0].toString()
|
|
490
|
+
) || t('ERROR', 'Error')
|
|
491
|
+
setCheckingCode(false)
|
|
492
|
+
setOtpError(titleText)
|
|
493
|
+
checkPhoneCodeState?.generate && setAlertState({
|
|
494
|
+
open: true,
|
|
495
|
+
title: titleText,
|
|
496
|
+
content: []
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
}, [checkPhoneCodeState])
|
|
498
500
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
501
|
+
return (
|
|
502
|
+
<View>
|
|
503
|
+
{isGuest ? (
|
|
504
|
+
<OText style={{ textAlign: 'center', marginBottom: 10 }} size={18}>{t('SIGNUP', 'Signup')}</OText>
|
|
505
|
+
) : (
|
|
506
|
+
<NavBar
|
|
507
|
+
title={t('SIGNUP', 'Signup')}
|
|
508
|
+
titleAlign={'center'}
|
|
509
|
+
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
510
|
+
showCall={false}
|
|
511
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
512
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
513
|
+
titleStyle={{ marginLeft: 0, marginRight: 0 }}
|
|
514
|
+
/>
|
|
515
|
+
)}
|
|
516
|
+
<FormSide>
|
|
517
|
+
{((Number(useSignUpFullDetails) + Number(useSignUpOtpEmail) + Number(useSignUpOtpCellphone)) > 1) && (
|
|
518
|
+
<SignupWith>
|
|
519
|
+
<OTabs
|
|
520
|
+
horizontal
|
|
521
|
+
showsHorizontalScrollIndicator={false}
|
|
522
|
+
ref={tabsRef}
|
|
523
|
+
>
|
|
524
|
+
{useSignUpFullDetails && (
|
|
525
|
+
<TabBtn
|
|
526
|
+
onPress={() => handleSignUpTab('default')}
|
|
527
|
+
onLayout={(event: any) => handleOnLayout(event, 'default')}
|
|
528
|
+
>
|
|
529
|
+
<OTab
|
|
530
|
+
style={{
|
|
531
|
+
borderBottomColor:
|
|
532
|
+
signUpTab === 'default'
|
|
533
|
+
? theme.colors.textNormal
|
|
534
|
+
: theme.colors.border,
|
|
535
|
+
}}>
|
|
536
|
+
<OText
|
|
537
|
+
size={14}
|
|
538
|
+
color={
|
|
539
|
+
signUpTab === 'default'
|
|
540
|
+
? theme.colors.textNormal
|
|
541
|
+
: theme.colors.disabled
|
|
542
|
+
}
|
|
543
|
+
weight={signUpTab === 'default' ? 'bold' : 'normal'}>
|
|
544
|
+
{t('DEFAULT', 'Default')}
|
|
545
|
+
</OText>
|
|
546
|
+
</OTab>
|
|
547
|
+
</TabBtn>
|
|
548
|
+
)}
|
|
549
|
+
{useSignUpOtpEmail && (
|
|
550
|
+
<TabBtn
|
|
551
|
+
onPress={() => handleSignUpTab('otpEmail')}
|
|
552
|
+
onLayout={(event: any) => handleOnLayout(event, 'otpEmail')}
|
|
553
|
+
>
|
|
554
|
+
<OTab
|
|
555
|
+
style={{
|
|
556
|
+
borderBottomColor:
|
|
557
|
+
signUpTab === 'otpEmail'
|
|
558
|
+
? theme.colors.textNormal
|
|
559
|
+
: theme.colors.border,
|
|
560
|
+
}}>
|
|
561
|
+
<OText
|
|
562
|
+
size={14}
|
|
563
|
+
color={
|
|
564
|
+
signUpTab === 'otpEmail'
|
|
565
|
+
? theme.colors.textNormal
|
|
566
|
+
: theme.colors.disabled
|
|
567
|
+
}
|
|
568
|
+
weight={signUpTab === 'otpEmail' ? 'bold' : 'normal'}>
|
|
569
|
+
{t('BY_OTP_EMAIL', 'by Otp Email')}
|
|
570
|
+
</OText>
|
|
571
|
+
</OTab>
|
|
572
|
+
</TabBtn>
|
|
571
573
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
574
|
+
)}
|
|
575
|
+
{useSignUpOtpCellphone && (
|
|
576
|
+
<TabBtn
|
|
577
|
+
onPress={() => handleSignUpTab('otpCellphone')}
|
|
578
|
+
onLayout={(event: any) => handleOnLayout(event, 'otpCellphone')}
|
|
579
|
+
>
|
|
580
|
+
<OTab
|
|
581
|
+
style={{
|
|
582
|
+
borderBottomColor:
|
|
583
|
+
signUpTab === 'otpCellphone'
|
|
584
|
+
? theme.colors.textNormal
|
|
585
|
+
: theme.colors.border,
|
|
586
|
+
}}>
|
|
587
|
+
<OText
|
|
588
|
+
size={14}
|
|
589
|
+
color={
|
|
590
|
+
signUpTab === 'otpCellphone'
|
|
591
|
+
? theme.colors.textNormal
|
|
592
|
+
: theme.colors.disabled
|
|
593
|
+
}
|
|
594
|
+
weight={signUpTab === 'otpCellphone' ? 'bold' : 'normal'}>
|
|
595
|
+
{t('BY_OTP_CELLPHONE', 'by Otp Cellphone')}
|
|
596
|
+
</OText>
|
|
597
|
+
</OTab>
|
|
598
|
+
</TabBtn>
|
|
599
|
+
)}
|
|
600
|
+
</OTabs>
|
|
601
|
+
</SignupWith>
|
|
602
|
+
)}
|
|
603
|
+
<FormInput>
|
|
604
|
+
{!(useChekoutFileds && validationFields?.loading) ? (
|
|
605
|
+
<>
|
|
606
|
+
{sortInputFields({
|
|
607
|
+
values: validationFields?.fields?.checkout,
|
|
608
|
+
}).map(
|
|
609
|
+
(item: any, i: number) => {
|
|
610
|
+
const field = item?.validation_field || item
|
|
611
|
+
return (!notValidationFields.includes(field.code) &&
|
|
612
|
+
showField &&
|
|
613
|
+
showField(field.code) &&
|
|
614
|
+
(signUpTab === 'default' ||
|
|
615
|
+
(signUpTab === 'otpEmail' && field.code === 'email')) && (
|
|
616
|
+
<React.Fragment key={field.id}>
|
|
617
|
+
{errors?.[`${field.code}`] && (
|
|
618
|
+
<OText
|
|
619
|
+
size={14}
|
|
620
|
+
color={theme.colors.danger5}
|
|
621
|
+
weight={'normal'}>
|
|
622
|
+
{errors?.[`${field.code}`]?.message} {errors?.[`${field.code}`]?.type === 'required' && '*'}
|
|
623
|
+
</OText>
|
|
624
|
+
)}
|
|
625
|
+
<Controller
|
|
626
|
+
control={control}
|
|
627
|
+
render={({ onChange, value }: any) => (
|
|
628
|
+
<OInput
|
|
629
|
+
placeholder={t(field.name?.replace(/\s/g, '_')?.toUpperCase(), field.name)}
|
|
630
|
+
style={style.inputStyle}
|
|
631
|
+
icon={
|
|
632
|
+
field.code === 'email'
|
|
633
|
+
? theme.images.general.email
|
|
634
|
+
: theme.images.general.user
|
|
635
|
+
}
|
|
636
|
+
value={value}
|
|
637
|
+
onChange={(val: any) =>
|
|
638
|
+
field.code !== 'email'
|
|
639
|
+
? (onChange(val))
|
|
640
|
+
: handleChangeInputEmail(val, onChange)
|
|
641
|
+
}
|
|
642
|
+
autoCapitalize={
|
|
643
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
644
|
+
}
|
|
645
|
+
autoCorrect={field.code === 'email' && false}
|
|
646
|
+
type={
|
|
647
|
+
field.code === 'email' ? 'email-address' : 'default'
|
|
648
|
+
}
|
|
649
|
+
autoCompleteType={
|
|
650
|
+
field.code === 'email' ? 'email' : 'off'
|
|
651
|
+
}
|
|
652
|
+
returnKeyType="next"
|
|
653
|
+
blurOnSubmit={false}
|
|
654
|
+
forwardRef={(ref: any) => handleRefs(ref, field.code)}
|
|
655
|
+
onSubmitEditing={() =>
|
|
656
|
+
field.code === 'email'
|
|
657
|
+
? phoneRef?.current?.focus?.()
|
|
658
|
+
: handleFocusRef(getNextFieldCode(i))
|
|
659
|
+
}
|
|
660
|
+
borderColor={errors?.[`${field.code}`] ? theme.colors.danger5 : theme.colors.border}
|
|
661
|
+
/>
|
|
662
|
+
)}
|
|
663
|
+
name={field.code}
|
|
664
|
+
rules={getInputRules(field)}
|
|
665
|
+
defaultValue=""
|
|
666
|
+
/>
|
|
667
|
+
</React.Fragment>
|
|
668
|
+
))
|
|
669
|
+
}
|
|
670
|
+
)}
|
|
669
671
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
672
|
+
{(!!showInputPhoneNumber && (signUpTab === 'default' || signUpTab === 'otpCellphone')) && (
|
|
673
|
+
<View style={{ marginBottom: 25 }}>
|
|
674
|
+
<PhoneInputNumber
|
|
675
|
+
data={phoneInputData}
|
|
676
|
+
handleData={handleChangePhoneNumber}
|
|
677
|
+
forwardRef={phoneRef}
|
|
678
|
+
changeCountry={(val: any) => setPhoneInputData({
|
|
679
|
+
...phoneInputData,
|
|
680
|
+
phone: {
|
|
681
|
+
...phoneInputData.phone,
|
|
682
|
+
country_code: val.cca2
|
|
683
|
+
}
|
|
684
|
+
})}
|
|
685
|
+
textInputProps={{
|
|
686
|
+
returnKeyType: 'next',
|
|
687
|
+
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
688
|
+
}}
|
|
689
|
+
isStartValidation={errors?.cellphone}
|
|
690
|
+
/>
|
|
691
|
+
</View>
|
|
692
|
+
)}
|
|
691
693
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
694
|
+
{(enableReCaptcha && recaptchaConfig?.version) && (
|
|
695
|
+
<>
|
|
696
|
+
{recaptchaConfig?.version === 'v3' ? (
|
|
697
|
+
<ReCaptcha
|
|
698
|
+
url={recaptchaConfig?.baseUrl}
|
|
699
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
700
|
+
containerStyle={{ height: 40 }}
|
|
701
|
+
onExecute={onRecaptchaVerify}
|
|
702
|
+
reCaptchaType={1}
|
|
703
|
+
/>
|
|
704
|
+
) : (
|
|
705
|
+
<>
|
|
706
|
+
<TouchableOpacity
|
|
707
|
+
onPress={handleOpenRecaptcha}
|
|
708
|
+
style={{ marginHorizontal: 4, marginBottom: 10 }}
|
|
709
|
+
>
|
|
710
|
+
<RecaptchaButton>
|
|
711
|
+
{recaptchaVerified ? (
|
|
712
|
+
<MaterialCommunityIcons
|
|
713
|
+
name="checkbox-marked"
|
|
714
|
+
size={23}
|
|
715
|
+
color={theme.colors.primary}
|
|
716
|
+
/>
|
|
717
|
+
) : (
|
|
718
|
+
<MaterialCommunityIcons
|
|
719
|
+
name="checkbox-blank-outline"
|
|
720
|
+
size={23}
|
|
721
|
+
color={theme.colors.disabled}
|
|
722
|
+
/>
|
|
723
|
+
)}
|
|
724
|
+
<OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
|
|
725
|
+
</RecaptchaButton>
|
|
726
|
+
</TouchableOpacity>
|
|
727
|
+
<Recaptcha
|
|
728
|
+
ref={recaptchaRef}
|
|
729
|
+
siteKey={recaptchaConfig?.siteKey}
|
|
730
|
+
baseUrl={recaptchaConfig?.baseUrl}
|
|
731
|
+
onVerify={onRecaptchaVerify}
|
|
732
|
+
onExpire={() => setRecaptchaVerified(false)}
|
|
733
|
+
/>
|
|
734
|
+
</>
|
|
735
|
+
)}
|
|
734
736
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
737
|
+
</>
|
|
738
|
+
)}
|
|
739
|
+
{(signUpTab === 'default') && (
|
|
740
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
|
|
741
|
+
<Controller
|
|
742
|
+
control={control}
|
|
743
|
+
render={({ onChange, value }: any) => (
|
|
744
|
+
<CheckBox
|
|
745
|
+
value={value}
|
|
746
|
+
onValueChange={newValue => {
|
|
747
|
+
onChange(newValue)
|
|
748
|
+
handleChangePromotions()
|
|
749
|
+
}}
|
|
750
|
+
boxType={'square'}
|
|
751
|
+
tintColors={{
|
|
752
|
+
true: theme.colors.primary,
|
|
753
|
+
false: theme.colors.disabled
|
|
754
|
+
}}
|
|
755
|
+
tintColor={theme.colors.disabled}
|
|
756
|
+
onCheckColor={theme.colors.primary}
|
|
757
|
+
onTintColor={theme.colors.primary}
|
|
758
|
+
style={Platform.OS === 'ios' && style.checkBoxStyle}
|
|
759
|
+
/>
|
|
760
|
+
)}
|
|
761
|
+
name='promotions'
|
|
762
|
+
defaultValue={false}
|
|
763
|
+
/>
|
|
764
|
+
<OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
|
|
765
|
+
</View>
|
|
766
|
+
)}
|
|
767
|
+
{configs?.terms_and_conditions?.value === 'true' && (
|
|
768
|
+
<>
|
|
769
|
+
{errors?.termsAccept && (
|
|
770
|
+
<OText
|
|
771
|
+
size={14}
|
|
772
|
+
color={theme.colors.danger5}
|
|
773
|
+
weight={'normal'}>
|
|
774
|
+
{errors?.termsAccept?.message}*
|
|
775
|
+
</OText>
|
|
776
|
+
)}
|
|
777
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
|
|
778
|
+
<Controller
|
|
779
|
+
control={control}
|
|
780
|
+
render={({ onChange, value }: any) => (
|
|
781
|
+
<CheckBox
|
|
782
|
+
value={value}
|
|
783
|
+
onValueChange={newValue => {
|
|
784
|
+
onChange(newValue)
|
|
785
|
+
}}
|
|
786
|
+
boxType={'square'}
|
|
787
|
+
tintColors={{
|
|
788
|
+
true: theme.colors.primary,
|
|
789
|
+
false: theme.colors.disabled
|
|
790
|
+
}}
|
|
791
|
+
tintColor={theme.colors.disabled}
|
|
792
|
+
onCheckColor={theme.colors.primary}
|
|
793
|
+
onTintColor={theme.colors.primary}
|
|
794
|
+
style={Platform.OS === 'ios' && style.checkBoxStyle}
|
|
795
|
+
/>
|
|
796
|
+
)}
|
|
797
|
+
name='termsAccept'
|
|
798
|
+
rules={{
|
|
799
|
+
required: t('VALIDATION_ERROR_ACCEPTED', 'The _attribute_ must be accepted.').replace('_attribute_', t('TERMS_AND_CONDITIONS', 'Terms & Conditions'))
|
|
800
|
+
}}
|
|
801
|
+
defaultValue={false}
|
|
802
|
+
/>
|
|
803
|
+
<OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('TERMS_AND_CONDITIONS_TEXT', 'I agree with')}</OText>
|
|
804
|
+
<OButton
|
|
805
|
+
imgRightSrc={null}
|
|
806
|
+
text={t('TERMS_AND_CONDITIONS', 'Terms & Conditions')}
|
|
807
|
+
bgColor={theme.colors.white}
|
|
808
|
+
borderColor={theme.colors.white}
|
|
809
|
+
style={{ paddingLeft: 0, paddingRight: 0, height: 30, shadowColor: theme.colors.white }}
|
|
810
|
+
textStyle={{ color: theme.colors.primary, marginLeft: 0, marginRight: 0 }}
|
|
811
|
+
onClick={() => handleOpenTermsUrl(configs?.terms_and_conditions_url?.value)}
|
|
812
|
+
/>
|
|
813
|
+
</View>
|
|
814
|
+
</>
|
|
813
815
|
|
|
814
|
-
|
|
816
|
+
)}
|
|
815
817
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
818
|
+
{signUpTab === 'default' && (
|
|
819
|
+
<>
|
|
820
|
+
{errors?.password && (
|
|
821
|
+
<OText
|
|
822
|
+
size={14}
|
|
823
|
+
color={theme.colors.danger5}
|
|
824
|
+
weight={'normal'}>
|
|
825
|
+
{errors?.password?.message} {errors?.password?.type === 'required' && '*'}
|
|
826
|
+
</OText>
|
|
827
|
+
)}
|
|
828
|
+
<Controller
|
|
829
|
+
control={control}
|
|
830
|
+
render={({ onChange, value }: any) => (
|
|
831
|
+
<OInput
|
|
832
|
+
isSecured={!passwordSee ? true : false}
|
|
833
|
+
placeholder={t('PASSWORD', 'Password')}
|
|
834
|
+
style={style.inputStyle}
|
|
835
|
+
icon={theme.images.general.lock}
|
|
836
|
+
iconCustomRight={
|
|
837
|
+
!passwordSee ? (
|
|
838
|
+
<MaterialCommunityIcons
|
|
839
|
+
name="eye-outline"
|
|
840
|
+
color={theme.colors.disabled}
|
|
841
|
+
size={24}
|
|
842
|
+
onPress={() => setPasswordSee(!passwordSee)}
|
|
843
|
+
/>
|
|
844
|
+
) : (
|
|
845
|
+
<MaterialCommunityIcons
|
|
846
|
+
name="eye-off-outline"
|
|
847
|
+
color={theme.colors.disabled}
|
|
848
|
+
size={24}
|
|
849
|
+
onPress={() => setPasswordSee(!passwordSee)}
|
|
850
|
+
/>
|
|
851
|
+
)
|
|
852
|
+
}
|
|
853
|
+
autoCapitalize='none'
|
|
854
|
+
value={value}
|
|
855
|
+
onChange={(val: any) => onChange(val)}
|
|
856
|
+
returnKeyType="done"
|
|
857
|
+
onSubmitEditing={handleSubmit(onSubmit)}
|
|
858
|
+
blurOnSubmit
|
|
859
|
+
forwardRef={passwordRef}
|
|
860
|
+
borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
|
|
861
|
+
/>
|
|
862
|
+
)}
|
|
863
|
+
name="password"
|
|
864
|
+
rules={{
|
|
865
|
+
required: isRequiredField('password')
|
|
866
|
+
? t(
|
|
867
|
+
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
868
|
+
'The field Password is required',
|
|
869
|
+
).replace('_attribute_', t('PASSWORD', 'password'))
|
|
870
|
+
: null,
|
|
871
|
+
minLength: {
|
|
872
|
+
value: 8,
|
|
873
|
+
message: t(
|
|
874
|
+
'VALIDATION_ERROR_PASSWORD_MIN_STRING',
|
|
875
|
+
'The Password must be at least 8 characters.',
|
|
876
|
+
)
|
|
877
|
+
.replace('_attribute_', t('PASSWORD', 'Password'))
|
|
878
|
+
.replace('_min_', 8),
|
|
879
|
+
},
|
|
880
|
+
}}
|
|
881
|
+
defaultValue=""
|
|
882
|
+
/>
|
|
883
|
+
</>
|
|
882
884
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
885
|
+
)}
|
|
886
|
+
</>
|
|
887
|
+
) : (
|
|
888
|
+
<Spinner visible />
|
|
889
|
+
)}
|
|
888
890
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
891
|
+
{(signUpTab === 'otpCellphone' && useSignUpOtpWhatsapp) ? (
|
|
892
|
+
<View style={{ flexDirection: 'row', gap: 10, marginTop: 6 }}>
|
|
893
|
+
<OButton
|
|
894
|
+
onClick={() => { otpChannelRef.current = 2; handleSubmit(onSubmit)() }}
|
|
895
|
+
text={t('SEND_BY_SMS', 'Send by SMS')}
|
|
896
|
+
imgRightSrc={null}
|
|
897
|
+
isLoading={isLoadingVerifyModal}
|
|
898
|
+
indicatorColor={theme.colors.white}
|
|
899
|
+
parentStyle={{ flex: 1 }}
|
|
900
|
+
style={{ borderRadius: 7.6 }}
|
|
901
|
+
/>
|
|
902
|
+
<OButton
|
|
903
|
+
onClick={() => { otpChannelRef.current = 4; handleSubmit(onSubmit)() }}
|
|
904
|
+
text={t('SEND_BY_WHATSAPP', 'Send by WhatsApp')}
|
|
905
|
+
imgRightSrc={null}
|
|
906
|
+
isLoading={isLoadingVerifyModal}
|
|
907
|
+
indicatorColor={theme.colors.white}
|
|
908
|
+
parentStyle={{ flex: 1 }}
|
|
909
|
+
style={{ borderRadius: 7.6 }}
|
|
910
|
+
/>
|
|
911
|
+
</View>
|
|
912
|
+
) : (signUpTab === 'otpEmail' || signUpTab === 'otpCellphone') ? (
|
|
913
|
+
<OButton
|
|
914
|
+
onClick={handleSubmit(onSubmit)}
|
|
915
|
+
text={t('GET_VERIFY_CODE', 'Get Verify Code')}
|
|
916
|
+
imgRightSrc={null}
|
|
917
|
+
isLoading={isLoadingVerifyModal}
|
|
918
|
+
indicatorColor={theme.colors.white}
|
|
919
|
+
style={{ borderRadius: 7.6, marginTop: 6 }}
|
|
920
|
+
/>
|
|
921
|
+
) : (
|
|
922
|
+
<OButton
|
|
923
|
+
onClick={handleSubmit(onSubmit)}
|
|
924
|
+
text={signupButtonText}
|
|
925
|
+
imgRightSrc={null}
|
|
926
|
+
isDisabled={formState.loading || validationFields.loading}
|
|
927
|
+
style={{ borderRadius: 7.6, marginTop: 6, shadowOpacity: 0 }}
|
|
928
|
+
/>
|
|
929
|
+
)}
|
|
930
|
+
</FormInput>
|
|
908
931
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
932
|
+
{
|
|
933
|
+
onNavigationRedirect && loginButtonText && (
|
|
934
|
+
<View style={style.wrappText}>
|
|
935
|
+
<OText size={14} style={{ marginRight: 5 }}>
|
|
936
|
+
{t('MOBILE_FRONT_ALREADY_HAVE_AN_ACCOUNT', 'Already have an account?')}
|
|
937
|
+
</OText>
|
|
938
|
+
<Pressable onPress={() => onNavigationRedirect('Login')}>
|
|
939
|
+
<OText size={14} color={theme.colors.primary}>
|
|
940
|
+
{loginButtonText}
|
|
941
|
+
</OText>
|
|
942
|
+
</Pressable>
|
|
943
|
+
</View>
|
|
944
|
+
)
|
|
945
|
+
}
|
|
946
|
+
{configs && Object.keys(configs).length > 0 && !isGuest && (
|
|
947
|
+
(((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value && facebookLoginEnabled) ||
|
|
948
|
+
((configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled) ||
|
|
949
|
+
((configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled)) &&
|
|
950
|
+
(
|
|
951
|
+
<>
|
|
952
|
+
<View
|
|
953
|
+
style={{
|
|
954
|
+
flexDirection: 'row',
|
|
955
|
+
width: '100%',
|
|
956
|
+
justifyContent: 'space-between',
|
|
957
|
+
alignItems: 'center',
|
|
958
|
+
marginVertical: 30,
|
|
959
|
+
}}>
|
|
960
|
+
<View style={style.line} />
|
|
961
|
+
<OText
|
|
962
|
+
size={14}
|
|
963
|
+
mBottom={10}
|
|
964
|
+
style={{ paddingHorizontal: 19 }}
|
|
965
|
+
color={theme.colors.disabled}>
|
|
966
|
+
{t('OR', 'or')}
|
|
967
|
+
</OText>
|
|
968
|
+
<View style={style.line} />
|
|
969
|
+
</View>
|
|
970
|
+
<ButtonsWrapper>
|
|
971
|
+
<SocialButtons>
|
|
972
|
+
{(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
|
|
973
|
+
configs?.facebook_id?.value &&
|
|
974
|
+
facebookLoginEnabled &&
|
|
975
|
+
(
|
|
976
|
+
<FacebookLogin
|
|
977
|
+
notificationState={notificationState}
|
|
978
|
+
handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
|
|
979
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
980
|
+
handleSuccessFacebookLogin={handleSuccessFacebook}
|
|
981
|
+
/>
|
|
982
|
+
)}
|
|
983
|
+
{(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
|
|
984
|
+
<GoogleLogin
|
|
985
|
+
notificationState={notificationState}
|
|
986
|
+
webClientId={configs?.google_login_client_id?.value}
|
|
987
|
+
handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
|
|
988
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
989
|
+
handleSuccessGoogleLogin={handleSuccessFacebook}
|
|
990
|
+
/>
|
|
991
|
+
)}
|
|
992
|
+
{(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
|
|
993
|
+
<AppleLogin
|
|
994
|
+
notificationState={notificationState}
|
|
995
|
+
handleErrors={(err: any) => { showToast(ToastType.Error, err), vibrateApp() }}
|
|
996
|
+
handleLoading={(val: boolean) => setIsFBLoading(val)}
|
|
997
|
+
handleSuccessAppleLogin={handleSuccessFacebook}
|
|
998
|
+
/>
|
|
999
|
+
)}
|
|
1000
|
+
</SocialButtons>
|
|
1001
|
+
</ButtonsWrapper>
|
|
1002
|
+
</>
|
|
1003
|
+
)
|
|
1004
|
+
)}
|
|
1005
|
+
</FormSide>
|
|
1006
|
+
<Modal
|
|
1007
|
+
visible={willVerifyOtpState}
|
|
1008
|
+
onDismiss={() => setWillVerifyOtpState && setWillVerifyOtpState(false)}
|
|
1009
|
+
animationType='slide'
|
|
1010
|
+
>
|
|
1011
|
+
<Otp
|
|
1012
|
+
isCheckingCode={isCheckingCode}
|
|
1013
|
+
setCheckingCode={setCheckingCode}
|
|
1014
|
+
otpError={otpError}
|
|
1015
|
+
setOtpError={setOtpError}
|
|
1016
|
+
pinCount={numOtpInputs || 6}
|
|
1017
|
+
willVerifyOtpState={willVerifyOtpState || false}
|
|
1018
|
+
setWillVerifyOtpState={() => setWillVerifyOtpState && setWillVerifyOtpState(false)}
|
|
1019
|
+
handleLoginOtp={handleSingUpOtp}
|
|
1020
|
+
onSubmit={onSubmit}
|
|
1021
|
+
setAlertState={setAlertState}
|
|
1022
|
+
/>
|
|
1023
|
+
</Modal>
|
|
1024
|
+
<Spinner
|
|
1025
|
+
visible={formState.loading || validationFields.loading || isFBLoading}
|
|
1026
|
+
/>
|
|
1027
|
+
<Alert
|
|
1028
|
+
open={alertState.open}
|
|
1029
|
+
content={alertState.content}
|
|
1030
|
+
title={alertState.title || ''}
|
|
1031
|
+
onAccept={closeAlert}
|
|
1032
|
+
onClose={closeAlert}
|
|
1033
|
+
/>
|
|
1034
|
+
</View>
|
|
1035
|
+
);
|
|
1013
1036
|
};
|
|
1014
1037
|
|
|
1015
1038
|
export const SignupForm = (props: any) => {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1039
|
+
const _numOtpInputs = 6
|
|
1040
|
+
const signupProps = {
|
|
1041
|
+
...props,
|
|
1042
|
+
numOtpInputs: _numOtpInputs,
|
|
1043
|
+
isRecaptchaEnable: true,
|
|
1044
|
+
UIComponent: SignupFormUI,
|
|
1045
|
+
};
|
|
1046
|
+
return <SignUpController {...signupProps} />;
|
|
1024
1047
|
};
|