@ -1,9 +1,14 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
import { TrialPeriodDTO } from 'src/engine/core-modules/billing/dto/trial-period.dto';
|
||||
import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { AuthProviders } from 'src/engine/core-modules/workspace/dtos/public-workspace-data-output';
|
||||
|
||||
registerEnumType(FeatureFlagKey, {
|
||||
name: 'FeatureFlagKey',
|
||||
});
|
||||
|
||||
@ObjectType()
|
||||
class Billing {
|
||||
@Field(() => Boolean)
|
||||
@ -52,6 +57,27 @@ class ApiConfig {
|
||||
mutationMaximumAffectedRecords: number;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
class PublicFeatureFlagMetadata {
|
||||
@Field(() => String)
|
||||
label: string;
|
||||
|
||||
@Field(() => String)
|
||||
description: string;
|
||||
|
||||
@Field(() => String, { nullable: false, defaultValue: '' })
|
||||
imagePath: string;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
class PublicFeatureFlag {
|
||||
@Field(() => FeatureFlagKey)
|
||||
key: FeatureFlagKey;
|
||||
|
||||
@Field(() => PublicFeatureFlagMetadata)
|
||||
metadata: PublicFeatureFlagMetadata;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
export class ClientConfig {
|
||||
@Field(() => AuthProviders, { nullable: false })
|
||||
@ -98,4 +124,7 @@ export class ClientConfig {
|
||||
|
||||
@Field(() => Boolean)
|
||||
canManageFeatureFlags: boolean;
|
||||
|
||||
@Field(() => [PublicFeatureFlag])
|
||||
publicFeatureFlags: PublicFeatureFlag[];
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import { Query, Resolver } from '@nestjs/graphql';
|
||||
|
||||
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/service/domain-manager.service';
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { PUBLIC_FEATURE_FLAGS } from 'src/engine/core-modules/feature-flag/constants/public-feature-flag.const';
|
||||
|
||||
import { ClientConfig } from './client-config.entity';
|
||||
|
||||
@ -75,6 +76,7 @@ export class ClientConfigResolver {
|
||||
canManageFeatureFlags:
|
||||
this.environmentService.get('DEBUG_MODE') ||
|
||||
this.environmentService.get('IS_BILLING_ENABLED'),
|
||||
publicFeatureFlags: PUBLIC_FEATURE_FLAGS,
|
||||
};
|
||||
|
||||
return Promise.resolve(clientConfig);
|
||||
|
||||
Reference in New Issue
Block a user