@trops/dash-core 0.1.362 → 0.1.364

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
@@ -46099,22 +46099,26 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46099
46099
  _useState4 = _slicedToArray(_useState3, 2),
46100
46100
  authError = _useState4[0],
46101
46101
  setAuthError = _useState4[1];
46102
- var _useState5 = useState("patch"),
46102
+ var _useState5 = useState(null),
46103
46103
  _useState6 = _slicedToArray(_useState5, 2),
46104
- bump = _useState6[0],
46105
- setBump = _useState6[1];
46106
- var _useState7 = useState("public"),
46104
+ username = _useState6[0],
46105
+ setUsername = _useState6[1];
46106
+ var _useState7 = useState("patch"),
46107
46107
  _useState8 = _slicedToArray(_useState7, 2),
46108
- visibility = _useState8[0],
46109
- setVisibility = _useState8[1];
46110
- var _useState9 = useState(false),
46108
+ bump = _useState8[0],
46109
+ setBump = _useState8[1];
46110
+ var _useState9 = useState("public"),
46111
46111
  _useState0 = _slicedToArray(_useState9, 2),
46112
- isPublishing = _useState0[0],
46113
- setIsPublishing = _useState0[1];
46114
- var _useState1 = useState(null),
46112
+ visibility = _useState0[0],
46113
+ setVisibility = _useState0[1];
46114
+ var _useState1 = useState(false),
46115
46115
  _useState10 = _slicedToArray(_useState1, 2),
46116
- result = _useState10[0],
46117
- setResult = _useState10[1];
46116
+ isPublishing = _useState10[0],
46117
+ setIsPublishing = _useState10[1];
46118
+ var _useState11 = useState(null),
46119
+ _useState12 = _slicedToArray(_useState11, 2),
46120
+ result = _useState12[0],
46121
+ setResult = _useState12[1];
46118
46122
 
46119
46123
  // Reset modal state on open
46120
46124
  useEffect(function () {
@@ -46126,12 +46130,12 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46126
46130
  setResult(null);
46127
46131
  }, [isOpen]);
46128
46132
 
46129
- // Check auth status
46133
+ // Check auth status + fetch username for the "publishing as" preview
46130
46134
  useEffect(function () {
46131
46135
  if (!isOpen) return;
46132
46136
  var cancelled = false;
46133
46137
  _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
46134
- var status;
46138
+ var status, profile;
46135
46139
  return _regeneratorRuntime.wrap(function (_context) {
46136
46140
  while (1) switch (_context.prev = _context.next) {
46137
46141
  case 0:
@@ -46146,18 +46150,38 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46146
46150
  }
46147
46151
  return _context.abrupt("return");
46148
46152
  case 2:
46149
- setAuthStatus(status !== null && status !== void 0 && status.authenticated ? "authenticated" : "unauthenticated");
46150
- _context.next = 4;
46151
- break;
46153
+ if (!(status !== null && status !== void 0 && status.authenticated)) {
46154
+ _context.next = 5;
46155
+ break;
46156
+ }
46157
+ _context.next = 3;
46158
+ return window.mainApi.registryAuth.getProfile();
46152
46159
  case 3:
46153
- _context.prev = 3;
46160
+ profile = _context.sent;
46161
+ if (!cancelled) {
46162
+ _context.next = 4;
46163
+ break;
46164
+ }
46165
+ return _context.abrupt("return");
46166
+ case 4:
46167
+ setUsername((profile === null || profile === void 0 ? void 0 : profile.username) || null);
46168
+ setAuthStatus(profile !== null && profile !== void 0 && profile.username ? "authenticated" : "unauthenticated");
46169
+ _context.next = 6;
46170
+ break;
46171
+ case 5:
46172
+ setAuthStatus("unauthenticated");
46173
+ case 6:
46174
+ _context.next = 8;
46175
+ break;
46176
+ case 7:
46177
+ _context.prev = 7;
46154
46178
  _context["catch"](0);
46155
46179
  if (!cancelled) setAuthStatus("unauthenticated");
46156
- case 4:
46180
+ case 8:
46157
46181
  case "end":
46158
46182
  return _context.stop();
46159
46183
  }
46160
- }, _callee, null, [[0, 3]]);
46184
+ }, _callee, null, [[0, 7]]);
46161
46185
  }))();
46162
46186
  return function () {
46163
46187
  cancelled = true;
@@ -46347,27 +46371,30 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46347
46371
  className: "flex gap-2",
46348
46372
  children: [/*#__PURE__*/jsx("span", {
46349
46373
  className: "opacity-50 w-28 flex-shrink-0",
46350
- children: "Package"
46374
+ children: "Local"
46351
46375
  }), /*#__PURE__*/jsxs("span", {
46352
- className: "font-mono text-xs",
46353
- children: [widget.scope ? "".concat(widget.scope, "/") : "", widget.name]
46376
+ className: "font-mono text-xs opacity-80",
46377
+ children: [widget.scope ? "@".concat(widget.scope, "/") : "", (widget.name || "").replace(/^@[^/]+\//, "")]
46354
46378
  })]
46355
46379
  }), /*#__PURE__*/jsxs("div", {
46356
46380
  className: "flex gap-2 mt-1",
46357
46381
  children: [/*#__PURE__*/jsx("span", {
46358
46382
  className: "opacity-50 w-28 flex-shrink-0",
46359
- children: "Current"
46383
+ children: "Publishing as"
46360
46384
  }), /*#__PURE__*/jsxs("span", {
46361
- children: ["v", currentVersion]
46385
+ className: "font-mono text-xs text-indigo-300",
46386
+ children: [username ? "@".concat(username, "/") : "", (widget.name || "").replace(/^@[^/]+\//, ""), /*#__PURE__*/jsxs("span", {
46387
+ className: "text-gray-400",
46388
+ children: [" v", newVersion]
46389
+ })]
46362
46390
  })]
46363
46391
  }), /*#__PURE__*/jsxs("div", {
46364
46392
  className: "flex gap-2 mt-1",
46365
46393
  children: [/*#__PURE__*/jsx("span", {
46366
46394
  className: "opacity-50 w-28 flex-shrink-0",
46367
- children: "Publishing as"
46395
+ children: "Current"
46368
46396
  }), /*#__PURE__*/jsxs("span", {
46369
- className: "text-indigo-300",
46370
- children: ["v", newVersion]
46397
+ children: ["v", currentVersion]
46371
46398
  })]
46372
46399
  })]
46373
46400
  }), /*#__PURE__*/jsxs("div", {
@@ -46464,6 +46491,13 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46464
46491
  }), /*#__PURE__*/jsx("div", {
46465
46492
  className: "text-xs opacity-80",
46466
46493
  children: result.error
46494
+ }), Array.isArray(result.details) && result.details.length > 0 && /*#__PURE__*/jsx("ul", {
46495
+ className: "text-xs opacity-70 mt-2 list-disc list-inside space-y-0.5",
46496
+ children: result.details.map(function (d, i) {
46497
+ return /*#__PURE__*/jsx("li", {
46498
+ children: d
46499
+ }, i);
46500
+ })
46467
46501
  })]
46468
46502
  })]
46469
46503
  }), /*#__PURE__*/jsxs("div", {