@powerhousedao/contributor-billing 0.0.73 → 0.0.75

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.
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,wCAAwC,CAAC;AA6ChD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAm3B3C"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,wCAAwC,CAAC;AAqChD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CA26B3C"}
@@ -8,7 +8,7 @@ import { loadUBLFile } from "./ingestUBL.js";
8
8
  import PDFUploader from "./ingestPDF.js";
9
9
  import RequestFinance from "./requestFinance.js";
10
10
  import InvoiceToGnosis from "./invoiceToGnosis.js";
11
- import { toast, ToastContainer, } from "@powerhousedao/design-system";
11
+ import { toast, ToastContainer } from "@powerhousedao/design-system";
12
12
  import { PDFDownloadLink } from "@react-pdf/renderer";
13
13
  import { InvoicePDF } from "./InvoicePDF.js";
14
14
  import { createRoot } from "react-dom/client";
@@ -21,6 +21,7 @@ import { formatNumber } from "./lineItems.js";
21
21
  import { Textarea } from "@powerhousedao/document-engineering/ui";
22
22
  import ConfirmationModal from "./components/confirmationModal.js";
23
23
  import { ClosePaymentModalContent, ConfirmPaymentModalContent, FinalRejectionModalContent, IssueInvoiceModalContent, RegisterPaymentTxModalContent, RejectInvoiceModalContent, ReportPaymentIssueModalContent, SchedulePaymentModalContent, } from "./components/statusModalComponents.js";
24
+ import { InvoiceStateSchema } from "../../document-models/invoice/gen/schema/zod.js";
24
25
  import validateStatusBeforeContinue from "./validation/validationHandler.js";
25
26
  function isFiatCurrency(currency) {
26
27
  return currencyList.find((c) => c.ticker === currency)?.crypto === false;
@@ -28,6 +29,19 @@ function isFiatCurrency(currency) {
28
29
  export default function Editor(props) {
29
30
  const { document: doc, dispatch } = props;
30
31
  const state = doc.state.global;
32
+ // Dynamic property check based on the actual schema
33
+ try {
34
+ const schema = InvoiceStateSchema();
35
+ const expectedProperties = Object.keys(schema.shape).filter((prop) => prop !== "__typename");
36
+ const missingProperties = expectedProperties.filter((prop) => !(prop in state));
37
+ if (missingProperties.length > 0) {
38
+ // Show error message for missing properties
39
+ return (_jsx("div", { className: "flex items-center justify-center min-h-screen bg-gray-50", children: _jsxs("div", { className: "max-w-md mx-auto text-center p-8 bg-white rounded-lg shadow-lg border border-red-200", children: [_jsx("div", { className: "w-16 h-16 mx-auto mb-4 bg-red-100 rounded-full flex items-center justify-center", children: _jsx("svg", { className: "w-8 h-8 text-red-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z" }) }) }), _jsx("h2", { className: "text-xl font-semibold text-gray-900 mb-2", children: "Document Schema Mismatch" }), _jsx("p", { className: "text-gray-600 mb-4", children: "The current document structure doesn't match the expected schema. This usually happens when using an outdated document model." }), _jsx("p", { className: "text-sm text-gray-500 mb-4", children: "Please create a new document using the latest document model to ensure compatibility." }), _jsxs("details", { className: "text-left text-xs text-gray-600", children: [_jsx("summary", { className: "cursor-pointer hover:text-gray-800", children: "View missing properties" }), _jsx("pre", { className: "mt-2 p-2 bg-gray-100 rounded text-xs overflow-auto max-h-32", children: JSON.stringify(missingProperties, null, 2) })] })] }) }));
40
+ }
41
+ }
42
+ catch (error) {
43
+ console.error("Error checking schema properties:", error);
44
+ }
31
45
  const [fiatMode, setFiatMode] = useState(isFiatCurrency(state.currency));
32
46
  const [uploadDropdownOpen, setUploadDropdownOpen] = useState(false);
33
47
  const [exportDropdownOpen, setExportDropdownOpen] = useState(false);
@@ -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.includes('localhost')) {
9
- GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
9
+ GRAPHQL_URL = 'https://switchboard-staging.powerhouse.xyz/graphql/invoice';
10
10
  }
