flowcore-fn 10.3.4 → 10.3.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/dist/pkg-index.js CHANGED
@@ -19278,7 +19278,7 @@ function PoolConfirmationModal({ isOpen, onClose, onConfirm, file, isSubmitting
19278
19278
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:w-10 fc:h-10 fc:bg-blue-50 fc:text-blue-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-inner", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiInboxArchiveLine, { size: 20 }) }),
19279
19279
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
19280
19280
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h3", { className: "fc:text-base fc:font-bold fc:text-slate-800", children: "Claim Workflow Files" }),
19281
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:text-xs fc:text-slate-500", children: "Claim unclaimed files for the selected step" })
19281
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:text-xs fc:text-slate-500", children: "Claim this unclaimed file for the selected step" })
19282
19282
  ] })
19283
19283
  ] }),
19284
19284
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
@@ -19296,9 +19296,7 @@ function PoolConfirmationModal({ isOpen, onClose, onConfirm, file, isSubmitting
19296
19296
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex fc:items-start fc:gap-3 fc:p-3.5 fc:bg-blue-50/70 fc:border fc:border-blue-100 fc:rounded-2xl", children: [
19297
19297
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiAlertLine, { size: 20, className: "fc:text-blue-600 fc:shrink-0 fc:mt-0.5" }),
19298
19298
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:text-xs fc:text-blue-900 fc:leading-relaxed", children: [
19299
- "Confirming will claim ",
19300
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("strong", { className: "fc:font-bold", children: "all unclaimed files" }),
19301
- " for this workflow step and assign them to your ",
19299
+ "Confirming will assign this file to your ",
19302
19300
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("strong", { className: "fc:font-bold", children: "My Files" }),
19303
19301
  " queue."
19304
19302
  ] })
@@ -19352,7 +19350,7 @@ function PoolConfirmationModal({ isOpen, onClose, onConfirm, file, isSubmitting
19352
19350
  className: "fc:px-5 fc:py-2 fc:bg-blue-600 hover:fc:bg-blue-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-blue-500/20 fc:transition-all fc:flex fc:items-center fc:gap-1.5 disabled:fc:cursor-not-allowed disabled:fc:opacity-60",
19353
19351
  children: [
19354
19352
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiCheckLine, { size: 16 }),
19355
- isSubmitting ? "Claiming..." : "Yes, Claim Files"
19353
+ isSubmitting ? "Claiming..." : "Yes, Claim File"
19356
19354
  ]
19357
19355
  }
19358
19356
  )
