PageSourceSearch

https://colara.co/assets/PartnerDashboard-EFcEC0dF.js

js colara.co collected 2026-09-24 14:37:19 UTC 31,642 bytes, 4 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-s6G00g-_.js","assets/index-CCfJC9m9.js","assets/vendor-C_lr6Peh.js","assets/index-EQ5jy9v_.css","assets/PartnerClicksChart-CYmOQuFw.js","assets/chart-column-Bn0EAZCg.js","assets/charts-Oh22Zf-T.js","assets/memoize-BFYXIJ-M.js","assets/index-5-VMID8x.js","assets/reactflow-CfPU3W8g.js","assets/FlowEditor-EhHPmxuu.js","assets/workflow-7IwvQk-T.js","assets/play-B0w_0Qg8.js","assets/git-branch-CAyWKYNr.js","assets/clock-3-DAJRhQ-f.js","assets/square-check-big-DH4vwcyp.js","assets/input-BhU9ByXS.js","assets/select-BK7nL9Mt.js","assets/index-D7pJbSr8.js","assets/index-DnHsgeAP.js","assets/check-wh8Oepvp.js","assets/chevron-up-BKNTUudS.js","assets/textarea-DPKXeB9F.js","assets/ShortCodePreviewDialog-rSILyKcF.js","assets/EmailPreviewMergeBanner-ByloVHqK.js","assets/circle-check-vKn0VvWh.js","assets/search-DJ1DqJUl.js","assets/html-text-nuc7F1He.js","assets/email-plain-text-hAD0xMT2.js","assets/AiWritingAssist-COWhiWSj.js","assets/wand-sparkles-Bwbf1Sma.js","assets/ShortCodeReference-CABpQykt.js","assets/popover-DsNWZLCi.js","assets/crm-shortcodes-D-w6xNV3.js","assets/client-name-zfge3VH_.js","assets/currency-Bpf8_ITC.js","assets/date-utils-_xtJs2tX.js","assets/braces-B4a2Ghgm.js","assets/bookmark-plus-CofZw01L.js","assets/chevron-right-C6nWXIh2.js","assets/clock-NeT8qJCP.js","assets/calendar-DTAYBCHu.js","assets/calendar-clock-DmW_XzR4.js","assets/bell-CoAbrTlJ.js","assets/send-Dla22FU7.js","assets/clipboard-list-D4d8SG2B.js","assets/arrow-right-left-C9WcJyhH.js","assets/tag-DMwA46Sl.js","assets/receipt-tMfuPpa_.js","assets/calendar-plus-Ben4uHnr.js","assets/image-C538Flpk.js","assets/archive-B9Z6CxMm.js","assets/plus-Cx32ukVL.js","assets/ClientWorkflowsView-BKtDQYRj.js","assets/invoice-reminder-workflow-Y9NzG0E0.js","assets/use-unsaved-changes-warning-CDDPJ7Xw.js","assets/label-Dpeci-J4.js","assets/switch-Dsti7IIC.js","assets/receipt-text-lsayHJbV.js","assets/disclosure-summary-DiAEyCbo.js","assets/calendar-check-DfQs7Sww.js","assets/party-popper-DESjsxcT.js","assets/dropdown-menu-CrqGqHT1.js","assets/index-6nj-CStY.js","assets/circle-DD1ufIjP.js","assets/grip-vertical-DY8HdbcO.js","assets/arrow-up-Dkus4uTS.js","assets/arrow-down-Bhw02iNr.js","assets/use-autosave-DBbQ56kv.js","assets/PageHelper-BeU7BH7D.js","assets/use-dismissed-hints-C5DtZfZV.js","assets/framer-motion-BelE6YLj.js","assets/circle-question-mark-CP_yXdEO.js","assets/empty-state-4a14WMSj.js","assets/zap-CP_9R3DG.js","assets/gift-D-fgjl6H.js","assets/pencil-B1CfnCkx.js","assets/lightbulb-CfrL7HRw.js","assets/trash-2-q_yUbozN.js","assets/timer-D7UYKmYf.js","assets/pin-DOdSrsqs.js","assets/layout-grid-DxSSbb99.js","assets/copy-BBUkuAem.js","assets/settings-2-Ck3QicmE.js","assets/undo-2-BISTJWF5.js","assets/redo-2-vLt8zs53.js","assets/unlink-C2omrWM5.js","assets/reactflow-Fd0xVSp_.css","assets/monitor-mNYTIRsV.js","assets/globe-DgnBOuPk.js","assets/smartphone-UY-i2Qpo.js"])))=>i.map(i=>d[i]);
2import{aj as Z,K as D,_ as V,C as u,v as x,P as w,U as ee,B as R,ac as te,M as se,D as ae,q as z,Q as _,L as N,F as re,R as $,V as A,I as F,h as T,al as ne,aE as ie,G as U}from"./index-CCfJC9m9.js";import{r as f,j as e}from"./vendor-C_lr6Peh.js";import{a as q}from"./date-utils-_xtJs2tX.js";import oe from"./purify.es-mDO9dmX5.js";import{B as H}from"./badge-CGFh8DGq.js";import{P as le}from"./PageHelper-BeU7BH7D.js";import{T as ce}from"./textarea-DPKXeB9F.js";import{I as G}from"./input-BhU9ByXS.js";import{d as de,e as me,S as ue}from"./index-CWhaPmf2.js";import{F as xe}from"./index-DY_1Cdsd.js";import{S as Q}from"./share-2-XFGRTOtq.js";import{M as pe}from"./mouse-pointer-click-Dx-aGhjZ.js";import{A as he}from"./arrow-up-right-BQFMtO_j.js";import{T as fe}from"./trending-up-B2xHeljy.js";import{C as ge}from"./check-wh8Oepvp.js";import{C as K}from"./copy-BBUkuAem.js";import{Q as be}from"./qr-code-CxiwyK2B.js";import{L as je}from"./label-Dpeci-J4.js";import{S as ye}from"./SignatureInput-BUoInO6D.js";import{a as Ne}from"./contract-prose-ByaO3mSN.js";import{S as ve}from"./scroll-text-B3NJtSWb.js";import{P as B}from"./pen-line-CRWb5ajB.js";import{D as W}from"./dollar-sign-CcvKpShs.js";import{C as X}from"./circle-check-vKn0VvWh.js";import{S as ke}from"./star-Bxv7pWmt.js";import"./use-dismissed-hints-C5DtZfZV.js";import"./framer-motion-BelE6YLj.js";import"./circle-question-mark-CP_yXdEO.js";import"./signature-BWogVemi.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"0ccb255495e39d589ace3c3ce0094401fe4fff85"};var o=new r.Error().stack;o&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[o]="449dfb2c-2f5a-41cb-bd20-8094d06b55a9",r._sentryDebugIdIdentifier="sentry-dbid-449dfb2c-2f5a-41cb-bd20-8094d06b55a9")}catch{}})();const we=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Ce=Z("trophy",we);function Se(){if(typeof navigator>"u")return null;const r=navigator.share;return typeof r=="function"?r.bind(navigator):null}const Y="I've been using Colara to manage my photography business — clients, bookings, contracts, the lot. Genuinely worth a look.";
2function y(r,o){const m=r.includes("?")?"&":"?";return`${r}${m}src=${encodeURIComponent(o)}`}function S(r,o){const m=r.trim();return m?`${m}
3
4${o}`:o}function Pe(r){return"$"+(r/100).toFixed(2)}function Re({referralCode:r,partnerName:o,baseUrl:m,stats:i}){const{toast:c}=D(),l=`${m||(typeof window<"u"?`${window.location.protocol}//${window.location.host}`:"https://colara.co")}/?ref=${r}`,[d,g]=f.useState(Y),[t,b]=f.useState(null),[k,E]=f.useState(!1),v=f.useMemo(()=>Se(),[]),h=!!v;f.useEffect(()=>{let a=!1;return V(()=>import("./browser-s6G00g-_.js").then(p=>p.b),__vite__mapDeps([0,1,2,3])).then(p=>{p.toDataURL(y(l,"qr"),{width:320,margin:2,color:{dark:"#1a1a1a",light:"#ffffff"}}).then(J=>{a||b(J)}).catch(()=>{})}),()=>{a=!0}},[l]);const I=f.useMemo(()=>`${o?`${o.split(" ")[0]} sent you`:"An invite to"} a tool you'll like — Colara`,[o]),O=async()=>{try{await navigator.clipboard.writeText(y(l,"copy")),E(!0),c({title:"Referral link copied"}),setTimeout(()=>E(!1),2e3)}catch{c({title:"Couldn't copy",variant:"destructive"})}},M=async()=>{try{await navigator.clipboard.writeText(S(d,y(l,"copy"))),c({title:"Message copied"})}catch{c({title:"Couldn't copy",variant:"destructive"})}},j=async()=>{if(v)try{const a=y(l,"native");await v({title:"Colara",text:d.trim()||void 0,url:a})}catch{}},C=()=>{if(!t)return;const a=document.createElement("a");a.href=t,a.download=`colara-referral-${r}.png`,document.body.appendChild(a),a.click(),document.body.removeChild(a)},n=a=>{window.open(a,"_blank","noopener,noreferrer")},L=[{key:"email",label:"Email",icon:te,onClick:()=>{const a=y(l,"email"),p=S(d,a);window.location.href=`mailto:?subject=${encodeURIComponent(I)}&body=${encodeURIComponent(p)}`}},{key:"sms",label:"SMS",icon:se,onClick:()=>{const a=y(l,"sms"),p=S(d,a);window.location.href=`sms:?&body=${encodeURIComponent(p)}`}},{key:"whatsapp",label:"WhatsApp",icon:de,onClick:()=>{const a=y(l,"whatsapp"),p=S(d,a);n(`https://wa.me/?text=${encodeURIComponent(p)}`)}},{key:"x",label:"X",icon:me,onClick:()=>{const a=y(l,"x"),p=S(d,a);n(`https://twitter.com/intent/tweet?text=${encodeURIComponent(p)}`)}},{key:"facebook",label:"Facebook",icon:ue,onClick:()=>{const a=y(l,"facebook");n(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(a)}&quote=${encodeURIComponent(d.trim())}`)}},{key:"linkedin",label:"LinkedIn",icon:xe,onClick:()=>{const a=y(l,"linkedin");n(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(a)}`)}}];return e.jsx(u,{className:"border-[#A8836F]/30 bg-[#A8836F]/5","data-testid":"card-share-panel",children:e.jsxs(x,{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4 text-[#A8836F]"})," Refer & earn"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Share your link, post the QR, or send the prefilled message — every signup is tracked."})]}),h&&e.jsxs(w,{size:"compact",className:"gap-1.5",onClick:j,"data-testid":"button-native-share",children:[e.jsx(Q,{className:"w-3.5 h-3.5"})," Share…"]})]}),i&&e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[e.jsxs("div",{className:"rounded-md bg-background border p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5",children:[e.jsx(pe,{className:"w-3 h-3"})," Clicks"]}),e.jsx("div",{className:"text-lg font-light tabular-nums","data-testid":"stat-share-clicks",children:i.clicks})]}),e.jsxs("div",{className:"rounded-md bg-background border p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5",children:[e.jsx(ee,{className:"w-3 h-3"})," Signups"]}),e.jsx("div",{className:"text-lg font-light tabular-nums","data-testid":"stat-share-signups",children:i.signups})]}),e.jsxs("div",{className:"rounded-md bg-background border p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5",children:[e.jsx(he,{className:"w-3 h-3"})," Paid"]}),e.jsx("div",{className:"text-lg font-light tabular-nums","data-testid":"stat-share-conversions",children:i.paidConversions})]}),e.jsxs("div",{className:"rounded-md bg-background border p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground mb-0.5",children:[e.jsx(fe,{className:"w-3 h-3"})," Earned"]}),e.jsx("div",{className:"text-lg font-light tabular-nums","data-testid":"stat-share-earnings",children:Pe(i.earningsCents)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Your referral link"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{readOnly:!0,value:l,className:"font-mono text-xs bg-background","data-testid":"input-referral-link",onFocus:a=>a.currentTarget.select()}),e.jsxs(R,{size:"sm",variant:"outline",className:"gap-1.5 h-9 shrink-0",onClick:O,"data-testid":"button-copy-link",children:[k?e.jsx(ge,{className:"w-3.5 h-3.5 text-green-600"}):e.jsx(K,{className:"w-3.5 h-3.5"}),k?"Copied":"Copy"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Personal message (the link is added automatically)"}),e.jsx("button",{type:"button",className:"text-[11px] text-muted-foreground hover:text-foreground underline",onClick:()=>g(Y),"data-testid":"button-reset-message",children:"Reset to default"})]}),e.jsx(ce,{value:d,onChange:a=>g(a.target.value),rows:3,className:"bg-background text-sm resize-none","data-testid":"textarea-share-message"}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{type:"button",className:"text-[11px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1",onClick:M,"data-testid":"button-copy-message",children:[e.jsx(K,{className:"w-3 h-3"})," Copy message + link"]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:"Send via"}),e.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2",children:L.map(a=>{const p=a.icon;return e.jsxs(R,{variant:"outline",size:"sm",className:"h-auto flex-col gap-1 py-3 bg-background",onClick:a.onClick,"data-testid":`button-share-${a.key}`,children:[e.jsx(p,{className:"w-4 h-4"}),e.jsx("span",{className:"text-[11px]",children:a.label})]},a.key)})})]}),e.jsxs("div",{className:"border-t border-border/50 pt-4 flex items-center gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[t?e.jsx("img",{src:t,alt:"Referral QR code",className:"w-20 h-20 rounded border bg-white","data-testid":"img-referral-qr"}):e.jsx("div",{className:"w-20 h-20 rounded border bg-background flex items-center justify-center",children:e.jsx(be,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("div",{className:"text-xs text-muted-foreground max-w-[220px]",children:"Print it on a card, drop it in a slide deck, or pop it on your studio window."})]}),e.jsxs(R,{size:"sm",variant:"outline",className:"gap-1.5 h-8 ml-auto",onClick:C,disabled:!t,"data-testid":"button-download-qr",children:[e.jsx(ae,{className:"w-3.5 h-3.5"})," Download QR"]})]})]})})}const $e=f.lazy(()=>V(()=>import("./PartnerClicksChart-CYmOQuFw.js"),__vite__mapDeps([4,2,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90])));function Ae(){return e.jsx(u,{children:e.jsx(x,{className:"p-4 h-56 flex items-center justify-center",children:e.jsx(N,{className:"w-4 h-4 animate-spin text-muted-foreground"})})})}function P(r){return"$"+(r/100).toFixed(2)}function Ee({milestoneDefs:r,milestonesAchieved:o,totalEarnedCents:m,convertedReferrals:i}){const c=new Set(o),s=r.filter(t=>c.has(t.key)),l=r.filter(t=>!c.has(t.key));function d(t){return t.kind==="earnings"?{current:m,target:t.cents,label:`$${(m/100).toFixed(0)} of $${(t.cents/100).toFixed(0)} in lifetime earnings`}:t.kind==="referrals"?{current:i,target:t.count,label:`${i} of ${t.count} paid referrals`}:t.kind==="first_conversion"?{current:i>0?1:0,target:1,label:i>0?"1 of 1 paid referral":"0 of 1 paid referral"}:null}function g(t){return t.kind==="earnings"?`Reached $${(t.cents/100).toLocaleStr
4ing()} in lifetime earnings`:t.kind==="referrals"?`Reached ${t.count} paid referrals`:"First paid referral recorded"}return s.length===0&&l.length===0?null:e.jsxs(u,{children:[e.jsx($,{className:"pb-3",children:e.jsxs(A,{className:"text-base font-normal flex items-center gap-2",children:[e.jsx(Ce,{className:"w-4 h-4 text-amber-500"}),"Milestones"]})}),e.jsxs(x,{className:"p-4 pt-0 space-y-4",children:[s.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:"Achieved"}),e.jsx("div",{className:"space-y-2",children:s.map(t=>e.jsxs("div",{className:"flex items-start gap-3 py-2 border-b border-border/40 last:border-0","data-testid":`milestone-achieved-${t.key}`,children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(X,{className:"w-3.5 h-3.5 text-green-600"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium","data-testid":`text-milestone-label-${t.key}`,children:t.label}),e.jsx("p",{className:"text-xs text-green-600 dark:text-green-500","data-testid":`text-milestone-value-${t.key}`,children:g(t)})]})]},t.key))})]}),l.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:"Upcoming"}),e.jsx("div",{className:"space-y-3",children:l.map(t=>{const b=d(t),k=b?Math.min(100,Math.round(b.current/b.target*100)):0;return e.jsxs("div",{className:"py-2 border-b border-border/40 last:border-0","data-testid":`milestone-upcoming-${t.key}`,children:[e.jsxs("div",{className:"flex items-start gap-3 mb-2",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-muted flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(ke,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm","data-testid":`text-milestone-upcoming-label-${t.key}`,children:t.label}),b&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5","data-testid":`text-milestone-progress-${t.key}`,children:b.label})]})]}),b&&e.jsx("div",{className:"ml-9",children:e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-amber-400 dark:bg-amber-500 transition-all",style:{width:`${k}%`},"data-testid":`progress-milestone-${t.key}`})})})]},t.key)})})]})]})]})}function Ie(){const{toast:r}=D(),{data:o,isLoading:m}=z({queryKey:["/api/partner/connect/status"],retry:!1}),i=_({mutationFn:async()=>(await T("POST","/api/partner/connect/onboard")).json(),onSuccess:s=>{s.alreadyConnected?(r({title:"Account already connected"}),F.invalidateQueries({queryKey:["/api/partner/connect/status"]})):s.url&&(window.location.href=s.url)},onError:s=>{r({title:"Couldn’t complete that",description:s.message||"Failed to start setup",variant:"destructive"})}}),c=_({mutationFn:async()=>(await T("POST","/api/partner/connect/dashboard")).json(),onSuccess:s=>{s.url&&window.open(s.url,"_blank")},onError:s=>{r({title:"Couldn’t complete that",description:s.message||"Failed to open dashboard",variant:"destructive"})}});return m?e.jsx(u,{children:e.jsx(x,{className:"p-4 flex items-center justify-center",children:e.jsx(N,{className:"w-4 h-4 animate-spin text-muted-foreground"})})}):o?.connectAvailable?o.status==="connected"?e.jsx(u,{className:"border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-950/20",children:e.jsx(x,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:e.jsx(X,{className:"w-4 h-4 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Bank account connected"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Payouts will be sent automatically to your connected account",o.email&&e.jsxs(e.Fragment,{children:[" (",o.email,")"]})]})]})]}),e.jsxs(R,{size:"sm",variant:"outline",className:"gap-1.5 h-8",onClick:()=>c.mutate(),disabled:c.isPending,"data-testid":"button-stripe-dashboard",children:[c.isPending?e.jsx(N,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(ne,{className:"w-3.5 h-3.5"}),"Stripe Dashboard"]})]})})}):o.status==="pending"?e.jsx(u,{className:"border-amber-200 bg-amber-50/50 dark:border-amber-800 dark:bg-amber-950/20",children:e.jsx(x,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-100 dar
4k:bg-amber-900/30 flex items-center justify-center",children:e.jsx(ie,{className:"w-4 h-4 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Setup incomplete"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Finish connecting your bank account to receive automatic payouts"})]})]}),e.jsxs(w,{size:"compact",className:"gap-1.5",onClick:()=>i.mutate(),disabled:i.isPending,"data-testid":"button-finish-connect",children:[i.isPending?e.jsx(N,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(U,{className:"w-3.5 h-3.5"}),"Finish Setup"]})]})})}):e.jsx(u,{className:"border-border/50",children:e.jsx(x,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(U,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Connect your bank account"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Set up automatic payouts through Stripe. Quick setup, Stripe handles everything."})]})]}),e.jsxs(w,{size:"compact",className:"gap-1.5",onClick:()=>i.mutate(),disabled:i.isPending,"data-testid":"button-connect-bank",children:[i.isPending?e.jsx(N,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(U,{className:"w-3.5 h-3.5"}),"Connect Bank Account"]})]})})}):null}function dt(){const{toast:r}=D(),[o,m]=f.useState(!1),[i,c]=f.useState(""),[s,l]=f.useState(null),{data:d,isLoading:g}=z({queryKey:["/api/partner/contract"]}),t=d?.contractHtml&&!d?.contractSignedAt,{data:b,isLoading:k,error:E}=z({queryKey:["/api/partner/dashboard"],enabled:!t,retry:(n,L)=>L?.message?.includes("Contract not signed")?!1:n<3}),v=_({mutationFn:async()=>{await T("POST","/api/partner/contract/sign",{typedName:i,signatureData:s})},onSuccess:()=>{F.invalidateQueries({queryKey:["/api/partner/contract"]}),F.invalidateQueries({queryKey:["/api/partner/dashboard"]}),r({title:"Agreement signed! Welcome to the team."})},onError:n=>r({title:"Couldn’t complete that",description:n.message,variant:"destructive"})});if(g||k&&!t)return e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(N,{className:"w-6 h-6 animate-spin text-muted-foreground"})});if(t)return e.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8 space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-light mb-1",children:"Partner Dashboard"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Welcome! Before you get started, please review and sign your partner agreement."})]}),e.jsx(u,{className:"border-amber-200 bg-amber-50/30 dark:border-amber-800 dark:bg-amber-950/20",children:e.jsx(x,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center shrink-0",children:e.jsx(ve,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium mb-1",children:"Partner Agreement Required"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Please review and sign your partner agreement to access your referral link, dashboard, and start earning."}),e.jsxs(w,{size:"default",onClick:()=>m(!0),"data-testid":"button-review-agreement",children:[e.jsx(re,{className:"w-4 h-4"})," Review Agreement"]})]})]})})}),o&&d?.contractHtml&&e.jsx(u,{children:e.jsxs(x,{className:"p-6",children:[e.jsx("div",{className:`${Ne} dark:prose-invert mb-8`,dangerouslySetInnerHTML:{__html:oe.sanitize(d.contractHtml)}}),e.jsxs("div",{className:"border-t pt-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx(je,{htmlFor:"partner-dash-name",className:"text-sm font-medium",children:"Sign this agreement"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 mb-3",children:"Enter your full legal name, then draw or type your signature."}),e.jsx(G,{id:"partner-dash-name",value:i,onChange:n=>c(n.target.value),placeholder:"Your full legal name","data-testid":"input-partner-dash-name"}),e.jsx("div",{className:"mt-4 max-w-md",children:e.jsx(ye,{kind:"signature",typedDefault:i.trim(),onChange:l,disabled:v.isPending,testIdBase:"partner-dash"})})]}),e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(B,{className:"w-4 h-4"}),e.jsx("span",{children:'By clicking "Sign Agreement" you agree to the terms above.'})]}),e.jsxs(w,{size:"default",onClick:()=>v.mutate(),disabled:!i.trim()||!s||v.isPending,"data-testid":"button-sign-agreement",children:[v.isPending?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(B,{className:"w-4 h-4"}),"Sign Agreement"]})]})]})]})})]});if(E||!b)return e.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-20 text-center",children:[e.jsx("h2",{className:"text-xl font-light mb-2",children:"Partner Dashboard"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active partner account. If you've applied, your application is being reviewed."})]});const{partner:h,referrals:I,commissions:O,payouts:M,stats:j,milestoneDefs:C}=b;return e.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8 space-y-8",children:[e.jsx(le,{title:"What is this?",description:"Your Partner Dashboard shows the health of your referral partnerships — who's sending you leads, which partners are most active, and your overall referral stats. Track the ROI of your professional network.",storageKey:"partner-dashboard",steps:["Review your partnership stats — referrals sent, received, and converted.","Check which partners are most active and strengthen those relationships.","Reach out to inactive partners to re-engage and exchange fresh leads."]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-light mb-1",children:"Partner Dashboard"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Welcome back, ",h.name,". Here's your referral performance."]})]}),e.jsx(Ie,{}),C&&C.length>0&&e.jsx(Ee,{milestoneDefs:C,milestonesAchieved:Array.isArray(h.milestonesAchieved)?h.milestonesAchieved:[],totalEarnedCents:j.totalEarnedCents,convertedReferrals:j.convertedReferrals??j.activeReferrals}),e.jsx(f.Suspense,{fallback:e.jsx(Ae,{}),children:e.jsx($e,{endpoint:"/api/partner/dashboard/clicks",csvEndpoint:"/api/partner/dashboard/clicks.
4csv",title:"Referral clicks over time",defaultDays:30,testIdPrefix:"partner-clicks"})}),e.jsx(Re,{referralCode:h.referralCode,partnerName:h.name,stats:{clicks:j.totalClicks??0,signups:j.totalReferrals,paidConversions:j.activeReferrals,earningsCents:j.totalEarnedCents}}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(u,{children:e.jsxs(x,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs mb-1",children:[e.jsx(W,{className:"w-3.5 h-3.5"})," Pending Payout"]}),e.jsx("p",{className:"text-2xl font-light text-amber-600","data-testid":"text-pending-payout",children:P(j.pendingPayoutCents)})]})}),e.jsx(u,{children:e.jsxs(x,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs mb-1",children:[e.jsx(W,{className:"w-3.5 h-3.5"})," Paid Out"]}),e.jsx("p",{className:"text-2xl font-light","data-testid":"text-total-paid",children:P(j.totalPaidCents)})]})})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs(u,{children:[e.jsx($,{className:"pb-3",children:e.jsx(A,{className:"text-base font-normal",children:"Recent Referrals"})}),e.jsx(x,{className:"p-4 pt-0",children:I.length===0?e.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"Share your referral link to start earning — every signup you refer shows up here with commission tracking."}):e.jsx("div",{className:"space-y-2",children:I.slice(0,10).map(n=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-border/50 last:border-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm",children:n.referredEmail||"Anonymous"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:q(n.createdAt)})]}),e.jsx(H,{variant:n.status==="converted"?"default":"secondary",className:"text-[10px]",children:n.status})]},n.id))})})]}),e.jsxs(u,{children:[e.jsx($,{className:"pb-3",children:e.jsx(A,{className:"text-base font-normal",children:"Commission History"})}),e.jsx(x,{className:"p-4 pt-0",children:O.length===0?e.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"Commissions will appear here when your referrals make payments."}):e.jsx("div",{className:"space-y-2",children:O.slice(0,10).map(n=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-border/50 last:border-0",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm",children:[P(n.commissionCents)," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",n.commissionRate,"% of ",P(n.amountCents),")"]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:q(n.createdAt)})]}),e.jsx(H,{variant:n.status==="paid"?"default":"secondary",className:"text-[10px]",children:n.status})]},n.id))})})]})]}),M.length>0&&e.jsxs(u,{children:[e.jsx($,{className:"pb-3",children:e.jsx(A,{className:"text-base font-normal",children:"Payout History"})}),e.jsx(x,{className:"p-4 pt-0",children:e.jsx("div",{className:"space-y-2",children:M.map(n=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-border/50 last:border-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:P(n.amountCents)}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[n.method==="str
4ipe_connect"?"Stripe Transfer":n.method,n.notes?` — ${n.notes}`:""]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:q(n.createdAt)})]},n.id))})})]}),e.jsx(Me,{weeklyRecapOptOut:!!h.weeklyRecapOptOut,monthlySnapshotOptOut:!!h.monthlySnapshotOptOut,payoutNotificationsOptOut:!!h.payoutNotificationsOptOut,milestoneNotificationsOptOut:!!h.milestoneNotificationsOptOut}),e.jsx("div",{className:"text-center py-4",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.commissionRate,"% recurring commission on all referred subscriptions"]})})]})}const Oe=[{key:"weeklyRecapOptOut",label:"Weekly recap email",description:"Get a Monday recap with your clicks, signups, conversions, and earnings.",testIdSlug:"weekly-recap"},{key:"monthlySnapshotOptOut",label:"Monthly snapshot",description:"A bigger month-end summary with trends and top referral sources.",testIdSlug:"monthly-snapshot"},{key:"payoutNotificationsOptOut",label:"Payout notifications",description:"Email me when a payout is sent or marked paid.",testIdSlug:"payout-notifications"},{key:"milestoneNotificationsOptOut",label:"Milestone celebrations",description:"Celebrate milestones like your first signup or hitting earnings goals.",testIdSlug:"milestone-notifications"}];function Me(r){const{toast:o}=D(),[m,i]=f.useState(null),c=_({mutationFn:async s=>(await T("PATCH","/api/partner/preferences",s)).json(),onSuccess:()=>{F.invalidateQueries({queryKey:["/api/partner/dashboard"]}),o({title:"Preferences updated"})},onError:s=>{o({title:"Couldn't update preferences",description:s?.message||"Please try again",variant:"destructive"})},onSettled:()=>i(null)});return e.jsxs(u,{id:"email-preferences",children:[e.jsx($,{className:"pb-3",children:e.jsx(A,{className:"text-base font-normal",children:"Email Preferences"})}),e.jsx(x,{className:"p-4 pt-0",children:e.jsx("div",{className:"space-y-3",children:Oe.map(s=>{const l=r[s.key],d=!l,g=c.isPending&&m===s.key;return e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap py-2 border-b border-border/50 last:border-0",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium","data-testid":`text-${s.testIdSlug}-label`,children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),d?e.jsx(R,{variant:"outline",onClick:()=>{i(s.key),c.mutate({[s.key]:!l})},disabled:g,"data-testid":`button-toggle-${s.testIdSlug}`,children:g?e.jsx(N,{className:"w-3.5 h-3.5 animate-spin"}):"Unsubscribe"}):e.jsx(w,{size:"compact",onClick:()=>{i(s.key),c.mutate({[s.key]:!l})},disabled:g,"data-testid":`button-toggle-${s.testIdSlug}`,children:g?e.jsx(N,{className:"w-3.5 h-3.5 animate-spin"}):"Subscribe"})]},s.key)})})})]})}export{dt as default};

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