@capillarytech/creatives-library 8.0.338 → 8.0.339

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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/utils/tests/tagValidations.test.js +0 -20
  3. package/v2Components/CapTagList/index.js +23 -28
  4. package/v2Components/CapTagList/style.scss +0 -29
  5. package/v2Components/CapTagListWithInput/index.js +0 -4
  6. package/v2Components/CapWhatsappCTA/index.js +0 -2
  7. package/v2Components/FormBuilder/index.js +0 -7
  8. package/v2Components/HtmlEditor/HTMLEditor.js +1 -6
  9. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
  10. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +2 -927
  11. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +0 -3
  12. package/v2Containers/BeeEditor/index.js +0 -3
  13. package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -28
  14. package/v2Containers/CreativesContainer/index.js +7 -9
  15. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -47
  16. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -5
  17. package/v2Containers/Email/index.js +0 -1
  18. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1 -6
  19. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +0 -3
  20. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +2 -20
  21. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +1 -16
  22. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +0 -3
  23. package/v2Containers/EmailWrapper/index.js +0 -4
  24. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -1
  25. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +0 -9
  26. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -1
  27. package/v2Containers/MobilePush/Create/index.js +0 -2
  28. package/v2Containers/MobilePush/Edit/index.js +0 -2
  29. package/v2Containers/MobilepushWrapper/index.js +1 -3
  30. package/v2Containers/Rcs/index.js +7 -1
  31. package/v2Containers/Sms/Create/index.js +0 -2
  32. package/v2Containers/Sms/Edit/index.js +0 -2
  33. package/v2Containers/SmsTrai/Edit/index.js +0 -2
  34. package/v2Containers/SmsWrapper/index.js +0 -2
  35. package/v2Containers/TagList/index.js +5 -62
  36. package/v2Containers/TagList/messages.js +0 -4
  37. package/v2Containers/TagList/tests/TagList.test.js +20 -124
  38. package/v2Containers/TagList/tests/mockdata.js +0 -17
  39. package/v2Containers/Viber/index.js +0 -3
  40. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +2 -0
  41. package/v2Containers/WebPush/Create/index.js +1 -9
  42. package/v2Containers/Whatsapp/index.js +0 -5
  43. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -20
  44. package/v2Containers/Zalo/index.js +0 -2
  45. package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +0 -63
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.338",
4
+ "version": "8.0.339",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -360,26 +360,6 @@ describe("validateTags", () => {
360
360
  expect(resultWhitespace.valid).toBe(true);
361
361
  expect(resultWhitespace.unsupportedTags ?? []).toEqual([]);
362
362
  });
363
-
364
- it('should treat tags from waitEventContextTags as supported', () => {
365
- const content = 'Hello {{waitEvent.orderId}}';
366
- const tagsParam = [];
367
- const injectedTagsParams = [];
368
- const location = { query: { module: 'DEFAULT' } };
369
- const tagModule = null;
370
-
371
- const result = validateTags({
372
- content,
373
- tagsParam,
374
- injectedTagsParams,
375
- location,
376
- tagModule,
377
- });
378
-
379
- expect(result.valid).toEqual(true);
380
- expect(result.missingTags).toEqual([]);
381
- expect(result.isBraceError).toEqual(false);
382
- });
383
363
  });
384
364
 
