Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/fix upgrade vs. renew subscription button labels (#4549)
Thomas Kaul07ad7f281774
diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.tsindex dc3e5cf59c..f95334684e 100644--- a/apps/api/src/app/subscription/subscription.service.ts+++ b/apps/api/src/app/subscription/subscription.service.ts@@ -183,8 +183,8 @@ export class SubscriptionService {});return {- expiresAt,offer,+ expiresAt: isBefore(new Date(), expiresAt) ? expiresAt : undefined,type: isBefore(new Date(), expiresAt)? SubscriptionType.Premium: SubscriptionType.Basic@@ -210,10 +210,15 @@ export class SubscriptionService {return undefined;}- const offers =+ const offers: {+ [offer in SubscriptionOfferKey]: SubscriptionOffer;+ } =((await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG)) as any) ??{};- return offers[key];+ return {+ ...offers[key],+ isRenewal: key.startsWith('renewal')+ };}}diff --git a/apps/client/src/app/components/header/header.component.html b/apps/client/src/app/components/header/header.component.htmlindex 680cc98f02..6cf0ca305d 100644--- a/apps/client/src/app/components/header/header.component.html+++ b/apps/client/src/app/components/header/header.component.html@@ -181,14 +181,10 @@<a class="d-flex" mat-menu-item [routerLink]="routerLinkPricing"><span class="align-items-center d-flex"><span>- @if (user.subscription.offer === 'default') {- <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'- ) {+ @if (user.subscription.offer.isRenewal) {<ng-container i18n>Renew Plan</ng-container>+ } @else {+ <ng-container i18n>Upgrade Plan</ng-container>}</span><gf-premium-indicatordiff --git a/apps/client/src/app/components/user-account-membership/user-account-membership.html b/apps/client/src/app/components/user-account-membership/user-account-membership.htmlindex 64dd2ce8f5..eadf856123 100644--- a/apps/client/src/app/components/user-account-membership/user-account-membership.html+++ b/apps/client/src/app/components/user-account-membership/user-account-membership.html@@ -14,14 +14,10 @@hasPermissionForSubscription && hasPermissionToUpdateUserSettings) {<button color="primary" mat-flat-button (click)="onCheckout()">- @if (user.subscription.offer === 'default') {- <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'- ) {+ @if (user.subscription.offer.isRenewal) {<ng-container i18n>Renew Plan</ng-container>+ } @else {+ <ng-container i18n>Upgrade Plan</ng-container>}</button>@if (price) {diff --git a/apps/client/src/app/pages/pricing/pricing-page.html b/apps/client/src/app/pages/pricing/pricing-page.htmlindex b165d5c230..d26a2e11e2 100644--- a/apps/client/src/app/pages/pricing/pricing-page.html+++ b/apps/client/src/app/pages/pricing/pricing-page.html@@ -306,14 +306,10 @@mat-flat-button(click)="onCheckout()">- @if (user.subscription.offer === 'default') {- <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'- ) {+ @if (user.subscription.offer.isRenewal) {<ng-container i18n>Renew Plan</ng-container>+ } @else {+ <ng-container i18n>Upgrade Plan</ng-container>}</button><p class="m-0 text-muted">diff --git a/libs/common/src/lib/interfaces/subscription-offer.interface.ts b/libs/common/src/lib/interfaces/subscription-offer.interface.tsindex 9ffe96a584..a9ebb54f42 100644--- a/libs/common/src/lib/interfaces/subscription-offer.interface.ts+++ b/libs/common/src/lib/interfaces/subscription-offer.interface.ts@@ -4,6 +4,7 @@ export interface SubscriptionOffer {coupon?: number;couponId?: string;durationExtension?: StringValue;+ isRenewal?: boolean;label?: string;price: number;priceId: string;