@activepieces/piece-buttondown 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -12
- package/src/index.js +13 -29
- package/src/index.d.ts +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/create-subscriber.d.ts +0 -16
- package/src/lib/actions/create-subscriber.js +0 -148
- package/src/lib/actions/create-subscriber.js.map +0 -1
- package/src/lib/actions/custom-api-call.d.ts +0 -12
- package/src/lib/actions/custom-api-call.js +0 -17
- package/src/lib/actions/custom-api-call.js.map +0 -1
- package/src/lib/actions/list-subscribers.d.ts +0 -10
- package/src/lib/actions/list-subscribers.js +0 -108
- package/src/lib/actions/list-subscribers.js.map +0 -1
- package/src/lib/actions/send-email.d.ts +0 -15
- package/src/lib/actions/send-email.js +0 -140
- package/src/lib/actions/send-email.js.map +0 -1
- package/src/lib/common/auth.d.ts +0 -1
- package/src/lib/common/auth.js +0 -44
- package/src/lib/common/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -19
- package/src/lib/common/client.js +0 -39
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/options.d.ts +0 -21
- package/src/lib/common/options.js +0 -58
- package/src/lib/common/options.js.map +0 -1
- package/src/lib/common/types.d.ts +0 -80
- package/src/lib/common/types.js +0 -3
- package/src/lib/common/types.js.map +0 -1
- package/src/lib/common/webhook.d.ts +0 -32
- package/src/lib/common/webhook.js +0 -77
- package/src/lib/common/webhook.js.map +0 -1
- package/src/lib/triggers/email-sent.d.ts +0 -13
- package/src/lib/triggers/email-sent.js +0 -38
- package/src/lib/triggers/email-sent.js.map +0 -1
- package/src/lib/triggers/new-subscriber.d.ts +0 -13
- package/src/lib/triggers/new-subscriber.js +0 -38
- package/src/lib/triggers/new-subscriber.js.map +0 -1
- package/src/lib/triggers/subscriber-confirmed.d.ts +0 -13
- package/src/lib/triggers/subscriber-confirmed.js +0 -38
- package/src/lib/triggers/subscriber-confirmed.js.map +0 -1
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createButtondownWebhookTrigger = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const auth_1 = require("./auth");
|
|
8
|
-
const client_1 = require("./client");
|
|
9
|
-
const createButtondownWebhookTrigger = ({ name, displayName, description, eventType, sampleData, enrich, }) => (0, pieces_framework_1.createTrigger)({
|
|
10
|
-
auth: auth_1.buttondownAuth,
|
|
11
|
-
name,
|
|
12
|
-
displayName,
|
|
13
|
-
description,
|
|
14
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
15
|
-
props: {
|
|
16
|
-
webhookDescription: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'Webhook Description',
|
|
18
|
-
description: 'Optional description stored with the webhook in Buttondown.',
|
|
19
|
-
required: false,
|
|
20
|
-
}),
|
|
21
|
-
signingKey: pieces_framework_1.Property.ShortText({
|
|
22
|
-
displayName: 'Webhook Signing Key',
|
|
23
|
-
description: 'Optional HMAC signing key to validate webhook requests.',
|
|
24
|
-
required: false,
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
sampleData,
|
|
28
|
-
onEnable(context) {
|
|
29
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const webhook = yield (0, client_1.buttondownRequest)({
|
|
31
|
-
auth: context.auth.secret_text,
|
|
32
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
33
|
-
path: '/webhooks',
|
|
34
|
-
body: {
|
|
35
|
-
url: context.webhookUrl,
|
|
36
|
-
event_types: [eventType],
|
|
37
|
-
description: context.propsValue.webhookDescription,
|
|
38
|
-
signing_key: context.propsValue.signingKey,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
yield context.store.put('webhookId', webhook.id);
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
onDisable(context) {
|
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const webhookId = yield context.store.get('webhookId');
|
|
47
|
-
if (!webhookId) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
yield (0, client_1.buttondownRequest)({
|
|
51
|
-
auth: context.auth.secret_text,
|
|
52
|
-
method: pieces_common_1.HttpMethod.DELETE,
|
|
53
|
-
path: `/webhooks/${webhookId}`,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
run(context) {
|
|
58
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const payload = context.payload.body;
|
|
60
|
-
if ((payload === null || payload === void 0 ? void 0 : payload.event_type) !== eventType) {
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
let enriched;
|
|
64
|
-
if (enrich) {
|
|
65
|
-
enriched = yield enrich({
|
|
66
|
-
apiKey: context.auth.secret_text,
|
|
67
|
-
payload,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return [
|
|
71
|
-
Object.assign(Object.assign({}, payload), (enriched !== null && enriched !== void 0 ? enriched : {})),
|
|
72
|
-
];
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
exports.createButtondownWebhookTrigger = createButtondownWebhookTrigger;
|
|
77
|
-
//# sourceMappingURL=webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../../src/lib/common/webhook.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA0F;AAC1F,iCAAwC;AACxC,qCAA6C;AAqBtC,MAAM,8BAA8B,GAAG,CAAC,EAC7C,IAAI,EACJ,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,MAAM,GAC+B,EAAE,EAAE,CACzC,IAAA,gCAAa,EAAC;IACZ,IAAI,EAAE,qBAAc;IACpB,IAAI;IACJ,WAAW;IACX,WAAW;IACX,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,kBAAkB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrC,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,UAAU;IACJ,QAAQ,CAAC,OAAO;;YACpB,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAiB,EAAoB;gBACzD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC9B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE;oBACJ,GAAG,EAAE,OAAO,CAAC,UAAU;oBACvB,WAAW,EAAE,CAAC,SAAS,CAAC;oBACxB,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,kBAAkB;oBAClD,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU;iBAC3C;aACF,CAAC,CAAC;YAEH,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACnD,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,WAAW,CAAC,CAAC;YAC/D,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO;YACT,CAAC;YAED,MAAM,IAAA,0BAAiB,EAAO;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC9B,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,IAAI,EAAE,aAAa,SAAS,EAAE;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAgC,CAAC;YACjE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,MAAK,SAAS,EAAE,CAAC;gBACtC,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,IAAI,QAA6C,CAAC;YAClD,IAAI,MAAM,EAAE,CAAC;gBACX,QAAQ,GAAG,MAAM,MAAM,CAAC;oBACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;oBAChC,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;YAED,OAAO;gDAEA,OAAO,GACP,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC;aAEtB,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC;AA3EQ,QAAA,8BAA8B,kCA2EtC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const buttondownEmailSent: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
8
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
11
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buttondownEmailSent = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
exports.buttondownEmailSent = (0, webhook_1.createButtondownWebhookTrigger)({
|
|
9
|
-
name: 'buttondown_email_sent',
|
|
10
|
-
displayName: 'Email Sent',
|
|
11
|
-
description: 'Triggers when an email is sent from Buttondown.',
|
|
12
|
-
eventType: 'email.sent',
|
|
13
|
-
sampleData: {
|
|
14
|
-
event_type: 'email.sent',
|
|
15
|
-
data: {
|
|
16
|
-
email: 'eml_123456789',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
enrich: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, payload }) {
|
|
20
|
-
var _b;
|
|
21
|
-
const emailData = (_b = payload.data) === null || _b === void 0 ? void 0 : _b['email'];
|
|
22
|
-
let email;
|
|
23
|
-
if (typeof emailData === 'string') {
|
|
24
|
-
email = yield (0, client_1.buttondownRequest)({
|
|
25
|
-
auth: apiKey,
|
|
26
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
-
path: `/emails/${encodeURIComponent(emailData)}`,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
else if (emailData && typeof emailData === 'object') {
|
|
31
|
-
email = emailData;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
email,
|
|
35
|
-
};
|
|
36
|
-
}),
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=email-sent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-sent.js","sourceRoot":"","sources":["../../../../src/lib/triggers/email-sent.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,6CAAqD;AACrD,+CAAmE;AAGtD,QAAA,mBAAmB,GAAG,IAAA,wCAA8B,EAAC;IAChE,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,iDAAiD;IAC9D,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE;QACV,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE;YACJ,KAAK,EAAE,eAAe;SACvB;KACF;IACD,MAAM,EAAE,KAA4B,EAAE,oDAAvB,EAAE,MAAM,EAAE,OAAO,EAAE;;QAChC,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,IAAI,0CAAG,OAAO,CAAC,CAAC;QAC1C,IAAI,KAAkC,CAAC;QAEvC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,KAAK,GAAG,MAAM,IAAA,0BAAiB,EAAkB;gBAC/C,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,WAAW,kBAAkB,CAAC,SAAS,CAAC,EAAE;aACjD,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YACtD,KAAK,GAAG,SAA4B,CAAC;QACvC,CAAC;QAED,OAAO;YACL,KAAK;SACN,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const buttondownNewSubscriber: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
8
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
11
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buttondownNewSubscriber = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
exports.buttondownNewSubscriber = (0, webhook_1.createButtondownWebhookTrigger)({
|
|
9
|
-
name: 'buttondown_new_subscriber',
|
|
10
|
-
displayName: 'New Subscriber',
|
|
11
|
-
description: 'Triggers when a new subscriber is created.',
|
|
12
|
-
eventType: 'subscriber.created',
|
|
13
|
-
sampleData: {
|
|
14
|
-
event_type: 'subscriber.created',
|
|
15
|
-
data: {
|
|
16
|
-
subscriber: 'sub_123456789',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
enrich: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, payload }) {
|
|
20
|
-
var _b;
|
|
21
|
-
const subscriberData = (_b = payload.data) === null || _b === void 0 ? void 0 : _b['subscriber'];
|
|
22
|
-
let subscriber;
|
|
23
|
-
if (typeof subscriberData === 'string') {
|
|
24
|
-
subscriber = yield (0, client_1.buttondownRequest)({
|
|
25
|
-
auth: apiKey,
|
|
26
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
-
path: `/subscribers/${encodeURIComponent(subscriberData)}`,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
else if (subscriberData && typeof subscriberData === 'object') {
|
|
31
|
-
subscriber = subscriberData;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
subscriber,
|
|
35
|
-
};
|
|
36
|
-
}),
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=new-subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-subscriber.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-subscriber.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,6CAAqD;AACrD,+CAAmE;AAGtD,QAAA,uBAAuB,GAAG,IAAA,wCAA8B,EAAC;IACpE,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4CAA4C;IACzD,SAAS,EAAE,oBAAoB;IAC/B,UAAU,EAAE;QACV,UAAU,EAAE,oBAAoB;QAChC,IAAI,EAAE;YACJ,UAAU,EAAE,eAAe;SAC5B;KACF;IACD,MAAM,EAAE,KAA4B,EAAE,oDAAvB,EAAE,MAAM,EAAE,OAAO,EAAE;;QAChC,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,IAAI,0CAAG,YAAY,CAAC,CAAC;QACpD,IAAI,UAA4C,CAAC;QAEjD,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,UAAU,GAAG,MAAM,IAAA,0BAAiB,EAAuB;gBACzD,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE;aAC3D,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YAChE,UAAU,GAAG,cAAsC,CAAC;QACtD,CAAC;QAED,OAAO;YACL,UAAU;SACX,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const buttondownSubscriberConfirmed: import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
8
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
}> | import("@activepieces/pieces-framework").ITrigger<import("@activepieces/shared").TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
11
|
-
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buttondownSubscriberConfirmed = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const client_1 = require("../common/client");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
exports.buttondownSubscriberConfirmed = (0, webhook_1.createButtondownWebhookTrigger)({
|
|
9
|
-
name: 'buttondown_subscriber_confirmed',
|
|
10
|
-
displayName: 'Subscriber Confirmed',
|
|
11
|
-
description: 'Triggers when a subscriber confirms their email.',
|
|
12
|
-
eventType: 'subscriber.confirmed',
|
|
13
|
-
sampleData: {
|
|
14
|
-
event_type: 'subscriber.confirmed',
|
|
15
|
-
data: {
|
|
16
|
-
subscriber: 'sub_123456789',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
enrich: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ apiKey, payload }) {
|
|
20
|
-
var _b;
|
|
21
|
-
const subscriberData = (_b = payload.data) === null || _b === void 0 ? void 0 : _b['subscriber'];
|
|
22
|
-
let subscriber;
|
|
23
|
-
if (typeof subscriberData === 'string') {
|
|
24
|
-
subscriber = yield (0, client_1.buttondownRequest)({
|
|
25
|
-
auth: apiKey,
|
|
26
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
-
path: `/subscribers/${encodeURIComponent(subscriberData)}`,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
else if (subscriberData && typeof subscriberData === 'object') {
|
|
31
|
-
subscriber = subscriberData;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
subscriber,
|
|
35
|
-
};
|
|
36
|
-
}),
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=subscriber-confirmed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriber-confirmed.js","sourceRoot":"","sources":["../../../../src/lib/triggers/subscriber-confirmed.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,6CAAqD;AACrD,+CAAmE;AAGtD,QAAA,6BAA6B,GAAG,IAAA,wCAA8B,EAAC;IAC1E,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,kDAAkD;IAC/D,SAAS,EAAE,sBAAsB;IACjC,UAAU,EAAE;QACV,UAAU,EAAE,sBAAsB;QAClC,IAAI,EAAE;YACJ,UAAU,EAAE,eAAe;SAC5B;KACF;IACD,MAAM,EAAE,KAA4B,EAAE,oDAAvB,EAAE,MAAM,EAAE,OAAO,EAAE;;QAChC,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,IAAI,0CAAG,YAAY,CAAC,CAAC;QACpD,IAAI,UAA4C,CAAC;QAEjD,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,UAAU,GAAG,MAAM,IAAA,0BAAiB,EAAuB;gBACzD,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE;aAC3D,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;YAChE,UAAU,GAAG,cAAsC,CAAC;QACtD,CAAC;QAED,OAAO;YACL,UAAU;SACX,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|