@trops/dash-core 0.1.273 → 0.1.274
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/electron/index.js +1 -1
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +31 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45206,7 +45206,7 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45206
45206
|
case 2:
|
|
45207
45207
|
list = _context.sent;
|
|
45208
45208
|
(list || []).forEach(function (w) {
|
|
45209
|
-
registryByName[w.name] = w;
|
|
45209
|
+
registryByName[w.packageId || w.name] = w;
|
|
45210
45210
|
});
|
|
45211
45211
|
case 3:
|
|
45212
45212
|
installedFromCM = Object.keys(cMap).filter(function (key) {
|
|
@@ -45374,17 +45374,32 @@ function useWidgetUpdates() {
|
|
|
45374
45374
|
if (installed.length === 0) return;
|
|
45375
45375
|
checkedRef.current = true;
|
|
45376
45376
|
setIsChecking(true);
|
|
45377
|
-
|
|
45378
|
-
|
|
45379
|
-
|
|
45380
|
-
|
|
45381
|
-
|
|
45377
|
+
|
|
45378
|
+
// Deduplicate by package — multiple widgets in the same package share one version
|
|
45379
|
+
var pkgMap = new Map();
|
|
45380
|
+
installed.forEach(function (w) {
|
|
45381
|
+
var pkgId = w.packageId || w.name;
|
|
45382
|
+
if (!pkgMap.has(pkgId)) {
|
|
45383
|
+
pkgMap.set(pkgId, {
|
|
45384
|
+
name: pkgId,
|
|
45385
|
+
version: w.version
|
|
45386
|
+
});
|
|
45387
|
+
}
|
|
45382
45388
|
});
|
|
45389
|
+
var payload = Array.from(pkgMap.values());
|
|
45383
45390
|
(_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.registry) === null || _window$mainApi === void 0 || _window$mainApi.checkUpdates(payload).then(function (results) {
|
|
45384
45391
|
if (Array.isArray(results) && results.length > 0) {
|
|
45385
45392
|
var map = new Map();
|
|
45386
45393
|
results.forEach(function (r) {
|
|
45387
|
-
|
|
45394
|
+
// Key by package ID (from result)
|
|
45395
|
+
map.set(r.name, r);
|
|
45396
|
+
// Also key by each widget's CM key so UI can look up by widget name
|
|
45397
|
+
installed.forEach(function (w) {
|
|
45398
|
+
var pkgId = w.packageId || w.name;
|
|
45399
|
+
if (pkgId === r.name) {
|
|
45400
|
+
map.set(w.name, r);
|
|
45401
|
+
}
|
|
45402
|
+
});
|
|
45388
45403
|
});
|
|
45389
45404
|
setUpdates(map);
|
|
45390
45405
|
}
|
|
@@ -45397,7 +45412,7 @@ function useWidgetUpdates() {
|
|
|
45397
45412
|
// Update a single widget by downloading the latest version
|
|
45398
45413
|
var updateWidget = React.useCallback(/*#__PURE__*/function () {
|
|
45399
45414
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
|
|
45400
|
-
var info, resolvedUrl;
|
|
45415
|
+
var info, widget, packageId, resolvedUrl;
|
|
45401
45416
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
45402
45417
|
while (1) switch (_context.prev = _context.next) {
|
|
45403
45418
|
case 0:
|
|
@@ -45408,11 +45423,16 @@ function useWidgetUpdates() {
|
|
|
45408
45423
|
}
|
|
45409
45424
|
return _context.abrupt("return");
|
|
45410
45425
|
case 1:
|
|
45426
|
+
// Use packageId for install — name may be a CM key (widget-level)
|
|
45427
|
+
widget = installedWidgets.find(function (w) {
|
|
45428
|
+
return w.name === name;
|
|
45429
|
+
});
|
|
45430
|
+
packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || info.name || name;
|
|
45411
45431
|
setIsUpdating(name);
|
|
45412
45432
|
_context.prev = 2;
|
|
45413
|
-
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g,
|
|
45433
|
+
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g, packageId);
|
|
45414
45434
|
_context.next = 3;
|
|
45415
|
-
return window.mainApi.widgets.install(
|
|
45435
|
+
return window.mainApi.widgets.install(packageId, resolvedUrl);
|
|
45416
45436
|
case 3:
|
|
45417
45437
|
// Remove from updates map on success
|
|
45418
45438
|
setUpdates(function (prev) {
|
|
@@ -45439,7 +45459,7 @@ function useWidgetUpdates() {
|
|
|
45439
45459
|
return function (_x) {
|
|
45440
45460
|
return _ref.apply(this, arguments);
|
|
45441
45461
|
};
|
|
45442
|
-
}(), [updates, onUpdated]);
|
|
45462
|
+
}(), [updates, onUpdated, installedWidgets]);
|
|
45443
45463
|
return {
|
|
45444
45464
|
updates: updates,
|
|
45445
45465
|
isChecking: isChecking,
|