@capillarytech/creatives-library 9.2.1 → 9.2.2-alpha.sprint-cap-214249.44

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 (47) hide show
  1. package/constants/unified.js +0 -1
  2. package/package.json +1 -1
  3. package/utils/common.js +0 -6
  4. package/utils/createMobilePushPayload.js +50 -56
  5. package/utils/tests/createMobilePushPayload.test.js +177 -168
  6. package/v2Components/CapMpushCTA/index.js +47 -57
  7. package/v2Components/CapMpushCTA/index.scss +43 -5
  8. package/v2Components/CapMpushCTA/tests/index.test.js +150 -0
  9. package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +11 -8
  10. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +13 -1
  11. package/v2Components/CommonTestAndPreview/constants.js +2 -0
  12. package/v2Components/CommonTestAndPreview/index.js +51 -12
  13. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +83 -5
  14. package/v2Components/CommonTestAndPreview/tests/index.test.js +100 -0
  15. package/v2Components/MobilePushPreviewV2/_mobilePushPreviewV2.scss +7 -0
  16. package/v2Components/MobilePushPreviewV2/index.js +22 -9
  17. package/v2Components/MobilePushPreviewV2/tests/index.test.js +55 -0
  18. package/v2Components/TemplatePreview/_mobilePushPhone.scss +72 -0
  19. package/v2Components/TemplatePreview/_templatePreview.scss +18 -2
  20. package/v2Components/TemplatePreview/index.js +20 -18
  21. package/v2Components/TemplatePreview/tests/index.test.js +69 -0
  22. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/extractContentForPreview.test.js +45 -0
  23. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +12 -2
  24. package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -6
  25. package/v2Containers/CreativesContainer/index.js +2 -1
  26. package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +43 -0
  27. package/v2Containers/MobilePushNew/components/CtaButtons.js +52 -47
  28. package/v2Containers/MobilePushNew/components/MediaUploaders.js +105 -345
  29. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +127 -105
  30. package/v2Containers/MobilePushNew/components/TapLinkActions.js +76 -0
  31. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +30 -208
  32. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +305 -1482
  33. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +165 -59
  34. package/v2Containers/MobilePushNew/constants.js +12 -0
  35. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +63 -1
  36. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +78 -0
  37. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +40 -1
  38. package/v2Containers/MobilePushNew/hooks/useUpload.js +42 -46
  39. package/v2Containers/MobilePushNew/index.js +498 -289
  40. package/v2Containers/MobilePushNew/index.scss +151 -4
  41. package/v2Containers/MobilePushNew/messages.js +106 -6
  42. package/v2Containers/MobilePushNew/tests/index.test.js +483 -1
  43. package/v2Containers/MobilePushNew/tests/utils.test.js +110 -0
  44. package/v2Containers/MobilePushNew/utils.js +83 -0
  45. package/v2Containers/Templates/_templates.scss +10 -2
  46. package/v2Containers/Templates/index.js +86 -81
  47. package/v2Containers/Templates/tests/index.test.js +81 -0
