1.1.1 • Published 2 years ago

ng-kompassify v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ng-kompassify

This is a Kompassify wrapper for Angular 2+

This library was generated with Nx.

Installation

$ npm install ng-kompassify@latest --save

Configuration

  1. Import KompassifyModule to app.module.ts. The module will automatically include the YOUR_KOMPASSIFY_KEY_ID instantiation, so you DO NOT need to copy the install script from Kompassify and place it in your index.html.
import { KompassifyModule } from 'ng-kompassify'
@NgModule({
  imports: [
    ...
    KompassifyModule.forRoot({
      uuid: <your_kompassify_key_id>, // from your Kompassify config
    )
    ...
  ]
})
export class AppModule { }

How to use

This package provide a service KompassifyService

Please read the Kompassify documentation for details

import { KompassifyService } from 'ng-kompassify'

@Component({
  selector: 'app',
  template: `...`,
})
export class AppRootComponent {
  constructor(private kompassify: KompassifyService) {
    // You can listen to the Ready state from Kompassify
    kompassify.ready$.subscribe(ready => console.log(ready))
    // You can listen to Events from Kompassify
    kompassify.event$.subscribe(event => console.log(event))
  }

  implementedKompassifyFunctions() {
    this.kompassify.launchTour(<tourUuid>, <startIndex>, <skipIfWasFinished>)
    this.kompassify.updateProgressBarIdx(<activeIdx>)
    this.kompassify.addProgressBarTemplateVariable(<key>, <value>)
    this.kompassify.markTaskAsComplete(<taskNumber>)
    this.kompassify.startChecklistV2(<checklistUuid>)
    this.kompassify.addChecklistTemplateVariable(<key>, <value>)
    this.kompassify.addUserToSegment(<segmentName>)
    this.kompassify.removeUserToSegment(<segmentName>)
    this.kompassify.setUserLanguage(<languageCode>)
    this.kompassify.resetUserLanguage()
    this.kompassify.startMultiChoice(<multiChoiceUuid>)
  }
}

Credits

Maintained by Clément de l'Hamaide