This package has been deprecated

Author message:

This package is now deprecated. Please read bit.ly/47JtIk0 to learn how to integrate Purple Dot into your Shopify storefront

@purple-dot/purple-dot-js

0.2.2 • Public • Published

PurpleDot.js SDK ES Module

An ES module wrapper for the purpledot.js SDK.

Note: This package wraps the PurpleDot object provided by the purpledot.js library and dynamically loads the underlying script. It does not bundle the full source code.

Installation

npm install @purple-dot/purple-dot-js

Usage

loadPurpleDot

This function returns a promise that resolves with the PurpleDot object provided by the SDK. If not included already, it will inject the script tag into your page and load it. When called in a server environment it returns null.

import { loadPurpleDot } from '@purple-dot/purple-dot-js';

// Injects the script and loads the SDK
const purpleDot = await loadPurpleDot();

// Use the SDK as usual
purpleDot.init({ apiKey: '5f6b6189-5380-423d-8f59-6c34eb61bbff' });
purpleDot.load({ placementType: 'button' });

Readme

Keywords

Package Sidebar

Install

npm i @purple-dot/purple-dot-js

Weekly Downloads

388

Version

0.2.2

License

MIT

Unpacked Size

9.64 kB

Total Files

10

Last publish

Collaborators

  • alexstapleton
  • andrew-rennie
  • domk
  • jcs180
  • rtkaleta