@capillarytech/creatives-library 9.2.2-alpha.sprint-cap-214249.44 → 9.2.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.
Files changed (89) hide show
  1. package/constants/unified.js +1 -3
  2. package/package.json +1 -1
  3. package/translations/en.json +0 -1
  4. package/translations/ja-JP.json +0 -1
  5. package/translations/zh.json +0 -1
  6. package/utils/common.js +6 -0
  7. package/utils/createMobilePushPayload.js +56 -50
  8. package/utils/tagValidations.js +4 -35
  9. package/utils/tests/createMobilePushPayload.test.js +168 -177
  10. package/utils/tests/tagValidations.test.js +0 -48
  11. package/v2Components/CapMpushCTA/index.js +57 -47
  12. package/v2Components/CapMpushCTA/index.scss +5 -43
  13. package/v2Components/CapTagList/index.js +7 -46
  14. package/v2Components/CapTagList/messages.js +0 -44
  15. package/v2Components/CapTagList/style.scss +1 -113
  16. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +8 -11
  17. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
  18. package/v2Components/CommonTestAndPreview/constants.js +0 -2
  19. package/v2Components/CommonTestAndPreview/index.js +12 -51
  20. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -83
  21. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -100
  22. package/v2Components/FormBuilder/Classic.js +14 -24
  23. package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +0 -1
  24. package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
  25. package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +0 -57
  26. package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
  27. package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +0 -3
  28. package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +0 -5
  29. package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +0 -6
  30. package/v2Components/FormBuilder/Functional/channels/sms/validate.js +1 -3
  31. package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +0 -3
  32. package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +0 -22
  33. package/v2Components/MobilePushPreviewV2/index.js +9 -22
  34. package/v2Components/TemplatePreview/_templatePreview.scss +2 -18
  35. package/v2Components/TemplatePreview/index.js +18 -20
  36. package/v2Components/TemplatePreview/tests/index.test.js +0 -69
  37. package/v2Containers/Cap/messages.js +0 -4
  38. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  39. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +2 -12
  40. package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -4
  41. package/v2Containers/CreativesContainer/index.js +1 -2
  42. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -43
  43. package/v2Containers/InApp/index.js +1 -4
  44. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
  45. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
  46. package/v2Containers/Line/Container/Text/index.js +1 -3
  47. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -16
  48. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -18
  49. package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
  50. package/v2Containers/MobilePushNew/components/MediaUploaders.js +345 -105
  51. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +105 -127
  52. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
  53. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +1484 -307
  54. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +59 -165
  55. package/v2Containers/MobilePushNew/constants.js +0 -12
  56. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
  57. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -78
  58. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -40
  59. package/v2Containers/MobilePushNew/hooks/useUpload.js +46 -42
  60. package/v2Containers/MobilePushNew/index.js +290 -502
  61. package/v2Containers/MobilePushNew/index.scss +4 -151
  62. package/v2Containers/MobilePushNew/messages.js +6 -106
  63. package/v2Containers/MobilePushNew/tests/index.test.js +1 -483
  64. package/v2Containers/MobilePushNew/tests/utils.test.js +0 -110
  65. package/v2Containers/MobilePushNew/utils.js +0 -83
  66. package/v2Containers/Rcs/index.js +1 -8
  67. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -59
  68. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  69. package/v2Containers/SmsTrai/Edit/index.js +5 -13
  70. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -15
  71. package/v2Containers/Templates/_templates.scss +2 -10
  72. package/v2Containers/Templates/index.js +81 -86
  73. package/v2Containers/Templates/tests/index.test.js +0 -81
  74. package/v2Containers/Viber/index.js +1 -3
  75. package/v2Containers/WebPush/Create/utils/validation.js +0 -6
  76. package/v2Containers/WebPush/Create/utils/validation.test.js +0 -50
  77. package/v2Containers/Whatsapp/index.js +5 -9
  78. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
  79. package/v2Containers/Zalo/index.js +1 -4
  80. package/v2Components/CapMpushCTA/tests/index.test.js +0 -150
  81. package/v2Components/CapTagList/TagFallbackPanel.js +0 -124
  82. package/v2Components/CapTagList/constants.js +0 -5
  83. package/v2Components/CapTagList/tests/TagFallback.test.js +0 -222
  84. package/v2Components/CapTagList/utils.js +0 -17
  85. package/v2Components/MobilePushPreviewV2/_mobilePushPreviewV2.scss +0 -7
  86. package/v2Components/MobilePushPreviewV2/tests/index.test.js +0 -55
  87. package/v2Components/TemplatePreview/_mobilePushPhone.scss +0 -72
  88. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/extractContentForPreview.test.js +0 -45
  89. package/v2Containers/MobilePushNew/components/TapLinkActions.js +0 -76
