@trops/dash-core 0.1.96 → 0.1.98

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
@@ -1790,6 +1790,12 @@ var WebDashboardApi = /*#__PURE__*/function () {
1790
1790
  onError === null || onError === void 0 ? void 0 : onError("mcp:get-catalog:error", new Error("MCP not available in web mode"));
1791
1791
  return false;
1792
1792
  }
1793
+ }, {
1794
+ key: "mcpRunAuth",
1795
+ value: function mcpRunAuth(mcpConfig, credentials, authCommand, onSuccess, onError) {
1796
+ onError === null || onError === void 0 ? void 0 : onError("mcp:run-auth:error", new Error("MCP not available in web mode"));
1797
+ return false;
1798
+ }
1793
1799
  }]);
1794
1800
  }();
1795
1801
 
@@ -3080,7 +3086,7 @@ var LayoutManagerPicker = function LayoutManagerPicker(_ref2) {
3080
3086
  });
3081
3087
  };
3082
3088
 
3083
- var FOLDER_ICONS$1 = [
3089
+ var FOLDER_ICONS = [
3084
3090
  // General / UI
3085
3091
  "home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
3086
3092
  // Communication
@@ -3103,7 +3109,7 @@ var FOLDER_ICONS$1 = [
3103
3109
  "file", "file-code", "clipboard", "book", "pen", "pencil",
3104
3110
  // Misc
3105
3111
  "magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
3106
- var ALL_ICON_NAMES$1 = Object.keys(DashReact__namespace).filter(function (key) {
3112
+ var ALL_ICON_NAMES = Object.keys(DashReact__namespace).filter(function (key) {
3107
3113
  return key.startsWith("fa") && key !== "fas";
3108
3114
  }).map(function (key) {
3109
3115
  var _DashReact$key;
@@ -3111,8 +3117,8 @@ var ALL_ICON_NAMES$1 = Object.keys(DashReact__namespace).filter(function (key) {
3111
3117
  }).filter(Boolean).filter(function (name, index, arr) {
3112
3118
  return arr.indexOf(name) === index;
3113
3119
  }).sort();
3114
- var CURATED_SET$1 = new Set(FOLDER_ICONS$1);
3115
- var IconPicker$1 = function IconPicker(_ref) {
3120
+ var CURATED_SET = new Set(FOLDER_ICONS);
3121
+ var IconPicker = function IconPicker(_ref) {
3116
3122
  var selectedIcon = _ref.selectedIcon,
3117
3123
  onSelectIcon = _ref.onSelectIcon;
3118
3124
  var _useState = React.useState(""),
@@ -3121,13 +3127,13 @@ var IconPicker$1 = function IconPicker(_ref) {
3121
3127
  setSearch = _useState2[1];
3122
3128
  var query = search.trim().toLowerCase();
3123
3129
  var filteredCurated = React.useMemo(function () {
3124
- return query ? FOLDER_ICONS$1.filter(function (name) {
3130
+ return query ? FOLDER_ICONS.filter(function (name) {
3125
3131
  return name.includes(query);
3126
- }) : FOLDER_ICONS$1;
3132
+ }) : FOLDER_ICONS;
3127
3133
  }, [query]);
3128
3134
  var remainingIcons = React.useMemo(function () {
3129
- var all = ALL_ICON_NAMES$1.filter(function (name) {
3130
- return !CURATED_SET$1.has(name);
3135
+ var all = ALL_ICON_NAMES.filter(function (name) {
3136
+ return !CURATED_SET.has(name);
3131
3137
  });
3132
3138
  return query ? all.filter(function (name) {
3133
3139
  return name.includes(query);
@@ -3182,26 +3188,27 @@ var IconPicker$1 = function IconPicker(_ref) {
3182
3188
  })]
3183
3189
  });
3184
3190
  };
3185
- var FolderDetail = function FolderDetail(_ref2) {
3186
- var _ref2$menuItem = _ref2.menuItem,
3187
- menuItem = _ref2$menuItem === void 0 ? null : _ref2$menuItem,
3188
- _ref2$workspaces = _ref2.workspaces,
3189
- workspaces = _ref2$workspaces === void 0 ? [] : _ref2$workspaces,
3190
- _ref2$isEditing = _ref2.isEditing,
3191
- isEditing = _ref2$isEditing === void 0 ? false : _ref2$isEditing,
3192
- _ref2$isCreating = _ref2.isCreating,
3193
- isCreating = _ref2$isCreating === void 0 ? false : _ref2$isCreating,
3194
- _ref2$formName = _ref2.formName,
3195
- formName = _ref2$formName === void 0 ? "" : _ref2$formName,
3196
- setFormName = _ref2.setFormName,
3197
- _ref2$formIcon = _ref2.formIcon,
3198
- formIcon = _ref2$formIcon === void 0 ? "folder" : _ref2$formIcon,
3199
- setFormIcon = _ref2.setFormIcon,
3200
- onSaveEdit = _ref2.onSaveEdit,
3201
- onCancelEdit = _ref2.onCancelEdit,
3202
- onStartEdit = _ref2.onStartEdit,
3203
- onCreate = _ref2.onCreate,
3204
- onDelete = _ref2.onDelete;
3191
+
3192
+ var FolderDetail = function FolderDetail(_ref) {
3193
+ var _ref$menuItem = _ref.menuItem,
3194
+ menuItem = _ref$menuItem === void 0 ? null : _ref$menuItem,
3195
+ _ref$workspaces = _ref.workspaces,
3196
+ workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
3197
+ _ref$isEditing = _ref.isEditing,
3198
+ isEditing = _ref$isEditing === void 0 ? false : _ref$isEditing,
3199
+ _ref$isCreating = _ref.isCreating,
3200
+ isCreating = _ref$isCreating === void 0 ? false : _ref$isCreating,
3201
+ _ref$formName = _ref.formName,
3202
+ formName = _ref$formName === void 0 ? "" : _ref$formName,
3203
+ setFormName = _ref.setFormName,
3204
+ _ref$formIcon = _ref.formIcon,
3205
+ formIcon = _ref$formIcon === void 0 ? "folder" : _ref$formIcon,
3206
+ setFormIcon = _ref.setFormIcon,
3207
+ onSaveEdit = _ref.onSaveEdit,
3208
+ onCancelEdit = _ref.onCancelEdit,
3209
+ onStartEdit = _ref.onStartEdit,
3210
+ onCreate = _ref.onCreate,
3211
+ onDelete = _ref.onDelete;
3205
3212
  var isFormMode = isEditing || isCreating;
3206
3213
 
3207
3214
  // Get dashboards in this folder
@@ -3228,7 +3235,7 @@ var FolderDetail = function FolderDetail(_ref2) {
3228
3235
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
3229
3236
  className: "flex-shrink-0 text-sm font-medium opacity-70",
3230
3237
  children: "Icon"
3231
- }), /*#__PURE__*/jsxRuntime.jsx(IconPicker$1, {
3238
+ }), /*#__PURE__*/jsxRuntime.jsx(IconPicker, {
3232
3239
  selectedIcon: formIcon,
3233
3240
  onSelectIcon: setFormIcon
3234
3241
  })]
@@ -3519,7 +3526,7 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3519
3526
  placeholder: "Folder name"
3520
3527
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
3521
3528
  className: "grid grid-cols-10 gap-2",
3522
- children: FOLDER_ICONS$1.map(function (icon) {
3529
+ children: FOLDER_ICONS.map(function (icon) {
3523
3530
  var isIconSelected = icon === newFolderIcon;
3524
3531
  return /*#__PURE__*/jsxRuntime.jsx("div", {
3525
3532
  className: "flex items-center justify-center p-2 rounded cursor-pointer transition-all ".concat(isIconSelected ? "bg-blue-600 ring-2 ring-blue-400 text-white" : "bg-gray-700 text-gray-400 hover:bg-gray-600 hover:text-gray-200"),
@@ -26480,109 +26487,6 @@ var StarRating = function StarRating(_ref) {
26480
26487
  });
26481
26488
  };
26482
26489
 
26483
- var FOLDER_ICONS = [
26484
- // General / UI
26485
- "home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
26486
- // Communication
26487
- "phone", "envelope", "comment", "message", "paper-plane",
26488
- // Media
26489
- "image", "camera", "music", "video", "film", "headphones",
26490
- // Tech
26491
- "code", "terminal", "database", "server", "wifi", "plug", "robot", "microchip", "globe",
26492
- // Nature
26493
- "leaf", "seedling", "tree", "sun", "moon", "cloud", "bolt", "fire", "snowflake", "water",
26494
- // Objects
26495
- "hammer", "wrench", "gear", "briefcase", "cart-shopping", "truck", "car", "plane", "rocket",
26496
- // People / Activity
26497
- "user", "users", "trophy", "gamepad", "dumbbell", "graduation-cap", "baby", "baby-carriage",
26498
- // Arrows / Navigation
26499
- "arrow-up", "arrow-down", "arrow-left", "arrow-right", "arrows-up-down", "arrows-left-right", "minus",
26500
- // Data / Charts
26501
- "chart-bar", "chart-line", "chart-pie", "table", "list", "layer-group",
26502
- // Files
26503
- "file", "file-code", "clipboard", "book", "pen", "pencil",
26504
- // Misc
26505
- "magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
26506
- var ALL_ICON_NAMES = Object.keys(DashReact__namespace).filter(function (key) {
26507
- return key.startsWith("fa") && key !== "fas";
26508
- }).map(function (key) {
26509
- var _DashReact$key;
26510
- return (_DashReact$key = DashReact__namespace[key]) === null || _DashReact$key === void 0 ? void 0 : _DashReact$key.iconName;
26511
- }).filter(Boolean).filter(function (name, index, arr) {
26512
- return arr.indexOf(name) === index;
26513
- }).sort();
26514
- var CURATED_SET = new Set(FOLDER_ICONS);
26515
- var IconPicker = function IconPicker(_ref) {
26516
- var selectedIcon = _ref.selectedIcon,
26517
- onSelectIcon = _ref.onSelectIcon;
26518
- var _useState = React.useState(""),
26519
- _useState2 = _slicedToArray(_useState, 2),
26520
- search = _useState2[0],
26521
- setSearch = _useState2[1];
26522
- var query = search.trim().toLowerCase();
26523
- var filteredCurated = React.useMemo(function () {
26524
- return query ? FOLDER_ICONS.filter(function (name) {
26525
- return name.includes(query);
26526
- }) : FOLDER_ICONS;
26527
- }, [query]);
26528
- var remainingIcons = React.useMemo(function () {
26529
- var all = ALL_ICON_NAMES.filter(function (name) {
26530
- return !CURATED_SET.has(name);
26531
- });
26532
- return query ? all.filter(function (name) {
26533
- return name.includes(query);
26534
- }) : all;
26535
- }, [query]);
26536
- var hasResults = filteredCurated.length > 0 || remainingIcons.length > 0;
26537
- var renderIcon = function renderIcon(icon) {
26538
- return /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
26539
- icon: icon,
26540
- selected: icon === selectedIcon,
26541
- onClick: function onClick() {
26542
- return onSelectIcon(icon);
26543
- },
26544
- iconSize: "h-6 w-6",
26545
- backgroundColor: "transparent",
26546
- className: icon !== selectedIcon ? "opacity-50 hover:!opacity-80" : ""
26547
- }, icon);
26548
- };
26549
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
26550
- className: "flex flex-col flex-1 min-h-0 space-y-3",
26551
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
26552
- className: "flex-shrink-0",
26553
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.SearchInput, {
26554
- value: search,
26555
- onChange: setSearch,
26556
- placeholder: "Search icons..."
26557
- })
26558
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
26559
- className: "flex-1 min-h-0 overflow-y-auto space-y-3",
26560
- children: [!hasResults && /*#__PURE__*/jsxRuntime.jsxs("span", {
26561
- className: "text-sm opacity-50 py-2",
26562
- children: ["No icons match \"", search, "\""]
26563
- }), filteredCurated.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
26564
- className: "flex flex-col space-y-1.5",
26565
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
26566
- className: "text-xs font-medium opacity-50",
26567
- children: "Suggested"
26568
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
26569
- className: "grid grid-cols-6 gap-2",
26570
- children: filteredCurated.map(renderIcon)
26571
- })]
26572
- }), remainingIcons.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
26573
- className: "flex flex-col space-y-1.5",
26574
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
26575
- className: "text-xs font-medium opacity-50",
26576
- children: "All Icons"
26577
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
26578
- className: "grid grid-cols-6 gap-2",
26579
- children: remainingIcons.map(renderIcon)
26580
- })]
26581
- })]
26582
- })]
26583
- });
26584
- };
26585
-
26586
26490
  var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication", "developer", "sales", "marketing", "finance", "project-management", "social", "news", "utilities"];
