@capillarytech/creatives-library 7.17.69-alpha.1 → 7.17.70

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.
@@ -83,7 +83,17 @@ export const BADGES_RELATED_TAGS = [
83
83
  "badge_expiry_Dd_dot_mm_dot_yy",
84
84
  "badge_expiry_dd_space_Mon",
85
85
  "Days_until_expiry",
86
+ "badges_enroll_expiry_date.FORMAT_1",
87
+ "badges_enroll_expiry_date.FORMAT_2",
88
+ "badges_enroll_expiry_date.FORMAT_3",
89
+ "badges_enroll_expiry_date.FORMAT_4",
90
+ "badges_enroll_expiry_date.FORMAT_5",
91
+ "badges_enroll_expiry_date.FORMAT_6",
92
+ "badges_enroll_expiry_date.FORMAT_7",
93
+ "badges_enroll_expiry_date.FORMAT_8",
94
+ "badges_enroll_expiring_in_days",
86
95
  ];
96
+ export const BADGES_ENROLL = 'BADGES_ENROLL';
87
97
 
88
98
  export const CUSTOMER_BARCODE_TAG = "customer_barcode";
89
99
  export const COPY_OF = "Copy of";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.69-alpha.1",
4
+ "version": "7.17.70",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/utils/common.js CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  JP_LOCALE_HIDE_FEATURE,
17
17
  ENABLE_CUSTOMER_BARCODE_TAG,
18
18
  BADGES_UI_ENABLED,
19
+ BADGES_ENROLL,
19
20
  } from '../containers/App/constants';
20
21
  import { apiMessageFormatHandler } from './commonUtils';
21
22
 
@@ -166,8 +167,12 @@ export function getTreeStructuredTags({tagsList, userLocale = 'en', offerDetails
166
167
  }
167
168
  });
168
169
  let combinedTags = result;
169
- if (offerDetails.length) {
170
- combinedTags = transformCouponTags(offerDetails, result);
170
+ if (offerDetails?.length) {
171
+ if (offerDetails?.[0]?.type === BADGES_ENROLL) {
172
+ combinedTags = transformBadgeTags(offerDetails, result);
173
+ } else {
174
+ combinedTags = transformCouponTags(offerDetails, result);
175
+ }
171
176
  }
172
177
  return getTreeStructureData(combinedTags);
173
178
  }
@@ -193,7 +198,7 @@ function transformCouponTags(offerDetails, allTags) {
193
198
  return {
194
199
  ...obj,
195
200
  ...tempObj,
196
- couponSeriesId: id,
201
+ incentiveSeriesId: id,
197
202
  };
198
203
  };