385
365
  describe('validateTags wrapper (v2 consumers)', () => {
@@ -44,7 +44,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
44
44
  super(props);
45
45
  this.state = {
46
46
  tagValue: '',
47
- selectedNodeKey: '',
48
47
  expandedKeys: [],
49
48
  searchValue: '',
50
49
  autoExpandParent: true,
@@ -123,11 +122,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
123
122
  this.handleOnExpand(info.node.props.eventKey);
124
123
  };
125
124
 
126
- getSearchedExpandedKeys(tags, value = '', parentPath = '') {
125
+ getSearchedExpandedKeys(tags, value = '') {
127
126
  let list = [];
128
127
  _.forEach(tags, (val = {}, key) => {
129
- const rawKey = val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`;
130
- const nodeKey = parentPath ? `${parentPath}.${rawKey}` : rawKey;
131
128
  const tagName =
132
129
  typeof val?.name === 'string'
133
130
  ? _.toLower(_.get(val, "name", ""))
@@ -140,16 +137,16 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
140
137
  && (tagName.includes(searchStringLower)
141
138
  || tagNameWithoutUnderscore.includes(searchStringLower))
142
139
  ) {
143
- list.push(nodeKey);
140
+ list.push(key);
144
141
  }
145
- const temp = this.getSearchedExpandedKeys(val?.subtags, value, nodeKey);
142
+ const temp = this.getSearchedExpandedKeys(val?.subtags, value);
146
143
  list = list.concat(temp);
147
144
  } else if (
148
145
  val?.name
149
146
  && (tagName.includes(searchStringLower)
150
147
  || tagNameWithoutUnderscore.includes(searchStringLower))
151
148
  ) {
152
- list.push(nodeKey);
149
+ list.push(key);
153
150
  }
154
151
  });
155
152
  return list;
@@ -203,17 +200,12 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
203
200
  handleOnSelect = (selectedKeys, info) => {
204
201
  if (selectedKeys.length > 0) {
205
202
  if (info && info.selectedNodes && info.selectedNodes.length > 0 && info.selectedNodes[0].props.isLeaf) {
206
- const selectedNode = info.selectedNodes[0];
207
- const selectedTagValue = selectedNode?.props?.tagKey || selectedKeys[0];
208
- this.setState({
209
- tagValue: selectedTagValue,
210
- selectedNodeKey: selectedKeys[0],
211
- });
212
- const ifDynamicTag = this.checkIfDynamicTag(selectedTagValue);
203
+ this.setState({tagValue: selectedKeys[0]});
204
+ const ifDynamicTag = this.checkIfDynamicTag(selectedKeys[0]);
213
205
  if (ifDynamicTag) {
214
206
  this.renderDynamicTagFlow();
215
207
  } else {
216
- this.props.onSelect([selectedTagValue], info);
208
+ this.props.onSelect(selectedKeys, info);
217
209
  this.setState({visible: false});
218
210
  }
219
211
  } else if (info && info.selectedNodes && info.selectedNodes.length > 0 && !info.selectedNodes[0].props.isLeaf) {
@@ -245,7 +237,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
245
237
  this.setState({showModal: true, visible: false});
246
238
  };
247
239
 
248
- renderTags = (tags, parentPath = '') => {
240
+ renderTags = (tags) => {
249
241
  const searchString = this.state.searchValue || '';
250
242
  const {
251
243
  disableRelatedTags, childTagsToDisable, parentTagstoDisable,
@@ -268,8 +260,6 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
268
260
  clonedTags = _.omit(clonedTags, CUSTOMER_BARCODE_TAG);
269
261
  }
270
262
  _.forEach(clonedTags, (val = '', key) => {
271
- const rawKey = val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`;
272
- const nodeKey = parentPath ? `${parentPath}.${rawKey}` : rawKey;
273
263
  let supportedTagsString = '';
274
264
  _.forEach(val.supportedTags, (supportedTag) => {
275
265
  supportedTagsString += `${supportedTag} ,`;
@@ -286,14 +276,13 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
286
276
  || tagNameWithoutUnderscore.includes(searchStringLower));
287
277
  if (_.has(val, 'subtags')) {
288
278
  const disabled = disableRelatedTags ? parentTagstoDisable.includes(key) : false;
289
- const temp = this.renderTags(val?.subtags, nodeKey);
279
+ const temp = this.renderTags(val?.subtags);
290
280
  if (temp?.length) {
291
281
  const tagValue = (
292
282
  <CapTreeNode
293
283
  title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
294
284
  tag={val}
295
- tagKey={rawKey}
296
- key={nodeKey}
285
+ key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
297
286
  disabled={disabled}
298
287
  >
299
288
  {temp}
@@ -328,9 +317,12 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
328
317
  )
329
318
  }
330
319
  tag={val}
331
- tagKey={rawKey}
332
320
  isLeaf
333
- key={nodeKey}
321
+ key={
322
+ val?.incentiveSeriesId
323
+ ? `${key}(${val?.incentiveSeriesId})`
324
+ : `${key}`
325
+ }
334
326
  disabled={childDisabled}
335
327
  >
336
328
  </CapTreeNode>
@@ -361,9 +353,12 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
361
353
  )
362
354
  }
363
355
  tag={val}
364
- tagKey={rawKey}
365
356
  isLeaf
366
- key={nodeKey}
357
+ key={
358
+ val?.incentiveSeriesId
359
+ ? `${key}(${val?.incentiveSeriesId})`
360
+ : `${key}`
361
+ }
367
362
  disabled={childDisabled}
368
363
  >
369
364
  </CapTreeNode>
@@ -390,7 +385,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
390
385
  } = this.props;
391
386
  const {formatMessage} = intl;
392
387
  const {
393
- tagValue, selectedNodeKey, expandedKeys, autoExpandParent, visible, translationLang, selectedContext, isLoadingLoyaltyTags, isLoadingContextChange,
388
+ tagValue, expandedKeys, autoExpandParent, visible, translationLang, selectedContext, isLoadingLoyaltyTags, isLoadingContextChange,
394
389
  } = this.state;
395
390
 
396
391
  // Show loading spinner if general loading OR if specifically loading loyalty tags OR if context change is in progress
@@ -409,7 +404,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
409
404
  },
410
405
  ];
411
406
  const contentSection = (
412
- <CapRow className="cap-tag-list-popover-inner">
407
+ <CapRow>
413
408
  <CapSpin tip={formatMessage(messages.gettingTags)} spinning={shouldShowLoading}>
414
409
  <Search
415
410
  style={{ marginBottom: 8, width: '250px'}}
@@ -429,7 +424,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
429
424
  <CapTree
430
425
  styling={{height: '350px', overflow: 'auto'}}
431
426
  onSelect={this.handleOnSelect}
432
- selectedKeys={selectedNodeKey ? [selectedNodeKey] : []}
427
+ selectedKeys={tagValue}
433
428
  expandedKeys={expandedKeys}
434
429
  autoExpandParent={autoExpandParent}
435
430
  onExpand={this.onExpand}
@@ -1,34 +1,5 @@
1
1
  @import "~@capillarytech/cap-ui-library/styles/_variables";
2
2
 
3
- .cap-tag-list-popover-inner {
4
- max-width: 20rem;
5
- min-width: 0;
6
- box-sizing: border-box;
7
-
8
- .ant-tree.cap-tree-v2.ant-tree-icon-hide {
9
- width: 100%;
10
- max-width: 100%;
11
-
12
- ul {
13
- max-width: 100%;
14
- }
15
-
16
- li {
17
- overflow: hidden;
18
- max-width: 100%;
19
- }
20
-
21
- li .ant-tree-node-content-wrapper {
22
- width: calc(100% - 3.5rem); // leave room for switcher (~24px)
23
- max-width: calc(100% - 3.5rem);
24
- overflow: hidden;
25
- vertical-align: top;
26
- box-sizing: border-box;
27
- text-overflow: ellipsis;
28
- }
29
- }
30
- }
31
-
32
3
  @media (max-height: 25rem) {
33
4
  .ant-tree.cap-tree-v2.ant-tree-icon-hide {
34
5
  height: 8.5714rem;
@@ -27,7 +27,6 @@ export const CapTagListWithInput = (props) => {
27
27
  userLocale = 'en',
28
28
  eventContextTags = [],
29
29
  restrictPersonalization = false,
30
- waitEventContextTags = {},
31
30
  // CapInput props
32
31
  inputId,
33
32
  inputValue = '',
@@ -78,7 +77,6 @@ export const CapTagListWithInput = (props) => {
78
77
  userLocale={userLocale}
79
78
  selectedOfferDetails={selectedOfferDetails}
80
79
  eventContextTags={eventContextTags}
81
- waitEventContextTags={waitEventContextTags}
82
80
  style={tagListStyle}
83
81
  popoverPlacement={popoverPlacement}
84
82
  restrictPersonalization={restrictPersonalization}
@@ -118,7 +116,6 @@ CapTagListWithInput.propTypes = {
118
116
  userLocale: PropTypes.string,
119
117
  eventContextTags: PropTypes.array,
120
118
  restrictPersonalization: PropTypes.bool,
121
- waitEventContextTags: PropTypes.object,
122
119
 
123
120
  // CapInput props
124
121
  inputId: PropTypes.string.isRequired,
@@ -157,7 +154,6 @@ CapTagListWithInput.defaultProps = {
157
154
  userLocale: 'en',
158
155
  eventContextTags: [],
159
156
  restrictPersonalization: false,
160
- waitEventContextTags: {},
161
157
  inputValue: '',
162
158
  inputSize: 'default',
163
159
  inputRequired: false,
@@ -52,7 +52,6 @@ export const CapWhatsappCTA = (props) => {
52
52
  injectedTags = {},
53
53
  selectedOfferDetails = [],
54
54
  eventContextTags = [],
55
- waitEventContextTags = {},
56
55
  } = props;
57
56
  const { formatMessage } = intl;
58
57
  const invalidVarRegex = /{{(.*?)}}/g;
@@ -284,7 +283,6 @@ export const CapWhatsappCTA = (props) => {
284
283
  injectedTags={injectedTags}
285
284
  selectedOfferDetails={selectedOfferDetails}
286
285
  eventContextTags={eventContextTags}
287
- waitEventContextTags={waitEventContextTags}
288
286
  />
289
287
  </CapColumn>
290
288
  )}
@@ -2990,7 +2990,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2990
2990
  selectedOfferDetails={this.props.selectedOfferDetails}
2991
2991
  eventContextTags={this.props?.eventContextTags}
2992
2992
  restrictPersonalization={this.props.restrictPersonalization}
2993
- waitEventContextTags={this.props?.waitEventContextTags}
2994
2993
  />
2995
2994
  </CapColumn>
2996
2995
  );
@@ -3020,7 +3019,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3020
3019
  userLocale={this.props.userLocale}
3021
3020
  selectedOfferDetails={this.props.selectedOfferDetails}
3022
3021
  eventContextTags={this.props?.eventContextTags}
3023
- waitEventContextTags={this.props?.waitEventContextTags}
3024
3022
  moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
3025
3023
  containerStyle={val.style || {}}
3026
3024
  inputProps={val.inputProps || {}}
@@ -3660,7 +3658,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3660
3658
  channel={channel}
3661
3659
  eventContextTags={this.props?.eventContextTags}
3662
3660
  restrictPersonalization={this.props.restrictPersonalization}
3663
- waitEventContextTags={this.props?.waitEventContextTags}
3664
3661
  />
3665
3662
  </CapColumn>
3666
3663
  );
@@ -3707,7 +3704,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3707
3704
  userLocale={this.state.translationLang}
3708
3705
  selectedOfferDetails={this.props.selectedOfferDetails}
3709
3706
  eventContextTags={this.props?.eventContextTags}
3710
- waitEventContextTags={this.props?.waitEventContextTags}
3711
3707
  moduleFilterEnabled={moduleFilterEnabledForCapTagList}
3712
3708
  containerStyle={val.style || {}}
3713
3709
  inputProps={val.inputProps || {}}
@@ -4002,7 +3998,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
4002
3998
  onContextChange={this.props.onContextChange}
4003
3999
  moduleFilterEnabled={isModuleFilterEnabled}
4004
4000
  eventContextTags={this.props?.eventContextTags}
4005
- waitEventContextTags={this.props?.waitEventContextTags}
4006
4001
  isGetBeeData={this.props?.isGetBeeData}
4007
4002
  getBEEData={this.props?.getBEEData}
4008
4003
  />
@@ -4307,7 +4302,6 @@ FormBuilder.defaultProps = {
4307
4302
  userLocale: localStorage.getItem('jlocale') || 'en',
4308
4303
  showLiquidErrorInFooter: () => {},
4309
4304
  metaDataStatus: "",
4310
- waitEventContextTags: {},
4311
4305
  isTestAndPreviewMode: false, // Default to false to maintain existing behavior
4312
4306
  };
4313
4307
 
@@ -4358,7 +4352,6 @@ FormBuilder.propTypes = {
4358
4352
  moduleType: PropTypes.string.isRequired,
4359
4353
  showLiquidErrorInFooter: PropTypes.bool.isRequired,
4360
4354
  eventContextTags: PropTypes.array.isRequired,
4361
- waitEventContextTags: PropTypes.object,
4362
4355
  forwardedTags: PropTypes.object.isRequired,
4363
4356
  isLoyaltyModule: PropTypes.bool.isRequired,
4364
4357
  isTestAndPreviewMode: PropTypes.bool, // Add new prop type
@@ -94,7 +94,6 @@ const HTMLEditor = forwardRef(({
94
94
  injectedTags = {},
95
95
  location,
96
96
  eventContextTags = [],
97
- waitEventContextTags,
98
97
  selectedOfferDetails = [],
99
98
  channel,
100
99
  userLocale = 'en',
@@ -362,7 +361,7 @@ const HTMLEditor = forwardRef(({
362
361
  const issueCounts = calculateIssueCounts();
363
362
  const isContentEmpty = !currentContent || currentContent.trim() === '';
364
363
 
365
- // hasErrors = only Rule Group #1 (Input & Sanitization) - gates Done/Update/Preview/Test
364
+ // hasErrors = only Rule Group #1 (Input & Sanitization) gates Done/Update/Preview/Test
366
365
  const newState = {
367
366
  isContentEmpty,
368
367
  issueCounts,
@@ -664,7 +663,6 @@ const HTMLEditor = forwardRef(({
664
663
  injectedTags={injectedTags}
665
664
  location={location}
666
665
  eventContextTags={eventContextTags}
667
- waitEventContextTags={waitEventContextTags}
668
666
  selectedOfferDetails={selectedOfferDetails}
669
667
  channel={channel}
670
668
  userLocale={userLocale}
@@ -736,7 +734,6 @@ const HTMLEditor = forwardRef(({
736
734
  injectedTags={injectedTags}
737
735
  location={location}
738
736
  eventContextTags={eventContextTags}
739
- waitEventContextTags={waitEventContextTags}
740
737
  selectedOfferDetails={selectedOfferDetails}
741
738
  channel={channel}
742
739
  userLocale={userLocale}
@@ -775,7 +772,6 @@ HTMLEditor.propTypes = {
775
772
  injectedTags: PropTypes.object,
776
773
  location: PropTypes.object,
777
774
  eventContextTags: PropTypes.array,
778
- waitEventContextTags: PropTypes.object,
779
775
  selectedOfferDetails: PropTypes.array,
780
776
  channel: PropTypes.string,
781
777
  userLocale: PropTypes.string,
@@ -809,7 +805,6 @@ HTMLEditor.defaultProps = {
809
805
  injectedTags: {},
810
806
  location: null,
811
807
  eventContextTags: [],
812
- waitEventContextTags: {},
813
808
  selectedOfferDetails: [],
814
809
  channel: null,
815
810
  userLocale: 'en',
@@ -225,7 +225,6 @@ const defaultProps = {
225
225
  injectedTags: {},
226
226
  location: { query: {} },
227
227
  eventContextTags: [],
228
- waitEventContextTags: {},
229
228
  selectedOfferDetails: [],
230
229
  channel: 'EMAIL',
231
230
  userLocale: 'en',