@oscilar/react-native-oscilar-module 0.1.4
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 -0
- package/OscilarModule.podspec +43 -0
- package/README.md +36 -0
- package/android/Osclib-release-protected.aar +0 -0
- package/android/build.gradle +93 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/oscilarmodule/OscilarModuleModule.kt +46 -0
- package/android/src/main/java/com/oscilarmodule/OscilarModulePackage.kt +17 -0
- package/ios/OscilarModule-Bridging-Header.h +2 -0
- package/ios/OscilarModule.mm +39 -0
- package/ios/OscilarModule.swift +143 -0
- package/lib/commonjs/index.js +48 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +38 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +189 -0
- package/src/index.tsx +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright
|
|
@@ -0,0 +1,43 @@
|
|
|
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 = "OscilarModule"
|
|
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 => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/Oscilar/react-native-oscilar-module.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
|
|
19
|
+
s.dependency "OscilarSDK"
|
|
20
|
+
|
|
21
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
23
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
24
|
+
install_modules_dependencies(s)
|
|
25
|
+
else
|
|
26
|
+
s.dependency "React-Core"
|
|
27
|
+
|
|
28
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
29
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
30
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
31
|
+
s.pod_target_xcconfig = {
|
|
32
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
33
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
34
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
35
|
+
}
|
|
36
|
+
s.dependency "React-Codegen"
|
|
37
|
+
s.dependency "RCT-Folly"
|
|
38
|
+
s.dependency "RCTRequired"
|
|
39
|
+
s.dependency "RCTTypeSafety"
|
|
40
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# react-native-oscilar-module
|
|
2
|
+
|
|
3
|
+
Oscilar module for React Native
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install react-native-oscilar-module
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { initOscilar, generateTransactionID } from 'react-native-oscilar-module';
|
|
16
|
+
|
|
17
|
+
// App initialization
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
(async () => {
|
|
21
|
+
await initOscilar(clientKey);
|
|
22
|
+
})();
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
// Generating Transaction ID
|
|
26
|
+
|
|
27
|
+
const transactionID = await generateTransactionID();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
Copyright
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['OscilarModule_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def isNewArchitectureEnabled() {
|
|
20
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apply plugin: "com.android.library"
|
|
24
|
+
apply plugin: "kotlin-android"
|
|
25
|
+
|
|
26
|
+
if (isNewArchitectureEnabled()) {
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def getExtOrIntegerDefault(name) {
|
|
31
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OscilarModule_" + name]).toInteger()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
def supportsNamespace() {
|
|
35
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
36
|
+
def major = parsed[0].toInteger()
|
|
37
|
+
def minor = parsed[1].toInteger()
|
|
38
|
+
|
|
39
|
+
// Namespace support was added in 7.3.0
|
|
40
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
android {
|
|
44
|
+
if (supportsNamespace()) {
|
|
45
|
+
namespace "com.oscilarmodule"
|
|
46
|
+
|
|
47
|
+
sourceSets {
|
|
48
|
+
main {
|
|
49
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
55
|
+
|
|
56
|
+
defaultConfig {
|
|
57
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
58
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
buildTypes {
|
|
62
|
+
release {
|
|
63
|
+
minifyEnabled false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
lintOptions {
|
|
68
|
+
disable "GradleCompatible"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
compileOptions {
|
|
72
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
73
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
repositories {
|
|
78
|
+
mavenCentral()
|
|
79
|
+
google()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
83
|
+
|
|
84
|
+
dependencies {
|
|
85
|
+
implementation "com.facebook.react:react-android"
|
|
86
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
87
|
+
debugImplementation(files("./Osclib-release-protected.aar"))
|
|
88
|
+
implementation "com.google.code.gson:gson:2.10.1"
|
|
89
|
+
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
|
90
|
+
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
|
91
|
+
implementation "androidx.work:work-runtime:2.9.0"
|
|
92
|
+
}
|
|
93
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
package com.oscilarmodule
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
|
+
import com.facebook.react.bridge.ReactMethod
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import android.util.Log
|
|
8
|
+
import com.osc.and.OscApi
|
|
9
|
+
import com.osc.and.OscApiInterface
|
|
10
|
+
|
|
11
|
+
class OscilarModuleModule(reactContext: ReactApplicationContext) :
|
|
12
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
13
|
+
|
|
14
|
+
override fun getName(): String {
|
|
15
|
+
return NAME
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private lateinit var oscApiInt: OscApiInterface
|
|
19
|
+
|
|
20
|
+
@ReactMethod
|
|
21
|
+
fun initOscilar(clientKey: String, promise: Promise) {
|
|
22
|
+
try {
|
|
23
|
+
val application = reactApplicationContext.applicationContext as android.app.Application
|
|
24
|
+
oscApiInt = OscApi.getInstance(application, clientKey)
|
|
25
|
+
promise.resolve(null)
|
|
26
|
+
} catch (e: Exception) {
|
|
27
|
+
promise.reject("INIT_ERROR", e)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// New method to get transaction ID
|
|
32
|
+
@ReactMethod
|
|
33
|
+
fun generateTransactionID(promise: Promise) {
|
|
34
|
+
try {
|
|
35
|
+
val transactionId = oscApiInt.getTransactionId(reactApplicationContext)
|
|
36
|
+
Log.d("OscilarModule", "Transaction ID: $transactionId")
|
|
37
|
+
promise.resolve(transactionId)
|
|
38
|
+
} catch (e: Exception) {
|
|
39
|
+
promise.reject("ERROR_GETTING_TRANSACTION_ID", e)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
companion object {
|
|
44
|
+
const val NAME = "OscilarModule"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.oscilarmodule
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class OscilarModulePackage : ReactPackage {
|
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
+
return listOf(OscilarModuleModule(reactContext))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
+
return emptyList()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface RCT_EXTERN_MODULE(OscilarModule, NSObject)
|
|
4
|
+
|
|
5
|
+
RCT_EXTERN_METHOD(startWithClientKey:(NSString*)clientKey
|
|
6
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
7
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
8
|
+
|
|
9
|
+
RCT_EXTERN_METHOD(startWithClientKeyAndServerURL:(NSString*)clientKey
|
|
10
|
+
serverURL:(NSString*)serverURL
|
|
11
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
12
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
13
|
+
|
|
14
|
+
RCT_EXTERN_METHOD(generateTransactionID:(RCTPromiseResolveBlock)resolve
|
|
15
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
16
|
+
|
|
17
|
+
RCT_EXTERN_METHOD(generateTransactionIDWithFlowType:(NSString*)flowType
|
|
18
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
19
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
20
|
+
|
|
21
|
+
RCT_EXTERN_METHOD(generateTransactionIDWithUserInfo:(NSString*)usernameHash
|
|
22
|
+
userEmailHash:(NSString*)userEmailHash
|
|
23
|
+
custom:(NSDictionary*)custom
|
|
24
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
25
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
26
|
+
|
|
27
|
+
RCT_EXTERN_METHOD(generateTransactionIDWithFlowTypeAndUserInfo:(NSString*)flowType
|
|
28
|
+
usernameHash:(NSString*)usernameHash
|
|
29
|
+
userEmailHash:(NSString*)userEmailHash
|
|
30
|
+
custom:(NSDictionary*)custom
|
|
31
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
32
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
33
|
+
|
|
34
|
+
+ (BOOL)requiresMainQueueSetup
|
|
35
|
+
{
|
|
36
|
+
return NO;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@end
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import OscilarSDK
|
|
2
|
+
|
|
3
|
+
@objc(OscilarModule)
|
|
4
|
+
class OscilarModule: NSObject {
|
|
5
|
+
|
|
6
|
+
@objc(startWithClientKey:withResolver:withRejecter:)
|
|
7
|
+
func start(
|
|
8
|
+
clientKey: String,
|
|
9
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
10
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
11
|
+
) -> Void {
|
|
12
|
+
Task {
|
|
13
|
+
do {
|
|
14
|
+
try await Oscilar.shared.start(clientKey: clientKey)
|
|
15
|
+
resolve(nil)
|
|
16
|
+
} catch {
|
|
17
|
+
reject(nil, nil, error)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc(startWithClientKeyAndServerURL:serverURL:withResolver:withRejecter:)
|
|
23
|
+
func start(
|
|
24
|
+
clientKey: String,
|
|
25
|
+
serverURL: String,
|
|
26
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
27
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
28
|
+
) -> Void {
|
|
29
|
+
Task {
|
|
30
|
+
do {
|
|
31
|
+
try await Oscilar.shared.start(
|
|
32
|
+
clientKey: clientKey,
|
|
33
|
+
serverURL: URL(string: serverURL)
|
|
34
|
+
)
|
|
35
|
+
resolve(nil)
|
|
36
|
+
} catch {
|
|
37
|
+
reject(nil, nil, error)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@objc(generateTransactionID:withRejecter:)
|
|
43
|
+
func generateTransactionID(
|
|
44
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
45
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
46
|
+
) -> Void {
|
|
47
|
+
Task {
|
|
48
|
+
do {
|
|
49
|
+
let transactionID = try await Oscilar.shared.generateTransactionID()
|
|
50
|
+
resolve(transactionID)
|
|
51
|
+
} catch {
|
|
52
|
+
reject(nil, nil, error)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@objc(generateTransactionIDWithFlowType:withResolver:withRejecter:)
|
|
58
|
+
func generateTransactionIDWithFlowType(
|
|
59
|
+
flowType: String,
|
|
60
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
61
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
62
|
+
) -> Void {
|
|
63
|
+
Task {
|
|
64
|
+
do {
|
|
65
|
+
let _flowType = switch flowType {
|
|
66
|
+
case "login":
|
|
67
|
+
FlowType.login
|
|
68
|
+
case "p2pTransfer":
|
|
69
|
+
FlowType.p2pTransfer
|
|
70
|
+
case "checkout":
|
|
71
|
+
FlowType.checkout
|
|
72
|
+
default:
|
|
73
|
+
FlowType.custom(flowType)
|
|
74
|
+
}
|
|
75
|
+
let transactionID = try await Oscilar.shared.generateTransactionID(flowType: _flowType)
|
|
76
|
+
resolve(transactionID)
|
|
77
|
+
} catch {
|
|
78
|
+
reject(nil, nil, error)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@objc(generateTransactionIDWithUserInfo:userEmailHash:custom:withResolver:withRejecter:)
|
|
84
|
+
func generateTransactionIDWithFlowType(
|
|
85
|
+
usernameHash: String,
|
|
86
|
+
userEmailHash: String,
|
|
87
|
+
custom: [String: String],
|
|
88
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
89
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
90
|
+
) -> Void {
|
|
91
|
+
Task {
|
|
92
|
+
do {
|
|
93
|
+
let _userInfo = UserInfo(
|
|
94
|
+
usernameHash: usernameHash,
|
|
95
|
+
userEmailHash: userEmailHash,
|
|
96
|
+
custom: custom
|
|
97
|
+
)
|
|
98
|
+
let transactionID = try await Oscilar.shared.generateTransactionID(userInfo: _userInfo)
|
|
99
|
+
resolve(transactionID)
|
|
100
|
+
} catch {
|
|
101
|
+
reject(nil, nil, error)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@objc(generateTransactionIDWithFlowTypeAndUserInfo:usernameHash:userEmailHash:custom:withResolver:withRejecter:)
|
|
107
|
+
func generateTransactionIDWithFlowType(
|
|
108
|
+
flowType: String,
|
|
109
|
+
usernameHash: String,
|
|
110
|
+
userEmailHash: String,
|
|
111
|
+
custom: [String: String],
|
|
112
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
113
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
114
|
+
) -> Void {
|
|
115
|
+
Task {
|
|
116
|
+
do {
|
|
117
|
+
let _flowType = switch flowType {
|
|
118
|
+
case "login":
|
|
119
|
+
FlowType.login
|
|
120
|
+
case "p2pTransfer":
|
|
121
|
+
FlowType.p2pTransfer
|
|
122
|
+
case "checkout":
|
|
123
|
+
FlowType.checkout
|
|
124
|
+
default:
|
|
125
|
+
FlowType.custom(flowType)
|
|
126
|
+
}
|
|
127
|
+
let _userInfo = UserInfo(
|
|
128
|
+
usernameHash: usernameHash,
|
|
129
|
+
userEmailHash: userEmailHash,
|
|
130
|
+
custom: custom
|
|
131
|
+
)
|
|
132
|
+
let transactionID = try await Oscilar.shared.generateTransactionID(
|
|
133
|
+
flowType: _flowType,
|
|
134
|
+
userInfo: _userInfo
|
|
135
|
+
)
|
|
136
|
+
resolve(transactionID)
|
|
137
|
+
} catch {
|
|
138
|
+
reject(nil, nil, error)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateTransactionID = generateTransactionID;
|
|
7
|
+
exports.generateTransactionIDWithFlowType = generateTransactionIDWithFlowType;
|
|
8
|
+
exports.generateTransactionIDWithFlowTypeAndUserInfo = generateTransactionIDWithFlowTypeAndUserInfo;
|
|
9
|
+
exports.generateTransactionIDWithUserInfo = generateTransactionIDWithUserInfo;
|
|
10
|
+
exports.initOscilar = initOscilar;
|
|
11
|
+
exports.startWithClientKey = startWithClientKey;
|
|
12
|
+
exports.startWithClientKeyAndServerURL = startWithClientKeyAndServerURL;
|
|
13
|
+
var _reactNative = require("react-native");
|
|
14
|
+
const LINKING_ERROR = `The package 'react-native-oscilar-module' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
15
|
+
ios: "- You have run 'pod install'\n",
|
|
16
|
+
default: ''
|
|
17
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
18
|
+
const OscilarModule = _reactNative.NativeModules.OscilarModule ? _reactNative.NativeModules.OscilarModule : new Proxy({}, {
|
|
19
|
+
get() {
|
|
20
|
+
throw new Error(LINKING_ERROR);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function initOscilar(clientKey) {
|
|
24
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
25
|
+
return OscilarModule.initOscilar(clientKey);
|
|
26
|
+
} else {
|
|
27
|
+
return OscilarModule.startWithClientKey(clientKey);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function startWithClientKey(clientKey) {
|
|
31
|
+
return OscilarModule.startWithClientKey(clientKey);
|
|
32
|
+
}
|
|
33
|
+
function startWithClientKeyAndServerURL(clientKey, serverURL) {
|
|
34
|
+
return OscilarModule.startWithClientKeyAndServerURL(clientKey, serverURL);
|
|
35
|
+
}
|
|
36
|
+
function generateTransactionID() {
|
|
37
|
+
return OscilarModule.generateTransactionID();
|
|
38
|
+
}
|
|
39
|
+
function generateTransactionIDWithFlowType(flowType) {
|
|
40
|
+
return OscilarModule.generateTransactionIDWithFlowType(flowType);
|
|
41
|
+
}
|
|
42
|
+
function generateTransactionIDWithUserInfo(usernameHash, userEmailHash, custom) {
|
|
43
|
+
return OscilarModule.generateTransactionIDWithUserInfo(usernameHash, userEmailHash, custom);
|
|
44
|
+
}
|
|
45
|
+
function generateTransactionIDWithFlowTypeAndUserInfo(flowType, usernameHash, userEmailHash, custom) {
|
|
46
|
+
return OscilarModule.generateTransactionIDWithFlowTypeAndUserInfo(flowType, usernameHash, userEmailHash, custom);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","OscilarModule","NativeModules","Proxy","get","Error","initOscilar","clientKey","OS","startWithClientKey","startWithClientKeyAndServerURL","serverURL","generateTransactionID","generateTransactionIDWithFlowType","flowType","generateTransactionIDWithUserInfo","usernameHash","userEmailHash","custom","generateTransactionIDWithFlowTypeAndUserInfo"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,aAAa,GAAGC,0BAAa,CAACD,aAAa,GAC7CC,0BAAa,CAACD,aAAa,GAC3B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,SAASU,WAAWA,CAACC,SAAiB,EAAiB;EAC5D,IAAIV,qBAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAOP,aAAa,CAACK,WAAW,CAACC,SAAS,CAAC;EAC7C,CAAC,MAAM;IACL,OAAON,aAAa,CAACQ,kBAAkB,CAACF,SAAS,CAAC;EACpD;AACF;AAEO,SAASE,kBAAkBA,CAACF,SAAiB,EAAiB;EACnE,OAAON,aAAa,CAACQ,kBAAkB,CAACF,SAAS,CAAC;AACpD;AAEO,SAASG,8BAA8BA,CAC5CH,SAAiB,EACjBI,SAAiB,EACF;EACf,OAAOV,aAAa,CAACS,8BAA8B,CAACH,SAAS,EAAEI,SAAS,CAAC;AAC3E;AAEO,SAASC,qBAAqBA,CAAA,EAAoB;EACvD,OAAOX,aAAa,CAACW,qBAAqB,CAAC,CAAC;AAC9C;AAEO,SAASC,iCAAiCA,CAC/CC,QAAgB,EACC;EACjB,OAAOb,aAAa,CAACY,iCAAiC,CAACC,QAAQ,CAAC;AAClE;AAEO,SAASC,iCAAiCA,CAC/CC,YAAoB,EACpBC,aAAqB,EACrBC,MAAc,EACG;EACjB,OAAOjB,aAAa,CAACc,iCAAiC,CACpDC,YAAY,EACZC,aAAa,EACbC,MACF,CAAC;AACH;AAEO,SAASC,4CAA4CA,CAC1DL,QAAgB,EAChBE,YAAoB,EACpBC,aAAqB,EACrBC,MAAc,EACG;EACjB,OAAOjB,aAAa,CAACkB,4CAA4C,CAC/DL,QAAQ,EACRE,YAAY,EACZC,aAAa,EACbC,MACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-oscilar-module' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
const OscilarModule = NativeModules.OscilarModule ? NativeModules.OscilarModule : new Proxy({}, {
|
|
9
|
+
get() {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export function initOscilar(clientKey) {
|
|
14
|
+
if (Platform.OS === 'android') {
|
|
15
|
+
return OscilarModule.initOscilar(clientKey);
|
|
16
|
+
} else {
|
|
17
|
+
return OscilarModule.startWithClientKey(clientKey);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function startWithClientKey(clientKey) {
|
|
21
|
+
return OscilarModule.startWithClientKey(clientKey);
|
|
22
|
+
}
|
|
23
|
+
export function startWithClientKeyAndServerURL(clientKey, serverURL) {
|
|
24
|
+
return OscilarModule.startWithClientKeyAndServerURL(clientKey, serverURL);
|
|
25
|
+
}
|
|
26
|
+
export function generateTransactionID() {
|
|
27
|
+
return OscilarModule.generateTransactionID();
|
|
28
|
+
}
|
|
29
|
+
export function generateTransactionIDWithFlowType(flowType) {
|
|
30
|
+
return OscilarModule.generateTransactionIDWithFlowType(flowType);
|
|
31
|
+
}
|
|
32
|
+
export function generateTransactionIDWithUserInfo(usernameHash, userEmailHash, custom) {
|
|
33
|
+
return OscilarModule.generateTransactionIDWithUserInfo(usernameHash, userEmailHash, custom);
|
|
34
|
+
}
|
|
35
|
+
export function generateTransactionIDWithFlowTypeAndUserInfo(flowType, usernameHash, userEmailHash, custom) {
|
|
36
|
+
return OscilarModule.generateTransactionIDWithFlowTypeAndUserInfo(flowType, usernameHash, userEmailHash, custom);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","OscilarModule","Proxy","get","Error","initOscilar","clientKey","OS","startWithClientKey","startWithClientKeyAndServerURL","serverURL","generateTransactionID","generateTransactionIDWithFlowType","flowType","generateTransactionIDWithUserInfo","usernameHash","userEmailHash","custom","generateTransactionIDWithFlowTypeAndUserInfo"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,sFAAsF,GACtFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,aAAa,GAAGN,aAAa,CAACM,aAAa,GAC7CN,aAAa,CAACM,aAAa,GAC3B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,SAASQ,WAAWA,CAACC,SAAiB,EAAiB;EAC5D,IAAIV,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAON,aAAa,CAACI,WAAW,CAACC,SAAS,CAAC;EAC7C,CAAC,MAAM;IACL,OAAOL,aAAa,CAACO,kBAAkB,CAACF,SAAS,CAAC;EACpD;AACF;AAEA,OAAO,SAASE,kBAAkBA,CAACF,SAAiB,EAAiB;EACnE,OAAOL,aAAa,CAACO,kBAAkB,CAACF,SAAS,CAAC;AACpD;AAEA,OAAO,SAASG,8BAA8BA,CAC5CH,SAAiB,EACjBI,SAAiB,EACF;EACf,OAAOT,aAAa,CAACQ,8BAA8B,CAACH,SAAS,EAAEI,SAAS,CAAC;AAC3E;AAEA,OAAO,SAASC,qBAAqBA,CAAA,EAAoB;EACvD,OAAOV,aAAa,CAACU,qBAAqB,CAAC,CAAC;AAC9C;AAEA,OAAO,SAASC,iCAAiCA,CAC/CC,QAAgB,EACC;EACjB,OAAOZ,aAAa,CAACW,iCAAiC,CAACC,QAAQ,CAAC;AAClE;AAEA,OAAO,SAASC,iCAAiCA,CAC/CC,YAAoB,EACpBC,aAAqB,EACrBC,MAAc,EACG;EACjB,OAAOhB,aAAa,CAACa,iCAAiC,CACpDC,YAAY,EACZC,aAAa,EACbC,MACF,CAAC;AACH;AAEA,OAAO,SAASC,4CAA4CA,CAC1DL,QAAgB,EAChBE,YAAoB,EACpBC,aAAqB,EACrBC,MAAc,EACG;EACjB,OAAOhB,aAAa,CAACiB,4CAA4C,CAC/DL,QAAQ,EACRE,YAAY,EACZC,aAAa,EACbC,MACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function initOscilar(clientKey: string): Promise<void>;
|
|
2
|
+
export declare function startWithClientKey(clientKey: string): Promise<void>;
|
|
3
|
+
export declare function startWithClientKeyAndServerURL(clientKey: string, serverURL: string): Promise<void>;
|
|
4
|
+
export declare function generateTransactionID(): Promise<string>;
|
|
5
|
+
export declare function generateTransactionIDWithFlowType(flowType: string): Promise<string>;
|
|
6
|
+
export declare function generateTransactionIDWithUserInfo(usernameHash: string, userEmailHash: string, custom: object): Promise<string>;
|
|
7
|
+
export declare function generateTransactionIDWithFlowTypeAndUserInfo(flowType: string, usernameHash: string, userEmailHash: string, custom: object): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEvD;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAgB,4CAA4C,CAC1D,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function initOscilar(clientKey: string): Promise<void>;
|
|
2
|
+
export declare function startWithClientKey(clientKey: string): Promise<void>;
|
|
3
|
+
export declare function startWithClientKeyAndServerURL(clientKey: string, serverURL: string): Promise<void>;
|
|
4
|
+
export declare function generateTransactionID(): Promise<string>;
|
|
5
|
+
export declare function generateTransactionIDWithFlowType(flowType: string): Promise<string>;
|
|
6
|
+
export declare function generateTransactionIDWithUserInfo(usernameHash: string, userEmailHash: string, custom: object): Promise<string>;
|
|
7
|
+
export declare function generateTransactionIDWithFlowTypeAndUserInfo(flowType: string, usernameHash: string, userEmailHash: string, custom: object): Promise<string>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5D;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAEvD;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAgB,4CAA4C,CAC1D,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oscilar/react-native-oscilar-module",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Oscilar module for React Native",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"react-native.config.js",
|
|
28
|
+
"!ios/build",
|
|
29
|
+
"!android/build",
|
|
30
|
+
"!android/gradle",
|
|
31
|
+
"!android/gradlew",
|
|
32
|
+
"!android/gradlew.bat",
|
|
33
|
+
"!android/local.properties",
|
|
34
|
+
"!**/__tests__",
|
|
35
|
+
"!**/__fixtures__",
|
|
36
|
+
"!**/__mocks__",
|
|
37
|
+
"!**/.*"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"example": "yarn workspace react-native-oscilar-module-example",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"typecheck": "tsc",
|
|
43
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
44
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
45
|
+
"prepare": "bob build",
|
|
46
|
+
"release": "release-it"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react-native",
|
|
50
|
+
"ios",
|
|
51
|
+
"android",
|
|
52
|
+
"oscilar"
|
|
53
|
+
],
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/Oscilar/react-native-oscilar-module.git"
|
|
57
|
+
},
|
|
58
|
+
"author": "Oscilar <mobile@oscilar.com> (https://oscilar.com)",
|
|
59
|
+
"license": "Copyright",
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/Oscilar/react-native-oscilar-module/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/Oscilar/react-native-oscilar-module#readme",
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"registry": "https://registry.npmjs.org/"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
69
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
70
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
71
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
72
|
+
"@types/jest": "^29.5.5",
|
|
73
|
+
"@types/react": "^18.2.44",
|
|
74
|
+
"commitlint": "^17.0.2",
|
|
75
|
+
"del-cli": "^5.1.0",
|
|
76
|
+
"eslint": "^8.51.0",
|
|
77
|
+
"eslint-config-prettier": "^9.0.0",
|
|
78
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"prettier": "^3.0.3",
|
|
81
|
+
"react": "19.0.0",
|
|
82
|
+
"react-native": "0.78.0",
|
|
83
|
+
"react-native-builder-bob": "^0.37.0",
|
|
84
|
+
"release-it": "^17.10.0",
|
|
85
|
+
"turbo": "^1.10.7",
|
|
86
|
+
"typescript": "^5.2.2"
|
|
87
|
+
},
|
|
88
|
+
"resolutions": {
|
|
89
|
+
"@types/react": "^18.2.44"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*"
|
|
94
|
+
},
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"example"
|
|
97
|
+
],
|
|
98
|
+
"packageManager": "yarn@3.6.1",
|
|
99
|
+
"jest": {
|
|
100
|
+
"preset": "react-native",
|
|
101
|
+
"modulePathIgnorePatterns": [
|
|
102
|
+
"<rootDir>/example/node_modules",
|
|
103
|
+
"<rootDir>/lib/"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"commitlint": {
|
|
107
|
+
"extends": [
|
|
108
|
+
"@commitlint/config-conventional"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"release-it": {
|
|
112
|
+
"git": {
|
|
113
|
+
"commitMessage": "chore: release ${version}",
|
|
114
|
+
"tagName": "v${version}"
|
|
115
|
+
},
|
|
116
|
+
"npm": {
|
|
117
|
+
"publish": true
|
|
118
|
+
},
|
|
119
|
+
"github": {
|
|
120
|
+
"release": true
|
|
121
|
+
},
|
|
122
|
+
"plugins": {
|
|
123
|
+
"@release-it/conventional-changelog": {
|
|
124
|
+
"preset": "angular"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"eslintConfig": {
|
|
129
|
+
"root": true,
|
|
130
|
+
"extends": [
|
|
131
|
+
"@react-native",
|
|
132
|
+
"prettier"
|
|
133
|
+
],
|
|
134
|
+
"rules": {
|
|
135
|
+
"react/react-in-jsx-scope": "off",
|
|
136
|
+
"prettier/prettier": [
|
|
137
|
+
"error",
|
|
138
|
+
{
|
|
139
|
+
"quoteProps": "consistent",
|
|
140
|
+
"singleQuote": true,
|
|
141
|
+
"tabWidth": 2,
|
|
142
|
+
"trailingComma": "es5",
|
|
143
|
+
"useTabs": false
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"eslintIgnore": [
|
|
149
|
+
"node_modules/",
|
|
150
|
+
"lib/"
|
|
151
|
+
],
|
|
152
|
+
"prettier": {
|
|
153
|
+
"quoteProps": "consistent",
|
|
154
|
+
"singleQuote": true,
|
|
155
|
+
"tabWidth": 2,
|
|
156
|
+
"trailingComma": "es5",
|
|
157
|
+
"useTabs": false
|
|
158
|
+
},
|
|
159
|
+
"react-native-builder-bob": {
|
|
160
|
+
"source": "src",
|
|
161
|
+
"output": "lib",
|
|
162
|
+
"targets": [
|
|
163
|
+
[
|
|
164
|
+
"commonjs",
|
|
165
|
+
{
|
|
166
|
+
"esm": true
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
"module",
|
|
171
|
+
{
|
|
172
|
+
"esm": true
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"typescript",
|
|
177
|
+
{
|
|
178
|
+
"project": "tsconfig.build.json",
|
|
179
|
+
"esm": true
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"create-react-native-library": {
|
|
185
|
+
"type": "legacy-module",
|
|
186
|
+
"languages": "kotlin-swift",
|
|
187
|
+
"version": "0.48.3"
|
|
188
|
+
}
|
|
189
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'react-native-oscilar-module' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const OscilarModule = NativeModules.OscilarModule
|
|
10
|
+
? NativeModules.OscilarModule
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export function initOscilar(clientKey: string): Promise<void> {
|
|
21
|
+
if (Platform.OS === 'android') {
|
|
22
|
+
return OscilarModule.initOscilar(clientKey);
|
|
23
|
+
} else {
|
|
24
|
+
return OscilarModule.startWithClientKey(clientKey);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function startWithClientKey(clientKey: string): Promise<void> {
|
|
29
|
+
return OscilarModule.startWithClientKey(clientKey);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function startWithClientKeyAndServerURL(
|
|
33
|
+
clientKey: string,
|
|
34
|
+
serverURL: string
|
|
35
|
+
): Promise<void> {
|
|
36
|
+
return OscilarModule.startWithClientKeyAndServerURL(clientKey, serverURL);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function generateTransactionID(): Promise<string> {
|
|
40
|
+
return OscilarModule.generateTransactionID();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function generateTransactionIDWithFlowType(
|
|
44
|
+
flowType: string
|
|
45
|
+
): Promise<string> {
|
|
46
|
+
return OscilarModule.generateTransactionIDWithFlowType(flowType);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function generateTransactionIDWithUserInfo(
|
|
50
|
+
usernameHash: string,
|
|
51
|
+
userEmailHash: string,
|
|
52
|
+
custom: object
|
|
53
|
+
): Promise<string> {
|
|
54
|
+
return OscilarModule.generateTransactionIDWithUserInfo(
|
|
55
|
+
usernameHash,
|
|
56
|
+
userEmailHash,
|
|
57
|
+
custom
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function generateTransactionIDWithFlowTypeAndUserInfo(
|
|
62
|
+
flowType: string,
|
|
63
|
+
usernameHash: string,
|
|
64
|
+
userEmailHash: string,
|
|
65
|
+
custom: object
|
|
66
|
+
): Promise<string> {
|
|
67
|
+
return OscilarModule.generateTransactionIDWithFlowTypeAndUserInfo(
|
|
68
|
+
flowType,
|
|
69
|
+
usernameHash,
|
|
70
|
+
userEmailHash,
|
|
71
|
+
custom
|
|
72
|
+
);
|
|
73
|
+
}
|