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