@capillarytech/creatives-library 8.0.275 → 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 +1 -1
- package/v2Containers/Email/index.js +1 -34
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +1 -143
- package/v2Containers/Facebook/Advertisement/index.js +1 -1
- package/v2Containers/Line/Container/_lineCreate.scss +0 -1
- package/v2Containers/Line/Container/style.js +1 -1
- package/v2Containers/SmsTrai/Create/index.scss +1 -1
- package/v2Containers/SmsTrai/Edit/index.js +3 -9
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +86 -11682
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +0 -5
- package/v2Containers/Viber/index.js +0 -7
- package/v2Containers/Viber/index.scss +1 -4
- package/v2Containers/Viber/style.js +2 -0
- package/utils/tests/imageUrlUpload.test.js +0 -298
package/package.json
CHANGED
|
@@ -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,
|
|
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';
|
|
@@ -325,7 +325,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
325
325
|
}
|
|
326
326
|
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
|
|
327
327
|
const newSchema = this.injectEvents(nextProps.metaEntities.layouts[0].definition);
|
|
328
|
-
this.applyTabOptionIconVisibility(newSchema);
|
|
329
328
|
|
|
330
329
|
this.setState({schema: newSchema, loadingStatus: this.state.loadingStatus + 1});
|
|
331
330
|
if (this.props.location.query.module !== 'library' || (this.props.location.query.module === 'library' && this.props.getDefaultTags)) {
|
|
@@ -1753,16 +1752,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1753
1752
|
newTabPopoverSection.cols[0].style.display = isDragDrop ? "" : "none";
|
|
1754
1753
|
}
|
|
1755
1754
|
});
|
|
1756
|
-
// Hide tab-option-icon (switch editor trigger) when SUPPORT_CK_EDITOR is disabled
|
|
1757
|
-
if (containerInputFieldCol.value && containerInputFieldCol.value.sections) {
|
|
1758
|
-
_.forEach(containerInputFieldCol.value.sections[0].inputFields, (valueInputField) => {
|
|
1759
|
-
_.forEach(valueInputField.cols, (valueCol) => {
|
|
1760
|
-
if (valueCol.id === 'tab-option-icon') {
|
|
1761
|
-
valueCol.colStyle = { ...valueCol.colStyle, display: hasSupportCKEditor() ? 'flex' : 'none' };
|
|
1762
|
-
}
|
|
1763
|
-
});
|
|
1764
|
-
});
|
|
1765
|
-
}
|
|
1766
1755
|
}
|
|
1767
1756
|
});
|
|
1768
1757
|
}
|
|
@@ -1771,28 +1760,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1771
1760
|
this.setState({schema, isSchemaChanged: true});
|
|
1772
1761
|
}
|
|
1773
1762
|
|
|
1774
|
-
/**
|
|
1775
|
-
* Hides the tab-option-icon (switch editor trigger) in schema when SUPPORT_CK_EDITOR is disabled,
|
|
1776
|
-
* so users cannot switch editor if the feature is not enabled.
|
|
1777
|
-
*/
|
|
1778
|
-
applyTabOptionIconVisibility = (schema) => {
|
|
1779
|
-
if (!schema || !schema.containers) return;
|
|
1780
|
-
_.forEach(schema.containers, (container) => {
|
|
1781
|
-
if (!container.isActive || !container.tabBarExtraContent?.sections?.[0]?.inputFields?.[0]?.cols) return;
|
|
1782
|
-
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (col) => {
|
|
1783
|
-
if (col.id === 'tab-options-popover' && col.value?.sections?.[0]?.inputFields) {
|
|
1784
|
-
_.forEach(col.value.sections[0].inputFields, (inputField) => {
|
|
1785
|
-
_.forEach(inputField.cols, (c) => {
|
|
1786
|
-
if (c.id === 'tab-option-icon') {
|
|
1787
|
-
c.colStyle = { ...(c.colStyle || {}), display: hasSupportCKEditor() ? 'flex' : 'none' };
|
|
1788
|
-
}
|
|
1789
|
-
});
|
|
1790
|
-
});
|
|
1791
|
-
}
|
|
1792
|
-
});
|
|
1793
|
-
});
|
|
1794
|
-
};
|
|
1795
|
-
|
|
1796
1763
|
showInsertImageButton = (passedSchema) => {
|
|
1797
1764
|
const schema = passedSchema || _.cloneDeep(this.state.schema);
|
|
1798
1765
|
_.forEach(schema.containers, (container) => {
|
|
@@ -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
|
|
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);
|
|
@@ -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
|
|
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}
|