@askdialog/dialog-vue 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DialogSearch/DialogSearchBar.vue.d.ts +13 -0
- package/dist/components/DialogSearch/DialogSearchPagination.vue.d.ts +7 -0
- package/dist/components/DialogSearch/DialogSearchProductCard.vue.d.ts +10 -0
- package/dist/components/DialogSearch/DialogSearchProductCardContent.vue.d.ts +6 -0
- package/dist/components/DialogSearch/DialogSearchResults.vue.d.ts +10 -0
- package/dist/components/DialogSearch/searchDisplay.d.ts +3 -0
- package/dist/components/DialogSearch/useAnchorRect.d.ts +12 -0
- package/dist/components/DialogSearch/useDialogSearch.d.ts +17 -0
- package/dist/components/DialogSearch/useOutsideDismiss.d.ts +6 -0
- package/dist/components/index.d.ts +6 -1
- package/dist/dialog-vue.css +1 -1
- package/dist/dialog-vue.js +726 -139
- package/dist/dialog-vue.umd.cjs +3 -3
- package/dist/icons/ArrowUpIcon.vue.d.ts +2 -0
- package/dist/icons/ShurikenIcon.vue.d.ts +5 -0
- package/package.json +2 -2
package/dist/dialog-vue.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
1
|
+
var ee = Object.defineProperty;
|
|
2
|
+
var te = (t, e, o) => e in t ? ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
+
var V = (t, e, o) => te(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
import { defineComponent as E, createElementBlock as v, openBlock as f, createElementVNode as d, toDisplayString as k, Fragment as O, renderList as W, createVNode as L, createBlock as N, ref as y, withDirectives as Y, withKeys as oe, vModelText as z, onMounted as B, watch as U, renderSlot as se, computed as I, withCtx as ne, createCommentVNode as x, withModifiers as re, onUnmounted as X, Teleport as ie, normalizeStyle as ae, unref as M, shallowRef as ce } from "vue";
|
|
5
|
+
const le = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), ue = (t) => t !== void 0 && le.has(t.trim().toLowerCase().slice(0, 2)), de = (t) => ue(t) ? "rtl" : "ltr";
|
|
6
|
+
var P;
|
|
4
7
|
(function(t) {
|
|
5
8
|
t.OPEN_ASSISTANT = "open_assistant", t.CLOSE_ASSISTANT = "close_assistant", t.SEND_MESSAGE = "PRODUCT_QUESTION", t.SEND_GENERIC_QUESTION = "GENERIC_QUESTION", t.TRACK_ADD_TO_CART = "TRACK_ADD_TO_CART", t.TRACK_SUBMIT_CHECKOUT = "TRACK_SUBMIT_CHECKOUT", t.TRACK_VIEW_SEARCH_RESULTS = "TRACK_VIEW_SEARCH_RESULTS", t.TRACK_SELECT_SEARCH_RESULT = "TRACK_SELECT_SEARCH_RESULT";
|
|
6
|
-
})(
|
|
7
|
-
var
|
|
9
|
+
})(P || (P = {}));
|
|
10
|
+
var H;
|
|
8
11
|
(function(t) {
|
|
9
12
|
t.USER_OPENED_ASSISTANT = "userOpenedAssistant", t.USER_CLOSED_ASSISTANT = "userClosedAssistant", t.USER_SENT_MESSAGE = "userSentMessage", t.USER_CLICKED_ON_PRODUCT_CARD = "userClickedOnProductCard", t.USER_OPENED_RECOMMENDATION = "userOpenedRecommendation", t.USER_ADDED_TO_CART = "userAddedToCart", t.USER_SEND_POSITIVE_FEEDBACK = "userSendPositiveFeedback", t.USER_SEND_NEGATIVE_FEEDBACK = "userSendNegativeFeedback";
|
|
10
|
-
})(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
})(H || (H = {}));
|
|
14
|
+
P.TRACK_ADD_TO_CART, P.TRACK_SUBMIT_CHECKOUT, P.TRACK_VIEW_SEARCH_RESULTS, P.TRACK_SELECT_SEARCH_RESULT;
|
|
15
|
+
class pe extends Error {
|
|
16
|
+
constructor({ status: o, code: n, message: i }) {
|
|
17
|
+
super(i);
|
|
18
|
+
V(this, "status");
|
|
19
|
+
V(this, "code");
|
|
20
|
+
this.name = "DialogSearchError", this.status = o, this.code = n;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const K = "multiple installation methods detected:", _e = () => typeof window > "u" ? void 0 : window, Z = () => {
|
|
24
|
+
const t = _e();
|
|
14
25
|
if (t !== void 0)
|
|
15
26
|
return t.dialog = t.dialog ?? {}, t.dialog.audit = t.dialog.audit ?? {
|
|
16
27
|
methods: [],
|
|
@@ -18,28 +29,225 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
|
|
|
18
29
|
capabilities: [],
|
|
19
30
|
warnings: []
|
|
20
31
|
}, t.dialog.audit;
|
|
21
|
-
},
|
|
22
|
-
if (t.warnings = t.warnings.filter((e) => !e.startsWith(
|
|
32
|
+
}, he = (t) => {
|
|
33
|
+
if (t.warnings = t.warnings.filter((e) => !e.startsWith(K)), t.methods.length >= 2) {
|
|
23
34
|
const e = t.methods.map((o) => o.method).join(", ");
|
|
24
|
-
t.warnings.push(`${
|
|
35
|
+
t.warnings.push(`${K} ${e}`);
|
|
25
36
|
}
|
|
26
|
-
},
|
|
37
|
+
}, fe = (t, e) => e === void 0 ? t : {
|
|
27
38
|
version: (t == null ? void 0 : t.version) ?? e.version,
|
|
28
39
|
commit: (t == null ? void 0 : t.commit) ?? e.commit
|
|
29
|
-
},
|
|
30
|
-
const e =
|
|
40
|
+
}, J = (t) => {
|
|
41
|
+
const e = Z();
|
|
31
42
|
if (e === void 0)
|
|
32
43
|
return;
|
|
33
44
|
const o = e.methods.find((n) => n.method === t.method);
|
|
34
45
|
if (o === void 0) {
|
|
35
|
-
e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
46
|
+
e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), he(e);
|
|
36
47
|
return;
|
|
37
48
|
}
|
|
38
|
-
o.version = o.version ?? t.version, o.build =
|
|
39
|
-
},
|
|
40
|
-
const e =
|
|
49
|
+
o.version = o.version ?? t.version, o.build = fe(o.build, t.build), o.source = o.source ?? t.source;
|
|
50
|
+
}, ge = (t) => {
|
|
51
|
+
const e = Z();
|
|
41
52
|
e !== void 0 && (e.capabilities.includes(t) || e.capabilities.push(t));
|
|
42
|
-
},
|
|
53
|
+
}, R = {
|
|
54
|
+
IDLE: "idle",
|
|
55
|
+
LOADING: "loading",
|
|
56
|
+
SUCCESS: "success",
|
|
57
|
+
/** The request succeeded with zero hits — distinct from `success` so views render a no-results state. */
|
|
58
|
+
EMPTY: "empty",
|
|
59
|
+
ERROR: "error"
|
|
60
|
+
}, ve = 0.5, me = 500, Se = 1500, Ce = 100;
|
|
61
|
+
function be({ emit: t, visibilityThreshold: e = ve, dwellMs: o = me, idleFlushMs: n = Se, maxItemsPerEvent: i = Ce }) {
|
|
62
|
+
let s, r = [];
|
|
63
|
+
const a = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
|
|
64
|
+
let u;
|
|
65
|
+
const h = () => {
|
|
66
|
+
clearTimeout(u), !(s === void 0 || r.length === 0) && (t({ ...s, items: r }), r = []);
|
|
67
|
+
}, m = (c) => {
|
|
68
|
+
if (s === void 0)
|
|
69
|
+
return;
|
|
70
|
+
const l = `${s.query_id}:${c.product_id}`;
|
|
71
|
+
if (!a.has(l)) {
|
|
72
|
+
if (a.add(l), r.push(c), r.length >= i) {
|
|
73
|
+
h();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
clearTimeout(u), u = setTimeout(h, n);
|
|
77
|
+
}
|
|
78
|
+
}, C = (c) => {
|
|
79
|
+
const l = _.get(c);
|
|
80
|
+
l !== void 0 && (clearTimeout(l), _.delete(c));
|
|
81
|
+
}, p = new IntersectionObserver((c) => {
|
|
82
|
+
for (const l of c) {
|
|
83
|
+
const T = g.get(l.target);
|
|
84
|
+
T !== void 0 && (l.intersectionRatio >= e ? _.has(l.target) || _.set(l.target, setTimeout(() => {
|
|
85
|
+
_.delete(l.target), m(T);
|
|
86
|
+
}, o)) : C(l.target));
|
|
87
|
+
}
|
|
88
|
+
}, { threshold: e }), b = () => {
|
|
89
|
+
p.disconnect();
|
|
90
|
+
for (const c of _.values())
|
|
91
|
+
clearTimeout(c);
|
|
92
|
+
_.clear(), g.clear();
|
|
93
|
+
}, S = () => {
|
|
94
|
+
h();
|
|
95
|
+
}, w = (c) => {
|
|
96
|
+
if (c.persisted) {
|
|
97
|
+
a.clear();
|
|
98
|
+
for (const l of g.keys())
|
|
99
|
+
C(l), p.unobserve(l), p.observe(l);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return window.addEventListener("pagehide", S), window.addEventListener("pageshow", w), {
|
|
103
|
+
setContext(c) {
|
|
104
|
+
h(), s !== void 0 && s.query_id !== c.query_id && a.clear(), s = c, b();
|
|
105
|
+
},
|
|
106
|
+
observe(c, l) {
|
|
107
|
+
g.set(c, l), p.observe(c);
|
|
108
|
+
},
|
|
109
|
+
forceImpression(c) {
|
|
110
|
+
m(c), h();
|
|
111
|
+
},
|
|
112
|
+
flush: h,
|
|
113
|
+
disconnect() {
|
|
114
|
+
h(), b(), window.removeEventListener("pagehide", S), window.removeEventListener("pageshow", w);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const F = (t, e) => ({
|
|
119
|
+
product_id: t.hits[e].product.id,
|
|
120
|
+
// 1-based and absolute across pages (page 2, first item, 20/page → 21).
|
|
121
|
+
position: t.page * t.hitsPerPage + e + 1
|
|
122
|
+
});
|
|
123
|
+
function Ee(t) {
|
|
124
|
+
let e, o;
|
|
125
|
+
const n = () => (e ?? (e = be({
|
|
126
|
+
emit: t.trackViewSearchResults
|
|
127
|
+
})), e);
|
|
128
|
+
return {
|
|
129
|
+
onResponse(i) {
|
|
130
|
+
o = {
|
|
131
|
+
// Straight off the response: the controller resends the previous
|
|
132
|
+
// queryId while the query text is unchanged, so the id is stable
|
|
133
|
+
// across pagination and rotates with the query.
|
|
134
|
+
query_id: i.queryId,
|
|
135
|
+
surface: t.surface,
|
|
136
|
+
// Analytics pages are 1-based; the wire response is 0-based.
|
|
137
|
+
page: i.page + 1,
|
|
138
|
+
total_hits: i.nbHits,
|
|
139
|
+
query_length: [...i.query].length
|
|
140
|
+
}, n().setContext(o), i.nbHits === 0 && t.trackViewSearchResults({ ...o, items: [] });
|
|
141
|
+
},
|
|
142
|
+
observeResult(i, s, r) {
|
|
143
|
+
n().observe(i, F(s, r));
|
|
144
|
+
},
|
|
145
|
+
select(i, s) {
|
|
146
|
+
if (o === void 0)
|
|
147
|
+
return;
|
|
148
|
+
const r = F(i, s);
|
|
149
|
+
n().forceImpression(r), t.trackSelectSearchResult({ ...o, items: [r] });
|
|
150
|
+
},
|
|
151
|
+
dispose() {
|
|
152
|
+
e == null || e.disconnect();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const Te = 250, Ie = 12, we = 2, G = {
|
|
157
|
+
status: R.IDLE,
|
|
158
|
+
query: "",
|
|
159
|
+
page: 0,
|
|
160
|
+
response: void 0,
|
|
161
|
+
error: void 0
|
|
162
|
+
};
|
|
163
|
+
function ke({ search: t, analytics: e, navigate: o, debounceMs: n = Te, hitsPerPage: i = Ie }) {
|
|
164
|
+
let s = G;
|
|
165
|
+
const r = /* @__PURE__ */ new Set(), a = Ee(e);
|
|
166
|
+
let g, _, u, h = 0, m = !1;
|
|
167
|
+
const C = (c) => {
|
|
168
|
+
s = { ...s, ...c };
|
|
169
|
+
for (const l of r)
|
|
170
|
+
l(s);
|
|
171
|
+
}, p = () => {
|
|
172
|
+
clearTimeout(g), u == null || u.abort(), u = void 0;
|
|
173
|
+
}, b = (c, l) => {
|
|
174
|
+
const T = { query: c, page: l, hitsPerPage: i }, A = s.response;
|
|
175
|
+
return (A == null ? void 0 : A.query) === c && (T.queryId = A.queryId), T;
|
|
176
|
+
}, S = async (c, l) => {
|
|
177
|
+
p(), u = new AbortController();
|
|
178
|
+
const T = ++h, A = b(c, l);
|
|
179
|
+
C({ status: R.LOADING, query: c, page: l });
|
|
180
|
+
try {
|
|
181
|
+
const $ = await t(A, {
|
|
182
|
+
signal: u.signal
|
|
183
|
+
});
|
|
184
|
+
if (T !== h)
|
|
185
|
+
return;
|
|
186
|
+
a.onResponse($), C({
|
|
187
|
+
status: $.nbHits === 0 ? R.EMPTY : R.SUCCESS,
|
|
188
|
+
response: $,
|
|
189
|
+
error: void 0
|
|
190
|
+
});
|
|
191
|
+
} catch ($) {
|
|
192
|
+
if ($ instanceof DOMException && $.name === "AbortError" || T !== h)
|
|
193
|
+
return;
|
|
194
|
+
C({ status: R.ERROR, error: $, response: void 0 });
|
|
195
|
+
}
|
|
196
|
+
}, w = (c) => {
|
|
197
|
+
const l = c.trim();
|
|
198
|
+
if (p(), _ = void 0, [...l].length < we) {
|
|
199
|
+
h += 1, C(G);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
return l;
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
setQuery(c) {
|
|
206
|
+
const l = m ? void 0 : w(c);
|
|
207
|
+
l !== void 0 && (_ = l, g = setTimeout(() => {
|
|
208
|
+
_ = void 0, S(l, 0);
|
|
209
|
+
}, n));
|
|
210
|
+
},
|
|
211
|
+
submit(c) {
|
|
212
|
+
const l = m ? void 0 : w(c);
|
|
213
|
+
l !== void 0 && S(l, 0);
|
|
214
|
+
},
|
|
215
|
+
setPage(c) {
|
|
216
|
+
if (!m) {
|
|
217
|
+
if (_ !== void 0) {
|
|
218
|
+
const l = _;
|
|
219
|
+
_ = void 0, S(l, 0);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
s.query !== "" && S(s.query, c);
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
retry() {
|
|
226
|
+
m || s.status !== R.ERROR || S(s.query, s.page);
|
|
227
|
+
},
|
|
228
|
+
observeResult(c, l) {
|
|
229
|
+
s.response !== void 0 && a.observeResult(c, s.response, l);
|
|
230
|
+
},
|
|
231
|
+
selectResult(c, l) {
|
|
232
|
+
const T = s.response;
|
|
233
|
+
if (T === void 0)
|
|
234
|
+
return !1;
|
|
235
|
+
a.select(T, c);
|
|
236
|
+
const A = T.hits[c].product.url;
|
|
237
|
+
return ((l == null ? void 0 : l.navigate) ?? !0) && o !== void 0 && A !== void 0 ? (o(A, T.hits[c]), !0) : !1;
|
|
238
|
+
},
|
|
239
|
+
subscribe(c) {
|
|
240
|
+
return r.add(c), () => {
|
|
241
|
+
r.delete(c);
|
|
242
|
+
};
|
|
243
|
+
},
|
|
244
|
+
getState: () => s,
|
|
245
|
+
dispose() {
|
|
246
|
+
m = !0, p(), h += 1, _ = void 0, r.clear(), a.dispose();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
const Re = { class: "dialog-block-header-container" }, ye = { class: "dialog-block-title" }, Ae = { class: "dialog-block-description" }, Le = /* @__PURE__ */ E({
|
|
43
251
|
__name: "DialogBlockHeader",
|
|
44
252
|
props: {
|
|
45
253
|
title: {},
|
|
@@ -47,32 +255,32 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
|
|
|
47
255
|
},
|
|
48
256
|
setup(t) {
|
|
49
257
|
const e = t;
|
|
50
|
-
return (o, n) => (
|
|
51
|
-
|
|
52
|
-
|
|
258
|
+
return (o, n) => (f(), v("div", Re, [
|
|
259
|
+
d("div", ye, k(e.title ?? "Your expert"), 1),
|
|
260
|
+
d("div", Ae, k(e.description ?? "A question about this product?"), 1)
|
|
53
261
|
]));
|
|
54
262
|
}
|
|
55
|
-
}),
|
|
263
|
+
}), D = (t, e) => {
|
|
56
264
|
const o = t.__vccOpts || t;
|
|
57
|
-
for (const [n,
|
|
58
|
-
o[n] =
|
|
265
|
+
for (const [n, i] of e)
|
|
266
|
+
o[n] = i;
|
|
59
267
|
return o;
|
|
60
|
-
},
|
|
268
|
+
}, $e = /* @__PURE__ */ D(Le, [["__scopeId", "data-v-28e6dda7"]]), De = {
|
|
61
269
|
width: "20",
|
|
62
270
|
height: "20",
|
|
63
271
|
viewBox: "0 0 20 20",
|
|
64
272
|
fill: "none",
|
|
65
273
|
xmlns: "http://www.w3.org/2000/svg"
|
|
66
|
-
},
|
|
274
|
+
}, Pe = { "clip-path": "url(#clip0_466_934)" }, Oe = ["stroke"], Ne = ["stroke"], Ue = /* @__PURE__ */ E({
|
|
67
275
|
__name: "AiStarsIcon",
|
|
68
276
|
props: {
|
|
69
277
|
color: {}
|
|
70
278
|
},
|
|
71
279
|
setup(t) {
|
|
72
280
|
const e = t;
|
|
73
|
-
return (o, n) => (
|
|
74
|
-
|
|
75
|
-
|
|
281
|
+
return (o, n) => (f(), v("svg", De, [
|
|
282
|
+
d("g", Pe, [
|
|
283
|
+
d("path", {
|
|
76
284
|
d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
|
|
77
285
|
12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
|
|
78
286
|
13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
|
|
@@ -87,8 +295,8 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
|
|
|
87
295
|
"stroke-width": "1.5",
|
|
88
296
|
"stroke-linecap": "round",
|
|
89
297
|
"stroke-linejoin": "round"
|
|
90
|
-
}, null, 8,
|
|
91
|
-
|
|
298
|
+
}, null, 8, Oe),
|
|
299
|
+
d("path", {
|
|
92
300
|
d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
|
|
93
301
|
5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
|
|
94
302
|
6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
|
|
@@ -103,11 +311,11 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
|
|
|
103
311
|
"stroke-width": "1.5",
|
|
104
312
|
"stroke-linecap": "round",
|
|
105
313
|
"stroke-linejoin": "round"
|
|
106
|
-
}, null, 8,
|
|
314
|
+
}, null, 8, Ne)
|
|
107
315
|
]),
|
|
108
|
-
n[0] || (n[0] =
|
|
109
|
-
|
|
110
|
-
|
|
316
|
+
n[0] || (n[0] = d("defs", null, [
|
|
317
|
+
d("clipPath", { id: "clip0_466_934" }, [
|
|
318
|
+
d("rect", {
|
|
111
319
|
width: "20",
|
|
112
320
|
height: "20",
|
|
113
321
|
fill: "white"
|
|
@@ -116,7 +324,7 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
|
|
|
116
324
|
], -1))
|
|
117
325
|
]));
|
|
118
326
|
}
|
|
119
|
-
}),
|
|
327
|
+
}), xe = ["onClick"], Me = { class: "dialog-block-suggestions-item-label" }, qe = /* @__PURE__ */ E({
|
|
120
328
|
__name: "DialogBlockSuggestions",
|
|
121
329
|
props: {
|
|
122
330
|
client: {},
|
|
@@ -135,27 +343,27 @@ const R = "multiple installation methods detected:", q = () => typeof window > "
|
|
|
135
343
|
fromQuestionSuggestion: !0
|
|
136
344
|
});
|
|
137
345
|
};
|
|
138
|
-
return (n,
|
|
139
|
-
key:
|
|
346
|
+
return (n, i) => (f(!0), v(O, null, W(e.questions, (s) => (f(), v("button", {
|
|
347
|
+
key: s.question,
|
|
140
348
|
class: "dialog-block-suggestions-item",
|
|
141
|
-
onClick: (r) => o(
|
|
349
|
+
onClick: (r) => o(s.question)
|
|
142
350
|
}, [
|
|
143
|
-
|
|
351
|
+
L(Ue, {
|
|
144
352
|
class: "dialog-block-suggestions-item-icon",
|
|
145
353
|
color: e.client.theme.primaryColor
|
|
146
354
|
}, null, 8, ["color"]),
|
|
147
|
-
|
|
148
|
-
], 8,
|
|
355
|
+
d("span", Me, k(s.question), 1)
|
|
356
|
+
], 8, xe))), 128));
|
|
149
357
|
}
|
|
150
|
-
}),
|
|
151
|
-
function
|
|
152
|
-
return
|
|
153
|
-
e[0] || (e[0] =
|
|
154
|
-
e[1] || (e[1] =
|
|
155
|
-
e[2] || (e[2] =
|
|
358
|
+
}), Be = /* @__PURE__ */ D(qe, [["__scopeId", "data-v-db34d4b4"]]), Ve = {};
|
|
359
|
+
function He(t, e) {
|
|
360
|
+
return f(), v(O, null, [
|
|
361
|
+
e[0] || (e[0] = d("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
|
|
362
|
+
e[1] || (e[1] = d("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
|
|
363
|
+
e[2] || (e[2] = d("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
|
|
156
364
|
], 64);
|
|
157
365
|
}
|
|
158
|
-
const
|
|
366
|
+
const Ke = /* @__PURE__ */ D(Ve, [["render", He], ["__scopeId", "data-v-26a64b58"]]), Fe = { class: "dialog-block-suggestions-container" }, Ge = /* @__PURE__ */ E({
|
|
159
367
|
__name: "DialogBlockSuggestionsContainer",
|
|
160
368
|
props: {
|
|
161
369
|
client: {},
|
|
@@ -167,8 +375,8 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
|
|
|
167
375
|
},
|
|
168
376
|
setup(t) {
|
|
169
377
|
const e = t;
|
|
170
|
-
return (o, n) => (
|
|
171
|
-
e.isLoading || !e.questions ? (
|
|
378
|
+
return (o, n) => (f(), v("div", Fe, [
|
|
379
|
+
e.isLoading || !e.questions ? (f(), N(Ke, { key: 0 })) : (f(), N(Be, {
|
|
172
380
|
key: 1,
|
|
173
381
|
client: e.client,
|
|
174
382
|
questions: e.questions,
|
|
@@ -178,30 +386,30 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
|
|
|
178
386
|
}, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
|
|
179
387
|
]));
|
|
180
388
|
}
|
|
181
|
-
}),
|
|
389
|
+
}), Qe = /* @__PURE__ */ D(Ge, [["__scopeId", "data-v-18c9e78b"]]), je = {
|
|
182
390
|
width: "20",
|
|
183
391
|
height: "20",
|
|
184
392
|
viewBox: "0 0 20 20",
|
|
185
393
|
fill: "none",
|
|
186
394
|
xmlns: "http://www.w3.org/2000/svg"
|
|
187
|
-
},
|
|
395
|
+
}, We = ["stroke"], Ye = /* @__PURE__ */ E({
|
|
188
396
|
__name: "ArrowIcon",
|
|
189
397
|
props: {
|
|
190
398
|
color: {}
|
|
191
399
|
},
|
|
192
400
|
setup(t) {
|
|
193
401
|
const e = t;
|
|
194
|
-
return (o, n) => (
|
|
195
|
-
|
|
402
|
+
return (o, n) => (f(), v("svg", je, [
|
|
403
|
+
d("path", {
|
|
196
404
|
d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
|
|
197
405
|
stroke: e.color || "#ffffff",
|
|
198
406
|
"stroke-width": "1.5",
|
|
199
407
|
"stroke-linecap": "round",
|
|
200
408
|
"stroke-linejoin": "round"
|
|
201
|
-
}, null, 8,
|
|
409
|
+
}, null, 8, We)
|
|
202
410
|
]));
|
|
203
411
|
}
|
|
204
|
-
}),
|
|
412
|
+
}), ze = ["placeholder"], Xe = ["disabled"], Ze = /* @__PURE__ */ E({
|
|
205
413
|
__name: "DialogInput",
|
|
206
414
|
props: {
|
|
207
415
|
client: {},
|
|
@@ -211,10 +419,10 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
|
|
|
211
419
|
selectedVariantId: {}
|
|
212
420
|
},
|
|
213
421
|
setup(t) {
|
|
214
|
-
const e = t, o =
|
|
422
|
+
const e = t, o = y(), n = y(""), i = () => {
|
|
215
423
|
var r;
|
|
216
424
|
(r = o.value) == null || r.focus();
|
|
217
|
-
},
|
|
425
|
+
}, s = () => {
|
|
218
426
|
const r = n.value;
|
|
219
427
|
r.trim() && (e.client.sendProductMessage({
|
|
220
428
|
productId: e.productId,
|
|
@@ -224,80 +432,80 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
|
|
|
224
432
|
fromQuestionSuggestion: !0
|
|
225
433
|
}), n.value = "");
|
|
226
434
|
};
|
|
227
|
-
return (r,
|
|
435
|
+
return (r, a) => (f(), v("div", {
|
|
228
436
|
class: "dialog-input-wrapper",
|
|
229
|
-
onClick:
|
|
437
|
+
onClick: i
|
|
230
438
|
}, [
|
|
231
|
-
|
|
439
|
+
Y(d("input", {
|
|
232
440
|
id: "dialog-ask-anything-input-ai-input",
|
|
233
441
|
ref_key: "inputRef",
|
|
234
442
|
ref: o,
|
|
235
|
-
"onUpdate:modelValue":
|
|
443
|
+
"onUpdate:modelValue": a[0] || (a[0] = (g) => n.value = g),
|
|
236
444
|
class: "dialog-ask-anything-input-ai-input",
|
|
237
445
|
placeholder: e.placeholder ?? "Ask anything...",
|
|
238
|
-
onKeydown:
|
|
239
|
-
}, null, 40,
|
|
240
|
-
[
|
|
446
|
+
onKeydown: oe(s, ["enter"])
|
|
447
|
+
}, null, 40, ze), [
|
|
448
|
+
[z, n.value]
|
|
241
449
|
]),
|
|
242
|
-
|
|
450
|
+
d("button", {
|
|
243
451
|
id: "send-message-button-ai-input",
|
|
244
452
|
class: "dialog-input-submit",
|
|
245
453
|
disabled: !n.value.trim(),
|
|
246
|
-
onClick:
|
|
454
|
+
onClick: s
|
|
247
455
|
}, [
|
|
248
|
-
|
|
456
|
+
L(Ye, {
|
|
249
457
|
color: e.client.theme.ctaTextColor
|
|
250
458
|
}, null, 8, ["color"])
|
|
251
|
-
], 8,
|
|
459
|
+
], 8, Xe)
|
|
252
460
|
]));
|
|
253
461
|
}
|
|
254
|
-
}),
|
|
462
|
+
}), Je = /* @__PURE__ */ D(Ze, [["__scopeId", "data-v-4f5901c9"]]), et = /* @__PURE__ */ E({
|
|
255
463
|
__name: "ThemeProvider",
|
|
256
464
|
props: {
|
|
257
465
|
theme: {}
|
|
258
466
|
},
|
|
259
467
|
setup(t) {
|
|
260
|
-
const e = t, o = document.body, n = (
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
if (typeof
|
|
265
|
-
Object.keys(
|
|
266
|
-
var
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
const
|
|
468
|
+
const e = t, o = document.body, n = (s) => s.replace(/([A-Z])/g, "-$1").toLowerCase(), i = (s) => {
|
|
469
|
+
s && Object.keys(s).forEach((r) => {
|
|
470
|
+
const a = r, g = n(r);
|
|
471
|
+
if (s[a] !== void 0) {
|
|
472
|
+
if (typeof s[a] == "object") {
|
|
473
|
+
Object.keys(s[a]).forEach((_) => {
|
|
474
|
+
var h;
|
|
475
|
+
const u = _;
|
|
476
|
+
if (u !== void 0) {
|
|
477
|
+
const m = n(_), C = s[a];
|
|
270
478
|
o.style.setProperty(
|
|
271
|
-
`--dialog-theme-${
|
|
272
|
-
(
|
|
479
|
+
`--dialog-theme-${g}-${m}`,
|
|
480
|
+
(h = C[u]) == null ? void 0 : h.toString()
|
|
273
481
|
);
|
|
274
482
|
}
|
|
275
483
|
});
|
|
276
484
|
return;
|
|
277
485
|
}
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
o.style.setProperty(`--dialog-theme-${
|
|
486
|
+
if (a === "ctaBorderType") {
|
|
487
|
+
const _ = s[a] === "rounded" ? "24px" : "0";
|
|
488
|
+
o.style.setProperty(`--dialog-theme-${g}`, _);
|
|
281
489
|
return;
|
|
282
490
|
}
|
|
283
491
|
o.style.setProperty(
|
|
284
|
-
`--dialog-theme-${
|
|
285
|
-
|
|
492
|
+
`--dialog-theme-${g}`,
|
|
493
|
+
s[a].toString()
|
|
286
494
|
);
|
|
287
495
|
}
|
|
288
496
|
});
|
|
289
497
|
};
|
|
290
|
-
return
|
|
291
|
-
e.theme &&
|
|
292
|
-
}),
|
|
498
|
+
return B(() => {
|
|
499
|
+
e.theme && i(e.theme);
|
|
500
|
+
}), U(
|
|
293
501
|
() => e.theme,
|
|
294
|
-
(
|
|
295
|
-
|
|
502
|
+
(s) => {
|
|
503
|
+
s && i(s);
|
|
296
504
|
},
|
|
297
505
|
{ deep: !0 }
|
|
298
|
-
), (
|
|
506
|
+
), (s, r) => se(s.$slots, "default");
|
|
299
507
|
}
|
|
300
|
-
}),
|
|
508
|
+
}), tt = ["dir"], ot = /* @__PURE__ */ E({
|
|
301
509
|
__name: "DialogProductBlock",
|
|
302
510
|
props: {
|
|
303
511
|
client: {},
|
|
@@ -308,85 +516,464 @@ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58
|
|
|
308
516
|
},
|
|
309
517
|
setup(t) {
|
|
310
518
|
const e = t;
|
|
311
|
-
|
|
312
|
-
|
|
519
|
+
B(() => {
|
|
520
|
+
J({
|
|
313
521
|
method: "vue",
|
|
314
|
-
version: "3.
|
|
315
|
-
}),
|
|
522
|
+
version: "3.3.0"
|
|
523
|
+
}), ge("pdp-block");
|
|
316
524
|
});
|
|
317
|
-
const o =
|
|
318
|
-
var
|
|
319
|
-
return o.value ? "" : (
|
|
320
|
-
}), r =
|
|
321
|
-
var
|
|
322
|
-
return o.value ? "" : (
|
|
323
|
-
}),
|
|
324
|
-
var
|
|
325
|
-
return o.value ? "" : (
|
|
326
|
-
}),
|
|
525
|
+
const o = y(!0), n = y(void 0), i = y(0), s = I(() => {
|
|
526
|
+
var u;
|
|
527
|
+
return o.value ? "" : (u = n.value) == null ? void 0 : u.assistantName;
|
|
528
|
+
}), r = I(() => {
|
|
529
|
+
var u;
|
|
530
|
+
return o.value ? "" : (u = n.value) == null ? void 0 : u.description;
|
|
531
|
+
}), a = I(() => {
|
|
532
|
+
var u;
|
|
533
|
+
return o.value ? "" : (u = n.value) == null ? void 0 : u.inputPlaceholder;
|
|
534
|
+
}), g = I(
|
|
327
535
|
() => {
|
|
328
|
-
var
|
|
329
|
-
return
|
|
330
|
-
(
|
|
536
|
+
var u;
|
|
537
|
+
return de(
|
|
538
|
+
(u = e.client.getLocalizationInformations()) == null ? void 0 : u.languageCode
|
|
331
539
|
);
|
|
332
540
|
}
|
|
333
|
-
),
|
|
334
|
-
const
|
|
541
|
+
), _ = async () => {
|
|
542
|
+
const u = ++i.value;
|
|
335
543
|
o.value = !0, n.value = void 0;
|
|
336
544
|
try {
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
} catch (
|
|
340
|
-
console.error("error",
|
|
545
|
+
const h = await e.client.getSuggestions(e.productId);
|
|
546
|
+
u === i.value && (n.value = h);
|
|
547
|
+
} catch (h) {
|
|
548
|
+
console.error("error", h);
|
|
341
549
|
} finally {
|
|
342
|
-
|
|
550
|
+
u === i.value && (o.value = !1);
|
|
343
551
|
}
|
|
344
552
|
};
|
|
345
|
-
return
|
|
553
|
+
return U(
|
|
346
554
|
() => [e.client, e.productId],
|
|
347
555
|
() => {
|
|
348
|
-
|
|
556
|
+
_();
|
|
349
557
|
},
|
|
350
558
|
{ immediate: !0 }
|
|
351
|
-
), (
|
|
559
|
+
), (u, h) => (f(), N(et, {
|
|
352
560
|
theme: e.client.theme
|
|
353
561
|
}, {
|
|
354
|
-
default:
|
|
355
|
-
var
|
|
562
|
+
default: ne(() => {
|
|
563
|
+
var m;
|
|
356
564
|
return [
|
|
357
|
-
|
|
565
|
+
d("div", {
|
|
358
566
|
id: "dialog-instant",
|
|
359
567
|
class: "dialog-block-container",
|
|
360
|
-
dir:
|
|
568
|
+
dir: g.value
|
|
361
569
|
}, [
|
|
362
|
-
|
|
363
|
-
title:
|
|
570
|
+
L($e, {
|
|
571
|
+
title: s.value,
|
|
364
572
|
description: r.value
|
|
365
573
|
}, null, 8, ["title", "description"]),
|
|
366
|
-
|
|
574
|
+
L(Qe, {
|
|
367
575
|
client: e.client,
|
|
368
|
-
questions: (
|
|
576
|
+
questions: (m = n.value) == null ? void 0 : m.questions,
|
|
369
577
|
"is-loading": o.value,
|
|
370
578
|
"product-id": e.productId,
|
|
371
579
|
"product-title": e.productTitle,
|
|
372
580
|
"selected-variant-id": e == null ? void 0 : e.selectedVariantId
|
|
373
581
|
}, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
|
|
374
|
-
e.enableInput ? (
|
|
582
|
+
e.enableInput ? (f(), N(Je, {
|
|
375
583
|
key: 0,
|
|
376
584
|
client: e.client,
|
|
377
|
-
placeholder:
|
|
585
|
+
placeholder: a.value,
|
|
378
586
|
"product-id": e.productId,
|
|
379
587
|
"product-title": e.productTitle,
|
|
380
588
|
"selected-variant-id": e == null ? void 0 : e.selectedVariantId
|
|
381
|
-
}, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) :
|
|
382
|
-
], 8,
|
|
589
|
+
}, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : x("", !0)
|
|
590
|
+
], 8, tt)
|
|
383
591
|
];
|
|
384
592
|
}),
|
|
385
593
|
_: 1
|
|
386
594
|
}, 8, ["theme"]));
|
|
387
595
|
}
|
|
388
|
-
}),
|
|
596
|
+
}), Bt = /* @__PURE__ */ D(ot, [["__scopeId", "data-v-c57aa677"]]), st = {}, nt = {
|
|
597
|
+
width: "16",
|
|
598
|
+
height: "16",
|
|
599
|
+
viewBox: "0 0 16 16",
|
|
600
|
+
fill: "none",
|
|
601
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
602
|
+
"aria-hidden": "true"
|
|
603
|
+
};
|
|
604
|
+
function rt(t, e) {
|
|
605
|
+
return f(), v("svg", nt, e[0] || (e[0] = [
|
|
606
|
+
d("path", {
|
|
607
|
+
d: "M8 13V3M8 3L3 8M8 3L13 8",
|
|
608
|
+
stroke: "currentColor",
|
|
609
|
+
"stroke-width": "1.5",
|
|
610
|
+
"stroke-linecap": "round",
|
|
611
|
+
"stroke-linejoin": "round"
|
|
612
|
+
}, null, -1)
|
|
613
|
+
]));
|
|
614
|
+
}
|
|
615
|
+
const it = /* @__PURE__ */ D(st, [["render", rt]]), at = {
|
|
616
|
+
width: "16",
|
|
617
|
+
height: "16",
|
|
618
|
+
viewBox: "0 0 12 12",
|
|
619
|
+
fill: "none",
|
|
620
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
621
|
+
"aria-hidden": "true"
|
|
622
|
+
}, ct = ["fill"], lt = "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", ut = /* @__PURE__ */ E({
|
|
623
|
+
__name: "ShurikenIcon",
|
|
624
|
+
props: {
|
|
625
|
+
color: {}
|
|
626
|
+
},
|
|
627
|
+
setup(t) {
|
|
628
|
+
const e = t;
|
|
629
|
+
return (o, n) => (f(), v("svg", at, [
|
|
630
|
+
d("path", {
|
|
631
|
+
d: lt,
|
|
632
|
+
fill: e.color || "currentColor"
|
|
633
|
+
}, null, 8, ct)
|
|
634
|
+
]));
|
|
635
|
+
}
|
|
636
|
+
}), dt = { class: "dialog-search-bar-field" }, pt = { class: "dialog-search-bar-icon" }, _t = ["aria-label", "placeholder", "autofocus"], ht = ["aria-label"], Vt = /* @__PURE__ */ E({
|
|
637
|
+
__name: "DialogSearchBar",
|
|
638
|
+
props: {
|
|
639
|
+
controller: {},
|
|
640
|
+
placeholder: { default: "Search products..." },
|
|
641
|
+
autoFocus: { type: Boolean, default: !1 },
|
|
642
|
+
submitAriaLabel: { default: "Search" }
|
|
643
|
+
},
|
|
644
|
+
setup(t) {
|
|
645
|
+
const e = t, o = y(""), n = () => {
|
|
646
|
+
e.controller.setQuery(o.value);
|
|
647
|
+
}, i = () => {
|
|
648
|
+
e.controller.submit(o.value);
|
|
649
|
+
};
|
|
650
|
+
return (s, r) => (f(), v("form", {
|
|
651
|
+
class: "dialog-search-bar",
|
|
652
|
+
role: "search",
|
|
653
|
+
onSubmit: re(i, ["prevent"])
|
|
654
|
+
}, [
|
|
655
|
+
d("div", dt, [
|
|
656
|
+
d("span", pt, [
|
|
657
|
+
L(ut)
|
|
658
|
+
]),
|
|
659
|
+
Y(d("input", {
|
|
660
|
+
"onUpdate:modelValue": r[0] || (r[0] = (a) => o.value = a),
|
|
661
|
+
type: "text",
|
|
662
|
+
name: "dialog-search-query",
|
|
663
|
+
class: "dialog-search-bar-input",
|
|
664
|
+
"aria-label": e.placeholder,
|
|
665
|
+
placeholder: e.placeholder,
|
|
666
|
+
autofocus: e.autoFocus,
|
|
667
|
+
onInput: n
|
|
668
|
+
}, null, 40, _t), [
|
|
669
|
+
[z, o.value]
|
|
670
|
+
])
|
|
671
|
+
]),
|
|
672
|
+
d("button", {
|
|
673
|
+
type: "submit",
|
|
674
|
+
class: "dialog-search-bar-submit",
|
|
675
|
+
"aria-label": e.submitAriaLabel
|
|
676
|
+
}, [
|
|
677
|
+
L(it)
|
|
678
|
+
], 8, ht)
|
|
679
|
+
], 32));
|
|
680
|
+
}
|
|
681
|
+
}), ft = {
|
|
682
|
+
key: 0,
|
|
683
|
+
"aria-label": "Search results pages",
|
|
684
|
+
class: "dialog-search-pagination"
|
|
685
|
+
}, gt = ["disabled"], vt = ["disabled"], mt = /* @__PURE__ */ E({
|
|
686
|
+
__name: "DialogSearchPagination",
|
|
687
|
+
props: {
|
|
688
|
+
controller: {},
|
|
689
|
+
state: {}
|
|
690
|
+
},
|
|
691
|
+
setup(t) {
|
|
692
|
+
const e = t, o = I(() => e.state.response);
|
|
693
|
+
return (n, i) => o.value !== void 0 && o.value.nbPages > 1 ? (f(), v("nav", ft, [
|
|
694
|
+
d("button", {
|
|
695
|
+
type: "button",
|
|
696
|
+
disabled: o.value.page === 0,
|
|
697
|
+
onClick: i[0] || (i[0] = (s) => e.controller.setPage(o.value.page - 1))
|
|
698
|
+
}, " Previous ", 8, gt),
|
|
699
|
+
d("span", null, " Page " + k(o.value.page + 1) + " / " + k(o.value.nbPages), 1),
|
|
700
|
+
d("button", {
|
|
701
|
+
type: "button",
|
|
702
|
+
disabled: o.value.page >= o.value.nbPages - 1,
|
|
703
|
+
onClick: i[1] || (i[1] = (s) => e.controller.setPage(o.value.page + 1))
|
|
704
|
+
}, " Next ", 8, vt)
|
|
705
|
+
])) : x("", !0);
|
|
706
|
+
}
|
|
707
|
+
}), St = (t) => {
|
|
708
|
+
if (t === void 0)
|
|
709
|
+
return "";
|
|
710
|
+
const { min: e, max: o } = t, n = ({ amount: i, currencyCode: s }) => new Intl.NumberFormat(void 0, {
|
|
711
|
+
style: "currency",
|
|
712
|
+
currency: s
|
|
713
|
+
}).format(Number(i));
|
|
714
|
+
try {
|
|
715
|
+
return e.amount === o.amount ? n(e) : `${n(e)} – ${n(o)}`;
|
|
716
|
+
} catch {
|
|
717
|
+
return "";
|
|
718
|
+
}
|
|
719
|
+
}, Ct = (t) => {
|
|
720
|
+
try {
|
|
721
|
+
const { protocol: e } = new URL(t, window.location.href);
|
|
722
|
+
return e === "http:" || e === "https:" ? t : void 0;
|
|
723
|
+
} catch {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
}, bt = { class: "dialog-search-card-image" }, Et = ["src", "alt"], Tt = { class: "dialog-search-card-info" }, It = { class: "dialog-search-card-title" }, wt = {
|
|
727
|
+
key: 0,
|
|
728
|
+
class: "dialog-search-card-price"
|
|
729
|
+
}, Q = /* @__PURE__ */ E({
|
|
730
|
+
__name: "DialogSearchProductCardContent",
|
|
731
|
+
props: {
|
|
732
|
+
hit: {}
|
|
733
|
+
},
|
|
734
|
+
setup(t) {
|
|
735
|
+
const e = t, o = I(() => e.hit.product.title ?? e.hit.product.id), n = I(() => St(e.hit.product.priceRange));
|
|
736
|
+
return (i, s) => (f(), v(O, null, [
|
|
737
|
+
d("div", bt, [
|
|
738
|
+
e.hit.product.imageUrl !== void 0 ? (f(), v("img", {
|
|
739
|
+
key: 0,
|
|
740
|
+
src: e.hit.product.imageUrl,
|
|
741
|
+
alt: o.value,
|
|
742
|
+
loading: "lazy"
|
|
743
|
+
}, null, 8, Et)) : x("", !0)
|
|
744
|
+
]),
|
|
745
|
+
d("div", Tt, [
|
|
746
|
+
d("p", It, k(o.value), 1),
|
|
747
|
+
n.value !== "" ? (f(), v("p", wt, k(n.value), 1)) : x("", !0)
|
|
748
|
+
])
|
|
749
|
+
], 64));
|
|
750
|
+
}
|
|
751
|
+
}), kt = {
|
|
752
|
+
key: 0,
|
|
753
|
+
class: "dialog-search-card-body"
|
|
754
|
+
}, Rt = ["href"], yt = /* @__PURE__ */ E({
|
|
755
|
+
__name: "DialogSearchProductCard",
|
|
756
|
+
props: {
|
|
757
|
+
controller: {},
|
|
758
|
+
hit: {},
|
|
759
|
+
index: {}
|
|
760
|
+
},
|
|
761
|
+
setup(t) {
|
|
762
|
+
const e = t, o = y();
|
|
763
|
+
U(
|
|
764
|
+
() => e.hit,
|
|
765
|
+
() => {
|
|
766
|
+
o.value !== void 0 && e.controller.observeResult(o.value, e.index);
|
|
767
|
+
},
|
|
768
|
+
{ immediate: !0, flush: "post" }
|
|
769
|
+
);
|
|
770
|
+
const n = (r) => {
|
|
771
|
+
const a = r.metaKey || r.ctrlKey || r.shiftKey || r.altKey;
|
|
772
|
+
e.controller.selectResult(e.index, { navigate: !a }) && r.preventDefault();
|
|
773
|
+
}, i = (r) => {
|
|
774
|
+
r.button === 1 && e.controller.selectResult(e.index, { navigate: !1 });
|
|
775
|
+
}, s = I(
|
|
776
|
+
() => e.hit.product.url === void 0 ? void 0 : Ct(e.hit.product.url)
|
|
777
|
+
);
|
|
778
|
+
return (r, a) => (f(), v("li", {
|
|
779
|
+
ref_key: "cardRef",
|
|
780
|
+
ref: o,
|
|
781
|
+
class: "dialog-search-card"
|
|
782
|
+
}, [
|
|
783
|
+
s.value === void 0 ? (f(), v("div", kt, [
|
|
784
|
+
L(Q, {
|
|
785
|
+
hit: e.hit
|
|
786
|
+
}, null, 8, ["hit"])
|
|
787
|
+
])) : (f(), v("a", {
|
|
788
|
+
key: 1,
|
|
789
|
+
class: "dialog-search-card-body",
|
|
790
|
+
href: s.value,
|
|
791
|
+
onClick: n,
|
|
792
|
+
onAuxclick: i
|
|
793
|
+
}, [
|
|
794
|
+
L(Q, {
|
|
795
|
+
hit: e.hit
|
|
796
|
+
}, null, 8, ["hit"])
|
|
797
|
+
], 40, Rt))
|
|
798
|
+
], 512));
|
|
799
|
+
}
|
|
800
|
+
}), At = (t) => {
|
|
801
|
+
const e = y(), o = y(void 0), n = y(0);
|
|
802
|
+
return U(
|
|
803
|
+
t,
|
|
804
|
+
(i, s, r) => {
|
|
805
|
+
if (!i)
|
|
806
|
+
return;
|
|
807
|
+
const a = () => {
|
|
808
|
+
const g = e.value;
|
|
809
|
+
if (g === void 0)
|
|
810
|
+
return;
|
|
811
|
+
const _ = g.previousElementSibling ?? g, { top: u, bottom: h, left: m, width: C } = _.getBoundingClientRect();
|
|
812
|
+
n.value = window.innerHeight;
|
|
813
|
+
const p = o.value;
|
|
814
|
+
(p === void 0 || p.top !== u || p.bottom !== h || p.left !== m || p.width !== C) && (o.value = { top: u, bottom: h, left: m, width: C });
|
|
815
|
+
};
|
|
816
|
+
a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), r(() => {
|
|
817
|
+
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
818
|
+
});
|
|
819
|
+
},
|
|
820
|
+
{ immediate: !0, flush: "post" }
|
|
821
|
+
), { anchorRef: e, rect: o, viewportHeight: n };
|
|
822
|
+
}, Lt = (t, e) => {
|
|
823
|
+
const o = y(!1), n = y(), i = I(
|
|
824
|
+
() => t.value.status !== R.IDLE && !o.value
|
|
825
|
+
);
|
|
826
|
+
U(
|
|
827
|
+
() => t.value.query,
|
|
828
|
+
() => {
|
|
829
|
+
o.value = !1;
|
|
830
|
+
}
|
|
831
|
+
), U(
|
|
832
|
+
i,
|
|
833
|
+
(r, a, g) => {
|
|
834
|
+
if (!r)
|
|
835
|
+
return;
|
|
836
|
+
const _ = (u) => {
|
|
837
|
+
var b, S;
|
|
838
|
+
const h = u.target;
|
|
839
|
+
if (!(h instanceof Node))
|
|
840
|
+
return;
|
|
841
|
+
const m = (b = e.value) == null ? void 0 : b.previousElementSibling, C = ((S = n.value) == null ? void 0 : S.contains(h)) ?? !1, p = (m == null ? void 0 : m.contains(h)) ?? !1;
|
|
842
|
+
!C && !p && (o.value = !0);
|
|
843
|
+
};
|
|
844
|
+
document.addEventListener("pointerdown", _), g(
|
|
845
|
+
() => document.removeEventListener("pointerdown", _)
|
|
846
|
+
);
|
|
847
|
+
},
|
|
848
|
+
{ immediate: !0 }
|
|
849
|
+
);
|
|
850
|
+
const s = () => {
|
|
851
|
+
o.value = !1;
|
|
852
|
+
};
|
|
853
|
+
return B(() => {
|
|
854
|
+
var r, a;
|
|
855
|
+
(a = (r = e.value) == null ? void 0 : r.previousElementSibling) == null || a.addEventListener(
|
|
856
|
+
"focusin",
|
|
857
|
+
s
|
|
858
|
+
);
|
|
859
|
+
}), X(() => {
|
|
860
|
+
var r, a;
|
|
861
|
+
(a = (r = e.value) == null ? void 0 : r.previousElementSibling) == null || a.removeEventListener(
|
|
862
|
+
"focusin",
|
|
863
|
+
s
|
|
864
|
+
);
|
|
865
|
+
}), { isOpen: i, panelRef: n };
|
|
866
|
+
}, $t = {
|
|
867
|
+
key: 0,
|
|
868
|
+
role: "status",
|
|
869
|
+
class: "dialog-search-status"
|
|
870
|
+
}, Dt = {
|
|
871
|
+
key: 1,
|
|
872
|
+
class: "dialog-search-error"
|
|
873
|
+
}, Pt = {
|
|
874
|
+
role: "alert",
|
|
875
|
+
class: "dialog-search-status dialog-search-status-error"
|
|
876
|
+
}, Ot = {
|
|
877
|
+
key: 2,
|
|
878
|
+
role: "status",
|
|
879
|
+
class: "dialog-search-status"
|
|
880
|
+
}, Nt = {
|
|
881
|
+
role: "status",
|
|
882
|
+
class: "dialog-search-status"
|
|
883
|
+
}, Ut = { class: "dialog-search-results" }, q = 8, j = 16, xt = 200, Ht = /* @__PURE__ */ E({
|
|
884
|
+
__name: "DialogSearchResults",
|
|
885
|
+
props: {
|
|
886
|
+
controller: {},
|
|
887
|
+
state: {}
|
|
888
|
+
},
|
|
889
|
+
setup(t) {
|
|
890
|
+
const e = t, o = (p) => p instanceof pe ? `Search failed (${p.status}${p.code ? ` ${p.code}` : ""}): ${p.message}` : "Search failed: network error. Check your connection and try again.", n = (p, b) => p.bottom > 0 && p.top < b, i = (p, b) => {
|
|
891
|
+
const S = b - p.bottom - q - j, w = p.top - q - j, c = { left: `${p.left}px`, width: `${p.width}px` };
|
|
892
|
+
return S < xt && w > S ? {
|
|
893
|
+
...c,
|
|
894
|
+
bottom: `${b - p.top + q}px`,
|
|
895
|
+
maxHeight: `${Math.max(w, 0)}px`
|
|
896
|
+
} : {
|
|
897
|
+
...c,
|
|
898
|
+
top: `${p.bottom + q}px`,
|
|
899
|
+
maxHeight: `${Math.max(S, 0)}px`
|
|
900
|
+
};
|
|
901
|
+
}, s = I(() => e.state), r = I(() => e.state.status !== R.IDLE), { anchorRef: a, rect: g, viewportHeight: _ } = At(r), { isOpen: u, panelRef: h } = Lt(s, a), m = I(
|
|
902
|
+
() => u.value && g.value !== void 0 && n(g.value, _.value)
|
|
903
|
+
), C = I(
|
|
904
|
+
() => g.value === void 0 ? void 0 : i(g.value, _.value)
|
|
905
|
+
);
|
|
906
|
+
return (p, b) => {
|
|
907
|
+
var S;
|
|
908
|
+
return f(), v(O, null, [
|
|
909
|
+
d("div", {
|
|
910
|
+
ref_key: "anchorRef",
|
|
911
|
+
ref: a
|
|
912
|
+
}, null, 512),
|
|
913
|
+
m.value ? (f(), N(ie, {
|
|
914
|
+
key: 0,
|
|
915
|
+
to: "body"
|
|
916
|
+
}, [
|
|
917
|
+
d("div", {
|
|
918
|
+
ref_key: "panelRef",
|
|
919
|
+
ref: h,
|
|
920
|
+
class: "dialog-search-panel",
|
|
921
|
+
style: ae(C.value)
|
|
922
|
+
}, [
|
|
923
|
+
e.state.status === M(R).LOADING ? (f(), v("p", $t, " Searching “" + k(e.state.query) + "”… ", 1)) : e.state.status === M(R).ERROR ? (f(), v("div", Dt, [
|
|
924
|
+
d("p", Pt, k(o(e.state.error)), 1),
|
|
925
|
+
d("button", {
|
|
926
|
+
type: "button",
|
|
927
|
+
class: "dialog-search-retry",
|
|
928
|
+
onClick: b[0] || (b[0] = (w) => e.controller.retry())
|
|
929
|
+
}, " Retry ")
|
|
930
|
+
])) : e.state.status === M(R).EMPTY ? (f(), v("p", Ot, " No products match “" + k((S = e.state.response) == null ? void 0 : S.query) + "”. ", 1)) : e.state.status === M(R).SUCCESS && e.state.response !== void 0 ? (f(), v(O, { key: 3 }, [
|
|
931
|
+
d("p", Nt, k(e.state.response.nbHits) + " result" + k(e.state.response.nbHits > 1 ? "s" : ""), 1),
|
|
932
|
+
d("ul", Ut, [
|
|
933
|
+
(f(!0), v(O, null, W(e.state.response.hits, (w, c) => (f(), N(yt, {
|
|
934
|
+
key: w.id,
|
|
935
|
+
controller: e.controller,
|
|
936
|
+
hit: w,
|
|
937
|
+
index: c
|
|
938
|
+
}, null, 8, ["controller", "hit", "index"]))), 128))
|
|
939
|
+
]),
|
|
940
|
+
L(mt, {
|
|
941
|
+
controller: e.controller,
|
|
942
|
+
state: e.state
|
|
943
|
+
}, null, 8, ["controller", "state"])
|
|
944
|
+
], 64)) : x("", !0)
|
|
945
|
+
], 4)
|
|
946
|
+
])) : x("", !0)
|
|
947
|
+
], 64);
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
}), Kt = (t) => {
|
|
951
|
+
const { client: e, surface: o = "search_page", ...n } = t, i = ke({
|
|
952
|
+
search: (a, g) => e.search(a, g),
|
|
953
|
+
analytics: {
|
|
954
|
+
surface: o,
|
|
955
|
+
trackViewSearchResults: (a) => e.trackViewSearchResults(a),
|
|
956
|
+
trackSelectSearchResult: (a) => e.trackSelectSearchResult(a)
|
|
957
|
+
},
|
|
958
|
+
...n
|
|
959
|
+
}), s = ce(i.getState()), r = i.subscribe(() => {
|
|
960
|
+
s.value = i.getState();
|
|
961
|
+
});
|
|
962
|
+
return B(() => {
|
|
963
|
+
J({
|
|
964
|
+
method: "vue",
|
|
965
|
+
version: "3.3.0"
|
|
966
|
+
});
|
|
967
|
+
}), X(() => {
|
|
968
|
+
r(), i.dispose();
|
|
969
|
+
}), { controller: i, state: s };
|
|
970
|
+
};
|
|
389
971
|
export {
|
|
390
|
-
|
|
391
|
-
|
|
972
|
+
Je as DialogInput,
|
|
973
|
+
Bt as DialogProductBlock,
|
|
974
|
+
Vt as DialogSearchBar,
|
|
975
|
+
mt as DialogSearchPagination,
|
|
976
|
+
yt as DialogSearchProductCard,
|
|
977
|
+
Ht as DialogSearchResults,
|
|
978
|
+
Kt as useDialogSearch
|
|
392
979
|
};
|