@capillarytech/creatives-library 8.0.312-alpha.2 → 8.0.312-alpha.3
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
CHANGED
|
@@ -204,6 +204,28 @@ export const ErrorInfoNote = (props) => {
|
|
|
204
204
|
const isNotArray = !Array.isArray(rawLiquidErrors);
|
|
205
205
|
const hasPlatformKeys = isObject && isNotArray && [ANDROID, IOS, GENERIC].some((key) => key in rawLiquidErrors);
|
|
206
206
|
|
|
207
|
+
// Hooks must execute on every render before any conditional return.
|
|
208
|
+
// Group into Errors (blocking) and Warnings (non-blocking)
|
|
209
|
+
const { errors: errorIssues, warnings: warningIssues } = useMemo(() => groupByErrorsAndWarnings(
|
|
210
|
+
Array.isArray(rawStandardErrors) ? rawStandardErrors : [],
|
|
211
|
+
Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [],
|
|
212
|
+
Array.isArray(rawStandardWarnings) ? rawStandardWarnings : [],
|
|
213
|
+
), [rawStandardErrors, rawLiquidErrors, rawStandardWarnings]);
|
|
214
|
+
|
|
215
|
+
const errorsCount = errorIssues.length;
|
|
216
|
+
const warningsCount = warningIssues.length;
|
|
217
|
+
const totalCount = errorsCount + warningsCount;
|
|
218
|
+
const hasLiquidErrors = Array.isArray(rawLiquidErrors) && rawLiquidErrors.length > 0;
|
|
219
|
+
|
|
220
|
+
// Default active tab: errors if any, else warnings
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (errorsCount > 0) {
|
|
223
|
+
setActiveKey(ERROR_TAB_KEYS.ERRORS);
|
|
224
|
+
} else if (warningsCount > 0) {
|
|
225
|
+
setActiveKey(ERROR_TAB_KEYS.WARNINGS);
|
|
226
|
+
}
|
|
227
|
+
}, [errorsCount, warningsCount]);
|
|
228
|
+
|
|
207
229
|
// For platform-specific errors or when useLegacyDisplay is true, use the legacy renderer
|
|
208
230
|
if (hasPlatformKeys) {
|
|
209
231
|
// Process errors for both platforms - they use the same structure but different platform parameters
|
|
@@ -255,27 +277,6 @@ export const ErrorInfoNote = (props) => {
|
|
|
255
277
|
);
|
|
256
278
|
}
|
|
257
279
|
|
|
258
|
-
// Group into Errors (blocking) and Warnings (non-blocking)
|
|
259
|
-
const { errors: errorIssues, warnings: warningIssues } = useMemo(() => groupByErrorsAndWarnings(
|
|
260
|
-
Array.isArray(rawStandardErrors) ? rawStandardErrors : [],
|
|
261
|
-
Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [],
|
|
262
|
-
Array.isArray(rawStandardWarnings) ? rawStandardWarnings : [],
|
|
263
|
-
), [rawStandardErrors, rawLiquidErrors, rawStandardWarnings]);
|
|
264
|
-
|
|
265
|
-
const errorsCount = errorIssues.length;
|
|
266
|
-
const warningsCount = warningIssues.length;
|
|
267
|
-
const totalCount = errorsCount + warningsCount;
|
|
268
|
-
const hasLiquidErrors = Array.isArray(rawLiquidErrors) && rawLiquidErrors.length > 0;
|
|
269
|
-
|
|
270
|
-
// Default active tab: errors if any, else warnings
|
|
271
|
-
useEffect(() => {
|
|
272
|
-
if (errorsCount > 0) {
|
|
273
|
-
setActiveKey(ERROR_TAB_KEYS.ERRORS);
|
|
274
|
-
} else if (warningsCount > 0) {
|
|
275
|
-
setActiveKey(ERROR_TAB_KEYS.WARNINGS);
|
|
276
|
-
}
|
|
277
|
-
}, [errorsCount, warningsCount]);
|
|
278
|
-
|
|
279
280
|
// Handle close
|
|
280
281
|
const handleClose = () => {
|
|
281
282
|
setIsDismissed(true);
|
|
@@ -54,6 +54,8 @@ import v2EditSmsReducer from '../../Sms/Edit/reducer';
|
|
|
54
54
|
import { v2SmsEditSagas } from '../../Sms/Edit/sagas';
|
|
55
55
|
import ErrorInfoNote from '../../../v2Components/ErrorInfoNote';
|
|
56
56
|
import { validateLiquidTemplateContent } from '../../../utils/commonUtils';
|
|
57
|
+
import { validateTags } from '../../../utils/tagValidations';
|
|
58
|
+
import globalMessages from '../../Cap/messages';
|
|
57
59
|
import { ANDROID } from '../../../v2Components/CommonTestAndPreview/constants';
|
|
58
60
|
|
|
59
61
|
let varMap = {};
|
|
@@ -279,6 +281,31 @@ export const SmsTraiEdit = (props) => {
|
|
|
279
281
|
return;
|
|
280
282
|
}
|
|
281
283
|
const content = updatedSmsEditor.join('');
|
|
284
|
+
const syncValidation = validateTags({
|
|
285
|
+
content,
|
|
286
|
+
tagsParam: tags,
|
|
287
|
+
location,
|
|
288
|
+
isFullMode,
|
|
289
|
+
});
|
|
290
|
+
if (!syncValidation?.valid) {
|
|
291
|
+
const standardErrors = [];
|
|
292
|
+
if (syncValidation?.isBraceError) {
|
|
293
|
+
standardErrors.push(formatMessage(globalMessages.unbalanacedCurlyBraces));
|
|
294
|
+
}
|
|
295
|
+
if (syncValidation?.missingTags?.length) {
|
|
296
|
+
standardErrors.push(
|
|
297
|
+
formatMessage(formBuilderMessages.missingTagsValidationError, {
|
|
298
|
+
missingTags: syncValidation.missingTags.join(', '),
|
|
299
|
+
})
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
setLiquidErrorMessages({
|
|
303
|
+
STANDARD_ERROR_MSG: standardErrors,
|
|
304
|
+
LIQUID_ERROR_MSG: [],
|
|
305
|
+
});
|
|
306
|
+
setIsLiquidValidationError(true);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
282
309
|
const onError = ({ standardErrors, liquidErrors }) => {
|
|
283
310
|
setLiquidErrorMessages({
|
|
284
311
|
STANDARD_ERROR_MSG: standardErrors,
|