1import{r as p,j as e}from"../chunks/chunk-x91YZxKf.js";import{M as h,D as I,P as T,E as O,r as _}from"../chunks/chunk-DQk_fF87.js";import"../chunks/chunk-CxLFMT2U.js";const k={label:"Add to cart",isCheckout:!0},D={label:"Enroll now",isCheckout:!1};function v(t){return(t/100).toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:t%100===0?0:2,maximumFractionDigits:2})}function F(t,s){return t<=0||s>=t?void 0:`-${Math.round((t-s)/t*100)}%`}function $(t,s){const n=t-s;if(!(n>0))return;const r=n/100;return r<100?`Members save ${v(n)}.`:`Members save over $${Math.floor(r/100)*100}.`}function N(t){return t?`Enroll in this ${t} today`:"Enroll today"}const H="Pricing unavailable";function C(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function U(t){return[t.listPriceInCents,t.memberPriceInCents,t.priceInCents].some(s=>{const n=C(s);return n!=null&&n>0})}function Y(t,s){const n=C(t.listPriceInCents),r=C(t.memberPriceInCents),i=C(t.priceInCents)??n,{isAuthenticated:c,isMember:a}=s,o=s.usedAuthedCatalog??c,u=!!s.tiHasNoPurchaseOption&&!U(t),d=!!t.isPublic||!!t.hasLicense||i===0||u,m=!!t.isPublic||n===0||u,b=c?d:m,P=!!t.isPublic||u,y=b?D:k,x=r!=null&&n!=null&&r<n;let l;if(b?l=0:c&&a?l=o&&i!=null&&r!=null&&i<r?i:x?r:i:l=n,l==null)return{priceInCentsLabel:H,displayedPriceInCents:null,priceUnavailable:!0,showMemberBenefitsBar:!1,discountLabel:void 0,secondary:{kind:"none"},title:c?"Your price to enroll:":N(s.productLabel),cta:y,layout:"single"};const g=l,A=b||g===0?"Free!":v(g),S=c&&a&&!t.isPublic&&x,B=!P&&n!=null&&n>0&&g<n?F(n,g):void 0;if(!c&&!b&&x)return{priceInCentsLabel:A,displayedPriceInCents:g,priceUnavailable:!1,showMemberBenefitsBar:!1,discountLabel:void 0,secondary:{kind:"none"},title:N(s.productLabel),cta:y,layout:"compare",compare:{yourLabel:"Your Price:",yourPriceLabel:A,memberLabel:"IMA Members:",memberPriceLabel:v(r),savingsLabel:$(n,r)}};let L={kind:"none"};!P&&a&&n!=null&&g<n?L={kind:"non-member-strikethrough",caption:"Non-Members:",listPriceLabel:v(n)}:!a&&!b&&x&&(L={kind:"member-info",caption:"IMA members pay:",memberPriceLabel:v(r)});const R=c?"Your price to enroll:":N(s.productLabel);return{priceInCentsLabel:A,displayedPriceInCents:g,priceUnavailable:!1,showMemberBenefitsBar:S,discountLabel:B,secondary:L,title:R,cta:y,layout:"single"}}const z="(max-width: 767px)";function G(){const t=p.useRef(null),s=p.useRef(null),n=p.useRef(null),[r,i]=p.useState(!1),[c,a]=p.useState(!0),o=p.useRef(0),u=p.useRef(!1);return p.useEffect(()=>{var x;const d=n.current;if(!d||typeof IntersectionObserver!="function"||!window.matchMedia)return;const m=window.matchMedia(z);let b=!0;const P=()=>{const l=m.matches&&!b;l!==u.current&&(l&&t.current&&(o.current=t.current.offsetHeight),u.current=l,i(l))},y=new IntersectionObserver(([l])=>{b=l.isIntersecting,P()},{threshold:0});return y.observe(d),(x=m.addEventListener)==null||x.call(m,"change",P),()=>{var l;y.disconnect(),(l=m.removeEventListener)==null||l.call(m,"change",P)}},[]),p.useEffect(()=>{r&&a(!0)},[r]),p.useEffect(()=>{const d=s.current;d&&(d.style.height=r?`${o.current}px`:"")},[r]),{cardRef:t,spacerRef:s,sentinelRef:n,pinned:r,collapsed:c,toggle:()=>a(d=>!d)}}function j({id:t,stickyStripLabel:s,persistentBanner:n,children:r}){const{cardRef:i,spacerRef:c,sentinelRef:a,pinned:o,collapsed:u,toggle:d}=G(),m=!!n||o,b=n??{message:s,icon:null};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:i,"data-ima-sticky-bar":o?"":void 0,className:o?"fixed inset-x-0 bottom-0":void 0,children:e.jsxs(h,{id:t,sticky:o,children:[m&&e.jsx(h.Banner,{tone:"success",icon:b.icon,collapsible:o,collapsed:u,onToggle:d,children:b.message}),e.jsx(h.Body,{className:o&&u?"hidden":void 0,children:r})]})}),e.jsx("div",{ref:c,"aria-hidden":!0}),e.jsx("div",{ref:a,"aria-hidden":!0})]})}const W="Included in a bundle",Q="Included in your bundle",V="View bundle options",J="Start course";function E({bundleName:t,href:s,libraryHref:n,ownership:r,onStart:i}){const c=r?Q:W,a=r?`You have this through the ${r.bundleTitle} bundle. Start it and it will appear in your learning.`:`This course isn't sold on its own â it c
1omes with the ${t}.`;return e.jsx(j,{id:"custom-product-bundle-gate",stickyStripLabel:c,children:e.jsx(h.Prompt,{align:"center",icon:e.jsx(T,{}),title:c,description:a,children:r?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"brand",size:"lg",className:"w-full",onClick:i,children:J}),n?e.jsx(h.Note,{children:e.jsx("a",{href:n,className:"underline",children:"Browse the full bundle library"})}):null]}):s?e.jsx(I,{variant:"brand",size:"lg",className:"w-full",asChild:!0,children:e.jsx("a",{href:s,children:V})}):e.jsx(h.Note,{children:"See âAccessing this courseâ on this page for how to get it."})})})}const K=new Set(["course","coursegroup","microcourse","learningpath","collection","bundle"]);function X(t){try{return new URL(t).hostname.replace(/^www\./i,"")||null}catch{return null}}function Z(t,s){const n="Opens in a new tab.";return t==="article"?{title:"Read this article",description:s?`Published on ${s}. ${n}`:n,cta:"Read article",stickyStripLabel:"Read this article"}:t&&K.has(t)?{title:"Enroll in this course",description:s?`Enrollment is completed on ${s}. Access Now opens it in a new tab.`:`Enrollment is completed on the site hosting this course. ${n}`,cta:"Access Now",stickyStripLabel:"Enroll in this course"}:{title:"Open this content",description:s?`Hosted on ${s}. ${n}`:n,cta:"Access Now",stickyStripLabel:"Open this content"}}function q({externalPurchaseUrl:t,contentKind:s}){const n=Z(s,X(t));return e.jsx(j,{id:"custom-product-external",stickyStripLabel:n.stickyStripLabel,children:e.jsx(h.Prompt,{title:n.title,description:n.description,children:e.jsx(I,{variant:"brand",size:"lg",className:"w-full",asChild:!0,children:e.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:[n.cta,e.jsx(O,{})]})})})})}function ee(t){if(!t)return"";try{return new Date(t).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}catch{return""}}function w({enrolledAt:t,resumeHref:s,resumeLabel:n,purchaseOptions:r}){return e.jsx(j,{id:"custom-product-pricing",stickyStripLabel:"You already have access",children:e.jsx(h.Access,{enrolledOn:ee(t)||void 0,resumeHref:s,...n?{resumeLabel:n}:{},children:r})})}const te="/join",ne="Your IMA membership benefits have been applied.";function se({title:t,priceInCentsLabel:s,hasMemberBenefits:n,discountLabel:r,secondary:i,compare:c,stickyStripLabel:a,cta:o,onPrimaryAction:u}){return e.jsx(j,{id:"custom-product-pricing",stickyStripLabel:a,persistentBanner:n?{message:ne}:null,children:e.jsx(M,{title:t,priceInCentsLabel:s,discountLabel:r,secondary:i,compare:c,cta:o,onPrimaryAction:u})})}function M({title:t,priceInCentsLabel:s,discountLabel:n,secondary:r,compare:i,cta:c,onPrimaryAction:a}){const o=r.kind==="non-member-strikethrough"?{label:r.caption,value:r.listPriceLabel}:r.kind==="member-info"?{label:r.caption,value:r.memberPriceLabel}:void 0;return e.jsxs(e.Fragment,{children:[i?e.jsx(h.Compare,{heading:t,yourLabel:i.yourLabel,yourPrice:i.yourPriceLabel,memberLabel:i.memberLabel,memberPrice:i.memberPriceLabel,savingsNote:i.savingsLabel?e.jsxs(e.Fragment,{children:[i.savingsLabel," ",e.jsx("a",{href:te,children:"Join IMA today!"})]}):void 0}):e.jsx(h.Price,{label:t,price:s,discount:n,secondary:o}),e.jsx(h.Actions,{children:e.jsxs(I,{variant:c.isCheckout?"warning":"brand",size:"lg",className:"w-full",onClick:a,children:[c.isCheckout&&e.jsx(_,{}),c.label]})})]})}const oe={title:"Dev â Product Pricing",description:"Local harness for the DS ProductPricing card across pricing states."},f={tiProductId:"ti-1",productId:"p-1",productCode:"SAMPLE-101",slug:"sample-course",minimumQuantity:1,maximumQuantity:1},re=[{label:"Anonymous â member savings available",note:"Compare layout: both prices side by side at the same size + join-to-save callout.",isAuthenticated:!1,isMember:!1,productLabel:"course",product:{...f,listPriceInCents:29900,memberPriceInCents:14900,priceInCents:14900}},{label:"Anonymous â no member discount",note:"Nothing to compare, so it falls back to the single price under the enroll heading.",isAuthenticated:!1,isMember:!1,productLabel:"course",product:{...f,listPriceInCents:29900,memberPriceInCents:29900,priceInCents:29900}},{label:"Authenticated member â member price applied",note:"Green benefits banner + your price + non-member reference + discount badge.",isAuthenticated:!0,isMember:!0,product:{...f,listPriceInCents:29900,memberPriceInCents:19900,priceInCents:19900}},{label:"Authenticated non-member â savings available",note:'Pays list (no member price); "IMA members pay:" incentive, no benefits banner.',isAuthenticated:!0,isMember:!1,product:{...f,listPriceInCents:29900,memberPriceInCents:19900,priceInCents:29900}},{label:"Authenticated member â no member discount",note:"Single price; no banner, no reference, no discount.",isAuthenticated:!0,isMember:!0,product:{...f,listPriceInCents:29900,memberPriceInCents:29900,priceInCents:29900}},{label:"Authenticated member â free with membership",note:"Free! at $0 with the benefits banner, -100% badge, and non-member reference.",isAuthenticated:!0,isMember:!0,product:{...f,listPriceInCents:29900,memberPriceInCents:0,priceInCents:0}
1},{label:"Free (public / $0)",note:"âFree!â with no reference or discount.",isAuthenticated:!1,isMember:!1,product:{...f,listPriceInCents:0,memberPriceInCents:0,priceInCents:0,isPublic:!0}},{label:"Price unknown â EAPI has no mapping",note:'Every price field null (what a renamed slug returns). Card suppressed â NOT "Free!".',isAuthenticated:!0,isMember:!0,product:{...f,listPriceInCents:null,memberPriceInCents:null,priceInCents:null}},{label:"Free â TI holds no price either",note:"Same all-null EAPI shell, but TI prices it $0.00 (the zh catalogue). Free!, not unavailable.",isAuthenticated:!1,isMember:!1,productLabel:"course",tiHasNoPurchaseOption:!0,product:{...f,listPriceInCents:null,memberPriceInCents:null,priceInCents:null}},{label:"Priced, but TI holds no price â the price wins",note:'Live /bundles/2: EAPI prices REGCERTCH at $325 while CourseGroupBySlug("2") answers with an unrelated archived zh video. $325, not "Free!".',isAuthenticated:!1,isMember:!1,tiHasNoPurchaseOption:!0,product:{...f,productCode:"REGCERTCH",slug:"2",listPriceInCents:32500,memberPriceInCents:32500,priceInCents:32500}}];function ue(){return e.jsx("div",{className:"min-h-screen bg-ima-light-gray px-4 py-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl",children:[e.jsx("h1",{className:"font-serif text-3xl font-bold text-navy-800",children:"ProductPricing â dev harness"}),e.jsxs("p",{className:"mt-1 text-sm text-text-muted",children:["The DS ",e.jsx("code",{className:"font-mono",children:"ProductPricing"})," card across pricing states, driven by the real ",e.jsx("code",{className:"font-mono",children:"getPricingPresentation"})," logic on fixtures (no EAPI). Add-to-cart is a no-op here."]}),e.jsxs("div",{className:"mt-8 grid grid-cols-1 items-start gap-x-8 gap-y-10 md:grid-cols-2 xl:grid-cols-3",children:[re.map(t=>{const s=Y(t.product,{isAuthenticated:t.isAuthenticated,isMember:t.isMember,productLabel:t.productLabel,tiHasNoPurchaseOption:t.tiHasNoPurchaseOption});return e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-subhead text-sm font-bold text-navy-700",children:t.label}),e.jsx("p",{className:"text-xs text-text-muted",children:t.note})]}),s.priceUnavailable?e.jsx("div",{className:"w-full max-w-md rounded-xl border border-border bg-surface p-6 text-sm text-text-muted shadow-md","data-ima-pricing-unavailable":!0,children:"Pricing for this product isn't available right now. Please contact IMA Support if it doesn't appear shortly."}):e.jsx(se,{title:s.title,priceInCentsLabel:s.priceInCentsLabel,hasMemberBenefits:s.showMemberBenefitsBar,discountLabel:s.discountLabel,secondary:s.secondary,compare:s.compare,stickyStripLabel:"Enroll in this course",cta:s.cta,onPrimaryAction:()=>{}})]},t.label)}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-subhead text-sm font-bold text-navy-700",children:"Already enrolled (has license)"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Access view: resume CTA + enrolled date."})]}),e.jsx(w,{enrolledAt:"2026-03-15",resumeHref:"#"})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-subhead text-sm font-bold text-navy-700",children:"Already enrolled â with purchase options"}),e.jsxs("p",{className:"text-xs text-text-muted",children:["Buy-again / gift seats, revealed by the DS Access card's own toggle. Live only when TI exposes a further purchase and"," ",e.jsx("code",{className:"font-mono",children:"SHOW_PURCHASE_OPTIONS"})," is on."]})]}),e.jsx(w,{enrolledAt:"2026-03-15",resumeHref:"#",purchaseOptions:e.jsx(M,{title:"Your price to enroll:",priceInCentsLabel:"$299",secondary:{kind:"none"},cta:k,onPrimaryAction:()=>{}})})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-subhead text-sm font-bold text-navy-700",children:"Bought on a partner's site"}),e.jsxs("p",{className:"text-xs text-text-muted",children:["TI's ",e.jsx("code",{className:"font-mono",children:"externalPurchaseUrl"})," (e.g. the Gies courses on Thinkific): no price, no cart â link out instead."]})]}),e.jsx(q,{externalPurchaseUrl:"https://giesbusiness-ima.thinkific.
1com/courses/btb-davap"})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-subhead text-sm font-bold text-navy-700",children:"Sold only inside a bundle"}),e.jsx("p",{className:"text-xs text-text-muted",children:"Becker / Kaplan content: TI holds no price because it isn't individually sellable, which used to render as âFree! / Enroll nowâ."})]}),e.jsx(E,{bundleName:"Becker CPE Bundle",href:"/pages/becker",libraryHref:"/pages/becker"}),e.jsx("p",{className:"text-xs text-text-muted",children:"â¦and the same card when TI authored no usable link:"}),e.jsx(E,{bundleName:"Kaplan CPE All Access Bundle",href:null,libraryHref:null}),e.jsx("p",{className:"text-xs text-text-muted",children:"â¦and what a member who already bought the bundle sees. TI grants a bundle's courses one at a time, so the CTA enrols them rather than linking away:"}),e.jsx(E,{bundleName:"Becker CPE Bundle",href:"/pages/becker",libraryHref:"/pages/becker",ownership:{bundleTitle:"Becker Select"},onStart:()=>window.dispatchEvent(new CustomEvent("ima:add-to-cart",{detail:{slug:"auditing-current-liabilities-course",quantity:1}}))})]})]})]})})}export{ue as Page,oe as documentProps};
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.