@tryvital/vital-core-react-native 0.3.0 → 0.3.1
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/lib/index.d.ts +5 -0
- package/lib/index.js +23 -0
- package/package.json +1 -1
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'vital-core-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
3
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
4
|
+
'- You rebuilt the app after installing the package\n' +
|
|
5
|
+
'- You are not using Expo Go\n';
|
|
6
|
+
const VitalCoreReactNative = NativeModules.VitalCoreReactNative
|
|
7
|
+
? NativeModules.VitalCoreReactNative
|
|
8
|
+
: new Proxy({}, {
|
|
9
|
+
get() {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export class VitalCore {
|
|
14
|
+
static setUserId(userId) {
|
|
15
|
+
return VitalCoreReactNative.setUserId(userId);
|
|
16
|
+
}
|
|
17
|
+
static configure(apiKey, environment, region, enableLogs) {
|
|
18
|
+
return VitalCoreReactNative.configure(apiKey, environment, region, enableLogs);
|
|
19
|
+
}
|
|
20
|
+
static cleanUp() {
|
|
21
|
+
return VitalCoreReactNative.cleanUp();
|
|
22
|
+
}
|
|
23
|
+
}
|