pollination-react-io 1.24.3 → 1.24.5

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/build/index.js CHANGED
@@ -37807,44 +37807,54 @@ function checkRuby() {
37807
37807
  checkPollinationPanel();
37808
37808
  return true;
37809
37809
  }
37810
- function checkPollinationPanel() {
37810
+ function conditional_throw(message, silent) {
37811
+ if (silent === void 0) { silent = true; }
37812
+ if (silent) {
37813
+ return false;
37814
+ }
37815
+ else {
37816
+ throw new Error(message);
37817
+ }
37818
+ }
37819
+ function checkPollinationPanel(silent) {
37820
+ if (silent === void 0) { silent = true; }
37811
37821
  try {
37812
37822
  if (typeof window.parent.chrome === 'undefined') {
37813
- throw new Error('[POLLINATION-DEBUG]: chrome not found.');
37823
+ return conditional_throw('[POLLINATION-DEBUG]: chrome not found.', silent);
37814
37824
  }
37815
37825
  }
37816
37826
  catch (_a) {
37817
- throw new Error('[POLLINATION-DEBUG]: chrome not found.');
37827
+ return conditional_throw('[POLLINATION-DEBUG]: chrome not found.', silent);
37818
37828
  }
37819
37829
  try {
37820
37830
  if (typeof window.parent.chrome.webview === 'undefined') {
37821
- throw new Error('[POLLINATION-DEBUG]: webview not found.');
37831
+ return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37822
37832
  }
37823
37833
  }
37824
37834
  catch (_b) {
37825
- throw new Error('[POLLINATION-DEBUG]: webview not found.');
37835
+ return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37826
37836
  }
37827
37837
  try {
37828
37838
  if (typeof window.parent.chrome.webview.hostObjects === 'undefined') {
37829
- throw new Error('[POLLINATION-DEBUG]: webview.hostObjects not found.');
37839
+ return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37830
37840
  }
37831
37841
  }
37832
37842
  catch (_c) {
37833
- throw new Error('[POLLINATION-DEBUG]: webview.hostObjects not found.');
37843
+ return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37834
37844
  }
37835
37845
  try {
37836
37846
  if (typeof window.parent.chrome.webview.hostObjects.sync === 'undefined') {
37837
- throw new Error('[POLLINATION-DEBUG]: webview.hostObjects.sync not found.');
37847
+ return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37838
37848
  }
37839
37849
  }
37840
37850
  catch (_d) {
37841
- throw new Error('[POLLINATION-DEBUG]: webview.hostObjects.sync not found.');
37851
+ return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37842
37852
  }
37843
37853
  return true;
37844
37854
  }
37845
37855
  function sendMessageDotNet(message) {
37846
37856
  if (!checkPollinationPanel())
37847
- ;
37857
+ return undefined;
37848
37858
  // const json = JSON.stringify(message)
37849
37859
  var json = message;
37850
37860
  if (typeof message.data !== 'string') {
@@ -37860,7 +37870,7 @@ function sendMessageDotNet(message) {
37860
37870
  }
37861
37871
  function sendMessageRuby(message) {
37862
37872
  if (!checkPollinationPanel())
37863
- ;
37873
+ return undefined;
37864
37874
  throw new Error('[POLLINATION-DEBUG]: sendMesssageRuby not yet implemented');
37865
37875
  }
37866
37876
  // not sure if this will work from Streamlit?
@@ -38028,6 +38038,9 @@ var useCreateStudy = function (accountName, projectName, client) {
38028
38038
  // then save it to the users machine and provide
38029
38039
  // the name to the jobInfo object
38030
38040
  if (typeof value.key === 'string') {
38041
+ if (value.name == null) {
38042
+ reject("'name' attribute of ".concat(value.key, " is null. Job will be invalid."));
38043
+ }
38031
38044
  downloadArtifact(value.key)
38032
38045
  .then(function (url) {
38033
38046
  fetch(url)
@@ -38134,8 +38147,7 @@ var useCreateStudy = function (accountName, projectName, client) {
38134
38147
  arguments: [jobArguments]
38135
38148
  });
38136
38149
  }).catch(function (err) {
38137
- var data = err.response.data;
38138
- console.error(data.detail);
38150
+ console.error(err);
38139
38151
  })];
38140
38152
  case 1:
38141
38153
  job = _c.sent();
@@ -46265,7 +46277,7 @@ var SendGeometry = function (_a) {
46265
46277
  var _d = React.useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
46266
46278
  var sendMessage = useSendMessage().sendMessage;
46267
46279
  var disabled = React.useMemo(function () {
46268
- return checkPollinationPanel();
46280
+ return !checkPollinationPanel();
46269
46281
  }, []);
46270
46282
  React.useEffect(function () {
46271
46283
  setSelOpt(defaultAction);
@@ -46391,6 +46403,9 @@ var SendModel = function (_a) {
46391
46403
  var _c = React.useState(defaultAction !== null && defaultAction !== void 0 ? defaultAction : Action$1.preview), selOpt = _c[0], setSelOpt = _c[1];
46392
46404
  var _d = React.useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
46393
46405
  var sendHbjson = useSendHbjson().sendHbjson;
46406
+ var disabled = React.useMemo(function () {
46407
+ return !checkPollinationPanel();
46408
+ }, []);
46394
46409
  React.useEffect(function () {
46395
46410
  setSelOpt(defaultAction);
46396
46411
  }, [defaultAction]);
@@ -46398,7 +46413,7 @@ var SendModel = function (_a) {
46398
46413
  setKey(defaultKey);
46399
46414
  }, [defaultKey]);
46400
46415
  React.useEffect(function () {
46401
- if (!sendHbjson || selOpt !== Action$1.subscribePreview)
46416
+ if (disabled || selOpt !== Action$1.subscribePreview)
46402
46417
  return;
46403
46418
  sendHbjson('SubscribePreviewHBJSON', {
46404
46419
  data: hbjson,
@@ -46418,9 +46433,9 @@ var SendModel = function (_a) {
46418
46433
  },
46419
46434
  });
46420
46435
  };
46421
- }, [selOpt, hbjson, sendHbjson, key]);
46422
- return (React__default["default"].createElement(SettingsButton, { disabled: !sendHbjson, onClick: function () {
46423
- if (!sendHbjson)
46436
+ }, [disabled, hbjson, key, selOpt, sendHbjson]);
46437
+ return (React__default["default"].createElement(SettingsButton, { disabled: disabled, onClick: function () {
46438
+ if (disabled)
46424
46439
  return;
46425
46440
  sendHbjson(getAction$1(selOpt), {
46426
46441
  data: hbjson,
@@ -46441,7 +46456,7 @@ var SendModel = function (_a) {
46441
46456
  label: 'Preview',
46442
46457
  checked: selOpt === Action$1.preview,
46443
46458
  icon: React__default["default"].createElement(Eyeglasses$1, { size: 16 }),
46444
- disabled: !sendHbjson,
46459
+ disabled: disabled,
46445
46460
  onSelect: function () {
46446
46461
  setSelOpt(function (state) { return (state === Action$1.preview ? undefined : Action$1.preview); });
46447
46462
  },
@@ -46452,7 +46467,7 @@ var SendModel = function (_a) {
46452
46467
  label: 'Add',
46453
46468
  checked: selOpt === Action$1.add,
46454
46469
  icon: React__default["default"].createElement(Building$1, { size: 16 }),
46455
- disabled: !sendHbjson,
46470
+ disabled: disabled,
46456
46471
  onSelect: function () {
46457
46472
  setSelOpt(function (state) { return (state === Action$1.add ? undefined : Action$1.add); });
46458
46473
  },
@@ -46463,7 +46478,7 @@ var SendModel = function (_a) {
46463
46478
  label: 'Clear',
46464
46479
  checked: selOpt === Action$1.clear,
46465
46480
  icon: React__default["default"].createElement(Recycle$1, { size: 16 }),
46466
- disabled: !sendHbjson,
46481
+ disabled: disabled,
46467
46482
  onSelect: function () {
46468
46483
  setSelOpt(function (state) { return (state === Action$1.clear ? undefined : Action$1.clear); });
46469
46484
  },
@@ -46474,7 +46489,7 @@ var SendModel = function (_a) {
46474
46489
  label: 'Subscribe Preview',
46475
46490
  checked: selOpt === Action$1.subscribePreview,
46476
46491
  icon: React__default["default"].createElement(ArrowRepeat$1, { size: 16 }),
46477
- disabled: !sendHbjson,
46492
+ disabled: disabled,
46478
46493
  onSelect: function () {
46479
46494
  setSelOpt(function (state) { return (state === Action$1.subscribePreview ? undefined : Action$1.subscribePreview); });
46480
46495
  },
@@ -46516,8 +46531,11 @@ var SendResults = function (_a) {
46516
46531
  var _d = React.useState(defaultKey !== null && defaultKey !== void 0 ? defaultKey : performance.now().toString()), key = _d[0], setKey = _d[1];
46517
46532
  var sendMessage = useSendMessage().sendMessage;
46518
46533
  var disabled = React.useMemo(function () {
46519
- return checkPollinationPanel();
46534
+ return !checkPollinationPanel();
46520
46535
  }, []);
46536
+ React.useEffect(function () {
46537
+ console.log(disabled);
46538
+ }, [disabled]);
46521
46539
  React.useEffect(function () {
46522
46540
  setSelOpt(defaultAction);
46523
46541
  }, [defaultAction]);