@metarouter/react-native-sdk 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +35 -0
- package/android/consumer-rules.pro +0 -0
- package/lib/MetaRouter.d.ts.map +1 -1
- package/lib/MetaRouter.js +1 -0
- package/lib/proxyClient.d.ts +1 -1
- package/lib/proxyClient.d.ts.map +1 -1
- package/lib/proxyClient.js +24 -26
- package/package.json +4 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
|
|
3
|
+
android {
|
|
4
|
+
namespace 'com.metarouterreactnative' // <- required in modern RN, change as needed
|
|
5
|
+
compileSdkVersion 33
|
|
6
|
+
|
|
7
|
+
defaultConfig {
|
|
8
|
+
minSdkVersion 21
|
|
9
|
+
targetSdkVersion 33
|
|
10
|
+
versionCode 1
|
|
11
|
+
versionName "0.1.0"
|
|
12
|
+
|
|
13
|
+
consumerProguardFiles "consumer-rules.pro"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
compileOptions {
|
|
17
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
18
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dependencies {
|
|
23
|
+
// Core RN dependency (linked by consumer app)
|
|
24
|
+
implementation 'com.facebook.react:react-native:+'
|
|
25
|
+
|
|
26
|
+
// Segment SDK + Sovran
|
|
27
|
+
implementation "com.segment.analytics.reactnative:analytics-react-native:2.21.2"
|
|
28
|
+
implementation "com.segment.analytics.reactnative:sovran-react-native:1.1.3"
|
|
29
|
+
|
|
30
|
+
// Async storage
|
|
31
|
+
implementation "com.reactnativecommunity:async-storage:1.17.11"
|
|
32
|
+
|
|
33
|
+
// Random values (get-random-values equivalent)
|
|
34
|
+
implementation "org.lazysodium:randombytes:1.0.1"
|
|
35
|
+
}
|
|
File without changes
|
package/lib/M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"","sources":["../src/MetaRouter.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC5D,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACjE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC/D,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC5D,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU;oBACC,WAAW,KAAG,OAAO,CAAC,kBAAkB,CAAC;iBAqClD,kBAAkB;iBAIlB,WAAW,GAAG,kBAAkB;;CAY9C,CAAC"}
|
package/lib/MetaRouter.js
CHANGED
package/lib/proxyClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AnalyticsInterface } from './MetaRouter';
|
|
2
2
|
export declare const proxyClient: AnalyticsInterface;
|
|
3
|
-
export declare function setRealClient(c: AnalyticsInterface): void;
|
|
3
|
+
export declare function setRealClient(c: AnalyticsInterface | null): void;
|
|
4
4
|
//# sourceMappingURL=proxyClient.d.ts.map
|
package/lib/proxyClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyClient.d.ts","sourceRoot":"","sources":["../src/proxyClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"proxyClient.d.ts","sourceRoot":"","sources":["../src/proxyClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAiBvD,eAAO,MAAM,WAAW,EAAE,kBAQzB,CAAC;AAEF,wBAAgB,aAAa,CAAC,CAAC,EAAE,kBAAkB,GAAG,IAAI,QAMzD"}
|
package/lib/proxyClient.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
const pendingCalls = [];
|
|
2
|
+
let realClient = null;
|
|
3
|
+
function handleMethodCall(methodName, ...args) {
|
|
4
|
+
if (realClient) {
|
|
5
|
+
return realClient[methodName](...args);
|
|
6
|
+
}
|
|
7
|
+
// Queue the call for later execution
|
|
8
|
+
pendingCalls.push(() => {
|
|
9
|
+
if (realClient) {
|
|
10
|
+
realClient[methodName](...args);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
2
14
|
export const proxyClient = {
|
|
3
|
-
track: (event, props) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
pendingCalls.push(() => client.group(groupId, traits));
|
|
11
|
-
},
|
|
12
|
-
screen: (name, props) => {
|
|
13
|
-
pendingCalls.push(() => client.screen(name, props));
|
|
14
|
-
},
|
|
15
|
-
alias: (newUserId) => {
|
|
16
|
-
pendingCalls.push(() => client.alias(newUserId));
|
|
17
|
-
},
|
|
18
|
-
flush: () => {
|
|
19
|
-
pendingCalls.push(() => client.flush());
|
|
20
|
-
},
|
|
21
|
-
cleanup: () => {
|
|
22
|
-
pendingCalls.push(() => client.cleanup());
|
|
23
|
-
},
|
|
15
|
+
track: (event, props) => handleMethodCall('track', event, props),
|
|
16
|
+
identify: (userId, traits) => handleMethodCall('identify', userId, traits),
|
|
17
|
+
group: (groupId, traits) => handleMethodCall('group', groupId, traits),
|
|
18
|
+
screen: (name, props) => handleMethodCall('screen', name, props),
|
|
19
|
+
alias: (newUserId) => handleMethodCall('alias', newUserId),
|
|
20
|
+
flush: () => handleMethodCall('flush'),
|
|
21
|
+
cleanup: () => handleMethodCall('cleanup'),
|
|
24
22
|
};
|
|
25
|
-
let client = null;
|
|
26
23
|
export function setRealClient(c) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
realClient = c;
|
|
25
|
+
if (c) {
|
|
26
|
+
pendingCalls.forEach((fn) => fn());
|
|
27
|
+
pendingCalls.length = 0;
|
|
28
|
+
}
|
|
31
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metarouter/react-native-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -14,12 +14,14 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"lib",
|
|
16
16
|
"react-native.config.js",
|
|
17
|
-
"MetaRouterReactNativeSDK.podspec"
|
|
17
|
+
"MetaRouterReactNativeSDK.podspec",
|
|
18
|
+
"android"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
21
|
"clean": "rm -rf lib",
|
|
21
22
|
"build": "tsc --project tsconfig.build.json",
|
|
22
23
|
"prepare": "npm run build",
|
|
24
|
+
"prePublish": "npm run clean && npm run build",
|
|
23
25
|
"test": "jest"
|
|
24
26
|
},
|
|
25
27
|
"publishConfig": {
|