feat(mailchimp): add mailchimp integration

This commit is contained in:
Rıdvan Akca
2024-01-31 12:32:15 +03:00
committed by Ali BARIN
parent c4cbc024e6
commit cbed79fbf1
12 changed files with 195 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { URLSearchParams } from 'url';
export default async function generateAuthUrl($) {
const oauthRedirectUrlField = $.app.auth.fields.find(
(field) => field.key == 'oAuthRedirectUrl'
);
const redirectUri = oauthRedirectUrlField.value;
const searchParams = new URLSearchParams({
response_type: 'code',
client_id: $.auth.data.clientId,
redirect_uri: redirectUri,
});
const url = `https://login.mailchimp.com/oauth2/authorize?${searchParams.toString()}`;
await $.auth.set({
url,
});
}