PageSourceSearch

https://www.promoamp.com/_app/immutable/nodes/29.-ZrtUMcH.js

js promoamp.com collected 2026-10-03 21:28:39 UTC 8,587 bytes, 2 lines download raw bytes

1import"../chunks/NZTpNUN0.js";import{p as He,l as V,v as Ce,t as k,a as e,b as Ke,s as Qe,c as v,f,e as Ue,n as i,r as m,d as r,i as x,o as P,j as t,g as y,m as W}from"../chunks/CswluXHk.js";import{s as S}from"../chunks/D5MUd0dc.js";import{i as ne}from"../chunks/Cvwav-Rz.js";import{e as Ve,i as We}from"../chunks/DLuIJL9M.js";import{c as o}from"../chunks/DCqg9Lcd.js";import{a as Ee}from"../chunks/sqsHMH9B.js";import{d as Ze,a as ke}from"../chunks/BnZqlU5Q.js";import{g as et}from"../chunks/DvabIYvy.js";import{p as tt}from"../chunks/BGX793Ew.js";import"../chunks/aH0YTA77.js";import{t as J}from"../chunks/CFi-xeDB.js";import{B as rt}from"../chunks/DltdByd6.js";import{C as Pe}from"../chunks/BFGY4aR1.js";import{T as at,a as st,b as Re,c as q,d as ot,e as z}from"../chunks/sC1LdqOV.js";import{I as lt}from"../chunks/DuX34-Zw.js";import{A as nt}from"../chunks/r7UZdRXb.js";import{B as it}from"../chunks/BNh867nN.js";import{K as dt}from"../chunks/DQK2-q4K.js";import{T as ct}from"../chunks/CLmkgC8t.js";var vt=f('<div class="rounded-lg border border-amber-200 bg-amber-50 p-4"><div class="flex items-start justify-between gap-4"><div><p class="font-medium text-amber-900">Copy this secret now</p> <p class="text-sm text-amber-800">You will not be able to view it again after leaving this page.</p></div> <button class="text-sm text-amber-900 underline">Copy</button></div> <pre class="mt-3 overflow-x-auto rounded bg-white p-3 text-sm"> </pre></div>'),mt=f('<div class="flex items-center gap-2"><!> <h2 class="font-semibold">Create API key</h2></div> <div class="flex flex-col gap-3 md:flex-row"><!> <!></div> <!>',1),pt=f('<p class="text-sm text-gray-500">No API keys yet.</p>'),je=f("<!> <!> <!> <!> <!> <!>",1),ut=f('<span class="rounded-full bg-gray-100 px-2 py-1 text-xs text-gray-700">Revoked</span>'),ft=f('<span class="rounded-full bg-green-100 px-2 py-1 text-xs text-green-700">Active</span>'),_t=f('<button class="inline-flex items-center text-sm text-red-600 hover:text-red-700 disabled:opacity-50"><!> </button>'),$t=f("<!> <!>",1),gt=f('<div class="overflow-x-auto"><!></div>'),ht=f('<div class="mb-4"><h2 class="font-semibold">Existing keys</h2> <p class="text-sm text-gray-500">Revoked keys remain visible for auditability.</p></div> <!>',1),xt=f('<p class="font-medium text-gray-900">Authentication</p> <p class="mt-2">Send the key as either <code>Authorization: Bearer &lt;key&gt;</code> or <code>X-API-Key: &lt;key&gt;</code>.</p> <p class="mt-2">Endpoints are read-only and strictly scoped to this team. Requests are limited to 120 per minute per key and client IP.</p> <p class="mt-2">The same key connects AI tools to the PromoAmp MCP server at <code> </code>. See the <a class="underline">API docs</a> for setup.</p>',1),yt=f('<div class="mb-20 space-y-6"><div class="flex items-center justify-between gap-4"><div><button class="mb-3 inline-flex items-center text-sm text-gray-500 hover:text-gray-700"><!> Back to integrations</button> <h1 class="text-lg font-semibold">Team API</h1> <p class="text-sm text-gray-500">Generate read-only API keys for this team. Raw secrets are shown once, then only the hash is stored.</p></div> <a class="inline-flex items-center rounded-md border px-4 py-2 text-sm hover:bg-gray-50"><!> API docs</a></div> <!> <!> <!></div>');function qt(Be,we){He(we,!0);const N=()=>Ue(tt,"$page",Ne),[Ne,De]=Qe();let D=V(Ce(we.data.apiKeys||[])),M=V(""),Z=V(""),ee=V(!1),w=V(Ce(new Set));function Ae(a){return a?new Date(a).toLocaleString():"Never"}async function Fe(a,l="Copied"){await navigator.clipboard.writeText(a),J.success(l)}async function Oe(){if(!t(M).trim()){J.error("Please enter a name for the API key");return}P(ee,!0);try{const a=await fetch(`/api/team-api-keys?teamSlug=${N().params.teamSlug}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t(M)})}),l=await a.json();if(!a.ok)throw new Error(l.error||"Failed to create API key");P(Z,l.rawKey,!0),P(D,[l.apiKey,...t(D)],!0),P(M,""),J.success("API key created")}catch(a){J.error(a instanceof Error?a.message:"Failed to create API key")}finally{P(ee,!1)}}async function Le(a){if(confirm("Revoke this API key? It will stop working immediately.")){t(w).add(a),P(w,t(w),!0);try{const l=await fetch(`/api/team-api-keys?teamSlug=${N().params.teamSlug}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({keyId:a})}),T=await l.json();if(!l.ok)throw new Error(T.error||"Failed to revoke API key");P(D,t(D).map(F=>F.id===a?{...F,revoked_at:new Date().toISOString()}:F),!0),J.success("API key revoked")}catch(l){J.error(l instanceof Error?l.message:"Failed to revoke API key")}finally{t(w).delete(a),P(w,t(w),!0)}}}var ie=yt(),de=v(ie),ce=v(de),ve=v(ce),Ge=v(ve);nt(Ge,{class:"mr-2 h-4 w-4"}),i(),m(ve),i(4),m(ce);var me=r(ce,2),Je=v(me);it(Je,{class:"mr-2 h-4 w-4"}),i(),m(me),m(de);var Ie=r(de,2);o(Ie,()=>Pe,(a,l)=>{l(a,{class:"p-6 space-y-4",children:(T,F)=>{var A=mt(),I=x(A),C=v(I);dt(C,{class:"h-4 w-4"}),i(2),m(I);var E=r(I,2),_=v(E);lt(_,{placeholder:"e.g. Reporting dashboard",class:"max-w-md",get value(){return t(M)},set value(b){P(M,b,!0)}});var R=r(_,2);rt(R,{onclick:Oe,get disabled(){return t(ee)},children:(b,O)=>{i();var j=y();k(()=>S(j,t(ee)?"Creating...":"Generate key")),e(b,j)},$$slots:{default:!0}}),m(E);var pe=r(E,2);{var ue=b=>{var O=vt(),j=v(O),te=r(v(j),2);m(j);var X=r(j,2),fe=v(X,!0);m(X),m(O),k(()=>
1S(fe,t(Z))),ke("click",te,()=>Fe(t(Z),"API key copied")),e(b,O)};ne(pe,b=>{t(Z)&&b(ue)})}e(T,A)},$$slots:{default:!0}})});var Se=r(Ie,2);o(Se,()=>Pe,(a,l)=>{l(a,{class:"p-6",children:(T,F)=>{var A=ht(),I=r(x(A),2);{var C=_=>{var R=pt();e(_,R)},E=_=>{var R=gt(),pe=v(R);o(pe,()=>at,(ue,b)=>{b(ue,{children:(O,j)=>{var te=$t(),X=x(te);o(X,()=>st,(_e,$e)=>{$e(_e,{children:(ge,ze)=>{var Y=W(),he=x(Y);o(he,()=>Re,(xe,$)=>{$(xe,{children:(re,Te)=>{var ae=je(),se=x(ae);o(se,()=>q,(d,c)=>{c(d,{children:(p,L)=>{i();var s=y("Name");e(p,s)},$$slots:{default:!0}})});var oe=r(se,2);o(oe,()=>q,(d,c)=>{c(d,{children:(p,L)=>{i();var s=y("Prefix");e(p,s)},$$slots:{default:!0}})});var ye=r(oe,2);o(ye,()=>q,(d,c)=>{c(d,{children:(p,L)=>{i();var s=y("Created");e(p,s)},$$slots:{default:!0}})});var H=r(ye,2);o(H,()=>q,(d,c)=>{c(d,{children:(p,L)=>{i();var s=y("Last used");e(p,s)},$$slots:{default:!0}})});var K=r(H,2);o(K,()=>q,(d,c)=>{c(d,{children:(p,L)=>{i();var s=y("Status");e(p,s)},$$slots:{default:!0}})});var le=r(K,2);o(le,()=>q,(d,c)=>{c(d,{})}),e(re,ae)},$$slots:{default:!0}})}),e(ge,Y)},$$slots:{default:!0}})});var fe=r(X,2);o(fe,()=>ot,(_e,$e)=>{$e(_e,{children:(ge,ze)=>{var Y=W(),he=x(Y);Ve(he,17,()=>t(D),We,(xe,$)=>{var re=W(),Te=x(re);o(Te,()=>Re,(ae,se)=>{se(ae,{children:(oe,ye)=>{var H=je(),K=x(H);o(K,()=>z,(s,g)=>{g(s,{class:"font-medium",children:(h,Q)=>{i();var n=y();k(()=>S(n,t($).name)),e(h,n)},$$slots:{default:!0}})});var le=r(K,2);o(le,()=>z,(s,g)=>{g(s,{class:"font-mono text-xs",children:(h,Q)=>{i();var n=y();k(()=>S(n,`${t($).key_prefix??""}...`)),e(h,n)},$$slots:{default:!0}})});var d=r(le,2);o(d,()=>z,(s,g)=>{g(s,{children:(h,Q)=>{i();var n=y();k(B=>S(n,B),[()=>Ae(t($).created_at)]),e(h,n)},$$slots:{default:!0}})});var c=r(d,2);o(c,()=>z,(s,g)=>{g(s,{children:(h,Q)=>{i();var n=y();k(B=>S(n,B),[()=>Ae(t($).last_used_at)]),e(h,n)},$$slots:{default:!0}})});var p=r(c,2);o(p,()=>z,(s,g)=>{g(s,{children:(h,Q)=>{var n=W(),B=x(n);{var be=u=>{var G=ut();e(u,G)},U=u=>{var G=ft();e(u,G)};ne(B,u=>{t($).revoked_at?u(be):u(U,-1)})}e(h,n)},$$slots:{default:!0}})});var L=r(p,2);o(L,()=>z,(s,g)=>{g(s,{class:"text-right",children:(h,Q)=>{var n=W(),B=x(n);{var be=U=>{var u=_t(),G=v(u);ct(G,{class:"mr-1 h-4 w-4"});var Me=r(G);m(u),k((Xe,Ye)=>{u.disabled=Xe,S(Me,` ${Ye??""}`)},[()=>t(w).has(t($).id),()=>t(w).has(t($).id)?"Revoking...":"Revoke"]),ke("click",u,()=>Le(t($).id)),e(U,u)};ne(B,U=>{t($).revoked_at||U(be)})}e(h,n)},$$slots:{default:!0}})}),e(oe,H)},$$slots:{default:!0}})}),e(xe,re)}),e(ge,Y)},$$slots:{default:!0}})}),e(O,te)},$$slots:{default:!0}})}),m(R),e(_,R)};ne(I,_=>{t(D).length===0?_(C):_(E,-1)})}e(T,A)},$$slots:{default:!0}})});var qe=r(Se,2);o(qe,()=>Pe,(a,l)=>{l(a,{class:"p-6 text-sm text-gray-600",children:(T,F)=>{var A=xt(),I=r(x(A),6),C=r(v(I)),E=v(C);m(C);var _=r(C,2);i(),m(I),k(()=>{S(E,`${N().url.origin??""}/mcp`),Ee(_,"href",`/brand/${N().params.teamSlug}/api`)}),e(T,A)},$$slots:{default:!0}})}),m(ie),k(()=>Ee(me,"href",`/brand/${N().params.teamSlug}/api`)),ke("click",ve,()=>et(`/brand/${N().params.teamSlug}/settings/integrations`)),e(Be,ie),Ke(),De()}Ze(["click"]);export{qt as component};
2//# sourceMappingURL=29.-ZrtUMcH.js.map

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.