@capillarytech/creatives-library 2.0.13 → 2.0.14
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/containers/Ebill/index.js +2 -1
- package/containers/Line/Create/index.js +2 -1
- package/containers/Line/Edit/index.js +54 -52
- package/containers/MobilePush/Create/index.js +81 -79
- package/containers/MobilePush/Edit/index.js +79 -77
- package/containers/Sms/Create/index.js +9 -8
- package/containers/Sms/Edit/index.js +2 -483
- package/containers/WeChat/index.js +5 -5
- package/package.json +1 -1
- package/utils/callNativeEvent.js +15 -0
|
@@ -24,6 +24,8 @@ import * as templatesActions from "../../Templates/actions";
|
|
|
24
24
|
import {makeSelectTemplates} from "../../Templates/selectors";
|
|
25
25
|
import messages from './messages';
|
|
26
26
|
import './_mobilePushCreate.scss';
|
|
27
|
+
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
28
|
+
|
|
27
29
|
import {makeSelectCreate} from "../Create/selectors";
|
|
28
30
|
const BreadcrumbItem = Breadcrumb.Item;
|
|
29
31
|
|
|
@@ -32,118 +34,118 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
32
34
|
super(props);
|
|
33
35
|
const map = {
|
|
34
36
|
"template-name": {
|
|
35
|
-
|
|
37
|
+
onChange: this.onTemplateNameChange,
|
|
36
38
|
},
|
|
37
39
|
"cta-deeplink-secondary-cta-0": {
|
|
38
|
-
|
|
40
|
+
onChange: this.onLinkTypeChange,
|
|
39
41
|
},
|
|
40
42
|
"cta-deeplink-secondary-cta-1": {
|
|
41
|
-
|
|
43
|
+
onChange: this.onLinkTypeChange,
|
|
42
44
|
},
|
|
43
45
|
"cta-deeplink-delete": {
|
|
44
|
-
|
|
46
|
+
onDelete: this.deletePrimaryCTA,
|
|
45
47
|
},
|
|
46
48
|
"cta-deeplink2-delete": {
|
|
47
|
-
|
|
49
|
+
onDelete: this.deletePrimaryCTA,
|
|
48
50
|
},
|
|
49
51
|
"secondary-cta-0-delete": {
|
|
50
|
-
|
|
52
|
+
onDelete: this.deleteSecondaryCTA,
|
|
51
53
|
},
|
|
52
54
|
"secondary-cta-1-delete": {
|
|
53
|
-
|
|
55
|
+
onDelete: this.deleteSecondaryCTA,
|
|
54
56
|
},
|
|
55
57
|
"secondary-cta-1-delete-ios": {
|
|
56
|
-
|
|
58
|
+
onDelete: this.deleteSecondaryCtaIos,
|
|
57
59
|
},
|
|
58
60
|
"discard-button": {
|
|
59
|
-
|
|
61
|
+
discardValues: this.discardValues,
|
|
60
62
|
},
|
|
61
63
|
"cancel-button": {
|
|
62
|
-
|
|
64
|
+
cancelTemplate: this.cancelTemplate,
|
|
63
65
|
},
|
|
64
66
|
"copy-android-content": {
|
|
65
|
-
|
|
67
|
+
onClick: this.copyAndroidContent,
|
|
66
68
|
},
|
|
67
69
|
"copy-iphone-content": {
|
|
68
|
-
|
|
70
|
+
onClick: this.copyIphoneContent,
|
|
69
71
|
},
|
|
70
72
|
"save-button": {
|
|
71
73
|
saveFormData: this.saveFormData,
|
|
72
74
|
},
|
|
73
75
|
"message-editor": {
|
|
74
|
-
|
|
76
|
+
onChange: this.onTemplateContentChange,
|
|
75
77
|
},
|
|
76
78
|
"message-editor2": {
|
|
77
|
-
|
|
79
|
+
onChange: this.onTemplateContentChange,
|
|
78
80
|
},
|
|
79
81
|
"message-tagList": {
|
|
80
|
-
|
|
82
|
+
onTagSelect: this.onTagSelect,
|
|
81
83
|
},
|
|
82
84
|
"message-tagList2": {
|
|
83
|
-
|
|
85
|
+
onTagSelect: this.onTagSelect,
|
|
84
86
|
},
|
|
85
87
|
"title-tagList": {
|
|
86
|
-
|
|
88
|
+
onTagSelect: this.onTagSelect,
|
|
87
89
|
},
|
|
88
90
|
"title-tagList2": {
|
|
89
|
-
|
|
91
|
+
onTagSelect: this.onTagSelect,
|
|
90
92
|
},
|
|
91
93
|
"pane": {
|
|
92
94
|
onTabChange: this.onTabChange,
|
|
93
95
|
},
|
|
94
96
|
"cta-deeplink": {
|
|
95
|
-
|
|
97
|
+
onChange: this.onLinkTypeChange,
|
|
96
98
|
},
|
|
97
99
|
"cta-deeplink2": {
|
|
98
|
-
|
|
100
|
+
onChange: this.onLinkTypeChange,
|
|
99
101
|
},
|
|
100
102
|
"cta-deeplink-secondary-cta-1-select": {
|
|
101
|
-
|
|
103
|
+
onSelect: this.showCtaKeys,
|
|
102
104
|
},
|
|
103
105
|
"cta-deeplink-secondary-cta-1-select2": {
|
|
104
|
-
|
|
106
|
+
onSelect: this.showCtaKeys,
|
|
105
107
|
},
|
|
106
108
|
"cta-deeplink-secondary-cta-0-select": {
|
|
107
|
-
|
|
109
|
+
onSelect: this.showCtaKeys,
|
|
108
110
|
},
|
|
109
111
|
"cta-deeplink-select": {
|
|
110
|
-
|
|
112
|
+
onSelect: this.showCtaKeys,
|
|
111
113
|
},
|
|
112
114
|
"cta-deeplink2-select": {
|
|
113
|
-
|
|
115
|
+
onSelect: this.showCtaKeys,
|
|
114
116
|
},
|
|
115
117
|
"add-pri-cta": {
|
|
116
|
-
|
|
118
|
+
addPrimaryCta: this.addPrimaryCta,
|
|
117
119
|
},
|
|
118
120
|
"add-pri-cta-ios": {
|
|
119
|
-
|
|
121
|
+
addPrimaryCta: this.addPrimaryCta,
|
|
120
122
|
},
|
|
121
123
|
"add-sec-cta": {
|
|
122
|
-
|
|
124
|
+
addSecondaryCta: this.addSecondoryCta,
|
|
123
125
|
},
|
|
124
126
|
"add-sec-cta-ios": {
|
|
125
|
-
|
|
127
|
+
addSecondaryCtaIos: this.addSecondoryCtaIos,
|
|
126
128
|
},
|
|
127
129
|
"image-upload-android": {
|
|
128
|
-
|
|
130
|
+
onUpload: this.uploadImage,
|
|
129
131
|
},
|
|
130
132
|
"image-upload-ios": {
|
|
131
|
-
|
|
133
|
+
onUpload: this.uploadImage,
|
|
132
134
|
},
|
|
133
135
|
"secondary-cta-1-table": {
|
|
134
|
-
|
|
136
|
+
onRowClick: this.selectCtaIos,
|
|
135
137
|
},
|
|
136
138
|
"cta-deeplink-select-show-keys": {
|
|
137
|
-
|
|
139
|
+
onShowCtaKeys: this.showCtaKeys,
|
|
138
140
|
},
|
|
139
141
|
"cta-deeplink-secondary-cta-0-select-show-keys": {
|
|
140
|
-
|
|
142
|
+
onShowCtaKeys: this.showCtaKeys,
|
|
141
143
|
},
|
|
142
144
|
"cta-deeplink-secondary-cta-1-select-show-keys": {
|
|
143
|
-
|
|
145
|
+
onShowCtaKeys: this.showCtaKeys,
|
|
144
146
|
},
|
|
145
147
|
"mobilepush-template": {
|
|
146
|
-
|
|
148
|
+
onSelect: this.onTemplateChange,
|
|
147
149
|
},
|
|
148
150
|
};
|
|
149
151
|
this.state = {
|
|
@@ -611,16 +613,16 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
611
613
|
delete android.base;
|
|
612
614
|
if (!_.isEmpty(android)) {
|
|
613
615
|
obj.versions.base.ANDROID = {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
616
|
+
luid: "{{luid}}",
|
|
617
|
+
cuid: "{{cuid}}",
|
|
618
|
+
communicationId: "{{communicationId}}",
|
|
619
|
+
title: android['message-title'],
|
|
620
|
+
message: android['message-editor'],
|
|
619
621
|
expandableDetails: {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
+
style: "BIG_TEXT",
|
|
623
|
+
message: android['message-editor'],
|
|
622
624
|
},
|
|
623
|
-
|
|
625
|
+
custom: _.map(android, (field, key) => {
|
|
624
626
|
if (key.indexOf('custom-value') > -1) {
|
|
625
627
|
return field !== "" ? {key: key.replace('custom-value-', "").replace('-cta-deeplink-select', '').replace('-cta-deeplink-secondary-cta-0-select', '').replace('-cta-deeplink-secondary-cta-1-select', ''), value: field} : undefined;
|
|
626
628
|
}
|
|
@@ -630,9 +632,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
630
632
|
}
|
|
631
633
|
if (android['cta-deeplink'] && android['cta-deeplink'] !== "") {
|
|
632
634
|
obj.versions.base.ANDROID.cta = {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
635
|
+
type: android['cta-deeplink'] && android['cta-deeplink'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
636
|
+
actionLink: android['cta-deeplink'] && android['cta-deeplink'].toLowerCase() === "deeplink" ? android['cta-deeplink-select'] : android['cta-deeplink-text'],
|
|
637
|
+
deepLinkName: android['cta-deeplink'] && android['cta-deeplink'].toLowerCase() === "deeplink" ? this.getLinkName(android['cta-deeplink-select']) : undefined,
|
|
636
638
|
};
|
|
637
639
|
if (this.props.location.query.type === 'embedded') {
|
|
638
640
|
delete obj.versions.base.ANDROID.cta.deepLinkName;
|
|
@@ -640,20 +642,20 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
640
642
|
}
|
|
641
643
|
if (!_.isEmpty(ios)) {
|
|
642
644
|
obj.versions.base.IOS = {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
645
|
+
luid: "{{luid}}",
|
|
646
|
+
cuid: "{{cuid}}",
|
|
647
|
+
communicationId: "{{communicationId}}",
|
|
648
|
+
title: ios['message-title2'],
|
|
649
|
+
message: ios['message-editor2'],
|
|
650
|
+
expandableDetails: {
|
|
651
|
+
style: "BIG_TEXT",
|
|
652
|
+
message: ios['message-title2'],
|
|
653
|
+
ctas: [
|
|
652
654
|
|
|
653
655
|
],
|
|
654
|
-
|
|
656
|
+
categoryId: ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].id : undefined,
|
|
655
657
|
},
|
|
656
|
-
|
|
658
|
+
custom: _.map(ios, (field, key) => {
|
|
657
659
|
if (key.indexOf('custom-value') > -1) {
|
|
658
660
|
return field !== "" ? {key: key.replace('custom-value-', "").replace('-cta-deeplink2-select', '').replace('-cta-deeplink-secondary-cta-0-select', '').replace('-cta-deeplink-secondary-cta-1-select2', ''), value: field} : undefined;
|
|
659
661
|
}
|
|
@@ -663,9 +665,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
663
665
|
}
|
|
664
666
|
if (ios['cta-deeplink2'] && ios['cta-deeplink2'] !== "") {
|
|
665
667
|
obj.versions.base.IOS.cta = {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
668
|
+
type: ios['cta-deeplink2'] && ios['cta-deeplink2'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
669
|
+
actionLink: ios['cta-deeplink2'] && ios['cta-deeplink2'].toLowerCase() === "deeplink" ? ios['cta-deeplink2-select'] : ios['cta-deeplink2-text'],
|
|
670
|
+
deepLinkName: ios['cta-deeplink2'] && ios['cta-deeplink2'].toLowerCase() === "deeplink" ? this.getLinkName(ios['cta-deeplink2-select']) : undefined,
|
|
669
671
|
};
|
|
670
672
|
if (this.props.location.query.type === 'embedded') {
|
|
671
673
|
delete obj.versions.base.IOS.cta.deepLinkName;
|
|
@@ -697,10 +699,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
697
699
|
obj.versions.base.ANDROID.expandableDetails.ctas = [];
|
|
698
700
|
if (secondaryCta1) {
|
|
699
701
|
const cta = {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
702
|
+
actionText: android['secondary-cta-0-label'],
|
|
703
|
+
type: android['cta-deeplink-secondary-cta-0'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
704
|
+
actionLink: android['cta-deeplink-secondary-cta-0'].toLowerCase() === "deeplink" ? android['cta-deeplink-secondary-cta-0-select'] : android['cta-deeplink-secondary-cta-0-text'],
|
|
705
|
+
seccdeepLinkName: this.getLinkName(android['cta-deeplink-secondary-cta-0-select']),
|
|
704
706
|
};
|
|
705
707
|
if (this.props.location.query.type === 'embedded') {
|
|
706
708
|
delete cta.seccdeepLinkName;
|
|
@@ -722,10 +724,10 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
722
724
|
}
|
|
723
725
|
if (secondaryCta2) {
|
|
724
726
|
obj.versions.base.ANDROID.expandableDetails.ctas.push({
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
727
|
+
actionText: android['secondary-cta-1-label'],
|
|
728
|
+
type: android['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL",
|
|
729
|
+
actionLink: android['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? android['cta-deeplink-secondary-cta-1-select'] : android['cta-deeplink-secondary-cta-1-text'],
|
|
730
|
+
seccdeepLinkName: this.getLinkName(android['cta-deeplink-secondary-cta-1-select']),
|
|
729
731
|
});
|
|
730
732
|
if (obj.versions.base.ANDROID.expandableDetails.ctas[obj.versions.base.ANDROID.expandableDetails.ctas.length - 1].type === "DEEP_LINK") {
|
|
731
733
|
const params = _.map(android, (field, key) => {
|
|
@@ -767,13 +769,13 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
767
769
|
if (secondaryCtaIos) {
|
|
768
770
|
obj.versions.base.IOS.expandableDetails.ctas = [];
|
|
769
771
|
const cta = {
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
772
|
+
actionText: ios['secondary-cta-1-label'],
|
|
773
|
+
actionLabel: ios['secondary-cta-1-action'],
|
|
774
|
+
actionLabel2: ios['secondary-cta-1-action2'],
|
|
775
|
+
type: ios['cta-deeplink-secondary-cta-1'] && (ios['cta-deeplink-secondary-cta-1'].toLowerCase() === "deeplink" ? "DEEP_LINK" : "EXTERNAL_URL"),
|
|
776
|
+
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']),
|
|
777
|
+
ioscdeepLinkName: this.getLinkName(ios['cta-deeplink-secondary-cta-1-select']),
|
|
778
|
+
templateCtaId: ios['secondary-cta-1-table'] ? ios['secondary-cta-1-table'].ctaTemplateDetails[0].id : undefined,
|
|
777
779
|
};
|
|
778
780
|
if (this.props.location.query.type === 'embedded') {
|
|
779
781
|
delete cta.ioscdeepLinkName;
|
|
@@ -1067,7 +1069,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1067
1069
|
myField.value += myValue;
|
|
1068
1070
|
}
|
|
1069
1071
|
const event = new Event('input', { bubbles: true });
|
|
1070
|
-
myField.
|
|
1072
|
+
callNativeEvent({field, value: myField.value, event});
|
|
1071
1073
|
};
|
|
1072
1074
|
|
|
1073
1075
|
selectCtaIos = (selectedConfig) => {
|
|
@@ -21,9 +21,10 @@ import FormBuilder from '../../../components/FormBuilder';
|
|
|
21
21
|
import * as actions from './actions';
|
|
22
22
|
import messages from './messages';
|
|
23
23
|
import * as charCount from '../../../utils/smsCharCount';
|
|
24
|
-
import {
|
|
24
|
+
import { checkUnicode} from '../../../utils/smsCharCountV2';
|
|
25
25
|
import * as globalActions from '../../../containers/Cap/actions';
|
|
26
26
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
27
|
+
import callNativeEvent from '../../../utils/callNativeEvent';
|
|
27
28
|
|
|
28
29
|
export class Create extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
29
30
|
constructor(props) {
|
|
@@ -275,22 +276,22 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
275
276
|
getMappedEvent(id, event) {
|
|
276
277
|
const map = {
|
|
277
278
|
"template-name": {
|
|
278
|
-
|
|
279
|
+
onChange: this.onTemplateNameChange,
|
|
279
280
|
},
|
|
280
281
|
"discard-button": {
|
|
281
|
-
|
|
282
|
+
discardValues: this.discardValues,
|
|
282
283
|
},
|
|
283
284
|
"cancel-button": {
|
|
284
|
-
|
|
285
|
+
cancelTemplate: this.cancelTemplate,
|
|
285
286
|
},
|
|
286
287
|
"save-button": {
|
|
287
288
|
saveFormData: this.saveFormData,
|
|
288
289
|
},
|
|
289
290
|
"sms-editor": {
|
|
290
|
-
|
|
291
|
+
onChange: this.onTemplateContentChange,
|
|
291
292
|
},
|
|
292
293
|
"tagList": {
|
|
293
|
-
|
|
294
|
+
onTagSelect: this.onTagSelect,
|
|
294
295
|
},
|
|
295
296
|
"unicode-validity": {
|
|
296
297
|
onChange: this.onTemplateNameChange,
|
|
@@ -381,7 +382,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
381
382
|
|
|
382
383
|
injectEvents(schema) {
|
|
383
384
|
console.log('now injecting events');
|
|
384
|
-
|
|
385
|
+
const temp = schema;
|
|
385
386
|
temp.standalone.sections = this.injectSections(temp.standalone.sections);
|
|
386
387
|
_.forEach(temp.containers, (container) => {
|
|
387
388
|
let tempContainer = container;
|
|
@@ -758,7 +759,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
758
759
|
myField.value += myValue;
|
|
759
760
|
}
|
|
760
761
|
const event = new Event('input', { bubbles: true });
|
|
761
|
-
myField.
|
|
762
|
+
callNativeEvent({field, value: myField.value, event});
|
|
762
763
|
}
|
|
763
764
|
|
|
764
765
|
startTemplateCreation(data) {
|