@capillarytech/creatives-library 0.1.9 → 0.1.11
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/Ckeditor/index.js +3 -1
- package/components/FormBuilder/_formBuilder.scss +4 -0
- package/components/FormBuilder/index.js +7 -4
- package/containers/Email/_email.scss +4 -0
- package/containers/Email/actions.js +8 -0
- package/containers/Email/constants.js +4 -0
- package/containers/Email/index.js +12 -5
- package/containers/Email/reducer.js +16 -0
- package/containers/Email/sagas.js +21 -0
- package/containers/MobilePush/Create/index.js +9 -9
- package/containers/MobilePush/Edit/index.js +16 -11
- package/containers/Sms/Create/index.js +5 -4
- package/containers/Sms/Edit/index.js +7 -6
- package/containers/Templates/index.js +6 -2
- package/containers/Templates/sagas.js +1 -0
- package/package.json +1 -1
- package/services/api.js +7 -0
|
@@ -11,13 +11,14 @@ import React, { PropTypes } from 'react';
|
|
|
11
11
|
import _ from 'lodash';
|
|
12
12
|
// import messages from './messages';
|
|
13
13
|
const loadScript = require('load-script');
|
|
14
|
-
const defaultScriptUrl = "https://cdn.ckeditor.com/4.
|
|
14
|
+
const defaultScriptUrl = "https://cdn.ckeditor.com/4.5.0/full/ckeditor.js";
|
|
15
15
|
const user = localStorage.getItem('user');
|
|
16
16
|
let locale = 'en';
|
|
17
17
|
if (user && JSON.parse(user).lang) {
|
|
18
18
|
locale = JSON.parse(user).lang;
|
|
19
19
|
}
|
|
20
20
|
const CKEditorConfig = {
|
|
21
|
+
skin: 'moono',
|
|
21
22
|
toolbar: [
|
|
22
23
|
{ name: 'document', items: ['Source', '-'] },
|
|
23
24
|
{ name: 'clipboard', items: ['Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
|
|
@@ -44,6 +45,7 @@ const CKEditorConfig = {
|
|
|
44
45
|
// Allow all content.
|
|
45
46
|
$1: {
|
|
46
47
|
// elements: this.editorInstance.dtd,
|
|
48
|
+
//elements: window.CKEDITOR.dtd,
|
|
47
49
|
attributes: true,
|
|
48
50
|
styles: true,
|
|
49
51
|
classes: true,
|
|
@@ -457,6 +457,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
459
|
const index = count + 1;
|
|
460
|
+
if (!this.state.formData[count]) {
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
460
463
|
const content = this.state.formData[count][`sms-editor${index > 1 ? index : ''}`];
|
|
461
464
|
const unicodeCheck = this.state.formData[count][`unicode-validity${index > 1 ? index : ''}`];
|
|
462
465
|
const ifUnicode = content && content !== '' ? charCount.checkUnicode(content) : false;
|
|
@@ -761,11 +764,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
761
764
|
this.setState({androidValid, iosValid});
|
|
762
765
|
}
|
|
763
766
|
if (isOnlyAndroid && androidValid) {
|
|
764
|
-
isValid = true;
|
|
767
|
+
isValid = isValid && true;
|
|
765
768
|
} else if (isOnlyIos && iosValid) {
|
|
766
|
-
isValid = true;
|
|
769
|
+
isValid = isValid && true;
|
|
767
770
|
} else if (!isOnlyIos && !isOnlyAndroid && androidValid && iosValid) {
|
|
768
|
-
isValid = true;
|
|
771
|
+
isValid = isValid && true;
|
|
769
772
|
}
|
|
770
773
|
}
|
|
771
774
|
|
|
@@ -936,7 +939,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
936
939
|
}
|
|
937
940
|
|
|
938
941
|
skipTags(tag) {
|
|
939
|
-
const regexGroups = ["dynamic_expiry_date_after_\\
|
|
942
|
+
const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "user_id_b64", "outbox_id_b64", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]"];
|
|
940
943
|
//const regexGroups = [];
|
|
941
944
|
let skipped = false;
|
|
942
945
|
_.forEach(regexGroups, (group) => {
|
|
@@ -13,6 +13,14 @@ export function createTemplate(template) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export function duplicateTemplate(id, channel) {
|
|
17
|
+
return {
|
|
18
|
+
type: types.DUPLICATE_TEMPLATE_REQUEST,
|
|
19
|
+
id,
|
|
20
|
+
channel,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
export function getTemplateDetails(id, channel) {
|
|
17
25
|
console.log('getting template', id, channel);
|
|
18
26
|
return {
|
|
@@ -30,3 +30,7 @@ export const UPLOAD_ASSET_FAILURE = 'app/containers/Email/UPLOAD_ASSET_FAILURE';
|
|
|
30
30
|
|
|
31
31
|
export const CLEAR_EMAIL_CRUD_RESPONSE_REQUEST = "app/containers/Email/CLEAR_EMAIL_CRUD_RESPONSE_REQUEST";
|
|
32
32
|
export const CLEAR_ALL_VALUES = "app/containers/Email/CLEAR_ALL_VALUES";
|
|
33
|
+
|
|
34
|
+
export const DUPLICATE_TEMPLATE_REQUEST = 'app/containers/Email/DUPLICATE_TEMPLATE_REQUEST';
|
|
35
|
+
export const DUPLICATE_TEMPLATE_SUCCESS = 'app/containers/Email/DUPLICATE_TEMPLATE_SUCCESS';
|
|
36
|
+
export const DUPLICATE_TEMPLATE_FAILURE = 'app/containers/Email/DUPLICATE_TEMPLATE_FAILURE';
|
|
@@ -1807,7 +1807,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1807
1807
|
console.log('Tranforming data for embedded mode', tmpData);
|
|
1808
1808
|
}
|
|
1809
1809
|
});
|
|
1810
|
-
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" || this.props.location.query.module === "library")) {
|
|
1810
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "coupon_expiry" || this.props.location.query.module === "timeline" || this.props.location.query.module === "library")) {
|
|
1811
1811
|
newFormData.base.subject = formData['template-subject'];
|
|
1812
1812
|
}
|
|
1813
1813
|
|
|
@@ -2002,7 +2002,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2002
2002
|
|
|
2003
2003
|
showSubject = () => {
|
|
2004
2004
|
const schema = _.cloneDeep(this.state.schema);
|
|
2005
|
-
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" ||
|
|
2005
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" || this.props.location.query.module === "coupon_expiry" ||
|
|
2006
2006
|
this.props.location.query.module === "library")) {
|
|
2007
2007
|
schema.standalone.sections[0].inputFields[0].style.display = "";
|
|
2008
2008
|
schema.standalone.sections[0].inputFields[0].labelStyle.display = "";
|
|
@@ -2487,6 +2487,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2487
2487
|
_.forEach(temp.containers, (container) => {
|
|
2488
2488
|
if (container.isActive) {
|
|
2489
2489
|
let hideLang = false;
|
|
2490
|
+
_.forEach(container.tabContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
2491
|
+
const tempEl = containerInputFieldCol;
|
|
2492
|
+
if (containerInputFieldCol.id === "tab-header") {
|
|
2493
|
+
const baseLanguage = this.props.Global.currentOrgDetails && this.props.Global.currentOrgDetails.basic_details && this.props.Global.currentOrgDetails.basic_details.base_language && this.props.Global.currentOrgDetails.basic_details.base_language !== "" ? this.props.Global.currentOrgDetails.basic_details.base_language : 'English';
|
|
2494
|
+
tempEl.value = baseLanguage;
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2490
2497
|
_.forEach(container.tabBarExtraContent.sections[0].inputFields[0].cols, (containerInputFieldCol) => {
|
|
2491
2498
|
if (hideLang && !ifLangSupported) {
|
|
2492
2499
|
const newContainerInputFieldCol = containerInputFieldCol;
|
|
@@ -2528,8 +2535,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2528
2535
|
if (type === 'embedded') {
|
|
2529
2536
|
this.removeStandAlone();
|
|
2530
2537
|
}
|
|
2531
|
-
if (type === 'embedded' && (this.props.route.name === 'EmailView' || (this.props.location.query.module && (this.props.location.query.module.toLowerCase() === 'loyalty' || this.props.location.query.module.toLowerCase() === 'dvs' || this.props.location.query.module.toLowerCase() === 'timeline')))) {
|
|
2532
|
-
if ((this.props.route.name === "EmailEdit" || this.props.route.name === "EmailCreate") && this.props.location.query.module === "dvs") {
|
|
2538
|
+
if (type === 'embedded' && (this.props.route.name === 'EmailView' || (this.props.location.query.module && (this.props.location.query.module.toLowerCase() === 'loyalty' || this.props.location.query.module.toLowerCase() === 'dvs' || this.props.location.query.module.toLowerCase() === 'coupon_expiry' || this.props.location.query.module.toLowerCase() === 'timeline')))) {
|
|
2539
|
+
if ((this.props.route.name === "EmailEdit" || this.props.route.name === "EmailCreate") && (this.props.location.query.module === "dvs" || this.props.location.query.module.toLowerCase() === 'coupon_expiry')) {
|
|
2533
2540
|
return;
|
|
2534
2541
|
}
|
|
2535
2542
|
const response = {
|
|
@@ -2557,7 +2564,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2557
2564
|
delete schema.standalone;
|
|
2558
2565
|
schema.standalone = {};
|
|
2559
2566
|
schema.standalone.sections = [];
|
|
2560
|
-
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" ||
|
|
2567
|
+
if (this.props.location.query.type === 'embedded' && (this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "coupon_expiry" || this.props.location.query.module === "timeline" ||
|
|
2561
2568
|
this.props.location.query.module === "library")) {
|
|
2562
2569
|
schema.standalone.sections.push(_.cloneDeep(this.state.schema.standalone.sections[0]));
|
|
2563
2570
|
}
|
|
@@ -32,6 +32,22 @@ function emailReducer(state = initialState, action) {
|
|
|
32
32
|
.set('createTemplateInProgress', false)
|
|
33
33
|
.set('createTemplateError', true)
|
|
34
34
|
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
35
|
+
case types.DUPLICATE_TEMPLATE_REQUEST:
|
|
36
|
+
return state
|
|
37
|
+
.set('createTemplateInProgress', true)
|
|
38
|
+
.set('createTemplateError', false)
|
|
39
|
+
.set('createTemplateErrorMessage', fromJS(""));
|
|
40
|
+
case types.DUPLICATE_TEMPLATE_SUCCESS:
|
|
41
|
+
return state
|
|
42
|
+
.set('createTemplateInProgress', false)
|
|
43
|
+
.set('createResponse', action.data)
|
|
44
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg))
|
|
45
|
+
.set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300));
|
|
46
|
+
case types.DUPLICATE_TEMPLATE_FAILURE:
|
|
47
|
+
return state
|
|
48
|
+
.set('createTemplateInProgress', false)
|
|
49
|
+
.set('createTemplateError', true)
|
|
50
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
35
51
|
case types.GET_TEMPLATE_DETAILS_REQUEST:
|
|
36
52
|
return state
|
|
37
53
|
.set('getTemplateDetailsInProgress', true);
|
|
@@ -18,6 +18,20 @@ export function* createTemplate(template) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export function* duplicateTemplate(id, channel) {
|
|
22
|
+
let errorMsg;
|
|
23
|
+
try {
|
|
24
|
+
console.log('Duplicate template ', id, channel);
|
|
25
|
+
const result = yield call(Api.duplicateTemplate, id, channel );
|
|
26
|
+
if (result.message || result.status.code === 500) {
|
|
27
|
+
errorMsg = result.message;
|
|
28
|
+
}
|
|
29
|
+
yield put({ type: types.DUPLICATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
30
|
+
} catch (error) {
|
|
31
|
+
yield put({ type: types.DUPLICATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
export function* getTemplateDetails(id) {
|
|
22
36
|
try {
|
|
23
37
|
console.log('saga get Template details', id);
|
|
@@ -104,6 +118,12 @@ function* watchUploadAsset() {
|
|
|
104
118
|
yield cancel(watcher);
|
|
105
119
|
}
|
|
106
120
|
|
|
121
|
+
function* watchDuplicateTemplate() {
|
|
122
|
+
const watcher = yield takeLatest(types.DUPLICATE_TEMPLATE_REQUEST, duplicateTemplate);
|
|
123
|
+
yield take(LOCATION_CHANGE);
|
|
124
|
+
yield cancel(watcher);
|
|
125
|
+
}
|
|
126
|
+
|
|
107
127
|
// All sagas to be loaded
|
|
108
128
|
export default [
|
|
109
129
|
watchCreateTemplate,
|
|
@@ -112,4 +132,5 @@ export default [
|
|
|
112
132
|
watchGetCmsSetting,
|
|
113
133
|
watchGetCmsData,
|
|
114
134
|
watchUploadAsset,
|
|
135
|
+
watchDuplicateTemplate,
|
|
115
136
|
];
|
|
@@ -193,7 +193,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
193
193
|
console.log('recieved props ', nextProps, nextProps.Create, this.props.Create);
|
|
194
194
|
if (nextProps.Create.uploadedAssetData) {
|
|
195
195
|
const formData = _.cloneDeep(this.state.formData);
|
|
196
|
-
formData[this.state.currentTab - 1].image = nextProps.Create.uploadedAssetData.metaInfo.
|
|
196
|
+
formData[this.state.currentTab - 1].image = nextProps.Create.uploadedAssetData.metaInfo.public_url;
|
|
197
197
|
this.setState({formData});
|
|
198
198
|
this.props.actions.clearAsset();
|
|
199
199
|
}
|
|
@@ -496,7 +496,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
496
496
|
console.log('posting final result', this.state.formData);
|
|
497
497
|
const response = {
|
|
498
498
|
action: "getFormData",
|
|
499
|
-
value: this.state.formData,
|
|
499
|
+
value: this.getTransformedData(this.state.formData),
|
|
500
500
|
validity: this.state.isFormValid,
|
|
501
501
|
};
|
|
502
502
|
this.setState({checkValidation: true});
|
|
@@ -571,9 +571,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
571
571
|
"message": ios['message-title2'],
|
|
572
572
|
"ctas": [
|
|
573
573
|
|
|
574
|
-
],
|
|
575
|
-
"nonActionableCta": [
|
|
576
|
-
|
|
577
574
|
],
|
|
578
575
|
"categoryId": ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].id : undefined,
|
|
579
576
|
},
|
|
@@ -696,8 +693,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
696
693
|
"actionText": ios['secondary-cta-1-label'],
|
|
697
694
|
"actionLabel": ios['secondary-cta-1-action'],
|
|
698
695
|
"actionLabel2": ios['secondary-cta-1-action2'],
|
|
699
|
-
"type": ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
700
|
-
"actionLink": ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? (ios['cta-deeplink-secondary-cta-1-select2'] || ios['cta-deeplink-secondary-cta-1-select']) : ios['cta-deeplink-secondary-cta-1-text'],
|
|
696
|
+
"type": ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
|
|
697
|
+
"actionLink": ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? (ios['cta-deeplink-secondary-cta-1-select2'] || ios['cta-deeplink-secondary-cta-1-select']) : ios['cta-deeplink-secondary-cta-1-text']),
|
|
701
698
|
"ioscdeepLinkName": this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
|
|
702
699
|
'templateCtaId': ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].ctaTemplateDetails[0].id : undefined,
|
|
703
700
|
};
|
|
@@ -1160,7 +1157,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1160
1157
|
showSelectedIosCta = (selectedConfig) => {
|
|
1161
1158
|
const currentTab = this.state.currentTab;
|
|
1162
1159
|
const schema = _.cloneDeep(this.state.schema);
|
|
1163
|
-
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount : '[]';
|
|
1160
|
+
const deeplinks = this.props.Templates.selectedWeChatAccount && this.props.Templates.selectedWeChatAccount.configs && !!this.props.Templates.selectedWeChatAccount.configs.deeplink ? this.props.Templates.selectedWeChatAccount.configs.deeplink : '[]';
|
|
1164
1161
|
const deepLinkOptions = this.props.Templates.selectedWeChatAccount ? _.map(JSON.parse(deeplinks), (link) => ({label: link.name, value: link.link, title: link.link }) ) : [];
|
|
1165
1162
|
_.forEach(schema.containers, (container) => {
|
|
1166
1163
|
_.forEach(container.panes, (pane, paneIndex) => {
|
|
@@ -1705,7 +1702,10 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1705
1702
|
const message = getMessageObject('error', this.props.intl.formatMessage(messages["File size cannot be more than 5mb"]), true);
|
|
1706
1703
|
this.props.globalActions.addMessageToQueue(message);
|
|
1707
1704
|
} else {
|
|
1708
|
-
|
|
1705
|
+
const name = data.file.name.split('.');
|
|
1706
|
+
const blob = data.file.slice(0, -1, 'image');
|
|
1707
|
+
const newFile = new File([blob], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1708
|
+
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1709
1709
|
}
|
|
1710
1710
|
};
|
|
1711
1711
|
selectCtaIos = (selectedConfig) => {
|
|
@@ -234,7 +234,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
234
234
|
}
|
|
235
235
|
if (nextProps.Edit.uploadedAssetData) {
|
|
236
236
|
const formData = _.cloneDeep(this.state.formData);
|
|
237
|
-
formData[this.state.currentTab - 1].image = nextProps.Edit.uploadedAssetData.metaInfo.
|
|
237
|
+
formData[this.state.currentTab - 1].image = nextProps.Edit.uploadedAssetData.metaInfo.public_url;
|
|
238
238
|
this.setState({formData});
|
|
239
239
|
this.props.actions.clearAsset();
|
|
240
240
|
}
|
|
@@ -628,9 +628,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
628
628
|
"message": ios['message-title2'],
|
|
629
629
|
"ctas": [
|
|
630
630
|
|
|
631
|
-
],
|
|
632
|
-
"nonActionableCta": [
|
|
633
|
-
|
|
634
631
|
],
|
|
635
632
|
"categoryId": ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].id : undefined,
|
|
636
633
|
},
|
|
@@ -751,8 +748,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
751
748
|
"actionText": ios['secondary-cta-1-label'],
|
|
752
749
|
"actionLabel": ios['secondary-cta-1-action'],
|
|
753
750
|
"actionLabel2": ios['secondary-cta-1-action2'],
|
|
754
|
-
"type": ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
755
|
-
"actionLink": ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? ios['cta-deeplink-secondary-cta-1-select2'] : ios['cta-deeplink-secondary-cta-1-text2'],
|
|
751
|
+
"type": ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
|
|
752
|
+
"actionLink": ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? ios['cta-deeplink-secondary-cta-1-select2'] : ios['cta-deeplink-secondary-cta-1-text2']),
|
|
756
753
|
"ioscdeepLinkName": this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
|
|
757
754
|
'templateCtaId': ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].ctaTemplateDetails[0].id : undefined,
|
|
758
755
|
};
|
|
@@ -925,7 +922,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
925
922
|
ios.image = iosData.expandableDetails.image;
|
|
926
923
|
}
|
|
927
924
|
if (iosData.expandableDetails && iosData.expandableDetails.ctas && iosData.expandableDetails.ctas.length) {
|
|
928
|
-
|
|
925
|
+
if (iosData.expandableDetails.ctas[0].type) {
|
|
926
|
+
ios['cta-deeplink-secondary-cta-1'] = iosData.expandableDetails.ctas[0].type === "DEEP_LINK" ? "Deeplink" : "External Link";
|
|
927
|
+
}
|
|
929
928
|
if (iosData.expandableDetails.ctas[0].type === "DEEP_LINK") {
|
|
930
929
|
ios['cta-deeplink-secondary-cta-1-select2'] = iosData.expandableDetails.ctas[0].actionLink;
|
|
931
930
|
} else {
|
|
@@ -982,7 +981,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
982
981
|
schema = this.showCtaKeys(true, formData, {id: 'cta-deeplink2-select'}, 2, schema);
|
|
983
982
|
}
|
|
984
983
|
if (formData[1]['secondary-cta-1-action']) {
|
|
985
|
-
schema = this.showSelectedIosCta(schema, {id: 'add-sec-cta-ios'}, 2);
|
|
984
|
+
schema = this.showSelectedIosCta(schema, {id: 'add-sec-cta-ios'}, 2, undefined, formData[1]['cta-deeplink-secondary-cta-1']);
|
|
986
985
|
schema = this.onLinkTypeChange(true, formData, {id: 'cta-deeplink-secondary-cta-1'}, 2, schema);
|
|
987
986
|
schema = this.showCtaKeys(true, formData, {id: 'cta-deeplink-secondary-cta-1-select2'}, 2, schema);
|
|
988
987
|
}
|
|
@@ -1055,7 +1054,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1055
1054
|
const message = getMessageObject('error', this.props.intl.formatMessage(messages['File size cannot be more than 5mb']), true);
|
|
1056
1055
|
this.props.globalActions.addMessageToQueue(message);
|
|
1057
1056
|
} else {
|
|
1058
|
-
|
|
1057
|
+
const name = data.file.name.split('.');
|
|
1058
|
+
const blob = data.file.slice(0, -1, 'image');
|
|
1059
|
+
const newFile = new File([blob], `${name[0]}${Date.now()}.${name[1]}`, {type: 'image'});
|
|
1060
|
+
this.props.actions.uploadAsset(newFile, data.type, data.fileParams);
|
|
1059
1061
|
}
|
|
1060
1062
|
};
|
|
1061
1063
|
|
|
@@ -1080,7 +1082,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1080
1082
|
}
|
|
1081
1083
|
};
|
|
1082
1084
|
|
|
1083
|
-
showSelectedIosCta = (inputSchema, field, tab, selectedConfig) => {
|
|
1085
|
+
showSelectedIosCta = (inputSchema, field, tab, selectedConfig, showDeeplink) => {
|
|
1084
1086
|
const currentTab = tab || this.state.currentTab;
|
|
1085
1087
|
const schema = inputSchema ? _.cloneDeep(inputSchema) : _.cloneDeep(this.state.schema);
|
|
1086
1088
|
const selectedWeChatAccount = (!_.isEmpty(this.props.Templates.selectedWeChatAccount) ? this.props.Templates.selectedWeChatAccount : this.props.Edit.selectedWeChatAccount);
|
|
@@ -1198,7 +1200,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1198
1200
|
},
|
|
1199
1201
|
],
|
|
1200
1202
|
};
|
|
1201
|
-
|
|
1203
|
+
let showDeeplinkOption = selectedConfig ? (selectedConfig.id !== "16589g0g" && selectedConfig.id !== "17543720" && selectedConfig.id !== "1a491g56") : true;
|
|
1204
|
+
if (!selectedConfig) {
|
|
1205
|
+
showDeeplinkOption = showDeeplink;
|
|
1206
|
+
}
|
|
1202
1207
|
if (showDeeplinkOption) {
|
|
1203
1208
|
formChaild.inputFields[fieldIndex + 2] = {
|
|
1204
1209
|
rowClassName: "mobile-push-row",
|
|
@@ -95,16 +95,17 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
95
95
|
};
|
|
96
96
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
97
97
|
const type = this.props.location.query.type;
|
|
98
|
-
const module = this.props.location.query.module;
|
|
98
|
+
// const module = this.props.location.query.module;
|
|
99
99
|
const name = this.props.route.name;
|
|
100
100
|
window.addEventListener("message", this.handleFrameTasks);
|
|
101
101
|
if (type === 'embedded') {
|
|
102
102
|
const response = {
|
|
103
103
|
action: 'startTemplateCreation',
|
|
104
|
+
window: name === 'view' ? 'view' : 'create',
|
|
104
105
|
};
|
|
105
|
-
if (name !== "view" && module.toLowerCase() === "timeline") {
|
|
106
|
-
|
|
107
|
-
}
|
|
106
|
+
// if (name !== "view" && module.toLowerCase() === "timeline") {
|
|
107
|
+
// return;
|
|
108
|
+
// }
|
|
108
109
|
parent.postMessage(JSON.stringify(response), '*');
|
|
109
110
|
}
|
|
110
111
|
//For testing embedded mode data injection
|
|
@@ -94,16 +94,17 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
94
94
|
this.props.actions.getTemplateDetails(this.props.params.id);
|
|
95
95
|
}
|
|
96
96
|
const type = this.props.location.query.type;
|
|
97
|
-
const module = this.props.location.query.module;
|
|
98
|
-
const name = this.props.route.name;
|
|
97
|
+
// const module = this.props.location.query.module;
|
|
98
|
+
// const name = this.props.route.name;
|
|
99
99
|
window.addEventListener("message", this.handleFrameTasks);
|
|
100
100
|
if (type === 'embedded') {
|
|
101
101
|
const response = {
|
|
102
102
|
action: 'startTemplateCreation',
|
|
103
|
+
window: 'edit',
|
|
103
104
|
};
|
|
104
|
-
if (name !== "view" && module.toLowerCase() === "timeline") {
|
|
105
|
-
|
|
106
|
-
}
|
|
105
|
+
// if (name !== "view" && module.toLowerCase() === "timeline") {
|
|
106
|
+
// return;
|
|
107
|
+
// }
|
|
107
108
|
parent.postMessage(JSON.stringify(response), '*');
|
|
108
109
|
}
|
|
109
110
|
}
|
|
@@ -1437,7 +1438,7 @@ Edit.propTypes = {
|
|
|
1437
1438
|
intl: intlShape.isRequired,
|
|
1438
1439
|
templateData: PropTypes.object,
|
|
1439
1440
|
supportedTags: PropTypes.array,
|
|
1440
|
-
route: PropTypes.object,
|
|
1441
|
+
// route: PropTypes.object,
|
|
1441
1442
|
};
|
|
1442
1443
|
|
|
1443
1444
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -244,7 +244,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
244
244
|
if (this.state.channel.toLowerCase() === "email" && nextProps.EmailCreate && nextProps.EmailCreate.createResponse && nextProps.EmailCreate.createResponse.templateId && nextProps.EmailCreate.createResponse.templateId !== '') {
|
|
245
245
|
const message = getMessageObject('success', `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`, true);
|
|
246
246
|
this.props.globalActions.addMessageToQueue(message);
|
|
247
|
-
this.getAllTemplates({params});
|
|
247
|
+
this.getAllTemplates({params, resetPage: true});
|
|
248
248
|
this.props.emailActions.clearStoreValues();
|
|
249
249
|
}
|
|
250
250
|
|
|
@@ -277,6 +277,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
277
277
|
const isLanguageSupport = (this.props.location.query.isLanguageSupport) ? this.props.location.query.isLanguageSupport : true;
|
|
278
278
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
279
279
|
const type = this.props.location.query.type;
|
|
280
|
+
if (module && module === 'library') {
|
|
281
|
+
this.props.createNew();
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
280
284
|
this.props.router.push({
|
|
281
285
|
pathname: `/${nextProps.route.name.toLowerCase()}/create`,
|
|
282
286
|
query: type === 'embedded' ? {type: 'embedded', module, isLanguageSupport, isEdmSupport} : {module},
|
|
@@ -745,7 +749,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
745
749
|
} else if (this.state.channel.toLowerCase() === "ebill") {
|
|
746
750
|
this.props.ebillActions.createTemplate(duplicateObj);
|
|
747
751
|
} else if (this.state.channel.toLowerCase() === "email") {
|
|
748
|
-
this.props.emailActions.
|
|
752
|
+
this.props.emailActions.duplicateTemplate(template._id, "EMAIL");
|
|
749
753
|
}
|
|
750
754
|
}
|
|
751
755
|
|
|
@@ -74,6 +74,7 @@ export function* sendZippedFile({selectedFile}) {
|
|
|
74
74
|
errorMessage = result.message;
|
|
75
75
|
}
|
|
76
76
|
console.log("Got Result ", result);
|
|
77
|
+
console.log("Got decoded result", decodeURIComponent(result.response.metaEntity.htmlContent));
|
|
77
78
|
yield [
|
|
78
79
|
put({
|
|
79
80
|
type: types.SEND_ZIPPED_FILE_SUCCESS,
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -178,6 +178,13 @@ export const createMobilePushTemplate = ({template}) => {
|
|
|
178
178
|
const url = `${API_ENDPOINT}/templates/MOBILEPUSH`;
|
|
179
179
|
return request(url, getAPICallObject('POST', template));
|
|
180
180
|
};
|
|
181
|
+
|
|
182
|
+
export const duplicateTemplate = ({id, channel}) => {
|
|
183
|
+
console.log('in api.js duplicateTemplate', id, channel);
|
|
184
|
+
const url = `${API_ENDPOINT}/templates/duplicate/${id}/${channel}`;
|
|
185
|
+
return request(url, getAPICallObject('GET'));
|
|
186
|
+
};
|
|
187
|
+
|
|
181
188
|
export const editWeChatTemplate = ({template}) => {
|
|
182
189
|
console.log('in api.js', template);
|
|
183
190
|
const url = `${API_ENDPOINT}/templates/WECHAT`;
|