@capillarytech/creatives-library 8.0.276-alpha.0 → 8.0.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.276-alpha.0",
4
+ "version": "8.0.276",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -8,7 +8,6 @@ import messages from './messages';
8
8
  import ErrorInfoNote from '../../v2Components/ErrorInfoNote';
9
9
  import { PREVIEW } from './constants';
10
10
  import { EMAIL_CREATE_MODES } from '../EmailWrapper/constants';
11
- import { hasSupportCKEditor } from '../../utils/common';
12
11
 
13
12
  function getFullModeSaveBtn(slidBoxContent, isCreatingTemplate) {
14
13
  if (isCreatingTemplate) {
@@ -73,10 +72,8 @@ function SlideBoxFooter(props) {
73
72
  const isBEEEditor = selectedEmailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP
74
73
  || (emailCreateMode === EMAIL_CREATE_MODES.EDITOR && !isHTMLEditorMode)
75
74
  || (isEditMode && !isHtmlEditorValidationStateActive);
76
- const isSupportCKEditor = hasSupportCKEditor();
77
75
  // Only check validation for HTML Editor mode, not for BEE/DragDrop editor
78
- // In upload mode the legacy Email (CK) component does not report validation state, so do not disable buttons
79
- const shouldCheckValidation = isEmailChannel && htmlEditorValidationState && isHTMLEditorMode && !isBEEEditor && !isSupportCKEditor;
76
+ const shouldCheckValidation = isEmailChannel && htmlEditorValidationState && isHTMLEditorMode && !isBEEEditor;
80
77
  const isContentEmpty = shouldCheckValidation ? (htmlEditorValidationState?.isContentEmpty ?? true) : false;
81
78
  // Check if validation has completed
82
79
  const validationComplete = shouldCheckValidation ? (htmlEditorValidationState?.validationComplete ?? false) : true;
@@ -126,7 +123,7 @@ function SlideBoxFooter(props) {
126
123
  const isBEEEditorMode = isBEEEditorModeInEdit || isBEEEditorModeInCreate;
127
124
  const hasBEEEditorErrors = isEmailChannel && isBEEEditorMode && (hasStandardErrors || hasLiquidErrors) && (!htmlEditorValidationState || !htmlEditorHasErrors);
128
125
 
129
- const shouldShowErrorInfoNote = hasBEEEditorErrors || isSupportCKEditor;
126
+ const shouldShowErrorInfoNote = hasBEEEditorErrors;
130
127
  return (
131
128
  <div className="template-footer-width">
132
129
  {shouldShowErrorInfoNote && (
@@ -26,7 +26,7 @@ import * as globalActions from '../Cap/actions';
26
26
  import './_email.scss';
27
27
  import {getMessageObject} from '../../utils/messageUtils';
28
28
  import EmailPreview from '../../v2Components/EmailPreview';
29
- import { getDecodedFileName, hasLiquidSupportFeature, hasSupportCKEditor } from '../../utils/common';
29
+ import { getDecodedFileName ,hasLiquidSupportFeature} from '../../utils/common';
30
30
  import Pagination from '../../v2Components/Pagination';
31
31
  import * as creativesContainerActions from '../CreativesContainer/actions';
32
32
  import withCreatives from '../../hoc/withCreatives';
@@ -235,12 +235,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
235
235
  this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
236
236
  }
237
237
  }
238
- const hasUploadedContent = !this.props.params?.id && this.props.Templates?.selectedEmailLayout && !_.isEmpty(formData);
239
- this.setState({
240
- content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''),
241
- formData,
242
- ...(hasUploadedContent ? { loadingStatus: 2 } : {}),
243
- });
238
+ this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''), formData});
244
239
 
245
240
  // setTimeout(() => {
246
241
  // // this.getFormData();
@@ -291,12 +286,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
291
286
  }
292
287
  }
293
288
  }
