site-operator-react 0.1.12 → 0.1.13
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 +73 -35
- package/dist/index.d.ts +13 -12
- package/dist/site-operator-react.es.js +126 -124
- package/dist/site-operator-react.umd.js +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,67 +4,105 @@ The React 19 wrapper for Site Operator. It provides a seamless integration of th
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
```bash
|
|
8
7
|
npm install site-operator-react
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
*Note: You must also have `react` and `react-dom` installed.*
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
```tsx
|
|
10
|
+
import { AgentChat, type AppContext, type AppState } from 'site-operator-react';
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
const context: AppContext = {
|
|
13
|
+
v: "1.1",
|
|
14
|
+
site: {
|
|
15
|
+
name: "My Portal",
|
|
16
|
+
description: "Main customer management portal",
|
|
17
|
+
deployment: "prod",
|
|
18
|
+
baseUrl: "https://myportal.com",
|
|
19
|
+
locale: "en-US"
|
|
20
|
+
},
|
|
21
|
+
user: { id: "u-123", displayName: "Jost" },
|
|
22
|
+
nav: {
|
|
23
|
+
globalClickTargets: [
|
|
24
|
+
{
|
|
25
|
+
id: "lnk.nav.clients",
|
|
26
|
+
name: "ClientsLink",
|
|
27
|
+
kind: "link",
|
|
28
|
+
label: "Clients",
|
|
29
|
+
locator: { testId: "nav-clients" },
|
|
30
|
+
action: { "type": "navigate", "toRouteId": "clients.list", "toPath": "/clients" }
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
routes: [
|
|
34
|
+
{
|
|
35
|
+
id: "clients.list",
|
|
36
|
+
path: "/clients",
|
|
37
|
+
title: "Client Directory",
|
|
38
|
+
description: "List of all active customers in the system",
|
|
39
|
+
clickTargets: [
|
|
40
|
+
{
|
|
41
|
+
id: "btn.createClient",
|
|
42
|
+
name: "CreateClient",
|
|
43
|
+
kind: "button",
|
|
44
|
+
label: "Add Client",
|
|
45
|
+
description: "Opens the registration form for new customers",
|
|
46
|
+
locator: { testId: "clients-create" },
|
|
47
|
+
action: { "type": "navigate", "toRouteId": "clients.create", "toPath": "/clients/new" }
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
16
54
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
55
|
+
const state: AppState = {
|
|
56
|
+
v: "1.1",
|
|
57
|
+
location: {
|
|
58
|
+
routeId: "clients.list",
|
|
59
|
+
path: "/clients?status=active",
|
|
60
|
+
params: { "status": "active" },
|
|
61
|
+
title: "Clientes"
|
|
62
|
+
},
|
|
63
|
+
ui: {
|
|
64
|
+
visibleClickTargetIds: ["lnk.nav.clients", "btn.createClient"]
|
|
65
|
+
},
|
|
66
|
+
focus: { "type": "client", "id": "c-77", "label": "ACME S.A." }
|
|
67
|
+
};
|
|
21
68
|
|
|
22
69
|
function App() {
|
|
23
70
|
return (
|
|
24
71
|
<div className="App">
|
|
25
72
|
<AgentChat
|
|
26
73
|
backendUrl="http://localhost:8001/ag_ui"
|
|
27
|
-
conversationUrl="http://localhost:8003"
|
|
28
74
|
appName="My React App"
|
|
29
|
-
|
|
30
|
-
header={{
|
|
31
|
-
title: "Mi Asistente",
|
|
32
|
-
hide: false
|
|
33
|
-
}}
|
|
34
|
-
composer={{
|
|
35
|
-
disclaimer: "Agent puede cometer errores. Verifica la información importante",
|
|
36
|
-
placeholder: "Enviar un mensaje a Agent"
|
|
37
|
-
}}
|
|
38
|
-
thread={{
|
|
39
|
-
emptyText: "¿Cómo puedo ayudarte hoy?"
|
|
40
|
-
}}
|
|
75
|
+
context={{ appContext: context, appState: state }}
|
|
41
76
|
/>
|
|
42
77
|
</div>
|
|
43
78
|
);
|
|
44
79
|
}
|
|
45
80
|
```
|
|
46
81
|
|
|
82
|
+
|
|
47
83
|
### useChatPortal Hook
|
|
48
84
|
|
|
49
|
-
The `useChatPortal` hook allows you to register the "Copilot" capabilities (
|
|
85
|
+
The `useChatPortal` hook allows you to register the "Copilot" capabilities (`AppContext`) for your application. This lets the agent understand the app structure and available targets.
|
|
50
86
|
|
|
51
87
|
```tsx
|
|
52
|
-
import { useChatPortal } from 'site-operator-react';
|
|
88
|
+
import { useChatPortal, type AppContext } from 'site-operator-react';
|
|
89
|
+
|
|
90
|
+
const context: AppContext = {
|
|
91
|
+
v: "1.1",
|
|
92
|
+
// ... configuration ...
|
|
93
|
+
site: { name: "Mi Portal" },
|
|
94
|
+
user: { id: "u-123" },
|
|
95
|
+
nav: {
|
|
96
|
+
routes: []
|
|
97
|
+
}
|
|
98
|
+
};
|
|
53
99
|
|
|
54
100
|
function App() {
|
|
55
|
-
useChatPortal(
|
|
56
|
-
actions: {
|
|
57
|
-
openSettings: () => {
|
|
58
|
-
// Your logic to open settings
|
|
59
|
-
},
|
|
60
|
-
navigate: ({ path }) => {
|
|
61
|
-
// Your router logic
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
101
|
+
useChatPortal(context);
|
|
65
102
|
|
|
66
103
|
return (
|
|
67
104
|
// ...
|
|
68
105
|
);
|
|
69
106
|
}
|
|
70
107
|
```
|
|
108
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentState } from 'site-operator';
|
|
2
|
+
import { AppContext } from 'site-operator';
|
|
3
|
+
import { AppState } from 'site-operator';
|
|
4
|
+
import { ClickTarget } from 'site-operator';
|
|
2
5
|
import { default as default_2 } from 'react';
|
|
3
|
-
import { NavGraph } from 'site-operator';
|
|
4
|
-
import { NavNode } from 'site-operator';
|
|
5
|
-
import { PortalSpec } from 'site-operator';
|
|
6
6
|
|
|
7
7
|
export declare const AgentChat: default_2.FC<AgentChatProps>;
|
|
8
8
|
|
|
@@ -22,13 +22,20 @@ export declare interface AgentChatProps {
|
|
|
22
22
|
|
|
23
23
|
export { AgentState }
|
|
24
24
|
|
|
25
|
+
export { AppContext }
|
|
26
|
+
|
|
27
|
+
export { AppState }
|
|
28
|
+
|
|
29
|
+
export { ClickTarget }
|
|
30
|
+
|
|
25
31
|
export declare interface ComposerProps {
|
|
26
32
|
disclaimer?: string;
|
|
27
33
|
placeholder?: string;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
export declare interface ContextProps {
|
|
31
|
-
appContext?:
|
|
37
|
+
appContext?: AppContext;
|
|
38
|
+
appState?: AppState;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
export declare interface HeaderProps {
|
|
@@ -36,12 +43,6 @@ export declare interface HeaderProps {
|
|
|
36
43
|
hide?: boolean;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
export { NavGraph }
|
|
40
|
-
|
|
41
|
-
export { NavNode }
|
|
42
|
-
|
|
43
|
-
export { PortalSpec }
|
|
44
|
-
|
|
45
46
|
export declare interface ThreadViewProps {
|
|
46
47
|
emptyText?: string;
|
|
47
48
|
}
|
|
@@ -49,8 +50,8 @@ export declare interface ThreadViewProps {
|
|
|
49
50
|
/**
|
|
50
51
|
* A hook to register a Chat Portal specification for the agent.
|
|
51
52
|
* This allows the agent to navigate and control the host application.
|
|
52
|
-
* @param
|
|
53
|
+
* @param context The AppContext defining site, user and navigation.
|
|
53
54
|
*/
|
|
54
|
-
export declare function useChatPortal(
|
|
55
|
+
export declare function useChatPortal(context: AppContext): void;
|
|
55
56
|
|
|
56
57
|
export { }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ee, { useRef as re, useEffect as
|
|
1
|
+
import ee, { useRef as re, useEffect as j } from "react";
|
|
2
2
|
import { chatPortalService as te } from "site-operator";
|
|
3
|
-
var
|
|
3
|
+
var S = { exports: {} }, v = {};
|
|
4
4
|
/**
|
|
5
5
|
* @license React
|
|
6
6
|
* react-jsx-runtime.production.js
|
|
@@ -10,27 +10,27 @@ var A = { exports: {} }, p = {};
|
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
for (var
|
|
23
|
-
|
|
24
|
-
} else
|
|
25
|
-
return
|
|
26
|
-
$$typeof:
|
|
27
|
-
type:
|
|
28
|
-
key:
|
|
29
|
-
ref:
|
|
30
|
-
props:
|
|
13
|
+
var D;
|
|
14
|
+
function ae() {
|
|
15
|
+
if (D) return v;
|
|
16
|
+
D = 1;
|
|
17
|
+
var u = Symbol.for("react.transitional.element"), _ = Symbol.for("react.fragment");
|
|
18
|
+
function d(m, l, s) {
|
|
19
|
+
var E = null;
|
|
20
|
+
if (s !== void 0 && (E = "" + s), l.key !== void 0 && (E = "" + l.key), "key" in l) {
|
|
21
|
+
s = {};
|
|
22
|
+
for (var i in l)
|
|
23
|
+
i !== "key" && (s[i] = l[i]);
|
|
24
|
+
} else s = l;
|
|
25
|
+
return l = s.ref, {
|
|
26
|
+
$$typeof: u,
|
|
27
|
+
type: m,
|
|
28
|
+
key: E,
|
|
29
|
+
ref: l !== void 0 ? l : null,
|
|
30
|
+
props: s
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return v.Fragment = _, v.jsx = d, v.jsxs = d, v;
|
|
34
34
|
}
|
|
35
35
|
var b = {};
|
|
36
36
|
/**
|
|
@@ -42,16 +42,16 @@ var b = {};
|
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
44
|
*/
|
|
45
|
-
var
|
|
46
|
-
function
|
|
47
|
-
return
|
|
48
|
-
function
|
|
45
|
+
var L;
|
|
46
|
+
function ne() {
|
|
47
|
+
return L || (L = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
|
+
function u(e) {
|
|
49
49
|
if (e == null) return null;
|
|
50
50
|
if (typeof e == "function")
|
|
51
51
|
return e.$$typeof === Z ? null : e.displayName || e.name || null;
|
|
52
52
|
if (typeof e == "string") return e;
|
|
53
53
|
switch (e) {
|
|
54
|
-
case
|
|
54
|
+
case A:
|
|
55
55
|
return "Fragment";
|
|
56
56
|
case q:
|
|
57
57
|
return "Profiler";
|
|
@@ -78,64 +78,64 @@ function ae() {
|
|
|
78
78
|
var r = e.render;
|
|
79
79
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
80
80
|
case H:
|
|
81
|
-
return r = e.displayName || null, r !== null ? r :
|
|
82
|
-
case
|
|
81
|
+
return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
|
|
82
|
+
case O:
|
|
83
83
|
r = e._payload, e = e._init;
|
|
84
84
|
try {
|
|
85
|
-
return
|
|
85
|
+
return u(e(r));
|
|
86
86
|
} catch {
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function _(e) {
|
|
92
92
|
return "" + e;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function d(e) {
|
|
95
95
|
try {
|
|
96
|
-
|
|
96
|
+
_(e);
|
|
97
97
|
var r = !1;
|
|
98
98
|
} catch {
|
|
99
99
|
r = !0;
|
|
100
100
|
}
|
|
101
101
|
if (r) {
|
|
102
102
|
r = console;
|
|
103
|
-
var t = r.error,
|
|
103
|
+
var t = r.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
104
104
|
return t.call(
|
|
105
105
|
r,
|
|
106
106
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
-
|
|
108
|
-
),
|
|
107
|
+
a
|
|
108
|
+
), _(e);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (e ===
|
|
113
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
111
|
+
function m(e) {
|
|
112
|
+
if (e === A) return "<>";
|
|
113
|
+
if (typeof e == "object" && e !== null && e.$$typeof === O)
|
|
114
114
|
return "<...>";
|
|
115
115
|
try {
|
|
116
|
-
var r =
|
|
116
|
+
var r = u(e);
|
|
117
117
|
return r ? "<" + r + ">" : "<...>";
|
|
118
118
|
} catch {
|
|
119
119
|
return "<...>";
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
var e =
|
|
122
|
+
function l() {
|
|
123
|
+
var e = P.A;
|
|
124
124
|
return e === null ? null : e.getOwner();
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function s() {
|
|
127
127
|
return Error("react-stack-top-frame");
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
129
|
+
function E(e) {
|
|
130
|
+
if (h.call(e, "key")) {
|
|
131
131
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
132
132
|
if (r && r.isReactWarning) return !1;
|
|
133
133
|
}
|
|
134
134
|
return e.key !== void 0;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function i(e, r) {
|
|
137
137
|
function t() {
|
|
138
|
-
|
|
138
|
+
x || (x = !0, console.error(
|
|
139
139
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
140
|
r
|
|
141
141
|
));
|
|
@@ -145,23 +145,23 @@ function ae() {
|
|
|
145
145
|
configurable: !0
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
var e =
|
|
150
|
-
return
|
|
148
|
+
function R() {
|
|
149
|
+
var e = u(this.type);
|
|
150
|
+
return Y[e] || (Y[e] = !0, console.error(
|
|
151
151
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
152
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
153
153
|
}
|
|
154
|
-
function c(e, r, t,
|
|
155
|
-
var
|
|
154
|
+
function c(e, r, t, a, k, g) {
|
|
155
|
+
var n = t.ref;
|
|
156
156
|
return e = {
|
|
157
|
-
$$typeof:
|
|
157
|
+
$$typeof: N,
|
|
158
158
|
type: e,
|
|
159
159
|
key: r,
|
|
160
160
|
props: t,
|
|
161
|
-
_owner:
|
|
162
|
-
}, (
|
|
161
|
+
_owner: a
|
|
162
|
+
}, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
|
|
163
163
|
enumerable: !1,
|
|
164
|
-
get:
|
|
164
|
+
get: R
|
|
165
165
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
@@ -184,61 +184,61 @@ function ae() {
|
|
|
184
184
|
value: g
|
|
185
185
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
if (Q(
|
|
192
|
-
for (
|
|
193
|
-
|
|
194
|
-
Object.freeze && Object.freeze(
|
|
187
|
+
function o(e, r, t, a, k, g) {
|
|
188
|
+
var n = r.children;
|
|
189
|
+
if (n !== void 0)
|
|
190
|
+
if (a)
|
|
191
|
+
if (Q(n)) {
|
|
192
|
+
for (a = 0; a < n.length; a++)
|
|
193
|
+
f(n[a]);
|
|
194
|
+
Object.freeze && Object.freeze(n);
|
|
195
195
|
} else
|
|
196
196
|
console.error(
|
|
197
197
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
198
|
);
|
|
199
|
-
else
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
var
|
|
199
|
+
else f(n);
|
|
200
|
+
if (h.call(r, "key")) {
|
|
201
|
+
n = u(e);
|
|
202
|
+
var p = Object.keys(r).filter(function(K) {
|
|
203
203
|
return K !== "key";
|
|
204
204
|
});
|
|
205
|
-
|
|
205
|
+
a = 0 < p.length ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}", F[n + a] || (p = 0 < p.length ? "{" + p.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
206
|
`A props object containing a "key" prop is being spread into JSX:
|
|
207
207
|
let props = %s;
|
|
208
208
|
<%s {...props} />
|
|
209
209
|
React keys must be passed directly to JSX without using spread:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s key={someKey} {...props} />`,
|
|
212
|
-
n,
|
|
213
212
|
a,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
n,
|
|
214
|
+
p,
|
|
215
|
+
n
|
|
216
|
+
), F[n + a] = !0);
|
|
217
217
|
}
|
|
218
|
-
if (
|
|
218
|
+
if (n = null, t !== void 0 && (d(t), n = "" + t), E(r) && (d(r.key), n = "" + r.key), "key" in r) {
|
|
219
219
|
t = {};
|
|
220
220
|
for (var w in r)
|
|
221
221
|
w !== "key" && (t[w] = r[w]);
|
|
222
222
|
} else t = r;
|
|
223
|
-
return
|
|
223
|
+
return n && i(
|
|
224
224
|
t,
|
|
225
225
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
226
226
|
), c(
|
|
227
227
|
e,
|
|
228
|
-
|
|
228
|
+
n,
|
|
229
229
|
t,
|
|
230
|
-
|
|
230
|
+
l(),
|
|
231
231
|
k,
|
|
232
232
|
g
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
|
|
235
|
+
function f(e) {
|
|
236
|
+
C(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? C(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
238
|
+
function C(e) {
|
|
239
|
+
return typeof e == "object" && e !== null && e.$$typeof === N;
|
|
240
240
|
}
|
|
241
|
-
var T = ee,
|
|
241
|
+
var T = ee, N = Symbol.for("react.transitional.element"), W = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), V = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), G = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), B = Symbol.for("react.activity"), Z = Symbol.for("react.client.reference"), P = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, h = Object.prototype.hasOwnProperty, Q = Array.isArray, y = console.createTask ? console.createTask : function() {
|
|
242
242
|
return null;
|
|
243
243
|
};
|
|
244
244
|
T = {
|
|
@@ -246,77 +246,79 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
246
|
return e();
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
var
|
|
249
|
+
var x, Y = {}, $ = T.react_stack_bottom_frame.bind(
|
|
250
250
|
T,
|
|
251
|
-
|
|
252
|
-
)(),
|
|
253
|
-
b.Fragment =
|
|
254
|
-
var
|
|
255
|
-
return
|
|
251
|
+
s
|
|
252
|
+
)(), I = y(m(s)), F = {};
|
|
253
|
+
b.Fragment = A, b.jsx = function(e, r, t) {
|
|
254
|
+
var a = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return o(
|
|
256
256
|
e,
|
|
257
257
|
r,
|
|
258
258
|
t,
|
|
259
259
|
!1,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
a ? Error("react-stack-top-frame") : $,
|
|
261
|
+
a ? y(m(e)) : I
|
|
262
262
|
);
|
|
263
263
|
}, b.jsxs = function(e, r, t) {
|
|
264
|
-
var
|
|
265
|
-
return
|
|
264
|
+
var a = 1e4 > P.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return o(
|
|
266
266
|
e,
|
|
267
267
|
r,
|
|
268
268
|
t,
|
|
269
269
|
!0,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
a ? Error("react-stack-top-frame") : $,
|
|
271
|
+
a ? y(m(e)) : I
|
|
272
272
|
);
|
|
273
273
|
};
|
|
274
274
|
})()), b;
|
|
275
275
|
}
|
|
276
|
-
var
|
|
276
|
+
var M;
|
|
277
277
|
function oe() {
|
|
278
|
-
return
|
|
278
|
+
return M || (M = 1, process.env.NODE_ENV === "production" ? S.exports = ae() : S.exports = ne()), S.exports;
|
|
279
279
|
}
|
|
280
280
|
var le = oe();
|
|
281
281
|
const ie = ({
|
|
282
|
-
backendUrl:
|
|
283
|
-
conversationUrl:
|
|
284
|
-
appName:
|
|
285
|
-
agentAvatar:
|
|
286
|
-
inspector:
|
|
287
|
-
interceptor:
|
|
288
|
-
className:
|
|
289
|
-
composer:
|
|
290
|
-
thread:
|
|
282
|
+
backendUrl: u,
|
|
283
|
+
conversationUrl: _,
|
|
284
|
+
appName: d,
|
|
285
|
+
agentAvatar: m,
|
|
286
|
+
inspector: l,
|
|
287
|
+
interceptor: s,
|
|
288
|
+
className: E,
|
|
289
|
+
composer: i,
|
|
290
|
+
thread: R,
|
|
291
291
|
header: c,
|
|
292
|
-
context:
|
|
292
|
+
context: o
|
|
293
293
|
}) => {
|
|
294
|
-
const
|
|
295
|
-
return
|
|
296
|
-
|
|
297
|
-
}, [
|
|
294
|
+
const f = re(null);
|
|
295
|
+
return j(() => {
|
|
296
|
+
f.current && (o != null && o.appContext) && f.current.setAppContext(o.appContext);
|
|
297
|
+
}, [o == null ? void 0 : o.appContext]), j(() => {
|
|
298
|
+
f.current && (o != null && o.appState) && f.current.setAppState(o.appState);
|
|
299
|
+
}, [o == null ? void 0 : o.appState]), /* @__PURE__ */ le.jsx(
|
|
298
300
|
"agent-chat",
|
|
299
301
|
{
|
|
300
|
-
ref:
|
|
301
|
-
backendUrl:
|
|
302
|
-
conversationUrl:
|
|
303
|
-
appName:
|
|
304
|
-
agentAvatar:
|
|
305
|
-
disclaimer:
|
|
306
|
-
placeholder:
|
|
307
|
-
emptyText:
|
|
302
|
+
ref: f,
|
|
303
|
+
backendUrl: u,
|
|
304
|
+
conversationUrl: _,
|
|
305
|
+
appName: d,
|
|
306
|
+
agentAvatar: m,
|
|
307
|
+
disclaimer: i == null ? void 0 : i.disclaimer,
|
|
308
|
+
placeholder: i == null ? void 0 : i.placeholder,
|
|
309
|
+
emptyText: R == null ? void 0 : R.emptyText,
|
|
308
310
|
headerTitle: c == null ? void 0 : c.title,
|
|
309
311
|
hideHeader: c == null ? void 0 : c.hide,
|
|
310
|
-
inspector:
|
|
311
|
-
interceptor:
|
|
312
|
-
class:
|
|
312
|
+
inspector: l ? "true" : void 0,
|
|
313
|
+
interceptor: s ? !0 : void 0,
|
|
314
|
+
class: E
|
|
313
315
|
}
|
|
314
316
|
);
|
|
315
317
|
};
|
|
316
|
-
function ce(
|
|
317
|
-
|
|
318
|
-
te.registerPortal(
|
|
319
|
-
}, [
|
|
318
|
+
function ce(u) {
|
|
319
|
+
j(() => {
|
|
320
|
+
te.registerPortal(u);
|
|
321
|
+
}, [u]);
|
|
320
322
|
}
|
|
321
323
|
export {
|
|
322
324
|
ie as AgentChat,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(c,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("site-operator")):typeof define=="function"&&define.amd?define(["exports","react","site-operator"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.SiteOperatorReact={},c.React,c.SiteOperator))})(this,(function(c,f
|
|
1
|
+
(function(c,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("site-operator")):typeof define=="function"&&define.amd?define(["exports","react","site-operator"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.SiteOperatorReact={},c.React,c.SiteOperator))})(this,(function(c,f,J){"use strict";var k={exports:{}},b={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var C;function V(){if(C)return b;C=1;var u=Symbol.for("react.transitional.element"),R=Symbol.for("react.fragment");function E(_,s,l){var m=null;if(l!==void 0&&(m=""+l),s.key!==void 0&&(m=""+s.key),"key"in s){l={};for(var i in s)i!=="key"&&(l[i]=s[i])}else l=s;return s=l.ref,{$$typeof:u,type:_,key:m,ref:s!==void 0?s:null,props:l}}return b.Fragment=R,b.jsx=E,b.jsxs=E,b}var T={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var N;function z(){return N||(N=1,process.env.NODE_ENV!=="production"&&(function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case P:return"Fragment";case Z:return"Profiler";case B:return"StrictMode";case re:return"Suspense";case te:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case H:return"Portal";case K:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case ee:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case y:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function R(e){return""+e}function E(e){try{R(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),R(e)}}function _(e){if(e===P)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===y)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=g.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function m(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function i(e,r){function t(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function S(){var e=u(this.type);return M[e]||(M[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function d(e,r,t,a,A,w){var n=t.ref;return e={$$typeof:I,type:e,key:r,props:t,_owner:a},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:S}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:A}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function o(e,r,t,a,A,w){var n=r.children;if(n!==void 0)if(a)if(se(n)){for(a=0;a<n.length;a++)p(n[a]);Object.freeze&&Object.freeze(n)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(n);if(F.call(r,"key")){n=u(e);var v=Object.keys(r).filter(function(ue){return ue!=="key"});a=0<v.length?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}",U[n+a]||(v=0<v.length?"{"+v.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,n,
|
|
22
|
+
<%s key={someKey} {...props} />`,a,n,v,n),U[n+a]=!0)}if(n=null,t!==void 0&&(E(t),n=""+t),m(r)&&(E(r.key),n=""+r.key),"key"in r){t={};for(var h in r)h!=="key"&&(t[h]=r[h])}else t=r;return n&&i(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),d(e,n,t,s(),A,w)}function p(e){Y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===y&&(e._payload.status==="fulfilled"?Y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function Y(e){return typeof e=="object"&&e!==null&&e.$$typeof===I}var O=f,I=Symbol.for("react.transitional.element"),H=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),K=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),g=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,se=Array.isArray,j=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(e){return e()}};var D,M={},L=O.react_stack_bottom_frame.bind(O,l)(),W=j(_(l)),U={};T.Fragment=P,T.jsx=function(e,r,t){var a=1e4>g.recentlyCreatedOwnerStacks++;return o(e,r,t,!1,a?Error("react-stack-top-frame"):L,a?j(_(e)):W)},T.jsxs=function(e,r,t){var a=1e4>g.recentlyCreatedOwnerStacks++;return o(e,r,t,!0,a?Error("react-stack-top-frame"):L,a?j(_(e)):W)}})()),T}var x;function $(){return x||(x=1,process.env.NODE_ENV==="production"?k.exports=V():k.exports=z()),k.exports}var G=$();const q=({backendUrl:u,conversationUrl:R,appName:E,agentAvatar:_,inspector:s,interceptor:l,className:m,composer:i,thread:S,header:d,context:o})=>{const p=f.useRef(null);return f.useEffect(()=>{p.current&&(o!=null&&o.appContext)&&p.current.setAppContext(o.appContext)},[o==null?void 0:o.appContext]),f.useEffect(()=>{p.current&&(o!=null&&o.appState)&&p.current.setAppState(o.appState)},[o==null?void 0:o.appState]),G.jsx("agent-chat",{ref:p,backendUrl:u,conversationUrl:R,appName:E,agentAvatar:_,disclaimer:i==null?void 0:i.disclaimer,placeholder:i==null?void 0:i.placeholder,emptyText:S==null?void 0:S.emptyText,headerTitle:d==null?void 0:d.title,hideHeader:d==null?void 0:d.hide,inspector:s?"true":void 0,interceptor:l?!0:void 0,class:m})};function X(u){f.useEffect(()=>{J.chatPortalService.registerPortal(u)},[u])}c.AgentChat=q,c.useChatPortal=X,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "site-operator-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "React wrapper for site-operator, providing AgentChat component and hooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "jostvian",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dev": "vite build --watch"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"site-operator": "^0.1.
|
|
35
|
+
"site-operator": "^0.1.13"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": "^19.0.0",
|