@marketing-sdk/mailchimp 0.1.1-experimental.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/client.d.ts +67 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +356 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +520 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/validators.d.ts +7 -0
- package/dist/validators.d.ts.map +1 -0
- package/dist/validators.js +21 -0
- package/dist/validators.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Cody
|
|
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.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CreateResponse, ISubscriberProvider, BaseProvider } from '@marketing-sdk/core';
|
|
2
|
+
import { Mailchimp } from './types';
|
|
3
|
+
export declare class MailchimpClient extends BaseProvider implements ISubscriberProvider<Mailchimp.SubscriberPayload> {
|
|
4
|
+
private serverPrefix;
|
|
5
|
+
private apiKey;
|
|
6
|
+
private audienceId;
|
|
7
|
+
constructor(config: {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
serverPrefix: string;
|
|
10
|
+
audienceId: string;
|
|
11
|
+
});
|
|
12
|
+
protected getDefaultHeaders(): Record<string, string>;
|
|
13
|
+
protected getAuthHeaders(): Record<string, string>;
|
|
14
|
+
private getSubscriberHash;
|
|
15
|
+
addSubscriber(subscriber: Mailchimp.SubscriberPayload, audienceId?: string): Promise<CreateResponse<Mailchimp.SubscriberResponse>>;
|
|
16
|
+
getAudienceMember(email: string, audienceId?: string): Promise<CreateResponse<Mailchimp.AudienceMemberResponse>>;
|
|
17
|
+
updateSubscriber(email: string, subscriber: Partial<Mailchimp.SubscriberPayload>, audienceId?: string): Promise<CreateResponse<Mailchimp.SubscriberResponse>>;
|
|
18
|
+
deleteSubscriber(email: string, audienceId?: string): Promise<CreateResponse<void>>;
|
|
19
|
+
getAudienceMembers(audienceId?: string, params?: {
|
|
20
|
+
count?: number;
|
|
21
|
+
offset?: number;
|
|
22
|
+
status?: string;
|
|
23
|
+
since_last_changed?: string;
|
|
24
|
+
}): Promise<CreateResponse<Mailchimp.AudienceMembersResponse>>;
|
|
25
|
+
getCampaigns(params?: {
|
|
26
|
+
count?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
}): Promise<CreateResponse<Mailchimp.CampaignsResponse>>;
|
|
29
|
+
createCampaign(campaign: Mailchimp.CampaignPayload): Promise<CreateResponse<Mailchimp.CampaignResponse>>;
|
|
30
|
+
getCampaign(campaignId: string): Promise<CreateResponse<Mailchimp.CampaignResponse>>;
|
|
31
|
+
updateCampaign(campaignId: string, campaign: Partial<Mailchimp.CampaignPayload>): Promise<CreateResponse<Mailchimp.CampaignResponse>>;
|
|
32
|
+
deleteCampaign(campaignId: string): Promise<CreateResponse<void>>;
|
|
33
|
+
sendCampaign(campaignId: string): Promise<CreateResponse<void>>;
|
|
34
|
+
getLists(params?: {
|
|
35
|
+
count?: number;
|
|
36
|
+
offset?: number;
|
|
37
|
+
}): Promise<CreateResponse<Mailchimp.ListsResponse>>;
|
|
38
|
+
createList(list: Mailchimp.ListPayload): Promise<CreateResponse<Mailchimp.ListResponse>>;
|
|
39
|
+
getList(listId: string): Promise<CreateResponse<Mailchimp.ListResponse>>;
|
|
40
|
+
updateList(listId: string, list: Partial<Mailchimp.ListPayload>): Promise<CreateResponse<Mailchimp.ListResponse>>;
|
|
41
|
+
deleteList(listId: string): Promise<CreateResponse<void>>;
|
|
42
|
+
getSegments(listId?: string, params?: {
|
|
43
|
+
count?: number;
|
|
44
|
+
offset?: number;
|
|
45
|
+
}): Promise<CreateResponse<Mailchimp.SegmentsResponse>>;
|
|
46
|
+
createSegment(segment: Mailchimp.SegmentPayload, listId?: string): Promise<CreateResponse<Mailchimp.SegmentResponse>>;
|
|
47
|
+
getSegment(segmentId: string, listId?: string): Promise<CreateResponse<Mailchimp.SegmentResponse>>;
|
|
48
|
+
updateSegment(segmentId: string, segment: Partial<Mailchimp.SegmentPayload>, listId?: string): Promise<CreateResponse<Mailchimp.SegmentResponse>>;
|
|
49
|
+
deleteSegment(segmentId: string, listId?: string): Promise<CreateResponse<void>>;
|
|
50
|
+
getTemplates(params?: {
|
|
51
|
+
count?: number;
|
|
52
|
+
offset?: number;
|
|
53
|
+
}): Promise<CreateResponse<Mailchimp.TemplatesResponse>>;
|
|
54
|
+
getCampaignReport(campaignId: string): Promise<CreateResponse<any>>;
|
|
55
|
+
getAutomations(): Promise<CreateResponse<Mailchimp.AutomationsResponse>>;
|
|
56
|
+
startAutomation(workflowId: string, emailId: string): Promise<CreateResponse<void>>;
|
|
57
|
+
pauseAutomation(workflowId: string, emailId: string): Promise<CreateResponse<void>>;
|
|
58
|
+
addStore(store: Mailchimp.StorePayload): Promise<CreateResponse<Mailchimp.StoreResponse>>;
|
|
59
|
+
getStore(storeId: string): Promise<CreateResponse<Mailchimp.StoreResponse>>;
|
|
60
|
+
updateStore(storeId: string, store: Partial<Mailchimp.StorePayload>): Promise<CreateResponse<Mailchimp.StoreResponse>>;
|
|
61
|
+
deleteStore(storeId: string): Promise<CreateResponse<void>>;
|
|
62
|
+
addOrder(storeId: string, order: Mailchimp.OrderPayload): Promise<CreateResponse<Mailchimp.OrderResponse>>;
|
|
63
|
+
getOrder(storeId: string, orderId: string): Promise<CreateResponse<Mailchimp.OrderResponse>>;
|
|
64
|
+
updateOrder(storeId: string, orderId: string, order: Partial<Mailchimp.OrderPayload>): Promise<CreateResponse<Mailchimp.OrderResponse>>;
|
|
65
|
+
deleteOrder(storeId: string, orderId: string): Promise<CreateResponse<void>>;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,qBAAa,eACX,SAAQ,YACR,YAAW,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,CAAC;IAE3D,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE;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AC1B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAUnB,QAAQ,CACnB,KAAK,EAAE,SAAS,CAAC,YAAY,GAC5B,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAQtC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAS3E,WAAW,CACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,GACrC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAUtC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAS3D,QAAQ,CACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,CAAC,YAAY,GAC5B,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAUtC,QAAQ,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAUtC,WAAW,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,GACrC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAWtC,WAAW,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;CASjC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MailchimpClient = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const core_1 = require("@marketing-sdk/core");
|
|
9
|
+
const validators_1 = require("./validators");
|
|
10
|
+
class MailchimpClient extends core_1.BaseProvider {
|
|
11
|
+
constructor(config) {
|
|
12
|
+
super({
|
|
13
|
+
baseURL: `https://${config.serverPrefix}.api.mailchimp.com/3.0`,
|
|
14
|
+
timeout: 30000,
|
|
15
|
+
});
|
|
16
|
+
this.apiKey = config.apiKey;
|
|
17
|
+
this.serverPrefix = config.serverPrefix;
|
|
18
|
+
this.audienceId = config.audienceId;
|
|
19
|
+
}
|
|
20
|
+
getDefaultHeaders() {
|
|
21
|
+
return {
|
|
22
|
+
"Content-Type": "application/json",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
getAuthHeaders() {
|
|
26
|
+
return {
|
|
27
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
getSubscriberHash(email) {
|
|
31
|
+
return crypto_1.default.createHash("md5").update(email.toLowerCase()).digest("hex");
|
|
32
|
+
}
|
|
33
|
+
async addSubscriber(subscriber, audienceId) {
|
|
34
|
+
validators_1.MailchimpValidators.validateSubscriberPayload(subscriber);
|
|
35
|
+
const listId = audienceId || this.audienceId;
|
|
36
|
+
const subscriberHash = this.getSubscriberHash(subscriber.email);
|
|
37
|
+
const body = {
|
|
38
|
+
email_address: subscriber.email,
|
|
39
|
+
status_if_new: subscriber.status || "subscribed",
|
|
40
|
+
status: subscriber.status || "subscribed",
|
|
41
|
+
};
|
|
42
|
+
const merge_fields = {};
|
|
43
|
+
if (subscriber.firstName)
|
|
44
|
+
merge_fields.FNAME = subscriber.firstName;
|
|
45
|
+
if (subscriber.lastName)
|
|
46
|
+
merge_fields.LNAME = subscriber.lastName;
|
|
47
|
+
if (Object.keys(merge_fields).length > 0) {
|
|
48
|
+
body.merge_fields = merge_fields;
|
|
49
|
+
}
|
|
50
|
+
if (subscriber.tags && subscriber.tags.length > 0) {
|
|
51
|
+
body.tags = subscriber.tags;
|
|
52
|
+
}
|
|
53
|
+
return this.makeRequest({
|
|
54
|
+
url: `/lists/${listId}/members/${subscriberHash}`,
|
|
55
|
+
method: "PUT",
|
|
56
|
+
body,
|
|
57
|
+
}, "Add Subscriber");
|
|
58
|
+
}
|
|
59
|
+
async getAudienceMember(email, audienceId) {
|
|
60
|
+
const listId = audienceId || this.audienceId;
|
|
61
|
+
const subscriberHash = this.getSubscriberHash(email);
|
|
62
|
+
return this.makeRequest({
|
|
63
|
+
url: `/lists/${listId}/members/${subscriberHash}`,
|
|
64
|
+
method: "GET",
|
|
65
|
+
}, "Get Audience Member");
|
|
66
|
+
}
|
|
67
|
+
async updateSubscriber(email, subscriber, audienceId) {
|
|
68
|
+
const listId = audienceId || this.audienceId;
|
|
69
|
+
const subscriberHash = this.getSubscriberHash(email);
|
|
70
|
+
const body = {};
|
|
71
|
+
if (subscriber.status)
|
|
72
|
+
body.status = subscriber.status;
|
|
73
|
+
const merge_fields = {};
|
|
74
|
+
if (subscriber.firstName !== undefined)
|
|
75
|
+
merge_fields.FNAME = subscriber.firstName;
|
|
76
|
+
if (subscriber.lastName !== undefined)
|
|
77
|
+
merge_fields.LNAME = subscriber.lastName;
|
|
78
|
+
if (Object.keys(merge_fields).length > 0) {
|
|
79
|
+
body.merge_fields = merge_fields;
|
|
80
|
+
}
|
|
81
|
+
if (subscriber.tags !== undefined) {
|
|
82
|
+
body.tags = subscriber.tags;
|
|
83
|
+
}
|
|
84
|
+
return this.makeRequest({
|
|
85
|
+
url: `/lists/${listId}/members/${subscriberHash}`,
|
|
86
|
+
method: "PATCH",
|
|
87
|
+
body,
|
|
88
|
+
}, "Update Subscriber");
|
|
89
|
+
}
|
|
90
|
+
async deleteSubscriber(email, audienceId) {
|
|
91
|
+
const listId = audienceId || this.audienceId;
|
|
92
|
+
const subscriberHash = this.getSubscriberHash(email);
|
|
93
|
+
return this.makeRequest({
|
|
94
|
+
url: `/lists/${listId}/members/${subscriberHash}`,
|
|
95
|
+
method: "DELETE",
|
|
96
|
+
}, "Delete Subscriber");
|
|
97
|
+
}
|
|
98
|
+
async getAudienceMembers(audienceId, params) {
|
|
99
|
+
if (params) {
|
|
100
|
+
core_1.Validators.validatePaginationParams({
|
|
101
|
+
limit: params.count,
|
|
102
|
+
offset: params.offset
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const listId = audienceId || this.audienceId;
|
|
106
|
+
return this.makeRequest({
|
|
107
|
+
url: `/lists/${listId}/members`,
|
|
108
|
+
method: "GET",
|
|
109
|
+
params,
|
|
110
|
+
}, "Get Audience Members");
|
|
111
|
+
}
|
|
112
|
+
async getCampaigns(params) {
|
|
113
|
+
if (params) {
|
|
114
|
+
core_1.Validators.validatePaginationParams({
|
|
115
|
+
limit: params.count,
|
|
116
|
+
offset: params.offset
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return this.makeRequest({
|
|
120
|
+
url: "/campaigns",
|
|
121
|
+
method: "GET",
|
|
122
|
+
params,
|
|
123
|
+
}, "Get Campaigns");
|
|
124
|
+
}
|
|
125
|
+
async createCampaign(campaign) {
|
|
126
|
+
return this.makeRequest({
|
|
127
|
+
url: "/campaigns",
|
|
128
|
+
method: "POST",
|
|
129
|
+
body: campaign,
|
|
130
|
+
}, "Create Campaign");
|
|
131
|
+
}
|
|
132
|
+
async getCampaign(campaignId) {
|
|
133
|
+
core_1.Validators.validateId(campaignId, "campaignId");
|
|
134
|
+
return this.makeRequest({
|
|
135
|
+
url: `/campaigns/${campaignId}`,
|
|
136
|
+
method: "GET",
|
|
137
|
+
}, "Get Campaign");
|
|
138
|
+
}
|
|
139
|
+
async updateCampaign(campaignId, campaign) {
|
|
140
|
+
core_1.Validators.validateId(campaignId, "campaignId");
|
|
141
|
+
return this.makeRequest({
|
|
142
|
+
url: `/campaigns/${campaignId}`,
|
|
143
|
+
method: "PATCH",
|
|
144
|
+
body: campaign,
|
|
145
|
+
}, "Update Campaign");
|
|
146
|
+
}
|
|
147
|
+
async deleteCampaign(campaignId) {
|
|
148
|
+
core_1.Validators.validateId(campaignId, "campaignId");
|
|
149
|
+
return this.makeRequest({
|
|
150
|
+
url: `/campaigns/${campaignId}`,
|
|
151
|
+
method: "DELETE",
|
|
152
|
+
}, "Delete Campaign");
|
|
153
|
+
}
|
|
154
|
+
async sendCampaign(campaignId) {
|
|
155
|
+
core_1.Validators.validateId(campaignId, "campaignId");
|
|
156
|
+
return this.makeRequest({
|
|
157
|
+
url: `/campaigns/${campaignId}/actions/send`,
|
|
158
|
+
method: "POST",
|
|
159
|
+
}, "Send Campaign");
|
|
160
|
+
}
|
|
161
|
+
async getLists(params) {
|
|
162
|
+
if (params) {
|
|
163
|
+
core_1.Validators.validatePaginationParams({
|
|
164
|
+
limit: params.count,
|
|
165
|
+
offset: params.offset
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return this.makeRequest({
|
|
169
|
+
url: "/lists",
|
|
170
|
+
method: "GET",
|
|
171
|
+
params,
|
|
172
|
+
}, "Get Lists");
|
|
173
|
+
}
|
|
174
|
+
async createList(list) {
|
|
175
|
+
return this.makeRequest({
|
|
176
|
+
url: "/lists",
|
|
177
|
+
method: "POST",
|
|
178
|
+
body: list,
|
|
179
|
+
}, "Create List");
|
|
180
|
+
}
|
|
181
|
+
async getList(listId) {
|
|
182
|
+
core_1.Validators.validateId(listId, "listId");
|
|
183
|
+
return this.makeRequest({
|
|
184
|
+
url: `/lists/${listId}`,
|
|
185
|
+
method: "GET",
|
|
186
|
+
}, "Get List");
|
|
187
|
+
}
|
|
188
|
+
async updateList(listId, list) {
|
|
189
|
+
core_1.Validators.validateId(listId, "listId");
|
|
190
|
+
return this.makeRequest({
|
|
191
|
+
url: `/lists/${listId}`,
|
|
192
|
+
method: "PATCH",
|
|
193
|
+
body: list,
|
|
194
|
+
}, "Update List");
|
|
195
|
+
}
|
|
196
|
+
async deleteList(listId) {
|
|
197
|
+
core_1.Validators.validateId(listId, "listId");
|
|
198
|
+
return this.makeRequest({
|
|
199
|
+
url: `/lists/${listId}`,
|
|
200
|
+
method: "DELETE",
|
|
201
|
+
}, "Delete List");
|
|
202
|
+
}
|
|
203
|
+
async getSegments(listId, params) {
|
|
204
|
+
if (params) {
|
|
205
|
+
core_1.Validators.validatePaginationParams({
|
|
206
|
+
limit: params.count,
|
|
207
|
+
offset: params.offset
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const audienceId = listId || this.audienceId;
|
|
211
|
+
return this.makeRequest({
|
|
212
|
+
url: `/lists/${audienceId}/segments`,
|
|
213
|
+
method: "GET",
|
|
214
|
+
params,
|
|
215
|
+
}, "Get Segments");
|
|
216
|
+
}
|
|
217
|
+
async createSegment(segment, listId) {
|
|
218
|
+
const audienceId = listId || this.audienceId;
|
|
219
|
+
return this.makeRequest({
|
|
220
|
+
url: `/lists/${audienceId}/segments`,
|
|
221
|
+
method: "POST",
|
|
222
|
+
body: segment,
|
|
223
|
+
}, "Create Segment");
|
|
224
|
+
}
|
|
225
|
+
async getSegment(segmentId, listId) {
|
|
226
|
+
core_1.Validators.validateId(segmentId, "segmentId");
|
|
227
|
+
const audienceId = listId || this.audienceId;
|
|
228
|
+
return this.makeRequest({
|
|
229
|
+
url: `/lists/${audienceId}/segments/${segmentId}`,
|
|
230
|
+
method: "GET",
|
|
231
|
+
}, "Get Segment");
|
|
232
|
+
}
|
|
233
|
+
async updateSegment(segmentId, segment, listId) {
|
|
234
|
+
core_1.Validators.validateId(segmentId, "segmentId");
|
|
235
|
+
const audienceId = listId || this.audienceId;
|
|
236
|
+
return this.makeRequest({
|
|
237
|
+
url: `/lists/${audienceId}/segments/${segmentId}`,
|
|
238
|
+
method: "PATCH",
|
|
239
|
+
body: segment,
|
|
240
|
+
}, "Update Segment");
|
|
241
|
+
}
|
|
242
|
+
async deleteSegment(segmentId, listId) {
|
|
243
|
+
core_1.Validators.validateId(segmentId, "segmentId");
|
|
244
|
+
const audienceId = listId || this.audienceId;
|
|
245
|
+
return this.makeRequest({
|
|
246
|
+
url: `/lists/${audienceId}/segments/${segmentId}`,
|
|
247
|
+
method: "DELETE",
|
|
248
|
+
}, "Delete Segment");
|
|
249
|
+
}
|
|
250
|
+
async getTemplates(params) {
|
|
251
|
+
if (params) {
|
|
252
|
+
core_1.Validators.validatePaginationParams({
|
|
253
|
+
limit: params.count,
|
|
254
|
+
offset: params.offset
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return this.makeRequest({
|
|
258
|
+
url: "/templates",
|
|
259
|
+
method: "GET",
|
|
260
|
+
params,
|
|
261
|
+
}, "Get Templates");
|
|
262
|
+
}
|
|
263
|
+
async getCampaignReport(campaignId) {
|
|
264
|
+
core_1.Validators.validateId(campaignId, "campaignId");
|
|
265
|
+
return this.makeRequest({
|
|
266
|
+
url: `/reports/${campaignId}`,
|
|
267
|
+
method: "GET",
|
|
268
|
+
}, "Get Campaign Report");
|
|
269
|
+
}
|
|
270
|
+
async getAutomations() {
|
|
271
|
+
return this.makeRequest({
|
|
272
|
+
url: "/automations",
|
|
273
|
+
method: "GET",
|
|
274
|
+
}, "Get Automations");
|
|
275
|
+
}
|
|
276
|
+
async startAutomation(workflowId, emailId) {
|
|
277
|
+
core_1.Validators.validateId(workflowId, "workflowId");
|
|
278
|
+
core_1.Validators.validateId(emailId, "emailId");
|
|
279
|
+
return this.makeRequest({
|
|
280
|
+
url: `/automations/${workflowId}/emails/${emailId}/actions/start`,
|
|
281
|
+
method: "POST",
|
|
282
|
+
}, "Start Automation");
|
|
283
|
+
}
|
|
284
|
+
async pauseAutomation(workflowId, emailId) {
|
|
285
|
+
core_1.Validators.validateId(workflowId, "workflowId");
|
|
286
|
+
core_1.Validators.validateId(emailId, "emailId");
|
|
287
|
+
return this.makeRequest({
|
|
288
|
+
url: `/automations/${workflowId}/emails/${emailId}/actions/pause`,
|
|
289
|
+
method: "POST",
|
|
290
|
+
}, "Pause Automation");
|
|
291
|
+
}
|
|
292
|
+
async addStore(store) {
|
|
293
|
+
return this.makeRequest({
|
|
294
|
+
url: "/ecommerce/stores",
|
|
295
|
+
method: "POST",
|
|
296
|
+
body: store,
|
|
297
|
+
}, "Add Store");
|
|
298
|
+
}
|
|
299
|
+
async getStore(storeId) {
|
|
300
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
301
|
+
return this.makeRequest({
|
|
302
|
+
url: `/ecommerce/stores/${storeId}`,
|
|
303
|
+
method: "GET",
|
|
304
|
+
}, "Get Store");
|
|
305
|
+
}
|
|
306
|
+
async updateStore(storeId, store) {
|
|
307
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
308
|
+
return this.makeRequest({
|
|
309
|
+
url: `/ecommerce/stores/${storeId}`,
|
|
310
|
+
method: "PATCH",
|
|
311
|
+
body: store,
|
|
312
|
+
}, "Update Store");
|
|
313
|
+
}
|
|
314
|
+
async deleteStore(storeId) {
|
|
315
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
316
|
+
return this.makeRequest({
|
|
317
|
+
url: `/ecommerce/stores/${storeId}`,
|
|
318
|
+
method: "DELETE",
|
|
319
|
+
}, "Delete Store");
|
|
320
|
+
}
|
|
321
|
+
async addOrder(storeId, order) {
|
|
322
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
323
|
+
return this.makeRequest({
|
|
324
|
+
url: `/ecommerce/stores/${storeId}/orders`,
|
|
325
|
+
method: "POST",
|
|
326
|
+
body: order,
|
|
327
|
+
}, "Add Order");
|
|
328
|
+
}
|
|
329
|
+
async getOrder(storeId, orderId) {
|
|
330
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
331
|
+
core_1.Validators.validateId(orderId, "orderId");
|
|
332
|
+
return this.makeRequest({
|
|
333
|
+
url: `/ecommerce/stores/${storeId}/orders/${orderId}`,
|
|
334
|
+
method: "GET",
|
|
335
|
+
}, "Get Order");
|
|
336
|
+
}
|
|
337
|
+
async updateOrder(storeId, orderId, order) {
|
|
338
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
339
|
+
core_1.Validators.validateId(orderId, "orderId");
|
|
340
|
+
return this.makeRequest({
|
|
341
|
+
url: `/ecommerce/stores/${storeId}/orders/${orderId}`,
|
|
342
|
+
method: "PATCH",
|
|
343
|
+
body: order,
|
|
344
|
+
}, "Update Order");
|
|
345
|
+
}
|
|
346
|
+
async deleteOrder(storeId, orderId) {
|
|
347
|
+
core_1.Validators.validateId(storeId, "storeId");
|
|
348
|
+
core_1.Validators.validateId(orderId, "orderId");
|
|
349
|
+
return this.makeRequest({
|
|
350
|
+
url: `/ecommerce/stores/${storeId}/orders/${orderId}`,
|
|
351
|
+
method: "DELETE",
|
|
352
|
+
}, "Delete Order");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
exports.MailchimpClient = MailchimpClient;
|
|
356
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,8CAAoG;AAEpG,6CAAmD;AAEnD,MAAa,eACX,SAAQ,mBAAY;IAOpB,YAAY,MAIX;QACC,KAAK,CAAC;YACJ,OAAO,EAAE,WAAW,MAAM,CAAC,YAAY,wBAAwB;YAC/D,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACtC,CAAC;IAES,iBAAiB;QACzB,OAAO;YACL,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAES,cAAc;QACtB,OAAO;YACL,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;SACv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MAAM,EAAE,OAAO;YACf,IAAI,EAAE,KAAK;SACZ,EAAE,cAAc,CAAC,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,WAAW,CACtB,OAAe,EACf,OAAe;QAEf,iBAAU,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1C,iBAAU,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC,WAAW,CAAC;YACtB,GAAG,EAAE,qBAAqB,OAAO,WAAW,OAAO,EAAE;YACrD,MAAM,EAAE,QAAQ;SACjB,EAAE,cAAc,CAAC,CAAC;IACrB,CAAC;CACF;AA/fD,0CA+fC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationError = exports.MailchimpValidators = exports.MailchimpClient = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "MailchimpClient", { enumerable: true, get: function () { return client_1.MailchimpClient; } });
|
|
6
|
+
var validators_1 = require("./validators");
|
|
7
|
+
Object.defineProperty(exports, "MailchimpValidators", { enumerable: true, get: function () { return validators_1.MailchimpValidators; } });
|
|
8
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validators_1.ValidationError; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AAExB,2CAAoE;AAA3D,iHAAA,mBAAmB,OAAA;AAAE,6GAAA,eAAe,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
export declare namespace Mailchimp {
|
|
2
|
+
type SubscriberPayload = {
|
|
3
|
+
email: string;
|
|
4
|
+
firstName?: string;
|
|
5
|
+
lastName?: string;
|
|
6
|
+
tags?: string[];
|
|
7
|
+
status?: "subscribed" | "unsubscribed" | "cleaned" | "pending";
|
|
8
|
+
};
|
|
9
|
+
type CampaignPayload = {
|
|
10
|
+
type: "regular" | "plaintext" | "absplit" | "rss" | "variate";
|
|
11
|
+
recipients: {
|
|
12
|
+
list_id: string;
|
|
13
|
+
segment_opts?: any;
|
|
14
|
+
};
|
|
15
|
+
settings: {
|
|
16
|
+
subject_line: string;
|
|
17
|
+
title: string;
|
|
18
|
+
from_name: string;
|
|
19
|
+
reply_to: string;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
content?: any;
|
|
23
|
+
};
|
|
24
|
+
type ListPayload = {
|
|
25
|
+
name: string;
|
|
26
|
+
contact: {
|
|
27
|
+
company: string;
|
|
28
|
+
address1: string;
|
|
29
|
+
city: string;
|
|
30
|
+
state: string;
|
|
31
|
+
zip: string;
|
|
32
|
+
country: string;
|
|
33
|
+
};
|
|
34
|
+
permission_reminder: string;
|
|
35
|
+
campaign_defaults: {
|
|
36
|
+
from_name: string;
|
|
37
|
+
from_email: string;
|
|
38
|
+
subject: string;
|
|
39
|
+
language: string;
|
|
40
|
+
};
|
|
41
|
+
email_type_option: boolean;
|
|
42
|
+
};
|
|
43
|
+
type SegmentPayload = {
|
|
44
|
+
name: string;
|
|
45
|
+
static_segment: string[];
|
|
46
|
+
};
|
|
47
|
+
type StorePayload = {
|
|
48
|
+
id: string;
|
|
49
|
+
list_id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
platform: string;
|
|
52
|
+
domain: string;
|
|
53
|
+
};
|
|
54
|
+
type OrderPayload = {
|
|
55
|
+
id: string;
|
|
56
|
+
customer: {
|
|
57
|
+
id: string;
|
|
58
|
+
email_address: string;
|
|
59
|
+
first_name?: string;
|
|
60
|
+
last_name?: string;
|
|
61
|
+
};
|
|
62
|
+
currency_code: string;
|
|
63
|
+
order_total: number;
|
|
64
|
+
lines: Array<{
|
|
65
|
+
id: string;
|
|
66
|
+
product_id: string;
|
|
67
|
+
product_title: string;
|
|
68
|
+
product_variant_id: string;
|
|
69
|
+
quantity: number;
|
|
70
|
+
price: number;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
type SubscriberResponse = {
|
|
74
|
+
id: string;
|
|
75
|
+
email_address: string;
|
|
76
|
+
unique_email_id: string;
|
|
77
|
+
email_type: string;
|
|
78
|
+
status: string;
|
|
79
|
+
merge_fields: {
|
|
80
|
+
FNAME?: string;
|
|
81
|
+
LNAME?: string;
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
};
|
|
84
|
+
stats: {
|
|
85
|
+
avg_open_rate: number;
|
|
86
|
+
avg_click_rate: number;
|
|
87
|
+
};
|
|
88
|
+
ip_signup: string;
|
|
89
|
+
timestamp_signup: string;
|
|
90
|
+
ip_opt: string;
|
|
91
|
+
timestamp_opt: string;
|
|
92
|
+
member_rating: number;
|
|
93
|
+
last_changed: string;
|
|
94
|
+
language: string;
|
|
95
|
+
vip: boolean;
|
|
96
|
+
email_client: string;
|
|
97
|
+
location: {
|
|
98
|
+
latitude: number;
|
|
99
|
+
longitude: number;
|
|
100
|
+
gmtoff: number;
|
|
101
|
+
dstoff: number;
|
|
102
|
+
country_code: string;
|
|
103
|
+
timezone: string;
|
|
104
|
+
};
|
|
105
|
+
tags_count: number;
|
|
106
|
+
tags: Array<{
|
|
107
|
+
id: number;
|
|
108
|
+
name: string;
|
|
109
|
+
}>;
|
|
110
|
+
list_id: string;
|
|
111
|
+
};
|
|
112
|
+
type CampaignResponse = {
|
|
113
|
+
id: string;
|
|
114
|
+
web_id: number;
|
|
115
|
+
type: string;
|
|
116
|
+
create_time: string;
|
|
117
|
+
archive_url: string;
|
|
118
|
+
long_archive_url: string;
|
|
119
|
+
status: string;
|
|
120
|
+
emails_sent: number;
|
|
121
|
+
send_time: string;
|
|
122
|
+
content_type: string;
|
|
123
|
+
needs_block_refresh: boolean;
|
|
124
|
+
resendable: boolean;
|
|
125
|
+
recipients: {
|
|
126
|
+
list_id: string;
|
|
127
|
+
list_name: string;
|
|
128
|
+
segment_text: string;
|
|
129
|
+
recipient_count: number;
|
|
130
|
+
};
|
|
131
|
+
settings: {
|
|
132
|
+
subject_line: string;
|
|
133
|
+
title: string;
|
|
134
|
+
from_name: string;
|
|
135
|
+
reply_to: string;
|
|
136
|
+
use_conversation: boolean;
|
|
137
|
+
to_name: string;
|
|
138
|
+
folder_id: string;
|
|
139
|
+
authenticate: boolean;
|
|
140
|
+
auto_footer: boolean;
|
|
141
|
+
inline_css: boolean;
|
|
142
|
+
auto_tweet: boolean;
|
|
143
|
+
fb_comments: boolean;
|
|
144
|
+
timewarp: boolean;
|
|
145
|
+
template_id: number;
|
|
146
|
+
drag_and_drop: boolean;
|
|
147
|
+
};
|
|
148
|
+
tracking: {
|
|
149
|
+
opens: boolean;
|
|
150
|
+
html_clicks: boolean;
|
|
151
|
+
text_clicks: boolean;
|
|
152
|
+
goal_tracking: boolean;
|
|
153
|
+
ecomm360: boolean;
|
|
154
|
+
google_analytics: string;
|
|
155
|
+
clicktale: string;
|
|
156
|
+
};
|
|
157
|
+
report_summary: {
|
|
158
|
+
opens: number;
|
|
159
|
+
unique_opens: number;
|
|
160
|
+
open_rate: number;
|
|
161
|
+
clicks: number;
|
|
162
|
+
subscriber_clicks: number;
|
|
163
|
+
click_rate: number;
|
|
164
|
+
ecommerce: {
|
|
165
|
+
total_orders: number;
|
|
166
|
+
total_spent: number;
|
|
167
|
+
total_revenue: number;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
_links: Array<{
|
|
171
|
+
rel: string;
|
|
172
|
+
href: string;
|
|
173
|
+
method: string;
|
|
174
|
+
targetSchema: string;
|
|
175
|
+
schema: string;
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
type CampaignsResponse = {
|
|
179
|
+
campaigns: CampaignResponse[];
|
|
180
|
+
total_items: number;
|
|
181
|
+
_links: Array<{
|
|
182
|
+
rel: string;
|
|
183
|
+
href: string;
|
|
184
|
+
method: string;
|
|
185
|
+
targetSchema: string;
|
|
186
|
+
schema: string;
|
|
187
|
+
}>;
|
|
188
|
+
};
|
|
189
|
+
type ListResponse = {
|
|
190
|
+
id: string;
|
|
191
|
+
web_id: number;
|
|
192
|
+
name: string;
|
|
193
|
+
contact: {
|
|
194
|
+
company: string;
|
|
195
|
+
address1: string;
|
|
196
|
+
address2: string;
|
|
197
|
+
city: string;
|
|
198
|
+
state: string;
|
|
199
|
+
zip: string;
|
|
200
|
+
country: string;
|
|
201
|
+
phone: string;
|
|
202
|
+
};
|
|
203
|
+
permission_reminder: string;
|
|
204
|
+
use_archive_bar: boolean;
|
|
205
|
+
campaign_defaults: {
|
|
206
|
+
from_name: string;
|
|
207
|
+
from_email: string;
|
|
208
|
+
subject: string;
|
|
209
|
+
language: string;
|
|
210
|
+
};
|
|
211
|
+
notify_on_subscribe: string;
|
|
212
|
+
notify_on_unsubscribe: string;
|
|
213
|
+
date_created: string;
|
|
214
|
+
list_rating: number;
|
|
215
|
+
email_type_option: boolean;
|
|
216
|
+
subscribe_url_short: string;
|
|
217
|
+
subscribe_url_long: string;
|
|
218
|
+
beamer_address: string;
|
|
219
|
+
visibility: string;
|
|
220
|
+
modules: string[];
|
|
221
|
+
stats: {
|
|
222
|
+
member_count: number;
|
|
223
|
+
unsubscribe_count: number;
|
|
224
|
+
cleaned_count: number;
|
|
225
|
+
member_count_since_send: number;
|
|
226
|
+
unsubscribe_count_since_send: number;
|
|
227
|
+
cleaned_count_since_send: number;
|
|
228
|
+
campaign_count: number;
|
|
229
|
+
campaign_last_sent: string;
|
|
230
|
+
merge_field_count: number;
|
|
231
|
+
avg_sub_rate: number;
|
|
232
|
+
avg_unsub_rate: number;
|
|
233
|
+
target_sub_rate: number;
|
|
234
|
+
open_rate: number;
|
|
235
|
+
click_rate: number;
|
|
236
|
+
last_sub_date: string;
|
|
237
|
+
last_unsub_date: string;
|
|
238
|
+
};
|
|
239
|
+
_links: Array<{
|
|
240
|
+
rel: string;
|
|
241
|
+
href: string;
|
|
242
|
+
method: string;
|
|
243
|
+
targetSchema: string;
|
|
244
|
+
schema: string;
|
|
245
|
+
}>;
|
|
246
|
+
};
|
|
247
|
+
type ListsResponse = {
|
|
248
|
+
lists: ListResponse[];
|
|
249
|
+
total_items: number;
|
|
250
|
+
_links: Array<{
|
|
251
|
+
rel: string;
|
|
252
|
+
href: string;
|
|
253
|
+
method: string;
|
|
254
|
+
targetSchema: string;
|
|
255
|
+
schema: string;
|
|
256
|
+
}>;
|
|
257
|
+
};
|
|
258
|
+
type SegmentResponse = {
|
|
259
|
+
id: number;
|
|
260
|
+
name: string;
|
|
261
|
+
member_count: number;
|
|
262
|
+
type: string;
|
|
263
|
+
created_at: string;
|
|
264
|
+
updated_at: string;
|
|
265
|
+
options: {
|
|
266
|
+
match: string;
|
|
267
|
+
conditions: Array<{
|
|
268
|
+
field: string;
|
|
269
|
+
operator: string;
|
|
270
|
+
value: string;
|
|
271
|
+
}>;
|
|
272
|
+
};
|
|
273
|
+
list_id: string;
|
|
274
|
+
_links: Array<{
|
|
275
|
+
rel: string;
|
|
276
|
+
href: string;
|
|
277
|
+
method: string;
|
|
278
|
+
targetSchema: string;
|
|
279
|
+
schema: string;
|
|
280
|
+
}>;
|
|
281
|
+
};
|
|
282
|
+
type SegmentsResponse = {
|
|
283
|
+
segments: SegmentResponse[];
|
|
284
|
+
total_items: number;
|
|
285
|
+
_links: Array<{
|
|
286
|
+
rel: string;
|
|
287
|
+
href: string;
|
|
288
|
+
method: string;
|
|
289
|
+
targetSchema: string;
|
|
290
|
+
schema: string;
|
|
291
|
+
}>;
|
|
292
|
+
};
|
|
293
|
+
type TemplateResponse = {
|
|
294
|
+
id: number;
|
|
295
|
+
type: string;
|
|
296
|
+
name: string;
|
|
297
|
+
drag_and_drop: boolean;
|
|
298
|
+
responsive: boolean;
|
|
299
|
+
category: string;
|
|
300
|
+
date_created: string;
|
|
301
|
+
created_by: string;
|
|
302
|
+
active: boolean;
|
|
303
|
+
folder_id: string;
|
|
304
|
+
thumbnail: string;
|
|
305
|
+
share_url: string;
|
|
306
|
+
_links: Array<{
|
|
307
|
+
rel: string;
|
|
308
|
+
href: string;
|
|
309
|
+
method: string;
|
|
310
|
+
targetSchema: string;
|
|
311
|
+
schema: string;
|
|
312
|
+
}>;
|
|
313
|
+
};
|
|
314
|
+
type TemplatesResponse = {
|
|
315
|
+
templates: TemplateResponse[];
|
|
316
|
+
total_items: number;
|
|
317
|
+
_links: Array<{
|
|
318
|
+
rel: string;
|
|
319
|
+
href: string;
|
|
320
|
+
method: string;
|
|
321
|
+
targetSchema: string;
|
|
322
|
+
schema: string;
|
|
323
|
+
}>;
|
|
324
|
+
};
|
|
325
|
+
type AutomationResponse = {
|
|
326
|
+
id: string;
|
|
327
|
+
create_time: string;
|
|
328
|
+
start_time: string;
|
|
329
|
+
status: string;
|
|
330
|
+
emails_sent: number;
|
|
331
|
+
recipients: {
|
|
332
|
+
list_id: string;
|
|
333
|
+
list_name: string;
|
|
334
|
+
segment_opts: {
|
|
335
|
+
saved_segment_id: number;
|
|
336
|
+
match: string;
|
|
337
|
+
conditions: Array<{
|
|
338
|
+
field: string;
|
|
339
|
+
operator: string;
|
|
340
|
+
value: string;
|
|
341
|
+
}>;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
settings: {
|
|
345
|
+
title: string;
|
|
346
|
+
from_name: string;
|
|
347
|
+
reply_to: string;
|
|
348
|
+
use_conversation: boolean;
|
|
349
|
+
to_name: string;
|
|
350
|
+
authenticate: boolean;
|
|
351
|
+
auto_footer: boolean;
|
|
352
|
+
inline_css: boolean;
|
|
353
|
+
};
|
|
354
|
+
tracking: {
|
|
355
|
+
opens: boolean;
|
|
356
|
+
html_clicks: boolean;
|
|
357
|
+
text_clicks: boolean;
|
|
358
|
+
goal_tracking: boolean;
|
|
359
|
+
ecomm360: boolean;
|
|
360
|
+
google_analytics: string;
|
|
361
|
+
clicktale: string;
|
|
362
|
+
};
|
|
363
|
+
report_summary: {
|
|
364
|
+
opens: number;
|
|
365
|
+
unique_opens: number;
|
|
366
|
+
open_rate: number;
|
|
367
|
+
clicks: number;
|
|
368
|
+
subscriber_clicks: number;
|
|
369
|
+
click_rate: number;
|
|
370
|
+
ecommerce: {
|
|
371
|
+
total_orders: number;
|
|
372
|
+
total_spent: number;
|
|
373
|
+
total_revenue: number;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
_links: Array<{
|
|
377
|
+
rel: string;
|
|
378
|
+
href: string;
|
|
379
|
+
method: string;
|
|
380
|
+
targetSchema: string;
|
|
381
|
+
schema: string;
|
|
382
|
+
}>;
|
|
383
|
+
};
|
|
384
|
+
type AutomationsResponse = {
|
|
385
|
+
automations: AutomationResponse[];
|
|
386
|
+
total_items: number;
|
|
387
|
+
_links: Array<{
|
|
388
|
+
rel: string;
|
|
389
|
+
href: string;
|
|
390
|
+
method: string;
|
|
391
|
+
targetSchema: string;
|
|
392
|
+
schema: string;
|
|
393
|
+
}>;
|
|
394
|
+
};
|
|
395
|
+
type StoreResponse = {
|
|
396
|
+
id: string;
|
|
397
|
+
list_id: string;
|
|
398
|
+
name: string;
|
|
399
|
+
platform: string;
|
|
400
|
+
domain: string;
|
|
401
|
+
is_syncing: boolean;
|
|
402
|
+
email_address: string;
|
|
403
|
+
currency_code: string;
|
|
404
|
+
money_format: string;
|
|
405
|
+
primary_locale: string;
|
|
406
|
+
timezone: string;
|
|
407
|
+
phone: string;
|
|
408
|
+
address: {
|
|
409
|
+
company: string;
|
|
410
|
+
address1: string;
|
|
411
|
+
address2: string;
|
|
412
|
+
city: string;
|
|
413
|
+
province: string;
|
|
414
|
+
province_code: string;
|
|
415
|
+
postal_code: string;
|
|
416
|
+
country: string;
|
|
417
|
+
country_code: string;
|
|
418
|
+
};
|
|
419
|
+
_links: Array<{
|
|
420
|
+
rel: string;
|
|
421
|
+
href: string;
|
|
422
|
+
method: string;
|
|
423
|
+
targetSchema: string;
|
|
424
|
+
schema: string;
|
|
425
|
+
}>;
|
|
426
|
+
};
|
|
427
|
+
type OrderResponse = {
|
|
428
|
+
id: string;
|
|
429
|
+
customer: {
|
|
430
|
+
id: string;
|
|
431
|
+
email_address: string;
|
|
432
|
+
opt_in_status: boolean;
|
|
433
|
+
company: string;
|
|
434
|
+
first_name: string;
|
|
435
|
+
last_name: string;
|
|
436
|
+
orders_count: number;
|
|
437
|
+
total_spent: number;
|
|
438
|
+
address: {
|
|
439
|
+
address1: string;
|
|
440
|
+
address2: string;
|
|
441
|
+
city: string;
|
|
442
|
+
province: string;
|
|
443
|
+
province_code: string;
|
|
444
|
+
postal_code: string;
|
|
445
|
+
country: string;
|
|
446
|
+
country_code: string;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
currency_code: string;
|
|
450
|
+
order_total: number;
|
|
451
|
+
lines: Array<{
|
|
452
|
+
id: string;
|
|
453
|
+
product_id: string;
|
|
454
|
+
product_title: string;
|
|
455
|
+
product_variant_id: string;
|
|
456
|
+
product_variant_title: string;
|
|
457
|
+
quantity: number;
|
|
458
|
+
price: number;
|
|
459
|
+
}>;
|
|
460
|
+
_links: Array<{
|
|
461
|
+
rel: string;
|
|
462
|
+
href: string;
|
|
463
|
+
method: string;
|
|
464
|
+
targetSchema: string;
|
|
465
|
+
schema: string;
|
|
466
|
+
}>;
|
|
467
|
+
};
|
|
468
|
+
type AudienceMemberResponse = {
|
|
469
|
+
id: string;
|
|
470
|
+
email_address: string;
|
|
471
|
+
unique_email_id: string;
|
|
472
|
+
email_type: string;
|
|
473
|
+
status: string;
|
|
474
|
+
merge_fields: {
|
|
475
|
+
FNAME?: string;
|
|
476
|
+
LNAME?: string;
|
|
477
|
+
[key: string]: any;
|
|
478
|
+
};
|
|
479
|
+
stats: {
|
|
480
|
+
avg_open_rate: number;
|
|
481
|
+
avg_click_rate: number;
|
|
482
|
+
};
|
|
483
|
+
ip_signup: string;
|
|
484
|
+
timestamp_signup: string;
|
|
485
|
+
ip_opt: string;
|
|
486
|
+
timestamp_opt: string;
|
|
487
|
+
member_rating: number;
|
|
488
|
+
last_changed: string;
|
|
489
|
+
language: string;
|
|
490
|
+
vip: boolean;
|
|
491
|
+
email_client: string;
|
|
492
|
+
location: {
|
|
493
|
+
latitude: number;
|
|
494
|
+
longitude: number;
|
|
495
|
+
gmtoff: number;
|
|
496
|
+
dstoff: number;
|
|
497
|
+
country_code: string;
|
|
498
|
+
timezone: string;
|
|
499
|
+
};
|
|
500
|
+
tags_count: number;
|
|
501
|
+
tags: Array<{
|
|
502
|
+
id: number;
|
|
503
|
+
name: string;
|
|
504
|
+
}>;
|
|
505
|
+
list_id: string;
|
|
506
|
+
};
|
|
507
|
+
type AudienceMembersResponse = {
|
|
508
|
+
members: AudienceMemberResponse[];
|
|
509
|
+
list_id: string;
|
|
510
|
+
total_items: number;
|
|
511
|
+
_links: Array<{
|
|
512
|
+
rel: string;
|
|
513
|
+
href: string;
|
|
514
|
+
method: string;
|
|
515
|
+
targetSchema: string;
|
|
516
|
+
schema: string;
|
|
517
|
+
}>;
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,yBAAiB,SAAS,CAAC;IACzB,KAAY,iBAAiB,GAAG;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MA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AAC;YACf,MAAM,EAAE,MAAM,CAAC;YACf,YAAY,EAAE,MAAM,CAAC;YACrB,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,KAAK,CAAC;YACV,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;SACd,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,KAAY,uBAAuB,GAAG;QACpC,OAAO,EAAE,sBAAsB,EAAE,CAAC;QAClC,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,KAAK,CAAC;YACZ,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,MAAM,CAAC;YACf,YAAY,EAAE,MAAM,CAAC;YACrB,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC,CAAC;KACJ,CAAC;CACH"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValidationError } from '@marketing-sdk/core';
|
|
2
|
+
import { Mailchimp } from './types';
|
|
3
|
+
export { ValidationError };
|
|
4
|
+
export declare class MailchimpValidators {
|
|
5
|
+
static validateSubscriberPayload(payload: Mailchimp.SubscriberPayload): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,yBAAyB,CAAC,OAAO,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI;CAc7E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MailchimpValidators = exports.ValidationError = void 0;
|
|
4
|
+
const core_1 = require("@marketing-sdk/core");
|
|
5
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return core_1.ValidationError; } });
|
|
6
|
+
class MailchimpValidators {
|
|
7
|
+
static validateSubscriberPayload(payload) {
|
|
8
|
+
if (!payload.email || payload.email.trim() === '') {
|
|
9
|
+
throw new core_1.ValidationError('email', 'Email is required');
|
|
10
|
+
}
|
|
11
|
+
if (!core_1.Validators.validateEmail(payload.email)) {
|
|
12
|
+
throw new core_1.ValidationError('email', 'Invalid email format');
|
|
13
|
+
}
|
|
14
|
+
const validStatuses = ['subscribed', 'unsubscribed', 'cleaned', 'pending'];
|
|
15
|
+
if (payload.status && !validStatuses.includes(payload.status)) {
|
|
16
|
+
throw new core_1.ValidationError('status', `Status must be one of: ${validStatuses.join(', ')}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.MailchimpValidators = MailchimpValidators;
|
|
21
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":";;;AAAA,8CAAkE;AAGzD,gGAHY,sBAAe,OAGZ;AAExB,MAAa,mBAAmB;IAC9B,MAAM,CAAC,yBAAyB,CAAC,OAAoC;QACnE,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAClD,MAAM,IAAI,sBAAe,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,iBAAU,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,sBAAe,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,aAAa,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAC3E,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9D,MAAM,IAAI,sBAAe,CAAC,QAAQ,EAAE,0BAA0B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AAfD,kDAeC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@marketing-sdk/mailchimp",
|
|
3
|
+
"version": "0.1.1-experimental.0",
|
|
4
|
+
"description": "Mailchimp provider for marketing-sdk",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@marketing-sdk/core": "0.1.1-experimental.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@marketing-sdk/core": ">=0.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.3.0",
|
|
28
|
+
"jest": "^29.7.0",
|
|
29
|
+
"ts-jest": "^29.1.0",
|
|
30
|
+
"@types/jest": "^29.5.0",
|
|
31
|
+
"@types/node": "^20.0.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"test": "jest",
|
|
36
|
+
"test:coverage": "jest --coverage",
|
|
37
|
+
"typecheck": "tsc --noEmit"
|
|
38
|
+
}
|
|
39
|
+
}
|