@junobuild/analytics 0.1.6 → 0.1.7-next-2025-04-06
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.
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export const idlFactory = ({IDL}) => {
|
|
3
|
+
const DeleteControllersArgs = IDL.Record({
|
|
4
|
+
controllers: IDL.Vec(IDL.Principal)
|
|
5
|
+
});
|
|
6
|
+
const ControllerScope = IDL.Variant({
|
|
7
|
+
Write: IDL.Null,
|
|
8
|
+
Admin: IDL.Null
|
|
9
|
+
});
|
|
10
|
+
const Controller = IDL.Record({
|
|
11
|
+
updated_at: IDL.Nat64,
|
|
12
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
13
|
+
created_at: IDL.Nat64,
|
|
14
|
+
scope: ControllerScope,
|
|
15
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
16
|
+
});
|
|
17
|
+
const DelSatelliteConfig = IDL.Record({version: IDL.Opt(IDL.Nat64)});
|
|
18
|
+
const DepositCyclesArgs = IDL.Record({
|
|
19
|
+
cycles: IDL.Nat,
|
|
20
|
+
destination_id: IDL.Principal
|
|
21
|
+
});
|
|
22
|
+
const GetAnalytics = IDL.Record({
|
|
23
|
+
to: IDL.Opt(IDL.Nat64),
|
|
24
|
+
from: IDL.Opt(IDL.Nat64),
|
|
25
|
+
satellite_id: IDL.Opt(IDL.Principal)
|
|
26
|
+
});
|
|
27
|
+
const AnalyticKey = IDL.Record({
|
|
28
|
+
key: IDL.Text,
|
|
29
|
+
collected_at: IDL.Nat64
|
|
30
|
+
});
|
|
31
|
+
const PageViewDevice = IDL.Record({
|
|
32
|
+
inner_height: IDL.Nat16,
|
|
33
|
+
inner_width: IDL.Nat16
|
|
34
|
+
});
|
|
35
|
+
const PageView = IDL.Record({
|
|
36
|
+
title: IDL.Text,
|
|
37
|
+
updated_at: IDL.Nat64,
|
|
38
|
+
referrer: IDL.Opt(IDL.Text),
|
|
39
|
+
time_zone: IDL.Text,
|
|
40
|
+
session_id: IDL.Text,
|
|
41
|
+
href: IDL.Text,
|
|
42
|
+
created_at: IDL.Nat64,
|
|
43
|
+
satellite_id: IDL.Principal,
|
|
44
|
+
device: PageViewDevice,
|
|
45
|
+
version: IDL.Opt(IDL.Nat64),
|
|
46
|
+
user_agent: IDL.Opt(IDL.Text)
|
|
47
|
+
});
|
|
48
|
+
const AnalyticsBrowsersPageViews = IDL.Record({
|
|
49
|
+
safari: IDL.Float64,
|
|
50
|
+
opera: IDL.Float64,
|
|
51
|
+
others: IDL.Float64,
|
|
52
|
+
firefox: IDL.Float64,
|
|
53
|
+
chrome: IDL.Float64
|
|
54
|
+
});
|
|
55
|
+
const AnalyticsDevicesPageViews = IDL.Record({
|
|
56
|
+
desktop: IDL.Float64,
|
|
57
|
+
others: IDL.Float64,
|
|
58
|
+
mobile: IDL.Float64
|
|
59
|
+
});
|
|
60
|
+
const AnalyticsClientsPageViews = IDL.Record({
|
|
61
|
+
browsers: AnalyticsBrowsersPageViews,
|
|
62
|
+
devices: AnalyticsDevicesPageViews
|
|
63
|
+
});
|
|
64
|
+
const CalendarDate = IDL.Record({
|
|
65
|
+
day: IDL.Nat8,
|
|
66
|
+
month: IDL.Nat8,
|
|
67
|
+
year: IDL.Int32
|
|
68
|
+
});
|
|
69
|
+
const AnalyticsMetricsPageViews = IDL.Record({
|
|
70
|
+
bounce_rate: IDL.Float64,
|
|
71
|
+
average_page_views_per_session: IDL.Float64,
|
|
72
|
+
daily_total_page_views: IDL.Vec(IDL.Tuple(CalendarDate, IDL.Nat32)),
|
|
73
|
+
total_page_views: IDL.Nat32,
|
|
74
|
+
unique_page_views: IDL.Nat64,
|
|
75
|
+
unique_sessions: IDL.Nat64
|
|
76
|
+
});
|
|
77
|
+
const AnalyticsTop10PageViews = IDL.Record({
|
|
78
|
+
referrers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32)),
|
|
79
|
+
pages: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
|
|
80
|
+
});
|
|
81
|
+
const NavigationType = IDL.Variant({
|
|
82
|
+
Navigate: IDL.Null,
|
|
83
|
+
Restore: IDL.Null,
|
|
84
|
+
Reload: IDL.Null,
|
|
85
|
+
BackForward: IDL.Null,
|
|
86
|
+
BackForwardCache: IDL.Null,
|
|
87
|
+
Prerender: IDL.Null
|
|
88
|
+
});
|
|
89
|
+
const WebVitalsMetric = IDL.Record({
|
|
90
|
+
id: IDL.Text,
|
|
91
|
+
value: IDL.Float64,
|
|
92
|
+
navigation_type: IDL.Opt(NavigationType),
|
|
93
|
+
delta: IDL.Float64
|
|
94
|
+
});
|
|
95
|
+
const PerformanceData = IDL.Variant({WebVitalsMetric: WebVitalsMetric});
|
|
96
|
+
const PerformanceMetricName = IDL.Variant({
|
|
97
|
+
CLS: IDL.Null,
|
|
98
|
+
FCP: IDL.Null,
|
|
99
|
+
INP: IDL.Null,
|
|
100
|
+
LCP: IDL.Null,
|
|
101
|
+
TTFB: IDL.Null
|
|
102
|
+
});
|
|
103
|
+
const PerformanceMetric = IDL.Record({
|
|
104
|
+
updated_at: IDL.Nat64,
|
|
105
|
+
session_id: IDL.Text,
|
|
106
|
+
data: PerformanceData,
|
|
107
|
+
href: IDL.Text,
|
|
108
|
+
metric_name: PerformanceMetricName,
|
|
109
|
+
created_at: IDL.Nat64,
|
|
110
|
+
satellite_id: IDL.Principal,
|
|
111
|
+
version: IDL.Opt(IDL.Nat64)
|
|
112
|
+
});
|
|
113
|
+
const AnalyticsWebVitalsPageMetrics = IDL.Record({
|
|
114
|
+
cls: IDL.Opt(IDL.Float64),
|
|
115
|
+
fcp: IDL.Opt(IDL.Float64),
|
|
116
|
+
inp: IDL.Opt(IDL.Float64),
|
|
117
|
+
lcp: IDL.Opt(IDL.Float64),
|
|
118
|
+
ttfb: IDL.Opt(IDL.Float64)
|
|
119
|
+
});
|
|
120
|
+
const AnalyticsWebVitalsPerformanceMetrics = IDL.Record({
|
|
121
|
+
overall: AnalyticsWebVitalsPageMetrics,
|
|
122
|
+
pages: IDL.Vec(IDL.Tuple(IDL.Text, AnalyticsWebVitalsPageMetrics))
|
|
123
|
+
});
|
|
124
|
+
const TrackEvent = IDL.Record({
|
|
125
|
+
updated_at: IDL.Nat64,
|
|
126
|
+
session_id: IDL.Text,
|
|
127
|
+
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
|
|
128
|
+
name: IDL.Text,
|
|
129
|
+
created_at: IDL.Nat64,
|
|
130
|
+
satellite_id: IDL.Principal,
|
|
131
|
+
version: IDL.Opt(IDL.Nat64)
|
|
132
|
+
});
|
|
133
|
+
const AnalyticsTrackEvents = IDL.Record({
|
|
134
|
+
total: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
|
|
135
|
+
});
|
|
136
|
+
const OrbiterSatelliteFeatures = IDL.Record({
|
|
137
|
+
performance_metrics: IDL.Bool,
|
|
138
|
+
track_events: IDL.Bool,
|
|
139
|
+
page_views: IDL.Bool
|
|
140
|
+
});
|
|
141
|
+
const OrbiterSatelliteConfig = IDL.Record({
|
|
142
|
+
updated_at: IDL.Nat64,
|
|
143
|
+
features: IDL.Opt(OrbiterSatelliteFeatures),
|
|
144
|
+
created_at: IDL.Nat64,
|
|
145
|
+
version: IDL.Opt(IDL.Nat64)
|
|
146
|
+
});
|
|
147
|
+
const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
|
|
148
|
+
const SetController = IDL.Record({
|
|
149
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
150
|
+
scope: ControllerScope,
|
|
151
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
152
|
+
});
|
|
153
|
+
const SetControllersArgs = IDL.Record({
|
|
154
|
+
controller: SetController,
|
|
155
|
+
controllers: IDL.Vec(IDL.Principal)
|
|
156
|
+
});
|
|
157
|
+
const SetPageView = IDL.Record({
|
|
158
|
+
title: IDL.Text,
|
|
159
|
+
updated_at: IDL.Opt(IDL.Nat64),
|
|
160
|
+
referrer: IDL.Opt(IDL.Text),
|
|
161
|
+
time_zone: IDL.Text,
|
|
162
|
+
session_id: IDL.Text,
|
|
163
|
+
href: IDL.Text,
|
|
164
|
+
satellite_id: IDL.Principal,
|
|
165
|
+
device: PageViewDevice,
|
|
166
|
+
version: IDL.Opt(IDL.Nat64),
|
|
167
|
+
user_agent: IDL.Opt(IDL.Text)
|
|
168
|
+
});
|
|
169
|
+
const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
|
|
170
|
+
const Result_1 = IDL.Variant({
|
|
171
|
+
Ok: IDL.Null,
|
|
172
|
+
Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
|
|
173
|
+
});
|
|
174
|
+
const SetPerformanceMetric = IDL.Record({
|
|
175
|
+
session_id: IDL.Text,
|
|
176
|
+
data: PerformanceData,
|
|
177
|
+
href: IDL.Text,
|
|
178
|
+
metric_name: PerformanceMetricName,
|
|
179
|
+
satellite_id: IDL.Principal,
|
|
180
|
+
version: IDL.Opt(IDL.Nat64),
|
|
181
|
+
user_agent: IDL.Opt(IDL.Text)
|
|
182
|
+
});
|
|
183
|
+
const Result_2 = IDL.Variant({Ok: PerformanceMetric, Err: IDL.Text});
|
|
184
|
+
const SetSatelliteConfig = IDL.Record({
|
|
185
|
+
features: IDL.Opt(OrbiterSatelliteFeatures),
|
|
186
|
+
version: IDL.Opt(IDL.Nat64)
|
|
187
|
+
});
|
|
188
|
+
const SetTrackEvent = IDL.Record({
|
|
189
|
+
updated_at: IDL.Opt(IDL.Nat64),
|
|
190
|
+
session_id: IDL.Text,
|
|
191
|
+
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
|
|
192
|
+
name: IDL.Text,
|
|
193
|
+
satellite_id: IDL.Principal,
|
|
194
|
+
version: IDL.Opt(IDL.Nat64),
|
|
195
|
+
user_agent: IDL.Opt(IDL.Text)
|
|
196
|
+
});
|
|
197
|
+
const Result_3 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
|
|
198
|
+
return IDL.Service({
|
|
199
|
+
del_controllers: IDL.Func(
|
|
200
|
+
[DeleteControllersArgs],
|
|
201
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
202
|
+
[]
|
|
203
|
+
),
|
|
204
|
+
del_satellite_config: IDL.Func([IDL.Principal, DelSatelliteConfig], [], []),
|
|
205
|
+
deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
|
|
206
|
+
get_page_views: IDL.Func([GetAnalytics], [IDL.Vec(IDL.Tuple(AnalyticKey, PageView))], []),
|
|
207
|
+
get_page_views_analytics_clients: IDL.Func([GetAnalytics], [AnalyticsClientsPageViews], []),
|
|
208
|
+
get_page_views_analytics_metrics: IDL.Func([GetAnalytics], [AnalyticsMetricsPageViews], []),
|
|
209
|
+
get_page_views_analytics_top_10: IDL.Func([GetAnalytics], [AnalyticsTop10PageViews], []),
|
|
210
|
+
get_performance_metrics: IDL.Func(
|
|
211
|
+
[GetAnalytics],
|
|
212
|
+
[IDL.Vec(IDL.Tuple(AnalyticKey, PerformanceMetric))],
|
|
213
|
+
[]
|
|
214
|
+
),
|
|
215
|
+
get_performance_metrics_analytics_web_vitals: IDL.Func(
|
|
216
|
+
[GetAnalytics],
|
|
217
|
+
[AnalyticsWebVitalsPerformanceMetrics],
|
|
218
|
+
[]
|
|
219
|
+
),
|
|
220
|
+
get_track_events: IDL.Func([GetAnalytics], [IDL.Vec(IDL.Tuple(AnalyticKey, TrackEvent))], []),
|
|
221
|
+
get_track_events_analytics: IDL.Func([GetAnalytics], [AnalyticsTrackEvents], []),
|
|
222
|
+
list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], []),
|
|
223
|
+
list_satellite_configs: IDL.Func(
|
|
224
|
+
[],
|
|
225
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, OrbiterSatelliteConfig))],
|
|
226
|
+
[]
|
|
227
|
+
),
|
|
228
|
+
memory_size: IDL.Func([], [MemorySize], []),
|
|
229
|
+
set_controllers: IDL.Func(
|
|
230
|
+
[SetControllersArgs],
|
|
231
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
232
|
+
[]
|
|
233
|
+
),
|
|
234
|
+
set_page_view: IDL.Func([AnalyticKey, SetPageView], [Result], []),
|
|
235
|
+
set_page_views: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetPageView))], [Result_1], []),
|
|
236
|
+
set_performance_metric: IDL.Func([AnalyticKey, SetPerformanceMetric], [Result_2], []),
|
|
237
|
+
set_performance_metrics: IDL.Func(
|
|
238
|
+
[IDL.Vec(IDL.Tuple(AnalyticKey, SetPerformanceMetric))],
|
|
239
|
+
[Result_1],
|
|
240
|
+
[]
|
|
241
|
+
),
|
|
242
|
+
set_satellite_configs: IDL.Func(
|
|
243
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, SetSatelliteConfig))],
|
|
244
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, OrbiterSatelliteConfig))],
|
|
245
|
+
[]
|
|
246
|
+
),
|
|
247
|
+
set_track_event: IDL.Func([AnalyticKey, SetTrackEvent], [Result_3], []),
|
|
248
|
+
set_track_events: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetTrackEvent))], [Result_1], []),
|
|
249
|
+
version: IDL.Func([], [IDL.Text], [])
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
// @ts-ignore
|
|
253
|
+
export const init = ({IDL}) => {
|
|
254
|
+
return [];
|
|
255
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ActorMethod, type ActorSubclass } from '@dfinity/agent';
|
|
2
2
|
import type { IDL } from '@dfinity/candid';
|
|
3
3
|
import type { EnvironmentActor } from '../types/env';
|
|
4
|
-
export declare const createActor: <T = Record<string, ActorMethod
|
|
4
|
+
export declare const createActor: <T = Record<string, ActorMethod>>({ orbiterId: canisterId, idlFactory, container }: {
|
|
5
5
|
idlFactory: IDL.InterfaceFactory;
|
|
6
6
|
} & EnvironmentActor) => Promise<ActorSubclass<T>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junobuild/analytics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7-next-2025-04-06",
|
|
4
4
|
"description": "Tracker for Juno analytics",
|
|
5
5
|
"author": "David Dal Busco (https://daviddalbusco.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"web-vitals": "^4.2.4"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@dfinity/agent": "
|
|
64
|
-
"@dfinity/candid": "
|
|
65
|
-
"@dfinity/identity": "
|
|
66
|
-
"@dfinity/principal": "
|
|
67
|
-
"@dfinity/utils": "
|
|
63
|
+
"@dfinity/agent": "*",
|
|
64
|
+
"@dfinity/candid": "*",
|
|
65
|
+
"@dfinity/identity": "*",
|
|
66
|
+
"@dfinity/principal": "*",
|
|
67
|
+
"@dfinity/utils": "*",
|
|
68
68
|
"@junobuild/utils": "*"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|