Phone Number

Overview

The Phone Number component provides UI to select the Country code and enter the user's phone number. The component also validates the user's phone number as per requirement. The Infinity application uses the Phone Number component throughout for various functionality flows such as Same Bank Transfer, Domestic Transfer, International Transfer, P2P, and Forgot Password.

The Phone Number component provides the following customizations for a developer.

  • Make the field Mandatory or Optional.
  • Provide the Choose from Contacts feature.
  • Provides a drop-down list to select the phone number.

The Phone Number component contains Dropdown component and Bottomsheet component as child components.

NOTE: The Phone Number component is used inside the Mobile Banking application.

Phone Number Contracts

The Phone Number component provides the contracts given below.

Service Parameters

The Service Parameters contract of the Phone Number component sets the service details required to retrieve all the Country Codes to populate the drop-down list. In the Phone Number component, the Service Parameter contract uses the DropdownServiceObject Object to retrieve the data for the drop-down list.

Here is a sample of the JSON object provided in the Service Parameter of the Phone Number component.

{
	"DropdownServiceObject": {
		"ServiceType": "customVerb",
		"Service": "CountryService",
		"Object": "Country",
		"Verb": "getAllCountries",
		"Criteria": {}
	}
}

The Service Parameter contract provides the following key-value pairs for customization.

Property Description
ServiceType

Type: String

Defines the type of service to be performed.

For example: customVerb

Service

Name: String

Name of the object service mentioned in the Quantum Fabric layer to fetch the data and meta data required for the component.

For example: CountryService

Object

Type: String

Name of the object linked to the object service mentioned above in the Quantum Fabric layer to fetch the data required for the component.

For example: Country

Verb

Type: String

Name of the operation or custom verb linked to the specified objects in the Quantum Fabric layer to fetch the data required for the component.

For example: getAllCountries

Criteria

Type: JSON object

The request payload as defined and configured in the Quantum Fabric Object service and operation.

Data Mapping

The Data Mapping contract of the Phone Number component maps the widget IDs with the data to be displayed. The component retrieves the data for mapping from Context Data Object or Service response.

Here is a sample of the JSON object provided in the Data Mapping of the Phone Number component.

{
	"editablePhoneNumberField": {
		"placeholder": "${i18n{i18n.common.enterPhoneNumber}}",
		"maxTextLength": "10",
		"textInputMode": "numeric",
		"keyboardActionLabel": "0"
	},
	"countryCodeDropdown": {
		"phoneTitle": "${i18n{i18n.common.phoneNumberWithColon}}",
		"primaryTitle": "${i18n{i18n.common.primaryPhoneNumber}}",
		"alternavtiveTitle": "${i18n{i18n.common.alternativePhoneNumber}}"
	},
	"phoneNumberField": {
		"multiPhoneNumberContext": "${CNTX.records}",
		"phoneNumberValue": "${CNTX.records.Value}"
	},
	"errorMessage": {
		"mandatoryErrorMsg": "${i18n{i18n.common.mandatoryPhoneNumber}}",
		"invalidPhoneErrorMsg": "${i18n{i18n.common.validPhoneNumber}}",
		"contactsPermissionErrorMsg": "${i18n{i18n.common.permissionForContacts}}",
		"countryCodeErrorMsg": "${i18n{i18n.common.validCountryCode}}"
	},
	"countryCodeSelectedValue": "${Collection.DropdownServiceObject.phoneCountryCode} + /s + ( + ${Collection.DropdownServiceObject.Code} + )",
	"isMandatoryField": false
}

The Data Mapping contract is assigned a JSON object with the following key-value pairs.

Key Description
editablePhoneNumberField
  • Maps the Context Data Object to the input field in the component.
  • This key accepts a JSON object with the following keys.
    • placeholder: Sets the filler text for the input field to enter the Phone Number.
    • maxTextLength: Sets the maximum number of characters that the user can enter.
    • textInputMode: Sets the type of soft keypad that appears.
    • keyboardActionLabel: Sets the text that appears on the action key of the keyboard.
countryCodeDropdown
  • Maps the Context Data Object to the drop-down in the component.
  • This key accepts a JSON object with the following keys.
    • phoneTitle: Sets the title of the drop-down list.
    • primaryTitle: Sets the main header for displaying the primary phone number.
    • alternavtiveTitle: Sets the text for displaying the alternate phone number.
phoneNumberField
  • Maps the Context Data Object to the Phone Number field.
  • This key accepts a JSON object with the following keys.
    • multiPhoneNumberContext: Sets the Context data object for the drop-down.
    • phoneNumberValue: Maps the Context variable to the selected value.
