react-native-okhi 1.2.27 → 1.2.28-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +2 -2
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/reactnativeokhi/OkhiModule.java +21 -2
- package/lib/commonjs/OkCore/types.js.map +1 -1
- package/lib/module/OkCore/types.js.map +1 -1
- package/lib/typescript/OkCore/types.d.ts +2 -1
- package/package.json +1 -1
- package/src/OkCore/types.ts +2 -1
package/android/build.gradle
CHANGED
|
@@ -126,8 +126,8 @@ repositories {
|
|
|
126
126
|
dependencies {
|
|
127
127
|
//noinspection GradleDynamicVersion
|
|
128
128
|
implementation "com.facebook.react:react-native:+"
|
|
129
|
-
implementation 'io.okhi.android:core:1.7.
|
|
130
|
-
implementation 'io.okhi.android:okverify:1.9.
|
|
129
|
+
implementation 'io.okhi.android:core:1.7.40'
|
|
130
|
+
implementation 'io.okhi.android:okverify:1.9.81'
|
|
131
131
|
// From node_modules
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -42,6 +42,7 @@ import io.okhi.android_okverify.OkVerify;
|
|
|
42
42
|
import io.okhi.android_okverify.interfaces.OkVerifyCallback;
|
|
43
43
|
import io.okhi.android_okverify.models.OkHiNotification;
|
|
44
44
|
import io.okhi.android_okverify.models.StartVerificationService;
|
|
45
|
+
import io.okhi.android_okverify.models.OkVerifyInitConfig;
|
|
45
46
|
|
|
46
47
|
@ReactModule(name = OkhiModule.NAME)
|
|
47
48
|
public class OkhiModule extends ReactContextBaseJavaModule {
|
|
@@ -161,20 +162,38 @@ public class OkhiModule extends ReactContextBaseJavaModule {
|
|
|
161
162
|
String branchId = config.getJSONObject("credentials").getString("branchId");
|
|
162
163
|
String clientKey = config.getJSONObject("credentials").getString("clientKey");
|
|
163
164
|
String mode = config.getJSONObject("context").getString("mode");
|
|
165
|
+
JSONObject configUser = config.getJSONObject("user");
|
|
166
|
+
|
|
164
167
|
auth = new OkHiAuth(getReactApplicationContext(), branchId, clientKey, mode);
|
|
165
168
|
if (getCurrentActivity() != null && getCurrentActivity().getApplicationContext() != null) {
|
|
166
169
|
okVerify = new OkVerify.Builder(getCurrentActivity(), auth).build();
|
|
170
|
+
|
|
167
171
|
if (config.has("notification")) {
|
|
168
172
|
JSONObject notificationConfig = config.getJSONObject("notification");
|
|
169
173
|
int importance = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? NotificationManager.IMPORTANCE_DEFAULT : 3;
|
|
170
|
-
|
|
174
|
+
|
|
175
|
+
OkHiNotification notification = new OkHiNotification(
|
|
171
176
|
notificationConfig.optString("title", "Verification in progress"),
|
|
172
177
|
notificationConfig.optString("text", "Address Verification in progress"),
|
|
173
178
|
notificationConfig.optString("channelId", "okhi"),
|
|
174
179
|
notificationConfig.optString("channelName", "OkHi Channel"),
|
|
175
180
|
notificationConfig.optString("channelDescription", "OkHi verification alerts"),
|
|
176
181
|
importance
|
|
177
|
-
)
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
if(configUser != null) {
|
|
185
|
+
String phone = configUser.getString("phone");
|
|
186
|
+
String email = configUser.getString("email");
|
|
187
|
+
String firstName = configUser.getString("firstName");
|
|
188
|
+
String lastName = configUser.getString("lastName");
|
|
189
|
+
String appUserId = configUser.getString("appUserId");
|
|
190
|
+
|
|
191
|
+
OkHiUser user = new OkHiUser.Builder(phone).withEmail(email).withFirstName(firstName).withLastName(lastName).withAppUserId(appUserId).build();
|
|
192
|
+
OkVerifyInitConfig okVerifyInitConfig = new OkVerifyInitConfig(auth, user);
|
|
193
|
+
OkVerify.init(getCurrentActivity(), notification, okVerifyInitConfig);
|
|
194
|
+
} else {
|
|
195
|
+
OkVerify.init(getCurrentActivity(), notification);
|
|
196
|
+
}
|
|
178
197
|
}
|
|
179
198
|
promise.resolve(true);
|
|
180
199
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { OkHiException } from './OkHiException';\n\n/**\n * Defines the structure of the user object requried by OkHi services and libraries.\n */\nexport interface OkHiUser {\n /**\n * The user's phone number. Must be MSISDN standard format. e.g +254712345678.\n */\n phone: string;\n /**\n * The user's first name.\n */\n firstName?: string;\n /**\n * The user's last name.\n */\n lastName?: string;\n /**\n * The user's email address.\n */\n email?: string;\n /**\n * The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.\n */\n id?: string;\n\n /**\n *
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { OkHiException } from './OkHiException';\n\n/**\n * Defines the structure of the user object requried by OkHi services and libraries.\n */\nexport interface OkHiUser {\n /**\n * The user's phone number. Must be MSISDN standard format. e.g +254712345678.\n */\n phone: string;\n /**\n * The user's first name.\n */\n firstName?: string;\n /**\n * The user's last name.\n */\n lastName?: string;\n /**\n * The user's email address.\n */\n email?: string;\n /**\n * The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.\n */\n id?: string;\n\n /**\n * @deprecated This field is no longer used.\n */\n fcmPushNotificationToken?: string;\n\n /**\n * The user's jwt token provided by OkHi after address creation.\n */\n token?: string;\n\n /**\n * Your assigned user id\n */\n appUserId?: string;\n}\n\n/**\n * Defines the current mode you'll be using OkHi's services as well as your application's meta information.\n */\nexport interface OkHiAppContext {\n /**\n * The current mode you'll be using OkHi services.\n */\n mode: 'sandbox' | 'prod' | string;\n /**\n * Your application's meta information.\n */\n app?: {\n /**\n * Your application's name.\n */\n name: string;\n /**\n * Your application's current version.\n */\n version: string;\n /**\n * Your application's current build number.\n */\n build: number;\n };\n /**\n * Meta information about the current developer.\n */\n developer?: string;\n}\n\n/**\n * Defines the structure of the OkHi location object once an address has been successfully created by the user.\n */\nexport interface OkHiLocation {\n /**\n * The latitude of the location.\n */\n lat: number;\n /**\n * The longitude of the location.\n */\n lon: number;\n /**\n * The OkHi's locationId. Usually obtained once an address has been successfully created by the user.\n */\n id?: string;\n /**\n * The id of a common residential or geological space such as apartment building or office block.\n */\n placeId?: string;\n /**\n * Geocode system for identifying an area anywhere on the Earth.\n * See https://plus.codes/\n */\n plusCode?: string;\n /**\n * The location's property name.\n */\n propertyName?: string;\n /**\n * The location's street name.\n */\n streetName?: string;\n /**\n * A string that can be used to render information about the location.\n */\n title?: string;\n /**\n * A string that can be used to render meta information about the location.\n */\n subtitle?: string;\n /**\n * User generated directions to the location.\n */\n directions?: string;\n /**\n * User generated meta information about the location, how to access it and any other relevant notes.\n */\n otherInformation?: string;\n /**\n * A link to the user's address visible on browser or desktop.\n */\n url?: string;\n /**\n * A Google's StreetView Panorama Id, if the address was created using Google StreetView.\n * See: https://developers.google.com/maps/documentation/javascript/streetview\n */\n streetViewPanoId?: string;\n /**\n * A Google's StreetView Panorama Url, if the address was created using Google StreetView.\n * See: https://developers.google.com/maps/documentation/javascript/streetview\n */\n streetViewPanoUrl?: string;\n /**\n * The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.\n */\n userId?: string;\n /**\n * The location's property number.\n */\n propertyNumber?: string;\n /**\n * A link to the location's gate photo.\n */\n photo?: string;\n\n /**\n * A user's country\n */\n country?: string;\n\n /**\n * A user's city\n */\n city?: string;\n\n /**\n * A user's state\n */\n state?: string;\n\n /**\n * A formatted location information\n */\n displayTitle?: string;\n\n /**\n * A user's country code\n */\n countryCode?: string;\n\n /**\n * An array of usage types that specifies the mode of verification. Can include \"physical_verification\" and/or \"digital_verification\" as valid values.\n */\n usageTypes?: UsageType;\n}\n\n/**\n * @ignore\n */\nexport interface OkHiError {\n code: string;\n message: string;\n}\n\nexport type OkHiApplicationConfiguration = {\n credentials: {\n branchId: string;\n clientKey: string;\n };\n context: {\n mode: 'sandbox' | 'prod';\n developer?: 'okhi' | 'external';\n };\n app?: {\n name?: string;\n version?: string;\n build?: string;\n };\n notification?: {\n title: string;\n text: string;\n channelId: string;\n channelName: string;\n channelDescription: string;\n };\n user?: OkHiUser;\n};\n\nexport type LocationPermissionStatus =\n | 'notDetermined'\n | 'restricted'\n | 'denied'\n | 'authorizedAlways'\n | 'authorizedWhenInUse'\n | 'authorized'\n | 'unknown';\n\nexport type LocationPermissionStatusCallback =\n | LocationPermissionStatus\n | 'rationaleDissmissed';\nexport type LocationRequestPermissionType = 'whenInUse' | 'always';\n\nexport type LocationPermissionCallback = (\n status: LocationPermissionStatusCallback | null,\n error: OkHiException | null\n) => any;\n\nexport type UsageType = Array<\n 'physical_verification' | 'digital_verification' | 'address_book'\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { OkHiException } from './OkHiException';\n\n/**\n * Defines the structure of the user object requried by OkHi services and libraries.\n */\nexport interface OkHiUser {\n /**\n * The user's phone number. Must be MSISDN standard format. e.g +254712345678.\n */\n phone: string;\n /**\n * The user's first name.\n */\n firstName?: string;\n /**\n * The user's last name.\n */\n lastName?: string;\n /**\n * The user's email address.\n */\n email?: string;\n /**\n * The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.\n */\n id?: string;\n\n /**\n *
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { OkHiException } from './OkHiException';\n\n/**\n * Defines the structure of the user object requried by OkHi services and libraries.\n */\nexport interface OkHiUser {\n /**\n * The user's phone number. Must be MSISDN standard format. e.g +254712345678.\n */\n phone: string;\n /**\n * The user's first name.\n */\n firstName?: string;\n /**\n * The user's last name.\n */\n lastName?: string;\n /**\n * The user's email address.\n */\n email?: string;\n /**\n * The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.\n */\n id?: string;\n\n /**\n * @deprecated This field is no longer used.\n */\n fcmPushNotificationToken?: string;\n\n /**\n * The user's jwt token provided by OkHi after address creation.\n */\n token?: string;\n\n /**\n * Your assigned user id\n */\n appUserId?: string;\n}\n\n/**\n * Defines the current mode you'll be using OkHi's services as well as your application's meta information.\n */\nexport interface OkHiAppContext {\n /**\n * The current mode you'll be using OkHi services.\n */\n mode: 'sandbox' | 'prod' | string;\n /**\n * Your application's meta information.\n */\n app?: {\n /**\n * Your application's name.\n */\n name: string;\n /**\n * Your application's current version.\n */\n version: string;\n /**\n * Your application's current build number.\n */\n build: number;\n };\n /**\n * Meta information about the current developer.\n */\n developer?: string;\n}\n\n/**\n * Defines the structure of the OkHi location object once an address has been successfully created by the user.\n */\nexport interface OkHiLocation {\n /**\n * The latitude of the location.\n */\n lat: number;\n /**\n * The longitude of the location.\n */\n lon: number;\n /**\n * The OkHi's locationId. Usually obtained once an address has been successfully created by the user.\n */\n id?: string;\n /**\n * The id of a common residential or geological space such as apartment building or office block.\n */\n placeId?: string;\n /**\n * Geocode system for identifying an area anywhere on the Earth.\n * See https://plus.codes/\n */\n plusCode?: string;\n /**\n * The location's property name.\n */\n propertyName?: string;\n /**\n * The location's street name.\n */\n streetName?: string;\n /**\n * A string that can be used to render information about the location.\n */\n title?: string;\n /**\n * A string that can be used to render meta information about the location.\n */\n subtitle?: string;\n /**\n * User generated directions to the location.\n */\n directions?: string;\n /**\n * User generated meta information about the location, how to access it and any other relevant notes.\n */\n otherInformation?: string;\n /**\n * A link to the user's address visible on browser or desktop.\n */\n url?: string;\n /**\n * A Google's StreetView Panorama Id, if the address was created using Google StreetView.\n * See: https://developers.google.com/maps/documentation/javascript/streetview\n */\n streetViewPanoId?: string;\n /**\n * A Google's StreetView Panorama Url, if the address was created using Google StreetView.\n * See: https://developers.google.com/maps/documentation/javascript/streetview\n */\n streetViewPanoUrl?: string;\n /**\n * The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.\n */\n userId?: string;\n /**\n * The location's property number.\n */\n propertyNumber?: string;\n /**\n * A link to the location's gate photo.\n */\n photo?: string;\n\n /**\n * A user's country\n */\n country?: string;\n\n /**\n * A user's city\n */\n city?: string;\n\n /**\n * A user's state\n */\n state?: string;\n\n /**\n * A formatted location information\n */\n displayTitle?: string;\n\n /**\n * A user's country code\n */\n countryCode?: string;\n\n /**\n * An array of usage types that specifies the mode of verification. Can include \"physical_verification\" and/or \"digital_verification\" as valid values.\n */\n usageTypes?: UsageType;\n}\n\n/**\n * @ignore\n */\nexport interface OkHiError {\n code: string;\n message: string;\n}\n\nexport type OkHiApplicationConfiguration = {\n credentials: {\n branchId: string;\n clientKey: string;\n };\n context: {\n mode: 'sandbox' | 'prod';\n developer?: 'okhi' | 'external';\n };\n app?: {\n name?: string;\n version?: string;\n build?: string;\n };\n notification?: {\n title: string;\n text: string;\n channelId: string;\n channelName: string;\n channelDescription: string;\n };\n user?: OkHiUser;\n};\n\nexport type LocationPermissionStatus =\n | 'notDetermined'\n | 'restricted'\n | 'denied'\n | 'authorizedAlways'\n | 'authorizedWhenInUse'\n | 'authorized'\n | 'unknown';\n\nexport type LocationPermissionStatusCallback =\n | LocationPermissionStatus\n | 'rationaleDissmissed';\nexport type LocationRequestPermissionType = 'whenInUse' | 'always';\n\nexport type LocationPermissionCallback = (\n status: LocationPermissionStatusCallback | null,\n error: OkHiException | null\n) => any;\n\nexport type UsageType = Array<\n 'physical_verification' | 'digital_verification' | 'address_book'\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -24,7 +24,7 @@ export interface OkHiUser {
|
|
|
24
24
|
*/
|
|
25
25
|
id?: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* @deprecated This field is no longer used.
|
|
28
28
|
*/
|
|
29
29
|
fcmPushNotificationToken?: string;
|
|
30
30
|
/**
|
|
@@ -194,6 +194,7 @@ export type OkHiApplicationConfiguration = {
|
|
|
194
194
|
channelName: string;
|
|
195
195
|
channelDescription: string;
|
|
196
196
|
};
|
|
197
|
+
user?: OkHiUser;
|
|
197
198
|
};
|
|
198
199
|
export type LocationPermissionStatus = 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'authorized' | 'unknown';
|
|
199
200
|
export type LocationPermissionStatusCallback = LocationPermissionStatus | 'rationaleDissmissed';
|
package/package.json
CHANGED
package/src/OkCore/types.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface OkHiUser {
|
|
|
26
26
|
id?: string;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* @deprecated This field is no longer used.
|
|
30
30
|
*/
|
|
31
31
|
fcmPushNotificationToken?: string;
|
|
32
32
|
|
|
@@ -208,6 +208,7 @@ export type OkHiApplicationConfiguration = {
|
|
|
208
208
|
channelName: string;
|
|
209
209
|
channelDescription: string;
|
|
210
210
|
};
|
|
211
|
+
user?: OkHiUser;
|
|
211
212
|
};
|
|
212
213
|
|
|
213
214
|
export type LocationPermissionStatus =
|