@automattic/jetpack-ai-client 0.14.2 → 0.14.3
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 +7 -0
- package/build/components/ai-control/ai-control.js +2 -2
- package/build/components/ai-status-indicator/index.js +2 -2
- package/build/components/message/index.js +2 -2
- package/build/hooks/use-image-generator/index.d.ts +1 -0
- package/build/hooks/use-image-generator/index.js +1 -0
- package/package.json +13 -13
- package/src/components/ai-control/ai-control.tsx +3 -3
- package/src/components/ai-status-indicator/index.tsx +2 -2
- package/src/components/message/index.tsx +2 -2
- package/src/hooks/use-image-generator/index.ts +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ 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.14.3] - 2024-06-10
|
|
9
|
+
### Changed
|
|
10
|
+
- AI Featured Image: export generic image generation request function. [#37668]
|
|
11
|
+
- Change codebase to use clsx instead of classnames. [#37708]
|
|
12
|
+
- Updated package dependencies. [#37669]
|
|
13
|
+
|
|
8
14
|
## [0.14.2] - 2024-06-03
|
|
9
15
|
### Added
|
|
10
16
|
- AI Client: Add list-related fixes on MarkdownToHTML conversion. [#37564]
|
|
@@ -333,6 +339,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
333
339
|
- Updated package dependencies. [#31659]
|
|
334
340
|
- Updated package dependencies. [#31785]
|
|
335
341
|
|
|
342
|
+
[0.14.3]: https://github.com/Automattic/jetpack-ai-client/compare/v0.14.2...v0.14.3
|
|
336
343
|
[0.14.2]: https://github.com/Automattic/jetpack-ai-client/compare/v0.14.1...v0.14.2
|
|
337
344
|
[0.14.1]: https://github.com/Automattic/jetpack-ai-client/compare/v0.14.0...v0.14.1
|
|
338
345
|
[0.14.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.13.1...v0.14.0
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { PlainText } from '@wordpress/block-editor';
|
|
6
|
-
import
|
|
6
|
+
import clsx from 'clsx';
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
@@ -16,7 +16,7 @@ import './style.scss';
|
|
|
16
16
|
* @returns {ReactElement} Rendered component
|
|
17
17
|
*/
|
|
18
18
|
export default function AIControl({ className, disabled = false, value = '', placeholder = '', isTransparent = false, state = 'init', onChange, banner = null, error = null, actions = null, message = null, promptUserInputRef = null, wrapperRef = null, }) {
|
|
19
|
-
return (_jsxs("div", { className:
|
|
19
|
+
return (_jsxs("div", { className: clsx('jetpack-components-ai-control__container-wrapper', className), ref: wrapperRef, children: [error, _jsxs("div", { className: "jetpack-components-ai-control__container", children: [banner, _jsxs("div", { className: clsx('jetpack-components-ai-control__wrapper', {
|
|
20
20
|
'is-transparent': isTransparent,
|
|
21
21
|
}), children: [_jsx(AiStatusIndicator, { state: state }), _jsx("div", { className: "jetpack-components-ai-control__input-wrapper", children: _jsx(PlainText, { value: value, onChange: onChange, placeholder: placeholder, className: "jetpack-components-ai-control__input", disabled: disabled, ref: promptUserInputRef }) }), actions] }), message] })] }));
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { Spinner } from '@wordpress/components';
|
|
6
|
-
import
|
|
6
|
+
import clsx from 'clsx';
|
|
7
7
|
import './style.scss';
|
|
8
8
|
/**
|
|
9
9
|
* AiStatusIndicator component.
|
|
@@ -12,7 +12,7 @@ import './style.scss';
|
|
|
12
12
|
* @returns {React.ReactElement} - rendered component.
|
|
13
13
|
*/
|
|
14
14
|
export default function AiStatusIndicator({ state }) {
|
|
15
|
-
return (_jsx("div", { className:
|
|
15
|
+
return (_jsx("div", { className: clsx('jetpack-ai-status-indicator__icon-wrapper', {
|
|
16
16
|
[`is-${state}`]: true,
|
|
17
17
|
}), children: _jsx(Spinner, {}) }));
|
|
18
18
|
}
|
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
import { ExternalLink, Button } from '@wordpress/components';
|
|
6
6
|
import { __, sprintf } from '@wordpress/i18n';
|
|
7
7
|
import { Icon, check, arrowRight } from '@wordpress/icons';
|
|
8
|
-
import
|
|
8
|
+
import clsx from 'clsx';
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
@@ -35,7 +35,7 @@ const messageIconsMap = {
|
|
|
35
35
|
* @returns {React.ReactElement } Banner component.
|
|
36
36
|
*/
|
|
37
37
|
export default function Message({ severity = MESSAGE_SEVERITY_INFO, icon = null, showSidebarIcon = false, onSidebarIconClick = () => { }, children, }) {
|
|
38
|
-
return (_jsxs("div", { className:
|
|
38
|
+
return (_jsxs("div", { className: clsx('jetpack-ai-assistant__message', `jetpack-ai-assistant__message-severity-${severity}`), children: [(messageIconsMap[severity] || icon) && (_jsx(Icon, { icon: messageIconsMap[severity] || icon })), _jsx("div", { className: "jetpack-ai-assistant__message-content", children: children }), showSidebarIcon && (_jsx(Button, { className: "jetpack-ai-assistant__message-sidebar", onClick: onSidebarIconClick, children: _jsx(Icon, { size: 20, icon: arrowRight }) }))] }));
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* React component to render a guideline message.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@automattic/jetpack-ai-client",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.3",
|
|
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": {
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"main": "./build/index.js",
|
|
43
43
|
"types": "./build/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@automattic/jetpack-base-styles": "^0.6.
|
|
46
|
-
"@automattic/jetpack-connection": "^0.33.
|
|
47
|
-
"@automattic/jetpack-shared-extension-utils": "^0.14.
|
|
45
|
+
"@automattic/jetpack-base-styles": "^0.6.26",
|
|
46
|
+
"@automattic/jetpack-connection": "^0.33.14",
|
|
47
|
+
"@automattic/jetpack-shared-extension-utils": "^0.14.14",
|
|
48
48
|
"@microsoft/fetch-event-source": "2.0.1",
|
|
49
49
|
"@types/react": "18.3.1",
|
|
50
|
-
"@wordpress/api-fetch": "
|
|
51
|
-
"@wordpress/block-editor": "
|
|
52
|
-
"@wordpress/components": "
|
|
53
|
-
"@wordpress/compose": "
|
|
54
|
-
"@wordpress/data": "
|
|
55
|
-
"@wordpress/element": "
|
|
56
|
-
"@wordpress/i18n": "
|
|
57
|
-
"@wordpress/icons": "
|
|
58
|
-
"
|
|
50
|
+
"@wordpress/api-fetch": "7.0.0",
|
|
51
|
+
"@wordpress/block-editor": "13.0.0",
|
|
52
|
+
"@wordpress/components": "28.0.0",
|
|
53
|
+
"@wordpress/compose": "7.0.0",
|
|
54
|
+
"@wordpress/data": "10.0.0",
|
|
55
|
+
"@wordpress/element": "6.0.0",
|
|
56
|
+
"@wordpress/i18n": "5.0.0",
|
|
57
|
+
"@wordpress/icons": "10.0.0",
|
|
58
|
+
"clsx": "2.1.1",
|
|
59
59
|
"debug": "4.3.4",
|
|
60
60
|
"markdown-it": "14.0.0",
|
|
61
61
|
"react": "18.3.1",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { PlainText } from '@wordpress/block-editor';
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -54,14 +54,14 @@ export default function AIControl( {
|
|
|
54
54
|
}: AIControlProps ): ReactElement {
|
|
55
55
|
return (
|
|
56
56
|
<div
|
|
57
|
-
className={
|
|
57
|
+
className={ clsx( 'jetpack-components-ai-control__container-wrapper', className ) }
|
|
58
58
|
ref={ wrapperRef }
|
|
59
59
|
>
|
|
60
60
|
{ error }
|
|
61
61
|
<div className="jetpack-components-ai-control__container">
|
|
62
62
|
{ banner }
|
|
63
63
|
<div
|
|
64
|
-
className={
|
|
64
|
+
className={ clsx( 'jetpack-components-ai-control__wrapper', {
|
|
65
65
|
'is-transparent': isTransparent,
|
|
66
66
|
} ) }
|
|
67
67
|
>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Spinner } from '@wordpress/components';
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
/*
|
|
7
7
|
* Types
|
|
8
8
|
*/
|
|
@@ -26,7 +26,7 @@ export type AiStatusIndicatorProps = {
|
|
|
26
26
|
export default function AiStatusIndicator( { state }: AiStatusIndicatorProps ): React.ReactElement {
|
|
27
27
|
return (
|
|
28
28
|
<div
|
|
29
|
-
className={
|
|
29
|
+
className={ clsx( 'jetpack-ai-status-indicator__icon-wrapper', {
|
|
30
30
|
[ `is-${ state }` ]: true,
|
|
31
31
|
} ) }
|
|
32
32
|
>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ExternalLink, Button } from '@wordpress/components';
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { Icon, check, arrowRight } from '@wordpress/icons';
|
|
7
|
-
import
|
|
7
|
+
import clsx from 'clsx';
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
@@ -78,7 +78,7 @@ export default function Message( {
|
|
|
78
78
|
}: MessageProps ): React.ReactElement {
|
|
79
79
|
return (
|
|
80
80
|
<div
|
|
81
|
-
className={
|
|
81
|
+
className={ clsx(
|
|
82
82
|
'jetpack-ai-assistant__message',
|
|
83
83
|
`jetpack-ai-assistant__message-severity-${ severity }`
|
|
84
84
|
) }
|
|
@@ -154,9 +154,9 @@ const getStableDiffusionImageGenerationPrompt = async (
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
const useImageGenerator = () => {
|
|
157
|
-
const executeImageGeneration = async function (
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
const executeImageGeneration = async function (
|
|
158
|
+
parameters: object
|
|
159
|
+
): Promise< ImageGenerationResponse > {
|
|
160
160
|
let token = '';
|
|
161
161
|
|
|
162
162
|
try {
|
|
@@ -259,6 +259,7 @@ const useImageGenerator = () => {
|
|
|
259
259
|
return {
|
|
260
260
|
generateImage,
|
|
261
261
|
generateImageWithStableDiffusion,
|
|
262
|
+
generateImageWithParameters: executeImageGeneration,
|
|
262
263
|
};
|
|
263
264
|
};
|
|
264
265
|
|