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