@askdialog/dialog-vue 3.1.0 → 3.2.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 +1 @@
1
- .dialog-block-header-container[data-v-28e6dda7]{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start}.dialog-block-title[data-v-28e6dda7]{color:var(--dialog-theme-title-color, #272727);font-family:var(--dialog-theme-font-family);font-size:var(--dialog-theme-title-font-size);font-style:normal;font-weight:500;line-height:20px;letter-spacing:1.3px;text-transform:uppercase}.dialog-block-description[data-v-28e6dda7]{color:var(--dialog-theme-description-color, #6c6c6c);font-family:var(--dialog-theme-font-family);font-size:var(--dialog-theme-description-font-size);font-style:normal;font-weight:500;line-height:20px}.dialog-block-suggestions-item[data-v-fb1910ce]{background-color:#f1f1f1;border:none;outline:none;padding:12px 16px;width:fit-content;cursor:pointer;display:flex;justify-content:flex-start;background-color:#fff;align-items:center;gap:8px;border:1px solid #dddce2;border-radius:24px}.dialog-block-suggestions-item[data-v-fb1910ce]:hover{transform:scale(1.01)}.dialog-block-suggestions-item-label[data-v-fb1910ce]{color:var(--dialog-theme-content-color, #575665);font-size:var(--dialog-theme-content-font-size, 14px);font-weight:500;text-align:left;flex:1}.dialog-block-suggestions-item-icon path[data-v-fb1910ce]{stroke:var(--dialog-theme-primary-color)}.dialog-block-suggestions-skeleton-item[data-v-26a64b58],.dialog-block-suggestions-skeleton-item[data-v-26a64b58]:empty{display:block;width:100%;width:90%;height:18px;border-radius:18px;padding:12px 16px;background-color:#f1f1f1;animation:pulse-26a64b58 1.5s ease-in-out infinite}@keyframes pulse-26a64b58{0%{background-color:#f1f1f1}50%{background-color:#fff}to{background-color:#f1f1f1}}.dialog-block-suggestions-container[data-v-18c9e78b]{display:flex;flex-direction:column;gap:12px;width:100%}.dialog-input-wrapper[data-v-7649af7c]{position:relative;width:100%;height:50px;max-height:50px;padding:16px 20px;border:1px solid #d9d9d9;border-radius:var(--dialog-theme-cta-border-type, 24px);background:#fff;display:flex;align-items:center;box-sizing:border-box}.dialog-input-container[data-v-7649af7c]{display:flex;justify-items:center;align-items:center;gap:12px;width:100%;height:100%}.dialog-ask-anything-input-ai-input[data-v-7649af7c]{outline:unset;box-shadow:unset;border:unset;width:100%;font-size:16px;background:transparent;padding-right:35px}.dialog-input-submit[data-v-7649af7c]{width:40px;height:40px;border-radius:100%;display:flex;align-items:center;justify-content:center;background-color:var(--dialog-theme-primary-color);position:absolute;cursor:pointer;top:calc(50% - 20px);right:4px;border:unset}.dialog-input-submit[data-v-7649af7c]:disabled{opacity:.5}.dialog-block-container[data-v-7e33975d]{position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;padding:24px 0;width:fit-content;gap:24px}.dialog-block-container[data-v-7e33975d]>*{box-sizing:border-box}
1
+ .dialog-block-header-container[data-v-28e6dda7]{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start}.dialog-block-title[data-v-28e6dda7]{color:var(--dialog-theme-title-color, #272727);font-family:var(--dialog-theme-font-family);font-size:var(--dialog-theme-title-font-size);font-style:normal;font-weight:500;line-height:20px;letter-spacing:1.3px;text-transform:uppercase}.dialog-block-description[data-v-28e6dda7]{color:var(--dialog-theme-description-color, #6c6c6c);font-family:var(--dialog-theme-font-family);font-size:var(--dialog-theme-description-font-size);font-style:normal;font-weight:500;line-height:20px}.dialog-block-suggestions-item[data-v-db34d4b4]{background-color:#f1f1f1;border:none;outline:none;padding:12px 16px;width:fit-content;cursor:pointer;display:flex;justify-content:flex-start;background-color:#fff;align-items:center;gap:8px;border:1px solid #dddce2;border-radius:24px}.dialog-block-suggestions-item[data-v-db34d4b4]:hover{transform:scale(1.01)}.dialog-block-suggestions-item-label[data-v-db34d4b4]{color:var(--dialog-theme-content-color, #575665);font-size:var(--dialog-theme-content-font-size, 14px);font-weight:500;text-align:start;flex:1}.dialog-block-suggestions-item-icon path[data-v-db34d4b4]{stroke:var(--dialog-theme-primary-color)}.dialog-block-suggestions-skeleton-item[data-v-26a64b58],.dialog-block-suggestions-skeleton-item[data-v-26a64b58]:empty{display:block;width:100%;width:90%;height:18px;border-radius:18px;padding:12px 16px;background-color:#f1f1f1;animation:pulse-26a64b58 1.5s ease-in-out infinite}@keyframes pulse-26a64b58{0%{background-color:#f1f1f1}50%{background-color:#fff}to{background-color:#f1f1f1}}.dialog-block-suggestions-container[data-v-18c9e78b]{display:flex;flex-direction:column;gap:12px;width:100%}.dialog-input-wrapper[data-v-4f5901c9]{position:relative;width:100%;height:50px;max-height:50px;padding:16px 20px;border:1px solid #d9d9d9;border-radius:var(--dialog-theme-cta-border-type, 24px);background:#fff;display:flex;align-items:center;box-sizing:border-box}.dialog-input-container[data-v-4f5901c9]{display:flex;justify-items:center;align-items:center;gap:12px;width:100%;height:100%}.dialog-ask-anything-input-ai-input[data-v-4f5901c9]{outline:unset;box-shadow:unset;border:unset;width:100%;font-size:16px;background:transparent;padding-inline-end:35px}.dialog-input-submit[data-v-4f5901c9]{width:40px;height:40px;border-radius:100%;display:flex;align-items:center;justify-content:center;background-color:var(--dialog-theme-primary-color);position:absolute;cursor:pointer;top:calc(50% - 20px);inset-inline-end:4px;border:unset}.dialog-input-submit[data-v-4f5901c9]:disabled{opacity:.5}.dialog-block-container[data-v-c57aa677]{position:relative;display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;padding:24px 0;width:fit-content;gap:24px}.dialog-block-container[data-v-c57aa677]>*{box-sizing:border-box}
@@ -1,15 +1,16 @@
1
- import { defineComponent as p, createElementBlock as u, openBlock as l, createElementVNode as c, toDisplayString as I, Fragment as E, renderList as O, createVNode as C, createBlock as v, ref as f, withDirectives as y, withKeys as $, vModelText as L, onMounted as D, watch as w, renderSlot as B, computed as S, withCtx as P, createCommentVNode as U } from "vue";
2
- var k;
1
+ import { defineComponent as _, createElementBlock as u, openBlock as l, createElementVNode as c, toDisplayString as E, Fragment as A, renderList as N, createVNode as v, createBlock as k, ref as m, withDirectives as O, withKeys as y, vModelText as U, onMounted as b, watch as L, renderSlot as $, computed as T, withCtx as K, createCommentVNode as B } from "vue";
2
+ const V = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur"]), P = (t) => t !== void 0 && V.has(t.trim().toLowerCase().slice(0, 2)), M = (t) => P(t) ? "rtl" : "ltr";
3
+ var h;
3
4
  (function(t) {
4
- 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";
5
- })(k || (k = {}));
6
- var T;
5
+ t.OPEN_ASSISTANT = "open_assistant", t.CLOSE_ASSISTANT = "close_assistant", t.SEND_MESSAGE = "PRODUCT_QUESTION", t.SEND_GENERIC_QUESTION = "GENERIC_QUESTION", t.TRACK_ADD_TO_CART = "TRACK_ADD_TO_CART", t.TRACK_SUBMIT_CHECKOUT = "TRACK_SUBMIT_CHECKOUT", t.TRACK_VIEW_SEARCH_RESULTS = "TRACK_VIEW_SEARCH_RESULTS", t.TRACK_SELECT_SEARCH_RESULT = "TRACK_SELECT_SEARCH_RESULT";
6
+ })(h || (h = {}));
7
+ var I;
7
8
  (function(t) {
8
9
  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";
9
- })(T || (T = {}));
10
- k.TRACK_ADD_TO_CART, k.TRACK_SUBMIT_CHECKOUT;
11
- const b = "multiple installation methods detected:", V = () => typeof window > "u" ? void 0 : window, A = () => {
12
- const t = V();
10
+ })(I || (I = {}));
11
+ h.TRACK_ADD_TO_CART, h.TRACK_SUBMIT_CHECKOUT, h.TRACK_VIEW_SEARCH_RESULTS, h.TRACK_SELECT_SEARCH_RESULT;
12
+ const R = "multiple installation methods detected:", q = () => typeof window > "u" ? void 0 : window, w = () => {
13
+ const t = q();
13
14
  if (t !== void 0)
14
15
  return t.dialog = t.dialog ?? {}, t.dialog.audit = t.dialog.audit ?? {
15
16
  methods: [],
@@ -17,28 +18,28 @@ const b = "multiple installation methods detected:", V = () => typeof window > "
17
18
  capabilities: [],
18
19
  warnings: []
19
20
  }, t.dialog.audit;
20
- }, M = (t) => {
21
- if (t.warnings = t.warnings.filter((e) => !e.startsWith(b)), t.methods.length >= 2) {
21
+ }, x = (t) => {
22
+ if (t.warnings = t.warnings.filter((e) => !e.startsWith(R)), t.methods.length >= 2) {
22
23
  const e = t.methods.map((o) => o.method).join(", ");
23
- t.warnings.push(`${b} ${e}`);
24
+ t.warnings.push(`${R} ${e}`);
24
25
  }
25
- }, K = (t, e) => e === void 0 ? t : {
26
+ }, H = (t, e) => e === void 0 ? t : {
26
27
  version: (t == null ? void 0 : t.version) ?? e.version,
27
28
  commit: (t == null ? void 0 : t.commit) ?? e.commit
28
- }, q = (t) => {
29
- const e = A();
29
+ }, F = (t) => {
30
+ const e = w();
30
31
  if (e === void 0)
31
32
  return;
32
33
  const o = e.methods.find((n) => n.method === t.method);
33
34
  if (o === void 0) {
34
- e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), M(e);
35
+ e.methods.push({ ...t, registeredAt: (/* @__PURE__ */ new Date()).toISOString() }), x(e);
35
36
  return;
36
37
  }
37
- o.version = o.version ?? t.version, o.build = K(o.build, t.build), o.source = o.source ?? t.source;
38
- }, x = (t) => {
39
- const e = A();
38
+ o.version = o.version ?? t.version, o.build = H(o.build, t.build), o.source = o.source ?? t.source;
39
+ }, G = (t) => {
40
+ const e = w();
40
41
  e !== void 0 && (e.capabilities.includes(t) || e.capabilities.push(t));
41
- }, F = { class: "dialog-block-header-container" }, j = { class: "dialog-block-title" }, H = { class: "dialog-block-description" }, G = /* @__PURE__ */ p({
42
+ }, j = { class: "dialog-block-header-container" }, Q = { class: "dialog-block-title" }, W = { class: "dialog-block-description" }, Z = /* @__PURE__ */ _({
42
43
  __name: "DialogBlockHeader",
43
44
  props: {
44
45
  title: {},
@@ -46,31 +47,31 @@ const b = "multiple installation methods detected:", V = () => typeof window > "
46
47
  },
47
48
  setup(t) {
48
49
  const e = t;
49
- return (o, n) => (l(), u("div", F, [
50
- c("div", j, I(e.title ?? "Your expert"), 1),
51
- c("div", H, I(e.description ?? "A question about this product?"), 1)
50
+ return (o, n) => (l(), u("div", j, [
51
+ c("div", Q, E(e.title ?? "Your expert"), 1),
52
+ c("div", W, E(e.description ?? "A question about this product?"), 1)
52
53
  ]));
53
54
  }
54
- }), h = (t, e) => {
55
+ }), S = (t, e) => {
55
56
  const o = t.__vccOpts || t;
56
57
  for (const [n, a] of e)
57
58
  o[n] = a;
58
59
  return o;
59
- }, Q = /* @__PURE__ */ h(G, [["__scopeId", "data-v-28e6dda7"]]), W = {
60
+ }, z = /* @__PURE__ */ S(Z, [["__scopeId", "data-v-28e6dda7"]]), X = {
60
61
  width: "20",
61
62
  height: "20",
62
63
  viewBox: "0 0 20 20",
63
64
  fill: "none",
64
65
  xmlns: "http://www.w3.org/2000/svg"
65
- }, Z = { "clip-path": "url(#clip0_466_934)" }, X = ["stroke"], Y = ["stroke"], z = /* @__PURE__ */ p({
66
+ }, Y = { "clip-path": "url(#clip0_466_934)" }, J = ["stroke"], ee = ["stroke"], te = /* @__PURE__ */ _({
66
67
  __name: "AiStarsIcon",
67
68
  props: {
68
69
  color: {}
69
70
  },
70
71
  setup(t) {
71
72
  const e = t;
72
- return (o, n) => (l(), u("svg", W, [
73
- c("g", Z, [
73
+ return (o, n) => (l(), u("svg", X, [
74
+ c("g", Y, [
74
75
  c("path", {
75
76
  d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
76
77
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
@@ -86,7 +87,7 @@ const b = "multiple installation methods detected:", V = () => typeof window > "
86
87
  "stroke-width": "1.5",
87
88
  "stroke-linecap": "round",
88
89
  "stroke-linejoin": "round"
89
- }, null, 8, X),
90
+ }, null, 8, J),
90
91
  c("path", {
91
92
  d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
92
93
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
@@ -102,7 +103,7 @@ const b = "multiple installation methods detected:", V = () => typeof window > "
102
103
  "stroke-width": "1.5",
103
104
  "stroke-linecap": "round",
104
105
  "stroke-linejoin": "round"
105
- }, null, 8, Y)
106
+ }, null, 8, ee)
106
107
  ]),
107
108
  n[0] || (n[0] = c("defs", null, [
108
109
  c("clipPath", { id: "clip0_466_934" }, [
@@ -115,7 +116,7 @@ const b = "multiple installation methods detected:", V = () => typeof window > "
115
116
  ], -1))
116
117
  ]));
117
118
  }
118
- }), J = ["onClick"], ee = { class: "dialog-block-suggestions-item-label" }, te = /* @__PURE__ */ p({
119
+ }), oe = ["onClick"], ne = { class: "dialog-block-suggestions-item-label" }, ie = /* @__PURE__ */ _({
119
120
  __name: "DialogBlockSuggestions",
120
121
  props: {
121
122
  client: {},
@@ -134,27 +135,27 @@ const b = "multiple installation methods detected:", V = () => typeof window > "
134
135
  fromQuestionSuggestion: !0
135
136
  });
136
137
  };
137
- return (n, a) => (l(!0), u(E, null, O(e.questions, (i) => (l(), u("button", {
138
+ return (n, a) => (l(!0), u(A, null, N(e.questions, (i) => (l(), u("button", {
138
139
  key: i.question,
139
140
  class: "dialog-block-suggestions-item",
140
141
  onClick: (r) => o(i.question)
141
142
  }, [
142
- C(z, {
143
+ v(te, {
143
144
  class: "dialog-block-suggestions-item-icon",
144
145
  color: e.client.theme.primaryColor
145
146
  }, null, 8, ["color"]),
146
- c("span", ee, I(i.question), 1)
147
- ], 8, J))), 128));
147
+ c("span", ne, E(i.question), 1)
148
+ ], 8, oe))), 128));
148
149
  }
149
- }), oe = /* @__PURE__ */ h(te, [["__scopeId", "data-v-fb1910ce"]]), ne = {};
150
- function ie(t, e) {
151
- return l(), u(E, null, [
150
+ }), se = /* @__PURE__ */ S(ie, [["__scopeId", "data-v-db34d4b4"]]), ce = {};
151
+ function re(t, e) {
152
+ return l(), u(A, null, [
152
153
  e[0] || (e[0] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
153
154
  e[1] || (e[1] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
154
155
  e[2] || (e[2] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
155
156
  ], 64);
156
157
  }
157
- const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58"]]), ce = { class: "dialog-block-suggestions-container" }, re = /* @__PURE__ */ p({
158
+ const de = /* @__PURE__ */ S(ce, [["render", re], ["__scopeId", "data-v-26a64b58"]]), le = { class: "dialog-block-suggestions-container" }, ae = /* @__PURE__ */ _({
158
159
  __name: "DialogBlockSuggestionsContainer",
159
160
  props: {
160
161
  client: {},
@@ -166,8 +167,8 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
166
167
  },
167
168
  setup(t) {
168
169
  const e = t;
169
- return (o, n) => (l(), u("div", ce, [
170
- e.isLoading || !e.questions ? (l(), v(se, { key: 0 })) : (l(), v(oe, {
170
+ return (o, n) => (l(), u("div", le, [
171
+ e.isLoading || !e.questions ? (l(), k(de, { key: 0 })) : (l(), k(se, {
171
172
  key: 1,
172
173
  client: e.client,
173
174
  questions: e.questions,
@@ -177,30 +178,30 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
177
178
  }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
178
179
  ]));
179
180
  }
180
- }), de = /* @__PURE__ */ h(re, [["__scopeId", "data-v-18c9e78b"]]), le = {
181
+ }), ue = /* @__PURE__ */ S(ae, [["__scopeId", "data-v-18c9e78b"]]), _e = {
181
182
  width: "20",
182
183
  height: "20",
183
184
  viewBox: "0 0 20 20",
184
185
  fill: "none",
185
186
  xmlns: "http://www.w3.org/2000/svg"
186
- }, ae = ["stroke"], ue = /* @__PURE__ */ p({
187
+ }, pe = ["stroke"], ge = /* @__PURE__ */ _({
187
188
  __name: "ArrowIcon",
188
189
  props: {
189
190
  color: {}
190
191
  },
191
192
  setup(t) {
192
193
  const e = t;
193
- return (o, n) => (l(), u("svg", le, [
194
+ return (o, n) => (l(), u("svg", _e, [
194
195
  c("path", {
195
196
  d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
196
197
  stroke: e.color || "#ffffff",
197
198
  "stroke-width": "1.5",
198
199
  "stroke-linecap": "round",
199
200
  "stroke-linejoin": "round"
200
- }, null, 8, ae)
201
+ }, null, 8, pe)
201
202
  ]));
202
203
  }
203
- }), pe = ["placeholder"], _e = ["disabled"], ge = /* @__PURE__ */ p({
204
+ }), Ce = ["placeholder"], he = ["disabled"], Se = /* @__PURE__ */ _({
204
205
  __name: "DialogInput",
205
206
  props: {
206
207
  client: {},
@@ -210,7 +211,7 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
210
211
  selectedVariantId: {}
211
212
  },
212
213
  setup(t) {
213
- const e = t, o = f(), n = f(""), a = () => {
214
+ const e = t, o = m(), n = m(""), a = () => {
214
215
  var r;
215
216
  (r = o.value) == null || r.focus();
216
217
  }, i = () => {
@@ -227,16 +228,16 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
227
228
  class: "dialog-input-wrapper",
228
229
  onClick: a
229
230
  }, [
230
- y(c("input", {
231
+ O(c("input", {
231
232
  id: "dialog-ask-anything-input-ai-input",
232
233
  ref_key: "inputRef",
233
234
  ref: o,
234
- "onUpdate:modelValue": d[0] || (d[0] = (_) => n.value = _),
235
+ "onUpdate:modelValue": d[0] || (d[0] = (p) => n.value = p),
235
236
  class: "dialog-ask-anything-input-ai-input",
236
237
  placeholder: e.placeholder ?? "Ask anything...",
237
- onKeydown: $(i, ["enter"])
238
- }, null, 40, pe), [
239
- [L, n.value]
238
+ onKeydown: y(i, ["enter"])
239
+ }, null, 40, Ce), [
240
+ [U, n.value]
240
241
  ]),
241
242
  c("button", {
242
243
  id: "send-message-button-ai-input",
@@ -244,13 +245,13 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
244
245
  disabled: !n.value.trim(),
245
246
  onClick: i
246
247
  }, [
247
- C(ue, {
248
+ v(ge, {
248
249
  color: e.client.theme.ctaTextColor
249
250
  }, null, 8, ["color"])
250
- ], 8, _e)
251
+ ], 8, he)
251
252
  ]));
252
253
  }
253
- }), he = /* @__PURE__ */ h(ge, [["__scopeId", "data-v-7649af7c"]]), me = /* @__PURE__ */ p({
254
+ }), me = /* @__PURE__ */ S(Se, [["__scopeId", "data-v-4f5901c9"]]), fe = /* @__PURE__ */ _({
254
255
  __name: "ThemeProvider",
255
256
  props: {
256
257
  theme: {}
@@ -258,48 +259,45 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
258
259
  setup(t) {
259
260
  const e = t, o = document.body, n = (i) => i.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (i) => {
260
261
  i && Object.keys(i).forEach((r) => {
261
- const d = r, _ = n(r);
262
+ const d = r, p = n(r);
262
263
  if (i[d] !== void 0) {
263
264
  if (typeof i[d] == "object") {
264
- Object.keys(i[d]).forEach((s) => {
265
- var m;
266
- const g = s;
267
- if (g !== void 0) {
268
- const R = n(s), N = i[d];
265
+ Object.keys(i[d]).forEach((C) => {
266
+ var g;
267
+ const s = C;
268
+ if (s !== void 0) {
269
+ const f = n(C), D = i[d];
269
270
  o.style.setProperty(
270
- `--dialog-theme-${_}-${R}`,
271
- (m = N[g]) == null ? void 0 : m.toString()
271
+ `--dialog-theme-${p}-${f}`,
272
+ (g = D[s]) == null ? void 0 : g.toString()
272
273
  );
273
274
  }
274
275
  });
275
276
  return;
276
277
  }
277
278
  if (d === "ctaBorderType") {
278
- const s = i[d] === "rounded" ? "24px" : "0";
279
- o.style.setProperty(`--dialog-theme-${_}`, s);
279
+ const C = i[d] === "rounded" ? "24px" : "0";
280
+ o.style.setProperty(`--dialog-theme-${p}`, C);
280
281
  return;
281
282
  }
282
283
  o.style.setProperty(
283
- `--dialog-theme-${_}`,
284
+ `--dialog-theme-${p}`,
284
285
  i[d].toString()
285
286
  );
286
287
  }
287
288
  });
288
289
  };
289
- return D(() => {
290
+ return b(() => {
290
291
  e.theme && a(e.theme);
291
- }), w(
292
+ }), L(
292
293
  () => e.theme,
293
294
  (i) => {
294
295
  i && a(i);
295
296
  },
296
297
  { deep: !0 }
297
- ), (i, r) => B(i.$slots, "default");
298
+ ), (i, r) => $(i.$slots, "default");
298
299
  }
299
- }), fe = {
300
- id: "dialog-instant",
301
- class: "dialog-block-container"
302
- }, Ce = /* @__PURE__ */ p({
300
+ }), Te = ["dir"], ve = /* @__PURE__ */ _({
303
301
  __name: "DialogProductBlock",
304
302
  props: {
305
303
  client: {},
@@ -310,22 +308,29 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
310
308
  },
311
309
  setup(t) {
312
310
  const e = t;
313
- D(() => {
314
- q({
311
+ b(() => {
312
+ F({
315
313
  method: "vue",
316
- version: "3.1.0"
317
- }), x("pdp-block");
314
+ version: "3.2.0"
315
+ }), G("pdp-block");
318
316
  });
319
- const o = f(!0), n = f(void 0), a = f(0), i = S(() => {
317
+ const o = m(!0), n = m(void 0), a = m(0), i = T(() => {
320
318
  var s;
321
319
  return o.value ? "" : (s = n.value) == null ? void 0 : s.assistantName;
322
- }), r = S(() => {
320
+ }), r = T(() => {
323
321
  var s;
324
322
  return o.value ? "" : (s = n.value) == null ? void 0 : s.description;
325
- }), d = S(() => {
323
+ }), d = T(() => {
326
324
  var s;
327
325
  return o.value ? "" : (s = n.value) == null ? void 0 : s.inputPlaceholder;
328
- }), _ = async () => {
326
+ }), p = T(
327
+ () => {
328
+ var s;
329
+ return M(
330
+ (s = e.client.getLocalizationInformations()) == null ? void 0 : s.languageCode
331
+ );
332
+ }
333
+ ), C = async () => {
329
334
  const s = ++a.value;
330
335
  o.value = !0, n.value = void 0;
331
336
  try {
@@ -337,47 +342,51 @@ const se = /* @__PURE__ */ h(ne, [["render", ie], ["__scopeId", "data-v-26a64b58
337
342
  s === a.value && (o.value = !1);
338
343
  }
339
344
  };
340
- return w(
345
+ return L(
341
346
  () => [e.client, e.productId],
342
347
  () => {
343
- _();
348
+ C();
344
349
  },
345
350
  { immediate: !0 }
346
- ), (s, g) => (l(), v(me, {
351
+ ), (s, g) => (l(), k(fe, {
347
352
  theme: e.client.theme
348
353
  }, {
349
- default: P(() => {
350
- var m;
354
+ default: K(() => {
355
+ var f;
351
356
  return [
352
- c("div", fe, [
353
- C(Q, {
357
+ c("div", {
358
+ id: "dialog-instant",
359
+ class: "dialog-block-container",
360
+ dir: p.value
361
+ }, [
362
+ v(z, {
354
363
  title: i.value,
355
364
  description: r.value
356
365
  }, null, 8, ["title", "description"]),
357
- C(de, {
366
+ v(ue, {
358
367
  client: e.client,
359
- questions: (m = n.value) == null ? void 0 : m.questions,
368
+ questions: (f = n.value) == null ? void 0 : f.questions,
360
369
  "is-loading": o.value,
361
370
  "product-id": e.productId,
362
371
  "product-title": e.productTitle,
363
372
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
364
373
  }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
365
- e.enableInput ? (l(), v(he, {
374
+ e.enableInput ? (l(), k(me, {
366
375
  key: 0,
367
376
  client: e.client,
368
377
  placeholder: d.value,
369
378
  "product-id": e.productId,
370
379
  "product-title": e.productTitle,
371
380
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
372
- }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : U("", !0)
373
- ])
381
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : B("", !0)
382
+ ], 8, Te)
374
383
  ];
375
384
  }),
376
385
  _: 1
377
386
  }, 8, ["theme"]));
378
387
  }
379
- }), ke = /* @__PURE__ */ h(Ce, [["__scopeId", "data-v-7e33975d"]]);
388
+ }), Ee = /* @__PURE__ */ S(ve, [["__scopeId", "data-v-c57aa677"]]);
380
389
  export {
381
- he as DialogInput,
382
- ke as DialogProductBlock
390
+ me as DialogInput,
391
+ Ee as DialogProductBlock
383
392
  };
@@ -1,4 +1,4 @@
1
- (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["dialog-vue"]={},a.Vue))})(this,(function(a,e){"use strict";var g;(function(o){o.OPEN_ASSISTANT="open_assistant",o.CLOSE_ASSISTANT="close_assistant",o.SEND_MESSAGE="PRODUCT_QUESTION",o.SEND_GENERIC_QUESTION="GENERIC_QUESTION",o.TRACK_ADD_TO_CART="TRACK_ADD_TO_CART",o.TRACK_SUBMIT_CHECKOUT="TRACK_SUBMIT_CHECKOUT"})(g||(g={}));var f;(function(o){o.USER_OPENED_ASSISTANT="userOpenedAssistant",o.USER_CLOSED_ASSISTANT="userClosedAssistant",o.USER_SENT_MESSAGE="userSentMessage",o.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",o.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",o.USER_ADDED_TO_CART="userAddedToCart",o.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",o.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(f||(f={})),g.TRACK_ADD_TO_CART,g.TRACK_SUBMIT_CHECKOUT;const h="multiple installation methods detected:",S=()=>typeof window>"u"?void 0:window,k=()=>{const o=S();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},E=o=>{if(o.warnings=o.warnings.filter(t=>!t.startsWith(h)),o.methods.length>=2){const t=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${h} ${t}`)}},I=(o,t)=>t===void 0?o:{version:(o==null?void 0:o.version)??t.version,commit:(o==null?void 0:o.commit)??t.commit},T=o=>{const t=k();if(t===void 0)return;const n=t.methods.find(i=>i.method===o.method);if(n===void 0){t.methods.push({...o,registeredAt:new Date().toISOString()}),E(t);return}n.version=n.version??o.version,n.build=I(n.build,o.build),n.source=n.source??o.source},b=o=>{const t=k();t!==void 0&&(t.capabilities.includes(o)||t.capabilities.push(o))},N={class:"dialog-block-header-container"},B={class:"dialog-block-title"},D={class:"dialog-block-description"},V=e.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",B,e.toDisplayString(t.title??"Your expert"),1),e.createElementVNode("div",D,e.toDisplayString(t.description??"A question about this product?"),1)]))}}),_=(o,t)=>{const n=o.__vccOpts||o;for(const[i,r]of t)n[i]=r;return n},w=_(V,[["__scopeId","data-v-28e6dda7"]]),A={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y={"clip-path":"url(#clip0_466_934)"},$=["stroke"],O=["stroke"],R=e.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("svg",A,[e.createElementVNode("g",y,[e.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
1
+ (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["dialog-vue"]={},a.Vue))})(this,(function(a,e){"use strict";const E=new Set(["ar","he","iw","fa","ur"]),T=o=>o!==void 0&&E.has(o.trim().toLowerCase().slice(0,2)),I=o=>T(o)?"rtl":"ltr";var _;(function(o){o.OPEN_ASSISTANT="open_assistant",o.CLOSE_ASSISTANT="close_assistant",o.SEND_MESSAGE="PRODUCT_QUESTION",o.SEND_GENERIC_QUESTION="GENERIC_QUESTION",o.TRACK_ADD_TO_CART="TRACK_ADD_TO_CART",o.TRACK_SUBMIT_CHECKOUT="TRACK_SUBMIT_CHECKOUT",o.TRACK_VIEW_SEARCH_RESULTS="TRACK_VIEW_SEARCH_RESULTS",o.TRACK_SELECT_SEARCH_RESULT="TRACK_SELECT_SEARCH_RESULT"})(_||(_={}));var C;(function(o){o.USER_OPENED_ASSISTANT="userOpenedAssistant",o.USER_CLOSED_ASSISTANT="userClosedAssistant",o.USER_SENT_MESSAGE="userSentMessage",o.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",o.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",o.USER_ADDED_TO_CART="userAddedToCart",o.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",o.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(C||(C={})),_.TRACK_ADD_TO_CART,_.TRACK_SUBMIT_CHECKOUT,_.TRACK_VIEW_SEARCH_RESULTS,_.TRACK_SELECT_SEARCH_RESULT;const h="multiple installation methods detected:",R=()=>typeof window>"u"?void 0:window,S=()=>{const o=R();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},b=o=>{if(o.warnings=o.warnings.filter(t=>!t.startsWith(h)),o.methods.length>=2){const t=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${h} ${t}`)}},A=(o,t)=>t===void 0?o:{version:(o==null?void 0:o.version)??t.version,commit:(o==null?void 0:o.commit)??t.commit},N=o=>{const t=S();if(t===void 0)return;const n=t.methods.find(i=>i.method===o.method);if(n===void 0){t.methods.push({...o,registeredAt:new Date().toISOString()}),b(t);return}n.version=n.version??o.version,n.build=A(n.build,o.build),n.source=n.source??o.source},B=o=>{const t=S();t!==void 0&&(t.capabilities.includes(o)||t.capabilities.push(o))},V={class:"dialog-block-header-container"},L={class:"dialog-block-title"},D={class:"dialog-block-description"},w=e.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",L,e.toDisplayString(t.title??"Your expert"),1),e.createElementVNode("div",D,e.toDisplayString(t.description??"A question about this product?"),1)]))}}),m=(o,t)=>{const n=o.__vccOpts||o;for(const[i,d]of t)n[i]=d;return n},y=m(w,[["__scopeId","data-v-28e6dda7"]]),O={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},$={"clip-path":"url(#clip0_466_934)"},U=["stroke"],K=["stroke"],P=e.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("svg",O,[e.createElementVNode("g",$,[e.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
2
2
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
3
3
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
4
4
  15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
@@ -7,7 +7,7 @@
7
7
  15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
8
8
  13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
9
9
  13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675
10
- 10.8333Z`,stroke:t.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,$),e.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
10
+ 10.8333Z`,stroke:t.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,U),e.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
11
11
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
12
12
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
13
13
  8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
@@ -16,4 +16,4 @@
16
16
  9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
17
17
  6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
18
18
  5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001
19
- 1.66666Z`,stroke:t.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,O)]),i[0]||(i[0]=e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"clip0_466_934"},[e.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),L=["onClick"],P={class:"dialog-block-suggestions-item-label"},M=_(e.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o,n=i=>{t.client.sendProductMessage({productId:t.productId,productTitle:t.productTitle,selectedVariantId:t.selectedVariantId,question:i,fromQuestionSuggestion:!0})};return(i,r)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.questions,c=>(e.openBlock(),e.createElementBlock("button",{key:c.question,class:"dialog-block-suggestions-item",onClick:l=>n(c.question)},[e.createVNode(R,{class:"dialog-block-suggestions-item-icon",color:t.client.theme.primaryColor},null,8,["color"]),e.createElementVNode("span",P,e.toDisplayString(c.question),1)],8,L))),128))}}),[["__scopeId","data-v-fb1910ce"]]),U={};function K(o,t){return e.openBlock(),e.createElementBlock(e.Fragment,null,[t[0]||(t[0]=e.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),t[1]||(t[1]=e.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),t[2]||(t[2]=e.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const q=_(U,[["render",K],["__scopeId","data-v-26a64b58"]]),x={class:"dialog-block-suggestions-container"},F=_(e.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("div",x,[t.isLoading||!t.questions?(e.openBlock(),e.createBlock(q,{key:0})):(e.openBlock(),e.createBlock(M,{key:1,client:t.client,questions:t.questions,"product-id":t.productId,"product-title":t.productTitle,"selected-variant-id":t.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-18c9e78b"]]),j={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},H=["stroke"],G=e.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("svg",j,[e.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:t.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,H)]))}}),Q=["placeholder"],W=["disabled"],C=_(e.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o,n=e.ref(),i=e.ref(""),r=()=>{var l;(l=n.value)==null||l.focus()},c=()=>{const l=i.value;l.trim()&&(t.client.sendProductMessage({productId:t.productId,productTitle:t.productTitle,selectedVariantId:t.selectedVariantId,question:l,fromQuestionSuggestion:!0}),i.value="")};return(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:"dialog-input-wrapper",onClick:r},[e.withDirectives(e.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:n,"onUpdate:modelValue":d[0]||(d[0]=u=>i.value=u),class:"dialog-ask-anything-input-ai-input",placeholder:t.placeholder??"Ask anything...",onKeydown:e.withKeys(c,["enter"])},null,40,Q),[[e.vModelText,i.value]]),e.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!i.value.trim(),onClick:c},[e.createVNode(G,{color:t.client.theme.ctaTextColor},null,8,["color"])],8,W)]))}}),[["__scopeId","data-v-7649af7c"]]),Z=e.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const t=o,n=document.body,i=c=>c.replace(/([A-Z])/g,"-$1").toLowerCase(),r=c=>{c&&Object.keys(c).forEach(l=>{const d=l,u=i(l);if(c[d]!==void 0){if(typeof c[d]=="object"){Object.keys(c[d]).forEach(s=>{var m;const p=s;if(p!==void 0){const z=i(s),J=c[d];n.style.setProperty(`--dialog-theme-${u}-${z}`,(m=J[p])==null?void 0:m.toString())}});return}if(d==="ctaBorderType"){const s=c[d]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${u}`,s);return}n.style.setProperty(`--dialog-theme-${u}`,c[d].toString())}})};return e.onMounted(()=>{t.theme&&r(t.theme)}),e.watch(()=>t.theme,c=>{c&&r(c)},{deep:!0}),(c,l)=>e.renderSlot(c.$slots,"default")}}),X={id:"dialog-instant",class:"dialog-block-container"},Y=_(e.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!0}},setup(o){const t=o;e.onMounted(()=>{T({method:"vue",version:"3.1.0"}),b("pdp-block")});const n=e.ref(!0),i=e.ref(void 0),r=e.ref(0),c=e.computed(()=>{var s;return n.value?"":(s=i.value)==null?void 0:s.assistantName}),l=e.computed(()=>{var s;return n.value?"":(s=i.value)==null?void 0:s.description}),d=e.computed(()=>{var s;return n.value?"":(s=i.value)==null?void 0:s.inputPlaceholder}),u=async()=>{const s=++r.value;n.value=!0,i.value=void 0;try{const p=await t.client.getSuggestions(t.productId);s===r.value&&(i.value=p)}catch(p){console.error("error",p)}finally{s===r.value&&(n.value=!1)}};return e.watch(()=>[t.client,t.productId],()=>{u()},{immediate:!0}),(s,p)=>(e.openBlock(),e.createBlock(Z,{theme:t.client.theme},{default:e.withCtx(()=>{var m;return[e.createElementVNode("div",X,[e.createVNode(w,{title:c.value,description:l.value},null,8,["title","description"]),e.createVNode(F,{client:t.client,questions:(m=i.value)==null?void 0:m.questions,"is-loading":n.value,"product-id":t.productId,"product-title":t.productTitle,"selected-variant-id":t==null?void 0:t.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),t.enableInput?(e.openBlock(),e.createBlock(C,{key:0,client:t.client,placeholder:d.value,"product-id":t.productId,"product-title":t.productTitle,"selected-variant-id":t==null?void 0:t.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):e.createCommentVNode("",!0)])]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-7e33975d"]]);a.DialogInput=C,a.DialogProductBlock=Y,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
19
+ 1.66666Z`,stroke:t.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,K)]),i[0]||(i[0]=e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"clip0_466_934"},[e.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),M=["onClick"],q={class:"dialog-block-suggestions-item-label"},x=m(e.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o,n=i=>{t.client.sendProductMessage({productId:t.productId,productTitle:t.productTitle,selectedVariantId:t.selectedVariantId,question:i,fromQuestionSuggestion:!0})};return(i,d)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.questions,c=>(e.openBlock(),e.createElementBlock("button",{key:c.question,class:"dialog-block-suggestions-item",onClick:l=>n(c.question)},[e.createVNode(P,{class:"dialog-block-suggestions-item-icon",color:t.client.theme.primaryColor},null,8,["color"]),e.createElementVNode("span",q,e.toDisplayString(c.question),1)],8,M))),128))}}),[["__scopeId","data-v-db34d4b4"]]),H={};function F(o,t){return e.openBlock(),e.createElementBlock(e.Fragment,null,[t[0]||(t[0]=e.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),t[1]||(t[1]=e.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),t[2]||(t[2]=e.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const j=m(H,[["render",F],["__scopeId","data-v-26a64b58"]]),G={class:"dialog-block-suggestions-container"},Q=m(e.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("div",G,[t.isLoading||!t.questions?(e.openBlock(),e.createBlock(j,{key:0})):(e.openBlock(),e.createBlock(x,{key:1,client:t.client,questions:t.questions,"product-id":t.productId,"product-title":t.productTitle,"selected-variant-id":t.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-18c9e78b"]]),W={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Z=["stroke"],z=e.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const t=o;return(n,i)=>(e.openBlock(),e.createElementBlock("svg",W,[e.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:t.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Z)]))}}),X=["placeholder"],Y=["disabled"],k=m(e.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o,n=e.ref(),i=e.ref(""),d=()=>{var l;(l=n.value)==null||l.focus()},c=()=>{const l=i.value;l.trim()&&(t.client.sendProductMessage({productId:t.productId,productTitle:t.productTitle,selectedVariantId:t.selectedVariantId,question:l,fromQuestionSuggestion:!0}),i.value="")};return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:"dialog-input-wrapper",onClick:d},[e.withDirectives(e.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:n,"onUpdate:modelValue":r[0]||(r[0]=u=>i.value=u),class:"dialog-ask-anything-input-ai-input",placeholder:t.placeholder??"Ask anything...",onKeydown:e.withKeys(c,["enter"])},null,40,X),[[e.vModelText,i.value]]),e.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!i.value.trim(),onClick:c},[e.createVNode(z,{color:t.client.theme.ctaTextColor},null,8,["color"])],8,Y)]))}}),[["__scopeId","data-v-4f5901c9"]]),J=e.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const t=o,n=document.body,i=c=>c.replace(/([A-Z])/g,"-$1").toLowerCase(),d=c=>{c&&Object.keys(c).forEach(l=>{const r=l,u=i(l);if(c[r]!==void 0){if(typeof c[r]=="object"){Object.keys(c[r]).forEach(g=>{var p;const s=g;if(s!==void 0){const f=i(g),te=c[r];n.style.setProperty(`--dialog-theme-${u}-${f}`,(p=te[s])==null?void 0:p.toString())}});return}if(r==="ctaBorderType"){const g=c[r]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${u}`,g);return}n.style.setProperty(`--dialog-theme-${u}`,c[r].toString())}})};return e.onMounted(()=>{t.theme&&d(t.theme)}),e.watch(()=>t.theme,c=>{c&&d(c)},{deep:!0}),(c,l)=>e.renderSlot(c.$slots,"default")}}),v=["dir"],ee=m(e.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!0}},setup(o){const t=o;e.onMounted(()=>{N({method:"vue",version:"3.2.0"}),B("pdp-block")});const n=e.ref(!0),i=e.ref(void 0),d=e.ref(0),c=e.computed(()=>{var s;return n.value?"":(s=i.value)==null?void 0:s.assistantName}),l=e.computed(()=>{var s;return n.value?"":(s=i.value)==null?void 0:s.description}),r=e.computed(()=>{var s;return n.value?"":(s=i.value)==null?void 0:s.inputPlaceholder}),u=e.computed(()=>{var s;return I((s=t.client.getLocalizationInformations())==null?void 0:s.languageCode)}),g=async()=>{const s=++d.value;n.value=!0,i.value=void 0;try{const p=await t.client.getSuggestions(t.productId);s===d.value&&(i.value=p)}catch(p){console.error("error",p)}finally{s===d.value&&(n.value=!1)}};return e.watch(()=>[t.client,t.productId],()=>{g()},{immediate:!0}),(s,p)=>(e.openBlock(),e.createBlock(J,{theme:t.client.theme},{default:e.withCtx(()=>{var f;return[e.createElementVNode("div",{id:"dialog-instant",class:"dialog-block-container",dir:u.value},[e.createVNode(y,{title:c.value,description:l.value},null,8,["title","description"]),e.createVNode(Q,{client:t.client,questions:(f=i.value)==null?void 0:f.questions,"is-loading":n.value,"product-id":t.productId,"product-title":t.productTitle,"selected-variant-id":t==null?void 0:t.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),t.enableInput?(e.openBlock(),e.createBlock(k,{key:0,client:t.client,placeholder:r.value,"product-id":t.productId,"product-title":t.productTitle,"selected-variant-id":t==null?void 0:t.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):e.createCommentVNode("",!0)],8,v)]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-c57aa677"]]);a.DialogInput=k,a.DialogProductBlock=ee,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-vue",
3
3
  "private": false,
4
- "version": "3.1.0",
4
+ "version": "3.2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/dialog-vue.umd.js",
7
7
  "module": "./dist/dialog-vue.js",
@@ -29,7 +29,7 @@
29
29
  "eslint-plugin-vue": "^10.0.0",
30
30
  "vite-plugin-eslint": "^1.8.1",
31
31
  "vue-tsc": "^2.2.4",
32
- "@askdialog/dialog-sdk": "2.3.0"
32
+ "@askdialog/dialog-sdk": "2.8.0"
33
33
  },
34
34
  "author": "Dialog",
35
35
  "publishConfig": {