@capillarytech/creatives-library 8.0.259 → 8.0.260-alpha.0
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 -12
- 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/index.js +4 -4
- 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 -240
- 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 +30 -239
- 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 +360 -804
- 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 +71 -152
- 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/MobilePushNew/index.js +2 -3
- 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/index.js +1 -2
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +111 -468
- 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,19 +108,7 @@ 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
|
-
this.liquidFlow = Boolean(commonUtil.hasLiquidSupportFeature());
|
|
137
112
|
this.creativesTemplateSteps = {
|
|
138
113
|
1: 'modeSelection',
|
|
139
114
|
2: 'templateSelection', // only for email in current flows wil be used for mpush, line and wechat as well.
|
|
@@ -161,7 +136,7 @@ export class Creatives extends React.Component {
|
|
|
161
136
|
if (!this.props?.isFullMode) {
|
|
162
137
|
this.props?.templateActions.getCdnTransformationConfig();
|
|
163
138
|
}
|
|
164
|
-
|
|
139
|
+
|
|
165
140
|
// Store loyalty tag props if loyaltyTagFetchingDependencies is provided
|
|
166
141
|
const { loyaltyTagFetchingDependencies } = this.props;
|
|
167
142
|
if (loyaltyTagFetchingDependencies) {
|
|
@@ -187,9 +162,9 @@ export class Creatives extends React.Component {
|
|
|
187
162
|
const isEmptyTemplateName = !value.trim();
|
|
188
163
|
|
|
189
164
|
// 1. IMMEDIATE: Update local state for instant UI feedback
|
|
190
|
-
this.setState({
|
|
165
|
+
this.setState({
|
|
191
166
|
isTemplateNameEmpty: isEmptyTemplateName,
|
|
192
|
-
localTemplateName: value
|
|
167
|
+
localTemplateName: value
|
|
193
168
|
});
|
|
194
169
|
|
|
195
170
|
// 2. DEBOUNCED: Only debounce the expensive onFormDataChange call
|
|
@@ -268,19 +243,8 @@ export class Creatives extends React.Component {
|
|
|
268
243
|
onCreateNextStep = () => {
|
|
269
244
|
this.setState((prevState) => {
|
|
270
245
|
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())) {
|
|
246
|
+
const { emailCreateMode, currentChannel } = prevState;
|
|
247
|
+
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || [constants.MOBILE_PUSH, constants.WECHAT, constants.INAPP].includes(currentChannel.toUpperCase())) {
|
|
284
248
|
templateStep = prevState.templateStep + 2;
|
|
285
249
|
}
|
|
286
250
|
return {
|
|
@@ -289,21 +253,14 @@ export class Creatives extends React.Component {
|
|
|
289
253
|
});
|
|
290
254
|
}
|
|
291
255
|
|
|
292
|
-
onEmailModeChange = (mode
|
|
293
|
-
this.setState({
|
|
294
|
-
emailCreateMode: mode,
|
|
295
|
-
selectedEmailCreateMode: selectedMode || mode, // Store the selected mode for new flow
|
|
296
|
-
});
|
|
256
|
+
onEmailModeChange = (mode) => {
|
|
257
|
+
this.setState({ emailCreateMode: mode });
|
|
297
258
|
}
|
|
298
259
|
|
|
299
260
|
onInAppModeChange = (mode) => {
|
|
300
261
|
this.setState({ inAppCreateMode: mode });
|
|
301
262
|
}
|
|
302
263
|
|
|
303
|
-
onInAppEditorTypeChange = (editorType) => {
|
|
304
|
-
this.setState({ inAppEditorType: editorType });
|
|
305
|
-
}
|
|
306
|
-
|
|
307
264
|
onMobilepushModeChange = (mode) => {
|
|
308
265
|
this.setState({ mobilePushCreateMode: mode });
|
|
309
266
|
}
|
|
@@ -347,7 +304,7 @@ export class Creatives extends React.Component {
|
|
|
347
304
|
}
|
|
348
305
|
return buttonObj;
|
|
349
306
|
});
|
|
350
|
-
const {
|
|
307
|
+
const {url, previewUrl} = media || {};
|
|
351
308
|
return {
|
|
352
309
|
bodyText: bodyTemplate,
|
|
353
310
|
varMap: cardVarMapped,
|
|
@@ -476,35 +433,14 @@ export class Creatives extends React.Component {
|
|
|
476
433
|
}
|
|
477
434
|
case constants.INAPP: {
|
|
478
435
|
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
436
|
creativesTemplateData = {
|
|
487
437
|
type: channel,
|
|
488
438
|
name: templateData.messageSubject,
|
|
489
439
|
versions: {
|
|
490
440
|
base: {
|
|
491
441
|
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,
|
|
442
|
+
ANDROID: templateData?.androidContent,
|
|
443
|
+
IOS: templateData?.iosContent,
|
|
508
444
|
},
|
|
509
445
|
},
|
|
510
446
|
},
|
|
@@ -739,7 +675,7 @@ export class Creatives extends React.Component {
|
|
|
739
675
|
} = templateData || {};
|
|
740
676
|
const cardContent = (rcsContent.cardContent && rcsContent.cardContent[0]) || {};
|
|
741
677
|
const Status = RCS_STATUSES.approved || '';
|
|
742
|
-
|
|
678
|
+
|
|
743
679
|
creativesTemplateData = {
|
|
744
680
|
type: channel,
|
|
745
681
|
edit: true,
|
|
@@ -891,7 +827,7 @@ export class Creatives extends React.Component {
|
|
|
891
827
|
});
|
|
892
828
|
|
|
893
829
|
getMobilePushCarouselData = (expandableDetails = []) => {
|
|
894
|
-
const newExpandableDetails = {
|
|
830
|
+
const newExpandableDetails = {...expandableDetails};
|
|
895
831
|
newExpandableDetails.style = expandableDetails.style || MANUAL_CAROUSEL;
|
|
896
832
|
newExpandableDetails.message = expandableDetails.message || '';
|
|
897
833
|
newExpandableDetails.ctas = expandableDetails.ctas || [];
|
|
@@ -986,24 +922,11 @@ export class Creatives extends React.Component {
|
|
|
986
922
|
androidContent.custom = custom;
|
|
987
923
|
}
|
|
988
924
|
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;
|
|
925
|
+
androidContent.expandableDetails = this.getMobilePushCarouselData({...androidContent?.expandableDetails});
|
|
1006
926
|
}
|
|
927
|
+
templateData.androidContent = androidContent;
|
|
928
|
+
templateData.androidContent.type = androidContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || constants.TEXT;
|
|
929
|
+
templateData.androidContent.deviceType = constants.ANDROID;
|
|
1007
930
|
}
|
|
1008
931
|
const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
|
|
1009
932
|
if (!isEmpty(iosContent)) {
|
|
@@ -1021,24 +944,11 @@ export class Creatives extends React.Component {
|
|
|
1021
944
|
iosContent.custom = custom;
|
|
1022
945
|
}
|
|
1023
946
|
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;
|
|
947
|
+
iosContent.expandableDetails = this.getMobilePushCarouselData({...iosContent?.expandableDetails});
|
|
1041
948
|
}
|
|
949
|
+
templateData.iosContent = iosContent;
|
|
950
|
+
templateData.iosContent.type = iosContent?.type || get(channelTemplate, 'definition.mode', '')?.toUpperCase() || 'TEXT';
|
|
951
|
+
templateData.iosContent.deviceType = constants.IOS;
|
|
1042
952
|
}
|
|
1043
953
|
templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
|
|
1044
954
|
}
|
|
@@ -1253,7 +1163,7 @@ export class Creatives extends React.Component {
|
|
|
1253
1163
|
contentType = "",
|
|
1254
1164
|
cardType = "",
|
|
1255
1165
|
cardSettings = {},
|
|
1256
|
-
} = get(versions, 'base.content.RCS.rcsContent',
|
|
1166
|
+
} = get(versions, 'base.content.RCS.rcsContent',{});
|
|
1257
1167
|
const rcsContent = {
|
|
1258
1168
|
contentType,
|
|
1259
1169
|
cardType,
|
|
@@ -1491,7 +1401,7 @@ export class Creatives extends React.Component {
|
|
|
1491
1401
|
processCentralCommsMetaId = (channel, creativesData) => {
|
|
1492
1402
|
// Create the payload for the centralcommnsmetaId API call
|
|
1493
1403
|
const { isLoyaltyModule = false, loyaltyMetaData = {} } = this.props;
|
|
1494
|
-
const { actionName, setMetaData = () => {
|
|
1404
|
+
const { actionName, setMetaData = () => {} } = loyaltyMetaData;
|
|
1495
1405
|
|
|
1496
1406
|
// const isTemplateModified = getTemplateDiffState(
|
|
1497
1407
|
// channel,
|
|
@@ -1541,9 +1451,6 @@ export class Creatives extends React.Component {
|
|
|
1541
1451
|
if (prevState.currentChannel.toUpperCase() === constants.EMAIL) {
|
|
1542
1452
|
newState = { ...newState, emailCreateMode: null };
|
|
1543
1453
|
}
|
|
1544
|
-
if (prevState.currentChannel.toUpperCase() === constants.INAPP) {
|
|
1545
|
-
newState = { ...newState, inAppEditorType: null };
|
|
1546
|
-
}
|
|
1547
1454
|
return newState;
|
|
1548
1455
|
});
|
|
1549
1456
|
}
|
|
@@ -1589,7 +1496,7 @@ export class Creatives extends React.Component {
|
|
|
1589
1496
|
shouldShowFooter = () => {
|
|
1590
1497
|
const { isFullMode } = this.props;
|
|
1591
1498
|
const {
|
|
1592
|
-
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1499
|
+
slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData,
|
|
1593
1500
|
} = this.state;
|
|
1594
1501
|
const channel = currentChannel.toUpperCase();
|
|
1595
1502
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1597,13 +1504,6 @@ export class Creatives extends React.Component {
|
|
|
1597
1504
|
showFooter = isFullMode && slidBoxContent === "preview";
|
|
1598
1505
|
const isMobilepush = channel === constants.MOBILE_PUSH;
|
|
1599
1506
|
|
|
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
1507
|
|
|
1608
1508
|
if (!isFullMode) {
|
|
1609
1509
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
@@ -1639,7 +1539,6 @@ export class Creatives extends React.Component {
|
|
|
1639
1539
|
showFooter = true;
|
|
1640
1540
|
}
|
|
1641
1541
|
|
|
1642
|
-
|
|
1643
1542
|
if (showFooter) {
|
|
1644
1543
|
if (slidBoxContent === "createTemplate" && ((channel === constants.EMAIL && currentStep === 'createTemplateContent')
|
|
1645
1544
|
|| ([constants.SMS, constants.WECHAT].includes(channel) && currentStep === 'modeSelection'))) {
|
|
@@ -1662,7 +1561,7 @@ export class Creatives extends React.Component {
|
|
|
1662
1561
|
|
|
1663
1562
|
shouldShowDoneFooter = () => {
|
|
1664
1563
|
const {
|
|
1665
|
-
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1564
|
+
slidBoxContent, templateStep, currentChannel, templateData,
|
|
1666
1565
|
} = this.state;
|
|
1667
1566
|
const { isFullMode } = this.props;
|
|
1668
1567
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
@@ -1670,17 +1569,10 @@ export class Creatives extends React.Component {
|
|
|
1670
1569
|
const channelName = !isFullMode && templateData ? templateData.type : currentChannel;
|
|
1671
1570
|
const channel = channelName?.toUpperCase();
|
|
1672
1571
|
|
|
1673
|
-
|
|
1674
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1572
|
+
|
|
1675
1573
|
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
1676
1574
|
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
|
-
}
|
|
1575
|
+
showDone = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
1684
1576
|
} else if ([constants.WECHAT, constants.MOBILE_PUSH].includes(channel)) {
|
|
1685
1577
|
showDone = currentStep === "createTemplateContent" || slidBoxContent === "editTemplate";
|
|
1686
1578
|
|
|
@@ -1690,6 +1582,7 @@ export class Creatives extends React.Component {
|
|
|
1690
1582
|
}
|
|
1691
1583
|
}
|
|
1692
1584
|
|
|
1585
|
+
|
|
1693
1586
|
return showDone;
|
|
1694
1587
|
}
|
|
1695
1588
|
|
|
@@ -1709,18 +1602,18 @@ export class Creatives extends React.Component {
|
|
|
1709
1602
|
templateNameComponentInput = ({ formData, onFormDataChange, name }) => {
|
|
1710
1603
|
// Use local state for immediate UI feedback, fallback to prop value
|
|
1711
1604
|
const displayValue = this.state.localTemplateName !== '' ? this.state.localTemplateName : name;
|
|
1712
|
-
|
|
1605
|
+
|
|
1713
1606
|
return (
|
|
1714
1607
|
<CapInput
|
|
1715
1608
|
value={displayValue}
|
|
1716
1609
|
suffix={<span />}
|
|
1717
|
-
onBlur={() => {
|
|
1718
|
-
this.setState({
|
|
1610
|
+
onBlur={() => {
|
|
1611
|
+
this.setState({
|
|
1719
1612
|
isEditName: false,
|
|
1720
|
-
localTemplateName: ''
|
|
1721
|
-
}, () => {
|
|
1722
|
-
this.showTemplateName({ formData, onFormDataChange });
|
|
1723
|
-
});
|
|
1613
|
+
localTemplateName: '' // Clear local state on blur
|
|
1614
|
+
}, () => {
|
|
1615
|
+
this.showTemplateName({ formData, onFormDataChange });
|
|
1616
|
+
});
|
|
1724
1617
|
}}
|
|
1725
1618
|
onChange={(ev) => {
|
|
1726
1619
|
const { value } = ev.currentTarget;
|
|
@@ -1732,18 +1625,10 @@ export class Creatives extends React.Component {
|
|
|
1732
1625
|
}
|
|
1733
1626
|
|
|
1734
1627
|
showTemplateName = ({ formData, onFormDataChange }) => { //gets called from email/index after template data is fetched
|
|
1735
|
-
const {
|
|
1736
|
-
slidBoxContent, currentChannel, isEditName, templateStep,
|
|
1737
|
-
} = this.state;
|
|
1628
|
+
const { slidBoxContent, currentChannel, isEditName } = this.state;
|
|
1738
1629
|
const channel = currentChannel.toUpperCase();
|
|
1739
1630
|
if ([constants.EMAIL, constants.MOBILE_PUSH, constants.INAPP].includes(channel) && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate')) {
|
|
1740
1631
|
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
1632
|
if (channel === constants.EMAIL && !name && slidBoxContent === 'createTemplate') {
|
|
1748
1633
|
this.setState({ isTemplateNameEmpty: true });
|
|
1749
1634
|
}
|
|
@@ -1751,9 +1636,9 @@ export class Creatives extends React.Component {
|
|
|
1751
1636
|
if (name && !isEditName) {
|
|
1752
1637
|
this.setState({ showTemplateNameComponentEdit: false });
|
|
1753
1638
|
} else if (isEditName) {
|
|
1754
|
-
this.setState({
|
|
1639
|
+
this.setState({
|
|
1755
1640
|
showTemplateNameComponentEdit: true,
|
|
1756
|
-
localTemplateName: name || ''
|
|
1641
|
+
localTemplateName: name || '' // Initialize local state with current value
|
|
1757
1642
|
});
|
|
1758
1643
|
}
|
|
1759
1644
|
}
|
|
@@ -1767,31 +1652,15 @@ export class Creatives extends React.Component {
|
|
|
1767
1652
|
});
|
|
1768
1653
|
}
|
|
1769
1654
|
|
|
1770
|
-
// Callback to update HTML Editor validation state (called from EmailWrapper)
|
|
1771
|
-
updateHtmlEditorValidationState = (validationState) => {
|
|
1772
|
-
this.setState({
|
|
1773
|
-
htmlEditorValidationState: validationState,
|
|
1774
|
-
});
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
1655
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
1778
1656
|
const {
|
|
1779
|
-
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode,
|
|
1657
|
+
slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, inAppCreateMode, weChatTemplateType,
|
|
1780
1658
|
} = this.state;
|
|
1781
1659
|
let isShowContinueFooter = false;
|
|
1782
1660
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
1783
1661
|
const channel = currentChannel.toUpperCase();
|
|
1784
|
-
// Check if supportCKEditor is false (new flow)
|
|
1785
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor(); // Default to legacy flow
|
|
1786
1662
|
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")) {
|
|
1663
|
+
if ((emailCreateMode === "upload" && !isEmpty(this.props.EmailLayout)) || emailCreateMode === "editor") {
|
|
1795
1664
|
let isEmailCreate = slidBoxContent === 'createTemplate';
|
|
1796
1665
|
isEmailCreate = currentChannel.toUpperCase() === constants.EMAIL && ((emailCreateMode === "upload" && currentStep !== 'createTemplateContent') || (emailCreateMode === "editor" && currentStep !== 'createTemplateContent' && currentStep !== "templateSelection"));
|
|
1797
1666
|
isShowContinueFooter = isEmailCreate && emailCreateMode;
|
|
@@ -1800,6 +1669,8 @@ export class Creatives extends React.Component {
|
|
|
1800
1669
|
isShowContinueFooter = !isEmpty(mobilePushCreateMode) && currentStep === "modeSelection";
|
|
1801
1670
|
} else if (currentChannel.toUpperCase() === constants.WECHAT) {
|
|
1802
1671
|
isShowContinueFooter = !isEmpty(weChatTemplateType) && currentStep === "modeSelection";
|
|
1672
|
+
} else if (currentChannel.toUpperCase() === constants.INAPP) {
|
|
1673
|
+
isShowContinueFooter = !isEmpty(inAppCreateMode) && currentChannel === "modeSelection";
|
|
1803
1674
|
}
|
|
1804
1675
|
|
|
1805
1676
|
return isShowContinueFooter;
|
|
@@ -1825,28 +1696,6 @@ export class Creatives extends React.Component {
|
|
|
1825
1696
|
return true;
|
|
1826
1697
|
}
|
|
1827
1698
|
|
|
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
1699
|
render() {
|
|
1851
1700
|
const {
|
|
1852
1701
|
slidBoxContent,
|
|
@@ -1855,7 +1704,6 @@ export class Creatives extends React.Component {
|
|
|
1855
1704
|
templateData,
|
|
1856
1705
|
currentChannel,
|
|
1857
1706
|
emailCreateMode,
|
|
1858
|
-
selectedEmailCreateMode,
|
|
1859
1707
|
templateStep,
|
|
1860
1708
|
isLoadingContent,
|
|
1861
1709
|
mobilePushCreateMode,
|
|
@@ -1868,8 +1716,6 @@ export class Creatives extends React.Component {
|
|
|
1868
1716
|
activeFormBuilderTab,
|
|
1869
1717
|
showTestAndPreviewSlidebox,
|
|
1870
1718
|
isTestAndPreviewMode,
|
|
1871
|
-
inAppEditorType,
|
|
1872
|
-
htmlEditorValidationState,
|
|
1873
1719
|
} = this.state;
|
|
1874
1720
|
const {
|
|
1875
1721
|
isFullMode,
|
|
@@ -1892,35 +1738,9 @@ export class Creatives extends React.Component {
|
|
|
1892
1738
|
isLoyaltyModule,
|
|
1893
1739
|
loyaltyMetaData = {},
|
|
1894
1740
|
} = this.props;
|
|
1895
|
-
// Compute Continue button label
|
|
1896
|
-
const supportCKEditor = commonUtil.hasSupportCKEditor();
|
|
1897
|
-
const continueButtonLabel = supportCKEditor ? messages.continue : messages.next;
|
|
1898
|
-
|
|
1899
1741
|
const mapTemplateCreate = slidBoxContent === "createTemplate"
|
|
1900
1742
|
&& weChatTemplateType === MAP_TEMPLATE
|
|
1901
1743
|
&& 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
1744
|
const slideBoxWrapperMargin = (get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0 && get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0)
|
|
1925
1745
|
? CAP_SPACE_64
|
|
1926
1746
|
: get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0
|
|
@@ -1930,11 +1750,7 @@ export class Creatives extends React.Component {
|
|
|
1930
1750
|
: 0;
|
|
1931
1751
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
1932
1752
|
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
|
-
>
|
|
1753
|
+
<SlideBoxWrapper slideBoxWrapperMargin={slideBoxWrapperMargin} className={classnames(`${classPrefix} ${isFullMode ? 'creatives-full-mode' : 'creatives-library-mode'} ${mapTemplateCreate ? 'map-template-create' : ''}`)}>
|
|
1938
1754
|
<CapSlideBox
|
|
1939
1755
|
header={
|
|
1940
1756
|
this.shouldShowHeader() && (
|
|
@@ -1983,8 +1799,6 @@ export class Creatives extends React.Component {
|
|
|
1983
1799
|
onChannelChange={this.onChannelChange}
|
|
1984
1800
|
onEmailModeChange={this.onEmailModeChange}//used when create is clicked in email
|
|
1985
1801
|
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
1802
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
1989
1803
|
onCreateNextStep={this.onCreateNextStep}
|
|
1990
1804
|
onEnterTemplateName={this.onEnterTemplateName}
|
|
@@ -1994,8 +1808,6 @@ export class Creatives extends React.Component {
|
|
|
1994
1808
|
cap={cap}
|
|
1995
1809
|
setIsLoadingContent={this.setIsLoadingContent}
|
|
1996
1810
|
onMobilepushModeChange={this.onMobilepushModeChange}
|
|
1997
|
-
inAppCreateMode={this.state.inAppCreateMode}
|
|
1998
|
-
onInAppModeChange={this.onInAppModeChange}
|
|
1999
1811
|
mobilePushCreateMode={mobilePushCreateMode}
|
|
2000
1812
|
showTemplateName={this.showTemplateName}
|
|
2001
1813
|
onValidationFail={this.onValidationFail}
|
|
@@ -2034,7 +1846,6 @@ export class Creatives extends React.Component {
|
|
|
2034
1846
|
handleTestAndPreview={this.handleTestAndPreview}
|
|
2035
1847
|
handleCloseTestAndPreview={this.handleCloseTestAndPreview}
|
|
2036
1848
|
isTestAndPreviewMode={(() => this.state.isTestAndPreviewMode)()}
|
|
2037
|
-
onHtmlEditorValidationStateChange={this.updateHtmlEditorValidationState}
|
|
2038
1849
|
/>
|
|
2039
1850
|
)}
|
|
2040
1851
|
footer={this.shouldShowFooter() ? (
|
|
@@ -2049,7 +1860,6 @@ export class Creatives extends React.Component {
|
|
|
2049
1860
|
currentChannel={currentChannel.toUpperCase()}
|
|
2050
1861
|
templateStep={this.creativesTemplateSteps[templateStep]}
|
|
2051
1862
|
emailCreateMode={emailCreateMode}
|
|
2052
|
-
selectedEmailCreateMode={selectedEmailCreateMode}
|
|
2053
1863
|
shouldShowContinueFooter={this.shouldShowContinueFooter}
|
|
2054
1864
|
shouldShowDoneFooter={this.shouldShowDoneFooter}
|
|
2055
1865
|
fetchingCmsData={fetchingCmsData}
|
|
@@ -2058,22 +1868,18 @@ export class Creatives extends React.Component {
|
|
|
2058
1868
|
errorMessages={liquidErrorMessage}
|
|
2059
1869
|
currentTab={activeFormBuilderTab}
|
|
2060
1870
|
onTestAndPreview={this.handleTestAndPreview}
|
|
2061
|
-
isContinueButtonDisabled={this.isContinueButtonDisabled()}
|
|
2062
|
-
continueButtonLabel={continueButtonLabel}
|
|
2063
1871
|
showTestAndPreviewButton={(() => {
|
|
2064
1872
|
const isEmailOrSmsOrWhatsappOrRcsOrInAppOrMobilePush = [constants.EMAIL, constants.SMS, constants.WHATSAPP, constants.RCS, constants.INAPP, constants.MOBILE_PUSH, constants.VIBER, constants.ZALO].includes(currentChannel.toUpperCase());
|
|
2065
1873
|
const showButton = isEmailOrSmsOrWhatsappOrRcsOrInAppOrMobilePush && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate');
|
|
2066
1874
|
return showButton;
|
|
2067
1875
|
})()}
|
|
2068
|
-
htmlEditorValidationState={htmlEditorValidationState}
|
|
2069
|
-
isCreatingTemplate={slidBoxContent === 'createTemplate' && currentChannel.toUpperCase() === constants.EMAIL}
|
|
2070
1876
|
/>
|
|
2071
1877
|
) : isLiquidValidationError && (
|
|
2072
1878
|
<CapRow className="template-footer-width">
|
|
2073
1879
|
{(() => {
|
|
2074
1880
|
const errorsToShow = get(liquidErrorMessage, constants.LIQUID_ERROR_MSG, []);
|
|
2075
1881
|
const standardErrorsToShow = get(liquidErrorMessage, constants.STANDARD_ERROR_MSG, []);
|
|
2076
|
-
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{
|
|
1882
|
+
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{LIQUID_ERROR_MSG: errorsToShow, STANDARD_ERROR_MSG: standardErrorsToShow}} />;
|
|
2077
1883
|
})()}
|
|
2078
1884
|
</CapRow>
|
|
2079
1885
|
)}
|
|
@@ -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();
|