UNPKG

@particle-network/authkit

Version:

Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.

83 lines (82 loc) 4.12 kB
"use client"; import{a as g}from"./chunk-PFY5B2RB.mjs";import{a as u,m as y,n}from"./chunk-NSWCC5PG.mjs";import"./chunk-BM7ICTT2.mjs";import{a as d}from"./chunk-ZTTU2K7E.mjs";import"./chunk-UXH6IVHO.mjs";import"./chunk-GYYKKPHD.mjs";import"./chunk-3RRPQ2DX.mjs";import{V as f,h as p,l as m,o as c,r as l}from"./chunk-H6TXMQRA.mjs";import"./chunk-C7OWFSST.mjs";import{RecordType as x}from"@particle-network/analytics";import{analyticsRecord as h,restoreWallet as I}from"@particle-network/auth-core";import D from"ahooks/es/useRequest";import e,{useEffect as B,useState as w}from"react";var v=`.mp-verify-container { display: flex; flex-direction: column; align-items: center; height: 100%; overflow: auto; font-size: 14px; color: var(--text-color); } .mp-verify-container .p-form { display: flex; flex: 1; flex-direction: column; width: 100%; max-width: 800px; min-height: 360px; } .mp-verify-container .p-form .scroll-content { flex: 1; width: 100%; padding-left: 18px; padding-right: 18px; } .mp-verify-container .p-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 W=P=>{let s=c(),[b,i]=w(!1),{t:r}=l(),{loginVerifyMasterPassword:_}=P||{},a=e.useRef(null),[S,N]=w(!0),{loginSuccessRedirectToApp:E}=m(),M=f(),{run:F,loading:V}=D(I,{manual:!0,onBefore:()=>{h({record_type:x.PAGE_MASTER_PASSWORD_VERIFY})},onSuccess:o=>{o?(h({record_type:x.PAGE_MASTER_PASSWORD_VERIFY_SUCCESS}),_?E():s(-1)):i(!0)},onError:o=>{M.error((o==null?void 0:o.message)||"check master password error")}}),A=()=>{s("/account/master-password/description")},C=o=>{let{password:t}=o;(t==null?void 0:t.length)>=6&&(t==null?void 0:t.length)<=20?(i(!1),F(t)):i(!0)},T=o=>{let{password:t}=o;i(!1),N(!t)};return B(()=>{setTimeout(()=>{var o,t;(t=(o=a.current)==null?void 0:o.querySelector(".password-input input"))==null||t.focus()},200)},[]),e.createElement("div",{className:"mp-verify-container",ref:a},e.createElement("style",null,p(v)),e.createElement("div",{className:"mp-verify-title"},r("account.restore_wallet")),e.createElement(y,{layout:"vertical",onFinish:C,onValuesChange:T},e.createElement("div",{className:"scroll-content"},e.createElement("div",{className:"mp-input-name padding-top-16"},r("account.master_password")),e.createElement(n,{name:"password"},e.createElement(g,{className:"mp-input"})),b&&e.createElement("div",{className:"mp-input-error"},r("account.password_error")),e.createElement("div",{className:"mp-tip-space p-space-vertical"},e.createElement("span",null,r("account.mpc_tss_intro")),e.createElement("span",null,r("account.input_decrypt_hint")," ",e.createElement("a",{onClick:A,className:"more-text-btn"},r("account.learn_more_period"))))),e.createElement(n,null,e.createElement("div",{className:"bottom-container footer"},e.createElement(u,{type:"primary",className:"primary-antd-btn mp-next",htmlType:"submit",loading:V,disabled:S},r("common.confirm")),e.createElement(d,{className:"footer-box-v2"})))))},X=W;export{X as default};