@activepieces/piece-savvycal 0.0.1
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 +16 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +75 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/cancel-event.d.ts +3 -0
- package/src/lib/actions/cancel-event.js +36 -0
- package/src/lib/actions/cancel-event.js.map +1 -0
- package/src/lib/actions/create-event.d.ts +7 -0
- package/src/lib/actions/create-event.js +88 -0
- package/src/lib/actions/create-event.js.map +1 -0
- package/src/lib/actions/find-events-by-email.d.ts +5 -0
- package/src/lib/actions/find-events-by-email.js +51 -0
- package/src/lib/actions/find-events-by-email.js.map +1 -0
- package/src/lib/actions/get-current-user.d.ts +1 -0
- package/src/lib/actions/get-current-user.js +36 -0
- package/src/lib/actions/get-current-user.js.map +1 -0
- package/src/lib/actions/get-event.d.ts +3 -0
- package/src/lib/actions/get-event.js +32 -0
- package/src/lib/actions/get-event.js.map +1 -0
- package/src/lib/actions/list-events.d.ts +7 -0
- package/src/lib/actions/list-events.js +95 -0
- package/src/lib/actions/list-events.js.map +1 -0
- package/src/lib/actions/list-scheduling-links.d.ts +1 -0
- package/src/lib/actions/list-scheduling-links.js +36 -0
- package/src/lib/actions/list-scheduling-links.js.map +1 -0
- package/src/lib/common/index.d.ts +70 -0
- package/src/lib/common/index.js +82 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/common/webhook-trigger-factory.d.ts +7 -0
- package/src/lib/common/webhook-trigger-factory.js +96 -0
- package/src/lib/common/webhook-trigger-factory.js.map +1 -0
- package/src/lib/triggers/booking-canceled.d.ts +1 -0
- package/src/lib/triggers/booking-canceled.js +11 -0
- package/src/lib/triggers/booking-canceled.js.map +1 -0
- package/src/lib/triggers/booking-rescheduled.d.ts +1 -0
- package/src/lib/triggers/booking-rescheduled.js +11 -0
- package/src/lib/triggers/booking-rescheduled.js.map +1 -0
- package/src/lib/triggers/new-booking.d.ts +1 -0
- package/src/lib/triggers/new-booking.js +11 -0
- package/src/lib/triggers/new-booking.js.map +1 -0
- package/src/lib/triggers/new-event.d.ts +10 -0
- package/src/lib/triggers/new-event.js +123 -0
- package/src/lib/triggers/new-event.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-savvycal",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
8
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@activepieces/pieces-common": "0.12.0",
|
|
12
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
13
|
+
"@activepieces/shared": "0.47.0",
|
|
14
|
+
"tslib": "2.6.2"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.savvyCal = exports.savvyCalAuth = 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 shared_1 = require("@activepieces/shared");
|
|
8
|
+
const get_current_user_1 = require("./lib/actions/get-current-user");
|
|
9
|
+
const list_events_1 = require("./lib/actions/list-events");
|
|
10
|
+
const get_event_1 = require("./lib/actions/get-event");
|
|
11
|
+
const cancel_event_1 = require("./lib/actions/cancel-event");
|
|
12
|
+
const create_event_1 = require("./lib/actions/create-event");
|
|
13
|
+
const find_events_by_email_1 = require("./lib/actions/find-events-by-email");
|
|
14
|
+
const list_scheduling_links_1 = require("./lib/actions/list-scheduling-links");
|
|
15
|
+
const new_booking_1 = require("./lib/triggers/new-booking");
|
|
16
|
+
const booking_canceled_1 = require("./lib/triggers/booking-canceled");
|
|
17
|
+
const booking_rescheduled_1 = require("./lib/triggers/booking-rescheduled");
|
|
18
|
+
const new_event_1 = require("./lib/triggers/new-event");
|
|
19
|
+
const common_1 = require("./lib/common");
|
|
20
|
+
exports.savvyCalAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
21
|
+
displayName: 'Personal Access Token',
|
|
22
|
+
description: `To get your SavvyCal API token:
|
|
23
|
+
1. Log in to your SavvyCal account at https://savvycal.com
|
|
24
|
+
2. Go to **Settings > Developer**
|
|
25
|
+
3. Click **Create Token**
|
|
26
|
+
4. Give it a name and copy the token (it starts with \`pt_secret_\`)
|
|
27
|
+
|
|
28
|
+
**Note:** Keep this token secret — it gives full access to your SavvyCal account.`,
|
|
29
|
+
required: true,
|
|
30
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
31
|
+
try {
|
|
32
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
33
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
34
|
+
url: `${common_1.SAVVYCAL_BASE_URL}/me`,
|
|
35
|
+
authentication: {
|
|
36
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
37
|
+
token: auth,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return { valid: true };
|
|
41
|
+
}
|
|
42
|
+
catch (_b) {
|
|
43
|
+
return { valid: false, error: 'Invalid token. Please check your Personal Access Token and try again.' };
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
exports.savvyCal = (0, pieces_framework_1.createPiece)({
|
|
48
|
+
displayName: 'SavvyCal',
|
|
49
|
+
description: 'Scheduling tool that lets invitees overlay their calendar when picking a time.',
|
|
50
|
+
minimumSupportedRelease: '0.36.1',
|
|
51
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/savvycal.png',
|
|
52
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
53
|
+
auth: exports.savvyCalAuth,
|
|
54
|
+
authors: ['bst1n', 'sanket-a11y'],
|
|
55
|
+
actions: [
|
|
56
|
+
get_current_user_1.getCurrentUserAction,
|
|
57
|
+
list_events_1.listEventsAction,
|
|
58
|
+
get_event_1.getEventAction,
|
|
59
|
+
cancel_event_1.cancelEventAction,
|
|
60
|
+
create_event_1.createEventAction,
|
|
61
|
+
find_events_by_email_1.findEventsByEmailAction,
|
|
62
|
+
list_scheduling_links_1.listSchedulingLinksAction,
|
|
63
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
64
|
+
baseUrl: () => common_1.SAVVYCAL_BASE_URL,
|
|
65
|
+
auth: exports.savvyCalAuth,
|
|
66
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
return ({
|
|
68
|
+
Authorization: `Bearer ${auth}`,
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
triggers: [new_booking_1.newBookingTrigger, booking_canceled_1.bookingCanceledTrigger, booking_rescheduled_1.bookingRescheduledTrigger, new_event_1.newEventTrigger],
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAoH;AACpH,iDAAqD;AAErD,qEAAsE;AACtE,2DAA6D;AAC7D,uDAAyD;AACzD,6DAA+D;AAC/D,6DAA+D;AAC/D,6EAA6E;AAC7E,+EAAgF;AAEhF,4DAA+D;AAC/D,sEAAyE;AACzE,4EAA+E;AAC/E,wDAA2D;AAE3D,yCAAiD;AAEpC,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C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iB,EAAE,yCAAsB,EAAE,+CAAyB,EAAE,2BAAe,CAAC;CAClG,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cancelEventAction = 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 common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
exports.cancelEventAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.savvyCalAuth,
|
|
11
|
+
name: 'cancel_event',
|
|
12
|
+
displayName: 'Cancel Event',
|
|
13
|
+
description: 'Cancels a scheduled meeting in SavvyCal.',
|
|
14
|
+
props: {
|
|
15
|
+
event_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Event ID',
|
|
17
|
+
description: 'The unique ID of the event to cancel. You can find this from the output of a trigger or the List Events / Get Event actions.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
yield (0, common_1.savvyCalApiCall)({
|
|
24
|
+
token: context.auth.secret_text,
|
|
25
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
26
|
+
path: `/events/${context.propsValue.event_id}/cancel`,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
event_id: context.propsValue.event_id,
|
|
31
|
+
message: 'Event cancelled successfully.',
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=cancel-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel-event.js","sourceRoot":"","sources":["../../../../src/lib/actions/cancel-event.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAA4C;AAC5C,8BAAsC;AAEzB,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,0CAA0C;IACvD,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,8HAA8H;YAC3I,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAA,wBAAe,EAAC;gBACpB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,WAAW,OAAO,CAAC,UAAU,CAAC,QAAQ,SAAS;aACtD,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;gBACrC,OAAO,EAAE,+BAA+B;aACzC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const createEventAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
link_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
start_at: import("@activepieces/pieces-framework").DateTimeProperty<true>;
|
|
4
|
+
end_at: import("@activepieces/pieces-framework").DateTimeProperty<true>;
|
|
5
|
+
attendee_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
attendee_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEventAction = 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 common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
exports.createEventAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.savvyCalAuth,
|
|
11
|
+
name: 'create_event',
|
|
12
|
+
displayName: 'Create Event',
|
|
13
|
+
description: 'Books a meeting on a scheduling link at a specific time slot.',
|
|
14
|
+
props: {
|
|
15
|
+
link_id: pieces_framework_1.Property.Dropdown({
|
|
16
|
+
auth: __1.savvyCalAuth,
|
|
17
|
+
displayName: 'Scheduling Link',
|
|
18
|
+
description: 'Select the scheduling link to book a meeting on.',
|
|
19
|
+
refreshers: [],
|
|
20
|
+
required: true,
|
|
21
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
22
|
+
if (!auth)
|
|
23
|
+
return {
|
|
24
|
+
disabled: true,
|
|
25
|
+
options: [],
|
|
26
|
+
placeholder: 'Please connect your account first',
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
const links = yield (0, common_1.savvyCalPaginatedCall)({
|
|
30
|
+
token: auth.secret_text,
|
|
31
|
+
path: '/links',
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
disabled: false,
|
|
35
|
+
options: links.map((l) => ({
|
|
36
|
+
label: `${l.name} (${l.slug})`,
|
|
37
|
+
value: l.id,
|
|
38
|
+
})),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (_b) {
|
|
42
|
+
return {
|
|
43
|
+
disabled: true,
|
|
44
|
+
options: [],
|
|
45
|
+
placeholder: 'Failed to load scheduling links. Check your connection.',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
start_at: pieces_framework_1.Property.DateTime({
|
|
51
|
+
displayName: 'Start Time',
|
|
52
|
+
description: 'The start date and time of the meeting. Must match an available slot on the scheduling link.',
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
end_at: pieces_framework_1.Property.DateTime({
|
|
56
|
+
displayName: 'End Time',
|
|
57
|
+
description: 'The End date and time of the meeting',
|
|
58
|
+
required: true,
|
|
59
|
+
}),
|
|
60
|
+
attendee_name: pieces_framework_1.Property.ShortText({
|
|
61
|
+
displayName: 'Attendee Name',
|
|
62
|
+
description: 'Full name of the person booking the meeting.',
|
|
63
|
+
required: true,
|
|
64
|
+
}),
|
|
65
|
+
attendee_email: pieces_framework_1.Property.ShortText({
|
|
66
|
+
displayName: 'Attendee Email',
|
|
67
|
+
description: 'Email address of the person booking the meeting.',
|
|
68
|
+
required: true,
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
run(context) {
|
|
72
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const response = yield (0, common_1.savvyCalApiCall)({
|
|
74
|
+
token: context.auth.secret_text,
|
|
75
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
76
|
+
path: `/links/${context.propsValue.link_id}/events`,
|
|
77
|
+
body: {
|
|
78
|
+
start_at: context.propsValue.start_at,
|
|
79
|
+
end_at: context.propsValue.end_at,
|
|
80
|
+
display_name: context.propsValue.attendee_name,
|
|
81
|
+
email: context.propsValue.attendee_email,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
return (0, common_1.flattenEvent)(response.body);
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=create-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-event.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-event.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAA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8FAA8F;YAChG,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAgB;gBACpD,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,UAAU,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS;gBACnD,IAAI,EAAE;oBACJ,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;oBACrC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;oBACjC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;oBAC9C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,cAAc;iBACzC;aACF,CAAC,CAAC;YACH,OAAO,IAAA,qBAAY,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const findEventsByEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
attendee_email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
start_after: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
4
|
+
start_before: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findEventsByEmailAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
exports.findEventsByEmailAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: __1.savvyCalAuth,
|
|
10
|
+
name: 'find_events_by_email',
|
|
11
|
+
displayName: 'Find Events by Attendee Email',
|
|
12
|
+
description: "Returns all events where the attendee's email matches the given address.",
|
|
13
|
+
props: {
|
|
14
|
+
attendee_email: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Attendee Email',
|
|
16
|
+
description: 'The email address of the attendee to search for.',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
start_after: pieces_framework_1.Property.DateTime({
|
|
20
|
+
displayName: 'Start After',
|
|
21
|
+
description: 'Only search events starting after this date. Use this to limit the search scope and improve performance.',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
start_before: pieces_framework_1.Property.DateTime({
|
|
25
|
+
displayName: 'Start Before',
|
|
26
|
+
description: 'Only search events starting before this date.',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
run(context) {
|
|
31
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const token = context.auth.secret_text;
|
|
33
|
+
const { attendee_email, start_after, start_before } = context.propsValue;
|
|
34
|
+
const queryParams = {};
|
|
35
|
+
if (start_after)
|
|
36
|
+
queryParams['start_after'] = start_after;
|
|
37
|
+
if (start_before)
|
|
38
|
+
queryParams['start_before'] = start_before;
|
|
39
|
+
const events = yield (0, common_1.savvyCalPaginatedCall)({
|
|
40
|
+
token,
|
|
41
|
+
path: '/events',
|
|
42
|
+
queryParams,
|
|
43
|
+
});
|
|
44
|
+
const normalizedEmail = attendee_email.toLowerCase().trim();
|
|
45
|
+
return events
|
|
46
|
+
.filter((e) => { var _a; return (_a = e.attendees) === null || _a === void 0 ? void 0 : _a.some((a) => { var _a; return ((_a = a.email) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === normalizedEmail; }); })
|
|
47
|
+
.map(common_1.flattenEvent);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=find-events-by-email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-events-by-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/find-events-by-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,sCAA+E;AAC/E,8BAAsC;AAEzB,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EAAE,0EAA0E;IACvF,KAAK,EAAE;QACL,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,0GAA0G;YACvH,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YACvC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEzE,MAAM,WAAW,GAA2B,EAAE,CAAC;YAC/C,IAAI,WAAW;gBAAE,WAAW,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;YAC1D,IAAI,YAAY;gBAAE,WAAW,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;YAE7D,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAqB,EAAgB;gBACxD,KAAK;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW;aACZ,CAAC,CAAC;YAEH,MAAM,eAAe,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;YAC5D,OAAO,MAAM;iBACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,MAAA,CAAC,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,CAAC,CAAC,KAAK,0CAAE,WAAW,EAAE,MAAK,eAAe,CAAA,EAAA,CAAC,CAAA,EAAA,CAAC;iBACnF,GAAG,CAAC,qBAAY,CAAC,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCurrentUserAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentUserAction = 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 common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
exports.getCurrentUserAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.savvyCalAuth,
|
|
11
|
+
name: 'get_current_user',
|
|
12
|
+
displayName: 'Get Current User',
|
|
13
|
+
description: 'Retrieves the profile of the currently authenticated SavvyCal user.',
|
|
14
|
+
props: {},
|
|
15
|
+
run(context) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
const response = yield (0, common_1.savvyCalApiCall)({
|
|
19
|
+
token: context.auth.secret_text,
|
|
20
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
21
|
+
path: '/me',
|
|
22
|
+
});
|
|
23
|
+
const user = response.body;
|
|
24
|
+
return {
|
|
25
|
+
id: user.id,
|
|
26
|
+
name: user.name,
|
|
27
|
+
email: user.email,
|
|
28
|
+
slug: (_a = user.slug) !== null && _a !== void 0 ? _a : null,
|
|
29
|
+
time_zone: (_b = user.time_zone) !== null && _b !== void 0 ? _b : null,
|
|
30
|
+
created_at: user.created_at,
|
|
31
|
+
updated_at: (_c = user.updated_at) !== null && _c !== void 0 ? _c : null,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=get-current-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-user.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-current-user.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;AACzD,sCAA4C;AAC5C,8BAAsC;AAEzB,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,qEAAqE;IAClF,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAQnC;gBACD,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,KAAK;aACZ,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mCAAI,IAAI;gBACvB,SAAS,EAAE,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI;gBACjC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,UAAU,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI;aACpC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEventAction = 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 common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
exports.getEventAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.savvyCalAuth,
|
|
11
|
+
name: 'get_event',
|
|
12
|
+
displayName: 'Get Event',
|
|
13
|
+
description: 'Retrieves the details of a specific scheduled meeting by its ID.',
|
|
14
|
+
props: {
|
|
15
|
+
event_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Event ID',
|
|
17
|
+
description: 'The unique ID of the event. You can find this in the event URL in SavvyCal, or from the output of a trigger or List Events action.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const response = yield (0, common_1.savvyCalApiCall)({
|
|
24
|
+
token: context.auth.secret_text,
|
|
25
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
26
|
+
path: `/events/${context.propsValue.event_id}`,
|
|
27
|
+
});
|
|
28
|
+
return (0, common_1.flattenEvent)(response.body);
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=get-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-event.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-event.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAAyE;AACzE,8BAAsC;AAEzB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,kEAAkE;IAC/E,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,oIAAoI;YACjJ,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAgB;gBACpD,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,WAAW,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE;aAC/C,CAAC,CAAC;YAEH,OAAO,IAAA,qBAAY,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const listEventsAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
state: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
3
|
+
start_after: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
4
|
+
start_before: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
5
|
+
link_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
6
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listEventsAction = 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 common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
exports.listEventsAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.savvyCalAuth,
|
|
11
|
+
name: 'list_events',
|
|
12
|
+
displayName: 'List Events',
|
|
13
|
+
description: 'Returns a list of scheduled meetings from your SavvyCal account.',
|
|
14
|
+
props: {
|
|
15
|
+
state: pieces_framework_1.Property.StaticDropdown({
|
|
16
|
+
displayName: 'State',
|
|
17
|
+
description: 'Filter events by their current status.',
|
|
18
|
+
required: false,
|
|
19
|
+
options: {
|
|
20
|
+
options: [
|
|
21
|
+
{ label: 'All', value: '' },
|
|
22
|
+
{ label: 'Confirmed', value: 'confirmed' },
|
|
23
|
+
{ label: 'Canceled', value: 'canceled' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
start_after: pieces_framework_1.Property.DateTime({
|
|
28
|
+
displayName: 'Start After',
|
|
29
|
+
description: 'Only return events that start after this date and time.',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
start_before: pieces_framework_1.Property.DateTime({
|
|
33
|
+
displayName: 'Start Before',
|
|
34
|
+
description: 'Only return events that start before this date and time.',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
link_id: pieces_framework_1.Property.Dropdown({
|
|
38
|
+
auth: __1.savvyCalAuth,
|
|
39
|
+
displayName: 'Scheduling Link',
|
|
40
|
+
description: 'Only return events booked through a specific scheduling link. Leave empty for all links.',
|
|
41
|
+
refreshers: [],
|
|
42
|
+
required: false,
|
|
43
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
44
|
+
if (!auth)
|
|
45
|
+
return { disabled: true, options: [], placeholder: 'Please connect your account first' };
|
|
46
|
+
try {
|
|
47
|
+
const links = yield (0, common_1.savvyCalPaginatedCall)({
|
|
48
|
+
token: auth,
|
|
49
|
+
path: '/links',
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
disabled: false,
|
|
53
|
+
options: links.map((l) => ({ label: `${l.name} (${l.slug})`, value: l.id })),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (_b) {
|
|
57
|
+
return { disabled: true, options: [], placeholder: 'Failed to load scheduling links.' };
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
limit: pieces_framework_1.Property.Number({
|
|
62
|
+
displayName: 'Maximum Results',
|
|
63
|
+
description: 'Maximum number of events to return. Leave empty to return all matching events.',
|
|
64
|
+
required: false,
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
run(context) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const token = context.auth.secret_text;
|
|
70
|
+
const { state, start_after, start_before, link_id, limit } = context.propsValue;
|
|
71
|
+
const queryParams = {};
|
|
72
|
+
if (state)
|
|
73
|
+
queryParams['state'] = state;
|
|
74
|
+
if (start_after)
|
|
75
|
+
queryParams['start_after'] = start_after;
|
|
76
|
+
if (start_before)
|
|
77
|
+
queryParams['start_before'] = start_before;
|
|
78
|
+
if (link_id)
|
|
79
|
+
queryParams['link_id'] = link_id;
|
|
80
|
+
if (limit) {
|
|
81
|
+
queryParams['limit'] = String(limit);
|
|
82
|
+
const response = yield (0, common_1.savvyCalApiCall)({
|
|
83
|
+
token,
|
|
84
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
85
|
+
path: '/events',
|
|
86
|
+
queryParams,
|
|
87
|
+
});
|
|
88
|
+
return response.body.entries.map(common_1.flattenEvent);
|
|
89
|
+
}
|
|
90
|
+
const events = yield (0, common_1.savvyCalPaginatedCall)({ token, path: '/events', queryParams });
|
|
91
|
+
return events.map(common_1.flattenEvent);
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=list-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-events.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-events.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,sCAAwH;AACxH,8BAAsC;AAEzB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,kEAAkE;IAC/E,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC7B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;oBAC3B,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBAC1C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;iBACzC;aACF;SACF,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,aAA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F,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;YACvC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhF,MAAM,WAAW,GAA2B,EAAE,CAAC;YAC/C,IAAI,KAAK;gBAAE,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACxC,IAAI,WAAW;gBAAE,WAAW,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC;YAC1D,IAAI,YAAY;gBAAE,WAAW,CAAC,cAAc,CAAC,GAAG,YAAY,CAAC;YAC7D,IAAI,OAAO;gBAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YAE9C,IAAI,KAAK,EAAE,CAAC;gBACV,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBACrC,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAA+B;oBACnE,KAAK;oBACL,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,IAAI,EAAE,SAAS;oBACf,WAAW;iBACZ,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC;YACjD,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAqB,EAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;YACnG,OAAO,MAAM,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC;QAClC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listSchedulingLinksAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listSchedulingLinksAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const __1 = require("../../");
|
|
8
|
+
exports.listSchedulingLinksAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: __1.savvyCalAuth,
|
|
10
|
+
name: 'list_scheduling_links',
|
|
11
|
+
displayName: 'List Scheduling Links',
|
|
12
|
+
description: 'Returns all scheduling links configured in your SavvyCal account.',
|
|
13
|
+
props: {},
|
|
14
|
+
run(context) {
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const links = yield (0, common_1.savvyCalPaginatedCall)({
|
|
17
|
+
token: context.auth.secret_text,
|
|
18
|
+
path: '/links',
|
|
19
|
+
});
|
|
20
|
+
return links.map((link) => {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
return ({
|
|
23
|
+
id: link.id,
|
|
24
|
+
name: link.name,
|
|
25
|
+
slug: link.slug,
|
|
26
|
+
url: (_a = link.url) !== null && _a !== void 0 ? _a : null,
|
|
27
|
+
active: (_b = link.active) !== null && _b !== void 0 ? _b : null,
|
|
28
|
+
duration_minutes: (_c = link.duration) !== null && _c !== void 0 ? _c : null,
|
|
29
|
+
created_at: link.created_at,
|
|
30
|
+
updated_at: link.updated_at,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=list-scheduling-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-scheduling-links.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-scheduling-links.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,sCAA0E;AAC1E,8BAAsC;AAEzB,QAAA,yBAAyB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,mEAAmE;IAChF,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;YACf,MAAM,KAAK,GAAG,MAAM,IAAA,8BAAqB,EAAyB;gBAChE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YAEH,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBAC1B,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,mCAAI,IAAI;oBACrB,MAAM,EAAE,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI;oBAC3B,gBAAgB,EAAE,MAAA,IAAI,CAAC,QAAQ,mCAAI,IAAI;oBACvC,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;iBAC5B,CAAC,CAAA;aAAA,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { HttpMethod, HttpMessageBody, HttpResponse } from '@activepieces/pieces-common';
|
|
2
|
+
export declare const SAVVYCAL_BASE_URL = "https://api.savvycal.com/v1";
|
|
3
|
+
export declare function savvyCalApiCall<T extends HttpMessageBody>({ token, method, path, body, queryParams, }: {
|
|
4
|
+
token: string;
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
path: string;
|
|
7
|
+
body?: unknown;
|
|
8
|
+
queryParams?: Record<string, string>;
|
|
9
|
+
}): Promise<HttpResponse<T>>;
|
|
10
|
+
export declare function savvyCalPaginatedCall<T>({ token, path, queryParams, }: {
|
|
11
|
+
token: string;
|
|
12
|
+
path: string;
|
|
13
|
+
queryParams?: Record<string, string>;
|
|
14
|
+
}): Promise<T[]>;
|
|
15
|
+
export declare function flattenEvent(event: SavvyCalEvent): Record<string, unknown>;
|
|
16
|
+
export interface SavvyCalAttendee {
|
|
17
|
+
id: string;
|
|
18
|
+
first_name: string | null;
|
|
19
|
+
last_name: string | null;
|
|
20
|
+
display_name: string | null;
|
|
21
|
+
email: string;
|
|
22
|
+
phone_number: string | null;
|
|
23
|
+
time_zone: string | null;
|
|
24
|
+
is_organizer: boolean;
|
|
25
|
+
response_status: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface SavvyCalEvent {
|
|
28
|
+
id: string;
|
|
29
|
+
summary: string | null;
|
|
30
|
+
description: string | null;
|
|
31
|
+
duration: number;
|
|
32
|
+
start_at: string;
|
|
33
|
+
end_at: string;
|
|
34
|
+
state: string;
|
|
35
|
+
url: string | null;
|
|
36
|
+
created_at: string;
|
|
37
|
+
canceled_at: string | null;
|
|
38
|
+
cancel_reason: string | null;
|
|
39
|
+
rescheduled_at: string | null;
|
|
40
|
+
reschedule_reason: string | null;
|
|
41
|
+
original_start_at: string | null;
|
|
42
|
+
original_end_at: string | null;
|
|
43
|
+
is_group_session: boolean;
|
|
44
|
+
location: string | null;
|
|
45
|
+
attendees: SavvyCalAttendee[];
|
|
46
|
+
conferencing: {
|
|
47
|
+
type: string | null;
|
|
48
|
+
join_url: string | null;
|
|
49
|
+
meeting_id: string | null;
|
|
50
|
+
} | null;
|
|
51
|
+
link: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
slug: string;
|
|
55
|
+
} | null;
|
|
56
|
+
payment: {
|
|
57
|
+
state: string;
|
|
58
|
+
amount_total: number | null;
|
|
59
|
+
} | null;
|
|
60
|
+
}
|
|
61
|
+
export interface SavvyCalSchedulingLink {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
slug: string;
|
|
65
|
+
url: string;
|
|
66
|
+
active: boolean;
|
|
67
|
+
duration: number | null;
|
|
68
|
+
created_at: string;
|
|
69
|
+
updated_at: string;
|
|
70
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SAVVYCAL_BASE_URL = void 0;
|
|
4
|
+
exports.savvyCalApiCall = savvyCalApiCall;
|
|
5
|
+
exports.savvyCalPaginatedCall = savvyCalPaginatedCall;
|
|
6
|
+
exports.flattenEvent = flattenEvent;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.SAVVYCAL_BASE_URL = 'https://api.savvycal.com/v1';
|
|
10
|
+
function savvyCalApiCall(_a) {
|
|
11
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ token, method, path, body, queryParams, }) {
|
|
12
|
+
console.log("sdfsd", token);
|
|
13
|
+
return pieces_common_1.httpClient.sendRequest({
|
|
14
|
+
method,
|
|
15
|
+
url: `${exports.SAVVYCAL_BASE_URL}${path}`,
|
|
16
|
+
authentication: {
|
|
17
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
18
|
+
token,
|
|
19
|
+
},
|
|
20
|
+
queryParams,
|
|
21
|
+
body,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function savvyCalPaginatedCall(_a) {
|
|
26
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ token, path, queryParams, }) {
|
|
27
|
+
const results = [];
|
|
28
|
+
let after = null;
|
|
29
|
+
do {
|
|
30
|
+
const params = Object.assign({ limit: '100' }, queryParams);
|
|
31
|
+
if (after)
|
|
32
|
+
params['after'] = after;
|
|
33
|
+
const response = yield savvyCalApiCall({
|
|
34
|
+
token,
|
|
35
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
36
|
+
path,
|
|
37
|
+
queryParams: params,
|
|
38
|
+
});
|
|
39
|
+
results.push(...response.body.entries);
|
|
40
|
+
after = response.body.metadata.after;
|
|
41
|
+
} while (after);
|
|
42
|
+
return results;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function flattenEvent(event) {
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
|
47
|
+
const scheduler = (_d = (_b = (_a = event.attendees) === null || _a === void 0 ? void 0 : _a.find((a) => !a.is_organizer)) !== null && _b !== void 0 ? _b : (_c = event.attendees) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : null;
|
|
48
|
+
return {
|
|
49
|
+
id: event.id,
|
|
50
|
+
summary: (_e = event.summary) !== null && _e !== void 0 ? _e : null,
|
|
51
|
+
description: (_f = event.description) !== null && _f !== void 0 ? _f : null,
|
|
52
|
+
state: event.state,
|
|
53
|
+
start_at: event.start_at,
|
|
54
|
+
end_at: event.end_at,
|
|
55
|
+
duration_minutes: (_g = event.duration) !== null && _g !== void 0 ? _g : null,
|
|
56
|
+
url: (_h = event.url) !== null && _h !== void 0 ? _h : null,
|
|
57
|
+
location: (_j = event.location) !== null && _j !== void 0 ? _j : null,
|
|
58
|
+
is_group_session: (_k = event.is_group_session) !== null && _k !== void 0 ? _k : null,
|
|
59
|
+
created_at: event.created_at,
|
|
60
|
+
canceled_at: (_l = event.canceled_at) !== null && _l !== void 0 ? _l : null,
|
|
61
|
+
cancel_reason: (_m = event.cancel_reason) !== null && _m !== void 0 ? _m : null,
|
|
62
|
+
rescheduled_at: (_o = event.rescheduled_at) !== null && _o !== void 0 ? _o : null,
|
|
63
|
+
reschedule_reason: (_p = event.reschedule_reason) !== null && _p !== void 0 ? _p : null,
|
|
64
|
+
original_start_at: (_q = event.original_start_at) !== null && _q !== void 0 ? _q : null,
|
|
65
|
+
original_end_at: (_r = event.original_end_at) !== null && _r !== void 0 ? _r : null,
|
|
66
|
+
scheduling_link_id: (_t = (_s = event.link) === null || _s === void 0 ? void 0 : _s.id) !== null && _t !== void 0 ? _t : null,
|
|
67
|
+
scheduling_link_name: (_v = (_u = event.link) === null || _u === void 0 ? void 0 : _u.name) !== null && _v !== void 0 ? _v : null,
|
|
68
|
+
scheduling_link_slug: (_x = (_w = event.link) === null || _w === void 0 ? void 0 : _w.slug) !== null && _x !== void 0 ? _x : null,
|
|
69
|
+
attendee_display_name: (_y = scheduler === null || scheduler === void 0 ? void 0 : scheduler.display_name) !== null && _y !== void 0 ? _y : null,
|
|
70
|
+
attendee_first_name: (_z = scheduler === null || scheduler === void 0 ? void 0 : scheduler.first_name) !== null && _z !== void 0 ? _z : null,
|
|
71
|
+
attendee_last_name: (_0 = scheduler === null || scheduler === void 0 ? void 0 : scheduler.last_name) !== null && _0 !== void 0 ? _0 : null,
|
|
72
|
+
attendee_email: (_1 = scheduler === null || scheduler === void 0 ? void 0 : scheduler.email) !== null && _1 !== void 0 ? _1 : null,
|
|
73
|
+
attendee_phone: (_2 = scheduler === null || scheduler === void 0 ? void 0 : scheduler.phone_number) !== null && _2 !== void 0 ? _2 : null,
|
|
74
|
+
attendee_time_zone: (_3 = scheduler === null || scheduler === void 0 ? void 0 : scheduler.time_zone) !== null && _3 !== void 0 ? _3 : null,
|
|
75
|
+
conferencing_type: (_5 = (_4 = event.conferencing) === null || _4 === void 0 ? void 0 : _4.type) !== null && _5 !== void 0 ? _5 : null,
|
|
76
|
+
conferencing_join_url: (_7 = (_6 = event.conferencing) === null || _6 === void 0 ? void 0 : _6.join_url) !== null && _7 !== void 0 ? _7 : null,
|
|
77
|
+
conferencing_meeting_id: (_9 = (_8 = event.conferencing) === null || _8 === void 0 ? void 0 : _8.meeting_id) !== null && _9 !== void 0 ? _9 : null,
|
|
78
|
+
payment_state: (_11 = (_10 = event.payment) === null || _10 === void 0 ? void 0 : _10.state) !== null && _11 !== void 0 ? _11 : null,
|
|
79
|
+
payment_amount_total_cents: (_13 = (_12 = event.payment) === null || _12 === void 0 ? void 0 : _12.amount_total) !== null && _13 !== void 0 ? _13 : null,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAIA,0CAwBC;AAED,sDA+BC;AAED,oCAmCC;;AAlGD,+DAAwH;AAE3G,QAAA,iBAAiB,GAAG,6BAA6B,CAAC;AAE/D,SAAsB,eAAe;iEAA4B,EAC/D,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,GAOZ;QACC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAC,KAAK,CAAC,CAAA;QAC1B,OAAO,0BAAU,CAAC,WAAW,CAAI;YAC/B,MAAM;YACN,GAAG,EAAE,GAAG,yBAAiB,GAAG,IAAI,EAAE;YAClC,cAAc,EAAE;gBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;gBACrC,KAAK;aACN;YACD,WAAW;YACX,IAAI;SACL,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,qBAAqB;iEAAI,EAC7C,KAAK,EACL,IAAI,EACJ,WAAW,GAKZ;QACC,MAAM,OAAO,GAAQ,EAAE,CAAC;QACxB,IAAI,KAAK,GAAkB,IAAI,CAAC;QAEhC,GAAG,CAAC;YACF,MAAM,MAAM,mBACV,KAAK,EAAE,KAAK,IACT,WAAW,CACf,CAAC;YACF,IAAI,KAAK;gBAAE,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YAEnC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAuD;gBAC3F,KAAK;gBACL,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI;gBACJ,WAAW,EAAE,MAAM;aACp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AY,qCAAI,IAAI;KAChE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare function createEventTrigger({ name, displayName, description, eventType, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
description: string;
|
|
6
|
+
eventType: string;
|
|
7
|
+
}): import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEventTrigger = createEventTrigger;
|
|
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 _1 = require(".");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
const SAMPLE_EVENT = {
|
|
10
|
+
id: 'evt_abc123',
|
|
11
|
+
summary: '30 Minute Meeting with Jane Doe',
|
|
12
|
+
description: null,
|
|
13
|
+
state: 'confirmed',
|
|
14
|
+
start_at: '2024-06-01T10:00:00Z',
|
|
15
|
+
end_at: '2024-06-01T10:30:00Z',
|
|
16
|
+
duration_minutes: 30,
|
|
17
|
+
url: 'https://savvycal.com/events/evt_abc123',
|
|
18
|
+
location: null,
|
|
19
|
+
is_group_session: false,
|
|
20
|
+
created_at: '2024-05-20T08:00:00Z',
|
|
21
|
+
canceled_at: null,
|
|
22
|
+
cancel_reason: null,
|
|
23
|
+
rescheduled_at: null,
|
|
24
|
+
reschedule_reason: null,
|
|
25
|
+
original_start_at: null,
|
|
26
|
+
original_end_at: null,
|
|
27
|
+
scheduling_link_id: 'lnk_xyz789',
|
|
28
|
+
scheduling_link_name: '30-Minute Meeting',
|
|
29
|
+
scheduling_link_slug: '30min',
|
|
30
|
+
attendee_display_name: 'Jane Doe',
|
|
31
|
+
attendee_first_name: 'Jane',
|
|
32
|
+
attendee_last_name: 'Doe',
|
|
33
|
+
attendee_email: 'jane@example.com',
|
|
34
|
+
attendee_phone: null,
|
|
35
|
+
attendee_time_zone: 'America/Chicago',
|
|
36
|
+
conferencing_type: 'zoom',
|
|
37
|
+
conferencing_join_url: 'https://zoom.us/j/123456789',
|
|
38
|
+
conferencing_meeting_id: '123456789',
|
|
39
|
+
payment_state: null,
|
|
40
|
+
payment_amount_total_cents: null,
|
|
41
|
+
};
|
|
42
|
+
function createEventTrigger({ name, displayName, description, eventType, }) {
|
|
43
|
+
return (0, pieces_framework_1.createTrigger)({
|
|
44
|
+
auth: __1.savvyCalAuth,
|
|
45
|
+
name,
|
|
46
|
+
displayName,
|
|
47
|
+
description,
|
|
48
|
+
props: {},
|
|
49
|
+
sampleData: Object.assign({ event_type: eventType }, SAMPLE_EVENT),
|
|
50
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
51
|
+
onEnable(context) {
|
|
52
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const response = yield (0, _1.savvyCalApiCall)({
|
|
54
|
+
token: context.auth.secret_text,
|
|
55
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
56
|
+
path: '/webhooks',
|
|
57
|
+
body: { url: context.webhookUrl },
|
|
58
|
+
});
|
|
59
|
+
yield context.store.put('webhookId', response.body.id);
|
|
60
|
+
yield context.store.put('webhookSecret', response.body.secret);
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
onDisable(context) {
|
|
64
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const webhookId = yield context.store.get('webhookId');
|
|
66
|
+
if (webhookId) {
|
|
67
|
+
yield (0, _1.savvyCalApiCall)({
|
|
68
|
+
token: context.auth.secret_text,
|
|
69
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
70
|
+
path: `/webhooks/${webhookId}`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
run(context) {
|
|
76
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const body = context.payload.body;
|
|
78
|
+
if ((body === null || body === void 0 ? void 0 : body.type) !== eventType || !(body === null || body === void 0 ? void 0 : body.payload))
|
|
79
|
+
return [];
|
|
80
|
+
return [Object.assign({ event_type: body.type }, (0, _1.flattenEvent)(body.payload))];
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
test(context) {
|
|
84
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const response = yield (0, _1.savvyCalApiCall)({
|
|
86
|
+
token: context.auth.secret_text,
|
|
87
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
88
|
+
path: '/events',
|
|
89
|
+
queryParams: { limit: '5' },
|
|
90
|
+
});
|
|
91
|
+
return response.body.entries.map((e) => (Object.assign({ event_type: eventType }, (0, _1.flattenEvent)(e))));
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=webhook-trigger-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-trigger-factory.js","sourceRoot":"","sources":["../../../../src/lib/common/webhook-trigger-factory.ts"],"names":[],"mappings":";;AAuCA,gDA0DC;;AAjGD,qEAAgF;AAChF,+DAAyD;AACzD,wBAAiE;AACjE,8BAAsC;AAEtC,MAAM,YAAY,GAAG;IACnB,EAAE,EAA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C/B,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;iBAC5B,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAG,UAAU,EAAE,SAAS,IAAK,IAAA,eAAY,EAAC,CAAC,CAAC,EAAG,CAAC,CAAC;YAC3F,CAAC;SAAA;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const bookingCanceledTrigger: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bookingCanceledTrigger = void 0;
|
|
4
|
+
const webhook_trigger_factory_1 = require("../common/webhook-trigger-factory");
|
|
5
|
+
exports.bookingCanceledTrigger = (0, webhook_trigger_factory_1.createEventTrigger)({
|
|
6
|
+
name: 'booking_canceled',
|
|
7
|
+
displayName: 'Booking Canceled',
|
|
8
|
+
description: 'Triggers when a scheduled meeting is canceled.',
|
|
9
|
+
eventType: 'event.canceled',
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=booking-canceled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-canceled.js","sourceRoot":"","sources":["../../../../src/lib/triggers/booking-canceled.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AAE1D,QAAA,sBAAsB,GAAG,IAAA,4CAAkB,EAAC;IACvD,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,gDAAgD;IAC7D,SAAS,EAAE,gBAAgB;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const bookingRescheduledTrigger: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bookingRescheduledTrigger = void 0;
|
|
4
|
+
const webhook_trigger_factory_1 = require("../common/webhook-trigger-factory");
|
|
5
|
+
exports.bookingRescheduledTrigger = (0, webhook_trigger_factory_1.createEventTrigger)({
|
|
6
|
+
name: 'booking_rescheduled',
|
|
7
|
+
displayName: 'Booking Rescheduled',
|
|
8
|
+
description: 'Triggers when a scheduled meeting is rescheduled to a new time.',
|
|
9
|
+
eventType: 'event.rescheduled',
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=booking-rescheduled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-rescheduled.js","sourceRoot":"","sources":["../../../../src/lib/triggers/booking-rescheduled.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AAE1D,QAAA,yBAAyB,GAAG,IAAA,4CAAkB,EAAC;IAC1D,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,iEAAiE;IAC9E,SAAS,EAAE,mBAAmB;CAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const newBookingTrigger: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newBookingTrigger = void 0;
|
|
4
|
+
const webhook_trigger_factory_1 = require("../common/webhook-trigger-factory");
|
|
5
|
+
exports.newBookingTrigger = (0, webhook_trigger_factory_1.createEventTrigger)({
|
|
6
|
+
name: 'new_booking',
|
|
7
|
+
displayName: 'New Booking',
|
|
8
|
+
description: 'Triggers when a new meeting is booked on any scheduling link.',
|
|
9
|
+
eventType: 'event.created',
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=new-booking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-booking.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-booking.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AAE1D,QAAA,iBAAiB,GAAG,IAAA,4CAAkB,EAAC;IAClD,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,+DAA+D;IAC5E,SAAS,EAAE,eAAe;CAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const newEventTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
event_types: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
event_types: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
event_types: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
+
event_types: import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newEventTrigger = 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 common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
9
|
+
const EVENT_TYPES = [
|
|
10
|
+
{ label: 'Event Created', value: 'event.created' },
|
|
11
|
+
{ label: 'Event Requested', value: 'event.requested' },
|
|
12
|
+
{ label: 'Event Approved', value: 'event.approved' },
|
|
13
|
+
{ label: 'Event Declined', value: 'event.declined' },
|
|
14
|
+
{ label: 'Event Rescheduled', value: 'event.rescheduled' },
|
|
15
|
+
{ label: 'Event Changed', value: 'event.changed' },
|
|
16
|
+
{ label: 'Event Canceled', value: 'event.canceled' },
|
|
17
|
+
{ label: 'Checkout Pending', value: 'checkout.pending' },
|
|
18
|
+
{ label: 'Checkout Expired', value: 'checkout.expired' },
|
|
19
|
+
{ label: 'Checkout Completed', value: 'checkout.completed' },
|
|
20
|
+
{ label: 'Attendee Added', value: 'attendee.added' },
|
|
21
|
+
{ label: 'Attendee Canceled', value: 'attendee.canceled' },
|
|
22
|
+
{ label: 'Attendee Rescheduled', value: 'attendee.rescheduled' },
|
|
23
|
+
{ label: 'Poll Response Created', value: 'poll_response.created' },
|
|
24
|
+
{ label: 'Poll Response Updated', value: 'poll_response.updated' },
|
|
25
|
+
{ label: 'Workflow Action Triggered', value: 'action.triggered' },
|
|
26
|
+
];
|
|
27
|
+
exports.newEventTrigger = (0, pieces_framework_1.createTrigger)({
|
|
28
|
+
auth: __1.savvyCalAuth,
|
|
29
|
+
name: 'new_event',
|
|
30
|
+
displayName: 'New Event',
|
|
31
|
+
description: 'Triggers on any SavvyCal event type, including checkout, attendee, and poll events. For the most common cases (new booking, cancellation, reschedule) use the dedicated triggers instead.',
|
|
32
|
+
props: {
|
|
33
|
+
event_types: pieces_framework_1.Property.StaticMultiSelectDropdown({
|
|
34
|
+
displayName: 'Event Types',
|
|
35
|
+
description: 'Select which event types to trigger on. Leave empty to trigger on all event types.',
|
|
36
|
+
required: false,
|
|
37
|
+
options: {
|
|
38
|
+
options: EVENT_TYPES,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
sampleData: {
|
|
43
|
+
event_type: 'event.created',
|
|
44
|
+
id: 'evt_abc123',
|
|
45
|
+
summary: '30 Minute Meeting with Jane Doe',
|
|
46
|
+
description: null,
|
|
47
|
+
state: 'confirmed',
|
|
48
|
+
start_at: '2024-06-01T10:00:00Z',
|
|
49
|
+
end_at: '2024-06-01T10:30:00Z',
|
|
50
|
+
duration_minutes: 30,
|
|
51
|
+
url: 'https://savvycal.com/events/evt_abc123',
|
|
52
|
+
location: null,
|
|
53
|
+
is_group_session: false,
|
|
54
|
+
created_at: '2024-05-20T08:00:00Z',
|
|
55
|
+
canceled_at: null,
|
|
56
|
+
cancel_reason: null,
|
|
57
|
+
rescheduled_at: null,
|
|
58
|
+
reschedule_reason: null,
|
|
59
|
+
original_start_at: null,
|
|
60
|
+
original_end_at: null,
|
|
61
|
+
scheduling_link_id: 'lnk_xyz789',
|
|
62
|
+
scheduling_link_name: '30-Minute Meeting',
|
|
63
|
+
scheduling_link_slug: '30min',
|
|
64
|
+
attendee_display_name: 'Jane Doe',
|
|
65
|
+
attendee_first_name: 'Jane',
|
|
66
|
+
attendee_last_name: 'Doe',
|
|
67
|
+
attendee_email: 'jane@example.com',
|
|
68
|
+
attendee_phone: null,
|
|
69
|
+
attendee_time_zone: 'America/Chicago',
|
|
70
|
+
conferencing_type: 'zoom',
|
|
71
|
+
conferencing_join_url: 'https://zoom.us/j/123456789',
|
|
72
|
+
conferencing_meeting_id: '123456789',
|
|
73
|
+
payment_state: null,
|
|
74
|
+
payment_amount_total_cents: null,
|
|
75
|
+
},
|
|
76
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
77
|
+
onEnable(context) {
|
|
78
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const response = yield (0, common_1.savvyCalApiCall)({
|
|
80
|
+
token: context.auth.secret_text,
|
|
81
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
82
|
+
path: '/webhooks',
|
|
83
|
+
body: { url: context.webhookUrl },
|
|
84
|
+
});
|
|
85
|
+
yield context.store.put('webhookId', response.body.id);
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
onDisable(context) {
|
|
89
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const webhookId = yield context.store.get('webhookId');
|
|
91
|
+
if (webhookId) {
|
|
92
|
+
yield (0, common_1.savvyCalApiCall)({
|
|
93
|
+
token: context.auth.secret_text,
|
|
94
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
95
|
+
path: `/webhooks/${webhookId}`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
run(context) {
|
|
101
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const body = context.payload.body;
|
|
103
|
+
if (!(body === null || body === void 0 ? void 0 : body.payload))
|
|
104
|
+
return [];
|
|
105
|
+
const selectedTypes = context.propsValue.event_types;
|
|
106
|
+
if (selectedTypes && selectedTypes.length > 0 && !selectedTypes.includes(body.type))
|
|
107
|
+
return [];
|
|
108
|
+
return [Object.assign({ event_type: body.type }, (0, common_1.flattenEvent)(body.payload))];
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
test(context) {
|
|
112
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const response = yield (0, common_1.savvyCalApiCall)({
|
|
114
|
+
token: context.auth.secret_text,
|
|
115
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
116
|
+
path: '/events',
|
|
117
|
+
queryParams: { limit: '5' },
|
|
118
|
+
});
|
|
119
|
+
return response.body.entries.map((e) => (Object.assign({ event_type: 'event.created' }, (0, common_1.flattenEvent)(e))));
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=new-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-event.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-event.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,+DAAyD;AACzD,sCAAyE;AACzE,8BAA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