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
Integration branch for Embedding Hub (#62986)
Phoomparin Mano0aa42f596fcf
diff --git a/.clj-kondo/config/modules/config.edn b/.clj-kondo/config/modules/config.ednindex f70cdc80a10..0f8699e13ac 100644--- a/.clj-kondo/config/modules/config.edn+++ b/.clj-kondo/config/modules/config.edn@@ -1721,6 +1721,18 @@settingsutil}}++ enterprise/embedding-hub+ {:team "Embedding"+ :api #{metabase-enterprise.embedding-hub.api}+ :uses #{api+ appearance+ audit-app+ embedding+ premium-features+ util+ enterprise/sso}}+enterprise/gsheets{:team "Cloud":api #{metabase-enterprise.gsheets.apidiff --git a/docs/embedding/embedded-analytics-js.md b/docs/embedding/embedded-analytics-js.mdindex b8a147581f8..e069a760f75 100644--- a/docs/embedding/embedded-analytics-js.md+++ b/docs/embedding/embedded-analytics-js.md@@ -31,7 +31,7 @@ Currently you can choose to embed:### 2. Create a new embed-1. In Metabase, click on **+ New** button in top right corner and select **Embed**. Note that this will only be visible to admins.+1. In Metabase, go to **Admin Settings > Embedding > Quick start** and select **Create embed**. Note that this will only be visible to admins.2. Choose the _type_ of entity to embed:- Dashboard- Question@@ -109,13 +109,13 @@ Note the `defer` attribute and the reference to your Metabase URL in the scriptIf you're embedding multiple entities on the same page, you only need to include the `<script>` tags once globally.-You can also generate the code snippet for Embedded Analytics JS interactively in Metabase through **+ New > Embed**. Check out the [Quickstart](#quickstart).+You can also generate the code snippet for Embedded Analytics JS interactively in Metabase through **Admin Settings > Embedding > Setup guide > Create embed**. Check out the [Quickstart](#quickstart).## Customizing embedsThe exact customization options you see will depend on what type of entity you're embedding.-When you're creating a new embed using **+ New > Embed**, you'll see the following customization options in the interactive creation flow. These options correspond to parameters in [components](#components).+When you're creating a new embed using **Admin Settings > Embedding > Setup guide > Create embed**, you'll see the following customization options in the interactive creation flow. These options correspond to parameters in [components](#components).- **Allow people to drill through on data points**: determines whether people can interact with the chart (or charts on a dashboard). Interactivity includes [drilling down](https://www.metabase.com/learn/metabase-basics/querying-and-dashboards/questions/drill-through) to individual records from aggregated questions, filtering on click, zooming in, etc. Disabling drill-through for an embedded _question_ also disables people's ability to add filters and summaries.diff --git a/e2e/support/helpers/e2e-misc-helpers.js b/e2e/support/helpers/e2e-misc-helpers.jsindex 758f4f37c25..1afa25e0ba7 100644--- a/e2e/support/helpers/e2e-misc-helpers.js+++ b/e2e/support/helpers/e2e-misc-helpers.js@@ -420,8 +420,6 @@ export function visitPublicDashboard(export const goToAuthOverviewPage = () => {cy.findByTestId("admin-layout-sidebar")- .findAllByText("Overview") // auth overview page- .should("have.length", 2)- .first()+ .findByText("Overview") // auth overview page.click();};diff --git a/e2e/test/scenarios/admin/i18n/content-translation/helpers/e2e-content-translation-helpers.ts b/e2e/test/scenarios/admin/i18n/content-translation/helpers/e2e-content-translation-helpers.tsindex 22f58983d4c..57850a73f28 100644--- a/e2e/test/scenarios/admin/i18n/content-translation/helpers/e2e-content-translation-helpers.ts+++ b/e2e/test/scenarios/admin/i18n/content-translation/helpers/e2e-content-translation-helpers.ts@@ -17,7 +17,7 @@ export const uploadTranslationDictionary = (rows: DictionaryArray) => {);cy.intercept("GET", "/api/setting").as("getSettings");cy.signInAsAdmin();- cy.visit("/admin/settings/embedding-in-other-applications/standalone");+ cy.visit("/admin/embedding/static");cy.wait("@getSettings");cy.findByTestId("content-localization-setting").findByText(diff --git a/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.ts b/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.tsindex e3a11f957e2..ca344ac2943 100644--- a/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.ts+++ b/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.ts@@ -26,7 +26,7 @@ describe("scenarios > admin > embedding > static embedding> content translation"});it("admin settings configuration form is not present", () => {- cy.visit("/admin/settings/embedding-in-other-applications/standalone");+ cy.visit("/admin/embedding/static");cy.findByTestId("content-translation-configuration").should("not.exist");});});@@ -52,7 +52,7 @@ describe("scenarios > admin > embedding > static embedding> content translation"describe("The translation download button", () => {it("downloads the stored translations", () => {uploadTranslationDictionaryViaAPI(germanFieldNames);- cy.visit("/admin/settings/embedding-in-other-applications/standalone");+ cy.visit("/admin/embedding/static");cy.findByTestId("content-translation-configuration").button(/Download translation dictionary/i).click();@@ -180,7 +180,7 @@ describe("scenarios > admin > embedding > static embedding> content translation"});it("rejects, in the frontend, a CSV upload that is too big", () => {- cy.visit("/admin/settings/embedding-in-other-applications/standalone");+ cy.visit("/admin/embedding/static");cy.get("#content-translation-dictionary-upload-input").selectFile({contents: Cypress.Buffer.from(@@ -206,7 +206,7 @@ describe("scenarios > admin > embedding > static embedding> content translation"});it("rejects invalid CSV", () => {- cy.visit("/admin/settings/embedding-in-other-applications/standalone");+ cy.visit("/admin/embedding/static");const validCSV = getCSVWithHeaderRow(germanFieldNames);const invalidCSV = validCSV + '\nde,Price,"Preis"X';diff --git a/e2e/test/scenarios/embedding/embedding-admin-settings-oss.cy.spec.ts b/e2e/test/scenarios/embedding/embedding-admin-settings-oss.cy.spec.tsnew file mode 100644index 00000000000..704c5da6ebc--- /dev/null+++ b/e2e/test/scenarios/embedding/embedding-admin-settings-oss.cy.spec.ts@@ -0,0 +1,63 @@+const { H } = cy;++// These tests will run on both OSS and EE instances, both without a token.+describe(+ "scenarios > embedding > admin settings > oss",+ { tags: "@OSS" },+ () => {+ beforeEach(() => {+ H.restore();+ cy.signInAsAdmin();+ H.updateSetting("show-sdk-embed-terms", false);+ });++ it("shows all embedding types without the setup guide", () => {+ cy.log("Navigate to Embedding admin section");+ cy.visit("/admin/embedding");++ cy.log("Check that we're on the modular embedding page");+ cy.url().should("include", "/admin/embedding/modular");+ cy.get("main").findByText("Modular embedding").should("be.visible");++ cy.log("Verify sidebar contains static smbedding link");+ cy.findByTestId("admin-layout-sidebar")+ .findByRole("link", { name: /Static/ })+ .should("have.attr", "href", "/admin/embedding/static");++ cy.log("Verify sidebar contains interactive embedding");+ cy.findByTestId("admin-layout-sidebar")+ .findByRole("link", { name: /Interactive/ })+ .should("have.attr", "href", "/admin/embedding/interactive");++ cy.log("Verify sidebar does not contain setup guide");+ cy.findByTestId("admin-layout-sidebar")+ .findByRole("link", { name: /Setup guide/ })+ .should("not.exist");++ cy.log("Verify 2 upsell icons are present in sidebar");+ cy.findByTestId("admin-layout-sidebar")+ .icon("gem")+ .should("have.length", 2);+ });++ it("should show interactive embedding upsell on oss", () => {+ cy.visit("/admin/embedding/interactive");++ cy.findByTestId("admin-layout-content").within(() => {+ cy.findByRole("heading", { name: "Interactive embedding" }).should(+ "be.visible",+ );++ cy.log("upsell gem icon should be visible");+ cy.icon("gem").should("be.visible");++ cy.findByRole("link", { name: /Check out our Quickstart/i })+ .should("be.visible")+ .and("have.attr", "href")+ .and("contain", "interactive-embedding-quick-start-guide");++ cy.findByRole("link", { name: "Try for free" }).should("be.visible");+ });+ });+ },+);diff --git a/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.ts b/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.tsnew file mode 100644index 00000000000..6a3e35b8530--- /dev/null+++ b/e2e/test/scenarios/embedding/embedding-hub/embedding-hub.cy.spec.ts@@ -0,0 +1,149 @@+import { enableJwtAuth } from "e2e/support/helpers/e2e-jwt-helpers";++const { H } = cy;++describe("scenarios - embedding hub", () => {+ describe("checklist", () => {+ beforeEach(() => {+ H.restore("setup");+ cy.signInAsAdmin();+ H.activateToken("pro-cloud");+ });++ it("Contains setup guide in sidebar", () => {+ cy.visit("/admin/embedding");++ cy.findByTestId("admin-layout-sidebar")+ .findByText("Setup guide")+ .should("exist")+ .click();++ cy.findByTestId("admin-layout-content")+ .findByRole("heading", { name: "Embedding setup guide" })+ .should("exist");+ });++ it('"Generate a dashboard" card should work correctly', () => {+ cy.visit("/admin/embedding/setup-guide");++ cy.log("Find and click on 'Generate a dashboard' card");+ cy.findByTestId("admin-layout-content")+ .findByText("Generate a dashboard")+ .click();++ cy.log("Select a table to generate dashboard from");+ H.modal().within(() => {+ cy.findByText("Choose a table to generate a dashboard").should(+ "be.visible",+ );+ // Click on the first available table+ cy.get("[data-testid='picker-item']").first().click();+ });++ cy.log("Should navigate to auto dashboard creation");+ cy.url().should("include", "/auto/dashboard/table/");+ });++ it('"Add data" card should work correctly', () => {+ cy.visit("/admin/embedding/setup-guide");++ cy.log("Find and click on 'Add data' card");+ cy.findByTestId("admin-layout-content").findByText("Add data").click();++ cy.log("Add data modal should open");+ cy.findByRole("dialog").within(() => {+ cy.findByRole("heading", { name: "Add data" }).should("be.visible");+ });+ });++ it("Uploading CSVs to sample database should mark the 'Add Data' step as done", () => {+ cy.intercept("GET", "/api/ee/embedding-hub/checklist").as("getChecklist");++ cy.log("Enable CSV uploads");+ cy.request("PUT", "/api/setting/uploads-settings", {+ value: {+ db_id: 1, // Sample Database ID+ schema_name: "PUBLIC",+ table_prefix: null,+ },+ });++ cy.visit("/admin/embedding/setup-guide");++ cy.log("'Add data' should not be marked as done");+ cy.findByTestId("admin-layout-content")+ .findByText("Add data")+ .closest("button")+ .findByText("Done")+ .should("not.exist");++ cy.findByTestId("admin-layout-content").findByText("Add data").click();++ H.modal().within(() => {+ cy.findByText("CSV").click();++ cy.log("Upload a CSV file");+ cy.get("#add-data-modal-upload-csv-input").selectFile(+ {+ contents: Cypress.Buffer.from(+ "header1,header2\nvalue1,value2",+ "utf8",+ ),+ fileName: "test-upload.csv",+ mimeType: "text/csv",+ lastModified: Date.now(),+ },+ { force: true },+ );++ cy.button("Upload").should("be.enabled").click();+ });++ cy.wait("@getChecklist");++ cy.log("'Add data' should be marked as done");+ cy.findByTestId("admin-layout-content")+ .findByText("Add data")+ .closest("button")+ .scrollIntoView()+ .findByText("Done")+ .should("be.visible");+ });++ it('"Create models" link should navigate correctly', () => {+ cy.visit("/admin/embedding/setup-guide");++ cy.log("Find and click on 'Create models' link");+ cy.findByTestId("admin-layout-content")+ .findByText("Create models")+ .first()+ .click();++ cy.log("Should navigate to model creation page");+ cy.url().should("include", "/model/new");+ });++ it("Embed in production step should be locked until JWT is enabled", () => {+ cy.visit("/admin/embedding/setup-guide");++ cy.findByTestId("admin-layout-content")+ .findByText("Embed in production")+ .scrollIntoView()+ .should("be.visible")+ .closest("button")+ .icon("lock")+ .should("be.visible");++ enableJwtAuth();+ cy.reload();++ cy.findByTestId("admin-layout-content")+ .findByText("Embed in production")+ .scrollIntoView()+ .should("be.visible")+ .closest("button")+ .icon("lock")+ .should("not.exist");+ });+ });+});diff --git a/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js b/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.jsindex c0e263a91d4..5f2ba9cb413 100644--- a/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js+++ b/e2e/test/scenarios/embedding/embedding-smoketests.cy.spec.js@@ -6,12 +6,7 @@ import {ORDERS_QUESTION_ID,} from "e2e/support/cypress_sample_instance_data";-const embeddingPage = "/admin/settings/embedding-in-other-applications";-const standalonePath =- "/admin/settings/embedding-in-other-applications/standalone";-const upgradeUrl = "https://www.metabase.com/upgrade";-const embeddingDescription =- "Embed dashboards, questions, or the entire Metabase app into your application. Integrate with your server code to create a secure environment, limited to specific users or organizations.";+const standalonePath = "/admin/embedding/static";// These tests will run on both OSS and EE instances. Both without a token!describe("scenarios > embedding > smoke tests", { tags: "@OSS" }, () => {@@ -43,81 +38,8 @@ describe("scenarios > embedding > smoke tests", { tags: "@OSS" }, () => {resetEmbedding();});- it("should display the embedding page correctly", () => {- cy.visit("/admin/settings/setup");-- sidebar().findByText("Embedding").click(); // open section- sidebar()- .findAllByText("Overview") // the second "overview" page is for embedding- .should("have.length", 2)- .last()- .click();-- cy.location("pathname").should("eq", embeddingPage);- mainPage().findByText(embeddingDescription).should("be.visible");- cy.log(- "With the embedding enabled, we should now see two new sections on the main page",- );- cy.log("The first section: 'Static embedding'");- cy.findByRole("article", { name: "Static embedding" }).within(() => {- // FE unit tests are making sure this section doesn't exist when a valid token is provided,- // so we don't have to do it here using conditional logic- assertLinkMatchesUrl("upgrade to a specific paid plan", upgradeUrl);-- cy.findByRole("link", { name: "Manage" })- .should("have.attr", "href")- .and("eq", standalonePath);- cy.findByText("Static embedding");- cy.findByText("Manage").click();- cy.location("pathname").should("eq", standalonePath);- });-- cy.log("Standalone embeds page");- // TODO: Remove this when the actual BE is implemented, this flag still controls the static embedding- // I've tried to change this but it failed like 500 BE tests.- cy.request("PUT", "/api/setting/enable-embedding-static", {- value: true,- });- mainPage().within(() => {- cy.findByLabelText("Enable static embedding")- .click({ force: true })- .should("be.checked");- cy.findByTestId("embedding-secret-key-setting").within(() => {- cy.findByText("Embedding secret key");- cy.findByText(- "Standalone Embed Secret Key used to sign JSON Web Tokens for requests to /api/embed endpoints. This lets you create a secure environment limited to specific users or organizations.",- );- cy.findByRole("textbox").invoke("val").should("have.length", 64);- cy.button("Regenerate key");- });-- cy.findByTestId("embedded-resources").within(() => {- cy.findByText("Embedded Dashboards");- cy.findByText("No dashboards have been embedded yet.");-- cy.findByText("Embedded Questions");- cy.findByText("No questions have been embedded yet.");- });- });-- cy.go("back");- cy.location("pathname").should("eq", embeddingPage);-- cy.log("The second section: 'Interactive embedding'");- cy.findByRole("article", { name: /Interactive embedding/ }).within(() => {- cy.findByText("Interactive embedding");-- cy.findByRole("link", { name: "Try for free" })- .should("have.attr", "href")- .and(- "eq",- "https://www.metabase.com/product/embedded-analytics?utm_source=product&utm_medium=upsell&utm_campaign=embedding-interactive&utm_content=embedding-page&source_plan=oss",- );- });- });-it("should show the sdk upsell link in oss", () => {- cy.visit("/admin/settings/embedding-in-other-applications/sdk");+ cy.visit("/admin/embedding/modular");mainPage().within(() => {cy.findByRole("link", { name: "Try for free" })@@ -379,12 +301,6 @@ function resetEmbedding() {H.updateSetting("embedding-secret-key", null);}-function assertLinkMatchesUrl(text, url) {- cy.findByRole("link", { name: text })- .should("have.attr", "href")- .and("contain", url);-}-function ensureEmbeddingIsDisabled() {H.openSharingMenu();H.sharingMenu()@@ -411,10 +327,6 @@ function visitAndEnableSharing(object, acceptTerms = true) {H.openStaticEmbeddingModal({ acceptTerms });}-function sidebar() {- return cy.findByTestId("admin-layout-sidebar");-}-function mainPage() {return cy.findByTestId("admin-layout-content");}diff --git a/e2e/test/scenarios/embedding/embedding-upsells.cy.spec.ts b/e2e/test/scenarios/embedding/embedding-upsells.cy.spec.tsindex f1f0ad1f73a..c92fd557a41 100644--- a/e2e/test/scenarios/embedding/embedding-upsells.cy.spec.ts+++ b/e2e/test/scenarios/embedding/embedding-upsells.cy.spec.ts@@ -13,7 +13,7 @@ describe("scenarios > embedding > upsells", { tags: "@EE" }, () => {cy.stub(win, "open").as("open");});- cy.visit("/admin/settings/embedding-in-other-applications/sdk");+ cy.visit("/admin/embedding/modular");mainPage().within(() => {cy.contains("SDK for React").should("be.visible");@@ -36,35 +36,6 @@ describe("scenarios > embedding > upsells", { tags: "@EE" }, () => {expect(url).to.match(/source_plan=oss/);});});-- it("should show the interactive embed card with upsell button", () => {- cy.on("window:before:load", (win) => {- // prevent Cypress opening in a new window/tab and spy on this method- cy.stub(win, "open").as("open");- });-- cy.visit("/admin/settings/embedding-in-other-applications");-- mainPage().within(() => {- cy.contains("Interactive embedding").should("be.visible");- });-- cy.findByRole("button", { name: "Try for free" }).click();-- cy.get<sinon.SinonSpy>("@open").should((spy) => {- const url = spy.getCall(0).args[0];-- expect(url).to.include(- "https://test-store.metabase.com/checkout/upgrade/self-hosted",- );-- expect(url).to.match(/utm_source=product/);- expect(url).to.match(/utm_medium=upsell/);- expect(url).to.match(/utm_campaign=embedding-interactive/);- expect(url).to.match(/utm_content=embedding-page/);- expect(url).to.match(/source_plan=oss/);- });- });});function mainPage() {diff --git a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js b/e2e/test/scenarios/onboarding/command-palette.cy.spec.jsindex 8e6501fa110..ebf2bb2395a 100644--- a/e2e/test/scenarios/onboarding/command-palette.cy.spec.js+++ b/e2e/test/scenarios/onboarding/command-palette.cy.spec.js@@ -544,9 +544,9 @@ H.describeWithSnowplow("shortcuts", { tags: ["@actions"] }, () => {cy.findByTestId("site-name-setting").should("exist");cy.location("pathname").should("contain", "/admin/settings");- cy.realPress("3");+ cy.realPress("4");cy.location("pathname").should("contain", "/admin/datamodel");- cy.realPress("7");+ cy.realPress("8");cy.location("pathname").should("contain", "/admin/tools");});diff --git a/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js b/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.jsindex 0eefa32b2db..07655d8d10e 100644--- a/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js+++ b/e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js@@ -194,11 +194,7 @@ describe("embed modal display", () => {cy.findByText("Disabled.").should("be.visible");cy.findByText("Enable in admin settings").should("be.visible")- .and(- "have.attr",- "href",- "/admin/settings/embedding-in-other-applications/full-app",- );+ .and("have.attr", "href", "/admin/embedding/interactive");},);});diff --git a/enterprise/backend/src/metabase_enterprise/api/routes.clj b/enterprise/backend/src/metabase_enterprise/api/routes.cljindex 8e7d69f202a..04984c2b5e7 100644--- a/enterprise/backend/src/metabase_enterprise/api/routes.clj+++ b/enterprise/backend/src/metabase_enterprise/api/routes.clj@@ -22,6 +22,7 @@[metabase-enterprise.database-routing.api][metabase-enterprise.documents.api][metabase-enterprise.email.api]+ [metabase-enterprise.embedding-hub.api][metabase-enterprise.gsheets.api :as gsheets.api][metabase-enterprise.llm.api][metabase-enterprise.metabot-v3.api]@@ -62,7 +63,8 @@:transforms (deferred-tru "Transforms"):upload-management (deferred-tru "Upload Management"):database-routing (deferred-tru "Database Routing")- :cloud-custom-smtp (deferred-tru "Custom SMTP")})+ :cloud-custom-smtp (deferred-tru "Custom SMTP")+ :embedding (deferred-tru "Embedding")})(defn- premium-handler [handler required-feature](let [handler (cond-> handler@@ -102,6 +104,7 @@"/database-routing" (premium-handler metabase-enterprise.database-routing.api/routes :database-routing)"/document" (premium-handler metabase-enterprise.documents.api/routes :documents)"/email" (premium-handler metabase-enterprise.email.api/routes :cloud-custom-smtp)+ "/embedding-hub" (premium-handler metabase-enterprise.embedding-hub.api/routes :embedding)"/gsheets" (-> gsheets.api/routes ;; gsheets requires both features.(premium-handler :attached-dwh)(premium-handler :etl-connections))diff --git a/enterprise/backend/src/metabase_enterprise/embedding_hub/api.clj b/enterprise/backend/src/metabase_enterprise/embedding_hub/api.cljnew file mode 100644index 00000000000..a177759d734--- /dev/null+++ b/enterprise/backend/src/metabase_enterprise/embedding_hub/api.clj@@ -0,0 +1,58 @@+(ns metabase-enterprise.embedding-hub.api+ (:require+ [metabase-enterprise.sso.settings :as sso-settings]+ [metabase.api.macros :as api.macros]+ [metabase.api.routes.common :refer [+auth]]+ [metabase.appearance.core :as appearance]+ [metabase.audit-app.core :as audit]+ [metabase.embedding.settings :as embedding.settings]+ [metabase.premium-features.core :as premium-features]+ [toucan2.core :as t2]))++(defn- has-user-added-database? []+ (or (t2/exists? :model/Database {:where [:and+ [:= :is_sample false]+ [:= :is_audit false]]})+ ;; check for CSV uploads to sample db+ ;; as the sample db is excluded from the above query+ (when-let [sample-db-id (t2/select-one-pk :model/Database :is_sample true)]+ (t2/exists? :model/Table {:where [:and+ [:= :active true]+ [:= :is_upload true]+ [:= :db_id sample-db-id]]}))))++(defn- has-user-created-dashboard? []+ (let [example-dashboard-id (appearance/example-dashboard-id)+ audit-collection-ids (filter some? [(when-let [audit-coll (audit/default-audit-collection)] (:id audit-coll))+ (when-let [custom-coll (audit/default-custom-reports-collection)] (:id custom-coll))])]+ (t2/exists? :model/Dashboard {:where (cond-> [:and+ [:= :archived false]]+ example-dashboard-id (conj [:not= :id example-dashboard-id])+ (seq audit-collection-ids) (conj [:or+ [:is :collection_id nil]+ [:not-in :collection_id audit-collection-ids]]))})))++(defn- has-configured-sandboxes? []+ (and (premium-features/has-feature? :sandboxes)+ (t2/exists? :model/Sandbox)))++(defn- has-configured-sso? []+ (or (and (premium-features/has-feature? :sso-jwt) (sso-settings/jwt-enabled) (sso-settings/jwt-configured))+ (and (premium-features/has-feature? :sso-saml) (sso-settings/saml-enabled) (sso-settings/saml-configured))))++(defn- embedding-hub-checklist []+ {"add-data" (has-user-added-database?)+ "create-dashboard" (has-user-created-dashboard?)+ "configure-row-column-security" (has-configured-sandboxes?)+ "create-test-embed" (embedding.settings/embedding-hub-test-embed-snippet-created)+ "embed-production" (embedding.settings/embedding-hub-production-embed-snippet-created)+ "secure-embeds" (has-configured-sso?)})++(api.macros/defendpoint :get "/checklist"+ "Get the embedding hub checklist status, indicating which setup steps have been completed."+ []+ (embedding-hub-checklist))++(def ^{:arglists '([request respond raise])} routes+ "`/api/ee/embedding-hub` routes."+ (api.macros/ns-handler *ns* +auth))diff --git a/enterprise/backend/test/metabase_enterprise/api/session_test.clj b/enterprise/backend/test/metabase_enterprise/api/session_test.cljindex 4b43284f3ee..c7df48de095 100644--- a/enterprise/backend/test/metabase_enterprise/api/session_test.clj+++ b/enterprise/backend/test/metabase_enterprise/api/session_test.clj@@ -25,6 +25,7 @@:embedding:embedding-sdk:embedding-simple+ :embedding-hub:hosting:llm-autodescription:metabot-v3diff --git a/enterprise/frontend/src/embedding-sdk-package/dev.md b/enterprise/frontend/src/embedding-sdk-package/dev.mdindex 9b2894c9322..e10feb42c74 100644--- a/enterprise/frontend/src/embedding-sdk-package/dev.md+++ b/enterprise/frontend/src/embedding-sdk-package/dev.md@@ -33,8 +33,8 @@ Storybook expects an instance running on `localhost:3000` with some configuratio- Set JWT secret to be "`0000000000000000000000000000000000000000000000000000000000000000`" in Admin > Authentication >JWT > String used by the JWT signing key- Press "Save and enable"-- on [/admin/settings/embedding-in-other-applications](http://localhost:3000/admin/settings/embedding-in-other-applications)- - Enable the sdk+- on [/admin/embedding/modular](http://localhost:3000/admin/embedding/modular)+ - Enable the "SDK for React" cardThen you can run `yarn storybook-embedding-sdk` to start storybook.@@ -74,22 +74,26 @@ In order to check compatibility between Sample Apps and Embedding SDK, we have a#### Local runsTo run these tests locally, run:+```TEST_SUITE=<sample_app_repo_name>-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local START_METABASE=false GENERATE_SNAPSHOTS=false START_CONTAINERS=false yarn test-cypress```For example for the `metabase-nodejs-react-sdk-embedding-sample`, run:+```TEST_SUITE=metabase-nodejs-react-sdk-embedding-sample-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local START_METABASE=false GENERATE_SNAPSHOTS=false START_CONTAINERS=false yarn test-cypress```##### :warning: Obtaining the Shoppy's Metabase App DB Dump locally+For the Shoppy's Sample App Tests (`TEST_SUITE=shoppy-e2e`) locally, a proper App DB dump of the Shoppy's Metabase instance must be placed to the `./e2e/tmp/db_dumps/shoppy_metabase_app_db_dump.sql`You can get it by:+- Enabling the `Tailscale` and logging in using your work email address.- Running `pg_dump "postgres://{{ username }}:{{ password }}@{{ host }}:{{ port }}/{{ database }}" > ./e2e/tmp/db_dumps/shoppy_metabase_app_db_dump.sql` command.- - See the `Shoppy Coredev Appdb` record in `1password` for credentials.+ - See the `Shoppy Coredev Appdb` record in `1password` for credentials.#### CI runs@@ -98,11 +102,13 @@ On our CI, test failures do not block the merging of a pull request (PR). Howeve- **Build Failure**:The failure occurs during the build of a local `@metabase/embedding-sdk-react` dist. This indicates there is likely a syntax or type error in the front-end code.+- **Test Run Failure**:The failure occurs during the actual test execution. In this case, the PR may have introduced a change that either:- - Breaks the entire Metabase or Embedding SDK, or- - Breaks the compatibility between the Embedding SDK and the Sample Apps.++ - Breaks the entire Metabase or Embedding SDK, or+ - Breaks the compatibility between the Embedding SDK and the Sample Apps.If a PR breaks compatibility between the Embedding SDK and the Sample Apps, the PR can still be merged. However, for each Sample App affected, a separate PR should be created to restore compatibility with the new `@metabase/embedding-sdk-react` version when it is released. These compatibility PRs should be merged only once the Embedding SDK version containing breaking changes is officially released.@@ -111,6 +117,7 @@ If a PR breaks compatibility between the Embedding SDK and the Sample Apps, theWhen we want to check integration of the Embedding SDK with consumer's apps that use different frameworks/bundlers, or when we want to test some tricky integration cases like conflicting types, we use Host App tests.Tests a bit similar to Sample App tests, but:+- Host Apps are placed in the `metabase` repo `e2e/embedding-sdk-host-apps/<HOST_APP_NAME>`.- Host Apps tests are under `e2e/test-host-app/<HOST_APP_NAME>/*`.- Host app contains the client application only that is run in a Docker container during e2e testing.@@ -119,11 +126,13 @@ Tests a bit similar to Sample App tests, but:#### Local runsTo run these tests locally, run:+```ENTERPRISE_TOKEN=<token> TEST_SUITE=<host_app_name>-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local HOST_APP_ENVIRONMENT=production yarn test-cypress```For example for the `vite-6-host-app` Host App, run:+```ENTERPRISE_TOKEN=<token> TEST_SUITE=vite-6-host-app-e2e OPEN_UI=false EMBEDDING_SDK_VERSION=local HOST_APP_ENVIRONMENT=production yarn test-cypress```diff --git a/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx b/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsxindex cecaf3b1e25..eb5caf5c25e 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.tsx@@ -1,5 +1,9 @@import { t } from "ttag";+import {+ RelatedSettingsSection,+ getInteractiveEmbeddingRelatedSettingItems,+} from "metabase/admin/components/RelatedSettingsSection";import {SettingsPageWrapper,SettingsSection,@@ -60,6 +64,10 @@ export function InteractiveEmbeddingSettings() {<SameSiteSelectWidget /></SettingsSection>++ <RelatedSettingsSection+ items={getInteractiveEmbeddingRelatedSettingItems()}+ /></SettingsPageWrapper>);}diff --git a/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.unit.spec.tsxindex 81a400071a7..ec3e7d4ba53 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding/components/InteractiveEmbeddingSettings.unit.spec.tsx@@ -89,4 +89,20 @@ describe("InteractiveEmbeddingSettings", () => {expect(url).toContain("/setting/session-cookie-samesite");expect(body).toEqual({ value: "strict" });});++ it("should show cards with related settings", async () => {+ await setup({ enabled: true });++ const relatedSettingCards = await screen.findAllByTestId(+ "related-setting-card",+ );+ expect(relatedSettingCards).toHaveLength(6);++ expect(await screen.findByText("Authentication")).toBeInTheDocument();+ expect(await screen.findByText("Databases")).toBeInTheDocument();+ expect(await screen.findByText("People")).toBeInTheDocument();+ expect(await screen.findByText("Permissions")).toBeInTheDocument();+ expect(await screen.findByText("Metabot")).toBeInTheDocument();+ expect(await screen.findByText("Appearance")).toBeInTheDocument();+ });});diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/GetCodeStep.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/GetCodeStep.tsxindex 23a6a887a81..6bb46b0dc5b 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/GetCodeStep.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/GetCodeStep.tsx@@ -1,5 +1,6 @@import { t } from "ttag";+import { useUpdateSettingsMutation } from "metabase/api";import { CodeEditor } from "metabase/common/components/CodeEditor";import { useSetting } from "metabase/common/hooks";import {@@ -13,6 +14,7 @@ import {Stack,Text,} from "metabase/ui";+import type { SettingKey } from "metabase-types/api";import { trackEmbedWizardCodeCopied } from "../analytics";import { useSdkIframeEmbedSetupContext } from "../context";@@ -20,6 +22,7 @@ import { useSdkIframeEmbedSnippet } from "../hooks/use-sdk-iframe-embed-snippet"export const GetCodeStep = () => {const { settings, updateSettings } = useSdkIframeEmbedSetupContext();+ const [updateInstanceSettings] = useUpdateSettingsMutation();const isJwtEnabled = useSetting("jwt-enabled");const isSamlEnabled = useSetting("saml-enabled");@@ -116,6 +119,13 @@ export const GetCodeStep = () => {onClick={() => {copy();trackEmbedWizardCodeCopied();++ // Embedding Hub: track step completion+ const settingKey: SettingKey = settings.useExistingUserSession+ ? "embedding-hub-test-embed-snippet-created"+ : "embedding-hub-production-embed-snippet-created";++ updateInstanceSettings({ [settingKey]: true });}}>{copied ? t`Copied!` : t`Copy Code`}diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.tsxindex a22609368bc..a70ef552701 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.tsx@@ -1,12 +1,24 @@import { useState } from "react";import { ResizableBox } from "react-resizable";+import { match } from "ts-pattern";import { t } from "ttag";import "react-resizable/css/styles.css";import noResultsSource from "assets/img/no_results.svg";+import { useUpdateSettingsMutation } from "metabase/api";import { useSetting } from "metabase/common/hooks";-import { Box, Button, Card, Flex, Group, Image, Stack } from "metabase/ui";+import {+ Box,+ Button,+ Card,+ Flex,+ Group,+ Icon,+ Image,+ Stack,+} from "metabase/ui";+import type { SettingKey } from "metabase-types/api";import { useSdkIframeEmbedSetupContext } from "../context";import { useSdkIframeEmbedNavigation } from "../hooks";@@ -16,18 +28,49 @@ import S from "./SdkIframeEmbedSetup.module.css";import { SdkIframeEmbedSetupProvider } from "./SdkIframeEmbedSetupProvider";const SdkIframeEmbedSetupContent = () => {- const { currentStep } = useSdkIframeEmbedSetupContext();+ const [updateSettings] = useUpdateSettingsMutation();+ const { currentStep, settings } = useSdkIframeEmbedSetupContext();const isSimpleEmbeddingEnabled = useSetting("enable-embedding-simple");- const {- handleNext,- handleBack,- canGoNext,- canGoBack,- isLastStep,- StepContent,- } = useSdkIframeEmbedNavigation();+ const { handleNext, handleBack, canGoBack, StepContent } =+ useSdkIframeEmbedNavigation();++ function handleEmbedDone() {+ // Embedding Hub: track step completion+ const settingKey: SettingKey = settings.useExistingUserSession+ ? "embedding-hub-test-embed-snippet-created"+ : "embedding-hub-production-embed-snippet-created";++ updateSettings({ [settingKey]: true });++ window.history.back();+ }++ const nextStepButton = match(currentStep)+ .with("get-code", () => (+ <Button+ variant="filled"+ onClick={handleEmbedDone}+ leftSection={<Icon name="check_filled" />}+ >+ {t`Done`}+ </Button>+ ))+ .with("select-embed-options", () => (+ <Button variant="filled" onClick={handleNext}>+ {t`Get Code`}+ </Button>+ ))+ .otherwise(() => (+ <Button+ variant="filled"+ onClick={handleNext}+ disabled={!isSimpleEmbeddingEnabled}+ >+ {t`Next`}+ </Button>+ ));return (<Box className={S.Container}>@@ -46,15 +89,7 @@ const SdkIframeEmbedSetupContent = () => {{t`Back`}</Button>- {!isLastStep && (- <Button- variant="filled"- onClick={handleNext}- disabled={!canGoNext || !isSimpleEmbeddingEnabled}- >- {currentStep === "select-embed-options" ? t`Get Code` : t`Next`}- </Button>- )}+ {nextStepButton}</Group></Box></SidebarResizer>diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetupProvider.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetupProvider.tsxindex ff0d845c2c5..ca5404572d8 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetupProvider.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetupProvider.tsx@@ -5,6 +5,7 @@ import {useMemo,useState,} from "react";+import { useLocation } from "react-use";import { match } from "ts-pattern";import _ from "underscore";@@ -35,6 +36,7 @@ interface SdkIframeEmbedSetupProviderProps {export const SdkIframeEmbedSetupProvider = ({children,}: SdkIframeEmbedSetupProviderProps) => {+ const location = useLocation();const [isEmbedSettingsLoaded, setEmbedSettingsLoaded] = useState(false);const [rawSettings, setRawSettings] = useState<SdkIframeEmbedSetupSettings>();@@ -58,6 +60,11 @@ export const SdkIframeEmbedSetupProvider = ({const modelCount = searchData?.total ?? 0;+ // Embedding Hub: pre-specifies the auth method to use+ const authMethodOverride = useMemo(() => {+ return new URLSearchParams(location.search).get("auth_method");+ }, [location.search]);+const defaultSettings = useMemo(() => {return getDefaultSdkIframeEmbedSettings("dashboard",@@ -163,11 +170,26 @@ export const SdkIframeEmbedSetupProvider = ({// If they are, set them as the current settings.useEffect(() => {if (!isEmbedSettingsLoaded && !isRecentsLoading) {- setRawSettings({ ...settings, ...persistedSettings });+ setRawSettings({+ ...settings,+ ...persistedSettings,++ // Override the persisted settings if `auth_method` is specified.+ // This is used for Embedding Hub.+ ...(authMethodOverride !== null && {+ useExistingUserSession: authMethodOverride === "user_session",+ }),+ });setEmbedSettingsLoaded(true);}- }, [persistedSettings, isEmbedSettingsLoaded, settings, isRecentsLoading]);+ }, [+ persistedSettings,+ isEmbedSettingsLoaded,+ settings,+ isRecentsLoading,+ authMethodOverride,+ ]);return (<SdkIframeEmbedSetupContext.Provider value={value}>diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/SdkIframeEmbedSetup-embedding-hub.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/SdkIframeEmbedSetup-embedding-hub.unit.spec.tsxnew file mode 100644index 00000000000..a35152ad39b--- /dev/null+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/SdkIframeEmbedSetup-embedding-hub.unit.spec.tsx@@ -0,0 +1,55 @@+import userEvent from "@testing-library/user-event";++import { screen } from "__support__/ui";++import { setup, waitForUpdateSetting } from "./test-setup";++const mockLocation = (search: string) =>+ jest.mock("react-use", () => ({ useLocation: jest.fn(() => ({ search })) }));++describe("Embed flow > embedding hub step completion tracking", () => {+ afterEach(() => {+ jest.clearAllMocks();+ });++ it.each([+ { authMethod: "user_session", trigger: "copy" },+ { authMethod: "sso", trigger: "copy" },+ { authMethod: "user_session", trigger: "done" },+ { authMethod: "sso", trigger: "done" },+ ])(+ "updates setting on $trigger with $authMethod",+ async ({ authMethod, trigger }) => {+ mockLocation(`auth_method=${authMethod}`);+ setup({+ jwtReady: authMethod === "sso",+ simpleEmbeddingEnabled: true,+ });++ await userEvent.click(screen.getByRole("button", { name: "Next" }));+ await userEvent.click(screen.getByRole("button", { name: "Next" }));+ await userEvent.click(screen.getByRole("button", { name: "Get Code" }));++ const authRadio = screen.getByDisplayValue(+ authMethod === "user_session" ? "user-session" : "sso",+ );++ await userEvent.click(authRadio);+ expect(authRadio).toBeChecked();++ const actionButton = screen.getByRole("button", {+ name: trigger === "copy" ? /Copy Code/ : /Done/,+ });++ await userEvent.click(actionButton);++ const expectedSetting =+ authMethod === "sso"+ ? "embedding-hub-production-embed-snippet-created"+ : "embedding-hub-test-embed-snippet-created";++ const matchingRequest = await waitForUpdateSetting(expectedSetting, true);+ expect(matchingRequest).toBeDefined();+ },+ );+});diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/SdkIframeEmbedSetup.unit.spec.tsxsimilarity index 79%rename from enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.unit.spec.tsxrename to enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/SdkIframeEmbedSetup.unit.spec.tsxindex c4fdff5d404..b40b1345551 100644--- a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/SdkIframeEmbedSetup.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/SdkIframeEmbedSetup.unit.spec.tsx@@ -1,30 +1,8 @@import userEvent from "@testing-library/user-event";-import {- setupDashboardEndpoints,- setupRecentViewsAndSelectionsEndpoints,-} from "__support__/server-mocks";-import { renderWithProviders, screen } from "__support__/ui";-import { createMockDashboard } from "metabase-types/api/mocks";-import {- createMockSettingsState,- createMockState,-} from "metabase-types/store/mocks";--import { SdkIframeEmbedSetup } from "./SdkIframeEmbedSetup";--const setup = (options?: { simpleEmbeddingEnabled?: boolean }) => {- setupRecentViewsAndSelectionsEndpoints([], ["selections", "views"]);- setupDashboardEndpoints(createMockDashboard());-- renderWithProviders(<SdkIframeEmbedSetup />, {- storeInitialState: createMockState({- settings: createMockSettingsState({- "enable-embedding-simple": options?.simpleEmbeddingEnabled ?? false,- }),- }),- });-};+import { screen } from "__support__/ui";++import { setup } from "./test-setup";describe("Embed flow > initial setup", () => {it("shows the embed experience step as the first step", () => {@@ -109,4 +87,11 @@ describe("Embed flow > forward and backward navigation", () => {screen.queryByText("Select a dashboard to embed"),).not.toBeInTheDocument();});++ it("disables next and back buttons when simple embedding is disabled", () => {+ setup({ simpleEmbeddingEnabled: false });++ expect(screen.getByRole("button", { name: "Next" })).toBeDisabled();+ expect(screen.getByRole("button", { name: "Back" })).toBeDisabled();+ });});diff --git a/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/test-setup.tsx b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/test-setup.tsxnew file mode 100644index 00000000000..81dcd20a8f7--- /dev/null+++ b/enterprise/frontend/src/metabase-enterprise/embedding_iframe_sdk_setup/components/tests/test-setup.tsx@@ -0,0 +1,55 @@+import {+ findRequests,+ setupDashboardEndpoints,+ setupRecentViewsAndSelectionsEndpoints,+ setupUpdateSettingEndpoint,+ setupUpdateSettingsEndpoint,+} from "__support__/server-mocks";+import { renderWithProviders, waitFor } from "__support__/ui";+import { createMockDashboard } from "metabase-types/api/mocks";+import {+ createMockSettingsState,+ createMockState,+} from "metabase-types/store/mocks";++import { SdkIframeEmbedSetup } from "../SdkIframeEmbedSetup";++export const setup = (options?: {+ simpleEmbeddingEnabled?: boolean;+ jwtReady?: boolean;+}) => {+ setupRecentViewsAndSelectionsEndpoints([], ["selections", "views"]);+ setupDashboardEndpoints(createMockDashboard());+ setupUpdateSettingsEndpoint();+ setupUpdateSettingEndpoint();++ renderWithProviders(<SdkIframeEmbedSetup />, {+ storeInitialState: createMockState({+ settings: createMockSettingsState({+ "enable-embedding-simple": options?.simpleEmbeddingEnabled ?? false,+ "jwt-enabled": options?.jwtReady ?? false,+ "jwt-configured": options?.jwtReady ?? false,+ }),+ }),+ });+};++export async function waitForPutRequests() {+ return waitFor(async () => {+ const puts = await findRequests("PUT");+ expect(puts.length).toBeGreaterThan(0);+ return puts;+ });+}++export async function waitForUpdateSetting(settingKey: string, value: any) {+ return waitFor(async () => {+ const puts = await findRequests("PUT");++ return puts.find(+ (request) =>+ request.url.includes("/api/setting") &&+ request.body[settingKey] === value,+ );+ });+}diff --git a/frontend/src/metabase-types/api/mocks/settings.ts b/frontend/src/metabase-types/api/mocks/settings.tsindex 79090a34b92..de38f9568bf 100644--- a/frontend/src/metabase-types/api/mocks/settings.ts+++ b/frontend/src/metabase-types/api/mocks/settings.ts@@ -381,6 +381,8 @@ export const createMockSettings = ("last-used-native-database-id": 1,"embedding-homepage": "hidden","setup-license-active-at-setup": false,+ "embedding-hub-test-embed-snippet-created": false,+ "embedding-hub-production-embed-snippet-created": false,"notebook-native-preview-shown": false,"notebook-native-preview-sidebar-width": null,"query-analysis-enabled": false,diff --git a/frontend/src/metabase-types/api/settings.ts b/frontend/src/metabase-types/api/settings.tsindex 0da30a16428..43137ec3c91 100644--- a/frontend/src/metabase-types/api/settings.ts+++ b/frontend/src/metabase-types/api/settings.ts@@ -229,6 +229,7 @@ const tokenStatusFeatures = ["embedding-sdk","embedding","embedding-simple",+ "embedding-hub","hosting","metabase-store-managed","metabot-v3",@@ -449,6 +450,8 @@ interface AdminSettings {"system-timezone"?: string;"embedding-homepage": EmbeddingHomepageStatus;"setup-license-active-at-setup": boolean;+ "embedding-hub-test-embed-snippet-created": boolean;+ "embedding-hub-production-embed-snippet-created": boolean;"store-url": string;gsheets: Partial<GdrivePayload>;"license-token-missing-banner-dismissal-timestamp"?: Array<string>;@@ -669,6 +672,8 @@ export interface EnterpriseSettings extends Settings {"saml-group-mappings": Record<string, GroupId[]> | null;"database-replication-enabled": boolean | null;"database-replication-connections"?: DatabaseReplicationConnections | null;+ "embedding-hub-test-embed-snippet-created": boolean;+ "embedding-hub-production-embed-snippet-created": boolean;/*** @deprecated*/diff --git a/frontend/src/metabase-types/store/admin.ts b/frontend/src/metabase-types/store/admin.tsindex 27d926da05e..5dc9b6d1270 100644--- a/frontend/src/metabase-types/store/admin.ts+++ b/frontend/src/metabase-types/store/admin.ts@@ -8,6 +8,7 @@ import type {export type AdminPathKey =| "data-model"| "settings"+ | "embedding"| "metabot"| "people"| "databases"diff --git a/frontend/src/metabase/admin/app/reducers.ts b/frontend/src/metabase/admin/app/reducers.tsindex bdb220d9357..1cec8af077e 100644--- a/frontend/src/metabase/admin/app/reducers.ts+++ b/frontend/src/metabase/admin/app/reducers.ts@@ -23,6 +23,11 @@ export const getAdminPaths: () => AdminPath[] = () => {path: "/admin/databases",key: "databases",},+ {+ name: t`Embedding`,+ path: "/admin/embedding",+ key: "embedding",+ },...PLUGIN_METABOT.getAdminPaths(),{name: t`Table Metadata`,diff --git a/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsx b/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsxnew file mode 100644index 00000000000..44189c93e9f--- /dev/null+++ b/frontend/src/metabase/admin/components/RelatedSettingsSection/RelatedSettingsSection.tsx@@ -0,0 +1,70 @@+import { t } from "ttag";++import Link from "metabase/common/components/Link";+import {+ Card,+ Group,+ Icon,+ type IconName,+ SimpleGrid,+ Stack,+ Text,+} from "metabase/ui";++import type { RelatedSettingItem } from "./constants";++export function RelatedSettingsSection({+ items,+}: {+ items?: RelatedSettingItem[];+}) {+ return (+ <Stack gap="md">+ <Text size="lg" fw="bold" lh="xs">+ {t`Related settings`}+ </Text>++ <SimpleGrid cols={3} spacing="md">+ {items?.map((item) => (+ <RelatedSettingCard+ key={item.to}+ icon={item.icon}+ name={item.name}+ to={item.to}+ />+ ))}+ </SimpleGrid>+ </Stack>+ );+}++const RelatedSettingCard = ({+ icon,+ name,+ to,+}: {+ icon: IconName;+ name: string;+ to: string;+}) => {+ return (+ <Card+ component={Link}+ to={to}+ px="md"+ py="xs"+ withBorder+ data-testid="related-setting-card"+ shadow="none"+ h="3rem"+ >+ <Group gap="sm" align="center" h="100%">+ <Icon name={icon} color="var(--mb-color-brand)" />++ <Text fw={500} ta="center">+ {name}+ </Text>+ </Group>+ </Card>+ );+};diff --git a/frontend/src/metabase/admin/components/RelatedSettingsSection/constants.ts b/frontend/src/metabase/admin/components/RelatedSettingsSection/constants.tsnew file mode 100644index 00000000000..bfa6b663a2c--- /dev/null+++ b/frontend/src/metabase/admin/components/RelatedSettingsSection/constants.ts@@ -0,0 +1,98 @@+import { t } from "ttag";++import type { IconName } from "metabase/ui";++export interface RelatedSettingItem {+ icon: IconName;+ name: string;+ to: string;+}++export const getModularEmbeddingRelatedSettingItems =+ (): RelatedSettingItem[] => [+ // TODO: enable this once we've added the "Security" tab to Embedding Settings.+ // {+ // icon: "shield_outline",+ // name: t`Security`,+ // to: "/admin/embedding/security",+ // },+ {+ icon: "lock",+ name: t`Authentication`,+ to: "/admin/settings/authentication",+ },+ {+ icon: "database",+ name: t`Databases`,+ to: "/admin/databases",+ },+ {+ icon: "person",+ name: t`People`,+ to: "/admin/people",+ },+ {+ icon: "group",+ name: t`Permissions`,+ to: "/admin/permissions",+ },+ {+ icon: "palette",+ name: t`Appearance`,+ to: "/admin/settings/appearance",+ },+ ];++export const getStaticEmbeddingRelatedSettingItems =+ (): RelatedSettingItem[] => [+ {+ icon: "database",+ name: t`Databases`,+ to: "/admin/databases",+ },+ {+ icon: "palette",+ name: t`Appearance`,+ to: "/admin/settings/appearance",+ },+ ];++export const getInteractiveEmbeddingRelatedSettingItems =+ (): RelatedSettingItem[] => [+ // TODO: enable this once we've added the "Security" tab to Embedding Settings.+ // {+ // icon: "shield_outline",+ // name: t`Security`,+ // to: "/admin/embedding/security",+ // },+ {+ icon: "lock",+ name: t`Authentication`,+ to: "/admin/settings/authentication",+ },+ {+ icon: "database",+ name: t`Databases`,+ to: "/admin/databases",+ },+ {+ icon: "person",+ name: t`People`,+ to: "/admin/people",+ },+ {+ icon: "group",+ name: t`Permissions`,+ to: "/admin/permissions",+ },+ {+ icon: "metabot",+ name: t`Metabot`,+ to: "/admin/metabot/2",+ },+ {+ icon: "palette",+ name: t`Appearance`,+ to: "/admin/settings/appearance",+ },+ ];diff --git a/frontend/src/metabase/admin/components/RelatedSettingsSection/index.ts b/frontend/src/metabase/admin/components/RelatedSettingsSection/index.tsnew file mode 100644index 00000000000..5d7a3e57a18--- /dev/null+++ b/frontend/src/metabase/admin/components/RelatedSettingsSection/index.ts@@ -0,0 +1,7 @@+export { RelatedSettingsSection } from "./RelatedSettingsSection";++export {+ getModularEmbeddingRelatedSettingItems,+ getStaticEmbeddingRelatedSettingItems,+ getInteractiveEmbeddingRelatedSettingItems,+} from "./constants";diff --git a/frontend/src/metabase/admin/embedding/components/EmbeddingNav.tsx b/frontend/src/metabase/admin/embedding/components/EmbeddingNav.tsxnew file mode 100644index 00000000000..a63744f88c3--- /dev/null+++ b/frontend/src/metabase/admin/embedding/components/EmbeddingNav.tsx@@ -0,0 +1,74 @@+import { t } from "ttag";++import {+ AdminNavItem,+ type AdminNavItemProps,+ AdminNavWrapper,+} from "metabase/admin/components/AdminNav";+import { UpsellGem } from "metabase/admin/upsells/components/UpsellGem";+import { useHasTokenFeature } from "metabase/common/hooks";+import { useSelector } from "metabase/lib/redux";+import { PLUGIN_EMBEDDING } from "metabase/plugins";+import { getLocation } from "metabase/selectors/routing";+import { Divider, Flex, Stack } from "metabase/ui";++export function EmbeddingNav() {+ const hasSimpleEmbedding = useHasTokenFeature("embedding_simple");+ const hasInteractiveEmbedding = PLUGIN_EMBEDDING.isEnabled();+ const hasSdkEmbedding = useHasTokenFeature("embedding_sdk");++ return (+ <AdminNavWrapper>+ <Stack gap="xs">+ {hasSimpleEmbedding && (+ <>+ <EmbeddingNavItem+ path="/admin/embedding/setup-guide"+ label={t`Setup guide`}+ icon="list"+ />++ <Divider mb="sm" />+ </>+ )}++ <EmbeddingNavItem+ path="/admin/embedding/modular"+ label={+ <Flex gap="sm" align="center">+ <span>{t`Modular`}</span>+ {(!hasSdkEmbedding || !hasSimpleEmbedding) && <UpsellGem />}+ </Flex>+ }+ icon="embed_modular"+ />++ <EmbeddingNavItem+ path="/admin/embedding/interactive"+ label={+ <Flex gap="sm" align="center">+ <span>{t`Interactive`}</span>+ {!hasInteractiveEmbedding && <UpsellGem />}+ </Flex>+ }+ icon="embed_interactive"+ />++ <EmbeddingNavItem+ path="/admin/embedding/static"+ label={t`Static`}+ icon="embed_static"+ />+ </Stack>+ </AdminNavWrapper>+ );+}++const EmbeddingNavItem = (props: AdminNavItemProps) => {+ const location = useSelector(getLocation);+ const subpath = location?.pathname;++ const isActive = props.path === subpath;++ return <AdminNavItem {...props} active={isActive} />;+};diff --git a/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsx b/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsxnew file mode 100644index 00000000000..0c154d155c0--- /dev/null+++ b/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsx@@ -0,0 +1,17 @@+import type * as React from "react";++import { AdminSettingsLayout } from "metabase/common/components/AdminLayout/AdminSettingsLayout";++import { EmbeddingNav } from "../components/EmbeddingNav";++export const AdminEmbeddingApp = ({+ children,+}: {+ children: React.ReactNode;+}) => {+ return (+ <AdminSettingsLayout sidebar={<EmbeddingNav />}>+ {children}+ </AdminSettingsLayout>+ );+};diff --git a/frontend/src/metabase/admin/routes.jsx b/frontend/src/metabase/admin/routes.jsxindex ce9db2ddca4..a9d1413752d 100644--- a/frontend/src/metabase/admin/routes.jsx+++ b/frontend/src/metabase/admin/routes.jsx@@ -9,6 +9,7 @@ import { DatabasePage } from "metabase/admin/databases/containers/DatabasePage";import RevisionHistoryApp from "metabase/admin/datamodel/containers/RevisionHistoryApp";import SegmentApp from "metabase/admin/datamodel/containers/SegmentApp";import SegmentListApp from "metabase/admin/datamodel/containers/SegmentListApp";+import { AdminEmbeddingApp } from "metabase/admin/embedding/containers/AdminEmbeddingApp";import { AdminPeopleApp } from "metabase/admin/people/containers/AdminPeopleApp";import { EditUserModal } from "metabase/admin/people/containers/EditUserModal";import { GroupDetailApp } from "metabase/admin/people/containers/GroupDetailApp";@@ -20,6 +21,10 @@ import { UserPasswordResetModal } from "metabase/admin/people/containers/UserPasimport { UserSuccessModal } from "metabase/admin/people/containers/UserSuccessModal";import { PerformanceApp } from "metabase/admin/performance/components/PerformanceApp";import getAdminPermissionsRoutes from "metabase/admin/permissions/routes";+import {+ EmbeddingSdkSettings,+ StaticEmbeddingSettings,+} from "metabase/admin/settings/components/EmbeddingSettings";import { Help } from "metabase/admin/tools/components/Help";import { JobInfoApp } from "metabase/admin/tools/components/JobInfoApp";import { JobTriggersModal } from "metabase/admin/tools/components/JobTriggersModal";@@ -32,10 +37,12 @@ import {import { TaskModal } from "metabase/admin/tools/components/TaskModal";import { TasksApp } from "metabase/admin/tools/components/TasksApp";import { ToolsApp } from "metabase/admin/tools/components/ToolsApp";+import { EmbeddingHub } from "metabase/embedding/embedding-hub";import { ModalRoute } from "metabase/hoc/ModalRoute";import { Route } from "metabase/hoc/Title";import { DataModel } from "metabase/metadata/pages/DataModel";import {+ PLUGIN_ADMIN_SETTINGS,PLUGIN_ADMIN_TOOLS,PLUGIN_ADMIN_USER_MENU_ROUTES,PLUGIN_CACHING,@@ -47,6 +54,7 @@ import {import { ModelPersistenceConfiguration } from "./performance/components/ModelPersistenceConfiguration";import { StrategyEditorForDatabases } from "./performance/components/StrategyEditorForDatabases";import { PerformanceTabId } from "./performance/types";+import { InteractiveEmbeddingUpsellPage } from "./settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage";import { getSettingsRoutes } from "./settingsRoutes";import { ToolsUpsell } from "./tools/components/ToolsUpsell";import { RedirectToAllowedSettings, createAdminRouteGuard } from "./utils";@@ -134,6 +142,58 @@ const getRoutes = (store, CanAccessSettings, IsAdmin) => (</Route></Route></Route>++ {/* EMBEDDING */}+ <Route path="embedding" component={createAdminRouteGuard("embedding")}>+ <Route title={t`Embedding`} component={AdminEmbeddingApp}>+ <IndexRedirect to="modular" />+ <Route+ path="setup-guide"+ title={t`Setup guide`}+ component={EmbeddingHub}+ />+ <Route+ path="modular"+ title={t`Modular`}+ component={EmbeddingSdkSettings}+ />+ <Route+ path="interactive"+ title={t`Interactive`}+ component={() => {+ if (PLUGIN_ADMIN_SETTINGS.InteractiveEmbeddingSettings) {+ return <PLUGIN_ADMIN_SETTINGS.InteractiveEmbeddingSettings />;+ }++ return <InteractiveEmbeddingUpsellPage />;+ }}+ />+ <Route+ path="static"+ title={t`Static`}+ component={StaticEmbeddingSettings}+ />+ </Route>+ </Route>++ {/* Backwards compatibility for embedding settings */}+ <Redirect+ from="/admin/settings/embedding-in-other-applications"+ to="/admin/embedding/modular"+ />+ <Redirect+ from="/admin/settings/embedding-in-other-applications/full-app"+ to="/admin/embedding/interactive"+ />+ <Redirect+ from="/admin/settings/embedding-in-other-applications/standalone"+ to="/admin/embedding/static"+ />+ <Redirect+ from="/admin/settings/embedding-in-other-applications/sdk"+ to="/admin/embedding/modular"+ />+{/* SETTINGS */}<Route path="settings" component={createAdminRouteGuard("settings")}>{getSettingsRoutes()}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingOption.module.css b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingOption.module.cssdeleted file mode 100644index 3c2967d48de..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingOption.module.css+++ /dev/null@@ -1,11 +0,0 @@-.EmbeddingOptionIcon {- --mb-color-embedding-option-primary: var(--mb-color-icon-primary);- --mb-color-embedding-option-secondary: var(--mb-color-icon-secondary);-}--.EmbeddingOptionIcon.Disabled {- --mb-color-embedding-option-primary: var(--mb-color-icon-primary-disabled);- --mb-color-embedding-option-secondary: var(- --mb-color-icon-secondary-disabled- );-}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingOption.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingOption.tsxdeleted file mode 100644index b9d524468f5..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingOption.tsx+++ /dev/null@@ -1,42 +0,0 @@-import type { ReactNode } from "react";--import { SettingsSection } from "metabase/admin/components/SettingsSection";-import { useUniqueId } from "metabase/common/hooks/use-unique-id";-import { Flex, Text, Title } from "metabase/ui";--type EmbeddingOptionProps = {- title: ReactNode;- label?: ReactNode;- children?: ReactNode;- description: ReactNode;- icon: ReactNode;-};--export function EmbeddingOption({- title,- label,- description,- children,- icon,-}: EmbeddingOptionProps) {- const titleId = useUniqueId();- return (- <SettingsSection>- <article aria-labelledby={titleId}>- {icon}- <Flex gap="md" mt="md" mb="sm" direction={"row"} align="center">- <Title id={titleId} order={3}>- {title}- </Title>- {label}- </Flex>- <Text lh={"1.25rem"} mb={"lg"}>- {description}- </Text>- <Flex gap="lg" direction="column" align="flex-start">- {children}- </Flex>- </article>- </SettingsSection>- );-}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/EmbeddingSdkOptionCard.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/EmbeddingSdkOptionCard.tsxdeleted file mode 100644index fb432b17525..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/EmbeddingSdkOptionCard.tsx+++ /dev/null@@ -1,43 +0,0 @@-import { t } from "ttag";--import { UpsellGem } from "metabase/admin/upsells/components/UpsellGem";-import { useSetting } from "metabase/common/hooks";-import { PLUGIN_EMBEDDING, PLUGIN_EMBEDDING_SDK } from "metabase/plugins";-import { Group } from "metabase/ui";--import { EmbeddingOption } from "../EmbeddingOption";-import { LinkButton } from "../LinkButton";--import { SdkIcon } from "./SdkIcon";-import { SdkJsIcon } from "./SdkJsIcon";--export function EmbeddingSdkOptionCard() {- const isEmbeddingSdkReactEnabled = useSetting("enable-embedding-sdk");- const isEmbeddingSdkJsEnabled = useSetting("enable-embedding-simple");- const isEE = PLUGIN_EMBEDDING.isEnabled();- const isEmbeddingSdkFeatureAvailable = PLUGIN_EMBEDDING_SDK.isEnabled();-- return (- <EmbeddingOption- icon={- <Group gap="sm">- <SdkIcon disabled={!isEmbeddingSdkReactEnabled} />- <SdkJsIcon disabled={!isEmbeddingSdkJsEnabled} />- </Group>- }- title={- <Group gap="sm">- {!isEmbeddingSdkFeatureAvailable && <UpsellGem />}- {t`Modular embedding`}- </Group>- }- description={t`Interactive embedding with full, granular control. Embed and style individual Metabase components in your app, and tailor the experience to each person. Allows for CSS styling, custom user flows, event subscriptions, and more. Only available with SSO via JWT.`}- >- <Group justify="flex-start" align="center" w="100%">- <LinkButton to={"/admin/settings/embedding-in-other-applications/sdk"}>- {!isEE ? t`Try it out` : t`Configure`}- </LinkButton>- </Group>- </EmbeddingOption>- );-}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/SdkIcon.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/SdkIcon.tsxdeleted file mode 100644index 35f0634869f..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/SdkIcon.tsx+++ /dev/null@@ -1,36 +0,0 @@-import cx from "classnames";--import EmbeddingOptionS from "../EmbeddingOption.module.css";-import type { EmbeddingOptionIconProps } from "../types";--export const SdkIcon = ({ disabled }: EmbeddingOptionIconProps) => {- return (- <svg- width="40"- height="32"- fill="none"- xmlns="http://www.w3.org/2000/svg"- className={cx(EmbeddingOptionS.EmbeddingOptionIcon, {- [EmbeddingOptionS.Disabled]: disabled,- })}- data-testid="sdk-icon"- data-disabled={disabled}- >- <g clipPath="url(#a)">- <rect- x="1.25"- y="1.25"- width="37.5"- height="29.5"- rx="2.75"- stroke="var(--mb-color-embedding-option-secondary)"- strokeWidth="2.5"- />- <path- d="M20 14.11c1.03 0 1.87.84 1.87 1.89 0 1-.84 1.85-1.87 1.85-1.03 0-1.87-.85-1.87-1.85 0-1.05.84-1.89 1.87-1.89ZM15.37 24c.63.38 2.01-.2 3.6-1.7-.52-.59-1.03-1.23-1.51-1.9a22.965 22.965 0 0 1-2.4-.36c-.51 2.14-.32 3.61.31 3.96Zm.71-5.74-.29-.51c-.11.29-.22.58-.29.86.27.06.57.11.88.16l-.3-.51Zm6.54-.76.81-1.5-.81-1.5c-.3-.53-.62-1-.91-1.47C21.17 13 20.6 13 20 13c-.6 0-1.17 0-1.71.03-.29.47-.61.94-.91 1.47l-.81 1.5.81 1.5c.3.53.62 1 .91 1.47.54.03 1.11.03 1.71.03.6 0 1.17 0 1.71-.03.29-.47.61-.94.91-1.47ZM20 10.78c-.19.22-.39.45-.59.72h1.18c-.2-.27-.4-.5-.59-.72Zm0 10.44c.19-.22.39-.45.59-.72h-1.18c.2.27.4.5.59.72ZM24.62 8c-.62-.38-2 .2-3.59 1.7.52.59 1.03 1.23 1.51 1.9.82.08 1.63.2 2.4.36.51-2.14.32-3.61-.32-3.96Zm-.7 5.74.29.51c.11-.29.22-.58.29-.86-.27-.06-.57-.11-.88-.16l.3.51Zm1.45-7.05c1.47.84 1.63 3.05 1.01 5.63 2.54.75 4.37 1.99 4.37 3.68 0 1.69-1.83 2.93-4.37 3.68.62 2.58.46 4.79-1.01 5.63-1.46.84-3.45-.12-5.37-1.95-1.92 1.83-3.91 2.79-5.38 1.95-1.46-.84-1.62-3.05-1-5.63-2.54-.75-4.37-1.99-4.37-3.68 0-1.69 1.83-2.93 4.37-3.68-.62-2.58-.46-4.79 1-5.63 1.47-.84 3.46.12 5.38 1.95 1.92-1.83 3.91-2.79 5.37-1.95ZM25.08 16c.34.75.64 1.5.89 2.26 2.1-.63 3.28-1.53 3.28-2.26 0-.73-1.18-1.63-3.28-2.26-.25.76-.55 1.51-.89 2.26Zm-10.16 0c-.34-.75-.64-1.5-.89-2.26-2.1.63-3.28 1.53-3.28 2.26 0 .73 1.18 1.63 3.28 2.26.25-.76.55-1.51.89-2.26Zm9 2.26-.3.51c.31-.05.61-.1.88-.16-.07-.28-.18-.57-.29-.86l-.29.51Zm-2.89 4.04c1.59 1.5 2.97 2.08 3.59 1.7.64-.35.83-1.82.32-3.96-.77.16-1.58.28-2.4.36-.48.67-.99 1.31-1.51 1.9Zm-4.95-8.56.3-.51c-.31.05-.61.1-.88.16.07.28.18.57.29.86l.29-.51Zm2.89-4.04C17.38 8.2 16 7.62 15.37 8c-.63.35-.82 1.82-.31 3.96a23.018 23.018 0 0 1 2.4-.36c.48-.67.99-1.31 1.51-1.9Z"- fill="var(--mb-color-embedding-option-primary)"- />- </g>- </svg>- );-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/SdkJsIcon.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/SdkJsIcon.tsxdeleted file mode 100644index 3f491dbd651..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/SdkJsIcon.tsx+++ /dev/null@@ -1,35 +0,0 @@-import cx from "classnames";--import EmbeddingOptionS from "../EmbeddingOption.module.css";-import type { EmbeddingOptionIconProps } from "../types";--export const SdkJsIcon = ({ disabled }: EmbeddingOptionIconProps) => {- return (- <svg- width="40"- height="32"- fill="none"- viewBox="0 0 40 32"- xmlns="http://www.w3.org/2000/svg"- className={cx(EmbeddingOptionS.EmbeddingOptionIcon, {- [EmbeddingOptionS.Disabled]: disabled,- })}- data-testid="sdk-js-icon"- data-disabled={disabled}- >- <rect- x="1"- y="1"- width="38"- height="30"- rx="3"- stroke="var(--mb-color-embedding-option-secondary)"- strokeWidth="2"- />- <path- d="M11.9598 22.126C11.6238 22.138 11.3598 22.048 11.1678 21.856C10.9758 21.664 10.8798 21.418 10.8798 21.118C10.8798 20.89 10.9518 20.692 11.0958 20.524C11.2278 20.344 11.4258 20.248 11.6898 20.236L12.2298 20.2C12.7578 20.164 13.1538 20.002 13.4178 19.714C13.6938 19.414 13.8318 18.988 13.8318 18.436V10.336C13.8318 9.952 13.9278 9.664 14.1198 9.472C14.3238 9.268 14.6118 9.166 14.9838 9.166C15.3558 9.166 15.6378 9.268 15.8298 9.472C16.0338 9.664 16.1358 9.952 16.1358 10.336V18.418C16.1358 19.174 15.9978 19.816 15.7218 20.344C15.4578 20.872 15.0618 21.286 14.5338 21.586C14.0058 21.874 13.3518 22.042 12.5718 22.09L11.9598 22.126ZM23.2727 22.18C22.7447 22.18 22.2167 22.138 21.6887 22.054C21.1607 21.982 20.6627 21.868 20.1947 21.712C19.7267 21.544 19.3067 21.34 18.9347 21.1C18.7187 20.956 18.5687 20.782 18.4847 20.578C18.4007 20.374 18.3707 20.176 18.3947 19.984C18.4307 19.78 18.5087 19.606 18.6287 19.462C18.7607 19.306 18.9227 19.21 19.1147 19.174C19.3067 19.138 19.5167 19.192 19.7447 19.336C20.2727 19.648 20.8307 19.876 21.4187 20.02C22.0067 20.164 22.6247 20.236 23.2727 20.236C24.2207 20.236 24.9107 20.08 25.3427 19.768C25.7747 19.444 25.9907 19.03 25.9907 18.526C25.9907 18.106 25.8347 17.776 25.5227 17.536C25.2227 17.296 24.7007 17.098 23.9567 16.942L21.9767 16.528C20.8367 16.288 19.9847 15.886 19.4207 15.322C18.8687 14.746 18.5927 13.99 18.5927 13.054C18.5927 12.466 18.7127 11.932 18.9527 11.452C19.1927 10.972 19.5287 10.558 19.9607 10.21C20.4047 9.862 20.9267 9.598 21.5267 9.418C22.1387 9.226 22.8107 9.13 23.5427 9.13C24.2627 9.13 24.9467 9.22 25.5947 9.4C26.2427 9.58 26.8247 9.844 27.3407 10.192C27.5327 10.324 27.6587 10.486 27.7187 10.678C27.7907 10.87 27.8087 11.062 27.7727 11.254C27.7367 11.434 27.6527 11.59 27.5207 11.722C27.3887 11.854 27.2207 11.932 27.0167 11.956C26.8247 11.98 26.6027 11.92 26.3507 11.776C25.9067 11.524 25.4567 11.344 25.0007 11.236C24.5447 11.128 24.0527 11.074 23.5247 11.074C22.9727 11.074 22.4987 11.152 22.1027 11.308C21.7067 11.464 21.4007 11.686 21.1847 11.974C20.9807 12.25 20.8787 12.58 20.8787 12.964C20.8787 13.396 21.0227 13.744 21.3107 14.008C21.5987 14.26 22.0907 14.458 22.7867 14.602L24.7487 15.016C25.9367 15.268 26.8187 15.664 27.3947 16.204C27.9827 16.744 28.2767 17.464 28.2767 18.364C28.2767 18.94 28.1567 19.462 27.9167 19.93C27.6887 20.398 27.3527 20.8 26.9087 21.136C26.4767 21.472 25.9547 21.73 25.3427 21.91C24.7307 22.09 24.0407 22.18 23.2727 22.18Z"- fill="var(--mb-color-embedding-option-primary)"- />- </svg>- );-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/index.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/index.tsdeleted file mode 100644index 0278fc7b802..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./EmbeddingSdkOptionCard";diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/common.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/common.unit.spec.tsxdeleted file mode 100644index 8db21d23334..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/common.unit.spec.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { screen } from "__support__/ui";--import { type SetupOpts, setup as baseSetup } from "./setup";--const setup = (opts: Omit<SetupOpts, "hasEnterprisePlugins"> = {}) =>- baseSetup({- ...opts,- hasEnterprisePlugins: false,- });--describe("EmbeddingSdkOptionCard (OSS)", () => {- it("should display the correct title and badges", async () => {- await setup();-- expect(screen.getByText("Modular embedding")).toBeInTheDocument();- expect(screen.queryByText("Beta")).not.toBeInTheDocument();- });-- it("should show 'Try it out' button", async () => {- await setup();-- expect(screen.getByText("Try it out")).toBeInTheDocument();- });-- it.each([- {- description:- "should disable both icons when both embedding types are disabled",- isEmbeddingSdkEnabled: false,- isEmbeddingSimpleEnabled: false,- },- {- description: "should enable the react sdk embedding icon when enabled",- isEmbeddingSdkEnabled: true,- isEmbeddingSimpleEnabled: false,- },- {- description: "should enable the simple embedding icon when enabled",- isEmbeddingSdkEnabled: false,- isEmbeddingSimpleEnabled: true,- },- {- description:- "should enable both icons when both embedding types are enabled",- isEmbeddingSdkEnabled: true,- isEmbeddingSimpleEnabled: true,- },- ])(- "$description",- async ({ isEmbeddingSdkEnabled, isEmbeddingSimpleEnabled }) => {- await setup({- isEmbeddingSdkEnabled,- isEmbeddingSimpleEnabled,- });-- expect(screen.getByTestId("sdk-icon")).toHaveAttribute(- "data-disabled",- String(!isEmbeddingSdkEnabled),- );-- expect(screen.getByTestId("sdk-js-icon")).toHaveAttribute(- "data-disabled",- String(!isEmbeddingSimpleEnabled),- );- },- );-});diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/premium.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/premium.unit.spec.tsxdeleted file mode 100644index 4119051c9c2..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/premium.unit.spec.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { screen } from "__support__/ui";--import { type SetupOpts, setup as baseSetup } from "./setup";--const setup = (opts: Omit<SetupOpts, "hasEnterprisePlugins"> = {}) =>- baseSetup({- ...opts,- hasEnterprisePlugins: true,- tokenFeatures: { embedding: true },- });--describe("EnterpriseSdkOptionCard (EE with token)", () => {- it("should show 'Configure' button", async () => {- await setup();-- expect(screen.getByText("Configure")).toBeInTheDocument();- });-});diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/setup.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/setup.tsxdeleted file mode 100644index 11bb44ad32e..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/EmbeddingSdkOptionCard/tests/setup.tsx+++ /dev/null@@ -1,79 +0,0 @@-import { setupEnterprisePlugins } from "__support__/enterprise";-import {- setupPropertiesEndpoints,- setupSettingsEndpoints,- setupUpdateSettingEndpoint,- setupUpdateSettingsEndpoint,-} from "__support__/server-mocks";-import { mockSettings } from "__support__/settings";-import { renderWithProviders } from "__support__/ui";-import type { Settings, TokenFeatures } from "metabase-types/api";-import {- createMockSettingDefinition,- createMockSettings,- createMockTokenFeatures,-} from "metabase-types/api/mocks";-import {- createMockAdminState,- createMockState,-} from "metabase-types/store/mocks";--import { EmbeddingSdkOptionCard } from "../EmbeddingSdkOptionCard";--export interface SetupOpts {- showSdkEmbedTerms?: Settings["show-sdk-embed-terms"];- isEmbeddingSdkEnabled?: Settings["enable-embedding-sdk"];- isEmbeddingSimpleEnabled?: Settings["enable-embedding-simple"];- hasEnterprisePlugins?: boolean;- tokenFeatures?: Partial<TokenFeatures>;-}--export async function setup({- showSdkEmbedTerms = true,- isEmbeddingSdkEnabled = false,- isEmbeddingSimpleEnabled = false,- hasEnterprisePlugins = false,- tokenFeatures = {},-}: SetupOpts = {}) {- const settingValues = createMockSettings({- "show-sdk-embed-terms": showSdkEmbedTerms,- "enable-embedding-sdk": isEmbeddingSdkEnabled,- "enable-embedding-simple": isEmbeddingSimpleEnabled,- "token-features": createMockTokenFeatures(tokenFeatures),- });-- const settingDefinitions = [- createMockSettingDefinition({- key: "show-sdk-embed-terms",- value: showSdkEmbedTerms,- }),- createMockSettingDefinition({- key: "enable-embedding-sdk",- value: isEmbeddingSdkEnabled,- }),- createMockSettingDefinition({- key: "enable-embedding-simple",- value: isEmbeddingSimpleEnabled,- }),- ];-- const state = createMockState({- settings: mockSettings(settingValues),- admin: createMockAdminState({- settings: {- settings: settingDefinitions,- },- }),- });-- if (hasEnterprisePlugins) {- setupEnterprisePlugins();- }-- setupSettingsEndpoints(settingDefinitions);- setupPropertiesEndpoints(settingValues);- setupUpdateSettingEndpoint();- setupUpdateSettingsEndpoint();-- renderWithProviders(<EmbeddingSdkOptionCard />, { storeInitialState: state });-}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/InteractiveEmbeddingIcon.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/InteractiveEmbeddingIcon.tsxdeleted file mode 100644index 1ee8bde38d8..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/InteractiveEmbeddingIcon.tsx+++ /dev/null@@ -1,43 +0,0 @@-import cx from "classnames";--import EmbeddingOptionS from "../EmbeddingOption.module.css";-import type { EmbeddingOptionIconProps } from "../types";--export const InteractiveEmbeddingIcon = ({- disabled,-}: EmbeddingOptionIconProps) => {- return (- <svg- width="40"- height="32"- fill="none"- xmlns="http://www.w3.org/2000/svg"- className={cx(EmbeddingOptionS.EmbeddingOptionIcon, {- [EmbeddingOptionS.Disabled]: disabled,- })}- >- <g clipPath="url(#clip0_1030_4461)">- <rect- x="1.25"- y="1.25"- width="37.5"- height="29.5"- rx="2.75"- stroke="var(--mb-color-embedding-option-secondary)"- strokeWidth="2.5"- />- <path- fillRule="evenodd"- clipRule="evenodd"- d="M18.527 17.473 13 16l5.527-1.473L20 9l1.473 5.527L27 16l-5.527 1.473L20 23l-1.473-5.527ZM29.369 8.631 27 8l2.369-.631L30 5l.631 2.369L33 8l-2.369.631L30 11l-.631-2.369ZM29.974 24.026 28 23.5l1.974-.526L30.5 21l.526 1.974L33 23.5l-1.974.526L30.5 26l-.526-1.974ZM8.974 11.026 7 10.5l1.974-.526L9.5 8l.526 1.974L12 10.5l-1.974.526L9.5 13l-.526-1.974Z"- fill="var(--mb-color-embedding-option-primary)"- />- </g>- <defs>- <clipPath id="clip0_1030_4461">- <path fill="#fff" d="M0 0h40v32H0z" />- </clipPath>- </defs>- </svg>- );-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/InteractiveEmbeddingOptionCard.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/InteractiveEmbeddingOptionCard.tsxdeleted file mode 100644index 08edec9d3f9..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/InteractiveEmbeddingOptionCard.tsx+++ /dev/null@@ -1,98 +0,0 @@-import { jt, t } from "ttag";--import { UpsellEmbeddingButton } from "metabase/admin/upsells/UpsellEmbeddingButton";-import { UpsellGem } from "metabase/admin/upsells/components/UpsellGem";-import ExternalLink from "metabase/common/components/ExternalLink";-import { useSetting } from "metabase/common/hooks";-import { getPlan } from "metabase/common/utils/plan";-import { useSelector } from "metabase/lib/redux";-import { PLUGIN_EMBEDDING } from "metabase/plugins";-import { getDocsUrl, getSetting } from "metabase/selectors/settings";-import { Box, Group, Icon, Text } from "metabase/ui";--import { EmbeddingToggle } from "../../EmbeddingToggle";-import { EmbeddingOption } from "../EmbeddingOption";-import { LinkButton } from "../LinkButton";--import { InteractiveEmbeddingIcon } from "./InteractiveEmbeddingIcon";--const interactiveEmbeddingUtmTags = {- utm_source: "product",- utm_medium: "docs",- utm_campaign: "embedding-interactive",- utm_content: "embedding-admin",-};--export const InteractiveEmbeddingOptionCard = () => {- const isEE = PLUGIN_EMBEDDING.isEnabled();- const plan = useSelector((state) =>- getPlan(getSetting(state, "token-features")),- );- const isInteractiveEmbeddingEnabled = useSetting(- "enable-embedding-interactive",- );- const quickStartUrl = useSelector((state) =>- getDocsUrl(state, {- page: "embedding/interactive-embedding-quick-start-guide",- utm: interactiveEmbeddingUtmTags,- }),- );-- return (- <EmbeddingOption- icon={- <InteractiveEmbeddingIcon- disabled={!isEE || !isInteractiveEmbeddingEnabled}- />- }- title={- <Group gap="sm">- {!isEE && <UpsellGem />}- {t`Interactive embedding`}- </Group>- }- description={jt`Use interactive embedding when you want to ${(- <ExternalLink- href={`https://www.metabase.com/blog/why-full-app-embedding?utm_source=${plan}&utm_media=embed-settings`}- key="why-full-app-embedding"- >- {t`offer multi-tenant, self-service analytics`}- </ExternalLink>- )} and people want to create their own questions, dashboards, models, and more, all in their own data sandbox.`}- >- <Text- fw="bold"- color="brand"- component="a"- pos="relative"- href={quickStartUrl}- target="_blank"- >- {t`Check out our Quickstart`}{" "}- <Box ml="sm" top="2.5px" pos="absolute" component="span">- <Icon name="share" aria-hidden />- </Box>- </Text>- <Group justify="space-between" align="center" w="100%">- {isEE ? (- <LinkButton- to={"/admin/settings/embedding-in-other-applications/full-app"}- >- {t`Configure`}- </LinkButton>- ) : (- <UpsellEmbeddingButton- url="https://www.metabase.com/product/embedded-analytics"- campaign="embedding-interactive"- location="embedding-page"- size="large"- />- )}- <EmbeddingToggle- settingKey="enable-embedding-interactive"- disabled={!isEE}- />- </Group>- </EmbeddingOption>- );-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/index.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/index.tsdeleted file mode 100644index 907cd926562..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/InteractiveEmbeddingOptionCard/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./InteractiveEmbeddingOptionCard";diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/StaticEmbeddingIcon.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/StaticEmbeddingIcon.tsxdeleted file mode 100644index 01fae49e9e1..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/StaticEmbeddingIcon.tsx+++ /dev/null@@ -1,35 +0,0 @@-import cx from "classnames";--import EmbeddingOptionS from "../EmbeddingOption.module.css";-import type { EmbeddingOptionIconProps } from "../types";-export const StaticEmbeddingIcon = ({ disabled }: EmbeddingOptionIconProps) => {- return (- <svg- width="42"- height="34"- fill="white"- xmlns="http://www.w3.org/2000/svg"- className={cx(EmbeddingOptionS.EmbeddingOptionIcon, {- [EmbeddingOptionS.Disabled]: disabled,- })}- >- <rect- x="1.25"- y="1.25"- width="37.5"- height="29.5"- rx="2.75"- stroke="var(--mb-color-embedding-option-secondary)"- strokeWidth="2.5"- />- <path- d="M14 12a2 2 0 0 1 2-2h17a2 2 0 0 1 2 2v5H14v-5ZM14 19h9v9h-7a2 2 0 0 1-2-2v-7ZM25 19h10v7a2 2 0 0 1-2 2h-8v-9Z"- fill="var(--mb-color-embedding-option-primary)"- />- <path- d="M5 10h6v18H7a2 2 0 0 1-2-2V10ZM5 6a2 2 0 0 1 2-2h26a2 2 0 0 1 2 2v2H5V6Z"- fill="var(--mb-color-embedding-option-secondary)"- />- </svg>- );-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/StaticEmbeddingOptionCard.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/StaticEmbeddingOptionCard.tsxdeleted file mode 100644index 83b3000214c..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/StaticEmbeddingOptionCard.tsx+++ /dev/null@@ -1,52 +0,0 @@-import { jt, t } from "ttag";--import ExternalLink from "metabase/common/components/ExternalLink";-import { useSetting } from "metabase/common/hooks";-import { useSelector } from "metabase/lib/redux";-import { PLUGIN_EMBEDDING } from "metabase/plugins";-import { getUpgradeUrl } from "metabase/selectors/settings";-import { Group, Text } from "metabase/ui";--import { EmbeddingToggle } from "../../EmbeddingToggle";-import { EmbeddingOption } from "../EmbeddingOption";-import { LinkButton } from "../LinkButton";--import { StaticEmbeddingIcon } from "./StaticEmbeddingIcon";--export const StaticEmbeddingOptionCard = () => {- const isStaticEmbeddingEnabled = useSetting("enable-embedding-static");- const upgradeUrl = useSelector((state) =>- getUpgradeUrl(state, { utm_content: "embed-settings" }),- );- const shouldPromptToUpgrade = !PLUGIN_EMBEDDING.isEnabled();-- const upgradeText = jt`A "powered by Metabase" banner appears on static embeds. You can ${(- <ExternalLink key="upgrade-link" href={upgradeUrl}>- {t`upgrade to a specific paid plan`}- </ExternalLink>- )} which removes it.`;-- return (- <EmbeddingOption- icon={<StaticEmbeddingIcon disabled={!isStaticEmbeddingEnabled} />}- title={t`Static embedding`}- description={jt`Use static embedding when you don’t want to give people ad hoc query access to their data for whatever reason, or you want to present data that applies to all of your tenants at once.${- shouldPromptToUpgrade && (- <Text size="sm" mt="xs" key="upgrade-text">- {upgradeText}- </Text>- )- }`}- >- <Group justify="space-between" align="center" w="100%">- <LinkButton- variant="default"- to={"/admin/settings/embedding-in-other-applications/standalone"}- >- {t`Manage`}- </LinkButton>- <EmbeddingToggle settingKey="enable-embedding-static" />- </Group>- </EmbeddingOption>- );-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/index.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/index.tsdeleted file mode 100644index 72e4b64b67b..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/StaticEmbeddingOptionCard/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./StaticEmbeddingOptionCard";diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/index.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/index.tsdeleted file mode 100644index 5d994ba01d6..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export { StaticEmbeddingOptionCard } from "./StaticEmbeddingOptionCard";-export { EmbeddingSdkOptionCard } from "./EmbeddingSdkOptionCard";-export { InteractiveEmbeddingOptionCard } from "./InteractiveEmbeddingOptionCard";diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/types.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/types.tsdeleted file mode 100644index 2e77fbf597b..00000000000--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/types.ts+++ /dev/null@@ -1,3 +0,0 @@-export type EmbeddingOptionIconProps = {- disabled?: boolean;-};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/EmbeddingSdkSettings.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/EmbeddingSdkSettings.tsxindex d51d5813b49..6ce6e8e0681 100644--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/EmbeddingSdkSettings.tsx+++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/EmbeddingSdkSettings.tsx@@ -2,6 +2,10 @@ import cx from "classnames";import { match } from "ts-pattern";import { c, jt, t } from "ttag";+import {+ RelatedSettingsSection,+ getModularEmbeddingRelatedSettingItems,+} from "metabase/admin/components/RelatedSettingsSection";import { SettingsPageWrapper } from "metabase/admin/components/SettingsSection";import { UpsellDevInstances } from "metabase/admin/upsells";import { UpsellEmbeddingButton } from "metabase/admin/upsells/UpsellEmbeddingButton";@@ -22,13 +26,14 @@ import {Group,HoverCard,Icon,+ Stack,Text,} from "metabase/ui";import { SettingHeader } from "../../SettingHeader";import { AdminSettingInput } from "../../widgets/AdminSettingInput";-import { LinkButton } from "../EmbeddingOption/LinkButton";import { EmbeddingToggle } from "../EmbeddingToggle";+import { LinkButton } from "../LinkButton";import S from "./EmbeddingSdkSettings.module.css";@@ -139,15 +144,18 @@ export function EmbeddingSdkSettings() {<UpsellDevInstances location="embedding-page" /><Flex direction="column" p="xl" className={S.SectionCard} gap="md">- <Group>+ <Stack gap="xs"><Text fz="h3" fw={600} c="text-dark">{t`SDK for React`}</Text>- </Group>++ <Text c="var(--mb-color-text-secondary)" lh="lg">+ {t`Embed the full power of Metabase into your application to build a custom analytics experience and programmatically manage dashboards and data.`}+ </Text>+ </Stack><Group gap="sm" align="center" justify="space-between" w="100%"><EmbeddingToggle- label={t`Enabled`}settingKey="enable-embedding-sdk"labelPosition="right"aria-label={t`SDK for React toggle`}@@ -181,15 +189,18 @@ export function EmbeddingSdkSettings() {<Box p="xl" className={S.SectionCard}><Flex direction="column" gap="md">- <Group gap="sm">+ <Stack gap="xs"><Text fz="h3" fw={600} c="text-dark">{t`Embedded Analytics JS`}</Text>- </Group>++ <Text c="var(--mb-color-text-secondary)" lh="lg">+ {t`An easy-to-use library that lets you embed Metabase entities like charts, dashboards, or even the query builder into your own application using customizable components.`}+ </Text>+ </Stack><Group gap="sm" align="center" justify="space-between" w="100%"><EmbeddingToggle- label={t`Enabled`}labelPosition="right"settingKey="enable-embedding-simple"disabled={!isSimpleEmbedFeatureEnabled}@@ -303,6 +314,10 @@ export function EmbeddingSdkSettings() {</Text></Flex></Alert>++ <RelatedSettingsSection+ items={getModularEmbeddingRelatedSettingItems()}+ /></SettingsPageWrapper>);}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/tests/common.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/tests/common.unit.spec.tsxindex d3bd00556ee..0ce22558983 100644--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/tests/common.unit.spec.tsx+++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingSdkSettings/tests/common.unit.spec.tsx@@ -118,6 +118,44 @@ describe("EmbeddingSdkSettings (OSS)", () => {screen.queryByRole("link", { name: "Request version pinning" }),).not.toBeInTheDocument();});++ it("should show cards with related settings", async () => {+ await setup({+ isEmbeddingSdkEnabled: true,+ showSdkEmbedTerms: false,+ });++ const relatedSettingCards = await screen.findAllByTestId(+ "related-setting-card",+ );+ expect(relatedSettingCards).toHaveLength(5);++ expect(await screen.findByText("Authentication")).toBeInTheDocument();+ expect(await screen.findByText("Databases")).toBeInTheDocument();+ expect(await screen.findByText("People")).toBeInTheDocument();+ expect(await screen.findByText("Permissions")).toBeInTheDocument();+ expect(await screen.findByText("Appearance")).toBeInTheDocument();+ });++ it("shows the Embedded Analytics JS toggle is Disabled when token features are missing (EMB-801)", () => {+ setup({ tokenFeatures: { embedding_simple: false } });++ const toggle = screen.getByRole("switch", {+ name: "Embedded Analytics JS toggle",+ });++ expect(toggle).toBeDisabled();++ const toggleContainer = screen+ .getAllByTestId("switch-with-env-var")+ .find((toggleElement) =>+ within(toggleElement).queryByRole("switch", {+ name: "Embedded Analytics JS toggle",+ }),+ );++ expect(within(toggleContainer!).getByText("Disabled")).toBeInTheDocument();+ });});function assertLegaleseModal() {diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage/InteractiveEmbeddingUpsellPage.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage/InteractiveEmbeddingUpsellPage.tsxnew file mode 100644index 00000000000..fc95274065a--- /dev/null+++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage/InteractiveEmbeddingUpsellPage.tsx@@ -0,0 +1,81 @@+import { jt, t } from "ttag";++import { SettingsSection } from "metabase/admin/components/SettingsSection";+import { UpsellEmbeddingButton } from "metabase/admin/upsells/UpsellEmbeddingButton";+import { UpsellGem } from "metabase/admin/upsells/components";+import ExternalLink from "metabase/common/components/ExternalLink";+import { getPlan } from "metabase/common/utils/plan";+import { useSelector } from "metabase/lib/redux";+import { getDocsUrl, getSetting } from "metabase/selectors/settings";+import { Box, Flex, Group, Icon, Text, Title } from "metabase/ui";++export const InteractiveEmbeddingUpsellPage = () => {+ const plan = useSelector((state) =>+ getPlan(getSetting(state, "token-features")),+ );++ const quickStartUrl = useSelector((state) =>+ getDocsUrl(state, {+ page: "embedding/interactive-embedding-quick-start-guide",+ utm: interactiveEmbeddingUtmTags,+ }),+ );++ return (+ <SettingsSection>+ <article>+ <Flex gap="md" mb="sm" direction="row" align="center">+ <Group gap="sm">+ <UpsellGem />++ <Title order={3}>{t`Interactive embedding`}</Title>+ </Group>+ </Flex>++ <Text lh="1.25rem" mb="lg">+ {jt`Use interactive embedding when you want to ${(+ <ExternalLink+ href={`https://www.metabase.com/blog/why-full-app-embedding?utm_source=${plan}&utm_media=embed-settings`}+ key="why-full-app-embedding"+ >+ {t`offer multi-tenant, self-service analytics`}+ </ExternalLink>+ )} and people want to create their own questions, dashboards, models, and more, all in their own data sandbox.`}+ </Text>++ <Flex gap="lg" direction="column" align="flex-start">+ <Text+ fw="bold"+ c="brand"+ component="a"+ pos="relative"+ href={quickStartUrl}+ target="_blank"+ rel="noreferrer"+ >+ {t`Check out our Quickstart`}{" "}+ <Box ml="sm" top="2.5px" pos="absolute" component="span">+ <Icon name="share" aria-hidden />+ </Box>+ </Text>++ <Group justify="space-between" align="center" w="100%">+ <UpsellEmbeddingButton+ url="https://www.metabase.com/product/embedded-analytics"+ campaign="embedding-interactive"+ location="embedding-page"+ size="large"+ />+ </Group>+ </Flex>+ </article>+ </SettingsSection>+ );+};++const interactiveEmbeddingUtmTags = {+ utm_source: "product",+ utm_medium: "docs",+ utm_campaign: "embedding-interactive",+ utm_content: "embedding-admin",+};diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage/index.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage/index.tsnew file mode 100644index 00000000000..4dcbce7d452--- /dev/null+++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/InteractiveEmbeddingUpsellPage/index.ts@@ -0,0 +1 @@+export { InteractiveEmbeddingUpsellPage } from "./InteractiveEmbeddingUpsellPage";diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/LinkButton/LinkButton.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/LinkButton/LinkButton.tsxsimilarity index 100%rename from frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/LinkButton/LinkButton.tsxrename to frontend/src/metabase/admin/settings/components/EmbeddingSettings/LinkButton/LinkButton.tsxdiff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/LinkButton/index.ts b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/LinkButton/index.tssimilarity index 100%rename from frontend/src/metabase/admin/settings/components/EmbeddingSettings/EmbeddingOption/LinkButton/index.tsrename to frontend/src/metabase/admin/settings/components/EmbeddingSettings/LinkButton/index.tsdiff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.tsxindex 5ab15f2d26a..fdade89637c 100644--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.tsx+++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.tsx@@ -1,5 +1,9 @@import { t } from "ttag";+import {+ RelatedSettingsSection,+ getStaticEmbeddingRelatedSettingItems,+} from "metabase/admin/components/RelatedSettingsSection";import {SettingsPageWrapper,SettingsSection,@@ -36,6 +40,8 @@ export function StaticEmbeddingSettings() {)}</SettingsSection><PLUGIN_CONTENT_TRANSLATION.ContentTranslationConfiguration />++ <RelatedSettingsSection items={getStaticEmbeddingRelatedSettingItems()} /></SettingsPageWrapper>);}diff --git a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.unit.spec.tsxindex 65ca9357278..62a9c371c92 100644--- a/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.unit.spec.tsx+++ b/frontend/src/metabase/admin/settings/components/EmbeddingSettings/StaticEmbeddingSettings.unit.spec.tsx@@ -98,4 +98,16 @@ describe("StaticEmbeddingSettings", () => {expect(url).toContain("/setting/embedding-secret-key");expect(body).toEqual({ value: "fake-token" }); // we got this from the mock api});++ it("should show cards with related settings", async () => {+ await setup({ enabled: true });++ const relatedSettingCards = await screen.findAllByTestId(+ "related-setting-card",+ );+ expect(relatedSettingCards).toHaveLength(2);++ expect(await screen.findByText("Databases")).toBeInTheDocument();+ expect(await screen.findByText("Appearance")).toBeInTheDocument();+ });});diff --git a/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNav.tsx b/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNav.tsxindex adf562d4892..e8f0ba2c059 100644--- a/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNav.tsx+++ b/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNav.tsx@@ -19,7 +19,6 @@ const NavDivider = () => <Divider my="sm" />;export function SettingsNav() {const hasHosting = useHasTokenFeature("hosting");- const hasEmbedding = useHasTokenFeature("embedding");const hasWhitelabel = useHasTokenFeature("whitelabel");const hasSaml = useHasTokenFeature("sso_saml");const hasJwt = useHasTokenFeature("sso_jwt");@@ -93,30 +92,6 @@ export function SettingsNav() {label={t`Public sharing`}icon="share"/>- <SettingsNavItem- label={t`Embedding`}- icon="embed"- folderPattern="embedding"- >- <SettingsNavItem- path="embedding-in-other-applications"- label={t`Overview`}- />- <SettingsNavItem- path="embedding-in-other-applications/standalone"- label={t`Static embedding`}- />- {hasEmbedding && (- <SettingsNavItem- path="embedding-in-other-applications/full-app"- label={t`Interactive embedding`}- />- )}- <SettingsNavItem- path="embedding-in-other-applications/sdk"- label={t`Modular embedding`}- />- </SettingsNavItem><NavDivider /><SettingsNavItem path="license" label={t`License`} icon="store" /><SettingsNavItemdiff --git a/frontend/src/metabase/admin/settings/components/SettingsPages/EmbeddingSettingsPage.tsx b/frontend/src/metabase/admin/settings/components/SettingsPages/EmbeddingSettingsPage.tsxdeleted file mode 100644index ff8640e3ca6..00000000000--- a/frontend/src/metabase/admin/settings/components/SettingsPages/EmbeddingSettingsPage.tsx+++ /dev/null@@ -1,24 +0,0 @@-import { t } from "ttag";--import { SettingsPageWrapper } from "metabase/admin/components/SettingsSection";-import { UpsellDevInstances } from "metabase/admin/upsells";--import {- EmbeddingSdkOptionCard,- InteractiveEmbeddingOptionCard,- StaticEmbeddingOptionCard,-} from "../EmbeddingSettings/EmbeddingOption";--export function EmbeddingSettingsPage() {- return (- <SettingsPageWrapper- title={t`Embedding`}- description={t`Embed dashboards, questions, or the entire Metabase app into your application. Integrate with your server code to create a secure environment, limited to specific users or organizations.`}- >- <UpsellDevInstances location="embedding-page" />- <StaticEmbeddingOptionCard />- <InteractiveEmbeddingOptionCard />- <EmbeddingSdkOptionCard />- </SettingsPageWrapper>- );-}diff --git a/frontend/src/metabase/admin/settings/components/SettingsPages/EmbeddingSettingsPage.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/SettingsPages/EmbeddingSettingsPage.unit.spec.tsxdeleted file mode 100644index c11a5aa6276..00000000000--- a/frontend/src/metabase/admin/settings/components/SettingsPages/EmbeddingSettingsPage.unit.spec.tsx+++ /dev/null@@ -1,57 +0,0 @@-import userEvent from "@testing-library/user-event";--import {- findRequests,- setupPropertiesEndpoints,- setupSettingsEndpoints,- setupUpdateSettingEndpoint,- setupUserKeyValueEndpoints,-} from "__support__/server-mocks";-import { renderWithProviders, screen } from "__support__/ui";-import { createMockSettings } from "metabase-types/api/mocks";--import { EmbeddingSettingsPage } from "./EmbeddingSettingsPage";--const setup = async () => {- const settings = createMockSettings();-- setupPropertiesEndpoints(settings);- setupSettingsEndpoints([]);- setupUpdateSettingEndpoint();- setupUserKeyValueEndpoints({- namespace: "user_acknowledgement",- key: "upsell-dev_instances",- value: true,- });-- renderWithProviders(<EmbeddingSettingsPage />);- expect(await screen.findByText("Embedding")).toBeInTheDocument(); // title-};--describe("EmbeddingSettingsPage", () => {- it("shows an index of embedding settings sections", async () => {- await setup();-- expect(await screen.findByText("Static embedding")).toBeInTheDocument();- expect(- await screen.findByText("Interactive embedding"),- ).toBeInTheDocument();- expect(await screen.findByText("Modular embedding")).toBeInTheDocument();- });-- it("can toggle static embedding on", async () => {- await setup();-- const toggles = await screen.findAllByText("Disabled");-- await userEvent.click(toggles[0]);-- const puts = await findRequests("PUT");- expect(puts).toHaveLength(1);- const [{ url, body }] = puts;- expect(url).toContain("/setting/enable-embedding-static");- expect(body).toEqual({ value: true });- });-- // note: the various states of the embedding cards are extensively tested elsewhere-});diff --git a/frontend/src/metabase/admin/settings/tests/setup.tsx b/frontend/src/metabase/admin/settings/tests/setup.tsxindex e7d038bec05..fc6093bafc7 100644--- a/frontend/src/metabase/admin/settings/tests/setup.tsx+++ b/frontend/src/metabase/admin/settings/tests/setup.tsx@@ -60,18 +60,6 @@ export const ossRoutes: RouteMap = {path: "/public-sharing",testPattern: /Enable Public Sharing/i,},- embedding: {- path: "/embedding-in-other-applications",- testPattern: /Embed dashboards, questions, or the entire Metabase app/i,- },- staticEmbedding: {- path: "/embedding-in-other-applications/standalone",- testPattern: /Embedding secret key/i,- },- embeddingSdk: {- path: "/embedding-in-other-applications/sdk",- testPattern: /SDK for React/i,- },license: { path: "/license", testPattern: /Looking for more/i },appearance: {path: "/appearance",@@ -87,10 +75,6 @@ export const enterpriseRoutes: RouteMap = {export const premiumRoutes: RouteMap = {saml: { path: "/authentication/saml", testPattern: /Set up SAML-based SSO/i },jwt: { path: "/authentication/jwt", testPattern: /Server Settings/i },- interactiveEmbedding: {- path: "/embedding-in-other-applications/full-app",- testPattern: /Enable Interactive embedding/i,- },};export const upsellRoutes: RouteMap = {diff --git a/frontend/src/metabase/admin/settingsRoutes.tsx b/frontend/src/metabase/admin/settingsRoutes.tsxindex a637a93c1f4..e49f855c47d 100644--- a/frontend/src/metabase/admin/settingsRoutes.tsx+++ b/frontend/src/metabase/admin/settingsRoutes.tsx@@ -2,20 +2,15 @@ import { IndexRedirect, Route } from "react-router";import { AdminSettingsLayout } from "metabase/common/components/AdminLayout/AdminSettingsLayout";import { NotFound } from "metabase/common/components/ErrorPages";-import { PLUGIN_ADMIN_SETTINGS, PLUGIN_AUTH_PROVIDERS } from "metabase/plugins";+import { PLUGIN_AUTH_PROVIDERS } from "metabase/plugins";import { GoogleAuthForm } from "./settings/auth/components/GoogleAuthForm";-import {- EmbeddingSdkSettings,- StaticEmbeddingSettings,-} from "./settings/components/EmbeddingSettings";import { SettingsLdapForm } from "./settings/components/SettingsLdapForm";import { SettingsNav } from "./settings/components/SettingsNav";import { AppearanceSettingsPage } from "./settings/components/SettingsPages/AppearanceSettingsPage";import { AuthenticationSettingsPage } from "./settings/components/SettingsPages/AuthenticationSettingsPage";import { CloudSettingsPage } from "./settings/components/SettingsPages/CloudSettingsPage";import { EmailSettingsPage } from "./settings/components/SettingsPages/EmailSettingsPage";-import { EmbeddingSettingsPage } from "./settings/components/SettingsPages/EmbeddingSettingsPage";import { GeneralSettingsPage } from "./settings/components/SettingsPages/GeneralSettingsPage";import { LicenseSettingsPage } from "./settings/components/SettingsPages/LicenseSettingsPage";import { LocalizationSettingsPage } from "./settings/components/SettingsPages/LocalizationSettingsPage";@@ -64,22 +59,6 @@ export const getSettingsRoutes = () => (<Route path="localization" component={LocalizationSettingsPage} /><Route path="uploads" component={UploadSettingsPage} /><Route path="public-sharing" component={PublicSharingSettingsPage} />- <Route- path="embedding-in-other-applications"- component={EmbeddingSettingsPage}- />- <Route- path="embedding-in-other-applications/standalone"- component={StaticEmbeddingSettings}- />- <Route- path="embedding-in-other-applications/sdk"- component={EmbeddingSdkSettings}- />- <Route- path="embedding-in-other-applications/full-app"- component={() => <PLUGIN_ADMIN_SETTINGS.InteractiveEmbeddingSettings />}- /><Route path="license" component={LicenseSettingsPage} /><Route path="appearance" component={() => <AppearanceSettingsPage />} /><Routediff --git a/frontend/src/metabase/admin/upsells/UpsellSdkCta.tsx b/frontend/src/metabase/admin/upsells/UpsellSdkCta.tsxindex e7c0e578a99..850a4ac5e49 100644--- a/frontend/src/metabase/admin/upsells/UpsellSdkCta.tsx+++ b/frontend/src/metabase/admin/upsells/UpsellSdkCta.tsx@@ -32,7 +32,7 @@ export function useUpsellSdkCta() {if (isInteractiveEmbeddingEnabled) {return {- internalLink: "/admin/settings/embedding-in-other-applications/full-app",+ internalLink: "/admin/embedding/interactive",};}diff --git a/frontend/src/metabase/api/card.ts b/frontend/src/metabase/api/card.tsindex 9acd6f2c159..b0fcbce5a03 100644--- a/frontend/src/metabase/api/card.ts+++ b/frontend/src/metabase/api/card.ts@@ -144,6 +144,7 @@ export const cardApi = Api.injectEndpoints({listTag("card"),listTag("schema"),listTag("table"),+ listTag("embedding-hub-checklist"),]),}),updateCard: builder.mutation<Card, UpdateCardRequest>({diff --git a/frontend/src/metabase/api/embedding-hub.ts b/frontend/src/metabase/api/embedding-hub.tsnew file mode 100644index 00000000000..8a3247276eb--- /dev/null+++ b/frontend/src/metabase/api/embedding-hub.ts@@ -0,0 +1,26 @@+import { Api } from "metabase/api";++import { listTag } from "./tags";++type CheckListApiStep =+ | "create-dashboard"+ | "add-data"+ | "configure-row-column-security"+ | "create-test-embed"+ | "embed-production"+ | "secure-embeds";+export type EmbeddingHubChecklist = Record<CheckListApiStep, boolean>;++export const embeddingHubApi = Api.injectEndpoints({+ endpoints: (builder) => ({+ getEmbeddingHubChecklist: builder.query<EmbeddingHubChecklist, void>({+ query: () => ({+ method: "GET",+ url: "/api/ee/embedding-hub/checklist",+ }),+ providesTags: [listTag("embedding-hub-checklist")],+ }),+ }),+});++export const { useGetEmbeddingHubChecklistQuery } = embeddingHubApi;diff --git a/frontend/src/metabase/api/tags/constants.ts b/frontend/src/metabase/api/tags/constants.tsindex 10c19d2a0c6..c06daefa989 100644--- a/frontend/src/metabase/api/tags/constants.ts+++ b/frontend/src/metabase/api/tags/constants.ts@@ -14,6 +14,7 @@ export const TAG_TYPES = ["dashboard-question-candidates","database","document",+ "embedding-hub-checklist","field","field-values","indexed-entity",diff --git a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.enterprise.unit.spec.tsx b/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.enterprise.unit.spec.tsxdeleted file mode 100644index e0a1a8e9540..00000000000--- a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.enterprise.unit.spec.tsx+++ /dev/null@@ -1,41 +0,0 @@-import userEvent from "@testing-library/user-event";--import { setupEnterprisePlugins } from "__support__/enterprise";-import { setupDatabasesEndpoints } from "__support__/server-mocks";-import { renderWithProviders, screen } from "__support__/ui";-import type { Database } from "metabase-types/api";-import { createSampleDatabase } from "metabase-types/api/mocks/presets";--import NewItemMenu from "./NewItemMenu";--type SetupOpts = {- databases?: Database[];- hasModels?: boolean;-};--const SAMPLE_DATABASE = createSampleDatabase();--async function setup({ databases = [SAMPLE_DATABASE] }: SetupOpts = {}) {- setupDatabasesEndpoints(databases);- setupEnterprisePlugins();-- renderWithProviders(<NewItemMenu trigger={<button>New</button>} />);-- await userEvent.click(screen.getByText("New"));-}--describe("NewItemMenu (EE without token)", () => {- beforeEach(() => {- console.warn = jest.fn();- console.error = jest.fn();- });-- afterEach(() => {- jest.restoreAllMocks();- });-- it("does not show the Embed item when the feature token is missing", async () => {- setup();- await expect(screen.queryByText("Embed")).not.toBeInTheDocument();- });-});diff --git a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.premium.unit.spec.tsx b/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.premium.unit.spec.tsxdeleted file mode 100644index ca30f05fd6e..00000000000--- a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.premium.unit.spec.tsx+++ /dev/null@@ -1,80 +0,0 @@-import userEvent from "@testing-library/user-event";--import { setupEnterprisePlugins } from "__support__/enterprise";-import {- setupDatabasesEndpoints,- setupPropertiesEndpoints,-} from "__support__/server-mocks";-import { mockSettings } from "__support__/settings";-import { renderWithProviders, screen } from "__support__/ui";-import type { Database, TokenFeatures } from "metabase-types/api";-import {- createMockSettings,- createMockTokenFeatures,- createMockUser,-} from "metabase-types/api/mocks";-import { createSampleDatabase } from "metabase-types/api/mocks/presets";-import { createMockState } from "metabase-types/store/mocks";--import NewItemMenu from "./NewItemMenu";--type SetupOpts = {- databases?: Database[];- hasModels?: boolean;- tokenFeatures?: Partial<TokenFeatures>;- isAdmin?: boolean;-};--const SAMPLE_DATABASE = createSampleDatabase();--async function setup({- databases = [SAMPLE_DATABASE],- tokenFeatures,- isAdmin = true,-}: SetupOpts = {}) {- const settings = mockSettings({- "token-features": createMockTokenFeatures(tokenFeatures),- });-- setupDatabasesEndpoints(databases);- setupEnterprisePlugins();- setupPropertiesEndpoints(createMockSettings());-- renderWithProviders(<NewItemMenu trigger={<button>New</button>} />, {- storeInitialState: createMockState({- settings,- currentUser: createMockUser({ is_superuser: isAdmin }),- }),- });-- await userEvent.click(screen.getByText("New"));-}--describe("NewItemMenu (EE with token)", () => {- beforeEach(() => {- console.warn = jest.fn();- console.error = jest.fn();- });-- afterEach(() => {- jest.restoreAllMocks();- });-- it("shows the Embed item when user is an admin", async () => {- await setup({- tokenFeatures: { embedding_simple: true },- isAdmin: true,- });-- expect(await screen.findByText("Embed")).toBeInTheDocument();- });-- it("hides the Embed item when user is non-admin", async () => {- await setup({- tokenFeatures: { embedding_simple: true },- isAdmin: false,- });-- expect(screen.queryByText("Embed")).not.toBeInTheDocument();- });-});diff --git a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.tsx b/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.tsxindex 92ff43b9652..9aab3ad69bd 100644--- a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.tsx+++ b/frontend/src/metabase/common/components/NewItemMenu/NewItemMenu.tsx@@ -9,7 +9,6 @@ import {getHasDatabaseWithJsonEngine,getHasNativeWrite,} from "metabase/selectors/data";-import { getUserIsAdmin } from "metabase/selectors/user";import type Database from "metabase-lib/v1/metadata/Database";import type { State } from "metabase-types/store";@@ -26,7 +25,6 @@ const mapStateToProps = (hasDataAccess: getHasDataAccess(databases),hasNativeWrite: getHasNativeWrite(databases),hasDatabaseWithJsonEngine: getHasDatabaseWithJsonEngine(databases),- isAdmin: getUserIsAdmin(state),});const mapDispatchToProps = {diff --git a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenuView.tsx b/frontend/src/metabase/common/components/NewItemMenu/NewItemMenuView.tsxindex b978f9ab084..6a38e2cabeb 100644--- a/frontend/src/metabase/common/components/NewItemMenu/NewItemMenuView.tsx+++ b/frontend/src/metabase/common/components/NewItemMenu/NewItemMenuView.tsx@@ -5,10 +5,7 @@ import { t } from "ttag";import { ForwardRefLink } from "metabase/common/components/Link";import { useDispatch, useSelector } from "metabase/lib/redux";import * as Urls from "metabase/lib/urls";-import {- PLUGIN_DOCUMENTS,- PLUGIN_EMBEDDING_IFRAME_SDK_SETUP,-} from "metabase/plugins";+import { PLUGIN_DOCUMENTS } from "metabase/plugins";import { setOpenModal } from "metabase/redux/ui";import { getSetting } from "metabase/selectors/settings";import { Box, Icon, Menu } from "metabase/ui";@@ -26,7 +23,6 @@ export interface NewItemMenuProps {hasNativeWrite: boolean;hasDatabaseWithJsonEngine: boolean;onCloseNavbar: () => void;- isAdmin: boolean;}const NewItemMenuView = ({@@ -35,7 +31,6 @@ const NewItemMenuView = ({hasDataAccess,hasNativeWrite,hasDatabaseWithJsonEngine,- isAdmin,}: NewItemMenuProps) => {const dispatch = useDispatch();@@ -108,29 +103,10 @@ const NewItemMenuView = ({);}- // This is a non-standard way of feature gating, akin to using hasPremiumFeature. Do not do this for more complex setups.- // We hide the "Embed" menu item if the user is not an admin- if (- PLUGIN_EMBEDDING_IFRAME_SDK_SETUP.shouldShowEmbedInNewItemMenu() &&- isAdmin- ) {- items.push(- <Menu.Item- key="embed"- component={ForwardRefLink}- to="/embed-js"- leftSection={<Icon name="embed" />}- >- {t`Embed`}- </Menu.Item>,- );- }-return items;}, [hasDataAccess,hasNativeWrite,- isAdmin,collectionId,lastUsedDatabaseId,hasDatabaseWithJsonEngine,diff --git a/frontend/src/metabase/css/core/colors.module.css b/frontend/src/metabase/css/core/colors.module.cssindex 55872d7349b..65b8e57d765 100644--- a/frontend/src/metabase/css/core/colors.module.css+++ b/frontend/src/metabase/css/core/colors.module.css@@ -62,6 +62,7 @@transparent);--mb-color-success: #84bb4c;+ --mb-color-success-darker: var(--mb-base-color-palm-50);--mb-color-summarize: #88bf4d;--mb-color-error: var(--mb-base-color-lobster-50);--mb-color-danger: var(--mb-base-color-lobster-50);@@ -116,6 +117,7 @@--mb-color-syntax-parameters: var(--mb-base-color-mango-40);--mb-color-syntax-parameters-active: var(--mb-base-color-mango-10);--mb-color-switch-off: var(--mb-base-color-orion-10);+ --mb-color-shadow-embedding-hub-card: rgba(162, 197, 228, 0.7);/*** Base colorsdiff --git a/frontend/src/metabase/embedding/embedding-hub/components/DocsLink.tsx b/frontend/src/metabase/embedding/embedding-hub/components/DocsLink.tsxnew file mode 100644index 00000000000..08f099acef8--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/DocsLink.tsx@@ -0,0 +1,30 @@+import type { ReactNode } from "react";++import ExternalLink from "metabase/common/components/ExternalLink";+import { useDocsUrl } from "metabase/common/hooks/use-docs-url";+import CS from "metabase/css/core/index.css";+import type { UtmProps } from "metabase/selectors/settings";++interface DocsLinkProps {+ docsPath: string;+ utm: Required<Pick<UtmProps, "utm_campaign" | "utm_content">>;+ children: ReactNode;+}++export const DocsLink = ({ docsPath, utm, children }: DocsLinkProps) => {+ // eslint-disable-next-line no-unconditional-metabase-links-render -- we are in admin so we must always show the link.+ const { url } = useDocsUrl(docsPath, {+ utm: {+ utm_source: "product",+ utm_campaign: utm.utm_campaign,+ utm_medium: "docs",+ utm_content: utm.utm_content,+ },+ });++ return (+ <ExternalLink href={url} className={CS.noDecoration}>+ {children}+ </ExternalLink>+ );+};diff --git a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.tsx b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.tsxnew file mode 100644index 00000000000..dccb7ec8615--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.tsx@@ -0,0 +1,110 @@+import { useMemo, useState } from "react";+import { P, match } from "ts-pattern";+import { t } from "ttag";++import {+ RelatedSettingsSection,+ getModularEmbeddingRelatedSettingItems,+} from "metabase/admin/components/RelatedSettingsSection";+import { CreateDashboardModal } from "metabase/dashboard/containers/CreateDashboardModal";+import { AddDataModal } from "metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal";+import { Stack, Text, Title } from "metabase/ui";++import { useCompletedEmbeddingHubSteps } from "../hooks";+import type {+ EmbeddingHubModalToTrigger,+ EmbeddingHubStepId,+} from "../types/embedding-checklist";+import { getEmbeddingHubSteps } from "../utils";++import { EmbeddingHubXrayPickerModal } from "./EmbeddingHubXrayPickerModal";+import {+ type StepperCardClickAction,+ type StepperStep,+ StepperWithCards,+} from "./StepperWithCards/StepperWithCards";++export const EmbeddingHub = () => {+ const embeddingSteps = useMemo(() => getEmbeddingHubSteps(), []);+ const { data: completedSteps } = useCompletedEmbeddingHubSteps();++ const [openedModal, setOpenedModal] =+ useState<EmbeddingHubModalToTrigger | null>(null);++ const closeModal = () => setOpenedModal(null);++ const lockedSteps: Partial<Record<EmbeddingHubStepId, boolean>> = useMemo(+ () => ({+ "embed-production": !completedSteps?.["secure-embeds"],+ }),+ [completedSteps],+ );++ const stepperSteps: StepperStep[] = useMemo(() => {+ return embeddingSteps.map((step) => ({+ id: step.id,+ title: step.title,+ cards: step.actions.map((action) => {+ const stepId = action.stepId ?? step.id;++ const clickAction: StepperCardClickAction | undefined = match(action)+ .with({ to: P.string }, ({ to }) => ({ type: "link" as const, to }))+ .with({ docsPath: P.string }, ({ docsPath }) => ({+ type: "docs" as const,+ docsPath,+ utm: { utm_campaign: "embedding_hub", utm_content: stepId },+ }))+ .with({ modal: P.nonNullable }, ({ modal }) => ({+ type: "click" as const,+ onClick: () => setOpenedModal(modal),+ }))+ .otherwise(() => undefined);++ return {+ id: `${stepId}-${action.title}`,+ title: action.title,+ description: action.description,+ optional: action.optional,++ // TODO: add completion checks for the 'create models' step+ done: completedSteps?.[stepId] ?? false,+ locked: lockedSteps?.[stepId] ?? false,++ clickAction,+ };+ }),+ }));+ }, [embeddingSteps, completedSteps, lockedSteps]);++ return (+ <Stack mx="auto" py="xl" gap="xl" maw={800}>+ <Stack gap="xs" ml="3rem">+ <Title+ order={1}+ c="var(--mb-color-text-primary)"+ >{t`Embedding setup guide`}</Title>++ <Text c="var(--mb-color-text-secondary)">{t`Follow the guide to get started with Embedded Analytics JS`}</Text>+ </Stack>+ <StepperWithCards steps={stepperSteps} />+ <RelatedSettingsSection+ items={getModularEmbeddingRelatedSettingItems()}+ />+ <AddDataModal+ opened={openedModal?.type === "add-data"}+ onClose={closeModal}+ initialTab={+ openedModal?.type === "add-data" ? openedModal?.initialTab : undefined+ }+ />+ <CreateDashboardModal+ opened={openedModal?.type === "new-dashboard"}+ onClose={closeModal}+ />+ <EmbeddingHubXrayPickerModal+ opened={openedModal?.type === "xray-dashboard"}+ onClose={closeModal}+ />+ </Stack>+ );+};diff --git a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsx b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsxnew file mode 100644index 00000000000..ab922e75cf7--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHub.unit.spec.tsx@@ -0,0 +1,93 @@+import userEvent from "@testing-library/user-event";+import { push } from "react-router-redux";++import {+ setupRecentViewsAndSelectionsEndpoints,+ setupSearchEndpoints,+} from "__support__/server-mocks";+import { mockSettings } from "__support__/settings";+import { renderWithProviders, screen, waitFor, within } from "__support__/ui";+import {+ createMockRecentTableDatabaseInfo,+ createMockRecentTableItem,+ createMockUser,+} from "metabase-types/api/mocks";+import { createMockState } from "metabase-types/store/mocks";++jest.mock("react-router-redux", () => ({+ push: jest.fn(() => ({+ type: "@@router/CALL_HISTORY_METHOD",+ payload: { method: "push" },+ })),+}));++import { EmbeddingHub } from "./EmbeddingHub";++const mockPush = push as jest.MockedFunction<typeof push>;++const setup = ({ isAdmin = true } = {}) => {+ const state = createMockState({+ currentUser: createMockUser({ is_superuser: isAdmin }),+ settings: mockSettings({+ "show-metabase-links": true,+ }),+ });++ setupRecentViewsAndSelectionsEndpoints(+ [+ createMockRecentTableItem({+ id: 10,+ name: "foobar",+ display_name: "Foo Bar Table",+ database: createMockRecentTableDatabaseInfo({+ id: 1,+ }),+ }),+ ],+ ["selections"],+ );++ setupSearchEndpoints([]);++ return renderWithProviders(<EmbeddingHub />, { storeInitialState: state });+};++describe("EmbeddingHub", () => {+ beforeEach(() => {+ mockPush.mockClear();+ });++ it("opens AddDataModal when 'Add data' is clicked", async () => {+ setup();++ await userEvent.click(screen.getByText("Add data"));++ await waitFor(() => {+ const dialog = within(screen.getByRole("dialog"));+ expect(+ dialog.getByRole("heading", { name: "Add data" }),+ ).toBeInTheDocument();+ });+ });++ it("opens DataPickerModal when 'Generate a dashboard' is clicked", async () => {+ setup();++ await userEvent.click(screen.getByText("Generate a dashboard"));++ const dialog = await screen.findByTestId("entity-picker-modal");+ expect(dialog).toBeInTheDocument();++ expect(+ await within(dialog).findByText("Choose a table to generate a dashboard"),+ ).toBeInTheDocument();++ expect(+ await within(dialog).findByText("Foo Bar Table"),+ ).toBeInTheDocument();++ await userEvent.click(within(dialog).getByText("Foo Bar Table"));++ expect(mockPush).toHaveBeenCalledWith("/auto/dashboard/table/10");+ });+});diff --git a/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubXrayPickerModal.tsx b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubXrayPickerModal.tsxnew file mode 100644index 00000000000..edd4ccf599c--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/EmbeddingHubXrayPickerModal.tsx@@ -0,0 +1,36 @@+import { push } from "react-router-redux";+import { t } from "ttag";++import { DataPickerModal } from "metabase/common/components/Pickers/DataPicker";+import { useDispatch } from "metabase/lib/redux";+import type { TableId } from "metabase-types/api";++interface EmbeddingHubXrayPickerModalProps {+ opened: boolean;+ onClose: () => void;+}++export const EmbeddingHubXrayPickerModal = ({+ opened,+ onClose,+}: EmbeddingHubXrayPickerModalProps) => {+ const dispatch = useDispatch();++ function handleTableSelect(tableId: TableId) {+ dispatch(push(`/auto/dashboard/table/${tableId}`));+ }++ if (!opened) {+ return null;+ }++ return (+ <DataPickerModal+ title={t`Choose a table to generate a dashboard`}+ value={undefined}+ models={["table"]}+ onChange={handleTableSelect}+ onClose={onClose}+ />+ );+};diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.cssnew file mode 100644index 00000000000..a2e5f5f6939--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.module.css@@ -0,0 +1,67 @@+.step {+ width: 100%;+}++.stepLabel {+ color: var(--mb-color-text-secondary);+ font-weight: bold;+ margin-top: 0.375rem;+}++.verticalSeparator {+ --stepper-outline-thickness: 0.0625rem;+ --stepper-outline-color: var(--mb-color-border);+}++.step:not(.stepDone) .stepIcon {+ color: var(--mb-color-text-dark);+ border-color: transparent;+ background: var(--mb-color-focus);+}++.step.stepDone .stepIcon {+ color: var(--mb-color-bg-white);+ background: var(--mb-color-success-darker);+}++.stepWrapper {+ margin-right: 0.625rem;+}++.stepBody {+ display: flex;+ width: 100%;+}++.stepDescription {+ padding: 0.625rem 0 1.25rem 0;+}++.stepCard {+ border: 1px solid var(--mb-color-border) !important;+ cursor: pointer;+ transition:+ box-shadow 250ms ease,+ border 250ms ease;+ padding: 0.94rem 1.25rem;+ height: 8.75rem;+ max-width: 23.75rem;+ text-align: left;+}++.stepCard:not(.optionalStepCard) {+ width: 100%;+}++.optionalStepCard {+ max-width: 15.625rem;+}++.lockedStepCard {+ cursor: not-allowed;+}++.stepCard:not(.lockedStepCard):hover {+ border: 1px solid var(--mb-color-focus) !important;+ box-shadow: 0 2px 24px 0 var(--mb-color-shadow-embedding-hub-card);+}diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsxnew file mode 100644index 00000000000..48b0cf27889--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx@@ -0,0 +1,173 @@+import cx from "classnames";+import type { ReactNode } from "react";+import { Link } from "react-router";+import { match } from "ts-pattern";+import { t } from "ttag";++import type { UtmProps } from "metabase/selectors/settings";+import { Card, Flex, Group, Icon, Stack, Stepper, Text } from "metabase/ui";++import { DocsLink } from "../DocsLink";++import S from "./StepperWithCards.module.css";++export interface StepperStep {+ id: string;+ title: string;+ cards: StepperCard[];+}++export interface StepperCard {+ id: string;+ title: string;+ description: string;++ optional?: boolean;+ done?: boolean;+ locked?: boolean;++ clickAction?: StepperCardClickAction;+}++type DocsUtm = Required<Pick<UtmProps, "utm_campaign" | "utm_content">>;++export type StepperCardClickAction =+ | { type: "link"; to: string }+ | { type: "docs"; docsPath: string; utm: DocsUtm }+ | { type: "click"; onClick: () => void };++export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {+ if (steps.length === 0) {+ return null;+ }++ return (+ <Stepper+ active={0}+ orientation="vertical"+ classNames={{+ stepLabel: S.stepLabel,+ verticalSeparator: S.verticalSeparator,+ stepIcon: S.stepIcon,+ stepWrapper: S.stepWrapper,+ stepBody: S.stepBody,+ stepDescription: S.stepDescription,+ }}+ iconSize={28}+ >+ {steps.map((step) => {+ const isDone = step.cards.every((card) => card.done || card.optional);++ return (+ <Stepper.Step+ key={step.id}+ label={step.title}+ className={cx(S.step, isDone && S.stepDone)}+ icon={isDone ? <Icon name="check" /> : undefined}+ description={+ <Group align="stretch">+ {step.cards.map((card) => {+ const onClick =+ card.clickAction?.type === "click"+ ? card.clickAction.onClick+ : undefined;++ return (+ <CardAction card={card} key={card.id}>+ <Card+ className={cx(S.stepCard, {+ [S.optionalStepCard]: card.optional,+ [S.lockedStepCard]: card.locked,+ })}+ component={onClick ? "button" : undefined}+ onClick={onClick}+ disabled={card.locked}+ data-testid={`step-card-${card.id}`}+ >+ <Stack justify="space-between" h="100%">+ <Stack gap="xs" h="100%">+ <Text+ size={card.optional ? "md" : "lg"}+ fw="bold"+ c={+ card.done+ ? "var(--mb-color-text-secondary)"+ : "var(--mb-color-text-primary)"+ }+ >+ {card.title}+ </Text>++ <Text+ c="var(--mb-color-text-secondary)"+ size="sm"+ lh="lg"+ >+ {card.description}+ </Text>+ </Stack>++ {(card.optional || card.done || card.locked) && (+ <Flex justify="flex-end">+ {match(card)+ .with({ done: true }, () => (+ <Text+ size="sm"+ c="var(--mb-color-success-darker)"+ >+ {t`Done`}+ </Text>+ ))+ .with({ locked: true }, () => (+ <Icon+ name="lock"+ c="var(--mb-color-text-secondary)"+ />+ ))+ .with({ optional: true }, () => (+ <Text+ size="sm"+ c="var(--mb-color-text-secondary)"+ >+ {t`Optional`}+ </Text>+ ))+ .otherwise(() => null)}+ </Flex>+ )}+ </Stack>+ </Card>+ </CardAction>+ );+ })}+ </Group>+ }+ data-done={isDone}+ ></Stepper.Step>+ );+ })}+ </Stepper>+ );+};++const CardAction = ({+ card,+ children,+}: {+ card: StepperCard;+ children: ReactNode;+}) =>+ match(card.clickAction)+ .with({ type: "docs" }, ({ docsPath, utm }) => (+ <DocsLink docsPath={docsPath} utm={utm}>+ {children}+ </DocsLink>+ ))+ .with({ type: "link" }, ({ to }) => {+ if (card.locked) {+ return children;+ }++ return <Link to={to}>{children}</Link>;+ })+ .otherwise(() => children);diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsxnew file mode 100644index 00000000000..17d3ba95ef7--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx@@ -0,0 +1,172 @@+import userEvent from "@testing-library/user-event";++import { render, screen } from "__support__/ui";++import type { StepperCardClickAction, StepperStep } from "./StepperWithCards";+import { StepperWithCards } from "./StepperWithCards";++const createMockSteps = (+ stepConfigs: {+ id: string;+ title: string;+ cards: {+ id: string;+ done?: boolean;+ optional?: boolean;+ locked?: boolean;+ clickAction?: StepperCardClickAction;+ }[];+ }[],+): StepperStep[] => {+ return stepConfigs.map(({ id, title, cards }) => ({+ id,+ title,+ cards: cards.map((card) => ({+ ...card,+ title: "Title",+ description: "Description",+ })),+ }));+};++describe("StepperWithCards", () => {+ it("should not automatically tick off former steps when completing a later step", () => {+ const steps = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [+ { id: "1", done: false },+ { id: "2", done: false },+ ],+ },+ {+ id: "step2",+ title: "Second Step",+ cards: [+ { id: "3", done: true }, // both must be done to complete the step+ { id: "4", done: false },+ ],+ },+ {+ id: "step3",+ title: "Third Step",+ cards: [+ { id: "5", done: true },+ { id: "6", done: true },+ ],+ },+ ]);++ render(<StepperWithCards steps={steps} />);++ const allSteps = screen.getAllByRole("button");+ expect(allSteps).toHaveLength(3);++ // Only the last step should be marked as done.+ expect(allSteps[0]).toHaveAttribute("data-done", "false");+ expect(allSteps[1]).toHaveAttribute("data-done", "false");+ expect(allSteps[2]).toHaveAttribute("data-done", "true");++ // Only one check icon should be visible.+ const checkIcons = screen.getAllByLabelText("check icon");+ expect(checkIcons).toHaveLength(1);+ });++ it("should consider optional cards as completed when determining step completion", () => {+ const steps = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [+ { id: "1", done: true },+ { id: "2", done: false, optional: true },+ ],+ },+ ]);++ render(<StepperWithCards steps={steps} />);++ const allSteps = screen.getAllByRole("button");+ expect(allSteps).toHaveLength(1);++ // Only the first step should be marked as done.+ expect(allSteps[0]).toHaveAttribute("data-done", "true");++ const checkIcons = screen.getAllByLabelText("check icon");+ expect(checkIcons).toHaveLength(1);+ });++ it("should disable locked cards", () => {+ const mockClickAction = jest.fn();+ const steps = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [+ { id: "1", done: false },+ {+ id: "2",+ done: false,+ locked: true,+ clickAction: { type: "click", onClick: mockClickAction },+ },+ ],+ },+ ]);++ render(<StepperWithCards steps={steps} />);++ // Lock icon should be shown+ const lockIcon = screen.getByLabelText("lock icon");+ expect(lockIcon).toBeInTheDocument();++ // The locked card should be disabled+ const lockedCard = screen.getByTestId("step-card-2");+ expect(lockedCard).toBeDisabled();++ // Clicking the disabled card should not trigger the action+ userEvent.click(lockedCard);+ expect(mockClickAction).not.toHaveBeenCalled();++ // The step should not be marked as done+ const allSteps = screen.getAllByRole("button");+ expect(allSteps).toHaveLength(2);+ expect(allSteps[0]).toHaveAttribute("data-done", "false");++ // No steps should be marked as done+ const checkIcons = screen.queryAllByLabelText("check icon");+ expect(checkIcons).toHaveLength(0);+ });++ it("should not create links for locked cards with link actions", () => {+ const steps = createMockSteps([+ {+ id: "step1",+ title: "First Step",+ cards: [+ { id: "1", done: false },+ {+ id: "2",+ done: false,+ locked: true,+ clickAction: {+ type: "link",+ to: "/test-link",+ },+ },+ ],+ },+ ]);++ render(<StepperWithCards steps={steps} />);++ // Should not find any links since the locked card shouldn't create one+ const links = screen.queryAllByRole("link");+ expect(links).toHaveLength(0);++ // Lock icon should still be present+ const lockIcon = screen.getByLabelText("lock icon");+ expect(lockIcon).toBeInTheDocument();+ });+});diff --git a/frontend/src/metabase/embedding/embedding-hub/components/index.ts b/frontend/src/metabase/embedding/embedding-hub/components/index.tsnew file mode 100644index 00000000000..e397fb532c2--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/components/index.ts@@ -0,0 +1 @@+export { EmbeddingHub } from "./EmbeddingHub";diff --git a/frontend/src/metabase/embedding/embedding-hub/hooks/index.ts b/frontend/src/metabase/embedding/embedding-hub/hooks/index.tsnew file mode 100644index 00000000000..a4d6d73369d--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/hooks/index.ts@@ -0,0 +1 @@+export { useCompletedEmbeddingHubSteps } from "./use-completed-embedding-hub-steps";diff --git a/frontend/src/metabase/embedding/embedding-hub/hooks/use-completed-embedding-hub-steps.ts b/frontend/src/metabase/embedding/embedding-hub/hooks/use-completed-embedding-hub-steps.tsnew file mode 100644index 00000000000..440463d8299--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/hooks/use-completed-embedding-hub-steps.ts@@ -0,0 +1,36 @@+import { useMemo } from "react";++import { useGetEmbeddingHubChecklistQuery } from "metabase/api/embedding-hub";++import type { EmbeddingHubStepId } from "../types";++/**+ * Embedding Hub completion steps should be derived by the instance state at the time, or tracked manually in instance settings for some of them.+ */+export const useCompletedEmbeddingHubSteps = (): {+ data: Record<EmbeddingHubStepId, boolean>;+ isLoading: boolean;+} => {+ const { data: embeddingHubChecklist, isLoading } =+ useGetEmbeddingHubChecklistQuery(undefined, {+ refetchOnMountOrArgChange: true,+ });++ const data = useMemo(() => {+ if (isLoading || !embeddingHubChecklist) {+ return {+ "create-test-embed": false,+ "add-data": false,+ "create-dashboard": false,+ "configure-row-column-security": false,+ "secure-embeds": false,+ "embed-production": false,+ "create-models": false,+ };+ }++ return { "create-models": false, ...embeddingHubChecklist };+ }, [embeddingHubChecklist, isLoading]);++ return { data, isLoading };+};diff --git a/frontend/src/metabase/embedding/embedding-hub/hooks/use-scroll-list-item-into-view.ts b/frontend/src/metabase/embedding/embedding-hub/hooks/use-scroll-list-item-into-view.tsnew file mode 100644index 00000000000..ff01c6b741e--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/hooks/use-scroll-list-item-into-view.ts@@ -0,0 +1,29 @@+import { createRef, useCallback, useMemo } from "react";++export function useScrollListItemIntoView<K extends string>(itemIds: K[]) {+ const listItemRefs = useMemo(() => {+ return itemIds.reduce(+ (refs, itemId) => {+ refs[itemId] = createRef<HTMLDivElement>();++ return refs;+ },+ {} as Record<K, React.RefObject<HTMLDivElement>>,+ );+ }, [itemIds]);++ const isValidItem = useCallback(+ (key: string | null): key is K => key != null && key in listItemRefs,+ [listItemRefs],+ );++ const scrollListItemIntoView = (itemId: string | null) => {+ if (isValidItem(itemId)) {+ const element = listItemRefs[itemId].current;++ element?.scrollIntoView({ behavior: "smooth", block: "center" });+ }+ };++ return { listItemRefs, scrollListItemIntoView };+}diff --git a/frontend/src/metabase/embedding/embedding-hub/index.ts b/frontend/src/metabase/embedding/embedding-hub/index.tsnew file mode 100644index 00000000000..474613d4483--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/index.ts@@ -0,0 +1,4 @@+export * from "./components";+export * from "./utils";+export * from "./hooks";+export * from "./types";diff --git a/frontend/src/metabase/embedding/embedding-hub/types/embedding-checklist.ts b/frontend/src/metabase/embedding/embedding-hub/types/embedding-checklist.tsnew file mode 100644index 00000000000..135f94396f3--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/types/embedding-checklist.ts@@ -0,0 +1,68 @@+import type { AddDataTab } from "metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/utils";+import type { IconName } from "metabase/ui";++export type EmbeddingHubStepId =+ | "create-test-embed"+ | "add-data"+ | "create-dashboard"+ | "configure-row-column-security"+ | "secure-embeds"+ | "embed-production"+ | "create-models";++export interface EmbeddingHubStep {+ id: EmbeddingHubStepId;+ title: string;+ icon: IconName;++ image?: EmbeddingHubImage;+ video?: EmbeddingHubVideo;++ /** Show an info alert box above the CTA */+ infoAlert?: EmbeddingHubInfoAlert;++ actions: EmbeddingHubAction[];+}++export type EmbeddingHubModalToTrigger =+ | { type: "add-data"; initialTab: AddDataTab }+ | { type: "new-dashboard" }+ | { type: "xray-dashboard" };++/** `always` is always shown. `locked` only shows on locked steps */+export type EmbeddingHubInfoAlert =+ | { type: "always"; message: string }+ | { type: "locked"; message: string };++interface EmbeddingHubAction {+ stepId?: EmbeddingHubStepId;++ title: string;+ description: string;++ /** Internal link to a Metabase route. */+ to?: string;++ /** Path of the documentation page, e.g. `embedding/embedded-analytics-js` */+ docsPath?: string;++ /** CTA button variant. */+ variant?: "outline" | "subtle" | "filled";++ /** Which modal to trigger? */+ modal?: EmbeddingHubModalToTrigger;++ optional?: boolean;+}++interface EmbeddingHubImage {+ src: string;+ srcSet?: string;+ alt: string;+}++export interface EmbeddingHubVideo {+ id: string;+ trackingId: string;+ title: string;+}diff --git a/frontend/src/metabase/embedding/embedding-hub/types/index.ts b/frontend/src/metabase/embedding/embedding-hub/types/index.tsnew file mode 100644index 00000000000..4b806b32c94--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/types/index.ts@@ -0,0 +1,5 @@+export type {+ EmbeddingHubStep,+ EmbeddingHubStepId,+ EmbeddingHubModalToTrigger,+} from "./embedding-checklist";diff --git a/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.ts b/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.tsnew file mode 100644index 00000000000..2ffebd5d431--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/utils/embedding-hub-steps.ts@@ -0,0 +1,136 @@+import { t } from "ttag";++import type { EmbeddingHubStep } from "../types";++export const getEmbeddingHubSteps = (): EmbeddingHubStep[] => {+ const TEST_EMBED: EmbeddingHubStep = {+ id: "create-test-embed",+ title: t`Create embed`,+ icon: "test_tube",+ actions: [+ {+ title: t`Create an embed`,+ description: t`Create an embed by using Embedded Analytics JS.`,+ to: "/embed-js?auth_method=user_session",+ variant: "outline",+ },+ ],+ image: {+ src: "app/assets/img/embedding_hub_create_embed.png",+ srcSet: "app/assets/img/[email protected] 2x",+ alt: t`Screenshot of creating an embed`,+ },+ };++ const ADD_DATA: EmbeddingHubStep = {+ id: "add-data",+ title: t`Add your data`,+ icon: "add_data",+ image: {+ src: "app/assets/img/onboarding_data_diagram.png",+ srcSet: "app/assets/img/[email protected] 2x",+ alt: t`Data sources and ETL diagram`,+ },+ actions: [+ {+ title: t`Add data`,+ description: t`Connect your own database or upload a CSV and start working with your real data.`,+ modal: { type: "add-data", initialTab: "db" },+ variant: "outline",+ },+ ],+ };++ const CREATE_DASHBOARD: EmbeddingHubStep = {+ id: "create-dashboard",+ title: t`Prepare data`,+ icon: "dashboard",+ video: {+ id: "FOAXF4p1AL0",+ trackingId: "COmu2w0SqGagUoVp",+ title: t`How to find and use X-rays?`,+ },+ actions: [+ {+ title: t`Generate a dashboard`,+ description: t`Automatically generate a dashboard from your data using x-rays.`,+ modal: { type: "xray-dashboard" },+ variant: "outline",+ },+ // {+ // title: t`Build a dashboard`,+ // description: t`Build your own dashboard from scratch.`,+ // modal: { type: "new-dashboard" },+ // variant: "subtle",+ // optional: true,+ // },+ {+ title: t`Create models`,+ description: t`Set up data models for your embedded analytics.`,+ to: "/model/new",+ optional: true,+ stepId: "create-models",+ },+ ],+ };++ const SECURE_EMBEDS: EmbeddingHubStep = {+ id: "secure-embeds",+ title: t`Security and permissions`,+ icon: "lock",+ actions: [+ {+ title: t`Configure SSO`,+ description: t`Configure JWT or SAML authentication to ensure only authorized users can access your embeds.`,+ docsPath: "embedding/embedded-analytics-js#set-up-sso",+ variant: "outline",+ stepId: "secure-embeds",+ },+ {+ title: t`Configure data permissions`,+ docsPath:+ "permissions/embedding#one-database-for-all-customers-commingled-setups",+ description: t`Manage permissions to limit what data your users can access.`,+ variant: "outline",+ stepId: "configure-row-column-security",+ optional: true,+ },+ ],+ image: {+ src: "app/assets/img/embedding_hub_secure_embeds_diagram.png",+ srcSet: "app/assets/img/[email protected] 2x",+ alt: t`Diagram of the SSO authentication workflow`,+ },+ };++ const EMBED_PRODUCTION: EmbeddingHubStep = {+ id: "embed-production",+ title: t`Deployment`,+ icon: "code_block",+ actions: [+ {+ title: t`Embed in production`,+ description: t`Deploy your embedded dashboard to a production environment and share with your users.`,+ to: "/embed-js?auth_method=sso",+ variant: "outline",+ },+ ],+ image: {+ src: "app/assets/img/embedding_hub_create_embed.png",+ srcSet: "app/assets/img/[email protected] 2x",+ alt: t`Screenshot of creating an embed`,+ },+ infoAlert: {+ type: "locked",+ message: t`Configure SSO authentication to unlock this step.`,+ },+ };++ return [+ ADD_DATA,+ CREATE_DASHBOARD,+ TEST_EMBED,+ SECURE_EMBEDS,+ EMBED_PRODUCTION,+ ];+};diff --git a/frontend/src/metabase/embedding/embedding-hub/utils/index.ts b/frontend/src/metabase/embedding/embedding-hub/utils/index.tsnew file mode 100644index 00000000000..3b76c3fa01f--- /dev/null+++ b/frontend/src/metabase/embedding/embedding-hub/utils/index.ts@@ -0,0 +1 @@+export { getEmbeddingHubSteps } from "./embedding-hub-steps";diff --git a/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx b/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsxindex 14566814e9a..68cfd88da3b 100644--- a/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx+++ b/frontend/src/metabase/home/components/EmbedHomepage/EmbedJsContent.tsx@@ -22,8 +22,12 @@ export const EmbedJsContent = ({}: EmbedJsContentProps) => {const cta = match({ variant, hasEmbeddingFeature }).with({ variant: "ee", hasEmbeddingFeature: true }, () => (- <Button component={Link} to={"/embed-js"} variant="outline">- {t`Start embedding`}+ <Button+ component={Link}+ to={"/admin/embedding/setup-guide"}+ variant="outline"+ >+ {t`Go to setup guide`}</Button>)).with({ variant: "ee", hasEmbeddingFeature: false }, () => (diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/AddDataModal.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/AddDataModal.tsxindex 847642d2310..9d4b33d5c29 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/AddDataModal.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/AddDataModal.tsx@@ -13,11 +13,17 @@ import { DatabasesPanel } from "./Panels/DatabasesPanel";import { PanelsHeader } from "./Panels/PanelsHeader";import { trackAddDataEvent } from "./analytics";import { useAddDataPermissions } from "./use-add-data-permission";-import { hasMeaningfulUploadableDatabases, isValidTab } from "./utils";+import {+ type AddDataTab,+ hasMeaningfulUploadableDatabases,+ isValidTab,+} from "./utils";interface AddDataModalProps {opened: boolean;onClose: () => void;++ initialTab?: AddDataTab;}interface Tabs {@@ -27,7 +33,11 @@ interface Tabs {iconName: IconName;}-export const AddDataModal = ({ opened, onClose }: AddDataModalProps) => {+export const AddDataModal = ({+ opened,+ onClose,+ initialTab,+}: AddDataModalProps) => {const { areUploadsEnabled, canUploadToDatabase, canManageUploads, isAdmin } =useAddDataPermissions();@@ -56,7 +66,7 @@ export const AddDataModal = ({ opened, onClose }: AddDataModalProps) => {db: "database_tab_clicked",csv: "csv_tab_clicked",gsheets: "sheets_tab_clicked",- } as const;+ } as const satisfies Record<AddDataTab, string>;trackAddDataEvent(eventMapping[tabValue]);setActiveTab(tabValue);@@ -81,11 +91,16 @@ export const AddDataModal = ({ opened, onClose }: AddDataModalProps) => {}, [shouldShowUploadsPanel, isHosted]);useEffect(() => {- const firstVisibleTab = tabs.find((tab) => tab.isVisible);- if (firstVisibleTab) {- setActiveTab(firstVisibleTab.value);+ if (initialTab) {+ setActiveTab(initialTab);+ } else {+ const firstVisibleTab = tabs.find((tab) => tab.isVisible);++ if (firstVisibleTab) {+ setActiveTab(firstVisibleTab.value);+ }}- }, [tabs]);+ }, [tabs, initialTab]);return (<Modal.Root opened={opened} onClose={onClose} size="auto">diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/utils.ts b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/utils.tsindex c779d08a186..5f9bff3d6f5 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/utils.ts+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/utils.ts@@ -3,7 +3,7 @@ import type { Database } from "metabase-types/api";const validTabArray = ["db", "csv", "gsheets"] as const;const validTabs = new Set<string>(validTabArray);-type AddDataTab = (typeof validTabArray)[number];+export type AddDataTab = (typeof validTabArray)[number];export const isValidTab = (v: string | null): v is AddDataTab =>typeof v === "string" && validTabs.has(v);diff --git a/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsx b/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsxindex f077d6e6f05..3b603d6fd52 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsx@@ -54,6 +54,7 @@ export type SetupOpts = {hasDWHAttached?: boolean;isEmbeddingIframe?: boolean;hasWhitelabelToken?: boolean;+ hasEmbeddingFeature?: boolean;applicationName?: string;activeUsersCount?: number;};@@ -86,6 +87,7 @@ export async function setup({hasDWHAttached = false,isEmbeddingIframe,hasWhitelabelToken,+ hasEmbeddingFeature,applicationName = "Metabase",}: SetupOpts = {}) {if (isEmbeddingIframe) {@@ -191,6 +193,7 @@ export async function setup({hosting: true,upload_management: true,whitelabel: hasWhitelabelToken,+ embedding: hasEmbeddingFeature,}),"show-google-sheets-integration": true,"active-users-count": activeUsersCount,diff --git a/frontend/src/metabase/palette/constants.ts b/frontend/src/metabase/palette/constants.tsindex c13cab57216..15512cddcd7 100644--- a/frontend/src/metabase/palette/constants.ts+++ b/frontend/src/metabase/palette/constants.ts@@ -73,9 +73,6 @@ export const getAdminSettingsSections = ("public-sharing": {name: t`Public Sharing`,},- "embedding-in-other-applications": {- name: t`Embedding`,- },license: {name: t`License`,},diff --git a/frontend/src/metabase/plugins/index.ts b/frontend/src/metabase/plugins/index.tsindex 5256dec3f74..3205e2c3016 100644--- a/frontend/src/metabase/plugins/index.ts+++ b/frontend/src/metabase/plugins/index.ts@@ -129,8 +129,14 @@ export const PLUGIN_WHITELABEL = {WhiteLabelConcealSettingsPage: PluginPlaceholder,};-export const PLUGIN_ADMIN_SETTINGS = {- InteractiveEmbeddingSettings: NotFoundPlaceholder,+export const PLUGIN_ADMIN_SETTINGS: {+ InteractiveEmbeddingSettings: ComponentType | null;+ LicenseAndBillingSettings: ComponentType;+ useUpsellFlow: (props: { campaign: string; location: string }) => {+ triggerUpsellFlow: (() => void) | undefined;+ };+} = {+ InteractiveEmbeddingSettings: null,LicenseAndBillingSettings: PluginPlaceholder,useUpsellFlow: (_props: {campaign: string;diff --git a/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.common.unit.spec.tsx b/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.common.unit.spec.tsxindex e35d59cabbd..a0029c72f8a 100644--- a/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.common.unit.spec.tsx+++ b/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.common.unit.spec.tsx@@ -37,10 +37,7 @@ describe("EmbedModalContent", () => {withinStaticEmbeddingCard.getByRole("link", {name: "Enable in admin settings",}),- ).toHaveAttribute(- "href",- "/admin/settings/embedding-in-other-applications/standalone",- );+ ).toHaveAttribute("href", "/admin/embedding/static");});});@@ -154,10 +151,7 @@ describe("EmbedModalContent", () => {withinSdkCard.getByRole("link", {name: "Enable in admin settings",}),- ).toHaveAttribute(- "href",- "/admin/settings/embedding-in-other-applications/sdk",- );+ ).toHaveAttribute("href", "/admin/embedding/modular");});});@@ -173,7 +167,7 @@ describe("EmbedModalContent", () => {expect(screen.getByRole("link", { name: SDK_TITLE })).toHaveProperty("href",// I have no idea why only this URL is absolute in the test, it is relative in the markup 🤷- "http://localhost/admin/settings/embedding-in-other-applications/sdk",+ "http://localhost/admin/embedding/modular",);// We don't show the link at the bottom of the carddiff --git a/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.premium.unit.spec.tsx b/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.premium.unit.spec.tsxindex 463e17c824e..36d7f5a990c 100644--- a/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.premium.unit.spec.tsx+++ b/frontend/src/metabase/public/components/EmbedModal/EmbedModalContent/tests/EmbedModalContent.premium.unit.spec.tsx@@ -37,10 +37,7 @@ describe("EmbedModalContent", () => {withinInteractiveEmbeddingCard.getByRole("link", {name: "Enable in admin settings",}),- ).toHaveAttribute(- "href",- "/admin/settings/embedding-in-other-applications/full-app",- );+ ).toHaveAttribute("href", "/admin/embedding/interactive");});});@@ -58,7 +55,7 @@ describe("EmbedModalContent", () => {).toHaveProperty("href",// I have no idea why only this URL is absolute in the test, it is relative in the markup 🤷- "http://localhost/admin/settings/embedding-in-other-applications/full-app",+ "http://localhost/admin/embedding/interactive",);// We don't show the link at the bottom of the carddiff --git a/frontend/src/metabase/public/components/EmbedModal/SelectEmbedTypePane/SelectEmbedTypePane.tsx b/frontend/src/metabase/public/components/EmbedModal/SelectEmbedTypePane/SelectEmbedTypePane.tsxindex 8d8ae5d79fb..99fa086045c 100644--- a/frontend/src/metabase/public/components/EmbedModal/SelectEmbedTypePane/SelectEmbedTypePane.tsx+++ b/frontend/src/metabase/public/components/EmbedModal/SelectEmbedTypePane/SelectEmbedTypePane.tsx@@ -116,7 +116,7 @@ export function SelectEmbedTypePane({illustration={<StaticEmbeddingIllustration />}onClick={isStaticEmbeddingEnabled ? goToNextStep : undefined}isDisabled={!isStaticEmbeddingEnabled}- disabledLink="/admin/settings/embedding-in-other-applications/standalone"+ disabledLink="/admin/embedding/static"><List><List.Item>{t`Embedded, signed charts in iframes.`}</List.Item>@@ -138,9 +138,7 @@ export function SelectEmbedTypePane({isDisabled={isInteractiveEmbeddingAvailable && !isInteractiveEmbeddingEnabled}- disabledLink={- "/admin/settings/embedding-in-other-applications/full-app"- }+ disabledLink={"/admin/embedding/interactive"}><List>{/* eslint-disable-next-line no-literal-metabase-strings -- only admin sees this */}@@ -157,7 +155,7 @@ export function SelectEmbedTypePane({{/* REACT SDK */}<MaybeLink- to="/admin/settings/embedding-in-other-applications/sdk"+ to="/admin/embedding/modular"shouldRenderLink={isEmbeddingSdkEnabled}aria-label={t`Embedded analytics SDK`}>@@ -166,7 +164,7 @@ export function SelectEmbedTypePane({badge={<UpsellGem />}illustration={<SdkIllustration />}isDisabled={!isEmbeddingSdkEnabled}- disabledLink={"/admin/settings/embedding-in-other-applications/sdk"}+ disabledLink={"/admin/embedding/modular"}><List>{/* eslint-disable-next-line no-literal-metabase-strings -- visible only to admin */}diff --git a/frontend/src/metabase/ui/components/data-display/Stepper/index.ts b/frontend/src/metabase/ui/components/data-display/Stepper/index.tsnew file mode 100644index 00000000000..c318b4374dd--- /dev/null+++ b/frontend/src/metabase/ui/components/data-display/Stepper/index.ts@@ -0,0 +1 @@+export { Stepper } from "@mantine/core";diff --git a/frontend/src/metabase/ui/components/data-display/index.ts b/frontend/src/metabase/ui/components/data-display/index.tsindex 297eff3f87f..f71263ae8e2 100644--- a/frontend/src/metabase/ui/components/data-display/index.ts+++ b/frontend/src/metabase/ui/components/data-display/index.ts@@ -6,3 +6,4 @@ export * from "./Image";export * from "./Indicator";export * from "./Kbd";export * from "./Timeline";+export * from "./Stepper";diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/embed_interactive.svg b/frontend/src/metabase/ui/components/icons/Icon/icons/embed_interactive.svgnew file mode 100644index 00000000000..6a2bc47dbe5--- /dev/null+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/embed_interactive.svg@@ -0,0 +1,8 @@+<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<mask id="path-1-inside-1_15523_12299" fill="white">+<rect x="1" y="3" width="14" height="10" rx="1"/>+</mask>+<rect x="1" y="3" width="14" height="10" rx="1" stroke="currentcolor" stroke-width="3" mask="url(#path-1-inside-1_15523_12299)"/>+<path d="M4.21967 6.71967C4.07902 6.86032 4 7.05109 4 7.25C4 7.44891 4.07902 7.63968 4.21967 7.78033C4.36032 7.92098 4.55109 8 4.75 8H5.5V8.75C5.5 8.94891 5.57902 9.13968 5.71967 9.28033C5.86032 9.42098 6.05109 9.5 6.25 9.5C6.44891 9.5 6.63968 9.42098 6.78033 9.28033C6.92098 9.13968 7 8.94891 7 8.75V8H7.75C7.94891 8 8.13968 7.92098 8.28033 7.78033C8.42098 7.63968 8.5 7.44891 8.5 7.25C8.5 7.05109 8.42098 6.86032 8.28033 6.71967C8.13968 6.57902 7.94891 6.5 7.75 6.5H7V5.75C7 5.55109 6.92098 5.36032 6.78033 5.21967C6.63968 5.07902 6.44891 5 6.25 5C6.05109 5 5.86032 5.07902 5.71967 5.21967C5.57902 5.36032 5.5 5.55109 5.5 5.75V6.5H4.75C4.55109 6.5 4.36032 6.57902 4.21967 6.71967Z" fill="currentcolor" />+<path d="M11.7803 9.78033C11.921 9.63968 12 9.44891 12 9.25C12 9.05109 11.921 8.86032 11.7803 8.71967C11.6397 8.57902 11.4489 8.5 11.25 8.5H11V8.25C11 8.05109 10.921 7.86032 10.7803 7.71967C10.6397 7.57902 10.4489 7.5 10.25 7.5C10.0511 7.5 9.86032 7.57902 9.71967 7.71967C9.57902 7.86032 9.5 8.05109 9.5 8.25V8.5H9.25C9.05109 8.5 8.86032 8.57902 8.71967 8.71967C8.57902 8.86032 8.5 9.05109 8.5 9.25C8.5 9.44891 8.57902 9.63968 8.71967 9.78033C8.86032 9.92098 9.05109 10 9.25 10H9.5V10.25C9.5 10.4489 9.57902 10.6397 9.71967 10.7803C9.86032 10.921 10.0511 11 10.25 11C10.4489 11 10.6397 10.921 10.7803 10.7803C10.921 10.6397 11 10.4489 11 10.25V10H11.25C11.4489 10 11.6397 9.92098 11.7803 9.78033Z" fill="currentcolor" />+</svg>diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/embed_modular.svg b/frontend/src/metabase/ui/components/icons/Icon/icons/embed_modular.svgnew file mode 100644index 00000000000..59048863e49--- /dev/null+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/embed_modular.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path d="M10.2593 2.9264C10.3431 3.01029 10.4477 3.0703 10.5624 3.10027C10.6772 3.13023 10.7978 3.12905 10.9119 3.09685C11.026 3.06465 11.1295 3.0026 11.2117 2.91709C11.2938 2.83159 11.3517 2.72572 11.3793 2.6104C11.4485 2.32233 11.5932 2.05792 11.7986 1.84438C12.0039 1.63085 12.2625 1.47592 12.5477 1.39555C12.8328 1.31517 13.1342 1.31226 13.4209 1.38711C13.7075 1.46196 13.9691 1.61187 14.1785 1.8214C14.388 2.03092 14.5378 2.29249 14.6126 2.57917C14.6873 2.86585 14.6843 3.16727 14.6038 3.45239C14.5234 3.73752 14.3683 3.99604 14.1547 4.20134C13.9411 4.40664 13.6767 4.55129 13.3886 4.6204C13.2733 4.648 13.1674 4.70585 13.0819 4.788C12.9964 4.87015 12.9343 4.97361 12.9021 5.08773C12.8699 5.20185 12.8688 5.32249 12.8987 5.43721C12.9287 5.55194 12.9887 5.6566 13.0726 5.7404L14.1946 6.86173C14.344 7.01118 14.4626 7.18859 14.5435 7.38385C14.6244 7.57911 14.666 7.78839 14.666 7.99973C14.666 8.21108 14.6244 8.42036 14.5435 8.61562C14.4626 8.81088 14.344 8.98829 14.1946 9.13773L13.0726 10.2597C12.9888 10.3436 12.8841 10.4036 12.7694 10.4336C12.6547 10.4636 12.534 10.4624 12.4199 10.4302C12.3058 10.398 12.2023 10.3359 12.1202 10.2504C12.038 10.1649 11.9802 10.0591 11.9526 9.94373C11.8834 9.65567 11.7386 9.39125 11.5333 9.17772C11.3279 8.96419 11.0693 8.80926 10.7842 8.72888C10.499 8.64851 10.1976 8.6456 9.91095 8.72045C9.6243 8.7953 9.36278 8.9452 9.15332 9.15473C8.94387 9.36425 8.79405 9.62582 8.71929 9.9125C8.64454 10.1992 8.64755 10.5006 8.72802 10.7857C8.80849 11.0709 8.9635 11.3294 9.1771 11.5347C9.3907 11.74 9.65517 11.8846 9.94326 11.9537C10.0586 11.9813 10.1644 12.0392 10.25 12.1213C10.3355 12.2035 10.3975 12.3069 10.4297 12.4211C10.4619 12.5352 10.4631 12.6558 10.4331 12.7705C10.4032 12.8853 10.3431 12.9899 10.2593 13.0737L9.13726 14.1951C8.98782 14.3445 8.8104 14.4631 8.61514 14.5439C8.41988 14.6248 8.21061 14.6665 7.99926 14.6665C7.78791 14.6665 7.57863 14.6248 7.38337 14.5439C7.18811 14.4631 7.0107 14.3445 6.86126 14.1951L5.73926 13.0731C5.65546 12.9892 5.5508 12.9292 5.43607 12.8992C5.32135 12.8692 5.20071 12.8704 5.08659 12.9026C4.97247 12.9348 4.869 12.9969 4.78686 13.0824C4.70471 13.1679 4.64686 13.2737 4.61926 13.3891C4.55005 13.6771 4.40532 13.9415 4.19995 14.1551C3.99458 14.3686 3.736 14.5235 3.45085 14.6039C3.1657 14.6843 2.86427 14.6872 2.57762 14.6124C2.29097 14.5375 2.02945 14.3876 1.81999 14.1781C1.61054 13.9685 1.46072 13.707 1.38596 13.4203C1.31121 13.1336 1.31422 12.8322 1.39469 12.5471C1.47515 12.2619 1.63017 12.0034 1.84377 11.7981C2.05737 11.5928 2.32183 11.4482 2.60992 11.3791C2.72524 11.3515 2.83111 11.2936 2.91662 11.2115C3.00213 11.1293 3.06418 11.0259 3.09638 10.9117C3.12857 10.7976 3.12975 10.677 3.09979 10.5623C3.06983 10.4475 3.00981 10.3429 2.92592 10.2591L1.80392 9.13773C1.65448 8.98829 1.53593 8.81088 1.45504 8.61562C1.37416 8.42036 1.33253 8.21108 1.33253 7.99973C1.33253 7.78839 1.37416 7.57911 1.45504 7.38385C1.53593 7.18859 1.65448 7.01118 1.80392 6.86173L2.92592 5.73973C3.00973 5.65585 3.11438 5.59583 3.22911 5.56587C3.34384 5.53591 3.46448 5.53709 3.57859 5.56928C3.69271 5.60148 3.79618 5.66353 3.87833 5.74904C3.96047 5.83455 4.01833 5.94042 4.04592 6.05573C4.11513 6.3438 4.25987 6.60822 4.46524 6.82175C4.6706 7.03528 4.92918 7.19021 5.21433 7.27059C5.49949 7.35096 5.80091 7.35387 6.08756 7.27902C6.37422 7.20417 6.63574 7.05426 6.84519 6.84474C7.05465 6.63521 7.20447 6.37364 7.27922 6.08697C7.35398 5.80029 7.35097 5.49887 7.2705 5.21374C7.19003 4.92861 7.03501 4.67009 6.82141 4.46479C6.60781 4.25949 6.34335 4.11484 6.05526 4.04573C5.93994 4.01814 5.83407 3.96028 5.74856 3.87813C5.66306 3.79599 5.601 3.69252 5.56881 3.5784C5.53661 3.46429 5.53543 3.34364 5.56539 3.22892C5.59535 3.11419 5.65537 3.00954 5.73926 2.92573L6.86126 1.8044C7.0107 1.65495 7.18811 1.5364 7.38337 1.45552C7.57863 1.37464 7.78791 1.33301 7.99926 1.33301C8.21061 1.33301 8.41988 1.37464 8.61514 1.45552C8.8104 1.5364 8.98782 1.65495 9.13726 1.8044L10.2593 2.9264Z" stroke="currentcolor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round" />+</svg>diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/embed_static.svg b/frontend/src/metabase/ui/components/icons/Icon/icons/embed_static.svgnew file mode 100644index 00000000000..51dec897688--- /dev/null+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/embed_static.svg@@ -0,0 +1,7 @@+<svg viewBox="0 0 16 16" fill="currentcolor" xmlns="http://www.w3.org/2000/svg">+ <path d="M1 3C1 2.44772 1.44772 2 2 2H14C14.5523 2 15 2.44772 15 3V4H1V3Z" />+ <path d="M1 5H3V13H2C1.44772 13 1 12.5523 1 12V5Z" />+ <path d="M4 6C4 5.44772 4.44772 5 5 5H14C14.5523 5 15 5.44772 15 6V8H4V6Z" />+ <path d="M4 9H9V13H5C4.44772 13 4 12.5523 4 12V9Z" />+ <path d="M10 9H15V12C15 12.5523 14.5523 13 14 13H10V9Z" />+</svg>diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts b/frontend/src/metabase/ui/components/icons/Icon/icons/index.tsindex 82b441dc038..84aa79f01bd 100644--- a/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts@@ -134,6 +134,12 @@ import ellipsis_component from "./ellipsis.svg?component";import ellipsis_source from "./ellipsis.svg?source";import embed_component from "./embed.svg?component";import embed_source from "./embed.svg?source";+import embed_interactive_component from "./embed_interactive.svg?component";+import embed_interactive_source from "./embed_interactive.svg?source";+import embed_modular_component from "./embed_modular.svg?component";+import embed_modular_source from "./embed_modular.svg?source";+import embed_static_component from "./embed_static.svg?component";+import embed_static_source from "./embed_static.svg?source";import empty_component from "./empty.svg?component";import empty_source from "./empty.svg?source";import enter_or_return_component from "./enter_or_return.svg?component";@@ -360,6 +366,8 @@ import share_component from "./share.svg?component";import share_source from "./share.svg?source";import shield_component from "./shield.svg?component";import shield_source from "./shield.svg?source";+import shield_outline_component from "./shield_outline.svg?component";+import shield_outline_source from "./shield_outline.svg?source";import sidebar_closed_component from "./sidebar_closed.svg?component";import sidebar_closed_source from "./sidebar_closed.svg?source";import sidebar_open_component from "./sidebar_open.svg?component";@@ -416,6 +424,8 @@ import table_component from "./table.svg?component";import table_source from "./table.svg?source";import table2_component from "./table2.svg?component";import table2_source from "./table2.svg?source";+import test_tube_component from "./test_tube.svg?component";+import test_tube_source from "./test_tube.svg?source";import text_bold_component from "./text_bold.svg?component";import text_bold_source from "./text_bold.svg?source";import text_italic_component from "./text_italic.svg?component";@@ -1097,6 +1107,18 @@ export const Icons: Record<IconName, { component: React.VFC; source: string }> =component: progress_component,source: progress_source,},+ embed_interactive: {+ component: embed_interactive_component,+ source: embed_interactive_source,+ },+ embed_modular: {+ component: embed_modular_component,+ source: embed_modular_source,+ },+ embed_static: {+ component: embed_static_component,+ source: embed_static_source,+ },pulse: {component: pulse_component,source: pulse_source,@@ -1217,6 +1239,10 @@ export const Icons: Record<IconName, { component: React.VFC; source: string }> =component: shield_component,source: shield_source,},+ shield_outline: {+ component: shield_outline_component,+ source: shield_outline_source,+ },sidebar_closed: {component: sidebar_closed_component,source: sidebar_closed_source,@@ -1431,6 +1457,7 @@ export const Icons: Record<IconName, { component: React.VFC; source: string }> =table_spaced: { component: table_component, source: table_source },collection: { component: folder_component, source: folder_source },beaker: { component: formula_component, source: formula_source },+ test_tube: { component: test_tube_component, source: test_tube_source },eye_filled: { component: eye_component, source: eye_source },};@@ -1503,6 +1530,9 @@ export type IconName =| "edit_document_outlined"| "ellipsis"| "embed"+ | "embed_interactive"+ | "embed_modular"+ | "embed_static"| "empty"| "enter_or_return"| "expand"@@ -1625,6 +1655,7 @@ export type IconName =| "section"| "segment"| "shield"+ | "shield_outline"| "sidebar_closed"| "sidebar_open"| "slack"@@ -1680,6 +1711,7 @@ export type IconName =| "table_spaced"| "collection"| "beaker"+ | "test_tube"| "eye_filled";export const iconNames = Object.keys(Icons) as unknown as IconName[];diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/shield_outline.svg b/frontend/src/metabase/ui/components/icons/Icon/icons/shield_outline.svgnew file mode 100644index 00000000000..b348bccfbd0--- /dev/null+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/shield_outline.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path d="M13.3346 8.66664C13.3346 12 11.0013 13.6666 8.22797 14.6333C8.08274 14.6825 7.92499 14.6802 7.7813 14.6266C5.0013 13.6666 2.66797 12 2.66797 8.66664V3.99997C2.66797 3.82316 2.73821 3.65359 2.86323 3.52857C2.98826 3.40355 3.15782 3.33331 3.33464 3.33331C4.66797 3.33331 6.33464 2.53331 7.49464 1.51997C7.63587 1.39931 7.81554 1.33301 8.0013 1.33301C8.18707 1.33301 8.36673 1.39931 8.50797 1.51997C9.67464 2.53997 11.3346 3.33331 12.668 3.33331C12.8448 3.33331 13.0143 3.40355 13.1394 3.52857C13.2644 3.65359 13.3346 3.82316 13.3346 3.99997V8.66664Z" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round" stroke="currentcolor" />+</svg>+diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/test_tube.svg b/frontend/src/metabase/ui/components/icons/Icon/icons/test_tube.svgnew file mode 100644index 00000000000..2af58d3cfb5--- /dev/null+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/test_tube.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 16 16" fill="transparent" xmlns="http://www.w3.org/2000/svg">+ <path d="M14.0001 4.66927L4.54681 14.1226C4.19245 14.4731 3.71382 14.6691 3.21544 14.6678C2.71706 14.6666 2.23941 14.4682 1.88681 14.1159C1.53345 13.7622 1.33496 13.2826 1.33496 12.7826C1.33496 12.2826 1.53345 11.803 1.88681 11.4493L11.3335 2.0026M10.6668 1.33594L14.6668 5.33594M8.00015 10.6693H2.66681" stroke="currentcolor" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round" />+</svg>diff --git a/resources/frontend_client/app/assets/img/embedding_hub_create_embed.png b/resources/frontend_client/app/assets/img/embedding_hub_create_embed.pngnew file mode 100644index 00000000000..7bffb07b50eBinary files /dev/null and b/resources/frontend_client/app/assets/img/embedding_hub_create_embed.png differdiff --git a/resources/frontend_client/app/assets/img/[email protected] b/resources/frontend_client/app/assets/img/[email protected]new file mode 100644index 00000000000..476ff6991a3Binary files /dev/null and b/resources/frontend_client/app/assets/img/[email protected] differdiff --git a/resources/frontend_client/app/assets/img/embedding_hub_row_column_security.png b/resources/frontend_client/app/assets/img/embedding_hub_row_column_security.pngnew file mode 100644index 00000000000..805394a46ddBinary files /dev/null and b/resources/frontend_client/app/assets/img/embedding_hub_row_column_security.png differdiff --git a/resources/frontend_client/app/assets/img/[email protected] b/resources/frontend_client/app/assets/img/[email protected]new file mode 100644index 00000000000..2c62a39be8bBinary files /dev/null and b/resources/frontend_client/app/assets/img/[email protected] differdiff --git a/resources/frontend_client/app/assets/img/embedding_hub_secure_embeds_diagram.png b/resources/frontend_client/app/assets/img/embedding_hub_secure_embeds_diagram.pngnew file mode 100644index 00000000000..127e6a7a541Binary files /dev/null and b/resources/frontend_client/app/assets/img/embedding_hub_secure_embeds_diagram.png differdiff --git a/resources/frontend_client/app/assets/img/[email protected] b/resources/frontend_client/app/assets/img/[email protected]new file mode 100644index 00000000000..97a5d6ad330Binary files /dev/null and b/resources/frontend_client/app/assets/img/[email protected] differdiff --git a/src/metabase/embedding/settings.clj b/src/metabase/embedding/settings.cljindex cead5eb3324..0ac4bc2d0ec 100644--- a/src/metabase/embedding/settings.clj+++ b/src/metabase/embedding/settings.clj@@ -294,3 +294,17 @@:default false:export? true:visibility :admin)++(defsetting embedding-hub-test-embed-snippet-created+ (deferred-tru "Indicates if a test embed snippet has been created for tracking in the embedding hub")+ :type :boolean+ :default false+ :export? true+ :visibility :admin)++(defsetting embedding-hub-production-embed-snippet-created+ (deferred-tru "Indicates if a production embed snippet has been created for tracking in the embedding hub")+ :type :boolean+ :default false+ :export? true+ :visibility :admin)diff --git a/src/metabase/premium_features/settings.clj b/src/metabase/premium_features/settings.cljindex 58b167b60f3..319e3957f3d 100644--- a/src/metabase/premium_features/settings.clj+++ b/src/metabase/premium_features/settings.clj@@ -255,6 +255,10 @@"Should we enable Embedded Analytics JS?":embedding-simple)+(define-premium-feature ^{:added "0.57.0"} enable-embedding-hub?+ "Should we enable the embedding hub?"+ :embedding-hub)+(define-premium-feature ^{:added "0.55.0"} enable-ai-entity-analysis?"Should Metabase do AI analysis on entities?":ai-entity-analysis)diff --git a/test/metabase/analytics/stats_test.clj b/test/metabase/analytics/stats_test.cljindex 048f6f4f377..328254c59e8 100644--- a/test/metabase/analytics/stats_test.clj+++ b/test/metabase/analytics/stats_test.clj@@ -558,6 +558,7 @@:embedding:embedding-sdk:embedding-simple+ :embedding-hub:enhancements:etl-connections:etl-connections-pgdiff --git a/test_resources/serialization_baseline/settings.yaml b/test_resources/serialization_baseline/settings.yamlindex 9323baf0231..f7b7360ba7d 100644--- a/test_resources/serialization_baseline/settings.yaml+++ b/test_resources/serialization_baseline/settings.yaml@@ -17,6 +17,8 @@ default-maps-enabled: nulldisable-cors-on-localhost: nullemail-max-recipients-per-second: nullembedding-homepage: null+embedding-hub-production-embed-snippet-created: null+embedding-hub-test-embed-snippet-created: nullenable-embedding: nullenable-nested-queries: nullenable-pivoted-exports: null