PageSourceSearch

https://klasoo.com/assets/PlanSelector-D9xn30vY.js

js klasoo.com collected 2026-09-30 06:30:26 UTC 14,060 bytes, 1 lines download raw bytes

1import{r as d,j as e}from"./vendor-react-BtGqQFvK.js";import{c as J}from"./clipboard-LYCV8Njj.js";import{s as P,k as O,B as _,L as Y,e as X,D as Z,E as ee,H as te,I as z,J as re,N as se,S,o as I,O as ae,Q as oe}from"./app-shell-CMj3qzLx.js";import{l as le,E as ne,a as ie}from"./vendor-stripe-1dy5k6hI.js";import{u as M}from"./vendor-i18n-Duo0qcql.js";import{m as ce}from"./vendor-motion-D4fhTsRL.js";const $="pk_live_51TbkEM9rvQ0j5trmE5ltaYeuSbMEj6cgNp5EguHrz9Qffh9qya7geaKcLWBSObAID6df4vvRamjXD3qUO2vVHsrp00Sbueh4vz";class B extends Error{constructor(){super("Stripe no está configurado correctamente para esta versión publicada. Completa la configuración de pagos en live antes de cobrar."),this.name="StripeConfigurationError"}}function F(){if($?.startsWith("pk_test_"))return"sandbox";if($?.startsWith("pk_live_"))return"live";throw new B}let C=null;class H extends Error{constructor(){super("No se pudo cargar Stripe.js. Suele deberse a un bloqueador de anuncios o a una extensión del navegador. Desactívalo para este sitio y reintenta."),this.name="StripeLoadError"}}function de(){if(!C){try{F()}catch(i){return Promise.reject(i)}C=le($).catch(i=>{throw C=null,new H})}return C}function ue(){return F()}function me(){if(typeof window>"u")return null;const l=[...navigator.languages||[],navigator.language,Intl.DateTimeFormat().resolvedOptions().locale].filter(Boolean);for(const x of l){const a=String(x).match(/(?:-|_)([a-z]{2})$/i);if(a)return a[1].toUpperCase()}const i=Intl.DateTimeFormat().resolvedOptions().timeZone;return i==="Europe/Madrid"||i==="Atlantic/Canary"?"ES":null}function xe({planName:l,billingPeriod:i,returnUrl:x,onError:a}){const{t:s}=M(),[r,j]=d.useState(0),[c,p]=d.useState(null),[E,A]=d.useState(!1),b=d.useMemo(()=>(A(!1),p(null),de().catch(n=>(n instanceof H?(A(!0),a?.(n.message)):n instanceof B&&(p(n.message),a?.(n.message)),null))),[r]);d.useEffect(()=>{p(null)},[l,i,r]);const g=d.useCallback(async()=>{const{data:n}=await P.auth.getSession();let y=n?.session??null;if(y?.access_token||(y=(await P.auth.refreshSession()).data.session??null),!y?.access_token){const o=s("saasCheckout.sessionExpired");throw p(o),a?.(o),new Error(o)}const D=x??`${window.location.origin}/dashboard/cuenta?subscription=success&session_id={CHECKOUT_SESSION_ID}`,{data:f,error:N}=await P.functions.invoke("create-subscription-checkout",{headers:{Authorization:`Bearer ${y.access_token}`},body:{planName:l,billingPeriod:i,customerCountryHint:me(),environment:ue(),returnUrl:D,mode:"embedded"}});if(N){let o=N.message||s("saasCheckout.couldNotStart");try{const v=N.context;if(v?.json){const k=await v.clone().json().catch(()=>null);k?.error&&(o=k.error)}}catch{}throw p(o),a?.(o),new Error(o)}if(!f?.clientSecret){const o=f?.error||s("saasCheckout.noClientSecret");throw p(o),a?.(o),new Error(o)}return f.clientSecret},[l,i,x,a,r,s]),L=`${l}-${i}-${r}`;return E?e.jsxs("div",{className:"rounded-2xl border border-amber-500/40 bg-amber-500/5 p-6 min-h-[260px] flex flex-col items-center justify-center text-center gap-4",children:[e.jsx(O,{className:"h-10 w-10 text-amber-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-foreground mb-1",children:s("saasCheckout.stripeBlockedTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:s("saasCheckout.stripeBlockedDesc")})]}),e.jsx(_,{onClick:()=>j(n=>n+1),variant:"default",size:"sm",children:s("saasCheckout.retry")})]}):c?e.jsxs("div",{className:"rounded-2xl border border-destructive/40 bg-destructive/5 p-6 min-h-[260px] flex flex-col items-center justify-center text-center gap-4",children:[e.jsx(O,{className:"h-10 w-10 text-destructive"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-foreground mb-1",children:s("saasCheckout.couldNotStart")}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:c})]}),e.jsx(_,{onClick:()=>j(n=>n+1),variant:"default",size:"sm",children:s("saasCheckout.retry")})]}):e.jsx("div",{id:"checkout",className:"min-h-[520px]",children:e.jsx(ne,{stripe:b,options:{fetchClientSecret:g},children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none -z-10",children:e.jsx(Y,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),e.jsx(ie,{})]})},L)})}const pe=[{slug:"starter",monthlyPrice:29,yearlyPrice:23,popular:!1,highlightAi:[!0,!1,
1!1,!0,!1,!1,!1],featureGroups:[{key:"createWithAi",ai:!0},{key:"whatYouSell"},{key:"howYouSell"},{key:"yourPlatform"}]},{slug:"growth",monthlyPrice:79,yearlyPrice:63,popular:!0,highlightAi:[!0,!1,!1,!1,!0,!1,!1,!1,!1],featureGroups:[{key:"createWithAi",ai:!0},{key:"whatYouSell"},{key:"howYouSell"},{key:"yourPlatform"}]},{slug:"pro",monthlyPrice:149,yearlyPrice:119,popular:!1,highlightAi:[!0,!1,!1,!1,!0,!1,!1,!1,!1,!1,!1],featureGroups:[{key:"createWithAi",ai:!0},{key:"whatYouSell"},{key:"howYouSell"},{key:"yourPlatform"}]},{slug:"enterprise",monthlyPrice:199,yearlyPrice:159,popular:!1,highlightAi:[!0,!1,!1,!0,!1,!1,!1,!1,!1,!1,!1,!1],featureGroups:[{key:"createWithAi",ai:!0},{key:"whatYouSell"},{key:"howYouSell"},{key:"yourPlatform"}]}],he=({open:l,onOpenChange:i,initialPlan:x,initialBilling:a})=>{const{t:s}=M(),r=(t,u)=>s(`planSelector.${t}`,{defaultValue:u??""}),j=t=>{const u=s(`planSelector.${t}`,{returnObjects:!0});return Array.isArray(u)?u:[]},[c,p]=d.useState(a?a==="yearly":!0),[E,A]=d.useState(null),[b,g]=d.useState(x??null),[L,n]=d.useState([]),[y,D]=d.useState(!0),{planName:f,isTrial:N}=X(),o=N?s("planSelector.header.trialLabel",{defaultValue:"Prueba gratuita"}):f?r(`plans.${f.toLowerCase()}.name`)||f:s("planSelector.header.noPlanLabel",{defaultValue:"Sin plan activo"});d.useEffect(()=>{l&&(v(),g(x||null),a&&p(a==="yearly"))},[l,x,a]);const v=async()=>{const{data:t,error:u}=await P.from("plan_limits").select("id, plan_name, display_name, sort_order, monthly_price_cents, yearly_price_cents, features, is_active").eq("is_active",!0).order("sort_order",{ascending:!0});!u&&t&&n(t.filter(m=>m.monthly_price_cents>0)),D(!1)},k=t=>{g(t)},V=t=>L.find(m=>m.plan_name.toLowerCase()===t.slug||m.display_name.toLowerCase()===t.slug)?.plan_name||t.slug;return e.jsx(Z,{open:l,onOpenChange:i,children:e.jsx(ee,{className:"max-w-[90vw] lg:max-w-6xl max-h-[92vh] overflow-y-auto p-0 notranslate",translate:"no",children:b?e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>g(null),children:[e.jsx(te,{className:"h-4 w-4 mr-1"})," ",r("header.backToPlans")]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[r("header.planLabel")," ",e.jsx("span",{className:"font-semibold text-foreground capitalize",children:b})," · ",r(c?"header.billingYearly":"header.billingMonthly")]})]}),e.jsx(xe,{planName:b,billingPeriod:c?"yearly":"monthly",onError:t=>z({title:r("header.paymentNotStarted"),description:t,variant:"destructive"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-6 pt-6 pb-4 border-b",children:[e.jsxs(re,{children:[e.jsx(se,{className:"text-2xl font-extrabold text-center tracking-tight",children:r("header.title")}),e.jsx("p",{className:"text-center text-primary text-sm font-medium mt-1",children:r("header.subtitle")}),e.jsx("div",{className:"flex justify-center mt-3",children:e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border bg-muted/50 px-4 py-1.5 text-[13px] font-semibold text-foreground",children:[s("planSelector.header.yourPlanLabel",{defaultValue:"Tu plan actual"}),":",e.jsx("span",{className:"text-primary",children:o})]})})]}),e.jsxs("div",{className:"flex items-center justify-center gap-4 mt-4",children:[e.jsx("span",{className:`text-[13px] font-medium transition-colors ${c?"text-muted-foreground":"text-foreground"}`,children:r("header.monthly")}),e.jsx("button",{onClick:()=>p(!c),className:`relative w-12 h-6 rounded-full transition-all duration-300 ${c?"bg-primary":"bg-muted-foreground/30"}`,children:e.jsx(ce.div,{className:"absolute top-0.5 left-0.5 w-5 h-5 bg-card rounded-full shadow-sm",animate:{x:c?24:0},transition:{type:"spring",stiffness:500,damping:30}})}),e.jsxs("span",{className:`text-[13px] font-medium transition-colors ${c?"text-foreground":"text-muted-foreground"}`,children:[r("header.yearly"),c&&e.jsx("span",{className:"ml-2 text-[11px] font-bold text-primary",children:r("header.yearlyDiscount")})]})]})]}),e.jsx("div",{className:"p-6",children:y?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(Y,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4",children:pe.map(t=>{const u=V(t),m=f?.toLowerCase()===t.slug,W=E===u,G=c?t.yearlyPrice:t.monthlyPrice,R=r(`plans.${t.slug}.name`),q=r(`plans.${t.slug}.description`),K=j(`plans.${t.slug}.highlights`);return e.jsxs("div",{className:`relative rounded-2xl h-full flex flex-col transition-all duration-300 ${t.popular?"bg-[hsl(var(--foreground))] text-primary-foreground ring-1 ring-white/10 shadow-xl scale-[1.02]":"bg-card border border-border/60 shadow-sm hover:shadow-md"} ${m?"ring-2 ring-primary":""}`,children:[m&&e.jsx("div",{className:"absolute -top-3 right-3",children:e.jsx("span",{className:"px-3 py-1.5 rounded-full bg-primary text-primary-foreground text-[10px] font-bold uppercase tracking-wider shadow-lg",children:s("planSelector.header.yourPlanBadge",{defaultValue:"Tu plan"})})}),t.popular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsx("span",{className:"px-4 py-1.5 rounded-full bg-primary text-primary-foreground text-[10px] font-bold uppercase tracking-wider shadow-lg",children:r("header.popular")})}),e.jsxs("div",{className:"p-6 flex flex-col flex-1",children:[e.jsx("h3",{className:`text-xl font-extrabold ${t.popular?"text-primary-foreground":"text-foreground"}`,children:R}),e.jsx("p",{className:`mt-1 text-[13px] ${t.popular?"text-primary-foreground
1/60":"text-muted-foreground"}`,children:q}),e.jsxs("div",{className:"mt-4 flex items-baseline gap-1",children:[e.jsxs("span",{className:`text-4xl font-extrabold tracking-tighter ${t.popular?"text-primary-foreground":"text-foreground"}`,children:["€",G]}),e.jsx("span",{className:`text-[13px] ${t.popular?"text-primary-foreground/40":"text-muted-foreground"}`,children:r("header.perMonth")})]}),e.jsx("div",{className:"mt-4 space-y-2",children:K.map((h,w)=>{const T=t.highlightAi[w]===!0;return e.jsxs("div",{className:"flex items-start gap-2",children:[T?e.jsx(S,{className:"w-4 h-4 mt-0.5 shrink-0 text-primary",strokeWidth:2.5}):e.jsx(I,{className:`w-4 h-4 mt-0.5 shrink-0 ${t.popular,"text-primary"}`,strokeWidth:2.5}),e.jsxs("span",{className:`text-[13px] font-semibold leading-snug ${t.popular?"text-primary-foreground/90":"text-foreground"}`,children:[h.text,h.tooltip&&e.jsxs("span",{className:"relative group inline-block ml-1",children:[e.jsx(ae,{className:`w-3.5 h-3.5 inline-block cursor-help ${t.popular?"text-primary-foreground/40":"text-muted-foreground"}`}),e.jsx("span",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-1.5 px-2.5 py-1.5 rounded-lg text-[11px] font-normal text-primary-foreground bg-foreground shadow-lg whitespace-normal max-w-[260px] shadow-lg opacity-0 pointer-events-none group-hover:opacity-100 transition-opacity z-10",children:h.tooltip})]})]})]},w)})}),e.jsx(_,{onClick:()=>k(u),disabled:m||W,className:`w-full mt-5 rounded-xl py-5 text-sm font-semibold transition-all ${t.popular?"bg-card text-foreground hover:bg-card/90 shadow-md":""}`,variant:t.popular?"ghost":m?"outline":"default",children:W?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"h-4 w-4 animate-spin mr-2"})," ",r("header.processing")]}):m?r("header.currentPlan"):e.jsxs(e.Fragment,{children:[r("header.start"),e.jsx(oe,{className:"ml-2 w-4 h-4"})]})}),e.jsx("div",{className:`my-4 h-px ${t.popular?"bg-card/10":"bg-border"}`}),e.jsx("div",{className:"flex-1 space-y-3",children:t.featureGroups.map(h=>{const w=j(`plans.${t.slug}.features.${h.key}`),T=r(`cats.${h.key}`);return e.jsxs("div",{children:[e.jsxs("p",{className:`text-[11px] font-bold uppercase tracking-wider mb-1.5 flex items-center gap-1.5 ${h.ai?"text-primary":t.popular?"text-primary-foreground/40":"text-muted-foreground"}`,children:[h.ai&&e.jsx(S,{className:"w-3 h-3",strokeWidth:2.5}),T]}),e.jsx("div",{className:"space-y-1.5",children:w.map((U,Q)=>e.jsxs("div",{className:"flex items-start gap-2 text-[12.5px] leading-snug",children:[e.jsx(I,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-primary",strokeWidth:2.5}),e.jsx("span",{className:t.popular?"text-primary-foreground/70":"text-muted-foreground",children:U})]},Q))})]},h.key)})})]})]},t.slug)})}),e.jsx("p",{className:"mt-4 text-center text-sm font-medium text-foreground",children:r("header.vat")}),e.jsx("div",{className:"mt-5 flex justify-center",children:e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-4 py-2 text-[13px] font-semibold text-primary",children:[e.jsx(S,{className:"h-4 w-4"}),r("header.setupNote")]})}),e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-5",children:[e.jsx(S,{className:"w-4 h-4 text-accent-purple"}),e.jsx("p",{className:"text-[13px] text-muted-foreground",children:r("header.aiCreditsNote")})]}),e.jsxs("p",{className:"text-center mt-3 text-[13px] text-muted-foreground",children:[r("header.needCustom")," ",e.jsx("button",{type:"button",onClick:async()=>{try{await J("[email protected]"),z({title:r("header.contactCopied","Email copiado"),description:"[email protected]"})}catch{z({title:"[email protected]"})}window.open("mailto:[email protected]?subject=Plan%20a%20medida%20Klasoo","_blank","noopener")},className:"text-primary font-medium hover:underline",children:r("header.contactUs")})]})]})})]})})})},ve=Object.freeze(Object.defineProperty({__proto__:null,PlanSelector:he},Symbol.toStringTag,{value:"Module"}));export{he as P,ve as a,ue as g};

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.