From 04e2c694fc7391a63e16aaee821d17fcec323d82 Mon Sep 17 00:00:00 2001 From: prabrisha-rudder Date: Mon, 23 Mar 2020 17:40:00 +0530 Subject: [PATCH] removed handlebars --- integrations/Lotame/browser.js | 18 +++++++++++++----- package.json | 1 - 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/integrations/Lotame/browser.js b/integrations/Lotame/browser.js index ff8ca397de..aefcc4590b 100644 --- a/integrations/Lotame/browser.js +++ b/integrations/Lotame/browser.js @@ -1,6 +1,5 @@ import logger from "../../utils/logUtil"; import {LotameStorage} from "./LotameStorage"; -import Handlebars from "handlebars" class Lotame { constructor(config) { this.name = "LOTAME"; @@ -33,8 +32,7 @@ class Lotame { if(this.dspUrlSettings && this.dspUrlSettings.length > 0){ this.dspUrlSettings.forEach(urlSettings => { - let template = Handlebars.compile(urlSettings.dspUrlTemplate); - let dspUrl = template({...this.mappings, userId:userId}); + let dspUrl = this.compileUrl({...this.mappings, userId:userId}, urlSettings.dspUrlTemplate); this.addPixel(dspUrl, "1", "1"); }); } @@ -45,6 +43,17 @@ class Lotame { } + compileUrl(map, url){ + + Object.keys(map).forEach(key => { + let replaceKey = "{{"+key+"}}"; + let regex = new RegExp(replaceKey, 'gi'); + url = url.replace(regex, map[key]); + }); + console.log(url); + return url; + } + identify(rudderElement) { logger.debug("in Lotame identify"); let userId = rudderElement.message.userId; @@ -60,8 +69,7 @@ class Lotame { if(this.bcpUrlSettings && this.bcpUrlSettings.length > 0){ this.bcpUrlSettings.forEach(urlSettings => { - let template = Handlebars.compile(urlSettings.bcpUrlTemplate); - let bcpUrl = template({...this.mappings}); + let bcpUrl = this.compileUrl({...this.mappings}, urlSettings.bcpUrlTemplate); this.addPixel(bcpUrl, "1", "1"); }); diff --git a/package.json b/package.json index a02d2cff1d..c1adcc73fd 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "component-each": "^0.2.6", "component-emitter": "github:component/emitter", "gh-release": "^3.5.0", - "handlebars": "^4.7.3", "is": "^3.3.0", "json3": "^3.3.3", "obj-case": "^0.2.0",