component

Component that handles additional donation input in the cart

component

This component is meant to be included on thank-you pages for one-time additional gifts (spon & ecomm) to ensure that data is commited/cleared properly.

component

Component that displays on Cart page when basket is empty.

component

Component which displays a 'checkout' button in combo-cart-order-summary. We display only one button. The value of the button is set conditionally depending on the checkout type. We need only one button and route users based on it's value because the submission happens only ater the form validation, which accepts only one callback function. The one button approach is also needed to enable proper routing of users if they use keyboard and press "Enter" key to go to the next step. (TW#10434964)

component

Responible for finalizing receipt generation and clearing cart contents. Very hacky - but provides a clear way to implement this functionality with injections in LOM thank-you pages.

component

Combo cart ecard success message component. Displays above 'thank you' copy on success page after user is redirected there following a successful ecard submission carrying an ECARD_SUCCESS_URL param.

component

TW#9958154 - Module to output ids collected from various modules of combo cart. Will be used in testing only.

component

2017-10-30: EM, this component doesn't seem to be in use

component

Remove button that appears next to the sponsored child in cart

component

Component used to facilitate cart summary interactions between the app and the ecomm-cart.js lib. Allows data to be sent to vuex in addition to being stored in cookie.

buttonValue

Sets the submit button value parameter, which will be used to determine where to route the user upon the form submission.

Returns String The value of the submit button

isNative

Is this native checkout, there are no sponsorships & no gift sponsorships.

Returns Boolean

isSpon

Is this a sponsorship only checkout. There are sponsorships, but no gift sponsorships.

Returns Boolean

isGiftSpon

Is this gift spon checkout. There is at least one gift sponsorships.

Returns [type] [description]

giftSponDetailsNextStep

Handler for events when 'continue' button is clicked on a gift spon input form and of the if the child profile click. If we queued up a child to see, go to that profile. Else if multiple gift spons then proceed to next. Else, proceed to the billing step

setActiveChildId

Set the first gift sponsorship child as active

Parameters

goToSponsorship

Trigger form submission, which will decide were to go next after the form is validated. We set the next child id as component data, as we can't pass that through to the parent's validation callback.

Parameters

ComboCartOrderSubmitSuccessComponent

This component processes the successful eCommerce (gift catalog only) transaction.

handleCartFormSubmission

Handles the form submission once the form validates

Parameters

submitForm

Handles the billing form submission. Is invoked as a callback to the enableValidation(), will be executed only when the form is valid.

Returns Boolean Always returns false to prevent default form submission

nextStep

Handles from submission. The function is involed by enableFormValidation as a callback, only when the form is valid.

Returns Boolean Must return false to prevent default form submission.

nextStep

Handles the shipping form submission. Is invoked as a callback to the enableValidation(), will be executed only when the form is valid.

Parameters

Returns Boolean Always returns false to prevent default form submission

ComboCartSponsorshipRecipientRow

A single row representing a sponsorship in the ecomm cart.

ComboCartSponsorshipRowComponent

A single row representing a sponsorship in the ecomm cart.

triggerAnalytics

Triggers an analytics call, based on the location Parameter ecommPage EcommPage object set in global scope. Assigning to a variable for ease of knowing where it came from.

filter

Format a numeric amount into currency.

filter

Convert a sponsorship frequency string to its shorthand equivilant.

cartAjaxSubmit

Facilitate fetching, embdding and submitting of user's ecomm cart. Primarily, this function is used when the user is on an interstitial step of the combo cart process (ex. Gift Spon input) and needs to work back into the Ecomm workflow.

Returns any jqXHR

childNameConcatenator

Function that accepts an array of Child records and returns a human-readable concatenation of child names, like so:

[Child] => Name [Child, Child] => Name and Name [Child, Child, Child] => Name, Name and Name

Parameters

cloneProps

Simple function which clones the properties of the provided object. Returns

default if param is not an object.

Parameters

Returns any mixed

ComponentMounter

Helper to dynamically mount Vue components to page. Ensures that component exists before mounting. Provides mounting instance methods per http://v1.vuejs.org/api/#Instance-Methods-DOM

Component arguments must be registered Vue compnents as returned by http://v1.vuejs.org/api/#Vue-component

appendTo

Append the component to the specified element.

Parameters

after

Mount component after the specified element.

Parameters

before

Mount component before the specified element.

Parameters

_mnt

Instantiate component, mount and return.

