contentoh-components-library 21.0.70 → 21.0.73
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/.env.development +20 -5
- package/.env.production +18 -3
- package/CHANGELOG.md +31 -33
- package/dist/assets/images/generalButton/downloadIcon.svg +3 -0
- package/dist/assets/images/genericModal/closeWhite.svg +3 -0
- package/dist/assets/images/genericModal/errorModal.svg +3 -0
- package/dist/assets/images/genericModal/yellowAlert.svg +12 -0
- package/dist/assets/images/modalsSVGs/attributesSent.svg +208 -0
- package/dist/assets/images/modalsSVGs/descriptionSent.svg +237 -0
- package/dist/assets/images/modalsSVGs/providerSent.svg +445 -0
- package/dist/assets/images/modalsSVGs/uploadingImages.svg +148 -0
- package/dist/components/atoms/AsignationOption/index.js +9 -5
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/{molecules/SignInLogin/SignInLogin.stories.js → atoms/CharCounter/CharCounter.stories.js} +10 -7
- package/dist/components/atoms/CharCounter/index.js +22 -0
- package/dist/components/{molecules/LogoLoading → atoms/CharCounter}/styles.js +3 -1
- package/dist/components/atoms/CheckBox/index.js +4 -2
- package/dist/components/atoms/Commentary/Commentary.stories.js +1 -0
- package/dist/components/atoms/Commentary/index.js +23 -0
- package/dist/components/{organisms/ChangePassword → atoms/Commentary}/styles.js +6 -1
- package/dist/components/atoms/GeneralButton/index.js +5 -0
- package/dist/components/atoms/GeneralButton/styles.js +4 -2
- package/dist/components/atoms/GeneralInput/index.js +72 -25
- package/dist/components/atoms/GeneralInput/styles.js +7 -1
- package/dist/components/atoms/GenericModal/index.js +4 -2
- package/dist/components/atoms/GenericModal/styles.js +1 -1
- package/dist/components/atoms/GradientPanel/styles.js +1 -1
- package/dist/components/atoms/Input/index.js +26 -0
- package/dist/components/atoms/Input/style.js +26 -0
- package/dist/components/{organisms/ChangePassword/ChangePassword.stories.js → atoms/InputFormatter/Wysiwyg.stories.js} +9 -7
- package/dist/components/atoms/InputFormatter/index.js +184 -0
- package/dist/components/atoms/InputFormatter/styles.js +33 -0
- package/dist/components/atoms/LabelToInput/index.js +53 -0
- package/dist/components/atoms/LabelToInput/style.js +22 -0
- package/dist/components/atoms/Loading/index.js +0 -1
- package/dist/components/atoms/LogoImage/index.js +0 -1
- package/dist/components/atoms/Percent/Percent.stories.js +39 -0
- package/dist/components/atoms/Percent/index.js +39 -0
- package/dist/components/atoms/Percent/styles.js +20 -0
- package/dist/components/atoms/PriorityFlag/index.js +1 -1
- package/dist/components/atoms/ProductImage/styles.js +1 -1
- package/dist/components/atoms/ProgressBar/index.js +2 -2
- package/dist/components/atoms/ProgressBar/styles.js +3 -5
- package/dist/components/atoms/ScreenHeader/index.js +1 -1
- package/dist/components/atoms/ScreenHeader/styles.js +1 -1
- package/dist/components/atoms/Select/index.js +39 -0
- package/dist/components/atoms/Select/style.js +32 -0
- package/dist/components/atoms/StatusTag/index.js +37 -2
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/atoms/ValidationPanel/index.js +5 -3
- package/dist/components/molecules/AvatarAndValidation/index.js +17 -7
- package/dist/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +42 -40
- package/dist/components/molecules/FeaturesBar/index.js +1 -1
- package/dist/components/molecules/GalleryElement/index.js +80 -21
- package/dist/components/molecules/GalleryElement/styles.js +1 -1
- package/dist/components/molecules/GalleryHeader/index.js +28 -6
- package/dist/components/molecules/GalleryHeader/styles.js +1 -1
- package/dist/components/molecules/ImageSelector/index.js +2 -4
- package/dist/components/molecules/LoginPasswordStrength/index.js +6 -6
- package/dist/components/molecules/LoginPasswordStrength/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +1 -2
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +48 -0
- package/dist/components/molecules/RetailerSelector/index.js +74 -0
- package/dist/components/{atoms/MenuCommercialRetailers → molecules/RetailerSelector}/styles.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +46 -28
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +12 -5
- package/dist/components/molecules/TableHeader/styles.js +1 -1
- package/dist/components/molecules/TagAndInput/index.js +24 -2
- package/dist/components/molecules/TextAndGradient/TextAndGradient.stories.js +31 -0
- package/dist/components/molecules/TextAndGradient/index.js +36 -0
- package/dist/components/molecules/TextAndGradient/styles.js +18 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +31 -9
- package/dist/components/organisms/FullTabsMenu/index.js +18 -5
- package/dist/components/organisms/GlobalModal/index.js +73 -0
- package/dist/components/organisms/GlobalModal/styles.js +66 -0
- package/dist/components/organisms/ImageDataTable/index.js +90 -14
- package/dist/components/organisms/InputGroup/index.js +34 -13
- package/dist/components/organisms/InputGroup/styles.js +1 -1
- package/dist/components/organisms/ProductImageModal/index.js +13 -10
- package/dist/components/organisms/ProductImageModal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +135 -0
- package/dist/components/pages/ProviderProductEdition/index.js +1979 -0
- package/dist/components/pages/ProviderProductEdition/styles.js +23 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +91 -347
- package/dist/components/pages/RetailerProductEdition/index.js +1610 -60
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +213 -53
- package/dist/global-files/global-styles.css +1 -0
- package/dist/global-files/variables.js +1 -0
- package/dist/index.js +30 -277
- package/package.json +17 -18
- package/src/assets/images/generalButton/downloadIcon.svg +3 -0
- package/src/assets/images/genericModal/closeWhite.svg +3 -0
- package/src/assets/images/genericModal/errorModal.svg +3 -0
- package/src/assets/images/genericModal/yellowAlert.svg +12 -0
- package/src/assets/images/modalsSVGs/attributesSent.svg +208 -0
- package/src/assets/images/modalsSVGs/descriptionSent.svg +237 -0
- package/src/assets/images/modalsSVGs/providerSent.svg +445 -0
- package/src/assets/images/modalsSVGs/uploadingImages.svg +148 -0
- package/src/components/atoms/AsignationOption/index.js +7 -5
- package/src/components/atoms/AsignationOption/styles.js +9 -1
- package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
- package/src/components/atoms/CharCounter/index.js +13 -0
- package/src/components/atoms/CharCounter/styles.js +10 -0
- package/src/components/atoms/CheckBox/index.js +8 -2
- package/src/components/atoms/Commentary/Commentary.stories.js +0 -0
- package/src/components/atoms/Commentary/index.js +9 -0
- package/src/components/atoms/Commentary/styles.js +16 -0
- package/src/components/atoms/GeneralButton/index.js +9 -2
- package/src/components/atoms/GeneralButton/styles.js +23 -0
- package/src/components/atoms/GeneralInput/index.js +71 -23
- package/src/components/atoms/GeneralInput/styles.js +11 -1
- package/src/components/atoms/GenericModal/index.js +2 -2
- package/src/components/atoms/GenericModal/styles.js +10 -2
- package/src/components/atoms/GradientPanel/styles.js +0 -1
- package/src/components/atoms/Input/index.js +15 -0
- package/src/components/atoms/Input/style.js +31 -0
- package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatter/index.js +144 -0
- package/src/components/atoms/InputFormatter/styles.js +40 -0
- package/src/components/atoms/LabelToInput/index.js +26 -0
- package/src/components/atoms/LabelToInput/style.js +41 -0
- package/src/components/atoms/Loading/index.js +2 -3
- package/src/components/atoms/LogoImage/index.js +1 -1
- package/src/components/atoms/PriorityFlag/index.js +1 -1
- package/src/components/atoms/ProductImage/styles.js +1 -1
- package/src/components/atoms/ProgressBar/index.js +2 -2
- package/src/components/atoms/ProgressBar/styles.js +54 -3
- package/src/components/atoms/ScreenHeader/index.js +7 -3
- package/src/components/atoms/ScreenHeader/styles.js +9 -2
- package/src/components/atoms/Select/index.js +35 -0
- package/src/components/atoms/Select/style.js +76 -0
- package/src/components/atoms/StatusTag/index.js +30 -2
- package/src/components/atoms/StatusTag/styles.js +15 -3
- package/src/components/atoms/ValidationPanel/index.js +4 -3
- package/src/components/molecules/AvatarAndValidation/index.js +23 -6
- package/src/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +37 -34
- package/src/components/molecules/FeaturesBar/index.js +10 -7
- package/src/components/molecules/GalleryElement/index.js +75 -36
- package/src/components/molecules/GalleryElement/styles.js +38 -11
- package/src/components/molecules/GalleryHeader/index.js +14 -8
- package/src/components/molecules/GalleryHeader/styles.js +16 -0
- package/src/components/molecules/ImageSelector/index.js +2 -3
- package/src/components/molecules/LoginPasswordStrength/index.js +3 -8
- package/src/components/molecules/LoginPasswordStrength/styles.js +0 -3
- package/src/components/molecules/ProductNameHeader/index.js +1 -2
- package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +35 -0
- package/src/components/molecules/RetailerSelector/index.js +63 -0
- package/src/components/molecules/RetailerSelector/styles.js +18 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +64 -39
- package/src/components/molecules/StatusAsignationInfo/styles.js +12 -2
- package/src/components/molecules/TableHeader/index.js +16 -3
- package/src/components/molecules/TableHeader/styles.js +5 -0
- package/src/components/molecules/TagAndInput/index.js +24 -2
- package/src/components/organisms/FullProductNameHeader/index.js +38 -8
- package/src/components/organisms/FullTabsMenu/index.js +15 -3
- package/src/components/organisms/GlobalModal/index.js +68 -0
- package/src/components/organisms/GlobalModal/styles.js +113 -0
- package/src/components/organisms/ImageDataTable/index.js +89 -11
- package/src/components/organisms/InputGroup/index.js +46 -11
- package/src/components/organisms/InputGroup/styles.js +3 -0
- package/src/components/organisms/ProductImageModal/index.js +19 -12
- package/src/components/organisms/ProductImageModal/styles.js +3 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +123 -0
- package/src/components/pages/ProviderProductEdition/index.js +1493 -0
- package/src/components/pages/ProviderProductEdition/styles.js +118 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +91 -343
- package/src/components/pages/RetailerProductEdition/index.js +1245 -48
- package/src/components/pages/RetailerProductEdition/styles.js +67 -4
- package/src/global-files/data.js +158 -57
- package/src/global-files/global-styles.css +1 -0
- package/src/global-files/variables.js +1 -0
- package/src/index.js +1 -20
- package/dist/assets/images/editField/showPassword.png +0 -0
- package/dist/assets/images/sliderToolTip/infoIcon.svg +0 -4
- package/dist/assets/images/sliderToolTip/slide1.svg +0 -5
- package/dist/assets/images/sliderToolTip/slide2.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide3.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide4.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide5.svg +0 -40
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
- package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
- package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/Loading/Loading.stories.js +0 -28
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
- package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
- package/dist/components/atoms/MenuProductImage/index.js +0 -88
- package/dist/components/atoms/MenuProductImage/styles.js +0 -20
- package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +0 -47
- package/dist/components/atoms/SliderToolTip/index.js +0 -200
- package/dist/components/atoms/SliderToolTip/styles.js +0 -24
- package/dist/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +0 -22
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +0 -49
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +0 -18
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
- package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
- package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
- package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +0 -28
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +0 -153
- package/dist/components/molecules/EmailResetPasswordLogin/styles.js +0 -20
- package/dist/components/molecules/LogoLoading/Loading.stories.js +0 -28
- package/dist/components/molecules/LogoLoading/index.js +0 -22
- package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +0 -28
- package/dist/components/molecules/RegistrationFirstStep/index.js +0 -308
- package/dist/components/molecules/RegistrationFirstStep/styles.js +0 -20
- package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +0 -28
- package/dist/components/molecules/RegistrationSecondStep/index.js +0 -169
- package/dist/components/molecules/RegistrationSecondStep/styles.js +0 -20
- package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +0 -28
- package/dist/components/molecules/RegistrationThirdStep/index.js +0 -155
- package/dist/components/molecules/RegistrationThirdStep/styles.js +0 -20
- package/dist/components/molecules/SignInLogin/index.js +0 -321
- package/dist/components/molecules/SignInLogin/styles.js +0 -20
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
- package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +0 -28
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +0 -210
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +0 -20
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +0 -69
- package/dist/components/organisms/ChangePassword/index.js +0 -123
- package/src/assets/images/editField/showPassword.png +0 -0
- package/src/assets/images/sliderToolTip/infoIcon.svg +0 -4
- package/src/assets/images/sliderToolTip/slide1.svg +0 -5
- package/src/assets/images/sliderToolTip/slide2.svg +0 -9
- package/src/assets/images/sliderToolTip/slide3.svg +0 -9
- package/src/assets/images/sliderToolTip/slide4.svg +0 -9
- package/src/assets/images/sliderToolTip/slide5.svg +0 -40
- package/src/components/atoms/Loading/Loading.stories.js +0 -10
- package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +0 -23
- package/src/components/atoms/SliderToolTip/index.js +0 -182
- package/src/components/atoms/SliderToolTip/styles.js +0 -168
- package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +0 -11
- package/src/components/molecules/EmailResetPasswordLogin/index.js +0 -85
- package/src/components/molecules/EmailResetPasswordLogin/styles.js +0 -23
- package/src/components/molecules/LogoLoading/Loading.stories.js +0 -10
- package/src/components/molecules/LogoLoading/index.js +0 -12
- package/src/components/molecules/LogoLoading/styles.js +0 -16
- package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +0 -11
- package/src/components/molecules/RegistrationFirstStep/index.js +0 -227
- package/src/components/molecules/RegistrationFirstStep/styles.js +0 -87
- package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +0 -11
- package/src/components/molecules/RegistrationSecondStep/index.js +0 -130
- package/src/components/molecules/RegistrationSecondStep/styles.js +0 -59
- package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +0 -11
- package/src/components/molecules/RegistrationThirdStep/index.js +0 -130
- package/src/components/molecules/RegistrationThirdStep/styles.js +0 -44
- package/src/components/molecules/SignInLogin/SignInLogin.stories.js +0 -11
- package/src/components/molecules/SignInLogin/index.js +0 -226
- package/src/components/molecules/SignInLogin/styles.js +0 -120
- package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +0 -11
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +0 -170
- package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +0 -51
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +0 -54
- package/src/components/organisms/ChangePassword/ChangePassword.stories.js +0 -11
- package/src/components/organisms/ChangePassword/index.js +0 -76
- package/src/components/organisms/ChangePassword/styles.js +0 -13
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
width: 50%;
|
|
7
|
-
height: 100%;
|
|
8
|
-
.user {
|
|
9
|
-
.input-name-header {
|
|
10
|
-
margin-top: 10px;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
.button-end {
|
|
14
|
-
text-align: end;
|
|
15
|
-
.general-default-button {
|
|
16
|
-
width: 160px;
|
|
17
|
-
}
|
|
18
|
-
& + * {
|
|
19
|
-
margin-top: 10px;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
.progress-bar {
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 8px;
|
|
25
|
-
display: flex;
|
|
26
|
-
justify-content: space-between;
|
|
27
|
-
.progress-bar-step-check {
|
|
28
|
-
width: 66.66%;
|
|
29
|
-
background-color: ${GlobalColors.exported};
|
|
30
|
-
}
|
|
31
|
-
.progress-bar-registration {
|
|
32
|
-
background-color: rgb(196, 196, 196);
|
|
33
|
-
width: 33.33%;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
.date-header {
|
|
37
|
-
margin-left: 66.66%;
|
|
38
|
-
.new-login {
|
|
39
|
-
& + * {
|
|
40
|
-
margin-top: 20px;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SignInLogin } from "./index";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/molecules/SignInLogin",
|
|
5
|
-
component: SignInLogin,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args) => <SignInLogin {...args} />;
|
|
9
|
-
|
|
10
|
-
export const SignInLoginDefault = Template.bind({});
|
|
11
|
-
SignInLoginDefault.args = {};
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import { LogoImage } from "../../atoms/LogoImage/index";
|
|
3
|
-
import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
4
|
-
import { Button } from "../../atoms/GeneralButton/index";
|
|
5
|
-
import { CheckBox } from "../../atoms/CheckBox/index";
|
|
6
|
-
import { TagAndInput } from "../TagAndInput";
|
|
7
|
-
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
8
|
-
import { useState, useEffect } from "react";
|
|
9
|
-
import { LogoLoading } from "../LogoLoading";
|
|
10
|
-
import { Redirect } from "react-router-dom";
|
|
11
|
-
import showPassword from "../../../assets/images/editField/showPassword.png";
|
|
12
|
-
import axios from "axios";
|
|
13
|
-
|
|
14
|
-
export const SignInLogin = (props) => {
|
|
15
|
-
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
16
|
-
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
17
|
-
const [emptyPassword, setEmptyPassword] = useState(false);
|
|
18
|
-
const [showErrors, setShowErrors] = useState(true);
|
|
19
|
-
const [signInError, setSignInError] = useState("");
|
|
20
|
-
const [loading, setLoading] = useState(false);
|
|
21
|
-
const [upgradePlanRedirect, setUpgradePlanRedirect] = useState(false);
|
|
22
|
-
|
|
23
|
-
const validate = async (e) => {
|
|
24
|
-
setSignInError("");
|
|
25
|
-
setShowErrors(true);
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
let valid = true;
|
|
28
|
-
const email = document.querySelector("#emailInput").value.trim();
|
|
29
|
-
const password = document.querySelector("#passwordInput").value;
|
|
30
|
-
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
31
|
-
email
|
|
32
|
-
)
|
|
33
|
-
? setInvalidEmail(true)
|
|
34
|
-
: setInvalidEmail(false);
|
|
35
|
-
if (email === "") {
|
|
36
|
-
valid = false;
|
|
37
|
-
setEmptyEmail(true);
|
|
38
|
-
} else {
|
|
39
|
-
setEmptyEmail(false);
|
|
40
|
-
}
|
|
41
|
-
if (password === "") {
|
|
42
|
-
valid = false;
|
|
43
|
-
setEmptyPassword(true);
|
|
44
|
-
} else {
|
|
45
|
-
setEmptyPassword(false);
|
|
46
|
-
}
|
|
47
|
-
if (valid) {
|
|
48
|
-
try {
|
|
49
|
-
setLoading(true);
|
|
50
|
-
const session = await props.Auth.signIn(email, password);
|
|
51
|
-
if (session.challengeName === "NEW_PASSWORD_REQUIRED") {
|
|
52
|
-
props.setUser(session);
|
|
53
|
-
props.setPaso(8);
|
|
54
|
-
} else {
|
|
55
|
-
const userGroup =
|
|
56
|
-
session.signInUserSession.accessToken.payload["cognito:groups"];
|
|
57
|
-
const response = await axios.get(
|
|
58
|
-
process.env.REACT_APP_USER_ENDPOINT,
|
|
59
|
-
{
|
|
60
|
-
headers: {
|
|
61
|
-
Authorization: session.signInUserSession.idToken.jwtToken,
|
|
62
|
-
},
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
if (userGroup[0] === props.users) {
|
|
66
|
-
sessionStorage.setItem("auth", true);
|
|
67
|
-
sessionStorage.setItem(
|
|
68
|
-
"jwt",
|
|
69
|
-
session.signInUserSession.idToken.jwtToken
|
|
70
|
-
);
|
|
71
|
-
const user = JSON.parse(response.data.body).data[0];
|
|
72
|
-
const company = JSON.parse(response.data.body).data[1];
|
|
73
|
-
caches.keys().then((names) => {
|
|
74
|
-
names.forEach((name) => {
|
|
75
|
-
caches.delete(name);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
user.src = `https://${
|
|
79
|
-
process.env.REACT_APP_IMAGES_PROFILE_BUCKET
|
|
80
|
-
}.s3.amazonaws.com/id-${user.id_user}/${
|
|
81
|
-
user.id_user
|
|
82
|
-
}.png?${new Date().getTime()}`;
|
|
83
|
-
sessionStorage.setItem("user", JSON.stringify(user));
|
|
84
|
-
sessionStorage.setItem("company", JSON.stringify(company));
|
|
85
|
-
setUpgradePlanRedirect(true);
|
|
86
|
-
} else {
|
|
87
|
-
setSignInError("NotAuthorizedException");
|
|
88
|
-
setLoading(false);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
} catch (error) {
|
|
92
|
-
console.log(error.code);
|
|
93
|
-
setLoading(false);
|
|
94
|
-
if (error.code === "NotAuthorizedException") {
|
|
95
|
-
setSignInError("NotAuthorizedException");
|
|
96
|
-
} else if (error.code === "UserNotConfirmedException") {
|
|
97
|
-
sessionStorage.setItem("email", JSON.stringify(email));
|
|
98
|
-
props.setPaso(5);
|
|
99
|
-
} else {
|
|
100
|
-
setSignInError("Error");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
sessionStorage.getItem("resetPasswordProcess") &&
|
|
108
|
-
sessionStorage.removeItem("resetPasswordProcess");
|
|
109
|
-
}, []);
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (upgradePlanRedirect) setLoading(false);
|
|
112
|
-
}, [upgradePlanRedirect]);
|
|
113
|
-
|
|
114
|
-
const closeEye = (e) => {
|
|
115
|
-
const input = document.getElementById("passwordInput");
|
|
116
|
-
const eye = document.getElementById("Eye");
|
|
117
|
-
if (input.type === "password") {
|
|
118
|
-
input.type = "text";
|
|
119
|
-
eye.style.opacity = 0.8;
|
|
120
|
-
} else {
|
|
121
|
-
input.type = "password";
|
|
122
|
-
eye.style.opacity = 0.2;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return loading ? (
|
|
127
|
-
<LogoLoading />
|
|
128
|
-
) : (
|
|
129
|
-
<>
|
|
130
|
-
<Container className={"home-login"}>
|
|
131
|
-
<div className="main-container">
|
|
132
|
-
<LogoImage />
|
|
133
|
-
<div className="credenciales">
|
|
134
|
-
<ScreenHeader
|
|
135
|
-
fontFamily={FontFamily.AvenirNext}
|
|
136
|
-
color={GlobalColors.s5}
|
|
137
|
-
text={"Ingresa tus credenciales"}
|
|
138
|
-
/>
|
|
139
|
-
</div>
|
|
140
|
-
<div className="user">
|
|
141
|
-
<TagAndInput
|
|
142
|
-
inputType={"text"}
|
|
143
|
-
label={"Nombre de usuario"}
|
|
144
|
-
inputPlaceHolder={"username@contentoh.com"}
|
|
145
|
-
inputId={"emailInput"}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
{showErrors && emptyEmail && <label>Ingrese su correo</label>}
|
|
149
|
-
{invalidEmail && !emptyEmail && (
|
|
150
|
-
<label>Ingrese un correo válido</label>
|
|
151
|
-
)}
|
|
152
|
-
<div className="password">
|
|
153
|
-
<TagAndInput
|
|
154
|
-
inputType={"password"}
|
|
155
|
-
label={"Contraseña"}
|
|
156
|
-
inputPlaceHolder={"Escribe tu contraseña"}
|
|
157
|
-
inputId={"passwordInput"}
|
|
158
|
-
/>
|
|
159
|
-
<img
|
|
160
|
-
src={showPassword}
|
|
161
|
-
alt="show password"
|
|
162
|
-
className="icon"
|
|
163
|
-
id="Eye"
|
|
164
|
-
onClick={(e) => {
|
|
165
|
-
closeEye(e);
|
|
166
|
-
}}
|
|
167
|
-
></img>
|
|
168
|
-
</div>
|
|
169
|
-
{showErrors && emptyPassword && <label>Ingrese su contraseña</label>}
|
|
170
|
-
<div className="select">
|
|
171
|
-
<CheckBox
|
|
172
|
-
label={"Mantener sesión activada"}
|
|
173
|
-
id={"chk-default"}
|
|
174
|
-
className="active-left"
|
|
175
|
-
/>
|
|
176
|
-
<p onClick={() => props.setPaso(10)} className="active-right">
|
|
177
|
-
Olvide mi contraseña
|
|
178
|
-
</p>
|
|
179
|
-
</div>
|
|
180
|
-
{showErrors && signInError === "NotAuthorizedException" && (
|
|
181
|
-
<label>Correo o contraseña incorrectos</label>
|
|
182
|
-
)}
|
|
183
|
-
{showErrors && signInError === "Error" && (
|
|
184
|
-
<label>Ha habido un problema al iniciar sesión</label>
|
|
185
|
-
)}
|
|
186
|
-
<div className="button-right">
|
|
187
|
-
<Button
|
|
188
|
-
buttonType={"general-default-button"}
|
|
189
|
-
label={"Iniciar sesión"}
|
|
190
|
-
onClick={(e) => validate(e)}
|
|
191
|
-
/>
|
|
192
|
-
</div>
|
|
193
|
-
{props.registration && (
|
|
194
|
-
<div className="new-login">
|
|
195
|
-
<p
|
|
196
|
-
className="pre-registro"
|
|
197
|
-
onClick={() => {
|
|
198
|
-
props.setPaso(1);
|
|
199
|
-
sessionStorage.setItem(
|
|
200
|
-
"nuevoRegistro",
|
|
201
|
-
JSON.stringify({
|
|
202
|
-
name: "",
|
|
203
|
-
lastName: "",
|
|
204
|
-
email: "",
|
|
205
|
-
position: "",
|
|
206
|
-
country: "",
|
|
207
|
-
phone: "",
|
|
208
|
-
commercialName: "",
|
|
209
|
-
companyName: "",
|
|
210
|
-
rfc: "",
|
|
211
|
-
adress: "",
|
|
212
|
-
})
|
|
213
|
-
);
|
|
214
|
-
sessionStorage.setItem("countryCode", JSON.stringify("+52"));
|
|
215
|
-
}}
|
|
216
|
-
>
|
|
217
|
-
¿Aún no tienes cuenta?<span> Regístrate</span>
|
|
218
|
-
</p>
|
|
219
|
-
</div>
|
|
220
|
-
)}
|
|
221
|
-
</div>
|
|
222
|
-
</Container>
|
|
223
|
-
{upgradePlanRedirect && <Redirect to={{ pathname: "/dashboard" }} />}
|
|
224
|
-
</>
|
|
225
|
-
);
|
|
226
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
background: "white";
|
|
6
|
-
display: flex;
|
|
7
|
-
height: 100vh;
|
|
8
|
-
width: 50%;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
align-items: center;
|
|
11
|
-
label {
|
|
12
|
-
color: red;
|
|
13
|
-
margin-top: 3px;
|
|
14
|
-
margin-left: 15px;
|
|
15
|
-
font-family: ${FontFamily.Raleway_700};
|
|
16
|
-
font-size: 11px;
|
|
17
|
-
& + * {
|
|
18
|
-
margin-top: 12px;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.home-login {
|
|
23
|
-
.credenciales {
|
|
24
|
-
& + * {
|
|
25
|
-
margin-top: 30px;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
.user {
|
|
29
|
-
& + * {
|
|
30
|
-
margin-top: 45px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
.password {
|
|
34
|
-
& + * {
|
|
35
|
-
margin-top: 20px;
|
|
36
|
-
}
|
|
37
|
-
&:hover {
|
|
38
|
-
border: 1px solid ${GlobalColors.magenta_s2};
|
|
39
|
-
}
|
|
40
|
-
display: flex;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
align-items: center;
|
|
43
|
-
height: 40px;
|
|
44
|
-
position: relative;
|
|
45
|
-
width: 100%;
|
|
46
|
-
border: 1px solid ${GlobalColors.s2};
|
|
47
|
-
.input-container {
|
|
48
|
-
h2 {
|
|
49
|
-
position: absolute;
|
|
50
|
-
top: -25px;
|
|
51
|
-
left: 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
#passwordInput {
|
|
55
|
-
width: 100%;
|
|
56
|
-
background-color: white;
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: 8px;
|
|
59
|
-
left: 0;
|
|
60
|
-
right: 0;
|
|
61
|
-
bottom: 8px;
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
border: none;
|
|
64
|
-
}
|
|
65
|
-
.icon {
|
|
66
|
-
position: absolute;
|
|
67
|
-
height: 60%;
|
|
68
|
-
position: absolute;
|
|
69
|
-
top: 50%;
|
|
70
|
-
right: 8px;
|
|
71
|
-
transform: translateY(-50%);
|
|
72
|
-
opacity: 0.3;
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
}
|
|
75
|
-
.icon:hover {
|
|
76
|
-
opacity: 0.8;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
.select {
|
|
80
|
-
display: flex;
|
|
81
|
-
justify-content: space-between;
|
|
82
|
-
.active-right {
|
|
83
|
-
font-family: ${FontFamily.AvenirNext};
|
|
84
|
-
font-weight: 500;
|
|
85
|
-
font-size: 13px;
|
|
86
|
-
line-height: 24px;
|
|
87
|
-
letter-spacing: -0.015em;
|
|
88
|
-
color: ${GlobalColors.s5};
|
|
89
|
-
cursor: pointer;
|
|
90
|
-
}
|
|
91
|
-
& + * {
|
|
92
|
-
margin-top: 50px;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
.button-right {
|
|
96
|
-
text-align: right;
|
|
97
|
-
& + * {
|
|
98
|
-
margin-top: 55px;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
.new-login {
|
|
102
|
-
p {
|
|
103
|
-
font-family: ${FontFamily.AvenirNext};
|
|
104
|
-
text-align: right;
|
|
105
|
-
font-weight: 500;
|
|
106
|
-
font-size: 13px;
|
|
107
|
-
line-height: 24px;
|
|
108
|
-
color: ${GlobalColors.s5};
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
span {
|
|
111
|
-
color: ${GlobalColors.secondary_magenta};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
.main-container {
|
|
117
|
-
max-width: 80%;
|
|
118
|
-
max-height: 80%;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VerificationCodeResetPasswordLogin } from "./index";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: "Components/molecules/VerificationCodeResetPasswordLogin",
|
|
5
|
-
component: VerificationCodeResetPasswordLogin,
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => <VerificationCodeResetPasswordLogin {...args} />;
|
|
8
|
-
|
|
9
|
-
export const VerificationCodeResetPasswordLoginDefault = Template.bind({});
|
|
10
|
-
|
|
11
|
-
VerificationCodeResetPasswordLoginDefault.args = {};
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { LogoImage } from "../../atoms/LogoImage";
|
|
5
|
-
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
6
|
-
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
7
|
-
import { GeneralInput } from "../../atoms/GeneralInput";
|
|
8
|
-
import { Button } from "../../atoms/GeneralButton";
|
|
9
|
-
import { validateInput, validate } from "./utils";
|
|
10
|
-
|
|
11
|
-
export const VerificationCodeResetPasswordLogin = (props) => {
|
|
12
|
-
const [resend, setResend] = useState(false);
|
|
13
|
-
const [awsError, setAwsError] = useState("");
|
|
14
|
-
const [emptyVerificationCode, setEmptyVerificationCode] = useState(false);
|
|
15
|
-
const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState(
|
|
16
|
-
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
17
|
-
);
|
|
18
|
-
const inputPositions = [1, 2, 3, 4, 5, 6];
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
props.confirmationError !== "" && setEmptyVerificationCode(false);
|
|
22
|
-
}, [props.confirmationError]);
|
|
23
|
-
|
|
24
|
-
const checkCode = (e, flag) => {
|
|
25
|
-
let valid = true;
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
let code = "";
|
|
28
|
-
if (awsError === "" && !flag) {
|
|
29
|
-
inputPositions.map(
|
|
30
|
-
(position) =>
|
|
31
|
-
(code =
|
|
32
|
-
code +
|
|
33
|
-
document.querySelector(`#verificationCodeInput${position}`).value)
|
|
34
|
-
);
|
|
35
|
-
if (sessionStorage.getItem("resetError")) {
|
|
36
|
-
JSON.parse(sessionStorage.getItem("confirmationCode")) === code &&
|
|
37
|
-
(valid = false);
|
|
38
|
-
}
|
|
39
|
-
sessionStorage.setItem("confirmationCode", JSON.stringify(code));
|
|
40
|
-
valid &&
|
|
41
|
-
!sessionStorage.getItem("resetPasswordProcess") &&
|
|
42
|
-
props.setPaso(6);
|
|
43
|
-
valid &&
|
|
44
|
-
sessionStorage.getItem("resetPasswordProcess") &&
|
|
45
|
-
props.setPaso(8);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const validateResend = async (e) => {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
const email = JSON.parse(sessionStorage.getItem("email"));
|
|
52
|
-
try {
|
|
53
|
-
await props.Auth.forgotPassword(email);
|
|
54
|
-
sessionStorage.setItem("email", JSON.stringify(email));
|
|
55
|
-
sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
|
|
56
|
-
props.setPaso(5);
|
|
57
|
-
setResend(true);
|
|
58
|
-
} catch (err) {
|
|
59
|
-
setAwsError(err.code);
|
|
60
|
-
console.log(err.message);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setInputCodeVerificationAll(
|
|
66
|
-
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
67
|
-
);
|
|
68
|
-
}, []);
|
|
69
|
-
|
|
70
|
-
const loginRight = [
|
|
71
|
-
<LogoImage key="1" />,
|
|
72
|
-
<div className="credenciales" key={"2"}>
|
|
73
|
-
<ScreenHeader
|
|
74
|
-
fontFamily={FontFamily.AvenirNext}
|
|
75
|
-
color={GlobalColors.s5}
|
|
76
|
-
text={"Ingresa tus credenciales"}
|
|
77
|
-
/>
|
|
78
|
-
</div>,
|
|
79
|
-
<div className="user" key="3">
|
|
80
|
-
{sessionStorage.getItem("email") && (
|
|
81
|
-
<ScreenHeader
|
|
82
|
-
text={`Ingrese el código de verificación enviado a: ${JSON.parse(
|
|
83
|
-
sessionStorage.getItem("email")
|
|
84
|
-
)}`}
|
|
85
|
-
headerType={"input-name-header"}
|
|
86
|
-
/>
|
|
87
|
-
)}
|
|
88
|
-
{!sessionStorage.getItem("email") && (
|
|
89
|
-
<ScreenHeader
|
|
90
|
-
text={`Ingrese código de verificación enviado a: ${
|
|
91
|
-
JSON.parse(sessionStorage.getItem("nuevoRegistro")).email
|
|
92
|
-
}`}
|
|
93
|
-
headerType={"input-name-header"}
|
|
94
|
-
/>
|
|
95
|
-
)}
|
|
96
|
-
<div className="verification-code">
|
|
97
|
-
{inputPositions.map((position) => (
|
|
98
|
-
<GeneralInput
|
|
99
|
-
inputId={`verificationCodeInput${position}`}
|
|
100
|
-
inputType={"text"}
|
|
101
|
-
inputPlaceholder={"X"}
|
|
102
|
-
validateInput={validateInput}
|
|
103
|
-
inputsArray={inputCodeVerificationAll}
|
|
104
|
-
position={position}
|
|
105
|
-
maxLength="1"
|
|
106
|
-
/>
|
|
107
|
-
))}
|
|
108
|
-
</div>
|
|
109
|
-
{emptyVerificationCode && (
|
|
110
|
-
<label>Ingrese su código de verificación</label>
|
|
111
|
-
)}
|
|
112
|
-
{sessionStorage.getItem("resetError") && (
|
|
113
|
-
<label>Código de verifiación incorrecto</label>
|
|
114
|
-
)}
|
|
115
|
-
{props.confirmationError === "LimitExceededException" &&
|
|
116
|
-
!emptyVerificationCode && (
|
|
117
|
-
<label>Haz realizado demasiados intentos, intentalo más tarde</label>
|
|
118
|
-
)}
|
|
119
|
-
{props.confirmationError === "CodeMismatchException" &&
|
|
120
|
-
!emptyVerificationCode && (
|
|
121
|
-
<label>Código de verificación incorrecto</label>
|
|
122
|
-
)}
|
|
123
|
-
{props.confirmationError === "ExpiredCodeException" &&
|
|
124
|
-
!emptyVerificationCode && (
|
|
125
|
-
<label>El código ingresado está expirado</label>
|
|
126
|
-
)}
|
|
127
|
-
{props.confirmationError === "InternalErrorException" &&
|
|
128
|
-
!emptyVerificationCode && (
|
|
129
|
-
<label>Algo salió mal, porfavor vuelva a intentarlo</label>
|
|
130
|
-
)}
|
|
131
|
-
{awsError === "LimitExceededException" && (
|
|
132
|
-
<label>Haz realizado demasiados intentos, intentalo más tarde</label>
|
|
133
|
-
)}
|
|
134
|
-
{awsError === "InternalErrorException" && (
|
|
135
|
-
<label>Algo salió mal, porfavor vuelva a intentarlo</label>
|
|
136
|
-
)}
|
|
137
|
-
{resend && awsError === "" && (
|
|
138
|
-
<label className="resendTrue">
|
|
139
|
-
Se reenvió el código de verificación correctamente
|
|
140
|
-
</label>
|
|
141
|
-
)}
|
|
142
|
-
</div>,
|
|
143
|
-
<div className="resend-code" key="4">
|
|
144
|
-
<p onClick={(e) => validateResend(e)}>Reenviar código de verificación</p>
|
|
145
|
-
</div>,
|
|
146
|
-
<div className="button-center" key="5">
|
|
147
|
-
<Button
|
|
148
|
-
buttonType={"general-default-button"}
|
|
149
|
-
label={"Enviar"}
|
|
150
|
-
onClick={(e) => {
|
|
151
|
-
let flag = validate(inputCodeVerificationAll);
|
|
152
|
-
checkCode(e, flag);
|
|
153
|
-
setEmptyVerificationCode(flag);
|
|
154
|
-
}}
|
|
155
|
-
/>
|
|
156
|
-
</div>,
|
|
157
|
-
<div className="reset-password" key="6">
|
|
158
|
-
<p onClick={() => props.setPaso(10)}>Regresar...</p>
|
|
159
|
-
</div>,
|
|
160
|
-
];
|
|
161
|
-
return (
|
|
162
|
-
<Container>
|
|
163
|
-
<GradientPanel
|
|
164
|
-
componentsArray={loginRight}
|
|
165
|
-
panelType={"home-login"}
|
|
166
|
-
panelColor={GlobalColors.white}
|
|
167
|
-
/>
|
|
168
|
-
</Container>
|
|
169
|
-
);
|
|
170
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
height: 100vh;
|
|
7
|
-
width: 50%;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
.button-center {
|
|
11
|
-
text-align: center;
|
|
12
|
-
.general-default-button {
|
|
13
|
-
width: 160px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
.reset-password {
|
|
17
|
-
text-align: center;
|
|
18
|
-
margin: 15px !important;
|
|
19
|
-
color: ${GlobalColors.secondary_magenta};
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
font-weight: bold;
|
|
22
|
-
font-family: ${FontFamily.Raleway};
|
|
23
|
-
font-size: 13px;
|
|
24
|
-
}
|
|
25
|
-
.resend-code {
|
|
26
|
-
margin-top: 8px !important;
|
|
27
|
-
color: ${GlobalColors.magenta_s2};
|
|
28
|
-
font-family: ${FontFamily.AvenirNext};
|
|
29
|
-
font-size: 11px;
|
|
30
|
-
text-decoration: underline rgb(228, 81, 172);
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
& + * {
|
|
33
|
-
margin-top: 30px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
.verification-code {
|
|
37
|
-
display: flex;
|
|
38
|
-
text-align: center;
|
|
39
|
-
margin: auto;
|
|
40
|
-
margin-top: 10px;
|
|
41
|
-
input[type="number"]::-webkit-inner-spin-button,
|
|
42
|
-
input[type="number"]::-webkit-outer-spin-button {
|
|
43
|
-
-webkit-appearance: none;
|
|
44
|
-
margin: 0;
|
|
45
|
-
}
|
|
46
|
-
input {
|
|
47
|
-
width: 70%;
|
|
48
|
-
text-align: center;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {event} e event received triggered by verification code input
|
|
4
|
-
* @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
|
|
5
|
-
* @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
|
|
6
|
-
*/
|
|
7
|
-
export const validateInput = (e, index, inputsArray) => {
|
|
8
|
-
let isValid = false;
|
|
9
|
-
const inputNotEmpty = e.target.value.length > 0;
|
|
10
|
-
if (inputNotEmpty) {
|
|
11
|
-
if (validateInputNumber(e) !== null) {
|
|
12
|
-
isValid = true;
|
|
13
|
-
nextInputFocus(inputsArray, index++);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return isValid ? e.target.value : "";
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param {event} e event received triggered by verification code input
|
|
22
|
-
* @returns {boolean} if digit is a number
|
|
23
|
-
*/
|
|
24
|
-
const validateInputNumber = (e) => {
|
|
25
|
-
return (e.target.value || String.fromCharCode(e.keyCode)).match(/[0-9]{1}/);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
|
|
31
|
-
* @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
|
|
32
|
-
* changes focus to next input if digit typed is a number and there wasn't any before
|
|
33
|
-
*/
|
|
34
|
-
const nextInputFocus = (inputsArray, index) => {
|
|
35
|
-
const button = document.getElementsByClassName("general-default-button");
|
|
36
|
-
|
|
37
|
-
inputsArray?.length && index === inputsArray?.length
|
|
38
|
-
? button[0].focus()
|
|
39
|
-
: inputsArray[index]?.focus();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param {array<html nodes>} inputsArray array which contains every VC digit input (used to check if there's any empty)
|
|
45
|
-
* @param {function} setEmptyVerificationCode function to update flag which handles if there's an empty char
|
|
46
|
-
* updates emptyVerificationFlag from father component
|
|
47
|
-
*/
|
|
48
|
-
export const validate = (inputsArray) => {
|
|
49
|
-
let contInputEmpty = 0;
|
|
50
|
-
inputsArray.forEach((element) => {
|
|
51
|
-
element.value === "" ? 0 : contInputEmpty++;
|
|
52
|
-
});
|
|
53
|
-
return contInputEmpty !== inputsArray.length
|
|
54
|
-
};
|