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
Link to usage conditions in the theme preview acceptance prompt (#77072)
Sébastien344861dd6773
diff --git a/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.tsx b/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.tsxindex 3c595ce7b70..fa84da43804 100644--- a/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.tsx+++ b/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.tsx@@ -1,7 +1,7 @@-import { t } from "ttag";+import { c, t } from "ttag";import { useUpdateSettingsMutation } from "metabase/api";-import { Button, Center, Stack, Text } from "metabase/ui";+import { Anchor, Button, Center, Stack, Text } from "metabase/ui";interface EnableEmbeddingPromptProps {isEnabled: boolean;@@ -21,9 +21,24 @@ export function EnableEmbeddingPrompt({});};+ const usageConditionsLink = (+ <Anchor+ key="usage-conditions"+ href="https://metabase.com/license/embedding"+ target="_blank"+ >+ {t`usage conditions`}+ </Anchor>+ );+const message = !isEnabled- ? t`Enable modular embedding to see a live preview of your theme.`- : t`Accept the usage conditions to see a live preview of your theme.`;+ ? c(+ "Prompt to enable modular embedding to see a live preview of an embedding theme.",+ ).t`Enable modular embedding to see a live preview of your theme.`+ : c(+ "{0} is a link to the embedding conditions, for users to accept them and see a live preview of their theme.",+ )+ .jt`Accept the ${usageConditionsLink} to see a live preview of your theme.`;const buttonLabel = !isEnabled? t`Enable modular embedding`diff --git a/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.unit.spec.tsx b/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.unit.spec.tsxnew file mode 100644index 00000000000..0e867fa8530--- /dev/null+++ b/frontend/src/metabase/admin/embedding/components/ThemeEditor/EnableEmbeddingPrompt.unit.spec.tsx@@ -0,0 +1,54 @@+import { renderWithProviders, screen } from "__support__/ui";++import { EnableEmbeddingPrompt } from "./EnableEmbeddingPrompt";++const setup = ({+ isEnabled,+ isTermsAccepted,+}: {+ isEnabled: boolean;+ isTermsAccepted: boolean;+}) => {+ renderWithProviders(+ <EnableEmbeddingPrompt+ isEnabled={isEnabled}+ isTermsAccepted={isTermsAccepted}+ />,+ );+};++describe("EnableEmbeddingPrompt", () => {+ it("prompts to enable modular embedding when it is disabled", () => {+ setup({ isEnabled: false, isTermsAccepted: false });++ expect(+ screen.getByText(+ "Enable modular embedding to see a live preview of your theme.",+ ),+ ).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: "Enable modular embedding" }),+ ).toBeInTheDocument();+ expect(+ screen.queryByRole("link", { name: "usage conditions" }),+ ).not.toBeInTheDocument();+ });++ it("links to the usage conditions when only the terms are pending", () => {+ setup({ isEnabled: true, isTermsAccepted: false });++ expect(+ screen.getByText(/to see a live preview of your theme\./),+ ).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: "Accept and continue" }),+ ).toBeInTheDocument();++ const link = screen.getByRole("link", { name: "usage conditions" });+ expect(link).toHaveAttribute(+ "href",+ "https://metabase.com/license/embedding",+ );+ expect(link).toHaveAttribute("target", "_blank");+ });+});