@activepieces/piece-gorgias 0.0.2 → 0.0.4
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.
- package/package.json +7 -12
- package/src/index.js +13 -44
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/create-message.d.ts +0 -18
- package/src/lib/actions/create-message.d.ts.map +0 -1
- package/src/lib/actions/create-message.js +0 -108
- package/src/lib/actions/create-message.js.map +0 -1
- package/src/lib/actions/create-ticket.d.ts +0 -13
- package/src/lib/actions/create-ticket.d.ts.map +0 -1
- package/src/lib/actions/create-ticket.js +0 -81
- package/src/lib/actions/create-ticket.js.map +0 -1
- package/src/lib/actions/get-customer.d.ts +0 -9
- package/src/lib/actions/get-customer.d.ts.map +0 -1
- package/src/lib/actions/get-customer.js +0 -47
- package/src/lib/actions/get-customer.js.map +0 -1
- package/src/lib/actions/get-ticket.d.ts +0 -8
- package/src/lib/actions/get-ticket.d.ts.map +0 -1
- package/src/lib/actions/get-ticket.js +0 -30
- package/src/lib/actions/get-ticket.js.map +0 -1
- package/src/lib/actions/list-tickets.d.ts +0 -11
- package/src/lib/actions/list-tickets.d.ts.map +0 -1
- package/src/lib/actions/list-tickets.js +0 -54
- package/src/lib/actions/list-tickets.js.map +0 -1
- package/src/lib/actions/update-ticket.d.ts +0 -17
- package/src/lib/actions/update-ticket.d.ts.map +0 -1
- package/src/lib/actions/update-ticket.js +0 -88
- package/src/lib/actions/update-ticket.js.map +0 -1
- package/src/lib/auth.d.ts +0 -10
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -73
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -31
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -59
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/constants.d.ts +0 -19
- package/src/lib/common/constants.d.ts.map +0 -1
- package/src/lib/common/constants.js +0 -29
- package/src/lib/common/constants.js.map +0 -1
|
@@ -1,81 +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
|
-
props: {
|
|
16
|
-
fromAddress: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'From Address',
|
|
18
|
-
description: 'The sender address for the initial message, typically the customer email.',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
toAddress: pieces_framework_1.Property.ShortText({
|
|
22
|
-
displayName: 'To Address',
|
|
23
|
-
description: 'The recipient address for the initial message.',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
subject: pieces_framework_1.Property.ShortText({
|
|
27
|
-
displayName: 'Subject',
|
|
28
|
-
required: true,
|
|
29
|
-
}),
|
|
30
|
-
message: pieces_framework_1.Property.LongText({
|
|
31
|
-
displayName: 'Message',
|
|
32
|
-
description: 'Initial ticket message. HTML is accepted by the API.',
|
|
33
|
-
required: true,
|
|
34
|
-
}),
|
|
35
|
-
channel: pieces_framework_1.Property.StaticDropdown({
|
|
36
|
-
displayName: 'Channel',
|
|
37
|
-
required: true,
|
|
38
|
-
options: constants_1.GORGIAS_CHANNEL_OPTIONS,
|
|
39
|
-
defaultValue: 'email',
|
|
40
|
-
}),
|
|
41
|
-
via: pieces_framework_1.Property.StaticDropdown({
|
|
42
|
-
displayName: 'Via',
|
|
43
|
-
description: 'How the message reached Gorgias.',
|
|
44
|
-
required: true,
|
|
45
|
-
options: constants_1.GORGIAS_VIA_OPTIONS,
|
|
46
|
-
defaultValue: 'api',
|
|
47
|
-
}),
|
|
48
|
-
},
|
|
49
|
-
run(context) {
|
|
50
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const { fromAddress, toAddress, subject, message, channel, via } = context.propsValue;
|
|
52
|
-
return yield (0, client_1.gorgiasApiCall)({
|
|
53
|
-
auth: context.auth,
|
|
54
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
55
|
-
resourceUri: '/tickets',
|
|
56
|
-
body: {
|
|
57
|
-
messages: [
|
|
58
|
-
{
|
|
59
|
-
from_agent: false,
|
|
60
|
-
subject,
|
|
61
|
-
body_html: message,
|
|
62
|
-
channel,
|
|
63
|
-
via,
|
|
64
|
-
source: {
|
|
65
|
-
from: {
|
|
66
|
-
address: fromAddress,
|
|
67
|
-
},
|
|
68
|
-
to: [
|
|
69
|
-
{
|
|
70
|
-
address: toAddress,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
//# 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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,OAAO;4BACP,SAAS,EAAE,OAAO;4BAClB,OAAO;4BACP,GAAG;4BACH,MAAM,EAAE;gCACN,IAAI,EAAE;oCACJ,OAAO,EAAE,WAAW;iCACrB;gCACD,EAAE,EAAE;oCACF;wCACE,OAAO,EAAE,SAAS;qCACnB;iCACF;6BACF;yBACF;qBACF;iBACF;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const getCustomerAction: 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;;;;;;;EA2C5B,CAAC"}
|
|
@@ -1,47 +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
|
-
props: {
|
|
15
|
-
customerId: pieces_framework_1.Property.Number({
|
|
16
|
-
displayName: 'Customer ID',
|
|
17
|
-
description: 'Use this when you already know the customer ID.',
|
|
18
|
-
required: false,
|
|
19
|
-
}),
|
|
20
|
-
email: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Email',
|
|
22
|
-
description: 'If Customer ID is not provided, search customers by email using Gorgias server-side filtering.',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
26
|
-
run(context) {
|
|
27
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const { customerId, email } = context.propsValue;
|
|
29
|
-
if (customerId) {
|
|
30
|
-
return yield (0, client_1.gorgiasApiCall)({
|
|
31
|
-
auth: context.auth,
|
|
32
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
33
|
-
resourceUri: `/customers/${customerId}`,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (!email) {
|
|
37
|
-
throw new Error('Provide either Customer ID or Email.');
|
|
38
|
-
}
|
|
39
|
-
const customer = yield (0, client_1.findCustomerByEmail)(context.auth, email);
|
|
40
|
-
if (!customer) {
|
|
41
|
-
throw new Error(`No customer found for email: ${email}`);
|
|
42
|
-
}
|
|
43
|
-
return customer;
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
//# 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,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;;;;;;EAkB1B,CAAC"}
|
|
@@ -1,30 +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
|
-
props: {
|
|
15
|
-
ticketId: pieces_framework_1.Property.Number({
|
|
16
|
-
displayName: 'Ticket ID',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
run(context) {
|
|
21
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return yield (0, client_1.gorgiasApiCall)({
|
|
23
|
-
auth: context.auth,
|
|
24
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
-
resourceUri: `/tickets/${context.propsValue.ticketId}`,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
//# 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,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;;;;;;;;;EA0C5B,CAAC"}
|
|
@@ -1,54 +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
|
-
props: {
|
|
15
|
-
customerId: pieces_framework_1.Property.Number({
|
|
16
|
-
displayName: 'Customer ID',
|
|
17
|
-
description: 'Optional customer ID to filter tickets for one customer.',
|
|
18
|
-
required: false,
|
|
19
|
-
}),
|
|
20
|
-
cursor: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Cursor',
|
|
22
|
-
description: 'Optional cursor returned by a previous list response.',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
limit: pieces_framework_1.Property.Number({
|
|
26
|
-
displayName: 'Limit',
|
|
27
|
-
description: 'Maximum number of tickets to return in this page. Defaults to 25.',
|
|
28
|
-
required: false,
|
|
29
|
-
defaultValue: 25,
|
|
30
|
-
}),
|
|
31
|
-
orderBy: pieces_framework_1.Property.ShortText({
|
|
32
|
-
displayName: 'Order By',
|
|
33
|
-
description: 'Optional ordering, for example `created_datetime:desc`.',
|
|
34
|
-
required: false,
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
run(context) {
|
|
38
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const { customerId, cursor, limit, orderBy } = context.propsValue;
|
|
40
|
-
return yield (0, client_1.gorgiasApiCall)({
|
|
41
|
-
auth: context.auth,
|
|
42
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
43
|
-
resourceUri: '/tickets',
|
|
44
|
-
query: {
|
|
45
|
-
customer_id: customerId,
|
|
46
|
-
cursor,
|
|
47
|
-
limit: limit !== null && limit !== void 0 ? limit : 25,
|
|
48
|
-
order_by: orderBy,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
//# 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,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;;;;;;;;;;;;;;;EAuF7B,CAAC"}
|
|
@@ -1,88 +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
|
-
props: {
|
|
16
|
-
ticketId: pieces_framework_1.Property.Number({
|
|
17
|
-
displayName: 'Ticket ID',
|
|
18
|
-
required: true,
|
|
19
|
-
}),
|
|
20
|
-
subject: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Subject',
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
25
|
-
displayName: 'Status',
|
|
26
|
-
required: false,
|
|
27
|
-
options: constants_1.GORGIAS_TICKET_STATUS_OPTIONS,
|
|
28
|
-
}),
|
|
29
|
-
channel: pieces_framework_1.Property.StaticDropdown({
|
|
30
|
-
displayName: 'Channel',
|
|
31
|
-
required: false,
|
|
32
|
-
options: constants_1.GORGIAS_CHANNEL_OPTIONS,
|
|
33
|
-
}),
|
|
34
|
-
customerId: pieces_framework_1.Property.Number({
|
|
35
|
-
displayName: 'Customer ID',
|
|
36
|
-
description: 'Optional customer ID to attach to the ticket.',
|
|
37
|
-
required: false,
|
|
38
|
-
}),
|
|
39
|
-
customerEmail: pieces_framework_1.Property.ShortText({
|
|
40
|
-
displayName: 'Customer Email',
|
|
41
|
-
description: 'Optional customer email to attach alongside the customer ID.',
|
|
42
|
-
required: false,
|
|
43
|
-
}),
|
|
44
|
-
fromAgent: pieces_framework_1.Property.Checkbox({
|
|
45
|
-
displayName: 'From Agent',
|
|
46
|
-
description: 'Whether the first message of the ticket was sent by your company.',
|
|
47
|
-
required: false,
|
|
48
|
-
}),
|
|
49
|
-
isUnread: pieces_framework_1.Property.Checkbox({
|
|
50
|
-
displayName: 'Is Unread',
|
|
51
|
-
required: false,
|
|
52
|
-
}),
|
|
53
|
-
spam: pieces_framework_1.Property.Checkbox({
|
|
54
|
-
displayName: 'Spam',
|
|
55
|
-
required: false,
|
|
56
|
-
}),
|
|
57
|
-
externalId: pieces_framework_1.Property.ShortText({
|
|
58
|
-
displayName: 'External ID',
|
|
59
|
-
required: false,
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
run(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const { ticketId, subject, status, channel, customerId, customerEmail, fromAgent, isUnread, spam, externalId, } = context.propsValue;
|
|
65
|
-
return yield (0, client_1.gorgiasApiCall)({
|
|
66
|
-
auth: context.auth,
|
|
67
|
-
method: pieces_common_1.HttpMethod.PUT,
|
|
68
|
-
resourceUri: `/tickets/${ticketId}`,
|
|
69
|
-
body: {
|
|
70
|
-
subject,
|
|
71
|
-
status,
|
|
72
|
-
channel,
|
|
73
|
-
external_id: externalId,
|
|
74
|
-
from_agent: fromAgent,
|
|
75
|
-
is_unread: isUnread,
|
|
76
|
-
spam,
|
|
77
|
-
customer: customerId
|
|
78
|
-
? {
|
|
79
|
-
id: customerId,
|
|
80
|
-
email: customerEmail,
|
|
81
|
-
}
|
|
82
|
-
: undefined,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
//# 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":";;;;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,0BAA0B;IACvC,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,yCAA6B;SACvC,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC/B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,mCAAuB;SACjC,CAAC;QACF,UAAU,EAAE,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AC,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
|
package/src/lib/auth.d.ts.map
DELETED
|
@@ -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
|
package/src/lib/auth.js.map
DELETED
|
@@ -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,CAAC;SAC3B,OAAO,CAAC,oBAAoB,EAAE,EAAE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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":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,UAAU,EAGX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACnC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAsB,cAAc,CAAC,CAAC,SAAS,eAAe,EAAE,EAC9D,IAAI,EACJ,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,GACL,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC,CA6BnC;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAoBjC"}
|
package/src/lib/common/client.js
DELETED
|
@@ -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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AAK,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"}
|