@askdialog/dialog-vue 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +104 -3
  2. package/package.json +7 -1
package/README.md CHANGED
@@ -1,5 +1,106 @@
1
- # Vue 3 + TypeScript + Vite
1
+ # Dialog SDK
2
2
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
3
+ ## Dialog
4
4
 
5
- Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
5
+ Dialog is an AI assistant designed to boost e-commerce sales by providing intelligent product recommendations and seamless customer interactions.
6
+
7
+ Visit our website: [Dialog AI Assistant](https://www.askdialog.com/)
8
+
9
+ Need to see it in action? [Request one here](https://w1rsh3lwqfo.typeform.com/to/VxHL0RBR?typeform-source=dialog-sdk)
10
+
11
+ ## Description
12
+
13
+ Dialog vue is a component library designed to be used with he progressive javascript framework VueJs.
14
+
15
+ ## Get started
16
+
17
+ ### Prerequisites
18
+
19
+ Before using the Dialog Vue, you need:
20
+
21
+ - Our [Dialog SDK](https://www.npmjs.com/package/@askdialog/dialog-sdk) installed.
22
+ - An active API Key, you can retrieve your api key in your [organization settings](https://app.askdialog.com/settings)
23
+
24
+ ### Installation
25
+
26
+ ```bash
27
+ npm install @askdialog/dialog-vue
28
+ # or
29
+ pnpm add @askdialog/dialog-vue
30
+ # or
31
+ yarn add @askdialog/dialog-vue
32
+ ```
33
+
34
+ ### DialogBlockProduct
35
+
36
+ #### Instantiate the client
37
+
38
+ ```typescript
39
+ import { Dialog } from '@dialog/dialog-sdk';
40
+
41
+ const client = new Dialog({
42
+ apiKey: 'YOUR_API_KEY', // required
43
+ locale: 'TARGETED_LOCALE', // required
44
+ callbacks: {
45
+ addToCart: () => Promise<void>, // required
46
+ getProduct: () => Promise<Product>, // required
47
+ },
48
+ });
49
+ ```
50
+
51
+ #### Use DialogProductBlock component
52
+
53
+ ````html
54
+ <DialogProductBlock
55
+ :client="client"
56
+ product-id="7899322908810"
57
+ product-title="Product Title"
58
+ selected-variant-id="1234567890"
59
+ />
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
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-vue",
3
3
  "private": false,
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "type": "module",
6
6
  "main": "./dist/dialog-vue.umd.js",
7
7
  "module": "./dist/dialog-vue.js",
@@ -45,6 +45,12 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
+ "keywords": [
49
+ "dialog",
50
+ "dialog-vue",
51
+ "dialog-sdk",
52
+ "vue components"
53
+ ],
48
54
  "scripts": {
49
55
  "dev": "vite",
50
56
  "clean": "rm -rf dist",