@capillarytech/creatives-library 7.17.46-alpha.0 → 7.17.46

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.
@@ -182,8 +182,8 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
182
182
  visible={this.state.visible}
183
183
  onVisibleChange={this.togglePopoverVisibility}
184
184
  content={<div>
185
- <Spin tip="Getting tags..." spinning={this.props.loading}>
186
- <Search style={{ marginBottom: 8, width: '250px'}} placeholder={this.props.intl.formatMessage(messages.searchText)} onChange={this.onChange} />
185
+ <Spin tip={this.props?.intl?.formatMessage(messages.gettingTags)} spinning={this.props.loading}>
186
+ <Search style={{ marginBottom: 8, width: '250px'}} placeholder={this.props?.intl?.formatMessage(messages.searchText)} onChange={this.onChange} />
187
187
  {this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue="All" options={options}>
188
188
  </CapSelect> : ''}
189
189
  <Tree
@@ -38,4 +38,8 @@ export default defineMessages({
38
38
  id: 'creatives.components.CapTagList.searchText',
39
39
  defaultMessage: 'Search',
40
40
  },
41
+ "gettingTags": {
42
+ id: 'creatives.components.CapTagList.gettingTags',
43
+ defaultMessage: "Getting tags...",
44
+ },
41
45
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.46-alpha.0",
4
+ "version": "7.17.46",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -15,8 +15,6 @@ import {
15
15
  REGISTRATION_CUSTOM_FIELD,
16
16
  JP_LOCALE_HIDE_FEATURE,
17
17
  ENABLE_CUSTOMER_BARCODE_TAG,
18
- PROMO_ENGINE_RELATED_TAGS,
19
- GIFT_VOUCHER_RELATED_TAGS,
20
18
  } from '../containers/App/constants';
21
19
  import { apiMessageFormatHandler } from './commonUtils';
22
20
 
@@ -97,25 +95,16 @@ export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
97
95
  export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails = [], disableTagsDetails = {}}) {
98
96
  const mainTags = {};
99
97
  const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = disableTagsDetails;
100
- const excludedTagList = [];
101
98
 
99
+ let clonedTags = tagsList;
102
100
  if (!hasCardBasedScope()) {
103
- excludedTagList.push(CARD_RELATED_TAGS);
101
+ //filtering CARD_RELATED_TAGS if org does not have CARD_BASED_SCOPE feature enabled
102
+ clonedTags = filterTags(CARD_RELATED_TAGS, tagsList);
104
103
  }
105
-
106
104
  if (!hasHospitalityBasedScope()) {
107
- excludedTagList.push(HOSPITALITY_RELATED_TAGS);
108
- }
109
-
110
- if (!hasPromoFeature()) {
111
- excludedTagList.push(PROMO_ENGINE_RELATED_TAGS);
105
+ //filtering HOSPITALITY_RELATED_TAGS if org does not have HOSPITALITY_BASED_SCOPE feature enabled
106
+ clonedTags = filterTags(HOSPITALITY_RELATED_TAGS, tagsList);
112
107
  }
113
-
114
- if (!hasGiftVoucherFeature()) {
115
- excludedTagList.push(GIFT_VOUCHER_RELATED_TAGS);
116
- }
117
- const clonedTags = filterTags(excludedTagList, tagsList);
118
-
119
108
  _.forEach(clonedTags, (temp) => {
120
109
  const tag = temp.definition;
121
110
  if (!tag['tag-header']) { //if tag doesn't have subtag(s), which means this tag itself is tag and not a tag header.
@@ -372,4 +361,4 @@ export const handleInjectedData = (data, scope) => {
372
361
 
373
362
  export const handlePreviewInNewTab = (previewUrl) => {
374
363
  window.open(previewUrl, '_blank');
375
- };
364
+ }
@@ -22,7 +22,8 @@ import './_tagList.scss';
22
22
  import { selectCurrentOrgDetails } from '../Cap/selectors';
23
23
  import { injectIntl } from 'react-intl';
24
24
  import { scope } from './messages';
25
- import { handleInjectedData } from '../../utils/common';
25
+ import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature } from '../../utils/common';
26
+ import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS } from '../../containers/App/constants';
26
27
 
27
28
  const TreeNode = Tree.TreeNode;
28
29
 
@@ -95,10 +96,24 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
95
96
  }
96
97
  populateTags(tagsList) {
97
98
  const mainTags = {};
99
+ const excludedTags = [];
100
+ if (!hasPromoFeature()) {
101
+ excludedTags.push(...PROMO_ENGINE_RELATED_TAGS);
102
+ //filtering PROMO_ENGINE_RELATED_TAGS if org does not have PROMO_ENGINE feature enabled
103
+ }
104
+ if (!hasGiftVoucherFeature()) {
105
+ //filtering GIFT_VOUCHER_RELATED_TAGS if org does not have GIFT_CARDS feature enabled
106
+ excludedTags.push(...GIFT_VOUCHER_RELATED_TAGS);
107
+ }
98
108
  //Form tags object with tag headers
99
109
  _.forEach(tagsList, (temp) => {
100
110
  const tag = temp.definition;
101
111
  const { locale: userLocale } = this.props?.intl || {};
112
+
113
+ // Check if the tag.value should be skipped based on feature control
114
+ if (_.includes(excludedTags, tag.value)) {
115
+ return; // Skip processing this tag
116
+ }
102
117
  if (!tag['tag-header']) {
103
118
  mainTags[tag.value] = {
104
119
  "name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,