@release0/js 1.1.0 → 1.1.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.
- package/README.md +4 -4
- package/dist/index.d.ts +129 -0
- package/dist/index.js +1 -0
- package/dist/web.js +2139 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install @release0/js
|
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
<script type="module">
|
|
19
|
-
import Agent from 'https://cdn.jsdelivr.net/npm/@release0/js@1.1.
|
|
19
|
+
import Agent from 'https://cdn.jsdelivr.net/npm/@release0/js@1.1.2/dist/web.js'
|
|
20
20
|
|
|
21
21
|
Agent.initStandard({
|
|
22
22
|
agent: 'my-agent-id',
|
|
@@ -34,7 +34,7 @@ There, you can change the container dimensions. Here is a code example:
|
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
36
|
<script type="module">
|
|
37
|
-
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.
|
|
37
|
+
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.2/dist/web.js";
|
|
38
38
|
|
|
39
39
|
Agent.initStandard({
|
|
40
40
|
agent: "my-agent-id",
|
|
@@ -54,7 +54,7 @@ Here is an example:
|
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
56
|
<script type="module">
|
|
57
|
-
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.
|
|
57
|
+
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.2/dist/web.js";
|
|
58
58
|
|
|
59
59
|
Agent.initPopup({
|
|
60
60
|
agent: "my-agent-id",
|
|
@@ -96,7 +96,7 @@ Here is an example:
|
|
|
96
96
|
|
|
97
97
|
```html
|
|
98
98
|
<script type="module">
|
|
99
|
-
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.
|
|
99
|
+
import Agent from "https://cdn.jsdelivr.net/npm/@release0/js@1.1.2/dist/web.js";
|
|
100
100
|
|
|
101
101
|
Agent.initBubble({
|
|
102
102
|
agent: "my-agent-id",
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { InputBlock } from '@release0/blocks-inputs/schema';
|
|
2
|
+
import { StartFrom } from '@release0/agent-engine/schemas/api';
|
|
3
|
+
import { Font } from '@release0/theme/schemas';
|
|
4
|
+
|
|
5
|
+
type BubbleParams = {
|
|
6
|
+
theme?: BubbleTheme;
|
|
7
|
+
previewMessage?: PreviewMessageParams;
|
|
8
|
+
autoShowDelay?: number;
|
|
9
|
+
};
|
|
10
|
+
type BubbleTheme = {
|
|
11
|
+
chatWindow?: ChatWindowTheme;
|
|
12
|
+
button?: ButtonTheme;
|
|
13
|
+
previewMessage?: PreviewMessageTheme;
|
|
14
|
+
placement?: "left" | "right";
|
|
15
|
+
};
|
|
16
|
+
type ChatWindowTheme = {
|
|
17
|
+
backgroundColor?: string;
|
|
18
|
+
maxWidth?: string;
|
|
19
|
+
maxHeight?: string;
|
|
20
|
+
};
|
|
21
|
+
type ButtonTheme = {
|
|
22
|
+
size?: "medium" | "large" | `${number}px`;
|
|
23
|
+
backgroundColor?: string;
|
|
24
|
+
iconColor?: string;
|
|
25
|
+
customIconSrc?: string;
|
|
26
|
+
customCloseIconSrc?: string;
|
|
27
|
+
};
|
|
28
|
+
type PreviewMessageParams = {
|
|
29
|
+
avatarUrl?: string;
|
|
30
|
+
message: string;
|
|
31
|
+
autoShowDelay?: number;
|
|
32
|
+
};
|
|
33
|
+
type PreviewMessageTheme = {
|
|
34
|
+
backgroundColor?: string;
|
|
35
|
+
textColor?: string;
|
|
36
|
+
closeButtonBackgroundColor?: string;
|
|
37
|
+
closeButtonIconColor?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type CommandArgs = {
|
|
41
|
+
id?: string;
|
|
42
|
+
};
|
|
43
|
+
type CommandData = CommandArgs & {
|
|
44
|
+
isFromAgent: boolean;
|
|
45
|
+
} & ({
|
|
46
|
+
command: "open" | "toggle" | "close" | "hidePreviewMessage" | "unmount";
|
|
47
|
+
} | ShowMessageCommandData | SetPrefilledVariablesCommandData | SetInputValueCommandData);
|
|
48
|
+
type ShowMessageCommandData = {
|
|
49
|
+
command: "showPreviewMessage";
|
|
50
|
+
message?: Pick<PreviewMessageParams, "avatarUrl" | "message">;
|
|
51
|
+
};
|
|
52
|
+
type SetPrefilledVariablesCommandData = {
|
|
53
|
+
command: "setPrefilledVariables";
|
|
54
|
+
variables: Record<string, string | number | boolean>;
|
|
55
|
+
};
|
|
56
|
+
type SetInputValueCommandData = {
|
|
57
|
+
command: "setInputValue";
|
|
58
|
+
value: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
declare const close: ({ id }?: CommandArgs) => void;
|
|
62
|
+
|
|
63
|
+
declare const open: ({ id }?: CommandArgs) => void;
|
|
64
|
+
|
|
65
|
+
declare const showPreviewMessage: (proactiveMessage: ShowMessageCommandData["message"] | undefined, { id }?: CommandArgs) => void;
|
|
66
|
+
|
|
67
|
+
declare const toggle: ({ id }?: CommandArgs) => void;
|
|
68
|
+
|
|
69
|
+
declare const setInputValue: (value: string, { id }?: CommandArgs) => void;
|
|
70
|
+
|
|
71
|
+
declare const unmount: ({ id }?: CommandArgs) => void;
|
|
72
|
+
|
|
73
|
+
declare const setPrefilledVariables: (variables: Record<string, string | number | boolean>, { id }?: CommandArgs) => void;
|
|
74
|
+
|
|
75
|
+
declare const hidePreviewMessage: ({ id }?: CommandArgs) => void;
|
|
76
|
+
|
|
77
|
+
type OutgoingLog = {
|
|
78
|
+
status: string;
|
|
79
|
+
description: string;
|
|
80
|
+
details?: unknown;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type AgentProps = {
|
|
84
|
+
id?: string;
|
|
85
|
+
agent: string | any;
|
|
86
|
+
isPreview?: boolean;
|
|
87
|
+
resultId?: string;
|
|
88
|
+
prefilledVariables?: Record<string, unknown>;
|
|
89
|
+
apiHost?: string;
|
|
90
|
+
font?: Font;
|
|
91
|
+
progressBarRef?: HTMLDivElement;
|
|
92
|
+
startFrom?: StartFrom;
|
|
93
|
+
sessionId?: string;
|
|
94
|
+
onNewInputBlock?: (inputBlock: InputBlock) => void;
|
|
95
|
+
onAnswer?: (answer: {
|
|
96
|
+
message: string;
|
|
97
|
+
blockId: string;
|
|
98
|
+
}) => void;
|
|
99
|
+
onInit?: () => void;
|
|
100
|
+
onEnd?: () => void;
|
|
101
|
+
onNewLogs?: (logs: OutgoingLog[]) => void;
|
|
102
|
+
onChatStatePersisted?: (isEnabled: boolean) => void;
|
|
103
|
+
onScriptExecutionSuccess?: (message: string) => void;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type PopupParams = {
|
|
107
|
+
autoShowDelay?: number;
|
|
108
|
+
theme?: {
|
|
109
|
+
width?: string;
|
|
110
|
+
backgroundColor?: string;
|
|
111
|
+
zIndex?: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
type PopupProps = AgentProps & PopupParams & {
|
|
116
|
+
defaultOpen?: boolean;
|
|
117
|
+
isOpen?: boolean;
|
|
118
|
+
onOpen?: () => void;
|
|
119
|
+
onClose?: () => void;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
type BubbleProps = AgentProps & BubbleParams & {
|
|
123
|
+
onOpen?: () => void;
|
|
124
|
+
onClose?: () => void;
|
|
125
|
+
onPreviewMessageClick?: () => void;
|
|
126
|
+
onPreviewMessageDismissed?: () => void;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export { type AgentProps, type BubbleParams, type BubbleProps, type BubbleTheme, type ButtonTheme, type ChatWindowTheme, type CommandArgs, type CommandData, type PopupParams, type PopupProps, type PreviewMessageParams, type PreviewMessageTheme, type SetInputValueCommandData, type SetPrefilledVariablesCommandData, type ShowMessageCommandData, close, hidePreviewMessage, open, setInputValue, setPrefilledVariables, showPreviewMessage, toggle, unmount };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=({id:o}={})=>{let e={isFromAgent:!0,command:"close",id:o};window.postMessage(e)};var a=({id:o}={})=>{let e={isFromAgent:!0,command:"open",id:o};window.postMessage(e)};var n=(o,{id:e}={})=>{let m={isFromAgent:!0,command:"showPreviewMessage",message:o,id:e};window.postMessage(m)};var d=({id:o}={})=>{let e={isFromAgent:!0,command:"toggle",id:o};window.postMessage(e)};var i=(o,{id:e}={})=>{let m={isFromAgent:!0,command:"setInputValue",value:o,id:e};window.postMessage(m)};var c=({id:o}={})=>{let e={isFromAgent:!0,command:"unmount",id:o};window.postMessage(e)};var f=(o,{id:e}={})=>{let m={isFromAgent:!0,command:"setPrefilledVariables",variables:o,id:e};window.postMessage(m)};var w=({id:o}={})=>{let e={isFromAgent:!0,command:"hidePreviewMessage",id:o};window.postMessage(e)};export{t as close,w as hidePreviewMessage,a as open,i as setInputValue,f as setPrefilledVariables,n as showPreviewMessage,d as toggle,c as unmount};
|