26587
26491
 
26588
26492
  /**
@@ -26590,12 +26494,14 @@ var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication"
26590
26494
  * for registry publishing.
26591
26495
  *
26592
26496
  * Steps:
26593
- * 1. DetailsAuthor name (required) + description (textarea)
26497
+ * 0. AccountAuth check, sign-in prompt, profile display
26498
+ * 1. Details — Author name (pre-filled from profile) + description (textarea)
26594
26499
  * 2. Tags — Predefined tag selection with toggle-pill styling
26595
26500
  * 3. Icon — Full icon picker with search
26596
26501
  * 4. Publish — Review summary, publish action, result display
26597
26502
  */
26598
26503
  var PublishDashboardModal = function PublishDashboardModal(_ref) {
26504
+ var _result$registrySubmi, _result$registrySubmi2;
26599
26505
  var isOpen = _ref.isOpen,
26600
26506
  setIsOpen = _ref.setIsOpen,
26601
26507
  appId = _ref.appId,
@@ -26612,39 +26518,129 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26612
26518
  step = _useState2[0],
26613
26519
  setStep = _useState2[1];
26614
26520
 
26615
- // Step 1: Details
26616
- var _useState3 = React.useState(""),
26521
+ // Step 0: Account / Auth
26522
+ var _useState3 = React.useState("loading"),
26617
26523
  _useState4 = _slicedToArray(_useState3, 2),
26618
- authorName = _useState4[0],
26619
- setAuthorName = _useState4[1];
26620
- var _useState5 = React.useState(""),
26524
+ authStatus = _useState4[0],
26525
+ setAuthStatus = _useState4[1]; // "loading" | "authenticated" | "unauthenticated"
26526
+ var _useState5 = React.useState(null),
26621
26527
  _useState6 = _slicedToArray(_useState5, 2),
26622
- description = _useState6[0],
26623
- setDescription = _useState6[1];
26528
+ profile = _useState6[0],
26529
+ setProfile = _useState6[1];
26530
+ var _useState7 = React.useState(null),
26531
+ _useState8 = _slicedToArray(_useState7, 2),
26532
+ authFlow = _useState8[0],
26533
+ setAuthFlow = _useState8[1];
26534
+ var _useState9 = React.useState(false),
26535
+ _useState0 = _slicedToArray(_useState9, 2),
26536
+ isPolling = _useState0[0],
26537
+ setIsPolling = _useState0[1];
26538
+
26539
+ // Step 1: Details
26540
+ var _useState1 = React.useState(""),
26541
+ _useState10 = _slicedToArray(_useState1, 2),
26542
+ authorName = _useState10[0],
26543
+ setAuthorName = _useState10[1];
26544
+ var _useState11 = React.useState(""),
26545
+ _useState12 = _slicedToArray(_useState11, 2),
26546
+ description = _useState12[0],
26547
+ setDescription = _useState12[1];
26624
26548
 
26625
26549
  // Step 2: Tags
26626
- var _useState7 = React.useState([]),
26627
- _useState8 = _slicedToArray(_useState7, 2),
26628
- selectedTags = _useState8[0],
26629
- setSelectedTags = _useState8[1];
26550
+ var _useState13 = React.useState([]),
26551
+ _useState14 = _slicedToArray(_useState13, 2),
26552
+ selectedTags = _useState14[0],
26553
+ setSelectedTags = _useState14[1];
26630
26554
 
26631
26555
  // Step 3: Icon
26632
- var _useState9 = React.useState("grip"),
26633
- _useState0 = _slicedToArray(_useState9, 2),
26634
- icon = _useState0[0],
26635
- setIcon = _useState0[1];
26556
+ var _useState15 = React.useState("grip"),
26557
+ _useState16 = _slicedToArray(_useState15, 2),
26558
+ icon = _useState16[0],
26559
+ setIcon = _useState16[1];
26636
26560
 
26637
26561
  // Step 4: Publish
26638
- var _useState1 = React.useState(false),
26639
- _useState10 = _slicedToArray(_useState1, 2),
26640
- isPublishing = _useState10[0],
26641
- setIsPublishing = _useState10[1];
26642
- var _useState11 = React.useState(null),
26643
- _useState12 = _slicedToArray(_useState11, 2),
26644
- result = _useState12[0],
26645
- setResult = _useState12[1];
26562
+ var _useState17 = React.useState(false),
26563
+ _useState18 = _slicedToArray(_useState17, 2),
26564
+ isPublishing = _useState18[0],
26565
+ setIsPublishing = _useState18[1];
26566
+ var _useState19 = React.useState(null),
26567
+ _useState20 = _slicedToArray(_useState19, 2),
26568
+ result = _useState20[0],
26569
+ setResult = _useState20[1];
26570
+
26571
+ // Check auth status on mount
26572
+ React.useEffect(function () {
26573
+ if (!isOpen) return;
26574
+ var cancelled = false;
26575
+ function checkAuth() {
26576
+ return _checkAuth.apply(this, arguments);
26577
+ }
26578
+ function _checkAuth() {
26579
+ _checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26580
+ var status, userProfile;
26581
+ return _regeneratorRuntime.wrap(function (_context) {
26582
+ while (1) switch (_context.prev = _context.next) {
26583
+ case 0:
26584
+ _context.prev = 0;
26585
+ _context.next = 1;
26586
+ return window.mainApi.registryAuth.getStatus();
26587
+ case 1:
26588
+ status = _context.sent;
26589
+ if (!cancelled) {
26590
+ _context.next = 2;
26591
+ break;
26592
+ }
26593
+ return _context.abrupt("return");
26594
+ case 2:
26595
+ if (!status.authenticated) {
26596
+ _context.next = 5;
26597
+ break;
26598
+ }
26599
+ _context.next = 3;
26600
+ return window.mainApi.registryAuth.getProfile();
26601
+ case 3:
26602
+ userProfile = _context.sent;
26603
+ if (!cancelled) {
26604
+ _context.next = 4;
26605
+ break;
26606
+ }
26607
+ return _context.abrupt("return");
26608
+ case 4:
26609
+ setProfile(userProfile);
26610
+ setAuthStatus("authenticated");
26611
+ if (userProfile !== null && userProfile !== void 0 && userProfile.displayName && !authorName) {
26612
+ setAuthorName(userProfile.displayName);
26613
+ }
26614
+ _context.next = 6;
26615
+ break;
26616
+ case 5:
26617
+ setAuthStatus("unauthenticated");
26618
+ case 6:
26619
+ _context.next = 8;
26620
+ break;
26621
+ case 7:
26622
+ _context.prev = 7;
26623
+ _context["catch"](0);
26624
+ if (!cancelled) setAuthStatus("unauthenticated");
26625
+ case 8:
26626
+ case "end":
26627
+ return _context.stop();
26628
+ }
26629
+ }, _callee, null, [[0, 7]]);
26630
+ }));
26631
+ return _checkAuth.apply(this, arguments);
26632
+ }
26633
+ checkAuth();
26634
+ return function () {
26635
+ cancelled = true;
26636
+ };
26637
+ }, [isOpen]);
26646
26638
  function resetState() {
26647
26639
  setStep(0);
26640
+ setAuthStatus("loading");
26641
+ setProfile(null);
26642
+ setAuthFlow(null);
26643
+ setIsPolling(false);
26648
26644
  setAuthorName("");
26649
26645
  setDescription("");
26650
26646
  setSelectedTags([]);
@@ -26657,8 +26653,9 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26657
26653
  setTimeout(resetState, 200);
26658
26654
  }
