@capillarytech/creatives-library 8.0.130 → 8.0.131

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 (77) hide show
  1. package/containers/App/constants.js +1 -0
  2. package/containers/Login/index.js +1 -2
  3. package/package.json +1 -1
  4. package/services/api.js +5 -0
  5. package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -3
  6. package/tests/integration/TemplateCreation/api-response.js +5 -0
  7. package/tests/integration/TemplateCreation/msw-handler.js +42 -63
  8. package/utils/common.js +7 -0
  9. package/utils/commonUtils.js +2 -6
  10. package/utils/createMobilePushPayload.js +322 -0
  11. package/utils/tests/createMobilePushPayload.test.js +1054 -0
  12. package/v2Components/CapDeviceContent/index.js +1 -1
  13. package/v2Components/CapImageUpload/index.js +57 -44
  14. package/v2Components/CapInAppCTA/index.js +1 -0
  15. package/v2Components/CapMpushCTA/constants.js +25 -0
  16. package/v2Components/CapMpushCTA/index.js +403 -0
  17. package/v2Components/CapMpushCTA/index.scss +95 -0
  18. package/v2Components/CapMpushCTA/messages.js +101 -0
  19. package/v2Components/CapTagList/index.js +178 -121
  20. package/v2Components/CapVideoUpload/constants.js +3 -0
  21. package/v2Components/CapVideoUpload/index.js +182 -115
  22. package/v2Components/CapVideoUpload/messages.js +16 -0
  23. package/v2Components/Carousel/index.js +15 -13
  24. package/v2Components/ErrorInfoNote/style.scss +1 -0
  25. package/v2Components/MobilePushPreviewV2/index.js +57 -12
  26. package/v2Components/TemplatePreview/_templatePreview.scss +218 -74
  27. package/v2Components/TemplatePreview/assets/images/Android_With_date_and_time.svg +29 -0
  28. package/v2Components/TemplatePreview/assets/images/android.svg +9 -0
  29. package/v2Components/TemplatePreview/assets/images/iOS_With_date_and_time.svg +26 -0
  30. package/v2Components/TemplatePreview/assets/images/ios.svg +9 -0
  31. package/v2Components/TemplatePreview/index.js +234 -107
  32. package/v2Components/TemplatePreview/messages.js +4 -0
  33. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +10 -10
  34. package/v2Containers/CreativesContainer/SlideBoxContent.js +127 -62
  35. package/v2Containers/CreativesContainer/index.js +193 -136
  36. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -22
  37. package/v2Containers/InApp/constants.js +1 -0
  38. package/v2Containers/InApp/index.js +13 -13
  39. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +4748 -4658
  40. package/v2Containers/Login/index.js +1 -2
  41. package/v2Containers/MobilePush/Create/index.js +1 -0
  42. package/v2Containers/MobilePush/commonMethods.js +7 -14
  43. package/v2Containers/MobilePush/tests/commonMethods.test.js +401 -0
  44. package/v2Containers/MobilePushNew/actions.js +116 -0
  45. package/v2Containers/MobilePushNew/components/CtaButtons.js +183 -0
  46. package/v2Containers/MobilePushNew/components/MediaUploaders.js +835 -0
  47. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +346 -0
  48. package/v2Containers/MobilePushNew/components/index.js +5 -0
  49. package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +565 -0
  50. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +3180 -0
  51. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +654 -0
  52. package/v2Containers/MobilePushNew/constants.js +116 -0
  53. package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1462 -0
  54. package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +1459 -0
  55. package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +366 -0
  56. package/v2Containers/MobilePushNew/hooks/useUpload.js +740 -0
  57. package/v2Containers/MobilePushNew/index.js +2158 -0
  58. package/v2Containers/MobilePushNew/index.scss +308 -0
  59. package/v2Containers/MobilePushNew/messages.js +272 -0
  60. package/v2Containers/MobilePushNew/reducer.js +160 -0
  61. package/v2Containers/MobilePushNew/sagas.js +193 -0
  62. package/v2Containers/MobilePushNew/selectors.js +55 -0
  63. package/v2Containers/MobilePushNew/tests/reducer.test.js +741 -0
  64. package/v2Containers/MobilePushNew/tests/sagas.test.js +864 -0
  65. package/v2Containers/MobilePushNew/tests/selectors.test.js +665 -0
  66. package/v2Containers/MobilePushNew/tests/utils.test.js +421 -0
  67. package/v2Containers/MobilePushNew/utils.js +84 -0
  68. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1176 -976
  69. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +684 -424
  70. package/v2Containers/TagList/index.js +56 -10
  71. package/v2Containers/Templates/_templates.scss +100 -1
  72. package/v2Containers/Templates/index.js +170 -31
  73. package/v2Containers/Templates/messages.js +8 -0
  74. package/v2Containers/Templates/sagas.js +1 -0
  75. package/v2Containers/Whatsapp/constants.js +1 -0
  76. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +3992 -3677
  77. package/assets/loading_img.gif +0 -0
