@capillarytech/creatives-library 7.17.33-alpha.6 → 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.
@@ -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 = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
16
+ const defaultScriptUrl = "https://storage.crm.n.content-cdn.io/ckeditor_full/ckeditor/ckeditor.js";
17
17
  const user = localStorage.getItem('user');
18
18
  let locale = 'en';
19
19
  if (user && JSON.parse(user).lang) {
@@ -43,4 +43,5 @@ export const HOSPITALITY_RELATED_TAGS = [
43
43
  "resID_Source",
44
44
  ];
45
45
 
46
- export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
46
+ export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
47
+ export const CUSTOMER_BAR_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.33-alpha.6",
4
+ "version": "7.17.33-alpha.7",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -6,7 +6,6 @@ import * as cdnTransformationHandler from './cdnTransformation.handler.mockdata'
6
6
 
7
7
  var bugsnagSpy;
8
8
  var localStorageMock;
9
- jest.setTimeout(10000);
10
9
  beforeEach(() => {
11
10
  localStorageMock = (function () {
12
11
  var store = {
@@ -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, ENABLE_CUSTOMER_BARCODE_TAG } from '../../containers/App/constants';
20
+ import { CARD_RELATED_TAGS, HOSPITALITY_RELATED_TAGS, CUSTOMER_BAR_TAG } from '../../containers/App/constants';
21
21
  import { hasCardBasedScope, hasCustomerBarcodeFeatureEnabled, hasHospitalityBasedScope } from '../../utils/common';
22
22
 
23
23
  import {
@@ -176,7 +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
179
  const list = [];
181
180
  const loyaltyAttrDisableText = <FormattedMessage {...messages.loyaltyAttributeDisable} />;
182
181
  const customerBarcodeDisableText = <FormattedMessage {...messages.customerBarcodeDisable} />;
@@ -184,10 +183,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
184
183
  if (!hasCardBasedScope()) {
185
184
  clonedTags = _.omit(clonedTags, CARD_RELATED_TAGS);
186
185
  }
187
- // code to remove until barcode tag is not supported by BE
188
- // if (!hasCustomerBarcodeFeatureEnabled()) {
189
- // clonedTags = _.omit(clonedTags, ENABLE_CUSTOMER_BARCODE_TAG);
190
- // }
191
186
  if (!hasHospitalityBasedScope()) {
192
187
  //filtering HOSPITALITY_RELATED_TAGS if org does not have HOSPITALITY_BASED_SCOPE feature enabled
193
188
  clonedTags = _.omit(clonedTags, HOSPITALITY_RELATED_TAGS);
@@ -214,13 +209,14 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
214
209
  hidingDateTagsForJpLocale(hideDateTagsForJpLocale, val, list, tagValue);
215
210
  } else if (searchString === '' || !searchString || ((val.name || '').toLowerCase().indexOf(searchString.toLowerCase()) !== -1)) {
216
211
  let childDisabled = true;
217
- if (key === "customer_barcode" && !hasCustomerBarcodeFeatureEnabled) {
212
+ if (key === CUSTOMER_BAR_TAG && !hasCustomerBarcodeFeatureEnabled()) {
218
213
  childDisabled = true;
219
- }
220
- else childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
214
+ } else {
215
+ childDisabled = disableRelatedTags ? childTagsToDisable.includes(key) : false;
216
+ }
221
217
  const tempNode = (
222
218
  <CapTreeNode
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
219
+ title={childDisabled ? <CapTooltip title={key === CUSTOMER_BAR_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
224
220
  tag={val}
225
221
  isLeaf
226
222
  key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
@@ -13,8 +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 = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
17
- //const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
16
+ const defaultScriptUrl = "https://storage.crm.n.content-cdn.io/ckeditor_full/ckeditor/ckeditor.js";
18
17
  const user = localStorage.getItem('user');
19
18
  let locale = 'en';
20
19
  if (user && JSON.parse(user).lang) {
@@ -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+(\s\w+)*$\(\)@!#$%^&*~.,/\\]+}}/g;
1139
+ const regex = /{{[(A-Z\w\(\)@!#$%^&*~.,/\\]+}}/g;
1140
1140
  let match = regex.exec(content);
1141
- while (match !== null) {
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) {
@@ -118,4 +118,3 @@ 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';