@capillarytech/creatives-library 7.1.6 → 7.1.7
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/Templates/index.js +1 -1
- package/favicon.ico +0 -0
- package/old_favicon.ico +0 -0
- package/package.json +1 -1
- package/v2Components/FormBuilder/index.js +5 -4
- package/v2Components/TemplatePreview/assets/images/mobile.svg +24 -0
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +3 -1
- package/v2Containers/FTP/_FTP.scss +14 -3
- package/v2Containers/FTP/index.js +82 -17
- package/v2Containers/FTP/messages.js +8 -0
- package/v2Containers/FTP/temp.js +11838 -0
- package/v2Containers/MobilePush/Create/sagas.js +1 -4
|
@@ -6,6 +6,8 @@ import moment from 'moment';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import messages from './messages';
|
|
8
8
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
9
|
+
import { NO_COMMUNICATION } from '../App/constants';
|
|
10
|
+
import { FTP } from '../FTP';
|
|
9
11
|
const PrefixWrapper = styled.div`
|
|
10
12
|
margin-right: 16px;
|
|
11
13
|
`;
|
|
@@ -29,7 +31,7 @@ function SlideBoxHeader(props) {
|
|
|
29
31
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
30
32
|
<CapHeader
|
|
31
33
|
title={<FormattedMessage {...messages.creativeTemplates} />}
|
|
32
|
-
description={
|
|
34
|
+
description={![NO_COMMUNICATION, FTP].includes(channel) &&
|
|
33
35
|
<FormattedMessage {...messages.creativeTemplatesDesc} />
|
|
34
36
|
}
|
|
35
37
|
/>
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
}
|
|
62
62
|
.scrollable-section{
|
|
63
63
|
height: calc(100vh - 220px);
|
|
64
|
-
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
margin-bottom: $CAP_SPACE_08;
|
|
65
66
|
}
|
|
66
67
|
.FTP-tagList {
|
|
67
68
|
position: absolute;
|
|
@@ -82,8 +83,13 @@
|
|
|
82
83
|
}
|
|
83
84
|
.ftp-preview-message-content{
|
|
84
85
|
max-width: 450px;
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
margin-top: 4px;
|
|
87
|
+
color: $FONT_COLOR_02;
|
|
88
|
+
.ant-input[disabled]{
|
|
89
|
+
background-color: $CAP_WHITE;
|
|
90
|
+
color: $FONT_COLOR_01;
|
|
91
|
+
cursor: default;
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
.ftp-preview-data-title{
|
|
89
95
|
margin-top: $CAP_SPACE_40;
|
|
@@ -100,4 +106,9 @@
|
|
|
100
106
|
.manage-ftp-setting-div{
|
|
101
107
|
display: flex;
|
|
102
108
|
align-items: baseline;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.configure-ftp-setting-div{
|
|
112
|
+
text-align: center;
|
|
113
|
+
align-items: baseline;
|
|
103
114
|
}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
CapTreeSelect,
|
|
20
20
|
CapDivider,
|
|
21
21
|
} from '@capillarytech/cap-ui-library';
|
|
22
|
-
import { find, cloneDeep, findIndex, isEmpty, isEqual, filter } from 'lodash';
|
|
22
|
+
import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, forEach } from 'lodash';
|
|
23
23
|
import * as actions from './actions';
|
|
24
24
|
import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
|
|
25
25
|
import withCreatives from '../../hoc/withCreatives';
|
|
@@ -140,24 +140,35 @@ export class FTP extends React.Component {
|
|
|
140
140
|
>
|
|
141
141
|
{formatMessage(messages.ftpServer)}
|
|
142
142
|
</CapHeading>
|
|
143
|
-
<CapHeading type="h6" className="manage-ftp-setting-div">
|
|
143
|
+
{serverOptions.length && <CapHeading type="h6" className="manage-ftp-setting-div">
|
|
144
144
|
{formatMessage(messages.ftpServerDesc)}
|
|
145
145
|
<CapLink
|
|
146
146
|
title={formatMessage(messages.manageFTPSettings)}
|
|
147
147
|
className="select-server"
|
|
148
148
|
onClick={this.handleManageFTPSettings}
|
|
149
149
|
/>
|
|
150
|
-
</CapHeading>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
150
|
+
</CapHeading>}
|
|
151
|
+
{serverOptions.length ? (
|
|
152
|
+
<CapRadioCard
|
|
153
|
+
className="select-account"
|
|
154
|
+
onChange={this.onChangeFTPServer}
|
|
155
|
+
panes={serverOptions}
|
|
156
|
+
cardHeight="48px"
|
|
157
|
+
cardWidth="276px"
|
|
158
|
+
size="small"
|
|
159
|
+
defaultValue={selectedServer}
|
|
160
|
+
selected={selectedServer}
|
|
161
|
+
/>
|
|
162
|
+
) : (
|
|
163
|
+
<CapHeading type="h6" className="configure-ftp-setting-div">
|
|
164
|
+
{formatMessage(messages.selectFtpServerDesc)}
|
|
165
|
+
<CapLink
|
|
166
|
+
title={formatMessage(messages.manageFTPSettings)}
|
|
167
|
+
className="select-server"
|
|
168
|
+
onClick={this.handleManageFTPSettings}
|
|
169
|
+
/>
|
|
170
|
+
</CapHeading>
|
|
171
|
+
)}
|
|
161
172
|
</CapSpin>
|
|
162
173
|
);
|
|
163
174
|
};
|
|
@@ -176,11 +187,62 @@ export class FTP extends React.Component {
|
|
|
176
187
|
}));
|
|
177
188
|
};
|
|
178
189
|
|
|
190
|
+
validateTags(content, tagsParam) {
|
|
191
|
+
const tags = tagsParam;
|
|
192
|
+
const response = {};
|
|
193
|
+
response.valid = true;
|
|
194
|
+
response.unsupportedTags = [];
|
|
195
|
+
if (tags && tags.length) {
|
|
196
|
+
const regex = /{{[(A-Z\w+(\s\w+)*$\(\)@!#$%^&*~.,/\\]+}}/g;
|
|
197
|
+
const matchedTags = [...content.matchAll(regex)];
|
|
198
|
+
matchedTags.forEach((tag) => {
|
|
199
|
+
const tagValue = tag[0].substring(this.indexOfEnd(tag[0], '{{'), tag[0].indexOf('}}'));
|
|
200
|
+
let ifSupported = !!tags.find((t) => t.definition.value === tagValue);
|
|
201
|
+
ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, tags);
|
|
202
|
+
if (!ifSupported) {
|
|
203
|
+
response.unsupportedTags.push(tagValue);
|
|
204
|
+
response.valid = false;
|
|
205
|
+
}
|
|
206
|
+
if (response.unsupportedTags.length === 0) {
|
|
207
|
+
response.valid = true;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return response;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
checkIfSupportedTag(checkingTag, injectedTags) {
|
|
215
|
+
let result = false;
|
|
216
|
+
forEach(injectedTags, (tag, key) => {
|
|
217
|
+
if (tag.subtags) {
|
|
218
|
+
if (this.checkIfSupportedTag(checkingTag, tag.subtags)) {
|
|
219
|
+
result = true;
|
|
220
|
+
}
|
|
221
|
+
} else if (checkingTag === key) {
|
|
222
|
+
result = true;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
indexOfEnd(targetString, string) {
|
|
230
|
+
const io = targetString.indexOf(string);
|
|
231
|
+
return io == -1 ? -1 : io + string.length;
|
|
232
|
+
}
|
|
233
|
+
|
|
179
234
|
getMessageContent = () => {
|
|
180
235
|
const { messageContent } = this.state;
|
|
181
236
|
const { formatMessage } = this.props.intl;
|
|
182
237
|
const { metaEntities, selectedOfferDetails } = this.props;
|
|
183
238
|
const tagsRaw = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
|
|
239
|
+
const validateTagResponse = this.validateTags(messageContent, tagsRaw);
|
|
240
|
+
let unsupportedTags = null;
|
|
241
|
+
let errorMessageText = '';
|
|
242
|
+
if (!validateTagResponse.valid) {
|
|
243
|
+
unsupportedTags = validateTagResponse.unsupportedTags.join(', ').toString();
|
|
244
|
+
errorMessageText = formatMessage(messages.unsupportedTagsValidationError, {unsupportedTags})
|
|
245
|
+
}
|
|
184
246
|
return (
|
|
185
247
|
<CapRow>
|
|
186
248
|
<CapColumn span={11}>
|
|
@@ -197,6 +259,7 @@ export class FTP extends React.Component {
|
|
|
197
259
|
label={formatMessage(messages.messageHeader)}
|
|
198
260
|
onChange={this.updateMessageBody}
|
|
199
261
|
value={messageContent}
|
|
262
|
+
errorMessage={errorMessageText}
|
|
200
263
|
/>
|
|
201
264
|
</div>
|
|
202
265
|
</CapColumn>
|
|
@@ -341,9 +404,11 @@ export class FTP extends React.Component {
|
|
|
341
404
|
<CapHeading className="ftp-preview-message-title" type="h3">
|
|
342
405
|
<FormattedMessage {...messages.messageContent}/>
|
|
343
406
|
</CapHeading>
|
|
344
|
-
<
|
|
345
|
-
{messageBody}
|
|
346
|
-
|
|
407
|
+
<CapInput.TextArea
|
|
408
|
+
value={messageBody}
|
|
409
|
+
disabled
|
|
410
|
+
className="ftp-preview-message-content"
|
|
411
|
+
/>
|
|
347
412
|
<CapHeading className="ftp-preview-data-title" type="h3">
|
|
348
413
|
<FormattedMessage {...messages.dataPreview}/>
|
|
349
414
|
</CapHeading>
|
|
@@ -353,7 +418,7 @@ export class FTP extends React.Component {
|
|
|
353
418
|
};
|
|
354
419
|
|
|
355
420
|
showAccountSelection = () => {
|
|
356
|
-
this.setState({ viewMode: UIView.serverSelection, selectedServer: null
|
|
421
|
+
this.setState({ viewMode: UIView.serverSelection, selectedServer: null});
|
|
357
422
|
};
|
|
358
423
|
|
|
359
424
|
selectCsvColumn = (option, label, index) => {
|
|
@@ -5,6 +5,10 @@ export default defineMessages({
|
|
|
5
5
|
id: 'creatives.containersV2.FTP.ftpServerDesc',
|
|
6
6
|
defaultMessage: 'Select the FTP server to send the message data. To add another FTP location, ',
|
|
7
7
|
},
|
|
8
|
+
selectFtpServerDesc: {
|
|
9
|
+
id: 'creatives.containersV2.FTP.selectFtpServerDesc',
|
|
10
|
+
defaultMessage: 'FTP not configured for this org. Please add FTP server ',
|
|
11
|
+
},
|
|
8
12
|
ftpServer: {
|
|
9
13
|
id: 'creatives.containersV2.FTP.ftpServer',
|
|
10
14
|
defaultMessage: 'FTP Server',
|
|
@@ -17,6 +21,10 @@ export default defineMessages({
|
|
|
17
21
|
id: 'creatives.containersV2.FTP.addColumn',
|
|
18
22
|
defaultMessage: 'Add column',
|
|
19
23
|
},
|
|
24
|
+
unsupportedTagsValidationError: {
|
|
25
|
+
id: 'creatives.containersV2.FTP.unsupportedTagsValidationError',
|
|
26
|
+
defaultMessage: 'Unsupported tags: {unsupportedTags}. Please remove them from this message.',
|
|
27
|
+
},
|
|
20
28
|
selectTag: {
|
|
21
29
|
id: 'creatives.containersV2.FTP.selectTag',
|
|
22
30
|
defaultMessage: 'Select tag',
|