@activepieces/piece-gorgias 0.0.3 → 0.0.5

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 (41) hide show
  1. package/package.json +7 -12
  2. package/src/index.js +13 -44
  3. package/src/index.d.ts +0 -6
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/create-message.d.ts +0 -18
  7. package/src/lib/actions/create-message.d.ts.map +0 -1
  8. package/src/lib/actions/create-message.js +0 -110
  9. package/src/lib/actions/create-message.js.map +0 -1
  10. package/src/lib/actions/create-ticket.d.ts +0 -13
  11. package/src/lib/actions/create-ticket.d.ts.map +0 -1
  12. package/src/lib/actions/create-ticket.js +0 -83
  13. package/src/lib/actions/create-ticket.js.map +0 -1
  14. package/src/lib/actions/get-customer.d.ts +0 -9
  15. package/src/lib/actions/get-customer.d.ts.map +0 -1
  16. package/src/lib/actions/get-customer.js +0 -49
  17. package/src/lib/actions/get-customer.js.map +0 -1
  18. package/src/lib/actions/get-ticket.d.ts +0 -8
  19. package/src/lib/actions/get-ticket.d.ts.map +0 -1
  20. package/src/lib/actions/get-ticket.js +0 -32
  21. package/src/lib/actions/get-ticket.js.map +0 -1
  22. package/src/lib/actions/list-tickets.d.ts +0 -11
  23. package/src/lib/actions/list-tickets.d.ts.map +0 -1
  24. package/src/lib/actions/list-tickets.js +0 -56
  25. package/src/lib/actions/list-tickets.js.map +0 -1
  26. package/src/lib/actions/update-ticket.d.ts +0 -17
  27. package/src/lib/actions/update-ticket.d.ts.map +0 -1
  28. package/src/lib/actions/update-ticket.js +0 -90
  29. package/src/lib/actions/update-ticket.js.map +0 -1
  30. package/src/lib/auth.d.ts +0 -10
  31. package/src/lib/auth.d.ts.map +0 -1
  32. package/src/lib/auth.js +0 -73
  33. package/src/lib/auth.js.map +0 -1
  34. package/src/lib/common/client.d.ts +0 -31
  35. package/src/lib/common/client.d.ts.map +0 -1
  36. package/src/lib/common/client.js +0 -59
  37. package/src/lib/common/client.js.map +0 -1
  38. package/src/lib/common/constants.d.ts +0 -19
  39. package/src/lib/common/constants.d.ts.map +0 -1
  40. package/src/lib/common/constants.js +0 -29
  41. package/src/lib/common/constants.js.map +0 -1
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTicketAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const auth_1 = require("../auth");
8
- const client_1 = require("../common/client");
9
- const constants_1 = require("../common/constants");
10
- exports.createTicketAction = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.gorgiasAuth,
12
- name: 'create_gorgias_ticket',
13
- displayName: 'Create Ticket',
14
- description: 'Create a new Gorgias ticket with an initial message.',
15
- audience: 'both',
16
- aiMetadata: { description: 'Open a new support ticket in Gorgias seeded with one initial message, specifying the sender (from) and recipient (to) addresses, subject, body, and the channel/via the message came through. Use to start a fresh conversation rather than reply to an existing thread; to add a follow-up message to a ticket that already exists, use Create Message instead. Not idempotent: each call creates a separate ticket.', idempotent: false },
17
- props: {
18
- fromAddress: pieces_framework_1.Property.ShortText({
19
- displayName: 'From Address',
20
- description: 'The sender address for the initial message, typically the customer email.',
21
- required: true,
22
- }),
23
- toAddress: pieces_framework_1.Property.ShortText({
24
- displayName: 'To Address',
25
- description: 'The recipient address for the initial message.',
26
- required: true,
27
- }),
28
- subject: pieces_framework_1.Property.ShortText({
29
- displayName: 'Subject',
30
- required: true,
31
- }),
32
- message: pieces_framework_1.Property.LongText({
33
- displayName: 'Message',
34
- description: 'Initial ticket message. HTML is accepted by the API.',
35
- required: true,
36
- }),
37
- channel: pieces_framework_1.Property.StaticDropdown({
38
- displayName: 'Channel',
39
- required: true,
40
- options: constants_1.GORGIAS_CHANNEL_OPTIONS,
41
- defaultValue: 'email',
42
- }),
43
- via: pieces_framework_1.Property.StaticDropdown({
44
- displayName: 'Via',
45
- description: 'How the message reached Gorgias.',
46
- required: true,
47
- options: constants_1.GORGIAS_VIA_OPTIONS,
48
- defaultValue: 'api',
49
- }),
50
- },
51
- run(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- const { fromAddress, toAddress, subject, message, channel, via } = context.propsValue;
54
- return yield (0, client_1.gorgiasApiCall)({
55
- auth: context.auth,
56
- method: pieces_common_1.HttpMethod.POST,
57
- resourceUri: '/tickets',
58
- body: {
59
- messages: [
60
- {
61
- from_agent: false,
62
- subject,
63
- body_html: message,
64
- channel,
65
- via,
66
- source: {
67
- from: {
68
- address: fromAddress,
69
- },
70
- to: [
71
- {
72
- address: toAddress,
73
- },
74
- ],
75
- },
76
- },
77
- ],
78
- },
79
- });
80
- });
81
- },
82
- });
83
- //# sourceMappingURL=create-ticket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-ticket.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-ticket.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAsC;AACtC,6CAAkD;AAClD,mDAG6B;AAEhB,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,sDAAsD;IACnE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,uZAAuZ,EAAE,UAAU,EAAE,KAAK,EAAE;IACvc,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,2EAA2E;YACxF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,IAAI;SACf,CAAC;Q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ustomerAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
- }>, {
6
- customerId: import("@activepieces/pieces-framework").NumberProperty<false>;
7
- email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- }>;
9
- //# sourceMappingURL=get-customer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-customer.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-customer.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;EA6C5B,CAAC"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCustomerAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const auth_1 = require("../auth");
8
- const client_1 = require("../common/client");
9
- exports.getCustomerAction = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.gorgiasAuth,
11
- name: 'get_gorgias_customer',
12
- displayName: 'Get Customer',
13
- description: 'Retrieve a Gorgias customer by ID or find one by email.',
14
- audience: 'both',
15
- aiMetadata: { description: 'Look up a single Gorgias customer, operating in one of two modes: pass a Customer ID to fetch it directly, or omit the ID and pass an Email to search customers server-side and return the match. Use to resolve a customer record before working with their tickets; supply exactly one of the two inputs and the call errors if neither is given or no email match is found. Idempotent read-only lookup.', idempotent: true },
16
- props: {
17
- customerId: pieces_framework_1.Property.Number({
18
- displayName: 'Customer ID',
19
- description: 'Use this when you already know the customer ID.',
20
- required: false,
21
- }),
22
- email: pieces_framework_1.Property.ShortText({
23
- displayName: 'Email',
24
- description: 'If Customer ID is not provided, search customers by email using Gorgias server-side filtering.',
25
- required: false,
26
- }),
27
- },
28
- run(context) {
29
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
30
- const { customerId, email } = context.propsValue;
31
- if (customerId) {
32
- return yield (0, client_1.gorgiasApiCall)({
33
- auth: context.auth,
34
- method: pieces_common_1.HttpMethod.GET,
35
- resourceUri: `/customers/${customerId}`,
36
- });
37
- }
38
- if (!email) {
39
- throw new Error('Provide either Customer ID or Email.');
40
- }
41
- const customer = yield (0, client_1.findCustomerByEmail)(context.auth, email);
42
- if (!customer) {
43
- throw new Error(`No customer found for email: ${email}`);
44
- }
45
- return customer;
46
- });
47
- },
48
- });
49
- //# sourceMappingURL=get-customer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-customer.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-customer.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAsC;AACtC,6CAAuE;AAE1D,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yDAAyD;IACtE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6YAA6Y,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5b,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,gGAAgG;YAC7G,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjD,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,MAAM,IAAA,uBAAc,EAAC;oBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,WAAW,EAAE,cAAc,UAAU,EAAE;iBACxC,CAAC,CAAC;YACL,CAAC;YAED,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YAC1D,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAmB,EACxC,OAAO,CAAC,IAAI,EACZ,KAAK,CACN,CAAC;YAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;YAC3D,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare const getTicketAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
- }>, {
6
- ticketId: import("@activepieces/pieces-framework").NumberProperty<true>;
7
- }>;
8
- //# sourceMappingURL=get-ticket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-ticket.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-ticket.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;EAoB1B,CAAC"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTicketAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const auth_1 = require("../auth");
8
- const client_1 = require("../common/client");
9
- exports.getTicketAction = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.gorgiasAuth,
11
- name: 'get_gorgias_ticket',
12
- displayName: 'Get Ticket',
13
- description: 'Retrieve a Gorgias ticket by ID.',
14
- audience: 'both',
15
- aiMetadata: { description: 'Fetch a single Gorgias support ticket by its numeric ID. Use when you already have the ticket ID and need its current details; to discover tickets without an ID, use List Tickets first. Idempotent read-only lookup.', idempotent: true },
16
- props: {
17
- ticketId: pieces_framework_1.Property.Number({
18
- displayName: 'Ticket ID',
19
- required: true,
20
- }),
21
- },
22
- run(context) {
23
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
- return yield (0, client_1.gorgiasApiCall)({
25
- auth: context.auth,
26
- method: pieces_common_1.HttpMethod.GET,
27
- resourceUri: `/tickets/${context.propsValue.ticketId}`,
28
- });
29
- });
30
- },
31
- });
32
- //# sourceMappingURL=get-ticket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-ticket.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-ticket.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAsC;AACtC,6CAAkD;AAErC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,wNAAwN,EAAE,UAAU,EAAE,IAAI,EAAE;IACvQ,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,IAAA,uBAAc,EAAC;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,YAAY,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare const listTicketsAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
- }>, {
6
- customerId: import("@activepieces/pieces-framework").NumberProperty<false>;
7
- cursor: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- limit: import("@activepieces/pieces-framework").NumberProperty<false>;
9
- orderBy: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
- }>;
11
- //# sourceMappingURL=list-tickets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-tickets.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-tickets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;;EA4C5B,CAAC"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listTicketsAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const auth_1 = require("../auth");
8
- const client_1 = require("../common/client");
9
- exports.listTicketsAction = (0, pieces_framework_1.createAction)({
10
- auth: auth_1.gorgiasAuth,
11
- name: 'list_gorgias_tickets',
12
- displayName: 'List Tickets',
13
- description: 'List Gorgias tickets with cursor-based pagination support.',
14
- audience: 'both',
15
- aiMetadata: { description: 'List Gorgias support tickets, one page at a time, with optional filtering by customer ID and custom ordering. Use to discover or enumerate tickets when you do not have a specific ID; pass the cursor from a prior response to page through results. Idempotent read-only query.', idempotent: true },
16
- props: {
17
- customerId: pieces_framework_1.Property.Number({
18
- displayName: 'Customer ID',
19
- description: 'Optional customer ID to filter tickets for one customer.',
20
- required: false,
21
- }),
22
- cursor: pieces_framework_1.Property.ShortText({
23
- displayName: 'Cursor',
24
- description: 'Optional cursor returned by a previous list response.',
25
- required: false,
26
- }),
27
- limit: pieces_framework_1.Property.Number({
28
- displayName: 'Limit',
29
- description: 'Maximum number of tickets to return in this page. Defaults to 25.',
30
- required: false,
31
- defaultValue: 25,
32
- }),
33
- orderBy: pieces_framework_1.Property.ShortText({
34
- displayName: 'Order By',
35
- description: 'Optional ordering, for example `created_datetime:desc`.',
36
- required: false,
37
- }),
38
- },
39
- run(context) {
40
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
- const { customerId, cursor, limit, orderBy } = context.propsValue;
42
- return yield (0, client_1.gorgiasApiCall)({
43
- auth: context.auth,
44
- method: pieces_common_1.HttpMethod.GET,
45
- resourceUri: '/tickets',
46
- query: {
47
- customer_id: customerId,
48
- cursor,
49
- limit: limit !== null && limit !== void 0 ? limit : 25,
50
- order_by: orderBy,
51
- },
52
- });
53
- });
54
- },
55
- });
56
- //# sourceMappingURL=list-tickets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-tickets.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-tickets.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAsC;AACtC,6CAAuE;AAE1D,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,4DAA4D;IACzE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,mRAAmR,EAAE,UAAU,EAAE,IAAI,EAAE;IAClU,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAClE,OAAO,MAAM,IAAA,uBAAc,EAA+B;gBACxD,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE;oBACL,WAAW,EAAE,UAAU;oBACvB,MAAM;oBACN,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE;oBAClB,QAAQ,EAAE,OAAO;iBAClB;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- export declare const updateTicketAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
- domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
- email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
- }>, {
6
- ticketId: import("@activepieces/pieces-framework").NumberProperty<true>;
7
- subject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
- status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
9
- channel: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
10
- customerId: import("@activepieces/pieces-framework").NumberProperty<false>;
11
- customerEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
- fromAgent: import("@activepieces/pieces-framework").CheckboxProperty<false>;
13
- isUnread: import("@activepieces/pieces-framework").CheckboxProperty<false>;
14
- spam: import("@activepieces/pieces-framework").CheckboxProperty<false>;
15
- externalId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
16
- }>;
17
- //# sourceMappingURL=update-ticket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-ticket.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-ticket.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAyF7B,CAAC"}
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateTicketAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const auth_1 = require("../auth");
8
- const client_1 = require("../common/client");
9
- const constants_1 = require("../common/constants");
10
- exports.updateTicketAction = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.gorgiasAuth,
12
- name: 'update_gorgias_ticket',
13
- displayName: 'Update Ticket',
14
- description: 'Update a Gorgias ticket.',
15
- audience: 'both',
16
- aiMetadata: { description: 'Modify fields on an existing Gorgias ticket identified by its numeric ID, such as subject, status (e.g. open/closed), channel, attached customer, spam/unread flags, or external ID. Use to change ticket state or metadata; this does not add a reply or message (use Create Message for that). Idempotent: it sets fields to the supplied values, so repeating the same call leaves the ticket in the same state.', idempotent: true },
17
- props: {
18
- ticketId: pieces_framework_1.Property.Number({
19
- displayName: 'Ticket ID',
20
- required: true,
21
- }),
22
- subject: pieces_framework_1.Property.ShortText({
23
- displayName: 'Subject',
24
- required: false,
25
- }),
26
- status: pieces_framework_1.Property.StaticDropdown({
27
- displayName: 'Status',
28
- required: false,
29
- options: constants_1.GORGIAS_TICKET_STATUS_OPTIONS,
30
- }),
31
- channel: pieces_framework_1.Property.StaticDropdown({
32
- displayName: 'Channel',
33
- required: false,
34
- options: constants_1.GORGIAS_CHANNEL_OPTIONS,
35
- }),
36
- customerId: pieces_framework_1.Property.Number({
37
- displayName: 'Customer ID',
38
- description: 'Optional customer ID to attach to the ticket.',
39
- required: false,
40
- }),
41
- customerEmail: pieces_framework_1.Property.ShortText({
42
- displayName: 'Customer Email',
43
- description: 'Optional customer email to attach alongside the customer ID.',
44
- required: false,
45
- }),
46
- fromAgent: pieces_framework_1.Property.Checkbox({
47
- displayName: 'From Agent',
48
- description: 'Whether the first message of the ticket was sent by your company.',
49
- required: false,
50
- }),
51
- isUnread: pieces_framework_1.Property.Checkbox({
52
- displayName: 'Is Unread',
53
- required: false,
54
- }),
55
- spam: pieces_framework_1.Property.Checkbox({
56
- displayName: 'Spam',
57
- required: false,
58
- }),
59
- externalId: pieces_framework_1.Property.ShortText({
60
- displayName: 'External ID',
61
- required: false,
62
- }),
63
- },
64
- run(context) {
65
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
- const { ticketId, subject, status, channel, customerId, customerEmail, fromAgent, isUnread, spam, externalId, } = context.propsValue;
67
- return yield (0, client_1.gorgiasApiCall)({
68
- auth: context.auth,
69
- method: pieces_common_1.HttpMethod.PUT,
70
- resourceUri: `/tickets/${ticketId}`,
71
- body: {
72
- subject,
73
- status,
74
- channel,
75
- external_id: externalId,
76
- from_agent: fromAgent,
77
- is_unread: isUnread,
78
- spam,
79
- customer: customerId
80
- ? {
81
- id: customerId,
82
- email: customerEmail,
83
- }
84
- : undefined,
85
- },
86
- });
87
- });
88
- },
89
- });
90
- //# sourceMappingURL=update-ticket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-ticket.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-ticket.ts"],"names":[],"mappings":";;;;AAA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AAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EACJ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,UAAU,GACX,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,OAAO,MAAM,IAAA,uBAAc,EAAC;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,YAAY,QAAQ,EAAE;gBACnC,IAAI,EAAE;oBACJ,OAAO;oBACP,MAAM;oBACN,OAAO;oBACP,WAAW,EAAE,UAAU;oBACvB,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,QAAQ;oBACnB,IAAI;oBACJ,QAAQ,EAAE,UAAU;wBAClB,CAAC,CAAC;4BACE,EAAE,EAAE,UAAU;4BACd,KAAK,EAAE,aAAa;yBACrB;wBACH,CAAC,CAAC,SAAS;iBACd;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
package/src/lib/auth.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
2
- export type GorgiasAuth = AppConnectionValueForAuthProperty<typeof gorgiasAuth>;
3
- export declare function normalizeGorgiasDomain(input: string): string;
4
- export declare function getGorgiasBaseUrl(domain: string): string;
5
- export declare const gorgiasAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
6
- domain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
- email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
- api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
9
- }>;
10
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAuB,MAAM,gCAAgC,CAAC;AAOxG,MAAM,MAAM,WAAW,GAAG,iCAAiC,CAAC,OAAO,WAAW,CAAC,CAAA;AAE/E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,WAAW;;;;EAkDtB,CAAC"}
package/src/lib/auth.js DELETED
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gorgiasAuth = void 0;
4
- exports.normalizeGorgiasDomain = normalizeGorgiasDomain;
5
- exports.getGorgiasBaseUrl = getGorgiasBaseUrl;
6
- const tslib_1 = require("tslib");
7
- const pieces_framework_1 = require("@activepieces/pieces-framework");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- function normalizeGorgiasDomain(input) {
10
- return input
11
- .trim()
12
- .replace(/^https?:\/\//, '')
13
- .replace(/\.gorgias\.com.*$/i, '')
14
- .replace(/^www\./, '')
15
- .replace(/\/$/, '');
16
- }
17
- function getGorgiasBaseUrl(domain) {
18
- return `https://${normalizeGorgiasDomain(domain)}.gorgias.com/api`;
19
- }
20
- exports.gorgiasAuth = pieces_framework_1.PieceAuth.CustomAuth({
21
- displayName: 'Gorgias',
22
- required: true,
23
- description: `To connect your Gorgias account:
24
-
25
- 1. Copy your helpdesk subdomain (for example, \`acme\` from \`https://acme.gorgias.com\`).
26
- 2. In Gorgias, create or copy an API key.
27
- 3. Use the email address associated with that API key.
28
-
29
- Authentication uses HTTP Basic auth with \`email:api_key\`.`,
30
- props: {
31
- domain: pieces_framework_1.Property.ShortText({
32
- displayName: 'Helpdesk Domain',
33
- description: 'Your Gorgias subdomain only, for example `acme` from https://acme.gorgias.com.',
34
- required: true,
35
- }),
36
- email: pieces_framework_1.Property.ShortText({
37
- displayName: 'Email Address',
38
- description: 'The email address associated with your Gorgias API key.',
39
- required: true,
40
- }),
41
- api_key: pieces_framework_1.PieceAuth.SecretText({
42
- displayName: 'API Key',
43
- description: 'Your Gorgias API key.',
44
- required: true,
45
- }),
46
- },
47
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
48
- var _b, _c;
49
- try {
50
- yield pieces_common_1.httpClient.sendRequest({
51
- method: pieces_common_1.HttpMethod.GET,
52
- url: `${getGorgiasBaseUrl(auth.domain)}/tickets`,
53
- authentication: {
54
- type: pieces_common_1.AuthenticationType.BASIC,
55
- username: auth.email,
56
- password: auth.api_key,
57
- },
58
- queryParams: {
59
- limit: '1',
60
- },
61
- });
62
- return { valid: true };
63
- }
64
- catch (error) {
65
- const err = error;
66
- if (((_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status) === 401 || ((_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.status) === 403) {
67
- return { valid: false, error: 'Invalid domain, email, or API key.' };
68
- }
69
- return { valid: false, error: 'Could not reach the Gorgias API. Check your domain and network.' };
70
- }
71
- }),
72
- });
73
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;AASA,wDAOC;AAED,8CAEC;;AApBD,qEAAwG;AACxG,+DAIqC;AAIrC,SAAgB,sBAAsB,CAAC,KAAa;IAClD,OAAO,KAAK;SACT,IAAI,EAAE;SACN,OAAO,CAAC,cAAc,EAAE,EAAE,CAA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CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,KAA2C,CAAC;YACxD,IAAI,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,MAAM,MAAK,GAAG,IAAI,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBACnE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,oCAAoC,EAAE,CAAC;YACvE,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iEAAiE,EAAE,CAAC;QACpG,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -1,31 +0,0 @@
1
- import { HttpMessageBody, HttpMethod } from '@activepieces/pieces-common';
2
- import { GorgiasAuth } from '../auth';
3
- export type GorgiasPaginationMeta = {
4
- prev_cursor?: string | null;
5
- next_cursor?: string | null;
6
- };
7
- export type GorgiasListResponse<T> = {
8
- data: T[];
9
- object: string;
10
- uri: string;
11
- meta: GorgiasPaginationMeta;
12
- };
13
- export type GorgiasCustomer = {
14
- id: number;
15
- email?: string;
16
- name?: string;
17
- channels?: Array<{
18
- address?: string;
19
- }>;
20
- [key: string]: unknown;
21
- };
22
- export type GorgiasRequestParams = {
23
- auth: GorgiasAuth;
24
- method: HttpMethod;
25
- resourceUri: string;
26
- query?: Record<string, string | number | boolean | undefined>;
27
- body?: unknown;
28
- };
29
- export declare function gorgiasApiCall<T extends HttpMessageBody>({ auth, method, resourceUri, query, body, }: GorgiasRequestParams): Promise<T>;
30
- export declare function findCustomerByEmail(auth: GorgiasAuth, email: string): Promise<GorgiasCustomer | null>;
31
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../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E,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAoBjC"}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gorgiasApiCall = gorgiasApiCall;
4
- exports.findCustomerByEmail = findCustomerByEmail;
5
- const tslib_1 = require("tslib");
6
- const pieces_common_1 = require("@activepieces/pieces-common");
7
- const auth_1 = require("../auth");
8
- function gorgiasApiCall(_a) {
9
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, resourceUri, query, body, }) {
10
- const queryParams = {};
11
- if (query) {
12
- for (const [key, value] of Object.entries(query)) {
13
- if (value !== undefined && value !== null && value !== '') {
14
- queryParams[key] = String(value);
15
- }
16
- }
17
- }
18
- const request = {
19
- method,
20
- url: `${(0, auth_1.getGorgiasBaseUrl)(auth.props.domain)}${resourceUri}`,
21
- authentication: {
22
- type: pieces_common_1.AuthenticationType.BASIC,
23
- username: auth.props.email,
24
- password: auth.props.api_key,
25
- },
26
- headers: {
27
- Accept: 'application/json',
28
- 'Content-Type': 'application/json',
29
- },
30
- queryParams,
31
- body,
32
- };
33
- const response = yield pieces_common_1.httpClient.sendRequest(request);
34
- return response.body;
35
- });
36
- }
37
- function findCustomerByEmail(auth, email) {
38
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
39
- var _a;
40
- const lowerEmail = email.trim().toLowerCase();
41
- const response = yield gorgiasApiCall({
42
- auth,
43
- method: pieces_common_1.HttpMethod.GET,
44
- resourceUri: '/customers',
45
- query: {
46
- email: lowerEmail,
47
- limit: 100,
48
- },
49
- });
50
- return (_a = response.data.find((customer) => {
51
- const primaryEmail = typeof customer.email === 'string' ? customer.email.toLowerCase() : undefined;
52
- const channelMatch = Array.isArray(customer.channels)
53
- ? customer.channels.some((channel) => { var _a; return ((_a = channel.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === lowerEmail; })
54
- : false;
55
- return primaryEmail === lowerEmail || channelMatch;
56
- })) !== null && _a !== void 0 ? _a : null;
57
- });
58
- }
59
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAsCA,wCAmCC;AAED,kDAuBC;;AAlGD,+DAOqC;AACrC,kCAAyD;AA8BzD,SAAsB,cAAc;iEAA4B,EAC9D,IAAI,EACJ,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,GACiB;QACrB,MAAM,WAAW,GAAgB,EAAE,CAAC;QAEpC,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;oBAC1D,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAgB;YAC3B,MAAM;YACN,GAAG,EAAE,GAAG,IAAA,wBAAiB,EAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,WAAW,EAAE;YAC5D,cAAc,EAAE;gBACd,IAAI,EAAE,kCAAkB,CAAC,KAAK;gBAC9B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;gBAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;aAC7B;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,WAAW;YACX,IAAI;SACL,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAI,OAAO,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CAAA;AAED,SAAsB,mBAAmB,CACvC,IAAiB,EACjB,KAAa;;;QAEb,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAE9C,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAuC;YAC1E,IAAI;YACJ,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,WAAW,EAAE,YAAY;YACzB,KAAK,EAAE;gBACL,KAAK,EAAE,UAAU;gBACjB,KAAK,EAAE,GAAG;aACX;SACF,CAAC,CAAC;QAEH,OAAO,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACrC,MAAM,YAAY,GAAG,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YACnG,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACnD,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,EAAE,MAAK,UAAU,CAAA,EAAA,CAAC;gBACpF,CAAC,CAAC,KAAK,CAAC;YACV,OAAO,YAAY,KAAK,UAAU,IAAI,YAAY,CAAC;QACrD,CAAC,CAAC,mCAAI,IAAI,CAAC;IACb,CAAC;CAAA"}
@@ -1,19 +0,0 @@
1
- export declare const GORGIAS_CHANNEL_OPTIONS: {
2
- options: {
3
- label: string;
4
- value: string;
5
- }[];
6
- };
7
- export declare const GORGIAS_VIA_OPTIONS: {
8
- options: {
9
- label: string;
10
- value: string;
11
- }[];
12
- };
13
- export declare const GORGIAS_TICKET_STATUS_OPTIONS: {
14
- options: {
15
- label: string;
16
- value: string;
17
- }[];
18
- };
19
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;CAUnC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;CAO/B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;CAKzC,CAAC"}