@capillarytech/creatives-library 7.3.3 → 7.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.3.3",
4
+ "version": "7.3.5",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -321,7 +321,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
321
321
  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']`))) {
322
322
  this.startTemplateCreation(nextProps.templateData);
323
323
  }
324
- if (nextProps.location.query.module === 'library' && nextProps.isGetFormData) {
324
+ if (nextProps.location.query.module === 'library' && nextProps.isGetFormData && (this.props.isGetFormData!==nextProps.isGetFormData)) {
325
325
  const formData = this.state.formData;
326
326
  let isBeeEditor = false;
327
327
  const isBEEEnable = this.checkBeeEditorAllowedForLibrary();
@@ -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,36 @@
43
52
  padding: 0;
44
53
  white-space: nowrap;
45
54
  list-style: none;
46
- outline: 0;
55
+ outline: 0;
47
56
  }
48
57
  .select-csv-col-dropdown {
58
+ padding: $CAP_SPACE_08 $CAP_SPACE_16;
59
+ max-width: 324px;
49
60
  .ant-select-tree-switcher-noop, .ant-select-tree-node-content-wrapper{
50
61
  display: inline-block !important;
51
62
  margin: 0 !important;
63
+ .ant-select-tree-title {
64
+ font-family: 'Roboto', Arial, sans-serif;
65
+ font-size: $FONT_SIZE_M;
66
+ }
52
67
  }
53
68
  .ant-select-tree-child-tree-open {
54
69
  display: block !important;
55
70
  padding: 0 0 0 $CAP_SPACE_16 !important;
56
71
  }
72
+
73
+ .search-placeholder-container {
74
+ display: flex;
75
+ }
57
76
  }
77
+
78
+ .select-csv-col-dropdown .ant-select-dropdown-search {
79
+ padding: 0;
80
+ .ant-select-search__field{
81
+ padding: $CAP_SPACE_06 $CAP_SPACE_08
82
+ }
83
+ }
84
+
58
85
  .remove-csv-column{
59
86
  display: inline-block;
60
87
  margin-left: $CAP_SPACE_08;
@@ -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';
@@ -18,7 +19,9 @@ import {
18
19
  CapTag,
19
20
  CapTreeSelect,
20
21
  CapDivider,
22
+ CapTooltip
21
23
  } from '@capillarytech/cap-ui-library';
24
+ import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
22
25
  import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep } from 'lodash';
23
26
  import * as actions from './actions';
24
27
  import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
@@ -37,6 +40,11 @@ const UIView = {
37
40
  configureMessage: 'configureMessage',
38
41
  };
39
42
  const { CapLabelInline } = CapLabel;
43
+
44
+ const StyledCapIcon = styled(CapIcon)`
45
+ font-size: ${FONT_SIZE_L};
46
+ `;
47
+
40
48
  export class FTP extends React.Component {
41
49
  constructor(props) {
42
50
  super(props);
@@ -93,15 +101,40 @@ export class FTP extends React.Component {
93
101
  this.props.globalActions.fetchSchemaForEntity(query);
94
102
  }
95
103
 
104
+ getTreeStructuredInjectedTags = (tags) => {
105
+ const finalTags = [];
106
+ let temp = {};
107
+ _.forEach(tags, (val, key) => {
108
+ temp = {
109
+ title: !val['tag-header'] ? val.desc : val.name,
110
+ value: `{{${key}}}`,
111
+ };
112
+ if (!val['subtags']) {
113
+ finalTags.push(temp);
114
+ } else {
115
+ temp.title = temp.title || val.name,
116
+ temp.selectable = false,
117
+ temp.children = this.getTreeStructuredInjectedTags(val.subtags)
118
+ finalTags.push(temp);
119
+ }
120
+ });
121
+ return finalTags;
122
+ }
123
+
96
124
  componentWillReceiveProps(nextProps) {
97
- const { metaEntities = {}, selectedOfferDetails = [], mode, FTP: nextFTP = {} } = nextProps;
98
- const { metaEntities: thisMetaEntities = {}, FTP: thisFTP = {}} = this.props;
99
- const { tags: thisTags = {}} = thisMetaEntities;
125
+ const { metaEntities = {}, selectedOfferDetails = [], mode, FTP: nextFTP = {}, injectedTags } = nextProps;
126
+ const { metaEntities: thisMetaEntities = {}, FTP: thisFTP = {}, injectedTags: thisInjectedTags } = this.props;
127
+ const { tags: thisTags = {} } = thisMetaEntities;
100
128
  if (
101
- !isEmpty((metaEntities.tags || {}).standard) &&
102
- !isEqual((metaEntities.tags || {}).standard, thisTags.standard)
129
+ (
130
+ !isEmpty((metaEntities.tags || {}).standard) &&
131
+ !isEqual((metaEntities.tags || {}).standard, thisTags.standard)
132
+ ) || !isEqual(injectedTags, thisInjectedTags)
103
133
  ) {
104
- const tags = getTreeStructuredTags({tagsList: metaEntities.tags.standard, offerDetails: selectedOfferDetails});
134
+ const tags = _.concat(
135
+ getTreeStructuredTags({ tagsList: ((metaEntities.tags || {}).standard || []), offerDetails: selectedOfferDetails }),
136
+ this.getTreeStructuredInjectedTags(injectedTags)
137
+ )
105
138
  this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
106
139
  }
107
140
 
@@ -162,15 +195,15 @@ export class FTP extends React.Component {
162
195
  selected={selectedServer}
163
196
  />
164
197
  ) : (
165
- <CapHeading type="h6" className="configure-ftp-setting-div">
166
- {formatMessage(messages.selectFtpServerDesc)}
167
- <CapLink
168
- title={formatMessage(messages.manageFTPSettings)}
169
- className="select-server"
170
- onClick={this.handleManageFTPSettings}
171
- />
172
- </CapHeading>
173
- )}
198
+ <CapHeading type="h6" className="configure-ftp-setting-div">
199
+ {formatMessage(messages.selectFtpServerDesc)}
200
+ <CapLink
201
+ title={formatMessage(messages.manageFTPSettings)}
202
+ className="select-server"
203
+ onClick={this.handleManageFTPSettings}
204
+ />
205
+ </CapHeading>
206
+ )}
174
207
  </CapSpin>
175
208
  );