11
11
  export async function loadPDFFile({ file, dispatch, }) {
12
12
  if (!file)
@@ -3,8 +3,8 @@ import { useState } from "react";
3
3
  import { actions } from "../../document-models/invoice/index.js";
4
4
  import { generateId } from "document-model";
5
5
  let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
6
- if (!window.document.baseURI.includes("localhost")) {
7
- GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
6
+ if (!window.document.baseURI.includes('localhost')) {
7
+ GRAPHQL_URL = 'https://switchboard-staging.powerhouse.xyz/graphql/invoice';
8
8
  }
9
9
  const InvoiceToGnosis = ({ docState, dispatch, }) => {
10
10
  const [isLoading, setIsLoading] = useState(false);
@@ -3,8 +3,8 @@ import { useState } from "react";
3
3
  import { actions } from "../../document-models/invoice/index.js";
4
4
  import { generateId } from "document-model";
5
5
  let GRAPHQL_URL = "http://localhost:4001/graphql/invoice";
6
- if (!window.document.baseURI.includes("localhost")) {
7
- GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
6
+ if (!window.document.baseURI.includes('localhost')) {
7
+ GRAPHQL_URL = 'https://switchboard-staging.powerhouse.xyz/graphql/invoice';
8
8
  }
9
9
  const RequestFinance = ({ docState, dispatch, }) => {
10
10
  const [isLoading, setIsLoading] = useState(false);
@@ -76,7 +76,7 @@ const RequestFinance = ({ docState, dispatch, }) => {
76
76
  };
77
77
  if (docState.issuer.paymentRouting.bank.ABA &&
78
78
  docState.issuer.paymentRouting.bank.ABA.trim() !== "") {
79
- bankDetails.achRoutingNumber = docState.issuer.paymentRouting.bank.ABA;
79
+ bankDetails.routingNumber = docState.issuer.paymentRouting.bank.ABA;
80
80
  }
81
81
  const getDecimalPlaces = (currency) => {
82
82
  const formatter = new Intl.NumberFormat("en-US", {
@@ -194,7 +194,7 @@ const RequestFinance = ({ docState, dispatch, }) => {
194
194
  ? "Schedule Payment in Request Finance"
195
195
  : "Reschedule Payment in Request Finance" }), invoiceLink && (_jsxs("div", { children: [_jsx("div", { className: "direct-payment-status", children: _jsx("p", { children: directPaymentStatus }) }), _jsx("div", { className: "invoice-link text-blue-900 hover:text-blue-600", children: _jsx("a", { href: invoiceLink, target: "_blank", rel: "noopener noreferrer", className: "view-invoice-button", children: liktText }) })] })), !invoiceLink &&
196
196
  invoiceStatus === "PAYMENTSCHEDULED" &&
197
- docState.payments.length > 0 && (_jsx(_Fragment, { children: docState.payments[docState.payments.length - 1].issue !== "" ? (_jsx("div", { className: "mt-4", children: _jsxs("p", { className: "text-red-700 font-medium", children: ["Issue: ", docState.payments[docState.payments.length - 1].issue] }) })) : (_jsx("div", { className: "mt-4", children: _jsx("div", { className: "invoice-link text-blue-900 hover:text-blue-600", children: _jsx("a", { className: "view-invoice-button", href: docState.payments[docState.payments.length - 1]
197
+ docState.payments?.length > 0 && (_jsx(_Fragment, { children: docState.payments[docState.payments.length - 1].issue !== "" ? (_jsx("div", { className: "mt-4", children: _jsxs("p", { className: "text-red-700 font-medium", children: ["Issue: ", docState.payments[docState.payments.length - 1].issue] }) })) : (_jsx("div", { className: "mt-4", children: _jsx("div", { className: "invoice-link text-blue-900 hover:text-blue-600", children: _jsx("a", { className: "view-invoice-button", href: docState.payments[docState.payments.length - 1]
198
198
  .processorRef, target: "_blank", rel: "noopener noreferrer", children: liktText }) }) })) }))] }));
199
199
  };
200
200
  export default RequestFinance;
@@ -7,7 +7,7 @@
7
7
  */
8
8
  let GRAPHQL_URL = 'http://localhost:4001/graphql/invoice';
9
9
  if (!window.document.baseURI.includes('localhost')) {
10
- GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
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) {
package/dist/style.css CHANGED
@@ -9,6 +9,7 @@
9
9
  "Courier New", monospace;
10
10
  --color-red-50: oklch(97.1% 0.013 17.38);
11
11
  --color-red-100: oklch(93.6% 0.032 17.717);
12
+ --color-red-200: oklch(88.5% 0.062 18.334);
12
13
  --color-red-300: oklch(80.8% 0.114 19.571);
13
14
  --color-red-400: oklch(70.4% 0.191 22.216);
14
15
  --color-red-500: oklch(63.7% 0.237 25.331);
@@ -321,6 +322,9 @@
321
322
  max-width: 96rem;
322
323
  }
323
324
  }
325
+ .mx-auto {
326
+ margin-inline: auto;
327
+ }
324
328
  .my-6 {
325
329
  margin-block: calc(var(--spacing) * 6);
326
330
  }
@@ -409,18 +413,27 @@
409
413
  .h-4 {
410
414
  height: calc(var(--spacing) * 4);
411
415
  }
416
+ .h-8 {
417
+ height: calc(var(--spacing) * 8);
418
+ }
412
419
  .h-10 {
413
420
  height: calc(var(--spacing) * 10);
414
421
  }
415
422
  .h-12 {
416
423
  height: calc(var(--spacing) * 12);
417
424
  }
425
+ .h-16 {
426
+ height: calc(var(--spacing) * 16);
427
+ }
418
428
  .h-32 {
419
429
  height: calc(var(--spacing) * 32);
420
430
  }
421
431
  .h-full {
422
432
  height: 100%;
423
433
  }
434
+ .max-h-32 {
435
+ max-height: calc(var(--spacing) * 32);
436
+ }
424
437
  .min-h-\[48px\] {
425
438
  min-height: 48px;
426
439
  }
@@ -608,6 +621,9 @@
608
621
  .justify-self-end {
609
622
  justify-self: flex-end;
610
623
  }
624
+ .overflow-auto {
625
+ overflow: auto;
626
+ }
611
627
  .overflow-hidden {
612
628
  overflow: hidden;
613
629
  }
@@ -684,6 +700,9 @@
684
700
  .border-gray-500 {
685
701
  border-color: var(--color-gray-500);
686
702
  }
703
+ .border-red-200 {
704
+ border-color: var(--color-red-200);
705
+ }
687
706
  .border-slate-100 {
688
707
  border-color: var(--color-slate-100);
689
708
  }
@@ -732,6 +751,9 @@
732
751
  .bg-red-50 {
733
752
  background-color: var(--color-red-50);
734
753
  }
754
+ .bg-red-100 {
755
+ background-color: var(--color-red-100);
756
+ }
735
757
  .bg-red-500 {
736
758
  background-color: var(--color-red-500);
737
759
  }
@@ -762,6 +784,9 @@
762
784
  .p-6 {
763
785
  padding: calc(var(--spacing) * 6);
764
786
  }
787
+ .p-8 {
788
+ padding: calc(var(--spacing) * 8);
789
+ }
765
790
  .px-1 {
766
791
  padding-inline: calc(var(--spacing) * 1);
767
792
  }
@@ -1107,6 +1132,13 @@
1107
1132
  }
1108
1133
  }
1109
1134
  }
1135
+ .hover\:text-gray-800 {
1136
+ &:hover {
1137
+ @media (hover: hover) {
1138
+ color: var(--color-gray-800);
1139
+ }
1140
+ }
1141
+ }
1110
1142
  .hover\:opacity-80 {
1111
1143
  &:hover {
1112
1144
  @media (hover: hover) {
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.73",
4
+ "version": "0.0.75",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [