React Native SDK Migration Guide
Info
We strongly recommend using the latest version of IDWise SDK. This ensures you always have access to the latest improvements, bug fixes, and security updates.
Migrating from v4.x.x to v5.x.x
Simple SDK Code Changes
If you are using Simple React-Native SDK integration please follow the following sections to change your code to be compatible with the new version:
IDWise.initialize
method:
IDWise.initialize
method:- The
theme
parameter has its type changed fromIDWiseSDKTheme
toIDWiseTheme
The following code:
String clientKey = "<clientKey>" //provided by IDWise
String theme = IDWiseSDKTheme.LIGHT // Available options [DARK, LIGHT, SYSTEM_DEFAULT]
const initializeCallback = {
onError(idwiseError) {
console.log(
'Event onInitalizeError:',
idwiseError.code,
idwiseError.message,
);
},
};
IDWise.initialize(clientKey,theme,initializeCallback);
Should be changed to be like this:
val clientKey = "<YOUR_CLIENT_KEY>"
val theme = IDWiseTheme.SYSTEM_DEFAULT //[LIGHT, DARK, SYSTEM_DEFAULT]
const initializeCallback = {
onError(idwiseError) {
console.log(
'Event onInitalizeError:',
idwiseError.code,
idwiseError.message,
);
},
};
IDWise.initialize(clientKey,theme, initializeCallback);
IDWise.startJourney
method:
IDWise.startJourney
method:- This method now takes a new optional parameter named
applicantDetails
which is aString:String
dictionary. You can pass this parameter asnil
if you do not intend to use it. For further information, please check the documentation. - The parameter
journeyDefinitionId
is now renamed toflowId
- The parameter
journeyCallback
is now renamed tojourneyCallbacks
The following code:
String journeyDefinitionId = "FLOW ID"; //As known as journey definition ID, Provided by IDWise
String referenceNo = "Unique reference number"; //[Optional] User's unique id e.g user_id
String locale = "en"; //Language code e.g en, ar
try {
IDWise.startJourney(journeyDefinitionId,referenceNo,locale, journeyCallbacks);
} on PlatformException catch (e) {
print("Error : '${e.message}'.");
}
Should be changed to become:
String flowId = "<FLOW_ID>"
String referenceNo = "Unique reference number"; //[Optional] User's unique id e.g user_id
String locale = "en"; //Language code e.g en, ar
const applicantDetails = {};
applicantDetails[ApplicantDetailsKeys.FULL_NAME] = 'John Doe';
applicantDetails[ApplicantDetailsKeys.SEX] = 'male';
try {
IDWise.startJourney(flowId, referenceNo, locale,applicantDetails, journeyCallbacks);
} on PlatformException catch (e) {
print("Error : '${e.message}'.");
}
IDWise.resumeJourney
method:
IDWise.resumeJourney
method:- The parameter
journeyDefinitionId
parameter is now renamed toflowId
- The parameter
journeyCallback
is now renamed tojourneyCallbacks
The following code:
String journeyDefinitionId = "FLOW ID"; //As known as journey definition ID, Provided by IDWise
String journeyId = "journey id"; //they journey id that you want to resume
String locale = "en"; //Language code e.g en, ar
IDWise.resumeJourney(journeyDefinitionId,journeyId,locale,journeyCallbacks);
Should be changed to become:
val flowId = "<FLOW_ID>"
val locale = "en"
val journeyId = "<YOUR_JOURNEY_ID>"
IDWise.resumeJourney(
context,flowId,journeyId,locale,journeyCallbacks
)
IDWiseSDK Journey Callbacks
JourneyStarted
Callback Method
JourneyStarted
Callback Method- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyStartedInfo
of typeJourneyStartedInfo
. The new typeJourneyStartedInfo
contains Journey Id as a subfield.
onJourneyResumed
Callback Method
onJourneyResumed
Callback Method- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyResumedInfo
of typeJourneyResumedInfo
. The new typeJourneyResumedInfo
contains Journey Id as a subfield.
JourneyFinished
Callback Method
JourneyFinished
Callback Method- This delegate method is now named
onJourneyCompleted
- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyCompletedInfo
of typeJourneyCompletedInfo
. The new typeJourneyCompletedInfo
contains Journey Id and isCompleted as a subfields.
JourneyCancelled
Callback Method
JourneyCancelled
Callback Method- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyCancelledInfo
of typeJourneyCancelledInfo
. The new typeJourneyCancelledInfo
contains optional Journey Id as a subfield.
onError
Callback Method
onError
Callback Method- This method previously took one parameter of type
IDWiseSDKError
. But the type of this parameter was changed to becomeIDWiseError
. It containscode
andmessage
as subfields.
Code Implementation of Journey Callbacks
The following code:
//callbacks events for journey
const journeyCallback = {
onJourneyStarted(data) {
console.log('Event onJourneyStarted received:', data);
},
onJourneyResumed(data) {
console.log('Event onJourneyResumed received:', data);
},
onJourneyFinished(data) {
console.log('Event onJourneyFinished received:', data);
},
onJourneyCancelled(data) {
console.log('Event onJourneyCancelled received:', data);
},
onError(data) {
console.log('Event onError received:', data);
},
};
Should be changed to be like this:
const journeyCallbacks = {
onJourneyStarted(journeyStartedInfo) {
console.log('Event onJourneyStarted received:', journeyStartedInfo);
},
onJourneyResumed(journeyResumedInfo) {
console.log('Event onJourneyResumed received:', journeyResumedInfo);
},
onJourneyCompleted(journeyCompletedInfo) {
console.log('Event onJourneyCompleted received:', journeyCompletedInfo);
},
onJourneyCancelled(journeyCancelledInfo) {
console.log('Event onJourneyCancelled received:', journeyCancelledInfo);
},
onError(idwiseError) {
console.log(
'Event onError received:',
idwiseError.code,
idwiseError.message,
);
},
};
Dynamic SDK Migration
If you are using Dynamic React Native SDK integration please follow the following sections to change your code to be compatible with the new version.
You should use IDWiseDynamic
object to call methods in dynamic mode.
IDWise.initialize
method:
IDWise.initialize
method:- The
theme
parameter has its type changed fromIDWiseSDKTheme
toIDWiseTheme
IDWiseDynamic
should be used instead ofIDWise
to call this method.
The following code:
String clientKey = "<YOUR_CLIENT_KEY>"
IDWiseTheme theme = IDWiseSDKTheme.LIGHT //[DARK, LIGHT, SYSTEM_DEFAULT]
IDWise.initialize(clientKey,theme, onError:(error){
print("Error in initializeSDK");
print(error);
});
Should be changed to be like this:
String clientKey = "<YOUR_CLIENT_KEY>"
IDWiseTheme theme = IDWiseTheme.LIGHT //[DARK, LIGHT, SYSTEM_DEFAULT]
IDWiseDynamic.initialize(clientKey,theme, onError:(error){
print("Error in initializeSDK");
print(error);
});
IDWise.startDynamicJourney
method:
IDWise.startDynamicJourney
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.- This method is renamed from
startDynamicJourney
tostartJourney
. - This method now takes a new optional parameter named
applicantDetails
which is a Hashmap of typeString:String
. You can pass this parameter asnull
if you do not intend to use it. For further information, please check documentation. - The parameter
journeyDefinitionId
is now renamed toflowId
- The parameter
journeyDelegate
is now renamed tojourneyCallbacks
The following code:
IDWise.startDynamicJourney(journeyDefinitionId: "FLOW_ID", referenceNumber: "REFERENCE_NUMBER",locale: "LOCALE", journeyDelegate: self)
Should be changed to become:
String flowId = "<FLOW_ID>"
String referenceNo = "Unique reference number"; //[Optional] User's unique id e.g user_id
String locale = "en"; //Language code e.g en, ar
const applicantDetails = {};
applicantDetails[ApplicantDetailsKeys.FULL_NAME] = 'John Doe';
applicantDetails[ApplicantDetailsKeys.SEX] = 'male';
IDWiseDynamic.startJourney(
flowId,
referenceNo,
locale,
applicantDetails,
journeyCallbacks,
stepCallbacks
);
IDWise.resumeDynamicJourney
method:
IDWise.resumeDynamicJourney
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.- This method is renamed from
resumeDynamicJourney
toresumeJourney
. - The parameter
journeyDefinitionId
parameter is now renamed toflowId
- The parameter
journeyCallback
is now renamed tojourneyCallbacks
- The parameter
stepCallback
is now renamed tostepCallbacks
The following code:
let journeyDefinitionId = "<JOURNEY_DEFINITION_ID>" // aka flowId
let journeyId = "<YOUR_JOURNEY_ID>"
let locale = "en"
IDWise.resumeDynamicJourney(
journeyDefinitionId,journeyId,locale, _journeyCallbacks,_stepCallbacks
);
Should be changed to become:
String flowId = "<FLOW_ID>"
String journeyId = "YOUR_JOURNEY_ID"
String locale = "en";
IDWiseDynamic.resumeJourney(
flowId,journeyId, locale,journeyCallbacks,stepCallbacks
)
IDWise.finishDynamicJourney
method:
IDWise.finishDynamicJourney
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.- This method is renamed from
finishDynamicJourney
tofinishJourney
.
The following code:
IDWise.finishDynamicJourney()
Should be changed to become:
IDWiseDynamic.finishJourney()
IDWise.startStep
method:
IDWise.startStep
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.
The following code:
IDWise.startStep("STEP_ID")
Should be changed to become:
IDWiseDynamic.startStep("STEP_ID")
IDWise.skipStep
method:
IDWise.skipStep
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.
The following code:
IDWise.skipStep("STEP_ID")
Should be changed to become:
IDWiseDynamic.skipStep("STEP_ID")
IDWise.unloadSDK
method:
IDWise.unloadSDK
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.
The following code:
IDWise.unloadSDK()
Should be changed to become:
IDWiseDynamic.unloadSDK()
IDWise.getJourneySummary
method:
IDWise.getJourneySummary
method:IDWiseDynamic
should be used instead ofIDWise
to call this method.
The following code:
IDWise.getJourneySummary(onJourneySummary: (summary) {
print("onJourneySummary: $summary")
});
Should be changed to become:
IDWiseDynamic.getJourneySummary(onJourneySummary: (summary) {
print("onJourneySummary: $summary")
});
IDWiseSDK Journey Callbacks
JourneyStarted
Callback Method
JourneyStarted
Callback Method- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyStartedInfo
of typeJourneyStartedInfo
. The new typeJourneyStartedInfo
contains Journey Id as a subfield.
onJourneyResumed
Callback Method
onJourneyResumed
Callback Method- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyResumedInfo
of typeJourneyResumedInfo
. The new typeJourneyResumedInfo
contains Journey Id as a subfield.
JourneyFinished
Callback Method
JourneyFinished
Callback Method- This delegate method is now named
onJourneyCompleted
- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyCompletedInfo
of typeJourneyCompletedInfo
. The new typeJourneyCompletedInfo
contains Journey Id and isCompleted as a subfields.
JourneyCancelled
Callback Method
JourneyCancelled
Callback Method- This method previously took one parameter
journeyInfo
of typeJourneyInfo
but now the parameter changed to becomejourneyCancelledInfo
of typeJourneyCancelledInfo
. The new typeJourneyCancelledInfo
contains optional Journey Id as a subfield.
onError
Callback Method
onError
Callback Method- This method previously took one parameter of type
IDWiseSDKError
. But the type of this parameter was changed to becomeIDWiseError
. It containscode
andmessage
as subfields.
Code Implementation of Journey Callbacks
The following code:
//callbacks events for journey
const journeyCallback = {
onJourneyStarted(data) {
console.log('Event onJourneyStarted received:', data);
},
onJourneyResumed(data) {
console.log('Event onJourneyResumed received:', data);
},
onJourneyFinished(data) {
console.log('Event onJourneyFinished received:', data);
},
onJourneyCancelled(data) {
console.log('Event onJourneyCancelled received:', data);
},
onError(data) {
console.log('Event onError received:', data);
},
};
Should be changed to be like this:
const journeyCallbacks = {
onJourneyStarted(journeyStartedInfo) {
console.log('Event onJourneyStarted received:', journeyStartedInfo);
},
onJourneyResumed(journeyResumedInfo) {
console.log('Event onJourneyResumed received:', journeyResumedInfo);
},
onJourneyCompleted(journeyCompletedInfo) {
console.log('Event onJourneyCompleted received:', journeyCompletedInfo);
},
onJourneyCancelled(journeyCancelledInfo) {
console.log('Event onJourneyCancelled received:', journeyCancelledInfo);
},
onError(idwiseError) {
console.log(
'Event onError received:',
idwiseError.code,
idwiseError.message,
);
},
};
IDWiseSDK Step Callbacks
onStepCaptured
Callback Method
onStepCaptured
Callback Method- This method previously took two parameters
stepId: Int
andcapturedImage: String?
but now the parameter changed to becomestepCapturedInfo: StepCapturedInfo
. The new typeStepCapturedInfo
containsstepId: String
,originalImage: String
andoriginalImage: String
as subfields.
onStepResult
Callback Method
onStepResult
Callback Method- This method previously took two parameters
stepId: Int
andstepResult: StepResult?
but now the parameter changed to becomestepResultInfo: StepResultInfo
. The new typeStepResultInfo
containsstepId: String
andstepResult: StepResult?
as subfields.
onStepCancelled
Callback Method
onStepCancelled
Callback Method- This method previously took one parameter
stepId: String
but now the parameter changed to becomestepCancelledInfo: StepCancelledInfo
. The new typeStepCancelledInfo
containsstepId: String
as a sub field.
onStepSkipped
Callback Method
onStepSkipped
Callback Method- This method previously took one parameter
stepId: String
but now the parameter changed to becomestepSkippedInfo: StepSkippedInfo
. The new typeStepSkippedInfo
containsstepId: String
as a subfield.
Code Implementation of Step Callbacks
//Declare global variables to be passed to initialize later
const stepCallback = {
onStepCaptured(stepId, capturedImageB64) {
console.log('Event onStepCaptured stepId:', stepId);
},
onStepResult(stepId, stepResult) {
console.log('Event onStepResult stepId:', stepId);
console.log('Event onStepResult stepResult:', stepResult);
},
onStepCancelled(stepId) {
console.log('Event onStepCancelled stepId:', stepId);
},
onStepSkipped(stepId) {
console.log('Event onStepSkipped stepId:', stepId);
},
};
should be changed to
//Declare global variables to be passed to initialize later
const stepCallback = {
onStepCaptured(stepCapturedInfo) {
console.log('Event onStepCaptured stepId:', stepCapturedInfo.stepId);
},
onStepResult(stepResultInfo) {
console.log('Event onStepResult stepId:', stepResultInfo.stepId);
console.log('Event onStepResult stepResult:', stepResultInfo.stepResult);
},
onStepCancelled(stepCancelledInfo) {
console.log('Event onStepCancelled stepId:', stepCancelledInfo.stepId);
},
onStepSkipped(stepSkippedInfo) {
console.log('Event onStepSkipped stepId:', stepSkippedInfo.stepId);
},
};
Updated 2 months ago