1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34549],{33570:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/brokerage/connect",function(){return n(4594)}])},4594:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return b}});var r=n(85893),a=n(20726),s=n.n(a),i=n(67294),o=n(31040),l=n(52042),c=n(43840),d=n(7644),g=n(26548),m=n(84091),u=n(76617),h=n(81986),x=n(92814),p=n(17349),f=n(9008),y=n.n(f);let w=[{slug:"SCHWAB",name:"Charles Schwab",logo:"/images/brokerages/schwab.png"},{slug:"FIDELITY",name:"Fidelity",logo:"/images/brokerages/fidelity.png"},{slug:"ETRADE",name:"E*TRADE",logo:"/images/brokerages/etrade.png"},{slug:"IBKR",name:"Interactive Brokers",logo:"/images/brokerages/ibkr.png"},{slug:"VANGUARD",name:"Vanguard",logo:"/images/brokerages/vanguard.png"}];var j=n(97979),b=()=>{var e;let[t,n]=(0,i.useState)("idle"),[a,f]=(0,i.useState)(null),[b,S]=(0,i.useState)(null),[N,v]=(0,i.useState)(null),[k,_]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=()=>{let e=window!==window.parent,t=window.innerWidth<500;_(e||t)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,i.useEffect)(()=>{let e=localStorage.getItem("snaptrade_credentials");if(e)try{let t=JSON.parse(e);v(t)}catch(e){}},[]);let C=()=>{let e=localStorage.getItem("snaptrade_user_id");if(e)return e;let t="mxls_".concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9));return localStorage.setItem("snaptrade_user_id",t),t},E=async e=>{let t=await fetch("".concat((0,j.h_)(),"/snaptrade/register"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})});if(!t.ok){let e=await t.json();if("USER_ALREADY_EXISTS"===e.code){let e=localStorage.getItem("snaptrade_credentials");if(e)return JSON.parse(e);throw Error("User already registered but credentials not found. Please contact support.")}throw Error(e.error||"Failed to register")}return await t.json()},z=async(e,t)=>{let n=await fetch("".concat((0,j.h_)(),"/snaptrade/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e.userId,userSecret:e.userSecret,broker:t,connectionType:"trade"})});if(!n.ok)throw Error((await n.json()).error||"Failed to get connection URL");return(await n.json()).redirectURI},I=async e=>{f(null),S(e||null);try{let t=N;if(!t){n("registering");let e=C();t=await E(e),localStorage.setItem("snaptrade_credentials",JSON.stringify(t)),v(t)}n("connecting");let r=await z(t,e);n("redirecting"),window!==window.parent?window.open(r,"_blank","width=600,height=700")||window.parent.postMessage({type:"snaptrade_redirect",url:r},"*"):window.location.href=r}catch(e){console.error("Connection error:",e),f(e instanceof Error?e.message:"Connection failed"),n("error")}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(y(),{children:[(0,r.jsx)("title",{className:"jsx-ece0de69d24d0d58",children:"Connect Brokerage | MarketXLS"}),(0,r.jsx)("meta",{name:"description",content:"Connect your brokerage account to MarketXLS",className:"jsx-ece0de69d24d0d58"})]}),(0,r.jsx)(h.Z,{fluid:k,className:k?"":"py-5",style:{maxWidth:k?"100%":700},children:"idle"!==t&&"error"!==t?(0,r.jsxs)("div",{className:"text-center",style:{padding:k?"16px":"40px 20px"},children:[(0,r.jsx)(o.Z,{animation:"border",size:k?"sm":void 0,variant:"primary",className:"mb-2"}),(0,r.jsxs)("div",{style:{fontSize:k?"12px":"18px",fontWeight:500},children:["registering"===t&&"Setting up...","connecting"===t&&"Preparing...","redirecting"===t&&"Redirecting..."]}),b&&(0,r.jsx)("div",{style:{fontSize:k?"10px":"14px",color:"#6c757d"},children:(null===(e=w.find(e=>e.slug===b))||void 0===e?void 0:e.name)||b})]}):k?(0,r.jsxs)("div",{style:{padding:"12px"},children:[(0,r.jsxs)("div",{className:"text-center mb-3",children:[(0,r.jsx)(x.G,{icon:p.nNP,style:{fontSize:"24px"},className:"text-primary mb-2"}),(0,r.jsx)("div",{style:{fontSize:"14px",fontWeight:600},children:"Connect Brokerage"}),(0,r.jsx)("div",{style:{fontSize:"10px",color:"#6c757d"},children:"Import portfolio holdings"})]}),a&&(0,r.jsx)(l.Z,{variant:"danger",className:"py-1 px-2 mb-2",style:{fontSize:"10px"},children:a}),(0,r.jsx)(c.Z,{variant:"flush",style:{fontSize:"12px"},children:w.map(e=>(0,r.jsxs)(c.Z.Item,{action:!0,onClick:()=>I(e.slug),className:"d-flex align-items-center px-2 py-2",style:{cursor:"pointer"},children:[(0,r.jsx)("div",{className:"me-2 d-flex align-items-center justify-content-center",style:{width:28,height:28,backgroundColor:"#f8f9fa",borderRadius:4},children:(0,r.jsx)(x.G,{icon:p.P88,style:{fontSize:"12px"},className:"text-secondary"})}),(0,r.jsx)("div",{style:{fontSize:"12px",fontWeight:500},children:e.name})]},e.slug))}),(0,r.jsx)("div",{className:"text-center mt-2",children:(0,r.jsx)(d.Z,{variant:"link",size:"sm",style:{fontSize:"10px"},onClick:()=>I(),children:"Other Brokerages..."})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-center mb-4",children:[(0,r.jsx)(x.G,{icon:p.nNP,size:"3x",className:"text-primary mb-3"}),(0,r.jsx)("h2",{children:"Connect Your Brokerage"}),(0,r.jsx)("p",{className:"text-muted",children:"Securely link your brokerage account to import your portfolio holdings."})]}),a&&(0,r.jsxs)(l.Z,{variant:"danger",className:"mb-4",children:[(0,r.jsx)(x.G,{icon:p.eHv,className:"me-2"}),a]}
1),(0,r.jsx)(g.Z,{className:"g-3",children:w.map(e=>(0,r.jsx)(m.Z,{xs:12,md:6,children:(0,r.jsx)(u.Z,{className:"h-100 cursor-pointer hover-shadow",onClick:()=>I(e.slug),style:{cursor:"pointer"},children:(0,r.jsxs)(u.Z.Body,{className:"d-flex align-items-center",children:[(0,r.jsx)("div",{className:"me-3 d-flex align-items-center justify-content-center",style:{width:48,height:48,backgroundColor:"#f8f9fa",borderRadius:8},children:(0,r.jsx)(x.G,{icon:p.P88,size:"lg",className:"text-secondary"})}),(0,r.jsxs)("div",{className:"flex-grow-1",children:[(0,r.jsx)("h5",{className:"mb-1",children:e.name}),(0,r.jsx)("small",{className:"text-muted",children:"Click to connect"})]})]})})},e.slug))}),(0,r.jsxs)("div",{className:"text-center mt-4",children:[(0,r.jsx)(d.Z,{variant:"outline-primary",onClick:()=>I(),children:"Connect Other Brokerage"}),(0,r.jsxs)("p",{className:"text-muted mt-3",style:{fontSize:"0.85rem"},children:["Your credentials are never shared with MarketXLS.",(0,r.jsx)("br",{}),"Connection is secured via OAuth and bank-level encryption."]})]})]})}),(0,r.jsx)(s(),{id:"ece0de69d24d0d58",children:".hover-shadow:hover{-webkit-box-shadow:0 4px 12px rgba(0,0,0,.1);-moz-box-shadow:0 4px 12px rgba(0,0,0,.1);box-shadow:0 4px 12px rgba(0,0,0,.1);-webkit-transform:translatey(-2px);-moz-transform:translatey(-2px);-ms-transform:translatey(-2px);-o-transform:translatey(-2px);transform:translatey(-2px);-webkit-transition:all.2s ease;-moz-transition:all.2s ease;-o-transition:all.2s ease;transition:all.2s ease}.cursor-pointer{cursor:pointer}"})]})}},97979:function(e,t,n){"use strict";n.d(t,{CX:function(){return a},Rt:function(){return s},h_:function(){return r}});let r=()=>"localhost"===window.location.hostname?"/api/com":"/api",a=()=>{let e=new Date,t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getDate(),r=e.getHours(),a=e.getMinutes().toString().padStart(2,"0"),s=r>=12?"pm":"am";return r=r%12||12,"".concat(t).concat(n," ").concat(r,"-").concat(a).concat(s)},s=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=t.filter(Boolean).map(e=>e.replace(/[\\/?*[\]:]/g,"").trim()).filter(e=>e.length>0);if(0===r.length)return"Sheet";let a=r.join(" ");if(a.length<=31)return a;if(r.length>=3){let e=r[0],t=r[r.length-1],n=r.slice(1,-1).join(" "),a=31-e.length-t.length-2;if(a>=3)return"".concat(e," ").concat(n.substring(0,a)," ").concat(t)}return a.substring(0,31)}}},function(e){e.O(0,[38523,92814,17813,92888,49774,40179],function(){return e(e.s=33570)}),_N_E=e.O()}]);
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.