PageSourceSearch

https://portfoliogenius.ai/_next/static/chunks/3343.d028a94bcd258bde.js

js portfoliogenius.ai collected 2026-10-04 04:20:27 UTC 10,730 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="348c4b31-9a07-4dec-9ff9-061683e89bec",e._sentryDebugIdIdentifier="sentry-dbid-348c4b31-9a07-4dec-9ff9-061683e89bec")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3343],{93343:(e,s,t)=>{t.r(s),t.d(s,{default:()=>h});var a=t(95155),n=t(12115),r=t(3504),l=t(71211),d=t(82957),i=t(27832),c=t(88061),o=t(61316),m=t(46516),x=t(77012),u=t(31885),b=t(1365),g=t(71726),p=t(48449);function h(e){let{message:s,portfolio:t,positions:h=[],onTradeConverted:f}=e,{addToast:j}=(0,i.d)(),[y,v]=(0,n.useState)(!1),[N,k]=(0,n.useState)(!1),[w,T]=(0,n.useState)(null),[C,S]=(0,n.useState)(!1),[A,I]=(0,n.useState)(""),[D,E]=(0,n.useState)(null),[M,_]=(0,n.useState)(!0),[z,P]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!s.suggestedTradeId)return void _(!1);(async()=>{try{let e=(await (0,d.getSuggestedTradesByIds)(t.id,[s.suggestedTradeId])).get(s.suggestedTradeId);e&&E(e)}catch(e){console.error("Failed to fetch suggested trade:",e)}finally{_(!1)}})()},[s.suggestedTradeId,t.id]);let R=(0,n.useCallback)(e=>!!e.expiresAt&&new Date(e.expiresAt)<new Date,[]),L=(0,n.useCallback)(e=>"pending"===e.status&&R(e)?"expired":e.status,[R]);if(!s.suggestedTradeId)return null;if(M)return(0,a.jsx)("div",{className:"bg-purple-50 border border-purple-200 rounded-lg p-4 mt-3",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(b.y$,{size:"sm",color:"border-purple-600"}),(0,a.jsx)("span",{className:"text-sm text-ink-body",children:"Loading trade details..."})]})});if(!D)return(0,a.jsx)("div",{className:"bg-slate-50 border border-hairline rounded-lg p-4 mt-3",children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsx)("span",{className:"text-sm text-ink-muted",children:"Trade suggestion not found"})})});let F=(e,a,n)=>{(async()=>{await (0,d.updateSuggestedTradeStatus)(t.id,e,a,n),await (0,d.updateTradeInMessage)(t.id,s.id,e,a,n)})().catch(e=>{j("Failed to update trade status: ".concat(e instanceof Error?e.message:"Unknown error"),"error")})},q=()=>{v(!1),k(!1),T(null)},B=L(D);return(0,a.jsxs)(b.Zp,{variant:"tile",padding:"p-0",className:"mt-4 overflow-hidden","data-sentry-element":"Card","data-sentry-component":"SingleTradeMessageComponent","data-sentry-source-file":"SingleTradeMessageComponent.tsx",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-hairline bg-slate-50/50",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(x.A,{size:18,className:"text-accent-soft","data-sentry-element":"Gift","data-sentry-source-file":"SingleTradeMessageComponent.tsx"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-accent-soft",children:"Trade Suggestion"}),(0,a.jsx)("span",{className:"text-sm text-ink-muted",children:D.createdAt.toLocaleDateString()})]}),(0,a.jsx)("span",{className:"px-3 py-1 rounded-full text-xs font-medium border ".concat((e=>{switch(e){case"pending":return"border-green-500 text-green-600 bg-white";case"converted":return"border-green-500 text-green-600 bg-green-50";case"dismissed":return"border-slate-400 text-slate-500 bg-slate-50";case"expired":return"border-orange-400 text-orange-500 bg-orange-50";default:return"border-slate-400 text-slate-500 bg-white"}})(B)),children:B})]}),(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsxs)("h4",{className:"text-lg font-bold text-ink",children:[D.action.toUpperCase()," ",(0,a.jsx)(g.A,{ticker:D.symbol,"data-sentry-element":"TickerPopover","data-sentry-source-file":"SingleTradeMessageComponent.tsx",children:(0,a.jsx)("span",{className:"cursor-pointer hover:underline",children:D.symbol})})]}),(0,a.jsxs)("span",{className:"px-2.5 py-1 rounded-full text-xs font-medium ".concat((e=>{switch(e){case"high":return"bg-slate-100 text-slate-700 border border-slate-200";case"medium":return"bg-slate-100 text-slate-600 border border-slate-200";default:return"bg-slate-50 text-slate-500 border border-slate-200"}})(D.priority)),children:[D.priority," priority"]})]}),"pending"===B&&(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[t.alpacaAccountId?(0,a.jsxs)("button",{onClick:()=>P(!0),className:"px-4 py-2 bg-orange-500 text-white text-sm font-medium rounded-lg hover:bg-orange-600 transition-colors disabled:bg-slate-400 flex items-center space-x-2",children:[(0,a.jsxs)("svg",{viewBox:"0 0 24 24",className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,a.jsx)("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),(0,a.jsx)("path",{d:"M2 17l10 5 10-5"}),(0,a.jsx)("path",{d:"M2 12l10 5 10-5"})]}),(0,a.jsx)("span",{children:"Execute on Alpaca"})]}):(0,a.jsx)("button",{onClick:()=>
1{if("sell"===(0,l.MR)(D.action)){let e=h.find(e=>e.symbol===D.symbol&&"open"===e.status);e?(T(e),k(!0)):j("No open position found for ".concat(D.symbol),"error")}else v(!0)},className:"px-4 py-2 bg-slate-900 text-white text-sm font-medium rounded-full hover:bg-slate-800 transition-colors disabled:bg-slate-400",children:"Execute"}),(0,a.jsx)("button",{onClick:()=>{I(""),S(!0)},className:"px-4 py-2 bg-slate-800 text-white text-sm font-medium rounded-lg hover:bg-slate-900 transition-colors disabled:bg-slate-400",children:"Dismiss"})]})]}),(0,a.jsx)("p",{className:"text-sm text-ink-body mb-4",children:D.name||D.symbol}),(0,a.jsxs)("div",{className:"grid grid-cols-4 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-ink-label block mb-1",children:"Quantity"}),(0,a.jsx)("p",{className:"text-base font-semibold tabular-nums text-ink",children:D.quantity})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-ink-label block mb-1",children:"Est. Price"}),(0,a.jsx)("p",{className:"text-base font-semibold tabular-nums text-ink",children:(0,r.vv)(D.estimatedPrice)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-ink-label block mb-1",children:"Est. Total"}),(0,a.jsx)("p",{className:"text-base font-semibold tabular-nums text-ink",children:(0,r.vv)(D.quantity*D.estimatedPrice)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-ink-label block mb-1",children:"Type"}),(0,a.jsx)("p",{className:"text-base font-semibold tabular-nums text-ink capitalize",children:D.type})]})]}),(0,a.jsx)("div",{className:"bg-slate-50/70 border border-hairline rounded-tile p-3",children:(0,a.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,a.jsx)(u.A,{size:16,className:"text-accent-soft mt-0.5 flex-shrink-0","data-sentry-element":"Lightbulb","data-sentry-source-file":"SingleTradeMessageComponent.tsx"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h5",{className:"text-sm font-medium text-slate-800 mb-1",children:"AI Rationale"}),(0,a.jsx)("p",{className:"text-sm text-ink-secondary leading-relaxed",children:D.rationale})]})]})}),"dismissed"===B&&D.dismissedReason&&(0,a.jsxs)("div",{className:"mt-3 bg-slate-50 border border-hairline rounded-lg p-3",children:[(0,a.jsx)("h5",{className:"text-sm font-medium text-slate-800 mb-1",children:"Dismissal Reason"}),(0,a.jsx)("p",{className:"text-sm text-ink-secondary",children:D.dismissedReason})]}),"expired"===B&&(0,a.jsx)("div",{className:"mt-3 bg-orange-50 border border-orange-200 rounded-lg p-3",children:(0,a.jsx)("p",{className:"text-sm text-orange-700",children:"This trade suggestion has expired and is no longer valid."})})]}),y&&D&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-surface rounded-lg p-6 max-w-md w-full mx-4 max-h-[90vh] overflow-y-auto",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-ink mb-4",children:["Execute Trade: ",D.symbol]}),(0,a.jsx)(c.default,{portfolioId:t.id,suggestedTrade:D,isAlpacaPortfolio:!!t.alpacaAccountId,onSuccess:()=>{E(e=>e?{...e,status:"converted",convertedAt:new Date}:null),v(!1),j("Trade executed successfully: ".concat(D.symbol),"success"),f&&f(),F(D.id,"converted")},onCancel:q})]})}),N&&w&&D&&(0,a.jsx)(o.default,{position:w,suggestedTrade:D,onSuccess:()=>{E(e=>e?{...e,status:"converted",convertedAt:new Date}:null),k(!1),T(null),j("Position closed successfully: ".concat(D.symbol),"success"),f&&f(),F(D.id,"converted")},onCancel:q},D.id),C&&D&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-surface rounded-lg p-6 max-w-md w-full mx-4",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-ink mb-4",children:["Dismiss Trade Suggestion: ",D.symbol]}),(0,a.jsx)("p",{className:"text-slate-800 mb-4",children:"Are you sure you want to dismiss this trade suggestion? This action cannot be undone."}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{htmlFor:"dismiss-reason",className:"block text-sm font-medium text-ink-secondary mb-2",children:"Reason (optional)"}),(0,a.jsx)("textarea",{id:"dismiss-reason",value:A,onChange:e=>I(e.target.value),placeholder:"Enter a reason for dismissing this trade suggestion...",className:"w-full px-3 py-2 border border-hairline rounded-md focus:outline-none focus:ring-2 focus:ring-ink-label text-ink placeholder-ink-muted",rows:3})]}),(0,a.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,a.jsx)("button",{onClick:()=>{S(!1),I("")},className:"px-4 py-2 text-ink-secondary bg-slate-200 rounded-md hover:bg-slate-300 transition-colors",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>{let e=A.trim()||void 0;E(s=>s?{...s,status:"dismissed",dismissedAt:new Date,dismissedReason:e}:null),S(!1),I(""),j("Trade suggestion dismissed: ".concat(D.symbol),"info"),F(D.id,"dismissed",e)},className:"px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors disabled:bg-slate-400",children:"Dismiss Trade"})]})]})}),z&&D&&(0,a.jsx)(m.A,{trade:D,portfolioId:t.id,isPaperTrading:(0,p.Zf)(t),onSuccess:(e,s)=>{if(!D)return;E(e=>e?{...e,status:"converted",convertedAt:new Date}:null),P(!1);let t=s?" at ".concat((0,r.vv)(s)):"";j("Alpaca order executed successfully: ".concat(D.symbol).concat(t),"success"),f&&f(),F(D.id,"converted")},onCancel:()=>{P(!1)}})]})}}}]);

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.