@capillarytech/creatives-library 8.0.242-alpha.0 → 8.0.242-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +2 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/sagas/__tests__/assetPolling.test.js +74 -3
- package/sagas/assetPolling.js +8 -1
- package/services/api.js +10 -5
- package/services/tests/api.test.js +18 -0
- package/translations/en.json +0 -1
- package/utils/common.js +5 -0
- package/utils/commonUtils.js +14 -1
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/transformTemplateConfig.js +0 -10
- package/utils/transformerUtils.js +0 -42
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +14 -54
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +0 -4
- package/v2Components/CapTagList/index.js +6 -1
- package/v2Components/CapTagListWithInput/index.js +5 -1
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
- package/v2Components/ErrorInfoNote/index.js +412 -72
- package/v2Components/ErrorInfoNote/messages.js +22 -0
- package/v2Components/ErrorInfoNote/style.scss +279 -2
- package/v2Components/HtmlEditor/HTMLEditor.js +220 -91
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1132 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
- package/v2Components/HtmlEditor/_htmlEditor.scss +107 -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 +10 -11
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +70 -72
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +29 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +95 -85
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +82 -80
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +193 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +1 -2
- package/v2Containers/CreativesContainer/index.js +173 -193
- package/v2Containers/CreativesContainer/messages.js +4 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +13 -0
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +41 -6
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1046 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
- package/v2Containers/EmailWrapper/index.js +99 -23
- package/v2Containers/EmailWrapper/messages.js +61 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -77
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
- package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
- package/v2Containers/InApp/actions.js +7 -0
- package/v2Containers/InApp/constants.js +20 -4
- package/v2Containers/InApp/index.js +801 -357
- package/v2Containers/InApp/index.scss +4 -3
- package/v2Containers/InApp/messages.js +7 -3
- package/v2Containers/InApp/reducer.js +21 -3
- package/v2Containers/InApp/sagas.js +29 -9
- package/v2Containers/InApp/selectors.js +25 -5
- package/v2Containers/InApp/tests/index.test.js +154 -50
- package/v2Containers/InApp/tests/reducer.test.js +34 -0
- package/v2Containers/InApp/tests/sagas.test.js +61 -9
- package/v2Containers/InApp/tests/selectors.test.js +612 -0
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
- package/v2Containers/InAppWrapper/constants.js +16 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
- package/v2Containers/InAppWrapper/index.js +148 -0
- package/v2Containers/InAppWrapper/messages.js +49 -0
- package/v2Containers/InappAdvance/index.js +1099 -0
- package/v2Containers/InappAdvance/index.scss +10 -0
- package/v2Containers/InappAdvance/tests/index.test.js +448 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
- package/v2Containers/TagList/index.js +67 -1
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +56 -200
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +124 -277
- package/v2Containers/Templates/messages.js +4 -24
- package/v2Containers/Templates/reducer.js +0 -2
- package/v2Containers/Templates/tests/index.test.js +0 -10
- package/v2Containers/TemplatesV2/index.js +2 -3
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
- package/v2Components/CapImageUrlUpload/constants.js +0 -19
- package/v2Components/CapImageUrlUpload/index.js +0 -455
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
- package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
- package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
- package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
- package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -80
- package/v2Containers/WebPush/Create/index.js +0 -1755
- package/v2Containers/WebPush/Create/index.scss +0 -123
- package/v2Containers/WebPush/Create/messages.js +0 -199
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
- package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
- package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
- package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
- package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
- package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
- package/v2Containers/WebPush/Create/preview/constants.js +0 -162
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -303
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -188
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -127
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -108
- package/v2Containers/WebPush/index.js +0 -2
- package/v2Containers/WebPush/reducer.js +0 -104
- package/v2Containers/WebPush/sagas.js +0 -119
- package/v2Containers/WebPush/selectors.js +0 -65
- package/v2Containers/WebPush/tests/reducer.test.js +0 -863
- package/v2Containers/WebPush/tests/sagas.test.js +0 -566
- package/v2Containers/WebPush/tests/selectors.test.js +0 -960
|
@@ -34,7 +34,7 @@ export const LIQUID_PATTERNS = {
|
|
|
34
34
|
OPERATORS: /\b(and|or|not|contains|in|==|!=|<|>|<=|>=)\b/g,
|
|
35
35
|
|
|
36
36
|
// String literals in Liquid
|
|
37
|
-
STRING_LITERALS: /(["'])((?:\\.|(?!\1)[^\\])*?)\1/g
|
|
37
|
+
STRING_LITERALS: /(["'])((?:\\.|(?!\1)[^\\])*?)\1/g,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -68,7 +68,7 @@ export const liquidVSCodeTheme = HighlightStyle.define([
|
|
|
68
68
|
{ tag: tags.atom, color: '#4ec9b0' }, // Liquid filters
|
|
69
69
|
{ tag: tags.punctuation, color: '#d4d4d4' },
|
|
70
70
|
{ tag: tags.bracket, color: '#ffd700' },
|
|
71
|
-
{ tag: tags.brace, color: '#ffd700' }
|
|
71
|
+
{ tag: tags.brace, color: '#ffd700' },
|
|
72
72
|
]);
|
|
73
73
|
|
|
74
74
|
/**
|
|
@@ -151,7 +151,7 @@ export class LiquidValidator {
|
|
|
151
151
|
column: 1,
|
|
152
152
|
rule: 'liquid-stray-closing-output',
|
|
153
153
|
severity: 'error',
|
|
154
|
-
source: 'liquid-validator'
|
|
154
|
+
source: 'liquid-validator',
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -160,7 +160,7 @@ export class LiquidValidator {
|
|
|
160
160
|
// After scan, any remaining entries on stack are unclosed opening braces
|
|
161
161
|
if (stack.length > 0) {
|
|
162
162
|
// Report each unclosed opening brace
|
|
163
|
-
stack.forEach(position => {
|
|
163
|
+
stack.forEach((position) => {
|
|
164
164
|
this.errors.push({
|
|
165
165
|
type: 'error',
|
|
166
166
|
message: 'unclosed Liquid output tag - missing }}',
|
|
@@ -168,7 +168,7 @@ export class LiquidValidator {
|
|
|
168
168
|
column: 1,
|
|
169
169
|
rule: 'liquid-unclosed-output',
|
|
170
170
|
severity: 'error',
|
|
171
|
-
source: 'liquid-validator'
|
|
171
|
+
source: 'liquid-validator',
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
}
|
|
@@ -203,7 +203,7 @@ export class LiquidValidator {
|
|
|
203
203
|
column: 1,
|
|
204
204
|
rule: 'liquid-unclosed-logic',
|
|
205
205
|
severity: 'error',
|
|
206
|
-
source: 'liquid-validator'
|
|
206
|
+
source: 'liquid-validator',
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -216,7 +216,7 @@ export class LiquidValidator {
|
|
|
216
216
|
const nestedOutputPattern = /\{\{[^}]*\{\{[^}]*\}\}/g;
|
|
217
217
|
const nestedOutput = html.match(nestedOutputPattern);
|
|
218
218
|
if (nestedOutput) {
|
|
219
|
-
nestedOutput.forEach(match => {
|
|
219
|
+
nestedOutput.forEach((match) => {
|
|
220
220
|
this.errors.push({
|
|
221
221
|
type: 'error',
|
|
222
222
|
message: `Nested braces in Liquid output tag: ${match}`,
|
|
@@ -224,7 +224,7 @@ export class LiquidValidator {
|
|
|
224
224
|
column: 1,
|
|
225
225
|
rule: 'liquid-nested-braces',
|
|
226
226
|
severity: 'error',
|
|
227
|
-
source: 'liquid-validator'
|
|
227
|
+
source: 'liquid-validator',
|
|
228
228
|
});
|
|
229
229
|
});
|
|
230
230
|
}
|
|
@@ -233,7 +233,7 @@ export class LiquidValidator {
|
|
|
233
233
|
const nestedLogicPattern = /\{%[^%]*\{%[^%]*%\}/g;
|
|
234
234
|
const nestedLogic = html.match(nestedLogicPattern);
|
|
235
235
|
if (nestedLogic) {
|
|
236
|
-
nestedLogic.forEach(match => {
|
|
236
|
+
nestedLogic.forEach((match) => {
|
|
237
237
|
this.errors.push({
|
|
238
238
|
type: 'error',
|
|
239
239
|
message: `Nested braces in Liquid logic tag: ${match}`,
|
|
@@ -241,7 +241,7 @@ export class LiquidValidator {
|
|
|
241
241
|
column: 1,
|
|
242
242
|
rule: 'liquid-nested-braces',
|
|
243
243
|
severity: 'error',
|
|
244
|
-
source: 'liquid-validator'
|
|
244
|
+
source: 'liquid-validator',
|
|
245
245
|
});
|
|
246
246
|
});
|
|
247
247
|
}
|
|
@@ -262,10 +262,10 @@ export class LiquidValidator {
|
|
|
262
262
|
|
|
263
263
|
logicTags.push({
|
|
264
264
|
full: match[0],
|
|
265
|
-
content
|
|
266
|
-
keyword
|
|
265
|
+
content,
|
|
266
|
+
keyword,
|
|
267
267
|
position: match.index,
|
|
268
|
-
line: this.getLineNumber(html, match.index)
|
|
268
|
+
line: this.getLineNumber(html, match.index),
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
|
|
@@ -279,25 +279,25 @@ export class LiquidValidator {
|
|
|
279
279
|
validateBalancedTags(logicTags) {
|
|
280
280
|
const stack = [];
|
|
281
281
|
const pairs = {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
282
|
+
if: 'endif',
|
|
283
|
+
unless: 'endunless',
|
|
284
|
+
for: 'endfor',
|
|
285
|
+
case: 'endcase',
|
|
286
|
+
capture: 'endcapture',
|
|
287
|
+
comment: 'endcomment',
|
|
288
|
+
tablerow: 'endtablerow',
|
|
289
|
+
raw: 'endraw',
|
|
290
290
|
};
|
|
291
291
|
|
|
292
|
-
logicTags.forEach(tag => {
|
|
293
|
-
const keyword = tag
|
|
292
|
+
logicTags.forEach((tag) => {
|
|
293
|
+
const {keyword} = tag;
|
|
294
294
|
|
|
295
295
|
if (pairs[keyword]) {
|
|
296
296
|
// Opening tag
|
|
297
297
|
stack.push({ keyword, tag });
|
|
298
298
|
} else if (Object.values(pairs).includes(keyword)) {
|
|
299
299
|
// Closing tag
|
|
300
|
-
const expectedOpening = Object.keys(pairs).find(key => pairs[key] === keyword);
|
|
300
|
+
const expectedOpening = Object.keys(pairs).find((key) => pairs[key] === keyword);
|
|
301
301
|
const lastOpening = stack.pop();
|
|
302
302
|
|
|
303
303
|
if (!lastOpening) {
|
|
@@ -308,7 +308,7 @@ export class LiquidValidator {
|
|
|
308
308
|
column: 1,
|
|
309
309
|
rule: 'liquid-unexpected-closing',
|
|
310
310
|
severity: 'error',
|
|
311
|
-
source: 'liquid-validator'
|
|
311
|
+
source: 'liquid-validator',
|
|
312
312
|
});
|
|
313
313
|
} else if (lastOpening.keyword !== expectedOpening) {
|
|
314
314
|
this.errors.push({
|
|
@@ -318,14 +318,14 @@ export class LiquidValidator {
|
|
|
318
318
|
column: 1,
|
|
319
319
|
rule: 'liquid-mismatched-tags',
|
|
320
320
|
severity: 'error',
|
|
321
|
-
source: 'liquid-validator'
|
|
321
|
+
source: 'liquid-validator',
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
// Check for unclosed opening tags
|
|
328
|
-
stack.forEach(unclosed => {
|
|
328
|
+
stack.forEach((unclosed) => {
|
|
329
329
|
this.errors.push({
|
|
330
330
|
type: 'error',
|
|
331
331
|
message: `Unclosed Liquid tag: {% ${unclosed.keyword} %}`,
|
|
@@ -333,7 +333,7 @@ export class LiquidValidator {
|
|
|
333
333
|
column: 1,
|
|
334
334
|
rule: 'liquid-unclosed-tag',
|
|
335
335
|
severity: 'error',
|
|
336
|
-
source: 'liquid-validator'
|
|
336
|
+
source: 'liquid-validator',
|
|
337
337
|
});
|
|
338
338
|
});
|
|
339
339
|
}
|
|
@@ -345,7 +345,7 @@ export class LiquidValidator {
|
|
|
345
345
|
// Check for malformed filters
|
|
346
346
|
const malformedFilters = html.match(/\|\s*\||\|\s*$/gm);
|
|
347
347
|
if (malformedFilters) {
|
|
348
|
-
malformedFilters.forEach(match => {
|
|
348
|
+
malformedFilters.forEach((match) => {
|
|
349
349
|
this.warnings.push({
|
|
350
350
|
type: 'warning',
|
|
351
351
|
message: `Malformed Liquid filter: ${match.trim()}`,
|
|
@@ -353,7 +353,7 @@ export class LiquidValidator {
|
|
|
353
353
|
column: 1,
|
|
354
354
|
rule: 'liquid-malformed-filter',
|
|
355
355
|
severity: 'warning',
|
|
356
|
-
source: 'liquid-validator'
|
|
356
|
+
source: 'liquid-validator',
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
359
|
}
|
|
@@ -373,7 +373,7 @@ export class LiquidValidator {
|
|
|
373
373
|
column: 1,
|
|
374
374
|
rule: 'liquid-filter-usage',
|
|
375
375
|
severity: 'info',
|
|
376
|
-
source: 'liquid-validator'
|
|
376
|
+
source: 'liquid-validator',
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
379
|
}
|
|
@@ -386,7 +386,7 @@ export class LiquidValidator {
|
|
|
386
386
|
// Check for undefined variable patterns (basic check)
|
|
387
387
|
const suspiciousVariables = html.match(/\{\{\s*[^}]*undefined[^}]*\s*\}\}/g);
|
|
388
388
|
if (suspiciousVariables) {
|
|
389
|
-
suspiciousVariables.forEach(match => {
|
|
389
|
+
suspiciousVariables.forEach((match) => {
|
|
390
390
|
this.warnings.push({
|
|
391
391
|
type: 'warning',
|
|
392
392
|
message: `Potentially undefined variable: ${match}`,
|
|
@@ -394,7 +394,7 @@ export class LiquidValidator {
|
|
|
394
394
|
column: 1,
|
|
395
395
|
rule: 'liquid-undefined-variable',
|
|
396
396
|
severity: 'warning',
|
|
397
|
-
source: 'liquid-validator'
|
|
397
|
+
source: 'liquid-validator',
|
|
398
398
|
});
|
|
399
399
|
});
|
|
400
400
|
}
|
|
@@ -417,7 +417,7 @@ export class LiquidValidator {
|
|
|
417
417
|
isValid: this.errors.length === 0,
|
|
418
418
|
errors: this.errors,
|
|
419
419
|
warnings: this.warnings,
|
|
420
|
-
info: this.info
|
|
420
|
+
info: this.info,
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
423
|
}
|
|
@@ -425,60 +425,58 @@ export class LiquidValidator {
|
|
|
425
425
|
/**
|
|
426
426
|
* Enhanced CodeMirror extensions with Liquid support
|
|
427
427
|
*/
|
|
428
|
-
export const createLiquidExtensions = () =>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
"
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
"
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
"
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
"
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
"
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
"
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
"
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
"
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
];
|
|
481
|
-
};
|
|
428
|
+
export const createLiquidExtensions = () => [
|
|
429
|
+
// HTML language support (base)
|
|
430
|
+
html(),
|
|
431
|
+
|
|
432
|
+
// Enhanced syntax highlighting with Liquid support
|
|
433
|
+
syntaxHighlighting(liquidVSCodeTheme),
|
|
434
|
+
|
|
435
|
+
// Editor theme
|
|
436
|
+
EditorView.theme({
|
|
437
|
+
"&": {
|
|
438
|
+
height: "500px",
|
|
439
|
+
backgroundColor: "#1e1e1e",
|
|
440
|
+
fontSize: "14px",
|
|
441
|
+
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
|
|
442
|
+
},
|
|
443
|
+
".cm-content": {
|
|
444
|
+
padding: "12px",
|
|
445
|
+
backgroundColor: "#1e1e1e",
|
|
446
|
+
fontSize: "14px",
|
|
447
|
+
lineHeight: "20px",
|
|
448
|
+
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
|
|
449
|
+
color: "#d4d4d4",
|
|
450
|
+
},
|
|
451
|
+
".cm-focused": {
|
|
452
|
+
outline: "none",
|
|
453
|
+
},
|
|
454
|
+
".cm-lineNumbers": {
|
|
455
|
+
fontSize: "14px",
|
|
456
|
+
lineHeight: "20px",
|
|
457
|
+
color: "#858585",
|
|
458
|
+
backgroundColor: "#1e1e1e",
|
|
459
|
+
paddingRight: "8px",
|
|
460
|
+
paddingLeft: "8px",
|
|
461
|
+
borderRight: "1px solid #3e3e3e",
|
|
462
|
+
minWidth: "45px",
|
|
463
|
+
textAlign: "right",
|
|
464
|
+
},
|
|
465
|
+
".cm-gutters": {
|
|
466
|
+
backgroundColor: "#1e1e1e",
|
|
467
|
+
borderRight: "1px solid #3e3e3e",
|
|
468
|
+
},
|
|
469
|
+
".cm-activeLine": {
|
|
470
|
+
backgroundColor: "#2a2d2e",
|
|
471
|
+
},
|
|
472
|
+
".cm-selection": {
|
|
473
|
+
backgroundColor: "#264f78",
|
|
474
|
+
},
|
|
475
|
+
".cm-cursor": {
|
|
476
|
+
borderLeft: "2px solid #ffffff",
|
|
477
|
+
},
|
|
478
|
+
}),
|
|
479
|
+
];
|
|
482
480
|
|
|
483
481
|
/**
|
|
484
482
|
* Validates HTML content with Liquid template support
|
|
@@ -496,22 +494,22 @@ export const validateLiquidHTML = (html, variant = 'email') => {
|
|
|
496
494
|
*/
|
|
497
495
|
export const LIQUID_SNIPPETS = {
|
|
498
496
|
// Output tags
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
497
|
+
customer_name: '{{ customer.first_name }} {{ customer.last_name }}',
|
|
498
|
+
customer_email: '{{ customer.email }}',
|
|
499
|
+
current_date: '{{ "now" | date: "%B %d, %Y" }}',
|
|
500
|
+
organization_name: '{{ organization.name }}',
|
|
503
501
|
|
|
504
502
|
// Logic tags
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
503
|
+
if_statement: '{% if condition %}\n <!-- content -->\n{% endif %}',
|
|
504
|
+
for_loop: '{% for item in collection %}\n {{ item.name }}\n{% endfor %}',
|
|
505
|
+
unless_statement: '{% unless condition %}\n <!-- content -->\n{% endunless %}',
|
|
506
|
+
case_statement: '{% case variable %}\n {% when "value1" %}\n <!-- content -->\n {% when "value2" %}\n <!-- content -->\n {% else %}\n <!-- default content -->\n{% endcase %}',
|
|
509
507
|
|
|
510
508
|
// Common filters
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
509
|
+
date_filter: '{{ date_variable | date: "%B %d, %Y" }}',
|
|
510
|
+
capitalize_filter: '{{ text | capitalize }}',
|
|
511
|
+
truncate_filter: '{{ text | truncate: 50 }}',
|
|
512
|
+
default_filter: '{{ variable | default: "Default Value" }}',
|
|
515
513
|
};
|
|
516
514
|
|
|
517
515
|
export default {
|
|
@@ -520,5 +518,5 @@ export default {
|
|
|
520
518
|
LiquidValidator,
|
|
521
519
|
createLiquidExtensions,
|
|
522
520
|
validateLiquidHTML,
|
|
523
|
-
LIQUID_SNIPPETS
|
|
521
|
+
LIQUID_SNIPPETS,
|
|
524
522
|
};
|
|
@@ -76,7 +76,7 @@ export const comprehensiveVSCodeTheme = HighlightStyle.define([
|
|
|
76
76
|
{ tag: tags.link, color: '#4fc1ff', textDecoration: 'underline' },
|
|
77
77
|
{ tag: tags.heading, color: '#9cdcfe', fontWeight: 'bold' },
|
|
78
78
|
{ tag: tags.emphasis, fontStyle: 'italic' },
|
|
79
|
-
{ tag: tags.strong, fontWeight: 'bold' }
|
|
79
|
+
{ tag: tags.strong, fontWeight: 'bold' },
|
|
80
80
|
]);
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -88,7 +88,7 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
88
88
|
height: "500px",
|
|
89
89
|
backgroundColor: "#1e1e1e",
|
|
90
90
|
fontSize: "14px",
|
|
91
|
-
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
|
|
91
|
+
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
|
|
92
92
|
},
|
|
93
93
|
".cm-content": {
|
|
94
94
|
padding: "12px",
|
|
@@ -96,17 +96,17 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
96
96
|
fontSize: "14px",
|
|
97
97
|
lineHeight: "20px",
|
|
98
98
|
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
|
|
99
|
-
color: "#d4d4d4" // Base text color for all content
|
|
99
|
+
color: "#d4d4d4", // Base text color for all content
|
|
100
100
|
},
|
|
101
101
|
".cm-focused": {
|
|
102
|
-
outline: "none"
|
|
102
|
+
outline: "none",
|
|
103
103
|
},
|
|
104
104
|
".cm-editor": {
|
|
105
105
|
borderRadius: "0",
|
|
106
|
-
border: "none"
|
|
106
|
+
border: "none",
|
|
107
107
|
},
|
|
108
108
|
".cm-scroller": {
|
|
109
|
-
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
|
|
109
|
+
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
|
|
110
110
|
},
|
|
111
111
|
".cm-lineNumbers": {
|
|
112
112
|
fontSize: "14px",
|
|
@@ -117,47 +117,45 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
117
117
|
paddingLeft: "8px",
|
|
118
118
|
borderRight: "1px solid #3e3e3e",
|
|
119
119
|
minWidth: "45px",
|
|
120
|
-
textAlign: "right"
|
|
120
|
+
textAlign: "right",
|
|
121
121
|
},
|
|
122
122
|
".cm-gutters": {
|
|
123
123
|
backgroundColor: "#1e1e1e",
|
|
124
|
-
borderRight: "1px solid #3e3e3e"
|
|
124
|
+
borderRight: "1px solid #3e3e3e",
|
|
125
125
|
},
|
|
126
126
|
".cm-activeLine": {
|
|
127
|
-
backgroundColor: "#2a2d2e"
|
|
127
|
+
backgroundColor: "#2a2d2e",
|
|
128
128
|
},
|
|
129
129
|
".cm-selection": {
|
|
130
|
-
backgroundColor: "#264f78"
|
|
130
|
+
backgroundColor: "#264f78",
|
|
131
131
|
},
|
|
132
132
|
".cm-cursor": {
|
|
133
|
-
borderLeft: "2px solid #ffffff"
|
|
133
|
+
borderLeft: "2px solid #ffffff",
|
|
134
134
|
},
|
|
135
135
|
// Additional fallback for text nodes
|
|
136
136
|
".cm-line": {
|
|
137
|
-
color: "#d4d4d4"
|
|
138
|
-
}
|
|
137
|
+
color: "#d4d4d4",
|
|
138
|
+
},
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* ROBUST Extension Creator - Single, clean implementation
|
|
143
143
|
* Uses only verified tags to avoid undefined errors
|
|
144
144
|
*/
|
|
145
|
-
export const createRobustExtensions = () =>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
html(),
|
|
145
|
+
export const createRobustExtensions = () => [
|
|
146
|
+
// 1. HTML language support with proper parsing
|
|
147
|
+
html(),
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
// 2. SAFE syntax highlighting (using only confirmed tags)
|
|
150
|
+
syntaxHighlighting(comprehensiveVSCodeTheme),
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
};
|
|
152
|
+
// 3. Clean theme (structure only, no color conflicts)
|
|
153
|
+
cleanEditorTheme,
|
|
154
|
+
];
|
|
157
155
|
|
|
158
156
|
// Export the main function
|
|
159
157
|
export default {
|
|
160
158
|
comprehensiveVSCodeTheme,
|
|
161
159
|
cleanEditorTheme,
|
|
162
|
-
createRobustExtensions
|
|
163
|
-
};
|
|
160
|
+
createRobustExtensions,
|
|
161
|
+
};
|
|
@@ -16,7 +16,7 @@ const VALIDATION_SOURCES = {
|
|
|
16
16
|
EMAIL_SPECIFIC: 'email-specific',
|
|
17
17
|
INAPP_SPECIFIC: 'inapp-specific',
|
|
18
18
|
EMAIL_COMPATIBILITY: 'email-compatibility',
|
|
19
|
-
MOBILE_OPTIMIZATION: 'mobile-optimization'
|
|
19
|
+
MOBILE_OPTIMIZATION: 'mobile-optimization',
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -33,39 +33,34 @@ export const transformValidationToErrorInfo = (validation, variant = 'email') =>
|
|
|
33
33
|
const allIssues = validation.getAllIssues();
|
|
34
34
|
|
|
35
35
|
// Separate liquid and standard errors
|
|
36
|
-
const liquidErrors = allIssues.filter(issue =>
|
|
37
|
-
issue.
|
|
38
|
-
issue.
|
|
39
|
-
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
issue.source !== VALIDATION_SOURCES.LIQUID &&
|
|
44
|
-
!issue.rule?.includes('liquid') &&
|
|
45
|
-
!issue.message?.toLowerCase().includes('liquid')
|
|
46
|
-
);
|
|
36
|
+
const liquidErrors = allIssues.filter((issue) => issue.source === VALIDATION_SOURCES.LIQUID
|
|
37
|
+
|| issue.rule?.includes('liquid')
|
|
38
|
+
|| issue.message?.toLowerCase().includes('liquid'));
|
|
39
|
+
|
|
40
|
+
const standardErrors = allIssues.filter((issue) => issue.source !== VALIDATION_SOURCES.LIQUID
|
|
41
|
+
&& !issue.rule?.includes('liquid')
|
|
42
|
+
&& !issue.message?.toLowerCase().includes('liquid'));
|
|
47
43
|
|
|
48
44
|
// Format errors for ErrorInfoNote
|
|
49
|
-
const formatErrors = (errors) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
message += `, Char ${error.column}`;
|
|
58
|
-
}
|
|
59
|
-
message += '.';
|
|
45
|
+
const formatErrors = (errors) => errors.map((error) => {
|
|
46
|
+
let {message} = error;
|
|
47
|
+
|
|
48
|
+
// Add line/column info if available
|
|
49
|
+
if (error.line) {
|
|
50
|
+
message += ` Line ${error.line}`;
|
|
51
|
+
if (error.column) {
|
|
52
|
+
message += `, Char ${error.column}`;
|
|
60
53
|
}
|
|
54
|
+
message += '.';
|
|
55
|
+
}
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
// Add rule info if available
|
|
58
|
+
if (error.rule) {
|
|
59
|
+
message += ` • ${error.rule}`;
|
|
60
|
+
}
|
|
66
61
|
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
return message;
|
|
63
|
+
});
|
|
69
64
|
|
|
70
65
|
// Handle InApp variant with platform-specific errors (if needed in future)
|
|
71
66
|
if (variant === 'inapp') {
|
|
@@ -74,8 +69,8 @@ export const transformValidationToErrorInfo = (validation, variant = 'email') =>
|
|
|
74
69
|
return {
|
|
75
70
|
errorMessages: {
|
|
76
71
|
LIQUID_ERROR_MSG: formatErrors(liquidErrors),
|
|
77
|
-
STANDARD_ERROR_MSG: formatErrors(standardErrors)
|
|
78
|
-
}
|
|
72
|
+
STANDARD_ERROR_MSG: formatErrors(standardErrors),
|
|
73
|
+
},
|
|
79
74
|
};
|
|
80
75
|
}
|
|
81
76
|
|
|
@@ -83,8 +78,8 @@ export const transformValidationToErrorInfo = (validation, variant = 'email') =>
|
|
|
83
78
|
return {
|
|
84
79
|
errorMessages: {
|
|
85
80
|
LIQUID_ERROR_MSG: formatErrors(liquidErrors),
|
|
86
|
-
STANDARD_ERROR_MSG: formatErrors(standardErrors)
|
|
87
|
-
}
|
|
81
|
+
STANDARD_ERROR_MSG: formatErrors(standardErrors),
|
|
82
|
+
},
|
|
88
83
|
};
|
|
89
84
|
};
|
|
90
85
|
|
|
@@ -113,18 +108,16 @@ export const getValidationSummary = (validation) => {
|
|
|
113
108
|
}
|
|
114
109
|
|
|
115
110
|
const allIssues = validation.getAllIssues();
|
|
116
|
-
const errors = allIssues.filter(issue => issue.severity === 'error');
|
|
117
|
-
const warnings = allIssues.filter(issue => issue.severity === 'warning');
|
|
118
|
-
const liquidErrors = allIssues.filter(issue =>
|
|
119
|
-
issue.
|
|
120
|
-
issue.
|
|
121
|
-
issue.message?.toLowerCase().includes('liquid')
|
|
122
|
-
);
|
|
111
|
+
const errors = allIssues.filter((issue) => issue.severity === 'error');
|
|
112
|
+
const warnings = allIssues.filter((issue) => issue.severity === 'warning');
|
|
113
|
+
const liquidErrors = allIssues.filter((issue) => issue.source === VALIDATION_SOURCES.LIQUID
|
|
114
|
+
|| issue.rule?.includes('liquid')
|
|
115
|
+
|| issue.message?.toLowerCase().includes('liquid'));
|
|
123
116
|
|
|
124
117
|
return {
|
|
125
118
|
totalErrors: errors.length,
|
|
126
119
|
totalWarnings: warnings.length,
|
|
127
120
|
hasLiquidErrors: liquidErrors.length > 0,
|
|
128
|
-
totalIssues: allIssues.length
|
|
121
|
+
totalIssues: allIssues.length,
|
|
129
122
|
};
|
|
130
123
|
};
|