@emartech/me-sdk-bridge

Copyright EMARSYS 2022 All rights reserved.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@emartech/me-sdk-bridge
1.11.0a year ago6 years agoMinified + gzip package size for @emartech/me-sdk-bridge in KB

Readme

me-sdk-bridge-js npm version
This script provides a JS interface that can be injected into an In App Message's html to make communication with the Mobile Engage SDK easier. The following methods are available on the global MEIAM object.

How to integrate

Include the uglified version (index.min.js) in the html.

Methods provided by the bridge

MEIAM.buttonClicked(<buttonId>, <callback>)

MEIAM.close(<callback>)

MEIAM.makeNetworkRequest(<url>, <method>, <headers>, <payload>, <callback>)

MEIAM.openExternalLink(<url>, <callback>)

MEIAM.requestPushPermission(<callback>)

MEIAM.triggerAppEvent(<name>, <payload>, <callback>)

MEIAM.triggerMEEvent(<name>, <payload>, <callback>)

MEIAM.gotoStep(<name>, <callback>)

Custom Attributes provided by the bridge

me-button-clicked="<buttonId>"

Reports button click with given id.

me-close=""

Closes the in-app message. Note that no click event is reported.

me-make-network-request='{"url": "<url>", "method": "<method>", "headers": <headers>, "payload": <payload>}'

href="<url>"

me-request-push-permission=""

me-trigger-app-event='{"type": "<name>", "payload": <payload>}'

me-trigger-event='{"type": "<name>", "payload": <payload>}'

me-goto-step="<name>"

me-copy-to-clipboard="<value>"

Copies the value to the clipboard when clicked.

Development

npm install

Running the tests

npm run test:lint
npm run test:unit
npm run test:e2e

Release new version

A new version is automatically published when merged into master. It's using the Semenatic Release package to create the new version.