@@ -1,5 +1,5 @@
1
1
  import { IntlProvider } from 'react-intl';
2
- import createMobilePushPayload, { buildCarouselCards } from '../createMobilePushPayload';
2
+ import createMobilePushPayload from '../createMobilePushPayload';
3
3
  import messages from '../../v2Containers/MobilePushNew/messages';
4
4
 
5
5
  // Create a mock intl object
@@ -48,7 +48,6 @@ jest.mock('../createMobilePushPayload', () => {
48
48
  __esModule: true,
49
49
  default: mockCreateMobilePushPayload,
50
50
  appendDeepLinkKeysToUrl: originalModule.appendDeepLinkKeysToUrl,
51
- buildCarouselCards: originalModule.buildCarouselCards,
52
51
  };
53
52
  });
54
53
 
@@ -262,21 +261,6 @@ describe('createMobilePushPayload', () => {
262
261
  accountData: unsupportedAccountData,
263
262
  })).not.toThrow();
264
263
  });
265
-
266
- it.each([
267
- ['IOS', 'ANDROID', { androidContent: { title: 'Title', message: 'Message' }, iosContent: { title: '', message: '' } }],
268
- ['ANDROID', 'IOS', { androidContent: { title: '', message: '' }, iosContent: { title: 'Title', message: 'Message' } }],
269
- ])('leaves out a supported platform passed as skipPlatform (%s)', (skipPlatform, keptPlatform, content) => {
270
- const result = callWithIntl({
271
- templateName: 'Test',
272
- ...content,
273
- accountData: mockAccountData,
274
- options: { skipPlatform },
275
- });
276
-
277
- expect(result.versions.base[skipPlatform]).toBeUndefined();
278
- expect(result.versions.base[keptPlatform]).toBeDefined();
279
- });
280
264
  });
281
265
 
282
266
  // Account Data Validation Tests
@@ -351,67 +335,33 @@ describe('createMobilePushPayload', () => {
351
335
  expect(result.versions.base.ANDROID.expandableDetails.image).toBe('test-image.jpg');
352
336
  });
353
337
 
354
- it('should handle VIDEO media type with the platform videoSrc', () => {
338
+ it('should handle VIDEO media type with mpushVideoSrc', () => {
355
339
  const result = callWithIntl({
356
340
  templateName: 'Test',
357
341
  androidContent: {
358
342
  title: 'Title',
359
343
  message: 'Message',
360
344
  mediaType: 'VIDEO',
361
- videoSrc: 'test-video.mp4',
362
345
  },
363
346
  iosContent: { title: 'Title', message: 'Message' },
364
347
  accountData: mockAccountData,
365
- // The shared slot is ignored; it can hold the other tab's video
366
- mpushVideoSrcAndPreview: { mpushVideoSrc: 'other-tab.mp4' },
348
+ mpushVideoSrcAndPreview: { mpushVideoSrc: 'test-video.mp4' },
367
349
  });
368
350
  expect(result.versions.base.ANDROID.expandableDetails.media[0].url).toBe('test-video.mp4');
369
351
  expect(result.versions.base.ANDROID.expandableDetails.media[0].type).toBe('VIDEO');
370
352
  });
371
353
 
372
- it('should fall back to mediaList for a VIDEO with no videoSrc', () => {
373
- const result = callWithIntl({
374
- templateName: 'Test',
375
- androidContent: {
376
- title: 'Title',
377
- message: 'Message',
378
- mediaType: 'VIDEO',
379
- mediaList: [{ url: 'saved.mp4', text: 'Saved' }],
380
- },
381
- iosContent: { title: 'Title', message: 'Message' },
382
- accountData: mockAccountData,
383
- });
384
- expect(result.versions.base.ANDROID.expandableDetails.media[0]).toEqual({ url: 'saved.mp4', text: 'Saved', type: 'VIDEO' });
385
- });
386
-
387
- it('saves each platform its own video', () => {
388
- const result = callWithIntl({
389
- templateName: 'Test',
390
- androidContent: {
391
- title: 'Title', message: 'Message', mediaType: 'VIDEO', videoSrc: 'a.mp4',
392
- },
393
- iosContent: {
394
- title: 'Title', message: 'Message', mediaType: 'VIDEO', videoSrc: 'b.mp4',
395
- },
396
- accountData: mockAccountData,
397
- mpushVideoSrcAndPreview: { mpushVideoSrc: 'b.mp4' },
398
- });
399
- expect(result.versions.base.ANDROID.expandableDetails.media[0].url).toBe('a.mp4');
400
- expect(result.versions.base.IOS.expandableDetails.media[0].url).toBe('b.mp4');
401
- });
402
-
403
- it('should handle GIF media type with the platform videoSrc', () => {
354
+ it('should handle GIF media type with mpushVideoSrc', () => {
404
355
  const result = callWithIntl({
405
356
  templateName: 'Test',
406
357
  androidContent: {
407
358
  title: 'Title',
408
359
  message: 'Message',
409
360
  mediaType: 'GIF',
410
- videoSrc: 'test-gif.gif',
411
361
  },
412
362
  iosContent: { title: 'Title', message: 'Message' },
413
363
  accountData: mockAccountData,
414
- mpushVideoSrcAndPreview: { mpushVideoSrc: 'other-tab.gif' },
364
+ mpushVideoSrcAndPreview: { mpushVideoSrc: 'test-gif.gif' },
415
365
  });
416
366
  expect(result.versions.base.ANDROID.expandableDetails.media[0].url).toBe('test-gif.gif');
417
367
  expect(result.versions.base.ANDROID.expandableDetails.media[0].type).toBe('GIF');
@@ -463,34 +413,6 @@ describe('createMobilePushPayload', () => {
463
413
 
464
414
  // Carousel Handling Tests
465
415
  describe('Carousel Handling', () => {
466
- // Buttons set before switching to carousel stay in the editor but aren't sent; the tap link is sent
467
- const hiddenCtas = [{ type: 'EXTERNAL_URL', actionText: 'IOS PrimButton', actionLink: 'https://btn.com' }];
468
- const withHiddenLinks = (mediaType) => ({
469
- title: 'Title',
470
- message: 'Message',
471
- mediaType,
472
- actionOnClick: true,
473
- linkType: 'EXTERNAL_LINK',
474
- externalLinkValue: 'https://tap.com',
475
- expandableDetails: { ctas: hiddenCtas },
476
- });
477
-
478
- it('drops the buttons of a carousel tab but keeps its notification tap', () => {
479
- const result = callWithIntl({
480
- templateName: 'Test',
481
- androidContent: withHiddenLinks('VIDEO'),
482
- iosContent: withHiddenLinks('CAROUSEL'),
483
- accountData: mockAccountData,
484
- });
485
- const { IOS, ANDROID } = result.versions.base;
486
- expect(IOS.expandableDetails.ctas).toEqual([]);
487
- // Notification tap is for the whole notification, carousel included
488
- expect(IOS.cta).toEqual({ type: 'EXTERNAL_URL', actionLink: 'https://tap.com' });
489
- // Another tab keeps them
490
- expect(ANDROID.expandableDetails.ctas).toEqual(hiddenCtas);
491
- expect(ANDROID.cta).toEqual({ type: 'EXTERNAL_URL', actionLink: 'https://tap.com' });
492
- });
493
-
494
416
  it('should handle CAROUSEL media type with carouselData', () => {
495
417
  const result = callWithIntl({
496
418
  templateName: 'Test',
@@ -689,7 +611,7 @@ describe('createMobilePushPayload', () => {
689
611
  });
690
612
  });
691
613
 
692
- it('should add the missing key when URL contains some keys but not all', () => {
614
+ it('should handle deep link CTA with keys when URL contains some keys but not all', () => {
693
615
  const result = callWithIntl({
694
616
  templateName: 'Test',
695
617
  androidContent: {
@@ -705,45 +627,8 @@ describe('createMobilePushPayload', () => {
705
627
  });
706
628
  expect(result.versions.base.ANDROID.cta).toEqual({
707
629
  type: 'DEEP_LINK',
708
- actionLink: 'app://deep-link?key1=key1&key2=key2',
709
- });
710
- });
711
-
712
- it('should send the configured key with the typed value', () => {
713
- const result = callWithIntl({
714
- templateName: 'Test',
715
- androidContent: {
716
- title: 'Title',
717
- message: 'Message',
718
- actionOnClick: true,
719
- linkType: 'DEEP_LINK',
720
- deepLinkValue: 'https://www.youtube.com/',
721
- deepLinkKeysValue: ['testing_purpose=androidDeeplink'],
722
- },
723
- iosContent: { title: 'Title', message: 'Message' },
724
- accountData: mockAccountData,
725
- });
726
- expect(result.versions.base.ANDROID.cta).toEqual({
727
- type: 'DEEP_LINK',
728
- actionLink: 'https://www.youtube.com/?testing_purpose=androidDeeplink',
729
- });
730
- });
731
-
732
- it('should replace a saved value instead of adding the key twice', () => {
733
- const result = callWithIntl({
734
- templateName: 'Test',
735
- androidContent: {
736
- title: 'Title',
737
- message: 'Message',
738
- actionOnClick: true,
739
- linkType: 'DEEP_LINK',
740
- deepLinkValue: 'app://home?src=push&id=5',
741
- deepLinkKeysValue: ['id=7'],
742
- },
743
- iosContent: { title: 'Title', message: 'Message' },
744
- accountData: mockAccountData,
630
+ actionLink: 'app://deep-link?key1=key1',
745
631
  });
746
- expect(result.versions.base.ANDROID.cta.actionLink).toBe('app://home?src=push&id=7');
747
632
  });
748
633
 
749
634
  it('should handle deep link CTA with empty deepLinkKeysValue', () => {
@@ -975,12 +860,13 @@ describe('createMobilePushPayload', () => {
975
860
  title: 'Title',
976
861
  message: 'Message',
977
862
  mediaType: 'GIF',
978
- videoSrc: 'test-gif.gif',
979
863
  },
980
864
  iosContent: { title: 'Title', message: 'Message' },
981
865
  accountData: mockAccountData,
866
+ mpushVideoSrcAndPreview: { mpushVideoSrc: 'test-gif.gif' },
982
867
  });
983
- expect(result.versions.base.ANDROID.expandableDetails.media[0]).toEqual({ url: 'test-gif.gif', text: '', type: 'GIF' });
868
+ // When mediaType is GIF and mpushVideoSrc is provided, it converts to VIDEO for backend compatibility
869
+ expect(result.versions.base.ANDROID.expandableDetails.media[0].type).toBe('GIF');
984
870
  });
985
871
 
986
872
  it('should handle options with custom mode', () => {
@@ -1146,7 +1032,7 @@ describe('createMobilePushPayload', () => {
1146
1032
  });
1147
1033
 
1148
1034
  describe('Carousel Button Deep Link Keys', () => {
1149
- it('drops old per-card links from carousel cards', () => {
1035
+ it('should append deep link keys to URL in carousel buttons', () => {
1150
1036
  const result = callWithIntl({
1151
1037
  templateName: 'Test',
1152
1038
  androidContent: {
@@ -1159,9 +1045,8 @@ describe('createMobilePushPayload', () => {
1159
1045
  imageUrl: 'test.jpg',
1160
1046
  buttons: [
1161
1047
  {
1162
- actionOnClick: true,
1163
1048
  linkType: 'DEEP_LINK',
1164
- deepLinkKeys: ['key1=a'],
1049
+ deepLinkKeys: ['key1', 'key2'],
1165
1050
  deepLinkValue: 'app://test',
1166
1051
  },
1167
1052
  ],
@@ -1172,11 +1057,162 @@ describe('createMobilePushPayload', () => {
1172
1057
  accountData: mockAccountData,
1173
1058
  });
1174
1059
 
1175
- expect(result.versions.base.ANDROID.expandableDetails.carouselData[0]).toEqual({
1176
- mediaType: 'image',
1177
- imageUrl: 'test.jpg',
1178
- videoSrc: '',
1179
- buttons: [],
1060
+ expect(result.versions.base.ANDROID.expandableDetails.carouselData[0].buttons[0].deepLinkValue)
1061
+ .toBe('app://test?key1=key1&key2=key2');
1062
+ });
1063
+
1064
+ it('should handle single deep link key in carousel buttons', () => {
1065
+ const result = callWithIntl({
1066
+ templateName: 'Test',
1067
+ androidContent: {
1068
+ title: 'Title',
1069
+ message: 'Message',
1070
+ mediaType: 'CAROUSEL',
1071
+ carouselData: [
1072
+ {
1073
+ mediaType: 'image',
1074
+ imageUrl: 'test.jpg',
1075
+ buttons: [
1076
+ {
1077
+ linkType: 'DEEP_LINK',
1078
+ deepLinkKeys: 'singleKey',
1079
+ deepLinkValue: 'app://test',
1080
+ },
1081
+ ],
1082
+ },
1083
+ ],
1084
+ },
1085
+ iosContent: { title: 'Title', message: 'Message' },
1086
+ accountData: mockAccountData,
1087
+ });
1088
+
1089
+ expect(result.versions.base.ANDROID.expandableDetails.carouselData[0].buttons[0].deepLinkValue)
1090
+ .toBe('app://test?singleKey=singleKey');
1091
+ });
1092
+
1093
+ it('should handle URL with existing query parameters', () => {
1094
+ const result = callWithIntl({
1095
+ templateName: 'Test',
1096
+ androidContent: {
1097
+ title: 'Title',
1098
+ message: 'Message',
1099
+ mediaType: 'CAROUSEL',
1100
+ carouselData: [
1101
+ {
1102
+ mediaType: 'image',
1103
+ imageUrl: 'test.jpg',
1104
+ buttons: [
1105
+ {
1106
+ linkType: 'DEEP_LINK',
1107
+ deepLinkKeys: ['key1', 'key2'],
1108
+ deepLinkValue: 'app://test?param=value',
1109
+ },
1110
+ ],
1111
+ },
1112
+ ],
1113
+ },
1114
+ iosContent: { title: 'Title', message: 'Message' },
1115
+ accountData: mockAccountData,
1116
+ });
1117
+
1118
+ expect(result.versions.base.ANDROID.expandableDetails.carouselData[0].buttons[0].deepLinkValue)
1119
+ .toBe('app://test?param=value&key1=key1&key2=key2');
1120
+ });
1121
+
1122
+ it('should not modify URL when deepLinkKeys is missing', () => {
1123
+ const result = callWithIntl({
1124
+ templateName: 'Test',
1125
+ androidContent: {
1126
+ title: 'Title',
1127
+ message: 'Message',
1128
+ mediaType: 'CAROUSEL',
1129
+ carouselData: [
1130
+ {
1131
+ mediaType: 'image',
1132
+ imageUrl: 'test.jpg',
1133
+ buttons: [
1134
+ {
1135
+ linkType: 'DEEP_LINK',
1136
+ deepLinkValue: 'app://test',
1137
+ },
1138
+ ],
1139
+ },
1140
+ ],
1141
+ },
1142
+ iosContent: { title: 'Title', message: 'Message' },
1143
+ accountData: mockAccountData,
1144
+ });
1145
+
1146
+ expect(result.versions.base.ANDROID.expandableDetails.carouselData[0].buttons[0].deepLinkValue)
1147
+ .toBe('app://test');
1148
+ });
1149
+
1150
+ it('should not modify URL when deepLinkKeys is empty array', () => {
1151
+ const result = callWithIntl({
1152
+ templateName: 'Test',
1153
+ androidContent: {
1154
+ title: 'Title',
1155
+ message: 'Message',
1156
+ mediaType: 'CAROUSEL',
1157
+ carouselData: [
1158
+ {
1159
+ mediaType: 'image',
1160
+ imageUrl: 'test.jpg',
1161
+ buttons: [
1162
+ {
1163
+ linkType: 'DEEP_LINK',
1164
+ deepLinkKeys: [],
1165
+ deepLinkValue: 'app://test',
1166
+ },
1167
+ ],
1168
+ },
1169
+ ],
1170
+ },
1171
+ iosContent: { title: 'Title', message: 'Message' },
1172
+ accountData: mockAccountData,
1173
+ });
1174
+
1175
+ expect(result.versions.base.ANDROID.expandableDetails.carouselData[0].buttons[0].deepLinkValue)
1176
+ .toBe('app://test');
1177
+ });
1178
+
1179
+ it('should handle invalid deepLinkKeys values', () => {
1180
+ const result = callWithIntl({
1181
+ templateName: 'Test',
1182
+ androidContent: {
1183
+ title: 'Title',
1184
+ message: 'Message',
1185
+ mediaType: 'CAROUSEL',
1186
+ carouselData: [
1187
+ {
1188
+ mediaType: 'image',
1189
+ imageUrl: 'test.jpg',
1190
+ buttons: [
1191
+ {
1192
+ linkType: 'DEEP_LINK',
1193
+ deepLinkKeys: null,
1194
+ deepLinkValue: 'app://test',
1195
+ },
1196
+ {
1197
+ linkType: 'DEEP_LINK',
1198
+ deepLinkKeys: undefined,
1199
+ deepLinkValue: 'app://test',
1200
+ },
1201
+ {
1202
+ linkType: 'DEEP_LINK',
1203
+ deepLinkKeys: {},
1204
+ deepLinkValue: 'app://test',
1205
+ },
1206
+ ],
1207
+ },
1208
+ ],
1209
+ },
1210
+ iosContent: { title: 'Title', message: 'Message' },
1211
+ accountData: mockAccountData,
1212
+ });
1213
+
1214
+ result.versions.base.ANDROID.expandableDetails.carouselData[0].buttons.forEach((button) => {
1215
+ expect(button.deepLinkValue).toBe('app://test');
1180
1216
  });
1181
1217
  });
1182
1218
 
@@ -1286,48 +1322,3 @@ describe('createMobilePushPayload', () => {
1286
1322
  });
1287
1323
  });
1288
1324
  });
1289
-
1290
- describe('buildCarouselCards', () => {
1291
- it.each([
1292
- ['no argument', undefined],
1293
- ['null', null],
1294
- ['an empty array', []],
1295
- ])('returns [] for %s', (_label, input) => {
1296
- expect(buildCarouselCards(input)).toEqual([]);
1297
- });
1298
-
1299
- it('fills defaults for a missing card', () => {
1300
- expect(buildCarouselCards([null])).toEqual([
1301
- { mediaType: 'image', imageUrl: '', videoSrc: '', buttons: [] },
1302
- ]);
1303
- });
1304
-
1305
- it('sends no card buttons, even when a card has old links', () => {
1306
- const [card] = buildCarouselCards([{
1307
- mediaType: 'image',
1308
- imageUrl: 'a.jpg',
1309
- buttons: [
1310
- {
1311
- actionOnClick: true, linkType: 'DEEP_LINK', deepLinkValue: 'app://home', deepLinkKeys: ['id=1'],
1312
- },
1313
- {
1314
- actionOnClick: true, linkType: 'EXTERNAL_LINK', externalLinkValue: 'https://a.com', isSaved: true,
1315
- },
1316
- null,
1317
- ],
1318
- }]);
1319
- expect(card).toEqual({
1320
- mediaType: 'image', imageUrl: 'a.jpg', videoSrc: '', buttons: [],
1321
- });
1322
- });
1323
-
1324
- it('keeps the video thumbnail only when there is one', () => {
1325
- const [withThumb, withoutThumb] = buildCarouselCards([
1326
- { mediaType: 'video', videoSrc: 'a.mp4', videoPreviewImg: 'a.png' },
1327
- { mediaType: 'video', videoSrc: 'b.mp4', videoPreviewImg: '' },
1328
- ]);
1329
-
1330
- expect(withThumb).toEqual({ mediaType: 'video', imageUrl: '', videoSrc: 'a.mp4', videoPreviewImg: 'a.png', buttons: [] });
1331
- expect(withoutThumb).toEqual({ mediaType: 'video', imageUrl: '', videoSrc: 'b.mp4', buttons: [] });
1332
- });
1333
- });
@@ -11,7 +11,6 @@ import {
11
11
  skipTags,
12
12
  checkIfSupportedTag,
13
13
  transformInjectedTags,
14
- hasUnquotedTagDefault,
15
14
  } from '../tagValidations';
16
15
  import { containsBase64Images } from '../content';
17
16
 
@@ -194,53 +193,6 @@ describe("check if curly brackets are balanced", () => {
194
193
  })
195
194
  })
196
195
 
197
- describe('hasUnquotedTagDefault', () => {
198
- it('allows tags without default and defaults within quotes', () => {
199
- expect(hasUnquotedTagDefault('{{badge_description}}')).toBe(false);
200
- expect(hasUnquotedTagDefault("{{badge_description | default: ''}}")).toBe(false);
201
- expect(hasUnquotedTagDefault("{{badge_description | default: 'Rafeeq'}}")).toBe(false);
202
- expect(hasUnquotedTagDefault('{{badge_description | default: "Rafeeq\'s"}}')).toBe(false);
203
- expect(hasUnquotedTagDefault("Hi {{a|default:' '}} {{b}} plain text")).toBe(false);
204
- });
205
-
206
- it('flags default with missing or unquoted value', () => {
207
- expect(hasUnquotedTagDefault('{{badge_description | default: }}')).toBe(true);
208
- expect(hasUnquotedTagDefault('{{badge_description | default: Rafeeq}}')).toBe(true);
209
- expect(hasUnquotedTagDefault("{{badge_description | default: 'Rafeeq}}")).toBe(true);
210
- expect(hasUnquotedTagDefault("{{a}} {{b | default: 'x' y}}")).toBe(true);
211
- });
212
-
213
- it('ignores pipes inside quotes and allows chained filters', () => {
214
- expect(hasUnquotedTagDefault("{{name | replace: '| default:', 'x'}}")).toBe(false);
215
- expect(hasUnquotedTagDefault("{{name | default: 'a | default: b'}}")).toBe(false);
216
- expect(hasUnquotedTagDefault("{{name | default: 'a|b'}}")).toBe(false);
217
- expect(hasUnquotedTagDefault("{{name | default: 'x' | append: '!'}}")).toBe(false);
218
- expect(hasUnquotedTagDefault("{{name | append: 'x' | default: 'y'}}")).toBe(false);
219
- });
220
-
221
- it('rejects backslash-escaped quotes since Liquid has no escapes', () => {
222
- expect(hasUnquotedTagDefault("{{name | default: 'it\\'s'}}")).toBe(true);
223
- });
224
- });
225
-
226
- describe('validateTagsCore default quote check', () => {
227
- const run = (content) => validateTagsCore({
228
- contentForBraceCheck: content, contentForUnsubscribeScan: content, tags: null, currentModule: 'default', isFullMode: true,
229
- });
230
-
231
- it('marks unquoted default as invalid with isDefaultQuoteError', () => {
232
- expect(run('{{name | default: Rafeeq}}')).toEqual(expect.objectContaining({ valid: false, isBraceError: false, isDefaultQuoteError: true }));
233
- });
234
-
235
- it('keeps quoted default valid', () => {
236
- expect(run("{{name | default: 'Rafeeq'}}")).toEqual(expect.objectContaining({ valid: true, isDefaultQuoteError: false }));
237
- });
238
-
239
- it('reports only brace error when braces are not closed', () => {
240
- expect(run('{{name | default: Rafeeq}')).toEqual(expect.objectContaining({ isBraceError: true, isDefaultQuoteError: false }));
241
- });
242
- });
243
-
244
196
  describe("validateTags", () => {
245
197
  const tagsParam = [
246
198
  {