Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-9364] Copy for Aggregate auto-scaling invoices for Teams and Enterprise customers #9875

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
showUpdatedSubscriptionStatusSection$: Observable<boolean>;
manageBillingFromProviderPortal = ManageBilling;
isProviderManaged = false;
enableTimeThreshold: boolean;

protected readonly teamsStarter = ProductTierType.TeamsStarter;

Expand All @@ -60,6 +61,10 @@
FeatureFlag.EnableConsolidatedBilling,
);

protected enableTimeThreshold$ = this.configService.getFeatureFlag$(

Check warning on line 64 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L64

Added line #L64 was not covered by tests
FeatureFlag.EnableTimeThreshold,
);

constructor(
private apiService: ApiService,
private platformUtilsService: PlatformUtilsService,
Expand Down Expand Up @@ -94,6 +99,7 @@
this.showUpdatedSubscriptionStatusSection$ = this.configService.getFeatureFlag$(
FeatureFlag.AC1795_UpdatedSubscriptionStatusSection,
);
this.enableTimeThreshold = await firstValueFrom(this.enableTimeThreshold$);

Check warning on line 102 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L102

Added line #L102 was not covered by tests
}

ngOnDestroy() {
Expand Down Expand Up @@ -284,16 +290,38 @@
return this.i18nService.t("subscriptionUpgrade", this.sub.seats.toString());
}
} else if (this.sub.maxAutoscaleSeats === this.sub.seats && this.sub.seats != null) {
return this.i18nService.t("subscriptionMaxReached", this.sub.seats.toString());
if (!this.enableTimeThreshold) {
return this.i18nService.t("subscriptionMaxReached", this.sub.seats.toString());

Check warning on line 294 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L294

Added line #L294 was not covered by tests
}
const seatAdjustmentMessage = this.sub.plan.isAnnual
? "annualSubscriptionUserSeatsMessage"
: "monthlySubscriptionUserSeatsMessage";
return this.i18nService.t(

Check warning on line 299 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L299

Added line #L299 was not covered by tests
seatAdjustmentMessage + "subscriptionSeatMaxReached",
this.sub.seats.toString(),
);
} else if (this.userOrg.productTierType === ProductTierType.TeamsStarter) {
return this.i18nService.t("subscriptionUserSeatsWithoutAdditionalSeatsOption", 10);
} else if (this.sub.maxAutoscaleSeats == null) {
return this.i18nService.t("subscriptionUserSeatsUnlimitedAutoscale");
if (!this.enableTimeThreshold) {
return this.i18nService.t("subscriptionUserSeatsUnlimitedAutoscale");

Check warning on line 307 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L307

Added line #L307 was not covered by tests
}

const seatAdjustmentMessage = this.sub.plan.isAnnual
? "annualSubscriptionUserSeatsMessage"
: "monthlySubscriptionUserSeatsMessage";
return this.i18nService.t(seatAdjustmentMessage);

Check warning on line 313 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L313

Added line #L313 was not covered by tests
} else {
return this.i18nService.t(
"subscriptionUserSeatsLimitedAutoscale",
this.sub.maxAutoscaleSeats.toString(),
);
if (!this.enableTimeThreshold) {
return this.i18nService.t(

Check warning on line 316 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L316

Added line #L316 was not covered by tests
"subscriptionUserSeatsLimitedAutoscale",
this.sub.maxAutoscaleSeats.toString(),
);
}
const seatAdjustmentMessage = this.sub.plan.isAnnual
? "annualSubscriptionUserSeatsMessage"
: "monthlySubscriptionUserSeatsMessage";
return this.i18nService.t(seatAdjustmentMessage, this.sub.maxAutoscaleSeats.toString());

Check warning on line 324 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

โŒ Getting worse: Complex Method

OrganizationSubscriptionCloudComponent.getsubscriptionDesc increases in cyclomatic complexity from 11 to 17, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 324 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

โŒ New issue: Bumpy Road Ahead

OrganizationSubscriptionCloudComponent.getsubscriptionDesc has 4 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 324 in apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/billing/organizations/organization-subscription-cloud.component.ts#L324

Added line #L324 was not covered by tests
}
}

Expand Down
15 changes: 15 additions & 0 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3689,6 +3689,15 @@
}
}
},
"subscriptionSeatMaxReached": {
"message": "You cannot invite more than $COUNT$ members without increasing your subscription seats.",
"placeholders": {
"count": {
"content": "$1",
"example": "50"
}
}
},
"seatsToAdd": {
"message": "Seats to add"
},
Expand Down Expand Up @@ -8489,5 +8498,11 @@
"billingHistoryDescription": {
"message": "Download a CSV to obtain client details for each billing date. Prorated charges are not included in the CSV and may vary from the linked invoice. For the most accurate billing details, refer to your monthly invoices.",
"description": "A paragraph on the Billing History page of the Provider Portal letting users know they can download a CSV report for their invoices that does not include prorations."
},
"monthlySubscriptionUserSeatsMessage": {
"message": "Adjustments to your subscription will result in prorated charges to your billing totals on your next billing period. "
},
"annualSubscriptionUserSeatsMessage": {
"message": "Adjustments to your subscription will result in prorated charges on a monthly billing cycle. "
}
}
2 changes: 2 additions & 0 deletions libs/common/src/enums/feature-flag.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum FeatureFlag {
EmailVerification = "email-verification",
InlineMenuFieldQualification = "inline-menu-field-qualification",
MemberAccessReport = "ac-2059-member-access-report",
EnableTimeThreshold = "PM-5864-dollar-threshold",
}

export type AllowedFeatureFlagTypes = boolean | number | string;
Expand Down Expand Up @@ -50,6 +51,7 @@ export const DefaultFeatureFlagValue = {
[FeatureFlag.EmailVerification]: FALSE,
[FeatureFlag.InlineMenuFieldQualification]: FALSE,
[FeatureFlag.MemberAccessReport]: FALSE,
[FeatureFlag.EnableTimeThreshold]: FALSE,
} satisfies Record<FeatureFlag, AllowedFeatureFlagTypes>;

export type DefaultFeatureFlagValueType = typeof DefaultFeatureFlagValue;
Expand Down
Loading