@reactor-team/js-sdk 2.9.1 → 2.9.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/dist/index.js +19 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -83,7 +83,7 @@ import { z } from "zod";
|
|
|
83
83
|
// package.json
|
|
84
84
|
var package_default = {
|
|
85
85
|
name: "@reactor-team/js-sdk",
|
|
86
|
-
version: "2.9.
|
|
86
|
+
version: "2.9.2",
|
|
87
87
|
description: "Reactor JavaScript frontend SDK",
|
|
88
88
|
main: "dist/index.js",
|
|
89
89
|
module: "dist/index.mjs",
|
|
@@ -1367,7 +1367,7 @@ var WebRTCTransportClient = class {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
};
|
|
1369
1369
|
this.peerConnection.onicecandidateerror = (event) => {
|
|
1370
|
-
console.
|
|
1370
|
+
console.debug("[WebRTCTransport] ICE candidate error:", event);
|
|
1371
1371
|
};
|
|
1372
1372
|
this.peerConnection.ondatachannel = (event) => {
|
|
1373
1373
|
console.debug("[WebRTCTransport] Data channel received from remote");
|
|
@@ -2301,7 +2301,7 @@ function useStats() {
|
|
|
2301
2301
|
|
|
2302
2302
|
// src/react/ReactorView.tsx
|
|
2303
2303
|
import { useEffect as useEffect3, useMemo, useRef as useRef3 } from "react";
|
|
2304
|
-
import { jsx as jsx2
|
|
2304
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2305
2305
|
function ReactorView({
|
|
2306
2306
|
track = "main_video",
|
|
2307
2307
|
audioTrack,
|
|
@@ -2312,12 +2312,11 @@ function ReactorView({
|
|
|
2312
2312
|
videoObjectFit = "contain",
|
|
2313
2313
|
muted = true
|
|
2314
2314
|
}) {
|
|
2315
|
-
const { videoMediaTrack, audioMediaTrack
|
|
2315
|
+
const { videoMediaTrack, audioMediaTrack } = useReactor((state) => {
|
|
2316
2316
|
var _a, _b;
|
|
2317
2317
|
return {
|
|
2318
2318
|
videoMediaTrack: (_a = state.tracks[track]) != null ? _a : null,
|
|
2319
|
-
audioMediaTrack: audioTrack ? (_b = state.tracks[audioTrack]) != null ? _b : null : null
|
|
2320
|
-
status: state.status
|
|
2319
|
+
audioMediaTrack: audioTrack ? (_b = state.tracks[audioTrack]) != null ? _b : null : null
|
|
2321
2320
|
};
|
|
2322
2321
|
});
|
|
2323
2322
|
const videoRef = useRef3(null);
|
|
@@ -2356,8 +2355,7 @@ function ReactorView({
|
|
|
2356
2355
|
console.debug("[ReactorView] No tracks or element to attach");
|
|
2357
2356
|
}
|
|
2358
2357
|
}, [mediaStream]);
|
|
2359
|
-
|
|
2360
|
-
return /* @__PURE__ */ jsxs(
|
|
2358
|
+
return /* @__PURE__ */ jsx2(
|
|
2361
2359
|
"div",
|
|
2362
2360
|
{
|
|
2363
2361
|
style: __spreadValues(__spreadValues(__spreadValues({
|
|
@@ -2365,51 +2363,27 @@ function ReactorView({
|
|
|
2365
2363
|
background: "#000"
|
|
2366
2364
|
}, width && { width }), height && { height }), style),
|
|
2367
2365
|
className,
|
|
2368
|
-
children:
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
),
|
|
2383
|
-
showPlaceholder && /* @__PURE__ */ jsx2(
|
|
2384
|
-
"div",
|
|
2385
|
-
{
|
|
2386
|
-
style: {
|
|
2387
|
-
position: "absolute",
|
|
2388
|
-
top: 0,
|
|
2389
|
-
left: 0,
|
|
2390
|
-
width: "100%",
|
|
2391
|
-
height: "100%",
|
|
2392
|
-
color: "#fff",
|
|
2393
|
-
display: "flex",
|
|
2394
|
-
alignItems: "center",
|
|
2395
|
-
justifyContent: "center",
|
|
2396
|
-
fontSize: "16px",
|
|
2397
|
-
fontFamily: "monospace",
|
|
2398
|
-
textAlign: "center",
|
|
2399
|
-
padding: "20px",
|
|
2400
|
-
boxSizing: "border-box"
|
|
2401
|
-
},
|
|
2402
|
-
children: status
|
|
2403
|
-
}
|
|
2404
|
-
)
|
|
2405
|
-
]
|
|
2366
|
+
children: /* @__PURE__ */ jsx2(
|
|
2367
|
+
"video",
|
|
2368
|
+
{
|
|
2369
|
+
ref: videoRef,
|
|
2370
|
+
style: {
|
|
2371
|
+
width: "100%",
|
|
2372
|
+
height: "100%",
|
|
2373
|
+
objectFit: videoObjectFit,
|
|
2374
|
+
display: videoMediaTrack ? "block" : "none"
|
|
2375
|
+
},
|
|
2376
|
+
muted,
|
|
2377
|
+
playsInline: true
|
|
2378
|
+
}
|
|
2379
|
+
)
|
|
2406
2380
|
}
|
|
2407
2381
|
);
|
|
2408
2382
|
}
|
|
2409
2383
|
|
|
2410
2384
|
// src/react/ReactorController.tsx
|
|
2411
2385
|
import React, { useState as useState3, useCallback, useRef as useRef4 } from "react";
|
|
2412
|
-
import { jsx as jsx3, jsxs
|
|
2386
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
2413
2387
|
function isFileParam(ps) {
|
|
2414
2388
|
return ps.type === "file" || ps.type === "object" && ps.format === "file-reference";
|
|
2415
2389
|
}
|
|
@@ -2565,8 +2539,8 @@ function ReactorController({
|
|
|
2565
2539
|
const step = isInteger ? 1 : 0.1;
|
|
2566
2540
|
const parseValue = isInteger ? parseInt : parseFloat;
|
|
2567
2541
|
if (typeof paramSchema.minimum === "number" && typeof paramSchema.maximum === "number") {
|
|
2568
|
-
return /* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2542
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: "8px" }, children: [
|
|
2543
|
+
/* @__PURE__ */ jsxs(
|
|
2570
2544
|
"label",
|
|
2571
2545
|
{
|
|
2572
2546
|
style: { fontSize: "12px", color: "#666", display: "block" },
|
|
@@ -2598,14 +2572,14 @@ function ReactorController({
|
|
|
2598
2572
|
style: { width: "100%", marginBottom: "4px" }
|
|
2599
2573
|
}
|
|
2600
2574
|
),
|
|
2601
|
-
/* @__PURE__ */
|
|
2575
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: "11px", color: "#888" }, children: [
|
|
2602
2576
|
"Value: ",
|
|
2603
2577
|
value
|
|
2604
2578
|
] })
|
|
2605
2579
|
] });
|
|
2606
2580
|
} else {
|
|
2607
|
-
return /* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: "8px" }, children: [
|
|
2582
|
+
/* @__PURE__ */ jsxs(
|
|
2609
2583
|
"label",
|
|
2610
2584
|
{
|
|
2611
2585
|
style: { fontSize: "12px", color: "#666", display: "block" },
|
|
@@ -2655,8 +2629,8 @@ function ReactorController({
|
|
|
2655
2629
|
}
|
|
2656
2630
|
} else if (paramSchema.type === "string") {
|
|
2657
2631
|
if (paramSchema.enum) {
|
|
2658
|
-
return /* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: "8px" }, children: [
|
|
2633
|
+
/* @__PURE__ */ jsxs(
|
|
2660
2634
|
"label",
|
|
2661
2635
|
{
|
|
2662
2636
|
style: { fontSize: "12px", color: "#666", display: "block" },
|
|
@@ -2667,7 +2641,7 @@ function ReactorController({
|
|
|
2667
2641
|
]
|
|
2668
2642
|
}
|
|
2669
2643
|
),
|
|
2670
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsxs(
|
|
2671
2645
|
"select",
|
|
2672
2646
|
{
|
|
2673
2647
|
value,
|
|
@@ -2687,8 +2661,8 @@ function ReactorController({
|
|
|
2687
2661
|
)
|
|
2688
2662
|
] });
|
|
2689
2663
|
} else {
|
|
2690
|
-
return /* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: "8px" }, children: [
|
|
2665
|
+
/* @__PURE__ */ jsxs(
|
|
2692
2666
|
"label",
|
|
2693
2667
|
{
|
|
2694
2668
|
style: { fontSize: "12px", color: "#666", display: "block" },
|
|
@@ -2717,7 +2691,7 @@ function ReactorController({
|
|
|
2717
2691
|
] });
|
|
2718
2692
|
}
|
|
2719
2693
|
} else if (paramSchema.type === "boolean") {
|
|
2720
|
-
return /* @__PURE__ */ jsx3("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */
|
|
2694
|
+
return /* @__PURE__ */ jsx3("div", { style: { marginBottom: "8px" }, children: /* @__PURE__ */ jsxs(
|
|
2721
2695
|
"label",
|
|
2722
2696
|
{
|
|
2723
2697
|
style: {
|
|
@@ -2753,7 +2727,7 @@ function ReactorController({
|
|
|
2753
2727
|
(ps) => (ps.type === "number" || ps.type === "integer") && typeof ps.minimum === "number" && typeof ps.maximum === "number"
|
|
2754
2728
|
);
|
|
2755
2729
|
const showExecuteButton = !allSliders;
|
|
2756
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ jsxs(
|
|
2757
2731
|
"div",
|
|
2758
2732
|
{
|
|
2759
2733
|
style: {
|
|
@@ -2763,7 +2737,7 @@ function ReactorController({
|
|
|
2763
2737
|
backgroundColor: "#fafafa"
|
|
2764
2738
|
},
|
|
2765
2739
|
children: [
|
|
2766
|
-
/* @__PURE__ */
|
|
2740
|
+
/* @__PURE__ */ jsxs(
|
|
2767
2741
|
"div",
|
|
2768
2742
|
{
|
|
2769
2743
|
onClick: () => toggleCommandExpanded(commandName),
|
|
@@ -2776,7 +2750,7 @@ function ReactorController({
|
|
|
2776
2750
|
alignItems: "center"
|
|
2777
2751
|
},
|
|
2778
2752
|
children: [
|
|
2779
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2780
2754
|
/* @__PURE__ */ jsx3(
|
|
2781
2755
|
"h4",
|
|
2782
2756
|
{
|
|
@@ -2811,8 +2785,8 @@ function ReactorController({
|
|
|
2811
2785
|
]
|
|
2812
2786
|
}
|
|
2813
2787
|
),
|
|
2814
|
-
isExpanded && /* @__PURE__ */
|
|
2815
|
-
hasParams && /* @__PURE__ */
|
|
2788
|
+
isExpanded && /* @__PURE__ */ jsxs("div", { style: { padding: "12px", paddingTop: "0" }, children: [
|
|
2789
|
+
hasParams && /* @__PURE__ */ jsxs("div", { style: { marginBottom: showExecuteButton ? "12px" : "0" }, children: [
|
|
2816
2790
|
/* @__PURE__ */ jsx3(
|
|
2817
2791
|
"div",
|
|
2818
2792
|
{
|
|
@@ -2849,7 +2823,7 @@ function ReactorController({
|
|
|
2849
2823
|
children: "No parameters required"
|
|
2850
2824
|
}
|
|
2851
2825
|
),
|
|
2852
|
-
showExecuteButton && /* @__PURE__ */
|
|
2826
|
+
showExecuteButton && /* @__PURE__ */ jsxs(
|
|
2853
2827
|
"button",
|
|
2854
2828
|
{
|
|
2855
2829
|
onClick: () => handleCommandSubmit(commandName),
|
|
@@ -2875,7 +2849,7 @@ function ReactorController({
|
|
|
2875
2849
|
commandName
|
|
2876
2850
|
);
|
|
2877
2851
|
};
|
|
2878
|
-
return /* @__PURE__ */ jsx3("div", { className, style, children: /* @__PURE__ */ jsx3("div", { style: { fontFamily: "monospace", fontSize: "12px" }, children: Object.keys(commands).length === 0 ? /* @__PURE__ */ jsx3("div", { style: { padding: "12px", color: "#666", fontStyle: "italic" }, children: "Waiting for commands schema..." }) : /* @__PURE__ */
|
|
2852
|
+
return /* @__PURE__ */ jsx3("div", { className, style, children: /* @__PURE__ */ jsx3("div", { style: { fontFamily: "monospace", fontSize: "12px" }, children: Object.keys(commands).length === 0 ? /* @__PURE__ */ jsx3("div", { style: { padding: "12px", color: "#666", fontStyle: "italic" }, children: "Waiting for commands schema..." }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
2879
2853
|
/* @__PURE__ */ jsx3(
|
|
2880
2854
|
"h3",
|
|
2881
2855
|
{
|
|
@@ -2917,13 +2891,13 @@ function FileParamInput({
|
|
|
2917
2891
|
setUploading(false);
|
|
2918
2892
|
}
|
|
2919
2893
|
});
|
|
2920
|
-
return /* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
2894
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: "8px" }, children: [
|
|
2895
|
+
/* @__PURE__ */ jsxs("label", { style: { fontSize: "12px", color: "#666", display: "block" }, children: [
|
|
2922
2896
|
paramName,
|
|
2923
2897
|
/* @__PURE__ */ jsx3("span", { style: { color: "#888", fontSize: "11px" }, children: " (file)" }),
|
|
2924
2898
|
description && ` - ${description}`
|
|
2925
2899
|
] }),
|
|
2926
|
-
/* @__PURE__ */
|
|
2900
|
+
/* @__PURE__ */ jsxs(
|
|
2927
2901
|
"div",
|
|
2928
2902
|
{
|
|
2929
2903
|
style: {
|
|
@@ -2964,7 +2938,7 @@ function FileParamInput({
|
|
|
2964
2938
|
children: uploading ? "Uploading\u2026" : fileRef ? "Change" : "Choose File"
|
|
2965
2939
|
}
|
|
2966
2940
|
),
|
|
2967
|
-
fileRef && /* @__PURE__ */
|
|
2941
|
+
fileRef && /* @__PURE__ */ jsxs("span", { style: { fontSize: "11px", color: "#28a745" }, children: [
|
|
2968
2942
|
"\\u2713 ",
|
|
2969
2943
|
fileRef.name
|
|
2970
2944
|
] })
|
|
@@ -2976,7 +2950,7 @@ function FileParamInput({
|
|
|
2976
2950
|
|
|
2977
2951
|
// src/react/WebcamStream.tsx
|
|
2978
2952
|
import { useEffect as useEffect4, useRef as useRef5, useState as useState4 } from "react";
|
|
2979
|
-
import { jsx as jsx4, jsxs as
|
|
2953
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2980
2954
|
function WebcamStream({
|
|
2981
2955
|
track,
|
|
2982
2956
|
className,
|
|
@@ -3110,7 +3084,7 @@ function WebcamStream({
|
|
|
3110
3084
|
};
|
|
3111
3085
|
}, []);
|
|
3112
3086
|
const showPlaceholder = !stream;
|
|
3113
|
-
return /* @__PURE__ */
|
|
3087
|
+
return /* @__PURE__ */ jsxs2(
|
|
3114
3088
|
"div",
|
|
3115
3089
|
{
|
|
3116
3090
|
style: __spreadValues({
|
|
@@ -3156,7 +3130,7 @@ function WebcamStream({
|
|
|
3156
3130
|
flexDirection: "column",
|
|
3157
3131
|
gap: "12px"
|
|
3158
3132
|
},
|
|
3159
|
-
children: permissionDenied ? /* @__PURE__ */
|
|
3133
|
+
children: permissionDenied ? /* @__PURE__ */ jsxs2("div", { style: { fontSize: "12px", fontFamily: "monospace" }, children: [
|
|
3160
3134
|
"Camera access denied.",
|
|
3161
3135
|
/* @__PURE__ */ jsx4("br", {}),
|
|
3162
3136
|
"Please allow access in your browser settings."
|