1/*! For license information please see 3714.f17db04f.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[3714],{92264(e,a,t){t.d(a,{p:()=>i});var s=t(65043),r=t(99766),o=t(70579);const i=s.forwardRef((e,a)=>{let{className:t,type:s,...i}=e;return(0,o.jsx)("input",{type:s,className:(0,r.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...i})});i.displayName="Input"},59938(e,a,t){t.d(a,{J:()=>d});var s=t(65043),r=t(65131),o=t(10917),i=t(99766),n=t(70579);const c=(0,o.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=s.forwardRef((e,a)=>{let{className:t,...s}=e;return(0,n.jsx)(r.b,{ref:a,className:(0,i.cn)(c(),t),...s})});d.displayName=r.b.displayName},51654(e,a,t){t.d(a,{d:()=>n});var s=t(65043),r=t(77943),o=t(99766),i=t(70579);const n=s.forwardRef((e,a)=>{let{className:t,...s}=e;return(0,i.jsx)(r.bL,{className:(0,o.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:a,children:(0,i.jsx)(r.zi,{className:(0,o.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});n.displayName=r.bL.displayName},53714(e,a,t){t.r(a),t.d(a,{default:()=>f});var s=t(65043),r=t(91586),o=t(25412),i=t(13390),n=t(92264),c=t(59938),d=t(51654),l=t(22024),u=t(72313),p=t(87095),h=t(23165),x=t(56328),m=t(70579);const b=[["PageView","Visita ao card\xe1pio"],["ViewContent","Visualizou produto"],["ViewCategory","Navegou por categoria"],["Search","Buscou no card\xe1pio"],["AddToCart","Adicionou ao carrinho"],["InitiateCheckout","Iniciou o checkout"],["AddPaymentInfo","Escolheu o pagamento"],["Purchase","Pedido conclu\xeddo"]];function f(){var e;const{user:a}=(0,o.A)(),t=null===a||void 0===a||null===(e=a.company)||void 0===e?void 0:e.slug,f=t?`${r.fn}/api/v1/public/${t}/catalog.csv`:"",[v,g]=(0,s.useState)({}),[y,j]=(0,s.useState)(!0),[w,k]=(0,s.useState)(!1);(0,s.useEffect)(()=>{r.Ay.get("/company/tracking/pixel").then(e=>g(e.data)).finally(()=>j(!1))},[]);return y?(0,m.jsx)("div",{className:"flex justify-center p-12",children:(0,m.jsx)(l.A,{className:"w-6 h-6 animate-spin"})}):(0,m.jsxs)("div",{className:"space-y-6 max-w-2xl","data-testid":"company-tracking-page",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"label-tracking mb-2",children:"Marketing"}),(0,m.jsx)("h1",{className:"text-3xl font-bold tracking-tight",children:"Pixel & Tr\xe1fego pago"}),(0,m.jsx)("p",{className:"text-zinc-400 mt-2",children:"Configure o Meta Pixel para rastrear convers\xf5es nas suas campanhas."})]}),(0,m.jsxs)("div",{className:"bg-[#161616] border border-white/10 rounded-2xl p-6",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,m.jsx)("div",{className:"w-10 h-10 rounded-xl bg-orange-500/10 border border-orange-500/20 flex items-center justify-center",children:(0,m.jsx)(h.A,{className:"w-5 h-5 text-orange-400"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"font-semibold",children:"Meta Pixel (Facebook)"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500",children:"Rastreia: visita ao card\xe1pio, visualiza\xe7\xe3o de produto, adi\xe7\xe3o ao carrinho, in\xedcio do checkout e pedido conclu\xeddo."})]})]}),(0,m.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),k(!0);try{const e=await r.Ay.post("/company/tracking/pixel",v);g(e.data),x.oR.success("Configura\xe7\xe3o salva!")}catch{x.oR.error("Erro.")}finally{k(!1)}},className:"space-y-4","data-testid":"company-tracking-form",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)(c.J,{children:"Pixel ID"}),(0,m.jsx)(n.p,{value:v.pixel_id||"",onChange:e=>g({...v,pixel_id:e.target.value}),placeholder:"123456789012345",className:"bg-[#0A0A0A] border-white/10","data-testid":"company-tracking-pixel-id"})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)(c.J,{children:"Token API de Convers\xf5es"}),(0,m.jsx)(n.p,{value:v.conversions_api_token||"",onChange:e=>g({...v,conversions_api_token:e.target.value}),placeholder:"EAAxxx...",className:"bg-[#0A0A0A] border-white/10"}),v.conversions_api_token_configured&&!v.conversions_api_token&&(0,m.jsx)("p",{className:"text-xs text-zinc-500 mt-1",children:"Token j\xe1 configurado. Preencha apenas se quiser substituir."})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)(c.J,{children:"C\xf3digo de teste (test event code)"}),(0,m.jsx)(n.p,{value:v.test_event_code||"",onChange:e=>g({...v,test_event_code:e.target.value}),placeholder:"TEST12345",className:"bg-[#0A0A0A] border-white/10"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 mt-1",children:'Opcional. Use durante a depura\xe7\xe3o no "Testar eventos" do Gerenciador de Eventos. Deixe vazio em produ\xe7\xe3o.'})]}),(0,m.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-[#0A0A0A] border border-white/10",children:[(0,m.jsx)(d.d,{checked:v.is_active,onCheckedChange:e=>g({...v,is_active:e})}),(0,m.jsxs)("div",{children:[(0,m.jsx)(c.J,{className:"cursor-pointer",children:"Pixel ativo"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500",children:"Habilita o rastreamento no card\xe1pio p\xfablico"})]})]}),(0,m.jsxs)("div",{className:"p-3 rounded-xl bg-[#0A0A0A] border border-white/10",children:[(0,m.jsx)(c.J,{className:"text-sm",children:"Eventos rastreados"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 mb-3",children:"Desligue eventos que n\xe3o quer enviar \xe0 Meta (navegador e API de Convers\xf5es)."}),(0,m.jsx)("div",{className:"grid sm:grid-cols-2 gap-x-6 gap-y-2.5",children:b.map(e=>{var a;let[t,s]=e;return(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-zinc-300",children:s}),(0,m.jsx)(d.d,{checked:!1!==(null===(a=v.events)||void 0===a?void 0:a[t]),onCheckedChange:e=>g({...v,events:{...v.events||{},[t]:e}}),"data-testid":`company-tracking-event-${t}`})]},t)})})]}),(0,m.jsx)(i.$,{type:"submit",disabled:w,className:"bg-orange-500 hover:bg-orange-600","data-testid":"company-tracking-submit",children:w?(0,m.jsx)(l.A,{className:"w-4 h-4 animate-spin"}):"Salvar"})]}),v.capi_last_sent_at&&(0,m.jsxs)("div",{className:"mt-6 p-3 rounded-xl border text-xs "+(v.capi_last_status>=200&&v.capi_last_status<300?"bg-emerald-500/10 border-emerald-500/20 text-emerald-300":"bg-red-500/10 border-red-500/20 text-red-300"),"data-testid":"company-tracking-capi-status",children:[(0,m.jsx)("strong",{children:"API de Convers\xf5es:"})," ",v.capi_last_status>=200&&v.capi_last_status<300?`funcionando (HTTP ${v.capi_last_status})`:`erro (HTTP ${v.capi_last_status||"\u2014"})${v.capi_last_error?`: ${v.capi_last_error}`:""}`,(0,m.jsxs)("span",{className:"block text-zinc-500 mt-0.5",children:["\xdaltimo envio: ",new Date(v.capi_last_sent_at).toLocaleStr
2ing("pt-BR")]})]}),(0,m.jsxs)("div",{className:"mt-6 p-4 rounded-xl bg-yellow-500/10 border border-yellow-500/20 text-xs text-yellow-300",children:[(0,m.jsx)("strong",{children:"LGPD:"})," O card\xe1pio p\xfablico exibe banner de consentimento de cookies antes de ativar rastreamento."]})]}),(0,m.jsxs)("div",{className:"bg-[#161616] border border-white/10 rounded-2xl p-6",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 mb-5",children:[(0,m.jsx)("div",{className:"w-10 h-10 rounded-xl bg-blue-500/10 border border-blue-500/20 flex items-center justify-center",children:(0,m.jsx)(p.A,{className:"w-5 h-5 text-blue-400"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"font-semibold",children:"Cat\xe1logo de produtos (An\xfancios Din\xe2micos)"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500",children:'Liga seus produtos aos eventos do Pixel para remarketing: "quem viu um produto v\xea o an\xfancio dele para voltar".'})]})]}),(0,m.jsx)(c.J,{children:"URL do feed do cat\xe1logo"}),(0,m.jsxs)("div",{className:"flex gap-2 mt-1",children:[(0,m.jsx)(n.p,{readOnly:!0,value:f,className:"bg-[#0A0A0A] border-white/10 font-mono text-xs","data-testid":"company-catalog-feed-url",onFocus:e=>e.target.select()}),(0,m.jsxs)(i.$,{type:"button",variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(f),x.oR.success("URL do cat\xe1logo copiada!")}catch{x.oR.error("N\xe3o foi poss\xedvel copiar.")}},className:"shrink-0 border-white/10","data-testid":"company-catalog-copy",children:[(0,m.jsx)(u.A,{className:"w-4 h-4 mr-1"})," Copiar"]})]}),(0,m.jsxs)("div",{className:"mt-4 text-xs text-zinc-400 space-y-1.5",children:[(0,m.jsx)("p",{className:"text-zinc-300 font-medium",children:"Como conectar na Meta:"}),(0,m.jsxs)("p",{children:["1. Abra o ",(0,m.jsx)("strong",{children:"Gerenciador de Com\xe9rcio"})," \u2192 Cat\xe1logo \u2192 Fontes de dados."]}),(0,m.jsxs)("p",{children:["2. Escolha ",(0,m.jsx)("strong",{children:'"URL agendada"'})," (Data feed) e cole a URL acima."]}),(0,m.jsx)("p",{children:"3. Defina a frequ\xeancia (di\xe1ria) e conclua. Depois associe o cat\xe1logo ao seu Pixel."}),(0,m.jsx)("p",{className:"text-zinc-500 mt-2",children:"Inclui os produtos ativos com pre\xe7o e imagem. Itens precificados por tamanho (ex.: pizza por tamanho) entram numa etapa futura."})]})]})]})}},77784(e,a,t){t.d(a,{A:()=>d});var s=t(65043);const r=e=>{const a=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,a,t)=>t?t.toUpperCase():a.toLowerCase()))(e);return a.charAt(0).toUpperCase()+a.slice(1)},o=function(){for(var e=arguments.length,a=new Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.filter((e,a,t)=>Boolean(e)&&""!==e.trim()&&t.indexOf(e)===a).join(" ").trim()},i=e=>{for(const a in e)if(a.startsWith("aria-")||"role"===a||"title"===a)return!0};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const c=(0,s.forwardRef)((e,a)=>{let{color:t="currentColor",size:r=24,strokeWidth:c=2,absoluteStrokeWidth:d,className:l="",children:u,iconNode:p,...h}=e;return(0,s.createElement)("svg",{ref:a,...n,width:r,height:r,stroke:t,strokeWidth:d?24*Number(c)/Number(r):c,className:o("lucide",l),...!u&&!i(h)&&{"aria-hidden":"true"},...h},[...p.map(e=>{let[a,t]=e;return(0,s.createElement)(a,t)}),...Array.isArray(u)?u:[u]])}),d=(e,a)=>{const t=(0,s.forwardRef)((t,i)=>{let{className:n,...d}=t;return(0,s.createElement)(c,{ref:i,iconNode:a,className:o(`lucide-${l=r(e),l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...d});var l});return t.displayName=r(e),t}},72313(e,a,t){t.d(a,{A:()=>s});const s=(0,t(77784).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"}]])},22024(e,a,t){t.d(a,{A:()=>s});const s=(0,t(77784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},87095(e,a,t){t.d(a,{A:()=>s});const s=(0,t(77784).A)("shopping-bag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]])},23165(e,a,t){t.d(a,{A:()=>s});const s=(0,t(77784).A)("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"}]])},65131(e,a,t){t.d(a,{b:()=>c});var s=t(65043),r=(t(97950),t(16851)),o=t(70579),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,a)=>{const t=(0,r.TL)(`Primitive.${a}`),i=s.forwardRef((e,s)=>{const{asChild:r,...i}=e,n=r?t:a;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,o.jsx)(n,{...i,ref:s})});return i.displayName=`Primitive.${a}`,{...e,[a]:i}},{});var n=s.forwardRef((e,a)=>(0,o.jsx)(i.label,{...e,ref:a,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));n.displayName="Label";var c=n},77943(e,a,t){t.d(a,{bL:()=>w,zi:()=>k}
2);var s=t(65043),r=t(30858),o=t(82814),i=t(21862),n=t(13642),c=t(23168),d=t(93124),l=t(87914),u=t(70579),p="Switch",[h,x]=(0,i.A)(p),[m,b]=h(p),f=s.forwardRef((e,a)=>{const{__scopeSwitch:t,name:i,checked:c,defaultChecked:d,required:h,disabled:x,value:b="on",onCheckedChange:f,form:v,...g}=e,[w,k]=s.useState(null),N=(0,o.s)(a,e=>k(e)),A=s.useRef(!1),_=!w||(v||!!w.closest("form")),[C,z]=(0,n.i)({prop:c,defaultProp:d??!1,onChange:f,caller:p});return(0,u.jsxs)(m,{scope:t,checked:C,disabled:x,children:[(0,u.jsx)(l.sG.button,{type:"button",role:"switch","aria-checked":C,"aria-required":h,"data-state":j(C),"data-disabled":x?"":void 0,disabled:x,value:b,...g,ref:N,onClick:(0,r.mK)(e.onClick,e=>{z(e=>!e),_&&(A.current=e.isPropagationStopped(),A.current||e.stopPropagation())})}),_&&(0,u.jsx)(y,{control:w,bubbles:!A.current,name:i,value:b,checked:C,required:h,disabled:x,form:v,style:{transform:"translateX(-100%)"}})]})});f.displayName=p;var v="SwitchThumb",g=s.forwardRef((e,a)=>{const{__scopeSwitch:t,...s}=e,r=b(v,t);return(0,u.jsx)(l.sG.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:a})});g.displayName=v;var y=s.forwardRef((e,a)=>{let{__scopeSwitch:t,control:r,checked:i,bubbles:n=!0,...l}=e;const p=s.useRef(null),h=(0,o.s)(p,a),x=(0,c.Z)(i),m=(0,d.X)(r);return s.useEffect(()=>{const e=p.current;if(!e)return;const a=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(a,"checked").set;if(x!==i&&t){const a=new Event("click",{bubbles:n});t.call(e,i),e.dispatchEvent(a)}},[x,i,n]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...l,tabIndex:-1,ref:h,style:{...l.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function j(e){return e?"checked":"unchecked"}y.displayName="SwitchBubbleInput";var w=f,k=g},23168(e,a,t){t.d(a,{Z:()=>r});var s=t(65043);function r(e){const a=s.useRef({value:e,previous:e});return s.useMemo(()=>(a.current.value!==e&&(a.current.previous=a.current.value,a.current.value=e),a.current.previous),[e])}},93124(e,a,t){t.d(a,{X:()=>o});var s=t(65043),r=t(70503);function o(e){const[a,t]=s.useState(void 0);return(0,r.N)(()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(a=>{if(!Array.isArray(a))return;if(!a.length)return;const s=a[0];let r,o;if("borderBoxSize"in s){const e=s.borderBoxSize,a=Array.isArray(e)?e[0]:e;r=a.inlineSize,o=a.blockSize}else r=e.offsetWidth,o=e.offsetHeight;t({width:r,height:o})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}t(void 0)},[e]),a}}}]); 3//# sourceMappingURL=3714.f17db04f.chunk.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.