errorMessage
  • Sets the static text that appears when an error occurs in the component.
  • This key accepts a JSON object with the following keys.
    • mandatoryErrorMsg: The error message that appears when the user does not enter the mandatory email in the component.
    • invalidPhoneErrorMsg: The error message when the user enters an invalid phone number.
    • contactsPermissionErrorMsg: The error message that appears when the component cannot access the contacts in the mobile device.
    • countryCodeErrorMsg: The error message when the user enters an invalid Country Code.
countryCodeSelectedValue
  • Sets the formatting after the user selects the country code and the phone number from the contact list on the mobile device.
  • Accepts value in the String format.
isMandatoryField
  • When the value of this field is true for an input field, the field becomes mandatory.
  • Accepts a Boolean value.

Data Formatting

Data formatting property adds a new formatting type or overrides the existing formatting type in the default format JSON.

{}

Conditional Mapping Key

The Conditional Mapping Key is used to define mapping based on a criterion. The property specifies the value on which the conditional data mapping check should happen.

The Phone Number component does not contain any value for this key by default.

{}

Conditional Mapping

The Conditional Mapping property key maps a widget with data from the Collection Object or service response as per the Conditional Mapping key.

By default, the Phone Number component does not contain any customization for this key.

{}

Phone Number

The Phone Number group contains the following contracts.

Read Only Contacts

This field specifies if the user-entered Phone Number should be read-only or editable. If the value of this contract is true, the field appears as read-only.

Parameter Value

Programmatic Name

readOnlyContacts

Default Value

true/false

Type

Boolean

Choose From Contacts

This field specifies if the user can choose the Phone Number using the Contacts button. If the value of this contract is true, the Contacts button appears in the component.

Parameter Value

Programmatic Name

chooseFromContacts

Default Value

true/false

Type

Boolean

Country Selected Config

This field specifies the format in which the Country Code appears in the drop-down list as per the response.

Parameter Value

Programmatic Name

countrySelectedConfig

Default Value

${dropdownSegmentData.lblCountryCodeOrCurrency}

Type

String

Phone Number Selected Config

This field formats the value user selects from the Multi Phone Number drop-down.

Parameter Value

Programmatic Name

phoneNumberSelectedConfig

Default Value

${sortSegmentData.phoneNumber}

Type

String

Multi Phone Number

The Multi Phone Number group contains the following contracts.

Phone Number Data Mapping

This field maps the value that the user selects from the Multi Phone Number drop-down with the Context data object.

Parameter Value

Syntax

JSON Object with the following keys.

  • fields: Maps the static text that appears as the header of the multi-phone number drop-down list and the phone number information. This key accepts data as an i18n key, context data, and a plain string.
  •  segments: Maps the data for the drop-down list. This parameter accepts a JSON object with segOptions as key and a JSON object with the following keys as values.
    • segmentMasterData: Maps the parent response key with the component consumer in the following format: ${CNTX.Options}.
    • segmentUI: Maps the row template widgets with the tokens in any following formats.
      • plain string - "lblOption": "Transaction"
      • i18 - "lblOption": "${i18n{i18n.common.amount}}"
      • collection/context: "lblOption": "${segmentMasterData.optionName}"

    While designing a new template, follow proper naming conventions for the widgets. For example, the name of a Label widget must start with lbl, and the name of an Image widget must start with img.

Default Value

{
	"fields": {
		"lblHeader": "${i18n{i18n.common.phoneNumber}}",
		"lblTitle": "${i18n{i18n.common.phoneNumberMsgInfo}}"
	},
	"segments": {
		"segOptions": {
			"segmentMasterData": "${CNTX.Options}",
			"segmentUI": {
				"lblOption": "${segmentMasterData.type}",
				"lblValue": "${segmentMasterData.phoneNumber}"
			}
		}
	}
}

Type

JSON

Row Template Config

The Row Template contract sets the Segment row template for the drop-down lists in the component.

A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempPhoneNumber2, where flxTempPhoneNumber2 is the row template ID.
  • JSON Format: This format supports inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

This parameter accepts the row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.
Programmatic Name rowTemplateConfig

Default Value

{
	"templateID": "flxTempPhoneNumber2",
	"microAppName": "ResourcesMA"
}

Type

String/ JSON

Selected Row Template Config

The Selected Row Template contract sets the Segment row template for the row selected by the user.

A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempPhoneNumber1, where flxTempPhoneNumber1 is the row template ID.
  • JSON Format: This format supports inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

This parameter accepts the row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.
Programmatic Name selectedRowTemplateConfig

Default Value

{
	"templateID": "flxTempPhoneNumber1",
	"microAppName": "ResourcesMA"
}

Type

String/ JSON

Default Selected Key

This field configures the default key in the drop-down list.

Parameter Value

Syntax

The selected key in a String format.

Programmatic Name defaultSelectedKey

Default Value

${CNTX.defaultOption}

Type

String

Country Code Dropdown

The Country Code Dropdown group contains the contracts given below to customize the dropdown list containing the Country Codes.

Country Code Data Mapping

This field maps the value that the user selects from the Country Code drop-down list with the Context data object.

Parameter Value

Syntax

JSON Object with the following keys.

  • mainHeaderTitle: Maps the static text that appears as the Country code drop-down list header. This key accepts value as an i18n key and as a plain string.
  •  segDropdown: Maps the data for the drop-down list. This parameter accepts a JSON object following keys.
    • segmentMasterData: Maps the parent response key with the component consumer in the following format: ${CNTX}.
    • segmentUI: Maps the row template widgets using the sectionHeader and segmentRowData keys. These keys map the row template widgets with the tokens. The tokens provided in the JSON object can be of any of the following formats.
      • plain string - "lblOption": "Transaction"
      • i18 - "lblOption": "${i18n{i18n.common.amount}}"
      • collection/context: "lblOption": "${segmentMasterData.optionName}"

    While designing a new template, follow proper naming conventions for the widgets. For example, the name of a Label widget must start with lbl, and the name of an Image widget must start with img.

Default Value

{
	"mainHeaderTitle": {
		"lblDropdownHeaderTitle": "${i18n{i18n.common.countryCode}}"
	},
	"segDropdown": {
		"segmentMasterData": "${CNTX}",
		"segmentUI": {
			"sectionHeader": [{
				"lblDropdownSectionTitle": "${i18n{i18n.common.selectCountryCode}}"
			}],
			"segmentRowData": {
				"countryId": "${segmentMasterData.Code}",
				"lblCountry": "${segmentMasterData.Name}",
				"imgFlag": "",
				"lblCountryCodeOrCurrency": "${segmentMasterData.Code} + /s + ( + ${segmentMasterData.phoneCountryCode} + )",
				"countryOrCurrencyCode": "${segmentMasterData.Code} + /s + ( + ${segmentMasterData.phoneCountryCode} + )"
			}
		}
	}
}

Type

JSON

Dropdown Row Template Config

This contract assigns the row template ID for the segment widget.

The Row Template contract sets the Segment row template for the drop-down lists in the component.

A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempDropdown3, where flxTempDropdown3 is the row template ID.
  • JSON Format: This format supports inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

This parameter accepts the row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.
Programmatic Name dropdownRowTemplateConfig

Default Value

{
	"templateID": "flxTempDropdown3",
	"microAppName": "ResourcesMA"
}

Type

String/ JSON

Dropdown Selected Row Template Config

The Selected Row Template contract sets the Segment row template for the row selected by the user.

A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempDropdown4, where flxTempDropdown4 is the row template ID.
  • JSON Format: This format supports inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

This parameter accepts the row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.
Programmatic Name dropdownSelectedRowTemplateConfig

Default Value

{
	"templateID": "flxTempDropdown4",
	"microAppName": "ResourcesMA"
}

Type

String/ JSON

Header Template Config

The Header Template contract sets the Segment Section Header template for the drop-down lists in the component.

A developer can set the value for this contract in two formats.

  • String Format: The dynamic row template ID is provided in a String format. For example: flxTempDropdown1, where flxTempDropdown1 is the row template ID.
  • JSON Format: This format supports inter-app access while using composite apps. In this format, the developer must provide both the Microapp Name and the template ID as a JSON object.
Parameter Value

Syntax

This parameter accepts the row template ID as a String or a JSON object containing the following keys.

  • templateID: Sets the row template ID as a String.
  • microAppName: Sets the name of the Microapp containing the template.
Programmatic Name headerTemplateConfig

Default Value

{
	"templateID": "flxTempDropdown1",
	"microAppName": "ResourcesMA"
}

Type

String/ JSON

Default Selection Config

The Component consumer uses this contract to select a row by default (before user selection) by providing key-value pair.

Parameter Value

Syntax

A JSON object with a key-value pair representing an item in the drop-down list.

Programmatic Name defaultSelectionConiig

Default Value

{
	"key": "countryId",
	"value": "US"
}

Type

JSON

Permission Deny Popup

The Email Address component uses the Pop-up Acknowledgment component as a child component. The Popup group in the Email Address component provides fields to customize this child component. It contains the following contracts.

Dynamic Skins

Dynamic Skin contract overrides the existing applied skin.

Parameter Value

Syntax

JSON format with fields parameter as key and the component level widget skins in the following format.

{
	<widgetID1>: <skinName1>,
 	<widgetID2>: <skinName2>
}
Programmatic Name dynamicSkins

Default Value

