File tree Expand file tree Collapse file tree
responses/src/Domain/Temp
Components/Preferences/Panes/Account Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ export type Subscription = {
44 createdAt : number
55 updatedAt : number
66 cancelled : boolean
7+ subscriptionType ?: 'regular' | 'shared'
78}
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ type Props = {
1818
1919const AccountPreferences = ( { application } : Props ) => {
2020 const isUsingThirdPartyServer = ! application . sessions . isSignedIntoFirstPartyServer ( )
21+ const isSharedSubscription = application . subscriptionController . isSharedSubscription
2122
2223 return (
2324 < PreferencesPane >
@@ -30,7 +31,7 @@ const AccountPreferences = ({ application }: Props) => {
3031 </ >
3132 ) }
3233 < Subscription />
33- < SubscriptionSharing application = { application } />
34+ { ! isSharedSubscription && < SubscriptionSharing application = { application } /> }
3435 { application . hasAccount ( ) && application . featuresController . entitledToFiles && (
3536 < FilesSection application = { application } />
3637 ) }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { useApplication } from '@/Components/ApplicationProvider'
55
66const SubscriptionInformation = ( ) => {
77 const application = useApplication ( )
8+ const isSharedSubscription = application . subscriptionController . isSharedSubscription
89
910 const manageSubscription = async ( ) => {
1011 void application . openSubscriptionDashboard . execute ( )
@@ -13,7 +14,9 @@ const SubscriptionInformation = () => {
1314 return (
1415 < >
1516 < SubscriptionStatusText />
16- < Button className = "mr-3 mt-3 min-w-20" label = "Manage subscription" onClick = { manageSubscription } />
17+ { ! isSharedSubscription && (
18+ < Button className = "mr-3 mt-3 min-w-20" label = "Manage subscription" onClick = { manageSubscription } />
19+ ) }
1720 </ >
1821 )
1922}
Original file line number Diff line number Diff line change @@ -11,8 +11,16 @@ const SubscriptionStatusText = () => {
1111 isUserSubscriptionExpired,
1212 isUserSubscriptionCanceled,
1313 } = application . subscriptions
14+ const isSharedSubscription = application . subscriptionController . isSharedSubscription
1415
1516 const expirationDateString = userSubscriptionExpirationDate ?. toLocaleString ( )
17+ const sharedMessage = isSharedSubscription ? (
18+ < >
19+ < br />
20+ < br />
21+ This subscription has been shared with you and can only be managed by the owner.
22+ </ >
23+ ) : null
1624
1725 if ( isUserSubscriptionCanceled ) {
1826 return (
@@ -29,6 +37,7 @@ const SubscriptionStatusText = () => {
2937 < span className = "font-bold" > but will remain valid until { expirationDateString } </ span >
3038 ) }
3139 . You may resubscribe below if you wish.
40+ { sharedMessage }
3241 </ Text >
3342 )
3443 }
@@ -43,6 +52,7 @@ const SubscriptionStatusText = () => {
4352 </ span > { ' ' }
4453 subscription < span className = "font-bold" > expired on { expirationDateString } </ span > . You may resubscribe below if
4554 you wish.
55+ { sharedMessage }
4656 </ Text >
4757 )
4858 }
@@ -54,7 +64,7 @@ const SubscriptionStatusText = () => {
5464 Standard Notes{ userSubscriptionName ? ' ' : '' }
5565 { userSubscriptionName }
5666 </ span > { ' ' }
57- subscription will be < span className = "font-bold" > renewed on { expirationDateString } </ span > .
67+ subscription will be < span className = "font-bold" > renewed on { expirationDateString } </ span > .{ sharedMessage }
5868 </ Text >
5969 )
6070}
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export class SubscriptionController extends AbstractViewController implements In
3636 hasAccount : observable ,
3737 onlineSubscription : observable ,
3838
39+ isSharedSubscription : computed ,
3940 usedInvitationsCount : computed ,
4041 allowedInvitationsCount : computed ,
4142 allInvitationsUsed : computed ,
@@ -96,6 +97,10 @@ export class SubscriptionController extends AbstractViewController implements In
9697 return ! ! this . subscriptions . getOnlineSubscription ( ) || offline
9798 }
9899
100+ get isSharedSubscription ( ) : boolean {
101+ return this . onlineSubscription ?. subscriptionType === 'shared'
102+ }
103+
99104 get usedInvitationsCount ( ) : number {
100105 return (
101106 this . subscriptionInvitations ?. filter ( ( invitation ) =>
You can’t perform that action at this time.
0 commit comments