@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
package/LICENSE.MIT-AP ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) Activepieces AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ Derived helpers in this folder are adapted from Activepieces (MIT) for use
24
+ inside CX without depending on @activepieces/* packages at runtime.
@@ -0,0 +1,3 @@
1
+ export declare const mailchimpAuth: import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>;
2
+ export declare const mailchimp: import("@agnocon/pieces-framework").Piece<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,aAAa,qGAMxB,CAAC;AAEH,eAAO,MAAM,SAAS,gJAsCpB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mailchimp = exports.mailchimpAuth = void 0;
4
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/index.ts (MIT).
5
+ // Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
6
+ const pieces_framework_1 = require("@agnocon/pieces-framework");
7
+ const add_member_to_list_1 = require("./lib/actions/add-member-to-list");
8
+ const add_note_to_subscriber_1 = require("./lib/actions/add-note-to-subscriber");
9
+ const remove_subscriber_from_tag_1 = require("./lib/actions/remove-subscriber-from-tag");
10
+ const update_subscriber_status_1 = require("./lib/actions/update-subscriber-status");
11
+ const add_subscriber_to_tag_1 = require("./lib/actions/add-subscriber-to-tag");
12
+ const create_campaign_1 = require("./lib/actions/create-campaign");
13
+ const get_campaign_report_1 = require("./lib/actions/get-campaign-report");
14
+ const create_audience_1 = require("./lib/actions/create-audience");
15
+ const archive_subscriber_1 = require("./lib/actions/archive-subscriber");
16
+ const unsubscribe_email_1 = require("./lib/actions/unsubscribe-email");
17
+ const find_campaign_1 = require("./lib/actions/find-campaign");
18
+ const find_customer_1 = require("./lib/actions/find-customer");
19
+ const find_tag_1 = require("./lib/actions/find-tag");
20
+ const find_subscriber_1 = require("./lib/actions/find-subscriber");
21
+ const create_tag_1 = require("./lib/actions/create-tag");
22
+ const send_campaign_1 = require("./lib/actions/send-campaign");
23
+ const create_custom_event_1 = require("./lib/actions/create-custom-event");
24
+ const pieces_framework_2 = require("@agnocon/pieces-framework");
25
+ const subscribe_trigger_1 = require("./lib/triggers/subscribe-trigger");
26
+ const unsubscribe_trigger_1 = require("./lib/triggers/unsubscribe-trigger");
27
+ const new_campaign_trigger_1 = require("./lib/triggers/new-campaign-trigger");
28
+ const link_clicked_trigger_1 = require("./lib/triggers/link-clicked-trigger");
29
+ const email_opened_trigger_1 = require("./lib/triggers/email-opened-trigger");
30
+ const subscriber_updated_trigger_1 = require("./lib/triggers/subscriber-updated-trigger");
31
+ const new_customer_trigger_1 = require("./lib/triggers/new-customer-trigger");
32
+ const new_order_trigger_1 = require("./lib/triggers/new-order-trigger");
33
+ const new_segment_tag_subscriber_trigger_1 = require("./lib/triggers/new-segment-tag-subscriber-trigger");
34
+ exports.mailchimpAuth = pieces_framework_1.PieceAuth.OAuth2({
35
+ description: '',
36
+ authUrl: 'https://login.mailchimp.com/oauth2/authorize',
37
+ tokenUrl: 'https://login.mailchimp.com/oauth2/token',
38
+ required: true,
39
+ scope: [],
40
+ });
41
+ exports.mailchimp = (0, pieces_framework_1.createPiece)({
42
+ displayName: 'Mailchimp',
43
+ description: 'All-in-One integrated marketing platform for managing audiences, sending campaigns, tracking engagement, and automating lifecycle communications.',
44
+ minimumSupportedRelease: '0.30.0',
45
+ logoUrl: 'https://cdn.activepieces.com/pieces/mailchimp.png',
46
+ authors: ["abdullahranginwala", "TaskMagicKyle", "kishanprmr", "AbdulTheActivePiecer", "khaledmashaly", "abuaboud", "sparkybug", "onyedikachi-david"],
47
+ categories: [pieces_framework_2.PieceCategory.MARKETING],
48
+ auth: exports.mailchimpAuth,
49
+ actions: [
50
+ add_member_to_list_1.addMemberToList,
51
+ add_note_to_subscriber_1.addNoteToSubscriber,
52
+ add_subscriber_to_tag_1.addSubscriberToTag,
53
+ remove_subscriber_from_tag_1.removeSubscriberFromTag,
54
+ update_subscriber_status_1.updateSubscriberInList,
55
+ create_campaign_1.createCampaign,
56
+ get_campaign_report_1.getCampaignReport,
57
+ create_audience_1.createAudience,
58
+ archive_subscriber_1.archiveSubscriber,
59
+ unsubscribe_email_1.unsubscribeEmail,
60
+ find_campaign_1.findCampaign,
61
+ find_customer_1.findCustomer,
62
+ find_tag_1.findTag,
63
+ find_subscriber_1.findSubscriber,
64
+ create_tag_1.createTag,
65
+ send_campaign_1.sendCampaign,
66
+ create_custom_event_1.createCustomEvent,
67
+ ],
68
+ triggers: [
69
+ subscribe_trigger_1.mailChimpSubscribeTrigger,
70
+ unsubscribe_trigger_1.mailChimpUnsubscriberTrigger,
71
+ new_campaign_trigger_1.mailChimpNewCampaignTrigger,
72
+ link_clicked_trigger_1.mailChimpLinkClickedTrigger,
73
+ email_opened_trigger_1.mailChimpEmailOpenedTrigger,
74
+ subscriber_updated_trigger_1.mailChimpSubscriberUpdatedTrigger,
75
+ new_customer_trigger_1.mailChimpNewCustomerTrigger,
76
+ new_order_trigger_1.mailChimpNewOrderTrigger,
77
+ new_segment_tag_subscriber_trigger_1.mailChimpNewSegmentTagSubscriberTrigger,
78
+ ],
79
+ });
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AACrF,qEAAqE;AACrE,gEAAmE;AACnE,yEAAmE;AACnE,iFAA2E;AAC3E,yFAAmF;AACnF,qFAAgF;AAChF,+EAAyE;AACzE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QACjC,kDAA2B;QAC3B,4CAAwB;QACxB,4EAAuC;KACxC;CACF,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const addMemberToList: 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
+ status_if_new: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
5
+ email_type: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
6
+ status: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
7
+ first_name: import("@agnocon/pieces-framework").ShortTextProperty<false>;
8
+ last_name: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ language: import("@agnocon/pieces-framework").ShortTextProperty<false>;
10
+ vip: import("@agnocon/pieces-framework").CheckboxProperty<false>;
11
+ skip_merge_validation: import("@agnocon/pieces-framework").CheckboxProperty<false>;
12
+ }>;
13
+ //# sourceMappingURL=add-member-to-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-member-to-list.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/add-member-to-list.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe;;;;;;;;;;;EA2K1B,CAAC"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addMemberToList = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/add-member-to-list.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
+ const crypto_1 = tslib_1.__importDefault(require("crypto"));
13
+ exports.addMemberToList = (0, pieces_framework_1.createAction)({
14
+ auth: __1.mailchimpAuth,
15
+ name: 'add_member_to_list',
16
+ displayName: 'Add or Update Subscriber',
17
+ description: 'Add a new subscriber to an audience or update existing subscriber',
18
+ audience: 'both',
19
+ aiMetadata: { description: 'Upserts a member into a Mailchimp audience (list) keyed on the email address: creates the subscriber if absent (using the "status if new" value) or updates the existing record otherwise. Use to ensure a contact exists with given status, name, language, or VIP flag without checking first. Requires the target list and email; repeating with the same input is safe and converges to the same member state.', idempotent: true },
20
+ props: {
21
+ list_id: common_1.mailchimpCommon.mailChimpListIdDropdown,
22
+ email_address: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Email Address',
24
+ description: 'Email address for the subscriber',
25
+ required: true,
26
+ }),
27
+ status_if_new: pieces_framework_1.Property.StaticDropdown({
28
+ displayName: 'Status if New',
29
+ description: 'Status for new subscribers',
30
+ required: true,
31
+ options: {
32
+ options: [
33
+ { label: 'Subscribed', value: 'subscribed' },
34
+ { label: 'Unsubscribed', value: 'unsubscribed' },
35
+ { label: 'Cleaned', value: 'cleaned' },
36
+ { label: 'Pending', value: 'pending' },
37
+ { label: 'Transactional', value: 'transactional' },
38
+ ],
39
+ },
40
+ }),
41
+ email_type: pieces_framework_1.Property.StaticDropdown({
42
+ displayName: 'Email Type',
43
+ description: 'Type of email this member wants to receive',
44
+ required: false,
45
+ options: {
46
+ options: [
47
+ { label: 'HTML', value: 'html' },
48
+ { label: 'Text', value: 'text' },
49
+ ],
50
+ },
51
+ }),
52
+ status: pieces_framework_1.Property.StaticDropdown({
53
+ displayName: 'Status',
54
+ description: 'Current status of subscriber (for updates)',
55
+ required: false,
56
+ options: {
57
+ options: [
58
+ { label: 'Subscribed', value: 'subscribed' },
59
+ { label: 'Unsubscribed', value: 'unsubscribed' },
60
+ { label: 'Cleaned', value: 'cleaned' },
61
+ { label: 'Pending', value: 'pending' },
62
+ { label: 'Transactional', value: 'transactional' },
63
+ ],
64
+ },
65
+ }),
66
+ first_name: pieces_framework_1.Property.ShortText({
67
+ displayName: 'First Name',
68
+ description: 'First name of the subscriber',
69
+ required: false,
70
+ }),
71
+ last_name: pieces_framework_1.Property.ShortText({
72
+ displayName: 'Last Name',
73
+ description: 'Last name of the subscriber',
74
+ required: false,
75
+ }),
76
+ language: pieces_framework_1.Property.ShortText({
77
+ displayName: 'Language',
78
+ description: 'Subscriber language (e.g., "en", "es", "fr")',
79
+ required: false,
80
+ }),
81
+ vip: pieces_framework_1.Property.Checkbox({
82
+ displayName: 'VIP',
83
+ description: 'VIP status for subscriber',
84
+ required: false,
85
+ defaultValue: false,
86
+ }),
87
+ skip_merge_validation: pieces_framework_1.Property.Checkbox({
88
+ displayName: 'Skip Merge Validation',
89
+ description: 'Accept member data without merge field values even if required',
90
+ required: false,
91
+ defaultValue: false,
92
+ }),
93
+ },
94
+ run(context) {
95
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
96
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
97
+ const server = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
98
+ const client = mailchimp_marketing_1.default;
99
+ client.setConfig({
100
+ accessToken: accessToken,
101
+ server: server,
102
+ });
103
+ try {
104
+ const subscriberHash = crypto_1.default.createHash('md5').update(context.propsValue.email_address.toLowerCase()).digest('hex');
105
+ const memberData = {
106
+ email_address: context.propsValue.email_address,
107
+ status_if_new: context.propsValue.status_if_new,
108
+ };
109
+ if (context.propsValue.email_type) {
110
+ memberData.email_type = context.propsValue.email_type;
111
+ }
112
+ if (context.propsValue.status) {
113
+ memberData.status = context.propsValue.status;
114
+ }
115
+ if (context.propsValue.first_name || context.propsValue.last_name) {
116
+ memberData.merge_fields = {};
117
+ if (context.propsValue.first_name) {
118
+ memberData.merge_fields.FNAME = context.propsValue.first_name;
119
+ }
120
+ if (context.propsValue.last_name) {
121
+ memberData.merge_fields.LNAME = context.propsValue.last_name;
122
+ }
123
+ }
124
+ if (context.propsValue.language) {
125
+ memberData.language = context.propsValue.language;
126
+ }
127
+ if (context.propsValue.vip !== undefined) {
128
+ memberData.vip = context.propsValue.vip;
129
+ }
130
+ const queryParams = {};
131
+ if (context.propsValue.skip_merge_validation) {
132
+ queryParams.skip_merge_validation = true;
133
+ }
134
+ const member = yield client.lists.setListMember(context.propsValue.list_id, subscriberHash, memberData, queryParams);
135
+ return {
136
+ success: true,
137
+ id: member.id,
138
+ email_address: member.email_address,
139
+ unique_email_id: member.unique_email_id,
140
+ contact_id: member.contact_id,
141
+ full_name: member.full_name,
142
+ web_id: member.web_id,
143
+ email_type: member.email_type,
144
+ status: member.status,
145
+ merge_fields: member.merge_fields,
146
+ interests: member.interests,
147
+ stats: member.stats,
148
+ ip_signup: member.ip_signup,
149
+ timestamp_signup: member.timestamp_signup,
150
+ ip_opt: member.ip_opt,
151
+ timestamp_opt: member.timestamp_opt,
152
+ member_rating: member.member_rating,
153
+ last_changed: member.last_changed,
154
+ language: member.language,
155
+ vip: member.vip,
156
+ email_client: member.email_client,
157
+ location: member.location,
158
+ marketing_permissions: member.marketing_permissions,
159
+ source: member.source,
160
+ tags_count: member.tags_count,
161
+ tags: member.tags,
162
+ list_id: member.list_id,
163
+ _links: member._links,
164
+ };
165
+ }
166
+ catch (error) {
167
+ throw new Error(`Failed to add or update subscriber: ${error.message || JSON.stringify(error)}`);
168
+ }
169
+ });
170
+ },
171
+ });
172
+ //# sourceMappingURL=add-member-to-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-member-to-list.js","sourceRoot":"","sources":["../../../src/lib/actions/add-member-to-list.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAAmE;AACnE,0DAA+D;AAC/D,sCAA4C;AAC5C,6BAAsC;AACtC,iGAAuD;AAEvD,4DAA4B;AAEf,QAAA,eAAe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ACrB,aAAa,EAAE,MAAM,CAAC,aAAa;oBACnC,aAAa,EAAE,MAAM,CAAC,aAAa;oBACnC,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;oBACnD,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,uCAAuC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACnG,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const addNoteToSubscriber: 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
+ note: import("@agnocon/pieces-framework").LongTextProperty<true>;
5
+ }>;
6
+ //# sourceMappingURL=add-note-to-subscriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-note-to-subscriber.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/add-note-to-subscriber.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB;;;;EAqF9B,CAAC"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addNoteToSubscriber = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/add-note-to-subscriber.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.addNoteToSubscriber = (0, pieces_framework_1.createAction)({
12
+ auth: __1.mailchimpAuth,
13
+ name: 'add_note_to_subscriber',
14
+ displayName: 'Add Note to Subscriber',
15
+ description: 'Add a note to a subscriber in your Mailchimp audience.',
16
+ audience: 'both',
17
+ aiMetadata: { description: 'Appends an internal note to a subscriber, identified by email within a given audience (list). Use to record context or annotations on a contact. Not idempotent: each call adds a new note even if the content is identical.', idempotent: false },
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 add a note to',
23
+ required: true,
24
+ }),
25
+ note: pieces_framework_1.Property.LongText({
26
+ displayName: 'Note Content',
27
+ description: 'The note content to add to the subscriber',
28
+ required: true,
29
+ }),
30
+ },
31
+ run(context) {
32
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
33
+ const { list_id, email, note } = 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}/notes`;
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
+ note: note,
47
+ }),
48
+ });
49
+ if (!response.ok) {
50
+ let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
51
+ try {
52
+ const errorText = yield response.text();
53
+ if (errorText && errorText.trim()) {
54
+ const errorData = JSON.parse(errorText);
55
+ errorMessage = errorData.detail || errorData.title || errorData.message || errorText;
56
+ }
57
+ }
58
+ catch (parseError) {
59
+ const errorText = yield response.text();
60
+ if (errorText && errorText.trim()) {
61
+ errorMessage = errorText;
62
+ }
63
+ }
64
+ throw new Error(`Failed to add note to subscriber: ${errorMessage}`);
65
+ }
66
+ let result;
67
+ try {
68
+ const responseText = yield response.text();
69
+ if (responseText && responseText.trim()) {
70
+ result = JSON.parse(responseText);
71
+ }
72
+ else {
73
+ result = { success: true };
74
+ }
75
+ }
76
+ catch (parseError) {
77
+ result = { success: true };
78
+ }
79
+ return {
80
+ success: true,
81
+ message: `Successfully added note to subscriber ${email}`,
82
+ note_id: result.id,
83
+ note_content: result.note,
84
+ created_at: result.created_at,
85
+ _links: result._links || [],
86
+ };
87
+ }
88
+ catch (error) {
89
+ console.error('Error adding note to subscriber:', error);
90
+ throw new Error(`Failed to add note to subscriber: ${error.message}`);
91
+ }
92
+ });
93
+ },
94
+ });
95
+ //# sourceMappingURL=add-note-to-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-note-to-subscriber.js","sourceRoot":"","sources":["../../../src/lib/actions/add-note-to-subscriber.ts"],"names":[],"mappings":";;;;AAAA,kHAAkH;AAClH,qEAAqE;AACrE,gEAAmE;AACnE,0DAA+D;AAC/D,sCAA4C;AAC5C,6BAAsC;AAEzB,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,iBAAa;IACnB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,wBAAwB;IACrC,WAAW,EAAE,wDAAwD;IACrE,QAAQ,EAAE,MAAM;I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MAAM,CAAC,UAAU;oBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;iBAC5B,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;gBACzD,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const addSubscriberToTag: 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=add-subscriber-to-tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-subscriber-to-tag.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/add-subscriber-to-tag.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB;;;;EA0D7B,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addSubscriberToTag = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/add-subscriber-to-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
+ const mailchimp_marketing_1 = tslib_1.__importDefault(require("@mailchimp/mailchimp_marketing"));
12
+ exports.addSubscriberToTag = (0, pieces_framework_1.createAction)({
13
+ auth: __1.mailchimpAuth,
14
+ name: 'add_subscriber_to_tag',
15
+ displayName: 'Add Subscriber to Tag',
16
+ description: 'Add a subscriber to a specific tag in your Mailchimp audience.',
17
+ audience: 'both',
18
+ aiMetadata: { description: 'Activates a tag on a subscriber, identified by email within a given audience (list); the tag is created if it does not already exist. Use to segment or label a contact. Idempotent: re-applying an already-active tag leaves the member state unchanged.', idempotent: true },
19
+ props: {
20
+ list_id: common_1.mailchimpCommon.mailChimpListIdDropdown,
21
+ email: pieces_framework_1.Property.ShortText({
22
+ displayName: 'Email Address',
23
+ description: 'The email address of the subscriber to add to the tag',
24
+ required: true,
25
+ }),
26
+ tag_name: pieces_framework_1.Property.ShortText({
27
+ displayName: 'Tag Name',
28
+ description: 'The name of the tag to add the subscriber to',
29
+ required: true,
30
+ }),
31
+ },
32
+ run(context) {
33
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
+ const { list_id, email, tag_name } = context.propsValue;
35
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
36
+ try {
37
+ const serverPrefix = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
38
+ const subscriberHash = common_1.mailchimpCommon.getMD5EmailHash(email);
39
+ mailchimp_marketing_1.default.setConfig({
40
+ accessToken: accessToken,
41
+ server: serverPrefix,
42
+ });
43
+ const client = mailchimp_marketing_1.default;
44
+ const result = yield client.lists.updateListMemberTags(list_id, subscriberHash, {
45
+ tags: [
46
+ {
47
+ name: tag_name,
48
+ status: 'active',
49
+ },
50
+ ],
51
+ });
52
+ return {
53
+ success: true,
54
+ message: `Successfully added subscriber ${email} to tag ${tag_name}`,
55
+ data: result,
56
+ };
57
+ }
58
+ catch (error) {
59
+ console.error('Error adding subscriber to tag:', error);
60
+ throw new Error(`Failed to add subscriber to tag: ${error.message}`);
61
+ }
62
+ });
63
+ },
64
+ });
65
+ //# sourceMappingURL=add-subscriber-to-tag.js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AY;iBACrB,CAAC,CAAC;gBAEH,MAAM,MAAM,GAAG,6BAAuC,CAAC;gBAEvD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,oBAAoB,CACpD,OAAiB,EACjB,cAAc,EACd;oBACE,IAAI,EAAE;wBACJ;4BACE,IAAI,EAAE,QAAQ;4BACd,MAAM,EAAE,QAAQ;yBACjB;qBACF;iBACF,CACF,CAAC;gBAEF,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,iCAAiC,KAAK,WAAW,QAAQ,EAAE;oBACpE,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;gBACxD,MAAM,IAAI,KAAK,CAAC,oCAAoC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const archiveSubscriber: 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
+ subscriber_hash: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ }>;
5
+ //# sourceMappingURL=archive-subscriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive-subscriber.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/archive-subscriber.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB;;;EAuD5B,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.archiveSubscriber = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // Vendored from Activepieces packages/pieces/community/mailchimp/src/lib/actions/archive-subscriber.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
+ const crypto_1 = tslib_1.__importDefault(require("crypto"));
13
+ exports.archiveSubscriber = (0, pieces_framework_1.createAction)({
14
+ auth: __1.mailchimpAuth,
15
+ name: 'archive_subscriber',
16
+ displayName: 'Archive Subscriber',
17
+ description: 'Archive an existing audience member',
18
+ audience: 'both',
19
+ aiMetadata: { description: 'Archives a member from an audience (list); the identifier accepts an MD5 hash of the lowercase email, the raw email (auto-hashed), or a contact_id. Use to remove a contact from active sending while preserving their record. Idempotent: archiving an already-archived or absent member converges to the same state.', idempotent: true },
20
+ props: {
21
+ list_id: common_1.mailchimpCommon.mailChimpListIdDropdown,
22
+ subscriber_hash: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Subscriber Hash or Email',
24
+ description: 'MD5 hash of the lowercase email address, email address, or contact_id',
25
+ required: true,
26
+ }),
27
+ },
28
+ run(context) {
29
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
30
+ const accessToken = (0, pieces_common_1.getAccessTokenOrThrow)(context.auth);
31
+ const server = yield common_1.mailchimpCommon.getMailChimpServerPrefix(accessToken);
32
+ const client = mailchimp_marketing_1.default;
33
+ client.setConfig({
34
+ accessToken: accessToken,
35
+ server: server,
36
+ });
37
+ try {
38
+ let subscriberHash = context.propsValue.subscriber_hash;
39
+ // If it looks like an email, convert to MD5 hash
40
+ if (subscriberHash.includes('@')) {
41
+ subscriberHash = crypto_1.default.createHash('md5').update(subscriberHash.toLowerCase()).digest('hex');
42
+ }
43
+ yield client.lists.deleteListMember(context.propsValue.list_id, subscriberHash);
44
+ return {
45
+ success: true,
46
+ message: 'Subscriber archived successfully',
47
+ list_id: context.propsValue.list_id,
48
+ subscriber_hash: subscriberHash,
49
+ archived_at: new Date().toISOString(),
50
+ };
51
+ }
52
+ catch (error) {
53
+ if (error.status === 404) {
54
+ return {
55
+ success: false,
56
+ error: 'Subscriber not found',
57
+ message: 'The subscriber could not be found in the specified list.',
58
+ detail: error.detail || 'The requested resource could not be found',
59
+ };
60
+ }
61
+ throw new Error(`Failed to archive subscriber: ${error.message || JSON.stringify(error)}`);
62
+ }
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=archive-subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archive-subscriber.js","sourceRoot":"","sources":["../../../src/lib/actions/archive-subscriber.ts"],"names":[],"mappings":";;;;AAAA,8GAA8G;AAC9G,qEAAqE;AACrE,gEAAmE;AACnE,0DAA+D;AAC/D,sCAA4C;AAC5C,6BAAsC;AACtC,iGAAuD;AAEvD,4DAA4B;AAEf,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,iBAAa;IACnB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,qCAAqC;IAClD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,wTAAwT,EAAE,UAAU,EAAE,IAAI,EAAE;IACvW,KAAK,EAAE;QACL,OAAO,EAAE,wBAAe,CAAC,uBAAuB;QAChD,eAAe,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAClC,WAAW,EAAE,0BAA0B;YACvC,WAAW,EAAE,uEAAuE;YACpF,QAAQ,EAAE,IAAI;SACf,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,C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ieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
2
+ name: import("@agnocon/pieces-framework").ShortTextProperty<true>;
3
+ company: import("@agnocon/pieces-framework").ShortTextProperty<true>;
4
+ address1: import("@agnocon/pieces-framework").ShortTextProperty<true>;
5
+ address2: import("@agnocon/pieces-framework").ShortTextProperty<false>;
6
+ city: import("@agnocon/pieces-framework").ShortTextProperty<true>;
7
+ state: import("@agnocon/pieces-framework").ShortTextProperty<false>;
8
+ zip: import("@agnocon/pieces-framework").ShortTextProperty<false>;
9
+ country: import("@agnocon/pieces-framework").ShortTextProperty<true>;
10
+ phone: import("@agnocon/pieces-framework").ShortTextProperty<false>;
11
+ permission_reminder: import("@agnocon/pieces-framework").LongTextProperty<true>;
12
+ from_name: import("@agnocon/pieces-framework").ShortTextProperty<true>;
13
+ from_email: import("@agnocon/pieces-framework").ShortTextProperty<true>;
14
+ subject: import("@agnocon/pieces-framework").ShortTextProperty<true>;
15
+ language: import("@agnocon/pieces-framework").ShortTextProperty<true>;
16
+ email_type_option: import("@agnocon/pieces-framework").CheckboxProperty<false>;
17
+ use_archive_bar: import("@agnocon/pieces-framework").CheckboxProperty<false>;
18
+ notify_on_subscribe: import("@agnocon/pieces-framework").ShortTextProperty<false>;
19
+ notify_on_unsubscribe: import("@agnocon/pieces-framework").ShortTextProperty<false>;
20
+ double_optin: import("@agnocon/pieces-framework").CheckboxProperty<false>;
21
+ marketing_permissions: import("@agnocon/pieces-framework").CheckboxProperty<false>;
22
+ }>;
23
+ //# sourceMappingURL=create-audience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-audience.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/create-audience.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;EAwLzB,CAAC"}