{
	"fields": {
		"lblTitle": "lblGrey500FS40Emp",
		"lblDescription1": "lblGrey400FS20",
		"lblDescription2": "lblGrey400FS20",
		"btnPrimary": "btnPrimary",
		"btnSecondary": "btnSecondary"
	}
}

Type

JSON

Popup Context

This contract maps the widgets in the Pop-Up Acknowledgment child component with the data.

Parameter Value

Syntax

JSON format with popupAck as key and a JSON object with the following keys as value.

  • title: Sets the header of the pop-up. This key accepts value as a Context value, i18n key, and as a plain string.
  • primary: Sets the text that appears in the Close button of the pop-up. This key accepts value as a Context value, i18n key, and as a plain string.
  • ack: Maps the images that appear on the pop-up. The value passed to this key must have the file extension.
  • close: Maps the images that appear on the pop-up. The value passed to this key must have the file extension.
  • enableModalContainer: Enables or disables the activity of the Pop-up Acknowledgment component when the user clicks the background of the pop-up.
Programmatic Name popupContext

Default Value

{
	"popupAck": {
		"ack": "alert.png",
		"close": "",
		"title": "${i18n{i18n.common.permissionForContacts}}",
		"primary": "${i18n{i18n.common.close}}",
		"enableModalContainer": false
	}
}

Type

JSON

onError Event

The OnError event handles any error that occurs during the user journey. The onError passes an error object to the parent widget containing the information about the error and where it had happened.

Parameter Value
Input parameter JSON object

Object Description

The JSON object contains the following keys:

  • level: This key contains the String value regarding where the error occurs. It can be from the component View controller or the component Business controller.
  • method: This key contains the function that handles the error.
  • error: This key contains the actual error message and the stack.

Sample Input

var errordata = {
	"level": "ComponentViewController",
	"method": "setWidgetTemplate",
	"error": err
};
this.onError(errordata);

onPhoneNumberEntered Event

This event provides the user-entered data to the component consumer.

Parameter Value
Input parameter

data: The user-entered information in the input field in a String format.

Programmatic Name onPhoneNumberEntered

Sample Code

this.onPhoneNumberEntered(data);

Return Type

None

handlePopupCallToAction Event

This event is triggered when the user clicks any button inside the Pop-up Acknowledgment child component.

Parameter Value
Input parameter

componentScope: The information associated with the scope of the component in a JSON format.

Programmatic Name handlePopupCallToAction

Sample Code

this.handlePopupCallToAction(componentScope);

Return Type

None

handleTitleBar Event

This event updates the native title bar attributes based on the pop-up visibility.

Parameter Value
Input parameter

componentScope: The information associated with the scope of the component in a JSON format.

Programmatic Name handleTitleBar

Sample Code

this.handleTitleBar(componentScope);

Return Type

None

setContext Method

This method must be invoked inside the parent component or form controller. This method passes a text used to the input box in place of the entry in the input box.

Parameter Value

Syntax

this.view.componentID.setContext(contextData);

Input parameter JSON object containing the context variable. For more information on the context object, click here.

Sample Input

this.view.phonenumber.setContext(contextData);

Return Type

None

setConfigsFromParent Method

This method sets the configurations from the parent component to the Phone Number component when the Phone Number component is placed inside another component.

Parameter Value

Syntax

this.view.<componentID>.setConfigsFromParent(configParams);

Input parameter

configParams: Sets the JSON object required for the child component. The JSON object can contain all the contracts used in the Email Address component as keys.

  • serviceParameters: JSON object containing the Service configurations.
  • dataMapping: JSON object containing the data mapped with the widget.
  • dataFormatting: JSON object containing the look and feel of the data.

Sample Input

var configParams ={
	"serviceParameters": "this._ServiceParameters",
	"dataMapping": "this._DataMapping",
	"dataFormatting": "this._DataFormatting"
}
this.view.phonenumber.setConfigsFromParent(configParams);

Return Type

None

Context Object

A context object is a JSON object that passes the data required for the component. The context variable helps the component get the data using the following parameters.

  • Type_id
  • Value
  • id
  • isPrimary
  • phoneCountryCode
  • phoneNumber

Here is a sample of the Context JSON Object used inside the component.

var contextData = {
	"records": [{
			"Type_id": "COMM_TYPE_PHONE",
			"Value": "9292929394",
			"id": "1",
			"isPrimary": "true",
			"phoneCountryCode": "+91",
			"phoneNumber": "9292929394"
		},
		{
			"Type_id": "COMM_TYPE_PHONE",
			"Value": "9999999999",
			"id": "1",
			"isPrimary": "false",
			"phoneCountryCode": "+91",
			"phoneNumber": "9999999999"
		}
	]
};

 

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 2, 2022 5:08:57 PM IST

Feedback
x