Welcome to FrankieOne!
On this page, we will explain how you can use a country object to have a specific customisation per country/state for different fields, which will allow you to meet different requirements for each country you want to launch for. This customisation can be added to the document and personal ekyc forms.
Country object
countries
is an array of different country objects:
Attribute | Description |
---|---|
countries: | array of country object |
Each country object starts with a country_code
followed by a set of state_code
. A default
key can be used where customisation is not required and to provide fallback behavior.
<country_code>: {
<state_code>: {
fields: []
},
<state_code>: {
fields: []
},
}
Attribute | Description |
---|---|
country_code | Three digit country code: If not applicable, use default as the key. |
state_code | State code for the specific country. If not applicable, use default as the key |
fields [ ] | An array of field object |
For each state, you can have an array of field
objects. This object is a common structure across all the Personal and ID document input fields. There are some pre-defined fields available that you can use as explained for each screen, but you can also define custom fields.
Field object
Attribute | Description | Values |
---|---|---|
fieldType | The type of the field to be rendered in the UI. | It can be one of the following: “input”: input text field ”select”: drop-down field ”dob”: Date of Birth field ”address”: Address field, which includes auto search and manual ”phone”: Phone number field |
name | The name of the field to be detected by OneSDK Forms | Available pre-defined fields: 'givenName' 'middleName' 'familyName' 'dateOfBirth' 'address.fullAddress' 'address.country' 'address.unitNumber' 'address.postalCode' 'address.state' 'address.streetNumber' 'address.streetName' 'address.town' 'idNumber' 'country' 'region' 'idExpiry' 'extraData.reference' 'extraData.document_number' |
dataType | The data type of this field to be processed by OneSDK Forms | 'phone' 'email' 'individual_extra' 'document_extra' 'previous_addr' 'current_addr' ‘'text' 'number' |
style | ||
label | displayed label for the field | |
helperText | the text displayed under the field for additional info | |
placeholder | the text displayed inside the field as a sample input | |
hide | display or hide a field | true/false |
rules
[NOT applicable to "dob" field].
Attribute | Description | Values |
---|---|---|
required | ||
required.value | true/false | |
required.value | ||
minLength | ||
minLength.value | integer | |
minLength.message | ||
maxLength | ||
maxLength.value | integer | |
regex.value | string - regex type /^([+-])(\d{2}):(\d{2})$/ Alphabetic → /^[A-Za-z]+$/ | |
regex.message |
options
: array
[applicable to "select" fieldType]
Attribute | Description | Values |
---|---|---|
label | ||
value |
calendar
[applicable to "dob" fieldType]
Attribute | Description | Values |
---|---|---|
calendar.type | “Gregorian” | “islamic” | |
local | ||
day | ||
day.required | ||
day.placeholder | ||
month | ||
month.required | ||
month.placeholder | ||
year | ||
year.required | ||
year.placeholder |
age
[applicable to “dob” field]
Attribute | Description | Values |
---|---|---|
min | minimum age required for input | integer |
max | maximum age required for input | integer |
message | Error message to user when outside min and max | string |
Sample
Default countries
Default fields for all countries/states:
"countries": {
"default": {
"default": {
"fields": [
{
"fieldType": "input",
"name": "license_number",
rules:{
},
style: {
ff-form-field:{}
}
},
{
"fieldType": "input",
"name": "card_number",
rules:{
},
style: {
ff-form-field:{}
}
}
],
}
}
}
Overwrite specific countries
Overwrite the config for specific countries/states:
"countries": {
"AUS": {
"VIC": {
"fields": [
{
"fieldType": "input",
"name": "license_number",
rules:{
},
style: {
ff-form-field:{}
}
},
{
"fieldType": "input",
"name": "card_number",
rules:{
},
style: {
ff-form-field:{}
}
},
{
"fieldType": "input",
"name": "registration_number",
style: {
ff-form-field:{}
}
}
]
},
"NSW": {
"fields": [
<data_field>
]
}
}
"NZL": {
"default": {
"fields": [
<data_field>
]
}
}
}
Use countries within documents
documents: [
{
type: "DRIVERS_LICENCE",
countries: {
default: {
default: {
fields: [
{
fieldType: 'select',
name: 'country',
options: [
{
label: "Australia",
value: "AUS"
},
{
label: "New Zealand",
value: "NZL"
}
],
}
]
}
}
}
},
{
type: "PASSPORT",
countries: {
default: {
default: {
fields: [
{
fieldType: 'select',
name: 'country',
options: [
{
label: "Australia",
value: "AUS"
},
{
label: "New Zealand",
value: "NZL"
}
],
}
]
}
}
}
}
]
Updated 2 months ago