@clerk/ui 1.0.0-snapshot.v20251216175437 → 1.0.0-snapshot.v20251217165918

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/{207_ui_338113_1.0.0-snapshot.v20251216175437.js → 207_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  2. package/dist/{217_ui_338113_1.0.0-snapshot.v20251216175437.js → 217_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  3. package/dist/{360_ui_338113_1.0.0-snapshot.v20251216175437.js → 360_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  4. package/dist/{444_ui_338113_1.0.0-snapshot.v20251216175437.js → 444_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  5. package/dist/{573_ui_338113_1.0.0-snapshot.v20251216175437.js → 573_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  6. package/dist/{970_ui_338113_1.0.0-snapshot.v20251216175437.js → 970_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  7. package/dist/ClerkUi.js +2 -2
  8. package/dist/{apiKeys_ui_338113_1.0.0-snapshot.v20251216175437.js → apiKeys_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  9. package/dist/{checkout_ui_338113_1.0.0-snapshot.v20251216175437.js → checkout_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +2 -2
  10. package/dist/components/OrganizationProfile/index.js +4 -3
  11. package/dist/components/OrganizationProfile/index.js.map +1 -1
  12. package/dist/components/SignIn/SignInFactorTwoAlternativeMethods.js +3 -1
  13. package/dist/components/SignIn/SignInFactorTwoAlternativeMethods.js.map +1 -1
  14. package/dist/components/SignIn/index.js +2 -1
  15. package/dist/components/SignIn/index.js.map +1 -1
  16. package/dist/components/SignUp/index.js +2 -1
  17. package/dist/components/SignUp/index.js.map +1 -1
  18. package/dist/components/UserProfile/index.js +3 -2
  19. package/dist/components/UserProfile/index.js.map +1 -1
  20. package/dist/components/UserVerification/UserVerificationFactorTwo.js +1 -1
  21. package/dist/components/UserVerification/UserVerificationFactorTwo.js.map +1 -1
  22. package/dist/components/UserVerification/index.js.map +1 -1
  23. package/dist/{createorganization_ui_338113_1.0.0-snapshot.v20251216175437.js → createorganization_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  24. package/dist/customizables/parseAppearance.d.ts +2 -2
  25. package/dist/customizables/parseAppearance.d.ts.map +1 -1
  26. package/dist/customizables/parseAppearance.js.map +1 -1
  27. package/dist/{enableOrganizationsPrompt_ui_338113_1.0.0-snapshot.v20251216175437.js → enableOrganizationsPrompt_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  28. package/dist/{impersonationfab_ui_338113_1.0.0-snapshot.v20251216175437.js → impersonationfab_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/internal/index.d.ts +2 -1
  31. package/dist/internal/index.d.ts.map +1 -1
  32. package/dist/internal/index.js +1 -1
  33. package/dist/internal/index.js.map +1 -1
  34. package/dist/internal/routing.d.ts +13 -0
  35. package/dist/internal/routing.d.ts.map +1 -0
  36. package/dist/{keylessPrompt_ui_338113_1.0.0-snapshot.v20251216175437.js → keylessPrompt_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  37. package/dist/lazyModules/components.d.ts +4 -3
  38. package/dist/lazyModules/components.d.ts.map +1 -1
  39. package/dist/{oauthConsent_ui_338113_1.0.0-snapshot.v20251216175437.js → oauthConsent_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  40. package/dist/{onetap_ui_338113_1.0.0-snapshot.v20251216175437.js → onetap_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  41. package/dist/{op-api-keys-page_ui_338113_1.0.0-snapshot.v20251216175437.js → op-api-keys-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  42. package/dist/{organizationlist_ui_338113_1.0.0-snapshot.v20251216175437.js → organizationlist_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  43. package/dist/{organizationprofile_ui_338113_1.0.0-snapshot.v20251216175437.js → organizationprofile_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  44. package/dist/{organizationswitcher_ui_338113_1.0.0-snapshot.v20251216175437.js → organizationswitcher_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  45. package/dist/{payment-attempt-page_ui_338113_1.0.0-snapshot.v20251216175437.js → payment-attempt-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  46. package/dist/{planDetails_ui_338113_1.0.0-snapshot.v20251216175437.js → planDetails_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  47. package/dist/{prefetchorganizationlist_ui_338113_1.0.0-snapshot.v20251216175437.js → prefetchorganizationlist_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  48. package/dist/{pricingTable_ui_338113_1.0.0-snapshot.v20251216175437.js → pricingTable_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  49. package/dist/{revoke-api-key-modal_ui_338113_1.0.0-snapshot.v20251216175437.js → revoke-api-key-modal_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  50. package/dist/{sessionTasks_ui_338113_1.0.0-snapshot.v20251216175437.js → sessionTasks_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  51. package/dist/signin_ui_7e9f20_1.0.0-snapshot.v20251217165918.js +1 -0
  52. package/dist/{signup_ui_338113_1.0.0-snapshot.v20251216175437.js → signup_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  53. package/dist/{statement-page_ui_338113_1.0.0-snapshot.v20251216175437.js → statement-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  54. package/dist/{subscriptionDetails_ui_338113_1.0.0-snapshot.v20251216175437.js → subscriptionDetails_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  55. package/dist/{taskChooseOrganization_ui_338113_1.0.0-snapshot.v20251216175437.js → taskChooseOrganization_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  56. package/dist/{taskResetPassword_ui_338113_1.0.0-snapshot.v20251216175437.js → taskResetPassword_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/{ui-common_ui_338113_1.0.0-snapshot.v20251216175437.js → ui-common_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +4 -4
  59. package/dist/ui.browser.js +1 -1
  60. package/dist/{up-api-keys-page_ui_338113_1.0.0-snapshot.v20251216175437.js → up-api-keys-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  61. package/dist/{useravatar_ui_338113_1.0.0-snapshot.v20251216175437.js → useravatar_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  62. package/dist/{userbutton_ui_338113_1.0.0-snapshot.v20251216175437.js → userbutton_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  63. package/dist/{userprofile_ui_338113_1.0.0-snapshot.v20251216175437.js → userprofile_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +2 -2
  64. package/dist/{userverification_ui_338113_1.0.0-snapshot.v20251216175437.js → userverification_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  65. package/dist/{waitlist_ui_338113_1.0.0-snapshot.v20251216175437.js → waitlist_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +1 -1
  66. package/package.json +6 -6
  67. package/dist/signin_ui_338113_1.0.0-snapshot.v20251216175437.js +0 -1
  68. /package/dist/{blankcaptcha_ui_338113_1.0.0-snapshot.v20251216175437.js → blankcaptcha_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  69. /package/dist/{copy-api-key-modal_ui_338113_1.0.0-snapshot.v20251216175437.js → copy-api-key-modal_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  70. /package/dist/{framework_ui_338113_1.0.0-snapshot.v20251216175437.js → framework_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  71. /package/dist/{op-billing-page_ui_338113_1.0.0-snapshot.v20251216175437.js → op-billing-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  72. /package/dist/{op-plans-page_ui_338113_1.0.0-snapshot.v20251216175437.js → op-plans-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  73. /package/dist/{up-billing-page_ui_338113_1.0.0-snapshot.v20251216175437.js → up-billing-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  74. /package/dist/{up-plans-page_ui_338113_1.0.0-snapshot.v20251216175437.js → up-plans-page_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
  75. /package/dist/{vendors_ui_338113_1.0.0-snapshot.v20251216175437.js → vendors_ui_7e9f20_1.0.0-snapshot.v20251217165918.js} +0 -0
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["207"],{9e3:function(e,t,i){i.d(t,{v:()=>h});var n=i(4518),r=i(374),a=i(137),o=i(9606),l=i(7288),s=i(6256),d=i(2861),c=i(8272),p=i(4964);let h=()=>{let{data:e,isLoading:t,count:i}=(0,l.wD)(),a=(0,s.N7)();return(0,n.Y)(r.bQ,{page:1,onPageChange:e=>{},itemCount:i,pageCount:1,itemsPerPage:10,isLoading:t,emptyStateLocalizationKey:(0,d.G)(`${a}.billingPage.paymentHistorySection.empty`),headers:[(0,d.G)(`${a}.billingPage.paymentHistorySection.tableHeader__date`),(0,d.G)(`${a}.billingPage.paymentHistorySection.tableHeader__amount`),(0,d.G)(`${a}.billingPage.paymentHistorySection.tableHeader__status`)],rows:e.map(e=>(0,n.Y)(u,{paymentAttempt:e},e.id))})},u=({paymentAttempt:e})=>{let{id:t,amount:i,failedAt:l,paidAt:s,updatedAt:d,status:h}=e,{navigate:u}=(0,p.r)();return(0,n.FD)(r.J2,{onClick:()=>{u(`payment-attempt/${t}`)},children:[(0,n.FD)(c.Td,{sx:{cursor:"pointer"},children:[(0,n.Y)(c.EY,{variant:"subtitle",children:(0,a.Y)(s||l||d,"long")}),(0,n.Y)(c.EY,{colorScheme:"secondary",variant:"caption",truncate:!0,sx:e=>({marginTop:e.space.$0x5}),children:(0,o.W)(t)})]}),(0,n.Y)(c.Td,{sx:{cursor:"pointer"},children:(0,n.FD)(c.EY,{children:[i.currencySymbol,i.amountFormatted]})}),(0,n.Y)(c.Td,{children:(0,n.Y)(c.Ex,{colorScheme:"paid"===h?"success":"failed"===h?"danger":"primary",sx:{textTransform:"capitalize"},children:h})})]})}},3450:function(e,t,i){i.d(t,{pr:()=>_,L6:()=>P,Mo:()=>G,bL:()=>w});var n=i(4518),r=i(5543),a=i(5074),o=i(6088),l=i(3269),s=i(2454),d=i(1475),c=i(3549),p=i(8930),h=i(4468),u=i(6256),g=i(6580),m=i(78),y=i(2861),b=i(8272),$=i(8920);let Y=e=>(0,n.Y)(b.az,{sx:[e=>({height:e.space.$2,width:"100%",borderRadius:e.radii.$md,background:e.colors.$neutralAlpha100}),e.sx]}),f=()=>(0,n.Y)(Y,{sx:e=>({height:e.space.$10,width:"100%"})}),v=e=>(0,n.Y)(b.so,{direction:"col",gap:2,children:e.children}),x=()=>(0,n.Y)(b.az,{"aria-label":"Loading...",sx:{position:"relative",minHeight:0,flex:1,overflowY:"auto"},children:(0,n.FD)(b.so,{direction:"col",gap:5,children:[(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$24})}),(0,n.Y)(f,{})]}),(0,n.FD)(b.xA,{columns:2,gap:4,children:[(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$20})}),(0,n.Y)(f,{})]}),(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$24})}),(0,n.Y)(f,{})]})]}),(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$16})}),(0,n.Y)(f,{})]}),(0,n.FD)(v,{children:[(0,n.Y)(Y,{}),(0,n.Y)(Y,{}),(0,n.Y)(Y,{sx:{width:"66.666667%"}})]})]})}),[D,z]=(0,r.e3)("AddPaymentMethodRoot"),S=({children:e,checkout:t,...i})=>{var o;let l,s=(0,u.XX)(),d=(0,a.useRef)(null),{t:c}=(0,m._)(),[h,b]=(0,a.useState)(void 0),[$,Y]=(0,a.useState)(void 0),[f,v]=(0,a.useState)(void 0),x=(o=d.current,l=(0,g.K)().parsedInternalTheme,(0,a.useMemo)(()=>{if(!o)return;let{colors:e,fontWeights:t,fontSizes:i,radii:n,space:r}=l;return{colorPrimary:(0,p.G3)(o,e.$primary500,e.$colorBackground),colorBackground:(0,p.G3)(o,e.$colorInput,e.$colorBackground),colorText:(0,p.G3)(o,e.$colorForeground,e.$colorBackground),colorTextSecondary:(0,p.G3)(o,e.$colorMutedForeground,e.$colorBackground),colorSuccess:(0,p.G3)(o,e.$success500,e.$colorBackground),colorDanger:(0,p.G3)(o,e.$danger500,e.$colorBackground),colorWarning:(0,p.G3)(o,e.$warning500,e.$colorBackground),fontWeightNormal:(0,p.yJ)(o,"font-weight",t.$normal.toString()),fontWeightMedium:(0,p.yJ)(o,"font-weight",t.$medium.toString()),fontWeightBold:(0,p.yJ)(o,"font-weight",t.$bold.toString()),fontSizeXl:(0,p.yJ)(o,"font-size",i.$xl),fontSizeLg:(0,p.yJ)(o,"font-size",i.$lg),fontSizeSm:(0,p.yJ)(o,"font-size",i.$md),fontSizeXs:(0,p.yJ)(o,"font-size",i.$sm),borderRadius:(0,p.yJ)(o,"border-radius",n.$lg),spacingUnit:(0,p.yJ)(o,"padding",r.$1)}},[l,o]));return(0,n.FD)(D.Provider,{value:{value:{headerTitle:h,headerSubtitle:$,submitLabel:f,setHeaderTitle:b,setHeaderSubtitle:Y,setSubmitLabel:v,checkout:t,...i}},children:[(0,n.Y)("div",{ref:d,style:{display:"none"}}),(0,n.Y)(r.Tn,{checkout:t,for:s,stripeAppearance:x,paymentDescription:c((0,y.G)(t?.planPeriod==="month"?"billing.paymentMethod.applePayDescription.monthly":"billing.paymentMethod.applePayDescription.annual")),children:e})]})},M=e=>{let{isProviderReady:t}=(0,r.Jl)();return t?null:e.children},F=e=>{let{isProviderReady:t}=(0,r.Jl)();return t?(0,n.Y)(n.FK,{children:e.children}):null},w=e=>{let{children:t,...i}=e;return(0,n.FD)(S,{...i,children:[(0,n.Y)(M,{children:(0,n.Y)(b.so,{direction:"row",align:"center",justify:"center",sx:e=>({width:"100%",minHeight:e.sizes.$60}),children:(0,n.Y)(b.y$,{size:"lg",colorScheme:"primary",elementDescriptor:$.$z.spinner})})}),(0,n.Y)(F,{children:(0,n.Y)(k,{children:t})})]})},T=(e,t)=>{(0,a.useRef)(()=>{t(e)}),(0,a.useEffect)(()=>{t(e)},[e,t])},G=({text:e})=>{let{setHeaderTitle:t}=z();return T(e,t),null},P=({text:e})=>{let{setHeaderSubtitle:t}=z();return T(e,t),null},_=({text:e})=>{let{setSubmitLabel:t}=z();return T(e,t),null},k=({children:e})=>{let{headerTitle:t,headerSubtitle:i,submitLabel:a,checkout:p,onSuccess:g,cancelAction:m}=z(),b=(0,l.f0)(),$=(0,u.N7)(),{isFormReady:Y,submit:f,reset:v}=(0,r.Jl)(),D=async e=>{e.preventDefault(),b.setLoading(),b.setError(void 0);let{data:t,error:i}=await f();if(!i)try{await g(t)}catch(e){(0,h.H4)(e,[],b.setError)}finally{b.setIdle(),v()}};return(0,n.Y)(c.M,{headerTitle:t,headerSubtitle:i,children:(0,n.FD)(s.l.Root,{onSubmit:D,sx:e=>({display:"flex",flexDirection:"column",rowGap:e.space.$3}),children:[e,(0,n.Y)(r.cl,{fallback:(0,n.Y)(x,{})}),(0,n.Y)(o.Z.Alert,{children:b.error}),(0,n.Y)(d.G,{isDisabled:!Y,submitLabel:a??(0,y.G)(`${$}.billingPage.paymentMethodsSection.formButtonPrimary__add`),onReset:m,hideReset:!m,sx:{flex:p?1:void 0}})]})})}},3369:function(e,t,i){i.d(t,{O:()=>d});var n=i(4518),r=i(8272),a=i(8920),o=i(2861),l=i(4967),s=i(5203);let d=({paymentMethod:e})=>(0,n.FD)(r.so,{sx:{overflow:"hidden"},gap:2,align:"baseline",elementDescriptor:a.$z.paymentMethodRow,children:[(0,n.Y)(r.In,{icon:"card"===e.paymentType?l.A:s.A,sx:e=>({alignSelf:"center",color:e.colors.$colorMutedForeground}),elementDescriptor:a.$z.paymentMethodRowIcon}),(0,n.Y)(r.EY,{sx:e=>({color:e.colors.$colorForeground,textTransform:"capitalize"}),truncate:!0,elementDescriptor:a.$z.paymentMethodRowType,children:"card"===e.paymentType?e.cardType:e.paymentType}),(0,n.Y)(r.EY,{sx:e=>({color:e.colors.$colorMutedForeground}),variant:"caption",truncate:!0,elementDescriptor:a.$z.paymentMethodRowValue,children:"card"===e.paymentType?`⋯ ${e.last4}`:null}),e.isDefault&&(0,n.Y)(r.Ex,{elementDescriptor:a.$z.paymentMethodRowBadge,elementId:a.$z.paymentMethodRowBadge.setId("default"),localizationKey:(0,o.G)("badge__default")}),"expired"===e.status&&(0,n.Y)(r.Ex,{elementDescriptor:a.$z.paymentMethodRowBadge,elementId:a.$z.paymentMethodRowBadge.setId("expired"),colorScheme:"danger",localizationKey:(0,o.G)("badge__expired")})]})},3365:function(e,t,i){i.d(t,{b:()=>M});var n=i(4518),r=i(5543),a=i(5074),o=i(3269),l=i(2611),s=i(4003),d=i(8080),c=i(4468),p=i(8046),h=i(625),u=i(6256),g=i(7288),m=i(2861),y=i(3453),b=i(2513),$=i(3450),Y=i(3369),f=i(9436),v=i(78),x=i(8272);let D=()=>{let{t:e}=(0,v._)();return(0,n.FD)(x.az,{sx:e=>({background:e.colors.$neutralAlpha50,padding:e.space.$2x5,borderRadius:e.radii.$md,borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,display:"flex",flexDirection:"column",rowGap:e.space.$2,position:"relative"}),children:[(0,n.Y)(x.az,{sx:e=>({position:"absolute",inset:0,background:`repeating-linear-gradient(-45deg,${e.colors.$warningAlpha100},${e.colors.$warningAlpha100} 6px,${e.colors.$warningAlpha150} 6px,${e.colors.$warningAlpha150} 12px)`,maskImage:"linear-gradient(transparent 20%, black)",pointerEvents:"none"})}),(0,n.FD)(x.az,{sx:{display:"flex",alignItems:"baseline",justifyContent:"space-between"},children:[(0,n.Y)(x.EY,{variant:"caption",colorScheme:"body",localizationKey:(0,m.G)("billing.paymentMethod.dev.testCardInfo")}),(0,n.Y)(x.EY,{variant:"caption",sx:e=>({color:e.colors.$warning500,fontWeight:e.fontWeights.$semibold}),localizationKey:(0,m.G)("billing.paymentMethod.dev.developmentMode")})]}),(0,n.FD)(f.p.Root,{children:[(0,n.FD)(f.p.Group,{variant:"tertiary",children:[(0,n.Y)(f.p.Title,{title:(0,m.G)("billing.paymentMethod.dev.cardNumber")}),(0,n.Y)(f.p.Description,{text:"4242 4242 4242 4242"})]}),(0,n.FD)(f.p.Group,{variant:"tertiary",children:[(0,n.Y)(f.p.Title,{title:(0,m.G)("billing.paymentMethod.dev.expirationDate")}),(0,n.Y)(f.p.Description,{text:"11/44"})]}),(0,n.FD)(f.p.Group,{variant:"tertiary",children:[(0,n.Y)(f.p.Title,{title:(0,m.G)("billing.paymentMethod.dev.cvcZip")}),(0,n.Y)(f.p.Description,{text:e((0,m.G)("billing.paymentMethod.dev.anyNumbers"))})]})]})]})},z=(0,o.dm)(({onSuccess:e})=>{let{close:t}=(0,b.D5)(),i=(0,r.ho)(),a=(0,u.XX)(),o=(0,u.N7)(),l=async n=>{let r="organization"===a?i?.organization:i.user;return await r?.addPaymentMethod(n),e(),t(),Promise.resolve()};return(0,n.FD)($.bL,{onSuccess:l,cancelAction:t,children:[(0,n.Y)($.Mo,{text:(0,m.G)(`${o}.billingPage.paymentMethodsSection.add`)}),(0,n.Y)($.L6,{text:(0,m.G)(`${o}.billingPage.paymentMethodsSection.addSubtitle`)}),(0,n.Y)(h.W,{children:(0,n.Y)(D,{})})]})}),S=({paymentMethod:e,revalidate:t})=>{let{close:i}=(0,b.D5)(),l=(0,o.f0)(),s=(0,u.XX)(),d=(0,u.N7)(),h=(0,a.useRef)(`${"card"===e.paymentType?e.cardType:e.paymentType} ${"card"===e.paymentType?`⋯ ${e.last4}`:"-"}`),g=(0,r.Wf)();if(!h.current)return null;let y=async()=>{await e.remove({orgId:"organization"===s?g?.organization?.id:void 0}).then(t).catch(e=>{(0,c.H4)(e,[],l.setError)})};return(0,n.Y)(p.P,{title:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.title`),messageLine1:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.messageLine1`,{identifier:h.current}),messageLine2:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.messageLine2`),successMessage:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.successMessage`,{paymentMethod:h.current}),deleteResource:y,onSuccess:i,onReset:i})},M=(0,o.dm)(()=>{let e=(0,r.ho)(),t=(0,u.XX)(),i=(0,u.N7)(),o="organization"===t?e?.organization:e.user,{data:d,isLoading:c,revalidate:p}=(0,g.mu)(),h=(0,a.useMemo)(()=>d.sort((e,t)=>e.isDefault&&!t.isDefault?-1:1),[d]);return o?(0,n.Y)(s.rd.Root,{title:(0,m.G)(`${i}.billingPage.paymentMethodsSection.title`),centered:!1,id:"paymentMethods",sx:e=>({flex:1,borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100}),children:(0,n.Y)(y.r.Root,{children:(0,n.Y)(s.rd.ItemList,{id:"paymentMethods",disableAnimation:!0,children:c?(0,n.Y)(l.K,{}):(0,n.FD)(n.FK,{children:[h.map(e=>(0,n.FD)(a.Fragment,{children:[(0,n.FD)(s.rd.Item,{id:"paymentMethods",children:[(0,n.Y)(Y.O,{paymentMethod:e}),(0,n.Y)(F,{paymentMethod:e,revalidate:p})]}),(0,n.Y)(y.r.Open,{value:`remove-${e.id}`,children:(0,n.Y)(y.r.Card,{variant:"destructive",children:(0,n.Y)(S,{paymentMethod:e,revalidate:p})})})]},e.id)),(0,n.FD)(n.FK,{children:[(0,n.Y)(y.r.Trigger,{value:"add",children:(0,n.Y)(s.rd.ArrowButton,{id:"paymentMethods",localizationKey:(0,m.G)(`${i}.billingPage.paymentMethodsSection.add`)})}),(0,n.Y)(y.r.Open,{value:"add",children:(0,n.Y)(y.r.Card,{children:(0,n.Y)(z,{onSuccess:p})})})]})]})})})}):null}),F=({paymentMethod:e,revalidate:t})=>{let{open:i}=(0,b.D5)(),a=(0,o.f0)(),l=(0,u.XX)(),s=(0,u.N7)(),p=(0,r.Wf)(),h=[{label:(0,m.G)(`${s}.billingPage.paymentMethodsSection.actionLabel__remove`),isDestructive:!0,onClick:()=>i(`remove-${e.id}`),isDisabled:!e.isRemovable}];return e.isDefault||h.unshift({label:(0,m.G)(`${s}.billingPage.paymentMethodsSection.actionLabel__default`),isDestructive:!1,onClick:()=>{e.makeDefault({orgId:"organization"===l?p?.organization?.id:void 0}).then(t).catch(e=>{(0,c.H4)(e,[],a.setError)})},isDisabled:!1}),(0,n.Y)(d.o,{actions:h})}},7682:function(e,t,i){i.d(t,{T:()=>h});var n=i(4518),r=i(7288),a=i(6256),o=i(374),l=i(137),s=i(2861),d=i(8272),c=i(4964),p=i(9606);let h=()=>{let{data:e,isLoading:t,count:i}=(0,r.eT)(),l=(0,a.N7)();return(0,n.Y)(o.bQ,{page:1,onPageChange:e=>{},itemCount:i,pageCount:1,itemsPerPage:10,isLoading:t,emptyStateLocalizationKey:(0,s.G)(`${l}.billingPage.statementsSection.empty`),headers:[(0,s.G)(`${l}.billingPage.statementsSection.tableHeader__date`),(0,s.G)(`${l}.billingPage.statementsSection.tableHeader__amount`)],rows:e.map(e=>(0,n.Y)(u,{statement:e},e.id))})},u=({statement:e})=>{let{timestamp:t,id:i,totals:{grandTotal:r}}=e,{navigate:a}=(0,c.r)();return(0,n.FD)(o.J2,{onClick:()=>{a(`statement/${i}`)},children:[(0,n.FD)(d.Td,{sx:{cursor:"pointer"},children:[(0,n.Y)(d.EY,{variant:"subtitle",children:(0,l.Y)(t,"monthyear")}),(0,n.Y)(d.EY,{colorScheme:"secondary",variant:"caption",truncate:!0,sx:e=>({marginTop:e.space.$0x5}),children:(0,p.W)(i)})]}),(0,n.Y)(d.Td,{sx:{cursor:"pointer"},children:(0,n.FD)(d.EY,{colorScheme:"secondary",children:[r.currencySymbol,r.amountFormatted]})})]})}},2916:function(e,t,i){i.d(t,{R:()=>$});var n=i(4518),r=i(5074),a=i(7477),o=i(4003),l=i(6256),s=i(7288),d=i(7697),c=i(8272),p=i(2861),h=i(7078),u=i(9679),g=i(8813),m=i(4430),y=i(4964),b=i(3679);function $({title:e,switchPlansLabel:t,newSubscriptionLabel:i,manageSubscriptionLabel:m}){let b=(0,l.N7)(),$=(0,l.XX)(),{subscriptionItems:f}=(0,s.Rs)(),v=(0,a.Fd)(e=>e({permission:"org:sys_billing:manage"}))||"user"===$,{navigate:x}=(0,y.r)(),{commerceSettings:D}=(0,d.O)(),{openSubscriptionDetails:z}=(0,s.D)(),S=D.billing.user.hasPaidPlans&&"user"===$||D.billing.organization.hasPaidPlans&&"organization"===$,M=(0,r.useMemo)(()=>f.some(e=>!e.plan.hasBaseFee&&"active"===e.status),[f]),F=v&&!M&&f.length>0,w=(0,r.useMemo)(()=>f.sort((e,t)=>"active"===e.status&&"active"!==t.status?-1:("active"===t.status&&e.status,1)),[f]);return(0,n.FD)(o.rd.Root,{id:"subscriptionsList",title:e,centered:!1,sx:e=>({borderTop:"none",paddingTop:e.space.$1}),children:[f.length>0&&(0,n.FD)(c.XI,{tableHeadVisuallyHidden:!0,children:[(0,n.Y)(c.d8,{children:(0,n.FD)(c.Tr,{children:[(0,n.Y)(c.Th,{localizationKey:(0,p.G)(`${b}.billingPage.subscriptionsListSection.tableHeader__plan`)}),(0,n.Y)(c.Th,{localizationKey:(0,p.G)(`${b}.billingPage.subscriptionsListSection.tableHeader__startDate`)})]})}),(0,n.Y)(c.NN,{children:w.map(e=>(0,n.Y)(Y,{subscription:e,length:w.length},e.id))})]}),(0,n.FD)(o.rd.ButtonGroup,{id:"subscriptionsList",children:[S?(0,n.Y)(o.rd.ArrowButton,{id:"subscriptionsList",textLocalizationKey:f.length>0?t:i,sx:[e=>({justifyContent:"start",height:e.sizes.$8,width:F?"unset":void 0})],leftIcon:f.length>0?h.A:u.A,rightIcon:null,leftIconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),onClick:()=>void x("plans")}):null,F?(0,n.Y)(o.rd.ArrowButton,{id:"subscriptionsList",textLocalizationKey:m,sx:[e=>({justifyContent:"start",height:e.sizes.$8,width:"unset"})],rightIcon:null,leftIcon:g.A,leftIconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),onClick:e=>z(e)}):null]})]})}function Y({subscription:e,length:t}){let i="annual"===e.planPeriod?e.plan.annualFee:e.plan.fee,{captionForSubscription:a}=(0,s.D)(),o=(0,r.useMemo)(()=>(0,s.Ij)(i.amountFormatted),[i.amountFormatted]);return(0,n.FD)(c.Tr,{children:[(0,n.Y)(c.Td,{children:(0,n.FD)(c.fv,{gap:1,children:[(0,n.FD)(c.so,{align:"center",gap:1,children:[(0,n.Y)(c.In,{icon:m.A,sx:e=>({width:e.sizes.$4,height:e.sizes.$4,opacity:e.opacity.$inactive})}),(0,n.Y)(c.EY,{variant:"subtitle",sx:e=>({marginRight:e.sizes.$1}),children:e.plan.name}),e.isFreeTrial||t>1||e.canceledAt?(0,n.Y)(b.V,{subscription:e.isFreeTrial?{status:"free_trial"}:e}):null]}),(!e.plan.isDefault||"upcoming"===e.status)&&(0,n.Y)(c.EY,{variant:"caption",colorScheme:"secondary",localizationKey:a(e)})]})}),(0,n.Y)(c.Td,{sx:e=>({textAlign:"right"}),children:(0,n.FD)(c.EY,{variant:"subtitle",children:[i.currencySymbol,o,i.amount>0&&(0,n.Y)(c.L9,{sx:e=>({color:e.colors.$colorMutedForeground,textTransform:"lowercase",":before":{content:'"/"',marginInline:e.space.$1}}),localizationKey:"annual"===e.planPeriod?(0,p.G)("billing.year"):(0,p.G)("billing.month")})]})})]},e.id)}},3679:function(e,t,i){i.d(t,{V:()=>s});var n=i(4518),r=i(8272),a=i(2861);let o={active:"badge__activePlan",upcoming:"badge__upcomingPlan",past_due:"badge__pastDuePlan",free_trial:"badge__freeTrial"},l={active:"secondary",upcoming:"primary",past_due:"warning",free_trial:"secondary"},s=({subscription:e,elementDescriptor:t})=>(0,n.Y)(r.Ex,{elementDescriptor:t,colorScheme:l[e.status],localizationKey:(0,a.G)(o[e.status])})}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["207"],{9e3:function(e,t,i){i.d(t,{v:()=>h});var n=i(4518),r=i(374),a=i(137),o=i(9606),l=i(7288),s=i(6256),d=i(2861),c=i(8272),p=i(4964);let h=()=>{let{data:e,isLoading:t,count:i}=(0,l.wD)(),a=(0,s.N7)();return(0,n.Y)(r.bQ,{page:1,onPageChange:e=>{},itemCount:i,pageCount:1,itemsPerPage:10,isLoading:t,emptyStateLocalizationKey:(0,d.G)(`${a}.billingPage.paymentHistorySection.empty`),headers:[(0,d.G)(`${a}.billingPage.paymentHistorySection.tableHeader__date`),(0,d.G)(`${a}.billingPage.paymentHistorySection.tableHeader__amount`),(0,d.G)(`${a}.billingPage.paymentHistorySection.tableHeader__status`)],rows:e.map(e=>(0,n.Y)(u,{paymentAttempt:e},e.id))})},u=({paymentAttempt:e})=>{let{id:t,amount:i,failedAt:l,paidAt:s,updatedAt:d,status:h}=e,{navigate:u}=(0,p.r)();return(0,n.FD)(r.J2,{onClick:()=>{u(`payment-attempt/${t}`)},children:[(0,n.FD)(c.Td,{sx:{cursor:"pointer"},children:[(0,n.Y)(c.EY,{variant:"subtitle",children:(0,a.Y)(s||l||d,"long")}),(0,n.Y)(c.EY,{colorScheme:"secondary",variant:"caption",truncate:!0,sx:e=>({marginTop:e.space.$0x5}),children:(0,o.W)(t)})]}),(0,n.Y)(c.Td,{sx:{cursor:"pointer"},children:(0,n.FD)(c.EY,{children:[i.currencySymbol,i.amountFormatted]})}),(0,n.Y)(c.Td,{children:(0,n.Y)(c.Ex,{colorScheme:"paid"===h?"success":"failed"===h?"danger":"primary",sx:{textTransform:"capitalize"},children:h})})]})}},3450:function(e,t,i){i.d(t,{pr:()=>_,L6:()=>P,Mo:()=>G,bL:()=>w});var n=i(4518),r=i(1210),a=i(5074),o=i(6088),l=i(3269),s=i(2454),d=i(1475),c=i(3549),p=i(8930),h=i(4468),u=i(6256),g=i(6580),m=i(78),y=i(2861),b=i(8272),$=i(8920);let Y=e=>(0,n.Y)(b.az,{sx:[e=>({height:e.space.$2,width:"100%",borderRadius:e.radii.$md,background:e.colors.$neutralAlpha100}),e.sx]}),f=()=>(0,n.Y)(Y,{sx:e=>({height:e.space.$10,width:"100%"})}),v=e=>(0,n.Y)(b.so,{direction:"col",gap:2,children:e.children}),x=()=>(0,n.Y)(b.az,{"aria-label":"Loading...",sx:{position:"relative",minHeight:0,flex:1,overflowY:"auto"},children:(0,n.FD)(b.so,{direction:"col",gap:5,children:[(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$24})}),(0,n.Y)(f,{})]}),(0,n.FD)(b.xA,{columns:2,gap:4,children:[(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$20})}),(0,n.Y)(f,{})]}),(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$24})}),(0,n.Y)(f,{})]})]}),(0,n.FD)(v,{children:[(0,n.Y)(Y,{sx:e=>({height:e.space.$3,width:e.sizes.$16})}),(0,n.Y)(f,{})]}),(0,n.FD)(v,{children:[(0,n.Y)(Y,{}),(0,n.Y)(Y,{}),(0,n.Y)(Y,{sx:{width:"66.666667%"}})]})]})}),[D,z]=(0,r.e3)("AddPaymentMethodRoot"),S=({children:e,checkout:t,...i})=>{var o;let l,s=(0,u.XX)(),d=(0,a.useRef)(null),{t:c}=(0,m._)(),[h,b]=(0,a.useState)(void 0),[$,Y]=(0,a.useState)(void 0),[f,v]=(0,a.useState)(void 0),x=(o=d.current,l=(0,g.K)().parsedInternalTheme,(0,a.useMemo)(()=>{if(!o)return;let{colors:e,fontWeights:t,fontSizes:i,radii:n,space:r}=l;return{colorPrimary:(0,p.G3)(o,e.$primary500,e.$colorBackground),colorBackground:(0,p.G3)(o,e.$colorInput,e.$colorBackground),colorText:(0,p.G3)(o,e.$colorForeground,e.$colorBackground),colorTextSecondary:(0,p.G3)(o,e.$colorMutedForeground,e.$colorBackground),colorSuccess:(0,p.G3)(o,e.$success500,e.$colorBackground),colorDanger:(0,p.G3)(o,e.$danger500,e.$colorBackground),colorWarning:(0,p.G3)(o,e.$warning500,e.$colorBackground),fontWeightNormal:(0,p.yJ)(o,"font-weight",t.$normal.toString()),fontWeightMedium:(0,p.yJ)(o,"font-weight",t.$medium.toString()),fontWeightBold:(0,p.yJ)(o,"font-weight",t.$bold.toString()),fontSizeXl:(0,p.yJ)(o,"font-size",i.$xl),fontSizeLg:(0,p.yJ)(o,"font-size",i.$lg),fontSizeSm:(0,p.yJ)(o,"font-size",i.$md),fontSizeXs:(0,p.yJ)(o,"font-size",i.$sm),borderRadius:(0,p.yJ)(o,"border-radius",n.$lg),spacingUnit:(0,p.yJ)(o,"padding",r.$1)}},[l,o]));return(0,n.FD)(D.Provider,{value:{value:{headerTitle:h,headerSubtitle:$,submitLabel:f,setHeaderTitle:b,setHeaderSubtitle:Y,setSubmitLabel:v,checkout:t,...i}},children:[(0,n.Y)("div",{ref:d,style:{display:"none"}}),(0,n.Y)(r.Tn,{checkout:t,for:s,stripeAppearance:x,paymentDescription:c((0,y.G)(t?.planPeriod==="month"?"billing.paymentMethod.applePayDescription.monthly":"billing.paymentMethod.applePayDescription.annual")),children:e})]})},M=e=>{let{isProviderReady:t}=(0,r.Jl)();return t?null:e.children},F=e=>{let{isProviderReady:t}=(0,r.Jl)();return t?(0,n.Y)(n.FK,{children:e.children}):null},w=e=>{let{children:t,...i}=e;return(0,n.FD)(S,{...i,children:[(0,n.Y)(M,{children:(0,n.Y)(b.so,{direction:"row",align:"center",justify:"center",sx:e=>({width:"100%",minHeight:e.sizes.$60}),children:(0,n.Y)(b.y$,{size:"lg",colorScheme:"primary",elementDescriptor:$.$z.spinner})})}),(0,n.Y)(F,{children:(0,n.Y)(k,{children:t})})]})},T=(e,t)=>{(0,a.useRef)(()=>{t(e)}),(0,a.useEffect)(()=>{t(e)},[e,t])},G=({text:e})=>{let{setHeaderTitle:t}=z();return T(e,t),null},P=({text:e})=>{let{setHeaderSubtitle:t}=z();return T(e,t),null},_=({text:e})=>{let{setSubmitLabel:t}=z();return T(e,t),null},k=({children:e})=>{let{headerTitle:t,headerSubtitle:i,submitLabel:a,checkout:p,onSuccess:g,cancelAction:m}=z(),b=(0,l.f0)(),$=(0,u.N7)(),{isFormReady:Y,submit:f,reset:v}=(0,r.Jl)(),D=async e=>{e.preventDefault(),b.setLoading(),b.setError(void 0);let{data:t,error:i}=await f();if(!i)try{await g(t)}catch(e){(0,h.H4)(e,[],b.setError)}finally{b.setIdle(),v()}};return(0,n.Y)(c.M,{headerTitle:t,headerSubtitle:i,children:(0,n.FD)(s.l.Root,{onSubmit:D,sx:e=>({display:"flex",flexDirection:"column",rowGap:e.space.$3}),children:[e,(0,n.Y)(r.cl,{fallback:(0,n.Y)(x,{})}),(0,n.Y)(o.Z.Alert,{children:b.error}),(0,n.Y)(d.G,{isDisabled:!Y,submitLabel:a??(0,y.G)(`${$}.billingPage.paymentMethodsSection.formButtonPrimary__add`),onReset:m,hideReset:!m,sx:{flex:p?1:void 0}})]})})}},3369:function(e,t,i){i.d(t,{O:()=>d});var n=i(4518),r=i(8272),a=i(8920),o=i(2861),l=i(4967),s=i(5203);let d=({paymentMethod:e})=>(0,n.FD)(r.so,{sx:{overflow:"hidden"},gap:2,align:"baseline",elementDescriptor:a.$z.paymentMethodRow,children:[(0,n.Y)(r.In,{icon:"card"===e.paymentType?l.A:s.A,sx:e=>({alignSelf:"center",color:e.colors.$colorMutedForeground}),elementDescriptor:a.$z.paymentMethodRowIcon}),(0,n.Y)(r.EY,{sx:e=>({color:e.colors.$colorForeground,textTransform:"capitalize"}),truncate:!0,elementDescriptor:a.$z.paymentMethodRowType,children:"card"===e.paymentType?e.cardType:e.paymentType}),(0,n.Y)(r.EY,{sx:e=>({color:e.colors.$colorMutedForeground}),variant:"caption",truncate:!0,elementDescriptor:a.$z.paymentMethodRowValue,children:"card"===e.paymentType?`⋯ ${e.last4}`:null}),e.isDefault&&(0,n.Y)(r.Ex,{elementDescriptor:a.$z.paymentMethodRowBadge,elementId:a.$z.paymentMethodRowBadge.setId("default"),localizationKey:(0,o.G)("badge__default")}),"expired"===e.status&&(0,n.Y)(r.Ex,{elementDescriptor:a.$z.paymentMethodRowBadge,elementId:a.$z.paymentMethodRowBadge.setId("expired"),colorScheme:"danger",localizationKey:(0,o.G)("badge__expired")})]})},3365:function(e,t,i){i.d(t,{b:()=>M});var n=i(4518),r=i(1210),a=i(5074),o=i(3269),l=i(2611),s=i(4003),d=i(8080),c=i(4468),p=i(8046),h=i(625),u=i(6256),g=i(7288),m=i(2861),y=i(3453),b=i(2513),$=i(3450),Y=i(3369),f=i(9436),v=i(78),x=i(8272);let D=()=>{let{t:e}=(0,v._)();return(0,n.FD)(x.az,{sx:e=>({background:e.colors.$neutralAlpha50,padding:e.space.$2x5,borderRadius:e.radii.$md,borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,display:"flex",flexDirection:"column",rowGap:e.space.$2,position:"relative"}),children:[(0,n.Y)(x.az,{sx:e=>({position:"absolute",inset:0,background:`repeating-linear-gradient(-45deg,${e.colors.$warningAlpha100},${e.colors.$warningAlpha100} 6px,${e.colors.$warningAlpha150} 6px,${e.colors.$warningAlpha150} 12px)`,maskImage:"linear-gradient(transparent 20%, black)",pointerEvents:"none"})}),(0,n.FD)(x.az,{sx:{display:"flex",alignItems:"baseline",justifyContent:"space-between"},children:[(0,n.Y)(x.EY,{variant:"caption",colorScheme:"body",localizationKey:(0,m.G)("billing.paymentMethod.dev.testCardInfo")}),(0,n.Y)(x.EY,{variant:"caption",sx:e=>({color:e.colors.$warning500,fontWeight:e.fontWeights.$semibold}),localizationKey:(0,m.G)("billing.paymentMethod.dev.developmentMode")})]}),(0,n.FD)(f.p.Root,{children:[(0,n.FD)(f.p.Group,{variant:"tertiary",children:[(0,n.Y)(f.p.Title,{title:(0,m.G)("billing.paymentMethod.dev.cardNumber")}),(0,n.Y)(f.p.Description,{text:"4242 4242 4242 4242"})]}),(0,n.FD)(f.p.Group,{variant:"tertiary",children:[(0,n.Y)(f.p.Title,{title:(0,m.G)("billing.paymentMethod.dev.expirationDate")}),(0,n.Y)(f.p.Description,{text:"11/44"})]}),(0,n.FD)(f.p.Group,{variant:"tertiary",children:[(0,n.Y)(f.p.Title,{title:(0,m.G)("billing.paymentMethod.dev.cvcZip")}),(0,n.Y)(f.p.Description,{text:e((0,m.G)("billing.paymentMethod.dev.anyNumbers"))})]})]})]})},z=(0,o.dm)(({onSuccess:e})=>{let{close:t}=(0,b.D5)(),i=(0,r.ho)(),a=(0,u.XX)(),o=(0,u.N7)(),l=async n=>{let r="organization"===a?i?.organization:i.user;return await r?.addPaymentMethod(n),e(),t(),Promise.resolve()};return(0,n.FD)($.bL,{onSuccess:l,cancelAction:t,children:[(0,n.Y)($.Mo,{text:(0,m.G)(`${o}.billingPage.paymentMethodsSection.add`)}),(0,n.Y)($.L6,{text:(0,m.G)(`${o}.billingPage.paymentMethodsSection.addSubtitle`)}),(0,n.Y)(h.W,{children:(0,n.Y)(D,{})})]})}),S=({paymentMethod:e,revalidate:t})=>{let{close:i}=(0,b.D5)(),l=(0,o.f0)(),s=(0,u.XX)(),d=(0,u.N7)(),h=(0,a.useRef)(`${"card"===e.paymentType?e.cardType:e.paymentType} ${"card"===e.paymentType?`⋯ ${e.last4}`:"-"}`),g=(0,r.Wf)();if(!h.current)return null;let y=async()=>{await e.remove({orgId:"organization"===s?g?.organization?.id:void 0}).then(t).catch(e=>{(0,c.H4)(e,[],l.setError)})};return(0,n.Y)(p.P,{title:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.title`),messageLine1:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.messageLine1`,{identifier:h.current}),messageLine2:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.messageLine2`),successMessage:(0,m.G)(`${d}.billingPage.paymentMethodsSection.removeMethod.successMessage`,{paymentMethod:h.current}),deleteResource:y,onSuccess:i,onReset:i})},M=(0,o.dm)(()=>{let e=(0,r.ho)(),t=(0,u.XX)(),i=(0,u.N7)(),o="organization"===t?e?.organization:e.user,{data:d,isLoading:c,revalidate:p}=(0,g.mu)(),h=(0,a.useMemo)(()=>d.sort((e,t)=>e.isDefault&&!t.isDefault?-1:1),[d]);return o?(0,n.Y)(s.rd.Root,{title:(0,m.G)(`${i}.billingPage.paymentMethodsSection.title`),centered:!1,id:"paymentMethods",sx:e=>({flex:1,borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100}),children:(0,n.Y)(y.r.Root,{children:(0,n.Y)(s.rd.ItemList,{id:"paymentMethods",disableAnimation:!0,children:c?(0,n.Y)(l.K,{}):(0,n.FD)(n.FK,{children:[h.map(e=>(0,n.FD)(a.Fragment,{children:[(0,n.FD)(s.rd.Item,{id:"paymentMethods",children:[(0,n.Y)(Y.O,{paymentMethod:e}),(0,n.Y)(F,{paymentMethod:e,revalidate:p})]}),(0,n.Y)(y.r.Open,{value:`remove-${e.id}`,children:(0,n.Y)(y.r.Card,{variant:"destructive",children:(0,n.Y)(S,{paymentMethod:e,revalidate:p})})})]},e.id)),(0,n.FD)(n.FK,{children:[(0,n.Y)(y.r.Trigger,{value:"add",children:(0,n.Y)(s.rd.ArrowButton,{id:"paymentMethods",localizationKey:(0,m.G)(`${i}.billingPage.paymentMethodsSection.add`)})}),(0,n.Y)(y.r.Open,{value:"add",children:(0,n.Y)(y.r.Card,{children:(0,n.Y)(z,{onSuccess:p})})})]})]})})})}):null}),F=({paymentMethod:e,revalidate:t})=>{let{open:i}=(0,b.D5)(),a=(0,o.f0)(),l=(0,u.XX)(),s=(0,u.N7)(),p=(0,r.Wf)(),h=[{label:(0,m.G)(`${s}.billingPage.paymentMethodsSection.actionLabel__remove`),isDestructive:!0,onClick:()=>i(`remove-${e.id}`),isDisabled:!e.isRemovable}];return e.isDefault||h.unshift({label:(0,m.G)(`${s}.billingPage.paymentMethodsSection.actionLabel__default`),isDestructive:!1,onClick:()=>{e.makeDefault({orgId:"organization"===l?p?.organization?.id:void 0}).then(t).catch(e=>{(0,c.H4)(e,[],a.setError)})},isDisabled:!1}),(0,n.Y)(d.o,{actions:h})}},7682:function(e,t,i){i.d(t,{T:()=>h});var n=i(4518),r=i(7288),a=i(6256),o=i(374),l=i(137),s=i(2861),d=i(8272),c=i(4964),p=i(9606);let h=()=>{let{data:e,isLoading:t,count:i}=(0,r.eT)(),l=(0,a.N7)();return(0,n.Y)(o.bQ,{page:1,onPageChange:e=>{},itemCount:i,pageCount:1,itemsPerPage:10,isLoading:t,emptyStateLocalizationKey:(0,s.G)(`${l}.billingPage.statementsSection.empty`),headers:[(0,s.G)(`${l}.billingPage.statementsSection.tableHeader__date`),(0,s.G)(`${l}.billingPage.statementsSection.tableHeader__amount`)],rows:e.map(e=>(0,n.Y)(u,{statement:e},e.id))})},u=({statement:e})=>{let{timestamp:t,id:i,totals:{grandTotal:r}}=e,{navigate:a}=(0,c.r)();return(0,n.FD)(o.J2,{onClick:()=>{a(`statement/${i}`)},children:[(0,n.FD)(d.Td,{sx:{cursor:"pointer"},children:[(0,n.Y)(d.EY,{variant:"subtitle",children:(0,l.Y)(t,"monthyear")}),(0,n.Y)(d.EY,{colorScheme:"secondary",variant:"caption",truncate:!0,sx:e=>({marginTop:e.space.$0x5}),children:(0,p.W)(i)})]}),(0,n.Y)(d.Td,{sx:{cursor:"pointer"},children:(0,n.FD)(d.EY,{colorScheme:"secondary",children:[r.currencySymbol,r.amountFormatted]})})]})}},2916:function(e,t,i){i.d(t,{R:()=>$});var n=i(4518),r=i(5074),a=i(7477),o=i(4003),l=i(6256),s=i(7288),d=i(7697),c=i(8272),p=i(2861),h=i(7078),u=i(9679),g=i(8813),m=i(4430),y=i(4964),b=i(3679);function $({title:e,switchPlansLabel:t,newSubscriptionLabel:i,manageSubscriptionLabel:m}){let b=(0,l.N7)(),$=(0,l.XX)(),{subscriptionItems:f}=(0,s.Rs)(),v=(0,a.Fd)(e=>e({permission:"org:sys_billing:manage"}))||"user"===$,{navigate:x}=(0,y.r)(),{commerceSettings:D}=(0,d.O)(),{openSubscriptionDetails:z}=(0,s.D)(),S=D.billing.user.hasPaidPlans&&"user"===$||D.billing.organization.hasPaidPlans&&"organization"===$,M=(0,r.useMemo)(()=>f.some(e=>!e.plan.hasBaseFee&&"active"===e.status),[f]),F=v&&!M&&f.length>0,w=(0,r.useMemo)(()=>f.sort((e,t)=>"active"===e.status&&"active"!==t.status?-1:("active"===t.status&&e.status,1)),[f]);return(0,n.FD)(o.rd.Root,{id:"subscriptionsList",title:e,centered:!1,sx:e=>({borderTop:"none",paddingTop:e.space.$1}),children:[f.length>0&&(0,n.FD)(c.XI,{tableHeadVisuallyHidden:!0,children:[(0,n.Y)(c.d8,{children:(0,n.FD)(c.Tr,{children:[(0,n.Y)(c.Th,{localizationKey:(0,p.G)(`${b}.billingPage.subscriptionsListSection.tableHeader__plan`)}),(0,n.Y)(c.Th,{localizationKey:(0,p.G)(`${b}.billingPage.subscriptionsListSection.tableHeader__startDate`)})]})}),(0,n.Y)(c.NN,{children:w.map(e=>(0,n.Y)(Y,{subscription:e,length:w.length},e.id))})]}),(0,n.FD)(o.rd.ButtonGroup,{id:"subscriptionsList",children:[S?(0,n.Y)(o.rd.ArrowButton,{id:"subscriptionsList",textLocalizationKey:f.length>0?t:i,sx:[e=>({justifyContent:"start",height:e.sizes.$8,width:F?"unset":void 0})],leftIcon:f.length>0?h.A:u.A,rightIcon:null,leftIconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),onClick:()=>void x("plans")}):null,F?(0,n.Y)(o.rd.ArrowButton,{id:"subscriptionsList",textLocalizationKey:m,sx:[e=>({justifyContent:"start",height:e.sizes.$8,width:"unset"})],rightIcon:null,leftIcon:g.A,leftIconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),onClick:e=>z(e)}):null]})]})}function Y({subscription:e,length:t}){let i="annual"===e.planPeriod?e.plan.annualFee:e.plan.fee,{captionForSubscription:a}=(0,s.D)(),o=(0,r.useMemo)(()=>(0,s.Ij)(i.amountFormatted),[i.amountFormatted]);return(0,n.FD)(c.Tr,{children:[(0,n.Y)(c.Td,{children:(0,n.FD)(c.fv,{gap:1,children:[(0,n.FD)(c.so,{align:"center",gap:1,children:[(0,n.Y)(c.In,{icon:m.A,sx:e=>({width:e.sizes.$4,height:e.sizes.$4,opacity:e.opacity.$inactive})}),(0,n.Y)(c.EY,{variant:"subtitle",sx:e=>({marginRight:e.sizes.$1}),children:e.plan.name}),e.isFreeTrial||t>1||e.canceledAt?(0,n.Y)(b.V,{subscription:e.isFreeTrial?{status:"free_trial"}:e}):null]}),(!e.plan.isDefault||"upcoming"===e.status)&&(0,n.Y)(c.EY,{variant:"caption",colorScheme:"secondary",localizationKey:a(e)})]})}),(0,n.Y)(c.Td,{sx:e=>({textAlign:"right"}),children:(0,n.FD)(c.EY,{variant:"subtitle",children:[i.currencySymbol,o,i.amount>0&&(0,n.Y)(c.L9,{sx:e=>({color:e.colors.$colorMutedForeground,textTransform:"lowercase",":before":{content:'"/"',marginInline:e.space.$1}}),localizationKey:"annual"===e.planPeriod?(0,p.G)("billing.year"):(0,p.G)("billing.month")})]})})]},e.id)}},3679:function(e,t,i){i.d(t,{V:()=>s});var n=i(4518),r=i(8272),a=i(2861);let o={active:"badge__activePlan",upcoming:"badge__upcomingPlan",past_due:"badge__pastDuePlan",free_trial:"badge__freeTrial"},l={active:"secondary",upcoming:"primary",past_due:"warning",free_trial:"secondary"},s=({subscription:e,elementDescriptor:t})=>(0,n.Y)(r.Ex,{elementDescriptor:t,colorScheme:l[e.status],localizationKey:(0,a.G)(o[e.status])})}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["217"],{2336:function(e,i,t){t.d(i,{v:()=>S});var r=t(4518),n=t(5543),l=t(5074),a=t(3269),o=t(2454),s=t(1475),d=t(3549),u=t(4468),c=t(8640),f=t(6245),m=t(7697),p=t(2861),h=t(1282),b=t(1421),g=t(4964),P=t(5240),_=t(8272),k=t(8920),v=t(8586);let A=e=>{let{navigate:i}=(0,g.r)(),{email:t,nextStep:n,onReset:o}=e,d=(0,a.f0)(),c=(0,P.B)(),{startEnterpriseSSOLinkFlow:f}=(0,v.q)(t);async function m(){await i(t.verification.externalVerificationRedirectURL?.href||"")}return l.useEffect(()=>{!function(){let{mode:e,componentName:i}=c;f({redirectUrl:"modal"===e?(0,b.j)({url:window.location.href,componentName:i}):window.location.href}).then(()=>n()).catch(e=>(0,u.H4)(e,[],d.setError))}()},[]),(0,r.FD)(r.FK,{children:[(0,r.Y)(_.so,{justify:"center",children:(0,r.Y)(_.$n,{variant:"link",onClick:m,localizationKey:(0,p.G)("userProfile.emailAddressPage.enterpriseSSOLink.formButton")})}),(0,r.Y)(s.c,{children:(0,r.Y)(_.$n,{variant:"ghost",localizationKey:(0,p.G)("userProfile.formButtonReset"),elementDescriptor:k.$z.formButtonReset,onClick:o})})]})};var C=t(393);let S=(0,a.dm)(e=>{let{emailId:i,onSuccess:t,onReset:b,disableAutoFocus:g=!1}=e,P=(0,a.f0)(),{user:_}=(0,n.Jd)(),k=(0,m.O)(),v=(0,n.Wp)(e=>_?.createEmailAddress({email:e})),S=l.useRef(_?.emailAddresses.find(e=>e.id===i)),D=y(S.current,k),F=(0,f.X)({defaultStep:+!!S.current,onNextStep:()=>P.setError(void 0)}),w=(0,c.tJ)("emailAddress","",{type:"email",label:(0,p.G)("formFieldLabel__emailAddress"),placeholder:(0,p.G)("formFieldInputPlaceholder__emailAddress"),isRequired:!0}),R=w.value.length>1&&_?.username!==w.value,T=async e=>{if(e.preventDefault(),_)return v(w.value).then(e=>{S.current=e,F.nextStep()}).catch(e=>(0,u.H4)(e,[w],P.setError))},B=G(D);return(0,r.FD)(f.s,{...F.props,children:[(0,r.Y)(d.M,{headerTitle:e.title||(0,p.G)("userProfile.emailAddressPage.title"),headerSubtitle:e.subtitle||(0,p.G)("userProfile.emailAddressPage.formHint"),children:(0,r.FD)(o.l.Root,{onSubmit:T,children:[(0,r.Y)(o.l.ControlRow,{elementId:w.id,children:(0,r.Y)(o.l.PlainInput,{...w.props,autoFocus:!g})}),(0,r.Y)(s.G,{submitLabel:(0,p.G)("userProfile.formButtonPrimary__add"),isDisabled:!R,onReset:b})]})}),(0,r.FD)(d.M,{headerTitle:(0,p.G)("userProfile.emailAddressPage.verifyTitle"),headerSubtitle:(0,p.G)(`${B}.formSubtitle`,{identifier:S.current?.emailAddress||""}),children:["email_link"===D&&(0,r.Y)(C.o,{nextStep:t,email:S.current,onReset:b}),"email_code"===D&&(0,r.Y)(h.j,{nextStep:t,identification:S.current,identifier:S.current?.emailAddress,prepareVerification:()=>S.current?.prepareVerification({strategy:"email_code"}),onReset:b}),"enterprise_sso"===D&&(0,r.Y)(A,{nextStep:t,email:S.current,onReset:b})]})]})}),G=e=>{switch(e){case"email_code":return"userProfile.emailAddressPage.emailCode";case"enterprise_sso":return"userProfile.emailAddressPage.enterpriseSSOLink";case"email_link":return"userProfile.emailAddressPage.emailLink";default:throw Error(`Unsupported strategy for email verification: ${e}`)}},y=(e,i)=>e?.matchesSsoConnection?"enterprise_sso":!function(e){let{userSettings:i}=e,{email_address:t}=i.attributes;return!!(t?.enabled&&t?.verifications.includes("email_link"))}(i)?"email_code":"email_link"},1282:function(e,i,t){t.d(i,{j:()=>m});var r=t(4518),n=t(5074),l=t(3356),a=t(3269),o=t(2454),s=t(1475),d=t(4468),u=t(2861),c=t(8272),f=t(8920);let m=e=>{let i=(0,a.f0)(),{nextStep:t,identification:m,identifier:p,onReset:h,prepareVerification:b}=e,g=()=>b?.()?.catch(e=>(0,d.H4)(e,[],i.setError)),P=(0,l.xM)({onCodeEntryFinished:(e,i,t)=>{m?.attemptVerification({code:e}).then(()=>i()).catch(t)},onResendCodeClicked:g,onResolve:t});return n.useEffect(()=>{g()},[]),(0,r.FD)(r.FK,{children:[(0,r.Y)(o.l.OTPInput,{...P,label:(0,u.G)("userProfile.emailAddressPage.emailCode.formTitle"),description:(0,u.G)("userProfile.emailAddressPage.emailCode.formSubtitle",{identifier:p||""}),resendButton:(0,u.G)("userProfile.emailAddressPage.emailCode.resendButton"),centerAlign:!1}),(0,r.FD)(s.c,{children:[(0,r.Y)(c.$n,{isLoading:P.isLoading,localizationKey:(0,u.G)("formButtonPrimary__verify"),elementDescriptor:f.$z.formButtonPrimary,onClick:P.onFakeContinue}),(0,r.Y)(c.$n,{variant:"ghost",isDisabled:P.isLoading,localizationKey:(0,u.G)("userProfile.formButtonReset"),elementDescriptor:f.$z.formButtonReset,onClick:h})]})]})}},393:function(e,i,t){t.d(i,{G:()=>P,o:()=>g});var r=t(4518),n=t(5074),l=t(3269),a=t(1475),o=t(2027),s=t(4468),d=t(4979),u=t(8051),c=t(5240),f=t(7697),m=t(2861),p=t(8272),h=t(8920),b=t(2992);let g=e=>{let{email:i,nextStep:t,onReset:d}=e,g=(0,l.f0)(),P=(0,c.B)(),{startEmailLinkFlow:_}=(0,b.u)(i),{displayConfig:k}=(0,f.O)();function v(){let{routing:e}=P,i="virtual"===e?k.userProfileUrl:"";_({redirectUrl:(0,u.lA)({ctx:P,baseUrl:i,intent:"profile"})}).then(()=>t()).catch(e=>(0,s.H4)(e,[],g.setError))}return n.useEffect(()=>{v()},[]),(0,r.FD)(r.FK,{children:[(0,r.Y)(o.i,{resendButton:(0,m.G)("userProfile.emailAddressPage.emailLink.resendButton"),onResendCodeClicked:v}),(0,r.Y)(a.c,{children:(0,r.Y)(p.$n,{variant:"ghost",localizationKey:(0,m.G)("userProfile.formButtonReset"),elementDescriptor:h.$z.formButtonReset,onClick:d})})]})},P=()=>(0,r.Y)(d.$,{title:(0,m.G)("signUp.emailLink.verifiedSwitchTab.title"),subtitle:(0,m.G)("signUp.emailLink.verifiedSwitchTab.subtitle"),status:"verified"})},7288:function(e,i,t){t.d(i,{A$:()=>h,D:()=>b,Ij:()=>d,Rs:()=>p,eT:()=>m,mu:()=>c,wD:()=>f});var r=t(5543),n=t(5074),l=t(7477),a=t(5424),o=t(2861),s=t(6256);function d(e){return e.endsWith(".00")?e.slice(0,-3):e}let u=()=>{let e=(0,s.XX)(),i=(0,l.Fd)(e=>e({permission:"org:sys_billing:read"})||e({permission:"org:sys_billing:manage"})),t=(0,r.Wf)();return{for:e,keepPreviousData:!0,enabled:"organization"!==e||!!t?.organization&&i}},c=()=>{let e=u();return(0,r.X$)(e)},f=()=>{let e=u();return(0,r.t7)(e)},m=e=>{let i=u();return(0,r.tr)({...i,__experimental_mode:e?.mode})},p=()=>{let e=u(),i=(0,r.kH)(e),t=(0,n.useMemo)(()=>i.data?.subscriptionItems||[],[i.data?.subscriptionItems]);return{...i,subscriptionItems:t}},h=e=>{let i=(0,s.XX)();return(0,r.rg)({for:i,initialPage:1,pageSize:50,keepPreviousData:!0,enabled:!0,__experimental_mode:e?.mode})},b=()=>{let e=(0,r.ho)(),{session:i}=(0,r.wV)(),t=(0,s.XX)(),l=(0,n.useMemo)(()=>!!(!e.session||e?.session?.checkAuthorization({permission:"org:sys_billing:manage"})||"user"===t),[e,t]),{subscriptionItems:d,revalidate:u,data:f}=p(),{data:b,revalidate:g}=h({mode:"cache"}),{revalidate:P}=m({mode:"cache"}),{revalidate:_}=c(),k=(0,n.useCallback)(()=>{u(),g(),P(),_()},[u,g,P,_]),v=(0,n.useMemo)(()=>0===d.length||!d.some(e=>!e.canceledAt),[d]),A=(0,n.useCallback)(e=>d.find(i=>i.plan.id===e.id),[d]),C=(0,n.useCallback)(e=>d.filter(i=>i.plan.id===e.id),[d]),S=(0,n.useCallback)((e,i="month")=>{let t=C(e);if(t.length>1){let e=t.find(e=>e.planPeriod===i);return e||t[0]}if(1===t.length)return t[0]},[C]),G=(0,n.useCallback)(({plan:e,subscription:i})=>{let t=i??(e?A(e):void 0);return!t||!t.canceledAt},[A]),y=(0,n.useCallback)(({plan:e,subscription:t,isCompact:r=!1,selectedPlanPeriod:n="annual"})=>{let a=t??(e?S(e,n):void 0),s=n,u=!!e?.annualMonthlyFee;"annual"!==s||u||(s="month");let c=t=>{if(e?.freeTrialEnabled){let t=!i,r=f?.eligibleForFreeTrial;if(t||r)return(0,o.G)("billing.startFreeTrial__days",{days:e.freeTrialDays??0})}return t};return{localizationKey:c((()=>{if(a){if(s!==a.planPeriod&&a.canceledAt){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(u)return(0,o.G)("billing.switchToAnnual")}if(a.canceledAt)return(0,o.G)("billing.reSubscribe");if(s!==a.planPeriod){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(u)return(0,o.G)("billing.switchToAnnual")}return(0,o.G)("billing.manageSubscription")}return d.filter(e=>!e.plan.isDefault).length>0?(0,o.G)("billing.switchPlan"):c((0,o.G)("billing.subscribe"))})()),variant:r?"bordered":"solid",colorScheme:r?"secondary":"primary",isDisabled:!l,disabled:!l}},[S,l,d,f]),D=(0,n.useCallback)(e=>e.pastDueAt?(0,o.G)("badge__pastDueAt",{date:e.pastDueAt}):"upcoming"===e.status?(0,o.G)("badge__startsAt",{date:e.periodStart}):e.canceledAt?(0,o.G)("badge__canceledEndsAt",{date:e.periodEnd}):e.periodEnd?(0,o.G)(e.isFreeTrial?"badge__trialEndsAt":"badge__renewsAt",{date:e.periodEnd}):void 0,[]),F=(0,n.useCallback)(i=>{let r=(0,a.J)("modal",i);e.__internal_openSubscriptionDetails({for:t,onSubscriptionCancel:()=>{k()},portalRoot:r})},[e,t,k]);return{activeOrUpcomingSubscription:A,activeAndUpcomingSubscriptions:C,activeOrUpcomingSubscriptionBasedOnPlanPeriod:S,isDefaultPlanImplicitlyActiveOrUpcoming:v,handleSelectPlan:(0,n.useCallback)(({plan:r,planPeriod:n,mode:l="mounted",event:o,appearance:s,newSubscriptionRedirectUrl:d})=>{let u=(0,a.J)(l,o);e.__internal_openCheckout({planId:r.id,planPeriod:"annual"!==n||r.annualMonthlyFee?n:"month",for:t,onSubscriptionComplete:()=>{k()},onClose:()=>{i?.id&&e.setActive({session:i.id})},appearance:s,portalRoot:u,newSubscriptionRedirectUrl:d})},[e,k,t,i?.id]),openSubscriptionDetails:F,buttonPropsForPlan:y,canManageSubscription:G,captionForSubscription:D,defaultFreePlan:(0,n.useMemo)(()=>b?.find(e=>e.isDefault),[b]),revalidateAll:k}}},6256:function(e,i,t){t.d(i,{N7:()=>o,XX:()=>a,m$:()=>l});var r=t(5074);let n="user",l=(0,r.createContext)(n),a=()=>(0,r.useContext)(l)||n,o=()=>"user"===a()?"userProfile":"organizationProfile"},5240:function(e,i,t){t.d(i,{B:()=>u,M:()=>d});var r=t(5543),n=t(5074),l=t(3121),a=t(4964),o=t(7697),s=t(7288);let d=(0,n.createContext)(null),u=()=>{let e=(0,n.useContext)(d),{queryParams:i}=(0,a.r)(),t=(0,r.ho)(),u=(0,o.O)(),{user:c}=(0,r.Jd)(),f=(0,s.Rs)(),m=(0,s.eT)(),p=f.data?.subscriptionItems.some(e=>e.plan.hasBaseFee),h=u.commerceSettings.billing.user.hasPaidPlans||p||m.data.length>0;if(!e||"UserProfile"!==e.componentName)throw Error("Clerk: useUserProfileContext called outside of the mounted UserProfile component.");let{componentName:b,customPages:g,...P}=e,_=(0,n.useMemo)(()=>(0,l.M)(g||[],t,h,u),[g,h]),k=(0,n.useMemo)(()=>{let{enterpriseSSO:e}=u.userSettings;return!(c&&e.enabled)||!c?.enterpriseAccounts.some(e=>e.active&&e.enterpriseConnection?.disableAdditionalIdentifications)},[c,u.userSettings.enterpriseSSO]);return{...P,pages:_,componentName:b,queryParams:i,authQueryString:"",shouldAllowIdentificationCreation:k,shouldShowBilling:h}}}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["217"],{2336:function(e,i,t){t.d(i,{v:()=>S});var r=t(4518),n=t(1210),l=t(5074),a=t(3269),o=t(2454),s=t(1475),d=t(3549),u=t(4468),c=t(8640),f=t(6245),m=t(7697),p=t(2861),h=t(1282),b=t(1421),g=t(4964),P=t(5240),_=t(8272),k=t(8920),v=t(8586);let A=e=>{let{navigate:i}=(0,g.r)(),{email:t,nextStep:n,onReset:o}=e,d=(0,a.f0)(),c=(0,P.B)(),{startEnterpriseSSOLinkFlow:f}=(0,v.q)(t);async function m(){await i(t.verification.externalVerificationRedirectURL?.href||"")}return l.useEffect(()=>{!function(){let{mode:e,componentName:i}=c;f({redirectUrl:"modal"===e?(0,b.j)({url:window.location.href,componentName:i}):window.location.href}).then(()=>n()).catch(e=>(0,u.H4)(e,[],d.setError))}()},[]),(0,r.FD)(r.FK,{children:[(0,r.Y)(_.so,{justify:"center",children:(0,r.Y)(_.$n,{variant:"link",onClick:m,localizationKey:(0,p.G)("userProfile.emailAddressPage.enterpriseSSOLink.formButton")})}),(0,r.Y)(s.c,{children:(0,r.Y)(_.$n,{variant:"ghost",localizationKey:(0,p.G)("userProfile.formButtonReset"),elementDescriptor:k.$z.formButtonReset,onClick:o})})]})};var C=t(393);let S=(0,a.dm)(e=>{let{emailId:i,onSuccess:t,onReset:b,disableAutoFocus:g=!1}=e,P=(0,a.f0)(),{user:_}=(0,n.Jd)(),k=(0,m.O)(),v=(0,n.Wp)(e=>_?.createEmailAddress({email:e})),S=l.useRef(_?.emailAddresses.find(e=>e.id===i)),D=y(S.current,k),F=(0,f.X)({defaultStep:+!!S.current,onNextStep:()=>P.setError(void 0)}),w=(0,c.tJ)("emailAddress","",{type:"email",label:(0,p.G)("formFieldLabel__emailAddress"),placeholder:(0,p.G)("formFieldInputPlaceholder__emailAddress"),isRequired:!0}),R=w.value.length>1&&_?.username!==w.value,T=async e=>{if(e.preventDefault(),_)return v(w.value).then(e=>{S.current=e,F.nextStep()}).catch(e=>(0,u.H4)(e,[w],P.setError))},B=G(D);return(0,r.FD)(f.s,{...F.props,children:[(0,r.Y)(d.M,{headerTitle:e.title||(0,p.G)("userProfile.emailAddressPage.title"),headerSubtitle:e.subtitle||(0,p.G)("userProfile.emailAddressPage.formHint"),children:(0,r.FD)(o.l.Root,{onSubmit:T,children:[(0,r.Y)(o.l.ControlRow,{elementId:w.id,children:(0,r.Y)(o.l.PlainInput,{...w.props,autoFocus:!g})}),(0,r.Y)(s.G,{submitLabel:(0,p.G)("userProfile.formButtonPrimary__add"),isDisabled:!R,onReset:b})]})}),(0,r.FD)(d.M,{headerTitle:(0,p.G)("userProfile.emailAddressPage.verifyTitle"),headerSubtitle:(0,p.G)(`${B}.formSubtitle`,{identifier:S.current?.emailAddress||""}),children:["email_link"===D&&(0,r.Y)(C.o,{nextStep:t,email:S.current,onReset:b}),"email_code"===D&&(0,r.Y)(h.j,{nextStep:t,identification:S.current,identifier:S.current?.emailAddress,prepareVerification:()=>S.current?.prepareVerification({strategy:"email_code"}),onReset:b}),"enterprise_sso"===D&&(0,r.Y)(A,{nextStep:t,email:S.current,onReset:b})]})]})}),G=e=>{switch(e){case"email_code":return"userProfile.emailAddressPage.emailCode";case"enterprise_sso":return"userProfile.emailAddressPage.enterpriseSSOLink";case"email_link":return"userProfile.emailAddressPage.emailLink";default:throw Error(`Unsupported strategy for email verification: ${e}`)}},y=(e,i)=>e?.matchesSsoConnection?"enterprise_sso":!function(e){let{userSettings:i}=e,{email_address:t}=i.attributes;return!!(t?.enabled&&t?.verifications.includes("email_link"))}(i)?"email_code":"email_link"},1282:function(e,i,t){t.d(i,{j:()=>m});var r=t(4518),n=t(5074),l=t(3356),a=t(3269),o=t(2454),s=t(1475),d=t(4468),u=t(2861),c=t(8272),f=t(8920);let m=e=>{let i=(0,a.f0)(),{nextStep:t,identification:m,identifier:p,onReset:h,prepareVerification:b}=e,g=()=>b?.()?.catch(e=>(0,d.H4)(e,[],i.setError)),P=(0,l.xM)({onCodeEntryFinished:(e,i,t)=>{m?.attemptVerification({code:e}).then(()=>i()).catch(t)},onResendCodeClicked:g,onResolve:t});return n.useEffect(()=>{g()},[]),(0,r.FD)(r.FK,{children:[(0,r.Y)(o.l.OTPInput,{...P,label:(0,u.G)("userProfile.emailAddressPage.emailCode.formTitle"),description:(0,u.G)("userProfile.emailAddressPage.emailCode.formSubtitle",{identifier:p||""}),resendButton:(0,u.G)("userProfile.emailAddressPage.emailCode.resendButton"),centerAlign:!1}),(0,r.FD)(s.c,{children:[(0,r.Y)(c.$n,{isLoading:P.isLoading,localizationKey:(0,u.G)("formButtonPrimary__verify"),elementDescriptor:f.$z.formButtonPrimary,onClick:P.onFakeContinue}),(0,r.Y)(c.$n,{variant:"ghost",isDisabled:P.isLoading,localizationKey:(0,u.G)("userProfile.formButtonReset"),elementDescriptor:f.$z.formButtonReset,onClick:h})]})]})}},393:function(e,i,t){t.d(i,{G:()=>P,o:()=>g});var r=t(4518),n=t(5074),l=t(3269),a=t(1475),o=t(2027),s=t(4468),d=t(4979),u=t(8051),c=t(5240),f=t(7697),m=t(2861),p=t(8272),h=t(8920),b=t(2992);let g=e=>{let{email:i,nextStep:t,onReset:d}=e,g=(0,l.f0)(),P=(0,c.B)(),{startEmailLinkFlow:_}=(0,b.u)(i),{displayConfig:k}=(0,f.O)();function v(){let{routing:e}=P,i="virtual"===e?k.userProfileUrl:"";_({redirectUrl:(0,u.lA)({ctx:P,baseUrl:i,intent:"profile"})}).then(()=>t()).catch(e=>(0,s.H4)(e,[],g.setError))}return n.useEffect(()=>{v()},[]),(0,r.FD)(r.FK,{children:[(0,r.Y)(o.i,{resendButton:(0,m.G)("userProfile.emailAddressPage.emailLink.resendButton"),onResendCodeClicked:v}),(0,r.Y)(a.c,{children:(0,r.Y)(p.$n,{variant:"ghost",localizationKey:(0,m.G)("userProfile.formButtonReset"),elementDescriptor:h.$z.formButtonReset,onClick:d})})]})},P=()=>(0,r.Y)(d.$,{title:(0,m.G)("signUp.emailLink.verifiedSwitchTab.title"),subtitle:(0,m.G)("signUp.emailLink.verifiedSwitchTab.subtitle"),status:"verified"})},7288:function(e,i,t){t.d(i,{A$:()=>h,D:()=>b,Ij:()=>d,Rs:()=>p,eT:()=>m,mu:()=>c,wD:()=>f});var r=t(1210),n=t(5074),l=t(7477),a=t(5424),o=t(2861),s=t(6256);function d(e){return e.endsWith(".00")?e.slice(0,-3):e}let u=()=>{let e=(0,s.XX)(),i=(0,l.Fd)(e=>e({permission:"org:sys_billing:read"})||e({permission:"org:sys_billing:manage"})),t=(0,r.Wf)();return{for:e,keepPreviousData:!0,enabled:"organization"!==e||!!t?.organization&&i}},c=()=>{let e=u();return(0,r.X$)(e)},f=()=>{let e=u();return(0,r.t7)(e)},m=e=>{let i=u();return(0,r.tr)({...i,__experimental_mode:e?.mode})},p=()=>{let e=u(),i=(0,r.kH)(e),t=(0,n.useMemo)(()=>i.data?.subscriptionItems||[],[i.data?.subscriptionItems]);return{...i,subscriptionItems:t}},h=e=>{let i=(0,s.XX)();return(0,r.rg)({for:i,initialPage:1,pageSize:50,keepPreviousData:!0,enabled:!0,__experimental_mode:e?.mode})},b=()=>{let e=(0,r.ho)(),{session:i}=(0,r.wV)(),t=(0,s.XX)(),l=(0,n.useMemo)(()=>!!(!e.session||e?.session?.checkAuthorization({permission:"org:sys_billing:manage"})||"user"===t),[e,t]),{subscriptionItems:d,revalidate:u,data:f}=p(),{data:b,revalidate:g}=h({mode:"cache"}),{revalidate:P}=m({mode:"cache"}),{revalidate:_}=c(),k=(0,n.useCallback)(()=>{u(),g(),P(),_()},[u,g,P,_]),v=(0,n.useMemo)(()=>0===d.length||!d.some(e=>!e.canceledAt),[d]),A=(0,n.useCallback)(e=>d.find(i=>i.plan.id===e.id),[d]),C=(0,n.useCallback)(e=>d.filter(i=>i.plan.id===e.id),[d]),S=(0,n.useCallback)((e,i="month")=>{let t=C(e);if(t.length>1){let e=t.find(e=>e.planPeriod===i);return e||t[0]}if(1===t.length)return t[0]},[C]),G=(0,n.useCallback)(({plan:e,subscription:i})=>{let t=i??(e?A(e):void 0);return!t||!t.canceledAt},[A]),y=(0,n.useCallback)(({plan:e,subscription:t,isCompact:r=!1,selectedPlanPeriod:n="annual"})=>{let a=t??(e?S(e,n):void 0),s=n,u=!!e?.annualMonthlyFee;"annual"!==s||u||(s="month");let c=t=>{if(e?.freeTrialEnabled){let t=!i,r=f?.eligibleForFreeTrial;if(t||r)return(0,o.G)("billing.startFreeTrial__days",{days:e.freeTrialDays??0})}return t};return{localizationKey:c((()=>{if(a){if(s!==a.planPeriod&&a.canceledAt){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(u)return(0,o.G)("billing.switchToAnnual")}if(a.canceledAt)return(0,o.G)("billing.reSubscribe");if(s!==a.planPeriod){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(u)return(0,o.G)("billing.switchToAnnual")}return(0,o.G)("billing.manageSubscription")}return d.filter(e=>!e.plan.isDefault).length>0?(0,o.G)("billing.switchPlan"):c((0,o.G)("billing.subscribe"))})()),variant:r?"bordered":"solid",colorScheme:r?"secondary":"primary",isDisabled:!l,disabled:!l}},[S,l,d,f]),D=(0,n.useCallback)(e=>e.pastDueAt?(0,o.G)("badge__pastDueAt",{date:e.pastDueAt}):"upcoming"===e.status?(0,o.G)("badge__startsAt",{date:e.periodStart}):e.canceledAt?(0,o.G)("badge__canceledEndsAt",{date:e.periodEnd}):e.periodEnd?(0,o.G)(e.isFreeTrial?"badge__trialEndsAt":"badge__renewsAt",{date:e.periodEnd}):void 0,[]),F=(0,n.useCallback)(i=>{let r=(0,a.J)("modal",i);e.__internal_openSubscriptionDetails({for:t,onSubscriptionCancel:()=>{k()},portalRoot:r})},[e,t,k]);return{activeOrUpcomingSubscription:A,activeAndUpcomingSubscriptions:C,activeOrUpcomingSubscriptionBasedOnPlanPeriod:S,isDefaultPlanImplicitlyActiveOrUpcoming:v,handleSelectPlan:(0,n.useCallback)(({plan:r,planPeriod:n,mode:l="mounted",event:o,appearance:s,newSubscriptionRedirectUrl:d})=>{let u=(0,a.J)(l,o);e.__internal_openCheckout({planId:r.id,planPeriod:"annual"!==n||r.annualMonthlyFee?n:"month",for:t,onSubscriptionComplete:()=>{k()},onClose:()=>{i?.id&&e.setActive({session:i.id})},appearance:s,portalRoot:u,newSubscriptionRedirectUrl:d})},[e,k,t,i?.id]),openSubscriptionDetails:F,buttonPropsForPlan:y,canManageSubscription:G,captionForSubscription:D,defaultFreePlan:(0,n.useMemo)(()=>b?.find(e=>e.isDefault),[b]),revalidateAll:k}}},6256:function(e,i,t){t.d(i,{N7:()=>o,XX:()=>a,m$:()=>l});var r=t(5074);let n="user",l=(0,r.createContext)(n),a=()=>(0,r.useContext)(l)||n,o=()=>"user"===a()?"userProfile":"organizationProfile"},5240:function(e,i,t){t.d(i,{B:()=>u,M:()=>d});var r=t(1210),n=t(5074),l=t(3121),a=t(4964),o=t(7697),s=t(7288);let d=(0,n.createContext)(null),u=()=>{let e=(0,n.useContext)(d),{queryParams:i}=(0,a.r)(),t=(0,r.ho)(),u=(0,o.O)(),{user:c}=(0,r.Jd)(),f=(0,s.Rs)(),m=(0,s.eT)(),p=f.data?.subscriptionItems.some(e=>e.plan.hasBaseFee),h=u.commerceSettings.billing.user.hasPaidPlans||p||m.data.length>0;if(!e||"UserProfile"!==e.componentName)throw Error("Clerk: useUserProfileContext called outside of the mounted UserProfile component.");let{componentName:b,customPages:g,...P}=e,_=(0,n.useMemo)(()=>(0,l.M)(g||[],t,h,u),[g,h]),k=(0,n.useMemo)(()=>{let{enterpriseSSO:e}=u.userSettings;return!(c&&e.enabled)||!c?.enterpriseAccounts.some(e=>e.active&&e.enterpriseConnection?.disableAdditionalIdentifications)},[c,u.userSettings.enterpriseSSO]);return{...P,pages:_,componentName:b,queryParams:i,authQueryString:"",shouldAllowIdentificationCreation:k,shouldShowBilling:h}}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["360"],{8188:function(e,t,r){r.d(t,{l:()=>i,w:()=>a});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"APIKeys"!==e.componentName)throw Error("Clerk: useAPIKeysContext called outside APIKeys.");let{componentName:t,...r}=e;return{...r,componentName:t}}},1:function(e,t,r){r.d(t,{$:()=>o,W:()=>s});var n=r(5074),a=r(7697),i=r(4964),l=r(2117);let o=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(o),{navigate:t}=(0,i.r)(),{displayConfig:r}=(0,a.O)();if(!e||"CreateOrganization"!==e.componentName)throw Error("Clerk: useCreateOrganizationContext called outside CreateOrganization.");let{componentName:s,...u}=e;return{...u,skipInvitationScreen:u.skipInvitationScreen||!1,navigateAfterCreateOrganization:e=>"function"==typeof u.afterCreateOrganizationUrl?t(u.afterCreateOrganizationUrl(e)):u.afterCreateOrganizationUrl?t((0,l.tR)({urlWithParam:u.afterCreateOrganizationUrl,entity:e})):t(r.afterCreateOrganizationUrl),componentName:s}}},7032:function(e,t,r){r.d(t,{H:()=>c,Q:()=>u});var n=r(8380),a=r(4173),i=r(5074),l=r(2366),o=r(7697),s=r(4964);let u=(0,i.createContext)(null),c=()=>{let e=(0,i.useContext)(u),t=(0,l.II)(),{displayConfig:r}=(0,o.O)(),{queryParams:c}=(0,s.r)();if(!e||"GoogleOneTap"!==e.componentName)throw Error("Clerk: useGoogleOneTapContext called outside GoogleOneTap.");let{componentName:g,...d}=e,f=(0,i.useCallback)(e=>{let i=new n.n(t,{...d,signInFallbackRedirectUrl:e,signUpFallbackRedirectUrl:e},c),l=t.signUpUrl||r.signUpUrl,o=t.signInUrl||r.signInUrl,s=i.getPreservedSearchParams();o=(0,a.kZ)({base:o,hashSearchParams:[c,s]},{stringify:!0}),l=(0,a.kZ)({base:l,hashSearchParams:[c,s]},{stringify:!0});let u=i.getAfterSignInUrl(),g=i.getAfterSignUpUrl(),f=(0,a.kZ)({base:l,hashPath:"/continue",hashSearch:new URLSearchParams({sign_up_force_redirect_url:g}).toString()},{stringify:!0}),h=(0,a.kZ)({base:o,hashPath:"/factor-one",hashSearch:new URLSearchParams({sign_in_force_redirect_url:u}).toString()},{stringify:!0}),U=(0,a.kZ)({base:o,hashPath:"/factor-two",hashSearch:new URLSearchParams({sign_in_force_redirect_url:u}).toString()},{stringify:!0});return{signInUrl:o,signUpUrl:l,firstFactorUrl:h,secondFactorUrl:U,continueSignUpUrl:f,signInForceRedirectUrl:u,signUpForceRedirectUrl:g}},[d,r.signInUrl,r.signUpUrl,t,c]);return{...d,componentName:g,generateCallbackUrls:f}}},2121:function(e,t,r){r.d(t,{W:()=>i,n:()=>a});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(null===e)throw Error("Clerk: useOAuthConsentContext called outside of the mounted OAuthConsent component.");return e}},9953:function(e,t,r){r.d(t,{e:()=>s,f:()=>o});var n=r(5074),a=r(7697),i=r(4964),l=r(2117);let o=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(o),{navigate:t}=(0,i.r)(),{displayConfig:r,organizationSettings:s}=(0,a.O)();if(!e||"OrganizationList"!==e.componentName)throw Error("Clerk: useOrganizationListContext called outside OrganizationList.");let{componentName:u,...c}=e,g=c.afterCreateOrganizationUrl||r.afterCreateOrganizationUrl,d=({organization:e,user:r})=>"function"==typeof c.afterSelectPersonalUrl&&r?t(c.afterSelectPersonalUrl(r)):"function"==typeof c.afterSelectOrganizationUrl&&e?t(c.afterSelectOrganizationUrl(e)):c.afterSelectPersonalUrl&&r?t((0,l.tR)({urlWithParam:c.afterSelectPersonalUrl,entity:r})):c.afterSelectOrganizationUrl&&e?t((0,l.tR)({urlWithParam:c.afterSelectOrganizationUrl,entity:e})):Promise.resolve();return{...c,afterCreateOrganizationUrl:g,skipInvitationScreen:c.skipInvitationScreen||!1,hidePersonal:s.forceOrganizationSelection||c.hidePersonal||!1,navigateAfterCreateOrganization:e=>"function"==typeof c.afterCreateOrganizationUrl?t(c.afterCreateOrganizationUrl(e)):c.afterCreateOrganizationUrl?t((0,l.tR)({urlWithParam:c.afterCreateOrganizationUrl,entity:e})):t(r.afterCreateOrganizationUrl),navigateAfterSelectOrganization:e=>d({organization:e}),navigateAfterSelectPersonal:e=>d({user:e}),componentName:u}}},5892:function(e,t,r){r.d(t,{V:()=>g,o:()=>c});var n=r(5543),a=r(5074),i=r(3121),l=r(1227),o=r(4964),s=r(7697),u=r(7288);let c=(0,a.createContext)(null),g=()=>{let e=(0,a.useContext)(c),{navigate:t}=(0,o.r)(),r=(0,s.O)(),g=(0,n.ho)();if(!e||"OrganizationProfile"!==e.componentName)throw Error("Clerk: useOrganizationProfileContext called outside OrganizationProfile.");let{componentName:d,customPages:f,...h}=e,U=(0,u.Rs)(),m=(0,u.eT)(),p=U.data?.subscriptionItems.some(e=>e.plan.hasBaseFee),C=r.commerceSettings.billing.organization.hasPaidPlans||p||m.data.length>0,S=(0,a.useMemo)(()=>(0,i.q)(f||[],g,C,r),[f,C]),P=S.routes[0].id===l.jc.MEMBERS,b=S.routes[0].id===l.jc.GENERAL,O=S.routes[0].id===l.jc.BILLING,k=S.routes[0].id===l.jc.API_KEYS;return{...h,pages:S,navigateAfterLeaveOrganization:()=>t(h.afterLeaveOrganizationUrl||r.displayConfig.afterLeaveOrganizationUrl),componentName:d,navigateToGeneralPageRoot:()=>t(b?"../":P?"./organization-general":"../organization-general"),isMembersPageRoot:P,isGeneralPageRoot:b,isBillingPageRoot:O,isAPIKeysPageRoot:k,shouldShowBilling:C}}},2826:function(e,t,r){r.d(t,{U:()=>o,l:()=>s});var n=r(5074),a=r(7697),i=r(4964),l=r(2117);let o=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(o),{navigate:t}=(0,i.r)(),{displayConfig:r,organizationSettings:s}=(0,a.O)();if(!e||"OrganizationSwitcher"!==e.componentName)throw Error("Clerk: useOrganizationSwitcherContext called outside OrganizationSwitcher.");let{componentName:u,...c}=e,g=c.afterCreateOrganizationUrl||r.afterCreateOrganizationUrl,d=c.afterLeaveOrganizationUrl||r.afterLeaveOrganizationUrl,f=({organization:e,user:r})=>{let n=h({organization:e,user:r});return n?t(n):Promise.resolve()},h=({organization:e,user:t})=>"function"==typeof c.afterSelectPersonalUrl&&t?c.afterSelectPersonalUrl(t):"function"==typeof c.afterSelectOrganizationUrl&&e?c.afterSelectOrganizationUrl(e):c.afterSelectPersonalUrl&&t?(0,l.tR)({urlWithParam:c.afterSelectPersonalUrl,entity:t}):c.afterSelectOrganizationUrl&&e?(0,l.tR)({urlWithParam:c.afterSelectOrganizationUrl,entity:e}):void 0,U=c.organizationProfileUrl&&!c.organizationProfileMode?"navigation":c.organizationProfileMode,m=c.createOrganizationUrl&&!c.createOrganizationMode?"navigation":c.createOrganizationMode;return{...c,hidePersonal:s.forceOrganizationSelection||c.hidePersonal||!1,organizationProfileMode:U||"modal",createOrganizationMode:m||"modal",skipInvitationScreen:c.skipInvitationScreen||!1,afterCreateOrganizationUrl:g,afterLeaveOrganizationUrl:d,navigateOrganizationProfile:()=>t(c.organizationProfileUrl||r.organizationProfileUrl),navigateCreateOrganization:()=>t(c.createOrganizationUrl||r.createOrganizationUrl),navigateAfterSelectOrganization:e=>f({organization:e}),navigateAfterSelectPersonal:e=>f({user:e}),afterSelectOrganizationUrl:e=>h({organization:e}),afterSelectPersonalUrl:e=>h({user:e}),componentName:u}}},7288:function(e,t,r){r.d(t,{A$:()=>U,D:()=>m,Ij:()=>u,Rs:()=>h,eT:()=>f,mu:()=>g,wD:()=>d});var n=r(5543),a=r(5074),i=r(7477),l=r(5424),o=r(2861),s=r(6256);function u(e){return e.endsWith(".00")?e.slice(0,-3):e}let c=()=>{let e=(0,s.XX)(),t=(0,i.Fd)(e=>e({permission:"org:sys_billing:read"})||e({permission:"org:sys_billing:manage"})),r=(0,n.Wf)();return{for:e,keepPreviousData:!0,enabled:"organization"!==e||!!r?.organization&&t}},g=()=>{let e=c();return(0,n.X$)(e)},d=()=>{let e=c();return(0,n.t7)(e)},f=e=>{let t=c();return(0,n.tr)({...t,__experimental_mode:e?.mode})},h=()=>{let e=c(),t=(0,n.kH)(e),r=(0,a.useMemo)(()=>t.data?.subscriptionItems||[],[t.data?.subscriptionItems]);return{...t,subscriptionItems:r}},U=e=>{let t=(0,s.XX)();return(0,n.rg)({for:t,initialPage:1,pageSize:50,keepPreviousData:!0,enabled:!0,__experimental_mode:e?.mode})},m=()=>{let e=(0,n.ho)(),{session:t}=(0,n.wV)(),r=(0,s.XX)(),i=(0,a.useMemo)(()=>!!(!e.session||e?.session?.checkAuthorization({permission:"org:sys_billing:manage"})||"user"===r),[e,r]),{subscriptionItems:u,revalidate:c,data:d}=h(),{data:m,revalidate:p}=U({mode:"cache"}),{revalidate:C}=f({mode:"cache"}),{revalidate:S}=g(),P=(0,a.useCallback)(()=>{c(),p(),C(),S()},[c,p,C,S]),b=(0,a.useMemo)(()=>0===u.length||!u.some(e=>!e.canceledAt),[u]),O=(0,a.useCallback)(e=>u.find(t=>t.plan.id===e.id),[u]),k=(0,a.useCallback)(e=>u.filter(t=>t.plan.id===e.id),[u]),z=(0,a.useCallback)((e,t="month")=>{let r=k(e);if(r.length>1){let e=r.find(e=>e.planPeriod===t);return e||r[0]}if(1===r.length)return r[0]},[k]),v=(0,a.useCallback)(({plan:e,subscription:t})=>{let r=t??(e?O(e):void 0);return!r||!r.canceledAt},[O]),x=(0,a.useCallback)(({plan:e,subscription:r,isCompact:n=!1,selectedPlanPeriod:a="annual"})=>{let l=r??(e?z(e,a):void 0),s=a,c=!!e?.annualMonthlyFee;"annual"!==s||c||(s="month");let g=r=>{if(e?.freeTrialEnabled){let r=!t,n=d?.eligibleForFreeTrial;if(r||n)return(0,o.G)("billing.startFreeTrial__days",{days:e.freeTrialDays??0})}return r};return{localizationKey:g((()=>{if(l){if(s!==l.planPeriod&&l.canceledAt){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(c)return(0,o.G)("billing.switchToAnnual")}if(l.canceledAt)return(0,o.G)("billing.reSubscribe");if(s!==l.planPeriod){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(c)return(0,o.G)("billing.switchToAnnual")}return(0,o.G)("billing.manageSubscription")}return u.filter(e=>!e.plan.isDefault).length>0?(0,o.G)("billing.switchPlan"):g((0,o.G)("billing.subscribe"))})()),variant:n?"bordered":"solid",colorScheme:n?"secondary":"primary",isDisabled:!i,disabled:!i}},[z,i,u,d]),I=(0,a.useCallback)(e=>e.pastDueAt?(0,o.G)("badge__pastDueAt",{date:e.pastDueAt}):"upcoming"===e.status?(0,o.G)("badge__startsAt",{date:e.periodStart}):e.canceledAt?(0,o.G)("badge__canceledEndsAt",{date:e.periodEnd}):e.periodEnd?(0,o.G)(e.isFreeTrial?"badge__trialEndsAt":"badge__renewsAt",{date:e.periodEnd}):void 0,[]),_=(0,a.useCallback)(t=>{let n=(0,l.J)("modal",t);e.__internal_openSubscriptionDetails({for:r,onSubscriptionCancel:()=>{P()},portalRoot:n})},[e,r,P]);return{activeOrUpcomingSubscription:O,activeAndUpcomingSubscriptions:k,activeOrUpcomingSubscriptionBasedOnPlanPeriod:z,isDefaultPlanImplicitlyActiveOrUpcoming:b,handleSelectPlan:(0,a.useCallback)(({plan:n,planPeriod:a,mode:i="mounted",event:o,appearance:s,newSubscriptionRedirectUrl:u})=>{let c=(0,l.J)(i,o);e.__internal_openCheckout({planId:n.id,planPeriod:"annual"!==a||n.annualMonthlyFee?a:"month",for:r,onSubscriptionComplete:()=>{P()},onClose:()=>{t?.id&&e.setActive({session:t.id})},appearance:s,portalRoot:c,newSubscriptionRedirectUrl:u})},[e,P,r,t?.id]),openSubscriptionDetails:_,buttonPropsForPlan:x,canManageSubscription:v,captionForSubscription:I,defaultFreePlan:(0,a.useMemo)(()=>m?.find(e=>e.isDefault),[m]),revalidateAll:P}}},164:function(e,t,r){r.d(t,{T:()=>i,a:()=>a});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"PricingTable"!==e.componentName)throw Error("Clerk: usePricingTableContext called outside PricingTable.");let{componentName:t,...r}=e;return{...r,componentName:t}}},1616:function(e,t,r){r.d(t,{O_:()=>g,lY:()=>s,pq:()=>c,qx:()=>l,u3:()=>u,z1:()=>o});var n=r(5580),a=r(5074),i=r(4964);let l=(0,a.createContext)(null),o=()=>{let e=(0,a.useContext)(l),{navigate:t,basePath:r,startPath:o}=(0,i.r)();if(null===e)throw Error("Clerk: useSessionTasksContext called outside of the mounted SessionTasks component.");let s=async({session:e,redirectUrlComplete:a})=>{let i=e.currentTask;if(!i)return t(a);let l=(0,n.ru)(i);return t(`/${r+o+l}`)};return{...e,navigateOnSetActive:s}},s=(0,a.createContext)(null),u=()=>{let e=(0,a.useContext)(s);if(null===e)throw Error("Clerk: useTaskChooseOrganizationContext called outside of the mounted TaskChooseOrganization component.");return e},c=(0,a.createContext)(null),g=()=>{let e=(0,a.useContext)(c);if(null===e)throw Error("Clerk: useTaskResetPasswordContext called outside of the mounted TaskResetPassword component.");return e}},4:function(e,t,r){r.d(t,{Q:()=>U,r:()=>m});var n=r(2166),a=r(8380),i=r(5580),l=r(4173),o=r(5543),s=r(5993),u=r(5074),c=r(8051),g=r(7697),d=r(2366),f=r(4964),h=r(2117);let U=(0,u.createContext)(null),m=()=>{let e=(0,u.useContext)(U),{navigate:t,basePath:r,startPath:m}=(0,f.r)(),{displayConfig:p,userSettings:C}=(0,g.O)(),{queryParams:S,queryString:P}=(0,f.r)(),b=C.signUp.mode,O=(0,d.II)(),k=(0,o.ho)();if(null===e||"SignIn"!==e.componentName)throw Error("Clerk: useSignInContext called outside of the mounted SignIn component.");let z="restricted"!==b&&!!(!O.signUpUrl&&O.signInUrl&&!(0,s.s)(O.signInUrl))&&!1!==e.withSignUp||e.withSignUp||!1,{componentName:v,mode:x,...I}=e,_=(0,u.useMemo)(()=>(0,h.tf)(P,n.u),[]),w=new a.n(O,{...I,signInFallbackRedirectUrl:I.signInFallbackRedirectUrl||I.fallbackRedirectUrl,signInForceRedirectUrl:I.signInForceRedirectUrl||I.forceRedirectUrl},S,x);delete I.fallbackRedirectUrl,delete I.forceRedirectUrl;let A=k.buildUrlWithAuth(w.getAfterSignInUrl()),y=k.buildUrlWithAuth(w.getAfterSignUpUrl()),T="path"===I.routing&&I.path||O.signInUrl||p.signInUrl,E=z?"path"===I.routing&&I.path||O.signUpUrl||p.signUpUrl:I.signUpUrl||O.signUpUrl||p.signUpUrl,M=I.waitlistUrl||O.waitlistUrl||p.waitlistUrl,R=w.getPreservedSearchParams();T=(0,l.kZ)({base:T,hashSearchParams:[S,R]},{stringify:!0}),E=(0,l.kZ)({base:E,hashSearchParams:[S,R]},{stringify:!0}),M=(0,l.kZ)({base:M,hashSearchParams:[S,R]},{stringify:!0});let G=w.toSearchParams().toString(),F=(0,c.aQ)({routing:I.routing,baseUrl:E,authQueryString:G,path:I.path,endpoint:z?"/create"+c.Vu:c.Vu}),N=(0,c.aQ)({routing:I.routing,baseUrl:E,authQueryString:G,path:I.path,endpoint:z?"/create"+c.aB:c.aB});z&&(E=(0,l.kZ)({base:T,hashPath:"/create",hashSearchParams:[S,R]},{stringify:!0}));let W=(0,l.kZ)({base:E,hashPath:"/continue"},{stringify:!0}),L=async({session:e,redirectUrl:n})=>{let a=e.currentTask;if(!a)return t(n);let l=(0,i.ru)(a);return t(`/${r+m+(z?"/create"+l:l)}`)},D=k.session?.currentTask?k.__internal_getOption("taskUrls")?.[k.session?.currentTask.key]??(0,c.aQ)({routing:I.routing,baseUrl:T,authQueryString:G,path:I.path,endpoint:z?"/create"+(0,i.ru)(k.session?.currentTask):(0,i.ru)(k.session?.currentTask)}):null;return{...I,transferable:I.transferable??!0,oauthFlow:I.oauthFlow||"auto",componentName:v,signUpUrl:E,signInUrl:T,waitlistUrl:M,afterSignInUrl:A,afterSignUpUrl:y,emailLinkRedirectUrl:F,ssoCallbackUrl:N,navigateAfterSignIn:()=>t(A),signUpContinueUrl:W,queryParams:S,initialValues:{...I.initialValues,..._},authQueryString:G,isCombinedFlow:z,navigateOnSetActive:L,taskUrl:D}}},6256:function(e,t,r){r.d(t,{N7:()=>o,XX:()=>l,m$:()=>i});var n=r(5074);let a="user",i=(0,n.createContext)(a),l=()=>(0,n.useContext)(i)||a,o=()=>"user"===l()?"userProfile":"organizationProfile"},3620:function(e,t,r){r.d(t,{E:()=>a,d:()=>i});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"UserAvatar"!==e.componentName)throw Error("Clerk: useUserAvatarContext called outside UserAvatar.");let{componentName:t,...r}=e;return{...r,componentName:t}}},9233:function(e,t,r){r.d(t,{P:()=>u,Y:()=>c});var n=r(5543),a=r(5074),i=r(856),l=r(7697),o=r(2366),s=r(4964);let u=(0,a.createContext)(null),c=()=>{let e=(0,a.useContext)(u),t=(0,n.ho)(),{navigate:r}=(0,s.r)(),{displayConfig:c}=(0,l.O)(),g=(0,o.II)();if(!e||"UserButton"!==e.componentName)throw Error("Clerk: useUserButtonContext called outside of the mounted UserButton component.");let{componentName:d,customMenuItems:f,...h}=e,U=h.signInUrl||g.signInUrl||c.signInUrl,m=h.userProfileUrl||c.userProfileUrl,p=t.buildAfterSignOutUrl(),C=t.buildAfterMultiSessionSingleSignOutUrl(),S=h.afterSwitchSessionUrl||c.afterSwitchSessionUrl,P=h.userProfileUrl&&!h.userProfileMode?"navigation":h.userProfileMode,b=(0,a.useMemo)(()=>(0,i.K)(f||[],t),[]);return{...h,componentName:d,navigateAfterMultiSessionSingleSignOut:()=>t.redirectWithAuth(C),navigateAfterSignOut:()=>r(p),signInUrl:U,userProfileUrl:m,afterMultiSessionSingleSignOutUrl:C,afterSignOutUrl:p,afterSwitchSessionUrl:S,userProfileMode:P||"modal",menutItems:b}}},5240:function(e,t,r){r.d(t,{B:()=>c,M:()=>u});var n=r(5543),a=r(5074),i=r(3121),l=r(4964),o=r(7697),s=r(7288);let u=(0,a.createContext)(null),c=()=>{let e=(0,a.useContext)(u),{queryParams:t}=(0,l.r)(),r=(0,n.ho)(),c=(0,o.O)(),{user:g}=(0,n.Jd)(),d=(0,s.Rs)(),f=(0,s.eT)(),h=d.data?.subscriptionItems.some(e=>e.plan.hasBaseFee),U=c.commerceSettings.billing.user.hasPaidPlans||h||f.data.length>0;if(!e||"UserProfile"!==e.componentName)throw Error("Clerk: useUserProfileContext called outside of the mounted UserProfile component.");let{componentName:m,customPages:p,...C}=e,S=(0,a.useMemo)(()=>(0,i.M)(p||[],r,U,c),[p,U]),P=(0,a.useMemo)(()=>{let{enterpriseSSO:e}=c.userSettings;return!(g&&e.enabled)||!g?.enterpriseAccounts.some(e=>e.active&&e.enterpriseConnection?.disableAdditionalIdentifications)},[g,c.userSettings.enterpriseSSO]);return{...C,pages:S,componentName:m,queryParams:t,authQueryString:"",shouldAllowIdentificationCreation:P,shouldShowBilling:U}}},9078:function(e,t,r){r.d(t,{_:()=>a,k:()=>i});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"UserVerification"!==e.componentName)throw Error("Clerk: useUserVerificationContext called outside of the mounted UserVerification component.");let{componentName:t,...r}=e;return{...r,componentName:t}}},451:function(e,t,r){r.d(t,{Y:()=>g,r:()=>c});var n=r(4173),a=r(5074),i=r(7697),l=r(2366),o=r(4964),s=r(2117);let u=["email_address"],c=(0,a.createContext)(null),g=()=>{let e=(0,a.useContext)(c),{displayConfig:t}=(0,i.O)(),r=(0,l.II)(),{queryString:g}=(0,o.r)(),d=(0,a.useMemo)(()=>(0,s.tf)(g,u),[]);if(!e||"Waitlist"!==e.componentName)throw Error("Clerk: useWaitlistContext called outside Waitlist.");let{componentName:f,...h}=e,U=h.signInUrl||r.signInUrl||t.signInUrl;return U=(0,n.kZ)({base:U},{stringify:!0}),{...h,componentName:f,signInUrl:U,initialValues:{...d}}}}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["360"],{8188:function(e,t,r){r.d(t,{l:()=>i,w:()=>a});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"APIKeys"!==e.componentName)throw Error("Clerk: useAPIKeysContext called outside APIKeys.");let{componentName:t,...r}=e;return{...r,componentName:t}}},1:function(e,t,r){r.d(t,{$:()=>o,W:()=>s});var n=r(5074),a=r(7697),i=r(4964),l=r(2117);let o=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(o),{navigate:t}=(0,i.r)(),{displayConfig:r}=(0,a.O)();if(!e||"CreateOrganization"!==e.componentName)throw Error("Clerk: useCreateOrganizationContext called outside CreateOrganization.");let{componentName:s,...u}=e;return{...u,skipInvitationScreen:u.skipInvitationScreen||!1,navigateAfterCreateOrganization:e=>"function"==typeof u.afterCreateOrganizationUrl?t(u.afterCreateOrganizationUrl(e)):u.afterCreateOrganizationUrl?t((0,l.tR)({urlWithParam:u.afterCreateOrganizationUrl,entity:e})):t(r.afterCreateOrganizationUrl),componentName:s}}},7032:function(e,t,r){r.d(t,{H:()=>c,Q:()=>u});var n=r(8380),a=r(4173),i=r(5074),l=r(2366),o=r(7697),s=r(4964);let u=(0,i.createContext)(null),c=()=>{let e=(0,i.useContext)(u),t=(0,l.II)(),{displayConfig:r}=(0,o.O)(),{queryParams:c}=(0,s.r)();if(!e||"GoogleOneTap"!==e.componentName)throw Error("Clerk: useGoogleOneTapContext called outside GoogleOneTap.");let{componentName:g,...d}=e,f=(0,i.useCallback)(e=>{let i=new n.n(t,{...d,signInFallbackRedirectUrl:e,signUpFallbackRedirectUrl:e},c),l=t.signUpUrl||r.signUpUrl,o=t.signInUrl||r.signInUrl,s=i.getPreservedSearchParams();o=(0,a.kZ)({base:o,hashSearchParams:[c,s]},{stringify:!0}),l=(0,a.kZ)({base:l,hashSearchParams:[c,s]},{stringify:!0});let u=i.getAfterSignInUrl(),g=i.getAfterSignUpUrl(),f=(0,a.kZ)({base:l,hashPath:"/continue",hashSearch:new URLSearchParams({sign_up_force_redirect_url:g}).toString()},{stringify:!0}),h=(0,a.kZ)({base:o,hashPath:"/factor-one",hashSearch:new URLSearchParams({sign_in_force_redirect_url:u}).toString()},{stringify:!0}),U=(0,a.kZ)({base:o,hashPath:"/factor-two",hashSearch:new URLSearchParams({sign_in_force_redirect_url:u}).toString()},{stringify:!0});return{signInUrl:o,signUpUrl:l,firstFactorUrl:h,secondFactorUrl:U,continueSignUpUrl:f,signInForceRedirectUrl:u,signUpForceRedirectUrl:g}},[d,r.signInUrl,r.signUpUrl,t,c]);return{...d,componentName:g,generateCallbackUrls:f}}},2121:function(e,t,r){r.d(t,{W:()=>i,n:()=>a});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(null===e)throw Error("Clerk: useOAuthConsentContext called outside of the mounted OAuthConsent component.");return e}},9953:function(e,t,r){r.d(t,{e:()=>s,f:()=>o});var n=r(5074),a=r(7697),i=r(4964),l=r(2117);let o=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(o),{navigate:t}=(0,i.r)(),{displayConfig:r,organizationSettings:s}=(0,a.O)();if(!e||"OrganizationList"!==e.componentName)throw Error("Clerk: useOrganizationListContext called outside OrganizationList.");let{componentName:u,...c}=e,g=c.afterCreateOrganizationUrl||r.afterCreateOrganizationUrl,d=({organization:e,user:r})=>"function"==typeof c.afterSelectPersonalUrl&&r?t(c.afterSelectPersonalUrl(r)):"function"==typeof c.afterSelectOrganizationUrl&&e?t(c.afterSelectOrganizationUrl(e)):c.afterSelectPersonalUrl&&r?t((0,l.tR)({urlWithParam:c.afterSelectPersonalUrl,entity:r})):c.afterSelectOrganizationUrl&&e?t((0,l.tR)({urlWithParam:c.afterSelectOrganizationUrl,entity:e})):Promise.resolve();return{...c,afterCreateOrganizationUrl:g,skipInvitationScreen:c.skipInvitationScreen||!1,hidePersonal:s.forceOrganizationSelection||c.hidePersonal||!1,navigateAfterCreateOrganization:e=>"function"==typeof c.afterCreateOrganizationUrl?t(c.afterCreateOrganizationUrl(e)):c.afterCreateOrganizationUrl?t((0,l.tR)({urlWithParam:c.afterCreateOrganizationUrl,entity:e})):t(r.afterCreateOrganizationUrl),navigateAfterSelectOrganization:e=>d({organization:e}),navigateAfterSelectPersonal:e=>d({user:e}),componentName:u}}},5892:function(e,t,r){r.d(t,{V:()=>g,o:()=>c});var n=r(1210),a=r(5074),i=r(3121),l=r(1227),o=r(4964),s=r(7697),u=r(7288);let c=(0,a.createContext)(null),g=()=>{let e=(0,a.useContext)(c),{navigate:t}=(0,o.r)(),r=(0,s.O)(),g=(0,n.ho)();if(!e||"OrganizationProfile"!==e.componentName)throw Error("Clerk: useOrganizationProfileContext called outside OrganizationProfile.");let{componentName:d,customPages:f,...h}=e,U=(0,u.Rs)(),m=(0,u.eT)(),p=U.data?.subscriptionItems.some(e=>e.plan.hasBaseFee),C=r.commerceSettings.billing.organization.hasPaidPlans||p||m.data.length>0,S=(0,a.useMemo)(()=>(0,i.q)(f||[],g,C,r),[f,C]),P=S.routes[0].id===l.jc.MEMBERS,b=S.routes[0].id===l.jc.GENERAL,O=S.routes[0].id===l.jc.BILLING,k=S.routes[0].id===l.jc.API_KEYS;return{...h,pages:S,navigateAfterLeaveOrganization:()=>t(h.afterLeaveOrganizationUrl||r.displayConfig.afterLeaveOrganizationUrl),componentName:d,navigateToGeneralPageRoot:()=>t(b?"../":P?"./organization-general":"../organization-general"),isMembersPageRoot:P,isGeneralPageRoot:b,isBillingPageRoot:O,isAPIKeysPageRoot:k,shouldShowBilling:C}}},2826:function(e,t,r){r.d(t,{U:()=>o,l:()=>s});var n=r(5074),a=r(7697),i=r(4964),l=r(2117);let o=(0,n.createContext)(null),s=()=>{let e=(0,n.useContext)(o),{navigate:t}=(0,i.r)(),{displayConfig:r,organizationSettings:s}=(0,a.O)();if(!e||"OrganizationSwitcher"!==e.componentName)throw Error("Clerk: useOrganizationSwitcherContext called outside OrganizationSwitcher.");let{componentName:u,...c}=e,g=c.afterCreateOrganizationUrl||r.afterCreateOrganizationUrl,d=c.afterLeaveOrganizationUrl||r.afterLeaveOrganizationUrl,f=({organization:e,user:r})=>{let n=h({organization:e,user:r});return n?t(n):Promise.resolve()},h=({organization:e,user:t})=>"function"==typeof c.afterSelectPersonalUrl&&t?c.afterSelectPersonalUrl(t):"function"==typeof c.afterSelectOrganizationUrl&&e?c.afterSelectOrganizationUrl(e):c.afterSelectPersonalUrl&&t?(0,l.tR)({urlWithParam:c.afterSelectPersonalUrl,entity:t}):c.afterSelectOrganizationUrl&&e?(0,l.tR)({urlWithParam:c.afterSelectOrganizationUrl,entity:e}):void 0,U=c.organizationProfileUrl&&!c.organizationProfileMode?"navigation":c.organizationProfileMode,m=c.createOrganizationUrl&&!c.createOrganizationMode?"navigation":c.createOrganizationMode;return{...c,hidePersonal:s.forceOrganizationSelection||c.hidePersonal||!1,organizationProfileMode:U||"modal",createOrganizationMode:m||"modal",skipInvitationScreen:c.skipInvitationScreen||!1,afterCreateOrganizationUrl:g,afterLeaveOrganizationUrl:d,navigateOrganizationProfile:()=>t(c.organizationProfileUrl||r.organizationProfileUrl),navigateCreateOrganization:()=>t(c.createOrganizationUrl||r.createOrganizationUrl),navigateAfterSelectOrganization:e=>f({organization:e}),navigateAfterSelectPersonal:e=>f({user:e}),afterSelectOrganizationUrl:e=>h({organization:e}),afterSelectPersonalUrl:e=>h({user:e}),componentName:u}}},7288:function(e,t,r){r.d(t,{A$:()=>U,D:()=>m,Ij:()=>u,Rs:()=>h,eT:()=>f,mu:()=>g,wD:()=>d});var n=r(1210),a=r(5074),i=r(7477),l=r(5424),o=r(2861),s=r(6256);function u(e){return e.endsWith(".00")?e.slice(0,-3):e}let c=()=>{let e=(0,s.XX)(),t=(0,i.Fd)(e=>e({permission:"org:sys_billing:read"})||e({permission:"org:sys_billing:manage"})),r=(0,n.Wf)();return{for:e,keepPreviousData:!0,enabled:"organization"!==e||!!r?.organization&&t}},g=()=>{let e=c();return(0,n.X$)(e)},d=()=>{let e=c();return(0,n.t7)(e)},f=e=>{let t=c();return(0,n.tr)({...t,__experimental_mode:e?.mode})},h=()=>{let e=c(),t=(0,n.kH)(e),r=(0,a.useMemo)(()=>t.data?.subscriptionItems||[],[t.data?.subscriptionItems]);return{...t,subscriptionItems:r}},U=e=>{let t=(0,s.XX)();return(0,n.rg)({for:t,initialPage:1,pageSize:50,keepPreviousData:!0,enabled:!0,__experimental_mode:e?.mode})},m=()=>{let e=(0,n.ho)(),{session:t}=(0,n.wV)(),r=(0,s.XX)(),i=(0,a.useMemo)(()=>!!(!e.session||e?.session?.checkAuthorization({permission:"org:sys_billing:manage"})||"user"===r),[e,r]),{subscriptionItems:u,revalidate:c,data:d}=h(),{data:m,revalidate:p}=U({mode:"cache"}),{revalidate:C}=f({mode:"cache"}),{revalidate:S}=g(),P=(0,a.useCallback)(()=>{c(),p(),C(),S()},[c,p,C,S]),b=(0,a.useMemo)(()=>0===u.length||!u.some(e=>!e.canceledAt),[u]),O=(0,a.useCallback)(e=>u.find(t=>t.plan.id===e.id),[u]),k=(0,a.useCallback)(e=>u.filter(t=>t.plan.id===e.id),[u]),z=(0,a.useCallback)((e,t="month")=>{let r=k(e);if(r.length>1){let e=r.find(e=>e.planPeriod===t);return e||r[0]}if(1===r.length)return r[0]},[k]),v=(0,a.useCallback)(({plan:e,subscription:t})=>{let r=t??(e?O(e):void 0);return!r||!r.canceledAt},[O]),x=(0,a.useCallback)(({plan:e,subscription:r,isCompact:n=!1,selectedPlanPeriod:a="annual"})=>{let l=r??(e?z(e,a):void 0),s=a,c=!!e?.annualMonthlyFee;"annual"!==s||c||(s="month");let g=r=>{if(e?.freeTrialEnabled){let r=!t,n=d?.eligibleForFreeTrial;if(r||n)return(0,o.G)("billing.startFreeTrial__days",{days:e.freeTrialDays??0})}return r};return{localizationKey:g((()=>{if(l){if(s!==l.planPeriod&&l.canceledAt){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(c)return(0,o.G)("billing.switchToAnnual")}if(l.canceledAt)return(0,o.G)("billing.reSubscribe");if(s!==l.planPeriod){if("month"===s)return(0,o.G)("billing.switchToMonthly");if(c)return(0,o.G)("billing.switchToAnnual")}return(0,o.G)("billing.manageSubscription")}return u.filter(e=>!e.plan.isDefault).length>0?(0,o.G)("billing.switchPlan"):g((0,o.G)("billing.subscribe"))})()),variant:n?"bordered":"solid",colorScheme:n?"secondary":"primary",isDisabled:!i,disabled:!i}},[z,i,u,d]),I=(0,a.useCallback)(e=>e.pastDueAt?(0,o.G)("badge__pastDueAt",{date:e.pastDueAt}):"upcoming"===e.status?(0,o.G)("badge__startsAt",{date:e.periodStart}):e.canceledAt?(0,o.G)("badge__canceledEndsAt",{date:e.periodEnd}):e.periodEnd?(0,o.G)(e.isFreeTrial?"badge__trialEndsAt":"badge__renewsAt",{date:e.periodEnd}):void 0,[]),_=(0,a.useCallback)(t=>{let n=(0,l.J)("modal",t);e.__internal_openSubscriptionDetails({for:r,onSubscriptionCancel:()=>{P()},portalRoot:n})},[e,r,P]);return{activeOrUpcomingSubscription:O,activeAndUpcomingSubscriptions:k,activeOrUpcomingSubscriptionBasedOnPlanPeriod:z,isDefaultPlanImplicitlyActiveOrUpcoming:b,handleSelectPlan:(0,a.useCallback)(({plan:n,planPeriod:a,mode:i="mounted",event:o,appearance:s,newSubscriptionRedirectUrl:u})=>{let c=(0,l.J)(i,o);e.__internal_openCheckout({planId:n.id,planPeriod:"annual"!==a||n.annualMonthlyFee?a:"month",for:r,onSubscriptionComplete:()=>{P()},onClose:()=>{t?.id&&e.setActive({session:t.id})},appearance:s,portalRoot:c,newSubscriptionRedirectUrl:u})},[e,P,r,t?.id]),openSubscriptionDetails:_,buttonPropsForPlan:x,canManageSubscription:v,captionForSubscription:I,defaultFreePlan:(0,a.useMemo)(()=>m?.find(e=>e.isDefault),[m]),revalidateAll:P}}},164:function(e,t,r){r.d(t,{T:()=>i,a:()=>a});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"PricingTable"!==e.componentName)throw Error("Clerk: usePricingTableContext called outside PricingTable.");let{componentName:t,...r}=e;return{...r,componentName:t}}},1616:function(e,t,r){r.d(t,{O_:()=>g,lY:()=>s,pq:()=>c,qx:()=>l,u3:()=>u,z1:()=>o});var n=r(5580),a=r(5074),i=r(4964);let l=(0,a.createContext)(null),o=()=>{let e=(0,a.useContext)(l),{navigate:t,basePath:r,startPath:o}=(0,i.r)();if(null===e)throw Error("Clerk: useSessionTasksContext called outside of the mounted SessionTasks component.");let s=async({session:e,redirectUrlComplete:a})=>{let i=e.currentTask;if(!i)return t(a);let l=(0,n.ru)(i);return t(`/${r+o+l}`)};return{...e,navigateOnSetActive:s}},s=(0,a.createContext)(null),u=()=>{let e=(0,a.useContext)(s);if(null===e)throw Error("Clerk: useTaskChooseOrganizationContext called outside of the mounted TaskChooseOrganization component.");return e},c=(0,a.createContext)(null),g=()=>{let e=(0,a.useContext)(c);if(null===e)throw Error("Clerk: useTaskResetPasswordContext called outside of the mounted TaskResetPassword component.");return e}},4:function(e,t,r){r.d(t,{Q:()=>U,r:()=>m});var n=r(2166),a=r(8380),i=r(5580),l=r(4173),o=r(1210),s=r(5993),u=r(5074),c=r(8051),g=r(7697),d=r(2366),f=r(4964),h=r(2117);let U=(0,u.createContext)(null),m=()=>{let e=(0,u.useContext)(U),{navigate:t,basePath:r,startPath:m}=(0,f.r)(),{displayConfig:p,userSettings:C}=(0,g.O)(),{queryParams:S,queryString:P}=(0,f.r)(),b=C.signUp.mode,O=(0,d.II)(),k=(0,o.ho)();if(null===e||"SignIn"!==e.componentName)throw Error("Clerk: useSignInContext called outside of the mounted SignIn component.");let z="restricted"!==b&&!!(!O.signUpUrl&&O.signInUrl&&!(0,s.s)(O.signInUrl))&&!1!==e.withSignUp||e.withSignUp||!1,{componentName:v,mode:x,...I}=e,_=(0,u.useMemo)(()=>(0,h.tf)(P,n.u),[]),w=new a.n(O,{...I,signInFallbackRedirectUrl:I.signInFallbackRedirectUrl||I.fallbackRedirectUrl,signInForceRedirectUrl:I.signInForceRedirectUrl||I.forceRedirectUrl},S,x);delete I.fallbackRedirectUrl,delete I.forceRedirectUrl;let A=k.buildUrlWithAuth(w.getAfterSignInUrl()),y=k.buildUrlWithAuth(w.getAfterSignUpUrl()),T="path"===I.routing&&I.path||O.signInUrl||p.signInUrl,E=z?"path"===I.routing&&I.path||O.signUpUrl||p.signUpUrl:I.signUpUrl||O.signUpUrl||p.signUpUrl,M=I.waitlistUrl||O.waitlistUrl||p.waitlistUrl,R=w.getPreservedSearchParams();T=(0,l.kZ)({base:T,hashSearchParams:[S,R]},{stringify:!0}),E=(0,l.kZ)({base:E,hashSearchParams:[S,R]},{stringify:!0}),M=(0,l.kZ)({base:M,hashSearchParams:[S,R]},{stringify:!0});let G=w.toSearchParams().toString(),F=(0,c.aQ)({routing:I.routing,baseUrl:E,authQueryString:G,path:I.path,endpoint:z?"/create"+c.Vu:c.Vu}),N=(0,c.aQ)({routing:I.routing,baseUrl:E,authQueryString:G,path:I.path,endpoint:z?"/create"+c.aB:c.aB});z&&(E=(0,l.kZ)({base:T,hashPath:"/create",hashSearchParams:[S,R]},{stringify:!0}));let W=(0,l.kZ)({base:E,hashPath:"/continue"},{stringify:!0}),L=async({session:e,redirectUrl:n})=>{let a=e.currentTask;if(!a)return t(n);let l=(0,i.ru)(a);return t(`/${r+m+(z?"/create"+l:l)}`)},D=k.session?.currentTask?k.__internal_getOption("taskUrls")?.[k.session?.currentTask.key]??(0,c.aQ)({routing:I.routing,baseUrl:T,authQueryString:G,path:I.path,endpoint:z?"/create"+(0,i.ru)(k.session?.currentTask):(0,i.ru)(k.session?.currentTask)}):null;return{...I,transferable:I.transferable??!0,oauthFlow:I.oauthFlow||"auto",componentName:v,signUpUrl:E,signInUrl:T,waitlistUrl:M,afterSignInUrl:A,afterSignUpUrl:y,emailLinkRedirectUrl:F,ssoCallbackUrl:N,navigateAfterSignIn:()=>t(A),signUpContinueUrl:W,queryParams:S,initialValues:{...I.initialValues,..._},authQueryString:G,isCombinedFlow:z,navigateOnSetActive:L,taskUrl:D}}},6256:function(e,t,r){r.d(t,{N7:()=>o,XX:()=>l,m$:()=>i});var n=r(5074);let a="user",i=(0,n.createContext)(a),l=()=>(0,n.useContext)(i)||a,o=()=>"user"===l()?"userProfile":"organizationProfile"},3620:function(e,t,r){r.d(t,{E:()=>a,d:()=>i});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"UserAvatar"!==e.componentName)throw Error("Clerk: useUserAvatarContext called outside UserAvatar.");let{componentName:t,...r}=e;return{...r,componentName:t}}},9233:function(e,t,r){r.d(t,{P:()=>u,Y:()=>c});var n=r(1210),a=r(5074),i=r(856),l=r(7697),o=r(2366),s=r(4964);let u=(0,a.createContext)(null),c=()=>{let e=(0,a.useContext)(u),t=(0,n.ho)(),{navigate:r}=(0,s.r)(),{displayConfig:c}=(0,l.O)(),g=(0,o.II)();if(!e||"UserButton"!==e.componentName)throw Error("Clerk: useUserButtonContext called outside of the mounted UserButton component.");let{componentName:d,customMenuItems:f,...h}=e,U=h.signInUrl||g.signInUrl||c.signInUrl,m=h.userProfileUrl||c.userProfileUrl,p=t.buildAfterSignOutUrl(),C=t.buildAfterMultiSessionSingleSignOutUrl(),S=h.afterSwitchSessionUrl||c.afterSwitchSessionUrl,P=h.userProfileUrl&&!h.userProfileMode?"navigation":h.userProfileMode,b=(0,a.useMemo)(()=>(0,i.K)(f||[],t),[]);return{...h,componentName:d,navigateAfterMultiSessionSingleSignOut:()=>t.redirectWithAuth(C),navigateAfterSignOut:()=>r(p),signInUrl:U,userProfileUrl:m,afterMultiSessionSingleSignOutUrl:C,afterSignOutUrl:p,afterSwitchSessionUrl:S,userProfileMode:P||"modal",menutItems:b}}},5240:function(e,t,r){r.d(t,{B:()=>c,M:()=>u});var n=r(1210),a=r(5074),i=r(3121),l=r(4964),o=r(7697),s=r(7288);let u=(0,a.createContext)(null),c=()=>{let e=(0,a.useContext)(u),{queryParams:t}=(0,l.r)(),r=(0,n.ho)(),c=(0,o.O)(),{user:g}=(0,n.Jd)(),d=(0,s.Rs)(),f=(0,s.eT)(),h=d.data?.subscriptionItems.some(e=>e.plan.hasBaseFee),U=c.commerceSettings.billing.user.hasPaidPlans||h||f.data.length>0;if(!e||"UserProfile"!==e.componentName)throw Error("Clerk: useUserProfileContext called outside of the mounted UserProfile component.");let{componentName:m,customPages:p,...C}=e,S=(0,a.useMemo)(()=>(0,i.M)(p||[],r,U,c),[p,U]),P=(0,a.useMemo)(()=>{let{enterpriseSSO:e}=c.userSettings;return!(g&&e.enabled)||!g?.enterpriseAccounts.some(e=>e.active&&e.enterpriseConnection?.disableAdditionalIdentifications)},[g,c.userSettings.enterpriseSSO]);return{...C,pages:S,componentName:m,queryParams:t,authQueryString:"",shouldAllowIdentificationCreation:P,shouldShowBilling:U}}},9078:function(e,t,r){r.d(t,{_:()=>a,k:()=>i});var n=r(5074);let a=(0,n.createContext)(null),i=()=>{let e=(0,n.useContext)(a);if(!e||"UserVerification"!==e.componentName)throw Error("Clerk: useUserVerificationContext called outside of the mounted UserVerification component.");let{componentName:t,...r}=e;return{...r,componentName:t}}},451:function(e,t,r){r.d(t,{Y:()=>g,r:()=>c});var n=r(4173),a=r(5074),i=r(7697),l=r(2366),o=r(4964),s=r(2117);let u=["email_address"],c=(0,a.createContext)(null),g=()=>{let e=(0,a.useContext)(c),{displayConfig:t}=(0,i.O)(),r=(0,l.II)(),{queryString:g}=(0,o.r)(),d=(0,a.useMemo)(()=>(0,s.tf)(g,u),[]);if(!e||"Waitlist"!==e.componentName)throw Error("Clerk: useWaitlistContext called outside Waitlist.");let{componentName:f,...h}=e,U=h.signInUrl||r.signInUrl||t.signInUrl;return U=(0,n.kZ)({base:U},{stringify:!0}),{...h,componentName:f,signInUrl:U,initialValues:{...d}}}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["444"],{1052:function(e,o,t){t.d(o,{iR:()=>A,pS:()=>v,ww:()=>P});var n=t(4518),r=t(4964),i=t(2531),s=t(750),c=t(9345),u=t(1227),l=t(9233),d=t(8920),a=t(8272),p=t(2861),B=t(8813),m=t(7240),I=t(9366),$=t(6932);let A=e=>{let{navigate:o}=(0,r.r)(),{handleManageAccountClicked:t,handleSignOutSessionClicked:s,handleUserProfileActionClicked:c,session:a}=e,{menutItems:p}=(0,l.Y)(),B=e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,padding:`${e.space.$4} ${e.space.$5}`}),m=async n=>n?.path?(await o(n.path),e?.completedCallback()):n.id===u.dY.MANAGE_ACCOUNT?await t():n?.open?c(n.open):(n.onClick?.(),e?.completedCallback());return(0,n.Y)(i.En,{role:"menu",elementDescriptor:d.$z.userButtonPopoverActions,elementId:d.$z.userButtonPopoverActions.setId("singleSession"),sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100}),children:p?.map(e=>{let o;return o=Object.values(u.dY).includes(e.id)?{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId(e.id)}:{elementDescriptor:d.$z.userButtonPopoverCustomItemButton,elementId:d.$z.userButtonPopoverCustomItemButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverCustomItemButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverCustomItemButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionItemButtonIcon,iconElementId:d.$z.userButtonPopoverActionItemButtonIcon.setId(e.id)},(0,n.Y)(i.rc,{...o,icon:e.icon,label:e.name,onClick:e.id===u.dY.SIGN_OUT?s(a):()=>m(e),sx:B,iconSx:e=>({width:e.sizes.$4,height:e.sizes.$4})},e.id)})})},v=e=>{let{navigate:o}=(0,r.r)(),{handleManageAccountClicked:t,handleSignOutSessionClicked:A,handleSessionClicked:v,handleAddAccountClicked:P,handleUserProfileActionClicked:g,session:z,otherSessions:h}=e,{menutItems:x}=(0,l.Y)(),C=async n=>n?.path?(await o(n.path),e?.completedCallback()):n.id===u.dY.MANAGE_ACCOUNT?await t():n?.open?g(n.open):(n.onClick?.(),e?.completedCallback()),b=x.every(e=>Object.values(u.dY).includes(e.id));return(0,n.FD)(n.FK,{children:[b?(0,n.Y)(i.Rh,{role:"menu",elementDescriptor:d.$z.userButtonPopoverActions,elementId:d.$z.userButtonPopoverActions.setId("multiSession"),children:(0,n.FD)(a.so,{justify:"between",sx:e=>({marginLeft:e.space.$12,padding:`0 ${e.space.$5} ${e.space.$4}`,gap:e.space.$2}),children:[(0,n.Y)(i.K5,{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId("manageAccount"),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId("manageAccount"),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId("manageAccount"),icon:B.A,label:(0,p.G)("userButton.action__manageAccount"),onClick:t,focusRing:!0}),(0,n.Y)(i.K5,{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId("signOut"),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId("signOut"),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId("signOut"),icon:m.A,label:(0,p.G)("userButton.action__signOut"),onClick:A(z),focusRing:!0})]})}):(0,n.Y)(i.Rh,{role:"menu",elementDescriptor:d.$z.userButtonPopoverActions,elementId:d.$z.userButtonPopoverActions.setId("multiSession"),sx:e=>({gap:e.space.$1,paddingBottom:e.space.$2}),children:x?.map(e=>{let o;return o=Object.values(u.dY).includes(e.id)?{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId(e.id)}:{elementDescriptor:d.$z.userButtonPopoverCustomItemButton,elementId:d.$z.userButtonPopoverCustomItemButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverCustomItemButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverCustomItemButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionItemButtonIcon,iconElementId:d.$z.userButtonPopoverActionItemButtonIcon.setId(e.id)},(0,n.Y)(i.rc,{...o,icon:e.icon,label:e.name,onClick:e.id===u.dY.SIGN_OUT?A(z):()=>C(e),sx:e=>({border:0,padding:`${e.space.$2} ${e.space.$5}`,gap:e.space.$3x5}),iconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),iconBoxSx:e=>({minHeight:e.sizes.$4,minWidth:e.sizes.$4,alignItems:"center"})},e.id)})}),(0,n.FD)(i.En,{role:"menu",sx:e=>({borderTopStyle:e.borderStyles.$solid,borderTopWidth:e.borderWidths.$normal,borderTopColor:e.colors.$borderAlpha100}),children:[h.map(e=>(0,n.Y)(s.P,{icon:I.A,onClick:v(e),role:"menuitem",children:(0,n.Y)(c.c,{user:e.user})},e.id)),(0,n.Y)(i.rc,{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId("addAccount"),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId("addAccount"),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId("addAccount"),icon:$.A,label:(0,p.G)("userButton.action__addAccount"),onClick:P,iconSx:e=>({width:e.sizes.$9,height:e.sizes.$6}),iconBoxSx:e=>({minHeight:e.sizes.$9,minWidth:e.sizes.$6,alignItems:"center"}),spinnerSize:"md"})]})]})},P=e=>{let{handleSignOutAllClicked:o,elementDescriptor:t,elementId:r,iconBoxElementDescriptor:s,iconBoxElementId:c,iconElementDescriptor:u,iconElementId:l,label:a,sx:B,actionSx:I}=e;return(0,n.Y)(i.En,{role:"menu",sx:[e=>({padding:e.space.$2}),B],children:(0,n.Y)(i.rc,{elementDescriptor:t||d.$z.userButtonPopoverActionButton,elementId:r||d.$z.userButtonPopoverActionButton.setId("signOutAll"),iconBoxElementDescriptor:s||d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:c||d.$z.userButtonPopoverActionButtonIconBox.setId("signOutAll"),iconElementDescriptor:u||d.$z.userButtonPopoverActionButtonIcon,iconElementId:l||d.$z.userButtonPopoverActionButtonIcon.setId("signOutAll"),icon:m.A,label:a||(0,p.G)("userButton.action__signOutAll"),onClick:o,variant:"ghost",colorScheme:"neutral",sx:[e=>({backgroundColor:e.colors.$transparent,padding:`${e.space.$2} ${e.space.$3}`,borderBottomWidth:0,borderRadius:e.radii.$lg}),I],spinnerSize:"md"})})}},2540:function(e,o,t){t.d(o,{u:()=>a});var n=t(5580),r=t(5483),i=t(5543),s=t(7697),c=t(3269),u=t(6735),l=t(8691),d=t(4964);let a=e=>{let{setActive:o,signOut:t,openUserProfile:a}=(0,i.ho)(),p=(0,c.f0)(),{signedInSessions:B,otherSessions:m}=(0,l.z)({user:e.user}),{navigate:I}=(0,d.r)(),{displayConfig:$}=(0,s.O)();return{handleSignOutSessionClicked:o=>()=>0===m.length?t(e.navigateAfterSignOut):t(e.navigateAfterMultiSessionSingleSignOut,{sessionId:o.id}).finally(()=>p.setIdle()),handleManageAccountClicked:()=>"navigation"===e.userProfileMode?I(e.userProfileUrl||"").finally(()=>{(async()=>{await (0,u.y)(300),e.actionCompleteCallback?.()})()}):(a(e.userProfileProps),e.actionCompleteCallback?.()),handleUserProfileActionClicked:o=>"navigation"===e.userProfileMode?I(e.userProfileUrl||"").finally(()=>{(async()=>{await (0,u.y)(300),e.actionCompleteCallback?.()})()}):(a({...e.userProfileProps,...o&&{__experimental_startPath:o}}),e.actionCompleteCallback?.()),handleSignOutAllClicked:()=>t(e.navigateAfterSignOut),handleSessionClicked:t=>async()=>(p.setLoading(),o({session:t,navigate:async({session:o})=>{!o.currentTask&&e.afterSwitchSessionUrl?await I(e.afterSwitchSessionUrl):e.taskUrl?await I(e.taskUrl):await (0,n.KA)(o,{baseUrl:e.signInUrl??$.signInUrl,navigate:I})}}).finally(()=>{p.setIdle(),e.actionCompleteCallback?.()})),handleAddAccountClicked:()=>((0,r.y7)(e.signInUrl||window.location.href),(0,u.y)(2e3)),otherSessions:m,signedInSessions:B}}},9233:function(e,o,t){t.d(o,{P:()=>l,Y:()=>d});var n=t(5543),r=t(5074),i=t(856),s=t(7697),c=t(2366),u=t(4964);let l=(0,r.createContext)(null),d=()=>{let e=(0,r.useContext)(l),o=(0,n.ho)(),{navigate:t}=(0,u.r)(),{displayConfig:d}=(0,s.O)(),a=(0,c.II)();if(!e||"UserButton"!==e.componentName)throw Error("Clerk: useUserButtonContext called outside of the mounted UserButton component.");let{componentName:p,customMenuItems:B,...m}=e,I=m.signInUrl||a.signInUrl||d.signInUrl,$=m.userProfileUrl||d.userProfileUrl,A=o.buildAfterSignOutUrl(),v=o.buildAfterMultiSessionSingleSignOutUrl(),P=m.afterSwitchSessionUrl||d.afterSwitchSessionUrl,g=m.userProfileUrl&&!m.userProfileMode?"navigation":m.userProfileMode,z=(0,r.useMemo)(()=>(0,i.K)(B||[],o),[]);return{...m,componentName:p,navigateAfterMultiSessionSingleSignOut:()=>o.redirectWithAuth(v),navigateAfterSignOut:()=>t(A),signInUrl:I,userProfileUrl:$,afterMultiSessionSingleSignOutUrl:v,afterSignOutUrl:A,afterSwitchSessionUrl:P,userProfileMode:g||"modal",menutItems:z}}}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["444"],{1052:function(e,o,t){t.d(o,{iR:()=>A,pS:()=>v,ww:()=>P});var n=t(4518),r=t(4964),i=t(2531),s=t(750),c=t(9345),u=t(1227),l=t(9233),d=t(8920),a=t(8272),p=t(2861),B=t(8813),m=t(7240),I=t(9366),$=t(6932);let A=e=>{let{navigate:o}=(0,r.r)(),{handleManageAccountClicked:t,handleSignOutSessionClicked:s,handleUserProfileActionClicked:c,session:a}=e,{menutItems:p}=(0,l.Y)(),B=e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,padding:`${e.space.$4} ${e.space.$5}`}),m=async n=>n?.path?(await o(n.path),e?.completedCallback()):n.id===u.dY.MANAGE_ACCOUNT?await t():n?.open?c(n.open):(n.onClick?.(),e?.completedCallback());return(0,n.Y)(i.En,{role:"menu",elementDescriptor:d.$z.userButtonPopoverActions,elementId:d.$z.userButtonPopoverActions.setId("singleSession"),sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100}),children:p?.map(e=>{let o;return o=Object.values(u.dY).includes(e.id)?{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId(e.id)}:{elementDescriptor:d.$z.userButtonPopoverCustomItemButton,elementId:d.$z.userButtonPopoverCustomItemButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverCustomItemButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverCustomItemButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionItemButtonIcon,iconElementId:d.$z.userButtonPopoverActionItemButtonIcon.setId(e.id)},(0,n.Y)(i.rc,{...o,icon:e.icon,label:e.name,onClick:e.id===u.dY.SIGN_OUT?s(a):()=>m(e),sx:B,iconSx:e=>({width:e.sizes.$4,height:e.sizes.$4})},e.id)})})},v=e=>{let{navigate:o}=(0,r.r)(),{handleManageAccountClicked:t,handleSignOutSessionClicked:A,handleSessionClicked:v,handleAddAccountClicked:P,handleUserProfileActionClicked:g,session:z,otherSessions:h}=e,{menutItems:x}=(0,l.Y)(),C=async n=>n?.path?(await o(n.path),e?.completedCallback()):n.id===u.dY.MANAGE_ACCOUNT?await t():n?.open?g(n.open):(n.onClick?.(),e?.completedCallback()),b=x.every(e=>Object.values(u.dY).includes(e.id));return(0,n.FD)(n.FK,{children:[b?(0,n.Y)(i.Rh,{role:"menu",elementDescriptor:d.$z.userButtonPopoverActions,elementId:d.$z.userButtonPopoverActions.setId("multiSession"),children:(0,n.FD)(a.so,{justify:"between",sx:e=>({marginLeft:e.space.$12,padding:`0 ${e.space.$5} ${e.space.$4}`,gap:e.space.$2}),children:[(0,n.Y)(i.K5,{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId("manageAccount"),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId("manageAccount"),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId("manageAccount"),icon:B.A,label:(0,p.G)("userButton.action__manageAccount"),onClick:t,focusRing:!0}),(0,n.Y)(i.K5,{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId("signOut"),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId("signOut"),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId("signOut"),icon:m.A,label:(0,p.G)("userButton.action__signOut"),onClick:A(z),focusRing:!0})]})}):(0,n.Y)(i.Rh,{role:"menu",elementDescriptor:d.$z.userButtonPopoverActions,elementId:d.$z.userButtonPopoverActions.setId("multiSession"),sx:e=>({gap:e.space.$1,paddingBottom:e.space.$2}),children:x?.map(e=>{let o;return o=Object.values(u.dY).includes(e.id)?{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId(e.id)}:{elementDescriptor:d.$z.userButtonPopoverCustomItemButton,elementId:d.$z.userButtonPopoverCustomItemButton.setId(e.id),iconBoxElementDescriptor:d.$z.userButtonPopoverCustomItemButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverCustomItemButtonIconBox.setId(e.id),iconElementDescriptor:d.$z.userButtonPopoverActionItemButtonIcon,iconElementId:d.$z.userButtonPopoverActionItemButtonIcon.setId(e.id)},(0,n.Y)(i.rc,{...o,icon:e.icon,label:e.name,onClick:e.id===u.dY.SIGN_OUT?A(z):()=>C(e),sx:e=>({border:0,padding:`${e.space.$2} ${e.space.$5}`,gap:e.space.$3x5}),iconSx:e=>({width:e.sizes.$4,height:e.sizes.$4}),iconBoxSx:e=>({minHeight:e.sizes.$4,minWidth:e.sizes.$4,alignItems:"center"})},e.id)})}),(0,n.FD)(i.En,{role:"menu",sx:e=>({borderTopStyle:e.borderStyles.$solid,borderTopWidth:e.borderWidths.$normal,borderTopColor:e.colors.$borderAlpha100}),children:[h.map(e=>(0,n.Y)(s.P,{icon:I.A,onClick:v(e),role:"menuitem",children:(0,n.Y)(c.c,{user:e.user})},e.id)),(0,n.Y)(i.rc,{elementDescriptor:d.$z.userButtonPopoverActionButton,elementId:d.$z.userButtonPopoverActionButton.setId("addAccount"),iconBoxElementDescriptor:d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:d.$z.userButtonPopoverActionButtonIconBox.setId("addAccount"),iconElementDescriptor:d.$z.userButtonPopoverActionButtonIcon,iconElementId:d.$z.userButtonPopoverActionButtonIcon.setId("addAccount"),icon:$.A,label:(0,p.G)("userButton.action__addAccount"),onClick:P,iconSx:e=>({width:e.sizes.$9,height:e.sizes.$6}),iconBoxSx:e=>({minHeight:e.sizes.$9,minWidth:e.sizes.$6,alignItems:"center"}),spinnerSize:"md"})]})]})},P=e=>{let{handleSignOutAllClicked:o,elementDescriptor:t,elementId:r,iconBoxElementDescriptor:s,iconBoxElementId:c,iconElementDescriptor:u,iconElementId:l,label:a,sx:B,actionSx:I}=e;return(0,n.Y)(i.En,{role:"menu",sx:[e=>({padding:e.space.$2}),B],children:(0,n.Y)(i.rc,{elementDescriptor:t||d.$z.userButtonPopoverActionButton,elementId:r||d.$z.userButtonPopoverActionButton.setId("signOutAll"),iconBoxElementDescriptor:s||d.$z.userButtonPopoverActionButtonIconBox,iconBoxElementId:c||d.$z.userButtonPopoverActionButtonIconBox.setId("signOutAll"),iconElementDescriptor:u||d.$z.userButtonPopoverActionButtonIcon,iconElementId:l||d.$z.userButtonPopoverActionButtonIcon.setId("signOutAll"),icon:m.A,label:a||(0,p.G)("userButton.action__signOutAll"),onClick:o,variant:"ghost",colorScheme:"neutral",sx:[e=>({backgroundColor:e.colors.$transparent,padding:`${e.space.$2} ${e.space.$3}`,borderBottomWidth:0,borderRadius:e.radii.$lg}),I],spinnerSize:"md"})})}},2540:function(e,o,t){t.d(o,{u:()=>a});var n=t(5580),r=t(5483),i=t(1210),s=t(7697),c=t(3269),u=t(6735),l=t(8691),d=t(4964);let a=e=>{let{setActive:o,signOut:t,openUserProfile:a}=(0,i.ho)(),p=(0,c.f0)(),{signedInSessions:B,otherSessions:m}=(0,l.z)({user:e.user}),{navigate:I}=(0,d.r)(),{displayConfig:$}=(0,s.O)();return{handleSignOutSessionClicked:o=>()=>0===m.length?t(e.navigateAfterSignOut):t(e.navigateAfterMultiSessionSingleSignOut,{sessionId:o.id}).finally(()=>p.setIdle()),handleManageAccountClicked:()=>"navigation"===e.userProfileMode?I(e.userProfileUrl||"").finally(()=>{(async()=>{await (0,u.y)(300),e.actionCompleteCallback?.()})()}):(a(e.userProfileProps),e.actionCompleteCallback?.()),handleUserProfileActionClicked:o=>"navigation"===e.userProfileMode?I(e.userProfileUrl||"").finally(()=>{(async()=>{await (0,u.y)(300),e.actionCompleteCallback?.()})()}):(a({...e.userProfileProps,...o&&{__experimental_startPath:o}}),e.actionCompleteCallback?.()),handleSignOutAllClicked:()=>t(e.navigateAfterSignOut),handleSessionClicked:t=>async()=>(p.setLoading(),o({session:t,navigate:async({session:o})=>{!o.currentTask&&e.afterSwitchSessionUrl?await I(e.afterSwitchSessionUrl):e.taskUrl?await I(e.taskUrl):await (0,n.KA)(o,{baseUrl:e.signInUrl??$.signInUrl,navigate:I})}}).finally(()=>{p.setIdle(),e.actionCompleteCallback?.()})),handleAddAccountClicked:()=>((0,r.y7)(e.signInUrl||window.location.href),(0,u.y)(2e3)),otherSessions:m,signedInSessions:B}}},9233:function(e,o,t){t.d(o,{P:()=>l,Y:()=>d});var n=t(1210),r=t(5074),i=t(856),s=t(7697),c=t(2366),u=t(4964);let l=(0,r.createContext)(null),d=()=>{let e=(0,r.useContext)(l),o=(0,n.ho)(),{navigate:t}=(0,u.r)(),{displayConfig:d}=(0,s.O)(),a=(0,c.II)();if(!e||"UserButton"!==e.componentName)throw Error("Clerk: useUserButtonContext called outside of the mounted UserButton component.");let{componentName:p,customMenuItems:B,...m}=e,I=m.signInUrl||a.signInUrl||d.signInUrl,$=m.userProfileUrl||d.userProfileUrl,A=o.buildAfterSignOutUrl(),v=o.buildAfterMultiSessionSingleSignOutUrl(),P=m.afterSwitchSessionUrl||d.afterSwitchSessionUrl,g=m.userProfileUrl&&!m.userProfileMode?"navigation":m.userProfileMode,z=(0,r.useMemo)(()=>(0,i.K)(B||[],o),[]);return{...m,componentName:p,navigateAfterMultiSessionSingleSignOut:()=>o.redirectWithAuth(v),navigateAfterSignOut:()=>t(A),signInUrl:I,userProfileUrl:$,afterMultiSessionSingleSignOutUrl:v,afterSignOutUrl:A,afterSwitchSessionUrl:P,userProfileMode:g||"modal",menutItems:z}}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["573"],{3934:function(e,t,i){i.d(t,{B:()=>y});var r=i(4518),l=i(3610),a=i(5543),n=i(5074),o=i(3269),s=i(2454),c=i(1475),d=i(6212),u=i(4468),p=i(3990),m=i(8640),h=i(7697),g=i(8272),f=i(3486),v=i(78),b=i(2861),Y=i(7591),_=i(4482);let z=e=>/^\S+@\S+\.\S+$/.test(e),y=e=>{let{onSuccess:t,onReset:i,resetButtonLabel:h}=e,{organization:f,invitations:_}=(0,a.Z5)({invitations:{pageSize:10,keepPreviousData:!0}}),y=(0,o.f0)(),{t:D,locale:$}=(0,v._)(),[w,F]=(0,n.useState)(!1),P=(0,m.tJ)("emailAddress","",{type:"text",label:(0,b.G)("formFieldLabel__emailAddresses")}),k=S(),C=(0,m.tJ)("role","",{label:(0,b.G)("formFieldLabel__role")});if((0,n.useEffect)(()=>{!C.value&&k&&C.setValue(k)},[k,C]),!f)return null;let{props:{setError:E,setWarning:A,setSuccess:G,setInfo:T,isFocused:K,validatePassword:M,setHasPassedComplexity:R,hasPassedComplexity:B,feedback:I,feedbackType:L,clearFeedback:j,...V}}=P,W=(!!P.value.length||w)&&!!C.value;return(0,r.FD)(s.l.Root,{onSubmit:e=>{if(e.preventDefault(),!W)return;let i=new FormData(e.currentTarget);return f.inviteMembers({emailAddresses:P.value.split(","),role:i.get("role")}).then(async()=>(await _?.revalidate?.(),t?.())).catch(e=>{var t;let i,r;if(!(0,l.$R)(e))return void(0,u.H4)(e,[],y.setError);switch(t=e.errors[0],i=new Set([...t.meta?.emailAddresses??[],...t.meta?.identifiers??[]]),r=P.value.split(","),P.setValue(r.filter(e=>!i.has(e)).join(",")),e.errors?.[0]?.code){case"duplicate_record":{let t=e.errors[0].meta?.emailAddresses||[];y.setError(D((0,b.G)("organizationProfile.invitePage.detailsTitle__inviteFailed",{email_addresses:(0,p.kS)(t,$)})));break}case"already_a_member_in_organization":{let t=e.errors[0].longMessage??"",i=t.match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)?.[0];(0,u.H4)(e,[],e=>i?y.setError(D((0,b.G)("unstable__errors.already_a_member_in_organization",{email:i}))):y.setError(e));break}default:(0,u.H4)(e,[],y.setError)}})},children:[(0,r.Y)(s.l.ControlRow,{elementId:P.id,children:(0,r.Y)(d.F,{...V,autoFocus:!0,validate:z,sx:{width:"100%"},validateUnsubmittedEmail:e=>F(z(e)),placeholder:(0,b.G)("formFieldInputPlaceholder__emailAddresses")})}),(0,r.FD)(g.so,{align:"center",justify:"between",sx:e=>({marginTop:e.space.$2,gap:e.space.$4,flexWrap:"wrap",[Y.g.sm]:{justifyContent:"center"}}),children:[(0,r.Y)(x,{...C}),(0,r.FD)(c.c,{sx:e=>({margin:e.space.$none,flexWrap:"wrap",justifyContent:"center"}),children:[(0,r.Y)(s.l.SubmitButton,{block:!1,isDisabled:!W,localizationKey:(0,b.G)("organizationProfile.invitePage.formButtonPrimary__continue")}),(0,r.Y)(s.l.ResetButton,{localizationKey:h||(0,b.G)("userProfile.formButtonReset"),block:!1,onClick:i})]})]})]})},x=e=>{let{options:t,isLoading:i}=(0,f.x)(),{t:l}=(0,v._)();return(0,r.Y)(s.l.ControlRow,{elementId:e.id,children:(0,r.Y)(g.so,{direction:"col",gap:2,children:(0,r.Y)(_.Vo,{...e.props,roles:t,isDisabled:i,onChange:t=>e.setValue(t),triggerSx:e=>({minWidth:e.sizes.$40,justifyContent:"space-between",display:"flex"}),optionListSx:e=>({minWidth:e.sizes.$48}),prefixLocalizationKey:`${l((0,b.G)("formFieldLabel__role"))}:`})})})},S=()=>{let{options:e}=(0,f.x)(),{organizationSettings:t}=(0,h.O)(),i=t.domains.defaultRole;return i||e?.length!==1||(i=e[0].value),i}},3100:function(e,t,i){i.d(t,{D:()=>f,k:()=>v});var r=i(4518),l=i(5543),a=i(3269),n=i(3549),o=i(6384),s=i(6370),c=i(6245),d=i(2861),u=i(8272),p=i(8920),m=i(2513),h=i(4421),g=i(3934);let f=(0,a.dm)(e=>{let{close:t}=(0,m.D5)(),{onReset:i=t}=e,o=(0,d.G)("organizationProfile.invitePage.title"),u=(0,d.G)("organizationProfile.invitePage.subtitle"),p=(0,a.f0)(),h=(0,c.X)({onNextStep:()=>p.setError(void 0)}),{organization:f}=(0,l.Z5)();return f?(0,r.FD)(c.s,{...h.props,children:[(0,r.Y)(n.M,{headerTitle:o,headerSubtitle:u,children:(0,r.Y)(g.B,{onSuccess:h.nextStep,onReset:i})}),(0,r.Y)(s.B,{title:o,onFinish:t,contents:(0,r.Y)(v,{})})]}):null}),v=()=>(0,r.FD)(u.so,{direction:"col",center:!0,gap:4,children:[(0,r.Y)(o.A,{boxElementDescriptor:p.$z.invitationsSentIconBox,iconElementDescriptor:p.$z.invitationsSentIcon,icon:h.A}),(0,r.Y)(u.EY,{localizationKey:(0,d.G)("organizationProfile.invitePage.successMessage")})]})},4482:function(e,t,i){i.d(t,{Vo:()=>g,Yq:()=>h,bQ:()=>p});var r=i(4518),l=i(5074),a=i(8819),n=i(1586),o=i(8272),s=i(8920),c=i(78),d=i(2861),u=i(3486);let p=e=>{let{headers:t,page:i,onPageChange:l,rows:n,isLoading:c,itemCount:d,itemsPerPage:u,pageCount:p,emptyStateLocalizationKey:h}=e,g=d>0?Math.max(0,(i-1)*u)+1:0,f=Math.min(i*u,d);return(0,r.FD)(o.fv,{gap:4,sx:{width:"100%"},children:[(0,r.Y)(o.so,{sx:e=>({overflowX:"auto",padding:e.space.$1}),children:(0,r.FD)(o.XI,{children:[(0,r.Y)(o.d8,{children:(0,r.Y)(o.Tr,{children:t.map((e,t)=>(0,r.Y)(o.Th,{elementDescriptor:s.$z.tableHead,localizationKey:e},t))})}),(0,r.Y)(o.NN,{children:c?(0,r.Y)(o.Tr,{children:(0,r.Y)(o.Td,{colSpan:4,children:(0,r.Y)(o.y$,{colorScheme:"primary",sx:{margin:"auto",display:"block"},elementDescriptor:s.$z.spinner})})}):n.length?n:(0,r.Y)(m,{localizationKey:h},"empty")})]})}),p>1&&(0,r.Y)(a.d,{count:p,page:i,onChange:l,siblingCount:1,rowInfo:{allRowsCount:d,startingRow:g,endingRow:f}})]})},m=e=>(0,r.Y)(o.Tr,{children:(0,r.Y)(o.Td,{colSpan:4,children:(0,r.Y)(o.EY,{localizationKey:e.localizationKey,sx:{margin:"auto",display:"block",width:"fit-content"}})})}),h=e=>(0,r.Y)(o.Tr,{...e,sx:e=>({":hover":{backgroundColor:e.colors.$neutralAlpha50}})}),g=e=>{let{value:t,fallbackLabel:i,roles:a,onChange:s,isDisabled:p,triggerSx:m,optionListSx:h,prefixLocalizationKey:g}=e,{localizeCustomRole:v}=(0,u.l)(),b=(0,l.useMemo)(()=>[...a||[]],[a]),Y=(0,l.useMemo)(()=>b.find(e=>e.value===t),[b,t]),{t:_}=(0,c._)(),z=(0,l.useMemo)(()=>b.map(e=>({value:e.value,label:v(e.value)||e.label})),[b,v]);return(0,r.FD)(n.l6,{elementId:"role",options:z,value:t,placeholder:_((0,d.G)("organizationProfile.invitePage.selectDropdown__role")),onChange:e=>s(e.value),renderOption:(e,t,i)=>(0,r.Y)(f,{isSelected:i,option:e}),children:[(0,r.Y)("input",{name:"role",type:"hidden",value:t}),(0,r.Y)(n.JC,{sx:m||(e=>({color:e.colors.$colorForeground,backgroundColor:"transparent",textWrap:"nowrap"})),isDisabled:p||!!t&&b.length>0&&!Y,children:Y?.label||Y?.value?(0,r.FD)(o.so,{as:"span",gap:1,children:[g&&(0,r.Y)(o.EY,{as:"span",colorScheme:"secondary",localizationKey:g}),(0,r.Y)(o.EY,{as:"span",colorScheme:"body",children:v(Y?.value)||Y?.label})]}):i?(0,r.Y)(o.EY,{as:"span",colorScheme:"body",children:i}):null}),(0,r.Y)(n.UL,{sx:h})]})},f=(0,l.memo)(e=>{let{option:t,isSelected:i,sx:l,...a}=e;return(0,r.Y)(o.so,{sx:[e=>({width:"100%",padding:`${e.space.$2} ${e.space.$4}`,borderRadius:e.radii.$md}),l],...a,children:(0,r.Y)(o.EY,{variant:"subtitle",children:t?.label})})})},5377:function(e,t,i){i.d(t,{i:()=>c});var r=i(4518),l=i(3817),a=i(6890),n=i(8272),o=i(8920),s=i(2861);let c=e=>{let{organization:t,...i}=e;return(0,r.FD)(n.fv,{elementDescriptor:o.$z.organizationAvatarUploaderContainer,children:[(0,r.Y)(n.EY,{variant:"subtitle",sx:e=>({textAlign:"left",marginBottom:e.space.$2}),localizationKey:(0,s.G)("organizationProfile.start.profileSection.uploadAction__title")}),(0,r.Y)(l.k,{...i,title:(0,s.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,r.Y)(a.h,{size:e=>e.sizes.$16,...t})})]})}},3689:function(e,t,i){i.d(t,{l_:()=>l,mu:()=>r});let r={userMemberships:{infinite:!0},userInvitations:{infinite:!0},userSuggestions:{infinite:!0,status:["pending","accepted"]}},l=(e,t,i)=>{if(void 0===t)return[{data:[e],total_count:1}];let r=t?.[t.length-1]?.total_count||1;return t.map(t=>{if(void 0===t)return t;let l=t.data.map(t=>t.id===e.id?{...e}:t);return{...t,data:l,total_count:"negative"===i?r-1:r}})}}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["573"],{3934:function(e,t,i){i.d(t,{B:()=>y});var r=i(4518),l=i(3610),a=i(1210),n=i(5074),o=i(3269),s=i(2454),c=i(1475),d=i(6212),u=i(4468),p=i(3990),m=i(8640),h=i(7697),g=i(8272),f=i(3486),v=i(78),b=i(2861),Y=i(7591),_=i(4482);let z=e=>/^\S+@\S+\.\S+$/.test(e),y=e=>{let{onSuccess:t,onReset:i,resetButtonLabel:h}=e,{organization:f,invitations:_}=(0,a.Z5)({invitations:{pageSize:10,keepPreviousData:!0}}),y=(0,o.f0)(),{t:D,locale:$}=(0,v._)(),[w,F]=(0,n.useState)(!1),P=(0,m.tJ)("emailAddress","",{type:"text",label:(0,b.G)("formFieldLabel__emailAddresses")}),k=S(),C=(0,m.tJ)("role","",{label:(0,b.G)("formFieldLabel__role")});if((0,n.useEffect)(()=>{!C.value&&k&&C.setValue(k)},[k,C]),!f)return null;let{props:{setError:E,setWarning:A,setSuccess:G,setInfo:T,isFocused:K,validatePassword:M,setHasPassedComplexity:R,hasPassedComplexity:B,feedback:I,feedbackType:L,clearFeedback:j,...V}}=P,W=(!!P.value.length||w)&&!!C.value;return(0,r.FD)(s.l.Root,{onSubmit:e=>{if(e.preventDefault(),!W)return;let i=new FormData(e.currentTarget);return f.inviteMembers({emailAddresses:P.value.split(","),role:i.get("role")}).then(async()=>(await _?.revalidate?.(),t?.())).catch(e=>{var t;let i,r;if(!(0,l.$R)(e))return void(0,u.H4)(e,[],y.setError);switch(t=e.errors[0],i=new Set([...t.meta?.emailAddresses??[],...t.meta?.identifiers??[]]),r=P.value.split(","),P.setValue(r.filter(e=>!i.has(e)).join(",")),e.errors?.[0]?.code){case"duplicate_record":{let t=e.errors[0].meta?.emailAddresses||[];y.setError(D((0,b.G)("organizationProfile.invitePage.detailsTitle__inviteFailed",{email_addresses:(0,p.kS)(t,$)})));break}case"already_a_member_in_organization":{let t=e.errors[0].longMessage??"",i=t.match(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/)?.[0];(0,u.H4)(e,[],e=>i?y.setError(D((0,b.G)("unstable__errors.already_a_member_in_organization",{email:i}))):y.setError(e));break}default:(0,u.H4)(e,[],y.setError)}})},children:[(0,r.Y)(s.l.ControlRow,{elementId:P.id,children:(0,r.Y)(d.F,{...V,autoFocus:!0,validate:z,sx:{width:"100%"},validateUnsubmittedEmail:e=>F(z(e)),placeholder:(0,b.G)("formFieldInputPlaceholder__emailAddresses")})}),(0,r.FD)(g.so,{align:"center",justify:"between",sx:e=>({marginTop:e.space.$2,gap:e.space.$4,flexWrap:"wrap",[Y.g.sm]:{justifyContent:"center"}}),children:[(0,r.Y)(x,{...C}),(0,r.FD)(c.c,{sx:e=>({margin:e.space.$none,flexWrap:"wrap",justifyContent:"center"}),children:[(0,r.Y)(s.l.SubmitButton,{block:!1,isDisabled:!W,localizationKey:(0,b.G)("organizationProfile.invitePage.formButtonPrimary__continue")}),(0,r.Y)(s.l.ResetButton,{localizationKey:h||(0,b.G)("userProfile.formButtonReset"),block:!1,onClick:i})]})]})]})},x=e=>{let{options:t,isLoading:i}=(0,f.x)(),{t:l}=(0,v._)();return(0,r.Y)(s.l.ControlRow,{elementId:e.id,children:(0,r.Y)(g.so,{direction:"col",gap:2,children:(0,r.Y)(_.Vo,{...e.props,roles:t,isDisabled:i,onChange:t=>e.setValue(t),triggerSx:e=>({minWidth:e.sizes.$40,justifyContent:"space-between",display:"flex"}),optionListSx:e=>({minWidth:e.sizes.$48}),prefixLocalizationKey:`${l((0,b.G)("formFieldLabel__role"))}:`})})})},S=()=>{let{options:e}=(0,f.x)(),{organizationSettings:t}=(0,h.O)(),i=t.domains.defaultRole;return i||e?.length!==1||(i=e[0].value),i}},3100:function(e,t,i){i.d(t,{D:()=>f,k:()=>v});var r=i(4518),l=i(1210),a=i(3269),n=i(3549),o=i(6384),s=i(6370),c=i(6245),d=i(2861),u=i(8272),p=i(8920),m=i(2513),h=i(4421),g=i(3934);let f=(0,a.dm)(e=>{let{close:t}=(0,m.D5)(),{onReset:i=t}=e,o=(0,d.G)("organizationProfile.invitePage.title"),u=(0,d.G)("organizationProfile.invitePage.subtitle"),p=(0,a.f0)(),h=(0,c.X)({onNextStep:()=>p.setError(void 0)}),{organization:f}=(0,l.Z5)();return f?(0,r.FD)(c.s,{...h.props,children:[(0,r.Y)(n.M,{headerTitle:o,headerSubtitle:u,children:(0,r.Y)(g.B,{onSuccess:h.nextStep,onReset:i})}),(0,r.Y)(s.B,{title:o,onFinish:t,contents:(0,r.Y)(v,{})})]}):null}),v=()=>(0,r.FD)(u.so,{direction:"col",center:!0,gap:4,children:[(0,r.Y)(o.A,{boxElementDescriptor:p.$z.invitationsSentIconBox,iconElementDescriptor:p.$z.invitationsSentIcon,icon:h.A}),(0,r.Y)(u.EY,{localizationKey:(0,d.G)("organizationProfile.invitePage.successMessage")})]})},4482:function(e,t,i){i.d(t,{Vo:()=>g,Yq:()=>h,bQ:()=>p});var r=i(4518),l=i(5074),a=i(8819),n=i(1586),o=i(8272),s=i(8920),c=i(78),d=i(2861),u=i(3486);let p=e=>{let{headers:t,page:i,onPageChange:l,rows:n,isLoading:c,itemCount:d,itemsPerPage:u,pageCount:p,emptyStateLocalizationKey:h}=e,g=d>0?Math.max(0,(i-1)*u)+1:0,f=Math.min(i*u,d);return(0,r.FD)(o.fv,{gap:4,sx:{width:"100%"},children:[(0,r.Y)(o.so,{sx:e=>({overflowX:"auto",padding:e.space.$1}),children:(0,r.FD)(o.XI,{children:[(0,r.Y)(o.d8,{children:(0,r.Y)(o.Tr,{children:t.map((e,t)=>(0,r.Y)(o.Th,{elementDescriptor:s.$z.tableHead,localizationKey:e},t))})}),(0,r.Y)(o.NN,{children:c?(0,r.Y)(o.Tr,{children:(0,r.Y)(o.Td,{colSpan:4,children:(0,r.Y)(o.y$,{colorScheme:"primary",sx:{margin:"auto",display:"block"},elementDescriptor:s.$z.spinner})})}):n.length?n:(0,r.Y)(m,{localizationKey:h},"empty")})]})}),p>1&&(0,r.Y)(a.d,{count:p,page:i,onChange:l,siblingCount:1,rowInfo:{allRowsCount:d,startingRow:g,endingRow:f}})]})},m=e=>(0,r.Y)(o.Tr,{children:(0,r.Y)(o.Td,{colSpan:4,children:(0,r.Y)(o.EY,{localizationKey:e.localizationKey,sx:{margin:"auto",display:"block",width:"fit-content"}})})}),h=e=>(0,r.Y)(o.Tr,{...e,sx:e=>({":hover":{backgroundColor:e.colors.$neutralAlpha50}})}),g=e=>{let{value:t,fallbackLabel:i,roles:a,onChange:s,isDisabled:p,triggerSx:m,optionListSx:h,prefixLocalizationKey:g}=e,{localizeCustomRole:v}=(0,u.l)(),b=(0,l.useMemo)(()=>[...a||[]],[a]),Y=(0,l.useMemo)(()=>b.find(e=>e.value===t),[b,t]),{t:_}=(0,c._)(),z=(0,l.useMemo)(()=>b.map(e=>({value:e.value,label:v(e.value)||e.label})),[b,v]);return(0,r.FD)(n.l6,{elementId:"role",options:z,value:t,placeholder:_((0,d.G)("organizationProfile.invitePage.selectDropdown__role")),onChange:e=>s(e.value),renderOption:(e,t,i)=>(0,r.Y)(f,{isSelected:i,option:e}),children:[(0,r.Y)("input",{name:"role",type:"hidden",value:t}),(0,r.Y)(n.JC,{sx:m||(e=>({color:e.colors.$colorForeground,backgroundColor:"transparent",textWrap:"nowrap"})),isDisabled:p||!!t&&b.length>0&&!Y,children:Y?.label||Y?.value?(0,r.FD)(o.so,{as:"span",gap:1,children:[g&&(0,r.Y)(o.EY,{as:"span",colorScheme:"secondary",localizationKey:g}),(0,r.Y)(o.EY,{as:"span",colorScheme:"body",children:v(Y?.value)||Y?.label})]}):i?(0,r.Y)(o.EY,{as:"span",colorScheme:"body",children:i}):null}),(0,r.Y)(n.UL,{sx:h})]})},f=(0,l.memo)(e=>{let{option:t,isSelected:i,sx:l,...a}=e;return(0,r.Y)(o.so,{sx:[e=>({width:"100%",padding:`${e.space.$2} ${e.space.$4}`,borderRadius:e.radii.$md}),l],...a,children:(0,r.Y)(o.EY,{variant:"subtitle",children:t?.label})})})},5377:function(e,t,i){i.d(t,{i:()=>c});var r=i(4518),l=i(3817),a=i(6890),n=i(8272),o=i(8920),s=i(2861);let c=e=>{let{organization:t,...i}=e;return(0,r.FD)(n.fv,{elementDescriptor:o.$z.organizationAvatarUploaderContainer,children:[(0,r.Y)(n.EY,{variant:"subtitle",sx:e=>({textAlign:"left",marginBottom:e.space.$2}),localizationKey:(0,s.G)("organizationProfile.start.profileSection.uploadAction__title")}),(0,r.Y)(l.k,{...i,title:(0,s.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,r.Y)(a.h,{size:e=>e.sizes.$16,...t})})]})}},3689:function(e,t,i){i.d(t,{l_:()=>l,mu:()=>r});let r={userMemberships:{infinite:!0},userInvitations:{infinite:!0},userSuggestions:{infinite:!0,status:["pending","accepted"]}},l=(e,t,i)=>{if(void 0===t)return[{data:[e],total_count:1}];let r=t?.[t.length-1]?.total_count||1;return t.map(t=>{if(void 0===t)return t;let l=t.data.map(t=>t.id===e.id?{...e}:t);return{...t,data:l,total_count:"negative"===i?r-1:r}})}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["970"],{1217:function(e,r,a){a.d(r,{n:()=>_});var i=a(4518),l=a(5543),n=a(5074),t=a(4607),o=a(164),c=a(7288),d=a(8511),s=a(6455),p=a(5424),g=a(7477),m=a(6256),u=a(8272),h=a(8920),b=a(2861),$=a(2405),x=a(9679),f=a(9406),z=a(1464),T=a(3679);function y({plans:e,planPeriod:r,setPlanPeriod:a,onSelect:l,isCompact:n,props:t}){return(0,i.Y)(f.S,{children:(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTable,sx:e=>({"--grid-min-size":n?"11.75rem":"20rem","--grid-max-columns":"infinity","--grid-gap":e.space.$4,"--max-column-width":"100% / var(--grid-max-columns, infinity) - var(--grid-gap)","--column-width":"max(var(--max-column-width), min(var(--grid-min-size, 10rem), 100%))",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(var(--column-width), 1fr))",gridTemplateRows:"auto 1fr",gap:`var(--grid-gap-y, var(--grid-gap, ${e.space.$4})) var(--grid-gap, ${e.space.$4})`,alignItems:"stretch",width:"100%",minWidth:"0"}),"data-variant":n?"compact":"default",children:e?.map(e=>(0,i.Y)(D,{plan:e,planPeriod:r,setPlanPeriod:a,onSelect:l,props:t,isCompact:n},e.id))})})}function D(e){let{plan:r,planPeriod:a,setPlanPeriod:t,onSelect:d,props:$,isCompact:x=!1}=e,f=(0,l.ho)(),{isSignedIn:y}=(0,l.wV)(),{mode:D="mounted",ctaPosition:C}=(0,o.T)(),w=(0,m.XX)(),S=(0,l.Wf)(),v=$.ctaPosition||C||"bottom",M=$.collapseFeatures||!1,{id:P,slug:k}=r,I=(0,g.Fd)(e=>e({permission:"org:sys_billing:manage"})||"user"===w),{buttonPropsForPlan:E,activeOrUpcomingSubscriptionBasedOnPlanPeriod:B}=(0,c.D)(),R=n.useMemo(()=>B(r,a),[r,a,B]),_=r.features.length>0,{shouldShowFooter:G,shouldShowFooterNotice:A}=(e=>{let[r,a]=(e=>{let{subscription:r,plan:a,planPeriod:i,for:l,hasActiveOrganization:n}=e,t=[!0,!0],o=[!0,!1],c=[!1,!1];if(!r)return"organization"!==l||n?o:c;if("upcoming"===r.status)return t;if("active"===r.status){let e=!!r.canceledAt,l=i!==r.planPeriod&&!!a.annualMonthlyFee,n=a.freeTrialEnabled&&r.isFreeTrial;if(e||l)return o;if(n)return t}return c})(e);return{shouldShowFooter:r,shouldShowFooterNotice:a}})({subscription:R,plan:r,planPeriod:a,for:$.for,hasActiveOrganization:!!S?.organization});return(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCard,elementId:h.$z.pricingTableCard.setId(k),sx:e=>({display:"grid",gap:0,gridTemplateRows:"subgrid",gridRow:"span 5",background:z.s.mutedBackground(e),borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha150,borderRadius:e.radii.$xl,overflow:"hidden",textAlign:"left"}),"data-variant":x?"compact":"default",children:[(0,i.Y)(Y,{plan:r,isCompact:x,planPeriod:a,setPlanPeriod:t,badge:R?(0,i.Y)(T.V,{subscription:R.isFreeTrial?{status:"free_trial"}:R}):void 0}),(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCardBody,sx:{display:"grid",gridTemplateRows:"subgrid",gridRow:"span 2",gap:0},children:["bottom"===v&&!M||"top"===v&&_?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableCardFeatures,sx:e=>({display:"flex",flexDirection:"column",flex:"1",padding:x?e.space.$3:e.space.$4,backgroundColor:_?e.colors.$colorBackground:"transparent",borderTopWidth:_?e.borderWidths.$normal:0,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha150}),"data-variant":x?"compact":"default",children:(0,i.Y)(F,{plan:r,isCompact:x,showPlanDetails:e=>{let i=(0,p.J)(D,e);f.__internal_openPlanDetails({plan:r,initialPlanPeriod:a,portalRoot:i})}})}):null,G?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableCardFooter,sx:e=>({marginTop:"auto",padding:x?e.space.$3:e.space.$4,borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha150,order:"top"===v?-1:void 0}),children:A&&R?(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFooterNotice,variant:x?"buttonSmall":"buttonLarge",localizationKey:r.freeTrialEnabled&&R.isFreeTrial&&R.periodEnd?(0,b.G)("badge__trialEndsAt",{date:R.periodEnd}):(0,b.G)("badge__startsAt",{date:R.periodStart}),colorScheme:"secondary",sx:e=>({paddingBlock:e.space.$1x5,textAlign:"center"})}):(0,i.FD)(s.m_.Root,{children:[(0,i.Y)(s.m_.Trigger,{sx:{width:"100%"},children:(0,i.Y)(u.$n,{elementDescriptor:h.$z.pricingTableCardFooterButton,block:!0,textVariant:x?"buttonSmall":"buttonLarge",...E({plan:r,isCompact:x,selectedPlanPeriod:a}),onClick:e=>{d(r,e)}})}),y&&!I&&(0,i.Y)(s.m_.Content,{text:(0,b.G)("organizationProfile.plansPage.alerts.noPermissionsToManageBilling")})]})}):(0,i.Y)(u.az,{sx:e=>({backgroundColor:_?e.colors.$colorBackground:"transparent"})})]})]},P)}let Y=n.forwardRef((e,r)=>{let{plan:a,isCompact:l,planPeriod:t,setPlanPeriod:o,badge:s}=e,{name:p,annualMonthlyFee:g}=a,m=!!g,$=n.useMemo(()=>m&&"annual"===t?a.annualMonthlyFee:a.fee,[m,t,a.fee,a.annualMonthlyFee]),x=n.useMemo(()=>(0,c.Ij)($.amountFormatted),[$.amountFormatted]);return(0,i.FD)(u.az,{ref:r,elementDescriptor:h.$z.pricingTableCardHeader,sx:e=>({width:"100%",padding:l?e.space.$3:e.space.$4,display:"grid",gap:e.space.$1,gridRow:"span 3",gridTemplateRows:"subgrid"}),"data-variant":l?"compact":"default",children:[(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCardTitleContainer,children:[(0,i.FD)(u.az,{sx:e=>({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:e.space.$0x25}),children:[(0,i.Y)(u.DZ,{elementDescriptor:h.$z.pricingTableCardTitle,as:"h2",textVariant:l?"h3":"h2",children:p}),s&&s]}),!l&&a.description?(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardDescription,variant:"subtitle",colorScheme:"secondary",sx:{justifySelf:"flex-start"},children:a.description}):null]}),(0,i.FD)(u.so,{elementDescriptor:h.$z.pricingTableCardFeeContainer,"data-variant":l?"compact":"default",align:"center",wrap:"wrap",sx:e=>({columnGap:e.space.$1,marginTop:e.space.$1}),children:[(0,i.FD)(u.EY,{elementDescriptor:h.$z.pricingTableCardFee,variant:l?"h2":"h1",colorScheme:"body",children:[$.currencySymbol,x]}),a.isDefault?null:(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFeePeriod,variant:"caption",colorScheme:"secondary",sx:e=>({textTransform:"lowercase",":before":{content:'"/"',marginInlineEnd:e.space.$0x25}}),localizationKey:(0,b.G)("billing.month")})]}),m&&o?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableCardPeriodToggle,sx:e=>({marginTop:e.space.$1}),children:(0,i.Y)(d.d,{isChecked:"annual"===t,onChange:e=>o(e?"annual":"month"),label:(0,b.G)("billing.billedAnnually")})}):(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFeePeriodNotice,variant:"caption",colorScheme:"secondary",localizationKey:a.isDefault?(0,b.G)("billing.alwaysFree"):(0,b.G)("billing.billedMonthlyOnly"),sx:e=>({justifySelf:"flex-start",alignSelf:"center",marginTop:e.space.$1})})]})}),F=n.forwardRef((e,r)=>{let{plan:a,isCompact:l,showPlanDetails:n}=e,t=a.features.length,o=l?t>3:t>8;return(0,i.FD)(u.az,{ref:r,elementDescriptor:h.$z.pricingTableCardFeatures,sx:e=>({display:"grid",flex:1,rowGap:l?e.space.$2:e.space.$3}),children:[(0,i.Y)(u.fv,{elementDescriptor:h.$z.pricingTableCardFeaturesList,"data-variant":l?"compact":"default",as:"ul",role:"list",sx:e=>({flex:"1",rowGap:l?e.space.$2:e.space.$3,margin:0,padding:0}),children:a.features.slice(0,o?l?3:8:t).map(e=>(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCardFeaturesListItem,elementId:h.$z.pricingTableCardFeaturesListItem.setId(e.slug),as:"li",sx:e=>({display:"flex",alignItems:"baseline",gap:e.space.$2,margin:0,padding:0}),children:[(0,i.Y)(u.In,{icon:$.A,colorScheme:"neutral",size:"sm","aria-hidden":!0,sx:e=>({transform:`translateY(${e.space.$0x25})`})}),(0,i.Y)(u.L9,{elementDescriptor:h.$z.pricingTableCardFeaturesListItemContent,children:(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFeaturesListItemTitle,colorScheme:"body",sx:e=>({fontWeight:e.fontWeights.$normal}),children:e.name})})]},e.id))}),o&&(0,i.FD)(u.dF,{onClick:e=>n(e),variant:"link",sx:e=>({marginBlockStart:"auto",paddingBlock:e.space.$1,gap:e.space.$1}),children:[(0,i.Y)(u.In,{icon:x.A,colorScheme:"neutral",size:"md","aria-hidden":!0}),(0,i.Y)(u.L9,{localizationKey:(0,b.G)("billing.seeAllFeatures")})]})]})});var C=a(6195),w=a(6839),S=a(4620),v=a(6580),M=a(78),P=a(359),k=a(9068),I=a(7591);function E({plans:e=[],planPeriod:r,setPlanPeriod:a,onSelect:l,highlightedPlan:t}){let o=(0,P.j)(),{animations:d}=(0,v.K)().parsedOptions,s=!o&&!0===d,p=n.useId(),g=`${p}-segmented-control`,{buttonPropsForPlan:m}=(0,c.D)(),{t:x}=(0,M._)(),T=e=>({transition:s?`grid-template-rows ${e.transitionDuration.$slower} ${e.transitionTiming.$slowBezier}`:"none"}),y=e=>({background:z.s.mergedColorsBackground(S.T.setAlpha(e.colors.$colorBackground,1),e.colors.$neutralAlpha25)}),D=n.useMemo(()=>`repeat(${e.length+1}, minmax(9.375rem,1fr))`,[e.length]),Y=n.useMemo(()=>e.some(e=>!!e.annualMonthlyFee),[e]),F=n.useMemo(()=>{let r=new Set;return e.forEach(({features:e})=>{e.forEach(({name:e})=>r.add(e))}),Array.from(r)},[e]);return e.length?(0,i.Y)(f.S,{children:(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrix,sx:e=>({position:"relative",minWidth:"100%",display:"grid",isolation:"isolate",backgroundColor:e.colors.$colorBackground,[I.g.md]:{overflowX:"auto"}}),children:(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableMatrixTable,role:"table",children:[(0,i.Y)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRowGroup,h.$z.pricingTableMatrixRowGroupHeader],role:"rowgroup",sx:e=>({position:"sticky",top:0,backgroundColor:e.colors.$colorBackground,borderBottomWidth:e.borderWidths.$normal,borderBottomStyle:e.borderStyles.$solid,borderBottomColor:e.colors.$borderAlpha100,zIndex:1}),children:(0,i.FD)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRow,h.$z.pricingTableMatrixRowHeader],role:"row",sx:{display:"grid",gridTemplateColumns:D},children:[(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixColumnHeader,role:"columnheader",sx:e=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-end",rowGap:e.space.$3,paddingBlockEnd:e.space.$12,paddingInlineStart:e.space.$3}),children:Y?(0,i.FD)(i.FK,{children:[(0,i.Y)(u.EY,{id:g,colorScheme:"secondary",variant:"caption",localizationKey:(0,b.G)("billing.pricingTable.billingCycle"),children:"Billing cycle"}),(0,i.FD)(w.I.Root,{"aria-labelledby":g,value:r,onChange:e=>a(e),children:[(0,i.Y)(w.I.Button,{value:"month",text:(0,b.G)("billing.monthly")}),(0,i.Y)(w.I.Button,{value:"annual",text:(0,b.G)("billing.annually")})]})]}):null}),e.map(e=>{let a=e.slug===t,n=e.annualMonthlyFee&&"annual"===r?e.annualMonthlyFee:e.fee;return(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableMatrixColumnHeader,role:"columnheader",sx:[e=>({display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,borderStartStartRadius:e.radii.$xl,borderStartEndRadius:e.radii.$xl}),a&&y],"data-highlighted":a,children:[(0,i.FD)(u.az,{sx:e=>({width:"100%",padding:e.space.$4}),children:[e.avatarUrl||a?(0,i.FD)(u.L9,{sx:e=>({width:"100%",display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBlockEnd:e.space.$3}),children:[e.avatarUrl?(0,i.Y)(C.e,{elementDescriptor:h.$z.pricingTableMatrixAvatar,size:e=>40,title:e.name,initials:e.name[0],rounded:!1,imageUrl:e.avatarUrl}):null,a?(0,i.Y)(u.Ex,{elementDescriptor:h.$z.pricingTableMatrixBadge,colorScheme:"secondary",localizationKey:(0,b.G)("billing.popular")}):null]}):null,(0,i.Y)(u.DZ,{elementDescriptor:h.$z.pricingTableMatrixPlanName,textVariant:"h3",children:e.name}),(0,i.Y)(u.so,{align:"center",wrap:"wrap",sx:e=>({marginTop:e.space.$2,columnGap:e.space.$1x5}),children:e.hasBaseFee?(0,i.FD)(i.FK,{children:[(0,i.FD)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFee,variant:"h2",colorScheme:"body",children:[n.currencySymbol,n.amountFormatted]}),(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFeePeriod,variant:"caption",colorScheme:"secondary",sx:e=>({textTransform:"lowercase",":before":{content:'"/"',marginInlineEnd:e.space.$1}}),localizationKey:(0,b.G)("billing.month")}),e.annualMonthlyFee?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixFeePeriodNotice,sx:[e=>({width:"100%",display:"grid",gridTemplateRows:"annual"===r?"1fr":"0fr"}),T],inert:"annual"!==r?"true":void 0,children:(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixFeePeriodNoticeInner,sx:{overflow:"hidden",minHeight:0},children:(0,i.FD)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFeePeriodNoticeLabel,variant:"caption",colorScheme:"secondary",sx:e=>({width:"100%",display:"flex",alignItems:"center",columnGap:e.space.$1}),children:[(0,i.Y)(u.In,{icon:k.A,colorScheme:"neutral",size:"sm","aria-hidden":!0})," ",(0,i.Y)(u.L9,{localizationKey:(0,b.G)("billing.billedAnnually")})]})})}):null]}):(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFee,variant:"h2",localizationKey:(0,b.G)("billing.free"),colorScheme:"body"})})]}),e.isDefault?null:(0,i.Y)(u.az,{sx:e=>({width:"100%",marginBlockStart:"auto",marginBlockEnd:e.space.$8,paddingBlockStart:e.space.$2,paddingBlockEnd:e.space.$4,paddingInline:e.space.$4}),children:(0,i.Y)(u.$n,{block:!0,textVariant:"buttonSmall",size:"xs",onClick:r=>{l(e,r)},...m({plan:e,selectedPlanPeriod:r}),colorScheme:a?"primary":"secondary"})})]},e.slug)})]})}),(0,i.FD)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRowGroup,h.$z.pricingTableMatrixRowGroupBody],role:"rowgroup",children:[F.map(r=>(0,i.FD)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRow,h.$z.pricingTableMatrixRowBody],role:"row",sx:e=>({position:"relative",display:"grid",gridTemplateColumns:D,borderBottomWidth:e.borderWidths.$normal,borderBottomStyle:e.borderStyles.$solid,borderBottomColor:e.colors.$borderAlpha100,":after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",backgroundColor:e.colors.$neutralAlpha25,opacity:0},":hover:after":{opacity:1}}),children:[(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixCell,role:"cell",sx:e=>({padding:e.space.$3}),children:(0,i.Y)(u.EY,{colorScheme:"body",children:r})}),e.map(e=>{let a=e.slug===t,l=e.features.some(e=>e.name===r);return(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixCell,role:"cell",sx:[e=>({display:"grid",placeContent:"center",padding:e.space.$3}),a&&y],"data-highlighted":a,"data-checked":l,children:l&&(0,i.Y)(u.In,{icon:$.A,colorScheme:"neutral",size:"sm","aria-label":x((0,b.G)("billing.pricingTable.included"))})},e.slug)})]},r)),(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableMatrixFooter,sx:{display:"grid",gridTemplateColumns:D},children:[(0,i.Y)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixCell,h.$z.pricingTableMatrixCellFooter]}),e.map(e=>{let r=e.slug===t;return(0,i.Y)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixCell,h.$z.pricingTableMatrixCellFooter],sx:[e=>({height:e.space.$10,borderEndStartRadius:e.radii.$xl,borderEndEndRadius:e.radii.$xl}),r&&y],"data-highlighted":r},e.slug)})]})]})]})})}):null}let B=e=>{let r=(0,l.ho)(),{mode:a="mounted",signInMode:d="redirect"}=(0,o.T)(),s="modal"===a,{data:p,subscriptionItems:g}=(0,c.Rs)(),{data:m}=(0,c.A$)(),{handleSelectPlan:u}=(0,c.D)(),h=(0,n.useMemo)(()=>r.isSignedIn?p?m:[]:m,[r.isSignedIn,m,p]),b=(0,n.useMemo)(()=>{if(s){let e=g?.find(e=>"upcoming"===e.status);if(e)return e.planPeriod;let r=g?.find(e=>!e.canceledAt&&"active"===e.status&&!e.plan.isDefault);if(r)return r.planPeriod}return"annual"},[s,g]),[$,x]=(0,n.useState)(b);(0,n.useEffect)(()=>{x(b)},[b]);let f=(i,l)=>{if(!r.isSignedIn)return"modal"===d?r.openSignIn():r.redirectToSignIn();u({mode:a,plan:i,planPeriod:$,event:l,appearance:e.checkoutProps?.appearance,newSubscriptionRedirectUrl:e.newSubscriptionRedirectUrl})};return(0,c.mu)(),(0,i.Y)(t.n.Root,{flow:"pricingTable",isFlowReady:r.isSignedIn?!!p:m.length>0,sx:{width:"100%"},children:"modal"!==a&&"matrix"===e.layout?(0,i.Y)(E,{plans:h,planPeriod:$,setPlanPeriod:x,onSelect:f,highlightedPlan:e.highlightPlan}):(0,i.Y)(y,{plans:h,planPeriod:$,setPlanPeriod:x,onSelect:f,isCompact:s,props:e})})},R=e=>(0,i.Y)("div",{children:(0,i.Y)(B,{...e})}),_=e=>{let{mode:r="mounted"}=(0,o.T)();return"modal"===r?(0,i.Y)(R,{...e}):(0,i.Y)(B,{...e})}},3679:function(e,r,a){a.d(r,{V:()=>c});var i=a(4518),l=a(8272),n=a(2861);let t={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"},c=({subscription:e,elementDescriptor:r})=>(0,i.Y)(l.Ex,{elementDescriptor:r,colorScheme:o[e.status],localizationKey:(0,n.G)(t[e.status])})},164:function(e,r,a){a.d(r,{T:()=>n,a:()=>l});var i=a(5074);let l=(0,i.createContext)(null),n=()=>{let e=(0,i.useContext)(l);if(!e||"PricingTable"!==e.componentName)throw Error("Clerk: usePricingTableContext called outside PricingTable.");let{componentName:r,...a}=e;return{...a,componentName:r}}}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["970"],{1217:function(e,r,a){a.d(r,{n:()=>_});var i=a(4518),l=a(1210),n=a(5074),t=a(4607),o=a(164),c=a(7288),d=a(8511),s=a(6455),p=a(5424),g=a(7477),m=a(6256),u=a(8272),h=a(8920),b=a(2861),$=a(2405),x=a(9679),f=a(9406),z=a(1464),T=a(3679);function y({plans:e,planPeriod:r,setPlanPeriod:a,onSelect:l,isCompact:n,props:t}){return(0,i.Y)(f.S,{children:(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTable,sx:e=>({"--grid-min-size":n?"11.75rem":"20rem","--grid-max-columns":"infinity","--grid-gap":e.space.$4,"--max-column-width":"100% / var(--grid-max-columns, infinity) - var(--grid-gap)","--column-width":"max(var(--max-column-width), min(var(--grid-min-size, 10rem), 100%))",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(var(--column-width), 1fr))",gridTemplateRows:"auto 1fr",gap:`var(--grid-gap-y, var(--grid-gap, ${e.space.$4})) var(--grid-gap, ${e.space.$4})`,alignItems:"stretch",width:"100%",minWidth:"0"}),"data-variant":n?"compact":"default",children:e?.map(e=>(0,i.Y)(D,{plan:e,planPeriod:r,setPlanPeriod:a,onSelect:l,props:t,isCompact:n},e.id))})})}function D(e){let{plan:r,planPeriod:a,setPlanPeriod:t,onSelect:d,props:$,isCompact:x=!1}=e,f=(0,l.ho)(),{isSignedIn:y}=(0,l.wV)(),{mode:D="mounted",ctaPosition:C}=(0,o.T)(),w=(0,m.XX)(),S=(0,l.Wf)(),v=$.ctaPosition||C||"bottom",M=$.collapseFeatures||!1,{id:P,slug:k}=r,I=(0,g.Fd)(e=>e({permission:"org:sys_billing:manage"})||"user"===w),{buttonPropsForPlan:E,activeOrUpcomingSubscriptionBasedOnPlanPeriod:B}=(0,c.D)(),R=n.useMemo(()=>B(r,a),[r,a,B]),_=r.features.length>0,{shouldShowFooter:G,shouldShowFooterNotice:A}=(e=>{let[r,a]=(e=>{let{subscription:r,plan:a,planPeriod:i,for:l,hasActiveOrganization:n}=e,t=[!0,!0],o=[!0,!1],c=[!1,!1];if(!r)return"organization"!==l||n?o:c;if("upcoming"===r.status)return t;if("active"===r.status){let e=!!r.canceledAt,l=i!==r.planPeriod&&!!a.annualMonthlyFee,n=a.freeTrialEnabled&&r.isFreeTrial;if(e||l)return o;if(n)return t}return c})(e);return{shouldShowFooter:r,shouldShowFooterNotice:a}})({subscription:R,plan:r,planPeriod:a,for:$.for,hasActiveOrganization:!!S?.organization});return(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCard,elementId:h.$z.pricingTableCard.setId(k),sx:e=>({display:"grid",gap:0,gridTemplateRows:"subgrid",gridRow:"span 5",background:z.s.mutedBackground(e),borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha150,borderRadius:e.radii.$xl,overflow:"hidden",textAlign:"left"}),"data-variant":x?"compact":"default",children:[(0,i.Y)(Y,{plan:r,isCompact:x,planPeriod:a,setPlanPeriod:t,badge:R?(0,i.Y)(T.V,{subscription:R.isFreeTrial?{status:"free_trial"}:R}):void 0}),(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCardBody,sx:{display:"grid",gridTemplateRows:"subgrid",gridRow:"span 2",gap:0},children:["bottom"===v&&!M||"top"===v&&_?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableCardFeatures,sx:e=>({display:"flex",flexDirection:"column",flex:"1",padding:x?e.space.$3:e.space.$4,backgroundColor:_?e.colors.$colorBackground:"transparent",borderTopWidth:_?e.borderWidths.$normal:0,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha150}),"data-variant":x?"compact":"default",children:(0,i.Y)(F,{plan:r,isCompact:x,showPlanDetails:e=>{let i=(0,p.J)(D,e);f.__internal_openPlanDetails({plan:r,initialPlanPeriod:a,portalRoot:i})}})}):null,G?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableCardFooter,sx:e=>({marginTop:"auto",padding:x?e.space.$3:e.space.$4,borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha150,order:"top"===v?-1:void 0}),children:A&&R?(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFooterNotice,variant:x?"buttonSmall":"buttonLarge",localizationKey:r.freeTrialEnabled&&R.isFreeTrial&&R.periodEnd?(0,b.G)("badge__trialEndsAt",{date:R.periodEnd}):(0,b.G)("badge__startsAt",{date:R.periodStart}),colorScheme:"secondary",sx:e=>({paddingBlock:e.space.$1x5,textAlign:"center"})}):(0,i.FD)(s.m_.Root,{children:[(0,i.Y)(s.m_.Trigger,{sx:{width:"100%"},children:(0,i.Y)(u.$n,{elementDescriptor:h.$z.pricingTableCardFooterButton,block:!0,textVariant:x?"buttonSmall":"buttonLarge",...E({plan:r,isCompact:x,selectedPlanPeriod:a}),onClick:e=>{d(r,e)}})}),y&&!I&&(0,i.Y)(s.m_.Content,{text:(0,b.G)("organizationProfile.plansPage.alerts.noPermissionsToManageBilling")})]})}):(0,i.Y)(u.az,{sx:e=>({backgroundColor:_?e.colors.$colorBackground:"transparent"})})]})]},P)}let Y=n.forwardRef((e,r)=>{let{plan:a,isCompact:l,planPeriod:t,setPlanPeriod:o,badge:s}=e,{name:p,annualMonthlyFee:g}=a,m=!!g,$=n.useMemo(()=>m&&"annual"===t?a.annualMonthlyFee:a.fee,[m,t,a.fee,a.annualMonthlyFee]),x=n.useMemo(()=>(0,c.Ij)($.amountFormatted),[$.amountFormatted]);return(0,i.FD)(u.az,{ref:r,elementDescriptor:h.$z.pricingTableCardHeader,sx:e=>({width:"100%",padding:l?e.space.$3:e.space.$4,display:"grid",gap:e.space.$1,gridRow:"span 3",gridTemplateRows:"subgrid"}),"data-variant":l?"compact":"default",children:[(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCardTitleContainer,children:[(0,i.FD)(u.az,{sx:e=>({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:e.space.$0x25}),children:[(0,i.Y)(u.DZ,{elementDescriptor:h.$z.pricingTableCardTitle,as:"h2",textVariant:l?"h3":"h2",children:p}),s&&s]}),!l&&a.description?(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardDescription,variant:"subtitle",colorScheme:"secondary",sx:{justifySelf:"flex-start"},children:a.description}):null]}),(0,i.FD)(u.so,{elementDescriptor:h.$z.pricingTableCardFeeContainer,"data-variant":l?"compact":"default",align:"center",wrap:"wrap",sx:e=>({columnGap:e.space.$1,marginTop:e.space.$1}),children:[(0,i.FD)(u.EY,{elementDescriptor:h.$z.pricingTableCardFee,variant:l?"h2":"h1",colorScheme:"body",children:[$.currencySymbol,x]}),a.isDefault?null:(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFeePeriod,variant:"caption",colorScheme:"secondary",sx:e=>({textTransform:"lowercase",":before":{content:'"/"',marginInlineEnd:e.space.$0x25}}),localizationKey:(0,b.G)("billing.month")})]}),m&&o?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableCardPeriodToggle,sx:e=>({marginTop:e.space.$1}),children:(0,i.Y)(d.d,{isChecked:"annual"===t,onChange:e=>o(e?"annual":"month"),label:(0,b.G)("billing.billedAnnually")})}):(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFeePeriodNotice,variant:"caption",colorScheme:"secondary",localizationKey:a.isDefault?(0,b.G)("billing.alwaysFree"):(0,b.G)("billing.billedMonthlyOnly"),sx:e=>({justifySelf:"flex-start",alignSelf:"center",marginTop:e.space.$1})})]})}),F=n.forwardRef((e,r)=>{let{plan:a,isCompact:l,showPlanDetails:n}=e,t=a.features.length,o=l?t>3:t>8;return(0,i.FD)(u.az,{ref:r,elementDescriptor:h.$z.pricingTableCardFeatures,sx:e=>({display:"grid",flex:1,rowGap:l?e.space.$2:e.space.$3}),children:[(0,i.Y)(u.fv,{elementDescriptor:h.$z.pricingTableCardFeaturesList,"data-variant":l?"compact":"default",as:"ul",role:"list",sx:e=>({flex:"1",rowGap:l?e.space.$2:e.space.$3,margin:0,padding:0}),children:a.features.slice(0,o?l?3:8:t).map(e=>(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableCardFeaturesListItem,elementId:h.$z.pricingTableCardFeaturesListItem.setId(e.slug),as:"li",sx:e=>({display:"flex",alignItems:"baseline",gap:e.space.$2,margin:0,padding:0}),children:[(0,i.Y)(u.In,{icon:$.A,colorScheme:"neutral",size:"sm","aria-hidden":!0,sx:e=>({transform:`translateY(${e.space.$0x25})`})}),(0,i.Y)(u.L9,{elementDescriptor:h.$z.pricingTableCardFeaturesListItemContent,children:(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableCardFeaturesListItemTitle,colorScheme:"body",sx:e=>({fontWeight:e.fontWeights.$normal}),children:e.name})})]},e.id))}),o&&(0,i.FD)(u.dF,{onClick:e=>n(e),variant:"link",sx:e=>({marginBlockStart:"auto",paddingBlock:e.space.$1,gap:e.space.$1}),children:[(0,i.Y)(u.In,{icon:x.A,colorScheme:"neutral",size:"md","aria-hidden":!0}),(0,i.Y)(u.L9,{localizationKey:(0,b.G)("billing.seeAllFeatures")})]})]})});var C=a(6195),w=a(6839),S=a(4620),v=a(6580),M=a(78),P=a(359),k=a(9068),I=a(7591);function E({plans:e=[],planPeriod:r,setPlanPeriod:a,onSelect:l,highlightedPlan:t}){let o=(0,P.j)(),{animations:d}=(0,v.K)().parsedOptions,s=!o&&!0===d,p=n.useId(),g=`${p}-segmented-control`,{buttonPropsForPlan:m}=(0,c.D)(),{t:x}=(0,M._)(),T=e=>({transition:s?`grid-template-rows ${e.transitionDuration.$slower} ${e.transitionTiming.$slowBezier}`:"none"}),y=e=>({background:z.s.mergedColorsBackground(S.T.setAlpha(e.colors.$colorBackground,1),e.colors.$neutralAlpha25)}),D=n.useMemo(()=>`repeat(${e.length+1}, minmax(9.375rem,1fr))`,[e.length]),Y=n.useMemo(()=>e.some(e=>!!e.annualMonthlyFee),[e]),F=n.useMemo(()=>{let r=new Set;return e.forEach(({features:e})=>{e.forEach(({name:e})=>r.add(e))}),Array.from(r)},[e]);return e.length?(0,i.Y)(f.S,{children:(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrix,sx:e=>({position:"relative",minWidth:"100%",display:"grid",isolation:"isolate",backgroundColor:e.colors.$colorBackground,[I.g.md]:{overflowX:"auto"}}),children:(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableMatrixTable,role:"table",children:[(0,i.Y)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRowGroup,h.$z.pricingTableMatrixRowGroupHeader],role:"rowgroup",sx:e=>({position:"sticky",top:0,backgroundColor:e.colors.$colorBackground,borderBottomWidth:e.borderWidths.$normal,borderBottomStyle:e.borderStyles.$solid,borderBottomColor:e.colors.$borderAlpha100,zIndex:1}),children:(0,i.FD)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRow,h.$z.pricingTableMatrixRowHeader],role:"row",sx:{display:"grid",gridTemplateColumns:D},children:[(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixColumnHeader,role:"columnheader",sx:e=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-end",rowGap:e.space.$3,paddingBlockEnd:e.space.$12,paddingInlineStart:e.space.$3}),children:Y?(0,i.FD)(i.FK,{children:[(0,i.Y)(u.EY,{id:g,colorScheme:"secondary",variant:"caption",localizationKey:(0,b.G)("billing.pricingTable.billingCycle"),children:"Billing cycle"}),(0,i.FD)(w.I.Root,{"aria-labelledby":g,value:r,onChange:e=>a(e),children:[(0,i.Y)(w.I.Button,{value:"month",text:(0,b.G)("billing.monthly")}),(0,i.Y)(w.I.Button,{value:"annual",text:(0,b.G)("billing.annually")})]})]}):null}),e.map(e=>{let a=e.slug===t,n=e.annualMonthlyFee&&"annual"===r?e.annualMonthlyFee:e.fee;return(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableMatrixColumnHeader,role:"columnheader",sx:[e=>({display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,borderStartStartRadius:e.radii.$xl,borderStartEndRadius:e.radii.$xl}),a&&y],"data-highlighted":a,children:[(0,i.FD)(u.az,{sx:e=>({width:"100%",padding:e.space.$4}),children:[e.avatarUrl||a?(0,i.FD)(u.L9,{sx:e=>({width:"100%",display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBlockEnd:e.space.$3}),children:[e.avatarUrl?(0,i.Y)(C.e,{elementDescriptor:h.$z.pricingTableMatrixAvatar,size:e=>40,title:e.name,initials:e.name[0],rounded:!1,imageUrl:e.avatarUrl}):null,a?(0,i.Y)(u.Ex,{elementDescriptor:h.$z.pricingTableMatrixBadge,colorScheme:"secondary",localizationKey:(0,b.G)("billing.popular")}):null]}):null,(0,i.Y)(u.DZ,{elementDescriptor:h.$z.pricingTableMatrixPlanName,textVariant:"h3",children:e.name}),(0,i.Y)(u.so,{align:"center",wrap:"wrap",sx:e=>({marginTop:e.space.$2,columnGap:e.space.$1x5}),children:e.hasBaseFee?(0,i.FD)(i.FK,{children:[(0,i.FD)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFee,variant:"h2",colorScheme:"body",children:[n.currencySymbol,n.amountFormatted]}),(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFeePeriod,variant:"caption",colorScheme:"secondary",sx:e=>({textTransform:"lowercase",":before":{content:'"/"',marginInlineEnd:e.space.$1}}),localizationKey:(0,b.G)("billing.month")}),e.annualMonthlyFee?(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixFeePeriodNotice,sx:[e=>({width:"100%",display:"grid",gridTemplateRows:"annual"===r?"1fr":"0fr"}),T],inert:"annual"!==r?"true":void 0,children:(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixFeePeriodNoticeInner,sx:{overflow:"hidden",minHeight:0},children:(0,i.FD)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFeePeriodNoticeLabel,variant:"caption",colorScheme:"secondary",sx:e=>({width:"100%",display:"flex",alignItems:"center",columnGap:e.space.$1}),children:[(0,i.Y)(u.In,{icon:k.A,colorScheme:"neutral",size:"sm","aria-hidden":!0})," ",(0,i.Y)(u.L9,{localizationKey:(0,b.G)("billing.billedAnnually")})]})})}):null]}):(0,i.Y)(u.EY,{elementDescriptor:h.$z.pricingTableMatrixFee,variant:"h2",localizationKey:(0,b.G)("billing.free"),colorScheme:"body"})})]}),e.isDefault?null:(0,i.Y)(u.az,{sx:e=>({width:"100%",marginBlockStart:"auto",marginBlockEnd:e.space.$8,paddingBlockStart:e.space.$2,paddingBlockEnd:e.space.$4,paddingInline:e.space.$4}),children:(0,i.Y)(u.$n,{block:!0,textVariant:"buttonSmall",size:"xs",onClick:r=>{l(e,r)},...m({plan:e,selectedPlanPeriod:r}),colorScheme:a?"primary":"secondary"})})]},e.slug)})]})}),(0,i.FD)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRowGroup,h.$z.pricingTableMatrixRowGroupBody],role:"rowgroup",children:[F.map(r=>(0,i.FD)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixRow,h.$z.pricingTableMatrixRowBody],role:"row",sx:e=>({position:"relative",display:"grid",gridTemplateColumns:D,borderBottomWidth:e.borderWidths.$normal,borderBottomStyle:e.borderStyles.$solid,borderBottomColor:e.colors.$borderAlpha100,":after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",backgroundColor:e.colors.$neutralAlpha25,opacity:0},":hover:after":{opacity:1}}),children:[(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixCell,role:"cell",sx:e=>({padding:e.space.$3}),children:(0,i.Y)(u.EY,{colorScheme:"body",children:r})}),e.map(e=>{let a=e.slug===t,l=e.features.some(e=>e.name===r);return(0,i.Y)(u.az,{elementDescriptor:h.$z.pricingTableMatrixCell,role:"cell",sx:[e=>({display:"grid",placeContent:"center",padding:e.space.$3}),a&&y],"data-highlighted":a,"data-checked":l,children:l&&(0,i.Y)(u.In,{icon:$.A,colorScheme:"neutral",size:"sm","aria-label":x((0,b.G)("billing.pricingTable.included"))})},e.slug)})]},r)),(0,i.FD)(u.az,{elementDescriptor:h.$z.pricingTableMatrixFooter,sx:{display:"grid",gridTemplateColumns:D},children:[(0,i.Y)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixCell,h.$z.pricingTableMatrixCellFooter]}),e.map(e=>{let r=e.slug===t;return(0,i.Y)(u.az,{elementDescriptor:[h.$z.pricingTableMatrixCell,h.$z.pricingTableMatrixCellFooter],sx:[e=>({height:e.space.$10,borderEndStartRadius:e.radii.$xl,borderEndEndRadius:e.radii.$xl}),r&&y],"data-highlighted":r},e.slug)})]})]})]})})}):null}let B=e=>{let r=(0,l.ho)(),{mode:a="mounted",signInMode:d="redirect"}=(0,o.T)(),s="modal"===a,{data:p,subscriptionItems:g}=(0,c.Rs)(),{data:m}=(0,c.A$)(),{handleSelectPlan:u}=(0,c.D)(),h=(0,n.useMemo)(()=>r.isSignedIn?p?m:[]:m,[r.isSignedIn,m,p]),b=(0,n.useMemo)(()=>{if(s){let e=g?.find(e=>"upcoming"===e.status);if(e)return e.planPeriod;let r=g?.find(e=>!e.canceledAt&&"active"===e.status&&!e.plan.isDefault);if(r)return r.planPeriod}return"annual"},[s,g]),[$,x]=(0,n.useState)(b);(0,n.useEffect)(()=>{x(b)},[b]);let f=(i,l)=>{if(!r.isSignedIn)return"modal"===d?r.openSignIn():r.redirectToSignIn();u({mode:a,plan:i,planPeriod:$,event:l,appearance:e.checkoutProps?.appearance,newSubscriptionRedirectUrl:e.newSubscriptionRedirectUrl})};return(0,c.mu)(),(0,i.Y)(t.n.Root,{flow:"pricingTable",isFlowReady:r.isSignedIn?!!p:m.length>0,sx:{width:"100%"},children:"modal"!==a&&"matrix"===e.layout?(0,i.Y)(E,{plans:h,planPeriod:$,setPlanPeriod:x,onSelect:f,highlightedPlan:e.highlightPlan}):(0,i.Y)(y,{plans:h,planPeriod:$,setPlanPeriod:x,onSelect:f,isCompact:s,props:e})})},R=e=>(0,i.Y)("div",{children:(0,i.Y)(B,{...e})}),_=e=>{let{mode:r="mounted"}=(0,o.T)();return"modal"===r?(0,i.Y)(R,{...e}):(0,i.Y)(B,{...e})}},3679:function(e,r,a){a.d(r,{V:()=>c});var i=a(4518),l=a(8272),n=a(2861);let t={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"},c=({subscription:e,elementDescriptor:r})=>(0,i.Y)(l.Ex,{elementDescriptor:r,colorScheme:o[e.status],localizationKey:(0,n.G)(t[e.status])})},164:function(e,r,a){a.d(r,{T:()=>n,a:()=>l});var i=a(5074);let l=(0,i.createContext)(null),n=()=>{let e=(0,i.useContext)(l);if(!e||"PricingTable"!==e.componentName)throw Error("Clerk: usePricingTableContext called outside PricingTable.");let{componentName:r,...a}=e;return{...a,componentName:r}}}}]);
package/dist/ClerkUi.js CHANGED
@@ -2,8 +2,8 @@ import { mountComponentRenderer } from "./Components.js";
2
2
 
3
3
  //#region src/ClerkUi.ts
4
4
  var ClerkUi = class {
5
- static version = "1.0.0-snapshot.v20251216175437";
6
- version = "1.0.0-snapshot.v20251216175437";
5
+ static version = "1.0.0-snapshot.v20251217165918";
6
+ version = "1.0.0-snapshot.v20251217165918";
7
7
  #componentRenderer;
8
8
  constructor(getClerk, getEnvironment, options, moduleManager) {
9
9
  this.#componentRenderer = mountComponentRenderer(getClerk, getEnvironment, options, moduleManager);
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["326"],{4875:function(e,t,i){i.r(t),i.d(t,{APIKeys:()=>N,APIKeysPage:()=>M});var a=i(4518),r=i(3610),n=i(6739),o=i(5543),l=i(5074),s=i(7477),d=i(8188),c=i(3264),p=i(78),u=i(8272),m=i(8920),h=i(2861),y=i(4607),_=i(3453),x=i(3269),f=i(5013),g=i(8819),K=i(4317),D=i(4439),Y=i(7591),v=i(8080),F=i(7198);let b=({rows:e,isLoading:t,onRevoke:i,elementDescriptor:r,canManageAPIKeys:n})=>(0,a.Y)(u.so,{sx:e=>({width:"100%",[Y.g.sm]:{overflowX:"auto",padding:e.space.$0x25}}),children:(0,a.FD)(u.XI,{sx:e=>({background:e.colors.$colorBackground}),elementDescriptor:r,children:[(0,a.Y)(u.d8,{children:(0,a.FD)(u.Tr,{children:[(0,a.Y)(u.Th,{children:"Name"}),(0,a.Y)(u.Th,{children:"Last used"}),n&&(0,a.Y)(u.Th,{children:"Actions"})]})}),(0,a.Y)(u.NN,{children:t?(0,a.Y)(u.Tr,{children:(0,a.Y)(u.Td,{colSpan:3,children:(0,a.Y)(u.y$,{colorScheme:"primary",sx:{margin:"auto",display:"block"},elementDescriptor:m.$z.spinner})})}):e.length?e.map(e=>(0,a.FD)(u.Tr,{children:[(0,a.Y)(u.Td,{children:(0,a.FD)(u.so,{direction:"col",sx:{minWidth:"25ch"},children:[(0,a.Y)(u.EY,{variant:"subtitle",truncate:!0,children:e.name}),(0,a.Y)(u.EY,{variant:"caption",colorScheme:"secondary",localizationKey:e.expiration?(0,h.G)("apiKeys.createdAndExpirationStatus__expiresOn",{createdDate:e.createdAt,expiresDate:e.expiration}):(0,h.G)("apiKeys.createdAndExpirationStatus__never",{createdDate:e.createdAt})})]})}),(0,a.Y)(u.Td,{children:(0,a.Y)(u.az,{sx:{minWidth:"10ch"},children:(0,a.Y)(u.EY,{localizationKey:e.lastUsedAt?(0,F.f)(e.lastUsedAt):"-"})})}),n&&(0,a.Y)(u.Td,{children:(0,a.Y)(v.o,{actions:[{label:(0,h.G)("apiKeys.menuAction__revoke"),isDestructive:!0,onClick:()=>i(e.id,e.name)}]})})]},e.id)):(0,a.Y)(C,{})})]})}),C=()=>(0,a.Y)(u.Tr,{children:(0,a.Y)(u.Td,{colSpan:4,children:(0,a.Y)(u.EY,{localizationKey:(0,h.G)("apiKeys.detailsTitle__emptyRow"),sx:{margin:"auto",display:"block",width:"fit-content"}})})});var $=i(2513),w=i(2454),I=i(1475),z=i(3549),S=i(1586),T=i(8023),k=i(8640);let E=["never","1d","7d","30d","60d","90d","180d","1y"],A={"1d":e=>e.setDate(e.getDate()+1),"7d":e=>e.setDate(e.getDate()+7),"30d":e=>e.setDate(e.getDate()+30),"60d":e=>e.setDate(e.getDate()+60),"90d":e=>e.setDate(e.getDate()+90),"180d":e=>e.setDate(e.getDate()+180),"1y":e=>e.setFullYear(e.getFullYear()+1)},G=e=>{if("never"===e||!e)return;let t=new Date,i=new Date(t);return A[e](i),Math.floor((i.getTime()-t.getTime())/1e3)},P=({selectedExpiration:e,setSelectedExpiration:t})=>{let i=(0,l.useRef)(null),{t:r}=(0,p._)(),n=E.map(e=>({value:e,label:r((0,h.G)((e=>{switch(e){case"never":return"apiKeys.formFieldOption__expiration__never";case"1d":return"apiKeys.formFieldOption__expiration__1d";case"7d":return"apiKeys.formFieldOption__expiration__7d";case"30d":return"apiKeys.formFieldOption__expiration__30d";case"60d":return"apiKeys.formFieldOption__expiration__60d";case"90d":return"apiKeys.formFieldOption__expiration__90d";case"180d":return"apiKeys.formFieldOption__expiration__180d";case"1y":return"apiKeys.formFieldOption__expiration__1y"}})(e)))}));return(0,a.FD)(S.l6,{elementId:"apiKeyExpiration",options:n,value:e?.value??"",onChange:t,placeholder:r((0,h.G)("formFieldInputPlaceholder__apiKeyExpirationDate")),referenceElement:i,children:[(0,a.Y)(S.JC,{ref:i,icon:T.A,sx:e=>({justifyContent:"space-between",backgroundColor:e.colors.$colorBackground}),"aria-labelledby":"expiration-field",id:"expiration-field"}),(0,a.Y)(S.UL,{sx:e=>({paddingBlock:e.space.$1,color:e.colors.$colorForeground})})]})},R=({onCreate:e})=>{let[t,i]=(0,l.useState)(null),{close:r}=(0,$.D5)(),{showDescription:n=!1}=(0,d.l)(),o=(0,x.f0)(),{t:s}=(0,p._)(),c=(0,k.tJ)("name","",{type:"text",label:(0,h.G)("formFieldLabel__apiKeyName"),placeholder:(0,h.G)("formFieldInputPlaceholder__apiKeyName"),isRequired:!0}),y=(0,k.tJ)("apiKeyDescription","",{type:"text",label:(0,h.G)("formFieldLabel__apiKeyDescription"),placeholder:(0,h.G)("formFieldInputPlaceholder__apiKeyDescription"),isRequired:!1}),_=c.value.length>2,f=(0,l.useMemo)(()=>{let e=G(t?.value);if(!t?.value||!e)return s((0,h.G)("apiKeys.formFieldCaption__expiration__never"));let i=new Date(Date.now()+1e3*e);return s((0,h.G)("apiKeys.formFieldCaption__expiration__expiresOn",{date:i.toLocaleString(void 0,{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"})}))},[t?.value]);return(0,a.Y)(z.M,{headerTitle:(0,h.G)("apiKeys.formTitle"),headerSubtitle:(0,h.G)("apiKeys.formHint"),elementDescriptor:m.$z.apiKeysCreateForm,children:(0,a.FD)(w.l.Root,{onSubmit:i=>{i.preventDefault(),e({name:c.value,description:y.value||void 0,secondsUntilExpiration:G(t?.value)})},children:[(0,a.FD)(u.az,{sx:e=>({gap:e.space.$4,display:"flex",flexDirection:"row",[Y.g.sm]:{flexDirection:"column"}}),children:[(0,a.Y)(w.l.ControlRow,{sx:{flex:1},elementId:c.id,elementDescriptor:m.$z.apiKeysCreateFormNameInput,children:(0,a.Y)(w.l.PlainInput,{...c.props})}),(0,a.FD)(u.fv,{sx:{flex:1,width:"100%"},gap:2,elementDescriptor:m.$z.apiKeysCreateFormExpirationInput,children:[(0,a.FD)(u.lR,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexDirection:"row"},htmlFor:"expiration-field",children:[(0,a.Y)(u.EY,{as:"span",variant:"subtitle",localizationKey:(0,h.G)("formFieldLabel__apiKeyExpiration")}),(0,a.Y)(u.EY,{variant:"caption",colorScheme:"secondary",localizationKey:(0,h.G)("formFieldHintText__optional")})]}),(0,a.Y)(P,{selectedExpiration:t,setSelectedExpiration:i}),(0,a.Y)(u.EY,{variant:"caption",colorScheme:"secondary",localizationKey:f,elementDescriptor:m.$z.apiKeysCreateFormExpirationCaption})]})]}),n&&(0,a.Y)(u.fv,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,paddingTop:e.space.$4,paddingBottom:e.space.$4}),children:(0,a.Y)(w.l.ControlRow,{elementId:y.id,elementDescriptor:m.$z.apiKeysCreateFormDescriptionInput,children:(0,a.Y)(w.l.PlainInput,{...y.props})})}),(0,a.Y)(I.G,{submitLabel:(0,h.G)("apiKeys.formButtonPrimary__add"),isDisabled:!_,onReset:r,isLoading:o.isLoading,elementDescriptor:m.$z.apiKeysCreateFormSubmitButton})]})})},O=(0,l.lazy)(()=>i.e("505").then(i.bind(i,8195)).then(e=>({default:e.RevokeAPIKeyConfirmationModal}))),L=(0,l.lazy)(()=>Promise.all([i.e("545"),i.e("666"),i.e("394")]).then(i.bind(i,8169)).then(e=>({default:e.CopyAPIKeyModal}))),M=({subject:e,perPage:t,revokeModalRoot:i})=>{let d=(0,n.n)(e),c=(0,s.Fd)({permission:"org:sys_api_keys:read"}),y=(0,s.Fd)({permission:"org:sys_api_keys:manage"}),[v,F]=(0,l.useState)(""),C=(0,K.d)(v,500).trim(),{data:$,isLoading:w,isFetching:I,page:z,fetchPage:S,pageCount:T,count:k,revalidate:E}=(0,o.hZ)({subject:e,pageSize:t??10,query:C,keepPreviousData:!0,enabled:!d||c});(({query:e,page:t,pageCount:i,isFetching:a,fetchPage:r})=>{let n=(0,l.useRef)(e);(0,l.useEffect)(()=>{n.current!==e&&(n.current=e,r(1))},[e,r]),(0,l.useEffect)(()=>{!a&&i>0&&t>i&&r(Math.max(1,i))},[i,t,a,r])})({query:C,page:z,pageCount:T,isFetching:I,fetchPage:S});let A=k>0?Math.max(0,(z-1)*(t??10))+1:0,G=Math.min(z*(t??10),k),P=(0,x.f0)(),M=(0,o.ho)(),[N,B]=(0,l.useState)(null),{t:W}=(0,p._)(),[j,J]=(0,l.useState)(!1),[U,H]=(0,l.useState)(""),[q,X]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),V=async t=>{try{P.setLoading();let i=await M.apiKeys.create({...t,subject:e});E(),P.setError(void 0),Q(!0),B(i)}catch(e){(0,r.$R)(e)&&409===e.status&&P.setError("API Key name already exists")}finally{P.setIdle()}};return(0,a.FD)(u.fv,{gap:4,sx:{width:"100%"},elementDescriptor:m.$z.apiKeys,children:[(0,a.FD)(_.r.Root,{children:[(0,a.FD)(u.so,{justify:"between",align:"center",gap:4,sx:{[Y.g.sm]:{flexDirection:"column",alignItems:"stretch"}},elementDescriptor:m.$z.apiKeysHeader,children:[(0,a.Y)(u.az,{elementDescriptor:m.$z.apiKeysSearchBox,children:(0,a.Y)(f.e,{placeholder:W((0,h.G)("apiKeys.action__search")),leftIcon:(0,a.Y)(u.In,{icon:D.A,sx:e=>({color:e.colors.$colorMutedForeground})}),value:v,type:"search",autoCapitalize:"none",spellCheck:!1,onChange:e=>F(e.target.value),elementDescriptor:m.$z.apiKeysSearchInput})}),(d&&y||!d)&&(0,a.Y)(_.r.Trigger,{value:"add-api-key",hideOnActive:!1,children:(0,a.Y)(u.$n,{variant:"solid",localizationKey:(0,h.G)("apiKeys.action__add"),elementDescriptor:m.$z.apiKeysAddButton})})]}),(0,a.Y)(_.r.Open,{value:"add-api-key",children:(0,a.Y)(u.so,{sx:e=>({paddingTop:e.space.$6,paddingBottom:e.space.$6}),children:(0,a.Y)(_.r.Card,{sx:{width:"100%"},children:(0,a.Y)(R,{onCreate:V})})})}),(0,a.Y)(L,{isOpen:Z,onOpen:()=>Q(!0),onClose:()=>Q(!1),apiKeyName:N?.name||"",apiKeySecret:N?.secret||"",modalRoot:i})]}),(0,a.Y)(b,{rows:$,isLoading:w,onRevoke:(e,t)=>{H(e),X(t),J(!0)},elementDescriptor:m.$z.apiKeysTable,canManageAPIKeys:d&&y||!d}),T>1&&(0,a.Y)(g.d,{count:T,page:Math.min(z,T),onChange:e=>{S(e)},siblingCount:1,rowInfo:{allRowsCount:k,startingRow:A,endingRow:G}}),(0,a.Y)(O,{isOpen:j,onOpen:()=>J(!0),onClose:()=>{H(""),X(""),J(!1)},apiKeyID:U,apiKeyName:q,onRevokeSuccess:E,modalRoot:i})]})},N=(0,c.G)((0,x.dm)(()=>{let e=(0,d.l)(),{user:t}=(0,o.Jd)(),i=(0,o.Wf)(),r=i?.organization?.id??t?.id??"";return(0,a.Y)(y.n.Root,{flow:"apiKeys",sx:{width:"100%"},children:(0,a.Y)(M,{subject:r,perPage:e.perPage})})}))},8188:function(e,t,i){i.d(t,{l:()=>n,w:()=>r});var a=i(5074);let r=(0,a.createContext)(null),n=()=>{let e=(0,a.useContext)(r);if(!e||"APIKeys"!==e.componentName)throw Error("Clerk: useAPIKeysContext called outside APIKeys.");let{componentName:t,...i}=e;return{...i,componentName:t}}}}]);
1
+ "use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["326"],{4875:function(e,t,i){i.r(t),i.d(t,{APIKeys:()=>N,APIKeysPage:()=>M});var a=i(4518),r=i(3610),n=i(6739),o=i(1210),l=i(5074),s=i(7477),d=i(8188),c=i(3264),p=i(78),u=i(8272),m=i(8920),h=i(2861),y=i(4607),_=i(3453),x=i(3269),f=i(5013),g=i(8819),K=i(4317),D=i(4439),Y=i(7591),v=i(8080),F=i(7198);let b=({rows:e,isLoading:t,onRevoke:i,elementDescriptor:r,canManageAPIKeys:n})=>(0,a.Y)(u.so,{sx:e=>({width:"100%",[Y.g.sm]:{overflowX:"auto",padding:e.space.$0x25}}),children:(0,a.FD)(u.XI,{sx:e=>({background:e.colors.$colorBackground}),elementDescriptor:r,children:[(0,a.Y)(u.d8,{children:(0,a.FD)(u.Tr,{children:[(0,a.Y)(u.Th,{children:"Name"}),(0,a.Y)(u.Th,{children:"Last used"}),n&&(0,a.Y)(u.Th,{children:"Actions"})]})}),(0,a.Y)(u.NN,{children:t?(0,a.Y)(u.Tr,{children:(0,a.Y)(u.Td,{colSpan:3,children:(0,a.Y)(u.y$,{colorScheme:"primary",sx:{margin:"auto",display:"block"},elementDescriptor:m.$z.spinner})})}):e.length?e.map(e=>(0,a.FD)(u.Tr,{children:[(0,a.Y)(u.Td,{children:(0,a.FD)(u.so,{direction:"col",sx:{minWidth:"25ch"},children:[(0,a.Y)(u.EY,{variant:"subtitle",truncate:!0,children:e.name}),(0,a.Y)(u.EY,{variant:"caption",colorScheme:"secondary",localizationKey:e.expiration?(0,h.G)("apiKeys.createdAndExpirationStatus__expiresOn",{createdDate:e.createdAt,expiresDate:e.expiration}):(0,h.G)("apiKeys.createdAndExpirationStatus__never",{createdDate:e.createdAt})})]})}),(0,a.Y)(u.Td,{children:(0,a.Y)(u.az,{sx:{minWidth:"10ch"},children:(0,a.Y)(u.EY,{localizationKey:e.lastUsedAt?(0,F.f)(e.lastUsedAt):"-"})})}),n&&(0,a.Y)(u.Td,{children:(0,a.Y)(v.o,{actions:[{label:(0,h.G)("apiKeys.menuAction__revoke"),isDestructive:!0,onClick:()=>i(e.id,e.name)}]})})]},e.id)):(0,a.Y)(C,{})})]})}),C=()=>(0,a.Y)(u.Tr,{children:(0,a.Y)(u.Td,{colSpan:4,children:(0,a.Y)(u.EY,{localizationKey:(0,h.G)("apiKeys.detailsTitle__emptyRow"),sx:{margin:"auto",display:"block",width:"fit-content"}})})});var $=i(2513),w=i(2454),I=i(1475),z=i(3549),S=i(1586),T=i(8023),k=i(8640);let E=["never","1d","7d","30d","60d","90d","180d","1y"],A={"1d":e=>e.setDate(e.getDate()+1),"7d":e=>e.setDate(e.getDate()+7),"30d":e=>e.setDate(e.getDate()+30),"60d":e=>e.setDate(e.getDate()+60),"90d":e=>e.setDate(e.getDate()+90),"180d":e=>e.setDate(e.getDate()+180),"1y":e=>e.setFullYear(e.getFullYear()+1)},G=e=>{if("never"===e||!e)return;let t=new Date,i=new Date(t);return A[e](i),Math.floor((i.getTime()-t.getTime())/1e3)},P=({selectedExpiration:e,setSelectedExpiration:t})=>{let i=(0,l.useRef)(null),{t:r}=(0,p._)(),n=E.map(e=>({value:e,label:r((0,h.G)((e=>{switch(e){case"never":return"apiKeys.formFieldOption__expiration__never";case"1d":return"apiKeys.formFieldOption__expiration__1d";case"7d":return"apiKeys.formFieldOption__expiration__7d";case"30d":return"apiKeys.formFieldOption__expiration__30d";case"60d":return"apiKeys.formFieldOption__expiration__60d";case"90d":return"apiKeys.formFieldOption__expiration__90d";case"180d":return"apiKeys.formFieldOption__expiration__180d";case"1y":return"apiKeys.formFieldOption__expiration__1y"}})(e)))}));return(0,a.FD)(S.l6,{elementId:"apiKeyExpiration",options:n,value:e?.value??"",onChange:t,placeholder:r((0,h.G)("formFieldInputPlaceholder__apiKeyExpirationDate")),referenceElement:i,children:[(0,a.Y)(S.JC,{ref:i,icon:T.A,sx:e=>({justifyContent:"space-between",backgroundColor:e.colors.$colorBackground}),"aria-labelledby":"expiration-field",id:"expiration-field"}),(0,a.Y)(S.UL,{sx:e=>({paddingBlock:e.space.$1,color:e.colors.$colorForeground})})]})},R=({onCreate:e})=>{let[t,i]=(0,l.useState)(null),{close:r}=(0,$.D5)(),{showDescription:n=!1}=(0,d.l)(),o=(0,x.f0)(),{t:s}=(0,p._)(),c=(0,k.tJ)("name","",{type:"text",label:(0,h.G)("formFieldLabel__apiKeyName"),placeholder:(0,h.G)("formFieldInputPlaceholder__apiKeyName"),isRequired:!0}),y=(0,k.tJ)("apiKeyDescription","",{type:"text",label:(0,h.G)("formFieldLabel__apiKeyDescription"),placeholder:(0,h.G)("formFieldInputPlaceholder__apiKeyDescription"),isRequired:!1}),_=c.value.length>2,f=(0,l.useMemo)(()=>{let e=G(t?.value);if(!t?.value||!e)return s((0,h.G)("apiKeys.formFieldCaption__expiration__never"));let i=new Date(Date.now()+1e3*e);return s((0,h.G)("apiKeys.formFieldCaption__expiration__expiresOn",{date:i.toLocaleString(void 0,{year:"numeric",month:"long",day:"2-digit",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"})}))},[t?.value]);return(0,a.Y)(z.M,{headerTitle:(0,h.G)("apiKeys.formTitle"),headerSubtitle:(0,h.G)("apiKeys.formHint"),elementDescriptor:m.$z.apiKeysCreateForm,children:(0,a.FD)(w.l.Root,{onSubmit:i=>{i.preventDefault(),e({name:c.value,description:y.value||void 0,secondsUntilExpiration:G(t?.value)})},children:[(0,a.FD)(u.az,{sx:e=>({gap:e.space.$4,display:"flex",flexDirection:"row",[Y.g.sm]:{flexDirection:"column"}}),children:[(0,a.Y)(w.l.ControlRow,{sx:{flex:1},elementId:c.id,elementDescriptor:m.$z.apiKeysCreateFormNameInput,children:(0,a.Y)(w.l.PlainInput,{...c.props})}),(0,a.FD)(u.fv,{sx:{flex:1,width:"100%"},gap:2,elementDescriptor:m.$z.apiKeysCreateFormExpirationInput,children:[(0,a.FD)(u.lR,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",flexDirection:"row"},htmlFor:"expiration-field",children:[(0,a.Y)(u.EY,{as:"span",variant:"subtitle",localizationKey:(0,h.G)("formFieldLabel__apiKeyExpiration")}),(0,a.Y)(u.EY,{variant:"caption",colorScheme:"secondary",localizationKey:(0,h.G)("formFieldHintText__optional")})]}),(0,a.Y)(P,{selectedExpiration:t,setSelectedExpiration:i}),(0,a.Y)(u.EY,{variant:"caption",colorScheme:"secondary",localizationKey:f,elementDescriptor:m.$z.apiKeysCreateFormExpirationCaption})]})]}),n&&(0,a.Y)(u.fv,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,paddingTop:e.space.$4,paddingBottom:e.space.$4}),children:(0,a.Y)(w.l.ControlRow,{elementId:y.id,elementDescriptor:m.$z.apiKeysCreateFormDescriptionInput,children:(0,a.Y)(w.l.PlainInput,{...y.props})})}),(0,a.Y)(I.G,{submitLabel:(0,h.G)("apiKeys.formButtonPrimary__add"),isDisabled:!_,onReset:r,isLoading:o.isLoading,elementDescriptor:m.$z.apiKeysCreateFormSubmitButton})]})})},O=(0,l.lazy)(()=>i.e("505").then(i.bind(i,8195)).then(e=>({default:e.RevokeAPIKeyConfirmationModal}))),L=(0,l.lazy)(()=>Promise.all([i.e("545"),i.e("666"),i.e("394")]).then(i.bind(i,8169)).then(e=>({default:e.CopyAPIKeyModal}))),M=({subject:e,perPage:t,revokeModalRoot:i})=>{let d=(0,n.n)(e),c=(0,s.Fd)({permission:"org:sys_api_keys:read"}),y=(0,s.Fd)({permission:"org:sys_api_keys:manage"}),[v,F]=(0,l.useState)(""),C=(0,K.d)(v,500).trim(),{data:$,isLoading:w,isFetching:I,page:z,fetchPage:S,pageCount:T,count:k,revalidate:E}=(0,o.hZ)({subject:e,pageSize:t??10,query:C,keepPreviousData:!0,enabled:!d||c});(({query:e,page:t,pageCount:i,isFetching:a,fetchPage:r})=>{let n=(0,l.useRef)(e);(0,l.useEffect)(()=>{n.current!==e&&(n.current=e,r(1))},[e,r]),(0,l.useEffect)(()=>{!a&&i>0&&t>i&&r(Math.max(1,i))},[i,t,a,r])})({query:C,page:z,pageCount:T,isFetching:I,fetchPage:S});let A=k>0?Math.max(0,(z-1)*(t??10))+1:0,G=Math.min(z*(t??10),k),P=(0,x.f0)(),M=(0,o.ho)(),[N,B]=(0,l.useState)(null),{t:W}=(0,p._)(),[j,J]=(0,l.useState)(!1),[U,H]=(0,l.useState)(""),[q,X]=(0,l.useState)(""),[Z,Q]=(0,l.useState)(!1),V=async t=>{try{P.setLoading();let i=await M.apiKeys.create({...t,subject:e});E(),P.setError(void 0),Q(!0),B(i)}catch(e){(0,r.$R)(e)&&409===e.status&&P.setError("API Key name already exists")}finally{P.setIdle()}};return(0,a.FD)(u.fv,{gap:4,sx:{width:"100%"},elementDescriptor:m.$z.apiKeys,children:[(0,a.FD)(_.r.Root,{children:[(0,a.FD)(u.so,{justify:"between",align:"center",gap:4,sx:{[Y.g.sm]:{flexDirection:"column",alignItems:"stretch"}},elementDescriptor:m.$z.apiKeysHeader,children:[(0,a.Y)(u.az,{elementDescriptor:m.$z.apiKeysSearchBox,children:(0,a.Y)(f.e,{placeholder:W((0,h.G)("apiKeys.action__search")),leftIcon:(0,a.Y)(u.In,{icon:D.A,sx:e=>({color:e.colors.$colorMutedForeground})}),value:v,type:"search",autoCapitalize:"none",spellCheck:!1,onChange:e=>F(e.target.value),elementDescriptor:m.$z.apiKeysSearchInput})}),(d&&y||!d)&&(0,a.Y)(_.r.Trigger,{value:"add-api-key",hideOnActive:!1,children:(0,a.Y)(u.$n,{variant:"solid",localizationKey:(0,h.G)("apiKeys.action__add"),elementDescriptor:m.$z.apiKeysAddButton})})]}),(0,a.Y)(_.r.Open,{value:"add-api-key",children:(0,a.Y)(u.so,{sx:e=>({paddingTop:e.space.$6,paddingBottom:e.space.$6}),children:(0,a.Y)(_.r.Card,{sx:{width:"100%"},children:(0,a.Y)(R,{onCreate:V})})})}),(0,a.Y)(L,{isOpen:Z,onOpen:()=>Q(!0),onClose:()=>Q(!1),apiKeyName:N?.name||"",apiKeySecret:N?.secret||"",modalRoot:i})]}),(0,a.Y)(b,{rows:$,isLoading:w,onRevoke:(e,t)=>{H(e),X(t),J(!0)},elementDescriptor:m.$z.apiKeysTable,canManageAPIKeys:d&&y||!d}),T>1&&(0,a.Y)(g.d,{count:T,page:Math.min(z,T),onChange:e=>{S(e)},siblingCount:1,rowInfo:{allRowsCount:k,startingRow:A,endingRow:G}}),(0,a.Y)(O,{isOpen:j,onOpen:()=>J(!0),onClose:()=>{H(""),X(""),J(!1)},apiKeyID:U,apiKeyName:q,onRevokeSuccess:E,modalRoot:i})]})},N=(0,c.G)((0,x.dm)(()=>{let e=(0,d.l)(),{user:t}=(0,o.Jd)(),i=(0,o.Wf)(),r=i?.organization?.id??t?.id??"";return(0,a.Y)(y.n.Root,{flow:"apiKeys",sx:{width:"100%"},children:(0,a.Y)(M,{subject:r,perPage:e.perPage})})}))},8188:function(e,t,i){i.d(t,{l:()=>n,w:()=>r});var a=i(5074);let r=(0,a.createContext)(null),n=()=>{let e=(0,a.useContext)(r);if(!e||"APIKeys"!==e.componentName)throw Error("Clerk: useAPIKeysContext called outside APIKeys.");let{componentName:t,...i}=e;return{...i,componentName:t}}}}]);