@capillarytech/creatives-library 8.0.259 → 8.0.260-alpha.1
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 +1 -2
- package/initialReducer.js +0 -2
- package/package.json +1 -1
- package/services/api.js +0 -10
- package/services/tests/api.test.js +0 -34
- package/translations/en.json +3 -4
- package/utils/common.js +0 -5
- package/utils/commonUtils.js +5 -28
- package/utils/tests/commonUtil.test.js +0 -224
- package/utils/transformTemplateConfig.js +10 -0
- package/v2Components/CapDeviceContent/index.js +56 -61
- package/v2Components/CapTagList/index.js +1 -6
- package/v2Components/CapTagListWithInput/index.js +1 -5
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +0 -5
- package/v2Components/ErrorInfoNote/index.js +72 -457
- package/v2Components/ErrorInfoNote/messages.js +6 -36
- package/v2Components/ErrorInfoNote/style.scss +6 -282
- package/v2Components/FormBuilder/tests/index.test.js +4 -13
- package/v2Components/HtmlEditor/HTMLEditor.js +94 -547
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +133 -1441
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +16 -27
- package/v2Components/HtmlEditor/_htmlEditor.scss +45 -108
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +102 -23
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +140 -148
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +0 -9
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +4 -4
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +0 -22
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +7 -4
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +45 -35
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +3 -1
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +6 -7
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +6 -3
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +43 -22
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +152 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +0 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +31 -49
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +34 -50
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +41 -70
- package/v2Components/HtmlEditor/constants.js +20 -42
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +16 -373
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +16 -120
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +2 -5
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +146 -88
- package/v2Components/HtmlEditor/hooks/useValidation.js +53 -189
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +94 -92
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +45 -94
- package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +0 -134
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +41 -40
- package/v2Components/HtmlEditor/utils/htmlValidator.js +72 -71
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +102 -134
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +25 -23
- package/v2Components/HtmlEditor/utils/validationAdapter.js +41 -66
- package/v2Components/MobilePushPreviewV2/index.js +7 -32
- package/v2Components/TemplatePreview/_templatePreview.scss +24 -55
- package/v2Components/TemplatePreview/index.js +32 -47
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +0 -1
- package/v2Containers/BeeEditor/index.js +90 -172
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +3 -4
- package/v2Containers/CreativesContainer/SlideBoxContent.js +52 -128
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +13 -163
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -2
- package/v2Containers/CreativesContainer/constants.js +0 -1
- package/v2Containers/CreativesContainer/index.js +46 -239
- package/v2Containers/CreativesContainer/messages.js +0 -8
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +2 -11
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +50 -38
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -106
- package/v2Containers/Email/actions.js +0 -7
- package/v2Containers/Email/constants.js +1 -5
- package/v2Containers/Email/index.js +36 -237
- package/v2Containers/Email/messages.js +0 -32
- package/v2Containers/Email/reducer.js +1 -12
- package/v2Containers/Email/sagas.js +7 -61
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +0 -2
- package/v2Containers/Email/tests/reducer.test.js +0 -46
- package/v2Containers/Email/tests/sagas.test.js +29 -320
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +21 -211
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +74 -40
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +67 -2
- package/v2Containers/EmailWrapper/constants.js +0 -2
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +77 -629
- package/v2Containers/EmailWrapper/index.js +23 -103
- package/v2Containers/EmailWrapper/messages.js +1 -65
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +214 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +77 -594
- package/v2Containers/InApp/actions.js +0 -7
- package/v2Containers/InApp/constants.js +4 -20
- package/v2Containers/InApp/index.js +359 -802
- package/v2Containers/InApp/index.scss +3 -4
- package/v2Containers/InApp/messages.js +3 -7
- package/v2Containers/InApp/reducer.js +3 -21
- package/v2Containers/InApp/sagas.js +9 -29
- package/v2Containers/InApp/selectors.js +5 -25
- package/v2Containers/InApp/tests/index.test.js +50 -154
- package/v2Containers/InApp/tests/reducer.test.js +0 -34
- package/v2Containers/InApp/tests/sagas.test.js +9 -61
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +12 -39
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +6 -10
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +75 -102
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +54 -81
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +178 -262
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +12 -16
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +36 -52
- package/v2Containers/TagList/index.js +19 -62
- package/v2Containers/Templates/_templates.scss +1 -60
- package/v2Containers/Templates/index.js +4 -89
- package/v2Containers/Templates/messages.js +0 -4
- package/v2Containers/WebPush/Create/messages.js +8 -0
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +2 -2
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +3 -1
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +5 -1
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +5 -1
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +5 -1
- package/v2Containers/WebPush/Create/preview/preview.scss +7 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +734 -1306
- package/v2Components/ErrorInfoNote/constants.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -874
- package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +0 -6
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +0 -255
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +0 -364
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +0 -51
- package/v2Components/HtmlEditor/utils/validationConstants.js +0 -40
- package/v2Containers/BeePopupEditor/_beePopupEditor.scss +0 -14
- package/v2Containers/BeePopupEditor/constants.js +0 -10
- package/v2Containers/BeePopupEditor/index.js +0 -194
- package/v2Containers/BeePopupEditor/tests/index.test.js +0 -627
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +0 -1285
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +0 -1880
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +0 -520
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -643
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +0 -376
- package/v2Containers/InApp/__tests__/sagas.test.js +0 -363
- package/v2Containers/InApp/tests/selectors.test.js +0 -612
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +0 -151
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +0 -267
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +0 -23
- package/v2Containers/InAppWrapper/constants.js +0 -16
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -473
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +0 -198
- package/v2Containers/InAppWrapper/index.js +0 -148
- package/v2Containers/InAppWrapper/messages.js +0 -49
- package/v2Containers/InappAdvance/index.js +0 -1099
- package/v2Containers/InappAdvance/index.scss +0 -10
- package/v2Containers/InappAdvance/tests/index.test.js +0 -448
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
CAP_SPACE_16, CAP_SPACE_32, CAP_SPACE_56, CAP_SPACE_64,
|
|
5
|
-
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
3
|
+
import { CAP_SPACE_32, CAP_SPACE_56, CAP_SPACE_64 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
6
4
|
|
|
7
5
|
import CapSlideBox from '@capillarytech/cap-ui-library/CapSlideBox';
|
|
8
6
|
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
@@ -46,7 +44,7 @@ import {
|
|
|
46
44
|
} from '../Line/Container/constants';
|
|
47
45
|
import {EXTERNAL_URL, SITE_URL, WEBPUSH_MEDIA_TYPES} from '../WebPush/constants';
|
|
48
46
|
import { IMAGE, VIDEO } from '../Facebook/Advertisement/constant';
|
|
49
|
-
import {
|
|
47
|
+
import {RCS_STATUSES} from '../Rcs/constants';
|
|
50
48
|
import { CREATIVE } from '../Facebook/constants';
|
|
51
49
|
import { LOYALTY } from '../App/constants';
|
|
52
50
|
import {
|
|
@@ -67,29 +65,19 @@ import {
|
|
|
67
65
|
// getTemplateDiffState
|
|
68
66
|
} from "../../utils/transformerUtils";
|
|
69
67
|
import { MANUAL_CAROUSEL } from '../MobilePushNew/constants';
|
|
70
|
-
import { BIG_HTML } from '../InApp/constants';
|
|
71
68
|
|
|
72
69
|
const classPrefix = 'add-creatives-section';
|
|
73
70
|
const CREATIVES_CONTAINER = 'creativesContainer';
|
|
74
71
|
|
|
75
72
|
const SlideBoxWrapper = styled.div`
|
|
76
73
|
.cap-slide-box-v2-container{
|
|
77
|
-
.slidebox-header, .slidebox-content-container{
|
|
74
|
+
.slidebox-header, .slidebox-content-container, .slidebox-footer{
|
|
78
75
|
margin-bottom: ${({ slideBoxWrapperMargin }) => `${slideBoxWrapperMargin}`};
|
|
79
76
|
padding: 0 rem;
|
|
80
77
|
&.has-footer{
|
|
81
78
|
overflow-x: hidden;
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
|
-
.slidebox-footer{
|
|
85
|
-
/* Only apply margin-bottom to footer when ErrorInfoNote is shown in footer (BEE editor) */
|
|
86
|
-
/* For HTML Editor, errors are shown in ValidationErrorDisplay (inside content area), so no footer margin needed */
|
|
87
|
-
margin-bottom: ${({ shouldApplyFooterMargin }) => (shouldApplyFooterMargin ? `${CAP_SPACE_16}` : '0')};
|
|
88
|
-
padding: 0 rem;
|
|
89
|
-
&.has-footer{
|
|
90
|
-
overflow-x: hidden;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
81
|
}
|
|
94
82
|
`;
|
|
95
83
|
export class Creatives extends React.Component {
|
|
@@ -108,7 +96,6 @@ export class Creatives extends React.Component {
|
|
|
108
96
|
currentChannel: this.props.channel || 'sms',
|
|
109
97
|
weChatTemplateType: '',
|
|
110
98
|
weChatMaptemplateStep: 0,
|
|
111
|
-
inAppEditorType: null,
|
|
112
99
|
isLiquidValidationError: false,
|
|
113
100
|
errorMessages: [],
|
|
114
101
|
liquidErrorMessage: {
|
|
@@ -121,17 +108,6 @@ export class Creatives extends React.Component {
|
|
|
121
108
|
isTestAndPreviewMode: false, // Add flag to track Test & Preview mode
|
|
122
109
|
// Performance optimization: Local template name for immediate UI feedback
|
|
123
110
|
localTemplateName: '',
|
|
124
|
-
// Track selected email create mode for new flow (HTML Editor vs Drag & Drop)
|
|
125
|
-
selectedEmailCreateMode: null,
|
|
126
|
-
// HTML Editor validation state (for email channel)
|
|
127
|
-
htmlEditorValidationState: {
|
|
128
|
-
isContentEmpty: true,
|
|
129
|
-
issueCounts: {
|
|
130
|
-
html: 0, label: 0, liquid: 0, total: 0,
|
|
131
|
-
},
|
|
132
|
-
validationComplete: false, // Flag to track if validation has completed
|
|
133
|
-
errorsAcknowledged: false, // Flag to track if user has acknowledged errors by clicking redirection icon
|
|
134
|
-
},
|
|
135
111
|
};
|
|
136
112
|
this.liquidFlow = Boolean(commonUtil.hasLiquidSupportFeature());
|
|
137
113
|
this.creativesTemplateSteps = {
|
|
@@ -161,7 +137,7 @@ export class Creatives extends React.Component {
|
|
|
161
137
|
if (!this.props?.isFullMode) {
|
|
162
138
|
this.props?.templateActions.getCdnTransformationConfig();
|
|
163
139
|
}
|
|
164
|
-
|
|
140
|
+
|
|
165
141
|
// Store loyalty tag props if loyaltyTagFetchingDependencies is provided
|
|
166
142
|
const { loyaltyTagFetchingDependencies } = this.props;
|
|
167
143
|
if (loyaltyTagFetchingDependencies) {
|
|
@@ -187,9 +163,9 @@ export class Creatives extends React.Component {
|
|
|
187
163
|
const isEmptyTemplateName = !value.trim();
|
|
188
164
|
|
|
189
165
|
// 1. IMMEDIATE: Update local state for instant UI feedback
|
|
190
|
-
this.setState({
|
|
166
|
+
this.setState({
|
|
191
167
|
isTemplateNameEmpty: isEmptyTemplateName,
|
|
192
|
-
localTemplateName: value
|
|
168
|
+
localTemplateName: value
|
|
193
169
|
});
|
|
194
170
|
|
|
195
171
|
// 2. DEBOUNCED: Only debounce the expensive onFormDataChange call
|
|
@@ -268,19 +244,8 @@ export class Creatives extends React.Component {
|
|
|
268
244
|
onCreateNextStep = () => {
|
|
269
245
|
this.setState((prevState) => {
|
|
270
246
|
let templateStep = prevState.templateStep + 1;
|
|
271
|
-
const { emailCreateMode, currentChannel
|
|
272
|
-
|
|
273
|
-
// Check if we should skip template selection for HTML Editor
|
|
274
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
275
|
-
const shouldSkipTemplateSelection = !supportCKEditor
|
|
276
|
-
&& selectedEmailCreateMode === 'html_editor'
|
|
277
|
-
&& currentChannel.toUpperCase() === constants.EMAIL
|
|
278
|
-
&& prevState.templateStep === 1; // Only skip if we're at modeSelection step
|
|
279
|
-
|
|
280
|
-
if (shouldSkipTemplateSelection) {
|
|
281
|
-
// Skip template selection (step 2), go directly to createTemplateContent (step 3)
|
|
282
|
-
templateStep = prevState.templateStep + 2;
|
|
283
|
-
} else if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || [constants.MOBILE_PUSH, constants.WECHAT, constants.INAPP].includes(currentChannel.toUpperCase())) {
|
|
247
|
+
const { emailCreateMode, currentChannel } = prevState;
|
|
248
|
+
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || [constants.MOBILE_PUSH, constants.WECHAT, constants.INAPP].includes(currentChannel.toUpperCase())) {
|
|
284
249
|
templateStep = prevState.templateStep + 2;
|
|
285
250
|
}
|
|
286
251
|
return {
|
|
@@ -289,21 +254,14 @@ export class Creatives extends React.Component {
|
|
|
289
254
|
});
|
|
290
255
|
}
|
|
291
256
|
|
|
292
|
-
onEmailModeChange = (mode
|
|
293
|
-
this.setState({
|
|
294
|
-
emailCreateMode: mode,
|
|
295
|
-
selectedEmailCreateMode: selectedMode || mode, // Store the selected mode for new flow
|
|
296
|
-
});
|
|
257
|
+
onEmailModeChange = (mode) => {
|
|
258
|
+
this.setState({ emailCreateMode: mode });
|
|
297
259
|
}
|
|
298
260
|
|
|
299
261
|
onInAppModeChange = (mode) => {
|
|
300
262
|
this.setState({ inAppCreateMode: mode });
|
|
301
263
|
}
|
|
302
264
|
|
|
303
|
-
onInAppEditorTypeChange = (editorType) => {
|
|
304
|
-
this.setState({ inAppEditorType: editorType });
|
|
305
|
-
}
|
|
306
|
-
|
|
307
265
|
onMobilepushModeChange = (mode) => {
|
|
308
266
|
this.setState({ mobilePushCreateMode: mode });
|
|
309
267
|
}
|
|
@@ -347,7 +305,7 @@ export class Creatives extends React.Component {
|
|
|
347
305
|
}
|
|
348
306
|
return buttonObj;
|
|
349
307
|
});
|
|
350
|
-
const {
|
|
308
|
+
const {url, previewUrl} = media || {};
|
|
351
309
|
return {
|
|
352
310
|
bodyText: bodyTemplate,
|
|
353
311
|
varMap: cardVarMapped,
|
|
@@ -476,35 +434,14 @@ export class Creatives extends React.Component {
|
|
|
476
434
|
}
|
|
477
435
|
case constants.INAPP: {
|
|
478
436
|
const mode = get(templateData, 'androidContent.type') || get(templateData, 'iosContent.type') || '';
|
|
479
|
-
|
|
480
|
-
// Check if this is a BEE editor template (identified by special title 'bee free template')
|
|
481
|
-
const isAndroidBeeEditor = templateData?.androidContent?.type === constants.HTML
|
|
482
|
-
&& templateData?.androidContent?.title?.toLowerCase() === 'bee free template';
|
|
483
|
-
const isIosBeeEditor = templateData?.iosContent?.type === constants.HTML
|
|
484
|
-
&& templateData?.iosContent?.title?.toLowerCase() === 'bee free template';
|
|
485
|
-
|
|
486
437
|
creativesTemplateData = {
|
|
487
438
|
type: channel,
|
|
488
439
|
name: templateData.messageSubject,
|
|
489
440
|
versions: {
|
|
490
441
|
base: {
|
|
491
442
|
content: {
|
|
492
|
-
ANDROID:
|
|
493
|
-
|
|
494
|
-
bodyType: templateData?.androidContent?.bodyType,
|
|
495
|
-
deviceType: constants.ANDROID,
|
|
496
|
-
beeHtml: { value: templateData?.androidContent?.message },
|
|
497
|
-
beeJson: templateData?.androidContent?.expandableDetails?.message,
|
|
498
|
-
isBEEeditor: true,
|
|
499
|
-
} : templateData?.androidContent,
|
|
500
|
-
IOS: isIosBeeEditor ? {
|
|
501
|
-
type: templateData?.iosContent?.type,
|
|
502
|
-
bodyType: templateData?.iosContent?.bodyType,
|
|
503
|
-
deviceType: constants.IOS,
|
|
504
|
-
beeHtml: { value: templateData?.iosContent?.message },
|
|
505
|
-
beeJson: templateData?.iosContent?.expandableDetails?.message,
|
|
506
|
-
isBEEeditor: true,
|
|
507
|
-
} : templateData?.iosContent,
|
|
443
|
+
ANDROID: templateData?.androidContent,
|
|
444
|
+
IOS: templateData?.iosContent,
|
|
508
445
|
},
|
|
509
446
|
},
|
|
510
447
|
},
|
|
@@ -739,7 +676,7 @@ export class Creatives extends React.Component {
|
|
|
739
676
|
} = templateData || {};
|
|
740
677
|
const cardContent = (rcsContent.cardContent && rcsContent.cardContent[0]) || {};
|
|
741
678
|
const Status = RCS_STATUSES.approved || '';
|
|
742
|
-
|
|
679
|
+
|
|
743
680
|
creativesTemplateData = {
|
|
744
681
|
type: channel,
|
|
745
682
|
edit: true,
|
|
@@ -891,7 +828,7 @@ export class Creatives extends React.Component {
|
|
|
891
828
|
});
|
|
892
829
|
|
|
893
830
|
getMobilePushCarouselData = (expandableDetails = []) => {
|
|
894
|
-
const newExpandableDetails = {
|
|
831
|
+
const newExpandableDetails = {...expandableDetails};
|
|
895
832
|
newExpandableDetails.style = expandableDetails.style || MANUAL_CAROUSEL;
|
|
896
833
|
newExpandableDetails.message = expandableDetails.message || '';
|
|
897
834
|
newExpandableDetails.ctas = expandableDetails.ctas || [];
|
|
@@ -986,24 +923,11 @@ export class Creatives extends React.Component {
|
|
|
986
923
|
androidContent.custom = custom;
|
|
987
924
|
}
|
|
988
925
|
if (channel === constants.MOBILE_PUSH && androidContent?.expandableDetails?.carouselData?.length) {
|
|
989
|
-
androidContent.expandableDetails = this.getMobilePushCarouselData({
|
|
990
|
-
}
|
|
991
|
-
if (androidContent?.isBEEeditor && androidContent?.beeHtml?.value) {
|
|
992
|
-
templateData.androidContent = {};
|
|
993
|
-
templateData.androidContent.type = constants.HTML;
|
|
994
|
-
templateData.androidContent.message = androidContent?.beeHtml?.value || '';
|
|
995
|
-
templateData.androidContent.title = 'bee free template';
|
|
996
|
-
templateData.androidContent.bodyType = androidContent?.bodyType;
|
|
997
|
-
templateData.androidContent.deviceType = constants.ANDROID;
|
|
998
|
-
templateData.androidContent.expandableDetails = {
|
|
999
|
-
style: BIG_HTML,
|
|
1000
|
-
message: androidContent?.beeJson || '',
|
|
1001
|
-
};
|
|
1002
|
-
} else if (!androidContent?.isBEEeditor) {
|
|
1003
|
-
templateData.androidContent = androidContent;
|
|
1004
|
-
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
1005
|
-
templateData.androidContent.deviceType = constants.ANDROID;
|
|
926
|
+
androidContent.expandableDetails = this.getMobilePushCarouselData({...androidContent?.expandableDetails});
|
|
1006
927
|
}
|
|
928
|
+
templateData.androidContent = androidContent;
|
|
929
|
+
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
930
|
+
templateData.androidContent.deviceType = constants.ANDROID;
|
|
1007
931
|
}
|
|
1008
932
|
const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
|
|
1009
933
|
if (!isEmpty(iosContent)) {
|
|
@@ -1021,24 +945,11 @@ export class Creatives extends React.Component {
|
|
|
1021
945
|
iosContent.custom = custom;
|
|
1022
946
|
}
|
|
1023
947
|
if (channel === constants.MOBILE_PUSH && iosContent?.expandableDetails?.carouselData?.length) {
|
|
1024
|
-
iosContent.expandableDetails = this.getMobilePushCarouselData({
|
|
1025
|
-
}
|
|
1026
|
-
if (iosContent?.isBEEeditor && iosContent?.beeHtml?.value) {
|
|
1027
|
-
templateData.iosContent = {};
|
|
1028
|
-
templateData.iosContent.type = constants.HTML;
|
|
1029
|
-
templateData.iosContent.message = iosContent?.beeHtml?.value || '';
|
|
1030
|
-
templateData.iosContent.title = 'bee free template';
|
|
1031
|
-
templateData.iosContent.bodyType = iosContent?.bodyType;
|
|
1032
|
-
templateData.iosContent.deviceType = constants.IOS;
|
|
1033
|
-
templateData.iosContent.expandableDetails = {
|
|
1034
|
-
style: BIG_HTML,
|
|
1035
|
-
message: iosContent?.beeJson || '',
|
|
1036
|
-
};
|
|
1037
|
-
} else if (!iosContent?.isBEEeditor) {
|
|
1038
|
-
templateData.iosContent = iosContent;
|
|
1039
|
-
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
1040
|
-
templateData.iosContent.deviceType = constants.IOS;
|
|
948
|
+
iosContent.expandableDetails = this.getMobilePushCarouselData({...iosContent?.expandableDetails});
|
|
1041
949
|
}
|
|
950
|
+
templateData.iosContent = iosContent;
|
|
951
|
+
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
952
|
+
templateData.iosContent.deviceType = constants.IOS;
|
|
1042
953
|
}
|
|
1043
954
|
templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
|
|
1044
955
|
}
|
|
@@ -1253,7 +1164,7 @@ export class Creatives extends React.Component {
|
|
|
1253
1164
|
contentType = "",
|
|
1254
1165
|
cardType = "",
|
|
1255
1166
|
cardSettings = {},
|
|
1256
|
-
} = get(versions, 'base.content.RCS.rcsContent',
|
|
1167
|
+
} = get(versions, 'base.content.RCS.rcsContent',{});
|
|
1257
1168
|
const rcsContent = {
|
|
1258
1169
|
contentType,
|
|
1259
1170
|
cardType,
|
|
@@ -1491,7 +1402,7 @@ export class Creatives extends React.Component {
|
|
|
1491
1402
|
processCentralCommsMetaId = (channel, creativesData) => {
|
|
1492
1403
|
// Create the payload for the centralcommnsmetaId API call
|
|
1493
1404
|
const { isLoyaltyModule = false, loyaltyMetaData = {} } = this.props;
|
|
1494
|
-
const { actionName, setMetaData = () => {
|
|
1405
|
+
const { actionName, setMetaData = () => {} } = loyaltyMetaData;
|
|
1495
1406
|
|
|
1496
1407
|
// const isTemplateModified = getTemplateDiffState(
|
|
1497
1408
|
// channel,
|
|
@@ -1541,9 +1452,6 @@ export class Creatives extends React.Component {
|
|
|
1541
1452
|
if (prevState.currentChannel.toUpperCase() === constants.EMAIL) {
|
|
1542
1453
|
newState = { ...newState, emailCreateMode: null };
|
|
1543
1454
|
}
|
|
1544
|
-
if (prevState.currentChannel.toUpperCase() === constants.INAPP) {
|
|
1545
|
-
newState = { ...newState, inAppEditorType: null };
|
|
1546
|
-
}
|
|
1547
1455
|
return newState;
|
|
1548
1456
|
});
|
|
1549
1457
|
}
|
|
@@ -1589,7 +1497,7 @@ export class Creatives extends React.Component {
|
|
|
1589
1497
|
shouldShowFooter = () => {
|
|
1590
1498
|
const { isFullMode } = this.props;
|
|
1591
1499
|
const {
|
|
1592
|
-
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1500
|
+
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1593
1501
|
} = this.state;
|
|
1594
1502
|
const channel = currentChannel.toUpperCase();
|
|
1595
1503
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1597,13 +1505,6 @@ export class Creatives extends React.Component {
|
|
|
1597
1505
|
showFooter = isFullMode && slidBoxContent === "preview";
|
|
1598
1506
|
const isMobilepush = channel === constants.MOBILE_PUSH;
|
|
1599
1507
|
|
|
1600
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1601
|
-
if (!supportCKEditor && channel === constants.EMAIL && currentStep === 'modeSelection' && slidBoxContent === 'createTemplate') {
|
|
1602
|
-
return true;
|
|
1603
|
-
}
|
|
1604
|
-
if (!supportCKEditor && channel === constants.EMAIL && currentStep === 'createTemplateContent' && slidBoxContent === 'createTemplate') {
|
|
1605
|
-
showFooter = true;
|
|
1606
|
-
}
|
|
1607
1508
|
|
|
1608
1509
|
if (!isFullMode) {
|
|
1609
1510
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
@@ -1639,7 +1540,6 @@ export class Creatives extends React.Component {
|
|
|
1639
1540
|
showFooter = true;
|
|
1640
1541
|
}
|
|
1641
1542
|
|
|
1642
|
-
|
|
1643
1543
|
if (showFooter) {
|
|
1644
1544
|
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent')
|
|
1645
1545
|
|| ([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
|
|
@@ -1662,7 +1562,7 @@ export class Creatives extends React.Component {
|
|
|
1662
1562
|
|
|
1663
1563
|
shouldShowDoneFooter = () => {
|
|
1664
1564
|
const {
|
|
1665
|
-
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1565
|
+
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1666
1566
|
} = this.state;
|
|
1667
1567
|
const { isFullMode } = this.props;
|
|
1668
1568
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1670,17 +1570,10 @@ export class Creatives extends React.Component {
|
|
|
1670
1570
|
const channelName = !isFullMode && templateData ? templateData.type : currentChannel;
|
|
1671
1571
|
const channel = channelName?.toUpperCase();
|
|
1672
1572
|
|
|
1673
|
-
|
|
1674
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1573
|
+
|
|
1675
1574
|
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
1676
1575
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
1677
|
-
|
|
1678
|
-
// For new HTML editor flow (when supportCKEditor is false), show Done footer when in createTemplateContent step
|
|
1679
|
-
if (!supportCKEditor && channel === constants.EMAIL && slidBoxContent === 'createTemplate' && currentStep === 'createTemplateContent') {
|
|
1680
|
-
showDone = true;
|
|
1681
|
-
} else {
|
|
1682
|
-
showDone = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
1683
|
-
}
|
|
1576
|
+
showDone = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
1684
1577
|
} else if ([constants.WECHAT, constants.MOBILE_PUSH].includes(channel)) {
|
|
1685
1578
|
showDone = currentStep === "createTemplateContent" || slidBoxContent === "editTemplate";
|
|
1686
1579
|
|
|
@@ -1690,6 +1583,7 @@ export class Creatives extends React.Component {
|
|
|
1690
1583
|
}
|
|
1691
1584
|
}
|
|
1692
1585
|
|
|
1586
|
+
|
|
1693
1587
|
return showDone;
|
|
1694
1588
|
}
|
|
1695
1589
|
|
|
@@ -1709,18 +1603,18 @@ export class Creatives extends React.Component {
|
|
|
1709
1603
|
templateNameComponentInput = ({ formData, onFormDataChange, name }) => {
|
|
1710
1604
|
// Use local state for immediate UI feedback, fallback to prop value
|
|
1711
1605
|
const displayValue = this.state.localTemplateName !== '' ? this.state.localTemplateName : name;
|
|
1712
|
-
|
|
1606
|
+
|
|
1713
1607
|
return (
|
|
1714
1608
|
<CapInput
|
|
1715
1609
|
value={displayValue}
|
|
1716
1610
|
suffix={<span />}
|
|
1717
|
-
onBlur={() => {
|
|
1718
|
-
this.setState({
|
|
1611
|
+
onBlur={() => {
|
|
1612
|
+
this.setState({
|
|
1719
1613
|
isEditName: false,
|
|
1720
|
-
localTemplateName: ''
|
|
1721
|
-
}, () => {
|
|
1722
|
-
this.showTemplateName({ formData, onFormDataChange });
|
|
1723
|
-
});
|
|
1614
|
+
localTemplateName: '' // Clear local state on blur
|
|
1615
|
+
}, () => {
|
|
1616
|
+
this.showTemplateName({ formData, onFormDataChange });
|
|
1617
|
+
});
|
|
1724
1618
|
}}
|
|
1725
1619
|
onChange={(ev) => {
|
|
1726
1620
|
const { value } = ev.currentTarget;
|
|
@@ -1732,18 +1626,10 @@ export class Creatives extends React.Component {
|
|
|
1732
1626
|
}
|
|
1733
1627
|
|
|
1734
1628
|
showTemplateName = ({ formData, onFormDataChange }) => { //gets called from email/index after template data is fetched
|
|
1735
|
-
const {
|
|
1736
|
-
slidBoxContent, currentChannel, isEditName, templateStep,
|
|
1737
|
-
} = this.state;
|
|
1629
|
+
const { slidBoxContent, currentChannel, isEditName } = this.state;
|
|
1738
1630
|
const channel = currentChannel.toUpperCase();
|
|
1739
1631
|
if ([constants.EMAIL, constants.MOBILE_PUSH, constants.INAPP].includes(channel) && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate')) {
|
|
1740
1632
|
const name = get(formData, 'template-name');
|
|
1741
|
-
|
|
1742
|
-
const isModeSelectionStep = templateStep === 'modeSelection' || this.creativesTemplateSteps[templateStep] === 'modeSelection';
|
|
1743
|
-
const isCreateMode = slidBoxContent === 'createTemplate';
|
|
1744
|
-
if (isCreateMode && isModeSelectionStep) {
|
|
1745
|
-
return;
|
|
1746
|
-
}
|
|
1747
1633
|
if (channel === constants.EMAIL && !name && slidBoxContent === 'createTemplate') {
|
|
1748
1634
|
this.setState({ isTemplateNameEmpty: true });
|
|
1749
1635
|
}
|
|
@@ -1751,9 +1637,9 @@ export class Creatives extends React.Component {
|
|
|
1751
1637
|
if (name && !isEditName) {
|
|
1752
1638
|
this.setState({ showTemplateNameComponentEdit: false });
|
|
1753
1639
|
} else if (isEditName) {
|
|
1754
|
-
this.setState({
|
|
1640
|
+
this.setState({
|
|
1755
1641
|
showTemplateNameComponentEdit: true,
|
|
1756
|
-
localTemplateName: name || ''
|
|
1642
|
+
localTemplateName: name || '' // Initialize local state with current value
|
|
1757
1643
|
});
|
|
1758
1644
|
}
|
|
1759
1645
|
}
|
|
@@ -1767,31 +1653,15 @@ export class Creatives extends React.Component {
|
|
|
1767
1653
|
});
|
|
1768
1654
|
}
|
|
1769
1655
|
|
|
1770
|
-
// Callback to update HTML Editor validation state (called from EmailWrapper)
|
|
1771
|
-
updateHtmlEditorValidationState = (validationState) => {
|
|
1772
|
-
this.setState({
|
|
1773
|
-
htmlEditorValidationState: validationState,
|
|
1774
|
-
});
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
1656
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
1778
1657
|
const {
|
|
1779
|
-
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode,
|
|
1658
|
+
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, inAppCreateMode, weChatTemplateType,
|
|
1780
1659
|
} = this.state;
|
|
1781
1660
|
let isShowContinueFooter = false;
|
|
1782
1661
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
1783
1662
|
const channel = currentChannel.toUpperCase();
|
|
1784
|
-
// Check if supportCKEditor is false (new flow)
|
|
1785
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor(); // Default to legacy flow
|
|
1786
1663
|
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
1787
|
-
|
|
1788
|
-
// Always show it (even if disabled) - visibility is separate from enabled state
|
|
1789
|
-
if (!supportCKEditor && currentStep === 'modeSelection' && slidBoxContent === 'createTemplate') {
|
|
1790
|
-
return true; // Return early to ensure visibility
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
// Legacy flow: Original logic (only when supportCKEditor is true)
|
|
1794
|
-
if (supportCKEditor && ((emailCreateMode === "upload" && !isEmpty(this.props.EmailLayout)) || emailCreateMode === "editor")) {
|
|
1664
|
+
if ((emailCreateMode === "upload" && !isEmpty(this.props.EmailLayout)) || emailCreateMode === "editor") {
|
|
1795
1665
|
let isEmailCreate = slidBoxContent === 'createTemplate';
|
|
1796
1666
|
isEmailCreate = currentChannel.toUpperCase() === constants.EMAIL && ((emailCreateMode === "upload" && currentStep !== 'createTemplateContent') || (emailCreateMode === "editor" && currentStep !== 'createTemplateContent' && currentStep !== "templateSelection"));
|
|
1797
1667
|
isShowContinueFooter = isEmailCreate && emailCreateMode;
|
|
@@ -1800,6 +1670,8 @@ export class Creatives extends React.Component {
|
|
|
1800
1670
|
isShowContinueFooter = !isEmpty(mobilePushCreateMode) && currentStep === "modeSelection";
|
|
1801
1671
|
} else if (currentChannel.toUpperCase() === constants.WECHAT) {
|
|
1802
1672
|
isShowContinueFooter = !isEmpty(weChatTemplateType) && currentStep === "modeSelection";
|
|
1673
|
+
} else if (currentChannel.toUpperCase() === constants.INAPP) {
|
|
1674
|
+
isShowContinueFooter = !isEmpty(inAppCreateMode) && currentChannel === "modeSelection";
|
|
1803
1675
|
}
|
|
1804
1676
|
|
|
1805
1677
|
return isShowContinueFooter;
|
|
@@ -1825,28 +1697,6 @@ export class Creatives extends React.Component {
|
|
|
1825
1697
|
return true;
|
|
1826
1698
|
}
|
|
1827
1699
|
|
|
1828
|
-
// Check if Continue button should be disabled (for new flow only)
|
|
1829
|
-
isContinueButtonDisabled = () => {
|
|
1830
|
-
const { currentChannel, emailCreateMode, templateNameExists } = this.state;
|
|
1831
|
-
const { isFullMode } = this.props;
|
|
1832
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1833
|
-
if (supportCKEditor) {
|
|
1834
|
-
return false;
|
|
1835
|
-
}
|
|
1836
|
-
if (currentChannel.toUpperCase() === constants.EMAIL) {
|
|
1837
|
-
const isEditorSelected = !!emailCreateMode && emailCreateMode !== 'upload';
|
|
1838
|
-
// In full mode: require both template name AND editor selection
|
|
1839
|
-
// In library mode: require only editor selection (template name not needed)
|
|
1840
|
-
if (isFullMode) {
|
|
1841
|
-
const isTemplateNameValid = templateNameExists;
|
|
1842
|
-
return !(isTemplateNameValid && isEditorSelected);
|
|
1843
|
-
}
|
|
1844
|
-
// Library mode: only editor selection is required
|
|
1845
|
-
return !isEditorSelected;
|
|
1846
|
-
}
|
|
1847
|
-
return true;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
1700
|
render() {
|
|
1851
1701
|
const {
|
|
1852
1702
|
slidBoxContent,
|
|
@@ -1855,7 +1705,6 @@ export class Creatives extends React.Component {
|
|
|
1855
1705
|
templateData,
|
|
1856
1706
|
currentChannel,
|
|
1857
1707
|
emailCreateMode,
|
|
1858
|
-
selectedEmailCreateMode,
|
|
1859
1708
|
templateStep,
|
|
1860
1709
|
isLoadingContent,
|
|
1861
1710
|
mobilePushCreateMode,
|
|
@@ -1868,8 +1717,6 @@ export class Creatives extends React.Component {
|
|
|
1868
1717
|
activeFormBuilderTab,
|
|
1869
1718
|
showTestAndPreviewSlidebox,
|
|
1870
1719
|
isTestAndPreviewMode,
|
|
1871
|
-
inAppEditorType,
|
|
1872
|
-
htmlEditorValidationState,
|
|
1873
1720
|
} = this.state;
|
|
1874
1721
|
const {
|
|
1875
1722
|
isFullMode,
|
|
@@ -1892,35 +1739,9 @@ export class Creatives extends React.Component {
|
|
|
1892
1739
|
isLoyaltyModule,
|
|
1893
1740
|
loyaltyMetaData = {},
|
|
1894
1741
|
} = this.props;
|
|
1895
|
-
// Compute Continue button label
|
|
1896
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1897
|
-
const continueButtonLabel = supportCKEditor ? messages.continue : messages.next;
|
|
1898
|
-
|
|
1899
1742
|
const mapTemplateCreate = slidBoxContent === "createTemplate"
|
|
1900
1743
|
&& weChatTemplateType === MAP_TEMPLATE
|
|
1901
1744
|
&& templateStep !== "modeSelection";
|
|
1902
|
-
|
|
1903
|
-
// Determine if we're in HTML Editor mode (where errors are shown in ValidationErrorDisplay, not ErrorInfoNote in footer)
|
|
1904
|
-
const isEmailChannel = currentChannel?.toUpperCase() === constants.EMAIL;
|
|
1905
|
-
const isEditMode = slidBoxContent === 'editTemplate';
|
|
1906
|
-
const isHTMLEditorModeInCreate = selectedEmailCreateMode === 'html_editor';
|
|
1907
|
-
const isHTMLEditorModeInEdit = isEditMode && htmlEditorValidationState != null;
|
|
1908
|
-
const isHTMLEditorMode = isEmailChannel && (isHTMLEditorModeInCreate || isHTMLEditorModeInEdit);
|
|
1909
|
-
const isBEEEditor = selectedEmailCreateMode === 'drag_drop'
|
|
1910
|
-
|| (emailCreateMode === 'editor' && !isHTMLEditorMode);
|
|
1911
|
-
|
|
1912
|
-
// Check for BEE editor errors (same logic as SlideBoxFooter)
|
|
1913
|
-
const hasStandardErrors = liquidErrorMessage && liquidErrorMessage.STANDARD_ERROR_MSG && liquidErrorMessage.STANDARD_ERROR_MSG.length > 0;
|
|
1914
|
-
const hasLiquidErrors = liquidErrorMessage && liquidErrorMessage.LIQUID_ERROR_MSG && liquidErrorMessage.LIQUID_ERROR_MSG.length > 0;
|
|
1915
|
-
const htmlEditorHasErrors = htmlEditorValidationState && htmlEditorValidationState.issueCounts && htmlEditorValidationState.issueCounts.total > 0;
|
|
1916
|
-
const hasBEEEditorErrors = isEmailChannel && (hasStandardErrors || hasLiquidErrors) && (!htmlEditorValidationState || !htmlEditorHasErrors);
|
|
1917
|
-
|
|
1918
|
-
// Only apply margin to footer when ErrorInfoNote is shown in footer (BEE editor)
|
|
1919
|
-
// For HTML Editor, errors are shown in ValidationErrorDisplay (inside content area), so no footer margin needed
|
|
1920
|
-
// IMPORTANT: Never show ErrorInfoNote in footer when in HTML Editor mode, even if liquidErrorMessage exists
|
|
1921
|
-
const shouldShowErrorInfoNoteInFooter = isHTMLEditorMode ? false : hasBEEEditorErrors;
|
|
1922
|
-
|
|
1923
|
-
// Calculate margin for header/content (always apply if there are errors, regardless of editor type)
|
|
1924
1745
|
const slideBoxWrapperMargin = (get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0 && get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0)
|
|
1925
1746
|
? CAP_SPACE_64
|
|
1926
1747
|
: get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0
|
|
@@ -1930,11 +1751,7 @@ export class Creatives extends React.Component {
|
|
|
1930
1751
|
: 0;
|
|
1931
1752
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
1932
1753
|
return (
|
|
1933
|
-
<SlideBoxWrapper
|
|
1934
|
-
slideBoxWrapperMargin={slideBoxWrapperMargin}
|
|
1935
|
-
shouldApplyFooterMargin={shouldShowErrorInfoNoteInFooter}
|
|
1936
|
-
className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}
|
|
1937
|
-
>
|
|
1754
|
+
<SlideBoxWrapper slideBoxWrapperMargin={slideBoxWrapperMargin} className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
1938
1755
|
<CapSlideBox
|
|
1939
1756
|
header={
|
|
1940
1757
|
this.shouldShowHeader() && (
|
|
@@ -1983,8 +1800,6 @@ export class Creatives extends React.Component {
|
|
|
1983
1800
|
onChannelChange={this.onChannelChange}
|
|
1984
1801
|
onEmailModeChange={this.onEmailModeChange}//used when create is clicked in email
|
|
1985
1802
|
emailCreateMode={emailCreateMode}// upload zip || use editor are values
|
|
1986
|
-
onInAppEditorTypeChange={this.onInAppEditorTypeChange}//used when create is clicked in inapp
|
|
1987
|
-
inAppEditorType={inAppEditorType}// htmlEditor || dragDropEditor are values
|
|
1988
1803
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
1989
1804
|
onCreateNextStep={this.onCreateNextStep}
|
|
1990
1805
|
onEnterTemplateName={this.onEnterTemplateName}
|
|
@@ -1994,8 +1809,6 @@ export class Creatives extends React.Component {
|
|
|
1994
1809
|
cap={cap}
|
|
1995
1810
|
setIsLoadingContent={this.setIsLoadingContent}
|
|
1996
1811
|
onMobilepushModeChange={this.onMobilepushModeChange}
|
|
1997
|
-
inAppCreateMode={this.state.inAppCreateMode}
|
|
1998
|
-
onInAppModeChange={this.onInAppModeChange}
|
|
1999
1812
|
mobilePushCreateMode={mobilePushCreateMode}
|
|
2000
1813
|
showTemplateName={this.showTemplateName}
|
|
2001
1814
|
onValidationFail={this.onValidationFail}
|
|
@@ -2034,7 +1847,6 @@ export class Creatives extends React.Component {
|
|
|
2034
1847
|
handleTestAndPreview={this.handleTestAndPreview}
|
|
2035
1848
|
handleCloseTestAndPreview={this.handleCloseTestAndPreview}
|
|
2036
1849
|
isTestAndPreviewMode={(() => this.state.isTestAndPreviewMode)()}
|
|
2037
|
-
onHtmlEditorValidationStateChange={this.updateHtmlEditorValidationState}
|
|
2038
1850
|
/>
|
|
2039
1851
|
)}
|
|
2040
1852
|
footer={this.shouldShowFooter() ? (
|
|
@@ -2049,7 +1861,6 @@ export class Creatives extends React.Component {
|
|
|
2049
1861
|
currentChannel={currentChannel.toUpperCase()}
|
|
2050
1862
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
2051
1863
|
emailCreateMode={emailCreateMode}
|
|
2052
|
-
selectedEmailCreateMode={selectedEmailCreateMode}
|
|
2053
1864
|
shouldShowContinueFooter={this.shouldShowContinueFooter}
|
|
2054
1865
|
shouldShowDoneFooter={this.shouldShowDoneFooter}
|
|
2055
1866
|
fetchingCmsData={fetchingCmsData}
|
|
@@ -2058,22 +1869,18 @@ export class Creatives extends React.Component {
|
|
|
2058
1869
|
errorMessages={liquidErrorMessage}
|
|
2059
1870
|
currentTab={activeFormBuilderTab}
|
|
2060
1871
|
onTestAndPreview={this.handleTestAndPreview}
|
|
2061
|
-
isContinueButtonDisabled={this.isContinueButtonDisabled()}
|
|
2062
|
-
continueButtonLabel={continueButtonLabel}
|
|
2063
1872
|
showTestAndPreviewButton={(() => {
|
|
2064
1873
|
const isEmailOrSmsOrWhatsappOrRcsOrInAppOrMobilePush = [constants.EMAIL, constants.SMS, constants.WHATSAPP, constants.RCS, constants.INAPP, constants.MOBILE_PUSH, constants.VIBER, constants.ZALO].includes(currentChannel.toUpperCase());
|
|
2065
1874
|
const showButton = isEmailOrSmsOrWhatsappOrRcsOrInAppOrMobilePush && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate');
|
|
2066
1875
|
return showButton;
|
|
2067
1876
|
})()}
|
|
2068
|
-
htmlEditorValidationState={htmlEditorValidationState}
|
|
2069
|
-
isCreatingTemplate={slidBoxContent === 'createTemplate' && currentChannel.toUpperCase() === constants.EMAIL}
|
|
2070
1877
|
/>
|
|
2071
1878
|
) : isLiquidValidationError && (
|
|
2072
1879
|
<CapRow className="template-footer-width">
|
|
2073
1880
|
{(() => {
|
|
2074
1881
|
const errorsToShow = get(liquidErrorMessage, constants.LIQUID_ERROR_MSG, []);
|
|
2075
1882
|
const standardErrorsToShow = get(liquidErrorMessage, constants.STANDARD_ERROR_MSG, []);
|
|
2076
|
-
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{
|
|
1883
|
+
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{LIQUID_ERROR_MSG: errorsToShow, STANDARD_ERROR_MSG: standardErrorsToShow}} />;
|
|
2077
1884
|
})()}
|
|
2078
1885
|
</CapRow>
|
|
2079
1886
|
)}
|
|
@@ -282,10 +282,6 @@ export default defineMessages({
|
|
|
282
282
|
id: `${scope}.creativesTemplatesUpdate`,
|
|
283
283
|
defaultMessage: `Update`,
|
|
284
284
|
},
|
|
285
|
-
"creativesTemplatesDone": {
|
|
286
|
-
id: `${scope}.creativesTemplatesDone`,
|
|
287
|
-
defaultMessage: `Done`,
|
|
288
|
-
},
|
|
289
285
|
"creativesTemplatesDiscard": {
|
|
290
286
|
id: `${scope}.creativesTemplatesDiscard`,
|
|
291
287
|
defaultMessage: `Discard`,
|
|
@@ -374,8 +370,4 @@ export default defineMessages({
|
|
|
374
370
|
id: `${scope}.testAndPreview`,
|
|
375
371
|
defaultMessage: `Preview and Test`,
|
|
376
372
|
},
|
|
377
|
-
"next": {
|
|
378
|
-
id: `${scope}.next`,
|
|
379
|
-
defaultMessage: `Next`,
|
|
380
|
-
},
|
|
381
373
|
});
|
|
@@ -43,12 +43,7 @@ describe("test for empty email empty template name", () => {
|
|
|
43
43
|
slidBoxContent: "editTemplate",
|
|
44
44
|
currentChannel: "EMAIL",
|
|
45
45
|
templateStep: "modeSelection",
|
|
46
|
-
isTemplateNameEmpty: true
|
|
47
|
-
htmlEditorValidationState: {
|
|
48
|
-
isContentEmpty: false,
|
|
49
|
-
issueCounts: { html: 0, label: 0, liquid: 0, total: 0 },
|
|
50
|
-
},
|
|
51
|
-
isCreatingTemplate: false,
|
|
46
|
+
isTemplateNameEmpty: true
|
|
52
47
|
}
|
|
53
48
|
renderComponent(props);
|
|
54
49
|
const errorMessage = await screen.findByText(/template name cannot be empty/i);
|
|
@@ -57,11 +52,7 @@ describe("test for empty email empty template name", () => {
|
|
|
57
52
|
expect(updateBtn).toBeDisabled();
|
|
58
53
|
renderComponent({
|
|
59
54
|
...props,
|
|
60
|
-
isTemplateNameEmpty: false
|
|
61
|
-
htmlEditorValidationState: {
|
|
62
|
-
isContentEmpty: false,
|
|
63
|
-
issueCounts: { html: 0, label: 0, liquid: 0, total: 0 },
|
|
64
|
-
},
|
|
55
|
+
isTemplateNameEmpty: false
|
|
65
56
|
})
|
|
66
57
|
const updateBtns = screen.getAllByRole('button',{name:/update/i});
|
|
67
58
|
expect(updateBtns[1]).toBeEnabled();
|