@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.
- package/containers/App/constants.js +1 -0
- package/containers/Login/index.js +1 -2
- package/package.json +1 -1
- package/services/api.js +5 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -3
- package/tests/integration/TemplateCreation/api-response.js +5 -0
- package/tests/integration/TemplateCreation/msw-handler.js +42 -63
- package/utils/common.js +7 -0
- package/utils/commonUtils.js +2 -6
- package/utils/createMobilePushPayload.js +322 -0
- package/utils/tests/createMobilePushPayload.test.js +1054 -0
- package/v2Components/CapDeviceContent/index.js +1 -1
- package/v2Components/CapImageUpload/index.js +57 -44
- package/v2Components/CapInAppCTA/index.js +1 -0
- package/v2Components/CapMpushCTA/constants.js +25 -0
- package/v2Components/CapMpushCTA/index.js +403 -0
- package/v2Components/CapMpushCTA/index.scss +95 -0
- package/v2Components/CapMpushCTA/messages.js +101 -0
- package/v2Components/CapTagList/index.js +178 -121
- package/v2Components/CapVideoUpload/constants.js +3 -0
- package/v2Components/CapVideoUpload/index.js +182 -115
- package/v2Components/CapVideoUpload/messages.js +16 -0
- package/v2Components/Carousel/index.js +15 -13
- package/v2Components/ErrorInfoNote/style.scss +1 -0
- package/v2Components/MobilePushPreviewV2/index.js +57 -12
- package/v2Components/TemplatePreview/_templatePreview.scss +218 -74
- package/v2Components/TemplatePreview/assets/images/Android_With_date_and_time.svg +29 -0
- package/v2Components/TemplatePreview/assets/images/android.svg +9 -0
- package/v2Components/TemplatePreview/assets/images/iOS_With_date_and_time.svg +26 -0
- package/v2Components/TemplatePreview/assets/images/ios.svg +9 -0
- package/v2Components/TemplatePreview/index.js +234 -107
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +10 -10
- package/v2Containers/CreativesContainer/SlideBoxContent.js +127 -62
- package/v2Containers/CreativesContainer/index.js +193 -136
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -22
- package/v2Containers/InApp/constants.js +1 -0
- package/v2Containers/InApp/index.js +13 -13
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +4748 -4658
- package/v2Containers/Login/index.js +1 -2
- package/v2Containers/MobilePush/Create/index.js +1 -0
- package/v2Containers/MobilePush/commonMethods.js +7 -14
- package/v2Containers/MobilePush/tests/commonMethods.test.js +401 -0
- package/v2Containers/MobilePushNew/actions.js +116 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +183 -0
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +835 -0
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +346 -0
- package/v2Containers/MobilePushNew/components/index.js +5 -0
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +565 -0
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +3180 -0
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +654 -0
- package/v2Containers/MobilePushNew/constants.js +116 -0
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1462 -0
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +1459 -0
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +366 -0
- package/v2Containers/MobilePushNew/hooks/useUpload.js +740 -0
- package/v2Containers/MobilePushNew/index.js +2158 -0
- package/v2Containers/MobilePushNew/index.scss +308 -0
- package/v2Containers/MobilePushNew/messages.js +272 -0
- package/v2Containers/MobilePushNew/reducer.js +160 -0
- package/v2Containers/MobilePushNew/sagas.js +193 -0
- package/v2Containers/MobilePushNew/selectors.js +55 -0
- package/v2Containers/MobilePushNew/tests/reducer.test.js +741 -0
- package/v2Containers/MobilePushNew/tests/sagas.test.js +864 -0
- package/v2Containers/MobilePushNew/tests/selectors.test.js +665 -0
- package/v2Containers/MobilePushNew/tests/utils.test.js +421 -0
- package/v2Containers/MobilePushNew/utils.js +84 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1176 -976
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +684 -424
- package/v2Containers/TagList/index.js +56 -10
- package/v2Containers/Templates/_templates.scss +100 -1
- package/v2Containers/Templates/index.js +170 -31
- package/v2Containers/Templates/messages.js +8 -0
- package/v2Containers/Templates/sagas.js +1 -0
- package/v2Containers/Whatsapp/constants.js +1 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +3992 -3677
- 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/
|
|
70
|
-
const iPhonePushMessagePhone = require('./assets/images/
|
|
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 (<
|
|
267
|
+
return (<CapRow className="actions" key={`action-${action.label}`}>
|
|
219
268
|
<span className="action">{action.label.toUpperCase()}</span>
|
|
220
|
-
</
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
</
|
|
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
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
-
<
|
|
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
|
-
</
|
|
562
|
+
</CapRow>
|
|
513
563
|
)}
|
|
514
|
-
<
|
|
564
|
+
<CapRow
|
|
515
565
|
className={`preview-container ${
|
|
516
566
|
type === "embedded" ? "embedded-preview" : ""
|
|
517
567
|
}`}
|
|
518
568
|
>
|
|
519
569
|
{channel && channel.toLowerCase() === "sms" && (
|
|
520
|
-
<
|
|
521
|
-
<
|
|
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
|
-
<
|
|
528
|
-
<
|
|
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
|
-
</
|
|
541
|
-
</
|
|
542
|
-
</
|
|
590
|
+
</CapRow>
|
|
591
|
+
</CapRow>
|
|
592
|
+
</CapRow>
|
|
543
593
|
{!this.props.showCount && (
|
|
544
|
-
<
|
|
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
|
-
</
|
|
621
|
+
</CapRow>
|
|
572
622
|
)}
|
|
573
|
-
</
|
|
623
|
+
</CapRow>
|
|
574
624
|
)}
|
|
575
625
|
{channel && channel.toLowerCase() === "wechat" ? (
|
|
576
|
-
<
|
|
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
|
-
<
|
|
587
|
-
<
|
|
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
|
-
</
|
|
604
|
-
</
|
|
605
|
-
</
|
|
653
|
+
</CapRow>
|
|
654
|
+
</CapRow>
|
|
655
|
+
</CapRow>
|
|
606
656
|
) : (
|
|
607
657
|
""
|
|
608
658
|
)}
|
|
609
|
-
{channel && channel.
|
|
610
|
-
<
|
|
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
|
-
<
|
|
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
|
-
<
|
|
630
|
-
<
|
|
631
|
-
<
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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
|
|
642
|
-
.length ? (
|
|
643
|
-
<
|
|
723
|
+
{(content?.actions || []).filter((action) => action?.label)
|
|
724
|
+
.length && content?.carouselData?.length === 0 ? (
|
|
725
|
+
<CapRow className="actions">
|
|
644
726
|
{_.map(
|
|
645
|
-
content
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
-
</
|
|
657
|
-
) :
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
</div>
|
|
739
|
+
</CapRow>
|
|
740
|
+
) : null}
|
|
741
|
+
{channel && channel.toLowerCase() === "mobilepush" && this.renderMobilePushCarousel(content)}
|
|
742
|
+
</CapRow>
|
|
661
743
|
) : (
|
|
662
|
-
<
|
|
663
|
-
<
|
|
664
|
-
<
|
|
665
|
-
|
|
666
|
-
<
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
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
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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
|
-
</
|
|
809
|
+
</CapRow>
|
|
683
810
|
)}
|
|
684
|
-
</
|
|
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
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
324
|
+
</CapRow>
|
|
325
325
|
</CapColumn>
|
|
326
326
|
</CapRow>
|
|
327
327
|
`;
|