@orchesty/connector-mailchimp 1.0.1 → 1.0.2
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.
|
@@ -17,6 +17,7 @@ export declare const AUDIENCE_ID = "audience_id";
|
|
|
17
17
|
export declare const TOKEN_URL = "https://login.mailchimp.com/oauth2/token";
|
|
18
18
|
export declare const API_KEYPOINT = "api_keypoint";
|
|
19
19
|
export declare const SEGMENT_ID = "segment_id";
|
|
20
|
+
export declare const NAME = "mailchimp";
|
|
20
21
|
export default class MailchimpApplication extends AOAuth2Application implements IWebhookApplication {
|
|
21
22
|
private readonly sender;
|
|
22
23
|
constructor(sender: CurlSender, inputProvider: OAuth2Provider);
|
|
@@ -36,8 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.SEGMENT_ID = exports.API_KEYPOINT = exports.TOKEN_URL = exports.AUDIENCE_ID = exports.MAILCHIMP_DATACENTER_URL = exports.MAILCHIMP_URL = void 0;
|
|
40
|
-
const GitHubApplication_1 = require("@orchesty/connector-git-hub/src/GitHubApplication");
|
|
39
|
+
exports.NAME = exports.SEGMENT_ID = exports.API_KEYPOINT = exports.TOKEN_URL = exports.AUDIENCE_ID = exports.MAILCHIMP_DATACENTER_URL = exports.MAILCHIMP_URL = void 0;
|
|
41
40
|
const ApplicationTypeEnum_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Base/ApplicationTypeEnum"));
|
|
42
41
|
const CoreFormsEnum_1 = __importStar(require("@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum"));
|
|
43
42
|
const Field_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field"));
|
|
@@ -58,6 +57,7 @@ exports.AUDIENCE_ID = 'audience_id';
|
|
|
58
57
|
exports.TOKEN_URL = 'https://login.mailchimp.com/oauth2/token';
|
|
59
58
|
exports.API_KEYPOINT = 'api_keypoint';
|
|
60
59
|
exports.SEGMENT_ID = 'segment_id';
|
|
60
|
+
exports.NAME = 'mailchimp';
|
|
61
61
|
class MailchimpApplication extends AOAuth2Application_1.default {
|
|
62
62
|
sender;
|
|
63
63
|
constructor(sender, inputProvider) {
|
|
@@ -71,7 +71,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
|
|
|
71
71
|
return 'Mail marketing automation service that lets you send out professional-looking newsletters';
|
|
72
72
|
}
|
|
73
73
|
getName() {
|
|
74
|
-
return
|
|
74
|
+
return exports.NAME;
|
|
75
75
|
}
|
|
76
76
|
getPublicName() {
|
|
77
77
|
return 'Mailchimp';
|
|
@@ -122,7 +122,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
|
|
|
122
122
|
];
|
|
123
123
|
}
|
|
124
124
|
getWebhookSubscribeRequestDto(applicationInstall, subscription, url) {
|
|
125
|
-
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(
|
|
125
|
+
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.POST, `${applicationInstall.getSettings()[exports.API_KEYPOINT]}
|
|
126
126
|
/3.0/lists/${applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUDIENCE_ID]}/webhooks`, JSON.stringify({
|
|
127
127
|
url,
|
|
128
128
|
events: {
|
|
@@ -136,7 +136,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
|
|
|
136
136
|
}));
|
|
137
137
|
}
|
|
138
138
|
getWebhookUnsubscribeRequestDto(applicationInstall, webhook) {
|
|
139
|
-
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(
|
|
139
|
+
return this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.DELETE, `${applicationInstall.getSettings()[exports.API_KEYPOINT]}/3.0/lists/${applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUDIENCE_ID]}/webhooks/${webhook.getWebhookId()}`);
|
|
140
140
|
}
|
|
141
141
|
processWebhookSubscribeResponse(dto, applicationInstall) {
|
|
142
142
|
return JSON.parse(dto.getBody()).id;
|
|
@@ -145,7 +145,7 @@ class MailchimpApplication extends AOAuth2Application_1.default {
|
|
|
145
145
|
return dto.getResponseCode() === http_status_codes_1.StatusCodes.NO_CONTENT;
|
|
146
146
|
}
|
|
147
147
|
async getApiEndpoint(applicationInstall) {
|
|
148
|
-
const output = await this.sender.send(this.getRequestDto(ProcessDto_1.default.createForFormRequest(
|
|
148
|
+
const output = await this.sender.send(this.getRequestDto(ProcessDto_1.default.createForFormRequest(exports.NAME, applicationInstall.getUser(), crypto.randomUUID()), applicationInstall, HttpMethods_1.HttpMethods.GET, '%s/oauth2/metadata', exports.MAILCHIMP_DATACENTER_URL));
|
|
149
149
|
return output.getJsonBody() ?? '';
|
|
150
150
|
}
|
|
151
151
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchesty/connector-mailchimp",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
7
7
|
"repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"keywords": [],
|
|
18
18
|
"author": "info@hanaboso.com",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orchesty/connector-git-hub": "workspace:*",
|
|
21
20
|
"@orchesty/nodejs-sdk": "^4.3.6",
|
|
22
21
|
"http-status-codes": "^2.3.0"
|
|
23
22
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchesty/connector-mailchimp",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
7
7
|
"repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"author": "info@hanaboso.com",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@orchesty/nodejs-sdk": "^4.3.6",
|
|
15
|
-
"http-status-codes": "^2.3.0"
|
|
16
|
-
"@orchesty/connector-git-hub": "1.0.1"
|
|
15
|
+
"http-status-codes": "^2.3.0"
|
|
17
16
|
},
|
|
18
17
|
"engines": {
|
|
19
18
|
"node": ">=24"
|