@simpoobusiness/sdk 1.0.1 → 1.0.4
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/README.md +1 -1
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +8 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -62,4 +62,4 @@ Each component may accept specific props. For example, `InventoryTable`:
|
|
|
62
62
|
|
|
63
63
|
## 📖 Documentation
|
|
64
64
|
|
|
65
|
-
See the [official docs](https://
|
|
65
|
+
See the [official docs](https://savics407.github.io/simpoo-sdk/) for more details and advanced usage.
|
package/dist/cjs/index.js
CHANGED
|
@@ -2627,6 +2627,9 @@ const useSDK = () => {
|
|
|
2627
2627
|
return context;
|
|
2628
2628
|
};
|
|
2629
2629
|
const SimpooProvider = ({ apiKey, children, }) => {
|
|
2630
|
+
if (typeof window === "undefined") {
|
|
2631
|
+
return null; // SSR-safe
|
|
2632
|
+
}
|
|
2630
2633
|
return (jsxRuntime.jsx(SDKContext.Provider, { value: { apiKey }, children: jsxRuntime.jsx(Provider_default, { store: store, children: children }) }));
|
|
2631
2634
|
};
|
|
2632
2635
|
|
|
@@ -28771,7 +28774,7 @@ function PaginationComponent({ showBulkActions = true, meta, }) {
|
|
|
28771
28774
|
}, [meta?.per_page]);
|
|
28772
28775
|
return (jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between gap-4 flex-wrap", meta && meta?.total > 0 ? null : "hidden"), children: [showBulkActions ? (jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5 shrink-0", children: [jsxRuntime.jsxs(DropdownMenu, { children: [jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: jsxRuntime.jsxs("button", { className: "rounded-md h-9 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 ", children: [perview, jsxRuntime.jsx("span", { className: "rotate-90", children: icons.arrow })] }) }), jsxRuntime.jsx(DropdownMenuContent, { align: "center", className: "flex flex-col gap-2.5 rounded-xl border-gray-200 py-2.5", children: rowsPerPage.map((count, index) => (jsxRuntime.jsx(DropdownMenuItem, { className: `capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-sm cursor-pointer px-[15px] flex items-center gap-[5px] ${perview === count
|
|
28773
28776
|
? "bg-primary_light text-primary"
|
|
28774
|
-
: "text-gray-700"} `, onClick: () => dispatch(setPerview(count)), children: count }, index))) })] }), jsxRuntime.jsxs("p", { className: "font-normal text-gray-600 text-[15px]", children: ["Showing ", meta?.from, " - ", meta?.to, " of ", meta?.total] })] })) : null, jsxRuntime.jsx(Pagination, { count: meta?.last_page, page: meta?.current_page, shape: "rounded", color: "primary", onChange: handleChange })] }));
|
|
28777
|
+
: "text-gray-700"} `, onClick: () => dispatch(setPerview(count)), children: count }, index))) })] }), jsxRuntime.jsxs("p", { className: "font-normal text-gray-600 text-[15px]", children: ["Showing ", meta?.from, " - ", meta?.to, " of ", meta?.total] })] })) : null, jsxRuntime.jsx(Pagination, { count: meta?.last_page || 1, page: meta?.current_page ?? 1, shape: "rounded", color: "primary", onChange: handleChange })] }));
|
|
28775
28778
|
}
|
|
28776
28779
|
|
|
28777
28780
|
function ItemEmpty({ props = {} }) {
|
|
@@ -28800,12 +28803,12 @@ accordionData, hasAccordion, bodyRowClass, tableContainerClass, firstCellClass,
|
|
|
28800
28803
|
.fill(null)
|
|
28801
28804
|
.map((_, index) => (jsxRuntime.jsx(React.Fragment, { children: table.getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx(TableRow, { className: cn("border-gray-300 hover:!bg-gray-100 rounded-xl"), children: headerGroup.headers.map((header) => {
|
|
28802
28805
|
return (jsxRuntime.jsx(TableCell, { children: jsxRuntime.jsx(Skeleton, { className: "w-full h-6 rounded-lg" }) }, header.id));
|
|
28803
|
-
}) }, headerGroup.id))) }, index)))) : table?.getRowModel().rows?.length ? (table?.getRowModel().rows.map((row, i) => (jsxRuntime.jsx(
|
|
28806
|
+
}) }, headerGroup.id))) }, index)))) : table?.getRowModel().rows?.length ? (table?.getRowModel().rows.map((row, i) => (jsxRuntime.jsx(React.Fragment, { children: jsxRuntime.jsx(TableRow, { onClick: () => toggleAccordion(i, row.original), "data-state": row.getIsSelected() && "selected", className: `border-gray-300 hover:!bg-gray-100 data-[state=selected]:bg-gray-100 ${bodyRowClass} `, children: row.getVisibleCells().map((cell, index) => (jsxRuntime.jsx(TableCell, { className: cn("text-gray-500 text-sm font-bold", tbCellClass, index === 0 && firstCellClass, index === row.getVisibleCells().length - 1 &&
|
|
28804
28807
|
lastCellClass), children: jsxRuntime.jsxs("div", { className: "flex", children: [hasAccordion &&
|
|
28805
28808
|
showAccordionDropdown &&
|
|
28806
28809
|
index === 0 && (jsxRuntime.jsx("div", { className: "cursor-pointer inline", children: jsxRuntime.jsx("div", { className: `transform transition-transform duration-200 ${openRowIndex === i
|
|
28807
28810
|
? "-rotate-90"
|
|
28808
|
-
: "rotate-90"}`, children: icons.arrow }) })), " ", jsxRuntime.jsx("div", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) })] }) }, cell.id))) }, row.id) })))) : (jsxRuntime.jsx(TableRow, { children: jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center hover:bg-gray-100", children: emptyData ? (jsxRuntime.jsx(ItemEmpty, { props: emptyProps })) : ("No results found.") }) })) })] }) }), showPaginate && (jsxRuntime.jsx(PaginationComponent, { showBulkActions: showBulkActions, meta: meta }))] }));
|
|
28811
|
+
: "rotate-90"}`, children: icons.arrow }) })), " ", jsxRuntime.jsx("div", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) })] }) }, cell.id))) }, row.id) }, row.id)))) : (jsxRuntime.jsx(TableRow, { children: jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center hover:bg-gray-100", children: emptyData ? (jsxRuntime.jsx(ItemEmpty, { props: emptyProps })) : ("No results found.") }) })) })] }) }), showPaginate && (jsxRuntime.jsx(PaginationComponent, { showBulkActions: showBulkActions, meta: meta }))] }));
|
|
28809
28812
|
}
|
|
28810
28813
|
|
|
28811
28814
|
function formatToCurrency(value, currency = "NGN", locale = "en-NG") {
|
|
@@ -29380,6 +29383,7 @@ const Title = ({ title, item_uuid, item_type_id, data, }) => {
|
|
|
29380
29383
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("button", { className: cn(`text-primary font-bold text-sm first-letter:uppercase truncate max-w-[265px]`, data.expired ? "text-danger" : ""), title: title, children: title }) }));
|
|
29381
29384
|
};
|
|
29382
29385
|
|
|
29386
|
+
const emptyImage = require("../../../assets/images/placeholder-image.svg");
|
|
29383
29387
|
const InventoryTable = () => {
|
|
29384
29388
|
const { apiKey } = useSDK();
|
|
29385
29389
|
const [items, setItems] = React.useState([]);
|
|
@@ -29419,7 +29423,7 @@ const InventoryTable = () => {
|
|
|
29419
29423
|
if (item.images?.length > 0) {
|
|
29420
29424
|
return item.images[0].image;
|
|
29421
29425
|
}
|
|
29422
|
-
return
|
|
29426
|
+
return emptyImage;
|
|
29423
29427
|
};
|
|
29424
29428
|
return {
|
|
29425
29429
|
item_description: item?.name,
|
|
@@ -29442,7 +29446,6 @@ const InventoryTable = () => {
|
|
|
29442
29446
|
fullData: item,
|
|
29443
29447
|
};
|
|
29444
29448
|
});
|
|
29445
|
-
console.log(items, "items");
|
|
29446
29449
|
return (jsxRuntime.jsx(Table, { loading: loading, columns: itemColumns, data: tableData || [], emptyData: tableData.length === 0, emptyProps: {
|
|
29447
29450
|
header: "No item yet",
|
|
29448
29451
|
subText: "Add new item to start managing your inventory.",
|