@capillarytech/creatives-library 7.17.91 → 7.17.92
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/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/services/api.js +5 -0
- package/v2Components/CapDeviceContent/index.js +338 -0
- package/v2Components/CapDeviceContent/index.scss +115 -0
- package/v2Components/CapDeviceContent/messages.js +107 -0
- package/v2Components/CapDeviceContent/tests/index.test.js +75 -0
- package/v2Components/CapImageUpload/index.js +10 -3
- package/v2Components/CapImageUpload/messages.js +4 -0
- package/v2Components/CapInAppCTA/constants.js +25 -0
- package/v2Components/CapInAppCTA/index.js +281 -0
- package/v2Components/CapInAppCTA/index.scss +93 -0
- package/v2Components/CapInAppCTA/messages.js +85 -0
- package/v2Components/MobilePushPreviewV2/index.js +81 -23
- package/v2Components/TemplatePreview/_templatePreview.scss +448 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_bottom.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_full.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_modal.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_top.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_bottom.svg +6 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_full.svg +18 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_modal.svg +7 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_top.svg +13 -0
- package/v2Components/TemplatePreview/index.js +660 -375
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/App/constants.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -1
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +94 -27
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/InApp/actions.js +64 -0
- package/v2Containers/InApp/constants.js +95 -0
- package/v2Containers/InApp/index.js +745 -0
- package/v2Containers/InApp/index.scss +47 -0
- package/v2Containers/InApp/messages.js +86 -0
- package/v2Containers/InApp/reducer.js +109 -0
- package/v2Containers/InApp/sagas.js +143 -0
- package/v2Containers/InApp/selectors.js +12 -0
- package/v2Containers/InApp/tests/action.test.js +53 -0
- package/v2Containers/InApp/tests/index.test.js +152 -0
- package/v2Containers/InApp/tests/mockData.js +897 -0
- package/v2Containers/InApp/tests/reducer.test.js +177 -0
- package/v2Containers/InApp/tests/sagas.test.js +391 -0
- package/v2Containers/Templates/_templates.scss +7 -0
- package/v2Containers/Templates/index.js +103 -23
- package/v2Containers/Templates/messages.js +20 -0
- package/v2Containers/TemplatesV2/index.js +8 -2
- package/v2Containers/TemplatesV2/messages.js +4 -0
|
@@ -19,11 +19,20 @@ import {
|
|
|
19
19
|
WECHAT,
|
|
20
20
|
WHATSAPP,
|
|
21
21
|
RCS,
|
|
22
|
-
ZALO
|
|
22
|
+
ZALO,
|
|
23
|
+
INAPP,
|
|
23
24
|
} from '../../v2Containers/CreativesContainer/constants';
|
|
24
25
|
import Carousel from '../Carousel';
|
|
25
26
|
import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
|
|
26
27
|
import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg';
|
|
28
|
+
import inAppMobileAndroidModal from './assets/images/inapp_mobile_android_modal.svg';
|
|
29
|
+
import inAppMobileAndroidTop from './assets/images/inapp_mobile_android_top.svg';
|
|
30
|
+
import inAppMobileAndroidBottom from './assets/images/inapp_mobile_android_bottom.svg';
|
|
31
|
+
import inAppMobileAndroidFull from './assets/images/inapp_mobile_android_full.svg';
|
|
32
|
+
import inAppMobileIOSModal from './assets/images/inapp_mobile_ios_modal.svg';
|
|
33
|
+
import inAppMobileIOSTop from './assets/images/inapp_mobile_ios_top.svg';
|
|
34
|
+
import inAppMobileIOSBottom from './assets/images/inapp_mobile_ios_bottom.svg';
|
|
35
|
+
import inAppMobileIOSFull from './assets/images/inapp_mobile_ios_full.svg';
|
|
27
36
|
import videoPlay from '../../assets/videoPlay.svg';
|
|
28
37
|
import zaloMessage from '../../v2Containers/Zalo/messages';
|
|
29
38
|
import { handlePreviewInNewTab } from '../../utils/common';
|
|
@@ -49,13 +58,13 @@ import {
|
|
|
49
58
|
CAP_PURPLE01,
|
|
50
59
|
CAP_G16,
|
|
51
60
|
CAP_SPACE_08,
|
|
52
|
-
CAP_SPACE_16,
|
|
53
61
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
54
62
|
import { TEMPLATE, IMAGE_CAROUSEL, IMAGE, STICKER, TEXT, IMAGE_MAP, VIDEO } from '../../v2Containers/Line/Container/constants';
|
|
55
63
|
import CapFacebookPreview from '../../v2Containers/CapFacebookPreview';
|
|
56
64
|
import WhatsappStatusContainer from '../WhatsappStatusContainer';
|
|
57
65
|
import { getWhatsappQuickReply } from '../../v2Containers/Whatsapp/utils';
|
|
58
66
|
import { QUICK_REPLY } from '../../v2Containers/Whatsapp/constants';
|
|
67
|
+
import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
|
|
59
68
|
|
|
60
69
|
export class TemplatePreview extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
61
70
|
onPreviewContentClicked = (channel) => {
|
|
@@ -164,17 +173,20 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
164
173
|
viberAccountName,
|
|
165
174
|
whatsappAccountName,
|
|
166
175
|
whatsappContentLen,
|
|
176
|
+
inAppAccountName,
|
|
167
177
|
intl,
|
|
168
178
|
templateData,
|
|
169
179
|
rcsIosPreview,
|
|
170
180
|
hideTestAndPreviewBtn,
|
|
171
181
|
hasJPLocaleHideFeatureEnabled,
|
|
182
|
+
templateLayoutType,
|
|
183
|
+
device,
|
|
172
184
|
} = this.props;
|
|
173
185
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
174
|
-
|
|
175
186
|
const { formatMessage } = intl;
|
|
176
|
-
const { buttonText, imageURL, rcsPreviewContent, messageContent: viberMessageContent } = content || {};
|
|
187
|
+
const { buttonText, imageURL, rcsPreviewContent, inAppPreviewContent, messageContent: viberMessageContent } = content || {};
|
|
177
188
|
const { rcsImageSrc, rcsTitle, rcsDesc, buttonText: rcsButtonText } = rcsPreviewContent || {};
|
|
189
|
+
const {mediaPreview = {}, templateTitle = "", templateMsg = "", ctaData} = inAppPreviewContent || {};
|
|
178
190
|
let smsDetails = {};
|
|
179
191
|
// let smsText = '';
|
|
180
192
|
if (this.props.content && this.props.charCounterEnabled) {
|
|
@@ -380,183 +392,316 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
380
392
|
handlePreviewInNewTab(templatePreviewUrl);
|
|
381
393
|
};
|
|
382
394
|
|
|
395
|
+
const getPreviewImage = () => {
|
|
396
|
+
if (this.props.device === ANDROID) {
|
|
397
|
+
switch (templateLayoutType) {
|
|
398
|
+
case INAPP_MESSAGE_LAYOUT_TYPES.MODAL:
|
|
399
|
+
return inAppMobileAndroidModal;
|
|
400
|
+
case INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER:
|
|
401
|
+
return inAppMobileAndroidTop;
|
|
402
|
+
case INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER:
|
|
403
|
+
return inAppMobileAndroidBottom;
|
|
404
|
+
default:
|
|
405
|
+
return inAppMobileAndroidFull;
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
switch (templateLayoutType) {
|
|
409
|
+
case INAPP_MESSAGE_LAYOUT_TYPES.MODAL:
|
|
410
|
+
return inAppMobileIOSModal;
|
|
411
|
+
case INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER:
|
|
412
|
+
return inAppMobileIOSTop;
|
|
413
|
+
case INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER:
|
|
414
|
+
return inAppMobileIOSBottom;
|
|
415
|
+
default:
|
|
416
|
+
return inAppMobileIOSFull;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
};
|
|
383
420
|
const whatsappUpdatedAccountName = whatsappAccountName || templateData?.versions?.base?.content?.whatsapp?.accountName || '';
|
|
384
421
|
const whatsappUpdatedLen = whatsappContentLen !== undefined ? whatsappContentLen : content?.charCount;
|
|
385
|
-
|
|
386
422
|
return (
|
|
387
423
|
<CapRow>
|
|
388
|
-
{this.props.showCount &&
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
{
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
424
|
+
{this.props.showCount &&
|
|
425
|
+
channel &&
|
|
426
|
+
channel.toLowerCase() !== FACEBOOK && (
|
|
427
|
+
<CapColumn span={16}>
|
|
428
|
+
{channel && channel.toLowerCase() === "sms" && (
|
|
429
|
+
<CapHeading type="h3">
|
|
430
|
+
<FormattedMessage
|
|
431
|
+
{...messages.charactersTotal}
|
|
432
|
+
values={{
|
|
433
|
+
smsCount: smsDetails.parts,
|
|
434
|
+
charCount: smsDetails.chars_used,
|
|
435
|
+
}}
|
|
436
|
+
/>
|
|
437
|
+
{smsDetails.unicode && (
|
|
438
|
+
<FormattedMessage {...messages.smsFormatType} />
|
|
439
|
+
)}
|
|
440
|
+
</CapHeading>
|
|
441
|
+
)}
|
|
442
|
+
{smsDetails.optoutUrlPresent && (
|
|
443
|
+
<CapHeading type="h6">
|
|
444
|
+
<FormattedMessage
|
|
445
|
+
{...messages.optoutCharactersTotal}
|
|
446
|
+
values={{ optoutUrlLength: smsDetails.optouturlLength }}
|
|
447
|
+
/>
|
|
448
|
+
</CapHeading>
|
|
449
|
+
)}
|
|
450
|
+
{channel?.toLowerCase() === WHATSAPP.toLowerCase() ? (
|
|
451
|
+
<>
|
|
452
|
+
<WhatsappStatusContainer template={templateData} />
|
|
453
|
+
<CapHeading type="h3" className="margin-t-12">
|
|
454
|
+
<FormattedMessage
|
|
455
|
+
{...messages.whatsappMessageLength}
|
|
456
|
+
values={{ length: whatsappUpdatedLen }}
|
|
457
|
+
/>
|
|
458
|
+
</CapHeading>
|
|
459
|
+
</>
|
|
460
|
+
) : null}
|
|
461
|
+
</CapColumn>
|
|
462
|
+
)}
|
|
410
463
|
<CapColumn span={this.props.showCount ? 8 : 24}>
|
|
411
464
|
{showTestAndPreview && (
|
|
412
465
|
<div className="test-and-preview-container">
|
|
413
466
|
<CapButton
|
|
414
467
|
style={{
|
|
415
|
-
color:
|
|
416
|
-
display:
|
|
417
|
-
padding:
|
|
418
|
-
marginTop:
|
|
468
|
+
color: "#2466ea",
|
|
469
|
+
display: "inline-block",
|
|
470
|
+
padding: "0 6px",
|
|
471
|
+
marginTop: "12px",
|
|
419
472
|
}}
|
|
420
473
|
type="flat"
|
|
421
474
|
onClick={() => this.onPreviewContentClicked(this.props.channel)}
|
|
422
475
|
disabled={disablePreviewAndTest}
|
|
423
476
|
>
|
|
424
|
-
<CapIcon type="eye"
|
|
477
|
+
<CapIcon type="eye" />
|
|
478
|
+
<FormattedMessage {...messages.preview} />
|
|
425
479
|
</CapButton>
|
|
426
480
|
<CapButton
|
|
427
481
|
style={{
|
|
428
|
-
color:
|
|
429
|
-
display:
|
|
430
|
-
padding:
|
|
431
|
-
marginTop:
|
|
482
|
+
color: "#2466ea",
|
|
483
|
+
display: "inline-block",
|
|
484
|
+
padding: "0 6px",
|
|
485
|
+
marginTop: "12px",
|
|
432
486
|
}}
|
|
433
487
|
type="flat"
|
|
434
488
|
onClick={() => this.onTestContentClicked(this.props.channel)}
|
|
435
489
|
disabled={disablePreviewAndTest}
|
|
436
490
|
>
|
|
437
|
-
<CapIcon type="lab"
|
|
491
|
+
<CapIcon type="lab" />
|
|
492
|
+
<FormattedMessage {...messages.testMessage} />
|
|
438
493
|
</CapButton>
|
|
439
494
|
</div>
|
|
440
495
|
)}
|
|
441
|
-
<div
|
|
442
|
-
{
|
|
496
|
+
<div
|
|
497
|
+
className={`preview-container ${
|
|
498
|
+
type === "embedded" ? "embedded-preview" : ""
|
|
499
|
+
}`}
|
|
500
|
+
>
|
|
501
|
+
{channel && channel.toLowerCase() === "sms" && (
|
|
443
502
|
<div>
|
|
444
503
|
<div className="shell-v2 align-center" id="sms-preview">
|
|
445
|
-
<CapImage
|
|
504
|
+
<CapImage
|
|
505
|
+
className="preview-image sms"
|
|
506
|
+
src={smsMobileAndroid}
|
|
507
|
+
alt="Preview is being generated"
|
|
508
|
+
/>
|
|
446
509
|
<div className="msg-container sms">
|
|
447
510
|
<div className={"message-pop sms"}>
|
|
448
|
-
{content &&
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
511
|
+
{content &&
|
|
512
|
+
content.length &&
|
|
513
|
+
content.map((msg, index) => (
|
|
514
|
+
<CapColumn
|
|
515
|
+
key={`"message-pop-content-${index}`}
|
|
516
|
+
className="message-pop-item align-left"
|
|
517
|
+
style={{ background: "#FFFFFF", color: "#091e42" }}
|
|
518
|
+
>
|
|
519
|
+
{msg}
|
|
520
|
+
</CapColumn>
|
|
521
|
+
))}
|
|
453
522
|
</div>
|
|
454
523
|
</div>
|
|
455
524
|
</div>
|
|
456
|
-
{!this.props.showCount &&
|
|
457
|
-
<
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
525
|
+
{!this.props.showCount && (
|
|
526
|
+
<div>
|
|
527
|
+
<CapColumn className="character-count-col" span={22}>
|
|
528
|
+
{(channel || "").toLowerCase() === "sms" && (
|
|
529
|
+
<CapHeading type="h3">
|
|
530
|
+
<FormattedMessage
|
|
531
|
+
{...messages.charactersTotal}
|
|
532
|
+
values={{
|
|
533
|
+
smsCount: smsDetails.parts,
|
|
534
|
+
charCount: smsDetails.chars_used,
|
|
535
|
+
}}
|
|
536
|
+
/>
|
|
537
|
+
{smsDetails.unicode && (
|
|
538
|
+
<FormattedMessage {...messages.smsFormatType} />
|
|
539
|
+
)}
|
|
540
|
+
</CapHeading>
|
|
541
|
+
)}
|
|
542
|
+
{smsDetails.optoutUrlPresent && (
|
|
543
|
+
<CapHeading type="h6" className="optout-tag-heading">
|
|
544
|
+
<FormattedMessage
|
|
545
|
+
{...messages.optoutCharactersTotal}
|
|
546
|
+
values={{
|
|
547
|
+
optoutUrlLength: smsDetails.optouturlLength,
|
|
548
|
+
}}
|
|
549
|
+
/>
|
|
550
|
+
</CapHeading>
|
|
551
|
+
)}
|
|
552
|
+
</CapColumn>
|
|
553
|
+
</div>
|
|
554
|
+
)}
|
|
469
555
|
</div>
|
|
470
|
-
}
|
|
471
|
-
{channel && channel.toLowerCase() ===
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
556
|
+
)}
|
|
557
|
+
{channel && channel.toLowerCase() === "wechat" ? (
|
|
558
|
+
<div className="shell-v2 align-center" id="sms-preview">
|
|
559
|
+
<CapImage
|
|
560
|
+
className="preview-image"
|
|
561
|
+
src={
|
|
562
|
+
(channel || "").toLowerCase() === "wechat"
|
|
563
|
+
? wechatBodyNew
|
|
564
|
+
: smsMobileAndroid
|
|
565
|
+
}
|
|
566
|
+
alt="Preview is being generated"
|
|
567
|
+
/>
|
|
568
|
+
<div className="msg-container wechat">
|
|
569
|
+
<div
|
|
570
|
+
className="message-pop align-left"
|
|
571
|
+
style={{
|
|
572
|
+
background: `${
|
|
573
|
+
this.props.channel.toLowerCase() === "wechat"
|
|
574
|
+
? "#ffffff"
|
|
575
|
+
: "#3F51B5"
|
|
576
|
+
}`,
|
|
577
|
+
color: `${
|
|
578
|
+
this.props.channel.toLowerCase() === "wechat"
|
|
579
|
+
? "#333333"
|
|
580
|
+
: "#ffffff"
|
|
581
|
+
}`,
|
|
582
|
+
}}
|
|
583
|
+
>
|
|
584
|
+
{content}
|
|
585
|
+
</div>
|
|
476
586
|
</div>
|
|
477
587
|
</div>
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
{
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
588
|
+
) : (
|
|
589
|
+
""
|
|
590
|
+
)}
|
|
591
|
+
{channel && channel.toLowerCase() === "mobilepush" && (
|
|
592
|
+
<div className="shell-v2 align-center" id="mobilepush-preview">
|
|
593
|
+
<CapImage
|
|
594
|
+
className="preview-image"
|
|
595
|
+
src={
|
|
596
|
+
this.props.device === "android"
|
|
597
|
+
? androidPushMessagePhone
|
|
598
|
+
: iPhonePushMessagePhone
|
|
599
|
+
}
|
|
600
|
+
alt={this.props.intl.formatMessage(messages.previewGenerated)}
|
|
601
|
+
/>
|
|
602
|
+
{(!!content.header ||
|
|
603
|
+
!!content.bodyText ||
|
|
604
|
+
!!content.bodyImage) && (
|
|
605
|
+
<div
|
|
606
|
+
className={`${
|
|
607
|
+
this.props.device === "ios" ? "iphone" : this.props.device
|
|
608
|
+
}-push-message-Container`}
|
|
609
|
+
>
|
|
610
|
+
{this.props.device === "android" ? (
|
|
611
|
+
<div className="message-pop align-left">
|
|
612
|
+
<div className="app-name">
|
|
613
|
+
<span className="app-icon"></span>{" "}
|
|
614
|
+
{content.appName ? content.appName : "App name"}
|
|
615
|
+
</div>
|
|
616
|
+
<div className="title">{content.header}</div>
|
|
617
|
+
<div className="body-text">{content.bodyText}</div>
|
|
618
|
+
{content.bodyImage && (
|
|
619
|
+
<div className="body-image">
|
|
620
|
+
<CapImage src={content.bodyImage} alt="" />
|
|
621
|
+
</div>
|
|
622
|
+
)}
|
|
623
|
+
{content.actions.filter((action) => action.label)
|
|
624
|
+
.length ? (
|
|
625
|
+
<div className="actions">
|
|
626
|
+
{_.map(
|
|
627
|
+
content.actions,
|
|
628
|
+
(action) =>
|
|
629
|
+
!!action.label && (
|
|
630
|
+
<span
|
|
631
|
+
className="action"
|
|
632
|
+
key={`action-${action.label}`}
|
|
633
|
+
>
|
|
634
|
+
{action.label && action.label.toUpperCase()}
|
|
635
|
+
</span>
|
|
636
|
+
)
|
|
637
|
+
)}
|
|
638
|
+
</div>
|
|
639
|
+
) : (
|
|
640
|
+
""
|
|
641
|
+
)}
|
|
517
642
|
</div>
|
|
518
|
-
|
|
519
|
-
|
|
643
|
+
) : (
|
|
644
|
+
<div className="message-pop align-left">
|
|
645
|
+
<div className="app-name">
|
|
646
|
+
<span className="app-icon"></span>
|
|
647
|
+
{content.appName ? content.appName : "App name"}{" "}
|
|
648
|
+
<i className="material-icons">
|
|
649
|
+
{this.props.intl.formatMessage(messages.close)}
|
|
650
|
+
</i>
|
|
651
|
+
</div>
|
|
652
|
+
{content.bodyImage && (
|
|
653
|
+
<div className="body-image">
|
|
654
|
+
<CapImage src={content.bodyImage} alt="" />
|
|
655
|
+
</div>
|
|
656
|
+
)}
|
|
657
|
+
<div className="title">{content.header}</div>
|
|
658
|
+
<div className="body-text">{content.bodyText}</div>
|
|
659
|
+
{content.actions.filter((action) => action.label).length
|
|
660
|
+
? iosActions
|
|
661
|
+
: ""}
|
|
520
662
|
</div>
|
|
521
|
-
|
|
522
|
-
|
|
663
|
+
)}
|
|
664
|
+
</div>
|
|
665
|
+
)}
|
|
666
|
+
</div>
|
|
667
|
+
)}
|
|
668
|
+
{channel && channel.toLowerCase() === "line" ? (
|
|
669
|
+
<div className="shell-v2 align-center" id="sms-preview">
|
|
670
|
+
<CapImage
|
|
671
|
+
className="preview-image"
|
|
672
|
+
src={
|
|
673
|
+
hasJPLocaleHideFeatureEnabled
|
|
674
|
+
? lineMobileAndroidJapaneseImg
|
|
675
|
+
: lineMobileAndroidDefaultImg
|
|
523
676
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
</div>
|
|
527
|
-
)
|
|
528
|
-
}
|
|
529
|
-
{
|
|
530
|
-
channel && channel.toLowerCase() === 'line' ? (
|
|
531
|
-
<div className="shell-v2 align-center" id="sms-preview">
|
|
532
|
-
<CapImage className="preview-image" src={hasJPLocaleHideFeatureEnabled ? lineMobileAndroidJapaneseImg : lineMobileAndroidDefaultImg} alt={this.props.intl.formatMessage(messages.previewGenerated)}/>
|
|
533
|
-
<div
|
|
534
|
-
className="msg-container line-preview"
|
|
535
|
-
style={{
|
|
536
|
-
maxHeight: 330,
|
|
537
|
-
overflow: 'auto',
|
|
538
|
-
flexDirection: 'column',
|
|
539
|
-
marginLeft: 40,
|
|
540
|
-
left: !this.props.showCount && '200px',
|
|
541
|
-
}}
|
|
542
|
-
>
|
|
677
|
+
alt={this.props.intl.formatMessage(messages.previewGenerated)}
|
|
678
|
+
/>
|
|
543
679
|
<div
|
|
544
|
-
className="
|
|
680
|
+
className="msg-container line-preview"
|
|
545
681
|
style={{
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
background: CAP_COLOR_03,
|
|
552
|
-
paddingRight: 5,
|
|
682
|
+
maxHeight: 330,
|
|
683
|
+
overflow: "auto",
|
|
684
|
+
flexDirection: "column",
|
|
685
|
+
marginLeft: 40,
|
|
686
|
+
left: !this.props.showCount && "200px",
|
|
553
687
|
}}
|
|
554
688
|
>
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
689
|
+
<div
|
|
690
|
+
className="sms-icon"
|
|
691
|
+
style={{
|
|
692
|
+
left: 0,
|
|
693
|
+
top: 8,
|
|
694
|
+
borderRadius: "50%",
|
|
695
|
+
width: 20,
|
|
696
|
+
height: 20,
|
|
697
|
+
background: CAP_COLOR_03,
|
|
698
|
+
paddingRight: 5,
|
|
699
|
+
}}
|
|
700
|
+
>
|
|
701
|
+
{this.props.LineAccountName}
|
|
702
|
+
</div>
|
|
703
|
+
<>
|
|
704
|
+
{content.map((item) => {
|
|
560
705
|
const {
|
|
561
706
|
type,
|
|
562
707
|
messageContent,
|
|
@@ -573,12 +718,12 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
573
718
|
background: CAP_WHITE,
|
|
574
719
|
color: FONT_COLOR_01,
|
|
575
720
|
borderRadius: 8,
|
|
576
|
-
position:
|
|
577
|
-
margin:
|
|
578
|
-
height:
|
|
579
|
-
minHeight:
|
|
580
|
-
overflow:
|
|
581
|
-
maxHeight:
|
|
721
|
+
position: "static",
|
|
722
|
+
margin: "6px 0 20px 28px",
|
|
723
|
+
height: "auto",
|
|
724
|
+
minHeight: "auto",
|
|
725
|
+
overflow: "initial",
|
|
726
|
+
maxHeight: "initial",
|
|
582
727
|
};
|
|
583
728
|
if (type === TEXT) {
|
|
584
729
|
return (
|
|
@@ -586,20 +731,22 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
586
731
|
className="message-pop align-left"
|
|
587
732
|
style={sectionStyle}
|
|
588
733
|
>
|
|
589
|
-
<p style={{ marginBottom: 5 }}>
|
|
734
|
+
<p style={{ marginBottom: 5 }}>
|
|
735
|
+
{messageContent || ""}
|
|
736
|
+
</p>
|
|
590
737
|
</div>
|
|
591
738
|
);
|
|
592
739
|
}
|
|
593
|
-
if (
|
|
740
|
+
if (type === IMAGE && previewImageUrl) {
|
|
594
741
|
return (
|
|
595
742
|
<div
|
|
596
743
|
className="message-pop align-left"
|
|
597
744
|
style={{
|
|
598
745
|
...sectionStyle,
|
|
599
746
|
minHeight: 184,
|
|
600
|
-
display:
|
|
601
|
-
justifyContent:
|
|
602
|
-
alignItems:
|
|
747
|
+
display: "flex",
|
|
748
|
+
justifyContent: "center",
|
|
749
|
+
alignItems: "center",
|
|
603
750
|
}}
|
|
604
751
|
>
|
|
605
752
|
<CapImage
|
|
@@ -607,7 +754,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
607
754
|
alt="brand-name"
|
|
608
755
|
rest={{
|
|
609
756
|
style: {
|
|
610
|
-
maxWidth:
|
|
757
|
+
maxWidth: "100%",
|
|
611
758
|
marginBottom: 5,
|
|
612
759
|
},
|
|
613
760
|
}}
|
|
@@ -616,11 +763,19 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
616
763
|
);
|
|
617
764
|
}
|
|
618
765
|
if (type === VIDEO) {
|
|
619
|
-
return getVideoContent({
|
|
766
|
+
return getVideoContent({
|
|
767
|
+
video,
|
|
768
|
+
actionUrl,
|
|
769
|
+
sectionStyle,
|
|
770
|
+
});
|
|
620
771
|
}
|
|
621
|
-
if (
|
|
772
|
+
if (type === IMAGE_MAP && baseUrl) {
|
|
622
773
|
if (video) {
|
|
623
|
-
return getVideoContent({
|
|
774
|
+
return getVideoContent({
|
|
775
|
+
video,
|
|
776
|
+
actionUrl,
|
|
777
|
+
sectionStyle,
|
|
778
|
+
});
|
|
624
779
|
}
|
|
625
780
|
return (
|
|
626
781
|
<div
|
|
@@ -628,17 +783,19 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
628
783
|
style={{
|
|
629
784
|
...sectionStyle,
|
|
630
785
|
minHeight: 184,
|
|
631
|
-
display:
|
|
632
|
-
justifyContent:
|
|
633
|
-
alignItems:
|
|
786
|
+
display: "flex",
|
|
787
|
+
justifyContent: "center",
|
|
788
|
+
alignItems: "center",
|
|
634
789
|
}}
|
|
635
790
|
>
|
|
636
791
|
<CapImage
|
|
637
|
-
src={
|
|
792
|
+
src={
|
|
793
|
+
baseUrl ? `${baseUrl}/1040` : lineImgPlaceholder
|
|
794
|
+
}
|
|
638
795
|
alt="brand-name"
|
|
639
796
|
rest={{
|
|
640
797
|
style: {
|
|
641
|
-
maxWidth:
|
|
798
|
+
maxWidth: "100%",
|
|
642
799
|
marginBottom: 5,
|
|
643
800
|
},
|
|
644
801
|
}}
|
|
@@ -652,265 +809,311 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
652
809
|
className="message-pop align-left"
|
|
653
810
|
style={{
|
|
654
811
|
...sectionStyle,
|
|
655
|
-
background:
|
|
656
|
-
display:
|
|
657
|
-
justifyContent:
|
|
658
|
-
alignItems:
|
|
812
|
+
background: "transparent",
|
|
813
|
+
display: "flex",
|
|
814
|
+
justifyContent: "center",
|
|
815
|
+
alignItems: "center",
|
|
659
816
|
}}
|
|
660
817
|
>
|
|
661
818
|
<CapImage
|
|
662
819
|
src={selectedSticker.stickerUrl}
|
|
663
|
-
style={{maxWidth:
|
|
820
|
+
style={{ maxWidth: "100%", marginBottom: 5 }}
|
|
664
821
|
rest={{
|
|
665
822
|
style: {
|
|
666
|
-
maxWidth:
|
|
823
|
+
maxWidth: "100%",
|
|
667
824
|
marginBottom: 5,
|
|
668
825
|
},
|
|
669
826
|
height: 70,
|
|
670
|
-
onMouseOut: (e) =>
|
|
671
|
-
|
|
827
|
+
onMouseOut: (e) =>
|
|
828
|
+
(e.currentTarget.src =
|
|
829
|
+
selectedSticker.stickerUrl),
|
|
830
|
+
onMouseOver: (e) =>
|
|
831
|
+
(e.currentTarget.src =
|
|
832
|
+
selectedSticker.animatedStickerUrl ||
|
|
833
|
+
selectedSticker.stickerUrl),
|
|
672
834
|
}}
|
|
673
835
|
/>
|
|
674
836
|
</div>
|
|
675
837
|
);
|
|
676
838
|
}
|
|
677
|
-
if (
|
|
839
|
+
if (
|
|
840
|
+
(type === IMAGE_CAROUSEL ||
|
|
841
|
+
type === TEMPLATE ||
|
|
842
|
+
type === "template") &&
|
|
843
|
+
imageCarousel
|
|
844
|
+
) {
|
|
678
845
|
return (
|
|
679
846
|
<div
|
|
680
847
|
style={{
|
|
681
|
-
margin:
|
|
848
|
+
margin: "6px 0 20px 28px",
|
|
682
849
|
}}
|
|
683
850
|
>
|
|
684
|
-
<Carousel imageCarousel={imageCarousel}/>
|
|
851
|
+
<Carousel imageCarousel={imageCarousel} />
|
|
685
852
|
</div>
|
|
686
853
|
);
|
|
687
854
|
}
|
|
688
855
|
return null;
|
|
689
|
-
})
|
|
690
|
-
|
|
691
|
-
|
|
856
|
+
})}
|
|
857
|
+
</>
|
|
858
|
+
</div>
|
|
859
|
+
{renderLineMultiText(content)}
|
|
692
860
|
</div>
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
marginLeft: 28,
|
|
707
|
-
}}
|
|
708
|
-
>
|
|
861
|
+
) : (
|
|
862
|
+
""
|
|
863
|
+
)}
|
|
864
|
+
{channel && channel.toLowerCase() === VIBER ? (
|
|
865
|
+
<div className="shell-v2 align-center" id="sms-preview">
|
|
866
|
+
<CapImage
|
|
867
|
+
className="preview-image"
|
|
868
|
+
src={viberMobileAndroid}
|
|
869
|
+
alt={this.props.intl.formatMessage(messages.previewGenerated)}
|
|
870
|
+
/>
|
|
871
|
+
<div style={{ position: "absolute", top: "12%", left: "36%" }}>
|
|
872
|
+
{viberBrandName}
|
|
873
|
+
</div>
|
|
709
874
|
<div
|
|
710
|
-
className="
|
|
875
|
+
className="msg-container viber-preview"
|
|
711
876
|
style={{
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
"margin": '0 4px 277px 0',
|
|
715
|
-
'border-radius': '4px',
|
|
716
|
-
'background-color': CAP_PURPLE01,
|
|
717
|
-
'font-size': '12px',
|
|
718
|
-
'font-weight': 900,
|
|
719
|
-
"color": CAP_WHITE,
|
|
877
|
+
maxHeight: 292,
|
|
878
|
+
marginLeft: 28,
|
|
720
879
|
}}
|
|
721
880
|
>
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
<div
|
|
725
|
-
className="message-pop align-left"
|
|
726
|
-
style={viberSectionStyle}>
|
|
727
|
-
{/* Text Viber preview */}
|
|
728
|
-
<p
|
|
881
|
+
<div
|
|
882
|
+
className="sms-icon"
|
|
729
883
|
style={{
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
alt="brand-name"
|
|
739
|
-
rest={{
|
|
740
|
-
style: {
|
|
741
|
-
maxWidth: '100%',
|
|
742
|
-
marginBottom: 5,
|
|
743
|
-
},
|
|
884
|
+
width: 20,
|
|
885
|
+
height: 20,
|
|
886
|
+
margin: "0 4px 277px 0",
|
|
887
|
+
"border-radius": "4px",
|
|
888
|
+
"background-color": CAP_PURPLE01,
|
|
889
|
+
"font-size": "12px",
|
|
890
|
+
"font-weight": 900,
|
|
891
|
+
color: CAP_WHITE,
|
|
744
892
|
}}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
'text-align': 'center',
|
|
754
|
-
"width": '140px',
|
|
755
|
-
"height": '20px',
|
|
756
|
-
"margin-left": "8px",
|
|
757
|
-
}}>
|
|
893
|
+
>
|
|
894
|
+
{viberAccountName}
|
|
895
|
+
</div>
|
|
896
|
+
<div
|
|
897
|
+
className="message-pop align-left"
|
|
898
|
+
style={viberSectionStyle}
|
|
899
|
+
>
|
|
900
|
+
{/* Text Viber preview */}
|
|
758
901
|
<p
|
|
759
|
-
style={{
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
902
|
+
style={{
|
|
903
|
+
"font-size": "10px",
|
|
904
|
+
color: CAP_G16,
|
|
905
|
+
margin: "1.5px 6px 1px 7px",
|
|
906
|
+
}}
|
|
907
|
+
>
|
|
908
|
+
{viberMessageContent || ""}
|
|
909
|
+
</p>
|
|
910
|
+
{/* Image Viber preview */}
|
|
911
|
+
{imageURL && (
|
|
912
|
+
<CapImage
|
|
913
|
+
src={imageURL}
|
|
914
|
+
alt="brand-name"
|
|
915
|
+
rest={{
|
|
916
|
+
style: {
|
|
917
|
+
maxWidth: "100%",
|
|
918
|
+
marginBottom: 5,
|
|
919
|
+
},
|
|
920
|
+
}}
|
|
921
|
+
/>
|
|
922
|
+
)}
|
|
923
|
+
{/* button viber preview */}
|
|
924
|
+
{buttonText && (
|
|
925
|
+
<div
|
|
926
|
+
style={{
|
|
927
|
+
"border-radius": "16px",
|
|
928
|
+
"background-color": CAP_PURPLE01,
|
|
929
|
+
"margin-top": "14px",
|
|
930
|
+
"text-align": "center",
|
|
931
|
+
width: "140px",
|
|
932
|
+
height: "20px",
|
|
933
|
+
"margin-left": "8px",
|
|
934
|
+
}}
|
|
766
935
|
>
|
|
767
|
-
|
|
936
|
+
<p
|
|
937
|
+
style={{
|
|
938
|
+
"font-size": "12px",
|
|
939
|
+
"font-weight": "500",
|
|
940
|
+
display: "-webkit-box",
|
|
941
|
+
"-webkit-line-clamp": "1",
|
|
942
|
+
"-webkit-box-orient": "vertical",
|
|
943
|
+
overflow: "hidden",
|
|
944
|
+
color: CAP_WHITE,
|
|
945
|
+
}}
|
|
946
|
+
>
|
|
947
|
+
{buttonText || ""}
|
|
948
|
+
</p>
|
|
949
|
+
</div>
|
|
950
|
+
)}
|
|
951
|
+
<div style={{ paddingBottom: 32 }}></div>
|
|
768
952
|
</div>
|
|
769
|
-
}
|
|
770
|
-
<div style={{ paddingBottom: 32}}></div>
|
|
771
953
|
</div>
|
|
772
|
-
|
|
773
954
|
</div>
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
{
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
<
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
<div
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
955
|
+
) : (
|
|
956
|
+
""
|
|
957
|
+
)}
|
|
958
|
+
{channel?.toUpperCase() === WHATSAPP ? (
|
|
959
|
+
<>
|
|
960
|
+
<div className="shell-v2 align-center">
|
|
961
|
+
<CapImage
|
|
962
|
+
className="preview-image"
|
|
963
|
+
src={whatsappMobileAndroid}
|
|
964
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
965
|
+
/>
|
|
966
|
+
<CapLabel className="whatsapp-brand-name">
|
|
967
|
+
{whatsappUpdatedAccountName || ""}
|
|
968
|
+
</CapLabel>
|
|
969
|
+
<div className="msg-container whatsapp-message-container">
|
|
970
|
+
<div
|
|
971
|
+
className="message-pop align-left"
|
|
972
|
+
style={whatsappSectionStyle}
|
|
973
|
+
>
|
|
974
|
+
<div className="whatsapp-content">
|
|
975
|
+
{content?.showUrlPreview &&
|
|
976
|
+
renderUrlPreview(content?.metaTagsDetails)}
|
|
977
|
+
{content?.whatsappImageSrc && (
|
|
978
|
+
<CapImage
|
|
979
|
+
src={content.whatsappImageSrc}
|
|
980
|
+
className="whatsapp-image"
|
|
981
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
982
|
+
/>
|
|
983
|
+
)}
|
|
984
|
+
{content?.whatsappVideoPreviewImg && (
|
|
985
|
+
<CapTooltip
|
|
986
|
+
title={formatMessage(messages.videoPreviewTooltip)}
|
|
987
|
+
>
|
|
988
|
+
<div className="video-preview">
|
|
989
|
+
<CapImage
|
|
990
|
+
src={content.whatsappVideoPreviewImg}
|
|
991
|
+
className="whatsapp-image"
|
|
992
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
993
|
+
/>
|
|
994
|
+
<div className="icon-position">
|
|
807
995
|
<CapImage
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
alt={formatMessage(messages.previewGenerated)}
|
|
996
|
+
className="video-icon"
|
|
997
|
+
src={videoPlay}
|
|
811
998
|
/>
|
|
812
|
-
<div className="icon-position">
|
|
813
|
-
<CapImage className="video-icon" src={videoPlay} />
|
|
814
|
-
</div>
|
|
815
999
|
</div>
|
|
816
|
-
</CapTooltip>
|
|
817
|
-
)}
|
|
818
|
-
{content?.docPreview && (
|
|
819
|
-
<div className="whatsapp-image">
|
|
820
|
-
{content?.docPreview}
|
|
821
1000
|
</div>
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1001
|
+
</CapTooltip>
|
|
1002
|
+
)}
|
|
1003
|
+
{content?.docPreview && (
|
|
1004
|
+
<div className="whatsapp-image">
|
|
1005
|
+
{content?.docPreview}
|
|
1006
|
+
</div>
|
|
1007
|
+
)}
|
|
1008
|
+
{content?.templateHeaderPreview || ""}
|
|
1009
|
+
{content?.templateMsg || ""}
|
|
1010
|
+
{content?.templateFooterPreview || ""}
|
|
1011
|
+
{renderWhatsappCtaPreview()}
|
|
1012
|
+
{renderQuickReplyPreview()}
|
|
829
1013
|
</div>
|
|
830
1014
|
</div>
|
|
831
1015
|
</div>
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1016
|
+
</div>
|
|
1017
|
+
<CapHeading
|
|
1018
|
+
type="h3"
|
|
1019
|
+
style={{ textAlign: "center" }}
|
|
1020
|
+
className="margin-t-16"
|
|
1021
|
+
>
|
|
1022
|
+
<FormattedMessage
|
|
1023
|
+
{...messages.whatsappMessageLength}
|
|
1024
|
+
values={{ length: whatsappUpdatedLen }}
|
|
1025
|
+
/>
|
|
1026
|
+
</CapHeading>
|
|
1027
|
+
</>
|
|
1028
|
+
) : (
|
|
1029
|
+
""
|
|
1030
|
+
)}
|
|
1031
|
+
{channel?.toUpperCase() === ZALO && (
|
|
1032
|
+
<CapRow
|
|
1033
|
+
className={`zalo-preview-container ${
|
|
1034
|
+
templateData?.fullMode
|
|
1035
|
+
? "zalo-preview-container-creative"
|
|
1036
|
+
: "zalo-preview-container-campaign"
|
|
1037
|
+
}`}
|
|
1038
|
+
>
|
|
1039
|
+
<CapRow>
|
|
1040
|
+
<CapLabel className="preview-head">
|
|
1041
|
+
{formatMessage(zaloMessage.previewHead)}
|
|
1042
|
+
</CapLabel>
|
|
1043
|
+
</CapRow>
|
|
1044
|
+
<CapRow>
|
|
1045
|
+
<CapLabel className="preview-text">
|
|
1046
|
+
{formatMessage(zaloMessage.previewText)}
|
|
1047
|
+
</CapLabel>
|
|
1048
|
+
</CapRow>
|
|
1049
|
+
<CapRow>
|
|
1050
|
+
<CapLabel
|
|
1051
|
+
data-testid="preview-link-button"
|
|
1052
|
+
onClick={handlePreview}
|
|
1053
|
+
className="preview-link"
|
|
836
1054
|
>
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
/>
|
|
841
|
-
</CapHeading>
|
|
842
|
-
</>
|
|
843
|
-
) : (
|
|
844
|
-
''
|
|
845
|
-
)
|
|
846
|
-
}
|
|
847
|
-
{
|
|
848
|
-
channel?.toUpperCase() === ZALO && (
|
|
849
|
-
<CapRow className={`zalo-preview-container ${templateData?.fullMode ? 'zalo-preview-container-creative' : 'zalo-preview-container-campaign'}`}>
|
|
850
|
-
<CapRow>
|
|
851
|
-
<CapLabel className="preview-head">
|
|
852
|
-
{formatMessage(zaloMessage.previewHead)}
|
|
853
|
-
</CapLabel>
|
|
854
|
-
</CapRow>
|
|
855
|
-
<CapRow>
|
|
856
|
-
<CapLabel className="preview-text">
|
|
857
|
-
{formatMessage(zaloMessage.previewText)}
|
|
858
|
-
</CapLabel>
|
|
859
|
-
</CapRow>
|
|
860
|
-
<CapRow>
|
|
861
|
-
<CapLabel
|
|
862
|
-
data-testid="preview-link-button"
|
|
863
|
-
onClick={handlePreview}
|
|
864
|
-
className="preview-link"
|
|
865
|
-
>
|
|
866
|
-
{formatMessage(zaloMessage.openPreview)}{' '}
|
|
867
|
-
<CapIcon type="open-in-new-light"></CapIcon>
|
|
868
|
-
</CapLabel>
|
|
869
|
-
</CapRow>
|
|
1055
|
+
{formatMessage(zaloMessage.openPreview)}{" "}
|
|
1056
|
+
<CapIcon type="open-in-new-light"></CapIcon>
|
|
1057
|
+
</CapLabel>
|
|
870
1058
|
</CapRow>
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
{
|
|
874
|
-
|
|
875
|
-
<
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
<div className="
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
1059
|
+
</CapRow>
|
|
1060
|
+
)}
|
|
1061
|
+
{channel?.toUpperCase() === RCS && (
|
|
1062
|
+
<div className="shell-v2 align-center">
|
|
1063
|
+
<CapImage
|
|
1064
|
+
className="preview-image"
|
|
1065
|
+
src={rcsIosPreview ? smsMobileIos : smsMobileAndroid}
|
|
1066
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
1067
|
+
/>
|
|
1068
|
+
<div className="msg-container sms">
|
|
1069
|
+
<div className="message-pop sms">
|
|
1070
|
+
{rcsImageSrc && (
|
|
1071
|
+
<CapImage
|
|
1072
|
+
src={rcsImageSrc}
|
|
1073
|
+
className="rcs-image"
|
|
1074
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
1075
|
+
/>
|
|
1076
|
+
)}
|
|
1077
|
+
{rcsTitle && (
|
|
1078
|
+
<CapLabel
|
|
1079
|
+
type="label5"
|
|
1080
|
+
className="message-pop-item align-left rcs-content"
|
|
1081
|
+
fontWeight="bold"
|
|
1082
|
+
>
|
|
1083
|
+
{rcsTitle}
|
|
1084
|
+
</CapLabel>
|
|
1085
|
+
)}
|
|
1086
|
+
{rcsDesc && (
|
|
1087
|
+
<CapLabel
|
|
1088
|
+
type="label5"
|
|
1089
|
+
className="message-pop-item align-left rcs-content rcs-desc"
|
|
1090
|
+
>
|
|
1091
|
+
{rcsDesc}
|
|
1092
|
+
</CapLabel>
|
|
1093
|
+
)}
|
|
1094
|
+
{rcsButtonText && (
|
|
1095
|
+
<CapLabel
|
|
1096
|
+
className="message-pop-item align-center rcs-content rcs-button-text"
|
|
1097
|
+
type="label21"
|
|
1098
|
+
>
|
|
1099
|
+
<CapIcon
|
|
1100
|
+
type="earth"
|
|
1101
|
+
size="xs"
|
|
1102
|
+
className="rcs-icon"
|
|
1103
|
+
svgProps={{ style: { marginRight: "4px" } }}
|
|
888
1104
|
/>
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
type="label5"
|
|
893
|
-
className="message-pop-item align-left rcs-content"
|
|
894
|
-
fontWeight="bold"
|
|
895
|
-
>
|
|
896
|
-
{rcsTitle}
|
|
897
|
-
</CapLabel>
|
|
898
|
-
)}
|
|
899
|
-
{rcsDesc && (
|
|
900
|
-
<CapLabel type="label5" className="message-pop-item align-left rcs-content rcs-desc">
|
|
901
|
-
{rcsDesc}
|
|
902
|
-
</CapLabel>
|
|
903
|
-
)}
|
|
904
|
-
{rcsButtonText && (<CapLabel className="message-pop-item align-center rcs-content rcs-button-text" type="label21">
|
|
905
|
-
<CapIcon type="earth" size="xs" className="rcs-icon" svgProps={{style: {marginRight: "4px"}}}/>{rcsButtonText}
|
|
906
|
-
</CapLabel>)}
|
|
907
|
-
</div>
|
|
1105
|
+
{rcsButtonText}
|
|
1106
|
+
</CapLabel>
|
|
1107
|
+
)}
|
|
908
1108
|
</div>
|
|
909
1109
|
</div>
|
|
910
|
-
|
|
911
|
-
}
|
|
1110
|
+
</div>
|
|
1111
|
+
)}
|
|
912
1112
|
{channel && channel.toLowerCase() === FACEBOOK && (
|
|
913
|
-
<div
|
|
1113
|
+
<div
|
|
1114
|
+
style={{ position: "absolute", left: "80%" }}
|
|
1115
|
+
id="facebook-preview"
|
|
1116
|
+
>
|
|
914
1117
|
<CapFacebookPreview
|
|
915
1118
|
disablePreviewButton={false}
|
|
916
1119
|
selectedAd={content.selectedAd}
|
|
@@ -918,16 +1121,98 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
918
1121
|
primaryText={content.primaryText}
|
|
919
1122
|
callToAction={content.callToAction}
|
|
920
1123
|
displayLink={content.displayLink}
|
|
921
|
-
orgUnitFacebookPageSettingsMap={{
|
|
922
|
-
|
|
1124
|
+
orgUnitFacebookPageSettingsMap={{
|
|
1125
|
+
pageAccessToken: content.pageAccessToken,
|
|
1126
|
+
pageId: content.pageId,
|
|
1127
|
+
}}
|
|
923
1128
|
accountId={content.accountId}
|
|
924
1129
|
accessToken={content.accessToken}
|
|
925
1130
|
defaultGeneratePreview
|
|
926
|
-
|
|
1131
|
+
/>
|
|
1132
|
+
</div>
|
|
1133
|
+
)}
|
|
1134
|
+
{channel?.toUpperCase() === INAPP && (
|
|
1135
|
+
<div className="shell-v2 align-center">
|
|
1136
|
+
<CapImage
|
|
1137
|
+
className="preview-image"
|
|
1138
|
+
src={getPreviewImage()}
|
|
1139
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
1140
|
+
/>
|
|
1141
|
+
<div className="preview-image">
|
|
1142
|
+
<div
|
|
1143
|
+
className={`inapp-message-container-${templateLayoutType}-${device} sms`}
|
|
1144
|
+
>
|
|
1145
|
+
<div className="preview-inapp-screen">
|
|
1146
|
+
{
|
|
1147
|
+
<CapLabel
|
|
1148
|
+
type="label15"
|
|
1149
|
+
className={`align-center inapp-title-${templateLayoutType}-${device} ${
|
|
1150
|
+
mediaPreview?.inAppImageSrcAndroid
|
|
1151
|
+
? ""
|
|
1152
|
+
: `without-image-title-${templateLayoutType}-android`
|
|
1153
|
+
} ${
|
|
1154
|
+
mediaPreview?.inAppImageSrcIos
|
|
1155
|
+
? ""
|
|
1156
|
+
: `without-image-title-${templateLayoutType}-ios`
|
|
1157
|
+
}`}
|
|
1158
|
+
>
|
|
1159
|
+
{templateTitle ? templateTitle : " "}
|
|
1160
|
+
{/* this ternary is required here for preview */}
|
|
1161
|
+
</CapLabel>
|
|
1162
|
+
}
|
|
1163
|
+
{mediaPreview && (
|
|
1164
|
+
<CapImage
|
|
1165
|
+
src={
|
|
1166
|
+
device === ANDROID
|
|
1167
|
+
? mediaPreview?.inAppImageSrcAndroid
|
|
1168
|
+
: mediaPreview?.inAppImageSrcIos
|
|
1169
|
+
}
|
|
1170
|
+
className={`inapp-image-${templateLayoutType}-${device}`}
|
|
1171
|
+
alt={formatMessage(messages.previewGenerated)}
|
|
1172
|
+
style={{ width: "100%", height: "100%" }}
|
|
1173
|
+
/>
|
|
1174
|
+
)}
|
|
1175
|
+
{
|
|
1176
|
+
<CapLabel
|
|
1177
|
+
type="label5"
|
|
1178
|
+
className={`align-left inapp-content-${templateLayoutType}-${device} ${
|
|
1179
|
+
mediaPreview?.inAppImageSrcAndroid
|
|
1180
|
+
? ""
|
|
1181
|
+
: `without-image-content-${templateLayoutType}-android`
|
|
1182
|
+
} ${
|
|
1183
|
+
mediaPreview?.inAppImageSrcIos
|
|
1184
|
+
? ""
|
|
1185
|
+
: `without-image-content-${templateLayoutType}-ios`
|
|
1186
|
+
}`}
|
|
1187
|
+
>
|
|
1188
|
+
{templateMsg ? templateMsg : " "}
|
|
1189
|
+
{/* this ternary is required here for preview */}
|
|
1190
|
+
</CapLabel>
|
|
1191
|
+
}
|
|
1192
|
+
{ctaData &&
|
|
1193
|
+
!isEmpty(ctaData) &&
|
|
1194
|
+
ctaData[0]?.text !== "" && (
|
|
1195
|
+
<CapButton
|
|
1196
|
+
type="primary"
|
|
1197
|
+
className={`inapp-button-${templateLayoutType}-${device} ${
|
|
1198
|
+
mediaPreview?.inAppImageSrcAndroid
|
|
1199
|
+
? ""
|
|
1200
|
+
: `without-image-button-${templateLayoutType}-android`
|
|
1201
|
+
} ${
|
|
1202
|
+
mediaPreview?.inAppImageSrcIos
|
|
1203
|
+
? ""
|
|
1204
|
+
: `without-image-button-${templateLayoutType}-ios`
|
|
1205
|
+
}`}
|
|
1206
|
+
>
|
|
1207
|
+
{ctaData[0]?.text}
|
|
1208
|
+
</CapButton>
|
|
1209
|
+
)}
|
|
1210
|
+
</div>
|
|
1211
|
+
</div>
|
|
1212
|
+
</div>
|
|
927
1213
|
</div>
|
|
928
|
-
|
|
1214
|
+
)}
|
|
929
1215
|
</div>
|
|
930
|
-
|
|
931
1216
|
</CapColumn>
|
|
932
1217
|
</CapRow>
|
|
933
1218
|
);
|