pollination-react-io 1.78.0 → 1.78.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
@@ -56039,14 +56039,16 @@ var FileCard = function (_a) {
56039
56039
  var _m = React.useState(), currFile = _m[0], setCurrFile = _m[1];
56040
56040
  // HTML integration
56041
56041
  var _o = React.useState(false), hasHtml = _o[0], setHasHtml = _o[1];
56042
+ // ZIP integration
56043
+ var _p = React.useState(), innerName = _p[0], setInnerName = _p[1];
56042
56044
  /**
56043
56045
  * Get file name to use
56044
56046
  */
56045
56047
  var filename = React.useMemo(function () {
56046
56048
  if (!path)
56047
56049
  return;
56048
- return path.split('/').reverse()[0];
56049
- }, [path]);
56050
+ return innerName !== null && innerName !== void 0 ? innerName : path.split('/').reverse()[0];
56051
+ }, [path, innerName]);
56050
56052
  /**
56051
56053
  * Get file from a ZIP file.
56052
56054
  * 1 zip = 1 file for now
@@ -56071,6 +56073,7 @@ var FileCard = function (_a) {
56071
56073
  var name = _a[0], f = _a[1];
56072
56074
  // 1 zip = 1 file
56073
56075
  // I assume text/plain
56076
+ setInnerName(name);
56074
56077
  var blob = f.slice(0, f.size, 'text/plain');
56075
56078
  setCurrFile(blob);
56076
56079
  if (name.endsWith('vsf')) {
@@ -56133,23 +56136,31 @@ var FileCard = function (_a) {
56133
56136
  setCADintegration(undefined);
56134
56137
  setIsLoading(false);
56135
56138
  setHasHtml(false);
56139
+ setInnerName(undefined);
56136
56140
  return;
56137
56141
  }
56138
56142
  res.blob()
56139
56143
  .then(function (blob) {
56140
- setCurrFile(blob);
56141
- // All zip files
56144
+ // File is a ZIP
56142
56145
  if (blob.type === 'application/zip') {
56143
56146
  getFileFromZip(blob);
56144
56147
  }
56145
- if (path === null || path === void 0 ? void 0 : path.endsWith('vsf')) {
56146
- setHasHtml(true);
56147
- fetchHTML(blob);
56148
- }
56149
56148
  else {
56150
- setHasHtml(false);
56149
+ setCurrFile(blob);
56150
+ setInnerName(undefined);
56151
+ if (path === null || path === void 0 ? void 0 : path.endsWith('vsf')) {
56152
+ setHasHtml(true);
56153
+ fetchHTML(blob); // HTML button
56154
+ setCADintegration(blob);
56155
+ }
56156
+ else if (path === null || path === void 0 ? void 0 : path.endsWith('hbjson')) {
56157
+ setHasHtml(false);
56158
+ setCADintegration(blob);
56159
+ }
56160
+ else {
56161
+ setHasHtml(false);
56162
+ }
56151
56163
  }
56152
- setCADintegration(blob);
56153
56164
  setIsLoading(false);
56154
56165
  setIsInactive(false);
56155
56166
  });