@trops/dash-core 0.1.596 → 0.1.598

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -54601,6 +54601,413 @@ var DashboardLoaderModal = function DashboardLoaderModal(_ref) {
54601
54601
  });
54602
54602
  };
54603
54603
 
54604
+ var KITCHEN_SINK_PACKAGE = "trops/kitchen-sink";
54605
+ var STATE = {
54606
+ WELCOME: "welcome",
54607
+ INSTALLING: "installing",
54608
+ DONE: "done",
54609
+ ERROR: "error"
54610
+ };
54611
+ var OnboardingModal = function OnboardingModal(_ref) {
54612
+ var open = _ref.open,
54613
+ appId = _ref.appId,
54614
+ onOpenDashboard = _ref.onOpenDashboard,
54615
+ onDismiss = _ref.onDismiss,
54616
+ onComplete = _ref.onComplete;
54617
+ var _ref2 = React.useContext(DashReact.ThemeContext) || {},
54618
+ currentTheme = _ref2.currentTheme;
54619
+ var _useState = React.useState(STATE.WELCOME),
54620
+ _useState2 = _slicedToArray(_useState, 2),
54621
+ state = _useState2[0],
54622
+ setState = _useState2[1];
54623
+ var _useState3 = React.useState([]),
54624
+ _useState4 = _slicedToArray(_useState3, 2),
54625
+ progressItems = _useState4[0],
54626
+ setProgressItems = _useState4[1];
54627
+ var _useState5 = React.useState(null),
54628
+ _useState6 = _slicedToArray(_useState5, 2),
54629
+ installError = _useState6[0],
54630
+ setInstallError = _useState6[1];
54631
+ var installResultRef = React.useRef(null);
54632
+ var cleanupProgressRef = React.useRef(null);
54633
+ React.useEffect(function () {
54634
+ if (open) {
54635
+ setState(STATE.WELCOME);
54636
+ setProgressItems([]);
54637
+ setInstallError(null);
54638
+ installResultRef.current = null;
54639
+ }
54640
+ return function () {
54641
+ if (cleanupProgressRef.current) {
54642
+ cleanupProgressRef.current();
54643
+ cleanupProgressRef.current = null;
54644
+ }
54645
+ };
54646
+ }, [open]);
54647
+ var markCompletedAndClose = React.useCallback(/*#__PURE__*/function () {
54648
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(source) {
54649
+ var _window$mainApi, _window$mainApi$markC;
54650
+ return _regeneratorRuntime.wrap(function (_context) {
54651
+ while (1) switch (_context.prev = _context.next) {
54652
+ case 0:
54653
+ _context.prev = 0;
54654
+ _context.next = 1;
54655
+ return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.onboarding) === null || _window$mainApi === void 0 || (_window$mainApi$markC = _window$mainApi.markCompleted) === null || _window$mainApi$markC === void 0 ? void 0 : _window$mainApi$markC.call(_window$mainApi, {
54656
+ source: source
54657
+ });
54658
+ case 1:
54659
+ _context.next = 3;
54660
+ break;
54661
+ case 2:
54662
+ _context.prev = 2;
54663
+ _context["catch"](0);
54664
+ case 3:
54665
+ if (onComplete) onComplete({
54666
+ source: source
54667
+ });
54668
+ case 4:
54669
+ case "end":
54670
+ return _context.stop();
54671
+ }
54672
+ }, _callee, null, [[0, 2]]);
54673
+ }));
54674
+ return function (_x) {
54675
+ return _ref3.apply(this, arguments);
54676
+ };
54677
+ }(), [onComplete]);
54678
+ var handleSkip = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
54679
+ return _regeneratorRuntime.wrap(function (_context2) {
54680
+ while (1) switch (_context2.prev = _context2.next) {
54681
+ case 0:
54682
+ _context2.next = 1;
54683
+ return markCompletedAndClose("dismissed");
54684
+ case 1:
54685
+ if (onDismiss) onDismiss();
54686
+ case 2:
54687
+ case "end":
54688
+ return _context2.stop();
54689
+ }
54690
+ }, _callee2);
54691
+ })), [markCompletedAndClose, onDismiss]);
54692
+ var handleInstall = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
54693
+ var _window$mainApi2, _window$mainApi2$onIn;
54694
+ var _window$mainApi3, _window$mainApi3$inst, result, _t2;
54695
+ return _regeneratorRuntime.wrap(function (_context3) {
54696
+ while (1) switch (_context3.prev = _context3.next) {
54697
+ case 0:
54698
+ if (appId) {
54699
+ _context3.next = 1;
54700
+ break;
54701
+ }
54702
+ setInstallError("Cannot install — application not initialized. Try again in a moment.");
54703
+ setState(STATE.ERROR);
54704
+ return _context3.abrupt("return");
54705
+ case 1:
54706
+ setState(STATE.INSTALLING);
54707
+ setProgressItems([]);
54708
+ setInstallError(null);
54709
+ if (cleanupProgressRef.current) cleanupProgressRef.current();
54710
+ cleanupProgressRef.current = (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.dashboardConfig) === null || _window$mainApi2 === void 0 || (_window$mainApi2$onIn = _window$mainApi2.onInstallProgress) === null || _window$mainApi2$onIn === void 0 ? void 0 : _window$mainApi2$onIn.call(_window$mainApi2, function (data) {
54711
+ setProgressItems(function (prev) {
54712
+ var next = prev.length > 0 ? _toConsumableArray(prev) : [];
54713
+ if (next.length === 0 && typeof data.total === "number") {
54714
+ for (var i = 0; i < data.total; i += 1) {
54715
+ next.push({
54716
+ packageName: i === data.index ? data.packageName : "",
54717
+ displayName: i === data.index ? data.displayName : "",
54718
+ status: "pending"
54719
+ });
54720
+ }
54721
+ }
54722
+ if (typeof data.index === "number" && data.index >= 0 && data.index < next.length) {
54723
+ next[data.index] = {
54724
+ packageName: data.packageName || next[data.index].packageName,
54725
+ displayName: data.displayName || next[data.index].displayName || data.packageName || "",
54726
+ status: data.status || next[data.index].status,
54727
+ error: data.error || null
54728
+ };
54729
+ }
54730
+ return next;
54731
+ });
54732
+ });
54733
+ _context3.prev = 2;
54734
+ _context3.next = 3;
54735
+ return (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.dashboardConfig) === null || _window$mainApi3 === void 0 || (_window$mainApi3$inst = _window$mainApi3.installDashboardFromRegistry) === null || _window$mainApi3$inst === void 0 ? void 0 : _window$mainApi3$inst.call(_window$mainApi3, appId, KITCHEN_SINK_PACKAGE, {});
54736
+ case 3:
54737
+ result = _context3.sent;
54738
+ if (cleanupProgressRef.current) {
54739
+ cleanupProgressRef.current();
54740
+ cleanupProgressRef.current = null;
54741
+ }
54742
+ if (!(!result || !result.success)) {
54743
+ _context3.next = 4;
54744
+ break;
54745
+ }
54746
+ setInstallError((result === null || result === void 0 ? void 0 : result.error) || "Failed to install Kitchen Sink. Check your internet connection and try again.");
54747
+ setState(STATE.ERROR);
54748
+ return _context3.abrupt("return");
54749
+ case 4:
54750
+ installResultRef.current = result;
54751
+ setState(STATE.DONE);
54752
+ _context3.next = 6;
54753
+ break;
54754
+ case 5:
54755
+ _context3.prev = 5;
54756
+ _t2 = _context3["catch"](2);
54757
+ if (cleanupProgressRef.current) {
54758
+ cleanupProgressRef.current();
54759
+ cleanupProgressRef.current = null;
54760
+ }
54761
+ setInstallError((_t2 === null || _t2 === void 0 ? void 0 : _t2.message) || "Installation failed.");
54762
+ setState(STATE.ERROR);
54763
+ case 6:
54764
+ case "end":
54765
+ return _context3.stop();
54766
+ }
54767
+ }, _callee3, null, [[2, 5]]);
54768
+ })), [appId]);
54769
+ var handleOpen = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
54770
+ var _installResultRef$cur;
54771
+ var workspace;
54772
+ return _regeneratorRuntime.wrap(function (_context4) {
54773
+ while (1) switch (_context4.prev = _context4.next) {
54774
+ case 0:
54775
+ workspace = ((_installResultRef$cur = installResultRef.current) === null || _installResultRef$cur === void 0 ? void 0 : _installResultRef$cur.workspace) || null;
54776
+ _context4.next = 1;
54777
+ return markCompletedAndClose("kitchen-sink");
54778
+ case 1:
54779
+ if (workspace && onOpenDashboard) {
54780
+ onOpenDashboard(workspace);
54781
+ }
54782
+ case 2:
54783
+ case "end":
54784
+ return _context4.stop();
54785
+ }
54786
+ }, _callee4);
54787
+ })), [markCompletedAndClose, onOpenDashboard]);
54788
+ var handleRetry = React.useCallback(function () {
54789
+ setInstallError(null);
54790
+ handleInstall();
54791
+ }, [handleInstall]);
54792
+
54793
+ // The Modal dispatches setIsOpen(false) on Escape / backdrop click.
54794
+ // Route any close attempt through handleSkip so the completion flag
54795
+ // is always stamped (otherwise Escape would silently re-show the
54796
+ // modal on the next launch).
54797
+ var handleSetIsOpen = React.useCallback(function (next) {
54798
+ if (next === false) handleSkip();
54799
+ }, [handleSkip]);
54800
+ var bgPanel = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-medium"]) || "bg-gray-900";
54801
+ var textPrimary = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-light"]) || "text-gray-100";
54802
+ var textMuted = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || "text-gray-400";
54803
+ var borderPanel = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["border-primary-medium"]) || "border-gray-700";
54804
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
54805
+ isOpen: open,
54806
+ setIsOpen: handleSetIsOpen,
54807
+ width: "w-full max-w-2xl",
54808
+ height: "h-auto",
54809
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
54810
+ className: "flex flex-col ".concat(bgPanel, " ").concat(textPrimary, " rounded-lg overflow-hidden p-8"),
54811
+ "data-testid": "onboarding-modal",
54812
+ children: [state === STATE.WELCOME && /*#__PURE__*/jsxRuntime.jsx(WelcomeBody, {
54813
+ onInstall: handleInstall,
54814
+ onSkip: handleSkip,
54815
+ textMuted: textMuted
54816
+ }), state === STATE.INSTALLING && /*#__PURE__*/jsxRuntime.jsx(InstallingBody, {
54817
+ items: progressItems,
54818
+ borderPanel: borderPanel,
54819
+ textMuted: textMuted
54820
+ }), state === STATE.DONE && /*#__PURE__*/jsxRuntime.jsx(DoneBody, {
54821
+ onOpen: handleOpen,
54822
+ textMuted: textMuted
54823
+ }), state === STATE.ERROR && /*#__PURE__*/jsxRuntime.jsx(ErrorBody, {
54824
+ message: installError,
54825
+ onRetry: handleRetry,
54826
+ onSkip: handleSkip,
54827
+ textMuted: textMuted
54828
+ })]
54829
+ })
54830
+ });
54831
+ };
54832
+ function WelcomeBody(_ref7) {
54833
+ var onInstall = _ref7.onInstall,
54834
+ onSkip = _ref7.onSkip,
54835
+ textMuted = _ref7.textMuted;
54836
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54837
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
54838
+ className: "flex items-center gap-3 mb-2",
54839
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
54840
+ icon: "sink",
54841
+ className: "text-2xl"
54842
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Heading2, {
54843
+ title: "Welcome to Dash"
54844
+ })]
54845
+ }), /*#__PURE__*/jsxRuntime.jsxs(DashReact.Paragraph, {
54846
+ className: "".concat(textMuted, " mb-6"),
54847
+ children: ["Get started with the ", /*#__PURE__*/jsxRuntime.jsx("strong", {
54848
+ children: "Kitchen Sink"
54849
+ }), " dashboard \u2014 a curated set of widgets that shows what Dash can do. You can swap anything out, or build your own from scratch later."]
54850
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
54851
+ className: "flex items-center justify-end gap-3 mt-2",
54852
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
54853
+ onClick: onSkip,
54854
+ title: "Skip for now",
54855
+ textSize: "text-sm",
54856
+ padding: "py-2 px-4",
54857
+ backgroundColor: "bg-gray-700",
54858
+ textColor: "text-gray-300",
54859
+ hoverTextColor: "hover:text-white",
54860
+ hoverBackgroundColor: "hover:bg-gray-600",
54861
+ "data-testid": "onboarding-skip-button"
54862
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
54863
+ onClick: onInstall,
54864
+ title: "Install Kitchen Sink",
54865
+ textSize: "text-sm",
54866
+ padding: "py-2 px-4",
54867
+ backgroundColor: "bg-blue-600",
54868
+ textColor: "text-white",
54869
+ hoverTextColor: "hover:text-white",
54870
+ hoverBackgroundColor: "hover:bg-blue-500",
54871
+ icon: "download",
54872
+ "data-testid": "onboarding-install-button"
54873
+ })]
54874
+ })]
54875
+ });
54876
+ }
54877
+ function InstallingBody(_ref8) {
54878
+ var items = _ref8.items,
54879
+ borderPanel = _ref8.borderPanel,
54880
+ textMuted = _ref8.textMuted;
54881
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54882
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SubHeading, {
54883
+ title: "Installing Kitchen Sink\u2026"
54884
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Paragraph, {
54885
+ className: "".concat(textMuted, " mt-2 mb-4"),
54886
+ children: "Downloading widgets, theme, and dashboard configuration from the registry. This usually takes a few seconds."
54887
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
54888
+ className: "border ".concat(borderPanel, " rounded-md max-h-64 overflow-y-auto"),
54889
+ "data-testid": "onboarding-progress-list",
54890
+ children: [items.length === 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
54891
+ className: "p-3 ".concat(textMuted),
54892
+ children: "Starting install\u2026"
54893
+ }), items.map(function (item, idx) {
54894
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
54895
+ className: "flex items-center justify-between px-3 py-2",
54896
+ "data-status": item.status,
54897
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
54898
+ className: "truncate",
54899
+ children: item.displayName || item.packageName || "Item ".concat(idx + 1)
54900
+ }), /*#__PURE__*/jsxRuntime.jsx(StatusBadge, {
54901
+ status: item.status
54902
+ })]
54903
+ }, "".concat(item.packageName || "slot", "-").concat(idx));
54904
+ })]
54905
+ })]
54906
+ });
54907
+ }
54908
+ function StatusBadge(_ref9) {
54909
+ var status = _ref9.status;
54910
+ switch (status) {
54911
+ case "installed":
54912
+ case "already-installed":
54913
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
54914
+ icon: "check",
54915
+ className: "text-green-500",
54916
+ "data-testid": "status-installed"
54917
+ });
54918
+ case "failed":
54919
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
54920
+ icon: "xmark",
54921
+ className: "text-red-500",
54922
+ "data-testid": "status-failed"
54923
+ });
54924
+ case "downloading":
54925
+ case "pending":
54926
+ default:
54927
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
54928
+ icon: "circle-notch",
54929
+ className: "animate-spin",
54930
+ "data-testid": "status-".concat(status || "pending")
54931
+ });
54932
+ }
54933
+ }
54934
+ function DoneBody(_ref0) {
54935
+ var onOpen = _ref0.onOpen,
54936
+ textMuted = _ref0.textMuted;
54937
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54938
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
54939
+ className: "flex items-center gap-3 mb-2",
54940
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
54941
+ icon: "check",
54942
+ className: "text-2xl text-green-500"
54943
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Heading2, {
54944
+ title: "Kitchen Sink Installed"
54945
+ })]
54946
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Paragraph, {
54947
+ className: "".concat(textMuted, " mb-6"),
54948
+ children: "Your first dashboard is ready. Open it to explore \u2014 every widget and the theme are now installed locally."
54949
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
54950
+ className: "flex items-center justify-end",
54951
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
54952
+ onClick: onOpen,
54953
+ title: "Open Kitchen Sink",
54954
+ textSize: "text-sm",
54955
+ padding: "py-2 px-4",
54956
+ backgroundColor: "bg-green-600",
54957
+ textColor: "text-white",
54958
+ hoverTextColor: "hover:text-white",
54959
+ hoverBackgroundColor: "hover:bg-green-500",
54960
+ icon: "arrow-right",
54961
+ "data-testid": "onboarding-open-button"
54962
+ })
54963
+ })]
54964
+ });
54965
+ }
54966
+ function ErrorBody(_ref1) {
54967
+ var message = _ref1.message,
54968
+ onRetry = _ref1.onRetry,
54969
+ onSkip = _ref1.onSkip,
54970
+ textMuted = _ref1.textMuted;
54971
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54972
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
54973
+ className: "flex items-center gap-3 mb-2",
54974
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
54975
+ icon: "triangle-exclamation",
54976
+ className: "text-2xl text-red-500"
54977
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Heading2, {
54978
+ title: "Install Failed"
54979
+ })]
54980
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Paragraph, {
54981
+ className: "".concat(textMuted, " mb-6"),
54982
+ children: message || "Something went wrong installing Kitchen Sink."
54983
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
54984
+ className: "flex items-center justify-end gap-3",
54985
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
54986
+ onClick: onSkip,
54987
+ title: "Skip for now",
54988
+ textSize: "text-sm",
54989
+ padding: "py-2 px-4",
54990
+ backgroundColor: "bg-gray-700",
54991
+ textColor: "text-gray-300",
54992
+ hoverTextColor: "hover:text-white",
54993
+ hoverBackgroundColor: "hover:bg-gray-600",
54994
+ "data-testid": "onboarding-skip-after-error-button"
54995
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
54996
+ onClick: onRetry,
54997
+ title: "Try again",
54998
+ textSize: "text-sm",
54999
+ padding: "py-2 px-4",
55000
+ backgroundColor: "bg-blue-600",
55001
+ textColor: "text-white",
55002
+ hoverTextColor: "hover:text-white",
55003
+ hoverBackgroundColor: "hover:bg-blue-500",
55004
+ icon: "rotate-right",
55005
+ "data-testid": "onboarding-retry-button"
55006
+ })]
55007
+ })]
55008
+ });
55009
+ }
55010
+
54604
55011
  var DashCommandPalette = function DashCommandPalette(_ref) {
54605
55012
  var isOpen = _ref.isOpen,
54606
55013
  setIsOpen = _ref.setIsOpen,
@@ -60409,64 +60816,75 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60409
60816
  isWizardOpen = _useState36[0],
60410
60817
  setIsWizardOpen = _useState36[1];
60411
60818
 
60819
+ // First-run onboarding (Phase 3A). Tri-state:
60820
+ // null — status not yet loaded from main; do not render anything
60821
+ // true — show the OnboardingModal
60822
+ // false — onboarding already completed (or app is not first-run)
60823
+ // The status read happens once per mount; subsequent dismiss/complete
60824
+ // flips this to false without re-fetching.
60825
+ var _useState37 = React.useState(null),
60826
+ _useState38 = _slicedToArray(_useState37, 2),
60827
+ isOnboardingOpen = _useState38[0],
60828
+ setIsOnboardingOpen = _useState38[1];
60829
+
60412
60830
  // Missing widgets detection
60413
60831
  var _useMissingWidgets = useMissingWidgets(workspaceSelected),
60414
60832
  missingComponents = _useMissingWidgets.missingComponents,
60415
60833
  hasMissing = _useMissingWidgets.hasMissing;
60416
- var _useState37 = React.useState(false),
60417
- _useState38 = _slicedToArray(_useState37, 2),
60418
- isMissingWidgetsModalOpen = _useState38[0],
60419
- setIsMissingWidgetsModalOpen = _useState38[1];
60420
- var _useState39 = React.useState(new Set()),
60834
+ var _useState39 = React.useState(false),
60421
60835
  _useState40 = _slicedToArray(_useState39, 2),
60422
- dismissedMissingForWorkspace = _useState40[0],
60423
- setDismissedMissingForWorkspace = _useState40[1];
60836
+ isMissingWidgetsModalOpen = _useState40[0],
60837
+ setIsMissingWidgetsModalOpen = _useState40[1];
60838
+ var _useState41 = React.useState(new Set()),
60839
+ _useState42 = _slicedToArray(_useState41, 2),
60840
+ dismissedMissingForWorkspace = _useState42[0],
60841
+ setDismissedMissingForWorkspace = _useState42[1];
60424
60842
 
60425
60843
  // Dashboard Config modal — bulk provider wiring for the current
60426
60844
  // workspace. Auto-opens on first load of a workspace with unresolved
60427
60845
  // providers (tracked per session via `configModalAutoOpenedFor` so
60428
60846
  // switching tabs doesn't re-fire the modal).
60429
- var _useState41 = React.useState(false),
60430
- _useState42 = _slicedToArray(_useState41, 2),
60431
- isConfigModalOpen = _useState42[0],
60432
- setIsConfigModalOpen = _useState42[1];
60433
- React.useRef(new Set());
60434
- var _useState43 = React.useState(new Set()),
60847
+ var _useState43 = React.useState(false),
60435
60848
  _useState44 = _slicedToArray(_useState43, 2),
60436
- dismissedUnresolvedForWorkspace = _useState44[0],
60437
- setDismissedUnresolvedForWorkspace = _useState44[1];
60849
+ isConfigModalOpen = _useState44[0],
60850
+ setIsConfigModalOpen = _useState44[1];
60851
+ React.useRef(new Set());
60852
+ var _useState45 = React.useState(new Set()),
60853
+ _useState46 = _slicedToArray(_useState45, 2),
60854
+ dismissedUnresolvedForWorkspace = _useState46[0],
60855
+ setDismissedUnresolvedForWorkspace = _useState46[1];
60438
60856
 
60439
60857
  // Unified App Settings Modal
60440
- var _useState45 = React.useState(false),
60441
- _useState46 = _slicedToArray(_useState45, 2),
60442
- isAppSettingsOpen = _useState46[0],
60443
- setIsAppSettingsOpen = _useState46[1];
60444
- var _useState47 = React.useState("dashboards"),
60858
+ var _useState47 = React.useState(false),
60445
60859
  _useState48 = _slicedToArray(_useState47, 2),
60446
- appSettingsInitialSection = _useState48[0],
60447
- setAppSettingsInitialSection = _useState48[1];
60448
- var _useState49 = React.useState(null),
60860
+ isAppSettingsOpen = _useState48[0],
60861
+ setIsAppSettingsOpen = _useState48[1];
60862
+ var _useState49 = React.useState("dashboards"),
60449
60863
  _useState50 = _slicedToArray(_useState49, 2),
60450
- appSettingsInitialProvider = _useState50[0],
60451
- setAppSettingsInitialProvider = _useState50[1];
60452
- var _useState51 = React.useState(false),
60864
+ appSettingsInitialSection = _useState50[0],
60865
+ setAppSettingsInitialSection = _useState50[1];
60866
+ var _useState51 = React.useState(null),
60453
60867
  _useState52 = _slicedToArray(_useState51, 2),
60454
- appSettingsCreateProvider = _useState52[0],
60455
- setAppSettingsCreateProvider = _useState52[1];
60868
+ appSettingsInitialProvider = _useState52[0],
60869
+ setAppSettingsInitialProvider = _useState52[1];
60870
+ var _useState53 = React.useState(false),
60871
+ _useState54 = _slicedToArray(_useState53, 2),
60872
+ appSettingsCreateProvider = _useState54[0],
60873
+ setAppSettingsCreateProvider = _useState54[1];
60456
60874
  // Optional pre-fills used by the cross-modal "Add new <type>"
60457
60875
  // flow dispatched from dash-electron's WidgetBuilderModal.
60458
60876
  // initialProviderType is the type id (e.g. "filesystem", "slack").
60459
60877
  // initialProviderClass routes the create flow: "mcp" opens the
60460
60878
  // catalog detail with that type pre-selected; otherwise opens
60461
60879
  // the credential create form with formType pre-filled.
60462
- var _useState53 = React.useState(null),
60463
- _useState54 = _slicedToArray(_useState53, 2),
60464
- appSettingsInitialProviderType = _useState54[0],
60465
- setAppSettingsInitialProviderType = _useState54[1];
60466
60880
  var _useState55 = React.useState(null),
60467
60881
  _useState56 = _slicedToArray(_useState55, 2),
60468
- appSettingsInitialProviderClass = _useState56[0],
60469
- setAppSettingsInitialProviderClass = _useState56[1];
60882
+ appSettingsInitialProviderType = _useState56[0],
60883
+ setAppSettingsInitialProviderType = _useState56[1];
60884
+ var _useState57 = React.useState(null),
60885
+ _useState58 = _slicedToArray(_useState57, 2),
60886
+ appSettingsInitialProviderClass = _useState58[0],
60887
+ setAppSettingsInitialProviderClass = _useState58[1];
60470
60888
  function openAppSettings() {
60471
60889
  var section = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "general";
60472
60890
  var providerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -60484,27 +60902,27 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60484
60902
  return _handleProfileUpdated.apply(this, arguments);
60485
60903
  } // Ref to access LayoutBuilder's current workspace without re-render cascades
60486
60904
  function _handleProfileUpdated() {
60487
- _handleProfileUpdated = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
60488
- var _window$mainApi11, profile;
60489
- return _regeneratorRuntime.wrap(function (_context2) {
60490
- while (1) switch (_context2.prev = _context2.next) {
60905
+ _handleProfileUpdated = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
60906
+ var _window$mainApi12, profile;
60907
+ return _regeneratorRuntime.wrap(function (_context3) {
60908
+ while (1) switch (_context3.prev = _context3.next) {
60491
60909
  case 0:
60492
- _context2.prev = 0;
60493
- _context2.next = 1;
60494
- return (_window$mainApi11 = window.mainApi) === null || _window$mainApi11 === void 0 || (_window$mainApi11 = _window$mainApi11.registryAuth) === null || _window$mainApi11 === void 0 ? void 0 : _window$mainApi11.getProfile();
60910
+ _context3.prev = 0;
60911
+ _context3.next = 1;
60912
+ return (_window$mainApi12 = window.mainApi) === null || _window$mainApi12 === void 0 || (_window$mainApi12 = _window$mainApi12.registryAuth) === null || _window$mainApi12 === void 0 ? void 0 : _window$mainApi12.getProfile();
60495
60913
  case 1:
60496
- profile = _context2.sent;
60914
+ profile = _context3.sent;
60497
60915
  if (profile) setAuthProfile(profile);
60498
- _context2.next = 3;
60916
+ _context3.next = 3;
60499
60917
  break;
60500
60918
  case 2:
60501
- _context2.prev = 2;
60502
- _context2["catch"](0);
60919
+ _context3.prev = 2;
60920
+ _context3["catch"](0);
60503
60921
  case 3:
60504
60922
  case "end":
60505
- return _context2.stop();
60923
+ return _context3.stop();
60506
60924
  }
60507
- }, _callee2, null, [[0, 2]]);
60925
+ }, _callee3, null, [[0, 2]]);
60508
60926
  }));
60509
60927
  return _handleProfileUpdated.apply(this, arguments);
60510
60928
  }
@@ -60541,14 +60959,14 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60541
60959
  // editing. Shapes:
60542
60960
  // { kind: "open-workspace", workspace } — sidebar switch
60543
60961
  // { kind: "cancel-edit" } — Cancel button
60544
- var _useState57 = React.useState(false),
60545
- _useState58 = _slicedToArray(_useState57, 2),
60546
- isDirty = _useState58[0],
60547
- setIsDirty = _useState58[1];
60548
- var _useState59 = React.useState(null),
60962
+ var _useState59 = React.useState(false),
60549
60963
  _useState60 = _slicedToArray(_useState59, 2),
60550
- pendingNavigation = _useState60[0],
60551
- setPendingNavigation = _useState60[1];
60964
+ isDirty = _useState60[0],
60965
+ setIsDirty = _useState60[1];
60966
+ var _useState61 = React.useState(null),
60967
+ _useState62 = _slicedToArray(_useState61, 2),
60968
+ pendingNavigation = _useState62[0],
60969
+ setPendingNavigation = _useState62[1];
60552
60970
  React.useEffect(function () {
60553
60971
  if (typeof globalThis !== "undefined") {
60554
60972
  globalThis.__dashboardIsDirty = isDirty;
@@ -60559,6 +60977,63 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60559
60977
  }
60560
60978
  };
60561
60979
  }, [isDirty]);
