@capillarytech/creatives-library 8.0.242-alpha.0 → 8.0.242-alpha.2
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 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/sagas/__tests__/assetPolling.test.js +74 -3
- package/sagas/assetPolling.js +8 -1
- package/services/api.js +10 -5
- package/services/tests/api.test.js +18 -0
- package/translations/en.json +0 -1
- package/utils/common.js +5 -0
- package/utils/commonUtils.js +14 -1
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/transformTemplateConfig.js +0 -10
- package/utils/transformerUtils.js +0 -42
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +14 -54
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +0 -4
- 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/index.js +412 -72
- package/v2Components/ErrorInfoNote/messages.js +22 -0
- package/v2Components/ErrorInfoNote/style.scss +279 -2
- package/v2Components/HtmlEditor/HTMLEditor.js +217 -90
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1132 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
- package/v2Components/HtmlEditor/_htmlEditor.scss +15 -23
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +13 -101
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -139
- 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 +1 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +1 -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 +10 -11
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +87 -62
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +29 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +95 -85
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +82 -80
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +193 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +1 -2
- package/v2Containers/CreativesContainer/index.js +173 -193
- package/v2Containers/CreativesContainer/messages.js +4 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +13 -0
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +41 -6
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1046 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
- package/v2Containers/EmailWrapper/index.js +99 -23
- package/v2Containers/EmailWrapper/messages.js +61 -1
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +26 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -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 +800 -357
- 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 +162 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -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 +3 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
- package/v2Containers/TagList/index.js +67 -1
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +56 -200
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +124 -277
- 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 +2 -3
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
- package/v2Components/CapImageUrlUpload/constants.js +0 -19
- package/v2Components/CapImageUrlUpload/index.js +0 -455
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
- 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 -80
- package/v2Containers/WebPush/Create/index.js +0 -1755
- package/v2Containers/WebPush/Create/index.scss +0 -123
- package/v2Containers/WebPush/Create/messages.js +0 -199
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
- 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/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/opera-icon.svg +0 -18
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
- package/v2Containers/WebPush/Create/preview/constants.js +0 -162
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
- 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 -303
- 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 -188
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
- 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 -127
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -108
- 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
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
IMAGE as LINE_IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, VIDEO as LINE_VIDEO, TEMPLATE, STICKER,
|
|
44
44
|
} from '../Line/Container/constants';
|
|
45
45
|
import { IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
|
|
46
|
-
import {RCS_STATUSES} from '../Rcs/constants';
|
|
46
|
+
import { RCS_STATUSES } from '../Rcs/constants';
|
|
47
47
|
import { CREATIVE } from '../Facebook/constants';
|
|
48
48
|
import { LOYALTY } from '../App/constants';
|
|
49
49
|
import {
|
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
// getTemplateDiffState
|
|
65
65
|
} from "../../utils/transformerUtils";
|
|
66
66
|
import { MANUAL_CAROUSEL } from '../MobilePushNew/constants';
|
|
67
|
+
import { BIG_HTML } from '../InApp/constants';
|
|
67
68
|
|
|
68
69
|
const classPrefix = 'add-creatives-section';
|
|
69
70
|
const CREATIVES_CONTAINER = 'creativesContainer';
|
|
@@ -95,6 +96,7 @@ export class Creatives extends React.Component {
|
|
|
95
96
|
currentChannel: this.props.channel || 'sms',
|
|
96
97
|
weChatTemplateType: '',
|
|
97
98
|
weChatMaptemplateStep: 0,
|
|
99
|
+
inAppEditorType: null,
|
|
98
100
|
isLiquidValidationError: false,
|
|
99
101
|
errorMessages: [],
|
|
100
102
|
liquidErrorMessage: {
|
|
@@ -107,6 +109,8 @@ export class Creatives extends React.Component {
|
|
|
107
109
|
isTestAndPreviewMode: false, // Add flag to track Test & Preview mode
|
|
108
110
|
// Performance optimization: Local template name for immediate UI feedback
|
|
109
111
|
localTemplateName: '',
|
|
112
|
+
// Track selected email create mode for new flow (HTML Editor vs Drag & Drop)
|
|
113
|
+
selectedEmailCreateMode: null,
|
|
110
114
|
};
|
|
111
115
|
this.liquidFlow = Boolean(commonUtil.hasLiquidSupportFeature());
|
|
112
116
|
this.creativesTemplateSteps = {
|
|
@@ -136,7 +140,7 @@ export class Creatives extends React.Component {
|
|
|
136
140
|
if (!this.props?.isFullMode) {
|
|
137
141
|
this.props?.templateActions.getCdnTransformationConfig();
|
|
138
142
|
}
|
|
139
|
-
|
|
143
|
+
|
|
140
144
|
// Store loyalty tag props if loyaltyTagFetchingDependencies is provided
|
|
141
145
|
const { loyaltyTagFetchingDependencies } = this.props;
|
|
142
146
|
if (loyaltyTagFetchingDependencies) {
|
|
@@ -162,9 +166,9 @@ export class Creatives extends React.Component {
|
|
|
162
166
|
const isEmptyTemplateName = !value.trim();
|
|
163
167
|
|
|
164
168
|
// 1. IMMEDIATE: Update local state for instant UI feedback
|
|
165
|
-
this.setState({
|
|
169
|
+
this.setState({
|
|
166
170
|
isTemplateNameEmpty: isEmptyTemplateName,
|
|
167
|
-
localTemplateName: value
|
|
171
|
+
localTemplateName: value
|
|
168
172
|
});
|
|
169
173
|
|
|
170
174
|
// 2. DEBOUNCED: Only debounce the expensive onFormDataChange call
|
|
@@ -243,8 +247,19 @@ export class Creatives extends React.Component {
|
|
|
243
247
|
onCreateNextStep = () => {
|
|
244
248
|
this.setState((prevState) => {
|
|
245
249
|
let templateStep = prevState.templateStep + 1;
|
|
246
|
-
const { emailCreateMode, currentChannel } = prevState;
|
|
247
|
-
|
|
250
|
+
const { emailCreateMode, currentChannel, selectedEmailCreateMode } = prevState;
|
|
251
|
+
|
|
252
|
+
// Check if we should skip template selection for HTML Editor
|
|
253
|
+
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
254
|
+
const shouldSkipTemplateSelection = !supportCKEditor
|
|
255
|
+
&& selectedEmailCreateMode === 'html_editor'
|
|
256
|
+
&& currentChannel.toUpperCase() === constants.EMAIL
|
|
257
|
+
&& prevState.templateStep === 1; // Only skip if we're at modeSelection step
|
|
258
|
+
|
|
259
|
+
if (shouldSkipTemplateSelection) {
|
|
260
|
+
// Skip template selection (step 2), go directly to createTemplateContent (step 3)
|
|
261
|
+
templateStep = prevState.templateStep + 2;
|
|
262
|
+
} else if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || [constants.MOBILE_PUSH, constants.WECHAT, constants.INAPP].includes(currentChannel.toUpperCase())) {
|
|
248
263
|
templateStep = prevState.templateStep + 2;
|
|
249
264
|
}
|
|
250
265
|
return {
|
|
@@ -253,14 +268,21 @@ export class Creatives extends React.Component {
|
|
|
253
268
|
});
|
|
254
269
|
}
|
|
255
270
|
|
|
256
|
-
onEmailModeChange = (mode) => {
|
|
257
|
-
this.setState({
|
|
271
|
+
onEmailModeChange = (mode, selectedMode = null) => {
|
|
272
|
+
this.setState({
|
|
273
|
+
emailCreateMode: mode,
|
|
274
|
+
selectedEmailCreateMode: selectedMode || mode, // Store the selected mode for new flow
|
|
275
|
+
});
|
|
258
276
|
}
|
|
259
277
|
|
|
260
278
|
onInAppModeChange = (mode) => {
|
|
261
279
|
this.setState({ inAppCreateMode: mode });
|
|
262
280
|
}
|
|
263
281
|
|
|
282
|
+
onInAppEditorTypeChange = (editorType) => {
|
|
283
|
+
this.setState({ inAppEditorType: editorType });
|
|
284
|
+
}
|
|
285
|
+
|
|
264
286
|
onMobilepushModeChange = (mode) => {
|
|
265
287
|
this.setState({ mobilePushCreateMode: mode });
|
|
266
288
|
}
|
|
@@ -304,7 +326,7 @@ export class Creatives extends React.Component {
|
|
|
304
326
|
}
|
|
305
327
|
return buttonObj;
|
|
306
328
|
});
|
|
307
|
-
const {url, previewUrl} = media || {};
|
|
329
|
+
const { url, previewUrl } = media || {};
|
|
308
330
|
return {
|
|
309
331
|
bodyText: bodyTemplate,
|
|
310
332
|
varMap: cardVarMapped,
|
|
@@ -433,14 +455,35 @@ export class Creatives extends React.Component {
|
|
|
433
455
|
}
|
|
434
456
|
case constants.INAPP: {
|
|
435
457
|
const mode = get(templateData, 'androidContent.type') || get(templateData, 'iosContent.type') || '';
|
|
458
|
+
|
|
459
|
+
// Check if this is a BEE editor template (identified by special title 'bee free template')
|
|
460
|
+
const isAndroidBeeEditor = templateData?.androidContent?.type === constants.HTML
|
|
461
|
+
&& templateData?.androidContent?.title?.toLowerCase() === 'bee free template';
|
|
462
|
+
const isIosBeeEditor = templateData?.iosContent?.type === constants.HTML
|
|
463
|
+
&& templateData?.iosContent?.title?.toLowerCase() === 'bee free template';
|
|
464
|
+
|
|
436
465
|
creativesTemplateData = {
|
|
437
466
|
type: channel,
|
|
438
467
|
name: templateData.messageSubject,
|
|
439
468
|
versions: {
|
|
440
469
|
base: {
|
|
441
470
|
content: {
|
|
442
|
-
ANDROID:
|
|
443
|
-
|
|
471
|
+
ANDROID: isAndroidBeeEditor ? {
|
|
472
|
+
type: templateData?.androidContent?.type,
|
|
473
|
+
bodyType: templateData?.androidContent?.bodyType,
|
|
474
|
+
deviceType: constants.ANDROID,
|
|
475
|
+
beeHtml: { value: templateData?.androidContent?.message },
|
|
476
|
+
beeJson: templateData?.androidContent?.expandableDetails?.message,
|
|
477
|
+
isBEEeditor: true,
|
|
478
|
+
} : templateData?.androidContent,
|
|
479
|
+
IOS: isIosBeeEditor ? {
|
|
480
|
+
type: templateData?.iosContent?.type,
|
|
481
|
+
bodyType: templateData?.iosContent?.bodyType,
|
|
482
|
+
deviceType: constants.IOS,
|
|
483
|
+
beeHtml: { value: templateData?.iosContent?.message },
|
|
484
|
+
beeJson: templateData?.iosContent?.expandableDetails?.message,
|
|
485
|
+
isBEEeditor: true,
|
|
486
|
+
} : templateData?.iosContent,
|
|
444
487
|
},
|
|
445
488
|
},
|
|
446
489
|
},
|
|
@@ -675,7 +718,7 @@ export class Creatives extends React.Component {
|
|
|
675
718
|
} = templateData || {};
|
|
676
719
|
const cardContent = (rcsContent.cardContent && rcsContent.cardContent[0]) || {};
|
|
677
720
|
const Status = RCS_STATUSES.approved || '';
|
|
678
|
-
|
|
721
|
+
|
|
679
722
|
creativesTemplateData = {
|
|
680
723
|
type: channel,
|
|
681
724
|
edit: true,
|
|
@@ -708,68 +751,6 @@ export class Creatives extends React.Component {
|
|
|
708
751
|
};
|
|
709
752
|
break;
|
|
710
753
|
}
|
|
711
|
-
case constants.WEBPUSH: {
|
|
712
|
-
// Convert from campaign format (messageContent.content.content) to creatives format
|
|
713
|
-
const webpushContent = get(templateData, 'content', {});
|
|
714
|
-
const accountId = get(templateData, 'accountId');
|
|
715
|
-
const templateName = templateData.name || 'Campaign message WebPush content';
|
|
716
|
-
const brandIcon = webpushContent.iconImageUrl || '';
|
|
717
|
-
|
|
718
|
-
// Map cta to onClickAction
|
|
719
|
-
let onClickAction = null;
|
|
720
|
-
if (webpushContent.cta) {
|
|
721
|
-
if (webpushContent.cta.type === 'EXTERNAL_URL') {
|
|
722
|
-
onClickAction = {
|
|
723
|
-
type: 'URL',
|
|
724
|
-
url: webpushContent.cta.actionLink || '',
|
|
725
|
-
};
|
|
726
|
-
} else {
|
|
727
|
-
onClickAction = {
|
|
728
|
-
type: webpushContent.cta.type || 'SITE_URL',
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
// Map expandableDetails.ctas to ctas array
|
|
734
|
-
let ctas = [];
|
|
735
|
-
if (webpushContent.expandableDetails?.ctas && webpushContent.expandableDetails.ctas.length > 0) {
|
|
736
|
-
ctas = webpushContent.expandableDetails.ctas.map((ctaItem) => ({
|
|
737
|
-
actionText: ctaItem.title || ctaItem.actionText || '',
|
|
738
|
-
type: 'URL',
|
|
739
|
-
actionLink: ctaItem.actionLink || '',
|
|
740
|
-
}));
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
// Map expandableDetails.media to image if present
|
|
744
|
-
let image = null;
|
|
745
|
-
if (webpushContent.expandableDetails?.media && webpushContent.expandableDetails.media.length > 0) {
|
|
746
|
-
const firstMedia = webpushContent.expandableDetails.media[0];
|
|
747
|
-
if (firstMedia.type === 'IMAGE' && firstMedia.url) {
|
|
748
|
-
image = firstMedia.url;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
creativesTemplateData = {
|
|
753
|
-
type: channel,
|
|
754
|
-
name: templateData.messageSubject,
|
|
755
|
-
versions: {
|
|
756
|
-
base: {
|
|
757
|
-
content: {
|
|
758
|
-
webpush: {
|
|
759
|
-
title: webpushContent.title || '',
|
|
760
|
-
message: webpushContent.message || '',
|
|
761
|
-
...(brandIcon && { brandIcon }),
|
|
762
|
-
...(onClickAction && { onClickAction }),
|
|
763
|
-
...(ctas.length > 0 && { ctas }),
|
|
764
|
-
...(image && { image, mediaType: "IMAGE" }),
|
|
765
|
-
},
|
|
766
|
-
},
|
|
767
|
-
},
|
|
768
|
-
},
|
|
769
|
-
definition: { accountId },
|
|
770
|
-
};
|
|
771
|
-
break;
|
|
772
|
-
}
|
|
773
754
|
default:
|
|
774
755
|
break;
|
|
775
756
|
}
|
|
@@ -822,7 +803,7 @@ export class Creatives extends React.Component {
|
|
|
822
803
|
});
|
|
823
804
|
|
|
824
805
|
getMobilePushCarouselData = (expandableDetails = []) => {
|
|
825
|
-
const newExpandableDetails = {...expandableDetails};
|
|
806
|
+
const newExpandableDetails = { ...expandableDetails };
|
|
826
807
|
newExpandableDetails.style = expandableDetails.style || MANUAL_CAROUSEL;
|
|
827
808
|
newExpandableDetails.message = expandableDetails.message || '';
|
|
828
809
|
newExpandableDetails.ctas = expandableDetails.ctas || [];
|
|
@@ -917,11 +898,24 @@ export class Creatives extends React.Component {
|
|
|
917
898
|
androidContent.custom = custom;
|
|
918
899
|
}
|
|
919
900
|
if (channel === constants.MOBILE_PUSH && androidContent?.expandableDetails?.carouselData?.length) {
|
|
920
|
-
androidContent.expandableDetails = this.getMobilePushCarouselData({...androidContent?.expandableDetails});
|
|
901
|
+
androidContent.expandableDetails = this.getMobilePushCarouselData({ ...androidContent?.expandableDetails });
|
|
902
|
+
}
|
|
903
|
+
if (androidContent?.isBEEeditor && androidContent?.beeHtml?.value) {
|
|
904
|
+
templateData.androidContent = {};
|
|
905
|
+
templateData.androidContent.type = constants.HTML;
|
|
906
|
+
templateData.androidContent.message = androidContent?.beeHtml?.value || '';
|
|
907
|
+
templateData.androidContent.title = 'bee free template';
|
|
908
|
+
templateData.androidContent.bodyType = androidContent?.bodyType;
|
|
909
|
+
templateData.androidContent.deviceType = constants.ANDROID;
|
|
910
|
+
templateData.androidContent.expandableDetails = {
|
|
911
|
+
style: BIG_HTML,
|
|
912
|
+
message: androidContent?.beeJson || '',
|
|
913
|
+
};
|
|
914
|
+
} else if (!androidContent?.isBEEeditor) {
|
|
915
|
+
templateData.androidContent = androidContent;
|
|
916
|
+
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
917
|
+
templateData.androidContent.deviceType = constants.ANDROID;
|
|
921
918
|
}
|
|
922
|
-
templateData.androidContent = androidContent;
|
|
923
|
-
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
924
|
-
templateData.androidContent.deviceType = constants.ANDROID;
|
|
925
919
|
}
|
|
926
920
|
const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
|
|
927
921
|
if (!isEmpty(iosContent)) {
|
|
@@ -939,11 +933,24 @@ export class Creatives extends React.Component {
|
|
|
939
933
|
iosContent.custom = custom;
|
|
940
934
|
}
|
|
941
935
|
if (channel === constants.MOBILE_PUSH && iosContent?.expandableDetails?.carouselData?.length) {
|
|
942
|
-
iosContent.expandableDetails = this.getMobilePushCarouselData({...iosContent?.expandableDetails});
|
|
936
|
+
iosContent.expandableDetails = this.getMobilePushCarouselData({ ...iosContent?.expandableDetails });
|
|
937
|
+
}
|
|
938
|
+
if (iosContent?.isBEEeditor && iosContent?.beeHtml?.value) {
|
|
939
|
+
templateData.iosContent = {};
|
|
940
|
+
templateData.iosContent.type = constants.HTML;
|
|
941
|
+
templateData.iosContent.message = iosContent?.beeHtml?.value || '';
|
|
942
|
+
templateData.iosContent.title = 'bee free template';
|
|
943
|
+
templateData.iosContent.bodyType = iosContent?.bodyType;
|
|
944
|
+
templateData.iosContent.deviceType = constants.IOS;
|
|
945
|
+
templateData.iosContent.expandableDetails = {
|
|
946
|
+
style: BIG_HTML,
|
|
947
|
+
message: iosContent?.beeJson || '',
|
|
948
|
+
};
|
|
949
|
+
} else if (!iosContent?.isBEEeditor) {
|
|
950
|
+
templateData.iosContent = iosContent;
|
|
951
|
+
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
952
|
+
templateData.iosContent.deviceType = constants.IOS;
|
|
943
953
|
}
|
|
944
|
-
templateData.iosContent = iosContent;
|
|
945
|
-
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
946
|
-
templateData.iosContent.deviceType = constants.IOS;
|
|
947
954
|
}
|
|
948
955
|
templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
|
|
949
956
|
}
|
|
@@ -1158,7 +1165,7 @@ export class Creatives extends React.Component {
|
|
|
1158
1165
|
contentType = "",
|
|
1159
1166
|
cardType = "",
|
|
1160
1167
|
cardSettings = {},
|
|
1161
|
-
} = get(versions, 'base.content.RCS.rcsContent',{});
|
|
1168
|
+
} = get(versions, 'base.content.RCS.rcsContent', {});
|
|
1162
1169
|
const rcsContent = {
|
|
1163
1170
|
contentType,
|
|
1164
1171
|
cardType,
|
|
@@ -1184,96 +1191,6 @@ export class Creatives extends React.Component {
|
|
|
1184
1191
|
}
|
|
1185
1192
|
}
|
|
1186
1193
|
break;
|
|
1187
|
-
case constants.WEBPUSH: {
|
|
1188
|
-
if (template.value) {
|
|
1189
|
-
const channelTemplate = template.value;
|
|
1190
|
-
const accountId = get(channelTemplate, 'definition.accountId');
|
|
1191
|
-
const webpushContent = get(channelTemplate, 'versions.base.content.webpush', {});
|
|
1192
|
-
|
|
1193
|
-
const iconImageUrl = webpushContent.brandIcon || webpushContent.iconImageUrl || '';
|
|
1194
|
-
|
|
1195
|
-
// Map onClickAction to cta
|
|
1196
|
-
let cta = null;
|
|
1197
|
-
if (webpushContent.onClickAction) {
|
|
1198
|
-
if (webpushContent.onClickAction.type === 'URL') {
|
|
1199
|
-
cta = {
|
|
1200
|
-
type: 'EXTERNAL_URL',
|
|
1201
|
-
actionLink: webpushContent.onClickAction.url || '',
|
|
1202
|
-
};
|
|
1203
|
-
} else {
|
|
1204
|
-
cta = {
|
|
1205
|
-
type: webpushContent.onClickAction.type || 'SITE_URL',
|
|
1206
|
-
actionLink: webpushContent.onClickAction.url || '',
|
|
1207
|
-
};
|
|
1208
|
-
}
|
|
1209
|
-
} else if (webpushContent.cta) {
|
|
1210
|
-
// Fallback to cta if onClickAction is not present
|
|
1211
|
-
cta = {
|
|
1212
|
-
type: webpushContent.cta.type || 'EXTERNAL_URL',
|
|
1213
|
-
actionLink: webpushContent.cta.actionLink || '',
|
|
1214
|
-
};
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
// Map ctas array to expandableDetails.ctas
|
|
1218
|
-
let expandableDetails = null;
|
|
1219
|
-
const hasCtas = webpushContent.ctas && webpushContent.ctas.length > 0;
|
|
1220
|
-
const hasImage = webpushContent.image;
|
|
1221
|
-
|
|
1222
|
-
if (hasCtas || hasImage) {
|
|
1223
|
-
expandableDetails = {
|
|
1224
|
-
media: [],
|
|
1225
|
-
ctas: [],
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
// Map image to expandableDetails.media
|
|
1229
|
-
if (hasImage) {
|
|
1230
|
-
expandableDetails.media = [{
|
|
1231
|
-
url: webpushContent.image,
|
|
1232
|
-
type: 'IMAGE',
|
|
1233
|
-
}];
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
// Map ctas array to expandableDetails.ctas
|
|
1237
|
-
if (hasCtas) {
|
|
1238
|
-
expandableDetails.ctas = webpushContent.ctas.map((ctaItem) => ({
|
|
1239
|
-
type: ctaItem.type === 'URL' ? 'EXTERNAL_URL' : ctaItem.type,
|
|
1240
|
-
action: ctaItem.action || '',
|
|
1241
|
-
title: ctaItem.actionText || ctaItem.title || '',
|
|
1242
|
-
actionLink: ctaItem.actionLink || '',
|
|
1243
|
-
}));
|
|
1244
|
-
}
|
|
1245
|
-
} else if (webpushContent.expandableDetails) {
|
|
1246
|
-
// If expandableDetails already exists, use it
|
|
1247
|
-
expandableDetails = {
|
|
1248
|
-
media: webpushContent.expandableDetails.media || [],
|
|
1249
|
-
ctas: webpushContent.expandableDetails.ctas || [],
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
// Convert from creatives format to campaign format
|
|
1254
|
-
templateData = {
|
|
1255
|
-
channel,
|
|
1256
|
-
messageContent: {
|
|
1257
|
-
content: {
|
|
1258
|
-
channel: 'WEBPUSH',
|
|
1259
|
-
accountId,
|
|
1260
|
-
isDefault: false,
|
|
1261
|
-
storeType: 'REGISTERED_STORE',
|
|
1262
|
-
content: {
|
|
1263
|
-
title: webpushContent.title || '',
|
|
1264
|
-
message: webpushContent.message || '',
|
|
1265
|
-
...(iconImageUrl && { iconImageUrl }),
|
|
1266
|
-
...(cta && { cta }),
|
|
1267
|
-
...(expandableDetails && { expandableDetails }),
|
|
1268
|
-
},
|
|
1269
|
-
messageSubject: channelTemplate?.name ? channelTemplate.name : 'messageSubject',
|
|
1270
|
-
offers: [],
|
|
1271
|
-
},
|
|
1272
|
-
},
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1275
|
-
break;
|
|
1276
|
-
}
|
|
1277
1194
|
default:
|
|
1278
1195
|
break;
|
|
1279
1196
|
}
|
|
@@ -1386,7 +1303,7 @@ export class Creatives extends React.Component {
|
|
|
1386
1303
|
processCentralCommsMetaId = (channel, creativesData) => {
|
|
1387
1304
|
// Create the payload for the centralcommnsmetaId API call
|
|
1388
1305
|
const { isLoyaltyModule = false, loyaltyMetaData = {} } = this.props;
|
|
1389
|
-
const { actionName, setMetaData = () => {} } = loyaltyMetaData;
|
|
1306
|
+
const { actionName, setMetaData = () => { } } = loyaltyMetaData;
|
|
1390
1307
|
|
|
1391
1308
|
// const isTemplateModified = getTemplateDiffState(
|
|
1392
1309
|
// channel,
|
|
@@ -1436,6 +1353,9 @@ export class Creatives extends React.Component {
|
|
|
1436
1353
|
if (prevState.currentChannel.toUpperCase() === constants.EMAIL) {
|
|
1437
1354
|
newState = { ...newState, emailCreateMode: null };
|
|
1438
1355
|
}
|
|
1356
|
+
if (prevState.currentChannel.toUpperCase() === constants.INAPP) {
|
|
1357
|
+
newState = { ...newState, inAppEditorType: null };
|
|
1358
|
+
}
|
|
1439
1359
|
return newState;
|
|
1440
1360
|
});
|
|
1441
1361
|
}
|
|
@@ -1481,7 +1401,7 @@ export class Creatives extends React.Component {
|
|
|
1481
1401
|
shouldShowFooter = () => {
|
|
1482
1402
|
const { isFullMode } = this.props;
|
|
1483
1403
|
const {
|
|
1484
|
-
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1404
|
+
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData, inAppCreateMode,
|
|
1485
1405
|
} = this.state;
|
|
1486
1406
|
const channel = currentChannel.toUpperCase();
|
|
1487
1407
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1489,6 +1409,13 @@ export class Creatives extends React.Component {
|
|
|
1489
1409
|
showFooter = isFullMode && slidBoxContent === "preview";
|
|
1490
1410
|
const isMobilepush = channel === constants.MOBILE_PUSH;
|
|
1491
1411
|
|
|
1412
|
+
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1413
|
+
if (!supportCKEditor && channel === constants.EMAIL && currentStep === 'modeSelection' && slidBoxContent === 'createTemplate') {
|
|
1414
|
+
return true;
|
|
1415
|
+
}
|
|
1416
|
+
if (!supportCKEditor && channel === constants.EMAIL && currentStep === 'createTemplateContent' && slidBoxContent === 'createTemplate') {
|
|
1417
|
+
showFooter = true;
|
|
1418
|
+
}
|
|
1492
1419
|
|
|
1493
1420
|
if (!isFullMode) {
|
|
1494
1421
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
@@ -1524,6 +1451,7 @@ export class Creatives extends React.Component {
|
|
|
1524
1451
|
showFooter = true;
|
|
1525
1452
|
}
|
|
1526
1453
|
|
|
1454
|
+
|
|
1527
1455
|
if (showFooter) {
|
|
1528
1456
|
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent')
|
|
1529
1457
|
|| ([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
|
|
@@ -1546,7 +1474,7 @@ export class Creatives extends React.Component {
|
|
|
1546
1474
|
|
|
1547
1475
|
shouldShowDoneFooter = () => {
|
|
1548
1476
|
const {
|
|
1549
|
-
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1477
|
+
slidBoxContent, templateStep, currentChannel, templateData, inAppCreateMode,
|
|
1550
1478
|
} = this.state;
|
|
1551
1479
|
const { isFullMode } = this.props;
|
|
1552
1480
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1554,10 +1482,17 @@ export class Creatives extends React.Component {
|
|
|
1554
1482
|
const channelName = !isFullMode && templateData ? templateData.type : currentChannel;
|
|
1555
1483
|
const channel = channelName?.toUpperCase();
|
|
1556
1484
|
|
|
1557
|
-
|
|
1485
|
+
// Check supportCKEditor flag for new HTML editor flow
|
|
1486
|
+
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1558
1487
|
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
1559
1488
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
1560
|
-
|
|
1489
|
+
|
|
1490
|
+
// For new HTML editor flow (when supportCKEditor is false), show Done footer when in createTemplateContent step
|
|
1491
|
+
if (!supportCKEditor && channel === constants.EMAIL && slidBoxContent === 'createTemplate' && currentStep === 'createTemplateContent') {
|
|
1492
|
+
showDone = true;
|
|
1493
|
+
} else {
|
|
1494
|
+
showDone = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
1495
|
+
}
|
|
1561
1496
|
} else if ([constants.WECHAT, constants.MOBILE_PUSH].includes(channel)) {
|
|
1562
1497
|
showDone = currentStep === "createTemplateContent" || slidBoxContent === "editTemplate";
|
|
1563
1498
|
|
|
@@ -1567,7 +1502,6 @@ export class Creatives extends React.Component {
|
|
|
1567
1502
|
}
|
|
1568
1503
|
}
|
|
1569
1504
|
|
|
1570
|
-
|
|
1571
1505
|
return showDone;
|
|
1572
1506
|
}
|
|
1573
1507
|
|
|
@@ -1587,18 +1521,18 @@ export class Creatives extends React.Component {
|
|
|
1587
1521
|
templateNameComponentInput = ({ formData, onFormDataChange, name }) => {
|
|
1588
1522
|
// Use local state for immediate UI feedback, fallback to prop value
|
|
1589
1523
|
const displayValue = this.state.localTemplateName !== '' ? this.state.localTemplateName : name;
|
|
1590
|
-
|
|
1524
|
+
|
|
1591
1525
|
return (
|
|
1592
1526
|
<CapInput
|
|
1593
1527
|
value={displayValue}
|
|
1594
1528
|
suffix={<span />}
|
|
1595
|
-
onBlur={() => {
|
|
1596
|
-
this.setState({
|
|
1529
|
+
onBlur={() => {
|
|
1530
|
+
this.setState({
|
|
1597
1531
|
isEditName: false,
|
|
1598
1532
|
localTemplateName: '' // Clear local state on blur
|
|
1599
|
-
}, () => {
|
|
1600
|
-
this.showTemplateName({ formData, onFormDataChange });
|
|
1601
|
-
});
|
|
1533
|
+
}, () => {
|
|
1534
|
+
this.showTemplateName({ formData, onFormDataChange });
|
|
1535
|
+
});
|
|
1602
1536
|
}}
|
|
1603
1537
|
onChange={(ev) => {
|
|
1604
1538
|
const { value } = ev.currentTarget;
|
|
@@ -1610,10 +1544,16 @@ export class Creatives extends React.Component {
|
|
|
1610
1544
|
}
|
|
1611
1545
|
|
|
1612
1546
|
showTemplateName = ({ formData, onFormDataChange }) => { //gets called from email/index after template data is fetched
|
|
1613
|
-
const { slidBoxContent, currentChannel, isEditName } = this.state;
|
|
1547
|
+
const { slidBoxContent, currentChannel, isEditName, templateStep } = this.state;
|
|
1614
1548
|
const channel = currentChannel.toUpperCase();
|
|
1615
1549
|
if ([constants.EMAIL, constants.MOBILE_PUSH, constants.INAPP].includes(channel) && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate')) {
|
|
1616
1550
|
const name = get(formData, 'template-name');
|
|
1551
|
+
|
|
1552
|
+
const isModeSelectionStep = templateStep === 'modeSelection' || this.creativesTemplateSteps[templateStep] === 'modeSelection';
|
|
1553
|
+
const isCreateMode = slidBoxContent === 'createTemplate';
|
|
1554
|
+
if (isCreateMode && isModeSelectionStep) {
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1617
1557
|
if (channel === constants.EMAIL && !name && slidBoxContent === 'createTemplate') {
|
|
1618
1558
|
this.setState({ isTemplateNameEmpty: true });
|
|
1619
1559
|
}
|
|
@@ -1621,7 +1561,7 @@ export class Creatives extends React.Component {
|
|
|
1621
1561
|
if (name && !isEditName) {
|
|
1622
1562
|
this.setState({ showTemplateNameComponentEdit: false });
|
|
1623
1563
|
} else if (isEditName) {
|
|
1624
|
-
this.setState({
|
|
1564
|
+
this.setState({
|
|
1625
1565
|
showTemplateNameComponentEdit: true,
|
|
1626
1566
|
localTemplateName: name || '' // Initialize local state with current value
|
|
1627
1567
|
});
|
|
@@ -1639,13 +1579,22 @@ export class Creatives extends React.Component {
|
|
|
1639
1579
|
|
|
1640
1580
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
1641
1581
|
const {
|
|
1642
|
-
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode,
|
|
1582
|
+
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, inAppEditorType, weChatTemplateType,
|
|
1643
1583
|
} = this.state;
|
|
1644
1584
|
let isShowContinueFooter = false;
|
|
1645
1585
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
1646
1586
|
const channel = currentChannel.toUpperCase();
|
|
1587
|
+
// Check if supportCKEditor is false (new flow)
|
|
1588
|
+
const supportCKEditor = commonUtil.hasSupportCKEditor(); // Default to legacy flow
|
|
1647
1589
|
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
1648
|
-
|
|
1590
|
+
// New flow: Show Continue button when supportCKEditor is false and in modeSelection
|
|
1591
|
+
// Always show it (even if disabled) - visibility is separate from enabled state
|
|
1592
|
+
if (!supportCKEditor && currentStep === 'modeSelection' && slidBoxContent === 'createTemplate') {
|
|
1593
|
+
return true; // Return early to ensure visibility
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
// Legacy flow: Original logic (only when supportCKEditor is true)
|
|
1597
|
+
if (supportCKEditor && ((emailCreateMode === "upload" && !isEmpty(this.props.EmailLayout)) || emailCreateMode === "editor")) {
|
|
1649
1598
|
let isEmailCreate = slidBoxContent === 'createTemplate';
|
|
1650
1599
|
isEmailCreate = currentChannel.toUpperCase() === constants.EMAIL && ((emailCreateMode === "upload" && currentStep !== 'createTemplateContent') || (emailCreateMode === "editor" && currentStep !== 'createTemplateContent' && currentStep !== "templateSelection"));
|
|
1651
1600
|
isShowContinueFooter = isEmailCreate && emailCreateMode;
|
|
@@ -1654,8 +1603,6 @@ export class Creatives extends React.Component {
|
|
|
1654
1603
|
isShowContinueFooter = !isEmpty(mobilePushCreateMode) && currentStep === "modeSelection";
|
|
1655
1604
|
} else if (currentChannel.toUpperCase() === constants.WECHAT) {
|
|
1656
1605
|
isShowContinueFooter = !isEmpty(weChatTemplateType) && currentStep === "modeSelection";
|
|
1657
|
-
} else if (currentChannel.toUpperCase() === constants.INAPP) {
|
|
1658
|
-
isShowContinueFooter = !isEmpty(inAppCreateMode) && currentChannel === "modeSelection";
|
|
1659
1606
|
}
|
|
1660
1607
|
|
|
1661
1608
|
return isShowContinueFooter;
|
|
@@ -1681,6 +1628,28 @@ export class Creatives extends React.Component {
|
|
|
1681
1628
|
return true;
|
|
1682
1629
|
}
|
|
1683
1630
|
|
|
1631
|
+
// Check if Continue button should be disabled (for new flow only)
|
|
1632
|
+
isContinueButtonDisabled = () => {
|
|
1633
|
+
const { currentChannel, emailCreateMode, templateNameExists } = this.state;
|
|
1634
|
+
const { isFullMode } = this.props;
|
|
1635
|
+
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1636
|
+
if (supportCKEditor) {
|
|
1637
|
+
return false;
|
|
1638
|
+
}
|
|
1639
|
+
if (currentChannel.toUpperCase() === constants.EMAIL) {
|
|
1640
|
+
const isEditorSelected = !!emailCreateMode && emailCreateMode !== 'upload';
|
|
1641
|
+
// In full mode: require both template name AND editor selection
|
|
1642
|
+
// In library mode: require only editor selection (template name not needed)
|
|
1643
|
+
if (isFullMode) {
|
|
1644
|
+
const isTemplateNameValid = templateNameExists;
|
|
1645
|
+
return !(isTemplateNameValid && isEditorSelected);
|
|
1646
|
+
}
|
|
1647
|
+
// Library mode: only editor selection is required
|
|
1648
|
+
return !isEditorSelected;
|
|
1649
|
+
}
|
|
1650
|
+
return true;
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1684
1653
|
render() {
|
|
1685
1654
|
const {
|
|
1686
1655
|
slidBoxContent,
|
|
@@ -1701,6 +1670,7 @@ export class Creatives extends React.Component {
|
|
|
1701
1670
|
activeFormBuilderTab,
|
|
1702
1671
|
showTestAndPreviewSlidebox,
|
|
1703
1672
|
isTestAndPreviewMode,
|
|
1673
|
+
inAppEditorType,
|
|
1704
1674
|
} = this.state;
|
|
1705
1675
|
const {
|
|
1706
1676
|
isFullMode,
|
|
@@ -1723,6 +1693,10 @@ export class Creatives extends React.Component {
|
|
|
1723
1693
|
isLoyaltyModule,
|
|
1724
1694
|
loyaltyMetaData = {},
|
|
1725
1695
|
} = this.props;
|
|
1696
|
+
// Compute Continue button label
|
|
1697
|
+
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1698
|
+
const continueButtonLabel = supportCKEditor ? messages.continue : messages.next;
|
|
1699
|
+
|
|
1726
1700
|
const mapTemplateCreate = slidBoxContent === "createTemplate"
|
|
1727
1701
|
&& weChatTemplateType === MAP_TEMPLATE
|
|
1728
1702
|
&& templateStep !== "modeSelection";
|
|
@@ -1784,6 +1758,8 @@ export class Creatives extends React.Component {
|
|
|
1784
1758
|
onChannelChange={this.onChannelChange}
|
|
1785
1759
|
onEmailModeChange={this.onEmailModeChange}//used when create is clicked in email
|
|
1786
1760
|
emailCreateMode={emailCreateMode}// upload zip || use editor are values
|
|
1761
|
+
onInAppEditorTypeChange={this.onInAppEditorTypeChange}//used when create is clicked in inapp
|
|
1762
|
+
inAppEditorType={inAppEditorType}// htmlEditor || dragDropEditor are values
|
|
1787
1763
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
1788
1764
|
onCreateNextStep={this.onCreateNextStep}
|
|
1789
1765
|
onEnterTemplateName={this.onEnterTemplateName}
|
|
@@ -1793,6 +1769,8 @@ export class Creatives extends React.Component {
|
|
|
1793
1769
|
cap={cap}
|
|
1794
1770
|
setIsLoadingContent={this.setIsLoadingContent}
|
|
1795
1771
|
onMobilepushModeChange={this.onMobilepushModeChange}
|
|
1772
|
+
inAppCreateMode={this.state.inAppCreateMode}
|
|
1773
|
+
onInAppModeChange={this.onInAppModeChange}
|
|
1796
1774
|
mobilePushCreateMode={mobilePushCreateMode}
|
|
1797
1775
|
showTemplateName={this.showTemplateName}
|
|
1798
1776
|
onValidationFail={this.onValidationFail}
|
|
@@ -1853,6 +1831,8 @@ export class Creatives extends React.Component {
|
|
|
1853
1831
|
errorMessages={liquidErrorMessage}
|
|
1854
1832
|
currentTab={activeFormBuilderTab}
|
|
1855
1833
|
onTestAndPreview={this.handleTestAndPreview}
|
|
1834
|
+
isContinueButtonDisabled={this.isContinueButtonDisabled()}
|
|
1835
|
+
continueButtonLabel={continueButtonLabel}
|
|
1856
1836
|
showTestAndPreviewButton={(() => {
|
|
1857
1837
|
const showButton = currentChannel.toUpperCase() === constants.EMAIL && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate');
|
|
1858
1838
|
return showButton;
|
|
@@ -1863,7 +1843,7 @@ export class Creatives extends React.Component {
|
|
|
1863
1843
|
{(() => {
|
|
1864
1844
|
const errorsToShow = get(liquidErrorMessage, constants.LIQUID_ERROR_MSG, []);
|
|
1865
1845
|
const standardErrorsToShow = get(liquidErrorMessage, constants.STANDARD_ERROR_MSG, []);
|
|
1866
|
-
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{LIQUID_ERROR_MSG: errorsToShow, STANDARD_ERROR_MSG: standardErrorsToShow}} />;
|
|
1846
|
+
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{ LIQUID_ERROR_MSG: errorsToShow, STANDARD_ERROR_MSG: standardErrorsToShow }} />;
|
|
1867
1847
|
})()}
|
|
1868
1848
|
</CapRow>
|
|
1869
1849
|
)}
|
|
@@ -338,10 +338,6 @@ export default defineMessages({
|
|
|
338
338
|
id: `${scope}.rcsCreative`,
|
|
339
339
|
defaultMessage: `RCS creative`,
|
|
340
340
|
},
|
|
341
|
-
"webPushTemplate": {
|
|
342
|
-
id: `${scope}.webPushTemplate`,
|
|
343
|
-
defaultMessage: `Web Push Template`,
|
|
344
|
-
},
|
|
345
341
|
"templateNameEmpty": {
|
|
346
342
|
id: `${scope}.templateNameEmpty`,
|
|
347
343
|
defaultMessage: `Template name cannot be empty`
|
|
@@ -370,4 +366,8 @@ export default defineMessages({
|
|
|
370
366
|
id: `${scope}.testAndPreview`,
|
|
371
367
|
defaultMessage: `Preview and Test`,
|
|
372
368
|
},
|
|
369
|
+
"next": {
|
|
370
|
+
id: `${scope}.next`,
|
|
371
|
+
defaultMessage: `Next`,
|
|
372
|
+
},
|
|
373
373
|
});
|