Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

refactor(sdk): move trasnformSdkQuestion (#64458)

Nicolò Prettobe441ae625f3
diff --git a/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/context/SdkQuestionProvider.tsx b/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/context/SdkQuestionProvider.tsx
index 18f5daac317..627c4ac66fb 100644
--- a/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/context/SdkQuestionProvider.tsx
+++ b/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/context/SdkQuestionProvider.tsx
@@ -2,10 +2,10 @@ import { createContext, useContext, useEffect, useMemo } from "react";
import { SdkError } from "embedding-sdk-bundle/components/private/PublicComponentWrapper";
import { useLoadQuestion } from "embedding-sdk-bundle/hooks/private/use-load-question";
-import { transformSdkQuestion } from "embedding-sdk-bundle/lib/transform-question";
import { useSdkDispatch, useSdkSelector } from "embedding-sdk-bundle/store";
import { getError, getPlugins } from "embedding-sdk-bundle/store/selectors";
import type { MetabasePluginsConfig } from "embedding-sdk-bundle/types/plugins";
+import { transformSdkQuestion } from "metabase/embedding-sdk/lib/transform-question";
import type { MetabasePluginsConfig as InternalMetabasePluginsConfig } from "metabase/embedding-sdk/types/plugins";
import {
type OnCreateOptions,
diff --git a/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/hooks/use-run-visualization.ts b/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/hooks/use-run-visualization.ts
index 47b436b2fc0..5b0fcaf8cd7 100644
--- a/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/hooks/use-run-visualization.ts
+++ b/enterprise/frontend/src/embedding-sdk-bundle/components/private/SdkQuestion/hooks/use-run-visualization.ts
@@ -1,6 +1,6 @@
import { useMemo } from "react";
-import { transformSdkQuestion } from "embedding-sdk-bundle/lib/transform-question";
+import { transformSdkQuestion } from "metabase/embedding-sdk/lib/transform-question";
import { isQuestionDirty } from "metabase/query_builder/utils/question";
import { useRunVisualization as useRunVisualizationCore } from "metabase/querying/notebook/components/Notebook";
import type Question from "metabase-lib/v1/Question";
diff --git a/enterprise/frontend/src/embedding-sdk-bundle/lib/transform-question.unit.spec.ts b/enterprise/frontend/src/embedding-sdk-bundle/lib/transform-question.unit.spec.ts
index 9d04b70f59f..6850edb64ba 100644
--- a/enterprise/frontend/src/embedding-sdk-bundle/lib/transform-question.unit.spec.ts
+++ b/enterprise/frontend/src/embedding-sdk-bundle/lib/transform-question.unit.spec.ts
@@ -1,5 +1,5 @@
import { createMockMetadata } from "__support__/metadata";
-import { transformSdkQuestion } from "embedding-sdk-bundle/lib/transform-question";
+import { transformSdkQuestion } from "metabase/embedding-sdk/lib/transform-question";
import Question from "metabase-lib/v1/Question";
import { createMockCard } from "metabase-types/api/mocks";
import { createMockEntityId } from "metabase-types/api/mocks/entity-id";
diff --git a/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenu.tsx b/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenu.tsx
index ba056675d6f..02767e03e9c 100644
--- a/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenu.tsx
+++ b/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenu.tsx
@@ -3,8 +3,6 @@ import cx from "classnames";
import { useMemo, useState } from "react";
import { t } from "ttag";
-/* eslint-disable-next-line no-restricted-imports -- deprecated sdk import */
-import { transformSdkQuestion } from "embedding-sdk-bundle/lib/transform-question";
import {
canDownloadResults,
canEditQuestion,
@@ -14,6 +12,7 @@ import {
useDashboardContext,
} from "metabase/dashboard/context";
import { getParameterValuesBySlugMap } from "metabase/dashboard/selectors";
+import { transformSdkQuestion } from "metabase/embedding-sdk/lib/transform-question";
import { useStore } from "metabase/lib/redux";
import { checkNotNull } from "metabase/lib/types";
import { QuestionDownloadWidget } from "metabase/query_builder/components/QuestionDownloadWidget";
diff --git a/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenuItems.tsx b/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenuItems.tsx
index 964527c9ddd..caf9457ee23 100644
--- a/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenuItems.tsx
+++ b/frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenuItems.tsx
@@ -3,10 +3,9 @@ import { t } from "ttag";
/* eslint-disable-next-line no-restricted-imports -- deprecated sdk import */
import { useSdkDashboardContext } from "embedding-sdk-bundle/components/public/dashboard/context";
-/* eslint-disable-next-line no-restricted-imports -- deprecated sdk import */
-import { transformSdkQuestion } from "embedding-sdk-bundle/lib/transform-question";
import { editQuestion } from "metabase/dashboard/actions";
import { useDashboardContext } from "metabase/dashboard/context";
+import { transformSdkQuestion } from "metabase/embedding-sdk/lib/transform-question";
import type { DashboardCardCustomMenuItem } from "metabase/embedding-sdk/types/plugins";
import { useDispatch } from "metabase/lib/redux";
import { isNotNull } from "metabase/lib/types";
diff --git a/enterprise/frontend/src/embedding-sdk-bundle/lib/transform-question.ts b/frontend/src/metabase/embedding-sdk/lib/transform-question.ts
similarity index 100%
rename from enterprise/frontend/src/embedding-sdk-bundle/lib/transform-question.ts
rename to frontend/src/metabase/embedding-sdk/lib/transform-question.ts