@automattic/jetpack-ai-client 0.16.1 → 0.16.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/ask-question/index.d.ts +3 -3
  3. package/build/ask-question/index.js +3 -3
  4. package/build/ask-question/sync.d.ts +3 -3
  5. package/build/ask-question/sync.js +3 -3
  6. package/build/audio-transcription/index.d.ts +3 -3
  7. package/build/audio-transcription/index.js +3 -3
  8. package/build/components/ai-control/ai-control.d.ts +1 -1
  9. package/build/components/ai-control/ai-control.js +1 -1
  10. package/build/components/ai-control/block-ai-control.d.ts +3 -3
  11. package/build/components/ai-control/block-ai-control.js +3 -3
  12. package/build/components/ai-control/extension-ai-control.d.ts +3 -3
  13. package/build/components/ai-control/extension-ai-control.js +3 -3
  14. package/build/components/ai-status-indicator/index.d.ts +1 -1
  15. package/build/components/ai-status-indicator/index.js +1 -1
  16. package/build/components/audio-duration-display/index.d.ts +1 -1
  17. package/build/components/audio-duration-display/index.js +1 -1
  18. package/build/components/audio-duration-display/lib/media.d.ts +2 -2
  19. package/build/components/audio-duration-display/lib/media.js +2 -2
  20. package/build/components/message/index.d.ts +4 -4
  21. package/build/components/message/index.js +4 -4
  22. package/build/data-flow/context.d.ts +2 -2
  23. package/build/data-flow/context.js +2 -2
  24. package/build/data-flow/use-ai-context.d.ts +1 -1
  25. package/build/data-flow/use-ai-context.js +1 -1
  26. package/build/data-flow/with-ai-assistant-data.d.ts +1 -1
  27. package/build/data-flow/with-ai-assistant-data.js +1 -1
  28. package/build/hooks/use-ai-suggestions/index.d.ts +3 -3
  29. package/build/hooks/use-ai-suggestions/index.js +11 -11
  30. package/build/hooks/use-audio-transcription/index.d.ts +1 -1
  31. package/build/hooks/use-audio-transcription/index.js +2 -2
  32. package/build/hooks/use-audio-validation/index.d.ts +1 -1
  33. package/build/hooks/use-audio-validation/index.js +1 -1
  34. package/build/hooks/use-image-generator/index.js +9 -9
  35. package/build/hooks/use-media-recording/index.d.ts +1 -1
  36. package/build/hooks/use-media-recording/index.js +4 -4
  37. package/build/hooks/use-save-to-media-library/index.d.ts +1 -1
  38. package/build/hooks/use-save-to-media-library/index.js +1 -1
  39. package/build/hooks/use-transcription-post-processing/index.d.ts +1 -1
  40. package/build/hooks/use-transcription-post-processing/index.js +1 -1
  41. package/build/jwt/index.d.ts +1 -1
  42. package/build/jwt/index.js +1 -1
  43. package/build/libs/markdown/html-to-markdown.d.ts +1 -1
  44. package/build/libs/markdown/html-to-markdown.js +1 -1
  45. package/build/libs/markdown/markdown-to-html.d.ts +4 -4
  46. package/build/libs/markdown/markdown-to-html.js +4 -4
  47. package/build/logo-generator/lib/logo-storage.d.ts +17 -17
  48. package/build/logo-generator/lib/logo-storage.js +17 -17
  49. package/build/logo-generator/lib/media-exists.d.ts +2 -2
  50. package/build/logo-generator/lib/media-exists.js +2 -2
  51. package/build/logo-generator/lib/set-site-logo.d.ts +3 -3
  52. package/build/logo-generator/lib/set-site-logo.js +3 -3
  53. package/build/logo-generator/lib/wpcom-limited-request.d.ts +1 -1
  54. package/build/logo-generator/lib/wpcom-limited-request.js +1 -1
  55. package/build/logo-generator/store/actions.d.ts +3 -3
  56. package/build/logo-generator/store/actions.js +3 -3
  57. package/build/logo-generator/store/reducer.d.ts +22 -22
  58. package/build/logo-generator/store/reducer.js +22 -22
  59. package/build/logo-generator/store/selectors.d.ts +20 -20
  60. package/build/logo-generator/store/selectors.js +20 -20
  61. package/build/suggestions-event-source/index.d.ts +1 -1
  62. package/build/suggestions-event-source/index.js +1 -1
  63. package/package.json +22 -21
  64. package/src/ask-question/index.ts +3 -3
  65. package/src/ask-question/sync.ts +3 -3
  66. package/src/audio-transcription/index.ts +3 -3
  67. package/src/components/ai-control/ai-control.tsx +1 -1
  68. package/src/components/ai-control/block-ai-control.tsx +3 -3
  69. package/src/components/ai-control/extension-ai-control.tsx +3 -3
  70. package/src/components/ai-status-indicator/index.tsx +1 -1
  71. package/src/components/audio-duration-display/index.tsx +1 -1
  72. package/src/components/audio-duration-display/lib/media.ts +2 -2
  73. package/src/components/message/index.tsx +4 -4
  74. package/src/data-flow/context.tsx +2 -2
  75. package/src/data-flow/use-ai-context.ts +1 -1
  76. package/src/data-flow/with-ai-assistant-data.tsx +1 -1
  77. package/src/hooks/use-ai-suggestions/index.ts +11 -11
  78. package/src/hooks/use-audio-transcription/index.ts +2 -2
  79. package/src/hooks/use-audio-validation/index.ts +1 -1
  80. package/src/hooks/use-image-generator/index.ts +9 -9
  81. package/src/hooks/use-media-recording/index.ts +4 -4
  82. package/src/hooks/use-save-to-media-library/index.ts +1 -1
  83. package/src/hooks/use-transcription-post-processing/index.ts +1 -1
  84. package/src/jwt/index.ts +1 -1
  85. package/src/libs/markdown/html-to-markdown.ts +1 -1
  86. package/src/libs/markdown/markdown-to-html.ts +4 -4
  87. package/src/logo-generator/lib/logo-storage.ts +17 -17
  88. package/src/logo-generator/lib/media-exists.ts +2 -2
  89. package/src/logo-generator/lib/set-site-logo.ts +3 -3
  90. package/src/logo-generator/lib/wpcom-limited-request.ts +1 -1
  91. package/src/logo-generator/store/actions.ts +3 -3
  92. package/src/logo-generator/store/reducer.ts +22 -22
  93. package/src/logo-generator/store/selectors.ts +20 -20
  94. package/src/suggestions-event-source/index.ts +1 -1