@@ -32,6 +32,7 @@ import {
32
32
  RCS,
33
33
  ZALO,
34
34
  INAPP,
35
+ MOBILE_PUSH
35
36
  } from '../../v2Containers/CreativesContainer/constants';
36
37
  import Carousel from '../Carousel';
37
38
  import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
@@ -55,6 +56,7 @@ import WhatsappStatusContainer from '../WhatsappStatusContainer';
55
56
  import { getWhatsappQuickReply, getWhatsappCarouselButtonView } from '../../v2Containers/Whatsapp/utils';
56
57
  import { QUICK_REPLY, WHATSAPP_CATEGORIES, PHONE_NUMBER } from '../../v2Containers/Whatsapp/constants';
57
58
  import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
59
+ import { CAROUSEL } from '../../v2Containers/MobilePushNew/constants';
58
60
 
59
61
  const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
60
62
  const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
@@ -66,8 +68,8 @@ const viberMobileAndroid = require('./assets/images/viberMobile.svg');
66
68
  const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
67
69
  const lineStickerPlaceholder = require('../../assets/smiley-placeholder.svg');
68
70
  const lineVideoPlaceholder = require('../../assets/rich-video-placeholder.svg');
69
- const androidPushMessagePhone = require('./assets/images/androidPushMessage.svg');
70
- const iPhonePushMessagePhone = require('./assets/images/iPhonePushMessage.svg');
71
+ const androidPushMessagePhone = require('./assets/images/Android_With_date_and_time.svg');
72
+ const iPhonePushMessagePhone = require('./assets/images/iOS_With_date_and_time.svg');
71
73
 
72
74
  export class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
73
75
  onPreviewContentClicked = (channel) => {
@@ -167,6 +169,53 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
167
169
  this.props.onTestContentClicked(params);
168
170
  };
169
171
 
