There are three main events to which you will need to assign handlers on each of the validation components:

  • onvalidationstatuschange
  • onfieldchange
  • onmappedfieldschange

onvalidationstatuschange

onvalidationstatuschange will fire every time the validation status changes, so either when a validation response comes back from the API with a new validation status, or when the user manually modifies an existing value, resulting in a Manually Updated status. When this happens, the event.detail object will contain the following values:

Name Purpose
validationInputKey A single string representing the value of the address, email or phone as it was saved in the database at the time of validation. This ensures that our solution can pick up on a previous validation status that is no longer valid.
validationStatus The status code returned by our API, for example Verified or Unknown.
validationMoreInfo A JSON object containing extra information that was returned with the validation, for example metadata regarding the operator associated with a given phone number.
globalAddressKey A unique key that identifies a given address within our address data. This is only returned by the Address Validation component.

onfieldchange

onfieldchange will fire whenever a change is made to any of the input elements present within our validation components. This ensures that whatever has been entered into our elements or changed by an API response can be picked up and stored in your own custom Lightning Web Component. When this happens, the event.detail object will contain the following values:

Field Description
street1Value, street2Value, street3Value, cityValue, provinceValue, countryValue Values of the basic address elements returned by our API or manually typed in by the user. street2Value and street3Value will not populate unless the split-street-field attribute is enabled.
countryCode2 The standard 2-letter ISO code of the chosen country, e.g. GB.
countryCode3 The standard 3-letter ISO code of the chosen country, e.g. GBR.
stateCode The state code for the API-returned state, e.g. WV for West Virginia.
Field Description
emailValue Value of the email returned by our API or manually typed in by the user.
Field Description
phoneValue Full numerical representation of the phone number with phone code returned by our API, e.g. 447550000000.
phoneCodelessValue The entered number without the phone code, e.g. 7550000000.
phoneCode 3-letter ISO code of the chosen country.
numericalPhoneCode Numerical representation of the chosen phone code, e.g. 44.
phoneCodeKey Unique identifier for the chosen phone code.

onmappedfieldschange

onmappedfieldschange is only relevant if you have assigned a touchpoint via the touchpoint-api-name attribute. You can pull event.detail.mappings from the first argument, which will contain a map of your chosen metadata, components or enrichment attributes, either in default dot syntax (e.g. uk_location_complete.latitude) or an alias, if you have set one in the Touchpoint mappings.

Example

Here is an example of an integration using our Email Validate component:

<template>
    <texperianledq-ledq-cmp-email-validate-flow
        field-label="Email"
        help-text="Help"
        touchpoint-api-name="Email_Test"
        onvalidationstatuschange={handleValidationStatusChange}
        onfieldchange={handleFieldChange}
        onmappedfieldschange={handleMappedFieldsChange}
    ></texperianledq-ledq-cmp-email-validate-flow>
</template>

onvalidationstatuschange, onfieldchange and onmappedfieldschange are bound to component handler functions, which then populate local variable values within the custom Lightning Web Component.

import { LightningElement } from 'lwc';

export default class TestLwcIntegration extends LightningElement {
    emailValue;
    domainType
    inputValue;
    confidence;
    moreInfo;

    handleFieldChange(e) {
        this.emailValue = e.detail.emailValue;
    }

    handleValidationStatusChange(e) {
        this.inputValue = e.detail.validationInputKey;
        this.confidence = e.detail.validationStatus;
        this.moreInfo = e.detail.validationMoreInfo;
    }

    handleMappedFieldsChange(e) {
        this.domainType = e.detail.mappings.domain_type_alias;
    }
}