@powerhousedao/contributor-billing 0.0.18 → 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/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/package.json +1 -1
|
@@ -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/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": [
|