@powerhousedao/contributor-billing 0.0.4 → 0.0.6

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":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAA+D,MAAM,wCAAwC,CAAC;AAsSnI,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyRhD,CAAC"}
1
+ {"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAIb,MAAM,wCAAwC,CAAC;AA4ShD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2ZhD,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Document, Page, Text, View, StyleSheet, Image, } from "@react-pdf/renderer";
3
- import powerhouseLogo from "./assets/powerhouseLogo.png";
2
+ import { Document, Page, Text, View, StyleSheet, } from "@react-pdf/renderer";
4
3
  import countries from "world-countries";
5
4
  const countriesArray = countries;
6
5
  function getCountryName(countryCode) {
@@ -46,7 +45,7 @@ const styles = StyleSheet.create({
46
45
  },
47
46
  sectionTitle: {
48
47
  marginBottom: 5,
49
- fontSize: 14,
48
+ fontSize: 12,
50
49
  marginRight: 4,
51
50
  fontFamily: "Helvetica",
52
51
  color: "#9ea0a2",
@@ -54,7 +53,7 @@ const styles = StyleSheet.create({
54
53
  },
55
54
  row: {
56
55
  flexDirection: "row",
57
- marginBottom: 8,
56
+ marginBottom: 0,
58
57
  },
59
58
  label: {
60
59
  width: 70,
@@ -97,12 +96,12 @@ const styles = StyleSheet.create({
97
96
  },
98
97
  itemName: {
99
98
  fontWeight: "bold",
100
- fontSize: 12,
99
+ fontSize: 10,
101
100
  color: "#374151",
102
101
  marginBottom: 2,
103
102
  },
104
103
  itemDescription: {
105
- fontSize: 12,
104
+ fontSize: 10,
106
105
  color: "#6B7280",
107
106
  fontWeight: "normal",
108
107
  },
@@ -129,7 +128,7 @@ const styles = StyleSheet.create({
129
128
  totalLabel: {
130
129
  marginRight: 8,
131
130
  color: "#6B7280",
132
- fontSize: 16,
131
+ fontSize: 14,
133
132
  fontWeight: "normal",
134
133
  width: 120,
135
134
  textAlign: "right",
@@ -137,7 +136,7 @@ const styles = StyleSheet.create({
137
136
  totalValue: {
138
137
  minWidth: 100,
139
138
  textAlign: "right",
140
- fontSize: 16,
139
+ fontSize: 14,
141
140
  fontWeight: "normal",
142
141
  color: "#374151",
143
142
  },
@@ -153,7 +152,7 @@ const styles = StyleSheet.create({
153
152
  totalLabelBold: {
154
153
  marginRight: 8,
155
154
  color: "#000",
156
- fontSize: 18,
155
+ fontSize: 16,
157
156
  fontWeight: "bold",
158
157
  width: 120,
159
158
  textAlign: "right",
@@ -161,7 +160,7 @@ const styles = StyleSheet.create({
161
160
  totalValueBold: {
162
161
  minWidth: 100,
163
162
  textAlign: "right",
164
- fontSize: 18,
163
+ fontSize: 16,
165
164
  fontWeight: "bold",
166
165
  color: "#000",
167
166
  },
@@ -172,14 +171,14 @@ const styles = StyleSheet.create({
172
171
  marginLeft: 4,
173
172
  },
174
173
  totalAmount: {
175
- fontSize: 25,
174
+ fontSize: 20,
176
175
  paddingTop: 7,
177
176
  fontWeight: "bold",
178
177
  color: "#black",
179
178
  },
180
179
  paymentSection: {
181
- marginTop: 20,
182
- marginBottom: 20,
180
+ marginTop: 10,
181
+ marginBottom: 10,
183
182
  },
184
183
  paymentTitle: {
185
184
  fontSize: 12,
@@ -213,12 +212,18 @@ const styles = StyleSheet.create({
213
212
  fontWeight: "normal",
214
213
  },
215
214
  companyInfo: {
216
- fontSize: 12,
215
+ fontSize: 9,
217
216
  color: "#4B5563",
218
217
  marginBottom: 4,
219
218
  },
219
+ companyInfoLabel: {
220
+ color: "#9ea0a2",
221
+ fontSize: 9,
222
+ marginRight: 5,
223
+ minWidth: 50,
224
+ },
220
225
  companyName: {
221
- fontSize: 12,
226
+ fontSize: 9,
222
227
  fontWeight: "bold",
223
228
  marginBottom: 4,
224
229
  },
@@ -277,64 +282,98 @@ function formatNumber(value) {
277
282
  });
278
283
  }
279
284
  export const InvoicePDF = ({ invoice, fiatMode, }) => {
280
- console.log(invoice);
281
- return (_jsx(Document, { children: _jsxs(Page, { size: "A4", style: styles.pageBackground, children: [_jsxs(View, { style: styles.page, children: [_jsxs(View, { style: {
282
- flexDirection: "row",
283
- justifyContent: "space-between",
284
- alignItems: "flex-start",
285
- }, children: [_jsxs(View, { style: { flexDirection: "column", alignItems: "flex-start" }, children: [_jsx(Image, { style: styles.logo, src: powerhouseLogo }), _jsxs(View, { children: [_jsx(Text, { style: styles.invoiceLabel, children: "Invoice number" }), _jsx(Text, { style: styles.invoiceNumber, children: invoice.invoiceNo })] })] }), _jsxs(View, { style: { alignItems: "flex-end" }, children: [_jsxs(Text, { style: styles.invoiceLabel, children: ["Invoice of (", invoice.currency, ")"] }), _jsx(Text, { style: [
286
- styles.invoiceNumber,
287
- { fontSize: 24, fontWeight: "bold" },
288
- ], children: formatNumber(invoice.totalPriceTaxIncl) })] })] }), _jsxs(View, { style: {
289
- flexDirection: "row",
290
- justifyContent: "space-between",
291
- marginTop: 40,
292
- }, children: [_jsxs(View, { style: { width: "45%" }, children: [_jsx(Text, { style: styles.sectionTitle, children: "Issuer" }), _jsx(Text, { style: styles.companyName, children: invoice.issuer.name }), _jsxs(Text, { style: styles.companyInfo, children: ["Tax/Corp ID:", " ", invoice.issuer.id?.taxId ||
293
- invoice.issuer.id?.corpRegId || ""] }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.streetAddress || "" }), invoice.issuer.address?.extendedAddress && (_jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.extendedAddress || "" })), _jsxs(Text, { style: styles.companyInfo, children: [invoice.issuer.address?.city || "", ",", " ", getCountryName(invoice.issuer.address?.country || "") || "", " -", " ", invoice.issuer.address?.postalCode || "00000"] }), invoice.issuer.contactInfo?.email && (_jsx(Text, { style: styles.companyInfo, children: invoice.issuer.contactInfo.email }))] }), _jsxs(View, { style: { width: "45%" }, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payer" }), _jsx(Text, { style: styles.companyName, children: invoice.payer.name }), _jsxs(Text, { style: styles.companyInfo, children: ["Tax/Corp ID:", " ", invoice.payer.id?.taxId ||
294
- invoice.payer.id?.corpRegId || ""] }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.streetAddress || "" }), invoice.payer.address?.extendedAddress && (_jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.extendedAddress || "" })), _jsxs(Text, { style: styles.companyInfo, children: [invoice.payer.address?.city || "", ",", " ", getCountryName(invoice.payer.address?.country || "") || "", " -", " ", invoice.payer.address?.postalCode || "00000"] }), invoice.payer.contactInfo?.email && (_jsx(Text, { style: styles.companyInfo, children: invoice.payer.contactInfo.email }))] }), _jsxs(View, { style: {
295
- width: "30%",
296
- alignItems: "flex-end",
297
- textAlign: "right",
298
- }, children: [_jsxs(View, { style: { marginBottom: 18, width: "100%" }, children: [_jsx(Text, { style: {
299
- color: "#9ea0a2",
300
- fontSize: 14,
301
- textAlign: "right",
302
- fontFamily: "Helvetica",
303
- fontWeight: "normal",
304
- }, children: "Invoice date" }), _jsx(Text, { style: {
305
- fontWeight: 4,
306
- fontSize: 14,
307
- textAlign: "right",
308
- color: "#000",
309
- fontFamily: "Helvetica",
310
- }, children: formatDate(invoice.dateIssued) })] }), _jsxs(View, { style: { marginBottom: 18, width: "100%" }, children: [_jsx(Text, { style: {
311
- color: "#9ea0a2",
312
- fontSize: 14,
313
- textAlign: "right",
314
- fontFamily: "Helvetica",
315
- fontWeight: "normal",
316
- }, children: "Due date" }), _jsx(Text, { style: {
317
- fontWeight: 4,
318
- fontSize: 14,
319
- textAlign: "right",
320
- color: "#000",
321
- fontFamily: "Helvetica",
322
- }, children: formatDate(invoice.dateDue) })] }), fiatMode && (_jsxs(View, { style: { marginBottom: 18, width: "100%" }, children: [_jsx(Text, { style: {
323
- color: "#9ea0a2",
324
- fontSize: 14,
325
- textAlign: "right",
326
- fontFamily: "Helvetica",
327
- fontWeight: "normal",
328
- }, children: "Account Type:" }), _jsx(Text, { style: {
329
- fontWeight: 4,
330
- fontSize: 14,
331
- textAlign: "right",
332
- color: "#000",
333
- fontFamily: "Helvetica",
334
- }, children: invoice.issuer.paymentRouting?.bank?.accountType ||
335
- "CHECKING" })] }))] })] }), _jsxs(View, { style: styles.paymentSection, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (_jsxs("div", { children: [_jsx(PaymentSectionFiat, { paymentRouting: invoice.issuer.paymentRouting }), invoice.issuer.paymentRouting?.bank?.memo && (_jsxs(Text, { style: styles.companyInfo, children: ["Memo: ", invoice.issuer.paymentRouting?.bank?.memo || "", " "] }))] })) : (_jsx(PaymentSectionCrypto, { paymentRouting: invoice.issuer.paymentRouting }))] }), _jsxs(View, { style: styles.table, children: [_jsxs(View, { style: styles.tableHeader, children: [_jsx(Text, { style: styles.tableCol40, children: "Description" }), _jsx(Text, { style: styles.tableCol15, children: "Quantity" }), _jsx(Text, { style: styles.tableCol15, children: "Unit Price" }), _jsx(Text, { style: styles.tableCol15, children: "Tax" }), _jsx(Text, { style: styles.tableCol15, children: "Total" })] }), invoice.lineItems.map((item, index) => (_jsx(InvoiceLineItem, { item: item, currency: invoice.currency }, index)))] }), _jsxs(View, { style: styles.totals, children: [_jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Subtotal" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxExcl, 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Tax" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum +
336
- item.quantity *
337
- (item.unitPriceTaxIncl - item.unitPriceTaxExcl), 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRowBold, children: [_jsx(Text, { style: styles.totalLabelBold, children: "Total" }), _jsx(Text, { style: styles.totalValueBold, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxIncl, 0), invoice.currency) })] })] })] }), _jsxs(View, { style: { marginLeft: 40 }, children: [_jsx(Text, { style: styles.termsTitle, children: "Terms & Conditions" }), _jsx(Text, { style: styles.termsText, children: "Please pay within 30 days of receiving this invoice." })] })] }) }));
285
+ const MAX_ITEMS_FIRST_PAGE = 15;
286
+ const MAX_ITEMS_OTHER_PAGES = 20;
287
+ // Helper to chunk line items with different first page size
288
+ function chunkLineItems(lineItems, firstPageSize, otherPageSize) {
289
+ if (lineItems.length <= firstPageSize)
290
+ return [lineItems];
291
+ const chunks = [lineItems.slice(0, firstPageSize)];
292
+ let i = firstPageSize;
293
+ while (i < lineItems.length) {
294
+ chunks.push(lineItems.slice(i, i + otherPageSize));
295
+ i += otherPageSize;
296
+ }
297
+ return chunks;
298
+ }
299
+ const lineItemChunks = chunkLineItems(invoice.lineItems, MAX_ITEMS_FIRST_PAGE, MAX_ITEMS_OTHER_PAGES);
300
+ const totalPages = lineItemChunks.length;
301
+ return (_jsx(Document, { children: lineItemChunks.map((items, pageIndex) => (_jsxs(Page, { size: "A4", style: styles.pageBackground, children: [_jsxs(View, { style: styles.page, children: [pageIndex === 0 && (_jsxs(_Fragment, { children: [_jsxs(View, { style: {
302
+ flexDirection: "row",
303
+ justifyContent: "space-between",
304
+ alignItems: "flex-start",
305
+ }, children: [_jsxs(View, { style: {
306
+ flexDirection: "column",
307
+ alignItems: "flex-start",
308
+ }, children: [_jsx(Text, { style: { fontSize: 20, fontWeight: "bold" }, children: invoice.issuer.name }), _jsxs(View, { children: [_jsx(Text, { style: styles.invoiceLabel, children: "Invoice number" }), _jsx(Text, { style: styles.invoiceNumber, children: invoice.invoiceNo })] })] }), _jsxs(View, { style: { alignItems: "flex-end" }, children: [_jsxs(Text, { style: styles.invoiceLabel, children: ["Invoice of (", invoice.currency, ")"] }), _jsx(Text, { style: [
309
+ styles.invoiceNumber,
310
+ { fontSize: 18, fontWeight: "bold" },
311
+ ], children: formatNumber(invoice.totalPriceTaxIncl) })] })] }), _jsxs(View, { style: {
312
+ flexDirection: "row",
313
+ justifyContent: "space-between",
314
+ marginTop: 20,
315
+ }, children: [_jsxs(View, { style: { width: "45%" }, children: [_jsx(Text, { style: styles.sectionTitle, children: "Issuer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.id
316
+ ?.taxId ||
317
+ invoice.issuer
318
+ .id?.corpRegId ||
319
+ "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.streetAddress || "" })] }), invoice.issuer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, children: [invoice.issuer.address?.city || "", ",", " ", getCountryName(invoice.issuer.address?.country || "") || ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.address?.postalCode || "00000" })] }), invoice.issuer.contactInfo?.email && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Email:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.issuer.contactInfo.email })] }))] }), _jsxs(View, { style: { width: "45%" }, children: [_jsx(Text, { style: styles.sectionTitle, children: "Payer" }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Name:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.name })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Tax/Corp ID:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.id?.taxId ||
320
+ invoice.payer
321
+ .id?.corpRegId ||
322
+ "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.streetAddress || "" })] }), invoice.payer.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, children: [invoice.payer.address?.city || "", ",", " ", getCountryName(invoice.payer.address?.country || "") ||
323
+ ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.address?.postalCode || "00000" })] }), invoice.payer.contactInfo?.email && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Email:" }), _jsx(Text, { style: styles.companyInfo, children: invoice.payer.contactInfo.email })] }))] }), _jsxs(View, { style: {
324
+ width: "30%",
325
+ alignItems: "flex-end",
326
+ textAlign: "right",
327
+ }, children: [_jsxs(View, { style: { marginBottom: 5, width: "100%" }, children: [_jsx(Text, { style: {
328
+ color: "#9ea0a2",
329
+ fontSize: 12,
330
+ textAlign: "right",
331
+ fontFamily: "Helvetica",
332
+ fontWeight: "normal",
333
+ }, children: "Invoice date" }), _jsx(Text, { style: {
334
+ fontWeight: 4,
335
+ fontSize: 12,
336
+ textAlign: "right",
337
+ color: "#000",
338
+ fontFamily: "Helvetica",
339
+ }, children: formatDate(invoice.dateIssued) })] }), invoice.dateDelivered && (_jsxs(View, { style: { marginBottom: 5, width: "100%" }, children: [_jsx(Text, { style: {
340
+ color: "#9ea0a2",
341
+ fontSize: 12,
342
+ textAlign: "right",
343
+ fontFamily: "Helvetica",
344
+ fontWeight: "normal",
345
+ }, children: "Delivery date" }), _jsx(Text, { style: {
346
+ fontWeight: 4,
347
+ fontSize: 12,
348
+ textAlign: "right",
349
+ color: "#000",
350
+ fontFamily: "Helvetica",
351
+ }, children: formatDate(invoice.dateDelivered) })] })), _jsxs(View, { style: { marginBottom: 5, width: "100%" }, children: [_jsx(Text, { style: {
352
+ color: "#9ea0a2",
353
+ fontSize: 12,
354
+ textAlign: "right",
355
+ fontFamily: "Helvetica",
356
+ fontWeight: "normal",
357
+ }, children: "Due date" }), _jsx(Text, { style: {
358
+ fontWeight: 4,
359
+ fontSize: 12,
360
+ textAlign: "right",
361
+ color: "#000",
362
+ fontFamily: "Helvetica",
363
+ }, children: formatDate(invoice.dateDue) })] })] })] }), _jsxs(View, { style: [styles.paymentSection, { marginLeft: 0 }], children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (_jsxs("div", { children: [_jsx(PaymentSectionFiat, { paymentRouting: invoice.issuer.paymentRouting }), invoice.issuer.paymentRouting?.bank?.memo && (_jsxs(Text, { style: [styles.companyInfo, { marginTop: 20 }], children: ["Memo:", " ", invoice.issuer.paymentRouting?.bank?.memo || "", " "] }))] })) : (_jsx(PaymentSectionCrypto, { paymentRouting: invoice.issuer.paymentRouting }))] })] })), _jsxs(View, { style: styles.table, children: [_jsxs(View, { style: styles.tableHeader, children: [_jsx(Text, { style: styles.tableCol40, children: "Description" }), _jsx(Text, { style: styles.tableCol15, children: "Quantity" }), _jsx(Text, { style: styles.tableCol15, children: "Unit Price" }), _jsx(Text, { style: styles.tableCol15, children: "Tax" }), _jsx(Text, { style: styles.tableCol15, children: "Total" })] }), items.map((item, index) => (_jsx(InvoiceLineItem, { item: item, currency: invoice.currency }, index + pageIndex * 1000)))] }), pageIndex === totalPages - 1 && (_jsx(_Fragment, { children: _jsxs(View, { style: styles.totals, children: [_jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Subtotal" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxExcl, 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRow, children: [_jsx(Text, { style: styles.totalLabel, children: "Tax" }), _jsx(Text, { style: styles.totalValue, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum +
364
+ item.quantity *
365
+ (item.unitPriceTaxIncl - item.unitPriceTaxExcl), 0), invoice.currency) })] }), _jsxs(View, { style: styles.totalRowBold, children: [_jsx(Text, { style: styles.totalLabelBold, children: "Total" }), _jsx(Text, { style: styles.totalValueBold, children: formatCurrency(invoice.lineItems.reduce((sum, item) => sum + item.quantity * item.unitPriceTaxIncl, 0), invoice.currency) })] })] }) }))] }), _jsxs(View, { style: {
366
+ marginLeft: 40,
367
+ flexDirection: "row",
368
+ alignItems: "center",
369
+ justifyContent: "space-between",
370
+ width: "90%",
371
+ }, children: [_jsxs(View, { children: [_jsx(Text, { style: styles.termsTitle, children: "Terms & Conditions" }), _jsx(Text, { style: styles.termsText, children: "Please pay within 30 days of receiving this invoice." })] }), _jsx(Text, { style: {
372
+ fontSize: 10,
373
+ color: "#6B7280",
374
+ textAlign: "right",
375
+ flex: 1,
376
+ }, children: `${pageIndex + 1}/${totalPages}` })] })] }, pageIndex))) }));
338
377
  };