26659
26655
  function handleStepChange(nextStep) {
26660
- if (step === 0 && nextStep > 0 && !authorName.trim()) return;
26661
- if (step === 1 && nextStep > 1 && selectedTags.length === 0) return;
26656
+ if (step === 0 && nextStep > 0 && authStatus !== "authenticated") return;
26657
+ if (step === 1 && nextStep > 1 && !authorName.trim()) return;
26658
+ if (step === 2 && nextStep > 2 && selectedTags.length === 0) return;
26662
26659
  setStep(nextStep);
26663
26660
  }
26664
26661
  function toggleTag(tag) {
@@ -26672,54 +26669,167 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26672
26669
  return _handlePublish.apply(this, arguments);
26673
26670
  }
26674
26671
  function _handlePublish() {
26675
- _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26676
- var options, res, _t;
26677
- return _regeneratorRuntime.wrap(function (_context) {
26678
- while (1) switch (_context.prev = _context.next) {
26672
+ _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
26673
+ var options, res, _t2;
26674
+ return _regeneratorRuntime.wrap(function (_context2) {
26675
+ while (1) switch (_context2.prev = _context2.next) {
26679
26676
  case 0:
26680
26677
  if (!(!appId || !workspaceId)) {
26681
- _context.next = 1;
26678
+ _context2.next = 1;
26682
26679
  break;
26683
26680
  }
26684
- return _context.abrupt("return");
26681
+ return _context2.abrupt("return");
26685
26682
  case 1:
26686
26683
  setIsPublishing(true);
26687
26684
  setResult(null);
26688
- _context.prev = 2;
26685
+ _context2.prev = 2;
26689
26686
  options = {
26690
26687
  authorName: authorName.trim(),
26691
26688
  description: description.trim() || undefined,
26692
26689
  tags: selectedTags,
26693
26690
  icon: icon || undefined
26694
26691
  };
26695
- _context.next = 3;
26692
+ _context2.next = 3;
26696
26693
  return window.mainApi.dashboardConfig.prepareDashboardForPublish(appId, workspaceId, options);
26697
26694
  case 3:
26698
- res = _context.sent;
26695
+ res = _context2.sent;
26699
26696
  setResult(res);
26700
- _context.next = 5;
26697
+ _context2.next = 5;
26701
26698
  break;
26702
26699
  case 4:
26703
- _context.prev = 4;
26704
- _t = _context["catch"](2);
26700
+ _context2.prev = 4;
26701
+ _t2 = _context2["catch"](2);
26705
26702
  setResult({
26706
26703
  success: false,
26707
- error: _t.message || "Failed to prepare dashboard for publish."
26704
+ error: _t2.message || "Failed to prepare dashboard for publish."
26708
26705
  });
26709
26706
  case 5:
26710
- _context.prev = 5;
26707
+ _context2.prev = 5;
26711
26708
  setIsPublishing(false);
26712
- return _context.finish(5);
26709
+ return _context2.finish(5);
26713
26710
  case 6:
26714
26711
  case "end":
26715
- return _context.stop();
26712
+ return _context2.stop();
26716
26713
  }
26717
- }, _callee, null, [[2, 4, 5, 6]]);
26714
+ }, _callee2, null, [[2, 4, 5, 6]]);
26718
26715
  }));
