@automattic/jetpack-ai-client 0.33.0 → 0.33.1
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 +6 -0
- package/build/chrome-ai/get-availability.js +1 -1
- package/build/components/ai-control/ai-control.d.ts +2 -3
- package/build/components/ai-control/block-ai-control.d.ts +5 -6
- package/build/components/ai-control/block-ai-control.js +2 -2
- package/build/components/ai-control/extension-ai-control.d.ts +5 -6
- package/build/components/ai-control/extension-ai-control.js +1 -1
- package/build/components/ai-feedback/index.d.ts +3 -3
- package/build/components/ai-feedback/index.js +1 -1
- package/build/components/ai-icon/index.d.ts +1 -1
- package/build/components/ai-icon/index.js +1 -4
- package/build/components/ai-image/components/ai-image-modal.d.ts +3 -5
- package/build/components/ai-image/components/ai-image-modal.js +1 -7
- package/build/components/ai-image/components/carrousel.d.ts +3 -2
- package/build/components/ai-image/components/carrousel.js +2 -8
- package/build/components/ai-image/components/usage-counter.d.ts +1 -4
- package/build/components/ai-image/components/usage-counter.js +1 -7
- package/build/components/ai-image/featured-image.d.ts +1 -4
- package/build/components/ai-image/featured-image.js +1 -7
- package/build/components/ai-image/general-purpose-image.d.ts +1 -4
- package/build/components/ai-image/general-purpose-image.js +1 -7
- package/build/components/ai-image/hooks/use-ai-image.d.ts +2 -3
- package/build/components/ai-modal-footer/index.d.ts +3 -3
- package/build/components/ai-modal-footer/index.js +1 -1
- package/build/components/ai-status-indicator/index.d.ts +3 -3
- package/build/components/ai-status-indicator/index.js +1 -1
- package/build/components/audio-duration-display/index.d.ts +3 -3
- package/build/components/audio-duration-display/index.js +1 -1
- package/build/components/message/index.d.ts +14 -14
- package/build/components/message/index.js +6 -6
- package/build/components/modal/index.d.ts +3 -2
- package/build/components/modal/index.js +1 -7
- package/build/data-flow/context.d.ts +5 -8
- package/build/data-flow/context.js +1 -1
- package/build/data-flow/with-ai-assistant-data.d.ts +4 -4
- package/build/data-flow/with-ai-assistant-data.js +2 -2
- package/build/logo-generator/components/feature-fetch-failure-screen.d.ts +2 -2
- package/build/logo-generator/components/first-load-screen.d.ts +2 -2
- package/build/logo-generator/components/generator-modal.d.ts +2 -2
- package/build/logo-generator/components/history-carousel.d.ts +2 -2
- package/build/logo-generator/components/image-loader.d.ts +2 -2
- package/build/logo-generator/components/logo-presenter.d.ts +2 -2
- package/build/logo-generator/components/logo-presenter.js +1 -1
- package/build/logo-generator/components/upgrade-screen.d.ts +2 -2
- package/build/logo-generator/components/visit-site-banner.d.ts +2 -2
- package/package.json +19 -19
- package/src/chrome-ai/get-availability.ts +1 -1
- package/src/components/ai-control/ai-control.tsx +2 -3
- package/src/components/ai-control/block-ai-control.tsx +5 -5
- package/src/components/ai-control/extension-ai-control.tsx +5 -5
- package/src/components/ai-feedback/index.tsx +3 -3
- package/src/components/ai-icon/index.tsx +2 -4
- package/src/components/ai-image/components/ai-image-modal.tsx +3 -8
- package/src/components/ai-image/components/carrousel.tsx +5 -10
- package/src/components/ai-image/components/usage-counter.tsx +2 -7
- package/src/components/ai-image/featured-image.tsx +2 -7
- package/src/components/ai-image/general-purpose-image.tsx +2 -7
- package/src/components/ai-image/hooks/use-ai-image.ts +2 -2
- package/src/components/ai-modal-footer/index.tsx +3 -3
- package/src/components/ai-status-indicator/index.tsx +3 -3
- package/src/components/audio-duration-display/index.tsx +3 -3
- package/src/components/message/index.tsx +16 -16
- package/src/components/modal/index.tsx +3 -8
- package/src/data-flow/Readme.md +2 -2
- package/src/data-flow/context.tsx +5 -4
- package/src/data-flow/with-ai-assistant-data.tsx +38 -41
- package/src/icons/ai-assistant.tsx +0 -1
- package/src/icons/mic.tsx +0 -1
- package/src/icons/origami-plane.tsx +0 -1
- package/src/icons/player-pause.tsx +0 -1
- package/src/icons/player-play.tsx +0 -1
- package/src/icons/player-stop.tsx +0 -1
- package/src/icons/speak-tone.tsx +0 -1
- package/src/logo-generator/components/feature-fetch-failure-screen.tsx +2 -2
- package/src/logo-generator/components/first-load-screen.tsx +2 -2
- package/src/logo-generator/components/generator-modal.tsx +3 -3
- package/src/logo-generator/components/history-carousel.tsx +2 -2
- package/src/logo-generator/components/image-loader.tsx +2 -2
- package/src/logo-generator/components/logo-presenter.tsx +11 -13
- package/src/logo-generator/components/prompt.tsx +4 -3
- package/src/logo-generator/components/upgrade-screen.tsx +2 -2
- package/src/logo-generator/components/visit-site-banner.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ 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.33.1] - 2025-07-07
|
|
9
|
+
### Changed
|
|
10
|
+
- Jetpack AI: Change Chrome AI experiment name to v2. [#44135]
|
|
11
|
+
- Update package dependencies. [#44148]
|
|
12
|
+
|
|
8
13
|
## [0.33.0] - 2025-06-30
|
|
9
14
|
### Changed
|
|
10
15
|
- Create custom explat client with public-api fetch for assignments. [#44081]
|
|
@@ -654,6 +659,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
654
659
|
- AI Client: stop using smart document visibility handling on the fetchEventSource library, so it does not restart the completion when changing tabs. [#32004]
|
|
655
660
|
- Updated package dependencies. [#31468] [#31659] [#31785]
|
|
656
661
|
|
|
662
|
+
[0.33.1]: https://github.com/Automattic/jetpack-ai-client/compare/v0.33.0...v0.33.1
|
|
657
663
|
[0.33.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.32.1...v0.33.0
|
|
658
664
|
[0.32.1]: https://github.com/Automattic/jetpack-ai-client/compare/v0.32.0...v0.32.1
|
|
659
665
|
[0.32.0]: https://github.com/Automattic/jetpack-ai-client/compare/v0.31.2...v0.32.0
|
|
@@ -60,7 +60,7 @@ export async function isChromeAIAvailable() {
|
|
|
60
60
|
logError: debug,
|
|
61
61
|
isDevelopmentMode: false,
|
|
62
62
|
});
|
|
63
|
-
const { variationName } = await loadExperimentAssignmentWithAuth('
|
|
63
|
+
const { variationName } = await loadExperimentAssignmentWithAuth('calypso_jetpack_ai_gemini_api_202503_v2');
|
|
64
64
|
debug('variationName', variationName);
|
|
65
65
|
return variationName === 'treatment';
|
|
66
66
|
}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { PlainText } from '@wordpress/block-editor';
|
|
5
|
-
import React from 'react';
|
|
6
5
|
import './style.scss';
|
|
7
6
|
/**
|
|
8
7
|
* Types
|
|
9
8
|
*/
|
|
10
9
|
import type { RequestingStateProp } from '../../types.ts';
|
|
11
|
-
import type { ReactElement } from 'react';
|
|
10
|
+
import type { MutableRefObject, ReactElement } from 'react';
|
|
12
11
|
type AIControlProps = {
|
|
13
12
|
className?: string;
|
|
14
13
|
disabled?: boolean;
|
|
@@ -22,7 +21,7 @@ type AIControlProps = {
|
|
|
22
21
|
actions?: ReactElement;
|
|
23
22
|
message?: ReactElement;
|
|
24
23
|
promptUserInputRef?: PlainText.Props['ref'];
|
|
25
|
-
wrapperRef?:
|
|
24
|
+
wrapperRef?: MutableRefObject<HTMLDivElement | null>;
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
27
|
* Base AIControl component. Contains the main structure of the control component and slots for banner, error, actions and message.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './style.scss';
|
|
3
2
|
/**
|
|
4
3
|
* Types
|
|
5
4
|
*/
|
|
6
5
|
import type { RequestingStateProp } from '../../types.ts';
|
|
7
|
-
import type { ReactElement } from 'react';
|
|
6
|
+
import type { MutableRefObject, ReactElement } from 'react';
|
|
8
7
|
type BlockAIControlProps = {
|
|
9
8
|
disabled?: boolean;
|
|
10
9
|
value: string;
|
|
@@ -29,10 +28,10 @@ type BlockAIControlProps = {
|
|
|
29
28
|
/**
|
|
30
29
|
* BlockAIControl component. Used by the AI Assistant block, adding logic and components to the base AIControl component.
|
|
31
30
|
*
|
|
32
|
-
* @param {BlockAIControlProps}
|
|
33
|
-
* @param {
|
|
31
|
+
* @param {BlockAIControlProps} props - Component props
|
|
32
|
+
* @param {MutableRefObject} ref - Ref to the component
|
|
34
33
|
* @return {ReactElement} Rendered component
|
|
35
34
|
*/
|
|
36
|
-
export declare function BlockAIControl({ disabled, value, placeholder, showAccept, acceptLabel, showButtonLabels, isTransparent, state, showGuideLine, customFooter, onChange, onSend, onStop, onAccept, onDiscard, showRemove, banner, error, lastAction, }: BlockAIControlProps, ref:
|
|
37
|
-
declare const _default:
|
|
35
|
+
export declare function BlockAIControl({ disabled, value, placeholder, showAccept, acceptLabel, showButtonLabels, isTransparent, state, showGuideLine, customFooter, onChange, onSend, onStop, onAccept, onDiscard, showRemove, banner, error, lastAction, }: BlockAIControlProps, ref: MutableRefObject<HTMLInputElement>): ReactElement;
|
|
36
|
+
declare const _default: import("react").ForwardRefExoticComponent<BlockAIControlProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
38
37
|
export default _default;
|
|
@@ -19,8 +19,8 @@ const debug = debugFactory('jetpack-ai-client:block-ai-control');
|
|
|
19
19
|
/**
|
|
20
20
|
* BlockAIControl component. Used by the AI Assistant block, adding logic and components to the base AIControl component.
|
|
21
21
|
*
|
|
22
|
-
* @param {BlockAIControlProps}
|
|
23
|
-
* @param {
|
|
22
|
+
* @param {BlockAIControlProps} props - Component props
|
|
23
|
+
* @param {MutableRefObject} ref - Ref to the component
|
|
24
24
|
* @return {ReactElement} Rendered component
|
|
25
25
|
*/
|
|
26
26
|
export function BlockAIControl({ disabled = false, value = '', placeholder = '', showAccept = false, acceptLabel = __('Accept', 'jetpack-ai-client'), showButtonLabels = true, isTransparent = false, state = 'init', showGuideLine = false, customFooter = null, onChange, onSend, onStop, onAccept, onDiscard, showRemove = false, banner = null, error = null, lastAction, }, ref) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './style.scss';
|
|
3
2
|
/**
|
|
4
3
|
* Types
|
|
5
4
|
*/
|
|
6
5
|
import type { RequestingErrorProps, RequestingStateProp } from '../../types.ts';
|
|
7
|
-
import type { ReactElement, MouseEvent } from 'react';
|
|
6
|
+
import type { MutableRefObject, ReactElement, MouseEvent } from 'react';
|
|
8
7
|
type ExtensionAIControlProps = {
|
|
9
8
|
className?: string;
|
|
10
9
|
disabled?: boolean;
|
|
@@ -19,7 +18,7 @@ type ExtensionAIControlProps = {
|
|
|
19
18
|
showUpgradeMessage?: boolean;
|
|
20
19
|
showFairUsageMessage?: boolean;
|
|
21
20
|
upgradeUrl?: string;
|
|
22
|
-
wrapperRef?:
|
|
21
|
+
wrapperRef?: MutableRefObject<HTMLDivElement | null>;
|
|
23
22
|
onChange?: (newValue: string) => void;
|
|
24
23
|
onSend?: (currentValue: string) => void;
|
|
25
24
|
onStop?: () => void;
|
|
@@ -34,9 +33,9 @@ type ExtensionAIControlProps = {
|
|
|
34
33
|
* ExtensionAIControl component. Used by the AI Assistant inline extensions, adding logic and components to the base AIControl component.
|
|
35
34
|
*
|
|
36
35
|
* @param {ExtensionAIControlProps} props - Component props
|
|
37
|
-
* @param {
|
|
36
|
+
* @param {MutableRefObject} ref - Ref to the component
|
|
38
37
|
* @return {ReactElement} Rendered component
|
|
39
38
|
*/
|
|
40
|
-
export declare function ExtensionAIControl({ className, disabled, value, placeholder, showButtonLabels, isTransparent, state, showGuideLine, error, requestsRemaining, showUpgradeMessage, showFairUsageMessage, upgradeUrl, wrapperRef, onChange, onSend, onStop, onClose, onUndo, onUpgrade, onTryAgain, lastAction, blockType, }: ExtensionAIControlProps, ref:
|
|
41
|
-
declare const _default:
|
|
39
|
+
export declare function ExtensionAIControl({ className, disabled, value, placeholder, showButtonLabels, isTransparent, state, showGuideLine, error, requestsRemaining, showUpgradeMessage, showFairUsageMessage, upgradeUrl, wrapperRef, onChange, onSend, onStop, onClose, onUndo, onUpgrade, onTryAgain, lastAction, blockType, }: ExtensionAIControlProps, ref: MutableRefObject<HTMLInputElement>): ReactElement;
|
|
40
|
+
declare const _default: import("react").ForwardRefExoticComponent<ExtensionAIControlProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
42
41
|
export default _default;
|
|
@@ -18,7 +18,7 @@ import './style.scss';
|
|
|
18
18
|
* ExtensionAIControl component. Used by the AI Assistant inline extensions, adding logic and components to the base AIControl component.
|
|
19
19
|
*
|
|
20
20
|
* @param {ExtensionAIControlProps} props - Component props
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {MutableRefObject} ref - Ref to the component
|
|
22
22
|
* @return {ReactElement} Rendered component
|
|
23
23
|
*/
|
|
24
24
|
export function ExtensionAIControl({ className, disabled = false, value = '', placeholder = '', showButtonLabels = true, isTransparent = false, state = 'init', showGuideLine = false, error, requestsRemaining, showUpgradeMessage = false, showFairUsageMessage = false, upgradeUrl, wrapperRef, onChange, onSend, onStop, onClose, onUndo, onUpgrade, onTryAgain, lastAction, blockType, }, ref) {
|
|
@@ -2,7 +2,7 @@ import './style.scss';
|
|
|
2
2
|
/**
|
|
3
3
|
* Types
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import type { ReactElement } from 'react';
|
|
6
6
|
type AiFeedbackThumbsProps = {
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
iconSize?: number;
|
|
@@ -21,7 +21,7 @@ type AiFeedbackThumbsProps = {
|
|
|
21
21
|
* AiFeedbackThumbs component.
|
|
22
22
|
*
|
|
23
23
|
* @param {AiFeedbackThumbsProps} props - component props.
|
|
24
|
-
* @return {
|
|
24
|
+
* @return {ReactElement} - rendered component.
|
|
25
25
|
*/
|
|
26
|
-
export default function AiFeedbackThumbs({ disabled, iconSize, ratedItem, feature, savedRatings, options, onRate, }: AiFeedbackThumbsProps):
|
|
26
|
+
export default function AiFeedbackThumbs({ disabled, iconSize, ratedItem, feature, savedRatings, options, onRate, }: AiFeedbackThumbsProps): ReactElement;
|
|
27
27
|
export {};
|
|
@@ -25,7 +25,7 @@ function getFeatureAvailability(feature) {
|
|
|
25
25
|
* AiFeedbackThumbs component.
|
|
26
26
|
*
|
|
27
27
|
* @param {AiFeedbackThumbsProps} props - component props.
|
|
28
|
-
* @return {
|
|
28
|
+
* @return {ReactElement} - rendered component.
|
|
29
29
|
*/
|
|
30
30
|
export default function AiFeedbackThumbs({ disabled = false, iconSize = 24, ratedItem = '', feature = '', savedRatings = {}, options = {}, onRate, }) {
|
|
31
31
|
if (!getFeatureAvailability('ai-response-feedback')) {
|
|
@@ -2,7 +2,7 @@ export declare const AiSVG: import("react/jsx-runtime").JSX.Element;
|
|
|
2
2
|
/**
|
|
3
3
|
* AiIcon component
|
|
4
4
|
* @param {string} className - The wrapper class name.
|
|
5
|
-
* @return {
|
|
5
|
+
* @return {ReactElement} The `AiIcon` component.
|
|
6
6
|
*/
|
|
7
7
|
export default function AiIcon({ className, size }: {
|
|
8
8
|
className?: string;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
2
|
import { G, Path, SVG, Rect } from '@wordpress/components';
|
|
6
3
|
import { Icon } from '@wordpress/icons';
|
|
7
4
|
import { Defs } from '@wordpress/primitives';
|
|
@@ -9,7 +6,7 @@ export const AiSVG = (_jsxs(SVG, { width: "42", height: "42", viewBox: "0 0 42 4
|
|
|
9
6
|
/**
|
|
10
7
|
* AiIcon component
|
|
11
8
|
* @param {string} className - The wrapper class name.
|
|
12
|
-
* @return {
|
|
9
|
+
* @return {ReactElement} The `AiIcon` component.
|
|
13
10
|
*/
|
|
14
11
|
export default function AiIcon({ className, size = 42 }) {
|
|
15
12
|
return _jsx(Icon, { icon: AiSVG, width: size, height: size, className: className });
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { ImageStyleObject, ImageStyle } from '../../../hooks/use-image-generator/constants.ts';
|
|
5
2
|
import { CarrouselImages } from './carrousel.tsx';
|
|
6
3
|
import './ai-image-modal.scss';
|
|
4
|
+
import type { JSX } from 'react';
|
|
7
5
|
type AiImageModalProps = {
|
|
8
6
|
title: string;
|
|
9
7
|
cost: number;
|
|
@@ -30,7 +28,7 @@ type AiImageModalProps = {
|
|
|
30
28
|
hasError: boolean;
|
|
31
29
|
handlePreviousImage: () => void;
|
|
32
30
|
handleNextImage: () => void;
|
|
33
|
-
acceptButton:
|
|
31
|
+
acceptButton: JSX.Element;
|
|
34
32
|
autoStart?: boolean;
|
|
35
33
|
autoStartAction?: ({ userPrompt, style }: {
|
|
36
34
|
userPrompt?: string;
|
|
@@ -49,7 +47,7 @@ type AiImageModalProps = {
|
|
|
49
47
|
/**
|
|
50
48
|
* AiImageModal component
|
|
51
49
|
* @param {AiImageModalProps} props - The component properties.
|
|
52
|
-
* @return {
|
|
50
|
+
* @return {ReactElement} - rendered component.
|
|
53
51
|
*/
|
|
54
52
|
export default function AiImageModal({ title, cost, open, images, currentIndex, onClose, onTryAgain, onGenerate, generating, notEnoughRequests, requireUpgrade, currentLimit, currentUsage, isUnlimited, upgradeDescription, hasError, handlePreviousImage, handleNextImage, acceptButton, autoStart, autoStartAction, instructionsPlaceholder, imageStyles, onGuessStyle, prompt, setPrompt, initialStyle, inputDisabled, actionDisabled, }: AiImageModalProps): import("react/jsx-runtime").JSX.Element;
|
|
55
53
|
export {};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
2
|
import { useAnalytics } from '@automattic/jetpack-shared-extension-utils';
|
|
6
3
|
import { SelectControl } from '@wordpress/components';
|
|
7
4
|
import { useCallback, useRef, useState, useEffect } from '@wordpress/element';
|
|
8
5
|
import { __ } from '@wordpress/i18n';
|
|
9
6
|
import debugFactory from 'debug';
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
7
|
import { IMAGE_STYLE_NONE, IMAGE_STYLE_AUTO, } from "../../../hooks/use-image-generator/constants.js";
|
|
14
8
|
import { AiModalPromptInput } from "../../../logo-generator/index.js";
|
|
15
9
|
import AiModalFooter from "../../ai-modal-footer/index.js";
|
|
@@ -23,7 +17,7 @@ const debug = debugFactory('jetpack-ai-client:ai-image-modal');
|
|
|
23
17
|
/**
|
|
24
18
|
* AiImageModal component
|
|
25
19
|
* @param {AiImageModalProps} props - The component properties.
|
|
26
|
-
* @return {
|
|
20
|
+
* @return {ReactElement} - rendered component.
|
|
27
21
|
*/
|
|
28
22
|
export default function AiImageModal({ title, cost, open, images, currentIndex = 0, onClose = null, onTryAgain = null, onGenerate = null, generating = false, notEnoughRequests = false, requireUpgrade = false, currentLimit = null, currentUsage = null, isUnlimited = false, upgradeDescription = null, hasError = false, handlePreviousImage = () => { }, handleNextImage = () => { }, acceptButton = null, autoStart = false, autoStartAction = null, instructionsPlaceholder = null, imageStyles = [], onGuessStyle = null, prompt = '', setPrompt = () => { }, initialStyle = null, inputDisabled = false, actionDisabled = false, }) {
|
|
29
23
|
const { tracks } = useAnalytics();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './carrousel.scss';
|
|
2
|
+
import type { JSX } from 'react';
|
|
2
3
|
export type CarrouselImageData = {
|
|
3
4
|
image?: string;
|
|
4
5
|
libraryId?: number | string;
|
|
@@ -16,12 +17,12 @@ type CarrouselProps = {
|
|
|
16
17
|
current: number;
|
|
17
18
|
handlePreviousImage: () => void;
|
|
18
19
|
handleNextImage: () => void;
|
|
19
|
-
actions?:
|
|
20
|
+
actions?: JSX.Element;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* Carrousel component
|
|
23
24
|
* @param {CarrouselProps} props - The component properties.
|
|
24
|
-
* @return {
|
|
25
|
+
* @return {ReactElement} - rendered component.
|
|
25
26
|
*/
|
|
26
27
|
export default function Carrousel({ images, current, handlePreviousImage, handleNextImage, actions, }: CarrouselProps): import("react/jsx-runtime").JSX.Element;
|
|
27
28
|
export {};
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
2
|
import { Spinner } from '@wordpress/components';
|
|
6
3
|
import { useEffect, useState } from '@wordpress/element';
|
|
7
4
|
import { __ } from '@wordpress/i18n';
|
|
8
5
|
import { Icon, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
9
6
|
import clsx from 'clsx';
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
7
|
import AiFeedbackThumbs from "../../ai-feedback/index.js";
|
|
14
8
|
import AiIcon from "../../ai-icon/index.js";
|
|
15
9
|
import './carrousel.scss';
|
|
16
10
|
/**
|
|
17
11
|
* BlankImage component
|
|
18
12
|
* @param {BlankImageProps} props - The component properties.
|
|
19
|
-
* @return {
|
|
13
|
+
* @return {ReactElement} - rendered component.
|
|
20
14
|
*/
|
|
21
15
|
function BlankImage({ children, isDotted = false, contentClassName = '' }) {
|
|
22
16
|
const blankImage = (_jsx("img", { className: "ai-assistant-image__carrousel-image", src: "data:image/svg+xml,<svg viewBox='0 0 1 1' width='1024' height='768' xmlns='http://www.w3.org/2000/svg'><path d='M0 0 L1 0 L1 1 L0 1 L0 0 Z' fill='none' /></svg>", alt: "" }));
|
|
@@ -27,7 +21,7 @@ function BlankImage({ children, isDotted = false, contentClassName = '' }) {
|
|
|
27
21
|
/**
|
|
28
22
|
* Carrousel component
|
|
29
23
|
* @param {CarrouselProps} props - The component properties.
|
|
30
|
-
* @return {
|
|
24
|
+
* @return {ReactElement} - rendered component.
|
|
31
25
|
*/
|
|
32
26
|
export default function Carrousel({ images, current, handlePreviousImage, handleNextImage, actions = null, }) {
|
|
33
27
|
const [imageFeedbackDisabled, setImageFeedbackDisabled] = useState(false);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import './usage-counter.scss';
|
|
5
2
|
type UsageCounterProps = {
|
|
6
3
|
currentLimit: number;
|
|
@@ -10,7 +7,7 @@ type UsageCounterProps = {
|
|
|
10
7
|
/**
|
|
11
8
|
* UsageCounter component
|
|
12
9
|
* @param {UsageCounterProps} props - The component properties.
|
|
13
|
-
* @return {
|
|
10
|
+
* @return {ReactElement} - rendered component.
|
|
14
11
|
*/
|
|
15
12
|
export default function UsageCounter({ currentLimit, currentUsage, cost }: UsageCounterProps): import("react/jsx-runtime").JSX.Element;
|
|
16
13
|
export {};
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
2
|
import { createInterpolateElement } from '@wordpress/element';
|
|
6
3
|
import { __, sprintf } from '@wordpress/i18n';
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
4
|
import './usage-counter.scss';
|
|
11
5
|
/**
|
|
12
6
|
* UsageCounter component
|
|
13
7
|
* @param {UsageCounterProps} props - The component properties.
|
|
14
|
-
* @return {
|
|
8
|
+
* @return {ReactElement} - rendered component.
|
|
15
9
|
*/
|
|
16
10
|
export default function UsageCounter({ currentLimit, currentUsage, cost }) {
|
|
17
11
|
const requestsBalance = currentLimit - currentUsage;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import './style.scss';
|
|
5
2
|
type FeaturedImageProps = {
|
|
6
3
|
busy: boolean;
|
|
@@ -11,7 +8,7 @@ type FeaturedImageProps = {
|
|
|
11
8
|
/**
|
|
12
9
|
* FeaturedImage component
|
|
13
10
|
* @param {FeaturedImageProps} props - The component properties.
|
|
14
|
-
* @return {
|
|
11
|
+
* @return {ReactElement} - rendered component.
|
|
15
12
|
*/
|
|
16
13
|
export default function FeaturedImage({ busy, disabled, placement, onClose, }: FeaturedImageProps): import("react/jsx-runtime").JSX.Element;
|
|
17
14
|
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
2
|
import { useAnalytics, PLAN_TYPE_UNLIMITED, usePlanType, } from '@automattic/jetpack-shared-extension-utils';
|
|
6
3
|
import { Button } from '@wordpress/components';
|
|
7
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -9,9 +6,6 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
9
6
|
import { useCallback, useState } from '@wordpress/element';
|
|
10
7
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
8
|
import debugFactory from 'debug';
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
9
|
import './style.scss';
|
|
16
10
|
import { PLACEMENT_JETPACK_SIDEBAR, PLACEMENT_DOCUMENT_SETTINGS } from "../../constants.js";
|
|
17
11
|
import useAiFeature from "../../hooks/use-ai-feature/index.js";
|
|
@@ -25,7 +19,7 @@ const debug = debugFactory('jetpack-ai-client:featured-image');
|
|
|
25
19
|
/**
|
|
26
20
|
* FeaturedImage component
|
|
27
21
|
* @param {FeaturedImageProps} props - The component properties.
|
|
28
|
-
* @return {
|
|
22
|
+
* @return {ReactElement} - rendered component.
|
|
29
23
|
*/
|
|
30
24
|
export default function FeaturedImage({ busy, disabled, placement, onClose = () => { }, }) {
|
|
31
25
|
const [isFeaturedImageModalVisible, setIsFeaturedImageModalVisible] = useState(placement === PLACEMENT_MEDIA_SOURCE_DROPDOWN);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import './style.scss';
|
|
5
2
|
/**
|
|
6
3
|
* The type for the callback function that is called when the user selects an image.
|
|
@@ -17,7 +14,7 @@ type GeneralPurposeImageProps = {
|
|
|
17
14
|
/**
|
|
18
15
|
* GeneralPurposeImage component
|
|
19
16
|
* @param {GeneralPurposeImageProps} props - The component properties.
|
|
20
|
-
* @return {
|
|
17
|
+
* @return {ReactElement} - rendered component.
|
|
21
18
|
*/
|
|
22
19
|
export default function GeneralPurposeImage({ placement, onClose, onSetImage, }: GeneralPurposeImageProps): import("react/jsx-runtime").JSX.Element;
|
|
23
20
|
export {};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
2
|
import { useAnalytics, PLAN_TYPE_UNLIMITED, usePlanType, } from '@automattic/jetpack-shared-extension-utils';
|
|
6
3
|
import { Button } from '@wordpress/components';
|
|
7
4
|
import { useCallback, useState } from '@wordpress/element';
|
|
8
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
6
|
import debugFactory from 'debug';
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
7
|
import './style.scss';
|
|
14
8
|
import useAiFeature from "../../hooks/use-ai-feature/index.js";
|
|
15
9
|
import usePostContent from "../../hooks/use-post-content.js";
|
|
@@ -22,7 +16,7 @@ const debug = debugFactory('jetpack-ai:general-purpose-image');
|
|
|
22
16
|
/**
|
|
23
17
|
* GeneralPurposeImage component
|
|
24
18
|
* @param {GeneralPurposeImageProps} props - The component properties.
|
|
25
|
-
* @return {
|
|
19
|
+
* @return {ReactElement} - rendered component.
|
|
26
20
|
*/
|
|
27
21
|
export default function GeneralPurposeImage({ placement, onClose = () => { }, onSetImage = () => { }, }) {
|
|
28
22
|
const [isFeaturedImageModalVisible, setIsFeaturedImageModalVisible] = useState(true);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ImageStyleObject, ImageStyle } from '../../../hooks/use-image-generator/constants.ts';
|
|
3
2
|
/**
|
|
4
3
|
* Types
|
|
@@ -34,14 +33,14 @@ type UseAiImageProps = {
|
|
|
34
33
|
*/
|
|
35
34
|
export default function useAiImage({ feature, type, cost, autoStart, previousMediaId, }: UseAiImageProps): {
|
|
36
35
|
current: number;
|
|
37
|
-
setCurrent:
|
|
36
|
+
setCurrent: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
38
37
|
processImageGeneration: ({ userPrompt, postContent, notEnoughRequests, style, }: ProcessImageGenerationProps) => Promise<ImageResponse>;
|
|
39
38
|
handlePreviousImage: () => void;
|
|
40
39
|
handleNextImage: () => void;
|
|
41
40
|
currentImage: CarrouselImageData;
|
|
42
41
|
currentPointer: CarrouselImageData;
|
|
43
42
|
images: CarrouselImages;
|
|
44
|
-
pointer:
|
|
43
|
+
pointer: import("react").MutableRefObject<number>;
|
|
45
44
|
imageStyles: ImageStyleObject[];
|
|
46
45
|
guessStyle: (prompt: string, requestType?: string, content?: string) => Promise<ImageStyle | null>;
|
|
47
46
|
};
|
|
@@ -5,7 +5,7 @@ import './style.scss';
|
|
|
5
5
|
/**
|
|
6
6
|
* Types
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import type { ReactElement } from 'react';
|
|
9
9
|
type AiModalFooterProps = {
|
|
10
10
|
onGuidelinesClick?: () => void;
|
|
11
11
|
onFeedbackClick?: () => void;
|
|
@@ -14,7 +14,7 @@ type AiModalFooterProps = {
|
|
|
14
14
|
* AiModalFooter component.
|
|
15
15
|
*
|
|
16
16
|
* @param {AiModalFooterProps} props - component props.
|
|
17
|
-
* @return {
|
|
17
|
+
* @return {ReactElement} - rendered component.
|
|
18
18
|
*/
|
|
19
|
-
export default function AiModalFooter({ onGuidelinesClick, onFeedbackClick, }: AiModalFooterProps):
|
|
19
|
+
export default function AiModalFooter({ onGuidelinesClick, onFeedbackClick, }: AiModalFooterProps): ReactElement;
|
|
20
20
|
export {};
|
|
@@ -14,7 +14,7 @@ import './style.scss';
|
|
|
14
14
|
* AiModalFooter component.
|
|
15
15
|
*
|
|
16
16
|
* @param {AiModalFooterProps} props - component props.
|
|
17
|
-
* @return {
|
|
17
|
+
* @return {ReactElement} - rendered component.
|
|
18
18
|
*/
|
|
19
19
|
export default function AiModalFooter({ onGuidelinesClick, onFeedbackClick, }) {
|
|
20
20
|
const handleGuidelinesClick = useCallback(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RequestingStateProp } from '../../types.ts';
|
|
2
2
|
export type AiStatusIndicatorIconSize = 24 | 32 | 48 | 64;
|
|
3
|
-
import type
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
4
4
|
import './style.scss';
|
|
5
5
|
export type AiStatusIndicatorProps = {
|
|
6
6
|
state?: RequestingStateProp;
|
|
@@ -10,6 +10,6 @@ export type AiStatusIndicatorProps = {
|
|
|
10
10
|
* AiStatusIndicator component.
|
|
11
11
|
*
|
|
12
12
|
* @param {AiStatusIndicatorProps} props - component props.
|
|
13
|
-
* @return {
|
|
13
|
+
* @return {ReactElement} - rendered component.
|
|
14
14
|
*/
|
|
15
|
-
export default function AiStatusIndicator({ state }: AiStatusIndicatorProps):
|
|
15
|
+
export default function AiStatusIndicator({ state }: AiStatusIndicatorProps): ReactElement;
|
|
@@ -9,7 +9,7 @@ import './style.scss';
|
|
|
9
9
|
* AiStatusIndicator component.
|
|
10
10
|
*
|
|
11
11
|
* @param {AiStatusIndicatorProps} props - component props.
|
|
12
|
-
* @return {
|
|
12
|
+
* @return {ReactElement} - rendered component.
|
|
13
13
|
*/
|
|
14
14
|
export default function AiStatusIndicator({ state }) {
|
|
15
15
|
return (_jsx("div", { className: clsx('jetpack-ai-status-indicator__icon-wrapper', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
2
|
type AudioDurationDisplayProps = {
|
|
3
3
|
duration: number;
|
|
4
4
|
className?: string | null;
|
|
@@ -7,7 +7,7 @@ type AudioDurationDisplayProps = {
|
|
|
7
7
|
* AudioDurationDisplay component.
|
|
8
8
|
*
|
|
9
9
|
* @param {AudioDurationDisplayProps} props - Component props.
|
|
10
|
-
* @return {
|
|
10
|
+
* @return {ReactElement} Rendered component.
|
|
11
11
|
*/
|
|
12
|
-
export default function AudioDurationDisplay({ duration, className, }: AudioDurationDisplayProps):
|
|
12
|
+
export default function AudioDurationDisplay({ duration, className, }: AudioDurationDisplayProps): ReactElement;
|
|
13
13
|
export {};
|
|
@@ -7,7 +7,7 @@ import { formatTime } from "./lib/media.js";
|
|
|
7
7
|
* AudioDurationDisplay component.
|
|
8
8
|
*
|
|
9
9
|
* @param {AudioDurationDisplayProps} props - Component props.
|
|
10
|
-
* @return {
|
|
10
|
+
* @return {ReactElement} Rendered component.
|
|
11
11
|
*/
|
|
12
12
|
export default function AudioDurationDisplay({ duration, className, }) {
|
|
13
13
|
return _jsx("span", { className: className, children: formatTime(duration, { addDecimalPart: false }) });
|
|
@@ -6,7 +6,7 @@ import './style.scss';
|
|
|
6
6
|
* Types
|
|
7
7
|
*/
|
|
8
8
|
import type { SuggestionErrorCode } from '../../types.ts';
|
|
9
|
-
import type
|
|
9
|
+
import type { MouseEvent, ReactElement, ReactNode } from 'react';
|
|
10
10
|
export declare const MESSAGE_SEVERITY_WARNING = "warning";
|
|
11
11
|
export declare const MESSAGE_SEVERITY_ERROR = "error";
|
|
12
12
|
export declare const MESSAGE_SEVERITY_SUCCESS = "success";
|
|
@@ -20,15 +20,15 @@ type AiFeedbackThumbsOptions = {
|
|
|
20
20
|
onRate?: (rating: string) => void;
|
|
21
21
|
};
|
|
22
22
|
export type MessageProps = {
|
|
23
|
-
icon?:
|
|
23
|
+
icon?: ReactNode;
|
|
24
24
|
severity?: MessageSeverityProp;
|
|
25
25
|
aiFeedbackThumbsOptions?: AiFeedbackThumbsOptions;
|
|
26
|
-
children:
|
|
26
|
+
children: ReactNode;
|
|
27
27
|
};
|
|
28
28
|
export type GuidelineMessageProps = {
|
|
29
29
|
aiFeedbackThumbsOptions?: AiFeedbackThumbsOptions;
|
|
30
30
|
};
|
|
31
|
-
export type OnUpgradeClick = (event?:
|
|
31
|
+
export type OnUpgradeClick = (event?: MouseEvent<HTMLButtonElement>) => void;
|
|
32
32
|
export type UpgradeMessageProps = {
|
|
33
33
|
requestsRemaining: number;
|
|
34
34
|
severity?: MessageSeverityProp;
|
|
@@ -46,34 +46,34 @@ export type ErrorMessageProps = {
|
|
|
46
46
|
* React component to render a block message.
|
|
47
47
|
*
|
|
48
48
|
* @param {MessageProps} props - Component props.
|
|
49
|
-
* @return {
|
|
49
|
+
* @return {ReactElement} Banner component.
|
|
50
50
|
*/
|
|
51
|
-
export default function Message({ severity, icon, aiFeedbackThumbsOptions, children, }: MessageProps):
|
|
51
|
+
export default function Message({ severity, icon, aiFeedbackThumbsOptions, children, }: MessageProps): ReactElement;
|
|
52
52
|
/**
|
|
53
53
|
* React component to render a guideline message.
|
|
54
54
|
*
|
|
55
55
|
* @param {GuidelineMessageProps} props - Component props.
|
|
56
|
-
* @return {
|
|
56
|
+
* @return {ReactElement} - Message component.
|
|
57
57
|
*/
|
|
58
|
-
export declare function GuidelineMessage({ aiFeedbackThumbsOptions, }: GuidelineMessageProps):
|
|
58
|
+
export declare function GuidelineMessage({ aiFeedbackThumbsOptions, }: GuidelineMessageProps): ReactElement;
|
|
59
59
|
/**
|
|
60
60
|
* React component to render a fair usage limit message.
|
|
61
61
|
*
|
|
62
|
-
* @return {
|
|
62
|
+
* @return {ReactElement} - Message component.
|
|
63
63
|
*/
|
|
64
|
-
export declare function FairUsageLimitMessage():
|
|
64
|
+
export declare function FairUsageLimitMessage(): ReactElement;
|
|
65
65
|
/**
|
|
66
66
|
* React component to render an upgrade message for free tier users
|
|
67
67
|
*
|
|
68
68
|
* @param {number} requestsRemaining - Number of requests remaining.
|
|
69
|
-
* @return {
|
|
69
|
+
* @return {ReactElement} - Message component.
|
|
70
70
|
*/
|
|
71
|
-
export declare function UpgradeMessage({ requestsRemaining, severity, onUpgradeClick, upgradeUrl, }: UpgradeMessageProps):
|
|
71
|
+
export declare function UpgradeMessage({ requestsRemaining, severity, onUpgradeClick, upgradeUrl, }: UpgradeMessageProps): ReactElement;
|
|
72
72
|
/**
|
|
73
73
|
* React component to render an error message
|
|
74
74
|
*
|
|
75
75
|
* @param {number} requestsRemaining - Number of requests remaining.
|
|
76
|
-
* @return {
|
|
76
|
+
* @return {ReactElement} - Message component.
|
|
77
77
|
*/
|
|
78
|
-
export declare function ErrorMessage({ error, code, onTryAgainClick, onUpgradeClick, upgradeUrl, }: ErrorMessageProps):
|
|
78
|
+
export declare function ErrorMessage({ error, code, onTryAgainClick, onUpgradeClick, upgradeUrl, }: ErrorMessageProps): ReactElement;
|
|
79
79
|
export {};
|