PageSourceSearch

https://devconnect.org/_next/static/chunks/6166.d22766307928d7ab.js

js devconnect.org collected 2026-10-03 21:03:44 UTC 19,350 bytes, 245 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6166],{96166:(e,t,i)=>{i.r(t),i.d(t,{W3mDataCaptureOtpConfirmView:()=>I,W3mDataCaptureView:()=>k,W3mEmailSuffixesWidget:()=>C,W3mRecentEmailsWidget:()=>q});var a=i(22707),r=i(71877),s=i(73779),n=i(6792),o=i(12890),l=i(16285),c=i(72317),u=i(21438),d=i(34907),h=i(11862),g=i(35149),p=i(35728),m=i(30447),w=i(76465),f=i(38372);class y{constructor(e){this.expiration=e.expiration,this.getNonce=e.getNonce,this.getRequestId=e.getRequestId,this.domain=e.domain,this.uri=e.uri,this.statement=e.statement,this.resources=e.resources}async createMessage(e){let t={accountAddress:e.accountAddress,chainId:e.chainId,version:this.version,domain:this.domain,uri:this.uri,statement:this.statement,resources:this.resources,nonce:await this.getNonce(e),requestId:await this.getRequestId?.(),expirationTime:this.getExpirationTime(e),issuedAt:this.getIssuedAt(),notBefore:this.getNotBefore(e)};return Object.assign(t,{toString:()=>this.stringify(t)})}getExpirationTime({notBefore:e}){if(void 0===this.expiration)return;let t=e?new Date(e).getTime():Date.now();return this.stringifyDate(new Date(t+this.expiration))}getNotBefore({notBefore:e}){return e?this.stringifyDate(new Date(e)):void 0}getIssuedAt(){return this.stringifyDate(new Date)}stringifyDate(e){return e.toISOString()}}class x extends y{constructor({clearChainIdNamespace:e,...t}){super(t),this.version="1",this.clearChainIdNamespace=e||!1}getNetworkName(e){let t=o.W.getAllRequestedCaipNetworks();return f.L.getNetworkNameByCaipNetworkId(t,e)}stringify(e){let t=this.clearChainIdNamespace?e.chainId.split(":")[1]:e.chainId,i=this.getNetworkName(e.chainId);return[`${e.domain} wants you to sign in with your ${i} account:`,e.accountAddress,e.statement?`
2${e.statement}
3`:"",`URI: ${e.uri}`,`Version: ${e.version}`,`Chain ID: ${t}`,`Nonce: ${e.nonce}`,e.issuedAt&&`Issued At: ${e.issuedAt}`,e.expirationTime&&`Expiration Time: ${e.expirationTime}`,e.notBefore&&`Not Before: ${e.notBefore}`,e.requestId&&`Request ID: ${e.requestId}`,e.resources?.length&&e.resources.reduce((e,t)=>`${e}
4- ${t}`,"Resources:")].filter(e=>"string"==typeof e).join("\n").trim()}}class v{constructor(e={}){this.otpUuid=null,this.listeners={sessionChanged:[]},this.localAuthStorageKey=e.localAuthStorageKey||s.Ws.SIWX_AUTH_TOKEN,this.localNonceStorageKey=e.localNonceStorageKey||s.Ws.SIWX_NONCE_TOKEN,this.required=e.required??!0,this.messenger=new x({domain:"undefined"==typeof document?"Unknown Domain":document.location.host,uri:"undefined"==typeof document?"Unknown URI":document.location.href,getNonce:this.getNonce.bind(this),clearChainIdNamespace:!1})}async createMessage(e){return this.messenger.createMessage(e)}async addSession(e){let t=await this.request({method:"POST",key:"authenticate",body:{data:e.data,message:e.message,signature:e.signature,clientId:this.getClientId(),walletInfo:this.getWalletInfo()},headers:["nonce","otp"]});this.setStorageToken(t.token,this.localAuthStorageKey),this.emit("sessionChanged",e),this.setAppKitAccountUser(function(e){let t=e.split(".");if(3!==t.length)throw Error("Invalid token");let i=t[1];if("string"!=typeof i)throw Error("Invalid token");let a=i.replace(/-/gu,"+").replace(/_/gu,"/");return JSON.parse(atob(a.padEnd(a.length+(4-a.length%4)%4,"=")))}(t.token)),this.otpUuid=null}async getSessions(e,t){try{if(!this.getStorageToken(this.localAuthStorageKey))return[];let i=await this.request({method:"GET",key:"me",query:{},headers:["auth"]});if(!i)return[];let a=i.address.toLowerCase()===t.toLowerCase(),r=i.caip2Network===e;if(!a||!r)return[];let s={data:{accountAddress:i.address,chainId:i.caip2Network},message:"",signature:""};return this.emit("sessionChanged",s),this.setAppKitAccountUser(i),[s]}catch{return[]}}async revokeSession(e,t){return Promise.resolve(this.clearStorageTokens())}async setSessions(e){if(0===e.length)this.clearStorageTokens();else{let t=e.find(e=>e.data.chainId===(0,h.kg)()?.caipNetworkId)||e[0];await this.addSession(t)}}getRequired(){return this.required}async getSessionAccount(){if(!this.getStorageToken(this.localAuthStorageKey))throw Error("Not authenticated");return this.request({method:"GET",key:"me",body:void 0,query:{includeAppKitAccount:!0},headers:["auth"]})}async setSessionAccountMetadata(e=null){if(!this.getStorageToken(this.localAuthStorageKey))throw Error("Not authenticated");return this.request({method:"PUT",key:"account-metadata",body:{metadata:e},headers:["auth"]})}on(e,t){return this.listeners[e].push(t),()=>{this.listeners[e]=this.listeners[e].filter(e=>e!==t)}}
4removeAllListeners(){Object.keys(this.listeners).forEach(e=>{this.listeners[e]=[]})}async requestEmailOtp({email:e,account:t}){let i=await this.request({method:"POST",key:"otp",body:{email:e,account:t}});return this.otpUuid=i.uuid,this.messenger.resources=[`email:${e}`],i}confirmEmailOtp({code:e}){return this.request({method:"PUT",key:"otp",body:{code:e},headers:["otp"]})}async request({method:e,key:t,query:i,body:a,headers:r}){let{projectId:s,st:n,sv:o}=this.getSDKProperties(),l=new URL(`${d.o.W3M_API_URL}/auth/v1/${String(t)}`);l.searchParams.set("projectId",s),l.searchParams.set("st",n),l.searchParams.set("sv",o),i&&Object.entries(i).forEach(([e,t])=>l.searchParams.set(e,String(t)));let c=await fetch(l,{method:e,body:a?JSON.stringify(a):void 0,headers:Array.isArray(r)?r.reduce((e,t)=>{switch(t){case"nonce":e["x-nonce-jwt"]=`Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;break;case"auth":e.Authorization=`Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;break;case"otp":this.otpUuid&&(e["x-otp"]=this.otpUuid)}return e},{}):void 0});if(!c.ok)throw Error(await c.text());return c.headers.get("content-type")?.includes("application/json")?c.json():null}getStorageToken(e){return s.Ud.getItem(e)}setStorageToken(e,t){s.Ud.setItem(t,e)}clearStorageTokens(){this.otpUuid=null,s.Ud.removeItem(this.localAuthStorageKey),s.Ud.removeItem(this.localNonceStorageKey),this.emit("sessionChanged",void 0)}async getNonce(){let{nonce:e,token:t}=await this.request({method:"GET",key:"nonce"});return this.setStorageToken(t,this.localNonceStorageKey),e}getClientId(){return g.T.state.clientId}getWalletInfo(){let{connectedWalletInfo:e}=p.U.state;if(!e)return;if("social"in e)return{type:"social",social:e.social,identifier:e.identifier};let{name:t,icon:i}=e,a="unknown";switch(e.type){case w.o.CONNECTOR_TYPE_EXTERNAL:case w.o.CONNECTOR_TYPE_INJECTED:case w.o.CONNECTOR_TYPE_ANNOUNCED:a="extension";break;case w.o.CONNECTOR_TYPE_WALLET_CONNECT:a="walletconnect";break;default:a="unknown"}return{type:a,name:t,icon:i}}getSDKProperties(){return m.N._getSdkProperties()}emit(e,t){this.listeners[e].forEach(e=>e(t))}setAppKitAccountUser(e){let{email:t}=e;
4t&&Object.values(d.o.CHAIN).forEach(e=>{o.W.setAccountProp("user",{email:t},e)})}}let b=(0,a.AH)`
5  .hero {
6    display: flex;
7    flex-direction: column;
8    align-items: center;
9    justify-content: center;
10    gap: var(--wui-spacing-3xs);
11
12    transition-property: margin, height;
13    transition-duration: var(--wui-duration-md);
14    transition-timing-function: var(--wui-ease-out-power-1);
15    margin-top: -100px;
16
17    &[data-state='loading'] {
18      margin-top: 0px;
19    }
20
21    position: relative;
22    &:after {
23      content: '';
24      position: absolute;
25      bottom: 0;
26      height: 252px;
27      width: 360px;
28      background: radial-gradient(
29        96.11% 53.95% at 50% 51.28%,
30        transparent 0%,
31        color-mix(in srgb, var(--wui-color-bg-100) 5%, transparent) 49%,
32        color-mix(in srgb, var(--wui-color-bg-100) 65%, transparent) 99.43%
33      );
34    }
35  }
36
37  .hero-main-icon {
38    width: 176px;
39    transition-property: background-color;
40    transition-duration: var(--wui-duration-lg);
41    transition-timing-function: var(--wui-ease-out-power-1);
42
43    &[data-state='loading'] {
44      width: 56px;
45    }
46  }
47
48  .hero-row {
49    display: flex;
50    flex-direction: row;
51    align-items: center;
52    justify-content: center;
53    gap: var(--wui-spacing-3xs);
54    flex-wrap: nowrap;
55    min-width: fit-content;
56
57    &:nth-child(1) {
58      transform: translateX(-30px);
59    }
60
61    &:nth-child(2) {
62      transform: translateX(30px);
63    }
64
65    &:nth-child(4) {
66      transform: translateX(40px);
67    }
68
69    transition-property: height;
70    transition-duration: var(--wui-duration-md);
71    transition-timing-function: var(--wui-ease-out-power-1);
72    height: 68px;
73
74    &[data-state='loading'] {
75      height: 0px;
76    }
77  }
78
79  .hero-row-icon {
80    opacity: 0.1;
81    transition-property: opacity;
82    transition-duration: var(--wui-duration-md);
83    transition-timing-function: var(--wui-ease-out-power-1);
84
85    &[data-state='loading'] {
86      opacity: 0;
87    }
88  }
89
90  .email-sufixes {
91    display: flex;
92    flex-direction: row;
93    gap: var(--wui-spacing-3xs);
94    overflow-x: auto;
95    max-width: 100%;
96    margin-top: var(--wui-spacing-s);
97    margin-bottom: calc(-1 * var(--wui-spacing-m));
98    padding-bottom: var(--wui-spacing-m);
99    margin-left: calc(-1 * var(--wui-spacing-m));
100    margin-right: calc(-1 * var(--wui-spacing-m));
101    padding-left: var(--wui-spacing-m);
102    padding-right: var(--wui-spacing-m);
103
104    &::-webkit-scrollbar {
105      display: none;
106    }
107  }
108
109  .recent-emails {
110    display: flex;
111    flex-direction: column;
112    padding: var(--wui-spacing-s) 0;
113    border-top: 1px solid var(--wui-color-gray-glass-005);
114    border-bottom: 1px solid var(--wui-color-gray-glass-005);
115  }
116
117  .recent-emails-heading {
118    margin-bottom: var(--wui-spacing-s);
119  }
120
121  .recent-emails-list-item {
122    --wui-color-gray-glass-002: transparent;
123  }
124`;var E=function(e,t,i,a){var r,s=arguments.length,n=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};let k=class extends a.WF{constructor(){super(...arguments),this.email=n.I.state.data?.email??o.W.getAccountData()?.user?.email??"",this.address=o.W.getAccountData()?.address??"",this.loading=!1,this.appName=l.H.state.metadata?.name??"AppKit",this.siwx=l.H.state.siwx,this.isRequired=Array.isArray(l.H.state.remoteFeatures?.emailCapture)&&l.H.state.remoteFeatures?.emailCapture.includes("required"),this.recentEmails=this.getRecentEmails()}connectedCallback(){this.siwx&&this.siwx instanceof v||c.P.showError("ReownAuthentication is not initialized."),super.connectedCallback()}firstUpdated(){this.loading=!1,this.recentEmails=this.getRecentEmails(),this.email&&this.onSubmit()}render(){return(0,a.qy)`
125      <wui-flex flexDirection="column" .padding=${["3xs","m","m","m"]} gap="l">
126        ${this.hero()} ${this.paragraph()} ${this.emailInput()} ${this.recentEmailsWidget()}
127        ${this.footerActions()}
128      </wui-flex>
129    `}hero(){return(0,a.qy)`
130      <div class="hero" data-state=${this.loading?"loading":"default"}>
131        ${this.heroRow(["id","mail","wallet","x","solana","qrCode"])}
132        ${this.heroRow(["mail","farcaster","wallet","discord","mobile","qrCode"])}
133        <div class="hero-row">
134          ${this.heroIcon("github")} ${this.heroIcon("bank")}
135          <wui-icon-box
136            size="xl"
137            iconSize="xxl"
138            iconColor=${this.loading?"fg-100":"accent-100"}
139            backgroundColor=${this.loading?"fg-100":"accent-100"}
140            icon=${this.loading?"id":"user"}
141            isOpaque
142            class="hero-main-icon"
143            data-state=${this.loading?"loading":"default"}
144          >
145          </wui-icon-box>
146          ${this.heroIcon("id")} ${this.heroIcon("card")}
147        </div>
148        ${this.heroRow(["google","id","github","verify","apple","mobile"])}
149      </div>
150    `}heroRow(e){return(0,a.qy)`
151      <div class="hero-row" data-state=${this.loading?"loading":"default"}>
152        ${e.map(this.heroIcon.bind(this))}
153      </div>
154    `}heroIcon(e){return(0,a.qy)`
155      <wui-icon-box
156        size="xl"
157        iconSize="xxl"
158        iconColor="fg-100"
159        backgroundColor="fg-100"
160        icon=${e}
161        data-state=${this.loading?"loading":"default"}
162        isOpaque
163        class="hero-row-icon"
164      >
165      </wui-icon-box>
166    `}paragraph(){return this.loading?(0,a.qy)`
167        <wui-text variant="paragraph-400" color="fg-200" align="center"
168          >We are verifying your account with email
169          <wui-text variant="paragraph-600" color="accent-100">${this.email}</wui-text> and address
170          <wui-text variant="paragraph-600" color="fg-100">
171            ${u.Zv.getTruncateString({string:this.address,charsEnd:4,charsStart:4,truncate:"middle"})} </wui-text
172          >, please wait a moment.</wui-text
173        >
174      `:this.isRequired?(0,a.qy)`
175        <wui-text variant="paragraph-600" color="fg-100" align="center">
176          ${this.appName} requires your email for authentication.
177        </wui-text>
178      `:(0,a.qy)`
179      <wui-flex flexDirection="column" gap="xs" alignItems="center">
180        <wui-text variant="paragraph-600" color="fg-100" align="center" size>
181          ${this.appName} would like to collect your email.
182        </wui-text>
183
184        <wui-text variant="small-400" color="fg-200" align="center">
185          Don't worry, it's optional&mdash;
185you can skip this step.
186        </wui-text>
187      </wui-flex>
188    `}emailInput(){if(this.loading)return null;let e=e=>{"Enter"===e.key&&this.onSubmit()},t=e=>{this.email=e.detail};return(0,a.qy)`
189      <wui-flex flexDirection="column">
190        <wui-email-input
191          .value=${this.email}
192          .disabled=${this.loading}
193          @inputChange=${t}
194          @keydown=${e}
195        ></wui-email-input>
196
197        <w3m-email-suffixes-widget
198          .email=${this.email}
199          @change=${t}
200        ></w3m-email-suffixes-widget>
201      </wui-flex>
202    `}recentEmailsWidget(){if(0===this.recentEmails.length||this.loading)return null;let e=e=>{this.email=e.detail,this.onSubmit()};return(0,a.qy)`
203      <w3m-recent-emails-widget
204        .emails=${this.recentEmails}
205        @select=${e}
206      ></w3m-recent-emails-widget>
207    `}footerActions(){return(0,a.qy)`
208      <wui-flex flexDirection="row" fullWidth gap="s">
209        ${this.isRequired?null:(0,a.qy)`<wui-button
210              size="lg"
211              variant="neutral"
212              fullWidth
213              .disabled=${this.loading}
214              @click=${this.onSkip.bind(this)}
215              >Skip this step</wui-button
216            >`}
217
218        <wui-button
219          size="lg"
220          variant="main"
221          type="submit"
222          fullWidth
223          .disabled=${!this.email||!this.isValidEmail(this.email)}
224          .loading=${this.loading}
225          @click=${this.onSubmit.bind(this)}
226        >
227          Continue
228        </wui-button>
229      </wui-flex>
230    `}async onSubmit(){let e=o.W.getActiveCaipAddress();if(!e)throw Error("Account is not connected.");if(!this.isValidEmail(this.email))return void c.P.showError("Please provide a valid email.");try{this.loading=!0;let t=await this.siwx.requestEmailOtp({email:this.email,account:e});this.pushRecentEmail(this.email),null===t.uuid?n.I.replace("SIWXSignMessage"):n.I.replace("DataCaptureOtpConfirm",{email:this.email})}catch(e){c.P.showError("Failed to send email OTP"),this.loading=!1}}onSkip(){n.I.replace("SIWXSignMessage")}getRecentEmails(){let e=s.Ud.getItem(s.Ws.RECENT_EMAILS);return(e?e.split(","):[]).filter(this.isValidEmail.bind(this)).slice(0,3)}pushRecentEmail(e){let t=Array.from(new Set([e,...this.getRecentEmails()])).slice(0,3);s.Ud.setItem(s.Ws.RECENT_EMAILS,t.join(","))}isValidEmail(e){return/^\S+@\S+\.\S+$/u.test(e)}};k.styles=[b],E([(0,r.wk)()],k.prototype,"email",void 0),E([(0,r.wk)()],k.prototype,"address",void 0),E([(0,r.wk)()],k.prototype,"loading",void 0),E([(0,r.wk)()],k.prototype,"appName",void 0),E([(0,r.wk)()],k.prototype,"siwx",void 0),E([(0,r.wk)()],k.prototype,"isRequired",void 0),E([(0,r.wk)()],k.prototype,"recentEmails",void 0),k=E([(0,u.EM)("w3m-data-capture-view")],k);var S=i(70710),$=function(e,t,i,a){var r,s=arguments.length,n=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};let I=class extends S.W3mEmailOtpWidget{constructor(){super(...arguments),this.siwx=l.H.state.siwx,this.onOtpSubmit=async e=>{await this.siwx.confirmEmailOtp({code:e}),n.I.replace("SIWXSignMessage")},this.onOtpResend=async e=>{let t=o.W.getAccountData();if(!t?.caipAddress)throw Error("No account data found");await this.siwx.requestEmailOtp({email:e,account:t.caipAddress})}}connectedCallback(){this.siwx&&this.siwx instanceof v||c.P.showError("ReownAuthentication is not initialized."),super.connectedCallback()}shouldSubmitOnOtpChange(){return this.otp.length===S.W3mEmailOtpWidget.OTP_LENGTH}};$([(0,r.wk)()],I.prototype,"siwx",void 0),I=$([(0,u.EM)("w3m-data-capture-otp-confirm-view")],I);var N=function(e,t,i,a){var r,s=arguments.length,n=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};
230let A=["@gmail.com","@outlook.com","@yahoo.com","@hotmail.com","@aol.com","@icloud.com","@zoho.com"],C=class extends a.WF{constructor(){super(...arguments),this.email=""}render(){let e=A.filter(this.filter.bind(this)).map(this.item.bind(this));return 0===e.length?null:(0,a.qy)`<div class="email-sufixes">${e}</div>`}filter(e){if(!this.email)return!1;let t=this.email.split("@");if(t.length<2)return!0;let i=t.pop();return e.includes(i)&&e!==`@${i}`}item(e){let t=()=>{let t=this.email.split("@");t.length>1&&t.pop();let i=t[0]+e;this.dispatchEvent(new CustomEvent("change",{detail:i,bubbles:!0,composed:!0}))};return(0,a.qy)`<wui-button variant="neutral" size="sm" @click=${t}
231      >${e}</wui-button
232    >`}};C.styles=[b],N([(0,r.MZ)()],C.prototype,"email",void 0),C=N([(0,u.EM)("w3m-email-suffixes-widget")],C);var O=function(e,t,i,a){var r,s=arguments.length,n=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,i,n),n};let q=class extends a.WF{constructor(){super(...arguments),this.emails=[]}render(){return 0===this.emails.length?null:(0,a.qy)`<div class="recent-emails">
233      <wui-text variant="micro-600" color="fg-200" class="recent-emails-heading"
234        >Recently used emails</wui-text
235      >
236      ${this.emails.map(this.item.bind(this))}
237    </div>`}item(e){let t=()=>{this.dispatchEvent(new CustomEvent("select",{detail:e,bubbles:!0,composed:!0}))};return(0,a.qy)`<wui-list-item
238      @click=${t}
239      ?chevron=${!0}
240      icon="mail"
241      iconVariant="overlay"
242      class="recent-emails-list-item"
243    >
244      <wui-text variant="paragraph-500" color="fg-100">${e}</wui-text>
245    </wui-list-item>`}};q.styles=[b],O([(0,r.MZ)()],q.prototype,"emails",void 0),q=O([(0,u.EM)("w3m-recent-emails-widget")],q)}}]);

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.