199
204
  offerDetails.forEach((offer) => {
@@ -216,7 +221,7 @@ function transformCouponTags(offerDetails, allTags) {
216
221
  'tag-header': true,
217
222
  'name': couponNameFinal || couponId,
218
223
  'desc': couponNameFinal || couponId,
219
- 'couponSeriesId': couponId,
224
+ 'incentiveSeriesId': couponId,
220
225
  'subtags': couponSubTags,
221
226
  'resolved': true,
222
227
  'couponTags': true,
@@ -227,6 +232,45 @@ function transformCouponTags(offerDetails, allTags) {
227
232
  return allTags;
228
233
  }
229
234
 
235
+ export function transformBadgeTags(badgeDetails = [], allTags) {
236
+ const badgeTags = {};
237
+ const badgeTagsKeys = Object.keys(_.get(allTags, 'Badge.subtags', []));
238
+ const withBadgeId = (obj, id) => {
239
+ const tempObj = {};
240
+ if (obj?.subtags) {
241
+ tempObj.subtags = _.mapValues(obj.subtags, (tag) => ({
242
+ ...withBadgeId(tag, id),
243
+ }));
244
+ }
245
+ return {
246
+ ...obj,
247
+ ...tempObj,
248
+ incentiveSeriesId: id,
249
+ };
250
+ };
251
+ badgeDetails.forEach((offer) => {
252
+ const { badgesMetaId, badgeName } = offer || {};
253
+ const badgeSubTags = {};
254
+ // eslint-disable-next-line no-unused-expressions
255
+ badgeTagsKeys?.forEach((badgeTagKey) => {
256
+ const badgeSubTagsObj = withBadgeId(allTags?.Badge?.subtags?.[badgeTagKey], badgesMetaId);
257
+ badgeSubTags[badgeTagKey] = badgeSubTagsObj;
258
+ });
259
+ badgeTags[badgesMetaId] = {
260
+ 'tag-header': true,
261
+ 'name': badgeName,
262
+ 'desc': badgeName,
263
+ 'incentiveSeriesId': badgesMetaId,
264
+ 'subtags': badgeSubTags,
265
+ 'resolved': true,
266
+ 'couponTags': true,
267
+ };
268
+ });
269
+ // eslint-disable-next-line no-param-reassign
270
+ allTags.Badge.subtags = badgeTags;
271
+ return allTags;
272
+ }
273
+
230
274
  function populateTagForChildren(targetTag, tagsObject, tagValue) {
231
275
  const tag = targetTag;
232
276
  if (tag && tag['tag-header'] && !tag.resolved) {
@@ -105,7 +105,7 @@ const indexOfEnd = (targetString, string) => {
105
105
  }
106
106
 
107
107
  const skipTags = (tag) => {
108
- const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN","^[A-Za-z].*\\([\\d]*\\)"];
108
+ const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN", "^[A-Za-z].*\\([a-zA-Z\\d]*\\)"];
109
109
  let skipped = false;
110
110
  lodashForEach(regexGroups, (group) => {
111
111
  const groupRegex = new RegExp(group, "g");
@@ -102,6 +102,454 @@ export const tagsList = [
102
102
  updatedAt: "2018-01-22T11:43:05.611Z",
103
103
  },
104
104
  ];
105
+
106
+ export const badgesTags = [
107
+ {
108
+ _id: "655b080695c9df613dbbed4d",
109
+ type: "TAG",
110
+ definition: {
111
+ "label": {
112
+ "en": "Badge",
113
+ "ja-JP": "バッジ",
114
+ },
115
+ "value": "Badge",
116
+ "subtags": [
117
+ "Badge_expiry_date",
118
+ "Days_until_expiry",
119
+ "badges_enroll_expiring_in_days",
120
+ ],
121
+ "tag-header": true,
122
+ "supportedModules": [
123
+ {
124
+ context: "loyalty",
125
+ layout: "sms",
126
+ mandatory: false,
127
+ },
128
+ {
129
+ context: "loyalty",
130
+ layout: "email",
131
+ mandatory: false,
132
+ },
133
+ {
134
+ context: "loyalty",
135
+ layout: "mobilepush",
136
+ mandatory: false,
137
+ },
138
+ {
139
+ context: "outbound",
140
+ layout: "sms",
141
+ mandatory: false,
142
+ },
143
+ {
144
+ context: "default",
145
+ layout: "sms",
146
+ mandatory: false,
147
+ },
148
+ {
149
+ context: "outbound",
150
+ layout: "email",
151
+ mandatory: false,
152
+ },
153
+ {
154
+ context: "default",
155
+ layout: "email",
156
+ mandatory: false,
157
+ },
158
+ {
159
+ context: "outbound",
160
+ layout: "mobilepush",
161
+ mandatory: false,
162
+ },
163
+ {
164
+ context: "default",
165
+ layout: "mobilepush",
166
+ mandatory: false,
167
+ },
168
+ {
169
+ context: "outbound",
170
+ layout: "wechat",
171
+ mandatory: false,
172
+ },
173
+ {
174
+ context: "default",
175
+ layout: "wechat",
176
+ mandatory: false,
177
+ },
178
+ {
179
+ context: "outbound",
180
+ layout: "line",
181
+ mandatory: false,
182
+ },
183
+ {
184
+ context: "default",
185
+ layout: "line",
186
+ mandatory: false,
187
+ },
188
+ {
189
+ context: "outbound",
190
+ layout: "ebill",
191
+ mandatory: false,
192
+ },
193
+ {
194
+ context: "default",
195
+ layout: "ebill",
196
+ mandatory: false,
197
+ },
198
+ ],
199
+ },
200
+ scope: {
201
+ verticals: [],
202
+ orgId: -1,
203
+ tag: "STANDARD",
204
+ },
205
+ isActive: true,
206
+ createdBy: 15000449,
207
+ updatedBy: 15000449,
208
+ createdAt: "2022-06-24T10:28:45.738Z",
209
+ updatedAt: "2022-06-24T10:28:45.738Z",
210
+ },
211
+ {
212
+ _id: "655b0afec0af192ba585cc98",
213
+ type: "TAG",
214
+ definition: {
215
+ "label": {
216
+ "en": "Badge Expiry Date",
217
+ "ja-JP": "バッジの有効期限",
218
+ },
219
+ "value": "Badge_expiry_date",
220
+ "subtags": [
221
+ "badge_expiry_mm_slash_dd_slash_yyyy",
222
+ "badge_expiry_dd_slash_mm_slash_yyyy",
223
+ "badge_expiry_yyyy_hyphen_mm_hyphen_dd",
224
+ "badge_expiry_mm_slash_dd_slash_yy",
225
+ "badge_expiry_dd_space_Mon_space_yyyy",
226
+ "badge_expiry_Day_comma_space_Mon_space_dd_comma_space_yy",
227
+ "badge_expiry_Dd_dot_mm_dot_yy",
228
+ "badge_expiry_dd_space_Mon",
229
+ "badges_enroll_expiry_date.FORMAT_1",
230
+ "badges_enroll_expiry_date.FORMAT_2",
231
+ "badges_enroll_expiry_date.FORMAT_3",
232
+ "badges_enroll_expiry_date.FORMAT_4",
233
+ "badges_enroll_expiry_date.FORMAT_5",
234
+ "badges_enroll_expiry_date.FORMAT_6",
235
+ "badges_enroll_expiry_date.FORMAT_7",
236
+ "badges_enroll_expiry_date.FORMAT_8",
237
+ ],
238
+ "tag-header": true,
239
+ "supportedModules": [
240
+ {
241
+ context: "loyalty",
242
+ layout: "sms",
243
+ mandatory: false,
244
+ },
245
+ {
246
+ context: "loyalty",
247
+ layout: "email",
248
+ mandatory: false,
249
+ },
250
+ {
251
+ context: "loyalty",
252
+ layout: "mobilepush",
253
+ mandatory: false,
254
+ },
255
+ {
256
+ context: "outbound",
257
+ layout: "sms",
258
+ mandatory: false,
259
+ },
260
+ {
261
+ context: "default",
262
+ layout: "sms",
263
+ mandatory: false,
264
+ },
265
+ {
266
+ context: "outbound",
267
+ layout: "email",
268
+ mandatory: false,
269
+ },
270
+ {
271
+ context: "default",
272
+ layout: "email",
273
+ mandatory: false,
274
+ },
275
+ {
276
+ context: "outbound",
277
+ layout: "mobilepush",
278
+ mandatory: false,
279
+ },
280
+ {
281
+ context: "default",
282
+ layout: "mobilepush",
283
+ mandatory: false,
284
+ },
285
+ {
286
+ context: "outbound",
287
+ layout: "wechat",
288
+ mandatory: false,
289
+ },
290
+ {
291
+ context: "default",
292
+ layout: "wechat",
293
+ mandatory: false,
294
+ },
295
+ {
296
+ context: "outbound",
297
+ layout: "line",
298
+ mandatory: false,
299
+ },
300
+ {
301
+ context: "default",
302
+ layout: "line",
303
+ mandatory: false,
304
+ },
305
+ {
306
+ context: "outbound",
307
+ layout: "ebill",
308
+ mandatory: false,
309
+ },
310
+ {
311
+ context: "default",
312
+ layout: "ebill",
313
+ mandatory: false,
314
+ },
315
+ ],
316
+ },
317
+ scope: {
318
+ tag: "STANDARD",
319
+ orgId: -1,
320
+ verticals: [],
321
+ },
322
+ isActive: true,
323
+ },
324
+ {
325
+ _id: "655b617e48bc1275ad0c717c",
326
+ type: "TAG",
327
+ definition: {
328
+ "label": {
329
+ "en": "Days_until_expiry",
330
+ "ja-JP": "有効期限までの日数",
331
+ },
332
+ "value": "badges_enroll_expiring_in_days",
333
+ "subtags": [],
334
+ "tag-header": false,
335
+ "supportedModules": [
336
+ {
337
+ context: "outbound",
338
+ layout: "sms",
339
+ mandatory: false,
340
+ },
341
+ {
342
+ context: "default",
343
+ layout: "sms",
344
+ mandatory: false,
345
+ },
346
+ {
347
+ context: "outbound",
348
+ layout: "email",
349
+ mandatory: false,
350
+ },
351
+ {
352
+ context: "default",
353
+ layout: "email",
354
+ mandatory: false,
355
+ },
356
+ {
357
+ context: "outbound",
358
+ layout: "mobilepush",
359
+ mandatory: false,
360
+ },
361
+ {
362
+ context: "default",
363
+ layout: "mobilepush",
364
+ mandatory: false,
365
+ },
366
+ {
367
+ context: "outbound",
368
+ layout: "wechat",
369
+ mandatory: false,
370
+ },
371
+ {
372
+ context: "default",
373
+ layout: "wechat",
374
+ mandatory: false,
375
+ },
376
+ {
377
+ context: "outbound",
378
+ layout: "line",
379
+ mandatory: false,
380
+ },
381
+ {
382
+ context: "default",
383
+ layout: "line",
384
+ mandatory: false,
385
+ },
386
+ {
387
+ context: "outbound",
388
+ layout: "ebill",
389
+ mandatory: false,
390
+ },
391
+ {
392
+ context: "default",
393
+ layout: "ebill",
394
+ mandatory: false,
395
+ },
396
+ ],
397
+ },
398
+ scope: {
399
+ verticals: [],
400
+ orgId: -1,
401
+ tag: "STANDARD",
402
+ },
403
+ isActive: true,
404
+ },
405
+ {
406
+ _id: "65818c77915d01082d1d34de",
407
+ type: "TAG",
408
+ definition: {
409
+ "label": {
410
+ en: "mm/dd/yyyy",
411
+ },
412
+ "value": "badges_enroll_expiry_date.FORMAT_1",
413
+ "subtags": [],
414
+ "tag-header": false,
415
+ "supportedModules": [
416
+ {
417
+ context: "outbound",
418
+ layout: "sms",
419
+ mandatory: false,
420
+ },
421
+ {
422
+ context: "default",
423
+ layout: "sms",
424
+ mandatory: false,
425
+ },
426
+ {
427
+ context: "outbound",
428
+ layout: "email",
429
+ mandatory: false,
430
+ },
431
+ {
432
+ context: "default",
433
+ layout: "email",
434
+ mandatory: false,
435
+ },
436
+ {
437
+ context: "outbound",
438
+ layout: "mobilepush",
439
+ mandatory: false,
440
+ },
441
+ {
442
+ context: "default",
443
+ layout: "mobilepush",
444
+ mandatory: false,
445
+ },
446
+ {
447
+ context: "outbound",
448
+ layout: "wechat",
449
+ mandatory: false,
450
+ },
451
+ {
452
+ context: "default",
453
+ layout: "wechat",
454
+ mandatory: false,
455
+ },
456
+ {
457
+ context: "outbound",
458
+ layout: "line",
459
+ mandatory: false,
460
+ },
461
+ {
462
+ context: "default",
463
+ layout: "line",
464
+ mandatory: false,
465
+ },
466
+ {
467
+ context: "outbound",
468
+ layout: "ebill",
469
+ mandatory: false,
470
+ },
471
+ {
472
+ context: "default",
473
+ layout: "ebill",
474
+ mandatory: false,
475
+ },
476
+ ],
477
+ },
478
+ scope: {
479
+ tag: "STANDARD",
480
+ orgId: -1,
481
+ verticals: [],
482
+ },
483
+ isActive: true,
484
+ },
485
+ ];
486
+ export const OfferTag = [{
487
+ _id: "5aaa0cec7472bc0eab75f55b",
488
+ type: "TAG",
489
+ definition: {
490
+ "supportedModules": [
491
+ {
492
+ context: "journey",
493
+ layout: "sms",
494
+ mandatory: false,
495
+ },
496
+ {
497
+ context: "journey",
498
+ layout: "email",
499
+ mandatory: false,
500
+ },
501
+ {
502
+ context: "journey",
503
+ layout: "mobilepush",
504
+ mandatory: false,
505
+ },
506
+ {
507
+ context: "default",
508
+ layout: "sms",
509
+ mandatory: false,
510
+ },
511
+ {
512
+ context: "outbound",
513
+ layout: "sms",
514
+ mandatory: false,
515
+ },
516
+ {
517
+ context: "outbound",
518
+ layout: "line",
519
+ mandatory: false,
520
+ },
521
+ {
522
+ context: "default",
523
+ layout: "line",
524
+ mandatory: false,
525
+ },
526
+ ],
527
+ "tag-header": true,
528
+ "subtags": [
529
+ "voucher",
530
+ "valid_till_date",
531
+ "valid_days_from_create",
532
+ ],
533
+ "value": "coupon",
534
+ "label": {
535
+ "en": "Coupons",
536
+ "ja-JP": "クーポン",
537
+ },
538
+ },
539
+ scope: {
540
+ tag: "STANDARD",
541
+ orgId: -1,
542
+ verticals: [],
543
+ },
544
+ isActive: true,
545
+ createdBy: 15000449,
546
+ updatedBy: 15000449,
547
+ createdAt: "2018-03-15T06:04:28.484Z",
548
+ updatedAt: "2018-03-15T06:04:28.484Z",
549
+ },
550
+ ];
551
+ export const offerOutput = [{children: [{disabled: undefined, title: "mac", value: "{{undefined}}"}], disabled: false, selectable: false, title: "Coupons", value: "{{coupon}}"}];
552
+ export const badgesOutput = [{children: [{children: [{children: [{disabled: false, title: "mm/dd/yyyy", value: "{{badges_enroll_expiry_date.FORMAT_1}}"}], disabled: false, selectable: false, title: "Badge Expiry Date", value: "{{Badge_expiry_date}}"}, {disabled: false, title: "Days_until_expiry", value: "{{badges_enroll_expiring_in_days}}"}], disabled: undefined, selectable: false, title: "moye_moye", value: "{{undefined}}"}], disabled: false, selectable: false, title: "Badge", value: "{{Badge}}"}];
105
553
  export const tagsToFilter = ["timeSpan_Start"];
106
554
 
107
555
  export const output1 = [
@@ -123,3 +571,42 @@ export const output2 = [
123
571
  value: "{{optout}}",
124
572
  },
125
573
  ];
574
+ export const offer = [
575
+ { badgesMetaId: "12", badgeName: "moye_moye", type: "BADGES_ENROLL" },
576
+ ];
577
+ export const expectedOffer = [
578
+ {
579
+ children: [
580
+ {
581
+ children: [
582
+ {
583
+ children: [
584
+ {
585
+ disabled: false,
586
+ title: "mm/dd/yyyy",
587
+ value: "{{badges_enroll_expiry_date.FORMAT_1}}",
588
+ },
589
+ ],
590
+ disabled: false,
591
+ selectable: false,
592
+ title: "Badge Expiry Date",
593
+ value: "{{Badge_expiry_date}}",
594
+ },
595
+ {
596
+ disabled: false,
597
+ title: "Days_until_expiry",
598
+ value: "{{badges_enroll_expiring_in_days}}",
599
+ },
600
+ ],
601
+ disabled: undefined,
602
+ selectable: false,
603
+ title: "moye_moye",
604
+ value: "{{undefined}}",
605
+ },
606
+ ],
607
+ disabled: false,
608
+ selectable: false,
609
+ title: "Badge",
610
+ value: "{{Badge}}",
611
+ },
612
+ ];
@@ -11,12 +11,19 @@ describe("getTreeStructuredTags test", () => {
11
11
  it("test for getTreeStructuredTags when tagsList is empty", () => {
12
12
  expect(getTreeStructuredTags({tagsList: []})).toEqual([]);
13
13
  });
14
+
15
+ it("test for getTreeStructuredTags when incentive attached is BADGES", () => {
16
+ expect(getTreeStructuredTags({tagsList: mockdata.badgesTags, offerDetails: mockdata.offer})).toEqual(mockdata.expectedOffer);
17
+ });
14
18
  it("test for filterTags", () => {
15
19
  expect(filterTags(mockdata.tagsToFilter, mockdata.tagsList)).toEqual([mockdata.tagsList[1]]);
16
20
  });
17
21
  it("test for filterTags when tagsToFilter and tagsList is empty", () => {
18
22
  expect(filterTags([], [])).toEqual([]);
19
23
  });
24
+ it("test for getTreeStructuredTags when incentive attached is offer", () => {
25
+ expect(getTreeStructuredTags({tagsList: mockdata.OfferTag, offerDetails: [{id: '12', couponName: 'mac'}]})).toEqual(mockdata.offerOutput);
26
+ });
20
27
  });
21
28
 
22
29
  describe("getUserNameById test", () => {
@@ -202,9 +202,9 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
202
202
  const temp = this.renderTags(val.subtags, '', disabled);
203
203
  const tagValue = (
204
204
  <CapTreeNode
205
- title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val.name}</CapTooltip> : val.name}
205
+ title={disabled ? <CapTooltip title={loyaltyAttrDisableText}>{val?.name}</CapTooltip> : val?.name}
206
206
  tag={val}
207
- key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
207
+ key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
208
208
  disabled={disabled}
209
209
  >
210
210
  {temp}
@@ -223,7 +223,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
223
223
  title={childDisabled ? <CapTooltip title={key === CUSTOMER_BARCODE_TAG ? customerBarcodeDisableText : loyaltyAttrDisableText}>{val.desc || val.name}</CapTooltip> : (val.desc || val.name)}
224
224
  tag={val}
225
225
  isLeaf
226
- key={val.couponSeriesId ? `${key}(${val.couponSeriesId})` : `${key}`}
226
+ key={val?.incentiveSeriesId ? `${key}(${val?.incentiveSeriesId})` : `${key}`}
227
227
  disabled={childDisabled}
228
228
  >
229
229
  </CapTreeNode>);
@@ -1093,8 +1093,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1093
1093
  }
1094
1094
 
1095
1095
  skipTags(tag) {
1096
- const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN","^[A-Za-z].*\\([\\d]*\\)"];
1097
-
1096
+ const regexGroups = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)","Link_to_[a-zA-z]","SURVEY.*.TOKEN","^[A-Za-z].*\\([a-zA-Z\\d]*\\)"];
1098
1097
  //const regexGroups = [];
1099
1098
  let skipped = false;
1100
1099
  _.forEach(regexGroups, (group) => {
@@ -22,8 +22,8 @@ import './_tagList.scss';
22
22
  import { selectCurrentOrgDetails } from '../Cap/selectors';
23
23
  import { injectIntl } from 'react-intl';
24
24
  import { scope } from './messages';
25
- import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature, hasBadgesFeature } from '../../utils/common';
26
- import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS } from '../../containers/App/constants';
25
+ import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature, hasBadgesFeature, transformBadgeTags } from '../../utils/common';
26
+ import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL } from '../../containers/App/constants';
27
27
 
28
28
  const TreeNode = Tree.TreeNode;
29
29
 
@@ -79,6 +79,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
79
79
  generateTags = (props) => {
80
80
  let tags = {};
81
81
  let injectedTags = {};
82
+ const {selectedOfferDetails } = props;
82
83
  if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
83
84
  const formattedInjectedTags = handleInjectedData(
84
85
  props.injectedTags,
@@ -89,8 +90,12 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
89
90
  if (props.tags && props.tags.length > 0) {
90
91
  tags = this.populateTags(props.tags);
91
92
  }
92
- if (props.selectedOfferDetails && !_.isEmpty(props.selectedOfferDetails) && (tags && tags.coupon)) {
93
- this.transformCouponTags(props.selectedOfferDetails, tags);
93
+ if (selectedOfferDetails && !_.isEmpty(selectedOfferDetails) ) {
94
+ if ((selectedOfferDetails[0]?.type === BADGES_ENROLL) && (tags && tags?.Badge) ) {
95
+ transformBadgeTags(selectedOfferDetails, tags);
96
+ } else if (tags && tags?.coupon) {
97
+ this.transformCouponTags(selectedOfferDetails, tags);
98
+ }
94
99
  }
95
100
  this.setState({tags: _.merge( {}, tags, injectedTags)});
96
101
  }
@@ -130,7 +135,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
130
135
  'tag-header': true,
131
136
  "name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
132
137
  "desc": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
133
- "subtags": tag.subtags,
138
+ "subtags": tag?.subtags,
134
139
  };
135
140
  }
136
141
  });
@@ -197,7 +202,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
197
202
  return {
198
203
  ...obj,
199
204
  ...tempObj,
200
- couponSeriesId: id,
205
+ incentiveSeriesId: id,
201
206
  };
202
207
  };
203
208
  offerDetails.forEach((offer) => {
@@ -214,7 +219,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
214
219
  'tag-header': true,
215
220
  'name': couponNameFinal || couponId,
216
221
  'desc': couponNameFinal || couponId,
217
- 'couponSeriesId': couponId,
222
+ 'incentiveSeriesId': couponId,
218
223
  'subtags': couponSubTags,
219
224
  'resolved': true,
220
225
  'couponTags': true,
@@ -306,7 +311,7 @@ TagList.propTypes = {
306
311
  modalProps: PropTypes.any,
307
312
  currentOrgDetails: PropTypes.object,
308
313
  channel: PropTypes.string,
309
- disabled: PropTypes.bool
314
+ disabled: PropTypes.bool,
310
315
  };
311
316
 
312
317
  const mapStateToProps = createStructuredSelector({