@plasma-platform/promotions
v2.1.10
Published
Scripts for monster promotions
Downloads
169
Readme
Full documentation
install:
npm i @plasma-platform/promotions -S
Short documentation
Table of Contents
- Main
- Initiators
- Promotion#run
- Promotion#setup
- Promotion#fetchPromocodeInfo
- Promotion#createBanner
- Promotion#createBanner
- Initiators/DomService
- Initiators/FlipClock
- Initiators/UI
- Initiators/Analytics
- Initiators/EventManager
- runTimer
- runTimer
- destroyTimer
- destroyTimer
- createClockTimerInstance
- createClockTimerInstance
- createClockTimerProps
- createClockTimerProps
- Utils
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
selector
string
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
args
Object all arguments
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
args
Object all arguments
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
outTarget
boolean object
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
event
Object jQuery Event
Examples
const uiPopup = new UiPopup({});
$(document).on('click', uiPopup.outTarget);
Initiators/Analytics
TagManager
Parameters
args
Object all arguments
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
Returns Object<any>
createClockTimerProps
Parameters
args
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
data
Object new data
Examples
const params = new Parameters();
params.update({});
Returns Object
Parameters#prepareData
prepare data for all initiators
Parameters
data
Object row parameters
Returns Object data
Parameters#validate
prepare data for time
Parameters
data
Object row parameters
Returns Object validate data
Parameters#other
prepare data for other
Parameters
data
Object row parameters
Returns Object data
Parameters#lang
prepare data for lang
Parameters
data
Object row parameters
Returns Object data
Parameters#validFormatDate
validation date format
Parameters
date
String date
Parameters#time
prepare data for time
Parameters
data
Object row parameters
Returns Object data
Parameters#flipClock
prepare data for flipClock
Parameters
data
Object row parameters
Returns Object final Data
Parameters#banner
prepare data for banner and popup
Parameters
data
Object row parameters
Returns Object final Data