@automattic/jetpack-ai-client 0.27.6 → 0.27.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/build/api-fetch/index.d.ts +3 -1
- package/build/components/ai-control/ai-control.d.ts +5 -1
- package/build/components/ai-image/components/ai-image-modal.d.ts +0 -1
- package/build/components/ai-image/components/carrousel.d.ts +0 -1
- package/build/components/ai-image/hooks/use-ai-image.js +2 -2
- package/build/components/modal/index.d.ts +0 -1
- package/build/hooks/use-ai-feature/index.d.ts +1 -1
- package/build/hooks/use-ai-feature/index.js +1 -1
- package/build/hooks/use-image-generator/index.d.ts +1 -1
- package/build/logo-generator/store/reducer.d.ts +17 -17
- package/build/logo-generator/store/reducer.js +1 -1
- package/package.json +21 -20
- package/src/components/ai-control/ai-control.tsx +1 -1
- package/src/components/ai-control/style.scss +1 -0
- package/src/components/ai-feedback/style.scss +1 -0
- package/src/components/ai-image/components/ai-image-modal.scss +2 -0
- package/src/components/ai-image/components/carrousel.scss +6 -0
- package/src/components/ai-image/style.scss +2 -0
- package/src/components/modal/style.scss +2 -0
- package/src/components/quota-exceeded-message/style.scss +2 -0
- package/src/logo-generator/assets/icons/icons.scss +1 -0
- package/src/logo-generator/components/generator-modal.scss +1 -0
- package/src/logo-generator/components/logo-presenter.scss +1 -0
- package/src/logo-generator/components/prompt.scss +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.27.7] - 2025-04-07
|
|
9
|
+
### Changed
|
|
10
|
+
- Code: First pass of style coding standards. [#42734]
|
|
11
|
+
- Update package dependencies. [#42762] [#42809]
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- Fix TypeScript type checking in the monorepo. [#42817]
|
|
15
|
+
|
|
8
16
|
## [0.27.6] - 2025-03-31
|
|
9
17
|
### Changed
|
|
10
18
|
- Update dependencies. [#42678]
|
|
@@ -576,6 +584,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
576
584
|
- AI Client: stop using smart document visibility handling on the fetchEventSource library, so it does not restart the completion when changing tabs. [#32004]
|
|
577
585
|
- Updated package dependencies. [#31468] [#31659] [#31785]
|
|
578
586
|
|
|
587
|
+
[0.27.7]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.6...v0.27.7
|
|
579
588
|
[0.27.6]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.5...v0.27.6
|
|
580
589
|
[0.27.5]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.4...v0.27.5
|
|
581
590
|
[0.27.4]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.3...v0.27.4
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import apiFetchMod from '@wordpress/api-fetch';
|
|
5
|
-
declare const
|
|
5
|
+
declare const apiFetch: typeof apiFetchMod.default;
|
|
6
|
+
type ApiFetchType = typeof apiFetch extends Function ? typeof apiFetch : typeof apiFetchMod;
|
|
7
|
+
declare const _default: ApiFetchType;
|
|
6
8
|
export default _default;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PlainText } from '@wordpress/block-editor';
|
|
1
5
|
import React from 'react';
|
|
2
6
|
import './style.scss';
|
|
3
7
|
/**
|
|
@@ -17,7 +21,7 @@ type AIControlProps = {
|
|
|
17
21
|
error?: ReactElement;
|
|
18
22
|
actions?: ReactElement;
|
|
19
23
|
message?: ReactElement;
|
|
20
|
-
promptUserInputRef?:
|
|
24
|
+
promptUserInputRef?: PlainText.Props['ref'];
|
|
21
25
|
wrapperRef?: React.MutableRefObject<HTMLDivElement | null>;
|
|
22
26
|
};
|
|
23
27
|
/**
|
|
@@ -109,8 +109,8 @@ export default function useAiImage({ feature, type, cost, autoStart = true, prev
|
|
|
109
109
|
*/
|
|
110
110
|
const generateImagePromise = generateImageWithParameters({
|
|
111
111
|
feature,
|
|
112
|
-
size: '1792x1024',
|
|
113
|
-
responseFormat: 'b64_json',
|
|
112
|
+
size: '1792x1024', // the size, when the generation happens with DALL-E-3
|
|
113
|
+
responseFormat: 'b64_json', // the response format, when the generation happens with DALL-E-3
|
|
114
114
|
messages: [
|
|
115
115
|
{
|
|
116
116
|
role: 'jetpack-ai',
|
|
@@ -22,7 +22,7 @@ export default function useAiFeature(): {
|
|
|
22
22
|
nextStart: string;
|
|
23
23
|
requestsCount: number;
|
|
24
24
|
};
|
|
25
|
-
nextTier?: import("@automattic/jetpack-shared-extension-utils/store/wordpress-com/types").TierProp;
|
|
25
|
+
nextTier?: import("@automattic/jetpack-shared-extension-utils/store/wordpress-com/types").TierProp | null;
|
|
26
26
|
tierPlansEnabled?: boolean;
|
|
27
27
|
costs?: {
|
|
28
28
|
[key: string]: {
|
|
@@ -10,7 +10,7 @@ declare const useImageGenerator: () => {
|
|
|
10
10
|
generateImage: ({ feature, postContent, responseFormat, userPrompt, }: {
|
|
11
11
|
feature: string;
|
|
12
12
|
postContent: string;
|
|
13
|
-
responseFormat?:
|
|
13
|
+
responseFormat?: "url" | "b64_json";
|
|
14
14
|
userPrompt?: string;
|
|
15
15
|
}) => Promise<ImageGenerationResponse>;
|
|
16
16
|
generateImageWithStableDiffusion: ({ feature, postContent, userPrompt, }: {
|
|
@@ -72,10 +72,10 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
72
72
|
errorCode?: string;
|
|
73
73
|
upgradeType: import("./types.js").UpgradeTypeProp;
|
|
74
74
|
currentTier?: import("./types.js").TierProp;
|
|
75
|
-
nextTier?: import("./types.js").TierProp;
|
|
75
|
+
nextTier?: import("./types.js").TierProp | null;
|
|
76
76
|
tierPlansEnabled?: boolean;
|
|
77
77
|
costs?: {
|
|
78
|
-
|
|
78
|
+
"jetpack-ai-logo-generator": {
|
|
79
79
|
logo: number;
|
|
80
80
|
};
|
|
81
81
|
};
|
|
@@ -103,7 +103,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
103
103
|
isLoadingHistory: boolean;
|
|
104
104
|
};
|
|
105
105
|
siteDetails?: SiteDetails | Record<string, never>;
|
|
106
|
-
history: import("./types.js").Logo
|
|
106
|
+
history: Array<import("./types.js").Logo>;
|
|
107
107
|
selectedLogoIndex: number;
|
|
108
108
|
} | {
|
|
109
109
|
history: {
|
|
@@ -148,7 +148,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
148
148
|
features: {
|
|
149
149
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
150
150
|
};
|
|
151
|
-
history: import("./types.js").Logo
|
|
151
|
+
history: Array<import("./types.js").Logo>;
|
|
152
152
|
selectedLogoIndex: number;
|
|
153
153
|
} | {
|
|
154
154
|
_meta: {
|
|
@@ -169,7 +169,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
169
169
|
features: {
|
|
170
170
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
171
171
|
};
|
|
172
|
-
history: import("./types.js").Logo
|
|
172
|
+
history: Array<import("./types.js").Logo>;
|
|
173
173
|
selectedLogoIndex: number;
|
|
174
174
|
} | {
|
|
175
175
|
_meta: {
|
|
@@ -190,7 +190,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
190
190
|
features: {
|
|
191
191
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
192
192
|
};
|
|
193
|
-
history: import("./types.js").Logo
|
|
193
|
+
history: Array<import("./types.js").Logo>;
|
|
194
194
|
selectedLogoIndex: number;
|
|
195
195
|
} | {
|
|
196
196
|
_meta: {
|
|
@@ -211,7 +211,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
211
211
|
features: {
|
|
212
212
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
213
213
|
};
|
|
214
|
-
history: import("./types.js").Logo
|
|
214
|
+
history: Array<import("./types.js").Logo>;
|
|
215
215
|
selectedLogoIndex: number;
|
|
216
216
|
} | {
|
|
217
217
|
features: {
|
|
@@ -236,10 +236,10 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
236
236
|
nextStart: string;
|
|
237
237
|
requestsCount: number;
|
|
238
238
|
};
|
|
239
|
-
nextTier?: import("./types.js").TierProp;
|
|
239
|
+
nextTier?: import("./types.js").TierProp | null;
|
|
240
240
|
tierPlansEnabled?: boolean;
|
|
241
241
|
costs?: {
|
|
242
|
-
|
|
242
|
+
"jetpack-ai-logo-generator": {
|
|
243
243
|
logo: number;
|
|
244
244
|
};
|
|
245
245
|
};
|
|
@@ -261,7 +261,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
261
261
|
isLoadingHistory?: boolean;
|
|
262
262
|
};
|
|
263
263
|
siteDetails?: SiteDetails | Record<string, never>;
|
|
264
|
-
history: import("./types.js").Logo
|
|
264
|
+
history: Array<import("./types.js").Logo>;
|
|
265
265
|
selectedLogoIndex: number;
|
|
266
266
|
} | {
|
|
267
267
|
_meta: {
|
|
@@ -282,7 +282,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
282
282
|
features: {
|
|
283
283
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
284
284
|
};
|
|
285
|
-
history: import("./types.js").Logo
|
|
285
|
+
history: Array<import("./types.js").Logo>;
|
|
286
286
|
selectedLogoIndex: number;
|
|
287
287
|
} | {
|
|
288
288
|
_meta: {
|
|
@@ -303,7 +303,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
303
303
|
features: {
|
|
304
304
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
305
305
|
};
|
|
306
|
-
history: import("./types.js").Logo
|
|
306
|
+
history: Array<import("./types.js").Logo>;
|
|
307
307
|
selectedLogoIndex: number;
|
|
308
308
|
} | {
|
|
309
309
|
_meta: {
|
|
@@ -324,7 +324,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
324
324
|
features: {
|
|
325
325
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
326
326
|
};
|
|
327
|
-
history: import("./types.js").Logo
|
|
327
|
+
history: Array<import("./types.js").Logo>;
|
|
328
328
|
selectedLogoIndex: number;
|
|
329
329
|
} | {
|
|
330
330
|
_meta: {
|
|
@@ -345,7 +345,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
345
345
|
features: {
|
|
346
346
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
347
347
|
};
|
|
348
|
-
history: import("./types.js").Logo
|
|
348
|
+
history: Array<import("./types.js").Logo>;
|
|
349
349
|
selectedLogoIndex: number;
|
|
350
350
|
} | {
|
|
351
351
|
_meta: {
|
|
@@ -366,7 +366,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
366
366
|
features: {
|
|
367
367
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
368
368
|
};
|
|
369
|
-
history: import("./types.js").Logo
|
|
369
|
+
history: Array<import("./types.js").Logo>;
|
|
370
370
|
selectedLogoIndex: number;
|
|
371
371
|
} | {
|
|
372
372
|
_meta: {
|
|
@@ -387,7 +387,7 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
387
387
|
features: {
|
|
388
388
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
389
389
|
};
|
|
390
|
-
history: import("./types.js").Logo
|
|
390
|
+
history: Array<import("./types.js").Logo>;
|
|
391
391
|
selectedLogoIndex: number;
|
|
392
392
|
} | {
|
|
393
393
|
_meta: {
|
|
@@ -408,6 +408,6 @@ export default function reducer(state: import("./types.js").LogoGeneratorStatePr
|
|
|
408
408
|
features: {
|
|
409
409
|
aiAssistantFeature?: AiFeatureStateProps;
|
|
410
410
|
};
|
|
411
|
-
history: import("./types.js").Logo
|
|
411
|
+
history: Array<import("./types.js").Logo>;
|
|
412
412
|
selectedLogoIndex: number;
|
|
413
413
|
};
|
|
@@ -48,7 +48,7 @@ export default function reducer(state = INITIAL_STATE, action) {
|
|
|
48
48
|
_meta: {
|
|
49
49
|
...state?.features?.aiAssistantFeature?._meta,
|
|
50
50
|
isRequesting: true,
|
|
51
|
-
asyncRequestCountdown: ASYNC_REQUEST_COUNTDOWN_INIT_VALUE,
|
|
51
|
+
asyncRequestCountdown: ASYNC_REQUEST_COUNTDOWN_INIT_VALUE, // restore the countdown
|
|
52
52
|
asyncRequestTimerId: 0, // reset the timer id
|
|
53
53
|
},
|
|
54
54
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@automattic/jetpack-ai-client",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.7",
|
|
5
5
|
"description": "A JS client for consuming Jetpack AI services",
|
|
6
6
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"compile-ts": "tsc --pretty",
|
|
21
21
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
22
22
|
"test-coverage": "pnpm run test --coverage",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
23
24
|
"watch": "tsc --watch --pretty"
|
|
24
25
|
},
|
|
25
26
|
"type": "module",
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
"jest": "^29.6.2",
|
|
34
35
|
"jest-environment-jsdom": "29.7.0",
|
|
35
36
|
"storybook": "8.6.7",
|
|
36
|
-
"typescript": "5.
|
|
37
|
+
"typescript": "5.8.2"
|
|
37
38
|
},
|
|
38
39
|
"exports": {
|
|
39
40
|
".": {
|
|
@@ -44,28 +45,28 @@
|
|
|
44
45
|
"main": "./build/index.js",
|
|
45
46
|
"types": "./build/index.d.ts",
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@automattic/jetpack-base-styles": "^0.
|
|
48
|
-
"@automattic/jetpack-components": "^0.72.
|
|
49
|
-
"@automattic/jetpack-connection": "^0.39.
|
|
50
|
-
"@automattic/jetpack-shared-extension-utils": "^0.18.
|
|
48
|
+
"@automattic/jetpack-base-styles": "^0.7.0",
|
|
49
|
+
"@automattic/jetpack-components": "^0.72.3",
|
|
50
|
+
"@automattic/jetpack-connection": "^0.39.10",
|
|
51
|
+
"@automattic/jetpack-shared-extension-utils": "^0.18.11",
|
|
51
52
|
"@microsoft/fetch-event-source": "2.0.1",
|
|
52
53
|
"@types/jest": "29.5.14",
|
|
53
54
|
"@types/react": "18.3.18",
|
|
54
55
|
"@types/wordpress__block-editor": "11.5.16",
|
|
55
|
-
"@wordpress/api-fetch": "7.
|
|
56
|
-
"@wordpress/base-styles": "5.
|
|
57
|
-
"@wordpress/blob": "4.
|
|
58
|
-
"@wordpress/blocks": "14.
|
|
59
|
-
"@wordpress/block-editor": "14.
|
|
60
|
-
"@wordpress/components": "29.
|
|
61
|
-
"@wordpress/compose": "7.
|
|
62
|
-
"@wordpress/data": "10.
|
|
63
|
-
"@wordpress/editor": "14.
|
|
64
|
-
"@wordpress/element": "6.
|
|
65
|
-
"@wordpress/i18n": "5.
|
|
66
|
-
"@wordpress/icons": "10.
|
|
67
|
-
"@wordpress/primitives": "4.
|
|
68
|
-
"@wordpress/url": "4.
|
|
56
|
+
"@wordpress/api-fetch": "7.21.0",
|
|
57
|
+
"@wordpress/base-styles": "5.21.0",
|
|
58
|
+
"@wordpress/blob": "4.21.0",
|
|
59
|
+
"@wordpress/blocks": "14.10.0",
|
|
60
|
+
"@wordpress/block-editor": "14.16.0",
|
|
61
|
+
"@wordpress/components": "29.7.0",
|
|
62
|
+
"@wordpress/compose": "7.21.0",
|
|
63
|
+
"@wordpress/data": "10.21.0",
|
|
64
|
+
"@wordpress/editor": "14.21.0",
|
|
65
|
+
"@wordpress/element": "6.21.0",
|
|
66
|
+
"@wordpress/i18n": "5.21.0",
|
|
67
|
+
"@wordpress/icons": "10.21.0",
|
|
68
|
+
"@wordpress/primitives": "4.21.0",
|
|
69
|
+
"@wordpress/url": "4.21.0",
|
|
69
70
|
"clsx": "2.1.1",
|
|
70
71
|
"debug": "4.4.0",
|
|
71
72
|
"markdown-it": "14.1.0",
|
|
@@ -27,7 +27,7 @@ type AIControlProps = {
|
|
|
27
27
|
error?: ReactElement;
|
|
28
28
|
actions?: ReactElement;
|
|
29
29
|
message?: ReactElement;
|
|
30
|
-
promptUserInputRef?:
|
|
30
|
+
promptUserInputRef?: PlainText.Props[ 'ref' ];
|
|
31
31
|
wrapperRef?: React.MutableRefObject< HTMLDivElement | null >;
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
$scale-factor: 0.55;
|
|
2
2
|
|
|
3
3
|
.ai-assistant-image {
|
|
4
|
+
|
|
4
5
|
&__blank {
|
|
5
6
|
display: flex;
|
|
6
7
|
justify-content: center;
|
|
@@ -52,6 +53,7 @@ $scale-factor: 0.55;
|
|
|
52
53
|
height: calc( 768px * $scale-factor );
|
|
53
54
|
|
|
54
55
|
.ai-carrousel {
|
|
56
|
+
|
|
55
57
|
&__prev {
|
|
56
58
|
left: 0;
|
|
57
59
|
}
|
|
@@ -62,6 +64,7 @@ $scale-factor: 0.55;
|
|
|
62
64
|
|
|
63
65
|
&__prev,
|
|
64
66
|
&__next {
|
|
67
|
+
|
|
65
68
|
&:hover {
|
|
66
69
|
background-color: rgba( 0, 0, 0, 0.3 );
|
|
67
70
|
opacity: 1;
|
|
@@ -69,6 +72,7 @@ $scale-factor: 0.55;
|
|
|
69
72
|
|
|
70
73
|
&-icon {
|
|
71
74
|
fill: white;
|
|
75
|
+
|
|
72
76
|
&.is-disabled {
|
|
73
77
|
fill: gray;
|
|
74
78
|
}
|
|
@@ -111,6 +115,7 @@ $scale-factor: 0.55;
|
|
|
111
115
|
padding: 6px 0;
|
|
112
116
|
|
|
113
117
|
.ai-carrousel {
|
|
118
|
+
|
|
114
119
|
&__prev,
|
|
115
120
|
&__next {
|
|
116
121
|
display: flex;
|
|
@@ -122,6 +127,7 @@ $scale-factor: 0.55;
|
|
|
122
127
|
padding: 0;
|
|
123
128
|
|
|
124
129
|
&-icon {
|
|
130
|
+
|
|
125
131
|
&.is-disabled {
|
|
126
132
|
fill: gray;
|
|
127
133
|
}
|