@scopieflows/app-convertkit 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/package.json +28 -0
- package/src/i18n/ca.json +240 -0
- package/src/i18n/de.json +239 -0
- package/src/i18n/es.json +239 -0
- package/src/i18n/fr.json +239 -0
- package/src/i18n/hi.json +240 -0
- package/src/i18n/id.json +240 -0
- package/src/i18n/ja.json +239 -0
- package/src/i18n/nl.json +239 -0
- package/src/i18n/pt.json +239 -0
- package/src/i18n/ru.json +240 -0
- package/src/i18n/translation.json +239 -0
- package/src/i18n/vi.json +240 -0
- package/src/i18n/zh.json +239 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +80 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/broadcasts.d.ts +37 -0
- package/src/lib/actions/broadcasts.js +213 -0
- package/src/lib/actions/broadcasts.js.map +1 -0
- package/src/lib/actions/custom-fields.d.ts +11 -0
- package/src/lib/actions/custom-fields.js +109 -0
- package/src/lib/actions/custom-fields.js.map +1 -0
- package/src/lib/actions/forms.d.ts +23 -0
- package/src/lib/actions/forms.js +90 -0
- package/src/lib/actions/forms.js.map +1 -0
- package/src/lib/actions/purchases.d.ts +51 -0
- package/src/lib/actions/purchases.js +258 -0
- package/src/lib/actions/purchases.js.map +1 -0
- package/src/lib/actions/sequences.d.ts +11 -0
- package/src/lib/actions/sequences.js +87 -0
- package/src/lib/actions/sequences.js.map +1 -0
- package/src/lib/actions/subscribers.d.ts +38 -0
- package/src/lib/actions/subscribers.js +172 -0
- package/src/lib/actions/subscribers.js.map +1 -0
- package/src/lib/actions/tags.d.ts +37 -0
- package/src/lib/actions/tags.js +188 -0
- package/src/lib/actions/tags.js.map +1 -0
- package/src/lib/actions/webhooks.d.ts +8 -0
- package/src/lib/actions/webhooks.js +40 -0
- package/src/lib/actions/webhooks.js.map +1 -0
- package/src/lib/common/broadcasts/index.d.ts +12 -0
- package/src/lib/common/broadcasts/index.js +67 -0
- package/src/lib/common/broadcasts/index.js.map +1 -0
- package/src/lib/common/constants.d.ts +9 -0
- package/src/lib/common/constants.js +13 -0
- package/src/lib/common/constants.js.map +1 -0
- package/src/lib/common/custom-fields/index.d.ts +4 -0
- package/src/lib/common/custom-fields/index.js +71 -0
- package/src/lib/common/custom-fields/index.js.map +1 -0
- package/src/lib/common/forms/index.d.ts +1 -0
- package/src/lib/common/forms/index.js +34 -0
- package/src/lib/common/forms/index.js.map +1 -0
- package/src/lib/common/index.d.ts +7 -0
- package/src/lib/common/index.js +11 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/common/purchases/index.d.ts +22 -0
- package/src/lib/common/purchases/index.js +168 -0
- package/src/lib/common/purchases/index.js.map +1 -0
- package/src/lib/common/sequences/index.d.ts +2 -0
- package/src/lib/common/sequences/index.js +39 -0
- package/src/lib/common/sequences/index.js.map +1 -0
- package/src/lib/common/service.d.ts +12 -0
- package/src/lib/common/service.js +238 -0
- package/src/lib/common/service.js.map +1 -0
- package/src/lib/common/subscribers/index.d.ts +18 -0
- package/src/lib/common/subscribers/index.js +64 -0
- package/src/lib/common/subscribers/index.js.map +1 -0
- package/src/lib/common/tags/index.d.ts +23 -0
- package/src/lib/common/tags/index.js +215 -0
- package/src/lib/common/tags/index.js.map +1 -0
- package/src/lib/common/types.d.ts +115 -0
- package/src/lib/common/types.js +19 -0
- package/src/lib/common/types.js.map +1 -0
- package/src/lib/common/webhooks/index.d.ts +7 -0
- package/src/lib/common/webhooks/index.js +209 -0
- package/src/lib/common/webhooks/index.js.map +1 -0
- package/src/lib/triggers/index.d.ts +69 -0
- package/src/lib/triggers/index.js +549 -0
- package/src/lib/triggers/index.js.map +1 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeWebhook = exports.createWebhook = exports.fetchTags = exports.fetchSubscribedTags = exports.fetchSubscriberByEmail = exports.fetchSubscriperById = exports.fetchSequences = exports.fetchPurchases = exports.fetchForms = exports.fetchCustomFields = exports.fetchBroadcasts = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
7
|
+
const fetchBroadcasts = (auth, page) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
+
const url = constants_1.BROADCASTS_API_ENDPOINT;
|
|
9
|
+
const request = {
|
|
10
|
+
url,
|
|
11
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
12
|
+
queryParams: {
|
|
13
|
+
api_secret: auth,
|
|
14
|
+
page: page.toString(),
|
|
15
|
+
sort_order: 'desc',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
19
|
+
const errorMessage = `Failed to fetch broadcasts. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
20
|
+
if (response.status !== 200) {
|
|
21
|
+
throw new Error(errorMessage);
|
|
22
|
+
}
|
|
23
|
+
if (response.body.broadcasts) {
|
|
24
|
+
return response.body.broadcasts;
|
|
25
|
+
}
|
|
26
|
+
throw new Error(errorMessage);
|
|
27
|
+
});
|
|
28
|
+
exports.fetchBroadcasts = fetchBroadcasts;
|
|
29
|
+
const fetchCustomFields = (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
const url = constants_1.CUSTOM_FIELDS_API_ENDPOINT;
|
|
31
|
+
const body = {
|
|
32
|
+
api_secret: auth,
|
|
33
|
+
};
|
|
34
|
+
const request = {
|
|
35
|
+
url,
|
|
36
|
+
body,
|
|
37
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
38
|
+
};
|
|
39
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
40
|
+
const errorMessage = `Failed to fetch custom fields. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
41
|
+
if (response.status !== 200) {
|
|
42
|
+
throw new Error(errorMessage);
|
|
43
|
+
}
|
|
44
|
+
if (response.body.custom_fields) {
|
|
45
|
+
return response.body.custom_fields;
|
|
46
|
+
}
|
|
47
|
+
throw new Error(errorMessage);
|
|
48
|
+
});
|
|
49
|
+
exports.fetchCustomFields = fetchCustomFields;
|
|
50
|
+
const fetchForms = (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const url = constants_1.FORMS_API_ENDPOINT;
|
|
52
|
+
const body = {
|
|
53
|
+
api_secret: auth,
|
|
54
|
+
};
|
|
55
|
+
const request = {
|
|
56
|
+
url,
|
|
57
|
+
body,
|
|
58
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
59
|
+
};
|
|
60
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
61
|
+
const errorMessage = `Failed to fetch forms. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
62
|
+
if (response.status !== 200) {
|
|
63
|
+
throw new Error(errorMessage);
|
|
64
|
+
}
|
|
65
|
+
if (response.body.forms) {
|
|
66
|
+
return response.body.forms;
|
|
67
|
+
}
|
|
68
|
+
throw new Error(errorMessage);
|
|
69
|
+
});
|
|
70
|
+
exports.fetchForms = fetchForms;
|
|
71
|
+
const fetchPurchases = (auth, page) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
const url = constants_1.PURCHASES_API_ENDPOINT;
|
|
73
|
+
const body = {
|
|
74
|
+
api_secret: auth,
|
|
75
|
+
page,
|
|
76
|
+
};
|
|
77
|
+
const request = {
|
|
78
|
+
url,
|
|
79
|
+
body,
|
|
80
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
81
|
+
};
|
|
82
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
83
|
+
const errorMessage = `Failed to fetch purchases. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
84
|
+
if (response.status !== 200) {
|
|
85
|
+
throw new Error(errorMessage);
|
|
86
|
+
}
|
|
87
|
+
if (response.body.purchases) {
|
|
88
|
+
return response.body.purchases;
|
|
89
|
+
}
|
|
90
|
+
throw new Error(errorMessage);
|
|
91
|
+
});
|
|
92
|
+
exports.fetchPurchases = fetchPurchases;
|
|
93
|
+
const fetchSequences = (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
const url = constants_1.SEQUENCES_API_ENDPOINT;
|
|
95
|
+
const body = {
|
|
96
|
+
api_secret: auth,
|
|
97
|
+
};
|
|
98
|
+
const request = {
|
|
99
|
+
url,
|
|
100
|
+
body,
|
|
101
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
102
|
+
};
|
|
103
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
104
|
+
const errorMessage = `Failed to fetch sequences. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
105
|
+
if (response.status !== 200) {
|
|
106
|
+
throw new Error(errorMessage);
|
|
107
|
+
}
|
|
108
|
+
if (response.body.courses) {
|
|
109
|
+
return response.body.courses;
|
|
110
|
+
}
|
|
111
|
+
throw new Error(errorMessage);
|
|
112
|
+
});
|
|
113
|
+
exports.fetchSequences = fetchSequences;
|
|
114
|
+
const fetchSubscriperById = (auth, subscriberId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
115
|
+
const url = `${constants_1.SUBSCRIBERS_API_ENDPOINT}/${subscriberId}`;
|
|
116
|
+
const body = {
|
|
117
|
+
api_secret: auth,
|
|
118
|
+
};
|
|
119
|
+
const request = {
|
|
120
|
+
url,
|
|
121
|
+
body,
|
|
122
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
123
|
+
};
|
|
124
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
125
|
+
const errorMessage = `Failed to fetch subscriber. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
126
|
+
if (response.status !== 200) {
|
|
127
|
+
throw new Error(errorMessage);
|
|
128
|
+
}
|
|
129
|
+
if (response.body.subscriber) {
|
|
130
|
+
return response.body.subscriber;
|
|
131
|
+
}
|
|
132
|
+
throw new Error(errorMessage);
|
|
133
|
+
});
|
|
134
|
+
exports.fetchSubscriperById = fetchSubscriperById;
|
|
135
|
+
const fetchSubscriberByEmail = (auth, email_address) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
136
|
+
const url = constants_1.SUBSCRIBERS_API_ENDPOINT;
|
|
137
|
+
const body = {
|
|
138
|
+
api_secret: auth,
|
|
139
|
+
email_address,
|
|
140
|
+
};
|
|
141
|
+
const request = {
|
|
142
|
+
url,
|
|
143
|
+
body,
|
|
144
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
145
|
+
};
|
|
146
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
147
|
+
const errorMessage = `Failed to fetch subscriber that match the provided email. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
148
|
+
if (response.status !== 200) {
|
|
149
|
+
throw new Error(errorMessage);
|
|
150
|
+
}
|
|
151
|
+
const subscriber = response.body.subscribers[0];
|
|
152
|
+
if (subscriber) {
|
|
153
|
+
return subscriber;
|
|
154
|
+
}
|
|
155
|
+
throw new Error(errorMessage);
|
|
156
|
+
});
|
|
157
|
+
exports.fetchSubscriberByEmail = fetchSubscriberByEmail;
|
|
158
|
+
const fetchSubscribedTags = (auth, subscriberId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
159
|
+
const url = `${constants_1.SUBSCRIBERS_API_ENDPOINT}/${subscriberId}/tags`;
|
|
160
|
+
const body = {
|
|
161
|
+
api_secret: auth,
|
|
162
|
+
};
|
|
163
|
+
const request = {
|
|
164
|
+
url,
|
|
165
|
+
body,
|
|
166
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
167
|
+
};
|
|
168
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
169
|
+
const errorMessage = `Failed to fetch tags. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
170
|
+
if (response.status !== 200) {
|
|
171
|
+
throw new Error(errorMessage);
|
|
172
|
+
}
|
|
173
|
+
if (response.body.tags) {
|
|
174
|
+
return response.body.tags;
|
|
175
|
+
}
|
|
176
|
+
throw new Error(errorMessage);
|
|
177
|
+
});
|
|
178
|
+
exports.fetchSubscribedTags = fetchSubscribedTags;
|
|
179
|
+
const fetchTags = (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
180
|
+
const url = constants_1.TAGS_API_ENDPOINT;
|
|
181
|
+
const body = {
|
|
182
|
+
api_secret: auth,
|
|
183
|
+
};
|
|
184
|
+
const request = {
|
|
185
|
+
url,
|
|
186
|
+
body,
|
|
187
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
188
|
+
};
|
|
189
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
190
|
+
const errorMessage = `Failed to fetch tags. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
191
|
+
if (response.status !== 200) {
|
|
192
|
+
throw new Error(errorMessage);
|
|
193
|
+
}
|
|
194
|
+
if (response.body.tags) {
|
|
195
|
+
return response.body.tags;
|
|
196
|
+
}
|
|
197
|
+
throw new Error(errorMessage);
|
|
198
|
+
});
|
|
199
|
+
exports.fetchTags = fetchTags;
|
|
200
|
+
const createWebhook = (auth, payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
+
const body = Object.assign(Object.assign({}, payload), { api_secret: auth });
|
|
202
|
+
const url = constants_1.WEBHOOKS_API_ENDPOINT;
|
|
203
|
+
const request = {
|
|
204
|
+
url,
|
|
205
|
+
body,
|
|
206
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
207
|
+
};
|
|
208
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
209
|
+
const errorMessage = `Failed to create webhook. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
210
|
+
if (response.status !== 200) {
|
|
211
|
+
throw new Error(errorMessage);
|
|
212
|
+
}
|
|
213
|
+
if (response.body.rule) {
|
|
214
|
+
return response.body.rule;
|
|
215
|
+
}
|
|
216
|
+
throw new Error(errorMessage);
|
|
217
|
+
});
|
|
218
|
+
exports.createWebhook = createWebhook;
|
|
219
|
+
const removeWebhook = (auth, ruleId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
220
|
+
const url = `${constants_1.WEBHOOKS_API_ENDPOINT}/${ruleId}`;
|
|
221
|
+
const body = { api_secret: auth };
|
|
222
|
+
const request = {
|
|
223
|
+
url,
|
|
224
|
+
body,
|
|
225
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
226
|
+
};
|
|
227
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
228
|
+
const errorMessage = `Failed to remove webhook. Response code: ${response.status} Response body: ${JSON.stringify(response.body)}`;
|
|
229
|
+
if (response.status !== 200) {
|
|
230
|
+
throw new Error(errorMessage);
|
|
231
|
+
}
|
|
232
|
+
if (response.body.success) {
|
|
233
|
+
return response.body.success;
|
|
234
|
+
}
|
|
235
|
+
throw new Error(errorMessage);
|
|
236
|
+
});
|
|
237
|
+
exports.removeWebhook = removeWebhook;
|
|
238
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/convertkit/src/lib/common/service.ts"],"names":[],"mappings":";;;;AAUA,2CASqB;AACrB,8DAIoC;AAE7B,MAAM,eAAe,GAAG,CAAO,IAAY,EAAE,IAAY,EAAE,EAAE;IAClE,MAAM,GAAG,GAAG,mCAAuB,CAAC;IACpC,MAAM,OAAO,GAAgB;QAC3B,GAAG;QACH,MAAM,EAAE,0BAAU,CAAC,GAAG;QACtB,WAAW,EAAE;YACX,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE;YACrB,UAAU,EAAE,MAAM;SACnB;KACF,CAAC;IACF,MAA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C5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC,CAAA,CAAC;AA1BW,QAAA,aAAa,iBA0BxB;AAEK,MAAM,aAAa,GAAG,CAAO,IAAY,EAAE,MAAc,EAAE,EAAE;IAClE,MAAM,GAAG,GAAG,GAAG,iCAAqB,IAAI,MAAM,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAElC,MAAM,OAAO,GAAgB;QAC3B,GAAG;QACH,IAAI;QACJ,MAAM,EAAE,0BAAU,CAAC,MAAM;KAC1B,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAuB,OAAO,CAAC,CAAC;IAE7E,MAAM,YAAY,GAAG,4CACnB,QAAQ,CAAC,MACX,mBAAmB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IAEnD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AAChC,CAAC,CAAA,CAAC;AAxBW,QAAA,aAAa,iBAwBxB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const subscriberId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
2
|
+
export declare const subscriberEmail: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
export declare const subscriberEmailOptional: {
|
|
4
|
+
required: boolean;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
displayName: string;
|
|
7
|
+
valueSchema: string;
|
|
8
|
+
type: import("@scopieflows/pieces-framework").PropertyType.SHORT_TEXT;
|
|
9
|
+
defaultValue?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare const subscriberFirstName: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
export declare const subscribersPageNumber: import("@scopieflows/pieces-framework").NumberProperty<false>;
|
|
13
|
+
export declare const from: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
|
|
14
|
+
export declare const to: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
|
|
15
|
+
export declare const updatedFrom: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
|
|
16
|
+
export declare const updatedTo: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
|
|
17
|
+
export declare const sortOrder: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, true>;
|
|
18
|
+
export declare const sortField: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortField = exports.sortOrder = exports.updatedTo = exports.updatedFrom = exports.to = exports.from = exports.subscribersPageNumber = exports.subscriberFirstName = exports.subscriberEmailOptional = exports.subscriberEmail = exports.subscriberId = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
5
|
+
exports.subscriberId = pieces_framework_1.Property.ShortText({
|
|
6
|
+
displayName: 'Subscriber ID',
|
|
7
|
+
description: 'The subscriber ID',
|
|
8
|
+
required: true,
|
|
9
|
+
});
|
|
10
|
+
exports.subscriberEmail = pieces_framework_1.Property.ShortText({
|
|
11
|
+
displayName: 'Email',
|
|
12
|
+
description: 'The email of the subscriber',
|
|
13
|
+
required: true,
|
|
14
|
+
});
|
|
15
|
+
exports.subscriberEmailOptional = Object.assign(Object.assign({}, exports.subscriberEmail), { required: false });
|
|
16
|
+
exports.subscriberFirstName = pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'First Name',
|
|
18
|
+
description: 'The first name of the subscriber',
|
|
19
|
+
required: false,
|
|
20
|
+
});
|
|
21
|
+
exports.subscribersPageNumber = pieces_framework_1.Property.Number({
|
|
22
|
+
displayName: 'Page',
|
|
23
|
+
description: 'Page number. Each page of results will contain up to 50 subscribers.',
|
|
24
|
+
required: false,
|
|
25
|
+
defaultValue: 1,
|
|
26
|
+
});
|
|
27
|
+
exports.from = pieces_framework_1.Property.DateTime({
|
|
28
|
+
displayName: 'From',
|
|
29
|
+
description: 'Return subscribers created after this date',
|
|
30
|
+
required: false,
|
|
31
|
+
});
|
|
32
|
+
exports.to = pieces_framework_1.Property.DateTime({
|
|
33
|
+
displayName: 'To',
|
|
34
|
+
description: 'Return subscribers created before this date',
|
|
35
|
+
required: false,
|
|
36
|
+
});
|
|
37
|
+
exports.updatedFrom = pieces_framework_1.Property.DateTime({
|
|
38
|
+
displayName: 'Updated From',
|
|
39
|
+
description: 'Return subscribers updated after this date',
|
|
40
|
+
required: false,
|
|
41
|
+
});
|
|
42
|
+
exports.updatedTo = pieces_framework_1.Property.DateTime({
|
|
43
|
+
displayName: 'Updated To',
|
|
44
|
+
description: 'Return subscribers updated before this date',
|
|
45
|
+
required: false,
|
|
46
|
+
});
|
|
47
|
+
exports.sortOrder = pieces_framework_1.Property.StaticDropdown({
|
|
48
|
+
displayName: 'Sort Order',
|
|
49
|
+
description: 'Sort order',
|
|
50
|
+
required: true,
|
|
51
|
+
defaultValue: 'asc',
|
|
52
|
+
options: {
|
|
53
|
+
options: [
|
|
54
|
+
{ value: 'asc', label: 'Ascending' },
|
|
55
|
+
{ value: 'desc', label: 'Descending' },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
exports.sortField = pieces_framework_1.Property.ShortText({
|
|
60
|
+
displayName: 'Sort Field',
|
|
61
|
+
description: 'Sort field',
|
|
62
|
+
required: false,
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/convertkit/src/lib/common/subscribers/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AAE5C,QAAA,YAAY,GAAG,2BAAQ,CAAC,SAAS,CAAC;IAC7C,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,2BAAQ,CAAC,SAAS,CAAC;IAChD,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,6BAA6B;IAC1C,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,uBAAuB,mCAC/B,uBAAe,KAClB,QAAQ,EAAE,KAAK,IACf;AAEW,QAAA,mBAAmB,GAAG,2BAAQ,CAAC,SAAS,CAAC;IACpD,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,2BAAQ,CAAC,MAAM,CAAC;IACnD,WAAW,EAAE,MAAM;IACnB,WAAW,EACT,sEAAsE;IACxE,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,CAAC;CAChB,CAAC,CAAC;AAEU,QAAA,IAAI,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACpC,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAEU,QAAA,EAAE,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAClC,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC3C,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACzC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,2BAAQ,CAAC,cAAc,CAAC;IAC/C,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE;QACP,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE;YACpC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE;SACvC;KACF;CACF,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,2BAAQ,CAAC,SAAS,CAAC;IAC1C,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const tagId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
2
|
+
export declare const name: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
export declare const tags: import("@scopieflows/pieces-framework").MultiSelectDropdownProperty<string, false, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
export declare const tagsRequired: {
|
|
5
|
+
required: boolean;
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
displayName: string;
|
|
8
|
+
auth: import("@scopieflows/pieces-framework").SecretTextProperty<true>;
|
|
9
|
+
refreshers: string[];
|
|
10
|
+
refreshOnSearch?: boolean;
|
|
11
|
+
options: (propsValue: Record<string, unknown> & {
|
|
12
|
+
auth?: import("dist/packages/shared/src").SecretTextConnectionValue | undefined;
|
|
13
|
+
}, ctx: import("@scopieflows/pieces-framework").PropertyContext) => Promise<import("@scopieflows/pieces-framework").DropdownState<string>>;
|
|
14
|
+
valueSchema: string[];
|
|
15
|
+
type: import("@scopieflows/pieces-framework").PropertyType.MULTI_SELECT_DROPDOWN;
|
|
16
|
+
defaultValue?: unknown[] | undefined;
|
|
17
|
+
};
|
|
18
|
+
export declare const tag: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
19
|
+
export declare const tagsPageNumber: import("@scopieflows/pieces-framework").NumberProperty<false>;
|
|
20
|
+
export declare const sortOrder: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
|
|
21
|
+
export declare const subscriberState: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
|
|
22
|
+
export declare const tagIdByEmail: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
23
|
+
export declare const tagIdBySubscriberId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tagIdBySubscriberId = exports.tagIdByEmail = exports.subscriberState = exports.sortOrder = exports.tagsPageNumber = exports.tag = exports.tagsRequired = exports.tags = exports.name = exports.tagId = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
+
const service_1 = require("../service");
|
|
7
|
+
const __1 = require("../../..");
|
|
8
|
+
exports.tagId = pieces_framework_1.Property.ShortText({
|
|
9
|
+
displayName: 'Tag Id',
|
|
10
|
+
description: 'The tag id',
|
|
11
|
+
required: true,
|
|
12
|
+
});
|
|
13
|
+
exports.name = pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'Name',
|
|
15
|
+
description: 'The name of the tag',
|
|
16
|
+
required: true,
|
|
17
|
+
});
|
|
18
|
+
exports.tags = pieces_framework_1.Property.MultiSelectDropdown({
|
|
19
|
+
displayName: 'Tags',
|
|
20
|
+
description: 'Choose the Tags',
|
|
21
|
+
required: false,
|
|
22
|
+
refreshers: ['auth'],
|
|
23
|
+
auth: __1.convertkitAuth,
|
|
24
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
25
|
+
if (!auth) {
|
|
26
|
+
return {
|
|
27
|
+
disabled: true,
|
|
28
|
+
placeholder: 'Connect your account',
|
|
29
|
+
options: [],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const tags = yield (0, service_1.fetchTags)(auth.secret_text);
|
|
33
|
+
const options = tags.map((tag) => {
|
|
34
|
+
return {
|
|
35
|
+
label: tag.name,
|
|
36
|
+
value: tag.id,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
options,
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
exports.tagsRequired = Object.assign(Object.assign({}, exports.tags), { required: true });
|
|
45
|
+
exports.tag = pieces_framework_1.Property.Dropdown({
|
|
46
|
+
displayName: 'Tag',
|
|
47
|
+
description: 'Choose a Tag',
|
|
48
|
+
required: true,
|
|
49
|
+
refreshers: ['auth'],
|
|
50
|
+
auth: __1.convertkitAuth,
|
|
51
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
52
|
+
if (!auth) {
|
|
53
|
+
return {
|
|
54
|
+
disabled: true,
|
|
55
|
+
placeholder: 'Connect your account',
|
|
56
|
+
options: [],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const tags = yield (0, service_1.fetchTags)(auth.secret_text);
|
|
60
|
+
// loop through data and map to options
|
|
61
|
+
const options = tags.map((tag) => {
|
|
62
|
+
return {
|
|
63
|
+
label: tag.name,
|
|
64
|
+
value: tag.id,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
options,
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
exports.tagsPageNumber = pieces_framework_1.Property.Number({
|
|
73
|
+
displayName: 'Page',
|
|
74
|
+
description: 'Each page of results will contain up to 50 tags.',
|
|
75
|
+
required: false,
|
|
76
|
+
defaultValue: 1,
|
|
77
|
+
});
|
|
78
|
+
exports.sortOrder = pieces_framework_1.Property.StaticDropdown({
|
|
79
|
+
displayName: 'Sort Order',
|
|
80
|
+
description: 'Sort order',
|
|
81
|
+
required: false,
|
|
82
|
+
options: {
|
|
83
|
+
options: [
|
|
84
|
+
{ label: 'Ascending', value: 'asc' },
|
|
85
|
+
{ label: 'Descending', value: 'desc' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
exports.subscriberState = pieces_framework_1.Property.StaticDropdown({
|
|
90
|
+
displayName: 'Subscriber State',
|
|
91
|
+
description: 'Subscriber state',
|
|
92
|
+
required: false,
|
|
93
|
+
options: {
|
|
94
|
+
options: [
|
|
95
|
+
{ label: 'Active', value: 'active' },
|
|
96
|
+
{ label: 'canceled', value: 'canceled' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
// Generate options for tags based on email address
|
|
101
|
+
exports.tagIdByEmail = pieces_framework_1.Property.Dropdown({
|
|
102
|
+
displayName: 'Tag',
|
|
103
|
+
description: 'The tag to remove',
|
|
104
|
+
required: true,
|
|
105
|
+
refreshers: ['auth', 'email'],
|
|
106
|
+
auth: __1.convertkitAuth,
|
|
107
|
+
options: (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
const { auth, email } = params;
|
|
109
|
+
if (!auth) {
|
|
110
|
+
return {
|
|
111
|
+
disabled: true,
|
|
112
|
+
placeholder: 'Connect your account.',
|
|
113
|
+
options: [],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (!email) {
|
|
117
|
+
return {
|
|
118
|
+
disabled: true,
|
|
119
|
+
placeholder: 'Provide a subscriber email address.',
|
|
120
|
+
options: [],
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const subscriber = yield (0, service_1.fetchSubscriberByEmail)(auth.toString(), email.toString());
|
|
124
|
+
if (!subscriber) {
|
|
125
|
+
return {
|
|
126
|
+
disabled: true,
|
|
127
|
+
placeholder: 'No subscribers found for this email address.',
|
|
128
|
+
options: [],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const subscriberId = subscriber.id;
|
|
132
|
+
const tags = yield (0, service_1.fetchSubscribedTags)(auth.toString(), subscriberId.toString());
|
|
133
|
+
// loop through data and map to options
|
|
134
|
+
const options = tags.map((tag) => {
|
|
135
|
+
return {
|
|
136
|
+
label: tag.name,
|
|
137
|
+
value: tag.id,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
disabled: false,
|
|
142
|
+
placeholder: 'Choose a tag',
|
|
143
|
+
options,
|
|
144
|
+
};
|
|
145
|
+
}),
|
|
146
|
+
});
|
|
147
|
+
exports.tagIdBySubscriberId = pieces_framework_1.Property.Dropdown({
|
|
148
|
+
displayName: 'Tag',
|
|
149
|
+
description: 'The tag to remove',
|
|
150
|
+
required: true,
|
|
151
|
+
auth: __1.convertkitAuth,
|
|
152
|
+
refreshers: ['auth', 'subscriberId'],
|
|
153
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, subscriberId }) {
|
|
154
|
+
if (!auth) {
|
|
155
|
+
return {
|
|
156
|
+
disabled: true,
|
|
157
|
+
placeholder: 'Connect your account and',
|
|
158
|
+
options: [],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
if (!subscriberId) {
|
|
162
|
+
return {
|
|
163
|
+
disabled: true,
|
|
164
|
+
placeholder: 'Provide a subscriber id.',
|
|
165
|
+
options: [],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
{
|
|
169
|
+
const tags = yield (0, service_1.fetchSubscribedTags)(auth.secret_text, subscriberId.toString());
|
|
170
|
+
if (!tags) {
|
|
171
|
+
return {
|
|
172
|
+
disabled: true,
|
|
173
|
+
placeholder: 'Something went wrong.',
|
|
174
|
+
options: [],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// loop through data and map to options
|
|
178
|
+
const options = tags.map((tag) => {
|
|
179
|
+
return {
|
|
180
|
+
label: tag.name,
|
|
181
|
+
value: tag.id,
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
return {
|
|
185
|
+
options,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}),
|
|
189
|
+
});
|
|
190
|
+
// WIP debounce
|
|
191
|
+
// // // https://github.com/lodash/lodash/issues/4700#issuecomment-805439202
|
|
192
|
+
// export const asyncT = function asyncThrottle<
|
|
193
|
+
// F extends (...args: any[]) => Promise<any>
|
|
194
|
+
// >(func: F, wait?: number) {
|
|
195
|
+
// const throttled = _.throttle((resolve, reject, args: Parameters<F>) => {
|
|
196
|
+
// func(...args)
|
|
197
|
+
// .then(resolve)
|
|
198
|
+
// .catch(reject);
|
|
199
|
+
// }, wait);
|
|
200
|
+
// return (...args: Parameters<F>): ReturnType<F> =>
|
|
201
|
+
// new Promise((resolve, reject) => {
|
|
202
|
+
// throttled(resolve, reject, args);
|
|
203
|
+
// }) as ReturnType<F>;
|
|
204
|
+
// };
|
|
205
|
+
// let optionsFnRef: any;
|
|
206
|
+
// function debouncedOptions() {
|
|
207
|
+
// // cancel any old refs
|
|
208
|
+
// if (optionsFnRef && optionsFnRef.cancel) optionsFnRef.cancel();
|
|
209
|
+
// // create new instance and save for later
|
|
210
|
+
// optionsFnRef = loadash.debounce(optiosnFn, 3000);
|
|
211
|
+
// // execute will start after 1000 unless cancelled because the function is re-invoked again
|
|
212
|
+
// return optionsFnRef;
|
|
213
|
+
// }
|
|
214
|
+
// import Options type
|
|
215
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/pieces/community/convertkit/src/lib/common/tags/index.ts"],"names":[],"mappings":";;;;AAAA,oEAEuC;AACvC,wCAIoB;AAEpB,gCAA0C;AAE7B,QAAA,KAAK,GAAG,2BAAQ,CAAC,SAAS,CAAC;IACtC,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,IAAI,GAAG,2BAAQ,CAAC,SAAS,CAAC;IACrC,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,qBAAqB;IAClC,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,IAAI,GAAG,2BAAQ,CAAC,mBAAmB,CAAC;IAC/C,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,iBAAiB;IAC9B,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,IAAI,EAAE,kBAAc;IACpB,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,sBAAsB;gBACnC,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAS,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE;YACpC,OAAO;gBACL,KAAK,EAAE,GAAG,CAAC,IAAI;gBACf,KAAK,EAAE,GAAG,CAAC,EAAE;aACd,CAAC;QACJ,CAAC,CAAC,CAA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