@askdialog/dialog-vue 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,6 @@ Dialog is an AI assistant designed to boost e-commerce sales by providing intell
|
|
|
6
6
|
|
|
7
7
|
Visit our website: [Dialog AI Assistant](https://www.askdialog.com/)
|
|
8
8
|
|
|
9
|
-
Need to see it in action? [Request one here](https://w1rsh3lwqfo.typeform.com/to/VxHL0RBR?typeform-source=dialog-sdk)
|
|
10
|
-
|
|
11
9
|
## Description
|
|
12
10
|
|
|
13
11
|
Dialog vue is a component library designed to be used with he progressive javascript framework VueJs.
|
|
@@ -31,9 +29,7 @@ pnpm add @askdialog/dialog-vue
|
|
|
31
29
|
yarn add @askdialog/dialog-vue
|
|
32
30
|
```
|
|
33
31
|
|
|
34
|
-
###
|
|
35
|
-
|
|
36
|
-
#### Instantiate the client
|
|
32
|
+
### Instantiate the client
|
|
37
33
|
|
|
38
34
|
```typescript
|
|
39
35
|
import { Dialog } from '@dialog/dialog-sdk';
|
|
@@ -48,59 +44,13 @@ const client = new Dialog({
|
|
|
48
44
|
});
|
|
49
45
|
```
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
### Use DialogProductBlock component
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
```html
|
|
54
50
|
<DialogProductBlock
|
|
55
51
|
:client="client"
|
|
56
|
-
product-id="
|
|
52
|
+
product-id="Product identifier"
|
|
57
53
|
product-title="Product Title"
|
|
58
|
-
selected-variant-id="
|
|
54
|
+
selected-variant-id="Variant identifier"
|
|
59
55
|
/>
|
|
60
|
-
``` ### Features - Send a message with context ```typescript
|
|
61
|
-
client.sendProductMessage({ question: 'YOUR_QUESTION', // required productId:
|
|
62
|
-
'PRODUCT_ID', // required productTitle: 'PRODUCT_TITLE', // required answer: '',
|
|
63
|
-
// Optional selectedVariantId: 'CURRENT_VARIANT_ID', // Optional });
|
|
64
|
-
````
|
|
65
|
-
|
|
66
|
-
- Send message without context
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
client.sendGenericMessage({
|
|
70
|
-
question: 'YOUR_QUESTION', // required
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
- Handler for fetch product
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
const client = new Dialog({
|
|
78
|
-
...,
|
|
79
|
-
callbacks: {
|
|
80
|
-
getProduct: () => {
|
|
81
|
-
// Call your api to retrieve product information
|
|
82
|
-
const response = await fetch('....');
|
|
83
|
-
const data = await response.json();
|
|
84
|
-
// To define
|
|
85
|
-
return {};
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
- Handler for add to cart
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
const client = new Dialog({
|
|
95
|
-
...,
|
|
96
|
-
callbacks: {
|
|
97
|
-
addToCart: () => {
|
|
98
|
-
// Call your api to trigger addToCart
|
|
99
|
-
const response = await fetch('....');
|
|
100
|
-
|
|
101
|
-
// Trigger other stuff like confirmation modal
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
56
|
```
|