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

emarsys-integration-client

v2.8.0

Published

Client library for Emarsys services.

Downloads

549

Readme

emarsys-integration-client-js

Emarsys Integration Client JS is a library providing methods of communication between Emarsys and integrated services running in an iframe.

Requirements

Install

npm install emarsys-integration-client --save

Usage

const { integrationClient } = require('emarsys-integration-client');

const result = await itegrationClient.getUrl({ target: 'email_analysis/list' });
const href = result.data.url;

Legacy usage

Earlier versions of this package required you to create an instance with custom config. Most methods now work without this, but if you are using messageToService explicitly, you might still need to instantiate like this:

var IntegrationClient = require('emarsys-integration-client');
var integrationClient = IntegrationClient.init({
  global: window,
  integrationId: 'my-integration',
  integrationInstanceId: 1234567
});

In the code above, integrationId and integrationInstanceId should have the values passed in the iframe URL.

Library methods

alert.error(text: String)

alert.info(text: String)

alert.log(text: String)

alert.success(text: String)

alert.warn(text: String)

Calling the methods above will render different types of Emarsys UI alerts with the text given.

alert.send(options: Object)

It's a lower level method for displaying custom alerts.

Options

|Field|Role|Mandatory|Default| |-----|----|---------|-------| |text: String|Alert message.|YES| |icon: String|Icon class of the icon to be rendered on the left side of the alert. Eg. 'check' for a check mark or 'exclamation-circle' for an exclamation mark in a circle.|NO| |className: String|Alert sub-class to use when rendering the alert. Eg. 'e-alert-success' for a green bar, 'e-alert-danger' for a red one.|NO| |timeout: Int|Amount of time after the alert will fade out and get removed from the DOM, in milliseconds.|NO|1500|

enableButton(selector: String)

This will enable a button selected.

dialog.close()

Closing the dialog and removing it from DOM.

dialog.confirm(options: Object)

Rendering a confirm dialog.

Options

|Field|Role|Mandatory|Default| |-----|----|---------|-------| |title: String|Title of the confirm dialog.|YES|| |body: String|Body text of the confirm dialog.|NO|| |cancel: String|Text of Cancel button.|YES|| |ok: String|Text of OK button.|YES||

dialog.modal(options: Object)

Rendering a modal dialog with it's content in an iframe.

Options

|Field|Role|Mandatory|Default| |-----|----|---------|-------| |src: String|URL for the iframe providing the modal content.|YES|| |width: Int|Width of the modal.|NO|650| |height: Int|Height of the modal.|NO|500|

dialog.submit(success: Boolean, data: Object)

Submitting a dialog.

Options

|Field|Role|Mandatory|Default| |-----|----|---------|-------| |success: Boolean|True if the result of the dialog is truthy.|YES|| |data: Object|Arbitrary object to send to the originating service.|NO|{}|

getUrl(options: Object)

Returns the url of a preset page. Available targets

Options

|Field|Role|Mandatory| |-----|----|---------| |target: String|The prespecified target you would like a link to.|YES| |params.foo: Object|The general param the actual target needs.|MIXED|

navigate(options: Object)

Navigating the browser to a preset page. Available targets

Options

|Field|Role|Mandatory| |-----|----|---------| |target: String|The prespecified target you would like to head to.|YES| |params.foo: Object|The general param the actual target needs.|MIXED|

refresh()

Reloading the whole page.

resize(height: Int)

Resizing the iframe.

track(options: Object)

Sending a track message.

unload:init(options: Object)

Setting up click handler for <a> elements, popping a navigation confirm dialog when clicked. It makes sense to call this method right after your content gets dirty.

Options

|Field|Role|Mandatory|Default| |-----|----|---------|-------| |selector: String|Selector for ancestor elements of <a> elements.|YES|| |confirm: Object|Options for confirm dialog. See dialog.confirm().|NO|Options for a general unload confirm dialog.|

unload:reset(selector: String)

Stopping to watch click events of elements selected by selector. It makes sense to call this method right after your content gets clean (ie. saved).

Contributing

See Contribution guideline.

Code of Conduct

See Code of Conduct here.

Licensing

MIT