Parameters

Returns any obj

_exists

Determine if the component exists in scope.

Parameters

Returns any bool

STCCookie

A wrapper class for ease of setting cookies.

set

Hard set the value of the cookie.

Parameters

Returns any string String value of cookie.

get

Retrieve value of the cookie.

Returns any string|undefined

getJSON

Retrieve value of serialized json object from cookie.

Returns any obj|undefined

remove

Remove the cookie

Returns undefined The value of the cookie, which will be undefined

_set

Native cookie setting method. Passes cookie name and configs to Cookies lib.

Parameters

Returns any string String value of cookie.

BasketCookie

Extends STCCookie

Provides a common interface for working with the stc-basket cookie.

BuyerCookie

Extends STCCookie

Provides a common interface for working with the stc-buyer cookie.

STCLocalStorage

Class for implementing local storage.

Parameters

set

Hard set the data.

Parameters

Returns any string String value of cookie.

get

Retrieve data

Returns any string|undefined

BasketItemsLocal

Extends STCLocalStorage

Class for storing basket items.

EcardRedirectData

Extends STCLocalStorage

Class for storing basket items.

ProductCategoryMap

Extends STCLocalStorage

Creates an object map of product ids => categories

ReceiptLocal

Extends STCLocalStorage

Class for storing basket items.

EcommCartItem

When passed a jquery object containing an ecomm product (as selected from an ecomm page) this class extracts pertinent details about the product and returns an object containing those details.

Parameters

_parseEl

Kickoff the parsing process.

Parameters

isSponsorship

Is this a sponsorship?

Returns any bool

isProduct

Is this a product?

Returns any bool

getData

Return the data of this item.

_parseRowId

Parses a product's ID out of a '.ShoppingCartRow'.

Parameters

Returns any int

_parseRowName

Parses a product's name out of a '.ShoppingCartRow'.

Parameters

Returns any string

_parseRowQuantity

Parses product quantity out of a '.ShoppingCartRow'.

Parameters

Returns any int

_parseRowQuantityIndex

Parses product quantity index out of a '.ShoppingCartRow'. Pull name attribute and extract index of this quantity object in cart.

Parameters

Returns any int

_parseRowCost

Parses product quantity out of a '.ShoppingCartRow'.

Parameters

Returns any int

_type

Return a 'type' for this item.

Returns any string

getCategory

Determine the category of this product.

Parameters

Returns any string Name of category product belongs to

EcommCartSummarizer

Creates summary of ecomm cart passed on array of EcommCartItem items passed.

Parameters

EcommCart

Library used to facilitate communication with eComm shopping cart. Especially for purposes of manipulating cart contents via ajax and retrieving details about active cart contents.

Of particular interest is the updateBasket() method which retrieves cart contents from Ecomm, writes to cookie then updates My Basket in header. This method can be called to keep cart contnets in sync with ecomm rather than relying on parity between ecomm/cookie.

Parameters

_init

Initialize this object. Note that this relies on window.sponsorshipDetails to be populated via reus_sponsorship_details_global_js or for an object with storeId, sponsorshipProductId and sponsorshipCost to be passed into the constructor.

Parameters

addSponsorship

Add a sponsorship to the cart.

Returns any jqXHR

registerProductId

Registers a product id to its category for later use. Do it only on the product page, else data is inaccurate

Parameters

_addToCart

Add item to the eComm cart. Allows passing of eventNames to be called on success/error.

Parameters

Returns any jqXHR jQuery promise useful for chaining.

addProductForm

Add item to cart by submitting raw params from a form representing an ecomm product. More flexible than this.addtoCart() as it allows for any number of additional options to be passed in directly as they appear on form.

Parameters

Returns any jqXHR

summaryPromise

Return a promise for the summary value.

Returns any $.promise()

_productAddFailed

Adding a product failed.

_sponsorshipQtyUpdateFailed

Updated sponsorship quantity failed. Throws event.

updateBasket

Call ecomm to get basket details and update element in header. Ensure that $menuBasketItem is loaded into global space first.

Returns any Promise

setSponsorshipsQty

Set the new number of sponsorships in the cart. Due to the way ecomm works, we must performa a hard set on the quantity of every item in cart via its associated quantity_ parameter.

Parameters

Returns any jqXHR

getSponsorshipItem

Return sponsorship item object from cart. Else, return null.

Returns any obj|null

getCartItems

