@capillarytech/creatives-library 8.0.262-alpha.0 → 8.0.262
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/package.json +1 -1
- package/v2Components/ErrorInfoNote/index.js +57 -112
- package/v2Components/ErrorInfoNote/messages.js +8 -12
- package/v2Components/ErrorInfoNote/style.scss +0 -4
- package/v2Components/HtmlEditor/HTMLEditor.js +46 -182
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +11 -15
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +7 -8
- package/v2Components/HtmlEditor/_htmlEditor.scss +6 -6
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +1 -1
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +4 -4
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +17 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +15 -28
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +0 -4
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +7 -31
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +53 -26
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +74 -144
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +14 -14
- package/v2Components/HtmlEditor/hooks/useValidation.js +23 -3
- package/v2Components/HtmlEditor/utils/validationConstants.js +3 -4
- package/v2Containers/CreativesContainer/index.js +1 -3
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +6 -9
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +5 -49
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +23 -38
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +4 -2
|
@@ -46,9 +46,7 @@ const mockGetAllIssues = jest.fn(() => []);
|
|
|
46
46
|
const mockGetValidationState = jest.fn(() => ({
|
|
47
47
|
isValidating: false,
|
|
48
48
|
hasErrors: false,
|
|
49
|
-
issueCounts: {
|
|
50
|
-
html: 0, label: 0, liquid: 0, total: 0,
|
|
51
|
-
},
|
|
49
|
+
issueCounts: { errors: 0, warnings: 0, total: 0 },
|
|
52
50
|
}));
|
|
53
51
|
|
|
54
52
|
// Mock HtmlEditor - it exports a lazy-loaded component by default
|
|
@@ -62,12 +60,10 @@ jest.mock('../../../../v2Components/HtmlEditor/index.lazy', () => {
|
|
|
62
60
|
isContentEmpty: () => !props.initialContent || (typeof props.initialContent === 'string' && props.initialContent.trim() === ''),
|
|
63
61
|
getIssueCounts: () => {
|
|
64
62
|
const issues = mockGetAllIssues();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
total: issues.length,
|
|
70
|
-
};
|
|
63
|
+
const total = issues.length;
|
|
64
|
+
const errors = issues.filter((i) => (i.source === 'liquid-validator' && i.severity === 'error')
|
|
65
|
+
|| ['liquid-api-validation', 'standard-api-validation'].includes(i.rule)).length;
|
|
66
|
+
return { errors, warnings: total - errors, total };
|
|
71
67
|
},
|
|
72
68
|
}));
|
|
73
69
|
|
|
@@ -94,9 +90,7 @@ jest.mock('../../../../v2Components/HtmlEditor/index.lazy', () => {
|
|
|
94
90
|
<button
|
|
95
91
|
onClick={() => props.onValidationChange && props.onValidationChange({
|
|
96
92
|
isContentEmpty: false,
|
|
97
|
-
issueCounts: {
|
|
98
|
-
html: 0, label: 0, liquid: 0, total: 0,
|
|
99
|
-
},
|
|
93
|
+
issueCounts: { errors: 0, warnings: 0, total: 0 },
|
|
100
94
|
validationComplete: true,
|
|
101
95
|
hasErrors: false,
|
|
102
96
|
})}
|
|
@@ -122,12 +116,10 @@ jest.mock('../../../../v2Components/HtmlEditor', () => {
|
|
|
122
116
|
isContentEmpty: () => !props.initialContent || (typeof props.initialContent === 'string' && props.initialContent.trim() === ''),
|
|
123
117
|
getIssueCounts: () => {
|
|
124
118
|
const issues = mockGetAllIssues();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
total: issues.length,
|
|
130
|
-
};
|
|
119
|
+
const total = issues.length;
|
|
120
|
+
const errors = issues.filter((i) => (i.source === 'liquid-validator' && i.severity === 'error')
|
|
121
|
+
|| ['liquid-api-validation', 'standard-api-validation'].includes(i.rule)).length;
|
|
122
|
+
return { errors, warnings: total - errors, total };
|
|
131
123
|
},
|
|
132
124
|
}));
|
|
133
125
|
|
|
@@ -154,9 +146,7 @@ jest.mock('../../../../v2Components/HtmlEditor', () => {
|
|
|
154
146
|
<button
|
|
155
147
|
onClick={() => props.onValidationChange && props.onValidationChange({
|
|
156
148
|
isContentEmpty: false,
|
|
157
|
-
issueCounts: {
|
|
158
|
-
html: 0, label: 0, liquid: 0, total: 0,
|
|
159
|
-
},
|
|
149
|
+
issueCounts: { errors: 0, warnings: 0, total: 0 },
|
|
160
150
|
validationComplete: true,
|
|
161
151
|
hasErrors: false,
|
|
162
152
|
})}
|
|
@@ -426,9 +416,7 @@ describe('EmailHTMLEditor', () => {
|
|
|
426
416
|
mockGetValidationState.mockReturnValue({
|
|
427
417
|
isValidating: false,
|
|
428
418
|
hasErrors: false,
|
|
429
|
-
issueCounts: {
|
|
430
|
-
html: 0, label: 0, liquid: 0, total: 0,
|
|
431
|
-
},
|
|
419
|
+
issueCounts: { errors: 0, warnings: 0, total: 0 },
|
|
432
420
|
});
|
|
433
421
|
// Reset hasLiquidSupportFeature mock to return true by default
|
|
434
422
|
mockHasLiquidSupportFeature.mockReturnValue(true);
|
|
@@ -878,7 +866,7 @@ describe('EmailHTMLEditor', () => {
|
|
|
878
866
|
isValidating: false,
|
|
879
867
|
hasErrors: true,
|
|
880
868
|
issueCounts: {
|
|
881
|
-
|
|
869
|
+
errors: 0, warnings: 1, total: 1,
|
|
882
870
|
},
|
|
883
871
|
});
|
|
884
872
|
|
|
@@ -921,7 +909,7 @@ describe('EmailHTMLEditor', () => {
|
|
|
921
909
|
isValidating: false,
|
|
922
910
|
hasErrors: true,
|
|
923
911
|
issueCounts: {
|
|
924
|
-
|
|
912
|
+
errors: 0, warnings: 1, total: 1,
|
|
925
913
|
},
|
|
926
914
|
});
|
|
927
915
|
|
|
@@ -963,7 +951,7 @@ describe('EmailHTMLEditor', () => {
|
|
|
963
951
|
isValidating: false,
|
|
964
952
|
hasErrors: true,
|
|
965
953
|
issueCounts: {
|
|
966
|
-
|
|
954
|
+
errors: 1, warnings: 0, total: 1,
|
|
967
955
|
},
|
|
968
956
|
});
|
|
969
957
|
|
|
@@ -2149,9 +2137,8 @@ describe('EmailHTMLEditor', () => {
|
|
|
2149
2137
|
|
|
2150
2138
|
const issueCounts = ref.current.getIssueCounts();
|
|
2151
2139
|
expect(issueCounts).toEqual({
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
liquid: expect.any(Number),
|
|
2140
|
+
errors: expect.any(Number),
|
|
2141
|
+
warnings: expect.any(Number),
|
|
2155
2142
|
total: expect.any(Number),
|
|
2156
2143
|
});
|
|
2157
2144
|
});
|
|
@@ -2201,7 +2188,7 @@ describe('EmailHTMLEditor', () => {
|
|
|
2201
2188
|
});
|
|
2202
2189
|
|
|
2203
2190
|
it('getIssueCounts returns default object with zeros (lines 168-170)', async () => {
|
|
2204
|
-
// This covers
|
|
2191
|
+
// This covers default return: { errors: 0, warnings: 0, total: 0 };
|
|
2205
2192
|
const ref = React.createRef();
|
|
2206
2193
|
|
|
2207
2194
|
render(
|
|
@@ -2218,18 +2205,16 @@ describe('EmailHTMLEditor', () => {
|
|
|
2218
2205
|
}, { timeout: 3000 });
|
|
2219
2206
|
|
|
2220
2207
|
// When htmlEditorRef.current?.getIssueCounts is not available,
|
|
2221
|
-
// the default return value should be {
|
|
2208
|
+
// the default return value should be { errors: 0, warnings: 0, total: 0 }
|
|
2222
2209
|
const issueCounts = ref.current.getIssueCounts();
|
|
2223
2210
|
expect(issueCounts).toEqual({
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
liquid: expect.any(Number),
|
|
2211
|
+
errors: expect.any(Number),
|
|
2212
|
+
warnings: expect.any(Number),
|
|
2227
2213
|
total: expect.any(Number),
|
|
2228
2214
|
});
|
|
2229
2215
|
// Verify all keys exist
|
|
2230
|
-
expect(issueCounts.
|
|
2231
|
-
expect(issueCounts.
|
|
2232
|
-
expect(issueCounts.liquid).toBeDefined();
|
|
2216
|
+
expect(issueCounts.errors).toBeDefined();
|
|
2217
|
+
expect(issueCounts.warnings).toBeDefined();
|
|
2233
2218
|
expect(issueCounts.total).toBeDefined();
|
|
2234
2219
|
});
|
|
2235
2220
|
|
|
@@ -14,8 +14,10 @@ export default css`
|
|
|
14
14
|
margin: 0 auto;
|
|
15
15
|
width: 100%;
|
|
16
16
|
padding: ${CAP_SPACE_24} 0;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/* Only main channel tabs content, not HTML Editor validation panel tabs */
|
|
18
|
+
> .cap-tab-v2 > .ant-tabs-content-holder > .ant-tabs-content,
|
|
19
|
+
> .cap-tab-v2 > .ant-tabs-content {
|
|
20
|
+
margin-top: ${CAP_SPACE_16};
|
|
19
21
|
}
|
|
20
22
|
` : `.cap-tab-v2 {
|
|
21
23
|
height: calc(100vh - 11.25rem);
|