PageSourceSearch

https://essentialmagazine.com/assets/SubscribePage-B032TsjL.js

js essentialmagazine.com collected 2026-10-02 09:59:56 UTC 13,016 bytes, 1 lines download raw bytes

1import{j as e,B as g,e as k,T as u,A as U,a4 as O,a5 as $,s as G,d as y,af as _,ag as q,i as Y,ab as K,ah as X}from"./mui-DyMPnixy.js";import{r as d,a as Q}from"./vendor-BTAVga7P.js";import{u as Z,A,C as J,b as V,f as ee}from"./index-CNkoOo8d.js";import"./firebase-BB0x3W83.js";function F(s){return!s||!Array.isArray(s)?null:s.map((p,n)=>{let a=p.text||"";return p.bold&&(a=e.jsx("strong",{children:a},n)),p.italic&&(a=e.jsx("em",{children:a},n)),p.underline&&(a=e.jsx("u",{children:a},n)),e.jsx(Q.Fragment,{children:a},n)})}function te(s,p){return!s||!Array.isArray(s)?null:e.jsx(g,{sx:{width:"100%",mb:4,flexGrow:1},children:s.map((n,a)=>{if(n.type==="list"&&Array.isArray(n.children))return e.jsx(_,{disablePadding:!0,sx:{width:"100%",mb:1},children:n.children.map((f,S)=>{const v=F(f.children);return e.jsxs(q,{disableGutters:!0,sx:{alignItems:"flex-start",py:.75},children:[e.jsx(Y,{sx:{minWidth:28,mt:.5},children:e.jsx(K,{sx:{color:p,fontSize:18}})}),e.jsx(X,{primary:v,primaryTypographyProps:{variant:"body2",sx:{fontFamily:"'Roboto', 'Open Sans', sans-serif",color:"#333",lineHeight:1.5,fontWeight:400}}})]},S)})},a);if(n.type==="paragraph")return n.children?.some(S=>(S.text||"").trim().length>0)?e.jsx(u,{variant:"body2",sx:{fontFamily:"'Roboto', 'Open Sans', sans-serif",color:"#555",lineHeight:1.55,mb:2,textAlign:"left"},children:F(n.children)},a):null;if(n.type==="heading"){const f=n.level||4;return e.jsx(u,{variant:`h${Math.min(Math.max(f,4),6)}`,sx:{fontFamily:"'Roboto', 'Open Sans', sans-serif",fontWeight:600,color:"#151719",mt:1,mb:1,textAlign:"left"},children:F(n.children)},a)}return null})})}function oe(){const{currentUser:s,dbUser:p,isSubscribed:n,userTierLevel:a}=Z(),[f,S]=d.useState(null),[v,j]=d.useState(!0),[E,R]=d.useState(null),[l,H]=d.useState(null),[M,W]=d.useState(null),[D,T]=d.useState(!1),[P,z]=d.useState("signin"),C=d.useCallback(()=>{j(!0),R(null);const t=fetch(`${A}/api/v1/pages/subscribe-page`,{cache:"no-store"}).then(r=>r.ok?r.json():{data:null}).catch(()=>({data:null})),c=fetch(`${A}/api/v1/subscription-tiers`,{cache:"no-store"}).then(async r=>{if(!r.ok)throw new Error(`Failed to load subscription tiers (Status: ${r.status})`);return r.json()});Promise.all([t,c]).then(([r,o])=>{const i=r?.data||{},x=Array.isArray(o?.data)&&o.data.length>0?o.data:Array.isArray(i?.tiers)?i.tiers:[];if(x.length===0)throw new Error("No subscription tiers returned by backend");x.sort((h,w)=>(h.level??0)-(w.level??0)),H({title:i.title||"DIGITAL SUBSCRIPTION",subtitle:i.subtitle,description:i.description||"Support high-quality journalism and gain access to all Marbella restaurants reviews, property reports, and digital edition pages.",tiers:x,seoTitle:i.seoTitle,seoDescription:i.seoDescription,seoImage:i.seoImage}),j(!1)}).catch(r=>{console.error("Error fetching subscribe page:",r),R(r.message||"Failed to load subscription tiers"),j(!1)})},[]);d.useEffect(()=>{C()},[C]),d.useEffect(()=>{const t=document.title,c=l?.seoTitle||(l?.title?`${l.title} | Essential Marbella Magazine`:"Digital Subscriptions | Essential Marbella Magazine"),r=l?.seoDescription||l?.description||l?.subtitle||"Subscribe to Essential Marbella Magazine for full access to luxury lifestyle articles, digital edition archives, and exclusive content.",o=l?.seoImage?.url||"/essential-logo.png";document.title=c;const i=(x,h,w)=>{let b=document.querySelector(`meta[${x}="${h}"]`);b||(b=document.createElement("meta"),b.setAttribute(x,h),document.head.appendChild(b)),b.setAttribute("content",w)};return i("name","description",r),i("property","og:title",c),i("property","og:description",r),i("property","og:image",o),i("property","og:url",window.location.href),i("property","og:type","website"),i("name","twitter:card","summary_large_image"),i("name","twitter:title",c),i("name","twitter:description",r),i("name","twitter:image",o),()=>{document.title=t}},[l]);const N=async t=>{if(!s){z("register"),T(!0);return}W(null);const c=t.id||t.name;S(c);try{const r=await s.getIdToken(),o=await fetch(`${A}/api/v1/billing/create-checkout-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({tier_id:t.id,stripe_product_id:t.stripeProductId})});if(!o.ok){const x=await o.json();throw new Error(x.detail||"Failed to initiate checkout")}const i=await o.json();if(i?.url)window.location.href=i.url;else throw new Error("Stripe checkout URL missing")}catch(r){console.error("Checkout error:",r),W(ee(r,"Failed to start subscription process. Please try again.")),S(null)}};if(v)return e.jsx(g,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"50vh"},children:e.jsx(k,{sx:{color:"#B59A6D"}})});if(E||!l||l.tiers.length===0)return e.jsx(J,{title:"Subscriptions Temporarily Unavailable",message:"We are experiencing technical difficulties retrieving our subscription packages. Please check back shortly or try refreshing the page.",developerHint:"Please ensure the FastAPI backend is running on http://127.0.0.1:8000 and the /api/v1/subscription-tiers endpoint returns active tiers.",rawError:E||"No subscription tiers found",onRetry:C,showHomeButton:!0});const B=l?.title||"DIGITAL SUBSCRIPTION",I=l?.subtitle,L=l?.description||"Support high-quality journalism and gain access to all Marbella restaurants reviews, property reports, and digital edition pages.",m=l?.tiers||[];return e.jsxs(g,{sx:{maxWidth:1840,width:"100%",mx:"auto",px:{xs:2.5,sm:3,md:4,lg:3,xl:6},py:{xs:4,md:6},display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box"},children:[e.jsx(u,{variant:"h3",component:"h1",sx:{fontFamily:"'Noto Serif', Georgia, serif",fontWeight:400,fontSize:{xs:"1.65rem",sm:"2.2rem",md:"2.8rem"},mb:I?1:2,textAlign:"center",textTransform:"uppercase",letterSpacing:1,lineHeight:1.25},children:B}),I&&e.jsx(u,{variant:"h6",component:"h2",sx:{fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:600,color:"#151719",mb:2,textAlign:"center",letterSpacing:2,textTransform:"uppercase",fontSize:{xs:"0.75rem",sm:"0.85rem"}},children:I}),e.jsx(u,{variant:"body1",sx:{color:"#666",mb:{xs:4,md:5},textAlign:"center",maxWidth:750,fontFamily:"'Noto Serif', Georgia, serif",fontStyle:"italic",lineHeight:1.6,fontSize:{xs:"0.95rem",md:"1.05rem"}},children:L}),M&&e.jsx(U,{severity:"error",sx:{width:"100%",maxWidth:600,mb:3},children:M}),e.jsx(g,{sx:{display:"grid",gridTemplateColumns:{xs:"minmax(0, 1fr)",md:m.length>=4?"repeat(2, minmax(0, 1fr))":`repeat(${Math.max(m.length,1)}, minmax(0, 1fr))`,lg:`repeat(${Math.max(m.length,1)}, minmax(0, 1fr))`},maxWidth:{xs:500,md:m.length>=4?980:1150,lg:m.length>=4?1780:1350},gap:{xs:3.5,md:3,lg:2.5,xl:4},width:"100%",mx:"auto",alignItems:"stretch",pt:2,boxSizing:"border-box"},children:m.map((t,c)=>{const r=t.highlightColor||"#B59A6D",o=t.borderColor||t.borderColour,i=!!o,x=t.badgeText,h=t.level??0,w=!s&&h===0||s&&p?.tier_id&&(p.tier_id===t.documentId||p.tier_id===t.id)||s&&a===h,b=s&&a>h;return e.jsxs(O,{sx:{width:"100%",height:"100%",display:"flex",flexDirection:"column",borderRadius:2,position:"relative",order:{xs:m.length-c,md:c},backgroundColor:i?"#FCFAF7":"#FFFFFF",border:i?`2.5px solid ${o}`:"1px solid #E5E7EB",boxShadow:i?`0 14px 40px ${o}35, 0 2px 12px rgba(0,0,0,0.06)`:"0 4px 20px rgba(0,0,0,0.06)",transform:"none",zIndex:i?2:1,overflow:"visible",boxSizing:"border-box",transition:"transform 0.3s ease, box-shadow 0.3s ease","&:hover":{transform:"translateY(-4px)",boxShadow:i?`0 20px 48px ${o}50, 0 6px 18px rgba(0,0,0,0.08)`:"0 12px 32px rgba(0,0,0,0.12)"}},children:[x&&e.jsx(g,{sx:{position:"absolute",top:-12,left:"50%",transform:"translateX(-50%)",backgroundColor:r,color:"white",border:"2px s
1olid white",borderRadius:"12px",px:2,py:.35,fontSize:"0.68rem",fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:800,letterSpacing:"1.5px",textTransform:"uppercase",boxShadow:"0 4px 12px rgba(0,0,0,0.18)",zIndex:3,whiteSpace:"nowrap"},children:x}),e.jsx(g,{sx:{py:{xs:2,xl:2.2},px:3,backgroundColor:r,color:"white",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,borderTopLeftRadius:"6px",borderTopRightRadius:"6px"},children:e.jsx(u,{variant:"h6",component:"h3",sx:{fontFamily:"'Montserrat', 'Helvetica', sans-serif",letterSpacing:{xs:"2px",lg:"1.5px",xl:"2.5px"},color:"white",fontWeight:700,fontSize:{xs:"0.95rem",sm:"1.05rem"},textAlign:"center",textTransform:"uppercase"},children:t.name})}),e.jsxs($,{sx:{p:{xs:2.5,sm:3,md:3,lg:2.5,xl:4},display:"flex",flexDirection:"column",alignItems:"center",flexGrow:1,width:"100%",boxSizing:"border-box"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"baseline",justifyContent:"center",textAlign:"center",width:"100%",my:2,minHeight:48,whiteSpace:"nowrap"},children:[e.jsx(u,{variant:"h3",component:"span",sx:{fontFamily:"'Noto Serif', Georgia, serif",fontWeight:700,color:"#151719",textAlign:"center",lineHeight:1.2,fontSize:t.price&&t.price.length>8?{xs:"1.75rem",sm:"1.85rem"}:{xs:"2.1rem",sm:"2.25rem"},letterSpacing:.5,whiteSpace:"nowrap"},children:t.price||"—"}),t.price&&(t.priceSuffix||t.period)&&e.jsx(u,{variant:"body1",component:"span",sx:{fontFamily:"'Montserrat', 'Helvetica', sans-serif",color:"#777",ml:.75,fontWeight:500,fontSize:"0.85rem",textAlign:"center",whiteSpace:"nowrap"},children:t.priceSuffix||`/${t.period}`})]}),e.jsx(G,{sx:{width:"100%",my:2}}),t.description&&e.jsx(u,{variant:"body2",sx:{fontFamily:"'Roboto', 'Open Sans', sans-serif",color:"#555",lineHeight:1.55,mb:2,width:"100%",textAlign:"left"},children:t.description}),te(t.benefits,r),e.jsx(g,{sx:{width:"100%",mt:"auto"},children:w?e.jsx(y,{variant:"outlined",disabled:!0,fullWidth:!0,sx:{color:r,borderColor:r,py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:700,borderRadius:0,letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},textTransform:"uppercase",whiteSpace:"nowrap"},children:"✓ CURRENT MEMBERSHIP"}):b?e.jsx(y,{variant:"outlined",disabled:!0,fullWidth:!0,sx:{color:"#999",borderColor:"#ddd",py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:600,borderRadius:0,letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},textTransform:"uppercase",whiteSpace:"nowrap"},children:"INCLUDED WITH YOUR MEMBERSHIP"}):t.buttonAction==="disabled"?e.jsx(y,{variant:"contained",disabled:!0,fullWidth:!0,sx:{py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:600,borderRadius:0,letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},textTransform:"uppercase",whiteSpace:"nowrap"},children:t.buttonText||"COMING SOON..."}):t.buttonAction==="stripe"?e.jsx(y,{variant:"contained",onClick:()=>N(t),disabled:f!==null,fullWidth:!0,sx:{backgroundColor:r,color:"white",py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:700,borderRadius:0,letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},textTransform:"uppercase",whiteSpace:"nowrap",transition:"all 0.3s ease","&:hover":{backgroundColor:"#151719"}},children:f===(t.id||t.name)?e.jsx(k,{size:20,color:"inherit"}):s?t.buttonText||"SIGN IN & SUBSCRIBE":"SIGN UP & SUBSCRIBE"}):t.buttonAction==="signup"?e.jsx(y,{variant:"contained",onClick:()=>{z("register"),T(!0)},fullWidth:!0,sx:{backgroundColor:r,color:"white",py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:700,borderRadius:0,letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},textTransform:"uppercase",whiteSpace:"nowrap",transition:"all 0.3s ease","&:hover":{backgroundColor:"#151719"}},children:t.buttonText||"SIGN UP NOW"}):t.buttonAction==="link"?e.jsx(y,{variant:"contained",component:"a",href:t.buttonUrl||"/subscribe",fullWidth:!0,sx:{backgroundColor:r,color:"white",py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:700,borderRadius:0,letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},textTransform:"uppercase",whiteSpace:"nowrap",textDecoration:"none",transition:"all 0.3s ease","&:hover":{backgroundColor:"#151719"}},children:t.buttonText||"LEARN MORE"}):e.jsx(y,{variant:"outlined",disabled:!0,fullWidth:!0,sx:{py:1.4,px:{xs:1,lg:.5,xl:1},fontFamily:"'Montserrat', 'Helvetica', sans-serif",fontWeight:600,borderRadius:0,fontSize:{xs:"0.75rem",sm:"0.78rem",lg:"0.72rem",xl:"0.8rem"},letterSpacing:{xs:"0.8px",lg:"0.5px",xl:"0.8px"},color:"#999",borderColor:"#ddd",textTransform:"uppercase",whiteSpace:"nowrap"},children:t.buttonText||"INCLUDED"})})]})]},c)})}),m.length===0&&!v&&e.jsx(u,{sx:{color:"#999",mt:4,fontStyle:"italic"},children:"No subscription tiers configured."}),e.jsx(V,{open:D,onClose:()=>T(!1),initialTab:P})]})}
1export{oe 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.