@@ -19796,6 +19794,7 @@ function InboxMain() {
19796
19794
  const [myFiles, setMyFiles] = (0, import_react100.useState)([]);
19797
19795
  const [totalFiles, setTotalFiles] = (0, import_react100.useState)([]);
19798
19796
  const [refreshKey, setRefreshKey] = (0, import_react100.useState)(0);
19797
+ const [isUnclaiming, setIsUnclaiming] = (0, import_react100.useState)(false);
19799
19798
  (0, import_react100.useEffect)(() => {
19800
19799
  let isCurrent = true;
19801
19800
  const loadAssignedSteps = async () => {
@@ -20105,11 +20104,16 @@ function InboxMain() {
20105
20104
  setPoolModalOpen(true);
20106
20105
  };
20107
20106
  const handleConfirmPool = async () => {
20108
- var _a, _b;
20107
+ var _a, _b, _c;
20109
20108
  if (!activeWorkflowStepId) {
20110
20109
  await import_sweetalert229.default.fire("Error", "Select an assigned workflow step before claiming files.", "error");
20111
20110
  return;
20112
20111
  }
20112
+ const filePoolId = Number((_a = selectedPoolFile == null ? void 0 : selectedPoolFile.filePoolId) != null ? _a : selectedPoolFile == null ? void 0 : selectedPoolFile.FilePoolId);
20113
+ if (!Number.isInteger(filePoolId) || filePoolId <= 0) {
20114
+ await import_sweetalert229.default.fire("Error", "The selected file pool entry has no valid FilePoolId.", "error");
20115
+ return;
20116
+ }
20113
20117
  setIsClaimingPool(true);
20114
20118
  try {
20115
20119
  const claimEndpoint = getInboxEndpoint(
@@ -20120,7 +20124,8 @@ function InboxMain() {
20120
20124
  throw new Error("Claim endpoint is not configured (flowCore.inbox.claimUnclaimedFilesByWorkflowStepId).");
20121
20125
  }
20122
20126
  await getApiService().post(claimEndpoint, {
20123
- workflowStepId: Number(activeWorkflowStepId)
20127
+ workflowStepId: Number(activeWorkflowStepId),
20128
+ filePoolId
20124
20129
  });
20125
20130
  setPoolModalOpen(false);
20126
20131
  setSelectedPoolFile(null);
@@ -20129,7 +20134,7 @@ function InboxMain() {
20129
20134
  await import_sweetalert229.default.fire({
20130
20135
  icon: "success",
20131
20136
  title: "Files Claimed",
20132
- text: "Unclaimed files for this workflow step have been assigned to your My Files queue.",
20137
+ text: "The selected file has been assigned to your My Files queue.",
20133
20138
  confirmButtonColor: "#2563eb",
20134
20139
  timer: 3e3,
20135
20140
  timerProgressBar: true
@@ -20137,13 +20142,44 @@ function InboxMain() {
20137
20142
  } catch (error) {
20138
20143
  await import_sweetalert229.default.fire(
20139
20144
  "Error",
20140
- ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to claim files.",
20145
+ ((_c = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || (error == null ? void 0 : error.message) || "Unable to claim files.",
20141
20146
  "error"
20142
20147
  );
20143
20148
  } finally {
20144
20149
  setIsClaimingPool(false);
20145
20150
  }
20146
20151
  };
20152
+ const handleUnclaim = async (file) => {
20153
+ var _a, _b, _c;
20154
+ const filePoolId = Number((_a = file.taskInstanceId) != null ? _a : file.TaskInstanceId);
20155
+ if (!Number.isInteger(filePoolId) || filePoolId <= 0) {
20156
+ await import_sweetalert229.default.fire("Error", "This file has no valid task instance ID to unclaim.", "error");
20157
+ return;
20158
+ }
20159
+ setIsUnclaiming(true);
20160
+ try {
20161
+ const endpoint2 = getInboxEndpoint(["inbox", "Inbox", "filePool", "FilePool"], "UnClaimClaimedFile");
20162
+ if (!endpoint2) throw new Error("Unclaim endpoint is not configured (flowCore.inbox.UnClaimClaimedFile).");
20163
+ await getApiService().post(endpoint2, { filePoolId });
20164
+ setRefreshKey((previous) => previous + 1);
20165
+ await import_sweetalert229.default.fire({
20166
+ icon: "success",
20167
+ title: "File Unclaimed",
20168
+ text: "The file has been released back to the file pool.",
20169
+ confirmButtonColor: "#2563eb",
20170
+ timer: 3e3,
20171
+ timerProgressBar: true
20172
+ });
20173
+ } catch (error) {
20174
+ await import_sweetalert229.default.fire(
20175
+ "Error",
20176
+ ((_c = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || (error == null ? void 0 : error.message) || "Unable to unclaim the file.",
20177
+ "error"
20178
+ );
20179
+ } finally {
20180
+ setIsUnclaiming(false);
20181
+ }
20182
+ };
20147
20183
  const handleOpenTakeAction = (file) => {
20148
20184
  setSelectedActionFile(file);
20149
20185
  setActionModalOpen(true);
@@ -20947,9 +20983,11 @@ function InboxMain() {
20947
20983
  "button",
20948
20984
  {
20949
20985
  type: "button",
20986
+ onClick: () => handleUnclaim(row),
20987
+ disabled: isUnclaiming,
20950
20988
  style: { fontSize: "11px" },
20951
- className: "fc:inline-flex fc:items-center fc:justify-center fc:h-8 fc:px-2 fc:whitespace-nowrap fc:border fc:border-rose-200 fc:bg-rose-50 fc:text-rose-700 fc:font-bold fc:rounded-lg hover:fc:bg-rose-100 hover:fc:border-rose-300 fc:transition-colors active:fc:scale-95",
20952
- children: "Unclaim"
20989
+ className: "fc:inline-flex fc:items-center fc:justify-center fc:h-8 fc:px-2 fc:whitespace-nowrap fc:border fc:border-rose-200 fc:bg-rose-50 fc:text-rose-700 fc:font-bold fc:rounded-lg hover:fc:bg-rose-100 hover:fc:border-rose-300 fc:transition-colors active:fc:scale-95 disabled:fc:cursor-not-allowed disabled:fc:opacity-60",
20990
+ children: isUnclaiming ? "Unclaiming..." : "Unclaim"
20953
20991
  }
20954
20992
  )
20955
20993
  ] }),
@@ -19140,7 +19140,7 @@ function PoolConfirmationModal({ isOpen, onClose, onConfirm, file, isSubmitting
19140
19140
  /* @__PURE__ */ jsx94("div", { className: "fc:w-10 fc:h-10 fc:bg-blue-50 fc:text-blue-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-inner", children: /* @__PURE__ */ jsx94(RiInboxArchiveLine, { size: 20 }) }),
19141
19141
  /* @__PURE__ */ jsxs93("div", { children: [
19142
19142
  /* @__PURE__ */ jsx94("h3", { className: "fc:text-base fc:font-bold fc:text-slate-800", children: "Claim Workflow Files" }),
19143
- /* @__PURE__ */ jsx94("p", { className: "fc:text-xs fc:text-slate-500", children: "Claim unclaimed files for the selected step" })
19143
+ /* @__PURE__ */ jsx94("p", { className: "fc:text-xs fc:text-slate-500", children: "Claim this unclaimed file for the selected step" })
19144
19144
  ] })
19145
19145
  ] }),
19146
19146
  /* @__PURE__ */ jsx94(
@@ -19158,9 +19158,7 @@ function PoolConfirmationModal({ isOpen, onClose, onConfirm, file, isSubmitting
19158
19158
  /* @__PURE__ */ jsxs93("div", { className: "fc:flex fc:items-start fc:gap-3 fc:p-3.5 fc:bg-blue-50/70 fc:border fc:border-blue-100 fc:rounded-2xl", children: [
19159
19159
  /* @__PURE__ */ jsx94(RiAlertLine, { size: 20, className: "fc:text-blue-600 fc:shrink-0 fc:mt-0.5" }),
19160
19160
  /* @__PURE__ */ jsxs93("div", { className: "fc:text-xs fc:text-blue-900 fc:leading-relaxed", children: [
19161
- "Confirming will claim ",
19162
- /* @__PURE__ */ jsx94("strong", { className: "fc:font-bold", children: "all unclaimed files" }),
19163
- " for this workflow step and assign them to your ",
19161
+ "Confirming will assign this file to your ",
19164
19162
  /* @__PURE__ */ jsx94("strong", { className: "fc:font-bold", children: "My Files" }),
19165
19163
  " queue."
19166
19164
  ] })
@@ -19214,7 +19212,7 @@ function PoolConfirmationModal({ isOpen, onClose, onConfirm, file, isSubmitting
19214
19212
  className: "fc:px-5 fc:py-2 fc:bg-blue-600 hover:fc:bg-blue-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-blue-500/20 fc:transition-all fc:flex fc:items-center fc:gap-1.5 disabled:fc:cursor-not-allowed disabled:fc:opacity-60",
19215
19213
  children: [
19216
19214
  /* @__PURE__ */ jsx94(RiCheckLine, { size: 16 }),
19217
- isSubmitting ? "Claiming..." : "Yes, Claim Files"
19215
+ isSubmitting ? "Claiming..." : "Yes, Claim File"
19218
19216
  ]
19219
19217
  }
19220
19218
  )
@@ -19654,6 +19652,7 @@ function InboxMain() {
19654
19652
  const [myFiles, setMyFiles] = useState71([]);
19655
19653
  const [totalFiles, setTotalFiles] = useState71([]);
19656
19654
  const [refreshKey, setRefreshKey] = useState71(0);
19655
+ const [isUnclaiming, setIsUnclaiming] = useState71(false);
19657
19656
  useEffect51(() => {
19658
19657
  let isCurrent = true;
19659
19658
  const loadAssignedSteps = async () => {
@@ -19963,11 +19962,16 @@ function InboxMain() {
19963
19962
  setPoolModalOpen(true);
19964
19963
  };
19965
19964
  const handleConfirmPool = async () => {
19966
- var _a, _b;
19965
+ var _a, _b, _c;
19967
19966
  if (!activeWorkflowStepId) {
19968
19967
  await Swal29.fire("Error", "Select an assigned workflow step before claiming files.", "error");
19969
19968
  return;
19970
19969
  }
19970
+ const filePoolId = Number((_a = selectedPoolFile == null ? void 0 : selectedPoolFile.filePoolId) != null ? _a : selectedPoolFile == null ? void 0 : selectedPoolFile.FilePoolId);
19971
+ if (!Number.isInteger(filePoolId) || filePoolId <= 0) {
19972
+ await Swal29.fire("Error", "The selected file pool entry has no valid FilePoolId.", "error");
19973
+ return;
19974
+ }
19971
19975
  setIsClaimingPool(true);
19972
19976
  try {
19973
19977
  const claimEndpoint = getInboxEndpoint(
@@ -19978,7 +19982,8 @@ function InboxMain() {
19978
19982
  throw new Error("Claim endpoint is not configured (flowCore.inbox.claimUnclaimedFilesByWorkflowStepId).");
19979
19983
  }
19980
19984
  await getApiService().post(claimEndpoint, {
19981
- workflowStepId: Number(activeWorkflowStepId)
19985
+ workflowStepId: Number(activeWorkflowStepId),
19986
+ filePoolId
19982
19987
  });
19983
19988
  setPoolModalOpen(false);
19984
19989
  setSelectedPoolFile(null);
@@ -19987,7 +19992,7 @@ function InboxMain() {
19987
19992
  await Swal29.fire({
19988
19993
  icon: "success",
19989
19994
  title: "Files Claimed",
19990
- text: "Unclaimed files for this workflow step have been assigned to your My Files queue.",
19995
+ text: "The selected file has been assigned to your My Files queue.",
19991
19996
  confirmButtonColor: "#2563eb",
19992
19997
  timer: 3e3,
19993
19998
  timerProgressBar: true
@@ -19995,13 +20000,44 @@ function InboxMain() {
19995
20000
  } catch (error) {
19996
20001
  await Swal29.fire(
19997
20002
  "Error",
19998
- ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to claim files.",
20003
+ ((_c = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || (error == null ? void 0 : error.message) || "Unable to claim files.",
19999
20004
  "error"
20000
20005
  );
20001
20006
  } finally {
20002
20007
  setIsClaimingPool(false);
20003
20008
  }
20004
20009
  };
20010
+ const handleUnclaim = async (file) => {
20011
+ var _a, _b, _c;
20012
+ const filePoolId = Number((_a = file.taskInstanceId) != null ? _a : file.TaskInstanceId);
20013
+ if (!Number.isInteger(filePoolId) || filePoolId <= 0) {
20014
+ await Swal29.fire("Error", "This file has no valid task instance ID to unclaim.", "error");
20015
+ return;
20016
+ }
20017
+ setIsUnclaiming(true);
20018
+ try {
20019
+ const endpoint2 = getInboxEndpoint(["inbox", "Inbox", "filePool", "FilePool"], "UnClaimClaimedFile");
20020
+ if (!endpoint2) throw new Error("Unclaim endpoint is not configured (flowCore.inbox.UnClaimClaimedFile).");
20021
+ await getApiService().post(endpoint2, { filePoolId });
20022
+ setRefreshKey((previous) => previous + 1);
20023
+ await Swal29.fire({
20024
+ icon: "success",
20025
+ title: "File Unclaimed",
20026
+ text: "The file has been released back to the file pool.",
20027
+ confirmButtonColor: "#2563eb",
20028
+ timer: 3e3,
20029
+ timerProgressBar: true
20030
+ });
20031
+ } catch (error) {
20032
+ await Swal29.fire(
20033
+ "Error",
20034
+ ((_c = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || (error == null ? void 0 : error.message) || "Unable to unclaim the file.",
20035
+ "error"
20036
+ );
20037
+ } finally {
20038
+ setIsUnclaiming(false);
20039
+ }
20040
+ };
20005
20041
  const handleOpenTakeAction = (file) => {
20006
20042
  setSelectedActionFile(file);
20007
20043
  setActionModalOpen(true);
@@ -20805,9 +20841,11 @@ function InboxMain() {
20805
20841
  "button",
20806
20842
  {
20807
20843
  type: "button",
20844
+ onClick: () => handleUnclaim(row),
20845
+ disabled: isUnclaiming,
20808
20846
  style: { fontSize: "11px" },
20809
- className: "fc:inline-flex fc:items-center fc:justify-center fc:h-8 fc:px-2 fc:whitespace-nowrap fc:border fc:border-rose-200 fc:bg-rose-50 fc:text-rose-700 fc:font-bold fc:rounded-lg hover:fc:bg-rose-100 hover:fc:border-rose-300 fc:transition-colors active:fc:scale-95",
20810
- children: "Unclaim"
20847
+ className: "fc:inline-flex fc:items-center fc:justify-center fc:h-8 fc:px-2 fc:whitespace-nowrap fc:border fc:border-rose-200 fc:bg-rose-50 fc:text-rose-700 fc:font-bold fc:rounded-lg hover:fc:bg-rose-100 hover:fc:border-rose-300 fc:transition-colors active:fc:scale-95 disabled:fc:cursor-not-allowed disabled:fc:opacity-60",
20848
+ children: isUnclaiming ? "Unclaiming..." : "Unclaim"
20811
20849
  }
20812
20850
  )
20813
20851
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "10.3.4",
3
+ "version": "10.3.5",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [