Members
-
<constant> host
-
Singleton instance
- Source:
-
<constant> languageToLocale
-
Supported languages/locales for the website.
This is placed here so that we have a single place in JavaScript to store this information.
- Source:
-
<constant> modules
-
The list of modules in order of execution
- Source:
-
<constant> modules
-
The list of modules in order of execution
- Source:
-
<constant> modules
-
The list of modules in order of execution
- Source:
-
<constant> platform :module:platform~Platform
-
Instance of the class of this module
Type:
- module:platform~Platform
- Source:
Methods
-
_findLocale(languages)
-
Helper function to find and return the first valid locale in the list of supported lanugages.
Parameters:
Name Type Description languages
array Supported languages
Returns:
- Valid locale in supported languages
- Type
- external:Locale
-
_isGfDomain(location)
-
Utility function for determining brand from the URL
Parameters:
Name Type Description location
string the domain
- Source:
Returns:
- Type
- boolean
-
_isUnbounceDomain(location)
-
Utility function for determining brand from the URL
Parameters:
Name Type Description location
string the domain
- Source:
Returns:
- Type
- boolean
-
_saveLocale(element)
-
Helper function to save locale based on attribute value of an element. (This will fail if the desired attribute is not found).
Parameters:
Name Type Description element
HTMLElement An element in a NodeList
Returns:
- Type
- boolean
-
beforeEachCustom( [scriptSrc])
-
Perform actions manually before each test
We cannot use Jest's
beforeEach
, because it does not support passing parameters.Parameters:
Name Type Argument Description scriptSrc
Location <optional>
Value for the
src
attribute of the script -
getCanonicalPath(pathname)
-
Set the canonical path, so google analytics page views are tracked properly
Parameters:
Name Type Description pathname
external:Location.pathname The URI of the current page
- Source:
Returns:
The path with the language code removed
- Type
- string
-
languageFromLocale(locale)
-
Extract the language from the locale string (the first two characters)
Parameters:
Name Type Description locale
string A known locale written in a specific format
- Source:
- To Do:
-
- Consider creating an `@external` for two-digit locales
- Consider creating a `@typedef` for our language syntax
Returns:
A known language name written in a specific format
- Type
- string
-
languageFromRequestUri(requestURI)
-
Extract the language prefix and return it or a default
Parameters:
Name Type Description requestURI
external:Location.pathname The URI from which to extract the language
- Source:
Returns:
A valid language
- Type
- boolan
-
module:referringSite()
-
If our referrer is not us and not one of the above ignored domains, set the
referring_site
cookie.Expiration is unset (expires when browser is closed) because this was a "session" based cookie originally in Scala.
-
module:sentryErrorReporting()
-
Initialize Sentry
-
toString()
-
Return the URL search parameter string corresponding to the UTM parameters
- Source:
Returns:
the search parameter string
- Type
- string