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