@plasma-platform/promotions

    2.0.9 • Public • Published

    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#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

    Install

    npm i @plasma-platform/promotions

    DownloadsWeekly Downloads

    19

    Version

    2.0.9

    License

    ISC

    Unpacked Size

    153 kB

    Total Files

    4

    Last publish

    Collaborators

    • ch-tm
    • viram
    • kyrylovoronoi
    • tmrdowner
    • soulwish