@shuffleio/shuffle-mcps 0.0.21 → 0.0.22
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.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +147 -101
- package/dist/index.mjs +343 -299
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1004,8 +1004,8 @@ interface AppAuthCardProps extends ShuffleHostProps {
|
|
|
1004
1004
|
* inside another bordered container without the nested "double border" look. */
|
|
1005
1005
|
borderless?: boolean;
|
|
1006
1006
|
}
|
|
1007
|
-
declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, }: AppAuthCardProps) => react_jsx_runtime.JSX.Element;
|
|
1008
|
-
declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, }: AppAuthConfigProps) => react_jsx_runtime.JSX.Element;
|
|
1007
|
+
declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthCardProps) => react_jsx_runtime.JSX.Element;
|
|
1008
|
+
declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthConfigProps) => react_jsx_runtime.JSX.Element;
|
|
1009
1009
|
|
|
1010
1010
|
declare function useAppAuth(): {
|
|
1011
1011
|
authStates: Record<string, AppAuthState>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1004,8 +1004,8 @@ interface AppAuthCardProps extends ShuffleHostProps {
|
|
|
1004
1004
|
* inside another bordered container without the nested "double border" look. */
|
|
1005
1005
|
borderless?: boolean;
|
|
1006
1006
|
}
|
|
1007
|
-
declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, }: AppAuthCardProps) => react_jsx_runtime.JSX.Element;
|
|
1008
|
-
declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, }: AppAuthConfigProps) => react_jsx_runtime.JSX.Element;
|
|
1007
|
+
declare const AppAuthCard: ({ app, authState, isExpanded, onToggle, onAuthChange, onTestConnection, onSaveAuth, apiAuthEntries, onSelectAuth, onRefreshAuth, disableUrlPrefill, hideHeader, hideStatusChips, hideDocsLink, hideUrlFields, borderless, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthCardProps) => react_jsx_runtime.JSX.Element;
|
|
1008
|
+
declare const AppAuthConfig: ({ apps, authStates, authenticatedApps, onAuthChange, onTestConnection, onSaveAuth, onSelectAuth, onRefreshAuth, globalUrl, userdata, isLoaded, isLoggedIn, serverside, }: AppAuthConfigProps) => react_jsx_runtime.JSX.Element;
|
|
1009
1009
|
|
|
1010
1010
|
declare function useAppAuth(): {
|
|
1011
1011
|
authStates: Record<string, AppAuthState>;
|
package/dist/index.js
CHANGED
|
@@ -459,15 +459,34 @@ var readHtmlDarkClass = () => {
|
|
|
459
459
|
if (typeof document === "undefined") return false;
|
|
460
460
|
return document.documentElement.classList.contains("dark");
|
|
461
461
|
};
|
|
462
|
-
var
|
|
462
|
+
var readAncestorDark = (anchor) => {
|
|
463
|
+
if (!anchor || typeof document === "undefined") return null;
|
|
464
|
+
const start = anchor.parentElement;
|
|
465
|
+
if (!start) return null;
|
|
466
|
+
const scoped = start.closest('[data-shuffle-mode="dark"], [data-shuffle-mode="light"]');
|
|
467
|
+
if (scoped) return scoped.getAttribute("data-shuffle-mode") === "dark";
|
|
468
|
+
const darkAncestor = start.closest(".dark");
|
|
469
|
+
if (darkAncestor) return true;
|
|
470
|
+
return null;
|
|
471
|
+
};
|
|
472
|
+
var useAutoDarkClass = (enabled, anchorRef) => {
|
|
463
473
|
const [isDark, setIsDark] = import_react.default.useState(() => enabled ? readHtmlDarkClass() : false);
|
|
464
|
-
import_react.default.
|
|
474
|
+
import_react.default.useLayoutEffect(() => {
|
|
465
475
|
if (!enabled || typeof document === "undefined") return;
|
|
466
|
-
|
|
467
|
-
|
|
476
|
+
const recompute = () => {
|
|
477
|
+
const ancestor = readAncestorDark(anchorRef.current);
|
|
478
|
+
setIsDark(ancestor !== null ? ancestor : readHtmlDarkClass());
|
|
479
|
+
};
|
|
480
|
+
recompute();
|
|
481
|
+
const observer = new MutationObserver(recompute);
|
|
468
482
|
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
|
|
483
|
+
let node = anchorRef.current?.parentElement ?? null;
|
|
484
|
+
while (node) {
|
|
485
|
+
observer.observe(node, { attributes: true, attributeFilter: ["class", "data-shuffle-mode"] });
|
|
486
|
+
node = node.parentElement;
|
|
487
|
+
}
|
|
469
488
|
return () => observer.disconnect();
|
|
470
|
-
}, [enabled]);
|
|
489
|
+
}, [enabled, anchorRef]);
|
|
471
490
|
return isDark;
|
|
472
491
|
};
|
|
473
492
|
var ShuffleMcpThemeContext = import_react.default.createContext(null);
|
|
@@ -554,10 +573,12 @@ var ShuffleMcpThemeProvider = ({
|
|
|
554
573
|
}) => {
|
|
555
574
|
const parent = (0, import_material.useTheme)();
|
|
556
575
|
const parentCtx = useShuffleMcpTheme();
|
|
557
|
-
const
|
|
558
|
-
const
|
|
576
|
+
const anchorRef = import_react.default.useRef(null);
|
|
577
|
+
const autoIsDark = useAutoDarkClass(mode === "auto", anchorRef);
|
|
578
|
+
const effectiveDark = mode === "auto" ? autoIsDark : mode === "dark";
|
|
559
579
|
const sameAsParent = parentCtx !== null && parentCtx.isDark === effectiveDark;
|
|
560
580
|
const scopeClassName = effectiveDark ? "shuffle-mcp-scope dark" : "shuffle-mcp-scope";
|
|
581
|
+
const resolvedModeAttr = effectiveDark ? "dark" : "light";
|
|
561
582
|
const merged = import_react.default.useMemo(
|
|
562
583
|
() => (0, import_material.createTheme)({
|
|
563
584
|
...parent,
|
|
@@ -577,9 +598,15 @@ var ShuffleMcpThemeProvider = ({
|
|
|
577
598
|
[mode, effectiveDark, scopeClassName]
|
|
578
599
|
);
|
|
579
600
|
if (sameAsParent) {
|
|
580
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ShuffleMcpThemeContext.Provider, { value: ctxValue, children: [
|
|
602
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: anchorRef, style: { display: "none" }, "aria-hidden": true }),
|
|
603
|
+
children
|
|
604
|
+
] });
|
|
581
605
|
}
|
|
582
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShuffleMcpThemeContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.ThemeProvider, { theme: merged, children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShuffleMcpThemeContext.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.ThemeProvider, { theme: merged, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: scopeClassName, "data-shuffle-mode": resolvedModeAttr, "data-shuffle-mcp-root": true, children: [
|
|
607
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ref: anchorRef, style: { display: "none" }, "aria-hidden": true }),
|
|
608
|
+
children
|
|
609
|
+
] }) }) });
|
|
583
610
|
};
|
|
584
611
|
|
|
585
612
|
// views/ShuffleMCP.tsx
|
|
@@ -588,7 +615,7 @@ var import_algoliasearch = require("algoliasearch");
|
|
|
588
615
|
var import_material10 = require("@mui/material");
|
|
589
616
|
|
|
590
617
|
// views/AppDetailDrawer.tsx
|
|
591
|
-
var
|
|
618
|
+
var import_react11 = require("react");
|
|
592
619
|
|
|
593
620
|
// toast.ts
|
|
594
621
|
var defaultImpl = (arg, opts) => {
|
|
@@ -2125,7 +2152,7 @@ var import_material5 = require("@mui/material");
|
|
|
2125
2152
|
var import_framer_motion3 = require("framer-motion");
|
|
2126
2153
|
|
|
2127
2154
|
// components/AppAuthConfig.tsx
|
|
2128
|
-
var
|
|
2155
|
+
var import_react7 = require("react");
|
|
2129
2156
|
var import_lucide_react3 = require("lucide-react");
|
|
2130
2157
|
var import_material4 = require("@mui/material");
|
|
2131
2158
|
var import_framer_motion2 = require("framer-motion");
|
|
@@ -2278,6 +2305,18 @@ var AppFallbackIcon = ({
|
|
|
2278
2305
|
|
|
2279
2306
|
// components/AppAuthConfig.tsx
|
|
2280
2307
|
init_api();
|
|
2308
|
+
|
|
2309
|
+
// useSyncHostBaseUrl.ts
|
|
2310
|
+
var import_react6 = require("react");
|
|
2311
|
+
init_api();
|
|
2312
|
+
var useSyncHostBaseUrl = (globalUrl) => {
|
|
2313
|
+
(0, import_react6.useEffect)(() => {
|
|
2314
|
+
if (!globalUrl) return;
|
|
2315
|
+
setHostBaseUrl(globalUrl);
|
|
2316
|
+
}, [globalUrl]);
|
|
2317
|
+
};
|
|
2318
|
+
|
|
2319
|
+
// components/AppAuthConfig.tsx
|
|
2281
2320
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
2282
2321
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
2283
2322
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -2333,8 +2372,14 @@ var AppAuthCard = ({
|
|
|
2333
2372
|
hideStatusChips,
|
|
2334
2373
|
hideDocsLink,
|
|
2335
2374
|
hideUrlFields,
|
|
2336
|
-
borderless
|
|
2375
|
+
borderless,
|
|
2376
|
+
globalUrl,
|
|
2377
|
+
userdata,
|
|
2378
|
+
isLoaded,
|
|
2379
|
+
isLoggedIn,
|
|
2380
|
+
serverside
|
|
2337
2381
|
}) => {
|
|
2382
|
+
useSyncHostBaseUrl(globalUrl);
|
|
2338
2383
|
const getBestDefaultAuth = (entries) => {
|
|
2339
2384
|
if (entries.length === 0) return ADD_NEW_AUTH;
|
|
2340
2385
|
const validatedEntry = entries.find((e) => e.validation?.valid === true);
|
|
@@ -2344,15 +2389,15 @@ var AppAuthCard = ({
|
|
|
2344
2389
|
const lastEntry = entries[entries.length - 1];
|
|
2345
2390
|
return lastEntry.id || lastEntry.label || "0";
|
|
2346
2391
|
};
|
|
2347
|
-
const [selectedAuthId, setSelectedAuthId] = (0,
|
|
2392
|
+
const [selectedAuthId, setSelectedAuthId] = (0, import_react7.useState)(() => {
|
|
2348
2393
|
return getBestDefaultAuth(apiAuthEntries);
|
|
2349
2394
|
});
|
|
2350
|
-
const [userHasSelected, setUserHasSelected] = (0,
|
|
2351
|
-
const [testStatusPerAuth, setTestStatusPerAuth] = (0,
|
|
2352
|
-
const [testMessagesPerAuth, setTestMessagesPerAuth] = (0,
|
|
2353
|
-
const [testingAuthId, setTestingAuthId] = (0,
|
|
2354
|
-
const [deleteConfirmAuthId, setDeleteConfirmAuthId] = (0,
|
|
2355
|
-
const [deleting, setDeleting] = (0,
|
|
2395
|
+
const [userHasSelected, setUserHasSelected] = (0, import_react7.useState)(false);
|
|
2396
|
+
const [testStatusPerAuth, setTestStatusPerAuth] = (0, import_react7.useState)({});
|
|
2397
|
+
const [testMessagesPerAuth, setTestMessagesPerAuth] = (0, import_react7.useState)({});
|
|
2398
|
+
const [testingAuthId, setTestingAuthId] = (0, import_react7.useState)(null);
|
|
2399
|
+
const [deleteConfirmAuthId, setDeleteConfirmAuthId] = (0, import_react7.useState)(null);
|
|
2400
|
+
const [deleting, setDeleting] = (0, import_react7.useState)(false);
|
|
2356
2401
|
const handleDeleteAuth = async (authId) => {
|
|
2357
2402
|
setDeleting(true);
|
|
2358
2403
|
try {
|
|
@@ -2376,10 +2421,10 @@ var AppAuthCard = ({
|
|
|
2376
2421
|
}
|
|
2377
2422
|
};
|
|
2378
2423
|
const localTestStatus = testStatusPerAuth[selectedAuthId] || "untested";
|
|
2379
|
-
const [wasPreValidatedPerAuth, setWasPreValidatedPerAuth] = (0,
|
|
2380
|
-
const prevEntryCountRef = (0,
|
|
2381
|
-
const autoTestFiredRef = (0,
|
|
2382
|
-
(0,
|
|
2424
|
+
const [wasPreValidatedPerAuth, setWasPreValidatedPerAuth] = (0, import_react7.useState)({});
|
|
2425
|
+
const prevEntryCountRef = (0, import_react7.useRef)(apiAuthEntries.length);
|
|
2426
|
+
const autoTestFiredRef = (0, import_react7.useRef)(null);
|
|
2427
|
+
(0, import_react7.useEffect)(() => {
|
|
2383
2428
|
if (apiAuthEntries.length > 0) {
|
|
2384
2429
|
if (apiAuthEntries.length > prevEntryCountRef.current) {
|
|
2385
2430
|
const sorted = [...apiAuthEntries].sort((a, b) => {
|
|
@@ -2408,7 +2453,7 @@ var AppAuthCard = ({
|
|
|
2408
2453
|
}
|
|
2409
2454
|
prevEntryCountRef.current = apiAuthEntries.length;
|
|
2410
2455
|
}, [apiAuthEntries, userHasSelected]);
|
|
2411
|
-
(0,
|
|
2456
|
+
(0, import_react7.useEffect)(() => {
|
|
2412
2457
|
if (wasPreValidatedPerAuth[selectedAuthId] === void 0) {
|
|
2413
2458
|
const currentAuth = apiAuthEntries.find(
|
|
2414
2459
|
(auth2) => (auth2.id || auth2.label || "") === selectedAuthId
|
|
@@ -2430,7 +2475,7 @@ var AppAuthCard = ({
|
|
|
2430
2475
|
};
|
|
2431
2476
|
const localTestMessages = testMessagesPerAuth[selectedAuthId] || {};
|
|
2432
2477
|
const wasPreValidated = wasPreValidatedPerAuth[selectedAuthId] || false;
|
|
2433
|
-
(0,
|
|
2478
|
+
(0, import_react7.useEffect)(() => {
|
|
2434
2479
|
if (!testingAuthId) return;
|
|
2435
2480
|
if (authState.status === "testing") {
|
|
2436
2481
|
setTestStatusForAuth(testingAuthId, "testing");
|
|
@@ -2484,19 +2529,19 @@ var AppAuthCard = ({
|
|
|
2484
2529
|
minute: "2-digit"
|
|
2485
2530
|
});
|
|
2486
2531
|
};
|
|
2487
|
-
const [localCredentials, setLocalCredentials] = (0,
|
|
2488
|
-
const [fieldErrors, setFieldErrors] = (0,
|
|
2489
|
-
const [loading, setLoading] = (0,
|
|
2490
|
-
const [saving, setSaving] = (0,
|
|
2491
|
-
const [saveSuccess, setSaveSuccess] = (0,
|
|
2492
|
-
const [error, setError] = (0,
|
|
2493
|
-
const [appConfig, setAppConfig] = (0,
|
|
2494
|
-
(0,
|
|
2532
|
+
const [localCredentials, setLocalCredentials] = (0, import_react7.useState)(authState.credentials || {});
|
|
2533
|
+
const [fieldErrors, setFieldErrors] = (0, import_react7.useState)({});
|
|
2534
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
2535
|
+
const [saving, setSaving] = (0, import_react7.useState)(false);
|
|
2536
|
+
const [saveSuccess, setSaveSuccess] = (0, import_react7.useState)(null);
|
|
2537
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
2538
|
+
const [appConfig, setAppConfig] = (0, import_react7.useState)(null);
|
|
2539
|
+
(0, import_react7.useEffect)(() => {
|
|
2495
2540
|
if (isExpanded && onRefreshAuth) {
|
|
2496
2541
|
onRefreshAuth();
|
|
2497
2542
|
}
|
|
2498
2543
|
}, [isExpanded]);
|
|
2499
|
-
(0,
|
|
2544
|
+
(0, import_react7.useEffect)(() => {
|
|
2500
2545
|
const fetchAppConfig = async () => {
|
|
2501
2546
|
if (!isExpanded || appConfig) return;
|
|
2502
2547
|
setLoading(true);
|
|
@@ -2529,13 +2574,13 @@ var AppAuthCard = ({
|
|
|
2529
2574
|
}, [isExpanded, app.objectID, appConfig]);
|
|
2530
2575
|
const auth = appConfig?.authentication;
|
|
2531
2576
|
const isOAuth2 = isOAuth2Type(auth?.type);
|
|
2532
|
-
const [selectedScopes, setSelectedScopes] = (0,
|
|
2533
|
-
(0,
|
|
2577
|
+
const [selectedScopes, setSelectedScopes] = (0, import_react7.useState)([]);
|
|
2578
|
+
(0, import_react7.useEffect)(() => {
|
|
2534
2579
|
if (auth?.scope) {
|
|
2535
2580
|
setSelectedScopes(auth.scope);
|
|
2536
2581
|
}
|
|
2537
2582
|
}, [auth?.scope]);
|
|
2538
|
-
(0,
|
|
2583
|
+
(0, import_react7.useEffect)(() => {
|
|
2539
2584
|
if (disableUrlPrefill) return;
|
|
2540
2585
|
if (!auth?.parameters || auth.parameters.length === 0) return;
|
|
2541
2586
|
const urlDefaults = {};
|
|
@@ -2552,7 +2597,7 @@ var AppAuthCard = ({
|
|
|
2552
2597
|
setLocalCredentials((prev) => ({ ...urlDefaults, ...prev }));
|
|
2553
2598
|
}
|
|
2554
2599
|
}, [auth?.parameters, disableUrlPrefill]);
|
|
2555
|
-
(0,
|
|
2600
|
+
(0, import_react7.useEffect)(() => {
|
|
2556
2601
|
const incoming = authState.credentials || {};
|
|
2557
2602
|
setLocalCredentials((prev) => {
|
|
2558
2603
|
let changed = false;
|
|
@@ -2568,12 +2613,12 @@ var AppAuthCard = ({
|
|
|
2568
2613
|
return changed ? next : prev;
|
|
2569
2614
|
});
|
|
2570
2615
|
}, [authState.credentials]);
|
|
2571
|
-
const [docsOpen, setDocsOpen] = (0,
|
|
2572
|
-
const [docsContent, setDocsContent] = (0,
|
|
2573
|
-
const [docsLoading, setDocsLoading] = (0,
|
|
2574
|
-
const [editingLabel, setEditingLabel] = (0,
|
|
2575
|
-
const [editLabelValue, setEditLabelValue] = (0,
|
|
2576
|
-
const [savingLabel, setSavingLabel] = (0,
|
|
2616
|
+
const [docsOpen, setDocsOpen] = (0, import_react7.useState)(false);
|
|
2617
|
+
const [docsContent, setDocsContent] = (0, import_react7.useState)("");
|
|
2618
|
+
const [docsLoading, setDocsLoading] = (0, import_react7.useState)(false);
|
|
2619
|
+
const [editingLabel, setEditingLabel] = (0, import_react7.useState)(false);
|
|
2620
|
+
const [editLabelValue, setEditLabelValue] = (0, import_react7.useState)("");
|
|
2621
|
+
const [savingLabel, setSavingLabel] = (0, import_react7.useState)(false);
|
|
2577
2622
|
const handleRenameAuth = async () => {
|
|
2578
2623
|
if (!selectedAuth || !editLabelValue.trim()) return;
|
|
2579
2624
|
setSavingLabel(true);
|
|
@@ -2969,8 +3014,8 @@ var AppAuthCard = ({
|
|
|
2969
3014
|
{
|
|
2970
3015
|
sx: {
|
|
2971
3016
|
background: "transparent",
|
|
2972
|
-
border: borderless ? "none" : "
|
|
2973
|
-
borderColor: borderless ? "transparent" : isTested ? "hsl(var(--severity-low) / 0.
|
|
3017
|
+
border: borderless ? "none" : "2px solid",
|
|
3018
|
+
borderColor: borderless ? "transparent" : isTested ? "hsl(var(--severity-low) / 0.9)" : authState.status === "error" ? "hsl(var(--destructive) / 0.7)" : "hsl(var(--border))",
|
|
2974
3019
|
borderRadius: borderless ? 0 : 3,
|
|
2975
3020
|
boxShadow: "none",
|
|
2976
3021
|
overflow: "hidden",
|
|
@@ -4012,8 +4057,14 @@ var AppAuthConfig = ({
|
|
|
4012
4057
|
onTestConnection,
|
|
4013
4058
|
onSaveAuth,
|
|
4014
4059
|
onSelectAuth,
|
|
4015
|
-
onRefreshAuth
|
|
4060
|
+
onRefreshAuth,
|
|
4061
|
+
globalUrl,
|
|
4062
|
+
userdata,
|
|
4063
|
+
isLoaded,
|
|
4064
|
+
isLoggedIn,
|
|
4065
|
+
serverside
|
|
4016
4066
|
}) => {
|
|
4067
|
+
useSyncHostBaseUrl(globalUrl);
|
|
4017
4068
|
const getApiAuthEntries = (app) => {
|
|
4018
4069
|
const normalize = (n) => n.toLowerCase().replace(/[\s_\-]+/g, "_");
|
|
4019
4070
|
return authenticatedApps.filter((auth) => normalize(auth.app?.name || "") === normalize(app.name)).map((auth) => ({
|
|
@@ -4032,8 +4083,8 @@ var AppAuthConfig = ({
|
|
|
4032
4083
|
const entries = getApiAuthEntries(app);
|
|
4033
4084
|
return entries.some((e) => e.validation?.valid === true);
|
|
4034
4085
|
};
|
|
4035
|
-
const initialSortRef = (0,
|
|
4036
|
-
const authAppsLoadedRef = (0,
|
|
4086
|
+
const initialSortRef = (0, import_react7.useRef)(null);
|
|
4087
|
+
const authAppsLoadedRef = (0, import_react7.useRef)(false);
|
|
4037
4088
|
if (!authAppsLoadedRef.current && authenticatedApps.length > 0) {
|
|
4038
4089
|
authAppsLoadedRef.current = true;
|
|
4039
4090
|
initialSortRef.current = null;
|
|
@@ -4056,7 +4107,7 @@ var AppAuthConfig = ({
|
|
|
4056
4107
|
const firstNotConfigured = sortedApps.find((app) => !isAppConfigured(app));
|
|
4057
4108
|
const firstNotValidated = sortedApps.find((app) => !isAppValidated(app));
|
|
4058
4109
|
const defaultExpanded = firstNotConfigured?.objectID || firstNotValidated?.objectID || false;
|
|
4059
|
-
const [expanded, setExpanded] = (0,
|
|
4110
|
+
const [expanded, setExpanded] = (0, import_react7.useState)(defaultExpanded);
|
|
4060
4111
|
if (apps.length === 0) {
|
|
4061
4112
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4062
4113
|
import_material4.Alert,
|
|
@@ -4116,6 +4167,11 @@ var AppAuthConfig = ({
|
|
|
4116
4167
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4117
4168
|
AppAuthCard,
|
|
4118
4169
|
{
|
|
4170
|
+
globalUrl,
|
|
4171
|
+
userdata,
|
|
4172
|
+
isLoaded,
|
|
4173
|
+
isLoggedIn,
|
|
4174
|
+
serverside,
|
|
4119
4175
|
app,
|
|
4120
4176
|
authState,
|
|
4121
4177
|
isExpanded,
|
|
@@ -4175,7 +4231,7 @@ var import_material7 = require("@mui/material");
|
|
|
4175
4231
|
var import_framer_motion5 = require("framer-motion");
|
|
4176
4232
|
|
|
4177
4233
|
// views/AppMcpChat.tsx
|
|
4178
|
-
var
|
|
4234
|
+
var import_react8 = require("react");
|
|
4179
4235
|
var import_lucide_react4 = require("lucide-react");
|
|
4180
4236
|
var import_material6 = require("@mui/material");
|
|
4181
4237
|
|
|
@@ -4331,14 +4387,14 @@ function getPrimaryCategory(appName, categories) {
|
|
|
4331
4387
|
return null;
|
|
4332
4388
|
}
|
|
4333
4389
|
var AppMcpChat = ({ appName, appIcon, appId, categories }) => {
|
|
4334
|
-
const [input, setInput] = (0,
|
|
4335
|
-
const [runState, setRunState] = (0,
|
|
4336
|
-
const [query, setQuery] = (0,
|
|
4337
|
-
const [result, setResult] = (0,
|
|
4338
|
-
const [isError, setIsError] = (0,
|
|
4339
|
-
const inputRef = (0,
|
|
4340
|
-
const suggestions = (0,
|
|
4341
|
-
const primaryCategory = (0,
|
|
4390
|
+
const [input, setInput] = (0, import_react8.useState)("");
|
|
4391
|
+
const [runState, setRunState] = (0, import_react8.useState)("idle");
|
|
4392
|
+
const [query, setQuery] = (0, import_react8.useState)("");
|
|
4393
|
+
const [result, setResult] = (0, import_react8.useState)("");
|
|
4394
|
+
const [isError, setIsError] = (0, import_react8.useState)(false);
|
|
4395
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
4396
|
+
const suggestions = (0, import_react8.useMemo)(() => getSuggestions(appName, categories), [appName, categories]);
|
|
4397
|
+
const primaryCategory = (0, import_react8.useMemo)(() => getPrimaryCategory(appName, categories), [appName, categories]);
|
|
4342
4398
|
const MIN_INPUT_LENGTH = 6;
|
|
4343
4399
|
const runAction = async () => {
|
|
4344
4400
|
const trimmed = input.trim();
|
|
@@ -4790,7 +4846,7 @@ function TryMcpSection({ appName, appIcon, appId, categories }) {
|
|
|
4790
4846
|
}
|
|
4791
4847
|
|
|
4792
4848
|
// components/SingulActionsPreview.tsx
|
|
4793
|
-
var
|
|
4849
|
+
var import_react9 = require("react");
|
|
4794
4850
|
var import_material8 = require("@mui/material");
|
|
4795
4851
|
var import_lucide_react5 = require("lucide-react");
|
|
4796
4852
|
init_api();
|
|
@@ -4798,7 +4854,7 @@ var import_react18_json_view = __toESM(require("react18-json-view"));
|
|
|
4798
4854
|
var import_style = require("react18-json-view/src/style.css");
|
|
4799
4855
|
var import_dark = require("react18-json-view/src/dark.css");
|
|
4800
4856
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
4801
|
-
var
|
|
4857
|
+
var import_react10 = require("react");
|
|
4802
4858
|
var deepParseJsonStrings = (obj, depth = 0) => {
|
|
4803
4859
|
if (depth > 5) return obj;
|
|
4804
4860
|
if (typeof obj === "string") {
|
|
@@ -5055,29 +5111,29 @@ var SingulActionsPreview = ({
|
|
|
5055
5111
|
activeOrgId,
|
|
5056
5112
|
onAuthenticate
|
|
5057
5113
|
}) => {
|
|
5058
|
-
const defaultCategory = (0,
|
|
5114
|
+
const defaultCategory = (0, import_react9.useMemo)(() => pickDefaultCategory(categories), [categories]);
|
|
5059
5115
|
const actions = ALL_ACTIONS;
|
|
5060
|
-
const sortedActions = (0,
|
|
5116
|
+
const sortedActions = (0, import_react9.useMemo)(() => {
|
|
5061
5117
|
const inCat = actions.filter((a) => a.category === defaultCategory);
|
|
5062
5118
|
const rest = actions.filter((a) => a.category !== defaultCategory);
|
|
5063
5119
|
return [...inCat, ...rest];
|
|
5064
5120
|
}, [actions, defaultCategory]);
|
|
5065
5121
|
const isDisabled = false;
|
|
5066
|
-
const [selected, setSelected] = (0,
|
|
5067
|
-
const [lang, setLang] = (0,
|
|
5068
|
-
const [snippet, setSnippet] = (0,
|
|
5069
|
-
const curlOpts = (0,
|
|
5122
|
+
const [selected, setSelected] = (0, import_react9.useState)(null);
|
|
5123
|
+
const [lang, setLang] = (0, import_react9.useState)("curl");
|
|
5124
|
+
const [snippet, setSnippet] = (0, import_react9.useState)("");
|
|
5125
|
+
const curlOpts = (0, import_react9.useMemo)(() => {
|
|
5070
5126
|
const apiKey = API_CONFIG.apiKey;
|
|
5071
5127
|
const trackedOrg = getTrackedOrgId();
|
|
5072
5128
|
const orgId = trackedOrg && activeOrgId && trackedOrg !== activeOrgId ? trackedOrg : null;
|
|
5073
5129
|
const baseUrl = API_CONFIG.baseUrl;
|
|
5074
5130
|
return { apiKey, orgId, baseUrl };
|
|
5075
5131
|
}, [activeOrgId]);
|
|
5076
|
-
const buildSnippet = (0,
|
|
5132
|
+
const buildSnippet = (0, import_react9.useCallback)(
|
|
5077
5133
|
(action, l) => l === "python" ? buildSingulPython(appName, action, curlOpts) : buildSingulCurl(appName, action, curlOpts),
|
|
5078
5134
|
[appName, curlOpts]
|
|
5079
5135
|
);
|
|
5080
|
-
(0,
|
|
5136
|
+
(0, import_react9.useEffect)(() => {
|
|
5081
5137
|
const initial = sortedActions[0] || null;
|
|
5082
5138
|
setSelected(initial);
|
|
5083
5139
|
setSnippet(buildSnippet(initial, lang));
|
|
@@ -5095,10 +5151,10 @@ var SingulActionsPreview = ({
|
|
|
5095
5151
|
toast.error("Copy failed");
|
|
5096
5152
|
}
|
|
5097
5153
|
};
|
|
5098
|
-
const [playLoading, setPlayLoading] = (0,
|
|
5099
|
-
const [playResult, setPlayResult] = (0,
|
|
5100
|
-
const responseRef = (0,
|
|
5101
|
-
const [copied, setCopied] = (0,
|
|
5154
|
+
const [playLoading, setPlayLoading] = (0, import_react9.useState)(false);
|
|
5155
|
+
const [playResult, setPlayResult] = (0, import_react9.useState)(null);
|
|
5156
|
+
const responseRef = (0, import_react9.useRef)(null);
|
|
5157
|
+
const [copied, setCopied] = (0, import_react9.useState)(false);
|
|
5102
5158
|
const scrollToResponse = () => {
|
|
5103
5159
|
requestAnimationFrame(() => {
|
|
5104
5160
|
responseRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
@@ -5166,7 +5222,7 @@ var SingulActionsPreview = ({
|
|
|
5166
5222
|
scrollToResponse();
|
|
5167
5223
|
}
|
|
5168
5224
|
};
|
|
5169
|
-
const lineCount = (0,
|
|
5225
|
+
const lineCount = (0, import_react9.useMemo)(() => Math.max(snippet.split("\n").length, 1), [snippet]);
|
|
5170
5226
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.Box, { sx: { mt: 5, mb: 3, opacity: isDisabled ? 0.55 : 1 }, children: [
|
|
5171
5227
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.Box, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 1.5 }, children: [
|
|
5172
5228
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.Typography, { sx: { color: "hsl(var(--foreground))", fontWeight: 600, fontSize: "0.95rem" }, children: "Try individual actions" }),
|
|
@@ -5216,7 +5272,7 @@ var SingulActionsPreview = ({
|
|
|
5216
5272
|
groupBy: (o) => o.category,
|
|
5217
5273
|
getOptionLabel: (o) => o?.label ?? "",
|
|
5218
5274
|
isOptionEqualToValue: (a, b) => a?.name === b?.name && a?.category === b?.category,
|
|
5219
|
-
renderOption: (props, option) => /* @__PURE__ */ (0,
|
|
5275
|
+
renderOption: (props, option) => /* @__PURE__ */ (0, import_react10.createElement)("li", { ...props, key: `${option.category}-${option.name}` }, /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
5220
5276
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.Typography, { sx: { fontSize: "0.78rem", color: "hsl(var(--foreground))" }, children: option.label }),
|
|
5221
5277
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.Typography, { sx: { fontFamily: "'JetBrains Mono', monospace", fontSize: "0.65rem", color: "hsl(var(--muted-foreground))" }, children: option.name })
|
|
5222
5278
|
] })),
|
|
@@ -5603,15 +5659,15 @@ function AppDetailDrawer({
|
|
|
5603
5659
|
isAuthenticated = true,
|
|
5604
5660
|
activeOrgId
|
|
5605
5661
|
}) {
|
|
5606
|
-
const [appInfo, setAppInfo] = (0,
|
|
5607
|
-
const [appLoading, setAppLoading] = (0,
|
|
5608
|
-
const [isActivated, setIsActivated] = (0,
|
|
5609
|
-
const [activatedAppId, setActivatedAppId] = (0,
|
|
5610
|
-
const [activateLoading, setActivateLoading] = (0,
|
|
5611
|
-
const [resolvedAlgoliaId, setResolvedAlgoliaId] = (0,
|
|
5612
|
-
const [authExpanded, setAuthExpanded] = (0,
|
|
5613
|
-
const lastValidAuthRef = (0,
|
|
5614
|
-
const [incidentStats, setIncidentStats] = (0,
|
|
5662
|
+
const [appInfo, setAppInfo] = (0, import_react11.useState)(null);
|
|
5663
|
+
const [appLoading, setAppLoading] = (0, import_react11.useState)(true);
|
|
5664
|
+
const [isActivated, setIsActivated] = (0, import_react11.useState)(null);
|
|
5665
|
+
const [activatedAppId, setActivatedAppId] = (0, import_react11.useState)(null);
|
|
5666
|
+
const [activateLoading, setActivateLoading] = (0, import_react11.useState)(false);
|
|
5667
|
+
const [resolvedAlgoliaId, setResolvedAlgoliaId] = (0, import_react11.useState)(null);
|
|
5668
|
+
const [authExpanded, setAuthExpanded] = (0, import_react11.useState)(true);
|
|
5669
|
+
const lastValidAuthRef = (0, import_react11.useRef)(null);
|
|
5670
|
+
const [incidentStats, setIncidentStats] = (0, import_react11.useState)(null);
|
|
5615
5671
|
const {
|
|
5616
5672
|
authStates,
|
|
5617
5673
|
authenticatedApps,
|
|
@@ -5621,7 +5677,7 @@ function AppDetailDrawer({
|
|
|
5621
5677
|
handleSaveAuth,
|
|
5622
5678
|
refreshAuth
|
|
5623
5679
|
} = useAppAuth();
|
|
5624
|
-
(0,
|
|
5680
|
+
(0, import_react11.useEffect)(() => {
|
|
5625
5681
|
if (!open || !appName) return;
|
|
5626
5682
|
setAppLoading(true);
|
|
5627
5683
|
setAppInfo(null);
|
|
@@ -5713,7 +5769,7 @@ function AppDetailDrawer({
|
|
|
5713
5769
|
setAppLoading(false);
|
|
5714
5770
|
})();
|
|
5715
5771
|
}, [open, appName, appId]);
|
|
5716
|
-
(0,
|
|
5772
|
+
(0, import_react11.useEffect)(() => {
|
|
5717
5773
|
if (!open || !appName || !isAuthenticated) {
|
|
5718
5774
|
setIncidentStats(null);
|
|
5719
5775
|
return;
|
|
@@ -5752,13 +5808,13 @@ function AppDetailDrawer({
|
|
|
5752
5808
|
onRefresh?.();
|
|
5753
5809
|
onClose();
|
|
5754
5810
|
};
|
|
5755
|
-
const matchingEntries = (0,
|
|
5811
|
+
const matchingEntries = (0, import_react11.useMemo)(() => {
|
|
5756
5812
|
if (!appName || !isAuthenticated) return [];
|
|
5757
5813
|
return authenticatedApps.filter(
|
|
5758
5814
|
(auth) => auth.app?.name?.toLowerCase().replace(/[\s_\-]+/g, "_") === appName.toLowerCase().replace(/[\s_\-]+/g, "_")
|
|
5759
5815
|
);
|
|
5760
5816
|
}, [appName, authenticatedApps, isAuthenticated]);
|
|
5761
|
-
const resolvedImage = (0,
|
|
5817
|
+
const resolvedImage = (0, import_react11.useMemo)(() => {
|
|
5762
5818
|
if (appInfo?.large_image) return appInfo.large_image;
|
|
5763
5819
|
for (const entry of matchingEntries) {
|
|
5764
5820
|
const img = entry.app?.large_image || entry.large_image;
|
|
@@ -5766,7 +5822,7 @@ function AppDetailDrawer({
|
|
|
5766
5822
|
}
|
|
5767
5823
|
return "";
|
|
5768
5824
|
}, [appInfo, matchingEntries]);
|
|
5769
|
-
const algoliaApp = (0,
|
|
5825
|
+
const algoliaApp = (0, import_react11.useMemo)(() => {
|
|
5770
5826
|
if (!appName) return null;
|
|
5771
5827
|
return {
|
|
5772
5828
|
objectID: resolvedAlgoliaId || appName,
|
|
@@ -5782,12 +5838,12 @@ function AppDetailDrawer({
|
|
|
5782
5838
|
const effectiveActivated = isActivated === null ? hasAnyAuth ? true : null : isActivated || hasAnyAuth;
|
|
5783
5839
|
const authCount = matchingEntries.length;
|
|
5784
5840
|
const displayName = (appInfo?.name || appName || "").replace(/_/g, " ");
|
|
5785
|
-
(0,
|
|
5841
|
+
(0, import_react11.useEffect)(() => {
|
|
5786
5842
|
if (lastValidAuthRef.current === hasValidAuth) return;
|
|
5787
5843
|
lastValidAuthRef.current = hasValidAuth;
|
|
5788
5844
|
setAuthExpanded(!hasValidAuth);
|
|
5789
5845
|
}, [hasValidAuth]);
|
|
5790
|
-
(0,
|
|
5846
|
+
(0, import_react11.useEffect)(() => {
|
|
5791
5847
|
lastValidAuthRef.current = null;
|
|
5792
5848
|
}, [appName]);
|
|
5793
5849
|
const handleActivateToggle = async () => {
|
|
@@ -6162,16 +6218,6 @@ function SegmentedControl({
|
|
|
6162
6218
|
) });
|
|
6163
6219
|
}
|
|
6164
6220
|
|
|
6165
|
-
// useSyncHostBaseUrl.ts
|
|
6166
|
-
var import_react11 = require("react");
|
|
6167
|
-
init_api();
|
|
6168
|
-
var useSyncHostBaseUrl = (globalUrl) => {
|
|
6169
|
-
(0, import_react11.useEffect)(() => {
|
|
6170
|
-
if (!globalUrl) return;
|
|
6171
|
-
setHostBaseUrl(globalUrl);
|
|
6172
|
-
}, [globalUrl]);
|
|
6173
|
-
};
|
|
6174
|
-
|
|
6175
6221
|
// views/ShuffleMCP.tsx
|
|
6176
6222
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
6177
6223
|
var DEFAULT_ALGOLIA_APP_ID = "JNSS5CFDZZ";
|