@metarouter/react-native-sdk 0.1.7 → 0.1.8
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/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 +2 -1
package/lib/MetaRouter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetaRouter.d.ts","sourceRoot":"","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,M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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.8",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"clean": "rm -rf lib",
|
|
21
21
|
"build": "tsc --project tsconfig.build.json",
|
|
22
22
|
"prepare": "npm run build",
|
|
23
|
+
"publish": "npm run clean && npm run build && npm publish --access public",
|
|
23
24
|
"test": "jest"
|
|
24
25
|
},
|
|
25
26
|
"publishConfig": {
|