@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.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';
@@ -3061,7 +3061,7 @@ var LayoutManagerPicker = function LayoutManagerPicker(_ref2) {
3061
3061
  });
3062
3062
  };
3063
3063
 
3064
- var FOLDER_ICONS$1 = [
3064
+ var FOLDER_ICONS = [
3065
3065
  // General / UI
3066
3066
  "home", "folder", "star", "heart", "bookmark", "tag", "flag", "bell", "circle", "square", "circle-check", "thumbs-up", "clone", "signal",
3067
3067
  // Communication
@@ -3084,7 +3084,7 @@ var FOLDER_ICONS$1 = [
3084
3084
  "file", "file-code", "clipboard", "book", "pen", "pencil",
3085
3085
  // Misc
3086
3086
  "magnifying-glass", "eye", "lock", "key", "shield", "clock", "calendar", "link"];
3087
- var ALL_ICON_NAMES$1 = Object.keys(DashReact).filter(function (key) {
3087
+ var ALL_ICON_NAMES = Object.keys(DashReact).filter(function (key) {
3088
3088
  return key.startsWith("fa") && key !== "fas";
3089
3089
  }).map(function (key) {
3090
3090
  var _DashReact$key;
@@ -3092,8 +3092,8 @@ var ALL_ICON_NAMES$1 = Object.keys(DashReact).filter(function (key) {
3092
3092
  }).filter(Boolean).filter(function (name, index, arr) {
3093
3093
  return arr.indexOf(name) === index;
3094
3094
  }).sort();
3095
- var CURATED_SET$1 = new Set(FOLDER_ICONS$1);
3096
- var IconPicker$1 = function IconPicker(_ref) {
3095
+ var CURATED_SET = new Set(FOLDER_ICONS);
3096
+ var IconPicker = function IconPicker(_ref) {
3097
3097
  var selectedIcon = _ref.selectedIcon,
3098
3098
  onSelectIcon = _ref.onSelectIcon;
3099
3099
  var _useState = useState(""),
@@ -3102,13 +3102,13 @@ var IconPicker$1 = function IconPicker(_ref) {
3102
3102
  setSearch = _useState2[1];
3103
3103
  var query = search.trim().toLowerCase();
3104
3104
  var filteredCurated = useMemo(function () {
3105
- return query ? FOLDER_ICONS$1.filter(function (name) {
3105
+ return query ? FOLDER_ICONS.filter(function (name) {
3106
3106
  return name.includes(query);
3107
- }) : FOLDER_ICONS$1;
3107
+ }) : FOLDER_ICONS;
3108
3108
  }, [query]);
3109
3109
  var remainingIcons = useMemo(function () {
3110
- var all = ALL_ICON_NAMES$1.filter(function (name) {
3111
- return !CURATED_SET$1.has(name);
3110
+ var all = ALL_ICON_NAMES.filter(function (name) {
3111
+ return !CURATED_SET.has(name);
3112
3112
  });
3113
3113
  return query ? all.filter(function (name) {
3114
3114
  return name.includes(query);
@@ -3163,26 +3163,27 @@ var IconPicker$1 = function IconPicker(_ref) {
3163
3163
  })]
3164
3164
  });
3165
3165
  };
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;
3166
+
3167
+ var FolderDetail = function FolderDetail(_ref) {
3168
+ var _ref$menuItem = _ref.menuItem,
3169
+ menuItem = _ref$menuItem === void 0 ? null : _ref$menuItem,
3170
+ _ref$workspaces = _ref.workspaces,
3171
+ workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
3172
+ _ref$isEditing = _ref.isEditing,
3173
+ isEditing = _ref$isEditing === void 0 ? false : _ref$isEditing,
3174
+ _ref$isCreating = _ref.isCreating,
3175
+ isCreating = _ref$isCreating === void 0 ? false : _ref$isCreating,
3176
+ _ref$formName = _ref.formName,
3177
+ formName = _ref$formName === void 0 ? "" : _ref$formName,
3178
+ setFormName = _ref.setFormName,
3179
+ _ref$formIcon = _ref.formIcon,
3180
+ formIcon = _ref$formIcon === void 0 ? "folder" : _ref$formIcon,
3181
+ setFormIcon = _ref.setFormIcon,
3182
+ onSaveEdit = _ref.onSaveEdit,
3183
+ onCancelEdit = _ref.onCancelEdit,
3184
+ onStartEdit = _ref.onStartEdit,
3185
+ onCreate = _ref.onCreate,
3186
+ onDelete = _ref.onDelete;
3186
3187
  var isFormMode = isEditing || isCreating;
3187
3188
 
3188
3189
  // Get dashboards in this folder
@@ -3209,7 +3210,7 @@ var FolderDetail = function FolderDetail(_ref2) {
3209
3210
  children: [/*#__PURE__*/jsx("span", {
3210
3211
  className: "flex-shrink-0 text-sm font-medium opacity-70",
3211
3212
  children: "Icon"
3212
- }), /*#__PURE__*/jsx(IconPicker$1, {
3213
+ }), /*#__PURE__*/jsx(IconPicker, {
3213
3214
  selectedIcon: formIcon,
3214
3215
  onSelectIcon: setFormIcon
3215
3216
  })]
@@ -3500,7 +3501,7 @@ var LayoutManagerModal = function LayoutManagerModal(_ref) {
3500
3501
  placeholder: "Folder name"
3501
3502
  }), /*#__PURE__*/jsx("div", {
3502
3503
  className: "grid grid-cols-10 gap-2",
3503
- children: FOLDER_ICONS$1.map(function (icon) {
3504
+ children: FOLDER_ICONS.map(function (icon) {
3504
3505
  var isIconSelected = icon === newFolderIcon;
3505
3506
  return /*#__PURE__*/jsx("div", {
3506
3507
  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 +26462,6 @@ var StarRating = function StarRating(_ref) {
26461
26462
  });
26462
26463
  };
26463
26464
 
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
26465
  var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication", "developer", "sales", "marketing", "finance", "project-management", "social", "news", "utilities"];
26568
26466
 
26569
26467
  /**
@@ -26571,12 +26469,14 @@ var DASHBOARD_TAGS = ["productivity", "monitoring", "analytics", "communication"
26571
26469
  * for registry publishing.
26572
26470
  *
26573
26471
  * Steps:
26574
- * 1. DetailsAuthor name (required) + description (textarea)
26472
+ * 0. AccountAuth check, sign-in prompt, profile display
26473
+ * 1. Details — Author name (pre-filled from profile) + description (textarea)
26575
26474
  * 2. Tags — Predefined tag selection with toggle-pill styling
26576
26475
  * 3. Icon — Full icon picker with search
26577
26476
  * 4. Publish — Review summary, publish action, result display
26578
26477
  */
26579
26478
  var PublishDashboardModal = function PublishDashboardModal(_ref) {
26479
+ var _result$registrySubmi, _result$registrySubmi2;
26580
26480
  var isOpen = _ref.isOpen,
26581
26481
  setIsOpen = _ref.setIsOpen,
26582
26482
  appId = _ref.appId,
@@ -26593,39 +26493,129 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26593
26493
  step = _useState2[0],
26594
26494
  setStep = _useState2[1];
26595
26495
 
26596
- // Step 1: Details
26597
- var _useState3 = useState(""),
26496
+ // Step 0: Account / Auth
26497
+ var _useState3 = useState("loading"),
26598
26498
  _useState4 = _slicedToArray(_useState3, 2),
26599
- authorName = _useState4[0],
26600
- setAuthorName = _useState4[1];
26601
- var _useState5 = useState(""),
26499
+ authStatus = _useState4[0],
26500
+ setAuthStatus = _useState4[1]; // "loading" | "authenticated" | "unauthenticated"
26501
+ var _useState5 = useState(null),
26602
26502
  _useState6 = _slicedToArray(_useState5, 2),
26603
- description = _useState6[0],
26604
- setDescription = _useState6[1];
26503
+ profile = _useState6[0],
26504
+ setProfile = _useState6[1];
26505
+ var _useState7 = useState(null),
26506
+ _useState8 = _slicedToArray(_useState7, 2),
26507
+ authFlow = _useState8[0],
26508
+ setAuthFlow = _useState8[1];
26509
+ var _useState9 = useState(false),
26510
+ _useState0 = _slicedToArray(_useState9, 2),
26511
+ isPolling = _useState0[0],
26512
+ setIsPolling = _useState0[1];
26513
+
26514
+ // Step 1: Details
26515
+ var _useState1 = useState(""),
26516
+ _useState10 = _slicedToArray(_useState1, 2),
26517
+ authorName = _useState10[0],
26518
+ setAuthorName = _useState10[1];
26519
+ var _useState11 = useState(""),
26520
+ _useState12 = _slicedToArray(_useState11, 2),
26521
+ description = _useState12[0],
26522
+ setDescription = _useState12[1];
26605
26523
 
26606
26524
  // Step 2: Tags
26607
- var _useState7 = useState([]),
26608
- _useState8 = _slicedToArray(_useState7, 2),
26609
- selectedTags = _useState8[0],
26610
- setSelectedTags = _useState8[1];
26525
+ var _useState13 = useState([]),
26526
+ _useState14 = _slicedToArray(_useState13, 2),
26527
+ selectedTags = _useState14[0],
26528
+ setSelectedTags = _useState14[1];
26611
26529
 
26612
26530
  // Step 3: Icon
26613
- var _useState9 = useState("grip"),
26614
- _useState0 = _slicedToArray(_useState9, 2),
26615
- icon = _useState0[0],
26616
- setIcon = _useState0[1];
26531
+ var _useState15 = useState("grip"),
26532
+ _useState16 = _slicedToArray(_useState15, 2),
26533
+ icon = _useState16[0],
26534
+ setIcon = _useState16[1];
26617
26535
 
26618
26536
  // 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];
26537
+ var _useState17 = useState(false),
26538
+ _useState18 = _slicedToArray(_useState17, 2),
26539
+ isPublishing = _useState18[0],
26540
+ setIsPublishing = _useState18[1];
26541
+ var _useState19 = useState(null),
26542
+ _useState20 = _slicedToArray(_useState19, 2),
26543
+ result = _useState20[0],
26544
+ setResult = _useState20[1];
26545
+
26546
+ // Check auth status on mount
26547
+ useEffect(function () {
26548
+ if (!isOpen) return;
26549
+ var cancelled = false;
26550
+ function checkAuth() {
26551
+ return _checkAuth.apply(this, arguments);
26552
+ }
26553
+ function _checkAuth() {
26554
+ _checkAuth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26555
+ var status, userProfile;
26556
+ return _regeneratorRuntime.wrap(function (_context) {
26557
+ while (1) switch (_context.prev = _context.next) {
26558
+ case 0:
26559
+ _context.prev = 0;
26560
+ _context.next = 1;
26561
+ return window.mainApi.registryAuth.getStatus();
26562
+ case 1:
26563
+ status = _context.sent;
26564
+ if (!cancelled) {
26565
+ _context.next = 2;
26566
+ break;
26567
+ }
26568
+ return _context.abrupt("return");
26569
+ case 2:
26570
+ if (!status.authenticated) {
26571
+ _context.next = 5;
26572
+ break;
26573
+ }
26574
+ _context.next = 3;
26575
+ return window.mainApi.registryAuth.getProfile();
26576
+ case 3:
26577
+ userProfile = _context.sent;
26578
+ if (!cancelled) {
26579
+ _context.next = 4;
26580
+ break;
26581
+ }
26582
+ return _context.abrupt("return");
26583
+ case 4:
26584
+ setProfile(userProfile);
26585
+ setAuthStatus("authenticated");
26586
+ if (userProfile !== null && userProfile !== void 0 && userProfile.displayName && !authorName) {
26587
+ setAuthorName(userProfile.displayName);
26588
+ }
26589
+ _context.next = 6;
26590
+ break;
26591
+ case 5:
26592
+ setAuthStatus("unauthenticated");
26593
+ case 6:
26594
+ _context.next = 8;
26595
+ break;
26596
+ case 7:
26597
+ _context.prev = 7;
26598
+ _context["catch"](0);
26599
+ if (!cancelled) setAuthStatus("unauthenticated");
26600
+ case 8:
26601
+ case "end":
26602
+ return _context.stop();
26603
+ }
26604
+ }, _callee, null, [[0, 7]]);
26605
+ }));
26606
+ return _checkAuth.apply(this, arguments);
26607
+ }
26608
+ checkAuth();
26609
+ return function () {
26610
+ cancelled = true;
26611
+ };
26612
+ }, [isOpen]);
26627
26613
  function resetState() {
26628
26614
  setStep(0);
26615
+ setAuthStatus("loading");
26616
+ setProfile(null);
26617
+ setAuthFlow(null);
26618
+ setIsPolling(false);
26629
26619
  setAuthorName("");
26630
26620
  setDescription("");
26631
26621
  setSelectedTags([]);
@@ -26638,8 +26628,9 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26638
26628
  setTimeout(resetState, 200);
26639
26629
  }
26640
26630
  function handleStepChange(nextStep) {
26641
- if (step === 0 && nextStep > 0 && !authorName.trim()) return;
26642
- if (step === 1 && nextStep > 1 && selectedTags.length === 0) return;
26631
+ if (step === 0 && nextStep > 0 && authStatus !== "authenticated") return;
26632
+ if (step === 1 && nextStep > 1 && !authorName.trim()) return;
26633
+ if (step === 2 && nextStep > 2 && selectedTags.length === 0) return;
26643
26634
  setStep(nextStep);
26644
26635
  }
26645
26636
  function toggleTag(tag) {
@@ -26653,54 +26644,167 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26653
26644
  return _handlePublish.apply(this, arguments);
26654
26645
  }
26655
26646
  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) {
26647
+ _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
26648
+ var options, res, _t2;
26649
+ return _regeneratorRuntime.wrap(function (_context2) {
26650
+ while (1) switch (_context2.prev = _context2.next) {
26660
26651
  case 0:
26661
26652
  if (!(!appId || !workspaceId)) {
26662
- _context.next = 1;
26653
+ _context2.next = 1;
26663
26654
  break;
26664
26655
  }
26665
- return _context.abrupt("return");
26656
+ return _context2.abrupt("return");
26666
26657
  case 1:
26667
26658
  setIsPublishing(true);
26668
26659
  setResult(null);
26669
- _context.prev = 2;
26660
+ _context2.prev = 2;
26670
26661
  options = {
26671
26662
  authorName: authorName.trim(),
26672
26663
  description: description.trim() || undefined,
26673
26664
  tags: selectedTags,
26674
26665
  icon: icon || undefined
26675
26666
  };
26676
- _context.next = 3;
26667
+ _context2.next = 3;
26677
26668
  return window.mainApi.dashboardConfig.prepareDashboardForPublish(appId, workspaceId, options);
26678
26669
  case 3:
26679
- res = _context.sent;
26670
+ res = _context2.sent;
26680
26671
  setResult(res);
26681
- _context.next = 5;
26672
+ _context2.next = 5;
26682
26673
  break;
26683
26674
  case 4:
26684
- _context.prev = 4;
26685
- _t = _context["catch"](2);
26675
+ _context2.prev = 4;
26676
+ _t2 = _context2["catch"](2);
26686
26677
  setResult({
26687
26678
  success: false,
26688
- error: _t.message || "Failed to prepare dashboard for publish."
26679
+ error: _t2.message || "Failed to prepare dashboard for publish."
26689
26680
  });
26690
26681
  case 5:
26691
- _context.prev = 5;
26682
+ _context2.prev = 5;
26692
26683
  setIsPublishing(false);
26693
- return _context.finish(5);
26684
+ return _context2.finish(5);
26694
26685
  case 6:
26695
26686
  case "end":
26696
- return _context.stop();
26687
+ return _context2.stop();
26697
26688
  }
26698
- }, _callee, null, [[2, 4, 5, 6]]);
26689
+ }, _callee2, null, [[2, 4, 5, 6]]);
26699
26690
  }));
26700
26691
  return _handlePublish.apply(this, arguments);
26701
26692
  }
26702
- var isLastStep = step === 3;
26703
- var canAdvance = step === 0 ? !!authorName.trim() : step === 1 ? selectedTags.length > 0 : true;
26693
+ function handleSignIn() {
26694
+ return _handleSignIn.apply(this, arguments);
26695
+ }
26696
+ function _handleSignIn() {
26697
+ _handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
26698
+ var flow, interval, poll;
26699
+ return _regeneratorRuntime.wrap(function (_context4) {
26700
+ while (1) switch (_context4.prev = _context4.next) {
26701
+ case 0:
26702
+ _context4.prev = 0;
26703
+ _context4.next = 1;
26704
+ return window.mainApi.registryAuth.initiateLogin();
26705
+ case 1:
26706
+ flow = _context4.sent;
26707
+ setAuthFlow(flow);
26708
+
26709
+ // Open verification URL in browser
26710
+ if (flow.verificationUrlComplete) {
26711
+ window.mainApi.shell.openExternal(flow.verificationUrlComplete);
26712
+ }
26713
+
26714
+ // Start polling
26715
+ setIsPolling(true);
26716
+ interval = (flow.interval || 5) * 1000;
26717
+ poll = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
26718
+ var pollResult, userProfile;
26719
+ return _regeneratorRuntime.wrap(function (_context3) {
26720
+ while (1) switch (_context3.prev = _context3.next) {
26721
+ case 0:
26722
+ _context3.prev = 0;
26723
+ _context3.next = 1;
26724
+ return window.mainApi.registryAuth.pollToken(flow.deviceCode);
26725
+ case 1:
26726
+ pollResult = _context3.sent;
26727
+ if (!(pollResult.status === "authorized")) {
26728
+ _context3.next = 3;
26729
+ break;
26730
+ }
26731
+ clearInterval(poll);
26732
+ setIsPolling(false);
26733
+ setAuthFlow(null);
26734
+ // Fetch profile and update auth state
26735
+ _context3.next = 2;
26736
+ return window.mainApi.registryAuth.getProfile();
26737
+ case 2:
26738
+ userProfile = _context3.sent;
26739
+ setProfile(userProfile);
26740
+ setAuthStatus("authenticated");
26741
+ if (userProfile !== null && userProfile !== void 0 && userProfile.displayName && !authorName) {
26742
+ setAuthorName(userProfile.displayName);
26743
+ }
26744
+ _context3.next = 4;
26745
+ break;
26746
+ case 3:
26747
+ if (pollResult.status === "expired") {
26748
+ clearInterval(poll);
26749
+ setIsPolling(false);
26750
+ setAuthFlow(null);
26751
+ }
26752
+ case 4:
26753
+ _context3.next = 6;
26754
+ break;
26755
+ case 5:
26756
+ _context3.prev = 5;
26757
+ _context3["catch"](0);
26758
+ clearInterval(poll);
26759
+ setIsPolling(false);
26760
+ case 6:
26761
+ case "end":
26762
+ return _context3.stop();
26763
+ }
26764
+ }, _callee3, null, [[0, 5]]);
26765
+ })), interval);
26766
+ _context4.next = 3;
26767
+ break;
26768
+ case 2:
26769
+ _context4.prev = 2;
26770
+ _context4["catch"](0);
26771
+ case 3:
26772
+ case "end":
26773
+ return _context4.stop();
26774
+ }
26775
+ }, _callee4, null, [[0, 2]]);
26776
+ }));
26777
+ return _handleSignIn.apply(this, arguments);
26778
+ }
26779
+ function handleSignOut() {
26780
+ return _handleSignOut.apply(this, arguments);
26781
+ }
26782
+ function _handleSignOut() {
26783
+ _handleSignOut = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
26784
+ return _regeneratorRuntime.wrap(function (_context5) {
26785
+ while (1) switch (_context5.prev = _context5.next) {
26786
+ case 0:
26787
+ _context5.prev = 0;
26788
+ _context5.next = 1;
26789
+ return window.mainApi.registryAuth.logout();
26790
+ case 1:
26791
+ setAuthStatus("unauthenticated");
26792
+ setProfile(null);
26793
+ _context5.next = 3;
26794
+ break;
26795
+ case 2:
26796
+ _context5.prev = 2;
26797
+ _context5["catch"](0);
26798
+ case 3:
26799
+ case "end":
26800
+ return _context5.stop();
26801
+ }
26802
+ }, _callee5, null, [[0, 2]]);
26803
+ }));
26804
+ return _handleSignOut.apply(this, arguments);
26805
+ }
26806
+ var isLastStep = step === 4;
26807
+ var canAdvance = step === 0 ? authStatus === "authenticated" : step === 1 ? !!authorName.trim() : step === 2 ? selectedTags.length > 0 : true;
26704
26808
  return /*#__PURE__*/jsx(Modal, {
26705
26809
  isOpen: isOpen,
26706
26810
  setIsOpen: handleClose,
@@ -26728,6 +26832,78 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26728
26832
  showNavigation: false,
26729
26833
  className: "flex-1 min-h-0 flex flex-col px-6 pt-2",
26730
26834
  children: [/*#__PURE__*/jsx(Stepper.Step, {
26835
+ label: "Account",
26836
+ children: /*#__PURE__*/jsxs("div", {
26837
+ className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
26838
+ children: [authStatus === "loading" && /*#__PURE__*/jsx("div", {
26839
+ className: "flex items-center justify-center py-12",
26840
+ children: /*#__PURE__*/jsxs("div", {
26841
+ className: "flex items-center gap-3 text-sm opacity-60",
26842
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
26843
+ icon: "spinner",
26844
+ className: "h-4 w-4 animate-spin"
26845
+ }), /*#__PURE__*/jsx("span", {
26846
+ children: "Checking account status..."
26847
+ })]
26848
+ })
26849
+ }), authStatus === "authenticated" && profile && /*#__PURE__*/jsxs("div", {
26850
+ className: "space-y-4",
26851
+ children: [/*#__PURE__*/jsx("p", {
26852
+ className: "text-sm opacity-70",
26853
+ children: "You're signed in and ready to publish."
26854
+ }), /*#__PURE__*/jsxs("div", {
26855
+ className: "bg-white/5 border border-white/10 rounded-lg p-4 flex items-center gap-4",
26856
+ children: [/*#__PURE__*/jsx("div", {
26857
+ className: "flex items-center justify-center h-10 w-10 rounded-full bg-green-500/20 border border-green-500/30",
26858
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
26859
+ icon: "circle-check",
26860
+ className: "h-5 w-5 text-green-400"
26861
+ })
26862
+ }), /*#__PURE__*/jsxs("div", {
26863
+ className: "flex-1 min-w-0",
26864
+ children: [/*#__PURE__*/jsx("div", {
26865
+ className: "text-sm font-medium truncate",
26866
+ children: profile.displayName || profile.username
26867
+ }), /*#__PURE__*/jsxs("div", {
26868
+ className: "text-xs opacity-50 truncate",
26869
+ children: ["@", profile.username]
26870
+ })]
26871
+ })]
26872
+ }), /*#__PURE__*/jsx("button", {
26873
+ type: "button",
26874
+ onClick: handleSignOut,
26875
+ className: "text-xs opacity-40 hover:opacity-70 transition-opacity cursor-pointer",
26876
+ children: "Sign out"
26877
+ })]
26878
+ }), authStatus === "unauthenticated" && /*#__PURE__*/jsxs("div", {
26879
+ className: "space-y-4",
26880
+ children: [/*#__PURE__*/jsx("p", {
26881
+ className: "text-sm opacity-70",
26882
+ children: "Sign in to the Dash Registry to publish your dashboard."
26883
+ }), !authFlow && !isPolling && /*#__PURE__*/jsx("button", {
26884
+ type: "button",
26885
+ onClick: handleSignIn,
26886
+ 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",
26887
+ children: "Sign in to Registry"
26888
+ }), authFlow && isPolling && /*#__PURE__*/jsxs("div", {
26889
+ className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
26890
+ children: [/*#__PURE__*/jsx("p", {
26891
+ className: "text-xs text-blue-300/90",
26892
+ children: "Enter this code in your browser:"
26893
+ }), /*#__PURE__*/jsx("div", {
26894
+ className: "text-center",
26895
+ children: /*#__PURE__*/jsx("span", {
26896
+ className: "text-2xl font-mono font-bold tracking-widest text-white",
26897
+ children: authFlow.userCode
26898
+ })
26899
+ }), /*#__PURE__*/jsx("p", {
26900
+ className: "text-xs text-blue-300/70 text-center",
26901
+ children: "Waiting for authorization..."
26902
+ })]
26903
+ })]
26904
+ })]
26905
+ })
26906
+ }), /*#__PURE__*/jsx(Stepper.Step, {
26731
26907
  label: "Details",
26732
26908
  children: /*#__PURE__*/jsxs("div", {
26733
26909
  className: "flex-1 min-h-0 overflow-y-auto pb-4 space-y-5",
@@ -26828,14 +27004,57 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26828
27004
  })]
26829
27005
  }) : result.success ? /*#__PURE__*/jsxs("div", {
26830
27006
  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."
27007
+ children: [(_result$registrySubmi = result.registrySubmission) !== null && _result$registrySubmi !== void 0 && _result$registrySubmi.success ? /*#__PURE__*/jsxs("div", {
27008
+ className: "space-y-3",
27009
+ children: [/*#__PURE__*/jsxs("div", {
27010
+ className: "flex items-center gap-2",
27011
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27012
+ icon: "circle-check",
27013
+ className: "h-4 w-4 text-green-400"
27014
+ }), /*#__PURE__*/jsx("span", {
27015
+ className: "text-sm",
27016
+ children: "Published to Dash Registry"
27017
+ })]
27018
+ }), result.registrySubmission.registryUrl && /*#__PURE__*/jsxs("div", {
27019
+ className: "bg-white/5 border border-white/10 rounded-lg p-3",
27020
+ children: [/*#__PURE__*/jsx("div", {
27021
+ className: "text-xs opacity-50 mb-1",
27022
+ children: "Shareable Link"
27023
+ }), /*#__PURE__*/jsx("button", {
27024
+ type: "button",
27025
+ onClick: function onClick() {
27026
+ return window.mainApi.shell.openExternal(result.registrySubmission.registryUrl);
27027
+ },
27028
+ className: "text-sm text-blue-400 hover:underline cursor-pointer break-all text-left",
27029
+ children: result.registrySubmission.registryUrl
27030
+ })]
27031
+ }), result.registrySubmission.version && /*#__PURE__*/jsxs("div", {
27032
+ className: "text-xs opacity-50",
27033
+ children: ["Version: v", result.registrySubmission.version]
27034
+ })]
27035
+ }) : /*#__PURE__*/jsxs("div", {
27036
+ className: "space-y-3",
27037
+ children: [/*#__PURE__*/jsxs("div", {
27038
+ className: "flex items-center gap-2",
27039
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27040
+ icon: "circle-check",
27041
+ className: "h-4 w-4 text-green-400"
27042
+ }), /*#__PURE__*/jsx("span", {
27043
+ className: "text-sm",
27044
+ children: "Dashboard prepared for publishing."
27045
+ })]
27046
+ }), ((_result$registrySubmi2 = result.registrySubmission) === null || _result$registrySubmi2 === void 0 ? void 0 : _result$registrySubmi2.error) && /*#__PURE__*/jsx("div", {
27047
+ className: "bg-amber-500/10 border border-amber-500/20 rounded-lg p-3",
27048
+ children: /*#__PURE__*/jsxs("div", {
27049
+ className: "flex items-start gap-2",
27050
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
27051
+ icon: "triangle-exclamation",
27052
+ className: "h-3.5 w-3.5 text-amber-400 mt-0.5 flex-shrink-0"
27053
+ }), /*#__PURE__*/jsxs("span", {
27054
+ className: "text-xs text-amber-300/90",
27055
+ children: ["Registry upload failed:", " ", result.registrySubmission.error, ". Your dashboard was saved locally."]
27056
+ })]
27057
+ })
26839
27058
  })]
26840
27059
  }), result.filePath && /*#__PURE__*/jsxs("div", {
26841
27060
  className: "text-xs opacity-50 break-all",
@@ -26899,7 +27118,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26899
27118
  className: "flex-1 text-center",
26900
27119
  children: /*#__PURE__*/jsxs("span", {
26901
27120
  className: "text-xs opacity-40",
26902
- children: ["Step ", step + 1, " of 4"]
27121
+ children: ["Step ", step + 1, " of 5"]
26903
27122
  })
26904
27123
  }), /*#__PURE__*/jsx("div", {
26905
27124
  className: "flex flex-row gap-2",
@@ -26907,7 +27126,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
26907
27126
  title: "Done",
26908
27127
  onClick: handleClose
26909
27128
  }) : isLastStep ? /*#__PURE__*/jsx(Button2, {
26910
- title: isPublishing ? "Preparing..." : "Publish",
27129
+ title: isPublishing ? "Publishing..." : "Publish",
26911
27130
  onClick: handlePublish,
26912
27131
  disabled: isPublishing
26913
27132
  }) : /*#__PURE__*/jsx(Button2, {
@@ -27889,7 +28108,7 @@ var DashboardsSection = function DashboardsSection(_ref) {
27889
28108
  return window.mainApi.dashboardConfig.importDashboardConfig(appId);
27890
28109
  case 3:
27891
28110
  result = _context.sent;
27892
- if (result) {
28111
+ if (!(!result || result.canceled)) {
27893
28112
  _context.next = 4;
27894
28113
  break;
27895
28114
  }
@@ -27940,7 +28159,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
27940
28159
  }),
27941
28160
  active: isSelected,
27942
28161
  onClick: function onClick() {
27943
- return setSelectedId(ws.id);
28162
+ setSelectedId(ws.id);
28163
+ setInstallMode(null);
28164
+ setImportResult(null);
27944
28165
  },
27945
28166
  badge: String(widgetCount),
27946
28167
  className: isSelected ? "bg-white/10 opacity-100" : "",