26719
26716
  return _handlePublish.apply(this, arguments);
26720
26717
  }
26721
- var isLastStep = step === 3;
26722
- var canAdvance = step === 0 ? !!authorName.trim() : step === 1 ? selectedTags.length > 0 : true;
26718
+ function handleSignIn() {
26719
+ return _handleSignIn.apply(this, arguments);
26720
+ }
26721
+ function _handleSignIn() {
26722
+ _handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
26723
+ var flow, interval, poll;
26724
+ return _regeneratorRuntime.wrap(function (_context4) {
26725
+ while (1) switch (_context4.prev = _context4.next) {
26726
+ case 0:
26727
+ _context4.prev = 0;
26728
+ _context4.next = 1;
26729
+ return window.mainApi.registryAuth.initiateLogin();
26730
+ case 1:
26731
+ flow = _context4.sent;
26732
+ setAuthFlow(flow);
26733
+
26734
+ // Open verification URL in browser
26735
+ if (flow.verificationUrlComplete) {
26736
+ window.mainApi.shell.openExternal(flow.verificationUrlComplete);
26737
+ }
26738
+
26739
+ // Start polling
26740
+ setIsPolling(true);
26741
+ interval = (flow.interval || 5) * 1000;
26742
+ poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
26743
+ var pollResult, userProfile;
26744
+ return _regeneratorRuntime.wrap(function (_context3) {
26745
+ while (1) switch (_context3.prev = _context3.next) {
26746
+ case 0:
26747
+ _context3.prev = 0;
26748
+ _context3.next = 1;
26749
+ return window.mainApi.registryAuth.pollToken(flow.deviceCode);
26750
+ case 1:
26751
+ pollResult = _context3.sent;
26752
+ if (!(pollResult.status === "authorized")) {
26753
+ _context3.next = 3;
26754
+ break;
26755
+ }
26756
+ clearInterval(poll);
26757
+ setIsPolling(false);
26758
+ setAuthFlow(null);
26759
+ // Fetch profile and update auth state
26760
+ _context3.next = 2;
26761
+ return window.mainApi.registryAuth.getProfile();
26762
+ case 2:
26763
+ userProfile = _context3.sent;
26764
+ setProfile(userProfile);
26765
+ setAuthStatus("authenticated");
26766
+ if (userProfile !== null && userProfile !== void 0 && userProfile.displayName && !authorName) {
26767
+ setAuthorName(userProfile.displayName);
26768
+ }
26769
+ _context3.next = 4;
26770
+ break;
26771
+ case 3:
26772
+ if (pollResult.status === "expired") {
26773
+ clearInterval(poll);
26774
+ setIsPolling(false);
26775
+ setAuthFlow(null);
26776
+ }
26777
+ case 4:
26778
+ _context3.next = 6;
26779
+ break;
26780
+ case 5:
26781
+ _context3.prev = 5;
26782
+ _context3["catch"](0);
26783
+ clearInterval(poll);
26784
+ setIsPolling(false);
26785
+ case 6:
26786
+ case "end":
26787
+ return _context3.stop();
26788
+ }
26789
+ }, _callee3, null, [[0, 5]]);
26790
+ })), interval);
26791
+ _context4.next = 3;
26792
+ break;
26793
+ case 2:
26794
+ _context4.prev = 2;
26795
+ _context4["catch"](0);
26796
+ case 3:
26797
+ case "end":
26798
+ return _context4.stop();
26799
+ }
26800
+ }, _callee4, null, [[0, 2]]);
26801
+ }));
26802
+ return _handleSignIn.apply(this, arguments);
26803
+ }
26804
+ function handleSignOut() {
26805
+ return _handleSignOut.apply(this, arguments);
26806
+ }
26807
+ function _handleSignOut() {
26808
+ _handleSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
26809
+ return _regeneratorRuntime.wrap(function (_context5) {
26810
+ while (1) switch (_context5.prev = _context5.next) {
26811
+ case 0:
26812
+ _context5.prev = 0;
26813
+ _context5.next = 1;
26814
+ return window.mainApi.registryAuth.logout();
26815
+ case 1:
26816
+ setAuthStatus("unauthenticated");
26817
+ setProfile(null);
26818
+ _context5.next = 3;
26819
+ break;
26820
+ case 2:
26821
+ _context5.prev = 2;
26822
+ _context5["catch"](0);
26823
+ case 3:
26824
+ case "end":
26825
+ return _context5.stop();
26826
+ }
26827
+ }, _callee5, null, [[0, 2]]);
26828
+ }));
26829
+ return _handleSignOut.apply(this, arguments);
26830
+ }
26831
+ var isLastStep = step === 4;
26832
+ var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : true;
26723
26833
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
26724
26834
  isOpen: isOpen,
