@activepieces/piece-clickfunnels 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/README.md +7 -0
- package/package.json +33 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +63 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/apply-tag-to-contact.d.ts +9 -0
- package/src/lib/actions/apply-tag-to-contact.js +32 -0
- package/src/lib/actions/apply-tag-to-contact.js.map +1 -0
- package/src/lib/actions/create-opportunity.d.ts +14 -0
- package/src/lib/actions/create-opportunity.js +51 -0
- package/src/lib/actions/create-opportunity.js.map +1 -0
- package/src/lib/actions/enroll-a-contact-into-a-course.d.ts +9 -0
- package/src/lib/actions/enroll-a-contact-into-a-course.js +32 -0
- package/src/lib/actions/enroll-a-contact-into-a-course.js.map +1 -0
- package/src/lib/actions/remove-tag-from-contact.d.ts +9 -0
- package/src/lib/actions/remove-tag-from-contact.js +29 -0
- package/src/lib/actions/remove-tag-from-contact.js.map +1 -0
- package/src/lib/actions/search-contacts.d.ts +8 -0
- package/src/lib/actions/search-contacts.js +30 -0
- package/src/lib/actions/search-contacts.js.map +1 -0
- package/src/lib/actions/update-or-create-contact.d.ts +13 -0
- package/src/lib/actions/update-or-create-contact.js +58 -0
- package/src/lib/actions/update-or-create-contact.js.map +1 -0
- package/src/lib/common/constants.d.ts +18 -0
- package/src/lib/common/constants.js +50 -0
- package/src/lib/common/constants.js.map +1 -0
- package/src/lib/common/props.d.ts +10 -0
- package/src/lib/common/props.js +409 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/requests.d.ts +21 -0
- package/src/lib/common/requests.js +179 -0
- package/src/lib/common/requests.js.map +1 -0
- package/src/lib/triggers/contact-completed-course.d.ts +20 -0
- package/src/lib/triggers/contact-completed-course.js +62 -0
- package/src/lib/triggers/contact-completed-course.js.map +1 -0
- package/src/lib/triggers/contact-identified.d.ts +20 -0
- package/src/lib/triggers/contact-identified.js +62 -0
- package/src/lib/triggers/contact-identified.js.map +1 -0
- package/src/lib/triggers/contact-submitted-form.d.ts +20 -0
- package/src/lib/triggers/contact-submitted-form.js +62 -0
- package/src/lib/triggers/contact-submitted-form.js.map +1 -0
- package/src/lib/triggers/contact-suspended-from-course.d.ts +20 -0
- package/src/lib/triggers/contact-suspended-from-course.js +62 -0
- package/src/lib/triggers/contact-suspended-from-course.js.map +1 -0
- package/src/lib/triggers/course-enrollment-created-for-contact.d.ts +20 -0
- package/src/lib/triggers/course-enrollment-created-for-contact.js +62 -0
- package/src/lib/triggers/course-enrollment-created-for-contact.js.map +1 -0
- package/src/lib/triggers/one-time-order-paid.d.ts +20 -0
- package/src/lib/triggers/one-time-order-paid.js +62 -0
- package/src/lib/triggers/one-time-order-paid.js.map +1 -0
- package/src/lib/triggers/scheduled-appointment-event-created.d.ts +20 -0
- package/src/lib/triggers/scheduled-appointment-event-created.js +62 -0
- package/src/lib/triggers/scheduled-appointment-event-created.js.map +1 -0
- package/src/lib/triggers/subscription-invoice-paid.d.ts +20 -0
- package/src/lib/triggers/subscription-invoice-paid.js +62 -0
- package/src/lib/triggers/subscription-invoice-paid.js.map +1 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contactCompletedCourse = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_contact_completed_course_trigger';
|
|
10
|
+
const MODULE_NAME = 'Contact Completed Course';
|
|
11
|
+
exports.contactCompletedCourse = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'contactCompletedCourse',
|
|
14
|
+
displayName: MODULE_NAME,
|
|
15
|
+
description: 'Triggers when a contact completes a course.',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['courses/enrollment.course_completed'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=contact-completed-course.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-completed-course.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/contact-completed-course.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,+CAA+C,CAAC;AAClE,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAElC,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAClD,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,qBAAa,EAAC,CAAC,MAAM,CAAC,CAAC;QAC/B,WAAW,EAAE,IAAA,0BAAkB,EAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KACpD;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE;YACrE,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAQ,MAAM,iCAAsB,CAAC,aAAa,CAC9D,IAAI,EACJ,WAAqB,EACrB;oBACE,0BAA0B,EAAE;wBAC1B,GAAG,EAAE,UAAU;wBACf,IAAI,EAAE,gBAAgB,WAAW,cAAc,IAAI,CAAC,GAAG,EAAE,EAAE;wBAC3D,cAAc,EAAE,CAAC,qCAAqC,CAAC;qBACxD;iBACF,CACF,CAAC;gBAEF,MAAM,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC;gBAE9B,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;gBAC/D,MAAM,IAAI,KAAK,CACb,6BACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,SAAS;qEAAC,EAAE,IAAI,EAAE,KAAK,EAAE;YAC7B,MAAM,UAAU,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAQ,CAAC;YAEvD,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,iCAAsB;qBACzB,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;qBACzC,IAAI,CAAC,GAAS,EAAE;oBACf,MAAM,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAChC,CAAC,CAAA,CAAC,CAAC;YACP,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const contactIdentified: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>, {
|
|
12
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
13
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
14
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>, {
|
|
18
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
19
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contactIdentified = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_contact_identified_trigger';
|
|
10
|
+
const MODULE_NAME = 'Contact Identified';
|
|
11
|
+
exports.contactIdentified = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'contactIdentified',
|
|
14
|
+
displayName: MODULE_NAME,
|
|
15
|
+
description: 'Triggers when a new contact is identified by email/phone.',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['contact.identified'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=contact-identified.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-identified.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/contact-identified.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,yCAAyC,CAAC;AAC5D,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAE5B,QAAA,iBAAiB,GAAG,IAAA,gCAAa,EAAC;IAC7C,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,2DAA2D;IACxE,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,qBAAa,EAAC,CAAC,MAAM,CAAC,CAAC;QAC/B,WAAW,EAAE,IAAA,0BAAkB,EAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KACpD;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE;YACrE,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;YAED,IAAI,CAA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ieces/pieces-framework';
|
|
2
|
+
export declare const contactSubmittedForm: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>, {
|
|
12
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
13
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
14
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>, {
|
|
18
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
19
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contactSubmittedForm = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_contact_submitted_form_trigger';
|
|
10
|
+
const MODULE_NAME = 'Contact Submitted Form';
|
|
11
|
+
exports.contactSubmittedForm = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'contactSubmittedForm',
|
|
14
|
+
displayName: MODULE_NAME,
|
|
15
|
+
description: 'Triggers each time a contact submits a form (opt-in or order).',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['form_submission.created'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=contact-submitted-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-submitted-form.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/contact-submitted-form.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,6CAA6C,CAAC;AAChE,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAEhC,QAAA,oBAAoB,GAAG,IAAA,gCAAa,EAAC;IAChD,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,gEAAgE;IAC7E,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,qBAAa,EAAC,CAAC,MAAM,CAAC,CAAC;QAC/B,WAAW,EAAE,IAAA,0BAAkB,EAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KACpD;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ;qEAAC,EAAE,IAAI,EAAE,U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K,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const contactSuspendedFromCourse: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>, {
|
|
12
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
13
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
14
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>, {
|
|
18
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
19
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contactSuspendedFromCourse = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_contact_suspended_from_course_trigger';
|
|
10
|
+
const MODULE_NAME = 'Contact Suspended';
|
|
11
|
+
exports.contactSuspendedFromCourse = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'contactSuspendedFromCourse',
|
|
14
|
+
displayName: `${MODULE_NAME} From Course`,
|
|
15
|
+
description: 'Triggers when a contact is suspended from a course.',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['courses/enrollment.suspended'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=contact-suspended-from-course.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-suspended-from-course.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/contact-suspended-from-course.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,oDAAoD,CAAC;AACvE,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAE3B,QAAA,0BAA0B,GAAG,IAAA,gCAAa,EAAC;IACtD,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,GAAG,WAAW,cAAc;IACzC,WAAW,EAAE,qDAAqD;IAClE,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,qBA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AM,iCAAsB;qBACzB,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;qBACzC,IAAI,CAAC,GAAS,EAAE;oBACf,MAAM,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAChC,CAAC,CAAA,CAAC,CAAC;YACP,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const courseEnrollmentCreatedForContact: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>, {
|
|
12
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
13
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
14
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>, {
|
|
18
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
19
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.courseEnrollmentCreatedForContact = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_course_enrollment_created_for_contact_trigger';
|
|
10
|
+
const MODULE_NAME = 'Course Enrollment Created';
|
|
11
|
+
exports.courseEnrollmentCreatedForContact = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'courseEnrollmentCreatedForContact',
|
|
14
|
+
displayName: `${MODULE_NAME} for contact`,
|
|
15
|
+
description: 'Triggers when a course enrollment is created for a contact.',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['courses/enrollment.created'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=course-enrollment-created-for-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"course-enrollment-created-for-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/course-enrollment-created-for-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,4DAA4D,CAAC;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AAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,SAAS;qEAAC,EAAE,IAAI,EAAE,KAAK,EAAE;YAC7B,MAAM,UAAU,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAQ,CAAC;YAEvD,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,iCAAsB;qBACzB,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;qBACzC,IAAI,CAAC,GAAS,EAAE;oBACf,MAAM,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAChC,CAAC,CAAA,CAAC,CAAC;YACP,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const oneTimeOrderPaid: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>, {
|
|
12
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
13
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
14
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>, {
|
|
18
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
19
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oneTimeOrderPaid = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_onetime_order_paid_trigger';
|
|
10
|
+
const MODULE_NAME = 'One-Time Order Paid';
|
|
11
|
+
exports.oneTimeOrderPaid = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'OneTimeOrderPaid',
|
|
14
|
+
displayName: MODULE_NAME,
|
|
15
|
+
description: 'Triggers when a customer pays a one-time order.',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['one-time-order.completed'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=one-time-order-paid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-time-order-paid.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/one-time-order-paid.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,yCAAyC,CAAC;AAC5D,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAE7B,QAAA,gBAAgB,GAAG,IAAA,gCAAa,EAAC;IAC5C,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,iDAAiD;IAC9D,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,qBAAa,EAAC,CAAC,MAAM,CAAC,CAAC;QAC/B,WAAW,EAAE,IAAA,0BAAkB,EAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KACpD;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE;YACrE,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAQ,MAAM,iCAAsB,CAAC,aAAa,CAC9D,IAAI,EACJ,WAAqB,EACrB;oBACE,0BAA0B,EAAE;wBAC1B,GAAG,EAAE,UAAU;wBACf,IAAI,EAAE,gBAAgB,WAAW,cAAc,IAAI,CAAC,GAAG,EAAE,EAAE;wBAC3D,cAAc,EAAE,CAAC,0BAA0B,CAAC;qBAC7C;iBACF,CACF,CAAC;gBAEF,MAAM,SAAS,GAAG,QAAQ,CAAC,EAAE,CAAC;gBAE9B,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;gBAC/D,MAAM,IAAI,KAAK,CACb,6BACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAC3C,EAAE,CACH,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,SAAS;qEAAC,EAAE,IAAI,EAAE,KAAK,EAAE;YAC7B,MAAM,UAAU,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAQ,CAAC;YAEvD,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,iCAAsB;qBACzB,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;qBACzC,IAAI,CAAC,GAAS,EAAE;oBACf,MAAM,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAChC,CAAC,CAAA,CAAC,CAAC;YACP,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const scheduledAppointmentEventCreated: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>, {
|
|
6
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
7
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>, {
|
|
12
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
13
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
14
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
subdomain: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
16
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
17
|
+
}>, {
|
|
18
|
+
teamId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
19
|
+
workspaceId: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scheduledAppointmentEventCreated = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const constants_1 = require("../common/constants");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const requests_1 = require("../common/requests");
|
|
9
|
+
const CACHE_KEY = 'clickfunnels_scheduled_appointment_event_created_trigger';
|
|
10
|
+
const MODULE_NAME = 'Scheduled Appointment Event';
|
|
11
|
+
exports.scheduledAppointmentEventCreated = (0, pieces_framework_1.createTrigger)({
|
|
12
|
+
auth: constants_1.clickfunnelsAuth,
|
|
13
|
+
name: 'scheduledAppointmentEventCreated',
|
|
14
|
+
displayName: `${MODULE_NAME} Created`,
|
|
15
|
+
description: 'Triggers when a scheduled appointment event is created.',
|
|
16
|
+
props: {
|
|
17
|
+
teamId: (0, props_1.teamsDropdown)(['auth']),
|
|
18
|
+
workspaceId: (0, props_1.workspacesDropdown)(['auth', 'teamId']),
|
|
19
|
+
},
|
|
20
|
+
sampleData: {},
|
|
21
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
22
|
+
onEnable(_a) {
|
|
23
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, webhookUrl, propsValue: { workspaceId }, store }) {
|
|
24
|
+
if (!workspaceId) {
|
|
25
|
+
throw new Error('Workspace ID is required. Please select a workspace.');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = yield requests_1.clickfunnelsApiService.createWebhook(auth, workspaceId, {
|
|
29
|
+
webhooks_outgoing_endpoint: {
|
|
30
|
+
url: webhookUrl,
|
|
31
|
+
name: `ActivePieces ${MODULE_NAME} Webhook - ${Date.now()}`,
|
|
32
|
+
event_type_ids: ['appointments/scheduled_event.created'],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const webhookId = response.id;
|
|
36
|
+
yield store.put(CACHE_KEY, { webhookId });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Failed to create ClickFunnels webhook:', error);
|
|
40
|
+
throw new Error(`Failed to create webhook: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onDisable(_a) {
|
|
45
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, store }) {
|
|
46
|
+
const cachedData = (yield store.get(CACHE_KEY));
|
|
47
|
+
if (cachedData) {
|
|
48
|
+
yield requests_1.clickfunnelsApiService
|
|
49
|
+
.deleteWebhook(auth, cachedData.webhookId)
|
|
50
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
yield store.delete(CACHE_KEY);
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return [context.payload.body];
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=scheduled-appointment-event-created.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduled-appointment-event-created.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/clickfunnels/src/lib/triggers/scheduled-appointment-event-created.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,mDAAuD;AACvD,2CAAoE;AACpE,iDAA4D;AAE5D,MAAM,SAAS,GAAG,0DAA0D,CAAC;AAC7E,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAErC,QAAA,gCAAgC,GAAG,IAAA,gCAAa,EAAC;IAC5D,IAAI,EAAE,4BAAgB;IACtB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,GAAG,WAAW,UAAU;IACrC,WAAW,EAAE,yDAAyD;IACtE,KAAK,EAAE;QACL,MAAM,EAAE,IAAA,qBAAa,EAAC,CAAC,MAAM,CAAC,CAAC;QAC/B,WAAW,EAAE,IAAA,0BAAkB,EAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KACpD;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE;YACrE,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAQ,MAAM,iCAAsB,CAAC,aAAa,CAC9D,IAAI,EACJ,WAAqB,EACrB;oBACE,0BAA0B,EAAE;wBAC1B,GAAG,EAAE,UAAU;wBACf,IAAI,EAAE,gBAAgB,WAAW,c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