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

ember-cli-olark

v0.1.1

Published

Initializes and exposes an olark service allowing access to Olark API to your ember application.

Downloads

8

Readme

Ember Observer Score

ember-cli-olark

Simple Olark Service for your Ember CLI app.

This addon lets you inject, configure and interact with the Olark API.

Olark API for Javascript reference doc for details on the usage.

The methods implemented are:

  • TODO / Checklist of Implemented
    • [x] Events (onExpand, onShow, etc.)
      • [x] box.onHide on('hide')
      • [x] box.onShow on('show')
      • [x] box.onExpand on('expand')
      • [x] box.onShrink on('shrink')
      • [x] chat.onReady on('ready')
      • [x] chat.onOperatorsAvailable on('operatorsAvailable')
      • [x] chat.onOperatorsAway on('operatorsAway')
      • [x] chat.onBeginConversation on('beginConversation')
      • [x] chat.onMessageToOperator on('messageToOperator')
      • [x] chat.onMessageToVisitor on('messageToVisitor')
      • [x] chat.onCommandFromOperator on('commandFromOperator')
      • [x] chat.onOfflineMessageToOperator on('offlineMessageToOperator')
    • [ ] Chat conversation
      • [ ] setOperatorGroup
      • [ ] sendMessageToVisitor
      • [ ] sendNotificationToOperator
      • [ ] sendNotificationToVisitor
    • [x] Chat box behavior
      • [x] showBox (Shows the button)
      • [x] hideBox (Hides the button)
      • [x] expandBox (Shows the actual window)
      • [x] shrinkBox (Hides the actual window)
        • [x] setLocale (Sets the language settings for the box)
    • [x] Visitor information
      • [x] getVisitorDetails [returns promise]
      • [x] updateVisitorStatus(string or [array of strings])
      • [x] updateVisitorNickname(string)
      • [x] updateVisitorFullName(fullName)
      • [x] updateVisitorEmail(emailAddress)
      • [x] updateVisitorPhoneNumber(phoneNumber)
      • [x] updateVisitorCustomField(fieldName,fieldValue)
      • [x] updateVisitorCustomFields(pojo)
    • [ ] Pre-chat survey
      • [ ] system.ask_for_name
      • [ ] system.ask_for_email
      • [ ] system.ask_for_phone

Installation

  • ember install ember-cli-olark

Usage and configuration

Configuration

Before using the Olark JS API you need to include it in your HTML. The most convenient way to do it is by using the addon service's OlarkInit method. To do so, you must configure the parameters to use to initialize the Olark API in your config/environment.js file in the OLARK key. The following is a basic example of such a configuration:

  OLARK = {
    identity: 'YOUR IDENTITY KEY'
		configure: [ //NOT YET IMPLEMENTED
			{ 'system.hb_primary_color': '#744da8' }
		]
  }

You need to replace YOUR IDENTITY KEY with your own Olark Identity Key (which can be found in the original embed code provided by Olark)

Usage

If you find yourself, needing the service in all your controllers you could inject the service by default in your controller like the following:

export function initialize(application) {
  application.inject('controller', 'olark', 'service:olark');
}

export default {
  name: 'olark',
  initialize
};

Initialize Olark

Before using Olark you must initialize it. The most convenient way is to call the OlarkInit function of the olark service in your Application route:

import Ember from 'ember';
const {
	inject: {
		service
	}
}
export default Ember.Route.extend({
  olark: service(),

  beforeModel() {
    this.get('olark').OlarkInit();
  }
})

Usage example

import Ember from 'ember';

export default Ember.Route.extend({
  olark: Ember.inject.service(),

  actions: {
		openHelp() {
			const olark = this.get('olark');

			olark.on("expand",() => {
				Ember.debug("Olark Expanded!");
			});

			olark.expandBox();
		},
		closeHelp() {
			const olark = this.get('olark');

			olark.on("shrink",() => {
				Ember.debug("Olark Shrunk!");
			});

			olark.shrinkBox();
		}
	}
});

Running Tests

Before running tests, substitute any occurence of YOUR IDENTITY KEY in tests/unit/services/olark-test.js with your YOUR IDENTITY KEY.

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.