@capillarytech/creatives-library 7.3.5 → 7.3.6

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.5",
4
+ "version": "7.3.6",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,5 +1,6 @@
1
1
  // makeSelectLocationState expects a plain JS object for the routing state
2
2
  import { createSelector } from 'reselect';
3
+ import { fromJS } from 'immutable';
3
4
  import _ from 'lodash';
4
5
  const selectCapDomain = (state) => state.get('cap');
5
6
 
@@ -24,7 +25,7 @@ const isLoadingMetaEntities = () => createSelector(
24
25
  );
25
26
  const setInjectedTags = () => createSelector(
26
27
  selectCapDomain,
27
- (globalState) => {
28
+ (globalState = fromJS({})) => {
28
29
  let injectedTags = globalState.get('injectedTags') || {};
29
30
  const metaEntities = globalState.get('metaEntities') || {};
30
31
  const { tags } = metaEntities;
@@ -15,7 +15,6 @@
15
15
  display: inline-block;
16
16
  }
17
17
  .configure-csv-container{
18
- margin-top: $CAP_SPACE_32;
19
18
  .configure-csv, .add-column{
20
19
  display: inline-block;
21
20
  }
@@ -106,11 +105,15 @@
106
105
 
107
106
  .ftp-preview-container{
108
107
  .ftp-preview-message-title{
109
- margin-top: $CAP_SPACE_16;
108
+ margin-top: $CAP_SPACE_40;
109
+ }
110
+ .ftp-content {
111
+ margin-top: 8px;
112
+ max-width: 70%;
110
113
  }
111
114
  .ftp-preview-message-content{
112
115
  max-width: 450px;
113
- margin-top: 4px;
116
+ margin-top: $CAP_SPACE_04;
114
117
  color: $FONT_COLOR_02;
115
118
  .ant-input[disabled]{
116
119
  background-color: $CAP_WHITE;
@@ -122,10 +125,14 @@
122
125
  margin-top: $CAP_SPACE_40;
123
126
  }
124
127
  .ftp-preview-data-col-container{
125
- margin-top: $CAP_SPACE_16;
128
+ margin-top: $CAP_SPACE_08;
126
129
  .ant-tag.cap-tag-v2{
127
130
  background-color: $CAP_WHITE;
128
131
  font-weight: 500;
132
+
133
+ &:first-child {
134
+ padding-left: 0;
135
+ }
129
136
  }
130
137
  }
131
138
  }
@@ -19,7 +19,7 @@ import {
19
19
  CapTag,
20
20
  CapTreeSelect,
21
21
  CapDivider,
22
- CapTooltip
22
+ CapTooltip,
23
23
  } from '@capillarytech/cap-ui-library';
24
24
  import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
25
25
  import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep } from 'lodash';
@@ -69,7 +69,7 @@ export class FTP extends React.Component {
69
69
  };
70
70
  } else {
71
71
  const { messageContent = {} } = this.props.messageDetails || {};
72
- const { headerTagList = [], messageBody = '' } = messageContent['message_content_id_1'] || {};
72
+ const { headerTagList = [], messageBody = '' } = messageContent.message_content_id_1 || {};
73
73
  stateObj = {
74
74
  mode,
75
75
  selectedServer: null,
@@ -109,12 +109,12 @@ export class FTP extends React.Component {
109
109
  title: !val['tag-header'] ? val.desc : val.name,
110
110
  value: `{{${key}}}`,
111
111
  };
112
- if (!val['subtags']) {
112
+ if (!val.subtags) {
113
113
  finalTags.push(temp);
114
- } else {
115
- temp.title = temp.title || val.name,
116
- temp.selectable = false,
117
- temp.children = this.getTreeStructuredInjectedTags(val.subtags)
114
+ } else {
115
+ temp.title = temp.title || val.name;
116
+ temp.selectable = false;
117
+ temp.children = this.getTreeStructuredInjectedTags(val.subtags);
118
118
  finalTags.push(temp);
119
119
  }
120
120
  });
@@ -134,7 +134,7 @@ export class FTP extends React.Component {
134
134
  const tags = _.concat(
135
135
  getTreeStructuredTags({ tagsList: ((metaEntities.tags || {}).standard || []), offerDetails: selectedOfferDetails }),
136
136
  this.getTreeStructuredInjectedTags(injectedTags)
137
- )
137
+ );
138
138
  this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
139
139
  }
140
140
 
@@ -175,7 +175,7 @@ export class FTP extends React.Component {
175
175
  >
176
176
  {formatMessage(messages.ftpServer)}
177
177
  </CapHeading>
178
- {serverOptions.length && <CapHeading type="h6" className="manage-ftp-setting-div">
178
+ {!!serverOptions.length && <CapHeading type="h6" className="manage-ftp-setting-div">
179
179
  {formatMessage(messages.ftpServerDesc)}
180
180
  <CapLink
181
181
  title={formatMessage(messages.manageFTPSettings)}
@@ -195,15 +195,19 @@ export class FTP extends React.Component {
195
195
  selected={selectedServer}
196
196
  />
197
197
  ) : (
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
- )}
198
+ <>
199
+ {!getFTPServersInProgress && (
200
+ <CapHeading type="h6" className="configure-ftp-setting-div">
201
+ {formatMessage(messages.selectFtpServerDesc)}
202
+ <CapLink
203
+ title={formatMessage(messages.manageFTPSettings)}
204
+ className="select-server"
205
+ onClick={this.handleManageFTPSettings}
206
+ />
207
+ </CapHeading>
208
+ )}
209
+ </>
210
+ )}
207
211
  </CapSpin>
208
212
  );
209
213
  };
