PageSourceSearch

https://novo.gruposvip.com/assets/SalesPages-rI47-ZYP.js

js gruposvip.com collected 2026-09-26 08:44:20 UTC 27,528 bytes, 1 lines download raw bytes

1import{j as e,b as re,u as me,c as q}from"./query-Q_ThwKGI.js";import{r as b,i as pe}from"./react-vendor-wefok28f.js";import{s as y}from"./client-DjLwxtrO.js";import{B as m}from"./button-DrepnwkX.js";import{T as E,a as T,b as A,u as ie}from"./index-C4Kq7kkR.js";import{S as xe}from"./skeleton-B8BTwlen.js";import{C as ge}from"./card-DYyqUxY6.js";import{B as je,D as R,a as K,b as L,c as Q,d as fe}from"./badge-u_30_p7s.js";import{u as F}from"./useTranslation-DNoH3foE.js";import{F as ve,Q as we,a4 as Ne,a_ as ye,C as be,a7 as le,a8 as Ce,a9 as Pe,aa as B,g as se,A as ze,m as De,L as ke,ac as M}from"./icons-By8asZST.js";import{T as O}from"./textarea-DJfrjX2A.js";import{A as Se,a as _e,b as Fe,c as Ie,d as Ue,e as Ee,f as Te,g as Ae}from"./alert-dialog-BzFKdENb.js";import{I as x}from"./input-Cu6Tiemi.js";import{L as d}from"./label-Ch0F7L4t.js";import{S as Be,a as Me,b as Oe,c as He,d as _}from"./select-DECm7gW5.js";import{P as qe}from"./progress-DCO54Zpc.js";import{P as $e}from"./PlanLimits-DheW4c0J.js";import{P as Re}from"./ProFeatureGate-CXf1Td84.js";import{u as Ke}from"./useSubscription-svlizlcK.js";import"./supabase-COHOFxoQ.js";import"./index-DC33WZD-.js";import"./index-DviHZN-M.js";import"./index-CryppvJw.js";import"./index-CSO0Tzy2.js";import"./AuthProvider-BSQZ2YtM.js";import"./PlanFeatureChecklist-BdN1LsxW.js";const Le=({salesPage:l,onEdit:h,onShare:c,onDelete:s,onViewStats:r,onCopy:g})=>{var v;const{t:a,i18n:j}=F("salesPages"),p=new Date(l.updated_at).toLocaleDateString(j.language==="pt-BR"?"pt-BR":"en-US",{year:"numeric",month:"short",day:"numeric"});return e.jsx(ge,{className:"p-4 bg-background border hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"p-3 bg-muted rounded-lg",children:e.jsx(ve,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold",children:l.name}),e.jsx(je,{variant:l.status==="published"?"default":"secondary",children:a(`status.${l.status}`)})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(we,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:[l.views_count||0," ",a("card.views")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ne,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:[l.cta_clicks||0," ",a("card.clicks")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ye,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:[((v=l.blocks)==null?void 0:v.length)||0," ",a("card.blocks")]})]}),e.jsxs("span",{className:"text-xs",children:[a("card.updated"),": ",p]})]})]})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(E,{children:[e.jsx(T,{asChild:!0,children:e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>r(l),children:e.jsx(be,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(A,{children:e.jsx("p",{children:a("tooltips.viewStats")})})]}),e.jsxs(E,{children:[e.jsx(T,{asChild:!0,children:e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>h(l.id),children:e.jsx(le,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(A,{children:e.jsx("p",{children:a("tooltips.editPage")})})]}),e.jsxs(E,{children:[e.jsx(T,{asChild:!0,children:e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>c(l),children:e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(A,{children:e.jsx("p",{children:a("tooltips.sharePage")})})]}),e.jsxs(E,{children:[e.jsx(T,{asChild:!0,children:e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>g(l),children:e.jsx(Pe,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(A,{children:e.jsx("p",{children:a("tooltips.duplicatePage")})})]}),e.jsxs(E,{children:[e.jsx(T,{asChild:!0,children:e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>s(l),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})}),e.jsx(A,{children:e.jsx("p",{children:a("tooltips.deletePage")})})]})]})]})})},Qe=({salesPages:l,isLoading:h,onEdit:c,onShare:s,onDelete:r,onViewStats:g,onCopy:a})=>{const{t:j}=F("salesPages");return h?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(p=>e.jsx(xe,{className:"h-[100px] w-full rounded-lg"},p))}):l!=null&&l.length?e.jsx("div",{className:"space-y-4",children:l.map(p=>e.jsx(Le,{salesPage:p,onEdit:c,onShare:s,onDelete:r,onViewStats:g,onCopy:a}
1,p.id))}):e.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-border rounded-lg",children:[e.jsx("h3",{className:"text-lg font-medium",children:j("noPages")}),e.jsx("p",{className:"text-muted-foreground mt-1",children:j("noPagesSubtext")})]})},Je=({open:l,onOpenChange:h,salesPage:c})=>{const{t:s}=F("salesPages"),{toast:r}=ie(),{data:g}=re({queryKey:["profile"],queryFn:async()=>{const{data:{user:v}}=await y.auth.getUser();if(!v)throw new Error("Not authenticated");const{data:P,error:k}=await y.from("profiles").select("user_code").eq("id",v.id).single();if(k)throw k;return P}}),a=()=>!(g!=null&&g.user_code)||!c.slug?"":`${window.location.origin}/${g.user_code}/sales/${c.slug}`,j=v=>{navigator.clipboard.writeText(v),r({title:s("dialogs.share.copied"),description:s("dialogs.share.copiedDescription")})},p=a();return e.jsx(R,{open:l,onOpenChange:h,children:e.jsxs(K,{className:"sm:max-w-md",children:[e.jsx(L,{children:e.jsx(Q,{children:s("dialogs.share.title")})}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:s("dialogs.share.publicUrl")}),e.jsx(O,{value:p,readOnly:!0,className:"mt-2 cursor-pointer",onClick:()=>j(p),rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("dialogs.share.clickToCopy")})]})})]})})},We=({open:l,onOpenChange:h,onConfirm:c})=>e.jsx(Se,{open:l,onOpenChange:h,children:e.jsxs(_e,{children:[e.jsxs(Fe,{children:[e.jsx(Ie,{children:"Are you sure?"}),e.jsx(Ue,{children:"This action cannot be undone. This will permanently delete the sales page and all its content."})]}),e.jsxs(Ee,{children:[e.jsx(Te,{children:"Cancel"}),e.jsx(Ae,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),Ve=({open:l,onOpenChange:h,salesPage:c})=>{var s;return e.jsx(R,{open:l,onOpenChange:h,children:e.jsxs(K,{className:"sm:max-w-md",children:[e.jsx(L,{children:e.jsx(Q,{children:"Sales Page Statistics"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 border rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Views"}),e.jsx("p",{className:"text-2xl font-bold",children:c.views_count||0})]}),e.jsxs("div",{className:"p-4 border rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Blocks"}),e.jsx("p",{className:"text-2xl font-bold",children:((s=c.blocks)==null?void 0:s.length)||0})]})]}),e.jsxs("div",{className:"p-4 border rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx("p",{className:"text-lg font-medium capitalize",children:c.status})]})]})]})})},Ge=({open:l,onOpenChange:h,onSelectAI:c,onSelectManual:s})=>{const{t:r}=F("salesPages");return e.jsx(R,{open:l,onOpenChange:h,children:e.jsxs(K,{className:"sm:max-w-md overflow-hidden",children:[e.jsxs(L,{children:[e.jsx(Q,{children:r("creationMethod.title")}),e.jsx(fe,{children:r("creationMethod.description")})]}),e.jsxs("div",{className:"grid gap-3 py-4",children:[e.jsx("button",{onClick:c,className:"w-full text-left p-4 rounded-lg border border-border hover:border-primary hover:bg-accent/50 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 flex-shrink-0",children:e.jsx(se,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:r("creationMethod.withAI")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:r("creationMethod.withAIDescription")})]})]})}),e.jsx("button",{onClick:s,className:"w-full text-left p-4 rounded-lg border border-border hover:border-primary hover:bg-accent/50 transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-muted flex-shrink-0",children:e.jsx(le,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:r("creationMethod.manual")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:r("creationMethod.manualDescription")})]})]})})]})]})})}
1,ae={productName:"",shortDescription:"",productType:"course",productImageUrl:"",studentsCount:"",audienceDescription:"",painPoints:["","",""],desires:["","",""],methodName:"",methodDescription:"",methodBenefits:["","",""],deliverables:["","",""],certificateHours:"",originalPrice:"",installmentPrice:"",cashPrice:"",checkoutUrl:"",guaranteeDays:"7",authorName:"",authorBio:"",authorPhotoUrl:""},$=[{id:1,title:"Produto",description:"Informações básicas"},{id:2,title:"Audiência",description:"Para quem é"},{id:3,title:"Dor & Desejo",description:"Problemas e sonhos"},{id:4,title:"Método",description:"Seu diferencial"},{id:5,title:"Entregas",description:"O que está incluso"},{id:6,title:"Preço & Garantia",description:"Valor e segurança"},{id:7,title:"Autor",description:"Quem criou (opcional)"}],Ze=({open:l,onOpenChange:h,onComplete:c})=>{const{t:s}=F("salesPages"),[r,g]=b.useState(1),[a,j]=b.useState(ae),[p,v]=b.useState(!1),[P,k]=b.useState(null),J=r/$.length*100,n=(t,o)=>{j(u=>({...u,[t]:o}))},z=(t,o,u)=>{j(I=>({...I,[t]:I[t].map((U,ee)=>ee===o?u:U)}))},S=t=>{j(o=>({...o,[t]:[...o[t],""]}))},C=(t,o)=>{a[t].length>1&&j(u=>({...u,[t]:u[t].filter((I,U)=>U!==o)}))},W=()=>{switch(r){case 1:return a.productName.trim()!==""&&a.shortDescription.trim()!=="";case 2:return a.audienceDescription.trim()!=="";case 3:return a.painPoints.some(t=>t.trim()!=="")&&a.desires.some(t=>t.trim()!=="");case 4:return a.methodName.trim()!=="";case 5:return a.deliverables.some(t=>t.trim()!=="");case 6:return a.installmentPrice.trim()!==""&&a.checkoutUrl.trim()!=="";case 7:return!0;default:return!1}},H=()=>{r<$.length&&g(r+1)},V=()=>{r>1&&g(r-1)},G=async()=>{v(!0),k(null);try{const t=await fetch("https://roksdtmnlqynbzukdqzm.supabase.co/functions/v1/generate-sales-page",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJva3NkdG1ubHF5bmJ6dWtkcXptIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzU1MTQ0ODIsImV4cCI6MjA1MTA5MDQ4Mn0.O5R3uYFaZxkW4RMWmOyk-Zv2jfcoAUK077fPcbvxjiM"},body:JSON.stringify(a)});if(!t.ok){const u=await t.json();throw new Error(u.error||s("errors.generateError"))}const o=await t.json();c(o.blocks,a.productName),h(!1),j(ae),g(1)}catch(t){console.error("Error generating sales page:",t),k(t instanceof Error?t.message:s("errors.unknownError"))}finally{v(!1)}},Z=t=>s(`wizard.steps.${["product","audience","painDesire","method","deliverables","pricing","author"][t-1]}`),X=t=>s(`wizard.steps.${["product","audience","painDesire","method","deliverables","pricing","author"][t-1]}Desc`),Y=()=>{switch(r){case 1:return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{htmlFor:"productName",children:[s("wizard.fields.productName")," *"]}),e.jsx(x,{id:"productName",placeholder:s("wizard.fields.productNamePlaceholder"),value:a.productName,onChange:t=>n("productName",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{htmlFor:"shortDescription",children:[s("wizard.fields.shortDescription")," *"]}),e.jsx(O,{id:"shortDescription",placeholder:s("wizard.fields.shortDescriptionPlaceholder"),value:a.shortDescription,onChange:t=>n("shortDescription",t.target.value),rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"productType",children:s("wizard.fields.productType")}),e.jsxs(Be,{value:a.productType,onValueChange:t=>n("productType",t),children:[e.jsx(Me,{children:e.jsx(Oe,{})}),e.jsxs(He,{children:[e.jsx(_,{value:"course",children:s("wizard.fields.productTypes.course")}),e.jsx(_,{value:"ebook",children:s("wizard.fields.productTypes.ebook")}),e.jsx(_,{value:"coaching",children:s("wizard.fields.productTypes.coaching")}),e.jsx(_,{value:"software",children:s("wizard.fields.productTypes.software")}),e.jsx(_,{value:"membership",children:s("wizard.fields.productTypes.membership")}),e.jsx(_,{value:"other",children:s("wizard.fields.productTypes.other")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"studentsCount",children:s("wizard.fields.studentsCount")}
1),e.jsx(x,{id:"studentsCount",placeholder:s("wizard.fields.studentsCountPlaceholder"),value:a.studentsCount,onChange:t=>n("studentsCount",t.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("wizard.fields.studentsCountHint")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"productImageUrl",children:s("wizard.fields.productImageUrl")}),e.jsx(x,{id:"productImageUrl",placeholder:"https://...",value:a.productImageUrl,onChange:t=>n("productImageUrl",t.target.value)})]})]});case 2:return e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{htmlFor:"audienceDescription",children:[s("wizard.fields.audienceDescription")," *"]}),e.jsx(O,{id:"audienceDescription",placeholder:s("wizard.fields.audienceDescriptionPlaceholder"),value:a.audienceDescription,onChange:t=>n("audienceDescription",t.target.value),rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("wizard.fields.audienceDescriptionHint")})]})});case 3:return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{children:[s("wizard.fields.painPoints")," *"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("wizard.fields.painPointsHint")}),a.painPoints.map((t,o)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{placeholder:s("wizard.fields.painPlaceholder",{index:o+1}),value:t,onChange:u=>z("painPoints",o,u.target.value)}),a.painPoints.length>1&&e.jsx(m,{type:"button",variant:"ghost",size:"icon",onClick:()=>C("painPoints",o),children:e.jsx(B,{className:"h-4 w-4"})})]},o)),a.painPoints.length<6&&e.jsxs(m,{type:"button",variant:"outline",size:"sm",onClick:()=>S("painPoints"),children:[e.jsx(M,{className:"h-4 w-4 mr-1"})," ",s("wizard.fields.addPain")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{children:[s("wizard.fields.desires")," *"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("wizard.fields.desiresHint")}),a.desires.map((t,o)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{placeholder:s("wizard.fields.desirePlaceholder",{index:o+1}),value:t,onChange:u=>z("desires",o,u.target.value)}),a.desires.length>1&&e.jsx(m,{type:"button",variant:"ghost",size:"icon",onClick:()=>C("desires",o),children:e.jsx(B,{className:"h-4 w-4"})})]},o)),a.desires.length<6&&e.jsxs(m,{type:"button",variant:"outline",size:"sm",onClick:()=>S("desires"),children:[e.jsx(M,{className:"h-4 w-4 mr-1"})," ",s("wizard.fields.addDesire")]})]})]});case 4:return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{htmlFor:"methodName",children:[s("wizard.fields.methodName")," *"]}),e.jsx(x,{id:"methodName",placeholder:s("wizard.fields.methodNamePlaceholder"),value:a.methodName,onChange:t=>n("methodName",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"methodDescription",children:s("wizard.fields.methodDescription")}),e.jsx(O,{id:"methodDescription",placeholder:s("wizard.fields.methodDescriptionPlaceholder"),value:a.methodDescription,onChange:t=>n("methodDescription",t.target.value),rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:s("wizard.fields.methodResults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("wizard.fields.methodResultsHint")}),a.methodBenefits.map((t,o)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{placeholder:s("wizard.fields.resultPlaceholder",{index:o+1}),value:t,onChange:u=>z("methodBenefits",o,u.target.value)}),a.methodBenefits.length>1&&e.jsx(m,{type:"button",variant:"ghost",size:"icon",onClick:()=>C("methodBenefits",o),children:e.jsx(B,{className:"h-4 w-4"})})]},o)),a.methodBenefits.length<6&&e.jsxs(m,{type:"button",variant:"outline",size:"sm",onClick:()=>S("methodBenefits"),children:[e.jsx(M,{className:"h-4 w-4 mr-1"})," ",s("wizard.fields.addResult")]})]})]});case 5:return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{children:[s("wizard.fields.whatsIncluded")," *"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("wizard.fields.whatsIncludedHint")}),a.deliverables.map((t,o)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{placeholder:s("wizard.fields.deliveryPlaceholder",{index:o+1}),value:t,onChange:u=>z("deliverables",o,u.target.value)}),a.deliverables.length>1&&e.jsx(m,{type:"button",variant:"ghost",size:"icon",onClick:()=>C("deliverables",o),children:e.jsx(B,{className:"h-4 w-4"})})]},o)),a.deliverables.length<10&&e.jsxs(m,{type:"button",variant:"outline",size:"sm",onClick:()=>S("deliverables"),children:[e.jsx(M,{className:"h-4 w-4 mr-1"})," ",s("wizard.fields.addDelivery")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"certificateHours",children:s("wizard.fields.certificateHours")}),e.jsx(x,{id:"certificateHours",placeholder:s("wizard.fields.certificateHoursPlaceholder"),value:a.certificateHours,onChange:t=>n("certificateHours",t.target.value)})]})]});case 6:return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"originalPrice",children:s("wizard.fields.originalPrice")}),e.jsx(x,{id:"originalPrice",placeholder:s("wizard.fields.originalPricePlaceholder"),value:a.originalPrice,onChange:t=>n("originalPrice",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{htmlFor:"installmentPrice",children:[s("wizard.fields.installmentPrice")," *"]}),e.jsx(x,{id:"installmentPrice",placeholder:s("wizard.fields.installmentPricePlaceholder"),value:a.installmentPrice,onChange:t=>n("installmentPrice",t.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"cashPrice",children:s("wizard.fields.cashPrice")}),e.jsx(x,{id:"cashPrice",placeholder:s("wizard.fields.cashPricePlaceholder"),value:a.cashPrice,onChange:t=>n("cashPrice",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(d,{htmlFor:"checkoutUrl",children:[s("wizard.fields.checkoutUrl")," *"]}),e.jsx(x,{id:"checkoutUrl",placeholder:s("wizard.fields.checkoutUrlPlaceholder"),value:a.checkoutUrl,onChange:t=>n("checkoutUrl",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"guaranteeDays",children:s("wizard.fields.guaranteeDays")}),e.jsx(x,{id:"guaranteeDays",placeholder:s("wizard.fields.guaranteeDaysPlaceholder"),value:a.guaranteeDays,onChange:t=>n("guaranteeDays",t.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("wizard.fields.guaranteeDaysHint")})]})]});case 7:return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s("wizard.fields.authorInfoOptional")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"authorName",children:s("wizard.fields.authorName")}
1),e.jsx(x,{id:"authorName",placeholder:s("wizard.fields.authorNamePlaceholder"),value:a.authorName,onChange:t=>n("authorName",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"authorBio",children:s("wizard.fields.authorBio")}),e.jsx(O,{id:"authorBio",placeholder:s("wizard.fields.authorBioPlaceholder"),value:a.authorBio,onChange:t=>n("authorBio",t.target.value),rows:4})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"authorPhotoUrl",children:s("wizard.fields.authorPhotoUrl")}),e.jsx(x,{id:"authorPhotoUrl",placeholder:"https://...",value:a.authorPhotoUrl,onChange:t=>n("authorPhotoUrl",t.target.value)})]})]});default:return null}};return e.jsx(R,{open:l,onOpenChange:h,children:e.jsxs(K,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(L,{children:e.jsxs(Q,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-5 w-5 text-primary"}),s("wizard.title")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"font-medium",children:Z(r)}),e.jsx("span",{className:"text-muted-foreground",children:s("wizard.stepOf",{current:r,total:$.length})})]}),e.jsx(qe,{value:J,className:"h-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:X(r)})]}),Y(),P&&e.jsx("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-sm text-destructive",children:P}),e.jsxs("div",{className:"flex justify-between pt-4 border-t",children:[e.jsxs(m,{type:"button",variant:"outline",onClick:V,disabled:r===1||p,children:[e.jsx(ze,{className:"h-4 w-4 mr-1"}),s("wizard.back")]}),r<$.length?e.jsxs(m,{type:"button",onClick:H,disabled:!W(),children:[s("wizard.next"),e.jsx(De,{className:"h-4 w-4 ml-1"})]}):e.jsx(m,{type:"button",onClick:G,disabled:p,children:p?e.jsxs(e.Fragment,{children:[e.jsx(ke,{className:"h-4 w-4 mr-2 animate-spin"}),s("wizard.generating")]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"h-4 w-4 mr-2"}),s("wizard.generate")]})})]})]})]})})},Ps=()=>{const{toast:l}=ie(),h=pe(),c=me(),{data:s}=Ke(),{t:r}=F("salesPages"),[g,a]=b.useState(!1),[j,p]=b.useState(!1),[v,P]=b.useState(!1),[k,J]=b.useState(!1),[n,z]=b.useState(null),[S,C]=b.useState(!1),[W,H]=b.useState(!1),{data:V,isLoading:G}=re({queryKey:["sales-pages"],queryFn:async()=>{const{data:{user:i}}=await y.auth.getUser();if(!i)throw new Error("Not authenticated");const{data:f,error:w}=await y.from("sales_pages").select("*").eq("user_id",i.id).order("created_at",{ascending:!1});if(w)throw w;return f.map(N=>({...N,blocks:N.blocks||[],theme:N.theme||{primaryColor:"#7E69AB",secondaryColor:"#9b87f5",fontFamily:"Inter",backgroundColor:"#ffffff"},custom_scripts:N.custom_scripts||{head:"",body:""},footer_links:N.footer_links||[]}))}}),Z=q({mutationFn:async()=>{const{data:{user:i}}=await y.auth.getUser();if(!i)throw new Error("Not authenticated");const f={user_id:i.id,name:"New Sales Page",description:"",status:"draft",blocks:[],theme:{primaryColor:"#7E69AB",secondaryColor:"#9b87f5",fontFamily:"Inter",backgroundColor:"#ffffff"}},{data:w,error:N}=await y.from("sales_pages").insert(f).select().single();if(N)throw N;return{...w,blocks:w.blocks||[],theme:w.theme||f.theme,custom_scripts:w.custom_scripts||{head:"",body:""},footer_links:w.footer_links||[]}},onSuccess:i=>{c.invalidateQueries({queryKey:["sales-pages"]}),l({title:r("toasts.createSuccess"),description:r("toasts.createSuccess")}),h(`/sales-pages/${i.id}`)},onError:()=>{l({title:r("toasts.createError"),description:r("toasts.createError"),variant:"destructive"})},onSettled:()=>{a(!1)}}),X=q({mutationFn:async i=>{const{error:f}=await y.from("sales_pages").delete().eq("id",i);if(f)throw f},onSuccess:()=>{c.invalidateQueries({queryKey:["sales-pages"]}),l({title:r("toasts.deleteSuccess"),description:r("toasts.deleteSuccess")}),P(!1),z(null)},onError:()=>{l({title:r("toasts.deleteError"),description:r("toasts.deleteError"),variant:"destructive"})}}),Y=q({mutationFn:async i=>{const{data:{user:f}}=await y.auth.getUser();if(!f)throw new Error("Not authenticated");const w={user_id:f.id,name:`${i.name} (Copy)`,description:i.description,status:"draft",blocks:i.blocks,theme:i.theme,custom_scripts:i.custom_scripts,footer_links:i.footer_links,facebook_pixel_id:i.facebook_pixel_id,google_analytics_id:i.google_analytics_id,google_tag_manager_id:i.google_tag_manager_id,utm_tracking:i.utm_tracking,utm_parameter_name:i.utm_parameter_name,utm_tracked_params:i.utm_tracked_params,utm_separator:i.utm_separator,utm_params_order:i.utm_params_order,views_count:0,cta_clicks:0},{data:N,error:D}=await y.from("sales_pages").insert(w).select().single();if(D)throw D;return{newPage:N,originalName:i.name}},onSuccess:({originalName:i})=>{c.invalidateQueries({queryKey:["sales-pages"]}),l({title:r("toasts.copySuccess"),description:r("toasts.copyDescription",{original:i,copy:`${i} (Copy)`})})},onError:()=>{l({title:r("toasts.createError"),description:r("toasts.createError"),variant:"destructive"})}}),t=q({mutationFn:async({blocks:i,pageName:f})=>{const{data:{user:w}}=await y.auth.getUser();if(!w)throw new Error("Not authenticated");const N={user_id:w.id,name:f,description:"",status:"draft",blocks:i,theme:{primaryColor:"#7E69AB",secondaryColor:"#9b87f5",fontFamily:"Inter",backgroundColor:"#ffffff"}},{data:D,error:te}=await y.from("sales_pages").insert(N).select().single();if(te)throw te;return{...D,blocks:D.blocks||[],theme:D.theme||N.theme,custom_scripts:D.custom_scripts||{head:"",body:""},footer_links:D.footer_links||[]}},onSuccess:i=>{c.invalidateQueries({queryKey:["sales-pages"]}),l({title:r("toasts.aiCreateSuccess"),description:r("toasts.aiCreateDescription")}),h(`/sales-pages/${i.id}`)},onError:()=>{l({title:r("toasts.aiCreateError"),description:r("toasts.aiCreateError"),variant:"destructive"})}}),o=()=>s!=null&&s.canUseProFeature?!0:(l({title:r("errors.trialExpiredTitle"),description:r("errors.trialExpiredDescription"),variant:"destructive"}),!1),u=()=>{o()&&C(!0)},I=()=>{C(!1),a(!0),Z.mutate()},U=()=>{C(!1),H(!0)},ee=(i,f)=>{t.mutate({blocks:i,pageName:f})},oe=i=>{h(`/sales-pages/${i}`)},ne=i=>{z(i),p(!0)},ce=i=>{z(i),P(!0)},de=i=>{h(`/sales-pages/${i.id}/statistics`)},he=i=>{o()&&Y.mutate(i)},ue=()=>{n&&X.mutate(n.id)};return(s==null?void 0:s.canUseProFeature)??!1?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"container mx-auto py-8 px-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:r("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:r("subtitle")})]}),e.jsxs(m,{onClick:u,disabled:g,children:[e.jsx(M,{className:"mr-2 h-4 w-4"}),r("newPage")]})]}),e.jsx($e,{module:"sales-pages"}),e.jsx(Qe,{salesPages:V||[],isLoading:G,onEdit:oe,onShare:ne,onDelete:ce,onViewStats:de,onCopy:he}),e.jsx(Ge,{open:S,onOpenChange:C,onSelectAI:U,onSelectManual:I}),e.jsx(Ze,{open:W,onOpenChange:H,onComplete:ee}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Je,{open:j,onOpenChange:p,salesPage:n}),e.jsx(We,{open:v,onOpenChange:P,onConfirm:ue}),e.jsx(Ve,{open:k,onOpenChange:J,salesPage:n})]})]})}):e.jsxs("div",{className:"container mx-auto py-8 px-4 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:r("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:r("subtitle")})]}),e.jsx(Re,{title:"Sales Pages é um recurso PRO",description:"Seu test drive acabou. Ative a assinatura para criar páginas de vendas ilimitadas com IA e analytics."})]})};export{Ps 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.