Members
(constant) Api
Helper functions for API
- Source:
Class
List of all html classes in the app
- Source:
(constant) FilterStyle
Manages filter styles
Globals
The global variable object
- Source:
historyState :Object
The current history state object
Type:
- Object
- Source:
Labels
List of all text labels in the app
- Source:
Selector
List of all css selectors in the app
- Source:
Settings
List of all settings in the app
- Source:
Methods
addProductClickData(data)
Add product click data in local storage.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | product click data |
- Source:
BoostPFSFilterCallback(result)
The JSONP callback function for our API.
Parameters:
Name | Type | Description |
---|---|---|
result |
- Source:
buildAddressBarUrl() → {string}
Build address bar URL from Globals.queryParams object.
- Source:
Returns:
- New URL
- Type
- string
buildProductClickData(productId, userAction, action) → {Object}
Build product click data in collection/search page and in instant search.
Parameters:
Name | Type | Description |
---|---|---|
productId |
Number | |
userAction |
AnalyticsEnum.UserAction | UserAction enum |
action |
AnalyticsEnum.Action | Action enum |
- Source:
Returns:
data - the click data to be add to localStorage/send to server.
- Type
- Object
callFilterApi(eventType, successCallback, errorCallback, errorCount)
Calls API with JSONP.
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string | |
successCallback |
function | |
errorCallback |
function | |
errorCount |
number |
- Source:
generateUUID() → {string}
Generates a random unique session ID
- Source:
Returns:
random unique ID
- Type
- string
getApiUrl(type) → {string}
Gets API url
Parameters:
Name | Type | Description |
---|---|---|
type |
string | 'search' or 'suggestion' |
- Source:
Returns:
- The API url
- Type
- string
getFilterData(eventType, successCallback, errorCallback)
Calls API with JSONP.
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string | |
successCallback |
function | |
errorCallback |
function |
- Source:
getFilterParams(url)
Update the Globals.queryParam object
from the current URL. This is called once on app load.
Parameters:
Name | Type | Description |
---|---|---|
url |
- Source:
getSettingValue(id) → {string}
Get value from setting based on id
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The setting id, for example 'general.showLoading' |
- Source:
Returns:
- Type
- string
init()
Init the analytics events
- Source:
init()
Init global variables by merging various settings
- Source:
init()
Init labels by merging various settings
- Source:
init()
Init history state with default values.
Bind to 'popstate' event to reinit the history
- Source:
init()
Init css selectors by merging various settings
- Source:
init()
Init settings by merging various settings:
boostPFSConfig - in app lib
boostPFSAppConfig - in snippets/boost-pfs.liquid
boostPFSThemeConfig - in sections/collection-template.liquid, templates/search.liquid
boostPFSFilterConfig - in boost-pfs-filter.js
boostPFSInstantSearchConfig - in boost-pfs-search.js
- Source:
initCollectionSearchPage()
Init analytics on collection/search page
- Source:
initInstantSearch()
Init analytics on instant search
- Source:
initOtherPage()
Init analytics on product page.
Find and send a product click data in localStorage to server.
- Source:
initShortenUrl()
Init mapping for shorten URL params
- Source:
inject(scope)
Injects all components into a scope, to override and customize outside applib.
Parameters:
Name | Type | Description |
---|---|---|
scope |
inject(scope)
Injects all components into a scope, to override and customize outside applib.
Parameters:
Name | Type | Description |
---|---|---|
scope |
- Source:
newFilterTree(id, filterTreeType) → {FilterTree}
Creates a new FilterTree instance
Parameters:
Name | Type | Description |
---|---|---|
id |
string | id of the filter tree (ex: 'boost-pfs-filter-tree') |
filterTreeType |
FilterTreeEnum | 'vertical' or 'horizontal' |
Returns:
- A new instance of FilterTree or its inherited style class
- Type
- FilterTree
onClickProductInFilterResult(event)
Handle analytic on click product list in the collection/search page.
Save the clicked product data to localStorage.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the click event |
- Source:
onClickProductInSuggestion(event)
Handle analytic on click product in search suggestion.
Save the clicked product data to localStorage.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | the click event |
- Source:
onPopState()
On back button
- Source:
prepareFilterParams(params, eventType) → {Object}
Build the params object for Filter API.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | |
eventType |
string |
- Source:
Returns:
- Type
- Object
prepareRequestParams(eventType)
Prepare the Globals.queryParams before sending API request.
It merges Globals.queryParams
and extra params (page, limit, currency,...).
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string |
- Source:
prepareSearchParams(params, eventType) → {Object}
Build the params object for Search API.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | |
eventType |
string |
- Source:
Returns:
- Type
- Object
revertPriceParams(params)
Revert price in queryParams to default currency (Multi-currency)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The query params |
- Source:
sendProductClickData(data, triedToGetToken)
Send product click data to server.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | product click data |
triedToGetToken |
boolean | tried to get cart token by calling cart.js or not |
- Source:
setAddressBarPathAfterFilter(path)
Set the new address bar path (when changing collections/tags)
after filtering
Parameters:
Name | Type | Description |
---|---|---|
path |
string |
- Source:
setApiLocaleParams(params)
Set the locale param for our api
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | The request params |
- Source:
setDefaultValueForExcludedFields(apiResult)
The API exclude some product fields in the response.
We set the default values for these field.
Parameters:
Name | Type | Description |
---|---|---|
apiResult |
- Source:
setDefaultValueForExcludedFields(apiResult)
The API exclude some product fields in the response.
We set the default values for these field.
Parameters:
Name | Type | Description |
---|---|---|
apiResult |
- Source:
setWindowTitleAfterFilter(title)
Set the new window title (when changing collections/tags/pages)
after filtering
Parameters:
Name | Type | Description |
---|---|---|
title |
string |
- Source:
updateAddressBar()
Update the address bar using Globals.queryParams object
Push new state to history
- Source:
updateParamsFromUrl(url)
Update the Globals.queryParam object
from the current URL. This is called once on app load.
Parameters:
Name | Type | Description |
---|---|---|
url |
- Source: