@capillarytech/creatives-library 7.6.0 → 7.6.2
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/assets/DeviceForEmail.png +0 -0
- package/components/CapTagList/index.js +5 -5
- package/components/Card/index.js +1 -1
- package/components/Ckeditor/index.js +5 -5
- package/components/CustomPopOver/index.js +3 -3
- package/components/Edmeditor/index.js +4 -4
- package/components/EmailPreview/index.js +1 -1
- package/components/PreviewSideBar/index.js +3 -3
- package/components/Sidebar/index.js +1 -1
- package/components/SmsTest/index.js +4 -4
- package/components/TemplatePreview/index.js +2 -2
- package/components/Toastr/index.js +1 -1
- package/containers/Assets/Gallery/index.js +2 -2
- package/containers/Assets/Gallery/sagas.js +1 -1
- package/containers/Cap/actions.js +2 -2
- package/containers/Cap/reducer.js +1 -1
- package/containers/Cap/sagas.js +3 -3
- package/containers/Cap/selectors.js +1 -1
- package/containers/Ebill/actions.js +1 -1
- package/containers/Ebill/index.js +34 -34
- package/containers/Ebill/sagas.js +3 -3
- package/containers/Email/actions.js +2 -2
- package/containers/Email/index.js +171 -171
- package/containers/Email/reducer.js +1 -1
- package/containers/Email/sagas.js +6 -6
- package/containers/LanguageProvider/actions.js +1 -1
- package/containers/Line/Create/actions.js +5 -5
- package/containers/Line/Create/index.js +37 -37
- package/containers/Line/Create/sagas.js +7 -7
- package/containers/Line/Edit/actions.js +3 -3
- package/containers/Line/Edit/index.js +24 -24
- package/containers/Line/Edit/sagas.js +4 -4
- package/containers/MobilePush/Create/actions.js +2 -2
- package/containers/MobilePush/Create/index.js +35 -35
- package/containers/MobilePush/Create/sagas.js +2 -2
- package/containers/MobilePush/Edit/actions.js +3 -3
- package/containers/MobilePush/Edit/index.js +32 -32
- package/containers/MobilePush/Edit/sagas.js +5 -5
- package/containers/Sms/Create/actions.js +2 -2
- package/containers/Sms/Create/index.js +57 -57
- package/containers/Sms/Create/sagas.js +2 -2
- package/containers/Sms/Edit/actions.js +3 -3
- package/containers/Sms/Edit/index.js +44 -44
- package/containers/Sms/Edit/sagas.js +3 -3
- package/containers/TagList/index.js +9 -9
- package/containers/Templates/actions.js +5 -5
- package/containers/Templates/index.js +44 -44
- package/containers/Templates/sagas.js +5 -5
- package/containers/WeChat/MapTemplates/actions.js +1 -1
- package/containers/WeChat/MapTemplates/index.js +34 -34
- package/containers/WeChat/MapTemplates/sagas.js +2 -2
- package/containers/WeChat/RichmediaTemplates/Create/index.js +9 -9
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
- package/package.json +1 -1
- package/services/api.js +20 -24
- package/utils/authWrapper.js +2 -2
- package/utils/smsCharCount.js +5 -5
- package/v2Components/CapTagList/index.js +1 -1
- package/v2Components/CapVideoUpload/index.js +14 -6
- package/v2Components/Card/index.js +1 -1
- package/v2Components/Ckeditor/index.js +5 -5
- package/v2Components/CustomPopOver/index.js +3 -3
- package/v2Components/Edmeditor/index.js +4 -4
- package/v2Components/EmailMobilePreview/index.js +4 -4
- package/v2Components/EmailPreviewV2/index.js +4 -4
- package/v2Components/FormBuilder/index.js +3 -3
- package/v2Components/PreviewSideBar/index.js +3 -3
- package/v2Components/SmsTest/index.js +4 -4
- package/v2Components/TemplatePreview/index.js +5 -1
- package/v2Components/Toastr/index.js +1 -1
- package/v2Containers/Assets/Gallery/sagas.js +1 -1
- package/v2Containers/Cap/actions.js +1 -1
- package/v2Containers/Cap/index.js +2 -2
- package/v2Containers/Cap/reducer.js +1 -1
- package/v2Containers/Cap/sagas.js +3 -3
- package/v2Containers/Cap/selectors.js +1 -1
- package/v2Containers/CapFacebookPreview/actions.js +3 -15
- package/v2Containers/CapFacebookPreview/constants.js +3 -11
- package/v2Containers/CapFacebookPreview/index.js +6 -6
- package/v2Containers/CapFacebookPreview/reducer.js +3 -9
- package/v2Containers/CapFacebookPreview/sagas.js +6 -65
- package/v2Containers/CreativesContainer/SlideBoxContent.js +16 -7
- package/v2Containers/CreativesContainer/index.js +1 -0
- package/v2Containers/Ebill/actions.js +1 -1
- package/v2Containers/Ebill/index.js +34 -34
- package/v2Containers/Ebill/sagas.js +3 -3
- package/v2Containers/Email/reducer.js +1 -1
- package/v2Containers/EmailWrapper/index.js +4 -4
- package/v2Containers/Facebook/Advertisement/index.js +38 -15
- package/v2Containers/Facebook/Advertisement/index.scss +9 -0
- package/v2Containers/Facebook/Advertisement/messages.js +2 -2
- package/v2Containers/Facebook/actions.js +2 -1
- package/v2Containers/Facebook/reducer.js +3 -0
- package/v2Containers/Facebook/sagas.js +18 -7
- package/v2Containers/LanguageProvider/actions.js +1 -1
- package/v2Containers/Line/Container/actions.js +5 -5
- package/v2Containers/Line/Container/sagas.js +4 -4
- package/v2Containers/MobilePush/Create/actions.js +2 -2
- package/v2Containers/MobilePush/Create/index.js +1 -1
- package/v2Containers/MobilePush/Create/sagas.js +2 -2
- package/v2Containers/MobilePush/Edit/actions.js +3 -3
- package/v2Containers/MobilePush/Edit/index.js +26 -26
- package/v2Containers/MobilePush/Edit/sagas.js +5 -5
- package/v2Containers/Sms/Create/index.js +4 -4
- package/v2Containers/TagList/index.js +6 -6
- package/v2Containers/Templates/actions.js +5 -5
- package/v2Containers/Templates/index.js +23 -2
- package/v2Containers/Templates/sagas.js +4 -4
- package/v2Containers/Viber/actions.js +2 -2
- package/v2Containers/Viber/sagas.js +2 -2
- package/v2Containers/WeChat/MapTemplates/actions.js +1 -1
- package/v2Containers/WeChat/MapTemplates/index.js +19 -19
- package/v2Containers/WeChat/MapTemplates/sagas.js +3 -3
- package/v2Containers/WeChat/RichmediaTemplates/Create/actions.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/actions.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/sagas.js +1 -1
|
@@ -183,7 +183,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
183
183
|
};
|
|
184
184
|
|
|
185
185
|
componentDidMount = () => {
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
const query = {
|
|
188
188
|
layout: 'MOBILEPUSH',
|
|
189
189
|
type: 'LAYOUT',
|
|
@@ -200,7 +200,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
componentWillReceiveProps = (nextProps) => {
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
if (nextProps.isGetFormData) {
|
|
205
205
|
nextProps.getFormLibraryData(this.getFormData());
|
|
206
206
|
}
|
|
@@ -211,7 +211,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
211
211
|
this.props.actions.clearAsset();
|
|
212
212
|
}
|
|
213
213
|
if (nextProps.createResponse && nextProps.createResponse.templateId) {
|
|
214
|
-
|
|
214
|
+
|
|
215
215
|
this.discardValues();
|
|
216
216
|
const message = getMessageObject('success', this.props.intl.formatMessage(messages["Mobile Push Template Created Successfully"]), true);
|
|
217
217
|
this.props.globalActions.addMessageToQueue(message);
|
|
@@ -234,7 +234,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
234
234
|
this.setState({iosCtasData: nextProps.Create.iosCtasData});
|
|
235
235
|
}
|
|
236
236
|
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
|
|
237
|
-
|
|
237
|
+
|
|
238
238
|
const schema = this.props.params.mode === "text" ? nextProps.metaEntities.layouts[0].definition.textSchema : nextProps.metaEntities.layouts[0].definition.imageSchema;
|
|
239
239
|
schema.standalone.sections.splice(1, 1);
|
|
240
240
|
this.injectEvents(schema);
|
|
@@ -254,7 +254,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
256
|
componentWillUnmount = () => {
|
|
257
|
-
|
|
257
|
+
|
|
258
258
|
window.removeEventListener("message", this.handleFrameTasks);
|
|
259
259
|
};
|
|
260
260
|
onTemplateChange = () => {
|
|
@@ -262,7 +262,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
262
262
|
};
|
|
263
263
|
|
|
264
264
|
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
265
|
-
|
|
265
|
+
|
|
266
266
|
const newFormData = _.cloneDeep(formData);
|
|
267
267
|
if (newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`]) {
|
|
268
268
|
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].name;
|
|
@@ -300,18 +300,18 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
300
300
|
};
|
|
301
301
|
|
|
302
302
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
303
|
-
|
|
303
|
+
|
|
304
304
|
const editorId = srcComp.target;
|
|
305
305
|
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
306
306
|
document.getElementById(editorId).focus();
|
|
307
307
|
};
|
|
308
308
|
|
|
309
309
|
onTabChange = (data) => {
|
|
310
|
-
|
|
310
|
+
|
|
311
311
|
this.setState({currentTab: data});
|
|
312
312
|
};
|
|
313
313
|
onTemplateNameChange = (name) => {
|
|
314
|
-
|
|
314
|
+
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
|
|
@@ -328,7 +328,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
328
328
|
if (inputField) {
|
|
329
329
|
_.forEach(inputField.cols, (col) => {
|
|
330
330
|
if (col.id === field.id && paneIndex === this.state.currentTab - 1) {
|
|
331
|
-
|
|
331
|
+
|
|
332
332
|
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
333
333
|
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
334
334
|
const deeplinkValue = formData[this.state.currentTab - 1][field.id];
|
|
@@ -457,7 +457,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
457
457
|
this.injectEvents(schema);
|
|
458
458
|
};
|
|
459
459
|
onTemplateContentChange = (content) => {
|
|
460
|
-
|
|
460
|
+
|
|
461
461
|
};
|
|
462
462
|
onModalCancel = () => {
|
|
463
463
|
if (this.state.modalContent && this.state.modalContent.show) {
|
|
@@ -477,7 +477,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
477
477
|
getMappedEvent = (id, event) => {
|
|
478
478
|
const map = this.state.eventsMap;
|
|
479
479
|
if (!map[id] || !map[id][event]) {
|
|
480
|
-
|
|
480
|
+
|
|
481
481
|
}
|
|
482
482
|
return map[id][event];
|
|
483
483
|
};
|
|
@@ -490,7 +490,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
490
490
|
parent.postMessage(JSON.stringify(response), '*');
|
|
491
491
|
};
|
|
492
492
|
getFormData = (e) => {
|
|
493
|
-
|
|
493
|
+
|
|
494
494
|
const response = {
|
|
495
495
|
action: "getFormData",
|
|
496
496
|
value: this.getTransformedData(this.state.formData),
|
|
@@ -753,7 +753,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
753
753
|
};
|
|
754
754
|
|
|
755
755
|
moveToTemplates = () => {
|
|
756
|
-
|
|
756
|
+
|
|
757
757
|
const modalContent = {
|
|
758
758
|
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
759
759
|
body: this.props.intl.formatMessage(messages.goBackConfirmation),
|
|
@@ -783,7 +783,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
783
783
|
tempContainer = this.injectContainer(tempContainer);
|
|
784
784
|
return tempContainer;
|
|
785
785
|
});
|
|
786
|
-
|
|
786
|
+
|
|
787
787
|
this.setState({schema, isSchemaChanged: true}, () => {
|
|
788
788
|
this.removeStandAlone();
|
|
789
789
|
});
|
|
@@ -827,7 +827,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
827
827
|
temp.injectedEvents = {};
|
|
828
828
|
|
|
829
829
|
_.forEach(col.supportedEvents, (event) => {
|
|
830
|
-
|
|
830
|
+
|
|
831
831
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
832
832
|
});
|
|
833
833
|
return true;
|
|
@@ -932,7 +932,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
932
932
|
};
|
|
933
933
|
|
|
934
934
|
startTemplateCreation = (data) => {
|
|
935
|
-
|
|
935
|
+
|
|
936
936
|
const content = data.content;
|
|
937
937
|
const id = _.uniqueId();
|
|
938
938
|
const tempData = {
|
|
@@ -950,18 +950,18 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
950
950
|
};
|
|
951
951
|
|
|
952
952
|
startLoading = (ifEdit) => {
|
|
953
|
-
|
|
953
|
+
|
|
954
954
|
if (ifEdit) {
|
|
955
955
|
this.setState({loading: true});
|
|
956
956
|
}
|
|
957
957
|
};
|
|
958
958
|
|
|
959
959
|
handleFrameTasks = (e) => {
|
|
960
|
-
|
|
960
|
+
|
|
961
961
|
const type = e.data;
|
|
962
|
-
|
|
962
|
+
|
|
963
963
|
if (typeof type === 'object') {
|
|
964
|
-
|
|
964
|
+
|
|
965
965
|
const action = type.action;
|
|
966
966
|
switch (action) {
|
|
967
967
|
case "startTemplateCreation":
|
|
@@ -982,15 +982,15 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
982
982
|
this.getFormData(e);
|
|
983
983
|
break;
|
|
984
984
|
case "startTemplateCreation":
|
|
985
|
-
|
|
985
|
+
|
|
986
986
|
//this.getFormData(e);
|
|
987
987
|
break;
|
|
988
988
|
case "moveToTemplates":
|
|
989
|
-
|
|
989
|
+
|
|
990
990
|
this.moveToTemplates();
|
|
991
991
|
break;
|
|
992
992
|
case "validateContent":
|
|
993
|
-
|
|
993
|
+
|
|
994
994
|
this.validateContent(e);
|
|
995
995
|
break;
|
|
996
996
|
default:
|
|
@@ -1012,7 +1012,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1012
1012
|
};
|
|
1013
1013
|
|
|
1014
1014
|
validateContent = (e) => {
|
|
1015
|
-
|
|
1015
|
+
|
|
1016
1016
|
const response = {
|
|
1017
1017
|
action: "validateContent",
|
|
1018
1018
|
value: this.state.isFormValid,
|
|
@@ -1059,7 +1059,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1059
1059
|
const colId = (paneIndex + 1) > 1 ? col.id + (paneIndex + 1) : col.id;
|
|
1060
1060
|
if (colId === id) {
|
|
1061
1061
|
const inputId = `secondary-cta-${paneIndex}`;
|
|
1062
|
-
|
|
1062
|
+
|
|
1063
1063
|
child.inputFields.splice(fieldIndex, 1, {
|
|
1064
1064
|
rowClassName: 'mobile-push-row',
|
|
1065
1065
|
cols: [
|
|
@@ -1172,7 +1172,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1172
1172
|
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1173
1173
|
_.forEach(inputField.cols, (col) => {
|
|
1174
1174
|
if (col.id.indexOf(`secondary-cta-${currentTab - 1}-table`) > -1) {
|
|
1175
|
-
|
|
1175
|
+
|
|
1176
1176
|
const inputId = `secondary-cta-${paneIndex}`;
|
|
1177
1177
|
|
|
1178
1178
|
formChaild.inputFields[fieldIndex] = {
|
|
@@ -1386,7 +1386,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1386
1386
|
_.forEach(inputField.cols, (col) => {
|
|
1387
1387
|
const colId = `${col.id}${this.state.currentTab > 1 ? this.state.currentTab : ''}`;
|
|
1388
1388
|
if (colId === id) {
|
|
1389
|
-
|
|
1389
|
+
|
|
1390
1390
|
child.inputFields.splice(fieldIndex, 1, {
|
|
1391
1391
|
rowClassName: 'mobile-push-row',
|
|
1392
1392
|
cols: [
|
|
@@ -1513,7 +1513,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1513
1513
|
if (col.id === id) {
|
|
1514
1514
|
if (col.fieldsCount < col.fieldsLimit) {
|
|
1515
1515
|
const inputId = `secondary-cta-${col.fieldsCount}`;
|
|
1516
|
-
|
|
1516
|
+
|
|
1517
1517
|
child.inputFields.splice(fieldIndex, 0, {
|
|
1518
1518
|
rowClassName: 'mobile-push-row',
|
|
1519
1519
|
cols: [
|
|
@@ -1716,7 +1716,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1716
1716
|
};
|
|
1717
1717
|
|
|
1718
1718
|
showCtaKeys = (eventTriggered, formData, field) => {
|
|
1719
|
-
|
|
1719
|
+
|
|
1720
1720
|
const schema = _.cloneDeep(this.state.schema);
|
|
1721
1721
|
const eventsMap = _.cloneDeep(this.state.eventsMap);
|
|
1722
1722
|
_.forEach(schema.containers, (container) => {
|
|
@@ -1799,8 +1799,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1799
1799
|
return row;
|
|
1800
1800
|
// formChaild.inputFields[fieldIndex + index] = field;
|
|
1801
1801
|
});
|
|
1802
|
-
|
|
1803
|
-
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
1804
|
const configkeys = _.filter(JSON.parse(deeplinks), (dl) => dl.link === this.state.formData[this.state.currentTab - 1][field.id]);
|
|
1805
1805
|
if (configkeys.length) {
|
|
1806
1806
|
const options = configkeys[0].keys;
|
|
@@ -1828,9 +1828,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1828
1828
|
this.injectEvents(schema);
|
|
1829
1829
|
};
|
|
1830
1830
|
saveFormData = (formData) => {
|
|
1831
|
-
|
|
1831
|
+
|
|
1832
1832
|
const obj = this.getTransformedData(formData);
|
|
1833
|
-
|
|
1833
|
+
|
|
1834
1834
|
this.props.actions.createTemplate(obj);
|
|
1835
1835
|
};
|
|
1836
1836
|
deleteSecondaryCtaIos = (event) => {
|
|
@@ -2158,7 +2158,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
2158
2158
|
this.injectEvents(schema);
|
|
2159
2159
|
};
|
|
2160
2160
|
handleOnTagsContextChange = (data) => {
|
|
2161
|
-
|
|
2161
|
+
|
|
2162
2162
|
const query = {
|
|
2163
2163
|
layout: 'mobilepush',
|
|
2164
2164
|
type: 'TAG',
|
|
@@ -9,7 +9,7 @@ import * as types from './constants';
|
|
|
9
9
|
export function* createTemplate(template) {
|
|
10
10
|
let errorMsg;
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
const result = yield call(Api.createMobilePushTemplate, template);
|
|
14
14
|
if (result.message || result.status.code === 500) {
|
|
15
15
|
errorMsg = result.message;
|
|
@@ -37,7 +37,7 @@ export function* getIosCtas(licenseCode) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function* watchCreateTemplate() {
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
const watcher = yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
42
42
|
yield take(LOCATION_CHANGE);
|
|
43
43
|
yield cancel(watcher);
|
|
@@ -14,14 +14,14 @@ export function defaultAction() {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function editTemplate(template) {
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
return {
|
|
19
19
|
type: types.EDIT_TEMPLATE_REQUEST, template,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function getTemplateDetails(id) {
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
return {
|
|
26
26
|
type: types.GET_TEMPLATE_DETAILS_REQUEST, id,
|
|
27
27
|
};
|
|
@@ -41,7 +41,7 @@ export function uploadAsset(file, assetType, fileParams, mode) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
export function clearEditResponse() {
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
return {
|
|
46
46
|
type: types.CLEAR_EDIT_RESPONSE_REQUEST,
|
|
47
47
|
};
|
|
@@ -161,7 +161,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
componentWillMount() {
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
this.props.actions.getWeCrmAccounts("mobilepush");
|
|
166
166
|
if (!this.props.Templates.selectedWeChatAccount && this.props.location.query.type !== 'embedded') {
|
|
167
167
|
const type = this.props.location.query.type;
|
|
@@ -176,7 +176,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
176
176
|
type: 'LAYOUT',
|
|
177
177
|
};
|
|
178
178
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
componentDidMount() {
|
|
@@ -205,7 +205,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
205
205
|
}
|
|
206
206
|
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.Edit.selectedWeChatAccount);
|
|
207
207
|
if (this.props.location.query.type === 'embedded' && !nextProps.Edit.fetchingWeCrmAccounts && !_.isEqual(this.props.Edit.weCrmAccounts, nextProps.Edit.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
this.setMobilePushAccountOptions(nextProps.Edit.weCrmAccounts);
|
|
210
210
|
}
|
|
211
211
|
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") {
|
|
@@ -256,7 +256,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
256
256
|
this.setState({iosCtasData: nextProps.Edit.iosCtasData});
|
|
257
257
|
}
|
|
258
258
|
if (nextProps.Edit.editResponse && nextProps.Edit.editResponse.templateId) {
|
|
259
|
-
|
|
259
|
+
|
|
260
260
|
this.resetSchema();
|
|
261
261
|
this.setState({
|
|
262
262
|
formData: {},
|
|
@@ -294,7 +294,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
294
294
|
});
|
|
295
295
|
};
|
|
296
296
|
onFormDataChange = (formData, tabCount, currentTab) => {
|
|
297
|
-
|
|
297
|
+
|
|
298
298
|
const newFormData = _.cloneDeep(formData);
|
|
299
299
|
if (newFormData[this.state.currentTab - 1] && newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`]) {
|
|
300
300
|
newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-label`] = newFormData[this.state.currentTab - 1][`secondary-cta-${this.state.currentTab - 1}-table`].name;
|
|
@@ -339,7 +339,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
339
339
|
if (inputField) {
|
|
340
340
|
_.forEach(inputField.cols, (col) => {
|
|
341
341
|
if (col.id === field.id && currentTab === paneIndex + 1) {
|
|
342
|
-
|
|
342
|
+
|
|
343
343
|
const ck = selectedWeChatAccount.configs ? !!selectedWeChatAccount.configs.deeplink : false;
|
|
344
344
|
const deepLinkOptions = _.map(JSON.parse(ck ? selectedWeChatAccount.configs.deeplink : '[]'), (link) => ({label: link.name, value: link.link, title: link.link }) );
|
|
345
345
|
const deeplinkValue = formData[currentTab - 1][field.id];
|
|
@@ -483,12 +483,12 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
483
483
|
};
|
|
484
484
|
|
|
485
485
|
onTabChange = (data) => {
|
|
486
|
-
|
|
486
|
+
|
|
487
487
|
this.setState({currentTab: data});
|
|
488
488
|
};
|
|
489
489
|
|
|
490
490
|
onTagSelect = (data, currentTab, srcComp) => {
|
|
491
|
-
|
|
491
|
+
|
|
492
492
|
const editorId = srcComp.target;
|
|
493
493
|
this.insertAtCursor(document.getElementById(editorId), `{{${data}}}`, currentTab);
|
|
494
494
|
document.getElementById(editorId).focus();
|
|
@@ -797,7 +797,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
797
797
|
getMappedEvent = (id, event) => {
|
|
798
798
|
const map = this.state.eventsMap;
|
|
799
799
|
if (!map[id] || !map[id][event]) {
|
|
800
|
-
|
|
800
|
+
|
|
801
801
|
}
|
|
802
802
|
return map[id][event];
|
|
803
803
|
};
|
|
@@ -812,13 +812,13 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
812
812
|
};
|
|
813
813
|
|
|
814
814
|
getFormData = (e) => {
|
|
815
|
-
|
|
815
|
+
|
|
816
816
|
const response = {
|
|
817
817
|
action: "getFormData",
|
|
818
818
|
value: this.getTransformedData(this.state.formData),
|
|
819
819
|
validity: this.state.isFormValid,
|
|
820
820
|
};
|
|
821
|
-
|
|
821
|
+
|
|
822
822
|
this.setState({checkValidation: true});
|
|
823
823
|
if (e) {
|
|
824
824
|
e.source.postMessage(JSON.stringify(response), e.origin);
|
|
@@ -828,7 +828,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
828
828
|
|
|
829
829
|
|
|
830
830
|
setEditState(data, schema) {
|
|
831
|
-
|
|
831
|
+
|
|
832
832
|
const tabCount = Object.keys(data.versions.base).length;
|
|
833
833
|
const formData = {};
|
|
834
834
|
if (this.props.location.query.type === 'embedded' && this.props.location.query.module === "loyalty") {
|
|
@@ -958,7 +958,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
958
958
|
formData[0].base = true;
|
|
959
959
|
// formData[0].tabKey = '1';
|
|
960
960
|
// formData[1].tabKey = '2';
|
|
961
|
-
|
|
961
|
+
|
|
962
962
|
this.getSchemaForFormData(formData, schema);
|
|
963
963
|
this.setState({tabCount, formData, editData: data, currentTab: 1});
|
|
964
964
|
}
|
|
@@ -1108,7 +1108,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1108
1108
|
_.forEach(child.inputFields, (inputField, fieldIndex) => {
|
|
1109
1109
|
_.forEach(inputField.cols, (col) => {
|
|
1110
1110
|
if (col.id.indexOf(`secondary-cta-${currentTab - 1}-table`) > -1 || (field && field.id === col.id)) {
|
|
1111
|
-
|
|
1111
|
+
|
|
1112
1112
|
const inputId = `secondary-cta-${paneIndex}`;
|
|
1113
1113
|
|
|
1114
1114
|
formChaild.inputFields[fieldIndex] = {
|
|
@@ -1668,7 +1668,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1668
1668
|
|
|
1669
1669
|
|
|
1670
1670
|
startTemplateCreation = (data) => {
|
|
1671
|
-
|
|
1671
|
+
|
|
1672
1672
|
if (!this.state.isContentEditLoaded && this.state.fullSchema && this.props.Edit.weCrmAccounts) {
|
|
1673
1673
|
const schema = JSON.stringify(data).indexOf("BIG_PICTURE") > -1 ? this.state.fullSchema.imageSchema : this.state.fullSchema.textSchema;
|
|
1674
1674
|
this.setMobilePushAccountOptions(this.props.Edit.weCrmAccounts, data.content.accId);
|
|
@@ -1684,7 +1684,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1684
1684
|
}
|
|
1685
1685
|
};
|
|
1686
1686
|
discardValues = () => {
|
|
1687
|
-
|
|
1687
|
+
|
|
1688
1688
|
this.resetSchema();
|
|
1689
1689
|
this.setState({
|
|
1690
1690
|
formData: {},
|
|
@@ -1710,7 +1710,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1710
1710
|
|
|
1711
1711
|
};
|
|
1712
1712
|
moveToTemplates = () => {
|
|
1713
|
-
|
|
1713
|
+
|
|
1714
1714
|
const modalContent = {
|
|
1715
1715
|
title: this.props.intl.formatMessage(messages.alertMessage),
|
|
1716
1716
|
body: this.props.intl.formatMessage(messages.goBackConfirmation),
|
|
@@ -1787,17 +1787,17 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1787
1787
|
};
|
|
1788
1788
|
|
|
1789
1789
|
saveFormData = (formData) => {
|
|
1790
|
-
|
|
1790
|
+
|
|
1791
1791
|
const obj = this.getTransformedData(formData);
|
|
1792
|
-
|
|
1792
|
+
|
|
1793
1793
|
this.props.actions.editTemplate(obj);
|
|
1794
1794
|
};
|
|
1795
1795
|
handleFrameTasks = (e) => {
|
|
1796
|
-
//
|
|
1796
|
+
//
|
|
1797
1797
|
const type = e.data;
|
|
1798
|
-
|
|
1798
|
+
|
|
1799
1799
|
if (typeof type === 'object') {
|
|
1800
|
-
//
|
|
1800
|
+
//
|
|
1801
1801
|
const action = type.action;
|
|
1802
1802
|
switch (action) {
|
|
1803
1803
|
case "startTemplateCreation":
|
|
@@ -1818,15 +1818,15 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1818
1818
|
this.getFormData(e);
|
|
1819
1819
|
break;
|
|
1820
1820
|
case "startTemplateCreation":
|
|
1821
|
-
|
|
1821
|
+
|
|
1822
1822
|
//this.getFormData(e);
|
|
1823
1823
|
break;
|
|
1824
1824
|
case "moveToTemplates":
|
|
1825
|
-
|
|
1825
|
+
|
|
1826
1826
|
this.moveToTemplates();
|
|
1827
1827
|
break;
|
|
1828
1828
|
case "validateContent":
|
|
1829
|
-
|
|
1829
|
+
|
|
1830
1830
|
this.validateContent(e);
|
|
1831
1831
|
break;
|
|
1832
1832
|
default:
|
|
@@ -1930,8 +1930,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1930
1930
|
return row;
|
|
1931
1931
|
// formChaild.inputFields[fieldIndex + index] = field;
|
|
1932
1932
|
});
|
|
1933
|
-
|
|
1934
|
-
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
1935
|
if (!tabIndex) { // removes the existing selected options keys so that newly selected options keys can be added.
|
|
1936
1936
|
const configkeys = _.filter(JSON.parse(ck ? selectedWeChatAccount.configs.deeplink : '[]'), (dl) => dl.link === this.state.formData[currentTab - 1][field.id]);
|
|
1937
1937
|
if (configkeys.length) {
|
|
@@ -1981,7 +1981,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1981
1981
|
_.forEach(inputField.cols, (col) => {
|
|
1982
1982
|
const colId = `${col.id}${this.state.currentTab > 1 ? this.state.currentTab : ''}`;
|
|
1983
1983
|
if (colId === id) {
|
|
1984
|
-
|
|
1984
|
+
|
|
1985
1985
|
child.inputFields.splice(fieldIndex, 1, {
|
|
1986
1986
|
rowClassName: 'mobile-push-row',
|
|
1987
1987
|
cols: [
|
|
@@ -2116,7 +2116,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2116
2116
|
if (col.id === id) {
|
|
2117
2117
|
if (col.fieldsCount < col.fieldsLimit) {
|
|
2118
2118
|
const inputId = `secondary-cta-${col.fieldsCount}`;
|
|
2119
|
-
|
|
2119
|
+
|
|
2120
2120
|
child.inputFields.splice(fieldIndex, 0, {
|
|
2121
2121
|
rowClassName: 'mobile-push-row',
|
|
2122
2122
|
cols: [
|
|
@@ -2305,7 +2305,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2305
2305
|
const colId = (paneIndex + 1) > 1 ? col.id + (paneIndex + 1) : col.id;
|
|
2306
2306
|
if (colId === id) {
|
|
2307
2307
|
const inputId = `secondary-cta-${paneIndex}`;
|
|
2308
|
-
|
|
2308
|
+
|
|
2309
2309
|
child.inputFields.splice(fieldIndex, 1, {
|
|
2310
2310
|
rowClassName: 'mobile-push-row',
|
|
2311
2311
|
cols: [
|
|
@@ -2430,7 +2430,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2430
2430
|
tempContainer = this.injectContainer(tempContainer);
|
|
2431
2431
|
return tempContainer;
|
|
2432
2432
|
});
|
|
2433
|
-
|
|
2433
|
+
|
|
2434
2434
|
this.setState({schema, loadingContentEdit: false}, () => {
|
|
2435
2435
|
this.removeStandAlone();
|
|
2436
2436
|
});
|
|
@@ -2450,7 +2450,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2450
2450
|
this.setState({ schema });
|
|
2451
2451
|
};
|
|
2452
2452
|
handleOnTagsContextChange = (data) => {
|
|
2453
|
-
|
|
2453
|
+
|
|
2454
2454
|
const query = {
|
|
2455
2455
|
layout: 'mobilepush',
|
|
2456
2456
|
type: 'TAG',
|
|
@@ -8,9 +8,9 @@ import * as types from './constants';
|
|
|
8
8
|
export function* editTemplate(template) {
|
|
9
9
|
let errorMsg;
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
const result = yield call(Api.createMobilePushTemplate, template);
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
if (result.message || result.status.code === 500) {
|
|
15
15
|
errorMsg = result.message;
|
|
16
16
|
}
|
|
@@ -22,7 +22,7 @@ export function* editTemplate(template) {
|
|
|
22
22
|
|
|
23
23
|
export function* getTemplateDetails(id) {
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
const result = yield call(Api.getTemplateDetails, id);
|
|
27
27
|
// const sidebar = result.response.sidebar;
|
|
28
28
|
yield put({ type: types.GET_TEMPLATE_DETAILS_SUCCESS, data: result.response });
|
|
@@ -49,7 +49,7 @@ export function* getIosCtas(licenseCode) {
|
|
|
49
49
|
|
|
50
50
|
export function* getMobilepushTemplatesList(params) {
|
|
51
51
|
try {
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
const result = yield call(Api.getAllTemplates, {channel: params.channel, queryParams: params.queryParams});
|
|
54
54
|
yield put({ type: types.GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS, data: result.response.templates, templateData: result.response.mapped});
|
|
55
55
|
} catch (error) {
|
|
@@ -58,7 +58,7 @@ export function* getMobilepushTemplatesList(params) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export function* fetchWeCrmAccounts(action) {
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
try {
|
|
63
63
|
const result = yield call(Api.fetchWeCrmAccounts, action.source);
|
|
64
64
|
yield [
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
|
|
9
9
|
export function createTemplate(template) {
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
return {
|
|
12
12
|
type: types.CREATE_TEMPLATE_REQUEST, template,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function clearCreateResponse() {
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
return {
|
|
19
19
|
type: types.CLEAR_CREATE_RESPONSE_REQUEST,
|
|
20
20
|
};
|