@capillarytech/creatives-library 7.10.3 → 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
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 {
|
|
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
|
|
59
|
+
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable} = disableTagsDetails;
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
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 (!
|
|
143
|
+
if (!hasCardBasedScope()) {
|
|
143
144
|
clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
|
|
144
145
|
}
|
|
145
146
|
_.forEach(clonedTags, (val = '', key) => {
|
|
@@ -119,8 +119,7 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
119
119
|
case types.SET_LOYALTY_PROMOTION_RELATED_CREATIVE_TAGS_DISPLAY: {
|
|
120
120
|
return state.set('disableLoyaltyPromotionRelatedTags', action.disable)
|
|
121
121
|
.set('tagsToDisable', action.tagsToDisable)
|
|
122
|
-
.set('parentTagsToDisable', action.parentTagsToDisable)
|
|
123
|
-
.set('showCardsRelatedTags', action.showCardsRelatedTags);
|
|
122
|
+
.set('parentTagsToDisable', action.parentTagsToDisable);
|
|
124
123
|
}
|
|
125
124
|
default:
|
|
126
125
|
return state;
|
|
@@ -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
|
|