60980
+
60981
+ // ─── First-run onboarding gate (Phase 3A) ────────────────────────
60982
+ // Decision fires exactly once per mount after the first workspaces
60983
+ // load completes. We need to wait for `isLoadingWorkspaces` to flip
60984
+ // true→false at least once; otherwise the gate reads workspaceConfig
60985
+ // at its initial empty value and would flash the modal on every
60986
+ // launch.
60987
+ //
60988
+ // Popout windows never show the modal — they're a slave to the
60989
+ // main window's onboarding decision and don't need their own gate.
60990
+ var onboardingCheckedRef = React.useRef(false);
60991
+ React.useEffect(function () {
60992
+ if (popout) {
60993
+ setIsOnboardingOpen(false);
60994
+ return;
60995
+ }
60996
+ if (onboardingCheckedRef.current) return;
60997
+ if (isLoadingWorkspaces) return;
60998
+ onboardingCheckedRef.current = true;
60999
+ var cancelled = false;
61000
+ _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
61001
+ var _window$mainApi, _window$mainApi$getSt, status;
61002
+ return _regeneratorRuntime.wrap(function (_context) {
61003
+ while (1) switch (_context.prev = _context.next) {
61004
+ case 0:
61005
+ _context.prev = 0;
61006
+ _context.next = 1;
61007
+ return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.onboarding) === null || _window$mainApi === void 0 || (_window$mainApi$getSt = _window$mainApi.getStatus) === null || _window$mainApi$getSt === void 0 ? void 0 : _window$mainApi$getSt.call(_window$mainApi);
61008
+ case 1:
61009
+ status = _context.sent;
61010
+ if (!cancelled) {
61011
+ _context.next = 2;
61012
+ break;
61013
+ }
61014
+ return _context.abrupt("return");
61015
+ case 2:
61016
+ if (status && status.completed === false && workspaceConfig.length === 0) {
61017
+ setIsOnboardingOpen(true);
61018
+ } else {
61019
+ setIsOnboardingOpen(false);
61020
+ }
61021
+ _context.next = 4;
61022
+ break;
61023
+ case 3:
61024
+ _context.prev = 3;
61025
+ _context["catch"](0);
61026
+ if (!cancelled) setIsOnboardingOpen(false);
61027
+ case 4:
61028
+ case "end":
61029
+ return _context.stop();
61030
+ }
61031
+ }, _callee, null, [[0, 3]]);
61032
+ }))();
61033
+ return function () {
61034
+ cancelled = true;
61035
+ };
61036
+ }, [popout, isLoadingWorkspaces, workspaceConfig.length]);
60562
61037
  React.useEffect(function () {
60563
61038
  isLoadingWorkspaces === false && loadWorkspaces();
60564
61039
  isLoadingMenuItems === false && loadMenuItems();
@@ -60573,9 +61048,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60573
61048
  return ws.id === popoutWorkspaceId;
60574
61049
  });
