synapse-react-client 3.0.5 → 3.0.6

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.
@@ -58140,13 +58140,13 @@ var SRC = (() => {
58140
58140
  library.add(faDatabase);
58141
58141
  library.add(faClock);
58142
58142
  function DownloadDetails(props) {
58143
+ const { numFiles, numBytes } = props;
58144
+ const { accessToken } = useSynapseContext();
58143
58145
  const [state, setState] = (0, import_react51.useState)({
58144
- isLoading: true,
58146
+ isLoading: !!numBytes,
58145
58147
  downloadSpeed: 0
58146
58148
  });
58147
- const { accessToken } = useSynapseContext();
58148
58149
  const { isLoading, downloadSpeed } = state;
58149
- const { numFiles, numBytes } = props;
58150
58150
  (0, import_react51.useEffect)(() => {
58151
58151
  if (accessToken) {
58152
58152
  testDownloadSpeed(accessToken).then((speed) => {
@@ -58157,22 +58157,25 @@ var SRC = (() => {
58157
58157
  });
58158
58158
  }
58159
58159
  }, [accessToken]);
58160
- const timeEstimateInSeconds = isLoading || downloadSpeed === 0 ? 0 : numBytes / downloadSpeed;
58161
- const friendlyTime = timeEstimateInSeconds === 0 ? "" : import_moment.default.duration(timeEstimateInSeconds, "seconds").humanize();
58160
+ const timeEstimateInSeconds = isLoading || downloadSpeed === 0 || !numBytes ? 0 : numBytes / downloadSpeed;
58161
+ const isTimeEstimateLoading = timeEstimateInSeconds === 0;
58162
+ const friendlyTime = isTimeEstimateLoading ? "" : import_moment.default.duration(timeEstimateInSeconds, "seconds").humanize();
58162
58163
  const numBytesTooltipId = "num_bytes_id";
58163
58164
  const friendlyTimeTooltipId = "friendly_time_id";
58164
- const isInactive = numFiles === 0 || timeEstimateInSeconds === 0;
58165
- const iconClassName = isInactive ? "SRC-inactive" : "SRC-primary-text-color";
58165
+ const isZeroFiles = numFiles === 0;
58166
+ const fileCountIconClass = isZeroFiles ? "SRC-inactive" : "SRC-primary-text-color";
58167
+ const timeEstimateIconClass = isTimeEstimateLoading ? "SRC-inactive" : "SRC-primary-text-color";
58166
58168
  return /* @__PURE__ */ import_react51.default.createElement("span", {
58167
58169
  className: "download-details-container"
58168
58170
  }, /* @__PURE__ */ import_react51.default.createElement("span", null, /* @__PURE__ */ import_react51.default.createElement(FontAwesomeIcon, {
58169
- className: iconClassName,
58171
+ className: fileCountIconClass,
58170
58172
  icon: "file"
58171
- }), isInactive ? /* @__PURE__ */ import_react51.default.createElement(SkeletonInlineBlock, {
58173
+ }), isZeroFiles ? /* @__PURE__ */ import_react51.default.createElement(SkeletonInlineBlock, {
58172
58174
  width: 50
58173
- }) : /* @__PURE__ */ import_react51.default.createElement(import_react51.default.Fragment, null, " ", numFiles, "\xA0files ")), /* @__PURE__ */ import_react51.default.createElement("span", {
58175
+ }) : /* @__PURE__ */ import_react51.default.createElement(import_react51.default.Fragment, null, " ", numFiles, "\xA0files ")), numBytes && /* @__PURE__ */ import_react51.default.createElement("span", {
58174
58176
  "data-for": numBytesTooltipId,
58175
- "data-tip": "This is the total size of all files. Zipped package(s) will likely be smaller."
58177
+ "data-tip": "This is the total size of all files. Zipped package(s) will likely be smaller.",
58178
+ "data-testid": "numBytesUI"
58176
58179
  }, /* @__PURE__ */ import_react51.default.createElement(index_es_default, {
58177
58180
  delayShow: TOOLTIP_DELAY_SHOW,
58178
58181
  place: "top",
@@ -58180,13 +58183,14 @@ var SRC = (() => {
58180
58183
  effect: "solid",
58181
58184
  id: numBytesTooltipId
58182
58185
  }), /* @__PURE__ */ import_react51.default.createElement(FontAwesomeIcon, {
58183
- className: iconClassName,
58186
+ className: timeEstimateIconClass,
58184
58187
  icon: "database"
58185
- }), isInactive ? /* @__PURE__ */ import_react51.default.createElement(SkeletonInlineBlock, {
58188
+ }), isTimeEstimateLoading ? /* @__PURE__ */ import_react51.default.createElement(SkeletonInlineBlock, {
58186
58189
  width: 50
58187
- }) : calculateFriendlyFileSize(numBytes)), /* @__PURE__ */ import_react51.default.createElement("span", {
58190
+ }) : calculateFriendlyFileSize(numBytes)), numBytes && /* @__PURE__ */ import_react51.default.createElement("span", {
58188
58191
  "data-for": friendlyTimeTooltipId,
58189
- "data-tip": "This is an estimate of how long package download will take."
58192
+ "data-tip": "This is an estimate of how long package download will take.",
58193
+ "data-testid": "downloadTimeEstimateUI"
58190
58194
  }, /* @__PURE__ */ import_react51.default.createElement(index_es_default, {
58191
58195
  delayShow: TOOLTIP_DELAY_SHOW,
58192
58196
  place: "top",
@@ -58194,7 +58198,7 @@ var SRC = (() => {
58194
58198
  effect: "solid",
58195
58199
  id: friendlyTimeTooltipId
58196
58200
  }), /* @__PURE__ */ import_react51.default.createElement(FontAwesomeIcon, {
58197
- className: iconClassName,
58201
+ className: timeEstimateIconClass,
58198
58202
  icon: "clock"
58199
58203
  }), isLoading && numFiles > 0 ? /* @__PURE__ */ import_react51.default.createElement(SkeletonInlineBlock, {
58200
58204
  width: 50
@@ -90756,7 +90760,7 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
90756
90760
  },
90757
90761
  [3 /* INFO_ITEMS_IN_LIST */]: {
90758
90762
  className: "alert-info",
90759
- infoText: /* @__PURE__ */ import_react219.default.createElement(import_react219.default.Fragment, null, "You already have files in your download list, which will be mixed with new files added to your download list.", /* @__PURE__ */ import_react219.default.createElement("br", null), "We recommend completing or clearing your download list before adding these files."),
90763
+ infoText: /* @__PURE__ */ import_react219.default.createElement(import_react219.default.Fragment, null, "Note: Files that you add will be mixed in with the files already in your download list.", /* @__PURE__ */ import_react219.default.createElement("br", null), "If you don\u2019t want to mix these files, clear your download list before continuing."),
90760
90764
  closeText: "Cancel"
90761
90765
  },
90762
90766
  [1 /* PROCESSING */]: {
@@ -90812,18 +90816,17 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
90812
90816
  const { showDownloadConfirmation = true } = topLevelControlsState != null ? topLevelControlsState : {};
90813
90817
  const [status, setStatus2] = (0, import_react219.useState)(accessToken ? 0 /* LOADING_INFO */ : 4 /* SIGNED_OUT */);
90814
90818
  const [fileCount, setFileCount] = (0, import_react219.useState)(0);
90815
- const [fileSize, setFileSize] = (0, import_react219.useState)(0);
90819
+ const [fileSize, setFileSize] = (0, import_react219.useState)();
90816
90820
  const { data: downloadListStatistics, refetch } = useGetDownloadListStatistics();
90817
90821
  const lastQueryRequest = getLastQueryRequest();
90818
90822
  const [showDownloadList, setShowDownloadList] = (0, import_react219.useState)(false);
90819
90823
  const updateStats = (0, import_react219.useCallback)((count2, bytes, downloadListStatistics2) => {
90820
90824
  if (accessToken && downloadListStatistics2) {
90821
90825
  const hasFilesInDownloadList = downloadListStatistics2.totalNumberOfFiles > 0;
90822
- const size2 = bytes != null ? bytes : 0;
90823
90826
  const fileCount2 = count2 != null ? count2 : 0;
90824
90827
  setStatus2(hasFilesInDownloadList ? 3 /* INFO_ITEMS_IN_LIST */ : 2 /* INFO */);
90825
90828
  setFileCount(fileCount2);
90826
- setFileSize(size2);
90829
+ setFileSize(bytes);
90827
90830
  }
90828
90831
  }, [accessToken]);
90829
90832
  const { data: entityChildrenData, isSuccess } = useGetEntityChildren({
@@ -90849,9 +90852,10 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_liter
90849
90852
  });
90850
90853
  const { data: queryResultBundle } = useGetQueryResultBundle(queryBundleRequestSizeInformation);
90851
90854
  useDeepCompareEffect(() => {
90852
- var _a;
90855
+ var _a, _b;
90853
90856
  if (queryResultBundle && downloadListStatistics) {
90854
- updateStats(queryResultBundle.queryCount, (_a = queryResultBundle.sumFileSizes) == null ? void 0 : _a.sumFileSizesBytes, downloadListStatistics);
90857
+ const isGreaterThanReportedValue = (_a = queryResultBundle.sumFileSizes) == null ? void 0 : _a.greaterThan;
90858
+ updateStats(queryResultBundle.queryCount, isGreaterThanReportedValue ? void 0 : (_b = queryResultBundle.sumFileSizes) == null ? void 0 : _b.sumFileSizesBytes, downloadListStatistics);
90855
90859
  }
90856
90860
  }, [
90857
90861
  updateStats,