@factorypure/client-helpers 1.0.4 → 1.0.5
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/dist/index.js +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -183,8 +183,18 @@ const handleIndexSearch = (dataToSearch, filters, variant, filterOptions) => {
|
|
|
183
183
|
};
|
|
184
184
|
const filterLinkedElsewhereResults = (results, variantId) => {
|
|
185
185
|
const filtered = results.filter((result) => {
|
|
186
|
-
const
|
|
187
|
-
|
|
186
|
+
const linkedVariantIds = result.linked_variant_ids || [];
|
|
187
|
+
let parsedLinkedVariantIds = linkedVariantIds;
|
|
188
|
+
if (!Array.isArray(linkedVariantIds)) {
|
|
189
|
+
try {
|
|
190
|
+
parsedLinkedVariantIds = JSON.parse(linkedVariantIds);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
parsedLinkedVariantIds = [];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const productLinkedElsewhere = linkedVariantIds.length > 0 &&
|
|
197
|
+
!linkedVariantIds.includes(variantId);
|
|
188
198
|
if (productLinkedElsewhere) {
|
|
189
199
|
return false;
|
|
190
200
|
}
|