UNPKG

@particle-network/auth-core-modal

Version:

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

68 lines (67 loc) 2.58 kB
"use client"; import{a as p}from"./chunk-K53EL6SP.js";import{a as r}from"./chunk-RT7AM6B4.js";import"./chunk-J7QRBMDL.js";import"./chunk-5CZ6V5XL.js";import{sa as c,ta as d}from"./chunk-ZJXZXTA4.js";import"./chunk-L535NPP3.js";import{useRequest as w}from"ahooks";import e,{useState as v}from"react";import{useTranslation as h}from"react-i18next";import{ApiError as m,verifyPaymentPassword as b}from"@particle-network/auth-core";var l=`.payment-password-container { position: relative; display: flex; flex-direction: column; align-items: center; box-sizing: border-box; height: 100%; overflow: hidden; color: var(--text-color); } .payment-password-container > .wrapper { padding: 0 30px; } .payment-password-container .display-none { display: none; } .payment-password-container .page-title { margin-top: 0px; font-size: 22px; color: var(--text-color); text-align: center; } .payment-title { margin-top: 60px; font-size: 22px; color: var(--text-color); } .patment-tips1 { width: 80vw; margin-top: 30px; font-size: 14px; text-align: center; color: var(--text-color); } @media (min-width: 600px) { .patment-tips1 { width: calc(80 * var(--vw)); } } .payment-buttons { position: absolute; bottom: 0; left: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 100%; height: auto; padding-bottom: 20px; } .success-icon { width: 50px; height: 50px; margin-top: 60px; } .payment-desc-1 { box-sizing: border-box; margin: 15px 0 75px; font-weight: 400; font-size: 14px; line-height: 16px; text-align: center; color: var(--text-color); } `;var P=z=>{let g=c(),{t:o}=h(),[n,s]=v(""),{setWrongPassword:a}=d(),{loading:x,run:u}=w(b,{manual:!0,onSuccess:(t,i)=>{g("/account/set-password",{state:{oldPassword:n},replace:!0})},onError:t=>{if(s(""),(t==null?void 0:t.error_code)===m.WrongPaymentPassword)a({visible:!0});else if((t==null?void 0:t.error_code)===m.SecurityAccountFrozen){let i=t.extra.seconds||0;a({visible:!0,accountFrozen:{seconds:i}})}}}),y=t=>{s(t),t.length===6&&u(t)};return e.createElement(e.Fragment,null,e.createElement("style",null,l),e.createElement("div",{className:"payment-password-container"},e.createElement(r,{displayBackBtn:!0}),e.createElement("div",{className:"wrapper"},e.createElement("div",{className:"page-title"},o("account.change_payment_password")),e.createElement("p",{className:"payment-desc-1"},o("account.change_enter_payment")),e.createElement(p,{onChange:y,value:n,keyboardInvisible:x}))))},H=P;export{H as default};