diff --git a/src/library-authoring/component-info/ComponentPreview.tsx b/src/library-authoring/component-info/ComponentPreview.tsx index 94ab52a775..1340e15c9a 100644 --- a/src/library-authoring/component-info/ComponentPreview.tsx +++ b/src/library-authoring/component-info/ComponentPreview.tsx @@ -4,8 +4,6 @@ import { Button, StandardModal, useToggle } from '@openedx/paragon'; import { OpenInFull } from '@openedx/paragon/icons'; import { LibraryBlock } from '../LibraryBlock'; -import { getXBlockHandlerUrl } from '../data/api'; -import { useXBlockRender } from '../data/apiHooks'; import messages from './messages'; // This is a simple overlay to prevent interaction with the preview diff --git a/src/library-authoring/data/api.ts b/src/library-authoring/data/api.ts index 516649764d..0cfe3a6dea 100644 --- a/src/library-authoring/data/api.ts +++ b/src/library-authoring/data/api.ts @@ -35,17 +35,6 @@ export const getLibraryPasteClipboardUrl = (libraryId: string) => `${getApiBaseU */ export const getXBlockFieldsApiUrl = (usageKey: string) => `${getApiBaseUrl()}/api/xblock/v2/xblocks/${usageKey}/fields/`; -/** - * Get the URL that render the XBlock in the LMS. - */ -export const getXBlockRenderUrl = (usageKey: string) => `${getApiBaseUrl()}/api/xblock/v2/xblocks/${usageKey}/view/student_view/`; - -/** - * Get the URL for the xblock handler API. - * The string `handler_name` is a placeholder for the name of the handler. - */ -export const getXBlockHandlerUrlUrl = (usageKey: string) => `${getApiBaseUrl()}/api/xblock/v2/xblocks/${usageKey}/handler_url/handler_name/`; - export interface ContentLibrary { id: string; type: string; @@ -144,18 +133,6 @@ export interface UpdateXBlockFieldsRequest { }; } -export interface XBlockRenderResource { - data: string; - kind: 'url'; - mimetype: string; - placement: 'head' | 'foot'; -} - -export interface XBlockRenderResponse { - content: string; - resources: XBlockRenderResource[]; -} - /** * Fetch block types of a library */ @@ -273,19 +250,3 @@ export async function updateXBlockFields(usageKey:string, xblockData: UpdateXBlo const client = getAuthenticatedHttpClient(); await client.post(getXBlockFieldsApiUrl(usageKey), xblockData); } - -/** - * Get rendered xblock - */ -export async function getXBlockRender(usageKey: string): Promise { - const { data } = await getAuthenticatedHttpClient().get(getXBlockRenderUrl(usageKey)); - return camelCaseObject(data); -} - -/** - * Get the URL of the xblock handler. - */ -export const getXBlockHandlerUrl = async (usageKey: string): Promise => { - const { data } = await getAuthenticatedHttpClient().get(getXBlockHandlerUrlUrl(usageKey)); - return data.handler_url; -}; diff --git a/src/library-authoring/data/apiHooks.ts b/src/library-authoring/data/apiHooks.ts index 651fd3a18d..bd1e210974 100644 --- a/src/library-authoring/data/apiHooks.ts +++ b/src/library-authoring/data/apiHooks.ts @@ -18,7 +18,6 @@ import { libraryPasteClipboard, getXBlockFields, updateXBlockFields, - getXBlockRender, } from './api'; const libraryQueryPredicate = (query: Query, libraryId: string): boolean => { @@ -53,7 +52,6 @@ export const libraryAuthoringQueryKeys = { 'content', 'libraryBlockTypes', ], - // ToDo: Move to xblockQueryKeys xblockFields: (contentLibraryId: string, usageKey: string) => [ ...libraryAuthoringQueryKeys.contentLibrary(contentLibraryId), 'content', @@ -62,18 +60,6 @@ export const libraryAuthoringQueryKeys = { ], }; -export const xblockQueryKeys = { - all: ['xblock'], - /** - * Base key for data specific to a xblock - */ - xblock: (usageKey?: string) => [...xblockQueryKeys.all, usageKey], - render: (usageKey: string) => [ - ...xblockQueryKeys.xblock(usageKey), - 'render', - ], -}; - /** * Hook to fetch a content library by its ID. */ @@ -222,11 +208,3 @@ export const useUpdateXBlockFields = (contentLibraryId: string, usageKey: string }, }); }; - -export const useXBlockRender = (usageKey: string) => ( - useQuery({ - queryKey: xblockQueryKeys.render(usageKey), - queryFn: () => getXBlockRender(usageKey), - enabled: !!usageKey, - }) -);