@powerhousedao/contributor-billing 0.0.44 → 0.0.46

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 (101) hide show
  1. package/dist/document-models/index.d.ts +1 -0
  2. package/dist/document-models/index.d.ts.map +1 -1
  3. package/dist/document-models/index.js +1 -0
  4. package/dist/document-models/integrations/gen/actions.d.ts +4 -0
  5. package/dist/document-models/integrations/gen/actions.d.ts.map +1 -0
  6. package/dist/document-models/integrations/gen/actions.js +1 -0
  7. package/dist/document-models/integrations/gen/creators.d.ts +2 -0
  8. package/dist/document-models/integrations/gen/creators.d.ts.map +1 -0
  9. package/dist/document-models/integrations/gen/creators.js +1 -0
  10. package/dist/document-models/integrations/gen/document-model.d.ts +3 -0
  11. package/dist/document-models/integrations/gen/document-model.d.ts.map +1 -0
  12. package/dist/document-models/integrations/gen/document-model.js +70 -0
  13. package/dist/document-models/integrations/gen/index.d.ts +6 -0
  14. package/dist/document-models/integrations/gen/index.d.ts.map +1 -0
  15. package/dist/document-models/integrations/gen/index.js +5 -0
  16. package/dist/document-models/integrations/gen/integrations/actions.d.ts +7 -0
  17. package/dist/document-models/integrations/gen/integrations/actions.d.ts.map +1 -0
  18. package/dist/document-models/integrations/gen/integrations/actions.js +1 -0
  19. package/dist/document-models/integrations/gen/integrations/creators.d.ts +6 -0
  20. package/dist/document-models/integrations/gen/integrations/creators.d.ts.map +1 -0
  21. package/dist/document-models/integrations/gen/integrations/creators.js +5 -0
  22. package/dist/document-models/integrations/gen/integrations/error.d.ts +2 -0
  23. package/dist/document-models/integrations/gen/integrations/error.d.ts.map +1 -0
  24. package/dist/document-models/integrations/gen/integrations/error.js +1 -0
  25. package/dist/document-models/integrations/gen/integrations/object.d.ts +9 -0
  26. package/dist/document-models/integrations/gen/integrations/object.d.ts.map +1 -0
  27. package/dist/document-models/integrations/gen/integrations/object.js +13 -0
  28. package/dist/document-models/integrations/gen/integrations/operations.d.ts +9 -0
  29. package/dist/document-models/integrations/gen/integrations/operations.d.ts.map +1 -0
  30. package/dist/document-models/integrations/gen/integrations/operations.js +1 -0
  31. package/dist/document-models/integrations/gen/object.d.ts +16 -0
  32. package/dist/document-models/integrations/gen/object.d.ts.map +1 -0
  33. package/dist/document-models/integrations/gen/object.js +25 -0
  34. package/dist/document-models/integrations/gen/reducer.d.ts +3 -0
  35. package/dist/document-models/integrations/gen/reducer.d.ts.map +1 -0
  36. package/dist/document-models/integrations/gen/reducer.js +25 -0
  37. package/dist/document-models/integrations/gen/schema/index.d.ts +3 -0
  38. package/dist/document-models/integrations/gen/schema/index.d.ts.map +1 -0
  39. package/dist/document-models/integrations/gen/schema/index.js +2 -0
  40. package/dist/document-models/integrations/gen/schema/types.d.ts +192 -0
  41. package/dist/document-models/integrations/gen/schema/types.d.ts.map +1 -0
  42. package/dist/document-models/integrations/gen/schema/types.js +1 -0
  43. package/dist/document-models/integrations/gen/schema/zod.d.ts +19 -0
  44. package/dist/document-models/integrations/gen/schema/zod.d.ts.map +1 -0
  45. package/dist/document-models/integrations/gen/schema/zod.js +97 -0
  46. package/dist/document-models/integrations/gen/types.d.ts +10 -0
  47. package/dist/document-models/integrations/gen/types.d.ts.map +1 -0
  48. package/dist/document-models/integrations/gen/types.js +1 -0
  49. package/dist/document-models/integrations/gen/utils.d.ts +7 -0
  50. package/dist/document-models/integrations/gen/utils.d.ts.map +1 -0
  51. package/dist/document-models/integrations/gen/utils.js +63 -0
  52. package/dist/document-models/integrations/index.d.ts +28 -0
  53. package/dist/document-models/integrations/index.d.ts.map +1 -0
  54. package/dist/document-models/integrations/index.js +21 -0
  55. package/dist/document-models/integrations/src/reducers/integrations.d.ts +8 -0
  56. package/dist/document-models/integrations/src/reducers/integrations.d.ts.map +1 -0
  57. package/dist/document-models/integrations/src/reducers/integrations.js +57 -0
  58. package/dist/document-models/integrations/src/tests/document-model.test.d.ts +6 -0
  59. package/dist/document-models/integrations/src/tests/document-model.test.d.ts.map +1 -0
  60. package/dist/document-models/integrations/src/tests/document-model.test.js +18 -0
  61. package/dist/document-models/integrations/src/tests/integrations.test.d.ts +6 -0
  62. package/dist/document-models/integrations/src/tests/integrations.test.d.ts.map +1 -0
  63. package/dist/document-models/integrations/src/tests/integrations.test.js +63 -0
  64. package/dist/document-models/integrations/src/utils.d.ts +2 -0
  65. package/dist/document-models/integrations/src/utils.d.ts.map +1 -0
  66. package/dist/document-models/integrations/src/utils.js +1 -0
  67. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +5 -1
  68. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  69. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +18 -4
  70. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  71. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +9 -1
  72. package/dist/editors/index.d.ts +1 -0
  73. package/dist/editors/index.d.ts.map +1 -1
  74. package/dist/editors/index.js +1 -0
  75. package/dist/editors/integrations/editor.d.ts +5 -0
  76. package/dist/editors/integrations/editor.d.ts.map +1 -0
  77. package/dist/editors/integrations/editor.js +113 -0
  78. package/dist/editors/integrations/index.d.ts +5 -0
  79. package/dist/editors/integrations/index.d.ts.map +1 -0
  80. package/dist/editors/integrations/index.js +12 -0
  81. package/dist/editors/invoice/ingestPDF.js +1 -1
  82. package/dist/editors/invoice/invoiceToGnosis.js +2 -2
  83. package/dist/editors/invoice/requestFinance.js +1 -1
  84. package/dist/editors/invoice/uploadPdfChunked.js +1 -1
  85. package/dist/index.d.ts +2 -2
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/scripts/invoice/gnosisTransactionBuilder.js +1 -1
  88. package/dist/style.css +1213 -18
  89. package/dist/subgraphs/index.d.ts +1 -0
  90. package/dist/subgraphs/index.d.ts.map +1 -1
  91. package/dist/subgraphs/index.js +1 -0
  92. package/dist/subgraphs/integrations/index.d.ts +10 -0
  93. package/dist/subgraphs/integrations/index.d.ts.map +1 -0
  94. package/dist/subgraphs/integrations/index.js +11 -0
  95. package/dist/subgraphs/integrations/resolvers.d.ts +3 -0
  96. package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -0
  97. package/dist/subgraphs/integrations/resolvers.js +89 -0
  98. package/dist/subgraphs/integrations/schema.d.ts +3 -0
  99. package/dist/subgraphs/integrations/schema.d.ts.map +1 -0
  100. package/dist/subgraphs/integrations/schema.js +109 -0
  101. package/package.json +13 -13
