PageSourceSearch

https://pro.subscan.io/static/js/574.b4c1c6e3.chunk.js

js subscan.io collected 2026-10-02 07:19:34 UTC 17,435 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunksubscan_api_platform=self.webpackChunksubscan_api_platform||[]).push([[574],{94574:(e,s,a)=>{a.r(s),a.d(s,{default:()=>I});var t=a(65043),l=a(68966),n=a(49665),i=a(83490),r=a(68231),o=a(64414),c=a(11919),d=a(91296),m=a(97964),x=a(58262),u=a(59905),p=a(63028),h=a(95896),g=a(73216),f=a(53536),v=a(24559),j=a(43818),w=a(30393),C=a(70579);const y=e=>{let{open:s,onClose:a}=e;const{updateUserInfo:l}=(0,x.nm)(),[n,i]=(0,t.useState)(!1),[r,o]=(0,t.useState)(""),[c,d]=(0,t.useState)(""),p=(0,t.useMemo)((()=>!(r.trim()&&r.trim()===c.trim())),[r,c]),h=(0,t.useCallback)((async()=>{try{i(!0);const{status:e,data:s}=await(0,v.qq)({password:r});i(!1),200===e&&0===s.code?(u.E.success({description:"Set password success"}),l(),a()):s.message&&u.E.error({description:s.message})}catch(e){i(!1),console.error(e);const s=e.response.data.message||(null===e||void 0===e?void 0:e.message);s&&u.E.error({description:s})}}),[r,l,a]);return(0,C.jsx)(w.V,{open:s,title:"Set Password",footer:!1,width:420,onClose:a,children:(0,C.jsxs)("div",{className:"flex flex-col gap-large",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Password"}),(0,C.jsx)(j.g,{type:"password",placeholder:"Password",onChange:e=>o(e.target.value)})]}),(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Confirm new password"}),(0,C.jsx)(j.g,{type:"password",placeholder:"Confirm new password",onChange:e=>d(e.target.value)}),c&&r.trim()!==c.trim()?(0,C.jsx)("span",{className:"text-normal text-xs text-red-600",children:"Confirm password is not equal to password"}):null]}),(0,C.jsx)(m.S,{variant:"contained",loading:n,className:"w-full h-9 rounded",textClassName:"text-normal text-sm",disabled:p,onClick:h,children:"Save"})]})})},N=e=>{let{open:s,onClose:a}=e;const{saveUserInfo:l}=(0,x.nm)(),[n,i]=(0,t.useState)(!1),[r,o]=(0,t.useState)(""),[c,d]=(0,t.useState)(""),[p,h]=(0,t.useState)("");(0,t.useEffect)((()=>{s||(o(""),d(""),h(""))}),[s]);const g=(0,t.useMemo)((()=>!(r.trim()&&c.trim()&&c.trim()===p.trim())),[r,c,p]),f=(0,t.useCallback)((async()=>{try{i(!0);const{status:e,data:s}=await(0,v.Ft)({old_password:r,password:c});i(!1),200===e&&0===s.code?(a(),u.E.success({description:"Reset password success"}),l(null)):s.message&&u.E.error({description:s.message})}catch(e){i(!1),console.error(e);const s=e.response.data.message||(null===e||void 0===e?void 0:e.message);s&&u.E.error({description:s})}}),[r,c,l,a]);return(0,C.jsx)(w.V,{open:s,title:"Set New Password",footer:!1,width:420,onClose:a,children:(0,C.jsxs)("div",{className:"flex flex-col gap-large",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Current password"}),(0,C.jsx)(j.g,{type:"password",placeholder:"Current password",onChange:e=>o(e.target.value)})]}),(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"New password"}),(0,C.jsx)(j.g,{type:"password",placeholder:"New password",onChange:e=>d(e.target.value)})]}),(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Confirm new password"}),(0,C.jsx)(j.g,{type:"password",placeholder:"Confirm new password",onChange:e=>h(e.target.value)}),p&&c.trim()!==p.trim()?(0,C.jsx)("span",{className:"text-normal text-xs text-red-600",children:"Confirm password is not equal to password"}):null]}),(0,C.jsx)(m.S,{variant:"contained",loading:n,className:"w-full h-9 rounded",textClassName:"text-normal text-sm",disabled:g,onClick:f,children:"Save"})]})})};var S=a(43803);const b=e=>{let{open:s,onClose:a}=e;const{userInfo:l,updateUserInfo:n}=(0,x.nm)(),[i,r]=(0,t.useState)(!1),[o,c]=(0,t.useState)(""),d=(0,t.useCallback)((async()=>{const e=null!==l&&void 0!==l&&l.password_state?"2":"1";try{r(!0);const{status:s,data:t}=await(0,v.lT)({email:o,binding:e});r(!1),200===s&&0===t.code?(a(),u.E.success({description:"Verification email has been sent, please check your inbox"}),n()):t.message&&u.E.error({description:t.message})}catch(s){r(!1),console.error(s);const e=s.response.data.message||(null===s||void 0===s?void 0:s.message);
1e&&u.E.error({description:e})}}),[o,l,n,a]);return(0,C.jsx)(w.V,{open:s,title:"Set Email",footer:!1,width:420,onClose:a,children:(0,C.jsxs)("div",{className:"flex flex-col gap-large",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Email"}),(0,C.jsx)(j.g,{type:"email",placeholder:"Email",onChange:e=>c(e.target.value)}),o&&!(0,S.DT)(o)?(0,C.jsx)("span",{className:"text-normal text-xs text-red-600",children:"Invalid email"}):null]}),(0,C.jsx)(m.S,{variant:"contained",loading:i,className:"w-full h-9 rounded",textClassName:"text-normal text-sm",disabled:!(0,S.DT)(o),onClick:d,children:"Send Verify Email"})]})})},k=e=>{let{open:s,onClose:a}=e;const{updateUserInfo:l}=(0,x.nm)(),[n,i]=(0,t.useState)(!1),[r,o]=(0,t.useState)(""),c=(0,t.useCallback)((async()=>{try{i(!0);const{status:e,data:s}=await(0,v.lT)({email:r,binding:"2"});i(!1),200===e&&0===s.code?(a(),u.E.success({description:"Verification email has been sent, please check your inbox"}),l()):s.message&&u.E.error({description:s.message})}catch(e){i(!1),console.error(e);const s=e.response.data.message||(null===e||void 0===e?void 0:e.message);s&&u.E.error({description:s})}}),[r,l,a]);return(0,C.jsx)(w.V,{open:s,title:"Change Email",footer:!1,width:420,onClose:a,children:(0,C.jsxs)("div",{className:"flex flex-col gap-large",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Email"}),(0,C.jsx)(j.g,{type:"email",placeholder:"Email",onChange:e=>o(e.target.value)}),r&&!(0,S.DT)(r)?(0,C.jsx)("span",{className:"text-normal text-xs text-red-600",children:"Invalid email"}):null]}),(0,C.jsx)(m.S,{variant:"contained",loading:n,className:"w-full h-9 rounded",textClassName:"text-normal text-sm",disabled:!(0,S.DT)(r),onClick:c,children:"Send Verify Email"})]})})};var E=a(18956);const _=e=>{let{open:s,onClose:a}=e;const[l,n]=(0,t.useState)(!1),{updateUserInfo:o}=(0,x.nm)(),[p,h]=(0,t.useState)(null),g=(0,t.useCallback)((async()=>{if(p)try{var e;n(!0);const s=(0,c.X)((0,i.F)(p.address)),t=await(0,v.GU)({public_key:s});if(200!==t.status||0!==t.data.code)return t.data.message&&u.E.error({description:t.data.message}),void n(!1);const l=t.data.data,m=await(0,r.Ao)(p.address),x=null===m||void 0===m||null===(e=m.signer)||void 0===e?void 0:e.signRaw;if(!x)return u.E.warn({description:"Signature signer not found"}),void n(!1);const{signature:h}=await x({address:p.address,data:(0,d.i)(l),type:"bytes"}),{status:g,data:f}=await(0,v.xw)({bind:"1",encryption:p.type||"",nonce:l,public_key:s,signature:h});n(!1),200===g&&0===f.code?(a(),u.E.success({description:"Link web3 address success"}),o()):f.message&&u.E.error({description:f.message})}catch(s){n(!1),console.error(s);const e=s.response.data.message||(null===s||void 0===s?void 0:s.message);e&&u.E.error({description:e})}}),[p,o,a]);return(0,C.jsx)(w.V,{open:s,title:"Set Web3 Account",footer:!1,width:420,onClose:a,children:(0,C.jsxs)("div",{className:"flex flex-col gap-large",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-small",children:[(0,C.jsx)("span",{className:"text-normal text-sm capitalize",children:"Choose Web3 account"}),(0,C.jsx)(E.k,{className:"h-12",currentAccount:p,onSelect:h})]}),(0,C.jsx)(m.S,{variant:"contained",className:"w-full h-9 rounded",textClassName:"text-normal text-sm",loading:l,disabled:!p,onClick:g,children:"Confirm"})]})})};var U=a(47696),F=a(98844);const V=e=>{let{name:s,children:a}=e;return(0,C.jsxs)("div",{className:"py-middle md:py-0 md:h-[3.75rem] flex flex-col md:flex-row md:items-center",children:[(0,C.jsx)("div",{className:"flex w-[11.25rem]",children:(0,C.jsx)("span",{className:"text-semibold text-sm",children:s})}),a]})},I=()=>{const e=(0,g.Zp)(),{api:s,accounts:a}=(0,x.gf)(),{userInfo:j,saveUserInfo:S,updateUserInfo:E}=(0,x.nm)(),{turnstileRef:I,executeTurnstile:z}=(0,U.A)(),[T,A]=(0,t.useState)(!1),[D,R]=(0,t.useState)(!1),[q,P]=(0,t.useState)(!1),[W,L]=(0,t.useState)(!1),[M,G]=(0,t.useState)(!1),[O,Y]=(0,t.useState)(!1),[$,X]=(0,t.useState)(!1),[B,K]=(0,t.useState)(!1),[Z,H]=(0,t.useState)(!1),[J,Q]=(0,t.useState)(!1),[ee,se]=(0,t.useState)(!1),[ae,te]=(0,t.useState)(!1),[,le]=(0,t.useState)(!1),[,ne]=(0,t.useState)(!1),ie=(0,t.useMemo)((()=>
1{if(null!==j&&void 0!==j&&j.public_key)try{return(0,n.j)(j.public_key)}catch(e){console.error(e)}return""}),[null===j||void 0===j?void 0:j.public_key]),re=(0,t.useMemo)((()=>{var e;return null!==j&&void 0!==j&&null!==(e=j.organizations)&&void 0!==e&&e.length?j.organizations[0]:null}),[null===j||void 0===j?void 0:j.organizations]),oe=(0,t.useCallback)((async()=>{try{Q(!0);const{status:e,data:s}=await(0,v.h9)({bind:"2"});Q(!1),200===e&&s.code===F.d.SUCCESS?(u.E.success({description:"Unlink web3 account success"}),E()):s.message&&u.E.error({description:s.message})}catch(e){Q(!1),(0,p.hS)(e,"Failed to unlink web3 account")}}),[E]),ce=(0,t.useCallback)((async()=>{try{se(!0);const{status:e,data:s}=await(0,v.s9)({email:(null===j||void 0===j?void 0:j.email)||"",binding:"3"});se(!1),200===e&&s.code===F.d.SUCCESS?(u.E.success({description:"Unlink email success"}),E()):s.message&&u.E.error({description:s.message})}catch(e){se(!1),console.error(e),u.E.warn({description:"Unlink email failed, please try again later"})}}),[j,E]),de=(0,t.useCallback)((async()=>{if(!I.current)return void u.E.warn({description:"Turnstile not ready, please try again later"});const e=null===j||void 0===j?void 0:j.email;if(e)try{te(!0);const s="verify_mail",a=await z(s);if(!a)return u.E.warn({description:"Verification failed, please try again"}),void te(!1);const{status:t,data:l}=await(0,v.eG)({email:e,recaptcha:a});if(te(!1),200===t&&l.code===F.d.SUCCESS)u.E.success({description:"Email has been sent"});else{!(0,p.$5)(l,{[F.d.ALREADY_VERIFIED]:"Please try again after 2 mins"})&&l.message&&u.E.error({description:l.message})}}catch(s){te(!1),(0,p.hS)(s,"Failed to resend email")}else u.E.warn({description:"User email not found"})}),[null===j||void 0===j?void 0:j.email,z,I]),me=(0,t.useCallback)((async()=>{const t=null===j||void 0===j?void 0:j.public_key;if(!t)return void u.E.warn({description:"No web3 register info found"});if(!s)return void u.E.warn({description:"No available extension"});const l=a.find((e=>(0,c.X)((0,i.F)(e.address))===t));if(l)try{var n;le(!0);const s=await(0,v.GU)({public_key:t});if(200!==s.status||s.data.code!==F.d.SUCCESS)return s.data.message&&u.E.error({description:s.data.message}),void le(!1);const a=s.data.data,i=await(0,r.Ao)(l.address),o=null===i||void 0===i||null===(n=i.signer)||void 0===n?void 0:n.signRaw;if(!o)return u.E.warn({description:"Signature signer not found"}),void le(!1);const{signature:c}=await o({address:l.address,data:(0,d.i)(a),type:"bytes"}),m=await(0,v.tD)({mode:2,encryption:l.type,nonce:a,public_key:t,signature:c});le(!1),200===m.status&&m.data.code===F.d.SUCCESS?(u.E.success({description:"Delete account success"}),S(null),e("/login")):m.data.message&&u.E.error({description:m.data.message})}catch(o){le(!1),(0,p.hS)(o,"Failed to delete web3 account")}else u.E.warn({description:"No injected account found"})}),[s,a,null===j||void 0===j?void 0:j.public_key,e,S]),xe=(0,t.useCallback)((async()=>{try{ne(!0);const{status:e,data:s}=await(0,v.tD)({mode:1});ne(!1),200===e&&s.code===F.d.SUCCESS?(u.E.success({description:"Verify email has been sent, please check your inbox"}),E()):s.message&&u.E.error({description:s.message})}catch(e){ne(!1),(0,p.hS)(e,"Failed to delete email account")}}),[E]);return j?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{className:"p-large rounded bg-white max-w-[720px]",style:{boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.05)",border:"1px solid #F2F4FA"},children:(0,C.jsx)("div",{className:"flex flex-col gap-large",children:(0,C.jsxs)("div",{className:"flex flex-col",children:[(0,C.jsx)(V,{name:"Account Type",children:re?(0,C.jsx)("span",{className:"text-normal text-sm",children:`${(0,f.capitalize)(null===re||void 0===re?void 0:re.role)} - ${null===re||void 0===re?void 0:re.name}`}):(0,C.jsx)("span",{className:"text-normal text-sm",children:"User"})}),(0,C.jsx)("div",{className:"h-[1px] bg-divider w-full"}),(0,C.jsx)(V,{name:"Web3 Account",children:(0,C.jsx)("div",{className:"flex flex-1 items-center justify-between gap-middle",children:ie.length?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)("div",{className:"flex items-center gap-small",children:[(0,C.jsx)(o.q,{theme:"polkadot",size:30,value:ie}),(0,C.jsx)("span",{className:"text-normal text-sm",children:(0,h._9)(ie)})]}),(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",loading:J,onClick:()=>Y(!0),children:"Unlink"})]}):(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",onClick:()=>G(!0),children:"Link to Web3 Account"})})}),(0,C.jsx)("div",{className:"h-[1px] bg-divider w-full"}),(0,C.jsx)(V,{name:"Email",children:(0,C.jsx)("div",{className:"flex flex-1 items-center justify-between gap-middle",children:j.email?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"text-normal text-sm",children:j.email}),j.email_verify?j.public_key?(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",loading:ee,onClick:()=>X(!0),children:"Unlink"}):null:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",loading:ae,onClick:de,children:"Resend Verify Email"}),(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",onClick:()=>L(!0),children:"Change Email"})]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"text-normal text-sm",children:"Not Set"}),(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",onClick:()=>P(!0),children:"Link"})]})})}),(0,C.jsx)("div",{className:"h-[1px] bg-divider w-full"}),(0,C.jsx)(V,{name:"Password",children:(0,C.jsx)("div",{className:"flex flex-1 items-center justify-between gap-middle",children:j.password_state?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"text-normal text-sm",children:"Already Set"}),j.email&&j.email_verify?(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",onClick:()=>R(!0),children:"Change Password"}):null]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"text-normal text-sm",children:"Not Set"}),j.email&&j.email_verify?(0,C.jsx)(m.S,{variant:"plain",className:"h-[1.875rem] px-large rounded flex items-center justify-center",textClassName:"text-normal text-sm",onClick:()=>A(!0),children:"Set Password"}):null]})})}),(0,C.jsx)("div",{className:"h-[1px] bg-divider w-full"})]})})}),(0,C.jsx)(y,{open:T,onClose:()=>A(!1)}),(0,C.jsx)(N,{open:D,onClose:()=>R(!1)}),(0,C.jsx)(b,{open:q,onClose:()=>P(!1)}),(0,C.jsx)(k,{open:W,onClose:()=>L(!1)}),(0,C.jsx)(_,{open:M,onClose:()=>G(!1)}),(0,C.jsx)(w.V,{title:"Confirmation Required",open:O,okText:"Unlink",width:420,onCancel:()=>Y(!1),onClose:()=>Y(!1),onOk:()=>{Y(!1),oe()},children:(0,C.jsx)("span",{className:"text-normal text-sm",children:"Web3 login 
1will be unavailable, are you sure you want to unlink it?"})}),(0,C.jsx)(w.V,{title:"Confirmation Required",open:$,okText:"Unlink",width:420,onCancel:()=>X(!1),onClose:()=>X(!1),onOk:()=>{X(!1),ce()},children:(0,C.jsx)("span",{className:"text-normal text-sm",children:"Email login will be unavailable, are you sure you want to unlink it?"})}),(0,C.jsx)(w.V,{title:"Confirmation Required",open:B,okText:"Delete",width:420,onCancel:()=>K(!1),onClose:()=>K(!1),onOk:()=>{K(!1),j.public_key&&j.email?H(!0):j.public_key?me():j.email&&xe()},children:(0,C.jsx)("span",{className:"text-normal text-sm",children:"Your account and apiKey will be unavailable, are you sure you want to delete your account?"})}),(0,C.jsx)(w.V,{title:"Verify Identity",open:Z,okText:"Delete",width:420,onClose:()=>H(!1),footer:!1,children:(0,C.jsxs)("div",{className:"flex flex-col gap-large",children:[(0,C.jsx)("span",{className:"text-normal text-sm",children:"Before deleting your account, you need to pass the identity verification. You can verify your identity in the following ways."}),(0,C.jsxs)("div",{className:"flex items-center gap-middle",children:[(0,C.jsx)(m.S,{className:"rounded px-large h-8",textClassName:"text-normal text-sm",variant:"contained",onClick:()=>{H(!1),me()},children:"Web3 Signature"}),(0,C.jsx)(m.S,{className:"rounded px-large h-8",textClassName:"text-normal text-sm",onClick:()=>{H(!1),xe()},children:"Email"})]})]})}),(0,C.jsx)(l.t,{ref:I})]}):null}}}]);
2//# sourceMappingURL=574.b4c1c6e3.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.