@activepieces/piece-katana 0.1.4 → 0.1.6

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.
@@ -1,196 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCustomer = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../common/auth");
8
- const constants_1 = require("../common/constants");
9
- exports.createCustomer = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.katanaAuth,
11
- name: 'create_customer',
12
- displayName: 'Create Customer',
13
- description: 'Creates a new customer in Katana.',
14
- props: {
15
- name: pieces_framework_1.Property.ShortText({
16
- displayName: 'Name',
17
- description: 'Customer display name.',
18
- required: true,
19
- }),
20
- first_name: pieces_framework_1.Property.ShortText({
21
- displayName: 'First Name',
22
- required: false,
23
- }),
24
- last_name: pieces_framework_1.Property.ShortText({
25
- displayName: 'Last Name',
26
- required: false,
27
- }),
28
- company: pieces_framework_1.Property.ShortText({
29
- displayName: 'Company',
30
- required: false,
31
- }),
32
- email: pieces_framework_1.Property.ShortText({
33
- displayName: 'Email',
34
- required: false,
35
- }),
36
- phone: pieces_framework_1.Property.ShortText({
37
- displayName: 'Phone',
38
- required: false,
39
- }),
40
- currency: pieces_framework_1.Property.ShortText({
41
- displayName: 'Currency',
42
- description: 'Currency code (ISO 4217), e.g. USD, EUR, GBP.',
43
- required: false,
44
- }),
45
- reference_id: pieces_framework_1.Property.ShortText({
46
- displayName: 'Reference ID',
47
- description: 'External reference ID (max 100 characters).',
48
- required: false,
49
- }),
50
- category: pieces_framework_1.Property.ShortText({
51
- displayName: 'Category',
52
- description: 'Customer category (max 100 characters).',
53
- required: false,
54
- }),
55
- comment: pieces_framework_1.Property.LongText({
56
- displayName: 'Comment',
57
- description: 'Additional notes about the customer.',
58
- required: false,
59
- }),
60
- discount_rate: pieces_framework_1.Property.Number({
61
- displayName: 'Discount Rate',
62
- description: 'Default discount rate for this customer.',
63
- required: false,
64
- }),
65
- addresses: pieces_framework_1.Property.Array({
66
- displayName: 'Addresses',
67
- required: false,
68
- properties: {
69
- entity_type: pieces_framework_1.Property.StaticDropdown({
70
- displayName: 'Address Type',
71
- required: true,
72
- options: {
73
- options: [
74
- { label: 'Billing', value: 'billing' },
75
- { label: 'Shipping', value: 'shipping' },
76
- ],
77
- },
78
- }),
79
- default: pieces_framework_1.Property.Checkbox({
80
- displayName: 'Set as Default',
81
- required: false,
82
- }),
83
- first_name: pieces_framework_1.Property.ShortText({
84
- displayName: 'First Name',
85
- required: false,
86
- }),
87
- last_name: pieces_framework_1.Property.ShortText({
88
- displayName: 'Last Name',
89
- required: false,
90
- }),
91
- company: pieces_framework_1.Property.ShortText({
92
- displayName: 'Company',
93
- required: false,
94
- }),
95
- phone: pieces_framework_1.Property.ShortText({
96
- displayName: 'Phone',
97
- required: false,
98
- }),
99
- line_1: pieces_framework_1.Property.ShortText({
100
- displayName: 'Address Line 1',
101
- required: false,
102
- }),
103
- line_2: pieces_framework_1.Property.ShortText({
104
- displayName: 'Address Line 2',
105
- required: false,
106
- }),
107
- city: pieces_framework_1.Property.ShortText({
108
- displayName: 'City',
109
- required: false,
110
- }),
111
- state: pieces_framework_1.Property.ShortText({
112
- displayName: 'State',
113
- required: false,
114
- }),
115
- zip: pieces_framework_1.Property.ShortText({
116
- displayName: 'Zip/Postal Code',
117
- required: false,
118
- }),
119
- country: pieces_framework_1.Property.ShortText({
120
- displayName: 'Country',
121
- required: false,
122
- }),
123
- },
124
- }),
125
- },
126
- run(context) {
127
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
128
- const { name, first_name, last_name, company, email, phone, currency, reference_id, category, comment, discount_rate, addresses, } = context.propsValue;
129
- const body = {
130
- name,
131
- };
132
- if (first_name)
133
- body['first_name'] = first_name;
134
- if (last_name)
135
- body['last_name'] = last_name;
136
- if (company)
137
- body['company'] = company;
138
- if (email)
139
- body['email'] = email;
140
- if (phone)
141
- body['phone'] = phone;
142
- if (currency)
143
- body['currency'] = currency;
144
- if (reference_id)
145
- body['reference_id'] = reference_id;
146
- if (category)
147
- body['category'] = category;
148
- if (comment)
149
- body['comment'] = comment;
150
- if (discount_rate !== undefined && discount_rate !== null) {
151
- body['discount_rate'] = discount_rate;
152
- }
153
- if (addresses && addresses.length > 0) {
154
- body['addresses'] = addresses.map((addr) => {
155
- const address = {
156
- entity_type: addr.entity_type,
157
- };
158
- if (addr.default !== undefined)
159
- address['default'] = addr.default;
160
- if (addr.first_name)
161
- address['first_name'] = addr.first_name;
162
- if (addr.last_name)
163
- address['last_name'] = addr.last_name;
164
- if (addr.company)
165
- address['company'] = addr.company;
166
- if (addr.phone)
167
- address['phone'] = addr.phone;
168
- if (addr.line_1)
169
- address['line_1'] = addr.line_1;
170
- if (addr.line_2)
171
- address['line_2'] = addr.line_2;
172
- if (addr.city)
173
- address['city'] = addr.city;
174
- if (addr.state)
175
- address['state'] = addr.state;
176
- if (addr.zip)
177
- address['zip'] = addr.zip;
178
- if (addr.country)
179
- address['country'] = addr.country;
180
- return address;
181
- });
182
- }
183
- const response = yield pieces_common_1.httpClient.sendRequest({
184
- method: pieces_common_1.HttpMethod.POST,
185
- url: `${constants_1.BASE_URL}/customers`,
186
- authentication: {
187
- type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
188
- token: context.auth,
189
- },
190
- body,
191
- });
192
- return response.body;
193
- });
194
- },
195
- });
196
- //# sourceMappingURL=create-customer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/katana/src/lib/actions/create-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,yCAA4C;AAC5C,mDAA+C;AAiBlC,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,iB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M,CAAC;oBACjD,IAAI,IAAI,CAAC,IAAI;wBAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;oBAC3C,IAAI,IAAI,CAAC,KAAK;wBAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;oBAC9C,IAAI,IAAI,CAAC,GAAG;wBAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;oBACxC,IAAI,IAAI,CAAC,OAAO;wBAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;oBAEpD,OAAO,OAAO,CAAC;gBACjB,CAAC,CAAC,CAAC;YACL,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,oBAAQ,YAAY;gBAC5B,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAyB;iBACzC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- export declare const createSalesOrder: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
- order_no: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- customer_id: import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
4
- variant_id: import("@activepieces/pieces-framework").DropdownProperty<number, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
5
- quantity: import("@activepieces/pieces-framework").NumberProperty<true>;
6
- price_per_unit: import("@activepieces/pieces-framework").NumberProperty<false>;
7
- total_discount: import("@activepieces/pieces-framework").NumberProperty<false>;
8
- tax_rate_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
9
- additional_order_rows: import("@activepieces/pieces-framework").JsonProperty<false>;
10
- status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
11
- location_id: import("@activepieces/pieces-framework").DropdownProperty<number, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
12
- currency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
- order_created_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
14
- delivery_date: import("@activepieces/pieces-framework").DateTimeProperty<false>;
15
- customer_ref: import("@activepieces/pieces-framework").ShortTextProperty<false>;
16
- additional_info: import("@activepieces/pieces-framework").LongTextProperty<false>;
17
- tracking_number: import("@activepieces/pieces-framework").ShortTextProperty<false>;
18
- tracking_number_url: import("@activepieces/pieces-framework").ShortTextProperty<false>;
19
- addresses: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
20
- ecommerce_order_type: import("@activepieces/pieces-framework").ShortTextProperty<false>;
21
- ecommerce_store_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
22
- ecommerce_order_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
23
- }>;
@@ -1,275 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSalesOrder = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../common/auth");
8
- const constants_1 = require("../common/constants");
9
- const props_1 = require("../common/props");
10
- exports.createSalesOrder = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.katanaAuth,
12
- name: 'create_sales_order',
13
- displayName: 'Create Sales Order',
14
- description: 'Creates a new sales order in Katana.',
15
- props: {
16
- order_no: pieces_framework_1.Property.ShortText({
17
- displayName: 'Order Number',
18
- description: 'Unique order number.',
19
- required: true,
20
- }),
21
- customer_id: props_1.customerDropdown,
22
- // Simple mode: single product variant
23
- variant_id: props_1.variantDropdown,
24
- quantity: pieces_framework_1.Property.Number({
25
- displayName: 'Quantity',
26
- description: 'Quantity for the product variant.',
27
- required: true,
28
- }),
29
- price_per_unit: pieces_framework_1.Property.Number({
30
- displayName: 'Price Per Unit',
31
- description: 'Override price per unit.',
32
- required: false,
33
- }),
34
- total_discount: pieces_framework_1.Property.Number({
35
- displayName: 'Total Discount',
36
- description: 'Discount amount for this line.',
37
- required: false,
38
- }),
39
- tax_rate_id: props_1.taxRateDropdown,
40
- additional_order_rows: pieces_framework_1.Property.Json({
41
- displayName: 'Additional Order Lines (JSON)',
42
- description: 'Add more line items as JSON array. Each object needs: variant_id, quantity. Optional: price_per_unit, total_discount, tax_rate_id, location_id.',
43
- required: false,
44
- }),
45
- status: pieces_framework_1.Property.StaticDropdown({
46
- displayName: 'Status',
47
- description: 'Order status. Use PENDING for quotes.',
48
- required: false,
49
- options: {
50
- options: [
51
- { label: 'Not Shipped', value: 'NOT_SHIPPED' },
52
- { label: 'Pending (Quote)', value: 'PENDING' },
53
- ],
54
- },
55
- }),
56
- location_id: props_1.locationDropdown,
57
- currency: pieces_framework_1.Property.ShortText({
58
- displayName: 'Currency',
59
- description: 'Currency code (ISO 4217), e.g. USD, EUR.',
60
- required: false,
61
- }),
62
- order_created_date: pieces_framework_1.Property.DateTime({
63
- displayName: 'Order Created Date',
64
- required: false,
65
- }),
66
- delivery_date: pieces_framework_1.Property.DateTime({
67
- displayName: 'Delivery Date',
68
- required: false,
69
- }),
70
- customer_ref: pieces_framework_1.Property.ShortText({
71
- displayName: 'Customer Reference',
72
- description: 'Customer reference number (max 255 characters).',
73
- required: false,
74
- }),
75
- additional_info: pieces_framework_1.Property.LongText({
76
- displayName: 'Additional Info',
77
- description: 'Additional notes for this order.',
78
- required: false,
79
- }),
80
- tracking_number: pieces_framework_1.Property.ShortText({
81
- displayName: 'Tracking Number',
82
- description: 'Shipping tracking number (max 256 characters).',
83
- required: false,
84
- }),
85
- tracking_number_url: pieces_framework_1.Property.ShortText({
86
- displayName: 'Tracking URL',
87
- description: 'URL to track the shipment.',
88
- required: false,
89
- }),
90
- addresses: pieces_framework_1.Property.Array({
91
- displayName: 'Addresses',
92
- required: false,
93
- properties: {
94
- entity_type: pieces_framework_1.Property.StaticDropdown({
95
- displayName: 'Address Type',
96
- required: true,
97
- options: {
98
- options: [
99
- { label: 'Billing', value: 'billing' },
100
- { label: 'Shipping', value: 'shipping' },
101
- ],
102
- },
103
- }),
104
- first_name: pieces_framework_1.Property.ShortText({
105
- displayName: 'First Name',
106
- required: false,
107
- }),
108
- last_name: pieces_framework_1.Property.ShortText({
109
- displayName: 'Last Name',
110
- required: false,
111
- }),
112
- company: pieces_framework_1.Property.ShortText({
113
- displayName: 'Company',
114
- required: false,
115
- }),
116
- phone: pieces_framework_1.Property.ShortText({
117
- displayName: 'Phone',
118
- required: false,
119
- }),
120
- line_1: pieces_framework_1.Property.ShortText({
121
- displayName: 'Address Line 1',
122
- required: false,
123
- }),
124
- line_2: pieces_framework_1.Property.ShortText({
125
- displayName: 'Address Line 2',
126
- required: false,
127
- }),
128
- city: pieces_framework_1.Property.ShortText({
129
- displayName: 'City',
130
- required: false,
131
- }),
132
- state: pieces_framework_1.Property.ShortText({
133
- displayName: 'State',
134
- required: false,
135
- }),
136
- zip: pieces_framework_1.Property.ShortText({
137
- displayName: 'Zip/Postal Code',
138
- required: false,
139
- }),
140
- country: pieces_framework_1.Property.ShortText({
141
- displayName: 'Country',
142
- required: false,
143
- }),
144
- },
145
- }),
146
- ecommerce_order_type: pieces_framework_1.Property.ShortText({
147
- displayName: 'E-commerce Order Type',
148
- description: 'Source platform (e.g. shopify).',
149
- required: false,
150
- }),
151
- ecommerce_store_name: pieces_framework_1.Property.ShortText({
152
- displayName: 'E-commerce Store Name',
153
- description: 'Store identifier.',
154
- required: false,
155
- }),
156
- ecommerce_order_id: pieces_framework_1.Property.ShortText({
157
- displayName: 'E-commerce Order ID',
158
- description: 'External order ID from the e-commerce platform.',
159
- required: false,
160
- }),
161
- },
162
- run(context) {
163
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
164
- const { order_no, customer_id, variant_id, quantity, price_per_unit, total_discount, tax_rate_id, additional_order_rows, status, location_id, currency, order_created_date, delivery_date, customer_ref, additional_info, tracking_number, tracking_number_url, addresses, ecommerce_order_type, ecommerce_store_name, ecommerce_order_id, } = context.propsValue;
165
- // Build the first order row
166
- const firstRow = {
167
- variant_id,
168
- quantity,
169
- };
170
- if (price_per_unit !== undefined && price_per_unit !== null) {
171
- firstRow['price_per_unit'] = price_per_unit;
172
- }
173
- if (total_discount !== undefined && total_discount !== null) {
174
- firstRow['total_discount'] = total_discount;
175
- }
176
- if (tax_rate_id)
177
- firstRow['tax_rate_id'] = tax_rate_id;
178
- if (location_id)
179
- firstRow['location_id'] = location_id;
180
- // Start with the first row
181
- const salesOrderRows = [firstRow];
182
- // Add additional rows if provided
183
- if (additional_order_rows) {
184
- const additionalRows = Array.isArray(additional_order_rows)
185
- ? additional_order_rows
186
- : [];
187
- for (const row of additionalRows) {
188
- const orderRow = {
189
- variant_id: row.variant_id,
190
- quantity: row.quantity,
191
- };
192
- if (row.price_per_unit !== undefined) {
193
- orderRow['price_per_unit'] = row.price_per_unit;
194
- }
195
- if (row.total_discount !== undefined) {
196
- orderRow['total_discount'] = row.total_discount;
197
- }
198
- if (row.tax_rate_id)
199
- orderRow['tax_rate_id'] = row.tax_rate_id;
200
- if (row.location_id)
201
- orderRow['location_id'] = row.location_id;
202
- salesOrderRows.push(orderRow);
203
- }
204
- }
205
- const body = {
206
- order_no,
207
- customer_id,
208
- sales_order_rows: salesOrderRows,
209
- };
210
- if (status)
211
- body['status'] = status;
212
- if (location_id)
213
- body['location_id'] = location_id;
214
- if (currency)
215
- body['currency'] = currency;
216
- if (order_created_date)
217
- body['order_created_date'] = order_created_date;
218
- if (delivery_date)
219
- body['delivery_date'] = delivery_date;
220
- if (customer_ref)
221
- body['customer_ref'] = customer_ref;
222
- if (additional_info)
223
- body['additional_info'] = additional_info;
224
- if (tracking_number)
225
- body['tracking_number'] = tracking_number;
226
- if (tracking_number_url)
227
- body['tracking_number_url'] = tracking_number_url;
228
- if (ecommerce_order_type)
229
- body['ecommerce_order_type'] = ecommerce_order_type;
230
- if (ecommerce_store_name)
231
- body['ecommerce_store_name'] = ecommerce_store_name;
232
- if (ecommerce_order_id)
233
- body['ecommerce_order_id'] = ecommerce_order_id;
234
- if (addresses && addresses.length > 0) {
235
- body['addresses'] = addresses.map((addr) => {
236
- const address = {
237
- entity_type: addr.entity_type,
238
- };
239
- if (addr.first_name)
240
- address['first_name'] = addr.first_name;
241
- if (addr.last_name)
242
- address['last_name'] = addr.last_name;
243
- if (addr.company)
244
- address['company'] = addr.company;
245
- if (addr.phone)
246
- address['phone'] = addr.phone;
247
- if (addr.line_1)
248
- address['line_1'] = addr.line_1;
249
- if (addr.line_2)
250
- address['line_2'] = addr.line_2;
251
- if (addr.city)
252
- address['city'] = addr.city;
253
- if (addr.state)
254
- address['state'] = addr.state;
255
- if (addr.zip)
256
- address['zip'] = addr.zip;
257
- if (addr.country)
258
- address['country'] = addr.country;
259
- return address;
260
- });
261
- }
262
- const response = yield pieces_common_1.httpClient.sendRequest({
263
- method: pieces_common_1.HttpMethod.POST,
264
- url: `${constants_1.BASE_URL}/sales_orders`,
265
- authentication: {
266
- type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
267
- token: context.auth.secret_text,
268
- },
269
- body,
270
- });
271
- return response.body;
272
- });
273
- },
274
- });
275
- //# sourceMappingURL=create-sales-order.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-sales-order.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/katana/src/lib/actions/create-sales-order.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,yCAA4C;AAC5C,mDAA+C;AAC/C,2CAKyB;AAyBZ,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC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AE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;oBACjD,IAAI,IAAI,CAAC,MAAM;wBAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;oBACjD,IAAI,IAAI,CAAC,IAAI;wBAAE,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;oBAC3C,IAAI,IAAI,CAAC,KAAK;wBAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;oBAC9C,IAAI,IAAI,CAAC,GAAG;wBAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;oBACxC,IAAI,IAAI,CAAC,OAAO;wBAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;oBAEpD,OAAO,OAAO,CAAC;gBACjB,CAAC,CAAC,CAAC;YACL,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,oBAAQ,eAAe;gBAC/B,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;iBAChC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- export declare const findCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
- name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
3
- first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
4
- last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
5
- company: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
- email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
- phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- currency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
- reference_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
- category: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
- include_deleted: import("@activepieces/pieces-framework").CheckboxProperty<false>;
12
- limit: import("@activepieces/pieces-framework").NumberProperty<false>;
13
- page: import("@activepieces/pieces-framework").NumberProperty<false>;
14
- }>;
@@ -1,117 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findCustomer = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../common/auth");
8
- const constants_1 = require("../common/constants");
9
- exports.findCustomer = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.katanaAuth,
11
- name: 'find_customer',
12
- displayName: 'Find Customer',
13
- description: 'Find a customer by name, email, or phone number.',
14
- props: {
15
- name: pieces_framework_1.Property.ShortText({
16
- displayName: 'Name',
17
- description: 'Filters customers by name.',
18
- required: false,
19
- }),
20
- first_name: pieces_framework_1.Property.ShortText({
21
- displayName: 'First Name',
22
- description: 'Filters customers by first name.',
23
- required: false,
24
- }),
25
- last_name: pieces_framework_1.Property.ShortText({
26
- displayName: 'Last Name',
27
- description: 'Filters customers by last name.',
28
- required: false,
29
- }),
30
- company: pieces_framework_1.Property.ShortText({
31
- displayName: 'Company',
32
- description: 'Filters customers by company.',
33
- required: false,
34
- }),
35
- email: pieces_framework_1.Property.ShortText({
36
- displayName: 'Email',
37
- description: 'Filters customers by email.',
38
- required: false,
39
- }),
40
- phone: pieces_framework_1.Property.ShortText({
41
- displayName: 'Phone',
42
- description: 'Filters customers by phone number.',
43
- required: false,
44
- }),
45
- currency: pieces_framework_1.Property.ShortText({
46
- displayName: 'Currency',
47
- description: 'Filters customers by currency.',
48
- required: false,
49
- }),
50
- reference_id: pieces_framework_1.Property.ShortText({
51
- displayName: 'Reference ID',
52
- description: 'Filters customers by reference ID.',
53
- required: false,
54
- }),
55
- category: pieces_framework_1.Property.ShortText({
56
- displayName: 'Category',
57
- description: 'Filters customers by category.',
58
- required: false,
59
- }),
60
- include_deleted: pieces_framework_1.Property.Checkbox({
61
- displayName: 'Include Deleted',
62
- description: 'Include soft-deleted customers in results.',
63
- required: false,
64
- }),
65
- limit: pieces_framework_1.Property.Number({
66
- displayName: 'Limit',
67
- description: 'Maximum number of results to return (default is 50).',
68
- required: false,
69
- }),
70
- page: pieces_framework_1.Property.Number({
71
- displayName: 'Page',
72
- description: 'Page number for pagination (default is 1).',
73
- required: false,
74
- }),
75
- },
76
- run(context) {
77
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
78
- const { name, first_name, last_name, company, email, phone, currency, reference_id, category, include_deleted, limit, page, } = context.propsValue;
79
- const queryParams = {};
80
- if (name)
81
- queryParams['name'] = name;
82
- if (first_name)
83
- queryParams['first_name'] = first_name;
84
- if (last_name)
85
- queryParams['last_name'] = last_name;
86
- if (company)
87
- queryParams['company'] = company;
88
- if (email)
89
- queryParams['email'] = email;
90
- if (phone)
91
- queryParams['phone'] = phone;
92
- if (currency)
93
- queryParams['currency'] = currency;
94
- if (reference_id)
95
- queryParams['reference_id'] = reference_id;
96
- if (category)
97
- queryParams['category'] = category;
98
- if (include_deleted !== undefined)
99
- queryParams['include_deleted'] = include_deleted.toString();
100
- if (limit !== undefined)
101
- queryParams['limit'] = limit.toString();
102
- if (page !== undefined)
103
- queryParams['page'] = page.toString();
104
- const response = yield pieces_common_1.httpClient.sendRequest({
105
- method: pieces_common_1.HttpMethod.GET,
106
- url: `${constants_1.BASE_URL}/customers`,
107
- authentication: {
108
- type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
109
- token: context.auth.secret_text,
110
- },
111
- queryParams,
112
- });
113
- return response.body;
114
- });
115
- },
116
- });
117
- //# sourceMappingURL=find-customer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/katana/src/lib/actions/find-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,yCAA4C;AAC5C,mDAA+C;AAElC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,gCAAgC;Y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