The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Add the metabase-browser custom element to Embed JS (#60828)
Phoomparin Mano37e6eee3116d
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding/view-and-curate-content.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding/view-and-curate-content.cy.spec.tsnew file mode 100644index 00000000000..6a3c0183244--- /dev/null+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding/view-and-curate-content.cy.spec.ts@@ -0,0 +1,332 @@+const { H } = cy;++const setupEmbed = (elementHtml: string) => {+ H.visitCustomHtmlPage(`+ ${H.getNewEmbedScriptTag()}+ ${H.getNewEmbedConfigurationScript({})}+ ${elementHtml}+ `);+};++describe("scenarios > embedding > sdk iframe embedding > view and curate content", () => {+ beforeEach(() => {+ cy.signInAsAdmin();+ H.prepareSdkIframeEmbedTest({ withTokenFeatures: true });+ });++ describe("<metabase-browser> (read-only mode)", () => {+ it("should show a collection browser with collection items", () => {+ setupEmbed('<metabase-browser initial-collection="root" />');++ H.getSimpleEmbedIframeContent()+ .should("contain", "Name")+ .findAllByText("Orders")+ .first()+ .should("be.visible");+ });++ it("should navigate to question when clicking on a question item", () => {+ setupEmbed('<metabase-browser initial-collection="root" />');++ H.getSimpleEmbedIframeContent()+ .findByText("Orders")+ .should("be.visible")+ .click();++ cy.log("should show question view");+ H.getSimpleEmbedIframeContent()+ .findByTestId("query-visualization-root")+ .should("be.visible");+ });++ it("should show New Exploration button and open data picker when clicked", () => {+ setupEmbed('<metabase-browser initial-collection="root" />');++ H.getSimpleEmbedIframeContent()+ .findByText("New Exploration")+ .should("be.visible")+ .click();++ H.getSimpleEmbedIframeContent()+ .findByText("Pick your starting data")+ .should("be.visible");+ });++ it("should pass through collection-visible-columns parameter", () => {+ setupEmbed(`+ <metabase-browser+ initial-collection="root"+ collection-visible-columns='["type", "name"]'+ />+ `);++ H.getSimpleEmbedIframeContent().should("contain", "Name");+ H.getSimpleEmbedIframeContent().should("contain", "Type");+ H.getSimpleEmbedIframeContent().should("not.contain", "Last edited by");+ H.getSimpleEmbedIframeContent().should("not.contain", "Last edited at");+ });++ it("should pass through collection-page-size parameter", () => {+ setupEmbed(`+ <metabase-browser+ initial-collection="root"+ collection-page-size="5"+ />+ `);++ cy.log("should show exactly 5 collection entries");+ H.getSimpleEmbedIframeContent()+ .findAllByTestId("collection-entry-type")+ .should("have.length", 5);+ });++ it("should hide New Exploration button when with-new-question is false", () => {+ setupEmbed(`+ <metabase-browser+ initial-collection="root"+ with-new-question="false"+ />+ `);++ H.getSimpleEmbedIframeContent()+ .findByText("New Exploration")+ .should("not.exist");+ });+ });++ describe("<metabase-browser> (read-write mode)", () => {+ it("should show New Dashboard button and open modal when clicked", () => {+ setupEmbed(+ '<metabase-browser initial-collection="root" read-only="false" />',+ );++ H.getSimpleEmbedIframeContent()+ .findByText("New Dashboard")+ .should("be.visible")+ .click();++ cy.log("should show create dashboard modal");+ H.getSimpleEmbedIframeContent()+ .findByText("New dashboard")+ .should("be.visible");+ });++ it("should update breadcrumbs when creating dashboard in different collection", () => {+ setupEmbed(+ '<metabase-browser initial-collection="root" read-only="false" />',+ );++ cy.log("verify initial breadcrumb");+ H.getSimpleEmbedIframeContent()+ .findByText("Our analytics")+ .should("be.visible");++ H.getSimpleEmbedIframeContent().findByText("New Dashboard").click();++ H.getSimpleEmbedIframeContent().within(() => {+ cy.log("change collection to save dashboard in");+ cy.findByRole("dialog").within(() => {+ cy.findByText("Which collection should this go in?").should(+ "be.visible",+ );++ cy.findByText("Our analytics").click();+ });++ cy.findByText("First collection", { timeout: 20_000 }).click();+ cy.findByText("Select").click();++ cy.log("create the dashboard");+ cy.findByRole("dialog").within(() => {+ cy.findByPlaceholderText("What is the name of your dashboard?").type(+ "Test Dashboard",+ );+ cy.findByText("Create").click();+ });+ });++ cy.log(+ "verify breadcrumbs are updated to reflect the selected collection",+ );+ H.getSimpleEmbedIframeContent()+ .findByTestId("sdk-breadcrumbs")+ .findByText("First collection")+ .should("be.visible");+ });++ it("should show New Exploration button and open data picker when clicked", () => {+ setupEmbed(+ '<metabase-browser initial-collection="root" read-only="false" />',+ );++ H.getSimpleEmbedIframeContent()+ .findByText("New Exploration")+ .should("be.visible")+ .click();++ cy.log("should show data picker");+ H.getSimpleEmbedIframeContent()+ .findByText("Pick your starting data")+ .should("be.visible");+ });++ it("should show Save button and save modal without entity picker when creating a new question", () => {+ setupEmbed(+ '<metabase-browser initial-collection="root" read-only="false" />',+ );++ H.getSimpleEmbedIframeContent().findByText("New Exploration").click();++ cy.log("select data model");+ H.getSimpleEmbedIframeContent().findByText("Orders").click();++ cy.log("should show Save button");+ H.getSimpleEmbedIframeContent()+ .findByText("Save")+ .should("be.visible")+ .click();++ cy.log("should show save modal without entity picker");+ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByRole("dialog").within(() => {+ cy.findByText("Save new question").should("be.visible");+ cy.findByText("Where do you want to save this?").should("not.exist");+ });+ });+ });++ it("should hide New Dashboard button when with-new-dashboard is false", () => {+ setupEmbed(`+ <metabase-browser+ initial-collection="root"+ read-only="false"+ with-new-dashboard="false"+ />+ `);++ H.getSimpleEmbedIframeContent()+ .findByText("New Dashboard")+ .should("not.exist");+ });++ it("should create a dashboard in a new collection", () => {+ setupEmbed(+ '<metabase-browser initial-collection="root" read-only="false" />',+ );++ H.getSimpleEmbedIframeContent()+ .findByText("New Dashboard")+ .should("be.visible")+ .click();++ H.getSimpleEmbedIframeContent().within(() => {+ cy.findByRole("dialog").within(() => {+ cy.findByPlaceholderText("What is the name of your dashboard?").type(+ "Foo Bar Dashboard",+ );++ cy.log("open the collection picker");+ cy.findByText("Our analytics").click();+ });++ cy.findByText("Collections").click();+ cy.findByText("New collection").click();++ cy.findAllByRole("dialog")+ .eq(2)+ .within(() => {+ cy.findByPlaceholderText("My new collection").type(+ "Foo Collection",+ );+ cy.findByText("Create").click();+ });++ cy.findByText("Select").click();++ cy.log("create new dashboard");+ cy.findByRole("dialog").within(() => {+ cy.findByText("Create").click();+ });+ });++ cy.log("dashboard is created and shows empty state");+ H.getSimpleEmbedIframeContent()+ .findByText("This dashboard is empty")+ .should("be.visible");++ cy.log("breadcrumbs show the new collection");+ H.getSimpleEmbedIframeContent()+ .findByTestId("sdk-breadcrumbs")+ .findByText("Foo Collection")+ .should("be.visible");++ cy.log("breadcrumbs show the new dashboard");+ H.getSimpleEmbedIframeContent()+ .findByTestId("sdk-breadcrumbs")+ .findByText("Foo Bar Dashboard")+ .should("be.visible");++ cy.log("dashboard title is visible in header");+ H.getSimpleEmbedIframeContent()+ .findByTestId("dashboard-header")+ .findByText("Foo Bar Dashboard")+ .should("be.visible");+ });++ it("should hide New Exploration button when with-new-question is false", () => {+ setupEmbed(`+ <metabase-browser+ initial-collection="root"+ read-only="false"+ with-new-question="false"+ />+ `);++ H.getSimpleEmbedIframeContent()+ .findByText("New Exploration")+ .should("not.exist");+ });++ it("should pass through data-picker-entity-types parameter", () => {+ setupEmbed(`+ <metabase-browser+ initial-collection="root"+ read-only="false"+ data-picker-entity-types='["table"]'+ />+ `);++ H.getSimpleEmbedIframeContent().findByText("New Exploration").click();++ cy.log("should show data picker with limited entity types");+ H.getSimpleEmbedIframeContent()+ .findByText("Pick your starting data")+ .should("be.visible");++ cy.log("should show Orders table but not Orders model");+ H.getSimpleEmbedIframeContent().should("contain", "Orders");+ H.getSimpleEmbedIframeContent().should("not.contain", "Orders model");+ });+ });++ describe("breadcrumb navigation", () => {+ it("should show breadcrumbs when navigating between content", () => {+ setupEmbed('<metabase-browser initial-collection="root" />');++ cy.log("should show initial breadcrumb");+ H.getSimpleEmbedIframeContent()+ .findByText("Our analytics")+ .should("be.visible");++ H.getSimpleEmbedIframeContent().findAllByText("Orders").first().click();++ cy.log("should show breadcrumb for the question");+ H.getSimpleEmbedIframeContent().should("contain", "Orders");++ H.getSimpleEmbedIframeContent().findByText("Our analytics").click();++ cy.log("should be back at collection browser");+ H.getSimpleEmbedIframeContent().should("contain", "Name");+ });+ });+});diff --git a/enterprise/frontend/src/embedding-sdk/components/private/SdkBreadcrumbs/SdkBreadcrumbs.tsx b/enterprise/frontend/src/embedding-sdk/components/private/SdkBreadcrumbs/SdkBreadcrumbs.tsxindex fd6d7509652..7ee127e3d61 100644--- a/enterprise/frontend/src/embedding-sdk/components/private/SdkBreadcrumbs/SdkBreadcrumbs.tsx+++ b/enterprise/frontend/src/embedding-sdk/components/private/SdkBreadcrumbs/SdkBreadcrumbs.tsx@@ -32,7 +32,7 @@ export const SdkBreadcrumbs = ({return (<PublicComponentStylesWrapper className={className} style={style}>- <Flex align="center">+ <Flex align="center" data-testid="sdk-breadcrumbs">{breadcrumbs.map((breadcrumb, index) => (<Fragment key={breadcrumb.id}><Badgediff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/MetabaseBrowser.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/MetabaseBrowser.tsxnew file mode 100644index 00000000000..0f700d92820--- /dev/null+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/MetabaseBrowser.tsx@@ -0,0 +1,210 @@+import { useEffect, useMemo, useState } from "react";+import { P, match } from "ts-pattern";+import { t } from "ttag";+import _ from "underscore";++import { SdkBreadcrumbs } from "embedding-sdk/components/private/SdkBreadcrumbs";+import { CollectionBrowser } from "embedding-sdk/components/public/CollectionBrowser";+import { CreateDashboardModal } from "embedding-sdk/components/public/CreateDashboardModal";+import { InteractiveQuestion } from "embedding-sdk/components/public/InteractiveQuestion";+import {+ EditableDashboard,+ InteractiveDashboard,+} from "embedding-sdk/components/public/dashboard";+import { useSdkBreadcrumbs } from "embedding-sdk/hooks/private/use-sdk-breadcrumb";+import type { SdkCollectionId } from "embedding-sdk/types";+import type { SdkBreadcrumbItemType } from "embedding-sdk/types/breadcrumb";+import { Box, Button, Group, Stack } from "metabase/ui";++import type { SdkIframeEmbedSettings } from "../types/embed";++interface MetabaseBrowserProps {+ settings: SdkIframeEmbedSettings & {+ componentName: "metabase-browser";+ };+}++type MetabaseBrowserView =+ | { type: "collection"; id: SdkCollectionId }+ | { type: "dashboard"; id: number | string }+ | { type: "question" | "metric" | "model"; id: number | string }+ | { type: "exploration" }+ | { type: "create-dashboard" };++const BREADCRUMB_HEIGHT = "3.5rem";++export function MetabaseBrowser({ settings }: MetabaseBrowserProps) {+ const { initialCollection } = settings;++ const isReadOnly = settings.readOnly ?? true;++ const { breadcrumbs, currentLocation, reportLocation } = useSdkBreadcrumbs();++ const [currentView, setCurrentView] = useState<MetabaseBrowserView>({+ type: "collection",+ id: initialCollection,+ });++ // Use the last collection in the breadcrumb as the target for saving new questions.+ const targetCollection = useMemo(() => {+ const collectionBreadcrumbs = breadcrumbs.filter(+ (item) => item.type === "collection",+ );++ const lastCollectionItem = _.last(collectionBreadcrumbs);++ return lastCollectionItem?.id ?? initialCollection;+ }, [breadcrumbs, initialCollection]);++ // If a user clicks on a collection breadcrumb, switch the view.+ useEffect(() => {+ if (currentLocation?.type === "collection") {+ setCurrentView({ type: currentLocation.type, id: currentLocation.id });+ }+ }, [currentLocation]);++ const viewContent = match(currentView)+ .with({ type: "exploration" }, () => (+ <Box px="xl" h="100%">+ <InteractiveQuestion+ questionId="new"+ height="100%"+ withDownloads+ isSaveEnabled={!isReadOnly}+ entityTypes={settings.dataPickerEntityTypes}+ targetCollection={targetCollection}+ />+ </Box>+ ))+ .with({ type: "create-dashboard" }, () => (+ <CreateDashboardModal+ onCreate={(dashboard) => {+ // Update the breadcrumbs to reflect the collection where the dashboard was saved+ if (dashboard.collection) {+ reportLocation({+ type: "collection",+ id: dashboard.collection.id,+ name: dashboard.collection.name,+ });+ }++ // On the next tick, update the current view.+ // This is needed for when we create new collections.+ setTimeout(() => {+ setCurrentView({ type: "dashboard", id: dashboard.id });+ }, 0);+ }}+ onClose={() =>+ setCurrentView({ type: "collection", id: targetCollection })+ }+ initialCollectionId={targetCollection}+ />+ ))+ .with({ type: "dashboard", id: P.nonNullable }, ({ id }) => {+ const dashboardView = isReadOnly ? (+ <InteractiveDashboard+ dashboardId={id}+ withDownloads+ style={{ height: "100%" }}+ drillThroughQuestionProps={{ isSaveEnabled: false }}+ />+ ) : (+ <EditableDashboard+ withCardTitle+ dashboardId={id}+ style={{ height: "100%" }}+ />+ );++ // The overflow-scroll is needed otherwise the editable+ // dashboard header gets scrolled out of view.+ return (+ <Group h="100%" style={{ overflowY: "scroll" }}>+ {dashboardView}+ </Group>+ );+ })+ .with(+ { type: P.union("question", "metric", "model"), id: P.nonNullable },+ ({ id }) => (+ <Box px="xl" h="100%">+ <InteractiveQuestion+ questionId={id}+ height="100%"+ withDownloads+ isSaveEnabled={!isReadOnly}+ targetCollection={targetCollection}+ />+ </Box>+ ),+ )+ .with({ type: "collection" }, (view) => (+ <Box px="xl" pt="lg" style={{ overflowY: "scroll" }}>+ <CollectionBrowser+ collectionId={view.id}+ visibleColumns={settings.collectionVisibleColumns}+ visibleEntityTypes={settings.collectionEntityTypes}+ pageSize={settings.collectionPageSize}+ onClick={(item) => {+ const type = match<string, SdkBreadcrumbItemType>(item.model)+ .with("card", () => "question")+ .with("dataset", () => "model")+ .otherwise((model) => model as SdkBreadcrumbItemType);++ setCurrentView({ type, id: item.id });+ }}+ style={{ overflowY: "scroll" }}+ />+ </Box>+ ))+ .otherwise(() => null);++ const handleNewExploration = () => {+ setCurrentView({ type: "exploration" });+ reportLocation({ type: "question", id: "new", name: "New Exploration" });+ };++ return (+ <Stack pos="relative" h="100%">+ <Box pos="absolute" top={0} left={0} w="100%">+ {/* Fixes the height to avoid layout shift when hiding buttons */}+ <Group+ justify="space-between"+ align="flex-start"+ gap="sm"+ h={BREADCRUMB_HEIGHT}+ px="xl"+ py="lg"+ w="100%"+ >+ <Group>+ <SdkBreadcrumbs />+ </Group>++ {currentView.type === "collection" && (+ <Group gap="sm">+ {(settings.withNewQuestion ?? true) && (+ <Button justify="center" onClick={handleNewExploration}>+ {t`New Exploration`}+ </Button>+ )}++ {!isReadOnly && (settings.withNewDashboard ?? true) && (+ <Button+ justify="center"+ onClick={() => setCurrentView({ type: "create-dashboard" })}+ >+ {t`New Dashboard`}+ </Button>+ )}+ </Group>+ )}+ </Group>+ </Box>++ <Stack mt={BREADCRUMB_HEIGHT} h="100%" style={{ overflowY: "hidden" }}>+ {viewContent}+ </Stack>+ </Stack>+ );+}diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/SdkIframeEmbedRoute.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/SdkIframeEmbedRoute.tsxindex e063865d50f..ebbdd35677c 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/SdkIframeEmbedRoute.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/components/SdkIframeEmbedRoute.tsx@@ -1,6 +1,7 @@import type { ReactNode } from "react";import { P, match } from "ts-pattern";+import { SdkBreadcrumbsProvider } from "embedding-sdk/components/private/SdkBreadcrumbs";import { ComponentProvider } from "embedding-sdk/components/public/ComponentProvider";import { SdkQuestion } from "embedding-sdk/components/public/SdkQuestion";import { StaticQuestion } from "embedding-sdk/components/public/StaticQuestion";@@ -17,6 +18,7 @@ import { useParamRerenderKey } from "../hooks/use-param-rerender-key";import { useSdkIframeEmbedEventBus } from "../hooks/use-sdk-iframe-embed-event-bus";import type { SdkIframeEmbedSettings } from "../types/embed";+import { MetabaseBrowser } from "./MetabaseBrowser";import {SdkIframeApiKeyInProductionError,SdkIframeExistingUserSessionInProductionError,@@ -81,77 +83,83 @@ const SdkIframeEmbedView = ({}): ReactNode => {const rerenderKey = useParamRerenderKey(settings);- return (- match(settings)- // .with({ template: "curate-content" }, (_settings) => null)- // .with({ template: "view-content" }, (_settings) => null)- .with(- {- componentName: "metabase-dashboard",- dashboardId: P.nonNullable,- drills: false,- },- (settings) => (- <StaticDashboard- dashboardId={settings.dashboardId}- withTitle={settings.withTitle}- withDownloads={settings.withDownloads}- initialParameters={settings.initialParameters}- hiddenParameters={settings.hiddenParameters}- key={rerenderKey}- />- ),- )- .with(- {- componentName: "metabase-dashboard",- dashboardId: P.nonNullable,- drills: P.optional(true),- },- (settings) => (- <InteractiveDashboard- dashboardId={settings.dashboardId}- withTitle={settings.withTitle}- withDownloads={settings.withDownloads}- initialParameters={settings.initialParameters}- hiddenParameters={settings.hiddenParameters}- drillThroughQuestionHeight="100%"- drillThroughQuestionProps={{ isSaveEnabled: false }}+ return match(settings)+ .with(+ {+ componentName: "metabase-browser",+ },+ (settings) => (+ <SdkBreadcrumbsProvider>+ <MetabaseBrowser settings={settings} />+ </SdkBreadcrumbsProvider>+ ),+ )+ .with(+ {+ componentName: "metabase-dashboard",+ dashboardId: P.nonNullable,+ drills: false,+ },+ (settings) => (+ <StaticDashboard+ dashboardId={settings.dashboardId}+ withTitle={settings.withTitle}+ withDownloads={settings.withDownloads}+ initialParameters={settings.initialParameters}+ hiddenParameters={settings.hiddenParameters}+ key={rerenderKey}+ />+ ),+ )+ .with(+ {+ componentName: "metabase-dashboard",+ dashboardId: P.nonNullable,+ drills: P.optional(true),+ },+ (settings) => (+ <InteractiveDashboard+ dashboardId={settings.dashboardId}+ withTitle={settings.withTitle}+ withDownloads={settings.withDownloads}+ initialParameters={settings.initialParameters}+ hiddenParameters={settings.hiddenParameters}+ drillThroughQuestionHeight="100%"+ drillThroughQuestionProps={{ isSaveEnabled: false }}+ key={rerenderKey}+ />+ ),+ )+ .with(+ {+ componentName: "metabase-question",+ questionId: P.nonNullable,+ },+ (settings) => {+ const commonProps = {+ questionId: settings.questionId,+ withDownloads: settings.withDownloads,+ height: "100%",+ initialSqlParameters: settings.initialSqlParameters,+ title: settings.withTitle ?? true, // defaulting title to true even if in the sdk it defaults to false for static+ };++ // note: to create a new question we need to render InteractiveQuestion+ if (settings.drills === false && settings.questionId !== "new") {+ // note: this disable drills but also removes the top toolbar+ return <StaticQuestion {...commonProps} key={rerenderKey} />;+ }++ return (+ <SdkQuestion+ {...commonProps}+ isSaveEnabled={settings.isSaveEnabled ?? false}key={rerenderKey}+ targetCollection={settings.targetCollection}+ entityTypes={settings.entityTypes}/>- ),- )- .with(- {- componentName: "metabase-question",- questionId: P.nonNullable,- },- (settings) => {- const commonProps = {- questionId: settings.questionId,- withDownloads: settings.withDownloads,- height: "100%",- initialSqlParameters: settings.initialSqlParameters,- title: settings.withTitle ?? true, // defaulting title to true even if in the sdk it defaults to false for static- };-- // note: to create a new question we need to render InteractiveQuestion- if (settings.drills === false && settings.questionId !== "new") {- // note: this disable drills but also removes the top toolbar- return <StaticQuestion {...commonProps} key={rerenderKey} />;- }-- return (- <SdkQuestion- {...commonProps}- isSaveEnabled={settings.isSaveEnabled ?? false}- key={rerenderKey}- targetCollection={settings.targetCollection}- entityTypes={settings.entityTypes}- />- );- },- )- .otherwise(() => null)- );+ );+ },+ )+ .otherwise(() => null);};diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/embed.ts b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/embed.tsindex 4e30f1730c1..0121a1d4b1b 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/embed.ts+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/embed.ts@@ -288,6 +288,7 @@ export abstract class MetabaseEmbedElement extends HTMLElement {this._iframe.style.width = "100%";this._iframe.style.height = "100%";this._iframe.style.border = "none";+ this._iframe.style.minHeight = "600px";this._iframe.setAttribute("data-metabase-embed", "true");@@ -487,6 +488,17 @@ const MetabaseQuestionElement = createCustomElement("metabase-question", ["entity-types",]);+const MetabaseManageContentElement = createCustomElement("metabase-browser", [+ "initial-collection",+ "collection-visible-columns",+ "collection-page-size",+ "collection-entity-types",+ "data-picker-entity-types",+ "with-new-question",+ "with-new-dashboard",+ "read-only",+]);+// Expose the old API that's still used in the tests, we'll probably remove this api unless customers prefer itif (typeof window !== "undefined") {(window as any)["metabase.embed"] = {@@ -494,4 +506,8 @@ if (typeof window !== "undefined") {};}-export { MetabaseDashboardElement, MetabaseQuestionElement };+export {+ MetabaseDashboardElement,+ MetabaseQuestionElement,+ MetabaseManageContentElement,+};diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/types/embed.ts b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/types/embed.tsindex ae342c08403..f1c8a59d884 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/types/embed.ts+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk/types/embed.ts@@ -1,4 +1,6 @@import type {+ CollectionBrowserListColumns,+ EmbeddingEntityType,EntityTypeFilterKeys,MetabaseTheme,SqlParameterValues,@@ -85,22 +87,34 @@ export interface ExplorationEmbedOptions {questionId?: never;}-export interface CurateContentEmbedOptions {- template: "curate-content";+export interface BrowserEmbedOptions {+ componentName: "metabase-browser";++ /** Which collection to start from? */initialCollection: CollectionId;- entityTypes?: CollectionBrowserEntityTypes[];+ /** Whether the content manager is in read-only mode. Defaults to true. */+ readOnly?: boolean;- questionId?: never;- dashboardId?: never;-}+ /** Which columns to show on the collection browser */+ collectionVisibleColumns?: CollectionBrowserListColumns[];-export interface ViewContentEmbedOptions {- template: "view-content";- initialCollection: CollectionId;+ /** How many items to show per page in the collection browser */+ collectionPageSize?: number;- entityTypes?: CollectionBrowserEntityTypes[];+ /** Which entities to show on the collection browser */+ collectionEntityTypes?: CollectionBrowserEntityTypes[];+ /** Which entities to show on the question's data picker */+ dataPickerEntityTypes?: EmbeddingEntityType[];++ /** Whether to show the "New Exploration" button. Defaults to true. */+ withNewQuestion?: boolean;++ /** Whether to show the "New Dashboard" button. Defaults to true. Only applies when readOnly is false. */+ withNewDashboard?: boolean;++ template?: never;questionId?: never;dashboardId?: never;}@@ -128,9 +142,8 @@ export type SdkIframeEmbedBaseSettings = {export type SdkIframeEmbedTemplateSettings =| DashboardEmbedOptions| QuestionEmbedOptions- | ExplorationEmbedOptions;-// | CurateContentEmbedOptions-// | ViewContentEmbedOptions;+ | ExplorationEmbedOptions+ | BrowserEmbedOptions;/** Settings used by the sdk embed route */export type SdkIframeEmbedSettings = SdkIframeEmbedBaseSettings &@@ -146,5 +159,4 @@ export type SdkIframeEmbedSettingKey =| keyof DashboardEmbedOptions| keyof QuestionEmbedOptions| keyof ExplorationEmbedOptions- | keyof CurateContentEmbedOptions- | keyof ViewContentEmbedOptions;+ | keyof BrowserEmbedOptions;diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedPreview.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedPreview.tsxindex 83825717274..038acd6b222 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedPreview.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedPreview.tsx@@ -129,6 +129,7 @@ export const SdkIframeEmbedPreview = () => {: undefined,}),)+ .with({ componentName: "metabase-browser" }, () => null).exhaustive()}</Card>);