@askdialog/dialog-sdk 1.0.1 → 1.0.3

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 +91 -6
  2. package/package.json +9 -2
package/README.md CHANGED
@@ -1,10 +1,26 @@
1
- # Dialog Custom SDK
1
+ # Dialog SDK
2
+
3
+ ## Dialog
4
+
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)
2
10
 
3
11
  ## Description
4
12
 
5
- Dialog Custom SDK is a TypeScript library that allows easy integration of the Dialog assistant.
13
+ Dialog SDK is a powerful TypeScript library that seamlessly integrates the Dialog AI assistant into your applications. It provides a comprehensive set of tools for managing assistant interactions, handling e-commerce operations like product fetching and cart management, and customizing the assistant's appearance to match your brand.
14
+
15
+ ## Get started
16
+
17
+ ### Prerequisites
18
+
19
+ Before using the Dialog SDK, you need:
6
20
 
7
- ## Installation
21
+ - An active API Key, you can retrieve your api key in your [organization settings](https://app.askdialog.com/settings)
22
+
23
+ ### Installation
8
24
 
9
25
  ```bash
10
26
  npm install @dialog/dialog-sdk
@@ -14,9 +30,78 @@ pnpm add @dialog/dialog-sdk
14
30
  yarn add @dialog/dialog-sdk
15
31
  ```
16
32
 
17
- ## Main Features
33
+ ### Instantiate the client
34
+
35
+ ```typescript
36
+ import { Dialog } from '@dialog/dialog-sdk';
37
+
38
+ const client = new Dialog({
39
+ apiKey: 'YOUR_API_KEY', // required
40
+ locale: 'TARGETED_LOCALE', // required
41
+ callbacks: {
42
+ addToCart: () => Promise<void>, // required
43
+ getProduct: () => Promise<Product>, // required
44
+ },
45
+ });
46
+ ```
47
+
48
+ The apiKey is required to authenticate with our API and interact with our assistant.
49
+ The locale specifies the language you want to use.
50
+ The addToCart function is triggered when a user clicks the AddToCart button.
51
+ The getProduct function is used to display product information in the assistant.
52
+
53
+ ### Features
54
+
55
+ - Send a message with context
56
+
57
+ ```typescript
58
+ client.sendProductMessage({
59
+ question: 'YOUR_QUESTION', // required
60
+ productId: 'PRODUCT_ID', // required
61
+ productTitle: 'PRODUCT_TITLE', // required
62
+ answer: '', // Optional
63
+ selectedVariantId?: 'CURRENT_VARIANT_ID', // Optional
64
+ })
65
+ ```
66
+
67
+ - Send message without context
68
+
69
+ ```typescript
70
+ client.sendGenericMessage({
71
+ question: 'YOUR_QUESTION', // required
72
+ });
73
+ ```
18
74
 
19
- - Assistant controls (open / close / send message)
20
75
  - Handler for fetch product
76
+
77
+ ```typescript
78
+ const client = new Dialog({
79
+ ...,
80
+ callbacks: {
81
+ getProduct: () => {
82
+ // Call your api to retrieve product information
83
+ const response = await fetch('....');
84
+ const data = await response.json();
85
+ // To define
86
+ return {};
87
+ }
88
+ },
89
+ });
90
+ ```
91
+
21
92
  - Handler for add to cart
22
- - Assistant theming
93
+
94
+ ```typescript
95
+ const client = new Dialog({
96
+ ...,
97
+ callbacks: {
98
+ addToCart: () => {
99
+ // Call your api to trigger addToCart
100
+ const response = await fetch('....');
101
+
102
+ // Trigger other stuff like confirmation modal
103
+ return;
104
+ }
105
+ },
106
+ });
107
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
5
  "description": "Dialog SDK",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,14 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
- "keywords": [],
18
+ "keywords": [
19
+ "dialog",
20
+ "ai",
21
+ "assistant",
22
+ "ecommerce",
23
+ "sdk",
24
+ "typescript"
25
+ ],
19
26
  "author": "Dialog",
20
27
  "license": "MIT",
21
28
  "devDependencies": {