@capillarytech/creatives-library 9.1.7 → 9.1.8-alpha.sprint-cap-214249.38
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/index.js +0 -13
- package/package.json +1 -1
- package/services/getSchema.js +1 -4
- package/services/tests/getSchema.test.js +2 -2
- package/utils/common.js +0 -6
- package/utils/createMobilePushPayload.js +47 -33
- package/utils/tests/createMobilePushPayload.test.js +102 -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 +26 -13
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +13 -1
- package/v2Components/CommonTestAndPreview/constants.js +2 -0
- package/v2Components/CommonTestAndPreview/index.js +49 -11
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +79 -5
- package/v2Components/CommonTestAndPreview/tests/index.test.js +86 -0
- package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpush.singlePlatform.test.js +1 -1
- package/v2Components/FormBuilder/tests/mpush.characterization.test.js +2 -2
- package/v2Components/TemplatePreview/_templatePreview.scss +12 -2
- package/v2Components/TemplatePreview/index.js +30 -17
- package/v2Components/TemplatePreview/tests/index.test.js +61 -0
- package/v2Containers/Cap/index.js +0 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +70 -151
- package/v2Containers/CreativesContainer/index.js +3 -6
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +29 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +52 -47
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +207 -192
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +116 -121
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +30 -208
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +316 -72
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +45 -16
- 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 +38 -1
- package/v2Containers/MobilePushNew/hooks/useUpload.js +29 -39
- package/v2Containers/MobilePushNew/index.js +453 -188
- package/v2Containers/MobilePushNew/index.scss +188 -4
- package/v2Containers/MobilePushNew/messages.js +86 -6
- package/v2Containers/MobilePushNew/tests/index.test.js +450 -1
- package/v2Containers/MobilePushNew/tests/utils.test.js +25 -0
- package/v2Containers/MobilePushNew/utils.js +8 -0
- package/v2Containers/Templates/_templates.scss +10 -2
- package/v2Containers/Templates/index.js +84 -90
- package/v2Containers/Templates/tests/index.test.js +68 -0
- package/v2Components/FormBuilder/Functional/tests/manual.typingPerf.test.js +0 -135
- package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +0 -320
- package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +0 -148
- package/v2Components/FormBuilder/Functional/tests/mpush.libraryValidity.parity.test.js +0 -152
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +0 -70
- package/v2Containers/MobilePush/Create/actions.js +0 -52
- package/v2Containers/MobilePush/Create/constants.js +0 -26
- package/v2Containers/MobilePush/Create/index.js +0 -2149
- package/v2Containers/MobilePush/Create/messages.js +0 -349
- package/v2Containers/MobilePush/Create/reducer.js +0 -72
- package/v2Containers/MobilePush/Create/sagas.js +0 -79
- package/v2Containers/MobilePush/Create/selectors.js +0 -29
- package/v2Containers/MobilePush/Create/test/contentValidity.test.js +0 -154
- package/v2Containers/MobilePush/Create/test/saga.test.js +0 -19
- package/v2Containers/MobilePush/Create/test/stayOpenOnSave.test.js +0 -80
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +0 -65
- package/v2Containers/MobilePush/Edit/actions.js +0 -94
- package/v2Containers/MobilePush/Edit/constants.js +0 -37
- package/v2Containers/MobilePush/Edit/index.js +0 -2407
- package/v2Containers/MobilePush/Edit/messages.js +0 -341
- package/v2Containers/MobilePush/Edit/reducer.js +0 -113
- package/v2Containers/MobilePush/Edit/sagas.js +0 -113
- package/v2Containers/MobilePush/Edit/selectors.js +0 -33
- package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +0 -149
- package/v2Containers/MobilePush/Edit/test/saga.test.js +0 -255
- package/v2Containers/MobilePush/Edit/test/stayOpenOnSave.test.js +0 -60
- package/v2Containers/MobilePush/commonMethods.js +0 -333
- package/v2Containers/MobilePush/eventsMap.js +0 -130
- package/v2Containers/MobilePush/tests/commonMethods.test.js +0 -401
- package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +0 -22
- package/v2Containers/MobilepushWrapper/index.js +0 -178
- package/v2Containers/MobilepushWrapper/messages.js +0 -29
- /package/{v2Containers/MobilePush/initialSchema.js → v2Components/FormBuilder/Functional/tests/fixtures/mpushInitialSchema.js} +0 -0
|
@@ -73,6 +73,67 @@ describe('Test Templates container', () => {
|
|
|
73
73
|
expect(renderedComponent).toMatchSnapshot();
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
describe('Mobile push action buttons', () => {
|
|
77
|
+
const renderMobilePush = (device, actions) => {
|
|
78
|
+
renderedComponent = shallowWithIntl(
|
|
79
|
+
<TemplatePreview
|
|
80
|
+
channel="MOBILEPUSH"
|
|
81
|
+
device={device}
|
|
82
|
+
content={{ header: 'Title', bodyText: 'Body', actions, carouselData: [] }}
|
|
83
|
+
/>,
|
|
84
|
+
);
|
|
85
|
+
return renderedComponent.find('.actions');
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
it.each(['android', 'ios'])('renders labels as typed on one flex row with index keys (%s)', (device) => {
|
|
89
|
+
const row = renderMobilePush(device, [
|
|
90
|
+
{ label: 'Shop', url: 'https://a.com' },
|
|
91
|
+
{ label: 'Shop' },
|
|
92
|
+
{ label: '' },
|
|
93
|
+
]);
|
|
94
|
+
const buttons = row.find('.action');
|
|
95
|
+
|
|
96
|
+
expect(row.props()).toEqual(expect.objectContaining({ type: 'flex', noWrap: true }));
|
|
97
|
+
expect(buttons).toHaveLength(2);
|
|
98
|
+
expect(buttons.map((button) => button.key())).toEqual(['action-0', 'action-1']);
|
|
99
|
+
expect(buttons.map((button) => button.text())).toEqual(['Shop', 'Shop']);
|
|
100
|
+
expect(buttons.at(0).prop('title')).toBe('https://a.com');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const renderCarousel = (device, carouselData) => {
|
|
104
|
+
renderedComponent = shallowWithIntl(
|
|
105
|
+
<TemplatePreview
|
|
106
|
+
channel="MOBILEPUSH"
|
|
107
|
+
device={device}
|
|
108
|
+
content={{ header: 'Title', carouselData }}
|
|
109
|
+
/>,
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
it.each(['android', 'ios'])('shows only cards with media, in one horizontal row (%s)', (device) => {
|
|
114
|
+
renderCarousel(device, [
|
|
115
|
+
{ mediaType: 'IMAGE', imageUrl: 'https://a.url' },
|
|
116
|
+
{ mediaType: 'IMAGE' },
|
|
117
|
+
{ mediaType: 'VIDEO', videoPreviewImg: 'https://b.url' },
|
|
118
|
+
]);
|
|
119
|
+
const scrollRow = renderedComponent.find('.scroll-container');
|
|
120
|
+
|
|
121
|
+
expect(scrollRow.props()).toEqual(expect.objectContaining({ type: 'flex', noWrap: true }));
|
|
122
|
+
expect(renderedComponent.find('.mobile-push-carousel-card')).toHaveLength(2);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it.each(['android', 'ios'])('shows a video card with no thumbnail as the video itself (%s)', (device) => {
|
|
126
|
+
renderCarousel(device, [{ mediaType: 'video', videoSrc: 'https://v.mp4' }]);
|
|
127
|
+
expect(renderedComponent.find('.mobile-push-carousel-card')).toHaveLength(1);
|
|
128
|
+
expect(renderedComponent.find('video.carousel-video-preview').prop('src')).toBe('https://v.mp4');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it.each(['android', 'ios'])('shows no carousel when no card has media (%s)', (device) => {
|
|
132
|
+
renderCarousel(device, [{ mediaType: 'IMAGE' }]);
|
|
133
|
+
expect(renderedComponent.find('.mobile-push-carousel-container')).toHaveLength(0);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
76
137
|
describe('RCS carousel preview branches', () => {
|
|
77
138
|
const buildRcsContent = (cards) => ({
|
|
78
139
|
rcsPreviewContent: {
|
|
@@ -46,7 +46,6 @@ import { v2SmsCreateSagas } from '../Sms/Create/sagas';
|
|
|
46
46
|
import { v2EbillSagas } from '../Ebill/sagas';
|
|
47
47
|
import { v2EmailDuplicateTemplateSaga } from '../Email/sagas';
|
|
48
48
|
import { v2LineContainerSagas } from '../Line/Container/sagas'
|
|
49
|
-
import { v2MobilePushCreateSagas } from '../MobilePush/Create/sagas';
|
|
50
49
|
import { v2WechatMapTemplatesSagas } from '../WeChat/MapTemplates/sagas';
|
|
51
50
|
import { v2RcsSagas } from '../Rcs/sagas';
|
|
52
51
|
import { v2InAppSagas } from '../InApp/sagas';
|
|
@@ -643,7 +642,6 @@ const withSmsCreateSaga = injectSaga({ key: 'create', saga: v2SmsCreateSagas });
|
|
|
643
642
|
const withEbillSaga = injectSaga({ key: 'ebill', saga: v2EbillSagas });
|
|
644
643
|
const withEmailSaga = injectSaga({ key: 'email', saga: v2EmailDuplicateTemplateSaga });
|
|
645
644
|
const withLineContainerSaga = injectSaga({ key: 'lineCreate', saga: v2LineContainerSagas });
|
|
646
|
-
const withMobilePushCreateSaga = injectSaga({ key: 'mobileCreate', saga: v2MobilePushCreateSagas });
|
|
647
645
|
const withWechatMapTemplatesSaga = injectSaga({ key: 'weChatMapTemplate', saga: v2WechatMapTemplatesSagas });
|
|
648
646
|
const withRcsSaga = injectSaga({ key: 'rcs', saga: v2RcsSagas });
|
|
649
647
|
const withInAppSaga = injectSaga({ key: 'inapp', saga: v2InAppSagas, mode: DAEMON });
|
|
@@ -658,7 +656,6 @@ export default compose(
|
|
|
658
656
|
withEmailSaga,
|
|
659
657
|
withLiquidSaga,
|
|
660
658
|
withLineContainerSaga,
|
|
661
|
-
withMobilePushCreateSaga,
|
|
662
659
|
withWechatMapTemplatesSaga,
|
|
663
660
|
withRcsSaga,
|
|
664
661
|
withInAppSaga,
|
|
@@ -10,7 +10,6 @@ import TemplatePreview from '../../v2Components/TemplatePreview';
|
|
|
10
10
|
import SmsWrapper from '../SmsWrapper';
|
|
11
11
|
import Email from '../Email';
|
|
12
12
|
import EmailWrapper from '../EmailWrapper';
|
|
13
|
-
import MobilepushWrapper from '../MobilepushWrapper';
|
|
14
13
|
import InAppWrapper from '../InAppWrapper';
|
|
15
14
|
import EmailPreviewV2 from '../../v2Components/EmailPreviewV2';
|
|
16
15
|
import MobilePushPreview from '../../v2Components/MobilePushPreviewV2';
|
|
@@ -18,7 +17,6 @@ import WechatWrapper from '../WeChat/Wrapper';
|
|
|
18
17
|
import Facebook from '../Facebook';
|
|
19
18
|
import { RICH_MEDIA, MAP_TEMPLATE, CREATE } from '../WeChat/Wrapper/constants';
|
|
20
19
|
import CallTask from '../CallTask';
|
|
21
|
-
import MobliPushEdit from '../MobilePush/Edit';
|
|
22
20
|
import * as constants from './constants';
|
|
23
21
|
import { SMS as SMS_LOWERCASE } from '../../constants/unified';
|
|
24
22
|
import LineContainer from '../Line/Container';
|
|
@@ -846,157 +844,78 @@ export function SlideBoxContent(props) {
|
|
|
846
844
|
})()
|
|
847
845
|
)}
|
|
848
846
|
{isEditMPush && (
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
isAnonymousType={isAnonymousType}
|
|
883
|
-
onPersonalizationTokensChange={onPersonalizationTokensChange}
|
|
884
|
-
onContentValidityChange={onContentValidityChange}
|
|
885
|
-
/>
|
|
886
|
-
) : (
|
|
887
|
-
<MobilePushNew
|
|
888
|
-
getFormLibraryData={getFormData}
|
|
889
|
-
setIsLoadingContent={setIsLoadingContent}
|
|
890
|
-
location={{
|
|
891
|
-
pathname: `/mobilepush/edit/`,
|
|
892
|
-
query,
|
|
893
|
-
}}
|
|
894
|
-
params={{ id: templateData._id }}
|
|
895
|
-
isFullMode={isFullMode}
|
|
896
|
-
isGetFormData={isGetFormData}
|
|
897
|
-
route={{ name: 'mobilepush' }}
|
|
898
|
-
templateData={templateData}
|
|
899
|
-
showTemplateName={showTemplateName}
|
|
900
|
-
getDefaultTags={type}
|
|
901
|
-
onValidationFail={onValidationFail}
|
|
902
|
-
forwardedTags={forwardedTags}
|
|
903
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
904
|
-
onPreviewContentClicked={onPreviewContentClicked}
|
|
905
|
-
onTestContentClicked={onTestContentClicked}
|
|
906
|
-
type={type}
|
|
907
|
-
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
908
|
-
creativesMode={creativesMode}
|
|
909
|
-
eventContextTags={eventContextTags}
|
|
910
|
-
waitEventContextTags={waitEventContextTags}
|
|
911
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
912
|
-
handleClose={handleClose}
|
|
913
|
-
restrictPersonalization={restrictPersonalization}
|
|
914
|
-
isAnonymousType={isAnonymousType}
|
|
915
|
-
onPersonalizationTokensChange={onPersonalizationTokensChange}
|
|
916
|
-
onContentValidityChange={onContentValidityChange}
|
|
917
|
-
/>
|
|
918
|
-
)
|
|
847
|
+
<MobilePushNew
|
|
848
|
+
getFormLibraryData={getFormData}
|
|
849
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
850
|
+
location={{
|
|
851
|
+
pathname: `/mobilepush/edit/`,
|
|
852
|
+
query,
|
|
853
|
+
}}
|
|
854
|
+
params={{ id: templateData._id }}
|
|
855
|
+
isFullMode={isFullMode}
|
|
856
|
+
isGetFormData={isGetFormData}
|
|
857
|
+
route={{ name: 'mobilepush' }}
|
|
858
|
+
templateData={templateData}
|
|
859
|
+
showTemplateName={showTemplateName}
|
|
860
|
+
getDefaultTags={type}
|
|
861
|
+
onValidationFail={onValidationFail}
|
|
862
|
+
forwardedTags={forwardedTags}
|
|
863
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
864
|
+
onPreviewContentClicked={onPreviewContentClicked}
|
|
865
|
+
onTestContentClicked={onTestContentClicked}
|
|
866
|
+
type={type}
|
|
867
|
+
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
868
|
+
creativesMode={creativesMode}
|
|
869
|
+
eventContextTags={eventContextTags}
|
|
870
|
+
waitEventContextTags={waitEventContextTags}
|
|
871
|
+
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
872
|
+
handleClose={handleClose}
|
|
873
|
+
showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
|
|
874
|
+
handleCloseTestAndPreview={handleCloseTestAndPreview}
|
|
875
|
+
restrictPersonalization={restrictPersonalization}
|
|
876
|
+
isAnonymousType={isAnonymousType}
|
|
877
|
+
onPersonalizationTokensChange={onPersonalizationTokensChange}
|
|
878
|
+
onContentValidityChange={onContentValidityChange}
|
|
879
|
+
/>
|
|
919
880
|
)}
|
|
920
881
|
{isCreateMPush && (
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
onPersonalizationTokensChange={onPersonalizationTokensChange}
|
|
959
|
-
onContentValidityChange={onContentValidityChange}
|
|
960
|
-
/>
|
|
961
|
-
) : (
|
|
962
|
-
<MobilePushNew
|
|
963
|
-
key="creatives-mobilepush-create-new"
|
|
964
|
-
date={new Date().getMilliseconds()}
|
|
965
|
-
setIsLoadingContent={setIsLoadingContent}
|
|
966
|
-
onMobilepushModeChange={onMobilepushModeChange}
|
|
967
|
-
mobilePushCreateMode={mobilePushCreateMode}
|
|
968
|
-
isGetFormData={isGetFormData}
|
|
969
|
-
getFormLibraryData={getFormData}
|
|
970
|
-
location={location}
|
|
971
|
-
getDefaultTags={type}
|
|
972
|
-
templateData={templateData}
|
|
973
|
-
type={type}
|
|
974
|
-
handleClose={handleClose}
|
|
975
|
-
step={templateStep}
|
|
976
|
-
showNextStep={onCreateNextStep}
|
|
977
|
-
isFullMode={isFullMode}
|
|
978
|
-
onEnterTemplateName={onEnterTemplateName}
|
|
979
|
-
onRemoveTemplateName={onRemoveTemplateName}
|
|
980
|
-
cap={cap}
|
|
981
|
-
onResetStep={onResetStep}
|
|
982
|
-
showTemplateName={showTemplateName}
|
|
983
|
-
query={query}
|
|
984
|
-
forwardedTags={forwardedTags}
|
|
985
|
-
onValidationFail={onValidationFail}
|
|
986
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
987
|
-
onPreviewContentClicked={onPreviewContentClicked}
|
|
988
|
-
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
989
|
-
onTestContentClicked={onTestContentClicked}
|
|
990
|
-
eventContextTags={eventContextTags}
|
|
991
|
-
waitEventContextTags={waitEventContextTags}
|
|
992
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
993
|
-
onCreateComplete={onCreateComplete}
|
|
994
|
-
creativesMode={creativesMode}
|
|
995
|
-
restrictPersonalization={restrictPersonalization}
|
|
996
|
-
isAnonymousType={isAnonymousType}
|
|
997
|
-
onContentValidityChange={onContentValidityChange}
|
|
998
|
-
/>
|
|
999
|
-
)
|
|
882
|
+
<MobilePushNew
|
|
883
|
+
key="creatives-mobilepush-create-new"
|
|
884
|
+
date={new Date().getMilliseconds()}
|
|
885
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
886
|
+
onMobilepushModeChange={onMobilepushModeChange}
|
|
887
|
+
mobilePushCreateMode={mobilePushCreateMode}
|
|
888
|
+
isGetFormData={isGetFormData}
|
|
889
|
+
getFormLibraryData={getFormData}
|
|
890
|
+
location={location}
|
|
891
|
+
getDefaultTags={type}
|
|
892
|
+
templateData={templateData}
|
|
893
|
+
type={type}
|
|
894
|
+
handleClose={handleClose}
|
|
895
|
+
step={templateStep}
|
|
896
|
+
showNextStep={onCreateNextStep}
|
|
897
|
+
isFullMode={isFullMode}
|
|
898
|
+
onEnterTemplateName={onEnterTemplateName}
|
|
899
|
+
onRemoveTemplateName={onRemoveTemplateName}
|
|
900
|
+
cap={cap}
|
|
901
|
+
onResetStep={onResetStep}
|
|
902
|
+
showTemplateName={showTemplateName}
|
|
903
|
+
query={query}
|
|
904
|
+
forwardedTags={forwardedTags}
|
|
905
|
+
onValidationFail={onValidationFail}
|
|
906
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
907
|
+
onPreviewContentClicked={onPreviewContentClicked}
|
|
908
|
+
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
909
|
+
onTestContentClicked={onTestContentClicked}
|
|
910
|
+
eventContextTags={eventContextTags}
|
|
911
|
+
waitEventContextTags={waitEventContextTags}
|
|
912
|
+
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
913
|
+
onCreateComplete={onCreateComplete}
|
|
914
|
+
creativesMode={creativesMode}
|
|
915
|
+
restrictPersonalization={restrictPersonalization}
|
|
916
|
+
isAnonymousType={isAnonymousType}
|
|
917
|
+
onContentValidityChange={onContentValidityChange}
|
|
918
|
+
/>
|
|
1000
919
|
)}
|
|
1001
920
|
{
|
|
1002
921
|
isCreateFacebook && (
|
|
@@ -110,8 +110,6 @@ import callTaskReducer from '../CallTask/reducer';
|
|
|
110
110
|
import tagListReducer from '../TagList/reducer';
|
|
111
111
|
import smsCreateReducer from '../Sms/Create/reducer';
|
|
112
112
|
import smsEditReducer from '../Sms/Edit/reducer';
|
|
113
|
-
import mobilePushCreateReducer from '../MobilePush/Create/reducer';
|
|
114
|
-
import mobilePushEditReducer from '../MobilePush/Edit/reducer';
|
|
115
113
|
import mobilePushNewReducer from '../MobilePushNew/reducer';
|
|
116
114
|
import beeEditorReducer from '../BeeEditor/reducer';
|
|
117
115
|
import ftpReducer from '../FTP/reducer';
|
|
@@ -1042,7 +1040,8 @@ export class Creatives extends React.Component {
|
|
|
1042
1040
|
newExpandableDetails.message = expandableDetails.message || '';
|
|
1043
1041
|
newExpandableDetails.ctas = expandableDetails.ctas || [];
|
|
1044
1042
|
newExpandableDetails.media = expandableDetails.carouselData.map((carousel) => ({
|
|
1045
|
-
url
|
|
1043
|
+
// Video cards keep their url in videoSrc
|
|
1044
|
+
url: carousel?.mediaType?.toUpperCase() === VIDEO ? carousel.videoSrc : carousel.imageUrl,
|
|
1046
1045
|
type: carousel?.mediaType?.toUpperCase(),
|
|
1047
1046
|
text: '',
|
|
1048
1047
|
}));
|
|
@@ -2609,8 +2608,6 @@ const withCallTaskReducer = injectReducer({ key: 'callTask', reducer: callTaskRe
|
|
|
2609
2608
|
const withTagListReducer = injectReducer({ key: 'tagList', reducer: tagListReducer });
|
|
2610
2609
|
const withSmsCreateReducer = injectReducer({ key: 'create', reducer: smsCreateReducer });
|
|
2611
2610
|
const withSmsEditReducer = injectReducer({ key: 'edit', reducer: smsEditReducer });
|
|
2612
|
-
const withMobilePushCreateReducer = injectReducer({ key: 'mobileCreate', reducer: mobilePushCreateReducer });
|
|
2613
|
-
const withMobilePushEditReducer = injectReducer({ key: 'mobileEdit', reducer: mobilePushEditReducer });
|
|
2614
2611
|
const withMobilePushNewReducer = injectReducer({ key: 'mobilePushNew', reducer: mobilePushNewReducer });
|
|
2615
2612
|
const withBeeEditorReducer = injectReducer({ key: 'beeEditor', reducer: beeEditorReducer });
|
|
2616
2613
|
const withFTPReducer = injectReducer({ key: 'FTP', reducer: ftpReducer });
|
|
@@ -2637,7 +2634,7 @@ export default compose(
|
|
|
2637
2634
|
withReducer, withTemplateReducer, withEmailReducer, withCapReducer,
|
|
2638
2635
|
withCallTaskReducer, withTagListReducer,
|
|
2639
2636
|
withSmsCreateReducer, withSmsEditReducer,
|
|
2640
|
-
|
|
2637
|
+
withMobilePushNewReducer,
|
|
2641
2638
|
withBeeEditorReducer, withFTPReducer,
|
|
2642
2639
|
withFacebookReducer, withGalleryReducer, withFacebookPreviewReducer,
|
|
2643
2640
|
withSmsTraiReducer, withWhatsappReducer, withRcsReducer, withZaloReducer,
|
|
@@ -4,6 +4,7 @@ import { SlideBoxContent } from '../SlideBoxContent';
|
|
|
4
4
|
import mockdata from '../../mockdata';
|
|
5
5
|
import { templateDetailsImage, templateDetailsVideo, templateDetailsText, templateDetails_ } from '../../Viber/tests/mockData';
|
|
6
6
|
import { CREATE, RICH_MEDIA } from '../../WeChat/Wrapper/constants';
|
|
7
|
+
import MobilePushNew from '../../MobilePushNew';
|
|
7
8
|
|
|
8
9
|
const {
|
|
9
10
|
whatsappEditTemplateData,
|
|
@@ -1015,4 +1016,32 @@ describe('Test SlideBoxContent container', () => {
|
|
|
1015
1016
|
});
|
|
1016
1017
|
|
|
1017
1018
|
});
|
|
1019
|
+
|
|
1020
|
+
describe('Mobile push editor choice', () => {
|
|
1021
|
+
const editTemplateData = { _id: 'mp-1', type: 'MOBILEPUSH' };
|
|
1022
|
+
|
|
1023
|
+
it.each([
|
|
1024
|
+
['full mode', { isFullMode: true }],
|
|
1025
|
+
['embedded outside Loyalty', { isFullMode: false, isLoyaltyModule: false }],
|
|
1026
|
+
['embedded in Loyalty', { isFullMode: false, isLoyaltyModule: true }],
|
|
1027
|
+
])('opens the new editor for create and edit in %s', (_, modeProps) => {
|
|
1028
|
+
renderFunction('MOBILEPUSH', 'createTemplate', { mode: 'create' }, modeProps);
|
|
1029
|
+
expect(renderedComponent.find(MobilePushNew).exists()).toBe(true);
|
|
1030
|
+
|
|
1031
|
+
renderFunction('MOBILEPUSH', 'editTemplate', editTemplateData, modeProps);
|
|
1032
|
+
expect(renderedComponent.find(MobilePushNew).exists()).toBe(true);
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
it('passes the footer Test & Preview state to the new editor in edit', () => {
|
|
1036
|
+
const handleCloseTestAndPreview = jest.fn();
|
|
1037
|
+
renderFunction('MOBILEPUSH', 'editTemplate', editTemplateData, {
|
|
1038
|
+
isFullMode: true,
|
|
1039
|
+
showTestAndPreviewSlidebox: true,
|
|
1040
|
+
handleCloseTestAndPreview,
|
|
1041
|
+
});
|
|
1042
|
+
const editor = renderedComponent.find(MobilePushNew);
|
|
1043
|
+
expect(editor.prop('showTestAndPreviewSlidebox')).toBe(true);
|
|
1044
|
+
expect(editor.prop('handleCloseTestAndPreview')).toBe(handleCloseTestAndPreview);
|
|
1045
|
+
});
|
|
1046
|
+
});
|
|
1018
1047
|
});
|
|
@@ -5,16 +5,20 @@ import CapRow from "@capillarytech/cap-ui-library/CapRow";
|
|
|
5
5
|
import CapButton from "@capillarytech/cap-ui-library/CapButton";
|
|
6
6
|
import CapIcon from "@capillarytech/cap-ui-library/CapIcon";
|
|
7
7
|
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
8
|
-
import
|
|
8
|
+
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
|
|
9
|
+
// import CapTooltip from "@capillarytech/cap-ui-library/CapTooltip";
|
|
9
10
|
import CapMpushCTA from "../../../v2Components/CapMpushCTA";
|
|
10
|
-
import { PRIMARY,
|
|
11
|
+
import { PRIMARY, DEEP_LINK } from "../constants";
|
|
12
|
+
// import { SECONDARY } from "../constants";
|
|
11
13
|
import messages from "../messages";
|
|
12
14
|
|
|
15
|
+
// Secondary button is commented out below: it needs backend support, so it is being revamped.
|
|
16
|
+
// Restore the commented secondaryButton / setSecondaryButton props, state, handler and JSX together.
|
|
13
17
|
const CtaButtons = ({
|
|
14
18
|
primaryButton,
|
|
15
|
-
secondaryButton,
|
|
19
|
+
// secondaryButton,
|
|
16
20
|
setPrimaryButton,
|
|
17
|
-
setSecondaryButton,
|
|
21
|
+
// setSecondaryButton,
|
|
18
22
|
ctaData,
|
|
19
23
|
updateHandler,
|
|
20
24
|
deleteHandler,
|
|
@@ -27,7 +31,7 @@ const CtaButtons = ({
|
|
|
27
31
|
}) => {
|
|
28
32
|
// Local state to control CTA form visibility
|
|
29
33
|
const [showPrimaryCTA, setShowPrimaryCTA] = useState(false);
|
|
30
|
-
const [showSecondaryCTA, setShowSecondaryCTA] = useState(false);
|
|
34
|
+
// const [showSecondaryCTA, setShowSecondaryCTA] = useState(false);
|
|
31
35
|
|
|
32
36
|
const handleAddPrimary = () => {
|
|
33
37
|
// Prevent multiple clicks if primary button is already being added or form is already showing
|
|
@@ -53,68 +57,67 @@ const CtaButtons = ({
|
|
|
53
57
|
setShowPrimaryCTA(true);
|
|
54
58
|
};
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
isSaved: false,
|
|
77
|
-
};
|
|
78
|
-
updateHandler(newSecondaryButton, 1);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// setSecondaryButton(true);
|
|
82
|
-
// setShowSecondaryCTA(true);
|
|
83
|
-
};
|
|
60
|
+
// Secondary button: needs backend support, revamped
|
|
61
|
+
// const handleAddSecondary = () => {
|
|
62
|
+
// if (secondaryButton && showSecondaryCTA) {
|
|
63
|
+
// return;
|
|
64
|
+
// }
|
|
65
|
+
// if (ctaData?.length < 2 || !ctaData?.find((cta) => cta?.index === 1)) {
|
|
66
|
+
// const newSecondaryButton = {
|
|
67
|
+
// index: 1,
|
|
68
|
+
// ctaType: SECONDARY,
|
|
69
|
+
// text: "",
|
|
70
|
+
// urlType: DEEP_LINK,
|
|
71
|
+
// url: "",
|
|
72
|
+
// deepLinkKeys: "",
|
|
73
|
+
// isSaved: false,
|
|
74
|
+
// };
|
|
75
|
+
// updateHandler(newSecondaryButton, 1);
|
|
76
|
+
// }
|
|
77
|
+
// setSecondaryButton(true);
|
|
78
|
+
// setShowSecondaryCTA(true);
|
|
79
|
+
// };
|
|
84
80
|
|
|
85
81
|
// Check if primary button exists (saved or being edited)
|
|
86
82
|
const primaryButtonExists = ctaData?.length > 0 && ctaData[0]?.text;
|
|
87
83
|
const isPrimaryButtonSaved = primaryButtonExists && ctaData[0]?.isSaved;
|
|
88
84
|
|
|
89
|
-
//
|
|
90
|
-
const secondaryButtonExists = ctaData?.length > 1 && ctaData[1]?.text;
|
|
91
|
-
const isSecondaryButtonSaved = secondaryButtonExists && ctaData[1]?.isSaved;
|
|
85
|
+
// Secondary button: needs backend support, revamped
|
|
86
|
+
// const secondaryButtonExists = ctaData?.length > 1 && ctaData[1]?.text;
|
|
87
|
+
// const isSecondaryButtonSaved = secondaryButtonExists && ctaData[1]?.isSaved;
|
|
92
88
|
|
|
93
89
|
// Show primary CTA if button is active and (form is showing OR button exists)
|
|
94
90
|
const shouldShowPrimaryCTA = primaryButton && (showPrimaryCTA || primaryButtonExists);
|
|
95
91
|
|
|
96
|
-
//
|
|
97
|
-
const shouldShowSecondaryCTA = secondaryButton && (showSecondaryCTA || secondaryButtonExists);
|
|
92
|
+
// Secondary button: needs backend support, revamped
|
|
93
|
+
// const shouldShowSecondaryCTA = secondaryButton && (showSecondaryCTA || secondaryButtonExists);
|
|
98
94
|
|
|
99
95
|
// Enhanced delete handler to hide forms when buttons are deleted
|
|
100
96
|
const handleDelete = (index) => {
|
|
101
97
|
if (index === 0) {
|
|
102
98
|
setShowPrimaryCTA(false);
|
|
103
99
|
setPrimaryButton(false);
|
|
104
|
-
} else if (index === 1) {
|
|
105
|
-
//cooment until supported from BE & Hydra
|
|
106
|
-
// setShowSecondaryCTA(false);
|
|
107
|
-
// setSecondaryButton(false);
|
|
108
100
|
}
|
|
101
|
+
// Secondary button: needs backend support, revamped
|
|
102
|
+
// else if (index === 1) {
|
|
103
|
+
// setShowSecondaryCTA(false);
|
|
104
|
+
// setSecondaryButton(false);
|
|
105
|
+
// }
|
|
109
106
|
deleteHandler(index);
|
|
110
107
|
};
|
|
111
108
|
|
|
112
109
|
return (
|
|
113
110
|
<>
|
|
114
111
|
<CapRow className="mpush-cta-buttons">
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
{/* Heading with "(Optional)" on the same line */}
|
|
113
|
+
<CapRow type="flex" align="middle" noWrap className="mpush-section-heading">
|
|
114
|
+
<CapHeading type="h3">
|
|
115
|
+
<FormattedMessage {...messages.buttons} />
|
|
116
|
+
</CapHeading>
|
|
117
|
+
<CapLabel className="optional-text">
|
|
118
|
+
<FormattedMessage {...messages.optionalText} />
|
|
119
|
+
</CapLabel>
|
|
120
|
+
</CapRow>
|
|
118
121
|
{!isPrimaryButtonSaved && !shouldShowPrimaryCTA && (
|
|
119
122
|
<CapButton
|
|
120
123
|
type="link"
|
|
@@ -142,6 +145,7 @@ const CtaButtons = ({
|
|
|
142
145
|
handleOnTagsContextChange={handleOnTagsContextChange}
|
|
143
146
|
/>
|
|
144
147
|
)}
|
|
148
|
+
{/* Secondary button: needs backend support, so it is being revamped. Hidden until then.
|
|
145
149
|
{isPrimaryButtonSaved && !isSecondaryButtonSaved && !shouldShowSecondaryCTA && (
|
|
146
150
|
<CapTooltip
|
|
147
151
|
overlay={<FormattedMessage {...messages.secondaryButtonTooltip} />}
|
|
@@ -171,15 +175,16 @@ const CtaButtons = ({
|
|
|
171
175
|
buttonType={SECONDARY}
|
|
172
176
|
/>
|
|
173
177
|
)}
|
|
178
|
+
*/}
|
|
174
179
|
</>
|
|
175
180
|
);
|
|
176
181
|
};
|
|
177
182
|
|
|
178
183
|
CtaButtons.propTypes = {
|
|
179
184
|
primaryButton: PropTypes.bool.isRequired,
|
|
180
|
-
secondaryButton: PropTypes.bool.isRequired,
|
|
185
|
+
// secondaryButton: PropTypes.bool.isRequired,
|
|
181
186
|
setPrimaryButton: PropTypes.func.isRequired,
|
|
182
|
-
setSecondaryButton: PropTypes.func.isRequired,
|
|
187
|
+
// setSecondaryButton: PropTypes.func.isRequired,
|
|
183
188
|
ctaData: PropTypes.array.isRequired,
|
|
184
189
|
updateHandler: PropTypes.func.isRequired,
|
|
185
190
|
deleteHandler: PropTypes.func.isRequired,
|