@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
@@ -4,115 +4,115 @@ declare const selectors: {
4
4
  /**
5
5
  * Return the AI Assistant feature.
6
6
  * @param {LogoGeneratorStateProp} state - The app state tree.
7
- * @returns {Partial<AiFeatureProps>} The AI Assistant feature data.
7
+ * @return {Partial<AiFeatureProps>} The AI Assistant feature data.
8
8
  */
9
9
  getAiAssistantFeature(state: LogoGeneratorStateProp): Partial<AiFeatureProps>;
10
10
  /**
11
11
  * Return the site details.
12
- * @param {LogoGeneratorStateProp} state - The app state tree.
13
- * @returns {Partial<SiteDetails> | undefined} The site details.
12
+ * @param {LogoGeneratorStateProp} state - The app state tree.
13
+ * @return {Partial<SiteDetails> | undefined} The site details.
14
14
  */
15
15
  getSiteDetails(state: LogoGeneratorStateProp): Partial<SiteDetails> | undefined;
16
16
  /**
17
17
  * Get the isRequesting flag for the AI Assistant feature.
18
18
  * @param {LogoGeneratorStateProp} state - The app state tree.
19
- * @returns {boolean} The isRequesting flag.
19
+ * @return {boolean} The isRequesting flag.
20
20
  */
21
21
  getIsRequestingAiAssistantFeature(state: LogoGeneratorStateProp): boolean;
22
22
  /**
23
23
  * Get the logos history.
24
24
  * @param {LogoGeneratorStateProp} state - The app state tree.
25
- * @returns {Array<Logo>} The logos history array.
25
+ * @return {Array<Logo>} The logos history array.
26
26
  */
27
27
  getLogos(state: LogoGeneratorStateProp): Array<Logo>;
28
28
  /**
29
29
  * Get the selected logo index.
30
30
  * @param {LogoGeneratorStateProp} state - The app state tree.
31
- * @returns {number | null} The selected logo index.
31
+ * @return {number | null} The selected logo index.
32
32
  */
33
33
  getSelectedLogoIndex(state: LogoGeneratorStateProp): number | null;
34
34
  /**
35
35
  * Get the selected logo.
36
36
  * @param {LogoGeneratorStateProp} state - The app state tree.
37
- * @returns {Logo} The selected logo.
37
+ * @return {Logo} The selected logo.
38
38
  */
39
39
  getSelectedLogo(state: LogoGeneratorStateProp): Logo;
40
40
  /**
41
41
  * Get the isSavingToLibrary flag.
42
42
  * @param {LogoGeneratorStateProp} state - The app state tree.
43
- * @returns {boolean} The isSavingToLibrary flag.
43
+ * @return {boolean} The isSavingToLibrary flag.
44
44
  */
45
45
  getIsSavingLogoToLibrary(state: LogoGeneratorStateProp): boolean;
46
46
  /**
47
47
  * Get the isApplyingLogo flag.
48
48
  * @param {LogoGeneratorStateProp} state - The app state tree.
49
- * @returns {boolean} The isApplyingLogo flag.
49
+ * @return {boolean} The isApplyingLogo flag.
50
50
  */
51
51
  getIsApplyingLogo(state: LogoGeneratorStateProp): boolean;
52
52
  /**
53
53
  * Get the isEnhancingPrompt flag.
54
54
  * @param {LogoGeneratorStateProp} state - The app state tree.
55
- * @returns {boolean} The isEnhancingPrompt flag.
55
+ * @return {boolean} The isEnhancingPrompt flag.
56
56
  */
57
57
  getIsEnhancingPrompt(state: LogoGeneratorStateProp): boolean;
58
58
  /**
59
59
  * Get the isRequestingImage flag.
60
60
  * @param {LogoGeneratorStateProp} state - The app state tree.
61
- * @returns {boolean} The isRequestingImage flag.
61
+ * @return {boolean} The isRequestingImage flag.
62
62
  */
63
63
  getIsRequestingImage(state: LogoGeneratorStateProp): boolean;
64
64
  /**
65
65
  * Get an aggregated isBusy flag, based on the loading states of the app.
66
66
  * @param {LogoGeneratorStateProp} state - The app state tree.
67
- * @returns {boolean} The isBusy flag.
67
+ * @return {boolean} The isBusy flag.
68
68
  */
69
69
  getIsBusy(state: LogoGeneratorStateProp): boolean;
70
70
  /**
71
71
  * Get the requireUpgrade value from aiAssistantFeature
72
72
  * @param {LogoGeneratorStateProp} state - The app state tree.
73
- * @returns {boolean} The requireUpgrade flag.
73
+ * @return {boolean} The requireUpgrade flag.
74
74
  */
75
75
  getRequireUpgrade(state: LogoGeneratorStateProp): boolean;
76
76
  /**
77
77
  * Get the featureFetchError value.
78
78
  * @param {LogoGeneratorStateProp} state - The app state tree.
79
- * @returns {RequestError} The featureFetchError value.
79
+ * @return {RequestError} The featureFetchError value.
80
80
  */
81
81
  getFeatureFetchError(state: LogoGeneratorStateProp): RequestError;
82
82
  /**
83
83
  * Get the firstLogoPromptFetchError value.
84
84
  * @param {LogoGeneratorStateProp} state - The app state tree.
85
- * @returns {RequestError} The firstLogoPromptFetchError value.
85
+ * @return {RequestError} The firstLogoPromptFetchError value.
86
86
  */
87
87
  getFirstLogoPromptFetchError(state: LogoGeneratorStateProp): RequestError;
88
88
  /**
89
89
  * Get the enhancePromptFetchError value.
90
90
  * @param {LogoGeneratorStateProp} state - The app state tree.
91
- * @returns {RequestError} The enhancePromptFetchError value.
91
+ * @return {RequestError} The enhancePromptFetchError value.
92
92
  */
93
93
  getEnhancePromptFetchError(state: LogoGeneratorStateProp): RequestError;
94
94
  /**
95
95
  * Get the logoFetchError value.
96
96
  * @param {LogoGeneratorStateProp} state - The app state tree.
97
- * @returns {RequestError} The logoFetchError value.
97
+ * @return {RequestError} The logoFetchError value.
98
98
  */
99
99
  getLogoFetchError(state: LogoGeneratorStateProp): RequestError;
100
100
  /**
101
101
  * Get the saveToLibraryError value.
102
102
  * @param {LogoGeneratorStateProp} state - The app state tree.
103
- * @returns {RequestError} The saveToLibraryError value.
103
+ * @return {RequestError} The saveToLibraryError value.
104
104
  */
105
105
  getSaveToLibraryError(state: LogoGeneratorStateProp): RequestError;
106
106
  /**
107
107
  * Get the logoUpdateError value.
108
108
  * @param {LogoGeneratorStateProp} state - The app state tree.
109
- * @returns {RequestError} The logoUpdateError value.
109
+ * @return {RequestError} The logoUpdateError value.
110
110
  */
111
111
  getLogoUpdateError(state: LogoGeneratorStateProp): RequestError;
112
112
  /**
113
113
  * Get the context value.
114
114
  * @param {LogoGeneratorStateProp} state - The app state tree.
115
- * @returns {string} The context value.
115
+ * @return {string} The context value.
116
116
  */
117
117
  getContext(state: LogoGeneratorStateProp): string;
118
118
  };
