fix: normalize campaign product size suffixes
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m44s

This commit is contained in:
Cauê Faleiros
2026-06-01 09:27:54 -03:00
parent b886b357d7
commit a1aa071e1d
5 changed files with 50 additions and 3 deletions

View File

@@ -1,4 +1,11 @@
const getBaseProductName = (name) => String(name || 'Unknown').split(' TAMANHO')[0].trim();
const SIZE_SUFFIX_PATTERN = /\s+-\s+(?:(?:PP|P|M|G|GG|XG|XGG|EG|EGG|EXG|U|UNICO|ÚNICO|\d{2})(?:\/(?:PP|P|M|G|GG|XG|XGG|EG|EGG|EXG|U|UNICO|ÚNICO|\d{2}))*)$/i;
const getBaseProductName = (name) => {
return String(name || 'Unknown')
.split(' TAMANHO')[0]
.replace(SIZE_SUFFIX_PATTERN, '')
.trim();
};
const normalizeStockPayload = (item) => {
const produtoId = item.idProduto || item.ID_Produto || '';