172
+ renderMobilePushCarousel = (content) => {
173
+ if (!content?.carouselData || content?.carouselData?.length === 0) {
174
+ return null;
175
+ }
176
+
177
+ return (
178
+ <CapRow className="msg-container-carousel mobile-push-carousel-container">
179
+ <CapRow className="scroll-container mobile-push-scroll-container">
180
+ {content?.carouselData?.map((item, idx) => (
181
+ <CapColumn
182
+ key={`carousel-card-${idx}`}
183
+ className="mobile-push-carousel-card message-pop align-left message-pop-carousel"
184
+ >
185
+ {item?.mediaType === IMAGE.toLowerCase() && item?.imageUrl && (
186
+ <CapImage
187
+ src={item?.imageUrl}
188
+ alt="carousel-img"
189
+ className="carousel-image"
190
+ />
191
+ )}
192
+ {item?.mediaType === VIDEO.toLowerCase() && item?.videoPreviewImg && (
193
+ <CapRow className="video-preview">
194
+ <CapImage
195
+ src={item?.videoPreviewImg}
196
+ alt="carousel-video-preview"
197
+ className="carousel-video-preview"
198
+ />
199
+ <CapRow className="icon-position">
200
+ <CapImage className="video-icon" src={videoPlay} />
201
+ </CapRow>
202
+ </CapRow>
203
+ )}
204
+ <CapRow className="carousel-content">
205
+ <CapLabel className="carousel-title">
206
+ {item?.title || item?.header || ""}
207
+ </CapLabel>
208
+ <CapLabel className="carousel-message">
209
+ {item?.message || item?.bodyText || ""}
210
+ </CapLabel>
211
+ </CapRow>
212
+ </CapColumn>
213
+ ))}
214
+ </CapRow>
215
+ </CapRow>
216
+ );
217
+ };
218
+
170
219
  render() {
171
220
  const {
172
221
  channel,
@@ -213,11 +262,11 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
213
262
  const type = this.props.location && this.props.location.query.type ? this.props.location.query.type : '';
214
263
  let iosActions = [];
215
264
  if ((channel || '').toLowerCase() === "mobilepush") {
216
- iosActions = _.map(content.actions, (action) => {
265
+ iosActions = _.map(content.actions || [], (action) => {
217
266
  if (action.label) {
218
- return (<div className="actions" key={`action-${action.label}`}>
267
+ return (<CapRow className="actions" key={`action-${action.label}`}>
219
268
  <span className="action">{action.label.toUpperCase()}</span>
220
- </div>);
269
+ </CapRow>);
221
270
  }
222
271
  return undefined;
223
272
  });
@@ -270,7 +319,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
270
319
  actionUrl,
271
320
  sectionStyle,
272
321
  }) => (
273
- <div
322
+ <CapRow
274
323
  className="message-pop align-left"
275
324
  style={{
276
325
  ...sectionStyle,
@@ -291,7 +340,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
291
340
  <video style={{ opacity: 0.5, width: '100%' }}>
292
341
  <source src={video} type="video/mp4" />
293
342
  </video>
294
- <div
343
+ <CapRow
295
344
  style={{
296
345
  position: 'absolute',
297
346
  display: 'flex',
@@ -318,7 +367,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
318
367
  )
319
368
  : null
320
369
  }
321
- </div>
370
+ </CapRow>
322
371
  </>
323
372
  )
324
373
  : (
@@ -334,7 +383,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
334
383
  />
335
384
  )
336
385
  }
337
- </div>
386
+ </CapRow>
338
387
  );
339
388
 
340
389
  const renderWhatsappCtaPreview = () => {
@@ -410,31 +459,32 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
410
459
  handlePreviewInNewTab(templatePreviewUrl);
411
460
  };
412
461
 
413
- const getPreviewImage = () => {
414
- if (this.props.device === ANDROID) {
415
- switch (templateLayoutType) {
416
- case INAPP_MESSAGE_LAYOUT_TYPES.MODAL:
417
- return inAppMobileAndroidModal;
418
- case INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER:
419
- return inAppMobileAndroidTop;
420
- case INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER:
421
- return inAppMobileAndroidBottom;
422
- default:
423
- return inAppMobileAndroidFull;
424
- }
425
- } else {
426
- switch (templateLayoutType) {
427
- case INAPP_MESSAGE_LAYOUT_TYPES.MODAL:
428
- return inAppMobileIOSModal;
429
- case INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER:
430
- return inAppMobileIOSTop;
431
- case INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER:
432
- return inAppMobileIOSBottom;
433
- default:
434
- return inAppMobileIOSFull;
435
- }
462
+ const getPreviewImage = () => {
463
+ if (this.props.device === ANDROID) {
464
+ switch (templateLayoutType) {
465
+ case INAPP_MESSAGE_LAYOUT_TYPES.MODAL:
466
+ return inAppMobileAndroidModal;
467
+ case INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER:
468
+ return inAppMobileAndroidTop;
469
+ case INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER:
470
+ return inAppMobileAndroidBottom;
471
+ default:
472
+ return inAppMobileAndroidFull;
436
473
  }
437
- };
474
+ } else {
475
+ switch (templateLayoutType) {
476
+ case INAPP_MESSAGE_LAYOUT_TYPES.MODAL:
477
+ return inAppMobileIOSModal;
478
+ case INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER:
479
+ return inAppMobileIOSTop;
480
+ case INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER:
481
+ return inAppMobileIOSBottom;
482
+ default:
483
+ return inAppMobileIOSFull;
484
+ }
485
+ }
486
+ };
487
+
438
488
  const whatsappUpdatedAccountName = whatsappAccountName || templateData?.versions?.base?.content?.whatsapp?.accountName || '';
439
489
  const whatsappUpdatedLen = whatsappContentLen !== undefined ? whatsappContentLen : content?.charCount;
440
490
  return (
@@ -480,7 +530,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
480
530
  )}
481
531
  <CapColumn span={this.props.showCount ? 8 : 24}>
482
532
  {showTestAndPreview && (
483
- <div className="test-and-preview-container">
533
+ <CapRow className="test-and-preview-container">
484
534
  <CapButton
485
535
  style={{
486
536
  color: "#2466ea",
@@ -509,23 +559,23 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
509
559
  <CapIcon type="lab" />
510
560
  <FormattedMessage {...messages.testMessage} />
511
561
  </CapButton>
512
- </div>
562
+ </CapRow>
513
563
  )}
514
- <div
564
+ <CapRow
515
565
  className={`preview-container ${
516
566
  type === "embedded" ? "embedded-preview" : ""
517
567
  }`}
518
568
  >
519
569
  {channel && channel.toLowerCase() === "sms" && (
520
- <div>
521
- <div className="shell-v2 align-center" id="sms-preview">
570
+ <CapRow>
571
+ <CapRow className="shell-v2 align-center" id="sms-preview">
522
572
  <CapImage
523
573
  className="preview-image sms"
524
574
  src={smsMobileAndroid}
525
575
  alt={this.props.intl.formatMessage(messages.previewGenerated)}
526
576
  />
527
- <div className="msg-container sms">
528
- <div className={"message-pop sms"}>
577
+ <CapRow className="msg-container sms">
578
+ <CapRow className={"message-pop sms"}>
529
579
  {content &&
530
580
  content.length &&
531
581
  content.map((msg, index) => (
@@ -537,11 +587,11 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
537
587
  {msg}
538
588
  </CapColumn>
539
589
  ))}
540
- </div>
541
- </div>
542
- </div>
590
+ </CapRow>
591
+ </CapRow>
592
+ </CapRow>
543
593
  {!this.props.showCount && (
544
- <div>
594
+ <CapRow>
545
595
  <CapColumn className="character-count-col" span={22}>
546
596
  {(channel || "").toLowerCase() === "sms" && (
547
597
  <CapHeading type="h3">
@@ -568,12 +618,12 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
568
618
  </CapHeading>
569
619
  )}
570
620
  </CapColumn>
571
- </div>
621
+ </CapRow>
572
622
  )}
573
- </div>
623
+ </CapRow>
574
624
  )}
575
625
  {channel && channel.toLowerCase() === "wechat" ? (
576
- <div className="shell-v2 align-center" id="sms-preview">
626
+ <CapRow className="shell-v2 align-center" id="sms-preview">
577
627
  <CapImage
578
628
  className="preview-image"
579
629
  src={
@@ -583,8 +633,8 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
583
633
  }
584
634
  alt={this.props.intl.formatMessage(messages.previewGenerated)}
585
635
  />
586
- <div className="msg-container wechat">
587
- <div
636
+ <CapRow className="msg-container wechat">
637
+ <CapRow
588
638
  className="message-pop align-left"
589
639
  style={{
590
640
  background: `${
@@ -600,14 +650,14 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
600
650
  }}
601
651
  >
602
652
  {content}
603
- </div>
604
- </div>
605
- </div>
653
+ </CapRow>
654
+ </CapRow>
655
+ </CapRow>
606
656
  ) : (
607
657
  ""
608
658
  )}
609
- {channel && channel.toLowerCase() === "mobilepush" && (
610
- <div className="shell-v2 align-center" id="mobilepush-preview">
659
+ {channel && channel.toUpperCase() === MOBILE_PUSH && (
660
+ <CapRow className="shell-v2 align-center" id="mobilepush-preview">
611
661
  <CapImage
612
662
  className="preview-image"
613
663
  src={
@@ -619,69 +669,146 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
619
669
  />
620
670
  {(!!content.header ||
621
671
  !!content.bodyText ||
622
- !!content.bodyImage) && (
623
- <div
672
+ !!content.bodyImage || !!content.bodyVideo?.videoSrc || !!content.bodyGif) && (
673
+ <CapRow
624
674
  className={`${
625
675
  this.props.device === "ios" ? "iphone" : this.props.device
626
676
  }-push-message-Container`}
627
677
  >
628
678
  {this.props.device === "android" ? (
629
- <div className="message-pop align-left">
630
- <div className="app-name">
631
- <span className="app-icon"></span>{" "}
632
- {content.appName ? content.appName : "App name"}
633
- </div>
634
- <div className="title">{content.header}</div>
635
- <div className="body-text">{content.bodyText}</div>
636
- {content.bodyImage && (
637
- <div className="body-image">
638
- <CapImage src={content.bodyImage} alt="" />
639
- </div>
679
+ <CapRow className="message-pop align-left">
680
+ <CapRow className="app-header">
681
+ <CapRow className="app-header-left">
682
+ <span className="app-icon">{""}</span>
683
+ <CapLabel className="title">{content.header}</CapLabel>
684
+ </CapRow>
685
+ <CapRow className="app-header-right">
686
+ <span>2:29 PM</span>
687
+ <CapIcon type="chevron-down" size="sm" />
688
+ </CapRow>
689
+ </CapRow>
690
+ <CapLabel className="body-text">{content.bodyText}</CapLabel>
691
+ {(content.bodyImage || content?.bodyVideo?.videoSrc || content?.bodyGif) && (
692
+ <CapRow className="body-image">
693
+ {(() => {
694
+ if (content?.bodyVideo?.videoSrc && !content?.bodyImage && !content?.bodyGif) {
695
+ return (
696
+ <video
697
+ key={`android-video-${content.bodyVideo.videoSrc}`}
698
+ controls
699
+ style={{ maxWidth: '100%', maxHeight: '120px', marginLeft: '24px' }}
700
+ poster={content?.bodyVideo?.videoPreview || undefined}
701
+ >
702
+ <source src={content.bodyVideo.videoSrc} type="video/mp4" />
703
+ {formatMessage(messages.videoNotSupported)}
704
+ </video>
705
+ );
706
+ } else if (content?.bodyGif) {
707
+ return (
708
+ <img
709
+ src={content?.bodyGif}
710
+ alt="GIF preview"
711
+ style={{ maxWidth: '100%', maxHeight: '120px' }}
712
+ key={`android-gif-${content?.bodyGif}`}
713
+ />
714
+ );
715
+ } else {
716
+ return (
717
+ <CapImage src={content?.bodyImage || content?.bodyVideo?.videoPreview} alt="" />
718
+ );
719
+ }
720
+ })()}
721
+ </CapRow>
640
722
  )}
641
- {content.actions.filter((action) => action.label)
642
- .length ? (
643
- <div className="actions">
723
+ {(content?.actions || []).filter((action) => action?.label)
724
+ .length && content?.carouselData?.length === 0 ? (
725
+ <CapRow className="actions">
644
726
  {_.map(
645
- content.actions,
646
- (action) =>
647
- !!action.label && (
648
- <span
649
- className="action"
650
- key={`action-${action.label}`}
651
- >
652
- {action.label && action.label.toUpperCase()}
653
- </span>
654
- )
727
+ content?.actions || [],
728
+ (action) =>
729
+ !!action?.label && (
730
+ <span
731
+ className="action"
732
+ key={`action-${action?.label}`}
733
+ title={action?.url || ''}
734
+ >
735
+ {action?.label?.toUpperCase()}
736
+ </span>
737
+ )
655
738
  )}
656
- </div>
657
- ) : (
658
- ""
659
- )}
660
- </div>
739
+ </CapRow>
740
+ ) : null}
741
+ {channel && channel.toLowerCase() === "mobilepush" && this.renderMobilePushCarousel(content)}
742
+ </CapRow>
661
743
  ) : (
662
- <div className="message-pop align-left">
663
- <div className="app-name">
664
- <span className="app-icon"></span>
665
- {content.appName ? content.appName : "App name"}{" "}
666
- <i className="material-icons">
667
- {this.props.intl.formatMessage(messages.close)}
668
- </i>
669
- </div>
670
- {content.bodyImage && (
671
- <div className="body-image">
672
- <CapImage src={content.bodyImage} alt="" />
673
- </div>
744
+ <CapRow className="message-pop align-left">
745
+ <CapRow className="app-header">
746
+ <CapRow className="app-header-left">
747
+ <span className="app-icon">{""}</span>
748
+ <CapLabel className="title">{content.header}</CapLabel>
749
+ </CapRow>
750
+ <CapRow className="app-header-right">
751
+ <span>2:29 PM</span>
752
+ <CapIcon type="chevron-down" size="sm" />
753
+ </CapRow>
754
+ </CapRow>
755
+ <CapLabel className="body-text">{content.bodyText}</CapLabel>
756
+ {(content?.bodyImage || content?.bodyVideo?.videoSrc || content?.bodyGif) && (
757
+ <CapRow className="body-image">
758
+ {(() => {
759
+ if (content?.bodyVideo?.videoSrc && !content?.bodyImage && !content?.bodyGif) {
760
+ return (
761
+ <video
762
+ key={`ios-video-${content?.bodyVideo?.videoSrc}`}
763
+ controls
764
+ style={{ maxWidth: '100%', maxHeight: '120px', marginLeft: '24px' }}
765
+ poster={content?.bodyVideo?.videoPreview || undefined}
766
+ >
767
+ <source src={content?.bodyVideo?.videoSrc} type="video/mp4" />
768
+ {formatMessage(messages.videoNotSupported)}
769
+ </video>
770
+ );
771
+ } else if (content?.bodyGif) {
772
+ return (
773
+ <img
774
+ src={content?.bodyGif}
775
+ alt="GIF preview"
776
+ style={{ maxWidth: '100%', maxHeight: '120px' }}
777
+ key={`ios-gif-${content?.bodyGif}`}
778
+ />
779
+ );
780
+ } else {
781
+ return (
782
+ <CapImage src={content?.bodyImage || content?.bodyVideo?.videoPreview} alt="" />
783
+ );
784
+ }
785
+ })()}
786
+ </CapRow>
674
787
  )}
675
- <div className="title">{content.header}</div>
676
- <div className="body-text">{content.bodyText}</div>
677
- {content.actions.filter((action) => action.label).length
678
- ? iosActions
679
- : ""}
680
- </div>
788
+ {(content?.actions || []).filter((action) => action?.label)
789
+ .length && content?.carouselData?.length === 0 ? (
790
+ <CapRow className="actions">
791
+ {_.map(
792
+ content?.actions || [],
793
+ (action) =>
794
+ !!action?.label && (
795
+ <span
796
+ className="action"
797
+ key={`action-${action?.label}`}
798
+ title={action?.url || ''}
799
+ >
800
+ {action?.label?.toUpperCase()}
801
+ </span>
802
+ )
803
+ )}
804
+ </CapRow>
805
+ ) : null}
806
+ {channel && channel.toLowerCase() === "mobilepush" && this.renderMobilePushCarousel(content)}
807
+ </CapRow>
681
808
  )}
682
- </div>
809
+ </CapRow>
683
810
  )}
684
- </div>
811
+ </CapRow>
685
812
  )}
686
813
  {channel && channel.toLowerCase() === "line" ? (
687
814
  <div className="shell-v2 align-center" id="sms-preview">
@@ -719,7 +846,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
719
846
  {this.props.LineAccountName}
720
847
  </div>
721
848
  <>
722
- {content.map((item) => {
849
+ {content?.map((item) => {
723
850
  const {
724
851
  type,
725
852
  messageContent,
@@ -1280,7 +1407,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
1280
1407
  </div>
1281
1408
  </div>
1282
1409
  )}
1283
- </div>
1410
+ </CapRow>
1284
1411
  </CapColumn>
1285
1412
  </CapRow>
1286
1413
  );
@@ -90,4 +90,8 @@ export default defineMessages({
90
90
  id: `creatives.componentsV2.TemplatePreview.addToCart`,
91
91
  defaultMessage: 'Add to cart',
92
92
  },
93
+ videoNotSupported: {
94
+ id: 'creatives.componentsV2.TemplatePreview.videoNotSupported',
95
+ defaultMessage: 'Your browser does not support the video tag.',
96
+ },
93
97
  });
@@ -5,7 +5,7 @@ exports[`Test Templates container Should render correct preview component for rc
5
5
  <CapColumn
6
6
  span={24}
7
7
  >
8
- <div
8
+ <CapRow
9
9
  className="preview-container "
10
10
  >
11
11
  <div
@@ -38,7 +38,7 @@ exports[`Test Templates container Should render correct preview component for rc
38
38
  </div>
39
39
  </div>
40
40
  </div>
41
- </div>
41
+ </CapRow>
42
42
  </CapColumn>
43
43
  </CapRow>
44
44
  `;
@@ -48,7 +48,7 @@ exports[`Test Templates container Should render correct preview component for wh
48
48
  <CapColumn
49
49
  span={24}
50
50
  >
51
- <div
51
+ <CapRow
52
52
  className="preview-container "
53
53
  >
54
54
  <div
@@ -135,7 +135,7 @@ exports[`Test Templates container Should render correct preview component for wh
135
135
  }
136
136
  />
137
137
  </CapHeading>
138
- </div>
138
+ </CapRow>
139
139
  </CapColumn>
140
140
  </CapRow>
141
141
  `;
@@ -145,7 +145,7 @@ exports[`Test Templates container Should render correct preview component for wh
145
145
  <CapColumn
146
146
  span={24}
147
147
  >
148
- <div
148
+ <CapRow
149
149
  className="preview-container "
150
150
  >
151
151
  <div
@@ -207,7 +207,7 @@ exports[`Test Templates container Should render correct preview component for wh
207
207
  }
208
208
  />
209
209
  </CapHeading>
210
- </div>
210
+ </CapRow>
211
211
  </CapColumn>
212
212
  </CapRow>
213
213
  `;
@@ -217,7 +217,7 @@ exports[`Test Templates container Should render correct preview component for wh
217
217
  <CapColumn
218
218
  span={24}
219
219
  >
220
- <div
220
+ <CapRow
221
221
  className="preview-container "
222
222
  >
223
223
  <div
@@ -274,7 +274,7 @@ exports[`Test Templates container Should render correct preview component for wh
274
274
  }
275
275
  />
276
276
  </CapHeading>
277
- </div>
277
+ </CapRow>
278
278
  </CapColumn>
279
279
  </CapRow>
280
280
  `;
@@ -284,7 +284,7 @@ exports[`Test Templates container Should render correct preview component for za
284
284
  <CapColumn
285
285
  span={24}
286
286
  >
287
- <div
287
+ <CapRow
288
288
  className="preview-container "
289
289
  >
290
290
  <CapRow
@@ -321,7 +321,7 @@ exports[`Test Templates container Should render correct preview component for za
321
321
  </CapLabel>
322
322
  </CapRow>
323
323
  </CapRow>
324
- </div>
324
+ </CapRow>
325
325
  </CapColumn>
326
326
  </CapRow>
327
327
  `;