@divyacon/piece-mailchimp 0.0.0-stage → 0.1.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 (148) hide show
  1. package/LICENSE.MIT-AP +24 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +80 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/actions/add-member-to-list.d.ts +13 -0
  7. package/dist/lib/actions/add-member-to-list.d.ts.map +1 -0
  8. package/dist/lib/actions/add-member-to-list.js +172 -0
  9. package/dist/lib/actions/add-member-to-list.js.map +1 -0
  10. package/dist/lib/actions/add-note-to-subscriber.d.ts +6 -0
  11. package/dist/lib/actions/add-note-to-subscriber.d.ts.map +1 -0
  12. package/dist/lib/actions/add-note-to-subscriber.js +95 -0
  13. package/dist/lib/actions/add-note-to-subscriber.js.map +1 -0
  14. package/dist/lib/actions/add-subscriber-to-tag.d.ts +6 -0
  15. package/dist/lib/actions/add-subscriber-to-tag.d.ts.map +1 -0
  16. package/dist/lib/actions/add-subscriber-to-tag.js +65 -0
  17. package/dist/lib/actions/add-subscriber-to-tag.js.map +1 -0
  18. package/dist/lib/actions/archive-subscriber.d.ts +5 -0
  19. package/dist/lib/actions/archive-subscriber.d.ts.map +1 -0
  20. package/dist/lib/actions/archive-subscriber.js +66 -0
  21. package/dist/lib/actions/archive-subscriber.js.map +1 -0
  22. package/dist/lib/actions/create-audience.d.ts +23 -0
  23. package/dist/lib/actions/create-audience.d.ts.map +1 -0
  24. package/dist/lib/actions/create-audience.js +196 -0
  25. package/dist/lib/actions/create-audience.js.map +1 -0
  26. package/dist/lib/actions/create-campaign.d.ts +15 -0
  27. package/dist/lib/actions/create-campaign.d.ts.map +1 -0
  28. package/dist/lib/actions/create-campaign.js +157 -0
  29. package/dist/lib/actions/create-campaign.js.map +1 -0
  30. package/dist/lib/actions/create-custom-event.d.ts +7 -0
  31. package/dist/lib/actions/create-custom-event.d.ts.map +1 -0
  32. package/dist/lib/actions/create-custom-event.js +65 -0
  33. package/dist/lib/actions/create-custom-event.js.map +1 -0
  34. package/dist/lib/actions/create-tag.d.ts +5 -0
  35. package/dist/lib/actions/create-tag.d.ts.map +1 -0
  36. package/dist/lib/actions/create-tag.js +56 -0
  37. package/dist/lib/actions/create-tag.js.map +1 -0
  38. package/dist/lib/actions/find-campaign.d.ts +6 -0
  39. package/dist/lib/actions/find-campaign.d.ts.map +1 -0
  40. package/dist/lib/actions/find-campaign.js +70 -0
  41. package/dist/lib/actions/find-campaign.js.map +1 -0
  42. package/dist/lib/actions/find-customer.d.ts +9 -0
  43. package/dist/lib/actions/find-customer.d.ts.map +1 -0
  44. package/dist/lib/actions/find-customer.js +87 -0
  45. package/dist/lib/actions/find-customer.js.map +1 -0
  46. package/dist/lib/actions/find-subscriber.d.ts +7 -0
  47. package/dist/lib/actions/find-subscriber.d.ts.map +1 -0
  48. package/dist/lib/actions/find-subscriber.js +307 -0
  49. package/dist/lib/actions/find-subscriber.js.map +1 -0
  50. package/dist/lib/actions/find-tag.d.ts +5 -0
  51. package/dist/lib/actions/find-tag.d.ts.map +1 -0
  52. package/dist/lib/actions/find-tag.js +57 -0
  53. package/dist/lib/actions/find-tag.js.map +1 -0
  54. package/dist/lib/actions/get-campaign-report.d.ts +6 -0
  55. package/dist/lib/actions/get-campaign-report.d.ts.map +1 -0
  56. package/dist/lib/actions/get-campaign-report.js +206 -0
  57. package/dist/lib/actions/get-campaign-report.js.map +1 -0
  58. package/dist/lib/actions/remove-subscriber-from-tag.d.ts +6 -0
  59. package/dist/lib/actions/remove-subscriber-from-tag.d.ts.map +1 -0
  60. package/dist/lib/actions/remove-subscriber-from-tag.js +98 -0
  61. package/dist/lib/actions/remove-subscriber-from-tag.js.map +1 -0
  62. package/dist/lib/actions/send-campaign.d.ts +4 -0
  63. package/dist/lib/actions/send-campaign.d.ts.map +1 -0
  64. package/dist/lib/actions/send-campaign.js +47 -0
  65. package/dist/lib/actions/send-campaign.js.map +1 -0
  66. package/dist/lib/actions/unsubscribe-email.d.ts +8 -0
  67. package/dist/lib/actions/unsubscribe-email.d.ts.map +1 -0
  68. package/dist/lib/actions/unsubscribe-email.js +90 -0
  69. package/dist/lib/actions/unsubscribe-email.js.map +1 -0
  70. package/dist/lib/actions/update-subscriber-status.d.ts +6 -0
  71. package/dist/lib/actions/update-subscriber-status.d.ts.map +1 -0
  72. package/dist/lib/actions/update-subscriber-status.js +54 -0
  73. package/dist/lib/actions/update-subscriber-status.js.map +1 -0
  74. package/dist/lib/common/index.d.ts +30 -0
  75. package/dist/lib/common/index.d.ts.map +1 -0
  76. package/dist/lib/common/index.js +206 -0
  77. package/dist/lib/common/index.js.map +1 -0
  78. package/dist/lib/common/types.d.ts +362 -0
  79. package/dist/lib/common/types.d.ts.map +1 -0
  80. package/dist/lib/common/types.js +54 -0
  81. package/dist/lib/common/types.js.map +1 -0
  82. package/dist/lib/triggers/email-opened-trigger.d.ts +11 -0
  83. package/dist/lib/triggers/email-opened-trigger.d.ts.map +1 -0
  84. package/dist/lib/triggers/email-opened-trigger.js +199 -0
  85. package/dist/lib/triggers/email-opened-trigger.js.map +1 -0
  86. package/dist/lib/triggers/link-clicked-trigger.d.ts +11 -0
  87. package/dist/lib/triggers/link-clicked-trigger.d.ts.map +1 -0
  88. package/dist/lib/triggers/link-clicked-trigger.js +226 -0
  89. package/dist/lib/triggers/link-clicked-trigger.js.map +1 -0
  90. package/dist/lib/triggers/new-campaign-trigger.d.ts +11 -0
  91. package/dist/lib/triggers/new-campaign-trigger.d.ts.map +1 -0
  92. package/dist/lib/triggers/new-campaign-trigger.js +147 -0
  93. package/dist/lib/triggers/new-campaign-trigger.js.map +1 -0
  94. package/dist/lib/triggers/new-customer-trigger.d.ts +11 -0
  95. package/dist/lib/triggers/new-customer-trigger.d.ts.map +1 -0
  96. package/dist/lib/triggers/new-customer-trigger.js +214 -0
  97. package/dist/lib/triggers/new-customer-trigger.js.map +1 -0
  98. package/dist/lib/triggers/new-order-trigger.d.ts +11 -0
  99. package/dist/lib/triggers/new-order-trigger.d.ts.map +1 -0
  100. package/dist/lib/triggers/new-order-trigger.js +270 -0
  101. package/dist/lib/triggers/new-order-trigger.js.map +1 -0
  102. package/dist/lib/triggers/new-segment-tag-subscriber-trigger.d.ts +19 -0
  103. package/dist/lib/triggers/new-segment-tag-subscriber-trigger.d.ts.map +1 -0
  104. package/dist/lib/triggers/new-segment-tag-subscriber-trigger.js +264 -0
  105. package/dist/lib/triggers/new-segment-tag-subscriber-trigger.js.map +1 -0
  106. package/dist/lib/triggers/subscribe-trigger.d.ts +11 -0
  107. package/dist/lib/triggers/subscribe-trigger.d.ts.map +1 -0
  108. package/dist/lib/triggers/subscribe-trigger.js +150 -0
  109. package/dist/lib/triggers/subscribe-trigger.js.map +1 -0
  110. package/dist/lib/triggers/subscriber-updated-trigger.d.ts +11 -0
  111. package/dist/lib/triggers/subscriber-updated-trigger.d.ts.map +1 -0
  112. package/dist/lib/triggers/subscriber-updated-trigger.js +157 -0
  113. package/dist/lib/triggers/subscriber-updated-trigger.js.map +1 -0
  114. package/dist/lib/triggers/unsubscribe-trigger.d.ts +11 -0
  115. package/dist/lib/triggers/unsubscribe-trigger.d.ts.map +1 -0
  116. package/dist/lib/triggers/unsubscribe-trigger.js +196 -0
  117. package/dist/lib/triggers/unsubscribe-trigger.js.map +1 -0
  118. package/package.json +45 -3
  119. package/src/index.ts +77 -0
  120. package/src/lib/actions/add-member-to-list.ts +180 -0
  121. package/src/lib/actions/add-note-to-subscriber.ts +91 -0
  122. package/src/lib/actions/add-subscriber-to-tag.ts +66 -0
  123. package/src/lib/actions/archive-subscriber.ts +64 -0
  124. package/src/lib/actions/create-audience.ts +192 -0
  125. package/src/lib/actions/create-campaign.ts +155 -0
  126. package/src/lib/actions/create-custom-event.ts +63 -0
  127. package/src/lib/actions/create-tag.ts +51 -0
  128. package/src/lib/actions/find-campaign.ts +68 -0
  129. package/src/lib/actions/find-customer.ts +88 -0
  130. package/src/lib/actions/find-subscriber.ts +307 -0
  131. package/src/lib/actions/find-tag.ts +57 -0
  132. package/src/lib/actions/get-campaign-report.ts +204 -0
  133. package/src/lib/actions/remove-subscriber-from-tag.ts +94 -0
  134. package/src/lib/actions/send-campaign.ts +42 -0
  135. package/src/lib/actions/unsubscribe-email.ts +91 -0
  136. package/src/lib/actions/update-subscriber-status.ts +53 -0
  137. package/src/lib/common/index.ts +267 -0
  138. package/src/lib/common/types.ts +410 -0
  139. package/src/lib/triggers/email-opened-trigger.ts +216 -0
  140. package/src/lib/triggers/link-clicked-trigger.ts +244 -0
  141. package/src/lib/triggers/new-campaign-trigger.ts +149 -0
  142. package/src/lib/triggers/new-customer-trigger.ts +230 -0
  143. package/src/lib/triggers/new-order-trigger.ts +288 -0
  144. package/src/lib/triggers/new-segment-tag-subscriber-trigger.ts +286 -0
  145. package/src/lib/triggers/subscribe-trigger.ts +159 -0
  146. package/src/lib/triggers/subscriber-updated-trigger.ts +165 -0
  147. package/src/lib/triggers/unsubscribe-trigger.ts +212 -0
  148. package/README.md +0 -3
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCampaignReport = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/get-campaign-report.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ const __1 = require("../..");
10
+ const common_1 = require("../common");
11
+ const mailchimp_marketing_1 = tslib_1.__importDefault(require("@mailchimp/mailchimp_marketing"));
12
+ exports.getCampaignReport = (0, pieces_framework_1.createAction)({
13
+ auth: __1.mailchimpAuth,
14
+ name: 'get_campaign_report',
15
+ displayName: 'Get Campaign Report',
16
+ description: 'Get comprehensive report details for a specific sent campaign including opens, clicks, bounces, and performance metrics',
17
+ audience: 'both',
18
+ aiMetadata: { description: 'Retrieves the analytics report for a single sent campaign by campaign ID, covering opens, clicks, bounces, unsubscribes, and engagement metrics; optional field include/exclude lists narrow the payload. Use to read performance for a campaign that has already been sent. Read-only and idempotent. Returns a not-found result if the campaign has not been sent or the ID is wrong.', idempotent: true },
19
+ props: {
20
+ campaign_id: common_1.mailchimpCommon.mailChimpCampaignIdDropdown,
21
+ fields: pieces_framework_1.Property.LongText({
22
+ displayName: 'Include Fields',
23
+ description: 'Comma-separated list of fields to return (e.g., "opens.unique_opens,clicks.click_rate")',
24
+ required: false,
25
+ }),
26
+ exclude_fields: pieces_framework_1.Property.LongText({
27
+ displayName: 'Exclude Fields',
28
+ description: 'Comma-separated list of fields to exclude (e.g., "timeseries,_links")',
29
+ required: false,
30
+ }),
31
+ },
32
+ run(context) {
33
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
35
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
36
+ const server = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
37
+ const client = mailchimp_marketing_1.default;
38
+ client.setConfig({
39
+ accessToken: accessToken,
40
+ server: server,
41
+ });
42
+ try {
43
+ const options = {};
44
+ if (context.propsValue.fields && context.propsValue.fields.trim()) {
45
+ options.fields = context.propsValue.fields.trim();
46
+ }
47
+ if (context.propsValue.exclude_fields && context.propsValue.exclude_fields.trim()) {
48
+ options.exclude_fields = context.propsValue.exclude_fields.trim();
49
+ }
50
+ const report = yield client.reports.getCampaignReport(context.propsValue.campaign_id, options);
51
+ return {
52
+ success: true,
53
+ report: {
54
+ id: report.id,
55
+ campaign_title: report.campaign_title,
56
+ type: report.type,
57
+ list_id: report.list_id,
58
+ list_is_active: report.list_is_active,
59
+ list_name: report.list_name,
60
+ subject_line: report.subject_line,
61
+ preview_text: report.preview_text,
62
+ emails_sent: report.emails_sent,
63
+ abuse_reports: report.abuse_reports,
64
+ unsubscribed: report.unsubscribed,
65
+ send_time: report.send_time,
66
+ rss_last_send: report.rss_last_send,
67
+ bounces: report.bounces,
68
+ forwards: report.forwards,
69
+ opens: report.opens,
70
+ clicks: report.clicks,
71
+ facebook_likes: report.facebook_likes,
72
+ industry_stats: report.industry_stats,
73
+ list_stats: report.list_stats,
74
+ ab_split: report.ab_split,
75
+ timewarp: report.timewarp,
76
+ timeseries: report.timeseries,
77
+ share_report: report.share_report,
78
+ ecommerce: report.ecommerce,
79
+ delivery_status: report.delivery_status,
80
+ _links: report._links,
81
+ },
82
+ summary: {
83
+ campaign_title: report.campaign_title,
84
+ subject_line: report.subject_line,
85
+ emails_sent: report.emails_sent,
86
+ unique_opens: ((_a = report.opens) === null || _a === void 0 ? void 0 : _a.unique_opens) || 0,
87
+ unique_clicks: ((_b = report.clicks) === null || _b === void 0 ? void 0 : _b.unique_clicks) || 0,
88
+ open_rate: ((_c = report.opens) === null || _c === void 0 ? void 0 : _c.open_rate) || 0,
89
+ click_rate: ((_d = report.clicks) === null || _d === void 0 ? void 0 : _d.click_rate) || 0,
90
+ bounce_rate: report.bounces ? ((report.bounces.hard_bounces + report.bounces.soft_bounces) / report.emails_sent * 100) : 0,
91
+ unsub_rate: report.unsubscribed ? (report.unsubscribed / report.emails_sent * 100) : 0,
92
+ abuse_rate: report.abuse_reports ? (report.abuse_reports / report.emails_sent * 100) : 0,
93
+ },
94
+ performance_metrics: {
95
+ opens: {
96
+ total: ((_e = report.opens) === null || _e === void 0 ? void 0 : _e.opens_total) || 0,
97
+ unique: ((_f = report.opens) === null || _f === void 0 ? void 0 : _f.unique_opens) || 0,
98
+ rate: ((_g = report.opens) === null || _g === void 0 ? void 0 : _g.open_rate) || 0,
99
+ last_open: (_h = report.opens) === null || _h === void 0 ? void 0 : _h.last_open,
100
+ proxy_excluded: {
101
+ total: ((_j = report.opens) === null || _j === void 0 ? void 0 : _j.proxy_excluded_opens) || 0,
102
+ unique: ((_k = report.opens) === null || _k === void 0 ? void 0 : _k.proxy_excluded_unique_opens) || 0,
103
+ rate: ((_l = report.opens) === null || _l === void 0 ? void 0 : _l.proxy_excluded_open_rate) || 0,
104
+ },
105
+ },
106
+ clicks: {
107
+ total: ((_m = report.clicks) === null || _m === void 0 ? void 0 : _m.clicks_total) || 0,
108
+ unique: ((_o = report.clicks) === null || _o === void 0 ? void 0 : _o.unique_clicks) || 0,
109
+ unique_subscribers: ((_p = report.clicks) === null || _p === void 0 ? void 0 : _p.unique_subscriber_clicks) || 0,
110
+ rate: ((_q = report.clicks) === null || _q === void 0 ? void 0 : _q.click_rate) || 0,
111
+ last_click: (_r = report.clicks) === null || _r === void 0 ? void 0 : _r.last_click,
112
+ },
113
+ bounces: {
114
+ hard: ((_s = report.bounces) === null || _s === void 0 ? void 0 : _s.hard_bounces) || 0,
115
+ soft: ((_t = report.bounces) === null || _t === void 0 ? void 0 : _t.soft_bounces) || 0,
116
+ syntax_errors: ((_u = report.bounces) === null || _u === void 0 ? void 0 : _u.syntax_errors) || 0,
117
+ total: (((_v = report.bounces) === null || _v === void 0 ? void 0 : _v.hard_bounces) || 0) + (((_w = report.bounces) === null || _w === void 0 ? void 0 : _w.soft_bounces) || 0) + (((_x = report.bounces) === null || _x === void 0 ? void 0 : _x.syntax_errors) || 0),
118
+ },
119
+ engagement: {
120
+ forwards: {
121
+ count: ((_y = report.forwards) === null || _y === void 0 ? void 0 : _y.forwards_count) || 0,
122
+ opens: ((_z = report.forwards) === null || _z === void 0 ? void 0 : _z.forwards_opens) || 0,
123
+ },
124
+ facebook_likes: {
125
+ recipient_likes: ((_0 = report.facebook_likes) === null || _0 === void 0 ? void 0 : _0.recipient_likes) || 0,
126
+ unique_likes: ((_1 = report.facebook_likes) === null || _1 === void 0 ? void 0 : _1.unique_likes) || 0,
127
+ facebook_likes: ((_2 = report.facebook_likes) === null || _2 === void 0 ? void 0 : _2.facebook_likes) || 0,
128
+ },
129
+ },
130
+ },
131
+ industry_comparison: report.industry_stats ? {
132
+ industry_type: report.industry_stats.type,
133
+ open_rate: report.industry_stats.open_rate,
134
+ click_rate: report.industry_stats.click_rate,
135
+ bounce_rate: report.industry_stats.bounce_rate,
136
+ unopen_rate: report.industry_stats.unopen_rate,
137
+ unsub_rate: report.industry_stats.unsub_rate,
138
+ abuse_rate: report.industry_stats.abuse_rate,
139
+ } : null,
140
+ list_performance: report.list_stats ? {
141
+ subscription_rate: report.list_stats.sub_rate,
142
+ unsubscription_rate: report.list_stats.unsub_rate,
143
+ open_rate: report.list_stats.open_rate,
144
+ proxy_excluded_open_rate: report.list_stats.proxy_excluded_open_rate,
145
+ click_rate: report.list_stats.click_rate,
146
+ } : null,
147
+ ecommerce_data: report.ecommerce ? {
148
+ total_orders: report.ecommerce.total_orders,
149
+ total_spent: report.ecommerce.total_spent,
150
+ total_revenue: report.ecommerce.total_revenue,
151
+ currency_code: report.ecommerce.currency_code,
152
+ } : null,
153
+ delivery_status: report.delivery_status ? {
154
+ enabled: report.delivery_status.enabled,
155
+ can_cancel: report.delivery_status.can_cancel,
156
+ status: report.delivery_status.status,
157
+ emails_sent: report.delivery_status.emails_sent,
158
+ emails_canceled: report.delivery_status.emails_canceled,
159
+ } : null,
160
+ ab_split_data: report.ab_split ? {
161
+ group_a: {
162
+ bounces: ((_3 = report.ab_split.a) === null || _3 === void 0 ? void 0 : _3.bounces) || 0,
163
+ abuse_reports: ((_4 = report.ab_split.a) === null || _4 === void 0 ? void 0 : _4.abuse_reports) || 0,
164
+ unsubs: ((_5 = report.ab_split.a) === null || _5 === void 0 ? void 0 : _5.unsubs) || 0,
165
+ recipient_clicks: ((_6 = report.ab_split.a) === null || _6 === void 0 ? void 0 : _6.recipient_clicks) || 0,
166
+ forwards: ((_7 = report.ab_split.a) === null || _7 === void 0 ? void 0 : _7.forwards) || 0,
167
+ forwards_opens: ((_8 = report.ab_split.a) === null || _8 === void 0 ? void 0 : _8.forwards_opens) || 0,
168
+ opens: ((_9 = report.ab_split.a) === null || _9 === void 0 ? void 0 : _9.opens) || 0,
169
+ last_open: (_10 = report.ab_split.a) === null || _10 === void 0 ? void 0 : _10.last_open,
170
+ unique_opens: ((_11 = report.ab_split.a) === null || _11 === void 0 ? void 0 : _11.unique_opens) || 0,
171
+ },
172
+ group_b: {
173
+ bounces: ((_12 = report.ab_split.b) === null || _12 === void 0 ? void 0 : _12.bounces) || 0,
174
+ abuse_reports: ((_13 = report.ab_split.b) === null || _13 === void 0 ? void 0 : _13.abuse_reports) || 0,
175
+ unsubs: ((_14 = report.ab_split.b) === null || _14 === void 0 ? void 0 : _14.unsubs) || 0,
176
+ recipient_clicks: ((_15 = report.ab_split.b) === null || _15 === void 0 ? void 0 : _15.recipient_clicks) || 0,
177
+ forwards: ((_16 = report.ab_split.b) === null || _16 === void 0 ? void 0 : _16.forwards) || 0,
178
+ forwards_opens: ((_17 = report.ab_split.b) === null || _17 === void 0 ? void 0 : _17.forwards_opens) || 0,
179
+ opens: ((_18 = report.ab_split.b) === null || _18 === void 0 ? void 0 : _18.opens) || 0,
180
+ last_open: (_19 = report.ab_split.b) === null || _19 === void 0 ? void 0 : _19.last_open,
181
+ unique_opens: ((_20 = report.ab_split.b) === null || _20 === void 0 ? void 0 : _20.unique_opens) || 0,
182
+ },
183
+ } : null,
184
+ timewarp_data: report.timewarp || [],
185
+ timeseries_data: report.timeseries || [],
186
+ share_report: report.share_report ? {
187
+ share_url: report.share_report.share_url,
188
+ share_password: report.share_report.share_password,
189
+ } : null,
190
+ };
191
+ }
192
+ catch (error) {
193
+ if (error.status === 404) {
194
+ return {
195
+ success: false,
196
+ error: 'Campaign report not found',
197
+ message: 'The requested campaign report could not be found. Make sure the campaign has been sent and the campaign ID is correct.',
198
+ detail: error.detail || 'The requested resource could not be found',
199
+ };
200
+ }
201
+ throw new Error(`Failed to get campaign report: ${error.message || JSON.stringify(error)}`);
202
+ }
203
+ });
204
+ },
205
+ });
206
+ //# sourceMappingURL=get-campaign-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-campaign-report.js","sourceRoot":"","sources":["../../../src/lib/actions/get-campaign-report.ts"],"names":[],"mappings":";;;;AAAA,+GAA+G;AAC/G,qEAAqE;AACrE,gEAAmE;AACnE,0DAA+D;AAC/D,6BAAsC;AACtC,sCAA4C;AAC5C,iGAAuD;AAG1C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAa;IACnB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,yHAAyH;IACtI,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,yXAAyX,EAAE,UAAU,EAAE,IAAI,EAAE;IACxa,KAAK,EAAE;QACL,WAAW,EAAE,wBAAe,CAAC,2BAA2B;QACxD,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,yFAAyF;YACtG,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,cAAc,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,uEAAuE;YACpF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,WAAW,GAAG,IAAA,qCAAqB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACxD,MAAM,MAAM,GAAG,MAAM,wBAAe,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;YAE3E,MAAM,MAAM,GAAG,6BAAuC,CAAC;YACvD,MAAM,CAAC,SAAS,CAAC;gBACf,WAAW,EAAE,WAAW;gBACxB,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;YAEH,IAAI,CAAC;gBACH,MAAM,OAAO,G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AAC;4BACpC,SAAS,EAAE,OAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,4CAAE,SAAS;4BACvC,YAAY,EAAE,CAAA,OAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,4CAAE,YAAY,KAAI,CAAC;yBACnD;qBACF,CAAC,CAAC,CAAC,IAAI;oBACR,aAAa,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;oBACpC,eAAe,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE;oBACxC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;wBAClC,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,SAAS;wBACxC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,cAAc;qBACnD,CAAC,CAAC,CAAC,IAAI;iBACT,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBACzB,OAAO;wBACL,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,2BAA2B;wBAClC,OAAO,EAAE,wHAAwH;wBACjI,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,2CAA2C;qBACpE,CAAC;gBACJ,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC9F,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const removeSubscriberFromTag: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
2
+ list_id: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
3
+ email: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ tag_name: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ }>;
6
+ //# sourceMappingURL=remove-subscriber-from-tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-subscriber-from-tag.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/remove-subscriber-from-tag.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,uBAAuB;;;;EAwFlC,CAAC"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeSubscriberFromTag = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/remove-subscriber-from-tag.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ const common_1 = require("../common");
10
+ const __1 = require("../..");
11
+ exports.removeSubscriberFromTag = (0, pieces_framework_1.createAction)({
12
+ auth: __1.mailchimpAuth,
13
+ name: 'remove_subscriber_from_tag',
14
+ displayName: 'Remove Subscriber from Tag',
15
+ description: 'Remove a subscriber from a specific tag in your Mailchimp audience.',
16
+ audience: 'both',
17
+ aiMetadata: { description: 'Deactivates a tag on a subscriber, identified by email within a given audience (list). Use to un-segment or un-label a contact. Idempotent: removing a tag the member does not have leaves the state unchanged.', idempotent: true },
18
+ props: {
19
+ list_id: common_1.mailchimpCommon.mailChimpListIdDropdown,
20
+ email: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Email Address',
22
+ description: 'The email address of the subscriber to remove from the tag',
23
+ required: true,
24
+ }),
25
+ tag_name: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Tag Name',
27
+ description: 'The name of the tag to remove the subscriber from',
28
+ required: true,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const { list_id, email, tag_name } = context.propsValue;
34
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
35
+ try {
36
+ const serverPrefix = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
37
+ const subscriberHash = common_1.mailchimpCommon.getMD5EmailHash(email);
38
+ const url = `https://${serverPrefix}.api.mailchimp.com/3.0/lists/${list_id}/members/${subscriberHash}/tags`;
39
+ const response = yield fetch(url, {
40
+ method: 'POST',
41
+ headers: {
42
+ 'Authorization': `Bearer ${accessToken}`,
43
+ 'Content-Type': 'application/json',
44
+ },
45
+ body: JSON.stringify({
46
+ tags: [
47
+ {
48
+ name: tag_name,
49
+ status: 'inactive',
50
+ },
51
+ ],
52
+ }),
53
+ });
54
+ if (!response.ok) {
55
+ let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
56
+ try {
57
+ const errorText = yield response.text();
58
+ if (errorText && errorText.trim()) {
59
+ const errorData = JSON.parse(errorText);
60
+ errorMessage = errorData.detail || errorData.title || errorData.message || errorText;
61
+ }
62
+ }
63
+ catch (parseError) {
64
+ const errorText = yield response.text();
65
+ if (errorText && errorText.trim()) {
66
+ errorMessage = errorText;
67
+ }
68
+ }
69
+ throw new Error(`Failed to remove subscriber from tag: ${errorMessage}`);
70
+ }
71
+ let result;
72
+ try {
73
+ const responseText = yield response.text();
74
+ if (responseText && responseText.trim()) {
75
+ result = JSON.parse(responseText);
76
+ }
77
+ else {
78
+ result = { success: true };
79
+ }
80
+ }
81
+ catch (parseError) {
82
+ result = { success: true };
83
+ }
84
+ return {
85
+ success: true,
86
+ message: `Successfully removed subscriber ${email} from tag ${tag_name}`,
87
+ data: result,
88
+ _links: result._links || [],
89
+ };
90
+ }
91
+ catch (error) {
92
+ console.error('Error removing subscriber from tag:', error);
93
+ throw new Error(`Failed to remove subscriber from tag: ${error.message}`);
94
+ }
95
+ });
96
+ },
97
+ });
98
+ //# sourceMappingURL=remove-subscriber-from-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-subscriber-from-tag.js","sourceRoot":"","sources":["../../../src/lib/actions/rem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AC;yBAAM,CAAC;wBACN,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oBAC7B,CAAC;gBACH,CAAC;gBAAC,OAAO,UAAU,EAAE,CAAC;oBACpB,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBAC7B,CAAC;gBAED,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,mCAAmC,KAAK,aAAa,QAAQ,EAAE;oBACxE,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;iBAC5B,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;gBAC5D,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const sendCampaign: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
2
+ campaign_id: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
3
+ }>;
4
+ //# sourceMappingURL=send-campaign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-campaign.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/send-campaign.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY;;EAkCvB,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendCampaign = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/send-campaign.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ const common_1 = require("../common");
10
+ const __1 = require("../..");
11
+ const mailchimp_marketing_1 = tslib_1.__importDefault(require("@mailchimp/mailchimp_marketing"));
12
+ exports.sendCampaign = (0, pieces_framework_1.createAction)({
13
+ auth: __1.mailchimpAuth,
14
+ name: 'send_campaign',
15
+ displayName: 'Send Campaign',
16
+ description: 'Send a draft campaign to the subscribers in its audience, segment, or tag',
17
+ audience: 'both',
18
+ aiMetadata: { description: 'Sends an existing draft campaign to its configured recipients immediately (RSS campaigns follow their schedule instead). Use once the campaign is fully set up; there is no undo, so confirm the campaign content and audience beforehand. Not idempotent: calling again on an already-sent campaign fails.', idempotent: false },
19
+ props: {
20
+ campaign_id: common_1.mailchimpCommon.mailChimpDraftCampaignIdDropdown,
21
+ },
22
+ run(context) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const { campaign_id } = context.propsValue;
25
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
26
+ const server = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
27
+ const client = mailchimp_marketing_1.default;
28
+ client.setConfig({
29
+ accessToken: accessToken,
30
+ server: server,
31
+ });
32
+ try {
33
+ // Docs: https://mailchimp.com/developer/marketing/api/campaigns/send-campaign/
34
+ yield client.campaigns.send(campaign_id);
35
+ return {
36
+ success: true,
37
+ message: 'Campaign sent successfully',
38
+ campaign_id,
39
+ };
40
+ }
41
+ catch (error) {
42
+ throw new Error(`Failed to send campaign: ${error.message || JSON.stringify(error)}`);
43
+ }
44
+ });
45
+ },
46
+ });
47
+ //# sourceMappingURL=send-campaign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-campaign.js","sourceRoot":"","sources":["../../../src/lib/actions/send-campaign.ts"],"names":[],"mappings":";;;;AAAA,yGAAyG;AACzG,qEAAqE;AACrE,gEAAyD;AACzD,0DAA+D;AAC/D,sCAA4C;AAC5C,6BAAsC;AACtC,iGAAuD;AAG1C,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,iBAAa;IACnB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,2EAA2E;IACxF,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6SAA6S,EAAE,UAAU,EAAE,KAAK,EAAE;IAC7V,KAAK,EAAE;QACL,WAAW,EAAE,wBAAe,CAAC,gCAAgC;KAC9D;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC3C,MAAM,WAAW,GAAG,IAAA,qCAAqB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACxD,MAAM,MAAM,GAAG,MAAM,wBAAe,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;YAE3E,MAAM,MAAM,GAAG,6BAAuC,CAAC;YACvD,MAAM,CAAC,SAAS,CAAC;gBACf,WAAW,EAAE,WAAW;gBACxB,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;YAEH,IAAI,CAAC;gBACH,+EAA+E;gBAC/E,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,WAAqB,CAAC,CAAC;gBAEnD,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,4BAA4B;oBACrC,WAAW;iBACZ,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const unsubscribeEmail: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
2
+ list_id: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
3
+ email_address: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ skip_merge_validation: import("@agnocon/pieces-framework").CheckboxProperty<false>;
5
+ skip_duplicate_check: import("@agnocon/pieces-framework").CheckboxProperty<false>;
6
+ update_existing: import("@agnocon/pieces-framework").CheckboxProperty<false>;
7
+ }>;
8
+ //# sourceMappingURL=unsubscribe-email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsubscribe-email.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/unsubscribe-email.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB;;;;;;EAmF3B,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unsubscribeEmail = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/unsubscribe-email.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
8
+ const pieces_common_1 = require("@agnocon/pieces-common");
9
+ const common_1 = require("../common");
10
+ const __1 = require("../..");
11
+ const mailchimp_marketing_1 = tslib_1.__importDefault(require("@mailchimp/mailchimp_marketing"));
12
+ exports.unsubscribeEmail = (0, pieces_framework_1.createAction)({
13
+ auth: __1.mailchimpAuth,
14
+ name: 'unsubscribe_email',
15
+ displayName: 'Unsubscribe Email',
16
+ description: 'Unsubscribe an email address from an audience',
17
+ audience: 'both',
18
+ aiMetadata: { description: 'Sets an email address to unsubscribed status within an audience (list) via a batch upsert; with "update existing" on, it changes an existing member, otherwise it can add the address as unsubscribed. Use to opt a contact out of a specific audience. Idempotent: repeating converges to the same unsubscribed state.', idempotent: true },
19
+ props: {
20
+ list_id: common_1.mailchimpCommon.mailChimpListIdDropdown,
21
+ email_address: pieces_framework_1.Property.ShortText({
22
+ displayName: 'Email Address',
23
+ description: 'Email address to unsubscribe',
24
+ required: true,
25
+ }),
26
+ skip_merge_validation: pieces_framework_1.Property.Checkbox({
27
+ displayName: 'Skip Merge Validation',
28
+ description: 'Accept member data without merge field values even if required',
29
+ required: false,
30
+ defaultValue: false,
31
+ }),
32
+ skip_duplicate_check: pieces_framework_1.Property.Checkbox({
33
+ displayName: 'Skip Duplicate Check',
34
+ description: 'Ignore duplicates in the request',
35
+ required: false,
36
+ defaultValue: false,
37
+ }),
38
+ update_existing: pieces_framework_1.Property.Checkbox({
39
+ displayName: 'Update Existing',
40
+ description: 'Change existing members subscription status',
41
+ required: false,
42
+ defaultValue: true,
43
+ }),
44
+ },
45
+ run(context) {
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
48
+ const server = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
49
+ const client = mailchimp_marketing_1.default;
50
+ client.setConfig({
51
+ accessToken: accessToken,
52
+ server: server,
53
+ });
54
+ try {
55
+ const batchData = {
56
+ members: [
57
+ {
58
+ email_address: context.propsValue.email_address,
59
+ status: 'unsubscribed',
60
+ },
61
+ ],
62
+ update_existing: context.propsValue.update_existing,
63
+ };
64
+ const queryParams = {};
65
+ if (context.propsValue.skip_merge_validation) {
66
+ queryParams.skip_merge_validation = true;
67
+ }
68
+ if (context.propsValue.skip_duplicate_check) {
69
+ queryParams.skip_duplicate_check = true;
70
+ }
71
+ const result = yield client.lists.batchListMembers(context.propsValue.list_id, batchData, queryParams);
72
+ return {
73
+ success: true,
74
+ message: `Email ${context.propsValue.email_address} has been unsubscribed`,
75
+ new_members: result.new_members,
76
+ updated_members: result.updated_members,
77
+ errors: result.errors,
78
+ total_created: result.total_created,
79
+ total_updated: result.total_updated,
80
+ error_count: result.error_count,
81
+ _links: result._links,
82
+ };
83
+ }
84
+ catch (error) {
85
+ throw new Error(`Failed to unsubscribe email: ${error.message || JSON.stringify(error)}`);
86
+ }
87
+ });
88
+ },
89
+ });
90
+ //# sourceMappingURL=unsubscribe-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsubscribe-email.js","sourceRoot":"","sources":["../../../src/lib/actions/unsubscribe-email.ts"],"names":[],"mappings":";;;;AAAA,6GAA6G;AAC7G,qEAAqE;AACrE,gEAAmE;AACnE,0DAA+D;AAC/D,sCAA4C;AAC5C,6BAAsC;AACtC,iGAAuD;AAG1C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,iBAAa;IACnB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,+CAA+C;IAC5D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,yTAAyT,EAAE,UAAU,EAAE,IAAI,EAAE;IACxW,KAAK,EAAE;QACL,OAAO,EAAE,wBAAe,CAAC,uBAAuB;QAChD,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,qBAAqB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,gEAAgE;YAC7E,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,oBAAoB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtC,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAA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aAAa;oBACnC,aAAa,EAAE,MAAM,CAAC,aAAa;oBACnC,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC5F,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const updateSubscriberInList: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
2
+ email: import("@agnocon/pieces-framework").ShortTextProperty<true>;
3
+ list_id: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
4
+ status: import("@agnocon/pieces-framework").StaticDropdownProperty<"cleaned" | "pending" | "transactional" | "subscribed" | "unsubscribed", false> | import("@agnocon/pieces-framework").StaticDropdownProperty<"cleaned" | "pending" | "transactional" | "subscribed" | "unsubscribed", true>;
5
+ }>;
6
+ //# sourceMappingURL=update-subscriber-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-subscriber-status.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/update-subscriber-status.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB;;;;EA+CjC,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateSubscriberInList = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/update-subscriber-status.ts (MIT).
6
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
7
+ const common_1 = require("../common");
8
+ const mailchimp_marketing_1 = tslib_1.__importDefault(require("@mailchimp/mailchimp_marketing"));
9
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
10
+ const __1 = require("../..");
11
+ exports.updateSubscriberInList = (0, pieces_framework_1.createAction)({
12
+ auth: __1.mailchimpAuth,
13
+ name: 'update_member_in_list',
14
+ displayName: 'Update Member in an Audience (List)',
15
+ description: 'Update a member in an existing Mailchimp audience (list)',
16
+ audience: 'both',
17
+ aiMetadata: { description: 'Updates the subscription status (subscribed, unsubscribed, cleaned, pending, transactional) of an existing member in an audience (list), identified by email. Use to change a known contact\'s status; the member must already exist, or the call fails. Idempotent: setting the same status repeatedly converges to that state.', idempotent: true },
18
+ props: {
19
+ email: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Email',
21
+ description: 'Email of the new contact',
22
+ required: true,
23
+ }),
24
+ list_id: common_1.mailchimpCommon.mailChimpListIdDropdown,
25
+ status: pieces_framework_1.Property.StaticDropdown({
26
+ displayName: 'Status',
27
+ required: true,
28
+ options: {
29
+ options: [
30
+ { label: 'Subscribed', value: 'subscribed' },
31
+ { label: 'Unsubscribed', value: 'unsubscribed' },
32
+ { label: 'Cleaned', value: 'cleaned' },
33
+ { label: 'Pending', value: 'pending' },
34
+ { label: 'Transactional', value: 'transactional' },
35
+ ],
36
+ },
37
+ }),
38
+ },
39
+ run(context) {
40
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
+ const { list_id, email, status } = context.propsValue;
42
+ const access_token = context.auth.access_token;
43
+ const mailChimpServerPrefix = yield common_1.mailchimpCommon.getMailChimpServerPrefix(access_token);
44
+ mailchimp_marketing_1.default.setConfig({
45
+ accessToken: access_token,
46
+ server: mailChimpServerPrefix,
47
+ });
48
+ return yield mailchimp_marketing_1.default.lists.updateListMember(list_id, email, {
49
+ status: status,
50
+ });
51
+ });
52
+ },
53
+ });
54
+ //# sourceMappingURL=update-subscriber-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-subscriber-status.js","sourceRoot":"","sources":["../../../src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,wBAAe,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;YAC/D,6BAAS,CAAC,SAAS,CAAC;gBAClB,WAAW,EAAE,YAAY;gBACzB,MAAM,EAAE,qBAAqB;aAC9B,CAAC,CAAC;YACH,OAAO,MAAM,6BAAS,CAAC,KAAK,CAAC,gBAAgB,CAC3C,OAAiB,EACjB,KAAM,EACN;gBACE,MAAM,EAAE,MAAO;aAChB,CACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { OAuth2PropertyValue } from '@agnocon/pieces-framework';
2
+ export declare const mailchimpCommon: {
3
+ mailChimpListIdDropdown: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
4
+ getUserLists: (authProp: OAuth2PropertyValue) => Promise<any>;
5
+ mailChimpCampaignIdDropdown: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
6
+ getUserCampaigns: (authProp: OAuth2PropertyValue, options?: {
7
+ status?: string;
8
+ }) => Promise<any>;
9
+ mailChimpDraftCampaignIdDropdown: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
10
+ mailChimpStoreIdDropdown: import("@agnocon/pieces-framework").DropdownProperty<string, true, import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
11
+ getUserStores: (authProp: OAuth2PropertyValue) => Promise<any>;
12
+ getMailChimpServerPrefix: (access_token: string) => Promise<any>;
13
+ enableWebhookRequest: ({ server, token, listId, webhookUrl, events, }: EnableTriggerRequestParams) => Promise<string>;
14
+ disableWebhookRequest: ({ server, token, listId, webhookId, }: DisableTriggerRequestParams) => Promise<void>;
15
+ getMD5EmailHash: (email: string) => string;
16
+ };
17
+ type TriggerRequestParams = {
18
+ server: string;
19
+ token: string;
20
+ listId: string;
21
+ };
22
+ type EnableTriggerRequestParams = TriggerRequestParams & {
23
+ webhookUrl: string;
24
+ events: object;
25
+ };
26
+ type DisableTriggerRequestParams = TriggerRequestParams & {
27
+ webhookId: string;
28
+ };
29
+ export {};
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/common/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAW1E,eAAO,MAAM,eAAe;;6BAgCK,mBAAmB;;iCAgDf,mBAAmB,YAAY;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;;8BAmFrD,mBAAmB;6CAeJ,MAAM;2EAgBlD,0BAA0B,KAAG,OAAO,CAAC,MAAM,CAAC;mEA2B5C,2BAA2B,KAAG,OAAO,CAAC,IAAI,CAAC;6BAUrB,MAAM;CAGhC,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,0BAA0B,GAAG,oBAAoB,GAAG;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,2BAA2B,GAAG,oBAAoB,GAAG;IACxD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}