@particle-network/auth-core-modal
Version:
Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.
84 lines (83 loc) • 4.17 kB
JavaScript
"use client";
import{a as l}from"./chunk-KABWARCU.js";import{a as c}from"./chunk-YBOB65TJ.js";import"./chunk-S7NKTA7D.js";import{a as p}from"./chunk-6XLKFNW7.js";import{sa as f,ta as d}from"./chunk-E4XMQAPX.js";import"./chunk-L535NPP3.js";import{RecordType as g}from"@particle-network/analytics";import{analyticsRecord as y,restoreWallet as F}from"@particle-network/auth-core";import{useRequest as C}from"ahooks";import{Button as I,Form as i,Space as D,Typography as B}from"antd";import o,{useEffect as W,useState as v}from"react";import{useTranslation as q}from"react-i18next";var u=`.mp-verify-container {
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
overflow: auto;
font-size: 14px;
color: var(--text-color);
background-color: var(--theme-background-color);
}
.mp-verify-container .ant-form {
display: flex;
flex: 1;
flex-direction: column;
width: 100%;
max-width: 800px;
min-height: 360px;
}
.mp-verify-container .ant-form .scroll-content {
flex: 1;
width: 100%;
padding-left: 18px;
padding-right: 18px;
}
.mp-verify-container .ant-form-item {
margin-bottom: 0;
}
.mp-verify-container .mp-verify-title {
margin-top: 16px;
font-weight: 500;
font-size: 18px;
line-height: 28px;
color: var(--text-color);
}
.mp-verify-container .mp-input-name {
align-self: flex-start;
margin-top: 30px;
font-weight: 400;
}
.mp-verify-container .mp-input {
margin-top: 6px;
}
.mp-verify-container .mp-input-error {
align-self: flex-start;
margin-top: 8px;
color: var(--error-color);
}
.mp-verify-container .mp-tip-space {
width: 100%;
margin-top: 25px;
margin-bottom: 110px;
line-height: 20px;
}
.mp-verify-container .mp-tip-space span {
color: var(--text-color);
}
.mp-verify-container .bottom-container {
width: 100%;
}
.mp-verify-container .bottom-container.footer {
padding-left: 18px;
padding-right: 18px;
}
.mp-verify-container .bottom-container .mp-next {
position: relative;
display: block;
width: 100%;
max-width: 800px;
margin: auto;
}
.mp-verify-container .bottom-container .footer-box {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: var(--footer-height);
margin: 0;
}
.mp-verify-container .bottom-container .footer-box img {
margin: 0;
}
`;var z=x=>{let{Text:a,Link:h}=B,s=f(),[w,n]=v(!1),{t:r}=q(),{loginVerifyMasterPassword:b}=x||{},m=o.useRef(null),[P,_]=v(!0),{loginSuccessRedirectToApp:S}=d(),N=c(),{run:E,loading:M}=C(F,{manual:!0,onBefore:()=>{y({record_type:g.PAGE_MASTER_PASSWORD_VERIFY})},onSuccess:e=>{e?(y({record_type:g.PAGE_MASTER_PASSWORD_VERIFY_SUCCESS}),b?S():s(-1)):n(!0)},onError:e=>{N.error((e==null?void 0:e.message)||"check master password error")}}),T=()=>{s("/account/master-password/description")},k=e=>{let{password:t}=e;(t==null?void 0:t.length)>=6&&(t==null?void 0:t.length)<=20?(n(!1),E(t)):n(!0)},V=e=>{let{password:t}=e;n(!1),_(!t)};return W(()=>{setTimeout(()=>{var e,t;(t=(e=m.current)==null?void 0:e.querySelector(".password-input input"))==null||t.focus()},200)},[]),o.createElement("div",{className:"mp-verify-container",ref:m},o.createElement("style",null,u),o.createElement("div",{className:"mp-verify-title"},r("account.restore_wallet")),o.createElement(i,{layout:"vertical",onFinish:k,onValuesChange:V},o.createElement("div",{className:"scroll-content"},o.createElement("div",{className:"mp-input-name padding-top-16"},r("account.master_password")),o.createElement(i.Item,{name:"password"},o.createElement(l,{className:"mp-input"})),w&&o.createElement("div",{className:"mp-input-error"},r("account.password_error")),o.createElement(D,{direction:"vertical",className:"mp-tip-space"},o.createElement(a,null,r("account.mpc_tss_intro")),o.createElement(a,null,r("account.input_decrypt_hint")," ",o.createElement(h,{onClick:T,className:"more-text-btn"},r("account.learn_more_period"))))),o.createElement(i.Item,null,o.createElement("div",{className:"bottom-container footer"},o.createElement(I,{className:"primary-antd-btn mp-next",htmlType:"submit",loading:M,disabled:P},r("common.confirm")),o.createElement(p,{className:"footer-box-v2"})))))},$=z;export{$ as default};