@activepieces/piece-buttondown 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 +1 -0
- package/src/index.js +29 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-subscriber.d.ts +16 -0
- package/src/lib/actions/create-subscriber.js +148 -0
- package/src/lib/actions/create-subscriber.js.map +1 -0
- package/src/lib/actions/custom-api-call.d.ts +12 -0
- package/src/lib/actions/custom-api-call.js +17 -0
- package/src/lib/actions/custom-api-call.js.map +1 -0
- package/src/lib/actions/list-subscribers.d.ts +10 -0
- package/src/lib/actions/list-subscribers.js +108 -0
- package/src/lib/actions/list-subscribers.js.map +1 -0
- package/src/lib/actions/send-email.d.ts +15 -0
- package/src/lib/actions/send-email.js +140 -0
- package/src/lib/actions/send-email.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +44 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +19 -0
- package/src/lib/common/client.js +39 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/options.d.ts +21 -0
- package/src/lib/common/options.js +58 -0
- package/src/lib/common/options.js.map +1 -0
- package/src/lib/common/types.d.ts +80 -0
- package/src/lib/common/types.js +3 -0
- package/src/lib/common/types.js.map +1 -0
- package/src/lib/common/webhook.d.ts +32 -0
- package/src/lib/common/webhook.js +77 -0
- package/src/lib/common/webhook.js.map +1 -0
- package/src/lib/triggers/email-sent.d.ts +13 -0
- package/src/lib/triggers/email-sent.js +38 -0
- package/src/lib/triggers/email-sent.js.map +1 -0
- package/src/lib/triggers/new-subscriber.d.ts +13 -0
- package/src/lib/triggers/new-subscriber.js +38 -0
- package/src/lib/triggers/new-subscriber.js.map +1 -0
- package/src/lib/triggers/subscriber-confirmed.d.ts +13 -0
- package/src/lib/triggers/subscriber-confirmed.js +38 -0
- package/src/lib/triggers/subscriber-confirmed.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-buttondown",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@activepieces/pieces-common": "0.12.0",
|
|
8
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
9
|
+
"@activepieces/shared": "0.42.0",
|
|
10
|
+
"tslib": "2.6.2"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
14
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buttondown: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttondown = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const shared_1 = require("@activepieces/shared");
|
|
6
|
+
const auth_1 = require("./lib/common/auth");
|
|
7
|
+
const create_subscriber_1 = require("./lib/actions/create-subscriber");
|
|
8
|
+
const list_subscribers_1 = require("./lib/actions/list-subscribers");
|
|
9
|
+
const send_email_1 = require("./lib/actions/send-email");
|
|
10
|
+
const custom_api_call_1 = require("./lib/actions/custom-api-call");
|
|
11
|
+
const new_subscriber_1 = require("./lib/triggers/new-subscriber");
|
|
12
|
+
const subscriber_confirmed_1 = require("./lib/triggers/subscriber-confirmed");
|
|
13
|
+
const email_sent_1 = require("./lib/triggers/email-sent");
|
|
14
|
+
exports.buttondown = (0, pieces_framework_1.createPiece)({
|
|
15
|
+
displayName: 'Buttondown',
|
|
16
|
+
description: 'Automate your Buttondown newsletter workflows.',
|
|
17
|
+
auth: auth_1.buttondownAuth,
|
|
18
|
+
minimumSupportedRelease: '0.36.1',
|
|
19
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/buttondown.png',
|
|
20
|
+
authors: ['jacksbox-cassandra'],
|
|
21
|
+
categories: [shared_1.PieceCategory.MARKETING, shared_1.PieceCategory.COMMUNICATION],
|
|
22
|
+
actions: [create_subscriber_1.createSubscriber, list_subscribers_1.listSubscribers, send_email_1.sendEmail, custom_api_call_1.customApiCall],
|
|
23
|
+
triggers: [
|
|
24
|
+
new_subscriber_1.buttondownNewSubscriber,
|
|
25
|
+
subscriber_confirmed_1.buttondownSubscriberConfirmed,
|
|
26
|
+
email_sent_1.buttondownEmailSent,
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
//# 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,qEAA6D;AAC7D,iDAAqD;AACrD,4CAAmD;AACnD,uEAAmE;AACnE,qEAAiE;AACjE,yDAAqD;AACrD,mEAA8D;AAC9D,kEAAwE;AACxE,8EAAoF;AACpF,0DAAgE;AAEnD,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,gDAAgD;IAC7D,IAAI,EAAE,qBAAc;IACpB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,OAAO,EAAE,CAAC,oBAAoB,CAAC;IAC/B,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,EAAE,sBAAa,CAAC,aAAa,CAAC;IAClE,OAAO,EAAE,CAAC,oCAAgB,EAAE,kCAAe,EAAE,sBAAS,EAAE,+BAAa,CAAC;IACtE,QAAQ,EAAE;QACR,wCAAuB;QACvB,oDAA6B;QAC7B,gCAAmB;KACpB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtondownSubscriberType } from '../common/types';
|
|
2
|
+
export declare const createSubscriber: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
type: import("@activepieces/pieces-framework").StaticDropdownProperty<ButtondownSubscriberType, false>;
|
|
5
|
+
notes: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
6
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
8
|
+
referrerUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
utmSource: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
utmMedium: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
utmCampaign: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
referringSubscriberId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
ipAddress: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
collisionBehavior: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
15
|
+
bypassFirewall: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSubscriber = 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("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const options_1 = require("../common/options");
|
|
10
|
+
exports.createSubscriber = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.buttondownAuth,
|
|
12
|
+
name: 'createSubscriber',
|
|
13
|
+
displayName: 'Create Subscriber',
|
|
14
|
+
description: 'Create a new subscriber in Buttondown.',
|
|
15
|
+
props: {
|
|
16
|
+
email: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Email Address',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'The email address of the subscriber.',
|
|
20
|
+
}),
|
|
21
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Subscriber Type',
|
|
23
|
+
description: 'Set the subscriber status. Use "regular" to bypass double opt-in.',
|
|
24
|
+
required: false,
|
|
25
|
+
options: {
|
|
26
|
+
options: options_1.subscriberTypeOptions,
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
notes: pieces_framework_1.Property.LongText({
|
|
30
|
+
displayName: 'Internal Notes',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
tags: pieces_framework_1.Property.Array({
|
|
34
|
+
displayName: 'Tags',
|
|
35
|
+
description: 'Add one or more tags to assign to the subscriber.',
|
|
36
|
+
required: false,
|
|
37
|
+
properties: {
|
|
38
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
39
|
+
displayName: 'Tag',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
metadata: pieces_framework_1.Property.Json({
|
|
45
|
+
displayName: 'Metadata',
|
|
46
|
+
description: 'Custom metadata to store on the subscriber (JSON object).',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
referrerUrl: pieces_framework_1.Property.ShortText({
|
|
50
|
+
displayName: 'Referrer URL',
|
|
51
|
+
required: false,
|
|
52
|
+
}),
|
|
53
|
+
utmSource: pieces_framework_1.Property.ShortText({
|
|
54
|
+
displayName: 'UTM Source',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
utmMedium: pieces_framework_1.Property.ShortText({
|
|
58
|
+
displayName: 'UTM Medium',
|
|
59
|
+
required: false,
|
|
60
|
+
}),
|
|
61
|
+
utmCampaign: pieces_framework_1.Property.ShortText({
|
|
62
|
+
displayName: 'UTM Campaign',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
referringSubscriberId: pieces_framework_1.Property.ShortText({
|
|
66
|
+
displayName: 'Referring Subscriber ID',
|
|
67
|
+
description: 'ID of the subscriber who referred this contact.',
|
|
68
|
+
required: false,
|
|
69
|
+
}),
|
|
70
|
+
ipAddress: pieces_framework_1.Property.ShortText({
|
|
71
|
+
displayName: 'IP Address',
|
|
72
|
+
description: 'The original IP address of the subscriber. Helps Buttondown evaluate spam.',
|
|
73
|
+
required: false,
|
|
74
|
+
}),
|
|
75
|
+
collisionBehavior: pieces_framework_1.Property.StaticDropdown({
|
|
76
|
+
displayName: 'Collision Behavior',
|
|
77
|
+
description: 'Control how Buttondown handles duplicate email addresses. Leave empty to keep the existing subscriber.',
|
|
78
|
+
required: false,
|
|
79
|
+
options: {
|
|
80
|
+
options: [
|
|
81
|
+
{ label: 'Overwrite existing subscriber', value: 'overwrite' },
|
|
82
|
+
{ label: 'Merge tags with existing subscriber', value: 'add' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
bypassFirewall: pieces_framework_1.Property.Checkbox({
|
|
87
|
+
displayName: 'Bypass Firewall',
|
|
88
|
+
description: 'Set to true when the request originates from a trusted internal system without the subscriber\'s IP address.',
|
|
89
|
+
required: false,
|
|
90
|
+
defaultValue: false,
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
run(_a) {
|
|
94
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
95
|
+
var _b;
|
|
96
|
+
const payload = {
|
|
97
|
+
email_address: propsValue.email,
|
|
98
|
+
};
|
|
99
|
+
if (propsValue.notes) {
|
|
100
|
+
payload.notes = propsValue.notes;
|
|
101
|
+
}
|
|
102
|
+
const tags = (_b = propsValue.tags) === null || _b === void 0 ? void 0 : _b.map((entry) => { var _a; return (_a = entry === null || entry === void 0 ? void 0 : entry.tag) === null || _a === void 0 ? void 0 : _a.trim(); }).filter((tag) => !!tag);
|
|
103
|
+
if (tags && tags.length > 0) {
|
|
104
|
+
payload.tags = tags;
|
|
105
|
+
}
|
|
106
|
+
if (propsValue.metadata) {
|
|
107
|
+
if (typeof propsValue.metadata !== 'object' || Array.isArray(propsValue.metadata)) {
|
|
108
|
+
throw new Error('Metadata must be a JSON object.');
|
|
109
|
+
}
|
|
110
|
+
payload.metadata = propsValue.metadata;
|
|
111
|
+
}
|
|
112
|
+
if (propsValue.referrerUrl) {
|
|
113
|
+
payload.referrer_url = propsValue.referrerUrl;
|
|
114
|
+
}
|
|
115
|
+
if (propsValue.utmSource) {
|
|
116
|
+
payload.utm_source = propsValue.utmSource;
|
|
117
|
+
}
|
|
118
|
+
if (propsValue.utmMedium) {
|
|
119
|
+
payload.utm_medium = propsValue.utmMedium;
|
|
120
|
+
}
|
|
121
|
+
if (propsValue.utmCampaign) {
|
|
122
|
+
payload.utm_campaign = propsValue.utmCampaign;
|
|
123
|
+
}
|
|
124
|
+
if (propsValue.referringSubscriberId) {
|
|
125
|
+
payload.referring_subscriber_id = propsValue.referringSubscriberId;
|
|
126
|
+
}
|
|
127
|
+
if (propsValue.type) {
|
|
128
|
+
payload.type = propsValue.type;
|
|
129
|
+
}
|
|
130
|
+
if (propsValue.ipAddress) {
|
|
131
|
+
payload.ip_address = propsValue.ipAddress;
|
|
132
|
+
}
|
|
133
|
+
const headers = {
|
|
134
|
+
'X-Buttondown-Collision-Behavior': propsValue.collisionBehavior,
|
|
135
|
+
'X-Buttondown-Bypass-Firewall': propsValue.bypassFirewall ? 'true' : undefined,
|
|
136
|
+
};
|
|
137
|
+
const subscriber = yield (0, client_1.buttondownRequest)({
|
|
138
|
+
auth: auth.secret_text,
|
|
139
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
140
|
+
path: '/subscribers',
|
|
141
|
+
body: payload,
|
|
142
|
+
headers,
|
|
143
|
+
});
|
|
144
|
+
return subscriber;
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
//# sourceMappingURL=create-subscriber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-subscriber.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-subscriber.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,yCAAgD;AAChD,6CAAqD;AACrD,+CAA0D;AAO7C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,sCAAsC;SACpD,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EACT,mEAAmE;YACrE,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,+BAAqB;aAC/B;SACF,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,gBAAgB;YAC7B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE;gBACV,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;oBACtB,WAAW,EAAE,KA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AC,SAAS,CAAC;YAC5C,CAAC;YAED,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;gBACzB,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC;YAC5C,CAAC;YAED,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC3B,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC;YAChD,CAAC;YAED,IAAI,UAAU,CAAC,qBAAqB,EAAE,CAAC;gBACrC,OAAO,CAAC,uBAAuB,GAAG,UAAU,CAAC,qBAAqB,CAAC;YACrE,CAAC;YAED,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;gBACpB,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAgC,CAAC;YAC7D,CAAC;YAED,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;gBACzB,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC;YAC5C,CAAC;YAED,MAAM,OAAO,GAAuC;gBAClD,iCAAiC,EAAE,UAAU,CAAC,iBAAuC;gBACrF,8BAA8B,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;aAC/E,CAAC;YAEF,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAiB,EAAuB;gBAC/D,IAAI,EAAE,IAAI,CAAC,WAAW;gBACtB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,OAAO;gBACb,OAAO;aACR,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const customApiCall: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
url: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").SecretTextProperty<true> | undefined>;
|
|
3
|
+
method: import("@activepieces/pieces-framework").StaticDropdownProperty<import("@activepieces/pieces-common").HttpMethod, false> | import("@activepieces/pieces-framework").StaticDropdownProperty<import("@activepieces/pieces-common").HttpMethod, true>;
|
|
4
|
+
headers: import("@activepieces/pieces-framework").ObjectProperty<false> | import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
5
|
+
queryParams: import("@activepieces/pieces-framework").ObjectProperty<false> | import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
6
|
+
body_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
body: import("@activepieces/pieces-framework").DynamicProperties<false, import("@activepieces/pieces-framework").SecretTextProperty<true> | undefined>;
|
|
8
|
+
response_is_binary: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
9
|
+
failsafe: import("@activepieces/pieces-framework").CheckboxProperty<false> | import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
10
|
+
timeout: import("@activepieces/pieces-framework").NumberProperty<false> | import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
11
|
+
followRedirects: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customApiCall = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.customApiCall = (0, pieces_common_1.createCustomApiCallAction)({
|
|
9
|
+
auth: auth_1.buttondownAuth,
|
|
10
|
+
baseUrl: () => client_1.BUTTONDOWN_BASE_URL,
|
|
11
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
return ({
|
|
13
|
+
Authorization: `Token ${auth.secret_text}`,
|
|
14
|
+
});
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=custom-api-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-api-call.js","sourceRoot":"","sources":["../../../../src/lib/actions/custom-api-call.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,yCAAgD;AAChD,6CAAuD;AAE1C,QAAA,aAAa,GAAG,IAAA,yCAAyB,EAAC;IACrD,IAAI,EAAE,qBAAc;IACpB,OAAO,EAAE,GAAG,EAAE,CAAC,4BAAmB;IAClC,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;QAAC,OAAA,CAAC;YAC5B,aAAa,EAAE,SAAS,IAAI,CAAC,WAAW,EAAE;SAC3C,CAAC,CAAA;MAAA;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const listSubscribers: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
3
|
+
cursor: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
type: import("@activepieces/pieces-framework").StaticDropdownProperty<import("../common/types").ButtondownSubscriberType, false>;
|
|
5
|
+
source: import("@activepieces/pieces-framework").StaticDropdownProperty<import("../common/types").ButtondownSubscriberSource, false>;
|
|
6
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
emailAddress: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
referrerUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
ordering: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listSubscribers = 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("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const options_1 = require("../common/options");
|
|
10
|
+
exports.listSubscribers = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.buttondownAuth,
|
|
12
|
+
name: 'listSubscribers',
|
|
13
|
+
displayName: 'List Subscribers',
|
|
14
|
+
description: 'Retrieve subscribers from Buttondown.',
|
|
15
|
+
props: {
|
|
16
|
+
limit: pieces_framework_1.Property.Number({
|
|
17
|
+
displayName: 'Page Size',
|
|
18
|
+
description: 'Maximum number of subscribers to return (1-1000).',
|
|
19
|
+
required: false,
|
|
20
|
+
defaultValue: 100,
|
|
21
|
+
}),
|
|
22
|
+
cursor: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Cursor',
|
|
24
|
+
description: 'Provide the cursor value from a previous response to fetch the next page.',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
28
|
+
displayName: 'Subscriber Type',
|
|
29
|
+
required: false,
|
|
30
|
+
options: {
|
|
31
|
+
options: options_1.subscriberTypeOptions,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
source: pieces_framework_1.Property.StaticDropdown({
|
|
35
|
+
displayName: 'Source',
|
|
36
|
+
required: false,
|
|
37
|
+
options: {
|
|
38
|
+
options: options_1.subscriberSourceOptions,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
tags: pieces_framework_1.Property.Array({
|
|
42
|
+
displayName: 'Tags',
|
|
43
|
+
description: 'Filter by subscribers who have at least one of these tags.',
|
|
44
|
+
required: false,
|
|
45
|
+
properties: {
|
|
46
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Tag',
|
|
48
|
+
required: true,
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
emailAddress: pieces_framework_1.Property.ShortText({
|
|
53
|
+
displayName: 'Email Contains',
|
|
54
|
+
description: 'Return subscribers whose email address contains this value.',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
referrerUrl: pieces_framework_1.Property.ShortText({
|
|
58
|
+
displayName: 'Referrer URL Contains',
|
|
59
|
+
required: false,
|
|
60
|
+
}),
|
|
61
|
+
ordering: pieces_framework_1.Property.StaticDropdown({
|
|
62
|
+
displayName: 'Ordering',
|
|
63
|
+
required: false,
|
|
64
|
+
options: {
|
|
65
|
+
options: options_1.subscriberOrderingOptions,
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
run(_a) {
|
|
70
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
71
|
+
var _b;
|
|
72
|
+
const query = {};
|
|
73
|
+
if (propsValue.limit) {
|
|
74
|
+
query['page_size'] = propsValue.limit;
|
|
75
|
+
}
|
|
76
|
+
if (propsValue.cursor) {
|
|
77
|
+
query['cursor'] = propsValue.cursor;
|
|
78
|
+
}
|
|
79
|
+
if (propsValue.type) {
|
|
80
|
+
query['type'] = [propsValue.type];
|
|
81
|
+
}
|
|
82
|
+
if (propsValue.source) {
|
|
83
|
+
query['source'] = [propsValue.source];
|
|
84
|
+
}
|
|
85
|
+
const tags = (_b = propsValue.tags) === null || _b === void 0 ? void 0 : _b.map((entry) => { var _a; return (_a = entry.tag) === null || _a === void 0 ? void 0 : _a.trim(); }).filter((tag) => !!tag);
|
|
86
|
+
if (tags && tags.length > 0) {
|
|
87
|
+
query['tag'] = tags;
|
|
88
|
+
}
|
|
89
|
+
if (propsValue.emailAddress) {
|
|
90
|
+
query['email_address'] = propsValue.emailAddress;
|
|
91
|
+
}
|
|
92
|
+
if (propsValue.referrerUrl) {
|
|
93
|
+
query['referrer_url'] = propsValue.referrerUrl;
|
|
94
|
+
}
|
|
95
|
+
if (propsValue.ordering) {
|
|
96
|
+
query['ordering'] = propsValue.ordering;
|
|
97
|
+
}
|
|
98
|
+
const response = yield (0, client_1.buttondownRequest)({
|
|
99
|
+
auth: auth.secret_text,
|
|
100
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
101
|
+
path: '/subscribers',
|
|
102
|
+
query,
|
|
103
|
+
});
|
|
104
|
+
return response;
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=list-subscribers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-subscribers.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-subscribers.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,yCAAgD;AAChD,6CAA8E;AAC9E,+CAI2B;AAGd,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,GAAG;SAClB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,QAAQ;YACrB,WAAW,EACT,2EAA2E;YAC7E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,+BAAqB;aAC/B;SACF,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE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AAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACxC,CAAC;YAED,MAAM,IAAI,GAAG,MAAC,UAAU,CAAC,IAA4C,0CACjE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,GAAG,0CAAE,IAAI,EAAE,CAAA,EAAA,EACjC,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YACtB,CAAC;YAED,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;gBAC5B,KAAK,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC;YACnD,CAAC;YAED,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;gBAC3B,KAAK,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC;YACjD,CAAC;YAED,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,KAAK,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC;YAC1C,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,0BAAiB,EAAgD;gBACtF,IAAI,EAAE,IAAI,CAAC,WAAW;gBACtB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,cAAc;gBACpB,KAAK;aACN,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtondownEmailStatus, ButtondownEmailType } from '../common/types';
|
|
2
|
+
export declare const sendEmail: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
body: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
status: import("@activepieces/pieces-framework").StaticDropdownProperty<ButtondownEmailStatus, false>;
|
|
6
|
+
publishDate: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
7
|
+
emailType: import("@activepieces/pieces-framework").StaticDropdownProperty<ButtondownEmailType, false>;
|
|
8
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
9
|
+
canonicalUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
image: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
13
|
+
attachments: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
14
|
+
triggerBilling: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendEmail = 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("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const options_1 = require("../common/options");
|
|
10
|
+
exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.buttondownAuth,
|
|
12
|
+
name: 'sendEmail',
|
|
13
|
+
displayName: 'Send Email',
|
|
14
|
+
description: 'Send an email to your Buttondown subscribers.',
|
|
15
|
+
props: {
|
|
16
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Subject',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
body: pieces_framework_1.Property.LongText({
|
|
21
|
+
displayName: 'Body',
|
|
22
|
+
description: 'Write your email content in Markdown or HTML. Buttondown will detect the format automatically.',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
26
|
+
displayName: 'Delivery Status',
|
|
27
|
+
description: 'Choose how Buttondown should treat this email after creation.',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: 'about_to_send',
|
|
30
|
+
options: {
|
|
31
|
+
options: options_1.emailStatusOptions,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
publishDate: pieces_framework_1.Property.DateTime({
|
|
35
|
+
displayName: 'Publish Date',
|
|
36
|
+
description: 'Required when scheduling an email. Use ISO 8601 format.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
emailType: pieces_framework_1.Property.StaticDropdown({
|
|
40
|
+
displayName: 'Email Type',
|
|
41
|
+
required: false,
|
|
42
|
+
defaultValue: 'public',
|
|
43
|
+
options: {
|
|
44
|
+
options: options_1.emailTypeOptions,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
description: pieces_framework_1.Property.LongText({
|
|
48
|
+
displayName: 'Description',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
canonicalUrl: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Canonical URL',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
image: pieces_framework_1.Property.ShortText({
|
|
56
|
+
displayName: 'Primary Image URL',
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
60
|
+
displayName: 'Slug',
|
|
61
|
+
description: 'Override the automatic slug used for the archive URL.',
|
|
62
|
+
required: false,
|
|
63
|
+
}),
|
|
64
|
+
metadata: pieces_framework_1.Property.Json({
|
|
65
|
+
displayName: 'Metadata',
|
|
66
|
+
description: 'Custom metadata to attach to the email (JSON object).',
|
|
67
|
+
required: false,
|
|
68
|
+
}),
|
|
69
|
+
attachments: pieces_framework_1.Property.Array({
|
|
70
|
+
displayName: 'Attachment IDs',
|
|
71
|
+
description: 'IDs of attachments uploaded via the Buttondown API.',
|
|
72
|
+
required: false,
|
|
73
|
+
properties: {
|
|
74
|
+
id: pieces_framework_1.Property.ShortText({
|
|
75
|
+
displayName: 'Attachment ID',
|
|
76
|
+
required: true,
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
triggerBilling: pieces_framework_1.Property.Checkbox({
|
|
81
|
+
displayName: 'Trigger Pay-per-email Billing',
|
|
82
|
+
description: 'Enable when this email should count against pay-per-email billing for paid subscribers.',
|
|
83
|
+
required: false,
|
|
84
|
+
defaultValue: false,
|
|
85
|
+
}),
|
|
86
|
+
},
|
|
87
|
+
run(_a) {
|
|
88
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
89
|
+
var _b, _c;
|
|
90
|
+
const status = (_b = propsValue.status) !== null && _b !== void 0 ? _b : 'about_to_send';
|
|
91
|
+
if (status === 'scheduled' && !propsValue.publishDate) {
|
|
92
|
+
throw new Error('Publish date is required when scheduling an email.');
|
|
93
|
+
}
|
|
94
|
+
const payload = {
|
|
95
|
+
subject: propsValue.subject,
|
|
96
|
+
body: propsValue.body,
|
|
97
|
+
status,
|
|
98
|
+
};
|
|
99
|
+
if (propsValue.publishDate) {
|
|
100
|
+
payload.publish_date = propsValue.publishDate;
|
|
101
|
+
}
|
|
102
|
+
if (propsValue.emailType) {
|
|
103
|
+
payload.email_type = propsValue.emailType;
|
|
104
|
+
}
|
|
105
|
+
if (propsValue.description) {
|
|
106
|
+
payload.description = propsValue.description;
|
|
107
|
+
}
|
|
108
|
+
if (propsValue.canonicalUrl) {
|
|
109
|
+
payload.canonical_url = propsValue.canonicalUrl;
|
|
110
|
+
}
|
|
111
|
+
if (propsValue.image) {
|
|
112
|
+
payload.image = propsValue.image;
|
|
113
|
+
}
|
|
114
|
+
if (propsValue.slug) {
|
|
115
|
+
payload.slug = propsValue.slug;
|
|
116
|
+
}
|
|
117
|
+
if (propsValue.metadata) {
|
|
118
|
+
if (typeof propsValue.metadata !== 'object' || Array.isArray(propsValue.metadata)) {
|
|
119
|
+
throw new Error('Metadata must be provided as a JSON object.');
|
|
120
|
+
}
|
|
121
|
+
payload.metadata = propsValue.metadata;
|
|
122
|
+
}
|
|
123
|
+
const attachments = (_c = propsValue.attachments) === null || _c === void 0 ? void 0 : _c.map((entry) => { var _a; return (_a = entry.id) === null || _a === void 0 ? void 0 : _a.trim(); }).filter((id) => !!id);
|
|
124
|
+
if (attachments && attachments.length > 0) {
|
|
125
|
+
payload.attachments = attachments;
|
|
126
|
+
}
|
|
127
|
+
if (propsValue.triggerBilling) {
|
|
128
|
+
payload.should_trigger_pay_per_email_billing = true;
|
|
129
|
+
}
|
|
130
|
+
const email = yield (0, client_1.buttondownRequest)({
|
|
131
|
+
auth: auth.secret_text,
|
|
132
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
133
|
+
path: '/emails',
|
|
134
|
+
body: payload,
|
|
135
|
+
});
|
|
136
|
+
return email;
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=send-email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-email.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,yCAAgD;AAChD,6CAAqD;AACrD,+CAAyE;AAQ5D,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1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;aACd,CAAC,CAAC;YAEH,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buttondownAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttondownAuth = 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 client_1 = require("./client");
|
|
8
|
+
exports.buttondownAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
description: 'Create an API key from https://buttondown.com/keys and paste it here.',
|
|
11
|
+
required: true,
|
|
12
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
13
|
+
var _b, _c, _d, _e, _f, _g;
|
|
14
|
+
if (!auth) {
|
|
15
|
+
return {
|
|
16
|
+
valid: false,
|
|
17
|
+
error: 'API key is required.',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
22
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
23
|
+
url: `${client_1.BUTTONDOWN_BASE_URL}/newsletters`,
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Token ${auth}`,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
valid: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (unknownError) {
|
|
33
|
+
const error = unknownError;
|
|
34
|
+
const status = (_b = error.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
35
|
+
const body = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.body) !== null && _d !== void 0 ? _d : {};
|
|
36
|
+
const message = (_g = (_f = (_e = body.detail) !== null && _e !== void 0 ? _e : body.error) !== null && _f !== void 0 ? _f : body.message) !== null && _g !== void 0 ? _g : (status === 401 ? 'Invalid API key.' : 'Failed to verify the API key.');
|
|
37
|
+
return {
|
|
38
|
+
valid: false,
|
|
39
|
+
error: message,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AACrE,qEAA2D;AAC3D,qCAA+C;AAYlC,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IACjD,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,uEAAuE;IACzE,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACvB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB;aAC9B,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAyB;gBACnD,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,4BAAmB,cAAc;gBACzC,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,IAAI,EAAE;iBAC/B;aACF,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,YAAqB,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,YAGb,CAAC;YACF,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,CAAC;YACtC,MAAM,IAAI,GAAG,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,mCAAI,EAAE,CAAC;YACxC,MAAM,OAAO,GACX,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,mCACX,IAAI,CAAC,KAAK,mCACV,IAAI,CAAC,OAAO,mCACZ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC;YAE1E,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,OAAO;aACf,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HttpMethod } from '@activepieces/pieces-common';
|
|
2
|
+
export declare const BUTTONDOWN_BASE_URL = "https://api.buttondown.com/v1";
|
|
3
|
+
type QueryValue = string | number | boolean | Array<string | number | boolean> | undefined;
|
|
4
|
+
export interface ButtondownRequest {
|
|
5
|
+
auth: string;
|
|
6
|
+
method: HttpMethod;
|
|
7
|
+
path: string;
|
|
8
|
+
query?: Record<string, QueryValue>;
|
|
9
|
+
body?: unknown;
|
|
10
|
+
headers?: Record<string, string | undefined>;
|
|
11
|
+
}
|
|
12
|
+
export interface ButtondownPagedResponse<T> {
|
|
13
|
+
results: T[];
|
|
14
|
+
count: number;
|
|
15
|
+
next?: string | null;
|
|
16
|
+
previous?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare const buttondownRequest: <TResponse>({ auth, method, path, query, body, headers, }: ButtondownRequest) => Promise<TResponse>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttondownRequest = exports.BUTTONDOWN_BASE_URL = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
exports.BUTTONDOWN_BASE_URL = 'https://api.buttondown.com/v1';
|
|
7
|
+
const sanitizeHeaders = (headers = {}) => Object.fromEntries(Object.entries(headers).filter(([, value]) => value !== undefined));
|
|
8
|
+
const serializeQueryParams = (query) => {
|
|
9
|
+
if (!query) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const result = {};
|
|
13
|
+
for (const [key, value] of Object.entries(query)) {
|
|
14
|
+
if (value === undefined) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(value)) {
|
|
18
|
+
if (value.length === 0) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
result[key] = value.map((item) => String(item)).join(',');
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
result[key] = String(value);
|
|
25
|
+
}
|
|
26
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
27
|
+
};
|
|
28
|
+
const buttondownRequest = (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, method, path, query, body, headers, }) {
|
|
29
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
30
|
+
method,
|
|
31
|
+
url: `${exports.BUTTONDOWN_BASE_URL}${path}`,
|
|
32
|
+
headers: Object.assign({ Authorization: `Token ${auth}`, Accept: 'application/json', 'Content-Type': 'application/json' }, sanitizeHeaders(headers)),
|
|
33
|
+
queryParams: serializeQueryParams(query),
|
|
34
|
+
body,
|
|
35
|
+
});
|
|
36
|
+
return response.body;
|
|
37
|
+
});
|
|
38
|
+
exports.buttondownRequest = buttondownRequest;
|
|
39
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;;;AAAA,+DAAqE;AAExD,QAAA,mBAAmB,GAAG,+BAA+B,CAAC;AAyBnE,MAAM,eAAe,GAAG,CAAC,UAA8C,EAAE,EAAE,EAAE,CAC3E,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,C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AAa,EAAE,SAAS,IAAI,EAAE,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,cAAc,EAAE,kBAAkB,IAC/B,eAAe,CAAC,OAAO,CAAC,CAC5B;QACD,WAAW,EAAE,oBAAoB,CAAC,KAAK,CAAC;QACxC,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AAtBW,QAAA,iBAAiB,qBAsB5B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ButtondownSubscriberType, ButtondownSubscriberSource, ButtondownEmailStatus, ButtondownEmailType } from './types';
|
|
2
|
+
export declare const subscriberTypeOptions: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: ButtondownSubscriberType;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const subscriberSourceOptions: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: ButtondownSubscriberSource;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const subscriberOrderingOptions: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
export declare const emailStatusOptions: {
|
|
15
|
+
label: string;
|
|
16
|
+
value: ButtondownEmailStatus;
|
|
17
|
+
}[];
|
|
18
|
+
export declare const emailTypeOptions: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: ButtondownEmailType;
|
|
21
|
+
}[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emailTypeOptions = exports.emailStatusOptions = exports.subscriberOrderingOptions = exports.subscriberSourceOptions = exports.subscriberTypeOptions = void 0;
|
|
4
|
+
exports.subscriberTypeOptions = [
|
|
5
|
+
{ label: 'Regular', value: 'regular' },
|
|
6
|
+
{ label: 'Premium', value: 'premium' },
|
|
7
|
+
{ label: 'Unactivated', value: 'unactivated' },
|
|
8
|
+
{ label: 'Paused', value: 'paused' },
|
|
9
|
+
{ label: 'Trialed', value: 'trialed' },
|
|
10
|
+
{ label: 'Upcoming', value: 'upcoming' },
|
|
11
|
+
{ label: 'Churning', value: 'churning' },
|
|
12
|
+
{ label: 'Churned', value: 'churned' },
|
|
13
|
+
{ label: 'Unsubscribed', value: 'unsubscribed' },
|
|
14
|
+
{ label: 'Undeliverable', value: 'undeliverable' },
|
|
15
|
+
{ label: 'Blocked', value: 'blocked' },
|
|
16
|
+
{ label: 'Complained', value: 'complained' },
|
|
17
|
+
{ label: 'Gifted', value: 'gifted' },
|
|
18
|
+
{ label: 'Past Due', value: 'past_due' },
|
|
19
|
+
{ label: 'Removed', value: 'removed' },
|
|
20
|
+
{ label: 'Unpaid', value: 'unpaid' },
|
|
21
|
+
];
|
|
22
|
+
exports.subscriberSourceOptions = [
|
|
23
|
+
{ label: 'Admin', value: 'admin' },
|
|
24
|
+
{ label: 'API', value: 'api' },
|
|
25
|
+
{ label: 'Carrd', value: 'carrd' },
|
|
26
|
+
{ label: 'Comment', value: 'comment' },
|
|
27
|
+
{ label: 'Embedded form', value: 'embedded_form' },
|
|
28
|
+
{ label: 'Hosted form', value: 'form' },
|
|
29
|
+
{ label: 'Import', value: 'import' },
|
|
30
|
+
{ label: 'Memberful', value: 'memberful' },
|
|
31
|
+
{ label: 'Organic', value: 'organic' },
|
|
32
|
+
{ label: 'Patreon', value: 'patreon' },
|
|
33
|
+
{ label: 'Stripe', value: 'stripe' },
|
|
34
|
+
{ label: 'User portal', value: 'user' },
|
|
35
|
+
{ label: 'Zapier', value: 'zapier' },
|
|
36
|
+
];
|
|
37
|
+
exports.subscriberOrderingOptions = [
|
|
38
|
+
{ label: 'Newest first', value: '-creation_date' },
|
|
39
|
+
{ label: 'Oldest first', value: 'creation_date' },
|
|
40
|
+
{ label: 'Email address (A-Z)', value: 'email_address' },
|
|
41
|
+
{ label: 'Email address (Z-A)', value: '-email_address' },
|
|
42
|
+
{ label: 'Last opened (recent first)', value: '-last_open_date' },
|
|
43
|
+
{ label: 'Last opened (oldest first)', value: 'last_open_date' },
|
|
44
|
+
];
|
|
45
|
+
exports.emailStatusOptions = [
|
|
46
|
+
{ label: 'Send immediately (about_to_send)', value: 'about_to_send' },
|
|
47
|
+
{ label: 'Draft', value: 'draft' },
|
|
48
|
+
{ label: 'Scheduled', value: 'scheduled' },
|
|
49
|
+
];
|
|
50
|
+
exports.emailTypeOptions = [
|
|
51
|
+
{ label: 'Public', value: 'public' },
|
|
52
|
+
{ label: 'Private', value: 'private' },
|
|
53
|
+
{ label: 'Premium', value: 'premium' },
|
|
54
|
+
{ label: 'Free', value: 'free' },
|
|
55
|
+
{ label: 'Churned', value: 'churned' },
|
|
56
|
+
{ label: 'Archival', value: 'archival' },
|
|
57
|
+
];
|
|
58
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/lib/common/options.ts"],"names":[],"mappings":";;;AAOa,QAAA,qBAAqB,GAAyD;IACzF,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;IAChD,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;IACl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G;IACvC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,EAAE;IAClD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,EAAE;IACjD,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,eAAe,EAAE;IACxD,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,gBAAgB,EAAE;IACzD,EAAE,KAAK,EAAE,4BAA4B,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACjE,EAAE,KAAK,EAAE,4BAA4B,EAAE,KAAK,EAAE,gBAAgB,EAAE;CACjE,CAAC;AAEW,QAAA,kBAAkB,GAAsD;IACnF,EAAE,KAAK,EAAE,kCAAkC,EAAE,KAAK,EAAE,eAAe,EAAE;IACrE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAClC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;CAC3C,CAAC;AAEW,QAAA,gBAAgB,GAAoD;IAC/E,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;IACtC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;CACzC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export type ButtondownSubscriberType = 'blocked' | 'complained' | 'churning' | 'churned' | 'gifted' | 'unactivated' | 'unpaid' | 'undeliverable' | 'premium' | 'past_due' | 'paused' | 'regular' | 'removed' | 'trialed' | 'unsubscribed' | 'upcoming';
|
|
2
|
+
export type ButtondownSubscriberSource = 'admin' | 'api' | 'carrd' | 'comment' | 'embedded_form' | 'form' | 'import' | 'memberful' | 'organic' | 'patreon' | 'stripe' | 'user' | 'zapier';
|
|
3
|
+
export interface ButtondownSubscriber {
|
|
4
|
+
id: string;
|
|
5
|
+
creation_date: string;
|
|
6
|
+
email_address: string;
|
|
7
|
+
type: ButtondownSubscriberType;
|
|
8
|
+
tags: string[];
|
|
9
|
+
metadata: Record<string, unknown>;
|
|
10
|
+
notes?: string;
|
|
11
|
+
referrer_url?: string;
|
|
12
|
+
utm_campaign?: string;
|
|
13
|
+
utm_medium?: string;
|
|
14
|
+
utm_source?: string;
|
|
15
|
+
ip_address?: string;
|
|
16
|
+
source: ButtondownSubscriberSource;
|
|
17
|
+
last_open_date?: string | null;
|
|
18
|
+
last_click_date?: string | null;
|
|
19
|
+
click_rate?: number | null;
|
|
20
|
+
open_rate?: number | null;
|
|
21
|
+
churn_date?: string | null;
|
|
22
|
+
unsubscription_date?: string | null;
|
|
23
|
+
undeliverability_date?: string | null;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface ButtondownSubscriberInput {
|
|
27
|
+
email_address: string;
|
|
28
|
+
notes?: string;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
tags?: string[];
|
|
31
|
+
referrer_url?: string;
|
|
32
|
+
utm_campaign?: string;
|
|
33
|
+
utm_medium?: string;
|
|
34
|
+
utm_source?: string;
|
|
35
|
+
referring_subscriber_id?: string;
|
|
36
|
+
type?: ButtondownSubscriberType;
|
|
37
|
+
ip_address?: string;
|
|
38
|
+
}
|
|
39
|
+
export type ButtondownEmailType = 'public' | 'private' | 'premium' | 'free' | 'churned' | 'archival';
|
|
40
|
+
export type ButtondownEmailStatus = 'draft' | 'managed_by_rss' | 'about_to_send' | 'scheduled' | 'in_flight' | 'paused' | 'deleted' | 'errored' | 'sent' | 'imported' | 'throttled' | 'resending' | 'transactional' | 'suppressed';
|
|
41
|
+
export interface ButtondownEmail {
|
|
42
|
+
id: string;
|
|
43
|
+
creation_date: string;
|
|
44
|
+
modification_date: string;
|
|
45
|
+
subject: string;
|
|
46
|
+
body: string;
|
|
47
|
+
status: ButtondownEmailStatus;
|
|
48
|
+
email_type: ButtondownEmailType;
|
|
49
|
+
publish_date?: string | null;
|
|
50
|
+
description?: string;
|
|
51
|
+
canonical_url?: string;
|
|
52
|
+
image?: string;
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
attachments?: string[];
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
export interface ButtondownEmailInput {
|
|
58
|
+
subject: string;
|
|
59
|
+
body?: string;
|
|
60
|
+
status?: ButtondownEmailStatus;
|
|
61
|
+
email_type?: ButtondownEmailType;
|
|
62
|
+
publish_date?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
canonical_url?: string;
|
|
65
|
+
image?: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
slug?: string;
|
|
68
|
+
attachments?: string[];
|
|
69
|
+
should_trigger_pay_per_email_billing?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export type ButtondownWebhookEvent = 'subscriber.created' | 'subscriber.confirmed' | 'email.sent';
|
|
72
|
+
export interface ButtondownWebhook {
|
|
73
|
+
id: string;
|
|
74
|
+
creation_date: string;
|
|
75
|
+
url: string;
|
|
76
|
+
event_types: ButtondownWebhookEvent[];
|
|
77
|
+
status?: 'enabled' | 'disabled';
|
|
78
|
+
description?: string;
|
|
79
|
+
signing_key?: string;
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/common/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
import { ButtondownWebhookEvent } from './types';
|
|
3
|
+
export interface ButtondownWebhookPayload {
|
|
4
|
+
event_type?: string;
|
|
5
|
+
data?: Record<string, unknown>;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface CreateButtondownWebhookTriggerParams {
|
|
9
|
+
name: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
description: string;
|
|
12
|
+
eventType: ButtondownWebhookEvent;
|
|
13
|
+
sampleData: unknown;
|
|
14
|
+
enrich?: (params: {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
payload: ButtondownWebhookPayload;
|
|
17
|
+
}) => Promise<Record<string, unknown>>;
|
|
18
|
+
}
|
|
19
|
+
export declare const createButtondownWebhookTrigger: ({ name, displayName, description, eventType, sampleData, enrich, }: CreateButtondownWebhookTriggerParams) => import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
20
|
+
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
21
|
+
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
22
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
23
|
+
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
24
|
+
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
25
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
26
|
+
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
27
|
+
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
29
|
+
webhookDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
30
|
+
signingKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
31
|
+
}>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,U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W;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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|