294
-
295
- // When SUPPORT_CK_EDITOR: after zip/HTML upload we show with selectedEmailLayout. Ensure spinner stops
296
- // even if formData was empty on first mount (e.g. currentOrgDetails not yet available).
297
- if (!this.props.params?.id && this.props.Templates?.selectedEmailLayout) {
298
- this.setState((prev) => ({ loadingStatus: Math.max(prev.loadingStatus, 2) }));
299
- }
300
289
  }
301
290
 
302
291
 
@@ -324,10 +313,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
324
313
  // }
325
314
  const {isFullMode, isGetFormData} = nextProps;
326
315
  if (isFullMode && isGetFormData && !_.isEqual(isGetFormData, this.props.isGetFormData) && !this.state.isDragDrop) {
327
- // Only for CK editor: when Done is clicked in full mode, trigger the same chain as library
328
- // so that FormBuilder validation and saveFormData run reliably (getFormData -> saveValidationData -> startValidation).
316
+ //only for ck editor
317
+ //when create button is clicked in full mode
318
+ // Don't start validation if we're in Test & Preview mode
329
319
  if (!nextProps.isTestAndPreviewMode) {
330
- this.getFormData();
320
+ this.startValidation(true);
331
321
  }
332
322
  }
333
323
  if (this.state.languageDataSet && nextProps.Templates.selectedEmailLayout && nextProps.Templates.selectedEmailLayout !== '' && !_.isEqual(this.props.Templates.selectedEmailLayout, nextProps.Templates.selectedEmailLayout )) {
@@ -335,7 +325,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
335
325
  }
336
326
  if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
337
327
  const newSchema = this.injectEvents(nextProps.metaEntities.layouts[0].definition);
338
- this.applyTabOptionIconVisibility(newSchema);
339
328
 
340
329
  this.setState({schema: newSchema, loadingStatus: this.state.loadingStatus + 1});
341
330
  if (this.props.location.query.module !== 'library' || (this.props.location.query.module === 'library' && this.props.getDefaultTags)) {
@@ -1571,12 +1560,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1571
1560
  newFormData[0] = baseData;
1572
1561
  newFormData[0].base = true;
1573
1562
  }
1574
- // Don't clear selectedEmailLayout when we're in create mode with uploaded content -
1575
- // EmailWrapper uses it to keep isShowEmailCreate true. Clearing it would unmount Email and show wrong UI.
1576
- const isCreateWithUpload = !props.params?.id && props.Templates?.selectedEmailLayout;
1577
- if (!isCreateWithUpload) {
1578
- this.props.templatesActions.resetUploadData();
1579
- }
1563
+ this.props.templatesActions.resetUploadData();
1580
1564
  return newFormData;
1581
1565
  }
1582
1566
 
@@ -1768,16 +1752,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1768
1752
  newTabPopoverSection.cols[0].style.display = isDragDrop ? "" : "none";
1769
1753
  }
1770
1754
  });
1771
- // Hide tab-option-icon (switch editor trigger) when SUPPORT_CK_EDITOR is disabled
1772
- if (containerInputFieldCol.value && containerInputFieldCol.value.sections) {
1773
- _.forEach(containerInputFieldCol.value.sections[0].inputFields, (valueInputField) => {
1774
- _.forEach(valueInputField.cols, (valueCol) => {
1775
- if (valueCol.id === 'tab-option-icon') {
1776
- valueCol.colStyle = { ...valueCol.colStyle, display: hasSupportCKEditor() ? 'flex' : 'none' };
1777
- }
1778
- });
1779
- });
1780
- }
1781
1755
  }
1782
1756
  });
1783
1757
  }
@@ -1786,28 +1760,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1786
1760
  this.setState({schema, isSchemaChanged: true});
1787
1761
  }
1788
1762
 
