File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
apps/sim/app/workspace/[workspaceId]/settings/components/subscription Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -941,6 +941,47 @@ export function Subscription() {
941941 < BillingUsageNotificationsToggle />
942942 ) }
943943
944+ { subscription . isPaid &&
945+ ! permissions . showTeamMemberView &&
946+ ! permissions . isEnterpriseMember && (
947+ < div className = 'flex items-center justify-between' >
948+ < Label > Invoices</ Label >
949+ < Button
950+ variant = 'outline'
951+ size = 'sm'
952+ disabled = { openBillingPortal . isPending }
953+ onClick = { ( ) => {
954+ const portalWindow = window . open ( '' , '_blank' )
955+ const context =
956+ subscription . isTeam || subscription . isEnterprise ? 'organization' : 'user'
957+ openBillingPortal . mutate (
958+ {
959+ context,
960+ organizationId : activeOrgId ,
961+ returnUrl : window . location . href ,
962+ } ,
963+ {
964+ onSuccess : ( data ) => {
965+ if ( portalWindow ) {
966+ portalWindow . location . href = data . url
967+ } else {
968+ window . location . href = data . url
969+ }
970+ } ,
971+ onError : ( error ) => {
972+ portalWindow ?. close ( )
973+ logger . error ( 'Failed to open billing portal' , { error } )
974+ alert ( error . message )
975+ } ,
976+ }
977+ )
978+ } }
979+ >
980+ View Invoices
981+ </ Button >
982+ </ div >
983+ ) }
984+
944985 { ! isLoading && isTeamAdmin && (
945986 < div className = 'flex items-center justify-between' >
946987 < div className = 'flex items-center gap-[6px]' >
You can’t perform that action at this time.
0 commit comments