@powerhousedao/contributor-billing 0.0.37 → 0.0.38

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":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,GAAI,wIAS5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,4CAyFA,CAAC"}
1
+ {"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,GAAI,wIAS5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,4CA2IA,CAAC"}
@@ -22,6 +22,7 @@ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], on
22
22
  "PAYMENTSCHEDULED",
23
23
  "PAYMENTSENT",
24
24
  "PAYMENTRECEIVED",
25
+ "PAYMENTCLOSED"
25
26
  ];
26
27
  const canExport = selectedStatuses.length > 0 &&
27
28
  selectedStatuses.every((status) => allowedStatuses.includes(status));
@@ -33,8 +34,11 @@ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], on
33
34
  }, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" })] })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
34
35
  width: "200px",
35
36
  height: "30px",
36
- }, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), _jsx(ConfirmationModal, { open: showCurrencyModal, onCancel: () => setShowCurrencyModal(false), onContinue: () => {
37
+ }, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), showCurrencyModal && (_jsx("div", { className: "fixed inset-0", children: _jsxs("div", { className: "absolute left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 bg-white rounded shadow-lg p-6 min-w-[300px] flex flex-col items-center", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Select Base Currency" }), _jsx("p", { className: "text-red-600 text-sm mb-2", children: "Chosen currency should match the base currency of the accounting." }), _jsx("select", { className: "border border-gray-300 rounded px-2 py-1 mb-4", value: selectedCurrency, onChange: (e) => setSelectedCurrency(e.target.value), children: currencyOptions.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { className: "bg-blue-600 text-white px-4 py-1 rounded hover:bg-blue-700", onClick: () => {
38
+ setShowCurrencyModal(false);
39
+ onExport?.(selectedCurrency);
40
+ }, children: "Export" }), _jsx("button", { className: "bg-gray-200 px-4 py-1 rounded hover:bg-gray-300", onClick: () => setShowCurrencyModal(false), children: "Cancel" })] })] }) })), _jsxs(ConfirmationModal, { open: showCurrencyModal, onCancel: () => setShowCurrencyModal(false), onContinue: () => {
37
41
  setShowCurrencyModal(false);
38
42
  onExport?.(selectedCurrency);
39
- }, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" }) })] }));
43
+ }, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: [_jsx("p", { style: { color: 'red', marginTop: '1rem', marginBottom: '1rem', fontWeight: 500 }, children: "\u26A0 Warning: the chosen currency should match the base currency of the accounting system." }), _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" })] })] }));
40
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAU/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8CAA8C,CAAC;AAwBtD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,GAAI,0LAc1B,iBAAiB,4CA4rBnB,CAAC"}
1
+ {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAU/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8CAA8C,CAAC;AAwBtD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,GAAI,0LAc1B,iBAAiB,4CAysBnB,CAAC"}
@@ -102,6 +102,14 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
102
102
  }
103
103
  return name;
104
104
  };
105
+ // Remove all non-alphanumeric, non-hyphen, non-underscore chars for slug safety
106
+ const makeSlug = (name) => {
107
+ return name
108
+ .replace(/\./g, "") // remove dots
109
+ .replace(/\s+/g, "-") // replace spaces with hyphens
110
+ .replace(/[^\w-]/g, "") // remove all non-word chars except hyphen/underscore
111
+ .toLowerCase();
112
+ };
105
113
  const handleCreateBillingStatement = async (id) => {
106
114
  const driveId = selectedNode?.id;
107
115
  if (!driveId)
@@ -111,7 +119,7 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
111
119
  const newDocumentId = generateId();
112
120
  await addDocument(driveId, `bill-${invoiceFile?.name}`, "powerhouse/billing-statement", undefined, {
113
121
  id: newDocumentId,
114
- slug: `bill-${cleanName(invoiceFile?.name || "")}`,
122
+ slug: `bill-${makeSlug(invoiceFile?.name || "")}`,
115
123
  name: `bill-${cleanName(invoiceFile?.name || "")}`,
116
124
  created: new Date().toISOString(),
117
125
  lastModified: new Date().toISOString(),
@@ -250,22 +258,22 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
250
258
  })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("ISSUED") && (_jsx(InvoiceTableSection, { title: "Issued", count: issued.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: issued.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
251
259
  ...prev,
252
260
  [row.id]: checked,
253
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("ACCEPTED") && (_jsx(InvoiceTableSection, { title: "Accepted", count: accepted.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: accepted.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
261
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("ACCEPTED") && (_jsx(InvoiceTableSection, { title: "Accepted", count: accepted.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: accepted.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
254
262
  ...prev,
255
263
  [row.id]: checked,
256
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSCHEDULED") && (_jsx(InvoiceTableSection, { title: "Payment Scheduled", count: paymentScheduled.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentScheduled.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
264
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSCHEDULED") && (_jsx(InvoiceTableSection, { title: "Payment Scheduled", count: paymentScheduled.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentScheduled.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
257
265
  ...prev,
258
266
  [row.id]: checked,
259
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSENT") && (_jsx(InvoiceTableSection, { title: "Payment Sent", count: paymentSent.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentSent.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
267
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTSENT") && (_jsx(InvoiceTableSection, { title: "Payment Sent", count: paymentSent.length, color: "bg-green-100 text-green-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentSent.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
260
268
  ...prev,
261
269
  [row.id]: checked,
262
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTISSUE") && (_jsx(InvoiceTableSection, { title: "Payment Issue", count: paymentIssue.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentIssue.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
270
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTISSUE") && (_jsx(InvoiceTableSection, { title: "Payment Issue", count: paymentIssue.length, color: "bg-yellow-100 text-yellow-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentIssue.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
263
271
  ...prev,
264
272
  [row.id]: checked,
265
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTCLOSED") && (_jsx(InvoiceTableSection, { title: "Payment Closed", count: paymentClosed.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentClosed.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
273
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode, onCreateBillingStatement: handleCreateBillingStatement, billingDocStates: billingDocStates }, row.id))) })] }) })), shouldShowSection("PAYMENTCLOSED") && (_jsx(InvoiceTableSection, { title: "Payment Closed", count: paymentClosed.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: paymentClosed.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
266
274
  ...prev,
267
275
  [row.id]: checked,
268
- })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-centert", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
276
+ })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("REJECTED") && (_jsx(InvoiceTableSection, { title: "Rejected", count: rejected.length, color: "bg-red-500 text-black-600", children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: rejected.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
269
277
  ...prev,
270
278
  [row.id]: checked,
271
279
  })), menuOptions: getMenuOptions(), onMenuAction: (action) => { }, setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("OTHER") && (_jsx(InvoiceTableSection, { title: "Other", count: otherInvoices.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Exported" })] }) }), _jsx("tbody", { children: otherInvoices.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,eAAe,GAAI,6JAY7B;IACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,GAAG,EAAE,GAAG,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D,4CA8FA,CAAC"}
1
+ {"version":3,"file":"InvoiceTableRow.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,eAAe,GAAI,6JAY7B;IACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,GAAG,EAAE,GAAG,CAAC;IACT,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D,4CA2GA,CAAC"}
@@ -7,5 +7,7 @@ export const InvoiceTableRow = ({ files, row, isSelected, onSelect, menuOptions,
7
7
  const billingDoc = billingDocStates?.find((doc) => doc.contributor === row.id);
8
8
  const billingFile = files?.find((file) => file.id === billingDoc?.id);
9
9
  const file = files?.find((file) => file.id === row.id);
10
- return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { uiNode: file, onSelectNode: () => setActiveDocumentId(row.id), onRenameNode: (name) => renameNode(row.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(row.id), isAllowedToCreateDocuments: true, className: "h-10" }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: row.amount }), (row.status === "ISSUED" || row.status === "PAYMENTSCHEDULED" || row.status === "PAYMENTRECEIVED") && !billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { uiNode: billingFile, onSelectNode: () => setActiveDocumentId(billingDoc?.id), onRenameNode: (name) => renameNode(billingDoc?.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(billingDoc?.id), isAllowedToCreateDocuments: true, className: "h-10" }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: row.exported.timestamp ? _jsx("span", { className: "text-green-500", children: "Yes" }) : _jsx("span", { className: "text-red-500", children: "No" }) })] }));
10
+ const hasExportedData = row.exported != null &&
11
+ (Boolean(row.exported.timestamp?.trim()));
12
+ return (_jsxs("tr", { className: "hover:bg-gray-50", children: [_jsx("td", { className: "px-2 py-2", children: _jsx("input", { type: "checkbox", checked: isSelected, onChange: (e) => onSelect(e.target.checked), className: "size-4 rounded border-gray-300 text-blue-600 focus:ring-2 focus:ring-blue-500" }) }), _jsx("td", { className: "py-1 w-10", children: file && (_jsx(FileItem, { uiNode: file, onSelectNode: () => setActiveDocumentId(row.id), onRenameNode: (name) => renameNode(row.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(row.id), isAllowedToCreateDocuments: true, className: "h-10" }, row.id)) }), _jsx("td", { className: "px-2 py-2 text-center", children: row.invoiceNo }), _jsx("td", { className: "px-2 py-2 text-center", children: row.issueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.dueDate }), _jsx("td", { className: "px-2 py-2 text-center", children: row.currency }), _jsx("td", { className: "px-2 py-2 text-center", children: row.amount }), (row.status === "ISSUED" || row.status === "ACCEPTED" || row.status === "PAYMENTSCHEDULED" || row.status === "PAYMENTRECEIVED" || row.status === "PAYMENTSENT") && !billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx("button", { className: "bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 col-span-1 justify-self-end", onClick: () => onCreateBillingStatement?.(row.id), children: "Generate Billing Statement" }) })), billingFile && (_jsx("td", { className: "px-2 py-2 text-center", children: _jsx(FileItem, { uiNode: billingFile, onSelectNode: () => setActiveDocumentId(billingDoc?.id), onRenameNode: (name) => renameNode(billingDoc?.id, name), onDuplicateNode: () => { }, onDeleteNode: () => onDeleteNode(billingDoc?.id), isAllowedToCreateDocuments: true, className: "h-10" }, billingDoc?.id) })), _jsx("td", { className: "px-2 py-2 text-center", children: hasExportedData ? (_jsx("span", { className: "text-green-500", children: "Yes" })) : (_jsx("span", { className: "text-red-500", children: "No" })) })] }));
11
13
  };
