nana800-analytics 1.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/LICENSE +22 -0
- package/README.md +158 -0
- package/dist/BekenderAnalytics.d.ts +136 -0
- package/dist/Nana800Analytics.d.ts +136 -0
- package/dist/api/ApiClient.d.ts +13 -0
- package/dist/bekender-analytics.js +3210 -0
- package/dist/bekender-analytics.min.js +6 -0
- package/dist/constants.d.ts +6 -0
- package/dist/index.d.ts +29 -0
- package/dist/main.cjs.js +3079 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.esm.js +3062 -0
- package/dist/platform/PlatformDetector.d.ts +14 -0
- package/dist/storage/StorageManager.d.ts +15 -0
- package/dist/types.d.ts +132 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bekender
|
|
4
|
+
|
|
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:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
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.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Nana800 Analytics from NANA800.io 📊
|
|
2
|
+
|
|
3
|
+
Official JavaScript/TypeScript SDK for Nana800 Analytics - a powerful analytics and telemetry service similar to Amplitude.
|
|
4
|
+
|
|
5
|
+
Track events, identify users, and analyze behavior in your web applications with ease. Nana800 Analytics provides a simple, reliable, and cost-effective alternative to services like Amplitude, Mixpanel, and Google Analytics.
|
|
6
|
+
|
|
7
|
+
### Detail Documentation
|
|
8
|
+
|
|
9
|
+
[NANA800 Documentation 📊](https://nana800.gitbook.io/doc)
|
|
10
|
+
|
|
11
|
+
[Analytics Dashboard](https://cloud.nana800.io/analytics)
|
|
12
|
+
|
|
13
|
+
### Why Nana800 Analytics?
|
|
14
|
+
|
|
15
|
+
- 🚀 **Fast & Lightweight** - Minimal bundle size, maximum performance
|
|
16
|
+
- 💰 **Cost-Effective** - Affordable pricing compared to alternatives
|
|
17
|
+
- 🔒 **Privacy-Focused** - Your data stays on your infrastructure
|
|
18
|
+
- 📊 **Powerful Insights** - Real-time analytics and user behavior tracking
|
|
19
|
+
- 🛠 **Easy Integration** - Simple API, works with any JavaScript framework
|
|
20
|
+
- 🌍 **Self-Hosted Option** - Full control over your analytics data
|
|
21
|
+
- 🔧 **Cross-Platform** - Works on Web, React Native, Node.js, Electron, and more
|
|
22
|
+
|
|
23
|
+
## Supported Platforms
|
|
24
|
+
|
|
25
|
+
| Platform | Support | Storage | Notes |
|
|
26
|
+
|----------|---------|---------|-------|
|
|
27
|
+
| 🌐 **Web (Browser)** | ✅ Full | localStorage | Works out of the box |
|
|
28
|
+
| ⚛️ **React Native** | ✅ Full | AsyncStorage | Requires AsyncStorage adapter |
|
|
29
|
+
| 🖥 **Electron** | ✅ Full | localStorage | Auto-detected |
|
|
30
|
+
| 🟢 **Node.js** | ✅ Full | Memory only | Server-side tracking |
|
|
31
|
+
| ⚡️ **Next.js** | ✅ Full | localStorage | SSR compatible |
|
|
32
|
+
| 📱 **Expo** | ✅ Full | AsyncStorage | Same as React Native |
|
|
33
|
+
| 🎯 **Vue.js** | ✅ Full | localStorage | Works as standard web |
|
|
34
|
+
| ⚙️ **Angular** | ✅ Full | localStorage | Works as standard web |
|
|
35
|
+
| 🔷 **TypeScript** | ✅ Full | - | Full type definitions included |
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install nana800-analytics
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
or
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
yarn add nana800-analytics
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### Web / Next.js / Browser
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { createNana800Analytics } from 'nana800-analytics';
|
|
55
|
+
|
|
56
|
+
const analytics = createNana800Analytics({
|
|
57
|
+
apiKey: 'your-api-key',
|
|
58
|
+
appProjectId: 'your-project-id',
|
|
59
|
+
flushIntervalMs: 20000,
|
|
60
|
+
debug: false,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
analytics.track('page_view', { page: '/home' });
|
|
64
|
+
|
|
65
|
+
analytics.identify('user123', {
|
|
66
|
+
name: 'John Doe',
|
|
67
|
+
email: 'john@example.com',
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### React Native / Expo
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { createNana800Analytics } from 'nana800-analytics';
|
|
75
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
76
|
+
|
|
77
|
+
const analytics = createNana800Analytics({
|
|
78
|
+
apiKey: 'your-api-key',
|
|
79
|
+
appProjectId: 'your-project-id',
|
|
80
|
+
storageAdapter: AsyncStorage,
|
|
81
|
+
flushIntervalMs: 20000,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
analytics.track('app_opened', { platform: 'ios' });
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Node.js (Server-side)
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { createNana800Analytics } from 'nana800-analytics';
|
|
91
|
+
|
|
92
|
+
const analytics = createNana800Analytics({
|
|
93
|
+
apiKey: 'your-api-key',
|
|
94
|
+
appProjectId: 'your-project-id',
|
|
95
|
+
disableStorage: true,
|
|
96
|
+
flushIntervalMs: 10000,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
analytics.track('api_request', { endpoint: '/api/users' });
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Configuration
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
interface Nana800AnalyticsConfig {
|
|
106
|
+
apiKey: string;
|
|
107
|
+
appProjectId: string;
|
|
108
|
+
baseUrl?: string; // default: https://api.analytics.nana800.io
|
|
109
|
+
flushIntervalMs?: number; // default: 20000
|
|
110
|
+
maxBatchSize?: number; // default: 100
|
|
111
|
+
enableAutoFlush?: boolean; // default: true
|
|
112
|
+
storageAdapter?: StorageAdapter;
|
|
113
|
+
disableStorage?: boolean;
|
|
114
|
+
debug?: boolean; // default: false
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## API Reference
|
|
119
|
+
|
|
120
|
+
### `createNana800Analytics(config)`
|
|
121
|
+
Creates and initializes a new analytics instance.
|
|
122
|
+
|
|
123
|
+
### `track(eventName, properties?, userId?)`
|
|
124
|
+
Tracks an analytics event.
|
|
125
|
+
|
|
126
|
+
### `identify(userId, properties?)`
|
|
127
|
+
Sets the current user and updates user properties.
|
|
128
|
+
|
|
129
|
+
### `setUserProperties(userId, properties)`
|
|
130
|
+
Updates user properties.
|
|
131
|
+
|
|
132
|
+
### `flush()`
|
|
133
|
+
Manually sends all pending events.
|
|
134
|
+
|
|
135
|
+
### `destroy()`
|
|
136
|
+
Stops automatic flushing and cleans up resources.
|
|
137
|
+
|
|
138
|
+
## FAQ
|
|
139
|
+
|
|
140
|
+
### Where is the API key?
|
|
141
|
+
Get your API key from [https://cloud.nana800.io/settings](https://cloud.nana800.io/settings)
|
|
142
|
+
|
|
143
|
+
### Where is the "app_project_id"?
|
|
144
|
+
Create an analytics project at [https://cloud.nana800.io/analytics](https://cloud.nana800.io/analytics)
|
|
145
|
+
|
|
146
|
+
## Contacts
|
|
147
|
+
|
|
148
|
+
No-Code & Business & Analytics Cloud Platform [NANA800.io](https://nana800.io)
|
|
149
|
+
|
|
150
|
+
Platform Console [CLOUD.NANA800.io](https://cloud.nana800.io)
|
|
151
|
+
|
|
152
|
+
Platform Documentation [NANA800 Documentation](https://nana800.gitbook.io/doc)
|
|
153
|
+
|
|
154
|
+
Support Email: support@nana800.io
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { BekenderAnalyticsConfig, BekenderAnalyticsEventProperties } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* BekenderAnalytics SDK class for tracking events and user properties
|
|
4
|
+
*
|
|
5
|
+
* Works across multiple platforms: Web, React Native, Node.js, Electron, Next.js
|
|
6
|
+
*
|
|
7
|
+
* @internal Use createBekenderAnalytics() instead of instantiating directly
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createBekenderAnalytics } from 'bekender-analytics';
|
|
12
|
+
*
|
|
13
|
+
* // Browser / Next.js
|
|
14
|
+
* const analytics = createBekenderAnalytics({
|
|
15
|
+
* apiKey: 'your-api-key',
|
|
16
|
+
* appProjectId: 'your-project-id',
|
|
17
|
+
* debug: false
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // React Native
|
|
21
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
22
|
+
* const analytics = createBekenderAnalytics({
|
|
23
|
+
* apiKey: 'your-api-key',
|
|
24
|
+
* appProjectId: 'your-project-id',
|
|
25
|
+
* storageAdapter: AsyncStorage
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Start tracking immediately - no init() needed!
|
|
29
|
+
* analytics.track('page_view', { page: '/home' });
|
|
30
|
+
* analytics.identify('user123', { email: 'user@example.com' });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class BekenderAnalytics {
|
|
34
|
+
private config;
|
|
35
|
+
private eventsQueue;
|
|
36
|
+
private userPropsQueue;
|
|
37
|
+
private flushIntervalId;
|
|
38
|
+
private initialFlushTimeoutId;
|
|
39
|
+
private isInitialized;
|
|
40
|
+
private currentUserId;
|
|
41
|
+
private storageManager;
|
|
42
|
+
private apiClient;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new BekenderAnalytics instance
|
|
45
|
+
*
|
|
46
|
+
* @param config - Configuration options for the analytics SDK
|
|
47
|
+
*/
|
|
48
|
+
constructor(config: BekenderAnalyticsConfig);
|
|
49
|
+
/**
|
|
50
|
+
* Initializes the analytics SDK and starts automatic event flushing
|
|
51
|
+
*
|
|
52
|
+
* @returns true if initialization was successful
|
|
53
|
+
*/
|
|
54
|
+
init(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Tracks an analytics event
|
|
57
|
+
*
|
|
58
|
+
* @param eventName - Name of the event to track
|
|
59
|
+
* @param properties - Optional event properties as key-value pairs
|
|
60
|
+
* @param userId - Optional user identifier (uses current user if not provided)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* analytics.track('button_clicked', { button_id: 'signup_btn' });
|
|
65
|
+
* analytics.track('page_view', { page: '/dashboard' }, 'user123');
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
track(eventName: string, properties?: BekenderAnalyticsEventProperties, userId?: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the current user identifier and optionally updates user properties
|
|
71
|
+
*
|
|
72
|
+
* @param userId - User identifier
|
|
73
|
+
* @param properties - Optional user properties to update
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* analytics.identify('user123', { name: 'John Doe', email: 'john@example.com' });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
identify(userId: string, properties?: BekenderAnalyticsEventProperties): void;
|
|
81
|
+
/**
|
|
82
|
+
* Updates user properties without changing the current user
|
|
83
|
+
*
|
|
84
|
+
* @param userId - User identifier
|
|
85
|
+
* @param properties - User properties to update
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* analytics.setUserProperties('user123', { subscription: 'premium' });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
setUserProperties(userId: string, properties: BekenderAnalyticsEventProperties): void;
|
|
93
|
+
/**
|
|
94
|
+
* Manually flushes all pending events and user properties to the server
|
|
95
|
+
*
|
|
96
|
+
* @returns Promise that resolves when flush is complete
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* await analytics.flush();
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
flush(): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Clears the current user identifier
|
|
106
|
+
*/
|
|
107
|
+
reset(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Stops automatic event flushing and clears the interval
|
|
110
|
+
*/
|
|
111
|
+
destroy(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Gets the current user identifier
|
|
114
|
+
*
|
|
115
|
+
* @returns Current user ID or null if not set
|
|
116
|
+
*/
|
|
117
|
+
getUserId(): string | null;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the number of pending events in the queue
|
|
120
|
+
*
|
|
121
|
+
* @returns Number of pending events
|
|
122
|
+
*/
|
|
123
|
+
getPendingEventsCount(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Gets the number of pending user property updates in the queue
|
|
126
|
+
*
|
|
127
|
+
* @returns Number of pending user property updates
|
|
128
|
+
*/
|
|
129
|
+
getPendingUserPropsCount(): number;
|
|
130
|
+
private startAutoFlush;
|
|
131
|
+
private sendEvents;
|
|
132
|
+
private sendUserProperties;
|
|
133
|
+
private saveToStorage;
|
|
134
|
+
private loadFromStorage;
|
|
135
|
+
private log;
|
|
136
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Nana800AnalyticsConfig, Nana800AnalyticsEventProperties } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Nana800Analytics SDK class for tracking events and user properties
|
|
4
|
+
*
|
|
5
|
+
* Works across multiple platforms: Web, React Native, Node.js, Electron, Next.js
|
|
6
|
+
*
|
|
7
|
+
* @internal Use createNana800Analytics() instead of instantiating directly
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createNana800Analytics } from 'nana800-analytics';
|
|
12
|
+
*
|
|
13
|
+
* // Browser / Next.js
|
|
14
|
+
* const analytics = createNana800Analytics({
|
|
15
|
+
* apiKey: 'your-api-key',
|
|
16
|
+
* appProjectId: 'your-project-id',
|
|
17
|
+
* debug: false
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // React Native
|
|
21
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
22
|
+
* const analytics = createNana800Analytics({
|
|
23
|
+
* apiKey: 'your-api-key',
|
|
24
|
+
* appProjectId: 'your-project-id',
|
|
25
|
+
* storageAdapter: AsyncStorage
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Start tracking immediately - no init() needed!
|
|
29
|
+
* analytics.track('page_view', { page: '/home' });
|
|
30
|
+
* analytics.identify('user123', { email: 'user@example.com' });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class Nana800Analytics {
|
|
34
|
+
private config;
|
|
35
|
+
private eventsQueue;
|
|
36
|
+
private userPropsQueue;
|
|
37
|
+
private flushIntervalId;
|
|
38
|
+
private initialFlushTimeoutId;
|
|
39
|
+
private isInitialized;
|
|
40
|
+
private currentUserId;
|
|
41
|
+
private storageManager;
|
|
42
|
+
private apiClient;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new Nana800Analytics instance
|
|
45
|
+
*
|
|
46
|
+
* @param config - Configuration options for the analytics SDK
|
|
47
|
+
*/
|
|
48
|
+
constructor(config: Nana800AnalyticsConfig);
|
|
49
|
+
/**
|
|
50
|
+
* Initializes the analytics SDK and starts automatic event flushing
|
|
51
|
+
*
|
|
52
|
+
* @returns true if initialization was successful
|
|
53
|
+
*/
|
|
54
|
+
init(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Tracks an analytics event
|
|
57
|
+
*
|
|
58
|
+
* @param eventName - Name of the event to track
|
|
59
|
+
* @param properties - Optional event properties as key-value pairs
|
|
60
|
+
* @param userId - Optional user identifier (uses current user if not provided)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* analytics.track('button_clicked', { button_id: 'signup_btn' });
|
|
65
|
+
* analytics.track('page_view', { page: '/dashboard' }, 'user123');
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
track(eventName: string, properties?: Nana800AnalyticsEventProperties, userId?: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the current user identifier and optionally updates user properties
|
|
71
|
+
*
|
|
72
|
+
* @param userId - User identifier
|
|
73
|
+
* @param properties - Optional user properties to update
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* analytics.identify('user123', { name: 'John Doe', email: 'john@example.com' });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
identify(userId: string, properties?: Nana800AnalyticsEventProperties): void;
|
|
81
|
+
/**
|
|
82
|
+
* Updates user properties without changing the current user
|
|
83
|
+
*
|
|
84
|
+
* @param userId - User identifier
|
|
85
|
+
* @param properties - User properties to update
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* analytics.setUserProperties('user123', { subscription: 'premium' });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
setUserProperties(userId: string, properties: Nana800AnalyticsEventProperties): void;
|
|
93
|
+
/**
|
|
94
|
+
* Manually flushes all pending events and user properties to the server
|
|
95
|
+
*
|
|
96
|
+
* @returns Promise that resolves when flush is complete
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* await analytics.flush();
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
flush(): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Clears the current user identifier
|
|
106
|
+
*/
|
|
107
|
+
reset(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Stops automatic event flushing and clears the interval
|
|
110
|
+
*/
|
|
111
|
+
destroy(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Gets the current user identifier
|
|
114
|
+
*
|
|
115
|
+
* @returns Current user ID or null if not set
|
|
116
|
+
*/
|
|
117
|
+
getUserId(): string | null;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the number of pending events in the queue
|
|
120
|
+
*
|
|
121
|
+
* @returns Number of pending events
|
|
122
|
+
*/
|
|
123
|
+
getPendingEventsCount(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Gets the number of pending user property updates in the queue
|
|
126
|
+
*
|
|
127
|
+
* @returns Number of pending user property updates
|
|
128
|
+
*/
|
|
129
|
+
getPendingUserPropsCount(): number;
|
|
130
|
+
private startAutoFlush;
|
|
131
|
+
private sendEvents;
|
|
132
|
+
private sendUserProperties;
|
|
133
|
+
private saveToStorage;
|
|
134
|
+
private loadFromStorage;
|
|
135
|
+
private log;
|
|
136
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Nana800AnalyticsEvent, Nana800AnalyticsUserIdentity, Nana800AnalyticsApiResponse } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Handles API communication with the analytics backend
|
|
4
|
+
*/
|
|
5
|
+
export declare class ApiClient {
|
|
6
|
+
private axiosClient;
|
|
7
|
+
private apiKey;
|
|
8
|
+
private appProjectId;
|
|
9
|
+
constructor(baseUrl: string, apiKey: string, appProjectId: string);
|
|
10
|
+
sendEvents(events: Nana800AnalyticsEvent[]): Promise<Nana800AnalyticsApiResponse>;
|
|
11
|
+
sendUserProperties(userProps: Nana800AnalyticsUserIdentity[]): Promise<Nana800AnalyticsApiResponse>;
|
|
12
|
+
private extractData;
|
|
13
|
+
}
|