TC Widget Callbacks

 

Demo page with Standard widget

Demo page with POS widget(PIN: 416905)

Demo page with Automotive Services widget

3rd Party cart transfer Demo

Demo page with Wheel widget

Usage

User should call method .on for TCWidget, passing an event name and a callback handler as arguments. Method can be called before and/or after the .init method. User is able to add as many callbacks as he needs.

 

Sample of adding a callback handler:

<script> var widget TCWidget.init({ apikey: '[your apikey]', container: 'content', }).then(function(widget) { widget.on('onOrderClick', function(event) { log('onOrderClick', event); event.resolve() }); }); function log(eventId, event) { console.log(eventId, event); } </script>

 

Full usage example might look like this:

<div id="content"></div> <script> var widget TCWidget.init({ apikey: '[your apikey]', container: 'content', }).then(function(widget) { widget.on('onOrderClick', function(event) { log('onOrderClick', event); event.resolve() }); }); function log(eventId, event) { console.log(eventId, event); } </script>

NOTE: Some exceptions might be occasions where data is still unknown, so empty objects or fields will be provided.

 

Event

Event object, that is passed inside every callback has a structure:

{ data: {}, // can be empty object, or contain other data resolve: function() { ... }, reject: function() { ... }, }

 

Where data field is an immutable object possibly containing some data inside. It's read-only, and attempts to write inside it will not succeed.

  • resolve is a method that signals that event has succeded, and application should continue it's execution flow. It can be used to pass additional/modified data inside the application.

  • reject is a method that prevents usual application execution flow. Can be used to block some user-interactions or any other proceeses related to a particular event.

Effects of all those fields for particular occasions will be covered in more detail for every event below.

 

Common events for Tire Widgets

onResultsReviseClicked

 

Description

Gets triggered when user clicks on Revise search button or Find your tires button in breadcrumbs. Works for all widget types

Properties

Type

Effect

Type

Effect

resolvable

Search page will be opened as usual

rejectable

Prevents page from opening

Example

Data example (vary according to search method)

onTireSearchResults

Description

Gets triggered when user clicks on Find your Tires now and there was a search. Works for all widget types

Properties

Type

Effect

Type

Effect

resolvable

Results page will be opened as usual and user will see all matching tires

Example

Data example (vary according to search method)

onTireSelect

Description

Gets triggered when user clicks on Select tire (See out-the-door-price) button. Works for all widget types

Properties

Type

Effect

Type

Effect

resolvable

Summary page will be opened as usual

rejectable

Prevents page from opening

Example

Data example

 

 

Order form

Pretty much all order events share the same data structure, as provided below

onOrderClick

Description

Gets triggered when user clicks on Order button, on summary page

Properties

Type

Effect

Type

Effect

rejectable

prevents page from opening

onOrderInitiated

Description

Gets triggered when page gets initiated.

onOrder_DateClicked

Description

Gets triggered when user clicks on Order button, on summary page

Properties

Type

Effect

Type

Effect

resolvable

Opens calendar, but user can inject custom customer.preferred_time

rejectable

Pevents calendar from opening, user also can inject custom customer.preferred_time

 

Example

onOrder_DateSelected

Description

Gets triggered when user clicks on Order button, on summary page

Properties

Type

Effect

Type

Effect

resolvable

User can inject custom customer.preferred_time (overriding)

 

Example

onOrderSubmitted

Description

Gets triggered when user clicks on Order button, on summary page

Properties

None

 

Appointment Request Form

Same as with orders, all appointment events share the same data structure, as provided below

NOTE: Some exceptions might be occasions where data is still unknown, so empty objects or fields will be provided.

onAppointmentClick

Description

Gets triggered when user clicks on Appointment button, on summary page

Properties

Type

Effect

Type

Effect

rejectable

prevents page from opening

onAppointmentInitiated

Description

Gets triggered when page gets initiated.

onAppointment_DateClicked

Description

Gets triggered when user clicks on preferred date field on the form.

Properties

Type

Effect

Type

Effect

resolvable

Opens calendar, but user can inject custom customer.preferred_time

rejectable

Pevents calendar from opening, user also can inject custom customer.preferred_time

Example

onAppointment_DateSelected

Description

Gets triggered when user selected a date in preferred date field.

Properties

Type

Effect

Type

Effect

resolvable

User can inject custom customer.preferred_time (overriding)

 

Example

onAppointmentSubmitted

Description

Gets triggered when user selected a date in preferred date field.

Properties

None

Widget Locator

onLocationChanged

Description

Gets triggered when user selects a location in wiget locator.

Properties

None

Data example

 

POS Widget

onSummaryInitiated

Description

Gets triggered when page gets initiated.

Properties

None

 

Data example

onSupplierOrderSubmitted

Description

Gets triggered when supplier order submitted. Works both for successful and failed order.

Properties

None

Data example

 

Service appointment widget

 

Full usage example might look like this:

 

onLocationChanged

Description

Gets triggered when user select/change location. 

Response of this event different that for other events. Please see an example of event response below.

Data example

 

Main events

Has different response structure that onLocationChanged event. An example you can find below.

Pretty much all service events share the same data structure, as provided below

onVehicleSelected

Description

Gets triggered when user select/change Year, Make & Model of vehicle

onAppointmentServicesUpdated

Description

Gets triggered when user select/change services

onAppointmentLightsUpdated

Description

Gets triggered when user select/change My Lights are On in symptoms widget under Tell us the symptoms category 

onAppointmentSymptomsUpdated

Description

Gets triggered when user select/change My Car Symptoms in symptoms widget under Tell us the symptoms category 

onAppointmentDateSelected

Description

Gets triggered when user selected a date in preferred date/time field

onAppointmentContinue

Description

Gets triggered when user click on Continue button on services page

onAppointmentSubmitted

Description

Gets triggered when user click on Request Appointment button on summary page

 

Wheel Widget

onResultsReviseClicked

 

Description

Gets triggered when user clicks on Revise search button.

Properties

Type

Effect

Type

Effect

resolvable

Search page will be opened as usual

rejectable

Prevents page from opening

Example

Data example (vary according to search method)

onTireSelect

Description

Gets triggered when user clicks on Add to package button.

Properties

Type

Effect

Type

Effect

resolvable

Summary page will be opened as usual

rejectable

Prevents page from opening

Example

Data example

onWheelSelect

Description

Gets triggered when user clicks on View Details button.

Properties

Type

Effect

Type

Effect

resolvable

Summary page will be opened as usual

rejectable

Prevents page from opening

Example

Data example

onWheelSearchResults

Description

Gets triggered when user clicks on Find your Wheels now and there was a search.

Properties

Type

Effect

Type

Effect

resolvable

Results page will be opened as usual and user will see all matching tires

Example

Data example

onSummaryInitiated

Description

Gets triggered when page gets initiated.

Properties

None

 

Data example

Note: tires can be empty array in case it’s no tire in quote

Appointment Request Form

Same as with orders, all appointment events share the same data structure, as provided below

onAppointmentClick

Description

Gets triggered when user clicks on Appointment button, on summary page

Properties

Type

Effect

Type

Effect

rejectable

prevents page from opening

onAppointmentInitiated

Description

Gets triggered when page gets initiated.

onAppointmentSubmitted

Description

Gets triggered when user submits an appointment

Properties

None

Date & time selection events

It will be same structure for Date & Time selection on Appointment and Order forms

onDateFieldClicked

Description

Gets triggered when user clicks on preferred date field on the form.

Properties

Type

Effect

Type

Effect

resolvable

Opens calendar, but user can inject custom customer.preferred_time

rejectable

Pevents calendar from opening, user also can inject custom customer.preferred_time

Example

onDateFieldSelected

Description

Gets triggered when user selected a date in preferred date field.

Properties

Type

Effect

Type

Effect

resolvable

User can inject custom customer.preferred_time (overriding)

Order form

Pretty much all order events share the same data structure, as provided below

onOrderClick

Description

Gets triggered when user clicks on Order button, on summary page

Properties

Type

Effect

Type

Effect

rejectable

prevents page from opening

onOrderInitiated

Description

Gets triggered when page gets initiated.

onOrderSubmitted

Description

Gets triggered when user submits an order

Properties

None