@capillarytech/creatives-library 8.0.124 → 8.0.125-alpha.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/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Carousel
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Carousel } from 'antd';
|
|
3
3
|
import './style.scss';
|
|
4
4
|
import CapImage from '@capillarytech/cap-ui-library/CapImage';
|
|
5
5
|
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
6
6
|
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
7
|
+
import { CAP_WHITE } from '@capillarytech/cap-ui-library/styled/variables';
|
|
7
8
|
const lineImgPlaceholder = require('../../assets/line-image-placeholder.svg');
|
|
8
|
-
import { CAP_WHITE, CAP_G08 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
9
9
|
|
|
10
10
|
const arrowStyle = {
|
|
11
11
|
background: 'rgba(0, 0, 0, 0.1)',
|
|
@@ -16,10 +16,12 @@ const arrowStyle = {
|
|
|
16
16
|
height: 24,
|
|
17
17
|
width: 24,
|
|
18
18
|
borderRadius: '50%',
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
|
|
21
|
-
const Arrow = props => {
|
|
22
|
-
const {
|
|
21
|
+
const Arrow = (props) => {
|
|
22
|
+
const {
|
|
23
|
+
className, style, onClick, extraStyle, type,
|
|
24
|
+
} = props;
|
|
23
25
|
return (
|
|
24
26
|
<CapButton
|
|
25
27
|
className={className}
|
|
@@ -35,8 +37,8 @@ const Arrow = props => {
|
|
|
35
37
|
type={type}
|
|
36
38
|
/>
|
|
37
39
|
</CapButton>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
40
42
|
|
|
41
43
|
const settings = {
|
|
42
44
|
nextArrow: (
|
|
@@ -56,7 +58,7 @@ const settings = {
|
|
|
56
58
|
type="chevron-left"
|
|
57
59
|
/>
|
|
58
60
|
),
|
|
59
|
-
}
|
|
61
|
+
};
|
|
60
62
|
|
|
61
63
|
const CarouselComponent = ({
|
|
62
64
|
imageCarousel,
|
|
@@ -81,11 +83,11 @@ const CarouselComponent = ({
|
|
|
81
83
|
|
|
82
84
|
return (
|
|
83
85
|
<div style={{ position: 'relative' }} className={`template-carousel ${imageCarouselLength ? 'single-img' : ''}`}>
|
|
84
|
-
<Carousel ref={node => (carousel = node)} {...prop} {...settings}>
|
|
86
|
+
<Carousel ref={(node) => (carousel = node)} {...prop} {...settings}>
|
|
85
87
|
{
|
|
86
88
|
imageCarousel.map(({
|
|
87
89
|
actionLabel,
|
|
88
|
-
imageUrl = lineImgPlaceholder
|
|
90
|
+
imageUrl = lineImgPlaceholder,
|
|
89
91
|
}) => (
|
|
90
92
|
<div className="carousel-section">
|
|
91
93
|
<CapImage
|
|
@@ -115,6 +117,6 @@ const CarouselComponent = ({
|
|
|
115
117
|
</Carousel>
|
|
116
118
|
</div>
|
|
117
119
|
);
|
|
118
|
-
}
|
|
120
|
+
};
|
|
119
121
|
|
|
120
|
-
export default CarouselComponent;
|
|
122
|
+
export default CarouselComponent;
|
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
EXTERNAL_LINK,
|
|
35
35
|
GIF,
|
|
36
36
|
CAROUSEL,
|
|
37
|
+
MANUAL_CAROUSEL,
|
|
38
|
+
PRIMARY,
|
|
39
|
+
SECONDARY,
|
|
37
40
|
} from "./constants";
|
|
38
41
|
import TemplatePreview from "../../v2Components/TemplatePreview";
|
|
39
42
|
import {
|
|
@@ -85,6 +88,7 @@ import { PlatformContentFields } from "./components";
|
|
|
85
88
|
import { TRACK_CREATE_MPUSH } from "../App/constants";
|
|
86
89
|
import { validateExternalLink, validateDeepLink } from "./utils";
|
|
87
90
|
import messages from "./messages";
|
|
91
|
+
import { EXTERNAL_URL } from "../CreativesContainer/constants";
|
|
88
92
|
|
|
89
93
|
const MobilePushNew = ({
|
|
90
94
|
isFullMode,
|
|
@@ -236,7 +240,7 @@ const MobilePushNew = ({
|
|
|
236
240
|
return false;
|
|
237
241
|
}
|
|
238
242
|
|
|
239
|
-
return carouselData.every((card
|
|
243
|
+
return carouselData.every((card) => {
|
|
240
244
|
// Check if image is uploaded (currently only image media type is supported)
|
|
241
245
|
if (card.mediaType === 'image' && !card.imageUrl) {
|
|
242
246
|
return false;
|
|
@@ -244,7 +248,7 @@ const MobilePushNew = ({
|
|
|
244
248
|
|
|
245
249
|
// Check if buttons have proper link data when actionOnClick is true
|
|
246
250
|
if (card.buttons && card.buttons.length > 0) {
|
|
247
|
-
return card.buttons.every((button
|
|
251
|
+
return card.buttons.every((button) => {
|
|
248
252
|
if (button.actionOnClick) {
|
|
249
253
|
// Check if link is provided based on link type
|
|
250
254
|
if (button.linkType === DEEP_LINK && !button.deepLinkValue) {
|
|
@@ -630,11 +634,11 @@ const MobilePushNew = ({
|
|
|
630
634
|
androidContentData.actionOnClick = true;
|
|
631
635
|
|
|
632
636
|
// Determine link type based on saved CTA type (prioritize saved type over URL pattern)
|
|
633
|
-
if (androidMainCta.type ===
|
|
637
|
+
if (androidMainCta.type === EXTERNAL_URL) {
|
|
634
638
|
androidContentData.linkType = EXTERNAL_LINK;
|
|
635
639
|
androidContentData.externalLinkValue = androidMainCta.actionLink;
|
|
636
640
|
androidContentData.deepLinkValue = "";
|
|
637
|
-
} else if (androidMainCta.type ===
|
|
641
|
+
} else if (androidMainCta.type === DEEP_LINK) {
|
|
638
642
|
androidContentData.linkType = DEEP_LINK;
|
|
639
643
|
androidContentData.deepLinkValue = androidMainCta.actionLink;
|
|
640
644
|
androidContentData.externalLinkValue = "";
|
|
@@ -663,8 +667,8 @@ const MobilePushNew = ({
|
|
|
663
667
|
text: button.actionText || button.label || "",
|
|
664
668
|
index,
|
|
665
669
|
url: button.actionLink || "",
|
|
666
|
-
urlType: button.type ||
|
|
667
|
-
ctaType: index === 0 ?
|
|
670
|
+
urlType: button.type || DEEP_LINK,
|
|
671
|
+
ctaType: index === 0 ? PRIMARY : SECONDARY,
|
|
668
672
|
isSaved: true, // Mark as saved since it's loaded from backend
|
|
669
673
|
}));
|
|
670
674
|
setCtaDataAndroid(ctaDataFromAndroid);
|
|
@@ -705,7 +709,7 @@ const MobilePushNew = ({
|
|
|
705
709
|
iosImageSrc = image || iosImage;
|
|
706
710
|
} else if (style === BIG_TEXT) {
|
|
707
711
|
iosMediaType = NONE;
|
|
708
|
-
} else if (style ===
|
|
712
|
+
} else if (style === MANUAL_CAROUSEL) {
|
|
709
713
|
iosMediaType = CAROUSEL;
|
|
710
714
|
}
|
|
711
715
|
|
|
@@ -880,7 +884,7 @@ const MobilePushNew = ({
|
|
|
880
884
|
setIosDeepLinkError(iosDeepLinkUrlError || "");
|
|
881
885
|
|
|
882
886
|
// Check for carousel link errors
|
|
883
|
-
const hasCarouselErrors = Object.values(carouselLinkErrors).some(error => error !== null && error !== "");
|
|
887
|
+
const hasCarouselErrors = Object.values(carouselLinkErrors).some((error) => error !== null && error !== "");
|
|
884
888
|
|
|
885
889
|
if (androidUrlError || iosUrlError || androidDeepLinkUrlError || iosDeepLinkUrlError || hasCarouselErrors) {
|
|
886
890
|
CapNotification.error({
|
|
@@ -1143,7 +1147,6 @@ const MobilePushNew = ({
|
|
|
1143
1147
|
handleMessageChange,
|
|
1144
1148
|
handleTagSelect,
|
|
1145
1149
|
handleMediaTypeChange,
|
|
1146
|
-
handleButtonChange,
|
|
1147
1150
|
handleActionOnClickChange,
|
|
1148
1151
|
handleLinkTypeChange,
|
|
1149
1152
|
} = usePlatformSync({
|
|
@@ -1331,8 +1334,8 @@ const MobilePushNew = ({
|
|
|
1331
1334
|
// Always map to { label } for both platforms
|
|
1332
1335
|
const newButtons = Array.isArray(ctaData)
|
|
1333
1336
|
? ctaData.map((data) => ({
|
|
1334
|
-
|
|
1335
|
-
|
|
1337
|
+
label: data?.text || '',
|
|
1338
|
+
}))
|
|
1336
1339
|
: [];
|
|
1337
1340
|
|
|
1338
1341
|
if (activeTab === ANDROID) {
|
|
@@ -1442,8 +1445,8 @@ const MobilePushNew = ({
|
|
|
1442
1445
|
updateOnMpushImageReUpload,
|
|
1443
1446
|
imageData,
|
|
1444
1447
|
// Create separate asset lists for VIDEO and GIF - use platform-specific lists
|
|
1445
|
-
videoAssetList: currentContent?.mediaType ===
|
|
1446
|
-
gifAssetList: currentContent?.mediaType ===
|
|
1448
|
+
videoAssetList: currentContent?.mediaType === VIDEO ? (activeTab === ANDROID ? androidAssetList : iosAssetList) : {},
|
|
1449
|
+
gifAssetList: currentContent?.mediaType === GIF ? (activeTab === ANDROID ? androidAssetList : iosAssetList) : {},
|
|
1447
1450
|
setUpdateMpushVideoSrc,
|
|
1448
1451
|
// Add video content state for fallback when Redux is empty (same pattern as imageSrc)
|
|
1449
1452
|
videoSrc: {
|
|
@@ -1472,6 +1475,7 @@ const MobilePushNew = ({
|
|
|
1472
1475
|
setCarouselActiveTabIndex,
|
|
1473
1476
|
carouselLinkErrors,
|
|
1474
1477
|
updateCarouselLinkError,
|
|
1478
|
+
linkProps: { deepLink },
|
|
1475
1479
|
};
|
|
1476
1480
|
|
|
1477
1481
|
const ctaButtonProps = {
|
|
@@ -1699,33 +1703,6 @@ const MobilePushNew = ({
|
|
|
1699
1703
|
? videoState?.androidVideoPreview || ''
|
|
1700
1704
|
: videoState?.iosVideoPreview || '';
|
|
1701
1705
|
return uploadVideoPreview;
|
|
1702
|
-
// } // Removed
|
|
1703
|
-
|
|
1704
|
-
// When sync is enabled, allow fallbacks to other platform
|
|
1705
|
-
// if (content?.videoPreview) { // Removed
|
|
1706
|
-
// return content.videoPreview; // Removed
|
|
1707
|
-
// } // Removed
|
|
1708
|
-
|
|
1709
|
-
// const otherPlatformContent = activeTab === ANDROID ? iosContent : androidContent; // Removed
|
|
1710
|
-
// if (otherPlatformContent?.videoPreview) { // Removed
|
|
1711
|
-
// return otherPlatformContent.videoPreview; // Removed
|
|
1712
|
-
// } // Removed
|
|
1713
|
-
|
|
1714
|
-
// // Check upload state with fallback to other platform - DEFENSIVE: ensure perfect symmetry
|
|
1715
|
-
// const currentPlatformVideoPreview = activeTab === ANDROID
|
|
1716
|
-
// ? videoState?.androidVideoPreview
|
|
1717
|
-
// : videoState?.iosVideoPreview;
|
|
1718
|
-
|
|
1719
|
-
// if (currentPlatformVideoPreview) {
|
|
1720
|
-
// return currentPlatformVideoPreview;
|
|
1721
|
-
// }
|
|
1722
|
-
|
|
1723
|
-
// // Fallback to other platform's upload state - DEFENSIVE: ensure perfect symmetry
|
|
1724
|
-
// const otherPlatformVideoPreview = activeTab === ANDROID
|
|
1725
|
-
// ? videoState?.iosVideoPreview
|
|
1726
|
-
// : videoState?.androidVideoPreview;
|
|
1727
|
-
|
|
1728
|
-
// return otherPlatformVideoPreview || '';
|
|
1729
1706
|
};
|
|
1730
1707
|
|
|
1731
1708
|
const videoSrc = getVideoSource();
|
|
@@ -1777,7 +1754,7 @@ const MobilePushNew = ({
|
|
|
1777
1754
|
>
|
|
1778
1755
|
<CapRow className="mobile-push-container">
|
|
1779
1756
|
<CapColumn className="content-section" span={14}>
|
|
1780
|
-
{
|
|
1757
|
+
{!isEditMode && createModeContent()}
|
|
1781
1758
|
<CapCheckbox
|
|
1782
1759
|
className="same-content-checkbox"
|
|
1783
1760
|
checked={sameContent}
|
|
@@ -1804,7 +1781,7 @@ const MobilePushNew = ({
|
|
|
1804
1781
|
}}
|
|
1805
1782
|
/>
|
|
1806
1783
|
|
|
1807
|
-
{
|
|
1784
|
+
{!isEditMode && (
|
|
1808
1785
|
<CapRow className="save-section">
|
|
1809
1786
|
<CapColumn span={24}>
|
|
1810
1787
|
<CapButton
|