@capillarytech/creatives-library 8.0.249 → 8.0.250-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 +2 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +10 -0
- package/services/tests/api.test.js +18 -0
- package/utils/common.js +5 -0
- package/utils/commonUtils.js +28 -5
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/transformTemplateConfig.js +0 -10
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapTagList/index.js +6 -1
- package/v2Components/CapTagListWithInput/index.js +5 -1
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
- package/v2Components/ErrorInfoNote/index.js +452 -72
- package/v2Components/ErrorInfoNote/messages.js +22 -0
- package/v2Components/ErrorInfoNote/style.scss +280 -4
- package/v2Components/FormBuilder/tests/index.test.js +13 -4
- package/v2Components/HtmlEditor/HTMLEditor.js +640 -94
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +874 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1167 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +27 -16
- package/v2Components/HtmlEditor/_htmlEditor.scss +108 -45
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +13 -101
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -139
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +9 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +11 -13
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +68 -39
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +391 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +42 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.apiErrors.test.js +795 -0
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/hooks/useValidation.js +189 -53
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +95 -85
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +94 -45
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +40 -41
- package/v2Components/HtmlEditor/utils/htmlValidator.js +71 -72
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +134 -102
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +66 -41
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -0
- package/v2Containers/BeeEditor/index.js +172 -90
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +193 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +127 -51
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +163 -13
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -1
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +239 -46
- package/v2Containers/CreativesContainer/messages.js +8 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +11 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +106 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +222 -27
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +61 -7
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/Email/tests/sagas.test.js +320 -29
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1321 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +210 -15
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +1749 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +520 -0
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +629 -77
- package/v2Containers/EmailWrapper/index.js +103 -23
- package/v2Containers/EmailWrapper/messages.js +61 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +643 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +594 -77
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
- package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
- package/v2Containers/InApp/actions.js +7 -0
- package/v2Containers/InApp/constants.js +20 -4
- package/v2Containers/InApp/index.js +802 -359
- package/v2Containers/InApp/index.scss +4 -3
- package/v2Containers/InApp/messages.js +7 -3
- package/v2Containers/InApp/reducer.js +21 -3
- package/v2Containers/InApp/sagas.js +29 -9
- package/v2Containers/InApp/selectors.js +25 -5
- package/v2Containers/InApp/tests/index.test.js +154 -50
- package/v2Containers/InApp/tests/reducer.test.js +34 -0
- package/v2Containers/InApp/tests/sagas.test.js +61 -9
- package/v2Containers/InApp/tests/selectors.test.js +612 -0
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
- package/v2Containers/InAppWrapper/constants.js +16 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
- package/v2Containers/InAppWrapper/index.js +148 -0
- package/v2Containers/InAppWrapper/messages.js +49 -0
- package/v2Containers/InappAdvance/index.js +1099 -0
- package/v2Containers/InappAdvance/index.scss +10 -0
- package/v2Containers/InappAdvance/tests/index.test.js +448 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +62 -19
- package/v2Containers/Templates/_templates.scss +60 -1
- package/v2Containers/Templates/index.js +89 -4
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +0 -152
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef, useCallback } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
4
|
import styled from 'styled-components';
|
|
@@ -11,10 +11,15 @@ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
|
|
|
11
11
|
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
12
12
|
import CapError from '@capillarytech/cap-ui-library/CapError';
|
|
13
13
|
import ComponentWithLabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
|
|
14
|
-
import
|
|
14
|
+
import { CAP_COLOR_06, CAP_WHITE } from '@capillarytech/cap-ui-library/styled/variables';
|
|
15
|
+
import { EmailWithoutSaga } from '../../Email';
|
|
15
16
|
import CmsTemplatesComponent from '../../../v2Components/CmsTemplatesComponent';
|
|
17
|
+
import EmailHTMLEditor from './EmailHTMLEditor';
|
|
18
|
+
import TestAndPreviewSlidebox from '../../../v2Components/TestAndPreviewSlidebox';
|
|
19
|
+
import { EMAIL } from '../../CreativesContainer/constants';
|
|
16
20
|
import messages from '../messages';
|
|
17
21
|
import { EMAIL_CREATE_MODES, STEPS } from '../constants';
|
|
22
|
+
import { hasSupportCKEditor } from '../../../utils/common';
|
|
18
23
|
|
|
19
24
|
const CapRadioCardWithLabel = ComponentWithLabelHOC(CapRadioCard);
|
|
20
25
|
|
|
@@ -27,9 +32,23 @@ const CardContainer = styled.div`
|
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
35
|
+
|
|
36
|
+
.ant-radio-group.cap-radioCard-v2 {
|
|
37
|
+
.ant-radio-button-wrapper {
|
|
38
|
+
&.ant-radio-button-wrapper-checked {
|
|
39
|
+
.icon-container {
|
|
40
|
+
background-color: ${CAP_COLOR_06};
|
|
41
|
+
.anticon,
|
|
42
|
+
.cap-icon {
|
|
43
|
+
color: ${CAP_WHITE};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
30
49
|
`;
|
|
31
50
|
|
|
32
|
-
// Mode selection component
|
|
51
|
+
// Mode selection component
|
|
33
52
|
const ModeSelectionUI = ({
|
|
34
53
|
isFullMode,
|
|
35
54
|
templateName,
|
|
@@ -51,7 +70,7 @@ const ModeSelectionUI = ({
|
|
|
51
70
|
value={templateName}
|
|
52
71
|
labelPosition="top"
|
|
53
72
|
size="default"
|
|
54
|
-
style={{ width: '68%'}}
|
|
73
|
+
style={{ width: '68%' }}
|
|
55
74
|
/>
|
|
56
75
|
)}
|
|
57
76
|
<CardContainer>
|
|
@@ -98,25 +117,36 @@ ModeSelectionUI.propTypes = {
|
|
|
98
117
|
uploadButtonLabel: PropTypes.node.isRequired,
|
|
99
118
|
};
|
|
100
119
|
|
|
101
|
-
// Content creation component
|
|
120
|
+
// Content creation component
|
|
102
121
|
const ContentCreationUI = ({
|
|
103
122
|
isShowEmailCreate,
|
|
104
123
|
emailProps,
|
|
105
124
|
cmsTemplatesProps,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
125
|
+
isHTMLEditorMode,
|
|
126
|
+
htmlEditorProps,
|
|
127
|
+
}) => {
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<>
|
|
131
|
+
{isShowEmailCreate ? (
|
|
132
|
+
isHTMLEditorMode ? (
|
|
133
|
+
<EmailHTMLEditor {...htmlEditorProps} />
|
|
134
|
+
) : (
|
|
135
|
+
<EmailWithoutSaga {...emailProps} />
|
|
136
|
+
)
|
|
137
|
+
) : (
|
|
138
|
+
<CmsTemplatesComponent {...cmsTemplatesProps} />
|
|
139
|
+
)}
|
|
140
|
+
</>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
115
143
|
|
|
116
144
|
ContentCreationUI.propTypes = {
|
|
117
145
|
isShowEmailCreate: PropTypes.bool.isRequired,
|
|
118
146
|
emailProps: PropTypes.object.isRequired,
|
|
119
147
|
cmsTemplatesProps: PropTypes.object.isRequired,
|
|
148
|
+
isHTMLEditorMode: PropTypes.bool,
|
|
149
|
+
htmlEditorProps: PropTypes.object,
|
|
120
150
|
};
|
|
121
151
|
|
|
122
152
|
// Main EmailWrapper presentational component
|
|
@@ -137,9 +167,136 @@ const EmailWrapperView = ({
|
|
|
137
167
|
isShowEmailCreate,
|
|
138
168
|
emailProps,
|
|
139
169
|
cmsTemplatesProps,
|
|
170
|
+
metaEntities,
|
|
171
|
+
loadingTags,
|
|
172
|
+
injectedTags,
|
|
173
|
+
globalActions,
|
|
174
|
+
supportedTags,
|
|
175
|
+
getDefaultTags,
|
|
176
|
+
location,
|
|
177
|
+
currentOrgDetails,
|
|
178
|
+
forwardedTags,
|
|
179
|
+
selectedOfferDetails,
|
|
180
|
+
eventContextTags,
|
|
181
|
+
getFormdata,
|
|
182
|
+
isGetFormData,
|
|
183
|
+
getLiquidTags,
|
|
184
|
+
showLiquidErrorInFooter,
|
|
185
|
+
onValidationFail,
|
|
186
|
+
emailActions,
|
|
187
|
+
Email,
|
|
188
|
+
templateData: templateDataProp,
|
|
189
|
+
params,
|
|
190
|
+
fetchingLiquidTags,
|
|
191
|
+
createTemplateInProgress,
|
|
192
|
+
fetchingCmsData,
|
|
193
|
+
setIsLoadingContent,
|
|
194
|
+
showTestAndPreviewSlidebox,
|
|
195
|
+
handleCloseTestAndPreview,
|
|
196
|
+
showTemplateName,
|
|
197
|
+
onHtmlEditorValidationStateChange,
|
|
198
|
+
moduleType,
|
|
140
199
|
}) => {
|
|
200
|
+
const htmlEditorRef = useRef(null);
|
|
201
|
+
const supportCKEditor = hasSupportCKEditor();
|
|
202
|
+
const hasParamsIdForEditor = params?.id || location?.query?.id || location?.params?.id || location?.pathname?.includes('/edit/');
|
|
203
|
+
const isEditModeForEditor = hasParamsIdForEditor;
|
|
204
|
+
const isBEEFromProps = emailProps?.editor === 'BEE' && emailProps?.selectedEditorMode === null;
|
|
205
|
+
const isDragDropFromCreateMode = emailCreateMode === EMAIL_CREATE_MODES.DRAG_DROP;
|
|
206
|
+
const isExplicitlyBEEEditor = isBEEFromProps || isDragDropFromCreateMode;
|
|
207
|
+
let isHTMLEditorMode = false;
|
|
208
|
+
|
|
209
|
+
if (supportCKEditor) {
|
|
210
|
+
isHTMLEditorMode = false; // Legacy flow: use Email component
|
|
211
|
+
} else if (isEditModeForEditor) {
|
|
212
|
+
isHTMLEditorMode = !isExplicitlyBEEEditor;
|
|
213
|
+
} else {
|
|
214
|
+
if (isExplicitlyBEEEditor || isBEEFromProps || isDragDropFromCreateMode) {
|
|
215
|
+
isHTMLEditorMode = false;
|
|
216
|
+
} else {
|
|
217
|
+
isHTMLEditorMode = emailProps?.selectedEditorMode === EMAIL_CREATE_MODES.HTML_EDITOR ||
|
|
218
|
+
emailCreateMode === EMAIL_CREATE_MODES.HTML_EDITOR;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const isShowTemplateSelection = step === STEPS.MODE_SELECTION;
|
|
141
223
|
|
|
142
|
-
|
|
224
|
+
// Create onFormDataChange callback for template name updates (similar to Email component)
|
|
225
|
+
// This allows CreativesContainer to update the template name when user clicks "Edit name"
|
|
226
|
+
// When user edits the name in CreativesContainer header, it calls this callback
|
|
227
|
+
// which updates the template name in EmailWrapper, and then CreativesContainer
|
|
228
|
+
// will call showTemplateName again with the updated formData
|
|
229
|
+
const handleFormDataChange = useCallback((updatedFormData) => {
|
|
230
|
+
const newTemplateName = updatedFormData?.['template-name'] || templateName;
|
|
231
|
+
if (newTemplateName !== templateName && onTemplateNameChange) {
|
|
232
|
+
// Update template name in parent (useEmailWrapper hook)
|
|
233
|
+
onTemplateNameChange({ target: { value: newTemplateName } });
|
|
234
|
+
}
|
|
235
|
+
// Note: CreativesContainer will call showTemplateName again after this callback
|
|
236
|
+
// (it stores the callback in templateContainerDetails and calls it after state updates)
|
|
237
|
+
}, [templateName, onTemplateNameChange]);
|
|
238
|
+
|
|
239
|
+
const htmlEditorProps = isHTMLEditorMode ? {
|
|
240
|
+
// Location and params
|
|
241
|
+
location,
|
|
242
|
+
params,
|
|
243
|
+
// Tag-related props
|
|
244
|
+
getDefaultTags,
|
|
245
|
+
supportedTags,
|
|
246
|
+
metaEntities,
|
|
247
|
+
injectedTags,
|
|
248
|
+
globalActions,
|
|
249
|
+
loadingTags,
|
|
250
|
+
eventContextTags,
|
|
251
|
+
forwardedTags,
|
|
252
|
+
selectedOfferDetails,
|
|
253
|
+
currentOrgDetails,
|
|
254
|
+
// Email Redux state and actions
|
|
255
|
+
Email,
|
|
256
|
+
emailActions,
|
|
257
|
+
// Full mode props
|
|
258
|
+
isFullMode,
|
|
259
|
+
templateName,
|
|
260
|
+
isGetFormData,
|
|
261
|
+
getFormdata,
|
|
262
|
+
// Library mode props
|
|
263
|
+
templateData: templateDataProp,
|
|
264
|
+
// Uploaded content from zip file
|
|
265
|
+
EmailLayout,
|
|
266
|
+
// Liquid validation
|
|
267
|
+
getLiquidTags,
|
|
268
|
+
showLiquidErrorInFooter,
|
|
269
|
+
// Validation state callback
|
|
270
|
+
onHtmlEditorValidationStateChange,
|
|
271
|
+
onValidationFail,
|
|
272
|
+
// Template name
|
|
273
|
+
showTemplateName,
|
|
274
|
+
onFormDataChange: handleFormDataChange,
|
|
275
|
+
// Module type for unsubscribe tag validation
|
|
276
|
+
moduleType,
|
|
277
|
+
// Loading states
|
|
278
|
+
fetchingLiquidTags: fetchingLiquidTags || false,
|
|
279
|
+
createTemplateInProgress: createTemplateInProgress || false,
|
|
280
|
+
fetchingCmsData: fetchingCmsData || false,
|
|
281
|
+
// Parent loading control
|
|
282
|
+
setIsLoadingContent,
|
|
283
|
+
ref: htmlEditorRef,
|
|
284
|
+
} : {};
|
|
285
|
+
|
|
286
|
+
// Get formData for TestAndPreviewSlidebox when needed
|
|
287
|
+
const getFormDataForPreview = () => {
|
|
288
|
+
if (htmlEditorRef.current && htmlEditorRef.current.getFormDataForPreview) {
|
|
289
|
+
return htmlEditorRef.current.getFormDataForPreview();
|
|
290
|
+
}
|
|
291
|
+
return {};
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const getContentForPreview = () => {
|
|
295
|
+
if (htmlEditorRef.current && htmlEditorRef.current.getContentForPreview) {
|
|
296
|
+
return htmlEditorRef.current.getContentForPreview();
|
|
297
|
+
}
|
|
298
|
+
return '';
|
|
299
|
+
};
|
|
143
300
|
|
|
144
301
|
return (
|
|
145
302
|
<>
|
|
@@ -163,9 +320,22 @@ const EmailWrapperView = ({
|
|
|
163
320
|
isShowEmailCreate={isShowEmailCreate}
|
|
164
321
|
emailProps={emailProps}
|
|
165
322
|
cmsTemplatesProps={cmsTemplatesProps}
|
|
323
|
+
isHTMLEditorMode={isHTMLEditorMode}
|
|
324
|
+
htmlEditorProps={htmlEditorProps}
|
|
166
325
|
/>
|
|
167
326
|
)}
|
|
168
327
|
</CapSpin>
|
|
328
|
+
{/* Render TestAndPreviewSlidebox for HTML Editor (similar to legacy Email component) */}
|
|
329
|
+
{isHTMLEditorMode && showTestAndPreviewSlidebox && (
|
|
330
|
+
<TestAndPreviewSlidebox
|
|
331
|
+
show={showTestAndPreviewSlidebox}
|
|
332
|
+
onClose={handleCloseTestAndPreview}
|
|
333
|
+
formData={getFormDataForPreview()}
|
|
334
|
+
content={getContentForPreview()}
|
|
335
|
+
currentChannel={EMAIL}
|
|
336
|
+
currentTab={1}
|
|
337
|
+
/>
|
|
338
|
+
)}
|
|
169
339
|
</>
|
|
170
340
|
);
|
|
171
341
|
};
|
|
@@ -175,6 +345,10 @@ EmailWrapperView.propTypes = {
|
|
|
175
345
|
emailCreateMode: PropTypes.string,
|
|
176
346
|
step: PropTypes.string,
|
|
177
347
|
isFullMode: PropTypes.bool,
|
|
348
|
+
getFormdata: PropTypes.func,
|
|
349
|
+
isGetFormData: PropTypes.bool,
|
|
350
|
+
getLiquidTags: PropTypes.func,
|
|
351
|
+
showLiquidErrorInFooter: PropTypes.func,
|
|
178
352
|
templateName: PropTypes.string,
|
|
179
353
|
onTemplateNameChange: PropTypes.func.isRequired,
|
|
180
354
|
isTemplateNameEmpty: PropTypes.bool,
|
|
@@ -187,6 +361,27 @@ EmailWrapperView.propTypes = {
|
|
|
187
361
|
isShowEmailCreate: PropTypes.bool.isRequired,
|
|
188
362
|
emailProps: PropTypes.object.isRequired,
|
|
189
363
|
cmsTemplatesProps: PropTypes.object.isRequired,
|
|
364
|
+
metaEntities: PropTypes.object,
|
|
365
|
+
loadingTags: PropTypes.bool,
|
|
366
|
+
injectedTags: PropTypes.object,
|
|
367
|
+
globalActions: PropTypes.object,
|
|
368
|
+
supportedTags: PropTypes.array,
|
|
369
|
+
getDefaultTags: PropTypes.string,
|
|
370
|
+
location: PropTypes.object,
|
|
371
|
+
currentOrgDetails: PropTypes.object,
|
|
372
|
+
forwardedTags: PropTypes.object,
|
|
373
|
+
selectedOfferDetails: PropTypes.array,
|
|
374
|
+
eventContextTags: PropTypes.array,
|
|
375
|
+
emailActions: PropTypes.object,
|
|
376
|
+
Email: PropTypes.object,
|
|
377
|
+
templateData: PropTypes.object,
|
|
378
|
+
params: PropTypes.object,
|
|
379
|
+
fetchingLiquidTags: PropTypes.bool,
|
|
380
|
+
createTemplateInProgress: PropTypes.bool,
|
|
381
|
+
fetchingCmsData: PropTypes.bool,
|
|
382
|
+
setIsLoadingContent: PropTypes.func,
|
|
383
|
+
showTestAndPreviewSlidebox: PropTypes.bool,
|
|
384
|
+
handleCloseTestAndPreview: PropTypes.func,
|
|
190
385
|
};
|
|
191
386
|
|
|
192
387
|
export default EmailWrapperView;
|
|
@@ -24,24 +24,20 @@ const HTMLEditorTesting = () => {
|
|
|
24
24
|
// Show/Hide editor
|
|
25
25
|
show: () => {
|
|
26
26
|
setIsVisible(true);
|
|
27
|
-
console.log('✅ HTMLEditor test mode activated');
|
|
28
27
|
},
|
|
29
28
|
|
|
30
29
|
hide: () => {
|
|
31
30
|
setIsVisible(false);
|
|
32
|
-
console.log('✅ HTMLEditor test mode deactivated');
|
|
33
31
|
},
|
|
34
32
|
|
|
35
33
|
toggle: () => {
|
|
36
|
-
setIsVisible(prev => !prev);
|
|
37
|
-
console.log(`✅ HTMLEditor test mode ${!isVisible ? 'activated' : 'deactivated'}`);
|
|
34
|
+
setIsVisible((prev) => !prev);
|
|
38
35
|
},
|
|
39
36
|
|
|
40
37
|
// Variant control
|
|
41
38
|
setVariant: (newVariant) => {
|
|
42
39
|
if (['email', 'inapp'].includes(newVariant)) {
|
|
43
40
|
setVariant(newVariant);
|
|
44
|
-
console.log(`✅ Variant set to: ${newVariant}`);
|
|
45
41
|
} else {
|
|
46
42
|
console.error('❌ Invalid variant. Use: "email" or "inapp"');
|
|
47
43
|
}
|
|
@@ -52,7 +48,6 @@ const HTMLEditorTesting = () => {
|
|
|
52
48
|
const validLayouts = Object.values(LAYOUT_TYPES);
|
|
53
49
|
if (validLayouts.includes(layout)) {
|
|
54
50
|
setLayoutType(layout);
|
|
55
|
-
console.log(`✅ Layout set to: ${layout}`);
|
|
56
51
|
} else {
|
|
57
52
|
console.error(`❌ Invalid layout. Use: ${validLayouts.join(', ')}`);
|
|
58
53
|
}
|
|
@@ -61,58 +56,22 @@ const HTMLEditorTesting = () => {
|
|
|
61
56
|
// Content control
|
|
62
57
|
setContent: (newContent) => {
|
|
63
58
|
setContent(newContent);
|
|
64
|
-
console.log('✅ Content updated');
|
|
65
59
|
},
|
|
66
60
|
|
|
67
61
|
getContent: () => {
|
|
68
|
-
console.log('Current content:', content);
|
|
69
62
|
return content;
|
|
70
63
|
},
|
|
71
64
|
|
|
72
65
|
// Status
|
|
73
66
|
status: () => {
|
|
74
|
-
console.log('📊 HTMLEditor Test Status:');
|
|
75
|
-
console.log(` Visible: ${isVisible}`);
|
|
76
|
-
console.log(` Variant: ${variant}`);
|
|
77
|
-
console.log(` Layout: ${layoutType}`);
|
|
78
|
-
console.log(` Content size: ${content.length} chars`);
|
|
79
67
|
},
|
|
80
68
|
|
|
81
69
|
// Help
|
|
82
70
|
help: () => {
|
|
83
|
-
|
|
84
|
-
🚀 HTMLEditor Testing Console Commands:
|
|
85
|
-
|
|
86
|
-
📱 Basic Controls:
|
|
87
|
-
htmlEditorTest.show() - Show the editor
|
|
88
|
-
htmlEditorTest.hide() - Hide the editor
|
|
89
|
-
htmlEditorTest.toggle() - Toggle editor visibility
|
|
90
|
-
|
|
91
|
-
⚙️ Configuration:
|
|
92
|
-
htmlEditorTest.setVariant('email') - Set to email variant
|
|
93
|
-
htmlEditorTest.setVariant('inapp') - Set to inapp variant
|
|
94
|
-
htmlEditorTest.setLayout('POPUP') - Set layout (inapp only)
|
|
95
|
-
- Valid: POPUP, HEADER, FOOTER, FULLSCREEN
|
|
96
|
-
|
|
97
|
-
📝 Content:
|
|
98
|
-
htmlEditorTest.setContent('<h1>Test</h1>') - Set editor content
|
|
99
|
-
htmlEditorTest.getContent() - Get current content
|
|
100
|
-
|
|
101
|
-
📊 Status:
|
|
102
|
-
htmlEditorTest.status() - Show current status
|
|
103
|
-
htmlEditorTest.help() - Show this help
|
|
104
|
-
|
|
105
|
-
💡 Example Usage:
|
|
106
|
-
htmlEditorTest.show()
|
|
107
|
-
htmlEditorTest.setVariant('inapp')
|
|
108
|
-
htmlEditorTest.setLayout('HEADER') // Top banner
|
|
109
|
-
htmlEditorTest.setLayout('FOOTER') // Bottom banner
|
|
110
|
-
`);
|
|
111
|
-
}
|
|
71
|
+
},
|
|
112
72
|
};
|
|
113
73
|
|
|
114
74
|
// Show help on first load
|
|
115
|
-
console.log('🚀 HTMLEditor Testing Ready! Type htmlEditorTest.help() for commands');
|
|
116
75
|
|
|
117
76
|
// Cleanup on unmount
|
|
118
77
|
return () => {
|
|
@@ -128,32 +87,40 @@ const HTMLEditorTesting = () => {
|
|
|
128
87
|
}
|
|
129
88
|
|
|
130
89
|
return (
|
|
131
|
-
<div
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
flexDirection: 'column',
|
|
141
|
-
padding: '20px'
|
|
142
|
-
}}>
|
|
143
|
-
{/* Header */}
|
|
144
|
-
<div style={{
|
|
145
|
-
backgroundColor: '#fff',
|
|
146
|
-
padding: '10px 20px',
|
|
147
|
-
borderRadius: '8px 8px 0 0',
|
|
90
|
+
<div
|
|
91
|
+
style={{
|
|
92
|
+
position: 'fixed',
|
|
93
|
+
top: 0,
|
|
94
|
+
left: 0,
|
|
95
|
+
right: 0,
|
|
96
|
+
bottom: 0,
|
|
97
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
98
|
+
zIndex: 9999,
|
|
148
99
|
display: 'flex',
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
borderBottom: '1px solid #ddd'
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
padding: '20px',
|
|
152
102
|
}}>
|
|
103
|
+
{/* Header */}
|
|
104
|
+
<div
|
|
105
|
+
style={{
|
|
106
|
+
backgroundColor: '#fff',
|
|
107
|
+
padding: '10px 20px',
|
|
108
|
+
borderRadius: '8px 8px 0 0',
|
|
109
|
+
display: 'flex',
|
|
110
|
+
justifyContent: 'space-between',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
borderBottom: '1px solid #ddd',
|
|
113
|
+
}}>
|
|
153
114
|
<div>
|
|
154
115
|
<strong>HTMLEditor Testing Mode</strong>
|
|
155
116
|
<span style={{ marginLeft: '20px', color: '#666' }}>
|
|
156
|
-
Variant:
|
|
117
|
+
Variant:
|
|
118
|
+
{' '}
|
|
119
|
+
{variant}
|
|
120
|
+
{' '}
|
|
121
|
+
| Layout:
|
|
122
|
+
{' '}
|
|
123
|
+
{layoutType}
|
|
157
124
|
</span>
|
|
158
125
|
</div>
|
|
159
126
|
<button
|
|
@@ -164,7 +131,7 @@ const HTMLEditorTesting = () => {
|
|
|
164
131
|
border: 'none',
|
|
165
132
|
padding: '5px 15px',
|
|
166
133
|
borderRadius: '4px',
|
|
167
|
-
cursor: 'pointer'
|
|
134
|
+
cursor: 'pointer',
|
|
168
135
|
}}
|
|
169
136
|
>
|
|
170
137
|
Close
|
|
@@ -172,12 +139,13 @@ const HTMLEditorTesting = () => {
|
|
|
172
139
|
</div>
|
|
173
140
|
|
|
174
141
|
{/* Editor Container */}
|
|
175
|
-
<div
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
142
|
+
<div
|
|
143
|
+
style={{
|
|
144
|
+
flex: 1,
|
|
145
|
+
backgroundColor: '#fff',
|
|
146
|
+
borderRadius: '0 0 8px 8px',
|
|
147
|
+
overflow: 'hidden',
|
|
148
|
+
}}>
|
|
181
149
|
<IntlProvider locale="en" messages={{}}>
|
|
182
150
|
<HTMLEditor
|
|
183
151
|
variant={variant}
|
|
@@ -185,10 +153,8 @@ const HTMLEditorTesting = () => {
|
|
|
185
153
|
initialContent={content}
|
|
186
154
|
onContentChange={(newContent) => {
|
|
187
155
|
setContent(newContent);
|
|
188
|
-
console.log('📝 Content changed:', newContent.substring(0, 100) + '...');
|
|
189
156
|
}}
|
|
190
|
-
onSave={(
|
|
191
|
-
console.log('💾 Content saved:', savedContent);
|
|
157
|
+
onSave={() => {
|
|
192
158
|
}}
|
|
193
159
|
/>
|
|
194
160
|
</IntlProvider>
|