@deenruv/wfirma-plugin 1.0.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 (64) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +45 -0
  3. package/dist/plugin-server/api/wfirma-admin.resolver.d.ts +13 -0
  4. package/dist/plugin-server/api/wfirma-admin.resolver.js +40 -0
  5. package/dist/plugin-server/constants.d.ts +12 -0
  6. package/dist/plugin-server/constants.js +31 -0
  7. package/dist/plugin-server/extensions/wfirma.extension.d.ts +1 -0
  8. package/dist/plugin-server/extensions/wfirma.extension.js +19 -0
  9. package/dist/plugin-server/helpers/fetch-wfirma-api.d.ts +3 -0
  10. package/dist/plugin-server/helpers/fetch-wfirma-api.js +75 -0
  11. package/dist/plugin-server/helpers/types.d.ts +349 -0
  12. package/dist/plugin-server/helpers/types.js +2 -0
  13. package/dist/plugin-server/index.d.ts +7 -0
  14. package/dist/plugin-server/index.js +56 -0
  15. package/dist/plugin-server/services/wfirma.service.d.ts +15 -0
  16. package/dist/plugin-server/services/wfirma.service.js +246 -0
  17. package/dist/plugin-server/types.d.ts +7 -0
  18. package/dist/plugin-server/types.js +2 -0
  19. package/dist/plugin-server/ui/components/ProformaInvoiceActionButton.ts +48 -0
  20. package/dist/plugin-server/ui/components/RecipeInvoiceActionButton.ts +48 -0
  21. package/dist/plugin-server/ui/graphql/mutations.ts +14 -0
  22. package/dist/plugin-server/ui/graphql/queries.ts +7 -0
  23. package/dist/plugin-server/ui/graphql/scalars.ts +15 -0
  24. package/dist/plugin-server/ui/graphql/selectors.ts +0 -0
  25. package/dist/plugin-server/ui/providers.ts +13 -0
  26. package/dist/plugin-server/ui/routes.ts +1 -0
  27. package/dist/plugin-server/ui/styles/overwrite.css +0 -0
  28. package/dist/plugin-server/ui/zeus/const.ts +4767 -0
  29. package/dist/plugin-server/ui/zeus/index.ts +21694 -0
  30. package/dist/plugin-server/ui/zeus/typedDocumentNode.ts +27 -0
  31. package/dist/plugin-server/zeus/const.d.ts +6 -0
  32. package/dist/plugin-server/zeus/const.js +3698 -0
  33. package/dist/plugin-server/zeus/index.d.ts +18878 -0
  34. package/dist/plugin-server/zeus/index.js +1094 -0
  35. package/dist/plugin-server/zeus/typedDocumentNode.d.ts +3 -0
  36. package/dist/plugin-server/zeus/typedDocumentNode.js +13 -0
  37. package/dist/plugin-ui/components/WFirmaButtons.d.ts +2 -0
  38. package/dist/plugin-ui/components/WFirmaButtons.js +66 -0
  39. package/dist/plugin-ui/graphql/mutations.d.ts +10 -0
  40. package/dist/plugin-ui/graphql/mutations.js +10 -0
  41. package/dist/plugin-ui/graphql/queries.d.ts +1 -0
  42. package/dist/plugin-ui/graphql/queries.js +4 -0
  43. package/dist/plugin-ui/graphql/scalars.d.ts +13 -0
  44. package/dist/plugin-ui/graphql/scalars.js +14 -0
  45. package/dist/plugin-ui/graphql/selectors.d.ts +0 -0
  46. package/dist/plugin-ui/graphql/selectors.js +1 -0
  47. package/dist/plugin-ui/index.d.ts +1 -0
  48. package/dist/plugin-ui/index.js +14 -0
  49. package/dist/plugin-ui/locales/en/index.d.ts +5 -0
  50. package/dist/plugin-ui/locales/en/index.js +2 -0
  51. package/dist/plugin-ui/locales/en/wfirma.json +4 -0
  52. package/dist/plugin-ui/locales/pl/index.d.ts +5 -0
  53. package/dist/plugin-ui/locales/pl/index.js +2 -0
  54. package/dist/plugin-ui/locales/pl/wfirma.json +4 -0
  55. package/dist/plugin-ui/translation-ns.d.ts +1 -0
  56. package/dist/plugin-ui/translation-ns.js +1 -0
  57. package/dist/plugin-ui/tsconfig.json +18 -0
  58. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  59. package/dist/plugin-ui/zeus/const.js +3695 -0
  60. package/dist/plugin-ui/zeus/index.d.ts +18878 -0
  61. package/dist/plugin-ui/zeus/index.js +1086 -0
  62. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  63. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  64. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ # License 1
