@nosto/search-js 3.1.1 → 3.2.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/dist/BaseElement-Ds4INJSy.cjs +1 -0
- package/dist/BaseElement-fZSwbg09.js +17 -0
- package/dist/{InfiniteScrollWithObserver-B6k7NAW1.js → InfiniteScrollWithObserver-BsydJKFj.js} +61 -63
- package/dist/InfiniteScrollWithObserver-wzwXCrZ7.cjs +1 -0
- package/dist/baseConfig-CTN0CcW-.js +48 -0
- package/dist/baseConfig-KREDcxnC.cjs +1 -0
- package/dist/core/core.cjs.js +1 -1
- package/dist/core/core.es.js +6 -6
- package/dist/currencies/currencies.cjs.js +1 -1
- package/dist/currencies/currencies.es.js +32 -32
- package/dist/eventBusSubscribe-B75y7otR.cjs +1 -0
- package/dist/eventBusSubscribe-Cxw0xUAm.js +25 -0
- package/dist/{unique-m1TIDWdl.js → isBot-C58Y7eiv.js} +12 -36
- package/dist/{unique-Blp-K9zG.cjs → isBot-CheH1DcZ.cjs} +1 -1
- package/dist/preact/autocomplete/autocomplete.cjs.js +1 -0
- package/dist/preact/autocomplete/autocomplete.d.ts +5 -0
- package/dist/preact/autocomplete/autocomplete.es.js +49 -0
- package/dist/preact/{src/config/pages/autocomplete/config.d.ts → autocomplete/src/AutocompleteConfig.d.ts} +5 -5
- package/dist/preact/{src/config/pages/autocomplete/provider.d.ts → autocomplete/src/AutocompletePageProvider.d.ts} +2 -2
- package/dist/preact/{src → autocomplete/src}/components/AutocompleteElement.d.ts +2 -2
- package/dist/preact/category/category.cjs.js +1 -0
- package/dist/preact/category/category.d.ts +3 -0
- package/dist/preact/category/category.es.js +25 -0
- package/dist/preact/{src/config/pages/category/config.d.ts → category/src/CategoryConfig.d.ts} +5 -5
- package/dist/preact/{src/config/pages/category/provider.d.ts → category/src/CategoryPageProvider.d.ts} +2 -2
- package/dist/preact/common/common.cjs.js +1 -0
- package/dist/preact/{common.d.ts → common/common.d.ts} +3 -3
- package/dist/preact/{common.es.js → common/common.es.js} +6 -6
- package/dist/preact/{src → common/src}/actions/newSearch.d.ts +2 -2
- package/dist/preact/{src → common/src}/actions/replaceFilter.d.ts +1 -1
- package/dist/preact/{src → common/src}/actions/toggleProductFilter.d.ts +1 -1
- package/dist/preact/{src → common/src}/actions/updateSearch.d.ts +2 -2
- package/dist/preact/{src/search/defaults.d.ts → common/src/actions/withDefaultQuery.d.ts} +2 -4
- package/dist/preact/{src/config/base → common/src/config}/baseConfig.d.ts +1 -2
- package/dist/preact/common/src/config/config.d.ts +4 -0
- package/dist/preact/common/src/config/configContext.d.ts +6 -0
- package/dist/preact/common/src/store/components/StoreActionsListener.d.ts +1 -0
- package/dist/preact/{src/api → common/src}/types.d.ts +6 -0
- package/dist/preact/events/events.cjs.js +1 -0
- package/dist/preact/events/events.d.ts +3 -0
- package/dist/preact/events/events.es.js +23 -0
- package/dist/preact/events/src/eventBusDispatch.d.ts +10 -0
- package/dist/preact/events/src/eventBusSubscribe.d.ts +8 -0
- package/dist/preact/events/src/types.d.ts +26 -0
- package/dist/preact/hooks/hooks.cjs.js +1 -0
- package/dist/preact/hooks/hooks.d.ts +18 -0
- package/dist/preact/hooks/hooks.es.js +414 -0
- package/dist/preact/{src/hooks → hooks/src}/useNostoAppState.d.ts +1 -1
- package/dist/preact/legacy/legacy.cjs.js +1 -0
- package/dist/preact/legacy/legacy.d.ts +6 -0
- package/dist/preact/legacy/legacy.es.js +10 -0
- package/dist/preact/serp/serp.cjs.js +1 -0
- package/dist/preact/serp/serp.d.ts +4 -0
- package/dist/preact/serp/serp.es.js +39 -0
- package/dist/preact/{src/config/pages/serp/config.d.ts → serp/src/SerpConfig.d.ts} +5 -5
- package/dist/preact/{src/config/pages/serp/provider.d.ts → serp/src/SerpPageProvider.d.ts} +2 -2
- package/dist/preact/{src → serp/src}/components/SerpElement.d.ts +2 -2
- package/dist/search-DweKaGAI.js +162 -0
- package/dist/search-sG5OjNAe.cjs +1 -0
- package/dist/thumbnails/thumbnails.cjs.js +1 -1
- package/dist/thumbnails/thumbnails.es.js +26 -27
- package/dist/unique-3gEanSFU.cjs +1 -0
- package/dist/unique-DxrT0M20.js +39 -0
- package/dist/useActions-B-wWOcHo.cjs +1 -0
- package/dist/useActions-BIIcXXS6.js +229 -0
- package/dist/useLoadMore-BWgWw24W.cjs +1 -0
- package/dist/useLoadMore-Dw7GDu8a.js +31 -0
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +24 -24
- package/package.json +45 -39
- package/dist/BaseElement-B0hSjDTT.cjs +0 -1
- package/dist/BaseElement-IyqEeIiJ.js +0 -18
- package/dist/InfiniteScrollWithObserver-DtlqmHSY.cjs +0 -1
- package/dist/baseConfig-BFFqFSg5.cjs +0 -1
- package/dist/baseConfig-Bafl02NY.js +0 -21
- package/dist/configContext-BR7w4VlU.cjs +0 -1
- package/dist/configContext-GuZOIX3o.js +0 -63
- package/dist/deepMerge-CZwCJzEe.js +0 -17
- package/dist/deepMerge-lDscDfII.cjs +0 -1
- package/dist/preact/autocomplete.cjs.js +0 -1
- package/dist/preact/autocomplete.d.ts +0 -5
- package/dist/preact/autocomplete.es.js +0 -46
- package/dist/preact/category.cjs.js +0 -1
- package/dist/preact/category.d.ts +0 -3
- package/dist/preact/category.es.js +0 -22
- package/dist/preact/common.cjs.js +0 -1
- package/dist/preact/hooks.cjs.js +0 -1
- package/dist/preact/hooks.d.ts +0 -18
- package/dist/preact/hooks.es.js +0 -453
- package/dist/preact/legacy.cjs.js +0 -1
- package/dist/preact/legacy.d.ts +0 -6
- package/dist/preact/legacy.es.js +0 -9
- package/dist/preact/preact.d.ts +0 -30
- package/dist/preact/serp.cjs.js +0 -1
- package/dist/preact/serp.d.ts +0 -4
- package/dist/preact/serp.es.js +0 -36
- package/dist/preact/src/actions/types.d.ts +0 -6
- package/dist/preact/src/config/config.d.ts +0 -4
- package/dist/preact/src/config/configContext.d.ts +0 -6
- package/dist/search-Bhebxu8K.cjs +0 -1
- package/dist/search-BrR80UbS.js +0 -164
- package/dist/useLoadMore-CeqFdxt1.cjs +0 -1
- package/dist/useLoadMore-FglaJn2W.js +0 -204
- /package/dist/preact/{src → autocomplete/src}/components/SearchInput.d.ts +0 -0
- /package/dist/preact/{src/components → autocomplete/src}/types.d.ts +0 -0
- /package/dist/preact/{src → common/src}/components/BaseElement.d.ts +0 -0
- /package/dist/preact/{src → common/src}/components/InfiniteScroll/InfiniteScroll.d.ts +0 -0
- /package/dist/preact/{src → common/src}/components/InfiniteScroll/InfiniteScrollWithLink.d.ts +0 -0
- /package/dist/preact/{src → common/src}/components/InfiniteScroll/InfiniteScrollWithObserver.d.ts +0 -0
- /package/dist/preact/{src → common/src}/components/InfiniteScroll/LoadMoreLink.d.ts +0 -0
- /package/dist/preact/{src → common/src}/components/InfiniteScroll/utils.d.ts +0 -0
- /package/dist/preact/{src → common/src/store}/store.d.ts +0 -0
- /package/dist/preact/{src → common/src/store}/storeContext.d.ts +0 -0
- /package/dist/preact/{src → common/src/store}/storeExtensions.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/types.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useActions.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useCheckClientScript.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useDecoratedSearchResults.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useFacet.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useFacets.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useLoadMore/getNextPageQuery.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useLoadMore/useLoadMore.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/usePagination.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/usePersonalization.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useProductFilters/useProductFilters.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useProductFilters/useProductFiltersUtils.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useRange.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useRangeSelector.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useResponse.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSelectedFiltersCount.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSizeOptions.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSort/useSort.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSort/utils.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSpeechToText.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSwatches/aggregateSwatches.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSwatches/applySelectionStates.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSwatches/sortOptions.d.ts +0 -0
- /package/dist/preact/{src/hooks → hooks/src}/useSwatches/useSwatches.d.ts +0 -0
package/dist/search-BrR80UbS.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { s as N } from "./index.es-B8mbAxS4.js";
|
|
2
|
-
import { l, i as R } from "./logger-DVwg4Wor.js";
|
|
3
|
-
async function T(t, { hitDecorators: e, ...n }, s) {
|
|
4
|
-
var o, i;
|
|
5
|
-
const r = await s(t, n);
|
|
6
|
-
if (!((i = (o = r.products) == null ? void 0 : o.hits) != null && i.length) || !(e != null && e.length))
|
|
7
|
-
return r;
|
|
8
|
-
const c = (a) => e.reduce((u, f) => f(u), a);
|
|
9
|
-
return {
|
|
10
|
-
...r,
|
|
11
|
-
products: {
|
|
12
|
-
...r.products,
|
|
13
|
-
hits: r.products.hits.map(c)
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function z(t, e, n) {
|
|
18
|
-
const s = JSON.stringify(e);
|
|
19
|
-
try {
|
|
20
|
-
n.setItem(t, s);
|
|
21
|
-
} catch (r) {
|
|
22
|
-
l.warn(r);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function O(t, e) {
|
|
26
|
-
try {
|
|
27
|
-
const n = e.getItem(t);
|
|
28
|
-
if (n)
|
|
29
|
-
return JSON.parse(n);
|
|
30
|
-
} catch (n) {
|
|
31
|
-
l.warn(n);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function E(t, e) {
|
|
35
|
-
z(t, e, sessionStorage);
|
|
36
|
-
}
|
|
37
|
-
function J(t) {
|
|
38
|
-
return O(t, sessionStorage);
|
|
39
|
-
}
|
|
40
|
-
const b = "nosto:search-js:cache", k = 60 * 1e3;
|
|
41
|
-
function I(t, e) {
|
|
42
|
-
E(b, { query: t, result: e, created: Date.now() });
|
|
43
|
-
}
|
|
44
|
-
function M(t) {
|
|
45
|
-
const e = J(b);
|
|
46
|
-
if (!e || !V(e))
|
|
47
|
-
return null;
|
|
48
|
-
const n = C(e.query);
|
|
49
|
-
return !R(C(t), n) || Date.now() - e.created > k ? null : e.result;
|
|
50
|
-
}
|
|
51
|
-
function C(t) {
|
|
52
|
-
const e = {
|
|
53
|
-
...t,
|
|
54
|
-
time: void 0,
|
|
55
|
-
products: {
|
|
56
|
-
...t.products,
|
|
57
|
-
size: void 0
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
return JSON.parse(JSON.stringify(e));
|
|
61
|
-
}
|
|
62
|
-
function V(t) {
|
|
63
|
-
return typeof t == "object" && t !== null && "query" in t && "result" in t && "created" in t;
|
|
64
|
-
}
|
|
65
|
-
async function W(t, { usePersistentCache: e, ...n }, s) {
|
|
66
|
-
if (!e)
|
|
67
|
-
return s(t, n);
|
|
68
|
-
const r = await j(t, n, s);
|
|
69
|
-
return I(t, r), r;
|
|
70
|
-
}
|
|
71
|
-
async function j(t, e, n) {
|
|
72
|
-
var h, g, m, S, w, y;
|
|
73
|
-
const { from: s = 0, size: r = 0 } = t.products || {}, c = M(t);
|
|
74
|
-
if (!c)
|
|
75
|
-
return await n(t, e);
|
|
76
|
-
const o = ((h = c == null ? void 0 : c.products) == null ? void 0 : h.size) ?? 0, i = ((g = c == null ? void 0 : c.products) == null ? void 0 : g.hits) ?? [];
|
|
77
|
-
if (r === o)
|
|
78
|
-
return c;
|
|
79
|
-
if (r < o)
|
|
80
|
-
return {
|
|
81
|
-
...c,
|
|
82
|
-
products: {
|
|
83
|
-
...c.products,
|
|
84
|
-
size: r,
|
|
85
|
-
hits: i.slice(0, r),
|
|
86
|
-
total: ((m = c.products) == null ? void 0 : m.total) || 0
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const a = r - i.length, u = s > 0 ? s + 1 : r - a, f = {
|
|
90
|
-
...t,
|
|
91
|
-
products: {
|
|
92
|
-
...t.products,
|
|
93
|
-
from: u,
|
|
94
|
-
size: a
|
|
95
|
-
}
|
|
96
|
-
}, p = await n(f, e);
|
|
97
|
-
return {
|
|
98
|
-
...c,
|
|
99
|
-
products: {
|
|
100
|
-
...c.products,
|
|
101
|
-
size: r,
|
|
102
|
-
hits: [...((S = c.products) == null ? void 0 : S.hits) || [], ...((w = p.products) == null ? void 0 : w.hits) || []],
|
|
103
|
-
total: ((y = p.products) == null ? void 0 : y.total) || 0
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
const x = 3e4, d = /* @__PURE__ */ new Map();
|
|
108
|
-
function A(t, e) {
|
|
109
|
-
const n = d.get(t);
|
|
110
|
-
if (!n) return;
|
|
111
|
-
const s = Date.now() - n.created > x, r = R(e, n.query);
|
|
112
|
-
if (s || !r) {
|
|
113
|
-
d.delete(t);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
return n.result;
|
|
117
|
-
}
|
|
118
|
-
function K(t, e, n) {
|
|
119
|
-
d.set(t, {
|
|
120
|
-
query: e,
|
|
121
|
-
result: n,
|
|
122
|
-
created: Date.now()
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
async function L(t, e, n) {
|
|
126
|
-
if (!e.useMemoryCache)
|
|
127
|
-
return n(t, e);
|
|
128
|
-
const s = JSON.stringify(t), r = A(s, t);
|
|
129
|
-
if (r) return r;
|
|
130
|
-
const c = await n(t, e);
|
|
131
|
-
return K(s, t, c), c;
|
|
132
|
-
}
|
|
133
|
-
function P(t) {
|
|
134
|
-
return new Promise((e) => setTimeout(e, t));
|
|
135
|
-
}
|
|
136
|
-
async function _(t, { maxRetries: e = 0, retryInterval: n = 0, ...s }, r) {
|
|
137
|
-
let c = 0;
|
|
138
|
-
for (; ; )
|
|
139
|
-
try {
|
|
140
|
-
return await r(t, s);
|
|
141
|
-
} catch (o) {
|
|
142
|
-
if (c >= e)
|
|
143
|
-
throw o;
|
|
144
|
-
if (!F(o))
|
|
145
|
-
throw l.info("Skipping retry logic for", o), o;
|
|
146
|
-
c++, await P(n);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function F(t) {
|
|
150
|
-
return !t || typeof t != "object" ? !1 : !("status" in t) || G(t.status);
|
|
151
|
-
}
|
|
152
|
-
function G(t) {
|
|
153
|
-
return typeof t == "number" && (t < 400 || t >= 500);
|
|
154
|
-
}
|
|
155
|
-
async function v(t, e = {}) {
|
|
156
|
-
const n = await new Promise(N);
|
|
157
|
-
return H(n.search, _, L, W, T)(t, e);
|
|
158
|
-
}
|
|
159
|
-
function H(t, ...e) {
|
|
160
|
-
return e.reduce((n, s) => (r, c) => s(r, c, n), t);
|
|
161
|
-
}
|
|
162
|
-
export {
|
|
163
|
-
v as s
|
|
164
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const y=require("./configContext-BR7w4VlU.cjs"),n=require("preact/hooks"),q=require("./search-Bhebxu8K.cjs"),g=require("./unique-Blp-K9zG.cjs"),h=require("./deepMerge-lDscDfII.cjs"),v=require("./logger-BcHMZObS.cjs");function T(e,t){return{...t,products:{facets:e==="autocomplete"?void 0:["*"],fields:A,...t.products},...t.keywords?{keywords:{...t.keywords,fields:g.unique([...I,...t.keywords.fields??[]]),highlight:t.keywords.highlight??{preTag:"<strong>",postTag:"</strong>"}}}:{}}}const A=["productId","url","name","imageUrl","imageHash","thumbUrl","description","brand","variantId","availability","price","priceText","categoryIds","categories","customFields.key","customFields.value","priceCurrencyCode","datePublished","listPrice","unitPricingBaseMeasure","unitPricingUnit","unitPricingMeasure","googleCategory","gtin","ageGroup","gender","condition","alternateImageUrls","ratingValue","reviewCount","inventoryLevel","skus.id","skus.name","skus.price","skus.listPrice","skus.priceText","skus.url","skus.imageUrl","skus.inventoryLevel","skus.customFields.key","skus.customFields.value","skus.availability","pid","onDiscount","extra.key","extra.value","saleable","available","tags1","tags2","tags3"],I=["keyword","_redirect"];async function k(e,t,r){var d,l,m,S,C,w,b;const o=g.measure("newSearch"),c=e.config.pageType,u=c==="search"?"serp":c,a=h.deepMerge(e.store.getInitialState().query,t),s=h.deepMerge(e.config.search,r,{track:u,redirect:c!=="autocomplete",isKeyword:!!(r!=null&&r.isKeyword),usePersistentCache:e.config.pageType!=="autocomplete"&&e.config.persistentSearchCache,useMemoryCache:e.config.pageType==="autocomplete"&&e.config.memoryCache});(l=(d=e.config).onBeforeSearch)==null||l.call(d,e,s),e.store.updateState({query:a,loading:!0,initialized:!0});const i=e.config.queryModifications({...a,products:{...a.products,filter:g.mergeArrays((S=(m=e.store.getInitialState().query)==null?void 0:m.products)==null?void 0:S.filter,(C=t.products)==null?void 0:C.filter)}},c);try{const p=await q.search(T(e.config.pageType,i),s);e.store.updateState({response:p,loading:!1})}catch(p){v.logger.error("Search action failed",p),(b=(w=e.config).onSearchError)==null||b.call(w,p,i,s,c)}o()}async function f(e,t,r){const o=g.measure("updateSearch"),c=h.deepMerge(e.store.getState().query,{products:{from:0}},t);await k(e,c,r),o()}function P(e=Q){const t=n.useContext(y.StoreContext),[r,o]=n.useState(e(t.getState()));return t.onChange(e,o),n.useEffect(()=>()=>t.clearOnChange(o),[t]),r}const Q=e=>e;async function U(e,t,r){var a;const o=g.measure("replaceFilter"),c=(a=e.store.getState().query.products)==null?void 0:a.filter,u=r!==void 0?[{field:t,[typeof r=="object"?"range":"value"]:[r]}]:[];await f(e,{products:{filter:[...(c==null?void 0:c.filter(s=>s.field!==t))??[],...u]}}),o()}async function L(e,t,r,o){var i,d;const c=g.measure("toggleProductFilter"),u=(i=e.store.getState().query.products)==null?void 0:i.filter,a=u==null?void 0:u.find(l=>l.value instanceof Array&&l.field===t),s=a!=null&&a.value?{...a,value:[...a.value.filter(l=>!v.isEqual(l,r)),...o?[r]:[]]}:o?{field:t,value:[r]}:void 0;await f(e,{products:{filter:[...(u==null?void 0:u.filter(l=>l!==a))??[],...(d=s==null?void 0:s.value)!=null&&d.length?[s]:[]]}}),c()}function F(){const e=y.useConfig(),t=n.useContext(y.StoreContext),r=n.useMemo(()=>({config:e,store:t}),[e,t]),o=n.useCallback((s,i)=>k(r,s,i),[r]),c=n.useCallback((s,i)=>f(r,s,i),[r]),u=n.useCallback((s,i,d)=>L(r,s,i,d),[r]),a=n.useCallback((s,i)=>U(r,s,i),[r]);return{newSearch:o,updateSearch:c,toggleProductFilter:u,replaceFilter:a}}function M({from:e,size:t,pageSize:r}){return g.isBot()?{products:{from:e+r}}:{products:{size:t+r}}}function N(e=24){const{from:t,size:r}=P(u=>{var a,s;return{from:((a=u.query.products)==null?void 0:a.from)??0,size:((s=u.query.products)==null?void 0:s.size)??0}}),{updateSearch:o}=F();return{loadMore:n.useCallback(async()=>{await o(M({from:t,size:r,pageSize:e}))},[t,r,e,o])}}exports.getNextPageQuery=M;exports.newSearch=k;exports.updateSearch=f;exports.useActions=F;exports.useLoadMore=N;exports.useNostoAppState=P;
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { S as C, u as F } from "./configContext-GuZOIX3o.js";
|
|
2
|
-
import { useContext as v, useState as P, useEffect as M, useMemo as T, useCallback as d } from "preact/hooks";
|
|
3
|
-
import { s as I } from "./search-BrR80UbS.js";
|
|
4
|
-
import { u as q, a as p, m as Q, i as U } from "./unique-m1TIDWdl.js";
|
|
5
|
-
import { d as f } from "./deepMerge-CZwCJzEe.js";
|
|
6
|
-
import { l as A, i as z } from "./logger-DVwg4Wor.js";
|
|
7
|
-
function B(e, t) {
|
|
8
|
-
return {
|
|
9
|
-
...t,
|
|
10
|
-
products: {
|
|
11
|
-
facets: e === "autocomplete" ? void 0 : ["*"],
|
|
12
|
-
fields: E,
|
|
13
|
-
...t.products
|
|
14
|
-
},
|
|
15
|
-
...t.keywords ? {
|
|
16
|
-
keywords: {
|
|
17
|
-
...t.keywords,
|
|
18
|
-
fields: q([...K, ...t.keywords.fields ?? []]),
|
|
19
|
-
highlight: t.keywords.highlight ?? {
|
|
20
|
-
preTag: "<strong>",
|
|
21
|
-
postTag: "</strong>"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} : {}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const E = [
|
|
28
|
-
"productId",
|
|
29
|
-
"url",
|
|
30
|
-
"name",
|
|
31
|
-
"imageUrl",
|
|
32
|
-
"imageHash",
|
|
33
|
-
"thumbUrl",
|
|
34
|
-
"description",
|
|
35
|
-
"brand",
|
|
36
|
-
"variantId",
|
|
37
|
-
"availability",
|
|
38
|
-
"price",
|
|
39
|
-
"priceText",
|
|
40
|
-
"categoryIds",
|
|
41
|
-
"categories",
|
|
42
|
-
"customFields.key",
|
|
43
|
-
"customFields.value",
|
|
44
|
-
"priceCurrencyCode",
|
|
45
|
-
"datePublished",
|
|
46
|
-
"listPrice",
|
|
47
|
-
"unitPricingBaseMeasure",
|
|
48
|
-
"unitPricingUnit",
|
|
49
|
-
"unitPricingMeasure",
|
|
50
|
-
"googleCategory",
|
|
51
|
-
"gtin",
|
|
52
|
-
"ageGroup",
|
|
53
|
-
"gender",
|
|
54
|
-
"condition",
|
|
55
|
-
"alternateImageUrls",
|
|
56
|
-
"ratingValue",
|
|
57
|
-
"reviewCount",
|
|
58
|
-
"inventoryLevel",
|
|
59
|
-
"skus.id",
|
|
60
|
-
"skus.name",
|
|
61
|
-
"skus.price",
|
|
62
|
-
"skus.listPrice",
|
|
63
|
-
"skus.priceText",
|
|
64
|
-
"skus.url",
|
|
65
|
-
"skus.imageUrl",
|
|
66
|
-
"skus.inventoryLevel",
|
|
67
|
-
"skus.customFields.key",
|
|
68
|
-
"skus.customFields.value",
|
|
69
|
-
"skus.availability",
|
|
70
|
-
"pid",
|
|
71
|
-
"onDiscount",
|
|
72
|
-
"extra.key",
|
|
73
|
-
"extra.value",
|
|
74
|
-
"saleable",
|
|
75
|
-
"available",
|
|
76
|
-
"tags1",
|
|
77
|
-
"tags2",
|
|
78
|
-
"tags3"
|
|
79
|
-
], K = ["keyword", "_redirect"];
|
|
80
|
-
async function b(e, t, r) {
|
|
81
|
-
var l, n, m, h, k, S, w;
|
|
82
|
-
const o = p("newSearch"), i = e.config.pageType, c = i === "search" ? "serp" : i, a = f(e.store.getInitialState().query, t), s = f(e.config.search, r, {
|
|
83
|
-
track: c,
|
|
84
|
-
redirect: i !== "autocomplete",
|
|
85
|
-
isKeyword: !!(r != null && r.isKeyword),
|
|
86
|
-
usePersistentCache: e.config.pageType !== "autocomplete" && e.config.persistentSearchCache,
|
|
87
|
-
useMemoryCache: e.config.pageType === "autocomplete" && e.config.memoryCache
|
|
88
|
-
});
|
|
89
|
-
(n = (l = e.config).onBeforeSearch) == null || n.call(l, e, s), e.store.updateState({
|
|
90
|
-
query: a,
|
|
91
|
-
loading: !0,
|
|
92
|
-
initialized: !0
|
|
93
|
-
});
|
|
94
|
-
const u = e.config.queryModifications(
|
|
95
|
-
{
|
|
96
|
-
...a,
|
|
97
|
-
products: {
|
|
98
|
-
...a.products,
|
|
99
|
-
// Apply filter merging to avoid overwriting base filters
|
|
100
|
-
filter: Q((h = (m = e.store.getInitialState().query) == null ? void 0 : m.products) == null ? void 0 : h.filter, (k = t.products) == null ? void 0 : k.filter)
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
i
|
|
104
|
-
);
|
|
105
|
-
try {
|
|
106
|
-
const g = await I(B(e.config.pageType, u), s);
|
|
107
|
-
e.store.updateState({
|
|
108
|
-
response: g,
|
|
109
|
-
loading: !1
|
|
110
|
-
});
|
|
111
|
-
} catch (g) {
|
|
112
|
-
A.error("Search action failed", g), (w = (S = e.config).onSearchError) == null || w.call(S, g, u, s, i);
|
|
113
|
-
}
|
|
114
|
-
o();
|
|
115
|
-
}
|
|
116
|
-
async function y(e, t, r) {
|
|
117
|
-
const o = p("updateSearch"), i = f(e.store.getState().query, { products: { from: 0 } }, t);
|
|
118
|
-
await b(e, i, r), o();
|
|
119
|
-
}
|
|
120
|
-
function L(e = D) {
|
|
121
|
-
const t = v(C), [r, o] = P(e(t.getState()));
|
|
122
|
-
return t.onChange(e, o), M(() => () => t.clearOnChange(o), [t]), r;
|
|
123
|
-
}
|
|
124
|
-
const D = (e) => e;
|
|
125
|
-
async function N(e, t, r) {
|
|
126
|
-
var a;
|
|
127
|
-
const o = p("replaceFilter"), i = (a = e.store.getState().query.products) == null ? void 0 : a.filter, c = r !== void 0 ? [{ field: t, [typeof r == "object" ? "range" : "value"]: [r] }] : [];
|
|
128
|
-
await y(e, {
|
|
129
|
-
products: {
|
|
130
|
-
filter: [...(i == null ? void 0 : i.filter((s) => s.field !== t)) ?? [], ...c]
|
|
131
|
-
}
|
|
132
|
-
}), o();
|
|
133
|
-
}
|
|
134
|
-
async function O(e, t, r, o) {
|
|
135
|
-
var u, l;
|
|
136
|
-
const i = p("toggleProductFilter"), c = (u = e.store.getState().query.products) == null ? void 0 : u.filter, a = c == null ? void 0 : c.find((n) => n.value instanceof Array && n.field === t), s = a != null && a.value ? {
|
|
137
|
-
...a,
|
|
138
|
-
value: [...a.value.filter((n) => !z(n, r)), ...o ? [r] : []]
|
|
139
|
-
} : o ? {
|
|
140
|
-
field: t,
|
|
141
|
-
value: [r]
|
|
142
|
-
} : void 0;
|
|
143
|
-
await y(e, {
|
|
144
|
-
products: {
|
|
145
|
-
filter: [...(c == null ? void 0 : c.filter((n) => n !== a)) ?? [], ...(l = s == null ? void 0 : s.value) != null && l.length ? [s] : []]
|
|
146
|
-
}
|
|
147
|
-
}), i();
|
|
148
|
-
}
|
|
149
|
-
function j() {
|
|
150
|
-
const e = F(), t = v(C), r = T(
|
|
151
|
-
() => ({
|
|
152
|
-
config: e,
|
|
153
|
-
store: t
|
|
154
|
-
}),
|
|
155
|
-
[e, t]
|
|
156
|
-
), o = d(
|
|
157
|
-
(s, u) => b(r, s, u),
|
|
158
|
-
[r]
|
|
159
|
-
), i = d(
|
|
160
|
-
(s, u) => y(r, s, u),
|
|
161
|
-
[r]
|
|
162
|
-
), c = d(
|
|
163
|
-
(s, u, l) => O(r, s, u, l),
|
|
164
|
-
[r]
|
|
165
|
-
), a = d(
|
|
166
|
-
(s, u) => N(r, s, u),
|
|
167
|
-
[r]
|
|
168
|
-
);
|
|
169
|
-
return {
|
|
170
|
-
newSearch: o,
|
|
171
|
-
updateSearch: i,
|
|
172
|
-
toggleProductFilter: c,
|
|
173
|
-
replaceFilter: a
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function G({ from: e, size: t, pageSize: r }) {
|
|
177
|
-
return U() ? {
|
|
178
|
-
products: { from: e + r }
|
|
179
|
-
} : {
|
|
180
|
-
products: { size: t + r }
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
function X(e = 24) {
|
|
184
|
-
const { from: t, size: r } = L((c) => {
|
|
185
|
-
var a, s;
|
|
186
|
-
return {
|
|
187
|
-
from: ((a = c.query.products) == null ? void 0 : a.from) ?? 0,
|
|
188
|
-
size: ((s = c.query.products) == null ? void 0 : s.size) ?? 0
|
|
189
|
-
};
|
|
190
|
-
}), { updateSearch: o } = j();
|
|
191
|
-
return {
|
|
192
|
-
loadMore: d(async () => {
|
|
193
|
-
await o(G({ from: t, size: r, pageSize: e }));
|
|
194
|
-
}, [t, r, e, o])
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
export {
|
|
198
|
-
X as a,
|
|
199
|
-
L as b,
|
|
200
|
-
j as c,
|
|
201
|
-
G as g,
|
|
202
|
-
b as n,
|
|
203
|
-
y as u
|
|
204
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/preact/{src → common/src}/components/InfiniteScroll/InfiniteScrollWithLink.d.ts
RENAMED
|
File without changes
|
/package/dist/preact/{src → common/src}/components/InfiniteScroll/InfiniteScrollWithObserver.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|