Skip to content

AlisonVilela/ngx-freshdesk-webwidget

Repository files navigation

ngx-freshdesk-webwidget

Maintainability Build Status contributions welcome

Freshdesk widget for Angular 8+

Installation

Via npm:

npm install ngx-freshdesk-webwidget --save

Usage

1. Import the NgxFreshdeskWebwidgetModule

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

import { NgxFreshdeskWebwidgetModule } from 'ngx-freshdesk-webwidget';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxFreshdeskWebwidgetModule.forRoot()
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

SharedModule

@NgModule({
    exports: [
      CommonModule,
      NgxFreshdeskWebwidgetModule
    ]
})
export class SharedModule { }
Configuration
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { NgxFreshdeskWebwidgetModule, NgxFreshdeskWebwidgetConfig } from 'ngx-freshdesk-webwidget';

import { AppComponent } from './app';

export class FreshdeskConfig extends NgxFreshdeskWebwidgetConfig {
  widgetId = 00000000000;
  locale = 'en';
  callback(FreshworksWidget) {
    FreshworksWidget('hide');
  }
}

@NgModule({
    imports: [
        BrowserModule,
        HttpClientModule,
        NgxFreshdeskWebwidgetModule.forRoot(FreshdeskConfig)
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }

2. Import the NgxFreshdeskWebwidgetService

import { NgxFreshdeskWebwidgetService } from 'ngx-freshdesk-webwidget';

@Component({
  selector: 'app',
  templateUrl: './app.html'
})
export class app {

  constructor(private _NgxFreshdeskWebwidgetService: NgxFreshdeskWebwidgetService) { }

}

3. Example to usage

constructor(private _NgxFreshdeskWebwidgetService: NgxFreshdeskWebwidgetService) {
  this._NgxFreshdeskWebwidgetService.FreshworksWidget('identify', 'ticketForm', {
    name: 'Fulano Detal',
    email: '[email protected]',
  });

  this._NgxFreshdeskWebwidgetService.FreshworksWidget('show');
}

logout(){
  this._NgxFreshdeskWebwidgetService.FreshworksWidget('hide');
}
buttonClick(){
  this._NgxFreshdeskWebwidgetService.FreshworksWidget('open', 'ticketForm');
}
buttonClickArticle(articleId: number){
  this._NgxFreshdeskWebwidgetService.FreshworksWidget('open', 'article', {
    id: articleId
  });
}

API

NgxFreshdeskWebwidgetService

Methods

NgxFreshdeskWebwidgetConfig

  • widgetId: Number of your Freshdesk Web Widget ID.
  • locale: To force the widget to load in a particular language.
  • callback: Callback, executed after Freshdesk loaded.

Issues

Please report bugs and issues here.

License

MIT © Alison Vilela

Change log

v1.1.0

  • Anuglar 10 support

v1.0.0

  • Added documentation
  • Initial version

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published