Skip to content

Commit

Permalink
AI Assistant: Remove dead code from transformative extensions (#39245)
Browse files Browse the repository at this point in the history
* remove old extensions code

* remove extension beta flag

* rename extensions folder

* changelog
  • Loading branch information
dhasilva authored Sep 6, 2024
1 parent b76b00d commit 52d9b5a
Show file tree
Hide file tree
Showing 36 changed files with 88 additions and 1,510 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

AI Assistant: Remove dead code from transformative extensions
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,6 @@ function () {
}
);

/**
* Register the `ai-assistant-extensions-support` extension.
*/
add_action(
'jetpack_register_gutenberg_extensions',
function () {
if ( apply_filters( 'jetpack_ai_enabled', true ) && apply_filters( 'jetpack_inline_extensions_enabled', false ) ) {
\Jetpack_Gutenberg::set_extension_available( 'ai-assistant-extensions-support' );
}
}
);

/**
* Register the `ai-assistant-experimental-image-generation-support` extension.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';
/**
* Internal dependencies
*/
import { EXTENDED_INLINE_BLOCKS } from '../../extensions/ai-assistant';
import { EXTENDED_BLOCKS } from '../../extensions/constants';
import {
PROMPT_TYPE_CHANGE_TONE,
PROMPT_TYPE_CORRECT_SPELLING,
Expand All @@ -27,7 +27,7 @@ import './style.scss';
/**
* Types and constants
*/
import type { ExtendedBlockProp, ExtendedInlineBlockProp } from '../../extensions/ai-assistant';
import type { ExtendedBlockProp } from '../../extensions/constants';
import type { PromptTypeProp } from '../../lib/prompt';
import type { ToneProp } from '../tone-dropdown-control';
import type { ReactElement } from 'react';
Expand Down Expand Up @@ -113,7 +113,7 @@ const quickActionsList: {
icon: postContent,
},
],
'core/list': EXTENDED_INLINE_BLOCKS.includes( 'core/list' )
'core/list': EXTENDED_BLOCKS.includes( 'core/list' )
? [
{
name: __( 'Simplify', 'jetpack' ),
Expand Down Expand Up @@ -172,7 +172,7 @@ export type OnRequestSuggestion = (
) => void;

type AiAssistantToolbarDropdownContentProps = {
blockType: ExtendedBlockProp | ExtendedInlineBlockProp;
blockType: ExtendedBlockProp;
disabled?: boolean;
onAskAiAssistant: () => void;
onRequestSuggestion: OnRequestSuggestion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React from 'react';
/**
* Internal dependencies
*/
import { getStoreBlockId } from '../../extensions/ai-assistant/with-ai-assistant';
import { getStoreBlockId } from '../../hooks/use-transform-to-assistant';
import { getBlocksContent, getRawTextFromHTML } from '../../lib/utils/block-content';
import { transformToAIAssistantBlock } from '../../transforms';
import AiAssistantToolbarDropdownContent from './dropdown-content';
Expand All @@ -21,7 +21,7 @@ import './style.scss';
* Types and constants
*/
import type { AiAssistantDropdownOnChangeOptionsArgProps } from './dropdown-content';
import type { ExtendedBlockProp } from '../../extensions/ai-assistant';
import type { ExtendedBlockProp } from '../../extensions/constants';
import type { PromptTypeProp } from '../../lib/prompt';
import type { ReactElement } from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ import ConnectPrompt from './components/connect-prompt';
import FeedbackControl from './components/feedback-control';
import QuotaExceededMessage, { FairUsageNotice } from './components/quota-exceeded-message';
import ToolbarControls from './components/toolbar-controls';
import { getStoreBlockId } from './extensions/ai-assistant/with-ai-assistant';
import useAIAssistant from './hooks/use-ai-assistant';
import useAICheckout from './hooks/use-ai-checkout';
import useAiFeature from './hooks/use-ai-feature';
import useAiProductPage from './hooks/use-ai-product-page';
import { getStoreBlockId } from './hooks/use-transform-to-assistant';
import { isUserConnected } from './lib/connection';
import './editor.scss';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import transforms from './transforms';
import './editor.scss';

/**
* Supports and extensions
* Extensions
*/
import './supports';
import './extensions/ai-assistant';
import './extensions/jetpack-contact-form';
import './inline-extensions/with-ai-extension';
import './extensions/with-ai-extension';

registerJetpackBlockFromMetadata( metadata, {
edit,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import './style.scss';
/*
* Types
*/
import type { ExtendedInlineBlockProp } from '../../../extensions/ai-assistant';
import type { ExtendedBlockProp } from '../../constants';
import type { RequestingErrorProps, RequestingStateProp } from '@automattic/jetpack-ai-client';
import type { ReactElement } from 'react';

Expand All @@ -27,7 +27,7 @@ export type AiAssistantInputProps = {
inputRef?: React.MutableRefObject< HTMLInputElement | null >;
wrapperRef?: React.MutableRefObject< HTMLDivElement | null >;
action?: string;
blockType: ExtendedInlineBlockProp;
blockType: ExtendedBlockProp;
feature: string;
request: ( question: string ) => void;
stopSuggestion?: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import type {
AiAssistantDropdownOnChangeOptionsArgProps,
OnRequestSuggestion,
} from '../../../components/ai-assistant-toolbar-dropdown/dropdown-content';
import type { ExtendedInlineBlockProp } from '../../../extensions/ai-assistant';
import type { PromptTypeProp } from '../../../lib/prompt';
import type { ExtendedBlockProp } from '../../constants';
import type { BlockBehavior } from '../../types';
import type { ReactElement } from 'react';

type AiAssistantExtensionToolbarDropdownContentProps = {
blockType: ExtendedInlineBlockProp;
blockType: ExtendedBlockProp;
onClose: () => void;
onAskAiAssistant: () => void;
onRequestSuggestion: OnRequestSuggestion;
Expand Down Expand Up @@ -101,7 +101,7 @@ function AiAssistantExtensionToolbarDropdownContent( {

type AiAssistantExtensionToolbarDropdownProps = {
behavior: BlockBehavior;
blockType: ExtendedInlineBlockProp;
blockType: ExtendedBlockProp;
label?: string;
onAskAiAssistant: () => void;
onRequestSuggestion: OnRequestSuggestion;
Expand Down
Loading

0 comments on commit 52d9b5a

Please sign in to comment.