@automattic/jetpack-ai-client 0.6.1 → 0.8.0

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 (71) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/build/api-fetch/index.d.ts +7 -0
  3. package/build/api-fetch/index.js +6 -0
  4. package/build/ask-question/index.d.ts +2 -2
  5. package/build/ask-question/index.js +1 -1
  6. package/build/audio-transcription/index.d.ts +12 -0
  7. package/build/audio-transcription/index.js +51 -0
  8. package/build/components/ai-control/index.d.ts +7 -6
  9. package/build/components/ai-control/index.js +6 -6
  10. package/build/components/ai-control/message.d.ts +10 -0
  11. package/build/components/ai-control/message.js +15 -2
  12. package/build/components/ai-status-indicator/index.d.ts +1 -1
  13. package/build/components/audio-duration-display/index.d.ts +3 -2
  14. package/build/components/audio-duration-display/index.js +3 -14
  15. package/build/components/audio-duration-display/lib/media.d.ts +13 -14
  16. package/build/components/audio-duration-display/lib/media.js +7 -32
  17. package/build/components/index.d.ts +4 -4
  18. package/build/components/index.js +4 -4
  19. package/build/data-flow/context.d.ts +9 -6
  20. package/build/data-flow/context.js +1 -1
  21. package/build/data-flow/index.d.ts +3 -3
  22. package/build/data-flow/index.js +3 -3
  23. package/build/data-flow/use-ai-context.d.ts +3 -3
  24. package/build/data-flow/use-ai-context.js +3 -3
  25. package/build/data-flow/with-ai-assistant-data.js +2 -2
  26. package/build/hooks/use-ai-suggestions/index.d.ts +4 -4
  27. package/build/hooks/use-ai-suggestions/index.js +2 -2
  28. package/build/hooks/use-audio-transcription/index.d.ts +28 -0
  29. package/build/hooks/use-audio-transcription/index.js +56 -0
  30. package/build/hooks/use-media-recording/index.d.ts +34 -12
  31. package/build/hooks/use-media-recording/index.js +116 -41
  32. package/build/hooks/use-transcription-post-processing/index.d.ts +30 -0
  33. package/build/hooks/use-transcription-post-processing/index.js +84 -0
  34. package/build/icons/index.d.ts +7 -7
  35. package/build/icons/index.js +7 -7
  36. package/build/icons/mic.js +2 -2
  37. package/build/icons/player-pause.js +1 -1
  38. package/build/index.d.ts +12 -9
  39. package/build/index.js +12 -9
  40. package/build/jwt/index.js +4 -1
  41. package/build/suggestions-event-source/index.d.ts +1 -1
  42. package/build/suggestions-event-source/index.js +3 -3
  43. package/build/types.d.ts +9 -2
  44. package/build/types.js +4 -0
  45. package/package.json +5 -5
  46. package/src/api-fetch/index.ts +13 -0
  47. package/src/ask-question/index.ts +2 -2
  48. package/src/audio-transcription/index.ts +75 -0
  49. package/src/components/ai-control/index.tsx +12 -16
  50. package/src/components/ai-control/message.tsx +34 -2
  51. package/src/components/ai-control/style.scss +6 -0
  52. package/src/components/ai-status-indicator/index.tsx +1 -1
  53. package/src/components/audio-duration-display/index.tsx +6 -17
  54. package/src/components/audio-duration-display/lib/media.ts +17 -40
  55. package/src/components/index.ts +8 -4
  56. package/src/data-flow/context.tsx +7 -8
  57. package/src/data-flow/index.ts +3 -3
  58. package/src/data-flow/use-ai-context.ts +6 -6
  59. package/src/data-flow/with-ai-assistant-data.tsx +2 -2
  60. package/src/hooks/use-ai-suggestions/index.ts +6 -6
  61. package/src/hooks/use-audio-transcription/index.ts +95 -0
  62. package/src/hooks/use-media-recording/Readme.md +2 -2
  63. package/src/hooks/use-media-recording/index.ts +179 -59
  64. package/src/hooks/use-transcription-post-processing/index.ts +135 -0
  65. package/src/icons/index.ts +7 -7
  66. package/src/icons/mic.tsx +14 -16
  67. package/src/icons/player-pause.tsx +5 -5
  68. package/src/index.ts +12 -9
  69. package/src/jwt/index.ts +4 -1
  70. package/src/suggestions-event-source/index.ts +4 -4
  71. package/src/types.ts +29 -2
package/src/types.ts CHANGED
@@ -31,8 +31,25 @@ export type PromptProp = PromptMessagesProp | string;
31
31
  /*
32
32
  * Data Flow types
33
33
  */
34
- export type { UseAiContextOptions } from './data-flow/use-ai-context';
35
- export type { RequestingErrorProps } from './hooks/use-ai-suggestions';
34
+ export type { UseAiContextOptions } from './data-flow/use-ai-context.js';
35
+
36
+ /*
37
+ * Hook types
38
+ */
39
+ export type { RequestingErrorProps } from './hooks/use-ai-suggestions/index.js';
40
+ export type {
41
+ UseAudioTranscriptionProps,
42
+ UseAudioTranscriptionReturn,
43
+ } from './hooks/use-audio-transcription/index.js';
44
+ export type {
45
+ UseTranscriptionPostProcessingProps,
46
+ UseTranscriptionPostProcessingReturn,
47
+ PostProcessingAction,
48
+ } from './hooks/use-transcription-post-processing/index.js';
49
+ /*
50
+ * Hook constants
51
+ */
52
+ export { TRANSCRIPTION_POST_PROCESSING_ACTION_SIMPLE_DRAFT } from './hooks/use-transcription-post-processing/index.js';
36
53
 
37
54
  /*
38
55
  * Requests types
@@ -61,6 +78,16 @@ export const AI_MODEL_GPT_4 = 'gpt-4' as const;
61
78
 
62
79
  export type AiModelTypeProp = typeof AI_MODEL_GPT_3_5_Turbo_16K | typeof AI_MODEL_GPT_4;
63
80
 
81
+ /*
82
+ * Media recording types
83
+ */
84
+ export type { RecordingState } from './hooks/use-media-recording/index.js';
85
+
86
+ /*
87
+ * Utility types
88
+ */
89
+ export type CancelablePromise< T = void > = Promise< T > & { canceled?: boolean };
90
+
64
91
  // Connection initial state
65
92
  // @todo: it should be provided by the connection package
66
93
  interface JPConnectionInitialState {