@capillarytech/creatives-library 7.17.39 → 7.17.40-alpha.0

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.
@@ -7,6 +7,8 @@ export const TRAI_DLT = 'TRAI_DLT';
7
7
  export const CARD_BASED_SCOPE = 'CARD_BASED_SCOPE';
8
8
  export const HOSPITALITY_BASED_SCOPE = 'HOSPITALITY_BASED_SCOPE';
9
9
  export const REGISTRATION_CUSTOM_FIELD = 'Registration custom fields';
10
+ export const GIFT_CARDS = 'GIFT_CARDS';
11
+ export const PROMO_ENGINE = 'PROMO_ENGINE';
10
12
  export const CUSTOM_TAG = 'CustomTagMessage';
11
13
  export const CUSTOMER_EXTENDED_FIELD = 'Customer extended fields';
12
14
  export const EXTENDED_TAG = 'ExtendedTagMessage';
@@ -43,5 +45,29 @@ export const HOSPITALITY_RELATED_TAGS = [
43
45
  "email",
44
46
  "resID_Source",
45
47
  ];
48
+ export const GIFT_VOUCHER_RELATED_TAGS = [
49
+ "gift_voucher",
50
+ "gift_voucher_expiry_date.FORMAT_1",
51
+ "gift_voucher_expiry_date.FORMAT_2",
52
+ "gift_voucher_expiry_date.FORMAT_3",
53
+ "gift_voucher_expiry_date.FORMAT_4",
54
+ "gift_voucher_expiry_date.FORMAT_5",
55
+ "gift_voucher_expiry_date.FORMAT_6",
56
+ "gift_voucher_expiry_date.FORMAT_7",
57
+ "gift_voucher_expiry_date.FORMAT_8",
58
+ "gift_voucher_expiry_date",
59
+ ];
60
+ export const PROMO_ENGINE_RELATED_TAGS = [
61
+ "promotion",
62
+ "promotion_expiry_date.FORMAT_1",
63
+ "promotion_expiry_date.FORMAT_2",
64
+ "promotion_expiry_date.FORMAT_3",
65
+ "promotion_expiry_date.FORMAT_4",
66
+ "promotion_expiry_date.FORMAT_5",
67
+ "promotion_expiry_date.FORMAT_6",
68
+ "promotion_expiry_date.FORMAT_7",
69
+ "promotion_expiry_date.FORMAT_8",
70
+ "promotion_expiry_date",
71
+ ];
46
72
 
47
73
  export const CUSTOMER_BARCODE_TAG = "customer_barcode";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.39",
4
+ "version": "7.17.40-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  CARD_BASED_SCOPE,
8
8
  HOSPITALITY_RELATED_TAGS,
9
9
  HOSPITALITY_BASED_SCOPE,
10
+ GIFT_CARDS,
11
+ PROMO_ENGINE,
10
12
  EXTENDED_TAG,
11
13
  CUSTOMER_EXTENDED_FIELD,
12
14
  CUSTOM_TAG,
@@ -66,7 +68,15 @@ export const hasHospitalityBasedScope = Auth.hasFeatureAccess.bind(
66
68
  null,
67
69
  HOSPITALITY_BASED_SCOPE,
68
70
  );
71
+ export const hasPromoFeature = Auth.hasFeatureAccess.bind(
72
+ null,
73
+ PROMO_ENGINE,
74
+ );
69
75
 
76
+ export const hasGiftVoucherFeature = Auth.hasFeatureAccess.bind(
77
+ null,
78
+ GIFT_CARDS,
79
+ );
70
80
  export const hasJPLocaleHideFeatureEnabled = Auth.hasFeatureAccess.bind(
71
81
  null,
72
82
  JP_LOCALE_HIDE_FEATURE,
@@ -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
- const { locale : userLocale } = this.props?.intl || {};
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,
@@ -117,7 +132,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
117
132
  });
118
133
 
119
134
  const mainTagsCloned = _.cloneDeep(mainTags);
120
- //Insert subtags in tag headers and reomve them from top level
135
+ //Insert subtags in tag headers and remove them from top level
121
136
  const result = {};
122
137
  _.forEach(mainTagsCloned, (tag, key) => {
123
138
  if (tag['tag-header']) {