@powerhousedao/contributor-billing 0.0.98 → 0.1.0

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.
Files changed (114) hide show
  1. package/dist/document-models/billing-statement/src/reducers/general.d.ts.map +1 -1
  2. package/dist/document-models/billing-statement/src/reducers/general.js +8 -26
  3. package/dist/document-models/billing-statement/src/reducers/line-items.d.ts.map +1 -1
  4. package/dist/document-models/billing-statement/src/reducers/line-items.js +19 -29
  5. package/dist/document-models/billing-statement/src/reducers/tags.d.ts.map +1 -1
  6. package/dist/document-models/billing-statement/src/reducers/tags.js +20 -25
  7. package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -1
  8. package/dist/document-models/integrations/src/reducers/integrations.js +29 -44
  9. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  10. package/dist/document-models/invoice/src/reducers/general.js +31 -56
  11. package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
  12. package/dist/document-models/invoice/src/reducers/items.js +63 -88
  13. package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
  14. package/dist/document-models/invoice/src/reducers/parties.js +199 -229
  15. package/dist/editors/billing-statement/components/lineItemsTable.d.ts +3 -2
  16. package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
  17. package/dist/editors/billing-statement/components/lineItemsTable.js +12 -8
  18. package/dist/editors/billing-statement/components/objectSetTable.d.ts +3 -2
  19. package/dist/editors/billing-statement/components/objectSetTable.d.ts.map +1 -1
  20. package/dist/editors/billing-statement/editor.d.ts +3 -1
  21. package/dist/editors/billing-statement/editor.d.ts.map +1 -1
  22. package/dist/editors/billing-statement/editor.js +2 -2
  23. package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts +2 -2
  24. package/dist/editors/billing-statement/lineItemTags/lineItemTags.d.ts.map +1 -1
  25. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +8 -1
  26. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  27. package/dist/editors/contributor-billing/components/DriveExplorer.js +18 -64
  28. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -8
  29. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  30. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +21 -7
  31. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +8 -10
  32. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  33. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +27 -24
  34. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +6 -8
  35. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
  36. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +8 -17
  37. package/dist/editors/contributor-billing/editor.d.ts +1 -10
  38. package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
  39. package/dist/editors/contributor-billing/editor.js +2 -23
  40. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +2 -1
  41. package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
  42. package/dist/editors/contributor-billing/index.js +1 -1
  43. package/dist/editors/hooks/useBillingStatementDocument.d.ts +4 -0
  44. package/dist/editors/hooks/useBillingStatementDocument.d.ts.map +1 -0
  45. package/dist/editors/hooks/useBillingStatementDocument.js +8 -0
  46. package/dist/editors/hooks/useIntegrationsDocument.d.ts +4 -0
  47. package/dist/editors/hooks/useIntegrationsDocument.d.ts.map +1 -0
  48. package/dist/editors/hooks/useIntegrationsDocument.js +8 -0
  49. package/dist/editors/hooks/useInvoiceDocument.d.ts +4 -0
  50. package/dist/editors/hooks/useInvoiceDocument.d.ts.map +1 -0
  51. package/dist/editors/hooks/useInvoiceDocument.js +8 -0
  52. package/dist/editors/integrations/editor.d.ts +4 -1
  53. package/dist/editors/integrations/editor.d.ts.map +1 -1
  54. package/dist/editors/integrations/editor.js +7 -12
  55. package/dist/editors/invoice/components/lineItemCard.d.ts +21 -0
  56. package/dist/editors/invoice/components/lineItemCard.d.ts.map +1 -0
  57. package/dist/editors/invoice/components/lineItemCard.js +23 -0
  58. package/dist/editors/invoice/components/lineItemMobileModal.d.ts +33 -0
  59. package/dist/editors/invoice/components/lineItemMobileModal.d.ts.map +1 -0
  60. package/dist/editors/invoice/components/lineItemMobileModal.js +73 -0
  61. package/dist/editors/invoice/components/lineItemsEmptyState.d.ts +6 -0
  62. package/dist/editors/invoice/components/lineItemsEmptyState.d.ts.map +1 -0
  63. package/dist/editors/invoice/components/lineItemsEmptyState.js +5 -0
  64. package/dist/editors/invoice/editor.d.ts +4 -1
  65. package/dist/editors/invoice/editor.d.ts.map +1 -1
  66. package/dist/editors/invoice/editor.js +41 -22
  67. package/dist/editors/invoice/ingestPDF.js +1 -1
  68. package/dist/editors/invoice/invoiceToGnosis.d.ts +3 -2
  69. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
  70. package/dist/editors/invoice/invoiceToGnosis.js +11 -11
  71. package/dist/editors/invoice/legalEntity/bankSection.d.ts +1 -0
  72. package/dist/editors/invoice/legalEntity/bankSection.d.ts.map +1 -1
  73. package/dist/editors/invoice/legalEntity/bankSection.js +36 -12
  74. package/dist/editors/invoice/legalEntity/legalEntity.d.ts +2 -1
  75. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
  76. package/dist/editors/invoice/legalEntity/legalEntity.js +2 -2
  77. package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
  78. package/dist/editors/invoice/lineItemTags/lineItemTags.js +25 -3
  79. package/dist/editors/invoice/lineItemTags/tagCard.d.ts +15 -0
  80. package/dist/editors/invoice/lineItemTags/tagCard.d.ts.map +1 -0
  81. package/dist/editors/invoice/lineItemTags/tagCard.js +13 -0
  82. package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts +18 -0
  83. package/dist/editors/invoice/lineItemTags/tagMobileModal.d.ts.map +1 -0
  84. package/dist/editors/invoice/lineItemTags/tagMobileModal.js +71 -0
  85. package/dist/editors/invoice/lineItems.d.ts.map +1 -1
  86. package/dist/editors/invoice/lineItems.js +76 -38
  87. package/dist/editors/invoice/requestFinance.js +2 -2
  88. package/dist/editors/invoice/uploadPdfChunked.js +1 -1
  89. package/dist/editors/invoice/validation/validationHandler.d.ts +1 -1
  90. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
  91. package/dist/editors/invoice/validation/validationHandler.js +25 -9
  92. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
  93. package/dist/editors/invoice/validation/validationManager.js +3 -2
  94. package/dist/editors/invoice/validation/validationRules.d.ts +2 -0
  95. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
  96. package/dist/editors/invoice/validation/validationRules.js +37 -7
  97. package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts +5 -0
  98. package/dist/scripts/contributor-billing/createExpenseReportCsv.d.ts.map +1 -0
  99. package/dist/scripts/contributor-billing/createExpenseReportCsv.js +122 -0
  100. package/dist/style.css +180 -12
  101. package/dist/tailwind.config.js +1 -0
  102. package/package.json +13 -12
  103. package/dist/reducers/general.d.ts +0 -8
  104. package/dist/reducers/general.d.ts.map +0 -1
  105. package/dist/reducers/general.js +0 -73
  106. package/dist/reducers/items.d.ts +0 -8
  107. package/dist/reducers/items.d.ts.map +0 -1
  108. package/dist/reducers/items.js +0 -195
  109. package/dist/reducers/parties.d.ts +0 -8
  110. package/dist/reducers/parties.d.ts.map +0 -1
  111. package/dist/reducers/parties.js +0 -266
  112. package/dist/reducers/transitions.d.ts +0 -8
  113. package/dist/reducers/transitions.d.ts.map +0 -1
  114. package/dist/reducers/transitions.js +0 -162
@@ -8,259 +8,229 @@ function getStateValue(input, currentValue) {
8
8
  }
9
9
  export const reducer = {
10
10
  editIssuerOperation(state, action, dispatch) {
11
- try {
12
- if ('address' in state.issuer && ('city' in action.input ||
13
- 'country' in action.input ||
14
- 'extendedAddress' in action.input ||
15
- 'postalCode' in action.input ||
16
- 'stateProvince' in action.input ||
17
- 'streetAddress' in action.input)) {
18
- state.issuer.address = {
19
- ...state.issuer.address,
20
- city: action.input.city !== undefined ? action.input.city : state.issuer.address?.city ?? null,
21
- country: action.input.country !== undefined ? action.input.country : state.issuer.address?.country ?? null,
22
- extendedAddress: action.input.extendedAddress !== undefined ? action.input.extendedAddress : state.issuer.address?.extendedAddress ?? null,
23
- postalCode: action.input.postalCode !== undefined ? action.input.postalCode : state.issuer.address?.postalCode ?? null,
24
- stateProvince: action.input.stateProvince !== undefined ? action.input.stateProvince : state.issuer.address?.stateProvince ?? null,
25
- streetAddress: action.input.streetAddress !== undefined ? action.input.streetAddress : state.issuer.address?.streetAddress ?? null,
26
- };
27
- }
28
- if ('contactInfo' in state.issuer && ('tel' in action.input ||
29
- 'email' in action.input)) {
30
- state.issuer.contactInfo = {
31
- ...state.issuer.contactInfo,
32
- tel: action.input.tel !== undefined ? action.input.tel : state.issuer.contactInfo?.tel ?? null,
33
- email: action.input.email !== undefined ? action.input.email : state.issuer.contactInfo?.email ?? null,
34
- };
35
- }
36
- if ('country' in action.input) {
37
- state.issuer.country = action.input.country !== undefined ? action.input.country : state.issuer.country ?? null;
38
- }
39
- if ('id' in action.input) {
40
- state.issuer.id = action.input.id ? { taxId: action.input.id } : null;
41
- }
42
- if ('name' in action.input) {
43
- state.issuer.name = action.input.name !== undefined ? action.input.name : state.issuer.name ?? null;
44
- }
11
+ if ('address' in state.issuer && ('city' in action.input ||
12
+ 'country' in action.input ||
13
+ 'extendedAddress' in action.input ||
14
+ 'postalCode' in action.input ||
15
+ 'stateProvince' in action.input ||
16
+ 'streetAddress' in action.input)) {
17
+ state.issuer.address = {
18
+ ...state.issuer.address,
19
+ city: action.input.city !== undefined ? action.input.city : state.issuer.address?.city ?? null,
20
+ country: action.input.country !== undefined ? action.input.country : state.issuer.address?.country ?? null,
21
+ extendedAddress: action.input.extendedAddress !== undefined ? action.input.extendedAddress : state.issuer.address?.extendedAddress ?? null,
22
+ postalCode: action.input.postalCode !== undefined ? action.input.postalCode : state.issuer.address?.postalCode ?? null,
23
+ stateProvince: action.input.stateProvince !== undefined ? action.input.stateProvince : state.issuer.address?.stateProvince ?? null,
24
+ streetAddress: action.input.streetAddress !== undefined ? action.input.streetAddress : state.issuer.address?.streetAddress ?? null,
25
+ };
26
+ }
27
+ if ('contactInfo' in state.issuer && ('tel' in action.input ||
28
+ 'email' in action.input)) {
29
+ state.issuer.contactInfo = {
30
+ ...state.issuer.contactInfo,
31
+ tel: action.input.tel !== undefined ? action.input.tel : state.issuer.contactInfo?.tel ?? null,
32
+ email: action.input.email !== undefined ? action.input.email : state.issuer.contactInfo?.email ?? null,
33
+ };
34
+ }
35
+ if ('country' in action.input) {
36
+ state.issuer.country = action.input.country !== undefined ? action.input.country : state.issuer.country ?? null;
45
37
  }
46
- catch (e) {
47
- console.error(e);
38
+ if ('id' in action.input) {
39
+ state.issuer.id = action.input.id ? { taxId: action.input.id } : null;
40
+ }
41
+ if ('name' in action.input) {
42
+ state.issuer.name = action.input.name !== undefined ? action.input.name : state.issuer.name ?? null;
48
43
  }
49
44
  },
50
45
  editIssuerBankOperation(state, action, dispatch) {
51
- try {
52
- if (!state.issuer.paymentRouting) {
53
- state.issuer.paymentRouting = {
54
- bank: null,
55
- wallet: null,
56
- };
57
- }
58
- state.issuer.paymentRouting.bank = {
59
- ABA: getStateValue(action.input.ABA, state.issuer.paymentRouting.bank?.ABA ?? null),
60
- BIC: getStateValue(action.input.BIC, state.issuer.paymentRouting.bank?.BIC ?? null),
61
- SWIFT: getStateValue(action.input.SWIFT, state.issuer.paymentRouting.bank?.SWIFT ?? null),
62
- accountNum: action.input.accountNum ??
63
- state.issuer.paymentRouting.bank?.accountNum ??
46
+ if (!state.issuer.paymentRouting) {
47
+ state.issuer.paymentRouting = {
48
+ bank: null,
49
+ wallet: null,
50
+ };
51
+ }
52
+ state.issuer.paymentRouting.bank = {
53
+ ABA: getStateValue(action.input.ABA, state.issuer.paymentRouting.bank?.ABA ?? null),
54
+ BIC: getStateValue(action.input.BIC, state.issuer.paymentRouting.bank?.BIC ?? null),
55
+ SWIFT: getStateValue(action.input.SWIFT, state.issuer.paymentRouting.bank?.SWIFT ?? null),
56
+ accountNum: action.input.accountNum ??
57
+ state.issuer.paymentRouting.bank?.accountNum ??
58
+ "",
59
+ accountType: getStateValue(action.input.accountType, state.issuer.paymentRouting.bank?.accountType ?? null),
60
+ address: {
61
+ city: getStateValue(action.input.city, state.issuer.paymentRouting.bank?.address.city ?? null),
62
+ country: getStateValue(action.input.country, state.issuer.paymentRouting.bank?.address.country ?? null),
63
+ extendedAddress: getStateValue(action.input.extendedAddress, state.issuer.paymentRouting.bank?.address.extendedAddress ?? null),
64
+ postalCode: getStateValue(action.input.postalCode, state.issuer.paymentRouting.bank?.address.postalCode ?? null),
65
+ stateProvince: getStateValue(action.input.stateProvince, state.issuer.paymentRouting.bank?.address.stateProvince ?? null),
66
+ streetAddress: getStateValue(action.input.streetAddress, state.issuer.paymentRouting.bank?.address.streetAddress ?? null),
67
+ },
68
+ beneficiary: getStateValue(action.input.beneficiary, state.issuer.paymentRouting.bank?.beneficiary ?? null),
69
+ name: action.input.name ?? state.issuer.paymentRouting.bank?.name ?? "",
70
+ memo: getStateValue(action.input.memo, state.issuer.paymentRouting.bank?.memo ?? null),
71
+ intermediaryBank: {
72
+ ABA: getStateValue(action.input.ABAIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
73
+ BIC: getStateValue(action.input.BICIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
74
+ SWIFT: getStateValue(action.input.SWIFTIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
75
+ accountNum: action.input.accountNumIntermediary ??
76
+ state.issuer.paymentRouting.bank?.intermediaryBank?.accountNum ??
64
77
  "",
65
- accountType: getStateValue(action.input.accountType, state.issuer.paymentRouting.bank?.accountType ?? null),
78
+ accountType: getStateValue(action.input.accountTypeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.accountType ??
79
+ null),
66
80
  address: {
67
- city: getStateValue(action.input.city, state.issuer.paymentRouting.bank?.address.city ?? null),
68
- country: getStateValue(action.input.country, state.issuer.paymentRouting.bank?.address.country ?? null),
69
- extendedAddress: getStateValue(action.input.extendedAddress, state.issuer.paymentRouting.bank?.address.extendedAddress ?? null),
70
- postalCode: getStateValue(action.input.postalCode, state.issuer.paymentRouting.bank?.address.postalCode ?? null),
71
- stateProvince: getStateValue(action.input.stateProvince, state.issuer.paymentRouting.bank?.address.stateProvince ?? null),
72
- streetAddress: getStateValue(action.input.streetAddress, state.issuer.paymentRouting.bank?.address.streetAddress ?? null),
81
+ city: getStateValue(action.input.cityIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
82
+ .city ?? null),
83
+ country: getStateValue(action.input.countryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
84
+ .country ?? null),
85
+ extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
86
+ .extendedAddress ?? null),
87
+ postalCode: getStateValue(action.input.postalCodeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
88
+ .postalCode ?? null),
89
+ stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
90
+ .stateProvince ?? null),
91
+ streetAddress: getStateValue(action.input.streetAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
92
+ .streetAddress ?? null),
73
93
  },
74
- beneficiary: getStateValue(action.input.beneficiary, state.issuer.paymentRouting.bank?.beneficiary ?? null),
75
- name: action.input.name ?? state.issuer.paymentRouting.bank?.name ?? "",
76
- memo: getStateValue(action.input.memo, state.issuer.paymentRouting.bank?.memo ?? null),
77
- intermediaryBank: {
78
- ABA: getStateValue(action.input.ABAIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
79
- BIC: getStateValue(action.input.BICIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
80
- SWIFT: getStateValue(action.input.SWIFTIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
81
- accountNum: action.input.accountNumIntermediary ??
82
- state.issuer.paymentRouting.bank?.intermediaryBank?.accountNum ??
83
- "",
84
- accountType: getStateValue(action.input.accountTypeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.accountType ??
85
- null),
86
- address: {
87
- city: getStateValue(action.input.cityIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
88
- .city ?? null),
89
- country: getStateValue(action.input.countryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
90
- .country ?? null),
91
- extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
92
- .extendedAddress ?? null),
93
- postalCode: getStateValue(action.input.postalCodeIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
94
- .postalCode ?? null),
95
- stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
96
- .stateProvince ?? null),
97
- streetAddress: getStateValue(action.input.streetAddressIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.address
98
- .streetAddress ?? null),
99
- },
100
- beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.beneficiary ??
101
- null),
102
- name: action.input.nameIntermediary ??
103
- state.issuer.paymentRouting.bank?.intermediaryBank?.name ??
104
- "",
105
- memo: getStateValue(action.input.memoIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.memo ?? null),
106
- },
107
- };
108
- }
109
- catch (e) {
110
- console.error(e);
111
- }
94
+ beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.beneficiary ??
95
+ null),
96
+ name: action.input.nameIntermediary ??
97
+ state.issuer.paymentRouting.bank?.intermediaryBank?.name ??
98
+ "",
99
+ memo: getStateValue(action.input.memoIntermediary, state.issuer.paymentRouting.bank?.intermediaryBank?.memo ?? null),
100
+ },
101
+ };
112
102
  },
113
103
  editIssuerWalletOperation(state, action, dispatch) {
114
- try {
115
- if (!state.issuer.paymentRouting) {
116
- state.issuer.paymentRouting = {
117
- bank: null,
118
- wallet: null,
119
- };
120
- }
121
- state.issuer.paymentRouting.wallet = {
122
- address: action.input.address ??
123
- state.issuer.paymentRouting.wallet?.address ??
124
- null,
125
- chainId: action.input.chainId ??
126
- state.issuer.paymentRouting.wallet?.chainId ??
127
- null,
128
- chainName: action.input.chainName ??
129
- state.issuer.paymentRouting.wallet?.chainName ??
130
- null,
131
- rpc: action.input.rpc ?? state.issuer.paymentRouting.wallet?.rpc ?? null,
104
+ if (!state.issuer.paymentRouting) {
105
+ state.issuer.paymentRouting = {
106
+ bank: null,
107
+ wallet: null,
132
108
  };
133
109
  }
134
- catch (e) {
135
- console.error(e);
136
- }
110
+ state.issuer.paymentRouting.wallet = {
111
+ address: action.input.address ??
112
+ state.issuer.paymentRouting.wallet?.address ??
113
+ null,
114
+ chainId: action.input.chainId ??
115
+ state.issuer.paymentRouting.wallet?.chainId ??
116
+ null,
117
+ chainName: action.input.chainName ??
118
+ state.issuer.paymentRouting.wallet?.chainName ??
119
+ null,
120
+ rpc: action.input.rpc ?? state.issuer.paymentRouting.wallet?.rpc ?? null,
121
+ };
137
122
  },
138
123
  editPayerOperation(state, action, dispatch) {
139
- try {
140
- if ('address' in state.payer && ('city' in action.input ||
141
- 'country' in action.input ||
142
- 'extendedAddress' in action.input ||
143
- 'postalCode' in action.input ||
144
- 'stateProvince' in action.input ||
145
- 'streetAddress' in action.input)) {
146
- state.payer.address = {
147
- ...state.payer.address,
148
- city: action.input.city !== undefined ? action.input.city : state.payer.address?.city ?? null,
149
- country: action.input.country !== undefined ? action.input.country : state.payer.address?.country ?? null,
150
- extendedAddress: action.input.extendedAddress !== undefined ? action.input.extendedAddress : state.payer.address?.extendedAddress ?? null,
151
- postalCode: action.input.postalCode !== undefined ? action.input.postalCode : state.payer.address?.postalCode ?? null,
152
- stateProvince: action.input.stateProvince !== undefined ? action.input.stateProvince : state.payer.address?.stateProvince ?? null,
153
- streetAddress: action.input.streetAddress !== undefined ? action.input.streetAddress : state.payer.address?.streetAddress ?? null,
154
- };
155
- }
156
- if ('contactInfo' in state.payer && ('tel' in action.input ||
157
- 'email' in action.input)) {
158
- state.payer.contactInfo = {
159
- ...state.payer.contactInfo,
160
- tel: action.input.tel !== undefined ? action.input.tel : state.payer.contactInfo?.tel ?? null,
161
- email: action.input.email !== undefined ? action.input.email : state.payer.contactInfo?.email ?? null,
162
- };
163
- }
164
- if ('country' in action.input) {
165
- state.payer.country = action.input.country !== undefined ? action.input.country : state.payer.country ?? null;
166
- }
167
- if ('id' in action.input) {
168
- state.payer.id = action.input.id ? { taxId: action.input.id } : null;
169
- }
170
- if ('name' in action.input) {
171
- state.payer.name = action.input.name !== undefined ? action.input.name : state.payer.name ?? null;
172
- }
124
+ if ('address' in state.payer && ('city' in action.input ||
125
+ 'country' in action.input ||
126
+ 'extendedAddress' in action.input ||
127
+ 'postalCode' in action.input ||
128
+ 'stateProvince' in action.input ||
129
+ 'streetAddress' in action.input)) {
130
+ state.payer.address = {
131
+ ...state.payer.address,
132
+ city: action.input.city !== undefined ? action.input.city : state.payer.address?.city ?? null,
133
+ country: action.input.country !== undefined ? action.input.country : state.payer.address?.country ?? null,
134
+ extendedAddress: action.input.extendedAddress !== undefined ? action.input.extendedAddress : state.payer.address?.extendedAddress ?? null,
135
+ postalCode: action.input.postalCode !== undefined ? action.input.postalCode : state.payer.address?.postalCode ?? null,
136
+ stateProvince: action.input.stateProvince !== undefined ? action.input.stateProvince : state.payer.address?.stateProvince ?? null,
137
+ streetAddress: action.input.streetAddress !== undefined ? action.input.streetAddress : state.payer.address?.streetAddress ?? null,
138
+ };
139
+ }
140
+ if ('contactInfo' in state.payer && ('tel' in action.input ||
141
+ 'email' in action.input)) {
142
+ state.payer.contactInfo = {
143
+ ...state.payer.contactInfo,
144
+ tel: action.input.tel !== undefined ? action.input.tel : state.payer.contactInfo?.tel ?? null,
145
+ email: action.input.email !== undefined ? action.input.email : state.payer.contactInfo?.email ?? null,
146
+ };
147
+ }
148
+ if ('country' in action.input) {
149
+ state.payer.country = action.input.country !== undefined ? action.input.country : state.payer.country ?? null;
173
150
  }
174
- catch (e) {
175
- console.error(e);
151
+ if ('id' in action.input) {
152
+ state.payer.id = action.input.id ? { taxId: action.input.id } : null;
153
+ }
154
+ if ('name' in action.input) {
155
+ state.payer.name = action.input.name !== undefined ? action.input.name : state.payer.name ?? null;
176
156
  }
177
157
  },
178
158
  editPayerBankOperation(state, action, dispatch) {
179
- try {
180
- if (!state.payer.paymentRouting) {
181
- state.payer.paymentRouting = {
182
- bank: null,
183
- wallet: null,
184
- };
185
- }
186
- state.payer.paymentRouting.bank = {
187
- ABA: getStateValue(action.input.ABA, state.payer.paymentRouting.bank?.ABA ?? null),
188
- BIC: getStateValue(action.input.BIC, state.payer.paymentRouting.bank?.BIC ?? null),
189
- SWIFT: getStateValue(action.input.SWIFT, state.payer.paymentRouting.bank?.SWIFT ?? null),
190
- accountNum: action.input.accountNum ??
191
- state.payer.paymentRouting.bank?.accountNum ??
159
+ if (!state.payer.paymentRouting) {
160
+ state.payer.paymentRouting = {
161
+ bank: null,
162
+ wallet: null,
163
+ };
164
+ }
165
+ state.payer.paymentRouting.bank = {
166
+ ABA: getStateValue(action.input.ABA, state.payer.paymentRouting.bank?.ABA ?? null),
167
+ BIC: getStateValue(action.input.BIC, state.payer.paymentRouting.bank?.BIC ?? null),
168
+ SWIFT: getStateValue(action.input.SWIFT, state.payer.paymentRouting.bank?.SWIFT ?? null),
169
+ accountNum: action.input.accountNum ??
170
+ state.payer.paymentRouting.bank?.accountNum ??
171
+ "",
172
+ accountType: getStateValue(action.input.accountType, state.payer.paymentRouting.bank?.accountType ?? null),
173
+ address: {
174
+ city: getStateValue(action.input.city, state.payer.paymentRouting.bank?.address.city ?? null),
175
+ country: getStateValue(action.input.country, state.payer.paymentRouting.bank?.address.country ?? null),
176
+ extendedAddress: getStateValue(action.input.extendedAddress, state.payer.paymentRouting.bank?.address.extendedAddress ?? null),
177
+ postalCode: getStateValue(action.input.postalCode, state.payer.paymentRouting.bank?.address.postalCode ?? null),
178
+ stateProvince: getStateValue(action.input.stateProvince, state.payer.paymentRouting.bank?.address.stateProvince ?? null),
179
+ streetAddress: getStateValue(action.input.streetAddress, state.payer.paymentRouting.bank?.address.streetAddress ?? null),
180
+ },
181
+ beneficiary: getStateValue(action.input.beneficiary, state.payer.paymentRouting.bank?.beneficiary ?? null),
182
+ name: action.input.name ?? state.payer.paymentRouting.bank?.name ?? "",
183
+ memo: getStateValue(action.input.memo, state.payer.paymentRouting.bank?.memo ?? null),
184
+ intermediaryBank: {
185
+ ABA: getStateValue(action.input.ABAIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
186
+ BIC: getStateValue(action.input.BICIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
187
+ SWIFT: getStateValue(action.input.SWIFTIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
188
+ accountNum: action.input.accountNumIntermediary ??
189
+ state.payer.paymentRouting.bank?.intermediaryBank?.accountNum ??
192
190
  "",
193
- accountType: getStateValue(action.input.accountType, state.payer.paymentRouting.bank?.accountType ?? null),
191
+ accountType: getStateValue(action.input.accountTypeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.accountType ??
192
+ null),
194
193
  address: {
195
- city: getStateValue(action.input.city, state.payer.paymentRouting.bank?.address.city ?? null),
196
- country: getStateValue(action.input.country, state.payer.paymentRouting.bank?.address.country ?? null),
197
- extendedAddress: getStateValue(action.input.extendedAddress, state.payer.paymentRouting.bank?.address.extendedAddress ?? null),
198
- postalCode: getStateValue(action.input.postalCode, state.payer.paymentRouting.bank?.address.postalCode ?? null),
199
- stateProvince: getStateValue(action.input.stateProvince, state.payer.paymentRouting.bank?.address.stateProvince ?? null),
200
- streetAddress: getStateValue(action.input.streetAddress, state.payer.paymentRouting.bank?.address.streetAddress ?? null),
201
- },
202
- beneficiary: getStateValue(action.input.beneficiary, state.payer.paymentRouting.bank?.beneficiary ?? null),
203
- name: action.input.name ?? state.payer.paymentRouting.bank?.name ?? "",
204
- memo: getStateValue(action.input.memo, state.payer.paymentRouting.bank?.memo ?? null),
205
- intermediaryBank: {
206
- ABA: getStateValue(action.input.ABAIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.ABA ?? null),
207
- BIC: getStateValue(action.input.BICIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.BIC ?? null),
208
- SWIFT: getStateValue(action.input.SWIFTIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.SWIFT ?? null),
209
- accountNum: action.input.accountNumIntermediary ??
210
- state.payer.paymentRouting.bank?.intermediaryBank?.accountNum ??
211
- "",
212
- accountType: getStateValue(action.input.accountTypeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.accountType ??
213
- null),
214
- address: {
215
- city: getStateValue(action.input.cityIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.city ??
216
- null),
217
- country: getStateValue(action.input.countryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
218
- .country ?? null),
219
- extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
220
- .extendedAddress ?? null),
221
- postalCode: getStateValue(action.input.postalCodeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
222
- .postalCode ?? null),
223
- stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
224
- .stateProvince ?? null),
225
- streetAddress: getStateValue(action.input.streetAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
226
- .streetAddress ?? null),
227
- },
228
- beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.beneficiary ??
194
+ city: getStateValue(action.input.cityIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address.city ??
229
195
  null),
230
- name: action.input.nameIntermediary ??
231
- state.payer.paymentRouting.bank?.intermediaryBank?.name ??
232
- "",
233
- memo: getStateValue(action.input.memoIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.memo ?? null),
196
+ country: getStateValue(action.input.countryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
197
+ .country ?? null),
198
+ extendedAddress: getStateValue(action.input.extendedAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
199
+ .extendedAddress ?? null),
200
+ postalCode: getStateValue(action.input.postalCodeIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
201
+ .postalCode ?? null),
202
+ stateProvince: getStateValue(action.input.stateProvinceIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
203
+ .stateProvince ?? null),
204
+ streetAddress: getStateValue(action.input.streetAddressIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.address
205
+ .streetAddress ?? null),
234
206
  },
235
- };
236
- }
237
- catch (e) {
238
- console.error(e);
239
- }
207
+ beneficiary: getStateValue(action.input.beneficiaryIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.beneficiary ??
208
+ null),
209
+ name: action.input.nameIntermediary ??
210
+ state.payer.paymentRouting.bank?.intermediaryBank?.name ??
211
+ "",
212
+ memo: getStateValue(action.input.memoIntermediary, state.payer.paymentRouting.bank?.intermediaryBank?.memo ?? null),
213
+ },
214
+ };
240
215
  },
241
216
  editPayerWalletOperation(state, action, dispatch) {
242
- try {
243
- if (!state.payer.paymentRouting) {
244
- state.payer.paymentRouting = {
245
- bank: null,
246
- wallet: null,
247
- };
248
- }
249
- state.payer.paymentRouting.wallet = {
250
- address: action.input.address ??
251
- state.payer.paymentRouting.wallet?.address ??
252
- null,
253
- chainId: action.input.chainId ??
254
- state.payer.paymentRouting.wallet?.chainId ??
255
- null,
256
- chainName: action.input.chainName ??
257
- state.payer.paymentRouting.wallet?.chainName ??
258
- null,
259
- rpc: action.input.rpc ?? state.payer.paymentRouting.wallet?.rpc ?? null,
217
+ if (!state.payer.paymentRouting) {
218
+ state.payer.paymentRouting = {
219
+ bank: null,
220
+ wallet: null,
260
221
  };
261
222
  }
262
- catch (e) {
263
- console.error(e);
264
- }
223
+ state.payer.paymentRouting.wallet = {
224
+ address: action.input.address ??
225
+ state.payer.paymentRouting.wallet?.address ??
226
+ null,
227
+ chainId: action.input.chainId ??
228
+ state.payer.paymentRouting.wallet?.chainId ??
229
+ null,
230
+ chainName: action.input.chainName ??
231
+ state.payer.paymentRouting.wallet?.chainName ??
232
+ null,
233
+ rpc: action.input.rpc ?? state.payer.paymentRouting.wallet?.rpc ?? null,
234
+ };
265
235
  },
266
236
  };
@@ -1,6 +1,7 @@
1
+ import { type BillingStatementAction, type BillingStatementState } from "../../../document-models/billing-statement/index.js";
1
2
  declare const LineItemsTable: (props: {
2
- state: any;
3
- dispatch: any;
3
+ state: BillingStatementState;
4
+ dispatch: React.Dispatch<BillingStatementAction>;
4
5
  }) => import("react/jsx-runtime").JSX.Element;
5
6
  export default LineItemsTable;
6
7
  //# sourceMappingURL=lineItemsTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lineItemsTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/lineItemsTable.tsx"],"names":[],"mappings":"AAmBA,QAAA,MAAM,cAAc,GAAI,OAAO;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAA;CAAE,4CA8N3D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"lineItemsTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/lineItemsTable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,sBAAsB,EAAE,KAAK,qBAAqB,EAAkC,MAAM,qDAAqD,CAAC;AAkCvK,QAAA,MAAM,cAAc,GAAI,OAAO;IAAE,KAAK,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA;CAAE,4CAiQhH,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -3,13 +3,13 @@ import { Tag } from "lucide-react";
3
3
  import { Select } from "@powerhousedao/document-engineering";
4
4
  import { InputField } from "../../invoice/components/inputField.js";
5
5
  import { NumberForm } from "../../invoice/components/numberForm.js";
6
- import { actions, } from "../../../document-models/billing-statement/index.js";
6
+ import { actions } from "../../../document-models/billing-statement/index.js";
7
7
  import { useState, useRef, useEffect } from "react";
8
8
  import { formatNumber } from "../../invoice/lineItems.js";
9
9
  import { LineItemTagsTable } from "../lineItemTags/lineItemTags.js";
10
10
  const initialLineItem = {
11
11
  description: "",
12
- unit: "Hour",
12
+ unit: "HOUR",
13
13
  quantity: "",
14
14
  unitPriceCash: "",
15
15
  unitPricePwt: "",
@@ -53,7 +53,8 @@ const LineItemsTable = (props) => {
53
53
  if (field === "unitPriceCash" || field === "unitPricePwt") {
54
54
  // Allow negative numbers with optional minus sign at start
55
55
  const regex = new RegExp(`^-?\\d*\\.?\\d{0,6}$`);
56
- if (regex.test(value) || value === "-") {
56
+ const stringValue = String(value);
57
+ if (regex.test(stringValue) || stringValue === "-") {
57
58
  setLocalLineItem((prev) => ({ ...prev, [field]: value }));
58
59
  }
59
60
  }
@@ -80,8 +81,9 @@ const LineItemsTable = (props) => {
80
81
  originalItem.unitPriceCash !== fiat ||
81
82
  originalItem.unitPricePwt !== powt;
82
83
  if (hasChanges) {
84
+ const id = String(localLineItem.id);
83
85
  dispatch(actions.editLineItem({
84
- id: localLineItem.id,
86
+ id,
85
87
  description,
86
88
  unit,
87
89
  quantity: qty,
@@ -104,13 +106,15 @@ const LineItemsTable = (props) => {
104
106
  height: 28,
105
107
  color: "white",
106
108
  fill: "#475264",
107
- }, onClick: () => setShowTagTable(!showTagTable) }) })] }), _jsx("div", { className: "mt-4 min-w-[900px]", ref: tableRef, children: _jsxs("table", { className: "w-full border border-gray-300 text-sm", children: [_jsx("thead", { className: "h-12", children: _jsxs("tr", { className: "bg-gray-100 h-10", children: [_jsx("th", { className: "border px-2 py-1 w-10", children: "#" }), _jsx("th", { className: "border px-2 py-1 w-72", children: "Desc" }), _jsx("th", { className: "border px-2 py-1 w-40", children: "Unit" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "Qty" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "FIAT/Unit" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "POWT/Unit" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "Total Fiat" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "Total POWT" })] }) }), _jsx("tbody", { children: state.lineItems.map((item, idx) => (editingRow === idx ? (_jsxs("tr", { className: "bg-yellow-100", children: [_jsx("td", { className: "border px-2 py-1 text-center w-10", children: idx + 1 }), _jsx("td", { className: "border px-2 py-1 w-72", children: _jsx(InputField, { input: localLineItem.description, value: localLineItem.description, onBlur: () => { }, handleInputChange: (e) => handleInputChange("description", e.target.value), className: "w-full px-1 py-1 border rounded" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(Select, { options: units, value: localLineItem.unit, onChange: (value) => handleInputChange("unit", value), className: "w-32 px-1 py-1 border rounded" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(NumberForm, { number: localLineItem.quantity, handleInputChange: (e) => handleInputChange("quantity", e.target.value), className: "w-32 px-4 py-1 border rounded text-center" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(NumberForm, { number: localLineItem.unitPriceCash, handleInputChange: (e) => handleInputChange("unitPriceCash", String(e.target.value)), className: "w-32 px-4 py-1 border rounded text-center" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(NumberForm, { number: localLineItem.unitPricePwt, handleInputChange: (e) => handleInputChange("unitPricePwt", e.target.value), className: "w-32 px-4 py-1 border rounded text-center" }) }), _jsx("td", { className: "border px-2 py-1 text-center", children: localLineItem.quantity && localLineItem.unitPriceCash
108
- ? Number(localLineItem.quantity) * Number(localLineItem.unitPriceCash)
109
+ }, onClick: () => setShowTagTable(!showTagTable) }) })] }), _jsx("div", { className: "mt-4 min-w-[900px]", ref: tableRef, children: _jsxs("table", { className: "w-full border border-gray-300 text-sm", children: [_jsx("thead", { className: "h-12", children: _jsxs("tr", { className: "bg-gray-100 h-10", children: [_jsx("th", { className: "border px-2 py-1 w-10", children: "#" }), _jsx("th", { className: "border px-2 py-1 w-72", children: "Desc" }), _jsx("th", { className: "border px-2 py-1 w-40", children: "Unit" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "Qty" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "FIAT/Unit" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "POWT/Unit" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "Total Fiat" }), _jsx("th", { className: "border px-2 py-1 w-16", children: "Total POWT" })] }) }), _jsx("tbody", { children: state.lineItems.map((item, idx) => editingRow === idx ? (_jsxs("tr", { className: "bg-yellow-100", children: [_jsx("td", { className: "border px-2 py-1 text-center w-10", children: idx + 1 }), _jsx("td", { className: "border px-2 py-1 w-72", children: _jsx(InputField, { input: localLineItem.description, value: localLineItem.description, onBlur: () => { }, handleInputChange: (e) => handleInputChange("description", e.target.value), className: "w-full px-1 py-1 border rounded" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(Select, { options: units, value: localLineItem.unit, onChange: (value) => handleInputChange("unit", value), className: "w-32 px-1 py-1 border rounded" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(NumberForm, { number: localLineItem.quantity, handleInputChange: (e) => handleInputChange("quantity", e.target.value), className: "w-32 px-4 py-1 border rounded text-center" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(NumberForm, { number: localLineItem.unitPriceCash, handleInputChange: (e) => handleInputChange("unitPriceCash", String(e.target.value)), className: "w-32 px-4 py-1 border rounded text-center" }) }), _jsx("td", { className: "border px-2 py-1 w-16", children: _jsx(NumberForm, { number: localLineItem.unitPricePwt, handleInputChange: (e) => handleInputChange("unitPricePwt", e.target.value), className: "w-32 px-4 py-1 border rounded text-center" }) }), _jsx("td", { className: "border px-2 py-1 text-center", children: localLineItem.quantity && localLineItem.unitPriceCash
110
+ ? Number(localLineItem.quantity) *
111
+ Number(localLineItem.unitPriceCash)
109
112
  : "" }), _jsx("td", { className: "border px-2 py-1 text-center", children: localLineItem.quantity && localLineItem.unitPricePwt
110
- ? Number(localLineItem.quantity) * Number(localLineItem.unitPricePwt)
113
+ ? Number(localLineItem.quantity) *
114
+ Number(localLineItem.unitPricePwt)
111
115
  : "" })] }, item.id)) : (_jsxs("tr", { className: "hover:bg-gray-50 cursor-pointer", onDoubleClick: () => {
112
116
  setEditingRow(idx);
113
117
  setLocalLineItem({ ...item });
114
- }, children: [_jsx("td", { className: "border px-2 py-2 text-center w-10", children: idx + 1 }), _jsx("td", { className: "border px-2 py-2", children: item.description }), _jsx("td", { className: "border px-2 py-2 w-40 text-center", children: item.unit }), _jsx("td", { className: "border px-2 py-2 w-16 text-center", children: item.quantity }), _jsx("td", { className: "border px-2 py-2 w-10 text-center", children: formatNumber(item.unitPriceCash) }), _jsx("td", { className: "border px-2 py-2 w-10 text-center", children: formatNumber(item.unitPricePwt) }), _jsx("td", { className: "border px-2 py-2 text-center", children: formatNumber(item.totalPriceCash) }), _jsx("td", { className: "border px-2 py-2 text-center", children: formatNumber(item.totalPricePwt) })] }, item.id)))) })] }) })] }));
118
+ }, children: [_jsx("td", { className: "border px-2 py-2 text-center w-10", children: idx + 1 }), _jsx("td", { className: "border px-2 py-2", children: item.description }), _jsx("td", { className: "border px-2 py-2 w-40 text-center", children: item.unit }), _jsx("td", { className: "border px-2 py-2 w-16 text-center", children: item.quantity }), _jsx("td", { className: "border px-2 py-2 w-10 text-center", children: formatNumber(item.unitPriceCash) }), _jsx("td", { className: "border px-2 py-2 w-10 text-center", children: formatNumber(item.unitPricePwt) }), _jsx("td", { className: "border px-2 py-2 text-center", children: formatNumber(item.totalPriceCash) }), _jsx("td", { className: "border px-2 py-2 text-center", children: formatNumber(item.totalPricePwt) })] }, item.id))) })] }) })] }));
115
119
  };
116
120
  export default LineItemsTable;
@@ -1,6 +1,7 @@
1
+ import { type BillingStatementState, type BillingStatementAction } from "../../../document-models/billing-statement/index.js";
1
2
  declare const ObjectSetTableComponent: (props: {
2
- state: any;
3
- dispatch: any;
3
+ state: BillingStatementState;
4
+ dispatch: React.Dispatch<BillingStatementAction>;
4
5
  }) => import("react/jsx-runtime").JSX.Element;
5
6
  export default ObjectSetTableComponent;
6
7
  //# sourceMappingURL=objectSetTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"objectSetTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/objectSetTable.tsx"],"names":[],"mappings":"AAqBA,QAAA,MAAM,uBAAuB,GAAI,OAAO;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAA;CAAE,4CA6JpE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"objectSetTable.d.ts","sourceRoot":"","sources":["../../../../editors/billing-statement/components/objectSetTable.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAE5B,MAAM,qDAAqD,CAAC;AAqB7D,QAAA,MAAM,uBAAuB,GAAI,OAAO;IAAE,KAAK,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA;CAAE,4CA6JzH,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import type { EditorProps } from "document-model";
2
2
  export type IProps = EditorProps;
3
- export default function Editor(props: any): import("react/jsx-runtime").JSX.Element | null;
3
+ export default function Editor(props: Partial<EditorProps> & {
4
+ documentId?: string;
5
+ }): import("react/jsx-runtime").JSX.Element | null;
4
6
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/billing-statement/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAYlD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,GAAG,kDAoHxC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/billing-statement/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAYlD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,kDAiGnF"}
@@ -5,9 +5,9 @@ import { CurrencyForm } from "../invoice/components/currencyForm.js";
5
5
  import { Textarea } from "@powerhousedao/document-engineering";
6
6
  import LineItemsTable from "./components/lineItemsTable.js";
7
7
  import { formatNumber } from "../invoice/lineItems.js";
8
- import { useDocumentById } from "@powerhousedao/reactor-browser";
8
+ import { useSelectedBillingStatementDocument } from "../hooks/useBillingStatementDocument.js";
9
9
  export default function Editor(props) {
10
- const [doc, dispatch] = useDocumentById(props.documentId);
10
+ const [doc, dispatch] = useSelectedBillingStatementDocument();
11
11
  const state = doc?.state.global;
12
12
  if (!state) {
13
13
  console.log("Document state not found from document id", props.documentId);
@@ -1,5 +1,5 @@
1
1
  import { Dispatch } from "react";
2
- import { BillingStatementTag } from "../../../document-models/billing-statement/index.js";
2
+ import { BillingStatementTag, type BillingStatementAction } from "../../../document-models/billing-statement/index.js";
3
3
  interface TagAssignmentRow {
4
4
  id: string;
5
5
  description: string;
@@ -9,7 +9,7 @@ interface TagAssignmentRow {
9
9
  interface LineItemTagsTableProps {
10
10
  lineItems: TagAssignmentRow[];
11
11
  onClose: () => void;
12
- dispatch: Dispatch<any>;
12
+ dispatch: Dispatch<BillingStatementAction>;
13
13
  }
14
14
  export declare function LineItemTagsTable({ lineItems, onClose, dispatch, }: LineItemTagsTableProps): import("react/jsx-runtime").JSX.Element;
15
15
  export {};