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

@plasma-platform/promotions

v2.1.10

Published

Scripts for monster promotions

Downloads

169

Readme

version nextVersion downloads license dependency


Full documentation install: npm i @plasma-platform/promotions -S

Short documentation

Table of Contents

Main

start project npm i && npm start

Initiators

Promotion

Parameters

  • args Object arg only for FlipClock

Examples

const promotion = new Promotion();

getAll

Get all elements by selector

Parameters

Returns any

Promotion#run

Initialise banner

Examples

const promotion = new Promotion();
promotion.run();

Promotion#setup

Examples

const promotion = new Promotion();
promotion.setup();

Promotion#fetchPromocodeInfo

Fetches promocode info with start and end dates.

Examples

const promotion = new Promotion();
promotion.setup();

Promotion#createBanner

Creates Banner instance and initiate it

Examples

const promotion = new Promotion();
const banner = promotion.createBanner(tagManager);

Promotion#createBanner

Creates Popup instance and initiate it

Examples

const promotion = new Promotion();
const popup = promotion.createPopup(banner, tagManager);

Initiators/DomService

DomService

get

Get element by selector

Parameters

  • selector

Returns any

data

Get data attributes

Parameters

  • element

Returns {}

addClass

Add class

Parameters

  • element
  • classList (optional, default [])

Returns any

attr

Attributes

Parameters

  • element
  • key
  • value

Returns any

prepend

Prepend

Parameters

  • parent
  • element

Returns any

removeClass

Remove class

Parameters

  • element
  • classList

Returns any

hasClass

Has class

Parameters

  • element
  • className

Returns boolean

removeAttribute

Remove Attribute

Parameters

  • element
  • name

Returns any

Initiators/FlipClock

Initiators/UI

UiBanner

Parameters

Examples

const uiBanner = new UiBanner({});

UiBanner#run

run banner function

Parameters

  • tagManager Object manager for dataLayer variable

Examples

const uiBanner = new UiBanner({});
uiBanner.run();

UiBanner#showBanner

show banner function

Examples

const uiBanner = new UiBanner({});
uiBanner.showBanner();

UiBanner#getBannerId

get banner id function

Examples

const uiBanner = new UiBanner({});
uiBanner.getId();

UiBanner#showBannerAnimation

Triggers animation, that show banner

Examples

const uiBanner = new UiBanner({});
uiBanner.showBannerAnimation();

UiBanner#closeBanner

Close banner upon user click

Examples

const uiBanner = new UiBanner({});
uiBanner.closeBanner();

UiBanner#hideBanner

hides banner and destroying timer

Examples

const uiBanner = new UiBanner({});
uiBanner.hideBanner ();

UiBanner#hideBannerAnimation

Trigger for hide banner animation

Examples

const uiBanner = new UiBanner({});
uiBanner.hideBannerAnimation();

UiBanner#setBannerCookie

Set expiration cookie on banner closing

Examples

const uiBanner = new UiBanner({});
uiBanner.setBannerCookie();

UiBanner#killBanner

Utility method to handle banner destruction

Examples

const uiBanner = new UiBanner({});
uiBanner.killBanner();

UiPopup

Parameters

Examples

const uiPopup = new UiPopup({});

UiPopup#run

run popup function

Parameters

Examples

const uiPopup = new UiPopup({});
uiPopup.run();

UiPopup#showBanner

show popup function

Examples

const uiPopup = new UiPopup({});
uiPopup.showPopup();

UiPopup#hidePopup

hide popup function

Parameters

Examples

const uiPopup = new UiPopup({});
uiPopup.hidePopup();

UiPopup#hidePopup

hide popup function with set cookie about not open again

Examples

const uiPopup = new UiPopup({});
uiPopup.hidePopupWithSetCookie ();

UiPopup#outTarget

outTarget popup click function

Parameters

Examples

const uiPopup = new UiPopup({});
$(document).on('click', uiPopup.outTarget);

Initiators/Analytics

TagManager

Parameters

Examples

const tagManager = new TagManager({});

TagManager#onClickBanner

Tag manager event click banner

Examples

const tagManager = new TagManager({});
tagManager.onClickBanner();

TagManager#onShowBanner

Tag manager event show banner

Examples

const tagManager = new TagManager({});
tagManager.onShowBanner();

TagManager#onClickPopup

Tag manager event on popupp click

Examples

const tagManager = new TagManager({});
tagManager.onClickPopup();

TagManager#onShowPopup

Tag manager event on popups show

Examples

const tagManager = new TagManager({});
tagManager.onShowPopup();

Initiators/EventManager

runTimer

runTimer

destroyTimer

destroyTimer

createClockTimerInstance

Parameters

  • timerFace
  • timerFace string One of: daily, hourly, counter

createClockTimerInstance

Parameters

  • timerFace
  • timerFace string One of: daily, hourly, counter

createClockTimerProps

Parameters

  • args
    • args.direction string? timer direction (decrement | increment)
    • args.startDateMs number? timer start date
    • args.endDateMs number timer end date
    • args.language string? timer localization
    • args.id string timer name
    • args.timerFace string timer type

Returns Object<any>

createClockTimerProps

Parameters

  • args
    • args.direction string? timer direction (decrement | increment)
    • args.startDateMs number? timer start date
    • args.endDateMs number timer end date
    • args.language string? timer localization
    • args.id string timer name
    • args.timerFace string timer type

Returns Object<any>

Utils

Other instruments for normal working project

Parameters

Parameters

  • selector string selector to main wrapper for promotion block

Examples

const params = parameters.parse('.Promotion');

Parameters#parse

Parse and return all params

Parameters

  • selector string jQuery selector

Examples

const params = new Parameters();
params.parse('.Promotion');

Returns Object

Parameters#update

Parse and return all params

Parameters

Examples

const params = new Parameters();
params.update({});

Returns Object

Parameters#prepareData

prepare data for all initiators

Parameters

Returns Object data

Parameters#validate

prepare data for time

Parameters

Returns Object validate data

Parameters#other

prepare data for other

Parameters

Returns Object data

Parameters#lang

prepare data for lang

Parameters

Returns Object data

Parameters#validFormatDate

validation date format

Parameters

Parameters#time

prepare data for time

Parameters

Returns Object data

Parameters#flipClock

prepare data for flipClock

Parameters

Returns Object final Data

Parameters#banner

prepare data for banner and popup

Parameters

Returns Object final Data