oneshot-gtm-server 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/bin.mjs +2192 -433
  2. package/dist/bin.mjs.map +1 -1
  3. package/dist/web/assets/Badge-DE7L41a6.js +2 -0
  4. package/dist/web/assets/Badge-DE7L41a6.js.map +1 -0
  5. package/dist/web/assets/Button-NJ1UVzeB.js +2 -0
  6. package/dist/web/assets/Button-NJ1UVzeB.js.map +1 -0
  7. package/dist/web/assets/EmptyNote-DkmaZWuo.js +2 -0
  8. package/dist/web/assets/{EmptyNote-C4quX2dg.js.map → EmptyNote-DkmaZWuo.js.map} +1 -1
  9. package/dist/web/assets/Field-B4mT8TGa.js +2 -0
  10. package/dist/web/assets/Field-B4mT8TGa.js.map +1 -0
  11. package/dist/web/assets/{Modal-BVbdN0gj.js → Modal-frAt7msr.js} +2 -2
  12. package/dist/web/assets/{Modal-BVbdN0gj.js.map → Modal-frAt7msr.js.map} +1 -1
  13. package/dist/web/assets/Skeleton-d2p06ghN.js +2 -0
  14. package/dist/web/assets/{Skeleton-D7Z-VTMo.js.map → Skeleton-d2p06ghN.js.map} +1 -1
  15. package/dist/web/assets/cadences-CsU8vKw2.js +2 -0
  16. package/dist/web/assets/cadences-CsU8vKw2.js.map +1 -0
  17. package/dist/web/assets/chevron-right-BXb7J1cp.js +2 -0
  18. package/dist/web/assets/chevron-right-BXb7J1cp.js.map +1 -0
  19. package/dist/web/assets/inbox-Dzd9QYT4.js +2 -0
  20. package/dist/web/assets/inbox-Dzd9QYT4.js.map +1 -0
  21. package/dist/web/assets/index-ByTPAanr.css +2 -0
  22. package/dist/web/assets/index-CzTgATNQ.js +60 -0
  23. package/dist/web/assets/index-CzTgATNQ.js.map +1 -0
  24. package/dist/web/assets/loader-circle-BylpxA-u.js +2 -0
  25. package/dist/web/assets/loader-circle-BylpxA-u.js.map +1 -0
  26. package/dist/web/assets/{measure-DLFAK1ZQ.js → measure-S3BWSb2L.js} +2 -2
  27. package/dist/web/assets/{measure-DLFAK1ZQ.js.map → measure-S3BWSb2L.js.map} +1 -1
  28. package/dist/web/assets/plays-DHIZA49D.js +2 -0
  29. package/dist/web/assets/plays-DHIZA49D.js.map +1 -0
  30. package/dist/web/assets/queue-ClVxfeJ0.js +2 -0
  31. package/dist/web/assets/queue-ClVxfeJ0.js.map +1 -0
  32. package/dist/web/assets/receipts-BgXV3-De.js +2 -0
  33. package/dist/web/assets/receipts-BgXV3-De.js.map +1 -0
  34. package/dist/web/assets/refresh-cw-BpMRSA9y.js +2 -0
  35. package/dist/web/assets/refresh-cw-BpMRSA9y.js.map +1 -0
  36. package/dist/web/assets/routes-B9L9tBMF.js +2 -0
  37. package/dist/web/assets/routes-B9L9tBMF.js.map +1 -0
  38. package/dist/web/assets/run._playName-a3eeybKs.js +5 -0
  39. package/dist/web/assets/run._playName-a3eeybKs.js.map +1 -0
  40. package/dist/web/assets/setup-fs0DMLq4.js +2 -0
  41. package/dist/web/assets/setup-fs0DMLq4.js.map +1 -0
  42. package/dist/web/assets/summarizeRun-BsPt7szF.js +2 -0
  43. package/dist/web/assets/summarizeRun-BsPt7szF.js.map +1 -0
  44. package/dist/web/index.html +3 -3
  45. package/package.json +2 -2
  46. package/dist/web/assets/Button-DPVQuma9.js +0 -2
  47. package/dist/web/assets/Button-DPVQuma9.js.map +0 -1
  48. package/dist/web/assets/EmptyNote-C4quX2dg.js +0 -2
  49. package/dist/web/assets/Field-D9WpcA8z.js +0 -2
  50. package/dist/web/assets/Field-D9WpcA8z.js.map +0 -1
  51. package/dist/web/assets/Skeleton-D7Z-VTMo.js +0 -2
  52. package/dist/web/assets/cadences-B8mwchUk.js +0 -2
  53. package/dist/web/assets/cadences-B8mwchUk.js.map +0 -1
  54. package/dist/web/assets/index-DkobhtBa.js +0 -60
  55. package/dist/web/assets/index-DkobhtBa.js.map +0 -1
  56. package/dist/web/assets/index-Dovjfyuq.css +0 -2
  57. package/dist/web/assets/plays-BUfo3QKZ.js +0 -2
  58. package/dist/web/assets/plays-BUfo3QKZ.js.map +0 -1
  59. package/dist/web/assets/queue-0mKz6GO1.js +0 -2
  60. package/dist/web/assets/queue-0mKz6GO1.js.map +0 -1
  61. package/dist/web/assets/receipts-CzIfb6zY.js +0 -2
  62. package/dist/web/assets/receipts-CzIfb6zY.js.map +0 -1
  63. package/dist/web/assets/routes-BEYqVix5.js +0 -2
  64. package/dist/web/assets/routes-BEYqVix5.js.map +0 -1
  65. package/dist/web/assets/run._playName-CJIjxoPb.js +0 -5
  66. package/dist/web/assets/run._playName-CJIjxoPb.js.map +0 -1
  67. package/dist/web/assets/setup-CFmdIoj0.js +0 -2
  68. package/dist/web/assets/setup-CFmdIoj0.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{s as e}from"./Button-NJ1UVzeB.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
