fix(plugins): fix open tracking and link tracking URLs

This commit is contained in:
Drew Regitsky 2016-02-24 12:00:40 -08:00
parent e02b924efb
commit 0550b092b7
6 changed files with 6 additions and 6 deletions

View file

@ -29,7 +29,7 @@ export default class LinkTrackingComposerExtension extends ComposerExtension {
// loop through all <a href> elements, replace with redirect links and save mappings
draftBody.unquoted = draftBody.unquoted.replace(RegExpUtils.linkTagRegex(), (match, prefix, url, suffix, content, closingTag) => {
const encoded = encodeURIComponent(url);
const redirectUrl = `http://${PLUGIN_URL}/${draft.accountId}/${messageUid}/${links.length}?redirect=${encoded}`;
const redirectUrl = `http://${PLUGIN_URL}/link/${draft.accountId}/${messageUid}/${links.length}?redirect=${encoded}`;
links.push({url: url, click_count: 0, click_data: [], redirect_url: redirectUrl});
return prefix + redirectUrl + suffix + content + closingTag;
});

View file

@ -2,4 +2,4 @@ import plugin from '../package.json'
export const PLUGIN_NAME = plugin.title
export const PLUGIN_ID = plugin.appId[NylasEnv.config.get("env")];
export const PLUGIN_URL = "https://edgehill-staging.nylas.com/plugins";
export const PLUGIN_URL = "https://edgehill-staging.nylas.com";

View file

@ -25,7 +25,7 @@ function afterDraftSend({draftClientId}) {
// post the uid and message id pair to the plugin server
const data = {uid: uid, message_id: message.id};
const serverUrl = `${PLUGIN_URL}/register-message`;
const serverUrl = `${PLUGIN_URL}/plugins/register-message`;
return post({
url: serverUrl,
body: JSON.stringify(data),

View file

@ -27,7 +27,7 @@ function afterDraftSend({draftClientId}) {
// post the uid and message id pair to the plugin server
const data = {uid: uid, message_id: message.id, thread_id: 1};
const serverUrl = `${PLUGIN_URL}/register-message`;
const serverUrl = `${PLUGIN_URL}/plugins/register-message`;
return post({
url: serverUrl,
body: JSON.stringify(data),

View file

@ -21,7 +21,7 @@ export default class OpenTrackingComposerExtension extends ComposerExtension {
const uid = uuid.v4().replace(/-/g, "");
// insert a tracking pixel <img> into the message
const serverUrl = `http://${PLUGIN_URL}/${draft.accountId}/${uid}`;
const serverUrl = `http://${PLUGIN_URL}/open/${draft.accountId}/${uid}`;
const img = `<img width="0" height="0" style="border:0; width:0; height:0;" src="${serverUrl}">`;
const draftBody = new DraftBody(draft);
draftBody.unquoted = draftBody.unquoted + "<br>" + img;

View file

@ -2,4 +2,4 @@ import plugin from '../package.json'
export const PLUGIN_NAME = plugin.title
export const PLUGIN_ID = plugin.appId[NylasEnv.config.get("env")];
export const PLUGIN_URL = "https://edgehill-staging.nylas.com/plugins";
export const PLUGIN_URL = "https://edgehill-staging.nylas.com";