Skip to content

Commit

Permalink
Fix Jetpack AI features control types (#39826)
Browse files Browse the repository at this point in the history
* add changelog

* fix types for featuresControl and add default value for logo-generator feature

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11441103824

Upstream-Ref: Automattic/jetpack@e8806f8
  • Loading branch information
CGastrell authored and matticbot committed Oct 21, 2024
1 parent dd6cb72 commit ee037f3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.22.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Changed
- AI Client: add types for AI assistant feature payload data branch featuresControl

## [0.21.0] - 2024-10-14
### Added
- AI Client: Add image styles 'auto' and 'none' to the logo generator. Order styles so those are on top in the dropdown selector. [#39689]
Expand Down Expand Up @@ -435,6 +442,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated package dependencies. [#31659]
- Updated package dependencies. [#31785]

[0.22.0-alpha]: https://github.com/Automattic/jetpack-ai-client/compare/v0.21.0...v0.22.0-alpha
[0.21.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.20.1...v0.21.0
[0.20.1]: https://github.com/Automattic/jetpack-ai-client/compare/v0.20.0...v0.20.1
[0.20.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.19.0...v0.20.0
Expand Down
6 changes: 6 additions & 0 deletions build/ai-client/src/logo-generator/store/initial-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ const INITIAL_STATE = {
asyncRequestTimerId: 0,
isRequestingImage: false,
},
featuresControl: {
'logo-generator': {
enabled: false,
styles: [],
},
},
},
},
history: [],
Expand Down
4 changes: 1 addition & 3 deletions build/ai-client/src/logo-generator/store/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ 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;
[key: string]: FeatureControl | LogoGeneratorFeatureControl;
};
export type AiFeatureProps = {
hasFeature: boolean;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": false,
"name": "@automattic/jetpack-ai-client",
"version": "0.21.0",
"version": "0.22.0-alpha",
"description": "A JS client for consuming Jetpack AI services",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme",
"bugs": {
Expand Down
6 changes: 6 additions & 0 deletions src/logo-generator/store/initial-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const INITIAL_STATE: LogoGeneratorStateProp = {
asyncRequestTimerId: 0,
isRequestingImage: false,
},
featuresControl: {
'logo-generator': {
enabled: false,
styles: [],
},
},
},
},
history: [],
Expand Down
6 changes: 3 additions & 3 deletions src/logo-generator/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ee037f3

Please sign in to comment.