@capillarytech/creatives-library 7.12.0 → 7.12.1
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/v2Components/CallTaskPreview/tests/__snapshots__/index.test.js.snap +30 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -1
- package/v2Components/TemplatePreview/index.js +2 -1
- package/v2Containers/Assets/images/rcsIllustration.png +0 -0
- package/v2Containers/MobilePush/Edit/index.js +21 -34
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<CallTaskPreview /> Test if Call task component renders 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
className="call-task-preview"
|
|
6
|
+
>
|
|
7
|
+
<img
|
|
8
|
+
alt="header"
|
|
9
|
+
className="call-task-image-undefined"
|
|
10
|
+
src="test-file-stub"
|
|
11
|
+
/>
|
|
12
|
+
<div
|
|
13
|
+
className="call-task-subject-container-undefined"
|
|
14
|
+
>
|
|
15
|
+
this is test
|
|
16
|
+
</div>
|
|
17
|
+
<div
|
|
18
|
+
className="call-task-message-container-undefined"
|
|
19
|
+
/>
|
|
20
|
+
<img
|
|
21
|
+
alt="footer"
|
|
22
|
+
src="test-file-stub"
|
|
23
|
+
style={
|
|
24
|
+
Object {
|
|
25
|
+
"width": "100%",
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
@@ -450,6 +450,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
450
450
|
overflow: 'auto',
|
|
451
451
|
flexDirection: 'column',
|
|
452
452
|
marginLeft: 40,
|
|
453
|
+
left: !this.props.showCount && '200px',
|
|
453
454
|
}}
|
|
454
455
|
>
|
|
455
456
|
<div
|
|
@@ -590,7 +591,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
590
591
|
return (
|
|
591
592
|
<div
|
|
592
593
|
style={{
|
|
593
|
-
margin: '
|
|
594
|
+
margin: '6px 0 20px 28px',
|
|
594
595
|
}}
|
|
595
596
|
>
|
|
596
597
|
<Carousel imageCarousel={imageCarousel}/>
|
|
Binary file
|
|
@@ -60,7 +60,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
60
60
|
this.getLinkTypeFields = getLinkTypeFields.bind(this);
|
|
61
61
|
}
|
|
62
62
|
componentWillMount() {
|
|
63
|
-
|
|
64
63
|
this.props.actions.getWeCrmAccounts("mobilepush");
|
|
65
64
|
if (!this.props.Templates.selectedWeChatAccount && this.props.location.query.type !== 'embedded') {
|
|
66
65
|
const type = this.props.location.query.type;
|
|
@@ -76,7 +75,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
76
75
|
version: "v2",
|
|
77
76
|
};
|
|
78
77
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
79
|
-
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
componentDidMount() {
|
|
@@ -106,10 +104,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
106
104
|
} else if (nextProps.isGetFormData && this.props.isGetFormData !== nextProps.isGetFormData && this.props.isFullMode && !this.props.Create.createTemplateInProgress) {
|
|
107
105
|
this.startValidation();
|
|
108
106
|
}
|
|
109
|
-
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount :
|
|
107
|
+
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount :
|
|
110
108
|
(!_.isEmpty(this.props.Edit.selectedWeChatAccount) ? this.props.Edit.selectedWeChatAccount : nextProps.Edit.selectedWeChatAccount));
|
|
111
109
|
if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
112
|
-
|
|
113
110
|
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
114
111
|
}
|
|
115
112
|
if (!_.isEmpty(nextProps.Edit.selectedWeChatAccount) && !_.isEqual(this.props.Edit.selectedWeChatAccount, nextProps.Edit.selectedWeChatAccount) && (this.props.location.query.type === 'embedded') && this.props.location.query.module === "loyalty") {
|
|
@@ -175,7 +172,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
175
172
|
});
|
|
176
173
|
};
|
|
177
174
|
onFormDataChange = (formData, tabCount, currentTab, inputField) => {
|
|
178
|
-
|
|
179
175
|
const newFormData = _.cloneDeep(formData);
|
|
180
176
|
const {templateCta} = this.state;
|
|
181
177
|
if (!_.isEmpty(templateCta) && this.state.currentTab === 2) {
|
|
@@ -241,12 +237,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
241
237
|
};
|
|
242
238
|
|
|
243
239
|
onTabChange = (data) => {
|
|
244
|
-
|
|
245
240
|
this.setState({currentTab: data});
|
|
246
241
|
};
|
|
247
242
|
|
|
248
243
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
249
|
-
|
|
250
244
|
const editorId = srcComp.target;
|
|
251
245
|
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
252
246
|
document.getElementById(editorId).focus();
|
|
@@ -259,10 +253,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
259
253
|
onUpdateTemplateComplete = (response) => {
|
|
260
254
|
const obj = this.getTransformedData(this.state.formData);
|
|
261
255
|
const content = getContent(obj);
|
|
262
|
-
const
|
|
256
|
+
const {
|
|
263
257
|
definition: {
|
|
264
|
-
mode: definitionMode
|
|
265
|
-
}
|
|
258
|
+
mode: definitionMode,
|
|
259
|
+
},
|
|
266
260
|
} = obj || {};
|
|
267
261
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
268
262
|
const timeTaken = GA.timeTracker.stopTimer(TRACK_EDIT_MPUSH, {
|
|
@@ -278,12 +272,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
278
272
|
timeTaken,
|
|
279
273
|
content,
|
|
280
274
|
mode: EDIT,
|
|
281
|
-
imageAdded: definitionMode === 'image'
|
|
282
|
-
})
|
|
283
|
-
} catch(e) {
|
|
275
|
+
imageAdded: definitionMode === 'image',
|
|
276
|
+
});
|
|
277
|
+
} catch (e) {
|
|
284
278
|
console.log(e);
|
|
285
279
|
}
|
|
286
|
-
|
|
280
|
+
|
|
287
281
|
this.resetSchema();
|
|
288
282
|
this.setState({
|
|
289
283
|
formData: {},
|
|
@@ -535,7 +529,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
535
529
|
delete cta.ioscdeepLinkName;
|
|
536
530
|
}
|
|
537
531
|
obj.versions.base.IOS.expandableDetails.ctas.push(cta);
|
|
538
|
-
obj.versions.base.IOS.expandableDetails.categoryId = get(this.state, "templateCta.id");
|
|
532
|
+
obj.versions.base.IOS.expandableDetails.categoryId = get(this.state, "templateCta.id") || get(this.state.editData, 'versions.base.IOS.expandableDetails.categoryId');
|
|
533
|
+
|
|
539
534
|
if (obj.versions.base.IOS.expandableDetails.ctas[obj.versions.base.IOS.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
540
535
|
const params = _.map(ios, (field, key) => {
|
|
541
536
|
let actionLink;
|
|
@@ -603,13 +598,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
603
598
|
getMappedEvent = (id, event) => {
|
|
604
599
|
const map = this.state.eventsMap;
|
|
605
600
|
if (!map[id] || !map[id][event]) {
|
|
606
|
-
|
|
601
|
+
|
|
607
602
|
}
|
|
608
603
|
return map[id][event];
|
|
609
604
|
};
|
|
610
605
|
|
|
611
606
|
getCurrentWindow = (e) => {
|
|
612
|
-
|
|
613
607
|
const response = {
|
|
614
608
|
action: e.action,
|
|
615
609
|
value: 'edit',
|
|
@@ -619,13 +613,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
619
613
|
};
|
|
620
614
|
|
|
621
615
|
getFormData = (e) => {
|
|
622
|
-
|
|
623
616
|
const response = {
|
|
624
617
|
action: "getFormData",
|
|
625
618
|
value: this.getTransformedData(this.state.formData),
|
|
626
619
|
validity: this.state.isFormValid,
|
|
627
620
|
};
|
|
628
|
-
|
|
621
|
+
|
|
629
622
|
this.setState({checkValidation: true}, this.showError);
|
|
630
623
|
if (e) {
|
|
631
624
|
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
@@ -635,7 +628,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
635
628
|
|
|
636
629
|
|
|
637
630
|
setEditState(data, schema) {
|
|
638
|
-
|
|
639
631
|
const tabCount = Object.keys(data.versions.base).length;
|
|
640
632
|
const formData = {};
|
|
641
633
|
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === "loyalty") {
|
|
@@ -775,7 +767,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
775
767
|
formData[0].base = true;
|
|
776
768
|
// formData[0].tabKey = '1';
|
|
777
769
|
// formData[1].tabKey = '2';
|
|
778
|
-
|
|
770
|
+
|
|
779
771
|
this.setState({templateCta}, () => {
|
|
780
772
|
this.getSchemaForFormData(formData, schema);
|
|
781
773
|
this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
|
|
@@ -1361,7 +1353,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1361
1353
|
|
|
1362
1354
|
|
|
1363
1355
|
startTemplateCreation = (data) => {
|
|
1364
|
-
|
|
1365
1356
|
if (!this.state.isContentEditLoaded && this.state.fullSchema && this.props.Edit.weCrmAccounts) {
|
|
1366
1357
|
const schema = JSON.stringify(data).indexOf("BIG_PICTURE") > -1 ? this.state.fullSchema.imageSchema : this.state.fullSchema.textSchema;
|
|
1367
1358
|
this.setMobilePushAccountOptions(this.props.Edit.weCrmAccounts, data.content.accId);
|
|
@@ -1377,7 +1368,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1377
1368
|
}
|
|
1378
1369
|
};
|
|
1379
1370
|
discardValues = () => {
|
|
1380
|
-
|
|
1381
1371
|
this.resetSchema();
|
|
1382
1372
|
this.setState({
|
|
1383
1373
|
formData: {},
|
|
@@ -1403,7 +1393,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1403
1393
|
|
|
1404
1394
|
};
|
|
1405
1395
|
moveToTemplates = () => {
|
|
1406
|
-
|
|
1407
1396
|
const modalContent = {
|
|
1408
1397
|
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
1409
1398
|
body: this.props.intl.formatMessage(messages.goBackTemporaryChangesLost),
|
|
@@ -1478,17 +1467,16 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1478
1467
|
};
|
|
1479
1468
|
|
|
1480
1469
|
saveFormData = (formData) => {
|
|
1481
|
-
|
|
1482
1470
|
const obj = this.getTransformedData(formData);
|
|
1483
|
-
|
|
1471
|
+
|
|
1484
1472
|
this.props.actions.editTemplate(obj, this.onUpdateTemplateComplete);
|
|
1485
1473
|
};
|
|
1486
1474
|
handleFrameTasks = (e) => {
|
|
1487
|
-
//
|
|
1475
|
+
//
|
|
1488
1476
|
const type = e.data;
|
|
1489
|
-
|
|
1477
|
+
|
|
1490
1478
|
if (typeof type === 'object') {
|
|
1491
|
-
//
|
|
1479
|
+
//
|
|
1492
1480
|
const action = type.action;
|
|
1493
1481
|
switch (action) {
|
|
1494
1482
|
case "startTemplateCreation":
|
|
@@ -1509,15 +1497,15 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1509
1497
|
this.getFormData(e);
|
|
1510
1498
|
break;
|
|
1511
1499
|
case "startTemplateCreation":
|
|
1512
|
-
|
|
1500
|
+
|
|
1513
1501
|
//this.getFormData(e);
|
|
1514
1502
|
break;
|
|
1515
1503
|
case "moveToTemplates":
|
|
1516
|
-
|
|
1504
|
+
|
|
1517
1505
|
this.moveToTemplates();
|
|
1518
1506
|
break;
|
|
1519
1507
|
case "validateContent":
|
|
1520
|
-
|
|
1508
|
+
|
|
1521
1509
|
this.validateContent(e);
|
|
1522
1510
|
break;
|
|
1523
1511
|
default:
|
|
@@ -1726,7 +1714,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1726
1714
|
tempContainer = this.injectContainer(tempContainer);
|
|
1727
1715
|
return tempContainer;
|
|
1728
1716
|
});
|
|
1729
|
-
|
|
1717
|
+
|
|
1730
1718
|
this.setState({schema, loadingContentEdit: false}, () => {
|
|
1731
1719
|
this.removeStandAlone();
|
|
1732
1720
|
});
|
|
@@ -1747,7 +1735,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1747
1735
|
this.setState({ schema });
|
|
1748
1736
|
};
|
|
1749
1737
|
handleOnTagsContextChange = (data) => {
|
|
1750
|
-
|
|
1751
1738
|
const query = {
|
|
1752
1739
|
layout: 'mobilepush',
|
|
1753
1740
|
type: 'TAG',
|