@askdialog/dialog-react 2.6.0 → 2.8.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 +4 -6
- package/dist/components/DialogProductBlock/DialogAskSomethingElse.d.ts +12 -0
- package/dist/components/DialogProductBlock/DialogInput.d.ts +1 -0
- package/dist/components/DialogProductBlock/DialogProductBlock.d.ts +1 -0
- package/dist/components/DialogProductBlock/inputMessages.d.ts +7 -0
- package/dist/dialog-react.css +1 -1
- package/dist/dialog-react.js +497 -436
- package/dist/dialog-react.umd.cjs +1 -1
- package/package.json +3 -3
package/dist/dialog-react.js
CHANGED
|
@@ -1,14 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as b, useState as v, useEffect as
|
|
3
|
-
import { registerDialogInstallation as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as o, jsxs as h, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as b, useState as v, useEffect as f, useMemo as S, useLayoutEffect as V, useCallback as P, useSyncExternalStore as K } from "react";
|
|
3
|
+
import { registerDialogInstallation as M, addAuditCapability as F, resolveTextDirection as U, SearchStatus as L, DialogSearchError as Q, createSearchController as W } from "@askdialog/dialog-sdk";
|
|
4
|
+
import { createPortal as Z } from "react-dom";
|
|
5
|
+
const R = {
|
|
6
|
+
en: {
|
|
7
|
+
placeholder: "Ask the AI a question",
|
|
8
|
+
aiDisclosure: "You're chatting with an AI assistant. It can make mistakes, so please double-check important information",
|
|
9
|
+
askSomethingElse: "Ask something else"
|
|
10
|
+
},
|
|
11
|
+
fr: {
|
|
12
|
+
placeholder: "Posez une question à l'IA",
|
|
13
|
+
aiDisclosure: "Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes",
|
|
14
|
+
askSomethingElse: "Posez une autre question"
|
|
15
|
+
},
|
|
16
|
+
es: {
|
|
17
|
+
placeholder: "Haz una pregunta a la IA",
|
|
18
|
+
aiDisclosure: "Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",
|
|
19
|
+
askSomethingElse: "Pregunta otra cosa"
|
|
20
|
+
}
|
|
21
|
+
}, T = (e) => {
|
|
22
|
+
var n;
|
|
23
|
+
const t = ((n = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : n.toLowerCase()) ?? "en";
|
|
24
|
+
return R[t] ?? R.en;
|
|
25
|
+
}, X = ({
|
|
26
|
+
client: e,
|
|
27
|
+
questions: t,
|
|
28
|
+
disabled: n,
|
|
29
|
+
productId: s,
|
|
30
|
+
productTitle: r,
|
|
31
|
+
selectedVariantId: a
|
|
32
|
+
}) => /* @__PURE__ */ o(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
className: "dialog-ask-something-else",
|
|
37
|
+
disabled: n,
|
|
38
|
+
onClick: () => {
|
|
39
|
+
e.openAssistantWithSuggestions({
|
|
40
|
+
questions: t ?? [],
|
|
41
|
+
product: {
|
|
42
|
+
id: s,
|
|
43
|
+
title: r,
|
|
44
|
+
selectedVariantId: a
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
children: T(e.locale).askSomethingElse
|
|
49
|
+
}
|
|
50
|
+
), G = ({
|
|
6
51
|
title: e = "Your expert",
|
|
7
52
|
description: t = "A question about this product?"
|
|
8
|
-
}) => /* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
] }),
|
|
53
|
+
}) => /* @__PURE__ */ h("div", { className: "dialog-block-header-container", children: [
|
|
54
|
+
/* @__PURE__ */ o("div", { className: "dialog-block-title", children: e }),
|
|
55
|
+
/* @__PURE__ */ o("div", { className: "dialog-block-description", children: t })
|
|
56
|
+
] }), Y = ({ color: e = "#181825" }) => /* @__PURE__ */ h(
|
|
12
57
|
"svg",
|
|
13
58
|
{
|
|
14
59
|
width: "20",
|
|
@@ -17,8 +62,8 @@ const W = ({
|
|
|
17
62
|
fill: "none",
|
|
18
63
|
xmlns: "http://www.w3.org/2000/svg",
|
|
19
64
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ h("g", { clipPath: "url(#clip0_466_934)", children: [
|
|
66
|
+
/* @__PURE__ */ o(
|
|
22
67
|
"path",
|
|
23
68
|
{
|
|
24
69
|
d: "M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011 12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684 13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559 15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232 16.3622 6.2917 16.5834 6.07046 17.0259L5.41675 18.3333L4.76303 17.0259C4.54179 16.5834 4.43117 16.3622 4.28339 16.1704C4.15225 16.0003 3.99974 15.8478 3.82962 15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418 13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225 13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675 10.8333Z",
|
|
@@ -28,7 +73,7 @@ const W = ({
|
|
|
28
73
|
strokeLinejoin: "round"
|
|
29
74
|
}
|
|
30
75
|
),
|
|
31
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ o(
|
|
32
77
|
"path",
|
|
33
78
|
{
|
|
34
79
|
d: "M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175 5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687 6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632 8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348 9.8631 13.7173 10.1686 13.4823 10.7796L12.5001 13.3333L11.5179 10.7796C11.2829 10.1686 11.1654 9.8631 10.9827 9.60612C10.8207 9.37836 10.6217 9.17937 10.3939 9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043 6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207 5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001 1.66666Z",
|
|
@@ -39,58 +84,58 @@ const W = ({
|
|
|
39
84
|
}
|
|
40
85
|
)
|
|
41
86
|
] }),
|
|
42
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ o("clipPath", { id: "clip0_466_934", children: /* @__PURE__ */ o("rect", { width: "20", height: "20", fill: "white" }) }) })
|
|
43
88
|
]
|
|
44
89
|
}
|
|
45
|
-
),
|
|
90
|
+
), J = ({
|
|
46
91
|
client: e,
|
|
47
92
|
questions: t,
|
|
48
|
-
productId:
|
|
49
|
-
productTitle:
|
|
50
|
-
selectedVariantId:
|
|
93
|
+
productId: n,
|
|
94
|
+
productTitle: s,
|
|
95
|
+
selectedVariantId: r
|
|
51
96
|
}) => {
|
|
52
|
-
const
|
|
97
|
+
const a = (c) => {
|
|
53
98
|
e.sendProductMessage({
|
|
54
|
-
productId:
|
|
55
|
-
productTitle:
|
|
56
|
-
selectedVariantId:
|
|
57
|
-
question:
|
|
99
|
+
productId: n,
|
|
100
|
+
productTitle: s,
|
|
101
|
+
selectedVariantId: r,
|
|
102
|
+
question: c,
|
|
58
103
|
fromQuestionSuggestion: !0
|
|
59
104
|
});
|
|
60
105
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ o(C, { children: t.map((c) => /* @__PURE__ */ h(
|
|
62
107
|
"button",
|
|
63
108
|
{
|
|
64
109
|
className: "dialog-block-suggestions-item",
|
|
65
|
-
onClick: () => c
|
|
110
|
+
onClick: () => a(c.question),
|
|
66
111
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ o(Y, { color: e.theme.primaryColor }),
|
|
113
|
+
/* @__PURE__ */ o("span", { className: "dialog-block-suggestions-item-label", children: c.question })
|
|
69
114
|
]
|
|
70
115
|
},
|
|
71
|
-
|
|
116
|
+
c.question
|
|
72
117
|
)) });
|
|
73
|
-
},
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
] }),
|
|
118
|
+
}, ee = () => /* @__PURE__ */ h(C, { children: [
|
|
119
|
+
/* @__PURE__ */ o("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
120
|
+
/* @__PURE__ */ o("div", { className: "dialog-block-suggestions-skeleton-item" }),
|
|
121
|
+
/* @__PURE__ */ o("div", { className: "dialog-block-suggestions-skeleton-item" })
|
|
122
|
+
] }), te = ({
|
|
78
123
|
client: e,
|
|
79
124
|
questions: t,
|
|
80
|
-
isLoading:
|
|
81
|
-
productId:
|
|
82
|
-
productTitle:
|
|
83
|
-
selectedVariantId:
|
|
84
|
-
}) => /* @__PURE__ */
|
|
85
|
-
|
|
125
|
+
isLoading: n,
|
|
126
|
+
productId: s,
|
|
127
|
+
productTitle: r,
|
|
128
|
+
selectedVariantId: a
|
|
129
|
+
}) => /* @__PURE__ */ o("div", { className: "dialog-block-suggestions-container", children: n || !t ? /* @__PURE__ */ o(ee, {}) : /* @__PURE__ */ o(
|
|
130
|
+
J,
|
|
86
131
|
{
|
|
87
132
|
client: e,
|
|
88
133
|
questions: t,
|
|
89
|
-
productId:
|
|
90
|
-
productTitle:
|
|
91
|
-
selectedVariantId:
|
|
134
|
+
productId: s,
|
|
135
|
+
productTitle: r,
|
|
136
|
+
selectedVariantId: a
|
|
92
137
|
}
|
|
93
|
-
) }),
|
|
138
|
+
) }), se = ({ color: e = "#ffffff" }) => /* @__PURE__ */ o(
|
|
94
139
|
"svg",
|
|
95
140
|
{
|
|
96
141
|
width: "20",
|
|
@@ -98,7 +143,7 @@ const W = ({
|
|
|
98
143
|
viewBox: "0 0 20 20",
|
|
99
144
|
fill: "none",
|
|
100
145
|
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ o(
|
|
102
147
|
"path",
|
|
103
148
|
{
|
|
104
149
|
d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
|
|
@@ -109,167 +154,183 @@ const W = ({
|
|
|
109
154
|
}
|
|
110
155
|
)
|
|
111
156
|
}
|
|
112
|
-
),
|
|
157
|
+
), ne = ({
|
|
113
158
|
client: e,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
selectedVariantId: o
|
|
159
|
+
productId: t,
|
|
160
|
+
productTitle: n,
|
|
161
|
+
selectedVariantId: s
|
|
118
162
|
}) => {
|
|
119
|
-
const
|
|
163
|
+
const r = b(null), [a, c] = v(""), i = T(e.locale), l = () => {
|
|
120
164
|
var d;
|
|
121
|
-
(d =
|
|
165
|
+
(d = r.current) == null || d.focus();
|
|
122
166
|
}, u = () => {
|
|
123
|
-
const d =
|
|
167
|
+
const d = a;
|
|
124
168
|
d.trim() && (e.sendProductMessage({
|
|
125
|
-
productId:
|
|
126
|
-
productTitle:
|
|
127
|
-
selectedVariantId:
|
|
169
|
+
productId: t,
|
|
170
|
+
productTitle: n,
|
|
171
|
+
selectedVariantId: s,
|
|
128
172
|
question: d,
|
|
129
173
|
fromQuestionSuggestion: !0
|
|
130
|
-
}),
|
|
174
|
+
}), c(""));
|
|
175
|
+
}, p = (d) => {
|
|
176
|
+
d.key === "Enter" && u();
|
|
131
177
|
};
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
178
|
+
return /* @__PURE__ */ h("div", { className: "dialog-input-container", children: [
|
|
179
|
+
/* @__PURE__ */ h("div", { className: "dialog-input-wrapper", onClick: l, children: [
|
|
180
|
+
/* @__PURE__ */ o(
|
|
181
|
+
"input",
|
|
182
|
+
{
|
|
183
|
+
id: "dialog-ask-anything-input-ai-input",
|
|
184
|
+
ref: r,
|
|
185
|
+
value: a,
|
|
186
|
+
onChange: (d) => c(d.target.value),
|
|
187
|
+
className: "dialog-ask-anything-input-ai-input",
|
|
188
|
+
placeholder: i.placeholder,
|
|
189
|
+
"aria-describedby": "dialog-input-ai-disclosure",
|
|
190
|
+
onKeyDown: p
|
|
144
191
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ o(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
id: "send-message-button-ai-input",
|
|
197
|
+
className: "dialog-input-submit",
|
|
198
|
+
disabled: !a.trim(),
|
|
199
|
+
onClick: u,
|
|
200
|
+
children: /* @__PURE__ */ o(se, { color: e.theme.ctaTextColor })
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] }),
|
|
204
|
+
/* @__PURE__ */ o("p", { id: "dialog-input-ai-disclosure", className: "dialog-input-ai-disclosure", children: i.aiDisclosure })
|
|
157
205
|
] });
|
|
158
|
-
},
|
|
206
|
+
}, I = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), oe = (e) => {
|
|
159
207
|
if (!e) return;
|
|
160
208
|
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
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
209
|
+
Object.keys(e).forEach((n) => {
|
|
210
|
+
const s = n, r = I(n);
|
|
211
|
+
if (e[s] !== void 0) {
|
|
212
|
+
if (typeof e[s] == "object") {
|
|
213
|
+
Object.keys(e[s]).forEach(
|
|
214
|
+
(a) => {
|
|
215
|
+
var i;
|
|
216
|
+
const c = a;
|
|
217
|
+
if (c !== void 0) {
|
|
218
|
+
const l = I(a), u = e[s];
|
|
171
219
|
t.style.setProperty(
|
|
172
|
-
`--dialog-theme-${
|
|
173
|
-
(
|
|
220
|
+
`--dialog-theme-${r}-${l}`,
|
|
221
|
+
(i = u[c]) == null ? void 0 : i.toString()
|
|
174
222
|
);
|
|
175
223
|
}
|
|
176
224
|
}
|
|
177
225
|
);
|
|
178
226
|
return;
|
|
179
227
|
}
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
t.style.setProperty(`--dialog-theme-${
|
|
228
|
+
if (s === "ctaBorderType") {
|
|
229
|
+
const a = e[s] === "rounded" ? "24px" : "0";
|
|
230
|
+
t.style.setProperty(`--dialog-theme-${r}`, a);
|
|
183
231
|
return;
|
|
184
232
|
}
|
|
185
233
|
t.style.setProperty(
|
|
186
|
-
`--dialog-theme-${
|
|
187
|
-
e[
|
|
234
|
+
`--dialog-theme-${r}`,
|
|
235
|
+
e[s].toString()
|
|
188
236
|
);
|
|
189
237
|
}
|
|
190
238
|
});
|
|
191
|
-
},
|
|
192
|
-
e &&
|
|
193
|
-
}, [e]), /* @__PURE__ */
|
|
239
|
+
}, re = ({ theme: e, children: t }) => (f(() => {
|
|
240
|
+
e && oe(e);
|
|
241
|
+
}, [e]), /* @__PURE__ */ o(C, { children: t })), ie = 2, ae = 5, Ze = ({
|
|
194
242
|
client: e,
|
|
195
243
|
productId: t,
|
|
196
|
-
productTitle:
|
|
197
|
-
selectedVariantId:
|
|
198
|
-
enableInput:
|
|
244
|
+
productTitle: n,
|
|
245
|
+
selectedVariantId: s,
|
|
246
|
+
enableInput: r = !1
|
|
199
247
|
}) => {
|
|
200
|
-
|
|
248
|
+
var g;
|
|
249
|
+
const [a, c] = v(!0), [i, l] = v(
|
|
201
250
|
void 0
|
|
202
251
|
);
|
|
203
|
-
|
|
204
|
-
|
|
252
|
+
f(() => {
|
|
253
|
+
M({
|
|
205
254
|
method: "react",
|
|
206
|
-
version: "2.
|
|
207
|
-
}),
|
|
255
|
+
version: "2.8.0"
|
|
256
|
+
}), F("pdp-block");
|
|
208
257
|
}, []);
|
|
209
|
-
const u =
|
|
210
|
-
() =>
|
|
211
|
-
[
|
|
212
|
-
), p =
|
|
213
|
-
() =>
|
|
214
|
-
[
|
|
215
|
-
), d =
|
|
216
|
-
() =>
|
|
217
|
-
[
|
|
218
|
-
),
|
|
258
|
+
const u = S(
|
|
259
|
+
() => a ? "" : i == null ? void 0 : i.assistantName,
|
|
260
|
+
[i, a]
|
|
261
|
+
), p = S(
|
|
262
|
+
() => a ? "" : i == null ? void 0 : i.description,
|
|
263
|
+
[i, a]
|
|
264
|
+
), d = S(
|
|
265
|
+
() => a ? "" : i == null ? void 0 : i.inputPlaceholder,
|
|
266
|
+
[i, a]
|
|
267
|
+
), m = S(
|
|
219
268
|
() => {
|
|
220
|
-
var
|
|
221
|
-
return
|
|
269
|
+
var y;
|
|
270
|
+
return U((y = e.getLocalizationInformations()) == null ? void 0 : y.languageCode);
|
|
222
271
|
},
|
|
223
272
|
[e]
|
|
224
273
|
);
|
|
225
|
-
return
|
|
226
|
-
let
|
|
274
|
+
return f(() => {
|
|
275
|
+
let y = !0;
|
|
227
276
|
return (async () => {
|
|
228
|
-
|
|
277
|
+
c(!0), l(void 0);
|
|
229
278
|
try {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
279
|
+
const E = await e.getSuggestions(t, {
|
|
280
|
+
limit: ae
|
|
281
|
+
});
|
|
282
|
+
y && l(E);
|
|
283
|
+
} catch (E) {
|
|
284
|
+
console.error("error", E);
|
|
234
285
|
} finally {
|
|
235
|
-
|
|
286
|
+
y && c(!1);
|
|
236
287
|
}
|
|
237
288
|
})(), () => {
|
|
238
|
-
|
|
289
|
+
y = !1;
|
|
239
290
|
};
|
|
240
|
-
}, [e, t]), /* @__PURE__ */
|
|
291
|
+
}, [e, t]), /* @__PURE__ */ o(re, { theme: e.theme, children: /* @__PURE__ */ h(
|
|
241
292
|
"div",
|
|
242
293
|
{
|
|
243
294
|
id: "dialog-instant",
|
|
244
295
|
className: "dialog-block-container",
|
|
245
|
-
dir:
|
|
296
|
+
dir: m,
|
|
246
297
|
children: [
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
298
|
+
/* @__PURE__ */ o(G, { title: u, description: p }),
|
|
299
|
+
/* @__PURE__ */ o(
|
|
300
|
+
te,
|
|
250
301
|
{
|
|
251
302
|
client: e,
|
|
252
|
-
questions:
|
|
253
|
-
isLoading:
|
|
303
|
+
questions: (g = i == null ? void 0 : i.questions) == null ? void 0 : g.slice(0, ie),
|
|
304
|
+
isLoading: a,
|
|
254
305
|
productId: t,
|
|
255
|
-
productTitle:
|
|
256
|
-
selectedVariantId:
|
|
306
|
+
productTitle: n,
|
|
307
|
+
selectedVariantId: s
|
|
257
308
|
}
|
|
258
309
|
),
|
|
259
|
-
|
|
260
|
-
|
|
310
|
+
r ? /* @__PURE__ */ o(
|
|
311
|
+
ne,
|
|
261
312
|
{
|
|
262
313
|
client: e,
|
|
263
314
|
placeholder: d,
|
|
264
315
|
productId: t,
|
|
265
|
-
productTitle:
|
|
266
|
-
selectedVariantId:
|
|
316
|
+
productTitle: n,
|
|
317
|
+
selectedVariantId: s
|
|
318
|
+
}
|
|
319
|
+
) : /* @__PURE__ */ o(
|
|
320
|
+
X,
|
|
321
|
+
{
|
|
322
|
+
client: e,
|
|
323
|
+
questions: i == null ? void 0 : i.questions,
|
|
324
|
+
disabled: a,
|
|
325
|
+
productId: t,
|
|
326
|
+
productTitle: n,
|
|
327
|
+
selectedVariantId: s
|
|
267
328
|
}
|
|
268
329
|
)
|
|
269
330
|
]
|
|
270
331
|
}
|
|
271
332
|
) });
|
|
272
|
-
},
|
|
333
|
+
}, le = () => /* @__PURE__ */ o(
|
|
273
334
|
"svg",
|
|
274
335
|
{
|
|
275
336
|
width: 16,
|
|
@@ -278,7 +339,7 @@ const W = ({
|
|
|
278
339
|
fill: "none",
|
|
279
340
|
xmlns: "http://www.w3.org/2000/svg",
|
|
280
341
|
"aria-hidden": "true",
|
|
281
|
-
children: /* @__PURE__ */
|
|
342
|
+
children: /* @__PURE__ */ o(
|
|
282
343
|
"path",
|
|
283
344
|
{
|
|
284
345
|
d: "M8 13V3M8 3L3 8M8 3L13 8",
|
|
@@ -289,9 +350,9 @@ const W = ({
|
|
|
289
350
|
}
|
|
290
351
|
)
|
|
291
352
|
}
|
|
292
|
-
),
|
|
353
|
+
), ce = "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", de = ({
|
|
293
354
|
color: e = "currentColor"
|
|
294
|
-
}) => /* @__PURE__ */
|
|
355
|
+
}) => /* @__PURE__ */ o(
|
|
295
356
|
"svg",
|
|
296
357
|
{
|
|
297
358
|
width: 16,
|
|
@@ -300,53 +361,53 @@ const W = ({
|
|
|
300
361
|
fill: "none",
|
|
301
362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
302
363
|
"aria-hidden": "true",
|
|
303
|
-
children: /* @__PURE__ */
|
|
364
|
+
children: /* @__PURE__ */ o("path", { d: ce, fill: e })
|
|
304
365
|
}
|
|
305
|
-
),
|
|
366
|
+
), Xe = ({
|
|
306
367
|
controller: e,
|
|
307
368
|
placeholder: t = "Search products...",
|
|
308
|
-
autoFocus:
|
|
309
|
-
submitAriaLabel:
|
|
369
|
+
autoFocus: n = !1,
|
|
370
|
+
submitAriaLabel: s = "Search"
|
|
310
371
|
}) => {
|
|
311
|
-
const [
|
|
312
|
-
return /* @__PURE__ */
|
|
313
|
-
|
|
372
|
+
const [r, a] = v("");
|
|
373
|
+
return /* @__PURE__ */ h("form", { className: "dialog-search-bar", role: "search", onSubmit: (i) => {
|
|
374
|
+
i.preventDefault(), e.submit(r);
|
|
314
375
|
}, children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ h("div", { className: "dialog-search-bar-field", children: [
|
|
377
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-bar-icon", children: /* @__PURE__ */ o(de, {}) }),
|
|
378
|
+
/* @__PURE__ */ o(
|
|
318
379
|
"input",
|
|
319
380
|
{
|
|
320
381
|
type: "text",
|
|
321
382
|
name: "dialog-search-query",
|
|
322
383
|
className: "dialog-search-bar-input",
|
|
323
|
-
value:
|
|
384
|
+
value: r,
|
|
324
385
|
"aria-label": t,
|
|
325
386
|
placeholder: t,
|
|
326
|
-
autoFocus:
|
|
327
|
-
onChange: (
|
|
328
|
-
|
|
387
|
+
autoFocus: n,
|
|
388
|
+
onChange: (i) => {
|
|
389
|
+
a(i.target.value), e.setQuery(i.target.value);
|
|
329
390
|
}
|
|
330
391
|
}
|
|
331
392
|
)
|
|
332
393
|
] }),
|
|
333
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ o(
|
|
334
395
|
"button",
|
|
335
396
|
{
|
|
336
397
|
type: "submit",
|
|
337
398
|
className: "dialog-search-bar-submit",
|
|
338
|
-
"aria-label":
|
|
339
|
-
children: /* @__PURE__ */
|
|
399
|
+
"aria-label": s,
|
|
400
|
+
children: /* @__PURE__ */ o(le, {})
|
|
340
401
|
}
|
|
341
402
|
)
|
|
342
403
|
] });
|
|
343
|
-
},
|
|
404
|
+
}, ue = (e, t) => {
|
|
344
405
|
try {
|
|
345
406
|
return new Intl.NumberFormat(t).format(e);
|
|
346
407
|
} catch {
|
|
347
408
|
return String(e);
|
|
348
409
|
}
|
|
349
|
-
},
|
|
410
|
+
}, $ = {
|
|
350
411
|
en: (e) => ({
|
|
351
412
|
searching: (t) => `Searching “${t}”…`,
|
|
352
413
|
noResults: "No matching products",
|
|
@@ -358,7 +419,7 @@ const W = ({
|
|
|
358
419
|
seeAllLabel: (t) => t === 1 ? "See the result" : `See all ${e(t)} results`,
|
|
359
420
|
previous: "Previous",
|
|
360
421
|
next: "Next",
|
|
361
|
-
pageOf: (t,
|
|
422
|
+
pageOf: (t, n) => `Page ${e(t)} / ${e(n)}`
|
|
362
423
|
}),
|
|
363
424
|
fr: (e) => ({
|
|
364
425
|
searching: (t) => `Recherche de « ${t} »…`,
|
|
@@ -371,7 +432,7 @@ const W = ({
|
|
|
371
432
|
seeAllLabel: (t) => t === 1 ? "Voir le résultat" : `Voir les ${e(t)} résultats`,
|
|
372
433
|
previous: "Précédent",
|
|
373
434
|
next: "Suivant",
|
|
374
|
-
pageOf: (t,
|
|
435
|
+
pageOf: (t, n) => `Page ${e(t)} / ${e(n)}`
|
|
375
436
|
}),
|
|
376
437
|
de: (e) => ({
|
|
377
438
|
searching: (t) => `Suche nach „${t}“…`,
|
|
@@ -384,7 +445,7 @@ const W = ({
|
|
|
384
445
|
seeAllLabel: (t) => t === 1 ? "Das Ergebnis anzeigen" : `Alle ${e(t)} Ergebnisse anzeigen`,
|
|
385
446
|
previous: "Zurück",
|
|
386
447
|
next: "Weiter",
|
|
387
|
-
pageOf: (t,
|
|
448
|
+
pageOf: (t, n) => `Seite ${e(t)} / ${e(n)}`
|
|
388
449
|
}),
|
|
389
450
|
es: (e) => ({
|
|
390
451
|
searching: (t) => `Buscando «${t}»…`,
|
|
@@ -397,7 +458,7 @@ const W = ({
|
|
|
397
458
|
seeAllLabel: (t) => t === 1 ? "Ver el resultado" : `Ver los ${e(t)} resultados`,
|
|
398
459
|
previous: "Anterior",
|
|
399
460
|
next: "Siguiente",
|
|
400
|
-
pageOf: (t,
|
|
461
|
+
pageOf: (t, n) => `Página ${e(t)} / ${e(n)}`
|
|
401
462
|
}),
|
|
402
463
|
it: (e) => ({
|
|
403
464
|
searching: (t) => `Ricerca di “${t}”…`,
|
|
@@ -410,123 +471,123 @@ const W = ({
|
|
|
410
471
|
seeAllLabel: (t) => t === 1 ? "Vedi il risultato" : `Vedi tutti i ${e(t)} risultati`,
|
|
411
472
|
previous: "Precedente",
|
|
412
473
|
next: "Successivo",
|
|
413
|
-
pageOf: (t,
|
|
474
|
+
pageOf: (t, n) => `Pagina ${e(t)} / ${e(n)}`
|
|
414
475
|
})
|
|
415
|
-
},
|
|
416
|
-
var
|
|
417
|
-
const t = ((
|
|
418
|
-
return (
|
|
419
|
-
},
|
|
476
|
+
}, O = (e) => {
|
|
477
|
+
var s;
|
|
478
|
+
const t = ((s = e == null ? void 0 : e.split("-")[0]) == null ? void 0 : s.toLowerCase()) ?? "en";
|
|
479
|
+
return ($[t] ?? $.en)((r) => ue(r, e));
|
|
480
|
+
}, _ = (e) => e.status !== L.LOADING && e.response !== void 0 && e.response.nbPages > 1, he = ({
|
|
420
481
|
controller: e,
|
|
421
482
|
state: t,
|
|
422
|
-
locale:
|
|
483
|
+
locale: n
|
|
423
484
|
}) => {
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
485
|
+
const s = t.response;
|
|
486
|
+
if (s === void 0 || !_(t))
|
|
426
487
|
return null;
|
|
427
|
-
const
|
|
428
|
-
return /* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
488
|
+
const r = O(n);
|
|
489
|
+
return /* @__PURE__ */ h("nav", { "aria-label": "Search results pages", className: "dialog-search-pagination", children: [
|
|
490
|
+
/* @__PURE__ */ o(
|
|
430
491
|
"button",
|
|
431
492
|
{
|
|
432
493
|
type: "button",
|
|
433
|
-
disabled:
|
|
434
|
-
onClick: () => e.setPage(
|
|
435
|
-
children:
|
|
494
|
+
disabled: s.page === 0,
|
|
495
|
+
onClick: () => e.setPage(s.page - 1),
|
|
496
|
+
children: r.previous
|
|
436
497
|
}
|
|
437
498
|
),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ o("span", { children: r.pageOf(s.page + 1, s.nbPages) }),
|
|
500
|
+
/* @__PURE__ */ o(
|
|
440
501
|
"button",
|
|
441
502
|
{
|
|
442
503
|
type: "button",
|
|
443
|
-
disabled:
|
|
444
|
-
onClick: () => e.setPage(
|
|
445
|
-
children:
|
|
504
|
+
disabled: s.page >= s.nbPages - 1,
|
|
505
|
+
onClick: () => e.setPage(s.page + 1),
|
|
506
|
+
children: r.next
|
|
446
507
|
}
|
|
447
508
|
)
|
|
448
509
|
] });
|
|
449
|
-
},
|
|
450
|
-
const
|
|
451
|
-
if (
|
|
452
|
-
return
|
|
453
|
-
const
|
|
454
|
-
let
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
for (let
|
|
458
|
-
|
|
459
|
-
|
|
510
|
+
}, D = (e) => e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").replace(/ẞ/gu, "ß").toUpperCase().toLowerCase().replace(/ς/g, "σ"), ge = (e, t) => {
|
|
511
|
+
const n = { before: "", match: e, after: "" }, s = D(t.trim());
|
|
512
|
+
if (s === "")
|
|
513
|
+
return n;
|
|
514
|
+
const r = [...e], a = [];
|
|
515
|
+
let c = "";
|
|
516
|
+
r.forEach((p, d) => {
|
|
517
|
+
const m = D(p);
|
|
518
|
+
for (let g = 0; g < m.length; g += 1)
|
|
519
|
+
a.push(d);
|
|
520
|
+
c += m;
|
|
460
521
|
});
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
return
|
|
464
|
-
const
|
|
522
|
+
const i = c.indexOf(s);
|
|
523
|
+
if (i === -1)
|
|
524
|
+
return n;
|
|
525
|
+
const l = a[i], u = a[i + s.length - 1] + 1;
|
|
465
526
|
return {
|
|
466
|
-
before:
|
|
467
|
-
match:
|
|
468
|
-
after:
|
|
527
|
+
before: r.slice(0, l).join(""),
|
|
528
|
+
match: r.slice(l, u).join(""),
|
|
529
|
+
after: r.slice(u).join("")
|
|
469
530
|
};
|
|
470
|
-
},
|
|
531
|
+
}, H = ({
|
|
471
532
|
title: e,
|
|
472
533
|
query: t
|
|
473
534
|
}) => {
|
|
474
|
-
const { before:
|
|
475
|
-
return /* @__PURE__ */
|
|
476
|
-
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
|
|
535
|
+
const { before: n, match: s, after: r } = ge(e, t);
|
|
536
|
+
return /* @__PURE__ */ h(C, { children: [
|
|
537
|
+
n !== "" && /* @__PURE__ */ o("span", { className: "dialog-search-muted", children: n }),
|
|
538
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-match", children: s }),
|
|
539
|
+
r !== "" && /* @__PURE__ */ o("span", { className: "dialog-search-muted", children: r })
|
|
479
540
|
] });
|
|
480
|
-
},
|
|
541
|
+
}, pe = ({ amount: e, currencyCode: t }, n) => t === void 0 ? new Intl.NumberFormat(n).format(Number(e)) : new Intl.NumberFormat(n, {
|
|
481
542
|
style: "currency",
|
|
482
543
|
currency: t
|
|
483
|
-
}).format(Number(e)),
|
|
544
|
+
}).format(Number(e)), me = (e, t) => {
|
|
484
545
|
if (e === void 0)
|
|
485
546
|
return "";
|
|
486
547
|
try {
|
|
487
|
-
return
|
|
548
|
+
return pe(e.min, t);
|
|
488
549
|
} catch {
|
|
489
550
|
return "";
|
|
490
551
|
}
|
|
491
|
-
},
|
|
552
|
+
}, fe = (e) => {
|
|
492
553
|
try {
|
|
493
554
|
const { protocol: t } = new URL(e, window.location.href);
|
|
494
555
|
return t === "http:" || t === "https:" ? e : void 0;
|
|
495
556
|
} catch {
|
|
496
557
|
return;
|
|
497
558
|
}
|
|
498
|
-
},
|
|
559
|
+
}, q = (e) => e.url === void 0 || e.url === "" ? void 0 : fe(e.url), B = (e) => e.title ?? e.handle ?? e.objectID, be = ({
|
|
499
560
|
controller: e,
|
|
500
561
|
hit: t,
|
|
501
|
-
index:
|
|
502
|
-
locale:
|
|
503
|
-
query:
|
|
562
|
+
index: n,
|
|
563
|
+
locale: s,
|
|
564
|
+
query: r = ""
|
|
504
565
|
}) => {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}, [e, t,
|
|
509
|
-
const
|
|
510
|
-
const
|
|
511
|
-
e.selectResult(
|
|
512
|
-
},
|
|
513
|
-
d.button === 1 && e.selectResult(
|
|
514
|
-
},
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
|
|
566
|
+
const a = b(null);
|
|
567
|
+
f(() => {
|
|
568
|
+
a.current !== null && e.observeResult(a.current, n);
|
|
569
|
+
}, [e, t, n]);
|
|
570
|
+
const c = (d) => {
|
|
571
|
+
const m = d.metaKey || d.ctrlKey || d.shiftKey || d.altKey;
|
|
572
|
+
e.selectResult(n, { navigate: !m }) && d.preventDefault();
|
|
573
|
+
}, i = (d) => {
|
|
574
|
+
d.button === 1 && e.selectResult(n, { navigate: !1 });
|
|
575
|
+
}, l = me(t.priceRange, s), u = q(t), p = /* @__PURE__ */ h(C, { children: [
|
|
576
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-product-thumb", "aria-hidden": !0, children: t.imageUrl !== void 0 && t.imageUrl !== "" && /* @__PURE__ */ o("img", { src: t.imageUrl, alt: "", loading: "lazy" }) }),
|
|
577
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-product-title", children: /* @__PURE__ */ o(H, { title: B(t), query: r }) }),
|
|
578
|
+
l !== "" && /* @__PURE__ */ o("span", { className: "dialog-search-product-price", children: l })
|
|
518
579
|
] });
|
|
519
|
-
return /* @__PURE__ */
|
|
580
|
+
return /* @__PURE__ */ o("li", { ref: a, className: "dialog-search-card", children: u === void 0 ? /* @__PURE__ */ o("div", { className: "dialog-search-product", children: p }) : /* @__PURE__ */ o(
|
|
520
581
|
"a",
|
|
521
582
|
{
|
|
522
583
|
className: "dialog-search-product",
|
|
523
584
|
href: u,
|
|
524
|
-
onClick:
|
|
525
|
-
onAuxClick:
|
|
585
|
+
onClick: c,
|
|
586
|
+
onAuxClick: i,
|
|
526
587
|
children: p
|
|
527
588
|
}
|
|
528
589
|
) });
|
|
529
|
-
},
|
|
590
|
+
}, ve = () => /* @__PURE__ */ o(
|
|
530
591
|
"svg",
|
|
531
592
|
{
|
|
532
593
|
width: 16,
|
|
@@ -535,9 +596,9 @@ const W = ({
|
|
|
535
596
|
fill: "currentColor",
|
|
536
597
|
xmlns: "http://www.w3.org/2000/svg",
|
|
537
598
|
"aria-hidden": "true",
|
|
538
|
-
children: /* @__PURE__ */
|
|
599
|
+
children: /* @__PURE__ */ o("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
600
|
}
|
|
540
|
-
),
|
|
601
|
+
), Ce = () => /* @__PURE__ */ o(
|
|
541
602
|
"svg",
|
|
542
603
|
{
|
|
543
604
|
width: 12,
|
|
@@ -546,100 +607,100 @@ const W = ({
|
|
|
546
607
|
fill: "currentColor",
|
|
547
608
|
xmlns: "http://www.w3.org/2000/svg",
|
|
548
609
|
"aria-hidden": "true",
|
|
549
|
-
children: /* @__PURE__ */
|
|
610
|
+
children: /* @__PURE__ */ o("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
611
|
}
|
|
551
|
-
),
|
|
552
|
-
const
|
|
553
|
-
return
|
|
554
|
-
}),
|
|
612
|
+
), j = (e) => (e ?? []).flatMap((t) => {
|
|
613
|
+
const n = q(t);
|
|
614
|
+
return n === void 0 ? [] : [{ collection: t, href: n }];
|
|
615
|
+
}), ye = ({
|
|
555
616
|
collections: e,
|
|
556
617
|
query: t,
|
|
557
|
-
messages:
|
|
618
|
+
messages: n
|
|
558
619
|
}) => {
|
|
559
|
-
const
|
|
560
|
-
return
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */
|
|
620
|
+
const s = j(e);
|
|
621
|
+
return s.length === 0 ? null : /* @__PURE__ */ h("aside", { className: "dialog-search-collections", children: [
|
|
622
|
+
/* @__PURE__ */ h("div", { className: "dialog-search-section-head", children: [
|
|
623
|
+
/* @__PURE__ */ o("p", { className: "dialog-search-label", children: n.collectionsLabel }),
|
|
624
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-count", children: n.collectionsCount(s.length) })
|
|
564
625
|
] }),
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
] }) },
|
|
626
|
+
/* @__PURE__ */ o("ul", { className: "dialog-search-collection-list", children: s.map(({ collection: r, href: a }) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ h("a", { className: "dialog-search-collection", href: a, children: [
|
|
627
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-collection-thumb", "aria-hidden": !0, children: r.imageUrl !== void 0 && r.imageUrl !== "" && /* @__PURE__ */ o("img", { src: r.imageUrl, alt: "", loading: "lazy" }) }),
|
|
628
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-collection-title", children: /* @__PURE__ */ o(H, { title: B(r), query: t }) }),
|
|
629
|
+
/* @__PURE__ */ o("span", { className: "dialog-search-caret", children: /* @__PURE__ */ o(Ce, {}) })
|
|
630
|
+
] }) }, r.objectID)) })
|
|
570
631
|
] });
|
|
571
|
-
},
|
|
632
|
+
}, Se = ({
|
|
572
633
|
controller: e,
|
|
573
634
|
response: t,
|
|
574
|
-
locale:
|
|
575
|
-
messages:
|
|
576
|
-
}) => /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
|
|
579
|
-
t.nbHits > 0 && /* @__PURE__ */
|
|
635
|
+
locale: n,
|
|
636
|
+
messages: s
|
|
637
|
+
}) => /* @__PURE__ */ h("section", { className: "dialog-search-products", children: [
|
|
638
|
+
/* @__PURE__ */ o("div", { className: "dialog-search-section-head", children: /* @__PURE__ */ h("p", { className: "dialog-search-label", children: [
|
|
639
|
+
s.productsLabel,
|
|
640
|
+
t.nbHits > 0 && /* @__PURE__ */ o("span", { className: "dialog-search-label-count", children: ` · ${s.resultsCount(t.nbHits)}` })
|
|
580
641
|
] }) }),
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
|
|
642
|
+
/* @__PURE__ */ o("ul", { className: "dialog-search-results", children: t.hits.length === 0 ? /* @__PURE__ */ o("li", { className: "dialog-search-empty", role: "status", children: s.noResults }) : t.hits.map((r, a) => /* @__PURE__ */ o(
|
|
643
|
+
be,
|
|
583
644
|
{
|
|
584
645
|
controller: e,
|
|
585
|
-
hit:
|
|
586
|
-
index:
|
|
587
|
-
locale:
|
|
646
|
+
hit: r,
|
|
647
|
+
index: a,
|
|
648
|
+
locale: n,
|
|
588
649
|
query: t.query
|
|
589
650
|
},
|
|
590
|
-
|
|
651
|
+
r.objectID
|
|
591
652
|
)) })
|
|
592
|
-
] }),
|
|
593
|
-
const
|
|
594
|
-
|
|
653
|
+
] }), k = 8, w = 16, we = 200, Le = 1440, ke = (e, t) => e.bottom > 0 && e.top < t, Ne = (e, t) => {
|
|
654
|
+
const n = Math.min(
|
|
655
|
+
Le,
|
|
595
656
|
t - 2 * w
|
|
596
|
-
),
|
|
657
|
+
), s = e.left + e.width / 2 - n / 2;
|
|
597
658
|
return { left: Math.min(
|
|
598
|
-
Math.max(
|
|
599
|
-
t - w -
|
|
600
|
-
), width:
|
|
601
|
-
},
|
|
602
|
-
const
|
|
603
|
-
return
|
|
604
|
-
...
|
|
605
|
-
bottom:
|
|
606
|
-
maxHeight: Math.max(o, 0)
|
|
607
|
-
} : {
|
|
608
|
-
...c,
|
|
609
|
-
top: e.bottom + S,
|
|
659
|
+
Math.max(s, w),
|
|
660
|
+
t - w - n
|
|
661
|
+
), width: n };
|
|
662
|
+
}, Ee = (e, t, n) => {
|
|
663
|
+
const s = n - e.bottom - k - w, r = e.top - k - w, a = Ne(e, t);
|
|
664
|
+
return s < we && r > s ? {
|
|
665
|
+
...a,
|
|
666
|
+
bottom: n - e.top + k,
|
|
610
667
|
maxHeight: Math.max(r, 0)
|
|
668
|
+
} : {
|
|
669
|
+
...a,
|
|
670
|
+
top: e.bottom + k,
|
|
671
|
+
maxHeight: Math.max(s, 0)
|
|
611
672
|
};
|
|
612
|
-
},
|
|
673
|
+
}, Pe = (e) => {
|
|
613
674
|
const t = e.trim().replace(/^#/, "");
|
|
614
675
|
if (!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t))
|
|
615
676
|
return;
|
|
616
|
-
const
|
|
677
|
+
const n = t.length <= 4 ? [...t].map((s) => s + s).join("") : t;
|
|
617
678
|
return [0, 2, 4].map(
|
|
618
|
-
(
|
|
679
|
+
(s) => Number.parseInt(n.slice(s, s + 2), 16)
|
|
619
680
|
);
|
|
620
|
-
},
|
|
681
|
+
}, Ae = (e) => {
|
|
621
682
|
const t = /^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(e);
|
|
622
683
|
if (t !== null)
|
|
623
684
|
return [t[1], t[2], t[3]].map(Number);
|
|
624
|
-
},
|
|
685
|
+
}, xe = (e) => {
|
|
625
686
|
if (typeof document > "u")
|
|
626
687
|
return;
|
|
627
688
|
const t = document.createElement("span");
|
|
628
689
|
if (t.style.color = e, t.style.color === "")
|
|
629
690
|
return;
|
|
630
691
|
document.body.appendChild(t);
|
|
631
|
-
const
|
|
632
|
-
return t.remove(),
|
|
633
|
-
},
|
|
692
|
+
const n = Ae(getComputedStyle(t).color);
|
|
693
|
+
return t.remove(), n;
|
|
694
|
+
}, Re = (e) => Pe(e) ?? xe(e), Ie = (e) => {
|
|
634
695
|
const t = e / 255;
|
|
635
696
|
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
636
|
-
},
|
|
637
|
-
const t =
|
|
697
|
+
}, z = (e) => {
|
|
698
|
+
const t = Re(e);
|
|
638
699
|
if (t === void 0)
|
|
639
700
|
return;
|
|
640
|
-
const [s, r
|
|
641
|
-
return 0.2126 *
|
|
642
|
-
},
|
|
701
|
+
const [n, s, r] = t.map(Ie);
|
|
702
|
+
return 0.2126 * n + 0.7152 * s + 0.0722 * r;
|
|
703
|
+
}, $e = "#181825", De = "#ffffff", Me = "straight", A = 0.5, x = {
|
|
643
704
|
light: {
|
|
644
705
|
panel: "#ffffff",
|
|
645
706
|
side: "#fafbfc",
|
|
@@ -658,7 +719,7 @@ const W = ({
|
|
|
658
719
|
hover: "#242830",
|
|
659
720
|
thumb: "#2b2f38"
|
|
660
721
|
}
|
|
661
|
-
},
|
|
722
|
+
}, Te = {
|
|
662
723
|
rectangle: {
|
|
663
724
|
"r-panel": "4px",
|
|
664
725
|
"r-item": "4px",
|
|
@@ -671,220 +732,220 @@ const W = ({
|
|
|
671
732
|
"r-thumb": "8px",
|
|
672
733
|
"r-btn": "10px"
|
|
673
734
|
}
|
|
674
|
-
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(),
|
|
675
|
-
const t = e === void 0 ? void 0 :
|
|
676
|
-
return t === void 0 ? "light" : t <
|
|
677
|
-
},
|
|
678
|
-
const
|
|
679
|
-
return
|
|
680
|
-
},
|
|
681
|
-
const t =
|
|
682
|
-
...
|
|
683
|
-
...
|
|
684
|
-
primary:
|
|
685
|
-
accent:
|
|
686
|
-
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ??
|
|
687
|
-
...
|
|
735
|
+
}, N = (e) => e === void 0 || e.trim() === "" ? void 0 : e.trim(), Oe = (e) => {
|
|
736
|
+
const t = e === void 0 ? void 0 : z(e);
|
|
737
|
+
return t === void 0 ? "light" : t < A ? "dark" : "light";
|
|
738
|
+
}, _e = (e, t) => {
|
|
739
|
+
const n = z(e);
|
|
740
|
+
return n === void 0 ? x[t].text : (t === "light" ? n < A : n >= A) ? e : x[t].text;
|
|
741
|
+
}, He = (e) => {
|
|
742
|
+
const t = Oe(N(e == null ? void 0 : e.backgroundColor)), n = (e == null ? void 0 : e.ctaBorderType) === Me ? "rectangle" : "rectangle-rounded", s = N(e == null ? void 0 : e.primaryColor) ?? $e, r = N(e == null ? void 0 : e.fontFamily), a = {
|
|
743
|
+
...x[t],
|
|
744
|
+
...Te[n],
|
|
745
|
+
primary: s,
|
|
746
|
+
accent: _e(s, t),
|
|
747
|
+
"cta-text": N(e == null ? void 0 : e.ctaTextColor) ?? De,
|
|
748
|
+
...r === void 0 ? {} : { font: r }
|
|
688
749
|
};
|
|
689
750
|
return Object.fromEntries(
|
|
690
|
-
Object.entries(
|
|
751
|
+
Object.entries(a).map(([c, i]) => [`--dso-${c}`, i])
|
|
691
752
|
);
|
|
692
|
-
},
|
|
693
|
-
const t = b(null), [
|
|
694
|
-
return
|
|
753
|
+
}, qe = (e) => {
|
|
754
|
+
const t = b(null), [n, s] = v(void 0), [r, a] = v({ width: 0, height: 0 });
|
|
755
|
+
return V(() => {
|
|
695
756
|
if (!e)
|
|
696
757
|
return;
|
|
697
|
-
const
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
758
|
+
const c = () => {
|
|
759
|
+
const i = t.current;
|
|
760
|
+
if (i === null)
|
|
700
761
|
return;
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
(
|
|
704
|
-
),
|
|
705
|
-
(
|
|
762
|
+
const l = i.previousElementSibling ?? i, { top: u, bottom: p, left: d, width: m } = l.getBoundingClientRect();
|
|
763
|
+
a(
|
|
764
|
+
(g) => g.width === window.innerWidth && g.height === window.innerHeight ? g : { width: window.innerWidth, height: window.innerHeight }
|
|
765
|
+
), s(
|
|
766
|
+
(g) => g !== void 0 && g.top === u && g.bottom === p && g.left === d && g.width === m ? g : { top: u, bottom: p, left: d, width: m }
|
|
706
767
|
);
|
|
707
768
|
};
|
|
708
|
-
return
|
|
709
|
-
window.removeEventListener("scroll",
|
|
769
|
+
return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
|
|
770
|
+
window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
|
|
710
771
|
};
|
|
711
|
-
}, [e]), { anchorRef: t, rect:
|
|
712
|
-
},
|
|
713
|
-
const [
|
|
714
|
-
return
|
|
715
|
-
|
|
716
|
-
}, [e.query]),
|
|
717
|
-
if (!
|
|
772
|
+
}, [e]), { anchorRef: t, rect: n, viewport: r };
|
|
773
|
+
}, Be = (e, t) => {
|
|
774
|
+
const [n, s] = v(!1), r = b(null), a = e.status !== L.IDLE && !n;
|
|
775
|
+
return f(() => {
|
|
776
|
+
s(!1);
|
|
777
|
+
}, [e.query]), f(() => {
|
|
778
|
+
if (!a)
|
|
718
779
|
return;
|
|
719
|
-
const
|
|
720
|
-
var
|
|
721
|
-
const
|
|
722
|
-
if (!(
|
|
780
|
+
const c = (i) => {
|
|
781
|
+
var m, g;
|
|
782
|
+
const l = i.target;
|
|
783
|
+
if (!(l instanceof Node))
|
|
723
784
|
return;
|
|
724
|
-
const u = (
|
|
725
|
-
!p && !d &&
|
|
785
|
+
const u = (m = t.current) == null ? void 0 : m.previousElementSibling, p = ((g = r.current) == null ? void 0 : g.contains(l)) ?? !1, d = (u == null ? void 0 : u.contains(l)) ?? !1;
|
|
786
|
+
!p && !d && s(!0);
|
|
726
787
|
};
|
|
727
|
-
return document.addEventListener("pointerdown",
|
|
728
|
-
}, [
|
|
729
|
-
var
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
788
|
+
return document.addEventListener("pointerdown", c), () => document.removeEventListener("pointerdown", c);
|
|
789
|
+
}, [a, t]), f(() => {
|
|
790
|
+
var l;
|
|
791
|
+
const c = (l = t.current) == null ? void 0 : l.previousElementSibling;
|
|
792
|
+
if (c == null)
|
|
732
793
|
return;
|
|
733
|
-
const
|
|
734
|
-
return
|
|
735
|
-
}, [t]), { isOpen:
|
|
736
|
-
},
|
|
737
|
-
var
|
|
738
|
-
const { controller:
|
|
739
|
-
if (
|
|
740
|
-
return /* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
794
|
+
const i = () => s(!1);
|
|
795
|
+
return c.addEventListener("focusin", i), () => c.removeEventListener("focusin", i);
|
|
796
|
+
}, [t]), { isOpen: a, panelRef: r };
|
|
797
|
+
}, je = (e) => e instanceof Q ? `Search failed (${e.status}${e.code ? ` ${e.code}` : ""}): ${e.message}` : "Search failed: network error. Check your connection and try again.", ze = (e, t) => {
|
|
798
|
+
var m, g;
|
|
799
|
+
const { controller: n, state: s, locale: r, seeAllHref: a } = e, { status: c, response: i } = s;
|
|
800
|
+
if (c === L.ERROR)
|
|
801
|
+
return /* @__PURE__ */ h("div", { className: "dialog-search-error", children: [
|
|
802
|
+
/* @__PURE__ */ o(
|
|
742
803
|
"p",
|
|
743
804
|
{
|
|
744
805
|
role: "alert",
|
|
745
806
|
className: "dialog-search-status dialog-search-status-error",
|
|
746
|
-
children:
|
|
807
|
+
children: je(s.error)
|
|
747
808
|
}
|
|
748
809
|
),
|
|
749
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ o(
|
|
750
811
|
"button",
|
|
751
812
|
{
|
|
752
813
|
type: "button",
|
|
753
814
|
className: "dialog-search-retry",
|
|
754
|
-
onClick: () =>
|
|
815
|
+
onClick: () => n.retry(),
|
|
755
816
|
children: t.retry
|
|
756
817
|
}
|
|
757
818
|
)
|
|
758
819
|
] });
|
|
759
|
-
if (
|
|
760
|
-
return /* @__PURE__ */
|
|
761
|
-
const
|
|
762
|
-
return /* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
820
|
+
if (i === void 0)
|
|
821
|
+
return /* @__PURE__ */ o("p", { role: "status", className: "dialog-search-status", children: t.searching(s.query) });
|
|
822
|
+
const l = ((g = (m = s.sections) == null ? void 0 : m.collections) == null ? void 0 : g.hits) ?? [], u = j(l).length > 0, p = a !== void 0 && i.nbHits > 0, d = !p && _(s);
|
|
823
|
+
return /* @__PURE__ */ h(C, { children: [
|
|
824
|
+
/* @__PURE__ */ h(
|
|
764
825
|
"div",
|
|
765
826
|
{
|
|
766
827
|
className: `dialog-search-body${u ? "" : " dialog-search-body--no-collections"}`,
|
|
767
828
|
children: [
|
|
768
|
-
/* @__PURE__ */
|
|
769
|
-
|
|
829
|
+
/* @__PURE__ */ o(
|
|
830
|
+
ye,
|
|
770
831
|
{
|
|
771
|
-
collections:
|
|
772
|
-
query:
|
|
832
|
+
collections: l,
|
|
833
|
+
query: i.query,
|
|
773
834
|
messages: t
|
|
774
835
|
}
|
|
775
836
|
),
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
|
|
837
|
+
/* @__PURE__ */ o(
|
|
838
|
+
Se,
|
|
778
839
|
{
|
|
779
|
-
controller:
|
|
780
|
-
response:
|
|
781
|
-
locale:
|
|
840
|
+
controller: n,
|
|
841
|
+
response: i,
|
|
842
|
+
locale: r,
|
|
782
843
|
messages: t
|
|
783
844
|
}
|
|
784
845
|
)
|
|
785
846
|
]
|
|
786
847
|
}
|
|
787
848
|
),
|
|
788
|
-
(p || d) && /* @__PURE__ */
|
|
789
|
-
t.seeAllLabel(
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
] }) : /* @__PURE__ */
|
|
792
|
-
|
|
849
|
+
(p || d) && /* @__PURE__ */ o("div", { className: "dialog-search-footer", children: p ? /* @__PURE__ */ h("a", { className: "dialog-search-cta", href: a(i.query), children: [
|
|
850
|
+
t.seeAllLabel(i.nbHits),
|
|
851
|
+
/* @__PURE__ */ o(ve, {})
|
|
852
|
+
] }) : /* @__PURE__ */ o(
|
|
853
|
+
he,
|
|
793
854
|
{
|
|
794
|
-
controller:
|
|
795
|
-
state:
|
|
796
|
-
locale:
|
|
855
|
+
controller: n,
|
|
856
|
+
state: s,
|
|
857
|
+
locale: r
|
|
797
858
|
}
|
|
798
859
|
) })
|
|
799
860
|
] });
|
|
800
|
-
},
|
|
801
|
-
const { state: t, locale:
|
|
802
|
-
() =>
|
|
803
|
-
[
|
|
861
|
+
}, Ge = (e) => {
|
|
862
|
+
const { state: t, locale: n, theme: s, layout: r = "list" } = e, a = t.status !== L.IDLE, { anchorRef: c, rect: i, viewport: l } = qe(a), { isOpen: u, panelRef: p } = Be(t, c), d = O(n), m = S(
|
|
863
|
+
() => He(s),
|
|
864
|
+
[s]
|
|
804
865
|
);
|
|
805
|
-
return /* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
u &&
|
|
808
|
-
/* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ h(C, { children: [
|
|
867
|
+
/* @__PURE__ */ o("div", { ref: c }),
|
|
868
|
+
u && i !== void 0 && ke(i, l.height) && Z(
|
|
869
|
+
/* @__PURE__ */ o(
|
|
809
870
|
"div",
|
|
810
871
|
{
|
|
811
872
|
ref: p,
|
|
812
|
-
className: `dialog-search-panel dialog-search-panel--${
|
|
873
|
+
className: `dialog-search-panel dialog-search-panel--${r}`,
|
|
813
874
|
style: {
|
|
814
|
-
...
|
|
815
|
-
...
|
|
875
|
+
...Ee(i, l.width, l.height),
|
|
876
|
+
...m
|
|
816
877
|
},
|
|
817
|
-
children:
|
|
878
|
+
children: ze(e, d)
|
|
818
879
|
}
|
|
819
880
|
),
|
|
820
881
|
document.body
|
|
821
882
|
)
|
|
822
883
|
] });
|
|
823
|
-
},
|
|
884
|
+
}, Ve = {
|
|
824
885
|
status: L.IDLE,
|
|
825
886
|
query: "",
|
|
826
887
|
page: 0
|
|
827
|
-
},
|
|
888
|
+
}, Ye = (e) => {
|
|
828
889
|
const t = b(e);
|
|
829
890
|
t.current = e;
|
|
830
|
-
const
|
|
831
|
-
if (
|
|
832
|
-
const { client:
|
|
833
|
-
|
|
834
|
-
search: (d,
|
|
891
|
+
const n = b(void 0), s = P(() => {
|
|
892
|
+
if (n.current === void 0) {
|
|
893
|
+
const { client: l, surface: u = "search_page", ...p } = t.current;
|
|
894
|
+
n.current = W({
|
|
895
|
+
search: (d, m) => l.search(d, m),
|
|
835
896
|
analytics: {
|
|
836
897
|
surface: u,
|
|
837
|
-
trackViewSearchResults: (d) =>
|
|
838
|
-
trackSelectSearchResult: (d) =>
|
|
898
|
+
trackViewSearchResults: (d) => l.trackViewSearchResults(d),
|
|
899
|
+
trackSelectSearchResult: (d) => l.trackSelectSearchResult(d)
|
|
839
900
|
},
|
|
840
901
|
...p
|
|
841
902
|
});
|
|
842
903
|
}
|
|
843
|
-
return
|
|
844
|
-
}, []),
|
|
845
|
-
|
|
846
|
-
setQuery: (
|
|
847
|
-
submit: (
|
|
848
|
-
setPage: (
|
|
849
|
-
retry: () =>
|
|
850
|
-
observeResult: (
|
|
851
|
-
selectResult: (
|
|
852
|
-
subscribe: (
|
|
853
|
-
getState: () =>
|
|
904
|
+
return n.current;
|
|
905
|
+
}, []), r = b(void 0);
|
|
906
|
+
r.current ?? (r.current = {
|
|
907
|
+
setQuery: (l) => s().setQuery(l),
|
|
908
|
+
submit: (l) => s().submit(l),
|
|
909
|
+
setPage: (l) => s().setPage(l),
|
|
910
|
+
retry: () => s().retry(),
|
|
911
|
+
observeResult: (l, u) => s().observeResult(l, u),
|
|
912
|
+
selectResult: (l, u) => s().selectResult(l, u),
|
|
913
|
+
subscribe: (l) => s().subscribe(l),
|
|
914
|
+
getState: () => s().getState(),
|
|
854
915
|
// Create a replacement on next access after disposal.
|
|
855
916
|
dispose: () => {
|
|
856
|
-
var
|
|
857
|
-
(
|
|
917
|
+
var l;
|
|
918
|
+
(l = n.current) == null || l.dispose(), n.current = void 0;
|
|
858
919
|
}
|
|
859
|
-
}),
|
|
860
|
-
|
|
920
|
+
}), f(() => {
|
|
921
|
+
M({
|
|
861
922
|
method: "react",
|
|
862
|
-
version: "2.
|
|
923
|
+
version: "2.8.0"
|
|
863
924
|
});
|
|
864
|
-
const
|
|
925
|
+
const l = s();
|
|
865
926
|
return () => {
|
|
866
|
-
|
|
927
|
+
l.dispose(), n.current === l && (n.current = void 0);
|
|
867
928
|
};
|
|
868
|
-
}, [
|
|
869
|
-
const
|
|
870
|
-
(
|
|
871
|
-
[
|
|
872
|
-
),
|
|
873
|
-
() =>
|
|
874
|
-
[
|
|
875
|
-
),
|
|
929
|
+
}, [s]);
|
|
930
|
+
const a = P(
|
|
931
|
+
(l) => s().subscribe(l),
|
|
932
|
+
[s]
|
|
933
|
+
), c = P(
|
|
934
|
+
() => s().getState(),
|
|
935
|
+
[s]
|
|
936
|
+
), i = K(
|
|
937
|
+
a,
|
|
876
938
|
c,
|
|
877
|
-
|
|
878
|
-
() => _e
|
|
939
|
+
() => Ve
|
|
879
940
|
);
|
|
880
|
-
return { controller:
|
|
941
|
+
return { controller: r.current, state: i, theme: e.client.theme };
|
|
881
942
|
};
|
|
882
943
|
export {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
944
|
+
ne as DialogInput,
|
|
945
|
+
Ze as DialogProductBlock,
|
|
946
|
+
Xe as DialogSearchBar,
|
|
947
|
+
he as DialogSearchPagination,
|
|
948
|
+
be as DialogSearchProductCard,
|
|
949
|
+
Ge as DialogSearchResults,
|
|
950
|
+
Ye as useDialogSearch
|
|
890
951
|
};
|