@eztrak/shared 0.13.6 → 0.13.7
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/{chunk-YWS7JMII.mjs → chunk-2JMFMMKR.mjs} +49 -1
- package/dist/chunk-2JMFMMKR.mjs.map +1 -0
- package/dist/{chunk-PXUB5ZF7.mjs → chunk-AO27YNP3.mjs} +84 -3
- package/dist/{chunk-PXUB5ZF7.mjs.map → chunk-AO27YNP3.mjs.map} +1 -1
- package/dist/chunk-PLAAQZDU.mjs +60 -0
- package/dist/chunk-PLAAQZDU.mjs.map +1 -0
- package/dist/components/index.d.mts +15 -1
- package/dist/components/index.d.ts +15 -1
- package/dist/components/index.js +115 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -2
- package/dist/handleApiError-Dgh_d-CX.d.mts +48 -0
- package/dist/handleApiError-Dgh_d-CX.d.ts +48 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +172 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/utils/index.d.mts +11 -35
- package/dist/utils/index.d.ts +11 -35
- package/dist/utils/index.js +91 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +8 -2
- package/package.json +5 -3
- package/dist/chunk-5HXJ4WHA.mjs +0 -16
- package/dist/chunk-5HXJ4WHA.mjs.map +0 -1
- package/dist/chunk-YWS7JMII.mjs.map +0 -1
package/dist/components/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(components_exports, {
|
|
|
41
41
|
ResetColumnsButton: () => ResetColumnsButton,
|
|
42
42
|
ResetFiltersButton: () => ResetFiltersButton,
|
|
43
43
|
SearchInput: () => SearchInput,
|
|
44
|
+
TableErrorBoundary: () => TableErrorBoundary,
|
|
44
45
|
TableLayoutToolbarControls: () => TableLayoutToolbarControls,
|
|
45
46
|
ToolTip: () => ToolTip,
|
|
46
47
|
TooltipText: () => TooltipText,
|
|
@@ -269,6 +270,40 @@ var import_react_router_dom = require("react-router-dom");
|
|
|
269
270
|
// src/utils/handleApiError.ts
|
|
270
271
|
var import_react_hot_toast = __toESM(require("react-hot-toast"));
|
|
271
272
|
var import_sweetalert2 = __toESM(require("sweetalert2"));
|
|
273
|
+
function classifyError(error) {
|
|
274
|
+
if (!error) {
|
|
275
|
+
return {
|
|
276
|
+
isRetryable: false,
|
|
277
|
+
userMessage: "An error occurred.",
|
|
278
|
+
technicalMessage: "Unknown error",
|
|
279
|
+
suggestedAction: "none"
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const status = error.status ?? error.originalStatus;
|
|
283
|
+
const data = error.data;
|
|
284
|
+
if (status === "FETCH_ERROR" || status === "TIMEOUT_ERROR" || status === "PARSING_ERROR") {
|
|
285
|
+
return {
|
|
286
|
+
isRetryable: true,
|
|
287
|
+
userMessage: "Network error. Please check your connection.",
|
|
288
|
+
technicalMessage: "Network request failed",
|
|
289
|
+
suggestedAction: "retry"
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
if (typeof status === "number" && status >= 500 && status < 600) {
|
|
293
|
+
return {
|
|
294
|
+
isRetryable: true,
|
|
295
|
+
userMessage: "Server is temporarily unavailable. Please try again.",
|
|
296
|
+
technicalMessage: `Server error: ${status}`,
|
|
297
|
+
suggestedAction: "retry"
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
isRetryable: false,
|
|
302
|
+
userMessage: data?.message || data?.title || error.error || "An error occurred. Please try again.",
|
|
303
|
+
technicalMessage: typeof status === "number" || typeof status === "string" ? `Client error: ${status}` : "Request failed",
|
|
304
|
+
suggestedAction: "none"
|
|
305
|
+
};
|
|
306
|
+
}
|
|
272
307
|
var BRAND_ORANGE = "#FF7335";
|
|
273
308
|
var CANCEL_RED = "#ff0000";
|
|
274
309
|
function getConfirmErrorMessage(error) {
|
|
@@ -1746,6 +1781,85 @@ function PopupCellRenderer({
|
|
|
1746
1781
|
}
|
|
1747
1782
|
) });
|
|
1748
1783
|
}
|
|
1784
|
+
|
|
1785
|
+
// src/components/table-error-boundary/TableErrorBoundary.tsx
|
|
1786
|
+
var import_react9 = require("react");
|
|
1787
|
+
var import_fa6 = require("react-icons/fa6");
|
|
1788
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1789
|
+
var TableErrorBoundary = ({
|
|
1790
|
+
isError,
|
|
1791
|
+
isLoading = false,
|
|
1792
|
+
refetch,
|
|
1793
|
+
children,
|
|
1794
|
+
error,
|
|
1795
|
+
errorMessage,
|
|
1796
|
+
className,
|
|
1797
|
+
minHeight = "280px"
|
|
1798
|
+
}) => {
|
|
1799
|
+
const message = (0, import_react9.useMemo)(() => {
|
|
1800
|
+
if (errorMessage) return errorMessage;
|
|
1801
|
+
if (error) return classifyError(error).userMessage;
|
|
1802
|
+
return "Unable to load table data. Please try again.";
|
|
1803
|
+
}, [error, errorMessage]);
|
|
1804
|
+
if (isLoading && !isError) {
|
|
1805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1806
|
+
"div",
|
|
1807
|
+
{
|
|
1808
|
+
className: cn(
|
|
1809
|
+
"flex w-full items-center justify-center rounded-xl bg-neutral-50",
|
|
1810
|
+
className
|
|
1811
|
+
),
|
|
1812
|
+
style: { minHeight },
|
|
1813
|
+
role: "status",
|
|
1814
|
+
"aria-live": "polite",
|
|
1815
|
+
"aria-busy": "true",
|
|
1816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: "40px" })
|
|
1817
|
+
}
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1820
|
+
if (isError) {
|
|
1821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1822
|
+
"div",
|
|
1823
|
+
{
|
|
1824
|
+
className: cn(
|
|
1825
|
+
"flex w-full flex-col items-center justify-center gap-4 rounded-xl border border-red-100 bg-red-50 px-6 py-10 text-center",
|
|
1826
|
+
className
|
|
1827
|
+
),
|
|
1828
|
+
style: { minHeight },
|
|
1829
|
+
role: "alert",
|
|
1830
|
+
"aria-live": "assertive",
|
|
1831
|
+
children: [
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1833
|
+
import_fa6.FaTriangleExclamation,
|
|
1834
|
+
{
|
|
1835
|
+
className: "text-red-500",
|
|
1836
|
+
size: 32,
|
|
1837
|
+
"aria-hidden": true
|
|
1838
|
+
}
|
|
1839
|
+
),
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "max-w-md space-y-1", children: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-base font-semibold text-gray-800", children: "Failed to load data" }),
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-sm text-gray-600", children: message })
|
|
1843
|
+
] }),
|
|
1844
|
+
refetch && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1845
|
+
"button",
|
|
1846
|
+
{
|
|
1847
|
+
type: "button",
|
|
1848
|
+
onClick: () => refetch(),
|
|
1849
|
+
disabled: isLoading,
|
|
1850
|
+
className: "inline-flex items-center gap-2 rounded-lg bg-primary-150 px-4 py-2 text-sm font-medium text-white transition-colors hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
|
|
1851
|
+
children: [
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_fa6.FaArrowsRotate, { className: cn(isLoading && "animate-spin") }),
|
|
1853
|
+
isLoading ? "Retrying..." : "Try again"
|
|
1854
|
+
]
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
]
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children });
|
|
1862
|
+
};
|
|
1749
1863
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1750
1864
|
0 && (module.exports = {
|
|
1751
1865
|
CardSkeleton,
|
|
@@ -1759,6 +1873,7 @@ function PopupCellRenderer({
|
|
|
1759
1873
|
ResetColumnsButton,
|
|
1760
1874
|
ResetFiltersButton,
|
|
1761
1875
|
SearchInput,
|
|
1876
|
+
TableErrorBoundary,
|
|
1762
1877
|
TableLayoutToolbarControls,
|
|
1763
1878
|
ToolTip,
|
|
1764
1879
|
TooltipText,
|