@capillarytech/creatives-library 7.17.33 → 7.17.35-alpha.2
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/components/Ckeditor/index.js +2 -1
- package/containers/App/constants.js +3 -0
- package/package.json +1 -1
- package/utils/common.js +11 -0
- package/utils/tests/cdnTransformation.test.js +1 -0
- package/v2Components/CapTagList/index.js +10 -4
- package/v2Components/CapTagList/messages.js +4 -0
- package/v2Components/Ckeditor/index.js +4 -1
- package/v2Components/FormBuilder/index.js +9 -1
- package/v2Containers/Email/index.js +4 -1
|
@@ -13,7 +13,8 @@ import React from 'react';
|
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
// import messages from './messages';
|
|
15
15
|
const loadScript = require('load-script');
|
|
16
|
-
|
|
16
|
+
// fetching ckeditor from s3 by rerouting through arya whitelisted services
|
|
17
|
+
const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
|
|
17
18
|
const user = localStorage.getItem('user');
|
|
18
19
|
let locale = 'en';
|
|
19
20
|
if (user && JSON.parse(user).lang) {
|
|
@@ -11,6 +11,7 @@ export const CUSTOM_TAG = 'CustomTagMessage';
|
|
|
11
11
|
export const CUSTOMER_EXTENDED_FIELD = 'Customer extended fields';
|
|
12
12
|
export const EXTENDED_TAG = 'ExtendedTagMessage';
|
|
13
13
|
export const JP_LOCALE_HIDE_FEATURE = 'JP_LOCALE_HIDE_FEATURE';
|
|
14
|
+
export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
|
|
14
15
|
|
|
15
16
|
export const CARD_RELATED_TAGS = [
|
|
16
17
|
'card_series',
|
|
@@ -42,3 +43,5 @@ export const HOSPITALITY_RELATED_TAGS = [
|
|
|
42
43
|
"email",
|
|
43
44
|
"resID_Source",
|
|
44
45
|
];
|
|
46
|
+
|
|
47
|
+
export const CUSTOMER_BARCODE_TAG = "customer_barcode";
|
package/package.json
CHANGED
package/utils/common.js
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
CUSTOM_TAG,
|
|
13
13
|
REGISTRATION_CUSTOM_FIELD,
|
|
14
14
|
JP_LOCALE_HIDE_FEATURE,
|
|
15
|
+
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
16
|
+
CUSTOMER_BARCODE_TAG,
|
|
15
17
|
} from '../containers/App/constants';
|
|
16
18
|
import { apiMessageFormatHandler } from './commonUtils';
|
|
17
19
|
|
|
@@ -71,6 +73,11 @@ export const hasJPLocaleHideFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
|
71
73
|
JP_LOCALE_HIDE_FEATURE,
|
|
72
74
|
);
|
|
73
75
|
|
|
76
|
+
export const hasCustomerBarcodeFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
77
|
+
null,
|
|
78
|
+
ENABLE_CUSTOMER_BARCODE_TAG,
|
|
79
|
+
);
|
|
80
|
+
|
|
74
81
|
//filtering tags based on scope
|
|
75
82
|
export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
|
|
76
83
|
(tag) => !tagsToFilter?.includes(tag?.definition?.value)
|
|
@@ -89,6 +96,10 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
|
|
|
89
96
|
//filtering HOSPITALITY_RELATED_TAGS if org does not have HOSPITALITY_BASED_SCOPE feature enabled
|
|
90
97
|
clonedTags = filterTags(HOSPITALITY_RELATED_TAGS, tagsList);
|
|
91
98
|
}
|
|
99
|
+
if (!hasCustomerBarcodeFeatureEnabled()) {
|
|
100
|
+
//filtering CUSTOMER_BARCODE_TAG if org does not have CUSTOMER_BARCODE_TAG feature enabled
|
|
101
|
+
clonedTags = filterTags(CUSTOMER_BARCODE_TAG, clonedTags);
|
|
102
|
+
}
|
|
92
103
|
_.forEach(clonedTags, (temp) => {
|
|
93
104
|
const tag = temp.definition;
|
|
94
105
|
if (!tag['tag-header']) { //if tag doesn't have subtag(s), which means this tag itself is tag and not a tag header.
|
|
@@ -17,8 +17,8 @@ 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_BARCODE_TAG } from '../../containers/App/constants';
|
|
21
|
+
import { hasCardBasedScope, hasCustomerBarcodeFeatureEnabled, hasHospitalityBasedScope } from '../../utils/common';
|
|
22
22
|
|
|
23
23
|
import {
|
|
24
24
|
GET_TRANSLATION_MAPPED,
|
|
@@ -178,6 +178,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
178
178
|
const hideDateTagsForJpLocale = accessibleFeatures.includes(JP_LOCALE_HIDE_FEATURE);
|
|
179
179
|
const list = [];
|
|
180
180
|
const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
|
|
181
|
+
const customerBarcodeDisableText = <FormattedMessage {...messages.customerBarcodeDisable} />;
|
|
181
182
|
let clonedTags = _.cloneDeep(tags);
|
|
182
183
|
if (!hasCardBasedScope()) {
|
|
183
184
|
clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
|
|
@@ -207,10 +208,15 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
207
208
|
);
|
|
208
209
|
hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
|
|
209
210
|
} else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
|
|
210
|
-
|
|
211
|
+
let childDisabled = true;
|
|
212
|
+
if (key === CUSTOMER_BARCODE_TAG && !hasCustomerBarcodeFeatureEnabled()) {
|
|
213
|
+
childDisabled = true;
|
|
214
|
+
} else {
|
|
215
|
+
childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
|
|
216
|
+
}
|
|
211
217
|
const tempNode = (
|
|
212
218
|
<CapTreeNode
|
|
213
|
-
title={childDisabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
|
|
219
|
+
title={childDisabled ? <CapTooltip title={key === CUSTOMER_BARCODE_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
|
|
214
220
|
tag={val}
|
|
215
221
|
isLeaf
|
|
216
222
|
key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
|
|
@@ -46,4 +46,8 @@ export default defineMessages({
|
|
|
46
46
|
id: `creatives.componentsV2.CapTagList.loyaltyAttributeDisable`,
|
|
47
47
|
defaultMessage: 'You won’t be able to add loyalty related attributes since the loyalty program/ card series is None.',
|
|
48
48
|
},
|
|
49
|
+
"customerBarcodeDisable": {
|
|
50
|
+
id: `creatives.componentsV2.CapTagList.customerBarcodeDisable`,
|
|
51
|
+
defaultMessage: 'This label is not enabled for your organization. Please connect with your Capillary POC',
|
|
52
|
+
},
|
|
49
53
|
});
|
|
@@ -13,7 +13,10 @@ import React from 'react';
|
|
|
13
13
|
import _ from 'lodash';
|
|
14
14
|
// import messages from './messages';
|
|
15
15
|
const loadScript = require('load-script');
|
|
16
|
-
const defaultScriptUrl =
|
|
16
|
+
const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
|
|
17
|
+
/*const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
|
|
18
|
+
**Uncomment the above line to use CKEDITOR in local
|
|
19
|
+
*/
|
|
17
20
|
const user = localStorage.getItem('user');
|
|
18
21
|
let locale = 'en';
|
|
19
22
|
if (user && JSON.parse(user).lang) {
|
|
@@ -54,6 +54,7 @@ import { convert } from 'html-to-text';
|
|
|
54
54
|
import { AI_SUGGESTION_API_URL } from './constants';
|
|
55
55
|
import { GET_TRANSLATION_MAPPED } from '../../containers/TagList/constants';
|
|
56
56
|
import moment from 'moment';
|
|
57
|
+
import { CUSTOMER_BARCODE_TAG } from '../../containers/App/constants';
|
|
57
58
|
const TabPane = Tabs.TabPane;
|
|
58
59
|
const {Column} = Table;
|
|
59
60
|
const {TextArea} = CapInput;
|
|
@@ -1138,7 +1139,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1138
1139
|
});
|
|
1139
1140
|
const regex = /{{[(A-Z\w+(\s\w+)*$\(\)@!#$%^&*~.,/\\]+}}/g;
|
|
1140
1141
|
let match = regex.exec(content);
|
|
1141
|
-
|
|
1142
|
+
const regexImgSrc=/<img[^>]*\bsrc\s*=\s*"[^"]*{{customer_barcode}}[^"]*"/;
|
|
1143
|
+
let matchImg = regexImgSrc.exec(content);
|
|
1144
|
+
const regexCustomerBarcode = /{{customer_barcode}}(?![^<]*>)/g;
|
|
1145
|
+
let matchCustomerBarcode = regexCustomerBarcode.exec(content);
|
|
1146
|
+
while (match !== null ) {
|
|
1142
1147
|
const tagValue = match[0].substring(this.indexOfEnd(match[0], '{{'), match[0].indexOf('}}'));
|
|
1143
1148
|
match = regex.exec(content);
|
|
1144
1149
|
let ifSupported = false;
|
|
@@ -1146,6 +1151,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1146
1151
|
if (tag.definition.value === tagValue) {
|
|
1147
1152
|
ifSupported = true;
|
|
1148
1153
|
}
|
|
1154
|
+
if(tagValue === CUSTOMER_BARCODE_TAG && (matchImg === null || matchCustomerBarcode !== null)){
|
|
1155
|
+
ifSupported = false;
|
|
1156
|
+
}
|
|
1149
1157
|
});
|
|
1150
1158
|
const ifSkipped = this.skipTags(tagValue);
|
|
1151
1159
|
if (ifSkipped) {
|
|
@@ -36,6 +36,7 @@ import { FONT_COLOR_05 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
|
36
36
|
import { gtmPush } from '../../utils/gtmTrackers';
|
|
37
37
|
const {CapCustomCardList} = CapCustomCard;
|
|
38
38
|
import {transformEmailTemplates, storeS3FileSizeDetails, CREATIVES_S3_ASSET_FILESIZES} from '../../utils/cdnTransformation';
|
|
39
|
+
import { CUSTOMER_BARCODE_TAG } from '../../containers/App/constants';
|
|
39
40
|
|
|
40
41
|
export class Email extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
41
42
|
constructor(props) {
|
|
@@ -643,7 +644,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
643
644
|
} else if (data === "unsubscribe" && this.state.editorInstanse) {
|
|
644
645
|
const anchor = `<a href='{{${data}}}'>${data}</a>`;
|
|
645
646
|
this.state.editorInstanse.insertHtml(`${anchor}`);
|
|
646
|
-
} else if (this.state.editorInstanse) {
|
|
647
|
+
} else if (data === CUSTOMER_BARCODE_TAG && this.state.editorInstanse) {
|
|
648
|
+
this.state.editorInstanse.insertHtml(`<img src="https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/8ebc8301-e262-45a6-bdab-ff0de91a.png?code={{${data}}}" />`);
|
|
649
|
+
} else if (this.state.editorInstanse){
|
|
647
650
|
this.state.editorInstanse.insertHtml(`{{${data}}}`);
|
|
648
651
|
}
|
|
649
652
|
//this.resetCkEditorInstance(currentTab, formData, true, data);
|