@capillarytech/creatives-library 7.17.33-alpha.5 → 7.17.33-alpha.7
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
package/utils/common.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
CUSTOM_TAG,
|
|
13
13
|
REGISTRATION_CUSTOM_FIELD,
|
|
14
14
|
JP_LOCALE_HIDE_FEATURE,
|
|
15
|
+
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
15
16
|
} from '../containers/App/constants';
|
|
16
17
|
import { apiMessageFormatHandler } from './commonUtils';
|
|
17
18
|
|
|
@@ -71,10 +72,10 @@ export const hasJPLocaleHideFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
|
71
72
|
JP_LOCALE_HIDE_FEATURE,
|
|
72
73
|
);
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
export const hasCustomerBarcodeFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
76
|
+
null,
|
|
77
|
+
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
78
|
+
);
|
|
78
79
|
|
|
79
80
|
//filtering tags based on scope
|
|
80
81
|
export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
|
|
@@ -17,15 +17,15 @@ import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
|
|
|
17
17
|
import { createStructuredSelector } from 'reselect';
|
|
18
18
|
import messages from './messages';
|
|
19
19
|
import { makeSelectLoyaltyPromotionDisplay } from '../../v2Containers/Cap/selectors';
|
|
20
|
-
import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS } from '../../containers/App/constants';
|
|
21
|
-
import { hasCardBasedScope, hasHospitalityBasedScope } from '../../utils/common';
|
|
20
|
+
import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS, CUSTOMER_BAR_TAG } from '../../containers/App/constants';
|
|
21
|
+
import { hasCardBasedScope, hasCustomerBarcodeFeatureEnabled, hasHospitalityBasedScope } from '../../utils/common';
|
|
22
22
|
|
|
23
23
|
import {
|
|
24
24
|
GET_TRANSLATION_MAPPED,
|
|
25
25
|
JAPANESE_HELP_TEXT,
|
|
26
26
|
TAG_TRANSLATION_DOC,
|
|
27
27
|
} from "../../containers/TagList/constants";
|
|
28
|
-
import {
|
|
28
|
+
import { JP_LOCALE_HIDE_FEATURE } from '../../v2Containers/App/constants';
|
|
29
29
|
import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
|
|
30
30
|
|
|
31
31
|
|
|
@@ -176,8 +176,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
176
176
|
const { disableRelatedTags, childTagsToDisable, parentTagstoDisable, showCardsRelatedTags } = this?.props?.disableTagsDetails;
|
|
177
177
|
const { accessibleFeatures = [] } = this?.props?.currentOrgDetails || {};
|
|
178
178
|
const hideDateTagsForJpLocale = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
|
|
179
|
-
const enabledCustomerBarcode = accessibleFeatures.includes(ENABLE_CUSTOMER_BARCODE_TAG);
|
|
180
|
-
console.log("enabled-->", accessibleFeatures, enabledCustomerBarcode);
|
|
181
179
|
const list = [];
|
|
182
180
|
const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
|
|
183
181
|
const customerBarcodeDisableText = <FormattedMessage {...messages.customerBarcodeDisable} />;
|
|
@@ -185,10 +183,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
185
183
|
if (!hasCardBasedScope()) {
|
|
186
184
|
clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
|
|
187
185
|
}
|
|
188
|
-
// code to remove until barcode tag is not supported by BE
|
|
189
|
-
// if (!hasCustomerBarcodeFeatureEnabled()) {
|
|
190
|
-
// clonedTags = _.omit(clonedTags, ENABLE_CUSTOMER_BARCODE_TAG);
|
|
191
|
-
// }
|
|
192
186
|
if (!hasHospitalityBasedScope()) {
|
|
193
187
|
//filtering HOSPITALITY_RELATED_TAGS if org does not have HOSPITALITY_BASED_SCOPE feature enabled
|
|
194
188
|
clonedTags = _.omit(clonedTags, HOSPITALITY_RELATED_TAGS);
|
|
@@ -215,14 +209,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
215
209
|
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
|
|
216
210
|
} else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
|
|
217
211
|
let childDisabled = true;
|
|
218
|
-
if (key ===
|
|
212
|
+
if (key === CUSTOMER_BAR_TAG && !hasCustomerBarcodeFeatureEnabled()) {
|
|
219
213
|
childDisabled = true;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
} else {
|
|
215
|
+
childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
216
|
+
}
|
|
223
217
|
const tempNode = (
|
|
224
218
|
<CapTreeNode
|
|
225
|
-
title={childDisabled ? <CapTooltip title={key ===
|
|
219
|
+
title={childDisabled ? <CapTooltip title={key === CUSTOMER_BAR_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
|
|
226
220
|
tag={val}
|
|
227
221
|
isLeaf
|
|
228
222
|
key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
|
|
@@ -1136,9 +1136,13 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1136
1136
|
}
|
|
1137
1137
|
});
|
|
1138
1138
|
});
|
|
1139
|
-
const regex = /{{[(A-Z\w
|
|
1139
|
+
const regex = /{{[(A-Z\w\(\)@!#$%^&*~.,/\\]+}}/g;
|
|
1140
1140
|
let match = regex.exec(content);
|
|
1141
|
-
|
|
1141
|
+
const regexImgSrc=/<img[^>]*\bsrc\s*=\s*"[^"]*{{customer_barcode}}[^"]*"/;
|
|
1142
|
+
let matchImg = regexImgSrc.exec(content);
|
|
1143
|
+
const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
|
|
1144
|
+
let matchCustomerBarcode = regexCustomerBarcode.exec(content);
|
|
1145
|
+
while (match !== null ) {
|
|
1142
1146
|
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1143
1147
|
match = regex.exec(content);
|
|
1144
1148
|
let ifSupported = false;
|
|
@@ -1146,6 +1150,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1146
1150
|
if (tag.definition.value === tagValue) {
|
|
1147
1151
|
ifSupported = true;
|
|
1148
1152
|
}
|
|
1153
|
+
if(tagValue === "customer_barcode" && (matchImg === null || matchCustomerBarcode !== null)){
|
|
1154
|
+
ifSupported = false;
|
|
1155
|
+
}
|
|
1149
1156
|
});
|
|
1150
1157
|
const ifSkipped = this.skipTags(tagValue);
|
|
1151
1158
|
if (ifSkipped) {
|