2
+ //# sourceMappingURL=loader-circle-BylpxA-u.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-circle-BylpxA-u.js","names":[],"sources":["../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/loader-circle.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [[\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\", key: \"13zald\" }]];\nconst LoaderCircle = createLucideIcon(\"loader-circle\", __iconNode);\n\nexport { __iconNode, LoaderCircle as default };\n//# sourceMappingURL=loader-circle.mjs.map\n"],"x_google_ignoreList":[0],"mappings":"yCAUA,IAAM,EAAe,EAAiB,gBAAiB,CADnC,CAAC,OAAQ,CAAE,EAAG,8BAA+B,IAAK,SAAU,CAAC,CAC1B,CAAW"}
@@ -1,2 +1,2 @@
1
- import{c as e,n as t,r as n,s as r,t as i,u as a}from"./Button-DPVQuma9.js";import{f as o,n as s}from"./index-DkobhtBa.js";import{t as c}from"./EmptyNote-C4quX2dg.js";import{n as l}from"./Skeleton-D7Z-VTMo.js";var u=a(e(),1),d=r(),f={receipt:`var(--ink-receipt)`,spend:`var(--ink-spend)`,blocked:`var(--ink-blocked)`,signal:`var(--ink-signal)`,muted:`var(--ink-muted)`};function p({values:e,width:n=120,height:r=28,tone:i=`receipt`,animateIn:a=!0,fill:o=!0,tip:s=!0,className:c,"aria-label":l}){let p=(0,u.useId)(),h=f[i],{path:g,area:_,tipX:v,tipY:y,length:b}=(0,u.useMemo)(()=>m(e,n,r),[e,n,r]);return e.length===0?(0,d.jsx)(`svg`,{width:n,height:r,className:t(`block`,c),role:`img`,"aria-label":l??`no data`}):(0,d.jsxs)(`svg`,{width:n,height:r,viewBox:`0 0 ${n} ${r}`,className:t(`block`,c),role:`img`,"aria-label":l??`sparkline`,children:[o&&(0,d.jsx)(`defs`,{children:(0,d.jsxs)(`linearGradient`,{id:`${p}-g`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,d.jsx)(`stop`,{offset:`0%`,stopColor:h,stopOpacity:`0.28`}),(0,d.jsx)(`stop`,{offset:`100%`,stopColor:h,stopOpacity:`0`})]})}),o&&(0,d.jsx)(`path`,{d:_,fill:`url(#${p}-g)`}),(0,d.jsx)(`path`,{d:g,fill:`none`,stroke:h,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,style:a?{strokeDasharray:b,strokeDashoffset:b,animation:`ln-draw 600ms var(--ease-reveal) forwards`,"--ln-dash-length":`${b}`}:void 0}),s&&(0,d.jsx)(`circle`,{cx:v,cy:y,r:1.8,fill:h,style:a?{opacity:0,animation:`ln-settle 280ms var(--ease-reveal) 500ms forwards`}:void 0})]})}function m(e,t,n){let r=t-4,i=n-4,a=Math.min(...e),o=Math.max(...e)-a||1,s=e.length,c=s>1?r/(s-1):0,l=e.map((e,t)=>[2+t*c,2+(1-(e-a)/o)*i]),u=l.map(([e,t],n)=>n===0?`M${e.toFixed(2)},${t.toFixed(2)}`:`L${e.toFixed(2)},${t.toFixed(2)}`).join(` `),d=l[0],f=l[l.length-1],p=`${u} L${f[0].toFixed(2)},${(n-2).toFixed(2)} L${d[0].toFixed(2)},${(n-2).toFixed(2)} Z`,m=0;for(let e=1;e<l.length;e++){let t=l[e][0]-l[e-1][0],n=l[e][1]-l[e-1][1];m+=Math.sqrt(t*t+n*n)}return m=Math.max(m,1),{path:u,area:p,tipX:f[0],tipY:f[1],length:m}}var h=[{label:`all-time`,value:void 0},{label:`30d`,value:30},{label:`7d`,value:7}];function g(){let[e,r]=(0,u.useState)(void 0),a=o({queryKey:[`measure`,`cac`,e],queryFn:()=>s.measureCac(e)}),f=o({queryKey:[`measure`,`rocs`,e],queryFn:()=>s.measureRocs(e)}),m=o({queryKey:[`measure`,`receipts-trend`],queryFn:()=>s.receipts({limit:500}),staleTime:6e4}),g=e??30,b=(0,u.useMemo)(()=>_(m.data?.receipts??[],g),[m.data?.receipts,g]),x=a.data?.spend.reduce((e,t)=>e+t.totalUsd,0)??0,S=a.data?.events.reduce((e,t)=>e+t.replied,0)??0,C=a.data?.events.reduce((e,t)=>e+t.sent,0)??0,w=f.data?.outcomes.reduce((e,t)=>e+t.won,0)??0;return(0,d.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,d.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Measure`}),(0,d.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`$ per reply, per meeting, per won.`})]}),(0,d.jsx)(`div`,{className:`flex items-center gap-1.5`,children:h.map(t=>(0,d.jsx)(i,{variant:e===t.value?`primary`:`secondary`,size:`sm`,onClick:()=>r(t.value),children:t.label},t.label))})]}),(0,d.jsxs)(`section`,{className:`grid grid-cols-2 divide-x divide-ink-rule border-b border-ink-rule md:grid-cols-4`,children:[(0,d.jsx)(v,{label:`Total spend`,value:a.data?n(x):void 0,tone:`spend`}),(0,d.jsx)(v,{label:`Sent`,value:a.data?String(C):void 0,caption:`lifetime, all plays`}),(0,d.jsx)(v,{label:`Replied`,value:a.data?String(S):void 0,caption:a.data&&C>0?`${(S/C*100).toFixed(1)}% reply rate`:void 0,tone:`receipt`}),(0,d.jsx)(v,{label:`Won`,value:f.data?String(w):void 0,caption:f.data?`deals`:void 0})]}),(0,d.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`CAC by play · signed receipts`}),(0,d.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:y(e)})]}),a.isLoading?Array.from({length:3},(e,t)=>(0,d.jsx)(l,{},t)):a.data?.spend.length===0?(0,d.jsx)(`div`,{className:`px-6 pb-6`,children:(0,d.jsx)(c,{note:`No spend in this window. Run a play and the dollars will account for themselves.`,cli:`oneshot-gtm motion show-hn --target targets.json`})}):(0,d.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,d.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`play`}),(0,d.jsxs)(`th`,{className:`py-2 text-left font-medium`,children:[`spend · `,g,`d`]}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`spend`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`calls`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`sent`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`replied`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`$/send`}),(0,d.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`$/reply`})]})}),(0,d.jsx)(`tbody`,{children:a.data?.spend.map((e,r)=>{let i=a.data.events.find(t=>t.playName===e.playName),o=i?.sent??0,s=i?.replied??0,c=b.get(e.playName)??[];return(0,d.jsxs)(`tr`,{className:t(`border-t border-ink-rule/60`,r%2==1&&`bg-ink-surface/20`),children:[(0,d.jsx)(`td`,{className:`px-6 py-2 text-ink-cream`,children:e.playName}),(0,d.jsx)(`td`,{className:`py-2`,children:c.length>1?(0,d.jsx)(p,{values:c,tone:`spend`,width:96,height:22,"aria-label":`${e.playName} spend over last ${g} days`}):(0,d.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream`,children:n(e.totalUsd)}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:e.calls}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:o}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:s}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream-2`,children:o>0?n(e.totalUsd/o):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s>0?n(e.totalUsd/s):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})})]},e.playName)})})]})]}),(0,d.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`RoCS · return on cognitive spend`}),(0,d.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:y(e)})]}),f.isLoading?Array.from({length:3},(e,t)=>(0,d.jsx)(l,{},t)):f.data?.spend.length===0?(0,d.jsx)(`div`,{className:`px-6 pb-6`,children:(0,d.jsx)(c,{note:`No spend in this window to attribute to outcomes yet.`})}):(0,d.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,d.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`play`}),(0,d.jsxs)(`th`,{className:`py-2 text-left font-medium`,children:[`spend · `,g,`d`]}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`spend`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`meetings`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`SQLs`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`won`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`$/meeting`}),(0,d.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`$/won`})]})}),(0,d.jsx)(`tbody`,{children:f.data?.spend.map((e,r)=>{let i=f.data.outcomes.find(t=>t.playName===e.playName),a=i?.meetings??0,o=i?.sqls??0,s=i?.won??0,c=b.get(e.playName)??[];return(0,d.jsxs)(`tr`,{className:t(`border-t border-ink-rule/60`,r%2==1&&`bg-ink-surface/20`),children:[(0,d.jsx)(`td`,{className:`px-6 py-2 text-ink-cream`,children:e.playName}),(0,d.jsx)(`td`,{className:`py-2`,children:c.length>1?(0,d.jsx)(p,{values:c,tone:`spend`,width:96,height:22,"aria-label":`${e.playName} spend over last ${g} days`}):(0,d.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream`,children:n(e.totalUsd)}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:a}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:o}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream-2`,children:a>0?n(e.totalUsd/a):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s>0?n(e.totalUsd/s):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})})]},e.playName)})})]})]})]})}function _(e,t){let n=Math.max(7,Math.min(t,90)),r=Date.now(),i=new Map;for(let t of e){if(t.costUsd==null)continue;let e=new Date(t.createdAt).getTime();if(Number.isNaN(e))continue;let a=Math.floor((r-e)/864e5);if(a<0||a>=n)continue;let o=n-1-a,s=i.get(t.playName);s||(s=Array.from({length:n},()=>0),i.set(t.playName,s)),s[o]=(s[o]??0)+t.costUsd}return i}function v({label:e,value:t,caption:n,tone:r=`neutral`}){return(0,d.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:e}),(0,d.jsx)(`div`,{className:`mt-1 truncate text-ink-cream ln-numeral`,style:{fontSize:34,lineHeight:1},children:t??(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),n&&(0,d.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px]`,style:{color:r===`spend`?`var(--ink-spend-2)`:r===`receipt`?`var(--ink-receipt-2)`:`var(--ink-faint)`},children:n})]})}function y(e){return e===void 0?`all-time`:`last ${e}d`}export{g as component};
2
- //# sourceMappingURL=measure-DLFAK1ZQ.js.map
1
+ import{c as e,d as t,l as n,n as r,o as i,r as a,t as o}from"./Button-NJ1UVzeB.js";import{p as s}from"./index-CzTgATNQ.js";import{t as c}from"./EmptyNote-DkmaZWuo.js";import{n as l}from"./Skeleton-d2p06ghN.js";var u=t(n(),1),d=e(),f={receipt:`var(--ink-receipt)`,spend:`var(--ink-spend)`,blocked:`var(--ink-blocked)`,signal:`var(--ink-signal)`,muted:`var(--ink-muted)`};function p({values:e,width:t=120,height:n=28,tone:i=`receipt`,animateIn:a=!0,fill:o=!0,tip:s=!0,className:c,"aria-label":l}){let p=(0,u.useId)(),h=f[i],{path:g,area:_,tipX:v,tipY:y,length:b}=(0,u.useMemo)(()=>m(e,t,n),[e,t,n]);return e.length===0?(0,d.jsx)(`svg`,{width:t,height:n,className:r(`block`,c),role:`img`,"aria-label":l??`no data`}):(0,d.jsxs)(`svg`,{width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:r(`block`,c),role:`img`,"aria-label":l??`sparkline`,children:[o&&(0,d.jsx)(`defs`,{children:(0,d.jsxs)(`linearGradient`,{id:`${p}-g`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,d.jsx)(`stop`,{offset:`0%`,stopColor:h,stopOpacity:`0.28`}),(0,d.jsx)(`stop`,{offset:`100%`,stopColor:h,stopOpacity:`0`})]})}),o&&(0,d.jsx)(`path`,{d:_,fill:`url(#${p}-g)`}),(0,d.jsx)(`path`,{d:g,fill:`none`,stroke:h,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,style:a?{strokeDasharray:b,strokeDashoffset:b,animation:`ln-draw 600ms var(--ease-reveal) forwards`,"--ln-dash-length":`${b}`}:void 0}),s&&(0,d.jsx)(`circle`,{cx:v,cy:y,r:1.8,fill:h,style:a?{opacity:0,animation:`ln-settle 280ms var(--ease-reveal) 500ms forwards`}:void 0})]})}function m(e,t,n){let r=t-4,i=n-4,a=Math.min(...e),o=Math.max(...e)-a||1,s=e.length,c=s>1?r/(s-1):0,l=e.map((e,t)=>[2+t*c,2+(1-(e-a)/o)*i]),u=l.map(([e,t],n)=>n===0?`M${e.toFixed(2)},${t.toFixed(2)}`:`L${e.toFixed(2)},${t.toFixed(2)}`).join(` `),d=l[0],f=l[l.length-1],p=`${u} L${f[0].toFixed(2)},${(n-2).toFixed(2)} L${d[0].toFixed(2)},${(n-2).toFixed(2)} Z`,m=0;for(let e=1;e<l.length;e++){let t=l[e][0]-l[e-1][0],n=l[e][1]-l[e-1][1];m+=Math.sqrt(t*t+n*n)}return m=Math.max(m,1),{path:u,area:p,tipX:f[0],tipY:f[1],length:m}}var h=[{label:`all-time`,value:void 0},{label:`30d`,value:30},{label:`7d`,value:7}];function g(){let[e,t]=(0,u.useState)(void 0),n=s({queryKey:[`measure`,`cac`,e],queryFn:()=>i.measureCac(e)}),f=s({queryKey:[`measure`,`rocs`,e],queryFn:()=>i.measureRocs(e)}),m=s({queryKey:[`measure`,`receipts-trend`],queryFn:()=>i.receipts({limit:500}),staleTime:6e4}),g=e??30,b=(0,u.useMemo)(()=>_(m.data?.receipts??[],g),[m.data?.receipts,g]),x=n.data?.spend.reduce((e,t)=>e+t.totalUsd,0)??0,S=n.data?.events.reduce((e,t)=>e+t.replied,0)??0,C=n.data?.events.reduce((e,t)=>e+t.sent,0)??0,w=f.data?.outcomes.reduce((e,t)=>e+t.won,0)??0;return(0,d.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,d.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Measure`}),(0,d.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`$ per reply, per meeting, per won.`})]}),(0,d.jsx)(`div`,{className:`flex items-center gap-1.5`,children:h.map(n=>(0,d.jsx)(o,{variant:e===n.value?`primary`:`secondary`,size:`sm`,onClick:()=>t(n.value),children:n.label},n.label))})]}),(0,d.jsxs)(`section`,{className:`grid grid-cols-2 divide-x divide-ink-rule border-b border-ink-rule md:grid-cols-4`,children:[(0,d.jsx)(v,{label:`Total spend`,value:n.data?a(x):void 0,tone:`spend`}),(0,d.jsx)(v,{label:`Sent`,value:n.data?String(C):void 0,caption:`lifetime, all plays`}),(0,d.jsx)(v,{label:`Replied`,value:n.data?String(S):void 0,caption:n.data&&C>0?`${(S/C*100).toFixed(1)}% reply rate`:void 0,tone:`receipt`}),(0,d.jsx)(v,{label:`Won`,value:f.data?String(w):void 0,caption:f.data?`deals`:void 0})]}),(0,d.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`CAC by play · signed receipts`}),(0,d.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:y(e)})]}),n.isLoading?Array.from({length:3},(e,t)=>(0,d.jsx)(l,{},t)):n.data?.spend.length===0?(0,d.jsx)(`div`,{className:`px-6 pb-6`,children:(0,d.jsx)(c,{note:`No spend in this window. Run a play and the dollars will account for themselves.`,cli:`oneshot-gtm motion show-hn --target targets.json`})}):(0,d.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,d.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`play`}),(0,d.jsxs)(`th`,{className:`py-2 text-left font-medium`,children:[`spend · `,g,`d`]}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`spend`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`calls`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`sent`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`replied`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`$/send`}),(0,d.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`$/reply`})]})}),(0,d.jsx)(`tbody`,{children:n.data?.spend.map((e,t)=>{let i=n.data.events.find(t=>t.playName===e.playName),o=i?.sent??0,s=i?.replied??0,c=b.get(e.playName)??[];return(0,d.jsxs)(`tr`,{className:r(`border-t border-ink-rule/60`,t%2==1&&`bg-ink-surface/20`),children:[(0,d.jsx)(`td`,{className:`px-6 py-2 text-ink-cream`,children:e.playName}),(0,d.jsx)(`td`,{className:`py-2`,children:c.length>1?(0,d.jsx)(p,{values:c,tone:`spend`,width:96,height:22,"aria-label":`${e.playName} spend over last ${g} days`}):(0,d.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream`,children:a(e.totalUsd)}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:e.calls}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:o}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:s}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream-2`,children:o>0?a(e.totalUsd/o):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s>0?a(e.totalUsd/s):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})})]},e.playName)})})]})]}),(0,d.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:`RoCS · return on cognitive spend`}),(0,d.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:y(e)})]}),f.isLoading?Array.from({length:3},(e,t)=>(0,d.jsx)(l,{},t)):f.data?.spend.length===0?(0,d.jsx)(`div`,{className:`px-6 pb-6`,children:(0,d.jsx)(c,{note:`No spend in this window to attribute to outcomes yet.`})}):(0,d.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,d.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`play`}),(0,d.jsxs)(`th`,{className:`py-2 text-left font-medium`,children:[`spend · `,g,`d`]}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`spend`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`meetings`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`SQLs`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`won`}),(0,d.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`$/meeting`}),(0,d.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`$/won`})]})}),(0,d.jsx)(`tbody`,{children:f.data?.spend.map((e,t)=>{let n=f.data.outcomes.find(t=>t.playName===e.playName),i=n?.meetings??0,o=n?.sqls??0,s=n?.won??0,c=b.get(e.playName)??[];return(0,d.jsxs)(`tr`,{className:r(`border-t border-ink-rule/60`,t%2==1&&`bg-ink-surface/20`),children:[(0,d.jsx)(`td`,{className:`px-6 py-2 text-ink-cream`,children:e.playName}),(0,d.jsx)(`td`,{className:`py-2`,children:c.length>1?(0,d.jsx)(p,{values:c,tone:`spend`,width:96,height:22,"aria-label":`${e.playName} spend over last ${g} days`}):(0,d.jsx)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream`,children:a(e.totalUsd)}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:i}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-muted`,children:o}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s}),(0,d.jsx)(`td`,{className:`py-2 text-right font-mono text-ink-cream-2`,children:i>0?a(e.totalUsd/i):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),(0,d.jsx)(`td`,{className:`px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]`,children:s>0?a(e.totalUsd/s):(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})})]},e.playName)})})]})]})]})}function _(e,t){let n=Math.max(7,Math.min(t,90)),r=Date.now(),i=new Map;for(let t of e){if(t.costUsd==null)continue;let e=new Date(t.createdAt).getTime();if(Number.isNaN(e))continue;let a=Math.floor((r-e)/864e5);if(a<0||a>=n)continue;let o=n-1-a,s=i.get(t.playName);s||(s=Array.from({length:n},()=>0),i.set(t.playName,s)),s[o]=(s[o]??0)+t.costUsd}return i}function v({label:e,value:t,caption:n,tone:r=`neutral`}){return(0,d.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,d.jsx)(`div`,{className:`ln-eyebrow`,children:e}),(0,d.jsx)(`div`,{className:`mt-1 truncate text-ink-cream ln-numeral`,style:{fontSize:34,lineHeight:1},children:t??(0,d.jsx)(`span`,{className:`text-ink-faint`,children:`—`})}),n&&(0,d.jsx)(`div`,{className:`mt-2 truncate font-mono text-[11px]`,style:{color:r===`spend`?`var(--ink-spend-2)`:r===`receipt`?`var(--ink-receipt-2)`:`var(--ink-faint)`},children:n})]})}function y(e){return e===void 0?`all-time`:`last ${e}d`}export{g as component};
2
+ //# sourceMappingURL=measure-S3BWSb2L.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"measure-DLFAK1ZQ.js","names":["useQuery","useMemo","useState","api","Button","EmptyNote","SkeletonRow","Sparkline","cn","formatUsd","RANGES","label","value","undefined","const","MeasurePage","sinceDays","setSinceDays","cac","queryKey","queryFn","measureCac","rocs","measureRocs","receipts","limit","staleTime","sparkDays","spendSeries","buildSpendSeries","data","totalSpend","spend","reduce","a","s","totalUsd","totalReplied","events","e","replied","totalSent","sent","totalWon","outcomes","o","won","fontFamily","fontSize","fontWeight","letterSpacing","lineHeight","map","r","String","toFixed","rangeLabel","isLoading","Array","from","length","_","i","ev","find","playName","series","get","calls","oc","meet","meetings","sql","sqls","ReceiptView","windowDays","Map","days","Math","max","min","now","Date","DAY_MS","out","costUsd","ts","createdAt","getTime","Number","isNaN","daysAgo","floor","idx","arr","set","Summary","caption","tone","captionColor","color","component"],"sources":["../../src/components/primitives/Sparkline.tsx","../../src/routes/measure.tsx?tsr-split=component"],"sourcesContent":["import { useId, useMemo } from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\n\ninterface SparklineProps {\n /** Values in chronological order. First is oldest, last is newest. */\n values: number[];\n width?: number;\n height?: number;\n /** Stroke colour (CSS colour). Defaults to the receipt tone. */\n tone?: \"receipt\" | \"spend\" | \"blocked\" | \"signal\" | \"muted\";\n /** Animate the stroke drawing in on mount. */\n animateIn?: boolean;\n /** Draw a subtle area fill under the line. */\n fill?: boolean;\n /** Show a filled dot at the last point (current reading). */\n tip?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nconst TONE_VAR: Record<NonNullable<SparklineProps[\"tone\"]>, string> = {\n receipt: \"var(--ink-receipt)\",\n spend: \"var(--ink-spend)\",\n blocked: \"var(--ink-blocked)\",\n signal: \"var(--ink-signal)\",\n muted: \"var(--ink-muted)\",\n};\n\n/**\n * A tiny SVG sparkline. No chart library — just a smooth polyline over\n * the values you give it, optionally with a faint fill and a tip dot.\n * The line draws in like an EKG on mount when `animateIn` is true.\n */\nexport function Sparkline({\n values,\n width = 120,\n height = 28,\n tone = \"receipt\",\n animateIn = true,\n fill = true,\n tip = true,\n className,\n \"aria-label\": ariaLabel,\n}: SparklineProps) {\n const id = useId();\n const colour = TONE_VAR[tone];\n\n const { path, area, tipX, tipY, length } = useMemo(\n () => buildPath(values, width, height),\n [values, width, height],\n );\n\n if (values.length === 0) {\n return (\n <svg\n width={width}\n height={height}\n className={cn(\"block\", className)}\n role=\"img\"\n aria-label={ariaLabel ?? \"no data\"}\n />\n );\n }\n\n return (\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n className={cn(\"block\", className)}\n role=\"img\"\n aria-label={ariaLabel ?? \"sparkline\"}\n >\n {fill && (\n <defs>\n <linearGradient id={`${id}-g`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colour} stopOpacity=\"0.28\" />\n <stop offset=\"100%\" stopColor={colour} stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n )}\n {fill && <path d={area} fill={`url(#${id}-g)`} />}\n <path\n d={path}\n fill=\"none\"\n stroke={colour}\n strokeWidth={1.25}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={\n animateIn\n ? ({\n strokeDasharray: length,\n strokeDashoffset: length,\n animation: \"ln-draw 600ms var(--ease-reveal) forwards\",\n [\"--ln-dash-length\" as string]: `${length}`,\n } as React.CSSProperties)\n : undefined\n }\n />\n {tip && (\n <circle\n cx={tipX}\n cy={tipY}\n r={1.8}\n fill={colour}\n style={\n animateIn\n ? ({\n opacity: 0,\n animation: \"ln-settle 280ms var(--ease-reveal) 500ms forwards\",\n } as React.CSSProperties)\n : undefined\n }\n />\n )}\n </svg>\n );\n}\n\nfunction buildPath(values: number[], width: number, height: number) {\n const pad = 2;\n const w = width - pad * 2;\n const h = height - pad * 2;\n const min = Math.min(...values);\n const max = Math.max(...values);\n const range = max - min || 1;\n const n = values.length;\n const step = n > 1 ? w / (n - 1) : 0;\n\n const pts = values.map((v, i) => {\n const x = pad + i * step;\n const y = pad + (1 - (v - min) / range) * h;\n return [x, y] as const;\n });\n\n const path = pts\n .map(([x, y], i) =>\n i === 0 ? `M${x.toFixed(2)},${y.toFixed(2)}` : `L${x.toFixed(2)},${y.toFixed(2)}`,\n )\n .join(\" \");\n const first = pts[0]!;\n const last = pts[pts.length - 1]!;\n const area = `${path} L${last[0].toFixed(2)},${(height - pad).toFixed(2)} L${first[0].toFixed(2)},${(\n height - pad\n ).toFixed(2)} Z`;\n\n // Approximate polyline length for stroke-dasharray drawing animation.\n let length = 0;\n for (let i = 1; i < pts.length; i++) {\n const dx = pts[i]![0] - pts[i - 1]![0];\n const dy = pts[i]![1] - pts[i - 1]![1];\n length += Math.sqrt(dx * dx + dy * dy);\n }\n length = Math.max(length, 1);\n\n return { path, area, tipX: last[0], tipY: last[1], length };\n}\n","import { useQuery } from \"@tanstack/react-query\";\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport { useMemo, useState } from \"react\";\nimport type { ReceiptView } from \"@oneshot-gtm/shared-types\";\nimport { api } from \"../api/client.ts\";\nimport { Button } from \"../components/primitives/Button.tsx\";\nimport { EmptyNote } from \"../components/primitives/EmptyNote.tsx\";\nimport { SkeletonRow } from \"../components/primitives/Skeleton.tsx\";\nimport { Sparkline } from \"../components/primitives/Sparkline.tsx\";\nimport { cn, formatUsd } from \"../lib/cn.ts\";\n\nexport const Route = createFileRoute(\"/measure\")({\n component: MeasurePage,\n});\n\nconst RANGES = [\n { label: \"all-time\", value: undefined },\n { label: \"30d\", value: 30 },\n { label: \"7d\", value: 7 },\n] as const;\n\nfunction MeasurePage() {\n const [sinceDays, setSinceDays] = useState<number | undefined>(undefined);\n const cac = useQuery({\n queryKey: [\"measure\", \"cac\", sinceDays],\n queryFn: () => api.measureCac(sinceDays),\n });\n const rocs = useQuery({\n queryKey: [\"measure\", \"rocs\", sinceDays],\n queryFn: () => api.measureRocs(sinceDays),\n });\n\n // Pull a wide receipts window once so the per-play sparklines can show a\n // daily-spend trend. We grab up to 500 receipts; for heavier founders we'd\n // wire a server-side time-bucketed aggregate, but 500 covers a month of\n // daily activity for the current scale.\n const receipts = useQuery({\n queryKey: [\"measure\", \"receipts-trend\"],\n queryFn: () => api.receipts({ limit: 500 }),\n staleTime: 60_000,\n });\n\n const sparkDays = sinceDays ?? 30;\n const spendSeries = useMemo(\n () => buildSpendSeries(receipts.data?.receipts ?? [], sparkDays),\n [receipts.data?.receipts, sparkDays],\n );\n\n const totalSpend = cac.data?.spend.reduce((a, s) => a + s.totalUsd, 0) ?? 0;\n const totalReplied = cac.data?.events.reduce((a, e) => a + e.replied, 0) ?? 0;\n const totalSent = cac.data?.events.reduce((a, e) => a + e.sent, 0) ?? 0;\n const totalWon = rocs.data?.outcomes.reduce((a, o) => a + o.won, 0) ?? 0;\n\n return (\n <div className=\"-mx-6 -my-6 flex flex-col\">\n {/* Masthead */}\n <section className=\"flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6\">\n <div>\n <div className=\"ln-eyebrow\">The Ledger · Measure</div>\n <h1\n className=\"mt-1 text-ink-cream\"\n style={{\n fontFamily: \"var(--font-display)\",\n fontSize: 44,\n fontWeight: 600,\n letterSpacing: \"-0.025em\",\n lineHeight: 0.98,\n }}\n >\n $ per reply, per meeting, per won.\n </h1>\n </div>\n <div className=\"flex items-center gap-1.5\">\n {RANGES.map((r) => (\n <Button\n key={r.label}\n variant={sinceDays === r.value ? \"primary\" : \"secondary\"}\n size=\"sm\"\n onClick={() => setSinceDays(r.value)}\n >\n {r.label}\n </Button>\n ))}\n </div>\n </section>\n\n {/* Aggregate strip */}\n <section className=\"grid grid-cols-2 divide-x divide-ink-rule border-b border-ink-rule md:grid-cols-4\">\n <Summary\n label=\"Total spend\"\n value={cac.data ? formatUsd(totalSpend) : undefined}\n tone=\"spend\"\n />\n <Summary\n label=\"Sent\"\n value={cac.data ? String(totalSent) : undefined}\n caption=\"lifetime, all plays\"\n />\n <Summary\n label=\"Replied\"\n value={cac.data ? String(totalReplied) : undefined}\n caption={\n cac.data && totalSent > 0\n ? `${((totalReplied / totalSent) * 100).toFixed(1)}% reply rate`\n : undefined\n }\n tone=\"receipt\"\n />\n <Summary\n label=\"Won\"\n value={rocs.data ? String(totalWon) : undefined}\n caption={rocs.data ? \"deals\" : undefined}\n />\n </section>\n\n {/* CAC table */}\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">CAC by play · signed receipts</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">{rangeLabel(sinceDays)}</div>\n </div>\n {cac.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : cac.data?.spend.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote\n note=\"No spend in this window. Run a play and the dollars will account for themselves.\"\n cli=\"oneshot-gtm motion show-hn --target targets.json\"\n />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">spend · {sparkDays}d</th>\n <th className=\"py-2 text-right font-medium\">spend</th>\n <th className=\"py-2 text-right font-medium\">calls</th>\n <th className=\"py-2 text-right font-medium\">sent</th>\n <th className=\"py-2 text-right font-medium\">replied</th>\n <th className=\"py-2 text-right font-medium\">$/send</th>\n <th className=\"px-6 py-2 text-right font-medium\">$/reply</th>\n </tr>\n </thead>\n <tbody>\n {cac.data?.spend.map((s, i) => {\n const ev = cac.data.events.find((e) => e.playName === s.playName);\n const sent = ev?.sent ?? 0;\n const replied = ev?.replied ?? 0;\n const series = spendSeries.get(s.playName) ?? [];\n return (\n <tr\n key={s.playName}\n className={cn(\n \"border-t border-ink-rule/60\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n <td className=\"px-6 py-2 text-ink-cream\">{s.playName}</td>\n <td className=\"py-2\">\n {series.length > 1 ? (\n <Sparkline\n values={series}\n tone=\"spend\"\n width={96}\n height={22}\n aria-label={`${s.playName} spend over last ${sparkDays} days`}\n />\n ) : (\n <span className=\"font-mono text-[11px] text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream\">\n {formatUsd(s.totalUsd)}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{s.calls}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{sent}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{replied}</td>\n <td className=\"py-2 text-right font-mono text-ink-cream-2\">\n {sent > 0 ? (\n formatUsd(s.totalUsd / sent)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {replied > 0 ? (\n formatUsd(s.totalUsd / replied)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n\n {/* RoCS table */}\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">RoCS · return on cognitive spend</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">{rangeLabel(sinceDays)}</div>\n </div>\n {rocs.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : rocs.data?.spend.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote note=\"No spend in this window to attribute to outcomes yet.\" />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">spend · {sparkDays}d</th>\n <th className=\"py-2 text-right font-medium\">spend</th>\n <th className=\"py-2 text-right font-medium\">meetings</th>\n <th className=\"py-2 text-right font-medium\">SQLs</th>\n <th className=\"py-2 text-right font-medium\">won</th>\n <th className=\"py-2 text-right font-medium\">$/meeting</th>\n <th className=\"px-6 py-2 text-right font-medium\">$/won</th>\n </tr>\n </thead>\n <tbody>\n {rocs.data?.spend.map((s, i) => {\n const oc = rocs.data.outcomes.find((o) => o.playName === s.playName);\n const meet = oc?.meetings ?? 0;\n const sql = oc?.sqls ?? 0;\n const won = oc?.won ?? 0;\n const series = spendSeries.get(s.playName) ?? [];\n return (\n <tr\n key={s.playName}\n className={cn(\n \"border-t border-ink-rule/60\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n <td className=\"px-6 py-2 text-ink-cream\">{s.playName}</td>\n <td className=\"py-2\">\n {series.length > 1 ? (\n <Sparkline\n values={series}\n tone=\"spend\"\n width={96}\n height={22}\n aria-label={`${s.playName} spend over last ${sparkDays} days`}\n />\n ) : (\n <span className=\"font-mono text-[11px] text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream\">\n {formatUsd(s.totalUsd)}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{meet}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{sql}</td>\n <td className=\"py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {won}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream-2\">\n {meet > 0 ? (\n formatUsd(s.totalUsd / meet)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {won > 0 ? (\n formatUsd(s.totalUsd / won)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n </div>\n );\n}\n\n/**\n * Group receipts by play and compute a daily spend histogram (oldest → newest).\n * Returns a Map keyed by playName. Receipts without a `costUsd` value are\n * skipped. Days beyond `windowDays` are dropped.\n */\nfunction buildSpendSeries(receipts: ReceiptView[], windowDays: number): Map<string, number[]> {\n const days = Math.max(7, Math.min(windowDays, 90));\n const now = Date.now();\n const DAY_MS = 24 * 3600 * 1000;\n const out = new Map<string, number[]>();\n\n for (const r of receipts) {\n if (r.costUsd == null) continue;\n const ts = new Date(r.createdAt).getTime();\n if (Number.isNaN(ts)) continue;\n const daysAgo = Math.floor((now - ts) / DAY_MS);\n if (daysAgo < 0 || daysAgo >= days) continue;\n const idx = days - 1 - daysAgo;\n let arr = out.get(r.playName);\n if (!arr) {\n arr = Array.from({ length: days }, () => 0);\n out.set(r.playName, arr);\n }\n arr[idx] = (arr[idx] ?? 0) + r.costUsd;\n }\n return out;\n}\n\nfunction Summary({\n label,\n value,\n caption,\n tone = \"neutral\",\n}: {\n label: string;\n value: string | undefined;\n caption?: string;\n /** Caption tint only; the number itself stays cream. */\n tone?: \"neutral\" | \"receipt\" | \"spend\";\n}) {\n const captionColor =\n tone === \"spend\"\n ? \"var(--ink-spend-2)\"\n : tone === \"receipt\"\n ? \"var(--ink-receipt-2)\"\n : \"var(--ink-faint)\";\n return (\n <div className=\"px-5 py-4\">\n <div className=\"ln-eyebrow\">{label}</div>\n <div\n className=\"mt-1 truncate text-ink-cream ln-numeral\"\n style={{ fontSize: 34, lineHeight: 1 }}\n >\n {value ?? <span className=\"text-ink-faint\">—</span>}\n </div>\n {caption && (\n <div className=\"mt-2 truncate font-mono text-[11px]\" style={{ color: captionColor }}>\n {caption}\n </div>\n )}\n </div>\n );\n}\n\nfunction rangeLabel(s: number | undefined): string {\n if (s === undefined) return \"all-time\";\n return `last ${s}d`;\n}\n"],"mappings":"uOAoBM,EAAgE,CACpE,QAAS,qBACT,MAAO,mBACP,QAAS,qBACT,OAAQ,oBACR,MAAO,mBACR,CAOD,SAAgB,EAAU,CACxB,SACA,QAAQ,IACR,SAAS,GACT,OAAO,UACP,YAAY,GACZ,OAAO,GACP,MAAM,GACN,YACA,aAAc,GACG,CACjB,IAAM,GAAA,EAAA,EAAA,QAAY,CACZ,EAAS,EAAS,GAElB,CAAE,OAAM,OAAM,OAAM,OAAM,WAAA,EAAA,EAAA,aACxB,EAAU,EAAQ,EAAO,EAAO,CACtC,CAAC,EAAQ,EAAO,EAAO,CACxB,CAcD,OAZI,EAAO,SAAW,GAElB,EAAA,EAAA,KAAC,MAAD,CACS,QACC,SACR,UAAW,EAAG,QAAS,EAAU,CACjC,KAAK,MACL,aAAY,GAAa,UACzB,CAAA,EAKJ,EAAA,EAAA,MAAC,MAAD,CACS,QACC,SACR,QAAS,OAAO,EAAM,GAAG,IACzB,UAAW,EAAG,QAAS,EAAU,CACjC,KAAK,MACL,aAAY,GAAa,qBAN3B,CAQG,IACC,EAAA,EAAA,KAAC,OAAD,CAAA,UACE,EAAA,EAAA,MA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,GAAWd,EAAM,SACpC,IAAMgB,EAAMhB,EAAO,EAAIc,EACnBG,EAAMV,EAAIjB,IAAId,EAAEY,SAAS,CACxB6B,IACHA,EAAMpC,MAAMC,KAAK,CAAEC,OAAQiB,EAAM,KAAQ,EAAE,CAC3CO,EAAIW,IAAI1C,EAAEY,SAAU6B,EAAI,EAE1BA,EAAID,IAAQC,EAAID,IAAQ,GAAKxC,EAAEgC,QAEjC,OAAOD,EAGT,SAASY,EAAQ,CACfrF,QACAC,QACAqF,UACAC,OAAO,WAON,CAOD,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sBAAcvF,EAAW,CAAA,EACxC,EAAA,EAAA,KAAC,MAAD,CACE,UAAU,0CACV,MAAO,CAAEqC,SAAU,GAAIG,WAAY,EAAG,UAErCvC,IAAS,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,0BAAiB,IAAQ,CAAA,CAChD,CAAA,CACJqF,IACC,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sCAAsC,MAAO,CAAEG,MAflEF,IAAS,QACL,qBACAA,IAAS,UACP,uBACA,mBAWiF,UAChFD,EAEJ,CAAA,CACG,GAIV,SAASzC,EAAWrB,EAA+B,CAEjD,OADIA,IAAMtB,IAAAA,GAAkB,WACrB,QAAQsB,EAAC"}
1
+ {"version":3,"file":"measure-S3BWSb2L.js","names":["useQuery","useMemo","useState","api","Button","EmptyNote","SkeletonRow","Sparkline","cn","formatUsd","RANGES","label","value","undefined","const","MeasurePage","sinceDays","setSinceDays","cac","queryKey","queryFn","measureCac","rocs","measureRocs","receipts","limit","staleTime","sparkDays","spendSeries","buildSpendSeries","data","totalSpend","spend","reduce","a","s","totalUsd","totalReplied","events","e","replied","totalSent","sent","totalWon","outcomes","o","won","fontFamily","fontSize","fontWeight","letterSpacing","lineHeight","map","r","String","toFixed","rangeLabel","isLoading","Array","from","length","_","i","ev","find","playName","series","get","calls","oc","meet","meetings","sql","sqls","ReceiptView","windowDays","Map","days","Math","max","min","now","Date","DAY_MS","out","costUsd","ts","createdAt","getTime","Number","isNaN","daysAgo","floor","idx","arr","set","Summary","caption","tone","captionColor","color","component"],"sources":["../../src/components/primitives/Sparkline.tsx","../../src/routes/measure.tsx?tsr-split=component"],"sourcesContent":["import { useId, useMemo } from \"react\";\nimport { cn } from \"../../lib/cn.ts\";\n\ninterface SparklineProps {\n /** Values in chronological order. First is oldest, last is newest. */\n values: number[];\n width?: number;\n height?: number;\n /** Stroke colour (CSS colour). Defaults to the receipt tone. */\n tone?: \"receipt\" | \"spend\" | \"blocked\" | \"signal\" | \"muted\";\n /** Animate the stroke drawing in on mount. */\n animateIn?: boolean;\n /** Draw a subtle area fill under the line. */\n fill?: boolean;\n /** Show a filled dot at the last point (current reading). */\n tip?: boolean;\n className?: string;\n \"aria-label\"?: string;\n}\n\nconst TONE_VAR: Record<NonNullable<SparklineProps[\"tone\"]>, string> = {\n receipt: \"var(--ink-receipt)\",\n spend: \"var(--ink-spend)\",\n blocked: \"var(--ink-blocked)\",\n signal: \"var(--ink-signal)\",\n muted: \"var(--ink-muted)\",\n};\n\n/**\n * A tiny SVG sparkline. No chart library — just a smooth polyline over\n * the values you give it, optionally with a faint fill and a tip dot.\n * The line draws in like an EKG on mount when `animateIn` is true.\n */\nexport function Sparkline({\n values,\n width = 120,\n height = 28,\n tone = \"receipt\",\n animateIn = true,\n fill = true,\n tip = true,\n className,\n \"aria-label\": ariaLabel,\n}: SparklineProps) {\n const id = useId();\n const colour = TONE_VAR[tone];\n\n const { path, area, tipX, tipY, length } = useMemo(\n () => buildPath(values, width, height),\n [values, width, height],\n );\n\n if (values.length === 0) {\n return (\n <svg\n width={width}\n height={height}\n className={cn(\"block\", className)}\n role=\"img\"\n aria-label={ariaLabel ?? \"no data\"}\n />\n );\n }\n\n return (\n <svg\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n className={cn(\"block\", className)}\n role=\"img\"\n aria-label={ariaLabel ?? \"sparkline\"}\n >\n {fill && (\n <defs>\n <linearGradient id={`${id}-g`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={colour} stopOpacity=\"0.28\" />\n <stop offset=\"100%\" stopColor={colour} stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n )}\n {fill && <path d={area} fill={`url(#${id}-g)`} />}\n <path\n d={path}\n fill=\"none\"\n stroke={colour}\n strokeWidth={1.25}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={\n animateIn\n ? ({\n strokeDasharray: length,\n strokeDashoffset: length,\n animation: \"ln-draw 600ms var(--ease-reveal) forwards\",\n [\"--ln-dash-length\" as string]: `${length}`,\n } as React.CSSProperties)\n : undefined\n }\n />\n {tip && (\n <circle\n cx={tipX}\n cy={tipY}\n r={1.8}\n fill={colour}\n style={\n animateIn\n ? ({\n opacity: 0,\n animation: \"ln-settle 280ms var(--ease-reveal) 500ms forwards\",\n } as React.CSSProperties)\n : undefined\n }\n />\n )}\n </svg>\n );\n}\n\nfunction buildPath(values: number[], width: number, height: number) {\n const pad = 2;\n const w = width - pad * 2;\n const h = height - pad * 2;\n const min = Math.min(...values);\n const max = Math.max(...values);\n const range = max - min || 1;\n const n = values.length;\n const step = n > 1 ? w / (n - 1) : 0;\n\n const pts = values.map((v, i) => {\n const x = pad + i * step;\n const y = pad + (1 - (v - min) / range) * h;\n return [x, y] as const;\n });\n\n const path = pts\n .map(([x, y], i) =>\n i === 0 ? `M${x.toFixed(2)},${y.toFixed(2)}` : `L${x.toFixed(2)},${y.toFixed(2)}`,\n )\n .join(\" \");\n const first = pts[0]!;\n const last = pts[pts.length - 1]!;\n const area = `${path} L${last[0].toFixed(2)},${(height - pad).toFixed(2)} L${first[0].toFixed(2)},${(\n height - pad\n ).toFixed(2)} Z`;\n\n // Approximate polyline length for stroke-dasharray drawing animation.\n let length = 0;\n for (let i = 1; i < pts.length; i++) {\n const dx = pts[i]![0] - pts[i - 1]![0];\n const dy = pts[i]![1] - pts[i - 1]![1];\n length += Math.sqrt(dx * dx + dy * dy);\n }\n length = Math.max(length, 1);\n\n return { path, area, tipX: last[0], tipY: last[1], length };\n}\n","import { useQuery } from \"@tanstack/react-query\";\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport { useMemo, useState } from \"react\";\nimport type { ReceiptView } from \"@oneshot-gtm/shared-types\";\nimport { api } from \"../api/client.ts\";\nimport { Button } from \"../components/primitives/Button.tsx\";\nimport { EmptyNote } from \"../components/primitives/EmptyNote.tsx\";\nimport { SkeletonRow } from \"../components/primitives/Skeleton.tsx\";\nimport { Sparkline } from \"../components/primitives/Sparkline.tsx\";\nimport { cn, formatUsd } from \"../lib/cn.ts\";\n\nexport const Route = createFileRoute(\"/measure\")({\n component: MeasurePage,\n});\n\nconst RANGES = [\n { label: \"all-time\", value: undefined },\n { label: \"30d\", value: 30 },\n { label: \"7d\", value: 7 },\n] as const;\n\nfunction MeasurePage() {\n const [sinceDays, setSinceDays] = useState<number | undefined>(undefined);\n const cac = useQuery({\n queryKey: [\"measure\", \"cac\", sinceDays],\n queryFn: () => api.measureCac(sinceDays),\n });\n const rocs = useQuery({\n queryKey: [\"measure\", \"rocs\", sinceDays],\n queryFn: () => api.measureRocs(sinceDays),\n });\n\n // Pull a wide receipts window once so the per-play sparklines can show a\n // daily-spend trend. We grab up to 500 receipts; for heavier founders we'd\n // wire a server-side time-bucketed aggregate, but 500 covers a month of\n // daily activity for the current scale.\n const receipts = useQuery({\n queryKey: [\"measure\", \"receipts-trend\"],\n queryFn: () => api.receipts({ limit: 500 }),\n staleTime: 60_000,\n });\n\n const sparkDays = sinceDays ?? 30;\n const spendSeries = useMemo(\n () => buildSpendSeries(receipts.data?.receipts ?? [], sparkDays),\n [receipts.data?.receipts, sparkDays],\n );\n\n const totalSpend = cac.data?.spend.reduce((a, s) => a + s.totalUsd, 0) ?? 0;\n const totalReplied = cac.data?.events.reduce((a, e) => a + e.replied, 0) ?? 0;\n const totalSent = cac.data?.events.reduce((a, e) => a + e.sent, 0) ?? 0;\n const totalWon = rocs.data?.outcomes.reduce((a, o) => a + o.won, 0) ?? 0;\n\n return (\n <div className=\"-mx-6 -my-6 flex flex-col\">\n {/* Masthead */}\n <section className=\"flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6\">\n <div>\n <div className=\"ln-eyebrow\">The Ledger · Measure</div>\n <h1\n className=\"mt-1 text-ink-cream\"\n style={{\n fontFamily: \"var(--font-display)\",\n fontSize: 44,\n fontWeight: 600,\n letterSpacing: \"-0.025em\",\n lineHeight: 0.98,\n }}\n >\n $ per reply, per meeting, per won.\n </h1>\n </div>\n <div className=\"flex items-center gap-1.5\">\n {RANGES.map((r) => (\n <Button\n key={r.label}\n variant={sinceDays === r.value ? \"primary\" : \"secondary\"}\n size=\"sm\"\n onClick={() => setSinceDays(r.value)}\n >\n {r.label}\n </Button>\n ))}\n </div>\n </section>\n\n {/* Aggregate strip */}\n <section className=\"grid grid-cols-2 divide-x divide-ink-rule border-b border-ink-rule md:grid-cols-4\">\n <Summary\n label=\"Total spend\"\n value={cac.data ? formatUsd(totalSpend) : undefined}\n tone=\"spend\"\n />\n <Summary\n label=\"Sent\"\n value={cac.data ? String(totalSent) : undefined}\n caption=\"lifetime, all plays\"\n />\n <Summary\n label=\"Replied\"\n value={cac.data ? String(totalReplied) : undefined}\n caption={\n cac.data && totalSent > 0\n ? `${((totalReplied / totalSent) * 100).toFixed(1)}% reply rate`\n : undefined\n }\n tone=\"receipt\"\n />\n <Summary\n label=\"Won\"\n value={rocs.data ? String(totalWon) : undefined}\n caption={rocs.data ? \"deals\" : undefined}\n />\n </section>\n\n {/* CAC table */}\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">CAC by play · signed receipts</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">{rangeLabel(sinceDays)}</div>\n </div>\n {cac.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : cac.data?.spend.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote\n note=\"No spend in this window. Run a play and the dollars will account for themselves.\"\n cli=\"oneshot-gtm motion show-hn --target targets.json\"\n />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">spend · {sparkDays}d</th>\n <th className=\"py-2 text-right font-medium\">spend</th>\n <th className=\"py-2 text-right font-medium\">calls</th>\n <th className=\"py-2 text-right font-medium\">sent</th>\n <th className=\"py-2 text-right font-medium\">replied</th>\n <th className=\"py-2 text-right font-medium\">$/send</th>\n <th className=\"px-6 py-2 text-right font-medium\">$/reply</th>\n </tr>\n </thead>\n <tbody>\n {cac.data?.spend.map((s, i) => {\n const ev = cac.data.events.find((e) => e.playName === s.playName);\n const sent = ev?.sent ?? 0;\n const replied = ev?.replied ?? 0;\n const series = spendSeries.get(s.playName) ?? [];\n return (\n <tr\n key={s.playName}\n className={cn(\n \"border-t border-ink-rule/60\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n <td className=\"px-6 py-2 text-ink-cream\">{s.playName}</td>\n <td className=\"py-2\">\n {series.length > 1 ? (\n <Sparkline\n values={series}\n tone=\"spend\"\n width={96}\n height={22}\n aria-label={`${s.playName} spend over last ${sparkDays} days`}\n />\n ) : (\n <span className=\"font-mono text-[11px] text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream\">\n {formatUsd(s.totalUsd)}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{s.calls}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{sent}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{replied}</td>\n <td className=\"py-2 text-right font-mono text-ink-cream-2\">\n {sent > 0 ? (\n formatUsd(s.totalUsd / sent)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {replied > 0 ? (\n formatUsd(s.totalUsd / replied)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n\n {/* RoCS table */}\n <section className=\"border-b border-ink-rule\">\n <div className=\"flex items-baseline justify-between px-6 pb-2 pt-5\">\n <div className=\"ln-eyebrow\">RoCS · return on cognitive spend</div>\n <div className=\"font-mono text-[11px] text-ink-faint\">{rangeLabel(sinceDays)}</div>\n </div>\n {rocs.isLoading ? (\n Array.from({ length: 3 }, (_, i) => <SkeletonRow key={i} />)\n ) : rocs.data?.spend.length === 0 ? (\n <div className=\"px-6 pb-6\">\n <EmptyNote note=\"No spend in this window to attribute to outcomes yet.\" />\n </div>\n ) : (\n <table className=\"w-full text-[13px]\">\n <thead>\n <tr className=\"text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n <th className=\"px-6 py-2 text-left font-medium\">play</th>\n <th className=\"py-2 text-left font-medium\">spend · {sparkDays}d</th>\n <th className=\"py-2 text-right font-medium\">spend</th>\n <th className=\"py-2 text-right font-medium\">meetings</th>\n <th className=\"py-2 text-right font-medium\">SQLs</th>\n <th className=\"py-2 text-right font-medium\">won</th>\n <th className=\"py-2 text-right font-medium\">$/meeting</th>\n <th className=\"px-6 py-2 text-right font-medium\">$/won</th>\n </tr>\n </thead>\n <tbody>\n {rocs.data?.spend.map((s, i) => {\n const oc = rocs.data.outcomes.find((o) => o.playName === s.playName);\n const meet = oc?.meetings ?? 0;\n const sql = oc?.sqls ?? 0;\n const won = oc?.won ?? 0;\n const series = spendSeries.get(s.playName) ?? [];\n return (\n <tr\n key={s.playName}\n className={cn(\n \"border-t border-ink-rule/60\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n <td className=\"px-6 py-2 text-ink-cream\">{s.playName}</td>\n <td className=\"py-2\">\n {series.length > 1 ? (\n <Sparkline\n values={series}\n tone=\"spend\"\n width={96}\n height={22}\n aria-label={`${s.playName} spend over last ${sparkDays} days`}\n />\n ) : (\n <span className=\"font-mono text-[11px] text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream\">\n {formatUsd(s.totalUsd)}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{meet}</td>\n <td className=\"py-2 text-right font-mono text-ink-muted\">{sql}</td>\n <td className=\"py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {won}\n </td>\n <td className=\"py-2 text-right font-mono text-ink-cream-2\">\n {meet > 0 ? (\n formatUsd(s.totalUsd / meet)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n <td className=\"px-6 py-2 text-right font-mono text-[color:var(--ink-receipt-2)]\">\n {won > 0 ? (\n formatUsd(s.totalUsd / won)\n ) : (\n <span className=\"text-ink-faint\">—</span>\n )}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </section>\n </div>\n );\n}\n\n/**\n * Group receipts by play and compute a daily spend histogram (oldest → newest).\n * Returns a Map keyed by playName. Receipts without a `costUsd` value are\n * skipped. Days beyond `windowDays` are dropped.\n */\nfunction buildSpendSeries(receipts: ReceiptView[], windowDays: number): Map<string, number[]> {\n const days = Math.max(7, Math.min(windowDays, 90));\n const now = Date.now();\n const DAY_MS = 24 * 3600 * 1000;\n const out = new Map<string, number[]>();\n\n for (const r of receipts) {\n if (r.costUsd == null) continue;\n const ts = new Date(r.createdAt).getTime();\n if (Number.isNaN(ts)) continue;\n const daysAgo = Math.floor((now - ts) / DAY_MS);\n if (daysAgo < 0 || daysAgo >= days) continue;\n const idx = days - 1 - daysAgo;\n let arr = out.get(r.playName);\n if (!arr) {\n arr = Array.from({ length: days }, () => 0);\n out.set(r.playName, arr);\n }\n arr[idx] = (arr[idx] ?? 0) + r.costUsd;\n }\n return out;\n}\n\nfunction Summary({\n label,\n value,\n caption,\n tone = \"neutral\",\n}: {\n label: string;\n value: string | undefined;\n caption?: string;\n /** Caption tint only; the number itself stays cream. */\n tone?: \"neutral\" | \"receipt\" | \"spend\";\n}) {\n const captionColor =\n tone === \"spend\"\n ? \"var(--ink-spend-2)\"\n : tone === \"receipt\"\n ? \"var(--ink-receipt-2)\"\n : \"var(--ink-faint)\";\n return (\n <div className=\"px-5 py-4\">\n <div className=\"ln-eyebrow\">{label}</div>\n <div\n className=\"mt-1 truncate text-ink-cream ln-numeral\"\n style={{ fontSize: 34, lineHeight: 1 }}\n >\n {value ?? <span className=\"text-ink-faint\">—</span>}\n </div>\n {caption && (\n <div className=\"mt-2 truncate font-mono text-[11px]\" style={{ color: captionColor }}>\n {caption}\n </div>\n )}\n </div>\n );\n}\n\nfunction rangeLabel(s: number | undefined): string {\n if (s === undefined) return \"all-time\";\n return `last ${s}d`;\n}\n"],"mappings":"uOAoBM,EAAgE,CACpE,QAAS,qBACT,MAAO,mBACP,QAAS,qBACT,OAAQ,oBACR,MAAO,mBACR,CAOD,SAAgB,EAAU,CACxB,SACA,QAAQ,IACR,SAAS,GACT,OAAO,UACP,YAAY,GACZ,OAAO,GACP,MAAM,GACN,YACA,aAAc,GACG,CACjB,IAAM,GAAA,EAAA,EAAA,QAAY,CACZ,EAAS,EAAS,GAElB,CAAE,OAAM,OAAM,OAAM,OAAM,WAAA,EAAA,EAAA,aACxB,EAAU,EAAQ,EAAO,EAAO,CACtC,CAAC,EAAQ,EAAO,EAAO,CACxB,CAcD,OAZI,EAAO,SAAW,GAElB,EAAA,EAAA,KAAC,MAAD,CACS,QACC,SACR,UAAW,EAAG,QAAS,EAAU,CACjC,KAAK,MACL,aAAY,GAAa,UACzB,CAAA,EAKJ,EAAA,EAAA,MAAC,MAAD,CACS,QACC,SACR,QAAS,OAAO,EAAM,GAAG,IACzB,UAAW,EAAG,QAAS,EAAU,CACjC,KAAK,MACL,aAAY,GAAa,qBAN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,KAAKc,OAAOX,EAAMK,GAAMH,MAAO,CAC/C,GAAIQ,EAAU,GAAKA,GAAWd,EAAM,SACpC,IAAMgB,EAAMhB,EAAO,EAAIc,EACnBG,EAAMV,EAAIjB,IAAId,EAAEY,SAAS,CACxB6B,IACHA,EAAMpC,MAAMC,KAAK,CAAEC,OAAQiB,EAAM,KAAQ,EAAE,CAC3CO,EAAIW,IAAI1C,EAAEY,SAAU6B,EAAI,EAE1BA,EAAID,IAAQC,EAAID,IAAQ,GAAKxC,EAAEgC,QAEjC,OAAOD,EAGT,SAASY,EAAQ,CACfrF,QACAC,QACAqF,UACAC,OAAO,WAON,CAOD,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,qBAAf,EACE,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sBAAcvF,EAAW,CAAA,EACxC,EAAA,EAAA,KAAC,MAAD,CACE,UAAU,0CACV,MAAO,CAAEqC,SAAU,GAAIG,WAAY,EAAG,UAErCvC,IAAS,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,0BAAiB,IAAQ,CAAA,CAChD,CAAA,CACJqF,IACC,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,sCAAsC,MAAO,CAAEG,MAflEF,IAAS,QACL,qBACAA,IAAS,UACP,uBACA,mBAWiF,UAChFD,EAEJ,CAAA,CACG,GAIV,SAASzC,EAAWrB,EAA+B,CAEjD,OADIA,IAAMtB,IAAAA,GAAkB,WACrB,QAAQsB,EAAC"}
@@ -0,0 +1,2 @@
1
+ import{c as e,d as t,l as n,n as r,o as i,s as a,t as o}from"./Button-NJ1UVzeB.js";import{a as s,c,f as l,l as u,m as d,n as f,o as p,p as m,u as h}from"./index-CzTgATNQ.js";import{r as g}from"./Field-B4mT8TGa.js";import{n as _}from"./Skeleton-d2p06ghN.js";var v=a(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),y=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),b=a(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),x=t(n()),S=e();function C({steps:e,className:t}){return e.length===0?(0,S.jsx)(`div`,{className:r(`ln-note text-[11.5px] text-ink-faint`,t),children:`no cadence`}):e.length===1?(0,S.jsxs)(`div`,{className:r(`flex items-center gap-2 text-[11.5px] text-ink-faint`,t),children:[(0,S.jsx)(`span`,{className:`h-[6px] w-[6px] rounded-full bg-[color:var(--ink-signal)]`}),(0,S.jsx)(`span`,{className:`font-mono`,children:`one-touch · day 0`})]}):(0,S.jsx)(`div`,{className:r(`flex items-center gap-0 overflow-hidden`,t),children:e.map((t,n)=>{let i=n===e.length-1;return(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[(0,S.jsxs)(`span`,{className:`flex flex-col items-center gap-0.5`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:r(`h-[6px] w-[6px] rounded-full`,t.breakup?`bg-[color:var(--ink-spend)]`:n===0?`bg-[color:var(--ink-signal)]`:`bg-[color:var(--ink-signal)]/60`)}),(0,S.jsxs)(`span`,{className:`whitespace-nowrap font-mono text-[10px] text-ink-faint`,children:[`d`,t.day]}),(0,S.jsx)(`span`,{className:`whitespace-nowrap text-[10px] text-ink-muted`,children:t.label})]}),!i&&(0,S.jsx)(`span`,{"aria-hidden":`true`,className:r(`mx-2 mb-[14px] h-px w-6 shrink-0`,`bg-ink-rule`)})]},`${t.day}-${t.label}`)})})}var w={email:p,sms:y,voice:b,linkedin:y},T=new Set([`show-hn`,`job-change`,`post-funding`,`accelerator-batch`,`hiring-signal`,`podcast-guest`,`stack-consolidation`]),E={"show-hn":{description:`One-touch founder-to-founder reply to a recent Show HN post, referencing a specific comment thread.`,steps:[{day:0,label:`send`}]},"job-change":{description:`Trigger: prospect started a new role at a target company. Day-0 send; day-5 follow-up; day-14 breakup.`,steps:[{day:0,label:`send`},{day:5,label:`follow-up`},{day:14,label:`breakup`,breakup:!0}]},"post-funding":{description:`Trigger: prospect's company announced a round. Day-3 congrats; day-9 follow-up; day-18 breakup.`,steps:[{day:0,label:`send`},{day:9,label:`follow-up`},{day:18,label:`breakup`,breakup:!0}]},"accelerator-batch":{description:`Founder-to-founder outreach within or across accelerator batches (YC, OD, SPC, Antler, Techstars).`,steps:[{day:0,label:`send`},{day:5,label:`follow-up`},{day:12,label:`breakup`,breakup:!0}]},concierge:{description:`Autonomous voice onboarding for new signups. Pre-call email → voice call → post-call summary email.`,steps:[{day:0,label:`prep email`},{day:0,label:`voice`},{day:0,label:`summary`}]},"demo-no-show":{description:`Same-day SMS + email recovery for demo no-shows; cadence engine handles day-3 follow-up.`,steps:[{day:0,label:`sms + email`},{day:3,label:`follow-up`}]},"competitor-switch":{description:`Migration-honesty pitch for prospects using a competing vendor. Optional G2 / BuiltWith scrape.`,steps:[{day:0,label:`send`}]},"stack-consolidation":{description:`Consolidation-honesty pitch for repos wiring up several API vendors. Fed by the github-topics finder.`,steps:[{day:0,label:`send`}]},"hiring-signal":{description:`Triggered by a job post at a target company. One-touch email to the hiring manager with your ramp-time claim.`,steps:[{day:0,label:`send`}]},"podcast-guest":{description:`One-touch reply to a recent podcast guest referencing a specific moment from the episode.`,steps:[{day:0,label:`send`}]},"breakup-revive":{description:"Pattern-interrupt for ledger cold leads (60–90 days). Pulled from `listColdProspects`.",steps:[{day:0,label:`revive`}]}};function D(){let e=m({queryKey:[`plays`],queryFn:i.plays}),t=O(m({queryKey:[`receipts`,`plays-catalogue`],queryFn:()=>i.receipts({limit:500}),staleTime:6e4}).data?.receipts??[]),[n,a]=(0,x.useState)(null);return(0,S.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,S.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Plays`}),(0,S.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`The motion catalogue.`}),(0,S.jsx)(`p`,{className:`ln-note mt-2 max-w-[64ch] text-[13px] text-ink-cream-2`,children:`Ten motion plays. Each one is a known signal you can act on — trigger, cadence, anti-slop lint, signed receipt. Run from the CLI or, for the six queue-drain plays, from the dashboard.`})]}),(0,S.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:e.data?(0,S.jsxs)(S.Fragment,{children:[e.data.plays.length,` `,(0,S.jsx)(`span`,{className:`text-ink-muted`,children:`plays`})]}):`…`})]}),(0,S.jsx)(`section`,{children:e.isLoading?(0,S.jsx)(`div`,{children:Array.from({length:8},(e,t)=>(0,S.jsx)(_,{},t))}):(0,S.jsx)(`div`,{children:e.data?.plays.map((e,i)=>{let l=E[e.name],d=T.has(e.name),f=t.get(e.name)??0;return(0,S.jsxs)(`div`,{className:r(`group grid gap-x-6 gap-y-3 px-6 py-5`,`grid-cols-[minmax(220px,280px)_1fr_auto]`,`border-b border-ink-rule/60`,`transition-colors duration-[var(--dur-stamp)]`,`hover:bg-ink-surface/40`,i%2==1&&`bg-ink-surface/20`),children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`code`,{className:`font-mono text-[15px] font-medium text-ink-cream`,style:{fontFeatureSettings:`"zero"`},children:e.name}),d&&(0,S.jsx)(`span`,{className:`font-mono text-[10px] text-ink-faint`,children:`· runnable`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-1 text-ink-muted`,children:e.channels.map(e=>(0,S.jsx)(`span`,{className:`inline-flex h-[18px] w-[18px] items-center justify-center rounded-[var(--radius-xs)] border border-ink-rule`,title:e,children:(0,S.jsx)(w[e]??p,{size:10})},e))}),(0,S.jsxs)(`span`,{className:`font-mono text-[11px] text-ink-faint`,children:[e.followupCount,` follow-up`,e.followupCount===1?``:`s`,e.hasBreakup?` · breakup`:``]})]}),(0,S.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:f>0?(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`text-[color:var(--ink-receipt-2)]`,children:f}),` receipt`,f===1?``:`s`,` signed`]}):(0,S.jsx)(`span`,{children:`no receipts yet`})})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 min-w-0`,children:[l?.description&&(0,S.jsx)(`p`,{className:`ln-note text-[13px] text-ink-cream-2`,children:l.description}),(0,S.jsx)(k,{play:e}),(0,S.jsxs)(`code`,{className:r(`block overflow-x-auto whitespace-nowrap rounded-[var(--radius-sm)]`,`border border-ink-rule bg-ink-bg-deep px-2.5 py-1.5`,`font-mono text-[12px] text-ink-cream-2`),children:[`$ `,e.cliInvocation]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[d&&(0,S.jsx)(h,{to:`/run/$playName`,params:{playName:e.name},className:`inline-flex`,children:(0,S.jsxs)(o,{variant:`primary`,size:`sm`,children:[(0,S.jsx)(s,{size:12}),` run`]})}),(0,S.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(e.cliInvocation),a(e.name),setTimeout(()=>a(t=>t===e.name?null:t),1500)},children:n===e.name?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(u,{size:12}),` copied`]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(c,{size:12}),` copy`]})}),!d&&(0,S.jsx)(`span`,{className:`font-mono text-[10px] text-ink-faint`,children:`CLI only`})]})]},e.name)})})})]})}function O(e){let t=new Map;for(let n of e)t.set(n.playName,(t.get(n.playName)??0)+1);return t}function k({play:e}){let t=d(),[n,r]=(0,x.useState)(!1),[a,s]=(0,x.useState)(e.steps.map(e=>e.day));(0,x.useEffect)(()=>{n||s(e.steps.map(e=>e.day))},[e.steps,n]);let c=l({mutationFn:t=>i.setCadence(e.name,t),onSuccess:(n,i)=>{t.invalidateQueries({queryKey:[`plays`]}),r(!1),f.success(i===null?`${e.name} · cadence reset`:`${e.name} · timing saved`)},onError:e=>f.error(`couldn't save · ${e.message}`)}),u=[{day:0,label:`send`},...e.steps.map(e=>({day:e.day,label:e.label,breakup:e.label.toLowerCase().includes(`breakup`)}))],p=e.steps.length>0,m=JSON.stringify(a)!==JSON.stringify(e.defaultDays);return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(C,{steps:u}),p&&!n&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`inline-flex items-center gap-1 font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2`,children:[(0,S.jsx)(v,{size:10}),` edit timing`]})]}),n&&(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3`,children:[(0,S.jsx)(`div`,{className:`flex flex-wrap items-end gap-3`,children:e.steps.map((e,t)=>(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[e.label,` · day`]}),(0,S.jsx)(g,{type:`number`,min:1,max:120,value:a[t]??1,onChange:e=>{let n=Math.max(1,Math.min(120,Number.parseInt(e.target.value,10)||1));s(e=>e.map((e,r)=>r===t?n:e))},className:`w-20 font-mono text-[12px]`})]},e.label))}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(o,{size:`sm`,disabled:c.isPending,onClick:()=>c.mutate(a),children:c.isPending?`saving…`:`save`}),(0,S.jsx)(o,{variant:`ghost`,size:`sm`,disabled:c.isPending||!m,onClick:()=>c.mutate(null),title:`Restore the code-default timing`,children:`reset to default`}),(0,S.jsx)(o,{variant:`ghost`,size:`sm`,disabled:c.isPending,onClick:()=>{s(e.steps.map(e=>e.day)),r(!1)},children:`cancel`})]}),(0,S.jsxs)(`p`,{className:`font-mono text-[10px] text-ink-faint`,children:[`cumulative days from the day-0 send · strictly increasing · 1–120 · default`,` `,e.defaultDays.map(e=>`d${e}`).join(` · `)]})]})]})}export{D as component};
2
+ //# sourceMappingURL=plays-DHIZA49D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plays-DHIZA49D.js","names":["__iconNode","__iconNode","useMutation","useQuery","useQueryClient","Link","Check","Clock","Copy","Mail","MessageSquare","Phone","Play","useEffect","useState","toast","api","Button","Input","SkeletonRow","CadenceTimeline","cn","CHANNEL_ICON","email","sms","voice","linkedin","const","RUNNABLE_PLAYS","Set","PLAY_META","Record","description","steps","CadenceStep","day","label","breakup","concierge","PlaysPage","plays","queryKey","queryFn","receipts","limit","staleTime","receiptCounts","groupByPlay","data","copiedName","setCopiedName","fontFamily","fontSize","fontWeight","letterSpacing","lineHeight","length","isLoading","Array","from","_","i","map","p","meta","name","runnable","has","count","get","fontFeatureSettings","channels","ch","Icon","followupCount","hasBreakup","cliInvocation","playName","navigator","clipboard","writeText","setTimeout","n","rows","T","Map","m","r","set","CadenceEditor","play","PlayDescriptor","qc","editing","setEditing","days","setDays","s","save","mutationFn","next","setCadence","onSuccess","_data","invalidateQueries","success","onError","err","error","message","timeline","toLowerCase","includes","hasFollowups","isModified","JSON","stringify","defaultDays","e","v","Math","max","min","Number","parseInt","target","value","prev","d","j","isPending","mutate","join","component"],"sources":["../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/clock.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/message-square.mjs","../../../../node_modules/.bun/lucide-react@1.9.0+3f10a4be4e334a9b/node_modules/lucide-react/dist/esm/icons/phone.mjs","../../src/components/plays/CadenceTimeline.tsx","../../src/routes/plays.tsx?tsr-split=component"],"sourcesContent":["/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"10\", key: \"1mglay\" }],\n [\"path\", { d: \"M12 6v6l4 2\", key: \"mmk7yg\" }]\n];\nconst Clock = createLucideIcon(\"clock\", __iconNode);\n\nexport { __iconNode, Clock as default };\n//# sourceMappingURL=clock.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\",\n key: \"18887p\"\n }\n ]\n];\nconst MessageSquare = createLucideIcon(\"message-square\", __iconNode);\n\nexport { __iconNode, MessageSquare as default };\n//# sourceMappingURL=message-square.mjs.map\n","/**\n * @license lucide-react v1.9.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\",\n key: \"9njp5v\"\n }\n ]\n];\nconst Phone = createLucideIcon(\"phone\", __iconNode);\n\nexport { __iconNode, Phone as default };\n//# sourceMappingURL=phone.mjs.map\n","import { cn } from \"../../lib/cn.ts\";\n\nexport interface CadenceStep {\n /** Day offset from enrollment (0 = first send). */\n day: number;\n label: string;\n /** When true, this is the final \"breakup\" touch — dot is amber, not cobalt. */\n breakup?: boolean;\n}\n\n/**\n * A small horizontal timeline of cadence steps — day-0 send on the left,\n * follow-ups walking right, breakup amber. When there's only one step the\n * timeline reads \"one-touch · no follow-ups\".\n */\nexport function CadenceTimeline({\n steps,\n className,\n}: {\n steps: CadenceStep[];\n className?: string;\n}) {\n if (steps.length === 0) {\n return <div className={cn(\"ln-note text-[11.5px] text-ink-faint\", className)}>no cadence</div>;\n }\n if (steps.length === 1) {\n return (\n <div className={cn(\"flex items-center gap-2 text-[11.5px] text-ink-faint\", className)}>\n <span className=\"h-[6px] w-[6px] rounded-full bg-[color:var(--ink-signal)]\" />\n <span className=\"font-mono\">one-touch · day 0</span>\n </div>\n );\n }\n\n return (\n <div className={cn(\"flex items-center gap-0 overflow-hidden\", className)}>\n {steps.map((s, i) => {\n const isLast = i === steps.length - 1;\n return (\n <span key={`${s.day}-${s.label}`} className=\"flex min-w-0 items-center\">\n <span className=\"flex flex-col items-center gap-0.5\">\n <span\n aria-hidden=\"true\"\n className={cn(\n \"h-[6px] w-[6px] rounded-full\",\n s.breakup\n ? \"bg-[color:var(--ink-spend)]\"\n : i === 0\n ? \"bg-[color:var(--ink-signal)]\"\n : \"bg-[color:var(--ink-signal)]/60\",\n )}\n />\n <span className=\"whitespace-nowrap font-mono text-[10px] text-ink-faint\">\n d{s.day}\n </span>\n <span className=\"whitespace-nowrap text-[10px] text-ink-muted\">{s.label}</span>\n </span>\n {!isLast && (\n <span\n aria-hidden=\"true\"\n className={cn(\"mx-2 mb-[14px] h-px w-6 shrink-0\", \"bg-ink-rule\")}\n />\n )}\n </span>\n );\n })}\n </div>\n );\n}\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { createFileRoute, Link } from \"@tanstack/react-router\";\nimport { Check, Clock, Copy, Mail, MessageSquare, Phone, Play } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport type { PlayDescriptor } from \"@oneshot-gtm/shared-types\";\nimport { api } from \"../api/client.ts\";\nimport { Button } from \"../components/primitives/Button.tsx\";\nimport { Input } from \"../components/primitives/Field.tsx\";\nimport { SkeletonRow } from \"../components/primitives/Skeleton.tsx\";\nimport { CadenceTimeline, type CadenceStep } from \"../components/plays/CadenceTimeline.tsx\";\nimport { cn } from \"../lib/cn.ts\";\n\nexport const Route = createFileRoute(\"/plays\")({\n component: PlaysPage,\n});\n\nconst CHANNEL_ICON = {\n email: Mail,\n sms: MessageSquare,\n voice: Phone,\n linkedin: MessageSquare,\n} as const;\n\n// Mirror of apps/server/src/api/run.ts SUPPORTED — plays whose targets the\n// SSE /api/run endpoint knows how to dispatch.\nconst RUNNABLE_PLAYS = new Set([\n \"show-hn\",\n \"job-change\",\n \"post-funding\",\n \"accelerator-batch\",\n \"hiring-signal\",\n \"podcast-guest\",\n \"stack-consolidation\",\n]);\n\n/**\n * Per-play metadata the API doesn't expose yet — human description + day-\n * offset timeline. Values mirror the sequences defined in\n * packages/plays/src/_cadence.ts on the server.\n */\nconst PLAY_META: Record<string, { description: string; steps: CadenceStep[] }> = {\n \"show-hn\": {\n description:\n \"One-touch founder-to-founder reply to a recent Show HN post, referencing a specific comment thread.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"job-change\": {\n description:\n \"Trigger: prospect started a new role at a target company. Day-0 send; day-5 follow-up; day-14 breakup.\",\n steps: [\n { day: 0, label: \"send\" },\n { day: 5, label: \"follow-up\" },\n { day: 14, label: \"breakup\", breakup: true },\n ],\n },\n \"post-funding\": {\n description:\n \"Trigger: prospect's company announced a round. Day-3 congrats; day-9 follow-up; day-18 breakup.\",\n steps: [\n { day: 0, label: \"send\" },\n { day: 9, label: \"follow-up\" },\n { day: 18, label: \"breakup\", breakup: true },\n ],\n },\n \"accelerator-batch\": {\n description:\n \"Founder-to-founder outreach within or across accelerator batches (YC, OD, SPC, Antler, Techstars).\",\n steps: [\n { day: 0, label: \"send\" },\n { day: 5, label: \"follow-up\" },\n { day: 12, label: \"breakup\", breakup: true },\n ],\n },\n concierge: {\n description:\n \"Autonomous voice onboarding for new signups. Pre-call email → voice call → post-call summary email.\",\n steps: [\n { day: 0, label: \"prep email\" },\n { day: 0, label: \"voice\" },\n { day: 0, label: \"summary\" },\n ],\n },\n \"demo-no-show\": {\n description:\n \"Same-day SMS + email recovery for demo no-shows; cadence engine handles day-3 follow-up.\",\n steps: [\n { day: 0, label: \"sms + email\" },\n { day: 3, label: \"follow-up\" },\n ],\n },\n \"competitor-switch\": {\n description:\n \"Migration-honesty pitch for prospects using a competing vendor. Optional G2 / BuiltWith scrape.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"stack-consolidation\": {\n description:\n \"Consolidation-honesty pitch for repos wiring up several API vendors. Fed by the github-topics finder.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"hiring-signal\": {\n description:\n \"Triggered by a job post at a target company. One-touch email to the hiring manager with your ramp-time claim.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"podcast-guest\": {\n description:\n \"One-touch reply to a recent podcast guest referencing a specific moment from the episode.\",\n steps: [{ day: 0, label: \"send\" }],\n },\n \"breakup-revive\": {\n description:\n \"Pattern-interrupt for ledger cold leads (60–90 days). Pulled from `listColdProspects`.\",\n steps: [{ day: 0, label: \"revive\" }],\n },\n};\n\nfunction PlaysPage() {\n const plays = useQuery({ queryKey: [\"plays\"], queryFn: api.plays });\n\n // Pull a wide window of receipts once and group them client-side so we can\n // show per-play \"signed N this month\" without an API change.\n const receipts = useQuery({\n queryKey: [\"receipts\", \"plays-catalogue\"],\n queryFn: () => api.receipts({ limit: 500 }),\n staleTime: 60_000,\n });\n const receiptCounts = groupByPlay(receipts.data?.receipts ?? []);\n\n const [copiedName, setCopiedName] = useState<string | null>(null);\n\n return (\n <div className=\"-mx-6 -my-6 flex flex-col\">\n {/* Masthead */}\n <section className=\"flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6\">\n <div>\n <div className=\"ln-eyebrow\">The Ledger · Plays</div>\n <h1\n className=\"mt-1 text-ink-cream\"\n style={{\n fontFamily: \"var(--font-display)\",\n fontSize: 44,\n fontWeight: 600,\n letterSpacing: \"-0.025em\",\n lineHeight: 0.98,\n }}\n >\n The motion catalogue.\n </h1>\n <p className=\"ln-note mt-2 max-w-[64ch] text-[13px] text-ink-cream-2\">\n Ten motion plays. Each one is a known signal you can act on — trigger, cadence,\n anti-slop lint, signed receipt. Run from the CLI or, for the six queue-drain plays, from\n the dashboard.\n </p>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">\n {plays.data ? (\n <>\n {plays.data.plays.length} <span className=\"text-ink-muted\">plays</span>\n </>\n ) : (\n \"…\"\n )}\n </div>\n </section>\n\n {/* Plays ledger — one rich row per play */}\n <section>\n {plays.isLoading ? (\n <div>\n {Array.from({ length: 8 }, (_, i) => (\n <SkeletonRow key={i} />\n ))}\n </div>\n ) : (\n <div>\n {plays.data?.plays.map((p, i) => {\n const meta = PLAY_META[p.name];\n const runnable = RUNNABLE_PLAYS.has(p.name);\n const count = receiptCounts.get(p.name) ?? 0;\n return (\n <div\n key={p.name}\n className={cn(\n \"group grid gap-x-6 gap-y-3 px-6 py-5\",\n \"grid-cols-[minmax(220px,280px)_1fr_auto]\",\n \"border-b border-ink-rule/60\",\n \"transition-colors duration-[var(--dur-stamp)]\",\n \"hover:bg-ink-surface/40\",\n i % 2 === 1 && \"bg-ink-surface/20\",\n )}\n >\n {/* Left: name + channel chips + receipt badge */}\n <div className=\"flex flex-col gap-2.5\">\n <div className=\"flex items-baseline gap-2\">\n <code\n className=\"font-mono text-[15px] font-medium text-ink-cream\"\n style={{ fontFeatureSettings: '\"zero\"' }}\n >\n {p.name}\n </code>\n {runnable && (\n <span className=\"font-mono text-[10px] text-ink-faint\">· runnable</span>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex items-center gap-1 text-ink-muted\">\n {p.channels.map((ch) => {\n const Icon = CHANNEL_ICON[ch] ?? Mail;\n return (\n <span\n key={ch}\n className=\"inline-flex h-[18px] w-[18px] items-center justify-center rounded-[var(--radius-xs)] border border-ink-rule\"\n title={ch}\n >\n <Icon size={10} />\n </span>\n );\n })}\n </div>\n <span className=\"font-mono text-[11px] text-ink-faint\">\n {p.followupCount} follow-up{p.followupCount === 1 ? \"\" : \"s\"}\n {p.hasBreakup ? \" · breakup\" : \"\"}\n </span>\n </div>\n <div className=\"font-mono text-[11px] text-ink-faint\">\n {count > 0 ? (\n <span>\n <span className=\"text-[color:var(--ink-receipt-2)]\">{count}</span> receipt\n {count === 1 ? \"\" : \"s\"} signed\n </span>\n ) : (\n <span>no receipts yet</span>\n )}\n </div>\n </div>\n\n {/* Middle: description + cadence timeline + CLI */}\n <div className=\"flex flex-col gap-3 min-w-0\">\n {meta?.description && (\n <p className=\"ln-note text-[13px] text-ink-cream-2\">{meta.description}</p>\n )}\n <CadenceEditor play={p} />\n <code\n className={cn(\n \"block overflow-x-auto whitespace-nowrap rounded-[var(--radius-sm)]\",\n \"border border-ink-rule bg-ink-bg-deep px-2.5 py-1.5\",\n \"font-mono text-[12px] text-ink-cream-2\",\n )}\n >\n $ {p.cliInvocation}\n </code>\n </div>\n\n {/* Right: actions */}\n <div className=\"flex flex-col items-end gap-1.5\">\n {runnable && (\n <Link\n to=\"/run/$playName\"\n params={{ playName: p.name }}\n className=\"inline-flex\"\n >\n <Button variant=\"primary\" size=\"sm\">\n <Play size={12} /> run\n </Button>\n </Link>\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => {\n void navigator.clipboard.writeText(p.cliInvocation);\n setCopiedName(p.name);\n setTimeout(() => setCopiedName((n) => (n === p.name ? null : n)), 1500);\n }}\n >\n {copiedName === p.name ? (\n <>\n <Check size={12} /> copied\n </>\n ) : (\n <>\n <Copy size={12} /> copy\n </>\n )}\n </Button>\n {!runnable && (\n <span className=\"font-mono text-[10px] text-ink-faint\">CLI only</span>\n )}\n </div>\n </div>\n );\n })}\n </div>\n )}\n </section>\n </div>\n );\n}\n\nfunction groupByPlay<T extends { playName: string }>(rows: T[]): Map<string, number> {\n const m = new Map<string, number>();\n for (const r of rows) m.set(r.playName, (m.get(r.playName) ?? 0) + 1);\n return m;\n}\n\n/**\n * Cadence timeline + inline timing editor for a play. The day-0 send is fixed;\n * the founder edits each follow-up's cumulative day (1–120, strictly\n * increasing). Save persists a per-play override; reset clears it back to the\n * code default. Structure (which prompts, breakup position) isn't editable.\n */\nfunction CadenceEditor({ play }: { play: PlayDescriptor }) {\n const qc = useQueryClient();\n const [editing, setEditing] = useState(false);\n const [days, setDays] = useState<number[]>(play.steps.map((s) => s.day));\n\n // Re-sync local state from the server after save/reset — but never while the\n // founder is mid-edit (a background refetch, e.g. on window focus, must not\n // clobber in-progress input).\n useEffect(() => {\n if (!editing) setDays(play.steps.map((s) => s.day));\n }, [play.steps, editing]);\n\n const save = useMutation({\n mutationFn: (next: number[] | null) => api.setCadence(play.name, next),\n onSuccess: (_data, next) => {\n void qc.invalidateQueries({ queryKey: [\"plays\"] });\n setEditing(false);\n toast.success(next === null ? `${play.name} · cadence reset` : `${play.name} · timing saved`);\n },\n onError: (err) => toast.error(`couldn't save · ${err.message}`),\n });\n\n const timeline: CadenceStep[] = [\n { day: 0, label: \"send\" },\n ...play.steps.map((s) => ({\n day: s.day,\n label: s.label,\n breakup: s.label.toLowerCase().includes(\"breakup\"),\n })),\n ];\n const hasFollowups = play.steps.length > 0;\n const isModified = JSON.stringify(days) !== JSON.stringify(play.defaultDays);\n\n return (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex items-center gap-3\">\n <CadenceTimeline steps={timeline} />\n {hasFollowups && !editing && (\n <button\n type=\"button\"\n onClick={() => setEditing(true)}\n className=\"inline-flex items-center gap-1 font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2\"\n >\n <Clock size={10} /> edit timing\n </button>\n )}\n </div>\n {editing && (\n <div className=\"flex flex-col gap-2 rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3\">\n <div className=\"flex flex-wrap items-end gap-3\">\n {play.steps.map((s, i) => (\n <label key={s.label} className=\"flex flex-col gap-1\">\n <span className=\"font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint\">\n {s.label} · day\n </span>\n <Input\n type=\"number\"\n min={1}\n max={120}\n value={days[i] ?? 1}\n onChange={(e) => {\n const v = Math.max(1, Math.min(120, Number.parseInt(e.target.value, 10) || 1));\n setDays((prev) => prev.map((d, j) => (j === i ? v : d)));\n }}\n className=\"w-20 font-mono text-[12px]\"\n />\n </label>\n ))}\n </div>\n <div className=\"flex items-center gap-1.5\">\n <Button size=\"sm\" disabled={save.isPending} onClick={() => save.mutate(days)}>\n {save.isPending ? \"saving…\" : \"save\"}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={save.isPending || !isModified}\n onClick={() => save.mutate(null)}\n title=\"Restore the code-default timing\"\n >\n reset to default\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n disabled={save.isPending}\n onClick={() => {\n setDays(play.steps.map((s) => s.day));\n setEditing(false);\n }}\n >\n cancel\n </Button>\n </div>\n <p className=\"font-mono text-[10px] text-ink-faint\">\n cumulative days from the day-0 send · strictly increasing · 1–120 · default{\" \"}\n {play.defaultDays.map((d) => `d${d}`).join(\" · \")}\n </p>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N,EAAKzD,MAAM6B,IAAKmC,GAAMA,EAAE9D,IAAI,CAAC,CACrC2D,EAAW,GAAM,WACjB,SAGI,CAAA,CACL,IACL,EAAA,EAAA,MAAC,IAAD,CAAG,UAAU,gDAAb,CAAmD,8EAC2B,IAC3EJ,EAAK2B,YAAYvD,IAAKkE,GAAM,IAAIA,IAAI,CAACI,KAAK,MAAM,CAChD,GAEN,GACG"}
@@ -0,0 +1,2 @@
1
+ import{c as e,d as t,i as n,l as r,n as i,o as a,s as o,t as s}from"./Button-NJ1UVzeB.js";import{n as c,t as l}from"./chevron-right-BXb7J1cp.js";import{t as u}from"./loader-circle-BylpxA-u.js";import{a as d,d as f,f as p,l as m,m as h,n as g,p as _,r as v,u as y}from"./index-CzTgATNQ.js";import{t as b}from"./Badge-DE7L41a6.js";import{t as x}from"./EmptyNote-DkmaZWuo.js";import{a as S,n as C,o as w,r as T}from"./Field-B4mT8TGa.js";import{t as E}from"./Modal-frAt7msr.js";import{n as ee}from"./Skeleton-d2p06ghN.js";import{n as D,t as O}from"./summarizeRun-BsPt7szF.js";var k=o(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),A=o(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),j=o(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),M=o(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),N=t(r(),1);function P(e,t=new Date){let n=F(t),r=[];for(let e=6;e>=0;e--){let t=new Date(n);t.setDate(t.getDate()-e),r.push({label:t.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}),count:0,startMs:t.getTime()})}let i=r[0].startMs;for(let t of e){let e=new Date(t.foundAt);if(Number.isNaN(e.getTime()))continue;let a=F(e);if(a.getTime()<i)continue;let o=6-Math.round((n.getTime()-a.getTime())/(24*3600*1e3));o>=0&&o<7&&(r[o].count+=1)}return r}function F(e){let t=new Date(e);return t.setHours(0,0,0,0),t}var I=`oneshot-gtm:trigger-running:`,L=14400*1e3,R=1500;function te(e){try{localStorage.setItem(I+e,String(Date.now()))}catch{}}function z(e){try{localStorage.removeItem(I+e)}catch{}}function B(){try{for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);if(t&&t.startsWith(I))return!0}return!1}catch{return!1}}function V(e){try{let t=localStorage.getItem(I+e);if(!t)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:null}catch{return null}}function H(e,t,n){let[r,i]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(e)},[]);let a=new Map,o=Date.now();for(let r of e){let e=V(r),i=n.get(r),s=i?new Date(i).getTime():null,c=e??s;if(c!=null){if(e!=null){let n=t.get(r),i=n?new Date(n).getTime():0,c=o-e;if(i>e&&c>=R){z(r),s!=null&&s>i&&a.set(r,{startedAt:s,elapsedMs:o-s});continue}if(c>L){z(r);continue}}a.set(r,{startedAt:c,elapsedMs:o-c})}}return a}function U(e){let t=Math.floor(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}var W=e(),ne=[`all`,`pending`,`approved`,`rejected`,`sent`,`expired`],re=[`show-hn`,`job-change`,`post-funding`,`accelerator-batch`,`hiring-signal`,`podcast-guest`,`competitor-switch`,`stack-consolidation`];function G(e){switch(e){case`pending`:return`spend`;case`approved`:return`receipt`;case`rejected`:return`blocked`;case`sent`:return`signal`;case`expired`:return`neutral`}}function K(){let e=h(),t=f(),[n,r]=(0,N.useState)(`pending`),[i,o]=(0,N.useState)(`all`),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(new Set),[y,b]=(0,N.useState)(null),[x,D]=(0,N.useState)(``),[O,k]=(0,N.useState)(null),[A,M]=(0,N.useState)(10),[P,F]=(0,N.useState)(``),[I,L]=(0,N.useState)(``),[R,te]=(0,N.useState)(!0),z=_({queryKey:[`queue`,n,i],queryFn:()=>a.queue({...n===`all`?{}:{status:n},...i===`all`?{}:{play:i},limit:200}),refetchInterval:2e4}),B=()=>{e.invalidateQueries({queryKey:[`queue`]}),e.invalidateQueries({queryKey:[`home`]})},V=p({mutationFn:e=>a.approveQueue(e),onSuccess:B,onError:e=>g.error(`couldn't approve · ${e.message}`)}),H=p({mutationFn:e=>a.rejectQueue(e.id,e.reason),onSuccess:()=>{b(null),D(``),B()},onError:e=>g.error(`couldn't reject · ${e.message}`)}),U=p({mutationFn:e=>a.approveAllQueue(e),onSuccess:e=>{B(),g.success(`approved ${e.approved} pending`)},onError:e=>g.error(`couldn't approve all · ${e.message}`)}),G=p({mutationFn:async e=>{let t=0;for(let n of e)try{await a.approveQueue(n),t++}catch{}return{ok:t,total:e.length}},onSuccess:({ok:e,total:t})=>{d(new Set),B(),g.success(`approved ${e} of ${t}`)}}),K=p({mutationFn:async e=>{let t=0;for(let n of e)try{await a.rejectQueue(n),t++}catch{}return{ok:t,total:e.length}},onSuccess:({ok:e,total:t})=>{d(new Set),B(),g.success(`rejected ${e} of ${t}`)}}),q=O?.playName===`accelerator-batch`&&P.trim().length===0,J=()=>{if(!O||q)return;let e={fromQueue:`1`,limit:String(A),dryRun:R?`1`:`0`};P.trim()&&(e.senderCohort=P.trim()),I.trim()&&(e.freeForCohortOffer=I.trim()),t({to:`/run/$playName`,params:{playName:O.playName},search:e})},X=z.data?.counts??{pending:0,approved:0,rejected:0,sent:0,expired:0},Z=z.data?.rows??[],le=Array.from(new Set(Z.map(e=>e.playName))).toSorted(),Q=u.size>0,$=Z.length>0&&u.size===Z.length;return(0,W.jsxs)(`div`,{className:`-mx-6 -my-6 flex flex-col`,children:[(0,W.jsxs)(`section`,{className:`flex items-end justify-between gap-4 border-b border-ink-rule px-6 pb-5 pt-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,children:`The Ledger · Queue`}),(0,W.jsx)(`h1`,{className:`mt-1 text-ink-cream`,style:{fontFamily:`var(--font-display)`,fontSize:44,fontWeight:600,letterSpacing:`-0.025em`,lineHeight:.98},children:`Candidates, for review.`})]}),(0,W.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:Object.entries(X).map(([e,t])=>`${e} ${t}`).join(` · `)})]}),(0,W.jsx)(se,{}),(0,W.jsx)(oe,{}),(0,W.jsxs)(`section`,{className:`border-t-2 border-ink-rule`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-6 pb-3 pt-5`,children:[(0,W.jsx)(`div`,{className:`flex items-baseline gap-3`,children:(0,W.jsxs)(`div`,{className:`ln-eyebrow`,children:[`Target Queue`,` `,(0,W.jsxs)(`span`,{className:`text-ink-faint`,children:[`· `,z.data?Z.length:`…`,` row`,Z.length===1?``:`s`]})]})}),(0,W.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:`refresh · 20s`})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-ink-rule/60 px-6 pb-3`,children:[(0,W.jsx)(`span`,{className:`ln-eyebrow`,children:`status`}),ne.map(e=>(0,W.jsx)(s,{variant:n===e?`primary`:`ghost`,size:`sm`,onClick:()=>r(e),children:e},e)),(0,W.jsx)(`span`,{className:`mx-2 h-4 w-px bg-ink-rule`}),(0,W.jsx)(`span`,{className:`ln-eyebrow`,children:`play`}),(0,W.jsx)(s,{variant:i===`all`?`primary`:`ghost`,size:`sm`,onClick:()=>o(`all`),children:`all`}),le.map(e=>(0,W.jsx)(s,{variant:i===e?`primary`:`ghost`,size:`sm`,onClick:()=>o(e),children:e},e))]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-ink-rule/60 bg-ink-surface/30 px-6 py-3`,children:[(0,W.jsxs)(s,{variant:`secondary`,size:`sm`,disabled:U.isPending||X.pending===0,onClick:()=>U.mutate(i===`all`?void 0:i),children:[(0,W.jsx)(m,{size:12}),` approve all pending`,i===`all`?``:` (${i})`]}),re.map(e=>(0,W.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:X.approved===0||i!==`all`&&i!==e||!Z.some(t=>t.playName===e&&t.status===`approved`),onClick:()=>k({playName:e,approvedCount:Z.filter(t=>t.playName===e&&t.status===`approved`).length}),children:[(0,W.jsx)(j,{size:12}),` drain `,e]},e))]}),Z.length>0&&(0,W.jsx)(ae,{rows:Z}),z.isLoading?Array.from({length:5},(e,t)=>(0,W.jsx)(ee,{},t)):Z.length===0?(0,W.jsx)(ce,{filterActive:n!==`pending`||i!==`all`}):(0,W.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,W.jsx)(`thead`,{className:`sticky top-0 z-10 bg-ink-bg`,children:(0,W.jsxs)(`tr`,{className:`border-b border-ink-rule text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,W.jsx)(`th`,{className:`w-6 py-2`}),(0,W.jsx)(`th`,{className:`w-6 py-2`,children:(0,W.jsx)(`label`,{className:`inline-flex cursor-pointer items-center`,children:(0,W.jsx)(`input`,{type:`checkbox`,className:`h-[13px] w-[13px] rounded-[var(--radius-xs)] border border-ink-rule bg-ink-bg-deep accent-[color:var(--ink-signal)]`,checked:$,ref:e=>{e&&(e.indeterminate=Q&&!$)},onChange:e=>d(e.target.checked?new Set(Z.map(e=>e.id)):new Set),"aria-label":$?`deselect all`:`select all`})})}),(0,W.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`id`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`prospect`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`play`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`status`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`source`}),(0,W.jsx)(`th`,{className:`py-2 text-right font-medium`,children:`found`}),(0,W.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`actions`})]})}),(0,W.jsx)(`tbody`,{children:Z.map((e,t)=>(0,W.jsx)(ie,{row:e,zebra:t%2==1,expanded:c===e.id,selected:u.has(e.id),anySelected:Q,onToggleSelect:()=>{d(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})},onToggle:()=>l(c===e.id?null:e.id),onApprove:()=>V.mutate(e.id),onReject:()=>b({id:e.id,email:Y(e.payload)??`#${e.id}`}),busy:V.isPending||H.isPending},e.id))})]})]}),Q&&(0,W.jsxs)(`div`,{className:`sticky bottom-0 z-20 flex items-center justify-between gap-4 border-b border-t border-ink-rule bg-ink-bg/95 px-6 py-3 backdrop-blur-[2px]`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`span`,{className:`inline-flex h-6 min-w-[24px] items-center justify-center rounded-full bg-[color:var(--ink-signal)]/20 px-2 font-mono text-[12px] text-[color:var(--ink-signal-2)]`,children:u.size}),(0,W.jsx)(`span`,{className:`text-[13px] text-ink-cream-2`,children:u.size===1?`row selected`:`rows selected`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>d(new Set),className:`font-mono text-[11px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream hover:decoration-ink-cream-2`,children:`clear`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsxs)(s,{variant:`secondary`,size:`sm`,disabled:G.isPending||u.size===0,onClick:()=>G.mutate([...u]),children:[(0,W.jsx)(m,{size:12}),` approve `,u.size]}),(0,W.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:K.isPending||u.size===0,onClick:()=>K.mutate([...u]),children:[(0,W.jsx)(v,{size:12}),` reject `,u.size]})]})]}),(0,W.jsx)(E,{open:y!=null,onClose:()=>b(null),title:`Reject #${y?.id} — ${y?.email??``}`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{variant:`ghost`,onClick:()=>b(null),children:`Cancel`}),(0,W.jsx)(s,{variant:`danger`,onClick:()=>y&&H.mutate({id:y.id,reason:x||void 0}),disabled:H.isPending,children:H.isPending?`Rejecting…`:`Reject`})]}),children:(0,W.jsx)(C,{label:`Reason (optional, logged for ICP-filter learning)`,children:(0,W.jsx)(S,{rows:3,value:x,onChange:e=>D(e.target.value),placeholder:`e.g. wrong stage, wrong industry, already a customer`})})}),(0,W.jsx)(E,{open:O!=null,onClose:()=>k(null),title:`Drain ${O?.playName??``} (${O?.approvedCount??0} approved)`,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{variant:`ghost`,onClick:()=>k(null),children:`Cancel`}),(0,W.jsxs)(s,{onClick:J,disabled:q,children:[(0,W.jsx)(j,{size:12}),R?`Preview drafts (no send)`:`Send up to ${A}`]})]}),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsx)(C,{label:`Limit`,children:(0,W.jsx)(T,{type:`number`,min:1,value:A,onChange:e=>M(Math.max(1,Number.parseInt(e.target.value,10)||1))})}),O?.playName===`accelerator-batch`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{label:`Sender cohort (required)`,hint:`Your accelerator/cohort tag, e.g. yc-w23`,children:(0,W.jsx)(T,{value:P,onChange:e=>F(e.target.value),placeholder:`yc-w23`,required:!0})}),(0,W.jsx)(C,{label:`Free-for-cohort offer (optional)`,children:(0,W.jsx)(T,{value:I,onChange:e=>L(e.target.value),placeholder:`Free for current YC W26 through demo day, just reply with your batch.`})})]}),(0,W.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2.5 text-[13px] text-ink-cream-2 hover:text-ink-cream`,children:[(0,W.jsx)(w,{checked:R,onChange:te,label:`dry run`}),(0,W.jsx)(`span`,{children:`Dry run — preview drafts only, no send (a one-time enrich lookup may apply)`})]}),(0,W.jsx)(`p`,{className:`font-mono text-[11px] text-ink-faint`,children:`Drafts stream live on the next page — every lint flag and send confirmation is visible per row.`}),q&&(0,W.jsx)(`p`,{className:`font-mono text-[11px] text-[color:var(--ink-blocked-2)]`,children:`accelerator-batch needs a sender cohort tag before it can run.`})]})})]})}function ie({row:e,zebra:t,expanded:r,selected:a,anySelected:o,onToggleSelect:u,onToggle:d,onApprove:f,onReject:p,busy:h}){let g=Y(e.payload),_=X(e.payload),y=Z(e.payload),x=le(e.payload),S=Q(e.payload);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`tr`,{className:i(`group cursor-pointer border-b border-ink-rule/60`,`transition-colors duration-[var(--dur-stamp)]`,`hover:bg-ink-surface/60`,t&&`bg-ink-surface/20`,a&&`bg-[color:var(--ink-signal)]/8`),onClick:d,children:[(0,W.jsx)(`td`,{className:`w-6 py-2 pl-4 pr-0 text-ink-faint`,children:r?(0,W.jsx)(c,{size:12}):(0,W.jsx)(l,{size:12})}),(0,W.jsx)(`td`,{className:`w-6 py-2`,onClick:e=>e.stopPropagation(),children:(0,W.jsx)(`label`,{className:`inline-flex cursor-pointer items-center`,children:(0,W.jsx)(`input`,{type:`checkbox`,className:i(`h-[13px] w-[13px] rounded-[var(--radius-xs)]`,`border border-ink-rule bg-ink-bg-deep accent-[color:var(--ink-signal)]`,`transition-opacity duration-[var(--dur-stamp)]`,a||o?`opacity-100`:`opacity-0 group-hover:opacity-100 focus:opacity-100`),checked:a,onChange:u,"aria-label":a?`deselect #${e.id}`:`select #${e.id}`})})}),(0,W.jsxs)(`td`,{className:`px-6 py-2 font-mono text-[11px] text-ink-faint`,children:[`#`,e.id]}),(0,W.jsxs)(`td`,{className:`py-2`,children:[(0,W.jsx)(`div`,{className:`text-ink-cream`,children:_??`(unknown)`}),(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:[g??`—`,y?` · ${y}`:``,x?(0,W.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`ml-1 text-ink-cream-2 underline decoration-ink-rule underline-offset-2 hover:text-ink-cream hover:decoration-ink-cream-2`,onClick:e=>e.stopPropagation(),children:`[in]`}):null,S?(0,W.jsxs)(`span`,{className:`ml-1 text-ink-faint`,children:[`· `,S]}):null]})]}),(0,W.jsx)(`td`,{className:`py-2 text-ink-cream-2`,children:e.playName}),(0,W.jsx)(`td`,{className:`py-2`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(b,{tone:G(e.status),children:e.status}),e.lastDraft&&(0,W.jsx)(b,{tone:e.lastDraft.sent?`receipt`:e.lastDraft.flags.length>0?`blocked`:`neutral`,title:e.lastDraft.sent?`draft sent`:e.lastDraft.flags.length>0?`draft held · ${e.lastDraft.flags.length} flag(s)`:`draft preview`,children:`draft`})]})}),(0,W.jsx)(`td`,{className:`py-2 font-mono text-[11px] text-ink-faint`,children:e.source}),(0,W.jsx)(`td`,{className:`py-2 text-right font-mono text-[12px] text-ink-muted`,children:n(e.foundAt)}),(0,W.jsx)(`td`,{className:`px-6 py-2 text-right`,onClick:e=>e.stopPropagation(),children:(0,W.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:e.status===`pending`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{variant:`ghost`,size:`sm`,title:`approve`,disabled:h,onClick:f,children:(0,W.jsx)(m,{size:12})}),(0,W.jsx)(s,{variant:`ghost`,size:`sm`,title:`reject`,disabled:h,onClick:p,children:(0,W.jsx)(v,{size:12})})]})})})]}),r&&(0,W.jsx)(`tr`,{className:`border-b border-ink-rule/60 bg-ink-bg-deep/50`,children:(0,W.jsx)(`td`,{colSpan:9,className:`px-6 py-3`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 text-[12px] text-ink-muted`,children:[e.notes?(0,W.jsx)(`div`,{className:`ln-note`,children:e.notes}):null,(0,W.jsx)(q,{id:e.id,playName:e.playName,status:e.status,draft:e.lastDraft,draftedAt:e.lastDraftedAt}),(0,W.jsxs)(`details`,{className:`text-ink-faint`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer font-mono text-[10px] uppercase tracking-[0.14em] hover:text-ink-cream-2`,children:`payload json`}),(0,W.jsx)(`pre`,{className:`mt-2 max-h-[300px] overflow-auto rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep p-3 font-mono text-[11.5px] leading-[1.55] text-ink-cream-2`,children:JSON.stringify(e.payload,null,2)})]})]})})})]})}function q({id:e,playName:t,status:r,draft:i,draftedAt:o}){let c=h(),l=p({mutationFn:()=>a.regenerateDraft(e),onSuccess:()=>{c.invalidateQueries({queryKey:[`queue`]}),g.success(`draft ready · preview only, not sent`)},onError:e=>g.error(`couldn't draft · ${e.message}`)}),d=p({mutationFn:()=>a.sendDraft(e),onSuccess:()=>{c.invalidateQueries({queryKey:[`queue`]}),c.invalidateQueries({queryKey:[`home`]}),g.success(`sent · the reviewed draft went out as-is`)},onError:e=>g.error(`couldn't send · ${e.message}`)}),f=t!==`accelerator-batch`&&!(i?.sent??!1),m=i?`regenerate`:`generate draft`,_=i?`regenerating…`:`generating…`,v=f?(0,W.jsxs)(s,{variant:`ghost`,size:`sm`,disabled:l.isPending,onClick:()=>l.mutate(),title:`Draft this row in preview mode — dry-run, never sends`,children:[l.isPending?(0,W.jsx)(u,{size:11,className:`animate-spin`}):(0,W.jsx)(A,{size:11}),l.isPending?_:m]}):null,x=i!=null&&i.flags.length===0&&!i.sent,S=r===`approved`&&!(i?.sent??!1)?(0,W.jsxs)(s,{variant:`secondary`,size:`sm`,disabled:d.isPending||!x,onClick:()=>d.mutate(),title:x?`Send this prospect now — sends the reviewed draft above, as-is`:i==null?`Generate a draft first, then send it`:`Draft has lint flags — regenerate to clear them, then send`,children:[d.isPending?(0,W.jsx)(u,{size:11,className:`animate-spin`}):(0,W.jsx)(j,{size:11}),d.isPending?`sending…`:`send this one`]}):null;if(!i)return(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-[var(--radius-sm)] border border-dashed border-ink-rule bg-ink-bg-deep px-3 py-2.5`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:`no draft yet`}),(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S,v]})]});let C=i.sent?`receipt`:i.flags.length>0?`blocked`:i.dryRun?`spend`:`neutral`,w=i.sent?`sent`:i.flags.length>0?`held · lint`:i.dryRun?`preview`:`drafted`;return(0,W.jsxs)(`div`,{className:`rounded-[var(--radius-sm)] border border-ink-rule bg-ink-bg-deep`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-ink-rule/60 px-3 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,W.jsx)(`span`,{children:`last draft`}),o?(0,W.jsxs)(`span`,{className:`text-ink-muted`,children:[`· `,n(o)]}):null,(0,W.jsx)(b,{tone:C,children:w}),i.flags.length>0&&i.flags.map(e=>(0,W.jsx)(b,{tone:`blocked`,children:e},e)),(0,W.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 normal-case tracking-normal`,children:[i.receiptIds.map(e=>(0,W.jsxs)(y,{to:`/receipts`,className:`font-mono text-[10px] text-ink-faint underline decoration-ink-rule underline-offset-2 hover:text-ink-cream-2`,children:[`receipt #`,e]},e)),S,v]})]}),(0,W.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,W.jsx)(`div`,{className:`text-[13px] font-medium text-ink-cream`,children:i.subject}),(0,W.jsx)(`pre`,{className:`mt-2 max-h-[360px] overflow-auto whitespace-pre-wrap font-mono text-[11.5px] leading-[1.55] text-ink-cream-2`,children:i.body})]})]})}function ae({rows:e}){let t=P(e),n=Math.max(1,...t.map(e=>e.count)),r=t.reduce((e,t)=>e+t.count,0);return(0,W.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-ink-rule/60 bg-ink-bg-deep/40 px-6 py-2.5`,children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,style:{fontSize:10},children:`last 7d`}),(0,W.jsx)(`div`,{className:`flex items-end gap-1`,"aria-hidden":`true`,children:t.map(e=>{let t=Math.round(e.count/n*20);return(0,W.jsx)(`span`,{title:`${e.label} · ${e.count} enqueued`,className:i(`w-[10px] rounded-[1px]`,e.count===0?`bg-ink-rule`:`bg-[color:var(--ink-signal)]/70`),style:{height:Math.max(2,t)}},e.label)})}),(0,W.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-muted`,children:[r,` enqueued`,(0,W.jsxs)(`span`,{className:`ml-2 text-ink-faint`,children:[`· `,(0,W.jsx)(`span`,{className:`text-ink-cream-2`,children:t[t.length-1]?.count??0}),` today`]})]})]})}function oe(){let e=h(),t=_({queryKey:[`triggers`],queryFn:()=>a.triggers(),refetchInterval:e=>B()||e.state.data?.triggers.some(e=>e.running)?5e3:3e4}),n=p({mutationFn:e=>a.setTriggerEnabled(e.name,e.enabled),onSuccess:()=>void e.invalidateQueries({queryKey:[`triggers`]}),onError:e=>g.error(e.message)}),r=p({mutationFn:e=>a.setTriggerConfig(e.name,e.config),onSuccess:()=>{s(null),e.invalidateQueries({queryKey:[`triggers`]})},onError:e=>g.error(e.message)}),i=p({mutationFn:e=>(te(e),a.runTrigger(e)),onSuccess:(t,n)=>{if(e.invalidateQueries({queryKey:[`triggers`]}),t.pending){g.success(`${n} · started`,{description:`polling for results`});return}if(z(n),e.invalidateQueries({queryKey:[`queue`]}),e.invalidateQueries({queryKey:[`home`]}),t.error){g.error(`${n} · ${t.error}`);return}let r=t.result;if(!r){g.success(`${n} · ran`);return}let i=[`${r.candidates} candidates`,`${r.enqueued} kept`,r.droppedIcp?`${r.droppedIcp} icp-drop`:null,r.droppedDuplicate?`${r.droppedDuplicate} dup`:null,r.droppedEnrichment?`${r.droppedEnrichment} enrich-fail`:null,`$${r.costUsd.toFixed(2)}`,r.halted?`halted: ${r.halted}`:null].filter(Boolean);g.success(`${n} · ${i.join(` · `)}`)},onError:(t,n)=>{if(t.message.includes(`already running`)){e.invalidateQueries({queryKey:[`triggers`]}),g.info(`${n} · already running`);return}z(n),g.error(`${n} · ${t.message}`)}}),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(null),u=t.data?.triggers??[],d=u.filter(e=>e.running).map(e=>e.name).toSorted().join(`,`),f=(0,N.useRef)(``);(0,N.useEffect)(()=>{let t=f.current;f.current=d;let n=t?t.split(`,`):[],r=d?d.split(`,`):[],i=new Set(r);n.some(e=>!i.has(e))&&(e.invalidateQueries({queryKey:[`queue`]}),e.invalidateQueries({queryKey:[`home`]}))},[d,e]);let m=new Map(u.map(e=>[e.name,e.lastPolledAt])),v=new Map(u.map(e=>[e.name,e.runningSince])),y=H(u.map(e=>e.name),m,v);return(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(`section`,{className:`border-b border-ink-rule`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between px-6 pb-2 pt-5`,children:[(0,W.jsxs)(`div`,{className:`ln-eyebrow`,children:[`Triggers `,(0,W.jsxs)(`span`,{className:`text-ink-faint`,children:[`· `,u.length]})]}),(0,W.jsx)(`div`,{className:`font-mono text-[11px] text-ink-faint`,children:`refresh · 30s`})]}),t.isLoading?Array.from({length:3},(e,t)=>(0,W.jsx)(ee,{},t)):u.length===0?(0,W.jsx)(`div`,{className:`px-6 pb-6`,children:(0,W.jsx)(x,{note:`No triggers stored yet. Enable one below and it bootstraps itself on the next watch tick — or run the watch loop once to initialise.`,cli:`oneshot-gtm find watch --once`})}):(0,W.jsxs)(`table`,{className:`w-full text-[13px]`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{className:`border-b border-ink-rule/60 text-[10px] uppercase tracking-[0.14em] text-ink-faint`,children:[(0,W.jsx)(`th`,{className:`px-6 py-2 text-left font-medium`,children:`name`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`enabled`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`interval`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`last polled`}),(0,W.jsx)(`th`,{className:`py-2 text-left font-medium`,children:`last run`}),(0,W.jsx)(`th`,{className:`px-6 py-2 text-right font-medium`,children:`actions`})]})}),(0,W.jsx)(`tbody`,{children:u.map((e,t)=>{let a=O(e.lastRunSummary),u=i.isPending&&i.variables===e.name,d=y.get(e.name),f=u||d!=null,p=d?.elapsedMs??null,m=o?.name===e.name;return(0,W.jsx)(J,{trigger:e,zebra:t%2==1,running:f,elapsedMs:p,summary:a,isEditing:!!m,editing:m?o:null,editError:m?c:null,onToggleEnabled:t=>n.mutate({name:e.name,enabled:t}),onRun:()=>i.mutate(e.name),onStartEdit:()=>{s({name:e.name,text:JSON.stringify(e.config??{},null,2),defaultConfig:e.defaultConfig}),l(null)},onCancelEdit:()=>{s(null),l(null)},onChangeEditText:e=>s(t=>t&&{...t,text:e}),onResetDefaults:()=>s(e=>e&&{...e,text:JSON.stringify(e.defaultConfig??{},null,2)}),onSaveEdit:()=>{if(!o)return;let e;try{e=JSON.parse(o.text)}catch(e){l(`invalid JSON: ${e.message}`);return}if(!e||typeof e!=`object`){l(`config must be a JSON object`);return}l(null),r.mutate({name:o.name,config:e})},setEnabledPending:n.isPending,setConfigPending:r.isPending},e.name)})})]})]})})}function J(e){let t=e.trigger,r=t.ready===!1,a=t.notReadyReason??`missing required config`,o=e.setEnabledPending||r&&!t.enabled,c=e.running||r;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`tr`,{className:i(`group relative border-b border-ink-rule/60`,`transition-colors duration-[var(--dur-stamp)]`,e.zebra&&`bg-ink-surface/20`,!t.enabled&&`opacity-65`,`hover:bg-ink-surface/50`,e.isEditing&&`bg-ink-surface/50`,e.running&&`bg-[color:var(--ink-signal)]/[0.08]`),children:[(0,W.jsxs)(`td`,{className:`relative px-6 py-2 font-mono text-[12px]`,children:[e.running?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-[2px] bg-[color:var(--ink-signal)] animate-pulse`}):t.enabled&&(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 left-0 w-[2px] bg-[color:var(--ink-signal)]/60`}),(0,W.jsx)(`span`,{className:t.enabled?`text-ink-cream`:`text-ink-muted`,children:t.name})]}),(0,W.jsx)(`td`,{className:`py-2`,title:r&&!t.enabled?`not ready · ${a}`:void 0,children:(0,W.jsx)(w,{checked:t.enabled,disabled:o,label:`${t.enabled?`disable`:`enable`} ${t.name}`,onChange:e.onToggleEnabled})}),(0,W.jsxs)(`td`,{className:`py-2 font-mono text-[12px] text-ink-muted`,children:[D(t.intervalMs),t.intervalMs!==t.defaultIntervalMs&&(0,W.jsxs)(`span`,{className:`ml-1 text-ink-faint`,children:[`· default `,D(t.defaultIntervalMs)]})]}),(0,W.jsx)(`td`,{className:`py-2 font-mono text-[12px] text-ink-muted`,children:t.lastPolledAt?n(t.lastPolledAt):`never`}),(0,W.jsx)(`td`,{className:i(`py-2 font-mono text-[11.5px]`,r?`text-[color:var(--ink-blocked-2)]`:`text-ink-muted`),children:r?`not ready · ${a}`:e.summary}),(0,W.jsx)(`td`,{className:`px-6 py-2 text-right`,children:(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,W.jsxs)(s,{variant:e.running?`accent`:`ghost`,size:`sm`,"aria-disabled":c||void 0,onClick:c?void 0:e.onRun,className:i(c&&`cursor-not-allowed pointer-events-none`),title:e.running?`Running for ${e.elapsedMs==null?`a moment`:U(e.elapsedMs)} — click won't re-fire`:r?`not ready · ${a}`:`Run this finder now — ignores schedule, spends OneShot $`,children:[e.running?(0,W.jsx)(u,{size:12,className:`animate-spin`,"aria-hidden":`true`}):(0,W.jsx)(d,{size:12,"aria-hidden":`true`}),e.running?e.elapsedMs==null?`running…`:`running · ${U(e.elapsedMs)}`:`run now`]}),(0,W.jsx)(s,{variant:e.isEditing?`secondary`:`ghost`,size:`sm`,title:e.isEditing?`close config`:`edit config`,"aria-label":`${e.isEditing?`close`:`edit`} ${t.name} config`,onClick:e.isEditing?e.onCancelEdit:e.onStartEdit,children:(0,W.jsx)(k,{size:12})})]})})]}),e.isEditing&&e.editing&&(0,W.jsx)(`tr`,{className:`border-b border-ink-rule/60 bg-ink-bg-deep/60`,children:(0,W.jsx)(`td`,{colSpan:6,className:`px-6 py-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`ln-eyebrow`,children:[`config ·`,` `,(0,W.jsx)(`span`,{className:`text-ink-cream-2 normal-case font-mono tracking-normal`,children:t.name})]}),(0,W.jsxs)(`div`,{className:`ln-note text-[12px] text-ink-cream-2`,children:[`add`,` `,(0,W.jsx)(`code`,{className:`ln-mono text-[11.5px] text-[color:var(--ink-signal-2)]`,children:`"intervalMs"`}),` `,`to override the watch cadence · min 60000`]})]}),(0,W.jsx)(S,{rows:8,value:e.editing.text,onChange:t=>e.onChangeEditText(t.target.value),className:`font-mono text-[12px]`,spellCheck:!1}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`div`,{className:`font-mono text-[11.5px] text-[color:var(--ink-blocked-2)]`,children:e.editError??``}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.editing.defaultConfig&&(0,W.jsx)(s,{variant:`ghost`,size:`sm`,onClick:e.onResetDefaults,disabled:e.setConfigPending,title:`Replace the textarea with the registry default config`,children:`reset`}),(0,W.jsx)(s,{variant:`ghost`,size:`sm`,onClick:e.onCancelEdit,disabled:e.setConfigPending,children:`cancel`}),(0,W.jsx)(s,{variant:`primary`,size:`sm`,onClick:e.onSaveEdit,disabled:e.setConfigPending,children:e.setConfigPending?`saving…`:`save`})]})]})]})})})]})}function se(){let e=_({queryKey:[`setup`],queryFn:()=>a.setupStatus()}),t=e.data?.cfg.icpOneLiner??null;return e.isLoading?null:!t||t.trim().length===0?(0,W.jsxs)(`section`,{className:`flex items-start gap-3 border-b border-ink-rule bg-[color:var(--ink-spend)]/6 px-6 py-4`,children:[(0,W.jsx)(M,{size:14,className:`mt-[3px] shrink-0 text-[color:var(--ink-spend-2)]`}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,style:{color:`var(--ink-spend-2)`},children:`Set your ICP first`}),(0,W.jsx)(`div`,{className:`ln-note mt-0.5 text-[13px] text-ink-cream-2`,children:`The find layer needs a free-text ICP one-liner to filter candidates. Without it, every result passes through and you'll review more noise than signal.`})]}),(0,W.jsx)(y,{to:`/setup`,children:(0,W.jsx)(s,{size:`sm`,children:`Open setup`})})]}):(0,W.jsxs)(`section`,{className:`flex items-start gap-3 border-b border-ink-rule px-6 py-3`,children:[(0,W.jsx)(M,{size:14,className:`mt-[3px] shrink-0 text-[color:var(--ink-receipt-2)]`}),(0,W.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,W.jsx)(`div`,{className:`ln-eyebrow`,children:`ICP`}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-[13px] text-ink-cream-2`,children:t})]}),(0,W.jsx)(y,{to:`/setup`,children:(0,W.jsx)(s,{variant:`ghost`,size:`sm`,children:`edit`})})]})}function ce({filterActive:e}){return e?(0,W.jsx)(`div`,{className:`p-5`,children:(0,W.jsx)(x,{note:`No queue rows match this filter. Try a different status or play above to see other rows.`})}):(0,W.jsx)(`div`,{className:`p-5`,children:(0,W.jsx)(x,{note:`No targets yet. Pick a finder from the Triggers panel and run it — candidates land here for review before any send.`,cli:`oneshot-gtm find watch`})})}function Y(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.email==`string`?t.email:typeof t.founderEmail==`string`?t.founderEmail:null}function X(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.name==`string`)return t.name;if(typeof t.founderName==`string`)return t.founderName;let n=typeof t.repoUrl==`string`?t.repoUrl:null;if(n){let e=n.match(/github\.com\/([^/]+)\/([^/?#]+)/);if(e)return`${e[1]}/${e[2]}`}let r=typeof t.postUrl==`string`?t.postUrl:null;if(r)try{let e=new URL(r).hostname.replace(/^www\./,``);if(e)return e}catch{}return null}function Z(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.company==`string`?t.company:null}function le(e){if(!e||typeof e!=`object`)return null;let t=e.linkedinUrl;return typeof t!=`string`||t.length===0?null:/^https?:\/\/(?:[a-z0-9-]+\.)*linkedin\.com\/in\//i.test(t)?t:null}function Q(e){if(!e||typeof e!=`object`)return null;let t=e.phone;return typeof t==`string`&&t.length>0?t:null}export{K as component};
2
+ //# sourceMappingURL=queue-ClVxfeJ0.js.map