@capillarytech/creatives-library 7.10.2 → 7.10.4

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.
@@ -4,6 +4,7 @@ export const GET_SIDEBAR_FAILURE = 'app/App/GET_SIDEBAR_FAILURE';
4
4
 
5
5
  export const STORE2DOOR_PLUS_ENABLED = 'STORE2DOOR_PLUS_ENABLED';
6
6
  export const TRAI_DLT = 'TRAI_DLT';
7
+ export const CARD_BASED_SCOPE = 'CARD_BASED_SCOPE';
7
8
 
8
9
  export const CARD_RELATED_TAGS = [
9
10
  'card_series',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.10.2",
4
+ "version": "7.10.4",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import _ from 'lodash';
2
2
  import { Auth } from '@capillarytech/cap-ui-utils';
3
- import { STORE2DOOR_PLUS_ENABLED, TRAI_DLT, CARD_RELATED_TAGS } from '../containers/App/constants';
3
+ import {
4
+ STORE2DOOR_PLUS_ENABLED,
5
+ TRAI_DLT,
6
+ CARD_RELATED_TAGS,
7
+ CARD_BASED_SCOPE,
8
+ } from '../containers/App/constants';
4
9
 
5
10
  export function getUserNameById(userId, allUserList) {
6
11
  let userName = "";
@@ -43,14 +48,22 @@ export const hasTraiDltFeature = Auth.hasFeatureAccess.bind(
43
48
  TRAI_DLT,
44
49
  );
45
50
 
51
+ export const hasCardBasedScope = Auth.hasFeatureAccess.bind(
52
+ null,
53
+ CARD_BASED_SCOPE,
54
+ );
55
+
46
56
  export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails = [], disableTagsDetails = {}}) {
47
57
  console.log('populating tags', (tagsList || []).length);
48
58
  const mainTags = {};
49
- const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags} = disableTagsDetails;
59
+ const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = disableTagsDetails;
50
60
 
51
- const clonedTags = _.filter(tagsList, (tag) =>
52
- !CARD_RELATED_TAGS.includes(tag?.definition?.value)
53
- );
61
+ let clonedTags = tagsList;
62
+ if (!hasCardBasedScope()) {
63
+ clonedTags = _.filter(tagsList, (tag) =>
64
+ !CARD_RELATED_TAGS.includes(tag?.definition?.value)
65
+ );
66
+ }
54
67
  _.forEach(clonedTags, (temp) => {
55
68
  const tag = temp.definition;
56
69
  if (!tag['tag-header']) { //if tag doesn't have subtag(s), which means this tag itself is tag and not a tag header.
@@ -16,6 +16,7 @@ import { createStructuredSelector } from 'reselect';
16
16
  import messages from './messages';
17
17
  import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
18
18
  import { CARD_RELATED_TAGS } from '../../containers/App/constants';
19
+ import { hasCardBasedScope } from '../../utils/common';
19
20
 
20
21
  const {Search} = CapInput;
21
22
  const {CapTreeNode} = CapTree;
@@ -139,7 +140,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
139
140
  const list = [];
140
141
  const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
141
142
  let clonedTags = _.cloneDeep(tags);
142
- if (!showCardsRelatedTags) {
143
+ if (!hasCardBasedScope()) {
143
144
  clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
144
145
  }
145
146
  _.forEach(clonedTags, (val = '', key) => {
@@ -29,7 +29,6 @@ export const GET_TOPBAR_MENU_DATA_FAILURE = 'creatives/cap/GET_TOPBAR_MENU_DATA_
29
29
  export const CLEAR_TOPBAR_MENU_DATA = 'creatives/cap/CLEAR_TOPBAR_MENU_DATA';
30
30
 
31
31
  export const SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY = 'SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY';
32
- export const SET_CARD_RELATED_TAGS_VISIBILITY = 'SET_CARD_RELATED_TAGS_VISIBILITY';
33
32
 
34
33
  export const CAMPAIGN_SETTINGS_URL = '/creatives/settings/message';
35
34
  export const ORG_SETTINGS_URL = '/org/index';
@@ -121,9 +121,6 @@ function capReducer(state = fromJS(initialState.cap), action) {
121
121
  .set('tagsToDisable', action.tagsToDisable)
122
122
  .set('parentTagsToDisable', action.parentTagsToDisable);
123
123
  }
124
- case types.SET_CARD_RELATED_TAGS_VISIBILITY: {
125
- return state.set('showCardsRelatedTags', action.showCardsRelatedTags);
126
- }
127
124
  default:
128
125
  return state;
129
126
  }
@@ -79,7 +79,6 @@ const makeSelectLoyaltyPromotionDisplay = () => createSelector(
79
79
  disableRelatedTags: globalState.get('disableLoyaltyPromotionRelatedTags'),
80
80
  childTagsToDisable: globalState.get('tagsToDisable') || [],
81
81
  parentTagstoDisable: globalState.get('parentTagsToDisable') || [],
82
- showCardsRelatedTags: globalState.get('showCardsRelatedTags') || false,
83
82
  }),
84
83
  );
85
84