// @flow

import url from 'url';
import R from 'ramda';
import env from '../../../env';

const MC_KEY = env('MC_KEY');

const urlSpec = {
  protocol: 'https:',
  pathname: '/3.0/',
};
const location = R.nth(1, R.match(/-(\S+)$/, MC_KEY));

// baseUrl () -> String
export const baseUrl = (): string => R.compose(
  url.format,
  R.assoc('host', R.concat(location, '.api.mailchimp.com')),
)(urlSpec);

// reportUrl :: String -> String
export const reportUrl = (campaignId: string): string => `/reports/${campaignId}`;

@@ -396,121 +396,4 @@
 c);%0A
-%0A// reportUrl :: String -%3E String%0Aexport const reportUrl = (campaignId: string): string =%3E %60/reports/$%7BcampaignId%7D%60;%0A

REMOVE obsolete code