@capillarytech/creatives-library 9.1.7 → 9.1.8-alpha.sprint-cap-214249.39
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/constants/unified.js +0 -1
- package/package.json +1 -1
- package/utils/common.js +0 -6
- package/utils/createMobilePushPayload.js +50 -33
- package/utils/tests/createMobilePushPayload.test.js +113 -8
- package/v2Components/CapMpushCTA/index.js +10 -9
- package/v2Components/CapMpushCTA/index.scss +29 -3
- package/v2Components/CapMpushCTA/tests/index.test.js +89 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +20 -12
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +13 -1
- package/v2Components/CommonTestAndPreview/constants.js +2 -0
- package/v2Components/CommonTestAndPreview/index.js +48 -10
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +81 -5
- package/v2Components/CommonTestAndPreview/tests/index.test.js +86 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +12 -2
- package/v2Components/TemplatePreview/index.js +24 -16
- package/v2Components/TemplatePreview/tests/index.test.js +68 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -6
- package/v2Containers/CreativesContainer/index.js +2 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +43 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +52 -47
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +297 -216
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +158 -125
- package/v2Containers/MobilePushNew/components/TapLinkActions.js +76 -0
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +30 -208
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +464 -108
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +106 -35
- package/v2Containers/MobilePushNew/constants.js +5 -0
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +63 -1
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +52 -0
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +40 -1
- package/v2Containers/MobilePushNew/hooks/useUpload.js +29 -39
- package/v2Containers/MobilePushNew/index.js +487 -235
- package/v2Containers/MobilePushNew/index.scss +205 -4
- package/v2Containers/MobilePushNew/messages.js +106 -6
- package/v2Containers/MobilePushNew/tests/index.test.js +469 -1
- package/v2Containers/MobilePushNew/tests/utils.test.js +70 -0
- package/v2Containers/MobilePushNew/utils.js +56 -0
- package/v2Containers/Templates/_templates.scss +10 -2
- package/v2Containers/Templates/index.js +83 -81
- package/v2Containers/Templates/tests/index.test.js +68 -0
|
@@ -19,10 +19,12 @@ import CapSpin from "@capillarytech/cap-ui-library/CapSpin";
|
|
|
19
19
|
import CapTab from "@capillarytech/cap-ui-library/CapTab";
|
|
20
20
|
import CapIcon from "@capillarytech/cap-ui-library/CapIcon";
|
|
21
21
|
import CapColumn from "@capillarytech/cap-ui-library/CapColumn";
|
|
22
|
+
import CapSelect from "@capillarytech/cap-ui-library/CapSelect";
|
|
22
23
|
import { intlShape, FormattedMessage } from "react-intl";
|
|
23
24
|
import "./index.scss";
|
|
24
25
|
import { GA } from "@capillarytech/cap-ui-utils";
|
|
25
26
|
import CapNotification from "@capillarytech/cap-ui-library/CapNotification";
|
|
27
|
+
import CapModal from "@capillarytech/cap-ui-library/CapModal";
|
|
26
28
|
import { DAEMON } from "@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes";
|
|
27
29
|
import globalMessages from "../Cap/messages";
|
|
28
30
|
import * as actions from "./actions";
|
|
@@ -30,6 +32,7 @@ import {
|
|
|
30
32
|
MEDIA_TYPES_OPTIONS,
|
|
31
33
|
ANDROID,
|
|
32
34
|
IOS,
|
|
35
|
+
BOTH_PLATFORMS,
|
|
33
36
|
MOBILE_PUSH_CHANNEL,
|
|
34
37
|
INITIAL_CONTENT,
|
|
35
38
|
BIG_PICTURE,
|
|
@@ -75,7 +78,6 @@ import {
|
|
|
75
78
|
import withCreatives from "../../hoc/withCreatives";
|
|
76
79
|
import { BIG_TEXT, DEEP_LINK, DEVICE_SUPPORTED } from "../InApp/constants";
|
|
77
80
|
import { v2MobilePushSagas } from "./sagas";
|
|
78
|
-
import { getContent } from "../MobilePush/commonMethods";
|
|
79
81
|
import { getMessageObject } from "../../utils/messageUtils";
|
|
80
82
|
import { gtmPush } from "../../utils/gtmTrackers";
|
|
81
83
|
import mobilePushReducer from "./reducer";
|
|
@@ -88,16 +90,17 @@ import useUpload from "./hooks/useUpload";
|
|
|
88
90
|
import { validateTags } from "../../utils/tagValidations";
|
|
89
91
|
import { PlatformContentFields } from "./components";
|
|
90
92
|
import { CREATE, EDIT, TRACK_CREATE_MPUSH } from "../App/constants";
|
|
91
|
-
import {
|
|
93
|
+
import {
|
|
94
|
+
validateExternalLink, validateDeepLink, isPlatformFieldsMissing, getContent, getCarouselCardIssue,
|
|
95
|
+
} from "./utils";
|
|
92
96
|
import messages from "./messages";
|
|
93
97
|
import { EXTERNAL_URL, MOBILE_PUSH } from "../CreativesContainer/constants";
|
|
94
|
-
import createMobilePushPayloadWithIntl from "../../utils/createMobilePushPayload";
|
|
98
|
+
import createMobilePushPayloadWithIntl, { buildCarouselCards } from "../../utils/createMobilePushPayload";
|
|
95
99
|
import { MOBILEPUSH } from "../../v2Components/CapVideoUpload/constants";
|
|
96
100
|
import { StyledCapTab } from "./style";
|
|
97
101
|
import TestAndPreviewSlidebox from "../../v2Components/TestAndPreviewSlidebox";
|
|
98
102
|
|
|
99
103
|
import creativesMessages from "../CreativesContainer/messages";
|
|
100
|
-
import { error } from "jquery";
|
|
101
104
|
|
|
102
105
|
// Helper function to extract deep link keys from URL where value equals key
|
|
103
106
|
const extractDeepLinkKeys = (deepLinkValue) => {
|
|
@@ -276,8 +279,50 @@ const processCtaButtons = (ctas, deepLink) => {
|
|
|
276
279
|
};
|
|
277
280
|
};
|
|
278
281
|
|
|
282
|
+
const getOtherPlatform = (platform) => (platform === ANDROID ? IOS : ANDROID);
|
|
283
|
+
|
|
284
|
+
// Title, message or media entered for a platform
|
|
285
|
+
const hasPlatformContent = (content) => !!(
|
|
286
|
+
content?.title?.trim()
|
|
287
|
+
|| content?.message?.trim()
|
|
288
|
+
|| (content?.mediaType && content.mediaType !== NONE)
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
// Platforms dropdown value for a saved template: whichever of ANDROID / IOS it has
|
|
292
|
+
const getSavedPlatformSelection = (base = {}) => {
|
|
293
|
+
const hasAndroid = !isEmpty(base?.ANDROID);
|
|
294
|
+
const hasIos = !isEmpty(base?.IOS);
|
|
295
|
+
if (hasAndroid && !hasIos) return ANDROID;
|
|
296
|
+
if (hasIos && !hasAndroid) return IOS;
|
|
297
|
+
return BOTH_PLATFORMS;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// Saved buttons in backend shape { actionText, type, actionLink }; used by Save and Test & Preview
|
|
301
|
+
const toSavedCtas = (ctaData = []) => (ctaData || [])
|
|
302
|
+
.filter((cta) => cta?.isSaved)
|
|
303
|
+
.map((cta) => {
|
|
304
|
+
let actionLink = cta?.url;
|
|
305
|
+
|
|
306
|
+
// Append deep link keys to URL if they exist
|
|
307
|
+
if (cta?.urlType === DEEP_LINK && cta?.deepLinkKeys?.length > 0) {
|
|
308
|
+
const deepLinkKeysArray = Array.isArray(cta?.deepLinkKeys) ? cta?.deepLinkKeys : [cta?.deepLinkKeys];
|
|
309
|
+
const validKeys = deepLinkKeysArray.filter((key) => typeof key === 'string' && key?.length > 0);
|
|
310
|
+
if (validKeys?.length > 0) {
|
|
311
|
+
const separator = actionLink.includes('?') ? '&' : '?';
|
|
312
|
+
const keyParams = validKeys.map((key) => `${key}=${key}`).join('&');
|
|
313
|
+
actionLink = `${actionLink}${separator}${keyParams}`;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
actionText: cta?.text,
|
|
319
|
+
type: cta?.urlType || DEEP_LINK,
|
|
320
|
+
actionLink,
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
|
|
279
324
|
// Helper function to create content data object
|
|
280
|
-
const createContentData =
|
|
325
|
+
const createContentData =(contentType, mediaInfo, buttons, deepLink, processCarouselDataForDeepLinks) => {
|
|
281
326
|
const {
|
|
282
327
|
mediaType,
|
|
283
328
|
imageSrc,
|
|
@@ -503,6 +548,9 @@ export const MobilePushNew = ({
|
|
|
503
548
|
supportedTags = [],
|
|
504
549
|
globalActions: globalActionsProps,
|
|
505
550
|
handleClose,
|
|
551
|
+
// Edit mode: footer Test & Preview button lives in CreativesContainer
|
|
552
|
+
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
553
|
+
handleCloseTestAndPreview: propsHandleCloseTestAndPreview,
|
|
506
554
|
fetchingLiquidValidation,
|
|
507
555
|
createTemplateError,
|
|
508
556
|
isGetFormData,
|
|
@@ -519,11 +567,30 @@ export const MobilePushNew = ({
|
|
|
519
567
|
const templateId = params?.id || templateData?._id || templateData?.id;
|
|
520
568
|
const isEditMode = !!templateId;
|
|
521
569
|
const computedCreativesMode = isEditMode || templateData?.type === MOBILEPUSH ? 'edit' : 'create';
|
|
522
|
-
|
|
570
|
+
// The checkbox tick; only syncs while both platforms are shown (see sameContent below)
|
|
571
|
+
const [sameContentChecked, setSameContent] = useState(false);
|
|
572
|
+
// Platforms dropdown: BOTH_PLATFORMS, ANDROID or IOS
|
|
573
|
+
const [platformSelection, setPlatformSelection] = useState(BOTH_PLATFORMS);
|
|
574
|
+
// Single platform waiting on the "Remove content" confirm
|
|
575
|
+
const [pendingPlatformSelection, setPendingPlatformSelection] = useState(null);
|
|
576
|
+
// Platform dropped by Both -> single; cleared after the switch, once sync is off
|
|
577
|
+
const [platformToClear, setPlatformToClear] = useState(null);
|
|
578
|
+
// Determine platform support from accountData
|
|
579
|
+
const isAndroidSupported = accountData?.configs?.android === '1';
|
|
580
|
+
const isIosSupported = accountData?.configs?.ios === '1';
|
|
581
|
+
// The Platforms dropdown only applies when the account supports both
|
|
582
|
+
const canChoosePlatforms = isAndroidSupported && isIosSupported;
|
|
583
|
+
// ANDROID or IOS when one platform is chosen, else null
|
|
584
|
+
const singlePlatform = canChoosePlatforms && platformSelection !== BOTH_PLATFORMS ? platformSelection : null;
|
|
585
|
+
const showAndroid = isAndroidSupported && singlePlatform !== IOS;
|
|
586
|
+
const showIos = isIosSupported && singlePlatform !== ANDROID;
|
|
587
|
+
const sameContent = sameContentChecked && !singlePlatform;
|
|
523
588
|
const [templateName, setTemplateName] = useState("");
|
|
524
589
|
const [spin, setSpin] = useState(false);
|
|
525
590
|
const [activeTab, setActiveTab] = useState(ANDROID);
|
|
526
591
|
const [templateNameError, setTemplateNameError] = useState(false);
|
|
592
|
+
// "Same content" tick waiting on the Replace confirm
|
|
593
|
+
const [isReplaceConfirmOpen, setIsReplaceConfirmOpen] = useState(false);
|
|
527
594
|
// Replace ctaData with platform-specific state
|
|
528
595
|
const [ctaDataAndroid, setCtaDataAndroid] = useState([]);
|
|
529
596
|
const [ctaDataIos, setCtaDataIos] = useState([]);
|
|
@@ -652,52 +719,9 @@ export const MobilePushNew = ({
|
|
|
652
719
|
const createTimeoutRef = useRef(null);
|
|
653
720
|
|
|
654
721
|
// Function to validate carousel data completeness
|
|
655
|
-
const validateCarouselData = useCallback((carouselData = []) =>
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
return carouselData.every((card) => {
|
|
661
|
-
// Check if image is uploaded (currently only image media type is supported)
|
|
662
|
-
if (card.mediaType === IMAGE.toLowerCase() && !card.imageUrl) {
|
|
663
|
-
return false;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// Check if buttons have proper link data when actionOnClick is true
|
|
667
|
-
if (card?.buttons?.length > 0) {
|
|
668
|
-
return card?.buttons?.every((button) => {
|
|
669
|
-
if (button.actionOnClick) {
|
|
670
|
-
// Check if link is provided based on link type
|
|
671
|
-
if (button.linkType === DEEP_LINK && !button.deepLinkValue) {
|
|
672
|
-
return false;
|
|
673
|
-
}
|
|
674
|
-
if (button.linkType === DEEP_LINK && button.deepLinkValue) {
|
|
675
|
-
// Check if the selected deep link has keys, and if so, require them
|
|
676
|
-
const selectedDeepLink = deepLink?.find((link) => link?.value === button.deepLinkValue);
|
|
677
|
-
const deepLinkKeysFromSelection = selectedDeepLink?.keys;
|
|
678
|
-
let deepLinkKeysFromSelectionArray = [];
|
|
679
|
-
if (Array.isArray(deepLinkKeysFromSelection)) {
|
|
680
|
-
deepLinkKeysFromSelectionArray = deepLinkKeysFromSelection;
|
|
681
|
-
} else if (deepLinkKeysFromSelection) {
|
|
682
|
-
deepLinkKeysFromSelectionArray = [deepLinkKeysFromSelection];
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
// Only require deep link keys if the selected deep link has keys defined
|
|
686
|
-
if (deepLinkKeysFromSelectionArray?.length > 0 && (!Array.isArray(button?.deepLinkKeys) || button?.deepLinkKeys?.length === 0)) {
|
|
687
|
-
return false;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
if (button.linkType === EXTERNAL_LINK && !button.externalLinkValue) {
|
|
691
|
-
return false;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
return true;
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
return true;
|
|
699
|
-
});
|
|
700
|
-
}, [deepLink]);
|
|
722
|
+
const validateCarouselData = useCallback((carouselData = []) => (
|
|
723
|
+
carouselData?.length > 0 && carouselData.every((card) => !getCarouselCardIssue(card, deepLink))
|
|
724
|
+
), [deepLink]);
|
|
701
725
|
|
|
702
726
|
// Function to check if carousel data is valid for both platforms
|
|
703
727
|
const isCarouselDataValid = useCallback(() => {
|
|
@@ -753,6 +777,9 @@ export const MobilePushNew = ({
|
|
|
753
777
|
setPrimaryButtonIos(false);
|
|
754
778
|
setSecondaryButtonIos(false);
|
|
755
779
|
setSameContent(false);
|
|
780
|
+
setPlatformSelection(BOTH_PLATFORMS);
|
|
781
|
+
setPendingPlatformSelection(null);
|
|
782
|
+
setPlatformToClear(null);
|
|
756
783
|
setTemplateNameError(false);
|
|
757
784
|
setAndroidTitleError("");
|
|
758
785
|
setAndroidMessageError("");
|
|
@@ -966,6 +993,8 @@ export const MobilePushNew = ({
|
|
|
966
993
|
templateNameRef.current = name;
|
|
967
994
|
});
|
|
968
995
|
|
|
996
|
+
stateUpdates.push(() => setPlatformSelection(getSavedPlatformSelection(editContent)));
|
|
997
|
+
|
|
969
998
|
// Process Android content
|
|
970
999
|
const androidContentType = editContent?.ANDROID;
|
|
971
1000
|
if (!isEmpty(androidContentType)) {
|
|
@@ -1101,6 +1130,8 @@ export const MobilePushNew = ({
|
|
|
1101
1130
|
templateNameRef.current = name;
|
|
1102
1131
|
});
|
|
1103
1132
|
|
|
1133
|
+
stateUpdates.push(() => setPlatformSelection(getSavedPlatformSelection(templateContent)));
|
|
1134
|
+
|
|
1104
1135
|
// Process Android content
|
|
1105
1136
|
const androidContentType = templateContent?.ANDROID;
|
|
1106
1137
|
if (!isEmpty(androidContentType)) {
|
|
@@ -1736,10 +1767,6 @@ export const MobilePushNew = ({
|
|
|
1736
1767
|
setSpin(false);
|
|
1737
1768
|
}, [templateData, isFullMode, deepLink, setUpdateMpushImageSrc, setUpdateMpushVideoSrc]);
|
|
1738
1769
|
|
|
1739
|
-
// Determine platform support from accountData
|
|
1740
|
-
const isAndroidSupported = accountData?.configs?.android === '1';
|
|
1741
|
-
const isIosSupported = accountData?.configs?.ios === '1';
|
|
1742
|
-
|
|
1743
1770
|
// Notify parent when personalization tokens are added/removed (for anonymous user flow)
|
|
1744
1771
|
useEffect(() => {
|
|
1745
1772
|
if (!restrictPersonalization || typeof onPersonalizationTokensChange !== 'function') return;
|
|
@@ -1748,8 +1775,8 @@ export const MobilePushNew = ({
|
|
|
1748
1775
|
|| (value.includes('[') && value.includes(']'))
|
|
1749
1776
|
);
|
|
1750
1777
|
const hasTokens = (
|
|
1751
|
-
(
|
|
1752
|
-
|| (
|
|
1778
|
+
(showAndroid && (hasToken(androidContent?.title) || hasToken(androidContent?.message)))
|
|
1779
|
+
|| (showIos && (hasToken(iosContent?.title) || hasToken(iosContent?.message)))
|
|
1753
1780
|
);
|
|
1754
1781
|
onPersonalizationTokensChange(hasTokens);
|
|
1755
1782
|
}, [
|
|
@@ -1758,18 +1785,21 @@ export const MobilePushNew = ({
|
|
|
1758
1785
|
androidContent?.message,
|
|
1759
1786
|
iosContent?.title,
|
|
1760
1787
|
iosContent?.message,
|
|
1761
|
-
|
|
1762
|
-
|
|
1788
|
+
showAndroid,
|
|
1789
|
+
showIos,
|
|
1763
1790
|
onPersonalizationTokensChange,
|
|
1764
1791
|
]);
|
|
1765
1792
|
|
|
1766
|
-
// Validation logic for template creation/update.
|
|
1767
|
-
const isAndroidFieldsMissing = isPlatformFieldsMissing(
|
|
1768
|
-
const isIosFieldsMissing = isPlatformFieldsMissing(
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1793
|
+
// Validation logic for template creation/update; a platform left out by the dropdown is never missing.
|
|
1794
|
+
const isAndroidFieldsMissing = isPlatformFieldsMissing(showAndroid, androidContent);
|
|
1795
|
+
const isIosFieldsMissing = isPlatformFieldsMissing(showIos, iosContent);
|
|
1796
|
+
// Every shown platform needs a title and message before Save
|
|
1797
|
+
const isMobilePushContentMissing = isAndroidFieldsMissing || isIosFieldsMissing;
|
|
1798
|
+
// Test & Preview only needs one platform filled
|
|
1799
|
+
const isAllContentMissing = (
|
|
1800
|
+
(showAndroid || showIos)
|
|
1801
|
+
&& (!showAndroid || isAndroidFieldsMissing)
|
|
1802
|
+
&& (!showIos || isIosFieldsMissing)
|
|
1773
1803
|
);
|
|
1774
1804
|
|
|
1775
1805
|
// Ref to dedupe reporting of content emptiness to the parent, so we only
|
|
@@ -1793,8 +1823,7 @@ export const MobilePushNew = ({
|
|
|
1793
1823
|
handleMessageChange,
|
|
1794
1824
|
handleTagSelect,
|
|
1795
1825
|
handleMediaTypeChange,
|
|
1796
|
-
|
|
1797
|
-
handleLinkTypeChange,
|
|
1826
|
+
handleTapActionChange,
|
|
1798
1827
|
} = usePlatformSync({
|
|
1799
1828
|
setAndroidContent,
|
|
1800
1829
|
setIosContent,
|
|
@@ -1866,9 +1895,21 @@ export const MobilePushNew = ({
|
|
|
1866
1895
|
}
|
|
1867
1896
|
}, [sameContent]);
|
|
1868
1897
|
|
|
1898
|
+
// Notification tap link Save / edit (both tabs when synced)
|
|
1899
|
+
const handleTapLinkSavedChange = useCallback((platform, tapLinkSaved) => {
|
|
1900
|
+
const update = (prev) => ({ ...prev, tapLinkSaved });
|
|
1901
|
+
if (platform === ANDROID || sameContent) setAndroidContent(update);
|
|
1902
|
+
if (platform === IOS || sameContent) setIosContent(update);
|
|
1903
|
+
}, [sameContent]);
|
|
1904
|
+
|
|
1905
|
+
// Notification tap URL: required once External link is chosen; same message as the button form
|
|
1906
|
+
const getTapUrlError = useCallback((url) => (
|
|
1907
|
+
!url?.trim() || validateExternalLink(url, formatMessage, messages) ? formatMessage(messages.urlNotValid) : ""
|
|
1908
|
+
), [formatMessage]);
|
|
1909
|
+
|
|
1869
1910
|
const handleExternalLinkChange = useCallback((platform, externalLinkValue) => {
|
|
1870
1911
|
// Validate URL
|
|
1871
|
-
const urlError =
|
|
1912
|
+
const urlError = getTapUrlError(externalLinkValue);
|
|
1872
1913
|
|
|
1873
1914
|
const updateContent = {
|
|
1874
1915
|
externalLinkValue,
|
|
@@ -1895,7 +1936,7 @@ export const MobilePushNew = ({
|
|
|
1895
1936
|
setAndroidExternalLinkError(urlError || "");
|
|
1896
1937
|
}
|
|
1897
1938
|
}
|
|
1898
|
-
}, [
|
|
1939
|
+
}, [getTapUrlError, sameContent]);
|
|
1899
1940
|
|
|
1900
1941
|
// Carousel data handler for platform-specific carousel management
|
|
1901
1942
|
const updateCarouselLinkError = useCallback((cardIndex, field, error) => {
|
|
@@ -2042,11 +2083,20 @@ export const MobilePushNew = ({
|
|
|
2042
2083
|
handleTitleChange,
|
|
2043
2084
|
handleMessageChange,
|
|
2044
2085
|
handleMediaTypeChange,
|
|
2045
|
-
|
|
2046
|
-
|
|
2086
|
+
handleTapActionChange: (value) => {
|
|
2087
|
+
handleTapActionChange(platform, value);
|
|
2088
|
+
// The old link field is gone, so are its errors (on both tabs when synced)
|
|
2089
|
+
[platform, ...(sameContent ? [getOtherPlatform(platform)] : [])].forEach((target) => {
|
|
2090
|
+
const isAndroidTarget = target === ANDROID;
|
|
2091
|
+
(isAndroidTarget ? setAndroidExternalLinkError : setIosExternalLinkError)("");
|
|
2092
|
+
(isAndroidTarget ? setAndroidDeepLinkError : setIosDeepLinkError)("");
|
|
2093
|
+
(isAndroidTarget ? setAndroidDeepLinkKeysError : setIosDeepLinkKeysError)("");
|
|
2094
|
+
});
|
|
2095
|
+
},
|
|
2047
2096
|
handleDeepLinkChange: (value) => handleDeepLinkChange(platform, value),
|
|
2048
2097
|
handleDeepLinkKeysChange: (value) => handleDeepLinkKeysChange(platform, value),
|
|
2049
2098
|
handleExternalLinkChange: (value) => handleExternalLinkChange(platform, value),
|
|
2099
|
+
handleTapLinkSavedChange: (isSaved) => handleTapLinkSavedChange(platform, isSaved),
|
|
2050
2100
|
onTagSelect,
|
|
2051
2101
|
handleOnTagsContextChange,
|
|
2052
2102
|
};
|
|
@@ -2166,7 +2216,7 @@ export const MobilePushNew = ({
|
|
|
2166
2216
|
restrictPersonalization={restrictPersonalization}
|
|
2167
2217
|
/>
|
|
2168
2218
|
);
|
|
2169
|
-
}, [androidContent, iosContent, androidTitleError, iosTitleError, androidMessageError, iosMessageError, androidExternalLinkError, iosExternalLinkError, androidDeepLinkError, iosDeepLinkError, androidDeepLinkKeysError, iosDeepLinkKeysError, formatMessage, activeTab, imageSrc, isFullMode, imageData, androidAssetList, iosAssetList, videoState, videoData, location, tags, injectedTags, selectedOfferDetails, primaryButtonAndroid, secondaryButtonAndroid, primaryButtonIos, secondaryButtonIos, ctaData, deepLink, mobilePushActions, carouselActiveTabIndex, carouselLinkErrors, handleTitleChange, handleMessageChange, handleMediaTypeChange,
|
|
2219
|
+
}, [androidContent, iosContent, androidTitleError, iosTitleError, androidMessageError, iosMessageError, androidExternalLinkError, iosExternalLinkError, androidDeepLinkError, iosDeepLinkError, androidDeepLinkKeysError, iosDeepLinkKeysError, formatMessage, activeTab, imageSrc, isFullMode, imageData, androidAssetList, iosAssetList, videoState, videoData, location, tags, injectedTags, selectedOfferDetails, primaryButtonAndroid, secondaryButtonAndroid, primaryButtonIos, secondaryButtonIos, ctaData, deepLink, mobilePushActions, carouselActiveTabIndex, carouselLinkErrors, handleTitleChange, handleMessageChange, handleMediaTypeChange, handleTapActionChange, handleDeepLinkChange, handleDeepLinkKeysChange, handleExternalLinkChange, handleTapLinkSavedChange, onTagSelect, handleOnTagsContextChange, setUpdateMpushImageSrc, updateOnMpushImageReUpload, setUpdateMpushVideoSrc, updateOnMpushVideoReUpload, clearImageDataByMediaType, handleCarouselDataChange, updateCarouselLinkError, sameContent, updateHandler, deleteHandler]
|
|
2170
2220
|
);
|
|
2171
2221
|
|
|
2172
2222
|
// PANES: Only render enabled platforms
|
|
@@ -2176,8 +2226,8 @@ export const MobilePushNew = ({
|
|
|
2176
2226
|
panes.push({
|
|
2177
2227
|
key: ANDROID,
|
|
2178
2228
|
tab: (
|
|
2179
|
-
<CapRow
|
|
2180
|
-
<CapIcon type="android" />
|
|
2229
|
+
<CapRow type="flex" align="middle" noWrap className="tab-label">
|
|
2230
|
+
<CapIcon type="android" size="s" />
|
|
2181
2231
|
{formatMessage(messages.android)}
|
|
2182
2232
|
</CapRow>
|
|
2183
2233
|
),
|
|
@@ -2188,8 +2238,8 @@ export const MobilePushNew = ({
|
|
|
2188
2238
|
panes.push({
|
|
2189
2239
|
key: IOS,
|
|
2190
2240
|
tab: (
|
|
2191
|
-
<CapRow
|
|
2192
|
-
<CapIcon type="ios" />
|
|
2241
|
+
<CapRow type="flex" align="middle" noWrap className="tab-label">
|
|
2242
|
+
<CapIcon type="ios" size="s" />
|
|
2193
2243
|
{formatMessage(messages.ios)}
|
|
2194
2244
|
</CapRow>
|
|
2195
2245
|
),
|
|
@@ -2202,25 +2252,42 @@ export const MobilePushNew = ({
|
|
|
2202
2252
|
const errorInTitle = activeTab === ANDROID ? androidTitleError : iosTitleError;
|
|
2203
2253
|
const errorInMessage = activeTab === ANDROID ? androidMessageError : iosMessageError;
|
|
2204
2254
|
|
|
2205
|
-
//
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2255
|
+
// A tap link (notification or carousel card) opened but its Save not clicked yet
|
|
2256
|
+
const hasUnsavedTapLink = [showAndroid && androidContent, showIos && iosContent].some((content) => {
|
|
2257
|
+
if (!content) return false;
|
|
2258
|
+
if (content.mediaType === CAROUSEL) {
|
|
2259
|
+
return (content.carouselData || []).some((card) => card?.buttons?.some((button) => button?.actionOnClick && button?.isSaved === false));
|
|
2260
|
+
}
|
|
2261
|
+
return content.actionOnClick && content.tapLinkSaved === false;
|
|
2262
|
+
});
|
|
2263
|
+
|
|
2264
|
+
const hasFormErrors = (
|
|
2265
|
+
templateNameError
|
|
2210
2266
|
|| Object.values(carouselLinkErrors).some((error) => error !== null && error !== "")
|
|
2211
2267
|
|| !isCarouselDataValid()
|
|
2268
|
+
|| hasUnsavedTapLink
|
|
2212
2269
|
|| errorInTitle || errorInMessage
|
|
2213
2270
|
);
|
|
2271
|
+
// Save needs every shown platform filled
|
|
2272
|
+
const isSaveDisabled = isMobilePushContentMissing || hasFormErrors;
|
|
2273
|
+
const isTestAndPreviewDisabled = isAllContentMissing || hasFormErrors;
|
|
2214
2274
|
|
|
2215
|
-
// Validation in handleSave:
|
|
2216
|
-
// allow saving with just one supported platform filled in.
|
|
2275
|
+
// Validation in handleSave: every shown platform needs a title and message (no save-without dialog)
|
|
2217
2276
|
const handleSave = useCallback(() => {
|
|
2218
2277
|
if (isMobilePushContentMissing) {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2278
|
+
const missingPlatforms = [
|
|
2279
|
+
[ANDROID, isAndroidFieldsMissing, androidContent],
|
|
2280
|
+
[IOS, isIosFieldsMissing, iosContent],
|
|
2281
|
+
].filter(([, isMissing]) => isMissing);
|
|
2282
|
+
missingPlatforms.forEach(([platform, , content]) => {
|
|
2283
|
+
const isAndroid = platform === ANDROID;
|
|
2284
|
+
(isAndroid ? setAndroidTitleError : setIosTitleError)(validateTitle(content?.title));
|
|
2285
|
+
(isAndroid ? setAndroidMessageError : setIosMessageError)(validateMessage(content?.message));
|
|
2223
2286
|
});
|
|
2287
|
+
// Open a tab that has the errors, unless the open one already does
|
|
2288
|
+
if (!missingPlatforms.some(([platform]) => platform === activeTab)) {
|
|
2289
|
+
setActiveTab(missingPlatforms[0][0]);
|
|
2290
|
+
}
|
|
2224
2291
|
if (onValidationFail) onValidationFail();
|
|
2225
2292
|
return;
|
|
2226
2293
|
}
|
|
@@ -2244,32 +2311,38 @@ export const MobilePushNew = ({
|
|
|
2244
2311
|
// Use ref to get the latest template name value to avoid closure issues
|
|
2245
2312
|
let finalTemplateName = templateNameRef.current || templateName;
|
|
2246
2313
|
if (!isFullMode && (!finalTemplateName || !finalTemplateName.trim())) {
|
|
2247
|
-
if (androidContent?.title && androidContent.title.trim()) {
|
|
2314
|
+
if (showAndroid && androidContent?.title && androidContent.title.trim()) {
|
|
2248
2315
|
finalTemplateName = androidContent.title.trim();
|
|
2249
|
-
} else if (iosContent?.title && iosContent.title.trim()) {
|
|
2316
|
+
} else if (showIos && iosContent?.title && iosContent.title.trim()) {
|
|
2250
2317
|
finalTemplateName = iosContent.title.trim();
|
|
2251
2318
|
} else {
|
|
2252
2319
|
finalTemplateName = '';
|
|
2253
2320
|
}
|
|
2254
2321
|
}
|
|
2255
2322
|
|
|
2256
|
-
// Validate
|
|
2257
|
-
const
|
|
2258
|
-
const
|
|
2323
|
+
// Validate the notification tap URL (only platforms that are saved, only when External link is chosen)
|
|
2324
|
+
const isTapExternalLink = (content) => content?.actionOnClick && content?.linkType === EXTERNAL_LINK;
|
|
2325
|
+
const androidUrlError = showAndroid && isTapExternalLink(androidContent) && getTapUrlError(androidContent.externalLinkValue);
|
|
2326
|
+
const iosUrlError = showIos && isTapExternalLink(iosContent) && getTapUrlError(iosContent.externalLinkValue);
|
|
2259
2327
|
|
|
2260
2328
|
setAndroidExternalLinkError(androidUrlError || "");
|
|
2261
2329
|
setIosExternalLinkError(iosUrlError || "");
|
|
2262
2330
|
|
|
2263
|
-
// Validate deep links
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2331
|
+
// Validate deep links; Deep link chosen as the tap action needs one picked
|
|
2332
|
+
const getTapDeepLinkError = (content) => (
|
|
2333
|
+
content?.actionOnClick && content?.linkType === DEEP_LINK && !content?.deepLinkValue
|
|
2334
|
+
? formatMessage(messages.deepLinkRequired)
|
|
2335
|
+
: validateDeepLink(content?.deepLinkValue, formatMessage, messages)
|
|
2336
|
+
);
|
|
2337
|
+
const androidDeepLinkUrlError = showAndroid && getTapDeepLinkError(androidContent);
|
|
2338
|
+
const iosDeepLinkUrlError = showIos && getTapDeepLinkError(iosContent);
|
|
2266
2339
|
|
|
2267
2340
|
setAndroidDeepLinkError(androidDeepLinkUrlError || "");
|
|
2268
2341
|
setIosDeepLinkError(iosDeepLinkUrlError || "");
|
|
2269
2342
|
|
|
2270
2343
|
// Validate deep link keys - only require keys if the selected deep link has keys defined
|
|
2271
2344
|
const androidDeepLinkKeysErrorMsg = (() => {
|
|
2272
|
-
if (androidContent?.linkType === DEEP_LINK && androidContent?.deepLinkValue) {
|
|
2345
|
+
if (showAndroid && androidContent?.linkType === DEEP_LINK && androidContent?.deepLinkValue) {
|
|
2273
2346
|
// Use the same matching logic as deep link value extraction
|
|
2274
2347
|
let selectedDeepLink = null;
|
|
2275
2348
|
|
|
@@ -2293,7 +2366,7 @@ export const MobilePushNew = ({
|
|
|
2293
2366
|
})();
|
|
2294
2367
|
|
|
2295
2368
|
const iosDeepLinkKeysErrorMsg = (() => {
|
|
2296
|
-
if (iosContent?.linkType === DEEP_LINK && iosContent?.deepLinkValue) {
|
|
2369
|
+
if (showIos && iosContent?.linkType === DEEP_LINK && iosContent?.deepLinkValue) {
|
|
2297
2370
|
// Use the same matching logic as deep link value extraction
|
|
2298
2371
|
let selectedDeepLink = null;
|
|
2299
2372
|
|
|
@@ -2322,6 +2395,15 @@ export const MobilePushNew = ({
|
|
|
2322
2395
|
// Check for carousel link errors
|
|
2323
2396
|
const hasCarouselErrors = Object.values(carouselLinkErrors).some((error) => error !== null && error !== "");
|
|
2324
2397
|
|
|
2398
|
+
// The host can trigger save without the (disabled) Save button
|
|
2399
|
+
if (hasUnsavedTapLink) {
|
|
2400
|
+
CapNotification.error({ message: formatMessage(messages.saveTapLinkFirst) });
|
|
2401
|
+
if (onValidationFail) {
|
|
2402
|
+
onValidationFail();
|
|
2403
|
+
}
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2325
2407
|
if (androidUrlError || iosUrlError || androidDeepLinkUrlError || iosDeepLinkUrlError || androidDeepLinkKeysErrorMsg || iosDeepLinkKeysErrorMsg || hasCarouselErrors) {
|
|
2326
2408
|
CapNotification.error({
|
|
2327
2409
|
message: formatMessage(messages.invalidUrl),
|
|
@@ -2338,74 +2420,34 @@ export const MobilePushNew = ({
|
|
|
2338
2420
|
const processedIosContent = { ...iosContent };
|
|
2339
2421
|
|
|
2340
2422
|
// Process button CTA data if it exists
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
processedAndroidContent.expandableDetails
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
let actionLink = cta?.url;
|
|
2348
|
-
|
|
2349
|
-
// Append deep link keys to URL if they exist
|
|
2350
|
-
if (cta?.urlType === DEEP_LINK && cta?.deepLinkKeys?.length > 0) {
|
|
2351
|
-
const deepLinkKeysArray = Array.isArray(cta?.deepLinkKeys) ? cta?.deepLinkKeys : [cta?.deepLinkKeys];
|
|
2352
|
-
const validKeys = deepLinkKeysArray.filter((key) => typeof key === 'string' && key?.length > 0);
|
|
2353
|
-
if (validKeys?.length > 0) {
|
|
2354
|
-
const separator = actionLink.includes('?') ? '&' : '?';
|
|
2355
|
-
const keyParams = validKeys.map((key) => `${key}=${key}`).join('&');
|
|
2356
|
-
actionLink = `${actionLink}${separator}${keyParams}`;
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
return {
|
|
2361
|
-
actionText: cta?.text,
|
|
2362
|
-
type: cta?.urlType || DEEP_LINK,
|
|
2363
|
-
actionLink,
|
|
2364
|
-
};
|
|
2365
|
-
}),
|
|
2366
|
-
};
|
|
2367
|
-
}
|
|
2423
|
+
const savedAndroidCtas = toSavedCtas(ctaDataAndroid);
|
|
2424
|
+
if (savedAndroidCtas.length > 0) {
|
|
2425
|
+
processedAndroidContent.expandableDetails = {
|
|
2426
|
+
...processedAndroidContent.expandableDetails,
|
|
2427
|
+
ctas: savedAndroidCtas,
|
|
2428
|
+
};
|
|
2368
2429
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
processedIosContent.expandableDetails
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
let actionLink = cta?.url;
|
|
2376
|
-
|
|
2377
|
-
// Append deep link keys to URL if they exist
|
|
2378
|
-
if (cta?.urlType === DEEP_LINK && cta?.deepLinkKeys?.length > 0) {
|
|
2379
|
-
const deepLinkKeysArray = Array.isArray(cta?.deepLinkKeys) ? cta?.deepLinkKeys : [cta?.deepLinkKeys];
|
|
2380
|
-
const validKeys = deepLinkKeysArray.filter((key) => typeof key === 'string' && key?.length > 0);
|
|
2381
|
-
if (validKeys?.length > 0) {
|
|
2382
|
-
const separator = actionLink.includes('?') ? '&' : '?';
|
|
2383
|
-
const keyParams = validKeys.map((key) => `${key}=${key}`).join('&');
|
|
2384
|
-
actionLink = `${actionLink}${separator}${keyParams}`;
|
|
2385
|
-
}
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
return {
|
|
2389
|
-
actionText: cta?.text,
|
|
2390
|
-
type: cta?.urlType || DEEP_LINK,
|
|
2391
|
-
actionLink,
|
|
2392
|
-
};
|
|
2393
|
-
}),
|
|
2394
|
-
};
|
|
2395
|
-
}
|
|
2430
|
+
const savedIosCtas = toSavedCtas(ctaDataIos);
|
|
2431
|
+
if (savedIosCtas.length > 0) {
|
|
2432
|
+
processedIosContent.expandableDetails = {
|
|
2433
|
+
...processedIosContent.expandableDetails,
|
|
2434
|
+
ctas: savedIosCtas,
|
|
2435
|
+
};
|
|
2396
2436
|
}
|
|
2397
2437
|
|
|
2398
2438
|
// Create payload with enabled platform content and intl
|
|
2399
2439
|
const payload = createMobilePushPayloadWithIntl({
|
|
2400
2440
|
templateName: finalTemplateName,
|
|
2401
|
-
androidContent:
|
|
2402
|
-
iosContent:
|
|
2441
|
+
androidContent: showAndroid ? processedAndroidContent : undefined,
|
|
2442
|
+
iosContent: showIos ? processedIosContent : undefined,
|
|
2403
2443
|
imageSrc,
|
|
2404
2444
|
mpushVideoSrcAndPreview,
|
|
2405
2445
|
accountData,
|
|
2406
2446
|
sameContent,
|
|
2407
2447
|
options: {
|
|
2408
2448
|
mode: params?.mode,
|
|
2449
|
+
// One platform chosen: leave the other platform's key out of versions.base
|
|
2450
|
+
skipPlatform: singlePlatform ? getOtherPlatform(singlePlatform) : undefined,
|
|
2409
2451
|
},
|
|
2410
2452
|
intl,
|
|
2411
2453
|
});
|
|
@@ -2596,7 +2638,7 @@ export const MobilePushNew = ({
|
|
|
2596
2638
|
globalActionsProps,
|
|
2597
2639
|
onValidationFail,
|
|
2598
2640
|
resetFormData,
|
|
2599
|
-
|
|
2641
|
+
getTapUrlError,
|
|
2600
2642
|
ctaDataAndroid,
|
|
2601
2643
|
ctaDataIos,
|
|
2602
2644
|
intl,
|
|
@@ -2604,8 +2646,17 @@ export const MobilePushNew = ({
|
|
|
2604
2646
|
createTimeoutRef,
|
|
2605
2647
|
isAndroidSupported,
|
|
2606
2648
|
isIosSupported,
|
|
2649
|
+
showAndroid,
|
|
2650
|
+
showIos,
|
|
2651
|
+
singlePlatform,
|
|
2652
|
+
activeTab,
|
|
2653
|
+
validateTitle,
|
|
2654
|
+
validateMessage,
|
|
2607
2655
|
isMobilePushContentMissing,
|
|
2656
|
+
isAndroidFieldsMissing,
|
|
2657
|
+
isIosFieldsMissing,
|
|
2608
2658
|
isCarouselDataValid,
|
|
2659
|
+
hasUnsavedTapLink,
|
|
2609
2660
|
isFullMode,
|
|
2610
2661
|
templateId,
|
|
2611
2662
|
savedTemplateId,
|
|
@@ -2700,38 +2751,30 @@ export const MobilePushNew = ({
|
|
|
2700
2751
|
getLiquidTags: globalActionsProps.getLiquidTags,
|
|
2701
2752
|
formatMessage,
|
|
2702
2753
|
messages: formBuilderMessages,
|
|
2703
|
-
|
|
2754
|
+
// One platform chosen: validate only that platform
|
|
2755
|
+
singleTab: singlePlatform || getSingleTab(accountData),
|
|
2704
2756
|
});
|
|
2705
2757
|
}, [
|
|
2706
2758
|
androidContent,
|
|
2707
2759
|
iosContent,
|
|
2708
2760
|
activeTab,
|
|
2761
|
+
singlePlatform,
|
|
2709
2762
|
globalActionsProps,
|
|
2710
2763
|
formatMessage,
|
|
2711
2764
|
accountData,
|
|
2712
2765
|
isFullMode,
|
|
2713
2766
|
]);
|
|
2714
2767
|
|
|
2768
|
+
// Each platform's preview buttons follow its own ctaData, so iOS shows before its tab is opened
|
|
2769
|
+
const toPreviewButtons = (ctas) => (Array.isArray(ctas) ? ctas.map((data) => ({ label: data?.text || '' })) : []);
|
|
2770
|
+
|
|
2715
2771
|
useEffect(() => {
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
if (activeTab === ANDROID) {
|
|
2724
|
-
setAndroidContent((prevContent) => ({
|
|
2725
|
-
...prevContent,
|
|
2726
|
-
buttons: newButtons,
|
|
2727
|
-
}));
|
|
2728
|
-
} else if (activeTab === IOS) {
|
|
2729
|
-
setIosContent((prevContent) => ({
|
|
2730
|
-
...prevContent,
|
|
2731
|
-
buttons: newButtons,
|
|
2732
|
-
}));
|
|
2733
|
-
}
|
|
2734
|
-
}, [ctaData, activeTab]);
|
|
2772
|
+
setAndroidContent((prevContent) => ({ ...prevContent, buttons: toPreviewButtons(ctaDataAndroid) }));
|
|
2773
|
+
}, [ctaDataAndroid]);
|
|
2774
|
+
|
|
2775
|
+
useEffect(() => {
|
|
2776
|
+
setIosContent((prevContent) => ({ ...prevContent, buttons: toPreviewButtons(ctaDataIos) }));
|
|
2777
|
+
}, [ctaDataIos]);
|
|
2735
2778
|
|
|
2736
2779
|
// Sync button data and state from active tab to other platform when sameContent is enabled
|
|
2737
2780
|
useEffect(() => {
|
|
@@ -2757,12 +2800,141 @@ export const MobilePushNew = ({
|
|
|
2757
2800
|
}
|
|
2758
2801
|
}, [sameContent, activeTab]);
|
|
2759
2802
|
|
|
2803
|
+
// What ticking "Same content" would copy over: text, media, links and buttons
|
|
2804
|
+
const getPlatformSnapshot = (platform) => {
|
|
2805
|
+
const isAndroid = platform === ANDROID;
|
|
2806
|
+
const content = isAndroid ? androidContent : iosContent;
|
|
2807
|
+
return JSON.stringify({
|
|
2808
|
+
title: content?.title || '',
|
|
2809
|
+
message: content?.message || '',
|
|
2810
|
+
mediaType: content?.mediaType || NONE,
|
|
2811
|
+
carouselData: content?.carouselData || [],
|
|
2812
|
+
actionOnClick: !!content?.actionOnClick,
|
|
2813
|
+
linkType: content?.linkType || '',
|
|
2814
|
+
deepLinkValue: content?.deepLinkValue || '',
|
|
2815
|
+
externalLinkValue: content?.externalLinkValue || '',
|
|
2816
|
+
image: (isAndroid ? imageSrc?.androidImageSrc : imageSrc?.iosImageSrc) || '',
|
|
2817
|
+
video: (isAndroid ? videoState?.androidVideoSrc : videoState?.iosVideoSrc) || '',
|
|
2818
|
+
buttons: toSavedCtas(isAndroid ? ctaDataAndroid : ctaDataIos),
|
|
2819
|
+
});
|
|
2820
|
+
};
|
|
2821
|
+
|
|
2760
2822
|
const handleSameContentChange = useCallback((e) => {
|
|
2761
2823
|
const isCurrentPlatformAndroid = activeTab === ANDROID;
|
|
2824
|
+
const otherContent = isCurrentPlatformAndroid ? iosContent : androidContent;
|
|
2825
|
+
// Ticking replaces the other tab: confirm when it has different content, not when it is empty
|
|
2826
|
+
if (e.target.checked && hasPlatformContent(otherContent) && getPlatformSnapshot(ANDROID) !== getPlatformSnapshot(IOS)) {
|
|
2827
|
+
setIsReplaceConfirmOpen(true);
|
|
2828
|
+
return;
|
|
2829
|
+
}
|
|
2762
2830
|
syncPlatformContent(isCurrentPlatformAndroid ? androidContent : iosContent, isCurrentPlatformAndroid ? ANDROID : IOS);
|
|
2763
2831
|
setSameContent(e.target.checked);
|
|
2832
|
+
}, [activeTab, androidContent, iosContent, imageSrc, videoState, ctaDataAndroid, ctaDataIos]);
|
|
2833
|
+
|
|
2834
|
+
const confirmSameContent = useCallback(() => {
|
|
2835
|
+
setIsReplaceConfirmOpen(false);
|
|
2836
|
+
syncPlatformContent(activeTab === ANDROID ? androidContent : iosContent, activeTab);
|
|
2837
|
+
setSameContent(true);
|
|
2764
2838
|
}, [activeTab, androidContent, iosContent]);
|
|
2765
2839
|
|
|
2840
|
+
// One platform chosen: its form is the only one shown, and the upload/button handlers follow activeTab
|
|
2841
|
+
useEffect(() => {
|
|
2842
|
+
if (singlePlatform && activeTab !== singlePlatform) {
|
|
2843
|
+
setActiveTab(singlePlatform);
|
|
2844
|
+
}
|
|
2845
|
+
}, [singlePlatform, activeTab]);
|
|
2846
|
+
|
|
2847
|
+
// Both -> single: empty the dropped platform. Runs after the switch so sync is off
|
|
2848
|
+
// and the kept platform's media stays.
|
|
2849
|
+
useEffect(() => {
|
|
2850
|
+
if (!platformToClear) return;
|
|
2851
|
+
const isAndroid = platformToClear === ANDROID;
|
|
2852
|
+
const platformIndex = isAndroid ? 0 : 1;
|
|
2853
|
+
clearImageDataByMediaType(IMAGE, platformToClear);
|
|
2854
|
+
clearImageDataByMediaType(VIDEO, platformToClear);
|
|
2855
|
+
// Uploaded-video list read by the upload box
|
|
2856
|
+
setUpdateMpushVideoSrc(platformIndex, {}, true);
|
|
2857
|
+
(isAndroid ? setAndroidContent : setIosContent)(INITIAL_CONTENT);
|
|
2858
|
+
(isAndroid ? setCtaDataAndroid : setCtaDataIos)([]);
|
|
2859
|
+
(isAndroid ? setPrimaryButtonAndroid : setPrimaryButtonIos)(false);
|
|
2860
|
+
(isAndroid ? setSecondaryButtonAndroid : setSecondaryButtonIos)(false);
|
|
2861
|
+
(isAndroid ? setAndroidTitleError : setIosTitleError)("");
|
|
2862
|
+
(isAndroid ? setAndroidMessageError : setIosMessageError)("");
|
|
2863
|
+
(isAndroid ? setAndroidExternalLinkError : setIosExternalLinkError)("");
|
|
2864
|
+
(isAndroid ? setAndroidDeepLinkError : setIosDeepLinkError)("");
|
|
2865
|
+
(isAndroid ? setAndroidDeepLinkKeysError : setIosDeepLinkKeysError)("");
|
|
2866
|
+
setPlatformToClear(null);
|
|
2867
|
+
}, [platformToClear, clearImageDataByMediaType, setUpdateMpushVideoSrc]);
|
|
2868
|
+
|
|
2869
|
+
// Android only <-> iOS only: give the empty target the current platform's content, buttons and media
|
|
2870
|
+
const copyPlatformContent = useCallback((source, target) => {
|
|
2871
|
+
const fromAndroid = source === ANDROID;
|
|
2872
|
+
const targetIndex = target === ANDROID ? 0 : 1;
|
|
2873
|
+
syncPlatformContent(fromAndroid ? androidContent : iosContent, source);
|
|
2874
|
+
(fromAndroid ? setCtaDataIos : setCtaDataAndroid)(cloneDeep(fromAndroid ? ctaDataAndroid : ctaDataIos));
|
|
2875
|
+
(fromAndroid ? setPrimaryButtonIos : setPrimaryButtonAndroid)(fromAndroid ? primaryButtonAndroid : primaryButtonIos);
|
|
2876
|
+
(fromAndroid ? setSecondaryButtonIos : setSecondaryButtonAndroid)(fromAndroid ? secondaryButtonAndroid : secondaryButtonIos);
|
|
2877
|
+
// Uploaded image/video live in the upload hook, per platform
|
|
2878
|
+
const sourceImage = fromAndroid ? imageSrc?.androidImageSrc : imageSrc?.iosImageSrc;
|
|
2879
|
+
if (sourceImage) {
|
|
2880
|
+
setUpdateMpushImageSrc(sourceImage, targetIndex, IMAGE);
|
|
2881
|
+
}
|
|
2882
|
+
const sourceVideo = fromAndroid ? videoState?.androidVideoSrc : videoState?.iosVideoSrc;
|
|
2883
|
+
if (sourceVideo) {
|
|
2884
|
+
setUpdateMpushVideoSrc(targetIndex, {
|
|
2885
|
+
...(fromAndroid ? androidAssetList : iosAssetList),
|
|
2886
|
+
videoSrc: sourceVideo,
|
|
2887
|
+
previewUrl: (fromAndroid ? videoState?.androidVideoPreview : videoState?.iosVideoPreview) || '',
|
|
2888
|
+
videoDuration: (fromAndroid ? videoState?.androidVideoDuration : videoState?.iosVideoDuration) || 0,
|
|
2889
|
+
}, true);
|
|
2890
|
+
}
|
|
2891
|
+
}, [androidContent, iosContent, ctaDataAndroid, ctaDataIos, primaryButtonAndroid, primaryButtonIos, secondaryButtonAndroid, secondaryButtonIos, imageSrc, videoState, androidAssetList, iosAssetList, setUpdateMpushImageSrc, setUpdateMpushVideoSrc]);
|
|
2892
|
+
|
|
2893
|
+
const handlePlatformChange = useCallback((value) => {
|
|
2894
|
+
if (value === platformSelection) return;
|
|
2895
|
+
const getPlatformContent = (platform) => (platform === ANDROID ? androidContent : iosContent);
|
|
2896
|
+
|
|
2897
|
+
if (platformSelection === BOTH_PLATFORMS) {
|
|
2898
|
+
// Both -> single: confirm before dropping a platform that has content
|
|
2899
|
+
if (hasPlatformContent(getPlatformContent(getOtherPlatform(value)))) {
|
|
2900
|
+
setPendingPlatformSelection(value);
|
|
2901
|
+
return;
|
|
2902
|
+
}
|
|
2903
|
+
setPlatformSelection(value);
|
|
2904
|
+
setPlatformToClear(getOtherPlatform(value));
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
if (value === BOTH_PLATFORMS) {
|
|
2909
|
+
// Single -> Both: content stays in its tab; a ticked "Same content" syncs it to the other tab
|
|
2910
|
+
// (media and buttons follow through the existing on-tick effects)
|
|
2911
|
+
if (sameContentChecked) {
|
|
2912
|
+
syncPlatformContent(getPlatformContent(platformSelection), platformSelection);
|
|
2913
|
+
}
|
|
2914
|
+
setPlatformSelection(value);
|
|
2915
|
+
return;
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
// Android only <-> iOS only: an empty target takes the current content
|
|
2919
|
+
if (!hasPlatformContent(getPlatformContent(value)) && hasPlatformContent(getPlatformContent(platformSelection))) {
|
|
2920
|
+
copyPlatformContent(platformSelection, value);
|
|
2921
|
+
}
|
|
2922
|
+
setPlatformSelection(value);
|
|
2923
|
+
}, [platformSelection, androidContent, iosContent, sameContentChecked, copyPlatformContent]);
|
|
2924
|
+
|
|
2925
|
+
const confirmPlatformRemoval = useCallback(() => {
|
|
2926
|
+
const value = pendingPlatformSelection;
|
|
2927
|
+
setPendingPlatformSelection(null);
|
|
2928
|
+
setPlatformSelection(value);
|
|
2929
|
+
setPlatformToClear(getOtherPlatform(value));
|
|
2930
|
+
}, [pendingPlatformSelection]);
|
|
2931
|
+
|
|
2932
|
+
const platformOptions = useMemo(() => [
|
|
2933
|
+
{ label: formatMessage(messages.androidAndIos), value: BOTH_PLATFORMS },
|
|
2934
|
+
{ label: formatMessage(messages.androidOnly), value: ANDROID },
|
|
2935
|
+
{ label: formatMessage(messages.iosOnly), value: IOS },
|
|
2936
|
+
], [formatMessage]);
|
|
2937
|
+
|
|
2766
2938
|
const getContentType = useCallback(
|
|
2767
2939
|
(content) => {
|
|
2768
2940
|
// Get image source from multiple possible locations
|
|
@@ -2890,6 +3062,10 @@ export const MobilePushNew = ({
|
|
|
2890
3062
|
'message-title': androidPreview?.header || androidContent?.title || '',
|
|
2891
3063
|
'message-editor': androidPreview?.bodyText || androidContent?.message || '',
|
|
2892
3064
|
image: androidPreview?.bodyImage || androidContent?.expandableDetails?.image || '',
|
|
3065
|
+
// Video only for now. This tab's own videoSrc: the preview falls back to the visible tab's video
|
|
3066
|
+
video: androidContent?.mediaType === VIDEO ? (androidContent?.videoSrc || '') : '',
|
|
3067
|
+
// Same cards Save sends
|
|
3068
|
+
carouselData: androidContent?.mediaType === CAROUSEL ? buildCarouselCards(androidContent?.carouselData) : [],
|
|
2893
3069
|
// Extract primary CTA
|
|
2894
3070
|
...(androidContent?.cta && {
|
|
2895
3071
|
'cta-deeplink': androidContent.cta.type === DEEP_LINK ? 'Deeplink' : 'External Link',
|
|
@@ -2899,9 +3075,10 @@ export const MobilePushNew = ({
|
|
|
2899
3075
|
}),
|
|
2900
3076
|
};
|
|
2901
3077
|
|
|
2902
|
-
//
|
|
2903
|
-
|
|
2904
|
-
|
|
3078
|
+
// Buttons live in ctaData state, not in androidContent
|
|
3079
|
+
const androidCtas = toSavedCtas(ctaDataAndroid);
|
|
3080
|
+
if (androidCtas.length > 0) {
|
|
3081
|
+
androidCtas.forEach((cta, index) => {
|
|
2905
3082
|
if (index === 0) {
|
|
2906
3083
|
androidFormData['secondary-cta-0-label'] = cta.actionText || '';
|
|
2907
3084
|
androidFormData['cta-deeplink-secondary-cta-0'] = cta.type === DEEP_LINK ? 'Deeplink' : 'External Link';
|
|
@@ -2922,6 +3099,8 @@ export const MobilePushNew = ({
|
|
|
2922
3099
|
'message-title2': iosPreview?.header || iosContent?.title || '',
|
|
2923
3100
|
'message-editor2': iosPreview?.bodyText || iosContent?.message || '',
|
|
2924
3101
|
image: iosPreview?.bodyImage || iosContent?.expandableDetails?.image || '',
|
|
3102
|
+
video: iosContent?.mediaType === VIDEO ? (iosContent?.videoSrc || '') : '',
|
|
3103
|
+
carouselData: iosContent?.mediaType === CAROUSEL ? buildCarouselCards(iosContent?.carouselData) : [],
|
|
2925
3104
|
// Extract primary CTA
|
|
2926
3105
|
...(iosContent?.cta && {
|
|
2927
3106
|
'cta-deeplink2': iosContent.cta.type === DEEP_LINK ? 'Deeplink' : 'External Link',
|
|
@@ -2931,9 +3110,9 @@ export const MobilePushNew = ({
|
|
|
2931
3110
|
}),
|
|
2932
3111
|
};
|
|
2933
3112
|
|
|
2934
|
-
|
|
2935
|
-
if (
|
|
2936
|
-
|
|
3113
|
+
const iosCtas = toSavedCtas(ctaDataIos);
|
|
3114
|
+
if (iosCtas.length > 0) {
|
|
3115
|
+
iosCtas.forEach((cta, index) => {
|
|
2937
3116
|
if (index === 0) {
|
|
2938
3117
|
iosFormData['secondary-cta-1-label'] = cta.actionText || '';
|
|
2939
3118
|
iosFormData['cta-deeplink-secondary-cta-1'] = cta.type === DEEP_LINK ? 'Deeplink' : 'External Link';
|
|
@@ -2946,7 +3125,7 @@ export const MobilePushNew = ({
|
|
|
2946
3125
|
|
|
2947
3126
|
// Return in formData array format [androidData, iosData]
|
|
2948
3127
|
return [androidFormData, iosFormData];
|
|
2949
|
-
}, [androidContent, iosContent, getContentType]);
|
|
3128
|
+
}, [androidContent, iosContent, getContentType, ctaDataAndroid, ctaDataIos]);
|
|
2950
3129
|
|
|
2951
3130
|
// Handle Test and Preview button click
|
|
2952
3131
|
const handleTestAndPreview = useCallback(() => {
|
|
@@ -2956,7 +3135,8 @@ export const MobilePushNew = ({
|
|
|
2956
3135
|
// Handle close Test and Preview slidebox
|
|
2957
3136
|
const handleCloseTestAndPreview = useCallback(() => {
|
|
2958
3137
|
setShowTestAndPreviewSlidebox(false);
|
|
2959
|
-
|
|
3138
|
+
if (propsHandleCloseTestAndPreview) propsHandleCloseTestAndPreview();
|
|
3139
|
+
}, [propsHandleCloseTestAndPreview]);
|
|
2960
3140
|
|
|
2961
3141
|
// Add useEffect to handle isGetFormData prop changes (e.g. Done clicked in footer)
|
|
2962
3142
|
// In library mode: run liquid validation (extractTags) first; on success liquidMiddleWare calls handleSave
|
|
@@ -3082,24 +3262,46 @@ export const MobilePushNew = ({
|
|
|
3082
3262
|
<CapRow className="mobile-push-container">
|
|
3083
3263
|
<CapColumn className="content-section" span={14}>
|
|
3084
3264
|
{createModeContent()}
|
|
3085
|
-
{
|
|
3086
|
-
<
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3265
|
+
{canChoosePlatforms && (
|
|
3266
|
+
<CapRow type="flex" vertical noWrap className="input-group creative-name-container">
|
|
3267
|
+
<CapSelect.CapCustomSelect
|
|
3268
|
+
id="mobile-push-platform-select"
|
|
3269
|
+
className="mobile-push-platform-select"
|
|
3270
|
+
label={formatMessage(messages.platforms)}
|
|
3271
|
+
width="100%"
|
|
3272
|
+
options={platformOptions}
|
|
3273
|
+
value={platformSelection}
|
|
3274
|
+
onChange={handlePlatformChange}
|
|
3275
|
+
/>
|
|
3276
|
+
</CapRow>
|
|
3277
|
+
)}
|
|
3278
|
+
{singlePlatform ? (
|
|
3279
|
+
// One platform: its form only, no tabs or "Same content" checkbox
|
|
3280
|
+
<CapRow className="platform-header">
|
|
3281
|
+
{renderContentFields(singlePlatform)}
|
|
3282
|
+
</CapRow>
|
|
3283
|
+
) : (
|
|
3284
|
+
<>
|
|
3285
|
+
{isAndroidSupported && isIosSupported && (
|
|
3286
|
+
<CapCheckbox
|
|
3287
|
+
className="same-content-checkbox"
|
|
3288
|
+
checked={sameContent}
|
|
3289
|
+
onChange={handleSameContentChange}
|
|
3290
|
+
key={`same-content-${sameContent}`}
|
|
3291
|
+
>
|
|
3292
|
+
{formatMessage(messages.sameContentForBothChannels)}
|
|
3293
|
+
</CapCheckbox>
|
|
3294
|
+
)}
|
|
3295
|
+
<CapRow className="platform-header">
|
|
3296
|
+
<StyledCapTab
|
|
3297
|
+
className="platform-tabs"
|
|
3298
|
+
activeKey={activeTab}
|
|
3299
|
+
onChange={setActiveTab}
|
|
3300
|
+
panes={PANES}
|
|
3301
|
+
/>
|
|
3302
|
+
</CapRow>
|
|
3303
|
+
</>
|
|
3094
3304
|
)}
|
|
3095
|
-
<CapRow className="platform-header">
|
|
3096
|
-
<StyledCapTab
|
|
3097
|
-
className="platform-tabs"
|
|
3098
|
-
activeKey={activeTab}
|
|
3099
|
-
onChange={setActiveTab}
|
|
3100
|
-
panes={PANES}
|
|
3101
|
-
/>
|
|
3102
|
-
</CapRow>
|
|
3103
3305
|
<CapRow>
|
|
3104
3306
|
<CapColumn span={24}>
|
|
3105
3307
|
<ErrorInfoNote
|
|
@@ -3109,39 +3311,6 @@ export const MobilePushNew = ({
|
|
|
3109
3311
|
STANDARD_ERROR_MSG: errorMessage?.STANDARD_ERROR_MSG,
|
|
3110
3312
|
}}
|
|
3111
3313
|
/>
|
|
3112
|
-
|
|
3113
|
-
{/* In library mode, only show save button in create mode (edit mode has Done button from FormBuilder). In full mode, keep old logic. */}
|
|
3114
|
-
{((!isFullMode && computedCreativesMode !== 'edit') || (isFullMode && !isEditMode && computedCreativesMode === 'create')) && (
|
|
3115
|
-
<CapRow className="save-section">
|
|
3116
|
-
<CapColumn span={24}>
|
|
3117
|
-
<CapButton
|
|
3118
|
-
type="primary"
|
|
3119
|
-
onClick={() => {
|
|
3120
|
-
// Liquid validation (extractTags) only in library mode
|
|
3121
|
-
if (!isFullMode) {
|
|
3122
|
-
liquidMiddleWare();
|
|
3123
|
-
} else {
|
|
3124
|
-
handleSave();
|
|
3125
|
-
}
|
|
3126
|
-
}}
|
|
3127
|
-
className="save-button"
|
|
3128
|
-
disabled={isSaveDisabled}
|
|
3129
|
-
>
|
|
3130
|
-
{formatMessage(messages.saveTemplate)}
|
|
3131
|
-
</CapButton>
|
|
3132
|
-
<CapButton
|
|
3133
|
-
onClick={handleTestAndPreview}
|
|
3134
|
-
className="mobilepush-test-preview-btn"
|
|
3135
|
-
type="secondary"
|
|
3136
|
-
style={{ marginLeft: '8px' }}
|
|
3137
|
-
disabled={isSaveDisabled}
|
|
3138
|
-
>
|
|
3139
|
-
<FormattedMessage {...creativesMessages.testAndPreview} />
|
|
3140
|
-
</CapButton>
|
|
3141
|
-
</CapColumn>
|
|
3142
|
-
</CapRow>
|
|
3143
|
-
)}
|
|
3144
|
-
|
|
3145
3314
|
</CapColumn>
|
|
3146
3315
|
</CapRow>
|
|
3147
3316
|
</CapColumn>
|
|
@@ -3154,8 +3323,87 @@ export const MobilePushNew = ({
|
|
|
3154
3323
|
/>
|
|
3155
3324
|
</CapColumn>
|
|
3156
3325
|
</CapRow>
|
|
3326
|
+
{/* In library mode, only show save button in create mode (edit mode has Done button from FormBuilder). In full mode, keep old logic. */}
|
|
3327
|
+
{/* Kept outside the content row so the sticky footer can stick across the whole scroll area */}
|
|
3328
|
+
{((!isFullMode && computedCreativesMode !== 'edit') || (isFullMode && !isEditMode && computedCreativesMode === 'create')) && (
|
|
3329
|
+
<CapRow className="save-section mpush-save-section">
|
|
3330
|
+
<CapColumn span={24}>
|
|
3331
|
+
<CapButton
|
|
3332
|
+
type="primary"
|
|
3333
|
+
onClick={() => {
|
|
3334
|
+
// Liquid validation (extractTags) only in library mode
|
|
3335
|
+
if (!isFullMode) {
|
|
3336
|
+
liquidMiddleWare();
|
|
3337
|
+
} else {
|
|
3338
|
+
handleSave();
|
|
3339
|
+
}
|
|
3340
|
+
}}
|
|
3341
|
+
className="save-button"
|
|
3342
|
+
disabled={isSaveDisabled}
|
|
3343
|
+
>
|
|
3344
|
+
{formatMessage(messages.saveTemplate)}
|
|
3345
|
+
</CapButton>
|
|
3346
|
+
<CapButton
|
|
3347
|
+
onClick={handleTestAndPreview}
|
|
3348
|
+
className="mobilepush-test-preview-btn"
|
|
3349
|
+
type="secondary"
|
|
3350
|
+
style={{ marginLeft: '8px' }}
|
|
3351
|
+
disabled={isTestAndPreviewDisabled}
|
|
3352
|
+
>
|
|
3353
|
+
<FormattedMessage {...creativesMessages.testAndPreview} />
|
|
3354
|
+
</CapButton>
|
|
3355
|
+
</CapColumn>
|
|
3356
|
+
</CapRow>
|
|
3357
|
+
)}
|
|
3358
|
+
<CapModal
|
|
3359
|
+
open={isReplaceConfirmOpen}
|
|
3360
|
+
centered
|
|
3361
|
+
width={520}
|
|
3362
|
+
title={formatMessage(messages.replacePlatformContent, { platform: formatMessage(activeTab === ANDROID ? messages.ios : messages.android) })}
|
|
3363
|
+
onCancel={() => setIsReplaceConfirmOpen(false)}
|
|
3364
|
+
footer={[
|
|
3365
|
+
<CapButton key="cancel" type="secondary" onClick={() => setIsReplaceConfirmOpen(false)}>
|
|
3366
|
+
{formatMessage(globalMessages.cancel)}
|
|
3367
|
+
</CapButton>,
|
|
3368
|
+
<CapButton
|
|
3369
|
+
key="replace"
|
|
3370
|
+
type="primary"
|
|
3371
|
+
className="mpush-replace-platform-content"
|
|
3372
|
+
onClick={confirmSameContent}
|
|
3373
|
+
>
|
|
3374
|
+
{formatMessage(messages.replace)}
|
|
3375
|
+
</CapButton>,
|
|
3376
|
+
]}
|
|
3377
|
+
>
|
|
3378
|
+
{formatMessage(messages.replacePlatformContentBody, {
|
|
3379
|
+
platform: formatMessage(activeTab === ANDROID ? messages.ios : messages.android),
|
|
3380
|
+
source: formatMessage(activeTab === ANDROID ? messages.android : messages.ios),
|
|
3381
|
+
})}
|
|
3382
|
+
</CapModal>
|
|
3383
|
+
<CapModal
|
|
3384
|
+
open={!!pendingPlatformSelection}
|
|
3385
|
+
centered
|
|
3386
|
+
width={520}
|
|
3387
|
+
title={formatMessage(messages.removePlatformContent, {
|
|
3388
|
+
platform: formatMessage(pendingPlatformSelection === ANDROID ? messages.ios : messages.android),
|
|
3389
|
+
})}
|
|
3390
|
+
onCancel={() => setPendingPlatformSelection(null)}
|
|
3391
|
+
footer={[
|
|
3392
|
+
<CapButton key="cancel" type="secondary" onClick={() => setPendingPlatformSelection(null)}>
|
|
3393
|
+
{formatMessage(globalMessages.cancel)}
|
|
3394
|
+
</CapButton>,
|
|
3395
|
+
<CapButton
|
|
3396
|
+
key="remove"
|
|
3397
|
+
type="primary"
|
|
3398
|
+
className="mpush-remove-platform-content"
|
|
3399
|
+
onClick={confirmPlatformRemoval}
|
|
3400
|
+
>
|
|
3401
|
+
{formatMessage(messages.removeContent)}
|
|
3402
|
+
</CapButton>,
|
|
3403
|
+
]}
|
|
3404
|
+
/>
|
|
3157
3405
|
<TestAndPreviewSlidebox
|
|
3158
|
-
show={showTestAndPreviewSlidebox}
|
|
3406
|
+
show={propsShowTestAndPreviewSlidebox || showTestAndPreviewSlidebox}
|
|
3159
3407
|
onClose={handleCloseTestAndPreview}
|
|
3160
3408
|
formData={getFormDataForPayload()} // Pass formData structure for payload building
|
|
3161
3409
|
content={getTemplateContent()} // Also pass content for preview
|
|
@@ -3191,6 +3439,8 @@ MobilePushNew.propTypes = {
|
|
|
3191
3439
|
globalActions: PropTypes.object,
|
|
3192
3440
|
fetchingLiquidValidation: PropTypes.bool,
|
|
3193
3441
|
handleClose: PropTypes.func,
|
|
3442
|
+
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
3443
|
+
handleCloseTestAndPreview: PropTypes.func,
|
|
3194
3444
|
createTemplateError: PropTypes.any,
|
|
3195
3445
|
isGetFormData: PropTypes.bool,
|
|
3196
3446
|
getTemplateDetailsInProgress: PropTypes.bool,
|
|
@@ -3223,6 +3473,8 @@ MobilePushNew.defaultProps = {
|
|
|
3223
3473
|
globalActions: {},
|
|
3224
3474
|
fetchingLiquidValidation: false,
|
|
3225
3475
|
handleClose: () => {},
|
|
3476
|
+
showTestAndPreviewSlidebox: false,
|
|
3477
|
+
handleCloseTestAndPreview: undefined,
|
|
3226
3478
|
createTemplateError: null,
|
|
3227
3479
|
isGetFormData: false,
|
|
3228
3480
|
getTemplateDetailsInProgress: false,
|