@@ -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.powerhouse.xyz/graphql/invoice';
9
+ GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
10
10
  }
11
11
  export async function loadPDFFile({ file, dispatch, }) {
12
12
  if (!file)
@@ -4,7 +4,7 @@ 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
6
  if (!window.document.baseURI.includes('localhost')) {
7
- GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql/invoice';
7
+ GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
8
8
  }
9
9
  const InvoiceToGnosis = ({ docState, dispatch }) => {
10
10
  const [isLoading, setIsLoading] = useState(false);
@@ -131,6 +131,6 @@ const InvoiceToGnosis = ({ docState, dispatch }) => {
131
131
  }
132
132
  };
133
133
  const urlChainName = parseChainName(chainName);
134
- 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}:0xF130f741d4E3185b29412c65397363f8c23A0460`, 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 })] }))] }));
134
+ 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 })] }))] }));
135
135
  };
136
136
  export default InvoiceToGnosis;
@@ -4,7 +4,7 @@ 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
6
  if (!window.document.baseURI.includes('localhost')) {
7
- GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql/invoice';
7
+ GRAPHQL_URL = 'https://switchboard-dev.powerhouse.xyz/graphql/invoice';
8
8
  }
9
9
  const RequestFinance = ({ docState, dispatch }) => {
10
10
  const [isLoading, setIsLoading] = useState(false);
@@ -87,7 +87,7 @@ const RequestFinance = ({ docState, dispatch }) => {
87
87
  invoiceNumber: docState.invoiceNo,
88
88
  buyerInfo: {
89
89
  // email: docState.payer.contactInfo.email,
90
- email: 'prometheus@powerhouse.inc',
90
+ email: '',
91
91
  firstName: docState.payer.name,
92
92
  // lastName: docState.payer.name.split(" ")[1] || "Liberty",
93
93
  businessName: docState.payer.name,
@@ -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.powerhouse.xyz/graphql/invoice';
10
+ GRAPHQL_URL = 'https://switchboard-dev.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":"createXeroCsv.d.ts","sourceRoot":"","sources":["../../../scripts/contributor-billing/createXeroCsv.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC7F;AAED,wBAAsB,uBAAuB,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA+LtG"}
1
+ {"version":3,"file":"createXeroCsv.d.ts","sourceRoot":"","sources":["../../../scripts/contributor-billing/createXeroCsv.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC7F;AAED,wBAAsB,uBAAuB,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAuMtG"}
@@ -58,12 +58,13 @@ export async function exportInvoicesToXeroCSV(invoiceStates, baseCurrency) {
58
58
  const exportDataByInvoice = {};
59
59
  const exportTimestamp = new Date().toISOString();
60
60
  const missingExpenseTagInvoices = [];
61
+ const missingDateIssuedInvoices = [];
61
62
  for (let invoiceState of invoiceStates) {
62
63
  const state = invoiceState.global;
63
64
  const invoiceId = invoiceState.id;
64
65
  const invoiceName = state.name || invoiceId;
65
66
  const items = state.lineItems || [];
66
- const dateIssued = state.dateIssued || '';
67
+ const dateIssued = state.dateIssued;
67
68
  let datePaid = state.paymentDate || '';
68
69
  if (datePaid.includes('T')) {
69
70
  datePaid = datePaid.split('T')[0];
@@ -75,6 +76,10 @@ export async function exportInvoicesToXeroCSV(invoiceStates, baseCurrency) {
75
76
  if (currency === 'DAI' || currency === 'USDS') {
76
77
  effectiveCurrency = 'USD';
77
78
  }
79
+ if (!dateIssued) {
80
+ missingDateIssuedInvoices.push(invoiceName);
81
+ continue;
82
+ }
78
83
  // Check if any line item is missing a valid xero-expense-account tag
79
84
  const hasMissingExpenseTag = items.some((item) => {
80
85
  const expenseTag = (item.lineItemTag || []).find((tag) => tag.dimension === "xero-expense-account");
@@ -175,11 +180,9 @@ export async function exportInvoicesToXeroCSV(invoiceStates, baseCurrency) {
175
180
  allRows.push(...invoiceRows);
176
181
  // Store export data for this invoice
177
182
  exportDataByInvoice[invoiceId] = {
178
- exportTimestamp,
179
- exportedLines: [headers, ...invoiceRows]
183
+ timestamp: exportTimestamp,
184
+ exportedLineItems: [headers, ...invoiceRows]
180
185
  };
181
- // Optionally, assign to the invoice state here if you want to mutate it directly:
182
- // state.exportData = exportDataByInvoice[invoiceId];
183
186
  }
184
187
  // If any invoices are missing expense tags, throw an error
185
188
  if (missingExpenseTagInvoices.length > 0) {
@@ -188,6 +191,9 @@ export async function exportInvoicesToXeroCSV(invoiceStates, baseCurrency) {
188
191
  missingExpenseTagInvoices: missingExpenseTagInvoices
189
192
  };
190
193
  }
194
+ if (missingDateIssuedInvoices.length > 0) {
195
+ throw new Error(`The following invoices are missing a 'dateIssued' value: ${[...new Set(missingDateIssuedInvoices)].join(', ')}`);
196
+ }
191
197
  // Download CSV for all invoices
192
198
  const csvLines = [headers.join(',')].concat(allRows.map(row => row.map(value => `"${value}"`).join(',')));
193
199
  const csvData = csvLines.join('\n');
@@ -4,7 +4,7 @@ import { OperationType } from '@safe-global/types-kit';
4
4
  import { ethers, AbiCoder } from 'ethers';
5
5
  import dotenv from 'dotenv';
6
6
  dotenv.config();
7
- const safeAddress = process.env.PRODUCTION_SAFE_ADDRESS;
7
+ const safeAddress = process.env.DEV_STAGING_SAFE_ADDRESS;
8
8
  if (!safeAddress) {
9
9
  throw new Error('Missing SAFE_ADDRESS in .env');
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"requestFinance.d.ts","sourceRoot":"","sources":["../../../scripts/invoice/requestFinance.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,GAAU,aAAa,GAAG,iBA0C1D,CAAC"}
1
+ {"version":3,"file":"requestFinance.d.ts","sourceRoot":"","sources":["../../../scripts/invoice/requestFinance.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,GAAU,aAAa,GAAG,iBA2C1D,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import axios from 'axios';
2
2
  const API_URL = 'https://api.request.finance/invoices';
3
3
  const API_KEY = process.env.REQUEST_FINANCE_API_KEY; // Store in .env file
4
+ const REQUEST_FINANCE_EMAIL = process.env.REQUEST_FINANCE_EMAIL;
4
5
  export const requestDirectPayment = async (invoiceData) => {
6
+ invoiceData.buyerInfo.email = REQUEST_FINANCE_EMAIL;
5
7
  console.log('Getting a request to create an invoice', invoiceData.invoiceNumber);
6
8
  try {
7
9
  // First API call to create the invoice
package/dist/style.css CHANGED
@@ -285,6 +285,9 @@
285
285
  .right-2 {
286
286
  right: calc(var(--spacing) * 2);
287
287
  }
288
+ .left-1\/2 {
289
+ left: calc(1/2 * 100%);
290
+ }
288
291
  .z-10 {
289
292
  z-index: 10;
290
293
  }
@@ -469,6 +472,9 @@
469
472
  .min-w-\[142px\] {
470
473
  min-width: 142px;
471
474
  }
475
+ .min-w-\[300px\] {
476
+ min-width: 300px;
477
+ }
472
478
  .min-w-\[900px\] {
473
479
  min-width: 900px;
474
480
  }
@@ -489,6 +495,10 @@
489
495
  --tw-border-spacing-y: calc(var(--spacing) * 0);
490
496
  border-spacing: var(--tw-border-spacing-x) var(--tw-border-spacing-y);
491
497
  }
498
+ .-translate-x-1\/2 {
499
+ --tw-translate-x: calc(calc(1/2 * 100%) * -1);
500
+ translate: var(--tw-translate-x) var(--tw-translate-y);
501
+ }
492
502
  .-translate-y-1\/2 {
493
503
  --tw-translate-y: calc(calc(1/2 * 100%) * -1);
494
504
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -869,6 +879,9 @@
869
879
  .text-red-500 {
870
880
  color: var(--color-red-500);
871
881
  }
882
+ .text-red-600 {
883
+ color: var(--color-red-600);
884
+ }
872
885
  .text-slate-800 {
873
886
  color: var(--color-slate-800);
874
887
  }
@@ -998,6 +1011,13 @@
998
1011
  }
999
1012
  }
1000
1013
  }
1014
+ .hover\:bg-gray-300 {
1015
+ &:hover {
1016
+ @media (hover: hover) {
1017
+ background-color: var(--color-gray-300);
1018
+ }
1019
+ }
1020
+ }
1001
1021
  .hover\:bg-gray-600 {
1002
1022
  &:hover {
1003
1023
  @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.37",
4
+ "version": "0.0.38",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [