@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.
Files changed (82) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/chrome-ai/get-availability.js +1 -1
  3. package/build/components/ai-control/ai-control.d.ts +2 -3
  4. package/build/components/ai-control/block-ai-control.d.ts +5 -6
  5. package/build/components/ai-control/block-ai-control.js +2 -2
  6. package/build/components/ai-control/extension-ai-control.d.ts +5 -6
  7. package/build/components/ai-control/extension-ai-control.js +1 -1
  8. package/build/components/ai-feedback/index.d.ts +3 -3
  9. package/build/components/ai-feedback/index.js +1 -1
  10. package/build/components/ai-icon/index.d.ts +1 -1
  11. package/build/components/ai-icon/index.js +1 -4
  12. package/build/components/ai-image/components/ai-image-modal.d.ts +3 -5
  13. package/build/components/ai-image/components/ai-image-modal.js +1 -7
  14. package/build/components/ai-image/components/carrousel.d.ts +3 -2
  15. package/build/components/ai-image/components/carrousel.js +2 -8
  16. package/build/components/ai-image/components/usage-counter.d.ts +1 -4
  17. package/build/components/ai-image/components/usage-counter.js +1 -7
  18. package/build/components/ai-image/featured-image.d.ts +1 -4
  19. package/build/components/ai-image/featured-image.js +1 -7
  20. package/build/components/ai-image/general-purpose-image.d.ts +1 -4
  21. package/build/components/ai-image/general-purpose-image.js +1 -7
  22. package/build/components/ai-image/hooks/use-ai-image.d.ts +2 -3
  23. package/build/components/ai-modal-footer/index.d.ts +3 -3
  24. package/build/components/ai-modal-footer/index.js +1 -1
  25. package/build/components/ai-status-indicator/index.d.ts +3 -3
  26. package/build/components/ai-status-indicator/index.js +1 -1
  27. package/build/components/audio-duration-display/index.d.ts +3 -3
  28. package/build/components/audio-duration-display/index.js +1 -1
  29. package/build/components/message/index.d.ts +14 -14
  30. package/build/components/message/index.js +6 -6
  31. package/build/components/modal/index.d.ts +3 -2
  32. package/build/components/modal/index.js +1 -7
  33. package/build/data-flow/context.d.ts +5 -8
  34. package/build/data-flow/context.js +1 -1
  35. package/build/data-flow/with-ai-assistant-data.d.ts +4 -4
  36. package/build/data-flow/with-ai-assistant-data.js +2 -2
  37. package/build/logo-generator/components/feature-fetch-failure-screen.d.ts +2 -2
  38. package/build/logo-generator/components/first-load-screen.d.ts +2 -2
  39. package/build/logo-generator/components/generator-modal.d.ts +2 -2
  40. package/build/logo-generator/components/history-carousel.d.ts +2 -2
  41. package/build/logo-generator/components/image-loader.d.ts +2 -2
  42. package/build/logo-generator/components/logo-presenter.d.ts +2 -2
  43. package/build/logo-generator/components/logo-presenter.js +1 -1
  44. package/build/logo-generator/components/upgrade-screen.d.ts +2 -2
  45. package/build/logo-generator/components/visit-site-banner.d.ts +2 -2
  46. package/package.json +26 -27
  47. package/src/chrome-ai/get-availability.ts +1 -1
  48. package/src/components/ai-control/ai-control.tsx +2 -3
  49. package/src/components/ai-control/block-ai-control.tsx +5 -5
  50. package/src/components/ai-control/extension-ai-control.tsx +5 -5
  51. package/src/components/ai-feedback/index.tsx +3 -3
  52. package/src/components/ai-icon/index.tsx +2 -4
  53. package/src/components/ai-image/components/ai-image-modal.tsx +3 -8
  54. package/src/components/ai-image/components/carrousel.tsx +5 -10
  55. package/src/components/ai-image/components/usage-counter.tsx +2 -7
  56. package/src/components/ai-image/featured-image.tsx +2 -7
  57. package/src/components/ai-image/general-purpose-image.tsx +2 -7
  58. package/src/components/ai-image/hooks/use-ai-image.ts +2 -2
  59. package/src/components/ai-modal-footer/index.tsx +3 -3
  60. package/src/components/ai-status-indicator/index.tsx +3 -3
  61. package/src/components/audio-duration-display/index.tsx +3 -3
  62. package/src/components/message/index.tsx +16 -16
  63. package/src/components/modal/index.tsx +3 -8
  64. package/src/data-flow/Readme.md +2 -2
  65. package/src/data-flow/context.tsx +5 -4
  66. package/src/data-flow/with-ai-assistant-data.tsx +38 -41
  67. package/src/icons/ai-assistant.tsx +0 -1
  68. package/src/icons/mic.tsx +0 -1
  69. package/src/icons/origami-plane.tsx +0 -1
  70. package/src/icons/player-pause.tsx +0 -1
  71. package/src/icons/player-play.tsx +0 -1
  72. package/src/icons/player-stop.tsx +0 -1
  73. package/src/icons/speak-tone.tsx +0 -1
  74. package/src/logo-generator/components/feature-fetch-failure-screen.tsx +2 -2
  75. package/src/logo-generator/components/first-load-screen.tsx +2 -2
  76. package/src/logo-generator/components/generator-modal.tsx +3 -3
  77. package/src/logo-generator/components/history-carousel.tsx +2 -2
  78. package/src/logo-generator/components/image-loader.tsx +2 -2
  79. package/src/logo-generator/components/logo-presenter.tsx +11 -13
  80. package/src/logo-generator/components/prompt.tsx +4 -3
  81. package/src/logo-generator/components/upgrade-screen.tsx +2 -2
  82. 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 React from 'react';
28
+ import type { FC, ReactNode } from 'react';
29
29
 
30
30
  const debug = debugFactory( 'jetpack-ai-calypso:logo-presenter' );
31
31
 
32
- const SaveInLibraryButton: React.FC< { siteId: string } > = ( { siteId } ) => {
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: React.FC< { onApplyLogo: ( mediaId: number ) => void } > = ( {
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: React.FC = () => {
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: React.FC = () => {
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: React.FC = () => {
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: React.FC< {
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: React.FC< {
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: React.FC< { logo: Logo } > = ( { logo } ) => {
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: React.FC< LogoPresenterProps > = ( {
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: React.ReactNode;
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: React.ChangeEvent< HTMLInputElement > ) => {
60
+ const onPromptInput = ( event: ChangeEvent< HTMLInputElement > ) => {
60
61
  setPrompt( event.target.textContent || '' );
61
62
  };
62
63
 
63
- const onPromptPaste = ( event: React.ClipboardEvent< HTMLInputElement > ) => {
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: React.KeyboardEvent ) => {
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 React from 'react';
16
+ import type { FC } from 'react';
17
17
 
18
- export const UpgradeScreen: React.FC< {
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 React from 'react';
16
+ import type { FC } from 'react';
17
17
 
18
- export const VisitSiteBanner: React.FC< {
18
+ export const VisitSiteBanner: FC< {
19
19
  className?: string;
20
20
  onVisitBlankTarget?: () => void;
21
21
  } > = ( { className = null, onVisitBlankTarget } ) => {