@metarouter/react-native-sdk 0.1.6 → 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.
@@ -24,4 +24,5 @@ Pod::Spec.new do |s|
24
24
  s.dependency 'AnalyticsReactNative', '~> 2.21.2'
25
25
  s.dependency 'SovranReactNative', '~> 1.1.3'
26
26
  s.dependency 'react-native-get-random-values', '~> 1.11.0'
27
+ s.dependency 'RNCAsyncStorage', '~> 2.2.0'
27
28
  end
@@ -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,S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,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
@@ -50,5 +50,6 @@ export const MetaRouter = {
50
50
  analytics = null;
51
51
  analyticsInterface = null;
52
52
  initialized = false;
53
+ setRealClient(null);
53
54
  },
54
55
  };
@@ -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
@@ -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;AAIvD,eAAO,MAAM,WAAW,EAAE,kBAsBzB,CAAC;AAIF,wBAAgB,aAAa,CAAC,CAAC,EAAE,kBAAkB,QAMlD"}
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"}
@@ -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
- pendingCalls.push(() => client.track(event, props));
5
- },
6
- identify: (userId, traits) => {
7
- pendingCalls.push(() => client.identify(userId, traits));
8
- },
9
- group: (groupId, traits) => {
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
- client = c;
28
- // Flush pending
29
- pendingCalls.forEach((fn) => fn());
30
- pendingCalls.length = 0;
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.6",
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": {
@@ -37,6 +38,7 @@
37
38
  "url": "https://github.com/metarouterio/react-native-sdk"
38
39
  },
39
40
  "dependencies": {
41
+ "@react-native-async-storage/async-storage": "^2.2.0",
40
42
  "@segment/analytics-react-native": "^2.21.2",
41
43
  "@segment/sovran-react-native": "^1.1.3",
42
44
  "react-native-get-random-values": "^1.11.0"
@@ -3,6 +3,7 @@ module.exports = {
3
3
  '@segment/analytics-react-native': {},
4
4
  '@segment/sovran-react-native': {},
5
5
  'react-native-get-random-values': {},
6
+ '@react-native-async-storage/async-storage': {},
6
7
  },
7
8
  platforms: {
8
9
  ios: {},