1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[77281,97966],{3358:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/company/integrations",function(){return r(31367)}])},7341:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var a=r(37876);r(14232);var n=r(48230),s=r.n(n),l=r(14136),i=r(28419),o=r(1868),d=r(24479),c=r(65163);let u={expert:{name:c.xo.full.name,price:(0,c.YB)("full"),annual:"or ".concat((0,c.eo)("full")),href:"/payments?tab=subscriptions",icon:d.A,gradient:"from-violet-500 to-purple-600",badgeBg:"bg-violet-50 dark:bg-violet-950/40 border border-violet-200/70 dark:border-violet-800/60",badgeText:"text-violet-700 dark:text-violet-300",glowFrom:"from-violet-400/15"},business:{name:c.xo.business.name,price:(0,c.YB)("business"),annual:"or ".concat((0,c.eo)("business")),href:"/payments?tab=subscriptions",icon:l.A,gradient:"from-cyan-500 to-teal-600",badgeBg:"bg-cyan-50 dark:bg-cyan-950/40 border border-cyan-200/70 dark:border-cyan-800/60",badgeText:"text-cyan-700 dark:text-cyan-300",glowFrom:"from-cyan-400/15"},enterprise:{name:c.xo.enterprise.name,price:(0,c.YB)("enterprise"),annual:"or ".concat((0,c.eo)("enterprise")),href:"/payments?tab=subscriptions",icon:l.A,gradient:"from-indigo-600 to-violet-700",badgeBg:"bg-indigo-50 dark:bg-indigo-950/40 border border-indigo-200/70 dark:border-indigo-800/60",badgeText:"text-indigo-700 dark:text-indigo-300",glowFrom:"from-indigo-400/15"}};function x(e){let{hub:t,hasAccess:r,loading:n,featureName:l,description:d,wide:c,hideCta:x,children:h,silent:p}=e;if(n)return(0,a.jsx)("div",{className:"animate-pulse rounded-2xl bg-neutral-200/40 dark:bg-neutral-800/40 h-40"});if(r)return(0,a.jsx)(a.Fragment,{children:h});if(p)return null;let m=u[t],b=m.icon,g=d&&("string"==typeof d?(0,a.jsx)("p",{className:"text-[13px] text-neutral-600 dar
1k:text-neutral-300 leading-relaxed mb-4 ".concat(c?"":"max-w-prose"),children:d}):(0,a.jsx)("div",{className:"text-[13px] text-neutral-600 dark:text-neutral-300 leading-relaxed mb-4 ".concat(c?"":"max-w-prose"),children:d})),f=!x&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[(0,a.jsxs)(s(),{href:m.href,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg bg-gradient-to-r ".concat(m.gradient," text-white text-[13px] font-semibold shadow-sm hover:shadow-md hover:opacity-95 transition"),children:["Unlock for ",m.price,(0,a.jsx)(i.A,{className:"w-3.5 h-3.5"})]}),(0,a.jsx)("span",{className:"text-[11px] font-medium text-emerald-600 dark:text-emerald-400",children:m.annual})]});return(0,a.jsxs)("div",{className:"relative overflow-hidden rounded-2xl border border-neutral-200/70 dark:border-neutral-800 bg-white dark:bg-neutral-900 p-5 sm:p-6",children:[(0,a.jsx)("div",{className:"absolute -top-16 -right-16 w-48 h-48 rounded-full bg-gradient-to-br ".concat(m.glowFrom," to-transparent blur-2xl pointer-events-none")}),(0,a.jsxs)("div",{className:"relative flex items-start gap-4",children:[(0,a.jsx)("div",{className:"flex-shrink-0 inline-flex w-11 h-11 items-center justify-center rounded-xl bg-gradient-to-br ".concat(m.gradient," shadow-md shadow-neutral-900/10"),children:(0,a.jsx)(o.A,{className:"w-5 h-5 text-white",strokeWidth:2.25})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 ".concat(c?"":"mb-1.5"),children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-neutral-900 dark:text-white leading-tight",children:l}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wide ".concat(m.badgeBg," ").concat(m.badgeText),children:[(0,a.jsx)(b,{className:"w-3 h-3"}),m.name]})]}),!c&&g,!c&&f]})]}),c&&(0,a.jsxs)("div",{className:"relative mt-4",children:[g,f]})]})}},14136:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},14463:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},16076:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},23551:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},31367:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>M});var a=r(37876),n=r(14232),s=r(91171),l=r(7341),i=r(64597),o=r(20978),d=r(97966),c=r(91929);let u={"shortlist.sent":"An operator sent you the shortlist for one of your projects","interview.invited":"You invited a shortlisted candidate to an AI interview","interview.graded":"An AI interview finished and was graded","webhook.ping":"A test event sent from the integrations page"},x=[1,5,30,120,720],h=x.length+1;Object.keys(u).filter(e=>"webhook.ping"!==e);var p=r(67609),m=r(53912),b=r(55634),g=r(28113),f=r(73291),y=r(32257),k=r(74206),w=r(60383),v=r(14463),j=r(23551),N=r(56262),A=r(16076),S=r(58725),C=r(93536);function T(e){if(!e)return"";try{return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch(t){return e}}let E={delivered:"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",pending:"bg-neutral-100 text-neutral-600 dar
1k:bg-neutral-800 dark:text-neutral-300",retrying:"bg-amber-50 text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",failed:"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300"},R=()=>{let e=(0,i.r)(),t=(0,o.HH)(e.userData),[r,s]=(0,n.useState)([]),[R,M]=(0,n.useState)([]),[B,H]=(0,n.useState)(null),[_,F]=(0,n.useState)(!0),[I,P]=(0,n.useState)(null),[O,L]=(0,n.useState)(""),[U,D]=(0,n.useState)(""),[q,W]=(0,n.useState)([]),[z,G]=(0,n.useState)(!1),[X,Y]=(0,n.useState)(null),[J,V]=(0,n.useState)(null),[K,$]=(0,n.useState)(!1),[Z,Q]=(0,n.useState)(null),[ee,et]=(0,n.useState)(null),[er,ea]=(0,n.useState)({}),[en,es]=(0,n.useState)(!1),el=(0,c.G)(),ei=(0,n.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=await (0,d.ensureAppToken)();if(!r)throw Error("Sign in again to manage integrations.");let a=await fetch("".concat(el).concat(e),{...t,headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r),...t.headers||{}}}),n=await a.json().catch(()=>({}));if(!a.ok){let e=null==n?void 0:n.detail;throw Error(e&&(e.message||e.error)||(null==n?void 0:n.error)||"Request failed (".concat(a.status,")"))}return n},[el]),eo=(0,n.useCallback)(async()=>{F(!0),P(null);try{let e=await ei("/enterprise/webhooks");s(e.webhooks||[]);let t=e.events||[];M(t),W(e=>e.length?e:t.map(e=>e.event)),H(e.limits||null)}catch(e){P((null==e?void 0:e.message)||"Could not load your integrations.")}finally{F(!1)}},[ei]);(0,n.useEffect)(()=>{!e.loading&&t?eo():e.loading||F(!1)},[e.loading,t,eo]);let ed=(0,n.useCallback)(async e=>{es(!0);try{let t=await ei("/enterprise/webhooks/".concat(encodeURIComponent(e),"/deliveries"));ea(r=>({...r,[e]:t.deliveries||[]}))}catch(e){P((null==e?void 0:e.message)||"Could not load the delivery log.")}finally{es(!1)}},[ei]),ec=async e=>{if(ee===e)return void et(null);et(e),await ed(e)},eu=async()=>{if(O.trim()&&0!==q.length&&!z){G(!0),P(null),Q(null);try{let e=await ei("/enterprise/webhooks",{method:"POST",body:JSON.stringify({url:O.trim(),events:q,description:U.trim()})});V({id:e.id,url:e.url,secret:e.secret}),$(!1),L(""),D(""),await eo()}catch(e){P((null==e?void 0:e.message)||"Could not add the endpoint.")}finally{G(!1)}}},ex=async e=>{if(!X&&confirm("Remove this endpoint? Deliveries still queued for it will not be sent.")){Y(e),P(null);try{await ei("/enterprise/webhooks/".concat(encodeURIComponent(e)),{method:"DELETE"}),(null==J?void 0:J.id)===e&&V(null),ee===e&&et(null),await eo()}catch(e){P((null==e?void 0:e.message)||"Could not remove the endpoint.")}finally{Y(null)}}},eh=async e=>{if(!X){Y(e),P(null),Q(null);try{await ei("/enterprise/webhooks/".concat(encodeURIComponent(e),"/test"),{method:"POST"}),Q("Test event queued. It is signed and posted within a few seconds; open the log to watch it land."),ee!==e&&et(e),await ed(e)}catch(e){P((null==e?void 0:e.message)||"Could not send the test event.")}finally{Y(null)}}},ep=async()=>{if(J)try{await navigator.clipboard.writeText(J.secret),$(!0),setTimeout(()=>$(!1),2e3)}catch(e){}},em=!!B&&r.length>=B.maxEndpoints,eb=Object.entries(u),eg=(0,a.jsx)("div",{children:(0,a.jsx)("p",{children:"Enterprise accounts connect the hub to their own systems: an ATS, a ticketing tool, a Slack workflow, an internal dashboard. Register an https endpoint and REWORK posts a signed event to it when a shortlist is sent to you or one of your AI interviews is invited or graded, with retries and a delivery log you can read here."})});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.Ay,{title:"Integrations",noindex:!0}),(0,a.jsx)("div",{className:"max-w-5xl mx-auto space-y-6",children:(0,a.jsx)(l.A,{hub:"enterprise",hasAccess:t,loading:e.loading,featureName:"Custom integrations",description:eg,wide:!0,children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"flex items-center gap-2 text-2xl font-bold text-neutral-900 dark:text-white",children:[(0,a.jsx)(m.A,{className:"h-6 w-6 text-indigo-500"})," Integrations"]}),(0,a.jsx)("p",{className:"mt-1 max-w-2xl text-sm text-neutral-500 dark:text-neutral-400",children:"Signed webhooks to your own systems when a shortlist is sent to you or an AI interview is invited or graded. Each endpoint has its own secret; the plan is re-checked on every event."})]}),B&&(0,a.jsxs)("div",{className:"rounded-xl border border-neutral-200 px-3 py-2 text-right dark:border-neutral-800",children:[(0,a.jsxs)("div",{className:"text-lg font-bold tabular-nums text-neutral-900 dark:text-white",children:[r.length," ",(0,a.jsxs)("span",{className:"text-xs font-medium text-neutral-500",children:["of ",B.maxEndpoints," endpoints"]})]}),(0,a.jsxs)("div",{className:"text-[11px] text-neutral-500 dark:text-neutral-400",children:["up to ",h," attempts per delivery"]})]})]}),I&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",children:[(0,a.jsx)(b.A,{className:"h-4 w-4"})," ",I]}),Z&&!I&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-2 text-sm text-indigo-800 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-300",children:[(0,a.jsx)(g.A,{className:"h-4 w-4"})," ",Z]}),J&&(0,a.jsxs)("section",{className:"rounded-2xl border border-emerald-300 bg-emerald-50 p-4 sm:p-5 dark:border-emerald-500/40 dark:bg-emerald-500/10",children:[(0,a.jsxs)("p",{className:"flex items-center gap-2 text-sm font-bold text-emerald-900 dark:text-emerald-200",children:[(0,a.jsx)(f.A,{className:"h-4 w-4"})," The signing secret for ",J.url,". Copy it now: it is not shown again."]}),(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,a.jsx)("code",{className:"flex-1 min-w-0 break-all rounded-lg bg-white px-3 py-2 font-mono text-sm text-neutral-900 dark:bg-neutral-950 dar
1k:text-neutral-100",children:J.secret}),(0,a.jsxs)("button",{type:"button",onClick:ep,className:"inline-flex items-center gap-1.5 rounded-lg bg-emerald-700 px-3 py-2 text-sm font-semibold text-white hover:bg-emerald-800",children:[K?(0,a.jsx)(y.A,{className:"h-4 w-4"}):(0,a.jsx)(k.A,{className:"h-4 w-4"})," ",K?"Copied":"Copy"]}),(0,a.jsx)("button",{type:"button",onClick:()=>V(null),className:"rounded-lg px-3 py-2 text-sm font-medium text-emerald-900 hover:bg-emerald-100 dark:text-emerald-200 dark:hover:bg-emerald-500/20",children:"I have saved it"})]})]}),(0,a.jsxs)("section",{className:"rounded-2xl border border-neutral-200 bg-white p-4 sm:p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-base font-semibold text-neutral-900 dark:text-white",children:[(0,a.jsx)(w.A,{className:"h-4 w-4 text-neutral-400"})," Add an endpoint"]}),(0,a.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-[2fr_1fr]",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:"Endpoint URL (https)"}),(0,a.jsx)("input",{value:O,onChange:e=>L(e.target.value),maxLength:2048,inputMode:"url",placeholder:"https://your-system.example.com/rework",className:"w-full rounded-lg border border-neutral-200 bg-white px-3 py-2 font-mono text-sm text-neutral-800 placeholder:text-neutral-400 focus:border-indigo-400 focus:outline-none focus:ring-1 focus:ring-indigo-400 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-100"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:"Label (optional)"}),(0,a.jsx)("input",{value:U,onChange:e=>D(e.target.value),maxLength:120,placeholder:"e.g. Greenhouse sync",className:"w-full rounded-lg border border-neutral-200 bg-white px-3 py-2 text-sm text-neutral-800 placeholder:text-neutral-400 focus:border-indigo-400 focus:outline-none focus:ring-1 focus:ring-indigo-400 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-100"})]})]}),(0,a.jsx)("p",{className:"mt-3 text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:"Events"}),(0,a.jsx)("div",{className:"mt-1 grid gap-2 sm:grid-cols-3",children:R.map(e=>{let t=q.includes(e.event);return(0,a.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded-lg border px-3 py-2 text-sm ".concat(t?"border-indigo-300 bg-indigo-50/60 dark:border-indigo-500/40 dark:bg-indigo-500/10":"border-neutral-200 dark:border-neutral-800"),children:[(0,a.jsx)("input",{type:"checkbox",checked:t,onChange:()=>(e=>{W(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})(e.event),className:"mt-0.5"}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block font-mono text-xs text-neutral-900 dark:text-white",children:e.event}),(0,a.jsx)("span",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:e.description})]})]},e.event)})}),(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("button",{type:"button",onClick:eu,disabled:z||!O.trim()||0===q.length||em,className:"inline-flex items-center gap-1.5 rounded-lg bg-indigo-700 px-3 py-2 text-sm font-semibold text-white hover:bg-indigo-800 disabled:opacity-50",children:[z?(0,a.jsx)(v.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(w.A,{className:"h-4 w-4"})," Add endpoint"]}),em&&(0,a.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:"You have every endpoint your plan allows. Remove one to add another."}),(0,a.jsx)("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Public https hosts only; private addresses are refused."})]})]}),(0,a.jsxs)("section",{className:"rounded-2xl border border-neutral-200 bg-white p-4 sm:p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-base font-semibold text-neutral-900 dark:text-white",children:[(0,a.jsx)(m.A,{className:"h-4 w-4 text-neutral-400"})," Endpoints"]}),(0,a.jsxs)("button",{type:"button",onClick:eo,disabled:_,className:"inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-neutral-800 disabled:opacity-50 dark:hover:text-neutral-200",children:[(0,a.jsx)(j.A,{className:"h-3.5 w-3.5 ".concat(_?"animate-spin":"")})," Refresh"]})]}),_?(0,a.jsx)("div",{className:"flex justify-center py-10",children:(0,a.jsx)(v.A,{className:"h-5 w-5 animate-spin text-neutral-400"})}):0===r.length?(0,a.jsx)("p",{className:"rounded-xl border border-dashed border-neutral-300 py-8 text-center text-sm text-neutral-500 dark:border-neutral-700 dark:text-neutral-400",children:"No endpoints yet. Add one above; its secret is shown once."}
1):(0,a.jsx)("ul",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:r.map(e=>{let t=er[e.id]||[],r=ee===e.id;return(0,a.jsxs)("li",{className:"py-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("code",{className:"break-all font-mono text-sm text-neutral-900 dark:text-white",children:e.url}),e.description&&(0,a.jsx)("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] font-semibold text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",children:e.description}),!e.active&&(0,a.jsx)("span",{className:"rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",children:"Paused"})]}),(0,a.jsxs)("p",{className:"mt-0.5 text-xs text-neutral-500 dark:text-neutral-400",children:[e.events.join(", ")," \xb7 ","added ",T(e.createdAt),e.lastDeliveredAt?" \xb7 last delivered ".concat(T(e.lastDeliveredAt)):" \xb7 nothing delivered yet"]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eh(e.id),disabled:X===e.id,className:"inline-flex items-center gap-1 rounded-lg border border-neutral-200 px-2.5 py-1.5 text-xs font-medium text-neutral-700 hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800",children:[X===e.id?(0,a.jsx)(v.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(g.A,{className:"h-3.5 w-3.5"})," Send test"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>ec(e.id),className:"inline-flex items-center gap-1 rounded-lg border border-neutral-200 px-2.5 py-1.5 text-xs font-medium text-neutral-700 hover:bg-neutral-50 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800",children:[(0,a.jsx)(N.A,{className:"h-3.5 w-3.5"})," Log ",r?(0,a.jsx)(A.A,{className:"h-3 w-3"}):(0,a.jsx)(S.A,{className:"h-3 w-3"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>ex(e.id),disabled:X===e.id,className:"inline-flex items-center gap-1 rounded-lg border border-red-200 px-2.5 py-1.5 text-xs font-medium text-red-700 hover:bg-red-50 disabled:opacity-50 dark:border-red-500/30 dark:text-red-300 dark:hover:bg-red-500/10",children:[(0,a.jsx)(C.A,{className:"h-3.5 w-3.5"})," Remove"]})]})]}),r&&(0,a.jsxs)("div",{className:"mt-3 rounded-xl border border-neutral-200 dark:border-neutral-800",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:[(0,a.jsxs)("span",{children:["Delivery log",B?", latest ".concat(B.deliveryLogLimit):""]}),(0,a.jsxs)("button",{type:"button",onClick:()=>ed(e.id),disabled:en,className:"inline-flex items-center gap-1 normal-case tracking-normal hover:text-neutral-700 disabled:opacity-50 dark:hover:text-neutral-200",children:[(0,a.jsx)(j.A,{className:"h-3 w-3 ".concat(en?"animate-spin":"")})," Refresh"]})]}),en&&0===t.length?(0,a.jsx)("div",{className:"flex justify-center py-6",children:(0,a.jsx)(v.A,{className:"h-4 w-4 animate-spin text-neutral-400"})}):0===t.length?(0,a.jsx)("p",{className:"px-3 pb-3 text-xs text-neutral-500 dark:text-neutral-400",children:"Nothing delivered yet. Send a test to see one here."}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:[(0,a.jsx)("th",{className:"px-3 py-1.5",children:"Event"}),(0,a.jsx)("th",{className:"px-3 py-1.5",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-1.5",children:"Attempts"}),(0,a.jsx)("th",{className:"px-3 py-1.5",children:"Response"}),(0,a.jsx)("th",{className:"px-3 py-1.5",children:"Created"}),(0,a.jsx)("th",{className:"px-3 py-1.5",children:"Next try"})]})}),(0,a.jsx)("tbody",{children:t.map(e=>(0,a.jsxs)("tr",{className:"border-t border-neutral-100 align-top dark:border-neutral-800",children:[(0,a.jsx)("td",{className:"px-3 py-2 font-mono text-neutral-800 dark:text-neutral-200 whitespace-nowrap",children:e.event}),(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ".concat(E[e.status]||E.pending),children:e.status})}),(0,a.jsxs)("td",{className:"px-3 py-2 tabular-nums text-neutral-600 dar
1k:text-neutral-300",children:[e.attempts," of ",h]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-neutral-600 dark:text-neutral-300",children:[null!=e.lastStatusCode?(0,a.jsx)("span",{className:"font-mono",children:e.lastStatusCode}):"",e.lastError?(0,a.jsx)("span",{className:"block max-w-xs truncate text-neutral-500",title:e.lastError,children:e.lastError}):null]}),(0,a.jsx)("td",{className:"px-3 py-2 text-neutral-600 dark:text-neutral-300 whitespace-nowrap",children:T(e.createdAt)}),(0,a.jsx)("td",{className:"px-3 py-2 text-neutral-600 dark:text-neutral-300 whitespace-nowrap",children:"retrying"===e.status?T(e.nextAttemptAt):""})]},e.id))})]})})]})]},e.id)})})]}),(0,a.jsxs)("section",{className:"rounded-2xl border border-neutral-200 bg-white p-4 sm:p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[(0,a.jsxs)("h2",{className:"flex items-center gap-2 text-base font-semibold text-neutral-900 dark:text-white",children:[(0,a.jsx)(f.A,{className:"h-4 w-4 text-neutral-400"})," Receiving and verifying events"]}),(0,a.jsx)("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"Every delivery is an HTTPS POST with a JSON body. Respond with any 2xx status within ten seconds to acknowledge it; anything else is retried. Redirects are not followed."}),(0,a.jsx)("p",{className:"mt-4 text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:"Headers"}),(0,a.jsx)("div",{className:"mt-1 overflow-x-auto",children:(0,a.jsx)("table",{className:"w-full text-left text-sm",children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{className:"border-t border-neutral-100 align-top dark:border-neutral-800",children:[(0,a.jsx)("td",{className:"py-2 pr-3 font-mono text-xs text-neutral-800 dark:text-neutral-200 whitespace-nowrap",children:"X-Rework-Event"}
1),(0,a.jsxs)("td",{className:"py-2 text-neutral-600 dark:text-neutral-300",children:["The event name, the same value as the body's ",(0,a.jsx)("code",{className:"font-mono text-xs",children:"event"}),"."]})]}),(0,a.jsxs)("tr",{className:"border-t border-neutral-100 align-top dark:border-neutral-800",children:[(0,a.jsx)("td",{className:"py-2 pr-3 font-mono text-xs text-neutral-800 dark:text-neutral-200 whitespace-nowrap",children:"X-Rework-Delivery"}),(0,a.jsx)("td",{className:"py-2 text-neutral-600 dark:text-neutral-300",children:"A unique id per delivery, stable across retries. Use it to ignore a duplicate."})]}),(0,a.jsxs)("tr",{className:"border-t border-neutral-100 align-top dark:border-neutral-800",children:[(0,a.jsx)("td",{className:"py-2 pr-3 font-mono text-xs text-neutral-800 dark:text-neutral-200 whitespace-nowrap",children:"X-Rework-Signature"}),(0,a.jsxs)("td",{className:"py-2 text-neutral-600 dark:text-neutral-300",children:[(0,a.jsx)("code",{className:"font-mono text-xs",children:"t=<unix seconds>,v1=<hex>"})," where v1 is HMAC-SHA256 with your secret over the string ",(0,a.jsx)("code",{className:"font-mono text-xs",children:"<t>.<raw body>"}),". Reject a timestamp older than a few minutes."]})]})]})})}),(0,a.jsx)("p",{className:"mt-4 text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:"Verify (Node.js)"}),(0,a.jsx)("pre",{className:"mt-1 overflow-x-auto rounded-lg bg-neutral-900 px-3 py-2 font-mono text-xs text-neutral-100 dark:bg-neutral-950",children:"const crypto = require('crypto');\n\n// rawBody: the request body exactly as received, before any JSON parsing.\nfunction verifyRework(secret, signatureHeader, rawBody, toleranceSec = 300) {\n const parts = Object.fromEntries(signatureHeader.split(',').map((kv) => kv.split('=')));\n const t = Number(parts.t);\n if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;\n const expected = crypto.createHmac('sha256', secret).update(t + '.' + rawBody).digest('hex');\n const given = String(parts.v1 || '');\n return given.length === expected.length\n && crypto.timingSafeEqual(Buffer.from(expected, 'hex'), Buffer.from(given, 'hex'));\n}\n\n// In your handler:\n// const ok = verifyRework(process.env.REWORK_WEBHOOK_SECRET, req.headers['x-rework-signature'], rawBody);\n// if (!ok) return res.status(400).end();\n// res.status(200).end(); // acknowledge fast; do the work after"}),(0,a.jsx)("p",{className:"mt-4 text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:"Body"}),(0,a.jsx)("pre",{className:"mt-1 overflow-x-auto rounded-lg bg-neutral-900 px-3 py-2 font-mono text-xs text-neutral-100 dark:bg-neutral-950",children:'{\n "id": "<the X-Rework-Delivery id>",\n "event": "shortlist.sent",\n "createdAt": "<ISO 8601, UTC>",\n "businessUid": "<your account id>",\n "data": { "projectId": "...", "title": "...", "sentAt": "...", "shortlist": [ { "uid": "...", "name": "...", "score": 0.91 } ] }\n}'}),(0,a.jsx)("div",{className:"mt-4 overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-left text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-[10px] font-semibold uppercase tracking-wider text-neutral-400",children:[(0,a.jsx)("th",{className:"py-1.5 pr-3",children:"Event"}),(0,a.jsx)("th",{className:"py-1.5",children:"When"})]})}),(0,a.jsx)("tbody",{children:eb.map(e=>{let[t,r]=e;return(0,a.jsxs)("tr",{className:"border-t border-neutral-100 align-top dark:border-neutral-800",children:[(0,a.jsx)("td",{className:"py-2 pr-3 font-mono text-xs text-neutral-800 dark:text-neutral-200 whitespace-nowrap",children:t}
1),(0,a.jsx)("td",{className:"py-2 text-neutral-600 dark:text-neutral-300",children:r})]},t)})})]})}),(0,a.jsxs)("div",{className:"mt-4 rounded-xl border border-neutral-200 p-3 text-xs text-neutral-600 dark:border-neutral-800 dark:text-neutral-300",children:[(0,a.jsx)("p",{className:"font-semibold text-neutral-800 dark:text-neutral-100",children:"Retries"}),(0,a.jsxs)("p",{className:"mt-1",children:["A delivery that is not acknowledged is tried again after ",function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;return e.map(e=>e>=60?"".concat(e/60," h"):"".concat(e," min")).join(", ")}(),", then marked failed:"," ",h," attempts in all. Deliveries are independent, so one failing endpoint never delays another."]})]})]})]})})})]})};R.getLayout=function(e){return(0,a.jsx)(s.A,{children:e})};let M=R},32257:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},53912:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]])},56262:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("ScrollText",[["path",{d:"M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4",key:"13a6an"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M15 12h-5",key:"r7krc0"}]])},60383:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},64597:(e,t,r)=>{"use strict";r.d(t,{r:()=>u});var a=r(14232),n=r(42009),s=r(50873),l=r(19412),i=r(91952),o=r(38965),d=r(20978);function c(e){let t=(0,d.hasBusinessHubAccess)(e),r=e.businessHubStatus||e.swiitchSubscriptionStatus||e.subscriptionStatus||"",a=(0,o.j2)(e),n=(0,i.Ct)(a,t);return{hasBusinessHub:t,subscriptionStatus:r,limits:n,userData:e}}function u(){let[e,t]=(0,a.useState)({loading:!0,hasBusinessHub:!1,subscriptionStatus:"",limits:null,userData:null}),r=(0,a.useCallback)(async e=>{if(!e)return void t({loading:!1,hasBusinessHub:!1,subscriptionStatus:"",limits:null,userData:null});try{let r=(0,s.getFirebaseFirestore)(),a=await (0,n.getDoc)((0,n.doc)(r,"users",e.uid)),l=a.exists()?a.data():{};t({loading:!1,...c(l)})}catch(e){t(e=>({...e,loading:!1}))}},[]);(0,a.useEffect)(()=>{let e=!1,r=null,a=(0,s.getFirebaseAuth)(),i=(0,l.onAuthStateChanged)(a,a=>{if(!e){if(r&&(r(),r=null),!a)return void t({loading:!1,hasBusinessHub:!1,subscriptionStatus:"",limits:null,userData:null});try{let l=(0,s.getFirebaseFirestore)();r=(0,n.onSnapshot)((0,n.doc)(l,"users",a.uid),r=>{if(e)return;let a=r.exists()?r.data():{};t({loading:!1,...c(a)})},()=>{e||t(e=>({...e,loading:!1}))})}catch(e){t(e=>({...e,loading:!1}))}}});return()=>{e=!0,r&&r(),i()}},[]);let i=(0,a.useCallback)(async()=>{let e=(0,s.getFirebaseAuth)();await r(e.currentUser)},[r]),o=(0,a.useCallback)(t=>{var r;let a=null==(r=e.limits)?void 0:r[t];return"boolean"==typeof a?a:"number"==typeof a&&0!==a},[e.limits]);return{...e,refresh:i,canUse:o}}},65163:(e,t,r)=>{"use strict";r.d(t,{TC:()=>o,TG:()=>n,YB:()=>l,eo:()=>d,oo:()=>s,s1:()=>i,xo:()=>a});let a={business:{monthly:149,yearly:1490,planId:"business_hub",name:"Business Hub",audience:"business",positioning:"For buying work",promise:"Find, vet, contract and pay verified experts at scale, with the paperwork finance signs off on and the reporting that proves the return.",journey:["Find experts","Evaluate them","Hire and contract","Manage delivery","Measure ROI"],guide:"business-hub-guide"},enterprise:{monthly:499,yearly:4990,planId:"enterprise_hub",name:"Enterprise",audience:"business",positioning:"For hiring at volume",promise:"Everything in Business Hub, plus AI interviews on your own scorecards, an API and signed webhooks into your systems, your own contract templates, and seats for your teammates.",journey:["Interview at scale","Connect your systems","Contract on your terms","Bring your teammates"],guide:"enterprise-guide"},lite:{monthly:14.99,yearly:149.99,planId:"expert_hub_lite",name:"Expert Hub Lite",audience:"expert",positioning:"For getting started",promise:"A branded storefront that quotes and books for you, live today, with the reviews and badges you have already earned.",journey:["Publish your storefront","Take bookings","Get paid through escrow"],guide:"expert-hub-lite-guide"},full:{monthly:39.99,yearly:399.99,planId:"expert_hub",name:"Expert Hub",audience:"expert",positioning:"For getting work",promise:"Win more work and run your practice from one place: instant payouts, hand-matched Pool work, the AI desk and the market data behind every quote.",journey:["Find clients","Win projects","Get paid","Grow"],guide:"expert-hub-guide"}};
1function n(e){return e%1==0?"$".concat(e.toLocaleString("en-US")):"$".concat(e.toFixed(2))}function s(e){return e>=1e3&&e%1e3==0?"$".concat((e/1e3).toLocaleString("en-US"),"K"):n(e)}function l(e){return"".concat(n(a[e].monthly),"/mo")}function i(e){return"".concat(n(a[e].yearly),"/yr")}function o(e){let{monthly:t,yearly:r}=a[e];return Math.round((12*t-r)/t)}function d(e){let t=o(e);return"".concat(i(e)," - ").concat(t," month").concat(1===t?"":"s"," free")}},74206:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(48900).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},91929:(e,t,r)=>{"use strict";function a(){{let e=window.location.hostname;if(e.startsWith("reci.")||"rhanta.com"===e||"www.rhanta.com"===e)return"https://api.rhanta.com/api/v1"}return"https://api.reworkdigital.io/api/v1".replace(/\/$/,"")}function n(){try{return new URL(a()).origin}catch(e){return a()}}r.d(t,{G:()=>a,p:()=>n})},97966:(e,t,r)=>{"use strict";r.d(t,{ensureAppToken:()=>i,exchangeFirebaseToken:()=>l});var a=r(9532),n=r(50873),s=r(19412);async function l(){let e=await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e3,t=(0,n.getFirebaseAuth)();return t.currentUser?Promise.resolve(t.currentUser):new Promise(r=>{let a=setTimeout(()=>{n(),r(null)},e),n=(0,s.onAuthStateChanged)(t,e=>{clearTimeout(a),n(),r(e)})})}();if(!e)return console.warn("[ensureAppToken] No Firebase user - cannot exch
1ange token"),null;try{let t,n=await e.getIdToken(!0);try{let{getFirebaseFirestore:a}=await Promise.resolve().then(r.bind(r,50873)),{doc:n,getDoc:s}=await Promise.resolve().then(r.bind(r,42009)),l=a(),i=await s(n(l,"users",e.uid));i.exists()&&(t=i.data().role)}catch(e){}"candidate"===t&&(t="freelancer");let s=new Set(["freelancer","employer","business","admin","auditor"]),l={token:n};t&&s.has(t)&&(l.role=t);let i=await fetch("".concat(function(){{let e=window.location.hostname;if(e.startsWith("reci.")||"rhanta.com"===e||"www.rhanta.com"===e)return"https://api.rhanta.com/api/v1"}return"https://api.reworkdigital.io/api/v1"}(),"/auth/google"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(i.ok){let e=await i.json();if(e.access_token&&e.refresh_token)return a.A.setTokens(e.access_token,e.refresh_token),e.access_token}else{let e=await i.text().catch(()=>"");console.error("[ensureAppToken] Token exchange HTTP ".concat(i.status,": ").concat(e))}}catch(e){console.error("[ensureAppToken] Token exchange failed:",e)}return null}async function i(){let e=a.A.getAccessToken();if(e&&!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,r=function(e){try{let t=e.split(".");if(3!==t.length)return null;return JSON.parse(atob(t[1].replace(/-/g,"+").replace(/_/g,"/")))}catch(e){return null}}(e);if(!(null==r?void 0:r.exp))return!0;let a=Math.floor(Date.now()/1e3);return r.exp<=a+t}(e))return e;let t=async()=>{for(let e=0;e<2;e++){let t=await l();if(t)return t;e<1&&await new Promise(t=>setTimeout(t,500*Math.pow(2,e)))}return null};try{let e=await Promise.race([t(),new Promise(e=>setTimeout(()=>e(null),5e3))]);return e||console.warn("[ensureAppToken] Token exchange timed out or failed - backend may be unreachable"),e}catch(e){return console.error("[ensureAppToken] Unexpected error during token exchange"),null}}}},e=>{e.O(0,[82175,26807,51901,91952,38965,10657,91171,90636,46593,38792],()=>e(e.s=3358)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.