@@ -224,7 +228,7 @@ export class FTP extends React.Component {
224
228
 
225
229
  getFlatTags = (tags) => {
226
230
  const flatTags = [];
227
- tags.forEach(tag => {
231
+ tags.forEach((tag) => {
228
232
  if ((tag.children || []).length) {
229
233
  const innerTags = this.getFlatTags(tag.children);
230
234
  flatTags.push(innerTags);
@@ -277,7 +281,7 @@ export class FTP extends React.Component {
277
281
  let errorMessageText = '';
278
282
  if (!validateTagResponse.valid) {
279
283
  unsupportedTags = validateTagResponse.unsupportedTags.join(', ').toString();
280
- errorMessageText = formatMessage(messages.unsupportedTagsValidationError, {unsupportedTags})
284
+ errorMessageText = formatMessage(messages.unsupportedTagsValidationError, {unsupportedTags});
281
285
  }
282
286
  return (
283
287
  <CapRow>
@@ -310,30 +314,29 @@ export class FTP extends React.Component {
310
314
  const tagsWithoutOptout = tagsTree.length && tagsTree.filter((tag) => tag.value !== '{{optout}}');
311
315
  const headerTagElements = headerTagList.map((item, index) => (
312
316
  index !== 0 && <div className="column-selection-container">
313
- <CapTooltip
314
- title={item.header}
315
- >
316
- <CapSpin spinning={!tagsWithoutOptout.length}>
317
+ <CapTooltip title={item.header}>
318
+ <CapSpin spinning={!tagsWithoutOptout.length}>
317
319
  <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
- />
320
+ dropdownClassName="select-csv-col-dropdown"
321
+ treeData={tagsWithoutOptout}
322
+ className="select-csv-column"
323
+ value={!isEmpty(item.header) ? item.header : formatMessage(messages.selectTag)}
324
+ onChange={(option, label) => this.selectCsvColumn(option, label, index)}
325
+ showSearch
326
+ searchPlaceholder={
327
+ <span className="search-placeholder-container">
328
+ <StyledCapIcon type="search" className="csv-column-search-icon"/>
329
+ {formatMessage(messages.search)}
330
+ </span>
331
+ }
332
+ placeholder={formatMessage(messages.selectTag)}
333
+ />
334
+ <CapIcon
335
+ type="close"
336
+ size="m"
337
+ onClick={() => this.removeCsvColumn(item)}
338
+ className="remove-csv-column"
339
+ />
337
340
  </CapSpin>
338
341
  </CapTooltip>
339
342
  </div>
@@ -353,7 +356,7 @@ export class FTP extends React.Component {
353
356
  getConfigureCsvContent = () => {
354
357
  const { formatMessage } = this.props.intl;
355
358
  return (
356
- <>
359
+ <CapSpin spinning={!(this.state.tagsTree || []).length}>
357
360
  <CapRow className="configure-csv-container">
358
361
  <CapColumn span={8} className="configure-csv">
359
362
  <CapHeader
@@ -373,7 +376,7 @@ export class FTP extends React.Component {
373
376
  </CapColumn>
374
377
  </CapRow>
375
378
  {this.getCsvColumns()}
376
- </>
379
+ </CapSpin>
377
380
  );
378
381
  }
379
382
 
@@ -446,20 +449,26 @@ export class FTP extends React.Component {
446
449
  getPreviewModeContents = () => {
447
450
  const { contents = [] } = this.props;
448
451
  const { messageBody = '', headerTagList = [] } = contents[0] || {};
452
+ const columns = cloneDeep(headerTagList);
453
+ if (messageBody) {
454
+ columns.push({
455
+ header: <FormattedMessage {...messages.message}/>,
456
+ });
457
+ }
449
458
  return (
450
459
  <div className="ftp-preview-container">
451
- <CapHeading className="ftp-preview-message-title" type="h3">
452
- <FormattedMessage {...messages.messageContent}/>
453
- </CapHeading>
454
- <CapInput.TextArea
455
- value={messageBody}
456
- disabled
457
- className="ftp-preview-message-content"
458
- />
459
460
  <CapHeading className="ftp-preview-data-title" type="h3">
460
461
  <FormattedMessage {...messages.dataPreview}/>
461
462
  </CapHeading>
462
- {this.getColumnsHeaderPreview(headerTagList)}
463
+ {this.getColumnsHeaderPreview(columns)}
464
+ {messageBody && (
465
+ <>
466
+ <CapHeading className="ftp-preview-message-title" type="h3">
467
+ <FormattedMessage {...messages.messageContent}/>
468
+ </CapHeading>
469
+ <CapLabel className="ftp-content" type="label1">{messageBody}</CapLabel>
470
+ </>
471
+ )}
463
472
  </div>
464
473
  );
465
474
  };
@@ -472,7 +481,7 @@ export class FTP extends React.Component {
472
481
  const { headerTagList } = this.state;
473
482
  const clonedHeaderTagList = cloneDeep(headerTagList);
474
483
  const optionValue = option.substring(this.indexOfEnd(option, '{{'), option.indexOf('}}'));
475
- let readableOptionValue = optionValue.replaceAll('_', ' ');
484
+ let readableOptionValue = optionValue.replaceAll('_', ' ');
476
485
  readableOptionValue = readableOptionValue[0].toUpperCase() + readableOptionValue.slice(1);
477
486
  const obj = {
478
487
  header: readableOptionValue,
@@ -488,7 +497,7 @@ export class FTP extends React.Component {
488
497
  const tags = _.concat(
489
498
  getTreeStructuredTags({ tagsList: ((metaEntities.tags || {}).standard || []), offerDetails: selectedOfferDetails }),
490
499
  this.getTreeStructuredInjectedTags(injectedTags)
491
- )
500
+ );
492
501
  const clonnedTagsTree = cloneDeep(tags);
493
502
  headerTagList.map((headerTag) => {
494
503
  clonnedTagsTree.map((tag, index) => {
@@ -69,4 +69,8 @@ export default defineMessages({
69
69
  id: 'creatives.componentsV2.FTP.search',
70
70
  defaultMessage: 'Search',
71
71
  },
72
+ message: {
73
+ id: `creatives.componentsV2.FTP.search`,
74
+ defaultMessage: 'Message',
75
+ },
72
76
  });