@nexly/react-native 0.13.0 → 0.15.0
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/README.md +2 -0
- package/dist/nexly.d.ts +5 -0
- package/dist/nexly.d.ts.map +1 -1
- package/dist/nexly.js +13 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,3 +73,5 @@ Hook it up to your router of choice. Example with `@react-navigation/native`:
|
|
|
73
73
|
- Sends `session_ping` when the app goes to background, and `session_end` on provider unmount.
|
|
74
74
|
|
|
75
75
|
No scroll/click tracking (those are DOM-only); if you want tap analytics, send custom `engagement` events yourself.
|
|
76
|
+
|
|
77
|
+
`startEngagement()` is idempotent — calling it again stops the previous subscription first, so Fast Refresh or double-mounts cannot produce duplicate listeners.
|
package/dist/nexly.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { NexlyBase, type NexlyInit } from '@nexly/core';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class Nexly extends NexlyBase {
|
|
10
10
|
private currentScreen;
|
|
11
|
+
private engagementStop;
|
|
11
12
|
/**
|
|
12
13
|
* Creates (or replaces) the singleton **and awaits ID prewarming**.
|
|
13
14
|
* `NexlyProvider` awaits this before exposing a client via context.
|
|
@@ -24,6 +25,10 @@ export declare class Nexly extends NexlyBase {
|
|
|
24
25
|
protected collectEventContext(): Record<string, unknown>;
|
|
25
26
|
protected collectSessionContext(): Record<string, unknown>;
|
|
26
27
|
getDefaultPath(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Attaches AppState-driven engagement tracking. Idempotent: calling again
|
|
30
|
+
* stops the previous subscription first. Returns a cleanup function.
|
|
31
|
+
*/
|
|
27
32
|
startEngagement(): () => void;
|
|
28
33
|
}
|
|
29
34
|
//# sourceMappingURL=nexly.d.ts.map
|
package/dist/nexly.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexly.d.ts","sourceRoot":"","sources":["../src/nexly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAmBpE;;;;;;GAMG;AACH,qBAAa,KAAM,SAAQ,SAAS;IAClC,OAAO,CAAC,aAAa,CAAM;
|
|
1
|
+
{"version":3,"file":"nexly.d.ts","sourceRoot":"","sources":["../src/nexly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAmBpE;;;;;;GAMG;AACH,qBAAa,KAAM,SAAQ,SAAS;IAClC,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,cAAc,CAA4B;IAElD;;;OAGG;WACU,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IASrD,+DAA+D;IAC/D,MAAM,CAAC,WAAW,IAAI,KAAK,GAAG,IAAI;gBAItB,IAAI,EAAE,SAAS;IAI3B,yEAAyE;IACzE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK7B,+DAA+D;IAC/D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;cAKd,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;cAIpD,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAI9C,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI1D,cAAc,IAAI,MAAM;IAIjC;;;OAGG;IACH,eAAe,IAAI,MAAM,IAAI;CAe9B"}
|
package/dist/nexly.js
CHANGED
|
@@ -24,6 +24,7 @@ function defaultClient() {
|
|
|
24
24
|
*/
|
|
25
25
|
export class Nexly extends NexlyBase {
|
|
26
26
|
currentScreen = '/';
|
|
27
|
+
engagementStop = null;
|
|
27
28
|
/**
|
|
28
29
|
* Creates (or replaces) the singleton **and awaits ID prewarming**.
|
|
29
30
|
* `NexlyProvider` awaits this before exposing a client via context.
|
|
@@ -65,14 +66,25 @@ export class Nexly extends NexlyBase {
|
|
|
65
66
|
getDefaultPath() {
|
|
66
67
|
return this.currentScreen;
|
|
67
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Attaches AppState-driven engagement tracking. Idempotent: calling again
|
|
71
|
+
* stops the previous subscription first. Returns a cleanup function.
|
|
72
|
+
*/
|
|
68
73
|
startEngagement() {
|
|
69
74
|
if (this.disabled)
|
|
70
75
|
return () => { };
|
|
71
|
-
|
|
76
|
+
this.engagementStop?.();
|
|
77
|
+
const stop = startEngagementTracking({
|
|
72
78
|
collectUrl: this.collectUrl,
|
|
73
79
|
appId: this.appId,
|
|
74
80
|
apiToken: this.key,
|
|
75
81
|
client: this.client,
|
|
76
82
|
});
|
|
83
|
+
this.engagementStop = stop;
|
|
84
|
+
return () => {
|
|
85
|
+
stop();
|
|
86
|
+
if (this.engagementStop === stop)
|
|
87
|
+
this.engagementStop = null;
|
|
88
|
+
};
|
|
77
89
|
}
|
|
78
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexly/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "React Native bindings for Nexly: fetch transport, AsyncStorage IDs, AppState engagement on top of @nexly/core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-native": ">=0.72.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@nexly/core": "0.
|
|
46
|
+
"@nexly/core": "0.15.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@react-native-async-storage/async-storage": "^2.1.2",
|