@automattic/jetpack-ai-client 0.27.7 → 0.27.8
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 +9 -1
- package/build/ask-question/index.d.ts +2 -2
- package/build/ask-question/index.js +1 -1
- package/build/ask-question/sync.d.ts +2 -2
- package/build/ask-question/sync.js +1 -1
- package/build/audio-transcription/index.js +1 -1
- package/build/chrome-ai/factory.d.ts +2 -2
- package/build/chrome-ai/factory.js +2 -2
- package/build/chrome-ai/index.d.ts +2 -2
- package/build/chrome-ai/index.js +2 -2
- package/build/chrome-ai/suggestions.d.ts +1 -1
- package/build/chrome-ai/suggestions.js +4 -4
- package/build/components/ai-control/ai-control.d.ts +1 -1
- package/build/components/ai-control/ai-control.js +1 -1
- package/build/components/ai-control/block-ai-control.d.ts +1 -1
- package/build/components/ai-control/block-ai-control.js +2 -2
- package/build/components/ai-control/extension-ai-control.d.ts +1 -1
- package/build/components/ai-control/extension-ai-control.js +2 -2
- package/build/components/ai-control/index.d.ts +3 -3
- package/build/components/ai-control/index.js +3 -3
- package/build/components/ai-image/components/ai-image-modal.d.ts +2 -2
- package/build/components/ai-image/components/ai-image-modal.js +7 -7
- package/build/components/ai-image/components/carrousel.js +2 -2
- package/build/components/ai-image/featured-image.js +8 -8
- package/build/components/ai-image/general-purpose-image.js +7 -7
- package/build/components/ai-image/hooks/use-ai-image.d.ts +3 -3
- package/build/components/ai-image/hooks/use-ai-image.js +5 -5
- package/build/components/ai-image/index.d.ts +3 -3
- package/build/components/ai-image/index.js +3 -3
- package/build/components/ai-status-indicator/index.d.ts +1 -1
- package/build/components/audio-duration-display/index.js +1 -1
- package/build/components/index.d.ts +10 -10
- package/build/components/index.js +10 -10
- package/build/components/message/index.d.ts +1 -1
- package/build/components/message/index.js +3 -3
- package/build/components/modal/index.d.ts +1 -1
- package/build/components/modal/index.js +1 -1
- package/build/components/quota-exceeded-message/index.js +3 -3
- package/build/data-flow/context.d.ts +4 -4
- package/build/data-flow/index.d.ts +3 -3
- package/build/data-flow/index.js +3 -3
- package/build/data-flow/use-ai-context.d.ts +3 -3
- package/build/data-flow/use-ai-context.js +2 -2
- package/build/data-flow/with-ai-assistant-data.js +2 -2
- package/build/hooks/use-ai-checkout/index.js +1 -1
- package/build/hooks/use-ai-suggestions/index.d.ts +3 -3
- package/build/hooks/use-ai-suggestions/index.js +3 -3
- package/build/hooks/use-audio-transcription/index.js +1 -1
- package/build/hooks/use-image-generator/index.d.ts +1 -1
- package/build/hooks/use-image-generator/index.js +3 -3
- package/build/hooks/use-post-content.js +1 -1
- package/build/hooks/use-transcription-post-processing/index.js +1 -1
- package/build/icons/index.d.ts +7 -7
- package/build/icons/index.js +7 -7
- package/build/index.d.ts +23 -23
- package/build/index.js +23 -23
- package/build/jwt/index.js +1 -1
- package/build/libs/get-all-blocks.d.ts +1 -1
- package/build/libs/index.d.ts +7 -7
- package/build/libs/index.js +6 -6
- package/build/libs/map-action-to-human-text.js +1 -1
- package/build/libs/markdown/index.d.ts +3 -3
- package/build/libs/markdown/index.js +2 -2
- package/build/logo-generator/components/fair-usage-notice.js +1 -1
- package/build/logo-generator/components/first-load-screen.js +1 -1
- package/build/logo-generator/components/generator-modal.d.ts +1 -1
- package/build/logo-generator/components/generator-modal.js +14 -14
- package/build/logo-generator/components/history-carousel.js +2 -2
- package/build/logo-generator/components/logo-presenter.d.ts +1 -1
- package/build/logo-generator/components/logo-presenter.js +10 -10
- package/build/logo-generator/components/prompt.js +8 -8
- package/build/logo-generator/components/upgrade-nudge.js +3 -3
- package/build/logo-generator/components/upgrade-screen.js +2 -2
- package/build/logo-generator/hooks/use-checkout.js +1 -1
- package/build/logo-generator/hooks/use-fair-usage-notice-message.js +1 -1
- package/build/logo-generator/hooks/use-logo-generator.d.ts +3 -3
- package/build/logo-generator/hooks/use-logo-generator.js +8 -8
- package/build/logo-generator/hooks/use-request-errors.d.ts +6 -6
- package/build/logo-generator/hooks/use-request-errors.js +1 -1
- package/build/logo-generator/index.d.ts +2 -2
- package/build/logo-generator/index.js +2 -2
- package/build/logo-generator/lib/logo-storage.d.ts +2 -2
- package/build/logo-generator/lib/logo-storage.js +1 -1
- package/build/logo-generator/lib/media-exists.d.ts +1 -1
- package/build/logo-generator/lib/media-exists.js +1 -1
- package/build/logo-generator/lib/set-site-logo.d.ts +1 -1
- package/build/logo-generator/lib/set-site-logo.js +1 -1
- package/build/logo-generator/lib/wpcom-limited-request.js +1 -1
- package/build/logo-generator/store/actions.d.ts +2 -2
- package/build/logo-generator/store/actions.js +3 -3
- package/build/logo-generator/store/index.js +3 -3
- package/build/logo-generator/store/initial-state.d.ts +1 -1
- package/build/logo-generator/store/initial-state.js +1 -1
- package/build/logo-generator/store/reducer.d.ts +24 -24
- package/build/logo-generator/store/reducer.js +3 -3
- package/build/logo-generator/store/selectors.d.ts +2 -2
- package/build/logo-generator/store/selectors.js +1 -1
- package/build/logo-generator/store/types.d.ts +2 -2
- package/build/logo-generator/types.d.ts +1 -1
- package/build/suggestions-event-source/index.d.ts +1 -1
- package/build/suggestions-event-source/index.js +3 -3
- package/build/types.d.ts +8 -8
- package/build/types.js +1 -1
- package/package.json +5 -5
- package/src/ask-question/index.ts +2 -2
- package/src/ask-question/sync.ts +3 -3
- package/src/audio-transcription/index.ts +1 -1
- package/src/chrome-ai/factory.ts +3 -3
- package/src/chrome-ai/index.ts +2 -2
- package/src/chrome-ai/suggestions.ts +4 -4
- package/src/components/ai-control/ai-control.tsx +2 -2
- package/src/components/ai-control/block-ai-control.tsx +3 -3
- package/src/components/ai-control/extension-ai-control.tsx +3 -3
- package/src/components/ai-control/index.tsx +3 -3
- package/src/components/ai-image/components/ai-image-modal.tsx +7 -7
- package/src/components/ai-image/components/carrousel.scss +4 -4
- package/src/components/ai-image/components/carrousel.tsx +2 -2
- package/src/components/ai-image/components/usage-counter.scss +1 -1
- package/src/components/ai-image/featured-image.tsx +11 -11
- package/src/components/ai-image/general-purpose-image.tsx +7 -7
- package/src/components/ai-image/hooks/use-ai-image.ts +8 -8
- package/src/components/ai-image/index.ts +3 -3
- package/src/components/ai-status-indicator/index.tsx +1 -1
- package/src/components/audio-duration-display/index.tsx +1 -1
- package/src/components/index.ts +10 -10
- package/src/components/message/index.tsx +4 -4
- package/src/components/modal/index.tsx +2 -2
- package/src/components/quota-exceeded-message/index.tsx +3 -3
- package/src/components/quota-exceeded-message/style.scss +1 -1
- package/src/data-flow/context.tsx +4 -4
- package/src/data-flow/index.ts +3 -3
- package/src/data-flow/use-ai-context.ts +4 -4
- package/src/data-flow/with-ai-assistant-data.tsx +2 -2
- package/src/hooks/use-ai-checkout/index.ts +1 -1
- package/src/hooks/use-ai-suggestions/index.ts +6 -6
- package/src/hooks/use-audio-transcription/index.ts +1 -1
- package/src/hooks/use-image-generator/index.ts +3 -3
- package/src/hooks/use-post-content.ts +1 -1
- package/src/hooks/use-save-to-media-library/index.ts +1 -1
- package/src/hooks/use-save-to-media-library.ts +1 -1
- package/src/hooks/use-transcription-post-processing/index.ts +2 -2
- package/src/icons/index.ts +7 -7
- package/src/index.ts +23 -23
- package/src/jwt/index.ts +1 -1
- package/src/libs/get-all-blocks.ts +1 -1
- package/src/libs/index.ts +7 -7
- package/src/libs/map-action-to-human-text.ts +1 -1
- package/src/libs/markdown/index.ts +3 -3
- package/src/logo-generator/components/fair-usage-notice.tsx +1 -1
- package/src/logo-generator/components/first-load-screen.tsx +1 -1
- package/src/logo-generator/components/generator-modal.tsx +15 -15
- package/src/logo-generator/components/history-carousel.tsx +2 -2
- package/src/logo-generator/components/logo-presenter.tsx +12 -12
- package/src/logo-generator/components/prompt.tsx +9 -9
- package/src/logo-generator/components/upgrade-nudge.tsx +3 -3
- package/src/logo-generator/components/upgrade-screen.tsx +2 -2
- package/src/logo-generator/hooks/use-checkout.ts +2 -2
- package/src/logo-generator/hooks/use-fair-usage-notice-message.tsx +2 -2
- package/src/logo-generator/hooks/use-logo-generator.ts +11 -11
- package/src/logo-generator/hooks/use-request-errors.ts +2 -2
- package/src/logo-generator/index.ts +2 -2
- package/src/logo-generator/lib/logo-storage.ts +3 -3
- package/src/logo-generator/lib/media-exists.ts +2 -2
- package/src/logo-generator/lib/set-site-logo.ts +2 -2
- package/src/logo-generator/lib/wpcom-limited-request.ts +1 -1
- package/src/logo-generator/store/actions.ts +5 -5
- package/src/logo-generator/store/index.ts +3 -3
- package/src/logo-generator/store/initial-state.ts +2 -2
- package/src/logo-generator/store/reducer.ts +5 -5
- package/src/logo-generator/store/selectors.ts +3 -3
- package/src/logo-generator/store/types.ts +2 -2
- package/src/logo-generator/types.ts +1 -1
- package/src/suggestions-event-source/index.ts +4 -4
- package/src/types.ts +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.27.8] - 2025-04-14
|
|
9
|
+
### Changed
|
|
10
|
+
- Adjust relative imports in TypeScript sources to use correct extensions after enabling TypeScript's new `rewriteRelativeImportExtensions` option. [#42990]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Linting: Update stylesheets to use WordPress rules for fonts and colors. [#42920] [#42928]
|
|
14
|
+
|
|
8
15
|
## [0.27.7] - 2025-04-07
|
|
9
16
|
### Changed
|
|
10
|
-
-
|
|
17
|
+
- Linting: First pass of style coding standards. [#42734]
|
|
11
18
|
- Update package dependencies. [#42762] [#42809]
|
|
12
19
|
|
|
13
20
|
### Fixed
|
|
@@ -584,6 +591,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
584
591
|
- AI Client: stop using smart document visibility handling on the fetchEventSource library, so it does not restart the completion when changing tabs. [#32004]
|
|
585
592
|
- Updated package dependencies. [#31468] [#31659] [#31785]
|
|
586
593
|
|
|
594
|
+
[0.27.8]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.7...v0.27.8
|
|
587
595
|
[0.27.7]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.6...v0.27.7
|
|
588
596
|
[0.27.6]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.5...v0.27.6
|
|
589
597
|
[0.27.5]: https://github.com/Automattic/jetpack-ai-client/compare/v0.27.4...v0.27.5
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import SuggestionsEventSource from '../suggestions-event-source/index.
|
|
2
|
-
import type { AiModelTypeProp, PromptProp } from '../types.
|
|
1
|
+
import SuggestionsEventSource from '../suggestions-event-source/index.ts';
|
|
2
|
+
import type { AiModelTypeProp, PromptProp } from '../types.ts';
|
|
3
3
|
export type AskQuestionOptionsArgProps = {
|
|
4
4
|
postId?: number;
|
|
5
5
|
fromCache?: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import debugFactory from 'debug';
|
|
5
|
-
import SuggestionsEventSource from
|
|
5
|
+
import SuggestionsEventSource from "../suggestions-event-source/index.js";
|
|
6
6
|
const debug = debugFactory('jetpack-ai-client:ask-question');
|
|
7
7
|
/**
|
|
8
8
|
* An asynchronous function that asks a question
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AskQuestionOptionsArgProps } from './index.
|
|
2
|
-
import type { PromptProp } from '../types.
|
|
1
|
+
import { AskQuestionOptionsArgProps } from './index.ts';
|
|
2
|
+
import type { PromptProp } from '../types.ts';
|
|
3
3
|
/**
|
|
4
4
|
* The response data from the AI assistant when doing a sync, not-streamed question.
|
|
5
5
|
*/
|
|
@@ -5,7 +5,7 @@ import debugFactory from 'debug';
|
|
|
5
5
|
/*
|
|
6
6
|
* Types & constants
|
|
7
7
|
*/
|
|
8
|
-
import requestJwt from
|
|
8
|
+
import requestJwt from "../jwt/index.js";
|
|
9
9
|
const debug = debugFactory('jetpack-ai-client:ask-question-sync');
|
|
10
10
|
/**
|
|
11
11
|
* A function that asks a question without streaming.
|
|
@@ -5,7 +5,7 @@ import debugFactory from 'debug';
|
|
|
5
5
|
/**
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
|
-
import requestJwt from
|
|
8
|
+
import requestJwt from "../jwt/index.js";
|
|
9
9
|
const debug = debugFactory('jetpack-ai-client:audio-transcription');
|
|
10
10
|
/**
|
|
11
11
|
* A function that takes an audio blob and transcribes it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PromptProp } from '../types.
|
|
2
|
-
import ChromeAISuggestionsEventSource from './suggestions.
|
|
1
|
+
import { PromptProp } from '../types.ts';
|
|
2
|
+
import ChromeAISuggestionsEventSource from './suggestions.ts';
|
|
3
3
|
/**
|
|
4
4
|
* This will return an instance of ChromeAISuggestionsEventSource or false.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getJetpackExtensionAvailability } from '@automattic/jetpack-shared-extension-utils';
|
|
2
|
-
import { PROMPT_TYPE_CHANGE_LANGUAGE, PROMPT_TYPE_SUMMARIZE } from
|
|
3
|
-
import ChromeAISuggestionsEventSource from
|
|
2
|
+
import { PROMPT_TYPE_CHANGE_LANGUAGE, PROMPT_TYPE_SUMMARIZE } from "../constants.js";
|
|
3
|
+
import ChromeAISuggestionsEventSource from "./suggestions.js";
|
|
4
4
|
/**
|
|
5
5
|
* Check for the feature flag.
|
|
6
6
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as ChromeAIFactory } from './factory.
|
|
2
|
-
export { default as ChromeAISuggestionsEventSource } from './suggestions.
|
|
1
|
+
export { default as ChromeAIFactory } from './factory.ts';
|
|
2
|
+
export { default as ChromeAISuggestionsEventSource } from './suggestions.ts';
|
package/build/chrome-ai/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as ChromeAIFactory } from
|
|
2
|
-
export { default as ChromeAISuggestionsEventSource } from
|
|
1
|
+
export { default as ChromeAIFactory } from "./factory.js";
|
|
2
|
+
export { default as ChromeAISuggestionsEventSource } from "./suggestions.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PROMPT_TYPE_CHANGE_LANGUAGE, PROMPT_TYPE_SUMMARIZE } from
|
|
2
|
-
import { getErrorData } from
|
|
3
|
-
import { renderHTMLFromMarkdown, renderMarkdownFromHTML } from
|
|
4
|
-
import { ERROR_RESPONSE, ERROR_NETWORK } from
|
|
1
|
+
import { PROMPT_TYPE_CHANGE_LANGUAGE, PROMPT_TYPE_SUMMARIZE } from "../constants.js";
|
|
2
|
+
import { getErrorData } from "../hooks/use-ai-suggestions/index.js";
|
|
3
|
+
import { renderHTMLFromMarkdown, renderMarkdownFromHTML } from "../libs/markdown/index.js";
|
|
4
|
+
import { ERROR_RESPONSE, ERROR_NETWORK } from "../types.js";
|
|
5
5
|
export default class ChromeAISuggestionsEventSource extends EventTarget {
|
|
6
6
|
fullMessage;
|
|
7
7
|
fullFunctionCall;
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import AiStatusIndicator from
|
|
10
|
+
import AiStatusIndicator from "../ai-status-indicator/index.js";
|
|
11
11
|
import './style.scss';
|
|
12
12
|
/**
|
|
13
13
|
* Base AIControl component. Contains the main structure of the control component and slots for banner, error, actions and message.
|
|
@@ -12,8 +12,8 @@ import { forwardRef } from 'react';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import { GuidelineMessage } from
|
|
16
|
-
import AIControl from
|
|
15
|
+
import { GuidelineMessage } from "../message/index.js";
|
|
16
|
+
import AIControl from "./ai-control.js";
|
|
17
17
|
import './style.scss';
|
|
18
18
|
const debug = debugFactory('jetpack-ai-client:block-ai-control');
|
|
19
19
|
/**
|
|
@@ -3,7 +3,7 @@ import './style.scss';
|
|
|
3
3
|
/**
|
|
4
4
|
* Types
|
|
5
5
|
*/
|
|
6
|
-
import type { RequestingErrorProps, RequestingStateProp } from '../../types.
|
|
6
|
+
import type { RequestingErrorProps, RequestingStateProp } from '../../types.ts';
|
|
7
7
|
import type { ReactElement, MouseEvent } from 'react';
|
|
8
8
|
type ExtensionAIControlProps = {
|
|
9
9
|
className?: string;
|
|
@@ -11,8 +11,8 @@ import { forwardRef } from 'react';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { GuidelineMessage, ErrorMessage, UpgradeMessage, FairUsageLimitMessage, } from
|
|
15
|
-
import AIControl from
|
|
14
|
+
import { GuidelineMessage, ErrorMessage, UpgradeMessage, FairUsageLimitMessage, } from "../message/index.js";
|
|
15
|
+
import AIControl from "./ai-control.js";
|
|
16
16
|
import './style.scss';
|
|
17
17
|
/**
|
|
18
18
|
* ExtensionAIControl component. Used by the AI Assistant inline extensions, adding logic and components to the base AIControl component.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as AIControl } from './ai-control.
|
|
2
|
-
export { default as BlockAIControl } from './block-ai-control.
|
|
3
|
-
export { default as ExtensionAIControl } from './extension-ai-control.
|
|
1
|
+
export { default as AIControl } from './ai-control.tsx';
|
|
2
|
+
export { default as BlockAIControl } from './block-ai-control.tsx';
|
|
3
|
+
export { default as ExtensionAIControl } from './extension-ai-control.tsx';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as AIControl } from
|
|
2
|
-
export { default as BlockAIControl } from
|
|
3
|
-
export { default as ExtensionAIControl } from
|
|
1
|
+
export { default as AIControl } from "./ai-control.js";
|
|
2
|
+
export { default as BlockAIControl } from "./block-ai-control.js";
|
|
3
|
+
export { default as ExtensionAIControl } from "./extension-ai-control.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { ImageStyleObject, ImageStyle } from '../../../hooks/use-image-generator/constants.
|
|
5
|
-
import { CarrouselImages } from './carrousel.
|
|
4
|
+
import { ImageStyleObject, ImageStyle } from '../../../hooks/use-image-generator/constants.ts';
|
|
5
|
+
import { CarrouselImages } from './carrousel.tsx';
|
|
6
6
|
import './ai-image-modal.scss';
|
|
7
7
|
type AiImageModalProps = {
|
|
8
8
|
title: string;
|
|
@@ -10,13 +10,13 @@ import debugFactory from 'debug';
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import { IMAGE_STYLE_NONE, IMAGE_STYLE_AUTO, } from
|
|
14
|
-
import { AiModalPromptInput } from
|
|
15
|
-
import AiModalFooter from
|
|
16
|
-
import AiAssistantModal from
|
|
17
|
-
import QuotaExceededMessage from
|
|
18
|
-
import Carrousel from
|
|
19
|
-
import UsageCounter from
|
|
13
|
+
import { IMAGE_STYLE_NONE, IMAGE_STYLE_AUTO, } from "../../../hooks/use-image-generator/constants.js";
|
|
14
|
+
import { AiModalPromptInput } from "../../../logo-generator/index.js";
|
|
15
|
+
import AiModalFooter from "../../ai-modal-footer/index.js";
|
|
16
|
+
import AiAssistantModal from "../../modal/index.js";
|
|
17
|
+
import QuotaExceededMessage from "../../quota-exceeded-message/index.js";
|
|
18
|
+
import Carrousel from "./carrousel.js";
|
|
19
|
+
import UsageCounter from "./usage-counter.js";
|
|
20
20
|
import './ai-image-modal.scss';
|
|
21
21
|
const FEATURED_IMAGE_UPGRADE_PROMPT_PLACEMENT = 'ai-image-generator';
|
|
22
22
|
const debug = debugFactory('jetpack-ai-client:ai-image-modal');
|
|
@@ -10,8 +10,8 @@ import clsx from 'clsx';
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import AiFeedbackThumbs from
|
|
14
|
-
import AiIcon from
|
|
13
|
+
import AiFeedbackThumbs from "../../ai-feedback/index.js";
|
|
14
|
+
import AiIcon from "../../ai-icon/index.js";
|
|
15
15
|
import './carrousel.scss';
|
|
16
16
|
/**
|
|
17
17
|
* BlankImage component
|
|
@@ -13,14 +13,14 @@ import debugFactory from 'debug';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import './style.scss';
|
|
16
|
-
import { PLACEMENT_JETPACK_SIDEBAR, PLACEMENT_DOCUMENT_SETTINGS } from
|
|
17
|
-
import useAiFeature from
|
|
18
|
-
import usePostContent from
|
|
19
|
-
import useSaveToMediaLibrary from
|
|
20
|
-
import AiImageModal from
|
|
21
|
-
import useAiImage from
|
|
22
|
-
import useSiteType from
|
|
23
|
-
import { FEATURED_IMAGE_FEATURE_NAME, IMAGE_GENERATION_MODEL_STABLE_DIFFUSION, IMAGE_GENERATION_MODEL_DALL_E_3, PLACEMENT_MEDIA_SOURCE_DROPDOWN, } from
|
|
16
|
+
import { PLACEMENT_JETPACK_SIDEBAR, PLACEMENT_DOCUMENT_SETTINGS } from "../../constants.js";
|
|
17
|
+
import useAiFeature from "../../hooks/use-ai-feature/index.js";
|
|
18
|
+
import usePostContent from "../../hooks/use-post-content.js";
|
|
19
|
+
import useSaveToMediaLibrary from "../../hooks/use-save-to-media-library.js";
|
|
20
|
+
import AiImageModal from "./components/ai-image-modal.js";
|
|
21
|
+
import useAiImage from "./hooks/use-ai-image.js";
|
|
22
|
+
import useSiteType from "./hooks/use-site-type.js";
|
|
23
|
+
import { FEATURED_IMAGE_FEATURE_NAME, IMAGE_GENERATION_MODEL_STABLE_DIFFUSION, IMAGE_GENERATION_MODEL_DALL_E_3, PLACEMENT_MEDIA_SOURCE_DROPDOWN, } from "./types.js";
|
|
24
24
|
const debug = debugFactory('jetpack-ai-client:featured-image');
|
|
25
25
|
/**
|
|
26
26
|
* FeaturedImage component
|
|
@@ -11,13 +11,13 @@ import debugFactory from 'debug';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import './style.scss';
|
|
14
|
-
import useAiFeature from
|
|
15
|
-
import usePostContent from
|
|
16
|
-
import useSaveToMediaLibrary from
|
|
17
|
-
import AiImageModal from
|
|
18
|
-
import useAiImage from
|
|
19
|
-
import useSiteType from
|
|
20
|
-
import { IMAGE_GENERATION_MODEL_STABLE_DIFFUSION, IMAGE_GENERATION_MODEL_DALL_E_3, GENERAL_IMAGE_FEATURE_NAME, } from
|
|
14
|
+
import useAiFeature from "../../hooks/use-ai-feature/index.js";
|
|
15
|
+
import usePostContent from "../../hooks/use-post-content.js";
|
|
16
|
+
import useSaveToMediaLibrary from "../../hooks/use-save-to-media-library.js";
|
|
17
|
+
import AiImageModal from "./components/ai-image-modal.js";
|
|
18
|
+
import useAiImage from "./hooks/use-ai-image.js";
|
|
19
|
+
import useSiteType from "./hooks/use-site-type.js";
|
|
20
|
+
import { IMAGE_GENERATION_MODEL_STABLE_DIFFUSION, IMAGE_GENERATION_MODEL_DALL_E_3, GENERAL_IMAGE_FEATURE_NAME, } from "./types.js";
|
|
21
21
|
const debug = debugFactory('jetpack-ai:general-purpose-image');
|
|
22
22
|
/**
|
|
23
23
|
* GeneralPurposeImage component
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ImageStyleObject, ImageStyle } from '../../../hooks/use-image-generator/constants.
|
|
2
|
+
import { ImageStyleObject, ImageStyle } from '../../../hooks/use-image-generator/constants.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Types
|
|
5
5
|
*/
|
|
6
|
-
import { FEATURED_IMAGE_FEATURE_NAME, GENERAL_IMAGE_FEATURE_NAME } from '../types.
|
|
7
|
-
import type { CarrouselImageData, CarrouselImages } from '../components/carrousel.
|
|
6
|
+
import { FEATURED_IMAGE_FEATURE_NAME, GENERAL_IMAGE_FEATURE_NAME } from '../types.ts';
|
|
7
|
+
import type { CarrouselImageData, CarrouselImages } from '../components/carrousel.tsx';
|
|
8
8
|
type AiImageType = 'featured-image-generation' | 'general-image-generation';
|
|
9
9
|
type AiImageFeature = typeof FEATURED_IMAGE_FEATURE_NAME | typeof GENERAL_IMAGE_FEATURE_NAME;
|
|
10
10
|
export type ImageResponse = {
|
|
@@ -8,14 +8,14 @@ import { cleanForSlug } from '@wordpress/url';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import askQuestionSync from
|
|
12
|
-
import useAiFeature from
|
|
13
|
-
import useImageGenerator from
|
|
14
|
-
import useSaveToMediaLibrary from
|
|
11
|
+
import askQuestionSync from "../../../ask-question/sync.js";
|
|
12
|
+
import useAiFeature from "../../../hooks/use-ai-feature/index.js";
|
|
13
|
+
import useImageGenerator from "../../../hooks/use-image-generator/index.js";
|
|
14
|
+
import useSaveToMediaLibrary from "../../../hooks/use-save-to-media-library.js";
|
|
15
15
|
/**
|
|
16
16
|
* Types
|
|
17
17
|
*/
|
|
18
|
-
import { FEATURED_IMAGE_FEATURE_NAME, } from
|
|
18
|
+
import { FEATURED_IMAGE_FEATURE_NAME, } from "../types.js";
|
|
19
19
|
/**
|
|
20
20
|
* Hook to get properties for AiImage
|
|
21
21
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FeaturedImage from './featured-image.
|
|
2
|
-
import GeneralPurposeImage from './general-purpose-image.
|
|
3
|
-
import { PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON } from './types.
|
|
1
|
+
import FeaturedImage from './featured-image.tsx';
|
|
2
|
+
import GeneralPurposeImage from './general-purpose-image.tsx';
|
|
3
|
+
import { PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON } from './types.ts';
|
|
4
4
|
export { FeaturedImage, PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON, GeneralPurposeImage, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FeaturedImage from
|
|
2
|
-
import GeneralPurposeImage from
|
|
3
|
-
import { PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON } from
|
|
1
|
+
import FeaturedImage from "./featured-image.js";
|
|
2
|
+
import GeneralPurposeImage from "./general-purpose-image.js";
|
|
3
|
+
import { PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON } from "./types.js";
|
|
4
4
|
export { FeaturedImage, PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON, GeneralPurposeImage, };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { AIControl, BlockAIControl, ExtensionAIControl } from './ai-control/index.
|
|
2
|
-
export { default as AiFeedbackThumbs } from './ai-feedback/index.
|
|
3
|
-
export { default as AiIcon, AiSVG } from './ai-icon/index.
|
|
4
|
-
export { FeaturedImage, GeneralPurposeImage, PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON, } from './ai-image/index.
|
|
5
|
-
export { default as AiStatusIndicator } from './ai-status-indicator/index.
|
|
6
|
-
export { default as AudioDurationDisplay } from './audio-duration-display/index.
|
|
7
|
-
export { default as AiModalFooter } from './ai-modal-footer/index.
|
|
8
|
-
export { GuidelineMessage, UpgradeMessage, ErrorMessage, default as FooterMessage, } from './message/index.
|
|
9
|
-
export { default as AiAssistantModal } from './modal/index.
|
|
10
|
-
export { default as QuotaExceededMessage, FairUsageNotice, } from './quota-exceeded-message/index.
|
|
1
|
+
export { AIControl, BlockAIControl, ExtensionAIControl } from './ai-control/index.tsx';
|
|
2
|
+
export { default as AiFeedbackThumbs } from './ai-feedback/index.tsx';
|
|
3
|
+
export { default as AiIcon, AiSVG } from './ai-icon/index.tsx';
|
|
4
|
+
export { FeaturedImage, GeneralPurposeImage, PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON, } from './ai-image/index.ts';
|
|
5
|
+
export { default as AiStatusIndicator } from './ai-status-indicator/index.tsx';
|
|
6
|
+
export { default as AudioDurationDisplay } from './audio-duration-display/index.tsx';
|
|
7
|
+
export { default as AiModalFooter } from './ai-modal-footer/index.tsx';
|
|
8
|
+
export { GuidelineMessage, UpgradeMessage, ErrorMessage, default as FooterMessage, } from './message/index.tsx';
|
|
9
|
+
export { default as AiAssistantModal } from './modal/index.tsx';
|
|
10
|
+
export { default as QuotaExceededMessage, FairUsageNotice, } from './quota-exceeded-message/index.tsx';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { AIControl, BlockAIControl, ExtensionAIControl } from
|
|
2
|
-
export { default as AiFeedbackThumbs } from
|
|
3
|
-
export { default as AiIcon, AiSVG } from
|
|
4
|
-
export { FeaturedImage, GeneralPurposeImage, PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON, } from
|
|
5
|
-
export { default as AiStatusIndicator } from
|
|
6
|
-
export { default as AudioDurationDisplay } from
|
|
7
|
-
export { default as AiModalFooter } from
|
|
8
|
-
export { GuidelineMessage, UpgradeMessage, ErrorMessage, default as FooterMessage, } from
|
|
9
|
-
export { default as AiAssistantModal } from
|
|
10
|
-
export { default as QuotaExceededMessage, FairUsageNotice, } from
|
|
1
|
+
export { AIControl, BlockAIControl, ExtensionAIControl } from "./ai-control/index.js";
|
|
2
|
+
export { default as AiFeedbackThumbs } from "./ai-feedback/index.js";
|
|
3
|
+
export { default as AiIcon, AiSVG } from "./ai-icon/index.js";
|
|
4
|
+
export { FeaturedImage, GeneralPurposeImage, PLACEMENT_MEDIA_SOURCE_DROPDOWN, PLACEMENT_BLOCK_PLACEHOLDER_BUTTON, } from "./ai-image/index.js";
|
|
5
|
+
export { default as AiStatusIndicator } from "./ai-status-indicator/index.js";
|
|
6
|
+
export { default as AudioDurationDisplay } from "./audio-duration-display/index.js";
|
|
7
|
+
export { default as AiModalFooter } from "./ai-modal-footer/index.js";
|
|
8
|
+
export { GuidelineMessage, UpgradeMessage, ErrorMessage, default as FooterMessage, } from "./message/index.js";
|
|
9
|
+
export { default as AiAssistantModal } from "./modal/index.js";
|
|
10
|
+
export { default as QuotaExceededMessage, FairUsageNotice, } from "./quota-exceeded-message/index.js";
|
|
@@ -5,7 +5,7 @@ import './style.scss';
|
|
|
5
5
|
/**
|
|
6
6
|
* Types
|
|
7
7
|
*/
|
|
8
|
-
import type { SuggestionErrorCode } from '../../types.
|
|
8
|
+
import type { SuggestionErrorCode } from '../../types.ts';
|
|
9
9
|
import type React from 'react';
|
|
10
10
|
export declare const MESSAGE_SEVERITY_WARNING = "warning";
|
|
11
11
|
export declare const MESSAGE_SEVERITY_ERROR = "error";
|
|
@@ -11,9 +11,9 @@ import clsx from 'clsx';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import './style.scss';
|
|
14
|
-
import errorExclamation from
|
|
15
|
-
import { ERROR_QUOTA_EXCEEDED } from
|
|
16
|
-
import AiFeedbackThumbs from
|
|
14
|
+
import errorExclamation from "../../icons/error-exclamation.js";
|
|
15
|
+
import { ERROR_QUOTA_EXCEEDED } from "../../types.js";
|
|
16
|
+
import AiFeedbackThumbs from "../ai-feedback/index.js";
|
|
17
17
|
export const MESSAGE_SEVERITY_WARNING = 'warning';
|
|
18
18
|
export const MESSAGE_SEVERITY_ERROR = 'error';
|
|
19
19
|
export const MESSAGE_SEVERITY_SUCCESS = 'success';
|
|
@@ -8,7 +8,7 @@ import { close } from '@wordpress/icons';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import AiStatusIndicator from
|
|
11
|
+
import AiStatusIndicator from "../ai-status-indicator/index.js";
|
|
12
12
|
import './style.scss';
|
|
13
13
|
const ModalHeader = ({ requestingState, onClose, title, }) => {
|
|
14
14
|
return (_jsxs("div", { className: "ai-assistant-modal__header", children: [_jsxs("div", { className: "ai-assistant-modal__title-wrapper", children: [_jsx(AiStatusIndicator, { state: requestingState }), _jsx("h1", { className: "ai-assistant-modal__title", children: title })] }), _jsx(Button, { icon: close, label: __('Close', 'jetpack-ai-client'), onClick: onClose })] }));
|
|
@@ -12,9 +12,9 @@ import debugFactory from 'debug';
|
|
|
12
12
|
/*
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import useAICheckout from
|
|
16
|
-
import useAiFeature from
|
|
17
|
-
import { LightNudge } from
|
|
15
|
+
import useAICheckout from "../../hooks/use-ai-checkout/index.js";
|
|
16
|
+
import useAiFeature from "../../hooks/use-ai-feature/index.js";
|
|
17
|
+
import { LightNudge } from "./light-nudge.js";
|
|
18
18
|
import './style.scss';
|
|
19
19
|
const debug = debugFactory('jetpack-ai-client:upgrade-prompt');
|
|
20
20
|
/**
|
|
@@ -5,10 +5,10 @@ import React from 'react';
|
|
|
5
5
|
/**
|
|
6
6
|
* Types & Constants
|
|
7
7
|
*/
|
|
8
|
-
import SuggestionsEventSource from '../suggestions-event-source/index.
|
|
9
|
-
import type { AskQuestionOptionsArgProps } from '../ask-question/index.
|
|
10
|
-
import type { RequestingErrorProps } from '../hooks/use-ai-suggestions/index.
|
|
11
|
-
import type { PromptProp, RequestingStateProp } from '../types.
|
|
8
|
+
import SuggestionsEventSource from '../suggestions-event-source/index.ts';
|
|
9
|
+
import type { AskQuestionOptionsArgProps } from '../ask-question/index.ts';
|
|
10
|
+
import type { RequestingErrorProps } from '../hooks/use-ai-suggestions/index.ts';
|
|
11
|
+
import type { PromptProp, RequestingStateProp } from '../types.ts';
|
|
12
12
|
export type AiDataContextProps = {
|
|
13
13
|
suggestion: string;
|
|
14
14
|
requestingError: RequestingErrorProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AiDataContext, AiDataContextProvider } from './context.
|
|
2
|
-
export { default as withAiDataProvider } from './with-ai-assistant-data.
|
|
3
|
-
export { default as useAiContext } from './use-ai-context.
|
|
1
|
+
export { AiDataContext, AiDataContextProvider } from './context.tsx';
|
|
2
|
+
export { default as withAiDataProvider } from './with-ai-assistant-data.tsx';
|
|
3
|
+
export { default as useAiContext } from './use-ai-context.ts';
|
package/build/data-flow/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AiDataContext, AiDataContextProvider } from
|
|
2
|
-
export { default as withAiDataProvider } from
|
|
3
|
-
export { default as useAiContext } from
|
|
1
|
+
export { AiDataContext, AiDataContextProvider } from "./context.js";
|
|
2
|
+
export { default as withAiDataProvider } from "./with-ai-assistant-data.js";
|
|
3
|
+
export { default as useAiContext } from "./use-ai-context.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { RequestingErrorProps } from '../types.
|
|
4
|
+
import { RequestingErrorProps } from '../types.ts';
|
|
5
5
|
/**
|
|
6
6
|
* Types & constants
|
|
7
7
|
*/
|
|
8
|
-
import type { AiDataContextProps } from './context.
|
|
9
|
-
import type { AskQuestionOptionsArgProps } from '../ask-question/index.
|
|
8
|
+
import type { AiDataContextProps } from './context.tsx';
|
|
9
|
+
import type { AskQuestionOptionsArgProps } from '../ask-question/index.ts';
|
|
10
10
|
export type UseAiContextOptions = {
|
|
11
11
|
askQuestionOptions?: AskQuestionOptionsArgProps;
|
|
12
12
|
onDone?: (content: string) => void;
|
|
@@ -5,8 +5,8 @@ import { useCallback, useContext, useEffect } from 'react';
|
|
|
5
5
|
/**
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
|
-
import { ERROR_RESPONSE } from
|
|
9
|
-
import { AiDataContext } from
|
|
8
|
+
import { ERROR_RESPONSE } from "../types.js";
|
|
9
|
+
import { AiDataContext } from "./index.js";
|
|
10
10
|
/**
|
|
11
11
|
* useAiContext hook to provide access to
|
|
12
12
|
* the AI Assistant data (from context),
|
|
@@ -7,8 +7,8 @@ import { useMemo } from '@wordpress/element';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal Dependencies
|
|
9
9
|
*/
|
|
10
|
-
import useAiSuggestions from
|
|
11
|
-
import { AiDataContextProvider } from
|
|
10
|
+
import useAiSuggestions from "../hooks/use-ai-suggestions/index.js";
|
|
11
|
+
import { AiDataContextProvider } from "./index.js";
|
|
12
12
|
/**
|
|
13
13
|
* High Order Component that provides the
|
|
14
14
|
* AI Assistant Data context to the wrapped component.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import getRedirectUrl from '@automattic/jetpack-components/tools/jp-redirect';
|
|
5
5
|
import { isAtomicSite, isSimpleSite, getSiteFragment, useAutosaveAndRedirect, } from '@automattic/jetpack-shared-extension-utils';
|
|
6
|
-
import useAiFeature from
|
|
6
|
+
import useAiFeature from "../use-ai-feature/index.js";
|
|
7
7
|
const getWPComRedirectToURL = () => {
|
|
8
8
|
const searchParams = new URLSearchParams(window.location.search);
|
|
9
9
|
const site = getSiteFragment();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types & constants
|
|
3
3
|
*/
|
|
4
|
-
import type { AskQuestionOptionsArgProps } from '../../ask-question/index.
|
|
5
|
-
import type SuggestionsEventSource from '../../suggestions-event-source/index.
|
|
6
|
-
import type { PromptProp, SuggestionErrorCode, RequestingStateProp } from '../../types.
|
|
4
|
+
import type { AskQuestionOptionsArgProps } from '../../ask-question/index.ts';
|
|
5
|
+
import type SuggestionsEventSource from '../../suggestions-event-source/index.ts';
|
|
6
|
+
import type { PromptProp, SuggestionErrorCode, RequestingStateProp } from '../../types.ts';
|
|
7
7
|
export type RequestingErrorProps = {
|
|
8
8
|
code: SuggestionErrorCode;
|
|
9
9
|
message: string;
|
|
@@ -6,9 +6,9 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import askQuestion from
|
|
10
|
-
import ChromeAIFactory from
|
|
11
|
-
import { ERROR_CONTEXT_TOO_LARGE, ERROR_MODERATION, ERROR_NETWORK, ERROR_QUOTA_EXCEEDED, ERROR_SERVICE_UNAVAILABLE, ERROR_UNCLEAR_PROMPT, ERROR_RESPONSE, } from
|
|
9
|
+
import askQuestion from "../../ask-question/index.js";
|
|
10
|
+
import ChromeAIFactory from "../../chrome-ai/factory.js";
|
|
11
|
+
import { ERROR_CONTEXT_TOO_LARGE, ERROR_MODERATION, ERROR_NETWORK, ERROR_QUOTA_EXCEEDED, ERROR_SERVICE_UNAVAILABLE, ERROR_UNCLEAR_PROMPT, ERROR_RESPONSE, } from "../../types.js";
|
|
12
12
|
/**
|
|
13
13
|
* Get the error data for a given error code.
|
|
14
14
|
*
|