@capillarytech/creatives-library 8.0.255-alpha.4 → 8.0.255
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/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +2 -2
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +10 -5
- package/services/tests/api.test.js +34 -0
- package/translations/en.json +3 -4
- package/utils/common.js +5 -6
- package/utils/commonUtils.js +28 -5
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/tests/transformerUtils.test.js +0 -297
- package/utils/transformTemplateConfig.js +0 -10
- package/utils/transformerUtils.js +0 -40
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +16 -65
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +1 -5
- package/v2Components/CapTagList/index.js +6 -1
- package/v2Components/CapTagListWithInput/index.js +5 -1
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
- package/v2Components/ErrorInfoNote/constants.js +1 -0
- package/v2Components/ErrorInfoNote/index.js +457 -72
- package/v2Components/ErrorInfoNote/messages.js +36 -6
- package/v2Components/ErrorInfoNote/style.scss +282 -6
- package/v2Components/FormBuilder/tests/index.test.js +13 -4
- package/v2Components/HtmlEditor/HTMLEditor.js +547 -94
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +874 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1441 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +27 -16
- package/v2Components/HtmlEditor/_htmlEditor.scss +108 -45
- package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +23 -102
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -140
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +9 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +4 -4
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +22 -43
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +1 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +50 -34
- package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +6 -0
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +70 -41
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +255 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +364 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +42 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +103 -0
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/hooks/useValidation.js +189 -53
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +92 -94
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +94 -45
- package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +134 -0
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +40 -41
- package/v2Components/HtmlEditor/utils/htmlValidator.js +71 -72
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +134 -102
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +66 -41
- package/v2Components/HtmlEditor/utils/validationConstants.js +40 -0
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +55 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -0
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +172 -90
- package/v2Containers/BeePopupEditor/_beePopupEditor.scss +14 -0
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +194 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +3 -4
- package/v2Containers/CreativesContainer/SlideBoxContent.js +129 -107
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +163 -13
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +1 -3
- package/v2Containers/CreativesContainer/index.js +239 -214
- package/v2Containers/CreativesContainer/messages.js +8 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -210
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +11 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -354
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +106 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +234 -29
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +61 -7
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/Email/tests/reducer.test.js +46 -0
- package/v2Containers/Email/tests/sagas.test.js +320 -29
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1285 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +211 -21
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +1880 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +520 -0
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +629 -77
- package/v2Containers/EmailWrapper/index.js +103 -23
- package/v2Containers/EmailWrapper/messages.js +65 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +643 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +594 -77
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
- package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
- package/v2Containers/InApp/actions.js +7 -0
- package/v2Containers/InApp/constants.js +20 -4
- package/v2Containers/InApp/index.js +802 -359
- package/v2Containers/InApp/index.scss +4 -3
- package/v2Containers/InApp/messages.js +7 -3
- package/v2Containers/InApp/reducer.js +21 -3
- package/v2Containers/InApp/sagas.js +29 -9
- package/v2Containers/InApp/selectors.js +25 -5
- package/v2Containers/InApp/tests/index.test.js +154 -50
- package/v2Containers/InApp/tests/reducer.test.js +34 -0
- package/v2Containers/InApp/tests/sagas.test.js +61 -9
- package/v2Containers/InApp/tests/selectors.test.js +612 -0
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +151 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +23 -0
- package/v2Containers/InAppWrapper/constants.js +16 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
- package/v2Containers/InAppWrapper/index.js +148 -0
- package/v2Containers/InAppWrapper/messages.js +49 -0
- package/v2Containers/InappAdvance/index.js +1099 -0
- package/v2Containers/InappAdvance/index.scss +10 -0
- package/v2Containers/InappAdvance/tests/index.test.js +448 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +15 -36
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +8 -8
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +77 -100
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +63 -72
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +190 -250
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +12 -16
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +40 -48
- package/v2Containers/TagList/index.js +62 -19
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +56 -202
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +123 -278
- package/v2Containers/Templates/messages.js +4 -24
- package/v2Containers/Templates/reducer.js +0 -2
- package/v2Containers/Templates/tests/index.test.js +0 -10
- package/v2Containers/TemplatesV2/index.js +7 -15
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +768 -1272
- package/utils/imageUrlUpload.js +0 -141
- package/v2Components/CapImageUrlUpload/constants.js +0 -26
- package/v2Components/CapImageUrlUpload/index.js +0 -365
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +0 -152
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +0 -108
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -172
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -145
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +0 -164
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +0 -463
- package/v2Containers/WebPush/Create/components/FormActions.js +0 -54
- package/v2Containers/WebPush/Create/components/FormActions.test.js +0 -163
- package/v2Containers/WebPush/Create/components/MediaSection.js +0 -142
- package/v2Containers/WebPush/Create/components/MediaSection.test.js +0 -341
- package/v2Containers/WebPush/Create/components/MessageSection.js +0 -103
- package/v2Containers/WebPush/Create/components/MessageSection.test.js +0 -268
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +0 -87
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +0 -210
- package/v2Containers/WebPush/Create/components/TemplateNameSection.js +0 -54
- package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +0 -143
- package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +0 -86
- package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +0 -16
- package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +0 -41
- package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +0 -54
- package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +0 -37
- package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +0 -21
- package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
- package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
- package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
- package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -78
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +0 -138
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +0 -406
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +0 -30
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +0 -151
- package/v2Containers/WebPush/Create/hooks/useImageUpload.js +0 -104
- package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +0 -538
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -122
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -633
- package/v2Containers/WebPush/Create/index.js +0 -1148
- package/v2Containers/WebPush/Create/index.scss +0 -134
- package/v2Containers/WebPush/Create/messages.js +0 -203
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -228
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -294
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -90
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -305
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -155
- package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
- package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-down.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
- package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
- package/v2Containers/WebPush/Create/preview/assets/macos-arrow-down-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
- package/v2Containers/WebPush/Create/preview/assets/windows-close-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -47
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -141
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -68
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -61
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -99
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -733
- package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +0 -571
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -81
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +0 -81
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -50
- package/v2Containers/WebPush/Create/preview/constants.js +0 -637
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -79
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -351
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -370
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -47
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -207
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -153
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -101
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -229
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1081
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -1327
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -131
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -112
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -129
- package/v2Containers/WebPush/Create/utils/payloadBuilder.js +0 -96
- package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +0 -396
- package/v2Containers/WebPush/Create/utils/previewUtils.js +0 -89
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -115
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/Create/utils/validation.js +0 -75
- package/v2Containers/WebPush/Create/utils/validation.test.js +0 -283
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -132
- package/v2Containers/WebPush/index.js +0 -2
- package/v2Containers/WebPush/reducer.js +0 -104
- package/v2Containers/WebPush/sagas.js +0 -119
- package/v2Containers/WebPush/selectors.js +0 -65
- package/v2Containers/WebPush/tests/reducer.test.js +0 -863
- package/v2Containers/WebPush/tests/sagas.test.js +0 -566
- package/v2Containers/WebPush/tests/selectors.test.js +0 -960
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports[`Test SlideBoxContent container campaign message, add creative click rcs 1`] = `
|
|
4
4
|
<CreativesContainer__SlideBoxWrapper
|
|
5
5
|
className="add-creatives-section creatives-library-mode "
|
|
6
|
+
shouldApplyFooterMargin={false}
|
|
6
7
|
slideBoxWrapperMargin={0}
|
|
7
8
|
>
|
|
8
9
|
<CapSlideBox
|
|
@@ -17,6 +18,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
17
18
|
handleCloseTestAndPreview={[Function]}
|
|
18
19
|
handleTestAndPreview={[Function]}
|
|
19
20
|
hostName=""
|
|
21
|
+
inAppEditorType={null}
|
|
20
22
|
isTestAndPreviewMode={false}
|
|
21
23
|
loyaltyMetaData={
|
|
22
24
|
Object {
|
|
@@ -32,6 +34,9 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
32
34
|
onEnterTemplateName={[Function]}
|
|
33
35
|
onFTPSubmit={[MockFunction]}
|
|
34
36
|
onFacebookSubmit={[MockFunction]}
|
|
37
|
+
onHtmlEditorValidationStateChange={[Function]}
|
|
38
|
+
onInAppEditorTypeChange={[Function]}
|
|
39
|
+
onInAppModeChange={[Function]}
|
|
35
40
|
onMobilepushModeChange={[Function]}
|
|
36
41
|
onPreviewTemplate={[Function]}
|
|
37
42
|
onRemoveTemplateName={[Function]}
|
|
@@ -89,6 +94,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
89
94
|
exports[`Test SlideBoxContent container campaign message, add creative click whatsapp 1`] = `
|
|
90
95
|
<CreativesContainer__SlideBoxWrapper
|
|
91
96
|
className="add-creatives-section creatives-library-mode "
|
|
97
|
+
shouldApplyFooterMargin={false}
|
|
92
98
|
slideBoxWrapperMargin={0}
|
|
93
99
|
>
|
|
94
100
|
<CapSlideBox
|
|
@@ -103,6 +109,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
103
109
|
handleCloseTestAndPreview={[Function]}
|
|
104
110
|
handleTestAndPreview={[Function]}
|
|
105
111
|
hostName=""
|
|
112
|
+
inAppEditorType={null}
|
|
106
113
|
isTestAndPreviewMode={false}
|
|
107
114
|
loyaltyMetaData={
|
|
108
115
|
Object {
|
|
@@ -118,6 +125,9 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
118
125
|
onEnterTemplateName={[Function]}
|
|
119
126
|
onFTPSubmit={[MockFunction]}
|
|
120
127
|
onFacebookSubmit={[MockFunction]}
|
|
128
|
+
onHtmlEditorValidationStateChange={[Function]}
|
|
129
|
+
onInAppEditorTypeChange={[Function]}
|
|
130
|
+
onInAppModeChange={[Function]}
|
|
121
131
|
onMobilepushModeChange={[Function]}
|
|
122
132
|
onPreviewTemplate={[Function]}
|
|
123
133
|
onRemoveTemplateName={[Function]}
|
|
@@ -175,6 +185,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
175
185
|
exports[`Test SlideBoxContent container campaign message, whatsapp edit all data 1`] = `
|
|
176
186
|
<CreativesContainer__SlideBoxWrapper
|
|
177
187
|
className="add-creatives-section creatives-library-mode "
|
|
188
|
+
shouldApplyFooterMargin={false}
|
|
178
189
|
slideBoxWrapperMargin={0}
|
|
179
190
|
>
|
|
180
191
|
<CapSlideBox
|
|
@@ -189,6 +200,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
189
200
|
handleCloseTestAndPreview={[Function]}
|
|
190
201
|
handleTestAndPreview={[Function]}
|
|
191
202
|
hostName=""
|
|
203
|
+
inAppEditorType={null}
|
|
192
204
|
isTestAndPreviewMode={false}
|
|
193
205
|
loyaltyMetaData={
|
|
194
206
|
Object {
|
|
@@ -204,6 +216,9 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
204
216
|
onEnterTemplateName={[Function]}
|
|
205
217
|
onFTPSubmit={[MockFunction]}
|
|
206
218
|
onFacebookSubmit={[MockFunction]}
|
|
219
|
+
onHtmlEditorValidationStateChange={[Function]}
|
|
220
|
+
onInAppEditorTypeChange={[Function]}
|
|
221
|
+
onInAppModeChange={[Function]}
|
|
207
222
|
onMobilepushModeChange={[Function]}
|
|
208
223
|
onPreviewTemplate={[Function]}
|
|
209
224
|
onRemoveTemplateName={[Function]}
|
|
@@ -226,20 +241,47 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
226
241
|
}
|
|
227
242
|
footer={
|
|
228
243
|
<SlideBoxFooter
|
|
244
|
+
continueButtonLabel={
|
|
245
|
+
Object {
|
|
246
|
+
"defaultMessage": "Next",
|
|
247
|
+
"id": "creatives.containersV2.Creatives.next",
|
|
248
|
+
}
|
|
249
|
+
}
|
|
229
250
|
currentChannel="WHATSAPP"
|
|
230
251
|
currentTab="ANDROID"
|
|
252
|
+
emailCreateMode=""
|
|
231
253
|
errorMessages={
|
|
232
254
|
Object {
|
|
233
255
|
"LIQUID_ERROR_MSG": Array [],
|
|
234
256
|
"STANDARD_ERROR_MSG": Array [],
|
|
235
257
|
}
|
|
236
258
|
}
|
|
259
|
+
fetchingCmsData={false}
|
|
260
|
+
htmlEditorValidationState={
|
|
261
|
+
Object {
|
|
262
|
+
"errorsAcknowledged": false,
|
|
263
|
+
"isContentEmpty": true,
|
|
264
|
+
"issueCounts": Object {
|
|
265
|
+
"html": 0,
|
|
266
|
+
"label": 0,
|
|
267
|
+
"liquid": 0,
|
|
268
|
+
"total": 0,
|
|
269
|
+
},
|
|
270
|
+
"validationComplete": false,
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
isContinueButtonDisabled={true}
|
|
274
|
+
isCreatingTemplate={false}
|
|
275
|
+
isEmptyContent={false}
|
|
276
|
+
isFullMode={false}
|
|
237
277
|
isLiquidValidationError={false}
|
|
278
|
+
isTemplateNameEmpty={false}
|
|
238
279
|
onCreateNextStep={[Function]}
|
|
239
280
|
onDiscard={[Function]}
|
|
240
281
|
onEditTemplate={[Function]}
|
|
241
282
|
onSave={[Function]}
|
|
242
283
|
onTestAndPreview={[Function]}
|
|
284
|
+
selectedEmailCreateMode={null}
|
|
243
285
|
shouldShowContinueFooter={[Function]}
|
|
244
286
|
shouldShowDoneFooter={[Function]}
|
|
245
287
|
showTestAndPreviewButton={true}
|
|
@@ -273,6 +315,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
273
315
|
exports[`Test SlideBoxContent container campaign message, whatsapp edit min data 1`] = `
|
|
274
316
|
<CreativesContainer__SlideBoxWrapper
|
|
275
317
|
className="add-creatives-section creatives-library-mode "
|
|
318
|
+
shouldApplyFooterMargin={false}
|
|
276
319
|
slideBoxWrapperMargin={0}
|
|
277
320
|
>
|
|
278
321
|
<CapSlideBox
|
|
@@ -287,6 +330,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
287
330
|
handleCloseTestAndPreview={[Function]}
|
|
288
331
|
handleTestAndPreview={[Function]}
|
|
289
332
|
hostName=""
|
|
333
|
+
inAppEditorType={null}
|
|
290
334
|
isTestAndPreviewMode={false}
|
|
291
335
|
loyaltyMetaData={
|
|
292
336
|
Object {
|
|
@@ -302,6 +346,9 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
302
346
|
onEnterTemplateName={[Function]}
|
|
303
347
|
onFTPSubmit={[MockFunction]}
|
|
304
348
|
onFacebookSubmit={[MockFunction]}
|
|
349
|
+
onHtmlEditorValidationStateChange={[Function]}
|
|
350
|
+
onInAppEditorTypeChange={[Function]}
|
|
351
|
+
onInAppModeChange={[Function]}
|
|
305
352
|
onMobilepushModeChange={[Function]}
|
|
306
353
|
onPreviewTemplate={[Function]}
|
|
307
354
|
onRemoveTemplateName={[Function]}
|
|
@@ -324,20 +371,47 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
324
371
|
}
|
|
325
372
|
footer={
|
|
326
373
|
<SlideBoxFooter
|
|
374
|
+
continueButtonLabel={
|
|
375
|
+
Object {
|
|
376
|
+
"defaultMessage": "Next",
|
|
377
|
+
"id": "creatives.containersV2.Creatives.next",
|
|
378
|
+
}
|
|
379
|
+
}
|
|
327
380
|
currentChannel="WHATSAPP"
|
|
328
381
|
currentTab="ANDROID"
|
|
382
|
+
emailCreateMode=""
|
|
329
383
|
errorMessages={
|
|
330
384
|
Object {
|
|
331
385
|
"LIQUID_ERROR_MSG": Array [],
|
|
332
386
|
"STANDARD_ERROR_MSG": Array [],
|
|
333
387
|
}
|
|
334
388
|
}
|
|
389
|
+
fetchingCmsData={false}
|
|
390
|
+
htmlEditorValidationState={
|
|
391
|
+
Object {
|
|
392
|
+
"errorsAcknowledged": false,
|
|
393
|
+
"isContentEmpty": true,
|
|
394
|
+
"issueCounts": Object {
|
|
395
|
+
"html": 0,
|
|
396
|
+
"label": 0,
|
|
397
|
+
"liquid": 0,
|
|
398
|
+
"total": 0,
|
|
399
|
+
},
|
|
400
|
+
"validationComplete": false,
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
isContinueButtonDisabled={true}
|
|
404
|
+
isCreatingTemplate={false}
|
|
405
|
+
isEmptyContent={false}
|
|
406
|
+
isFullMode={false}
|
|
335
407
|
isLiquidValidationError={false}
|
|
408
|
+
isTemplateNameEmpty={false}
|
|
336
409
|
onCreateNextStep={[Function]}
|
|
337
410
|
onDiscard={[Function]}
|
|
338
411
|
onEditTemplate={[Function]}
|
|
339
412
|
onSave={[Function]}
|
|
340
413
|
onTestAndPreview={[Function]}
|
|
414
|
+
selectedEmailCreateMode={null}
|
|
341
415
|
shouldShowContinueFooter={[Function]}
|
|
342
416
|
shouldShowDoneFooter={[Function]}
|
|
343
417
|
showTestAndPreviewButton={true}
|
|
@@ -371,6 +445,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
371
445
|
exports[`Test SlideBoxContent container it should clear the url, on channel change from new whatsapp to another 1`] = `
|
|
372
446
|
<CreativesContainer__SlideBoxWrapper
|
|
373
447
|
className="add-creatives-section creatives-library-mode "
|
|
448
|
+
shouldApplyFooterMargin={false}
|
|
374
449
|
slideBoxWrapperMargin={0}
|
|
375
450
|
>
|
|
376
451
|
<CapSlideBox
|
|
@@ -385,6 +460,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
385
460
|
handleCloseTestAndPreview={[Function]}
|
|
386
461
|
handleTestAndPreview={[Function]}
|
|
387
462
|
hostName=""
|
|
463
|
+
inAppEditorType={null}
|
|
388
464
|
isTestAndPreviewMode={false}
|
|
389
465
|
loyaltyMetaData={
|
|
390
466
|
Object {
|
|
@@ -400,6 +476,9 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
400
476
|
onEnterTemplateName={[Function]}
|
|
401
477
|
onFTPSubmit={[MockFunction]}
|
|
402
478
|
onFacebookSubmit={[MockFunction]}
|
|
479
|
+
onHtmlEditorValidationStateChange={[Function]}
|
|
480
|
+
onInAppEditorTypeChange={[Function]}
|
|
481
|
+
onInAppModeChange={[Function]}
|
|
403
482
|
onMobilepushModeChange={[Function]}
|
|
404
483
|
onPreviewTemplate={[Function]}
|
|
405
484
|
onRemoveTemplateName={[Function]}
|
|
@@ -422,20 +501,47 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
422
501
|
}
|
|
423
502
|
footer={
|
|
424
503
|
<SlideBoxFooter
|
|
504
|
+
continueButtonLabel={
|
|
505
|
+
Object {
|
|
506
|
+
"defaultMessage": "Next",
|
|
507
|
+
"id": "creatives.containersV2.Creatives.next",
|
|
508
|
+
}
|
|
509
|
+
}
|
|
425
510
|
currentChannel="WHATSAPP"
|
|
426
511
|
currentTab="ANDROID"
|
|
512
|
+
emailCreateMode=""
|
|
427
513
|
errorMessages={
|
|
428
514
|
Object {
|
|
429
515
|
"LIQUID_ERROR_MSG": Array [],
|
|
430
516
|
"STANDARD_ERROR_MSG": Array [],
|
|
431
517
|
}
|
|
432
518
|
}
|
|
519
|
+
fetchingCmsData={false}
|
|
520
|
+
htmlEditorValidationState={
|
|
521
|
+
Object {
|
|
522
|
+
"errorsAcknowledged": false,
|
|
523
|
+
"isContentEmpty": true,
|
|
524
|
+
"issueCounts": Object {
|
|
525
|
+
"html": 0,
|
|
526
|
+
"label": 0,
|
|
527
|
+
"liquid": 0,
|
|
528
|
+
"total": 0,
|
|
529
|
+
},
|
|
530
|
+
"validationComplete": false,
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
isContinueButtonDisabled={true}
|
|
534
|
+
isCreatingTemplate={false}
|
|
535
|
+
isEmptyContent={false}
|
|
536
|
+
isFullMode={false}
|
|
433
537
|
isLiquidValidationError={false}
|
|
538
|
+
isTemplateNameEmpty={false}
|
|
434
539
|
onCreateNextStep={[Function]}
|
|
435
540
|
onDiscard={[Function]}
|
|
436
541
|
onEditTemplate={[Function]}
|
|
437
542
|
onSave={[Function]}
|
|
438
543
|
onTestAndPreview={[Function]}
|
|
544
|
+
selectedEmailCreateMode={null}
|
|
439
545
|
shouldShowContinueFooter={[Function]}
|
|
440
546
|
shouldShowDoneFooter={[Function]}
|
|
441
547
|
showTestAndPreviewButton={true}
|
|
@@ -66,6 +66,13 @@ export function clearCRUDResponse() {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export function getCmsAccounts(cmsType) {
|
|
70
|
+
return {
|
|
71
|
+
type: types.GET_CMS_ACCOUNTS_REQUEST,
|
|
72
|
+
cmsType,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
export function clearStoreValues() {
|
|
70
77
|
return {
|
|
71
78
|
type: types.CLEAR_ALL_VALUES,
|
|
@@ -36,4 +36,8 @@ export const DUPLICATE_TEMPLATE_REQUEST = 'app/v2Containers/Email/DUPLICATE_TEMP
|
|
|
36
36
|
export const DUPLICATE_TEMPLATE_SUCCESS = 'app/v2Containers/Email/DUPLICATE_TEMPLATE_SUCCESS';
|
|
37
37
|
export const DUPLICATE_TEMPLATE_FAILURE = 'app/v2Containers/Email/DUPLICATE_TEMPLATE_FAILURE';
|
|
38
38
|
|
|
39
|
-
export const TRANSFORM_EMAIL_TEMPLATE_REQUEST = 'app/v2Containers/Email/TRANSFORM_EMAIL_TEMPLATE_REQUEST';
|
|
39
|
+
export const TRANSFORM_EMAIL_TEMPLATE_REQUEST = 'app/v2Containers/Email/TRANSFORM_EMAIL_TEMPLATE_REQUEST';
|
|
40
|
+
|
|
41
|
+
export const GET_CMS_ACCOUNTS_REQUEST = 'app/v2Containers/Email/GET_CMS_ACCOUNTS_REQUEST';
|
|
42
|
+
export const GET_CMS_ACCOUNTS_SUCCESS = 'app/v2Containers/Email/GET_CMS_ACCOUNTS_SUCCESS';
|
|
43
|
+
export const GET_CMS_ACCOUNTS_FAILURE = 'app/v2Containers/Email/GET_CMS_ACCOUNTS_FAILURE';
|
|
@@ -207,13 +207,31 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
207
207
|
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
208
208
|
const isBEEAppEnable = this.checkBeeEditorAllowedForLibrary();
|
|
209
209
|
if (!_.isEmpty(this.props.Templates.BEETemplate)) {
|
|
210
|
-
|
|
210
|
+
const isDragDrop = this.props.Templates.BEETemplate.versions?.base?.is_drag_drop;
|
|
211
|
+
|
|
212
|
+
if (isDragDrop && isBEEAppEnable ) {
|
|
211
213
|
this.setState({isDragDrop: true});
|
|
212
214
|
}
|
|
213
215
|
if (this.props.params.id) {
|
|
214
|
-
|
|
216
|
+
// Extract drag_drop_id - check multiple possible paths
|
|
217
|
+
const activeTab = this.props.Templates.BEETemplate.versions?.base?.activeTab || 'en';
|
|
218
|
+
const activeTabData = this.props.Templates.BEETemplate.versions?.base?.[activeTab] || {};
|
|
219
|
+
const dragDropId = activeTabData.drag_drop_id
|
|
220
|
+
|| activeTabData.id
|
|
221
|
+
|| _.get(this.props.Templates.BEETemplate, 'versions.base.drag_drop_id')
|
|
222
|
+
|| _.get(this.props.Templates.BEETemplate, 'versions.base.id')
|
|
223
|
+
|| this.props.Templates.BEETemplate?._id;
|
|
224
|
+
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'open', undefined, isBEESupport, isBEEAppEnable);
|
|
215
225
|
} else if (this.props.location.query.module !== "library" || (this.props.location.query.module === "library" && !this.props.templateData)) {
|
|
216
|
-
|
|
226
|
+
// Extract drag_drop_id - check multiple possible paths
|
|
227
|
+
const activeTab = this.props.Templates.BEETemplate.versions?.base?.activeTab || 'en';
|
|
228
|
+
const activeTabData = this.props.Templates.BEETemplate.versions?.base?.[activeTab] || {};
|
|
229
|
+
const dragDropId = activeTabData.drag_drop_id
|
|
230
|
+
|| activeTabData.id
|
|
231
|
+
|| _.get(this.props.Templates.BEETemplate, 'versions.base.drag_drop_id')
|
|
232
|
+
|| _.get(this.props.Templates.BEETemplate, 'versions.base.id')
|
|
233
|
+
|| this.props.Templates.BEETemplate?._id;
|
|
234
|
+
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
217
235
|
}
|
|
218
236
|
}
|
|
219
237
|
this.setState({ content: (this.props.Templates.selectedEmailLayout ? this.props.Templates.selectedEmailLayout : ''), formData});
|
|
@@ -236,11 +254,52 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
236
254
|
if (this.props.location.query.type === 'embedded') {
|
|
237
255
|
this.showNext();
|
|
238
256
|
}
|
|
257
|
+
|
|
258
|
+
// Check if BEETemplate was set after componentWillMount but before componentDidMount
|
|
259
|
+
// This can happen if BEETemplate is set asynchronously
|
|
260
|
+
if (!_.isEmpty(this.props.Templates.BEETemplate) && !this.state.isDragDrop) {
|
|
261
|
+
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
262
|
+
const isBEEAppEnable = this.checkBeeEditorAllowedForLibrary();
|
|
263
|
+
const beeTemplate = this.props.Templates.BEETemplate;
|
|
264
|
+
const activeTab = beeTemplate.versions?.base?.activeTab || 'en';
|
|
265
|
+
const activeTabData = beeTemplate.versions?.base?.[activeTab] || {};
|
|
266
|
+
const isDragDrop = activeTabData.is_drag_drop
|
|
267
|
+
|| beeTemplate.versions?.base?.is_drag_drop
|
|
268
|
+
|| beeTemplate.base?.is_drag_drop
|
|
269
|
+
|| beeTemplate.is_drag_drop;
|
|
270
|
+
|
|
271
|
+
if (isDragDrop && isBEEAppEnable) {
|
|
272
|
+
this.setState({isDragDrop: true});
|
|
273
|
+
|
|
274
|
+
const dragDropId = activeTabData.drag_drop_id
|
|
275
|
+
|| activeTabData.id
|
|
276
|
+
|| _.get(beeTemplate, 'versions.base.drag_drop_id')
|
|
277
|
+
|| _.get(beeTemplate, 'versions.base.id')
|
|
278
|
+
|| beeTemplate._id;
|
|
279
|
+
|
|
280
|
+
if (this.props.params.id) {
|
|
281
|
+
const activeTabForLang = beeTemplate.versions?.base?.activeTab || 'en';
|
|
282
|
+
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'open', activeTabForLang, isBEESupport, isBEEAppEnable);
|
|
283
|
+
} else {
|
|
284
|
+
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
239
288
|
}
|
|
240
289
|
|
|
241
290
|
|
|
242
|
-
checkBeeEditorAllowedForLibrary = () => {
|
|
243
|
-
|
|
291
|
+
checkBeeEditorAllowedForLibrary = (props = null) => {
|
|
292
|
+
// Allow passing props for use in componentWillReceiveProps (to use nextProps)
|
|
293
|
+
const componentProps = props || this.props;
|
|
294
|
+
const { isFullMode = false, editor, Email } = componentProps || {};
|
|
295
|
+
// IMPORTANT: For isBEEAppEnable API parameter, use API response if available
|
|
296
|
+
// This ensures consistent behavior across full mode and library mode
|
|
297
|
+
// The API response (Email.isBeeEnabled) represents the actual org setting
|
|
298
|
+
if (Email?.isBeeEnabled !== undefined && Email?.isBeeEnabled !== null) {
|
|
299
|
+
return Email.isBeeEnabled;
|
|
300
|
+
}
|
|
301
|
+
// Fallback to mode-based logic for UI purposes (editor selection, etc.)
|
|
302
|
+
// But for API calls, this should ideally use the API response
|
|
244
303
|
if ((editor === "BEE" && !isFullMode) || isFullMode) {
|
|
245
304
|
return true;
|
|
246
305
|
}
|
|
@@ -341,9 +400,61 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
341
400
|
// this.props.globalActions.fetchSchemaForEntity(query);
|
|
342
401
|
// }
|
|
343
402
|
|
|
403
|
+
// Check if BEETemplate was just set (for new flow when template details load)
|
|
404
|
+
// This handles the case where BEETemplate is set after componentWillMount
|
|
405
|
+
const wasBEETemplateEmpty = _.isEmpty(this.props.Templates.BEETemplate);
|
|
406
|
+
const isBEETemplateNowSet = !_.isEmpty(nextProps.Templates.BEETemplate);
|
|
407
|
+
const isBEEAppEnable = this.checkBeeEditorAllowedForLibrary(nextProps);
|
|
408
|
+
const isBEESupport = (nextProps.location.query.isBEESupport !== "false") || false;
|
|
409
|
+
|
|
410
|
+
if (wasBEETemplateEmpty && isBEETemplateNowSet && isBEEAppEnable) {
|
|
411
|
+
const beeTemplate = nextProps.Templates.BEETemplate;
|
|
412
|
+
const isDragDrop = beeTemplate.versions?.base?.is_drag_drop
|
|
413
|
+
|| beeTemplate.versions?.base?.[beeTemplate.versions?.base?.activeTab || 'en']?.is_drag_drop
|
|
414
|
+
|| beeTemplate.base?.is_drag_drop
|
|
415
|
+
|| beeTemplate.is_drag_drop;
|
|
416
|
+
|
|
417
|
+
// Check if we're in edit mode - check multiple sources for id
|
|
418
|
+
const hasParamsId = nextProps.params?.id
|
|
419
|
+
|| nextProps.location?.query?.id
|
|
420
|
+
|| nextProps.location?.params?.id
|
|
421
|
+
|| (nextProps.location?.pathname && nextProps.location.pathname.includes('/edit/'));
|
|
422
|
+
|
|
423
|
+
if (isDragDrop) {
|
|
424
|
+
this.setState({isDragDrop: true});
|
|
425
|
+
|
|
426
|
+
// Extract drag_drop_id - check multiple possible paths
|
|
427
|
+
// Priority: versions.base[activeTab].drag_drop_id > versions.base[activeTab].id > versions.base.drag_drop_id > _id
|
|
428
|
+
const activeTab = beeTemplate.versions?.base?.activeTab || 'en';
|
|
429
|
+
const activeTabData = beeTemplate.versions?.base?.[activeTab] || {};
|
|
430
|
+
let dragDropId = activeTabData.drag_drop_id
|
|
431
|
+
|| activeTabData.id
|
|
432
|
+
|| beeTemplate.versions?.base?.drag_drop_id
|
|
433
|
+
|| beeTemplate.versions?.base?.id
|
|
434
|
+
|| beeTemplate.base?.drag_drop_id
|
|
435
|
+
|| beeTemplate.base?.id
|
|
436
|
+
|| beeTemplate._id;
|
|
437
|
+
|
|
438
|
+
// Call getCmsSetting for BEE template - use 'open' mode if in edit mode
|
|
439
|
+
// Extract langId from active tab
|
|
440
|
+
const activeTabForLang = beeTemplate.versions?.base?.activeTab || 'en';
|
|
441
|
+
if (hasParamsId) {
|
|
442
|
+
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'open', activeTabForLang, isBEESupport, isBEEAppEnable);
|
|
443
|
+
} else if (nextProps.location.query.module !== "library" || (nextProps.location.query.module === "library" && !nextProps.templateData)) {
|
|
444
|
+
this.props.actions.getCmsSetting(BEE_PLUGIN, dragDropId, 'create', undefined, isBEESupport, isBEEAppEnable);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
344
449
|
if (this.state.isEdit && !this.state.editDataSet && !_.isEmpty(nextProps.Email.templateDetails) && !_.isEmpty(this.state.schema)) {
|
|
345
450
|
this.setState({editDataSet: true}, () => {
|
|
346
451
|
this.setEditData(nextProps.Email.templateDetails);
|
|
452
|
+
// Update template name in parent if available
|
|
453
|
+
if (this.props.isFullMode && this.props.showTemplateName && nextProps.Email.templateDetails.name) {
|
|
454
|
+
const formData = this.state.formData;
|
|
455
|
+
formData['template-name'] = nextProps.Email.templateDetails.name;
|
|
456
|
+
this.props.showTemplateName({formData, onFormDataChange: this.onFormDataChange});
|
|
457
|
+
}
|
|
347
458
|
});
|
|
348
459
|
}
|
|
349
460
|
if (this.state.isEdit && nextProps.location.query.module === "library" && !_.isEmpty(nextProps.templateData) && !this.props.params.id && !nextProps.isGetFormData && _.isEmpty(_.get(this, `state.formData['template-subject']`))) {
|
|
@@ -382,7 +493,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
382
493
|
const formData = _.cloneDeep(this.state.formData);
|
|
383
494
|
|
|
384
495
|
const schema = _.cloneDeep(this.state.schema);
|
|
385
|
-
const langIndex = formData[this.state.currentTab - 1]
|
|
496
|
+
const langIndex = formData[this.state.currentTab - 1]?.selectedLanguages?.indexOf(langId);
|
|
386
497
|
|
|
387
498
|
const temp = (schema.containers || {})[this.state.currentTab - 1];
|
|
388
499
|
|
|
@@ -390,32 +501,91 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
390
501
|
if (nextProps.Email.CmsSettings.isDragDrop && this.checkBeeEditorAllowedForLibrary()) {
|
|
391
502
|
const beeJson = `BEEeditor${currentTab > 1 ? currentTab : ''}json`;
|
|
392
503
|
const beeToken = `BEEeditor${currentTab > 1 ? currentTab : ''}token`;
|
|
393
|
-
let beeJsonValue =
|
|
504
|
+
let beeJsonValue = '';
|
|
394
505
|
const selectedId = _.get(this.props, 'Email.templateDetails._id', '') || _.get(this.props, 'Templates.BEETemplate.versions.base.drag_drop_id', '');
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
506
|
+
|
|
507
|
+
// Get beeJsonValue from template data - check multiple sources
|
|
508
|
+
// First check if it's already in formData (from setEditData)
|
|
509
|
+
beeJsonValue = _.get(this.state, `formData[${currentTab - 1}][${langId}].json-content`, '');
|
|
510
|
+
|
|
511
|
+
// Also check formData.base
|
|
512
|
+
if (!beeJsonValue) {
|
|
513
|
+
beeJsonValue = _.get(this.state, `formData.base[${langId}].json-content`, '');
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// Always check templateDetails and BEETemplate regardless of mode
|
|
517
|
+
if (!beeJsonValue) {
|
|
518
|
+
// Check Email.templateDetails first
|
|
519
|
+
const templateDetails = nextProps.Email.templateDetails;
|
|
520
|
+
if (templateDetails && templateDetails.versions && templateDetails.versions.base) {
|
|
521
|
+
const baseVersion = templateDetails.versions.base;
|
|
522
|
+
// Try language-specific path first (e.g., base.en.json-content)
|
|
523
|
+
if (baseVersion[langId] && baseVersion[langId]['json-content']) {
|
|
524
|
+
beeJsonValue = baseVersion[langId]['json-content'];
|
|
525
|
+
} else if (baseVersion['json-content']) {
|
|
526
|
+
// Fallback to base-level json-content
|
|
527
|
+
beeJsonValue = baseVersion['json-content'];
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// If still not found, check BEETemplate
|
|
532
|
+
if (!beeJsonValue) {
|
|
533
|
+
const beeTemplate = nextProps.Templates.BEETemplate;
|
|
534
|
+
if (beeTemplate && beeTemplate.versions && beeTemplate.versions.base) {
|
|
535
|
+
const beeBase = beeTemplate.versions.base;
|
|
536
|
+
if (beeBase[langId] && beeBase[langId]['json-content']) {
|
|
537
|
+
beeJsonValue = beeBase[langId]['json-content'];
|
|
538
|
+
} else if (beeBase['json-content']) {
|
|
539
|
+
beeJsonValue = beeBase['json-content'];
|
|
540
|
+
}
|
|
541
|
+
}
|
|
400
542
|
}
|
|
401
543
|
}
|
|
544
|
+
// Ensure we have a valid beeJsonValue - if it's a string, try to parse it to verify it's valid JSON
|
|
545
|
+
let finalBeeJsonValue = beeJsonValue;
|
|
546
|
+
if (beeJsonValue && typeof beeJsonValue === 'string') {
|
|
547
|
+
try {
|
|
548
|
+
// Try to parse to verify it's valid JSON
|
|
549
|
+
JSON.parse(beeJsonValue);
|
|
550
|
+
} catch (e) {
|
|
551
|
+
console.warn('[Email] componentWillReceiveProps - beeJsonValue is not valid JSON, using as-is:', e);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// Preserve existing formData values, especially template-subject
|
|
556
|
+
const existingFormData = formData[`${currentTab - 1}`][langId] || {};
|
|
402
557
|
formData[`${currentTab - 1}`][langId] = {
|
|
403
|
-
...
|
|
558
|
+
...existingFormData,
|
|
404
559
|
is_drag_drop: true,
|
|
405
|
-
[beeJson]:
|
|
560
|
+
[beeJson]: finalBeeJsonValue,
|
|
406
561
|
[beeToken]: nextProps.Email.CmsSettings.tokenData,
|
|
407
562
|
id: selectedId,
|
|
563
|
+
// Also store json-content for reference
|
|
564
|
+
'json-content': finalBeeJsonValue,
|
|
408
565
|
};
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: "none"};
|
|
566
|
+
|
|
567
|
+
// Ensure template-subject is preserved at the top level
|
|
568
|
+
if (formData['template-subject'] === undefined || formData['template-subject'] === '') {
|
|
569
|
+
const subjectFromEditData = _.get(nextProps, 'Email.templateDetails.versions.base.subject', '');
|
|
570
|
+
if (subjectFromEditData) {
|
|
571
|
+
formData['template-subject'] = subjectFromEditData;
|
|
416
572
|
}
|
|
417
|
-
}
|
|
418
|
-
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (langIndex !== undefined && langIndex !== -1 && temp && temp.panes) {
|
|
576
|
+
_.forEach(temp.panes, (pane, index) => {
|
|
577
|
+
const tempPane = pane;
|
|
578
|
+
//
|
|
579
|
+
if (parseInt(index, 10) === parseInt(langIndex, 10)) {
|
|
580
|
+
//
|
|
581
|
+
if (tempPane.sections && tempPane.sections[0] && tempPane.sections[0].inputFields && tempPane.sections[0].inputFields[0] && tempPane.sections[0].inputFields[0].cols) {
|
|
582
|
+
tempPane.sections[0].inputFields[0].cols[1].colStyle = {display: ""};
|
|
583
|
+
tempPane.sections[0].inputFields[0].cols[0].colStyle = {display: "none"};
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
this.setState({schema, isSchemaChanged: true, loadingStatus: this.state.loadingStatus + 1, formData});
|
|
419
589
|
} else {
|
|
420
590
|
_.forEach(temp.panes, (pane, index) => {
|
|
421
591
|
const tempPane = pane;
|
|
@@ -712,8 +882,18 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
712
882
|
const msgString = JSON.stringify(msg);
|
|
713
883
|
const langId = formData[this.state.currentTab - 1].activeTab;
|
|
714
884
|
const langIndex = formData[this.state.currentTab - 1].selectedLanguages.indexOf(langId);
|
|
715
|
-
const
|
|
716
|
-
|
|
885
|
+
const elementToSelect = document.getElementById(`edmeditor${(langIndex + 1) > 1 ? (langIndex + 1) : ''}`);
|
|
886
|
+
if (elementToSelect) {
|
|
887
|
+
try {
|
|
888
|
+
const win = elementToSelect.contentWindow;
|
|
889
|
+
if (win) {
|
|
890
|
+
win.postMessage(msgString, '*');
|
|
891
|
+
}
|
|
892
|
+
} catch (error) {
|
|
893
|
+
// Handle cross-origin frame access errors
|
|
894
|
+
console.warn('Failed to access iframe contentWindow (cross-origin restriction):', error);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
717
897
|
} else if (data === "unsubscribe" && this.state.editorInstanse) {
|
|
718
898
|
const anchor = `<a href='{{${data}}}'>${data}</a>`;
|
|
719
899
|
this.state.editorInstanse.insertHtml(`${anchor}`);
|
|
@@ -894,6 +1074,11 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
894
1074
|
const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
|
|
895
1075
|
const formData = _.cloneDeep(this.state.formData);
|
|
896
1076
|
|
|
1077
|
+
// Set template name from editData if available
|
|
1078
|
+
if (editData.name) {
|
|
1079
|
+
formData['template-name'] = editData.name;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
897
1082
|
const schema = (this.props.location.query.type === 'embedded') ? this.removeStandAlone(this.state.schema) : _.cloneDeep(this.state.schema);
|
|
898
1083
|
const containers = _.cloneDeep(schema.containers.slice());
|
|
899
1084
|
let tabKey = "";
|
|
@@ -902,7 +1087,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
902
1087
|
const type = this.props.location.query.type;
|
|
903
1088
|
|
|
904
1089
|
formData['template-name'] = editData.name;
|
|
905
|
-
|
|
1090
|
+
const subject = _.get(editData, 'versions.base.subject', '');
|
|
1091
|
+
formData['template-subject'] = subject;
|
|
906
1092
|
formData.base = editData.versions.base;
|
|
907
1093
|
|
|
908
1094
|
_.forEach(editData.versions.history, (data1, index) => {
|
|
@@ -983,8 +1169,13 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
983
1169
|
|
|
984
1170
|
|
|
985
1171
|
this.setState({ formData, schema, tabKey, currentTab, tabCount: editData.versions.history.length, loadingStatus: this.state.loadingStatus + 1 }, () => {
|
|
986
|
-
if (this.props.isFullMode) {
|
|
987
|
-
|
|
1172
|
+
if (this.props.isFullMode && this.props.showTemplateName) {
|
|
1173
|
+
// Ensure template name is set before showing it
|
|
1174
|
+
const updatedFormData = _.cloneDeep(formData);
|
|
1175
|
+
if (editData.name && !updatedFormData['template-name']) {
|
|
1176
|
+
updatedFormData['template-name'] = editData.name;
|
|
1177
|
+
}
|
|
1178
|
+
this.props.showTemplateName({formData: updatedFormData, onFormDataChange: this.onFormDataChange});
|
|
988
1179
|
}
|
|
989
1180
|
const isBEEAppEnable = this.checkBeeEditorAllowedForLibrary();
|
|
990
1181
|
_.forEach((editData.versions.base.selectedLanguages), (language) => {
|
|
@@ -2659,6 +2850,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2659
2850
|
getTemplateDetailsInProgress,
|
|
2660
2851
|
assetUploading,
|
|
2661
2852
|
createTemplateInProgress,
|
|
2853
|
+
fetchingCmsSettings,
|
|
2662
2854
|
} = this.props.Email;
|
|
2663
2855
|
let isLoading =
|
|
2664
2856
|
isLoadingMetaEntities ||
|
|
@@ -2667,7 +2859,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2667
2859
|
) || (
|
|
2668
2860
|
assetUploading !== undefined && assetUploading
|
|
2669
2861
|
) || (
|
|
2670
|
-
Email && (fetchingCmsData || getTemplateDetailsInProgress)
|
|
2862
|
+
Email && (fetchingCmsData || getTemplateDetailsInProgress || fetchingCmsSettings)
|
|
2671
2863
|
);
|
|
2672
2864
|
|
|
2673
2865
|
if (!isLoading) {
|
|
@@ -2989,6 +3181,19 @@ function mapDispatchToProps(dispatch) {
|
|
|
2989
3181
|
const withReducer = injectReducer({ key: 'email', reducer: v2EmailReducer });
|
|
2990
3182
|
const withEmailSaga = injectSaga({ key: 'email', saga: v2EmailSagas });
|
|
2991
3183
|
|
|
3184
|
+
// Base Email component without saga registration (for use from EmailWrapper)
|
|
3185
|
+
// EmailWrapper already registers the saga, so we don't need to register it here
|
|
3186
|
+
export const EmailWithoutSaga = withCreatives({
|
|
3187
|
+
WrappedComponent: Email,
|
|
3188
|
+
mapStateToProps,
|
|
3189
|
+
mapDispatchToProps,
|
|
3190
|
+
userAuth: true,
|
|
3191
|
+
sagas: [], // No saga - EmailWrapper registers it
|
|
3192
|
+
reducers: [withReducer],
|
|
3193
|
+
});
|
|
3194
|
+
|
|
3195
|
+
// Email component with saga registration (for direct use from SlideBoxContent in Edit mode)
|
|
3196
|
+
// When Email is used directly (not as child of EmailWrapper), it needs to register the saga
|
|
2992
3197
|
export default withCreatives({
|
|
2993
3198
|
WrappedComponent: Email,
|
|
2994
3199
|
mapStateToProps,
|