@powerhousedao/contributor-billing 0.0.17 → 0.0.19
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/editors/billing-statement/editor.js +2 -2
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +13 -2
- package/dist/editors/invoice/requestFinance.js +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +11 -3
- package/dist/style.css +8 -6
- package/package.json +1 -1
|
@@ -12,12 +12,12 @@ export default function Editor(props) {
|
|
|
12
12
|
const [notes, setNotes] = useState(state.notes ?? "");
|
|
13
13
|
return (_jsxs("div", { className: "editor-container", children: [_jsxs("div", { className: "grid grid-cols-2 gap-2 border border-gray-500 p-2 rounded-md bg-gray-1001", children: [_jsx("div", { className: "col-span-1 flex items-center", children: _jsx("h1", { className: "text-xl md:text-2xl font-bold", children: "Billing Statement" }) }), _jsxs("div", { className: "grid col-span-1 grid-rows-2 gap-2 justify-end ", children: [_jsxs("div", { className: "col-span-1 space-x-2", children: [_jsx("span", { children: "Submitter" }), _jsx("span", { children: state.contributor })] }), _jsxs("div", { className: "col-span-1 space-x-2", children: [_jsx("span", { children: "Status" }), _jsx("span", { children: state.status })] })] })] }), _jsx("div", { className: "mt-6 p-2", children: _jsxs("div", { className: "flex justify-end", children: [_jsx("span", { className: "mr-2 pt-2", children: "Currency: " }), _jsx(CurrencyForm, { currency: props.document.state.global.currency, handleInputChange: (e) => {
|
|
14
14
|
dispatch(actions.editBillingStatement({ currency: e.target.value }));
|
|
15
|
-
} })] }) }), _jsx("div", { className: "", children: _jsx(LineItemsTable, { state: state, dispatch: dispatch }) }), _jsxs("div", { className: "grid grid-cols-2
|
|
15
|
+
} })] }) }), _jsx("div", { className: "", children: _jsx(LineItemsTable, { state: state, dispatch: dispatch }) }), _jsxs("div", { className: "grid sm:grid-cols-2 two-column-grid", children: [_jsx("div", { className: "mt-6 p-2 two-column-grid:mt-2", children: _jsx(Textarea, { label: "Notes", placeholder: "Add notes", autoExpand: false, rows: 4, multiline: true, value: notes, onBlur: (e) => {
|
|
16
16
|
const newValue = e.target.value;
|
|
17
17
|
if (newValue !== state.notes) {
|
|
18
18
|
dispatch(actions.editBillingStatement({ notes: newValue }));
|
|
19
19
|
}
|
|
20
20
|
}, onChange: (e) => {
|
|
21
21
|
setNotes(e.target.value);
|
|
22
|
-
}, className: "p-2 mb-4" }) }), _jsx("div", { className: "mt-6 p-2
|
|
22
|
+
}, className: "p-2 mb-4" }) }), _jsx("div", { className: "mt-6 p-2 flex justify-center items-center", children: _jsxs("table", { className: "border border-gray-300", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-100", children: [_jsx("th", { className: "border px-4 py-2", children: "Total Fiat" }), _jsx("th", { className: "border px-4 py-2", children: "Total POWT" })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { className: "border px-4 py-2 text-center", children: formatNumber(state.totalCash) }), _jsx("td", { className: "border px-4 py-2 text-center", children: formatNumber(state.totalPowt) })] }) })] }) })] })] }));
|
|
23
23
|
}
|
|
@@ -6,7 +6,7 @@ import { uploadPdfChunked } from "./uploadPdfChunked.js";
|
|
|
6
6
|
import { getCountryCodeFromName } from "./utils/utils.js";
|
|
7
7
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
8
8
|
if (window.document.baseURI !== 'http://localhost:3000/') {
|
|
9
|
-
GRAPHQL_URL = 'https://switchboard-
|
|
9
|
+
GRAPHQL_URL = 'https://switchboard-staging.powerhouse.xyz/graphql/invoice';
|
|
10
10
|
}
|
|
11
11
|
export async function loadPDFFile({ file, dispatch, }) {
|
|
12
12
|
if (!file)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"invoiceToGnosis.d.ts","sourceRoot":"","sources":["../../../editors/invoice/invoiceToGnosis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqLnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
|
|
4
4
|
if (window.document.baseURI !== "http://localhost:3000/") {
|
|
5
|
-
GRAPHQL_URL = "https://switchboard-
|
|
5
|
+
GRAPHQL_URL = "https://switchboard-staging.powerhouse.xyz/graphql/invoice";
|
|
6
6
|
}
|
|
7
7
|
const InvoiceToGnosis = ({ docState }) => {
|
|
8
8
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -113,6 +113,17 @@ const InvoiceToGnosis = ({ docState }) => {
|
|
|
113
113
|
if (!currency || !chainName || currency === "" || chainName === "") {
|
|
114
114
|
return null;
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
const parseChainName = (chainName) => {
|
|
117
|
+
switch (chainName) {
|
|
118
|
+
case "Base":
|
|
119
|
+
return "base";
|
|
120
|
+
case "Ethereum":
|
|
121
|
+
return "eth";
|
|
122
|
+
case "Arbitrum One":
|
|
123
|
+
return "arb";
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const urlChainName = parseChainName(chainName);
|
|
127
|
+
return (_jsxs("div", { className: "space-y-4", children: [currency && chainName && currency !== "" && chainName !== "" && (_jsx("button", { className: "bg-blue-500 text-black px-4 py-2 rounded-md hover:bg-blue-600", onClick: handleInvoiceToGnosis, disabled: isLoading, children: isLoading ? "Processing..." : "Send Payment to Gnosis >" })), error && (_jsx("div", { className: "text-red-500 bg-red-50 p-3 rounded-md", children: error })), safeTxHash && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md space-y-2", children: [_jsxs("p", { className: "font-medium", children: ["Safe Transaction Hash:", _jsx("span", { className: "font-mono text-sm ml-2 break-all", children: safeTxHash })] }), _jsx("a", { href: `https://app.safe.global/transactions/queue?safe=${urlChainName}:0x1FB6bEF04230d67aF0e3455B997a28AFcCe1F45e`, target: "_blank", rel: "noopener noreferrer", className: "text-blue-500 hover:text-blue-600 underline block", children: "View Transaction" })] })), invoiceStatusResponse && (_jsxs("div", { className: "bg-gray-50 p-4 rounded-md", children: [_jsx("p", { className: "font-medium", children: "Payment Details:" }), _jsx("p", { className: "text-gray-700", children: invoiceStatusResponse })] }))] }));
|
|
117
128
|
};
|
|
118
129
|
export default InvoiceToGnosis;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
4
4
|
if (window.document.baseURI !== 'http://localhost:3000/') {
|
|
5
|
-
GRAPHQL_URL = 'https://switchboard-
|
|
5
|
+
GRAPHQL_URL = 'https://switchboard-staging.powerhouse.xyz/graphql/invoice';
|
|
6
6
|
}
|
|
7
7
|
const RequestFinance = ({ docState }) => {
|
|
8
8
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
|
|
9
9
|
if (window.document.baseURI !== 'http://localhost:3000/') {
|
|
10
|
-
GRAPHQL_URL = 'https://switchboard-
|
|
10
|
+
GRAPHQL_URL = 'https://switchboard-staging.powerhouse.xyz/graphql/invoice';
|
|
11
11
|
}
|
|
12
12
|
export async function uploadPdfChunked(pdfData, endpoint = GRAPHQL_URL, chunkSize = 500 * 1024, // 500KB chunks
|
|
13
13
|
onProgress) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validationRules.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/validation/validationRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"validationRules.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/validation/validationRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA8BxD,eAAO,MAAM,iBAAiB,EAAE,cAuB/B,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,cA8BjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAuB7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAuB7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cA8B/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cAkC3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAuBrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAuB5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,cAuBlC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cA8B5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC"}
|
|
@@ -5,7 +5,15 @@ function isValidEthereumAddress(address) {
|
|
|
5
5
|
}
|
|
6
6
|
function isValidIBAN(iban) {
|
|
7
7
|
const ibanRegex = /^([A-Z]{2}[0-9]{2})(?=(?:[A-Z0-9]){9,30}$)((?:[A-Z0-9]{3,5}){2,7})([A-Z0-9]{1,3})?$/;
|
|
8
|
-
|
|
8
|
+
const hasNumbers = /\d/.test(iban);
|
|
9
|
+
// Extract country code from IBAN (first 2 letters)
|
|
10
|
+
const countryCode = iban.substring(0, 2).toUpperCase();
|
|
11
|
+
// If IBAN starts with a valid country code (2 letters), validate full IBAN format
|
|
12
|
+
if (/^[A-Z]{2}$/.test(countryCode)) {
|
|
13
|
+
return ibanRegex.test(iban);
|
|
14
|
+
}
|
|
15
|
+
// Otherwise just check if it's not empty and has numbers
|
|
16
|
+
return iban.trim() !== '' && hasNumbers;
|
|
9
17
|
}
|
|
10
18
|
function isValidEmail(email) {
|
|
11
19
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
@@ -142,7 +150,7 @@ export const bankCountryRule = {
|
|
|
142
150
|
};
|
|
143
151
|
export const accountNumberRule = {
|
|
144
152
|
field: 'accountNum',
|
|
145
|
-
validate: (value) => {
|
|
153
|
+
validate: (value, document) => {
|
|
146
154
|
if (!value || value.trim() === '') {
|
|
147
155
|
return {
|
|
148
156
|
isValid: false,
|
|
@@ -153,7 +161,7 @@ export const accountNumberRule = {
|
|
|
153
161
|
if (!isValidIBAN(value)) {
|
|
154
162
|
return {
|
|
155
163
|
isValid: false,
|
|
156
|
-
message: 'Invalid
|
|
164
|
+
message: 'Invalid account number format - For IBAN, ensure it starts with country code and follows IBAN format',
|
|
157
165
|
severity: 'warning'
|
|
158
166
|
};
|
|
159
167
|
}
|
package/dist/style.css
CHANGED
|
@@ -970,6 +970,11 @@
|
|
|
970
970
|
padding: calc(var(--spacing) * 0);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
+
.sm\:grid-cols-2 {
|
|
974
|
+
@media (width >= 40rem) {
|
|
975
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
976
|
+
}
|
|
977
|
+
}
|
|
973
978
|
.md\:grid-cols-2 {
|
|
974
979
|
@media (width >= 48rem) {
|
|
975
980
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
@@ -6350,12 +6355,9 @@ input[type="number"] {
|
|
|
6350
6355
|
transform: none;
|
|
6351
6356
|
}
|
|
6352
6357
|
}
|
|
6353
|
-
@media (
|
|
6354
|
-
.
|
|
6355
|
-
grid-template-columns: 1fr
|
|
6356
|
-
}
|
|
6357
|
-
.editor-grid-item {
|
|
6358
|
-
width: 100% !important;
|
|
6358
|
+
@media (min-width: 640px) {
|
|
6359
|
+
.two-column-grid {
|
|
6360
|
+
grid-template-columns: 1fr 1fr;
|
|
6359
6361
|
}
|
|
6360
6362
|
}
|
|
6361
6363
|
@property --tw-border-spacing-x {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/contributor-billing",
|
|
3
3
|
"description": "Document models that help contributors of open organisations get paid anonymously for their work on a monthly basis.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.19",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|