@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
@@ -75,8 +75,6 @@ import {
75
75
  CTA_TYPE_EXTERNAL_URL,
76
76
  STYLE_TYPE_BIG_PICTURE,
77
77
  STYLE_TYPE_BIG_TEXT,
78
- STYLE_TYPE_VIDEO,
79
- STYLE_TYPE_MANUAL_CAROUSEL,
80
78
  DEVICE_TYPE_ANDROID,
81
79
  DEVICE_TYPE_IOS,
82
80
  BUTTON_TYPE_NONE,
@@ -1886,10 +1884,6 @@ const CommonTestAndPreview = (props) => {
1886
1884
  'message-title': formDataObj.androidContent.header || '',
1887
1885
  'message-editor': formDataObj.androidContent.bodyText || '',
1888
1886
  'image': formDataObj.androidContent.bodyImage || '',
1889
- // bodyVideo also carries GIFs; send only real videos
1890
- 'video': formDataObj.androidContent.bodyGif ? '' : (formDataObj.androidContent.bodyVideo?.videoSrc || ''),
1891
- // Saved cards, already in the shape Save sent
1892
- carouselData: formDataObj.androidContent.carouselData || [],
1893
1887
  // Extract CTA info from actions if available
1894
1888
  ...(formDataObj.androidContent.actions?.[0] && {
1895
1889
  'cta-deeplink-label': formDataObj.androidContent.actions[0].label,
@@ -1908,8 +1902,6 @@ const CommonTestAndPreview = (props) => {
1908
1902
  'message-title2': formDataObj.iosContent.header || '',
1909
1903
  'message-editor2': formDataObj.iosContent.bodyText || '',
1910
1904
  'image': formDataObj.iosContent.bodyImage || '',
1911
- 'video': formDataObj.iosContent.bodyGif ? '' : (formDataObj.iosContent.bodyVideo?.videoSrc || ''),
1912
- carouselData: formDataObj.iosContent.carouselData || [],
1913
1905
  // Extract CTA info from actions if available
1914
1906
  ...(formDataObj.iosContent.actions?.[0] && {
1915
1907
  'cta-deeplink2-label': formDataObj.iosContent.actions[0].label,
@@ -2015,35 +2007,11 @@ const CommonTestAndPreview = (props) => {
2015
2007
  };
2016
2008
  };
2017
2009
 
2018
- const hasCarousel = (data) => Array.isArray(data.carouselData) && data.carouselData.length > 0;
2019
- // Carousel, then video, then image; BIG_TEXT when none
2020
- const getMpushStyle = (data) => {
2021
- if (hasCarousel(data)) return STYLE_TYPE_MANUAL_CAROUSEL;
2022
- if (data.video) return STYLE_TYPE_VIDEO;
2023
- return data.image ? STYLE_TYPE_BIG_PICTURE : STYLE_TYPE_BIG_TEXT;
2024
- };
2025
- const getMpushType = (data) => {
2026
- if (hasCarousel(data)) return MEDIA_TYPE_CAROUSEL;
2027
- if (data.video) return MEDIA_TYPE_VIDEO;
2028
- return data.image ? MEDIA_TYPE_IMAGE : MEDIA_TYPE_TEXT;
2029
- };
2030
- // Raw URL, as Save sends it (the CDN helper is an image transform)
2031
- const toMpushVideoMedia = (url) => [{ url, text: '', type: MEDIA_TYPE_VIDEO }];
2032
- // Only the spec's media list, as campaigns saves it (carouselData is the editor's own format)
2033
- const addMpushCarousel = (expandableDetails, data) => {
2034
- Object.assign(expandableDetails, {
2035
- media: data.carouselData.map((card) => ({
2036
- url: card?.mediaType?.toUpperCase() === MEDIA_TYPE_VIDEO ? card.videoSrc : card.imageUrl,
2037
- type: card?.mediaType?.toUpperCase(),
2038
- text: '',
2039
- })),
2040
- });
2041
- };
2042
-
2043
2010
  // Helper function to build expandableDetails for Android
2044
2011
  const buildAndroidExpandableDetails = (data) => {
2012
+ // Default style is BIG_TEXT, change to BIG_PICTURE if image exists
2045
2013
  const imageLink = data.image;
2046
- const style = getMpushStyle(data);
2014
+ const style = imageLink ? STYLE_TYPE_BIG_PICTURE : STYLE_TYPE_BIG_TEXT;
2047
2015
 
2048
2016
  const expandableDetails = {
2049
2017
  style,
@@ -2052,11 +2020,7 @@ const CommonTestAndPreview = (props) => {
2052
2020
  };
2053
2021
 
2054
2022
  // Add image if present (transform to CDN URL if needed)
2055
- if (hasCarousel(data)) {
2056
- addMpushCarousel(expandableDetails, data);
2057
- } else if (data.video) {
2058
- expandableDetails.media = toMpushVideoMedia(data.video);
2059
- } else if (imageLink) {
2023
+ if (imageLink) {
2060
2024
  expandableDetails.image = getCdnUrl({ url: imageLink, channelName: CHANNEL_NAME_MOBILE_PUSH });
2061
2025
  }
2062
2026
 
@@ -2135,8 +2099,9 @@ const CommonTestAndPreview = (props) => {
2135
2099
 
2136
2100
  // Helper function to build expandableDetails for iOS
2137
2101
  const buildIosExpandableDetails = (data) => {
2102
+ // Default style is BIG_TEXT, change to BIG_PICTURE if image exists
2138
2103
  const imageLinkIos = data.image;
2139
- const style = getMpushStyle(data);
2104
+ const style = imageLinkIos ? STYLE_TYPE_BIG_PICTURE : STYLE_TYPE_BIG_TEXT;
2140
2105
 
2141
2106
  const expandableDetails = {
2142
2107
  style,
@@ -2145,11 +2110,7 @@ const CommonTestAndPreview = (props) => {
2145
2110
  };
2146
2111
 
2147
2112
  // Add image if present (transform to CDN URL if needed)
2148
- if (hasCarousel(data)) {
2149
- addMpushCarousel(expandableDetails, data);
2150
- } else if (data.video) {
2151
- expandableDetails.media = toMpushVideoMedia(data.video);
2152
- } else if (imageLinkIos) {
2113
+ if (imageLinkIos) {
2153
2114
  expandableDetails.image = getCdnUrl({ url: imageLinkIos, channelName: CHANNEL_NAME_MOBILE_PUSH });
2154
2115
  }
2155
2116
 
@@ -2222,13 +2183,12 @@ const CommonTestAndPreview = (props) => {
2222
2183
  // Build Android content
2223
2184
  const androidTitle = resolveTagsInText(androidData['message-title'] || '', customValuesObj);
2224
2185
  const androidMessage = resolveTagsInText(androidData['message-editor'] || '', customValuesObj);
2225
- // No tap-link form keys when campaigns passes its content: use its saved cta as is
2226
- const getSavedMpushCta = (savedContent) => savedContent?.cta || null;
2227
- const androidCta = buildAndroidCta(androidData) || getSavedMpushCta(formDataObj?.androidContent);
2186
+ const androidCta = buildAndroidCta(androidData);
2228
2187
  const androidExpandableDetails = buildAndroidExpandableDetails(androidData);
2229
2188
  const androidCustomProperties = buildCustomProperties(androidData);
2230
2189
 
2231
- const androidType = getMpushType(androidData);
2190
+ // Determine type based on image presence
2191
+ const androidType = androidData.image ? MEDIA_TYPE_IMAGE : MEDIA_TYPE_TEXT;
2232
2192
 
2233
2193
  const androidContent = {
2234
2194
  type: androidType,
@@ -2243,11 +2203,12 @@ const CommonTestAndPreview = (props) => {
2243
2203
  // Build iOS content
2244
2204
  const iosTitle = resolveTagsInText(iosData['message-title2'] || '', customValuesObj);
2245
2205
  const iosMessage = resolveTagsInText(iosData['message-editor2'] || '', customValuesObj);
2246
- const iosCta = buildIosCta(iosData) || getSavedMpushCta(formDataObj?.iosContent);
2206
+ const iosCta = buildIosCta(iosData);
2247
2207
  const iosExpandableDetails = buildIosExpandableDetails(iosData);
2248
2208
  const iosCustomProperties = buildCustomProperties(iosData);
2249
2209
 
2250
- const iosType = getMpushType(iosData);
2210
+ // Determine type based on image presence
2211
+ const iosType = iosData.image ? MEDIA_TYPE_IMAGE : MEDIA_TYPE_TEXT;
2251
2212
 
2252
2213
  const iosContent = {
2253
2214
  type: iosType,
@@ -279,8 +279,8 @@ describe('MobilePushPreviewContent', () => {
279
279
  </TestWrapper>
280
280
  );
281
281
 
282
- expect(screen.getByText('Action 1')).toBeTruthy();
283
- expect(screen.getByText('Action 2')).toBeTruthy();
282
+ expect(screen.getByText('ACTION 1')).toBeTruthy();
283
+ expect(screen.getByText('ACTION 2')).toBeTruthy();
284
284
  });
285
285
 
286
286
  it('should use actionText as fallback for label', () => {
@@ -304,7 +304,7 @@ describe('MobilePushPreviewContent', () => {
304
304
  </TestWrapper>
305
305
  );
306
306
 
307
- expect(screen.getByText('Action Text')).toBeTruthy();
307
+ expect(screen.getByText('ACTION TEXT')).toBeTruthy();
308
308
  });
309
309
 
310
310
  it('should not render actions when carouselData is present', () => {
@@ -330,7 +330,7 @@ describe('MobilePushPreviewContent', () => {
330
330
  </TestWrapper>
331
331
  );
332
332
 
333
- expect(screen.queryByText('Action 1')).toBeNull();
333
+ expect(screen.queryByText('ACTION 1')).toBeNull();
334
334
  });
335
335
 
336
336
  it('should filter out actions without label or actionText', () => {
@@ -354,7 +354,7 @@ describe('MobilePushPreviewContent', () => {
354
354
  <ComponentToRender {...props} />
355
355
  </TestWrapper>
356
356
  );
357
- expect(screen.getByText('Action 1')).toBeTruthy();
357
+ expect(screen.getByText('ACTION 1')).toBeTruthy();
358
358
  });
359
359
  });
360
360
 
@@ -368,13 +368,11 @@ describe('MobilePushPreviewContent', () => {
368
368
  bodyText: 'Body',
369
369
  carouselData: [
370
370
  {
371
- mediaType: 'IMAGE',
372
371
  title: 'Carousel Item 1',
373
372
  message: 'Message 1',
374
373
  imageUrl: 'https://image1.url',
375
374
  },
376
375
  {
377
- mediaType: 'IMAGE',
378
376
  title: 'Carousel Item 2',
379
377
  message: 'Message 2',
380
378
  imageUrl: 'https://image2.url',
@@ -394,78 +392,6 @@ describe('MobilePushPreviewContent', () => {
394
392
  expect(screen.getByText('Carousel Item 2')).toBeTruthy();
395
393
  });
396
394
 
397
- it('should render every card, with or without media, in a horizontal row', () => {
398
- const props = {
399
- ...defaultProps,
400
- content: {
401
- androidContent: {
402
- header: 'Header',
403
- carouselData: [
404
- { mediaType: 'IMAGE', imageUrl: 'https://a.url', title: 'Card 1' },
405
- { mediaType: 'IMAGE', title: 'Empty card' },
406
- { mediaType: 'VIDEO', videoPreviewImg: 'https://b.url', title: 'Card 3' },
407
- ],
408
- },
409
- },
410
- };
411
-
412
- const { container } = render(
413
- <TestWrapper>
414
- <ComponentToRender {...props} />
415
- </TestWrapper>
416
- );
417
-
418
- expect(container.querySelectorAll('.mobile-push-carousel-card')).toHaveLength(3);
419
- expect(screen.getByText('Empty card')).toBeInTheDocument();
420
- const scrollRow = container.querySelector('.scroll-container');
421
- expect(scrollRow.className).not.toMatch(/ant-row-legacy|cap-row-vertical/);
422
- });
423
-
424
- it('should render a video card with no thumbnail as the video placeholder', () => {
425
- const props = {
426
- ...defaultProps,
427
- content: {
428
- androidContent: {
429
- header: 'Header',
430
- carouselData: [{ mediaType: 'video', videoSrc: 'https://v.mp4', title: 'Video card' }],
431
- },
432
- },
433
- };
434
-
435
- const { container } = render(
436
- <TestWrapper>
437
- <ComponentToRender {...props} />
438
- </TestWrapper>
439
- );
440
-
441
- expect(container.querySelectorAll('.mobile-push-carousel-card')).toHaveLength(1);
442
- expect(container.querySelector('video')).toBeNull();
443
- // svg imports resolve to the file stub in tests
444
- expect(container.querySelector('img.carousel-video-preview')).toHaveAttribute('src', 'test-file-stub');
445
- });
446
-
447
- it('should render an empty card while no media is uploaded', () => {
448
- const props = {
449
- ...defaultProps,
450
- content: {
451
- androidContent: {
452
- header: 'Header',
453
- carouselData: [{ mediaType: 'IMAGE', title: 'Empty card' }],
454
- },
455
- },
456
- };
457
-
458
- const { container } = render(
459
- <TestWrapper>
460
- <ComponentToRender {...props} />
461
- </TestWrapper>
462
- );
463
-
464
- expect(container.querySelector('.mobile-push-carousel-container')).toBeTruthy();
465
- expect(container.querySelectorAll('.mobile-push-carousel-card')).toHaveLength(1);
466
- expect(container.querySelector('.carousel-image')).toBeNull();
467
- });
468
-
469
395
  it('should render carousel with image media type', () => {
470
396
  const props = {
471
397
  ...defaultProps,
@@ -562,8 +488,6 @@ describe('MobilePushPreviewContent', () => {
562
488
  bodyText: 'Body',
563
489
  carouselData: [
564
490
  {
565
- mediaType: 'IMAGE',
566
- imageUrl: 'https://image.url',
567
491
  header: 'Carousel Header',
568
492
  message: 'Message',
569
493
  },
@@ -590,8 +514,6 @@ describe('MobilePushPreviewContent', () => {
590
514
  bodyText: 'Body',
591
515
  carouselData: [
592
516
  {
593
- mediaType: 'IMAGE',
594
- imageUrl: 'https://image.url',
595
517
  title: 'Title',
596
518
  bodyText: 'Carousel Body',
597
519
  },
@@ -602,106 +602,6 @@ describe('CommonTestAndPreview', () => {
602
602
  });
603
603
  });
604
604
 
605
- describe('Mobile push video payload - handleSendTestMessage', () => {
606
- // resetMocks in the jest config wipes the module mock's implementation before each test
607
- beforeEach(() => {
608
- // eslint-disable-next-line global-require
609
- require('../../../utils/cdnTransformation').getCdnUrl.mockImplementation(({ url }) => `cdn_${url}`);
610
- });
611
-
612
- const sendAndGetContent = async (props) => {
613
- render(
614
- <TestWrapper>
615
- <CommonTestAndPreview {...defaultProps} channel={CHANNELS.MOBILEPUSH} {...props} />
616
- </TestWrapper>
617
- );
618
- await waitFor(() => expect(lastSendTestMessageProps).toBeTruthy());
619
- lastSendTestMessageProps.handleSendTestMessage();
620
- const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
621
- return payload.mpushMessageContent;
622
- };
623
-
624
- it('sends a VIDEO style with the raw video url from the edit flow form data', async () => {
625
- const { androidContent, iosContent } = await sendAndGetContent({
626
- formData: [
627
- { 'message-title': 'T', 'message-editor': 'M', image: 'old.jpg', video: 'https://s3/a.mp4' },
628
- { 'message-title2': 'T2', 'message-editor2': 'M2', image: 'ios.jpg', video: '' },
629
- ],
630
- });
631
- expect(androidContent.type).toBe('VIDEO');
632
- expect(androidContent.expandableDetails.style).toBe('VIDEO');
633
- expect(androidContent.expandableDetails.media).toEqual([{ url: 'https://s3/a.mp4', text: '', type: 'VIDEO' }]);
634
- expect(androidContent.expandableDetails.image).toBeUndefined();
635
- expect(iosContent.type).toBe('IMAGE');
636
- expect(iosContent.expandableDetails.style).toBe('BIG_PICTURE');
637
- expect(iosContent.expandableDetails.image).toBe('cdn_ios.jpg');
638
- expect(iosContent.expandableDetails.media).toBeUndefined();
639
- });
640
-
641
- it('reads bodyVideo from the list (three-dots) content, but not for a GIF', async () => {
642
- const { androidContent, iosContent } = await sendAndGetContent({
643
- formData: undefined,
644
- content: {
645
- androidContent: { header: 'T', bodyText: 'M', bodyVideo: { videoSrc: 'https://s3/a.mp4' } },
646
- iosContent: { header: 'T2', bodyText: 'M2', bodyVideo: { videoSrc: 'https://s3/b.gif' }, bodyGif: 'https://s3/b.gif' },
647
- },
648
- });
649
- expect(androidContent.expandableDetails.media).toEqual([{ url: 'https://s3/a.mp4', text: '', type: 'VIDEO' }]);
650
- expect(androidContent.type).toBe('VIDEO');
651
- expect(iosContent.type).toBe('TEXT');
652
- expect(iosContent.expandableDetails.style).toBe('BIG_TEXT');
653
- expect(iosContent.expandableDetails.media).toBeUndefined();
654
- });
655
-
656
- const imageCard = { mediaType: 'image', imageUrl: 'https://s3/1.png', videoSrc: '', buttons: [] };
657
- const videoCard = { mediaType: 'video', imageUrl: '', videoSrc: 'https://s3/2.mp4', buttons: [] };
658
-
659
- it('sends only the media list for carousel cards from the edit flow form data', async () => {
660
- const { androidContent, iosContent } = await sendAndGetContent({
661
- formData: [
662
- { 'message-title': 'T', 'message-editor': 'M', image: '', video: '', carouselData: [imageCard, videoCard] },
663
- { 'message-title2': 'T2', 'message-editor2': 'M2', image: '', video: '', carouselData: [] },
664
- ],
665
- });
666
- expect(androidContent.type).toBe('CAROUSEL');
667
- expect(androidContent.expandableDetails.style).toBe('MANUAL_CAROUSEL');
668
- // carouselData is the editor's format; campaigns saves only media
669
- expect(androidContent.expandableDetails.carouselData).toBeUndefined();
670
- expect(androidContent.expandableDetails.media).toEqual([
671
- { url: 'https://s3/1.png', type: 'IMAGE', text: '' },
672
- { url: 'https://s3/2.mp4', type: 'VIDEO', text: '' },
673
- ]);
674
- expect(iosContent.type).toBe('TEXT');
675
- expect(iosContent.expandableDetails.carouselData).toBeUndefined();
676
- });
677
-
678
- it('sends saved carousel cards from the list (three-dots) content', async () => {
679
- const { iosContent } = await sendAndGetContent({
680
- formData: undefined,
681
- content: {
682
- androidContent: { header: 'T', bodyText: 'M' },
683
- iosContent: { header: 'T2', bodyText: 'M2', carouselData: [videoCard] },
684
- },
685
- });
686
- expect(iosContent.type).toBe('CAROUSEL');
687
- expect(iosContent.expandableDetails.style).toBe('MANUAL_CAROUSEL');
688
- expect(iosContent.expandableDetails.media).toEqual([{ url: 'https://s3/2.mp4', type: 'VIDEO', text: '' }]);
689
- });
690
-
691
- it('sends the saved tap link from campaigns content, carousel included', async () => {
692
- const tapCta = { type: 'EXTERNAL_URL', actionLink: 'https://tap.com' };
693
- const { androidContent, iosContent } = await sendAndGetContent({
694
- formData: {
695
- androidContent: { header: 'T', bodyText: 'M', cta: tapCta },
696
- iosContent: { header: 'T2', bodyText: 'M2', cta: tapCta, carouselData: [imageCard] },
697
- },
698
- });
699
- expect(androidContent.cta).toEqual(tapCta);
700
- expect(iosContent.type).toBe('CAROUSEL');
701
- expect(iosContent.cta).toEqual(tapCta);
702
- });
703
- });
704
-
705
605
  describe('Carousel payload (getCarouselMappedData) - handleSendTestMessage', () => {
706
606
  it('should map empty carouselData to empty cards when mediaType is CAROUSEL', async () => {
707
607
  const props = {
@@ -81,8 +81,7 @@ const tagsTypes = {
81
81
  const errorMessageForTags = {
82
82
  MISSING_TAG_ERROR: 'missingTagsError',
83
83
  GENERIC_VALIDATION_ERROR: 'genericValidationError',
84
- TAG_BRACKET_COUNT_MISMATCH_ERROR: 'tagBracketCountMismatchError',
85
- TAG_DEFAULT_QUOTE_ERROR: 'tagDefaultQuoteError',
84
+ TAG_BRACKET_COUNT_MISMATCH_ERROR: 'tagBracketCountMismatchError'
86
85
  };
87
86
 
88
87
  // Isolated input for EMAIL template-name: only this tiny component re-renders on each keystroke.
@@ -857,11 +856,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
857
856
  if (tagResult.valid) {
858
857
  errorData[count][`sms-editor${index > 1 ? index : ''}`] = false;
859
858
  } else {
860
- const { MISSING_TAG_ERROR, GENERIC_VALIDATION_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags || {};
861
- const { missingTags, isBraceError, isDefaultQuoteError } = tagResult;
862
- let smsEditorError = isDefaultQuoteError ? TAG_DEFAULT_QUOTE_ERROR : GENERIC_VALIDATION_ERROR;
863
- if (isBraceError) smsEditorError = TAG_BRACKET_COUNT_MISMATCH_ERROR;
864
- errorData[count][`sms-editor${index > 1 ? index : ''}`] = missingTags && missingTags.length ? MISSING_TAG_ERROR : smsEditorError;
859
+ const { MISSING_TAG_ERROR, GENERIC_VALIDATION_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags || {};
860
+ const { missingTags, isBraceError } = tagResult;
861
+ errorData[count][`sms-editor${index > 1 ? index : ''}`] = missingTags && missingTags.length ? MISSING_TAG_ERROR : (isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : GENERIC_VALIDATION_ERROR);
865
862
  errorData[count][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
866
863
  isValid = false;
867
864
  }
@@ -995,7 +992,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
995
992
  if(this.props.schema && this.props.schema.channel && this.props.schema.channel.toUpperCase() === "MOBILEPUSH"){
996
993
  let androidValid = true, iosValid = true;
997
994
  let isOnlyAndroid = false, isOnlyIos = false;
998
- const { TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags;
995
+ const { TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
999
996
  const androidData = {};
1000
997
  if (this.state.formData && this.state.formData[0]) {
1001
998
  for(let data in this.state.formData[0]){
@@ -1044,8 +1041,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1044
1041
  if (tagValidationResponse.valid) {
1045
1042
  errorData[parseInt(index)][`message-editor${selector}`] = false;
1046
1043
  } else {
1047
- const { isBraceError, isDefaultQuoteError } = tagValidationResponse;
1048
- errorData[parseInt(index)][`message-editor${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : (isDefaultQuoteError ? TAG_DEFAULT_QUOTE_ERROR : true);
1044
+ const { isBraceError } = tagValidationResponse;
1045
+ errorData[parseInt(index)][`message-editor${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : true;
1049
1046
  errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
1050
1047
  isValid = false;
1051
1048
  }
@@ -1076,8 +1073,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1076
1073
  if (tagValidationResponse.valid) {
1077
1074
  errorData[parseInt(index)][`message-title${selector}`] = false;
1078
1075
  } else {
1079
- const { isBraceError, isDefaultQuoteError } = tagValidationResponse;
1080
- errorData[parseInt(index)][`message-title${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : (isDefaultQuoteError ? TAG_DEFAULT_QUOTE_ERROR : true);
1076
+ const {isBraceError} = tagValidationResponse;
1077
+ errorData[parseInt(index)][`message-title${selector}`] = isBraceError ? TAG_BRACKET_COUNT_MISMATCH_ERROR : true;
1081
1078
  errorData[parseInt(index)][`bracket-error`] = isBraceError && TAG_BRACKET_COUNT_MISMATCH_ERROR;
1082
1079
  isValid = false;
1083
1080
  }
@@ -1361,9 +1358,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1361
1358
  if (tagValidationResponse?.isBraceError){
1362
1359
  errorString += this.props.intl.formatMessage(globalMessages.unbalanacedCurlyBraces);
1363
1360
  }
1364
- if (tagValidationResponse?.isDefaultQuoteError) {
1365
- errorString += this.props.intl.formatMessage(globalMessages.unquotedTagDefaultValue);
1366
- }
1367
1361
  if (tagValidationResponse?.isContentEmpty) {
1368
1362
  errorString += this.props.intl.formatMessage(messages.emailBodyEmptyError);
1369
1363
  // Adds a bypass for cases where content is initially empty in the creation flow.
@@ -2928,7 +2922,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2928
2922
  const errorType = (isVersionEnable ? errorData[`${currentTab - 1}`][val.id] : errorData[val.id]);
2929
2923
  const ifError = checkValidation && errorType;
2930
2924
  const messageContent = isVersionEnable ? formData[`${currentTab - 1}`][val.id] : formData[val.id];
2931
- const { MISSING_TAG_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags;
2925
+ const { MISSING_TAG_ERROR, TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
2932
2926
  const { formatMessage } = this.props.intl;
2933
2927
 
2934
2928
  const aiContentBotDisabled = isAiContentBotDisabled();
@@ -2941,9 +2935,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2941
2935
  case TAG_BRACKET_COUNT_MISMATCH_ERROR:
2942
2936
  errorMessageText = formatMessage(globalMessages.unbalanacedCurlyBraces);
2943
2937
  break;
2944
- case TAG_DEFAULT_QUOTE_ERROR:
2945
- errorMessageText = formatMessage(globalMessages.unquotedTagDefaultValue);
2946
- break;
2947
2938
  case true:
2948
2939
  errorMessageText = formatMessage(messages.genericTagsValidationError);
2949
2940
  break;
@@ -3573,7 +3564,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3573
3564
  const errorType = isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id];
3574
3565
  const aiContentBotDisabled = isAiContentBotDisabled();
3575
3566
  ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
3576
- const { TAG_BRACKET_COUNT_MISMATCH_ERROR, TAG_DEFAULT_QUOTE_ERROR } = errorMessageForTags;
3567
+ const { TAG_BRACKET_COUNT_MISMATCH_ERROR } = errorMessageForTags;
3577
3568
  const { formatMessage } = this.props.intl;
3578
3569
  const value = isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id];
3579
3570
  // Show personalization error for title field inline (same as message textarea) when restrictPersonalization is true
@@ -3581,10 +3572,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3581
3572
  if (hasPersonalizationError) {
3582
3573
  ifError = true;
3583
3574
  }
3584
- let errorMessageText = val.errorMessage && ifError ? val.errorMessage : '';
3585
- if (errorType === TAG_BRACKET_COUNT_MISMATCH_ERROR) errorMessageText = formatMessage(globalMessages.unbalanacedCurlyBraces);
3586
- if (errorType === TAG_DEFAULT_QUOTE_ERROR) errorMessageText = formatMessage(globalMessages.unquotedTagDefaultValue);
3587
- if (hasPersonalizationError) errorMessageText = formatMessage(messages.personalizationTagsErrorMessage);
3575
+ let errorMessageText = hasPersonalizationError
3576
+ ? formatMessage(messages.personalizationTagsErrorMessage)
3577
+ : (errorType === TAG_BRACKET_COUNT_MISMATCH_ERROR ? formatMessage(globalMessages.unbalanacedCurlyBraces) : (val.errorMessage && ifError ? val.errorMessage : ''));
3588
3578
  if (styling === 'semantic') {
3589
3579
  const isEmailStandaloneHighFreq = val.standalone && this.props.schema?.channel?.toUpperCase() === EMAIL;
3590
3580
  if (isEmailStandaloneHighFreq) {
@@ -12,7 +12,6 @@ import { TEMPLATE_NAME_FIELD } from '../../constants';
12
12
  // boolean true). Mirrors errorMessageForTags.TAG_BRACKET_COUNT_MISMATCH_ERROR.
13
13
  export const ERROR_VALUE = {
14
14
  BRACKET: 'tagBracketCountMismatchError',
15
- DEFAULT_QUOTE: 'tagDefaultQuoteError',
16
15
  };
17
16
 
18
17
  // Legacy tab semantics: 1-based currentTab, 1=Android, 2=iOS (Classic.js:483-486).
@@ -69,6 +69,6 @@ export default function getEditorErrorDescriptor(legacyFormData = {}, ctx = {})
69
69
  if (!field?.errorMessage) return null;
70
70
  return {
71
71
  text: field.errorMessage,
72
- kind: [ERROR_VALUE.BRACKET, ERROR_VALUE.DEFAULT_QUOTE].includes(editorError) ? EDITOR_ERROR_KIND.BRACE : EDITOR_ERROR_KIND.MISSING,
72
+ kind: editorError === ERROR_VALUE.BRACKET ? EDITOR_ERROR_KIND.BRACE : EDITOR_ERROR_KIND.MISSING,
73
73
  };
74
74
  }
@@ -5,7 +5,6 @@
5
5
  */
6
6
  import validateMobilePush, { isValidExternalLink } from '../validate';
7
7
  import { ERROR_VALUE } from '../config';
8
- import * as tagValidations from '../../../../../../utils/tagValidations';
9
8
 
10
9
  const baseOptions = { tags: [], isFullMode: true, isEmbedded: false };
11
10
 
@@ -262,62 +261,6 @@ describe('channels/mobilepush/validate', () => {
262
261
  expect(result.platform.androidValid).toBe(true); // NOT cleared, like the editor
263
262
  expect(result.isValid).toBe(false);
264
263
  });
265
-
266
- describe('unquoted tag default value', () => {
267
- afterEach(() => jest.restoreAllMocks());
268
-
269
- it('EDITOR: writes DEFAULT_QUOTE, bracket-error stays false and the tab flag is kept', () => {
270
- const result = validateMobilePush(bothPlatforms({
271
- 0: {
272
- 'message-title': 'hello', 'message-editor': 'hi {{name | default: Rafeeq}}', "base": true, "tabKey": 'k0',
273
- },
274
- }), baseOptions);
275
- expect(result.isValid).toBe(false);
276
- expect(result.errorData[0]['message-editor']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
277
- expect(result.errorData[0]['bracket-error']).toBe(false);
278
- expect(result.platform.androidValid).toBe(true);
279
- });
280
-
281
- it('TITLE: writes DEFAULT_QUOTE and bracket-error stays false', () => {
282
- const result = validateMobilePush(bothPlatforms({
283
- 0: {
284
- 'message-title': 'hi {{name | default: }}', 'message-editor': 'body', "base": true, "tabKey": 'k0',
285
- },
286
- }), baseOptions);
287
- expect(result.isValid).toBe(false);
288
- expect(result.errorData[0]['message-title']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
289
- expect(result.errorData[0]['bracket-error']).toBe(false);
290
- });
291
-
292
- it('iOS tab uses the suffixed ids for DEFAULT_QUOTE', () => {
293
- const result = validateMobilePush(bothPlatforms({
294
- 1: { 'message-title2': "{{a | default: x}}", 'message-editor2': "{{b | default: y}}", "tabKey": 'k1' },
295
- }), baseOptions);
296
- expect(result.errorData[1]['message-editor2']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
297
- expect(result.errorData[1]['message-title2']).toBe(ERROR_VALUE.DEFAULT_QUOTE);
298
- });
299
-
300
- it('quoted default value stays valid', () => {
301
- const result = validateMobilePush(bothPlatforms({
302
- 0: {
303
- 'message-title': "hi {{name | default: 'Rafeeq'}}", 'message-editor': "{{name | default: ''}}", "base": true, "tabKey": 'k0',
304
- },
305
- }), baseOptions);
306
- expect(result.errorData[0]['message-title']).toBe(false);
307
- expect(result.errorData[0]['message-editor']).toBe(false);
308
- });
309
-
310
- it('invalid without brace/quote error (e.g. missing tags) falls back to generic true', () => {
311
- jest.spyOn(tagValidations, 'validateTagsCore').mockReturnValue({
312
- valid: false, missingTags: ['unsubscribe'], isBraceError: false, isDefaultQuoteError: false,
313
- });
314
- const result = validateMobilePush(bothPlatforms(), baseOptions);
315
- expect(result.errorData[0]['message-editor']).toBe(true);
316
- expect(result.errorData[0]['message-title']).toBe(true);
317
- expect(result.errorData[0]['bracket-error']).toBe(false);
318
- expect(result.isValid).toBe(false);
319
- });
320
- });
321
264
  });
322
265
 
323
266
  describe('isValidExternalLink', () => {
@@ -128,8 +128,8 @@ export default function validateMobilePush(formData = {}, options = {}) {
128
128
  if (tagValidation.valid) {
129
129
  tabErrors[`message-editor${suffix}`] = false;
130
130
  } else {
131
- const { isBraceError, isDefaultQuoteError } = tagValidation;
132
- tabErrors[`message-editor${suffix}`] = isBraceError ? ERROR_VALUE.BRACKET : (isDefaultQuoteError ? ERROR_VALUE.DEFAULT_QUOTE : true);
131
+ const { isBraceError } = tagValidation;
132
+ tabErrors[`message-editor${suffix}`] = isBraceError ? ERROR_VALUE.BRACKET : true;
133
133
  tabErrors['bracket-error'] = isBraceError && ERROR_VALUE.BRACKET;
134
134
  isValid = false; // NOTE: isCurrentTabValid deliberately NOT cleared (Classic parity)
135
135
  }
@@ -157,8 +157,8 @@ export default function validateMobilePush(formData = {}, options = {}) {
157
157
  if (tagValidation.valid) {
158
158
  tabErrors[`message-title${suffix}`] = false;
159
159
  } else {
160
- const { isBraceError, isDefaultQuoteError } = tagValidation;
161
- tabErrors[`message-title${suffix}`] = isBraceError ? ERROR_VALUE.BRACKET : (isDefaultQuoteError ? ERROR_VALUE.DEFAULT_QUOTE : true);
160
+ const { isBraceError } = tagValidation;
161
+ tabErrors[`message-title${suffix}`] = isBraceError ? ERROR_VALUE.BRACKET : true;
162
162
  tabErrors['bracket-error'] = isBraceError && ERROR_VALUE.BRACKET;
163
163
  isValid = false; // isCurrentTabValid NOT cleared (Classic parity)
164
164
  }
@@ -34,9 +34,6 @@ export default function getEditorErrorDescriptor(legacyFormData = {}, options =
34
34
  if (tagValidation?.isBraceError) {
35
35
  return { message: globalMessages.unbalanacedCurlyBraces, kind: EDITOR_ERROR_KIND.BRACE };
36
36
  }
37
- if (tagValidation?.isDefaultQuoteError) {
38
- return { message: globalMessages.unquotedTagDefaultValue, kind: EDITOR_ERROR_KIND.BRACE };
39
- }
40
37
  if (tagValidation?.missingTags?.length) {
41
38
  return {
42
39
  message: formMessages.missingTagsValidationError,
@@ -16,11 +16,6 @@ describe('getEditorErrorDescriptor (SMS)', () => {
16
16
  expect(d).toEqual({ message: globalMessages.unbalanacedCurlyBraces, kind: 'brace' });
17
17
  });
18
18
 
19
- it('unquoted default value -> unquotedTagDefaultValue descriptor tagged kind:brace', () => {
20
- const d = getEditorErrorDescriptor(fd('Hi {{full_name | default: Rafeeq}}'), ctx);
21
- expect(d).toEqual({ message: globalMessages.unquotedTagDefaultValue, kind: 'brace' });
22
- });
23
-
24
19
  it('valid content -> null (no error)', () => {
25
20
  expect(getEditorErrorDescriptor(fd('hello world'), ctx)).toBeNull();
26
21
  });
@@ -30,12 +30,6 @@ describe('validateSms', () => {
30
30
  expect(errorData['template-name']).toBe(true);
31
31
  });
32
32
 
33
- it('invalid: unquoted tag default value flags sms-editor with DEFAULT_QUOTE', () => {
34
- const { isValid, errorData } = validateSms(fd({ content: 'Hi {{name | default: Rafeeq}}' }), baseCtx);
35
- expect(isValid).toBe(false);
36
- expect(errorData[0]['sms-editor']).toBe(ERROR.DEFAULT_QUOTE);
37
- });
38
-
39
33
  it('invalid: empty content flags sms-editor with a generic error', () => {
40
34
  const { isValid, errorData } = validateSms(fd({ content: '' }), baseCtx);
41
35
  expect(isValid).toBe(false);