Return array of cart items (non-sponsorships).

Returns any array

numSponsorships

How many sponsorships are in the cart.

Returns any int

_dataAddToCart

Returns data for add objects to cart.

Parameters

Returns any obj

_raiseEvents

Raise events by iterating over an array of event names.

Parameters

Returns any null

cartConfig

Generate cart configuration object.

EcommManipulator

Class used to manipulate ecomm pages.

EcommPage

Class which provides feedback about which page in the LOM Ecomm module the user is currently viewing. Requires current wrapper to be outfitted with EM's singularly awesome reus_body_class include as this library uses those classes to determine the page.

Requires jQuery.

is

Is this an ecomm page of any kind (based on existence of store class on body element)?

_classCheck

Determine if body contains a particular class. Used by other convenience methods to determine actual page.

Parameters

Returns any bool

isHome

Is this the ecomm store's homepage?

Returns any bool

isCategory

Is this a category page?

Returns any bool

isProduct

Is this a product page?

Returns any bool

isCart

Is this the cart?

Returns any bool

isShipping

Is shipping page?

Returns any bool

isBilling

Is billing page?

Returns any bool

isConfirmation

Is Confirmation page?

Returns any bool

isECard

Is this the ecard conformation page?

Returns any bool

isThankYou

Is thank you page?

Returns any bool

EcommTagMounter

Convenience class for mounting tags on ecomm pages.

autoMount

Automatically detect the page we're on and mount tags.

mountAll

Mount tags on all ecomm pages.

mountCartTags

Mount tags for the cart page.

mountConfirmationPage

Mount tags for the confirmation page.

mountThankYouPage

Mount tags for the thank-you page.

mountBillingPage

Mount tags for bililng page.

mountShippingPage

Mount tags for bililng page.

moountBillingPage

Mounts tags on the billing page.

isTyped

Filtering predicates

Parameters

getCartItems

Collections

Parameters

goToSponCheckout

Proceed to spon checkout page.

Returns any true

normalizeGiftSponsorship

Function to normalize the format of gift sponsorship object. Specifically, set the state property equal to the intl_state property then delete the latter.

Parameters

Returns any obj

birthdayBetween

Does this child's birthday fall between two dates? Date check is fully inclusive of both dates.

Note that the child object contains separate birth month/day fields and no complete birthdate object so we have to perform some checks for date overlap in case start/end span across months.

WARNING: The span of time between start and end should not be more than a single month. The current logic is not setup to allow multi-month spanning ranges.

Parameters

Returns any bool

TagMounter

Library for mounting custom tags to DOM. Requires jQuery.

mount

Mount a custom HTML tag to the DOM.

Parameters

StcBasketMixin

Provides common access to cart basket.

childIconActionsMixin

Deals with interactions for the icon that is displayed in search results

Note: For this mixin to work the child object must have been fetched from ODS with their countryOffice expanded. (ie. $expand=community($expand=impactArea($expand=countryOffice)))

childLivesInMixin

Calculates value for "i live in" attribute of a child's record. The child's home country should be returned for this attribute. Because the ODS data model is not strictly geographic and requires some aliasing it is necessary to apply some logic here rather than simply returning a string from the child's record.

Note: For this mixin to work the chid object must have been fetched from ODS with their countryOffice expanded. (ie. $expand=community($expand=impactArea($expand=countryOffice)))

countryIsDomestic

Is the provided country "domestic" (USA / Canada)

Parameters

Returns any bool

isSearchMixin

Exposes isSearch(). Returns true if Vue router is available on we're on a search page.

StaticMixin

Expose isStatic prop. If set to true then after a VM has fully loaded we destroy the VM while leaving the DOM element in place. This effectively makes the content of that component static.

transactionReceiptMixin

Provides convenient access to receipt store.

getAdditionalDonationAnalytics

Retrieves the details about the additional donation information from cart. Returns an object that will go into digitalData.donation object only.

Parameters

getAdditionalDonationFormAnalytics

Retrieves form details for the additional donation from the cart. Returns an object that will go into digitalData.form object only.

Parameters

getDonorTypeAnalytics

Grabs user's type parameters from a variable embedded on the page or a logged in user's Cookie.

Parameters

Returns Object JSON object with details about the donor type

getDonorTypeFromCookie

Cookie is always now set on all types of user logins, so we give this a priority over DTM & API call DMT also reads info from the cookie, so best to stick with a source of truth.

Parameters

getDonationJourneyAnalytics

Returns an object with details of user journey, which is determined based on the location in the checkout flow.

Parameters

getFormNameAndId

Sets default form properties, namely name & id, based on our location in the checkout flow. The default is the thank you page, as this function also gets called there.

Parameters

getProductItemsForAnalytics

Takes all the products from the store and puts them into an array for analytics

Parameters

Returns Array An array of catalog items

getSponsorshipFormInfo

Creates an object that will passed along into Analytics for digitalData.form object

Parameters

Returns [type] [description]

getSponsorshipsAsProducts

Gets all sponsorship items from the store, packages them as eCommerce items, includes additional child details. Original Analytics specs didn't define any of this, so this was added on 2017-06-06 in agreement with STC & Adobe to enable them to get all the necessary data points for reporting.

Parameters

resetAnalyticsData

Resets all the analytics data

Parameters

Returns [type] [description]

setChildAddedSponsorshipAnalytics

Sets information about the child that has been added to the cart, also include viewed children statistics. Gets called when the child is added to a cart.

Parameters

setChildProfilesViewedAnalytics

Updates the number of children's individual profiles has been viewed.

Parameters

setChildrenViewedCountAnalytics

Updates the number of the children that has been viewed, in a list. Is called by a mixin in sponsorship.

Parameters

setChildSearchParametersAnalytics

Gets called each time we have a pageview in sponsorship, so the data is updated. As pageview clears the history. Grab child viewed stats & merges them with an child details object, so the data is complete.

Parameters

setChildNumberAndClickedAnalytics

Sets the statistics on how many children a user saw and how many profiles were clicked on. This is called in the checkout process, it enables to see how profiles viewed can relate to the success of the transaction.

Parameters

setCombinedConfirmationCodesAnalytics

Writes confirmation codes from the store/local storage into the analytics object

Parameters

setComboCartAnalytics

Sets combo cart analytics, gets called in the native cart on both gift catalog and combo transactions. Retrieves full transaction details for analytics, sets the data into Vuex store & into digitalData object.

Parameters

setConfirmationIdAnalytics

Sets the confirmation code into analytics store as purchaseId and transactionId. Value of the code is expected to be passed in.

Parameters

setConfirmationIdFromAPIAnalytics

Called when a sponsorship only billing form is submitted. Processes API response and sets confirmation ID based on the response.

Parameters

setDonationAndFormAnalytics

Sets the details about the form and donation into digitalData. Called on donation amount update. We fake the thank you page on sponsorship checkout as we get the transaction details there. We need the thank you page information to be sent to analytics.

Parameters

setFormSubmissionErrorAnalytics

When the form submission fails, track the error in analytics

Parameters

setHowDidYouHearAnalytics

Updates the digitalData object with a value of How did you hear about us field.

Parameters

setSponsorshipProductId

Adds the product id to the sponsorship pages. This enables the more accurate analytics reporting in sponsorships, which follow the pattern of the gift catalog.

Parameters

setPaymentTypeAnalytics

Sets payment types based on form selection or sets it to the default value 'credit'.

Parameters

setProductAnalytics

Gets all items in the cart (catalog & sponsorships) from the store and writes it into an analytics store, store.state.analytics object. Must grab from cart on each page, as it's often called to update the info. Ex: setting gift sponsorship flag Then writes the information into analytics object

Parameters

trackChildProfileClick

Triggers an analytics event when a user clicks on Learn more for a child from search results page

Parameters

trackInAnalytics

Trigger a custom call rule in analytics

Parameters

trackTransactionSuccessAnalytics

Triggers the custom call rule in analytics to record a successful transaction

Parameters

trackUserAnalytics

Tracks user registration, but only the first time on the thank you page

Parameters

Returns String Form type, which will be passed into registration object

trackSponsorshipSearchAnalytics

Called when the child sponsorship search is executed

Parameters

addSponsorChildToCart

Adds a child with computed properties to the cart

Parameters

updateSponsorChildBillingInCart

Updates billing address in the store

Parameters

Returns [type] [description]

getAllFields

Get the fields for shipping and billing forms

Parameters

Returns [type] [description]

getUserData

Get the current user's information and store it in the form store. Used to pre-populate form data.

Parameters

Returns [type] [description]

setCurrentPaymentType

Set the current payment type for the checkout billing form (cc or paypal)

Parameters

submitSponsorshipAdditionalBillingResponse

