feat: redirect to Plan Required page if subscription status is not active (#2981)
* feat: redirect to Plan Required page if subscription status is not active Closes #2934 * feat: navigate to Plan Required in PageChangeEffect * feat: add Twenty logo to Plan Required modal * test: add Storybook story * Fix lint --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -116,6 +116,7 @@ export class AuthService {
|
||||
displayName: '',
|
||||
domainName: '',
|
||||
inviteHash: v4(),
|
||||
subscriptionStatus: 'incomplete',
|
||||
});
|
||||
|
||||
workspace = await this.workspaceRepository.save(workspaceToCreate);
|
||||
|
||||
@ -21,6 +21,15 @@ class Telemetry {
|
||||
anonymizationEnabled: boolean;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
class Billing {
|
||||
@Field(() => Boolean)
|
||||
isBillingEnabled: boolean;
|
||||
|
||||
@Field(() => String)
|
||||
billingUrl: string;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
class Support {
|
||||
@Field(() => String)
|
||||
@ -38,6 +47,9 @@ export class ClientConfig {
|
||||
@Field(() => Telemetry, { nullable: false })
|
||||
telemetry: Telemetry;
|
||||
|
||||
@Field(() => Billing, { nullable: false })
|
||||
billing: Billing;
|
||||
|
||||
@Field(() => Boolean)
|
||||
signInPrefilled: boolean;
|
||||
|
||||
|
||||
@ -21,6 +21,10 @@ export class ClientConfigResolver {
|
||||
anonymizationEnabled:
|
||||
this.environmentService.isTelemetryAnonymizationEnabled(),
|
||||
},
|
||||
billing: {
|
||||
isBillingEnabled: this.environmentService.isBillingEnabled(),
|
||||
billingUrl: this.environmentService.getBillingUrl(),
|
||||
},
|
||||
signInPrefilled: this.environmentService.isSignInPrefilled(),
|
||||
debugMode: this.environmentService.isDebugMode(),
|
||||
support: {
|
||||
|
||||
@ -58,4 +58,8 @@ export class Workspace {
|
||||
|
||||
@OneToMany(() => FeatureFlagEntity, (featureFlag) => featureFlag.workspace)
|
||||
featureFlags: FeatureFlagEntity[];
|
||||
|
||||
@Field()
|
||||
@Column({ default: 'incomplete' })
|
||||
subscriptionStatus: 'incomplete' | 'active' | 'canceled';
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddSubscriptionStatusOnWorkspace1702479005171
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddSubscriptionStatusOnWorkspace1702479005171';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."workspace" ADD "subscriptionStatus" character varying NOT NULL DEFAULT 'incomplete'`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."workspace" DROP COLUMN "subscriptionStatus"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,14 @@ export class EnvironmentService {
|
||||
return this.configService.get<boolean>('SIGN_IN_PREFILLED') ?? false;
|
||||
}
|
||||
|
||||
isBillingEnabled() {
|
||||
return this.configService.get<boolean>('IS_BILLING_ENABLED') ?? false;
|
||||
}
|
||||
|
||||
getBillingUrl() {
|
||||
return this.configService.get<string>('BILLING_PLAN_REQUIRED_LINK') ?? '';
|
||||
}
|
||||
|
||||
isTelemetryEnabled(): boolean {
|
||||
return this.configService.get<boolean>('TELEMETRY_ENABLED') ?? true;
|
||||
}
|
||||
|
||||
@ -38,6 +38,15 @@ export class EnvironmentVariables {
|
||||
@IsBoolean()
|
||||
SIGN_IN_PREFILLED?: boolean;
|
||||
|
||||
@CastToBoolean()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
IS_BILLING_ENABLED?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
BILLING_URL?: string;
|
||||
|
||||
@CastToBoolean()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
|
||||
Reference in New Issue
Block a user