site-operator-react 0.2.4 → 0.2.7
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/dist/index.d.ts +2 -0
- package/dist/site-operator-react.es.js +145 -143
- package/dist/site-operator-react.umd.js +4 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ClickTarget } from 'site-operator';
|
|
|
8
8
|
import { default as default_2 } from 'react';
|
|
9
9
|
import { ExecutePlanResult } from 'site-operator';
|
|
10
10
|
import { RefObject } from 'react';
|
|
11
|
+
import { SuggestedPrompt } from 'site-operator';
|
|
11
12
|
|
|
12
13
|
export declare const AgentChat: default_2.ForwardRefExoticComponent<AgentChatProps & default_2.RefAttributes<AgentChat_2>>;
|
|
13
14
|
|
|
@@ -49,6 +50,7 @@ export { ClickTarget }
|
|
|
49
50
|
export declare interface ComposerProps {
|
|
50
51
|
disclaimer?: string;
|
|
51
52
|
placeholder?: string;
|
|
53
|
+
suggestedPrompts?: SuggestedPrompt[];
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export declare interface ContextProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import q, { useRef as N, useImperativeHandle as
|
|
2
|
-
import { chatPortalService as
|
|
1
|
+
import q, { useRef as N, useImperativeHandle as ie, useEffect as R, useState as J, createContext as V, useContext as z } from "react";
|
|
2
|
+
import { chatPortalService as ce } from "site-operator";
|
|
3
3
|
import { createPortal as fe } from "react-dom";
|
|
4
|
-
var
|
|
4
|
+
var S = { exports: {} }, T = {};
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.production.js
|
|
@@ -13,27 +13,27 @@ var C = { exports: {} }, b = {};
|
|
|
13
13
|
*/
|
|
14
14
|
var L;
|
|
15
15
|
function de() {
|
|
16
|
-
if (L) return
|
|
16
|
+
if (L) return T;
|
|
17
17
|
L = 1;
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
var
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
for (var
|
|
24
|
-
|
|
25
|
-
} else
|
|
26
|
-
return
|
|
27
|
-
$$typeof:
|
|
18
|
+
var s = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
19
|
+
function f(d, a, i) {
|
|
20
|
+
var E = null;
|
|
21
|
+
if (i !== void 0 && (E = "" + i), a.key !== void 0 && (E = "" + a.key), "key" in a) {
|
|
22
|
+
i = {};
|
|
23
|
+
for (var n in a)
|
|
24
|
+
n !== "key" && (i[n] = a[n]);
|
|
25
|
+
} else i = a;
|
|
26
|
+
return a = i.ref, {
|
|
27
|
+
$$typeof: s,
|
|
28
28
|
type: d,
|
|
29
|
-
key:
|
|
30
|
-
ref:
|
|
31
|
-
props:
|
|
29
|
+
key: E,
|
|
30
|
+
ref: a !== void 0 ? a : null,
|
|
31
|
+
props: i
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return T.Fragment = t, T.jsx = f, T.jsxs = f, T;
|
|
35
35
|
}
|
|
36
|
-
var
|
|
36
|
+
var p = {};
|
|
37
37
|
/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-jsx-runtime.development.js
|
|
@@ -44,15 +44,15 @@ var T = {};
|
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
45
|
*/
|
|
46
46
|
var W;
|
|
47
|
-
function
|
|
47
|
+
function Ee() {
|
|
48
48
|
return W || (W = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
49
|
-
function
|
|
49
|
+
function s(e) {
|
|
50
50
|
if (e == null) return null;
|
|
51
51
|
if (typeof e == "function")
|
|
52
52
|
return e.$$typeof === ue ? null : e.displayName || e.name || null;
|
|
53
53
|
if (typeof e == "string") return e;
|
|
54
54
|
switch (e) {
|
|
55
|
-
case
|
|
55
|
+
case C:
|
|
56
56
|
return "Fragment";
|
|
57
57
|
case Q:
|
|
58
58
|
return "Profiler";
|
|
@@ -79,11 +79,11 @@ function me() {
|
|
|
79
79
|
var r = e.render;
|
|
80
80
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
81
81
|
case ae:
|
|
82
|
-
return r = e.displayName || null, r !== null ? r :
|
|
82
|
+
return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
|
|
83
83
|
case h:
|
|
84
84
|
r = e._payload, e = e._init;
|
|
85
85
|
try {
|
|
86
|
-
return
|
|
86
|
+
return s(e(r));
|
|
87
87
|
} catch {
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -92,7 +92,7 @@ function me() {
|
|
|
92
92
|
function t(e) {
|
|
93
93
|
return "" + e;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function f(e) {
|
|
96
96
|
try {
|
|
97
97
|
t(e);
|
|
98
98
|
var r = !1;
|
|
@@ -101,68 +101,68 @@ function me() {
|
|
|
101
101
|
}
|
|
102
102
|
if (r) {
|
|
103
103
|
r = console;
|
|
104
|
-
var
|
|
105
|
-
return
|
|
104
|
+
var l = r.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
105
|
+
return l.call(
|
|
106
106
|
r,
|
|
107
107
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
108
|
-
|
|
108
|
+
u
|
|
109
109
|
), t(e);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function d(e) {
|
|
113
|
-
if (e ===
|
|
113
|
+
if (e === C) return "<>";
|
|
114
114
|
if (typeof e == "object" && e !== null && e.$$typeof === h)
|
|
115
115
|
return "<...>";
|
|
116
116
|
try {
|
|
117
|
-
var r =
|
|
117
|
+
var r = s(e);
|
|
118
118
|
return r ? "<" + r + ">" : "<...>";
|
|
119
119
|
} catch {
|
|
120
120
|
return "<...>";
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function a() {
|
|
124
124
|
var e = y.A;
|
|
125
125
|
return e === null ? null : e.getOwner();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function i() {
|
|
128
128
|
return Error("react-stack-top-frame");
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function E(e) {
|
|
131
131
|
if (Y.call(e, "key")) {
|
|
132
132
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
133
133
|
if (r && r.isReactWarning) return !1;
|
|
134
134
|
}
|
|
135
135
|
return e.key !== void 0;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
function
|
|
137
|
+
function n(e, r) {
|
|
138
|
+
function l() {
|
|
139
139
|
$ || ($ = !0, console.error(
|
|
140
140
|
"%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)",
|
|
141
141
|
r
|
|
142
142
|
));
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
get:
|
|
144
|
+
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
145
|
+
get: l,
|
|
146
146
|
configurable: !0
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
var e =
|
|
149
|
+
function b() {
|
|
150
|
+
var e = s(this.type);
|
|
151
151
|
return I[e] || (I[e] = !0, console.error(
|
|
152
152
|
"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."
|
|
153
153
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
154
154
|
}
|
|
155
|
-
function v(e, r,
|
|
156
|
-
var
|
|
155
|
+
function v(e, r, l, u, k, j) {
|
|
156
|
+
var o = l.ref;
|
|
157
157
|
return e = {
|
|
158
158
|
$$typeof: x,
|
|
159
159
|
type: e,
|
|
160
160
|
key: r,
|
|
161
|
-
props:
|
|
162
|
-
_owner:
|
|
163
|
-
}, (
|
|
161
|
+
props: l,
|
|
162
|
+
_owner: u
|
|
163
|
+
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
164
164
|
enumerable: !1,
|
|
165
|
-
get:
|
|
165
|
+
get: b
|
|
166
166
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
167
167
|
configurable: !1,
|
|
168
168
|
enumerable: !1,
|
|
@@ -177,7 +177,7 @@ function me() {
|
|
|
177
177
|
configurable: !1,
|
|
178
178
|
enumerable: !1,
|
|
179
179
|
writable: !0,
|
|
180
|
-
value:
|
|
180
|
+
value: k
|
|
181
181
|
}), Object.defineProperty(e, "_debugTask", {
|
|
182
182
|
configurable: !1,
|
|
183
183
|
enumerable: !1,
|
|
@@ -185,61 +185,61 @@ function me() {
|
|
|
185
185
|
value: j
|
|
186
186
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
187
187
|
}
|
|
188
|
-
function c(e, r,
|
|
189
|
-
var
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
192
|
-
if (oe(
|
|
193
|
-
for (
|
|
194
|
-
|
|
195
|
-
Object.freeze && Object.freeze(
|
|
188
|
+
function c(e, r, l, u, k, j) {
|
|
189
|
+
var o = r.children;
|
|
190
|
+
if (o !== void 0)
|
|
191
|
+
if (u)
|
|
192
|
+
if (oe(o)) {
|
|
193
|
+
for (u = 0; u < o.length; u++)
|
|
194
|
+
A(o[u]);
|
|
195
|
+
Object.freeze && Object.freeze(o);
|
|
196
196
|
} else
|
|
197
197
|
console.error(
|
|
198
198
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
199
199
|
);
|
|
200
|
-
else
|
|
200
|
+
else A(o);
|
|
201
201
|
if (Y.call(r, "key")) {
|
|
202
|
-
|
|
202
|
+
o = s(e);
|
|
203
203
|
var _ = Object.keys(r).filter(function(se) {
|
|
204
204
|
return se !== "key";
|
|
205
205
|
});
|
|
206
|
-
|
|
206
|
+
u = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", D[o + u] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
207
207
|
`A props object containing a "key" prop is being spread into JSX:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s {...props} />
|
|
210
210
|
React keys must be passed directly to JSX without using spread:
|
|
211
211
|
let props = %s;
|
|
212
212
|
<%s key={someKey} {...props} />`,
|
|
213
|
-
l,
|
|
214
213
|
u,
|
|
214
|
+
o,
|
|
215
215
|
_,
|
|
216
|
-
|
|
217
|
-
), D[
|
|
216
|
+
o
|
|
217
|
+
), D[o + u] = !0);
|
|
218
218
|
}
|
|
219
|
-
if (
|
|
220
|
-
|
|
219
|
+
if (o = null, l !== void 0 && (f(l), o = "" + l), E(r) && (f(r.key), o = "" + r.key), "key" in r) {
|
|
220
|
+
l = {};
|
|
221
221
|
for (var w in r)
|
|
222
|
-
w !== "key" && (
|
|
223
|
-
} else
|
|
224
|
-
return
|
|
225
|
-
|
|
222
|
+
w !== "key" && (l[w] = r[w]);
|
|
223
|
+
} else l = r;
|
|
224
|
+
return o && n(
|
|
225
|
+
l,
|
|
226
226
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
227
227
|
), v(
|
|
228
228
|
e,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
o,
|
|
230
|
+
l,
|
|
231
|
+
a(),
|
|
232
|
+
k,
|
|
233
233
|
j
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
|
|
236
|
+
function A(e) {
|
|
237
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === h && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function m(e) {
|
|
240
240
|
return typeof e == "object" && e !== null && e.$$typeof === x;
|
|
241
241
|
}
|
|
242
|
-
var P = q, x = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"),
|
|
242
|
+
var P = q, x = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), Z = Symbol.for("react.strict_mode"), Q = Symbol.for("react.profiler"), K = Symbol.for("react.consumer"), ee = Symbol.for("react.context"), re = Symbol.for("react.forward_ref"), te = Symbol.for("react.suspense"), ne = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), le = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), y = P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, oe = Array.isArray, O = console.createTask ? console.createTask : function() {
|
|
243
243
|
return null;
|
|
244
244
|
};
|
|
245
245
|
P = {
|
|
@@ -249,122 +249,124 @@ React keys must be passed directly to JSX without using spread:
|
|
|
249
249
|
};
|
|
250
250
|
var $, I = {}, M = P.react_stack_bottom_frame.bind(
|
|
251
251
|
P,
|
|
252
|
-
|
|
253
|
-
)(), F = O(d(
|
|
254
|
-
|
|
255
|
-
var
|
|
252
|
+
i
|
|
253
|
+
)(), F = O(d(i)), D = {};
|
|
254
|
+
p.Fragment = C, p.jsx = function(e, r, l) {
|
|
255
|
+
var u = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
256
256
|
return c(
|
|
257
257
|
e,
|
|
258
258
|
r,
|
|
259
|
-
|
|
259
|
+
l,
|
|
260
260
|
!1,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
u ? Error("react-stack-top-frame") : M,
|
|
262
|
+
u ? O(d(e)) : F
|
|
263
263
|
);
|
|
264
|
-
},
|
|
265
|
-
var
|
|
264
|
+
}, p.jsxs = function(e, r, l) {
|
|
265
|
+
var u = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
266
266
|
return c(
|
|
267
267
|
e,
|
|
268
268
|
r,
|
|
269
|
-
|
|
269
|
+
l,
|
|
270
270
|
!0,
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
u ? Error("react-stack-top-frame") : M,
|
|
272
|
+
u ? O(d(e)) : F
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
})()),
|
|
275
|
+
})()), p;
|
|
276
276
|
}
|
|
277
277
|
var U;
|
|
278
|
-
function
|
|
279
|
-
return U || (U = 1, process.env.NODE_ENV === "production" ?
|
|
278
|
+
function me() {
|
|
279
|
+
return U || (U = 1, process.env.NODE_ENV === "production" ? S.exports = de() : S.exports = Ee()), S.exports;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
281
|
+
var g = me();
|
|
282
282
|
const G = q.forwardRef(({
|
|
283
|
-
backendUrl:
|
|
283
|
+
backendUrl: s,
|
|
284
284
|
conversationUrl: t,
|
|
285
|
-
appName:
|
|
285
|
+
appName: f,
|
|
286
286
|
agentAvatar: d,
|
|
287
|
-
inspector:
|
|
288
|
-
interceptor:
|
|
289
|
-
className:
|
|
290
|
-
composer:
|
|
291
|
-
thread:
|
|
287
|
+
inspector: a,
|
|
288
|
+
interceptor: i,
|
|
289
|
+
className: E,
|
|
290
|
+
composer: n,
|
|
291
|
+
thread: b,
|
|
292
292
|
header: v,
|
|
293
293
|
context: c
|
|
294
|
-
},
|
|
295
|
-
const
|
|
296
|
-
return
|
|
297
|
-
|
|
298
|
-
}, [c == null ? void 0 : c.appContext]),
|
|
299
|
-
|
|
300
|
-
}, [c == null ? void 0 : c.appState]),
|
|
294
|
+
}, A) => {
|
|
295
|
+
const m = N(null);
|
|
296
|
+
return ie(A, () => m.current), R(() => {
|
|
297
|
+
m.current && (c != null && c.appContext) && m.current.setAppContext(c.appContext);
|
|
298
|
+
}, [c == null ? void 0 : c.appContext]), R(() => {
|
|
299
|
+
m.current && (c != null && c.appState) && m.current.setAppState(c.appState);
|
|
300
|
+
}, [c == null ? void 0 : c.appState]), R(() => {
|
|
301
|
+
m.current && (n != null && n.suggestedPrompts) && m.current.setSuggestedPrompts(n.suggestedPrompts);
|
|
302
|
+
}, [n == null ? void 0 : n.suggestedPrompts]), /* @__PURE__ */ g.jsx(
|
|
301
303
|
"agent-chat",
|
|
302
304
|
{
|
|
303
|
-
ref:
|
|
304
|
-
backendUrl:
|
|
305
|
+
ref: m,
|
|
306
|
+
backendUrl: s,
|
|
305
307
|
conversationUrl: t,
|
|
306
|
-
appName:
|
|
308
|
+
appName: f,
|
|
307
309
|
agentAvatar: d,
|
|
308
|
-
disclaimer:
|
|
309
|
-
placeholder:
|
|
310
|
-
emptyText:
|
|
310
|
+
disclaimer: n == null ? void 0 : n.disclaimer,
|
|
311
|
+
placeholder: n == null ? void 0 : n.placeholder,
|
|
312
|
+
emptyText: b == null ? void 0 : b.emptyText,
|
|
311
313
|
headerTitle: v == null ? void 0 : v.title,
|
|
312
314
|
hideHeader: v == null ? void 0 : v.hide,
|
|
313
|
-
inspector:
|
|
314
|
-
interceptor:
|
|
315
|
-
class:
|
|
315
|
+
inspector: a ? "true" : void 0,
|
|
316
|
+
interceptor: i ? !0 : void 0,
|
|
317
|
+
class: E
|
|
316
318
|
}
|
|
317
319
|
);
|
|
318
320
|
});
|
|
319
321
|
G.displayName = "AgentChat";
|
|
320
|
-
function ve(
|
|
321
|
-
const [
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
}, [
|
|
325
|
-
var
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
328
|
-
if (
|
|
329
|
-
d(
|
|
322
|
+
function ve(s, t) {
|
|
323
|
+
const [f, d] = J(null);
|
|
324
|
+
return R(() => {
|
|
325
|
+
s && ce.registerPortal(s, t == null ? void 0 : t.handlers);
|
|
326
|
+
}, [s, t == null ? void 0 : t.handlers]), R(() => {
|
|
327
|
+
var E;
|
|
328
|
+
const a = (E = t == null ? void 0 : t.chatRef) == null ? void 0 : E.current;
|
|
329
|
+
if (!a) return;
|
|
330
|
+
if (a.controller) {
|
|
331
|
+
d(a.controller);
|
|
330
332
|
return;
|
|
331
333
|
}
|
|
332
|
-
const
|
|
333
|
-
d(
|
|
334
|
+
const i = (n) => {
|
|
335
|
+
d(n.detail ?? null);
|
|
334
336
|
};
|
|
335
|
-
return
|
|
336
|
-
|
|
337
|
+
return a.addEventListener("controller-ready", i), () => {
|
|
338
|
+
a.removeEventListener("controller-ready", i);
|
|
337
339
|
};
|
|
338
|
-
}, [t == null ? void 0 : t.chatRef]),
|
|
340
|
+
}, [t == null ? void 0 : t.chatRef]), f;
|
|
339
341
|
}
|
|
340
342
|
const X = V(null), H = V(null);
|
|
341
343
|
function Te() {
|
|
342
344
|
return z(X);
|
|
343
345
|
}
|
|
344
|
-
const pe = ({ children:
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
if (
|
|
348
|
-
return
|
|
349
|
-
|
|
346
|
+
const pe = ({ children: s, ...t }) => {
|
|
347
|
+
const f = z(H), d = N(null);
|
|
348
|
+
return R(() => {
|
|
349
|
+
if (f)
|
|
350
|
+
return f(d.current), () => {
|
|
351
|
+
f(null);
|
|
350
352
|
};
|
|
351
|
-
}, [
|
|
352
|
-
},
|
|
353
|
-
children:
|
|
353
|
+
}, [f]), /* @__PURE__ */ g.jsx("div", { ref: d, ...t, children: s });
|
|
354
|
+
}, ge = ({
|
|
355
|
+
children: s,
|
|
354
356
|
context: t,
|
|
355
|
-
handlers:
|
|
357
|
+
handlers: f,
|
|
356
358
|
...d
|
|
357
359
|
}) => {
|
|
358
|
-
const
|
|
359
|
-
return /* @__PURE__ */
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
const a = N(null), i = ve(t == null ? void 0 : t.appContext, { chatRef: a, handlers: f }), [E, n] = J(null);
|
|
361
|
+
return /* @__PURE__ */ g.jsx(X.Provider, { value: i, children: /* @__PURE__ */ g.jsxs(H.Provider, { value: n, children: [
|
|
362
|
+
s,
|
|
363
|
+
E ? fe(/* @__PURE__ */ g.jsx(G, { ref: a, context: t, ...d }), E) : null
|
|
362
364
|
] }) });
|
|
363
365
|
};
|
|
364
366
|
export {
|
|
365
367
|
G as AgentChat,
|
|
366
368
|
pe as AgentChatMount,
|
|
367
|
-
|
|
369
|
+
ge as AgentChatProvider,
|
|
368
370
|
Te as useAgentChatController,
|
|
369
371
|
ve as useChatPortal
|
|
370
372
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(v,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("site-operator"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","site-operator","react-dom"],a):(v=typeof globalThis<"u"?globalThis:v||self,a(v.SiteOperatorReact={},v.React,v.SiteOperator,v.ReactDOM))})(this,(function(v,a,H,B){"use strict";var P={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 Y;function Z(){if(Y)return b;Y=1;var
|
|
9
|
+
*/var Y;function Z(){if(Y)return b;Y=1;var c=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function d(E,l,f){var R=null;if(f!==void 0&&(R=""+f),l.key!==void 0&&(R=""+l.key),"key"in l){f={};for(var n in l)n!=="key"&&(f[n]=l[n])}else f=l;return l=f.ref,{$$typeof:c,type:E,key:R,ref:l!==void 0?l:null,props:f}}return b.Fragment=t,b.jsx=d,b.jsxs=d,b}var p={};/**
|
|
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 M;function Q(){return M||(M=1,process.env.NODE_ENV!=="production"&&(function(){function
|
|
17
|
+
*/var M;function Q(){return M||(M=1,process.env.NODE_ENV!=="production"&&(function(){function c(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case ne:return"Profiler";case te:return"StrictMode";case se:return"Suspense";case oe:return"SuspenseList";case fe: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 re:return"Portal";case le:return e.displayName||"Context";case ae:return(e._context.displayName||"Context")+".Consumer";case ue:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return r=e.displayName||null,r!==null?r:c(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return c(e(r))}catch{}}return null}function t(e){return""+e}function d(e){try{t(e);var r=!1}catch{r=!0}if(r){r=console;var u=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),t(e)}}function E(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=c(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=j.A;return e===null?null:e.getOwner()}function f(){return Error("react-stack-top-frame")}function R(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function n(e,r){function u(){J||(J=!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))}u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}function A(){var e=c(this.type);return V[e]||(V[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 m(e,r,u,s,h,N){var o=u.ref;return e={$$typeof:W,type:e,key:r,props:u,_owner:s},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:A}):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:h}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function i(e,r,u,s,h,N){var o=r.children;if(o!==void 0)if(s)if(de(o)){for(s=0;s<o.length;s++)C(o[s]);Object.freeze&&Object.freeze(o)}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 C(o);if(U.call(r,"key")){o=c(e);var T=Object.keys(r).filter(function(Ee){return Ee!=="key"});s=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",X[o+s]||(T=0<T.length?"{"+T.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} />`,o,
|
|
22
|
+
<%s key={someKey} {...props} />`,s,o,T,o),X[o+s]=!0)}if(o=null,u!==void 0&&(d(u),o=""+u),R(r)&&(d(r.key),o=""+r.key),"key"in r){u={};for(var x in r)x!=="key"&&(u[x]=r[x])}else u=r;return o&&n(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),m(e,o,u,l(),h,N)}function C(e){_(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?_(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function _(e){return typeof e=="object"&&e!==null&&e.$$typeof===W}var S=a,W=Symbol.for("react.transitional.element"),re=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),ae=Symbol.for("react.consumer"),le=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),fe=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),j=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,de=Array.isArray,w=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(e){return e()}};var J,V={},z=S.react_stack_bottom_frame.bind(S,f)(),G=w(E(f)),X={};p.Fragment=y,p.jsx=function(e,r,u){var s=1e4>j.recentlyCreatedOwnerStacks++;return i(e,r,u,!1,s?Error("react-stack-top-frame"):z,s?w(E(e)):G)},p.jsxs=function(e,r,u){var s=1e4>j.recentlyCreatedOwnerStacks++;return i(e,r,u,!0,s?Error("react-stack-top-frame"):z,s?w(E(e)):G)}})()),p}var I;function K(){return I||(I=1,process.env.NODE_ENV==="production"?P.exports=Z():P.exports=Q()),P.exports}var g=K();const k=a.forwardRef(({backendUrl:c,conversationUrl:t,appName:d,agentAvatar:E,inspector:l,interceptor:f,className:R,composer:n,thread:A,header:m,context:i},C)=>{const _=a.useRef(null);return a.useImperativeHandle(C,()=>_.current),a.useEffect(()=>{_.current&&(i!=null&&i.appContext)&&_.current.setAppContext(i.appContext)},[i==null?void 0:i.appContext]),a.useEffect(()=>{_.current&&(i!=null&&i.appState)&&_.current.setAppState(i.appState)},[i==null?void 0:i.appState]),a.useEffect(()=>{_.current&&(n!=null&&n.suggestedPrompts)&&_.current.setSuggestedPrompts(n.suggestedPrompts)},[n==null?void 0:n.suggestedPrompts]),g.jsx("agent-chat",{ref:_,backendUrl:c,conversationUrl:t,appName:d,agentAvatar:E,disclaimer:n==null?void 0:n.disclaimer,placeholder:n==null?void 0:n.placeholder,emptyText:A==null?void 0:A.emptyText,headerTitle:m==null?void 0:m.title,hideHeader:m==null?void 0:m.hide,inspector:l?"true":void 0,interceptor:f?!0:void 0,class:R})});k.displayName="AgentChat";function D(c,t){const[d,E]=a.useState(null);return a.useEffect(()=>{c&&H.chatPortalService.registerPortal(c,t==null?void 0:t.handlers)},[c,t==null?void 0:t.handlers]),a.useEffect(()=>{var R;const l=(R=t==null?void 0:t.chatRef)==null?void 0:R.current;if(!l)return;if(l.controller){E(l.controller);return}const f=n=>{E(n.detail??null)};return l.addEventListener("controller-ready",f),()=>{l.removeEventListener("controller-ready",f)}},[t==null?void 0:t.chatRef]),d}const F=a.createContext(null),L=a.createContext(null);function q(){return a.useContext(F)}const $=({children:c,...t})=>{const d=a.useContext(L),E=a.useRef(null);return a.useEffect(()=>{if(d)return d(E.current),()=>{d(null)}},[d]),g.jsx("div",{ref:E,...t,children:c})},ee=({children:c,context:t,handlers:d,...E})=>{const l=a.useRef(null),f=D(t==null?void 0:t.appContext,{chatRef:l,handlers:d}),[R,n]=a.useState(null);return g.jsx(F.Provider,{value:f,children:g.jsxs(L.Provider,{value:n,children:[c,R?B.createPortal(g.jsx(k,{ref:l,context:t,...E}),R):null]})})};v.AgentChat=k,v.AgentChatMount=$,v.AgentChatProvider=ee,v.useAgentChatController=q,v.useChatPortal=D,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "site-operator-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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.2.
|
|
35
|
+
"site-operator": "^0.2.6"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": "^19.0.0",
|