Processes the API response after the recurring payment submission has been made.

Parameters

submitSponsorshipOnlyBilling

Submits the sponsorship transactions. Get the current payment type for the checkout billing form (cc or paypal). Then calls the appropriate API method based on the payment type.

Parameters

Returns [type] [description]

submitSponsorshipOnlyBillingResponse

Executed when the sponsorship transaction is called, without any additional recurring donations. Processes the API response.

Parameters

Returns [type] [description]

submitNativeSponsorshipBilling

Submit sponsorship transaction in the native cart, if available. Otherwise submit additional donation billing.

Parameters

Returns [type] [description]

submitNativeSponsorshipBillingResponse

Processes the API response of the sponsorship in the native gift catalog.

Parameters

Returns [type] [description]

submitNativeAdditionalBilling

Submits an additional recurring donation payment for processing. Gets called only in the gift catalog transactions.

Parameters

Returns [type] [description]

submitNativeAdditionalBillingResponse

Processes the API response after the additional recurring donation was processed in gift catalog.

Parameters

Returns [type] [description]

submitNativeCartBilling

Submits the native gift catalog order.

Parameters

Returns [type] [description]

submitNativeBilling

Starts the execution of billing submission for the native gift catalog cart.

Parameters

Returns [type] [description]

vuexAnalyticsSponsorshipProducts

Returns list of sponsored children set in product format for analytics.

Parameters

Returns [type] [description]

vuexAnalyticsSponsorshipInfo

Returns sponsorship form details in proper format for analytics.

Parameters

Returns [type] [description]

vuexCartGiftSponsorships

Return sponsorships that are marked as Gift sponsorships.

Parameters

Returns any array

vuexCartCurrentGiftSponsorship

Return the current sponsorship that are marked as Gift sponsorships.

Parameters

Returns any array

vuexCartCurrentGiftSponsorshipId

Return the current sponsorship that are marked as Gift sponsorships.

Parameters

Returns any array

vuexAnalyticsDonationInfo

Return info about the donation donation from the analyics store.

Parameters

Returns Object Object for analytics that describes the donation properties

vuexAnalyticsDonationFormInfo

Return info about the donation form from the analyics store.

Parameters

Returns Object Object for analytics that describes the donation properties

vuexFormPaymentType

Return current billing type for the billing form (credit or paypal)

Parameters

Returns [type] [description]

vuexHowDidYouHearAnalytics

Returns the how did you hear about us value

Parameters

Returns [type] [description]

vuexPaymentTypeAnalytics

Returns the selected payment type from analytis store

Parameters

Returns String

vuexPurchaseId

Returns a set of combined purchase ids for analytics

Parameters

Returns String Purchase Ids

vuexTransactionId

Returns a set of combined transaction ids for analytics

Parameters

Returns String Transaction Ids

vuexAnalyticsDefaults

Returns default settings for analytics module module. We set item that we need to store from page to page and cannot reliably rely on the combo cart store.

state

Reset purchase id

Parameters

state

Reset transaction id

Parameters

state

Update the number of single child profiles that were viewed

Parameters

state

Update the number of children were viewed in a list mode.

Parameters

state

Sets payment type into analytics

Parameters

state

Set sponsorship info details for form object into analytics store so we can grab it on the review and thank you pages

Parameters

state

Set sponsorship product for transaction object into analytics store so we can grab it on the review and thank you pages

Parameters

state

Sets the gift sponsorship data for a given child.

Parameters

vuexSponParityPlugin

Plugin which attempts to ensure that the number of sponsorships present in the ecomm cart is the same as those stored in the local vuex store. This should help reduce situations whereby the user loses part of their cart contents (as when LOM cookie expires or is cleared) but user retains sponsorships in their data store.

vuexPersistStatePlugin

vuex-persistedstate v0.3.0

(c) 2016 Robin van der Vleuten robin@webstronauts.co

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

vuexPersistStatePlugin

Hacked version of the vuex-persistedstate plugin compatible with our current build processes. Had to de-npm it and replace some dependency references. https://github.com/robinvdvleuten/vuex-persistedstate

vuexSponRepeatTempLocks

Ensures that sponsor children remained locked in ODS while their corresponding sponsorship is in a user's cart. Locks are checked every checkEveryMillis millseconds to confirm that they are still locked. If not, then lock is reapplied.

Parameters

setInterval

Starting core logic of the plugin. Here there be dragons!