@trops/dash-core 0.1.257 → 0.1.259
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/electron/index.js +13 -2
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +490 -490
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +490 -490
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3583,17 +3583,14 @@ var InstallProgressModal = function InstallProgressModal(_ref) {
|
|
|
3583
3583
|
widgets = _ref$widgets === void 0 ? [] : _ref$widgets,
|
|
3584
3584
|
_ref$isComplete = _ref.isComplete,
|
|
3585
3585
|
isComplete = _ref$isComplete === void 0 ? false : _ref$isComplete,
|
|
3586
|
-
onDone = _ref.onDone
|
|
3586
|
+
onDone = _ref.onDone,
|
|
3587
|
+
_ref$onCancel = _ref.onCancel,
|
|
3588
|
+
onCancel = _ref$onCancel === void 0 ? null : _ref$onCancel;
|
|
3587
3589
|
var _useContext = React.useContext(DashReact.ThemeContext),
|
|
3588
3590
|
currentTheme = _useContext.currentTheme;
|
|
3589
3591
|
var panelStyles = DashReact.getStylesForItem(DashReact.themeObjects.PANEL, currentTheme, {
|
|
3590
3592
|
grow: false
|
|
3591
3593
|
});
|
|
3592
|
-
|
|
3593
|
-
// Prevent dismissal while installation is in progress
|
|
3594
|
-
var guardedSetIsOpen = function guardedSetIsOpen(val) {
|
|
3595
|
-
if (isComplete) setIsOpen(val);
|
|
3596
|
-
};
|
|
3597
3594
|
var doneCount = widgets.filter(function (w) {
|
|
3598
3595
|
return w.status === "installed" || w.status === "already-installed" || w.status === "failed";
|
|
3599
3596
|
}).length;
|
|
@@ -3624,7 +3621,7 @@ var InstallProgressModal = function InstallProgressModal(_ref) {
|
|
|
3624
3621
|
}
|
|
3625
3622
|
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
|
|
3626
3623
|
isOpen: isOpen,
|
|
3627
|
-
setIsOpen:
|
|
3624
|
+
setIsOpen: setIsOpen,
|
|
3628
3625
|
width: "w-[440px]",
|
|
3629
3626
|
height: "auto",
|
|
3630
3627
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -3654,9 +3651,19 @@ var InstallProgressModal = function InstallProgressModal(_ref) {
|
|
|
3654
3651
|
})]
|
|
3655
3652
|
}, idx);
|
|
3656
3653
|
})
|
|
3657
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
3658
|
-
className: "flex items-center justify-
|
|
3659
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
3654
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3655
|
+
className: "flex items-center justify-between px-5 py-3 border-t ".concat(currentTheme["border-primary-medium"] || "border-white/10"),
|
|
3656
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3657
|
+
children: !isComplete && onCancel && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3658
|
+
type: "button",
|
|
3659
|
+
onClick: function onClick() {
|
|
3660
|
+
if (onCancel) onCancel();
|
|
3661
|
+
setIsOpen(false);
|
|
3662
|
+
},
|
|
3663
|
+
className: "text-sm text-gray-500 hover:text-gray-300 transition-colors",
|
|
3664
|
+
children: "Cancel"
|
|
3665
|
+
})
|
|
3666
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
3660
3667
|
title: "Done",
|
|
3661
3668
|
bgColor: isComplete ? "bg-blue-600" : "bg-gray-700",
|
|
3662
3669
|
hoverBackgroundColor: isComplete ? "hover:bg-blue-700" : "",
|
|
@@ -3666,12 +3673,273 @@ var InstallProgressModal = function InstallProgressModal(_ref) {
|
|
|
3666
3673
|
if (isComplete && onDone) onDone();
|
|
3667
3674
|
},
|
|
3668
3675
|
disabled: !isComplete
|
|
3669
|
-
})
|
|
3676
|
+
})]
|
|
3670
3677
|
})]
|
|
3671
3678
|
})
|
|
3672
3679
|
});
|
|
3673
3680
|
};
|
|
3674
3681
|
|
|
3682
|
+
/**
|
|
3683
|
+
* useRegistryAuth — reusable hook for device-code OAuth against the Dash Registry.
|
|
3684
|
+
*
|
|
3685
|
+
* Encapsulates the full auth state machine: check status, initiate login,
|
|
3686
|
+
* poll for token, and cancel. Cleans up the poll interval on unmount.
|
|
3687
|
+
*
|
|
3688
|
+
* @returns {{
|
|
3689
|
+
* isAuthenticated: boolean,
|
|
3690
|
+
* isAuthenticating: boolean,
|
|
3691
|
+
* authFlow: { userCode: string, verificationUrlComplete: string } | null,
|
|
3692
|
+
* authError: string | null,
|
|
3693
|
+
* checkAuth: () => Promise<boolean>,
|
|
3694
|
+
* initiateAuth: () => Promise<void>,
|
|
3695
|
+
* cancelAuth: () => void,
|
|
3696
|
+
* }}
|
|
3697
|
+
*/
|
|
3698
|
+
function useRegistryAuth() {
|
|
3699
|
+
var _useState = React.useState(false),
|
|
3700
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3701
|
+
isAuthenticated = _useState2[0],
|
|
3702
|
+
setIsAuthenticated = _useState2[1];
|
|
3703
|
+
var _useState3 = React.useState(false),
|
|
3704
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
3705
|
+
isAuthenticating = _useState4[0],
|
|
3706
|
+
setIsAuthenticating = _useState4[1];
|
|
3707
|
+
var _useState5 = React.useState(null),
|
|
3708
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
3709
|
+
authFlow = _useState6[0],
|
|
3710
|
+
setAuthFlow = _useState6[1];
|
|
3711
|
+
var _useState7 = React.useState(null),
|
|
3712
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
3713
|
+
authError = _useState8[0],
|
|
3714
|
+
setAuthError = _useState8[1];
|
|
3715
|
+
var pollIntervalRef = React.useRef(null);
|
|
3716
|
+
var onAuthorizedRef = React.useRef(null);
|
|
3717
|
+
|
|
3718
|
+
// Clean up polling on unmount
|
|
3719
|
+
React.useEffect(function () {
|
|
3720
|
+
return function () {
|
|
3721
|
+
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
3722
|
+
};
|
|
3723
|
+
}, []);
|
|
3724
|
+
var checkAuth = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3725
|
+
var status, authed;
|
|
3726
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
3727
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3728
|
+
case 0:
|
|
3729
|
+
_context.prev = 0;
|
|
3730
|
+
_context.next = 1;
|
|
3731
|
+
return window.mainApi.registryAuth.getStatus();
|
|
3732
|
+
case 1:
|
|
3733
|
+
status = _context.sent;
|
|
3734
|
+
authed = !!(status !== null && status !== void 0 && status.authenticated);
|
|
3735
|
+
setIsAuthenticated(authed);
|
|
3736
|
+
return _context.abrupt("return", authed);
|
|
3737
|
+
case 2:
|
|
3738
|
+
_context.prev = 2;
|
|
3739
|
+
_context["catch"](0);
|
|
3740
|
+
return _context.abrupt("return", false);
|
|
3741
|
+
case 3:
|
|
3742
|
+
case "end":
|
|
3743
|
+
return _context.stop();
|
|
3744
|
+
}
|
|
3745
|
+
}, _callee, null, [[0, 2]]);
|
|
3746
|
+
})), []);
|
|
3747
|
+
var cancelAuth = React.useCallback(function () {
|
|
3748
|
+
if (pollIntervalRef.current) {
|
|
3749
|
+
clearInterval(pollIntervalRef.current);
|
|
3750
|
+
pollIntervalRef.current = null;
|
|
3751
|
+
}
|
|
3752
|
+
setIsAuthenticating(false);
|
|
3753
|
+
setAuthFlow(null);
|
|
3754
|
+
}, []);
|
|
3755
|
+
var initiateAuth = React.useCallback(/*#__PURE__*/function () {
|
|
3756
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(onAuthorized) {
|
|
3757
|
+
var flow, interval;
|
|
3758
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
3759
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3760
|
+
case 0:
|
|
3761
|
+
setAuthError(null);
|
|
3762
|
+
onAuthorizedRef.current = onAuthorized || null;
|
|
3763
|
+
_context3.prev = 1;
|
|
3764
|
+
_context3.next = 2;
|
|
3765
|
+
return window.mainApi.registryAuth.initiateLogin();
|
|
3766
|
+
case 2:
|
|
3767
|
+
flow = _context3.sent;
|
|
3768
|
+
setAuthFlow(flow);
|
|
3769
|
+
if (flow.verificationUrlComplete) {
|
|
3770
|
+
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
3771
|
+
}
|
|
3772
|
+
setIsAuthenticating(true);
|
|
3773
|
+
interval = (flow.interval || 5) * 1000;
|
|
3774
|
+
pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
3775
|
+
var pollResult;
|
|
3776
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
3777
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3778
|
+
case 0:
|
|
3779
|
+
_context2.prev = 0;
|
|
3780
|
+
_context2.next = 1;
|
|
3781
|
+
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
3782
|
+
case 1:
|
|
3783
|
+
pollResult = _context2.sent;
|
|
3784
|
+
if (pollResult.status === "authorized") {
|
|
3785
|
+
clearInterval(pollIntervalRef.current);
|
|
3786
|
+
pollIntervalRef.current = null;
|
|
3787
|
+
setIsAuthenticating(false);
|
|
3788
|
+
setAuthFlow(null);
|
|
3789
|
+
setIsAuthenticated(true);
|
|
3790
|
+
if (onAuthorizedRef.current) {
|
|
3791
|
+
onAuthorizedRef.current();
|
|
3792
|
+
}
|
|
3793
|
+
} else if (pollResult.status === "expired") {
|
|
3794
|
+
clearInterval(pollIntervalRef.current);
|
|
3795
|
+
pollIntervalRef.current = null;
|
|
3796
|
+
setIsAuthenticating(false);
|
|
3797
|
+
setAuthFlow(null);
|
|
3798
|
+
setAuthError("Authorization expired. Please try again.");
|
|
3799
|
+
}
|
|
3800
|
+
_context2.next = 3;
|
|
3801
|
+
break;
|
|
3802
|
+
case 2:
|
|
3803
|
+
_context2.prev = 2;
|
|
3804
|
+
_context2["catch"](0);
|
|
3805
|
+
clearInterval(pollIntervalRef.current);
|
|
3806
|
+
pollIntervalRef.current = null;
|
|
3807
|
+
setIsAuthenticating(false);
|
|
3808
|
+
case 3:
|
|
3809
|
+
case "end":
|
|
3810
|
+
return _context2.stop();
|
|
3811
|
+
}
|
|
3812
|
+
}, _callee2, null, [[0, 2]]);
|
|
3813
|
+
})), interval);
|
|
3814
|
+
_context3.next = 4;
|
|
3815
|
+
break;
|
|
3816
|
+
case 3:
|
|
3817
|
+
_context3.prev = 3;
|
|
3818
|
+
_context3["catch"](1);
|
|
3819
|
+
setAuthError("Could not reach the registry. Check your connection and try again.");
|
|
3820
|
+
case 4:
|
|
3821
|
+
case "end":
|
|
3822
|
+
return _context3.stop();
|
|
3823
|
+
}
|
|
3824
|
+
}, _callee3, null, [[1, 3]]);
|
|
3825
|
+
}));
|
|
3826
|
+
return function (_x) {
|
|
3827
|
+
return _ref2.apply(this, arguments);
|
|
3828
|
+
};
|
|
3829
|
+
}(), [cancelAuth]);
|
|
3830
|
+
return {
|
|
3831
|
+
isAuthenticated: isAuthenticated,
|
|
3832
|
+
isAuthenticating: isAuthenticating,
|
|
3833
|
+
authFlow: authFlow,
|
|
3834
|
+
authError: authError,
|
|
3835
|
+
checkAuth: checkAuth,
|
|
3836
|
+
initiateAuth: initiateAuth,
|
|
3837
|
+
cancelAuth: cancelAuth
|
|
3838
|
+
};
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
var RegistryAuthPrompt = function RegistryAuthPrompt(_ref) {
|
|
3842
|
+
var onAuthenticated = _ref.onAuthenticated,
|
|
3843
|
+
_ref$onCancel = _ref.onCancel,
|
|
3844
|
+
onCancel = _ref$onCancel === void 0 ? null : _ref$onCancel,
|
|
3845
|
+
_ref$message = _ref.message,
|
|
3846
|
+
message = _ref$message === void 0 ? "Sign in to install from the Dash Registry." : _ref$message;
|
|
3847
|
+
var _useRegistryAuth = useRegistryAuth(),
|
|
3848
|
+
isAuthenticating = _useRegistryAuth.isAuthenticating,
|
|
3849
|
+
authFlow = _useRegistryAuth.authFlow,
|
|
3850
|
+
authError = _useRegistryAuth.authError,
|
|
3851
|
+
checkAuth = _useRegistryAuth.checkAuth,
|
|
3852
|
+
initiateAuth = _useRegistryAuth.initiateAuth,
|
|
3853
|
+
cancelAuth = _useRegistryAuth.cancelAuth;
|
|
3854
|
+
var checkedRef = React.useRef(false);
|
|
3855
|
+
|
|
3856
|
+
// Check auth on mount — if already authenticated, short-circuit
|
|
3857
|
+
React.useEffect(function () {
|
|
3858
|
+
if (checkedRef.current) return;
|
|
3859
|
+
checkedRef.current = true;
|
|
3860
|
+
checkAuth().then(function (authed) {
|
|
3861
|
+
if (authed && onAuthenticated) onAuthenticated();
|
|
3862
|
+
});
|
|
3863
|
+
}, [checkAuth, onAuthenticated]);
|
|
3864
|
+
function handleSignIn() {
|
|
3865
|
+
initiateAuth(function () {
|
|
3866
|
+
if (onAuthenticated) onAuthenticated();
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
function handleCancel() {
|
|
3870
|
+
cancelAuth();
|
|
3871
|
+
if (onCancel) onCancel();
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3874
|
+
// Polling state: show user code
|
|
3875
|
+
if (authFlow && isAuthenticating) {
|
|
3876
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3877
|
+
className: "flex flex-col gap-3 p-4",
|
|
3878
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3879
|
+
className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
|
|
3880
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
3881
|
+
className: "text-xs text-blue-300/90",
|
|
3882
|
+
children: "Enter this code in your browser:"
|
|
3883
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3884
|
+
className: "text-center",
|
|
3885
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3886
|
+
className: "text-2xl font-mono font-bold tracking-widest text-white",
|
|
3887
|
+
children: authFlow.userCode
|
|
3888
|
+
})
|
|
3889
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
3890
|
+
className: "text-xs text-blue-300/70 text-center",
|
|
3891
|
+
children: "Waiting for authorization \u2014 install will resume automatically..."
|
|
3892
|
+
})]
|
|
3893
|
+
}), onCancel && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3894
|
+
type: "button",
|
|
3895
|
+
onClick: handleCancel,
|
|
3896
|
+
className: "self-center text-xs text-gray-500 hover:text-gray-300 transition-colors",
|
|
3897
|
+
children: "Cancel"
|
|
3898
|
+
})]
|
|
3899
|
+
});
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
// Default: not-started / error state
|
|
3903
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3904
|
+
className: "flex flex-col gap-3 p-4",
|
|
3905
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3906
|
+
className: "bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",
|
|
3907
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3908
|
+
className: "flex items-start gap-2",
|
|
3909
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
3910
|
+
icon: "lock",
|
|
3911
|
+
className: "h-3.5 w-3.5 text-yellow-400 mt-0.5 flex-shrink-0"
|
|
3912
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3913
|
+
className: "text-sm text-yellow-300/90",
|
|
3914
|
+
children: message
|
|
3915
|
+
})]
|
|
3916
|
+
})
|
|
3917
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3918
|
+
type: "button",
|
|
3919
|
+
onClick: handleSignIn,
|
|
3920
|
+
className: "px-4 py-2 rounded-lg text-sm bg-blue-500/20 border border-blue-500/30 text-blue-300 hover:bg-blue-500/30 transition-colors cursor-pointer",
|
|
3921
|
+
children: "Sign in to Registry"
|
|
3922
|
+
}), authError && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3923
|
+
className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
|
|
3924
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3925
|
+
className: "flex items-start gap-2",
|
|
3926
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
3927
|
+
icon: "circle-xmark",
|
|
3928
|
+
className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
|
|
3929
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3930
|
+
className: "text-xs text-red-300/90",
|
|
3931
|
+
children: authError
|
|
3932
|
+
})]
|
|
3933
|
+
})
|
|
3934
|
+
}), onCancel && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
3935
|
+
type: "button",
|
|
3936
|
+
onClick: handleCancel,
|
|
3937
|
+
className: "self-center text-xs text-gray-500 hover:text-gray-300 transition-colors",
|
|
3938
|
+
children: "Cancel"
|
|
3939
|
+
})]
|
|
3940
|
+
});
|
|
3941
|
+
};
|
|
3942
|
+
|
|
3675
3943
|
function _createForOfIteratorHelper$g(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$g(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3676
3944
|
function _unsupportedIterableToArray$g(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$g(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$g(r, a) : void 0; } }
|
|
3677
3945
|
function _arrayLikeToArray$g(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -3702,41 +3970,27 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3702
3970
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
3703
3971
|
installResult = _useState8[0],
|
|
3704
3972
|
setInstallResult = _useState8[1];
|
|
3705
|
-
var _useState9 = React.useState(
|
|
3973
|
+
var _useState9 = React.useState(false),
|
|
3706
3974
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
var _useState1 = React.useState(
|
|
3975
|
+
showProgressModal = _useState0[0],
|
|
3976
|
+
setShowProgressModal = _useState0[1];
|
|
3977
|
+
var _useState1 = React.useState([]),
|
|
3710
3978
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
var _useState11 = React.useState(
|
|
3979
|
+
progressWidgets = _useState10[0],
|
|
3980
|
+
setProgressWidgets = _useState10[1];
|
|
3981
|
+
var _useState11 = React.useState(false),
|
|
3714
3982
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
var _useState13 = React.useState(false),
|
|
3718
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
3719
|
-
showProgressModal = _useState14[0],
|
|
3720
|
-
setShowProgressModal = _useState14[1];
|
|
3721
|
-
var _useState15 = React.useState([]),
|
|
3722
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
3723
|
-
progressWidgets = _useState16[0],
|
|
3724
|
-
setProgressWidgets = _useState16[1];
|
|
3725
|
-
var _useState17 = React.useState(false),
|
|
3726
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
3727
|
-
progressComplete = _useState18[0],
|
|
3728
|
-
setProgressComplete = _useState18[1];
|
|
3983
|
+
progressComplete = _useState12[0],
|
|
3984
|
+
setProgressComplete = _useState12[1];
|
|
3729
3985
|
var progressResultRef = React.useRef(null);
|
|
3730
|
-
var pollIntervalRef = React.useRef(null);
|
|
3731
3986
|
var cleanupProgressRef = React.useRef(null);
|
|
3732
3987
|
var pkg = dashboardPackage;
|
|
3733
3988
|
if (!pkg) return null;
|
|
3734
3989
|
|
|
3735
|
-
// Clean up
|
|
3990
|
+
// Clean up progress listener on unmount
|
|
3736
3991
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
3737
3992
|
React.useEffect(function () {
|
|
3738
3993
|
return function () {
|
|
3739
|
-
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
3740
3994
|
if (cleanupProgressRef.current) cleanupProgressRef.current();
|
|
3741
3995
|
};
|
|
3742
3996
|
}, []);
|
|
@@ -3750,10 +4004,6 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3750
4004
|
setPreviewLoading(true);
|
|
3751
4005
|
setPreview(null);
|
|
3752
4006
|
setInstallResult(null);
|
|
3753
|
-
setAuthFlow(null);
|
|
3754
|
-
setIsPolling(false);
|
|
3755
|
-
setAuthError(null);
|
|
3756
|
-
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
3757
4007
|
(_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.dashboardConfig) === null || _window$mainApi === void 0 || _window$mainApi.getDashboardPreview(pkg.name).then(function (result) {
|
|
3758
4008
|
if (!cancelled) setPreview(result);
|
|
3759
4009
|
})["catch"](function (err) {
|
|
@@ -3781,8 +4031,6 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3781
4031
|
case 1:
|
|
3782
4032
|
setIsInstalling(true);
|
|
3783
4033
|
setInstallResult(null);
|
|
3784
|
-
setAuthFlow(null);
|
|
3785
|
-
setAuthError(null);
|
|
3786
4034
|
|
|
3787
4035
|
// Initialize progress modal from widget deps
|
|
3788
4036
|
deps = widgetDeps.length > 0 ? widgetDeps : [];
|
|
@@ -3890,83 +4138,6 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
3890
4138
|
}
|
|
3891
4139
|
}
|
|
3892
4140
|
}, [pkg.name, onInstallComplete]);
|
|
3893
|
-
function handleSignIn() {
|
|
3894
|
-
return _handleSignIn.apply(this, arguments);
|
|
3895
|
-
}
|
|
3896
|
-
function _handleSignIn() {
|
|
3897
|
-
_handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
3898
|
-
var flow, interval;
|
|
3899
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
3900
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
3901
|
-
case 0:
|
|
3902
|
-
setAuthError(null);
|
|
3903
|
-
_context3.prev = 1;
|
|
3904
|
-
_context3.next = 2;
|
|
3905
|
-
return window.mainApi.registryAuth.initiateLogin();
|
|
3906
|
-
case 2:
|
|
3907
|
-
flow = _context3.sent;
|
|
3908
|
-
setAuthFlow(flow);
|
|
3909
|
-
|
|
3910
|
-
// Open verification URL in browser
|
|
3911
|
-
if (flow.verificationUrlComplete) {
|
|
3912
|
-
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
3913
|
-
}
|
|
3914
|
-
|
|
3915
|
-
// Start polling for token
|
|
3916
|
-
setIsPolling(true);
|
|
3917
|
-
interval = (flow.interval || 5) * 1000;
|
|
3918
|
-
pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
3919
|
-
var pollResult;
|
|
3920
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
3921
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3922
|
-
case 0:
|
|
3923
|
-
_context2.prev = 0;
|
|
3924
|
-
_context2.next = 1;
|
|
3925
|
-
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
3926
|
-
case 1:
|
|
3927
|
-
pollResult = _context2.sent;
|
|
3928
|
-
if (pollResult.status === "authorized") {
|
|
3929
|
-
clearInterval(pollIntervalRef.current);
|
|
3930
|
-
pollIntervalRef.current = null;
|
|
3931
|
-
setIsPolling(false);
|
|
3932
|
-
setAuthFlow(null);
|
|
3933
|
-
// DASH-136: Auto-retry install after successful auth
|
|
3934
|
-
handleInstall();
|
|
3935
|
-
} else if (pollResult.status === "expired") {
|
|
3936
|
-
clearInterval(pollIntervalRef.current);
|
|
3937
|
-
pollIntervalRef.current = null;
|
|
3938
|
-
setIsPolling(false);
|
|
3939
|
-
setAuthFlow(null);
|
|
3940
|
-
setAuthError("Authorization expired. Please try again.");
|
|
3941
|
-
}
|
|
3942
|
-
_context2.next = 3;
|
|
3943
|
-
break;
|
|
3944
|
-
case 2:
|
|
3945
|
-
_context2.prev = 2;
|
|
3946
|
-
_context2["catch"](0);
|
|
3947
|
-
clearInterval(pollIntervalRef.current);
|
|
3948
|
-
pollIntervalRef.current = null;
|
|
3949
|
-
setIsPolling(false);
|
|
3950
|
-
case 3:
|
|
3951
|
-
case "end":
|
|
3952
|
-
return _context2.stop();
|
|
3953
|
-
}
|
|
3954
|
-
}, _callee2, null, [[0, 2]]);
|
|
3955
|
-
})), interval);
|
|
3956
|
-
_context3.next = 4;
|
|
3957
|
-
break;
|
|
3958
|
-
case 3:
|
|
3959
|
-
_context3.prev = 3;
|
|
3960
|
-
_context3["catch"](1);
|
|
3961
|
-
setAuthError("Could not reach the registry. Check your connection and try again.");
|
|
3962
|
-
case 4:
|
|
3963
|
-
case "end":
|
|
3964
|
-
return _context3.stop();
|
|
3965
|
-
}
|
|
3966
|
-
}, _callee3, null, [[1, 3]]);
|
|
3967
|
-
}));
|
|
3968
|
-
return _handleSignIn.apply(this, arguments);
|
|
3969
|
-
}
|
|
3970
4141
|
var widgetDeps = (preview === null || preview === void 0 ? void 0 : preview.widgets) || pkg.widgets || [];
|
|
3971
4142
|
var providers = (preview === null || preview === void 0 ? void 0 : preview.providers) || [];
|
|
3972
4143
|
|
|
@@ -4210,55 +4381,15 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
|
|
|
4210
4381
|
children: installResult.message
|
|
4211
4382
|
})]
|
|
4212
4383
|
})
|
|
4213
|
-
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) === "auth" && /*#__PURE__*/jsxRuntime.
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4223
|
-
className: "text-sm text-yellow-300/90",
|
|
4224
|
-
children: installResult.message
|
|
4225
|
-
})]
|
|
4226
|
-
})
|
|
4227
|
-
}), !authFlow && !isPolling && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4228
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
4229
|
-
type: "button",
|
|
4230
|
-
onClick: handleSignIn,
|
|
4231
|
-
className: "px-4 py-2 rounded-lg text-sm bg-blue-500/20 border border-blue-500/30 text-blue-300 hover:bg-blue-500/30 transition-colors cursor-pointer",
|
|
4232
|
-
children: "Sign in to Registry"
|
|
4233
|
-
}), authError && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4234
|
-
className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
|
|
4235
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4236
|
-
className: "flex items-start gap-2",
|
|
4237
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
4238
|
-
icon: "circle-xmark",
|
|
4239
|
-
className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
|
|
4240
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4241
|
-
className: "text-xs text-red-300/90",
|
|
4242
|
-
children: authError
|
|
4243
|
-
})]
|
|
4244
|
-
})
|
|
4245
|
-
})]
|
|
4246
|
-
}), authFlow && isPolling && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4247
|
-
className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
|
|
4248
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
4249
|
-
className: "text-xs text-blue-300/90",
|
|
4250
|
-
children: "Enter this code in your browser:"
|
|
4251
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4252
|
-
className: "text-center",
|
|
4253
|
-
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
4254
|
-
className: "text-2xl font-mono font-bold tracking-widest text-white",
|
|
4255
|
-
children: authFlow.userCode
|
|
4256
|
-
})
|
|
4257
|
-
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
4258
|
-
className: "text-xs text-blue-300/70 text-center",
|
|
4259
|
-
children: "Waiting for authorization \u2014 install will resume automatically..."
|
|
4260
|
-
})]
|
|
4261
|
-
})]
|
|
4384
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) === "auth" && /*#__PURE__*/jsxRuntime.jsx(RegistryAuthPrompt, {
|
|
4385
|
+
onAuthenticated: function onAuthenticated() {
|
|
4386
|
+
setInstallResult(null);
|
|
4387
|
+
handleInstall();
|
|
4388
|
+
},
|
|
4389
|
+
onCancel: function onCancel() {
|
|
4390
|
+
return setInstallResult(null);
|
|
4391
|
+
},
|
|
4392
|
+
message: installResult.message
|
|
4262
4393
|
})]
|
|
4263
4394
|
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "auth" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4264
4395
|
className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
|
|
@@ -5687,6 +5818,23 @@ var LayoutQuickAddMenu = function LayoutQuickAddMenu(_ref) {
|
|
|
5687
5818
|
});
|
|
5688
5819
|
};
|
|
5689
5820
|
|
|
5821
|
+
/**
|
|
5822
|
+
* Strip the Electron IPC error prefix from error messages.
|
|
5823
|
+
*
|
|
5824
|
+
* Raw IPC errors look like:
|
|
5825
|
+
* "Error invoking remote method 'widget:install': Error: Failed to fetch: Unauthorized"
|
|
5826
|
+
*
|
|
5827
|
+
* This extracts just the meaningful part after the last "Error: " prefix.
|
|
5828
|
+
*
|
|
5829
|
+
* @param {string} message - Raw error message
|
|
5830
|
+
* @returns {string} Cleaned error message
|
|
5831
|
+
*/
|
|
5832
|
+
function cleanIpcError(message) {
|
|
5833
|
+
if (!message || typeof message !== "string") return message;
|
|
5834
|
+
var match = message.match(/Error invoking remote method '[^']+': (?:Error: )?(.*)/);
|
|
5835
|
+
return match ? match[1] : message;
|
|
5836
|
+
}
|
|
5837
|
+
|
|
5690
5838
|
function _createForOfIteratorHelper$f(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$f(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
5691
5839
|
function _unsupportedIterableToArray$f(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$f(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$f(r, a) : void 0; } }
|
|
5692
5840
|
function _arrayLikeToArray$f(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -5748,8 +5896,12 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
5748
5896
|
setInstallError = _useState12[1];
|
|
5749
5897
|
var _useState13 = React.useState(false),
|
|
5750
5898
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
5751
|
-
|
|
5752
|
-
|
|
5899
|
+
needsAuth = _useState14[0],
|
|
5900
|
+
setNeedsAuth = _useState14[1];
|
|
5901
|
+
var _useState15 = React.useState(false),
|
|
5902
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
5903
|
+
showAllPackages = _useState16[0],
|
|
5904
|
+
setShowAllPackages = _useState16[1];
|
|
5753
5905
|
|
|
5754
5906
|
// Discover app capabilities from window.mainApi
|
|
5755
5907
|
var appCapabilities = React.useMemo(function () {
|
|
@@ -5914,9 +6066,12 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
5914
6066
|
};
|
|
5915
6067
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5916
6068
|
}, [searchQuery, showAllPackages]);
|
|
6069
|
+
var clearNeedsAuth = React.useCallback(function () {
|
|
6070
|
+
return setNeedsAuth(false);
|
|
6071
|
+
}, []);
|
|
5917
6072
|
var installPackage = React.useCallback(/*#__PURE__*/function () {
|
|
5918
6073
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(widget) {
|
|
5919
|
-
var packageName, packageScope, downloadUrl, packageVersion, scopedId, resolvedUrl,
|
|
6074
|
+
var _window$mainApi2, status, packageName, packageScope, downloadUrl, packageVersion, scopedId, resolvedUrl, msg, _t3;
|
|
5920
6075
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
5921
6076
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5922
6077
|
case 0:
|
|
@@ -5928,28 +6083,53 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
5928
6083
|
case 1:
|
|
5929
6084
|
setIsInstalling(true);
|
|
5930
6085
|
setInstallError(null);
|
|
6086
|
+
setNeedsAuth(false);
|
|
5931
6087
|
_context2.prev = 2;
|
|
6088
|
+
_context2.prev = 3;
|
|
6089
|
+
_context2.next = 4;
|
|
6090
|
+
return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.registryAuth) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.getStatus();
|
|
6091
|
+
case 4:
|
|
6092
|
+
status = _context2.sent;
|
|
6093
|
+
if (status !== null && status !== void 0 && status.authenticated) {
|
|
6094
|
+
_context2.next = 5;
|
|
6095
|
+
break;
|
|
6096
|
+
}
|
|
6097
|
+
setNeedsAuth(true);
|
|
6098
|
+
setIsInstalling(false);
|
|
6099
|
+
return _context2.abrupt("return");
|
|
6100
|
+
case 5:
|
|
6101
|
+
_context2.next = 7;
|
|
6102
|
+
break;
|
|
6103
|
+
case 6:
|
|
6104
|
+
_context2.prev = 6;
|
|
6105
|
+
_context2["catch"](3);
|
|
6106
|
+
case 7:
|
|
5932
6107
|
packageName = widget.packageName, packageScope = widget.packageScope, downloadUrl = widget.downloadUrl, packageVersion = widget.packageVersion; // Build scoped ID (e.g. "@trops/slack") for the install key
|
|
5933
6108
|
scopedId = packageScope ? "@".concat(packageScope.replace(/^@/, ""), "/").concat(packageName) : packageName; // Resolve placeholders in the download URL
|
|
5934
6109
|
resolvedUrl = downloadUrl.replace(/\{version\}/g, packageVersion).replace(/\{name\}/g, packageName);
|
|
5935
|
-
_context2.next =
|
|
6110
|
+
_context2.next = 8;
|
|
5936
6111
|
return window.mainApi.widgets.install(scopedId, resolvedUrl);
|
|
5937
|
-
case
|
|
5938
|
-
_context2.next =
|
|
6112
|
+
case 8:
|
|
6113
|
+
_context2.next = 10;
|
|
5939
6114
|
break;
|
|
5940
|
-
case
|
|
5941
|
-
_context2.prev =
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
6115
|
+
case 9:
|
|
6116
|
+
_context2.prev = 9;
|
|
6117
|
+
_t3 = _context2["catch"](2);
|
|
6118
|
+
msg = cleanIpcError(_t3.message || "Failed to install package");
|
|
6119
|
+
if (msg.toLowerCase().includes("unauthorized") || msg.toLowerCase().includes("authentication required")) {
|
|
6120
|
+
setNeedsAuth(true);
|
|
6121
|
+
} else {
|
|
6122
|
+
setInstallError(msg);
|
|
6123
|
+
}
|
|
6124
|
+
case 10:
|
|
6125
|
+
_context2.prev = 10;
|
|
5946
6126
|
setIsInstalling(false);
|
|
5947
|
-
return _context2.finish(
|
|
5948
|
-
case
|
|
6127
|
+
return _context2.finish(10);
|
|
6128
|
+
case 11:
|
|
5949
6129
|
case "end":
|
|
5950
6130
|
return _context2.stop();
|
|
5951
6131
|
}
|
|
5952
|
-
}, _callee2, null, [[2,
|
|
6132
|
+
}, _callee2, null, [[2, 9, 10, 11], [3, 6]]);
|
|
5953
6133
|
}));
|
|
5954
6134
|
return function (_x2) {
|
|
5955
6135
|
return _ref3.apply(this, arguments);
|
|
@@ -5967,6 +6147,8 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
5967
6147
|
setSearchQuery: setSearchQuery,
|
|
5968
6148
|
isInstalling: isInstalling,
|
|
5969
6149
|
installError: installError,
|
|
6150
|
+
needsAuth: needsAuth,
|
|
6151
|
+
clearNeedsAuth: clearNeedsAuth,
|
|
5970
6152
|
search: search,
|
|
5971
6153
|
installPackage: installPackage,
|
|
5972
6154
|
retry: retry,
|
|
@@ -16341,6 +16523,10 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
|
|
|
16341
16523
|
_useState64 = _slicedToArray(_useState63, 2),
|
|
16342
16524
|
installError = _useState64[0],
|
|
16343
16525
|
setInstallError = _useState64[1];
|
|
16526
|
+
var _useState65 = React.useState(false),
|
|
16527
|
+
_useState66 = _slicedToArray(_useState65, 2),
|
|
16528
|
+
needsAuth = _useState66[0],
|
|
16529
|
+
setNeedsAuth = _useState66[1];
|
|
16344
16530
|
|
|
16345
16531
|
// Phase 3: Recent Widgets - localStorage functions
|
|
16346
16532
|
var loadRecentWidgets = function loadRecentWidgets() {
|
|
@@ -16935,7 +17121,7 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
|
|
|
16935
17121
|
// Install a package from the registry
|
|
16936
17122
|
var handleInstallPackage = /*#__PURE__*/function () {
|
|
16937
17123
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
16938
|
-
var packageName, downloadUrl, packageVersion, resolvedUrl,
|
|
17124
|
+
var _window$mainApi, status, packageName, downloadUrl, packageVersion, resolvedUrl, msg, _t3;
|
|
16939
17125
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
16940
17126
|
while (1) switch (_context2.prev = _context2.next) {
|
|
16941
17127
|
case 0:
|
|
@@ -16947,32 +17133,57 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
|
|
|
16947
17133
|
case 1:
|
|
16948
17134
|
setIsInstalling(true);
|
|
16949
17135
|
setInstallError(null);
|
|
17136
|
+
setNeedsAuth(false);
|
|
16950
17137
|
_context2.prev = 2;
|
|
17138
|
+
_context2.prev = 3;
|
|
17139
|
+
_context2.next = 4;
|
|
17140
|
+
return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.registryAuth) === null || _window$mainApi === void 0 ? void 0 : _window$mainApi.getStatus();
|
|
17141
|
+
case 4:
|
|
17142
|
+
status = _context2.sent;
|
|
17143
|
+
if (status !== null && status !== void 0 && status.authenticated) {
|
|
17144
|
+
_context2.next = 5;
|
|
17145
|
+
break;
|
|
17146
|
+
}
|
|
17147
|
+
setNeedsAuth(true);
|
|
17148
|
+
setIsInstalling(false);
|
|
17149
|
+
return _context2.abrupt("return");
|
|
17150
|
+
case 5:
|
|
17151
|
+
_context2.next = 7;
|
|
17152
|
+
break;
|
|
17153
|
+
case 6:
|
|
17154
|
+
_context2.prev = 6;
|
|
17155
|
+
_context2["catch"](3);
|
|
17156
|
+
case 7:
|
|
16951
17157
|
packageName = selectedWidget.packageName, downloadUrl = selectedWidget.downloadUrl, packageVersion = selectedWidget.packageVersion; // Resolve version placeholder in download URL
|
|
16952
17158
|
resolvedUrl = downloadUrl.replace(/\{version\}/g, packageVersion).replace(/\{name\}/g, packageName);
|
|
16953
|
-
_context2.next =
|
|
17159
|
+
_context2.next = 8;
|
|
16954
17160
|
return window.mainApi.widgets.install(packageName, resolvedUrl);
|
|
16955
|
-
case
|
|
17161
|
+
case 8:
|
|
16956
17162
|
|
|
16957
17163
|
// Switch to Installed tab after successful install
|
|
16958
17164
|
setSelectedSource("Installed");
|
|
16959
17165
|
setSelectedWidget(null);
|
|
16960
17166
|
setSelectedPackage(null);
|
|
16961
|
-
_context2.next =
|
|
17167
|
+
_context2.next = 10;
|
|
16962
17168
|
break;
|
|
16963
|
-
case
|
|
16964
|
-
_context2.prev =
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
17169
|
+
case 9:
|
|
17170
|
+
_context2.prev = 9;
|
|
17171
|
+
_t3 = _context2["catch"](2);
|
|
17172
|
+
msg = cleanIpcError(_t3.message || "Failed to install package");
|
|
17173
|
+
if (msg.toLowerCase().includes("unauthorized") || msg.toLowerCase().includes("authentication required")) {
|
|
17174
|
+
setNeedsAuth(true);
|
|
17175
|
+
} else {
|
|
17176
|
+
setInstallError(msg);
|
|
17177
|
+
}
|
|
17178
|
+
case 10:
|
|
17179
|
+
_context2.prev = 10;
|
|
16969
17180
|
setIsInstalling(false);
|
|
16970
|
-
return _context2.finish(
|
|
16971
|
-
case
|
|
17181
|
+
return _context2.finish(10);
|
|
17182
|
+
case 11:
|
|
16972
17183
|
case "end":
|
|
16973
17184
|
return _context2.stop();
|
|
16974
17185
|
}
|
|
16975
|
-
}, _callee2, null, [[2,
|
|
17186
|
+
}, _callee2, null, [[2, 9, 10, 11], [3, 6]]);
|
|
16976
17187
|
}));
|
|
16977
17188
|
return function handleInstallPackage() {
|
|
16978
17189
|
return _ref3.apply(this, arguments);
|
|
@@ -17291,6 +17502,18 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
|
|
|
17291
17502
|
className: "text-xs text-red-400",
|
|
17292
17503
|
children: installError
|
|
17293
17504
|
})
|
|
17505
|
+
}), needsAuth && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
17506
|
+
className: "mt-3",
|
|
17507
|
+
children: /*#__PURE__*/jsxRuntime.jsx(RegistryAuthPrompt, {
|
|
17508
|
+
onAuthenticated: function onAuthenticated() {
|
|
17509
|
+
setNeedsAuth(false);
|
|
17510
|
+
handleInstallPackage();
|
|
17511
|
+
},
|
|
17512
|
+
onCancel: function onCancel() {
|
|
17513
|
+
return setNeedsAuth(false);
|
|
17514
|
+
},
|
|
17515
|
+
message: "Sign in to install this widget from the Dash Registry."
|
|
17516
|
+
})
|
|
17294
17517
|
})]
|
|
17295
17518
|
});
|
|
17296
17519
|
};
|
|
@@ -23143,7 +23366,13 @@ var RegistryPackageDetail = function RegistryPackageDetail(_ref) {
|
|
|
23143
23366
|
_ref$installError = _ref.installError,
|
|
23144
23367
|
installError = _ref$installError === void 0 ? null : _ref$installError,
|
|
23145
23368
|
_ref$isInstalled = _ref.isInstalled,
|
|
23146
|
-
isInstalled = _ref$isInstalled === void 0 ? false : _ref$isInstalled
|
|
23369
|
+
isInstalled = _ref$isInstalled === void 0 ? false : _ref$isInstalled,
|
|
23370
|
+
_ref$showAuth = _ref.showAuth,
|
|
23371
|
+
showAuth = _ref$showAuth === void 0 ? false : _ref$showAuth,
|
|
23372
|
+
_ref$onAuthSuccess = _ref.onAuthSuccess,
|
|
23373
|
+
onAuthSuccess = _ref$onAuthSuccess === void 0 ? null : _ref$onAuthSuccess,
|
|
23374
|
+
_ref$onAuthCancel = _ref.onAuthCancel,
|
|
23375
|
+
onAuthCancel = _ref$onAuthCancel === void 0 ? null : _ref$onAuthCancel;
|
|
23147
23376
|
var _useContext = React.useContext(DashReact.ThemeContext),
|
|
23148
23377
|
currentTheme = _useContext.currentTheme;
|
|
23149
23378
|
var panelStyles = DashReact.getStylesForItem(DashReact.themeObjects.PANEL, currentTheme, {
|
|
@@ -23279,7 +23508,11 @@ var RegistryPackageDetail = function RegistryPackageDetail(_ref) {
|
|
|
23279
23508
|
children: installError
|
|
23280
23509
|
})
|
|
23281
23510
|
})]
|
|
23282
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
23511
|
+
}), showAuth && /*#__PURE__*/jsxRuntime.jsx(RegistryAuthPrompt, {
|
|
23512
|
+
onAuthenticated: onAuthSuccess,
|
|
23513
|
+
onCancel: onAuthCancel,
|
|
23514
|
+
message: "Sign in to install this widget from the Dash Registry."
|
|
23515
|
+
}), !showAuth && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
23283
23516
|
className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
|
|
23284
23517
|
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
23285
23518
|
title: isInstalled ? "Installed" : isInstalling ? "Installing..." : "Install Package",
|
|
@@ -23294,267 +23527,6 @@ var RegistryPackageDetail = function RegistryPackageDetail(_ref) {
|
|
|
23294
23527
|
});
|
|
23295
23528
|
};
|
|
23296
23529
|
|
|
23297
|
-
/**
|
|
23298
|
-
* useRegistryAuth — reusable hook for device-code OAuth against the Dash Registry.
|
|
23299
|
-
*
|
|
23300
|
-
* Encapsulates the full auth state machine: check status, initiate login,
|
|
23301
|
-
* poll for token, and cancel. Cleans up the poll interval on unmount.
|
|
23302
|
-
*
|
|
23303
|
-
* @returns {{
|
|
23304
|
-
* isAuthenticated: boolean,
|
|
23305
|
-
* isAuthenticating: boolean,
|
|
23306
|
-
* authFlow: { userCode: string, verificationUrlComplete: string } | null,
|
|
23307
|
-
* authError: string | null,
|
|
23308
|
-
* checkAuth: () => Promise<boolean>,
|
|
23309
|
-
* initiateAuth: () => Promise<void>,
|
|
23310
|
-
* cancelAuth: () => void,
|
|
23311
|
-
* }}
|
|
23312
|
-
*/
|
|
23313
|
-
function useRegistryAuth() {
|
|
23314
|
-
var _useState = React.useState(false),
|
|
23315
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
23316
|
-
isAuthenticated = _useState2[0],
|
|
23317
|
-
setIsAuthenticated = _useState2[1];
|
|
23318
|
-
var _useState3 = React.useState(false),
|
|
23319
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
23320
|
-
isAuthenticating = _useState4[0],
|
|
23321
|
-
setIsAuthenticating = _useState4[1];
|
|
23322
|
-
var _useState5 = React.useState(null),
|
|
23323
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
23324
|
-
authFlow = _useState6[0],
|
|
23325
|
-
setAuthFlow = _useState6[1];
|
|
23326
|
-
var _useState7 = React.useState(null),
|
|
23327
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
23328
|
-
authError = _useState8[0],
|
|
23329
|
-
setAuthError = _useState8[1];
|
|
23330
|
-
var pollIntervalRef = React.useRef(null);
|
|
23331
|
-
var onAuthorizedRef = React.useRef(null);
|
|
23332
|
-
|
|
23333
|
-
// Clean up polling on unmount
|
|
23334
|
-
React.useEffect(function () {
|
|
23335
|
-
return function () {
|
|
23336
|
-
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
23337
|
-
};
|
|
23338
|
-
}, []);
|
|
23339
|
-
var checkAuth = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23340
|
-
var status, authed;
|
|
23341
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
23342
|
-
while (1) switch (_context.prev = _context.next) {
|
|
23343
|
-
case 0:
|
|
23344
|
-
_context.prev = 0;
|
|
23345
|
-
_context.next = 1;
|
|
23346
|
-
return window.mainApi.registryAuth.getStatus();
|
|
23347
|
-
case 1:
|
|
23348
|
-
status = _context.sent;
|
|
23349
|
-
authed = !!(status !== null && status !== void 0 && status.authenticated);
|
|
23350
|
-
setIsAuthenticated(authed);
|
|
23351
|
-
return _context.abrupt("return", authed);
|
|
23352
|
-
case 2:
|
|
23353
|
-
_context.prev = 2;
|
|
23354
|
-
_context["catch"](0);
|
|
23355
|
-
return _context.abrupt("return", false);
|
|
23356
|
-
case 3:
|
|
23357
|
-
case "end":
|
|
23358
|
-
return _context.stop();
|
|
23359
|
-
}
|
|
23360
|
-
}, _callee, null, [[0, 2]]);
|
|
23361
|
-
})), []);
|
|
23362
|
-
var cancelAuth = React.useCallback(function () {
|
|
23363
|
-
if (pollIntervalRef.current) {
|
|
23364
|
-
clearInterval(pollIntervalRef.current);
|
|
23365
|
-
pollIntervalRef.current = null;
|
|
23366
|
-
}
|
|
23367
|
-
setIsAuthenticating(false);
|
|
23368
|
-
setAuthFlow(null);
|
|
23369
|
-
}, []);
|
|
23370
|
-
var initiateAuth = React.useCallback(/*#__PURE__*/function () {
|
|
23371
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(onAuthorized) {
|
|
23372
|
-
var flow, interval;
|
|
23373
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
23374
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
23375
|
-
case 0:
|
|
23376
|
-
setAuthError(null);
|
|
23377
|
-
onAuthorizedRef.current = onAuthorized || null;
|
|
23378
|
-
_context3.prev = 1;
|
|
23379
|
-
_context3.next = 2;
|
|
23380
|
-
return window.mainApi.registryAuth.initiateLogin();
|
|
23381
|
-
case 2:
|
|
23382
|
-
flow = _context3.sent;
|
|
23383
|
-
setAuthFlow(flow);
|
|
23384
|
-
if (flow.verificationUrlComplete) {
|
|
23385
|
-
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
23386
|
-
}
|
|
23387
|
-
setIsAuthenticating(true);
|
|
23388
|
-
interval = (flow.interval || 5) * 1000;
|
|
23389
|
-
pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
23390
|
-
var pollResult;
|
|
23391
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
23392
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
23393
|
-
case 0:
|
|
23394
|
-
_context2.prev = 0;
|
|
23395
|
-
_context2.next = 1;
|
|
23396
|
-
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
23397
|
-
case 1:
|
|
23398
|
-
pollResult = _context2.sent;
|
|
23399
|
-
if (pollResult.status === "authorized") {
|
|
23400
|
-
clearInterval(pollIntervalRef.current);
|
|
23401
|
-
pollIntervalRef.current = null;
|
|
23402
|
-
setIsAuthenticating(false);
|
|
23403
|
-
setAuthFlow(null);
|
|
23404
|
-
setIsAuthenticated(true);
|
|
23405
|
-
if (onAuthorizedRef.current) {
|
|
23406
|
-
onAuthorizedRef.current();
|
|
23407
|
-
}
|
|
23408
|
-
} else if (pollResult.status === "expired") {
|
|
23409
|
-
clearInterval(pollIntervalRef.current);
|
|
23410
|
-
pollIntervalRef.current = null;
|
|
23411
|
-
setIsAuthenticating(false);
|
|
23412
|
-
setAuthFlow(null);
|
|
23413
|
-
setAuthError("Authorization expired. Please try again.");
|
|
23414
|
-
}
|
|
23415
|
-
_context2.next = 3;
|
|
23416
|
-
break;
|
|
23417
|
-
case 2:
|
|
23418
|
-
_context2.prev = 2;
|
|
23419
|
-
_context2["catch"](0);
|
|
23420
|
-
clearInterval(pollIntervalRef.current);
|
|
23421
|
-
pollIntervalRef.current = null;
|
|
23422
|
-
setIsAuthenticating(false);
|
|
23423
|
-
case 3:
|
|
23424
|
-
case "end":
|
|
23425
|
-
return _context2.stop();
|
|
23426
|
-
}
|
|
23427
|
-
}, _callee2, null, [[0, 2]]);
|
|
23428
|
-
})), interval);
|
|
23429
|
-
_context3.next = 4;
|
|
23430
|
-
break;
|
|
23431
|
-
case 3:
|
|
23432
|
-
_context3.prev = 3;
|
|
23433
|
-
_context3["catch"](1);
|
|
23434
|
-
setAuthError("Could not reach the registry. Check your connection and try again.");
|
|
23435
|
-
case 4:
|
|
23436
|
-
case "end":
|
|
23437
|
-
return _context3.stop();
|
|
23438
|
-
}
|
|
23439
|
-
}, _callee3, null, [[1, 3]]);
|
|
23440
|
-
}));
|
|
23441
|
-
return function (_x) {
|
|
23442
|
-
return _ref2.apply(this, arguments);
|
|
23443
|
-
};
|
|
23444
|
-
}(), [cancelAuth]);
|
|
23445
|
-
return {
|
|
23446
|
-
isAuthenticated: isAuthenticated,
|
|
23447
|
-
isAuthenticating: isAuthenticating,
|
|
23448
|
-
authFlow: authFlow,
|
|
23449
|
-
authError: authError,
|
|
23450
|
-
checkAuth: checkAuth,
|
|
23451
|
-
initiateAuth: initiateAuth,
|
|
23452
|
-
cancelAuth: cancelAuth
|
|
23453
|
-
};
|
|
23454
|
-
}
|
|
23455
|
-
|
|
23456
|
-
var RegistryAuthPrompt = function RegistryAuthPrompt(_ref) {
|
|
23457
|
-
var onAuthenticated = _ref.onAuthenticated,
|
|
23458
|
-
_ref$onCancel = _ref.onCancel,
|
|
23459
|
-
onCancel = _ref$onCancel === void 0 ? null : _ref$onCancel,
|
|
23460
|
-
_ref$message = _ref.message,
|
|
23461
|
-
message = _ref$message === void 0 ? "Sign in to install from the Dash Registry." : _ref$message;
|
|
23462
|
-
var _useRegistryAuth = useRegistryAuth(),
|
|
23463
|
-
isAuthenticating = _useRegistryAuth.isAuthenticating,
|
|
23464
|
-
authFlow = _useRegistryAuth.authFlow,
|
|
23465
|
-
authError = _useRegistryAuth.authError,
|
|
23466
|
-
checkAuth = _useRegistryAuth.checkAuth,
|
|
23467
|
-
initiateAuth = _useRegistryAuth.initiateAuth,
|
|
23468
|
-
cancelAuth = _useRegistryAuth.cancelAuth;
|
|
23469
|
-
var checkedRef = React.useRef(false);
|
|
23470
|
-
|
|
23471
|
-
// Check auth on mount — if already authenticated, short-circuit
|
|
23472
|
-
React.useEffect(function () {
|
|
23473
|
-
if (checkedRef.current) return;
|
|
23474
|
-
checkedRef.current = true;
|
|
23475
|
-
checkAuth().then(function (authed) {
|
|
23476
|
-
if (authed && onAuthenticated) onAuthenticated();
|
|
23477
|
-
});
|
|
23478
|
-
}, [checkAuth, onAuthenticated]);
|
|
23479
|
-
function handleSignIn() {
|
|
23480
|
-
initiateAuth(function () {
|
|
23481
|
-
if (onAuthenticated) onAuthenticated();
|
|
23482
|
-
});
|
|
23483
|
-
}
|
|
23484
|
-
function handleCancel() {
|
|
23485
|
-
cancelAuth();
|
|
23486
|
-
if (onCancel) onCancel();
|
|
23487
|
-
}
|
|
23488
|
-
|
|
23489
|
-
// Polling state: show user code
|
|
23490
|
-
if (authFlow && isAuthenticating) {
|
|
23491
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
23492
|
-
className: "flex flex-col gap-3 p-4",
|
|
23493
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
23494
|
-
className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
|
|
23495
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
23496
|
-
className: "text-xs text-blue-300/90",
|
|
23497
|
-
children: "Enter this code in your browser:"
|
|
23498
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
23499
|
-
className: "text-center",
|
|
23500
|
-
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
23501
|
-
className: "text-2xl font-mono font-bold tracking-widest text-white",
|
|
23502
|
-
children: authFlow.userCode
|
|
23503
|
-
})
|
|
23504
|
-
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
23505
|
-
className: "text-xs text-blue-300/70 text-center",
|
|
23506
|
-
children: "Waiting for authorization \u2014 install will resume automatically..."
|
|
23507
|
-
})]
|
|
23508
|
-
}), onCancel && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
23509
|
-
type: "button",
|
|
23510
|
-
onClick: handleCancel,
|
|
23511
|
-
className: "self-center text-xs text-gray-500 hover:text-gray-300 transition-colors",
|
|
23512
|
-
children: "Cancel"
|
|
23513
|
-
})]
|
|
23514
|
-
});
|
|
23515
|
-
}
|
|
23516
|
-
|
|
23517
|
-
// Default: not-started / error state
|
|
23518
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
23519
|
-
className: "flex flex-col gap-3 p-4",
|
|
23520
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
23521
|
-
className: "bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",
|
|
23522
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
23523
|
-
className: "flex items-start gap-2",
|
|
23524
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
23525
|
-
icon: "lock",
|
|
23526
|
-
className: "h-3.5 w-3.5 text-yellow-400 mt-0.5 flex-shrink-0"
|
|
23527
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
23528
|
-
className: "text-sm text-yellow-300/90",
|
|
23529
|
-
children: message
|
|
23530
|
-
})]
|
|
23531
|
-
})
|
|
23532
|
-
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
23533
|
-
type: "button",
|
|
23534
|
-
onClick: handleSignIn,
|
|
23535
|
-
className: "px-4 py-2 rounded-lg text-sm bg-blue-500/20 border border-blue-500/30 text-blue-300 hover:bg-blue-500/30 transition-colors cursor-pointer",
|
|
23536
|
-
children: "Sign in to Registry"
|
|
23537
|
-
}), authError && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
23538
|
-
className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
|
|
23539
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
23540
|
-
className: "flex items-start gap-2",
|
|
23541
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
23542
|
-
icon: "circle-xmark",
|
|
23543
|
-
className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
|
|
23544
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
23545
|
-
className: "text-xs text-red-300/90",
|
|
23546
|
-
children: authError
|
|
23547
|
-
})]
|
|
23548
|
-
})
|
|
23549
|
-
}), onCancel && /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
23550
|
-
type: "button",
|
|
23551
|
-
onClick: handleCancel,
|
|
23552
|
-
className: "self-center text-xs text-gray-500 hover:text-gray-300 transition-colors",
|
|
23553
|
-
children: "Cancel"
|
|
23554
|
-
})]
|
|
23555
|
-
});
|
|
23556
|
-
};
|
|
23557
|
-
|
|
23558
23530
|
function getWidgetSearchQuery(componentKey) {
|
|
23559
23531
|
var parts = componentKey.split(".");
|
|
23560
23532
|
if (parts.length >= 3) {
|
|
@@ -44650,6 +44622,8 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
|
|
|
44650
44622
|
setSearchQuery = _useRegistrySearch.setSearchQuery,
|
|
44651
44623
|
isInstalling = _useRegistrySearch.isInstalling,
|
|
44652
44624
|
installError = _useRegistrySearch.installError,
|
|
44625
|
+
needsAuth = _useRegistrySearch.needsAuth,
|
|
44626
|
+
clearNeedsAuth = _useRegistrySearch.clearNeedsAuth,
|
|
44653
44627
|
installPackage = _useRegistrySearch.installPackage,
|
|
44654
44628
|
retry = _useRegistrySearch.retry,
|
|
44655
44629
|
showAllPackages = _useRegistrySearch.showAllPackages,
|
|
@@ -44850,7 +44824,13 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
|
|
|
44850
44824
|
installError: installError,
|
|
44851
44825
|
isInstalled: selectedWidget ? isPackageInstalled(packages.find(function (p) {
|
|
44852
44826
|
return p.name === selectedPackageName;
|
|
44853
|
-
}) || {}) : false
|
|
44827
|
+
}) || {}) : false,
|
|
44828
|
+
showAuth: needsAuth,
|
|
44829
|
+
onAuthSuccess: function onAuthSuccess() {
|
|
44830
|
+
clearNeedsAuth();
|
|
44831
|
+
installPackage(selectedWidget);
|
|
44832
|
+
},
|
|
44833
|
+
onAuthCancel: clearNeedsAuth
|
|
44854
44834
|
})]
|
|
44855
44835
|
});
|
|
44856
44836
|
}
|
|
@@ -48109,6 +48089,10 @@ var SidebarDiscoverContent = function SidebarDiscoverContent(_ref2) {
|
|
|
48109
48089
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48110
48090
|
selectedPackageName = _useState2[0],
|
|
48111
48091
|
setSelectedPackageName = _useState2[1];
|
|
48092
|
+
var _useState3 = React.useState(null),
|
|
48093
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48094
|
+
pendingInstallPkg = _useState4[0],
|
|
48095
|
+
setPendingInstallPkg = _useState4[1];
|
|
48112
48096
|
|
|
48113
48097
|
// Check if a package is installed by name or scope/name
|
|
48114
48098
|
var isPackageInstalled = React.useCallback(function (pkg) {
|
|
@@ -48153,19 +48137,22 @@ var SidebarDiscoverContent = function SidebarDiscoverContent(_ref2) {
|
|
|
48153
48137
|
}
|
|
48154
48138
|
return _context.abrupt("return");
|
|
48155
48139
|
case 1:
|
|
48140
|
+
setPendingInstallPkg(pkg);
|
|
48156
48141
|
installable = {
|
|
48157
48142
|
isRegistry: true,
|
|
48158
48143
|
packageName: pkg.name,
|
|
48144
|
+
packageScope: pkg.scope || null,
|
|
48159
48145
|
downloadUrl: pkg.downloadUrl || "",
|
|
48160
48146
|
packageVersion: pkg.version || ""
|
|
48161
48147
|
};
|
|
48162
48148
|
_context.next = 2;
|
|
48163
48149
|
return registry.installPackage(installable);
|
|
48164
48150
|
case 2:
|
|
48165
|
-
// If no install error, signal success
|
|
48166
|
-
if (!registry.installError) {
|
|
48151
|
+
// If no install error and no auth needed, signal success
|
|
48152
|
+
if (!registry.installError && !registry.needsAuth) {
|
|
48167
48153
|
onInstallSuccess(pkg.displayName || pkg.name);
|
|
48168
48154
|
setSelectedPackageName(null);
|
|
48155
|
+
setPendingInstallPkg(null);
|
|
48169
48156
|
}
|
|
48170
48157
|
case 3:
|
|
48171
48158
|
case "end":
|
|
@@ -48260,8 +48247,21 @@ var SidebarDiscoverContent = function SidebarDiscoverContent(_ref2) {
|
|
|
48260
48247
|
}), registry.installError && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48261
48248
|
className: "text-xs text-red-400 bg-red-500/10 rounded px-2 py-1.5 mb-3",
|
|
48262
48249
|
children: registry.installError
|
|
48250
|
+
}), registry.needsAuth && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48251
|
+
className: "mb-3",
|
|
48252
|
+
children: /*#__PURE__*/jsxRuntime.jsx(RegistryAuthPrompt, {
|
|
48253
|
+
onAuthenticated: function onAuthenticated() {
|
|
48254
|
+
registry.clearNeedsAuth();
|
|
48255
|
+
if (pendingInstallPkg) handleInstall(pendingInstallPkg);
|
|
48256
|
+
},
|
|
48257
|
+
onCancel: function onCancel() {
|
|
48258
|
+
registry.clearNeedsAuth();
|
|
48259
|
+
setPendingInstallPkg(null);
|
|
48260
|
+
},
|
|
48261
|
+
message: "Sign in to install this widget from the Dash Registry."
|
|
48262
|
+
})
|
|
48263
48263
|
})]
|
|
48264
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48264
|
+
}), !registry.needsAuth && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48265
48265
|
className: "px-3 py-2 flex-shrink-0",
|
|
48266
48266
|
children: /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
48267
48267
|
type: "button",
|
|
@@ -48389,45 +48389,45 @@ var WidgetSidebar = function WidgetSidebar(_ref4) {
|
|
|
48389
48389
|
currentTheme = _useContext.currentTheme;
|
|
48390
48390
|
|
|
48391
48391
|
// Tab state
|
|
48392
|
-
var
|
|
48393
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
48394
|
-
activeTab = _useState4[0],
|
|
48395
|
-
setActiveTab = _useState4[1]; // "installed" | "discover"
|
|
48396
|
-
var _useState5 = React.useState(null),
|
|
48392
|
+
var _useState5 = React.useState("installed"),
|
|
48397
48393
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
48398
|
-
|
|
48399
|
-
|
|
48394
|
+
activeTab = _useState6[0],
|
|
48395
|
+
setActiveTab = _useState6[1]; // "installed" | "discover"
|
|
48396
|
+
var _useState7 = React.useState(null),
|
|
48397
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
48398
|
+
installSuccess = _useState8[0],
|
|
48399
|
+
setInstallSuccess = _useState8[1];
|
|
48400
48400
|
|
|
48401
48401
|
// Registry hook (only active when discover tab is shown)
|
|
48402
48402
|
var registry = useRegistrySearch();
|
|
48403
48403
|
|
|
48404
48404
|
// Filter state
|
|
48405
|
-
var
|
|
48406
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
48407
|
-
searchQuery = _useState8[0],
|
|
48408
|
-
setSearchQuery = _useState8[1];
|
|
48409
|
-
var _useState9 = React.useState("all"),
|
|
48405
|
+
var _useState9 = React.useState(""),
|
|
48410
48406
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
48411
|
-
|
|
48412
|
-
|
|
48407
|
+
searchQuery = _useState0[0],
|
|
48408
|
+
setSearchQuery = _useState0[1];
|
|
48413
48409
|
var _useState1 = React.useState("all"),
|
|
48414
48410
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
48415
|
-
|
|
48416
|
-
|
|
48411
|
+
filterAuthor = _useState10[0],
|
|
48412
|
+
setFilterAuthor = _useState10[1];
|
|
48417
48413
|
var _useState11 = React.useState("all"),
|
|
48418
48414
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
48419
|
-
|
|
48420
|
-
|
|
48415
|
+
filterProvider = _useState12[0],
|
|
48416
|
+
setFilterProvider = _useState12[1];
|
|
48421
48417
|
var _useState13 = React.useState("all"),
|
|
48422
48418
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
48423
|
-
|
|
48424
|
-
|
|
48419
|
+
filterHasEvents = _useState14[0],
|
|
48420
|
+
setFilterHasEvents = _useState14[1];
|
|
48421
|
+
var _useState15 = React.useState("all"),
|
|
48422
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
48423
|
+
filterHasHandlers = _useState16[0],
|
|
48424
|
+
setFilterHasHandlers = _useState16[1];
|
|
48425
48425
|
|
|
48426
48426
|
// Counter to trigger re-computation when installed widgets change
|
|
48427
|
-
var
|
|
48428
|
-
|
|
48429
|
-
widgetVersion =
|
|
48430
|
-
setWidgetVersion =
|
|
48427
|
+
var _useState17 = React.useState(0),
|
|
48428
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
48429
|
+
widgetVersion = _useState18[0],
|
|
48430
|
+
setWidgetVersion = _useState18[1];
|
|
48431
48431
|
React.useEffect(function () {
|
|
48432
48432
|
var handleWidgetsUpdated = function handleWidgetsUpdated() {
|
|
48433
48433
|
return setWidgetVersion(function (v) {
|
|
@@ -48455,10 +48455,10 @@ var WidgetSidebar = function WidgetSidebar(_ref4) {
|
|
|
48455
48455
|
|
|
48456
48456
|
// Set of installed package identifiers for "Installed" badge in Discover tab.
|
|
48457
48457
|
// Stores folder names, package names, and "author/name" keys for matching.
|
|
48458
|
-
var
|
|
48459
|
-
|
|
48460
|
-
installedPackageNames =
|
|
48461
|
-
setInstalledPackageNames =
|
|
48458
|
+
var _useState19 = React.useState(new Set()),
|
|
48459
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
48460
|
+
installedPackageNames = _useState20[0],
|
|
48461
|
+
setInstalledPackageNames = _useState20[1];
|
|
48462
48462
|
React.useEffect(function () {
|
|
48463
48463
|
var cancelled = false;
|
|
48464
48464
|
var loadInstalled = /*#__PURE__*/function () {
|