Skip to content

Commit 1f023ad

Browse files
committed
LYNX-759: Fix for copy-pasted rules containing whitespaces characters
1 parent e0bb70e commit 1f023ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

blocks/targeted-block/condition-matcher.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function rulesMatched(activeRules, rules) {
2-
return activeRules && rules.some((rule) => activeRules.includes(rule));
2+
return activeRules && rules.some((rule) => activeRules.includes(rule.trim()));
33
}
44

55
const groupMatched = (activeGroup, groups) => groups.includes(activeGroup);
@@ -13,14 +13,14 @@ export default function conditionsMatched(activeRules, blockConfig) {
1313
} = blockConfig;
1414

1515
const activeSegments = activeRules.customerSegments?.map(
16-
(segment) => segment.name,
16+
(segment) => segment.name.trim(),
1717
);
18-
const activeGroup = activeRules.customerGroup?.name;
18+
const activeGroup = activeRules.customerGroup?.name.trim();
1919
const activeCartRules = activeRules.cart?.map(
20-
(rule) => rule.name,
20+
(rule) => rule.name.trim(),
2121
);
2222
const activePriceRules = activeRules.catalogPriceRules?.rules?.map(
23-
(rule) => rule.name,
23+
(rule) => rule.name.trim(),
2424
);
2525

2626
if (customerSegments !== undefined && !rulesMatched(activeSegments, customerSegments.split(','))) {

0 commit comments

Comments
 (0)