@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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import * as DashReact from '@trops/dash-react';
3
- import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, SearchInput, ButtonIcon, Modal, Panel, Stepper, Paragraph, Heading3, MenuItem3, FormLabel, SelectMenu, CodeEditorInline, Sidebar, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, Tag2, Tag3, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, Switch, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Card2, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Card3, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, TextArea, SelectInput, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
3
+ import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Modal, Panel, Stepper, Paragraph, Heading3, MenuItem3, FormLabel, SelectMenu, CodeEditorInline, Sidebar, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, Tag2, Tag3, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, Switch, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Card2, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Card3, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, TextArea, SelectInput, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
4
4
  export * from '@trops/dash-react';
5
5
  export { ThemeContext } from '@trops/dash-react';
6
6
  import _typeof from '@babel/runtime/helpers/typeof';
@@ -1771,6 +1771,12 @@ var WebDashboardApi = /*#__PURE__*/function () {
1771
1771
  onError === null || onError === void 0 ? void 0 : onError("mcp:get-catalog:error", new Error("MCP not available in web mode"));
1772
1772
  return false;
1773
1773
  }
1774
+ }, {
1775
+ key: "mcpRunAuth",
1776
+ value: function mcpRunAuth(mcpConfig, credentials, authCommand, onSuccess, onError) {
1777
+ onError === null || onError === void 0 ? void 0 : onError("mcp:run-auth:error", new Error("MCP not available in web mode"));
1778
+ return false;
1779
+ }
1774
1780
  }]);
1775
1781
  }();
1776
1782
 
@@ -3061,7 +3067,7 @@ var LayoutManagerPicker = function LayoutManagerPicker(_ref2) {
3061
3067
  });
3062
3068
  };
3063
3069
 
