@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.
Files changed (81) hide show
  1. package/README.md +29 -0
  2. package/package.json +28 -0
  3. package/src/i18n/ca.json +240 -0
  4. package/src/i18n/de.json +239 -0
  5. package/src/i18n/es.json +239 -0
  6. package/src/i18n/fr.json +239 -0
  7. package/src/i18n/hi.json +240 -0
  8. package/src/i18n/id.json +240 -0
  9. package/src/i18n/ja.json +239 -0
  10. package/src/i18n/nl.json +239 -0
  11. package/src/i18n/pt.json +239 -0
  12. package/src/i18n/ru.json +240 -0
  13. package/src/i18n/translation.json +239 -0
  14. package/src/i18n/vi.json +240 -0
  15. package/src/i18n/zh.json +239 -0
  16. package/src/index.d.ts +2 -0
  17. package/src/index.js +80 -0
  18. package/src/index.js.map +1 -0
  19. package/src/lib/actions/broadcasts.d.ts +37 -0
  20. package/src/lib/actions/broadcasts.js +213 -0
  21. package/src/lib/actions/broadcasts.js.map +1 -0
  22. package/src/lib/actions/custom-fields.d.ts +11 -0
  23. package/src/lib/actions/custom-fields.js +109 -0
  24. package/src/lib/actions/custom-fields.js.map +1 -0
  25. package/src/lib/actions/forms.d.ts +23 -0
  26. package/src/lib/actions/forms.js +90 -0
  27. package/src/lib/actions/forms.js.map +1 -0
  28. package/src/lib/actions/purchases.d.ts +51 -0
  29. package/src/lib/actions/purchases.js +258 -0
  30. package/src/lib/actions/purchases.js.map +1 -0
  31. package/src/lib/actions/sequences.d.ts +11 -0
  32. package/src/lib/actions/sequences.js +87 -0
  33. package/src/lib/actions/sequences.js.map +1 -0
  34. package/src/lib/actions/subscribers.d.ts +38 -0
  35. package/src/lib/actions/subscribers.js +172 -0
  36. package/src/lib/actions/subscribers.js.map +1 -0
  37. package/src/lib/actions/tags.d.ts +37 -0
  38. package/src/lib/actions/tags.js +188 -0
  39. package/src/lib/actions/tags.js.map +1 -0
  40. package/src/lib/actions/webhooks.d.ts +8 -0
  41. package/src/lib/actions/webhooks.js +40 -0
  42. package/src/lib/actions/webhooks.js.map +1 -0
  43. package/src/lib/common/broadcasts/index.d.ts +12 -0
  44. package/src/lib/common/broadcasts/index.js +67 -0
  45. package/src/lib/common/broadcasts/index.js.map +1 -0
  46. package/src/lib/common/constants.d.ts +9 -0
  47. package/src/lib/common/constants.js +13 -0
  48. package/src/lib/common/constants.js.map +1 -0
  49. package/src/lib/common/custom-fields/index.d.ts +4 -0
  50. package/src/lib/common/custom-fields/index.js +71 -0
  51. package/src/lib/common/custom-fields/index.js.map +1 -0
  52. package/src/lib/common/forms/index.d.ts +1 -0
  53. package/src/lib/common/forms/index.js +34 -0
  54. package/src/lib/common/forms/index.js.map +1 -0
  55. package/src/lib/common/index.d.ts +7 -0
  56. package/src/lib/common/index.js +11 -0
  57. package/src/lib/common/index.js.map +1 -0
  58. package/src/lib/common/purchases/index.d.ts +22 -0
  59. package/src/lib/common/purchases/index.js +168 -0
  60. package/src/lib/common/purchases/index.js.map +1 -0
  61. package/src/lib/common/sequences/index.d.ts +2 -0
  62. package/src/lib/common/sequences/index.js +39 -0
  63. package/src/lib/common/sequences/index.js.map +1 -0
  64. package/src/lib/common/service.d.ts +12 -0
  65. package/src/lib/common/service.js +238 -0
  66. package/src/lib/common/service.js.map +1 -0
  67. package/src/lib/common/subscribers/index.d.ts +18 -0
  68. package/src/lib/common/subscribers/index.js +64 -0
  69. package/src/lib/common/subscribers/index.js.map +1 -0
  70. package/src/lib/common/tags/index.d.ts +23 -0
  71. package/src/lib/common/tags/index.js +215 -0
  72. package/src/lib/common/tags/index.js.map +1 -0
  73. package/src/lib/common/types.d.ts +115 -0
  74. package/src/lib/common/types.js +19 -0
  75. package/src/lib/common/types.js.map +1 -0
  76. package/src/lib/common/webhooks/index.d.ts +7 -0
  77. package/src/lib/common/webhooks/index.js +209 -0
  78. package/src/lib/common/webhooks/index.js.map +1 -0
  79. package/src/lib/triggers/index.d.ts +69 -0
  80. package/src/lib/triggers/index.js +549 -0
  81. package/src/lib/triggers/index.js.map +1 -0
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listSubscriptionsToSequence = exports.addSubscriberToSequence = exports.listSequences = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../..");
8
+ const sequences_1 = require("../common/sequences");
9
+ const subscribers_1 = require("../common/subscribers");
10
+ const custom_fields_1 = require("../common/custom-fields");
11
+ const tags_1 = require("../common/tags");
12
+ const constants_1 = require("../common/constants");
13
+ const service_1 = require("../common/service");
14
+ exports.listSequences = (0, pieces_framework_1.createAction)({
15
+ auth: __1.convertkitAuth,
16
+ name: 'sequences_list_sequences',
17
+ displayName: 'List Sequences',
18
+ description: 'Returns a list of all sequences',
19
+ props: {},
20
+ run(context) {
21
+ return (0, service_1.fetchSequences)(context.auth.secret_text);
22
+ },
23
+ });
24
+ exports.addSubscriberToSequence = (0, pieces_framework_1.createAction)({
25
+ auth: __1.convertkitAuth,
26
+ name: 'sequences_add_subscriber_to_sequence',
27
+ displayName: 'Add Subscriber To Sequence',
28
+ description: 'Add a subscriber to a sequence',
29
+ props: {
30
+ sequenceId: sequences_1.sequenceIdDropdown,
31
+ email: subscribers_1.subscriberEmail,
32
+ firstName: subscribers_1.subscriberFirstName,
33
+ tags: tags_1.tags,
34
+ fields: custom_fields_1.allFields,
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { sequenceId, email, firstName, tags, fields } = context.propsValue;
39
+ const url = `${constants_1.SEQUENCES_API_ENDPOINT}/${sequenceId}/subscribe`;
40
+ const body = {
41
+ api_secret: context.auth,
42
+ email,
43
+ first_name: firstName,
44
+ tags,
45
+ fields,
46
+ };
47
+ const request = {
48
+ url,
49
+ method: pieces_common_1.HttpMethod.POST,
50
+ body,
51
+ };
52
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
53
+ if (response.status !== 200) {
54
+ throw new Error(`Error adding subscriber to sequence: ${response.status}`);
55
+ }
56
+ return response.body.subscription;
57
+ });
58
+ },
59
+ });
60
+ exports.listSubscriptionsToSequence = (0, pieces_framework_1.createAction)({
61
+ auth: __1.convertkitAuth,
62
+ name: 'sequences_list_subscriptions_to_sequence',
63
+ displayName: 'List Subscriptions To Sequence',
64
+ description: 'List all subscriptions to a sequence',
65
+ props: {
66
+ sequenceId: sequences_1.sequenceIdDropdown,
67
+ },
68
+ run(context) {
69
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
+ const url = `${constants_1.SEQUENCES_API_ENDPOINT}/${context.propsValue.sequenceId}/subscriptions`;
71
+ const body = {
72
+ api_secret: context.auth,
73
+ };
74
+ const request = {
75
+ url,
76
+ method: pieces_common_1.HttpMethod.GET,
77
+ body,
78
+ };
79
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
80
+ if (response.status !== 200) {
81
+ throw new Error(`Error listing subscriptions to sequence: ${response.status}`);
82
+ }
83
+ return response.body.subscriptions;
84
+ });
85
+ },
86
+ });
87
+ //# sourceMappingURL=sequences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequences.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/convertkit/src/lib/actions/sequences.ts"],"names":[],"mappings":";;;;AAAA,oEAA6D;AAC7D,8DAIoC;AAEpC,6BAAuC;AACvC,mDAAyD;AACzD,uDAA6E;AAC7E,2DAAoD;AACpD,yCAAsC;AACtC,mDAA6D;AAC7D,+CAAmD;AAEtC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE,EAAE;IACT,GAAG,CAAC,OAAO;QACT,OAAO,IAAA,wBAAc,EAAC,OAAO,CAAC,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C,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,UAAU,EAAE,8BAAkB;KAC/B;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,GAAG,GAAG,GAAG,kCAAsB,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,gBAAgB,CAAC;YAEvF,MAAM,IAAI,GAAG;gBACX,UAAU,EAAE,OAAO,CAAC,IAAI;aACzB,CAAC;YAEF,MAAM,OAAO,GAAgB;gBAC3B,GAAG;gBACH,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI;aACL,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAE1C,OAAO,CAAC,CAAC;YAEZ,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CACb,4CAA4C,QAAQ,CAAC,MAAM,EAAE,CAC9D,CAAC;YACJ,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;QACrC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ export declare const getSubscriberById: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
2
+ subscriberId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ }>;
4
+ export declare const getSubscriberByEmail: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
5
+ email_address: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
6
+ }>;
7
+ export declare const listSubscribers: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
8
+ page: import("@scopieflows/pieces-framework").NumberProperty<false>;
9
+ sortOrder: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, true>;
10
+ sortField: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
11
+ from: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
12
+ to: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
13
+ updatedFrom: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
14
+ updatedTo: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
15
+ emailAddress: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
16
+ }>;
17
+ export declare const updateSubscriber: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
18
+ subscriberId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
19
+ emailAddress: {
20
+ required: boolean;
21
+ description?: string | undefined;
22
+ displayName: string;
23
+ valueSchema: string;
24
+ type: import("@scopieflows/pieces-framework").PropertyType.SHORT_TEXT;
25
+ defaultValue?: string | undefined;
26
+ };
27
+ firstName: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
28
+ fields: import("@scopieflows/pieces-framework").DynamicProperties<false, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
29
+ }>;
30
+ export declare const unsubscribeSubscriber: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
31
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
32
+ }>;
33
+ export declare const listTagsBySubscriberId: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
34
+ subscriberId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
35
+ }>;
36
+ export declare const listSubscriberTagsByEmail: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
37
+ email_address: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
38
+ }>;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listSubscriberTagsByEmail = exports.listTagsBySubscriberId = exports.unsubscribeSubscriber = exports.updateSubscriber = exports.listSubscribers = exports.getSubscriberByEmail = exports.getSubscriberById = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../..");
8
+ const subscribers_1 = require("../common/subscribers");
9
+ const custom_fields_1 = require("../common/custom-fields");
10
+ const constants_1 = require("../common/constants");
11
+ const service_1 = require("../common/service");
12
+ exports.getSubscriberById = (0, pieces_framework_1.createAction)({
13
+ auth: __1.convertkitAuth,
14
+ name: 'subscribers_get_subscriber_by_id',
15
+ displayName: 'Get Subscriber By Id',
16
+ description: 'Returns data for a single subscriber',
17
+ props: {
18
+ subscriberId: subscribers_1.subscriberId,
19
+ },
20
+ run(context) {
21
+ const { subscriberId } = context.propsValue;
22
+ return (0, service_1.fetchSubscriperById)(context.auth.secret_text, subscriberId);
23
+ },
24
+ });
25
+ exports.getSubscriberByEmail = (0, pieces_framework_1.createAction)({
26
+ auth: __1.convertkitAuth,
27
+ name: 'subscribers_get_subscriber_by_email',
28
+ displayName: 'Get Subscriber By Email',
29
+ description: 'Returns data for a single subscriber',
30
+ props: {
31
+ email_address: subscribers_1.subscriberEmail,
32
+ },
33
+ run(context) {
34
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ const { email_address } = context.propsValue;
36
+ return (0, service_1.fetchSubscriberByEmail)(context.auth.secret_text, email_address);
37
+ });
38
+ },
39
+ });
40
+ exports.listSubscribers = (0, pieces_framework_1.createAction)({
41
+ auth: __1.convertkitAuth,
42
+ name: 'subscribers_list_subscribers',
43
+ displayName: 'List Subscribers',
44
+ description: 'Returns a list of all subscribers',
45
+ props: {
46
+ page: subscribers_1.subscribersPageNumber,
47
+ sortOrder: subscribers_1.sortOrder,
48
+ sortField: subscribers_1.sortField,
49
+ from: subscribers_1.from,
50
+ to: subscribers_1.to,
51
+ updatedFrom: subscribers_1.updatedFrom,
52
+ updatedTo: subscribers_1.updatedTo,
53
+ emailAddress: subscribers_1.subscriberEmail,
54
+ },
55
+ run(context) {
56
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
57
+ const { page, from, to, updatedFrom, updatedTo, emailAddress, sortOrder, sortField, } = context.propsValue;
58
+ const url = constants_1.SUBSCRIBERS_API_ENDPOINT;
59
+ const body = {
60
+ api_secret: context.auth,
61
+ page,
62
+ from,
63
+ to,
64
+ updated_from: updatedFrom,
65
+ updated_to: updatedTo,
66
+ email_address: emailAddress,
67
+ sort_order: sortOrder,
68
+ sort_field: sortField,
69
+ };
70
+ const request = {
71
+ url,
72
+ method: pieces_common_1.HttpMethod.GET,
73
+ body,
74
+ };
75
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
76
+ if (response.status !== 200) {
77
+ throw new Error(`Error fetching subscribers: ${response.status}`);
78
+ }
79
+ return response.body.subscribers;
80
+ });
81
+ },
82
+ });
83
+ exports.updateSubscriber = (0, pieces_framework_1.createAction)({
84
+ auth: __1.convertkitAuth,
85
+ name: 'subscribers_update_subscriber',
86
+ displayName: 'Update Subscriber',
87
+ description: 'Update a subscriber',
88
+ props: {
89
+ subscriberId: subscribers_1.subscriberId,
90
+ emailAddress: subscribers_1.subscriberEmailOptional,
91
+ firstName: subscribers_1.subscriberFirstName,
92
+ fields: custom_fields_1.allFields,
93
+ },
94
+ run(context) {
95
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
96
+ const { subscriberId, emailAddress, firstName, fields } = context.propsValue;
97
+ const url = `${constants_1.SUBSCRIBERS_API_ENDPOINT}/${subscriberId}`;
98
+ const body = {
99
+ api_secret: context.auth,
100
+ email_address: emailAddress,
101
+ first_name: firstName,
102
+ fields,
103
+ };
104
+ const request = {
105
+ url,
106
+ method: pieces_common_1.HttpMethod.PUT,
107
+ body,
108
+ };
109
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
110
+ if (response.status !== 200) {
111
+ throw new Error(`Error updating subscriber: ${response.status}`);
112
+ }
113
+ return response.body.subscriber;
114
+ });
115
+ },
116
+ });
117
+ exports.unsubscribeSubscriber = (0, pieces_framework_1.createAction)({
118
+ auth: __1.convertkitAuth,
119
+ name: 'subscribers_unsubscribe_subscriber',
120
+ displayName: 'Unsubscribe Subscriber',
121
+ description: 'Unsubscribe a subscriber',
122
+ props: {
123
+ email: subscribers_1.subscriberEmail,
124
+ },
125
+ run(context) {
126
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
127
+ const { email } = context.propsValue;
128
+ const url = `${constants_1.CONVERTKIT_API_URL}/unsubscribe`;
129
+ const body = { email, api_secret: context.auth };
130
+ const request = {
131
+ url,
132
+ method: pieces_common_1.HttpMethod.PUT,
133
+ body,
134
+ };
135
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
136
+ if (response.status !== 200) {
137
+ throw new Error(`Error unsubscribing subscriber: ${response.status}`);
138
+ }
139
+ return response.body.subscriber;
140
+ });
141
+ },
142
+ });
143
+ exports.listTagsBySubscriberId = (0, pieces_framework_1.createAction)({
144
+ auth: __1.convertkitAuth,
145
+ name: 'subscribers_list_tags_by_subscriber_id',
146
+ displayName: 'List Tags By Subscriber Id',
147
+ description: 'Returns a list of all subscribed tags',
148
+ props: {
149
+ subscriberId: subscribers_1.subscriberId,
150
+ },
151
+ run(context) {
152
+ const { subscriberId } = context.propsValue;
153
+ return (0, service_1.fetchSubscribedTags)(context.auth.secret_text, subscriberId);
154
+ },
155
+ });
156
+ exports.listSubscriberTagsByEmail = (0, pieces_framework_1.createAction)({
157
+ auth: __1.convertkitAuth,
158
+ name: 'subscribers_list_tags_by_email',
159
+ displayName: 'List Tags By Email',
160
+ description: 'Returns a list of all subscribed tags',
161
+ props: {
162
+ email_address: subscribers_1.subscriberEmail,
163
+ },
164
+ run(context) {
165
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
166
+ const { email_address } = context.propsValue;
167
+ const subscriberId = yield (0, service_1.fetchSubscriberByEmail)(context.auth.secret_text, email_address);
168
+ return (0, service_1.fetchSubscribedTags)(context.auth.secret_text, subscriberId.id);
169
+ });
170
+ },
171
+ });
172
+ //# sourceMappingURL=subscribers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribers.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/convertkit/src/lib/actions/subscribers.ts"],"names":[],"mappings":";;;;AAAA,oEAA6D;AAC7D,8DAIoC;AAEpC,6BAAuC;AACvC,uDAY+B;AAC/B,2DAAoD;AACpD,mDAG6B;AAC7B,+CAI2B;AAEd,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,YAAY,EAAZ,0BAAY;KACb;IACD,GAAG,CAAC,OAAO;QACT,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;QAC5C,OAAO,IAAA,6BAAmB,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrE,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,qCAAqC;IAC3C,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,aAAa,EAAE,6BAAe;KAC/B;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC7C,OAAO,IAAA,gCAAsB,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QACzE,CAAC;KAAA;CACF,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE;QACL,IAAI,EAAE,mCAAqB;QAC3B,SAAS,EAAT,uBAAS;QACT,SAAS,EAAT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C;QACxE,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ export declare const listTags: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {}>;
2
+ export declare const createTag: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
3
+ name: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
4
+ }>;
5
+ export declare const tagSubscriber: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
6
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
7
+ firstName: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
8
+ tags: {
9
+ required: boolean;
10
+ description?: string | undefined;
11
+ displayName: string;
12
+ auth: import("@scopieflows/pieces-framework").SecretTextProperty<true>;
13
+ refreshers: string[];
14
+ refreshOnSearch?: boolean;
15
+ options: (propsValue: Record<string, unknown> & {
16
+ auth?: import("dist/packages/shared/src").SecretTextConnectionValue | undefined;
17
+ }, ctx: import("@scopieflows/pieces-framework").PropertyContext) => Promise<import("@scopieflows/pieces-framework").DropdownState<string>>;
18
+ valueSchema: string[];
19
+ type: import("@scopieflows/pieces-framework").PropertyType.MULTI_SELECT_DROPDOWN;
20
+ defaultValue?: unknown[] | undefined;
21
+ };
22
+ fields: import("@scopieflows/pieces-framework").DynamicProperties<false, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
23
+ }>;
24
+ export declare const removeTagFromSubscriberByEmail: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
25
+ email: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
26
+ tagId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
27
+ }>;
28
+ export declare const removeTagFromSubscriberById: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
29
+ subscriberId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
30
+ tagId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
31
+ }>;
32
+ export declare const listSubscriptionsToATag: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
33
+ tagId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
34
+ page: import("@scopieflows/pieces-framework").NumberProperty<false>;
35
+ sortOrder: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
36
+ subscriberState: import("@scopieflows/pieces-framework").StaticDropdownProperty<string, false>;
37
+ }>;
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listSubscriptionsToATag = exports.removeTagFromSubscriberById = exports.removeTagFromSubscriberByEmail = exports.tagSubscriber = exports.createTag = exports.listTags = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const pieces_common_1 = require("@scopieflows/pieces-common");
7
+ const __1 = require("../..");
8
+ const tags_1 = require("../common/tags");
9
+ const subscribers_1 = require("../common/subscribers");
10
+ const custom_fields_1 = require("../common/custom-fields");
11
+ const constants_1 = require("../common/constants");
12
+ const service_1 = require("../common/service");
13
+ exports.listTags = (0, pieces_framework_1.createAction)({
14
+ auth: __1.convertkitAuth,
15
+ name: 'tags_list_tags',
16
+ displayName: 'List Tags',
17
+ description: 'Returns a list of all tags',
18
+ props: {},
19
+ run(context) {
20
+ return (0, service_1.fetchTags)(context.auth.secret_text);
21
+ },
22
+ });
23
+ exports.createTag = (0, pieces_framework_1.createAction)({
24
+ auth: __1.convertkitAuth,
25
+ name: 'tags_create_tag',
26
+ displayName: 'Create Tag',
27
+ description: 'Create a tag',
28
+ props: {
29
+ name: tags_1.name,
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const url = constants_1.TAGS_API_ENDPOINT;
34
+ const body = {
35
+ api_secret: context.auth,
36
+ tag: { name: context.propsValue.name },
37
+ };
38
+ const request = {
39
+ url,
40
+ method: pieces_common_1.HttpMethod.POST,
41
+ body,
42
+ };
43
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
44
+ if (response.status !== 201) {
45
+ throw new Error(`Error creating tag: ${response.status}`);
46
+ }
47
+ return response.body;
48
+ });
49
+ },
50
+ });
51
+ // TODO:
52
+ // fields do not show up in the UI
53
+ // Sometimes the Tags dropdown will show an error instead of a tag list. Clicking to another piece (Cradete Tag) and then back to this one will fix it.
54
+ exports.tagSubscriber = (0, pieces_framework_1.createAction)({
55
+ auth: __1.convertkitAuth,
56
+ name: 'tags_tag_subscriber',
57
+ displayName: 'Tag Subscriber',
58
+ description: 'Tag a subscriber',
59
+ props: {
60
+ email: subscribers_1.subscriberEmail,
61
+ // tagId: tag,
62
+ firstName: subscribers_1.subscriberFirstName,
63
+ tags: tags_1.tagsRequired,
64
+ fields: custom_fields_1.allFields,
65
+ },
66
+ run(context) {
67
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
68
+ const { email, firstName, tags, fields } = context.propsValue;
69
+ if (!tags || tags.length === 0) {
70
+ throw new Error('At least one tag is required');
71
+ }
72
+ const tagId = tags[0];
73
+ const url = `${constants_1.TAGS_API_ENDPOINT}/${tagId}/subscribe`;
74
+ const body = {
75
+ email,
76
+ first_name: firstName,
77
+ tags,
78
+ fields,
79
+ api_secret: context.auth,
80
+ };
81
+ const request = {
82
+ url,
83
+ method: pieces_common_1.HttpMethod.POST,
84
+ body,
85
+ };
86
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
87
+ if (response.status !== 200) {
88
+ throw new Error(`Error tagging subscriber: ${response.status}`);
89
+ }
90
+ return response.body.subscription;
91
+ });
92
+ },
93
+ });
94
+ exports.removeTagFromSubscriberByEmail = (0, pieces_framework_1.createAction)({
95
+ auth: __1.convertkitAuth,
96
+ name: 'tags_remove_tag_from_subscriber_by_email',
97
+ displayName: 'Remove Tag From Subscriber By Email',
98
+ description: 'Remove a tag from a subscriber by email',
99
+ props: {
100
+ email: subscribers_1.subscriberEmail,
101
+ tagId: tags_1.tagIdByEmail,
102
+ },
103
+ run(context) {
104
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
105
+ const { email, tagId } = context.propsValue;
106
+ const url = `${constants_1.TAGS_API_ENDPOINT}/${tagId}/unsubscribe`;
107
+ const body = {
108
+ email,
109
+ api_secret: context.auth,
110
+ };
111
+ const request = {
112
+ url,
113
+ method: pieces_common_1.HttpMethod.POST,
114
+ body,
115
+ };
116
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
117
+ if (response.status !== 200) {
118
+ throw new Error(`Error removing tag from subscriber: ${response.status}`);
119
+ }
120
+ return response.body;
121
+ });
122
+ },
123
+ });
124
+ exports.removeTagFromSubscriberById = (0, pieces_framework_1.createAction)({
125
+ auth: __1.convertkitAuth,
126
+ name: 'tags_remove_tag_from_subscriber_by_id',
127
+ displayName: 'Remove Tag From Subscriber By Id',
128
+ description: 'Remove a tag from a subscriber by id',
129
+ props: {
130
+ subscriberId: subscribers_1.subscriberId,
131
+ tagId: tags_1.tagIdBySubscriberId,
132
+ },
133
+ run(context) {
134
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
135
+ const { subscriberId, tagId } = context.propsValue;
136
+ const url = `${constants_1.TAGS_API_ENDPOINT}/${tagId}/unsubscribe`;
137
+ const body = {
138
+ id: subscriberId,
139
+ api_secret: context.auth,
140
+ };
141
+ const request = {
142
+ url,
143
+ method: pieces_common_1.HttpMethod.POST,
144
+ body,
145
+ };
146
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
147
+ if (response.status !== 200) {
148
+ throw new Error(`Error removing tag from subscriber: ${response.status}`);
149
+ }
150
+ return response.body;
151
+ });
152
+ },
153
+ });
154
+ exports.listSubscriptionsToATag = (0, pieces_framework_1.createAction)({
155
+ auth: __1.convertkitAuth,
156
+ name: 'tags_list_subscriptions_to_tag',
157
+ displayName: 'List Subscriptions To Tag',
158
+ description: 'List all subscriptions to a tag',
159
+ props: {
160
+ tagId: tags_1.tag,
161
+ page: tags_1.tagsPageNumber,
162
+ sortOrder: tags_1.sortOrder,
163
+ subscriberState: tags_1.subscriberState,
164
+ },
165
+ run(context) {
166
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
167
+ const { tagId, page, sortOrder, subscriberState } = context.propsValue;
168
+ const url = `${constants_1.TAGS_API_ENDPOINT}/${tagId}/subscriptions?`;
169
+ const body = {
170
+ api_secret: context.auth,
171
+ page,
172
+ sort_order: sortOrder,
173
+ subscriber_state: subscriberState,
174
+ };
175
+ const request = {
176
+ url,
177
+ method: pieces_common_1.HttpMethod.GET,
178
+ body,
179
+ };
180
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
181
+ if (response.status !== 200) {
182
+ throw new Error(`Error listing subscriptions to tag: ${response.status}`);
183
+ }
184
+ return response.body.subscriptions;
185
+ });
186
+ },
187
+ });
188
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/convertkit/src/lib/actions/tags.ts"],"names":[],"mappings":";;;;AAAA,oEAA6D;AAC7D,8DAIoC;AACpC,6BAAuC;AACvC,yCASwB;AACxB,uDAI+B;AAE/B,2DAAoD;AACpD,mDAAwD;AACxD,+CAA8C;AAEjC,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,4BAA4B;IACzC,KAAK,EAAE,EAAE;IACT,GAAG,CAAC,OAAO;QACT,OAAO,IAAA,mBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,IAAA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QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE;QACL,KAAK,EAAE,UAAG;QACV,IAAI,EAAE,qBAAc;QACpB,SAAS,EAAT,gBAAS;QACT,eAAe,EAAf,sBAAe;KAChB;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACvE,MAAM,GAAG,GAAG,GAAG,6BAAiB,IAAI,KAAK,iBAAiB,CAAC;YAE3D,MAAM,IAAI,GAAG;gBACX,UAAU,EAAE,OAAO,CAAC,IAAI;gBACxB,IAAI;gBACJ,UAAU,EAAE,SAAS;gBACrB,gBAAgB,EAAE,eAAe;aAClC,CAAC;YAEF,MAAM,OAAO,GAAgB;gBAC3B,GAAG;gBACH,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI;aACL,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAE1C,OAAO,CAAC,CAAC;YAEZ,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,uCAAuC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC5E,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;QACrC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const createWebhook: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
2
+ targetUrl: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
3
+ event: import("@scopieflows/pieces-framework").StaticDropdownProperty<import("../common/types").EventType, true>;
4
+ eventParameter: import("@scopieflows/pieces-framework").DynamicProperties<false, import("@scopieflows/pieces-framework").SecretTextProperty<true>>;
5
+ }>;
6
+ export declare const deleteWebhook: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").SecretTextProperty<true>, {
7
+ webhookId: import("@scopieflows/pieces-framework").NumberProperty<true>;
8
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteWebhook = exports.createWebhook = void 0;
4
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
5
+ const __1 = require("../..");
6
+ const webhooks_1 = require("../common/webhooks");
7
+ const service_1 = require("../common/service");
8
+ exports.createWebhook = (0, pieces_framework_1.createAction)({
9
+ auth: __1.convertkitAuth,
10
+ name: 'create_webhook',
11
+ displayName: 'Add Webhook',
12
+ description: 'Create a webhook automation',
13
+ props: {
14
+ targetUrl: webhooks_1.targetUrl,
15
+ event: webhooks_1.event,
16
+ eventParameter: webhooks_1.eventParameter,
17
+ },
18
+ run(context) {
19
+ const { targetUrl, event, eventParameter } = context.propsValue;
20
+ const payload = {
21
+ event: Object.assign({ name: event }, eventParameter),
22
+ target_url: targetUrl,
23
+ };
24
+ return (0, service_1.createWebhook)(context.auth.secret_text, payload);
25
+ },
26
+ });
27
+ exports.deleteWebhook = (0, pieces_framework_1.createAction)({
28
+ auth: __1.convertkitAuth,
29
+ name: 'destroy_webhook',
30
+ displayName: 'Delete Webhook',
31
+ description: 'Delete a webhook automation',
32
+ props: {
33
+ webhookId: webhooks_1.webhookId,
34
+ },
35
+ run(context) {
36
+ const { webhookId } = context.propsValue;
37
+ return (0, service_1.removeWebhook)(context.auth.secret_text, webhookId);
38
+ },
39
+ });
40
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/convertkit/src/lib/actions/webhooks.ts"],"names":[],"mappings":";;;AAAA,oEAA6D;AAC7D,6BAAuC;AACvC,iDAK4B;AAC5B,+CAG2B;AAEd,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACL,SAAS,EAAT,oBAAS;QACT,KAAK,EAAL,gBAAK;QACL,cAAc,EAAd,yBAAc;KACf;IACD,GAAG,CAAC,OAAO;QACT,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;QAEhE,MAAM,OAAO,GAAG;YACd,KAAK,kBACH,IAAI,EAAE,KAAK,IACR,cAAc,CAClB;YACD,UAAU,EAAE,SAAS;SACtB,CAAC;QAEF,OAAO,IAAA,uBAAmB,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,kBAAc;IACpB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACL,SAAS,EAAT,oBAAS;KACV;IACD,GAAG,CAAC,OAAO;QACT,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;QACzC,OAAO,IAAA,uBAAmB,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const broadcastId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
2
+ export declare const broadcastPageNumber: import("@scopieflows/pieces-framework").NumberProperty<false>;
3
+ export declare const broadcastContent: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
4
+ export declare const description: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
5
+ export declare const broadcastEmailAddress: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
6
+ export declare const emailLayoutTemplate: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
7
+ export declare const isPublic: import("@scopieflows/pieces-framework").CheckboxProperty<false>;
8
+ export declare const publishedAt: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
9
+ export declare const sendAt: import("@scopieflows/pieces-framework").DateTimeProperty<false>;
10
+ export declare const subject: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
11
+ export declare const thumbnailAlt: import("@scopieflows/pieces-framework").ShortTextProperty<false>;
12
+ export declare const thumbnailUrl: import("@scopieflows/pieces-framework").ShortTextProperty<false>;