@@ -12,7 +12,7 @@ const MEDIA_TYPE_WEBM = 'audio/webm';
12
12
  * react custom hook to handle media recording.
13
13
  *
14
14
  * @param {UseMediaRecordingProps} props - The props
15
- * @returns {UseMediaRecordingReturn} The media recorder instance
15
+ * @return {UseMediaRecordingReturn} The media recorder instance
16
16
  */
17
17
  export default function useMediaRecording({ onDone, } = {}) {
18
18
  // Reference to the media recorder instance
@@ -35,7 +35,7 @@ export default function useMediaRecording({ onDone, } = {}) {
35
35
  /**
36
36
  * Get the recorded blob.
37
37
  *
38
- * @returns {Blob} The recorded blob
38
+ * @return {Blob} The recorded blob
39
39
  */
40
40
  function getBlob() {
41
41
  if (MediaRecorder.isTypeSupported(MEDIA_TYPE_MP4_MP4A)) {
@@ -158,7 +158,7 @@ export default function useMediaRecording({ onDone, } = {}) {
158
158
  * `stop` event listener for the media recorder instance.
159
159
  * Happens after the last `dataavailable` event.
160
160
  *
161
- * @returns {void}
161
+ * @return {void}
162
162
  */
163
163
  function onStopListener() {
164
164
  const lastBlob = getBlob();
@@ -182,7 +182,7 @@ export default function useMediaRecording({ onDone, } = {}) {
182
182
  * `dataavailable` event listener for the media recorder instance.
183
183
  *
184
184
  * @param {MediaRecorderEvent} event - The event object
185
- * @returns {void}
185
+ * @return {void}
186
186
  */
187
187
  function onDataAvailableListener(event) {
188
188
  const { data } = event;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hook to save an image to the media library.
3
3
  *
4
- * @returns {object} Object with the loading state and the function to save the image to the media library.
4
+ * @return {object} Object with the loading state and the function to save the image to the media library.
5
5
  */
6
6
  export default function useSaveToMediaLibrary(): {
7
7
  isLoading: boolean;
@@ -9,7 +9,7 @@ const debug = debugFactory('ai-client:save-to-media-library');
9
9
  /**
10
10
  * Hook to save an image to the media library.
11
11
  *
12
- * @returns {object} Object with the loading state and the function to save the image to the media library.
12
+ * @return {object} Object with the loading state and the function to save the image to the media library.
13
13
  */
14
14
  export default function useSaveToMediaLibrary() {
15
15
  const [isLoading, setIsLoading] = useState(false);
@@ -26,6 +26,6 @@ export type UseTranscriptionPostProcessingProps = {
26
26
  * A hook to handle transcription post-processing.
27
27
  *
28
28
  * @param {string} feature - The feature name that is calling the post-processing actions.
29
- * @returns {UseTranscriptionPostProcessingReturn} - Object with properties to get the post-processing results.
29
+ * @return {UseTranscriptionPostProcessingReturn} - Object with properties to get the post-processing results.
30
30
  */
31
31
  export default function useTranscriptionPostProcessing({ feature, onReady, onError, onUpdate, }: UseTranscriptionPostProcessingProps): UseTranscriptionPostProcessingReturn;
@@ -16,7 +16,7 @@ export const TRANSCRIPTION_POST_PROCESSING_ACTION_SIMPLE_DRAFT = 'voice-to-conte
16
16
  * A hook to handle transcription post-processing.
17
17
  *
18
18
  * @param {string} feature - The feature name that is calling the post-processing actions.
19
- * @returns {UseTranscriptionPostProcessingReturn} - Object with properties to get the post-processing results.
19
+ * @return {UseTranscriptionPostProcessingReturn} - Object with properties to get the post-processing results.
20
20
  */
21
21
  export default function useTranscriptionPostProcessing({ feature, onReady, onError, onUpdate, }) {
22
22
  const [postProcessingResult, setPostProcessingResult] = useState('');
@@ -13,7 +13,7 @@ type TokenDataProps = {
13
13
  * Request a token from the Jetpack site.
14
14
  *
15
15
  * @param {RequestTokenOptions} options - Options
16
- * @returns {Promise<TokenDataProps>} The token and the blogId
16
+ * @return {Promise<TokenDataProps>} The token and the blogId
17
17
  */
18
18
  export default function requestJwt({ apiNonce, siteId, expirationTime, }?: RequestTokenOptions): Promise<TokenDataProps>;
19
19
  export {};
@@ -14,7 +14,7 @@ const JWT_TOKEN_EXPIRATION_TIME = 2 * 60 * 1000; // 2 minutes
14
14
  * Request a token from the Jetpack site.
15
15
  *
16
16
  * @param {RequestTokenOptions} options - Options
17
- * @returns {Promise<TokenDataProps>} The token and the blogId
17
+ * @return {Promise<TokenDataProps>} The token and the blogId
18
18
  */
19
19
  export default async function requestJwt({ apiNonce, siteId, expirationTime, } = {}) {
20
20
  // Default values
@@ -23,7 +23,7 @@ export default class HTMLToMarkdown {
23
23
  * Renders HTML from Markdown content with specified processing rules.
24
24
  * @param {object} options - The options to use when rendering the Markdown content
25
25
  * @param {string} options.content - The HTML content to render
26
- * @returns {string} The rendered Markdown content
26
+ * @return {string} The rendered Markdown content
27
27
  */
28
28
  render({ content }: {
29
29
  content: string;
@@ -34,7 +34,7 @@ export default class HTMLToMarkdown {
34
34
  * Renders HTML from Markdown content with specified processing rules.
35
35
  * @param {object} options - The options to use when rendering the Markdown content
36
36
  * @param {string} options.content - The HTML content to render
37
- * @returns {string} The rendered Markdown content
37
+ * @return {string} The rendered Markdown content
38
38
  */
39
39
  render({ content }) {
40
40
  const rendered = this.turndownService.turndown(content);
@@ -18,11 +18,11 @@ export default class MarkdownToHTML {
18
18
  constructor(options?: Options);
19
19
  /**
20
20
  * Renders HTML from Markdown content with specified processing rules.
21
- * @param {object} options - The options to use when rendering the HTML content
22
- * @param {string} options.content - The Markdown content to render
23
- * @param {string} options.rules - The rules to apply to the rendered content
21
+ * @param {object} options - The options to use when rendering the HTML content
22
+ * @param {string} options.content - The Markdown content to render
23
+ * @param {string} options.rules - The rules to apply to the rendered content
24
24
  * @param {boolean} options.extension - Whether to apply the extension-specific rules
25
- * @returns {string} The rendered HTML content
25
+ * @return {string} The rendered HTML content
26
26
  */
27
27
  render({ content, rules, extension, }: {
28
28
  content: string;
@@ -65,11 +65,11 @@ export default class MarkdownToHTML {
65
65
  }
66
66
  /**
67
67
  * Renders HTML from Markdown content with specified processing rules.
68
- * @param {object} options - The options to use when rendering the HTML content
69
- * @param {string} options.content - The Markdown content to render
70
- * @param {string} options.rules - The rules to apply to the rendered content
68
+ * @param {object} options - The options to use when rendering the HTML content
69
+ * @param {string} options.content - The Markdown content to render
70
+ * @param {string} options.rules - The rules to apply to the rendered content
71
71
  * @param {boolean} options.extension - Whether to apply the extension-specific rules
72
- * @returns {string} The rendered HTML content
72
+ * @return {string} The rendered HTML content
73
73
  */
74
74
  render({ content, rules = assistantBlockRules, extension = false, }) {
75
75
  const rendered = this.markdownConverter.render(content);
@@ -6,53 +6,53 @@ import { RemoveFromStorageProps, SaveToStorageProps, UpdateInStorageProps } from
6
6
  /**
7
7
  * Add an entry to the site's logo history.
8
8
  *
9
- * @param {SaveToStorageProps} saveToStorageProps - The properties to save to storage
10
- * @param {SaveToStorageProps.siteId} saveToStorageProps.siteId - The site ID
11
- * @param {SaveToStorageProps.url} saveToStorageProps.url - The URL of the logo
9
+ * @param {SaveToStorageProps} saveToStorageProps - The properties to save to storage
10
+ * @param {SaveToStorageProps.siteId} saveToStorageProps.siteId - The site ID
11
+ * @param {SaveToStorageProps.url} saveToStorageProps.url - The URL of the logo
12
12
  * @param {SaveToStorageProps.description} saveToStorageProps.description - The description of the logo, based on the prompt used to generate it
13
- * @param {SaveToStorageProps.mediaId} saveToStorageProps.mediaId - The media ID of the logo on the backend
13
+ * @param {SaveToStorageProps.mediaId} saveToStorageProps.mediaId - The media ID of the logo on the backend
14
14
  *
15
- * @returns {Logo} The logo that was saved
15
+ * @return {Logo} The logo that was saved
16
16
  */
17
17
  export declare function stashLogo({ siteId, url, description, mediaId }: SaveToStorageProps): Logo;
18
18
  /**
19
19
  * Update an entry in the site's logo history.
20
20
  *
21
- * @param {UpdateInStorageProps} updateInStorageProps - The properties to update in storage
22
- * @param {UpdateInStorageProps.siteId} updateInStorageProps.siteId - The site ID
23
- * @param {UpdateInStorageProps.url} updateInStorageProps.url - The URL of the logo to update
24
- * @param {UpdateInStorageProps.newUrl} updateInStorageProps.newUrl - The new URL of the logo
21
+ * @param {UpdateInStorageProps} updateInStorageProps - The properties to update in storage
22
+ * @param {UpdateInStorageProps.siteId} updateInStorageProps.siteId - The site ID
23
+ * @param {UpdateInStorageProps.url} updateInStorageProps.url - The URL of the logo to update
24
+ * @param {UpdateInStorageProps.newUrl} updateInStorageProps.newUrl - The new URL of the logo
25
25
  * @param {UpdateInStorageProps.mediaId} updateInStorageProps.mediaId - The new media ID of the logo
26
- * @returns {Logo} The logo that was updated
26
+ * @return {Logo} The logo that was updated
27
27
  */
28
28
  export declare function updateLogo({ siteId, url, newUrl, mediaId }: UpdateInStorageProps): Logo;
29
29
  /**
30
30
  * Get the logo history for a site.
31
31
  *
32
32
  * @param {string} siteId - The site ID to get the logo history for
33
- * @returns {Logo[]} The logo history for the site
33
+ * @return {Logo[]} The logo history for the site
34
34
  */
35
35
  export declare function getSiteLogoHistory(siteId: string): Logo[];
36
36
  /**
37
37
  * Check if the logo history for a site is empty.
38
38
  *
39
- * @param {string }siteId - The site ID to check the logo history for
40
- * @returns {boolean} Whether the logo history for the site is empty
39
+ * @param {string } siteId - The site ID to check the logo history for
40
+ * @return {boolean} Whether the logo history for the site is empty
41
41
  */
42
42
  export declare function isLogoHistoryEmpty(siteId: string): boolean;
43
43
  /**
44
44
  * Remove an entry from the site's logo history.
45
45
  *
46
- * @param {RemoveFromStorageProps} removeFromStorageProps - The properties to remove from storage
47
- * @param {RemoveFromStorageProps.siteId} removeFromStorageProps.siteId - The site ID
46
+ * @param {RemoveFromStorageProps} removeFromStorageProps - The properties to remove from storage
47
+ * @param {RemoveFromStorageProps.siteId} removeFromStorageProps.siteId - The site ID
48
48
  * @param {RemoveFromStorageProps.mediaId} removeFromStorageProps.mediaId - The media ID of the logo to remove
49
- * @returns {void}
49
+ * @return {void}
50
50
  */
51
51
  export declare function removeLogo({ siteId, mediaId }: RemoveFromStorageProps): void;
52
52
  /**
53
53
  * Clear deleted media from the site's logo history, checking if the media still exists on the backend.
54
54
  *
55
55
  * @param {string} siteId - The site ID to clear deleted media for
56
- * @returns {Promise<void>}
56
+ * @return {Promise<void>}
57
57
  */
58
58
  export declare function clearDeletedMedia(siteId: string): Promise<void>;
@@ -3,13 +3,13 @@ const MAX_LOGOS = 10;
3
3
  /**
4
4
  * Add an entry to the site's logo history.
5
5
  *
6
- * @param {SaveToStorageProps} saveToStorageProps - The properties to save to storage
7
- * @param {SaveToStorageProps.siteId} saveToStorageProps.siteId - The site ID
8
- * @param {SaveToStorageProps.url} saveToStorageProps.url - The URL of the logo
6
+ * @param {SaveToStorageProps} saveToStorageProps - The properties to save to storage
7
+ * @param {SaveToStorageProps.siteId} saveToStorageProps.siteId - The site ID
8
+ * @param {SaveToStorageProps.url} saveToStorageProps.url - The URL of the logo
9
9
  * @param {SaveToStorageProps.description} saveToStorageProps.description - The description of the logo, based on the prompt used to generate it
10
- * @param {SaveToStorageProps.mediaId} saveToStorageProps.mediaId - The media ID of the logo on the backend
10
+ * @param {SaveToStorageProps.mediaId} saveToStorageProps.mediaId - The media ID of the logo on the backend
11
11
  *
12
- * @returns {Logo} The logo that was saved
12
+ * @return {Logo} The logo that was saved
13
13
  */
14
14
  export function stashLogo({ siteId, url, description, mediaId }) {
15
15
  const storedContent = getSiteLogoHistory(siteId);
@@ -25,12 +25,12 @@ export function stashLogo({ siteId, url, description, mediaId }) {
25
25
  /**
26
26
  * Update an entry in the site's logo history.
27
27
  *
28
- * @param {UpdateInStorageProps} updateInStorageProps - The properties to update in storage
29
- * @param {UpdateInStorageProps.siteId} updateInStorageProps.siteId - The site ID
30
- * @param {UpdateInStorageProps.url} updateInStorageProps.url - The URL of the logo to update
31
- * @param {UpdateInStorageProps.newUrl} updateInStorageProps.newUrl - The new URL of the logo
28
+ * @param {UpdateInStorageProps} updateInStorageProps - The properties to update in storage
29
+ * @param {UpdateInStorageProps.siteId} updateInStorageProps.siteId - The site ID
30
+ * @param {UpdateInStorageProps.url} updateInStorageProps.url - The URL of the logo to update
31
+ * @param {UpdateInStorageProps.newUrl} updateInStorageProps.newUrl - The new URL of the logo
32
32
  * @param {UpdateInStorageProps.mediaId} updateInStorageProps.mediaId - The new media ID of the logo
33
- * @returns {Logo} The logo that was updated
33
+ * @return {Logo} The logo that was updated
34
34
  */
35
35
  export function updateLogo({ siteId, url, newUrl, mediaId }) {
36
36
  const storedContent = getSiteLogoHistory(siteId);
@@ -46,7 +46,7 @@ export function updateLogo({ siteId, url, newUrl, mediaId }) {
46
46
  * Get the logo history for a site.
47
47
  *
48
48
  * @param {string} siteId - The site ID to get the logo history for
49
- * @returns {Logo[]} The logo history for the site
49
+ * @return {Logo[]} The logo history for the site
50
50
  */
51
51
  export function getSiteLogoHistory(siteId) {
52
52
  const storedString = localStorage.getItem(`logo-history-${siteId}`);
@@ -74,8 +74,8 @@ export function getSiteLogoHistory(siteId) {
74
74
  /**
75
75
  * Check if the logo history for a site is empty.
76
76
  *
77
- * @param {string }siteId - The site ID to check the logo history for
78
- * @returns {boolean} Whether the logo history for the site is empty
77
+ * @param {string } siteId - The site ID to check the logo history for
78
+ * @return {boolean} Whether the logo history for the site is empty
79
79
  */
80
80
  export function isLogoHistoryEmpty(siteId) {
81
81
  const storedContent = getSiteLogoHistory(siteId);
@@ -84,10 +84,10 @@ export function isLogoHistoryEmpty(siteId) {
84
84
  /**
85
85
  * Remove an entry from the site's logo history.
86
86
  *
87
- * @param {RemoveFromStorageProps} removeFromStorageProps - The properties to remove from storage
88
- * @param {RemoveFromStorageProps.siteId} removeFromStorageProps.siteId - The site ID
87
+ * @param {RemoveFromStorageProps} removeFromStorageProps - The properties to remove from storage
88
+ * @param {RemoveFromStorageProps.siteId} removeFromStorageProps.siteId - The site ID
89
89
  * @param {RemoveFromStorageProps.mediaId} removeFromStorageProps.mediaId - The media ID of the logo to remove
90
- * @returns {void}
90
+ * @return {void}
91
91
  */
92
92
  export function removeLogo({ siteId, mediaId }) {
93
93
  const storedContent = getSiteLogoHistory(siteId);
@@ -102,7 +102,7 @@ export function removeLogo({ siteId, mediaId }) {
102
102
  * Clear deleted media from the site's logo history, checking if the media still exists on the backend.
103
103
  *
104
104
  * @param {string} siteId - The site ID to clear deleted media for
105
- * @returns {Promise<void>}
105
+ * @return {Promise<void>}
106
106
  */
107
107
  export async function clearDeletedMedia(siteId) {
108
108
  const storedContent = getSiteLogoHistory(siteId);
@@ -5,8 +5,8 @@ import type { CheckMediaProps } from '../types.js';
5
5
  /**
6
6
  * Uses the media information to confirm it exists or not on the server.
7
7
  *
8
- * @param {CheckMediaProps} checkMediaProps - the media details to check
8
+ * @param {CheckMediaProps} checkMediaProps - the media details to check
9
9
  * @param {CheckMediaProps.mediaId} checkMediaProps.mediaId - the id of the media to check
10
- * @returns {Promise<boolean>} - true if the media exists, false otherwise
10
+ * @return {Promise<boolean>} - true if the media exists, false otherwise
11
11
  */
12
12
  export declare function mediaExists({ mediaId }: CheckMediaProps): Promise<boolean>;
@@ -5,9 +5,9 @@ import apiFetch from '../../api-fetch/index.js';
5
5
  /**
6
6
  * Uses the media information to confirm it exists or not on the server.
7
7
  *
8
- * @param {CheckMediaProps} checkMediaProps - the media details to check
8
+ * @param {CheckMediaProps} checkMediaProps - the media details to check
9
9
  * @param {CheckMediaProps.mediaId} checkMediaProps.mediaId - the id of the media to check
10
- * @returns {Promise<boolean>} - true if the media exists, false otherwise
10
+ * @return {Promise<boolean>} - true if the media exists, false otherwise
11
11
  */
12
12
  export async function mediaExists({ mediaId }) {
13
13
  const id = Number(mediaId);
@@ -5,9 +5,9 @@ import type { SetSiteLogoProps, SetSiteLogoResponseProps } from '../types.js';
5
5
  /**
6
6
  * Set the site logo using a backend request.
7
7
  *
8
- * @param {SetSiteLogoProps} setSiteLogoProps - The properties to set the site logo
9
- * @param {SetSiteLogoProps.siteId} setSiteLogoProps.siteId - The site ID
8
+ * @param {SetSiteLogoProps} setSiteLogoProps - The properties to set the site logo
9
+ * @param {SetSiteLogoProps.siteId} setSiteLogoProps.siteId - The site ID
10
10
  * @param {SetSiteLogoProps.imageId} setSiteLogoProps.imageId - The image ID to set as the site logo
11
- * @returns {Promise<SetSiteLogoResponseProps>} The response from the request
11
+ * @return {Promise<SetSiteLogoResponseProps>} The response from the request
12
12
  */
13
13
  export declare function setSiteLogo({ siteId, imageId }: SetSiteLogoProps): Promise<SetSiteLogoResponseProps>;
@@ -5,10 +5,10 @@ import wpcomLimitedRequest from './wpcom-limited-request.js';
5
5
  /**
6
6
  * Set the site logo using a backend request.
7
7
  *
8
- * @param {SetSiteLogoProps} setSiteLogoProps - The properties to set the site logo
9
- * @param {SetSiteLogoProps.siteId} setSiteLogoProps.siteId - The site ID
8
+ * @param {SetSiteLogoProps} setSiteLogoProps - The properties to set the site logo
9
+ * @param {SetSiteLogoProps.siteId} setSiteLogoProps.siteId - The site ID
10
10
  * @param {SetSiteLogoProps.imageId} setSiteLogoProps.imageId - The image ID to set as the site logo
11
- * @returns {Promise<SetSiteLogoResponseProps>} The response from the request
11
+ * @return {Promise<SetSiteLogoResponseProps>} The response from the request
12
12
  */
13
13
  export async function setSiteLogo({ siteId, imageId }) {
14
14
  const body = {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Concurrency-limited request to wpcom-proxy-request.
3
3
  * @param { object } params - The request params, as expected by apiFetch.
4
- * @returns { Promise } The response.
4
+ * @return { Promise } The response.
5
5
  * @throws { Error } If there are too many concurrent requests.
6
6
  */
7
7
  export default function wpcomLimitedRequest<T>(params: object): Promise<T>;
@@ -10,7 +10,7 @@ let concurrentCounter = 0;
10
10
  /**
11
11
  * Concurrency-limited request to wpcom-proxy-request.
12
12
  * @param { object } params - The request params, as expected by apiFetch.
13
- * @returns { Promise } The response.
13
+ * @return { Promise } The response.
14
14
  * @throws { Error } If there are too many concurrent requests.
15
15
  */
16
16
  export default async function wpcomLimitedRequest(params) {
@@ -4,7 +4,7 @@ import type { SiteDetails } from '../types.js';
4
4
  * Map the response from the `sites/$site/ai-assistant-feature`
5
5
  * endpoint to the AI Assistant feature props.
6
6
  * @param { AiAssistantFeatureEndpointResponseProps } response - The response from the endpoint.
7
- * @returns { AiFeatureProps } The AI Assistant feature props.
7
+ * @return { AiFeatureProps } The AI Assistant feature props.
8
8
  */
9
9
  export declare function mapAiFeatureResponseToAiFeatureProps(response: AiAssistantFeatureEndpointResponseProps): AiFeatureProps;
10
10
  declare const actions: {
@@ -14,7 +14,7 @@ declare const actions: {
14
14
  };
15
15
  /**
16
16
  * Thunk action to fetch the AI Assistant feature from the API.
17
- * @returns {Function} The thunk action.
17
+ * @return {Function} The thunk action.
18
18
  */
19
19
  fetchAiAssistantFeature(): ({ dispatch }: {
20
20
  dispatch: any;
@@ -23,7 +23,7 @@ declare const actions: {
23
23
  * This thunk action is used to increase
24
24
  * the requests count for the current usage period.
25
25
  * @param {number} count - The number of requests to increase. Default is 1.
26
- * @returns {Function} The thunk action.
26
+ * @return {Function} The thunk action.
27
27
  */
28
28
  increaseAiAssistantRequestsCount(count?: number): ({ dispatch }: {
29
29
  dispatch: any;
@@ -11,7 +11,7 @@ import { ACTION_INCREASE_AI_ASSISTANT_REQUESTS_COUNT, ACTION_REQUEST_AI_ASSISTAN
11
11
  * Map the response from the `sites/$site/ai-assistant-feature`
12
12
  * endpoint to the AI Assistant feature props.
13
13
  * @param { AiAssistantFeatureEndpointResponseProps } response - The response from the endpoint.
14
- * @returns { AiFeatureProps } The AI Assistant feature props.
14
+ * @return { AiFeatureProps } The AI Assistant feature props.
15
15
  */
16
16
  export function mapAiFeatureResponseToAiFeatureProps(response) {
17
17
  return {
@@ -43,7 +43,7 @@ const actions = {
43
43
  },
44
44
  /**
45
45
  * Thunk action to fetch the AI Assistant feature from the API.
46
- * @returns {Function} The thunk action.
46
+ * @return {Function} The thunk action.
47
47
  */
48
48
  fetchAiAssistantFeature() {
49
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -68,7 +68,7 @@ const actions = {
68
68
  * This thunk action is used to increase
69
69
  * the requests count for the current usage period.
70
70
  * @param {number} count - The number of requests to increase. Default is 1.
71
- * @returns {Function} The thunk action.
71
+ * @return {Function} The thunk action.
72
72
  */
73
73
  increaseAiAssistantRequestsCount(count = 1) {
74
74
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -3,28 +3,28 @@ import type { SiteDetails } from '../types.js';
3
3
  /**
4
4
  * Reducer for the Logo Generator store.
5
5
  *
6
- * @param {LogoGeneratorStateProp} state - The current state
7
- * @param {object} action - The action to apply, as described by the properties below
8
- * @param {string} action.type - The action type
9
- * @param {AiFeatureStateProps} action.feature - The AI Assistant feature state
10
- * @param {number} action.count - The number of requests to increase the counter by
11
- * @param {boolean} action.requireUpgrade - Whether an upgrade is required
12
- * @param {boolean} action.tierPlansEnabled - Whether tier plans are enabled
13
- * @param {SiteDetails} action.siteDetails - The site details
14
- * @param {number} action.selectedLogoIndex - The selected logo index
15
- * @param {boolean} action.isSavingLogoToLibrary - Whether a logo is being saved to the library
16
- * @param {boolean} action.isApplyingLogo - Whether a logo is being applied
17
- * @param {object} action.logo - The logo to save, as described by the properties below
18
- * @param {string} action.logo.url - The logo URL
19
- * @param {string} action.logo.description - The logo description
20
- * @param {number} action.mediaId - The media ID from backend
21
- * @param {string} action.url - The URL to save
22
- * @param {boolean} action.isRequestingImage - Whether an image is being requested
23
- * @param {boolean} action.isEnhancingPrompt - Whether a prompt enhancement is being requested
24
- * @param {Array< { url: string; description: string; mediaId?: number } >} action.history - The logo history
25
- * @param {RequestError} action.error - The error to set
26
- * @param {string} action.context - The context where the tool is being used
27
- * @returns {LogoGeneratorStateProp} The new state
6
+ * @param {LogoGeneratorStateProp} state - The current state
7
+ * @param {object} action - The action to apply, as described by the properties below
8
+ * @param {string} action.type - The action type
9
+ * @param {AiFeatureStateProps} action.feature - The AI Assistant feature state
10
+ * @param {number} action.count - The number of requests to increase the counter by
11
+ * @param {boolean} action.requireUpgrade - Whether an upgrade is required
12
+ * @param {boolean} action.tierPlansEnabled - Whether tier plans are enabled
13
+ * @param {SiteDetails} action.siteDetails - The site details
14
+ * @param {number} action.selectedLogoIndex - The selected logo index
15
+ * @param {boolean} action.isSavingLogoToLibrary - Whether a logo is being saved to the library
16
+ * @param {boolean} action.isApplyingLogo - Whether a logo is being applied
17
+ * @param {object} action.logo - The logo to save, as described by the properties below
18
+ * @param {string} action.logo.url - The logo URL
19
+ * @param {string} action.logo.description - The logo description
20
+ * @param {number} action.mediaId - The media ID from backend
21
+ * @param {string} action.url - The URL to save
22
+ * @param {boolean} action.isRequestingImage - Whether an image is being requested
23
+ * @param {boolean} action.isEnhancingPrompt - Whether a prompt enhancement is being requested
24
+ * @param {Array< { url: string; description: string; mediaId?: number } >} action.history - The logo history
25
+ * @param {RequestError} action.error - The error to set
26
+ * @param {string} action.context - The context where the tool is being used
27
+ * @return {LogoGeneratorStateProp} The new state
28
28
  */
29
29
  export default function reducer(state: LogoGeneratorStateProp, action: {
30
30
  type: string;
@@ -7,28 +7,28 @@ import INITIAL_STATE from './initial-state.js';
7
7
  /**
8
8
  * Reducer for the Logo Generator store.
9
9
  *
10
- * @param {LogoGeneratorStateProp} state - The current state
11
- * @param {object} action - The action to apply, as described by the properties below
12
- * @param {string} action.type - The action type
13
- * @param {AiFeatureStateProps} action.feature - The AI Assistant feature state
14
- * @param {number} action.count - The number of requests to increase the counter by
15
- * @param {boolean} action.requireUpgrade - Whether an upgrade is required
16
- * @param {boolean} action.tierPlansEnabled - Whether tier plans are enabled
17
- * @param {SiteDetails} action.siteDetails - The site details
18
- * @param {number} action.selectedLogoIndex - The selected logo index
19
- * @param {boolean} action.isSavingLogoToLibrary - Whether a logo is being saved to the library
20
- * @param {boolean} action.isApplyingLogo - Whether a logo is being applied
21
- * @param {object} action.logo - The logo to save, as described by the properties below
22
- * @param {string} action.logo.url - The logo URL
23
- * @param {string} action.logo.description - The logo description
24
- * @param {number} action.mediaId - The media ID from backend
25
- * @param {string} action.url - The URL to save
26
- * @param {boolean} action.isRequestingImage - Whether an image is being requested
27
- * @param {boolean} action.isEnhancingPrompt - Whether a prompt enhancement is being requested
28
- * @param {Array< { url: string; description: string; mediaId?: number } >} action.history - The logo history
29
- * @param {RequestError} action.error - The error to set
30
- * @param {string} action.context - The context where the tool is being used
31
- * @returns {LogoGeneratorStateProp} The new state
10
+ * @param {LogoGeneratorStateProp} state - The current state
11
+ * @param {object} action - The action to apply, as described by the properties below
12
+ * @param {string} action.type - The action type
13
+ * @param {AiFeatureStateProps} action.feature - The AI Assistant feature state
14
+ * @param {number} action.count - The number of requests to increase the counter by
15
+ * @param {boolean} action.requireUpgrade - Whether an upgrade is required
16
+ * @param {boolean} action.tierPlansEnabled - Whether tier plans are enabled
17
+ * @param {SiteDetails} action.siteDetails - The site details
18
+ * @param {number} action.selectedLogoIndex - The selected logo index
19
+ * @param {boolean} action.isSavingLogoToLibrary - Whether a logo is being saved to the library
20
+ * @param {boolean} action.isApplyingLogo - Whether a logo is being applied
21
+ * @param {object} action.logo - The logo to save, as described by the properties below
22
+ * @param {string} action.logo.url - The logo URL
23
+ * @param {string} action.logo.description - The logo description
24
+ * @param {number} action.mediaId - The media ID from backend
25
+ * @param {string} action.url - The URL to save
26
+ * @param {boolean} action.isRequestingImage - Whether an image is being requested
27
+ * @param {boolean} action.isEnhancingPrompt - Whether a prompt enhancement is being requested
28
+ * @param {Array< { url: string; description: string; mediaId?: number } >} action.history - The logo history
29
+ * @param {RequestError} action.error - The error to set
30
+ * @param {string} action.context - The context where the tool is being used
31
+ * @return {LogoGeneratorStateProp} The new state
32
32
  */
33
33
  export default function reducer(state = INITIAL_STATE, action) {
34
34
  switch (action.type) {