@capillarytech/creatives-library 2.0.40 → 2.0.42
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/components/EmailPreviewV2/_emailPreviewV2.scss +0 -2
- package/components/EmailPreviewV2/index.js +28 -2
- package/components/EmailPreviewV2/messages.js +12 -1
- package/components/FormBuilder/index.js +2 -2
- package/containers/CreativesContainer/SlideBoxContent.js +2 -2
- package/containers/CreativesContainer/index.js +3 -1
- package/containers/Email/index.js +64 -77
- package/containers/EmailWrapper/index.js +1 -1
- package/containers/Sms/Create/index.js +8 -7
- package/containers/Sms/Edit/index.js +8 -7
- package/containers/Templates/index.js +3 -1
- package/package.json +1 -1
|
@@ -12,8 +12,8 @@ import {isEmpty} from 'lodash';
|
|
|
12
12
|
import { connect } from 'react-redux';
|
|
13
13
|
import { bindActionCreators } from 'redux';
|
|
14
14
|
import { createStructuredSelector } from 'reselect';
|
|
15
|
-
import { CapSpin } from '@capillarytech/cap-ui-library';
|
|
16
|
-
|
|
15
|
+
import { CapSpin, CapSlideBox } from '@capillarytech/cap-ui-library';
|
|
16
|
+
import moment from 'moment';
|
|
17
17
|
import messages from './messages';
|
|
18
18
|
import './_emailPreviewV2.scss';
|
|
19
19
|
import tabletBody from '../../assets/iPad.svg';
|
|
@@ -57,6 +57,27 @@ class EmailPreviewV2 extends React.Component {
|
|
|
57
57
|
changePreviewDevice = (ev) => {
|
|
58
58
|
this.setState({currentDevice: ev.currentTarget.id});
|
|
59
59
|
}
|
|
60
|
+
getPreview = ({device, messageContainerName, templateContent}) => {
|
|
61
|
+
return (
|
|
62
|
+
<div className={device === devices.desktop ? '' : "shell align-center"}>
|
|
63
|
+
{device === devices.tablet ?
|
|
64
|
+
<img src={tabletBody} alt="capillary" width="520" /> : ''}
|
|
65
|
+
{device === devices.mobile ?
|
|
66
|
+
<img src={mobileBody} alt="capillary" width="85%" /> : ''}
|
|
67
|
+
<div className={messageContainerName}>
|
|
68
|
+
<iframe srcDoc={templateContent} {...deviceAspectRatio[device]} >
|
|
69
|
+
<p><FormattedMessage {...messages.noIframeSupport}/></p>
|
|
70
|
+
</iframe>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
showAllDevices = () => {
|
|
76
|
+
this.setState({showSlideBox: true});
|
|
77
|
+
}
|
|
78
|
+
hideAllDevices = () => {
|
|
79
|
+
this.setState({showSlideBox: false})l
|
|
80
|
+
}
|
|
60
81
|
render() {
|
|
61
82
|
let messageContainerName = '';
|
|
62
83
|
const {currentDevice} = this.state;
|
|
@@ -97,6 +118,11 @@ class EmailPreviewV2 extends React.Component {
|
|
|
97
118
|
</div>
|
|
98
119
|
</div>
|
|
99
120
|
</div>
|
|
121
|
+
{this.props.templateData &&
|
|
122
|
+
[<p className="preview-info"><FormattedMessage {...messages.lastModified} />: {moment(this.props.templateData.updatedAt).format('MM-DD-YYYY')}</p>,
|
|
123
|
+
<p style={{marginBottom: '8px'}} className="preview-info"><FormattedMessage {...messages.uploadedBy} /> : {this.props.templateData.updatedByName}</p>,
|
|
124
|
+
]
|
|
125
|
+
}
|
|
100
126
|
</CapSpin>
|
|
101
127
|
</div>
|
|
102
128
|
|
|
@@ -26,5 +26,16 @@ export default defineMessages({
|
|
|
26
26
|
id: 'app.components.EmailPreviewV2.noIframeSupport',
|
|
27
27
|
defaultMessage: 'Your browser does not support iframes.',
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
showAllDevices: {
|
|
30
|
+
id: 'app.components.EmailPreviewV2.showAllDevices',
|
|
31
|
+
defaultMessage: 'Show all devices',
|
|
32
|
+
},
|
|
33
|
+
lastModified: {
|
|
34
|
+
id: 'app.components.PreviewSideBar.lastModified',
|
|
35
|
+
defaultMessage: 'Last Modified On',
|
|
36
|
+
},
|
|
37
|
+
uploadedBy: {
|
|
38
|
+
id: 'app.components.PreviewSideBar.uploadedBy',
|
|
39
|
+
defaultMessage: 'Last Modified By',
|
|
40
|
+
},
|
|
30
41
|
});
|
|
@@ -305,7 +305,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
handleCloseModal = (
|
|
308
|
+
handleCloseModal = () => {
|
|
309
309
|
const event = this.state.currentEvent;
|
|
310
310
|
if (!_.isEmpty(this.state.currentEvent)) {
|
|
311
311
|
switch (event) {
|
|
@@ -947,7 +947,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
947
947
|
}
|
|
948
948
|
|
|
949
949
|
skipTags(tag) {
|
|
950
|
-
const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d",
|
|
950
|
+
const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d","Link_to_[a-zA-z]"];
|
|
951
951
|
|
|
952
952
|
//const regexGroups = [];
|
|
953
953
|
let skipped = false;
|
|
@@ -38,7 +38,7 @@ function SlideBoxContent(props) {
|
|
|
38
38
|
isFullMode,
|
|
39
39
|
} = props;
|
|
40
40
|
const type = messageDetails.type.toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
41
|
-
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'defualt' : 'library'
|
|
41
|
+
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'defualt' : 'library'};
|
|
42
42
|
const creativesLocationProps = {
|
|
43
43
|
pathname: `/sms/edit`,
|
|
44
44
|
query,
|
|
@@ -80,7 +80,7 @@ function SlideBoxContent(props) {
|
|
|
80
80
|
content={templateData.versions.base['sms-editor']}
|
|
81
81
|
channel={templateData.type.toLowerCase()}
|
|
82
82
|
charCounterEnabled
|
|
83
|
-
templateData={
|
|
83
|
+
templateData={templateData}
|
|
84
84
|
/>
|
|
85
85
|
)}
|
|
86
86
|
{isEmailPreview && (
|
|
@@ -51,7 +51,9 @@ class Creatives extends React.Component {
|
|
|
51
51
|
};
|
|
52
52
|
onPreviewTemplate = (template) => {
|
|
53
53
|
const templateData = template;
|
|
54
|
-
|
|
54
|
+
const usersList = commonUtil.getMergedUserList(this.props.templateUserList);
|
|
55
|
+
const userId = parseInt(template.updatedBy, 10);
|
|
56
|
+
templateData.updatedByName = commonUtil.getUserNameById(userId, usersList );
|
|
55
57
|
this.setState({ slidBoxContent: 'preview', templateData });
|
|
56
58
|
};
|
|
57
59
|
onEditTemplate = () => {
|
|
@@ -1639,86 +1639,73 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1639
1639
|
let langTab = 0;
|
|
1640
1640
|
const schema = _.cloneDeep(this.state.schema);
|
|
1641
1641
|
const formData = _.cloneDeep(passedData);
|
|
1642
|
-
|
|
1643
|
-
let
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
if (langTab === -1) {
|
|
1650
|
-
formData[`${this.state.currentTab - 1}`].selectedLanguages.push(newActiveTab);
|
|
1642
|
+
if (!_.isEmpty(schema)) {
|
|
1643
|
+
for (let idx = 0; idx < addLanguageLength; idx += 1) {
|
|
1644
|
+
let newActiveTab = this.state.settingLanguage ? this.state.settingLanguage.iso_code : 'en';
|
|
1645
|
+
if (asyncLanguages) {
|
|
1646
|
+
newActiveTab = asyncLanguages[idx].iso_code;
|
|
1647
|
+
data = asyncLanguages[idx];
|
|
1648
|
+
}
|
|
1651
1649
|
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
const tabIndex = (selectedLanguage) + 1;
|
|
1657
|
-
const containers = schema.containers.slice();
|
|
1658
|
-
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
1659
|
-
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
1660
|
-
const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
|
|
1661
|
-
const firstPane = _.cloneDeep(panes[0]);
|
|
1662
|
-
const sections = [];
|
|
1663
|
-
_.forEach(firstPane.sections, (section) => {
|
|
1664
|
-
let sect = _.cloneDeep(section);
|
|
1665
|
-
|
|
1666
|
-
if (sect.type === 'col-label') {
|
|
1667
|
-
sect = this.cloneColLabel(sect, tabIndex);
|
|
1668
|
-
} else if (sect.type === 'multicols') {
|
|
1669
|
-
sect = this.cloneMultiCol(sect, tabIndex);
|
|
1670
|
-
} else if (sect.type === 'parent') {
|
|
1671
|
-
sect = this.cloneParent(sect, tabIndex);
|
|
1650
|
+
if (langTab === -1) {
|
|
1651
|
+
formData[`${this.state.currentTab - 1}`].selectedLanguages.push(newActiveTab);
|
|
1652
|
+
langTab = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(newActiveTab);
|
|
1672
1653
|
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1654
|
+
const selectedLanguage = formData[`${this.state.currentTab - 1}`].selectedLanguages.indexOf(data.iso_code);
|
|
1655
|
+
tabKey = formData[`${this.state.currentTab - 1}`][data.iso_code].tabKey;
|
|
1656
|
+
const tabIndex = (selectedLanguage) + 1;
|
|
1657
|
+
const containers = schema.containers.slice();
|
|
1658
|
+
const tabContent = _.cloneDeep(containers[0].tabContent.sections[0]);
|
|
1659
|
+
const tabContentSection = tabContent.inputFields[0].cols[0];
|
|
1660
|
+
const panes = containers[`${this.state.currentTab - 1}`].panes.slice();
|
|
1661
|
+
const firstPane = _.cloneDeep(panes[0]);
|
|
1662
|
+
const sections = [];
|
|
1663
|
+
_.forEach(firstPane.sections, (section) => {
|
|
1664
|
+
let sect = _.cloneDeep(section);
|
|
1665
|
+
if (sect.type === 'col-label') {
|
|
1666
|
+
sect = this.cloneColLabel(sect, tabIndex);
|
|
1667
|
+
} else if (sect.type === 'multicols') {
|
|
1668
|
+
sect = this.cloneMultiCol(sect, tabIndex);
|
|
1669
|
+
} else if (sect.type === 'parent') {
|
|
1670
|
+
sect = this.cloneParent(sect, tabIndex);
|
|
1687
1671
|
}
|
|
1672
|
+
sections.push(sect);
|
|
1673
|
+
return true;
|
|
1674
|
+
});
|
|
1675
|
+
tabContentSection.id = `${tabContentSection.id}${tabIndex}`;
|
|
1676
|
+
tabContentSection.value = `${data.language}`;
|
|
1677
|
+
_.forEach(sections[0].inputFields[0].cols, (inputField) => {
|
|
1678
|
+
if (this.map[inputField.id] === undefined) {
|
|
1679
|
+
if (inputField.id.indexOf('template-content') > -1) {
|
|
1680
|
+
this.map[inputField.id] = this.map['template-content'];
|
|
1681
|
+
} else if (inputField.id.indexOf('edmeditor2') > -1) {
|
|
1682
|
+
this.map[inputField.id] = this.map.edmeditor2;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1686
|
+
firstPane.sections = sections;
|
|
1687
|
+
firstPane.sectionsHeaders = [tabContent];
|
|
1688
|
+
// panes.push(firstPane);
|
|
1689
|
+
schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
|
|
1690
|
+
// schema.containers[0].tabContent.sections.push(tabContent);
|
|
1691
|
+
}
|
|
1692
|
+
//this.props.templatesActions.getEdmDefaultTemplates();
|
|
1693
|
+
const container = schema.containers[this.state.currentTab - 1];
|
|
1694
|
+
const temp = container;
|
|
1695
|
+
if (this.state.addLanguageType === "upload") {
|
|
1696
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
1697
|
+
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
1698
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
1699
|
+
}
|
|
1700
|
+
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
|
|
1701
|
+
if (schema) {
|
|
1702
|
+
this.setState({schema, isSchemaChanged: true, tabKey});
|
|
1703
|
+
if (this.state.addLanguageType !== "upload") {
|
|
1704
|
+
this.setState({addLanguageType: ''});
|
|
1688
1705
|
}
|
|
1689
|
-
|
|
1690
|
-
firstPane.sections = sections;
|
|
1691
|
-
firstPane.sectionsHeaders = [tabContent];
|
|
1692
|
-
|
|
1693
|
-
// panes.push(firstPane);
|
|
1694
|
-
|
|
1695
|
-
schema.containers[`${this.state.currentTab - 1}`].panes.push(firstPane);
|
|
1696
|
-
// schema.containers[0].tabContent.sections.push(tabContent);
|
|
1697
|
-
}
|
|
1698
|
-
//this.props.templatesActions.getEdmDefaultTemplates();
|
|
1699
|
-
const container = schema.containers[this.state.currentTab - 1];
|
|
1700
|
-
const temp = container;
|
|
1701
|
-
|
|
1702
|
-
if (this.state.addLanguageType === "upload") {
|
|
1703
|
-
temp.panes[langTab].sections[0].inputFields[0].cols[0].colStyle = {display: ""};
|
|
1704
|
-
temp.panes[langTab].sections[0].inputFields[0].cols[1].colStyle = {display: "none"};
|
|
1705
|
-
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[3].cols[0].style = {display: "none"};
|
|
1706
|
-
}
|
|
1707
|
-
temp.tabBarExtraContent.sections[0].inputFields[0].cols[4].content.sections[0].inputFields[2].cols[0].style = {display: ""};
|
|
1708
|
-
if (schema) {
|
|
1709
|
-
this.setState({schema, isSchemaChanged: true, tabKey});
|
|
1710
|
-
if (this.state.addLanguageType !== "upload") {
|
|
1711
|
-
this.setState({addLanguageType: ''});
|
|
1706
|
+
//this.toggleEdmEmailTemplateSelection();
|
|
1712
1707
|
}
|
|
1713
|
-
//this.toggleEdmEmailTemplateSelection();
|
|
1714
1708
|
}
|
|
1715
|
-
// const mode = this.state.addLanguageMode;
|
|
1716
|
-
// switch (mode) {
|
|
1717
|
-
// case "upload":
|
|
1718
|
-
//
|
|
1719
|
-
// default:
|
|
1720
|
-
// break;
|
|
1721
|
-
// }
|
|
1722
1709
|
}
|
|
1723
1710
|
|
|
1724
1711
|
openPreviewMode = (selectedAsset) => {
|
|
@@ -2453,9 +2440,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2453
2440
|
if (!isLoading) {
|
|
2454
2441
|
isLoading = this.state.loadingStatus < 2;
|
|
2455
2442
|
}
|
|
2456
|
-
if (isLoading) {
|
|
2457
|
-
|
|
2458
|
-
}
|
|
2443
|
+
// if (isLoading) {
|
|
2444
|
+
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
2445
|
+
// }
|
|
2459
2446
|
return isLoading;
|
|
2460
2447
|
}
|
|
2461
2448
|
renderConfirmationModal() {
|
|
@@ -24,7 +24,7 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
24
24
|
templateName: '',
|
|
25
25
|
routeParams: {
|
|
26
26
|
pathname: `/email/create`,
|
|
27
|
-
query: { module: 'library', type: 'embedded', isEdmSupport: true
|
|
27
|
+
query: { module: 'library', type: 'embedded', isEdmSupport: true},
|
|
28
28
|
},
|
|
29
29
|
modeContent: {
|
|
30
30
|
|
|
@@ -236,9 +236,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
236
236
|
}
|
|
237
237
|
const result = {};
|
|
238
238
|
result.base = baseData;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
if (this.state.isValid) {
|
|
240
|
+
const msgObj = charCount.updateCharCount(baseData['sms-editor']);
|
|
241
|
+
result.base.msg_count = msgObj.msgCount;
|
|
242
|
+
}
|
|
242
243
|
const response = {
|
|
243
244
|
action: "getFormData",
|
|
244
245
|
value: result,
|
|
@@ -246,7 +247,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
246
247
|
validity: this.state.isFormValid,
|
|
247
248
|
type: 'SMS',
|
|
248
249
|
};
|
|
249
|
-
this.setState({checkValidation: true
|
|
250
|
+
this.setState({checkValidation: true});
|
|
250
251
|
|
|
251
252
|
if (e) {
|
|
252
253
|
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
@@ -910,9 +911,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
910
911
|
if (!isLoading) {
|
|
911
912
|
isLoading = this.state.loadingStatus < 2;
|
|
912
913
|
}
|
|
913
|
-
if (isLoading && this.state.loadingStatus >= 2) {
|
|
914
|
-
|
|
915
|
-
}
|
|
914
|
+
// if (isLoading && this.state.loadingStatus >= 2) {
|
|
915
|
+
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
916
|
+
// }
|
|
916
917
|
return isLoading;
|
|
917
918
|
}
|
|
918
919
|
render() {
|
|
@@ -283,9 +283,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
283
283
|
}
|
|
284
284
|
const result = {};
|
|
285
285
|
result.base = baseData;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
if (this.state.isFormValid) {
|
|
287
|
+
const msgObj = updateCharCount(baseData['sms-editor']);
|
|
288
|
+
result.base.msg_count = msgObj.msgCount;
|
|
289
|
+
}
|
|
289
290
|
const response = {
|
|
290
291
|
action: "getFormData",
|
|
291
292
|
value: result,
|
|
@@ -293,7 +294,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
293
294
|
validity: this.state.isFormValid,
|
|
294
295
|
type: 'SMS',
|
|
295
296
|
};
|
|
296
|
-
this.setState({checkValidation: true
|
|
297
|
+
this.setState({checkValidation: true});
|
|
297
298
|
|
|
298
299
|
if (e) {
|
|
299
300
|
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
@@ -896,9 +897,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
896
897
|
if (!isLoading) {
|
|
897
898
|
isLoading = this.state.loadingStatus < 3;
|
|
898
899
|
}
|
|
899
|
-
if (isLoading && this.state.loadingStatus >= 3) {
|
|
900
|
-
|
|
901
|
-
}
|
|
900
|
+
// if (isLoading && this.state.loadingStatus >= 3) {
|
|
901
|
+
// this.props.creativesContainerActions.hideCreativesContanerLoader();
|
|
902
|
+
// }
|
|
902
903
|
return isLoading;
|
|
903
904
|
}
|
|
904
905
|
render() {
|
|
@@ -119,7 +119,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
119
119
|
channel = '';
|
|
120
120
|
}
|
|
121
121
|
this.setState({ channel });
|
|
122
|
-
this.props.
|
|
122
|
+
if (_.isEmpty(this.props.Templates.userList)) {
|
|
123
|
+
this.props.actions.getUserList();
|
|
124
|
+
}
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
|