PageSourceSearch

https://nexbid.dev/assets/SdkCodeGeneratorPage-C2XI0je9.js

js nexbid.dev collected 2026-10-01 23:58:35 UTC 5,895 bytes, 7 lines download raw bytes

1import{u as R,r as a,j as e}from"./index-CclSbnHS.js";import{u as w}from"./useImpersonation-CAQF3vmY.js";function G({mode:i,publisherId:d,token:t,debug:r,managedRefresh:l}){const n=d||"pub_xxx",c=t||"nxt_****",o=`
2        data-mode="${i}"`;return`<script src="https://nexbid.dev/sdk/nexbid.js"
3        data-publisher="${n}"
4        data-token="${c}"${o}${i==="gam"&&!l?`
5        data-managed-refresh="false"`:""}${r?`
6        data-debug="true"`:""}>
7<\/script>`}const T={de:{title:"SDK Code",subtitle:"Ein Script-Tag — das ist alles.",mode:"Integrationsmodus",standalone:"Standalone",standaloneDesc:"Nexbid-Slots direkt auf deiner Seite",gam:"GAM",gamDesc:"Nur GAM-Targeting-Anreicherung",hybrid:"Hybrid",hybridDesc:"Standalone-Slots + GAM-Targeting",managedRefresh:"Managed Refresh (Standard für GAM)",managedRefreshDesc:'Standardmässig aktiv für GAM: setzt den GAM-Auto-Load aus und refresht nach dem Targeting, damit Erstbesucher (Cold Cache) die nx_*-Keys erhalten. Deaktivieren emittiert data-managed-refresh="false". Tipp: nexbid.js früh/synchron laden für swap-freie Auslieferung.',debug:"Debug-Modus",preview:"Code-Vorschau",copy:"Code kopieren",copied:"Kopiert!",optional:"Optional",noDomain:"Registriere zuerst eine Domain im Setup.",loading:"Lade..."},en:{title:"SDK Code",subtitle:"One script tag — that's all.",mode:"Integration Mode",standalone:"Standalone",standaloneDesc:"Nexbid slots directly on your page",gam:"GAM",gamDesc:"GAM targeting enrichment only",hybrid:"Hybrid",hybridDesc:"Standalone slots + GAM targeting",managedRefresh:"Managed Refresh (on by default for GAM)",managedRefreshDesc:'On by default for GAM: suppresses the GAM auto-load and refreshes after targeting so first-time (cold-cache) visitors still carry the nx_* keys. Turning it off emits data-managed-refresh="false". Tip: load nexbid.js early/synchronously for swap-free delivery.',debug:"Debug Mode",preview:"Code Preview",copy:"Copy Code",copied:"Copied!",optional:"Optional",noDomain:"Register a domain in Setup first.",loading:"Loading..."}};function $(){const{locale:i}=R(),{apiFetch:d}=w(),t=T[i],[r,l]=a.useState("gam"),[n,c]=a.useState(!1),[o,u]=a.useState(!0),[x,b]=a.useState(!1),[p,N]=a.useState(""),[m,k]=a.useState(""),[D,S]=a.useState(!0);a.useEffect(()=>{async function s(){try{const[h,f]=await Promise.all([d("/api/account/profile"),d("/api/publisher/domains")]);if(h.ok){const j=await h.json();N(j.customerId||"")}if(f.ok){const y=((await f.json()).domains||[])[0];if(y?.id){const v=await d(`/api/publisher/domains/${y.id}/token`);if(v.ok){const M=await v.json();k(M.token||"")}}}}catch{}S(!1)}s()},[d]);const g=a.useMemo(()=>G({mode:r,publisherId:p,token:m,debug:n,managedRefresh:o}),[r,p,m,n,o]);function A(){navigator.clipboard.writeText(g),b(!0),setTimeout(()=>b(!1),2e3)}const C=[{value:"gam",label:t.gam,desc:t.gamDesc},{value:"standalone",label:t.standalone,desc:t.standaloneDesc},{value:"hybrid",label:t.hybrid,desc:t.hybridDesc}];return D?e.jsx("p",{className:"text-sm text-text-muted",children:t.loading}):e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-text-primary mb-2",children:t.title}),e.jsx("p",{className:"text-sm text-text-muted mb-6",children:t.subtitle}),!m&&e.jsx("div",{className:"rounded-2xl border border-amber-800/30 bg-amber-900/5 p-4 mb-6",children:e.jsx("p",{className:"text-sm text-amber-400",children:t.noDomain})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-text-primary mb-3",children:t.mode}),e.jsx("div",{className:"space-y-2",children:C.map(s=>e.jsxs("label",{className:`flex items-start gap-3 cursor-pointer rounded-lg border p-3 transition-colors ${r===s.value?"border-nexbid-500/50 bg-nexbid-500/5":"border-border-subtle hover:border-border-default"}`,children:[e.jsx("input",{type:"radio",name:"sdk_mode",value:s.value,checked:r===s.value,onChange:()=>l(s.value),className:"mt-0.5 accent-nexbid-500"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text-primary",children:s.label}),e.jsx("p",{className:"text-xs text-text-muted",children:s.desc})]})]},s.value))})]}),r==="gam"&&e.jsx("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:o,onChange:s=>u(s.target.checked),className:"mt-0.5 accent-nexbid-500"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-text-muted",children:t.managedRefresh}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:t.managedRefreshDesc})]})]})}),e.jsx("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:s=>c(s.target.checked),className:"accent-nexbid-500"}),e.jsx("span",{className:"text-sm text-text-muted",children:t.debug}),e.jsxs("span",{className:"text-xs text-text-muted",children:["(",t.optional,")"]})]})})]}),e.jsxs("div",{className:"rounded-2xl border border-border-subtle/50 bg-surface-raised/50 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-text-primary",children:t.preview}),e.jsx("button",{onClick:A,className:"rounded-lg border border-border-subtle px-3 py-1.5 text-xs text-text-muted hover:text-text-primary hover:border-border-default",children:x?t.copied:t.copy})]}),e.jsx("pre",{className:"bg-surface-bg rounded-lg p-4 font-mono text-sm text-emerald-400 overflow-x-auto whitespace-pre",children:g})]})]})]})}const O=$;export{O as Component,$ 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.