@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/dist/esm/index.js
CHANGED
|
@@ -2607,6 +2607,9 @@ const useSDK = () => {
|
|
|
2607
2607
|
return context;
|
|
2608
2608
|
};
|
|
2609
2609
|
const SimpooProvider = ({ apiKey, children, }) => {
|
|
2610
|
+
if (typeof window === "undefined") {
|
|
2611
|
+
return null; // SSR-safe
|
|
2612
|
+
}
|
|
2610
2613
|
return (jsx$1(SDKContext.Provider, { value: { apiKey }, children: jsx$1(Provider_default, { store: store, children: children }) }));
|
|
2611
2614
|
};
|
|
2612
2615
|
|
|
@@ -28751,7 +28754,7 @@ function PaginationComponent({ showBulkActions = true, meta, }) {
|
|
|
28751
28754
|
}, [meta?.per_page]);
|
|
28752
28755
|
return (jsxs("div", { className: cn("flex items-center justify-between gap-4 flex-wrap", meta && meta?.total > 0 ? null : "hidden"), children: [showBulkActions ? (jsxs("div", { className: "flex items-center gap-2.5 shrink-0", children: [jsxs(DropdownMenu, { children: [jsx$1(DropdownMenuTrigger, { asChild: true, children: 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, jsx$1("span", { className: "rotate-90", children: icons.arrow })] }) }), jsx$1(DropdownMenuContent, { align: "center", className: "flex flex-col gap-2.5 rounded-xl border-gray-200 py-2.5", children: rowsPerPage.map((count, index) => (jsx$1(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
|
|
28753
28756
|
? "bg-primary_light text-primary"
|
|
28754
|
-
: "text-gray-700"} `, onClick: () => dispatch(setPerview(count)), children: count }, index))) })] }), jsxs("p", { className: "font-normal text-gray-600 text-[15px]", children: ["Showing ", meta?.from, " - ", meta?.to, " of ", meta?.total] })] })) : null, jsx$1(Pagination, { count: meta?.last_page, page: meta?.current_page, shape: "rounded", color: "primary", onChange: handleChange })] }));
|
|
28757
|
+
: "text-gray-700"} `, onClick: () => dispatch(setPerview(count)), children: count }, index))) })] }), jsxs("p", { className: "font-normal text-gray-600 text-[15px]", children: ["Showing ", meta?.from, " - ", meta?.to, " of ", meta?.total] })] })) : null, jsx$1(Pagination, { count: meta?.last_page || 1, page: meta?.current_page ?? 1, shape: "rounded", color: "primary", onChange: handleChange })] }));
|
|
28755
28758
|
}
|
|
28756
28759
|
|
|
28757
28760
|
function ItemEmpty({ props = {} }) {
|
|
@@ -28780,12 +28783,12 @@ accordionData, hasAccordion, bodyRowClass, tableContainerClass, firstCellClass,
|
|
|
28780
28783
|
.fill(null)
|
|
28781
28784
|
.map((_, index) => (jsx$1(React__default.Fragment, { children: table.getHeaderGroups().map((headerGroup) => (jsx$1(TableRow, { className: cn("border-gray-300 hover:!bg-gray-100 rounded-xl"), children: headerGroup.headers.map((header) => {
|
|
28782
28785
|
return (jsx$1(TableCell, { children: jsx$1(Skeleton, { className: "w-full h-6 rounded-lg" }) }, header.id));
|
|
28783
|
-
}) }, headerGroup.id))) }, index)))) : table?.getRowModel().rows?.length ? (table?.getRowModel().rows.map((row, i) => (jsx$1(Fragment, { children: jsx$1(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) => (jsx$1(TableCell, { className: cn("text-gray-500 text-sm font-bold", tbCellClass, index === 0 && firstCellClass, index === row.getVisibleCells().length - 1 &&
|
|
28786
|
+
}) }, headerGroup.id))) }, index)))) : table?.getRowModel().rows?.length ? (table?.getRowModel().rows.map((row, i) => (jsx$1(React__default.Fragment, { children: jsx$1(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) => (jsx$1(TableCell, { className: cn("text-gray-500 text-sm font-bold", tbCellClass, index === 0 && firstCellClass, index === row.getVisibleCells().length - 1 &&
|
|
28784
28787
|
lastCellClass), children: jsxs("div", { className: "flex", children: [hasAccordion &&
|
|
28785
28788
|
showAccordionDropdown &&
|
|
28786
28789
|
index === 0 && (jsx$1("div", { className: "cursor-pointer inline", children: jsx$1("div", { className: `transform transition-transform duration-200 ${openRowIndex === i
|
|
28787
28790
|
? "-rotate-90"
|
|
28788
|
-
: "rotate-90"}`, children: icons.arrow }) })), " ", jsx$1("div", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) })] }) }, cell.id))) }, row.id) })))) : (jsx$1(TableRow, { children: jsx$1(TableCell, { colSpan: columns.length, className: "h-24 text-center hover:bg-gray-100", children: emptyData ? (jsx$1(ItemEmpty, { props: emptyProps })) : ("No results found.") }) })) })] }) }), showPaginate && (jsx$1(PaginationComponent, { showBulkActions: showBulkActions, meta: meta }))] }));
|
|
28791
|
+
: "rotate-90"}`, children: icons.arrow }) })), " ", jsx$1("div", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) })] }) }, cell.id))) }, row.id) }, row.id)))) : (jsx$1(TableRow, { children: jsx$1(TableCell, { colSpan: columns.length, className: "h-24 text-center hover:bg-gray-100", children: emptyData ? (jsx$1(ItemEmpty, { props: emptyProps })) : ("No results found.") }) })) })] }) }), showPaginate && (jsx$1(PaginationComponent, { showBulkActions: showBulkActions, meta: meta }))] }));
|
|
28789
28792
|
}
|
|
28790
28793
|
|
|
28791
28794
|
function formatToCurrency(value, currency = "NGN", locale = "en-NG") {
|
|
@@ -29360,6 +29363,7 @@ const Title = ({ title, item_uuid, item_type_id, data, }) => {
|
|
|
29360
29363
|
return (jsx$1(Fragment, { children: jsx$1("button", { className: cn(`text-primary font-bold text-sm first-letter:uppercase truncate max-w-[265px]`, data.expired ? "text-danger" : ""), title: title, children: title }) }));
|
|
29361
29364
|
};
|
|
29362
29365
|
|
|
29366
|
+
const emptyImage = require("../../../assets/images/placeholder-image.svg");
|
|
29363
29367
|
const InventoryTable = () => {
|
|
29364
29368
|
const { apiKey } = useSDK();
|
|
29365
29369
|
const [items, setItems] = React__default.useState([]);
|
|
@@ -29399,7 +29403,7 @@ const InventoryTable = () => {
|
|
|
29399
29403
|
if (item.images?.length > 0) {
|
|
29400
29404
|
return item.images[0].image;
|
|
29401
29405
|
}
|
|
29402
|
-
return
|
|
29406
|
+
return emptyImage;
|
|
29403
29407
|
};
|
|
29404
29408
|
return {
|
|
29405
29409
|
item_description: item?.name,
|
|
@@ -29422,7 +29426,6 @@ const InventoryTable = () => {
|
|
|
29422
29426
|
fullData: item,
|
|
29423
29427
|
};
|
|
29424
29428
|
});
|
|
29425
|
-
console.log(items, "items");
|
|
29426
29429
|
return (jsx$1(Table, { loading: loading, columns: itemColumns, data: tableData || [], emptyData: tableData.length === 0, emptyProps: {
|
|
29427
29430
|
header: "No item yet",
|
|
29428
29431
|
subText: "Add new item to start managing your inventory.",
|