@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 CHANGED
@@ -23616,8 +23616,6 @@ var WidgetNotFound = function WidgetNotFound(_ref) {
23616
23616
  _useState12 = _slicedToArray(_useState11, 2),
23617
23617
  needsAuth = _useState12[0],
23618
23618
  setNeedsAuth = _useState12[1];
23619
- var _useRegistryAuth = useRegistryAuth(),
23620
- checkAuth = _useRegistryAuth.checkAuth;
23621
23619
  var lookupWidget = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
23622
23620
  var _getWidgetSearchQuery, packageName, widgetName, pkg, result;
23623
23621
  return _regeneratorRuntime.wrap(function (_context) {
@@ -23675,7 +23673,7 @@ var WidgetNotFound = function WidgetNotFound(_ref) {
23675
23673
  }, _callee, null, [[1, 6]]);
23676
23674
  })), [component]);
23677
23675
  var handleInstall = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
23678
- var authed, packageName, packageScope, downloadUrl, packageVersion, scopedId, resolvedUrl, msg, _t2;
23676
+ var _window$mainApi, status, packageName, packageScope, downloadUrl, packageVersion, scopedId, resolvedUrl, msg, _t3;
23679
23677
  return _regeneratorRuntime.wrap(function (_context2) {
23680
23678
  while (1) switch (_context2.prev = _context2.next) {
23681
23679
  case 0:
@@ -23689,44 +23687,51 @@ var WidgetNotFound = function WidgetNotFound(_ref) {
23689
23687
  setInstallError(null);
23690
23688
  setNeedsAuth(false);
23691
23689
  _context2.prev = 2;
23692
- _context2.next = 3;
23693
- return checkAuth();
23694
- case 3:
23695
- authed = _context2.sent;
23696
- if (authed) {
23697
- _context2.next = 4;
23690
+ _context2.prev = 3;
23691
+ _context2.next = 4;
23692
+ 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();
23693
+ case 4:
23694
+ status = _context2.sent;
23695
+ if (status !== null && status !== void 0 && status.authenticated) {
23696
+ _context2.next = 5;
23698
23697
  break;
23699
23698
  }
23700
23699
  setNeedsAuth(true);
23701
23700
  setIsInstalling(false);
23702
23701
  return _context2.abrupt("return");
23703
- case 4:
23702
+ case 5:
23703
+ _context2.next = 7;
23704
+ break;
23705
+ case 6:
23706
+ _context2.prev = 6;
23707
+ _context2["catch"](3);
23708
+ case 7:
23704
23709
  packageName = registryWidget.packageName, packageScope = registryWidget.packageScope, downloadUrl = registryWidget.downloadUrl, packageVersion = registryWidget.packageVersion;
23705
23710
  scopedId = packageScope ? "@".concat(packageScope.replace(/^@/, ""), "/").concat(packageName) : packageName;
23706
23711
  resolvedUrl = downloadUrl.replace(/\{version\}/g, packageVersion).replace(/\{name\}/g, packageName);
23707
- _context2.next = 5;
23712
+ _context2.next = 8;
23708
23713
  return window.mainApi.widgets.install(scopedId, resolvedUrl);
23709
- case 5:
23714
+ case 8:
23710
23715
  setShowModal(false);
23711
- _context2.next = 7;
23716
+ _context2.next = 10;
23712
23717
  break;
23713
- case 6:
23714
- _context2.prev = 6;
23715
- _t2 = _context2["catch"](2);
23716
- msg = _t2.message || "Failed to install package";
23718
+ case 9:
23719
+ _context2.prev = 9;
23720
+ _t3 = _context2["catch"](2);
23721
+ msg = _t3.message || "Failed to install package";
23717
23722
  if (msg.toLowerCase().includes("unauthorized")) {
23718
23723
  setNeedsAuth(true);
23719
23724
  } else {
23720
23725
  setInstallError(msg);
23721
23726
  }
23722
- case 7:
23727
+ case 10:
23723
23728
  setIsInstalling(false);
23724
- case 8:
23729
+ case 11:
23725
23730
  case "end":
23726
23731
  return _context2.stop();
23727
23732
  }
23728
- }, _callee2, null, [[2, 6]]);
23729
- })), [registryWidget, checkAuth]);
23733
+ }, _callee2, null, [[2, 9], [3, 6]]);
23734
+ })), [registryWidget]);
23730
23735
  var handleAuthSuccess = useCallback(function () {
23731
23736
  setNeedsAuth(false);
23732
23737
  handleInstall();
@@ -33602,10 +33607,18 @@ function evaluateBundle(source, widgetName) {
33602
33607
  }
33603
33608
  throw new Error("[widgetBundleLoader] Widget \"".concat(widgetName, "\" requires unknown module: \"").concat(name, "\""));
33604
33609
  };
33610
+
33611
+ // Provide a process shim so bundles that reference process.env.NODE_ENV
33612
+ // (common in React libraries) don't throw ReferenceError in the sandbox.
33613
+ var process = {
33614
+ env: {
33615
+ NODE_ENV: "production"
33616
+ }
33617
+ };
33605
33618
  try {
33606
33619
  // eslint-disable-next-line no-new-func
33607
- var fn = new Function("module", "exports", "require", source);
33608
- fn(module, exports, require);
33620
+ var fn = new Function("module", "exports", "require", "process", source);
33621
+ fn(module, exports, require, process);
33609
33622
  } catch (error) {
33610
33623
  throw error;
33611
33624
  }