@capillarytech/creatives-library 7.13.17 → 7.13.19
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,15 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capillarytech/creatives-library",
|
|
3
3
|
"author": "meharaj",
|
|
4
|
-
"
|
|
5
|
-
"*.css",
|
|
6
|
-
"*.scss",
|
|
7
|
-
"*/styles/",
|
|
8
|
-
"*global-styles*",
|
|
9
|
-
"*font*",
|
|
10
|
-
"*moment/locale*"
|
|
11
|
-
],
|
|
12
|
-
"version": "7.13.17",
|
|
4
|
+
"version": "7.13.19",
|
|
13
5
|
"description": "Capillary creatives ui",
|
|
14
6
|
"main": "./index.js",
|
|
15
7
|
"module": "./index.es.js",
|
|
@@ -22,4 +22,4 @@ export const RCS = "RCS";
|
|
|
22
22
|
export const SHOW_CONTANER_LOADER = "app/CreativesContainer/SHOW_CONTANER_LOADER";
|
|
23
23
|
export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOADER";
|
|
24
24
|
|
|
25
|
-
export const WHATSAPP_HELP_DOC_LINK = "https://
|
|
25
|
+
export const WHATSAPP_HELP_DOC_LINK = "https://docs.capillarytech.com/docs/create-whatsapp-template";
|
|
@@ -324,7 +324,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
324
324
|
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData && _.isEmpty(_.get(this, `state.formData['template-subject']`))) {
|
|
325
325
|
this.startTemplateCreation(nextProps.templateData);
|
|
326
326
|
}
|
|
327
|
-
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData && (this.props.isGetFormData!==nextProps.isGetFormData)) {
|
|
327
|
+
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData && (this.props.isGetFormData !== nextProps.isGetFormData)) {
|
|
328
328
|
const formData = this.state.formData;
|
|
329
329
|
let isBeeEditor = false;
|
|
330
330
|
const isBEEEnable = this.checkBeeEditorAllowedForLibrary();
|
|
@@ -681,9 +681,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
681
681
|
channel: EMAIL,
|
|
682
682
|
timeTaken,
|
|
683
683
|
content: base?.[activeTab]?.['template-content'],
|
|
684
|
-
mode: isEdit ? EDIT : CREATE
|
|
684
|
+
mode: isEdit ? EDIT : CREATE,
|
|
685
685
|
});
|
|
686
|
-
|
|
686
|
+
|
|
687
687
|
// this.resetSchema();
|
|
688
688
|
let message;
|
|
689
689
|
if (isEdit) {
|
|
@@ -872,46 +872,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
872
872
|
} else {
|
|
873
873
|
schema.containers[index].isActive = false;
|
|
874
874
|
}
|
|
875
|
-
// const isLanguageSupport = this.props.location.query.isLanguageSupport;
|
|
876
|
-
|
|
877
|
-
_.forEach(data.selectedLanguages, (lang, langIndex) => {
|
|
878
|
-
if ((type !== 'embedded' || (type === 'embedded' && isLanguageSupport === 'true')) && lang !== this.props.currentOrgDetails.basic_details.base_language) {
|
|
879
|
-
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
880
|
-
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
881
|
-
const panes = containers[0].panes.slice();
|
|
882
|
-
const firstPane = _.cloneDeep(panes[0]);
|
|
883
|
-
const sections = [];
|
|
884
|
-
_.forEach(firstPane.sections, (section) => {
|
|
885
|
-
let sect = _.cloneDeep(section);
|
|
886
|
-
|
|
887
|
-
if (sect.type === 'col-label') {
|
|
888
|
-
sect = this.cloneColLabel(sect, (langIndex + 1));
|
|
889
|
-
} else if (sect.type === 'multicols') {
|
|
890
|
-
sect = this.cloneMultiCol(sect, (langIndex + 1));
|
|
891
|
-
} else if (sect.type === 'parent') {
|
|
892
|
-
sect = this.cloneParent(sect, (langIndex + 1));
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
sections.push(sect);
|
|
896
|
-
return true;
|
|
897
|
-
});
|
|
898
|
-
//
|
|
899
|
-
|
|
900
|
-
this.map[`template-content${data.selectedLanguages.indexOf(lang) + 1}`] = this.map['template-content'];
|
|
901
|
-
tabContentSection.id = `${tabContentSection.id}${index + 1}`;
|
|
902
|
-
tabContentSection.value = `${data[lang].language}`;
|
|
903
|
-
|
|
904
|
-
firstPane.sections = sections;
|
|
905
|
-
firstPane.sectionsHeaders = [tabContent];
|
|
906
|
-
|
|
907
|
-
// panes.push(firstPane);
|
|
908
|
-
|
|
909
|
-
schema.containers[index].panes.push(firstPane);
|
|
910
|
-
} else if (lang !== this.props.currentOrgDetails.basic_details.base_language) {
|
|
911
|
-
delete data[lang];
|
|
912
|
-
data.selectedLanguages.splice(langIndex, 1);
|
|
913
|
-
}
|
|
914
|
-
});
|
|
915
875
|
}
|
|
916
876
|
if (data.base) {
|
|
917
877
|
formData.base = data;
|
|
@@ -2373,7 +2333,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2373
2333
|
const response = {
|
|
2374
2334
|
action: "getFormData",
|
|
2375
2335
|
postAction: this.state.getFormDataValue || 'next',
|
|
2376
|
-
id
|
|
2336
|
+
id: _.get(this.props, 'Email.templateDetails._id', ''),
|
|
2377
2337
|
value: this.transformFormData(passedData),
|
|
2378
2338
|
validity: this.state.isFormValid,
|
|
2379
2339
|
type: 'EMAIL',
|
|
@@ -2407,9 +2367,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2407
2367
|
const newdata = data;
|
|
2408
2368
|
|
|
2409
2369
|
if (!isNaN(index) && newdata) {
|
|
2410
|
-
|
|
2370
|
+
// as baseLanguage & created template language are not same than it will pick from template language
|
|
2371
|
+
const baseLangTabKey = newdata[baseLanguage]?.tabKey || newdata.tabKey;
|
|
2411
2372
|
newdata.tabKey = baseLangTabKey;
|
|
2412
|
-
newdata.activeTab = baseLanguage;
|
|
2413
2373
|
if (newdata.base) {
|
|
2414
2374
|
baseKey = baseLangTabKey;
|
|
2415
2375
|
}
|
|
@@ -2431,7 +2391,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2431
2391
|
obj.versions.base = formData.base;
|
|
2432
2392
|
obj.versions.base.tabKey = baseKey;
|
|
2433
2393
|
obj.versions.base.subject = formData['template-subject'];
|
|
2434
|
-
obj.versions.base.activeTab = baseLanguage;
|
|
2394
|
+
obj.versions.base.activeTab = formData?.base?.activeTab || baseLanguage;
|
|
2435
2395
|
_.forEach(obj.versions.base.selectedLanguages, (language) => {
|
|
2436
2396
|
if (obj.versions.base[language].is_drag_drop) {
|
|
2437
2397
|
delete obj.versions.base[language].edmeditorsrc;
|
|
@@ -2730,7 +2690,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2730
2690
|
isEdit={this.state.isEdit}
|
|
2731
2691
|
iframeParent={parent}
|
|
2732
2692
|
router={this.props.router}
|
|
2733
|
-
baseLanguage={this.props.currentOrgDetails.basic_details.base_language}
|
|
2693
|
+
baseLanguage={this.state.formData[0]?.activeTab || this.props.currentOrgDetails.basic_details.base_language} // // as baseLanguage & created template language are not same than it will pick from template language (activeTab has template language)
|
|
2734
2694
|
supportedLanguages={this.getSupportedLanguages(this.props)}
|
|
2735
2695
|
isSchemaChanged={this.state.isSchemaChanged}
|
|
2736
2696
|
cmsTemplates={this.props.Templates.cmsTemplates}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const EMAILPreviewMockData = {
|
|
2
|
+
loadingStatus: 0,
|
|
3
|
+
formData: {},
|
|
4
|
+
tabCount: 1,
|
|
5
|
+
currentTab: 1,
|
|
6
|
+
events: {
|
|
7
|
+
blur: (() => {}),
|
|
8
|
+
afterPaste: (() => {}),
|
|
9
|
+
change: (() => {}),
|
|
10
|
+
},
|
|
11
|
+
isEdit: false,
|
|
12
|
+
schema: {},
|
|
13
|
+
loading: false,
|
|
14
|
+
isFormValid: true,
|
|
15
|
+
injectedTags: {},
|
|
16
|
+
checkValidation: false,
|
|
17
|
+
saveEdmDataMode: 'save',
|
|
18
|
+
tabKey: '',
|
|
19
|
+
showEmailPreview: false,
|
|
20
|
+
device: "desktop",
|
|
21
|
+
editorInstanse: undefined,
|
|
22
|
+
showImageSelectionBox: false,
|
|
23
|
+
isDragDrop: false,
|
|
24
|
+
showConfirmationModal: false,
|
|
25
|
+
modalContent: {title: "", body: "", type: 'confirm', id: 'email-language-delete-modal'},
|
|
26
|
+
showModal: false,
|
|
27
|
+
page: 1,
|
|
28
|
+
perPageLimit: 25,
|
|
29
|
+
totalCount: 0,
|
|
30
|
+
searchText: '',
|
|
31
|
+
saveCount: 0,
|
|
32
|
+
cmsDataCount: 0,
|
|
33
|
+
targetSaveCount: 0,
|
|
34
|
+
saveObj: {},
|
|
35
|
+
showEdmEmailTemplates: false,
|
|
36
|
+
editDataSet: false,
|
|
37
|
+
languageDataSet: false,
|
|
38
|
+
addLanguageType: '',
|
|
39
|
+
startValidation: false,
|
|
40
|
+
saveForm: false,
|
|
41
|
+
|
|
42
|
+
params: {},
|
|
43
|
+
location: {
|
|
44
|
+
pathname: '/creatives/ui/v2',
|
|
45
|
+
search: '',
|
|
46
|
+
hash: '',
|
|
47
|
+
key: 'm54f44',
|
|
48
|
+
query: {module: "library"},
|
|
49
|
+
},
|
|
50
|
+
Templates: {},
|
|
51
|
+
Email: {},
|
|
52
|
+
isGetFormData: true,
|
|
53
|
+
currentOrgDetails: {basic_details: {}},
|
|
54
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { injectIntl } from 'react-intl';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import {
|
|
5
|
+
render,
|
|
6
|
+
} from '../../../utils/test-utils';
|
|
7
|
+
import { EMAILPreviewMockData } from '../mockdata/mockdata';
|
|
8
|
+
import { Email } from "../index";
|
|
9
|
+
|
|
10
|
+
const initializeComponent = () => {
|
|
11
|
+
const Component = injectIntl(Email);
|
|
12
|
+
const resetUploadData = jest.fn();
|
|
13
|
+
const clearStoreValues = jest.fn();
|
|
14
|
+
const clearCRUDResponse = jest.fn();
|
|
15
|
+
const fetchSchemaForEntity = jest.fn();
|
|
16
|
+
|
|
17
|
+
return render( <Component
|
|
18
|
+
{...EMAILPreviewMockData}
|
|
19
|
+
templatesActions={{resetUploadData}}
|
|
20
|
+
actions={{
|
|
21
|
+
clearStoreValues,
|
|
22
|
+
clearCRUDResponse,
|
|
23
|
+
}}
|
|
24
|
+
globalActions={{
|
|
25
|
+
fetchSchemaForEntity,
|
|
26
|
+
}}
|
|
27
|
+
/>);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
describe('renders a message', () => {
|
|
31
|
+
it("Test if Email component renders", () => {
|
|
32
|
+
initializeComponent();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
@@ -887,8 +887,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
887
887
|
const cardDataList = filteredTemplates && filteredTemplates.length ? map(filteredTemplates, (template) => {
|
|
888
888
|
const templateData =
|
|
889
889
|
{
|
|
890
|
-
key: `${currentChannel}-card-${template
|
|
891
|
-
title: <span title={template
|
|
890
|
+
key: `${currentChannel}-card-${template?.name}`,
|
|
891
|
+
title: <span title={template?.name} >{template?.name}</span>,
|
|
892
892
|
extra: [
|
|
893
893
|
<CapIcon
|
|
894
894
|
className={`view-${channelLowerCase}`}
|
|
@@ -1070,7 +1070,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1070
1070
|
const { whatsappImageSrc = '', templateMsg} = getWhatsappContent(template);
|
|
1071
1071
|
templateData.title = (
|
|
1072
1072
|
<CapRow>
|
|
1073
|
-
<CapLabel className="whatsapp-rcs-template-name">{template
|
|
1073
|
+
<CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>
|
|
1074
1074
|
<WhatsappStatusContainer template={template} />
|
|
1075
1075
|
</CapRow>
|
|
1076
1076
|
);
|
|
@@ -1094,7 +1094,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1094
1094
|
break;
|
|
1095
1095
|
}
|
|
1096
1096
|
case RCS: {
|
|
1097
|
-
templateData.title = <CapLabel className="whatsapp-rcs-template-name">{template
|
|
1097
|
+
templateData.title = <CapLabel className="whatsapp-rcs-template-name">{template?.name}</CapLabel>;
|
|
1098
1098
|
templateData.content = getRCSContent(template);
|
|
1099
1099
|
break;
|
|
1100
1100
|
}
|
|
@@ -1610,7 +1610,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1610
1610
|
|
|
1611
1611
|
duplicateTemplate(template) {
|
|
1612
1612
|
const duplicateObj = cloneDeep(template);
|
|
1613
|
-
duplicateObj.name = `Copy of ${template
|
|
1613
|
+
duplicateObj.name = `Copy of ${template?.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
|
|
1614
1614
|
delete duplicateObj._id;
|
|
1615
1615
|
|
|
1616
1616
|
if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
@@ -1953,7 +1953,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1953
1953
|
<div className="card-title">
|
|
1954
1954
|
<span className="template-name" style={{ fontWeight: `${this.state.channel.toLowerCase() === 'wechat' ? '400' : '600'}` }}>
|
|
1955
1955
|
{ template && template.versions && template.versions.history && template.versions.history.length > 1 && this.state.channel.toLowerCase() !== 'mobilepush' && <i style={{fontSize: '16px', margin: '0 8px 0 0', verticalAlign: 'middle'}} className="material-icons">filter_none</i>}
|
|
1956
|
-
{template
|
|
1956
|
+
{template?.name}
|
|
1957
1957
|
</span>
|
|
1958
1958
|
{this.props.location.query.type !== 'embedded' && <CapPopover
|
|
1959
1959
|
trigger="click"
|