react-native-okhi 1.2.31 → 1.2.32-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/LICENSE +1 -1
- package/README.md +34 -4
- package/ReactNativeOkhi.podspec +21 -0
- package/android/build.gradle +38 -99
- package/android/gradle.properties +3 -3
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/com/okhi/OkhiModule.kt +336 -0
- package/android/src/main/java/com/okhi/OkhiPackage.kt +33 -0
- package/ios/OkHiWrapper.swift +348 -0
- package/ios/Okhi.h +5 -0
- package/ios/Okhi.mm +170 -0
- package/lib/commonjs/NativeOkhi.js +9 -0
- package/lib/commonjs/NativeOkhi.js.map +1 -0
- package/lib/commonjs/index.js +234 -28
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/NativeOkhi.js +5 -0
- package/lib/module/NativeOkhi.js.map +1 -0
- package/lib/module/index.js +221 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeOkhi.d.ts +25 -0
- package/lib/typescript/commonjs/src/NativeOkhi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +22 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +81 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeOkhi.d.ts +25 -0
- package/lib/typescript/module/src/NativeOkhi.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +22 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +81 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/package.json +91 -112
- package/src/NativeOkhi.ts +68 -0
- package/src/index.tsx +271 -3
- package/src/types.ts +90 -0
- package/android/src/main/java/com/reactnativeokhi/OkhiModule.java +0 -389
- package/android/src/main/java/com/reactnativeokhi/OkhiPackage.java +0 -28
- package/ios/OkHiExtension.swift +0 -27
- package/ios/OkHiStruct.swift +0 -29
- package/ios/Okhi-Bridging-Header.h +0 -3
- package/ios/Okhi.m +0 -62
- package/ios/Okhi.swift +0 -325
- package/ios/Okhi.xcodeproj/project.pbxproj +0 -283
- package/lib/commonjs/OkCollect/Helpers.js +0 -40
- package/lib/commonjs/OkCollect/Helpers.js.map +0 -1
- package/lib/commonjs/OkCollect/OkHiLocationManager.js +0 -305
- package/lib/commonjs/OkCollect/OkHiLocationManager.js.map +0 -1
- package/lib/commonjs/OkCollect/Spinner.js +0 -27
- package/lib/commonjs/OkCollect/Spinner.js.map +0 -1
- package/lib/commonjs/OkCollect/Util.js +0 -226
- package/lib/commonjs/OkCollect/Util.js.map +0 -1
- package/lib/commonjs/OkCollect/app.json +0 -4
- package/lib/commonjs/OkCollect/index.js +0 -47
- package/lib/commonjs/OkCollect/index.js.map +0 -1
- package/lib/commonjs/OkCollect/types.js +0 -6
- package/lib/commonjs/OkCollect/types.js.map +0 -1
- package/lib/commonjs/OkCore/Helpers.js +0 -386
- package/lib/commonjs/OkCore/Helpers.js.map +0 -1
- package/lib/commonjs/OkCore/OkHiException.js +0 -96
- package/lib/commonjs/OkCore/OkHiException.js.map +0 -1
- package/lib/commonjs/OkCore/OkHiMode.js +0 -14
- package/lib/commonjs/OkCore/OkHiMode.js.map +0 -1
- package/lib/commonjs/OkCore/_helpers.js +0 -41
- package/lib/commonjs/OkCore/_helpers.js.map +0 -1
- package/lib/commonjs/OkCore/_types.js +0 -2
- package/lib/commonjs/OkCore/_types.js.map +0 -1
- package/lib/commonjs/OkCore/index.js +0 -119
- package/lib/commonjs/OkCore/index.js.map +0 -1
- package/lib/commonjs/OkCore/types.js +0 -6
- package/lib/commonjs/OkCore/types.js.map +0 -1
- package/lib/commonjs/OkHiNativeModule/index.js +0 -19
- package/lib/commonjs/OkHiNativeModule/index.js.map +0 -1
- package/lib/commonjs/OkVerify/index.js +0 -211
- package/lib/commonjs/OkVerify/index.js.map +0 -1
- package/lib/commonjs/OkVerify/types.js.map +0 -1
- package/lib/module/OkCollect/Helpers.js +0 -34
- package/lib/module/OkCollect/Helpers.js.map +0 -1
- package/lib/module/OkCollect/OkHiLocationManager.js +0 -298
- package/lib/module/OkCollect/OkHiLocationManager.js.map +0 -1
- package/lib/module/OkCollect/Spinner.js +0 -20
- package/lib/module/OkCollect/Spinner.js.map +0 -1
- package/lib/module/OkCollect/Util.js +0 -214
- package/lib/module/OkCollect/Util.js.map +0 -1
- package/lib/module/OkCollect/app.json +0 -4
- package/lib/module/OkCollect/index.js +0 -4
- package/lib/module/OkCollect/index.js.map +0 -1
- package/lib/module/OkCollect/types.js +0 -2
- package/lib/module/OkCollect/types.js.map +0 -1
- package/lib/module/OkCore/Helpers.js +0 -363
- package/lib/module/OkCore/Helpers.js.map +0 -1
- package/lib/module/OkCore/OkHiException.js +0 -89
- package/lib/module/OkCore/OkHiException.js.map +0 -1
- package/lib/module/OkCore/OkHiMode.js +0 -8
- package/lib/module/OkCore/OkHiMode.js.map +0 -1
- package/lib/module/OkCore/_helpers.js +0 -34
- package/lib/module/OkCore/_helpers.js.map +0 -1
- package/lib/module/OkCore/_types.js +0 -2
- package/lib/module/OkCore/_types.js.map +0 -1
- package/lib/module/OkCore/index.js +0 -65
- package/lib/module/OkCore/index.js.map +0 -1
- package/lib/module/OkCore/types.js +0 -2
- package/lib/module/OkCore/types.js.map +0 -1
- package/lib/module/OkHiNativeModule/index.js +0 -13
- package/lib/module/OkHiNativeModule/index.js.map +0 -1
- package/lib/module/OkVerify/index.js +0 -195
- package/lib/module/OkVerify/index.js.map +0 -1
- package/lib/module/OkVerify/types.js +0 -2
- package/lib/module/OkVerify/types.js.map +0 -1
- package/lib/typescript/OkCollect/Helpers.d.ts +0 -9
- package/lib/typescript/OkCollect/OkHiLocationManager.d.ts +0 -7
- package/lib/typescript/OkCollect/Spinner.d.ts +0 -5
- package/lib/typescript/OkCollect/Util.d.ts +0 -31
- package/lib/typescript/OkCollect/index.d.ts +0 -3
- package/lib/typescript/OkCollect/types.d.ts +0 -139
- package/lib/typescript/OkCore/Helpers.d.ts +0 -95
- package/lib/typescript/OkCore/OkHiException.d.ts +0 -81
- package/lib/typescript/OkCore/OkHiMode.d.ts +0 -7
- package/lib/typescript/OkCore/_helpers.d.ts +0 -3
- package/lib/typescript/OkCore/_types.d.ts +0 -38
- package/lib/typescript/OkCore/index.d.ts +0 -17
- package/lib/typescript/OkCore/types.d.ts +0 -203
- package/lib/typescript/OkHiNativeModule/index.d.ts +0 -48
- package/lib/typescript/OkVerify/index.d.ts +0 -65
- package/lib/typescript/OkVerify/types.d.ts +0 -0
- package/lib/typescript/index.d.ts +0 -3
- package/react-native-okhi.podspec +0 -35
- package/src/OkCollect/Helpers.ts +0 -53
- package/src/OkCollect/OkHiLocationManager.tsx +0 -391
- package/src/OkCollect/Spinner.tsx +0 -18
- package/src/OkCollect/Util.ts +0 -270
- package/src/OkCollect/app.json +0 -4
- package/src/OkCollect/index.ts +0 -3
- package/src/OkCollect/types.ts +0 -154
- package/src/OkCore/Helpers.ts +0 -477
- package/src/OkCore/OkHiException.ts +0 -93
- package/src/OkCore/OkHiMode.ts +0 -7
- package/src/OkCore/_helpers.ts +0 -47
- package/src/OkCore/_types.ts +0 -37
- package/src/OkCore/index.ts +0 -87
- package/src/OkCore/types.ts +0 -235
- package/src/OkHiNativeModule/index.ts +0 -92
- package/src/OkVerify/index.ts +0 -259
- package/src/OkVerify/types.ts +0 -0
- /package/lib/commonjs/{OkVerify/types.js → types.js} +0 -0
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { LocationPermissionCallback, LocationPermissionStatus, LocationRequestPermissionType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Checks whether location services are enabled
|
|
4
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the service is available
|
|
5
|
-
*/
|
|
6
|
-
export declare const isLocationServicesEnabled: () => Promise<boolean>;
|
|
7
|
-
/**
|
|
8
|
-
* Checks whether when in use location permission is granted
|
|
9
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted
|
|
10
|
-
*/
|
|
11
|
-
export declare const isLocationPermissionGranted: () => Promise<boolean>;
|
|
12
|
-
/**
|
|
13
|
-
* Checks whether background location permission is granted
|
|
14
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted
|
|
15
|
-
*/
|
|
16
|
-
export declare const isBackgroundLocationPermissionGranted: () => Promise<boolean>;
|
|
17
|
-
/**
|
|
18
|
-
* Requests for when in use location permission
|
|
19
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted
|
|
20
|
-
*/
|
|
21
|
-
export declare const requestLocationPermission: () => Promise<boolean>;
|
|
22
|
-
/**
|
|
23
|
-
* Requests for background location permission
|
|
24
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolen value indicating whether the permission is granted
|
|
25
|
-
*/
|
|
26
|
-
export declare const requestBackgroundLocationPermission: () => Promise<boolean>;
|
|
27
|
-
/**
|
|
28
|
-
* Requests the user to enable location services by showing an in app modal on android and opening location settings on iOS
|
|
29
|
-
* @returns {Promise<boolean>} A promise that resolves to either a boolean value on android or null on iOS
|
|
30
|
-
*/
|
|
31
|
-
export declare const requestEnableLocationServices: () => Promise<boolean | null>;
|
|
32
|
-
/**
|
|
33
|
-
* Android Only - Checks if Google Play Services is available
|
|
34
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe
|
|
35
|
-
*/
|
|
36
|
-
export declare const isGooglePlayServicesAvailable: () => Promise<boolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Android Only - Requests user to enable Google Play Services
|
|
39
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is avaialbe
|
|
40
|
-
*/
|
|
41
|
-
export declare const requestEnableGooglePlayServices: () => Promise<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the system version of the current platform
|
|
44
|
-
* @returns {Promise<boolean>} A promise that resolves either a string on iOS or number on Android
|
|
45
|
-
*/
|
|
46
|
-
export declare const getSystemVersion: () => Promise<string | number>;
|
|
47
|
-
/**
|
|
48
|
-
* Requests location permission from the user. It'll also attempt to activate any disbaled services (Android Only)
|
|
49
|
-
*/
|
|
50
|
-
export declare const request: (locationPermissionType: LocationRequestPermissionType, rationale: {
|
|
51
|
-
title: string;
|
|
52
|
-
text: string;
|
|
53
|
-
successButton?: {
|
|
54
|
-
label: string;
|
|
55
|
-
};
|
|
56
|
-
denyButton?: {
|
|
57
|
-
label: string;
|
|
58
|
-
};
|
|
59
|
-
} | null, callback: LocationPermissionCallback) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Open the device's app settings.
|
|
62
|
-
*/
|
|
63
|
-
export declare const openAppSettings: () => void;
|
|
64
|
-
/**
|
|
65
|
-
* Retrives the location permission status from the device
|
|
66
|
-
*/
|
|
67
|
-
export declare const retriveLocationPermissionStatus: () => Promise<LocationPermissionStatus>;
|
|
68
|
-
/**
|
|
69
|
-
* Requests tracking authorization from the user. iOS only, iOS version >= 14
|
|
70
|
-
* Read more: https://developer.apple.com/app-store/user-privacy-and-data-use/
|
|
71
|
-
*/
|
|
72
|
-
export declare const requestTrackingAuthorization: () => Promise<string | null>;
|
|
73
|
-
/**
|
|
74
|
-
* Checks whether current device can open "Protected Apps Settings" available in Transsion Group android devices such as Infinix and Tecno
|
|
75
|
-
* When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.
|
|
76
|
-
*/
|
|
77
|
-
export declare const canOpenProtectedAppsSettings: () => Promise<boolean>;
|
|
78
|
-
/**
|
|
79
|
-
* Opens "Protected Apps Settings" available in Transsion Group android devices such as Infinix and Tecno
|
|
80
|
-
* When your application is included in protected apps, verification processes are less likely to be terminated by the OS. Increasing rate of users being verified.
|
|
81
|
-
*/
|
|
82
|
-
export declare const openProtectedAppsSettings: () => Promise<boolean>;
|
|
83
|
-
/**
|
|
84
|
-
* Checks whether notification permission is granted on both android and ios devices
|
|
85
|
-
*/
|
|
86
|
-
export declare const isNotificationPermissionGranted: () => Promise<boolean>;
|
|
87
|
-
/**
|
|
88
|
-
* Requests notification permission from both android and ios devices
|
|
89
|
-
*/
|
|
90
|
-
export declare const requestNotificationPermission: () => Promise<boolean>;
|
|
91
|
-
/**
|
|
92
|
-
* Determines the current location accuracy level of the device
|
|
93
|
-
* @returns "no_permission" | "approximate" | "precise"
|
|
94
|
-
*/
|
|
95
|
-
export declare const getLocationAccuracyLevel: () => Promise<"no_permission" | "approximate" | "precise">;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { OkHiError } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* The OkHiException class extends the Error class to provide additional information regarding the type of errors thrown while running any OkHiLibraries.
|
|
4
|
-
* It contains static string properties that can be used to evaluate the kind of errors being thrown and handle them appropriately.
|
|
5
|
-
*/
|
|
6
|
-
export declare class OkHiException extends Error {
|
|
7
|
-
/**
|
|
8
|
-
* Error is thrown when location services is unavailable.
|
|
9
|
-
*/
|
|
10
|
-
static LOCATION_SERVICES_UNAVAILABLE_CODE: string;
|
|
11
|
-
/**
|
|
12
|
-
* Error is thrown when play services is unavailable.
|
|
13
|
-
*/
|
|
14
|
-
static PLAY_SERVICES_UNAVAILABLE_CODE: string;
|
|
15
|
-
/**
|
|
16
|
-
* Error is thrown when the device can't connect to OkHi's servers.
|
|
17
|
-
*/
|
|
18
|
-
static NETWORK_ERROR_CODE: string;
|
|
19
|
-
/**
|
|
20
|
-
* Error is thrown when the device can't connect to OkHi's servers.
|
|
21
|
-
*/
|
|
22
|
-
static NETWORK_ERROR_MESSAGE: string;
|
|
23
|
-
/**
|
|
24
|
-
* Error is thrown whenever there's an unknown error that occured during the usage of one of OkHi's services.
|
|
25
|
-
*/
|
|
26
|
-
static UNKNOWN_ERROR_CODE: string;
|
|
27
|
-
/**
|
|
28
|
-
* Error is thrown whenever there's an unknown error that occured during the usage of one of OkHi's services.
|
|
29
|
-
*/
|
|
30
|
-
static UNKNOWN_ERROR_MESSAGE: string;
|
|
31
|
-
/**
|
|
32
|
-
* Error is thrown whenever an invalid phone number is provided to a service that requires a user's phone number.
|
|
33
|
-
*/
|
|
34
|
-
static INVALID_PHONE_CODE: string;
|
|
35
|
-
/**
|
|
36
|
-
* Error is thrown whenever an invalid phone number is provided to a service that requires a user's phone number.
|
|
37
|
-
*/
|
|
38
|
-
static INVALID_PHONE_MESSAGE: string;
|
|
39
|
-
/**
|
|
40
|
-
* Error is thrown whenever there's an issue with the credentials provided.
|
|
41
|
-
*/
|
|
42
|
-
static UNAUTHORIZED_CODE: string;
|
|
43
|
-
/**
|
|
44
|
-
* Error is thrown whenever there's an issue with the credentials provided.
|
|
45
|
-
*/
|
|
46
|
-
static UNAUTHORIZED_MESSAGE: string;
|
|
47
|
-
/**
|
|
48
|
-
* Error is thrown whenever a particular permission is required for a service to run and isn't granted by the user.
|
|
49
|
-
*/
|
|
50
|
-
static PERMISSION_DENIED_CODE: string;
|
|
51
|
-
/**
|
|
52
|
-
* Error is thrown whenever a particular device service is required for a library to run and isn't granted by the user.
|
|
53
|
-
*/
|
|
54
|
-
static SERVICE_UNAVAILABLE_CODE: string;
|
|
55
|
-
/**
|
|
56
|
-
* Error is thrown whenever an OkHi service is run on an unsupported platform.
|
|
57
|
-
*/
|
|
58
|
-
static UNSUPPORTED_PLATFORM_CODE: string;
|
|
59
|
-
/**
|
|
60
|
-
* Error is thrown whenever an OkHi service is run on an unsupported platform.
|
|
61
|
-
*/
|
|
62
|
-
static UNSUPPORTED_PLATFORM_MESSAGE: string;
|
|
63
|
-
/**
|
|
64
|
-
* Error is thrown whenever bad configuration is provided to an OkHi service.
|
|
65
|
-
*/
|
|
66
|
-
static BAD_REQUEST_CODE: string;
|
|
67
|
-
/**
|
|
68
|
-
* Error is thrown whenever bad configuration is provided to an OkHi service.
|
|
69
|
-
*/
|
|
70
|
-
static BAD_REQUEST_MESSAGE: string;
|
|
71
|
-
/**
|
|
72
|
-
* Specific error code string detailing the kind of error being thrown.
|
|
73
|
-
*/
|
|
74
|
-
code: string;
|
|
75
|
-
/**
|
|
76
|
-
* @param error An error object with code and respective message.
|
|
77
|
-
* @param error.code Specific error code string detailing the kind of error being thrown.
|
|
78
|
-
* @param error.message Specific error message string detailing the kind of error being thrown.
|
|
79
|
-
*/
|
|
80
|
-
constructor(error: OkHiError);
|
|
81
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ignore
|
|
3
|
-
*/
|
|
4
|
-
export type OkHiAccessScope = 'verify' | 'address' | 'checkout' | 'profile';
|
|
5
|
-
export type OkHiInitializationConfiguration = {
|
|
6
|
-
credentials: {
|
|
7
|
-
branchId: string;
|
|
8
|
-
clientKey: string;
|
|
9
|
-
};
|
|
10
|
-
context: {
|
|
11
|
-
mode: string;
|
|
12
|
-
platform: 'react-native';
|
|
13
|
-
developer: 'okhi' | 'external';
|
|
14
|
-
};
|
|
15
|
-
app?: {
|
|
16
|
-
name?: string | null;
|
|
17
|
-
version?: string | null;
|
|
18
|
-
build?: number | null;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export type AuthApplicationConfig = {
|
|
22
|
-
auth: {
|
|
23
|
-
token: string;
|
|
24
|
-
};
|
|
25
|
-
credentials: {
|
|
26
|
-
branchId: string;
|
|
27
|
-
clientKey: string;
|
|
28
|
-
};
|
|
29
|
-
context: {
|
|
30
|
-
mode: 'sandbox' | 'prod';
|
|
31
|
-
developer?: 'okhi' | 'external';
|
|
32
|
-
};
|
|
33
|
-
app?: {
|
|
34
|
-
name?: string;
|
|
35
|
-
version?: string;
|
|
36
|
-
build?: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { OkHiApplicationConfiguration } from './types';
|
|
2
|
-
import type { AuthApplicationConfig } from './_types';
|
|
3
|
-
export * from './types';
|
|
4
|
-
export * from './OkHiException';
|
|
5
|
-
export * from './OkHiMode';
|
|
6
|
-
export * from './Helpers';
|
|
7
|
-
/**
|
|
8
|
-
* Initializes the OkHi library with provided API keys
|
|
9
|
-
* @param {Object} configuration A configuration object with your OkHi credentials as well as library settings
|
|
10
|
-
* @returns {Promise<void>} A promise that resolves when initialization is successful
|
|
11
|
-
*/
|
|
12
|
-
export declare function initialize(configuration: OkHiApplicationConfiguration): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Obtains your current running configuration
|
|
15
|
-
* @returns {Promise<void>} A promise that resolves with your application configuration
|
|
16
|
-
*/
|
|
17
|
-
export declare function getApplicationConfiguration(): Promise<AuthApplicationConfig | null>;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import type { OkHiException } from './OkHiException';
|
|
2
|
-
/**
|
|
3
|
-
* Defines the structure of the user object requried by OkHi services and libraries.
|
|
4
|
-
*/
|
|
5
|
-
export interface OkHiUser {
|
|
6
|
-
/**
|
|
7
|
-
* The user's phone number. Must be MSISDN standard format. e.g +254712345678.
|
|
8
|
-
*/
|
|
9
|
-
phone: string;
|
|
10
|
-
/**
|
|
11
|
-
* The user's first name.
|
|
12
|
-
*/
|
|
13
|
-
firstName?: string;
|
|
14
|
-
/**
|
|
15
|
-
* The user's last name.
|
|
16
|
-
*/
|
|
17
|
-
lastName?: string;
|
|
18
|
-
/**
|
|
19
|
-
* The user's email address.
|
|
20
|
-
*/
|
|
21
|
-
email?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.
|
|
24
|
-
*/
|
|
25
|
-
id?: string;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated This field is no longer used.
|
|
28
|
-
*/
|
|
29
|
-
fcmPushNotificationToken?: string;
|
|
30
|
-
/**
|
|
31
|
-
* The user's jwt token provided by OkHi after address creation.
|
|
32
|
-
*/
|
|
33
|
-
token?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Your assigned user id
|
|
36
|
-
*/
|
|
37
|
-
appUserId?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Defines the current mode you'll be using OkHi's services as well as your application's meta information.
|
|
41
|
-
*/
|
|
42
|
-
export interface OkHiAppContext {
|
|
43
|
-
/**
|
|
44
|
-
* The current mode you'll be using OkHi services.
|
|
45
|
-
*/
|
|
46
|
-
mode: 'sandbox' | 'prod' | string;
|
|
47
|
-
/**
|
|
48
|
-
* Your application's meta information.
|
|
49
|
-
*/
|
|
50
|
-
app?: {
|
|
51
|
-
/**
|
|
52
|
-
* Your application's name.
|
|
53
|
-
*/
|
|
54
|
-
name: string;
|
|
55
|
-
/**
|
|
56
|
-
* Your application's current version.
|
|
57
|
-
*/
|
|
58
|
-
version: string;
|
|
59
|
-
/**
|
|
60
|
-
* Your application's current build number.
|
|
61
|
-
*/
|
|
62
|
-
build: number;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Meta information about the current developer.
|
|
66
|
-
*/
|
|
67
|
-
developer?: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Defines the structure of the OkHi location object once an address has been successfully created by the user.
|
|
71
|
-
*/
|
|
72
|
-
export interface OkHiLocation {
|
|
73
|
-
/**
|
|
74
|
-
* The latitude of the location.
|
|
75
|
-
*/
|
|
76
|
-
lat: number;
|
|
77
|
-
/**
|
|
78
|
-
* The longitude of the location.
|
|
79
|
-
*/
|
|
80
|
-
lon: number;
|
|
81
|
-
/**
|
|
82
|
-
* The OkHi's locationId. Usually obtained once an address has been successfully created by the user.
|
|
83
|
-
*/
|
|
84
|
-
id?: string;
|
|
85
|
-
/**
|
|
86
|
-
* The id of a common residential or geological space such as apartment building or office block.
|
|
87
|
-
*/
|
|
88
|
-
placeId?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Geocode system for identifying an area anywhere on the Earth.
|
|
91
|
-
* See https://plus.codes/
|
|
92
|
-
*/
|
|
93
|
-
plusCode?: string;
|
|
94
|
-
/**
|
|
95
|
-
* The location's property name.
|
|
96
|
-
*/
|
|
97
|
-
propertyName?: string;
|
|
98
|
-
/**
|
|
99
|
-
* The location's street name.
|
|
100
|
-
*/
|
|
101
|
-
streetName?: string;
|
|
102
|
-
/**
|
|
103
|
-
* A string that can be used to render information about the location.
|
|
104
|
-
*/
|
|
105
|
-
title?: string;
|
|
106
|
-
/**
|
|
107
|
-
* A string that can be used to render meta information about the location.
|
|
108
|
-
*/
|
|
109
|
-
subtitle?: string;
|
|
110
|
-
/**
|
|
111
|
-
* User generated directions to the location.
|
|
112
|
-
*/
|
|
113
|
-
directions?: string;
|
|
114
|
-
/**
|
|
115
|
-
* User generated meta information about the location, how to access it and any other relevant notes.
|
|
116
|
-
*/
|
|
117
|
-
otherInformation?: string;
|
|
118
|
-
/**
|
|
119
|
-
* A link to the user's address visible on browser or desktop.
|
|
120
|
-
*/
|
|
121
|
-
url?: string;
|
|
122
|
-
/**
|
|
123
|
-
* A Google's StreetView Panorama Id, if the address was created using Google StreetView.
|
|
124
|
-
* See: https://developers.google.com/maps/documentation/javascript/streetview
|
|
125
|
-
*/
|
|
126
|
-
streetViewPanoId?: string;
|
|
127
|
-
/**
|
|
128
|
-
* A Google's StreetView Panorama Url, if the address was created using Google StreetView.
|
|
129
|
-
* See: https://developers.google.com/maps/documentation/javascript/streetview
|
|
130
|
-
*/
|
|
131
|
-
streetViewPanoUrl?: string;
|
|
132
|
-
/**
|
|
133
|
-
* The OkHi's userId. Usually obtained after a user successfully creates an OkHi address.
|
|
134
|
-
*/
|
|
135
|
-
userId?: string;
|
|
136
|
-
/**
|
|
137
|
-
* The location's property number.
|
|
138
|
-
*/
|
|
139
|
-
propertyNumber?: string;
|
|
140
|
-
/**
|
|
141
|
-
* A link to the location's gate photo.
|
|
142
|
-
*/
|
|
143
|
-
photo?: string;
|
|
144
|
-
/**
|
|
145
|
-
* A user's country
|
|
146
|
-
*/
|
|
147
|
-
country?: string;
|
|
148
|
-
/**
|
|
149
|
-
* A user's city
|
|
150
|
-
*/
|
|
151
|
-
city?: string;
|
|
152
|
-
/**
|
|
153
|
-
* A user's state
|
|
154
|
-
*/
|
|
155
|
-
state?: string;
|
|
156
|
-
/**
|
|
157
|
-
* A formatted location information
|
|
158
|
-
*/
|
|
159
|
-
displayTitle?: string;
|
|
160
|
-
/**
|
|
161
|
-
* A user's country code
|
|
162
|
-
*/
|
|
163
|
-
countryCode?: string;
|
|
164
|
-
/**
|
|
165
|
-
* An array of usage types that specifies the mode of verification. Can include "physical_verification" and/or "digital_verification" as valid values.
|
|
166
|
-
*/
|
|
167
|
-
usageTypes?: UsageType;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* @ignore
|
|
171
|
-
*/
|
|
172
|
-
export interface OkHiError {
|
|
173
|
-
code: string;
|
|
174
|
-
message: string;
|
|
175
|
-
}
|
|
176
|
-
export type OkHiApplicationConfiguration = {
|
|
177
|
-
credentials: {
|
|
178
|
-
branchId: string;
|
|
179
|
-
clientKey: string;
|
|
180
|
-
};
|
|
181
|
-
context: {
|
|
182
|
-
mode: 'sandbox' | 'prod';
|
|
183
|
-
developer?: 'okhi' | 'external';
|
|
184
|
-
};
|
|
185
|
-
app?: {
|
|
186
|
-
name?: string;
|
|
187
|
-
version?: string;
|
|
188
|
-
build?: string;
|
|
189
|
-
};
|
|
190
|
-
notification?: {
|
|
191
|
-
title: string;
|
|
192
|
-
text: string;
|
|
193
|
-
channelId: string;
|
|
194
|
-
channelName: string;
|
|
195
|
-
channelDescription: string;
|
|
196
|
-
};
|
|
197
|
-
user?: OkHiUser;
|
|
198
|
-
};
|
|
199
|
-
export type LocationPermissionStatus = 'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'authorized' | 'unknown';
|
|
200
|
-
export type LocationPermissionStatusCallback = LocationPermissionStatus | 'rationaleDissmissed';
|
|
201
|
-
export type LocationRequestPermissionType = 'whenInUse' | 'always';
|
|
202
|
-
export type LocationPermissionCallback = (status: LocationPermissionStatusCallback | null, error: OkHiException | null) => any;
|
|
203
|
-
export type UsageType = Array<'physical_verification' | 'digital_verification' | 'address_book'>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { NativeEventEmitter } from 'react-native';
|
|
2
|
-
type OkHiNativeModuleType = {
|
|
3
|
-
isLocationServicesEnabled(): Promise<boolean>;
|
|
4
|
-
isLocationPermissionGranted(): Promise<boolean>;
|
|
5
|
-
isBackgroundLocationPermissionGranted(): Promise<boolean>;
|
|
6
|
-
requestLocationPermission(): Promise<boolean>;
|
|
7
|
-
requestBackgroundLocationPermission(): Promise<boolean>;
|
|
8
|
-
requestEnableLocationServices(): Promise<boolean>;
|
|
9
|
-
isGooglePlayServicesAvailable(): Promise<boolean>;
|
|
10
|
-
requestEnableGooglePlayServices(): Promise<boolean>;
|
|
11
|
-
getSystemVersion(): Promise<number | string>;
|
|
12
|
-
getAuthToken(branchId: string, clientKey: string): Promise<string>;
|
|
13
|
-
initialize(configuration: string): Promise<void>;
|
|
14
|
-
startAddressVerification(token: string, phoneNumber: string, userId: string, locationId: string, lat: Number, lon: Number, usageTypes: string[]): Promise<string>;
|
|
15
|
-
stopAddressVerification(phoneNumber: string, locationId: string): Promise<string>;
|
|
16
|
-
startForegroundService(): Promise<boolean>;
|
|
17
|
-
stopForegroundService(): Promise<boolean>;
|
|
18
|
-
isForegroundServiceRunning(): Promise<boolean>;
|
|
19
|
-
initializeIOS(branchId: string, clientKey: string, environment: string): Promise<boolean>;
|
|
20
|
-
openAppSettings(): Promise<void>;
|
|
21
|
-
retriveLocationPermissionStatus(): Promise<string>;
|
|
22
|
-
requestTrackingAuthorization(): Promise<string | null>;
|
|
23
|
-
canOpenProtectedAppsSettings(): Promise<boolean>;
|
|
24
|
-
openProtectedAppsSettings(): Promise<boolean>;
|
|
25
|
-
retrieveDeviceInfo(): Promise<{
|
|
26
|
-
manufacturer: string;
|
|
27
|
-
model: string;
|
|
28
|
-
osVersion: string;
|
|
29
|
-
platform: 'android' | 'ios';
|
|
30
|
-
}>;
|
|
31
|
-
setItem(key: string, value: string): Promise<boolean>;
|
|
32
|
-
onNewToken(fcmPushNotificationToken: string): Promise<boolean>;
|
|
33
|
-
onMessageReceived(): Promise<boolean>;
|
|
34
|
-
isNotificationPermissionGranted(): Promise<boolean>;
|
|
35
|
-
requestNotificationPermission(): Promise<boolean>;
|
|
36
|
-
fetchCurrentLocation(): Promise<null | {
|
|
37
|
-
lat: number;
|
|
38
|
-
lng: number;
|
|
39
|
-
accuracy: number;
|
|
40
|
-
}>;
|
|
41
|
-
fetchIOSLocationPermissionStatus(): Promise<'notDetermined' | 'restricted' | 'denied' | 'authorizedAlways' | 'authorizedWhenInUse' | 'authorized' | 'unknown'>;
|
|
42
|
-
onStart(): Promise<boolean>;
|
|
43
|
-
fetchRegisteredGeofences(): Promise<string | null>;
|
|
44
|
-
getLocationAccuracyLevel(): Promise<'no_permission' | 'approximate' | 'precise'>;
|
|
45
|
-
};
|
|
46
|
-
export declare const OkHiNativeModule: OkHiNativeModuleType;
|
|
47
|
-
export declare const OkHiNativeEvents: NativeEventEmitter;
|
|
48
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { OkCollectSuccessResponse } from '../OkCollect/types';
|
|
2
|
-
import type { UsageType } from '../OkCore';
|
|
3
|
-
/**
|
|
4
|
-
* Starts verification for a particular address
|
|
5
|
-
* @param {string} phoneNumber A users phone number
|
|
6
|
-
* @param {string} locationId An OkHi location identifier obtained after successfull creation of addresses.
|
|
7
|
-
* @param {number} lat The latitude of the created address
|
|
8
|
-
* @param {number} lon The longitude of the created address
|
|
9
|
-
* @param usageTypes - Optional. An array of verification types that specifies the mode of verification.
|
|
10
|
-
* Can include "physical" and/or "digital" as valid values.
|
|
11
|
-
* @returns {Promise<string>} A promise that resolves to a string value of the location identifier
|
|
12
|
-
*/
|
|
13
|
-
export declare const start: (token: string, phoneNumber: string, okhiUserId: string, locationId: string, lat: number, lon: number, usageTypes?: UsageType) => Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Starts verification for a particular address using the response object returned by OkCollect
|
|
16
|
-
* @param {Object} response Response returned by OkCollect
|
|
17
|
-
* @returns {Promise<string>} A promise that resolves to a string value of the location identifier
|
|
18
|
-
*/
|
|
19
|
-
export declare const startVerification: (response: OkCollectSuccessResponse) => Promise<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Stops verification for a particular address using a user's phonenumber and OkHi location identifier
|
|
22
|
-
* @param {string} phoneNumber The user's phone number
|
|
23
|
-
* @param {string} locationId An OkHi location identifier obtained after successfull creation of addresses.
|
|
24
|
-
* @returns {Promise<string>} A promise that resolves to a string value of the location identifier
|
|
25
|
-
*/
|
|
26
|
-
export declare const stopVerification: (phoneNumber: string, locationId: string) => Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Android Only - Starts a foreground service that speeds up rate of verification
|
|
29
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service has started successfully
|
|
30
|
-
*/
|
|
31
|
-
export declare const startForegroundService: () => Promise<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* Android Only - Stops previously started foreground services
|
|
34
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service has stopped successfully
|
|
35
|
-
*/
|
|
36
|
-
export declare const stopForegroundService: () => Promise<boolean>;
|
|
37
|
-
/**
|
|
38
|
-
* Android Only - Checks if the foreground service is running
|
|
39
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service is running
|
|
40
|
-
*/
|
|
41
|
-
export declare const isForegroundServiceRunning: () => Promise<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Checks whether all necessary permissions and services are available in order to start the address verification process
|
|
44
|
-
* @param {Object} configuration Object that determines whether or not to request these permissions and services from the user
|
|
45
|
-
* @param {boolean} configuration.requestServices Flag that determines whether to request the services from the user
|
|
46
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether or not all conditions are met to start the address verification process
|
|
47
|
-
*/
|
|
48
|
-
export declare const canStartVerification: (configuration?: {
|
|
49
|
-
requestServices?: boolean;
|
|
50
|
-
}) => Promise<boolean>;
|
|
51
|
-
/**
|
|
52
|
-
* Checks whether all necessary permissions and services are available in order to start the address verification process
|
|
53
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether or not all conditions are met to start the address verification process
|
|
54
|
-
*/
|
|
55
|
-
export declare const checkVerificationStartRequirements: () => Promise<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* Android Only - Updates user's device firebase push notification token
|
|
58
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service has started successfully
|
|
59
|
-
*/
|
|
60
|
-
export declare const onNewToken: (fcmPushNotificationToken: string) => Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Android Only - Should be invoked only when push notification is received.
|
|
63
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether the service has started successfully
|
|
64
|
-
*/
|
|
65
|
-
export declare const onMessageReceived: () => Promise<boolean>;
|
|
File without changes
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
-
|
|
6
|
-
Pod::Spec.new do |s|
|
|
7
|
-
s.name = "react-native-okhi"
|
|
8
|
-
s.version = package["version"]
|
|
9
|
-
s.summary = package["description"]
|
|
10
|
-
s.homepage = package["homepage"]
|
|
11
|
-
s.license = package["license"]
|
|
12
|
-
s.authors = package["author"]
|
|
13
|
-
|
|
14
|
-
s.platforms = { :ios => "12.0" }
|
|
15
|
-
s.source = { :git => "https://github.com/OkHi/react-native-okhi.git", :tag => "#{s.version}" }
|
|
16
|
-
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
-
|
|
19
|
-
s.dependency "React-Core"
|
|
20
|
-
s.dependency "OkHi", "1.9.52"
|
|
21
|
-
|
|
22
|
-
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
24
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
25
|
-
s.pod_target_xcconfig = {
|
|
26
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
27
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
s.dependency "React-Codegen"
|
|
31
|
-
s.dependency "RCTRequired"
|
|
32
|
-
s.dependency "RCTTypeSafety"
|
|
33
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
34
|
-
end
|
|
35
|
-
end
|
package/src/OkCollect/Helpers.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
import {
|
|
3
|
-
isLocationServicesEnabled,
|
|
4
|
-
isLocationPermissionGranted,
|
|
5
|
-
isGooglePlayServicesAvailable,
|
|
6
|
-
requestEnableLocationServices,
|
|
7
|
-
requestEnableGooglePlayServices,
|
|
8
|
-
requestLocationPermission,
|
|
9
|
-
} from '../OkCore/Helpers';
|
|
10
|
-
import { OkHiException } from '../OkCore/OkHiException';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Checks whether all necessary permissions and services are available in order to start the address creation process.
|
|
14
|
-
* @param {Object} configuration Object that determines whether or not to request these permissions and services from the user.
|
|
15
|
-
* @param {boolean} configuration.requestServices Flag that determines whether to request the services from the user.
|
|
16
|
-
* @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether or not all conditions are met to start the address creation process.
|
|
17
|
-
*/
|
|
18
|
-
export const canStartAddressCreation = (configuration?: {
|
|
19
|
-
requestServices?: boolean;
|
|
20
|
-
}): Promise<boolean> => {
|
|
21
|
-
return new Promise(async (resolve, reject) => {
|
|
22
|
-
const requestServices = configuration && configuration.requestServices;
|
|
23
|
-
const locationServicesStatus = await isLocationServicesEnabled();
|
|
24
|
-
const googlePlayServices =
|
|
25
|
-
Platform.OS === 'android' ? await isGooglePlayServicesAvailable() : true;
|
|
26
|
-
const locationPerm = await isLocationPermissionGranted();
|
|
27
|
-
if (!requestServices) {
|
|
28
|
-
resolve(locationServicesStatus && googlePlayServices && locationPerm);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (!locationServicesStatus && Platform.OS === 'ios') {
|
|
32
|
-
reject(
|
|
33
|
-
new OkHiException({
|
|
34
|
-
code: OkHiException.SERVICE_UNAVAILABLE_CODE,
|
|
35
|
-
message: 'Location services is unavailable',
|
|
36
|
-
})
|
|
37
|
-
);
|
|
38
|
-
} else {
|
|
39
|
-
const locationServicesRequestStatus =
|
|
40
|
-
Platform.OS === 'ios'
|
|
41
|
-
? true
|
|
42
|
-
: ((await requestEnableLocationServices()) as boolean);
|
|
43
|
-
const gPlayServices =
|
|
44
|
-
Platform.OS === 'android'
|
|
45
|
-
? await requestEnableGooglePlayServices()
|
|
46
|
-
: true;
|
|
47
|
-
const locationPermStatus = await requestLocationPermission();
|
|
48
|
-
resolve(
|
|
49
|
-
locationServicesRequestStatus && gPlayServices && locationPermStatus
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
};
|