@trops/dash-core 0.1.96 → 0.1.97

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