Socket
Socket
Sign inDemoInstall

@qore-project/urshipper-custom-table-component

Package Overview
Dependencies
20
Maintainers
5
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 1.1.4

.rollup.cache/Users/albarms/Workspace/Feedloop/solution-project-component/urshipper-custom-table/src/func/label.js

90

.rollup.cache/Users/albarms/Workspace/Feedloop/solution-project-component/urshipper-custom-table/src/urshipper-custom-table.js

@@ -1,2 +0,2 @@

import { __awaiter, __rest } from "tslib";
import { __rest } from "tslib";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";

@@ -10,4 +10,2 @@ import React, { useEffect, useMemo, useState } from 'react';

import matchSorter from 'match-sorter';
import { bulkPrintLabel } from './utils/bulk-print-label.js';
import { generateInvoice } from './utils/generate-invoice.js';
import { defaultSchema } from './utils/default-schema.js';

@@ -39,2 +37,3 @@ import { iconsList } from '@qorebase/app-component';

const { isOpen, onOpen, onClose } = useDisclosure();
const client = props.hooks.useClient();
const toast = useToast();

@@ -59,2 +58,5 @@ const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, selectedFlatRows, state: { selectedRowIds }, setGlobalFilter, } = useTable({

const actionTwo = props.hooks.useActionTrigger(props.properties.action_1, selectedItem, props.pageSource);
const actionThree = props.hooks.useActionTrigger(props.properties.action_3, selectedItem, props.pageSource);
const actionFour = props.hooks.useActionTrigger(props.properties.action_4, selectedItem, props.pageSource);
const actionFive = props.hooks.useActionTrigger(props.properties.action_5, selectedItem, props.pageSource);
const handleFilterInputChange = (e) => {

@@ -68,37 +70,2 @@ const { value } = e.currentTarget;

}, [selectedFlatRows]);
const handlePrint = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
if (!userId || !(selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.length))
return;
const shippingIds = selectedRow.map((item) => item.id);
const printLabelResponse = yield bulkPrintLabel(userId, shippingIds);
if ((printLabelResponse === null || printLabelResponse === void 0 ? void 0 : printLabelResponse.status) == 200) {
onOpen();
}
else {
toast({
title: `Failed print label`,
status: 'error',
isClosable: false,
});
}
return printLabelResponse;
}), [selectedRow, userId]);
const handleCreateInvoice = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
if (!userId || !(selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.length))
return;
const createInvoiceResponse = yield generateInvoice(userId, selectedRow);
return createInvoiceResponse;
}), [selectedRow, userId]);
const client = props.hooks.useClient();
const triggerDenoAction = () => __awaiter(this, void 0, void 0, function* () {
const server = `https://staging-qore-data-apple-202883.qore.dev`;
const actionResponse = yield client.project.axios.post(`${server}/v1/action/action/create_xendit_invoice/1`, { args: { userId: 'albar@feedloop.io', shipment: selectedRow } }, {
headers: {
authority: 'staging-qore-data-apple-202883.qore.dev',
'x-qore-engine-admin-secret': 'LPUFvfGKE6KscQt5DAYb2AtqZiUjm76Z',
},
});
console.log(actionResponse);
return actionResponse.data;
});
const handleClickActionOne = (item) => {

@@ -108,3 +75,2 @@ console.log({ item });

actionOne.handleClick();
return;
};

