@askdialog/dialog-vue 0.0.0-beta-20260604071941

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.
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ title?: string;
3
+ description?: string;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
6
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Dialog, Suggestion } from '@askdialog/dialog-sdk';
2
+ type __VLS_Props = {
3
+ client: Dialog;
4
+ questions: Suggestion["questions"];
5
+ productId: string;
6
+ productTitle: string;
7
+ selectedVariantId?: string;
8
+ };
9
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { Dialog, Suggestion } from '@askdialog/dialog-sdk';
2
+ type __VLS_Props = {
3
+ client: Dialog;
4
+ questions: Suggestion["questions"] | undefined;
5
+ isLoading: boolean;
6
+ productId: string;
7
+ productTitle: string;
8
+ selectedVariantId?: string;
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
11
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { Dialog } from '@askdialog/dialog-sdk';
2
+ interface Props {
3
+ client: Dialog;
4
+ placeholder?: string;
5
+ productId: string;
6
+ productTitle: string;
7
+ selectedVariantId?: string;
8
+ }
9
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
10
+ inputRef: HTMLInputElement;
11
+ }, HTMLDivElement>;
12
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { Dialog } from '@askdialog/dialog-sdk';
2
+ interface Props {
3
+ client: Dialog;
4
+ productId: string;
5
+ productTitle: string;
6
+ selectedVariantId?: string;
7
+ enableInput?: boolean;
8
+ }
9
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
10
+ selectedVariantId: string;
11
+ enableInput: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { Theme } from '@askdialog/dialog-sdk';
2
+ type __VLS_Props = {
3
+ theme: Theme;
4
+ };
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: any;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
+ export default _default;
17
+ type __VLS_WithTemplateSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,3 @@
1
+ import { default as DialogProductBlock } from './DialogProductBlock/DialogProductBlock.vue';
2
+ import { default as DialogInput } from './DialogProductBlock/DialogInput.vue';
3
+ export { DialogProductBlock, DialogInput };
@@ -0,0 +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-651875ac]{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-651875ac]>*{box-sizing:border-box}
@@ -0,0 +1,346 @@
1
+ import { defineComponent as p, createElementBlock as u, openBlock as d, createElementVNode as c, toDisplayString as I, Fragment as b, renderList as A, createVNode as m, createBlock as S, ref as k, withDirectives as R, withKeys as N, vModelText as O, onMounted as w, watch as E, renderSlot as $, computed as v, withCtx as L, createCommentVNode as B } from "vue";
2
+ var f;
3
+ (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
+ })(f || (f = {}));
6
+ var T;
7
+ (function(t) {
8
+ 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
+ f.TRACK_ADD_TO_CART, f.TRACK_SUBMIT_CHECKOUT;
11
+ const U = { class: "dialog-block-header-container" }, V = { class: "dialog-block-title" }, x = { class: "dialog-block-description" }, P = /* @__PURE__ */ p({
12
+ __name: "DialogBlockHeader",
13
+ props: {
14
+ title: {},
15
+ description: {}
16
+ },
17
+ setup(t) {
18
+ const e = t;
19
+ return (s, o) => (d(), u("div", U, [
20
+ c("div", V, I(e.title ?? "Your expert"), 1),
21
+ c("div", x, I(e.description ?? "A question about this product?"), 1)
22
+ ]));
23
+ }
24
+ }), C = (t, e) => {
25
+ const s = t.__vccOpts || t;
26
+ for (const [o, a] of e)
27
+ s[o] = a;
28
+ return s;
29
+ }, K = /* @__PURE__ */ C(P, [["__scopeId", "data-v-28e6dda7"]]), M = {
30
+ width: "20",
31
+ height: "20",
32
+ viewBox: "0 0 20 20",
33
+ fill: "none",
34
+ xmlns: "http://www.w3.org/2000/svg"
35
+ }, q = { "clip-path": "url(#clip0_466_934)" }, F = ["stroke"], j = ["stroke"], Q = /* @__PURE__ */ p({
36
+ __name: "AiStarsIcon",
37
+ props: {
38
+ color: {}
39
+ },
40
+ setup(t) {
41
+ const e = t;
42
+ return (s, o) => (d(), u("svg", M, [
43
+ c("g", q, [
44
+ c("path", {
45
+ d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
46
+ 12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
47
+ 13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
48
+ 15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
49
+ 16.3622 6.2917 16.5834 6.07046 17.0259L5.41675 18.3333L4.76303 17.0259C4.54179
50
+ 16.5834 4.43117 16.3622 4.28339 16.1704C4.15225 16.0003 3.99974 15.8478 3.82962
51
+ 15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
52
+ 13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
53
+ 13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675
54
+ 10.8333Z`,
55
+ stroke: e.color || "#181825",
56
+ "stroke-width": "1.5",
57
+ "stroke-linecap": "round",
58
+ "stroke-linejoin": "round"
59
+ }, null, 8, F),
60
+ c("path", {
61
+ d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
62
+ 5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
63
+ 6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
64
+ 8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
65
+ 9.8631 13.7173 10.1686 13.4823 10.7796L12.5001 13.3333L11.5179 10.7796C11.2829
66
+ 10.1686 11.1654 9.8631 10.9827 9.60612C10.8207 9.37836 10.6217 9.17937 10.3939
67
+ 9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
68
+ 6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
69
+ 5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001
70
+ 1.66666Z`,
71
+ stroke: e.color || "#181825",
72
+ "stroke-width": "1.5",
73
+ "stroke-linecap": "round",
74
+ "stroke-linejoin": "round"
75
+ }, null, 8, j)
76
+ ]),
77
+ o[0] || (o[0] = c("defs", null, [
78
+ c("clipPath", { id: "clip0_466_934" }, [
79
+ c("rect", {
80
+ width: "20",
81
+ height: "20",
82
+ fill: "white"
83
+ })
84
+ ])
85
+ ], -1))
86
+ ]));
87
+ }
88
+ }), G = ["onClick"], H = { class: "dialog-block-suggestions-item-label" }, Z = /* @__PURE__ */ p({
89
+ __name: "DialogBlockSuggestions",
90
+ props: {
91
+ client: {},
92
+ questions: {},
93
+ productId: {},
94
+ productTitle: {},
95
+ selectedVariantId: {}
96
+ },
97
+ setup(t) {
98
+ const e = t, s = (o) => {
99
+ e.client.sendProductMessage({
100
+ productId: e.productId,
101
+ productTitle: e.productTitle,
102
+ selectedVariantId: e.selectedVariantId,
103
+ question: o,
104
+ fromQuestionSuggestion: !0
105
+ });
106
+ };
107
+ return (o, a) => (d(!0), u(b, null, A(e.questions, (n) => (d(), u("button", {
108
+ key: n.question,
109
+ class: "dialog-block-suggestions-item",
110
+ onClick: (l) => s(n.question)
111
+ }, [
112
+ m(Q, {
113
+ class: "dialog-block-suggestions-item-icon",
114
+ color: e.client.theme.primaryColor
115
+ }, null, 8, ["color"]),
116
+ c("span", H, I(n.question), 1)
117
+ ], 8, G))), 128));
118
+ }
119
+ }), Y = /* @__PURE__ */ C(Z, [["__scopeId", "data-v-fb1910ce"]]), z = {};
120
+ function J(t, e) {
121
+ return d(), u(b, null, [
122
+ e[0] || (e[0] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
123
+ e[1] || (e[1] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
124
+ e[2] || (e[2] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
125
+ ], 64);
126
+ }
127
+ const W = /* @__PURE__ */ C(z, [["render", J], ["__scopeId", "data-v-26a64b58"]]), X = { class: "dialog-block-suggestions-container" }, ee = /* @__PURE__ */ p({
128
+ __name: "DialogBlockSuggestionsContainer",
129
+ props: {
130
+ client: {},
131
+ questions: {},
132
+ isLoading: { type: Boolean },
133
+ productId: {},
134
+ productTitle: {},
135
+ selectedVariantId: {}
136
+ },
137
+ setup(t) {
138
+ const e = t;
139
+ return (s, o) => (d(), u("div", X, [
140
+ e.isLoading || !e.questions ? (d(), S(W, { key: 0 })) : (d(), S(Y, {
141
+ key: 1,
142
+ client: e.client,
143
+ questions: e.questions,
144
+ "product-id": e.productId,
145
+ "product-title": e.productTitle,
146
+ "selected-variant-id": e.selectedVariantId
147
+ }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
148
+ ]));
149
+ }
150
+ }), te = /* @__PURE__ */ C(ee, [["__scopeId", "data-v-18c9e78b"]]), oe = {
151
+ width: "20",
152
+ height: "20",
153
+ viewBox: "0 0 20 20",
154
+ fill: "none",
155
+ xmlns: "http://www.w3.org/2000/svg"
156
+ }, ne = ["stroke"], se = /* @__PURE__ */ p({
157
+ __name: "ArrowIcon",
158
+ props: {
159
+ color: {}
160
+ },
161
+ setup(t) {
162
+ const e = t;
163
+ return (s, o) => (d(), u("svg", oe, [
164
+ c("path", {
165
+ d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
166
+ stroke: e.color || "#ffffff",
167
+ "stroke-width": "1.5",
168
+ "stroke-linecap": "round",
169
+ "stroke-linejoin": "round"
170
+ }, null, 8, ne)
171
+ ]));
172
+ }
173
+ }), ie = ["placeholder"], ce = ["disabled"], le = /* @__PURE__ */ p({
174
+ __name: "DialogInput",
175
+ props: {
176
+ client: {},
177
+ placeholder: {},
178
+ productId: {},
179
+ productTitle: {},
180
+ selectedVariantId: {}
181
+ },
182
+ setup(t) {
183
+ const e = t, s = k(), o = k(""), a = () => {
184
+ var l;
185
+ (l = s.value) == null || l.focus();
186
+ }, n = () => {
187
+ const l = o.value;
188
+ l.trim() && (e.client.sendProductMessage({
189
+ productId: e.productId,
190
+ productTitle: e.productTitle,
191
+ selectedVariantId: e.selectedVariantId,
192
+ question: l,
193
+ fromQuestionSuggestion: !0
194
+ }), o.value = "");
195
+ };
196
+ return (l, r) => (d(), u("div", {
197
+ class: "dialog-input-wrapper",
198
+ onClick: a
199
+ }, [
200
+ R(c("input", {
201
+ id: "dialog-ask-anything-input-ai-input",
202
+ ref_key: "inputRef",
203
+ ref: s,
204
+ "onUpdate:modelValue": r[0] || (r[0] = (_) => o.value = _),
205
+ class: "dialog-ask-anything-input-ai-input",
206
+ placeholder: e.placeholder ?? "Ask anything...",
207
+ onKeydown: N(n, ["enter"])
208
+ }, null, 40, ie), [
209
+ [O, o.value]
210
+ ]),
211
+ c("button", {
212
+ id: "send-message-button-ai-input",
213
+ class: "dialog-input-submit",
214
+ disabled: !o.value.trim(),
215
+ onClick: n
216
+ }, [
217
+ m(se, {
218
+ color: e.client.theme.ctaTextColor
219
+ }, null, 8, ["color"])
220
+ ], 8, ce)
221
+ ]));
222
+ }
223
+ }), re = /* @__PURE__ */ C(le, [["__scopeId", "data-v-7649af7c"]]), de = /* @__PURE__ */ p({
224
+ __name: "ThemeProvider",
225
+ props: {
226
+ theme: {}
227
+ },
228
+ setup(t) {
229
+ const e = t, s = document.body, o = (n) => n.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (n) => {
230
+ n && Object.keys(n).forEach((l) => {
231
+ const r = l, _ = o(l);
232
+ if (n[r] !== void 0) {
233
+ if (typeof n[r] == "object") {
234
+ Object.keys(n[r]).forEach((i) => {
235
+ var h;
236
+ const g = i;
237
+ if (g !== void 0) {
238
+ const y = o(i), D = n[r];
239
+ s.style.setProperty(
240
+ `--dialog-theme-${_}-${y}`,
241
+ (h = D[g]) == null ? void 0 : h.toString()
242
+ );
243
+ }
244
+ });
245
+ return;
246
+ }
247
+ if (r === "ctaBorderType") {
248
+ const i = n[r] === "rounded" ? "24px" : "0";
249
+ s.style.setProperty(`--dialog-theme-${_}`, i);
250
+ return;
251
+ }
252
+ s.style.setProperty(
253
+ `--dialog-theme-${_}`,
254
+ n[r].toString()
255
+ );
256
+ }
257
+ });
258
+ };
259
+ return w(() => {
260
+ e.theme && a(e.theme);
261
+ }), E(
262
+ () => e.theme,
263
+ (n) => {
264
+ n && a(n);
265
+ },
266
+ { deep: !0 }
267
+ ), (n, l) => $(n.$slots, "default");
268
+ }
269
+ }), ae = {
270
+ id: "dialog-instant",
271
+ class: "dialog-block-container"
272
+ }, ue = /* @__PURE__ */ p({
273
+ __name: "DialogProductBlock",
274
+ props: {
275
+ client: {},
276
+ productId: {},
277
+ productTitle: {},
278
+ selectedVariantId: { default: void 0 },
279
+ enableInput: { type: Boolean, default: !0 }
280
+ },
281
+ setup(t) {
282
+ const e = t, s = k(!0), o = k(void 0), a = k(0), n = v(() => {
283
+ var i;
284
+ return s.value ? "" : (i = o.value) == null ? void 0 : i.assistantName;
285
+ }), l = v(() => {
286
+ var i;
287
+ return s.value ? "" : (i = o.value) == null ? void 0 : i.description;
288
+ }), r = v(() => {
289
+ var i;
290
+ return s.value ? "" : (i = o.value) == null ? void 0 : i.inputPlaceholder;
291
+ }), _ = async () => {
292
+ const i = ++a.value;
293
+ s.value = !0, o.value = void 0;
294
+ try {
295
+ const g = await e.client.getSuggestions(e.productId);
296
+ i === a.value && (o.value = g);
297
+ } catch (g) {
298
+ console.error("error", g);
299
+ } finally {
300
+ i === a.value && (s.value = !1);
301
+ }
302
+ };
303
+ return E(
304
+ () => [e.client, e.productId],
305
+ () => {
306
+ _();
307
+ },
308
+ { immediate: !0 }
309
+ ), (i, g) => (d(), S(de, {
310
+ theme: e.client.theme
311
+ }, {
312
+ default: L(() => {
313
+ var h;
314
+ return [
315
+ c("div", ae, [
316
+ m(K, {
317
+ title: n.value,
318
+ description: l.value
319
+ }, null, 8, ["title", "description"]),
320
+ m(te, {
321
+ client: e.client,
322
+ questions: (h = o.value) == null ? void 0 : h.questions,
323
+ "is-loading": s.value,
324
+ "product-id": e.productId,
325
+ "product-title": e.productTitle,
326
+ "selected-variant-id": e == null ? void 0 : e.selectedVariantId
327
+ }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
328
+ e.enableInput ? (d(), S(re, {
329
+ key: 0,
330
+ client: e.client,
331
+ placeholder: r.value,
332
+ "product-id": e.productId,
333
+ "product-title": e.productTitle,
334
+ "selected-variant-id": e == null ? void 0 : e.selectedVariantId
335
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : B("", !0)
336
+ ])
337
+ ];
338
+ }),
339
+ _: 1
340
+ }, 8, ["theme"]));
341
+ }
342
+ }), _e = /* @__PURE__ */ C(ue, [["__scopeId", "data-v-651875ac"]]);
343
+ export {
344
+ re as DialogInput,
345
+ _e as DialogProductBlock
346
+ };
@@ -0,0 +1,19 @@
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 m;(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"})(m||(m={}));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={})),m.TRACK_ADD_TO_CART,m.TRACK_SUBMIT_CHECKOUT;const C={class:"dialog-block-header-container"},h={class:"dialog-block-title"},S={class:"dialog-block-description"},E=e.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const t=o;return(i,n)=>(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",h,e.toDisplayString(t.title??"Your expert"),1),e.createElementVNode("div",S,e.toDisplayString(t.description??"A question about this product?"),1)]))}}),_=(o,t)=>{const i=o.__vccOpts||o;for(const[n,d]of t)i[n]=d;return i},T=_(E,[["__scopeId","data-v-28e6dda7"]]),I={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},N={"clip-path":"url(#clip0_466_934)"},B=["stroke"],b=["stroke"],y=e.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const t=o;return(i,n)=>(e.openBlock(),e.createElementBlock("svg",I,[e.createElementVNode("g",N,[e.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
2
+ 12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
3
+ 13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
4
+ 15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
5
+ 16.3622 6.2917 16.5834 6.07046 17.0259L5.41675 18.3333L4.76303 17.0259C4.54179
6
+ 16.5834 4.43117 16.3622 4.28339 16.1704C4.15225 16.0003 3.99974 15.8478 3.82962
7
+ 15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
8
+ 13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
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,B),e.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
11
+ 5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
12
+ 6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
13
+ 8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
14
+ 9.8631 13.7173 10.1686 13.4823 10.7796L12.5001 13.3333L11.5179 10.7796C11.2829
15
+ 10.1686 11.1654 9.8631 10.9827 9.60612C10.8207 9.37836 10.6217 9.17937 10.3939
16
+ 9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
17
+ 6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
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,b)]),n[0]||(n[0]=e.createElementVNode("defs",null,[e.createElementVNode("clipPath",{id:"clip0_466_934"},[e.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),V=["onClick"],D={class:"dialog-block-suggestions-item-label"},A=_(e.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o,i=n=>{t.client.sendProductMessage({productId:t.productId,productTitle:t.productTitle,selectedVariantId:t.selectedVariantId,question:n,fromQuestionSuggestion:!0})};return(n,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=>i(c.question)},[e.createVNode(y,{class:"dialog-block-suggestions-item-icon",color:t.client.theme.primaryColor},null,8,["color"]),e.createElementVNode("span",D,e.toDisplayString(c.question),1)],8,V))),128))}}),[["__scopeId","data-v-fb1910ce"]]),$={};function O(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 R=_($,[["render",O],["__scopeId","data-v-26a64b58"]]),w={class:"dialog-block-suggestions-container"},L=_(e.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o;return(i,n)=>(e.openBlock(),e.createElementBlock("div",w,[t.isLoading||!t.questions?(e.openBlock(),e.createBlock(R,{key:0})):(e.openBlock(),e.createBlock(A,{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"]]),P={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},U=["stroke"],x=e.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const t=o;return(i,n)=>(e.openBlock(),e.createElementBlock("svg",P,[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,U)]))}}),K=["placeholder"],M=["disabled"],k=_(e.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const t=o,i=e.ref(),n=e.ref(""),d=()=>{var l;(l=i.value)==null||l.focus()},c=()=>{const l=n.value;l.trim()&&(t.client.sendProductMessage({productId:t.productId,productTitle:t.productTitle,selectedVariantId:t.selectedVariantId,question:l,fromQuestionSuggestion:!0}),n.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:i,"onUpdate:modelValue":r[0]||(r[0]=p=>n.value=p),class:"dialog-ask-anything-input-ai-input",placeholder:t.placeholder??"Ask anything...",onKeydown:e.withKeys(c,["enter"])},null,40,K),[[e.vModelText,n.value]]),e.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!n.value.trim(),onClick:c},[e.createVNode(x,{color:t.client.theme.ctaTextColor},null,8,["color"])],8,M)]))}}),[["__scopeId","data-v-7649af7c"]]),q=e.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const t=o,i=document.body,n=c=>c.replace(/([A-Z])/g,"-$1").toLowerCase(),d=c=>{c&&Object.keys(c).forEach(l=>{const r=l,p=n(l);if(c[r]!==void 0){if(typeof c[r]=="object"){Object.keys(c[r]).forEach(s=>{var g;const u=s;if(u!==void 0){const Q=n(s),G=c[r];i.style.setProperty(`--dialog-theme-${p}-${Q}`,(g=G[u])==null?void 0:g.toString())}});return}if(r==="ctaBorderType"){const s=c[r]==="rounded"?"24px":"0";i.style.setProperty(`--dialog-theme-${p}`,s);return}i.style.setProperty(`--dialog-theme-${p}`,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")}}),j={id:"dialog-instant",class:"dialog-block-container"},F=_(e.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!0}},setup(o){const t=o,i=e.ref(!0),n=e.ref(void 0),d=e.ref(0),c=e.computed(()=>{var s;return i.value?"":(s=n.value)==null?void 0:s.assistantName}),l=e.computed(()=>{var s;return i.value?"":(s=n.value)==null?void 0:s.description}),r=e.computed(()=>{var s;return i.value?"":(s=n.value)==null?void 0:s.inputPlaceholder}),p=async()=>{const s=++d.value;i.value=!0,n.value=void 0;try{const u=await t.client.getSuggestions(t.productId);s===d.value&&(n.value=u)}catch(u){console.error("error",u)}finally{s===d.value&&(i.value=!1)}};return e.watch(()=>[t.client,t.productId],()=>{p()},{immediate:!0}),(s,u)=>(e.openBlock(),e.createBlock(q,{theme:t.client.theme},{default:e.withCtx(()=>{var g;return[e.createElementVNode("div",j,[e.createVNode(T,{title:c.value,description:l.value},null,8,["title","description"]),e.createVNode(L,{client:t.client,questions:(g=n.value)==null?void 0:g.questions,"is-loading":i.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)])]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-651875ac"]]);a.DialogInput=k,a.DialogProductBlock=F,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ color?: string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ color?: string;
3
+ };
4
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, SVGSVGElement>;
5
+ export default _default;
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@askdialog/dialog-vue",
3
+ "private": false,
4
+ "version": "0.0.0-beta-20260604071941",
5
+ "type": "module",
6
+ "main": "./dist/dialog-vue.umd.js",
7
+ "module": "./dist/dialog-vue.js",
8
+ "types": "./dist/main.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/main.d.ts",
12
+ "require": "./dist/dialog-vue.umd.js",
13
+ "import": "./dist/dialog-vue.js",
14
+ "default": "./dist/dialog-vue.js"
15
+ },
16
+ "./style.css": "./dist/dialog-vue.css"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "peerDependencies": {
22
+ "@askdialog/dialog-sdk": "2.0.0",
23
+ "vue": "^3.0.0"
24
+ },
25
+ "devDependencies": {
26
+ "@rollup/plugin-replace": "^6.0.2",
27
+ "@vitejs/plugin-vue": "^5.2.1",
28
+ "@vue/tsconfig": "^0.7.0",
29
+ "eslint-plugin-vue": "^10.0.0",
30
+ "vite-plugin-eslint": "^1.8.1",
31
+ "vue-tsc": "^2.2.4",
32
+ "@askdialog/dialog-sdk": "2.0.0"
33
+ },
34
+ "author": "Dialog",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "keywords": [
39
+ "dialog",
40
+ "dialog-vue",
41
+ "dialog-sdk",
42
+ "vue components"
43
+ ],
44
+ "scripts": {
45
+ "clean": "rm -rf dist",
46
+ "build": "pnpm run clean && vue-tsc -b && vite build",
47
+ "lint": "eslint .",
48
+ "lint:fix": "eslint . --fix"
49
+ }
50
+ }