dojah-kyc-sdk-react-expo 0.1.0

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.
Files changed (44) hide show
  1. package/.eslintrc.js +5 -0
  2. package/README.md +211 -0
  3. package/android/build.gradle +55 -0
  4. package/android/src/main/AndroidManifest.xml +2 -0
  5. package/android/src/main/java/com/dojah/dojah_Kyc_rn_expo/DojahKycSdkReactExpoModule.kt +234 -0
  6. package/android/src/main/java/com/dojah/dojah_Kyc_rn_expo/DojahKycSdkReactExpoView.kt +30 -0
  7. package/app.plugin.js +5 -0
  8. package/build/DojahKycSdkReactExpo.types.d.ts +18 -0
  9. package/build/DojahKycSdkReactExpo.types.d.ts.map +1 -0
  10. package/build/DojahKycSdkReactExpo.types.js +2 -0
  11. package/build/DojahKycSdkReactExpo.types.js.map +1 -0
  12. package/build/DojahKycSdkReactExpoModule.d.ts +8 -0
  13. package/build/DojahKycSdkReactExpoModule.d.ts.map +1 -0
  14. package/build/DojahKycSdkReactExpoModule.js +4 -0
  15. package/build/DojahKycSdkReactExpoModule.js.map +1 -0
  16. package/build/DojahKycSdkReactExpoModule.web.d.ts +8 -0
  17. package/build/DojahKycSdkReactExpoModule.web.d.ts.map +1 -0
  18. package/build/DojahKycSdkReactExpoModule.web.js +8 -0
  19. package/build/DojahKycSdkReactExpoModule.web.js.map +1 -0
  20. package/build/DojahKycSdkReactExpoView.d.ts +4 -0
  21. package/build/DojahKycSdkReactExpoView.d.ts.map +1 -0
  22. package/build/DojahKycSdkReactExpoView.js +7 -0
  23. package/build/DojahKycSdkReactExpoView.js.map +1 -0
  24. package/build/DojahKycSdkReactExpoView.web.d.ts +4 -0
  25. package/build/DojahKycSdkReactExpoView.web.d.ts.map +1 -0
  26. package/build/DojahKycSdkReactExpoView.web.js +7 -0
  27. package/build/DojahKycSdkReactExpoView.web.js.map +1 -0
  28. package/build/index.d.ts +3 -0
  29. package/build/index.d.ts.map +1 -0
  30. package/build/index.js +5 -0
  31. package/build/index.js.map +1 -0
  32. package/expo-module.config.json +9 -0
  33. package/ios/DojahKycSdkReactExpo.podspec +29 -0
  34. package/ios/DojahKycSdkReactExpoModule.swift +38 -0
  35. package/ios/DojahKycSdkReactExpoView.swift +38 -0
  36. package/package.json +48 -0
  37. package/plugin/withDojahKyc.js +67 -0
  38. package/src/DojahKycSdkReactExpo.types.ts +19 -0
  39. package/src/DojahKycSdkReactExpoModule.ts +13 -0
  40. package/src/DojahKycSdkReactExpoModule.web.ts +11 -0
  41. package/src/DojahKycSdkReactExpoView.tsx +11 -0
  42. package/src/DojahKycSdkReactExpoView.web.tsx +15 -0
  43. package/src/index.ts +4 -0
  44. package/tsconfig.json +9 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['universe/native', 'universe/web'],
