@agnocon/piece-buttondown 0.0.5
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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/create-subscriber.d.ts +17 -0
- package/dist/lib/actions/create-subscriber.d.ts.map +1 -0
- package/dist/lib/actions/create-subscriber.js +155 -0
- package/dist/lib/actions/create-subscriber.js.map +1 -0
- package/dist/lib/actions/custom-api-call.d.ts +13 -0
- package/dist/lib/actions/custom-api-call.d.ts.map +1 -0
- package/dist/lib/actions/custom-api-call.js +19 -0
- package/dist/lib/actions/custom-api-call.js.map +1 -0
- package/dist/lib/actions/list-subscribers.d.ts +11 -0
- package/dist/lib/actions/list-subscribers.d.ts.map +1 -0
- package/dist/lib/actions/list-subscribers.js +115 -0
- package/dist/lib/actions/list-subscribers.js.map +1 -0
- package/dist/lib/actions/send-email.d.ts +16 -0
- package/dist/lib/actions/send-email.d.ts.map +1 -0
- package/dist/lib/actions/send-email.js +147 -0
- package/dist/lib/actions/send-email.js.map +1 -0
- package/dist/lib/common/auth.d.ts +2 -0
- package/dist/lib/common/auth.d.ts.map +1 -0
- package/dist/lib/common/auth.js +46 -0
- package/dist/lib/common/auth.js.map +1 -0
- package/dist/lib/common/client.d.ts +20 -0
- package/dist/lib/common/client.d.ts.map +1 -0
- package/dist/lib/common/client.js +41 -0
- package/dist/lib/common/client.js.map +1 -0
- package/dist/lib/common/options.d.ts +22 -0
- package/dist/lib/common/options.d.ts.map +1 -0
- package/dist/lib/common/options.js +58 -0
- package/dist/lib/common/options.js.map +1 -0
- package/dist/lib/common/types.d.ts +81 -0
- package/dist/lib/common/types.d.ts.map +1 -0
- package/dist/lib/common/types.js +3 -0
- package/dist/lib/common/types.js.map +1 -0
- package/dist/lib/common/webhook.d.ts +36 -0
- package/dist/lib/common/webhook.d.ts.map +1 -0
- package/dist/lib/common/webhook.js +80 -0
- package/dist/lib/common/webhook.js.map +1 -0
- package/dist/lib/triggers/email-sent.d.ts +14 -0
- package/dist/lib/triggers/email-sent.d.ts.map +1 -0
- package/dist/lib/triggers/email-sent.js +43 -0
- package/dist/lib/triggers/email-sent.js.map +1 -0
- package/dist/lib/triggers/new-subscriber.d.ts +14 -0
- package/dist/lib/triggers/new-subscriber.d.ts.map +1 -0
- package/dist/lib/triggers/new-subscriber.js +43 -0
- package/dist/lib/triggers/new-subscriber.js.map +1 -0
- package/dist/lib/triggers/subscriber-confirmed.d.ts +14 -0
- package/dist/lib/triggers/subscriber-confirmed.d.ts.map +1 -0
- package/dist/lib/triggers/subscriber-confirmed.js +43 -0
- package/dist/lib/triggers/subscriber-confirmed.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +26 -0
- package/src/lib/actions/create-subscriber.ts +171 -0
- package/src/lib/actions/custom-api-call.ts +11 -0
- package/src/lib/actions/list-subscribers.ts +125 -0
- package/src/lib/actions/send-email.ts +162 -0
- package/src/lib/common/auth.ts +58 -0
- package/src/lib/common/client.ts +83 -0
- package/src/lib/common/options.ts +65 -0
- package/src/lib/common/types.ts +141 -0
- package/src/lib/common/webhook.ts +105 -0
- package/src/lib/triggers/email-sent.ts +39 -0
- package/src/lib/triggers/new-subscriber.ts +39 -0
- package/src/lib/triggers/subscriber-confirmed.ts +39 -0
package/LICENSE.MIT-AP
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Activepieces AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Derived helpers in this folder are adapted from Activepieces (MIT) for use
|
|
24
|
+
inside CX without depending on @activepieces/* packages at runtime.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,yGAcrB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buttondown = void 0;
|
|
4
|
+
// Vendored from Activepieces packages/pieces/community/buttondown/src/index.ts (MIT).
|
|
5
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
6
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
7
|
+
const pieces_framework_2 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("./lib/common/auth");
|
|
9
|
+
const create_subscriber_1 = require("./lib/actions/create-subscriber");
|
|
10
|
+
const list_subscribers_1 = require("./lib/actions/list-subscribers");
|
|
11
|
+
const send_email_1 = require("./lib/actions/send-email");
|
|
12
|
+
const custom_api_call_1 = require("./lib/actions/custom-api-call");
|
|
13
|
+
const new_subscriber_1 = require("./lib/triggers/new-subscriber");
|
|
14
|
+
const subscriber_confirmed_1 = require("./lib/triggers/subscriber-confirmed");
|
|
15
|
+
const email_sent_1 = require("./lib/triggers/email-sent");
|
|
16
|
+
exports.buttondown = (0, pieces_framework_1.createPiece)({
|
|
17
|
+
displayName: 'Buttondown',
|
|
18
|
+
description: 'Automate your Buttondown newsletter workflows.',
|
|
19
|
+
auth: auth_1.buttondownAuth,
|
|
20
|
+
minimumSupportedRelease: '0.36.1',
|
|
21
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/buttondown.png',
|
|
22
|
+
authors: ['jacksbox-cassandra'],
|
|
23
|
+
categories: [pieces_framework_2.PieceCategory.MARKETING, pieces_framework_2.PieceCategory.COMMUNICATION],
|
|
24
|
+
actions: [create_subscriber_1.createSubscriber, list_subscribers_1.listSubscribers, send_email_1.sendEmail, custom_api_call_1.customApiCall],
|
|
25
|
+
triggers: [
|
|
26
|
+
new_subscriber_1.buttondownNewSubscriber,
|
|
27
|
+
subscriber_confirmed_1.buttondownSubscriberConfirmed,
|
|
28
|
+
email_sent_1.buttondownEmailSent,
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sFAAsF;AACtF,qEAAqE;AACrE,gEAAwD;AACxD,gEAA0D;AAC1D,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,gCAAa,CAAC,SAAS,EAAE,gCAAa,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,17 @@
|
|
|
1
|
+
import { ButtondownSubscriberType } from '../common/types';
|
|
2
|
+
export declare const createSubscriber: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
email: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
type: import("@agnocon/pieces-framework").StaticDropdownProperty<ButtondownSubscriberType, false>;
|
|
5
|
+
notes: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
6
|
+
tags: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
metadata: import("@agnocon/pieces-framework").JsonProperty<false>;
|
|
8
|
+
referrerUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
utmSource: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
utmMedium: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
utmCampaign: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
referringSubscriberId: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
ipAddress: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
collisionBehavior: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
15
|
+
bypassFirewall: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=create-subscriber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-subscriber.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/create-subscriber.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,wBAAwB,EACzB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;EA+J3B,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSubscriber = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/buttondown/src/lib/actions/create-subscriber.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const client_1 = require("../common/client");
|
|
11
|
+
const options_1 = require("../common/options");
|
|
12
|
+
exports.createSubscriber = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.buttondownAuth,
|
|
14
|
+
name: 'createSubscriber',
|
|
15
|
+
displayName: 'Create Subscriber',
|
|
16
|
+
description: 'Create a new subscriber in Buttondown.',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Adds a subscriber to a Buttondown newsletter by email address, with optional tags, metadata, UTM attribution, and referral data. Use "regular" subscriber type to skip double opt-in. Not idempotent: each call creates a subscriber; control duplicate-email handling via collision behavior (default keeps the existing subscriber, or overwrite/merge tags).',
|
|
20
|
+
idempotent: false,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
email: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Email Address',
|
|
25
|
+
required: true,
|
|
26
|
+
description: 'The email address of the subscriber.',
|
|
27
|
+
}),
|
|
28
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
29
|
+
displayName: 'Subscriber Type',
|
|
30
|
+
description: 'Set the subscriber status. Use "regular" to bypass double opt-in.',
|
|
31
|
+
required: false,
|
|
32
|
+
options: {
|
|
33
|
+
options: options_1.subscriberTypeOptions,
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
notes: pieces_framework_1.Property.LongText({
|
|
37
|
+
displayName: 'Internal Notes',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
tags: pieces_framework_1.Property.Array({
|
|
41
|
+
displayName: 'Tags',
|
|
42
|
+
description: 'Add one or more tags to assign to the subscriber.',
|
|
43
|
+
required: false,
|
|
44
|
+
properties: {
|
|
45
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
46
|
+
displayName: 'Tag',
|
|
47
|
+
required: true,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
metadata: pieces_framework_1.Property.Json({
|
|
52
|
+
displayName: 'Metadata',
|
|
53
|
+
description: 'Custom metadata to store on the subscriber (JSON object).',
|
|
54
|
+
required: false,
|
|
55
|
+
}),
|
|
56
|
+
referrerUrl: pieces_framework_1.Property.ShortText({
|
|
57
|
+
displayName: 'Referrer URL',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
utmSource: pieces_framework_1.Property.ShortText({
|
|
61
|
+
displayName: 'UTM Source',
|
|
62
|
+
required: false,
|
|
63
|
+
}),
|
|
64
|
+
utmMedium: pieces_framework_1.Property.ShortText({
|
|
65
|
+
displayName: 'UTM Medium',
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
utmCampaign: pieces_framework_1.Property.ShortText({
|
|
69
|
+
displayName: 'UTM Campaign',
|
|
70
|
+
required: false,
|
|
71
|
+
}),
|
|
72
|
+
referringSubscriberId: pieces_framework_1.Property.ShortText({
|
|
73
|
+
displayName: 'Referring Subscriber ID',
|
|
74
|
+
description: 'ID of the subscriber who referred this contact.',
|
|
75
|
+
required: false,
|
|
76
|
+
}),
|
|
77
|
+
ipAddress: pieces_framework_1.Property.ShortText({
|
|
78
|
+
displayName: 'IP Address',
|
|
79
|
+
description: 'The original IP address of the subscriber. Helps Buttondown evaluate spam.',
|
|
80
|
+
required: false,
|
|
81
|
+
}),
|
|
82
|
+
collisionBehavior: pieces_framework_1.Property.StaticDropdown({
|
|
83
|
+
displayName: 'Collision Behavior',
|
|
84
|
+
description: 'Control how Buttondown handles duplicate email addresses. Leave empty to keep the existing subscriber.',
|
|
85
|
+
required: false,
|
|
86
|
+
options: {
|
|
87
|
+
options: [
|
|
88
|
+
{ label: 'Overwrite existing subscriber', value: 'overwrite' },
|
|
89
|
+
{ label: 'Merge tags with existing subscriber', value: 'add' },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
bypassFirewall: pieces_framework_1.Property.Checkbox({
|
|
94
|
+
displayName: 'Bypass Firewall',
|
|
95
|
+
description: 'Set to true when the request originates from a trusted internal system without the subscriber\'s IP address.',
|
|
96
|
+
required: false,
|
|
97
|
+
defaultValue: false,
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
run(_a) {
|
|
101
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
102
|
+
var _b;
|
|
103
|
+
const payload = {
|
|
104
|
+
email_address: propsValue.email,
|
|
105
|
+
};
|
|
106
|
+
if (propsValue.notes) {
|
|
107
|
+
payload.notes = propsValue.notes;
|
|
108
|
+
}
|
|
109
|
+
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);
|
|
110
|
+
if (tags && tags.length > 0) {
|
|
111
|
+
payload.tags = tags;
|
|
112
|
+
}
|
|
113
|
+
if (propsValue.metadata) {
|
|
114
|
+
if (typeof propsValue.metadata !== 'object' || Array.isArray(propsValue.metadata)) {
|
|
115
|
+
throw new Error('Metadata must be a JSON object.');
|
|
116
|
+
}
|
|
117
|
+
payload.metadata = propsValue.metadata;
|
|
118
|
+
}
|
|
119
|
+
if (propsValue.referrerUrl) {
|
|
120
|
+
payload.referrer_url = propsValue.referrerUrl;
|
|
121
|
+
}
|
|
122
|
+
if (propsValue.utmSource) {
|
|
123
|
+
payload.utm_source = propsValue.utmSource;
|
|
124
|
+
}
|
|
125
|
+
if (propsValue.utmMedium) {
|
|
126
|
+
payload.utm_medium = propsValue.utmMedium;
|
|
127
|
+
}
|
|
128
|
+
if (propsValue.utmCampaign) {
|
|
129
|
+
payload.utm_campaign = propsValue.utmCampaign;
|
|
130
|
+
}
|
|
131
|
+
if (propsValue.referringSubscriberId) {
|
|
132
|
+
payload.referring_subscriber_id = propsValue.referringSubscriberId;
|
|
133
|
+
}
|
|
134
|
+
if (propsValue.type) {
|
|
135
|
+
payload.type = propsValue.type;
|
|
136
|
+
}
|
|
137
|
+
if (propsValue.ipAddress) {
|
|
138
|
+
payload.ip_address = propsValue.ipAddress;
|
|
139
|
+
}
|
|
140
|
+
const headers = {
|
|
141
|
+
'X-Buttondown-Collision-Behavior': propsValue.collisionBehavior,
|
|
142
|
+
'X-Buttondown-Bypass-Firewall': propsValue.bypassFirewall ? 'true' : undefined,
|
|
143
|
+
};
|
|
144
|
+
const subscriber = yield (0, client_1.buttondownRequest)({
|
|
145
|
+
auth: auth.secret_text,
|
|
146
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
147
|
+
path: '/subscribers',
|
|
148
|
+
body: payload,
|
|
149
|
+
headers,
|
|
150
|
+
});
|
|
151
|
+
return subscriber;
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
//# 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,8GAA8G;AAC9G,qEAAqE;AACrE,0DAAoD;AACpD,gEAAmE;AACnE,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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,iWAAiW;QACnW,UAAU,EAAE,KAAK;KAClB;IACD,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,KAAK;oBAClB,QAAQ,EAAE,IAAI;iBACf,CAAC;aACH;SACF,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACtB,WAAW,EAAE,UAAU;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AC5C,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,13 @@
|
|
|
1
|
+
export declare const customApiCall: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
url: import("@agnocon/pieces-framework").DynamicProperties<true, import("@agnocon/pieces-framework").SecretTextProperty<true> | undefined>;
|
|
3
|
+
method: import("@agnocon/pieces-framework").StaticDropdownProperty<import("@agnocon/pieces-common").HttpMethod, false> | import("@agnocon/pieces-framework").StaticDropdownProperty<import("@agnocon/pieces-common").HttpMethod, true>;
|
|
4
|
+
headers: import("@agnocon/pieces-framework").ObjectProperty<false> | import("@agnocon/pieces-framework").ObjectProperty<true>;
|
|
5
|
+
queryParams: import("@agnocon/pieces-framework").ObjectProperty<false> | import("@agnocon/pieces-framework").ObjectProperty<true>;
|
|
6
|
+
body_type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
body: import("@agnocon/pieces-framework").DynamicProperties<false, import("@agnocon/pieces-framework").SecretTextProperty<true> | undefined>;
|
|
8
|
+
response_is_binary: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
9
|
+
failsafe: import("@agnocon/pieces-framework").CheckboxProperty<false> | import("@agnocon/pieces-framework").CheckboxProperty<true>;
|
|
10
|
+
timeout: import("@agnocon/pieces-framework").NumberProperty<false> | import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
11
|
+
followRedirects: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=custom-api-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-api-call.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/custom-api-call.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;EAMxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customApiCall = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/buttondown/src/lib/actions/custom-api-call.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
exports.customApiCall = (0, pieces_common_1.createCustomApiCallAction)({
|
|
11
|
+
auth: auth_1.buttondownAuth,
|
|
12
|
+
baseUrl: () => client_1.BUTTONDOWN_BASE_URL,
|
|
13
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
return ({
|
|
15
|
+
Authorization: `Token ${auth.secret_text}`,
|
|
16
|
+
});
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
//# 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,4GAA4G;AAC5G,qEAAqE;AACrE,0DAAmE;AACnE,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,11 @@
|
|
|
1
|
+
export declare const listSubscribers: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
limit: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
3
|
+
cursor: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
type: import("@agnocon/pieces-framework").StaticDropdownProperty<import("../common/types").ButtondownSubscriberType, false>;
|
|
5
|
+
source: import("@agnocon/pieces-framework").StaticDropdownProperty<import("../common/types").ButtondownSubscriberSource, false>;
|
|
6
|
+
tags: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
emailAddress: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
referrerUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
ordering: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=list-subscribers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-subscribers.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/list-subscribers.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe;;;;;;;;;EAiH1B,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listSubscribers = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/buttondown/src/lib/actions/list-subscribers.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const client_1 = require("../common/client");
|
|
11
|
+
const options_1 = require("../common/options");
|
|
12
|
+
exports.listSubscribers = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.buttondownAuth,
|
|
14
|
+
name: 'listSubscribers',
|
|
15
|
+
displayName: 'List Subscribers',
|
|
16
|
+
description: 'Retrieve subscribers from Buttondown.',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Lists subscribers from a Buttondown newsletter, optionally filtered by type, source, tags, email substring, or referrer URL; with no filters it returns all subscribers. Use to look up or enumerate subscribers. Read-only and idempotent. Returns one page (default 100); pass the returned cursor to page through results.',
|
|
20
|
+
idempotent: true,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
limit: pieces_framework_1.Property.Number({
|
|
24
|
+
displayName: 'Page Size',
|
|
25
|
+
description: 'Maximum number of subscribers to return (1-1000).',
|
|
26
|
+
required: false,
|
|
27
|
+
defaultValue: 100,
|
|
28
|
+
}),
|
|
29
|
+
cursor: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Cursor',
|
|
31
|
+
description: 'Provide the cursor value from a previous response to fetch the next page.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
type: pieces_framework_1.Property.StaticDropdown({
|
|
35
|
+
displayName: 'Subscriber Type',
|
|
36
|
+
required: false,
|
|
37
|
+
options: {
|
|
38
|
+
options: options_1.subscriberTypeOptions,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
source: pieces_framework_1.Property.StaticDropdown({
|
|
42
|
+
displayName: 'Source',
|
|
43
|
+
required: false,
|
|
44
|
+
options: {
|
|
45
|
+
options: options_1.subscriberSourceOptions,
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
tags: pieces_framework_1.Property.Array({
|
|
49
|
+
displayName: 'Tags',
|
|
50
|
+
description: 'Filter by subscribers who have at least one of these tags.',
|
|
51
|
+
required: false,
|
|
52
|
+
properties: {
|
|
53
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
54
|
+
displayName: 'Tag',
|
|
55
|
+
required: true,
|
|
56
|
+
}),
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
emailAddress: pieces_framework_1.Property.ShortText({
|
|
60
|
+
displayName: 'Email Contains',
|
|
61
|
+
description: 'Return subscribers whose email address contains this value.',
|
|
62
|
+
required: false,
|
|
63
|
+
}),
|
|
64
|
+
referrerUrl: pieces_framework_1.Property.ShortText({
|
|
65
|
+
displayName: 'Referrer URL Contains',
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
ordering: pieces_framework_1.Property.StaticDropdown({
|
|
69
|
+
displayName: 'Ordering',
|
|
70
|
+
required: false,
|
|
71
|
+
options: {
|
|
72
|
+
options: options_1.subscriberOrderingOptions,
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
76
|
+
run(_a) {
|
|
77
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
78
|
+
var _b;
|
|
79
|
+
const query = {};
|
|
80
|
+
if (propsValue.limit) {
|
|
81
|
+
query['page_size'] = propsValue.limit;
|
|
82
|
+
}
|
|
83
|
+
if (propsValue.cursor) {
|
|
84
|
+
query['cursor'] = propsValue.cursor;
|
|
85
|
+
}
|
|
86
|
+
if (propsValue.type) {
|
|
87
|
+
query['type'] = [propsValue.type];
|
|
88
|
+
}
|
|
89
|
+
if (propsValue.source) {
|
|
90
|
+
query['source'] = [propsValue.source];
|
|
91
|
+
}
|
|
92
|
+
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);
|
|
93
|
+
if (tags && tags.length > 0) {
|
|
94
|
+
query['tag'] = tags;
|
|
95
|
+
}
|
|
96
|
+
if (propsValue.emailAddress) {
|
|
97
|
+
query['email_address'] = propsValue.emailAddress;
|
|
98
|
+
}
|
|
99
|
+
if (propsValue.referrerUrl) {
|
|
100
|
+
query['referrer_url'] = propsValue.referrerUrl;
|
|
101
|
+
}
|
|
102
|
+
if (propsValue.ordering) {
|
|
103
|
+
query['ordering'] = propsValue.ordering;
|
|
104
|
+
}
|
|
105
|
+
const response = yield (0, client_1.buttondownRequest)({
|
|
106
|
+
auth: auth.secret_text,
|
|
107
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
108
|
+
path: '/subscribers',
|
|
109
|
+
query,
|
|
110
|
+
});
|
|
111
|
+
return response;
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=list-subscribers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-subscribers.js","sourceRoot":"","sources":["../../../src/lib/actions/list-subscribers.ts"],"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,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,16 @@
|
|
|
1
|
+
import { ButtondownEmailStatus, ButtondownEmailType } from '../common/types';
|
|
2
|
+
export declare const sendEmail: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
subject: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
body: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
status: import("@agnocon/pieces-framework").StaticDropdownProperty<ButtondownEmailStatus, false>;
|
|
6
|
+
publishDate: import("@agnocon/pieces-framework").DateTimeProperty<false>;
|
|
7
|
+
emailType: import("@agnocon/pieces-framework").StaticDropdownProperty<ButtondownEmailType, false>;
|
|
8
|
+
description: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
9
|
+
canonicalUrl: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
image: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
slug: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
metadata: import("@agnocon/pieces-framework").JsonProperty<false>;
|
|
13
|
+
attachments: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
14
|
+
triggerBilling: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=send-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-email.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/send-email.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,SAAS;;;;;;;;;;;;;EAqJpB,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendEmail = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/buttondown/src/lib/actions/send-email.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const client_1 = require("../common/client");
|
|
11
|
+
const options_1 = require("../common/options");
|
|
12
|
+
exports.sendEmail = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.buttondownAuth,
|
|
14
|
+
name: 'sendEmail',
|
|
15
|
+
displayName: 'Send Email',
|
|
16
|
+
description: 'Send an email to your Buttondown subscribers.',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Creates an email in Buttondown from a subject and Markdown/HTML body, then handles it per the chosen delivery status (e.g. send now vs. schedule for a future publish date, or save as draft). Use to broadcast a newsletter or queue one for later. A publish date is required when status is scheduled. Not idempotent: each call creates and may dispatch a new email.',
|
|
20
|
+
idempotent: false,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Subject',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
body: pieces_framework_1.Property.LongText({
|
|
28
|
+
displayName: 'Body',
|
|
29
|
+
description: 'Write your email content in Markdown or HTML. Buttondown will detect the format automatically.',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
33
|
+
displayName: 'Delivery Status',
|
|
34
|
+
description: 'Choose how Buttondown should treat this email after creation.',
|
|
35
|
+
required: false,
|
|
36
|
+
defaultValue: 'about_to_send',
|
|
37
|
+
options: {
|
|
38
|
+
options: options_1.emailStatusOptions,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
publishDate: pieces_framework_1.Property.DateTime({
|
|
42
|
+
displayName: 'Publish Date',
|
|
43
|
+
description: 'Required when scheduling an email. Use ISO 8601 format.',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
emailType: pieces_framework_1.Property.StaticDropdown({
|
|
47
|
+
displayName: 'Email Type',
|
|
48
|
+
required: false,
|
|
49
|
+
defaultValue: 'public',
|
|
50
|
+
options: {
|
|
51
|
+
options: options_1.emailTypeOptions,
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
description: pieces_framework_1.Property.LongText({
|
|
55
|
+
displayName: 'Description',
|
|
56
|
+
required: false,
|
|
57
|
+
}),
|
|
58
|
+
canonicalUrl: pieces_framework_1.Property.ShortText({
|
|
59
|
+
displayName: 'Canonical URL',
|
|
60
|
+
required: false,
|
|
61
|
+
}),
|
|
62
|
+
image: pieces_framework_1.Property.ShortText({
|
|
63
|
+
displayName: 'Primary Image URL',
|
|
64
|
+
required: false,
|
|
65
|
+
}),
|
|
66
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
67
|
+
displayName: 'Slug',
|
|
68
|
+
description: 'Override the automatic slug used for the archive URL.',
|
|
69
|
+
required: false,
|
|
70
|
+
}),
|
|
71
|
+
metadata: pieces_framework_1.Property.Json({
|
|
72
|
+
displayName: 'Metadata',
|
|
73
|
+
description: 'Custom metadata to attach to the email (JSON object).',
|
|
74
|
+
required: false,
|
|
75
|
+
}),
|
|
76
|
+
attachments: pieces_framework_1.Property.Array({
|
|
77
|
+
displayName: 'Attachment IDs',
|
|
78
|
+
description: 'IDs of attachments uploaded via the Buttondown API.',
|
|
79
|
+
required: false,
|
|
80
|
+
properties: {
|
|
81
|
+
id: pieces_framework_1.Property.ShortText({
|
|
82
|
+
displayName: 'Attachment ID',
|
|
83
|
+
required: true,
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
triggerBilling: pieces_framework_1.Property.Checkbox({
|
|
88
|
+
displayName: 'Trigger Pay-per-email Billing',
|
|
89
|
+
description: 'Enable when this email should count against pay-per-email billing for paid subscribers.',
|
|
90
|
+
required: false,
|
|
91
|
+
defaultValue: false,
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
run(_a) {
|
|
95
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
96
|
+
var _b, _c;
|
|
97
|
+
const status = (_b = propsValue.status) !== null && _b !== void 0 ? _b : 'about_to_send';
|
|
98
|
+
if (status === 'scheduled' && !propsValue.publishDate) {
|
|
99
|
+
throw new Error('Publish date is required when scheduling an email.');
|
|
100
|
+
}
|
|
101
|
+
const payload = {
|
|
102
|
+
subject: propsValue.subject,
|
|
103
|
+
body: propsValue.body,
|
|
104
|
+
status,
|
|
105
|
+
};
|
|
106
|
+
if (propsValue.publishDate) {
|
|
107
|
+
payload.publish_date = propsValue.publishDate;
|
|
108
|
+
}
|
|
109
|
+
if (propsValue.emailType) {
|
|
110
|
+
payload.email_type = propsValue.emailType;
|
|
111
|
+
}
|
|
112
|
+
if (propsValue.description) {
|
|
113
|
+
payload.description = propsValue.description;
|
|
114
|
+
}
|
|
115
|
+
if (propsValue.canonicalUrl) {
|
|
116
|
+
payload.canonical_url = propsValue.canonicalUrl;
|
|
117
|
+
}
|
|
118
|
+
if (propsValue.image) {
|
|
119
|
+
payload.image = propsValue.image;
|
|
120
|
+
}
|
|
121
|
+
if (propsValue.slug) {
|
|
122
|
+
payload.slug = propsValue.slug;
|
|
123
|
+
}
|
|
124
|
+
if (propsValue.metadata) {
|
|
125
|
+
if (typeof propsValue.metadata !== 'object' || Array.isArray(propsValue.metadata)) {
|
|
126
|
+
throw new Error('Metadata must be provided as a JSON object.');
|
|
127
|
+
}
|
|
128
|
+
payload.metadata = propsValue.metadata;
|
|
129
|
+
}
|
|
130
|
+
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);
|
|
131
|
+
if (attachments && attachments.length > 0) {
|
|
132
|
+
payload.attachments = attachments;
|
|
133
|
+
}
|
|
134
|
+
if (propsValue.triggerBilling) {
|
|
135
|
+
payload.should_trigger_pay_per_email_billing = true;
|
|
136
|
+
}
|
|
137
|
+
const email = yield (0, client_1.buttondownRequest)({
|
|
138
|
+
auth: auth.secret_text,
|
|
139
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
140
|
+
path: '/emails',
|
|
141
|
+
body: payload,
|
|
142
|
+
});
|
|
143
|
+
return email;
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
//# sourceMappingURL=send-email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-email.js","sourceRoot":"","sources":["../../../src/lib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