PageSourceSearch

https://ardenna.ai/api/__clerk/npm/@clerk/[email protected]/dist/subscriptionDetails_ui_af76e0_1.38.0.js

js ardenna.ai collected 2026-10-05 11:48:48 UTC 14,936 bytes, 1 lines download raw bytes

1"use strict";(globalThis.rspackChunk_clerk_ui=globalThis.rspackChunk_clerk_ui||[]).push([[7451],{7562(e,i,n){n.r(i),n.d(i,{SubscriptionDetails:()=>P});var t=n(9763),l=n(6762),a=n(9701),r=n(6130),o=n(8343),s=n(2396);let c=(0,a.createContext)(null),u=()=>{let e=(0,a.useContext)(c);if(!e||"SubscriptionDetails"!==e.componentName)throw Error("Clerk: useSubscriptionDetailsContext called outside SubscriptionDetails.");let{componentName:i,...n}=e;return{...n,componentName:i}};var d=n(9286),p=n(1414),b=n(7308),g=n(6923),m=n(3751),h=n(49),D=n(7505),f=n(869),y=n(3736),v=n(9229),Y=n(2861),S=n(4641),C=n(9230),$=n(8342),_=n(1046),G=n(6887),F=n(
vendor: 9,632 bytes, line 1
15760);let k=a.createContext({confirmationOpen:!1,setConfirmationOpen:()=>{},subscription:null,setSubscription:()=>{}}),P=e=>(0,t.Y)(S.n.Root,{flow:"subscriptionDetails",children:(0,t.Y)(S.n.Part,{children:(0,t.Y)(g.Drawer.Content,{children:(0,t.Y)(c.Provider,{value:{componentName:"SubscriptionDetails",...e},children:(0,t.Y)(v.m$.Provider,{value:e.for,children:(0,t.Y)(w,{...e})})})})})});function x(e){let{subscriptionItems:i,isLoading:n}=(0,Y.Rs)(),t=i?.find(e=>"active"===e.status),l=i?.find(e=>"upcoming"===e.status),a=i?.find(e=>"past_due"===e.status);if(e?.or==="throw"&&!t&&!a)throw Error("No active or past due subscription found");return{upcomingSubscription:l,pastDueSubscription:a,activeSubscription:t,anySubscription:l||t||a,isLoading:n}}let w=e=>{let[i,n]=(0,a.useState)(null),[l,r]=(0,a.useState)(!1),{subscriptionItems:o,isLoading:s}=(0,Y.Rs)(),{activeSubscription:c,pastDueSubscription:u}=x();return s?(0,t.Y)(C.y$,{sx:{margin:"auto"}}):c||u?(0,t.FD)(k.Provider,{value:{subscription:i,setSubscription:n,confirmationOpen:l,setConfirmationOpen:r},children:[(0,t.Y)(g.Drawer.Header,{title:(0,$.G)("billing.subscriptionDetails.title")}),(0,t.Y)(g.Drawer.Body,{sx:e=>({display:"flex",flexDirection:"column",flex:1,overflowY:"auto",padding:e.space.$4,gap:e.space.$4}),children:o?.map(i=>(0,t.Y)(E,{subscription:i,...e},i.id))}),(0,t.Y)(z,{})]}):null},z=(0,b.dm)(()=>{let e=(0,v.XX)(),{isLoading:i,error:n,setError:r,setLoading:o,setIdle:s}=(0,b.f0)(),{subscription:c,confirmationOpen:d,setConfirmationOpen:m}=(0,a.useContext)(k),{data:h}=(0,Y.Rs)(),{setIsOpen:D}=(0,g.g)(),{onSubscriptionCancel:y}=u(),S=(0,l.It)(),G=(0,a.useCallback)(e=>m(e),[m]),F=(0,a.useCallback)(async()=>{c&&(r(void 0),o(),await c.cancel({orgId:"organization"===e?S?.id:void 0}).then(()=>{y?.(),D&&D(!1)}).catch(e=>{(0,f.H4)(e,[],r)}).finally(()=>{s()}))},[c,r,o,e,S?.id,y,D,s]);return h?.nextPayment?(0,t.FD)(g.Drawer.Footer,{children:[(0,t.Y)(A,{}),(0,t.Y)(g.Drawer.Confirmation,{open:d,onOpenChange:G,actionsSlot:(0,t.FD)(t.FK,{children:[!i&&(0,t.Y)(C.$n,{variant:"ghost",size:"sm",textVariant:"buttonLarge",onClick:()=>{s(),r(void 0),G(!1)},localizationKey:c?.isFreeTrial?(0,$.G)("billing.keepFreeTrial"):(0,$.G)("billing.keepSubscription")}),(0,t.Y)(C.$n,{variant:"solid",colorScheme:"danger",size:"sm",textVariant:"buttonLarge",isLoading:i,onClick:()=>void F(),localizationKey:c?.isFreeTrial?(0,$.G)("billing.cancelFreeTrial",{plan:c.plan.name}):(0,$.G)("billing.cancelSubscription")})]}),children:c?(0,t.FD)(t.FK,{children:[(0,t.Y)(C.DZ,{elementDescriptor:_.$z.drawerConfirmationTitle,as:"h2",textVariant:"h3",localizationKey:c?.isFreeTrial?(0,$.G)("billing.cancelFreeTrialTitle",{plan:c.plan.name}):(0,$.G)("billing.cancelSubscriptionTitle",{plan:`${"upcoming"===c.status?"upcoming ":""}${c.plan.name}`})}),(0,t.Y)(C.EY,{elementDescriptor:_.$z.drawerConfirmationDescription,colorScheme:"secondary",localizationKey:c?.isFreeTrial?(0,$.G)("billing.cancelFreeTrialAccessUntil",{plan:c.plan.name,date:c.periodEnd}):"upcoming"===c.status?(0,$.G)("billing.cancelSubscriptionNoCharge"):"past_due"===c.status?(0,$.G)("billing.cancelSubscriptionPastDue"):(0,$.G)("billing.cancelSubscriptionAccessUntil",{plan:c.plan.name,date:c.periodEnd})}),(0,t.Y)(p.v,{children:n})]}):null})]}):null});function A(){let{activeSubscription:e}=x({or:"throw"}),{data:i}=(0,Y.Rs)(),{$:n}=(0,G._)();if(!i?.nextPayment||!e)return null;let{isFreeTrial:l}=e;return(0,t.FD)(m.p.Root,{children:[(0,t.FD)(m.p.Group,{children:[(0,t.Y)(m.p.Title,{description:(0,$.G)("billing.subscriptionDetails.currentBillingCycle")}),(0,t.Y)(m.p.Description,{text:"month"===e.planPeriod?(0,$.G)("billing.monthly"):(0,$.G)("billing.annually")})]}),(0,t.FD)(m.p.Group,{children:[(0,t.Y)(m.p.Title,{description:(0,$.G)(`billing.subscriptionDetails.${l?"firstPaymentOn":"nextPaymentOn"}`)}),(0,t.Y)(m.p.Description,{text:(0,y.Y)(i.nextPayment.date)})]}),(0,t.FD)(m.p.Group,{children:[(0,t.Y)(m.p.Title,{description:(0,$.G)(`billing.subscriptionDetails.${l?"firstPaymentAmount":"nextPaymentAmount"}`)}),(0,t.Y)(m.p.Description,{prefix:i.nextPayment.amount.currency,text:n(i.nextPayment.amount)})]})]})}let T=({subscription:e})=>{let{portalRoot:i}=u(),{__internal_openCheckout:n}=(0,l.ho)(),r=(0,v.XX)(),{setIsOpen:o}=(0,g.g)(),{revalidateAll:c}=(0,Y.D)(),{setSubscription:d,setConfirmationOpen:p}=(0,a.useContext)(k),{$:b}=(0,G._)(),m=(0,s.Fd)(e=>e({permission:"org:sys_billing:manage"})),h="user"===r||m,f=(0,D.g)(e),y=("month"===e.planPeriod&&!!e.plan.annualMonthlyFee||"annual"===e.planPeriod&&!!e.plan.fee)&&"past_due"!==e.status&&f,S=null===e.canceledAt&&f,F=null!==e.canceledAt&&f,P=(0,a.useCallback)(e=>{o&&o(!1),n({...e,onSubscriptionComplete:()=>{c()},portalRoot:i})},[n,c,i,o]),x=a.useMemo(()=>h?[y?{label:"month"===e.planPeriod?(0,$.G)("billing.switchToAnnualWithAnnualPrice",{price:b(e.plan.annualFee,{style:"short"})}):(0,$.G)("billing.switchToMonthlyWithPrice",{price:b(e.plan.fee,{style:"short"})}),onClick:()=>{P({planId:e.plan.id,planPeriod:"month"===e.planPeriod?"annual":"month",for:r})}}:null,S?{isDestructive:!0,label:e.isFreeTrial?(0,$.G)("billing.cancelFreeTrial",{plan:e.plan.name}):(0,$.G)("billing.cancelSubscription"),onClick:()=>{d(e),p(!0)}}:null,F?{label:(0,$.G)("billing.reSubscribe"),onClick:()=>{P({planId:e.plan.id,planPeriod:e.planPeriod,for:r})}}:null].filter(e=>null!==e):[],[y,e,S,P,r,d,h,F,p,b]);return 0===x.length?null:(0,t.Y)(C.so,{elementDescriptor:_.$z.subscriptionDetailsCardActions,gap:2,sx:e=>({paddingInline:e.space.$3,paddingBlock:e.space.$3,borderBlockStartWidth:e.borderWidths.$normal,borderBlockStartStyle:e.borderStyles.$solid,borderBlockStartColor:e.colors.$borderAlpha100}),children:x.map((e,i)=>(0,t.Y)(C.$n,{elementDescriptor:e.isDestructive?_.$z.subscriptionDetailsCancelButton:_.$z.subscriptionDetailsActionButton,variant:e.isDestructive?"ghost":"outline",colorScheme:e.isDestructive?"danger":void 0,size:"xs",textVariant:"buttonSmall",onClick:e.onClick,localizationKey:e.label},i))})},E=({subscription:e})=>{let{t:i,$:n}=(0,G._)(),l=e.seats?.quantity,a=e.seats?.tiers?.find(e=>e.total.amount>0),s=i((0,$.G)("billing.month")).toLowerCase(),c=(0,h.s5)(e.plan),u="month"===e.planPeriod?e.plan.fee:e.plan.annualFee;return(0,t.FD)(C.fv,{elementDescriptor:_.$z.subscriptionDetailsCard,sx:e=>({borderRadius:e.radii.$md,boxShadow:e.shadows.$tableBodyShadow,overflow:"hidden"}),children:[(0,t.Y)(C.fv,{elementDescriptor:_.$z.subscriptionDetailsCardBody,gap:3,sx:e=>({padding:e.space.$3,background:o.s.mutedBackground(e)}),children:(0,t.FD)(C.so,{elementDescriptor:_.$z.subscriptionDetailsCardHeader,justify:"between",gap:2,children:[e.plan.avatarUrl?(0,t.Y)(d.e,{boxElementDescriptor:_.$z.planDetailAvatar,size:e=>40,title:e.plan.name,rounded:!1,imageUrl:e.plan.avatarUrl}):null,(0,t.FD)(C.so,{direction:"col",justify:"between",children:[(0,t.Y)(C.EY,{elementDescriptor:_.$z.subscriptionDetailsCardTitle,variant:"h2",sx:e=>({fontSize:e.fontSizes.$lg,fontWeight:e.fontWeights.$semibold,color:e.colors.$colorForeground}),children:e.plan.name}),(0,t.FD)(C.so,{children:[(0,t.Y)(C.EY,{variant:"body",as:"span",sx:e=>({fontWeight:e.fontWeights.$medium,textTransform:"lowercase"}),children:n(u)}),(0,t.Y)(C.EY,{variant:"body",as:"span",colorScheme:"secondary",sx:e=>({fontWeight:e.fontWeights.$medium,textTransform:"lowercase",whiteSpace:"pre"}),children:` / ${i((0,$.G)(`billing.${"month"===e.planPeriod?"month":"year"}`))}`})]})]}),(0,t.Y)(C.so,{align:"start",children:(0,t.Y)(F.V,{subscription:e.isFreeTrial?{status:"free_trial"}:e,elementDescriptor:_.$z.subscriptionDetailsCardBadge})})]})}),void 0!==l?(0,t.Y)(B,{variant:"header",labelNode:(0,t.FD)(C.so,{align:"center",gap:1,children:[(0,t.Y)(C.In,{icon:r.A,size:"md",colorScheme:"neutral"}),(0,t.Y)(C.EY,{localizationKey:(0,$.G)("billing.seats")})]}),valueNode:(0,t.FD)(C.fv,{gap:1,align:"end",children:[c?(0,t.Y)(C.EY,{variant:"subtitle",localizationKey:c}):null,a&&a.quantity?(0,t.Y)(C.EY,{variant:"subtitle",children:i((0,$.G)("organizationProfile.billingPage.subscriptionsListSection.paidSeatsUsage",{seatsQuantity:a.quantity,amount:`${n(a.feePerBlock)} / ${s}`}))}):null]})}):null,e.pastDueAt?(0,t.Y)(B,{label:(0,$.G)("billing.subscriptionDetails.pastDueAt"),value:(0,y.Y)(e.pastDueAt)}):null,"active"===e.status?(0,t.FD)(t.FK,{children:[(0,t.Y)(B,{label:e.isFreeTrial?(0,$.G)("billing.subscriptionDetails.trialStartedOn"):(0,$.G)("billing.subscriptionDetails.subscribedOn"),value:(0,y.Y)(e.createdAt)}),e.periodEnd&&(0,t.Y)(B,{label:e.canceledAt?(0,$.G)("billing.subscriptionDetails.endsOn"):e.isFreeTrial?(0,$.G)("billing.subscriptionDetails.trialEndsOn"):(0,$.G)("billing.subscriptionDetails.renewsAt"),value:(0,y.Y)(e.periodEnd)})]}):null,"upcoming"===e.status?(0,t.Y)(B,{label:(0,$.G)("billing.subscriptionDetails.beginsOn"),value:(0,y.Y)(e.periodStart)}):null,(0,t.Y)(T,{subscription:e})]})},B=({label:e,labelNode:i,value:n,valueNode:l,variant:a})=>(0,t.FD)(C.so,{elementDescriptor:_.$z.subscriptionDetailsDetailRow,justify:"between",align:l?"start":"center",sx:e=>({paddingInline:e.space.$3,paddingBlock:e.space.$3,borderBlockStartWidth:e.borderWidths.$normal,borderBlockStartStyle:e.borderStyles.$solid,borderBlockStartColor:e.colors.$borderAlpha100,..."header"===a?{background:o.s.mutedBackground(e)}:{}}),children:[e?(0,t.Y)(C.EY,{elementDescriptor:_.$z.subscriptionDetailsDetailRowLabel,localizationKey:e}):null,i||null,l||("string"==typeof n?(0,t.Y)(C.EY,{elementDescriptor:_.$z.subscriptionDetailsDetailRowValue,colorScheme:"secondary",children:n}):n?(0,t.Y)(C.EY,{localizationKey:n,elementDescriptor:_.$z.subscriptionDetailsDetailRowValue,colorScheme:"secondary"}):null)]})},
vendor: 1,494 bytes, line 1
15760(e,i,n){var t=n(9763),l=n(9230),a=n(8342);let r={active:"badge__activePlan",upcoming:"badge__upcomingPlan",past_due:"badge__pastDuePlan",free_trial:"badge__freeTrial"},o={active:"secondary",upcoming:"primary",past_due:"warning",free_trial:"secondary"};n.d(i,{},{V:({subscription:e,elementDescriptor:i})=>(0,t.Y)(l.Ex,{elementDescriptor:i,colorScheme:o[e.status],localizationKey:(0,a.G)(r[e.status])})})},2861(e,i,n){n.d(i,{A$:()=>m,D:()=>f,JB:()=>h,Rs:()=>g,eT:()=>b,mu:()=>d,ns:()=>D,wD:()=>p});var t=n(6762),l=n(9701),a=n(2396),r=n(49),o=n(7549),s=n(8342),c=n(9229);let u=()=>{let e=(0,c.XX)(),i=(0,a.Fd)(e=>e({permission:"org:sys_billing:read"})||e({permission:"org:sys_billing:manage"})),n=(0,t.It)();return{for:e,keepPreviousData:!0,enabled:"organization"!==e||!!n&&i}},d=()=>{let e=u();return(0,t.X$)(e)},p=()=>{let e=u();return(0,t.t7)(e)},b=e=>{let i=u();return(0,t.tr)({...i,__experimental_mode:e?.mode})},g=()=>{let e=u(),i=(0,t.kH)(e),n=(0,l.useMemo)(()=>i.data?.subscriptionItems||[],[i.data?.subscriptionItems]);return{...i,subscriptionItems:n}},m=e=>{let i=(0,c.XX)();return(0,t.rg)({for:i,initialPage:1,pageSize:50,keepPreviousData:!0,enabled:!0,__experimental_mode:e?.mode})},h=()=>{let e=u();return(0,t.pH)(e)},D=()=>{let e=u();return(0,t.ZD)(e)},f=()=>{let e=(0,t.ho)(),{session:i}=(0,t.wV)(),n=(0,c.XX)(),a=(0,l.useMemo)(()=>!!(!e.session||e?.session?.checkAuthorization({permission:"org:sys_billing:manage"})||"user"===n),[e,n]),{subscriptionItems:u,revalidate:p,data:h}
vendor: 3,172 bytes, line 1
1=g(),{data:D,revalidate:f}=m({mode:"cache"}),{revalidate:y}=b({mode:"cache"}),{revalidate:v}=d(),Y=(0,l.useCallback)(()=>{p(),f(),y(),v()},[p,f,y,v]),S=(0,l.useMemo)(()=>0===u.length||!u.some(e=>!e.canceledAt),[u]),C=(0,l.useCallback)(e=>u.find(i=>i.plan.id===e.id),[u]),$=(0,l.useCallback)(e=>u.filter(i=>i.plan.id===e.id),[u]),_=(0,l.useCallback)((e,i="month")=>{let n=$(e);if(n.length>1){let e=n.find(e=>e.planPeriod===i);return e||n[0]}if(1===n.length)return n[0]},[$]),G=(0,l.useCallback)(({plan:e,subscription:i})=>{let n=i??(e?C(e):void 0);return!n||!n.canceledAt},[C]),F=(0,l.useCallback)(({plan:e,organization:t,subscription:l,isCompact:o=!1,selectedPlanPeriod:c="annual"})=>{let d=l??(e?_(e,c):void 0),p="organization"===n&&!!t&&(0,r.iI)(e,t),b=c,g=!!e?.annualMonthlyFee;"annual"!==b||g||(b="month");let m=n=>{if(e?.freeTrialEnabled){let n=!i,t=h?.eligibleForFreeTrial;if(n||t)return(0,s.G)("billing.startFreeTrial__days",{days:e.freeTrialDays??0})}return n};return{localizationKey:m((()=>{if(d){if(b!==d.planPeriod&&d.canceledAt){if("month"===b)return(0,s.G)("billing.switchToMonthly");if(g)return(0,s.G)("billing.switchToAnnual")}if(d.canceledAt)return(0,s.G)("billing.reSubscribe");if(b!==d.planPeriod){if("month"===b)return(0,s.G)("billing.switchToMonthly");if(g)return(0,s.G)("billing.switchToAnnual")}return(0,s.G)("billing.manageSubscription")}return u.filter(e=>!e.plan.isDefault).length>0?(0,s.G)("billing.switchPlan"):m((0,s.G)("billing.subscribe"))})()),variant:o?"bordered":"solid",colorScheme:o?"secondary":"primary",isDisabled:!a||p,disabled:!a||p}},[_,a,n,u,h]),k=(0,l.useCallback)(e=>e.pastDueAt?(0,s.G)("badge__pastDueAt",{date:e.pastDueAt}):"upcoming"===e.status?(0,s.G)("badge__startsAt",{date:e.periodStart}):e.canceledAt?(0,s.G)("badge__canceledEndsAt",{date:e.periodEnd}):e.periodEnd?(0,s.G)(e.isFreeTrial?"badge__trialEndsAt":"badge__renewsAt",{date:e.periodEnd}):void 0,[]),P=(0,l.useCallback)(i=>{let t=(0,o.J)("modal",i);e.__internal_openSubscriptionDetails({for:n,onSubscriptionCancel:()=>{Y()},portalRoot:t})},[e,n,Y]);return{activeOrUpcomingSubscription:C,activeAndUpcomingSubscriptions:$,activeOrUpcomingSubscriptionBasedOnPlanPeriod:_,isDefaultPlanImplicitlyActiveOrUpcoming:S,handleSelectPlan:(0,l.useCallback)(({plan:t,planPeriod:l,seatsQuantity:a,priceId:r,mode:s="mounted",event:c,portalRoot:u,appearance:d,newSubscriptionRedirectUrl:p,onSubscriptionComplete:b})=>{var g,m;let h=u??(0,o.J)(s,c);e.__internal_openCheckout({planId:t.id,planPeriod:(g=t,"month"===(m=l)&&g.fee||"annual"===m&&g.annualMonthlyFee?m:"month"!==m||g.fee?"annual"!==m||g.annualMonthlyFee?m:"month":"annual"),for:n,seatsQuantity:a,priceId:r,onSubscriptionComplete:()=>{Y(),b?.()},onClose:()=>{i?.id&&e.setActive({session:i.id})},appearance:d,portalRoot:h,newSubscriptionRedirectUrl:p})},[e,Y,n,i?.id]),openSubscriptionDetails:P,buttonPropsForPlan:F,canManageSubscription:G,captionForSubscription:k,defaultFreePlan:(0,l.useMemo)(()=>D?.find(e=>e.isDefault),[D]),revalidateAll:Y}}},9229(e,i,n){var t=n(9701);let l="user",a=(0,t.createContext)(l),r=()=>(0,t.useContext)(a)||l;n.d(i,{},{N7:()=>"user"===r()?"userProfile":"organizationProfile",XX:r,m$:a})}}]);

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.