PageSourceSearch

https://www.scientificamerican.com/static/entry/checkout.S9d2wBTv.js

js scientificamerican.com collected 2026-09-24 07:35:15 UTC 7,315 bytes, 1 lines download raw bytes

1import{j as e}from"../chunks/vendor-react-DdEP1kCQ.js";import{D as C}from"../chunks/DefaultLayout-B4mESSua.js";import{k as v,y as j,x as m,d as g,r as _,P as N}from"../chunks/core-Bpuic6mr.js";import{N as r}from"../chunks/Notice-DIOat8pd.js";import{C as P}from"../chunks/Form-CThyhD9U.js";import"../chunks/Header-DuP3RNUx.js";import"../chunks/sciam-B_IQ-Vo8.js";import"../chunks/sciam-CvuG93yt.js";import"../chunks/vendor-shared-ShLQKC4n.js";import"../chunks/Input-xTKQaCJR.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new s.Error().stack;n&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[n]="c8f5a993-2484-46f5-aa76-73db1311bd56",s._sentryDebugIdIdentifier="sentry-dbid-c8f5a993-2484-46f5-aa76-73db1311bd56")}catch{}})();const F="layout-EwRAt",I="header-YLYDC",D="main-18Af3",A="noForm--P4Kx",i={layout:F,header:I,main:D,noForm:A};function E({children:s=null,force:n=!1,dryRun:l=!1,renewFrom:t="",returnTo:u=""}){const{isLoggedIn:d}=v(),{plan:a,eligibility:o}=j(),{recentTrials:h,activePlans:c}=m(),b=!c.length||o?.isPurchasable||!!t,f=a?.is_trial&&h?.length>0,k=!t&&!a?.is_giftable&&c.some(w=>w.enabled_in_portal),x=d&&!!a&&b&&!f&&!k||!!n&&!!a;let p="Checkout";return t?p="Renew Subscription":!f&&a?.external_name&&(o.isUpgrade?p="Upgrade to "+a.external_name:o.isDowngrade&&(p="Downgrade to "+a.external_name)),(l||n)&&(p+=` (${[n&&"Force",l&&"Dry Run"].filter(
1Boolean).join(", ")})`),e.jsxs("div",{className:g(i.layout,n&&i.force,l&&i.dryRun),children:[e.jsx("h1",{className:i.header,children:p}),e.jsxs("section",{className:g(i.main,x?i.form:i.noForm),children:[x&&e.jsxs(P,{force:n,dryRun:l,returnTo:u,renewFrom:t,children:[e.jsx(y,{flow:t?"renewal":"purchase"}),s]}),!x&&e.jsx(y,{}),!x&&s]})]})}function y({flow:s="purchase"}){const{isLoading:n,isLoggedIn:l,register:t,login:u}=v(),{plan:d,eligibility:a}=j(),{recentTrials:o,isActiveSubscriber:h,isLoggedIn:c}=m();if(!n&&!l)return c?e.jsx(r,{type:"warn",className:i.notice,children:e.jsx(r.Content,{children:e.jsxs("p",{children:[e.jsx("button",{className:i.registerButton,"data-click-position":"checkoutpage-signin-reauth",onClick:()=>{u()},children:"Sign In"})," ","again to continue with your purchase."]})})}):e.jsx(r,{type:"warn",className:i.notice,children:e.jsx(r.Content,{children:e.jsxs("p",{children:["You need to be signed in to purchase a subscription."," ",e.jsx("button",{className:i.registerButton,"data-click-position":"checkoutpage-register",onClick:()=>{t()},children:"Register"})," or ",e.jsx("button",{className:i.registerButton,"data-click-position":"checkoutpage-signin",onClick:()=>{u()},children:"Sign In"})]})})});if(s==="renewal")return null;const b=h&&!d?.is_giftable,f=d?.is_trial&&o?.length>0;return!n&&(!a?.isPurchasable||b||f)?e.jsx(r,{children:e.jsx(L,{})}):null}function L({flow:s="checkout"}){const{checkout:n}=_(),{eligibility:l,plan:t}=j(),{plan:u,recentTrials:d,activePlans:a}=m();if(!t)return e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"error",children:e.jsx("p",{children:"Plan not found."})}),e.jsx("div",{className:g(i.recirculate),children:e.jsxs("p",{children:[e.jsx("a",{href:"/getsciam/","data-click-position":"checkoutpage-eligibility-notice-plan-not-found-view-available-offers-lnk",children:"View available offers"}),"."]})})]});if(!l.enabledForCheckout)return e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"neutral",children:e.jsx("p",{children:"This plan is not currently available for purchase."})}),e.jsx("div",{className:g(i.recirculate),children:e.jsxs("p",{children:[e.jsx("a",{href:"/getsciam/","data-click-position":"checkoutpage-eligibility-notice-plan-not-enabled-view-available-plans-lnk",children:"Click here"})," ","to see our available plans."]})})]});if(t?.is_trial&&d?.length>0){window.location.href="/getsciam/?notice=ineligible-for-offer";return}if(t?.is_giftable&&!n.gifts)return e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"neutral",children:e.jsx("p",{children:"Gift plans are currently unavailable."})}),e.jsx("div",{className:g(i.recirculate),children:e.jsxs("p",{children:[e.jsx("a",{href:"/getsciam/","data-click-position":"checkoutpage-eligibility-notice-gifts-disabled-view-available-plans-lnk",children:"click here"})," ","to see our available plans."]})})]});const o=a.find(c=>c.id===t.id);if(o&&s!=="renewal"){const c=!t.is_cds&&o.status==="non_renewing";return e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"info",children:e.jsx("p",{children:"You already have this plan."})}),c?e.jsxs("p",{children:["You can"," ",e.jsx("a",{href:`/renew/?subscription=${o.sub_id}`,"data-click-position":"checkoutpage-renew-sub-lnk",children:"renew your subscription early"})," ","or manage it via the"," ",e.jsx("a",{href:"/account/","data-click-position":"checkoutpage-account-page-lnk",children:"account page"}),"."]}):e.jsxs("p",{children:[e.jsx("a",{href:"/account/","data-click-position":"checkoutpage-account-page-lnk",children:"Check your account"})," ","to manage your subscription",n.gifts&&e.jsxs("span",{children:[" ","or consider a"," ",e.jsx("a",{href:"/getsciam/gift/","data-click-position":"checkoutpage-eligibility-notice-give-gift-lnk",children:"gift"})," ","for a friend"]}),"."]})]})}if(a.some(c=>c.legacy_resource_id===t.legacy_resource_id))return e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"info",children:e.jsx("p",{children:"You already have a subscription."})}),e.jsx("div",{className:i.recirculate,children:e.jsxs("p",{children:[e.jsx("a",{href:"/account/","data-click-position":"renewsub-account",children:"Check your account"})," ","to manage your subscription",n.gifts&&e.jsxs("span",{children:[" ","or consider a"," ",e.jsx("a",{href:"/getsciam/gift/","data-click-position":"checkoutpage-eligibility-notice-give-gift",children:"gift"})," ","for a friend"]}),"."]})})]});const h=a.some(c=>
1c.enabled_in_portal===!1);return a.length>0?e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"warn",children:e.jsx("p",{children:"You already have a subscription."})}),e.jsxs("div",{className:i.recirculate,children:[h&&e.jsxs("p",{children:["If you would like to change to a different subscription, please"," ",e.jsx("a",{href:"mailto:[email protected]","data-click-position":"checkoutpage-eligibility-notice-unmanageable-plan-contact-support",children:"contact support"}),"."]}),!h&&e.jsxs("p",{children:["If you would like to change to a different subscription, please"," ",e.jsx("a",{href:"mailto:[email protected]","data-click-position":"checkoutpage-eligibility-notice-standard-plan-contact-support",children:"contact support"}),"."]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(r.Content,{type:"error",children:e.jsx("p",{children:"You are not eligible to purchase this plan."})}),e.jsx("div",{className:i.recirculate,children:e.jsxs("p",{children:["Please"," ",e.jsx("a",{href:"mailto:[email protected]","data-click-position":"checkoutpage-eligibility-notice-ineligible-state-contact-support",children:"contact us"})," ","for assistance."]})})]})}function V({force:s=!1,dryRun:n=!1,planId:l,renewFrom:t="",returnTo:u="",priceId:d,giftId:a,couponCode:o,customFields:h}){return e.jsx(N,{planId:l||d||a,couponCode:o,customFields:h,children:e.jsx(C,{showCta:!1,children:e.jsx(E,{force:s,dryRun:n,returnTo:u,renewFrom:t})})})}export{V 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.