26725
26835
  setIsOpen: handleClose,
@@ -26747,6 +26857,78 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26747
26857
  showNavigation: false,
26748
26858
  className: "flex-1 min-h-0 flex flex-col px-6 pt-2",
26749
26859
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
26860
+ label: "Account",
26861
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
26862
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
26863
+ children: [authStatus === "loading" && /*#__PURE__*/jsxRuntime.jsx("div", {
26864
+ className: "flex items-center justify-center py-12",
26865
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
26866
+ className: "flex items-center gap-3 text-sm opacity-60",
26867
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
26868
+ icon: "spinner",
26869
+ className: "h-4 w-4 animate-spin"
26870
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
26871
+ children: "Checking account status..."
26872
+ })]
26873
+ })
26874
+ }), authStatus === "authenticated" && profile && /*#__PURE__*/jsxRuntime.jsxs("div", {
26875
+ className: "space-y-4",
26876
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
26877
+ className: "text-sm opacity-70",
26878
+ children: "You're signed in and ready to publish."
26879
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
26880
+ className: "bg-white/5 border border-white/10 rounded-lg p-4 flex items-center gap-4",
26881
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
26882
+ className: "flex items-center justify-center h-10 w-10 rounded-full bg-green-500/20 border border-green-500/30",
26883
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
26884
+ icon: "circle-check",
26885
+ className: "h-5 w-5 text-green-400"
26886
+ })
26887
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
26888
+ className: "flex-1 min-w-0",
26889
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
26890
+ className: "text-sm font-medium truncate",
26891
+ children: profile.displayName || profile.username
26892
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
26893
+ className: "text-xs opacity-50 truncate",
26894
+ children: ["@", profile.username]
26895
+ })]
26896
+ })]
26897
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
26898
+ type: "button",
26899
+ onClick: handleSignOut,
26900
+ className: "text-xs opacity-40 hover:opacity-70 transition-opacity cursor-pointer",
26901
+ children: "Sign out"
26902
+ })]
26903
+ }), authStatus === "unauthenticated" && /*#__PURE__*/jsxRuntime.jsxs("div", {
26904
+ className: "space-y-4",
26905
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
26906
+ className: "text-sm opacity-70",
26907
+ children: "Sign in to the Dash Registry to publish your dashboard."
26908
+ }), !authFlow && !isPolling && /*#__PURE__*/jsxRuntime.jsx("button", {
26909
+ type: "button",
26910
+ onClick: handleSignIn,
26911
+ 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",
26912
+ children: "Sign in to Registry"
26913
+ }), authFlow && isPolling && /*#__PURE__*/jsxRuntime.jsxs("div", {
26914
+ className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
26915
+ children: [/*#__PURE__*/jsxRuntime.jsx("p", {
26916
+ className: "text-xs text-blue-300/90",
26917
+ children: "Enter this code in your browser:"
26918
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
26919
+ className: "text-center",
26920
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
26921
+ className: "text-2xl font-mono font-bold tracking-widest text-white",
26922
+ children: authFlow.userCode
26923
+ })
26924
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
26925
+ className: "text-xs text-blue-300/70 text-center",
26926
+ children: "Waiting for authorization..."
26927
+ })]
26928
+ })]
26929
+ })]
26930
+ })
26931
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Stepper.Step, {
26750
26932
  label: "Details",
26751
26933
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
26752
26934
  className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
@@ -26847,14 +27029,57 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26847
27029
  })]
