pollination-react-io 1.25.0 → 1.25.1

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
@@ -37797,58 +37797,23 @@ var useArtifacts = function (owner, name, client) {
37797
37797
  * Deprecated
37798
37798
  */
37799
37799
  function checkDotNet() {
37800
- checkPollinationPanel();
37801
- return true;
37800
+ return checkPollinationPanel();
37802
37801
  }
37803
37802
  /*
37804
37803
  * Deprecated
37805
37804
  */
37806
37805
  function checkRuby() {
37807
- checkPollinationPanel();
37808
- return true;
37809
- }
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
- }
37806
+ return checkPollinationPanel();
37818
37807
  }
37819
37808
  function checkPollinationPanel(silent) {
37820
- if (silent === void 0) { silent = true; }
37821
- try {
37822
- if (typeof window.parent.chrome === 'undefined') {
37823
- return conditional_throw('[POLLINATION-DEBUG]: chrome not found.', silent);
37824
- }
37825
- }
37826
- catch (_a) {
37827
- return conditional_throw('[POLLINATION-DEBUG]: chrome not found.', silent);
37828
- }
37829
- try {
37830
- if (typeof window.parent.chrome.webview === 'undefined') {
37831
- return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37832
- }
37833
- }
37834
- catch (_b) {
37835
- return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37836
- }
37837
- try {
37838
- if (typeof window.parent.chrome.webview.hostObjects === 'undefined') {
37839
- return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37840
- }
37841
- }
37842
- catch (_c) {
37843
- return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37809
+ if (window.parent.chrome == null) {
37810
+ return false;
37844
37811
  }
37845
- try {
37846
- if (typeof window.parent.chrome.webview.hostObjects.sync === 'undefined') {
37847
- return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37848
- }
37812
+ if (window.parent.chrome.webview == null) {
37813
+ return false;
37849
37814
  }
37850
- catch (_d) {
37851
- return conditional_throw('[POLLINATION-DEBUG]: webview not found.', silent);
37815
+ if (window.parent.chrome.webview == null) {
37816
+ return false;
37852
37817
  }
37853
37818
  return true;
37854
37819
  }
@@ -37920,13 +37885,7 @@ function blobToBase64(blob) {
37920
37885
  }
37921
37886
  var usePollinationPanel = function () {
37922
37887
  var panel = React.useMemo(function () {
37923
- try {
37924
- checkPollinationPanel();
37925
- }
37926
- catch (_a) {
37927
- return false;
37928
- }
37929
- return window.parent.chrome.webview.hostObjects.sync.study;
37888
+ return checkPollinationPanel() && window.parent.chrome.webview.hostObjects.sync.study;
37930
37889
  }, []);
37931
37890
  var saveFileBase64 = React.useCallback(function (key, file, subFolder, fileName) { return __awaiter$1(void 0, void 0, void 0, function () {
37932
37891
  var base64;
@@ -40067,7 +40026,7 @@ var useGetGeometry = function () {
40067
40026
  if (selection === void 0) { selection = false; }
40068
40027
  if (force === void 0) { force = false; }
40069
40028
  if (!checkDotNet())
40070
- ;
40029
+ return;
40071
40030
  var res = {
40072
40031
  data: null,
40073
40032
  identifier: null,
@@ -40131,7 +40090,7 @@ var useGetHbjson = function () {
40131
40090
  if (selection === void 0) { selection = false; }
40132
40091
  if (force === void 0) { force = false; }
40133
40092
  if (!checkDotNet())
40134
- ;
40093
+ return;
40135
40094
  var res = window.parent.chrome.webview
40136
40095
  .hostObjects.sync.hbjson.Get(key, selection);
40137
40096
  if (res) {
@@ -40140,7 +40099,7 @@ var useGetHbjson = function () {
40140
40099
  }, [setReturnValue]);
40141
40100
  var revitGetHbjson = React.useCallback(function () {
40142
40101
  if (!checkDotNet())
40143
- ;
40102
+ return;
40144
40103
  window.parent.chrome.webview.hostObjects.sync.hbjson.GetAsync();
40145
40104
  }, []);
40146
40105
  var getHbjson = React.useMemo(function () {
@@ -40302,7 +40261,7 @@ var useManageSettings = function () {
40302
40261
  var getSettings = React.useCallback(function (key) {
40303
40262
  if (key === void 0) { key = performance.now().toString(); }
40304
40263
  if (!checkDotNet())
40305
- ;
40264
+ return;
40306
40265
  var settings;
40307
40266
  try {
40308
40267
  settings = window.parent.chrome.webview.hostObjects.sync.settings.GetModelSettings();
@@ -40486,7 +40445,7 @@ var useSendHbjson = function () {
40486
40445
  var _a = React.useState({}), state = _a[0], setState = _a[1];
40487
40446
  var sendHbjson = React.useCallback(function (action, message) {
40488
40447
  if (!checkDotNet())
40489
- ;
40448
+ return;
40490
40449
  var response = sendMessageDotNet(__assign({ action: action }, message));
40491
40450
  setState(function (state) { return (__assign(__assign({}, state), { response: response })); });
40492
40451
  return response;
@@ -40816,7 +40775,7 @@ var SelectLocalArtifactNative = function (_a) {
40816
40775
  var _g = React.useState(), selPath = _g[0], setSelPath = _g[1];
40817
40776
  var handleSelectNative = React.useCallback(function () {
40818
40777
  if (!checkDotNet())
40819
- ;
40778
+ throw new Error('Use handleSelectNative from a Pollination CAD Plugin.');
40820
40779
  var res;
40821
40780
  try {
40822
40781
  if (mode === 'file') {