@capillarytech/creatives-library 7.3.4 → 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.4",
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();
@@ -56,6 +56,7 @@
56
56
  }
57
57
  .select-csv-col-dropdown {
58
58
  padding: $CAP_SPACE_08 $CAP_SPACE_16;
59
+ max-width: 324px;
59
60
  .ant-select-tree-switcher-noop, .ant-select-tree-node-content-wrapper{
60
61
  display: inline-block !important;
61
62
  margin: 0 !important;
@@ -19,6 +19,7 @@ import {
19
19
  CapTag,
20
20
  CapTreeSelect,
21
21
  CapDivider,
22
+ CapTooltip
22
23
  } from '@capillarytech/cap-ui-library';
23
24
  import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
24
25
  import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep } from 'lodash';
@@ -100,15 +101,40 @@ export class FTP extends React.Component {
100
101
  this.props.globalActions.fetchSchemaForEntity(query);
101
102
  }
102
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
+
103
124
  componentWillReceiveProps(nextProps) {
104
- const { metaEntities = {}, selectedOfferDetails = [], mode, FTP: nextFTP = {} } = nextProps;
105
- const { metaEntities: thisMetaEntities = {}, FTP: thisFTP = {}} = this.props;
106
- 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;
107
128
  if (
108
- !isEmpty((metaEntities.tags || {}).standard) &&
109
- !isEqual((metaEntities.tags || {}).standard, thisTags.standard)
129
+ (
130
+ !isEmpty((metaEntities.tags || {}).standard) &&
131
+ !isEqual((metaEntities.tags || {}).standard, thisTags.standard)
132
+ ) || !isEqual(injectedTags, thisInjectedTags)
110
133
  ) {
111
- 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
+ )
112
138
  this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
113
139
  }
114
140
 
@@ -169,15 +195,15 @@ export class FTP extends React.Component {
169
195
  selected={selectedServer}
170
196
  />
171
197
  ) : (
172
- <CapHeading type="h6" className="configure-ftp-setting-div">
173
- {formatMessage(messages.selectFtpServerDesc)}
174
- <CapLink
175
- title={formatMessage(messages.manageFTPSettings)}
176
- className="select-server"
177
- onClick={this.handleManageFTPSettings}
178
- />
179
- </CapHeading>
180
- )}
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
+ )}
181
207
  </CapSpin>
182
208
  );
183
209
  };
@@ -284,28 +310,32 @@ export class FTP extends React.Component {
284
310
  const tagsWithoutOptout = tagsTree.length && tagsTree.filter((tag) => tag.value !== '{{optout}}');
285
311
  const headerTagElements = headerTagList.map((item, index) => (
286
312
  index !== 0 && <div className="column-selection-container">
287
- <CapSpin spinning={!tagsWithoutOptout.length}>
288
- <CapTreeSelect
289
- dropdownClassName="select-csv-col-dropdown"
290
- treeData={tagsWithoutOptout}
291
- className="select-csv-column"
292
- value={!isEmpty(item.header) ? item.header : formatMessage(messages.selectTag)}
293
- onChange={(option, label) => this.selectCsvColumn(option, label, index)}
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
- }
301
- />
302
- <CapIcon
303
- type="close"
304
- size="m"
305
- onClick={() => this.removeCsvColumn(item)}
306
- className="remove-csv-column"
307
- />
308
- </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>
309
339
  </div>
310
340
  ));
311
341
  headerTagElements.unshift(
@@ -454,8 +484,11 @@ export class FTP extends React.Component {
454
484
 
455
485
  disableUsedColumns = () => {
456
486
  const { headerTagList = [] } = this.state;
457
- const { selectedOfferDetails = [], metaEntities = {} } = this.props;
458
- 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
+ )
459
492
  const clonnedTagsTree = cloneDeep(tags);
460
493
  headerTagList.map((headerTag) => {
461
494
  clonnedTagsTree.map((tag, index) => {
@@ -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);