26848
27030
  }) : result.success ? /*#__PURE__*/jsxRuntime.jsxs("div", {
26849
27031
  className: "space-y-3",
26850
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
26851
- className: "flex items-center gap-2",
26852
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
26853
- icon: "circle-check",
26854
- className: "h-4 w-4 text-green-400"
26855
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
26856
- className: "text-sm",
26857
- children: "Dashboard prepared for publishing."
27032
+ children: [(_result$registrySubmi = result.registrySubmission) !== null && _result$registrySubmi !== void 0 && _result$registrySubmi.success ? /*#__PURE__*/jsxRuntime.jsxs("div", {
27033
+ className: "space-y-3",
27034
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
27035
+ className: "flex items-center gap-2",
27036
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
27037
+ icon: "circle-check",
27038
+ className: "h-4 w-4 text-green-400"
27039
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
27040
+ className: "text-sm",
27041
+ children: "Published to Dash Registry"
27042
+ })]
27043
+ }), result.registrySubmission.registryUrl && /*#__PURE__*/jsxRuntime.jsxs("div", {
27044
+ className: "bg-white/5 border border-white/10 rounded-lg p-3",
27045
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
27046
+ className: "text-xs opacity-50 mb-1",
27047
+ children: "Shareable Link"
27048
+ }), /*#__PURE__*/jsxRuntime.jsx("button", {
27049
+ type: "button",
27050
+ onClick: function onClick() {
27051
+ return window.mainApi.shell.openExternal(result.registrySubmission.registryUrl);
27052
+ },
27053
+ className: "text-sm text-blue-400 hover:underline cursor-pointer break-all text-left",
27054
+ children: result.registrySubmission.registryUrl
27055
+ })]
27056
+ }), result.registrySubmission.version && /*#__PURE__*/jsxRuntime.jsxs("div", {
27057
+ className: "text-xs opacity-50",
27058
+ children: ["Version: v", result.registrySubmission.version]
27059
+ })]
27060
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
27061
+ className: "space-y-3",
27062
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
27063
+ className: "flex items-center gap-2",
27064
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
27065
+ icon: "circle-check",
27066
+ className: "h-4 w-4 text-green-400"
27067
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
27068
+ className: "text-sm",
27069
+ children: "Dashboard prepared for publishing."
27070
+ })]
27071
+ }), ((_result$registrySubmi2 = result.registrySubmission) === null || _result$registrySubmi2 === void 0 ? void 0 : _result$registrySubmi2.error) && /*#__PURE__*/jsxRuntime.jsx("div", {
27072
+ className: "bg-amber-500/10 border border-amber-500/20 rounded-lg p-3",
27073
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
27074
+ className: "flex items-start gap-2",
27075
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
27076
+ icon: "triangle-exclamation",
27077
+ className: "h-3.5 w-3.5 text-amber-400 mt-0.5 flex-shrink-0"
27078
+ }), /*#__PURE__*/jsxRuntime.jsxs("span", {
27079
+ className: "text-xs text-amber-300/90",
27080
+ children: ["Registry upload failed:", " ", result.registrySubmission.error, ". Your dashboard was saved locally."]
27081
+ })]
27082
+ })
26858
27083
  })]
