@trops/dash-core 0.1.252 → 0.1.254
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 +36 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23634,8 +23634,6 @@ var WidgetNotFound = function WidgetNotFound(_ref) {
|
|
|
23634
23634
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
23635
23635
|
needsAuth = _useState12[0],
|
|
23636
23636
|
setNeedsAuth = _useState12[1];
|
|
23637
|
-
var _useRegistryAuth = useRegistryAuth(),
|
|
23638
|
-
checkAuth = _useRegistryAuth.checkAuth;
|
|
23639
23637
|
var lookupWidget = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23640
23638
|
var _getWidgetSearchQuery, packageName, widgetName, pkg, result;
|
|
23641
23639
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
@@ -23693,7 +23691,7 @@ var WidgetNotFound = function WidgetNotFound(_ref) {
|
|
|
23693
23691
|
}, _callee, null, [[1, 6]]);
|
|
23694
23692
|
})), [component]);
|
|
23695
23693
|
var handleInstall = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
23696
|
-
var
|
|
23694
|
+
var _window$mainApi, status, packageName, packageScope, downloadUrl, packageVersion, scopedId, resolvedUrl, msg, _t3;
|
|
23697
23695
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
23698
23696
|
while (1) switch (_context2.prev = _context2.next) {
|
|
23699
23697
|
case 0:
|
|
@@ -23707,44 +23705,51 @@ var WidgetNotFound = function WidgetNotFound(_ref) {
|
|
|
23707
23705
|
setInstallError(null);
|
|
23708
23706
|
setNeedsAuth(false);
|
|
23709
23707
|
_context2.prev = 2;
|
|
23710
|
-
_context2.
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23708
|
+
_context2.prev = 3;
|
|
23709
|
+
_context2.next = 4;
|
|
23710
|
+
return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.registryAuth) === null || _window$mainApi === void 0 ? void 0 : _window$mainApi.getStatus();
|
|
23711
|
+
case 4:
|
|
23712
|
+
status = _context2.sent;
|
|
23713
|
+
if (status !== null && status !== void 0 && status.authenticated) {
|
|
23714
|
+
_context2.next = 5;
|
|
23716
23715
|
break;
|
|
23717
23716
|
}
|
|
23718
23717
|
setNeedsAuth(true);
|
|
23719
23718
|
setIsInstalling(false);
|
|
23720
23719
|
return _context2.abrupt("return");
|
|
23721
|
-
case
|
|
23720
|
+
case 5:
|
|
23721
|
+
_context2.next = 7;
|
|
23722
|
+
break;
|
|
23723
|
+
case 6:
|
|
23724
|
+
_context2.prev = 6;
|
|
23725
|
+
_context2["catch"](3);
|
|
23726
|
+
case 7:
|
|
23722
23727
|
packageName = registryWidget.packageName, packageScope = registryWidget.packageScope, downloadUrl = registryWidget.downloadUrl, packageVersion = registryWidget.packageVersion;
|
|
23723
23728
|
scopedId = packageScope ? "@".concat(packageScope.replace(/^@/, ""), "/").concat(packageName) : packageName;
|
|
23724
23729
|
resolvedUrl = downloadUrl.replace(/\{version\}/g, packageVersion).replace(/\{name\}/g, packageName);
|
|
23725
|
-
_context2.next =
|
|
23730
|
+
_context2.next = 8;
|
|
23726
23731
|
return window.mainApi.widgets.install(scopedId, resolvedUrl);
|
|
23727
|
-
case
|
|
23732
|
+
case 8:
|
|
23728
23733
|
setShowModal(false);
|
|
23729
|
-
_context2.next =
|
|
23734
|
+
_context2.next = 10;
|
|
23730
23735
|
break;
|
|
23731
|
-
case
|
|
23732
|
-
_context2.prev =
|
|
23733
|
-
|
|
23734
|
-
msg =
|
|
23736
|
+
case 9:
|
|
23737
|
+
_context2.prev = 9;
|
|
23738
|
+
_t3 = _context2["catch"](2);
|
|
23739
|
+
msg = _t3.message || "Failed to install package";
|
|
23735
23740
|
if (msg.toLowerCase().includes("unauthorized")) {
|
|
23736
23741
|
setNeedsAuth(true);
|
|
23737
23742
|
} else {
|
|
23738
23743
|
setInstallError(msg);
|
|
23739
23744
|
}
|
|
23740
|
-
case
|
|
23745
|
+
case 10:
|
|
23741
23746
|
setIsInstalling(false);
|
|
23742
|
-
case
|
|
23747
|
+
case 11:
|
|
23743
23748
|
case "end":
|
|
23744
23749
|
return _context2.stop();
|
|
23745
23750
|
}
|
|
23746
|
-
}, _callee2, null, [[2, 6]]);
|
|
23747
|
-
})), [registryWidget
|
|
23751
|
+
}, _callee2, null, [[2, 9], [3, 6]]);
|
|
23752
|
+
})), [registryWidget]);
|
|
23748
23753
|
var handleAuthSuccess = React.useCallback(function () {
|
|
23749
23754
|
setNeedsAuth(false);
|
|
23750
23755
|
handleInstall();
|
|
@@ -33620,10 +33625,18 @@ function evaluateBundle(source, widgetName) {
|
|
|
33620
33625
|
}
|
|
33621
33626
|
throw new Error("[widgetBundleLoader] Widget \"".concat(widgetName, "\" requires unknown module: \"").concat(name, "\""));
|
|
33622
33627
|
};
|
|
33628
|
+
|
|
33629
|
+
// Provide a process shim so bundles that reference process.env.NODE_ENV
|
|
33630
|
+
// (common in React libraries) don't throw ReferenceError in the sandbox.
|
|
33631
|
+
var process = {
|
|
33632
|
+
env: {
|
|
33633
|
+
NODE_ENV: "production"
|
|
33634
|
+
}
|
|
33635
|
+
};
|
|
33623
33636
|
try {
|
|
33624
33637
|
// eslint-disable-next-line no-new-func
|
|
33625
|
-
var fn = new Function("module", "exports", "require", source);
|
|
33626
|
-
fn(module, exports, require);
|
|
33638
|
+
var fn = new Function("module", "exports", "require", "process", source);
|
|
33639
|
+
fn(module, exports, require, process);
|
|
33627
33640
|
} catch (error) {
|
|
33628
33641
|
throw error;
|
|
33629
33642
|
}
|