@@ -115,7 +81,16 @@ const handleClickActionTwo = (item) => {

actionTwo.handleClick();
return;
};
const handleCreateSingleInvoice = (data) => {
return data;
const handleClickActionThree = (item) => {
console.log({ item });
setSelectedItem(item);
actionThree.handleClick();
};
const handleClickActionFour = (item) => {
setSelectedItem(item);
actionFour.handleClick();
};
const handleClickActionFive = (item) => {
setSelectedItem(item);
actionFive.handleClick();
};
return (_jsxs(_Fragment, { children: [_jsx(ActionModal, { isOpen: isOpen, onClose: onClose, rowData: selectedRow }), _jsx(Flex, Object.assign({ w: "100%" }, { children: _jsxs(HStack, Object.assign({ alignItems: 'center', w: "xs" }, { children: [_jsx(IconButton, { onClick: handleClickActionTwo, colorScheme: "blue", "aria-label": "Search database", icon: _jsx(BiPlus, {}) }), _jsx(Input, { type: "text", onChange: handleFilterInputChange, placeholder: "Search here.." })] })) })), _jsx(TableContainer, Object.assign({ p: "5" }, { children: _jsxs(Table, Object.assign({}, getTableProps(), { children: [_jsx(Thead, { children: headerGroups.map((headerGroup, index) => (_jsxs(Tr, Object.assign({}, headerGroup.getHeaderGroupProps(), { children: [index == 0 && _jsx(Th, { children: "action" }), headerGroup.headers.map((column) => (_jsxs(Th, Object.assign({ textTransform: 'capitalize' }, column.getHeaderProps(column.getSortByToggleProps()), { children: [column.render('Header'), _jsx(chakra.span, Object.assign({ pl: "4" }, { children: column.isSorted ? (column.isSortedDesc ? (_jsx(Icon, { as: iconsList['ArrowUp'], "aria-label": "sorted descending" })) : (_jsx(Icon, { as: iconsList['ArrowDown'], "aria-label": "sorted ascending" }))) : null }))] }))))] })))) }), _jsx(Tbody, Object.assign({}, getTableBodyProps(), { children: rows.slice(0, 10).map((row, i) => {

@@ -125,5 +100,5 @@ prepareRow(row);

backgroundColor: 'rgba(249, 247, 242, 1)',
}, color: "rgba(69, 69, 69, 1)", fontSize: "14px", fontWeight: "400", p: "16px", w: "100%", justifyContent: "flex-start", variant: "ghost" }, { children: "Edit" })), _jsx(Button, Object.assign({ onClick: () => handleCreateSingleInvoice(row.values), leftIcon: _jsx(FaPrint, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }), _hover: {
}, color: "rgba(69, 69, 69, 1)", fontSize: "14px", fontWeight: "400", p: "16px", w: "100%", justifyContent: "flex-start", variant: "ghost" }, { children: "Edit" })), _jsx(Button, Object.assign({ onClick: () => handleClickActionTwo(row.values), leftIcon: _jsx(FaPrint, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }), _hover: {
backgroundColor: 'rgba(249, 247, 242, 1)',
}, color: "rgba(69, 69, 69, 1)", fontSize: "14px", fontWeight: "400", p: "16px", w: "100%", justifyContent: "flex-start", variant: "ghost" }, { children: "Print Label" })), type == 'admin' && (_jsx(Button, Object.assign({ onClick: triggerDenoAction, leftIcon: _jsx(FaFileInvoice, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }), _hover: {
}, color: "rgba(69, 69, 69, 1)", fontSize: "14px", fontWeight: "400", p: "16px", w: "100%", justifyContent: "flex-start", variant: "ghost" }, { children: "Print Label" })), type == 'admin' && (_jsx(Button, Object.assign({ onClick: () => handleClickActionThree(row.values), leftIcon: _jsx(FaFileInvoice, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }), _hover: {
backgroundColor: 'rgba(249, 247, 242, 1)',

@@ -133,3 +108,3 @@ }, color: "rgba(69, 69, 69, 1)", fontSize: "14px", fontWeight: "400", p: "16px", w: "100%", justifyContent: "flex-start", variant: "ghost" }, { children: "Create Inovice" })))] })) })) })) })] })) })), row.cells.map((cell) => {

})] })));
}) }))] })) })), (selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.length) >= 1 && (_jsx(Box, Object.assign({ mt: "5" }, { children: _jsxs(Menu, { children: [_jsx(MenuButton, Object.assign({ as: Button, size: "sm", rightIcon: _jsx(BiChevronDown, {}) }, { children: "Actions" })), _jsxs(MenuList, { children: [_jsx(MenuItem, Object.assign({ onClick: () => handlePrint(), icon: _jsx(FaPrint, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }) }, { children: "Print Label" })), type == 'admin' && (_jsx(MenuItem, Object.assign({ onClick: () => triggerDenoAction(), icon: _jsx(FaFileInvoice, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }) }, { children: "Create Inovice" })))] })] }) })))] }));
}) }))] })) })), (selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.length) >= 1 && (_jsx(Box, Object.assign({ mt: "5" }, { children: _jsxs(Menu, { children: [_jsx(MenuButton, Object.assign({ as: Button, size: "sm", rightIcon: _jsx(BiChevronDown, {}) }, { children: "Actions" })), _jsxs(MenuList, { children: [_jsx(MenuItem, Object.assign({ onClick: () => handleClickActionFour(selectedItem), icon: _jsx(FaPrint, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }) }, { children: "Print Label" })), type == 'admin' && (_jsx(MenuItem, Object.assign({ onClick: () => handleClickActionFive(selectedItem), icon: _jsx(FaFileInvoice, { color: "rgba(162, 162, 162, 1)", fontSize: "16px" }) }, { children: "Create Inovice" })))] })] }) })))] }));
}

@@ -155,2 +130,5 @@ function filterGreaterThan(rows, id, filterValue) {

action_2: [{ type: 'none' }],
action_3: [{ type: 'none' }],
action_4: [{ type: 'none' }],
action_5: [{ type: 'none' }],
},

@@ -173,3 +151,3 @@ propDefinition: {

group: 'Action',
label: 'Item Action',
label: 'Row Action 1',
type: 'action',

@@ -180,6 +158,24 @@ options: [{ type: 'none' }],

group: 'Action',
label: 'Item Action',
label: 'Row Action 2',
type: 'action',
options: [{ type: 'none' }],
},
action_3: {
group: 'Action',
label: 'Row Action 3',
type: 'action',
options: [{ type: 'none' }],
},
action_4: {
group: 'Action',
label: 'Bulk Action 1',
type: 'action',
options: [{ type: 'none' }],
},
action_5: {
group: 'Action',
label: 'Bulk Action 2',
type: 'action',
options: [{ type: 'none' }],
},
},

@@ -186,0 +182,0 @@ Component: (props) => {

{
"name": "@qore-project/urshipper-custom-table-component",
"version": "1.1.3",
"version": "1.1.4",
"module": "lib/urshipper-custom-table.js",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc