@powerhousedao/contributor-billing 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/document-model.js +14 -36
- package/dist/document-models/invoice/gen/general/actions.d.ts +2 -5
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.d.ts +2 -5
- package/dist/document-models/invoice/gen/general/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/creators.js +0 -3
- package/dist/document-models/invoice/gen/general/object.d.ts +1 -4
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.js +1 -10
- package/dist/document-models/invoice/gen/general/operations.d.ts +1 -4
- package/dist/document-models/invoice/gen/general/operations.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/actions.d.ts +3 -2
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/creators.d.ts +3 -2
- package/dist/document-models/invoice/gen/items/creators.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/creators.js +1 -0
- package/dist/document-models/invoice/gen/items/object.d.ts +2 -1
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/object.js +4 -1
- package/dist/document-models/invoice/gen/items/operations.d.ts +2 -1
- package/dist/document-models/invoice/gen/items/operations.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +4 -12
- package/dist/document-models/invoice/gen/schema/types.d.ts +14 -17
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +3 -5
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +19 -26
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +2 -1
- package/dist/document-models/invoice/index.d.ts +1 -3
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +1 -40
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +29 -0
- package/dist/document-models/invoice/src/tests/general.test.js +0 -10
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +24 -6
- package/dist/editors/invoice/components/countryForm.d.ts.map +1 -1
- package/dist/editors/invoice/components/countryForm.js +1 -1
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +37 -23
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +5 -3
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.js +4 -4
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts +3 -3
- package/dist/editors/invoice/lineItemTags/lineItemTags.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/lineItemTags.js +24 -15
- package/dist/editors/invoice/lineItemTags/tagMapping.d.ts +1 -0
- package/dist/editors/invoice/lineItemTags/tagMapping.d.ts.map +1 -1
- package/dist/editors/invoice/lineItemTags/tagMapping.js +15 -0
- package/dist/editors/invoice/lineItems.d.ts +3 -3
- package/dist/editors/invoice/lineItems.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +3 -2
- package/dist/editors/invoice/validation/validationRules.d.ts +2 -1
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +26 -2
- package/dist/style.css +9 -11
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +9 -23
- package/dist/subgraphs/invoice/schema.d.ts.map +1 -1
- package/dist/subgraphs/invoice/schema.js +18 -31
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { AddLineItemInput,
|
|
2
|
+
import type { AddLineItemInput, AddRefInput, Address, Bank, ContactInfo, DeleteLineItemInput, DeleteRefInput, EditInvoiceInput, EditIssuerBankInput, EditIssuerInput, EditIssuerWalletInput, EditLineItemInput, EditPayerBankInput, EditPayerInput, EditPayerWalletInput, EditRefInput, EditStatusInput, IntermediaryBank, InvoiceLineItem, InvoiceState, InvoiceTag, InvoiceWallet, LegalEntity, LegalEntityCorporateRegistrationId, LegalEntityTaxId, PaymentRouting, Ref, SetInvoiceTagInput, SetLineItemTagInput, Token } from "./types.js";
|
|
3
3
|
type Properties<T> = Required<{
|
|
4
4
|
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
|
|
5
5
|
}>;
|
|
@@ -10,13 +10,11 @@ export declare const InvoiceAccountTypeSchema: z.ZodEnum<["CHECKING", "SAVINGS",
|
|
|
10
10
|
export declare const InvoiceAccountTypeInputSchema: z.ZodEnum<["CHECKING", "SAVINGS", "TRUST", "WALLET"]>;
|
|
11
11
|
export declare const StatusSchema: z.ZodEnum<["ACCEPTED", "AWAITINGPAYMENT", "CANCELLED", "DRAFT", "ISSUED", "PAYMENTISSUE", "PAYMENTRECEIVED", "PAYMENTSCHEDULED", "PAYMENTSENT", "REJECTED"]>;
|
|
12
12
|
export declare function AddLineItemInputSchema(): z.ZodObject<Properties<AddLineItemInput>>;
|
|
13
|
-
export declare function AddPaymentAccountInputSchema(): z.ZodObject<Properties<AddPaymentAccountInput>>;
|
|
14
13
|
export declare function AddRefInputSchema(): z.ZodObject<Properties<AddRefInput>>;
|
|
15
14
|
export declare function AddressSchema(): z.ZodObject<Properties<Address>>;
|
|
16
15
|
export declare function BankSchema(): z.ZodObject<Properties<Bank>>;
|
|
17
16
|
export declare function ContactInfoSchema(): z.ZodObject<Properties<ContactInfo>>;
|
|
18
17
|
export declare function DeleteLineItemInputSchema(): z.ZodObject<Properties<DeleteLineItemInput>>;
|
|
19
|
-
export declare function DeletePaymentAccountInputSchema(): z.ZodObject<Properties<DeletePaymentAccountInput>>;
|
|
20
18
|
export declare function DeleteRefInputSchema(): z.ZodObject<Properties<DeleteRefInput>>;
|
|
21
19
|
export declare function EditInvoiceInputSchema(): z.ZodObject<Properties<EditInvoiceInput>>;
|
|
22
20
|
export declare function EditIssuerBankInputSchema(): z.ZodObject<Properties<EditIssuerBankInput>>;
|
|
@@ -26,13 +24,12 @@ export declare function EditLineItemInputSchema(): z.ZodObject<Properties<EditLi
|
|
|
26
24
|
export declare function EditPayerBankInputSchema(): z.ZodObject<Properties<EditPayerBankInput>>;
|
|
27
25
|
export declare function EditPayerInputSchema(): z.ZodObject<Properties<EditPayerInput>>;
|
|
28
26
|
export declare function EditPayerWalletInputSchema(): z.ZodObject<Properties<EditPayerWalletInput>>;
|
|
29
|
-
export declare function EditPaymentAccountInputSchema(): z.ZodObject<Properties<EditPaymentAccountInput>>;
|
|
30
27
|
export declare function EditRefInputSchema(): z.ZodObject<Properties<EditRefInput>>;
|
|
31
28
|
export declare function EditStatusInputSchema(): z.ZodObject<Properties<EditStatusInput>>;
|
|
32
29
|
export declare function IntermediaryBankSchema(): z.ZodObject<Properties<IntermediaryBank>>;
|
|
33
30
|
export declare function InvoiceLineItemSchema(): z.ZodObject<Properties<InvoiceLineItem>>;
|
|
34
|
-
export declare function InvoiceLineItemTagSchema(): z.ZodObject<Properties<InvoiceLineItemTag>>;
|
|
35
31
|
export declare function InvoiceStateSchema(): z.ZodObject<Properties<InvoiceState>>;
|
|
32
|
+
export declare function InvoiceTagSchema(): z.ZodObject<Properties<InvoiceTag>>;
|
|
36
33
|
export declare function InvoiceWalletSchema(): z.ZodObject<Properties<InvoiceWallet>>;
|
|
37
34
|
export declare function LegalEntitySchema(): z.ZodObject<Properties<LegalEntity>>;
|
|
38
35
|
export declare function LegalEntityCorporateRegistrationIdSchema(): z.ZodObject<Properties<LegalEntityCorporateRegistrationId>>;
|
|
@@ -52,6 +49,7 @@ export declare function LegalEntityIdSchema(): z.ZodUnion<[z.ZodObject<Required<
|
|
|
52
49
|
export declare function LegalEntityTaxIdSchema(): z.ZodObject<Properties<LegalEntityTaxId>>;
|
|
53
50
|
export declare function PaymentRoutingSchema(): z.ZodObject<Properties<PaymentRouting>>;
|
|
54
51
|
export declare function RefSchema(): z.ZodObject<Properties<Ref>>;
|
|
52
|
+
export declare function SetInvoiceTagInputSchema(): z.ZodObject<Properties<SetInvoiceTagInput>>;
|
|
55
53
|
export declare function SetLineItemTagInputSchema(): z.ZodObject<Properties<SetLineItemTagInput>>;
|
|
56
54
|
export declare function TokenSchema(): z.ZodObject<Properties<Token>>;
|
|
57
55
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAGhB,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EACX,kCAAkC,EAClC,gBAAgB,EAChB,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AmB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAQ5E;AAED,wBAAgB,iBAAiB,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAUxE;AAED,wBAAgB,wCAAwC,IAAI,CAAC,CAAC,SAAS,CACrE,UAAU,CAAC,kCAAkC,CAAC,CAC/C,CAKA;AAED,wBAAgB,mBAAmB;;;eAsBb,sCAAkB;;eAAlB,sCAAkB;;;;WAOhC,sCACH;;WADG,sCACH;KAzBJ;AAED,wBAAgB,sBAAsB,IAAI,CAAC,CAAC,SAAS,CACnD,UAAU,CAAC,gBAAgB,CAAC,CAC7B,CAKA;AAED,wBAAgB,oBAAoB,IAAI,CAAC,CAAC,SAAS,CACjD,UAAU,CAAC,cAAc,CAAC,CAC3B,CAMA;AAED,wBAAgB,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAMxD;AAED,wBAAgB,wBAAwB,IAAI,CAAC,CAAC,SAAS,CACrD,UAAU,CAAC,kBAAkB,CAAC,CAC/B,CAMA;AAED,wBAAgB,yBAAyB,IAAI,CAAC,CAAC,SAAS,CACtD,UAAU,CAAC,mBAAmB,CAAC,CAChC,CAOA;AAED,wBAAgB,WAAW,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAS5D"}
|
|
@@ -40,11 +40,6 @@ export function AddLineItemInputSchema() {
|
|
|
40
40
|
unitPriceTaxIncl: z.number(),
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
export function AddPaymentAccountInputSchema() {
|
|
44
|
-
return z.object({
|
|
45
|
-
paymentAccount: z.string(),
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
43
|
export function AddRefInputSchema() {
|
|
49
44
|
return z.object({
|
|
50
45
|
id: z.string(),
|
|
@@ -89,11 +84,6 @@ export function DeleteLineItemInputSchema() {
|
|
|
89
84
|
id: z.string(),
|
|
90
85
|
});
|
|
91
86
|
}
|
|
92
|
-
export function DeletePaymentAccountInputSchema() {
|
|
93
|
-
return z.object({
|
|
94
|
-
paymentAccount: z.string(),
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
87
|
export function DeleteRefInputSchema() {
|
|
98
88
|
return z.object({
|
|
99
89
|
id: z.string(),
|
|
@@ -106,6 +96,7 @@ export function EditInvoiceInputSchema() {
|
|
|
106
96
|
dateDue: z.string().nullish(),
|
|
107
97
|
dateIssued: z.string().nullish(),
|
|
108
98
|
invoiceNo: z.string().nullish(),
|
|
99
|
+
notes: z.string().nullish(),
|
|
109
100
|
});
|
|
110
101
|
}
|
|
111
102
|
export function EditIssuerBankInputSchema() {
|
|
@@ -229,12 +220,6 @@ export function EditPayerWalletInputSchema() {
|
|
|
229
220
|
rpc: z.string().nullish(),
|
|
230
221
|
});
|
|
231
222
|
}
|
|
232
|
-
export function EditPaymentAccountInputSchema() {
|
|
233
|
-
return z.object({
|
|
234
|
-
existingPaymentAccount: z.string(),
|
|
235
|
-
newPaymentAccount: z.string(),
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
223
|
export function EditRefInputSchema() {
|
|
239
224
|
return z.object({
|
|
240
225
|
id: z.string(),
|
|
@@ -266,7 +251,7 @@ export function InvoiceLineItemSchema() {
|
|
|
266
251
|
currency: z.string(),
|
|
267
252
|
description: z.string(),
|
|
268
253
|
id: z.string(),
|
|
269
|
-
lineItemTag: z.array(
|
|
254
|
+
lineItemTag: z.array(InvoiceTagSchema()).nullable(),
|
|
270
255
|
quantity: z.number(),
|
|
271
256
|
taxPercent: z.number(),
|
|
272
257
|
totalPriceTaxExcl: z.number(),
|
|
@@ -275,14 +260,6 @@ export function InvoiceLineItemSchema() {
|
|
|
275
260
|
unitPriceTaxIncl: z.number(),
|
|
276
261
|
});
|
|
277
262
|
}
|
|
278
|
-
export function InvoiceLineItemTagSchema() {
|
|
279
|
-
return z.object({
|
|
280
|
-
__typename: z.literal("InvoiceLineItemTag").optional(),
|
|
281
|
-
dimension: z.string(),
|
|
282
|
-
label: z.string().nullable(),
|
|
283
|
-
value: z.string(),
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
263
|
export function InvoiceStateSchema() {
|
|
287
264
|
return z.object({
|
|
288
265
|
__typename: z.literal("InvoiceState").optional(),
|
|
@@ -291,16 +268,25 @@ export function InvoiceStateSchema() {
|
|
|
291
268
|
dateDue: z.string(),
|
|
292
269
|
dateIssued: z.string(),
|
|
293
270
|
invoiceNo: z.string(),
|
|
271
|
+
invoiceTags: z.array(InvoiceTagSchema()),
|
|
294
272
|
issuer: LegalEntitySchema(),
|
|
295
273
|
lineItems: z.array(InvoiceLineItemSchema()),
|
|
274
|
+
notes: z.string().nullable(),
|
|
296
275
|
payer: LegalEntitySchema(),
|
|
297
|
-
paymentAccounts: z.array(z.string()),
|
|
298
276
|
refs: z.array(RefSchema()),
|
|
299
277
|
status: StatusSchema,
|
|
300
278
|
totalPriceTaxExcl: z.number(),
|
|
301
279
|
totalPriceTaxIncl: z.number(),
|
|
302
280
|
});
|
|
303
281
|
}
|
|
282
|
+
export function InvoiceTagSchema() {
|
|
283
|
+
return z.object({
|
|
284
|
+
__typename: z.literal("InvoiceTag").optional(),
|
|
285
|
+
dimension: z.string(),
|
|
286
|
+
label: z.string().nullable(),
|
|
287
|
+
value: z.string(),
|
|
288
|
+
});
|
|
289
|
+
}
|
|
304
290
|
export function InvoiceWalletSchema() {
|
|
305
291
|
return z.object({
|
|
306
292
|
__typename: z.literal("InvoiceWallet").optional(),
|
|
@@ -353,6 +339,13 @@ export function RefSchema() {
|
|
|
353
339
|
value: z.string(),
|
|
354
340
|
});
|
|
355
341
|
}
|
|
342
|
+
export function SetInvoiceTagInputSchema() {
|
|
343
|
+
return z.object({
|
|
344
|
+
dimension: z.string(),
|
|
345
|
+
label: z.string().nullish(),
|
|
346
|
+
value: z.string(),
|
|
347
|
+
});
|
|
348
|
+
}
|
|
356
349
|
export function SetLineItemTagInputSchema() {
|
|
357
350
|
return z.object({
|
|
358
351
|
dimension: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/invoice/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,kBAAkB,EAAE,YAuIhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,iBAAsB,CAAC;AAEvD,QAAA,MAAM,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAgC9C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -22,9 +22,6 @@ declare const actions: {
|
|
|
22
22
|
addRef: (input: import("./gen/index.js").AddRefInput) => import("./gen/index.js").AddRefAction;
|
|
23
23
|
editRef: (input: import("./gen/index.js").EditRefInput) => import("./gen/index.js").EditRefAction;
|
|
24
24
|
deleteRef: (input: import("./gen/index.js").DeleteRefInput) => import("./gen/index.js").DeleteRefAction;
|
|
25
|
-
addPaymentAccount: (input: import("./gen/index.js").AddPaymentAccountInput) => import("./gen/index.js").AddPaymentAccountAction;
|
|
26
|
-
editPaymentAccount: (input: import("./gen/index.js").EditPaymentAccountInput) => import("./gen/index.js").EditPaymentAccountAction;
|
|
27
|
-
deletePaymentAccount: (input: import("./gen/index.js").DeletePaymentAccountInput) => import("./gen/index.js").DeletePaymentAccountAction;
|
|
28
25
|
editIssuer: (input: import("./gen/index.js").EditIssuerInput) => import("./gen/index.js").EditIssuerAction;
|
|
29
26
|
editIssuerBank: (input: import("./gen/index.js").EditIssuerBankInput) => import("./gen/index.js").EditIssuerBankAction;
|
|
30
27
|
editIssuerWallet: (input: import("./gen/index.js").EditIssuerWalletInput) => import("./gen/index.js").EditIssuerWalletAction;
|
|
@@ -35,6 +32,7 @@ declare const actions: {
|
|
|
35
32
|
editLineItem: (input: import("./gen/index.js").EditLineItemInput) => import("./gen/index.js").EditLineItemAction;
|
|
36
33
|
deleteLineItem: (input: import("./gen/index.js").DeleteLineItemInput) => import("./gen/index.js").DeleteLineItemAction;
|
|
37
34
|
setLineItemTag: (input: import("./gen/index.js").SetLineItemTagInput) => import("./gen/index.js").SetLineItemTagAction;
|
|
35
|
+
setInvoiceTag: (input: import("./gen/index.js").SetInvoiceTagInput) => import("./gen/index.js").SetInvoiceTagAction;
|
|
38
36
|
};
|
|
39
37
|
export declare const module: DocumentModelModule<InvoiceDocument>;
|
|
40
38
|
export { reducer, actions, utils, documentModel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/invoice/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,QAAA,MAAM,KAAK;;;;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/invoice/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,QAAA,MAAM,KAAK;;;;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;kBANwC,gDAClC;iBAKnB,+CAAsB;aASP,2CAAkB;cAIoC,4CAAmB;gBAA6J,8CAAqB;iBAhBnQ,+CAAqB;qBAKY,mDACpC;uBAUkB,qDAA4B;gBAAyL,8CAAqB;oBAAuK,kDAAyB;sBAAsL,oDAA2B;kBAjBjpB,gDAAsB;mBAIuB,iDAEhC;qBASY,mDACN;qBACwJ,mDAA0B;oBAAwL,kDAAyB;CAbjW,CAAC;AAEtD,eAAO,MAAM,MAAM,EAAE,mBAAmB,CAAC,eAAe,CAKvD,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAElD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/general.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,eAAO,MAAM,OAAO,EAAE,wBAwDrB,CAAC"}
|
|
@@ -13,6 +13,7 @@ export const reducer = {
|
|
|
13
13
|
newState.dateDue = action.input.dateDue ?? state.dateDue;
|
|
14
14
|
newState.dateIssued = action.input.dateIssued ?? state.dateIssued;
|
|
15
15
|
newState.invoiceNo = action.input.invoiceNo ?? state.invoiceNo;
|
|
16
|
+
newState.notes = action.input.notes ?? state.notes;
|
|
16
17
|
state = Object.assign(state, newState);
|
|
17
18
|
}
|
|
18
19
|
catch (e) {
|
|
@@ -66,44 +67,4 @@ export const reducer = {
|
|
|
66
67
|
console.error(e);
|
|
67
68
|
}
|
|
68
69
|
},
|
|
69
|
-
addPaymentAccountOperation(state, action, dispatch) {
|
|
70
|
-
try {
|
|
71
|
-
if (!action.input.paymentAccount)
|
|
72
|
-
throw new Error("No input.paymentAccount");
|
|
73
|
-
if (!state.paymentAccounts)
|
|
74
|
-
state.paymentAccounts = [];
|
|
75
|
-
if (state.paymentAccounts.includes(action.input.paymentAccount))
|
|
76
|
-
throw new Error("Payment account already exists");
|
|
77
|
-
state.paymentAccounts.push(action.input.paymentAccount);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
console.error(e);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
editPaymentAccountOperation(state, action, dispatch) {
|
|
84
|
-
try {
|
|
85
|
-
if (!action.input.existingPaymentAccount)
|
|
86
|
-
throw new Error("No input.existingPaymentAccount");
|
|
87
|
-
if (!action.input.newPaymentAccount)
|
|
88
|
-
throw new Error("No input.newPaymentAccount");
|
|
89
|
-
if (!state.paymentAccounts)
|
|
90
|
-
state.paymentAccounts = [];
|
|
91
|
-
state.paymentAccounts = state.paymentAccounts.map((paymentAccount) => paymentAccount === action.input.existingPaymentAccount ? action.input.newPaymentAccount : paymentAccount);
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
console.error(e);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
deletePaymentAccountOperation(state, action, dispatch) {
|
|
98
|
-
try {
|
|
99
|
-
if (!action.input.paymentAccount)
|
|
100
|
-
throw new Error("No input.paymentAccount");
|
|
101
|
-
if (!state.paymentAccounts)
|
|
102
|
-
state.paymentAccounts = [];
|
|
103
|
-
state.paymentAccounts = state.paymentAccounts.filter((paymentAccount) => paymentAccount !== action.input.paymentAccount);
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
console.error(e);
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/items.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../../document-models/invoice/src/reducers/items.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,eAAO,MAAM,OAAO,EAAE,sBA6GrB,CAAC"}
|
|
@@ -69,6 +69,9 @@ export const reducer = {
|
|
|
69
69
|
value: action.input.value,
|
|
70
70
|
label: action.input.label || null,
|
|
71
71
|
};
|
|
72
|
+
if (!stateItem.lineItemTag) {
|
|
73
|
+
stateItem.lineItemTag = [];
|
|
74
|
+
}
|
|
72
75
|
// Add the new tag
|
|
73
76
|
stateItem.lineItemTag?.push(newTag);
|
|
74
77
|
}
|
|
@@ -77,6 +80,32 @@ export const reducer = {
|
|
|
77
80
|
console.error(e);
|
|
78
81
|
}
|
|
79
82
|
},
|
|
83
|
+
setInvoiceTagOperation(state, action, dispatch) {
|
|
84
|
+
try {
|
|
85
|
+
// if tag already exists with the same dimension, update the value and label
|
|
86
|
+
const existingTag = state.invoiceTags?.find((tag) => tag.dimension === action.input.dimension);
|
|
87
|
+
if (existingTag) {
|
|
88
|
+
existingTag.value = action.input.value;
|
|
89
|
+
existingTag.label = action.input.label || null;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// if tag does not exist, add it
|
|
93
|
+
const newTag = {
|
|
94
|
+
dimension: action.input.dimension,
|
|
95
|
+
value: action.input.value,
|
|
96
|
+
label: action.input.label || null,
|
|
97
|
+
};
|
|
98
|
+
if (!state.invoiceTags) {
|
|
99
|
+
state.invoiceTags = [];
|
|
100
|
+
}
|
|
101
|
+
// Add the new tag
|
|
102
|
+
state.invoiceTags.push(newTag);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
console.error(e);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
80
109
|
};
|
|
81
110
|
function updateTotals(state) {
|
|
82
111
|
state.totalPriceTaxExcl = state.lineItems.reduce((total, lineItem) => {
|
|
@@ -62,14 +62,4 @@ describe("General Operations", () => {
|
|
|
62
62
|
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
63
63
|
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
64
64
|
});
|
|
65
|
-
it("should handle setPaymentAccount operation", () => {
|
|
66
|
-
// generate a random id
|
|
67
|
-
// const id = documentModelUtils.hashKey();
|
|
68
|
-
const input = generateMock(z.AddPaymentAccountInputSchema());
|
|
69
|
-
const updatedDocument = reducer(document, creators.addPaymentAccount(input));
|
|
70
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
71
|
-
expect(updatedDocument.operations.global[0].type).toBe("SET_PAYMENT_ACCOUNT");
|
|
72
|
-
expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
|
|
73
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
74
|
-
});
|
|
75
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAIb,MAAM,wCAAwC,CAAC;AAiThD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"InvoicePDF.d.ts","sourceRoot":"","sources":["../../../editors/invoice/InvoicePDF.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EAIb,MAAM,wCAAwC,CAAC;AAiThD,UAAU,eAAe;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2bhD,CAAC"}
|
|
@@ -310,18 +310,33 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
310
310
|
}, children: [_jsxs(View, { style: {
|
|
311
311
|
flexDirection: "column",
|
|
312
312
|
alignItems: "flex-start",
|
|
313
|
-
}, children: [_jsx(Text, { style: {
|
|
313
|
+
}, children: [_jsx(Text, { style: {
|
|
314
|
+
fontSize: 20,
|
|
315
|
+
fontWeight: "bold",
|
|
316
|
+
marginBottom: 10,
|
|
317
|
+
paddingRight: 65,
|
|
318
|
+
marginRight: 20,
|
|
319
|
+
}, 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: [
|
|
314
320
|
styles.invoiceNumber,
|
|
315
321
|
{ fontSize: 18, fontWeight: "bold" },
|
|
316
322
|
], children: formatNumber(invoice.totalPriceTaxIncl) })] })] }), _jsxs(View, { style: {
|
|
317
323
|
flexDirection: "row",
|
|
318
324
|
justifyContent: "space-between",
|
|
319
325
|
marginTop: 20,
|
|
320
|
-
}, children: [_jsxs(View, { style: {
|
|
326
|
+
}, children: [_jsxs(View, { style: {
|
|
327
|
+
width: "50%",
|
|
328
|
+
minWidth: 0,
|
|
329
|
+
flexDirection: "column",
|
|
330
|
+
paddingRight: 65,
|
|
331
|
+
}, 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, wrap: true, 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
|
|
321
332
|
?.taxId ||
|
|
322
333
|
invoice.issuer
|
|
323
334
|
.id?.corpRegId ||
|
|
324
|
-
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, 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, wrap: true, children: invoice.issuer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, 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, wrap: true, children: invoice.issuer.contactInfo.email })] }))] }), _jsxs(View, { style: {
|
|
335
|
+
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, 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, wrap: true, children: invoice.issuer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, 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, wrap: true, children: invoice.issuer.contactInfo.email })] }))] }), _jsxs(View, { style: {
|
|
336
|
+
width: "47%",
|
|
337
|
+
minWidth: 0,
|
|
338
|
+
flexDirection: "column",
|
|
339
|
+
}, 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, wrap: true, 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 ||
|
|
325
340
|
invoice.payer
|
|
326
341
|
.id?.corpRegId ||
|
|
327
342
|
"" })] }), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel, children: "Address:" }), _jsx(Text, { style: styles.companyInfo, wrap: true, 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, wrap: true, children: invoice.payer.address?.extendedAddress || "" })] })), _jsxs(View, { style: styles.row, children: [_jsx(Text, { style: styles.companyInfoLabel }), _jsxs(Text, { style: styles.companyInfo, wrap: true, children: [invoice.payer.address?.city || "", ",", " ", getCountryName(invoice.payer.address?.country || "") ||
|
|
@@ -365,9 +380,12 @@ export const InvoicePDF = ({ invoice, fiatMode, }) => {
|
|
|
365
380
|
textAlign: "right",
|
|
366
381
|
color: "#000",
|
|
367
382
|
fontFamily: "Helvetica",
|
|
368
|
-
}, children: formatDate(invoice.dateDue) })] })] })] }), _jsxs(View, { style: [styles.paymentSection, { marginLeft: 0 }], children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (
|
|
369
|
-
|
|
370
|
-
|
|
383
|
+
}, children: formatDate(invoice.dateDue) })] })] })] }), _jsxs(View, { style: [styles.paymentSection, { marginLeft: 0 }], children: [_jsx(Text, { style: styles.sectionTitle, children: "Payment Information" }), fiatMode ? (_jsx("div", { children: _jsx(PaymentSectionFiat, { paymentRouting: invoice.issuer.paymentRouting }) })) : (_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: { flexDirection: "row", gap: 20 }, children: [_jsxs(View, { style: {
|
|
384
|
+
flex: 1,
|
|
385
|
+
marginTop: 20,
|
|
386
|
+
}, children: [_jsx(Text, { style: [styles.sectionTitle, { marginBottom: 10 }], children: invoice.notes ? "Notes" : "" }), _jsx(Text, { style: styles.companyInfo, children: invoice.notes || "" })] }), _jsxs(View, { style: [styles.totals, { flex: 1 }], 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 +
|
|
387
|
+
item.quantity *
|
|
388
|
+
(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: {
|
|
371
389
|
marginLeft: 40,
|
|
372
390
|
flexDirection: "row",
|
|
373
391
|
alignItems: "center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countryForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/countryForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,GAAI,2EAOzB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"countryForm.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/components/countryForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,GAAI,2EAOzB,gBAAgB,4CA0ClB,CAAC"}
|
|
@@ -24,5 +24,5 @@ export const CountryForm = ({ country, handleInputChange, handleBlur, className,
|
|
|
24
24
|
},
|
|
25
25
|
// required
|
|
26
26
|
// defaultValue={countryCode}
|
|
27
|
-
value: countryCode, className: twMerge(className), label: label, warnings: warnings }) }));
|
|
27
|
+
value: countryCode, className: twMerge(className), label: label, warnings: warnings, includeDependentAreas: true }) }));
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA4BhD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAsyB3C"}
|
|
@@ -18,6 +18,7 @@ import { validateField, } from "./validation/validationManager.js";
|
|
|
18
18
|
import { DatePicker } from "./components/datePicker.js";
|
|
19
19
|
import { SelectField } from "./components/selectField.js";
|
|
20
20
|
import { formatNumber } from "./lineItems.js";
|
|
21
|
+
import { Textarea } from "@powerhousedao/document-engineering/ui";
|
|
21
22
|
function isFiatCurrency(currency) {
|
|
22
23
|
return currencyList.find((c) => c.ticker === currency)?.crypto === false;
|
|
23
24
|
}
|
|
@@ -31,11 +32,11 @@ export default function Editor(props) {
|
|
|
31
32
|
const uploadDropdownRef = useRef(null);
|
|
32
33
|
const exportDropdownRef = useRef(null);
|
|
33
34
|
const [isPdfLoading, setIsPdfLoading] = useState(false);
|
|
35
|
+
const [notes, setNotes] = useState(state.notes || "");
|
|
34
36
|
// Validation state
|
|
35
37
|
const [invoiceValidation, setInvoiceValidation] = useState(null);
|
|
36
38
|
const [walletValidation, setWalletValidation] = useState(null);
|
|
37
39
|
const [currencyValidation, setCurrencyValidation] = useState(null);
|
|
38
|
-
const [countryValidation, setCountryValidation] = useState(null);
|
|
39
40
|
const [ibanValidation, setIbanValidation] = useState(null);
|
|
40
41
|
const [bicValidation, setBicValidation] = useState(null);
|
|
41
42
|
const [bankNameValidation, setBankNameValidation] = useState(null);
|
|
@@ -44,15 +45,17 @@ export default function Editor(props) {
|
|
|
44
45
|
const [postalCodeValidation, setPostalCodeValidation] = useState(null);
|
|
45
46
|
const [payerEmailValidation, setPayerEmailValidation] = useState(null);
|
|
46
47
|
const [lineItemValidation, setLineItemValidation] = useState(null);
|
|
48
|
+
const [mainCountryValidation, setMainCountryValidation] = useState(null);
|
|
49
|
+
const [bankCountryValidation, setBankCountryValidation] = useState(null);
|
|
47
50
|
const prevStatus = useRef(state.status);
|
|
48
51
|
const invoiceRootStyle = {
|
|
49
|
-
width:
|
|
50
|
-
minHeight:
|
|
52
|
+
width: "100vw",
|
|
53
|
+
minHeight: "100vh",
|
|
51
54
|
margin: 0,
|
|
52
55
|
padding: 0,
|
|
53
|
-
boxSizing:
|
|
54
|
-
transform:
|
|
55
|
-
transformOrigin:
|
|
56
|
+
boxSizing: "border-box",
|
|
57
|
+
transform: "scale(0.9)",
|
|
58
|
+
transformOrigin: "top left",
|
|
56
59
|
};
|
|
57
60
|
const [responsiveStyle, setResponsiveStyle] = useState(invoiceRootStyle);
|
|
58
61
|
useEffect(() => {
|
|
@@ -60,10 +63,10 @@ export default function Editor(props) {
|
|
|
60
63
|
if (window.innerWidth >= 1024) {
|
|
61
64
|
setResponsiveStyle({
|
|
62
65
|
...invoiceRootStyle,
|
|
63
|
-
maxWidth:
|
|
64
|
-
marginLeft:
|
|
65
|
-
marginRight:
|
|
66
|
-
padding:
|
|
66
|
+
maxWidth: "1280px",
|
|
67
|
+
marginLeft: "auto",
|
|
68
|
+
marginRight: "auto",
|
|
69
|
+
padding: "1rem",
|
|
67
70
|
});
|
|
68
71
|
}
|
|
69
72
|
else {
|
|
@@ -71,8 +74,8 @@ export default function Editor(props) {
|
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
handleResize();
|
|
74
|
-
window.addEventListener(
|
|
75
|
-
return () => window.removeEventListener(
|
|
77
|
+
window.addEventListener("resize", handleResize);
|
|
78
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
76
79
|
}, []);
|
|
77
80
|
useEffect(() => {
|
|
78
81
|
setFiatMode(isFiatCurrency(state.currency));
|
|
@@ -265,15 +268,19 @@ export default function Editor(props) {
|
|
|
265
268
|
if (currencyValidation && !currencyValidation.isValid) {
|
|
266
269
|
validationErrors.push(currencyValidation);
|
|
267
270
|
}
|
|
268
|
-
// Validate country
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
// Validate main country
|
|
272
|
+
const mainCountry = state.issuer.country ?? "";
|
|
273
|
+
const mainCountryValidation = validateField("mainCountry", mainCountry, context);
|
|
274
|
+
setMainCountryValidation(mainCountryValidation);
|
|
275
|
+
if (mainCountryValidation && !mainCountryValidation.isValid) {
|
|
276
|
+
validationErrors.push(mainCountryValidation);
|
|
277
|
+
}
|
|
278
|
+
// Validate bank country
|
|
279
|
+
const bankCountry = state.issuer.paymentRouting?.bank?.address?.country ?? "";
|
|
280
|
+
const bankCountryValidation = validateField("bankCountry", bankCountry, context);
|
|
281
|
+
setBankCountryValidation(bankCountryValidation);
|
|
282
|
+
if (bankCountryValidation && !bankCountryValidation.isValid) {
|
|
283
|
+
validationErrors.push(bankCountryValidation);
|
|
277
284
|
}
|
|
278
285
|
// Validate EUR&GBP IBAN account number
|
|
279
286
|
const ibanValidation = validateField("accountNum", state.issuer.paymentRouting?.bank?.accountNum, context);
|
|
@@ -384,7 +391,7 @@ export default function Editor(props) {
|
|
|
384
391
|
dateDelivered: newValue,
|
|
385
392
|
}));
|
|
386
393
|
}
|
|
387
|
-
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer,
|
|
394
|
+
}, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-6", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: "w-full", onChange: (e) => dispatch(actions.editInvoice({
|
|
388
395
|
dateDue: e.target.value.split("T")[0],
|
|
389
396
|
})), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
|
|
390
397
|
...item,
|
|
@@ -392,5 +399,12 @@ export default function Editor(props) {
|
|
|
392
399
|
})), onAddItem: (item) => dispatch(actions.addLineItem(item)), onDeleteItem: (input) => dispatch(actions.deleteLineItem(input)), onUpdateCurrency: (input) => {
|
|
393
400
|
setFiatMode(input.currency !== "USDS");
|
|
394
401
|
dispatch(actions.editInvoice(input));
|
|
395
|
-
}, onUpdateItem: (item) => dispatch(actions.editLineItem(item)), dispatch: dispatch, paymentAccounts: state.
|
|
402
|
+
}, onUpdateItem: (item) => dispatch(actions.editLineItem(item)), dispatch: dispatch, paymentAccounts: state.invoiceTags || [] }) }), _jsxs("div", { className: "grid grid-cols-2 md:grid-cols-2 gap-4", children: [_jsx("div", { className: "col-span-1", children: _jsx("div", { className: "", children: _jsx(Textarea, { label: "Notes", placeholder: "Add notes", autoExpand: false, rows: 4, multiline: true, value: notes, onBlur: (e) => {
|
|
403
|
+
const newValue = e.target.value;
|
|
404
|
+
if (newValue !== state.notes) {
|
|
405
|
+
dispatch(actions.editInvoice({ notes: newValue }));
|
|
406
|
+
}
|
|
407
|
+
}, onChange: (e) => {
|
|
408
|
+
setNotes(e.target.value);
|
|
409
|
+
}, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 p-6 shadow-sm h-32", children: _jsxs("div", { className: "", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), state.status === "PAYMENTSCHEDULED" && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state })) : (_jsx(RequestFinance, { docState: state })) }))] }));
|
|
396
410
|
}
|
|
@@ -8,7 +8,8 @@ export type LegalEntityMainSectionProps = Omit<ComponentPropsWithRef<"div">, "ch
|
|
|
8
8
|
readonly value: EditLegalEntityInput;
|
|
9
9
|
readonly onChange: (value: EditLegalEntityInput) => void;
|
|
10
10
|
readonly disabled?: boolean;
|
|
11
|
-
readonly
|
|
11
|
+
readonly mainCountryValidation?: ValidationResult | null;
|
|
12
|
+
readonly bankCountryValidation?: ValidationResult | null;
|
|
12
13
|
readonly streetaddressvalidation?: ValidationResult | null;
|
|
13
14
|
readonly cityvalidation?: ValidationResult | null;
|
|
14
15
|
readonly postalcodevalidation?: ValidationResult | null;
|
|
@@ -26,7 +27,8 @@ type LegalEntityFormProps = {
|
|
|
26
27
|
readonly currency: string;
|
|
27
28
|
readonly status: string;
|
|
28
29
|
readonly walletvalidation?: ValidationResult | null;
|
|
29
|
-
readonly
|
|
30
|
+
readonly mainCountryValidation?: ValidationResult | null;
|
|
31
|
+
readonly bankCountryValidation?: ValidationResult | null;
|
|
30
32
|
readonly ibanvalidation?: ValidationResult | null;
|
|
31
33
|
readonly bicvalidation?: ValidationResult | null;
|
|
32
34
|
readonly banknamevalidation?: ValidationResult | null;
|
|
@@ -35,6 +37,6 @@ type LegalEntityFormProps = {
|
|
|
35
37
|
readonly postalcodevalidation?: ValidationResult | null;
|
|
36
38
|
readonly payeremailvalidation?: ValidationResult | null;
|
|
37
39
|
};
|
|
38
|
-
export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation,
|
|
40
|
+
export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
|
|
39
41
|
export {};
|
|
40
42
|
//# sourceMappingURL=legalEntity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legalEntity.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/legalEntity.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,
|
|
1
|
+
{"version":3,"file":"legalEntity.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/legalEntity.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,WAAW,EACZ,MAAM,2CAA2C,CAAC;AACnD,OAAc,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAKrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,MAAM,MAAM,0BAA0B,GACl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