Skip to content

Commit

Permalink
Merge pull request #89 from CaliStyle/7.x.x-alpha
Browse files Browse the repository at this point in the history
[fix] #87 #51
  • Loading branch information
scott-wyatt authored Mar 11, 2019
2 parents 8bd99e8 + bd47ac0 commit 8f6bc55
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ng-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"name": "ng-intercom",
"version": "7.0.1-beta.1",
"version": "7.0.1-beta.2",
"licensePath": "LICENSE",
"lib": {
"entryFile": "public_api.ts",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-intercom",
"version": "7.0.1-beta.1",
"version": "7.0.1-beta.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions src/app/ng-intercom/intercom/intercom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class Intercom {
* when the page loads. You call this method with the standard intercomSettings object.
*/
public boot(intercomData?: BootInput): void {
console.log('brk', intercomData)
if (!isPlatformBrowser(this.platformId)) {
return
}
Expand Down Expand Up @@ -241,6 +242,10 @@ export class Intercom {
return
}

// Set the window configuration to conf
(<any>window).intercomSettings = conf

// Create the intercom script in document
const s = this.document.createElement('script')
s.type = 'text/javascript'
s.async = true
Expand All @@ -267,6 +272,10 @@ export class Intercom {
this.id = config.appId
const w = <any>window
const ic = w.Intercom

// Set window config for Intercom
w.intercomSettings = config

if (typeof ic === 'function') {
ic('reattach_activator')
ic('update', config)
Expand Down
17 changes: 17 additions & 0 deletions src/app/ng-intercom/shared/intercom-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,22 @@ import { Injectable } from '@angular/core'
export class IntercomConfig {
appId: string
updateOnRouterChange?: boolean
/**
* Customize left or right position of messenger
*/
alignment?: 'left' | 'right'
/**
* Customize horizontal padding
*/
horizontal_padding?: number

/**
* Customize vertical padding
*/
vertical_padding?: number

/**
* arbitrarily localize your intercom messenger
*/
language_override?: string
}
2 changes: 2 additions & 0 deletions src/app/root/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class AppComponent implements OnInit {
this.intercom.boot({
app_id: 'klwzj86j',
// Supports all optional configuration.
alignment: 'right',
widget: {
'activator': '#intercom'
}
Expand All @@ -41,6 +42,7 @@ export class AppComponent implements OnInit {
setTimeout(() => this.intercom.boot({
app_id: 'klwzj86j',
// Supports all optional configuration.
alignment: 'left',
widget: {
'activator': '#intercom'
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/root/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { IntercomModule } from '../ng-intercom/intercom.module'
SharedModule,
IntercomModule.forRoot({
appId: 'klwzj86j',
updateOnRouterChange: true
updateOnRouterChange: true,
alignment: 'left'
}),
environment.production ? ServiceWorkerModule.register('/ngsw-worker.js') : []
],
Expand Down
3 changes: 2 additions & 1 deletion src/app/root/app.server.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import { IntercomModule } from '../ng-intercom/intercom.module'
SharedModule,
IntercomModule.forRoot({
appId: 'klwzj86j',
updateOnRouterChange: true
updateOnRouterChange: true,
alignment: 'left'
})
],
providers: [],
Expand Down

0 comments on commit 8f6bc55

Please sign in to comment.