respectlytics-react-native 2.0.1 → 2.2.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/LICENSE +17 -20
- package/README.md +77 -29
- package/lib/commonjs/EventQueue.js +1 -1
- package/lib/commonjs/NetworkClient.js +13 -14
- package/lib/commonjs/NetworkClient.js.map +1 -1
- package/lib/commonjs/Respectlytics.js +28 -85
- package/lib/commonjs/Respectlytics.js.map +1 -1
- package/lib/commonjs/SessionManager.js +4 -4
- package/lib/commonjs/Storage.js +1 -1
- package/lib/commonjs/index.js +3 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +12 -11
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/EventQueue.js +1 -1
- package/lib/module/NetworkClient.js +13 -14
- package/lib/module/NetworkClient.js.map +1 -1
- package/lib/module/Respectlytics.js +29 -86
- package/lib/module/Respectlytics.js.map +1 -1
- package/lib/module/SessionManager.js +4 -4
- package/lib/module/Storage.js +1 -1
- package/lib/module/index.js +3 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +12 -11
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/EventQueue.d.ts +1 -1
- package/lib/typescript/NetworkClient.d.ts +6 -5
- package/lib/typescript/NetworkClient.d.ts.map +1 -1
- package/lib/typescript/Respectlytics.d.ts +15 -12
- package/lib/typescript/Respectlytics.d.ts.map +1 -1
- package/lib/typescript/SessionManager.d.ts +4 -4
- package/lib/typescript/Storage.d.ts +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +10 -14
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/EventQueue.ts +4 -4
- package/src/NetworkClient.ts +12 -13
- package/src/Respectlytics.ts +31 -92
- package/src/SessionManager.ts +6 -6
- package/src/Storage.ts +1 -1
- package/src/index.ts +5 -6
- package/src/types.ts +12 -16
package/LICENSE
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
1
|
+
MIT License
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
- View and read the source code for transparency and security review
|
|
6
|
-
- Install the SDK via official package managers (SPM, npm, pub.dev)
|
|
7
|
-
- Use the SDK to send analytics data to the official Respectlytics service
|
|
3
|
+
Copyright (c) 2025 Respectlytics
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
shall not be liable for any damages arising from the use of this SDK.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,17 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/respectlytics-react-native)
|
|
4
4
|
[](https://github.com/respectlytics/respectlytics-react-native)
|
|
5
|
-
[](LICENSE)
|
|
6
6
|
|
|
7
7
|
Official Respectlytics SDK for React Native. Privacy-first, session-based analytics with automatic session management, offline event queuing, and zero device identifier collection.
|
|
8
8
|
|
|
9
|
+
## Philosophy: Return of Avoidance (ROA)
|
|
10
|
+
|
|
11
|
+
Respectlytics helps developers avoid collecting personal data in the first place. We believe the best way to handle sensitive data is to never collect it.
|
|
12
|
+
|
|
13
|
+
Our SDK collects only 4 fields, and the API stores 5 total:
|
|
14
|
+
- `event_name` - What happened
|
|
15
|
+
- `timestamp` - When it happened
|
|
16
|
+
- `session_id` - Groups events in a session (RAM-only, auto-rotates)
|
|
17
|
+
- `platform` - iOS or Android
|
|
18
|
+
- `country` - Derived server-side from IP (IP immediately discarded, never stored)
|
|
19
|
+
|
|
20
|
+
That's it. No device identifiers, no fingerprinting, no persistent tracking.
|
|
21
|
+
|
|
9
22
|
## Features
|
|
10
23
|
|
|
11
24
|
- 🔒 **Privacy-First**: No device identifiers (IDFA, GAID, Android ID)
|
|
12
25
|
- ⚡ **Simple Integration**: 2 lines of code to get started
|
|
13
26
|
- 📡 **Offline Support**: Events queue automatically and sync when online
|
|
14
27
|
- 🔄 **Automatic Sessions**: RAM-only, 2-hour rotation, new session on app restart
|
|
15
|
-
- ✅ **Designed for GDPR/ePrivacy compliance** - Potentially consent-free
|
|
16
28
|
- 📱 **Cross-Platform**: iOS and Android support
|
|
17
29
|
|
|
18
30
|
## Requirements
|
|
@@ -53,28 +65,44 @@ Respectlytics.configure('your-api-key');
|
|
|
53
65
|
|
|
54
66
|
// 2. Track events
|
|
55
67
|
Respectlytics.track('purchase');
|
|
56
|
-
Respectlytics.track('view_product'
|
|
68
|
+
Respectlytics.track('view_product');
|
|
69
|
+
|
|
70
|
+
// For self-hosted instances:
|
|
71
|
+
Respectlytics.configure('your-api-key', {
|
|
72
|
+
apiEndpoint: 'https://your-server.com/api/v1/events/',
|
|
73
|
+
});
|
|
57
74
|
```
|
|
58
75
|
|
|
59
76
|
That's it! Session management is fully automatic.
|
|
60
77
|
|
|
61
78
|
## API Reference
|
|
62
79
|
|
|
63
|
-
### `configure(apiKey: string)`
|
|
80
|
+
### `configure(apiKey: string, options?: { apiEndpoint?: string })`
|
|
64
81
|
|
|
65
82
|
Initialize the SDK with your API key. Call once at app startup.
|
|
66
83
|
|
|
67
84
|
```typescript
|
|
85
|
+
// Respectlytics Cloud (default)
|
|
68
86
|
Respectlytics.configure('your-api-key');
|
|
87
|
+
|
|
88
|
+
// Self-hosted instance
|
|
89
|
+
Respectlytics.configure('your-api-key', {
|
|
90
|
+
apiEndpoint: 'https://your-server.com/api/v1/events/',
|
|
91
|
+
});
|
|
69
92
|
```
|
|
70
93
|
|
|
71
|
-
|
|
94
|
+
| Parameter | Type | Required | Description |
|
|
95
|
+
|-----------|------|----------|-------------|
|
|
96
|
+
| `apiKey` | `string` | Yes | Your Respectlytics API key |
|
|
97
|
+
| `options.apiEndpoint` | `string` | No | Custom endpoint for self-hosted instances |
|
|
98
|
+
|
|
99
|
+
### `track(eventName: string)`
|
|
72
100
|
|
|
73
|
-
Track an event
|
|
101
|
+
Track an event.
|
|
74
102
|
|
|
75
103
|
```typescript
|
|
76
104
|
Respectlytics.track('button_clicked');
|
|
77
|
-
Respectlytics.track('checkout_started'
|
|
105
|
+
Respectlytics.track('checkout_started');
|
|
78
106
|
```
|
|
79
107
|
|
|
80
108
|
### `flush()`
|
|
@@ -94,15 +122,16 @@ Session IDs are managed entirely by the SDK - no configuration needed.
|
|
|
94
122
|
| **New session on app launch** | Every time your app starts, a fresh session begins |
|
|
95
123
|
| **2-hour rotation** | Sessions automatically rotate after 2 hours of use |
|
|
96
124
|
| **RAM-only storage** | Session IDs are never written to disk |
|
|
97
|
-
| **No cross-session tracking** | Each session is independent and
|
|
125
|
+
| **No cross-session tracking** | Each session is independent and anonymized |
|
|
98
126
|
|
|
99
|
-
|
|
127
|
+
## Privacy Architecture
|
|
100
128
|
|
|
101
|
-
|
|
129
|
+
Respectlytics uses anonymized identifiers stored only in device memory (RAM) that rotate automatically every two hours or upon app restart. IP addresses are processed transiently for approximate country lookup and immediately discarded—no personal data is ever persisted.
|
|
102
130
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
Our system is:
|
|
132
|
+
- **Transparent** - Clear about what data is collected
|
|
133
|
+
- **Defensible** - Minimal data surface by design
|
|
134
|
+
- **Clear** - Explicit reasoning for each field
|
|
106
135
|
|
|
107
136
|
| What we DON'T collect | Why |
|
|
108
137
|
|----------------------|-----|
|
|
@@ -110,16 +139,18 @@ This privacy-by-design architecture avoids persistent device storage and cross-s
|
|
|
110
139
|
| Device fingerprints | Can be used to identify users without consent |
|
|
111
140
|
| IP addresses | Processed transiently for geolocation, then discarded |
|
|
112
141
|
| Custom properties | Prevents accidental PII collection |
|
|
113
|
-
| Persistent user IDs | Cross-session tracking
|
|
142
|
+
| Persistent user IDs | Cross-session tracking is unnecessary |
|
|
114
143
|
|
|
115
144
|
| What we DO collect | Purpose |
|
|
116
145
|
|-------------------|---------|
|
|
117
146
|
| Event name | Analytics |
|
|
118
|
-
|
|
|
147
|
+
| Timestamp | When the event occurred |
|
|
119
148
|
| Random session ID (RAM-only) | Group events in a session |
|
|
120
|
-
| Platform
|
|
121
|
-
|
|
122
|
-
|
|
149
|
+
| Platform | iOS or Android |
|
|
150
|
+
|
|
151
|
+
### Server-Side Only
|
|
152
|
+
|
|
153
|
+
Country is derived server-side from IP addresses, then IP is immediately discarded.
|
|
123
154
|
|
|
124
155
|
## Automatic Behaviors
|
|
125
156
|
|
|
@@ -142,27 +173,44 @@ Events are automatically queued when offline and sent when connectivity returns:
|
|
|
142
173
|
3. Queue is flushed when connectivity is restored
|
|
143
174
|
4. Failed sends are retried with exponential backoff
|
|
144
175
|
|
|
145
|
-
## Migration from
|
|
176
|
+
## Migration from v2.1.x
|
|
177
|
+
|
|
178
|
+
### Changes in v2.2.0
|
|
179
|
+
|
|
180
|
+
- `configure()` now accepts an optional second argument `{ apiEndpoint }` for self-hosted instances
|
|
181
|
+
- License changed from proprietary to MIT
|
|
182
|
+
- The API stores 5 fields total (the 4 sent by the SDK plus `country` derived server-side)
|
|
183
|
+
|
|
184
|
+
### What to do
|
|
185
|
+
|
|
186
|
+
No breaking changes. Existing code works as-is.
|
|
146
187
|
|
|
147
|
-
|
|
188
|
+
## Migration from v2.0.x
|
|
148
189
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-
|
|
190
|
+
### Changes in v2.1.0
|
|
191
|
+
|
|
192
|
+
- `track()` method now takes only `eventName` - the `screen` parameter has been removed
|
|
193
|
+
- Deprecated fields (`screen`, `os_version`, `app_version`, `locale`, `device_type`, `region`) are no longer collected
|
|
152
194
|
|
|
153
195
|
### What to do
|
|
154
196
|
|
|
155
|
-
1.
|
|
156
|
-
|
|
157
|
-
|
|
197
|
+
1. Update any `track()` calls that pass a second parameter:
|
|
198
|
+
```typescript
|
|
199
|
+
// Before
|
|
200
|
+
Respectlytics.track('view_product', 'ProductScreen');
|
|
201
|
+
|
|
202
|
+
// After
|
|
203
|
+
Respectlytics.track('view_product');
|
|
204
|
+
```
|
|
205
|
+
2. That's it!
|
|
158
206
|
|
|
159
|
-
|
|
207
|
+
## Legal Note
|
|
160
208
|
|
|
161
|
-
|
|
209
|
+
Respectlytics provides a technical solution focused on privacy. Regulations vary by jurisdiction. Consult your legal team to determine your specific requirements.
|
|
162
210
|
|
|
163
211
|
## License
|
|
164
212
|
|
|
165
|
-
This SDK is
|
|
213
|
+
This SDK is licensed under the [MIT License](LICENSE).
|
|
166
214
|
|
|
167
215
|
## Support
|
|
168
216
|
|
|
@@ -14,7 +14,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
14
14
|
*
|
|
15
15
|
* Manages event batching, persistence, and automatic flushing.
|
|
16
16
|
* Events are NEVER lost - they are persisted immediately and retried on failure.
|
|
17
|
-
* Copyright (c) 2025 Respectlytics.
|
|
17
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
const MAX_QUEUE_SIZE = 10;
|
|
@@ -7,12 +7,12 @@ exports.networkClient = exports.NetworkError = exports.NetworkClient = void 0;
|
|
|
7
7
|
/**
|
|
8
8
|
* NetworkClient.ts
|
|
9
9
|
* Respectlytics React Native SDK
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* Handles HTTP communication with the Respectlytics API.
|
|
12
|
-
* Copyright (c) 2025 Respectlytics.
|
|
12
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const DEFAULT_API_ENDPOINT = 'https://respectlytics.com/api/v1/events/';
|
|
16
16
|
const MAX_RETRIES = 3;
|
|
17
17
|
const TIMEOUT_MS = 30000;
|
|
18
18
|
let NetworkError = exports.NetworkError = /*#__PURE__*/function (NetworkError) {
|
|
@@ -28,12 +28,16 @@ let NetworkError = exports.NetworkError = /*#__PURE__*/function (NetworkError) {
|
|
|
28
28
|
}({});
|
|
29
29
|
class NetworkClient {
|
|
30
30
|
apiKey = null;
|
|
31
|
+
apiEndpoint = DEFAULT_API_ENDPOINT;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* Configure the network client with an API key
|
|
34
|
+
* Configure the network client with an API key and optional custom endpoint
|
|
34
35
|
*/
|
|
35
|
-
configure(apiKey) {
|
|
36
|
+
configure(apiKey, apiEndpoint) {
|
|
36
37
|
this.apiKey = apiKey;
|
|
38
|
+
if (apiEndpoint) {
|
|
39
|
+
this.apiEndpoint = apiEndpoint;
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
/**
|
|
@@ -65,7 +69,7 @@ class NetworkClient {
|
|
|
65
69
|
const controller = new AbortController();
|
|
66
70
|
const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
67
71
|
try {
|
|
68
|
-
const response = await fetch(
|
|
72
|
+
const response = await fetch(this.apiEndpoint, {
|
|
69
73
|
method: 'POST',
|
|
70
74
|
headers: {
|
|
71
75
|
'Content-Type': 'application/json',
|
|
@@ -129,20 +133,15 @@ class NetworkClient {
|
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
/**
|
|
132
|
-
* Convert Event object to API payload format
|
|
133
|
-
*
|
|
136
|
+
* Convert Event object to API payload format.
|
|
137
|
+
* The SDK sends 4 fields; the API stores 5 (adding country derived from IP).
|
|
134
138
|
*/
|
|
135
139
|
eventToPayload(event) {
|
|
136
140
|
return {
|
|
137
141
|
event_name: event.eventName,
|
|
138
142
|
timestamp: event.timestamp,
|
|
139
143
|
session_id: event.sessionId,
|
|
140
|
-
|
|
141
|
-
platform: event.platform,
|
|
142
|
-
os_version: event.osVersion,
|
|
143
|
-
app_version: event.appVersion,
|
|
144
|
-
locale: event.locale,
|
|
145
|
-
device_type: event.deviceType
|
|
144
|
+
platform: event.platform
|
|
146
145
|
};
|
|
147
146
|
}
|
|
148
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["DEFAULT_API_ENDPOINT","MAX_RETRIES","TIMEOUT_MS","NetworkError","exports","NetworkClient","apiKey","apiEndpoint","configure","isConfigured","send","events","Error","NotConfigured","event","sendEvent","attempt","controller","AbortController","timeoutId","setTimeout","abort","response","fetch","method","headers","body","JSON","stringify","eventToPayload","signal","clearTimeout","ok","status","Unauthorized","BadRequest","delay","Math","pow","RateLimited","ServerError","InvalidResponse","error","message","name","Timeout","event_name","eventName","timestamp","session_id","sessionId","platform","ms","Promise","resolve","networkClient"],"sourceRoot":"../../src","sources":["NetworkClient.ts"],"mappings":";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,KAAK,CAACoC,SAAS;MAC3BC,QAAQ,EAAErC,KAAK,CAACqC;IAClB,CAAC;EACH;;EAEA;AACF;AACA;EACUf,KAAKA,CAACgB,EAAU,EAAiB;IACvC,OAAO,IAAIC,OAAO,CAACC,OAAO,IAAIlC,UAAU,CAACkC,OAAO,EAAEF,EAAE,CAAC,CAAC;EACxD;AACF;AAAChD,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAEM,MAAMkD,aAAa,GAAAnD,OAAA,CAAAmD,aAAA,GAAG,IAAIlD,aAAa,CAAC,CAAC","ignoreList":[]}
|
|
@@ -11,28 +11,30 @@ var _EventQueue = require("./EventQueue");
|
|
|
11
11
|
/**
|
|
12
12
|
* Respectlytics.ts
|
|
13
13
|
* Respectlytics React Native SDK
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* Main entry point for the SDK.
|
|
16
|
-
* Copyright (c) 2025 Respectlytics.
|
|
16
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Main entry point for the Respectlytics SDK.
|
|
21
|
-
*
|
|
22
|
-
* v2.
|
|
21
|
+
*
|
|
22
|
+
* v2.1.0 uses session-based analytics only:
|
|
23
23
|
* - Session IDs are generated automatically in RAM
|
|
24
24
|
* - Sessions rotate every 2 hours
|
|
25
25
|
* - New session on every app restart
|
|
26
|
-
* -
|
|
27
|
-
*
|
|
26
|
+
* - Only 4 fields sent by SDK; 5 stored (country derived server-side)
|
|
27
|
+
*
|
|
28
28
|
* Usage:
|
|
29
29
|
* ```typescript
|
|
30
30
|
* // 1. Configure at app launch
|
|
31
31
|
* Respectlytics.configure('your-api-key');
|
|
32
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* // For self-hosted instances:
|
|
34
|
+
* Respectlytics.configure('your-api-key', { apiEndpoint: 'https://your-server.com/api/v1/events/' });
|
|
35
|
+
*
|
|
33
36
|
* // 2. Track events
|
|
34
37
|
* Respectlytics.track('purchase');
|
|
35
|
-
* Respectlytics.track('view_product', 'ProductScreen');
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
40
|
class RespectlyticsSDK {
|
|
@@ -41,35 +43,36 @@ class RespectlyticsSDK {
|
|
|
41
43
|
this.networkClient = new _NetworkClient.NetworkClient();
|
|
42
44
|
this.eventQueue = new _EventQueue.EventQueue(this.networkClient);
|
|
43
45
|
this.sessionManager = new _SessionManager.SessionManager();
|
|
46
|
+
this.platform = _reactNative.Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
/**
|
|
47
50
|
* Initialize the SDK with your API key.
|
|
48
51
|
* Call once at app startup.
|
|
49
|
-
*
|
|
52
|
+
*
|
|
50
53
|
* @param apiKey Your Respectlytics API key from the dashboard
|
|
54
|
+
* @param options Optional configuration (e.g., apiEndpoint for self-hosted instances)
|
|
51
55
|
*/
|
|
52
|
-
configure(apiKey) {
|
|
56
|
+
configure(apiKey, options) {
|
|
53
57
|
if (!apiKey || apiKey.trim() === '') {
|
|
54
58
|
console.log('[Respectlytics] ⚠️ API key cannot be empty');
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
57
|
-
this.networkClient.configure(apiKey);
|
|
61
|
+
this.networkClient.configure(apiKey, options?.apiEndpoint);
|
|
58
62
|
this.eventQueue.start();
|
|
59
63
|
this.isConfigured = true;
|
|
60
|
-
console.log('[Respectlytics] ✓ SDK configured');
|
|
64
|
+
console.log('[Respectlytics] ✓ SDK configured (v2.2.0)');
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
/**
|
|
64
|
-
* Track an event
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
68
|
+
* Track an event.
|
|
69
|
+
*
|
|
70
|
+
* Custom properties are NOT supported - this is by design for privacy.
|
|
71
|
+
* The API stores 5 fields (these 4 plus country derived server-side).
|
|
72
|
+
*
|
|
69
73
|
* @param eventName Name of the event (e.g., "purchase", "button_clicked")
|
|
70
|
-
* @param screen Optional screen name where the event occurred
|
|
71
74
|
*/
|
|
72
|
-
track(eventName
|
|
75
|
+
track(eventName) {
|
|
73
76
|
if (!this.isConfigured) {
|
|
74
77
|
console.log('[Respectlytics] ⚠️ SDK not configured. Call configure(apiKey) first.');
|
|
75
78
|
return;
|
|
@@ -82,7 +85,12 @@ class RespectlyticsSDK {
|
|
|
82
85
|
console.log('[Respectlytics] ⚠️ Event name too long (max 100 characters)');
|
|
83
86
|
return;
|
|
84
87
|
}
|
|
85
|
-
const event =
|
|
88
|
+
const event = {
|
|
89
|
+
eventName,
|
|
90
|
+
timestamp: new Date().toISOString(),
|
|
91
|
+
sessionId: this.sessionManager.getSessionId(),
|
|
92
|
+
platform: this.platform
|
|
93
|
+
};
|
|
86
94
|
this.eventQueue.add(event);
|
|
87
95
|
}
|
|
88
96
|
|
|
@@ -93,71 +101,6 @@ class RespectlyticsSDK {
|
|
|
93
101
|
async flush() {
|
|
94
102
|
await this.eventQueue.flush();
|
|
95
103
|
}
|
|
96
|
-
|
|
97
|
-
// MARK: - Private Helpers
|
|
98
|
-
|
|
99
|
-
createEvent(eventName, screen) {
|
|
100
|
-
const metadata = this.collectMetadata();
|
|
101
|
-
return {
|
|
102
|
-
eventName,
|
|
103
|
-
timestamp: new Date().toISOString(),
|
|
104
|
-
sessionId: this.sessionManager.getSessionId(),
|
|
105
|
-
screen: screen || null,
|
|
106
|
-
...metadata
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
collectMetadata() {
|
|
110
|
-
// Determine platform
|
|
111
|
-
const platform = _reactNative.Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
112
|
-
|
|
113
|
-
// Get OS version
|
|
114
|
-
const osVersion = String(_reactNative.Platform.Version);
|
|
115
|
-
|
|
116
|
-
// Get app version - try to get from native modules
|
|
117
|
-
let appVersion = 'unknown';
|
|
118
|
-
try {
|
|
119
|
-
// React Native provides app info through different native modules
|
|
120
|
-
const {
|
|
121
|
-
PlatformConstants
|
|
122
|
-
} = _reactNative.NativeModules;
|
|
123
|
-
if (PlatformConstants?.reactNativeVersion) {
|
|
124
|
-
// This is React Native version, not app version
|
|
125
|
-
// App version should come from the host app
|
|
126
|
-
}
|
|
127
|
-
// For now, use 'unknown' as we can't reliably get app version without additional dependencies
|
|
128
|
-
// In a real app, the developer would configure this
|
|
129
|
-
} catch {
|
|
130
|
-
appVersion = 'unknown';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Get locale
|
|
134
|
-
let locale = 'en_US';
|
|
135
|
-
try {
|
|
136
|
-
// React Native doesn't expose locale directly, but we can get it from platform
|
|
137
|
-
if (_reactNative.Platform.OS === 'ios') {
|
|
138
|
-
locale = _reactNative.NativeModules.SettingsManager?.settings?.AppleLocale || _reactNative.NativeModules.SettingsManager?.settings?.AppleLanguages?.[0] || 'en_US';
|
|
139
|
-
} else {
|
|
140
|
-
locale = _reactNative.NativeModules.I18nManager?.localeIdentifier || 'en_US';
|
|
141
|
-
}
|
|
142
|
-
} catch {
|
|
143
|
-
locale = 'en_US';
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Determine device type based on screen size
|
|
147
|
-
const {
|
|
148
|
-
width,
|
|
149
|
-
height
|
|
150
|
-
} = _reactNative.Dimensions.get('window');
|
|
151
|
-
const minDimension = Math.min(width, height);
|
|
152
|
-
const deviceType = minDimension >= 600 ? 'tablet' : 'phone';
|
|
153
|
-
return {
|
|
154
|
-
platform,
|
|
155
|
-
osVersion,
|
|
156
|
-
appVersion,
|
|
157
|
-
locale,
|
|
158
|
-
deviceType
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
104
|
}
|
|
162
105
|
|
|
163
106
|
// Export singleton instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_SessionManager","_NetworkClient","_EventQueue","RespectlyticsSDK","isConfigured","constructor","networkClient","NetworkClient","eventQueue","EventQueue","sessionManager","SessionManager","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_SessionManager","_NetworkClient","_EventQueue","RespectlyticsSDK","isConfigured","constructor","networkClient","NetworkClient","eventQueue","EventQueue","sessionManager","SessionManager","platform","Platform","OS","configure","apiKey","options","trim","console","log","apiEndpoint","start","track","eventName","length","event","timestamp","Date","toISOString","sessionId","getSessionId","add","flush","exports","Respectlytics","_default","default"],"sourceRoot":"../../src","sources":["Respectlytics.ts"],"mappings":";;;;;;AAQA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,gBAAgB,CAAC;EACbC,YAAY,GAAG,KAAK;EAM5BC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,aAAa,GAAG,IAAIC,4BAAa,CAAC,CAAC;IACxC,IAAI,CAACC,UAAU,GAAG,IAAIC,sBAAU,CAAC,IAAI,CAACH,aAAa,CAAC;IACpD,IAAI,CAACI,cAAc,GAAG,IAAIC,8BAAc,CAAC,CAAC;IAC1C,IAAI,CAACC,QAAQ,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,KAAK,GAAG,SAAS;EAC3D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,SAASA,CAACC,MAAc,EAAEC,OAAkC,EAAQ;IAClE,IAAI,CAACD,MAAM,IAAIA,MAAM,CAACE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;MACnCC,OAAO,CAACC,GAAG,CAAC,4CAA4C,CAAC;MACzD;IACF;IAEA,IAAI,CAACd,aAAa,CAACS,SAAS,CAACC,MAAM,EAAEC,OAAO,EAAEI,WAAW,CAAC;IAC1D,IAAI,CAACb,UAAU,CAACc,KAAK,CAAC,CAAC;IACvB,IAAI,CAAClB,YAAY,GAAG,IAAI;IAExBe,OAAO,CAACC,GAAG,CAAC,2CAA2C,CAAC;EAC1D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,KAAKA,CAACC,SAAiB,EAAQ;IAC7B,IAAI,CAAC,IAAI,CAACpB,YAAY,EAAE;MACtBe,OAAO,CAACC,GAAG,CAAC,sEAAsE,CAAC;MACnF;IACF;IAEA,IAAI,CAACI,SAAS,IAAIA,SAAS,CAACN,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;MACzCC,OAAO,CAACC,GAAG,CAAC,+CAA+C,CAAC;MAC5D;IACF;IAEA,IAAII,SAAS,CAACC,MAAM,GAAG,GAAG,EAAE;MAC1BN,OAAO,CAACC,GAAG,CAAC,6DAA6D,CAAC;MAC1E;IACF;IAEA,MAAMM,KAAY,GAAG;MACnBF,SAAS;MACTG,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;MACnCC,SAAS,EAAE,IAAI,CAACpB,cAAc,CAACqB,YAAY,CAAC,CAAC;MAC7CnB,QAAQ,EAAE,IAAI,CAACA;IACjB,CAAC;IAED,IAAI,CAACJ,UAAU,CAACwB,GAAG,CAACN,KAAK,CAAC;EAC5B;;EAEA;AACF;AACA;AACA;EACE,MAAMO,KAAKA,CAAA,EAAkB;IAC3B,MAAM,IAAI,CAACzB,UAAU,CAACyB,KAAK,CAAC,CAAC;EAC/B;AACF;;AAEA;AAAAC,OAAA,CAAA/B,gBAAA,GAAAA,gBAAA;AACA,MAAMgC,aAAa,GAAG,IAAIhC,gBAAgB,CAAC,CAAC;AAAC,IAAAiC,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAC9BF,aAAa","ignoreList":[]}
|
|
@@ -9,10 +9,10 @@ exports.SessionManager = void 0;
|
|
|
9
9
|
* Respectlytics React Native SDK
|
|
10
10
|
*
|
|
11
11
|
* Manages session ID generation and rotation.
|
|
12
|
-
* Sessions are stored in RAM only (never persisted
|
|
12
|
+
* Sessions are stored in RAM only (never persisted to disk).
|
|
13
13
|
* Sessions automatically rotate every 2 hours.
|
|
14
14
|
*
|
|
15
|
-
* Copyright (c) 2025 Respectlytics.
|
|
15
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -35,8 +35,8 @@ function generateUUID() {
|
|
|
35
35
|
* - Rotated automatically every 2 hours
|
|
36
36
|
* - Regenerated on every app restart (new instance = new session)
|
|
37
37
|
*
|
|
38
|
-
* This RAM-only approach
|
|
39
|
-
* -
|
|
38
|
+
* This RAM-only approach means session data never touches device storage:
|
|
39
|
+
* - Sessions exist only in memory and are lost on app restart
|
|
40
40
|
* - Each app launch creates a fresh, unlinked session
|
|
41
41
|
*/
|
|
42
42
|
class SessionManager {
|
package/lib/commonjs/Storage.js
CHANGED
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
12
12
|
*
|
|
13
13
|
* Wrapper around AsyncStorage for persisting SDK data.
|
|
14
14
|
*
|
|
15
|
-
* Copyright (c) 2025 Respectlytics.
|
|
15
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
/**
|
package/lib/commonjs/index.js
CHANGED
|
@@ -26,11 +26,11 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
26
26
|
*
|
|
27
27
|
* v2.0.0 Features:
|
|
28
28
|
* - Session-based analytics (no persistent user tracking)
|
|
29
|
-
* - RAM-only session storage (
|
|
29
|
+
* - RAM-only session storage (never persisted to disk)
|
|
30
30
|
* - Automatic 2-hour session rotation
|
|
31
31
|
* - New session on every app restart
|
|
32
|
-
*
|
|
33
|
-
* Copyright (c) 2025 Respectlytics.
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
34
34
|
*/
|
|
35
35
|
// Default export - the main SDK instance
|
|
36
36
|
var _default = exports.default = _Respectlytics.default; // Named exports for advanced usage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_Respectlytics","_interopRequireWildcard","require","_types","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","Respectlytics"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"names":["_Respectlytics","_interopRequireWildcard","require","_types","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","Respectlytics"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,IAAAA,cAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAD,OAAA;AAAgC,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AApBhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA,IAAAkB,QAAA,GAAAC,OAAA,CAAAV,OAAA,GACeW,sBAAa,EAE5B","ignoreList":[]}
|
package/lib/commonjs/types.js
CHANGED
|
@@ -8,26 +8,27 @@ exports.STORAGE_KEYS = void 0;
|
|
|
8
8
|
* types.ts
|
|
9
9
|
* Respectlytics React Native SDK
|
|
10
10
|
*
|
|
11
|
-
* Copyright (c) 2025 Respectlytics.
|
|
12
|
-
* This SDK is provided under a proprietary license.
|
|
13
|
-
* See LICENSE file for details.
|
|
11
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
14
12
|
*/
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* Represents an analytics event - flat structure matching API payload
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
17
|
+
* The SDK sends these 4 fields. The API stores 5 total
|
|
18
|
+
* (adding country, derived server-side from IP which is immediately discarded):
|
|
19
|
+
* - event_name (required)
|
|
20
|
+
* - timestamp
|
|
21
|
+
* - session_id
|
|
22
|
+
* - platform
|
|
23
|
+
*
|
|
24
|
+
* Country is derived server-side from IP (which is immediately discarded).
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Storage keys used by the SDK
|
|
28
|
-
*
|
|
29
|
-
* Note:
|
|
30
|
-
* Session IDs are RAM-only for
|
|
29
|
+
*
|
|
30
|
+
* Note: Only the event queue is persisted.
|
|
31
|
+
* Session IDs are RAM-only for privacy.
|
|
31
32
|
*/
|
|
32
33
|
const STORAGE_KEYS = exports.STORAGE_KEYS = {
|
|
33
34
|
EVENT_QUEUE: 'com.respectlytics.eventQueue'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["STORAGE_KEYS","exports","EVENT_QUEUE"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["STORAGE_KEYS","exports","EVENT_QUEUE"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BE,WAAW,EAAE;AACf,CAAU","ignoreList":[]}
|
package/lib/module/EventQueue.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Manages event batching, persistence, and automatic flushing.
|
|
6
6
|
* Events are NEVER lost - they are persisted immediately and retried on failure.
|
|
7
|
-
* Copyright (c) 2025 Respectlytics.
|
|
7
|
+
* Copyright (c) 2025 Respectlytics. Licensed under MIT.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { AppState } from 'react-native';
|