PageSourceSearch

https://www.scientificamerican.com/static/entry/account-debug.CqR1pO5-.js

js scientificamerican.com collected 2026-10-01 07:48:33 UTC 8,383 bytes, 1 lines download raw bytes

1import{r as j,j as s}from"../chunks/vendor-react-DdEP1kCQ.js";import{D as N}from"../chunks/DefaultLayout-n0x-WG_8.js";import{p as v}from"../chunks/sciam-DxVNerXk.js";import{C as A,k as D,g as f,r as P,v as b}from"../chunks/core-DTFOJR-b.js";import{E}from"../chunks/Form-ClKuskFd.js";import{P as w,C as R,a as T}from"../chunks/Debug-BKnTqnKc.js";import{o as S,p as C,S as I}from"../chunks/Header-CvZfB-VC.js";import{P as k}from"../chunks/PageHeader-D5UP9mXf.js";import"../chunks/vendor-shared-ShLQKC4n.js";import"../chunks/Input-uX61N3qI.js";import"../chunks/Notice-CcqsS8oi.js";import"../chunks/index-1rYQGQvt.js";import"../chunks/sciam-BnjwuU5W.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9ab19b6a-252a-4e49-8c2b-5793778c1d68",e._sentryDebugIdIdentifier="sentry-dbid-9ab19b6a-252a-4e49-8c2b-5793778c1d68")}catch{}})();function U({auto:e=!0,customerId:t=""}){const{portal:n,close:u,session:c}=A(),{isLoggedIn:a,login:h}=D(),i=n.state.status,o=(!t||c?.customer_id===t)&&i==="error";return j.useEffect(()=>{if(e){if(!a){u();return}return n.open({close:(...r)=>console.log("Portal closed",r),loaded:(...r)=>console.log("Portal loaded",r),visit:(...r)=>console.log("Portal visited",r)},void 0,t),u}},[a]),s.jsx("div",{id:"chargebee-portal",children:a?s.jsx(s.Fragment,{children:o?s.jsx("p",{children:"There was an error opening the portal."}):s.jsx("button",{onClick:()=>n.open(void 0,void 0,t),disabled:i==="open",children:"Open Customer Portal"})}):s.jsxs("p",{children:["You must"," ",s.jsx("a",{href:"#",onClick:()=>h(),children:"log in"})," ","to manage your account."]})})}const B="customerDebug-gou-B",F="userInfo-WopQQ",$="customersGrid-SaiHe",X="customers-wVU-P",G="topRow-v1Ase",L="status-future-XXnQc",O="status-in_trial-C5BA6",Q="status-active-pgeme",M="status-non_renewing-q0h3X",V="status-paused--pYlV",q="status-transferred-tegN7",Y="status-cancelled-xroOP",z="subscriptionInfo-PNXu4",H="status-KrhWu",J="subscriptionActions-nFCwz",W="error-jPzQZ",l={customerDebug:B,userInfo:F,customersGrid:$,customers:X,topRow:G,"status-future":"status-future-XXnQc",statusFuture:L,"status-in_trial":"status-in_trial-C5BA6",statusInTrial:O,"status-active":"status-active-pgeme",statusActive:Q,"status-non_renewing":"status-non_renewing-q0h3X",statusNonRenewing:M,"status-paused":"status-paused--pYlV",statusPaused:V,"status-transferred":"status-transferred-tegN7",statusTransferred:q,"status-cancelled":"status-cancelled-xroOP",statusCancelled:Y,subscriptionInfo:z,status:H,subscriptionActions:J,error:W};function Z(){const{payload:e}=f(),{all:t,primary:n}=S(),u=!!t.length,c=t.length>1;return u?s.jsxs("div",{className:l.customerDebug,children:[s.jsxs("div",{className:l.userInfo,children:[s.jsxs("code",{children:["Auth0 User ",e?.["https://sciam.com/user_id"]||"Unknown"]}),s.jsx("br",{}),s.jsx("code",{children:e?.email})]}),s.jsx("h2",{children:s.jsx("b",{children:c?"Main Customer":"Customer"})}),s.jsx(_,{id:n,primary:c}),c&&s.jsxs("div",{className:l.customersGrid,children:[s.jsx("h3",{children:s.jsx("b",{children:"Additional Customers"})}),s.jsx("div",{className:l.customers,children:t.map(a=>a!==n&&s.jsx(_,{id:a},a))})]})]}):s.jsx("div",{children:"No customer found"})}function _({id:e,primary:t=!1}){const{entitlements:n}=P(),u=C(),{payload:c}=f(),a=c?.subscriptions?.filter(i=>i.customer_id===e),h=c?.["https://sciam.com/customers"]?.[n?.environment]?.some?.(i=>i.id===e);return s.jsxs("div",{children:[s.jsxs("div",{className:l.topRow,children:[s.jsx("a",{href:`${u}/d/customers/${e}`,target:"_blank",children:s.jsxs("code",{children:["Cust. ",e]})}),h&&s.jsx("span",{children:" Auth0 Sync 👍"})]}),a?.map?.(i=>s.jsx(K,{subscription:i},i.id)),s.jsx(U,{auto:!1,customerId:e})]})}const x=e=>e?new Date(e).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}):null;function K({subscription:e={}}){const t=C(),{id:n,price_id:u,status:c,current_term_end:a,next_billing_at:h,trial_end:i,shared_access_remaining:m,remaining_billing_cycles:o,serv_id:r}=e;return s.jsxs("div",{className:`${l.subscriptionInfo} ${l[`status-${c}`]}`,children:[s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[s.jsx("a",{href:`${t}/d/subscriptions/${n}`,target:"_blank",children:s.jsxs("code",{children:["Sub. ",n]})})," ",s.jsx("code",{className:l.status,children:c?.toUpperCase()})]}),s.jsx(es,{priceId:u}),r&&s.jsxs("p",{children:[s.jsx("strong",{children:"CDS Serv ID:"})," ",r]}),i&&s.jsxs("p",{children:[s.jsx("strong",{children:"Trial End:"})," ",x(i*1e3)]}),a&&s.jsxs("p",{children:[s.jsx("strong",{children:"Term End:"})," ",x(a*1e3)]}),h&&s.jsxs("p",{children:[s.jsx("strong",{children:"Next Billing:"})," ",x(h*1e3)]}),typeof m<"u"&&s.jsxs("p",{children:[s.jsx("strong",{children:"Shared G
1ift Access Remaining:"})," ",m]})||null,typeof o=="number"&&s.jsxs("p",{children:[s.jsx("strong",{children:"Remaining Billing Cycles:"})," ",""+o]}),o===null&&e.status!=="cancelled"&&s.jsx("p",{children:s.jsx("strong",{children:"Auto-Renewing"})})]}),s.jsx(ss,{subscription:e})]})}function ss({subscription:e={}}){const{update:t,updating:n}=f(),u=v.find(p=>p.default_price_id===e.price_id),c=u?.is_renewable&&["active","in_trial","paused"].includes(e.status||""),a=!u?.is_cds&&e.status==="non_renewing"&&!e.renewed_to,[h,i]=j.useState("");j.useEffect(()=>{const p=new URLSearchParams(window.location.search);p.has("coupon")&&i(p.get("coupon"))},[]);const m={method:"POST",authMode:"require",headers:{"Content-Type":"application/json"}},o=b("/auth/chargebee/checkout/estimate-renewal/",m),r=b("/auth/chargebee/checkout/renewal/",m),g=r.data?.object==="subscription";return s.jsxs("div",{className:l.subscriptionActions,children:[c&&s.jsx("p",{children:"Cancelable via portal"}),e.renewed_from&&s.jsxs("p",{children:["This subscription is a renewal for ",e.renewed_from,"."]}),e.renewed_to&&s.jsxs("p",{children:["This subscription is renewed by ",e.renewed_to,"."]}),a&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:l.button,disabled:o.loading,onClick:()=>o.refetch({body:{subscription_id:e.id,coupon_id:h}}),children:"Get Early Renewal Estimate"})," ",s.jsx(y,{data:o.data,error:o.error}),o.data&&s.jsxs(s.Fragment,{children:[s.jsx(E,{defaultPlan:u,data:o.data,flow:"renewal"}),s.jsxs("details",{children:[s.jsx("summary",{children:"Raw Estimate"}),s.jsx(w,{children:o.data})]}),s.jsx("button",{className:l.button,disabled:!o.data?.subscription_estimate||r.loading||g,onClick:()=>r.refetch({body:{subscription_id:e.id,coupon_id:h}}).then(()=>t()),children:"Renew Early"}),g&&s.jsx("p",{children:"Renewal successful!"}),n&&s.jsx("p",{children:"Updating user entitlements..."}),s.jsx(y,{data:r.data,error:r.error})]}),r.data&&s.jsx(s.Fragment,{children:s.jsxs("details",{children:[s.jsx("summary",{children:"Raw Renewal Response"}),s.jsx(w,{children:r.data})]})})]})]})}function y({data:e,error:t}){return t?s.jsx("div",{className:l.error,children:t.message||"Error: "+t.toString()}):e?.error?s.jsxs("div",{className:l.error,children:["Error: ",e.message||e.error]}):null}function es({priceId:e}){const t=v.find(n=>n.default_price_id===e);return t?s.jsx("div",{children:s.jsxs("span",{children:[s.jsx("strong",{children:t.name})," ",s.jsxs("code",{children:["(",e,")"]})]})}):null}const ts="accountDebug-VPLu5",ns="container-oMf96",rs="section-Sp2Ea",as="sectionTitle-a-vJp",d={accountDebug:ts,container:ns,section:rs,sectionTitle:as};function bs({}){return s.jsxs(N,{children:[s.jsx(k,{title:"Chargebee Account"}),s.jsxs("div",{className:d.accountDebug,children:[s.jsxs("div",{className:d.container,children:[s.jsxs("section",{className:d.section,children:[s.jsx("h2",{className:d.sectionTitle,children:"Info"}),s.jsx(I,{})]}),s.jsxs("section",{className:d.section,children:[s.jsx("h2",{className:d.sectionTitle,children:"Purchase Flow"}),s.jsx(R,{})]}),s.jsxs("section",{className:d.section,children:[s.jsx("h2",{className:d.sectionTitle,children:"Customer(s)"}),s.jsx(Z,{})]})]}),s.jsx("div",{className:d.container,children:s.jsxs("section",{className:d.section,children:[s.jsx("h2",{className:d.sectionTitle,children:"Debug"}),s.jsx(T,{})]})})]})]})}export{bs 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.