@capillarytech/creatives-library 7.3.2 → 7.3.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/utils/tagValidations.js +2 -2
- package/v2Containers/FTP/_FTP.scss +29 -2
- package/v2Containers/FTP/index.js +27 -5
- package/v2Containers/FTP/messages.js +4 -0
- package/v2Components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/v2Containers/FTP/temp.js +0 -11838
package/package.json
CHANGED
package/utils/tagValidations.js
CHANGED
|
@@ -81,7 +81,7 @@ export const validateTags = ({
|
|
|
81
81
|
return response;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
const checkIfSupportedTag = (checkingTag, injectedTags) => {
|
|
84
|
+
export const checkIfSupportedTag = (checkingTag, injectedTags) => {
|
|
85
85
|
let result = false;
|
|
86
86
|
lodashForEach(injectedTags, (tag, key) => {
|
|
87
87
|
if (tag.subtags && checkIfSupportedTag(checkingTag, tag.subtags)) {
|
|
@@ -114,7 +114,7 @@ const skipTags = (tag) => {
|
|
|
114
114
|
return skipped;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
const transformInjectedTags = (tags) => {
|
|
117
|
+
export const transformInjectedTags = (tags) => {
|
|
118
118
|
lodashForEach(tags, (tag) => {
|
|
119
119
|
const temp = tag;
|
|
120
120
|
let subKey = '';
|
|
@@ -34,6 +34,15 @@
|
|
|
34
34
|
border: 1px solid #d9d9d9 !important;
|
|
35
35
|
border-radius: 4px !important;
|
|
36
36
|
display: inline-block;
|
|
37
|
+
.ant-select-selection{
|
|
38
|
+
height: 100%;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.csv-column-search-icon {
|
|
43
|
+
svg {
|
|
44
|
+
height: 100%;
|
|
45
|
+
}
|
|
37
46
|
}
|
|
38
47
|
.select-csv-col-dropdown ul{
|
|
39
48
|
padding: 0 $CAP_SPACE_04;
|
|
@@ -43,18 +52,35 @@
|
|
|
43
52
|
padding: 0;
|
|
44
53
|
white-space: nowrap;
|
|
45
54
|
list-style: none;
|
|
46
|
-
|
|
55
|
+
outline: 0;
|
|
47
56
|
}
|
|
48
57
|
.select-csv-col-dropdown {
|
|
58
|
+
padding: $CAP_SPACE_08 $CAP_SPACE_16;
|
|
49
59
|
.ant-select-tree-switcher-noop, .ant-select-tree-node-content-wrapper{
|
|
50
60
|
display: inline-block !important;
|
|
51
61
|
margin: 0 !important;
|
|
62
|
+
.ant-select-tree-title {
|
|
63
|
+
font-family: 'Roboto', Arial, sans-serif;
|
|
64
|
+
font-size: $FONT_SIZE_M;
|
|
65
|
+
}
|
|
52
66
|
}
|
|
53
67
|
.ant-select-tree-child-tree-open {
|
|
54
68
|
display: block !important;
|
|
55
69
|
padding: 0 0 0 $CAP_SPACE_16 !important;
|
|
56
70
|
}
|
|
71
|
+
|
|
72
|
+
.search-placeholder-container {
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.select-csv-col-dropdown .ant-select-dropdown-search {
|
|
78
|
+
padding: 0;
|
|
79
|
+
.ant-select-search__field{
|
|
80
|
+
padding: $CAP_SPACE_06 $CAP_SPACE_08
|
|
81
|
+
}
|
|
57
82
|
}
|
|
83
|
+
|
|
58
84
|
.remove-csv-column{
|
|
59
85
|
display: inline-block;
|
|
60
86
|
margin-left: $CAP_SPACE_08;
|
|
@@ -109,6 +135,7 @@
|
|
|
109
135
|
}
|
|
110
136
|
|
|
111
137
|
.configure-ftp-setting-div{
|
|
112
|
-
text-align: center;
|
|
113
138
|
align-items: baseline;
|
|
139
|
+
display: flex;
|
|
140
|
+
justify-content: center;
|
|
114
141
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
3
4
|
import { bindActionCreators } from 'redux';
|
|
4
5
|
import { FormattedMessage, intlShape } from 'react-intl';
|
|
5
6
|
import { createStructuredSelector } from 'reselect';
|
|
@@ -19,9 +20,11 @@ import {
|
|
|
19
20
|
CapTreeSelect,
|
|
20
21
|
CapDivider,
|
|
21
22
|
} from '@capillarytech/cap-ui-library';
|
|
23
|
+
import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
|
|
22
24
|
import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep } from 'lodash';
|
|
23
25
|
import * as actions from './actions';
|
|
24
26
|
import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
|
|
27
|
+
import { setInjectedTags } from '../Cap/selectors';
|
|
25
28
|
import withCreatives from '../../hoc/withCreatives';
|
|
26
29
|
import messages from './messages';
|
|
27
30
|
import './_FTP.scss';
|
|
@@ -29,12 +32,18 @@ import * as globalActions from '../../containers/Cap/actions';
|
|
|
29
32
|
import { TagList } from '../TagList';
|
|
30
33
|
import { NO_COMMUNICATION, CREATE, EDIT, PREVIEW } from '../App/constants';
|
|
31
34
|
import { getTreeStructuredTags } from '../../utils/common';
|
|
35
|
+
import { transformInjectedTags, checkIfSupportedTag } from '../../utils/tagValidations';
|
|
32
36
|
|
|
33
37
|
const UIView = {
|
|
34
38
|
serverSelection: 'serverSelection',
|
|
35
39
|
configureMessage: 'configureMessage',
|
|
36
40
|
};
|
|
37
41
|
const { CapLabelInline } = CapLabel;
|
|
42
|
+
|
|
43
|
+
const StyledCapIcon = styled(CapIcon)`
|
|
44
|
+
font-size: ${FONT_SIZE_L};
|
|
45
|
+
`;
|
|
46
|
+
|
|
38
47
|
export class FTP extends React.Component {
|
|
39
48
|
constructor(props) {
|
|
40
49
|
super(props);
|
|
@@ -201,8 +210,9 @@ export class FTP extends React.Component {
|
|
|
201
210
|
return flattenDeep(flatTags);
|
|
202
211
|
};
|
|
203
212
|
|
|
204
|
-
validateTags(content, tagsParam) {
|
|
213
|
+
validateTags(content, tagsParam, injectedTagsParams) {
|
|
205
214
|
const tags = tagsParam;
|
|
215
|
+
const injectedTags = transformInjectedTags(injectedTagsParams);
|
|
206
216
|
const response = {};
|
|
207
217
|
response.valid = true;
|
|
208
218
|
response.unsupportedTags = [];
|
|
@@ -212,8 +222,9 @@ export class FTP extends React.Component {
|
|
|
212
222
|
const matchedTags = [...content.matchAll(regex)];
|
|
213
223
|
matchedTags.forEach((tag) => {
|
|
214
224
|
let ifSupported = !!flatTags.find((t) => t === tag[0]);
|
|
225
|
+
const tagValue = tag[0].substring(this.indexOfEnd(tag[0], '{{'), tag[0].indexOf('}}'));
|
|
226
|
+
ifSupported = ifSupported || checkIfSupportedTag(tagValue, injectedTags);
|
|
215
227
|
if (!ifSupported) {
|
|
216
|
-
const tagValue = tag[0].substring(this.indexOfEnd(tag[0], '{{'), tag[0].indexOf('}}'));
|
|
217
228
|
response.unsupportedTags.push(tagValue);
|
|
218
229
|
response.valid = false;
|
|
219
230
|
}
|
|
@@ -233,9 +244,9 @@ export class FTP extends React.Component {
|
|
|
233
244
|
getMessageContent = () => {
|
|
234
245
|
const { messageContent, tagsTree = []} = this.state;
|
|
235
246
|
const { formatMessage } = this.props.intl;
|
|
236
|
-
const { metaEntities, selectedOfferDetails } = this.props;
|
|
247
|
+
const { metaEntities, selectedOfferDetails, injectedTags } = this.props;
|
|
237
248
|
const tagsRaw = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
|
|
238
|
-
const validateTagResponse = this.validateTags(messageContent, tagsTree);
|
|
249
|
+
const validateTagResponse = this.validateTags(messageContent, tagsTree, injectedTags);
|
|
239
250
|
let unsupportedTags = null;
|
|
240
251
|
let errorMessageText = '';
|
|
241
252
|
if (!validateTagResponse.valid) {
|
|
@@ -252,6 +263,7 @@ export class FTP extends React.Component {
|
|
|
252
263
|
tags={tagsRaw}
|
|
253
264
|
onTagSelect={this.onTagSelect}
|
|
254
265
|
selectedOfferDetails={selectedOfferDetails}
|
|
266
|
+
injectedTags={injectedTags || {}}
|
|
255
267
|
/>
|
|
256
268
|
<CapInput.TextArea
|
|
257
269
|
setInputRef={this.setInputRef}
|
|
@@ -280,6 +292,12 @@ export class FTP extends React.Component {
|
|
|
280
292
|
value={!isEmpty(item.header) ? item.header : formatMessage(messages.selectTag)}
|
|
281
293
|
onChange={(option, label) => this.selectCsvColumn(option, label, index)}
|
|
282
294
|
showSearch
|
|
295
|
+
searchPlaceholder={
|
|
296
|
+
<span className="search-placeholder-container">
|
|
297
|
+
<StyledCapIcon type="search" className="csv-column-search-icon"/>
|
|
298
|
+
{formatMessage(messages.search)}
|
|
299
|
+
</span>
|
|
300
|
+
}
|
|
283
301
|
/>
|
|
284
302
|
<CapIcon
|
|
285
303
|
type="close"
|
|
@@ -423,8 +441,11 @@ export class FTP extends React.Component {
|
|
|
423
441
|
selectCsvColumn = (option, label, index) => {
|
|
424
442
|
const { headerTagList } = this.state;
|
|
425
443
|
const clonedHeaderTagList = cloneDeep(headerTagList);
|
|
444
|
+
const optionValue = option.substring(this.indexOfEnd(option, '{{'), option.indexOf('}}'));
|
|
445
|
+
let readableOptionValue = optionValue.replaceAll('_', ' ');
|
|
446
|
+
readableOptionValue = readableOptionValue[0].toUpperCase() + readableOptionValue.slice(1);
|
|
426
447
|
const obj = {
|
|
427
|
-
header:
|
|
448
|
+
header: readableOptionValue,
|
|
428
449
|
tag: option,
|
|
429
450
|
};
|
|
430
451
|
clonedHeaderTagList[index] = obj;
|
|
@@ -588,6 +609,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
588
609
|
const mapStateToProps = createStructuredSelector({
|
|
589
610
|
FTP: makeSelectFTP(),
|
|
590
611
|
metaEntities: makeSelectMetaEntities(),
|
|
612
|
+
injectedTags: setInjectedTags(),
|
|
591
613
|
});
|
|
592
614
|
|
|
593
615
|
export default withCreatives({
|