@capillarytech/creatives-library 8.0.235 → 8.0.236-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/config/app.js +0 -1
- package/constants/unified.js +1 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +5 -2
- package/services/tests/api.test.js +18 -0
- package/utils/common.js +1 -2
- package/utils/commonUtils.js +14 -1
- package/utils/transformTemplateConfig.js +0 -10
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapTagList/index.js +4 -0
- package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
- package/v2Components/HtmlEditor/HTMLEditor.js +165 -80
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +532 -0
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
- package/v2Components/HtmlEditor/_htmlEditor.scss +0 -4
- package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +0 -98
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +125 -148
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -0
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- 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/constants.js +29 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +158 -17
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +53 -143
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +85 -85
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +31 -21
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/BeeEditor/index.js +82 -80
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +180 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +69 -34
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -1
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +65 -13
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +4 -12
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -0
- 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 +18 -4
- package/v2Containers/InApp/index.js +642 -355
- 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 +1006 -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 +65 -1
- package/v2Containers/Templates/_templates.scss +49 -1
- package/v2Containers/Templates/index.js +93 -5
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Templates/reducer.js +20 -7
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +8 -88
- package/v2Containers/Templates/tests/reducer.test.js +125 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
|
@@ -31,79 +31,6 @@
|
|
|
31
31
|
display: flex;
|
|
32
32
|
align-items: center;
|
|
33
33
|
gap: 0.5rem;
|
|
34
|
-
|
|
35
|
-
.cap-button,
|
|
36
|
-
.ant-btn,
|
|
37
|
-
button {
|
|
38
|
-
color: map-get($CAP_PRIMARY, base);
|
|
39
|
-
border: none;
|
|
40
|
-
background: $CAP_WHITE;
|
|
41
|
-
border-radius: 0.25rem;
|
|
42
|
-
padding: 0.375rem 0.5rem;
|
|
43
|
-
font-size: 0.875rem;
|
|
44
|
-
font-family: $FONT_FAMILY;
|
|
45
|
-
font-weight: 500;
|
|
46
|
-
height: auto;
|
|
47
|
-
min-width: 5.9375rem;
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
gap: 0.25rem;
|
|
51
|
-
box-shadow: 0 0 0.0625rem 0 rgba(9, 30, 66, 0.31), 0 0.25rem 0.5rem -0.125rem rgba(9, 30, 66, 0.25);
|
|
52
|
-
line-height: 1.25rem;
|
|
53
|
-
text-align: left;
|
|
54
|
-
|
|
55
|
-
&:hover {
|
|
56
|
-
background: $CAP_G09;
|
|
57
|
-
box-shadow: 0 0 0.0625rem 0 rgba(9, 30, 66, 0.31), 0 0.375rem 0.75rem -0.125rem rgba(9, 30, 66, 0.25);
|
|
58
|
-
color: map-get($CAP_PRIMARY, base);
|
|
59
|
-
border: none;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&:active,
|
|
63
|
-
&:focus {
|
|
64
|
-
background: $CAP_G08;
|
|
65
|
-
box-shadow: 0 0 0.0625rem 0 rgba(9, 30, 66, 0.31), 0 0.125rem 0.25rem -0.125rem rgba(9, 30, 66, 0.25);
|
|
66
|
-
color: map-get($CAP_PRIMARY, base);
|
|
67
|
-
border: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.anticon,
|
|
71
|
-
.cap-icon {
|
|
72
|
-
font-size: 1rem;
|
|
73
|
-
color: map-get($CAP_PRIMARY, base);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
span {
|
|
77
|
-
font-size: 0.875rem;
|
|
78
|
-
font-weight: 500;
|
|
79
|
-
line-height: 1.25rem;
|
|
80
|
-
color: map-get($CAP_PRIMARY, base);
|
|
81
|
-
white-space: nowrap;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&:before,
|
|
85
|
-
&:after {
|
|
86
|
-
display: none;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.tooltip-add-label-container {
|
|
91
|
-
|
|
92
|
-
.cap-button,
|
|
93
|
-
.ant-btn {
|
|
94
|
-
color: map-get($CAP_PRIMARY, base);
|
|
95
|
-
background: $CAP_WHITE;
|
|
96
|
-
border: none;
|
|
97
|
-
box-shadow: 0 0 0.0625rem 0 rgba(9, 30, 66, 0.31), 0 0.25rem 0.5rem -0.125rem rgba(9, 30, 66, 0.25);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.cap-button-flat,
|
|
102
|
-
.cap-button-add {
|
|
103
|
-
background: $CAP_WHITE;
|
|
104
|
-
color: map-get($CAP_PRIMARY, base);
|
|
105
|
-
border: none;
|
|
106
|
-
}
|
|
107
34
|
}
|
|
108
35
|
|
|
109
36
|
&__content {
|
|
@@ -234,31 +161,6 @@
|
|
|
234
161
|
top: 0.5rem;
|
|
235
162
|
right: 0.5rem;
|
|
236
163
|
z-index: 20;
|
|
237
|
-
|
|
238
|
-
.cap-button,
|
|
239
|
-
.ant-btn,
|
|
240
|
-
button {
|
|
241
|
-
background: $CAP_WHITE;
|
|
242
|
-
color: map-get($CAP_PRIMARY, base);
|
|
243
|
-
border: none;
|
|
244
|
-
border-radius: 0.25rem;
|
|
245
|
-
padding: 0.375rem 0.5rem;
|
|
246
|
-
font-size: 0.875rem;
|
|
247
|
-
font-family: $FONT_FAMILY;
|
|
248
|
-
font-weight: 500;
|
|
249
|
-
min-width: 5.9375rem;
|
|
250
|
-
box-shadow: 0 0 0.0625rem 0 rgba(9, 30, 66, 0.31), 0 0.25rem 0.5rem -0.125rem rgba(9, 30, 66, 0.25);
|
|
251
|
-
|
|
252
|
-
&:hover {
|
|
253
|
-
background: $CAP_G09;
|
|
254
|
-
color: map-get($CAP_PRIMARY, base);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
&:active {
|
|
258
|
-
background: $CAP_G08;
|
|
259
|
-
color: map-get($CAP_PRIMARY, base);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
164
|
}
|
|
263
165
|
|
|
264
166
|
.codemirror-editor {
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* - Theme support with proper styling
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import React, {
|
|
11
|
+
import React, {
|
|
12
|
+
forwardRef, useImperativeHandle, useRef, useEffect,
|
|
13
|
+
} from 'react';
|
|
12
14
|
import PropTypes from 'prop-types';
|
|
13
15
|
|
|
14
16
|
// CodeMirror 6 imports
|
|
@@ -16,16 +18,15 @@ import { EditorState } from '@codemirror/state';
|
|
|
16
18
|
import { EditorView, lineNumbers, highlightActiveLine } from '@codemirror/view';
|
|
17
19
|
|
|
18
20
|
// Import our comprehensive syntax highlighting solution
|
|
21
|
+
import { injectIntl, intlShape } from 'react-intl';
|
|
22
|
+
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
19
23
|
import { createRobustExtensions } from '../../utils/properSyntaxHighlighting';
|
|
20
24
|
|
|
21
25
|
|
|
22
|
-
import { injectIntl, intlShape } from 'react-intl';
|
|
23
|
-
|
|
24
26
|
// Messages
|
|
25
27
|
import messages from '../../messages';
|
|
26
28
|
|
|
27
29
|
// Cap UI Components
|
|
28
|
-
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
29
30
|
|
|
30
31
|
// Components
|
|
31
32
|
import TagList from '../../../../v2Containers/TagList';
|
|
@@ -44,7 +45,14 @@ const CodeEditorPaneComponent = ({
|
|
|
44
45
|
className = '',
|
|
45
46
|
isFullscreenMode = false,
|
|
46
47
|
onLabelInsert,
|
|
47
|
-
forwardedRef
|
|
48
|
+
forwardedRef,
|
|
49
|
+
// Tags-related props
|
|
50
|
+
tags = [],
|
|
51
|
+
injectedTags = {},
|
|
52
|
+
location = {},
|
|
53
|
+
selectedOfferDetails = null,
|
|
54
|
+
onTagSelect = null,
|
|
55
|
+
onContextChange = null,
|
|
48
56
|
}) => {
|
|
49
57
|
const { content, validation } = useEditorContext();
|
|
50
58
|
const { content: contentValue, updateContent } = content;
|
|
@@ -61,7 +69,7 @@ const CodeEditorPaneComponent = ({
|
|
|
61
69
|
get view() {
|
|
62
70
|
return viewRef.current;
|
|
63
71
|
},
|
|
64
|
-
viewRef
|
|
72
|
+
viewRef, // For compatibility with existing code
|
|
65
73
|
|
|
66
74
|
focus: () => {
|
|
67
75
|
if (viewRef.current) {
|
|
@@ -75,7 +83,7 @@ const CodeEditorPaneComponent = ({
|
|
|
75
83
|
const pos = position !== undefined ? position : head;
|
|
76
84
|
view.dispatch({
|
|
77
85
|
changes: { from: pos, insert: text },
|
|
78
|
-
selection: { anchor: pos + text.length }
|
|
86
|
+
selection: { anchor: pos + text.length },
|
|
79
87
|
});
|
|
80
88
|
} else {
|
|
81
89
|
throw new Error('CodeMirror view not initialized');
|
|
@@ -88,9 +96,7 @@ const CodeEditorPaneComponent = ({
|
|
|
88
96
|
}
|
|
89
97
|
return 0;
|
|
90
98
|
},
|
|
91
|
-
getValue: () =>
|
|
92
|
-
return contentValue || '';
|
|
93
|
-
},
|
|
99
|
+
getValue: () => contentValue || '',
|
|
94
100
|
setValue: (value) => {
|
|
95
101
|
updateContent(value);
|
|
96
102
|
},
|
|
@@ -107,7 +113,7 @@ const CodeEditorPaneComponent = ({
|
|
|
107
113
|
|
|
108
114
|
view.dispatch({
|
|
109
115
|
selection: { anchor: pos },
|
|
110
|
-
effects: EditorView.scrollIntoView(pos, { y: 'center' })
|
|
116
|
+
effects: EditorView.scrollIntoView(pos, { y: 'center' }),
|
|
111
117
|
});
|
|
112
118
|
view.focus();
|
|
113
119
|
} catch (error) {
|
|
@@ -117,79 +123,99 @@ const CodeEditorPaneComponent = ({
|
|
|
117
123
|
}
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
|
-
}
|
|
126
|
+
},
|
|
121
127
|
}), [contentValue]);
|
|
122
128
|
|
|
123
129
|
// Note: handleContentChange removed - using updateContentRef directly in CodeMirror
|
|
124
130
|
|
|
125
131
|
const handleTagSelect = (tagData) => {
|
|
126
132
|
// Get the unified editor
|
|
127
|
-
if (viewRef.current) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (!tagText) {
|
|
139
|
-
console.warn('Invalid tag data:', tagData);
|
|
140
|
-
return;
|
|
133
|
+
if (!viewRef.current) {
|
|
134
|
+
console.warn('CodeEditorPane: Editor view not initialized. Cannot insert tag.');
|
|
135
|
+
// Try to notify parent if onLabelInsert is available
|
|
136
|
+
if (onLabelInsert) {
|
|
137
|
+
// Extract tag text for notification purposes
|
|
138
|
+
let tagText = '';
|
|
139
|
+
if (typeof tagData === 'string') {
|
|
140
|
+
tagText = tagData;
|
|
141
|
+
} else if (tagData) {
|
|
142
|
+
const { text, name, label, value } = tagData;
|
|
143
|
+
tagText = text || name || label || value || '';
|
|
141
144
|
}
|
|
142
|
-
|
|
145
|
+
const formattedTag = tagText ? `{{${tagText}}}` : '';
|
|
146
|
+
// Call onLabelInsert with null position to indicate editor not ready
|
|
147
|
+
onLabelInsert(formattedTag, null);
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const view = viewRef.current;
|
|
153
|
+
const { state: { selection: { main: { head: pos } } } } = view;
|
|
154
|
+
|
|
155
|
+
// Extract tag text from the tagData object using destructuring
|
|
156
|
+
let tagText = '';
|
|
157
|
+
if (typeof tagData === 'string') {
|
|
158
|
+
tagText = tagData;
|
|
159
|
+
} else if (tagData) {
|
|
160
|
+
const {
|
|
161
|
+
text, name, label, value,
|
|
162
|
+
} = tagData;
|
|
163
|
+
tagText = text || name || label || value;
|
|
164
|
+
if (!tagText) {
|
|
143
165
|
console.warn('Invalid tag data:', tagData);
|
|
144
166
|
return;
|
|
145
167
|
}
|
|
168
|
+
} else {
|
|
169
|
+
console.warn('Invalid tag data:', tagData);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
146
172
|
|
|
147
|
-
|
|
148
|
-
|
|
173
|
+
// For unified HTML editor, insert as template variable
|
|
174
|
+
const formattedTag = `{{${tagText}}}`;
|
|
149
175
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
176
|
+
// Insert the tag at cursor position
|
|
177
|
+
view.dispatch({
|
|
178
|
+
changes: { from: pos, insert: formattedTag },
|
|
179
|
+
selection: { anchor: pos + formattedTag.length },
|
|
180
|
+
});
|
|
155
181
|
|
|
156
|
-
|
|
157
|
-
|
|
182
|
+
// Focus back to editor
|
|
183
|
+
view.focus();
|
|
158
184
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
185
|
+
// Call the parent's handleLabelInsert for notification purposes only
|
|
186
|
+
// The tag has already been inserted above, so this is just for parent component awareness
|
|
187
|
+
if (onLabelInsert) {
|
|
188
|
+
onLabelInsert(formattedTag, pos);
|
|
163
189
|
}
|
|
164
190
|
};
|
|
165
191
|
|
|
166
192
|
// Initialize CodeMirror effect
|
|
167
193
|
useEffect(() => {
|
|
168
194
|
if (editorRef.current && !viewRef.current) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
195
|
+
// Use the comprehensive extensions from properSyntaxHighlighting.js
|
|
196
|
+
// This includes: html(), syntaxHighlighting(comprehensiveVSCodeTheme), cleanEditorTheme
|
|
197
|
+
const robustExtensions = createRobustExtensions();
|
|
198
|
+
|
|
199
|
+
// Add additional extensions for line numbers, active line, and update listener
|
|
200
|
+
const extensions = [
|
|
201
|
+
lineNumbers(),
|
|
202
|
+
highlightActiveLine(),
|
|
203
|
+
...robustExtensions, // Spread the robust extensions (html, syntax highlighting, theme)
|
|
204
|
+
EditorView.updateListener.of((update) => {
|
|
205
|
+
if (update.docChanged) {
|
|
206
|
+
updateContentRef.current(update.state.doc.toString());
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
];
|
|
184
210
|
|
|
185
211
|
const state = EditorState.create({
|
|
186
212
|
doc: contentValue || '',
|
|
187
|
-
extensions
|
|
213
|
+
extensions,
|
|
188
214
|
});
|
|
189
215
|
|
|
190
216
|
viewRef.current = new EditorView({
|
|
191
217
|
state,
|
|
192
|
-
parent: editorRef.current
|
|
218
|
+
parent: editorRef.current,
|
|
193
219
|
});
|
|
194
220
|
}
|
|
195
221
|
|
|
@@ -215,100 +241,52 @@ const CodeEditorPaneComponent = ({
|
|
|
215
241
|
changes: {
|
|
216
242
|
from: 0,
|
|
217
243
|
to: length,
|
|
218
|
-
insert: contentValue || ''
|
|
219
|
-
}
|
|
244
|
+
insert: contentValue || '',
|
|
245
|
+
},
|
|
220
246
|
});
|
|
221
247
|
}
|
|
222
248
|
}, [contentValue]);
|
|
223
249
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
desc: 'Customer email address',
|
|
261
|
-
resolved: true
|
|
262
|
-
},
|
|
263
|
-
'customer.phone': {
|
|
264
|
-
name: 'Phone',
|
|
265
|
-
desc: 'Customer phone number',
|
|
266
|
-
resolved: true
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
'Common Tags': {
|
|
271
|
-
name: 'Common Tags',
|
|
272
|
-
desc: 'Commonly used template tags',
|
|
273
|
-
resolved: true,
|
|
274
|
-
'tag-header': true,
|
|
275
|
-
subtags: {
|
|
276
|
-
'organization.name': {
|
|
277
|
-
name: 'Organization Name',
|
|
278
|
-
desc: 'Organization name',
|
|
279
|
-
resolved: true
|
|
280
|
-
},
|
|
281
|
-
'currentDate': {
|
|
282
|
-
name: 'Current Date',
|
|
283
|
-
desc: 'Current date',
|
|
284
|
-
resolved: true
|
|
285
|
-
},
|
|
286
|
-
'unsubscribeLink': {
|
|
287
|
-
name: 'Unsubscribe Link',
|
|
288
|
-
desc: 'Unsubscribe link',
|
|
289
|
-
resolved: true
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}}
|
|
294
|
-
moduleFilterEnabled={true}
|
|
295
|
-
userLocale="en"
|
|
296
|
-
channel="email"
|
|
297
|
-
disabled={readOnly}
|
|
298
|
-
location={{
|
|
299
|
-
query: {
|
|
300
|
-
type: 'html-editor' // Identify the context
|
|
301
|
-
}
|
|
302
|
-
}}
|
|
303
|
-
selectedOfferDetails={[]}
|
|
304
|
-
eventContextTags={[]}
|
|
305
|
-
/>
|
|
306
|
-
</CapRow>
|
|
307
|
-
</div>
|
|
308
|
-
</CapRow>
|
|
309
|
-
|
|
250
|
+
return (
|
|
251
|
+
<CapRow className={`code-editor-pane ${className}`}>
|
|
252
|
+
{/* Unified Code Editor with Floating Add Label Button */}
|
|
253
|
+
<CapRow className="code-editor-pane__content">
|
|
254
|
+
<div className="codemirror-wrapper">
|
|
255
|
+
<div ref={editorRef} className="codemirror-editor" />
|
|
256
|
+
{/* Floating Add Label Button */}
|
|
257
|
+
<CapRow className="code-editor-pane__actions">
|
|
258
|
+
<TagList
|
|
259
|
+
key="html-editor-taglist"
|
|
260
|
+
label={intl.formatMessage(messages.addLabel)}
|
|
261
|
+
onTagSelect={(tag) => {
|
|
262
|
+
// Always use handleTagSelect to insert tag at cursor position
|
|
263
|
+
handleTagSelect(tag);
|
|
264
|
+
// Also call parent's onTagSelect callback if provided
|
|
265
|
+
if (onTagSelect) {
|
|
266
|
+
onTagSelect(tag);
|
|
267
|
+
}
|
|
268
|
+
}}
|
|
269
|
+
onContextChange={(context) => {
|
|
270
|
+
if (onContextChange) {
|
|
271
|
+
onContextChange(context);
|
|
272
|
+
}
|
|
273
|
+
}}
|
|
274
|
+
className="tag-list-trigger"
|
|
275
|
+
tags={tags} // Use passed tags from parent component
|
|
276
|
+
injectedTags={injectedTags} // Use passed injectedTags from parent component
|
|
277
|
+
location={location} // Use passed location for context
|
|
278
|
+
selectedOfferDetails={selectedOfferDetails} // Use passed selectedOfferDetails
|
|
279
|
+
moduleFilterEnabled={
|
|
280
|
+
location && location?.query && location?.query?.type !== "embedded"
|
|
281
|
+
}
|
|
282
|
+
disabled={readOnly}
|
|
283
|
+
/>
|
|
284
|
+
</CapRow>
|
|
285
|
+
</div>
|
|
310
286
|
</CapRow>
|
|
311
|
-
|
|
287
|
+
|
|
288
|
+
</CapRow>
|
|
289
|
+
);
|
|
312
290
|
};
|
|
313
291
|
|
|
314
292
|
// Create the forwardRef wrapper
|
|
@@ -323,9 +301,8 @@ CodeEditorPane.propTypes = {
|
|
|
323
301
|
readOnly: PropTypes.bool,
|
|
324
302
|
className: PropTypes.string,
|
|
325
303
|
isFullscreenMode: PropTypes.bool,
|
|
326
|
-
onLabelInsert: PropTypes.func
|
|
304
|
+
onLabelInsert: PropTypes.func,
|
|
327
305
|
};
|
|
328
306
|
|
|
329
307
|
// Export with injectIntl - ref forwarding is handled by forwardRef wrapper
|
|
330
308
|
export default injectIntl(CodeEditorPane);
|
|
331
|
-
|
|
@@ -32,7 +32,7 @@ const DeviceToggle = ({
|
|
|
32
32
|
onDeviceChange,
|
|
33
33
|
keepContentSame = false,
|
|
34
34
|
onKeepContentSameChange,
|
|
35
|
-
className = ''
|
|
35
|
+
className = '',
|
|
36
36
|
}) => {
|
|
37
37
|
const handleDeviceClick = (device) => {
|
|
38
38
|
if (onDeviceChange && device !== activeDevice) {
|
|
@@ -97,7 +97,7 @@ DeviceToggle.propTypes = {
|
|
|
97
97
|
onDeviceChange: PropTypes.func,
|
|
98
98
|
keepContentSame: PropTypes.bool,
|
|
99
99
|
onKeepContentSameChange: PropTypes.func,
|
|
100
|
-
className: PropTypes.string
|
|
100
|
+
className: PropTypes.string,
|
|
101
101
|
};
|
|
102
102
|
|
|
103
103
|
DeviceToggle.defaultProps = {
|
|
@@ -105,7 +105,7 @@ DeviceToggle.defaultProps = {
|
|
|
105
105
|
onDeviceChange: null,
|
|
106
106
|
keepContentSame: false,
|
|
107
107
|
onKeepContentSameChange: null,
|
|
108
|
-
className: ''
|
|
108
|
+
className: '',
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
export default injectIntl(DeviceToggle);
|
|
@@ -14,9 +14,7 @@ const DeviceFrame = ({
|
|
|
14
14
|
className = '',
|
|
15
15
|
...props
|
|
16
16
|
}) => {
|
|
17
|
-
const getFrameAsset = () =>
|
|
18
|
-
return device === DEVICE_TYPES.IOS ? iosFrame : androidFrame;
|
|
19
|
-
};
|
|
17
|
+
const getFrameAsset = () => device === DEVICE_TYPES.IOS ? iosFrame : androidFrame;
|
|
20
18
|
|
|
21
19
|
const getFrameStyles = () => {
|
|
22
20
|
const baseStyles = {
|
|
@@ -26,14 +24,13 @@ const DeviceFrame = ({
|
|
|
26
24
|
backgroundRepeat: 'no-repeat',
|
|
27
25
|
backgroundPosition: 'center',
|
|
28
26
|
backgroundSize: 'contain',
|
|
29
|
-
filter: 'drop-shadow(0 12px 48px rgba(0, 0, 0, 0.25)) brightness(1.05) contrast(1.1)'
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
// Unified dimensions - both devices use the same size since assets are identical
|
|
33
30
|
return {
|
|
34
31
|
...baseStyles,
|
|
35
32
|
width: '450px',
|
|
36
|
-
height: '920px'
|
|
33
|
+
height: '920px',
|
|
37
34
|
};
|
|
38
35
|
};
|
|
39
36
|
|
|
@@ -45,7 +42,7 @@ const DeviceFrame = ({
|
|
|
45
42
|
{...props}
|
|
46
43
|
>
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
{children}
|
|
49
46
|
|
|
50
47
|
</div>
|
|
51
48
|
);
|
|
@@ -54,7 +51,7 @@ const DeviceFrame = ({
|
|
|
54
51
|
DeviceFrame.propTypes = {
|
|
55
52
|
device: PropTypes.oneOf(Object.values(DEVICE_TYPES)),
|
|
56
53
|
children: PropTypes.node,
|
|
57
|
-
className: PropTypes.string
|
|
54
|
+
className: PropTypes.string,
|
|
58
55
|
};
|
|
59
56
|
|
|
60
57
|
export default DeviceFrame;
|