2.1.10 • Published 10 days ago

@plasma-platform/promotions v2.1.10

Weekly downloads
260
License
ISC
Repository
gitlab
Last release
10 days ago

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

2.1.9

10 days ago

2.1.10

10 days ago

2.1.8

10 days ago

2.1.7

11 days ago

2.1.4

12 months ago

2.1.3

12 months ago

2.1.6

11 months ago

2.1.5

12 months ago

2.1.2

1 year ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.7

3 years ago

2.0.5

3 years ago

2.0.6

3 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.12.1-alpha.2

4 years ago

1.12.1-alpha.0

4 years ago

1.12.1-next.0

4 years ago

1.11.10-next.0

4 years ago

1.12.0

4 years ago

1.11.9

4 years ago

1.11.8

4 years ago

1.11.5

4 years ago

1.11.4

4 years ago

1.11.3

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.2-next.0

4 years ago

1.7.0-next.0

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.6

4 years ago

1.5.5

4 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.6

5 years ago

1.3.12-alpha.0

5 years ago

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.3.11-alpha.0

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.10-alpha.0

5 years ago

1.3.9-alpha.0

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.1.0-alpha.0

5 years ago

1.0.9

5 years ago

1.0.11-alpha.0

5 years ago

1.0.10-alpha.0

5 years ago

1.0.9-alpha.0

5 years ago

2.0.1-alpha.0

5 years ago

2.0.0-alpha.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.7-alpha.0

5 years ago

1.0.6-alpha.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.1-alpha.0

5 years ago

1.0.0

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.14

5 years ago

0.2.14-alpha.0

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.13-alpha.0

5 years ago

0.2.12-alpha.0

5 years ago

0.4.0-alpha.0

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.4-alpha.0

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago