@capillarytech/creatives-library 7.1.3 → 7.1.4
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/services/api.js +0 -1
- package/utils/common.js +7 -6
- package/v2Components/TemplatePreview/index.js +7 -3
- package/v2Containers/App/constants.js +3 -1
- package/v2Containers/CreativesContainer/index.js +5 -4
- package/v2Containers/FTP/index.js +19 -16
- package/v2Containers/Templates/_templates.scss +2 -2
- package/v2Containers/Viber/index.js +3 -2
- package/v2Containers/Viber/messages.js +4 -0
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -215,7 +215,6 @@ export const duplicateTemplate = ({id, channel}) => {
|
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
export const getFTPServers = () => {
|
|
218
|
-
console.log('in api.js getFTPServers');
|
|
219
218
|
const url = `${EXPORT_API_ENDPOINT}/ftplist`;
|
|
220
219
|
return request(url, getAPICallObject('GET'));
|
|
221
220
|
};
|
package/utils/common.js
CHANGED
|
@@ -42,21 +42,22 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
|
|
|
42
42
|
console.log('populating tags', (tagsList || []).length);
|
|
43
43
|
const mainTags = {};
|
|
44
44
|
|
|
45
|
-
//Form tags object with tag headers
|
|
46
45
|
_.forEach(tagsList, (temp) => {
|
|
47
46
|
const tag = temp.definition;
|
|
48
|
-
if (!tag['tag-header']) {
|
|
47
|
+
if (!tag['tag-header']) { //if tag doesn't have subtag(s), which means this tag itself is tag and not a tag header.
|
|
49
48
|
mainTags[tag.value] = {
|
|
50
|
-
name: tag.label[userLocale]
|
|
49
|
+
name: tag.label[userLocale] || tag.label.en,
|
|
51
50
|
value: tag.value,
|
|
52
51
|
};
|
|
53
|
-
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
52
|
+
} else if (tag['tag-header'] && mainTags[tag.value]) {
|
|
53
|
+
// to check it this tag header is already available in mainTags object,
|
|
54
|
+
//If yes, it will concat the subtag
|
|
54
55
|
mainTags[tag.value].subtags = _.concat(mainTags[tag.value].subtags, tag.subtags);
|
|
55
56
|
} else if (!mainTags[tag.value]) {
|
|
56
|
-
//
|
|
57
|
+
//If tag is not available in mainTag object, new maintag will be added.
|
|
57
58
|
mainTags[tag.value] = {
|
|
58
59
|
'tag-header': true,
|
|
59
|
-
"name": tag.label[userLocale]
|
|
60
|
+
"name": tag.label[userLocale] || tag.label.en,
|
|
60
61
|
"subtags": tag.subtags,
|
|
61
62
|
"value": tag.value,
|
|
62
63
|
};
|
|
@@ -184,7 +184,7 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
184
184
|
"padding": '3.5px 0 0',
|
|
185
185
|
'border-radius': '8px',
|
|
186
186
|
'background-color': CAP_G15,
|
|
187
|
-
'width': '
|
|
187
|
+
'width': '81%',
|
|
188
188
|
};
|
|
189
189
|
const getVideoContent = ({
|
|
190
190
|
video,
|
|
@@ -614,13 +614,17 @@ class TemplatePreview extends React.Component { // eslint-disable-line react/pre
|
|
|
614
614
|
'background-color': CAP_PURPLE01,
|
|
615
615
|
"margin-top": '14px',
|
|
616
616
|
'text-align': 'center',
|
|
617
|
-
"width": '
|
|
617
|
+
"width": '140px',
|
|
618
618
|
"height": '20px',
|
|
619
|
-
"margin-left": "
|
|
619
|
+
"margin-left": "2px",
|
|
620
620
|
}}>
|
|
621
621
|
<p
|
|
622
622
|
style={{ 'font-size': '12px',
|
|
623
623
|
'font-weight': '500',
|
|
624
|
+
"display": '-webkit-box',
|
|
625
|
+
'-webkit-line-clamp': '1',
|
|
626
|
+
'-webkit-box-orient': 'vertical',
|
|
627
|
+
'overflow': 'hidden',
|
|
624
628
|
"color": CAP_WHITE }}
|
|
625
629
|
>
|
|
626
630
|
{buttonText || ''}</p>
|
|
@@ -19,7 +19,9 @@ export const TRACK_CREATE_MPUSH = 'createMpush';
|
|
|
19
19
|
export const TRACK_CREATE_WECHAT = 'createWeChat';
|
|
20
20
|
export const TRACK_CREATE_IMAGE = 'createImage';
|
|
21
21
|
export const TRACK_CREATE_LINE = 'createLine';
|
|
22
|
-
|
|
22
|
+
export const CREATE = 'create';
|
|
23
|
+
export const EDIT = 'edit';
|
|
24
|
+
export const PREVIEW = 'preview';
|
|
23
25
|
export const VIBER = 'viber';
|
|
24
26
|
export const TRACK_EDIT_SMS = 'editSms';
|
|
25
27
|
export const TRACK_EDIT_EMAIL = 'editEmail';
|
|
@@ -358,10 +358,11 @@ class Creatives extends React.Component {
|
|
|
358
358
|
break;
|
|
359
359
|
case constants.VIBER:
|
|
360
360
|
if (template.value) {
|
|
361
|
-
const { Templates
|
|
361
|
+
const { Templates, templateData: templateDataProps } = this.props;
|
|
362
|
+
const { accountDetails: selectedAccountDetails, accountId: selectedAccountId } = templateDataProps || {};
|
|
362
363
|
const selectedViberAccount = Templates && Templates.selectedViberAccount;
|
|
363
|
-
const accountDetails = selectedViberAccount ? JSON.stringify(selectedViberAccount) : '';
|
|
364
|
-
const accountId = selectedViberAccount ? selectedViberAccount.id : '';
|
|
364
|
+
const accountDetails = selectedAccountDetails || (selectedViberAccount ? JSON.stringify(selectedViberAccount) : '');
|
|
365
|
+
const accountId = selectedAccountId || (selectedViberAccount ? selectedViberAccount.id : '');
|
|
365
366
|
const { versions } = template.value;
|
|
366
367
|
const content = cloneDeep(versions.base.content);
|
|
367
368
|
content.scenarioKey = get(accountDetails, 'configs.scenario_key');
|
|
@@ -717,4 +718,4 @@ function mapDispatchToProps(dispatch) {
|
|
|
717
718
|
actions: bindActionCreators(actions, dispatch),
|
|
718
719
|
};
|
|
719
720
|
}
|
|
720
|
-
export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
|
|
721
|
+
export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
|
|
@@ -27,7 +27,7 @@ import messages from './messages';
|
|
|
27
27
|
import './_FTP.scss';
|
|
28
28
|
import * as globalActions from '../../containers/Cap/actions';
|
|
29
29
|
import { TagList } from '../TagList';
|
|
30
|
-
import { NO_COMMUNICATION } from '../App/constants';
|
|
30
|
+
import { NO_COMMUNICATION, CREATE, EDIT, PREVIEW } from '../App/constants';
|
|
31
31
|
import { getTreeStructuredTags } from '../../utils/common';
|
|
32
32
|
|
|
33
33
|
const UIView = {
|
|
@@ -41,9 +41,9 @@ export class FTP extends React.Component {
|
|
|
41
41
|
this.state = this.getInitialState();
|
|
42
42
|
}
|
|
43
43
|
getInitialState = () => {
|
|
44
|
-
const mode = this.props.mode ||
|
|
44
|
+
const mode = this.props.mode || CREATE;
|
|
45
45
|
let stateObj = {};
|
|
46
|
-
if (mode ===
|
|
46
|
+
if (mode === CREATE) {
|
|
47
47
|
const { formatMessage } = this.props.intl;
|
|
48
48
|
const headerTagList = [{
|
|
49
49
|
header: formatMessage(messages.customerID),
|
|
@@ -59,14 +59,13 @@ export class FTP extends React.Component {
|
|
|
59
59
|
};
|
|
60
60
|
} else {
|
|
61
61
|
const { messageContent = {} } = this.props.messageDetails || {};
|
|
62
|
-
const
|
|
63
|
-
const headerTagList = (messageContent['message_content_id_1'] || {}).headerTagList || [];
|
|
62
|
+
const { headerTagList = [], messageBody = '' } = messageContent['message_content_id_1'] || {};
|
|
64
63
|
stateObj = {
|
|
65
64
|
mode,
|
|
66
65
|
selectedServer: null,
|
|
67
66
|
viewMode: UIView.configureMessage,
|
|
68
67
|
headerTagList,
|
|
69
|
-
messageContent:
|
|
68
|
+
messageContent: messageBody,
|
|
70
69
|
tagsTree: [],
|
|
71
70
|
};
|
|
72
71
|
}
|
|
@@ -74,8 +73,8 @@ export class FTP extends React.Component {
|
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
setFTPServerInState = (FTPServers) => {
|
|
77
|
-
const { deliverySetting = {} } = this.props.messageDetails;
|
|
78
|
-
const configId = deliverySetting.channelSetting[NO_COMMUNICATION].endPointConfigs.ftpConfigId;
|
|
76
|
+
const { deliverySetting = { channelSetting: {} }} = this.props.messageDetails;
|
|
77
|
+
const configId = (deliverySetting.channelSetting[NO_COMMUNICATION].endPointConfigs || {}).ftpConfigId;
|
|
79
78
|
const selectedServer = find(FTPServers, {id: configId});
|
|
80
79
|
this.setState({ selectedServer });
|
|
81
80
|
};
|
|
@@ -88,24 +87,28 @@ export class FTP extends React.Component {
|
|
|
88
87
|
context: 'outbound',
|
|
89
88
|
embedded: 'embedded',
|
|
90
89
|
};
|
|
90
|
+
//This call is to fetch tags that are populated in csv columns.
|
|
91
91
|
this.props.globalActions.fetchSchemaForEntity(query);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
componentWillReceiveProps(nextProps) {
|
|
95
|
+
const { metaEntities = {}, selectedOfferDetails = [], mode, FTP: nextFTP = {} } = nextProps;
|
|
96
|
+
const { metaEntities: thisMetaEntities = {}, FTP: thisFTP = {}} = this.props;
|
|
97
|
+
const { tags: thisTags = {}} = thisMetaEntities;
|
|
95
98
|
if (
|
|
96
|
-
!isEmpty((
|
|
97
|
-
!isEqual((
|
|
99
|
+
!isEmpty((metaEntities.tags || {}).standard) &&
|
|
100
|
+
!isEqual((metaEntities.tags || {}).standard, thisTags.standard)
|
|
98
101
|
) {
|
|
99
|
-
const tags = getTreeStructuredTags({tagsList:
|
|
102
|
+
const tags = getTreeStructuredTags({tagsList: metaEntities.tags.standard, offerDetails: selectedOfferDetails});
|
|
100
103
|
this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
!isEqual(
|
|
107
|
+
mode === EDIT &&
|
|
108
|
+
nextFTP.FTPServers.length &&
|
|
109
|
+
!isEqual(nextFTP.FTPServers, thisFTP.FTPServers)
|
|
107
110
|
) {
|
|
108
|
-
this.setFTPServerInState(
|
|
111
|
+
this.setFTPServerInState(nextFTP.FTPServers);
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
|
|
@@ -457,7 +460,7 @@ export class FTP extends React.Component {
|
|
|
457
460
|
const { serverSelection } = UIView;
|
|
458
461
|
const { mode } = this.props;
|
|
459
462
|
return (
|
|
460
|
-
mode ===
|
|
463
|
+
mode === PREVIEW ?
|
|
461
464
|
this.getPreviewModeContents() :
|
|
462
465
|
(viewMode === serverSelection ?
|
|
463
466
|
this.getServerSelectionContent() :
|
|
@@ -516,6 +516,7 @@ const Viber = (props) => {
|
|
|
516
516
|
defaultValue={buttonText}
|
|
517
517
|
value={buttonText}
|
|
518
518
|
style={{paddingBottom: '11px'}}
|
|
519
|
+
maxLength={20}
|
|
519
520
|
/>
|
|
520
521
|
<CapInput
|
|
521
522
|
id="viber-button-url"
|
|
@@ -563,7 +564,7 @@ const Viber = (props) => {
|
|
|
563
564
|
const createCallback = (errorMessage, isEdit) => {
|
|
564
565
|
if (!errorMessage) {
|
|
565
566
|
CapNotification.success({
|
|
566
|
-
message: formatMessage(messages.viberCreateNotification),
|
|
567
|
+
message: isEdit ? formatMessage(messages.viberEditNotification) : formatMessage(messages.viberCreateNotification),
|
|
567
568
|
});
|
|
568
569
|
if (isEdit) {
|
|
569
570
|
actions.clearEditResponse();
|
|
@@ -626,7 +627,7 @@ const Viber = (props) => {
|
|
|
626
627
|
return true;
|
|
627
628
|
}
|
|
628
629
|
// if button is being added than button url and button Text both are mandatory
|
|
629
|
-
if (( trimedButtonText === '' && trimedButtonUrl !== '') || (
|
|
630
|
+
if (( trimedButtonText === '' && trimedButtonUrl !== '') || ( trimedButtonText !== '' && trimedButtonUrl === '')) {
|
|
630
631
|
return true;
|
|
631
632
|
}
|
|
632
633
|
// if button url is not valid url
|
|
@@ -118,6 +118,10 @@ export default defineMessages({
|
|
|
118
118
|
id: `${scope}.viberCreateNotification`,
|
|
119
119
|
defaultMessage: 'Viber template created successfully',
|
|
120
120
|
},
|
|
121
|
+
viberEditNotification: {
|
|
122
|
+
id: `${scope}.viberEditNotification`,
|
|
123
|
+
defaultMessage: 'Viber template updated successfully',
|
|
124
|
+
},
|
|
121
125
|
textMessageTitlePlaceholder: {
|
|
122
126
|
id: `${scope}.textMessageTitlePlaceholder`,
|
|
123
127
|
defaultMessage: 'Enter template name',
|