Skip to content

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

EMB-1329: update embed wizard terms copy and add link (#69856)

Alberto Perdomof02d26aa14a6
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.ts
index ef03f2b208a..054f565d33f 100644
--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.ts
+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-ee.cy.spec.ts
@@ -18,6 +18,8 @@ const DATA_BY_EMBEDDING_TYPE = {
"To continue, enable guest embeds and agree to the usage conditions.",
embeddingSettingName: "enable-embedding-static",
showTermsSettingName: "show-static-embed-terms",
+ tooltipText:
+ /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,
},
modular: {
path: "/admin/embedding",
@@ -28,6 +30,7 @@ const DATA_BY_EMBEDDING_TYPE = {
"To continue, enable modular embedding and agree to the usage conditions.",
embeddingSettingName: "enable-embedding-simple",
showTermsSettingName: "show-simple-embed-terms",
+ tooltipText: /Sharing Metabase accounts is a security risk/,
},
} as const;
@@ -49,6 +52,7 @@ describe("scenarios > embedding > sdk iframe embed setup > enable embed js (EE)"
showTermsSettingName,
cardTestId,
cardText,
+ tooltipText,
} = value;
beforeEach(() => {
@@ -71,20 +75,14 @@ describe("scenarios > embedding > sdk iframe embed setup > enable embed js (EE)"
cy.findByLabelText(authMethodLabel).click();
- embedModalEnableEmbeddingCard().within(() => {
- cy.findByText(cardText).should("exist");
- });
+ embedModalEnableEmbeddingCard().should("contain.text", cardText);
cy.log("shows tooltip with fair usage info");
embedModalEnableEmbeddingCard()
.findByLabelText("info icon")
.trigger("mouseover");
- H.hovercard()
- .contains(
- /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,
- )
- .should("be.visible");
+ H.hovercard().contains(tooltipText).should("be.visible");
embedModalEnableEmbeddingCard()
.findByLabelText("info icon")
@@ -139,22 +137,19 @@ describe("scenarios > embedding > sdk iframe embed setup > enable embed js (EE)"
cy.findByLabelText(authMethodLabel).click();
- embedModalEnableEmbeddingCard().within(() => {
- cy.findByText("Agree to the usage conditions to continue.").should(
- "exist",
- );
+ embedModalEnableEmbeddingCard().should(
+ "contain.text",
+ "Agree to the usage conditions to continue.",
+ );
+ embedModalEnableEmbeddingCard().within(() => {
cy.findByText(cardText).should("not.exist");
});
cy.log("shows tooltip with fair usage info");
getEmbedSidebar().findByLabelText("info icon").trigger("mouseover");
- H.hovercard()
- .contains(
- /You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature/,
- )
- .should("be.visible");
+ H.hovercard().contains(tooltipText).should("be.visible");
});
it("hides the enable card when embedding is already enabled", () => {
diff --git a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.ts b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.ts
index 320e62a1005..0bbf78ec441 100644
--- a/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.ts
+++ b/e2e/test/scenarios/embedding/sdk-iframe-embedding-setup/embed-flow-enable-embed-js-oss-and-starter.cy.spec.ts
@@ -34,10 +34,20 @@ describe("scenarios > embedding > sdk iframe embed setup > enable embed js (oss
cy.findByText("New embed").click();
});
+ embedModalEnableEmbeddingCard().should(
+ "contain.text",
+ "To continue, enable guest embeds and agree to the usage conditions.",
+ );
+
embedModalEnableEmbeddingCard().within(() => {
- cy.findByText(
- "To continue, enable guest embeds and agree to the usage conditions.",
- ).should("exist");
+ cy.log("usage conditions should be a link");
+ cy.findByRole("link", { name: "usage conditions" })
+ .should(
+ "have.attr",
+ "href",
+ "https://metabase.com/license/embedding",
+ )
+ .should("have.attr", "target", "_blank");
});
cy.log("shows tooltip with fair usage info");
@@ -102,13 +112,21 @@ describe("scenarios > embedding > sdk iframe embed setup > enable embed js (oss
cy.findByText("New embed").click();
});
+ embedModalEnableEmbeddingCard()
+ .should("contain.text", "Agree to the")
+ .should("contain.text", "to continue.");
+
embedModalEnableEmbeddingCard().within(() => {
- cy.findByText("Agree to the usage conditions to continue.").should(
- "exist",
- );
+ cy.findByRole("link", { name: "usage conditions" })
+ .should(
+ "have.attr",
+ "href",
+ "https://metabase.com/license/embedding",
+ )
+ .should("have.attr", "target", "_blank");
cy.findByText(
- "To continue, enable guest embeds and agree to the usage conditions.",
+ /To continue, enable guest embeds and agree to the/,
).should("not.exist");
});
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddedAnalyticsCard.tsx b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddedAnalyticsCard.tsx
index a676f3c09f1..2d09d19d0e0 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddedAnalyticsCard.tsx
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddedAnalyticsCard.tsx
@@ -15,7 +15,7 @@ export const EnableEmbeddedAnalyticsCard = () => {
return (
<EnableEmbeddingCard
- embeddingType="modular embedding"
+ embeddingType="modular-embedding"
isEnabled={isSimpleEmbeddingEnabled}
termsAccepted={isSimpleEmbeddingTermsAccepted}
settingsToUpdate={{
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddingCard.tsx b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddingCard.tsx
index 8b53f311a09..94f352a75bb 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddingCard.tsx
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableEmbeddingCard.tsx
@@ -1,14 +1,22 @@
import { useRef, useState } from "react";
import { match } from "ts-pattern";
-import { t } from "ttag";
+import { jt, t } from "ttag";
import { useUpdateSettingsMutation } from "metabase/api";
import { useToast } from "metabase/common/hooks";
-import { Button, Group, HoverCard, Icon, Stack, Text } from "metabase/ui";
+import {
+ Anchor,
+ Button,
+ Group,
+ HoverCard,
+ Icon,
+ Stack,
+ Text,
+} from "metabase/ui";
import type { EnterpriseSettings } from "metabase-types/api";
interface EmbeddingControlCardProps {
- embeddingType: string;
+ embeddingType: "guest-embeds" | "modular-embedding";
isEnabled: boolean;
termsAccepted: boolean;
settingsToUpdate: Partial<EnterpriseSettings>;
@@ -45,6 +53,11 @@ export const EnableEmbeddingCard = ({
return null;
}
+ const embeddingTypeLocalized = match(embeddingType)
+ .with("guest-embeds", () => t`guest embeds`)
+ .with("modular-embedding", () => t`modular embedding`)
+ .exhaustive();
+
const data = match(initialDataRef.current)
.with(
{
@@ -52,7 +65,18 @@ export const EnableEmbeddingCard = ({
termsAccepted: false,
},
() => ({
- title: t`To continue, enable ${embeddingType} and agree to the usage conditions.`,
+ title:
+ embeddingType === "guest-embeds"
+ ? jt`To continue, enable guest embeds and agree to the ${(
+ <Anchor
+ key="usage-conditions"
+ href="https://metabase.com/license/embedding"
+ target="_blank"
+ >
+ {t`usage conditions`}
+ </Anchor>
+ )}.`
+ : t`To continue, enable ${embeddingTypeLocalized} and agree to the usage conditions.`,
buttonCaption: t`Agree and enable`,
}),
)
@@ -62,7 +86,18 @@ export const EnableEmbeddingCard = ({
termsAccepted: false,
},
() => ({
- title: t`Agree to the usage conditions to continue.`,
+ title:
+ embeddingType === "guest-embeds"
+ ? jt`Agree to the ${(
+ <Anchor
+ key="usage-conditions"
+ href="https://metabase.com/license/embedding"
+ target="_blank"
+ >
+ {t`usage conditions`}
+ </Anchor>
+ )} to continue.`
+ : t`Agree to the usage conditions to continue.`,
buttonCaption: t`Agree and continue`,
}),
)
@@ -72,7 +107,7 @@ export const EnableEmbeddingCard = ({
termsAccepted: true,
},
() => ({
- title: t`Enable ${embeddingType} to get started.`,
+ title: t`Enable ${embeddingTypeLocalized} to get started.`,
buttonCaption: t`Enable and continue`,
}),
)
@@ -103,18 +138,12 @@ export const EnableEmbeddingCard = ({
<HoverCard.Dropdown>
<Stack maw={340} p="md" gap="md">
- <Text fz="sm" lh="lg">
- {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- User facing text */}
- {t`When you embed charts or dashboards from Metabase in your
- own application that application isn't subject to the Affero
- General Public License that covers the rest of Metabase,
- provided you keep the Metabase logo and the "Powered by
- Metabase" visible on those embeds.`}
- </Text>
-
- <Text fz="sm" lh="lg">
- {t`You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature.`}
- </Text>
+ {match(embeddingType)
+ .with("guest-embeds", () => <GuestEmbedsTooltipContent />)
+ .with("modular-embedding", () => (
+ <ModularEmbeddingTooltipContent />
+ ))
+ .exhaustive()}
</Stack>
</HoverCard.Dropdown>
</HoverCard>
@@ -134,3 +163,39 @@ export const EnableEmbeddingCard = ({
</Stack>
);
};
+
+const GuestEmbedsTooltipContent = () => (
+ <>
+ <Text fz="sm" lh="lg">
+ {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- Only admins, at the moment, should see this */}
+ {t`When you embed charts or dashboards from Metabase in your
+ own application, that application isn't subject to the Affero
+ General Public License that covers the rest of Metabase,
+ provided you keep the Metabase logo and the "Powered by
+ Metabase" visible on those embeds.`}
+ </Text>
+
+ <Text fz="sm" lh="lg">
+ {t`You should, however, read the license text linked above as that is the actual license that you will be agreeing to by enabling this feature.`}
+ </Text>
+ </>
+);
+
+const ModularEmbeddingTooltipContent = () => (
+ <>
+ <Text fz="sm" lh="lg">
+ {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- Only admins, at the moment, should see this */}
+ {t`When using modular embedding, each end user must have their own Metabase account.`}
+ </Text>
+
+ <Text fz="sm" lh="lg">
+ {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- Only admins, at the moment, should see this */}
+ {t`Sharing Metabase accounts is a security risk. Even if you filter data on the client side, each user could use their token to view any data visible to that shared user account.`}
+ </Text>
+
+ <Text fz="sm" lh="lg">
+ {/* eslint-disable-next-line metabase/no-literal-metabase-strings -- Only admins, at the moment, should see this */}
+ {t`That, and we consider shared accounts to be unfair usage. Fair usage involves giving each end-user of the embedded analytics their own Metabase account.`}
+ </Text>
+ </>
+);
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableGuestEmbedsCard.tsx b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableGuestEmbedsCard.tsx
index a18986c4e2f..c9753ba45c4 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableGuestEmbedsCard.tsx
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/EnableGuestEmbedsCard.tsx
@@ -15,7 +15,7 @@ export const EnableGuestEmbedsCard = () => {
return (
<EnableEmbeddingCard
- embeddingType="guest embeds"
+ embeddingType="guest-embeds"
isEnabled={isGuestEmbedsEnabled}
termsAccepted={isGuestEmbedsTermsAccepted}
settingsToUpdate={{