ng-intercom
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
@@ -7,4 +7,8 @@ # Changelog | ||
## [1.0.0-beta.6] - 2017-09-03 | ||
## [1.0.0-beta.7] - 2017-10-13 | ||
### Fixed | ||
- Fix load script | ||
## [1.0.0-beta.6] - 2017-09-06 | ||
### Fixed | ||
- Properly inject options providers | ||
@@ -11,0 +15,0 @@ - Set property onUnreadCountChange to correct value (Closing #20) |
@@ -0,3 +1,3 @@ | ||
import { Router } from '@angular/router'; | ||
import { IntercomConfig } from '../types/intercom-config'; | ||
import { Router } from '@angular/router'; | ||
/** | ||
@@ -4,0 +4,0 @@ * @description A provider with every Intercom.JS method |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var router_1 = require("@angular/router"); | ||
var config_token_1 = require("../shared/config-token"); | ||
var router_1 = require("@angular/router"); | ||
var load_intercom_1 = require("../util/load-intercom"); | ||
@@ -38,3 +46,3 @@ /** | ||
} | ||
return window.Intercom("boot", intercomData); | ||
return window.Intercom("boot", __assign({ app_id: this.config.appId }, intercomData)); | ||
}; | ||
@@ -48,3 +56,3 @@ /** | ||
Intercom.prototype.boot = function (intercomData) { | ||
return window.Intercom("boot", intercomData); | ||
return window.Intercom("boot", __assign({ app_id: this.config.appId }, intercomData)); | ||
}; | ||
@@ -51,0 +59,0 @@ /** |
@@ -14,28 +14,27 @@ "use strict"; | ||
function loadIntercom(appId) { | ||
id = appId; | ||
var w = window; | ||
var ic = w.Intercom; | ||
if (typeof ic === 'function') { | ||
ic('reattach_activator'); | ||
ic('update'); | ||
} | ||
else { | ||
var i_1 = function () { | ||
i_1.c(arguments); | ||
}; | ||
i_1.q = []; | ||
i_1.c = function (args) { | ||
i_1.q.push(args); | ||
}; | ||
w.Intercom = i_1; | ||
if (w.attachEvent) { | ||
w.attachEvent('onload', l); | ||
} | ||
else { | ||
w.addEventListener('load', l, false); | ||
} | ||
} | ||
window.Intercom = intercomBootstrap(); | ||
createScript(appId); | ||
} | ||
exports.loadIntercom = loadIntercom; | ||
; | ||
function createScript(appId) { | ||
var scriptTag = document.createElement('script'); | ||
scriptTag.type = 'text/javascript'; | ||
scriptTag.async = true; | ||
scriptTag.src = 'https://widget.intercom.io/widget/' + appId; | ||
var s = document.getElementsByTagName('head')[0]; | ||
s.appendChild(scriptTag); | ||
} | ||
; | ||
function intercomBootstrap() { | ||
var Intercom = function () { | ||
Intercom.c(arguments); | ||
}; | ||
Intercom.q = []; | ||
Intercom.c = function (args) { | ||
Intercom.q.push(args); | ||
}; | ||
return Intercom; | ||
} | ||
; | ||
//# sourceMappingURL=load-intercom.js.map |
{ | ||
"name": "ng-intercom", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"description": "An Intercom wrapper for Angular", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index", |
@@ -1,8 +0,8 @@ | ||
import { Inject, Injectable, InjectionToken, Optional, isDevMode } from '@angular/core'; | ||
import { Inject, Injectable, InjectionToken, isDevMode, Optional } from '@angular/core'; | ||
import { Router } from '@angular/router'; | ||
import { CONFIG } from '../shared/config-token'; | ||
import { IntercomConfig } from '../types/intercom-config'; | ||
import { Router } from '@angular/router'; | ||
import { loadIntercom } from '../util/load-intercom'; | ||
/** | ||
@@ -40,3 +40,3 @@ * @description A provider with every Intercom.JS method | ||
} | ||
return (<any>window).Intercom("boot", intercomData); | ||
return (<any>window).Intercom("boot", { app_id: this.config.appId, ...intercomData }); | ||
} | ||
@@ -51,3 +51,3 @@ | ||
boot(intercomData?: object) { | ||
return (<any>window).Intercom("boot", intercomData); | ||
return (<any>window).Intercom("boot", { app_id: this.config.appId, ...intercomData }); | ||
} | ||
@@ -54,0 +54,0 @@ |
@@ -15,23 +15,23 @@ | ||
export function loadIntercom(appId: any) { | ||
id = appId; | ||
var w = <any>window; | ||
var ic = w.Intercom; | ||
if (typeof ic === 'function') { | ||
ic('reattach_activator'); | ||
ic('update'); | ||
} else { | ||
let i: any = function () { | ||
i.c(arguments); | ||
}; | ||
i.q = []; | ||
i.c = function (args: any) { | ||
i.q.push(args); | ||
}; | ||
w.Intercom = i; | ||
if (w.attachEvent) { | ||
w.attachEvent('onload', l); | ||
} else { | ||
w.addEventListener('load', l, false); | ||
} | ||
} | ||
(<any>window).Intercom = intercomBootstrap(); | ||
createScript(appId); | ||
}; | ||
function createScript(appId: string) { | ||
var scriptTag = document.createElement('script'); | ||
scriptTag.type = 'text/javascript'; | ||
scriptTag.async = true; | ||
scriptTag.src = 'https://widget.intercom.io/widget/' + appId; | ||
var s = document.getElementsByTagName('head')[0]; | ||
s.appendChild(scriptTag); | ||
}; | ||
function intercomBootstrap() { | ||
let Intercom: any = function () { | ||
Intercom.c(arguments) | ||
}; | ||
Intercom.q = []; | ||
Intercom.c = function (args: any) { | ||
Intercom.q.push(args) | ||
}; | ||
return Intercom; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
147275
1942