Full documentation
install:
npm i @plasma-platform/promotions -S
- 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
start project npm i && npm start
-
args
Object arg only for FlipClock
const promotion = new Promotion();
Get all elements by selector
-
selector
string
Returns any
Initialise banner
const promotion = new Promotion();
promotion.run();
const promotion = new Promotion();
promotion.setup();
Fetches promocode info with start and end dates.
const promotion = new Promotion();
promotion.setup();
Creates Banner instance and initiate it
const promotion = new Promotion();
const banner = promotion.createBanner(tagManager);
Creates Popup instance and initiate it
const promotion = new Promotion();
const popup = promotion.createPopup(banner, tagManager);
Get element by selector
selector
Returns any
Get data attributes
element
Returns {}
Add class
element
-
classList
(optional, default[]
)
Returns any
Attributes
element
key
value
Returns any
Prepend
parent
element
Returns any
Remove class
element
classList
Returns any
Has class
element
className
Returns boolean
Remove Attribute
element
name
Returns any
-
args
Object all arguments
const uiBanner = new UiBanner({});
run banner function
-
tagManager
Object manager for dataLayer variable
const uiBanner = new UiBanner({});
uiBanner.run();
show banner function
const uiBanner = new UiBanner({});
uiBanner.showBanner();
get banner id function
const uiBanner = new UiBanner({});
uiBanner.getId();
Triggers animation, that show banner
const uiBanner = new UiBanner({});
uiBanner.showBannerAnimation();
Close banner upon user click
const uiBanner = new UiBanner({});
uiBanner.closeBanner();
hides banner and destroying timer
const uiBanner = new UiBanner({});
uiBanner.hideBanner ();
Trigger for hide banner animation
const uiBanner = new UiBanner({});
uiBanner.hideBannerAnimation();
Set expiration cookie on banner closing
const uiBanner = new UiBanner({});
uiBanner.setBannerCookie();
Utility method to handle banner destruction
const uiBanner = new UiBanner({});
uiBanner.killBanner();
-
args
Object all arguments
const uiPopup = new UiPopup({});
run popup function
const uiPopup = new UiPopup({});
uiPopup.run();
show popup function
const uiPopup = new UiPopup({});
uiPopup.showPopup();
hide popup function
-
outTarget
boolean object
const uiPopup = new UiPopup({});
uiPopup.hidePopup();
hide popup function with set cookie about not open again
const uiPopup = new UiPopup({});
uiPopup.hidePopupWithSetCookie ();
outTarget popup click function
-
event
Object jQuery Event
const uiPopup = new UiPopup({});
$(document).on('click', uiPopup.outTarget);
-
args
Object all arguments
const tagManager = new TagManager({});
Tag manager event click banner
const tagManager = new TagManager({});
tagManager.onClickBanner();
Tag manager event show banner
const tagManager = new TagManager({});
tagManager.onShowBanner();
Tag manager event on popupp click
const tagManager = new TagManager({});
tagManager.onClickPopup();
Tag manager event on popups show
const tagManager = new TagManager({});
tagManager.onShowPopup();
timerFace
-
timerFace
string One of: daily, hourly, counter
timerFace
-
timerFace
string One of: daily, hourly, counter
-
args
Returns Object<any>
-
args
Returns Object<any>
Other instruments for normal working project
-
selector
string selector to main wrapper for promotion block
const params = parameters.parse('.Promotion');
Parse and return all params
-
selector
string jQuery selector
const params = new Parameters();
params.parse('.Promotion');
Returns Object
Parse and return all params
-
data
Object new data
const params = new Parameters();
params.update({});
Returns Object
prepare data for all initiators
-
data
Object row parameters
Returns Object data
prepare data for time
-
data
Object row parameters
Returns Object validate data
prepare data for other
-
data
Object row parameters
Returns Object data
prepare data for lang
-
data
Object row parameters
Returns Object data
validation date format
-
date
String date
prepare data for time
-
data
Object row parameters
Returns Object data
prepare data for flipClock
-
data
Object row parameters
Returns Object final Data
prepare data for banner and popup
-
data
Object row parameters
Returns Object final Data