@capillarytech/creatives-library 7.9.8 → 7.9.10

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.9.8",
4
+ "version": "7.9.10",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -38,11 +38,9 @@ export const hasStore2DoorFeature = Auth.hasFeatureAccess.bind(
38
38
  STORE2DOOR_PLUS_ENABLED,
39
39
  );
40
40
 
41
- export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails = [], disableTagsDetails = {}}) {
41
+ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails = []}) {
42
42
  console.log('populating tags', (tagsList || []).length);
43
43
  const mainTags = {};
44
- const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = disableTagsDetails;
45
-
46
44
 
47
45
  _.forEach(tagsList, (temp) => {
48
46
  const tag = temp.definition;
@@ -50,7 +48,6 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
50
48
  mainTags[tag.value] = {
51
49
  name: tag.label[userLocale] || tag.label.en,
52
50
  value: tag.value,
53
- disabled: disableRelatedTags ? childTagsToDisable.includes(tag.value) : false,
54
51
  };
55
52
  } else if (tag['tag-header'] && mainTags[tag.value]) {
56
53
  // to check it this tag header is already available in mainTags object,
@@ -63,7 +60,6 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
63
60
  "name": tag.label[userLocale] || tag.label.en,
64
61
  "subtags": tag.subtags,
65
62
  "value": tag.value,
66
- "disabled": disableRelatedTags ? parentTagstoDisable.includes(tag.value) : false,
67
63
  };
68
64
  }
69
65
  });
