From b49638513b793b5fc885a4c78cc5c51aa157d987 Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Mon, 21 Oct 2024 10:23:30 -0300 Subject: [PATCH] Fix Jetpack AI features control types (#39826) * add changelog * fix types for featuresControl and add default value for logo-generator feature --- .../changelog/add-jetpack-ai-features-control-types | 4 ++++ .../ai-client/src/logo-generator/store/initial-state.ts | 6 ++++++ .../js-packages/ai-client/src/logo-generator/store/types.ts | 6 +++--- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 projects/js-packages/ai-client/changelog/add-jetpack-ai-features-control-types diff --git a/projects/js-packages/ai-client/changelog/add-jetpack-ai-features-control-types b/projects/js-packages/ai-client/changelog/add-jetpack-ai-features-control-types new file mode 100644 index 0000000000000..68e175cac7043 --- /dev/null +++ b/projects/js-packages/ai-client/changelog/add-jetpack-ai-features-control-types @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +AI Client: add types for AI assistant feature payload data branch featuresControl diff --git a/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts b/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts index 7b130dc12e31e..d07579e8f9793 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/initial-state.ts @@ -34,6 +34,12 @@ const INITIAL_STATE: LogoGeneratorStateProp = { asyncRequestTimerId: 0, isRequestingImage: false, }, + featuresControl: { + 'logo-generator': { + enabled: false, + styles: [], + }, + }, }, }, history: [], diff --git a/projects/js-packages/ai-client/src/logo-generator/store/types.ts b/projects/js-packages/ai-client/src/logo-generator/store/types.ts index c4eb52f9d95da..5f45e6644844c 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/types.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/types.ts @@ -95,11 +95,11 @@ export type LogoGeneratorFeatureControl = FeatureControl & { export type FeatureControl = { enabled: boolean; - 'min-jetpack-version': string; - [ key: string ]: FeatureControl | LogoGeneratorFeatureControl | boolean | string; }; -export type FeaturesControl = { [ key: string ]: FeatureControl }; +export type FeaturesControl = { + [ key: string ]: FeatureControl | LogoGeneratorFeatureControl; +}; export type AiFeatureProps = { hasFeature: boolean;