diff --git a/packages/koenig-lexical/src/components/ui/cards/EmailCard.jsx b/packages/koenig-lexical/src/components/ui/cards/EmailCard.jsx index 24656617c3..8c91b334b6 100644 --- a/packages/koenig-lexical/src/components/ui/cards/EmailCard.jsx +++ b/packages/koenig-lexical/src/components/ui/cards/EmailCard.jsx @@ -1,34 +1,28 @@ -import HelpIcon from '../../../assets/icons/kg-help.svg?react'; import KoenigNestedEditor from '../../KoenigNestedEditor'; import PropTypes from 'prop-types'; import React from 'react'; import ReplacementStringsPlugin from '../../../plugins/ReplacementStringsPlugin'; +import {CardVisibilityMessage} from '../CardVisibilityMessage.jsx'; import {ReadOnlyOverlay} from '../ReadOnlyOverlay'; export function EmailCard({htmlEditor, htmlEditorInitialState, isEditing}) { return ( -
- - - + <> + +
+ + + - {isEditing && -
- Only visible when delivered by email, this card will not be published on your site. - - - -
- } - - {!isEditing && } -
+ {!isEditing && } +
+ ); } diff --git a/packages/koenig-lexical/src/components/ui/cards/EmailCtaCard.jsx b/packages/koenig-lexical/src/components/ui/cards/EmailCtaCard.jsx index 3c744f6106..14575c9b25 100644 --- a/packages/koenig-lexical/src/components/ui/cards/EmailCtaCard.jsx +++ b/packages/koenig-lexical/src/components/ui/cards/EmailCtaCard.jsx @@ -6,6 +6,7 @@ import React from 'react'; import ReplacementStringsPlugin from '../../../plugins/ReplacementStringsPlugin'; import {Button} from '../Button'; import {ButtonGroupSetting, DropdownSetting, InputSetting, InputUrlSetting, SettingsPanel, ToggleSetting} from '../SettingsPanel'; +import {CardVisibilityMessage} from '../CardVisibilityMessage.jsx'; import {ReadOnlyOverlay} from '../ReadOnlyOverlay'; export function EmailCtaCard({ @@ -48,18 +49,27 @@ export function EmailCtaCard({ name: 'status:-free' }]; - const segmentName = dropdownOptions.find(option => option.name === segment)?.label ?? ''; + const getVisibilityMessage = (segmentType) => { + switch (segmentType) { + case 'status:free': + return 'Hidden on website and paid newsletter'; + case 'status:-free': + return 'Hidden on website and free newsletter'; + default: + return ''; + } + }; + + const visibilityMessage = getVisibilityMessage(segment); return ( <>
{/* Segment */} -
- {segmentName} -
+ {/* Top divider */} - {showDividers &&
} + {showDividers &&
} {/* HTML content */} {emailVisibility && dropdownOptions && ( diff --git a/packages/koenig-lexical/test/e2e/cards/email-card.test.js b/packages/koenig-lexical/test/e2e/cards/email-card.test.js index 5c18aed92d..464aee0846 100644 --- a/packages/koenig-lexical/test/e2e/cards/email-card.test.js +++ b/packages/koenig-lexical/test/e2e/cards/email-card.test.js @@ -45,6 +45,7 @@ test.describe('Email card', async () => {
+
Hidden on website
@@ -70,6 +71,7 @@ test.describe('Email card', async () => {
+
Hidden on website
@@ -84,12 +86,6 @@ test.describe('Email card', async () => {
-
- Only visible when delivered by email, this card will not be published on your site. - - - -
@@ -198,6 +194,7 @@ test.describe('Email card', async () => {
+
Hidden on website
@@ -219,12 +216,6 @@ test.describe('Email card', async () => {
-
- Only visible when delivered by email, this card will not be published on your site. - - - -
@@ -239,6 +230,7 @@ test.describe('Email card', async () => {
+
Hidden on website
@@ -256,12 +248,6 @@ test.describe('Email card', async () => {
-
- Only visible when delivered by email, this card will not be published on your site. - - - -
diff --git a/packages/koenig-lexical/test/e2e/cards/email-cta-card.test.js b/packages/koenig-lexical/test/e2e/cards/email-cta-card.test.js index b69fee50a2..1b782d20ce 100644 --- a/packages/koenig-lexical/test/e2e/cards/email-cta-card.test.js +++ b/packages/koenig-lexical/test/e2e/cards/email-cta-card.test.js @@ -51,7 +51,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter
@@ -95,7 +95,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter

@@ -142,7 +142,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter
@@ -189,7 +189,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter
@@ -302,7 +302,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter

@@ -482,7 +482,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter

@@ -513,7 +513,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter

@@ -548,7 +548,7 @@ test.describe('Email card', async () => {
-
Free members
+
Hidden on website and paid newsletter