@capillarytech/creatives-library 7.3.1 → 7.3.3
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/App/constants.js +1 -0
- package/v2Containers/FTP/_FTP.scss +2 -1
- package/v2Containers/FTP/index.js +14 -5
- 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 = '';
|
|
@@ -52,4 +52,5 @@ export const CHANNEL_EDIT_TRACK_MAPPING = {
|
|
|
52
52
|
export const GTM_TRACKING_ID = 'UA-110024621-2';
|
|
53
53
|
export const BEE_PLUGIN = 'BEE_PLUGIN';
|
|
54
54
|
export const NO_COMMUNICATION = 'NO_COMMUNICATION';
|
|
55
|
+
export const FTP = 'FTP';
|
|
55
56
|
export const CREATIVES_UI_VIEW = 'CREATIVES_UI_VIEW';
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep } from 'lodash';
|
|
23
23
|
import * as actions from './actions';
|
|
24
24
|
import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
|
|
25
|
+
import { setInjectedTags } from '../Cap/selectors';
|
|
25
26
|
import withCreatives from '../../hoc/withCreatives';
|
|
26
27
|
import messages from './messages';
|
|
27
28
|
import './_FTP.scss';
|
|
@@ -29,6 +30,7 @@ import * as globalActions from '../../containers/Cap/actions';
|
|
|
29
30
|
import { TagList } from '../TagList';
|
|
30
31
|
import { NO_COMMUNICATION, CREATE, EDIT, PREVIEW } from '../App/constants';
|
|
31
32
|
import { getTreeStructuredTags } from '../../utils/common';
|
|
33
|
+
import { transformInjectedTags, checkIfSupportedTag } from '../../utils/tagValidations';
|
|
32
34
|
|
|
33
35
|
const UIView = {
|
|
34
36
|
serverSelection: 'serverSelection',
|
|
@@ -201,8 +203,9 @@ export class FTP extends React.Component {
|
|
|
201
203
|
return flattenDeep(flatTags);
|
|
202
204
|
};
|
|
203
205
|
|
|
204
|
-
validateTags(content, tagsParam) {
|
|
206
|
+
validateTags(content, tagsParam, injectedTagsParams) {
|
|
205
207
|
const tags = tagsParam;
|
|
208
|
+
const injectedTags = transformInjectedTags(injectedTagsParams);
|
|
206
209
|
const response = {};
|
|
207
210
|
response.valid = true;
|
|
208
211
|
response.unsupportedTags = [];
|
|
@@ -212,8 +215,9 @@ export class FTP extends React.Component {
|
|
|
212
215
|
const matchedTags = [...content.matchAll(regex)];
|
|
213
216
|
matchedTags.forEach((tag) => {
|
|
214
217
|
let ifSupported = !!flatTags.find((t) => t === tag[0]);
|
|
218
|
+
const tagValue = tag[0].substring(this.indexOfEnd(tag[0], '{{'), tag[0].indexOf('}}'));
|
|
219
|
+
ifSupported = ifSupported || checkIfSupportedTag(tagValue, injectedTags);
|
|
215
220
|
if (!ifSupported) {
|
|
216
|
-
const tagValue = tag[0].substring(this.indexOfEnd(tag[0], '{{'), tag[0].indexOf('}}'));
|
|
217
221
|
response.unsupportedTags.push(tagValue);
|
|
218
222
|
response.valid = false;
|
|
219
223
|
}
|
|
@@ -233,9 +237,9 @@ export class FTP extends React.Component {
|
|
|
233
237
|
getMessageContent = () => {
|
|
234
238
|
const { messageContent, tagsTree = []} = this.state;
|
|
235
239
|
const { formatMessage } = this.props.intl;
|
|
236
|
-
const { metaEntities, selectedOfferDetails } = this.props;
|
|
240
|
+
const { metaEntities, selectedOfferDetails, injectedTags } = this.props;
|
|
237
241
|
const tagsRaw = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
|
|
238
|
-
const validateTagResponse = this.validateTags(messageContent, tagsTree);
|
|
242
|
+
const validateTagResponse = this.validateTags(messageContent, tagsTree, injectedTags);
|
|
239
243
|
let unsupportedTags = null;
|
|
240
244
|
let errorMessageText = '';
|
|
241
245
|
if (!validateTagResponse.valid) {
|
|
@@ -252,6 +256,7 @@ export class FTP extends React.Component {
|
|
|
252
256
|
tags={tagsRaw}
|
|
253
257
|
onTagSelect={this.onTagSelect}
|
|
254
258
|
selectedOfferDetails={selectedOfferDetails}
|
|
259
|
+
injectedTags={injectedTags || {}}
|
|
255
260
|
/>
|
|
256
261
|
<CapInput.TextArea
|
|
257
262
|
setInputRef={this.setInputRef}
|
|
@@ -423,8 +428,11 @@ export class FTP extends React.Component {
|
|
|
423
428
|
selectCsvColumn = (option, label, index) => {
|
|
424
429
|
const { headerTagList } = this.state;
|
|
425
430
|
const clonedHeaderTagList = cloneDeep(headerTagList);
|
|
431
|
+
const optionValue = option.substring(this.indexOfEnd(option, '{{'), option.indexOf('}}'));
|
|
432
|
+
let readableOptionValue = optionValue.replaceAll('_', ' ');
|
|
433
|
+
readableOptionValue = readableOptionValue[0].toUpperCase() + readableOptionValue.slice(1);
|
|
426
434
|
const obj = {
|
|
427
|
-
header:
|
|
435
|
+
header: readableOptionValue,
|
|
428
436
|
tag: option,
|
|
429
437
|
};
|
|
430
438
|
clonedHeaderTagList[index] = obj;
|
|
@@ -588,6 +596,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
588
596
|
const mapStateToProps = createStructuredSelector({
|
|
589
597
|
FTP: makeSelectFTP(),
|
|
590
598
|
metaEntities: makeSelectMetaEntities(),
|
|
599
|
+
injectedTags: setInjectedTags(),
|
|
591
600
|
});
|
|
592
601
|
|
|
593
602
|
export default withCreatives({
|