@@ -0,0 +1,97 @@
1
+ import { z } from "zod";
2
+ export const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
3
+ export const definedNonNullAnySchema = z
4
+ .any()
5
+ .refine((v) => isDefinedNonNullAny(v));
6
+ export function GnosisSafeSchema() {
7
+ return z.object({
8
+ __typename: z.literal("GnosisSafe").optional(),
9
+ safeAddress: z
10
+ .string()
11
+ .regex(/^0x[a-fA-F0-9]{40}$/, {
12
+ message: "Invalid Ethereum address format",
13
+ })
14
+ .nullable(),
15
+ signerPrivateKey: z.string().nullable(),
16
+ });
17
+ }
18
+ export function GoogleCloudSchema() {
19
+ return z.object({
20
+ __typename: z.literal("GoogleCloud").optional(),
21
+ keyFile: GoogleKeyFileSchema().nullable(),
22
+ location: z.string().nullable(),
23
+ processorId: z.string().nullable(),
24
+ projectId: z.string().nullable(),
25
+ });
26
+ }
27
+ export function GoogleKeyFileSchema() {
28
+ return z.object({
29
+ __typename: z.literal("GoogleKeyFile").optional(),
30
+ auth_provider_x509_cert_url: z.string().nullable(),
31
+ auth_uri: z.string().nullable(),
32
+ client_email: z.string().nullable(),
33
+ client_id: z.string().nullable(),
34
+ client_x509_cert_url: z.string().nullable(),
35
+ private_key: z.string().nullable(),
36
+ private_key_id: z.string().nullable(),
37
+ project_id: z.string().nullable(),
38
+ token_uri: z.string().nullable(),
39
+ type: z.string().nullable(),
40
+ universe_domain: z.string().nullable(),
41
+ });
42
+ }
43
+ export function GoogleKeyFileInputSchema() {
44
+ return z.object({
45
+ auth_provider_x509_cert_url: z.string().nullish(),
46
+ auth_uri: z.string().nullish(),
47
+ client_email: z.string().nullish(),
48
+ client_id: z.string().nullish(),
49
+ client_x509_cert_url: z.string().nullish(),
50
+ private_key: z.string().nullish(),
51
+ private_key_id: z.string().nullish(),
52
+ project_id: z.string().nullish(),
53
+ token_uri: z.string().nullish(),
54
+ type: z.string().nullish(),
55
+ universe_domain: z.string().nullish(),
56
+ });
57
+ }
58
+ export function IntegrationsStateSchema() {
59
+ return z.object({
60
+ __typename: z.literal("IntegrationsState").optional(),
61
+ gnosisSafe: GnosisSafeSchema().nullable(),
62
+ googleCloud: GoogleCloudSchema().nullable(),
63
+ requestFinance: RequestFinanceSchema().nullable(),
64
+ });
65
+ }
66
+ export function RequestFinanceSchema() {
67
+ return z.object({
68
+ __typename: z.literal("RequestFinance").optional(),
69
+ apiKey: z.string().nullable(),
70
+ email: z.string().nullable(),
71
+ });
72
+ }
73
+ export function SetGnosisSafeInputSchema() {
74
+ return z.object({
75
+ safeAddress: z
76
+ .string()
77
+ .regex(/^0x[a-fA-F0-9]{40}$/, {
78
+ message: "Invalid Ethereum address format",
79
+ })
80
+ .nullish(),
81
+ signerPrivateKey: z.string().nullish(),
82
+ });
83
+ }
84
+ export function SetGoogleCloudInputSchema() {
85
+ return z.object({
86
+ keyFile: z.lazy(() => GoogleKeyFileInputSchema().nullish()),
87
+ location: z.string().nullish(),
88
+ processorId: z.string().nullish(),
89
+ projectId: z.string().nullish(),
90
+ });
91
+ }
92
+ export function SetRequestFinanceInputSchema() {
93
+ return z.object({
94
+ apiKey: z.string().nullish(),
95
+ email: z.string().nullish(),
96
+ });
97
+ }
@@ -0,0 +1,10 @@
1
+ import type { PHDocument, ExtendedState } from "document-model";
2
+ import type { IntegrationsState } from "./schema/types.js";
3
+ import type { IntegrationsAction } from "./actions.js";
4
+ export { z } from "./schema/index.js";
5
+ export type * from "./schema/types.js";
6
+ type IntegrationsLocalState = Record<PropertyKey, never>;
7
+ export type ExtendedIntegrationsState = ExtendedState<IntegrationsState, IntegrationsLocalState>;
8
+ export type IntegrationsDocument = PHDocument<IntegrationsState, IntegrationsLocalState, IntegrationsAction>;
9
+ export type { IntegrationsState, IntegrationsLocalState, IntegrationsAction };
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../document-models/integrations/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,mBAAmB,mBAAmB,CAAC;AACvC,KAAK,sBAAsB,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACzD,MAAM,MAAM,yBAAyB,GAAG,aAAa,CACnD,iBAAiB,EACjB,sBAAsB,CACvB,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAC3C,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,CACnB,CAAC;AACF,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export { z } from "./schema/index.js";
@@ -0,0 +1,7 @@
1
+ import { type DocumentModelUtils } from "document-model";
2
+ import { type IntegrationsDocument, type IntegrationsState, type IntegrationsLocalState } from "./types.js";
3
+ export declare const initialGlobalState: IntegrationsState;
4
+ export declare const initialLocalState: IntegrationsLocalState;
5
+ declare const utils: DocumentModelUtils<IntegrationsDocument>;
6
+ export default utils;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/integrations/gen/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAQxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,kBAAkB,EAAE,iBA2BhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,sBAA2B,CAAC;AAE5D,QAAA,MAAM,KAAK,EAAE,kBAAkB,CAAC,oBAAoB,CAoCnD,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { baseCreateDocument, baseCreateExtendedState, baseSaveToFile, baseSaveToFileHandle, baseLoadFromFile, baseLoadFromInput, generateId, } from "document-model";
2
+ import { reducer } from "./reducer.js";
3
+ export const initialGlobalState = {
4
+ gnosisSafe: {
5
+ safeAddress: "",
6
+ signerPrivateKey: "",
7
+ },
8
+ googleCloud: {
9
+ projectId: "",
10
+ location: "",
11
+ processorId: "",
12
+ keyFile: {
13
+ type: "",
14
+ project_id: "",
15
+ private_key_id: "",
16
+ private_key: "",
17
+ client_email: "",
18
+ client_id: "",
19
+ auth_uri: "",
20
+ token_uri: "",
21
+ auth_provider_x509_cert_url: "",
22
+ client_x509_cert_url: "",
23
+ universe_domain: "",
24
+ },
25
+ },
26
+ requestFinance: {
27
+ apiKey: "",
28
+ email: "",
29
+ },
30
+ };
31
+ export const initialLocalState = {};
32
+ const utils = {
33
+ fileExtension: ".phdm",
34
+ createState(state) {
35
+ return {
36
+ global: { ...initialGlobalState, ...state?.global },
37
+ local: { ...initialLocalState, ...state?.local },
38
+ };
39
+ },
40
+ createExtendedState(extendedState) {
41
+ return baseCreateExtendedState({ ...extendedState }, utils.createState);
42
+ },
43
+ createDocument(state) {
44
+ const document = baseCreateDocument(utils.createExtendedState(state), utils.createState);
45
+ document.header.documentType = "powerhouse/integrations";
46
+ // for backwards compatibility, but this is NOT a valid signed document id
47
+ document.header.id = generateId();
48
+ return document;
49
+ },
50
+ saveToFile(document, path, name) {
51
+ return baseSaveToFile(document, path, ".phdm", name);
52
+ },
53
+ saveToFileHandle(document, input) {
54
+ return baseSaveToFileHandle(document, input);
55
+ },
56
+ loadFromFile(path) {
57
+ return baseLoadFromFile(path, reducer);
58
+ },
59
+ loadFromInput(input) {
60
+ return baseLoadFromInput(input, reducer);
61
+ },
62
+ };
63
+ export default utils;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This is a scaffold file meant for customization.
3
+ * Delete the file and run the code generator again to have it reset
4
+ */
5
+ import { type DocumentModelModule } from "document-model";
6
+ import { reducer } from "./gen/reducer.js";
7
+ import { documentModel } from "./gen/document-model.js";
8
+ import { type IntegrationsDocument } from "./gen/types.js";
9
+ declare const utils: {
10
+ fileExtension: string;
11
+ createState: import("document-model").CreateState<IntegrationsDocument>;
12
+ createExtendedState: import("document-model").CreateExtendedState<IntegrationsDocument>;
13
+ createDocument: import("document-model").CreateDocument<IntegrationsDocument>;
14
+ loadFromFile: import("document-model").LoadFromFile<IntegrationsDocument>;
15
+ loadFromInput: import("document-model").LoadFromInput<IntegrationsDocument>;
16
+ saveToFile: import("document-model").SaveToFile;
17
+ saveToFileHandle: import("document-model").SaveToFileHandle;
18
+ };
19
+ declare const actions: {
20
+ setRequestFinance: (input: import("./gen/index.js").SetRequestFinanceInput) => import("./gen/index.js").SetRequestFinanceAction;
21
+ setGnosisSafe: (input: import("./gen/index.js").SetGnosisSafeInput) => import("./gen/index.js").SetGnosisSafeAction;
22
+ setGoogleCloud: (input: import("./gen/index.js").SetGoogleCloudInput) => import("./gen/index.js").SetGoogleCloudAction;
23
+ };
24
+ export declare const module: DocumentModelModule<IntegrationsDocument>;
25
+ export { reducer, actions, utils, documentModel };
26
+ export * from "./gen/types.js";
27
+ export * from "./src/utils.js";
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/integrations/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,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,QAAA,MAAM,KAAK;;;;;;;;;CAAkC,CAAC;AAC9C,QAAA,MAAM,OAAO;wBAP6B,sDACf;oBAKX,kDAAwB;qBAOzB,mDAGK;CATsC,CAAC;AAE3D,eAAO,MAAM,MAAM,EAAE,mBAAmB,CAAC,oBAAoB,CAK5D,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAElD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This is a scaffold file meant for customization.
3
+ * Delete the file and run the code generator again to have it reset
4
+ */
5
+ import { actions as BaseActions, } from "document-model";
6
+ import { actions as IntegrationsActions } from "./gen/index.js";
7
+ import { reducer } from "./gen/reducer.js";
8
+ import { documentModel } from "./gen/document-model.js";
9
+ import genUtils from "./gen/utils.js";
10
+ import * as customUtils from "./src/utils.js";
11
+ const utils = { ...genUtils, ...customUtils };
12
+ const actions = { ...BaseActions, ...IntegrationsActions };
13
+ export const module = {
14
+ reducer,
15
+ actions,
16
+ utils,
17
+ documentModel,
18
+ };
19
+ export { reducer, actions, utils, documentModel };
20
+ export * from "./gen/types.js";
21
+ export * from "./src/utils.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - modify it by implementing the reducer functions
4
+ * - delete the file and run the code generator again to have it reset
5
+ */
6
+ import type { IntegrationsIntegrationsOperations } from "../../gen/integrations/operations.js";
7
+ export declare const reducer: IntegrationsIntegrationsOperations;
8
+ //# sourceMappingURL=integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../../../document-models/integrations/src/reducers/integrations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE/F,eAAO,MAAM,OAAO,EAAE,kCAoDrB,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - modify it by implementing the reducer functions
4
+ * - delete the file and run the code generator again to have it reset
5
+ */
6
+ export const reducer = {
7
+ setRequestFinanceOperation(state, action, dispatch) {
8
+ try {
9
+ const requestFinance = {
10
+ apiKey: action.input.apiKey || '',
11
+ email: action.input.email || '',
12
+ };
13
+ state.requestFinance = requestFinance;
14
+ }
15
+ catch (error) {
16
+ console.error(error);
17
+ }
18
+ },
19
+ setGnosisSafeOperation(state, action, dispatch) {
20
+ try {
21
+ const gnosisSafe = {
22
+ safeAddress: action.input.safeAddress || '',
23
+ signerPrivateKey: action.input.signerPrivateKey || '',
24
+ };
25
+ state.gnosisSafe = gnosisSafe;
26
+ }
27
+ catch (error) {
28
+ console.error(error);
29
+ }
30
+ },
31
+ setGoogleCloudOperation(state, action, dispatch) {
32
+ try {
33
+ const googleCloud = {
34
+ projectId: action.input.projectId || '',
35
+ location: action.input.location || '',
36
+ processorId: action.input.processorId || '',
37
+ keyFile: {
38
+ type: action.input.keyFile?.type || '',
39
+ project_id: action.input.keyFile?.project_id || '',
40
+ private_key_id: action.input.keyFile?.private_key_id || '',
41
+ private_key: action.input.keyFile?.private_key || '',
42
+ client_email: action.input.keyFile?.client_email || '',
43
+ client_id: action.input.keyFile?.client_id || '',
44
+ auth_uri: action.input.keyFile?.auth_uri || '',
45
+ token_uri: action.input.keyFile?.token_uri || '',
46
+ auth_provider_x509_cert_url: action.input.keyFile?.auth_provider_x509_cert_url || '',
47
+ client_x509_cert_url: action.input.keyFile?.client_x509_cert_url || '',
48
+ universe_domain: action.input.keyFile?.universe_domain || '',
49
+ },
50
+ };
51
+ state.googleCloud = googleCloud;
52
+ }
53
+ catch (error) {
54
+ console.error(error);
55
+ }
56
+ },
57
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=document-model.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/integrations/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ import { describe, it, expect } from "vitest";
6
+ import utils, { initialGlobalState, initialLocalState, } from "../../gen/utils.js";
7
+ describe("Integrations Document Model", () => {
8
+ it("should create a new Integrations document", () => {
9
+ const document = utils.createDocument();
10
+ expect(document).toBeDefined();
11
+ expect(document.header.documentType).toBe("powerhouse/integrations");
12
+ });
13
+ it("should create a new Integrations document with a valid initial state", () => {
14
+ const document = utils.createDocument();
15
+ expect(document.state.global).toStrictEqual(initialGlobalState);
16
+ expect(document.state.local).toStrictEqual(initialLocalState);
17
+ });
18
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=integrations.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/integrations/src/tests/integrations.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * This is a scaffold file meant for customization:
3
+ * - change it by adding new tests or modifying the existing ones
4
+ */
5
+ import utils from "../../gen/utils.js";
6
+ import { reducer } from "../../gen/reducer.js";
7
+ import * as creators from "../../gen/integrations/creators.js";
8
+ describe("Integrations Operations", () => {
9
+ let document;
10
+ beforeEach(() => {
11
+ document = utils.createDocument();
12
+ });
13
+ it("should handle setRequestFinance operation", () => {
14
+ const input = {
15
+ apiKey: "1234567890",
16
+ email: "test@test.com",
17
+ };
18
+ const updatedDocument = reducer(document, creators.setRequestFinance(input));
19
+ expect(updatedDocument.operations.global).toHaveLength(1);
20
+ expect(updatedDocument.operations.global[0].type).toBe("SET_REQUEST_FINANCE");
21
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
22
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
23
+ expect(updatedDocument.state.global.requestFinance).toStrictEqual(input);
24
+ });
25
+ it("should handle setGnosisSafe operation", () => {
26
+ const input = {
27
+ safeAddress: "0x1234567890abcdef1234567890abcdef12345678",
28
+ signerPrivateKey: "test-private-key-gnosis-safe",
29
+ };
30
+ const updatedDocument = reducer(document, creators.setGnosisSafe(input));
31
+ expect(updatedDocument.operations.global).toHaveLength(1);
32
+ expect(updatedDocument.operations.global[0].type).toBe("SET_GNOSIS_SAFE");
33
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
34
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
35
+ expect(updatedDocument.state.global.gnosisSafe).toStrictEqual(input);
36
+ });
37
+ it("should handle setGoogleCloud operation", () => {
38
+ const input = {
39
+ projectId: "test-project-123",
40
+ location: "us-central1",
41
+ processorId: "processor-abc-123",
42
+ keyFile: {
43
+ type: "service_account",
44
+ project_id: "test-project-123",
45
+ private_key_id: "abcdef1234567890",
46
+ private_key: "-----BEGIN PRIVATE KEY-----\nMIIEv...\n-----END PRIVATE KEY-----\n",
47
+ client_email: "gcloud-user@example.com",
48
+ client_id: "123456789012345678901",
49
+ auth_uri: "https://accounts.google.com/o/oauth2/auth",
50
+ token_uri: "https://oauth2.googleapis.com/token",
51
+ auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
52
+ client_x509_cert_url: "https://www.googleapis.com/robot/v1/metadata/x509/gcloud-user%40example.com",
53
+ universe_domain: "googleapis.com",
54
+ },
55
+ };
56
+ const updatedDocument = reducer(document, creators.setGoogleCloud(input));
57
+ expect(updatedDocument.operations.global).toHaveLength(1);
58
+ expect(updatedDocument.operations.global[0].type).toBe("SET_GOOGLE_CLOUD");
59
+ expect(updatedDocument.operations.global[0].input).toStrictEqual(input);
60
+ expect(updatedDocument.operations.global[0].index).toEqual(0);
61
+ expect(updatedDocument.state.global.googleCloud).toStrictEqual(input);
62
+ });
63
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/integrations/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
- export declare const HeaderControls: ({ contributorOptions, statusOptions, onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses, }: {
1
+ import { UiFileNode } from "@powerhousedao/design-system";
2
+ export declare const HeaderControls: ({ contributorOptions, statusOptions, onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses, createIntegrationsDocument, integrationsDoc, setActiveDocumentId }: {
2
3
  contributorOptions?: {
3
4
  label: string;
4
5
  value: string;
@@ -13,5 +14,8 @@ export declare const HeaderControls: ({ contributorOptions, statusOptions, onCon
13
14
  onExport?: (baseCurrency: string) => void;
14
15
  onBatchAction?: (action: string) => void;
15
16
  selectedStatuses?: string[];
17
+ createIntegrationsDocument?: () => void;
18
+ integrationsDoc?: UiFileNode | null;
19
+ setActiveDocumentId?: (id: string) => void;
16
20
  }) => import("react/jsx-runtime").JSX.Element;
17
21
  //# sourceMappingURL=HeaderControls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,GAAI,wIAS5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,4CA2IA,CAAC"}
1
+ {"version":3,"file":"HeaderControls.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/HeaderControls.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAQ,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAWhE,eAAO,MAAM,cAAc,GAAI,yMAY5B;IACD,kBAAkB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,4CAgKA,CAAC"}
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { Select } from "@powerhousedao/document-engineering";
4
4
  import ConfirmationModal from "../../../invoice/components/confirmationModal.js";
5
+ import { Icon } from "@powerhousedao/design-system";
5
6
  const currencyOptions = [
6
7
  { label: "CHF", value: "CHF" },
7
8
  { label: "USD", value: "USD" },
@@ -9,7 +10,7 @@ const currencyOptions = [
9
10
  { label: "GBP", value: "GBP" },
10
11
  { label: "JPY", value: "JPY" },
11
12
  ];
12
- export const HeaderControls = ({ contributorOptions = [], statusOptions = [], onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses = [], }) => {
13
+ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], onContributorChange, onStatusChange, onSearchChange, onExport, onBatchAction, selectedStatuses = [], createIntegrationsDocument, integrationsDoc, setActiveDocumentId }) => {
13
14
  const batchOptions = [
14
15
  { label: "$ Pay Selected", value: "pay" },
15
16
  { label: "Approve Selected", value: "approve" },
@@ -22,7 +23,7 @@ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], on
22
23
  "PAYMENTSCHEDULED",
23
24
  "PAYMENTSENT",
24
25
  "PAYMENTRECEIVED",
25
- "PAYMENTCLOSED"
26
+ "PAYMENTCLOSED",
26
27
  ];
27
28
  const canExport = selectedStatuses.length > 0 &&
28
29
  selectedStatuses.every((status) => allowedStatuses.includes(status));
@@ -31,7 +32,15 @@ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], on
31
32
  return (_jsxs("div", { className: "flex flex-col gap-4 mb-4", children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsx("h3", { className: "text-lg font-bold", children: "Powerhouse OH Admin Drive" }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx("button", { className: `bg-white border border-gray-300 rounded px-3 py-1 text-sm hover:bg-gray-100 ${!canExport ? "opacity-50 cursor-not-allowed" : ""}`, onClick: () => setShowCurrencyModal(true), disabled: !canExport, children: "Export to CSV" }), _jsx(Select, { style: {
32
33
  width: "180px",
33
34
  height: "30px",
34
- }, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" })] })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
35
+ }, options: batchOptions, onChange: (value) => onBatchAction?.(value), placeholder: "Batch Action", selectionIcon: "checkmark" }), _jsx("div", { className: "cursor-pointer", children: _jsx(Icon, { name: "Settings", className: "hover:text-blue-300", onClick: () => {
36
+ console.log("Settings");
37
+ if (!integrationsDoc) {
38
+ createIntegrationsDocument?.();
39
+ }
40
+ else {
41
+ setActiveDocumentId?.(integrationsDoc.id);
42
+ }
43
+ } }) })] })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Select, { style: {
35
44
  width: "200px",
36
45
  height: "30px",
37
46
  }, options: statusOptions, onChange: onStatusChange, placeholder: "Status", selectionIcon: "checkmark", multiple: true }), _jsx("input", { type: "text", className: "border rounded px-2 py-1 text-sm", placeholder: "Search", onChange: (e) => onSearchChange?.(e.target.value) })] }), showCurrencyModal && (_jsx("div", { className: "fixed inset-0", children: _jsxs("div", { className: "absolute left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 bg-white rounded shadow-lg p-6 min-w-[300px] flex flex-col items-center", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Select Base Currency" }), _jsx("p", { className: "text-red-600 text-sm mb-2", children: "Chosen currency should match the base currency of the accounting." }), _jsx("select", { className: "border border-gray-300 rounded px-2 py-1 mb-4", value: selectedCurrency, onChange: (e) => setSelectedCurrency(e.target.value), children: currencyOptions.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { className: "bg-blue-600 text-white px-4 py-1 rounded hover:bg-blue-700", onClick: () => {
@@ -40,5 +49,10 @@ export const HeaderControls = ({ contributorOptions = [], statusOptions = [], on
40
49
  }, children: "Export" }), _jsx("button", { className: "bg-gray-200 px-4 py-1 rounded hover:bg-gray-300", onClick: () => setShowCurrencyModal(false), children: "Cancel" })] })] }) })), _jsxs(ConfirmationModal, { open: showCurrencyModal, onCancel: () => setShowCurrencyModal(false), onContinue: () => {
41
50
  setShowCurrencyModal(false);
42
51
  onExport?.(selectedCurrency);
43
- }, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: [_jsx("p", { style: { color: 'red', marginTop: '1rem', marginBottom: '1rem', fontWeight: 500 }, children: "\u26A0 Warning: the chosen currency should match the base currency of the accounting system." }), _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" })] })] }));
52
+ }, header: "Select Base Currency", continueLabel: "Export", cancelLabel: "Cancel", children: [_jsx("p", { style: {
53
+ color: "red",
54
+ marginTop: "1rem",
55
+ marginBottom: "1rem",
56
+ fontWeight: 500,
57
+ }, children: "\u26A0 Warning: the chosen currency should match the base currency of the accounting system." }), _jsx(Select, { options: currencyOptions, onChange: (value) => setSelectedCurrency(value), placeholder: "Select Base Currency" })] })] }));
44
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8CAA8C,CAAC;AActD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,GAAI,0LAc1B,iBAAiB,4CA2pBnB,CAAC"}
1
+ {"version":3,"file":"InvoiceTable.d.ts","sourceRoot":"","sources":["../../../../../editors/contributor-billing/components/InvoiceTable/InvoiceTable.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8CAA8C,CAAC;AActD,UAAU,iBAAiB;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACpC,WAAW,EAAE,CACX,QAAQ,EACJ;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACzB,CAAC,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,KAAK;QAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,qBAAqB,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC5D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,GAAI,0LAc1B,iBAAiB,4CAwqBnB,CAAC"}
@@ -228,7 +228,15 @@ export const InvoiceTable = ({ files, state, setActiveDocumentId, getDispatch, s
228
228
  toast(_jsxs(_Fragment, { children: ["Invoice Line Item Tags need to be set for:", _jsx("br", {}), missingExpenseTagInvoicesList.map((name, idx) => (_jsxs(React.Fragment, { children: ["- ", name, _jsx("br", {})] }, name)))] }), { type: "error" });
229
229
  }
230
230
  };
231
- return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction, onExport: handleCSVExport, selectedStatuses: selectedInvoiceStatuses }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
231
+ // check if integrations document exists
232
+ const integrationsDoc = files.find(file => file.documentType === "powerhouse/integrations");
233
+ const createIntegrationsDocument = () => {
234
+ const integrationsDocument = filteredDocumentModels?.find(model => model.documentModel.id === "powerhouse/integrations");
235
+ if (integrationsDocument) {
236
+ onSelectDocumentModel(integrationsDocument);
237
+ }
238
+ };
239
+ return (_jsxs("div", { className: "w-full h-full bg-white rounded-lg p-4 border border-gray-200 shadow-md mt-4 overflow-x-auto", children: [_jsx(HeaderControls, { statusOptions: statusOptions, onStatusChange: handleStatusChange, onBatchAction: onBatchAction, onExport: handleCSVExport, selectedStatuses: selectedInvoiceStatuses, createIntegrationsDocument: createIntegrationsDocument, integrationsDoc: integrationsDoc, setActiveDocumentId: setActiveDocumentId }), shouldShowSection("DRAFT") && (_jsx(InvoiceTableSection, { title: "Draft", count: draft.length, onSelectDocumentModel: onSelectDocumentModel, filteredDocumentModels: filteredDocumentModels, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: draft.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
232
240
  ...prev,
233
241
  [row.id]: checked,
234
242
  })), setActiveDocumentId: setActiveDocumentId, onDeleteNode: handleDelete, renameNode: renameNode }, row.id))) })] }) })), shouldShowSection("ISSUED") && (_jsx(InvoiceTableSection, { title: "Issued", count: issued.length, children: _jsxs("table", { className: "w-full text-sm border-separate border-spacing-0 border border-gray-400", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-gray-50", children: [_jsx("th", { className: "px-2 py-2 w-8" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issuer" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Invoice No." }), _jsx("th", { className: "px-2 py-2 text-center", children: "Issue Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Due Date" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Currency" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Amount" }), _jsx("th", { className: "px-2 py-2 text-center", children: "Billing Statement" }), _jsx("th", { className: "px-2 py-2", children: "Exported" })] }) }), _jsx("tbody", { children: issued.map((row) => (_jsx(InvoiceTableRow, { files: files, row: row, isSelected: !!selected[row.id], onSelect: (checked) => setSelected((prev) => ({
@@ -1,4 +1,5 @@
1
1
  export { module as Invoice } from "./invoice/index.js";
2
2
  export { module as ContributorBilling } from "./contributor-billing/index.js";
3
3
  export { module as BillingStatement } from "./billing-statement/index.js";
4
+ export { module as Integrations } from "./integrations/index.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { module as Invoice } from "./invoice/index.js";
2
2
  export { module as ContributorBilling } from "./contributor-billing/index.js";
3
3
  export { module as BillingStatement } from "./billing-statement/index.js";
4
+ export { module as Integrations } from "./integrations/index.js";
@@ -0,0 +1,5 @@
1
+ import type { EditorProps } from "document-model";
2
+ import { type IntegrationsDocument } from "../../document-models/integrations/index.js";
3
+ export type IProps = EditorProps<IntegrationsDocument>;
4
+ export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/integrations/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,6CAA6C,CAAC;AAIrD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAQvD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAsT3C"}