react-gldn-kit 0.1.174 → 0.1.175
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.
|
@@ -43,7 +43,6 @@ var react_1 = require("react");
|
|
|
43
43
|
var classnames_1 = __importDefault(require("classnames"));
|
|
44
44
|
var types_1 = require("react-memory-optimization/dist/lib/binary/types");
|
|
45
45
|
var CrossSvg_1 = require("components/ui/Icons/Base/CrossSvg");
|
|
46
|
-
var HOCRequestLoader_1 = require("components/HOCs/HOCRequestLoader");
|
|
47
46
|
var EmailInput_1 = require("components/ui/Inputs/EmailInput");
|
|
48
47
|
var BaseInput_1 = require("components/ui/Inputs/BaseInput");
|
|
49
48
|
var Buttons_1 = require("components/ui/Buttons");
|
|
@@ -60,7 +59,7 @@ var DEFAULT_VALUE = {
|
|
|
60
59
|
};
|
|
61
60
|
// TODO: Props
|
|
62
61
|
var AssignEmail = function (props) {
|
|
63
|
-
var sendCommand = props.sendCommand, updateUserInfo = props.updateUserInfo, status = props.status, setStatus = props.setStatus, classes = props.classes,
|
|
62
|
+
var sendCommand = props.sendCommand, updateUserInfo = props.updateUserInfo, status = props.status, setStatus = props.setStatus, classes = props.classes, resetFormType = props.resetFormType, _a = props.initialEmail, initialEmail = _a === void 0 ? '' : _a;
|
|
64
63
|
var useProfileInfoController = (0, ModalContext_1.useHookProvider)().useProfileInfoController;
|
|
65
64
|
var _b = (0, react_1.useState)(!!initialEmail), isAllowed = _b[0], setAllow = _b[1];
|
|
66
65
|
var _c = (0, react_1.useState)(initialEmail || ''), email = _c[0], setEmail = _c[1];
|
|
@@ -83,29 +82,11 @@ var AssignEmail = function (props) {
|
|
|
83
82
|
}
|
|
84
83
|
}; };
|
|
85
84
|
var assignEmail = function () {
|
|
86
|
-
if (
|
|
87
|
-
if (!email || !code.value) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
handleConfirmEmailByCode({ email: email, code: code.value });
|
|
85
|
+
if (!email || !code.value) {
|
|
91
86
|
return;
|
|
92
87
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!email || !code.value || !requestId) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
var data = getUpdateUserData({
|
|
99
|
-
email: email,
|
|
100
|
-
requestId: requestId,
|
|
101
|
-
code: code.value,
|
|
102
|
-
});
|
|
103
|
-
console.log('data', data);
|
|
104
|
-
if (!data) {
|
|
105
|
-
console.error('No update user data');
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
sendCommand(key, data, true);
|
|
88
|
+
handleConfirmEmailByCode({ email: email, code: code.value });
|
|
89
|
+
return;
|
|
109
90
|
};
|
|
110
91
|
(0, react_1.useEffect)(function () {
|
|
111
92
|
if (code.value.length >= 4) {
|
|
@@ -113,10 +94,11 @@ var AssignEmail = function (props) {
|
|
|
113
94
|
}
|
|
114
95
|
}, [code]);
|
|
115
96
|
(0, react_1.useEffect)(function () {
|
|
116
|
-
if (
|
|
97
|
+
if (confirmEmailByCodeStatus === 'success' ||
|
|
117
98
|
status === types_3.UpdateStatus.Success) {
|
|
118
99
|
setStatus(types_3.UpdateStatus.Unknown);
|
|
119
100
|
updateUserInfo('email', email);
|
|
101
|
+
updateUserInfo('isEmailConfirmed', true);
|
|
120
102
|
resetFormType();
|
|
121
103
|
setModal(types_2.EModalTypes.Info, {
|
|
122
104
|
text: 'profile.content.myAccount.form.dataChanged',
|
|
@@ -124,6 +106,6 @@ var AssignEmail = function (props) {
|
|
|
124
106
|
});
|
|
125
107
|
}
|
|
126
108
|
}, [status, resetFormType, email, confirmEmailByCodeStatus]);
|
|
127
|
-
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)(styles.wrapperEmail, classes) }, { children: [(0, jsx_runtime_1.jsx)(EmailInput_1.EmailInput, { size: "full", onChange: setEmail, callbackFn: handleAllowInputCode, classesWrapper: styles.wrapperEmailInput, label: "profile.content.myAccount.form.email", placeholder: "profile.content.myAccount.form.enterEmail", requestId: types_1.ERequestIds.UpdateUserEmail, sendCommand: sendCommand, classes: styles.wrapperEmailInput, defaultValue: initialEmail, isRestEmail:
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)(styles.wrapperEmail, classes) }, { children: [(0, jsx_runtime_1.jsx)(EmailInput_1.EmailInput, { size: "full", onChange: setEmail, callbackFn: handleAllowInputCode, classesWrapper: styles.wrapperEmailInput, label: "profile.content.myAccount.form.email", placeholder: "profile.content.myAccount.form.enterEmail", requestId: types_1.ERequestIds.UpdateUserEmail, sendCommand: sendCommand, classes: styles.wrapperEmailInput, defaultValue: initialEmail, isRestEmail: true }), (0, jsx_runtime_1.jsx)(BaseInput_1.BaseInput, { placeholder: "profile.content.myAccount.form.code", size: "full", defaultValue: "", disabled: !isAllowed, onChange: changeInput('code'), classes: styles.wrapperInput }), (0, jsx_runtime_1.jsxs)("div", __assign({ className: styles.buttons }, { children: [(0, jsx_runtime_1.jsx)(Buttons_1.BaseButton, { text: "profile.content.myAccount.form.verification", color: "primary", disabled: isNotUpdateBtn, size: "--button-full", buttonHeight: "--button-height-l", classes: styles.verificationButton, handleClick: assignEmail, centreText: true }), (0, jsx_runtime_1.jsx)(Buttons_1.BaseButton, { text: "", color: "dark", size: "--button-s", classes: styles.closeButton, handleClick: resetFormType, startIcon: (0, jsx_runtime_1.jsx)(CrossSvg_1.CrossSvg, { width: "10", height: "10", classes: styles.closeButtonSvg }) })] }))] })));
|
|
128
110
|
};
|
|
129
111
|
exports.AssignEmail = AssignEmail;
|