Browse Source
Bugfix/fix upgrade vs. renew subscription button labels (#4549)
* Fix upgrade vs. renew subscription button labels
pull/4553/head
Thomas Kaul
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
18 additions and
24 deletions
-
apps/api/src/app/subscription/subscription.service.ts
-
apps/client/src/app/components/header/header.component.html
-
apps/client/src/app/components/user-account-membership/user-account-membership.html
-
apps/client/src/app/pages/pricing/pricing-page.html
-
libs/common/src/lib/interfaces/subscription-offer.interface.ts
|
@ -183,8 +183,8 @@ export class SubscriptionService { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
expiresAt, |
|
|
|
|
|
offer, |
|
|
offer, |
|
|
|
|
|
expiresAt: isBefore(new Date(), expiresAt) ? expiresAt : undefined, |
|
|
type: isBefore(new Date(), expiresAt) |
|
|
type: isBefore(new Date(), expiresAt) |
|
|
? SubscriptionType.Premium |
|
|
? SubscriptionType.Premium |
|
|
: SubscriptionType.Basic |
|
|
: SubscriptionType.Basic |
|
@ -210,10 +210,15 @@ export class SubscriptionService { |
|
|
return undefined; |
|
|
return undefined; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const offers = |
|
|
const offers: { |
|
|
|
|
|
[offer in SubscriptionOfferKey]: SubscriptionOffer; |
|
|
|
|
|
} = |
|
|
((await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG)) as any) ?? |
|
|
((await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG)) as any) ?? |
|
|
{}; |
|
|
{}; |
|
|
|
|
|
|
|
|
return offers[key]; |
|
|
return { |
|
|
|
|
|
...offers[key], |
|
|
|
|
|
isRenewal: key.startsWith('renewal') |
|
|
|
|
|
}; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
@ -181,14 +181,10 @@ |
|
|
<a class="d-flex" mat-menu-item [routerLink]="routerLinkPricing" |
|
|
<a class="d-flex" mat-menu-item [routerLink]="routerLinkPricing" |
|
|
><span class="align-items-center d-flex" |
|
|
><span class="align-items-center d-flex" |
|
|
><span> |
|
|
><span> |
|
|
@if (user.subscription.offer === 'default') { |
|
|
@if (user.subscription.offer.isRenewal) { |
|
|
<ng-container i18n>Upgrade Plan</ng-container> |
|
|
|
|
|
} @else if ( |
|
|
|
|
|
user.subscription.offer === 'renewal' || |
|
|
|
|
|
user.subscription.offer === 'renewal-early-bird-2023' || |
|
|
|
|
|
user.subscription.offer === 'renewal-early-bird-2024' |
|
|
|
|
|
) { |
|
|
|
|
|
<ng-container i18n>Renew Plan</ng-container> |
|
|
<ng-container i18n>Renew Plan</ng-container> |
|
|
|
|
|
} @else { |
|
|
|
|
|
<ng-container i18n>Upgrade Plan</ng-container> |
|
|
} |
|
|
} |
|
|
</span> |
|
|
</span> |
|
|
<gf-premium-indicator |
|
|
<gf-premium-indicator |
|
|
|
@ -14,14 +14,10 @@ |
|
|
hasPermissionForSubscription && hasPermissionToUpdateUserSettings |
|
|
hasPermissionForSubscription && hasPermissionToUpdateUserSettings |
|
|
) { |
|
|
) { |
|
|
<button color="primary" mat-flat-button (click)="onCheckout()"> |
|
|
<button color="primary" mat-flat-button (click)="onCheckout()"> |
|
|
@if (user.subscription.offer === 'default') { |
|
|
@if (user.subscription.offer.isRenewal) { |
|
|
<ng-container i18n>Upgrade Plan</ng-container> |
|
|
|
|
|
} @else if ( |
|
|
|
|
|
user.subscription.offer === 'renewal' || |
|
|
|
|
|
user.subscription.offer === 'renewal-early-bird-2023' || |
|
|
|
|
|
user.subscription.offer === 'renewal-early-bird-2024' |
|
|
|
|
|
) { |
|
|
|
|
|
<ng-container i18n>Renew Plan</ng-container> |
|
|
<ng-container i18n>Renew Plan</ng-container> |
|
|
|
|
|
} @else { |
|
|
|
|
|
<ng-container i18n>Upgrade Plan</ng-container> |
|
|
} |
|
|
} |
|
|
</button> |
|
|
</button> |
|
|
@if (price) { |
|
|
@if (price) { |
|
|
|
@ -306,14 +306,10 @@ |
|
|
mat-flat-button |
|
|
mat-flat-button |
|
|
(click)="onCheckout()" |
|
|
(click)="onCheckout()" |
|
|
> |
|
|
> |
|
|
@if (user.subscription.offer === 'default') { |
|
|
@if (user.subscription.offer.isRenewal) { |
|
|
<ng-container i18n>Upgrade Plan</ng-container> |
|
|
|
|
|
} @else if ( |
|
|
|
|
|
user.subscription.offer === 'renewal' || |
|
|
|
|
|
user.subscription.offer === 'renewal-early-bird-2023' || |
|
|
|
|
|
user.subscription.offer === 'renewal-early-bird-2024' |
|
|
|
|
|
) { |
|
|
|
|
|
<ng-container i18n>Renew Plan</ng-container> |
|
|
<ng-container i18n>Renew Plan</ng-container> |
|
|
|
|
|
} @else { |
|
|
|
|
|
<ng-container i18n>Upgrade Plan</ng-container> |
|
|
} |
|
|
} |
|
|
</button> |
|
|
</button> |
|
|
<p class="m-0 text-muted"> |
|
|
<p class="m-0 text-muted"> |
|
|
|
@ -4,6 +4,7 @@ export interface SubscriptionOffer { |
|
|
coupon?: number; |
|
|
coupon?: number; |
|
|
couponId?: string; |
|
|
couponId?: string; |
|
|
durationExtension?: StringValue; |
|
|
durationExtension?: StringValue; |
|
|
|
|
|
isRenewal?: boolean; |
|
|
label?: string; |
|
|
label?: string; |
|
|
price: number; |
|
|
price: number; |
|
|
priceId: string; |
|
|
priceId: string; |
|
|