@capillarytech/creatives-library 8.0.287-alpha.0 → 8.0.287

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 (61) hide show
  1. package/constants/unified.js +1 -0
  2. package/initialState.js +2 -0
  3. package/package.json +1 -1
  4. package/utils/common.js +8 -5
  5. package/utils/commonUtils.js +86 -2
  6. package/utils/tagValidations.js +222 -84
  7. package/utils/tests/commonUtil.test.js +118 -147
  8. package/utils/tests/tagValidations.test.js +358 -280
  9. package/v2Components/CapTagList/index.js +6 -2
  10. package/v2Components/CapTagListWithInput/index.js +4 -0
  11. package/v2Components/ErrorInfoNote/index.js +5 -2
  12. package/v2Components/FormBuilder/index.js +184 -67
  13. package/v2Components/FormBuilder/messages.js +12 -0
  14. package/v2Components/HtmlEditor/HTMLEditor.js +5 -0
  15. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
  16. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +15 -0
  17. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +2 -1
  18. package/v2Containers/Cap/mockData.js +14 -0
  19. package/v2Containers/Cap/reducer.js +55 -3
  20. package/v2Containers/Cap/tests/reducer.test.js +102 -0
  21. package/v2Containers/CreativesContainer/SlideBoxContent.js +20 -0
  22. package/v2Containers/CreativesContainer/SlideBoxFooter.js +39 -3
  23. package/v2Containers/CreativesContainer/constants.js +6 -0
  24. package/v2Containers/CreativesContainer/index.js +33 -1
  25. package/v2Containers/CreativesContainer/messages.js +12 -0
  26. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +339 -0
  27. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +18 -0
  28. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +37 -0
  29. package/v2Containers/Email/index.js +5 -1
  30. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +62 -10
  31. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +115 -12
  32. package/v2Containers/FTP/index.js +51 -2
  33. package/v2Containers/FTP/messages.js +4 -0
  34. package/v2Containers/InApp/index.js +96 -1
  35. package/v2Containers/InApp/tests/index.test.js +6 -17
  36. package/v2Containers/InappAdvance/index.js +103 -2
  37. package/v2Containers/Line/Container/Text/index.js +1 -0
  38. package/v2Containers/MobilePush/Create/index.js +45 -0
  39. package/v2Containers/MobilePush/Create/messages.js +4 -0
  40. package/v2Containers/MobilePush/Edit/index.js +45 -0
  41. package/v2Containers/MobilePush/Edit/messages.js +4 -0
  42. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +36 -12
  43. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +68 -27
  44. package/v2Containers/MobilePushNew/index.js +65 -5
  45. package/v2Containers/MobilePushNew/messages.js +8 -0
  46. package/v2Containers/MobilepushWrapper/index.js +7 -1
  47. package/v2Containers/Rcs/index.js +37 -12
  48. package/v2Containers/SmsTrai/Edit/index.js +47 -6
  49. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -6
  50. package/v2Containers/TagList/index.js +17 -1
  51. package/v2Containers/TagList/messages.js +4 -0
  52. package/v2Containers/TemplatesV2/index.js +43 -23
  53. package/v2Containers/Viber/index.js +1 -0
  54. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +3 -1
  55. package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +7 -0
  56. package/v2Containers/WebPush/Create/index.js +25 -6
  57. package/v2Containers/WebPush/Create/messages.js +8 -1
  58. package/v2Containers/WebPush/Create/utils/validation.js +20 -22
  59. package/v2Containers/WebPush/Create/utils/validation.test.js +52 -0
  60. package/v2Containers/Whatsapp/index.js +17 -9
  61. package/v2Containers/Zalo/index.js +11 -3
