respectlytics-react-native 1.0.1 → 2.0.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 +43 -34
- package/lib/commonjs/EventQueue.js +174 -0
- package/lib/commonjs/EventQueue.js.map +1 -0
- package/lib/commonjs/NetworkClient.js +158 -0
- package/lib/commonjs/NetworkClient.js.map +1 -0
- package/lib/commonjs/Respectlytics.js +167 -0
- package/lib/commonjs/Respectlytics.js.map +1 -0
- package/lib/commonjs/SessionManager.js +75 -0
- package/lib/commonjs/SessionManager.js.map +1 -0
- package/lib/commonjs/Storage.js +57 -0
- package/lib/commonjs/Storage.js.map +1 -0
- package/lib/commonjs/index.js +37 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +35 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/EventQueue.js +166 -0
- package/lib/module/EventQueue.js.map +1 -0
- package/lib/module/NetworkClient.js +151 -0
- package/lib/module/NetworkClient.js.map +1 -0
- package/lib/module/Respectlytics.js +162 -0
- package/lib/module/Respectlytics.js.map +1 -0
- package/lib/module/SessionManager.js +68 -0
- package/lib/module/SessionManager.js.map +1 -0
- package/lib/module/Storage.js +50 -0
- package/lib/module/Storage.js.map +1 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +29 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/EventQueue.d.ts +47 -0
- package/lib/typescript/EventQueue.d.ts.map +1 -0
- package/lib/typescript/NetworkClient.d.ts +48 -0
- package/lib/typescript/NetworkClient.d.ts.map +1 -0
- package/lib/typescript/Respectlytics.d.ts +61 -0
- package/lib/typescript/Respectlytics.d.ts.map +1 -0
- package/lib/typescript/SessionManager.d.ts +39 -0
- package/lib/typescript/SessionManager.d.ts.map +1 -0
- package/lib/typescript/Storage.d.ts +26 -0
- package/lib/typescript/Storage.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +18 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +38 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/NetworkClient.ts +1 -1
- package/src/Respectlytics.ts +7 -29
- package/src/SessionManager.ts +24 -20
- package/src/index.ts +8 -1
- package/src/types.ts +5 -2
- package/src/UserManager.ts +0 -74
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respectlytics.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Main entry point for the SDK.
|
|
6
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Platform, Dimensions, NativeModules } from 'react-native';
|
|
10
|
+
import { SessionManager } from './SessionManager';
|
|
11
|
+
import { NetworkClient } from './NetworkClient';
|
|
12
|
+
import { EventQueue } from './EventQueue';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Main entry point for the Respectlytics SDK.
|
|
16
|
+
*
|
|
17
|
+
* v2.0.0 uses session-based analytics only:
|
|
18
|
+
* - Session IDs are generated automatically in RAM
|
|
19
|
+
* - Sessions rotate every 2 hours
|
|
20
|
+
* - New session on every app restart
|
|
21
|
+
* - No persistent user tracking (GDPR/ePrivacy compliant)
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // 1. Configure at app launch
|
|
26
|
+
* Respectlytics.configure('your-api-key');
|
|
27
|
+
*
|
|
28
|
+
* // 2. Track events
|
|
29
|
+
* Respectlytics.track('purchase');
|
|
30
|
+
* Respectlytics.track('view_product', 'ProductScreen');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
class RespectlyticsSDK {
|
|
34
|
+
isConfigured = false;
|
|
35
|
+
constructor() {
|
|
36
|
+
this.networkClient = new NetworkClient();
|
|
37
|
+
this.eventQueue = new EventQueue(this.networkClient);
|
|
38
|
+
this.sessionManager = new SessionManager();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Initialize the SDK with your API key.
|
|
43
|
+
* Call once at app startup.
|
|
44
|
+
*
|
|
45
|
+
* @param apiKey Your Respectlytics API key from the dashboard
|
|
46
|
+
*/
|
|
47
|
+
configure(apiKey) {
|
|
48
|
+
if (!apiKey || apiKey.trim() === '') {
|
|
49
|
+
console.log('[Respectlytics] ⚠️ API key cannot be empty');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.networkClient.configure(apiKey);
|
|
53
|
+
this.eventQueue.start();
|
|
54
|
+
this.isConfigured = true;
|
|
55
|
+
console.log('[Respectlytics] ✓ SDK configured');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Track an event with an optional screen name.
|
|
60
|
+
*
|
|
61
|
+
* The SDK automatically collects privacy-safe metadata:
|
|
62
|
+
* - timestamp, session_id, platform, os_version, app_version, locale
|
|
63
|
+
*
|
|
64
|
+
* @param eventName Name of the event (e.g., "purchase", "button_clicked")
|
|
65
|
+
* @param screen Optional screen name where the event occurred
|
|
66
|
+
*/
|
|
67
|
+
track(eventName, screen) {
|
|
68
|
+
if (!this.isConfigured) {
|
|
69
|
+
console.log('[Respectlytics] ⚠️ SDK not configured. Call configure(apiKey) first.');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!eventName || eventName.trim() === '') {
|
|
73
|
+
console.log('[Respectlytics] ⚠️ Event name cannot be empty');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (eventName.length > 100) {
|
|
77
|
+
console.log('[Respectlytics] ⚠️ Event name too long (max 100 characters)');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const event = this.createEvent(eventName, screen);
|
|
81
|
+
this.eventQueue.add(event);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Force send all queued events immediately.
|
|
86
|
+
* Rarely needed - the SDK auto-flushes every 30 seconds or when the queue reaches 10 events.
|
|
87
|
+
*/
|
|
88
|
+
async flush() {
|
|
89
|
+
await this.eventQueue.flush();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// MARK: - Private Helpers
|
|
93
|
+
|
|
94
|
+
createEvent(eventName, screen) {
|
|
95
|
+
const metadata = this.collectMetadata();
|
|
96
|
+
return {
|
|
97
|
+
eventName,
|
|
98
|
+
timestamp: new Date().toISOString(),
|
|
99
|
+
sessionId: this.sessionManager.getSessionId(),
|
|
100
|
+
screen: screen || null,
|
|
101
|
+
...metadata
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
collectMetadata() {
|
|
105
|
+
// Determine platform
|
|
106
|
+
const platform = Platform.OS === 'ios' ? 'iOS' : 'Android';
|
|
107
|
+
|
|
108
|
+
// Get OS version
|
|
109
|
+
const osVersion = String(Platform.Version);
|
|
110
|
+
|
|
111
|
+
// Get app version - try to get from native modules
|
|
112
|
+
let appVersion = 'unknown';
|
|
113
|
+
try {
|
|
114
|
+
// React Native provides app info through different native modules
|
|
115
|
+
const {
|
|
116
|
+
PlatformConstants
|
|
117
|
+
} = NativeModules;
|
|
118
|
+
if (PlatformConstants?.reactNativeVersion) {
|
|
119
|
+
// This is React Native version, not app version
|
|
120
|
+
// App version should come from the host app
|
|
121
|
+
}
|
|
122
|
+
// For now, use 'unknown' as we can't reliably get app version without additional dependencies
|
|
123
|
+
// In a real app, the developer would configure this
|
|
124
|
+
} catch {
|
|
125
|
+
appVersion = 'unknown';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Get locale
|
|
129
|
+
let locale = 'en_US';
|
|
130
|
+
try {
|
|
131
|
+
// React Native doesn't expose locale directly, but we can get it from platform
|
|
132
|
+
if (Platform.OS === 'ios') {
|
|
133
|
+
locale = NativeModules.SettingsManager?.settings?.AppleLocale || NativeModules.SettingsManager?.settings?.AppleLanguages?.[0] || 'en_US';
|
|
134
|
+
} else {
|
|
135
|
+
locale = NativeModules.I18nManager?.localeIdentifier || 'en_US';
|
|
136
|
+
}
|
|
137
|
+
} catch {
|
|
138
|
+
locale = 'en_US';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Determine device type based on screen size
|
|
142
|
+
const {
|
|
143
|
+
width,
|
|
144
|
+
height
|
|
145
|
+
} = Dimensions.get('window');
|
|
146
|
+
const minDimension = Math.min(width, height);
|
|
147
|
+
const deviceType = minDimension >= 600 ? 'tablet' : 'phone';
|
|
148
|
+
return {
|
|
149
|
+
platform,
|
|
150
|
+
osVersion,
|
|
151
|
+
appVersion,
|
|
152
|
+
locale,
|
|
153
|
+
deviceType
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Export singleton instance
|
|
159
|
+
const Respectlytics = new RespectlyticsSDK();
|
|
160
|
+
export default Respectlytics;
|
|
161
|
+
export { RespectlyticsSDK };
|
|
162
|
+
//# sourceMappingURL=Respectlytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","Dimensions","NativeModules","SessionManager","NetworkClient","EventQueue","RespectlyticsSDK","isConfigured","constructor","networkClient","eventQueue","sessionManager","configure","apiKey","trim","console","log","start","track","eventName","screen","length","event","createEvent","add","flush","metadata","collectMetadata","timestamp","Date","toISOString","sessionId","getSessionId","platform","OS","osVersion","String","Version","appVersion","PlatformConstants","reactNativeVersion","locale","SettingsManager","settings","AppleLocale","AppleLanguages","I18nManager","localeIdentifier","width","height","get","minDimension","Math","min","deviceType","Respectlytics"],"sourceRoot":"../../src","sources":["Respectlytics.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionManager.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Manages session ID generation and rotation.
|
|
6
|
+
* Sessions are stored in RAM only (never persisted) for GDPR/ePrivacy compliance.
|
|
7
|
+
* Sessions automatically rotate every 2 hours.
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Generate a UUID v4 string
|
|
14
|
+
*/
|
|
15
|
+
function generateUUID() {
|
|
16
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
17
|
+
const r = Math.random() * 16 | 0;
|
|
18
|
+
const v = c === 'x' ? r : r & 0x3 | 0x8;
|
|
19
|
+
return v.toString(16);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Manages session ID generation and rotation.
|
|
25
|
+
*
|
|
26
|
+
* Session IDs are:
|
|
27
|
+
* - Generated immediately when the SDK initializes
|
|
28
|
+
* - Stored in RAM only (never persisted to AsyncStorage)
|
|
29
|
+
* - Rotated automatically every 2 hours
|
|
30
|
+
* - Regenerated on every app restart (new instance = new session)
|
|
31
|
+
*
|
|
32
|
+
* This RAM-only approach ensures GDPR/ePrivacy compliance:
|
|
33
|
+
* - No device storage = No consent required under ePrivacy Directive Article 5(3)
|
|
34
|
+
* - Each app launch creates a fresh, unlinked session
|
|
35
|
+
*/
|
|
36
|
+
export class SessionManager {
|
|
37
|
+
// Session ID generated immediately at class instantiation
|
|
38
|
+
sessionId = this.generateSessionId();
|
|
39
|
+
sessionStart = new Date();
|
|
40
|
+
|
|
41
|
+
// 2 hours in milliseconds
|
|
42
|
+
SESSION_TIMEOUT_MS = 2 * 60 * 60 * 1000;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get current session ID, rotating if necessary.
|
|
46
|
+
* Session rotates after 2 hours of continuous use.
|
|
47
|
+
*/
|
|
48
|
+
getSessionId() {
|
|
49
|
+
const now = new Date();
|
|
50
|
+
const elapsed = now.getTime() - this.sessionStart.getTime();
|
|
51
|
+
|
|
52
|
+
// Rotate session after 2 hours
|
|
53
|
+
if (elapsed > this.SESSION_TIMEOUT_MS) {
|
|
54
|
+
this.sessionId = this.generateSessionId();
|
|
55
|
+
this.sessionStart = now;
|
|
56
|
+
}
|
|
57
|
+
return this.sessionId;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Generate a new session ID (32 lowercase hex characters)
|
|
62
|
+
* UUID without dashes, all lowercase
|
|
63
|
+
*/
|
|
64
|
+
generateSessionId() {
|
|
65
|
+
return generateUUID().toLowerCase().replace(/-/g, '');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=SessionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["generateUUID","replace","c","r","Math","random","v","toString","SessionManager","sessionId","generateSessionId","sessionStart","Date","SESSION_TIMEOUT_MS","getSessionId","now","elapsed","getTime","toLowerCase"],"sourceRoot":"../../src","sources":["SessionManager.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,YAAYA,CAAA,EAAW;EAC9B,OAAO,sCAAsC,CAACC,OAAO,CAAC,OAAO,EAAGC,CAAC,IAAK;IACpE,MAAMC,CAAC,GAAIC,IAAI,CAACC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAI,CAAC;IAClC,MAAMC,CAAC,GAAGJ,CAAC,KAAK,GAAG,GAAGC,CAAC,GAAIA,CAAC,GAAG,GAAG,GAAI,GAAG;IACzC,OAAOG,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC;EACvB,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,CAAC;EAC1B;EACQC,SAAS,GAAW,IAAI,CAACC,iBAAiB,CAAC,CAAC;EAC5CC,YAAY,GAAS,IAAIC,IAAI,CAAC,CAAC;;EAEvC;EACiBC,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;;EAExD;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAW;IACrB,MAAMC,GAAG,GAAG,IAAIH,IAAI,CAAC,CAAC;IACtB,MAAMI,OAAO,GAAGD,GAAG,CAACE,OAAO,CAAC,CAAC,GAAG,IAAI,CAACN,YAAY,CAACM,OAAO,CAAC,CAAC;;IAE3D;IACA,IAAID,OAAO,GAAG,IAAI,CAACH,kBAAkB,EAAE;MACrC,IAAI,CAACJ,SAAS,GAAG,IAAI,CAACC,iBAAiB,CAAC,CAAC;MACzC,IAAI,CAACC,YAAY,GAAGI,GAAG;IACzB;IAEA,OAAO,IAAI,CAACN,SAAS;EACvB;;EAEA;AACF;AACA;AACA;EACUC,iBAAiBA,CAAA,EAAW;IAClC,OAAOV,YAAY,CAAC,CAAC,CAACkB,WAAW,CAAC,CAAC,CAACjB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;EACvD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Wrapper around AsyncStorage for persisting SDK data.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Storage wrapper providing typed access to AsyncStorage
|
|
14
|
+
*/
|
|
15
|
+
export class Storage {
|
|
16
|
+
/**
|
|
17
|
+
* Get a string value from storage
|
|
18
|
+
*/
|
|
19
|
+
static async getItem(key) {
|
|
20
|
+
try {
|
|
21
|
+
return await AsyncStorage.getItem(key);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.log(`[Respectlytics] Failed to read from storage: ${key}`);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Set a string value in storage
|
|
30
|
+
*/
|
|
31
|
+
static async setItem(key, value) {
|
|
32
|
+
try {
|
|
33
|
+
await AsyncStorage.setItem(key, value);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.log(`[Respectlytics] Failed to write to storage: ${key}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Remove a value from storage
|
|
41
|
+
*/
|
|
42
|
+
static async removeItem(key) {
|
|
43
|
+
try {
|
|
44
|
+
await AsyncStorage.removeItem(key);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.log(`[Respectlytics] Failed to remove from storage: ${key}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=Storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AsyncStorage","Storage","getItem","key","error","console","log","setItem","value","removeItem"],"sourceRoot":"../../src","sources":["Storage.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,YAAY,MAAM,2CAA2C;;AAEpE;AACA;AACA;AACA,OAAO,MAAMC,OAAO,CAAC;EACnB;AACF;AACA;EACE,aAAaC,OAAOA,CAACC,GAAW,EAA0B;IACxD,IAAI;MACF,OAAO,MAAMH,YAAY,CAACE,OAAO,CAACC,GAAG,CAAC;IACxC,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACC,GAAG,CAAC,gDAAgDH,GAAG,EAAE,CAAC;MAClE,OAAO,IAAI;IACb;EACF;;EAEA;AACF;AACA;EACE,aAAaI,OAAOA,CAACJ,GAAW,EAAEK,KAAa,EAAiB;IAC9D,IAAI;MACF,MAAMR,YAAY,CAACO,OAAO,CAACJ,GAAG,EAAEK,KAAK,CAAC;IACxC,CAAC,CAAC,OAAOJ,KAAK,EAAE;MACdC,OAAO,CAACC,GAAG,CAAC,+CAA+CH,GAAG,EAAE,CAAC;IACnE;EACF;;EAEA;AACF;AACA;EACE,aAAaM,UAAUA,CAACN,GAAW,EAAiB;IAClD,IAAI;MACF,MAAMH,YAAY,CAACS,UAAU,CAACN,GAAG,CAAC;IACpC,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdC,OAAO,CAACC,GAAG,CAAC,kDAAkDH,GAAG,EAAE,CAAC;IACtE;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respectlytics React Native SDK
|
|
3
|
+
*
|
|
4
|
+
* Official SDK for privacy-first, session-based analytics.
|
|
5
|
+
*
|
|
6
|
+
* v2.0.0 Features:
|
|
7
|
+
* - Session-based analytics (no persistent user tracking)
|
|
8
|
+
* - RAM-only session storage (GDPR/ePrivacy compliant)
|
|
9
|
+
* - Automatic 2-hour session rotation
|
|
10
|
+
* - New session on every app restart
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import Respectlytics from './Respectlytics';
|
|
16
|
+
|
|
17
|
+
// Default export - the main SDK instance
|
|
18
|
+
export default Respectlytics;
|
|
19
|
+
|
|
20
|
+
// Named exports for advanced usage
|
|
21
|
+
export { RespectlyticsSDK } from './Respectlytics';
|
|
22
|
+
export { Event } from './types';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Respectlytics","RespectlyticsSDK","Event"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,aAAa,MAAM,iBAAiB;;AAE3C;AACA,eAAeA,aAAa;;AAE5B;AACA,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,KAAK,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
6
|
+
* This SDK is provided under a proprietary license.
|
|
7
|
+
* See LICENSE file for details.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an analytics event - flat structure matching API payload
|
|
12
|
+
*
|
|
13
|
+
* This interface only contains fields accepted by the Respectlytics API.
|
|
14
|
+
* The API uses a strict allowlist for privacy protection.
|
|
15
|
+
* Custom properties are NOT supported - this is by design for privacy.
|
|
16
|
+
*
|
|
17
|
+
* Note: As of v2.0.0, there is no userId field. Session-based analytics only.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Storage keys used by the SDK
|
|
22
|
+
*
|
|
23
|
+
* Note: As of v2.0.0, we only persist the event queue.
|
|
24
|
+
* Session IDs are RAM-only for GDPR/ePrivacy compliance.
|
|
25
|
+
*/
|
|
26
|
+
export const STORAGE_KEYS = {
|
|
27
|
+
EVENT_QUEUE: 'com.respectlytics.eventQueue'
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["STORAGE_KEYS","EVENT_QUEUE"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAG;EAC1BC,WAAW,EAAE;AACf,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventQueue.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Manages event batching, persistence, and automatic flushing.
|
|
6
|
+
* Events are NEVER lost - they are persisted immediately and retried on failure.
|
|
7
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
import { Event } from './types';
|
|
10
|
+
import { NetworkClient } from './NetworkClient';
|
|
11
|
+
export declare class EventQueue {
|
|
12
|
+
private events;
|
|
13
|
+
private isOnline;
|
|
14
|
+
private flushTimer;
|
|
15
|
+
private networkClient;
|
|
16
|
+
private isFlushing;
|
|
17
|
+
private unsubscribeNetInfo;
|
|
18
|
+
private appStateSubscription;
|
|
19
|
+
constructor(networkClient: NetworkClient);
|
|
20
|
+
/**
|
|
21
|
+
* Initialize the queue - load persisted events and set up listeners
|
|
22
|
+
*/
|
|
23
|
+
start(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Stop the queue and clean up resources
|
|
26
|
+
*/
|
|
27
|
+
stop(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Add an event to the queue
|
|
30
|
+
* CRITICAL: Events are persisted IMMEDIATELY before any async operations
|
|
31
|
+
*/
|
|
32
|
+
add(event: Event): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Force flush all queued events
|
|
35
|
+
*/
|
|
36
|
+
flush(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Get current queue size (for testing)
|
|
39
|
+
*/
|
|
40
|
+
getQueueSize(): number;
|
|
41
|
+
private scheduleFlush;
|
|
42
|
+
private setupNetworkMonitor;
|
|
43
|
+
private setupAppStateMonitor;
|
|
44
|
+
private persistQueue;
|
|
45
|
+
private loadPersistedQueue;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=EventQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventQueue.d.ts","sourceRoot":"","sources":["../../src/EventQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,oBAAoB,CAAuC;gBAEvD,aAAa,EAAE,aAAa;IAIxC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B;;OAEG;IACH,IAAI,IAAI,IAAI;IAeZ;;;OAGG;IACG,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAYtC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC5B;;OAEG;IACH,YAAY,IAAI,MAAM;IAMtB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,oBAAoB;YAYd,YAAY;YAQZ,kBAAkB;CAejC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetworkClient.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Handles HTTP communication with the Respectlytics API.
|
|
6
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
import { Event } from './types';
|
|
9
|
+
export declare enum NetworkError {
|
|
10
|
+
NotConfigured = "NOT_CONFIGURED",
|
|
11
|
+
InvalidResponse = "INVALID_RESPONSE",
|
|
12
|
+
Unauthorized = "UNAUTHORIZED",
|
|
13
|
+
BadRequest = "BAD_REQUEST",
|
|
14
|
+
RateLimited = "RATE_LIMITED",
|
|
15
|
+
ServerError = "SERVER_ERROR",
|
|
16
|
+
NetworkError = "NETWORK_ERROR",
|
|
17
|
+
Timeout = "TIMEOUT"
|
|
18
|
+
}
|
|
19
|
+
export declare class NetworkClient {
|
|
20
|
+
private apiKey;
|
|
21
|
+
/**
|
|
22
|
+
* Configure the network client with an API key
|
|
23
|
+
*/
|
|
24
|
+
configure(apiKey: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check if the client is configured
|
|
27
|
+
*/
|
|
28
|
+
isConfigured(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Send events to the API
|
|
31
|
+
*/
|
|
32
|
+
send(events: Event[]): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Send a single event with retry logic
|
|
35
|
+
*/
|
|
36
|
+
private sendEvent;
|
|
37
|
+
/**
|
|
38
|
+
* Convert Event object to API payload format
|
|
39
|
+
* Note: As of v2.0.0, no user_id field is sent (session-based analytics only)
|
|
40
|
+
*/
|
|
41
|
+
private eventToPayload;
|
|
42
|
+
/**
|
|
43
|
+
* Helper to delay for exponential backoff
|
|
44
|
+
*/
|
|
45
|
+
private delay;
|
|
46
|
+
}
|
|
47
|
+
export declare const networkClient: NetworkClient;
|
|
48
|
+
//# sourceMappingURL=NetworkClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkClient.d.ts","sourceRoot":"","sources":["../../src/NetworkClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMhC,oBAAY,YAAY;IACtB,aAAa,mBAAmB;IAChC,eAAe,qBAAqB;IACpC,YAAY,iBAAiB;IAC7B,UAAU,gBAAgB;IAC1B,WAAW,iBAAiB;IAC5B,WAAW,iBAAiB;IAC5B,YAAY,kBAAkB;IAC9B,OAAO,YAAY;CACpB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAuB;IAErC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAU1C;;OAEG;YACW,SAAS;IAgFvB;;;OAGG;IACH,OAAO,CAAC,cAAc;IActB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respectlytics.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Main entry point for the SDK.
|
|
6
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Main entry point for the Respectlytics SDK.
|
|
10
|
+
*
|
|
11
|
+
* v2.0.0 uses session-based analytics only:
|
|
12
|
+
* - Session IDs are generated automatically in RAM
|
|
13
|
+
* - Sessions rotate every 2 hours
|
|
14
|
+
* - New session on every app restart
|
|
15
|
+
* - No persistent user tracking (GDPR/ePrivacy compliant)
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // 1. Configure at app launch
|
|
20
|
+
* Respectlytics.configure('your-api-key');
|
|
21
|
+
*
|
|
22
|
+
* // 2. Track events
|
|
23
|
+
* Respectlytics.track('purchase');
|
|
24
|
+
* Respectlytics.track('view_product', 'ProductScreen');
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare class RespectlyticsSDK {
|
|
28
|
+
private isConfigured;
|
|
29
|
+
private networkClient;
|
|
30
|
+
private eventQueue;
|
|
31
|
+
private sessionManager;
|
|
32
|
+
constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the SDK with your API key.
|
|
35
|
+
* Call once at app startup.
|
|
36
|
+
*
|
|
37
|
+
* @param apiKey Your Respectlytics API key from the dashboard
|
|
38
|
+
*/
|
|
39
|
+
configure(apiKey: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Track an event with an optional screen name.
|
|
42
|
+
*
|
|
43
|
+
* The SDK automatically collects privacy-safe metadata:
|
|
44
|
+
* - timestamp, session_id, platform, os_version, app_version, locale
|
|
45
|
+
*
|
|
46
|
+
* @param eventName Name of the event (e.g., "purchase", "button_clicked")
|
|
47
|
+
* @param screen Optional screen name where the event occurred
|
|
48
|
+
*/
|
|
49
|
+
track(eventName: string, screen?: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Force send all queued events immediately.
|
|
52
|
+
* Rarely needed - the SDK auto-flushes every 30 seconds or when the queue reaches 10 events.
|
|
53
|
+
*/
|
|
54
|
+
flush(): Promise<void>;
|
|
55
|
+
private createEvent;
|
|
56
|
+
private collectMetadata;
|
|
57
|
+
}
|
|
58
|
+
declare const Respectlytics: RespectlyticsSDK;
|
|
59
|
+
export default Respectlytics;
|
|
60
|
+
export { RespectlyticsSDK };
|
|
61
|
+
//# sourceMappingURL=Respectlytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Respectlytics.d.ts","sourceRoot":"","sources":["../../src/Respectlytics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH;;;;;;;;;;;;;;;;;;GAkBG;AACH,cAAM,gBAAgB;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAiB;;IAQvC;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAa/B;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAoB/C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,eAAe;CAwDxB;AAGD,QAAA,MAAM,aAAa,kBAAyB,CAAC;AAC7C,eAAe,aAAa,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SessionManager.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Manages session ID generation and rotation.
|
|
6
|
+
* Sessions are stored in RAM only (never persisted) for GDPR/ePrivacy compliance.
|
|
7
|
+
* Sessions automatically rotate every 2 hours.
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Manages session ID generation and rotation.
|
|
13
|
+
*
|
|
14
|
+
* Session IDs are:
|
|
15
|
+
* - Generated immediately when the SDK initializes
|
|
16
|
+
* - Stored in RAM only (never persisted to AsyncStorage)
|
|
17
|
+
* - Rotated automatically every 2 hours
|
|
18
|
+
* - Regenerated on every app restart (new instance = new session)
|
|
19
|
+
*
|
|
20
|
+
* This RAM-only approach ensures GDPR/ePrivacy compliance:
|
|
21
|
+
* - No device storage = No consent required under ePrivacy Directive Article 5(3)
|
|
22
|
+
* - Each app launch creates a fresh, unlinked session
|
|
23
|
+
*/
|
|
24
|
+
export declare class SessionManager {
|
|
25
|
+
private sessionId;
|
|
26
|
+
private sessionStart;
|
|
27
|
+
private readonly SESSION_TIMEOUT_MS;
|
|
28
|
+
/**
|
|
29
|
+
* Get current session ID, rotating if necessary.
|
|
30
|
+
* Session rotates after 2 hours of continuous use.
|
|
31
|
+
*/
|
|
32
|
+
getSessionId(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Generate a new session ID (32 lowercase hex characters)
|
|
35
|
+
* UUID without dashes, all lowercase
|
|
36
|
+
*/
|
|
37
|
+
private generateSessionId;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=SessionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionManager.d.ts","sourceRoot":"","sources":["../../src/SessionManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;IAEzB,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,YAAY,CAAoB;IAGxC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;IAEzD;;;OAGG;IACH,YAAY,IAAI,MAAM;IAatB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Wrapper around AsyncStorage for persisting SDK data.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Storage wrapper providing typed access to AsyncStorage
|
|
11
|
+
*/
|
|
12
|
+
export declare class Storage {
|
|
13
|
+
/**
|
|
14
|
+
* Get a string value from storage
|
|
15
|
+
*/
|
|
16
|
+
static getItem(key: string): Promise<string | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Set a string value in storage
|
|
19
|
+
*/
|
|
20
|
+
static setItem(key: string, value: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Remove a value from storage
|
|
23
|
+
*/
|
|
24
|
+
static removeItem(key: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=Storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../src/Storage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,qBAAa,OAAO;IAClB;;OAEG;WACU,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IASzD;;OAEG;WACU,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/D;;OAEG;WACU,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOpD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Respectlytics React Native SDK
|
|
3
|
+
*
|
|
4
|
+
* Official SDK for privacy-first, session-based analytics.
|
|
5
|
+
*
|
|
6
|
+
* v2.0.0 Features:
|
|
7
|
+
* - Session-based analytics (no persistent user tracking)
|
|
8
|
+
* - RAM-only session storage (GDPR/ePrivacy compliant)
|
|
9
|
+
* - Automatic 2-hour session rotation
|
|
10
|
+
* - New session on every app restart
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
13
|
+
*/
|
|
14
|
+
import Respectlytics from './Respectlytics';
|
|
15
|
+
export default Respectlytics;
|
|
16
|
+
export { RespectlyticsSDK } from './Respectlytics';
|
|
17
|
+
export { Event } from './types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,eAAe,aAAa,CAAC;AAG7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts
|
|
3
|
+
* Respectlytics React Native SDK
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2025 Respectlytics. All rights reserved.
|
|
6
|
+
* This SDK is provided under a proprietary license.
|
|
7
|
+
* See LICENSE file for details.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Represents an analytics event - flat structure matching API payload
|
|
11
|
+
*
|
|
12
|
+
* This interface only contains fields accepted by the Respectlytics API.
|
|
13
|
+
* The API uses a strict allowlist for privacy protection.
|
|
14
|
+
* Custom properties are NOT supported - this is by design for privacy.
|
|
15
|
+
*
|
|
16
|
+
* Note: As of v2.0.0, there is no userId field. Session-based analytics only.
|
|
17
|
+
*/
|
|
18
|
+
export interface Event {
|
|
19
|
+
eventName: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
screen: string | null;
|
|
23
|
+
platform: string;
|
|
24
|
+
osVersion: string;
|
|
25
|
+
appVersion: string;
|
|
26
|
+
locale: string;
|
|
27
|
+
deviceType: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Storage keys used by the SDK
|
|
31
|
+
*
|
|
32
|
+
* Note: As of v2.0.0, we only persist the event queue.
|
|
33
|
+
* Session IDs are RAM-only for GDPR/ePrivacy compliance.
|
|
34
|
+
*/
|
|
35
|
+
export declare const STORAGE_KEYS: {
|
|
36
|
+
readonly EVENT_QUEUE: "com.respectlytics.eventQueue";
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;CAEf,CAAC"}
|