@activepieces/piece-bokio 0.0.5 → 0.0.7

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 (44) hide show
  1. package/package.json +7 -21
  2. package/src/index.js +13 -52
  3. package/README.md +0 -7
  4. package/src/index.d.ts +0 -4
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/add-line-item-to-invoice.d.ts +0 -14
  7. package/src/lib/actions/add-line-item-to-invoice.js +0 -63
  8. package/src/lib/actions/add-line-item-to-invoice.js.map +0 -1
  9. package/src/lib/actions/create-a-journal-entry.d.ts +0 -8
  10. package/src/lib/actions/create-a-journal-entry.js +0 -66
  11. package/src/lib/actions/create-a-journal-entry.js.map +0 -1
  12. package/src/lib/actions/create-an-item.d.ts +0 -10
  13. package/src/lib/actions/create-an-item.js +0 -56
  14. package/src/lib/actions/create-an-item.js.map +0 -1
  15. package/src/lib/actions/create-customer.d.ts +0 -18
  16. package/src/lib/actions/create-customer.js +0 -141
  17. package/src/lib/actions/create-customer.js.map +0 -1
  18. package/src/lib/actions/create-invoice.d.ts +0 -17
  19. package/src/lib/actions/create-invoice.js +0 -121
  20. package/src/lib/actions/create-invoice.js.map +0 -1
  21. package/src/lib/actions/find-customer.d.ts +0 -9
  22. package/src/lib/actions/find-customer.js +0 -74
  23. package/src/lib/actions/find-customer.js.map +0 -1
  24. package/src/lib/actions/get-a-journal-entry.d.ts +0 -6
  25. package/src/lib/actions/get-a-journal-entry.js +0 -30
  26. package/src/lib/actions/get-a-journal-entry.js.map +0 -1
  27. package/src/lib/actions/get-an-invoice.d.ts +0 -6
  28. package/src/lib/actions/get-an-invoice.js +0 -30
  29. package/src/lib/actions/get-an-invoice.js.map +0 -1
  30. package/src/lib/actions/get-draft-invoice-by-customer-name.d.ts +0 -8
  31. package/src/lib/actions/get-draft-invoice-by-customer-name.js +0 -71
  32. package/src/lib/actions/get-draft-invoice-by-customer-name.js.map +0 -1
  33. package/src/lib/actions/update-an-invoice.d.ts +0 -17
  34. package/src/lib/actions/update-an-invoice.js +0 -105
  35. package/src/lib/actions/update-an-invoice.js.map +0 -1
  36. package/src/lib/common/auth.d.ts +0 -4
  37. package/src/lib/common/auth.js +0 -45
  38. package/src/lib/common/auth.js.map +0 -1
  39. package/src/lib/common/client.d.ts +0 -3
  40. package/src/lib/common/client.js +0 -27
  41. package/src/lib/common/client.js.map +0 -1
  42. package/src/lib/common/props.d.ts +0 -9
  43. package/src/lib/common/props.js +0 -126
  44. package/src/lib/common/props.js.map +0 -1
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDraftInvoiceByCustomerName = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../common/auth");
7
- const client_1 = require("../common/client");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- exports.getDraftInvoiceByCustomerName = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.bokioAuth,
11
- name: 'getDraftInvoiceByCustomerName',
12
- displayName: 'Get Draft Invoice by Customer Name',
13
- description: 'Get all draft invoices for a customer by customer name',
14
- props: {
15
- customerName: pieces_framework_1.Property.ShortText({
16
- displayName: 'Customer Name',
17
- description: 'Name of the customer to find draft invoices for',
18
- required: true,
19
- }),
20
- page: pieces_framework_1.Property.Number({
21
- displayName: 'Page',
22
- description: 'Page number (defaults to 1)',
23
- required: false,
24
- }),
25
- pageSize: pieces_framework_1.Property.Number({
26
- displayName: 'Page Size',
27
- description: 'Number of items per page (max 100, defaults to 25)',
28
- required: false,
29
- }),
30
- },
31
- run(context) {
32
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
- const { customerName, page, pageSize } = context.propsValue;
34
- const { api_key, companyId } = context.auth.props;
35
- // First, find the customer by name
36
- const customerSearchParams = new URLSearchParams();
37
- customerSearchParams.append('page', '1');
38
- customerSearchParams.append('pageSize', '100');
39
- customerSearchParams.append('query', `name=='${customerName}'`);
40
- const customerUrl = `/companies/${companyId}/customers?${customerSearchParams.toString()}`;
41
- const customerResponse = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, customerUrl);
42
- if (!customerResponse.items || customerResponse.items.length === 0) {
43
- return {
44
- message: `No customer found with name: ${customerName}`,
45
- items: [],
46
- };
47
- }
48
- const customerId = customerResponse.items[0].id;
49
- // Now fetch draft invoices for this customer
50
- const invoiceParams = new URLSearchParams();
51
- if (page !== undefined && page !== null) {
52
- invoiceParams.append('page', String(page));
53
- }
54
- else {
55
- invoiceParams.append('page', '1');
56
- }
57
- if (pageSize !== undefined && pageSize !== null) {
58
- invoiceParams.append('pageSize', String(pageSize));
59
- }
60
- else {
61
- invoiceParams.append('pageSize', '25');
62
- }
63
- // Filter for draft invoices with matching customer
64
- invoiceParams.append('query', `status==draft&&customerRef==${customerId}`);
65
- const invoiceUrl = `/companies/${companyId}/invoices?${invoiceParams.toString()}`;
66
- const invoiceResponse = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, invoiceUrl);
67
- return Object.assign({ customerName: customerResponse.items[0].name, customerId }, invoiceResponse);
68
- });
69
- },
70
- });
71
- //# sourceMappingURL=get-draft-invoice-by-customer-name.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-draft-invoice-by-customer-name.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bokio/src/lib/actions/get-draft-invoice-by-customer-name.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA2C;AAC3C,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,6BAA6B,GAAG,IAAA,+BAAY,EAAC;IACxD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE,wDAAwD;IACrE,KAAK,EAAE;QACL,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EA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C,CAAC,EAAE,CAAC;YAEhD,6CAA6C;YAC7C,MAAM,aAAa,GAAG,IAAI,eAAe,EAAE,CAAC;YAC5C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBACxC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACpC,CAAC;YAED,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAChD,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC;YAED,mDAAmD;YACnD,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,+BAA+B,UAAU,EAAE,CAAC,CAAC;YAE3E,MAAM,UAAU,GAAG,cAAc,SAAS,aAAa,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC;YAClF,MAAM,eAAe,GAAG,MAAM,IAAA,oBAAW,EAAC,OAAO,EAAE,0BAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAE/E,uBACE,YAAY,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5C,UAAU,IACP,eAAe,EAClB;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- export declare const updateAnInvoice: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- companyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- }>, {
5
- invoiceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
- companyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
- }>>;
9
- invoiceType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
10
- customerRef: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
- invoiceDate: import("@activepieces/pieces-framework").ShortTextProperty<true>;
12
- dueDate: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
- orderNumberReference: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
- currency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
15
- currencyRate: import("@activepieces/pieces-framework").NumberProperty<false>;
16
- lineItemsJson: import("@activepieces/pieces-framework").LongTextProperty<false>;
17
- }>;
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateAnInvoice = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../common/auth");
7
- const client_1 = require("../common/client");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- const props_1 = require("../common/props");
10
- exports.updateAnInvoice = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.bokioAuth,
12
- name: 'updateAnInvoice',
13
- displayName: 'Update an invoice',
14
- description: 'Updates an existing draft invoice in Bokio',
15
- props: {
16
- invoiceId: props_1.invoiceIdDropdown,
17
- invoiceType: pieces_framework_1.Property.StaticDropdown({
18
- displayName: 'Invoice Type',
19
- description: 'Type of invoice',
20
- required: false,
21
- options: {
22
- options: [
23
- { label: 'Invoice', value: 'invoice' },
24
- { label: 'Cash Invoice', value: 'cashInvoice' },
25
- ],
26
- },
27
- }),
28
- customerRef: pieces_framework_1.Property.ShortText({
29
- displayName: 'Customer ID',
30
- description: 'UUID of the customer',
31
- required: false,
32
- }),
33
- invoiceDate: pieces_framework_1.Property.ShortText({
34
- displayName: 'Invoice Date',
35
- description: 'Invoice date (YYYY-MM-DD)',
36
- required: true,
37
- }),
38
- dueDate: pieces_framework_1.Property.ShortText({
39
- displayName: 'Due Date',
40
- description: 'Due date (YYYY-MM-DD)',
41
- required: true,
42
- }),
43
- orderNumberReference: pieces_framework_1.Property.ShortText({
44
- displayName: 'Order Number Reference',
45
- description: 'The order number associated with the invoice',
46
- required: false,
47
- }),
48
- currency: pieces_framework_1.Property.ShortText({
49
- displayName: 'Currency',
50
- description: 'ISO 4217 currency code (e.g., SEK, EUR, USD)',
51
- required: false,
52
- }),
53
- currencyRate: pieces_framework_1.Property.Number({
54
- displayName: 'Currency Rate',
55
- description: 'Currency rate',
56
- required: false,
57
- }),
58
- lineItemsJson: pieces_framework_1.Property.LongText({
59
- displayName: 'Line Items (JSON)',
60
- description: 'Line items as JSON array. Each item should have: itemRef (object with id), description, quantity, unitPrice, unit, itemType (PRODUCT or SERVICE), vat',
61
- required: false,
62
- }),
63
- },
64
- run(context) {
65
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
- const { invoiceId, invoiceType, customerRef, invoiceDate, dueDate, orderNumberReference, currency, currencyRate, lineItemsJson, } = context.propsValue;
67
- const { api_key, companyId } = context.auth.props;
68
- const body = {};
69
- if (invoiceType) {
70
- body.type = invoiceType;
71
- }
72
- if (customerRef) {
73
- body.customerRef = {
74
- id: customerRef,
75
- };
76
- }
77
- if (invoiceDate) {
78
- body.invoiceDate = invoiceDate;
79
- }
80
- if (dueDate) {
81
- body.dueDate = dueDate;
82
- }
83
- if (orderNumberReference) {
84
- body.orderNumberReference = orderNumberReference;
85
- }
86
- if (currency) {
87
- body.currency = currency;
88
- }
89
- if (currencyRate !== undefined && currencyRate !== null) {
90
- body.currencyRate = currencyRate;
91
- }
92
- if (lineItemsJson) {
93
- try {
94
- body.lineItems = JSON.parse(lineItemsJson);
95
- }
96
- catch (_a) {
97
- throw new Error('Invalid JSON format for line items');
98
- }
99
- }
100
- const response = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.PUT, `/companies/${companyId}/invoices/${invoiceId}`, body);
101
- return response;
102
- });
103
- },
104
- });
105
- //# sourceMappingURL=update-an-invoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-an-invoice.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bokio/src/lib/actions/update-an-invoice.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA2C;AAC3C,6CAA+C;AAC/C,+DAAyD;AACzD,2CAAoD;AAEvC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,4CAA4C;IACzD,KAAK,EAAE;QACL,SAAS,EAAE,yBAAiB;QAC5B,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACtC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE;iBAChD;aACF;SACF,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,oBAAoB,EAAE,2BAAQ,CAAC,SAAS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G,oBAAoB,CAAC;YACnD,CAAC;YAED,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC3B,CAAC;YAED,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;gBACxD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;YACnC,CAAC;YAED,IAAI,aAAa,EAAE,CAAC;gBAClB,IAAI,CAAC;oBACH,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC7C,CAAC;gBAAC,WAAM,CAAC;oBACP,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,EACP,0BAAU,CAAC,GAAG,EACd,cAAc,SAAS,aAAa,SAAS,EAAE,EAC/C,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const bokioAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- companyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- }>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bokioAuth = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const client_1 = require("./client");
7
- const pieces_common_1 = require("@activepieces/pieces-common");
8
- exports.bokioAuth = pieces_framework_1.PieceAuth.CustomAuth({
9
- displayName: 'Bokio API Key',
10
- description: 'Bokio API Key is required to authenticate requests to Bokio',
11
- required: true,
12
- props: {
13
- companyId: pieces_framework_1.Property.ShortText({
14
- displayName: 'Company ID',
15
- description: 'Enter your Bokio Company ID ',
16
- required: true,
17
- }),
18
- api_key: pieces_framework_1.Property.ShortText({
19
- displayName: 'API Key',
20
- description: 'Enter your Bokio API Key',
21
- required: true,
22
- }),
23
- },
24
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
25
- if (auth) {
26
- try {
27
- yield (0, client_1.makeRequest)(auth.api_key, pieces_common_1.HttpMethod.GET, `/companies/${auth.companyId}/journal-entries`);
28
- return {
29
- valid: true,
30
- };
31
- }
32
- catch (e) {
33
- return {
34
- valid: false,
35
- error: 'Invalid Api Key',
36
- };
37
- }
38
- }
39
- return {
40
- valid: false,
41
- error: 'Invalid Api Key',
42
- };
43
- }),
44
- });
45
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bokio/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,qCAAuC;AACvC,+DAAqE;AAExD,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,6DAA6D;IAC1E,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,IAAA,oBAAW,EACf,IAAI,CAAC,OAAO,EACZ,0BAAU,CAAC,GAAG,EACd,cAAc,IAAI,CAAC,SAAS,kBAAkB,CAC/C,CAAC;gBACF,OAAO;oBACL,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,iBAAiB;iBACzB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iBAAiB;SACzB,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { HttpMethod } from '@activepieces/pieces-common';
2
- export declare const BASE_URL = "https://api.bokio.se/v1";
3
- export declare function makeRequest(api_key: string, method: HttpMethod, path: string, body?: unknown): Promise<any>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BASE_URL = void 0;
4
- exports.makeRequest = makeRequest;
5
- const tslib_1 = require("tslib");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- exports.BASE_URL = `https://api.bokio.se/v1`;
8
- function makeRequest(api_key, method, path, body) {
9
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
- try {
11
- const response = yield pieces_common_1.httpClient.sendRequest({
12
- method,
13
- url: `${exports.BASE_URL}${path}`,
14
- headers: {
15
- Authorization: `Bearer ${api_key}`,
16
- 'Content-Type': 'application/json',
17
- },
18
- body,
19
- });
20
- return response.body;
21
- }
22
- catch (error) {
23
- throw new Error(`Unexpected error: ${error.message || String(error)}`);
24
- }
25
- });
26
- }
27
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bokio/src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,kCAoBC;;AAxBD,+DAAqE;AAExD,QAAA,QAAQ,GAAG,yBAAyB,CAAC;AAElD,SAAsB,WAAW,CAC/B,OAAe,EACf,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;gBACzB,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,EAAE;oBAClC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CAAA"}
@@ -1,9 +0,0 @@
1
- export declare const invoiceIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- companyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- }>>;
5
- export declare const unitTypeDropdown: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
6
- export declare const lineItemsProps: import("@activepieces/pieces-framework").DynamicProperties<false, import("@activepieces/pieces-framework").CustomAuthProperty<{
7
- companyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
- api_key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- }>>;
@@ -1,126 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lineItemsProps = exports.unitTypeDropdown = exports.invoiceIdDropdown = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const client_1 = require("./client");
7
- const auth_1 = require("./auth");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- exports.invoiceIdDropdown = pieces_framework_1.Property.Dropdown({
10
- auth: auth_1.bokioAuth,
11
- displayName: 'Invoice',
12
- description: 'Select the invoice',
13
- required: true,
14
- refreshers: [],
15
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
16
- if (!auth) {
17
- return {
18
- disabled: true,
19
- options: [],
20
- };
21
- }
22
- try {
23
- const response = yield (0, client_1.makeRequest)(auth.props.api_key, pieces_common_1.HttpMethod.GET, `/companies/${auth.props.companyId}/invoices?limit=100`);
24
- const options = response.items.map((invoice) => ({
25
- label: `#${invoice.invoiceNumber} - ${invoice.customerRef.customerName}`,
26
- value: invoice.id,
27
- }));
28
- return {
29
- disabled: false,
30
- options,
31
- };
32
- }
33
- catch (error) {
34
- return {
35
- disabled: true,
36
- options: [],
37
- };
38
- }
39
- }),
40
- });
41
- exports.unitTypeDropdown = pieces_framework_1.Property.StaticDropdown({
42
- displayName: 'Unit Type',
43
- description: 'Unit type for the item',
44
- required: false,
45
- options: {
46
- options: [
47
- { label: 'Unspecified', value: 'unspecified' },
48
- { label: 'Piece', value: 'piece' },
49
- { label: 'Hour', value: 'hour' },
50
- { label: 'Day', value: 'day' },
51
- { label: 'Month', value: 'month' },
52
- { label: 'Kilogram', value: 'kilogram' },
53
- { label: 'Gram', value: 'gram' },
54
- { label: 'Liter', value: 'liter' },
55
- { label: 'Meter', value: 'meter' },
56
- { label: 'Centimeter', value: 'centimeter' },
57
- { label: 'Millimeter', value: 'millimeter' },
58
- { label: 'Meter Squared', value: 'meterSquared' },
59
- { label: 'Meter Cubic', value: 'meterCubic' },
60
- { label: 'Mile', value: 'mile' },
61
- { label: 'Kilometer', value: 'kilometer' },
62
- { label: 'Gigabyte', value: 'gigabyte' },
63
- { label: 'Hectar', value: 'hectar' },
64
- { label: 'Words', value: 'words' },
65
- { label: 'Year', value: 'year' },
66
- { label: 'Week', value: 'week' },
67
- { label: 'Minute', value: 'minute' },
68
- { label: 'Megabyte', value: 'megabyte' },
69
- { label: 'Ton', value: 'ton' },
70
- ],
71
- },
72
- });
73
- exports.lineItemsProps = pieces_framework_1.Property.DynamicProperties({
74
- auth: auth_1.bokioAuth,
75
- displayName: 'Item Details',
76
- description: 'Configure item details based on item type',
77
- required: false,
78
- refreshers: ['itemType'],
79
- props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ itemType }) {
80
- const properties = {
81
- description: pieces_framework_1.Property.ShortText({
82
- displayName: 'Description',
83
- description: 'Description of the line item',
84
- required: true,
85
- }),
86
- };
87
- // Only show pricing fields for sales items
88
- if (itemType === 'salesItem') {
89
- properties['itemRefId'] = pieces_framework_1.Property.ShortText({
90
- displayName: 'Item Reference ID',
91
- description: 'UUID of the item reference',
92
- required: false,
93
- });
94
- properties['productType'] = pieces_framework_1.Property.StaticDropdown({
95
- displayName: 'Product Type',
96
- description: 'Type of product',
97
- required: true,
98
- options: {
99
- options: [
100
- { label: 'Goods', value: 'goods' },
101
- { label: 'Service', value: 'service' },
102
- ],
103
- },
104
- });
105
- properties['unitType'] = exports.unitTypeDropdown;
106
- properties['quantity'] = pieces_framework_1.Property.Number({
107
- displayName: 'Quantity',
108
- description: 'Quantity of the item',
109
- required: true,
110
- defaultValue: 1,
111
- });
112
- properties['unitPrice'] = pieces_framework_1.Property.Number({
113
- displayName: 'Unit Price',
114
- description: 'Price per unit',
115
- required: true,
116
- });
117
- properties['taxRate'] = pieces_framework_1.Property.Number({
118
- displayName: 'Tax Rate',
119
- description: 'Tax rate in percentage (e.g., 25 for 25%)',
120
- required: false,
121
- });
122
- }
123
- return properties;
124
- }),
125
- });
126
- //# sourceMappingURL=props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/bokio/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,qCAAuC;AACvC,iCAAmC;AACnC,+DAAyD;AAE5C,QAAA,iBAAiB,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE,gBAAS;IACf,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,oBAAoB;IACjC,Q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