2
+
3
+ The MIT License
4
+
5
+ Copyright (c) 2025-present Aexol
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+
13
+ # License 2
14
+
15
+ The MIT License
16
+
17
+ Copyright (c) 2018-2025 Michael Bromley
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @deenruv/wfirma-plugin
2
+
3
+ An invoicing plugin that integrates the [wFirma](https://wfirma.pl/) Polish accounting platform with your Deenruv server, enabling automatic invoice generation for orders.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @deenruv/wfirma-plugin
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ ```typescript
14
+ import { WFirmaPlugin } from '@deenruv/wfirma-plugin';
15
+
16
+ // In your Deenruv server config:
17
+ plugins: [
18
+ WFirmaPlugin.init({
19
+ authorization: {
20
+ accessKey: process.env.WFIRMA_ACCESS_KEY,
21
+ secretKey: process.env.WFIRMA_SECRET_KEY,
22
+ appKey: process.env.WFIRMA_APP_KEY,
23
+ },
24
+ }),
25
+ ]
26
+ ```
27
+
28
+ ## Features
29
+
30
+ - Integration with the wFirma accounting API
31
+ - Automatic invoice generation for orders
32
+ - Custom `wfirmaInvoiceId` field on orders to track linked invoices
33
+ - Admin API for triggering invoice operations
34
+ - Admin UI extension with invoice action buttons on order detail pages
35
+
36
+ ## Admin UI
37
+
38
+ This plugin extends the admin UI with wFirma integration controls, including invoice generation buttons on order detail pages, invoice status display, and custom styling overrides. The UI supports both English and Polish translations.
39
+
40
+ ## API Extensions
41
+
42
+ The plugin extends the **Admin API** with:
43
+
44
+ - Mutations for generating wFirma invoices for orders
45
+ - Queries for retrieving invoice status and details
@@ -0,0 +1,13 @@
1
+ import { RequestContext } from "@deenruv/core";
2
+ import { WFirmaService } from "../services/wfirma.service";
3
+ import { ResolverInputTypes } from "../zeus";
4
+ export declare class WFirmaAdminResolver {
5
+ private wFirmaService;
6
+ constructor(wFirmaService: WFirmaService);
7
+ sendInvoiceToWFirma(ctx: RequestContext, args: {
8
+ input: ResolverInputTypes["SendInvoiceToWFirmaInput"];
9
+ }): Promise<{
10
+ __typename: "WFirmaResponse";
11
+ url: string;
12
+ } | null>;
13
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.WFirmaAdminResolver = void 0;
16
+ const graphql_1 = require("@nestjs/graphql");
17
+ const core_1 = require("@deenruv/core");
18
+ const wfirma_service_1 = require("../services/wfirma.service");
19
+ let WFirmaAdminResolver = class WFirmaAdminResolver {
20
+ constructor(wFirmaService) {
21
+ this.wFirmaService = wFirmaService;
22
+ }
23
+ async sendInvoiceToWFirma(ctx, args) {
24
+ return await this.wFirmaService.createInvoice(ctx, args.input);
25
+ }
26
+ };
27
+ exports.WFirmaAdminResolver = WFirmaAdminResolver;
28
+ __decorate([
29
+ (0, core_1.Transaction)(),
30
+ (0, graphql_1.Mutation)(),
31
+ __param(0, (0, core_1.Ctx)()),
32
+ __param(1, (0, graphql_1.Args)()),
33
+ __metadata("design:type", Function),
34
+ __metadata("design:paramtypes", [core_1.RequestContext, Object]),
35
+ __metadata("design:returntype", Promise)
36
+ ], WFirmaAdminResolver.prototype, "sendInvoiceToWFirma", null);
37
+ exports.WFirmaAdminResolver = WFirmaAdminResolver = __decorate([
38
+ (0, graphql_1.Resolver)(),
39
+ __metadata("design:paramtypes", [wfirma_service_1.WFirmaService])
40
+ ], WFirmaAdminResolver);
@@ -0,0 +1,12 @@
1
+ import { WFirmaTypes } from "./helpers/types";
2
+ export declare const PLUGIN_INIT_OPTIONS: unique symbol;
3
+ export declare const HOST = "https://api2.wfirma.pl";
4
+ export declare const COMPANY_ID = "Aleksander";
5
+ export declare const DATA_FORMAT = "json";
6
+ export declare const QUERY_PARAMS = "?outputFormat=json&inputFormat=json";
7
+ type ENDPOINTS = Record<keyof WFirmaTypes, {
8
+ method: string;
9
+ url: string;
10
+ }>;
11
+ export declare const ENDPOINTS: ENDPOINTS;
12
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENDPOINTS = exports.QUERY_PARAMS = exports.DATA_FORMAT = exports.COMPANY_ID = exports.HOST = exports.PLUGIN_INIT_OPTIONS = void 0;
4
+ exports.PLUGIN_INIT_OPTIONS = Symbol("WFIRMA_PLUGIN_OPTIONS");
5
+ exports.HOST = "https://api2.wfirma.pl";
6
+ exports.COMPANY_ID = "Aleksander";
7
+ exports.DATA_FORMAT = "json";
8
+ exports.QUERY_PARAMS = `?outputFormat=${exports.DATA_FORMAT}&inputFormat=${exports.DATA_FORMAT}`;
9
+ exports.ENDPOINTS = {
10
+ "add-invoice": { method: "POST", url: `${exports.HOST}/invoices/add${exports.QUERY_PARAMS}` },
11
+ "find-invoice": {
12
+ method: "GET",
13
+ url: `${exports.HOST}/invoices/find${exports.QUERY_PARAMS}`,
14
+ },
15
+ "get-invoice": {
16
+ method: "GET",
17
+ url: `${exports.HOST}/invoices/get/{{INVOICE_ID}}${exports.QUERY_PARAMS}`,
18
+ },
19
+ "download-invoice": {
20
+ method: "POST",
21
+ url: `${exports.HOST}/invoices/download/{{INVOICE_ID}}${exports.QUERY_PARAMS}`,
22
+ },
23
+ "find-contractor": {
24
+ method: "GET",
25
+ url: `${exports.HOST}/contractors/find${exports.QUERY_PARAMS}`,
26
+ },
27
+ "add-contractor": {
28
+ method: "POST",
29
+ url: `${exports.HOST}/contractors/add${exports.QUERY_PARAMS}`,
30
+ },
31
+ };
@@ -0,0 +1 @@
1
+ export declare const WFirmaAdminExtension: import("graphql").DocumentNode;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WFirmaAdminExtension = void 0;
7
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
+ exports.WFirmaAdminExtension = (0, graphql_tag_1.default) `
9
+ type WFirmaResponse {
10
+ url: String!
11
+ }
12
+ input SendInvoiceToWFirmaInput {
13
+ orderID: String!
14
+ invoiceType: String!
15
+ }
16
+ extend type Mutation {
17
+ sendInvoiceToWFirma(input: SendInvoiceToWFirmaInput!): WFirmaResponse
18
+ }
19
+ `;
@@ -0,0 +1,3 @@
1
+ import { WFirmaTypes } from "./types";
2
+ import { WFirmaPluginConfig } from "../types";
3
+ export declare const fetchWFirmaAPI: (authorization: WFirmaPluginConfig["authorization"]) => <T extends keyof WFirmaTypes>(endpoint: T, data: WFirmaTypes[T]["input"], invoiceID?: string) => Promise<WFirmaTypes[T]["return"] | null>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchWFirmaAPI = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const constants_1 = require("../constants");
9
+ const core_1 = require("@deenruv/core");
10
+ const API_RETURN_CODES = {
11
+ UNKNOWN: "Nieznany błąd połączenia",
12
+ OK: "Operacja zakończona sukcesem",
13
+ "ACCESS DENIED": "Odmowa dostępu",
14
+ "ACTION NOT FOUND": "Akcja nie znaleziona",
15
+ AUTH: "Bład autoryzacji",
16
+ "AUTH FAILED LIMIT WAIT 5 MINUTES": "Błąd autoryzacji. Przekroczono limit prób. Odczekaj 5 minut",
17
+ "COMPANY ID REQUIRED": "Wymagane jest podanie identyfikatora firmy",
18
+ "DENIED SCOPE REQUESTED": "Odmowa dostępu do zasobu",
19
+ ERROR: "Błąd zapytania",
20
+ FATAL: "Błąd krytyczny",
21
+ "INPUT ERROR": "Błąd wejścia",
22
+ "NOT FOUND": "Nie znaleziono",
23
+ "OUT OF SERVICE": "Serwis niedostępny",
24
+ "SNAPSHOT LOCK": "Błąd blokady",
25
+ "TOTAL REQUESTS LIMIT EXCEEDED": "Przekroczono limit żądań",
26
+ "TOTAL EXECUTION TIME LIMIT EXCEEDED": "Przekroczono limit czasu wykonania",
27
+ };
28
+ const buildAxiosHeaders = (authHeaders) => {
29
+ const headers = {
30
+ "Content-Type": "application/json",
31
+ };
32
+ Object.entries(authHeaders).forEach(([key, value]) => {
33
+ headers[key] = value;
34
+ });
35
+ return headers;
36
+ };
37
+ const fetchWithBackoff = async (config) => {
38
+ const backoff = [1000, 3000, 5000, 10000];
39
+ let response;
40
+ for (const delay of backoff) {
41
+ try {
42
+ response = await (0, axios_1.default)(config);
43
+ break;
44
+ }
45
+ catch (error) {
46
+ await new Promise((resolve) => setTimeout(resolve, delay));
47
+ }
48
+ }
49
+ return response;
50
+ };
51
+ const fetchWFirmaAPI = (authorization) => async (endpoint, data, invoiceID) => {
52
+ const { method, url } = constants_1.ENDPOINTS[endpoint];
53
+ const correctUrl = invoiceID
54
+ ? url.replace("{{INVOICE_ID}}", invoiceID)
55
+ : url;
56
+ const responseType = url.includes("/download") ? "stream" : "json";
57
+ try {
58
+ const response = await fetchWithBackoff({
59
+ url: correctUrl,
60
+ method,
61
+ headers: buildAxiosHeaders(authorization),
62
+ data: JSON.stringify(data),
63
+ responseType,
64
+ });
65
+ if (!response || response.statusText != "OK")
66
+ throw new Error(API_RETURN_CODES["UNKNOWN"]);
67
+ core_1.Logger.info(`WFirma API response: ${JSON.stringify(response.data)}`, "fetchWFirmaAPI");
68
+ return response.data;
69
+ }
70
+ catch (error) {
71
+ core_1.Logger.error(`WFirma API error: ${error}`, "fetchWFirmaAPI");
72
+ return null;
73
+ }
74
+ };
75
+ exports.fetchWFirmaAPI = fetchWFirmaAPI;
@@ -0,0 +1,349 @@
1
+ export type Contractor = {
2
+ id?: string;
3
+ name?: string;
4
+ altname?: string;
5
+ tax_id_type?: "nip" | "vat" | "pesel" | "regon" | "custom" | "none";
6
+ nip?: string;
7
+ regon?: string;
8
+ street?: string;
9
+ zip?: string;
10
+ city?: string;
11
+ country?: string;
12
+ diffrent_contact_address?: boolean;
13
+ contact_name?: string;
14
+ contact_street?: string;
15
+ contact_zip?: string;
16
+ contact_city?: string;
17
+ contact_country?: string;
18
+ contact_person?: string;
19
+ phone?: string;
20
+ skype?: string;
21
+ fax?: string;
22
+ email?: string;
23
+ url?: string;
24
+ description?: string;
25
+ buyer?: boolean;
26
+ seller?: boolean;
27
+ account_number?: string;
28
+ discount_percent?: string;
29
+ payment_days?: string;
30
+ payment_method?: string;
31
+ remind?: boolean;
32
+ hash?: string;
33
+ notes?: string;
34
+ documents?: string;
35
+ tags?: string;
36
+ };
37
+ type InvoiceContent = {
38
+ id?: string;
39
+ name: string;
40
+ classification?: string;
41
+ unit?: string;
42
+ count: string;
43
+ price: string;
44
+ discount?: boolean;
45
+ discount_percent?: string;
46
+ netto?: string;
47
+ brutto?: string;
48
+ vat?: string;
49
+ lumpcode?: number;
50
+ };
51
+ export type InvoiceType = "normal" | "margin" | "proforma" | "offer" | "receipt_normal" | "receipt_fiscal_normal" | "income_normal" | "bill" | "proforma_bill" | "offer_bill" | "receipt_bill" | "receipt_fiscal_bill" | "income_bill";
52
+ export type AddInvoiceInput = {
53
+ invoices: {
54
+ invoice: {
55
+ type: string;
56
+ type_of_sale: "WSTO_EE";
57
+ contractor: Contractor;
58
+ invoicecontents: Array<{
59
+ invoicecontent: InvoiceContent;
60
+ }>;
61
+ price_type: "netto" | "brutto";
62
+ };
63
+ }[];
64
+ };
65
+ interface VatContent {
66
+ id: string;
67
+ object_name: string;
68
+ object_id: string;
69
+ netto: string;
70
+ tax: string;
71
+ brutto: string;
72
+ created: string;
73
+ vat_code: {
74
+ id: number;
75
+ };
76
+ }
77
+ interface ContractorDetail {
78
+ id: string;
79
+ tax_id_type: string;
80
+ name: string;
81
+ nip: string;
82
+ street: string;
83
+ zip: string;
84
+ city: string;
85
+ country: string;
86
+ phone: string;
87
+ email: string;
88
+ account_number: string;
89
+ affiliated_entity: string;
90
+ discount_percent: string;
91
+ empty: string;
92
+ simple: string;
93
+ created: string;
94
+ modified: string;
95
+ }
96
+ interface CompanyDetail {
97
+ id: string;
98
+ name: string;
99
+ altname: string;
100
+ nip: string;
101
+ bdo: string;
102
+ street: string;
103
+ building_number: string;
104
+ flat_number: string;
105
+ zip: string;
106
+ post: string;
107
+ city: string;
108
+ country: string;
109
+ phone: string;
110
+ email: string;
111
+ bank_name: string;
112
+ bank_account: string;
113
+ bank_swift: string;
114
+ bank_address: string;
115
+ created: string;
116
+ modified: string;
117
+ }
118
+ export interface Invoice {
119
+ id: string;
120
+ interest_status: string;
121
+ warehouse_type: string;
122
+ paymentmethod: string;
123
+ paymentdate: string;
124
+ paymentstate: string;
125
+ disposaldate_format: string;
126
+ disposaldate_empty: string;
127
+ disposaldate: string;
128
+ date: string;
129
+ total: string;
130
+ total_composed: string;
131
+ alreadypaid: string;
132
+ alreadypaid_initial: string;
133
+ remaining: string;
134
+ number: string;
135
+ day: string;
136
+ month: string;
137
+ year: string;
138
+ day_year: string;
139
+ fullnumber: string;
140
+ semitemplatenumber: string;
141
+ type: string;
142
+ correction_type: string;
143
+ register_vat_book: string;
144
+ register_tax_book: string;
145
+ simplified_invoice: string;
146
+ corrections: string;
147
+ formal_data_corrections: string;
148
+ formal_data_corrections_note: string;
149
+ currency: string;
150
+ currency_exchange: string;
151
+ currency_label: string;
152
+ currency_date: string;
153
+ price_currency_exchange: string;
154
+ type_of_sale: string;
155
+ auto_send_postivo: string;
156
+ auto_send: string;
157
+ auto_sms: string;
158
+ account_type: string;
159
+ account_date: string;
160
+ final_account_invoice_contents: string;
161
+ template: string;
162
+ description: string;
163
+ header: string;
164
+ footer: string;
165
+ user_name: string;
166
+ schema: string;
167
+ schema_vat_cashbox: string;
168
+ schema_vat_cashbox_limit: string;
169
+ schema_vat_cashbox_small_taxpayer: string;
170
+ schema_bill: string;
171
+ schema_receipt_book: string;
172
+ schema_cancelled: string;
173
+ margin_tax_schema: string;
174
+ margin_description_schema: string;
175
+ register_description: string;
176
+ income_lumpcode: string;
177
+ income_correction: string;
178
+ bill_legal_description: string;
179
+ netto: string;
180
+ netto_service: string;
181
+ netto_good: string;
182
+ tax: string;
183
+ receipt_fiscal_printed: string;
184
+ receipt_fiscal_fiscalization: string;
185
+ ledger_auto: string;
186
+ hash: string;
187
+ id_external: string;
188
+ client_accept: string;
189
+ tags: string;
190
+ notes: string;
191
+ documents: string;
192
+ created: string;
193
+ modified: string;
194
+ price_type: string;
195
+ series: {
196
+ id: number;
197
+ };
198
+ contractor: {
199
+ id: string;
200
+ altname: string;
201
+ phone: string;
202
+ email: string;
203
+ };
204
+ contractor_detail: ContractorDetail;
205
+ contractor_receiver: {
206
+ id: number;
207
+ };
208
+ contractor_detail_receiver: {
209
+ id: number;
210
+ };
211
+ company_detail: CompanyDetail;
212
+ parent: {
213
+ id: number;
214
+ };
215
+ order: {
216
+ id: number;
217
+ };
218
+ email: {
219
+ id: number;
220
+ };
221
+ email2: {
222
+ id: number;
223
+ };
224
+ invoice_pef_document: {
225
+ id: number;
226
+ };
227
+ expense: {
228
+ id: number;
229
+ };
230
+ ledger_operation_schema: {
231
+ id: number;
232
+ };
233
+ company_account: {
234
+ id: number;
235
+ };
236
+ payment_cashbox: {
237
+ id: number;
238
+ };
239
+ translation_language: {
240
+ id: number;
241
+ };
242
+ postivo_shipment: {
243
+ id: number;
244
+ };
245
+ postivo_shipment_content: {
246
+ id: number;
247
+ };
248
+ warehouse: {
249
+ id: number;
250
+ };
251
+ good_price_group: {
252
+ id: number;
253
+ };
254
+ vat_contents: {
255
+ [key: string]: VatContent;
256
+ };
257
+ invoicecontents: {
258
+ [key: string]: InvoiceContent;
259
+ };
260
+ }
261
+ type FindInvoiceInput = {
262
+ invoices: {
263
+ parameters: {
264
+ limit: number;
265
+ page: number;
266
+ fields: {
267
+ field: keyof Invoice;
268
+ }[];
269
+ conditions: {
270
+ condition: {
271
+ field: keyof Invoice;
272
+ operator: "eq" | "ne" | "gt" | "lt" | "ge" | "le" | "like" | "not like" | "in" | "is null" | "is not null";
273
+ value: string;
274
+ };
275
+ }[];
276
+ };
277
+ };
278
+ };
279
+ export type FindContractorInput = {
280
+ contractors: {
281
+ parameters: {
282
+ limit: number;
283
+ page: number;
284
+ fields: {
285
+ field: keyof Contractor;
286
+ }[];
287
+ conditions: {
288
+ condition: {
289
+ field: keyof Contractor;
290
+ operator: "eq" | "ne" | "gt" | "lt" | "ge" | "le" | "like" | "not like" | "in" | "is null" | "is not null";
291
+ value: string;
292
+ };
293
+ }[];
294
+ };
295
+ };
296
+ };
297
+ export type AddContractorInput = {
298
+ contractors: {
299
+ contractor: Contractor;
300
+ }[];
301
+ };
302
+ export type DownloadInvoiceInput = {
303
+ invoices: {
304
+ parameters: {
305
+ page: string;
306
+ };
307
+ };
308
+ };
309
+ type Contractors = Record<string, {
310
+ contractor: Contractor;
311
+ }>;
312
+ type Invoices = Record<string, {
313
+ invoice: Invoice;
314
+ }>;
315
+ export type WFirmaTypes = {
316
+ "add-invoice": {
317
+ input: AddInvoiceInput;
318
+ return: {
319
+ invoices: Invoices;
320
+ };
321
+ };
322
+ "find-invoice": {
323
+ input: FindInvoiceInput;
324
+ return: {};
325
+ };
326
+ "get-invoice": {
327
+ input: {
328
+ id: string;
329
+ };
330
+ return: {};
331
+ };
332
+ "download-invoice": {
333
+ input: DownloadInvoiceInput;
334
+ return: any;
335
+ };
336
+ "find-contractor": {
337
+ input: FindContractorInput;
338
+ return: {
339
+ contractors: Contractors;
340
+ };
341
+ };
342
+ "add-contractor": {
343
+ input: AddContractorInput;
344
+ return: {
345
+ contractors: Contractors;
346
+ };
347
+ };
348
+ };
349
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { AdminUiExtension } from "@deenruv/ui-devkit/compiler";
2
+ import { WFirmaPluginConfig } from "./types";
3
+ export declare class WFirmaPlugin {
4
+ static config: WFirmaPluginConfig;
5
+ static init(config: WFirmaPluginConfig): typeof WFirmaPlugin;
6
+ static ui: AdminUiExtension;
7
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WFirmaPlugin = void 0;
13
+ const core_1 = require("@deenruv/core");
14
+ const path_1 = __importDefault(require("path"));
15
+ const wfirma_service_1 = require("./services/wfirma.service");
16
+ const constants_1 = require("./constants");
17
+ const wfirma_extension_1 = require("./extensions/wfirma.extension");
18
+ const wfirma_admin_resolver_1 = require("./api/wfirma-admin.resolver");
19
+ let WFirmaPlugin = class WFirmaPlugin {
20
+ static init(config) {
21
+ this.config = config;
22
+ return this;
23
+ }
24
+ };
25
+ exports.WFirmaPlugin = WFirmaPlugin;
26
+ WFirmaPlugin.ui = {
27
+ id: "WFirma-extension",
28
+ extensionPath: path_1.default.join(__dirname, "ui"),
29
+ providers: ["providers.ts"],
30
+ globalStyles: [path_1.default.join(__dirname, "ui/styles/overwrite.css")],
31
+ translations: {},
32
+ };
33
+ exports.WFirmaPlugin = WFirmaPlugin = __decorate([
34
+ (0, core_1.DeenruvPlugin)({
35
+ compatibility: "^2.0.0",
36
+ imports: [core_1.PluginCommonModule],
37
+ providers: [
38
+ wfirma_service_1.WFirmaService,
39
+ { provide: constants_1.PLUGIN_INIT_OPTIONS, useFactory: () => WFirmaPlugin.config },
40
+ ],
41
+ adminApiExtensions: {
42
+ schema: wfirma_extension_1.WFirmaAdminExtension,
43
+ resolvers: [wfirma_admin_resolver_1.WFirmaAdminResolver],
44
+ },
45
+ configuration: (config) => {
46
+ config.customFields.Order.push({
47
+ type: "string",
48
+ name: "wfirmaInvoiceId",
49
+ internal: true,
50
+ nullable: true,
51
+ defaultValue: "",
52
+ });
53
+ return config;
54
+ },
55
+ })
56
+ ], WFirmaPlugin);