npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nitsanzo/ngx-zendesk-webwidget

v17.0.1

Published

[![Maintainability](https://api.codeclimate.com/v1/badges/75bc5877b3bf6939fe44/maintainability)](https://codeclimate.com/github/AlisonVilela/ngx-zendesk-webwidget/maintainability) [![Build Status](https://travis-ci.org/AlisonVilela/ngx-zendesk-webwidget.s

Downloads

7,399

Readme

ngx-zendesk-webwidget

Maintainability Build Status contributions welcome

Zendesk-Webwidget for Angular 2+

Zendesk-Webwidget for Angular 1.x see here

Installation

Via npm:

npm install @nitsanzo/ngx-zendesk-webwidget

Usage

Add to your tsconfig.json file, to paths ngx-zendesk-webwidget:

"compilerOptions": {
    "paths": {
      "ngx-zendesk-webwidget": ["node_modules/@nitsanzo/ngx-zendesk-webwidget"]
    }

The examples were made using the classic web widget

1. Import the NgxZendeskWebwidgetModule

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

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

import { NgxZendeskWebwidgetModule } from 'ngx-zendesk-webwidget';

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

SharedModule

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

import { NgxZendeskWebwidgetModule, NgxZendeskWebwidgetConfig } from 'ngx-zendesk-webwidget';

import { AppComponent } from './app';

export class ZendeskConfig extends NgxZendeskWebwidgetConfig {
  accountUrl = 'yourdomain.zendesk.com';
  callback(zE) {
    // You can call every command you want in here
    // zE('webWidget', 'hide');
    // zE('webWidget', 'show');
  }
}

@NgModule({
    imports: [
        BrowserModule,
        HttpClientModule,
        NgxZendeskWebwidgetModule.forRoot(ZendeskConfig)
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Configuration with Lazyload
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { NgxZendeskWebwidgetModule, NgxZendeskWebwidgetConfig } from 'ngx-zendesk-webwidget';

import { AppComponent } from './app';

export class ZendeskConfig extends NgxZendeskWebwidgetConfig {
  override lazyLoad = true;
  accountUrl = 'yourdomain.zendesk.com';
  callback(zE) {
    // You can call every command you want in here
    // zE('webWidget', 'hide');
    // zE('webWidget', 'show');
  }
}

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

2. Init the NgxZendeskWebwidgetService

For your application
import { NgxZendeskWebwidgetService } from 'ngx-zendesk-webwidget';

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

  constructor(private _NgxZendeskWebwidgetService: NgxZendeskWebwidgetService) { }

}
With Lazyload
import { NgxZendeskWebwidgetService } from 'ngx-zendesk-webwidget';

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

  constructor(private _NgxZendeskWebwidgetService: NgxZendeskWebwidgetService) {
    this._NgxZendeskWebwidgetService_.initZendesk();
  }

}

3. Example to usage

  constructor(private _NgxZendeskWebwidgetService: NgxZendeskWebwidgetService) {
    this._NgxZendeskWebwidgetService.zE('webWidget', 'identify', {
      name: 'Fulano de Tal',
      email: '[email protected]'
    });
  
    this._NgxZendeskWebwidgetService.zE('webWidget', 'prefill', {
        name: {
        value: 'Fulano de Tal',
        readOnly: true
      },
      email: {
        value: '[email protected]',
        readOnly: true
      }
    });
  
    this._NgxZendeskWebwidgetService.zE('webWidget', 'show');
  }
  
  logout() {
    this._NgxZendeskWebwidgetService.zE('webWidget', 'hide');
  }

API

NgxZendeskWebwidgetService

Web Widget (Messenger)

  • The new web widget is not as supported as the classic one, you can check the documentation here.

Web widget (Classic)

  • zE('webWidget:<action>', '<event|property>', <parameters>): All commands follow the same basic syntax. Please see Zendesk Documentation for more information.

NgxZendeskWebwidgetConfig

  • lazyLoad: Boolean for activate Lazyload initialization of Zendesk Web Widget
  • timeOut: Timeout in milliseconds of the timer before opening the widget, zendesk unfortunately needs to load more files after the initial promise has been resolved, such as translation files. (default: 30 seconds)
  • injectionTag: You can identify which tag will be used as a reference for widget injection('head', 'body', 'script'). (Default: 'head')
  • accountUrl: Url of your domain (example.zendesk.com)
  • callback: Callback, executed after Zendesk loaded

Issues

Please report bugs and issues here.

To do

  • Tests with jest
  • Error handler

License

MIT © Alison Vilela

Change log

v3.0.1

  • Fix documentation

v3.0.0

  • Support Angular 13
  • Changed the library core
  • Fix initZendesk parameters based on issue 47 and issue 43

v2.1.1

v2.1.0

  • Include injectionTag in NgxZendeskWebwidgetConfig based on issue 30

V2.0.0

  • API services that used legacy zE methods (setLocale, identify, hide, show, activate, setHelpCenterSuggestions, setSettings) have been removed, you now need to use the new command syntax for greater flexibility (breaking changes)
  • beforePageLoad(zE) changed to callback(zE) (breaking changes)

V1.0.1

  • Fix bugs

v1.0.0

  • Update Packages
  • Change Class name to pascal case (breaking changes)
  • Lazyload Implemented, based on Pull 23
  • Configure Timeout on Webwidget initialization

v0.1.5

  • Support Angular 8

v0.1.4

  • Support Angular 6

v0.1.3

  • Support Angular 5

v0.1.2

  • Added custom settings

v0.1.1

  • Change documentation

v0.1.0

  • Added documentation
  • Initial version