@automattic/jetpack-ai-client 0.33.0 → 0.33.2
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 +11 -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 +26 -27
- 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
|
@@ -25,11 +25,11 @@ import './logo-presenter.scss';
|
|
|
25
25
|
*/
|
|
26
26
|
import type { Logo } from '../store/types.ts';
|
|
27
27
|
import type { LogoPresenterProps } from '../types.ts';
|
|
28
|
-
import type
|
|
28
|
+
import type { FC, ReactNode } from 'react';
|
|
29
29
|
|
|
30
30
|
const debug = debugFactory( 'jetpack-ai-calypso:logo-presenter' );
|
|
31
31
|
|
|
32
|
-
const SaveInLibraryButton:
|
|
32
|
+
const SaveInLibraryButton: FC< { siteId: string } > = ( { siteId } ) => {
|
|
33
33
|
const { tracks } = useAnalytics();
|
|
34
34
|
const { recordEvent: recordTracksEvent } = tracks;
|
|
35
35
|
const {
|
|
@@ -87,9 +87,7 @@ const SaveInLibraryButton: React.FC< { siteId: string } > = ( { siteId } ) => {
|
|
|
87
87
|
);
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
const UseOnSiteButton:
|
|
91
|
-
onApplyLogo,
|
|
92
|
-
} ) => {
|
|
90
|
+
const UseOnSiteButton: FC< { onApplyLogo: ( mediaId: number ) => void } > = ( { onApplyLogo } ) => {
|
|
93
91
|
const { tracks } = useAnalytics();
|
|
94
92
|
const { recordEvent: recordTracksEvent } = tracks;
|
|
95
93
|
const { isSavingLogoToLibrary, selectedLogo, logos, selectedLogoIndex, context } =
|
|
@@ -120,7 +118,7 @@ const UseOnSiteButton: React.FC< { onApplyLogo: ( mediaId: number ) => void } >
|
|
|
120
118
|
);
|
|
121
119
|
};
|
|
122
120
|
|
|
123
|
-
const LogoLoading:
|
|
121
|
+
const LogoLoading: FC = () => {
|
|
124
122
|
return (
|
|
125
123
|
<>
|
|
126
124
|
<ImageLoader className="jetpack-ai-logo-generator-modal-presenter__logo" />
|
|
@@ -131,7 +129,7 @@ const LogoLoading: React.FC = () => {
|
|
|
131
129
|
);
|
|
132
130
|
};
|
|
133
131
|
|
|
134
|
-
const LogoFetching:
|
|
132
|
+
const LogoFetching: FC = () => {
|
|
135
133
|
return (
|
|
136
134
|
<>
|
|
137
135
|
<ImageLoader className="jetpack-ai-logo-generator-modal-presenter__logo" />
|
|
@@ -142,7 +140,7 @@ const LogoFetching: React.FC = () => {
|
|
|
142
140
|
);
|
|
143
141
|
};
|
|
144
142
|
|
|
145
|
-
const LogoEmpty:
|
|
143
|
+
const LogoEmpty: FC = () => {
|
|
146
144
|
return (
|
|
147
145
|
<>
|
|
148
146
|
<div style={ { width: 0, height: '229px' } }></div>
|
|
@@ -153,7 +151,7 @@ const LogoEmpty: React.FC = () => {
|
|
|
153
151
|
);
|
|
154
152
|
};
|
|
155
153
|
|
|
156
|
-
const RateLogo:
|
|
154
|
+
const RateLogo: FC< {
|
|
157
155
|
disabled: boolean;
|
|
158
156
|
ratedItem: string;
|
|
159
157
|
onRate: ( rating: string ) => void;
|
|
@@ -181,7 +179,7 @@ const RateLogo: React.FC< {
|
|
|
181
179
|
);
|
|
182
180
|
};
|
|
183
181
|
|
|
184
|
-
const LogoReady:
|
|
182
|
+
const LogoReady: FC< {
|
|
185
183
|
siteId: string;
|
|
186
184
|
logo: Logo;
|
|
187
185
|
onApplyLogo: ( mediaId: number ) => void;
|
|
@@ -218,7 +216,7 @@ const LogoReady: React.FC< {
|
|
|
218
216
|
);
|
|
219
217
|
};
|
|
220
218
|
|
|
221
|
-
const LogoUpdated:
|
|
219
|
+
const LogoUpdated: FC< { logo: Logo } > = ( { logo } ) => {
|
|
222
220
|
return (
|
|
223
221
|
<>
|
|
224
222
|
<img
|
|
@@ -234,7 +232,7 @@ const LogoUpdated: React.FC< { logo: Logo } > = ( { logo } ) => {
|
|
|
234
232
|
);
|
|
235
233
|
};
|
|
236
234
|
|
|
237
|
-
export const LogoPresenter:
|
|
235
|
+
export const LogoPresenter: FC< LogoPresenterProps > = ( {
|
|
238
236
|
logo = null,
|
|
239
237
|
loading = false,
|
|
240
238
|
onApplyLogo,
|
|
@@ -244,7 +242,7 @@ export const LogoPresenter: React.FC< LogoPresenterProps > = ( {
|
|
|
244
242
|
const { isRequestingImage } = useLogoGenerator();
|
|
245
243
|
const { saveToLibraryError, logoUpdateError } = useRequestErrors();
|
|
246
244
|
|
|
247
|
-
let logoContent:
|
|
245
|
+
let logoContent: ReactNode;
|
|
248
246
|
|
|
249
247
|
if ( ! logo && ! isRequestingImage ) {
|
|
250
248
|
logoContent = <LogoEmpty />;
|
|
@@ -30,6 +30,7 @@ import './prompt.scss';
|
|
|
30
30
|
* Types
|
|
31
31
|
*/
|
|
32
32
|
import type { ImageStyle, ImageStyleObject } from '../../hooks/use-image-generator/constants.ts';
|
|
33
|
+
import type { ChangeEvent, ClipboardEvent, KeyboardEvent } from 'react';
|
|
33
34
|
|
|
34
35
|
const debug = debugFactory( 'jetpack-ai-calypso:prompt-box' );
|
|
35
36
|
|
|
@@ -56,11 +57,11 @@ export const AiModalPromptInput = ( {
|
|
|
56
57
|
} ) => {
|
|
57
58
|
const inputRef = useRef< HTMLDivElement | null >( null );
|
|
58
59
|
|
|
59
|
-
const onPromptInput = ( event:
|
|
60
|
+
const onPromptInput = ( event: ChangeEvent< HTMLInputElement > ) => {
|
|
60
61
|
setPrompt( event.target.textContent || '' );
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
const onPromptPaste = ( event:
|
|
64
|
+
const onPromptPaste = ( event: ClipboardEvent< HTMLInputElement > ) => {
|
|
64
65
|
event.preventDefault();
|
|
65
66
|
|
|
66
67
|
const selection = event.currentTarget.ownerDocument.getSelection();
|
|
@@ -79,7 +80,7 @@ export const AiModalPromptInput = ( {
|
|
|
79
80
|
setPrompt( inputRef.current?.textContent || '' );
|
|
80
81
|
};
|
|
81
82
|
|
|
82
|
-
const onKeyDown = ( event:
|
|
83
|
+
const onKeyDown = ( event: KeyboardEvent ) => {
|
|
83
84
|
if ( event.key === 'Enter' ) {
|
|
84
85
|
event.preventDefault();
|
|
85
86
|
generateHandler();
|
|
@@ -13,9 +13,9 @@ import useLogoGenerator from '../hooks/use-logo-generator.ts';
|
|
|
13
13
|
/**
|
|
14
14
|
* Types
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import type { FC } from 'react';
|
|
17
17
|
|
|
18
|
-
export const UpgradeScreen:
|
|
18
|
+
export const UpgradeScreen: FC< {
|
|
19
19
|
onCancel: () => void;
|
|
20
20
|
upgradeURL: string;
|
|
21
21
|
reason: 'feature' | 'requests';
|
|
@@ -13,9 +13,9 @@ import './visit-site-banner.scss';
|
|
|
13
13
|
/**
|
|
14
14
|
* Types
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import type { FC } from 'react';
|
|
17
17
|
|
|
18
|
-
export const VisitSiteBanner:
|
|
18
|
+
export const VisitSiteBanner: FC< {
|
|
19
19
|
className?: string;
|
|
20
20
|
onVisitBlankTarget?: () => void;
|
|
21
21
|
} > = ( { className = null, onVisitBlankTarget } ) => {
|