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

ziwo-core-front

v1.0.13

Published

Provides a Ziwo Client to perform call

Downloads

72

Readme

Ziwo Core Front

Provides a Ziwo Client to perform call

Online documentation: http://doc-core-front.ziwo.tech/

Get started

Take time to read the following links:

  1. Usage section of this file
  2. Events section of this file
  3. Ziwo Client class http://doc-core-front.ziwo.tech/classes/ziwoclient.html
  4. Call class http://doc-core-front.ziwo.tech/classes/call.html
  5. Event's details: http://doc-core-front.ziwo.tech/classes/ziwoevent.html)

Usage

You can easily instanciate a Ziwo Client:

ziwoClient = new ziwoCoreFront.ZiwoClient({
    autoConnect: true, // Automatically connect agent to contact center. Default is true
    contactCenterName: 'your-contact-center-name', // Contact center you are trying to connect to
    credentials: { // User's credentials. You can either send an authentication token or directly the user's credentials
        authenticationToken: 'token_returned_on_login_action',
        //// If you don't have an authentication token, simply provide user's credentials
        // email: '[email protected]',
        // password: 'verysecretpassword',
    },
    tags: { // HTML tags of <video> elements available in your DOM
        selfTag: document.getElementById('self-video'), // `selfTag` is not required if you don't use video
        peerTag: document.getElementById('peer-video'), // `peerTag` is mandatory. It is used to bind the incoming stream (audio or video)
    },
    debug: true, // Will provide additional logs as well as displaying incoming/outgoing Verto messages
});

If you disabled the auto connect in the option, make sure to call connect() before anything else.

Now, you can use the only function available in the Ziwo Client : startCall

ziwoClient.startCall('+3364208xxxx');

Everything else is managed through the events.

Events

The events emitted by Ziwo will allow you to perform many actions. Each event holds a Call instance that you can use to change the status of the call.

See below the list of events:

| Events | Description | | ------------ | --------------------------------------------------------------------------------------- | | error | Something wrong happened. See details for further information | | connected | User has been successfully authenticated | | disconnected | User has been disconnected | | requesting | Requesting operator to make the call | | trying | Operator trying to make the call | | early | Call is waiting for customer to pick up | | ringing | Call is ringing agent phone | | answering | Agent is answering call | | active | Agent and customer can talk to each other | | held | Customer has been put on hold by the Agent | | hangup | Call is being hanged up | | mute | Call has been muted by the agent | | unmute | Call has been unmuted by the agent | | destroy | Call is destroying | | recovering | When reconnecting to virtual phone and a call wasn't over, it automatically recovers it |

For retro-compability reason, events are emitted with 2 formats:

  • jorel-dialog-state-{EVENT_NAME} (ex: jorel-dialog-state-held)
  • ziwo-{EVENT_NAME} (ex: ziwo-held)

You can use addEventListener to listen for ziwo event. Here is how you could simply answer an incoming call.

// Automatically answer incoming call
window.addEventListener('ziwo-ringing', (ev) => {
    // ev holds an instance of the Call in its details
    ev.details.call.answer();
});

Read http://doc-core-front.ziwo.tech/classes/ziwoevent.html) for more details

Commands

| Command | Description | | -------------- | ------------------------------------------------------------------------------------------ | | build | Build the library into /dist | | start | Start the library in watch mode | | start:app | Start the demo application | | start:app:port | Start the demo application on a specific port. Usage: $ PORT=1818 npm run start:app:port | | lint | Run tslint | | test | Run the unit tests | | test:coverage | Display a test coverage report | | doc | Build the documentation | | open:doc | Open the documentation |

Contributing

  1. Fork it (https://github.com/ASWATFZLLC/ziwo-core-front/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Coding standards

Styles

DO:

  1. Use 2 space per indentation
  2. Use Single Quote only '
  3. Surround loop and conditional bodies with curly braces. Statements on same line are allow to omit braces
  4. Commas ,, colons : and semi-colons ; are followed by a single space
  5. End of statement must be followed by semi-colons ;

DO NOT:

  1. Do not use var to declare variable. Instead use const or let
  2. Do not use <type>myVar for casting. Instead use as keyword
  3. Do not declare multiple variables with a single variable statement (let x = 1, y = 2 is forbidden)
  4. Do not use anonymous functions. Instead use arrow functions
  5. Do not include white spaces in import

Files & Declaration

DO:

  1. 1 file per logical component

DO NOT: 2. Do not export type/functions/interface/class unless you need to share it across multiple components

Names

DO:

  1. Use PascalCase for type names
  2. Use PascalCase for enum values
  3. Use camelCase for function names
  4. Use camelCase for property name and local variables
  5. Use whole words when possible. One letter variable names are only allowed in arrow functions

DO NOT:

  1. Do not use _ for private properties
  2. Do not use I as a prefix for interface names

Types

DO:

  1. Variable must all be typed. Type may be omitted if the variable is assigned in the same statement
  2. Function must all have a return type (even void)

DO NOT:

  1. Do not use anonymous types. Instead use Interface
  2. Do not use 'x'|'y' as type. Instead use Enum
  3. Do not include white space before nor after semicolor of type definition
  4. Avoid using type any

Classes

DO:

  1. Always add function visibility (public/private/protected)
  2. Always add property visibility (public/private/protected)
  3. Break the constructor into multiple line in order to keep 1 injection per line
  4. Declare all the properties before the constructor
  5. Declare all the functions after the constructor
  6. Public properties must be declared before private ones
  7. Public functions must be declared before private ones