@release0/js 1.1.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.
- package/README.md +169 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Release0 JS library
|
|
2
|
+
|
|
3
|
+
Frontend library to embed chat agents from [Release0](https://release0.com/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Using npm
|
|
8
|
+
|
|
9
|
+
To install, simply run:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @release0/js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Directly in your HTML
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
<script type="module">
|
|
19
|
+
import Agent from 'https://cdn.jsdelivr.net/npm/@release0/js@1.1.0/dist/web.js'
|
|
20
|
+
|
|
21
|
+
Agent.initStandard({
|
|
22
|
+
agent: 'my-agent-id',
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<agent-standard style="width: 100%; height: 600px; "></agent-standard>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Standard
|
|
30
|
+
|
|
31
|
+
You can get the standard HTML and Javascript code by clicking on the "HTML & Javascript" button in the "Integrations" tab of your agent.
|
|
32
|
+
|
|
33
|
+
There, you can change the container dimensions. Here is a code example:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<script type="module">
|
|
37
|
+
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.0/dist/web.js";
|
|
38
|
+
|
|
39
|
+
Agent.initStandard({
|
|
40
|
+
agent: "my-agent-id",
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<agent-standard style="width: 100%; height: 600px; "></agent-standard>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This code is creating a container with a 100% width (will match parent width) and 600px height.
|
|
48
|
+
|
|
49
|
+
## Popup
|
|
50
|
+
|
|
51
|
+
You can get the popup HTML and Javascript code by clicking on the "HTML & Javascript" button in the "Integrations" tab of your agent.
|
|
52
|
+
|
|
53
|
+
Here is an example:
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<script type="module">
|
|
57
|
+
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.0/dist/web.js";
|
|
58
|
+
|
|
59
|
+
Agent.initPopup({
|
|
60
|
+
agent: "my-agent-id",
|
|
61
|
+
apiHost: "https://release0.com",
|
|
62
|
+
autoShowDelay: 3000,
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This code will automatically trigger the popup window after 3 seconds.
|
|
68
|
+
|
|
69
|
+
### Open or Close a popup
|
|
70
|
+
|
|
71
|
+
You can use these commands:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
Agent.open();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
Agent.close();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
Agent.toggle();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
You can bind these commands on a button element, for example:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<button onclick="Agent.open()">Contact us</button>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Bubble
|
|
92
|
+
|
|
93
|
+
You can get the bubble HTML and Javascript code by clicking on the "HTML & Javascript" button in the "Integrations" tab of your agent.
|
|
94
|
+
|
|
95
|
+
Here is an example:
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<script type="module">
|
|
99
|
+
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.0/dist/web.js";
|
|
100
|
+
|
|
101
|
+
Agent.initBubble({
|
|
102
|
+
agent: "my-agent-id",
|
|
103
|
+
previewMessage: {
|
|
104
|
+
message: "I have a question for you!",
|
|
105
|
+
autoShowDelay: 5000,
|
|
106
|
+
avatarUrl: "https://release0.com/images/logo512.png",
|
|
107
|
+
},
|
|
108
|
+
theme: {
|
|
109
|
+
button: { backgroundColor: "#0042DA", iconColor: "#FFFFFF" },
|
|
110
|
+
previewMessage: { backgroundColor: "#ffffff", textColor: "black" },
|
|
111
|
+
chatWindow: { backgroundColor: "#ffffff" },
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
This code will show the bubble and let a preview message appear after 5 seconds.
|
|
118
|
+
|
|
119
|
+
### Open or close the preview message
|
|
120
|
+
|
|
121
|
+
You can use these commands:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
Agent.showPreviewMessage();
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
Agent.hidePreviewMessage();
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Open or close the agent
|
|
132
|
+
|
|
133
|
+
You can use these commands:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
Agent.open();
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
Agent.close();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
Agent.toggle();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
You can bind these commands on a button element, for example:
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<button onclick="Agent.open()">Contact us</button>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Additional configuration
|
|
154
|
+
|
|
155
|
+
You can prefill the agent variable values in your embed code by adding the `prefilledVariables` option. Here is an example:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
Agent.initStandard({
|
|
159
|
+
agent: "my-agent-id",
|
|
160
|
+
prefilledVariables: {
|
|
161
|
+
"Current URL": "https://my-site.com/account",
|
|
162
|
+
"User name": "John Doe",
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
It will prefill the `Current URL` variable with "https://my-site.com/account" and the `User name` variable with "John Doe".
|
|
168
|
+
|
|
169
|
+
Note that if your site URL contains query params (i.e. https://release0.com?User%20name=John%20Doe), the variables will automatically be injected to the agent. So you don't need to manually transfer query params to the agent embed configuration.
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@release0/js",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Javascript library to display Release0 agents on your website",
|
|
5
|
+
"license": "FSL-1.1-ALv2",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js",
|
|
11
|
+
"./web": "./dist/web.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "tsup --watch",
|
|
15
|
+
"build": "tsup"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@ai-sdk/ui-utils": "0.0.46",
|
|
19
|
+
"@ark-ui/solid": "4.2.1",
|
|
20
|
+
"@fix-webm-duration/fix": "1.0.1",
|
|
21
|
+
"@stripe/stripe-js": "1.54.1",
|
|
22
|
+
"clsx": "2.1.1",
|
|
23
|
+
"dompurify": "3.0.6",
|
|
24
|
+
"ky": "1.2.4",
|
|
25
|
+
"marked": "9.0.3",
|
|
26
|
+
"partysocket": "1.0.2",
|
|
27
|
+
"solid-element": "1.9.0",
|
|
28
|
+
"solid-js": "1.9.2",
|
|
29
|
+
"@release0/blocks-bubbles": "workspace:*",
|
|
30
|
+
"@release0/blocks-inputs": "workspace:*",
|
|
31
|
+
"@release0/blocks-logic": "workspace:*",
|
|
32
|
+
"@release0/agent-engine": "workspace:*",
|
|
33
|
+
"@release0/env": "workspace:*",
|
|
34
|
+
"@release0/lib": "workspace:*",
|
|
35
|
+
"@release0/rich-text": "workspace:*",
|
|
36
|
+
"@release0/settings": "workspace:*",
|
|
37
|
+
"@release0/theme": "workspace:*",
|
|
38
|
+
"@release0/tsconfig": "workspace:*",
|
|
39
|
+
"@release0/zendesk-block": "workspace:*",
|
|
40
|
+
"@types/dompurify": "3.0.3",
|
|
41
|
+
"autoprefixer": "10.4.20",
|
|
42
|
+
"esbuild-plugin-solid": "^0.6.0",
|
|
43
|
+
"postcss": "8.4.49",
|
|
44
|
+
"tailwindcss": "3.4.16",
|
|
45
|
+
"tsup": "8.3.0"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|