3064
- var FOLDER_ICONS$1 = [
3070
+ var FOLDER_ICONS = [
3065
3071
  // General / UI
3066
3072
  "home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
3067
3073
  // Communication
@@ -3084,7 +3090,7 @@ var FOLDER_ICONS$1 = [
3084
3090
  "file", "file-code", "clipboard", "book", "pen", "pencil",
3085
3091
  // Misc
3086
3092
  "magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
3087
- var ALL_ICON_NAMES$1 = Object.keys(DashReact).filter(function (key) {
3093
+ var ALL_ICON_NAMES = Object.keys(DashReact).filter(function (key) {
3088
3094
  return key.startsWith("fa") && key !== "fas";
3089
3095
  }).map(function (key) {
3090
3096
  var _DashReact$key;
@@ -3092,8 +3098,8 @@ var ALL_ICON_NAMES$1 = Object.keys(DashReact).filter(function (key) {
3092
3098
  }).filter(Boolean).filter(function (name, index, arr) {
3093
3099
  return arr.indexOf(name) === index;
3094
3100
  }).sort();
3095
- var CURATED_SET$1 = new Set(FOLDER_ICONS$1);
3096
- var IconPicker$1 = function IconPicker(_ref) {
3101
+ var CURATED_SET = new Set(FOLDER_ICONS);
3102
+ var IconPicker = function IconPicker(_ref) {
3097
3103
  var selectedIcon = _ref.selectedIcon,
3098
3104
  onSelectIcon = _ref.onSelectIcon;
3099
3105
  var _useState = useState(""),
@@ -3102,13 +3108,13 @@ var IconPicker$1 = function IconPicker(_ref) {
3102
3108
  setSearch = _useState2[1];
3103
3109
  var query = search.trim().toLowerCase();
3104
3110
  var filteredCurated = useMemo(function () {
3105
- return query ? FOLDER_ICONS$1.filter(function (name) {
3111
+ return query ? FOLDER_ICONS.filter(function (name) {
3106
3112
  return name.includes(query);
3107
- }) : FOLDER_ICONS$1;
3113
+ }) : FOLDER_ICONS;
3108
3114
  }, [query]);
3109
3115
  var remainingIcons = useMemo(function () {
3110
- var all = ALL_ICON_NAMES$1.filter(function (name) {
3111
- return !CURATED_SET$1.has(name);
3116
+ var all = ALL_ICON_NAMES.filter(function (name) {
3117
+ return !CURATED_SET.has(name);
3112
3118
  });
3113
3119
  return query ? all.filter(function (name) {
3114
3120
  return name.includes(query);
@@ -3163,26 +3169,27 @@ var IconPicker$1 = function IconPicker(_ref) {
3163
3169
  })]
3164
3170
  });
3165
3171
  };
3166
- var FolderDetail = function FolderDetail(_ref2) {
3167
- var _ref2$menuItem = _ref2.menuItem,
3168
- menuItem = _ref2$menuItem === void 0 ? null : _ref2$menuItem,
3169
- _ref2$workspaces = _ref2.workspaces,
3170
- workspaces = _ref2$workspaces === void 0 ? [] : _ref2$workspaces,
3171
- _ref2$isEditing = _ref2.isEditing,
3172
- isEditing = _ref2$isEditing === void 0 ? false : _ref2$isEditing,
3173
- _ref2$isCreating = _ref2.isCreating,
3174
- isCreating = _ref2$isCreating === void 0 ? false : _ref2$isCreating,
3175
- _ref2$formName = _ref2.formName,
3176
- formName = _ref2$formName === void 0 ? "" : _ref2$formName,
3177
- setFormName = _ref2.setFormName,
3178
- _ref2$formIcon = _ref2.formIcon,
3179
- formIcon = _ref2$formIcon === void 0 ? "folder" : _ref2$formIcon,
3180
- setFormIcon = _ref2.setFormIcon,
3181
- onSaveEdit = _ref2.onSaveEdit,
3182
- onCancelEdit = _ref2.onCancelEdit,
3183
- onStartEdit = _ref2.onStartEdit,
3184
- onCreate = _ref2.onCreate,
3185
- onDelete = _ref2.onDelete;
3172
+
3173
+ var FolderDetail = function FolderDetail(_ref) {
3174
+ var _ref$menuItem = _ref.menuItem,
3175
+ menuItem = _ref$menuItem === void 0 ? null : _ref$menuItem,
3176
+ _ref$workspaces = _ref.workspaces,
3177
+ workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
3178
+ _ref$isEditing = _ref.isEditing,
3179
+ isEditing = _ref$isEditing === void 0 ? false : _ref$isEditing,
3180
+ _ref$isCreating = _ref.isCreating,
3181
+ isCreating = _ref$isCreating === void 0 ? false : _ref$isCreating,
3182
+ _ref$formName = _ref.formName,
3183
+ formName = _ref$formName === void 0 ? "" : _ref$formName,
3184
+ setFormName = _ref.setFormName,
3185
+ _ref$formIcon = _ref.formIcon,
3186
+ formIcon = _ref$formIcon === void 0 ? "folder" : _ref$formIcon,
3187
+ setFormIcon = _ref.setFormIcon,
3188
+ onSaveEdit = _ref.onSaveEdit,
3189
+ onCancelEdit = _ref.onCancelEdit,
3190
+ onStartEdit = _ref.onStartEdit,
3191
+ onCreate = _ref.onCreate,
3192
+ onDelete = _ref.onDelete;
3186
3193
  var isFormMode = isEditing || isCreating;
3187
3194
 
3188
3195
  // Get dashboards in this folder
@@ -3209,7 +3216,7 @@ var FolderDetail = function FolderDetail(_ref2) {
3209
3216
  children: [/*#__PURE__*/jsx("span", {
3210
3217
  className: "flex-shrink-0 text-sm font-medium opacity-70",
3211
3218
  children: "Icon"
3212
- }), /*#__PURE__*/jsx(IconPicker$1, {
3219
+ }), /*#__PURE__*/jsx(IconPicker, {
3213
3220
  selectedIcon: formIcon,
3214
3221
  onSelectIcon: setFormIcon
3215
3222
  })]
@@ -3500,7 +3507,7 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3500
3507
  placeholder: "Folder name"
3501
3508
  }), /*#__PURE__*/jsx("div", {
3502
3509
  className: "grid grid-cols-10 gap-2",
3503
- children: FOLDER_ICONS$1.map(function (icon) {
3510
+ children: FOLDER_ICONS.map(function (icon) {
3504
3511
  var isIconSelected = icon === newFolderIcon;
3505
3512
  return /*#__PURE__*/jsx("div", {
3506
3513
  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"),
@@ -26461,109 +26468,6 @@ var StarRating = function StarRating(_ref) {
26461
26468
  });
26462
26469
  };
26463
26470
 
26464
- var FOLDER_ICONS = [
26465
- // General / UI
26466
- "home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
26467
- // Communication
26468
- "phone", "envelope", "comment", "message", "paper-plane",
26469
- // Media
26470
- "image", "camera", "music", "video", "film", "headphones",
26471
- // Tech
26472
- "code", "terminal", "database", "server", "wifi", "plug", "robot", "microchip", "globe",
26473
- // Nature
26474
- "leaf", "seedling", "tree", "sun", "moon", "cloud", "bolt", "fire", "snowflake", "water",
26475
- // Objects
26476
- "hammer", "wrench", "gear", "briefcase", "cart-shopping", "truck", "car", "plane", "rocket",
26477
- // People / Activity
26478
- "user", "users", "trophy", "gamepad", "dumbbell", "graduation-cap", "baby", "baby-carriage",
26479
- // Arrows / Navigation
26480
- "arrow-up", "arrow-down", "arrow-left", "arrow-right", "arrows-up-down", "arrows-left-right", "minus",
26481
- // Data / Charts
26482
- "chart-bar", "chart-line", "chart-pie", "table", "list", "layer-group",
26483
- // Files
26484
- "file", "file-code", "clipboard", "book", "pen", "pencil",
26485
- // Misc
26486
- "magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
26487
- var ALL_ICON_NAMES = Object.keys(DashReact).filter(function (key) {
26488
- return key.startsWith("fa") && key !== "fas";
26489
- }).map(function (key) {
26490
- var _DashReact$key;
26491
- return (_DashReact$key = DashReact[key]) === null || _DashReact$key === void 0 ? void 0 : _DashReact$key.iconName;
26492
- }).filter(Boolean).filter(function (name, index, arr) {
26493
- return arr.indexOf(name) === index;
26494
- }).sort();
26495
- var CURATED_SET = new Set(FOLDER_ICONS);
26496
- var IconPicker = function IconPicker(_ref) {
26497
- var selectedIcon = _ref.selectedIcon,
26498
- onSelectIcon = _ref.onSelectIcon;
26499
- var _useState = useState(""),
26500
- _useState2 = _slicedToArray(_useState, 2),
26501
- search = _useState2[0],
26502
- setSearch = _useState2[1];
26503
- var query = search.trim().toLowerCase();
26504
- var filteredCurated = useMemo(function () {
26505
- return query ? FOLDER_ICONS.filter(function (name) {
26506
- return name.includes(query);
26507
- }) : FOLDER_ICONS;
26508
- }, [query]);
26509
- var remainingIcons = useMemo(function () {
26510
- var all = ALL_ICON_NAMES.filter(function (name) {
26511
- return !CURATED_SET.has(name);
26512
- });
26513
- return query ? all.filter(function (name) {
26514
- return name.includes(query);
26515
- }) : all;
26516
- }, [query]);
26517
- var hasResults = filteredCurated.length > 0 || remainingIcons.length > 0;
26518
- var renderIcon = function renderIcon(icon) {
26519
- return /*#__PURE__*/jsx(ButtonIcon, {
26520
- icon: icon,
26521
- selected: icon === selectedIcon,
26522
- onClick: function onClick() {
26523
- return onSelectIcon(icon);
26524
- },
26525
- iconSize: "h-6 w-6",
26526
- backgroundColor: "transparent",
26527
- className: icon !== selectedIcon ? "opacity-50 hover:!opacity-80" : ""
26528
- }, icon);
26529
- };
26530
- return /*#__PURE__*/jsxs("div", {
26531
- className: "flex flex-col flex-1 min-h-0 space-y-3",
26532
- children: [/*#__PURE__*/jsx("div", {
26533
- className: "flex-shrink-0",
26534
- children: /*#__PURE__*/jsx(SearchInput, {
26535
- value: search,
26536
- onChange: setSearch,
26537
- placeholder: "Search icons..."
26538
- })
26539
- }), /*#__PURE__*/jsxs("div", {
26540
- className: "flex-1 min-h-0 overflow-y-auto space-y-3",
26541
- children: [!hasResults && /*#__PURE__*/jsxs("span", {
26542
- className: "text-sm opacity-50 py-2",
26543
- children: ["No icons match \"", search, "\""]
26544
- }), filteredCurated.length > 0 && /*#__PURE__*/jsxs("div", {
26545
- className: "flex flex-col space-y-1.5",
26546
- children: [/*#__PURE__*/jsx("span", {
26547
- className: "text-xs font-medium opacity-50",
26548
- children: "Suggested"
26549
- }), /*#__PURE__*/jsx("div", {
26550
- className: "grid grid-cols-6 gap-2",
26551
- children: filteredCurated.map(renderIcon)
26552
- })]
26553
- }), remainingIcons.length > 0 && /*#__PURE__*/jsxs("div", {
26554
- className: "flex flex-col space-y-1.5",
26555
- children: [/*#__PURE__*/jsx("span", {
26556
- className: "text-xs font-medium opacity-50",
26557
- children: "All Icons"
26558
- }), /*#__PURE__*/jsx("div", {
26559
- className: "grid grid-cols-6 gap-2",
26560
- children: remainingIcons.map(renderIcon)
26561
- })]
26562
- })]
26563
- })]
26564
- });
26565
- };
26566
-
26567
26471
  var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication", "developer", "sales", "marketing", "finance", "project-management", "social", "news", "utilities"];
26568
26472
 
26569
26473
  /**
@@ -26571,12 +26475,14 @@ var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication"
26571
26475
  * for registry publishing.
26572
26476
  *
26573
26477
  * Steps:
26574
- * 1. DetailsAuthor name (required) + description (textarea)
26478
+ * 0. AccountAuth check, sign-in prompt, profile display
26479
+ * 1. Details — Author name (pre-filled from profile) + description (textarea)
26575
26480
  * 2. Tags — Predefined tag selection with toggle-pill styling
26576
26481
  * 3. Icon — Full icon picker with search
26577
26482
  * 4. Publish — Review summary, publish action, result display
26578
26483
  */
26579
26484
  var PublishDashboardModal = function PublishDashboardModal(_ref) {
26485
+ var _result$registrySubmi, _result$registrySubmi2;
26580
26486
  var isOpen = _ref.isOpen,
26581
26487
  setIsOpen = _ref.setIsOpen,
26582
26488
  appId = _ref.appId,
@@ -26593,39 +26499,129 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26593
26499
  step = _useState2[0],
26594
26500
  setStep = _useState2[1];
26595
26501
 
26596
- // Step 1: Details
26597
- var _useState3 = useState(""),
26502
+ // Step 0: Account / Auth
26503
+ var _useState3 = useState("loading"),
26598
26504
  _useState4 = _slicedToArray(_useState3, 2),
26599
- authorName = _useState4[0],
26600
- setAuthorName = _useState4[1];
26601
- var _useState5 = useState(""),
26505
+ authStatus = _useState4[0],
26506
+ setAuthStatus = _useState4[1]; // "loading" | "authenticated" | "unauthenticated"
26507
+ var _useState5 = useState(null),
26602
26508
  _useState6 = _slicedToArray(_useState5, 2),
26603
- description = _useState6[0],
26604
- setDescription = _useState6[1];
26509
+ profile = _useState6[0],
26510
+ setProfile = _useState6[1];
26511
+ var _useState7 = useState(null),
26512
+ _useState8 = _slicedToArray(_useState7, 2),
26513
+ authFlow = _useState8[0],
26514
+ setAuthFlow = _useState8[1];
26515
+ var _useState9 = useState(false),
26516
+ _useState0 = _slicedToArray(_useState9, 2),
26517
+ isPolling = _useState0[0],
26518
+ setIsPolling = _useState0[1];
26519
+
26520
+ // Step 1: Details
26521
+ var _useState1 = useState(""),
26522
+ _useState10 = _slicedToArray(_useState1, 2),
26523
+ authorName = _useState10[0],
26524
+ setAuthorName = _useState10[1];
26525
+ var _useState11 = useState(""),
26526
+ _useState12 = _slicedToArray(_useState11, 2),
26527
+ description = _useState12[0],
26528
+ setDescription = _useState12[1];
26605
26529
 
26606
26530
  // Step 2: Tags
26607
- var _useState7 = useState([]),
26608
- _useState8 = _slicedToArray(_useState7, 2),
26609
- selectedTags = _useState8[0],
26610
- setSelectedTags = _useState8[1];
26531
+ var _useState13 = useState([]),
26532
+ _useState14 = _slicedToArray(_useState13, 2),
26533
+ selectedTags = _useState14[0],
26534
+ setSelectedTags = _useState14[1];
26611
26535
 
26612
26536
  // Step 3: Icon
26613
- var _useState9 = useState("grip"),
26614
- _useState0 = _slicedToArray(_useState9, 2),
26615
- icon = _useState0[0],
26616
- setIcon = _useState0[1];
26537
+ var _useState15 = useState("grip"),
26538
+ _useState16 = _slicedToArray(_useState15, 2),
26539
+ icon = _useState16[0],
26540
+ setIcon = _useState16[1];
26617
26541
 
26618
26542
  // Step 4: Publish
26619
- var _useState1 = useState(false),
26620
- _useState10 = _slicedToArray(_useState1, 2),
26621
- isPublishing = _useState10[0],
26622
- setIsPublishing = _useState10[1];
26623
- var _useState11 = useState(null),
26624
- _useState12 = _slicedToArray(_useState11, 2),
26625
- result = _useState12[0],
26626
- setResult = _useState12[1];
26543
+ var _useState17 = useState(false),
26544
+ _useState18 = _slicedToArray(_useState17, 2),
26545
+ isPublishing = _useState18[0],
26546
+ setIsPublishing = _useState18[1];
26547
+ var _useState19 = useState(null),
26548
+ _useState20 = _slicedToArray(_useState19, 2),
26549
+ result = _useState20[0],
26550
+ setResult = _useState20[1];
26551
+
26552
+ // Check auth status on mount
26553
+ useEffect(function () {
26554
+ if (!isOpen) return;
26555
+ var cancelled = false;
26556
+ function checkAuth() {
26557
+ return _checkAuth.apply(this, arguments);
26558
+ }
26559
+ function _checkAuth() {
26560
+ _checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26561
+ var status, userProfile;
26562
+ return _regeneratorRuntime.wrap(function (_context) {
26563
+ while (1) switch (_context.prev = _context.next) {
26564
+ case 0:
26565
+ _context.prev = 0;
26566
+ _context.next = 1;
26567
+ return window.mainApi.registryAuth.getStatus();
26568
+ case 1:
26569
+ status = _context.sent;
26570
+ if (!cancelled) {
26571
+ _context.next = 2;
26572
+ break;
26573
+ }
26574
+ return _context.abrupt("return");
26575
+ case 2:
26576
+ if (!status.authenticated) {
26577
+ _context.next = 5;
26578
+ break;
26579
+ }
26580
+ _context.next = 3;
26581
+ return window.mainApi.registryAuth.getProfile();
26582
+ case 3:
26583
+ userProfile = _context.sent;
26584
+ if (!cancelled) {
26585
+ _context.next = 4;
26586
+ break;
26587
+ }
26588
+ return _context.abrupt("return");
26589
+ case 4:
26590
+ setProfile(userProfile);
26591
+ setAuthStatus("authenticated");
26592
+ if (userProfile !== null && userProfile !== void 0 && userProfile.displayName && !authorName) {
26593
+ setAuthorName(userProfile.displayName);
26594
+ }
26595
+ _context.next = 6;
26596
+ break;
26597
+ case 5:
26598
+ setAuthStatus("unauthenticated");
26599
+ case 6:
26600
+ _context.next = 8;
26601
+ break;
26602
+ case 7:
26603
+ _context.prev = 7;
26604
+ _context["catch"](0);
26605
+ if (!cancelled) setAuthStatus("unauthenticated");
26606
+ case 8:
26607
+ case "end":
26608
+ return _context.stop();
26609
+ }
26610
+ }, _callee, null, [[0, 7]]);
26611
+ }));
26612
+ return _checkAuth.apply(this, arguments);
26613
+ }
26614
+ checkAuth();
26615
+ return function () {
26616
+ cancelled = true;
26617
+ };
26618
+ }, [isOpen]);
26627
26619
  function resetState() {
26628
26620
  setStep(0);
26621
+ setAuthStatus("loading");
26622
+ setProfile(null);
26623
+ setAuthFlow(null);
26624
+ setIsPolling(false);
26629
26625
  setAuthorName("");
26630
26626
  setDescription("");
26631
26627
  setSelectedTags([]);
@@ -26638,8 +26634,9 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26638
26634
  setTimeout(resetState, 200);
26639
26635
  }
26640
26636
  function handleStepChange(nextStep) {
26641
- if (step === 0 && nextStep > 0 && !authorName.trim()) return;
26642
- if (step === 1 && nextStep > 1 && selectedTags.length === 0) return;
26637
+ if (step === 0 && nextStep > 0 && authStatus !== "authenticated") return;
26638
+ if (step === 1 && nextStep > 1 && !authorName.trim()) return;
26639
+ if (step === 2 && nextStep > 2 && selectedTags.length === 0) return;
26643
26640
  setStep(nextStep);
26644
26641
  }
26645
26642
  function toggleTag(tag) {
@@ -26653,54 +26650,167 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26653
26650
  return _handlePublish.apply(this, arguments);
26654
26651
  }
26655
26652
  function _handlePublish() {
26656
- _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26657
- var options, res, _t;
26658
- return _regeneratorRuntime.wrap(function (_context) {
26659
- while (1) switch (_context.prev = _context.next) {
26653
+ _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
26654
+ var options, res, _t2;
26655
+ return _regeneratorRuntime.wrap(function (_context2) {
26656
+ while (1) switch (_context2.prev = _context2.next) {
26660
26657
  case 0:
26661
26658
  if (!(!appId || !workspaceId)) {
26662
- _context.next = 1;
26659
+ _context2.next = 1;
26663
26660
  break;
26664
26661
  }
26665
- return _context.abrupt("return");
26662
+ return _context2.abrupt("return");
26666
26663
  case 1:
26667
26664
  setIsPublishing(true);
26668
26665
  setResult(null);
26669
- _context.prev = 2;
26666
+ _context2.prev = 2;
26670
26667
  options = {
26671
26668
  authorName: authorName.trim(),
26672
26669
  description: description.trim() || undefined,
26673
26670
  tags: selectedTags,
26674
26671
  icon: icon || undefined
26675
26672
  };
26676
- _context.next = 3;
26673
+ _context2.next = 3;
26677
26674
  return window.mainApi.dashboardConfig.prepareDashboardForPublish(appId, workspaceId, options);
26678
26675
  case 3:
26679
- res = _context.sent;
26676
+ res = _context2.sent;
26680
26677
  setResult(res);
26681
- _context.next = 5;
26678
+ _context2.next = 5;
26682
26679
  break;
26683
26680
  case 4:
26684
- _context.prev = 4;
26685
- _t = _context["catch"](2);
26681
+ _context2.prev = 4;
26682
+ _t2 = _context2["catch"](2);
26686
26683
  setResult({
26687
26684
  success: false,
26688
- error: _t.message || "Failed to prepare dashboard for publish."
26685
+ error: _t2.message || "Failed to prepare dashboard for publish."
26689
26686
  });
26690
26687
  case 5:
26691
- _context.prev = 5;
26688
+ _context2.prev = 5;
26692
26689
  setIsPublishing(false);
26693
- return _context.finish(5);
26690
+ return _context2.finish(5);
26694
26691
  case 6:
26695
26692
  case "end":
26696
- return _context.stop();
26693
+ return _context2.stop();
26697
26694
  }
26698
- }, _callee, null, [[2, 4, 5, 6]]);
26695
+ }, _callee2, null, [[2, 4, 5, 6]]);
26699
26696
  }));
26700
26697
  return _handlePublish.apply(this, arguments);
26701
26698
  }
26702
- var isLastStep = step === 3;
26703
- var canAdvance = step === 0 ? !!authorName.trim() : step === 1 ? selectedTags.length > 0 : true;
26699
+ function handleSignIn() {
26700
+ return _handleSignIn.apply(this, arguments);
26701
+ }
26702
+ function _handleSignIn() {
26703
+ _handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
26704
+ var flow, interval, poll;
26705
+ return _regeneratorRuntime.wrap(function (_context4) {
26706
+ while (1) switch (_context4.prev = _context4.next) {
26707
+ case 0:
26708
+ _context4.prev = 0;
26709
+ _context4.next = 1;
26710
+ return window.mainApi.registryAuth.initiateLogin();
26711
+ case 1:
26712
+ flow = _context4.sent;
26713
+ setAuthFlow(flow);
26714
+
26715
+ // Open verification URL in browser
26716
+ if (flow.verificationUrlComplete) {
26717
+ window.mainApi.shell.openExternal(flow.verificationUrlComplete);
26718
+ }
26719
+
26720
+ // Start polling
26721
+ setIsPolling(true);
26722
+ interval = (flow.interval || 5) * 1000;
26723
+ poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
26724
+ var pollResult, userProfile;
26725
+ return _regeneratorRuntime.wrap(function (_context3) {
26726
+ while (1) switch (_context3.prev = _context3.next) {
26727
+ case 0:
26728
+ _context3.prev = 0;
26729
+ _context3.next = 1;
26730
+ return window.mainApi.registryAuth.pollToken(flow.deviceCode);
26731
+ case 1:
26732
+ pollResult = _context3.sent;
26733
+ if (!(pollResult.status === "authorized")) {
26734
+ _context3.next = 3;
26735
+ break;
26736
+ }
26737
+ clearInterval(poll);
26738
+ setIsPolling(false);
26739
+ setAuthFlow(null);
26740
+ // Fetch profile and update auth state
26741
+ _context3.next = 2;
26742
+ return window.mainApi.registryAuth.getProfile();
26743
+ case 2:
26744
+ userProfile = _context3.sent;
26745
+ setProfile(userProfile);
26746
+ setAuthStatus("authenticated");
26747
+ if (userProfile !== null && userProfile !== void 0 && userProfile.displayName && !authorName) {
26748
+ setAuthorName(userProfile.displayName);
26749
+ }
26750
+ _context3.next = 4;
26751
+ break;
26752
+ case 3:
26753
+ if (pollResult.status === "expired") {
26754
+ clearInterval(poll);
26755
+ setIsPolling(false);
26756
+ setAuthFlow(null);
26757
+ }
26758
+ case 4:
26759
+ _context3.next = 6;
26760
+ break;
26761
+ case 5:
26762
+ _context3.prev = 5;
26763
+ _context3["catch"](0);
26764
+ clearInterval(poll);
26765
+ setIsPolling(false);
26766
+ case 6:
26767
+ case "end":
26768
+ return _context3.stop();
26769
+ }
26770
+ }, _callee3, null, [[0, 5]]);
26771
+ })), interval);
26772
+ _context4.next = 3;
26773
+ break;
26774
+ case 2:
26775
+ _context4.prev = 2;
26776
+ _context4["catch"](0);
26777
+ case 3:
26778
+ case "end":
26779
+ return _context4.stop();
26780
+ }
26781
+ }, _callee4, null, [[0, 2]]);
26782
+ }));
26783
+ return _handleSignIn.apply(this, arguments);
26784
+ }
26785
+ function handleSignOut() {
26786
+ return _handleSignOut.apply(this, arguments);
26787
+ }
26788
+ function _handleSignOut() {
26789
+ _handleSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
26790
+ return _regeneratorRuntime.wrap(function (_context5) {
26791
+ while (1) switch (_context5.prev = _context5.next) {
26792
+ case 0:
26793
+ _context5.prev = 0;
26794
+ _context5.next = 1;
26795
+ return window.mainApi.registryAuth.logout();
26796
+ case 1:
26797
+ setAuthStatus("unauthenticated");
26798
+ setProfile(null);
26799
+ _context5.next = 3;
26800
+ break;
26801
+ case 2:
26802
+ _context5.prev = 2;
26803
+ _context5["catch"](0);
26804
+ case 3:
26805
+ case "end":
26806
+ return _context5.stop();
26807
+ }
26808
+ }, _callee5, null, [[0, 2]]);
26809
+ }));
26810
+ return _handleSignOut.apply(this, arguments);
26811
+ }
26812
+ var isLastStep = step === 4;
26813
+ var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : true;
26704
26814
  return /*#__PURE__*/jsx(Modal, {
26705
26815
  isOpen: isOpen,
26706
26816
  setIsOpen: handleClose,
@@ -26728,6 +26838,78 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26728
26838
  showNavigation: false,
26729
26839
  className: "flex-1 min-h-0 flex flex-col px-6 pt-2",
26730
26840
  children: [/*#__PURE__*/jsx(Stepper.Step, {
26841
+ label: "Account",
26842
+ children: /*#__PURE__*/jsxs("div", {
26843
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
26844
+ children: [authStatus === "loading" && /*#__PURE__*/jsx("div", {
26845
+ className: "flex items-center justify-center py-12",
26846
+ children: /*#__PURE__*/jsxs("div", {
26847
+ className: "flex items-center gap-3 text-sm opacity-60",
26848
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26849
+ icon: "spinner",
26850
+ className: "h-4 w-4 animate-spin"
26851
+ }), /*#__PURE__*/jsx("span", {
26852
+ children: "Checking account status..."
26853
+ })]
26854
+ })
26855
+ }), authStatus === "authenticated" && profile && /*#__PURE__*/jsxs("div", {
26856
+ className: "space-y-4",
26857
+ children: [/*#__PURE__*/jsx("p", {
26858
+ className: "text-sm opacity-70",
26859
+ children: "You're signed in and ready to publish."
26860
+ }), /*#__PURE__*/jsxs("div", {
26861
+ className: "bg-white/5 border border-white/10 rounded-lg p-4 flex items-center gap-4",
26862
+ children: [/*#__PURE__*/jsx("div", {
26863
+ className: "flex items-center justify-center h-10 w-10 rounded-full bg-green-500/20 border border-green-500/30",
26864
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
26865
+ icon: "circle-check",
26866
+ className: "h-5 w-5 text-green-400"
26867
+ })
26868
+ }), /*#__PURE__*/jsxs("div", {
26869
+ className: "flex-1 min-w-0",
26870
+ children: [/*#__PURE__*/jsx("div", {
26871
+ className: "text-sm font-medium truncate",
26872
+ children: profile.displayName || profile.username
26873
+ }), /*#__PURE__*/jsxs("div", {
26874
+ className: "text-xs opacity-50 truncate",
26875
+ children: ["@", profile.username]
26876
+ })]
26877
+ })]
26878
+ }), /*#__PURE__*/jsx("button", {
26879
+ type: "button",
26880
+ onClick: handleSignOut,
26881
+ className: "text-xs opacity-40 hover:opacity-70 transition-opacity cursor-pointer",
26882
+ children: "Sign out"
26883
+ })]
26884
+ }), authStatus === "unauthenticated" && /*#__PURE__*/jsxs("div", {
26885
+ className: "space-y-4",
26886
+ children: [/*#__PURE__*/jsx("p", {
26887
+ className: "text-sm opacity-70",
26888
+ children: "Sign in to the Dash Registry to publish your dashboard."
26889
+ }), !authFlow && !isPolling && /*#__PURE__*/jsx("button", {
26890
+ type: "button",
26891
+ onClick: handleSignIn,
26892
+ 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",
26893
+ children: "Sign in to Registry"
26894
+ }), authFlow && isPolling && /*#__PURE__*/jsxs("div", {
26895
+ className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
26896
+ children: [/*#__PURE__*/jsx("p", {
26897
+ className: "text-xs text-blue-300/90",
26898
+ children: "Enter this code in your browser:"
26899
+ }), /*#__PURE__*/jsx("div", {
26900
+ className: "text-center",
26901
+ children: /*#__PURE__*/jsx("span", {
26902
+ className: "text-2xl font-mono font-bold tracking-widest text-white",
26903
+ children: authFlow.userCode
26904
+ })
26905
+ }), /*#__PURE__*/jsx("p", {
26906
+ className: "text-xs text-blue-300/70 text-center",
26907
+ children: "Waiting for authorization..."
26908
+ })]
26909
+ })]
26910
+ })]
26911
+ })
26912
+ }), /*#__PURE__*/jsx(Stepper.Step, {
26731
26913
  label: "Details",
26732
26914
  children: /*#__PURE__*/jsxs("div", {
26733
26915
  className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
@@ -26828,14 +27010,57 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26828
27010
  })]
26829
27011
  }) : result.success ? /*#__PURE__*/jsxs("div", {
26830
27012
  className: "space-y-3",
26831
- children: [/*#__PURE__*/jsxs("div", {
26832
- className: "flex items-center gap-2",
26833
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26834
- icon: "circle-check",
26835
- className: "h-4 w-4 text-green-400"
26836
- }), /*#__PURE__*/jsx("span", {
26837
- className: "text-sm",
26838
- children: "Dashboard prepared for publishing."
27013
+ children: [(_result$registrySubmi = result.registrySubmission) !== null && _result$registrySubmi !== void 0 && _result$registrySubmi.success ? /*#__PURE__*/jsxs("div", {
27014
+ className: "space-y-3",
27015
+ children: [/*#__PURE__*/jsxs("div", {
27016
+ className: "flex items-center gap-2",
27017
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27018
+ icon: "circle-check",
27019
+ className: "h-4 w-4 text-green-400"
27020
+ }), /*#__PURE__*/jsx("span", {
27021
+ className: "text-sm",
27022
+ children: "Published to Dash Registry"
27023
+ })]
27024
+ }), result.registrySubmission.registryUrl && /*#__PURE__*/jsxs("div", {
27025
+ className: "bg-white/5 border border-white/10 rounded-lg p-3",
27026
+ children: [/*#__PURE__*/jsx("div", {
27027
+ className: "text-xs opacity-50 mb-1",
27028
+ children: "Shareable Link"
27029
+ }), /*#__PURE__*/jsx("button", {
27030
+ type: "button",
27031
+ onClick: function onClick() {
27032
+ return window.mainApi.shell.openExternal(result.registrySubmission.registryUrl);
27033
+ },
27034
+ className: "text-sm text-blue-400 hover:underline cursor-pointer break-all text-left",
27035
+ children: result.registrySubmission.registryUrl
27036
+ })]
27037
+ }), result.registrySubmission.version && /*#__PURE__*/jsxs("div", {
27038
+ className: "text-xs opacity-50",
27039
+ children: ["Version: v", result.registrySubmission.version]
27040
+ })]
27041
+ }) : /*#__PURE__*/jsxs("div", {
27042
+ className: "space-y-3",
27043
+ children: [/*#__PURE__*/jsxs("div", {
27044
+ className: "flex items-center gap-2",
27045
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27046
+ icon: "circle-check",
27047
+ className: "h-4 w-4 text-green-400"
27048
+ }), /*#__PURE__*/jsx("span", {
27049
+ className: "text-sm",
27050
+ children: "Dashboard prepared for publishing."
27051
+ })]
27052
+ }), ((_result$registrySubmi2 = result.registrySubmission) === null || _result$registrySubmi2 === void 0 ? void 0 : _result$registrySubmi2.error) && /*#__PURE__*/jsx("div", {
27053
+ className: "bg-amber-500/10 border border-amber-500/20 rounded-lg p-3",
27054
+ children: /*#__PURE__*/jsxs("div", {
27055
+ className: "flex items-start gap-2",
27056
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27057
+ icon: "triangle-exclamation",
27058
+ className: "h-3.5 w-3.5 text-amber-400 mt-0.5 flex-shrink-0"
27059
+ }), /*#__PURE__*/jsxs("span", {
27060
+ className: "text-xs text-amber-300/90",
27061
+ children: ["Registry upload failed:", " ", result.registrySubmission.error, ". Your dashboard was saved locally."]
27062
+ })]
27063
+ })
26839
27064
  })]
26840
27065
  }), result.filePath && /*#__PURE__*/jsxs("div", {
26841
27066
  className: "text-xs opacity-50 break-all",
@@ -26899,7 +27124,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26899
27124
  className: "flex-1 text-center",
26900
27125
  children: /*#__PURE__*/jsxs("span", {
26901
27126
  className: "text-xs opacity-40",
26902
- children: ["Step ", step + 1, " of 4"]
27127
+ children: ["Step ", step + 1, " of 5"]
26903
27128
  })
26904
27129
  }), /*#__PURE__*/jsx("div", {
26905
27130
  className: "flex flex-row gap-2",
@@ -26907,7 +27132,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26907
27132
  title: "Done",
26908
27133
  onClick: handleClose
26909
27134
  }) : isLastStep ? /*#__PURE__*/jsx(Button2, {
26910
- title: isPublishing ? "Preparing..." : "Publish",
27135
+ title: isPublishing ? "Publishing..." : "Publish",
26911
27136
  onClick: handlePublish,
26912
27137
  disabled: isPublishing
26913
27138
  }) : /*#__PURE__*/jsx(Button2, {
@@ -27889,7 +28114,7 @@ var DashboardsSection = function DashboardsSection(_ref) {
27889
28114
  return window.mainApi.dashboardConfig.importDashboardConfig(appId);
27890
28115
  case 3:
27891
28116
  result = _context.sent;
27892
- if (result) {
28117
+ if (!(!result || result.canceled)) {
27893
28118
  _context.next = 4;
27894
28119
  break;
27895
28120
  }
@@ -27940,7 +28165,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
27940
28165
  }),
27941
28166
  active: isSelected,
27942
28167
  onClick: function onClick() {
27943
- return setSelectedId(ws.id);
28168
+ setSelectedId(ws.id);
28169
+ setInstallMode(null);
28170
+ setImportResult(null);
27944
28171
  },
27945
28172
  badge: String(widgetCount),
27946
28173
  className: isSelected ? "bg-white/10 opacity-100" : "",