4
+ ignorePatterns: ['build'],
5
+ };
package/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # Dojah KYC SDK (React Native Expo)
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ npm install dojah-kyc-sdk-react-expo
7
+ ```
8
+
9
+ ### Permissions
10
+
11
+ For Android you don't need to declare permissions, its already included in the Package.
12
+
13
+ ## IOS Setup
14
+
15
+ ### Requirements
16
+
17
+ * Minimum iOS version - 14
18
+
19
+ ### Add the following POD dependencies in your Podfile app under your App target
20
+
21
+ ```
22
+ pod 'Realm', '~> 10.52.2', :modular_headers => true
23
+ pod 'DojahWidget', :git => 'https://github.com/dojah-inc/sdk-swift.git', :branch => 'pod-package'
24
+ ```
25
+
26
+ example
27
+
28
+ ```
29
+ target 'Example' do
30
+ ...
31
+ pod 'Realm', '~> 10.52.2', :modular_headers => true
32
+ pod 'DojahWidget', :git => 'https://github.com/dojah-inc/sdk-swift.git', :branch => 'pod-package'
33
+ ...
34
+ end
35
+ ```
36
+
37
+ and run pod install in your ios folder:
38
+
39
+ ```sh
40
+ cd ios
41
+ pod install
42
+ ```
43
+
44
+ ### Permissions
45
+
46
+ For IOS, Add the following keys to your Info.plist file:
47
+
48
+ NSCameraUsageDescription - describe why your app needs access to the camera. This is called
49
+ Privacy - Camera Usage Description in the visual editor.
50
+
51
+ NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend
52
+ to record videos. This is called Privacy - Microphone Usage Description in the visual editor.
53
+
54
+ NSLocationWhenInUseUsageDescription - describe why your app needs access to the location, if you
55
+ intend to verify address/location. This is called Privacy - Location Usage Description in the visual
56
+ editor.
57
+
58
+ ## Usage
59
+
60
+ To start KYC, import Dojah in your React Native code, and launch Dojah Screen
61
+
62
+ ```js
63
+ import DojahKycSdk from 'dojah-kyc-sdk-react-expo';
64
+
65
+
66
+ /**
67
+ * The following parameters are available
68
+ * for launching the flow.
69
+ */
70
+
71
+ /**
72
+ * This is your widget ID, a unique identifier for your Dojah flow. You can find it in your Dojah Dashboard after creating and publishing a flow. Replace `'your-widget-id'` with the actual widget ID from your dashboard.
73
+ */
74
+ const widgetId = 'your-widget-id';
75
+
76
+ /**
77
+ * Reference ID: This is an optional parameter that allows you to initialize the SDK for an ongoing verification process.
78
+ */
79
+ const referenceId = 'your-reference-id';
80
+
81
+ /**
82
+ * Email: This is an optional parameter that allows you to initialize the SDK with the user's email address.
83
+ */
84
+ const email = 'your-email@example.com';
85
+
86
+ /**
87
+ * User Data: This object contains personal information about the user, such as their first name, last name, date of birth, and email.
88
+ */
89
+ const userData = {
90
+ firstName: 'John',
91
+ lastName: 'Doe',
92
+ dob: '1990-01-01',
93
+ email: email
94
+ };
95
+
96
+ /**
97
+ * Government Data: This object contains government-issued identifiers such as BVN, driver's license, NIN, and voter ID.
98
+ */
99
+ const govData = {
100
+ bvn: 'your-bvn',
101
+ dl: 'your-dl',
102
+ nin: 'your-nin',
103
+ vnin: 'your-vnin'
104
+ };
105
+
106
+ /**
107
+ * Government ID: This object contains various types of government-issued IDs, such as national ID, passport, driver's license, voter ID, and others.
108
+ */
109
+ const govId = {
110
+ national: 'your-national-id',
111
+ passport: 'your-passport-id',
112
+ dl: 'your-dl-id',
113
+ voter: 'your-voter-id',
114
+ nin: 'your-nin-id',
115
+ others: 'your-others-id'
116
+ };
117
+
118
+ /**
119
+ * Location: This object contains the latitude and longitude of the user's location, which can be used for address verification.
120
+ */
121
+ const location = {
122
+ latitude: 'your-latitude',
123
+ longitude: 'your-longitude'
124
+ };
125
+
126
+ /**
127
+ * Business Data: This object contains business-related information, such as the CAC (Corporate Affairs Commission) registration number.
128
+ */
129
+ const businessData = {
130
+ cac: 'your-cac'
131
+ };
132
+
133
+ /**
134
+ * Address: This is the user's address, which can be used for address verification.
135
+ */
136
+ const address = 'your-address';
137
+
138
+ /**
139
+ * Metadata: This object contains additional key-value pairs that can be used to pass custom data to the SDK.
140
+ */
141
+ const metadata = {
142
+ key1: 'value1',
143
+ key2: 'value2'
144
+ };
145
+
146
+ /**
147
+ * to launch the flow only [widgetId] is mandatory
148
+ * @returns - the Promise of the result, promise
149
+ * will return a status that you can use to track
150
+ * the immidiate progress.
151
+ * @throws - an error if the Dojah KYC flow fails
152
+ */
153
+
154
+ const status = await DojahKycSdk.launch(widgetId, referenceId, email, {
155
+ userData: userData,
156
+ govData: govData,
157
+ govId: govId,
158
+ location: location,
159
+ businessData: businessData,
160
+ address: address,
161
+ metadata: metadata
162
+ });
163
+ switch(status){
164
+ case 'approved':
165
+ //kyc approved
166
+ console.log('KYC Approved');
167
+ break;
168
+ case 'pending':
169
+ //kyc pending
170
+ console.log('KYC Pending');
171
+ break;
172
+ case 'failed':
173
+ //kyc failed
174
+ console.log('KYC Failed');
175
+ break;
176
+ case 'closed':
177
+ //user has cancelled the KYC
178
+ console.log('KYC Closed');
179
+ }
180
+ ```
181
+
182
+ ## How to Get a Widget ID
183
+ To use the SDK, you need a WidgetID, which is a required parameter for initializing the SDK. You can obtain this by creating a flow on the Dojah platform. Follow these steps to configure and get your Widget ID:
184
+
185
+ ```txt
186
+ 1. Log in to your Dojah Dashboard: If you don’t have an account, sign up on the Dojah platform.
187
+
188
+ 2. Navigate to the EasyOnboard Feature: Once logged in, find the EasyOnboard section on your dashboard.
189
+
190
+ 3. Create a Flow:
191
+
192
+ - Click on the 'Create a Flow' button.
193
+ - Name Your Flow: Choose a meaningful name for your flow, which will help you identify it later.
194
+
195
+ 4. Add an Application:
196
+
197
+ - Either create a new application or add an existing one.
198
+ - Customise your widget with your brand logo and color by selecting an application.
199
+
200
+ 5. Configure the Flow:
201
+
202
+ - Select a Country: Choose the country or countries relevant to your verification process.
203
+ - Select a Preview Process: Decide between automatic or manual verification.
204
+ - Notification Type: Choose how you’d like to receive notifications for updates (email, SMS, etc.).
205
+ - Add Verification Pages: Customize the verification steps in your flow (e.g., ID verification, address verification, etc.).
206
+
207
+ 6. Publish Your Widget: After configuring your flow, publish the widget. Once published, your flow is live.
208
+
209
+ 7. Copy Your Widget ID: After publishing, the platform will generate a Widget ID. Copy this Widget ID as you will need it to initialize the SDK as stated above.
210
+ ```
211
+
@@ -0,0 +1,55 @@
1
+ apply plugin: 'com.android.library'
2
+
3
+ group = 'com.dojah.dojah_Kyc_rn_expo'
4
+ version = '0.1.0'
5
+
6
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useExpoPublishing()
11
+
12
+ // If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
13
+ // The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
14
+ // Most of the time, you may like to manage the Android SDK versions yourself.
15
+ def useManagedAndroidSdkVersions = false
16
+ if (useManagedAndroidSdkVersions) {
17
+ useDefaultAndroidSdkVersions()
18
+ } else {
19
+ buildscript {
20
+ // Simple helper that allows the root project to override versions declared by this library.
21
+ ext.safeExtGet = { prop, fallback ->
22
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
+ }
24
+ }
25
+ project.android {
26
+ compileSdkVersion safeExtGet("compileSdkVersion", 34)
27
+ defaultConfig {
28
+ minSdkVersion safeExtGet("minSdkVersion", 21)
29
+ targetSdkVersion safeExtGet("targetSdkVersion", 34)
30
+ }
31
+ }
32
+ }
33
+
34
+ android {
35
+ namespace "com.dojah.dojah_Kyc_rn_expo"
36
+ defaultConfig {
37
+ versionCode 1
38
+ versionName "0.1.0"
39
+ }
40
+ lintOptions {
41
+ abortOnError false
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ google()
47
+ mavenCentral()
48
+ maven { url "https://jitpack.io" }
49
+ }
50
+
51
+
52
+ dependencies {
53
+ // implementation 'com.github.dojah-inc:sdk-kotlin:v0.0.1-dev'
54
+ implementation 'com.github.dojah-inc:sdk-kotlin:v0.0.4-dev'
55
+ }
@@ -0,0 +1,2 @@
1
+ <manifest>
2
+ </manifest>
@@ -0,0 +1,234 @@
1
+ package com.dojah.dojah_Kyc_rn_expo
2
+
3
+ import expo.modules.kotlin.modules.Module
4
+ import expo.modules.kotlin.modules.ModuleDefinition
5
+ import java.net.URL
6
+ import android.app.Activity
7
+ import android.content.Intent
8
+ import android.util.Log
9
+ import com.dojah.kyc_sdk_kotlin.DOJAH_RESULT_KEY
10
+ import com.dojah.kyc_sdk_kotlin.domain.ExtraUserData
11
+ import com.dojah.kyc_sdk_kotlin.DojahSdk
12
+ import com.dojah.kyc_sdk_kotlin.domain.UserData
13
+ import com.dojah.kyc_sdk_kotlin.domain.GovData
14
+ import com.dojah.kyc_sdk_kotlin.domain.GovId
15
+ import com.dojah.kyc_sdk_kotlin.domain.Location
16
+ import com.dojah.kyc_sdk_kotlin.domain.BusinessData
17
+ import expo.modules.core.interfaces.ActivityEventListener
18
+ import expo.modules.kotlin.Promise
19
+ import expo.modules.kotlin.exception.CodedException
20
+ import expo.modules.kotlin.records.Field
21
+ import expo.modules.kotlin.records.Record
22
+
23
+ const val BACKWARD_CALL_REQUEST_CODE = 1001
24
+
25
+ class DojahKycSdkReactExpoModule : Module() {
26
+ var mPromise: Promise? = null
27
+
28
+ // Each module class must implement the definition function. The definition consists of components
29
+ // that describes the module's functionality and behavior.
30
+ // See https://docs.expo.dev/modules/module-api for more details about available components.
31
+ override fun definition() = ModuleDefinition {
32
+ // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
33
+ // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
34
+ // The module will be accessible from `requireNativeModule('DojahKycSdkReactExpo')` in JavaScript.
35
+ Name("DojahKycSdk")
36
+
37
+ // Defines event names that the module can send to JavaScript.
38
+ Events("onChange")
39
+
40
+ // Defines a JavaScript function that always returns a Promise and whose native code
41
+ // is by default dispatched on the different thread than the JavaScript runtime runs on.
42
+ AsyncFunction("launch") { widgetId: String, referenceId: String?, email: String?, extraData: ExtraDataRecord?, promise: Promise ->
43
+ mPromise = promise
44
+ val reactContext = appContext.reactContext
45
+ val activity = appContext.currentActivity
46
+ if (reactContext == null || activity == null)
47
+ mPromise?.reject(CodedException("Activity does not exist"))
48
+ else {
49
+ try {
50
+ DojahSdk.with(reactContext)
51
+ .launchWithBackwardCompatibility(
52
+ activity,
53
+ widgetId,
54
+ referenceId,
55
+ email,
56
+ extraData = extraData?.toExtraUserData()?: ExtraUserData(),
57
+ )
58
+ Log.d("DojahKycSdk", "data passed -> ${extraData?.toExtraUserData()}")
59
+ } catch (e: Exception) {
60
+ e.printStackTrace()
61
+ mPromise?.reject(CodedException("Error launching Dojah SDK"))
62
+ }
63
+ }
64
+ }
65
+
66
+
67
+ OnActivityResult { _, payload ->
68
+ val requestCode = payload.requestCode
69
+ val resultCode = payload.resultCode
70
+ val data = payload.data
71
+ if (requestCode == BACKWARD_CALL_REQUEST_CODE) {
72
+ if (resultCode == Activity.RESULT_OK) {
73
+ val result = data?.getStringExtra(DOJAH_RESULT_KEY)
74
+ mPromise?.resolve(result)
75
+ } else {
76
+ mPromise?.reject(CodedException("Activity did not return OK"))
77
+ }
78
+ mPromise = null
79
+ }
80
+ }
81
+
82
+
83
+ // Enables the module to be used as a native view. Definition components that are accepted as part of
84
+ // the view definition: Prop, Events.
85
+ View(DojahKycSdkReactExpoView::class) {
86
+ // Defines a setter for the `url` prop.
87
+ Prop("url") { view: DojahKycSdkReactExpoView, url: URL ->
88
+ view.webView.loadUrl(url.toString())
89
+ }
90
+ // Defines an event that the view can send to JavaScript.
91
+ Events("onLoad")
92
+ }
93
+ }
94
+ }
95
+
96
+ class ExtraDataRecord : Record {
97
+ @Field
98
+ val userData: UserRecord? = null
99
+
100
+ @Field
101
+ val govData: GovDataRecord? = null
102
+
103
+ @Field
104
+ val govId: GovIdRecord? = null
105
+
106
+ @Field
107
+ val location: LocationRecord? = null
108
+
109
+ @Field
110
+ val businessData: BusinessDataRecord? = null
111
+
112
+ @Field
113
+ val address: String? = null
114
+
115
+ @Field
116
+ val metadata: Map<String, Any>? = null
117
+
118
+ fun toExtraUserData(): ExtraUserData {
119
+ return ExtraUserData(
120
+ userData = userData?.toUserData(),
121
+ govData = govData?.toGovData(),
122
+ govId = govId?.toGovId(),
123
+ location = location?.toLocation(),
124
+ businessData = businessData?.toBusinessData(),
125
+ address = address,
126
+ metadata = metadata
127
+ )
128
+ }
129
+
130
+ }
131
+
132
+
133
+ class UserRecord : Record {
134
+ @Field
135
+ val firstName: String? = null
136
+
137
+ @Field
138
+ val lastName: String? = null
139
+
140
+ @Field
141
+ val dob: String? = null
142
+
143
+ @Field
144
+ val email: String? = null
145
+
146
+ fun toUserData(): UserData {
147
+ return UserData(
148
+ firstName = firstName,
149
+ lastName = lastName,
150
+ dob = dob,
151
+ email = email
152
+ )
153
+ }
154
+ }
155
+
156
+ class GovDataRecord : Record {
157
+ @Field
158
+ val bvn: String? = null
159
+
160
+ @Field
161
+ val dl: String? = null
162
+
163
+ @Field
164
+ val nin: String? = null
165
+
166
+ @Field
167
+ val vnin: String? = null
168
+
169
+ fun toGovData(): GovData {
170
+ return GovData(
171
+ bvn = bvn,
172
+ dl = dl,
173
+ nin = nin,
174
+ vnin = vnin
175
+ )
176
+ }
177
+ }
178
+
179
+ class GovIdRecord : Record {
180
+ @Field
181
+ val national: String? = null
182
+
183
+ @Field
184
+ val passport: String? = null
185
+
186
+ @Field
187
+ val dl: String? = null
188
+
189
+ @Field
190
+ val voter: String? = null
191
+
192
+ @Field
193
+ val nin: String? = null
194
+
195
+ @Field
196
+ val others: String? = null
197
+
198
+ fun toGovId(): GovId {
199
+ return GovId(
200
+ national = national,
201
+ passport = passport,
202
+ dl = dl,
203
+ voter = voter,
204
+ nin = nin,
205
+ others = others
206
+ )
207
+ }
208
+ }
209
+
210
+ class LocationRecord : Record {
211
+ @Field
212
+ val latitude: String? = null
213
+
214
+ @Field
215
+ val longitude: String? = null
216
+
217
+ fun toLocation(): Location {
218
+ return Location(
219
+ latitude = latitude,
220
+ longitude = longitude
221
+ )
222
+ }
223
+ }
224
+
225
+ class BusinessDataRecord : Record {
226
+ @Field
227
+ val cac: String? = null
228
+
229
+ fun toBusinessData(): BusinessData {
230
+ return BusinessData(
231
+ cac = cac
232
+ )
233
+ }
234
+ }
@@ -0,0 +1,30 @@
1
+ package com.dojah.dojah_Kyc_rn_expo
2
+
3
+ import android.content.Context
4
+ import android.webkit.WebView
5
+ import android.webkit.WebViewClient
6
+ import expo.modules.kotlin.AppContext
7
+ import expo.modules.kotlin.viewevent.EventDispatcher
8
+ import expo.modules.kotlin.views.ExpoView
9
+
10
+ class DojahKycSdkReactExpoView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {
11
+ // Creates and initializes an event dispatcher for the `onLoad` event.
12
+ // The name of the event is inferred from the value and needs to match the event name defined in the module.
13
+ private val onLoad by EventDispatcher()
14
+
15
+ // Defines a WebView that will be used as the root subview.
16
+ internal val webView = WebView(context).apply {
17
+ layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
18
+ webViewClient = object : WebViewClient() {
19
+ override fun onPageFinished(view: WebView, url: String) {
20
+ // Sends an event to JavaScript. Triggers a callback defined on the view component in JavaScript.
21
+ onLoad(mapOf("url" to url))
22
+ }
23
+ }
24
+ }
25
+
26
+ init {
27
+ // Adds the WebView to the view hierarchy.
28
+ addView(webView)
29
+ }
30
+ }
package/app.plugin.js ADDED
@@ -0,0 +1,5 @@
1
+ const withDojahKyc = require('./plugin/withDojahKyc');
2
+
3
+ module.exports = function withPlugin(config) {
4
+ return withDojahKyc(config);
5
+ };
@@ -0,0 +1,18 @@
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
+ export type OnLoadEventPayload = {
3
+ url: string;
4
+ };
5
+ export type DojahKycSdkReactExpoModuleEvents = {
6
+ onChange: (params: ChangeEventPayload) => void;
7
+ };
8
+ export type ChangeEventPayload = {
9
+ value: string;
10
+ };
11
+ export type DojahKycSdkReactExpoViewProps = {
12
+ url: string;
13
+ onLoad: (event: {
14
+ nativeEvent: OnLoadEventPayload;
15
+ }) => void;
16
+ style?: StyleProp<ViewStyle>;
17
+ };
18
+ //# sourceMappingURL=DojahKycSdkReactExpo.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpo.types.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpo.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,kBAAkB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DojahKycSdkReactExpo.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpo.types.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpo.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nexport type OnLoadEventPayload = {\n url: string;\n};\n\nexport type DojahKycSdkReactExpoModuleEvents = {\n onChange: (params: ChangeEventPayload) => void;\n};\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type DojahKycSdkReactExpoViewProps = {\n url: string;\n onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;\n style?: StyleProp<ViewStyle>;\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import { NativeModule } from 'expo';
2
+ import { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';
3
+ declare class DojahKycSdk extends NativeModule<DojahKycSdkReactExpoModuleEvents> {
4
+ launch(widgetId: string, referenceId?: string | null, email?: string | null, extraData?: Record<string, any> | null): Promise<string>;
5
+ }
6
+ declare const _default: DojahKycSdk;
7
+ export default _default;
8
+ //# sourceMappingURL=DojahKycSdkReactExpoModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoModule.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,OAAO,WAAY,SAAQ,YAAY,CAAC,gCAAgC,CAAC;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC5C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GACrC,OAAO,CAAC,MAAM,CAAC;CACzB;;AAGD,wBAA+D"}
@@ -0,0 +1,4 @@
1
+ import { requireNativeModule } from 'expo';
2
+ // This call loads the native module object from the JSI.
3
+ export default requireNativeModule('DojahKycSdk');
4
+ //# sourceMappingURL=DojahKycSdkReactExpoModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoModule.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAWzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAc,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';\n\ndeclare class DojahKycSdk extends NativeModule<DojahKycSdkReactExpoModuleEvents> {\n launch(widgetId: string, referenceId?: string | null,\n email?: string | null,\n extraData?: Record<string, any> | null\n ): Promise<string>;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<DojahKycSdk>('DojahKycSdk');\n"]}
@@ -0,0 +1,8 @@
1
+ import { NativeModule } from 'expo';
2
+ import { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';
3
+ declare class DojahKycSdkReactExpoModule extends NativeModule<DojahKycSdkReactExpoModuleEvents> {
4
+ launch(value: string): Promise<void>;
5
+ }
6
+ declare const _default: typeof DojahKycSdkReactExpoModule;
7
+ export default _default;
8
+ //# sourceMappingURL=DojahKycSdkReactExpoModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoModule.web.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAE,MAAM,MAAM,CAAC;AAEvD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhF,cAAM,0BAA2B,SAAQ,YAAY,CAAC,gCAAgC,CAAC;IAC/E,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3C;;AAED,wBAA4E"}
@@ -0,0 +1,8 @@
1
+ import { registerWebModule, NativeModule } from 'expo';
2
+ class DojahKycSdkReactExpoModule extends NativeModule {
3
+ async launch(value) {
4
+ this.emit('onChange', { value });
5
+ }
6
+ }
7
+ export default registerWebModule(DojahKycSdkReactExpoModule, 'DojahKycSdk');
8
+ //# sourceMappingURL=DojahKycSdkReactExpoModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoModule.web.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIvD,MAAM,0BAA2B,SAAQ,YAA8C;IACrF,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { registerWebModule, NativeModule } from 'expo';\n\nimport { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';\n\nclass DojahKycSdkReactExpoModule extends NativeModule<DojahKycSdkReactExpoModuleEvents> {\n async launch(value: string): Promise<void> {\n this.emit('onChange', { value });\n }\n}\n\nexport default registerWebModule(DojahKycSdkReactExpoModule, 'DojahKycSdk');\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { DojahKycSdkReactExpoViewProps } from './DojahKycSdkReactExpo.types';
3
+ export default function DojahKycSdkReactExpoView(props: DojahKycSdkReactExpoViewProps): React.JSX.Element;
4
+ //# sourceMappingURL=DojahKycSdkReactExpoView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoView.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAK7E,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,qBAEpF"}
@@ -0,0 +1,7 @@
1
+ import { requireNativeView } from 'expo';
2
+ import * as React from 'react';
3
+ const NativeView = requireNativeView('DojahKycSdkReactExpo');
4
+ export default function DojahKycSdkReactExpoView(props) {
5
+ return <NativeView {...props}/>;
6
+ }
7
+ //# sourceMappingURL=DojahKycSdkReactExpoView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoView.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,UAAU,GACd,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AAE5C,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAoC;IACnF,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\n\nimport { DojahKycSdkReactExpoViewProps } from './DojahKycSdkReactExpo.types';\n\nconst NativeView: React.ComponentType<DojahKycSdkReactExpoViewProps> =\n requireNativeView('DojahKycSdkReactExpo');\n\nexport default function DojahKycSdkReactExpoView(props: DojahKycSdkReactExpoViewProps) {\n return <NativeView {...props} />;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { DojahKycSdkReactExpoViewProps } from './DojahKycSdkReactExpo.types';
3
+ export default function DojahKycSdkReactExpoView(props: DojahKycSdkReactExpoViewProps): React.JSX.Element;
4
+ //# sourceMappingURL=DojahKycSdkReactExpoView.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoView.web.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAE7E,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,qBAUpF"}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ export default function DojahKycSdkReactExpoView(props) {
3
+ return (<div>
4
+ <iframe style={{ flex: 1 }} src={props.url} onLoad={() => props.onLoad({ nativeEvent: { url: props.url } })}/>
5
+ </div>);
6
+ }
7
+ //# sourceMappingURL=DojahKycSdkReactExpoView.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DojahKycSdkReactExpoView.web.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,KAAoC;IACnF,OAAO,CACL,CAAC,GAAG,CACF;MAAA,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACnB,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CACf,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAEpE;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { DojahKycSdkReactExpoViewProps } from './DojahKycSdkReactExpo.types';\n\nexport default function DojahKycSdkReactExpoView(props: DojahKycSdkReactExpoViewProps) {\n return (\n <div>\n <iframe\n style={{ flex: 1 }}\n src={props.url}\n onLoad={() => props.onLoad({ nativeEvent: { url: props.url } })}\n />\n </div>\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from './DojahKycSdkReactExpoModule';
2
+ export * from './DojahKycSdkReactExpo.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,cAAe,8BAA8B,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,5 @@
1
+ // Reexport the native module. On web, it will be resolved to DojahKycSdkReactExpoModule.web.ts
2
+ // and on native platforms to DojahKycSdkReactExpoModule.ts
3
+ export { default } from './DojahKycSdkReactExpoModule';
4
+ export * from './DojahKycSdkReactExpo.types';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,2DAA2D;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,cAAe,8BAA8B,CAAC","sourcesContent":["// Reexport the native module. On web, it will be resolved to DojahKycSdkReactExpoModule.web.ts\n// and on native platforms to DojahKycSdkReactExpoModule.ts\nexport { default } from './DojahKycSdkReactExpoModule';\nexport * from './DojahKycSdkReactExpo.types';\n"]}
@@ -0,0 +1,9 @@
1
+ {
2
+ "platforms": ["apple", "android", "web"],
3
+ "apple": {
4
+ "modules": ["DojahKycSdkReactExpoModule"]
5
+ },
6
+ "android": {
7
+ "modules": ["com.dojah.dojah_Kyc_rn_expo.DojahKycSdkReactExpoModule"]
8
+ }
9
+ }
@@ -0,0 +1,29 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'DojahKycSdkReactExpo'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.description = package['description']
10
+ s.license = package['license']
11
+ s.author = package['author']
12
+ s.homepage = package['homepage']
13
+ s.platforms = {
14
+ :ios => '15.1',
15
+ :tvos => '15.1'
16
+ }
17
+ s.swift_version = '5.4'
18
+ s.source = { git: 'https://github.com/dojah-inc/dojah_kyc_sdk_rn_expo' }
19
+ s.static_framework = true
20
+
21
+ s.dependency 'ExpoModulesCore'
22
+
23
+ # Swift/Objective-C compatibility
24
+ s.pod_target_xcconfig = {
25
+ 'DEFINES_MODULE' => 'YES',
26
+ }
27
+
28
+ s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
29
+ end
@@ -0,0 +1,38 @@
1
+ import ExpoModulesCore
2
+
3
+ public class DojahKycSdkReactExpoModule: Module {
4
+ // Each module class must implement the definition function. The definition consists of components
5
+ // that describes the module's functionality and behavior.
6
+ // See https://docs.expo.dev/modules/module-api for more details about available components.
7
+ public func definition() -> ModuleDefinition {
8
+ // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
9
+ // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
10
+ // The module will be accessible from `requireNativeModule('DojahKycSdk')` in JavaScript.
11
+ Name("DojahKycSdk")
12
+
13
+ // Defines event names that the module can send to JavaScript.
14
+ Events("onChange")
15
+
16
+ // Defines a JavaScript function that always returns a Promise and whose native code
17
+ // is by default dispatched on the different thread than the JavaScript runtime runs on.
18
+ AsyncFunction("launch") { (widgetId: String, referenceId: String?, email: String?, extraData: Record<String, Any>?) in
19
+ // Send an event to JavaScript.
20
+ self.sendEvent("onChange", [
21
+ "value": value
22
+ ])
23
+ }
24
+
25
+ // Enables the module to be used as a native view. Definition components that are accepted as part of the
26
+ // view definition: Prop, Events.
27
+ View(DojahKycSdkReactExpoView.self) {
28
+ // Defines a setter for the `url` prop.
29
+ Prop("url") { (view: DojahKycSdkReactExpoView, url: URL) in
30
+ if view.webView.url != url {
31
+ view.webView.load(URLRequest(url: url))
32
+ }
33
+ }
34
+
35
+ Events("onLoad")
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,38 @@
1
+ import ExpoModulesCore
2
+ import WebKit
3
+
4
+ // This view will be used as a native component. Make sure to inherit from `ExpoView`
5
+ // to apply the proper styling (e.g. border radius and shadows).
6
+ class DojahKycSdkReactExpoView: ExpoView {
7
+ let webView = WKWebView()
8
+ let onLoad = EventDispatcher()
9
+ var delegate: WebViewDelegate?
10
+
11
+ required init(appContext: AppContext? = nil) {
12
+ super.init(appContext: appContext)
13
+ clipsToBounds = true
14
+ delegate = WebViewDelegate { url in
15
+ self.onLoad(["url": url])
16
+ }
17
+ webView.navigationDelegate = delegate
18
+ addSubview(webView)
19
+ }
20
+
21
+ override func layoutSubviews() {
22
+ webView.frame = bounds
23
+ }
24
+ }
25
+
26
+ class WebViewDelegate: NSObject, WKNavigationDelegate {
27
+ let onUrlChange: (String) -> Void
28
+
29
+ init(onUrlChange: @escaping (String) -> Void) {
30
+ self.onUrlChange = onUrlChange
31
+ }
32
+
33
+ func webView(_ webView: WKWebView, didFinish navigation: WKNavigation) {
34
+ if let url = webView.url {
35
+ onUrlChange(url.absoluteString)
36
+ }
37
+ }
38
+ }
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "dojah-kyc-sdk-react-expo",
3
+ "version": "0.1.0",
4
+ "description": "Dojah Kyc",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "expo": {
8
+ "plugins": [
9
+ "./app.plugin.js"
10
+ ]
11
+ },
12
+ "scripts": {
13
+ "build": "expo-module build",
14
+ "clean": "expo-module clean",
15
+ "lint": "expo-module lint",
16
+ "test": "expo-module test",
17
+ "prepare": "expo-module prepare",
18
+ "prepublishOnly": "expo-module prepublishOnly",
19
+ "expo-module": "expo-module",
20
+ "open:ios": "xed example/ios",
21
+ "open:android": "open -a \"Android Studio\" example/android"
22
+ },
23
+ "keywords": [
24
+ "react-native",
25
+ "expo",
26
+ "dojah-kyc-sdk-react-expo",
27
+ "DojahKycSdkReactExpo"
28
+ ],
29
+ "repository": "https://github.com/dojah-inc/dojah_kyc_sdk_rn_expo",
30
+ "bugs": {
31
+ "url": "https://github.com/dojah-inc/dojah_kyc_sdk_rn_expo/issues"
32
+ },
33
+ "author": "dojah-inc < dojah-inc@dojah.io> (https://github.com/dojah-inc)",
34
+ "license": "MIT",
35
+ "homepage": "https://github.com/dojah-inc/dojah_kyc_sdk_rn_expo#readme",
36
+ "dependencies": {},
37
+ "devDependencies": {
38
+ "@types/react": "~19.0.0",
39
+ "expo-module-scripts": "^4.1.6",
40
+ "expo": "~53.0.0",
41
+ "react-native": "0.79.1"
42
+ },
43
+ "peerDependencies": {
44
+ "expo": "*",
45
+ "react": "*",
46
+ "react-native": "*"
47
+ }
48
+ }
@@ -0,0 +1,67 @@
1
+ const {
2
+ withPlugins,
3
+ withAppBuildGradle,
4
+ withSettingsGradle,
5
+ withGradleProperties,
6
+ } = require('@expo/config-plugins');
7
+ const path = require('path');
8
+
9
+ const withDojahKyc = config => {
10
+ return withPlugins(config, [
11
+ // withAppBuildGradleModification,
12
+ // withSettingsGradleModification,
13
+ // withGradlePropertiesModification,
14
+ ]);
15
+ };
16
+
17
+ function withAppBuildGradleModification(config) {
18
+ return withAppBuildGradle(config, config => {
19
+ if (!config.modResults.contents.includes("project(':dojah_Kyc_rn_expo')")) {
20
+ config.modResults.contents += `
21
+ dependencies {
22
+ implementation project(':dojah_Kyc_rn_expo')
23
+ }
24
+ `;
25
+ }
26
+ return config;
27
+ });
28
+ }
29
+
30
+ function withSettingsGradleModification(config) {
31
+ return withSettingsGradle(config, config => {
32
+ if (!config.modResults.contents.includes("include ':dojah_Kyc_rn_expo'")) {
33
+ config.modResults.contents += `
34
+ include ':dojah_Kyc_rn_expo'
35
+ project(':dojah_Kyc_rn_expo').projectDir = new File(rootProject.projectDir, '../node_modules/dojah-kyc-sdk-react-expo/android')
36
+ `;
37
+ }
38
+ return config;
39
+ });
40
+ }
41
+
42
+ function withGradlePropertiesModification(config) {
43
+ return withGradleProperties(config, (config) => {
44
+ if (!config.modResults) {
45
+ config.modResults = [];
46
+ }
47
+
48
+ // Add new entries
49
+ config.modResults.push(
50
+ [{
51
+ key: 'org.gradle.jvmargs',
52
+ value:
53
+ '-Xmx4096m -XX:MaxMetaspaceSize=512m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8',
54
+ },
55
+ {
56
+ key: 'android.enableJetifier',
57
+ value: 'true',
58
+ }]
59
+ );
60
+
61
+ return config;
62
+ });
63
+ }
64
+
65
+
66
+
67
+ module.exports = withDojahKyc;
@@ -0,0 +1,19 @@
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
+
3
+ export type OnLoadEventPayload = {
4
+ url: string;
5
+ };
6
+
7
+ export type DojahKycSdkReactExpoModuleEvents = {
8
+ onChange: (params: ChangeEventPayload) => void;
9
+ };
10
+
11
+ export type ChangeEventPayload = {
12
+ value: string;
13
+ };
14
+
15
+ export type DojahKycSdkReactExpoViewProps = {
16
+ url: string;
17
+ onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;
18
+ style?: StyleProp<ViewStyle>;
19
+ };
@@ -0,0 +1,13 @@
1
+ import { NativeModule, requireNativeModule } from 'expo';
2
+
3
+ import { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';
4
+
5
+ declare class DojahKycSdk extends NativeModule<DojahKycSdkReactExpoModuleEvents> {
6
+ launch(widgetId: string, referenceId?: string | null,
7
+ email?: string | null,
8
+ extraData?: Record<string, any> | null
9
+ ): Promise<string>;
10
+ }
11
+
12
+ // This call loads the native module object from the JSI.
13
+ export default requireNativeModule<DojahKycSdk>('DojahKycSdk');
@@ -0,0 +1,11 @@
1
+ import { registerWebModule, NativeModule } from 'expo';
2
+
3
+ import { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';
4
+
5
+ class DojahKycSdkReactExpoModule extends NativeModule<DojahKycSdkReactExpoModuleEvents> {
6
+ async launch(value: string): Promise<void> {
7
+ this.emit('onChange', { value });
8
+ }
9
+ }
10
+
11
+ export default registerWebModule(DojahKycSdkReactExpoModule, 'DojahKycSdk');
@@ -0,0 +1,11 @@
1
+ import { requireNativeView } from 'expo';
2
+ import * as React from 'react';
3
+
4
+ import { DojahKycSdkReactExpoViewProps } from './DojahKycSdkReactExpo.types';
5
+
6
+ const NativeView: React.ComponentType<DojahKycSdkReactExpoViewProps> =
7
+ requireNativeView('DojahKycSdkReactExpo');
8
+
9
+ export default function DojahKycSdkReactExpoView(props: DojahKycSdkReactExpoViewProps) {
10
+ return <NativeView {...props} />;
11
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ import { DojahKycSdkReactExpoViewProps } from './DojahKycSdkReactExpo.types';
4
+
5
+ export default function DojahKycSdkReactExpoView(props: DojahKycSdkReactExpoViewProps) {
6
+ return (
7
+ <div>
8
+ <iframe
9
+ style={{ flex: 1 }}
10
+ src={props.url}
11
+ onLoad={() => props.onLoad({ nativeEvent: { url: props.url } })}
12
+ />
13
+ </div>
14
+ );
15
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Reexport the native module. On web, it will be resolved to DojahKycSdkReactExpoModule.web.ts
2
+ // and on native platforms to DojahKycSdkReactExpoModule.ts
3
+ export { default } from './DojahKycSdkReactExpoModule';
4
+ export * from './DojahKycSdkReactExpo.types';
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ // @generated by expo-module-scripts
2
+ {
3
+ "extends": "expo-module-scripts/tsconfig.base",
4
+ "compilerOptions": {
5
+ "outDir": "./build"
6
+ },
7
+ "include": ["./src"],
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__rsc_tests__/*"]
9
+ }