Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ng-intercom

CaliStyle41kMIT8.0.2TypeScript support: included

npm npm [![Build status][ci-image]][ci-url] [![Maintenance](https://img.sh

Intercom, Angular

readme

ng-intercom

npm npm Build status Maintenance

This is an Intercom wrapper for Angular 2+ which supports AoT and SSR.

It intends to supports all documented intercom methods and PRs for functionality is greatly appreciated.

BETA VERSION

master is now hosting the 7.0.0 beta version of ng-intercom. If you need to make changes to the latest stable version, please PR against 0.x.x. If you need to use the last 0.x version, please run npm install --save --save-exact ng-intercom@0.2.

If you find issues with this version, please file an issue as soon as possible so we can take a look at it. We appreciate your cooperation!

ALPHA VERSION

If you want to try the latest features, check out the 7.0.0-alpha branch! Features include automatic script loading and intercom directives! If you find an issue, please report it!

Installation

This package is on NPM, so just run

$ npm install ng-intercom@latest --save

Configuration

  1. Import IntercomModule to app.module.ts. The module will automatically include the APP_ID instantiation, so you DO NOT need to copy the install script from Intercom and place it in your index.html.
import { IntercomModule } from 'ng-intercom';

@NgModule({
  imports: [
    ...
    IntercomModule.forRoot({
      appId: <your_app_id>, // from your Intercom config
      updateOnRouterChange: true // will automatically run `update` on router event changes. Default: `false`
    })
    ...
  ]
})
export class AppModule { }
  1. Use in your components/directives/whatever you want!
// App
import { Component, OnInit } from '@angular/core';
import { Intercom } from 'ng-intercom';

@Component({
  selector: 'app',
  template: `...`
})
export class AppComponent implements OnInit {
  constructor(
    public intercom: Intercom
  ){}

  ngOnInit() {
    this.intercom.boot({
      app_id: <app_id>,
      // Supports all optional configuration.
      widget: {
        "activator": "#intercom" 
      }
    });
  }
}

Development

To run live testing: ng test

To run tests: npm test

To run distribution: npm run build:dist

To publish npm run build:dist && npm publish dist

Credits

Maintained by Scott Wyatt and Wilson Hobbs in 2017 with contributions from Florian Reifschneider, Devon Sams, Humberto Rocha, and Luca GOUTY

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[1.0.0-beta.11] - 2018-1-4

Added

  • Configuration options (that would otherwise be in window.intercomSettings)
  • Add a somewhat typed input for Intercom.boot and Intercom.update

Removed

  • BREAKING CHANGE: Removed deprecated Intercom.init() method

[1.0.0-beta.10] - 2017-11-15

Fixed

  • BREAKING CHANGE: ng-intercom now requires peers of Angular v5. Please update your applications, or you may get an error when compiling.

[1.0.0-beta.9] - 2017-11-01

Fixed

  • Make NPM dependencies compatible with Angular v5

[1.0.0-beta.8] - 2017-10-14

Fixed

  • Clean up dependencies and structure
  • Add compatibility with Angular v5

[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
  • Set property onUnreadCountChange to correct value (Closing #20)

[1.0.0-beta.3] - 2017-09-03

Added

[1.0.0-beta.1] - 2017-08-23

Added

  • semver-major:Add option to watch router events and fire Intercom update, as is standard practice in SPAs (#17)
  • Added peer dependency for @angular/router. It will warn if you don't have the router installed, but it is not required to function if you are not using updateOnRouterChange.

Fixed

  • Fix issue with production build throwing error (#19)
  • Only fire warnings if in development mode, so production code executes without warnings.

[1.0.0-beta.0] - 2017-08-22

Fixed

  • Resolved an error where undefined was being exported from the module.
  • Removed CommonModule from exports array

[1.0.0-alpha.1] - 2017-07-10

Added

  • semver-major: New methods to line up with Intercom documentation
  • semver-major: New directives

Deprecated

  • semver-major: intercom.init() method

Removed

  • IntercomEnvironment class
  • IntercomBrowser class
  • IntercomNode class

[0.2.2] - 2017-04-21

Fixed

  • Fix reference in package.json

[0.2.0] - 2017-03-10

Added

  • semver-minor: AoT compatibility
  • trackEvent() method

Fixed

  • Move to Angular compiler so it acutally works
  • Clean up module format setup