60575
61050
  if (target) {
60576
- var _window$mainApi;
61051
+ var _window$mainApi2;
60577
61052
  handleOpenTab(target);
60578
- if ((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.popout) !== null && _window$mainApi !== void 0 && _window$mainApi.setTitle) {
61053
+ if ((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && (_window$mainApi2 = _window$mainApi2.popout) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.setTitle) {
60579
61054
  window.mainApi.popout.setTitle(popoutWorkspaceId, target.name || "Untitled");
60580
61055
  }
60581
61056
  }
@@ -60584,15 +61059,15 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60584
61059
 
60585
61060
  // ─── Listen for workspace:saved broadcasts (MCP tools, popouts) ──
60586
61061
  React.useEffect(function () {
60587
- var _window$mainApi2;
60588
- if (!((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.on)) return;
61062
+ var _window$mainApi3;
61063
+ if (!((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.on)) return;
60589
61064
  var handler = function handler() {
60590
61065
  loadWorkspaces();
60591
61066
  };
60592
61067
  window.mainApi.on("workspace:saved", handler);
60593
61068
  return function () {
60594
- var _window$mainApi3;
60595
- if ((_window$mainApi3 = window.mainApi) !== null && _window$mainApi3 !== void 0 && _window$mainApi3.removeListener) {
61069
+ var _window$mainApi4;
61070
+ if ((_window$mainApi4 = window.mainApi) !== null && _window$mainApi4 !== void 0 && _window$mainApi4.removeListener) {
60596
61071
  window.mainApi.removeListener("workspace:saved", handler);
60597
61072
  }
60598
61073
  };
@@ -60624,9 +61099,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60624
61099
  // closing the builder modal — this listener only opens Settings.
60625
61100
  React.useEffect(function () {
60626
61101
  var handler = function handler(e) {
60627
- var _ref4 = (e === null || e === void 0 ? void 0 : e.detail) || {},
60628
- type = _ref4.type,
60629
- providerClass = _ref4.providerClass;
61102
+ var _ref5 = (e === null || e === void 0 ? void 0 : e.detail) || {},
61103
+ type = _ref5.type,
61104
+ providerClass = _ref5.providerClass;
60630
61105
  if (!type) return;
60631
61106
  openAppSettings("providers", null, true, type, providerClass || null);
60632
61107
  };
@@ -60646,10 +61121,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60646
61121
  // We record the requested ID and open it once it appears in
60647
61122
  // workspaceConfig — handles the case where the workspace was just
60648
61123
  // created and the config reload is still in flight.
60649
- var _useState61 = React.useState(null),
60650
- _useState62 = _slicedToArray(_useState61, 2),
60651
- pendingOpenWorkspaceId = _useState62[0],
60652
- setPendingOpenWorkspaceId = _useState62[1];
61124
+ var _useState63 = React.useState(null),
61125
+ _useState64 = _slicedToArray(_useState63, 2),
61126
+ pendingOpenWorkspaceId = _useState64[0],
61127
+ setPendingOpenWorkspaceId = _useState64[1];
60653
61128
  React.useEffect(function () {
60654
61129
  var handler = function handler(e) {
60655
61130
  var _e$detail2;
@@ -60677,30 +61152,30 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60677
61152
 
60678
61153
  // ─── Load recents on mount ───────────────────────────────────────
60679
61154
  React.useEffect(function () {
60680
- var _window$mainApi4;
61155
+ var _window$mainApi5;
60681
61156
  if (popout) return;
60682
- (_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.session) === null || _window$mainApi4 === void 0 || _window$mainApi4.getRecents().then(function (recents) {
61157
+ (_window$mainApi5 = window.mainApi) === null || _window$mainApi5 === void 0 || (_window$mainApi5 = _window$mainApi5.session) === null || _window$mainApi5 === void 0 || _window$mainApi5.getRecents().then(function (recents) {
60683
61158
  if (recents) setRecentDashboards(recents);
60684
61159
  });
60685
61160
  }, [popout]);
60686
61161
 
60687
61162
  // ─── Session save (continuous) ──────────────────────────────────
60688
61163
  React.useEffect(function () {
60689
- var _window$mainApi5;
61164
+ var _window$mainApi6;
60690
61165
  if (popout) return;
60691
61166
  var tabIds = openTabs.map(function (t) {
60692
61167
  return t.id;
60693
61168
  });
60694
- (_window$mainApi5 = window.mainApi) === null || _window$mainApi5 === void 0 || (_window$mainApi5 = _window$mainApi5.session) === null || _window$mainApi5 === void 0 || _window$mainApi5.saveState(tabIds, activeTabId);
61169
+ (_window$mainApi6 = window.mainApi) === null || _window$mainApi6 === void 0 || (_window$mainApi6 = _window$mainApi6.session) === null || _window$mainApi6 === void 0 || _window$mainApi6.saveState(tabIds, activeTabId);
60695
61170
  }, [openTabs, activeTabId, popout]);
60696
61171
 
60697
61172
  // ─── Session restore on launch ─────────────────────────────────
60698
61173
  React.useEffect(function () {
60699
- var _window$mainApi6;
61174
+ var _window$mainApi7;
60700
61175
  if (popout || workspaceConfig.length === 0 || sessionRestored.current) return;
60701
61176
  sessionRestored.current = true;
60702
- (_window$mainApi6 = window.mainApi) === null || _window$mainApi6 === void 0 || (_window$mainApi6 = _window$mainApi6.session) === null || _window$mainApi6 === void 0 || _window$mainApi6.getState().then(function (state) {
60703
- var _state$openTabIds, _window$mainApi7;
61177
+ (_window$mainApi7 = window.mainApi) === null || _window$mainApi7 === void 0 || (_window$mainApi7 = _window$mainApi7.session) === null || _window$mainApi7 === void 0 || _window$mainApi7.getState().then(function (state) {
61178
+ var _state$openTabIds, _window$mainApi8;
60704
61179
  if (!(state !== null && state !== void 0 && (_state$openTabIds = state.openTabIds) !== null && _state$openTabIds !== void 0 && _state$openTabIds.length)) return;
60705
61180
  state.openTabIds.forEach(function (wsId) {
60706
61181
  var ws = workspaceConfig.find(function (w) {
@@ -60709,7 +61184,7 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60709
61184
  if (ws) handleOpenTab(ws);
60710
61185
  });
60711
61186
  if (state.activeTabId) setActiveTabId(state.activeTabId);
60712
- (_window$mainApi7 = window.mainApi) === null || _window$mainApi7 === void 0 || (_window$mainApi7 = _window$mainApi7.session) === null || _window$mainApi7 === void 0 || _window$mainApi7.clearState();
61187
+ (_window$mainApi8 = window.mainApi) === null || _window$mainApi8 === void 0 || (_window$mainApi8 = _window$mainApi8.session) === null || _window$mainApi8 === void 0 || _window$mainApi8.clearState();
60713
61188
  });
60714
61189
  // eslint-disable-next-line react-hooks/exhaustive-deps
60715
61190
  }, [workspaceConfig, popout]);
@@ -60722,35 +61197,35 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60722
61197
  return _checkAuth.apply(this, arguments);
60723
61198
  }
60724
61199
  function _checkAuth() {
60725
- _checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
60726
- var _window$mainApi8, status, _window$mainApi9, profile;
60727
- return _regeneratorRuntime.wrap(function (_context) {
60728
- while (1) switch (_context.prev = _context.next) {
61200
+ _checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
61201
+ var _window$mainApi9, status, _window$mainApi0, profile;
61202
+ return _regeneratorRuntime.wrap(function (_context2) {
61203
+ while (1) switch (_context2.prev = _context2.next) {
60729
61204
  case 0:
60730
- _context.prev = 0;
60731
- _context.next = 1;
60732
- return (_window$mainApi8 = window.mainApi) === null || _window$mainApi8 === void 0 || (_window$mainApi8 = _window$mainApi8.registryAuth) === null || _window$mainApi8 === void 0 ? void 0 : _window$mainApi8.getStatus();
61205
+ _context2.prev = 0;
61206
+ _context2.next = 1;
61207
+ return (_window$mainApi9 = window.mainApi) === null || _window$mainApi9 === void 0 || (_window$mainApi9 = _window$mainApi9.registryAuth) === null || _window$mainApi9 === void 0 ? void 0 : _window$mainApi9.getStatus();
60733
61208
  case 1:
60734
- status = _context.sent;
61209
+ status = _context2.sent;
60735
61210
  if (!cancelled) {
60736
- _context.next = 2;
61211
+ _context2.next = 2;
60737
61212
  break;
60738
61213
  }
60739
- return _context.abrupt("return");
61214
+ return _context2.abrupt("return");
60740
61215
  case 2:
60741
61216
  if (!(status !== null && status !== void 0 && status.authenticated)) {
60742
- _context.next = 5;
61217
+ _context2.next = 5;
60743
61218
  break;
60744
61219
  }
60745
- _context.next = 3;
60746
- return (_window$mainApi9 = window.mainApi) === null || _window$mainApi9 === void 0 || (_window$mainApi9 = _window$mainApi9.registryAuth) === null || _window$mainApi9 === void 0 ? void 0 : _window$mainApi9.getProfile();
61220
+ _context2.next = 3;
61221
+ return (_window$mainApi0 = window.mainApi) === null || _window$mainApi0 === void 0 || (_window$mainApi0 = _window$mainApi0.registryAuth) === null || _window$mainApi0 === void 0 ? void 0 : _window$mainApi0.getProfile();
60747
61222
  case 3:
60748
- profile = _context.sent;
61223
+ profile = _context2.sent;
60749
61224
  if (!cancelled) {
60750
- _context.next = 4;
61225
+ _context2.next = 4;
60751
61226
  break;
60752
61227
  }
60753
- return _context.abrupt("return");
61228
+ return _context2.abrupt("return");
60754
61229
  case 4:
60755
61230
  if (profile) {
60756
61231
  setAuthProfile(profile);
@@ -60758,22 +61233,22 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60758
61233
  } else {
60759
61234
  setAuthStatus("unauthenticated");
60760
61235
  }
60761
- _context.next = 6;
61236
+ _context2.next = 6;
60762
61237
  break;
60763
61238
  case 5:
60764
61239
  setAuthStatus("unauthenticated");
60765
61240
  case 6:
60766
- _context.next = 8;
61241
+ _context2.next = 8;
60767
61242
  break;
60768
61243
  case 7:
60769
- _context.prev = 7;
60770
- _context["catch"](0);
61244
+ _context2.prev = 7;
61245
+ _context2["catch"](0);
60771
61246
  if (!cancelled) setAuthStatus("unauthenticated");
60772
61247
  case 8:
60773
61248
  case "end":
60774
- return _context.stop();
61249
+ return _context2.stop();
60775
61250
  }
60776
- }, _callee, null, [[0, 7]]);
61251
+ }, _callee2, null, [[0, 7]]);
60777
61252
  }));
60778
61253
  return _checkAuth.apply(this, arguments);
60779
61254
  }
@@ -60900,8 +61375,8 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
60900
61375
 
60901
61376
  // Track in recents
60902
61377
  if (!popout) {
60903
- var _window$mainApi0;
60904
- (_window$mainApi0 = window.mainApi) === null || _window$mainApi0 === void 0 || (_window$mainApi0 = _window$mainApi0.session) === null || _window$mainApi0 === void 0 || _window$mainApi0.addRecent(workspaceItem.id, workspaceItem.name || "Untitled").then(function (updated) {
61378
+ var _window$mainApi1;
61379
+ (_window$mainApi1 = window.mainApi) === null || _window$mainApi1 === void 0 || (_window$mainApi1 = _window$mainApi1.session) === null || _window$mainApi1 === void 0 || _window$mainApi1.addRecent(workspaceItem.id, workspaceItem.name || "Untitled").then(function (updated) {
60905
61380
  if (updated) setRecentDashboards(updated);
60906
61381
  });
60907
61382
  }
@@ -61276,10 +61751,10 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
61276
61751
  }
61277
61752
 
61278
61753
  // ─── Page State ──────────────────────────────────────────────────
61279
- var _useState63 = React.useState(null),
61280
- _useState64 = _slicedToArray(_useState63, 2),
61281
- activePageId = _useState64[0],
61282
- setActivePageId = _useState64[1];
61754
+ var _useState65 = React.useState(null),
61755
+ _useState66 = _slicedToArray(_useState65, 2),
61756
+ activePageId = _useState66[0],
61757
+ setActivePageId = _useState66[1];
61283
61758
 
61284
61759
  // Page history stack for goBack() — pushes the previous page id
61285
61760
  // whenever a navigation happens through navigateToPage().
@@ -61313,9 +61788,9 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
61313
61788
  // Listen for programmatic page switches via DashboardActionsApi
61314
61789
  React.useEffect(function () {
61315
61790
  function onSwitchPage(e) {
61316
- var _ref5 = e.detail || {},
61317
- pageId = _ref5.pageId,
61318
- pageName = _ref5.pageName;
61791
+ var _ref6 = e.detail || {},
61792
+ pageId = _ref6.pageId,
61793
+ pageName = _ref6.pageName;
61319
61794
  if (pageId) {
61320
61795
  navigateToPage(pageId);
61321
61796
  } else if (pageName) {
@@ -61905,70 +62380,70 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
61905
62380
  return _handleSidebarSignIn.apply(this, arguments);
61906
62381
  }
61907
62382
  function _handleSidebarSignIn() {
61908
- _handleSidebarSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
62383
+ _handleSidebarSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
61909
62384
  var flow, interval, poll;
61910
- return _regeneratorRuntime.wrap(function (_context4) {
61911
- while (1) switch (_context4.prev = _context4.next) {
62385
+ return _regeneratorRuntime.wrap(function (_context5) {
62386
+ while (1) switch (_context5.prev = _context5.next) {
61912
62387
  case 0:
61913
- _context4.prev = 0;
61914
- _context4.next = 1;
62388
+ _context5.prev = 0;
62389
+ _context5.next = 1;
61915
62390
  return window.mainApi.registryAuth.initiateLogin();
61916
62391
  case 1:
61917
- flow = _context4.sent;
62392
+ flow = _context5.sent;
61918
62393
  if (flow.verificationUrlComplete) {
61919
62394
  window.mainApi.shell.openExternal(flow.verificationUrlComplete);
61920
62395
  }
61921
62396
  interval = (flow.interval || 5) * 1000;
61922
- poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
62397
+ poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
61923
62398
  var result, profile;
61924
- return _regeneratorRuntime.wrap(function (_context3) {
61925
- while (1) switch (_context3.prev = _context3.next) {
62399
+ return _regeneratorRuntime.wrap(function (_context4) {
62400
+ while (1) switch (_context4.prev = _context4.next) {
61926
62401
  case 0:
61927
- _context3.prev = 0;
61928
- _context3.next = 1;
62402
+ _context4.prev = 0;
62403
+ _context4.next = 1;
61929
62404
  return window.mainApi.registryAuth.pollToken(flow.deviceCode);
61930
62405
  case 1:
61931
- result = _context3.sent;
62406
+ result = _context4.sent;
61932
62407
  if (!(result.status === "authorized")) {
61933
- _context3.next = 3;
62408
+ _context4.next = 3;
61934
62409
  break;
61935
62410
  }
61936
62411
  clearInterval(poll);
61937
- _context3.next = 2;
62412
+ _context4.next = 2;
61938
62413
  return window.mainApi.registryAuth.getProfile();
61939
62414
  case 2:
61940
- profile = _context3.sent;
62415
+ profile = _context4.sent;
61941
62416
  setAuthProfile(profile);
61942
62417
  setAuthStatus("authenticated");
61943
- _context3.next = 4;
62418
+ _context4.next = 4;
61944
62419
  break;
61945
62420
  case 3:
61946
62421
  if (result.status === "expired") {
61947
62422
  clearInterval(poll);
61948
62423
  }
61949
62424
  case 4:
61950
- _context3.next = 6;
62425
+ _context4.next = 6;
61951
62426
  break;
61952
62427
  case 5:
61953
- _context3.prev = 5;
61954
- _context3["catch"](0);
62428
+ _context4.prev = 5;
62429
+ _context4["catch"](0);
61955
62430
  clearInterval(poll);
61956
62431
  case 6:
61957
62432
  case "end":
61958
- return _context3.stop();
62433
+ return _context4.stop();
61959
62434
  }
61960
- }, _callee3, null, [[0, 5]]);
62435
+ }, _callee4, null, [[0, 5]]);
61961
62436
  })), interval);
61962
- _context4.next = 3;
62437
+ _context5.next = 3;
61963
62438
  break;
61964
62439
  case 2:
61965
- _context4.prev = 2;
61966
- _context4["catch"](0);
62440
+ _context5.prev = 2;
62441
+ _context5["catch"](0);
61967
62442
  case 3:
61968
62443
  case "end":
61969
- return _context4.stop();
62444
+ return _context5.stop();
61970
62445
  }
61971
- }, _callee4, null, [[0, 2]]);
62446
+ }, _callee5, null, [[0, 2]]);
61972
62447
  }));
61973
62448
  return _handleSidebarSignIn.apply(this, arguments);
61974
62449
  }
@@ -61976,38 +62451,38 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
61976
62451
  return _handleSidebarSignOut.apply(this, arguments);
61977
62452
  }
61978
62453
  function _handleSidebarSignOut() {
61979
- _handleSidebarSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
61980
- return _regeneratorRuntime.wrap(function (_context5) {
61981
- while (1) switch (_context5.prev = _context5.next) {
62454
+ _handleSidebarSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
62455
+ return _regeneratorRuntime.wrap(function (_context6) {
62456
+ while (1) switch (_context6.prev = _context6.next) {
61982
62457
  case 0:
61983
- _context5.prev = 0;
61984
- _context5.next = 1;
62458
+ _context6.prev = 0;
62459
+ _context6.next = 1;
61985
62460
  return window.mainApi.registryAuth.logout();
61986
62461
  case 1:
61987
62462
  setAuthStatus("unauthenticated");
61988
62463
  setAuthProfile(null);
61989
- _context5.next = 3;
62464
+ _context6.next = 3;
61990
62465
  break;
61991
62466
  case 2:
61992
- _context5.prev = 2;
61993
- _context5["catch"](0);
62467
+ _context6.prev = 2;
62468
+ _context6["catch"](0);
61994
62469
  case 3:
61995
62470
  case "end":
61996
- return _context5.stop();
62471
+ return _context6.stop();
61997
62472
  }
61998
- }, _callee5, null, [[0, 2]]);
62473
+ }, _callee6, null, [[0, 2]]);
61999
62474
  }));
62000
62475
  return _handleSidebarSignOut.apply(this, arguments);
62001
62476
  }
62002
62477
  function handlePopout() {
62003
- var _window$mainApi1;
62004
- if (workspaceSelected && (_window$mainApi1 = window.mainApi) !== null && _window$mainApi1 !== void 0 && (_window$mainApi1 = _window$mainApi1.popout) !== null && _window$mainApi1 !== void 0 && _window$mainApi1.open) {
62478
+ var _window$mainApi10;
62479
+ if (workspaceSelected && (_window$mainApi10 = window.mainApi) !== null && _window$mainApi10 !== void 0 && (_window$mainApi10 = _window$mainApi10.popout) !== null && _window$mainApi10 !== void 0 && _window$mainApi10.open) {
62005
62480
  window.mainApi.popout.open(workspaceSelected.id);
62006
62481
  }
62007
62482
  }
62008
62483
  function handleWidgetPopout(widgetId) {
62009
- var _window$mainApi10;
62010
- if (workspaceSelected && (_window$mainApi10 = window.mainApi) !== null && _window$mainApi10 !== void 0 && (_window$mainApi10 = _window$mainApi10.widgetPopout) !== null && _window$mainApi10 !== void 0 && _window$mainApi10.open) {
62484
+ var _window$mainApi11;
62485
+ if (workspaceSelected && (_window$mainApi11 = window.mainApi) !== null && _window$mainApi11 !== void 0 && (_window$mainApi11 = _window$mainApi11.widgetPopout) !== null && _window$mainApi11 !== void 0 && _window$mainApi11.open) {
62011
62486
  window.mainApi.widgetPopout.open(workspaceSelected.id, widgetId);
62012
62487
  }
62013
62488
  }
@@ -62327,6 +62802,23 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
62327
62802
  onSaveListeners: handleBulkListenerBindings,
62328
62803
  onSaveUserPrefs: handleBulkUserPrefs,
62329
62804
  initialTab: "providers"
62805
+ }), /*#__PURE__*/jsxRuntime.jsx(OnboardingModal, {
62806
+ open: isOnboardingOpen === true,
62807
+ appId: credentials === null || credentials === void 0 ? void 0 : credentials.appId,
62808
+ onDismiss: function onDismiss() {
62809
+ return setIsOnboardingOpen(false);
62810
+ },
62811
+ onComplete: function onComplete() {
62812
+ return setIsOnboardingOpen(false);
62813
+ },
62814
+ onOpenDashboard: function onOpenDashboard(ws) {
62815
+ setIsOnboardingOpen(false);
62816
+ // Refresh workspaces before opening so the just-
62817
+ // installed Kitchen Sink shows up in the sidebar list
62818
+ // alongside the open tab.
62819
+ loadWorkspaces();
62820
+ handleOpenTab(ws);
62821
+ }
62330
62822
  })]
62331
62823
  })]
62332
62824
  }), !popout && /*#__PURE__*/jsxRuntime.jsx(DashCommandPalette, {