@capillarytech/creatives-library 2.0.72 → 2.0.74
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/CapTagList/index.js +2 -7
- package/components/FormBuilder/index.js +18 -8
- package/package.json +1 -1
- package/v2Containers/Email/index.js +5 -1
- package/v2Containers/MobilePush/Create/index.js +1 -2
- package/v2Containers/MobilePush/Create/messages.js +4 -0
- package/v2Containers/MobilePush/commonMethods.js +4 -4
- package/v2Containers/Templates/_templates.scss +5 -1
- package/v2Containers/Templates/index.js +1 -1
|
@@ -65,13 +65,11 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
65
65
|
return list;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
handleOnChange = (data
|
|
69
|
-
console.log('module data', data, e);
|
|
68
|
+
handleOnChange = (data) => {
|
|
70
69
|
this.props.onContextChange(data);
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
handleDynamicDateChange = (data
|
|
74
|
-
console.log('data.target', data.target.value, e);
|
|
72
|
+
handleDynamicDateChange = (data) => {
|
|
75
73
|
this.setState({dynamicDateValue: data.target.value});
|
|
76
74
|
};
|
|
77
75
|
|
|
@@ -126,7 +124,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
126
124
|
this.setState({expandedKeys, autoExpandParent: false});
|
|
127
125
|
};
|
|
128
126
|
togglePopoverVisibility = (visible) => {
|
|
129
|
-
console.log('popover ');
|
|
130
127
|
this.setState({visible});
|
|
131
128
|
};
|
|
132
129
|
|
|
@@ -135,7 +132,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
135
132
|
};
|
|
136
133
|
|
|
137
134
|
renderTags(tags, searchString) {
|
|
138
|
-
console.log('final tags list', tags);
|
|
139
135
|
const list = [];
|
|
140
136
|
_.forEach(tags, (val, key) => {
|
|
141
137
|
let supportedTagsString = '';
|
|
@@ -143,7 +139,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
143
139
|
supportedTagsString += `${supportedTag} ,`;
|
|
144
140
|
});
|
|
145
141
|
supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
|
|
146
|
-
console.log('supportedTagsString', supportedTagsString);
|
|
147
142
|
if (_.has(val, 'subtags')) {
|
|
148
143
|
const temp = this.renderTags(val.subtags);
|
|
149
144
|
list.push((
|
|
@@ -31,7 +31,10 @@ const {CapRadioGroup} = CapRadio;
|
|
|
31
31
|
|
|
32
32
|
// import { FormattedMessage } from 'react-intl';
|
|
33
33
|
// import messages from './messages';
|
|
34
|
-
|
|
34
|
+
const isUrl = (str) => {
|
|
35
|
+
const res = str.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g);
|
|
36
|
+
return res;
|
|
37
|
+
};
|
|
35
38
|
class FormBuilder extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
36
39
|
constructor(props) {
|
|
37
40
|
super(props);
|
|
@@ -409,7 +412,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
409
412
|
});
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
|
-
|
|
415
|
+
isValidExternalLink = ({obj, key}) => {
|
|
416
|
+
const url = _.get(obj, key);
|
|
417
|
+
return (url && url !== "" && isUrl(url));
|
|
418
|
+
}
|
|
413
419
|
/* eslint-disable */
|
|
414
420
|
validateForm(tags, injectedTags, isSave, showMessages) {
|
|
415
421
|
|
|
@@ -640,15 +646,15 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
640
646
|
errorData[parseInt(index)]['cta-deeplink2-select'] = false;
|
|
641
647
|
}
|
|
642
648
|
// }
|
|
643
|
-
if(tab
|
|
649
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-text'})){
|
|
644
650
|
errorData[parseInt(index)][`cta-deeplink-text`] = true;
|
|
645
651
|
isValid = false;
|
|
646
652
|
isCurrentTabValid = false;
|
|
647
653
|
}else {
|
|
648
654
|
errorData[parseInt(index)]['cta-deeplink-text'] = false;
|
|
649
655
|
}
|
|
650
|
-
|
|
651
|
-
if(tab
|
|
656
|
+
|
|
657
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink2-text'})){
|
|
652
658
|
errorData[parseInt(index)][`cta-deeplink2-text`] = true;
|
|
653
659
|
isValid = false;
|
|
654
660
|
isCurrentTabValid = false;
|
|
@@ -671,7 +677,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
671
677
|
}else {
|
|
672
678
|
errorData[parseInt(index)]['secondary-cta-0-label'] = false;
|
|
673
679
|
}
|
|
674
|
-
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-0-text'})){
|
|
675
683
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-0-text`] = true;
|
|
676
684
|
isValid = false;
|
|
677
685
|
isCurrentTabValid = false;
|
|
@@ -692,7 +700,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
692
700
|
}else {
|
|
693
701
|
errorData[parseInt(index)]['secondary-cta-1-label'] = false;
|
|
694
702
|
}
|
|
695
|
-
|
|
703
|
+
|
|
704
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-1-text'})){
|
|
696
705
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-1-text`] = true;
|
|
697
706
|
isValid = false;
|
|
698
707
|
isCurrentTabValid = false;
|
|
@@ -706,7 +715,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
706
715
|
}else {
|
|
707
716
|
errorData[parseInt(index)]['cta-deeplink-secondary-cta-1-select'] = false;
|
|
708
717
|
}
|
|
709
|
-
|
|
718
|
+
|
|
719
|
+
if(!this.isValidExternalLink({obj: tab, key: 'cta-deeplink-secondary-cta-1-text2'})){
|
|
710
720
|
errorData[parseInt(index)][`cta-deeplink-secondary-cta-1-text2`] = true;
|
|
711
721
|
isValid = false;
|
|
712
722
|
isCurrentTabValid = false;
|
package/package.json
CHANGED
|
@@ -307,7 +307,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
307
307
|
this.setEditData(nextProps.Email.templateDetails);
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData) {
|
|
310
|
+
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData && _.isEmpty(_.get(this, `state.formData['template-subject']`))) {
|
|
311
311
|
this.startTemplateCreation(nextProps.templateData);
|
|
312
312
|
}
|
|
313
313
|
if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
|
|
@@ -2065,6 +2065,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2065
2065
|
"language": this.supportedLanguages[languageIndex].language,
|
|
2066
2066
|
"template-content": !data.base.is_drag_drop && data.base.is_drag_drop !== 1 ? data.base.html_content : "",
|
|
2067
2067
|
};
|
|
2068
|
+
const dragDropId = _.get(data, 'base.drag_drop_id');
|
|
2069
|
+
if (dragDropId) {
|
|
2070
|
+
tempData.drag_drop_id = dragDropId;
|
|
2071
|
+
}
|
|
2068
2072
|
formData[0].base = true;
|
|
2069
2073
|
formData[0].selectedLanguages.push(this.supportedLanguages[languageIndex].iso_code);
|
|
2070
2074
|
formData[0][this.supportedLanguages[languageIndex].iso_code] = tempData;
|
|
@@ -269,7 +269,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
269
269
|
type: "input", //Resembles component to be used
|
|
270
270
|
metaType: "text",
|
|
271
271
|
datatype: "string",
|
|
272
|
-
errorMessage:
|
|
272
|
+
errorMessage: <FormattedMessage {...messages.invalidExternalLink}/>,
|
|
273
273
|
required: true,
|
|
274
274
|
fluid: true,
|
|
275
275
|
width: 18,
|
|
@@ -277,7 +277,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
277
277
|
style: {
|
|
278
278
|
width: '100%',
|
|
279
279
|
|
|
280
|
-
marginBottom: '16px',
|
|
281
280
|
},
|
|
282
281
|
styling: "semantic",
|
|
283
282
|
order: 1,
|
|
@@ -154,6 +154,10 @@ export default defineMessages({
|
|
|
154
154
|
id: 'app.containers.MobilePush.Create.externalLinkCantEmpty',
|
|
155
155
|
defaultMessage: 'External Link cannot be empty',
|
|
156
156
|
},
|
|
157
|
+
"invalidExternalLink": {
|
|
158
|
+
id: 'app.containers.MobilePush.Create.invalidExternalLink',
|
|
159
|
+
defaultMessage: 'External Link cannot be empty / Invalid url',
|
|
160
|
+
},
|
|
157
161
|
"Do you really want to go back? All your temporary changes will be lost!": {
|
|
158
162
|
id: 'app.containers.MobilePush.Create.goBackConfirmation',
|
|
159
163
|
defaultMessage: "Going back will discard all the changes you've made. Continue?",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {get, filter, cloneDeep} from 'lodash';
|
|
2
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {FormattedMessage} from 'react-intl';
|
|
4
|
+
import messages from './Create/messages';
|
|
3
5
|
function getPrimaryCtaFields({inputFields, fieldIndex, deepLinkOptions}) {
|
|
4
6
|
const newInputFields = cloneDeep(inputFields);
|
|
5
7
|
newInputFields.splice(fieldIndex + 1, 0, {
|
|
@@ -205,15 +207,13 @@ function getLinkTypeFields({inputFieldsArgs, fieldIndex, deepLinkOptions, formDa
|
|
|
205
207
|
type: "input", //Resembles component to be used
|
|
206
208
|
metaType: "text",
|
|
207
209
|
datatype: "string",
|
|
208
|
-
errorMessage:
|
|
210
|
+
errorMessage: <FormattedMessage {...messages.invalidExternalLink}/>,
|
|
209
211
|
required: true,
|
|
210
212
|
fluid: true,
|
|
211
213
|
width: 18,
|
|
212
214
|
offset: 1,
|
|
213
215
|
style: {
|
|
214
216
|
width: '100%',
|
|
215
|
-
|
|
216
|
-
marginBottom: '16px',
|
|
217
217
|
},
|
|
218
218
|
styling: "semantic",
|
|
219
219
|
order: 1,
|
|
@@ -4,15 +4,19 @@
|
|
|
4
4
|
padding: unset;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
.creatives-templates-list.full-mode{
|
|
7
8
|
.pagination-container {
|
|
8
9
|
.cap-custom-card-list-row {
|
|
9
10
|
.cap-custom-card-list-col{
|
|
10
|
-
&:nth-child(4) {
|
|
11
|
+
&:nth-child(4n+4) {
|
|
11
12
|
margin-right: unset;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
|
|
17
21
|
.card-title {
|
|
18
22
|
line-height: 24px;
|
|
@@ -1589,7 +1589,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1589
1589
|
const {route} = this.props;
|
|
1590
1590
|
const loadingTip = (this.props.Templates.sendingFile && (this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill')) ? this.props.intl.formatMessage(messages.uploadingFile) : this.props.intl.formatMessage(messages.gettingAllTemplates);
|
|
1591
1591
|
return (
|
|
1592
|
-
<div>
|
|
1592
|
+
<div className={`creatives-templates-list ${this.props.isFullMode ? 'full-mode' : 'library-mode'}`}>
|
|
1593
1593
|
<input type="file" id="filename" style={{ display: 'none'}} accept=".zip, .html, .htm" onChange={(event) => this.handleFileUpload(event, {files: event.target.files})} />
|
|
1594
1594
|
|
|
1595
1595
|
|