PageSourceSearch

https://app.evaheld.com/assets/founding-family-offer-Gtu_WsOy.js

js evaheld.com collected 2026-09-28 08:31:27 UTC 9,184 bytes, 1 lines download raw bytes

1import{a0 as S,X as k,r as y,an as U,j as n,L as N,aN as O,aa as T}from"./PrivacyChoices-C6w-XUak.js";import{u as D}from"./main-runtime-4dUeodXo.js";import{I as B}from"./Input-DAEmJFbK.js";import{L as P}from"./Label-CQ1caMn1.js";import{S as C}from"./Switch-qQogvjBK.js";import{a as A}from"./index-DesqbAf8.js";import{T as E}from"./triangle-alert-DEebjAxr.js";import"./index-Fu5N3_1R.js";import"./index-Dxeku_h4.js";import"./index-CxuhBffx.js";const w={offers:["founding-family","admin","offers"]};async function L(){return A("/api/founding-family/admin/offers")}async function V(r){return A(`/api/founding-family/admin/offers/${r.environment}`,{method:"PUT",body:JSON.stringify(r)})}const q=()=>S({queryKey:w.offers,queryFn:L});function F(r){return{environment:r,name:"Evaheld Founding Family",isActive:!1,pricingPhase:"founding",currency:"aud",pair:{launch:{amount:19700,stripePriceId:""},future:{amount:59900,stripePriceId:""},vaultCount:2},single:{enabled:!0,launch:{amount:12900,stripePriceId:""},future:{amount:39900,stripePriceId:""},vaultCount:1},family:{launchTotal:34900,futureTotal:99900,launchUpgrade:{amount:15200,stripePriceId:""},futureUpgrade:{amount:4e4,stripePriceId:""},additionalVaultCount:3},foundingBonus:{enabled:!0,label:"Evaheld Family Start Pack"},termsVersion:"founding-family-v1"}}function l(r){return(r/100).toFixed(2)}function b(r){return Math.round(Number(r||0)*100)}function H(){const r=k(),[i,d]=y.useState("development"),[a,t]=y.useState(F("development")),[c,g]=y.useState(!1),j=D(q());y.useEffect(()=>{const e=j.data?.offers.find(u=>u.environment===i);t(e||F(i)),g(!1)},[i,j.data?.offers]);const p=U({mutationFn:V,onSuccess:async()=>{await r.invalidateQueries({queryKey:w.offers}),g(!0)}}),s=(e,u,x,m)=>{t(v=>({...v,[e]:{...v[e],[u]:{...v[e][u],[x]:x==="amount"?b(m):m}}}))},h=(e,u,x)=>{t(m=>({...m,family:{...m.family,[e]:{...m.family[e],[u]:u==="amount"?b(x):x}}}))};return j.isLoading?n.jsx("div",{className:"flex min-h-72 items-center justify-center text-[#652C90]",children:n.jsx(N,{className:"h-6 w-6 animate-spin"})}):n.jsxs("div",{className:"mx-auto max-w-6xl space-y-6 p-6",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-[#652C90]",children:"Admin"}),n.jsx("h1",{className:"mt-1 text-2xl font-semibold text-gray-950",children:"Founding Family Offer"}),n.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-gray-500",children:"Control availability, enforced prices, Stripe Price IDs and the founding bonus separately for Development and Production."})]}),n.jsx("div",{className:"inline-flex rounded-full border border-gray-200 bg-white p-1",children:["development","production"].map(e=>n.jsx("button",{type:"button",onClick:()=>d(e),className:`min-h-10 rounded-full px-5 text-sm font-medium capitalize ${i===e?"bg-[#652C90] text-white":"text-gray-600 hover:bg-gray-50"}`,children:e},e))}),i==="production"&&n.jsxs("div",{className:"flex gap-3 rounded-2xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900",children:[n.jsx(E,{className:"mt-0.5 h-5 w-5 shrink-0"}),"Saving an active Production offer changes the live price enforced by checkout. Confirm every Stripe Price ID before enabling it."]}),n.jsxs("form",{className:"space-y-6",onSubmit:e=>{e.preventDefault(),g(!1),p.mutate(a)},children:[n.jsxs("section",{className:"rounded-3xl border border-gray-200 bg-white p-5 sm:p-6",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-950",children:"Offer status and pricing"}),n.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Pricing changes only when an administrator selects a different phase."})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(P,{htmlFor:"offer-active",children:"Purchasable"}),n.jsx(C,{id:"offer-active",checked:a.isActive,onCheckedChange:e=>t({...a,isActive:e})})]})]}),n.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-2",children:[n.jsx(o,{label:"Offer name",id:"offer-name",value:a.name,onChange:e=>t({...a,name:e})}),n.jsx(o,{label:"Currency",id:"offer-currency",value:a.currency,onChange:e=>t({...a,currency:e.toLowerCase()})}
1),n.jsx(o,{label:"Terms version",id:"offer-terms",value:a.termsVersion,onChange:e=>t({...a,termsVersion:e})})]}),n.jsxs("fieldset",{className:"mt-5",children:[n.jsx("legend",{className:"text-sm font-medium text-gray-900",children:"Price currently shown at checkout"}),n.jsx("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:["founding","future"].map(e=>n.jsxs("label",{className:`flex min-h-12 cursor-pointer items-center gap-3 rounded-xl border px-4 text-sm font-medium ${a.pricingPhase===e?"border-[#8D43C5] bg-[#F6F0FA] text-[#652C90]":"border-gray-200 text-gray-700"}`,children:[n.jsx("input",{type:"radio",name:"pricingPhase",checked:a.pricingPhase===e,onChange:()=>t({...a,pricingPhase:e}),className:"h-5 w-5 accent-[#8D43C5]"}),e==="founding"?"Founding pricing":"Future pricing"]},e))})]})]}),n.jsxs("section",{className:"rounded-3xl border border-gray-200 bg-white p-5 sm:p-6",children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-950",children:"Prices and Stripe IDs"}),n.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Amounts are in Australian dollars. Checkout rejects any Stripe total that does not match these values."}),n.jsxs("div",{className:"mt-5 grid gap-5 lg:grid-cols-2",children:[n.jsx(f,{title:"Parent Pair · Founding",amount:l(a.pair.launch.amount),priceId:a.pair.launch.stripePriceId,onAmount:e=>s("pair","launch","amount",e),onPriceId:e=>s("pair","launch","stripePriceId",e)}),n.jsx(f,{title:"Parent Pair · Future",amount:l(a.pair.future.amount),priceId:a.pair.future.stripePriceId,onAmount:e=>s("pair","future","amount",e),onPriceId:e=>s("pair","future","stripePriceId",e)}),n.jsx(f,{title:"Single Vault · Founding",amount:l(a.single.launch.amount),priceId:a.single.launch.stripePriceId,onAmount:e=>s("single","launch","amount",e),onPriceId:e=>s("single","launch","stripePriceId",e)}),n.jsx(f,{title:"Single Vault · Future",amount:l(a.single.future.amount),priceId:a.single.future.stripePriceId,onAmount:e=>s("single","future","amount",e),onPriceId:e=>s("single","future","stripePriceId",e)}),n.jsx(f,{title:"Add 3 Vaults · Founding",amount:l(a.family.launchUpgrade.amount),priceId:a.family.launchUpgrade.stripePriceId,onAmount:e=>h("launchUpgrade","amount",e),onPriceId:e=>h("launchUpgrade","stripePriceId",e)}),n.jsx(f,{title:"Add 3 Vaults · Future",amount:l(a.family.futureUpgrade.amount),priceId:a.family.futureUpgrade.stripePriceId,onAmount:e=>h("futureUpgrade","amount",e),onPriceId:e=>h("futureUpgrade","stripePriceId",e)})]}),n.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-2",children:[n.jsx(o,{label:"Founding Family Pack total",id:"launch-total",type:"number",step:"0.01",value:l(a.family.launchTotal),onChange:e=>t({...a,family:{...a.family,launchTotal:b(e)}})}),n.jsx(o,{label:"Future Family Pack total",id:"future-total",type:"number",step:"0.01",value:l(a.family.futureTotal),onChange:e=>t({...a,family:{...a.family,futureTotal:b(e)}})})]}),n.jsxs("div",{className:"mt-5 flex flex-wrap gap-6",children:[n.jsx(I,{label:"Single fallback enabled",id:"single-enabled",checked:a.single.enabled,onChange:e=>t({...a,single:{...a.single,enabled:e}})}),n.jsx(I,{label:"Founding bonus enabled",id:"bonus-enabled",checked:a.foundingBonus.enabled,onChange:e=>t({...a,foundingBonus:{...a.foundingBonus,enabled:e}})})]}),n.jsx("div",{className:"mt-4",children:n.jsx(o,{label:"Founding bonus label",id:"bonus-label",value:a.foundingBonus.label,onChange:e=>t({...a,foundingBonus:{...a.foundingBonus,label:e}})})})]}),p.isError&&n.jsx("div",{className:"rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-700",children:p.error.message}),c&&n.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-800",children:[n.jsx(O,{className:"h-4 w-4"}),i==="production"?"Production":"Development"," offer saved."]}),n.jsxs(T,{type:"submit",className:"h-12 px-7",disabled:p.isPending,children:[p.isPending&&n.jsx(N,{className:"h-4 w-4 animate-spin"}),"Save ",i," offer"]})]})]})}function o({label:r,id:i,value:d,onChange:a,type:t="text",step:c}){return n.jsxs("div",{className:"space-y-2",children:[n.jsx(P,{htmlFor:i,children:r}),n.jsx(B,{id:i,type:t,step:c,value:d,onChange:g=>a(g.target.value),required:!0})]})}function I({label:r,id:i,checked:d,onChange:a}){return n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(C,{id:i,checked:d,onCheckedChange:a}),n.jsx(P,{htmlFor:i,children:r})]})}function f({title:r,amount:i,priceId:d,onAmount:a,onPriceId:t}){const c=r.toLowerCase().replace(/[^a-z0-9]+/g,"-");return n.jsxs("div",{className:"rounded-2xl border border-gray-200 p-4",children:[n.jsx("h3",{className:"font-semibold text-gray-900",children:r}),n.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-[0.4fr_1fr]",children:[n.jsx(o,{label:"Amount (A$)",id:`${c}-amount`,type:"number",step:"0.01",value:i,onChange:a}
1),n.jsx(o,{label:"Stripe Price ID",id:`${c}-stripe`,value:d,onChange:t})]})]})}export{H as component};

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.