Files
adnexus/assets/Payment-f6wAWjU2.js
2026-09-20 08:53:09 -07:00

2 lines
16 KiB
JavaScript

import{r as v,j as e}from"./ui-SA1K2VdO.js";import{B as L,F as M}from"./index-BBRaFEzF.js";import{I as m}from"./input-jTrHrzjY.js";import{L as o}from"./label-CXIJoLRr.js";import{S as P,a as A,b as U,c as F,d as p}from"./select-CLfuir-h.js";import{u as $,L as W}from"./vendor-khT4bKqW.js";import{h as O,z as G,ae as k,x as J}from"./utils-BOogt4zp.js";function C(l){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(r){return typeof r}:C=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},C(l)}var I="clover",K=function(r){return r===3?"v3":r},R="https://js.stripe.com",X="".concat(R,"/").concat(I,"/stripe.js"),Y=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Z=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var H=function(r){return Y.test(r)||Z.test(r)},Q=function(){for(var r=document.querySelectorAll('script[src^="'.concat(R,'"]')),s=0;s<r.length;s++){var n=r[s];if(H(n.src))return n}return null},D=function(r){var s="",n=document.createElement("script");n.src="".concat(X).concat(s);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n},ee=function(r,s){!r||!r._registerWrapper||r._registerWrapper({name:"stripe-js",version:"8.11.0",startTime:s})},f=null,w=null,S=null,re=function(r){return function(s){r(new Error("Failed to load Stripe.js",{cause:s}))}},te=function(r,s){return function(){window.Stripe?r(window.Stripe):s(new Error("Stripe.js not available"))}},se=function(r){return f!==null?f:(f=new Promise(function(s,n){if(typeof window>"u"||typeof document>"u"){s(null);return}if(window.Stripe){s(window.Stripe);return}try{var i=Q();if(!(i&&r)){if(!i)i=D(r);else if(i&&S!==null&&w!==null){var d;i.removeEventListener("load",S),i.removeEventListener("error",w),(d=i.parentNode)===null||d===void 0||d.removeChild(i),i=D(r)}}S=te(s,n),w=re(n),i.addEventListener("load",S),i.addEventListener("error",w)}catch(u){n(u);return}}),f.catch(function(s){return f=null,Promise.reject(s)}))},ae=function(r,s,n){if(r===null)return null;var i=s[0];if(typeof i!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(C(i)," instead."));var d=i.match(/^pk_test/),u=K(r.version),g=I;d&&u!==g&&console.warn("Stripe.js@".concat(u," was loaded on the page, but @stripe/stripe-js@").concat("8.11.0"," expected Stripe.js@").concat(g,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var b=r.apply(void 0,s);return ee(b,n),b},j,T=!1,_=function(){return j||(j=se(null).catch(function(r){return j=null,Promise.reject(r)}),j)};Promise.resolve().then(function(){return _()}).catch(function(l){T||console.warn(l)});var ie=function(){for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];T=!0;var i=Date.now();return _().then(function(d){return ae(d,s,i)})};const ne=ie("pk_test_placeholder"),ye=()=>{const[l,r]=v.useState(!1),[s,n]=v.useState(""),[i,d]=v.useState(!1),[u,g]=v.useState(0),b=$(),x=new URLSearchParams(b.search).get("plan")||"agency",[a,c]=v.useState({email:"",cardNumber:"",expiry:"",cvc:"",name:"",country:"United States",firstName:"",lastName:"",address:"",city:"",state:"",zip:"",emailUpdates:!1});v.useEffect(()=>(document.body.classList.add("dark"),()=>{document.body.classList.remove("dark")}),[]);const q=async t=>{t.preventDefault(),r(!0);try{const y=await ne;if(!y)throw new Error("Stripe failed to load");let N="";x==="enterprise"?N="price_placeholder_enterprise":x==="instant-site"?N="price_placeholder_instant_site":N="price_placeholder_agency";const B=await(await fetch("/.netlify/functions/create-checkout-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({priceId:N,email:a.email,plan:x,successUrl:`${window.location.origin}/agency/onboarding-success`,cancelUrl:window.location.href})})).json(),E=await y.redirectToCheckout({sessionId:B.id});E.error&&(console.error(E.error.message),alert("Payment failed. Please try again."),r(!1))}catch(y){console.error("Payment error:",y),alert("An error occurred. Please try again."),r(!1)}},h=x==="instant-site"?{name:"Instant Site",price:500,description:"3-page website in 24 hours",features:["Custom-built 3-page website","Up to 10 premium images","24-hour turnaround","1 design revision","Lifetime ownership"]}:x==="enterprise"?{name:"Enterprise Plan",price:9999,description:"$9,999/month billed monthly",features:["Access to all creative services with unlimited revisions","Dedicated creative team for your projects","AI-powered creative solutions and optimization","Priority support and fast turnaround times","Regular strategy meetings and performance reports","Complete asset ownership and source files"]}:{name:"Agency Service",price:5e3,description:"Full-service creative agency",features:["Dedicated Creative Director","Dedicated Project Manager","120 hours per month","Unlimited revisions","Full copyright ownership"]},V=()=>{if(s.toUpperCase()==="SAVE20"){const t=h.price*.2;g(t),d(!0)}else if(s.toUpperCase()==="LAUNCH50"){const t=h.price*.5;g(t),d(!0)}else d(!1),g(0)},z=h.price-u;return e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"pt-32 pb-20 bg-black text-white min-h-screen",children:e.jsx("div",{className:"container-custom max-w-7xl",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12",children:[e.jsx("div",{className:"order-2 lg:order-1",children:e.jsxs("form",{onSubmit:q,className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Contact"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"email",className:"sr-only",children:"Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(m,{id:"email",type:"email",placeholder:"Email",required:!0,value:a.email,onChange:t=>c({...a,email:t.target.value}),className:"bg-gray-900/50 border-gray-800 text-white pl-4 pr-10 py-3 rounded-lg"}),e.jsx(O,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"emailUpdates",checked:a.emailUpdates,onChange:t=>c({...a,emailUpdates:t.target.checked}),className:"rounded border-gray-700 bg-gray-900/50 text-white focus:ring-white"}),e.jsx(o,{htmlFor:"emailUpdates",className:"text-sm text-gray-400 cursor-pointer",children:"Email me with news and offers"})]})]}),e.jsx("div",{className:"mt-4 text-right",children:e.jsx(W,{to:"/login",className:"text-white hover:text-gray-300 text-sm",children:"Log in"})})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Payment"}),e.jsx("p",{className:"text-sm text-gray-400 mb-6",children:"All transactions are secure and encrypted."}),e.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 rounded-lg",children:[e.jsxs("div",{className:"p-4 border-b border-gray-800 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{className:"h-5 w-5 text-gray-400"}),e.jsx("span",{className:"font-medium",children:"Credit card"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("img",{src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 15'%3E%3Crect width='24' height='15' rx='2' fill='%23fff'/%3E%3Ctext x='12' y='10' text-anchor='middle' font-size='8' fill='%23000'%3EVISA%3C/text%3E%3C/svg%3E",alt:"Visa",className:"h-5"}),e.jsx("img",{src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 15'%3E%3Crect width='24' height='15' rx='2' fill='%23eb001b'/%3E%3Ccircle cx='8' cy='7.5' r='5' fill='%23ff5f00'/%3E%3Ccircle cx='16' cy='7.5' r='5' fill='%23f79e1b'/%3E%3C/svg%3E",alt:"Mastercard",className:"h-5"}),e.jsx("img",{src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 15'%3E%3Crect width='24' height='15' rx='2' fill='%23016fd0'/%3E%3Ctext x='12' y='10' text-anchor='middle' font-size='6' fill='%23fff'%3EAMEX%3C/text%3E%3C/svg%3E",alt:"Amex",className:"h-5"}),e.jsx("img",{src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 15'%3E%3Crect width='24' height='15' rx='2' fill='%23ff5f00'/%3E%3Ctext x='12' y='10' text-anchor='middle' font-size='6' fill='%23fff'%3EDISCOVER%3C/text%3E%3C/svg%3E",alt:"Discover",className:"h-5"})]})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"cardNumber",className:"sr-only",children:"Card number"}),e.jsxs("div",{className:"relative",children:[e.jsx(m,{id:"cardNumber",type:"text",placeholder:"Card number",required:!0,value:a.cardNumber,onChange:t=>c({...a,cardNumber:t.target.value}),className:"bg-gray-800/50 border-gray-700 text-white pl-4 pr-10 py-3 rounded-lg"}),e.jsx(k,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"expiry",className:"sr-only",children:"Expiration date"}),e.jsx(m,{id:"expiry",type:"text",placeholder:"Expiration date (MM / YY)",required:!0,value:a.expiry,onChange:t=>c({...a,expiry:t.target.value}),className:"bg-gray-800/50 border-gray-700 text-white px-4 py-3 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"cvc",className:"sr-only",children:"Security code"}),e.jsxs("div",{className:"relative",children:[e.jsx(m,{id:"cvc",type:"text",placeholder:"Security code",required:!0,value:a.cvc,onChange:t=>c({...a,cvc:t.target.value}),className:"bg-gray-800/50 border-gray-700 text-white pl-4 pr-10 py-3 rounded-lg"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500",children:e.jsxs("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),e.jsx("path",{strokeWidth:"2",d:"M12 8v4m0 4h.01"})]})})]})]})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"name",className:"sr-only",children:"Name on card"}),e.jsx(m,{id:"name",type:"text",placeholder:"Name on card",required:!0,value:a.name,onChange:t=>c({...a,name:t.target.value}),className:"bg-gray-800/50 border-gray-700 text-white px-4 py-3 rounded-lg"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Billing address"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"country",className:"sr-only",children:"Country/Region"}),e.jsxs(P,{value:a.country,onValueChange:t=>c({...a,country:t}),children:[e.jsx(A,{className:"bg-gray-900/50 border-gray-800 text-white py-3 rounded-lg",children:e.jsx(U,{placeholder:"Country/Region"})}),e.jsxs(F,{className:"bg-gray-900 border-gray-800 text-white",children:[e.jsx(p,{value:"United States",children:"United States"}),e.jsx(p,{value:"Canada",children:"Canada"}),e.jsx(p,{value:"United Kingdom",children:"United Kingdom"}),e.jsx(p,{value:"Australia",children:"Australia"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"firstName",className:"sr-only",children:"First name"}),e.jsx(m,{id:"firstName",type:"text",placeholder:"First name",required:!0,value:a.firstName,onChange:t=>c({...a,firstName:t.target.value}),className:"bg-gray-900/50 border-gray-800 text-white px-4 py-3 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"lastName",className:"sr-only",children:"Last name"}),e.jsx(m,{id:"lastName",type:"text",placeholder:"Last name",required:!0,value:a.lastName,onChange:t=>c({...a,lastName:t.target.value}),className:"bg-gray-900/50 border-gray-800 text-white px-4 py-3 rounded-lg"})]})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"address",className:"sr-only",children:"Address"}),e.jsx(m,{id:"address",type:"text",placeholder:"Address",required:!0,value:a.address,onChange:t=>c({...a,address:t.target.value}),className:"bg-gray-900/50 border-gray-800 text-white px-4 py-3 rounded-lg"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"city",className:"sr-only",children:"City"}),e.jsx(m,{id:"city",type:"text",placeholder:"City",required:!0,value:a.city,onChange:t=>c({...a,city:t.target.value}),className:"bg-gray-900/50 border-gray-800 text-white px-4 py-3 rounded-lg"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"state",className:"sr-only",children:"State"}),e.jsxs(P,{value:a.state,onValueChange:t=>c({...a,state:t}),children:[e.jsx(A,{className:"bg-gray-900/50 border-gray-800 text-white py-3 rounded-lg",children:e.jsx(U,{placeholder:"State"})}),e.jsxs(F,{className:"bg-gray-900 border-gray-800 text-white",children:[e.jsx(p,{value:"KS",children:"Kansas"}),e.jsx(p,{value:"CA",children:"California"}),e.jsx(p,{value:"NY",children:"New York"}),e.jsx(p,{value:"TX",children:"Texas"})]})]})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"zip",className:"sr-only",children:"ZIP code"}),e.jsx(m,{id:"zip",type:"text",placeholder:"ZIP code",required:!0,value:a.zip,onChange:t=>c({...a,zip:t.target.value}),className:"bg-gray-900/50 border-gray-800 text-white px-4 py-3 rounded-lg"})]})]})]})]}),e.jsx(L,{type:"submit",disabled:l,className:"w-full bg-white hover:bg-gray-100 text-black py-4 text-lg font-semibold rounded-lg transition-colors",children:l?"Processing...":"Pay now"})]})}),e.jsx("div",{className:"order-1 lg:order-2",children:e.jsxs("div",{className:"bg-gray-900/30 border border-gray-800 rounded-xl p-6 lg:sticky lg:top-32",children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Order Summary"}),e.jsxs("div",{className:"flex items-start space-x-4 pb-6 border-b border-gray-800",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-800 rounded-lg flex items-center justify-center",children:e.jsx("span",{className:"text-2xl",children:"🚀"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold",children:h.name}),e.jsx("p",{className:"text-sm text-gray-400",children:h.description})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"font-semibold",children:["$",h.price.toLocaleString()]}),x==="agency"&&e.jsx("p",{className:"text-sm text-gray-400",children:"/month"})]})]}),e.jsx("div",{className:"mt-6 pb-6 border-b border-gray-800",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(m,{type:"text",placeholder:"Discount code",value:s,onChange:t=>n(t.target.value),className:"flex-1 bg-gray-900/50 border-gray-800 text-white px-4 py-2 rounded-lg"}),e.jsx(L,{type:"button",onClick:V,className:"bg-gray-800 hover:bg-gray-700 text-white px-4 py-2 rounded-lg transition-colors",children:"Apply"})]}),i&&e.jsx("p",{className:"text-sm text-green-400",children:"Discount applied successfully!"})]})}),e.jsxs("div",{className:"mt-6 space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-400",children:"Subtotal"}),e.jsxs("span",{children:["$",h.price.toLocaleString()]})]}),i&&e.jsxs("div",{className:"flex justify-between text-sm text-green-400",children:[e.jsx("span",{children:"Discount"}),e.jsxs("span",{children:["-$",u.toLocaleString()]})]}),e.jsxs("div",{className:"pt-3 border-t border-gray-800",children:[e.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{className:"flex items-center",children:[e.jsx("span",{className:"text-sm text-gray-400 mr-2",children:"USD"}),"$",z.toLocaleString()]})]}),(x==="agency"||x==="enterprise")&&e.jsx("p",{className:"text-sm text-gray-400 text-right mt-1",children:x==="enterprise"?"Billed monthly • Cancel anytime":"Billed monthly • 3 month minimum"})]})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"font-semibold mb-4",children:"What's included:"}),e.jsx("ul",{className:"space-y-3",children:h.features.map((t,y)=>e.jsxs("li",{className:"flex items-start gap-3 text-sm",children:[e.jsx(J,{className:"h-4 w-4 text-white mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"text-gray-300",children:t})]},y))})]}),e.jsx("div",{className:"mt-8 p-4 bg-gray-800/30 rounded-lg",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[e.jsx(k,{className:"h-4 w-4"}),e.jsx("span",{children:"Your payment information is encrypted and secure"})]})})]})})]})})}),e.jsx(M,{})]})};export{ye as default};