@@ -6,7 +6,7 @@ const selectors = {
6
6
  /**
7
7
  * Return the AI Assistant feature.
8
8
  * @param {LogoGeneratorStateProp} state - The app state tree.
9
- * @returns {Partial<AiFeatureProps>} The AI Assistant feature data.
9
+ * @return {Partial<AiFeatureProps>} The AI Assistant feature data.
10
10
  */
11
11
  getAiAssistantFeature(state) {
12
12
  // Clean up the _meta property.
@@ -16,8 +16,8 @@ const selectors = {
16
16
  },
17
17
  /**
18
18
  * Return the site details.
19
- * @param {LogoGeneratorStateProp} state - The app state tree.
20
- * @returns {Partial<SiteDetails> | undefined} The site details.
19
+ * @param {LogoGeneratorStateProp} state - The app state tree.
20
+ * @return {Partial<SiteDetails> | undefined} The site details.
21
21
  */
22
22
  getSiteDetails(state) {
23
23
  return state.siteDetails;
@@ -25,7 +25,7 @@ const selectors = {
25
25
  /**
26
26
  * Get the isRequesting flag for the AI Assistant feature.
27
27
  * @param {LogoGeneratorStateProp} state - The app state tree.
28
- * @returns {boolean} The isRequesting flag.
28
+ * @return {boolean} The isRequesting flag.
29
29
  */
30
30
  getIsRequestingAiAssistantFeature(state) {
31
31
  return state.features.aiAssistantFeature?._meta?.isRequesting ?? false;
@@ -33,7 +33,7 @@ const selectors = {
33
33
  /**
34
34
  * Get the logos history.
35
35
  * @param {LogoGeneratorStateProp} state - The app state tree.
36
- * @returns {Array<Logo>} The logos history array.
36
+ * @return {Array<Logo>} The logos history array.
37
37
  */
38
38
  getLogos(state) {
39
39
  return state.history ?? [];
@@ -41,7 +41,7 @@ const selectors = {
41
41
  /**
42
42
  * Get the selected logo index.
43
43
  * @param {LogoGeneratorStateProp} state - The app state tree.
44
- * @returns {number | null} The selected logo index.
44
+ * @return {number | null} The selected logo index.
45
45
  */
46
46
  getSelectedLogoIndex(state) {
47
47
  return state.selectedLogoIndex ?? null;
@@ -49,7 +49,7 @@ const selectors = {
49
49
  /**
50
50
  * Get the selected logo.
51
51
  * @param {LogoGeneratorStateProp} state - The app state tree.
52
- * @returns {Logo} The selected logo.
52
+ * @return {Logo} The selected logo.
53
53
  */
54
54
  getSelectedLogo(state) {
55
55
  return state.history?.[state.selectedLogoIndex] ?? null;
@@ -57,7 +57,7 @@ const selectors = {
57
57
  /**
58
58
  * Get the isSavingToLibrary flag.
59
59
  * @param {LogoGeneratorStateProp} state - The app state tree.
60
- * @returns {boolean} The isSavingToLibrary flag.
60
+ * @return {boolean} The isSavingToLibrary flag.
61
61
  */
62
62
  getIsSavingLogoToLibrary(state) {
63
63
  return state._meta?.isSavingLogoToLibrary ?? false;
@@ -65,7 +65,7 @@ const selectors = {
65
65
  /**
66
66
  * Get the isApplyingLogo flag.
67
67
  * @param {LogoGeneratorStateProp} state - The app state tree.
68
- * @returns {boolean} The isApplyingLogo flag.
68
+ * @return {boolean} The isApplyingLogo flag.
69
69
  */
70
70
  getIsApplyingLogo(state) {
71
71
  return state._meta?.isApplyingLogo ?? false;
@@ -73,7 +73,7 @@ const selectors = {
73
73
  /**
74
74
  * Get the isEnhancingPrompt flag.
75
75
  * @param {LogoGeneratorStateProp} state - The app state tree.
76
- * @returns {boolean} The isEnhancingPrompt flag.
76
+ * @return {boolean} The isEnhancingPrompt flag.
77
77
  */
78
78
  getIsEnhancingPrompt(state) {
79
79
  return state._meta?.isEnhancingPrompt ?? false;
@@ -81,7 +81,7 @@ const selectors = {
81
81
  /**
82
82
  * Get the isRequestingImage flag.
83
83
  * @param {LogoGeneratorStateProp} state - The app state tree.
84
- * @returns {boolean} The isRequestingImage flag.
84
+ * @return {boolean} The isRequestingImage flag.
85
85
  */
86
86
  getIsRequestingImage(state) {
87
87
  return state._meta?.isRequestingImage ?? false;
@@ -89,7 +89,7 @@ const selectors = {
89
89
  /**
90
90
  * Get an aggregated isBusy flag, based on the loading states of the app.
91
91
  * @param {LogoGeneratorStateProp} state - The app state tree.
92
- * @returns {boolean} The isBusy flag.
92
+ * @return {boolean} The isBusy flag.
93
93
  */
94
94
  getIsBusy(state) {
95
95
  return (selectors.getIsApplyingLogo(state) ||
@@ -100,7 +100,7 @@ const selectors = {
100
100
  /**
101
101
  * Get the requireUpgrade value from aiAssistantFeature
102
102
  * @param {LogoGeneratorStateProp} state - The app state tree.
103
- * @returns {boolean} The requireUpgrade flag.
103
+ * @return {boolean} The requireUpgrade flag.
104
104
  */
105
105
  getRequireUpgrade(state) {
106
106
  const feature = state.features.aiAssistantFeature;
@@ -116,7 +116,7 @@ const selectors = {
116
116
  /**
117
117
  * Get the featureFetchError value.
118
118
  * @param {LogoGeneratorStateProp} state - The app state tree.
119
- * @returns {RequestError} The featureFetchError value.
119
+ * @return {RequestError} The featureFetchError value.
120
120
  */
121
121
  getFeatureFetchError(state) {
122
122
  return state._meta?.featureFetchError ?? null;
@@ -124,7 +124,7 @@ const selectors = {
124
124
  /**
125
125
  * Get the firstLogoPromptFetchError value.
126
126
  * @param {LogoGeneratorStateProp} state - The app state tree.
127
- * @returns {RequestError} The firstLogoPromptFetchError value.
127
+ * @return {RequestError} The firstLogoPromptFetchError value.
128
128
  */
129
129
  getFirstLogoPromptFetchError(state) {
130
130
  return state._meta?.firstLogoPromptFetchError ?? null;
@@ -132,7 +132,7 @@ const selectors = {
132
132
  /**
133
133
  * Get the enhancePromptFetchError value.
134
134
  * @param {LogoGeneratorStateProp} state - The app state tree.
135
- * @returns {RequestError} The enhancePromptFetchError value.
135
+ * @return {RequestError} The enhancePromptFetchError value.
136
136
  */
137
137
  getEnhancePromptFetchError(state) {
138
138
  return state._meta?.enhancePromptFetchError ?? null;
@@ -140,7 +140,7 @@ const selectors = {
140
140
  /**
141
141
  * Get the logoFetchError value.
142
142
  * @param {LogoGeneratorStateProp} state - The app state tree.
143
- * @returns {RequestError} The logoFetchError value.
143
+ * @return {RequestError} The logoFetchError value.
144
144
  */
145
145
  getLogoFetchError(state) {
146
146
  return state._meta?.logoFetchError ?? null;
@@ -148,7 +148,7 @@ const selectors = {
148
148
  /**
149
149
  * Get the saveToLibraryError value.
150
150
  * @param {LogoGeneratorStateProp} state - The app state tree.
151
- * @returns {RequestError} The saveToLibraryError value.
151
+ * @return {RequestError} The saveToLibraryError value.
152
152
  */
153
153
  getSaveToLibraryError(state) {
154
154
  return state._meta?.saveToLibraryError ?? null;
@@ -156,7 +156,7 @@ const selectors = {
156
156
  /**
157
157
  * Get the logoUpdateError value.
158
158
  * @param {LogoGeneratorStateProp} state - The app state tree.
159
- * @returns {RequestError} The logoUpdateError value.
159
+ * @return {RequestError} The logoUpdateError value.
160
160
  */
161
161
  getLogoUpdateError(state) {
162
162
  return state._meta?.logoUpdateError ?? null;
@@ -164,7 +164,7 @@ const selectors = {
164
164
  /**
165
165
  * Get the context value.
166
166
  * @param {LogoGeneratorStateProp} state - The app state tree.
167
- * @returns {string} The context value.
167
+ * @return {string} The context value.
168
168
  */
169
169
  getContext(state) {
170
170
  return state._meta?.context ?? '';
@@ -25,7 +25,7 @@ type FunctionCallProps = {
25
25
  * when the stream is closed.
26
26
  * It also emits a 'suggestion' event with the full suggestion received so far
27
27
  *
28
- * @returns {EventSource} The event source
28
+ * @return {EventSource} The event source
29
29
  * @fires SuggestionsEventSource#suggestion - The full suggestion has been received so far
30
30
  * @fires SuggestionsEventSource#message - A message has been received
31
31
  * @fires SuggestionsEventSource#chunk - A chunk of data has been received
@@ -19,7 +19,7 @@ const debug = debugFactory('jetpack-ai-client:suggestions-event-source');
19
19
  * when the stream is closed.
20
20
  * It also emits a 'suggestion' event with the full suggestion received so far
21
21
  *
22
- * @returns {EventSource} The event source
22
+ * @return {EventSource} The event source
23
23
  * @fires SuggestionsEventSource#suggestion - The full suggestion has been received so far
24
24
  * @fires SuggestionsEventSource#message - A message has been received
25
25
  * @fires SuggestionsEventSource#chunk - A chunk of data has been received
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@automattic/jetpack-ai-client",
4
- "version": "0.16.1",
4
+ "version": "0.16.3",
5
5
  "description": "A JS client for consuming Jetpack AI services",
6
6
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme",
7
7
  "bugs": {
@@ -23,14 +23,15 @@
23
23
  },
24
24
  "type": "module",
25
25
  "devDependencies": {
26
- "@storybook/addon-actions": "8.1.6",
27
- "@storybook/blocks": "8.1.6",
28
- "@storybook/preview-api": "8.1.6",
29
- "@storybook/react": "8.1.6",
30
- "@types/markdown-it": "14.0.1",
31
- "@types/turndown": "5.0.4",
26
+ "@storybook/addon-actions": "8.2.9",
27
+ "@storybook/blocks": "8.2.9",
28
+ "@storybook/preview-api": "8.2.9",
29
+ "@storybook/react": "8.2.9",
30
+ "@types/markdown-it": "14.1.2",
31
+ "@types/turndown": "5.0.5",
32
32
  "jest": "^29.6.2",
33
33
  "jest-environment-jsdom": "29.7.0",
34
+ "storybook": "8.2.9",
34
35
  "typescript": "5.0.4"
35
36
  },
36
37
  "exports": {
@@ -42,21 +43,21 @@
42
43
  "main": "./build/index.js",
43
44
  "types": "./build/index.d.ts",
44
45
  "dependencies": {
45
- "@automattic/jetpack-base-styles": "^0.6.28",
46
- "@automattic/jetpack-connection": "^0.34.1",
47
- "@automattic/jetpack-shared-extension-utils": "^0.15.1",
46
+ "@automattic/jetpack-base-styles": "^0.6.29",
47
+ "@automattic/jetpack-connection": "^0.35.3",
48
+ "@automattic/jetpack-shared-extension-utils": "^0.15.4",
48
49
  "@microsoft/fetch-event-source": "2.0.1",
49
- "@types/react": "18.3.1",
50
- "@types/wordpress__block-editor": "11.5.14",
51
- "@wordpress/api-fetch": "7.2.0",
52
- "@wordpress/blob": "4.2.0",
53
- "@wordpress/block-editor": "13.2.0",
54
- "@wordpress/components": "28.2.0",
55
- "@wordpress/compose": "7.2.0",
56
- "@wordpress/data": "10.2.0",
57
- "@wordpress/element": "6.2.0",
58
- "@wordpress/i18n": "5.2.0",
59
- "@wordpress/icons": "10.2.0",
50
+ "@types/react": "18.3.3",
51
+ "@types/wordpress__block-editor": "11.5.15",
52
+ "@wordpress/api-fetch": "7.5.0",
53
+ "@wordpress/blob": "4.5.0",
54
+ "@wordpress/block-editor": "14.0.0",
55
+ "@wordpress/components": "28.5.0",
56
+ "@wordpress/compose": "7.5.0",
57
+ "@wordpress/data": "10.5.0",
58
+ "@wordpress/element": "6.5.0",
59
+ "@wordpress/i18n": "5.5.0",
60
+ "@wordpress/icons": "10.5.0",
60
61
  "clsx": "2.1.1",
61
62
  "debug": "4.3.4",
62
63
  "markdown-it": "14.0.0",
@@ -46,9 +46,9 @@ const debug = debugFactory( 'jetpack-ai-client:ask-question' );
46
46
  * An asynchronous function that asks a question
47
47
  * and returns an event source with suggestions.
48
48
  *
49
- * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects.
50
- * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration:
51
- * @returns {Promise<SuggestionsEventSource>} A promise that resolves to an instance of the SuggestionsEventSource
49
+ * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects.
50
+ * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration:
51
+ * @return {Promise<SuggestionsEventSource>} A promise that resolves to an instance of the SuggestionsEventSource
52
52
  * @example
53
53
  * const question = "What is the meaning of life?";
54
54
  * const options = {
@@ -19,9 +19,9 @@ const debug = debugFactory( 'jetpack-ai-client:ask-question-sync' );
19
19
  /**
20
20
  * A function that asks a question without streaming.
21
21
  *
22
- * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects.
23
- * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration: postId, feature, model.
24
- * @returns {Promise<ResponseData>} - A promise that resolves to an instance of the ResponseData
22
+ * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects.
23
+ * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration: postId, feature, model.
24
+ * @return {Promise<ResponseData>} - A promise that resolves to an instance of the ResponseData
25
25
  * @example
26
26
  * const question = "What is the meaning of life?";
27
27
  * const options = {
@@ -12,10 +12,10 @@ const debug = debugFactory( 'jetpack-ai-client:audio-transcription' );
12
12
  /**
13
13
  * A function that takes an audio blob and transcribes it.
14
14
  *
15
- * @param {Blob} audio - The audio to be transcribed, from a recording or from a file.
16
- * @param {string} feature - The feature name that is calling the transcription.
15
+ * @param {Blob} audio - The audio to be transcribed, from a recording or from a file.
16
+ * @param {string} feature - The feature name that is calling the transcription.
17
17
  * @param {AbortSignal} requestAbortSignal - The signal to abort the request.
18
- * @returns {Promise<string>} - The promise of a string containing the transcribed audio.
18
+ * @return {Promise<string>} - The promise of a string containing the transcribed audio.
19
19
  */
20
20
  export default async function transcribeAudio(
21
21
  audio: Blob,
@@ -35,7 +35,7 @@ type AIControlProps = {
35
35
  * Base AIControl component. Contains the main structure of the control component and slots for banner, error, actions and message.
36
36
  *
37
37
  * @param {AIControlProps} props - Component props
38
- * @returns {ReactElement} Rendered component
38
+ * @return {ReactElement} Rendered component
39
39
  */
40
40
  export default function AIControl( {
41
41
  className,
@@ -53,9 +53,9 @@ const debug = debugFactory( 'jetpack-ai-client:block-ai-control' );
53
53
  /**
54
54
  * BlockAIControl component. Used by the AI Assistant block, adding logic and components to the base AIControl component.
55
55
  *
56
- * @param {BlockAIControlProps} props - Component props
57
- * @param {React.MutableRefObject} ref - Ref to the component
58
- * @returns {ReactElement} Rendered component
56
+ * @param {BlockAIControlProps} props - Component props
57
+ * @param {React.MutableRefObject} ref - Ref to the component
58
+ * @return {ReactElement} Rendered component
59
59
  */
60
60
  export function BlockAIControl(
61
61
  {
@@ -45,9 +45,9 @@ type ExtensionAIControlProps = {
45
45
  /**
46
46
  * ExtensionAIControl component. Used by the AI Assistant inline extensions, adding logic and components to the base AIControl component.
47
47
  *
48
- * @param {ExtensionAIControlProps} props - Component props
49
- * @param {React.MutableRefObject} ref - Ref to the component
50
- * @returns {ReactElement} Rendered component
48
+ * @param {ExtensionAIControlProps} props - Component props
49
+ * @param {React.MutableRefObject} ref - Ref to the component
50
+ * @return {ReactElement} Rendered component
51
51
  */
52
52
  export function ExtensionAIControl(
53
53
  {
@@ -21,7 +21,7 @@ export type AiStatusIndicatorProps = {
21
21
  * AiStatusIndicator component.
22
22
  *
23
23
  * @param {AiStatusIndicatorProps} props - component props.
24
- * @returns {React.ReactElement} - rendered component.
24
+ * @return {React.ReactElement} - rendered component.
25
25
  */
26
26
  export default function AiStatusIndicator( { state }: AiStatusIndicatorProps ): React.ReactElement {
27
27
  return (
@@ -16,7 +16,7 @@ type AudioDurationDisplayProps = {
16
16
  * AudioDurationDisplay component.
17
17
  *
18
18
  * @param {AudioDurationDisplayProps} props - Component props.
19
- * @returns {React.ReactElement} Rendered component.
19
+ * @return {React.ReactElement} Rendered component.
20
20
  */
21
21
  export default function AudioDurationDisplay( {
22
22
  duration,
@@ -19,9 +19,9 @@ type FormatTimeOptions = {
19
19
  * Formats the given time in milliseconds into a string with the format HH:MM:SS.DD,
20
20
  * adding hours and minutes only when needed.
21
21
  *
22
- * @param {number} time - The time in milliseconds to format.
22
+ * @param {number} time - The time in milliseconds to format.
23
23
  * @param {FormatTimeOptions} options - The arguments.
24
- * @returns {string} The formatted time string.
24
+ * @return {string} The formatted time string.
25
25
  * @example
26
26
  * const formattedTime1 = formatTime( 1234567, { addDecimalPart: true } ); // Returns "20:34.56"
27
27
  * const formattedTime2 = formatTime( 45123 ); // Returns "00.45"
@@ -67,7 +67,7 @@ const messageIconsMap = {
67
67
  * React component to render a block message.
68
68
  *
69
69
  * @param {MessageProps} props - Component props.
70
- * @returns {React.ReactElement } Banner component.
70
+ * @return {React.ReactElement } Banner component.
71
71
  */
72
72
  export default function Message( {
73
73
  severity = MESSAGE_SEVERITY_INFO,
@@ -99,7 +99,7 @@ export default function Message( {
99
99
  /**
100
100
  * React component to render a guideline message.
101
101
  *
102
- * @returns {React.ReactElement } - Message component.
102
+ * @return {React.ReactElement } - Message component.
103
103
  */
104
104
  export function GuidelineMessage(): React.ReactElement {
105
105
  return (
@@ -118,7 +118,7 @@ export function GuidelineMessage(): React.ReactElement {
118
118
  * React component to render an upgrade message for free tier users
119
119
  *
120
120
  * @param {number} requestsRemaining - Number of requests remaining.
121
- * @returns {React.ReactElement } - Message component.
121
+ * @return {React.ReactElement } - Message component.
122
122
  */
123
123
  export function UpgradeMessage( {
124
124
  requestsRemaining,
@@ -157,7 +157,7 @@ export function UpgradeMessage( {
157
157
  * React component to render an error message
158
158
  *
159
159
  * @param {number} requestsRemaining - Number of requests remaining.
160
- * @returns {React.ReactElement } - Message component.
160
+ * @return {React.ReactElement } - Message component.
161
161
  */
162
162
  export function ErrorMessage( {
163
163
  error,
@@ -58,7 +58,7 @@ type AiDataContextProviderProps = {
58
58
  /**
59
59
  * AI Data Context
60
60
  *
61
- * @returns {AiDataContextProps} Context.
61
+ * @return {AiDataContextProps} Context.
62
62
  */
63
63
  export const AiDataContext = createContext< AiDataContextProps | object >( {} );
64
64
 
@@ -66,7 +66,7 @@ export const AiDataContext = createContext< AiDataContextProps | object >( {} );
66
66
  * AI Data Context Provider
67
67
  *
68
68
  * @param {AiDataContextProviderProps} props - Component props.
69
- * @returns {React.ReactElement} Context provider.
69
+ * @return {React.ReactElement} Context provider.
70
70
  * @example
71
71
  * <AiDataContextProvider value={ value }>
72
72
  * { children }
@@ -41,7 +41,7 @@ export type UseAiContextOptions = {
41
41
  * and to subscribe to the request events (onDone, onSuggestion).
42
42
  *
43
43
  * @param {UseAiContextOptions} options - the hook options.
44
- * @returns {AiDataContextProps} the AI Assistant data context.
44
+ * @return {AiDataContextProps} the AI Assistant data context.
45
45
  */
46
46
  export default function useAiContext( {
47
47
  onDone,
@@ -15,7 +15,7 @@ import { AiDataContextProvider } from './index.js';
15
15
  * AI Assistant Data context to the wrapped component.
16
16
  *
17
17
  * @param {React.ReactElement} WrappedComponent - component to wrap.
18
- * @returns {React.ReactElement} Wrapped component, with the AI Assistant Data context.
18
+ * @return {React.ReactElement} Wrapped component, with the AI Assistant Data context.
19
19
  */
20
20
  const withAiDataProvider = createHigherOrderComponent(
21
21
  ( WrappedComponent: React.ComponentType ) => {