@capillarytech/creatives-library 9.0.15-alpha.3 → 9.0.16-beta.0
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/AppRoot.js +80 -0
- package/app.js +5 -3
- package/constants/unified.js +0 -29
- package/entry.js +67 -1
- package/global-styles.js +1 -1
- package/mfe-exposed-components.js +2 -4
- package/package.json +2 -2
- package/services/api.js +1 -1
- package/services/tests/api.test.js +20 -35
- package/styles/containers/layout/_layoutPage.scss +8 -6
- package/utils/commonUtils.js +1 -19
- package/utils/getDataLayer.js +15 -0
- package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
- package/utils/mfeDetect.js +1 -0
- package/v2Components/CapActionButton/constants.js +1 -8
- package/v2Components/CapActionButton/index.js +144 -202
- package/v2Components/CapActionButton/index.scss +14 -232
- package/v2Components/CapActionButton/messages.js +3 -19
- package/v2Components/CapActionButton/tests/index.test.js +18 -42
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +0 -10
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +22 -202
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +80 -381
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
- package/v2Components/CommonTestAndPreview/constants.js +2 -38
- package/v2Components/CommonTestAndPreview/index.js +222 -761
- package/v2Components/CommonTestAndPreview/messages.js +3 -45
- package/v2Components/CommonTestAndPreview/sagas.js +6 -25
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
- package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
- package/v2Components/NavigationBar/index.js +9 -7
- package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
- package/v2Components/Pagination/_pagination.scss +2 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +25 -45
- package/v2Components/TemplatePreview/index.js +32 -147
- package/v2Components/TemplatePreview/tests/index.test.js +0 -142
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
- package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
- package/v2Containers/Cap/constants.js +1 -0
- package/v2Containers/Cap/index.js +47 -21
- package/v2Containers/Cap/sagas.js +19 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -37
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
- package/v2Containers/CreativesContainer/constants.js +0 -11
- package/v2Containers/CreativesContainer/index.js +104 -323
- package/v2Containers/CreativesContainer/index.scss +1 -83
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
- package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/constants.js +11 -131
- package/v2Containers/Rcs/index.js +829 -2682
- package/v2Containers/Rcs/index.scss +8 -443
- package/v2Containers/Rcs/messages.js +6 -45
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +39409 -74176
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +74 -10
- package/v2Containers/Rcs/tests/index.test.js +40 -151
- package/v2Containers/Rcs/tests/mockData.js +0 -38
- package/v2Containers/Rcs/tests/utils.test.js +30 -643
- package/v2Containers/Rcs/utils.js +12 -466
- package/v2Containers/Sms/Create/index.js +48 -115
- package/v2Containers/SmsTrai/Create/index.js +4 -9
- package/v2Containers/SmsTrai/Edit/constants.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +169 -678
- package/v2Containers/SmsTrai/Edit/messages.js +4 -14
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
- package/v2Containers/SmsWrapper/index.js +8 -37
- package/v2Containers/TagList/index.js +0 -6
- package/v2Containers/Templates/_templates.scss +11 -196
- package/v2Containers/Templates/actions.js +0 -11
- package/v2Containers/Templates/constants.js +0 -2
- package/v2Containers/Templates/index.js +60 -131
- package/v2Containers/Templates/sagas.js +13 -57
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
- package/v2Containers/Templates/tests/sagas.test.js +16 -199
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +10 -75
- package/v2Containers/TemplatesV2/index.js +43 -86
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +25 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
- package/utils/rcsPayloadUtils.js +0 -92
- package/utils/templateVarUtils.js +0 -201
- package/utils/tests/rcsPayloadUtils.test.js +0 -226
- package/utils/tests/templateVarUtils.test.js +0 -204
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
- package/v2Components/CommonTestAndPreview/utils.js +0 -84
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
- package/v2Components/SmsFallback/constants.js +0 -94
- package/v2Components/SmsFallback/index.js +0 -958
- package/v2Components/SmsFallback/index.scss +0 -266
- package/v2Components/SmsFallback/messages.js +0 -78
- package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
- package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
- package/v2Components/TemplatePreview/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
- package/v2Components/VarSegmentMessageEditor/index.js +0 -125
- package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
- package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
- package/v2Containers/SmsTrai/Edit/index.scss +0 -126
- package/v2Containers/Templates/TemplatesActionBar.js +0 -101
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
|
@@ -52,7 +52,6 @@ import { QUICK_REPLY, WHATSAPP_CATEGORIES, PHONE_NUMBER, TEMPLATE_VARIABLE_REGEX
|
|
|
52
52
|
import { RCS_BUTTON_TYPES, LEFT, HORIZONTAL, VERTICAL, RIGHT} from '../../v2Containers/Rcs/constants';
|
|
53
53
|
import { ANDROID, INAPP_MESSAGE_LAYOUT_TYPES } from '../../v2Containers/InApp/constants';
|
|
54
54
|
import { CAROUSEL } from '../../v2Containers/MobilePushNew/constants';
|
|
55
|
-
import { TEMPLATE_VAR_REGEX } from './constants';
|
|
56
55
|
|
|
57
56
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
58
57
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
@@ -237,23 +236,7 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
237
236
|
let content = channel && channel.toLowerCase() === 'sms' ? [this.props.content] : this.props.content;
|
|
238
237
|
const { formatMessage } = intl;
|
|
239
238
|
const { rcsPreviewContent, inAppPreviewContent, viberPreviewContent, isBeeFreeTemplate } = content || {};
|
|
240
|
-
const
|
|
241
|
-
? { carouselData: rcsPreviewContent }
|
|
242
|
-
: (rcsPreviewContent || {});
|
|
243
|
-
const {
|
|
244
|
-
rcsImageSrc,
|
|
245
|
-
rcsVideoSrc,
|
|
246
|
-
rcsTitle,
|
|
247
|
-
rcsDesc,
|
|
248
|
-
rcsSuggestions,
|
|
249
|
-
carouselData: rcsCarouselData,
|
|
250
|
-
rcsCarouselData: rcsCarouselDataAlt,
|
|
251
|
-
cardVarMapped: rcsCardVarMapped,
|
|
252
|
-
} = normalizedRcsPreviewContent;
|
|
253
|
-
const resolvedRcsCarouselData =
|
|
254
|
-
Array.isArray(rcsCarouselData) && rcsCarouselData.length > 0
|
|
255
|
-
? rcsCarouselData
|
|
256
|
-
: rcsCarouselDataAlt;
|
|
239
|
+
const { rcsImageSrc, rcsVideoSrc, rcsTitle, rcsDesc, rcsSuggestions } = rcsPreviewContent || {};
|
|
257
240
|
const {
|
|
258
241
|
videoParams,
|
|
259
242
|
imageURL,
|
|
@@ -334,18 +317,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
334
317
|
'flex-shrink': 0,
|
|
335
318
|
'left': 0,
|
|
336
319
|
};
|
|
337
|
-
|
|
338
|
-
const resolveVarsWithMap = (input, varMap) => {
|
|
339
|
-
if (input === null || input === undefined) return '';
|
|
340
|
-
const str = typeof input === 'string' ? input : String(input);
|
|
341
|
-
return str.replace(TEMPLATE_VAR_REGEX, (token, varName) => {
|
|
342
|
-
const mappedValue = varMap?.[varName];
|
|
343
|
-
if (mappedValue === null || mappedValue === undefined || String(mappedValue) === '') {
|
|
344
|
-
return token;
|
|
345
|
-
}
|
|
346
|
-
return String(mappedValue);
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
320
|
const getVideoContent = ({
|
|
350
321
|
video,
|
|
351
322
|
actionUrl,
|
|
@@ -502,15 +473,13 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
502
473
|
const whatsappUpdatedAccountName = whatsappAccountName || templateData?.versions?.base?.content?.whatsapp?.accountName || '';
|
|
503
474
|
const whatsappUpdatedLen = whatsappContentLen !== undefined ? whatsappContentLen : content?.charCount;
|
|
504
475
|
|
|
505
|
-
const renderRcsSuggestionsPreview = (
|
|
476
|
+
const renderRcsSuggestionsPreview = () => {
|
|
506
477
|
const renderArray = [];
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const suggestionKey = `${suggestion?.type || 'unknown'}-${suggestion?.text || ''}-${idx}`;
|
|
510
|
-
renderArray.push(<CapDivider key={`rcs-divider-${suggestionKey}`} className="whatsapp-divider" />);
|
|
478
|
+
(rcsSuggestions || []).forEach((suggestion) => {
|
|
479
|
+
renderArray.push(<CapDivider className="whatsapp-divider" />);
|
|
511
480
|
if (suggestion.type === RCS_BUTTON_TYPES.QUICK_REPLY) {
|
|
512
481
|
renderArray.push(
|
|
513
|
-
<CapLabel
|
|
482
|
+
<CapLabel type="label21" className="rcs-cta-preview">
|
|
514
483
|
<CapIcon
|
|
515
484
|
type='small-link'
|
|
516
485
|
size="xs"
|
|
@@ -520,17 +489,14 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
520
489
|
);
|
|
521
490
|
} else if (suggestion.type === RCS_BUTTON_TYPES.CTA) {
|
|
522
491
|
renderArray.push(
|
|
523
|
-
<CapLabel
|
|
524
|
-
|
|
525
|
-
CTA buttons render together, showing as a solid square — "open-in-new"
|
|
526
|
-
is a single flat path with no ids, so it can't collide. */}
|
|
527
|
-
<CapIcon type="open-in-new" size="xs" />
|
|
492
|
+
<CapLabel type="label21" className="rcs-cta-preview">
|
|
493
|
+
<CapIcon type="launch" size="xs" />
|
|
528
494
|
{suggestion.text}
|
|
529
495
|
</CapLabel>,
|
|
530
496
|
);
|
|
531
497
|
} else if (suggestion.type === RCS_BUTTON_TYPES.PHONE_NUMBER) {
|
|
532
498
|
renderArray.push(
|
|
533
|
-
<CapLabel
|
|
499
|
+
<CapLabel type="label21" className="rcs-cta-preview">
|
|
534
500
|
<CapIcon type="call" size="xs" />
|
|
535
501
|
{suggestion.text}
|
|
536
502
|
</CapLabel>,
|
|
@@ -543,20 +509,23 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
543
509
|
const renderTextPreviewContent = () => (
|
|
544
510
|
<>
|
|
545
511
|
{rcsTitle && (
|
|
512
|
+
<>
|
|
546
513
|
<CapLabel
|
|
547
514
|
type="label5"
|
|
548
515
|
className="message-pop-item align-left rcs-content"
|
|
549
516
|
fontWeight="bold"
|
|
550
517
|
>
|
|
551
|
-
{
|
|
518
|
+
{rcsTitle}
|
|
552
519
|
</CapLabel>
|
|
520
|
+
<CapDivider className="whatsapp-divider" />
|
|
521
|
+
</>
|
|
553
522
|
)}
|
|
554
523
|
{rcsDesc && (
|
|
555
524
|
<CapLabel
|
|
556
525
|
type="label5"
|
|
557
526
|
className="message-pop-item align-left rcs-desc rcs-content"
|
|
558
527
|
>
|
|
559
|
-
{
|
|
528
|
+
{rcsDesc}
|
|
560
529
|
</CapLabel>
|
|
561
530
|
)}
|
|
562
531
|
{renderRcsSuggestionsPreview()}
|
|
@@ -573,134 +542,50 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
573
542
|
/>
|
|
574
543
|
)}
|
|
575
544
|
{rcsVideoSrc && (
|
|
576
|
-
<
|
|
545
|
+
<div className="video-preview">
|
|
577
546
|
<CapImage
|
|
578
547
|
src={rcsVideoSrc}
|
|
579
548
|
className="rcs-image"
|
|
580
549
|
alt={formatMessage(messages.previewGenerated)}
|
|
581
550
|
/>
|
|
582
|
-
<
|
|
551
|
+
<div className="icon-position">
|
|
583
552
|
<CapImage
|
|
584
553
|
className="video-icon"
|
|
585
554
|
src={videoPlay}
|
|
586
555
|
/>
|
|
587
|
-
</
|
|
588
|
-
</
|
|
556
|
+
</div>
|
|
557
|
+
</div>
|
|
589
558
|
)}
|
|
590
559
|
</>
|
|
591
560
|
);
|
|
592
561
|
|
|
593
562
|
const renderRcsPreviewContent = () => {
|
|
594
|
-
const carouselCards = Array.isArray(resolvedRcsCarouselData) ? resolvedRcsCarouselData : [];
|
|
595
|
-
if (carouselCards.length > 0) {
|
|
596
|
-
return (
|
|
597
|
-
<CapRow className="msg-container sms">
|
|
598
|
-
<CapRow className="message-pop sms">
|
|
599
|
-
<CapRow className="msg-container-carousel">
|
|
600
|
-
<CapRow className="scroll-container">
|
|
601
|
-
{carouselCards.map((card, idx) => {
|
|
602
|
-
const key = `rcs-carousel-${idx}-${card?.bodyText || card?.imageSrc || card?.videoPreviewImg || ''}`;
|
|
603
|
-
const isVideo = (card?.mediaType || '').toLowerCase() === VIDEO;
|
|
604
|
-
const cardSuggestions = Array.isArray(card?.suggestions) ? card.suggestions : [];
|
|
605
|
-
const effectiveCardVarMap = { ...rcsCardVarMapped, ...(card?.cardVarMapped || {}) };
|
|
606
|
-
const suggestionsNode = cardSuggestions.length > 0
|
|
607
|
-
? renderRcsSuggestionsPreview(cardSuggestions)
|
|
608
|
-
: null;
|
|
609
|
-
|
|
610
|
-
const resolvedCardTitle = resolveVarsWithMap(card?.title, effectiveCardVarMap);
|
|
611
|
-
const resolvedCardBodyText = resolveVarsWithMap(card?.bodyText, effectiveCardVarMap);
|
|
612
|
-
|
|
613
|
-
return (
|
|
614
|
-
<CapRow
|
|
615
|
-
key={key}
|
|
616
|
-
className="message-pop align-left message-pop-carousel rcs-carousel-card"
|
|
617
|
-
>
|
|
618
|
-
<CapRow className="whatsapp-content">
|
|
619
|
-
{!isVideo && (
|
|
620
|
-
<CapImage
|
|
621
|
-
src={card?.imageSrc ? card.imageSrc : whatsappImageEmptyPreview}
|
|
622
|
-
className="whatsapp-image"
|
|
623
|
-
alt={formatMessage(messages.previewGenerated)}
|
|
624
|
-
/>
|
|
625
|
-
)}
|
|
626
|
-
{isVideo && (
|
|
627
|
-
<CapTooltip title={formatMessage(messages.videoPreviewTooltip)}>
|
|
628
|
-
<CapRow className="video-preview">
|
|
629
|
-
<CapImage
|
|
630
|
-
src={card?.videoPreviewImg ? card.videoPreviewImg : whatsappVideoEmptyPreview}
|
|
631
|
-
className="whatsapp-image"
|
|
632
|
-
alt={formatMessage(messages.previewGenerated)}
|
|
633
|
-
/>
|
|
634
|
-
<CapRow className="icon-position">
|
|
635
|
-
<CapImage className="video-icon" src={videoPlay} alt="Play" />
|
|
636
|
-
</CapRow>
|
|
637
|
-
</CapRow>
|
|
638
|
-
</CapTooltip>
|
|
639
|
-
)}
|
|
640
|
-
|
|
641
|
-
{(resolvedCardTitle || resolvedCardBodyText) && (
|
|
642
|
-
<CapRow className="carousel-content">
|
|
643
|
-
{!!resolvedCardTitle && (
|
|
644
|
-
<CapLabel
|
|
645
|
-
type={card?.titleLabelType || 'label1'}
|
|
646
|
-
className="carousel-title"
|
|
647
|
-
>
|
|
648
|
-
{resolvedCardTitle}
|
|
649
|
-
</CapLabel>
|
|
650
|
-
)}
|
|
651
|
-
{!!resolvedCardBodyText && (
|
|
652
|
-
<CapLabel
|
|
653
|
-
type={card?.bodyLabelType || 'label2'}
|
|
654
|
-
className="carousel-message"
|
|
655
|
-
>
|
|
656
|
-
{resolvedCardBodyText}
|
|
657
|
-
</CapLabel>
|
|
658
|
-
)}
|
|
659
|
-
</CapRow>
|
|
660
|
-
)}
|
|
661
|
-
|
|
662
|
-
{!!suggestionsNode && (
|
|
663
|
-
<>
|
|
664
|
-
{suggestionsNode}
|
|
665
|
-
</>
|
|
666
|
-
)}
|
|
667
|
-
</CapRow>
|
|
668
|
-
</CapRow>
|
|
669
|
-
);
|
|
670
|
-
})}
|
|
671
|
-
</CapRow>
|
|
672
|
-
</CapRow>
|
|
673
|
-
</CapRow>
|
|
674
|
-
</CapRow>
|
|
675
|
-
);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
563
|
if (rcsOrientation === HORIZONTAL) {
|
|
679
564
|
return rcsType === RIGHT ? (
|
|
680
|
-
<
|
|
681
|
-
<
|
|
565
|
+
<div className="msg-container sms">
|
|
566
|
+
<div className="message-pop sms horizontal">
|
|
682
567
|
<CapColumn className="rcs-preview-text" span={12}>{renderTextPreviewContent()}</CapColumn>
|
|
683
568
|
<CapColumn span={12}>{renderMediaPreviewContent()}</CapColumn>
|
|
684
|
-
</
|
|
685
|
-
</
|
|
569
|
+
</div>
|
|
570
|
+
</div>
|
|
686
571
|
|
|
687
572
|
) : (
|
|
688
|
-
<
|
|
689
|
-
<
|
|
573
|
+
<div className="msg-container sms">
|
|
574
|
+
<div className="message-pop sms horizontal">
|
|
690
575
|
<CapColumn span={12}>{renderMediaPreviewContent()}</CapColumn>
|
|
691
576
|
<CapColumn className="rcs-preview-text" span={12}>{renderTextPreviewContent()}</CapColumn>
|
|
692
|
-
</
|
|
693
|
-
</
|
|
577
|
+
</div>
|
|
578
|
+
</div>
|
|
694
579
|
);
|
|
695
580
|
}
|
|
696
581
|
|
|
697
582
|
return (
|
|
698
|
-
<
|
|
699
|
-
<
|
|
583
|
+
<div className="msg-container sms">
|
|
584
|
+
<div className="message-pop sms">
|
|
700
585
|
{renderMediaPreviewContent()}
|
|
701
586
|
{renderTextPreviewContent()}
|
|
702
|
-
</
|
|
703
|
-
</
|
|
587
|
+
</div>
|
|
588
|
+
</div>
|
|
704
589
|
);
|
|
705
590
|
};
|
|
706
591
|
|
|
@@ -1421,14 +1306,14 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
1421
1306
|
""
|
|
1422
1307
|
)}
|
|
1423
1308
|
{channel?.toUpperCase() === RCS && (
|
|
1424
|
-
<
|
|
1309
|
+
<div className="shell-v2 align-center rcs-preview">
|
|
1425
1310
|
<CapImage
|
|
1426
1311
|
className="preview-image"
|
|
1427
1312
|
src={rcsIosPreview ? smsMobileIos : smsMobileAndroid}
|
|
1428
1313
|
alt={formatMessage(messages.previewGenerated)}
|
|
1429
1314
|
/>
|
|
1430
1315
|
{renderRcsPreviewContent()}
|
|
1431
|
-
</
|
|
1316
|
+
</div>
|
|
1432
1317
|
|
|
1433
1318
|
)}
|
|
1434
1319
|
{channel?.toUpperCase() === ZALO && (
|
|
@@ -1630,4 +1515,4 @@ TemplatePreview.propTypes = {
|
|
|
1630
1515
|
rcsOrientation: PropTypes.string,
|
|
1631
1516
|
};
|
|
1632
1517
|
|
|
1633
|
-
export default (injectIntl(TemplatePreview));
|
|
1518
|
+
export default (injectIntl(TemplatePreview));
|
|
@@ -2,9 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
3
3
|
|
|
4
4
|
import { TemplatePreview } from '../index';
|
|
5
|
-
import { RCS } from '../../../v2Containers/CreativesContainer/constants';
|
|
6
|
-
import whatsappImageEmptyPreview from '../assets/images/empty_image_preview.svg';
|
|
7
|
-
import whatsappVideoEmptyPreview from '../assets/images/empty_video_preview.svg';
|
|
8
5
|
|
|
9
6
|
describe('Test Templates container', () => {
|
|
10
7
|
let renderedComponent;
|
|
@@ -72,143 +69,4 @@ describe('Test Templates container', () => {
|
|
|
72
69
|
});
|
|
73
70
|
expect(renderedComponent).toMatchSnapshot();
|
|
74
71
|
});
|
|
75
|
-
|
|
76
|
-
describe('RCS carousel preview branches', () => {
|
|
77
|
-
const buildRcsContent = (cards) => ({
|
|
78
|
-
rcsPreviewContent: {
|
|
79
|
-
carouselData: cards,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const getNodesByClassName = (className) =>
|
|
84
|
-
renderedComponent.findWhere((node) => node.prop('className') === className);
|
|
85
|
-
|
|
86
|
-
it('renders image and video cards with proper media-specific markup', () => {
|
|
87
|
-
renderFunction(
|
|
88
|
-
RCS,
|
|
89
|
-
buildRcsContent([
|
|
90
|
-
{
|
|
91
|
-
mediaType: 'image',
|
|
92
|
-
imageSrc: 'https://example.com/image-card.jpg',
|
|
93
|
-
bodyText: 'image body',
|
|
94
|
-
suggestions: [],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
mediaType: 'video',
|
|
98
|
-
videoPreviewImg: 'https://example.com/video-thumb.jpg',
|
|
99
|
-
bodyText: 'video body',
|
|
100
|
-
suggestions: [],
|
|
101
|
-
},
|
|
102
|
-
]),
|
|
103
|
-
'',
|
|
104
|
-
0,
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
// Video card should render tooltip/video icon path; image-only card should not.
|
|
108
|
-
expect(renderedComponent.find('CapTooltip')).toHaveLength(1);
|
|
109
|
-
expect(
|
|
110
|
-
renderedComponent.findWhere((node) => node.prop('className') === 'video-icon')
|
|
111
|
-
).toHaveLength(1);
|
|
112
|
-
|
|
113
|
-
// Both cards render media containers.
|
|
114
|
-
expect(
|
|
115
|
-
renderedComponent.findWhere((node) => node.prop('className') === 'whatsapp-image')
|
|
116
|
-
).toHaveLength(2);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('renders per-card suggestions only for cards that provide suggestions', () => {
|
|
120
|
-
renderFunction(
|
|
121
|
-
RCS,
|
|
122
|
-
buildRcsContent([
|
|
123
|
-
{
|
|
124
|
-
mediaType: 'image',
|
|
125
|
-
imageSrc: 'https://example.com/with-suggestions.jpg',
|
|
126
|
-
bodyText: 'has suggestions',
|
|
127
|
-
suggestions: [
|
|
128
|
-
{ type: 'QUICK_REPLY', text: 'Reply 1' },
|
|
129
|
-
{ type: 'CTA', text: 'Visit' },
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
mediaType: 'image',
|
|
134
|
-
imageSrc: 'https://example.com/no-suggestions.jpg',
|
|
135
|
-
bodyText: 'no suggestions',
|
|
136
|
-
suggestions: [],
|
|
137
|
-
},
|
|
138
|
-
]),
|
|
139
|
-
'',
|
|
140
|
-
0,
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
// Suggestion labels/icons should be rendered only from first card.
|
|
144
|
-
expect(getNodesByClassName('rcs-cta-preview')).toHaveLength(2);
|
|
145
|
-
expect(getNodesByClassName('whatsapp-divider')).not.toHaveLength(0);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('falls back to empty preview assets when image/video media src is missing', () => {
|
|
149
|
-
renderFunction(
|
|
150
|
-
RCS,
|
|
151
|
-
buildRcsContent([
|
|
152
|
-
{
|
|
153
|
-
mediaType: 'image',
|
|
154
|
-
bodyText: 'fallback image',
|
|
155
|
-
suggestions: [],
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
mediaType: 'video',
|
|
159
|
-
bodyText: 'fallback video',
|
|
160
|
-
suggestions: [],
|
|
161
|
-
},
|
|
162
|
-
]),
|
|
163
|
-
'',
|
|
164
|
-
0,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const mediaImageNodes = renderedComponent.findWhere(
|
|
168
|
-
(node) => node.name() === 'CapImage' && node.prop('className') === 'whatsapp-image'
|
|
169
|
-
);
|
|
170
|
-
const mediaSrcs = mediaImageNodes.map((node) => node.prop('src'));
|
|
171
|
-
|
|
172
|
-
expect(mediaSrcs).toContain(whatsappImageEmptyPreview);
|
|
173
|
-
expect(mediaSrcs).toContain(whatsappVideoEmptyPreview);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('generates unique carousel keys using rcs-carousel-<idx>-<bodyText|imageSrc|videoPreviewImg>', () => {
|
|
177
|
-
renderFunction(
|
|
178
|
-
RCS,
|
|
179
|
-
buildRcsContent([
|
|
180
|
-
{
|
|
181
|
-
mediaType: 'image',
|
|
182
|
-
imageSrc: 'https://example.com/one.jpg',
|
|
183
|
-
bodyText: 'same body',
|
|
184
|
-
suggestions: [],
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
mediaType: 'image',
|
|
188
|
-
imageSrc: 'https://example.com/two.jpg',
|
|
189
|
-
bodyText: 'same body',
|
|
190
|
-
suggestions: [],
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
mediaType: 'video',
|
|
194
|
-
videoPreviewImg: 'https://example.com/three-thumb.jpg',
|
|
195
|
-
bodyText: 'same body',
|
|
196
|
-
suggestions: [],
|
|
197
|
-
},
|
|
198
|
-
]),
|
|
199
|
-
'',
|
|
200
|
-
0,
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
const cardNodes = getNodesByClassName('message-pop align-left message-pop-carousel rcs-carousel-card');
|
|
204
|
-
const keys = cardNodes.map((node) => node.key());
|
|
205
|
-
|
|
206
|
-
expect(keys).toEqual([
|
|
207
|
-
'rcs-carousel-0-same body',
|
|
208
|
-
'rcs-carousel-1-same body',
|
|
209
|
-
'rcs-carousel-2-same body',
|
|
210
|
-
]);
|
|
211
|
-
expect(new Set(keys).size).toBe(keys.length);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
72
|
});
|
|
@@ -88,12 +88,12 @@ const CustomValuesEditor = ({
|
|
|
88
88
|
</CapLabel>
|
|
89
89
|
</CapRow>
|
|
90
90
|
{requiredTags.map((tag) => (
|
|
91
|
-
<CapRow key={tag.fullPath}
|
|
92
|
-
<CapRow
|
|
91
|
+
<CapRow key={tag.fullPath} className="value-row">
|
|
92
|
+
<CapRow className="tag-name">
|
|
93
93
|
{tag.fullPath}
|
|
94
94
|
<span className="required-tag-indicator">*</span>
|
|
95
95
|
</CapRow>
|
|
96
|
-
<CapRow
|
|
96
|
+
<CapRow className="tag-input">
|
|
97
97
|
<CapInput
|
|
98
98
|
type="text"
|
|
99
99
|
isRequired
|
|
@@ -107,9 +107,9 @@ const CustomValuesEditor = ({
|
|
|
107
107
|
</CapRow>
|
|
108
108
|
))}
|
|
109
109
|
{optionalTags.map((tag) => (
|
|
110
|
-
<CapRow key={tag.fullPath}
|
|
111
|
-
<CapRow
|
|
112
|
-
<CapRow
|
|
110
|
+
<CapRow key={tag.fullPath} className="value-row">
|
|
111
|
+
<CapRow className="tag-name">{tag.fullPath}</CapRow>
|
|
112
|
+
<CapRow className="tag-input">
|
|
113
113
|
<CapInput
|
|
114
114
|
type="text"
|
|
115
115
|
className="tag-input-field"
|
|
@@ -18,7 +18,7 @@ import injectReducer from '../../utils/injectReducer';
|
|
|
18
18
|
import injectSaga from '../../utils/injectSaga';
|
|
19
19
|
|
|
20
20
|
import CommonTestAndPreview from '../CommonTestAndPreview';
|
|
21
|
-
import { CHANNELS
|
|
21
|
+
import { CHANNELS } from '../CommonTestAndPreview/constants';
|
|
22
22
|
import * as commonTestAndPreviewActions from '../CommonTestAndPreview/actions';
|
|
23
23
|
import { commonTestAndPreviewSaga } from '../CommonTestAndPreview/sagas';
|
|
24
24
|
import commonTestAndPreviewReducer from '../CommonTestAndPreview/reducer';
|
|
@@ -78,16 +78,6 @@ TestAndPreviewSlidebox.propTypes = {
|
|
|
78
78
|
content: PropTypes.string,
|
|
79
79
|
beeInstance: PropTypes.object,
|
|
80
80
|
currentTab: PropTypes.number,
|
|
81
|
-
smsFallbackContent: PropTypes.shape({
|
|
82
|
-
templateContent: PropTypes.string,
|
|
83
|
-
senderId: PropTypes.string,
|
|
84
|
-
templateName: PropTypes.string,
|
|
85
|
-
[RCS_SMS_FALLBACK_VAR_MAPPED_PROP]: PropTypes.object,
|
|
86
|
-
}),
|
|
87
|
-
/** Passed to CommonTestAndPreview for RCS test-meta resolution (slot semantics vs full-mode). */
|
|
88
|
-
rcsTestPreviewOptions: PropTypes.shape({
|
|
89
|
-
isLibraryMode: PropTypes.bool,
|
|
90
|
-
}),
|
|
91
81
|
// Redux props are passed through
|
|
92
82
|
actions: PropTypes.object.isRequired,
|
|
93
83
|
extractedTags: PropTypes.array.isRequired,
|
|
@@ -119,12 +109,10 @@ TestAndPreviewSlidebox.defaultProps = {
|
|
|
119
109
|
currentTab: 1,
|
|
120
110
|
messageMetaConfigId: null,
|
|
121
111
|
prefilledValues: {},
|
|
122
|
-
rcsTestPreviewOptions: undefined,
|
|
123
112
|
senderDetailsByChannel: {},
|
|
124
113
|
wecrmAccounts: [],
|
|
125
114
|
isLoadingSenderDetails: false,
|
|
126
115
|
orgUnitId: -1,
|
|
127
|
-
smsFallbackContent: null,
|
|
128
116
|
};
|
|
129
117
|
|
|
130
118
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -34,7 +34,6 @@ import {
|
|
|
34
34
|
GET_PREFILLED_VALUES_SUCCESS,
|
|
35
35
|
GET_PREFILLED_VALUES_FAILURE,
|
|
36
36
|
} from './constants';
|
|
37
|
-
import { extractPreviewFromLiquidResponse } from '../CommonTestAndPreview/previewApiUtils';
|
|
38
37
|
|
|
39
38
|
// Search Customers Saga
|
|
40
39
|
export function* searchCustomersSaga(action) {
|
|
@@ -81,12 +80,11 @@ export function* updatePreviewSaga(action) {
|
|
|
81
80
|
const customValues = action.payload.resolvedTags;
|
|
82
81
|
|
|
83
82
|
const response = yield call(Api.updateEmailPreview, action.payload);
|
|
84
|
-
|
|
85
|
-
if (previewPayload) {
|
|
83
|
+
if (response?.data) {
|
|
86
84
|
yield put({
|
|
87
85
|
type: UPDATE_PREVIEW_SUCCESS,
|
|
88
86
|
payload: {
|
|
89
|
-
previewData:
|
|
87
|
+
previewData: response.data,
|
|
90
88
|
customValues, // Pass custom values to be preserved
|
|
91
89
|
},
|
|
92
90
|
});
|
|
@@ -223,13 +221,8 @@ export function* createMessageMetaSaga(action) {
|
|
|
223
221
|
export function* getPrefilledValuesSaga(action) {
|
|
224
222
|
try {
|
|
225
223
|
const response = yield call(Api.updateEmailPreview, action.payload);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
? response.data
|
|
229
|
-
: response;
|
|
230
|
-
const resolvedTagValues = body?.resolvedTagValues;
|
|
231
|
-
if (resolvedTagValues != null) {
|
|
232
|
-
yield put({ type: GET_PREFILLED_VALUES_SUCCESS, payload: { values: resolvedTagValues } });
|
|
224
|
+
if (response?.data) {
|
|
225
|
+
yield put({ type: GET_PREFILLED_VALUES_SUCCESS, payload: { values: response?.data?.resolvedTagValues } });
|
|
233
226
|
} else {
|
|
234
227
|
yield put({ type: GET_PREFILLED_VALUES_FAILURE, payload: { error: response.error || 'Failed to fetch prefilled values' } });
|
|
235
228
|
}
|
|
@@ -136,9 +136,7 @@ describe('TestAndPreviewSlidebox Sagas', () => {
|
|
|
136
136
|
describe('updatePreviewSaga', () => {
|
|
137
137
|
it('should handle successful preview update', () => {
|
|
138
138
|
const mockResponse = {
|
|
139
|
-
data:
|
|
140
|
-
resolvedBody: 'Test Preview Data',
|
|
141
|
-
},
|
|
139
|
+
data: 'Test Preview Data',
|
|
142
140
|
};
|
|
143
141
|
const customValues = { test: 'value' };
|
|
144
142
|
return expectSaga(sagas.updatePreviewSaga, {
|
|
@@ -56,6 +56,7 @@ export const SUCCESS = 'SUCCESS';
|
|
|
56
56
|
export const FAILURE = 'FAILURE';
|
|
57
57
|
|
|
58
58
|
export const ENABLE_PRODUCT_SUPPORT_VIDEOS = 'ENABLE_PRODUCT_SUPPORT_VIDEOS';
|
|
59
|
+
export const ENABLE_NEW_LEFT_NAVIGATION = 'ENABLE_NEW_LEFT_NAVIGATION';
|
|
59
60
|
export const DEFAULT = 'default';
|
|
60
61
|
export const DEFAULT_MODULE = 'creatives';
|
|
61
62
|
|