@factorypure/client-helpers 1.0.7 → 1.0.9
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 +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { subDays } from "date-fns";
|
|
1
|
+
import { startOfDay, subDays } from "date-fns";
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
import { Index } from "flexsearch";
|
|
4
4
|
// @ts-ignore
|
|
@@ -107,7 +107,7 @@ const handleIndexSearch = (dataToSearch, filters, variant, filterOptions) => {
|
|
|
107
107
|
const nots = [];
|
|
108
108
|
if (filters.skip_skus.length && filterOptions.skip_skus_enabled) {
|
|
109
109
|
const formatted = filters.skip_skus
|
|
110
|
-
.filter((sku) => sku.toLowerCase() !== sku.toLowerCase())
|
|
110
|
+
.filter((sku) => sku.toLowerCase() !== variant.sku.toLowerCase())
|
|
111
111
|
.map((sku) => ` ${sku} `);
|
|
112
112
|
nots.push(...formatted);
|
|
113
113
|
}
|
|
@@ -131,7 +131,7 @@ const handleIndexSearch = (dataToSearch, filters, variant, filterOptions) => {
|
|
|
131
131
|
}
|
|
132
132
|
if (filters.vendor_search_exclusions.length &&
|
|
133
133
|
filterOptions.skip_skus_enabled) {
|
|
134
|
-
nots.push(...filters.vendor_search_exclusions.filter((sku) => sku.toLowerCase() !== sku.toLowerCase()));
|
|
134
|
+
nots.push(...filters.vendor_search_exclusions.filter((sku) => sku.toLowerCase() !== variant.sku.toLowerCase()));
|
|
135
135
|
}
|
|
136
136
|
if (title.toLowerCase().includes("dual fuel")) {
|
|
137
137
|
// nots.push('tri fuel', 'trifuel', 'tri-fuel')
|
|
@@ -240,7 +240,7 @@ const filterDateWindow = (results, dayWindow) => {
|
|
|
240
240
|
if (!dayWindow)
|
|
241
241
|
return true;
|
|
242
242
|
const itemDate = new Date(item.created_at);
|
|
243
|
-
const variantDate = subDays(new Date(), Number(dayWindow) || 7);
|
|
243
|
+
const variantDate = startOfDay(subDays(new Date(), Number(dayWindow) || 7));
|
|
244
244
|
return itemDate >= variantDate;
|
|
245
245
|
});
|
|
246
246
|
return filtered;
|