@askdialog/dialog-react 2.4.0 → 2.6.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/README.md +28 -9
- package/dist/components/DialogSearch/DialogSearchCollections.d.ts +10 -0
- package/dist/components/DialogSearch/DialogSearchPagination.d.ts +2 -0
- package/dist/components/DialogSearch/DialogSearchProductCard.d.ts +2 -0
- package/dist/components/DialogSearch/DialogSearchProducts.d.ts +11 -0
- package/dist/components/DialogSearch/DialogSearchResults.d.ts +8 -1
- package/dist/components/DialogSearch/HighlightedTitle.d.ts +7 -0
- package/dist/components/DialogSearch/cssColor.d.ts +3 -0
- package/dist/components/DialogSearch/panelPlacement.d.ts +5 -0
- package/dist/components/DialogSearch/searchCollections.d.ts +6 -0
- package/dist/components/DialogSearch/searchDisplay.d.ts +5 -2
- package/dist/components/DialogSearch/searchMessages.d.ts +14 -0
- package/dist/components/DialogSearch/searchTheme.d.ts +3 -0
- package/dist/components/DialogSearch/titleHighlight.d.ts +6 -0
- package/dist/components/DialogSearch/useAnchorRect.d.ts +6 -1
- package/dist/components/DialogSearch/useDialogSearch.d.ts +15 -6
- package/dist/components/index.d.ts +1 -1
- package/dist/dialog-react.css +1 -1
- package/dist/dialog-react.js +535 -274
- package/dist/dialog-react.umd.cjs +1 -1
- package/dist/icons/ArrowRightIcon.d.ts +2 -0
- package/dist/icons/CaretRightIcon.d.ts +2 -0
- package/package.json +2 -2
package/dist/dialog-react.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { registerDialogInstallation as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
1
|
+
import { jsxs as g, jsx as n, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as b, useState as v, useEffect as m, useMemo as y, useLayoutEffect as j, useCallback as x, useSyncExternalStore as V } from "react";
|
|
3
|
+
import { registerDialogInstallation as D, addAuditCapability as K, resolveTextDirection as F, SearchStatus as L, DialogSearchError as q, createSearchController as z } from "@askdialog/dialog-sdk";
|
|
4
|
+
import { createPortal as U } from "react-dom";
|
|
5
|
+
const W = ({
|
|
6
6
|
title: e = "Your expert",
|
|
7
7
|
description: t = "A question about this product?"
|
|
8
|
-
}) => /* @__PURE__ */
|
|
8
|
+
}) => /* @__PURE__ */ g("div", { className: "dialog-block-header-container", children: [
|
|
9
9
|
/* @__PURE__ */ n("div", { className: "dialog-block-title", children: e }),
|
|
10
10
|
/* @__PURE__ */ n("div", { className: "dialog-block-description", children: t })
|
|
11
|
-
] }),
|
|
11
|
+
] }), Q = ({ color: e = "#181825" }) => /* @__PURE__ */ g(
|
|
12
12
|
"svg",
|
|
13
13
|
{
|
|
14
14
|
width: "20",
|
|
@@ -17,7 +17,7 @@ const H = ({
|
|
|
17
17
|
fill: "none",
|
|
18
18
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
19
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
20
|
+
/* @__PURE__ */ g("g", { clipPath: "url(#clip0_466_934)", children: [
|
|
21
21
|
/* @__PURE__ */ n(
|
|
22
22
|
"path",
|
|
23
23
|
{
|
|
@@ -42,55 +42,55 @@ const H = ({
|
|
|
42
42
|
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("clipPath", { id: "clip0_466_934", children: /* @__PURE__ */ n("rect", { width: "20", height: "20", fill: "white" }) }) })
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
|
-
),
|
|
45
|
+
), Z = ({
|
|
46
46
|
client: e,
|
|
47
47
|
questions: t,
|
|
48
48
|
productId: s,
|
|
49
49
|
productTitle: r,
|
|
50
|
-
selectedVariantId:
|
|
50
|
+
selectedVariantId: o
|
|
51
51
|
}) => {
|
|
52
52
|
const c = (l) => {
|
|
53
53
|
e.sendProductMessage({
|
|
54
54
|
productId: s,
|
|
55
55
|
productTitle: r,
|
|
56
|
-
selectedVariantId:
|
|
56
|
+
selectedVariantId: o,
|
|
57
57
|
question: l,
|
|
58
58
|
fromQuestionSuggestion: !0
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
return /* @__PURE__ */ n(
|
|
61
|
+
return /* @__PURE__ */ n(C, { children: t.map((l) => /* @__PURE__ */ g(
|
|
62
62
|
"button",
|
|
63
63
|
{
|
|
64
64
|
className: "dialog-block-suggestions-item",
|
|
65
65
|
onClick: () => c(l.question),
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */ n(
|
|
67
|
+
/* @__PURE__ */ n(Q, { color: e.theme.primaryColor }),
|
|
68
68
|
/* @__PURE__ */ n("span", { className: "dialog-block-suggestions-item-label", children: l.question })
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
l.question
|
|
72
72
|
)) });
|
|
73
|
-
},
|
|
73
|
+
}, X = () => /* @__PURE__ */ g(C, { children: [
|
|
74
74
|
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
75
75
|
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
76
76
|
/* @__PURE__ */ n("div", { className: "dialog-block-suggestions-skeleton-item" })
|
|
77
|
-
] }),
|
|
77
|
+
] }), G = ({
|
|
78
78
|
client: e,
|
|
79
79
|
questions: t,
|
|
80
80
|
isLoading: s,
|
|
81
81
|
productId: r,
|
|
82
|
-
productTitle:
|
|
82
|
+
productTitle: o,
|
|
83
83
|
selectedVariantId: c
|
|
84
|
-
}) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: s || !t ? /* @__PURE__ */ n(
|
|
85
|
-
|
|
84
|
+
}) => /* @__PURE__ */ n("div", { className: "dialog-block-suggestions-container", children: s || !t ? /* @__PURE__ */ n(X, {}) : /* @__PURE__ */ n(
|
|
85
|
+
Z,
|
|
86
86
|
{
|
|
87
87
|
client: e,
|
|
88
88
|
questions: t,
|
|
89
89
|
productId: r,
|
|
90
|
-
productTitle:
|
|
90
|
+
productTitle: o,
|
|
91
91
|
selectedVariantId: c
|
|
92
92
|
}
|
|
93
|
-
) }),
|
|
93
|
+
) }), Y = ({ color: e = "#ffffff" }) => /* @__PURE__ */ n(
|
|
94
94
|
"svg",
|
|
95
95
|
{
|
|
96
96
|
width: "20",
|
|
@@ -109,14 +109,14 @@ const H = ({
|
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
111
|
}
|
|
112
|
-
),
|
|
112
|
+
), J = ({
|
|
113
113
|
client: e,
|
|
114
114
|
placeholder: t = "Ask anything...",
|
|
115
115
|
productId: s,
|
|
116
116
|
productTitle: r,
|
|
117
|
-
selectedVariantId:
|
|
117
|
+
selectedVariantId: o
|
|
118
118
|
}) => {
|
|
119
|
-
const c =
|
|
119
|
+
const c = b(null), [l, a] = v(""), i = () => {
|
|
120
120
|
var d;
|
|
121
121
|
(d = c.current) == null || d.focus();
|
|
122
122
|
}, u = () => {
|
|
@@ -124,19 +124,19 @@ const H = ({
|
|
|
124
124
|
d.trim() && (e.sendProductMessage({
|
|
125
125
|
productId: s,
|
|
126
126
|
productTitle: r,
|
|
127
|
-
selectedVariantId:
|
|
127
|
+
selectedVariantId: o,
|
|
128
128
|
question: d,
|
|
129
129
|
fromQuestionSuggestion: !0
|
|
130
|
-
}),
|
|
130
|
+
}), a(""));
|
|
131
131
|
};
|
|
132
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ g("div", { className: "dialog-input-wrapper", onClick: i, children: [
|
|
133
133
|
/* @__PURE__ */ n(
|
|
134
134
|
"input",
|
|
135
135
|
{
|
|
136
136
|
id: "dialog-ask-anything-input-ai-input",
|
|
137
137
|
ref: c,
|
|
138
138
|
value: l,
|
|
139
|
-
onChange: (d) =>
|
|
139
|
+
onChange: (d) => a(d.target.value),
|
|
140
140
|
className: "dialog-ask-anything-input-ai-input",
|
|
141
141
|
placeholder: t,
|
|
142
142
|
onKeyDown: (d) => {
|
|
@@ -151,26 +151,26 @@ const H = ({
|
|
|
151
151
|
className: "dialog-input-submit",
|
|
152
152
|
disabled: !l.trim(),
|
|
153
153
|
onClick: u,
|
|
154
|
-
children: /* @__PURE__ */ n(
|
|
154
|
+
children: /* @__PURE__ */ n(Y, { color: e.theme.ctaTextColor })
|
|
155
155
|
}
|
|
156
156
|
)
|
|
157
157
|
] });
|
|
158
|
-
},
|
|
158
|
+
}, E = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), ee = (e) => {
|
|
159
159
|
if (!e) return;
|
|
160
160
|
const t = document.body;
|
|
161
161
|
Object.keys(e).forEach((s) => {
|
|
162
|
-
const r = s,
|
|
162
|
+
const r = s, o = E(s);
|
|
163
163
|
if (e[r] !== void 0) {
|
|
164
164
|
if (typeof e[r] == "object") {
|
|
165
165
|
Object.keys(e[r]).forEach(
|
|
166
166
|
(c) => {
|
|
167
|
-
var
|
|
167
|
+
var a;
|
|
168
168
|
const l = c;
|
|
169
169
|
if (l !== void 0) {
|
|
170
|
-
const
|
|
170
|
+
const i = E(c), u = e[r];
|
|
171
171
|
t.style.setProperty(
|
|
172
|
-
`--dialog-theme-${
|
|
173
|
-
(
|
|
172
|
+
`--dialog-theme-${o}-${i}`,
|
|
173
|
+
(a = u[l]) == null ? void 0 : a.toString()
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -179,85 +179,85 @@ const H = ({
|
|
|
179
179
|
}
|
|
180
180
|
if (r === "ctaBorderType") {
|
|
181
181
|
const c = e[r] === "rounded" ? "24px" : "0";
|
|
182
|
-
t.style.setProperty(`--dialog-theme-${
|
|
182
|
+
t.style.setProperty(`--dialog-theme-${o}`, c);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
t.style.setProperty(
|
|
186
|
-
`--dialog-theme-${
|
|
186
|
+
`--dialog-theme-${o}`,
|
|
187
187
|
e[r].toString()
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
},
|
|
192
|
-
e &&
|
|
193
|
-
}, [e]), /* @__PURE__ */ n(
|
|
191
|
+
}, te = ({ theme: e, children: t }) => (m(() => {
|
|
192
|
+
e && ee(e);
|
|
193
|
+
}, [e]), /* @__PURE__ */ n(C, { children: t })), Fe = ({
|
|
194
194
|
client: e,
|
|
195
195
|
productId: t,
|
|
196
196
|
productTitle: s,
|
|
197
197
|
selectedVariantId: r,
|
|
198
|
-
enableInput:
|
|
198
|
+
enableInput: o = !0
|
|
199
199
|
}) => {
|
|
200
|
-
const [c, l] =
|
|
200
|
+
const [c, l] = v(!0), [a, i] = v(
|
|
201
201
|
void 0
|
|
202
202
|
);
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
m(() => {
|
|
204
|
+
D({
|
|
205
205
|
method: "react",
|
|
206
|
-
version: "2.
|
|
207
|
-
}),
|
|
206
|
+
version: "2.6.0"
|
|
207
|
+
}), K("pdp-block");
|
|
208
208
|
}, []);
|
|
209
|
-
const u =
|
|
210
|
-
() => c ? "" :
|
|
211
|
-
[
|
|
212
|
-
), p =
|
|
213
|
-
() => c ? "" :
|
|
214
|
-
[
|
|
215
|
-
), d =
|
|
216
|
-
() => c ? "" :
|
|
217
|
-
[
|
|
218
|
-
),
|
|
209
|
+
const u = y(
|
|
210
|
+
() => c ? "" : a == null ? void 0 : a.assistantName,
|
|
211
|
+
[a, c]
|
|
212
|
+
), p = y(
|
|
213
|
+
() => c ? "" : a == null ? void 0 : a.description,
|
|
214
|
+
[a, c]
|
|
215
|
+
), d = y(
|
|
216
|
+
() => c ? "" : a == null ? void 0 : a.inputPlaceholder,
|
|
217
|
+
[a, c]
|
|
218
|
+
), f = y(
|
|
219
219
|
() => {
|
|
220
|
-
var
|
|
221
|
-
return
|
|
220
|
+
var h;
|
|
221
|
+
return F((h = e.getLocalizationInformations()) == null ? void 0 : h.languageCode);
|
|
222
222
|
},
|
|
223
223
|
[e]
|
|
224
224
|
);
|
|
225
|
-
return
|
|
226
|
-
let
|
|
225
|
+
return m(() => {
|
|
226
|
+
let h = !0;
|
|
227
227
|
return (async () => {
|
|
228
|
-
l(!0),
|
|
228
|
+
l(!0), i(void 0);
|
|
229
229
|
try {
|
|
230
230
|
const k = await e.getSuggestions(t);
|
|
231
|
-
|
|
231
|
+
h && i(k);
|
|
232
232
|
} catch (k) {
|
|
233
233
|
console.error("error", k);
|
|
234
234
|
} finally {
|
|
235
|
-
|
|
235
|
+
h && l(!1);
|
|
236
236
|
}
|
|
237
237
|
})(), () => {
|
|
238
|
-
|
|
238
|
+
h = !1;
|
|
239
239
|
};
|
|
240
|
-
}, [e, t]), /* @__PURE__ */ n(
|
|
240
|
+
}, [e, t]), /* @__PURE__ */ n(te, { theme: e.theme, children: /* @__PURE__ */ g(
|
|
241
241
|
"div",
|
|
242
242
|
{
|
|
243
243
|
id: "dialog-instant",
|
|
244
244
|
className: "dialog-block-container",
|
|
245
|
-
dir:
|
|
245
|
+
dir: f,
|
|
246
246
|
children: [
|
|
247
|
-
/* @__PURE__ */ n(
|
|
247
|
+
/* @__PURE__ */ n(W, { title: u, description: p }),
|
|
248
248
|
/* @__PURE__ */ n(
|
|
249
|
-
|
|
249
|
+
G,
|
|
250
250
|
{
|
|
251
251
|
client: e,
|
|
252
|
-
questions:
|
|
252
|
+
questions: a == null ? void 0 : a.questions,
|
|
253
253
|
isLoading: c,
|
|
254
254
|
productId: t,
|
|
255
255
|
productTitle: s,
|
|
256
256
|
selectedVariantId: r
|
|
257
257
|
}
|
|
258
258
|
),
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
o && /* @__PURE__ */ n(
|
|
260
|
+
J,
|
|
261
261
|
{
|
|
262
262
|
client: e,
|
|
263
263
|
placeholder: d,
|
|
@@ -269,7 +269,7 @@ const H = ({
|
|
|
269
269
|
]
|
|
270
270
|
}
|
|
271
271
|
) });
|
|
272
|
-
},
|
|
272
|
+
}, re = () => /* @__PURE__ */ n(
|
|
273
273
|
"svg",
|
|
274
274
|
{
|
|
275
275
|
width: 16,
|
|
@@ -289,7 +289,7 @@ const H = ({
|
|
|
289
289
|
}
|
|
290
290
|
)
|
|
291
291
|
}
|
|
292
|
-
),
|
|
292
|
+
), se = "M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z", ne = ({
|
|
293
293
|
color: e = "currentColor"
|
|
294
294
|
}) => /* @__PURE__ */ n(
|
|
295
295
|
"svg",
|
|
@@ -300,32 +300,32 @@ const H = ({
|
|
|
300
300
|
fill: "none",
|
|
301
301
|
xmlns: "http://www.w3.org/2000/svg",
|
|
302
302
|
"aria-hidden": "true",
|
|
303
|
-
children: /* @__PURE__ */ n("path", { d:
|
|
303
|
+
children: /* @__PURE__ */ n("path", { d: se, fill: e })
|
|
304
304
|
}
|
|
305
|
-
),
|
|
305
|
+
), qe = ({
|
|
306
306
|
controller: e,
|
|
307
307
|
placeholder: t = "Search products...",
|
|
308
308
|
autoFocus: s = !1,
|
|
309
309
|
submitAriaLabel: r = "Search"
|
|
310
310
|
}) => {
|
|
311
|
-
const [
|
|
312
|
-
return /* @__PURE__ */
|
|
313
|
-
|
|
311
|
+
const [o, c] = v("");
|
|
312
|
+
return /* @__PURE__ */ g("form", { className: "dialog-search-bar", role: "search", onSubmit: (a) => {
|
|
313
|
+
a.preventDefault(), e.submit(o);
|
|
314
314
|
}, children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(
|
|
315
|
+
/* @__PURE__ */ g("div", { className: "dialog-search-bar-field", children: [
|
|
316
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ n(ne, {}) }),
|
|
317
317
|
/* @__PURE__ */ n(
|
|
318
318
|
"input",
|
|
319
319
|
{
|
|
320
320
|
type: "text",
|
|
321
321
|
name: "dialog-search-query",
|
|
322
322
|
className: "dialog-search-bar-input",
|
|
323
|
-
value:
|
|
323
|
+
value: o,
|
|
324
324
|
"aria-label": t,
|
|
325
325
|
placeholder: t,
|
|
326
326
|
autoFocus: s,
|
|
327
|
-
onChange: (
|
|
328
|
-
c(
|
|
327
|
+
onChange: (a) => {
|
|
328
|
+
c(a.target.value), e.setQuery(a.target.value);
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
)
|
|
@@ -336,294 +336,555 @@ const H = ({
|
|
|
336
336
|
type: "submit",
|
|
337
337
|
className: "dialog-search-bar-submit",
|
|
338
338
|
"aria-label": r,
|
|
339
|
-
children: /* @__PURE__ */ n(
|
|
339
|
+
children: /* @__PURE__ */ n(re, {})
|
|
340
340
|
}
|
|
341
341
|
)
|
|
342
342
|
] });
|
|
343
|
-
},
|
|
343
|
+
}, oe = (e, t) => {
|
|
344
|
+
try {
|
|
345
|
+
return new Intl.NumberFormat(t).format(e);
|
|
346
|
+
} catch {
|
|
347
|
+
return String(e);
|
|
348
|
+
}
|
|
349
|
+
}, A = {
|
|
350
|
+
en: (e) => ({
|
|
351
|
+
searching: (t) => `Searching “${t}”…`,
|
|
352
|
+
noResults: "No matching products",
|
|
353
|
+
retry: "Retry",
|
|
354
|
+
collectionsLabel: "Collections",
|
|
355
|
+
productsLabel: "Products",
|
|
356
|
+
collectionsCount: (t) => t === 1 ? "1 collection" : `${e(t)} collections`,
|
|
357
|
+
resultsCount: (t) => t === 1 ? "1 result" : `${e(t)} results`,
|
|
358
|
+
seeAllLabel: (t) => t === 1 ? "See the result" : `See all ${e(t)} results`,
|
|
359
|
+
previous: "Previous",
|
|
360
|
+
next: "Next",
|
|
361
|
+
pageOf: (t, s) => `Page ${e(t)} / ${e(s)}`
|
|
362
|
+
}),
|
|
363
|
+
fr: (e) => ({
|
|
364
|
+
searching: (t) => `Recherche de « ${t} »…`,
|
|
365
|
+
noResults: "Aucun produit correspondant",
|
|
366
|
+
retry: "Réessayer",
|
|
367
|
+
collectionsLabel: "Collections",
|
|
368
|
+
productsLabel: "Produits",
|
|
369
|
+
collectionsCount: (t) => t === 1 ? "1 collection" : `${e(t)} collections`,
|
|
370
|
+
resultsCount: (t) => t === 1 ? "1 résultat" : `${e(t)} résultats`,
|
|
371
|
+
seeAllLabel: (t) => t === 1 ? "Voir le résultat" : `Voir les ${e(t)} résultats`,
|
|
372
|
+
previous: "Précédent",
|
|
373
|
+
next: "Suivant",
|
|
374
|
+
pageOf: (t, s) => `Page ${e(t)} / ${e(s)}`
|
|
375
|
+
}),
|
|
376
|
+
de: (e) => ({
|
|
377
|
+
searching: (t) => `Suche nach „${t}“…`,
|
|
378
|
+
noResults: "Keine passenden Produkte",
|
|
379
|
+
retry: "Erneut versuchen",
|
|
380
|
+
collectionsLabel: "Kollektionen",
|
|
381
|
+
productsLabel: "Produkte",
|
|
382
|
+
collectionsCount: (t) => t === 1 ? "1 Kollektion" : `${e(t)} Kollektionen`,
|
|
383
|
+
resultsCount: (t) => t === 1 ? "1 Ergebnis" : `${e(t)} Ergebnisse`,
|
|
384
|
+
seeAllLabel: (t) => t === 1 ? "Das Ergebnis anzeigen" : `Alle ${e(t)} Ergebnisse anzeigen`,
|
|
385
|
+
previous: "Zurück",
|
|
386
|
+
next: "Weiter",
|
|
387
|
+
pageOf: (t, s) => `Seite ${e(t)} / ${e(s)}`
|
|
388
|
+
}),
|
|
389
|
+
es: (e) => ({
|
|
390
|
+
searching: (t) => `Buscando «${t}»…`,
|
|
391
|
+
noResults: "No hay productos que coincidan",
|
|
392
|
+
retry: "Reintentar",
|
|
393
|
+
collectionsLabel: "Colecciones",
|
|
394
|
+
productsLabel: "Productos",
|
|
395
|
+
collectionsCount: (t) => t === 1 ? "1 colección" : `${e(t)} colecciones`,
|
|
396
|
+
resultsCount: (t) => t === 1 ? "1 resultado" : `${e(t)} resultados`,
|
|
397
|
+
seeAllLabel: (t) => t === 1 ? "Ver el resultado" : `Ver los ${e(t)} resultados`,
|
|
398
|
+
previous: "Anterior",
|
|
399
|
+
next: "Siguiente",
|
|
400
|
+
pageOf: (t, s) => `Página ${e(t)} / ${e(s)}`
|
|
401
|
+
}),
|
|
402
|
+
it: (e) => ({
|
|
403
|
+
searching: (t) => `Ricerca di “${t}”…`,
|
|
404
|
+
noResults: "Nessun prodotto corrispondente",
|
|
405
|
+
retry: "Riprova",
|
|
406
|
+
collectionsLabel: "Collezioni",
|
|
407
|
+
productsLabel: "Prodotti",
|
|
408
|
+
collectionsCount: (t) => t === 1 ? "1 collezione" : `${e(t)} collezioni`,
|
|
409
|
+
resultsCount: (t) => t === 1 ? "1 risultato" : `${e(t)} risultati`,
|
|
410
|
+
seeAllLabel: (t) => t === 1 ? "Vedi il risultato" : `Vedi tutti i ${e(t)} risultati`,
|
|
411
|
+
previous: "Precedente",
|
|
412
|
+
next: "Successivo",
|
|
413
|
+
pageOf: (t, s) => `Pagina ${e(t)} / ${e(s)}`
|
|
414
|
+
})
|
|
415
|
+
}, I = (e) => {
|
|
416
|
+
var r;
|
|
417
|
+
const t = ((r = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : r.toLowerCase()) ?? "en";
|
|
418
|
+
return (A[t] ?? A.en)((o) => oe(o, e));
|
|
419
|
+
}, M = (e) => e.status !== L.LOADING && e.response !== void 0 && e.response.nbPages > 1, ae = ({
|
|
344
420
|
controller: e,
|
|
345
|
-
state: t
|
|
421
|
+
state: t,
|
|
422
|
+
locale: s
|
|
346
423
|
}) => {
|
|
347
|
-
const
|
|
348
|
-
|
|
424
|
+
const r = t.response;
|
|
425
|
+
if (r === void 0 || !M(t))
|
|
426
|
+
return null;
|
|
427
|
+
const o = I(s);
|
|
428
|
+
return /* @__PURE__ */ g("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
|
|
349
429
|
/* @__PURE__ */ n(
|
|
350
430
|
"button",
|
|
351
431
|
{
|
|
352
432
|
type: "button",
|
|
353
|
-
disabled:
|
|
354
|
-
onClick: () => e.setPage(
|
|
355
|
-
children:
|
|
433
|
+
disabled: r.page === 0,
|
|
434
|
+
onClick: () => e.setPage(r.page - 1),
|
|
435
|
+
children: o.previous
|
|
356
436
|
}
|
|
357
437
|
),
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
"Page ",
|
|
360
|
-
s.page + 1,
|
|
361
|
-
" / ",
|
|
362
|
-
s.nbPages
|
|
363
|
-
] }),
|
|
438
|
+
/* @__PURE__ */ n("span", { children: o.pageOf(r.page + 1, r.nbPages) }),
|
|
364
439
|
/* @__PURE__ */ n(
|
|
365
440
|
"button",
|
|
366
441
|
{
|
|
367
442
|
type: "button",
|
|
368
|
-
disabled:
|
|
369
|
-
onClick: () => e.setPage(
|
|
370
|
-
children:
|
|
443
|
+
disabled: r.page >= r.nbPages - 1,
|
|
444
|
+
onClick: () => e.setPage(r.page + 1),
|
|
445
|
+
children: o.next
|
|
371
446
|
}
|
|
372
447
|
)
|
|
373
448
|
] });
|
|
374
|
-
},
|
|
449
|
+
}, $ = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), ie = (e, t) => {
|
|
450
|
+
const s = { before: "", match: e, after: "" }, r = $(t.trim());
|
|
451
|
+
if (r === "")
|
|
452
|
+
return s;
|
|
453
|
+
const o = [...e], c = [];
|
|
454
|
+
let l = "";
|
|
455
|
+
o.forEach((p, d) => {
|
|
456
|
+
const f = $(p);
|
|
457
|
+
for (let h = 0; h < f.length; h += 1)
|
|
458
|
+
c.push(d);
|
|
459
|
+
l += f;
|
|
460
|
+
});
|
|
461
|
+
const a = l.indexOf(r);
|
|
462
|
+
if (a === -1)
|
|
463
|
+
return s;
|
|
464
|
+
const i = c[a], u = c[a + r.length - 1] + 1;
|
|
465
|
+
return {
|
|
466
|
+
before: o.slice(0, i).join(""),
|
|
467
|
+
match: o.slice(i, u).join(""),
|
|
468
|
+
after: o.slice(u).join("")
|
|
469
|
+
};
|
|
470
|
+
}, T = ({
|
|
471
|
+
title: e,
|
|
472
|
+
query: t
|
|
473
|
+
}) => {
|
|
474
|
+
const { before: s, match: r, after: o } = ie(e, t);
|
|
475
|
+
return /* @__PURE__ */ g(C, { children: [
|
|
476
|
+
s !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: s }),
|
|
477
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-match", children: r }),
|
|
478
|
+
o !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-muted", children: o })
|
|
479
|
+
] });
|
|
480
|
+
}, ce = ({ amount: e, currencyCode: t }, s) => t === void 0 ? new Intl.NumberFormat(s).format(Number(e)) : new Intl.NumberFormat(s, {
|
|
375
481
|
style: "currency",
|
|
376
482
|
currency: t
|
|
377
|
-
}).format(Number(e)),
|
|
483
|
+
}).format(Number(e)), le = (e, t) => {
|
|
378
484
|
if (e === void 0)
|
|
379
485
|
return "";
|
|
380
486
|
try {
|
|
381
|
-
return
|
|
487
|
+
return ce(e.min, t);
|
|
382
488
|
} catch {
|
|
383
489
|
return "";
|
|
384
490
|
}
|
|
385
|
-
},
|
|
491
|
+
}, de = (e) => {
|
|
386
492
|
try {
|
|
387
493
|
const { protocol: t } = new URL(e, window.location.href);
|
|
388
494
|
return t === "http:" || t === "https:" ? e : void 0;
|
|
389
495
|
} catch {
|
|
390
496
|
return;
|
|
391
497
|
}
|
|
392
|
-
},
|
|
498
|
+
}, O = (e) => e.url === void 0 || e.url === "" ? void 0 : de(e.url), _ = (e) => e.title ?? e.handle ?? e.objectID, ue = ({
|
|
393
499
|
controller: e,
|
|
394
500
|
hit: t,
|
|
395
501
|
index: s,
|
|
396
|
-
locale: r
|
|
502
|
+
locale: r,
|
|
503
|
+
query: o = ""
|
|
397
504
|
}) => {
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
505
|
+
const c = b(null);
|
|
506
|
+
m(() => {
|
|
507
|
+
c.current !== null && e.observeResult(c.current, s);
|
|
401
508
|
}, [e, t, s]);
|
|
402
|
-
const
|
|
403
|
-
const
|
|
404
|
-
e.selectResult(s, { navigate: !
|
|
405
|
-
},
|
|
509
|
+
const l = (d) => {
|
|
510
|
+
const f = d.metaKey || d.ctrlKey || d.shiftKey || d.altKey;
|
|
511
|
+
e.selectResult(s, { navigate: !f }) && d.preventDefault();
|
|
512
|
+
}, a = (d) => {
|
|
406
513
|
d.button === 1 && e.selectResult(s, { navigate: !1 });
|
|
407
|
-
}, i =
|
|
408
|
-
/* @__PURE__ */ n("
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
-
|
|
411
|
-
o !== "" && /* @__PURE__ */ n("p", { className: "dialog-search-card-price", children: o })
|
|
412
|
-
] })
|
|
514
|
+
}, i = le(t.priceRange, r), u = O(t), p = /* @__PURE__ */ g(C, { children: [
|
|
515
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children: t.imageUrl !== void 0 && t.imageUrl !== "" && /* @__PURE__ */ n("img", { src: t.imageUrl, alt: "", loading: "lazy" }) }),
|
|
516
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ n(T, { title: _(t), query: o }) }),
|
|
517
|
+
i !== "" && /* @__PURE__ */ n("span", { className: "dialog-search-product-price", children: i })
|
|
413
518
|
] });
|
|
414
|
-
return /* @__PURE__ */ n("li", { ref:
|
|
519
|
+
return /* @__PURE__ */ n("li", { ref: c, className: "dialog-search-card", children: u === void 0 ? /* @__PURE__ */ n("div", { className: "dialog-search-product", children: p }) : /* @__PURE__ */ n(
|
|
415
520
|
"a",
|
|
416
521
|
{
|
|
417
|
-
className: "dialog-search-
|
|
522
|
+
className: "dialog-search-product",
|
|
418
523
|
href: u,
|
|
419
|
-
onClick:
|
|
420
|
-
onAuxClick:
|
|
524
|
+
onClick: l,
|
|
525
|
+
onAuxClick: a,
|
|
421
526
|
children: p
|
|
422
527
|
}
|
|
423
528
|
) });
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
|
|
529
|
+
}, he = () => /* @__PURE__ */ n(
|
|
530
|
+
"svg",
|
|
531
|
+
{
|
|
532
|
+
width: 16,
|
|
533
|
+
height: 16,
|
|
534
|
+
viewBox: "0 0 256 256",
|
|
535
|
+
fill: "currentColor",
|
|
536
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
537
|
+
"aria-hidden": "true",
|
|
538
|
+
children: /* @__PURE__ */ n("path", { d: "M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z" })
|
|
539
|
+
}
|
|
540
|
+
), ge = () => /* @__PURE__ */ n(
|
|
541
|
+
"svg",
|
|
542
|
+
{
|
|
543
|
+
width: 12,
|
|
544
|
+
height: 12,
|
|
545
|
+
viewBox: "0 0 256 256",
|
|
546
|
+
fill: "currentColor",
|
|
547
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
548
|
+
"aria-hidden": "true",
|
|
549
|
+
children: /* @__PURE__ */ n("path", { d: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z" })
|
|
550
|
+
}
|
|
551
|
+
), H = (e) => (e ?? []).flatMap((t) => {
|
|
552
|
+
const s = O(t);
|
|
553
|
+
return s === void 0 ? [] : [{ collection: t, href: s }];
|
|
554
|
+
}), pe = ({
|
|
555
|
+
collections: e,
|
|
556
|
+
query: t,
|
|
557
|
+
messages: s
|
|
558
|
+
}) => {
|
|
559
|
+
const r = H(e);
|
|
560
|
+
return r.length === 0 ? null : /* @__PURE__ */ g("aside", { className: "dialog-search-collections", children: [
|
|
561
|
+
/* @__PURE__ */ g("div", { className: "dialog-search-section-head", children: [
|
|
562
|
+
/* @__PURE__ */ n("p", { className: "dialog-search-label", children: s.collectionsLabel }),
|
|
563
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-count", children: s.collectionsCount(r.length) })
|
|
564
|
+
] }),
|
|
565
|
+
/* @__PURE__ */ n("ul", { className: "dialog-search-collection-list", children: r.map(({ collection: o, href: c }) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ g("a", { className: "dialog-search-collection", href: c, children: [
|
|
566
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children: o.imageUrl !== void 0 && o.imageUrl !== "" && /* @__PURE__ */ n("img", { src: o.imageUrl, alt: "", loading: "lazy" }) }),
|
|
567
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ n(T, { title: _(o), query: t }) }),
|
|
568
|
+
/* @__PURE__ */ n("span", { className: "dialog-search-caret", children: /* @__PURE__ */ n(ge, {}) })
|
|
569
|
+
] }) }, o.objectID)) })
|
|
570
|
+
] });
|
|
571
|
+
}, fe = ({
|
|
572
|
+
controller: e,
|
|
573
|
+
response: t,
|
|
574
|
+
locale: s,
|
|
575
|
+
messages: r
|
|
576
|
+
}) => /* @__PURE__ */ g("section", { className: "dialog-search-products", children: [
|
|
577
|
+
/* @__PURE__ */ n("div", { className: "dialog-search-section-head", children: /* @__PURE__ */ g("p", { className: "dialog-search-label", children: [
|
|
578
|
+
r.productsLabel,
|
|
579
|
+
t.nbHits > 0 && /* @__PURE__ */ n("span", { className: "dialog-search-label-count", children: ` · ${r.resultsCount(t.nbHits)}` })
|
|
580
|
+
] }) }),
|
|
581
|
+
/* @__PURE__ */ n("ul", { className: "dialog-search-results", children: t.hits.length === 0 ? /* @__PURE__ */ n("li", { className: "dialog-search-empty", role: "status", children: r.noResults }) : t.hits.map((o, c) => /* @__PURE__ */ n(
|
|
582
|
+
ue,
|
|
583
|
+
{
|
|
584
|
+
controller: e,
|
|
585
|
+
hit: o,
|
|
586
|
+
index: c,
|
|
587
|
+
locale: s,
|
|
588
|
+
query: t.query
|
|
589
|
+
},
|
|
590
|
+
o.objectID
|
|
591
|
+
)) })
|
|
592
|
+
] }), S = 8, w = 16, me = 200, be = 1440, ve = (e, t) => e.bottom > 0 && e.top < t, Ce = (e, t) => {
|
|
593
|
+
const s = Math.min(
|
|
594
|
+
be,
|
|
595
|
+
t - 2 * w
|
|
596
|
+
), r = e.left + e.width / 2 - s / 2;
|
|
597
|
+
return { left: Math.min(
|
|
598
|
+
Math.max(r, w),
|
|
599
|
+
t - w - s
|
|
600
|
+
), width: s };
|
|
601
|
+
}, ye = (e, t, s) => {
|
|
602
|
+
const r = s - e.bottom - S - w, o = e.top - S - w, c = Ce(e, t);
|
|
603
|
+
return r < me && o > r ? {
|
|
604
|
+
...c,
|
|
605
|
+
bottom: s - e.top + S,
|
|
606
|
+
maxHeight: Math.max(o, 0)
|
|
607
|
+
} : {
|
|
608
|
+
...c,
|
|
609
|
+
top: e.bottom + S,
|
|
610
|
+
maxHeight: Math.max(r, 0)
|
|
611
|
+
};
|
|
612
|
+
}, we = (e) => {
|
|
613
|
+
const t = e.trim().replace(/^#/, "");
|
|
614
|
+
if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))
|
|
615
|
+
return;
|
|
616
|
+
const s = t.length <= 4 ? [...t].map((r) => r + r).join("") : t;
|
|
617
|
+
return [0, 2, 4].map(
|
|
618
|
+
(r) => Number.parseInt(s.slice(r, r + 2), 16)
|
|
619
|
+
);
|
|
620
|
+
}, Le = (e) => {
|
|
621
|
+
const t = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(e);
|
|
622
|
+
if (t !== null)
|
|
623
|
+
return [t[1], t[2], t[3]].map(Number);
|
|
624
|
+
}, Se = (e) => {
|
|
625
|
+
if (typeof document > "u")
|
|
626
|
+
return;
|
|
627
|
+
const t = document.createElement("span");
|
|
628
|
+
if (t.style.color = e, t.style.color === "")
|
|
629
|
+
return;
|
|
630
|
+
document.body.appendChild(t);
|
|
631
|
+
const s = Le(getComputedStyle(t).color);
|
|
632
|
+
return t.remove(), s;
|
|
633
|
+
}, Ne = (e) => we(e) ?? Se(e), ke = (e) => {
|
|
634
|
+
const t = e / 255;
|
|
635
|
+
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
636
|
+
}, B = (e) => {
|
|
637
|
+
const t = Ne(e);
|
|
638
|
+
if (t === void 0)
|
|
639
|
+
return;
|
|
640
|
+
const [s, r, o] = t.map(ke);
|
|
641
|
+
return 0.2126 * s + 0.7152 * r + 0.0722 * o;
|
|
642
|
+
}, xe = "#181825", Pe = "#ffffff", Re = "straight", P = 0.5, R = {
|
|
643
|
+
light: {
|
|
644
|
+
panel: "#ffffff",
|
|
645
|
+
side: "#fafbfc",
|
|
646
|
+
text: "#111827",
|
|
647
|
+
"text-sec": "#6b7280",
|
|
648
|
+
border: "#eceef2",
|
|
649
|
+
hover: "#eef2f7",
|
|
650
|
+
thumb: "#eef1f5"
|
|
651
|
+
},
|
|
652
|
+
dark: {
|
|
653
|
+
panel: "#15171c",
|
|
654
|
+
side: "#1b1e25",
|
|
655
|
+
text: "#f3f4f6",
|
|
656
|
+
"text-sec": "#9ca3af",
|
|
657
|
+
border: "#2b2f38",
|
|
658
|
+
hover: "#242830",
|
|
659
|
+
thumb: "#2b2f38"
|
|
660
|
+
}
|
|
661
|
+
}, Ee = {
|
|
662
|
+
rectangle: {
|
|
663
|
+
"r-panel": "4px",
|
|
664
|
+
"r-item": "4px",
|
|
665
|
+
"r-thumb": "2px",
|
|
666
|
+
"r-btn": "4px"
|
|
667
|
+
},
|
|
668
|
+
"rectangle-rounded": {
|
|
669
|
+
"r-panel": "16px",
|
|
670
|
+
"r-item": "10px",
|
|
671
|
+
"r-thumb": "8px",
|
|
672
|
+
"r-btn": "10px"
|
|
673
|
+
}
|
|
674
|
+
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Ae = (e) => {
|
|
675
|
+
const t = e === void 0 ? void 0 : B(e);
|
|
676
|
+
return t === void 0 ? "light" : t < P ? "dark" : "light";
|
|
677
|
+
}, $e = (e, t) => {
|
|
678
|
+
const s = B(e);
|
|
679
|
+
return s === void 0 ? R[t].text : (t === "light" ? s < P : s >= P) ? e : R[t].text;
|
|
680
|
+
}, De = (e) => {
|
|
681
|
+
const t = Ae(N(e == null ? void 0 : e.backgroundColor)), s = (e == null ? void 0 : e.ctaBorderType) === Re ? "rectangle" : "rectangle-rounded", r = N(e == null ? void 0 : e.primaryColor) ?? xe, o = N(e == null ? void 0 : e.fontFamily), c = {
|
|
682
|
+
...R[t],
|
|
683
|
+
...Ee[s],
|
|
684
|
+
primary: r,
|
|
685
|
+
accent: $e(r, t),
|
|
686
|
+
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? Pe,
|
|
687
|
+
...o === void 0 ? {} : { font: o }
|
|
688
|
+
};
|
|
689
|
+
return Object.fromEntries(
|
|
690
|
+
Object.entries(c).map(([l, a]) => [`--dso-${l}`, a])
|
|
691
|
+
);
|
|
692
|
+
}, Ie = (e) => {
|
|
693
|
+
const t = b(null), [s, r] = v(void 0), [o, c] = v({ width: 0, height: 0 });
|
|
694
|
+
return j(() => {
|
|
427
695
|
if (!e)
|
|
428
696
|
return;
|
|
429
697
|
const l = () => {
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
698
|
+
const a = t.current;
|
|
699
|
+
if (a === null)
|
|
432
700
|
return;
|
|
433
|
-
const
|
|
434
|
-
c(
|
|
435
|
-
(
|
|
701
|
+
const i = a.previousElementSibling ?? a, { top: u, bottom: p, left: d, width: f } = i.getBoundingClientRect();
|
|
702
|
+
c(
|
|
703
|
+
(h) => h.width === window.innerWidth && h.height === window.innerHeight ? h : { width: window.innerWidth, height: window.innerHeight }
|
|
704
|
+
), r(
|
|
705
|
+
(h) => h !== void 0 && h.top === u && h.bottom === p && h.left === d && h.width === f ? h : { top: u, bottom: p, left: d, width: f }
|
|
436
706
|
);
|
|
437
707
|
};
|
|
438
708
|
return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
|
|
439
709
|
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
|
|
440
710
|
};
|
|
441
|
-
}, [e]), { anchorRef: t, rect: s,
|
|
442
|
-
},
|
|
443
|
-
const [s, r] =
|
|
444
|
-
return
|
|
711
|
+
}, [e]), { anchorRef: t, rect: s, viewport: o };
|
|
712
|
+
}, Me = (e, t) => {
|
|
713
|
+
const [s, r] = v(!1), o = b(null), c = e.status !== L.IDLE && !s;
|
|
714
|
+
return m(() => {
|
|
445
715
|
r(!1);
|
|
446
|
-
}, [e.query]),
|
|
716
|
+
}, [e.query]), m(() => {
|
|
447
717
|
if (!c)
|
|
448
718
|
return;
|
|
449
|
-
const l = (
|
|
450
|
-
var
|
|
451
|
-
const
|
|
452
|
-
if (!(
|
|
719
|
+
const l = (a) => {
|
|
720
|
+
var f, h;
|
|
721
|
+
const i = a.target;
|
|
722
|
+
if (!(i instanceof Node))
|
|
453
723
|
return;
|
|
454
|
-
const u = (
|
|
724
|
+
const u = (f = t.current) == null ? void 0 : f.previousElementSibling, p = ((h = o.current) == null ? void 0 : h.contains(i)) ?? !1, d = (u == null ? void 0 : u.contains(i)) ?? !1;
|
|
455
725
|
!p && !d && r(!0);
|
|
456
726
|
};
|
|
457
727
|
return document.addEventListener("pointerdown", l), () => document.removeEventListener("pointerdown", l);
|
|
458
|
-
}, [c, t]),
|
|
459
|
-
var
|
|
460
|
-
const l = (
|
|
728
|
+
}, [c, t]), m(() => {
|
|
729
|
+
var i;
|
|
730
|
+
const l = (i = t.current) == null ? void 0 : i.previousElementSibling;
|
|
461
731
|
if (l == null)
|
|
462
732
|
return;
|
|
463
|
-
const
|
|
464
|
-
return l.addEventListener("focusin",
|
|
465
|
-
}, [t]), { isOpen: c, panelRef:
|
|
466
|
-
},
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}) => {
|
|
539
|
-
const r = t.status !== b.IDLE, { anchorRef: a, rect: c, viewportHeight: l } = J(r), { isOpen: i, panelRef: o } = ee(t, a);
|
|
540
|
-
return /* @__PURE__ */ h(y, { children: [
|
|
541
|
-
/* @__PURE__ */ n("div", { ref: a }),
|
|
542
|
-
i && c !== void 0 && re(c, l) && _(
|
|
733
|
+
const a = () => r(!1);
|
|
734
|
+
return l.addEventListener("focusin", a), () => l.removeEventListener("focusin", a);
|
|
735
|
+
}, [t]), { isOpen: c, panelRef: o };
|
|
736
|
+
}, Te = (e) => e instanceof q ? `Search failed (${e.status}${e.code ? ` ${e.code}` : ""}): ${e.message}` : "Search failed: network error. Check your connection and try again.", Oe = (e, t) => {
|
|
737
|
+
var f, h;
|
|
738
|
+
const { controller: s, state: r, locale: o, seeAllHref: c } = e, { status: l, response: a } = r;
|
|
739
|
+
if (l === L.ERROR)
|
|
740
|
+
return /* @__PURE__ */ g("div", { className: "dialog-search-error", children: [
|
|
741
|
+
/* @__PURE__ */ n(
|
|
742
|
+
"p",
|
|
743
|
+
{
|
|
744
|
+
role: "alert",
|
|
745
|
+
className: "dialog-search-status dialog-search-status-error",
|
|
746
|
+
children: Te(r.error)
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ n(
|
|
750
|
+
"button",
|
|
751
|
+
{
|
|
752
|
+
type: "button",
|
|
753
|
+
className: "dialog-search-retry",
|
|
754
|
+
onClick: () => s.retry(),
|
|
755
|
+
children: t.retry
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
] });
|
|
759
|
+
if (a === void 0)
|
|
760
|
+
return /* @__PURE__ */ n("p", { role: "status", className: "dialog-search-status", children: t.searching(r.query) });
|
|
761
|
+
const i = ((h = (f = r.sections) == null ? void 0 : f.collections) == null ? void 0 : h.hits) ?? [], u = H(i).length > 0, p = c !== void 0 && a.nbHits > 0, d = !p && M(r);
|
|
762
|
+
return /* @__PURE__ */ g(C, { children: [
|
|
763
|
+
/* @__PURE__ */ g(
|
|
764
|
+
"div",
|
|
765
|
+
{
|
|
766
|
+
className: `dialog-search-body${u ? "" : " dialog-search-body--no-collections"}`,
|
|
767
|
+
children: [
|
|
768
|
+
/* @__PURE__ */ n(
|
|
769
|
+
pe,
|
|
770
|
+
{
|
|
771
|
+
collections: i,
|
|
772
|
+
query: a.query,
|
|
773
|
+
messages: t
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ n(
|
|
777
|
+
fe,
|
|
778
|
+
{
|
|
779
|
+
controller: s,
|
|
780
|
+
response: a,
|
|
781
|
+
locale: o,
|
|
782
|
+
messages: t
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
(p || d) && /* @__PURE__ */ n("div", { className: "dialog-search-footer", children: p ? /* @__PURE__ */ g("a", { className: "dialog-search-cta", href: c(a.query), children: [
|
|
789
|
+
t.seeAllLabel(a.nbHits),
|
|
790
|
+
/* @__PURE__ */ n(he, {})
|
|
791
|
+
] }) : /* @__PURE__ */ n(
|
|
792
|
+
ae,
|
|
793
|
+
{
|
|
794
|
+
controller: s,
|
|
795
|
+
state: r,
|
|
796
|
+
locale: o
|
|
797
|
+
}
|
|
798
|
+
) })
|
|
799
|
+
] });
|
|
800
|
+
}, ze = (e) => {
|
|
801
|
+
const { state: t, locale: s, theme: r, layout: o = "list" } = e, c = t.status !== L.IDLE, { anchorRef: l, rect: a, viewport: i } = Ie(c), { isOpen: u, panelRef: p } = Me(t, l), d = I(s), f = y(
|
|
802
|
+
() => De(r),
|
|
803
|
+
[r]
|
|
804
|
+
);
|
|
805
|
+
return /* @__PURE__ */ g(C, { children: [
|
|
806
|
+
/* @__PURE__ */ n("div", { ref: l }),
|
|
807
|
+
u && a !== void 0 && ve(a, i.height) && U(
|
|
543
808
|
/* @__PURE__ */ n(
|
|
544
809
|
"div",
|
|
545
810
|
{
|
|
546
|
-
ref:
|
|
547
|
-
className:
|
|
548
|
-
style:
|
|
549
|
-
|
|
811
|
+
ref: p,
|
|
812
|
+
className: `dialog-search-panel dialog-search-panel--${o}`,
|
|
813
|
+
style: {
|
|
814
|
+
...ye(a, i.width, i.height),
|
|
815
|
+
...f
|
|
816
|
+
},
|
|
817
|
+
children: Oe(e, d)
|
|
550
818
|
}
|
|
551
819
|
),
|
|
552
820
|
document.body
|
|
553
821
|
)
|
|
554
822
|
] });
|
|
555
|
-
},
|
|
556
|
-
status:
|
|
823
|
+
}, _e = {
|
|
824
|
+
status: L.IDLE,
|
|
557
825
|
query: "",
|
|
558
826
|
page: 0
|
|
559
|
-
},
|
|
560
|
-
const t =
|
|
827
|
+
}, Ue = (e) => {
|
|
828
|
+
const t = b(e);
|
|
561
829
|
t.current = e;
|
|
562
|
-
const s =
|
|
830
|
+
const s = b(void 0), r = x(() => {
|
|
563
831
|
if (s.current === void 0) {
|
|
564
|
-
const {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
locale: p = o.locale,
|
|
568
|
-
...d
|
|
569
|
-
} = t.current;
|
|
570
|
-
s.current = B({
|
|
571
|
-
search: (m, g) => o.search(m, g),
|
|
572
|
-
locale: p,
|
|
832
|
+
const { client: i, surface: u = "search_page", ...p } = t.current;
|
|
833
|
+
s.current = z({
|
|
834
|
+
search: (d, f) => i.search(d, f),
|
|
573
835
|
analytics: {
|
|
574
836
|
surface: u,
|
|
575
|
-
trackViewSearchResults: (
|
|
576
|
-
trackSelectSearchResult: (
|
|
837
|
+
trackViewSearchResults: (d) => i.trackViewSearchResults(d),
|
|
838
|
+
trackSelectSearchResult: (d) => i.trackSelectSearchResult(d)
|
|
577
839
|
},
|
|
578
|
-
...
|
|
840
|
+
...p
|
|
579
841
|
});
|
|
580
842
|
}
|
|
581
843
|
return s.current;
|
|
582
|
-
}, []),
|
|
583
|
-
|
|
584
|
-
setQuery: (
|
|
585
|
-
submit: (
|
|
586
|
-
setPage: (
|
|
844
|
+
}, []), o = b(void 0);
|
|
845
|
+
o.current ?? (o.current = {
|
|
846
|
+
setQuery: (i) => r().setQuery(i),
|
|
847
|
+
submit: (i) => r().submit(i),
|
|
848
|
+
setPage: (i) => r().setPage(i),
|
|
587
849
|
retry: () => r().retry(),
|
|
588
|
-
observeResult: (
|
|
589
|
-
selectResult: (
|
|
590
|
-
subscribe: (
|
|
850
|
+
observeResult: (i, u) => r().observeResult(i, u),
|
|
851
|
+
selectResult: (i, u) => r().selectResult(i, u),
|
|
852
|
+
subscribe: (i) => r().subscribe(i),
|
|
591
853
|
getState: () => r().getState(),
|
|
592
|
-
//
|
|
593
|
-
// dispatching into the disposed one; never create a controller here.
|
|
854
|
+
// Create a replacement on next access after disposal.
|
|
594
855
|
dispose: () => {
|
|
595
|
-
var
|
|
596
|
-
(
|
|
856
|
+
var i;
|
|
857
|
+
(i = s.current) == null || i.dispose(), s.current = void 0;
|
|
597
858
|
}
|
|
598
|
-
}),
|
|
599
|
-
|
|
859
|
+
}), m(() => {
|
|
860
|
+
D({
|
|
600
861
|
method: "react",
|
|
601
|
-
version: "2.
|
|
862
|
+
version: "2.6.0"
|
|
602
863
|
});
|
|
603
|
-
const
|
|
864
|
+
const i = r();
|
|
604
865
|
return () => {
|
|
605
|
-
|
|
866
|
+
i.dispose(), s.current === i && (s.current = void 0);
|
|
606
867
|
};
|
|
607
868
|
}, [r]);
|
|
608
|
-
const c =
|
|
609
|
-
(
|
|
869
|
+
const c = x(
|
|
870
|
+
(i) => r().subscribe(i),
|
|
610
871
|
[r]
|
|
611
|
-
), l =
|
|
872
|
+
), l = x(
|
|
612
873
|
() => r().getState(),
|
|
613
874
|
[r]
|
|
614
|
-
),
|
|
875
|
+
), a = V(
|
|
615
876
|
c,
|
|
616
877
|
l,
|
|
617
|
-
() =>
|
|
878
|
+
() => _e
|
|
618
879
|
);
|
|
619
|
-
return { controller:
|
|
880
|
+
return { controller: o.current, state: a, theme: e.client.theme };
|
|
620
881
|
};
|
|
621
882
|
export {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
883
|
+
J as DialogInput,
|
|
884
|
+
Fe as DialogProductBlock,
|
|
885
|
+
qe as DialogSearchBar,
|
|
886
|
+
ae as DialogSearchPagination,
|
|
887
|
+
ue as DialogSearchProductCard,
|
|
888
|
+
ze as DialogSearchResults,
|
|
889
|
+
Ue as useDialogSearch
|
|
629
890
|
};
|