176
209
  };
@@ -277,22 +310,32 @@ export class FTP extends React.Component {
277
310
  const tagsWithoutOptout = tagsTree.length && tagsTree.filter((tag) => tag.value !== '{{optout}}');
278
311
  const headerTagElements = headerTagList.map((item, index) => (
279
312
  index !== 0 && <div className="column-selection-container">
280
- <CapSpin spinning={!tagsWithoutOptout.length}>
281
- <CapTreeSelect
282
- dropdownClassName="select-csv-col-dropdown"
283
- treeData={tagsWithoutOptout}
284
- className="select-csv-column"
285
- value={!isEmpty(item.header) ? item.header : formatMessage(messages.selectTag)}
286
- onChange={(option, label) => this.selectCsvColumn(option, label, index)}
287
- showSearch
288
- />
289
- <CapIcon
290
- type="close"
291
- size="m"
292
- onClick={() => this.removeCsvColumn(item)}
293
- className="remove-csv-column"
294
- />
295
- </CapSpin>
313
+ <CapTooltip
314
+ title={item.header}
315
+ >
316
+ <CapSpin spinning={!tagsWithoutOptout.length}>
317
+ <CapTreeSelect
318
+ dropdownClassName="select-csv-col-dropdown"
319
+ treeData={tagsWithoutOptout}
320
+ className="select-csv-column"
321
+ value={!isEmpty(item.header) ? item.header : formatMessage(messages.selectTag)}
322
+ onChange={(option, label) => this.selectCsvColumn(option, label, index)}
323
+ showSearch
324
+ searchPlaceholder={
325
+ <span className="search-placeholder-container">
326
+ <StyledCapIcon type="search" className="csv-column-search-icon"/>
327
+ {formatMessage(messages.search)}
328
+ </span>
329
+ }
330
+ />
331
+ <CapIcon
332
+ type="close"
333
+ size="m"
334
+ onClick={() => this.removeCsvColumn(item)}
335
+ className="remove-csv-column"
336
+ />
337
+ </CapSpin>
338
+ </CapTooltip>
296
339
  </div>
297
340
  ));
298
341
  headerTagElements.unshift(
@@ -441,8 +484,11 @@ export class FTP extends React.Component {
441
484
 
442
485
  disableUsedColumns = () => {
443
486
  const { headerTagList = [] } = this.state;
444
- const { selectedOfferDetails = [], metaEntities = {} } = this.props;
445
- const tags = getTreeStructuredTags({tagsList: (metaEntities.tags || {}).standard, offerDetails: selectedOfferDetails});
487
+ const { selectedOfferDetails = [], metaEntities = {}, injectedTags } = this.props;
488
+ const tags = _.concat(
489
+ getTreeStructuredTags({ tagsList: ((metaEntities.tags || {}).standard || []), offerDetails: selectedOfferDetails }),
490
+ this.getTreeStructuredInjectedTags(injectedTags)
491
+ )
446
492
  const clonnedTagsTree = cloneDeep(tags);
447
493
  headerTagList.map((headerTag) => {
448
494
  clonnedTagsTree.map((tag, index) => {
@@ -65,4 +65,8 @@ export default defineMessages({
65
65
  id: 'creatives.containersV2.FTP.dataPreview',
66
66
  defaultMessage: 'Data Preview',
67
67
  },
68
+ search: {
69
+ id: 'creatives.componentsV2.FTP.search',
70
+ defaultMessage: 'Search',
71
+ },
68
72
  });
@@ -140,6 +140,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
140
140
  if (nextProps.Create.createTemplateError && !_.isEqual(nextProps.Create.createTemplateError, this.props.Create.createTemplateError)) {
141
141
  const message = (nextProps.Create.createTemplateErrorMessage && nextProps.Create.createTemplateErrorMessage !== '') ? nextProps.Create.createTemplateErrorMessage : this.props.intl.formatMessage(messages.somethingWentWrong);
142
142
  CapNotification.error({key: 'createTemplateError', message });
143
+ this.stopValidation();
143
144
  }
144
145
  if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.schema)) {
145
146
  this.injectEvents(nextProps.metaEntities.layouts[0].definition);