diff --git a/.vscode/settings.json b/.vscode/settings.json index 0f680690..bc313803 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,5 @@ "[javascript]": { "editor.defaultFormatter": "vscode.typescript-language-features" }, - "editor.tabSize": 2 + "editor.tabSize": 4, } diff --git a/components/atoms/Card/Provider/index.js b/components/atoms/Card/Provider/index.js index 6725b71f..0602351c 100644 --- a/components/atoms/Card/Provider/index.js +++ b/components/atoms/Card/Provider/index.js @@ -16,10 +16,11 @@ const CardProvider = ({ {/* Provider */}
- {name
diff --git a/components/atoms/Stepper/Forms/identity2.js b/components/atoms/Stepper/Forms/identity2.js index 0d168254..21d4b7c3 100644 --- a/components/atoms/Stepper/Forms/identity2.js +++ b/components/atoms/Stepper/Forms/identity2.js @@ -166,6 +166,20 @@ function Identity2() { homeAddress: item.homeAddress, }), ); + + localStorage.setItem('dispatchBuyVoucher', JSON.stringify( + { + ...client.patient, + id: item.id, + country: item.country, + firstName: item.firstName, + lastName: item.lastName, + email: item.email, + phoneNumber: item.phoneNumber, + city: item.city, + homeAddress: item.homeAddress, + } + )) setActiveStepIndex(activeStepIndex + 1); }; @@ -284,7 +298,7 @@ function Identity2() {
@@ -412,8 +426,8 @@ function Identity2() { diff --git a/components/atoms/Stepper/Forms/kyc.js b/components/atoms/Stepper/Forms/kyc.js index f2d05244..18270380 100644 --- a/components/atoms/Stepper/Forms/kyc.js +++ b/components/atoms/Stepper/Forms/kyc.js @@ -81,7 +81,12 @@ function KYC() { const response = await fetch(`https://api.bigdatacloud.net/data/reverse-geocode-client?latitude=${latitude}&longitude=${longitude}&localityLanguage=fr`); const data = await response.json(); - if (data.continent != "Afrique") { + console.log(data.continent); + + if (/Afrique/i.test(data.continent)) { + setKycTest(false) + + } else { checkKyc({ accessToken: session.accessToken }).then((data) => { if (data) { setKycTest(false) @@ -89,8 +94,6 @@ function KYC() { conversation() } }).catch((error) => conversation()) - } else { - setKycTest(false) } } catch (error) { checkKyc({ accessToken: session.accessToken }).then((data) => { @@ -123,6 +126,21 @@ function KYC() { }, []); + const rerunCheck = () => { + fetch('/api/authologic', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + path: router.asPath + '?step=1', + }), + }) + .then((res) => res.json()) + .then((data) => { + router.push(data.url); + }) + .catch((e) => console.log(e)); + } + return (
{!router.query.conversation ? ( @@ -142,6 +160,12 @@ function KYC() {
Mismatch {resultKYC?.identity?.errors.toString()} +
) : '' } diff --git a/components/atoms/Stepper/Forms/payment2.js b/components/atoms/Stepper/Forms/payment2.js index bfa7b58d..846dca05 100644 --- a/components/atoms/Stepper/Forms/payment2.js +++ b/components/atoms/Stepper/Forms/payment2.js @@ -269,9 +269,9 @@ function Amount({ ); const [currencyPatientName, setCurrencyPatientName] = useState( patient.countryLabel ?? - new Intl.DisplayNames(['en'], { type: 'region' }).of( - patient?.country?.toUpperCase(), - ), + new Intl.DisplayNames(['en'], { type: 'region' }).of( + patient?.country?.toUpperCase(), + ), ); const [currencySender, setCurrencySender] = useState('EUR'); @@ -380,9 +380,8 @@ function Amount({ Pays:{' '} cd diff --git a/components/atoms/Stepper/Forms/send.js b/components/atoms/Stepper/Forms/send.js index 2345b72e..d2728008 100644 --- a/components/atoms/Stepper/Forms/send.js +++ b/components/atoms/Stepper/Forms/send.js @@ -227,13 +227,13 @@ function Send() { currency: data.currency, }).format(data.amount)} {' '} - Health Pass WiiQare
From{' '} + Pass santé WiiQare
de{' '} - {data.sender.firstName} + {data?.sender?.firstName ?? '' + ' ' + data?.sender?.lastName ?? ''} {' '} - To{' '} + à{' '} - {data.patient.firstName} + {data?.patient?.firstName ?? '' + ' ' + data?.patient?.lastName ?? ''}
diff --git a/components/atoms/Tab/ItemHistory.js b/components/atoms/Tab/ItemHistory.js index 6eb165f7..fbbf171e 100644 --- a/components/atoms/Tab/ItemHistory.js +++ b/components/atoms/Tab/ItemHistory.js @@ -313,11 +313,11 @@ const ItemHistory = ({
de{' '} - {sender.firstName} + {sender?.firstName ?? '' + ' ' + sender?.lastName ?? ''} {' '} à{' '} - - {patient?.firstName ?? ''} + + {patient?.firstName ?? '' + ' ' + patient?.lastName ?? ''}
diff --git a/components/organisms/Auth/Forms/__snapshots__/information.test.js.snap b/components/organisms/Auth/Forms/__snapshots__/information.test.js.snap index 4c661005..6c6bf10b 100644 --- a/components/organisms/Auth/Forms/__snapshots__/information.test.js.snap +++ b/components/organisms/Auth/Forms/__snapshots__/information.test.js.snap @@ -242,6 +242,25 @@ exports[`Information renders 1`] = `
+
state.app.client); const router = useRouter(); const dispatch = useDispatch(); @@ -59,9 +62,19 @@ function Information() { const onSubmit = async (values) => { if (Object.keys(values).length == 0) return console.log('Pas de données'); //dispatch(setRegsiter({...values})) + // const passwordStrength = zxcvbn(values.password); - let { confirm_password, ...info } = values; - newAccountMutation.mutate({ ...info, ...client.register }); + // Utilisez les résultats pour fournir des retours à l'utilisateur + // console.log('Score de robustesse du mot de passe :', passwordStrength.score); + // console.log('Suggestions :', passwordStrength.feedback.suggestions); + + if (strength > 50) { + + let { confirm_password, ...info } = values; + newAccountMutation.mutate({ ...info, ...client.register }); + } else { + formik.setErrors({ password: 'Renforcez votre mot de passe' }) + } }; const closeToast = () => { @@ -95,12 +108,36 @@ function Information() { onSubmit, }); + const handlePasswordChange = (event) => { + const newPassword = event.target.value; + setPassword(newPassword); + formik.handleChange(event); + + const passwordStrength = zxcvbn(newPassword); + // Le score va de 0 (faible) à 4 (fort) + const strengthPercentage = (passwordStrength.score + 1) * 25; + console.log(strengthPercentage); + setStrength(strengthPercentage); + }; + const renderError = (message) => (

{message}

); + const getStrengthColor = (strength) => { + if (strength <= 25) { + return 'red'; + } else if (strength <= 50) { + return 'orange'; + } else if (strength <= 75) { + return 'green'; + } else { + return 'green'; + } + }; + return ( <> {state.type > 0 ? ( @@ -185,6 +222,7 @@ function Information() { type={showPassword ? 'text' : 'password'} name="password" {...formik.getFieldProps('password')} + onChange={handlePasswordChange} endAdornment={ )} +
+
+
+
+ Mot de passe {strength <= 25 ? 'faible' : strength <= 50 ? 'moyen' : 'fort'} +
diff --git a/components/organisms/Auth/__snapshots__/StepRegistration.test.js.snap b/components/organisms/Auth/__snapshots__/StepRegistration.test.js.snap index ad03f00b..0d7dc1da 100644 --- a/components/organisms/Auth/__snapshots__/StepRegistration.test.js.snap +++ b/components/organisms/Auth/__snapshots__/StepRegistration.test.js.snap @@ -318,6 +318,25 @@ exports[`StepRegistration should render information if activeStep=2: information
+