@@ -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,11 +368,13 @@ describe('MobilePushPreviewContent', () => {
368
368
  bodyText: 'Body',
369
369
  carouselData: [
370
370
  {
371
+ mediaType: 'IMAGE',
371
372
  title: 'Carousel Item 1',
372
373
  message: 'Message 1',
373
374
  imageUrl: 'https://image1.url',
374
375
  },
375
376
  {
377
+ mediaType: 'IMAGE',
376
378
  title: 'Carousel Item 2',
377
379
  message: 'Message 2',
378
380
  imageUrl: 'https://image2.url',
@@ -392,6 +394,78 @@ describe('MobilePushPreviewContent', () => {
392
394
  expect(screen.getByText('Carousel Item 2')).toBeTruthy();
393
395
  });
394
396
 
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
+
395
469
  it('should render carousel with image media type', () => {
396
470
  const props = {
397
471
  ...defaultProps,
@@ -488,6 +562,8 @@ describe('MobilePushPreviewContent', () => {
488
562
  bodyText: 'Body',
489
563
  carouselData: [
490
564
  {
565
+ mediaType: 'IMAGE',
566
+ imageUrl: 'https://image.url',
491
567
  header: 'Carousel Header',
492
568
  message: 'Message',
493
569
  },
@@ -514,6 +590,8 @@ describe('MobilePushPreviewContent', () => {
514
590
  bodyText: 'Body',
515
591
  carouselData: [
516
592
  {
593
+ mediaType: 'IMAGE',
594
+ imageUrl: 'https://image.url',
517
595
  title: 'Title',
518
596
  bodyText: 'Carousel Body',
519
597
  },
@@ -602,6 +602,106 @@ 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
+
605
705
  describe('Carousel payload (getCarouselMappedData) - handleSendTestMessage', () => {
606
706
  it('should map empty carouselData to empty cards when mediaType is CAROUSEL', async () => {
607
707
  const props = {
@@ -0,0 +1,7 @@
1
+ @import '../TemplatePreview/mobilePushPhone';
2
+
3
+ // Saved-template preview (campaigns message summary, creatives template preview).
4
+ // The extra .preview-container outranks TemplatePreview's own `.preview-container #mobilepush-preview` rule.
5
+ .mobile-push-preview-v2 .preview-container #mobilepush-preview.shell-v2 {
6
+ @include mobile-push-phone-shell;
7
+ }
@@ -7,17 +7,27 @@
7
7
  import PropTypes from 'prop-types';
8
8
 
9
9
  import React from 'react';
10
- import { CapTab, CapIcon } from '@capillarytech/cap-ui-library';
10
+ import { CapTab, CapIcon, CapRow } from '@capillarytech/cap-ui-library';
11
11
  import { get, isEmpty} from 'lodash';
12
12
  import TemplatePreview from '../TemplatePreview';
13
13
  import '../PreviewSideBar/_previewsidebar.scss';
14
+ import './_mobilePushPreviewV2.scss';
14
15
  import { MOBILE_PUSH } from '../../v2Containers/CreativesContainer/constants';
15
16
  import { INAPP } from '../../v2Containers/App/constants';
16
17
  import { ANDROID, IOS } from '../../v2Containers/InApp/constants';
17
18
  import { getCtaObject } from '../../v2Containers/InApp/utils';
18
- import { CAROUSEL, VIDEO } from '../../v2Containers/MobilePushNew/constants';
19
+ import {
20
+ CAROUSEL, IMAGE, MANUAL_CAROUSEL, VIDEO,
21
+ } from '../../v2Containers/MobilePushNew/constants';
19
22
  import { DEVICE_TYPES, IPHONE } from './constants';
20
23
 
24
+ // Saved media item -> carousel card in the shape TemplatePreview renders
25
+ const toCarouselCard = ({ type, url } = {}) => ({
26
+ mediaType: type,
27
+ imageUrl: type === IMAGE ? url : '',
28
+ videoSrc: type === VIDEO ? url : '',
29
+ });
30
+
21
31
  class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
22
32
  constructor(props) {
23
33
  super(props);
@@ -92,16 +102,18 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
92
102
  const data = device?.toLowerCase() === "android" ? androidContent : iosContent;
93
103
  const {
94
104
  title = '', message = '', type = '', expandableDetails: {
95
- ctas = [], image = '', media = [], carouselData = [],
105
+ ctas = [], image = '', media = [], carouselData = [], style = '',
96
106
  } = {},
97
107
  } = data || {};
108
+ const isCarousel = style === MANUAL_CAROUSEL || type === CAROUSEL;
98
109
 
99
110
  // Handle video/GIF content from expandableDetails.media array (new format)
100
111
  let bodyVideo = {};
101
112
  let bodyGif = '';
102
113
  let bodyImage = image;
103
114
 
104
- if (media?.length > 0) {
115
+ // A carousel's media are its cards, not a body video
116
+ if (!isCarousel && media?.length > 0) {
105
117
  const mediaItem = media[0];
106
118
  const { type: mediaType, url } = mediaItem;
107
119
  if (mediaType === VIDEO) {
@@ -127,7 +139,8 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
127
139
  bodyGif,
128
140
  actions: [],
129
141
  appName: templateData?.appName,
130
- carouselData,
142
+ // Campaigns drops carouselData on save, so a saved carousel has its cards only in media
143
+ carouselData: (carouselData?.length || !isCarousel) ? carouselData : (media || []).map(toCarouselCard),
131
144
  };
132
145
 
133
146
  // Map CTAs consistently for both Android and iOS
@@ -190,8 +203,8 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
190
203
  }
191
204
  const hasBothAndroidAndIos = hasAndroid && hasIos;
192
205
  return (
193
- <div>
194
- <div className="devices">
206
+ <CapRow useLegacy className="mobile-push-preview-v2">
207
+ <CapRow useLegacy className="devices">
195
208
  {!isEmpty(templateData)
196
209
  && ( hasBothAndroidAndIos ? (
197
210
  <CapTab
@@ -214,8 +227,8 @@ class MobilePushPreviewV2 extends React.Component { // eslint-disable-line react
214
227
  (hasAndroid || hasIos) && this.getPreview(hasAndroid ? 'android' : 'ios')
215
228
  ))
216
229
  }
217
- </div>
218
- </div>
230
+ </CapRow>
231
+ </CapRow>
219
232
  );
220
233
  }
221
234
  }
@@ -0,0 +1,55 @@
1
+ import MobilePushPreviewV2 from '../index';
2
+
3
+ const { setContent } = MobilePushPreviewV2.prototype;
4
+
5
+ // Campaign message as stored: carouselData is dropped on save, cards stay in media
6
+ const savedMessage = {
7
+ androidContent: {
8
+ title: 'Android video',
9
+ message: 'Video body',
10
+ expandableDetails: {
11
+ style: 'VIDEO',
12
+ media: [{ url: 'body.mp4', type: 'VIDEO', text: '' }],
13
+ },
14
+ },
15
+ iosContent: {
16
+ title: 'IOS carousel',
17
+ message: 'Carousel body',
18
+ expandableDetails: {
19
+ style: 'MANUAL_CAROUSEL',
20
+ media: [
21
+ { url: 'card1.jpg', type: 'IMAGE', text: '' },
22
+ { url: 'card2.mp4', type: 'VIDEO', text: '' },
23
+ ],
24
+ },
25
+ },
26
+ };
27
+
28
+ describe('MobilePushPreviewV2 setContent', () => {
29
+ it('builds carousel cards from media for a saved carousel', () => {
30
+ const content = setContent(savedMessage, 'iphone', 'MOBILEPUSH');
31
+ expect(content.carouselData).toEqual([
32
+ { mediaType: 'IMAGE', imageUrl: 'card1.jpg', videoSrc: '' },
33
+ { mediaType: 'VIDEO', imageUrl: '', videoSrc: 'card2.mp4' },
34
+ ]);
35
+ // A video card is not shown as the body video
36
+ expect(content.bodyVideo).toEqual({});
37
+ });
38
+
39
+ it('keeps carouselData when the template still has it', () => {
40
+ const cards = [{ mediaType: 'IMAGE', imageUrl: 'kept.jpg' }];
41
+ const templateData = {
42
+ iosContent: {
43
+ title: 'T',
44
+ expandableDetails: { style: 'MANUAL_CAROUSEL', carouselData: cards, media: [{ url: 'x.jpg', type: 'IMAGE' }] },
45
+ },
46
+ };
47
+ expect(setContent(templateData, 'iphone', 'MOBILEPUSH').carouselData).toEqual(cards);
48
+ });
49
+
50
+ it('shows the first media item as the body video when not a carousel', () => {
51
+ const content = setContent(savedMessage, 'android', 'MOBILEPUSH');
52
+ expect(content.bodyVideo).toEqual({ videoSrc: 'body.mp4', videoPreview: 'body.mp4' });
53
+ expect(content.carouselData).toEqual([]);
54
+ });
55
+ });
@@ -0,0 +1,72 @@
1
+ @import '~@capillarytech/cap-ui-library/styles/_variables';
2
+
3
+ // Mobile push phone preview, matched to the Preview and Test phone.
4
+ // TemplatePreview sets `position: unset` on #mobilepush-preview.shell-v2, so the card was placed
5
+ // against a wider ancestor and spilled out of the phone; this re-anchors it to the phone image.
6
+ // Include on a selector that ends in `#mobilepush-preview.shell-v2`.
7
+ @mixin mobile-push-phone-shell {
8
+ position: relative;
9
+ width: 100%;
10
+ max-width: 26.786rem;
11
+ padding: 0;
12
+
13
+ .preview-image {
14
+ width: 100%;
15
+ }
16
+
17
+ .android-push-message-Container,
18
+ .iphone-push-message-Container {
19
+ left: 4%;
20
+ width: 92%;
21
+
22
+ .message-pop {
23
+ padding: $CAP_SPACE_08;
24
+ border-radius: $CAP_SPACE_08;
25
+ background: $CAP_WHITE;
26
+ line-height: normal;
27
+ }
28
+
29
+ .app-header {
30
+ align-items: center;
31
+ flex-wrap: nowrap;
32
+ }
33
+
34
+ .app-header-left {
35
+ flex: 1 1 auto;
36
+ flex-wrap: nowrap;
37
+ min-width: 0;
38
+
39
+ .app-icon {
40
+ flex: none;
41
+ width: $CAP_SPACE_20;
42
+ height: $CAP_SPACE_20;
43
+ background-color: $CAP_COLOR_16;
44
+ }
45
+ }
46
+
47
+ .title {
48
+ max-width: none;
49
+ min-width: 0;
50
+ font-size: $FONT_SIZE_M;
51
+ font-weight: 600;
52
+ color: $FONT_COLOR_01;
53
+ }
54
+
55
+ .app-header-right {
56
+ flex: none;
57
+ flex-wrap: nowrap;
58
+ margin-left: $CAP_SPACE_08;
59
+ gap: $CAP_SPACE_04;
60
+ font-size: $FONT_SIZE_VS;
61
+ }
62
+
63
+ .body-text {
64
+ padding-left: 2.785rem;
65
+ }
66
+
67
+ // Fixed 18.75rem image + left margin is wider than the card on narrow columns
68
+ .body-image img {
69
+ max-width: calc(100% - 1.571rem);
70
+ }
71
+ }
72
+ }
@@ -627,6 +627,12 @@
627
627
  margin-left: 1.571rem;
628
628
  display: block;
629
629
  }
630
+ // Width leaves room for the left inset, so the video stays inside the card
631
+ .mpush-body-video{
632
+ max-width: calc(100% - 1.5rem);
633
+ max-height: 7.5rem;
634
+ margin-left: 1.5rem;
635
+ }
630
636
  }
631
637
  }
632
638
  .mobile-push-carousel-card {
@@ -745,13 +751,23 @@
745
751
  justify-content: space-between;
746
752
  flex-direction: row;
747
753
  gap: $CAP_SPACE_08;
754
+ width: 100%;
755
+ // One button: centred. Two: equal halves, each centred, split by a divider.
748
756
  .action{
757
+ flex: 1 1 0;
758
+ min-width: 0;
759
+ text-align: center;
760
+ white-space: nowrap;
761
+ overflow: hidden;
762
+ text-overflow: ellipsis;
749
763
  font-size: $FONT_SIZE_S;
750
764
  font-weight: 600;
751
- color: #1970DA;
765
+ color: $FONT_COLOR_01;
752
766
  height: 1.25rem;
753
- text-transform: uppercase;
754
767
  cursor: pointer;
768
+ & + .action {
769
+ border-left: 1px solid $CAP_G07;
770
+ }
755
771
  &:hover {
756
772
  text-decoration: underline;
757
773
  }
@@ -168,14 +168,15 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
168
168
  };
169
169
 
170
170
  renderMobilePushCarousel = (content) => {
171
+ // Every card shows, even before its media is uploaded (an empty card keeps its place)
171
172
  if (!content?.carouselData || content?.carouselData?.length === 0) {
172
173
  return null;
173
174
  }
174
175
 
175
176
  return (
176
177
  <CapRow type="flex" vertical noWrap className="msg-container-carousel mobile-push-carousel-container">
177
- <CapRow className="scroll-container mobile-push-scroll-container">
178
- {content?.carouselData?.map((item, idx) => (
178
+ <CapRow type="flex" noWrap className="scroll-container mobile-push-scroll-container">
179
+ {content.carouselData.map((item, idx) => (
179
180
  <CapColumn
180
181
  key={`carousel-card-${idx}`}
181
182
  className="mobile-push-carousel-card message-pop align-left message-pop-carousel"
@@ -187,10 +188,11 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
187
188
  className="carousel-image"
188
189
  />
189
190
  )}
190
- {item?.mediaType?.toLowerCase() === VIDEO && item?.videoPreviewImg && (
191
+ {item?.mediaType?.toLowerCase() === VIDEO && (item?.videoPreviewImg || item?.videoSrc) && (
191
192
  <CapRow className="video-preview">
193
+ {/* No thumbnail from the upload: same placeholder as WhatsApp/RCS */}
192
194
  <CapImage
193
- src={item?.videoPreviewImg || item?.url}
195
+ src={item?.videoPreviewImg || whatsappVideoEmptyPreview}
194
196
  alt="carousel-video-preview"
195
197
  className="carousel-video-preview"
196
198
  />
@@ -879,10 +881,10 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
879
881
  {(() => {
880
882
  if (content?.bodyVideo?.videoSrc && !content?.bodyImage && !content?.bodyGif) {
881
883
  return (
882
- <video
884
+ <video
883
885
  key={`android-video-${content.bodyVideo.videoSrc}`}
884
- controls
885
- style={{ maxWidth: '100%', maxHeight: '120px', marginLeft: '24px' }}
886
+ controls
887
+ className="mpush-body-video"
886
888
  poster={content?.bodyVideo?.videoPreview || undefined}
887
889
  >
888
890
  <source src={content.bodyVideo.videoSrc} type="video/mp4" />
@@ -907,17 +909,17 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
907
909
  )}
908
910
  {(content?.actions || []).filter((action) => action?.label)
909
911
  .length && content?.carouselData?.length === 0 ? (
910
- <CapRow className="actions">
912
+ <CapRow type="flex" noWrap className="actions">
911
913
  {_.map(
912
914
  content?.actions || [],
913
- (action) =>
915
+ (action, index) =>
914
916
  !!action?.label && (
915
917
  <span
916
918
  className="action"
917
- key={`action-${action?.label}`}
919
+ key={`action-${index}`}
918
920
  title={action?.url || ''}
919
921
  >
920
- {action?.label?.toUpperCase()}
922
+ {action?.label}
921
923
  </span>
922
924
  )
923
925
  )}
@@ -943,10 +945,10 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
943
945
  {(() => {
944
946
  if (content?.bodyVideo?.videoSrc && !content?.bodyImage && !content?.bodyGif) {
945
947
  return (
946
- <video
948
+ <video
947
949
  key={`ios-video-${content?.bodyVideo?.videoSrc}`}
948
- controls
949
- style={{ maxWidth: '100%', maxHeight: '120px', marginLeft: '24px' }}
950
+ controls
951
+ className="mpush-body-video"
950
952
  poster={content?.bodyVideo?.videoPreview || undefined}
951
953
  >
952
954
  <source src={content?.bodyVideo?.videoSrc} type="video/mp4" />
@@ -971,17 +973,17 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
971
973
  )}
972
974
  {(content?.actions || []).filter((action) => action?.label)
973
975
  .length && content?.carouselData?.length === 0 ? (
974
- <CapRow className="actions">
976
+ <CapRow type="flex" noWrap className="actions">
975
977
  {_.map(
976
978
  content?.actions || [],
977
- (action) =>
979
+ (action, index) =>
978
980
  !!action?.label && (
979
981
  <span
980
982
  className="action"
981
- key={`action-${action?.label}`}
983
+ key={`action-${index}`}
982
984
  title={action?.url || ''}
983
985
  >
984
- {action?.label?.toUpperCase()}
986
+ {action?.label}
985
987
  </span>
986
988
  )
987
989
  )}