@@ -179,19 +175,17 @@ function populateTagForChildren(targetTag, tagsObject, tagValue) {
179
175
  function getTreeStructureData(data) {
180
176
  const result = [];
181
177
  _.forOwn(data, (mainTag) => {
182
- const { name, value, subtags = [], disabled } = mainTag;
178
+ const { name, value, subtags = [] } = mainTag;
183
179
  if (!mainTag['tag-header']) {
184
180
  result.push({
185
181
  title: name,
186
182
  value: `{{${value}}}`,
187
- disabled,
188
183
  });
189
184
  } else {
190
185
  const obj = {
191
186
  title: name,
192
187
  value: `{{${value}}}`,
193
188
  selectable: false,
194
- disabled,
195
189
  };
196
190
  obj.children = getSubTags(subtags);
197
191
  result.push(obj);
@@ -203,19 +197,17 @@ function getTreeStructureData(data) {
203
197
  function getSubTags(subtagsParam) {
204
198
  const result = [];
205
199
  _.forOwn(subtagsParam, (subTag) => {
206
- const { name, value, subtags = [], disabled } = subTag;
200
+ const { name, value, subtags = [] } = subTag;
207
201
  if (_.isEmpty(subtags)) {
208
202
  result.push({
209
203
  title: name,
210
204
  value: `{{${value}}}`,
211
- disabled,
212
205
  });
213
206
  } else {
214
207
  const obj = {
215
208
  title: name,
216
209
  value: `{{${value}}}`,
217
210
  selectable: false,
218
- disabled,
219
211
  };
220
212
  obj.children = getSubTags(subtags);
221
213
  result.push(obj);
@@ -8,18 +8,16 @@ import PropTypes from 'prop-types';
8
8
 
9
9
  import React from 'react';
10
10
  // import styled from 'styled-components';
11
- import { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree, CapSelect, CapTooltip } from '@capillarytech/cap-ui-library';
11
+ import { CapSpin, CapModal, CapButton, CapPopover, CapInput, CapTree, CapSelect } from '@capillarytech/cap-ui-library';
12
12
 
13
13
  import _ from 'lodash';
14
- import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
15
- import { createStructuredSelector } from 'reselect';
14
+ import { injectIntl, intlShape } from 'react-intl';
16
15
  import messages from './messages';
17
- import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
18
- import withCreatives from '../../hoc/withCreatives';
19
16
 
20
17
  const {Search} = CapInput;
21
18
  const {CapTreeNode} = CapTree;
22
19
  class CapTagList extends React.Component { // eslint-disable-line react/prefer-stateless-function
20
+
23
21
  constructor(props) {
24
22
  super(props);
25
23
  this.state = {
@@ -134,39 +132,23 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
134
132
  };
135
133
 
136
134
  renderTags(tags, searchString = '') {
137
- const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = this.props.disableTagsDetails;
138
135
  const list = [];
139
- const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
140
136
  _.forEach(tags, (val = '', key) => {
141
137
  let supportedTagsString = '';
142
138
  _.forEach(val.supportedTags, (supportedTag) => {
143
139
  supportedTagsString += `${supportedTag} ,`;
144
140
  });
145
141
  supportedTagsString = supportedTagsString.replace(/,\s*$/, "");
142
+
146
143
  if (_.has(val, 'subtags')) {
147
- const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
148
- const temp = this.renderTags(val.subtags, '', disabled);
144
+ const temp = this.renderTags(val.subtags);
149
145
  list.push((
150
- <CapTreeNode
151
- title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.name}</CapTooltip> : val.name}
152
- tag={val}
153
- key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
154
- disabled={disabled}
155
- >
146
+ <CapTreeNode title={val.name} tag={val} key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}>
156
147
  {temp}
157
148
  </CapTreeNode>
158
149
  ));
159
150
  } else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
160
- const childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
161
- const tempNode = (
162
- <CapTreeNode
163
- title={childDisabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
164
- tag={val}
165
- isLeaf
166
- key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
167
- disabled={childDisabled}
168
- >
169
- </CapTreeNode>);
151
+ const tempNode = (<CapTreeNode title={val.desc || val.name} tag={val} isLeaf key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}></CapTreeNode>);
170
152
  list.push(tempNode);
171
153
  }
172
154
  });
@@ -271,27 +253,10 @@ CapTagList.propTypes = {
271
253
  visibleTaglist: PropTypes.bool,
272
254
  hidePopover: PropTypes.bool,
273
255
  modalProps: PropTypes.any,
274
- disableTagsDetails: PropTypes.object,
275
256
  };
276
257
 
277
258
  CapTagList.defaultValue = {
278
259
  hidePopover: false,
279
260
  };
280
261
 
281
- function mapDispatchToProps() {
282
- return {
283
- };
284
- }
285
-
286
- const mapStateToProps = createStructuredSelector({
287
- disableTagsDetails: makeSelectLoyaltyPromotionDisplay(),
288
- });
289
-
290
- export default withCreatives({
291
- WrappedComponent: CapTagList,
292
- mapStateToProps,
293
- mapDispatchToProps,
294
- suserAuth: true,
295
- });
296
-
297
- // export default injectIntl(CapTagList);
262
+ export default injectIntl(CapTagList);
@@ -42,8 +42,4 @@ export default defineMessages({
42
42
  id: 'creatives.componentsV2.CapTagList.search',
43
43
  defaultMessage: 'Search',
44
44
  },
45
- "loyaltyAttributeDisable": {
46
- id: `creatives.componentsV2.CapTagList.loyaltyAttributeDisable`,
47
- defaultMessage: 'You won’t be able to add loyalty related attributes since the loyalty program/ card series is None.',
48
- },
49
45
  });
@@ -11,9 +11,9 @@ export const LOGOUT_SUCCESS_V2 = 'cap/LOGOUT_SUCCESS_V2';
11
11
  export const LOGOUT_FAILURE_V2 = 'cap/LOGOUT_FAILURE_V2';
12
12
  export const ADD_MESSAGE = 'cap/ADD_MESSAGE';
13
13
  export const REMOVE_MESSAGE = 'cap/REMOVE_MESSAGE';
14
- export const GET_USER_DATA_REQUEST = 'cap/GET_USER_DATA_REQUEST_V2';
15
- export const GET_USER_DATA_SUCCESS = 'cap/GET_USER_DATA_SUCCESS_V2';
16
- export const GET_USER_DATA_FAILURE = 'cap/GET_USER_DATA_FAILURE_V2';
14
+ export const GET_USER_DATA_REQUEST = 'cap/GET_USER_DATA_REQUEST';
15
+ export const GET_USER_DATA_SUCCESS = 'cap/GET_USER_DATA_SUCCESS';
16
+ export const GET_USER_DATA_FAILURE = 'cap/GET_USER_DATA_FAILURE';
17
17
 
18
18
  export const GET_SCHEMA_FOR_ENTITY_FAILURE = 'cap/GET_SCHEMA_FOR_ENTITY_FAILURE';
19
19
  export const GET_SCHEMA_FOR_ENTITY_REQUEST = 'cap/GET_SCHEMA_FOR_ENTITY_REQUEST';
@@ -28,8 +28,6 @@ export const GET_TOPBAR_MENU_DATA_SUCCESS = 'creatives/cap/GET_TOPBAR_MENU_DATA_
28
28
  export const GET_TOPBAR_MENU_DATA_FAILURE = 'creatives/cap/GET_TOPBAR_MENU_DATA_FAILURE';
29
29
  export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
30
30
 
31
- export const SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY = 'SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY';
32
-
33
31
  export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
34
32
  export const ORG_SETTINGS_URL = '/org/index';
35
33
  export const HELP_URL = 'https://support.capillarytech.com/en/support/solutions/4000007853';
@@ -82,6 +82,7 @@ function capReducer(state = fromJS(initialState.cap), action) {
82
82
  .set('fetchingSchema', false);
83
83
  case types.GET_SCHEMA_FOR_ENTITY_SUCCESS: {
84
84
  const stateMeta = state.get('metaEntities');
85
+
85
86
  return state
86
87
  .set('fetchingSchema', false)
87
88
  .set('metaEntities', {
@@ -116,11 +117,6 @@ function capReducer(state = fromJS(initialState.cap), action) {
116
117
  );
117
118
  case types.CLEAR_TOPBAR_MENU_DATA:
118
119
  return state.set('topbarMenuData', fromJS({}));
119
- case types.SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY: {
120
- return state.set('disableLoyaltyPromotionRelatedTags', action.disable)
121
- .set('tagsToDisable', action.tagsToDisable)
122
- .set('parentTagsToDisable', action.parentTagsToDisable);
123
- }
124
120
  default:
125
121
  return state;
126
122
  }
@@ -31,6 +31,7 @@ const setInjectedTags = () => createSelector(
31
31
  const { tags } = metaEntities;
32
32
  const customTags = tags && (tags.custom || {});
33
33
  const extendedTags = tags && (tags.extended || {});
34
+
34
35
  return (injectedTags = _.merge({}, injectedTags, customTags, extendedTags));
35
36
  }
36
37
  );
@@ -73,15 +74,6 @@ const makeSelectFetchingSchema = () => createSelector(
73
74
  (globalState) => globalState.get('fetchingSchema')
74
75
  );
75
76
 
76
- const makeSelectLoyaltyPromotionDisplay = () => createSelector(
77
- selectCapDomain,
78
- (globalState) => ({
79
- disableRelatedTags: globalState.get('disableLoyaltyPromotionRelatedTags'),
80
- childTagsToDisable: globalState.get('tagsToDisable') || [],
81
- parentTagstoDisable: globalState.get('parentTagsToDisable') || [],
82
- }),
83
- );
84
-
85
77
  export {
86
78
  makeSelectLocationState,
87
79
  makeSelectAuthenticated,
@@ -93,5 +85,4 @@ export {
93
85
  isLoadingMetaEntities,
94
86
  makeSelectFetchingSchema,
95
87
  setInjectedTags,
96
- makeSelectLoyaltyPromotionDisplay,
97
88
  };
@@ -214,15 +214,14 @@ function SlideBoxContent(props) {
214
214
  stickerId,
215
215
  packageId,
216
216
  baseUrl,
217
- video,
218
- template,
219
- }) => {
220
- const {
217
+ video: {
221
218
  originalContentUrl,
222
219
  externalLink: {
223
220
  linkUri,
224
221
  } = {},
225
- } = video || {};
222
+ } = {},
223
+ template,
224
+ }) => {
226
225
  const previewContent = {};
227
226
  previewContent.messageContent = text;
228
227
  previewContent.previewImageUrl = previewImageUrl;
@@ -25,7 +25,7 @@ import { FONT_SIZE_L } from '@capillarytech/cap-ui-library/styled/variables';
25
25
  import { find, cloneDeep, findIndex, isEmpty, isEqual, filter, flattenDeep, replace } from 'lodash';
26
26
  import * as actions from './actions';
27
27
  import { makeSelectFTP, makeSelectMetaEntities } from './selectors';
28
- import { makeSelectLoyaltyPromotionDisplay, setInjectedTags } from '../Cap/selectors';
28
+ import { setInjectedTags } from '../Cap/selectors';
29
29
  import withCreatives from '../../hoc/withCreatives';
30
30
  import messages from './messages';
31
31
  import './_FTP.scss';
@@ -132,11 +132,7 @@ export class FTP extends React.Component {
132
132
  ) || !isEqual(injectedTags, thisInjectedTags)
133
133
  ) {
134
134
  const tags = _.concat(
135
- getTreeStructuredTags({
136
- tagsList: ((metaEntities.tags || {}).standard || []),
137
- offerDetails: selectedOfferDetails,
138
- disableTagsDetails: this.props.disableTagsDetails,
139
- }),
135
+ getTreeStructuredTags({ tagsList: ((metaEntities.tags || {}).standard || []), offerDetails: selectedOfferDetails }),
140
136
  this.getTreeStructuredInjectedTags(injectedTags)
141
137
  );
142
138
  this.setState({ tagsTree: tags}, () => this.disableUsedColumns());
@@ -495,13 +491,9 @@ export class FTP extends React.Component {
495
491
 
496
492
  disableUsedColumns = () => {
497
493
  const { headerTagList = [] } = this.state;
498
- const { selectedOfferDetails = [], metaEntities = {}, injectedTags, disableTagsDetails } = this.props;
494
+ const { selectedOfferDetails = [], metaEntities = {}, injectedTags } = this.props;
499
495
  const tags = _.concat(
500
- getTreeStructuredTags({
501
- tagsList: ((metaEntities.tags || {}).standard || []),
502
- offerDetails: selectedOfferDetails,
503
- disableTagsDetails,
504
- }),
496
+ getTreeStructuredTags({ tagsList: ((metaEntities.tags || {}).standard || []), offerDetails: selectedOfferDetails }),
505
497
  this.getTreeStructuredInjectedTags(injectedTags)
506
498
  );
507
499
  const clonnedTagsTree = cloneDeep(tags);
@@ -644,7 +636,6 @@ FTP.propTypes = {
644
636
  contents: PropTypes.array,
645
637
  metaEntities: PropTypes.object,
646
638
  selectedOfferDetails: PropTypes.array,
647
- disableTagsDetails: PropTypes.func,
648
639
  };
649
640
 
650
641
 
@@ -659,7 +650,6 @@ const mapStateToProps = createStructuredSelector({
659
650
  FTP: makeSelectFTP(),
660
651
  metaEntities: makeSelectMetaEntities(),
661
652
  injectedTags: setInjectedTags(),
662
- disableTagsDetails: makeSelectLoyaltyPromotionDisplay(),
663
653
  });
664
654
 
665
655
  export default withCreatives({
@@ -810,7 +810,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
810
810
  { [WECHAT, MOBILE_PUSH].includes(currentChannel) && this.showAccountName() }
811
811
  {filterContent}
812
812
  <CapSpin spinning={isLoading} tip={loadingTip} style={{width: '100%'}}>
813
- {<div>
813
+ {!isLoading && <div>
814
814
  {!isEmpty(filteredTemplates) || !isEmpty(this.state.searchText) || !isEmpty(this.props.Templates.templateError) ? (
815
815
  <div className={!isEmpty(this.state.searchText) && isEmpty(cardDataList) ? '' : "pagination-container"}>
816
816
  <CapCustomCardList
@@ -821,7 +821,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
821
821
  fbType={"list"}
822
822
  />
823
823
  </div>)
824
- : ['sms', "email"].includes(this.state.channel.toLowerCase()) && !isLoading && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
824
+ : ['sms', "email"].includes(this.state.channel.toLowerCase()) && <CapIllustration buttonClassName={`create-new-${channelLowerCase}`} {...this.getChannelTypeIllustrationInfo(currentChannel)} />
825
825
  }
826
826
 
827
827
  {(this.state.selectedAccount === '' && isEmpty(this.props.Templates.selectedWeChatAccount)) && (this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === "mobilepush") &&