@@ -20,17 +20,13 @@ describe("validateLiquidTemplateContent", () => {
20
20
  somethingWentWrong: { id: "wrong" },
21
21
  unsupportedTagsValidationError: { id: "unsupported" }
22
22
  };
23
+ const tagLookupMap = { foo: true };
23
24
  const eventContextTags = [{ tagName: "bar" }];
24
25
  const onError = jest.fn();
25
26
  const onSuccess = jest.fn();
26
27
 
27
28
  beforeEach(() => {
28
29
  jest.clearAllMocks();
29
- formatMessage.mockImplementation((msg, vars) =>
30
- vars && vars.unsupportedTags != null
31
- ? `${msg?.id}:${vars.unsupportedTags}`
32
- : (msg?.id ?? "unsupported")
33
- );
34
30
  });
35
31
 
36
32
  it("calls onError for empty content", async () => {
@@ -43,10 +39,11 @@ describe("validateLiquidTemplateContent", () => {
43
39
  messages,
44
40
  onError,
45
41
  onSuccess,
42
+ tagLookupMap,
46
43
  eventContextTags
47
44
  });
48
45
  expect(onError).toHaveBeenCalledWith({
49
- standardErrors: ["empty"],
46
+ standardErrors: [undefined],
50
47
  liquidErrors: [],
51
48
  tabType: undefined
52
49
  });
@@ -61,6 +58,7 @@ describe("validateLiquidTemplateContent", () => {
61
58
  getLiquidTags,
62
59
  formatMessage,
63
60
  messages,
61
+ tagLookupMap,
64
62
  eventContextTags
65
63
  });
66
64
  expect(onError).not.toHaveBeenCalled();
@@ -77,6 +75,7 @@ describe("validateLiquidTemplateContent", () => {
77
75
  messages,
78
76
  onError,
79
77
  onSuccess,
78
+ tagLookupMap,
80
79
  eventContextTags
81
80
  });
82
81
  expect(onError).toHaveBeenCalledWith({
@@ -87,15 +86,9 @@ describe("validateLiquidTemplateContent", () => {
87
86
  expect(onSuccess).not.toHaveBeenCalled();
88
87
  });
89
88
 
90
- it("calls onError when API returns success but response.errors has validation errors (e.g. unsupported tag)", async () => {
89
+ it("calls onError for unsupported tags", async () => {
91
90
  const getLiquidTags = jest.fn((content, cb) =>
92
- cb({
93
- askAiraResponse: {
94
- errors: [{ message: "Unsupported tag: custom_tag" }],
95
- data: []
96
- },
97
- isError: false
98
- })
91
+ cb({ askAiraResponse: { errors: [], data: [{ name: "baz" }] }, isError: false })
99
92
  );
100
93
  await validateLiquidTemplateContent("foo", {
101
94
  getLiquidTags,
@@ -103,33 +96,18 @@ describe("validateLiquidTemplateContent", () => {
103
96
  messages,
104
97
  onError,
105
98
  onSuccess,
99
+ tagLookupMap,
106
100
  eventContextTags
107
101
  });
108
102
  expect(onError).toHaveBeenCalledWith({
109
103
  standardErrors: [],
110
- liquidErrors: ["Unsupported tag: custom_tag"],
104
+ liquidErrors: [undefined],
111
105
  tabType: undefined
112
106
  });
113
107
  expect(onSuccess).not.toHaveBeenCalled();
114
108
  });
115
109
 
116
- it("calls onSuccess when API returns no errors and a single extracted tag (extracted tags are not validated)", async () => {
117
- const getLiquidTags = jest.fn((content, cb) =>
118
- cb({ askAiraResponse: { errors: [], data: [{ name: "foo" }] }, isError: false })
119
- );
120
- await validateLiquidTemplateContent("foo", {
121
- getLiquidTags,
122
- formatMessage,
123
- messages,
124
- onError,
125
- onSuccess,
126
- eventContextTags
127
- });
128
- expect(onSuccess).toHaveBeenCalledWith("foo", undefined);
129
- expect(onError).not.toHaveBeenCalled();
130
- });
131
-
132
- it("calls onSuccess for valid content when API returns multiple extracted tags but no errors", async () => {
110
+ it("calls onSuccess for valid content", async () => {
133
111
  const getLiquidTags = jest.fn((content, cb) =>
134
112
  cb({ askAiraResponse: { errors: [], data: [{ name: "foo" }, { name: "bar" }] }, isError: false })
135
113
  );
@@ -139,6 +117,7 @@ describe("validateLiquidTemplateContent", () => {
139
117
  messages,
140
118
  onError,
141
119
  onSuccess,
120
+ tagLookupMap,
142
121
  eventContextTags
143
122
  });
144
123
  expect(onSuccess).toHaveBeenCalledWith("foo", undefined);
@@ -154,6 +133,7 @@ describe("validateLiquidTemplateContent", () => {
154
133
  messages,
155
134
  onError,
156
135
  onSuccess,
136
+ tagLookupMap,
157
137
  eventContextTags,
158
138
  skipTags
159
139
  });
@@ -171,6 +151,7 @@ describe("validateLiquidTemplateContent", () => {
171
151
  messages,
172
152
  onError,
173
153
  onSuccess,
154
+ tagLookupMap,
174
155
  eventContextTags,
175
156
  skipTags
176
157
  });
@@ -188,6 +169,7 @@ describe("validateLiquidTemplateContent", () => {
188
169
  messages,
189
170
  onError,
190
171
  onSuccess,
172
+ tagLookupMap,
191
173
  eventContextTags,
192
174
  skipTags
193
175
  });
@@ -205,6 +187,7 @@ describe("validateLiquidTemplateContent", () => {
205
187
  messages,
206
188
  onError,
207
189
  onSuccess,
190
+ tagLookupMap,
208
191
  eventContextTags,
209
192
  skipTags
210
193
  });
@@ -222,6 +205,7 @@ describe("validateLiquidTemplateContent", () => {
222
205
  messages,
223
206
  onError,
224
207
  onSuccess,
208
+ tagLookupMap,
225
209
  eventContextTags,
226
210
  skipTags
227
211
  });
@@ -239,6 +223,7 @@ describe("validateLiquidTemplateContent", () => {
239
223
  messages,
240
224
  onError,
241
225
  onSuccess,
226
+ tagLookupMap,
242
227
  eventContextTags,
243
228
  skipTags
244
229
  });
@@ -256,6 +241,7 @@ describe("validateLiquidTemplateContent", () => {
256
241
  messages,
257
242
  onError,
258
243
  onSuccess,
244
+ tagLookupMap,
259
245
  eventContextTags,
260
246
  skipTags
261
247
  });
@@ -273,6 +259,7 @@ describe("validateLiquidTemplateContent", () => {
273
259
  messages,
274
260
  onError,
275
261
  onSuccess,
262
+ tagLookupMap,
276
263
  eventContextTags,
277
264
  skipTags
278
265
  });
@@ -290,6 +277,7 @@ describe("validateLiquidTemplateContent", () => {
290
277
  };
291
278
  const onError = jest.fn();
292
279
  const onSuccess = jest.fn();
280
+ const tagLookupMap = {};
293
281
  const eventContextTags = [];
294
282
  await validateLiquidTemplateContent('', {
295
283
  getLiquidTags,
@@ -297,6 +285,7 @@ describe("validateLiquidTemplateContent", () => {
297
285
  messages,
298
286
  onError,
299
287
  onSuccess,
288
+ tagLookupMap,
300
289
  eventContextTags,
301
290
  });
302
291
  expect(formatMessage).toHaveBeenCalledWith(messages.emailBodyEmptyError);
@@ -308,7 +297,7 @@ describe("validateLiquidTemplateContent", () => {
308
297
  expect(onSuccess).not.toHaveBeenCalled();
309
298
  });
310
299
 
311
- it("calls onSuccess when API returns extracted tags from {% for %} template but no errors (extracted tags are not validated)", async () => {
300
+ it("should skip tags that appear in {% %} syntax (like order.items in for loop)", async () => {
312
301
  const content = '{% for item in order.items %} Hello {% endfor %}';
313
302
  const getLiquidTags = jest.fn((content, cb) =>
314
303
  cb({ askAiraResponse: { errors: [], data: [{ name: "order.items" }] }, isError: false })
@@ -319,13 +308,15 @@ describe("validateLiquidTemplateContent", () => {
319
308
  messages,
320
309
  onError,
321
310
  onSuccess,
311
+ tagLookupMap,
322
312
  eventContextTags
323
313
  });
314
+ // order.items appears in {% %} syntax, so it should be skipped and validation should pass
324
315
  expect(onSuccess).toHaveBeenCalledWith(content, undefined);
325
316
  expect(onError).not.toHaveBeenCalled();
326
317
  });
327
318
 
328
- it("calls onSuccess when API returns extracted tags in {% %} blocks but no errors", async () => {
319
+ it("should skip tags that appear only inside {% %} blocks (like item.name in for loop)", async () => {
329
320
  const content = '{% for item in order.items %} {{ item.name }} - {{ item.quantity }} {% endfor %}';
330
321
  const getLiquidTags = jest.fn((content, cb) =>
331
322
  cb({ askAiraResponse: { errors: [], data: [{ name: "item.name" }, { name: "item.quantity" }] }, isError: false })
@@ -336,13 +327,15 @@ describe("validateLiquidTemplateContent", () => {
336
327
  messages,
337
328
  onError,
338
329
  onSuccess,
330
+ tagLookupMap,
339
331
  eventContextTags
340
332
  });
333
+ // item.name and item.quantity appear inside {% for %} block, so they should be skipped
341
334
  expect(onSuccess).toHaveBeenCalledWith(content, undefined);
342
335
  expect(onError).not.toHaveBeenCalled();
343
336
  });
344
337
 
345
- it("calls onSuccess when API returns extracted tags not in content but no errors", async () => {
338
+ it("should validate tags that don't appear in content but are extracted by API", async () => {
346
339
  const content = 'Some content without the tag';
347
340
  const getLiquidTags = jest.fn((content, cb) =>
348
341
  cb({ askAiraResponse: { errors: [], data: [{ name: "extractedTag" }] }, isError: false })
@@ -353,13 +346,19 @@ describe("validateLiquidTemplateContent", () => {
353
346
  messages,
354
347
  onError,
355
348
  onSuccess,
349
+ tagLookupMap,
356
350
  eventContextTags
357
351
  });
358
- expect(onSuccess).toHaveBeenCalledWith(content, undefined);
359
- expect(onError).not.toHaveBeenCalled();
352
+ // extractedTag doesn't appear in content but was extracted by API, should be validated
353
+ expect(onError).toHaveBeenCalledWith({
354
+ standardErrors: [],
355
+ liquidErrors: [undefined],
356
+ tabType: undefined
357
+ });
358
+ expect(onSuccess).not.toHaveBeenCalled();
360
359
  });
361
360
 
362
- it("calls onSuccess when API returns tags outside {% %} but no errors", async () => {
361
+ it("should validate tags that appear outside {% %} blocks", async () => {
363
362
  const content = '{{ outsideTag }} {% for item in order.items %} {{ item.name }} {% endfor %}';
364
363
  const getLiquidTags = jest.fn((content, cb) =>
365
364
  cb({ askAiraResponse: { errors: [], data: [{ name: "outsideTag" }, { name: "item.name" }] }, isError: false })
@@ -370,70 +369,20 @@ describe("validateLiquidTemplateContent", () => {
370
369
  messages,
371
370
  onError,
372
371
  onSuccess,
372
+ tagLookupMap,
373
373
  eventContextTags
374
374
  });
375
- expect(onSuccess).toHaveBeenCalledWith(content, undefined);
376
- expect(onError).not.toHaveBeenCalled();
377
- });
378
-
379
- it("calls onSuccess when API returns tag in {{ }} and no errors", async () => {
380
- const content = 'Hello {{ unsupportedTag }} world';
381
- const getLiquidTags = jest.fn((content, cb) =>
382
- cb({ askAiraResponse: { errors: [], data: [{ name: "unsupportedTag" }] }, isError: false })
383
- );
384
- await validateLiquidTemplateContent(content, {
385
- getLiquidTags,
386
- formatMessage,
387
- messages,
388
- onError,
389
- onSuccess,
390
- eventContextTags
391
- });
392
- expect(onSuccess).toHaveBeenCalledWith(content, undefined);
393
- expect(onError).not.toHaveBeenCalled();
394
- });
395
-
396
- it("calls onSuccess when API returns tag with spacing variants and no errors", async () => {
397
- const content = '{{ tag}} and {{tag }} and {{ tag }}';
398
- const getLiquidTags = jest.fn((content, cb) =>
399
- cb({
400
- askAiraResponse: {
401
- errors: [],
402
- data: [{ name: "tag" }]
403
- },
404
- isError: false
405
- })
406
- );
407
- await validateLiquidTemplateContent(content, {
408
- getLiquidTags,
409
- formatMessage,
410
- messages,
411
- onError,
412
- onSuccess,
413
- eventContextTags
414
- });
415
- expect(onSuccess).toHaveBeenCalledWith(content, undefined);
416
- expect(onError).not.toHaveBeenCalled();
417
- });
418
-
419
- it("calls onSuccess when API returns tag inside {% %} blocks but no errors", async () => {
420
- const content = '{% for x in some.unsupported %} {{ x }} {% endfor %}';
421
- const getLiquidTags = jest.fn((content, cb) =>
422
- cb({ askAiraResponse: { errors: [], data: [{ name: "some.unsupported" }] }, isError: false })
423
- );
424
- await validateLiquidTemplateContent(content, {
425
- getLiquidTags,
426
- formatMessage,
427
- messages,
428
- onError,
429
- onSuccess,
430
- eventContextTags
375
+ // outsideTag appears outside {% %} block, so it should be validated
376
+ // item.name appears inside block, so it should be skipped
377
+ expect(onError).toHaveBeenCalledWith({
378
+ standardErrors: [],
379
+ liquidErrors: [undefined],
380
+ tabType: undefined
431
381
  });
432
- expect(onSuccess).toHaveBeenCalledWith(content, undefined);
433
- expect(onError).not.toHaveBeenCalled();
382
+ expect(onSuccess).not.toHaveBeenCalled();
434
383
  });
435
384
 
436
- it("calls onSuccess when API returns tags with dots in {% %} syntax but no errors", async () => {
385
+ it("should skip tags with dots that appear in {% %} syntax", async () => {
437
386
  const content = '{% assign myVar = order.items %} Some text';
438
387
  const getLiquidTags = jest.fn((content, cb) =>
439
388
  cb({ askAiraResponse: { errors: [], data: [{ name: "order.items" }] }, isError: false })
@@ -444,8 +393,10 @@ describe("validateLiquidTemplateContent", () => {
444
393
  messages,
445
394
  onError,
446
395
  onSuccess,
396
+ tagLookupMap,
447
397
  eventContextTags
448
398
  });
399
+ // order.items appears in {% %} syntax, so it should be skipped
449
400
  expect(onSuccess).toHaveBeenCalledWith(content, undefined);
450
401
  expect(onError).not.toHaveBeenCalled();
451
402
  });
@@ -500,6 +451,7 @@ describe("validateMobilePushContent", () => {
500
451
  somethingWentWrong: { id: "wrong" },
501
452
  unsupportedTagsValidationError: { id: "unsupported" }
502
453
  };
454
+ const tagLookupMap = { foo: true };
503
455
  const eventContextTags = [{ tagName: "foo" }];
504
456
  const onError = jest.fn();
505
457
  const onSuccess = jest.fn();
@@ -508,7 +460,7 @@ describe("validateMobilePushContent", () => {
508
460
  jest.clearAllMocks();
509
461
  });
510
462
 
511
- it("calls onError for empty formData (validateMobilePushContent)", async () => {
463
+ it("calls onError for empty formData", async () => {
512
464
  const getLiquidTags = jest.fn((content, cb) =>
513
465
  cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
514
466
  );
@@ -517,17 +469,18 @@ describe("validateMobilePushContent", () => {
517
469
  {
518
470
  getLiquidTags,
519
471
  formatMessage,
520
- messages,
521
- onError,
522
- onSuccess,
523
- eventContextTags,
472
+ messages,
473
+ onError,
474
+ onSuccess,
475
+ tagLookupMap,
476
+ eventContextTags,
524
477
  currentTab: 1
525
478
  }
526
479
  );
527
480
  expect(onError).toHaveBeenCalled();
528
481
  });
529
482
 
530
- it("calls onSuccess for valid android and ios content (validateMobilePushContent)", async () => {
483
+ it("calls onSuccess for valid android and ios content", async () => {
531
484
  const getLiquidTags = jest.fn((content, cb) =>
532
485
  cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
533
486
  );
@@ -538,6 +491,7 @@ describe("validateMobilePushContent", () => {
538
491
  messages,
539
492
  onError,
540
493
  onSuccess,
494
+ tagLookupMap,
541
495
  eventContextTags,
542
496
  currentTab: 1
543
497
  });
@@ -555,6 +509,7 @@ describe("validateMobilePushContent", () => {
555
509
  messages,
556
510
  onError,
557
511
  onSuccess,
512
+ tagLookupMap,
558
513
  eventContextTags,
559
514
  currentTab: 1
560
515
  });
@@ -572,6 +527,7 @@ describe("validateMobilePushContent", () => {
572
527
  messages,
573
528
  onError,
574
529
  onSuccess,
530
+ tagLookupMap,
575
531
  eventContextTags,
576
532
  currentTab: 2
577
533
  });
@@ -589,6 +545,7 @@ describe("validateMobilePushContent", () => {
589
545
  messages,
590
546
  onError,
591
547
  onSuccess,
548
+ tagLookupMap,
592
549
  eventContextTags
593
550
  });
594
551
  expect(onSuccess).toHaveBeenCalledWith(JSON.stringify(formData[0]), "android");
@@ -605,6 +562,7 @@ describe("validateMobilePushContent", () => {
605
562
  messages,
606
563
  onError,
607
564
  onSuccess,
565
+ tagLookupMap,
608
566
  eventContextTags
609
567
  });
610
568
  expect(onSuccess).toHaveBeenCalledWith("null", "android");
@@ -617,10 +575,11 @@ describe("validateMobilePushContent", () => {
617
575
  {
618
576
  getLiquidTags,
619
577
  formatMessage,
620
- messages,
621
- onError,
622
- onSuccess,
623
- eventContextTags,
578
+ messages,
579
+ onError,
580
+ onSuccess,
581
+ tagLookupMap,
582
+ eventContextTags,
624
583
  currentTab: 1,
625
584
  },
626
585
  );
@@ -634,10 +593,11 @@ describe("validateMobilePushContent", () => {
634
593
  {
635
594
  getLiquidTags,
636
595
  formatMessage,
637
- messages,
638
- onError,
639
- onSuccess,
640
- eventContextTags,
596
+ messages,
597
+ onError,
598
+ onSuccess,
599
+ tagLookupMap,
600
+ eventContextTags,
641
601
  currentTab: 1,
642
602
  },
643
603
  );
@@ -651,10 +611,11 @@ describe("validateMobilePushContent", () => {
651
611
  {
652
612
  getLiquidTags,
653
613
  formatMessage,
654
- messages,
655
- onError,
656
- onSuccess,
657
- eventContextTags,
614
+ messages,
615
+ onError,
616
+ onSuccess,
617
+ tagLookupMap,
618
+ eventContextTags,
658
619
  currentTab: 1,
659
620
  },
660
621
  );
@@ -668,10 +629,11 @@ describe("validateMobilePushContent", () => {
668
629
  {
669
630
  getLiquidTags,
670
631
  formatMessage,
671
- messages,
672
- onError,
673
- onSuccess,
674
- eventContextTags,
632
+ messages,
633
+ onError,
634
+ onSuccess,
635
+ tagLookupMap,
636
+ eventContextTags,
675
637
  currentTab: 1,
676
638
  },
677
639
  );
@@ -685,10 +647,11 @@ describe("validateMobilePushContent", () => {
685
647
  {
686
648
  getLiquidTags,
687
649
  formatMessage,
688
- messages,
689
- onError,
690
- onSuccess,
691
- eventContextTags,
650
+ messages,
651
+ onError,
652
+ onSuccess,
653
+ tagLookupMap,
654
+ eventContextTags,
692
655
  },
693
656
  );
694
657
  expect(onError).toHaveBeenCalled();
@@ -701,10 +664,11 @@ describe("validateMobilePushContent", () => {
701
664
  {
702
665
  getLiquidTags,
703
666
  formatMessage,
704
- messages,
705
- onError,
706
- onSuccess,
707
- eventContextTags,
667
+ messages,
668
+ onError,
669
+ onSuccess,
670
+ tagLookupMap,
671
+ eventContextTags,
708
672
  },
709
673
  );
710
674
  expect(onError).toHaveBeenCalled();
@@ -717,10 +681,11 @@ describe("validateMobilePushContent", () => {
717
681
  {
718
682
  getLiquidTags,
719
683
  formatMessage,
720
- messages,
721
- onError,
722
- onSuccess,
723
- eventContextTags,
684
+ messages,
685
+ onError,
686
+ onSuccess,
687
+ tagLookupMap,
688
+ eventContextTags,
724
689
  },
725
690
  );
726
691
  expect(onError).toHaveBeenCalled();
@@ -733,10 +698,11 @@ describe("validateMobilePushContent", () => {
733
698
  {
734
699
  getLiquidTags,
735
700
  formatMessage,
736
- messages,
737
- onError,
738
- onSuccess,
739
- eventContextTags,
701
+ messages,
702
+ onError,
703
+ onSuccess,
704
+ tagLookupMap,
705
+ eventContextTags,
740
706
  },
741
707
  );
742
708
  expect(onError).toHaveBeenCalled();
@@ -749,10 +715,11 @@ describe("validateMobilePushContent", () => {
749
715
  {
750
716
  getLiquidTags,
751
717
  formatMessage,
752
- messages,
753
- onError,
754
- onSuccess,
755
- eventContextTags,
718
+ messages,
719
+ onError,
720
+ onSuccess,
721
+ tagLookupMap,
722
+ eventContextTags,
756
723
  },
757
724
  );
758
725
  expect(onError).toHaveBeenCalled();
@@ -766,6 +733,7 @@ describe("validateInAppContent", () => {
766
733
  somethingWentWrong: { id: "wrong" },
767
734
  unsupportedTagsValidationError: { id: "unsupported" }
768
735
  };
736
+ const tagLookupMap = { foo: true };
769
737
  const eventContextTags = [{ tagName: "foo" }];
770
738
  const onError = jest.fn();
771
739
  const onSuccess = jest.fn();
@@ -774,7 +742,7 @@ describe("validateInAppContent", () => {
774
742
  jest.clearAllMocks();
775
743
  });
776
744
 
777
- it("calls onError for empty formData (validateInAppContent)", async () => {
745
+ it("calls onError for empty formData", async () => {
778
746
  const getLiquidTags = jest.fn((content, cb) =>
779
747
  cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
780
748
  );
@@ -783,16 +751,17 @@ describe("validateInAppContent", () => {
783
751
  {
784
752
  getLiquidTags,
785
753
  formatMessage,
786
- messages,
787
- onError,
788
- onSuccess,
789
- eventContextTags,
754
+ messages,
755
+ onError,
756
+ onSuccess,
757
+ tagLookupMap,
758
+ eventContextTags,
790
759
  }
791
760
  );
792
761
  expect(onError).toHaveBeenCalled();
793
762
  });
794
763
 
795
- it("calls onSuccess for valid android and ios content (validateInAppContent)", async () => {
764
+ it("calls onSuccess for valid android and ios content", async () => {
796
765
  const getLiquidTags = jest.fn((content, cb) =>
797
766
  cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
798
767
  );
@@ -812,6 +781,7 @@ describe("validateInAppContent", () => {
812
781
  messages,
813
782
  onError,
814
783
  onSuccess,
784
+ tagLookupMap,
815
785
  eventContextTags,
816
786
  singleTab: ANDROID,
817
787
  });
@@ -838,6 +808,7 @@ describe("validateInAppContent", () => {
838
808
  messages,
839
809
  onError,
840
810
  onSuccess,
811
+ tagLookupMap,
841
812
  eventContextTags,
842
813
  singleTab: IOS,
843
814
  });
@@ -864,11 +835,11 @@ describe("getChannelData", () => {
864
835
  expect(getChannelData("SMS", formData)).toBe("Hi Test");
865
836
  });
866
837
 
867
- it("returns string with undefineds for SMS when base and template-name are empty or undefined", () => {
838
+ it("returns string with undefineds for SMS channel with missing fields", () => {
868
839
  const formData = { base: {}, "template-name": undefined };
869
840
  expect(getChannelData("SMS", formData)).toBe("undefined undefined");
870
841
  });
871
- it("returns string with undefineds for SMS when formData is empty string", () => {
842
+ it("returns string with undefineds for SMS channel with missing fields", () => {
872
843
  expect(getChannelData("SMS", "")).toBe("undefined undefined");
873
844
  });
874
845