Skip to content

Commit

Permalink
removed handlebars
Browse files Browse the repository at this point in the history
  • Loading branch information
prabrisha-rudder committed Mar 23, 2020
1 parent f63c1c7 commit 04e2c69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 13 additions & 5 deletions integrations/Lotame/browser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logger from "../../utils/logUtil";
import {LotameStorage} from "./LotameStorage";
import Handlebars from "handlebars"
class Lotame {
constructor(config) {
this.name = "LOTAME";
Expand Down Expand Up @@ -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");
});
}
Expand All @@ -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;
Expand All @@ -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");
});

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 04e2c69

Please sign in to comment.