@capillarytech/creatives-library 7.17.32 → 7.17.33-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.
@@ -13,7 +13,7 @@ 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 = "https://storage.crm.n.content-cdn.io/ckeditor_full/ckeditor/ckeditor.js";
16
+ const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
17
17
  const user = localStorage.getItem('user');
18
18
  let locale = 'en';
19
19
  if (user && JSON.parse(user).lang) {
@@ -42,3 +42,5 @@ export const HOSPITALITY_RELATED_TAGS = [
42
42
  "email",
43
43
  "resID_Source",
44
44
  ];
45
+
46
+ 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.32",
4
+ "version": "7.17.33-alpha.2",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -17,7 +17,7 @@ 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';
20
+ import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS, CUSTOMER_BARCODE_TAG } from '../../containers/App/constants';
21
21
  import { hasCardBasedScope, hasHospitalityBasedScope } from '../../utils/common';
22
22
 
23
23
  import {
@@ -25,7 +25,7 @@ import {
25
25
  JAPANESE_HELP_TEXT,
26
26
  TAG_TRANSLATION_DOC,
27
27
  } from "../../containers/TagList/constants";
28
- import { JP_LOCALE_HIDE_FEATURE } from '../../v2Containers/App/constants';
28
+ import { ENABLE_CUSTOMER_BARCODE_TAG, JP_LOCALE_HIDE_FEATURE } from '../../v2Containers/App/constants';
29
29
  import { hidingDateTagsForJpLocale } from '../../v2Containers/TagList/utils';
30
30
 
31
31
 
@@ -176,12 +176,18 @@ 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);
179
180
  const list = [];
180
181
  const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
182
+ const customerBarcodeDisableText = <FormattedMessage {...messages.customerBarcodeDisable} />;
181
183
  let clonedTags = _.cloneDeep(tags);
182
184
  if (!hasCardBasedScope()) {
183
185
  clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
184
186
  }
187
+ //code to remove until barcode tag is not supported by BE
188
+ // if (!hasCardBasedScope()) {
189
+ // clonedTags = _.omit(clonedTags, CUSTOMER_BARCODE_TAG );
190
+ // }
185
191
  if (!hasHospitalityBasedScope()) {
186
192
  //filtering HOSPITALITY_RELATED_TAGS if org does not have HOSPITALITY_BASED_SCOPE feature enabled
187
193
  clonedTags = _.omit(clonedTags, HOSPITALITY_RELATED_TAGS);
@@ -207,10 +213,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
207
213
  );
208
214
  hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
209
215
  } else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
210
- const childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
216
+ let childDisabled = false;
217
+ if (key === "customer_barcode" && !enabledCustomerBarcode) {
218
+ childDisabled = true;
219
+ }
220
+ else childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
211
221
  const tempNode = (
212
222
  <CapTreeNode
213
- title={childDisabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
223
+ title={childDisabled ? <CapTooltip title={key === "customer_barcode" ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)} //need to add key name to get tooltip
214
224
  tag={val}
215
225
  isLeaf
216
226
  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,8 @@ 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 = "https://storage.crm.n.content-cdn.io/ckeditor_full/ckeditor/ckeditor.js";
16
+ const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
17
+ //const defaultScriptUrl = '{hostName}/arya/ui/library/ckeditor/ckeditor.js'; uncomment for local testing
17
18
  const user = localStorage.getItem('user');
18
19
  let locale = 'en';
19
20
  if (user && JSON.parse(user).lang) {
@@ -118,3 +118,4 @@ export const LOYALTY = 'loyalty';
118
118
  export const FAILURE = 'FAILURE';
119
119
  export const DATE_DISPLAY_FORMAT = 'D MMM YYYY';
120
120
  export const TIME_DISPLAY_FORMAT = 'hh:mm A';
121
+ export const ENABLE_CUSTOMER_BARCODE_TAG = 'ENABLE_CUSTOMER_BARCODE_TAG';
@@ -643,7 +643,9 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
643
643
  } else if (data === "unsubscribe" && this.state.editorInstanse) {
644
644
  const anchor = `<a href='{{${data}}}'>${data}</a>`;
645
645
  this.state.editorInstanse.insertHtml(`${anchor}`);
646
- } else if (this.state.editorInstanse) {
646
+ } else if (data === "customer_barcode" && this.state.editorInstanse) {
647
+ 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}}}" />`);
648
+ } else if (this.state.editorInstanse){
647
649
  this.state.editorInstanse.insertHtml(`{{${data}}}`);
648
650
  }
649
651
  //this.resetCkEditorInstance(currentTab, formData, true, data);