1789
- /**
1790
- * Hides the tab-option-icon (switch editor trigger) in schema when SUPPORT_CK_EDITOR is disabled,
1791
- * so users cannot switch editor if the feature is not enabled.
1792
- */
1793
- applyTabOptionIconVisibility = (schema) => {
1794
- if (!schema || !schema.containers) return;
1795
- _.forEach(schema.containers, (container) => {
1796
- if (!container.isActive || !container.tabBarExtraContent?.sections?.[0]?.inputFields?.[0]?.cols) return;
1797
- _.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (col) => {
1798
- if (col.id === 'tab-options-popover' && col.value?.sections?.[0]?.inputFields) {
1799
- _.forEach(col.value.sections[0].inputFields, (inputField) => {
1800
- _.forEach(inputField.cols, (c) => {
1801
- if (c.id === 'tab-option-icon') {
1802
- c.colStyle = { ...(c.colStyle || {}), display: hasSupportCKEditor() ? 'flex' : 'none' };
1803
- }
1804
- });
1805
- });
1806
- }
1807
- });
1808
- });
1809
- };
1810
-
1811
1763
  showInsertImageButton = (passedSchema) => {
1812
1764
  const schema = passedSchema || _.cloneDeep(this.state.schema);
1813
1765
  _.forEach(schema.containers, (container) => {
@@ -2917,25 +2869,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2917
2869
  if (!isLoading) {
2918
2870
  isLoading = this.state.loadingStatus < 2;
2919
2871
  }
2920
-
2921
- // When SUPPORT_CK_EDITOR: after zip/HTML upload we show Email component with selectedEmailLayout.
2922
- // Don't show spinner once we have uploaded content in formData (create mode, no params.id).
2923
- if (isLoading && !this.props.params?.id && this.props.Templates?.selectedEmailLayout) {
2924
- const content = this.state.formData?.[0]?.['template-content']
2925
- || _.get(this.state.formData, 'base.template-content')
2926
- || (this.state.formData?.base && this.state.formData.base[this.state.formData.base?.activeTab]?.['template-content']);
2927
- if (content) {
2928
- isLoading = false;
2929
- }
2930
- if (typeof window !== 'undefined' && this.state.loadingStatus < 2) {
2931
- console.log('[UPLOAD-DEBUG] Email isEmailLoading (upload path)', {
2932
- loadingStatus: this.state.loadingStatus,
2933
- hasContentInFormData: !!content,
2934
- isLoadingResult: isLoading,
2935
- hasSelectedEmailLayout: !!this.props.Templates?.selectedEmailLayout,
2936
- });
2937
- }
2938
- }
2939
2872
  // if (isLoading) {
2940
2873
  // this.props.creativesContainerActions.hideCreativesContanerLoader();
2941
2874
  // }
@@ -198,13 +198,12 @@ const EmailWrapperView = ({
198
198
  const isEditModeForEditor = hasParamsIdForEditor;
199
199
  const isBEEFromProps = emailProps?.editor === 'BEE' && emailProps?.selectedEditorMode === null;
200
200
  const isDragDropFromCreateMode = emailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP;
201
- const isExplicitlyBEEEditor = isBEEFromProps || isDragDropFromCreateMode || (emailProps?.editor === "BEE" && !isFullMode);
201
+ const isExplicitlyBEEEditor = isBEEFromProps || isDragDropFromCreateMode;
202
202
  let isHTMLEditorMode = false;
203
203
 
204
204
  if (supportCKEditor) {
205
- // UPLOAD mode should use Email component (CKEditor), NOT HTML editor
206
- // This ensures consistency between create and edit flows when SUPPORT_CK_EDITOR is enabled
207
- isHTMLEditorMode = false; // Always use Email component (CKEditor) in legacy flow
205
+ // Legacy flow: use HTML editor for UPLOAD so zip/HTML content (EmailLayout) is shown; use Email component for EDITOR
206
+ isHTMLEditorMode = emailCreateMode === EMAIL_CREATE_MODES.UPLOAD;
208
207
  } else if (isEditModeForEditor) {
209
208
  isHTMLEditorMode = !isExplicitlyBEEEditor;
210
209
  } else {
@@ -1897,117 +1897,6 @@ describe('EmailHTMLEditor', () => {
1897
1897
  });
1898
1898
  });
1899
1899
 
1900
- describe('Template content extraction (lines 291-309)', () => {
1901
- it('extracts content and subject from templateDataProp.base branch', async () => {
1902
- const ref = React.createRef();
1903
- const templateData = {
1904
- base: {
1905
- 'template-content': '<p>Base branch content</p>',
1906
- "subject": 'Base branch subject',
1907
- },
1908
- };
1909
- render(
1910
- <IntlProvider locale="en" messages={{}}>
1911
- <EmailHTMLEditor
1912
- {...defaultProps}
1913
- ref={ref}
1914
- params={{ id: '123' }}
1915
- templateData={templateData}
1916
- Email={{
1917
- templateDetails: { _id: '123' },
1918
- getTemplateDetailsInProgress: false,
1919
- fetchingCmsData: false,
1920
- }}
1921
- />
1922
- </IntlProvider>
1923
- );
1924
- await waitFor(() => {
1925
- expect(ref.current).toBeTruthy();
1926
- }, { timeout: 3000 });
1927
- await waitFor(() => {
1928
- const content = ref.current.getContentForPreview();
1929
- const formData = ref.current.getFormDataForPreview();
1930
- expect(content).toBe('<p>Base branch content</p>');
1931
- expect(formData['template-subject']).toBe('Base branch subject');
1932
- }, { timeout: 3000 });
1933
- });
1934
-
1935
- it('extracts content and subject from templateDataProp.versions.base branch with activeTab', async () => {
1936
- const ref = React.createRef();
1937
- const templateData = {
1938
- versions: {
1939
- base: {
1940
- activeTab: 'en',
1941
- en: {
1942
- 'template-content': '<p>Versions base en content</p>',
1943
- "html_content": '<p>fallback html_content</p>',
1944
- },
1945
- subject: 'Versions base subject',
1946
- emailSubject: 'Fallback email subject',
1947
- },
1948
- },
1949
- };
1950
- render(
1951
- <IntlProvider locale="en" messages={{}}>
1952
- <EmailHTMLEditor
1953
- {...defaultProps}
1954
- ref={ref}
1955
- params={{ id: '123' }}
1956
- templateData={templateData}
1957
- Email={{
1958
- templateDetails: { _id: '123' },
1959
- getTemplateDetailsInProgress: false,
1960
- fetchingCmsData: false,
1961
- }}
1962
- />
1963
- </IntlProvider>
1964
- );
1965
- await waitFor(() => {
1966
- expect(ref.current).toBeTruthy();
1967
- }, { timeout: 3000 });
1968
- await waitFor(() => {
1969
- const content = ref.current.getContentForPreview();
1970
- const formData = ref.current.getFormDataForPreview();
1971
- expect(content).toBe('<p>Versions base en content</p>');
1972
- expect(formData['template-subject']).toBe('Versions base subject');
1973
- }, { timeout: 3000 });
1974
- });
1975
-
1976
- it('extracts content and subject from flat templateDataProp (else branch)', async () => {
1977
- const ref = React.createRef();
1978
- const templateData = {
1979
- 'template-content': '<p>Flat content</p>',
1980
- "emailSubject": 'Flat email subject',
1981
- "html_content": '<p>flat html_content</p>',
1982
- "subject": 'Flat subject',
1983
- };
1984
- render(
1985
- <IntlProvider locale="en" messages={{}}>
1986
- <EmailHTMLEditor
1987
- {...defaultProps}
1988
- ref={ref}
1989
- params={{ id: '123' }}
1990
- templateData={templateData}
1991
- Email={{
1992
- templateDetails: { _id: '123' },
1993
- getTemplateDetailsInProgress: false,
1994
- fetchingCmsData: false,
1995
- }}
1996
- />
1997
- </IntlProvider>
1998
- );
1999
- await waitFor(() => {
2000
- expect(ref.current).toBeTruthy();
2001
- }, { timeout: 3000 });
2002
- await waitFor(() => {
2003
- const content = ref.current.getContentForPreview();
2004
- const formData = ref.current.getFormDataForPreview();
2005
- expect(content).toBe('<p>Flat content</p>');
2006
- expect(formData['template-subject']).toBe('Flat email subject');
2007
- }, { timeout: 3000 });
2008
- });
2009
- });
2010
-
2011
1900
  describe('setIsLoadingContent callback', () => {
2012
1901
  it('should call setIsLoadingContent when uploaded content is available', async () => {
2013
1902
  const setIsLoadingContent = jest.fn();
@@ -2044,37 +1933,6 @@ describe('EmailHTMLEditor', () => {
2044
1933
  });
2045
1934
  });
2046
1935
 
2047
- describe('location.query and tagList (lines 127, 129, 185)', () => {
2048
- it('should handle missing location.query (destructure from empty object)', () => {
2049
- renderWithIntl({
2050
- location: {},
2051
- supportedTags: [],
2052
- metaEntities: { tags: { standard: [{ name: 'standard.tag' }] } },
2053
- });
2054
- expect(screen.getByTestId('html-editor')).toBeInTheDocument();
2055
- });
2056
-
2057
- it('should handle null location (query defaults to {})', () => {
2058
- renderWithIntl({
2059
- location: null,
2060
- supportedTags: [],
2061
- metaEntities: { tags: { standard: [] } },
2062
- });
2063
- expect(screen.getByTestId('html-editor')).toBeInTheDocument();
2064
- });
2065
-
2066
- it('should use tagList from supportedTags when type=embedded, module=library and no getDefaultTags (line 129)', () => {
2067
- const supportedTags = [{ name: 'custom.a' }, { name: 'custom.b' }];
2068
- renderWithIntl({
2069
- location: { query: { type: 'embedded', module: 'library' } },
2070
- getDefaultTags: null,
2071
- supportedTags,
2072
- metaEntities: { tags: { standard: [{ name: 'standard.only' }] } },
2073
- });
2074
- expect(screen.getByTestId('html-editor')).toBeInTheDocument();
2075
- });
2076
- });
2077
-
2078
1936
  describe('tags useMemo (lines 125-132)', () => {
2079
1937
  it('should use supportedTags when in EMBEDDED mode with LIBRARY module and no getDefaultTags', () => {
2080
1938
  const supportedTags = [{ name: 'custom.tag1' }, { name: 'custom.tag2' }];
@@ -2192,7 +2050,7 @@ describe('EmailHTMLEditor', () => {
2192
2050
  expect(formData).toBeDefined();
2193
2051
  expect(formData['0']).toBeDefined();
2194
2052
  expect(formData['0'].fr).toBeDefined(); // Uses base_language 'fr'
2195
- expect(formData['0'].fr.is_drag_drop).toBe(false);
2053
+ expect(formData['0'].fr['is_drag_drop']).toBe(false);
2196
2054
  expect(formData['0'].activeTab).toBe('fr');
2197
2055
  expect(formData['0'].selectedLanguages).toEqual(['fr']);
2198
2056
  expect(formData['0'].base).toBe(true);
@@ -517,141 +517,4 @@ describe('EmailWrapperView', () => {
517
517
  // Should handle gracefully if ref methods don't exist
518
518
  });
519
519
  });
520
-
521
- describe('Issue 1: Beefree template should open in Beefree editor in Edit mode', () => {
522
- beforeEach(() => {
523
- const { hasSupportCKEditor } = require('../../../../utils/common');
524
- hasSupportCKEditor.mockReturnValue(false); // New flow
525
- });
526
-
527
- it('should render Email component (not HTML editor) when editing Beefree template', () => {
528
- const emailPropsWithBEE = {
529
- ...defaultProps.emailProps,
530
- editor: 'BEE',
531
- selectedEditorMode: null,
532
- };
533
-
534
- renderWithIntl({
535
- step: STEPS.CREATE_TEMPLATE_CONTENT,
536
- isShowEmailCreate: true,
537
- emailProps: emailPropsWithBEE,
538
- emailCreateMode: EMAIL_CREATE_MODES.DRAG_DROP,
539
- params: { id: 'beefree-template-1' },
540
- location: { query: {}, pathname: '/email/edit/beefree-template-1' },
541
- });
542
-
543
- // Should render Email component (BEE editor), not HTML editor
544
- expect(screen.queryByTestId('email-html-editor')).not.toBeInTheDocument();
545
- // Email component would be rendered (we're using EmailWithoutSaga which doesn't have a testid)
546
- });
547
-
548
- it('should render HTML editor when editing non-Beefree template', () => {
549
- const emailPropsWithHTML = {
550
- ...defaultProps.emailProps,
551
- editor: 'HTML',
552
- selectedEditorMode: EMAIL_CREATE_MODES.HTML_EDITOR,
553
- };
554
-
555
- renderWithIntl({
556
- step: STEPS.CREATE_TEMPLATE_CONTENT,
557
- isShowEmailCreate: true,
558
- emailProps: emailPropsWithHTML,
559
- emailCreateMode: EMAIL_CREATE_MODES.HTML_EDITOR,
560
- params: { id: 'html-template-1' },
561
- location: { query: {}, pathname: '/email/edit/html-template-1' },
562
- });
563
-
564
- // Should render HTML editor for non-Beefree template
565
- expect(screen.getByTestId('email-html-editor')).toBeInTheDocument();
566
- });
567
-
568
- it('should render Email component when emailCreateMode is DRAG_DROP in create mode', () => {
569
- const emailPropsWithBEE = {
570
- ...defaultProps.emailProps,
571
- editor: 'BEE',
572
- selectedEditorMode: null,
573
- };
574
-
575
- renderWithIntl({
576
- step: STEPS.CREATE_TEMPLATE_CONTENT,
577
- isShowEmailCreate: true,
578
- emailProps: emailPropsWithBEE,
579
- emailCreateMode: EMAIL_CREATE_MODES.DRAG_DROP,
580
- params: {},
581
- location: { query: {}, pathname: '/email/create' },
582
- });
583
-
584
- // Should render Email component (BEE editor), not HTML editor
585
- expect(screen.queryByTestId('email-html-editor')).not.toBeInTheDocument();
586
- });
587
- });
588
-
589
- describe('Issue 2: Upload Zip should open in CKEditor when SUPPORT_CK_EDITOR is enabled', () => {
590
- beforeEach(() => {
591
- const { hasSupportCKEditor } = require('../../../../utils/common');
592
- hasSupportCKEditor.mockReturnValue(true); // Legacy flow
593
- });
594
-
595
- it('should render Email component (CKEditor) for UPLOAD mode in create flow', () => {
596
- const emailPropsForCKEditor = {
597
- ...defaultProps.emailProps,
598
- editor: undefined, // Default CKEditor
599
- selectedEditorMode: null,
600
- };
601
-
602
- renderWithIntl({
603
- step: STEPS.CREATE_TEMPLATE_CONTENT,
604
- isShowEmailCreate: true,
605
- emailProps: emailPropsForCKEditor,
606
- emailCreateMode: EMAIL_CREATE_MODES.UPLOAD,
607
- EmailLayout: { html: '<p>Uploaded content</p>' },
608
- params: {},
609
- location: { query: {}, pathname: '/email/create' },
610
- });
611
-
612
- // Should render Email component (CKEditor), NOT HTML editor
613
- expect(screen.queryByTestId('email-html-editor')).not.toBeInTheDocument();
614
- });
615
-
616
- it('should render Email component (CKEditor) for UPLOAD mode in edit flow', () => {
617
- const emailPropsForCKEditor = {
618
- ...defaultProps.emailProps,
619
- editor: undefined,
620
- selectedEditorMode: null,
621
- };
622
-
623
- renderWithIntl({
624
- step: STEPS.CREATE_TEMPLATE_CONTENT,
625
- isShowEmailCreate: true,
626
- emailProps: emailPropsForCKEditor,
627
- emailCreateMode: EMAIL_CREATE_MODES.UPLOAD,
628
- EmailLayout: { html: '<p>Edited uploaded content</p>' },
629
- params: { id: 'uploaded-template-1' },
630
- location: { query: {}, pathname: '/email/edit/uploaded-template-1' },
631
- });
632
-
633
- // Should render Email component (CKEditor), NOT HTML editor
634
- expect(screen.queryByTestId('email-html-editor')).not.toBeInTheDocument();
635
- });
636
-
637
- it('should NOT render HTML editor for EDITOR mode when SUPPORT_CK_EDITOR is enabled', () => {
638
- const emailPropsForCKEditor = {
639
- ...defaultProps.emailProps,
640
- editor: undefined,
641
- selectedEditorMode: null,
642
- };
643
-
644
- renderWithIntl({
645
- step: STEPS.CREATE_TEMPLATE_CONTENT,
646
- isShowEmailCreate: true,
647
- emailProps: emailPropsForCKEditor,
648
- emailCreateMode: EMAIL_CREATE_MODES.EDITOR,
649
- params: {},
650
- location: { query: {}, pathname: '/email/create' },
651
- });
652
-
653
- // Should render Email component (CKEditor), NOT HTML editor
654
- expect(screen.queryByTestId('email-html-editor')).not.toBeInTheDocument();
655
- });
656
- });
657
520
  });
@@ -643,7 +643,7 @@ const useEmailWrapper = ({
643
643
  // If template was created in BEE AND BEE is enabled → open in BEE editor
644
644
  // Otherwise → open in HTML editor (fallback)
645
645
  // IMPORTANT: When supportCKEditor is false, default to HTML editor unless explicitly BEE
646
- if ((isDragDrop && isBeeEnabled) || (!isFullMode && isBeeEnabled)) {
646
+ if (isDragDrop && isBeeEnabled) {
647
647
  editorType = 'BEE';
648
648
  selectedEditorMode = null; // BEE uses existing flow
649
649
  } else {
@@ -732,7 +732,8 @@ describe('useEmailWrapper', () => {
732
732
 
733
733
  await waitFor(() => {
734
734
  const emailProps = result.current.emailProps;
735
- expect(emailProps.editor).toBe('BEE');
735
+ expect(emailProps.editor).toBe('HTML');
736
+ expect(emailProps.selectedEditorMode).toBe(EMAIL_CREATE_MODES.HTML_EDITOR);
736
737
  });
737
738
  });
738
739
 
@@ -761,7 +762,8 @@ describe('useEmailWrapper', () => {
761
762
 
762
763
  await waitFor(() => {
763
764
  const emailProps = result.current.emailProps;
764
- expect(emailProps.editor).toBe('BEE');
765
+ expect(emailProps.editor).toBe('HTML');
766
+ expect(emailProps.selectedEditorMode).toBe(EMAIL_CREATE_MODES.HTML_EDITOR);
765
767
  });
766
768
  });
767
769
  });
@@ -73,7 +73,7 @@ export const Advertisement = (props) => {
73
73
  const FbAdFooter = styled.div`
74
74
  background-color: ${CAP_WHITE};
75
75
  position: fixed;
76
- bottom: 0;
76
+ bottom: 20px;
77
77
  width: 100%;
78
78
  margin-left: -32px;
79
79
  padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
@@ -40,7 +40,6 @@
40
40
  .create-msg,
41
41
  .cancel-msg {
42
42
  position: fixed;
43
- bottom: 20px;
44
43
  }
45
44
  .cancel-msg {
46
45
  margin-left: 100px;
@@ -38,7 +38,7 @@ export default css`
38
38
  .action-section {
39
39
  background-color: ${CAP_WHITE};
40
40
  position: fixed;
41
- bottom: 0;
41
+ bottom: 20px;
42
42
  width: 100%;
43
43
  margin-left: -32px;
44
44
  padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
@@ -167,7 +167,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
167
167
  };
168
168
  this.props.actions.getMobilepushTemplatesList('mobilepush', params);
169
169
  }
170
- if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.fullSchema) && _.isEmpty(this.state.formData)) {
170
+ if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.fullSchema)) {
171
171
  this.setState({fullSchema: nextProps.metaEntities.layouts[0].definition, schema: (nextProps.location.query.module === 'loyalty') ? nextProps.metaEntities.layouts[0].definition.textSchema : {}}, () => {
172
172
  this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
173
173
  const templateId = get(this, "props.params.id");
@@ -388,11 +388,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
388
388
  }
389
389
  });
390
390
  } else {
391
- selectedAccount = accounts?.length > 0 ? accounts[0] : {};
391
+ selectedAccount = accounts[0];
392
392
  formData['mobilepush-accounts'] = selectedAccount?.id;
393
393
  }
394
394
  this.props.actions.setWeChatAccount(selectedAccount);
395
- this.setState({formData, accountsOptions: accounts?.length > 0 ? accounts.map((acc) => ({key: acc.id, label: acc.name, value: acc.id})) : []});
395
+ this.setState({formData, accountsOptions: accounts.map((acc) => ({key: acc.id, label: acc.name, value: acc.id}))});
396
396
  };
397
397
 
398
398
  createDefinition = (account) => ({
@@ -2023,8 +2023,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
2023
2023
  <CapSpin spinning={spinning}>
2024
2024
  <CapRow>
2025
2025
  <CapColumn>
2026
- <FormBuilder
2027
- key={!_.isEmpty(schema) ? 'has-schema' : 'no-schema'}
2026
+ {!this.props.isLoadingMetaEntities && <FormBuilder
2028
2027
  channel={MOBILE_PUSH}
2029
2028
  schema={schema}
2030
2029
  showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
@@ -2059,7 +2058,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
2059
2058
  hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
2060
2059
  isFullMode={this.props.isFullMode}
2061
2060
  eventContextTags={this.props?.eventContextTags}
2062
- />
2061
+ />}
2063
2062
  </CapColumn>
2064
2063
  {this.props.iosCtasData && this.state.showIosCtaTable &&
2065
2064
  <CapSlideBox
@@ -98,5 +98,5 @@
98
98
  }
99
99
 
100
100
  .create-dlt-msg {
101
- margin-left: 170px;
101
+ margin-left: 120px;
102
102
  }
@@ -106,6 +106,7 @@ export const SmsTraiEdit = (props) => {
106
106
  padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
107
107
  position: fixed;
108
108
  bottom: 2rem;
109
+ margin-left: -2rem;
109
110
  .ant-btn {
110
111
  margin-right: ${CAP_SPACE_16};
111
112
  }
@@ -687,24 +688,17 @@ export const SmsTraiEdit = (props) => {
687
688
  <CapButton
688
689
  onClick={handleTestAndPreview}
689
690
  type="secondary"
690
- className="create-msg"
691
+ className="create-msg create-dlt-msg"
691
692
  >
692
693
  <FormattedMessage {...messages.testAndPreviewButtonLabel} />
693
694
  </CapButton>
694
695
  <CapButton
695
696
  onClick={isLiquidSupportFeatureEnabled ? onSubmitWrapper : onDoneCallback}
696
- className="create-msg create-dlt-msg"
697
+ className="create-msg"
697
698
  disabled={isTagValidationError || (isLiquidSupportFeatureEnabled && !isObject(metaEntities?.tagLookupMap))}
698
699
  >
699
700
  <FormattedMessage {...messages.saveButtonLabel} />
700
701
  </CapButton>
701
- <CapButton
702
- onClick={handleClose}
703
- className="cancel-dlt-msg"
704
- type="secondary"
705
- >
706
- <FormattedMessage {...messages.cancelButtonLabel} />
707
- </CapButton>
708
702
  </SMSTraiFooter>
709
703
  <TestAndPreviewSlidebox
710
704
  show={showTestAndPreviewSlidebox}