@capillarytech/creatives-library 8.0.87 → 8.0.88-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/package.json
CHANGED
|
@@ -282,11 +282,28 @@ export const Zalo = (props) => {
|
|
|
282
282
|
const handleErrorValidation = (e, field) => {
|
|
283
283
|
const { minLength, maxLength } = field;
|
|
284
284
|
let error = e ? tagValidationErrorMessage(e) : '';
|
|
285
|
-
|
|
285
|
+
|
|
286
|
+
// Check if the value contains any tags
|
|
287
|
+
const containsTags = e && e.includes('{{') && e.includes('}}');
|
|
288
|
+
|
|
289
|
+
if (!e || e.length <= minLength) {
|
|
286
290
|
error = formatMessage(messages.maxMinLengthMessage, {
|
|
287
291
|
minLength,
|
|
288
292
|
maxLength,
|
|
289
293
|
});
|
|
294
|
+
} else if (e.length > maxLength) {
|
|
295
|
+
if (containsTags) {
|
|
296
|
+
// Show warning message for tag values
|
|
297
|
+
error = formatMessage(messages.tagLengthWarning, {
|
|
298
|
+
maxLength,
|
|
299
|
+
});
|
|
300
|
+
} else {
|
|
301
|
+
// Show error message for static values
|
|
302
|
+
error = formatMessage(messages.maxMinLengthMessage, {
|
|
303
|
+
minLength,
|
|
304
|
+
maxLength,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
290
307
|
}
|
|
291
308
|
return error;
|
|
292
309
|
};
|
|
@@ -355,7 +372,10 @@ export const Zalo = (props) => {
|
|
|
355
372
|
const errorMessage = !error
|
|
356
373
|
? handleErrorValidation(value, listParams)
|
|
357
374
|
: error;
|
|
358
|
-
|
|
375
|
+
|
|
376
|
+
// Only disable if there's an error and the value doesn't contain tags
|
|
377
|
+
const containsTags = value && value.includes('{{') && value.includes('}}');
|
|
378
|
+
if (errorMessage && !containsTags) {
|
|
359
379
|
disableCheck = true;
|
|
360
380
|
}
|
|
361
381
|
});
|
|
@@ -397,7 +417,10 @@ export const Zalo = (props) => {
|
|
|
397
417
|
|
|
398
418
|
const renderContent = () =>
|
|
399
419
|
templateListParams?.map((listParam) => {
|
|
400
|
-
const { name = '', value = '', maxLength } = listParam;
|
|
420
|
+
const { name = '', value = '', maxLength = '' } = listParam;
|
|
421
|
+
const containsTags = value && value.includes('{{') && value.includes('}}');
|
|
422
|
+
const isExceedingLength = value.length > maxLength;
|
|
423
|
+
|
|
401
424
|
return (
|
|
402
425
|
<>
|
|
403
426
|
{renderTextBoxesForListParams(listParam)}
|
|
@@ -407,11 +430,21 @@ export const Zalo = (props) => {
|
|
|
407
430
|
name,
|
|
408
431
|
})}
|
|
409
432
|
</CapLabel>
|
|
410
|
-
<CapLabel
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
433
|
+
<CapLabel
|
|
434
|
+
className="variable-field-length"
|
|
435
|
+
>
|
|
436
|
+
{
|
|
437
|
+
containsTags && isExceedingLength ? (
|
|
438
|
+
formatMessage(messages.tagLengthWarning, {
|
|
439
|
+
maxLength,
|
|
440
|
+
})
|
|
441
|
+
) : (
|
|
442
|
+
formatMessage(messages.charactersCount, {
|
|
443
|
+
variableLength: value.length,
|
|
444
|
+
maxLength,
|
|
445
|
+
})
|
|
446
|
+
)
|
|
447
|
+
}
|
|
415
448
|
</CapLabel>
|
|
416
449
|
</CapRow>
|
|
417
450
|
</>
|
|
@@ -83,4 +83,8 @@ export default defineMessages({
|
|
|
83
83
|
id: `${prefix}.btnDisabledTooltip`,
|
|
84
84
|
defaultMessage: 'Please add all mandatory fields to proceed further',
|
|
85
85
|
},
|
|
86
|
+
tagLengthWarning: {
|
|
87
|
+
id: `${prefix}.tagLengthWarning`,
|
|
88
|
+
defaultMessage: "If the character count of the tag value exceeds {maxLength}, the campaign will fail.",
|
|
89
|
+
},
|
|
86
90
|
});
|