26859
27084
  }), result.filePath && /*#__PURE__*/jsxRuntime.jsxs("div", {
26860
27085
  className: "text-xs opacity-50 break-all",
@@ -26918,7 +27143,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26918
27143
  className: "flex-1 text-center",
26919
27144
  children: /*#__PURE__*/jsxRuntime.jsxs("span", {
26920
27145
  className: "text-xs opacity-40",
26921
- children: ["Step ", step + 1, " of 4"]
27146
+ children: ["Step ", step + 1, " of 5"]
26922
27147
  })
26923
27148
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
26924
27149
  className: "flex flex-row gap-2",
@@ -26926,7 +27151,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26926
27151
  title: "Done",
26927
27152
  onClick: handleClose
26928
27153
  }) : isLastStep ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
26929
- title: isPublishing ? "Preparing..." : "Publish",
27154
+ title: isPublishing ? "Publishing..." : "Publish",
26930
27155
  onClick: handlePublish,
26931
27156
  disabled: isPublishing
26932
27157
  }) : /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
@@ -27908,7 +28133,7 @@ var DashboardsSection = function DashboardsSection(_ref) {
27908
28133
  return window.mainApi.dashboardConfig.importDashboardConfig(appId);
27909
28134
  case 3:
27910
28135
  result = _context.sent;
27911
- if (result) {
28136
+ if (!(!result || result.canceled)) {
27912
28137
  _context.next = 4;
27913
28138
  break;
27914
28139
  }
@@ -27959,7 +28184,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
27959
28184
  }),
27960
28185
  active: isSelected,
27961
28186
  onClick: function onClick() {
27962
- return setSelectedId(ws.id);
28187
+ setSelectedId(ws.id);
28188
+ setInstallMode(null);
28189
+ setImportResult(null);
27963
28190
  },
27964
28191
  badge: String(widgetCount),
27965
28192
  className: isSelected ? "bg-white/10 opacity-100" : "",