339
378
  // New component for issuer and payer sections
340
379
  const InvoiceSection = ({ title, data, }) => (_jsxs(View, { style: styles.gridColumn, children: [_jsx(Text, { style: styles.sectionTitle, children: title }), title === "Issuer" && (_jsxs(_Fragment, { children: [_jsx(InvoiceField, { label: "Issue Date", value: formatDate(data.dateIssued) }), _jsx(InvoiceField, { label: "Delivery Date", value: formatDate(data.dateDelivered) })] })), title === "Payer" && (_jsx(InvoiceField, { label: "Due Date", value: formatDate(data.dateDue) })), _jsx(InvoiceField, { label: "Name", value: data.name }), _jsx(InvoiceField, { label: data.id?.taxId ? "Tax ID" : data.id?.corpRegId ? "Corp. Reg" : "", value: data.id?.taxId || data.id?.corpRegId || "" }), _jsx(InvoiceField, { label: "Address", value: data.address?.streetAddress || "" }), _jsx(InvoiceField, { label: "City", value: data.address?.city || "" }), _jsx(InvoiceField, { label: "Country", value: getCountryName(data.address?.country || "") || "" }), _jsx(InvoiceField, { label: "Email", value: data.contactInfo?.email || "" })] }));
@@ -345,14 +384,14 @@ const InvoiceField = ({ label, value, }) => value && (_jsx(View, { style: styles
345
384
  {
346
385
  /* New component for fiat payment section */
347
386
  }
348
- const PaymentSectionFiat = ({ paymentRouting, }) => (_jsxs(View, { style: [styles.gridContainer, { marginTop: 0 }], children: [_jsxs(View, { style: styles.gridColumn, children: [_jsx(Text, { style: styles.companyName, children: paymentRouting.bank?.name || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.streetAddress || "" }), paymentRouting.bank?.address?.extendedAddress && (_jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.extendedAddress })), _jsxs(Text, { style: styles.companyInfo, children: [paymentRouting.bank?.address?.city || "", ",", " ", getCountryName(paymentRouting.bank?.address?.country || "") || "", " -", " ", paymentRouting.bank?.address?.postalCode || ""] })] }), _jsxs(View, { style: styles.gridColumn, children: [_jsx(Text, { style: styles.companyName, children: paymentRouting.bank?.beneficiary || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountNum || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountType || "" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.BIC ||
349
- paymentRouting.bank?.SWIFT ||
350
- paymentRouting.bank?.ABA ||
351
- "" })] })] }));
387
+ const PaymentSectionFiat = ({ paymentRouting, }) => (_jsxs(View, { style: [styles.gridContainer, { marginTop: 0, marginLeft: 0 }], children: [_jsxs(View, { style: styles.gridColumn, children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Bank Name:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.name || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.streetAddress || "" })] }), paymentRouting.bank?.address?.extendedAddress && (_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.extendedAddress })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, children: [paymentRouting.bank?.address?.city || "", ",", " ", getCountryName(paymentRouting.bank?.address?.country || "") || ""] })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Postcode:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.address?.postalCode || "00000" })] })] }), _jsxs(View, { style: [styles.gridColumn], children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Beneficiary:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.beneficiary || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Acct No:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountNum || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "BIC/SWIFT:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.BIC ||
388
+ paymentRouting.bank?.SWIFT ||
389
+ paymentRouting.bank?.ABA ||
390
+ "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Acct Type:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.bank?.accountType || "" })] })] })] }));
352
391
  {
353
392
  /* New component for crypto payment section */
354
393
  }
355
- const PaymentSectionCrypto = ({ paymentRouting, }) => (_jsx(View, { style: styles.row, children: _jsxs(View, { style: styles.gridColumn, children: [_jsx(InvoiceField, { label: "Chain", value: paymentRouting.wallet?.chainName || "" }), _jsx(InvoiceField, { label: "Address", value: paymentRouting.wallet?.address || "" })] }) }));
394
+ const PaymentSectionCrypto = ({ paymentRouting, }) => (_jsx(View, { style: styles.row, children: _jsxs(View, { style: styles.gridColumn, children: [_jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Chain:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.wallet?.chainName || "" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, children: paymentRouting.wallet?.address || "" })] })] }) }));
356
395
  {
357
396
  /* New component for line items */
358
397
  }
@@ -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-staging.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)
@@ -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-staging.powerhouse.xyz/graphql/invoice";
5
+ GRAPHQL_URL = "https://switchboard-dev.powerhouse.xyz/graphql/invoice";
6
6
  }
7
7
  const InvoiceToGnosis = ({ docState }) => {
8
8
  const [isLoading, setIsLoading] = useState(false);
@@ -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-staging.powerhouse.xyz/graphql/invoice';
5
+ GRAPHQL_URL = 'https://switchboard-dev.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-staging.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) {
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",
4
+ "version": "0.0.6",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [