analytica.click 0.0.536 → 0.0.538
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/dist/helpers/server.d.ts +3 -1
- package/dist/helpers/server.js +1 -1
- package/dist/index.d.ts +206 -37
- package/dist/index.js +1 -1
- package/dist/ui/src/server/schema/index.d.ts +189 -35
- package/package.json +1 -1
package/dist/helpers/server.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import 'cross-fetch/polyfill';
|
2
|
-
import type { TEvent, TPage } from '../types';
|
2
|
+
import type { TEvent, TMetric, TPage } from '../types';
|
3
3
|
/** used for tracking arbitrary events */
|
4
4
|
export declare const event: TEvent;
|
5
5
|
/** used for tracking visits to a page */
|
6
6
|
export declare const page: TPage;
|
7
|
+
/** used for tracking custom metrics */
|
8
|
+
export declare const metric: TMetric;
|
package/dist/helpers/server.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var y=(e,r)=>{for(var t in r)p(e,t,{get:r[t],enumerable:!0})},h=(e,r,t,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of w(r))!l.call(e,s)&&s!==t&&p(e,s,{get:()=>r[s],enumerable:!(d=f(r,s))||d.enumerable});return e};var u=e=>h(p({},"__esModule",{value:!0}),e);var T={};y(T,{event:()=>m,metric:()=>k,page:()=>v});module.exports=u(T);var P=require("cross-fetch/polyfill"),a=require("ag-common/dist/common/helpers/log"),m=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",eventName:d,devMode:s,valueOverrides:i}=e;if(!s&&typeof window<"u"&&window.location.hostname==="localhost")return(0,a.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let o={eventName:d,browserFingerprint:i?.browserFingerprint,pageLocation:""};typeof window<"u"&&(o={...o,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof navigator<"u"&&(o={...o,browser:navigator.userAgent});try{let n=await fetch(`${t}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:o})});if(!n.ok){let c=await n.text();return(0,a.warn)("tracking error:"+c),{error:c}}}catch(n){let c=n instanceof Error?n.message:"Unknown error";return(0,a.warn)("tracking error:"+c),{error:c}}return{}},v=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",devMode:d,valueOverrides:s}=e;if(!d&&typeof window<"u"&&window.location.hostname==="localhost")return(0,a.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let i={pageLocation:"",browserFingerprint:s?.browserFingerprint};if(typeof window<"u"&&(i={...i,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof document<"u"&&(i={...i,pageReferrer:document.referrer,pageTitle:document.title}),typeof navigator<"u"&&(i={...i,browserLanguage:navigator.language,browser:navigator.userAgent}),!i.pageLocation)return(0,a.warn)("no pageLocation"),{};try{let o=await fetch(`${t}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:i})});if(!o.ok){let n=await o.text();return(0,a.warn)("tracking error:"+n),{error:n}}}catch(o){let n=o instanceof Error?o.message:"Unknown error";return(0,a.warn)("tracking error:"+n),{error:n}}return{}},k=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",type:d,name:s,value:i,devMode:o}=e;if(!o&&typeof window<"u"&&window.location.hostname==="localhost")return(0,a.debug)(`local metric ignored: ${JSON.stringify(e)}, to ${t}`),{};if(d==="health")return(0,a.warn)('Type "health" is reserved for system metrics'),{error:'Type "health" is reserved for system metrics'};let n={type:d,name:s,value:i};try{let c=await fetch(`${t}/site/metric`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:n})});if(!c.ok){let g=await c.text();return(0,a.warn)("metric tracking error:"+g),{error:g}}}catch(c){let g=c instanceof Error?c.message:"Unknown error";return(0,a.warn)("metric tracking error:"+g),{error:g}}return{}};0&&(module.exports={event,metric,page});
|
package/dist/index.d.ts
CHANGED
@@ -102,18 +102,21 @@ declare module 'analytica.click/dist/helpers/object' {
|
|
102
102
|
}
|
103
103
|
declare module 'analytica.click/dist/helpers/server' {
|
104
104
|
import 'cross-fetch/polyfill';
|
105
|
-
import type { TEvent, TPage } from 'analytica.click/dist/types';
|
105
|
+
import type { TEvent, TMetric, TPage } from 'analytica.click/dist/types';
|
106
106
|
/** used for tracking arbitrary events */
|
107
107
|
export const event: TEvent;
|
108
108
|
/** used for tracking visits to a page */
|
109
109
|
export const page: TPage;
|
110
|
+
/** used for tracking custom metrics */
|
111
|
+
export const metric: TMetric;
|
110
112
|
|
111
113
|
}
|
112
114
|
declare module 'analytica.click/dist/helpers/useAnalytica' {
|
113
|
-
import type { IEvent, IPage } from 'analytica.click/dist/types';
|
115
|
+
import type { IEvent, IMetric, IPage } from 'analytica.click/dist/types';
|
114
116
|
export const useAnalytica: () => {
|
115
117
|
event: (d: Omit<IEvent, "analyticaToken" | "overrideBaseUrl">) => void;
|
116
118
|
page: (d: Omit<IPage, "analyticaToken" | "overrideBaseUrl">) => void;
|
119
|
+
metric: (d: Omit<IMetric, "analyticaToken" | "overrideBaseUrl">) => void;
|
117
120
|
};
|
118
121
|
|
119
122
|
}
|
@@ -149,6 +152,18 @@ declare module 'analytica.click/dist/types' {
|
|
149
152
|
browserFingerprint?: string;
|
150
153
|
};
|
151
154
|
}
|
155
|
+
export type TMetric = (p: IMetric) => Promise<{
|
156
|
+
error?: string;
|
157
|
+
}>;
|
158
|
+
export interface IMetric {
|
159
|
+
analyticaToken: string;
|
160
|
+
overrideBaseUrl?: string;
|
161
|
+
type: string;
|
162
|
+
name: string;
|
163
|
+
value: number;
|
164
|
+
/** internal testing only. also allows local sending of errors */
|
165
|
+
devMode?: boolean;
|
166
|
+
}
|
152
167
|
export type TErrorMessage = (m: ErrorEvent) => Promise<void>;
|
153
168
|
export interface IAnalyticaConfig {
|
154
169
|
analyticaToken: string;
|
@@ -167,6 +182,11 @@ declare module 'analytica.click/dist/types' {
|
|
167
182
|
}
|
168
183
|
declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
169
184
|
import { z } from 'zod';
|
185
|
+
export const category: z.ZodEnum<{
|
186
|
+
SERVER: "SERVER";
|
187
|
+
CLIENT: "CLIENT";
|
188
|
+
}>;
|
189
|
+
export type Category = z.infer<typeof category>;
|
170
190
|
export const createSiteSchema: z.ZodObject<{
|
171
191
|
site: z.ZodString;
|
172
192
|
}, z.core.$strip>;
|
@@ -204,7 +224,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
204
224
|
email: z.ZodString;
|
205
225
|
site: z.ZodString;
|
206
226
|
datetime: z.ZodNumber;
|
207
|
-
category: z.
|
227
|
+
category: z.ZodEnum<{
|
228
|
+
SERVER: "SERVER";
|
229
|
+
CLIENT: "CLIENT";
|
230
|
+
}>;
|
208
231
|
totals: z.ZodObject<{
|
209
232
|
clicks: z.ZodNumber;
|
210
233
|
impressions: z.ZodNumber;
|
@@ -246,7 +269,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
246
269
|
search: z.ZodOptional<z.ZodString>;
|
247
270
|
hash: z.ZodOptional<z.ZodString>;
|
248
271
|
count: z.ZodNumber;
|
249
|
-
category: z.
|
272
|
+
category: z.ZodEnum<{
|
273
|
+
SERVER: "SERVER";
|
274
|
+
CLIENT: "CLIENT";
|
275
|
+
}>;
|
250
276
|
}, z.core.$strip>;
|
251
277
|
export const BrowserSchema: z.ZodObject<{
|
252
278
|
account: z.ZodOptional<z.ZodString>;
|
@@ -254,7 +280,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
254
280
|
site: z.ZodString;
|
255
281
|
browser: z.ZodString;
|
256
282
|
count: z.ZodNumber;
|
257
|
-
category: z.
|
283
|
+
category: z.ZodEnum<{
|
284
|
+
SERVER: "SERVER";
|
285
|
+
CLIENT: "CLIENT";
|
286
|
+
}>;
|
258
287
|
}, z.core.$strip>;
|
259
288
|
export const ResolutionSchema: z.ZodObject<{
|
260
289
|
account: z.ZodOptional<z.ZodString>;
|
@@ -262,7 +291,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
262
291
|
site: z.ZodString;
|
263
292
|
resolution: z.ZodString;
|
264
293
|
count: z.ZodNumber;
|
265
|
-
category: z.
|
294
|
+
category: z.ZodEnum<{
|
295
|
+
SERVER: "SERVER";
|
296
|
+
CLIENT: "CLIENT";
|
297
|
+
}>;
|
266
298
|
}, z.core.$strip>;
|
267
299
|
export const ReferrerSchema: z.ZodObject<{
|
268
300
|
account: z.ZodOptional<z.ZodString>;
|
@@ -270,14 +302,20 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
270
302
|
site: z.ZodString;
|
271
303
|
referrer: z.ZodString;
|
272
304
|
count: z.ZodNumber;
|
273
|
-
category: z.
|
305
|
+
category: z.ZodEnum<{
|
306
|
+
SERVER: "SERVER";
|
307
|
+
CLIENT: "CLIENT";
|
308
|
+
}>;
|
274
309
|
}, z.core.$strip>;
|
275
310
|
export const LocationSchema: z.ZodObject<{
|
276
311
|
account: z.ZodOptional<z.ZodString>;
|
277
312
|
datetime: z.ZodNumber;
|
278
313
|
site: z.ZodString;
|
279
314
|
countryRegion: z.ZodString;
|
280
|
-
category: z.
|
315
|
+
category: z.ZodEnum<{
|
316
|
+
SERVER: "SERVER";
|
317
|
+
CLIENT: "CLIENT";
|
318
|
+
}>;
|
281
319
|
count: z.ZodNumber;
|
282
320
|
}, z.core.$strip>;
|
283
321
|
export const LanguageSchema: z.ZodObject<{
|
@@ -286,7 +324,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
286
324
|
site: z.ZodString;
|
287
325
|
language: z.ZodString;
|
288
326
|
count: z.ZodNumber;
|
289
|
-
category: z.
|
327
|
+
category: z.ZodEnum<{
|
328
|
+
SERVER: "SERVER";
|
329
|
+
CLIENT: "CLIENT";
|
330
|
+
}>;
|
290
331
|
}, z.core.$strip>;
|
291
332
|
export const FingerprintSchema: z.ZodObject<{
|
292
333
|
account: z.ZodOptional<z.ZodString>;
|
@@ -294,7 +335,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
294
335
|
site: z.ZodString;
|
295
336
|
fingerprint: z.ZodString;
|
296
337
|
count: z.ZodNumber;
|
297
|
-
category: z.
|
338
|
+
category: z.ZodEnum<{
|
339
|
+
SERVER: "SERVER";
|
340
|
+
CLIENT: "CLIENT";
|
341
|
+
}>;
|
298
342
|
}, z.core.$strip>;
|
299
343
|
export const EventSchema: z.ZodObject<{
|
300
344
|
account: z.ZodOptional<z.ZodString>;
|
@@ -302,15 +346,54 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
302
346
|
eventName: z.ZodString;
|
303
347
|
datetime: z.ZodNumber;
|
304
348
|
count: z.ZodNumber;
|
305
|
-
category: z.
|
349
|
+
category: z.ZodEnum<{
|
350
|
+
SERVER: "SERVER";
|
351
|
+
CLIENT: "CLIENT";
|
352
|
+
}>;
|
306
353
|
}, z.core.$strip>;
|
307
|
-
export const
|
308
|
-
|
309
|
-
|
310
|
-
|
354
|
+
export const HealthMetricSchema: z.ZodObject<{
|
355
|
+
type: z.ZodLiteral<"health">;
|
356
|
+
responseTimeMs: z.ZodNumber;
|
357
|
+
success: z.ZodBoolean;
|
358
|
+
}, z.core.$strip>;
|
359
|
+
export const UserMetricSchema: z.ZodObject<{
|
360
|
+
type: z.ZodString;
|
361
|
+
name: z.ZodString;
|
362
|
+
value: z.ZodNumber;
|
363
|
+
}, z.core.$strip>;
|
364
|
+
export const MetricItemSchema: z.ZodUnion<readonly [z.ZodObject<{
|
365
|
+
type: z.ZodLiteral<"health">;
|
311
366
|
responseTimeMs: z.ZodNumber;
|
312
367
|
success: z.ZodBoolean;
|
368
|
+
}, z.core.$strip>, z.ZodObject<{
|
369
|
+
type: z.ZodString;
|
370
|
+
name: z.ZodString;
|
371
|
+
value: z.ZodNumber;
|
372
|
+
}, z.core.$strip>]>;
|
373
|
+
export const MetricSchema: z.ZodObject<{
|
374
|
+
account: z.ZodOptional<z.ZodString>;
|
375
|
+
site: z.ZodString;
|
376
|
+
datetime: z.ZodNumber;
|
377
|
+
category: z.ZodEnum<{
|
378
|
+
SERVER: "SERVER";
|
379
|
+
CLIENT: "CLIENT";
|
380
|
+
}>;
|
381
|
+
metric: z.ZodUnion<readonly [z.ZodObject<{
|
382
|
+
type: z.ZodLiteral<"health">;
|
383
|
+
responseTimeMs: z.ZodNumber;
|
384
|
+
success: z.ZodBoolean;
|
385
|
+
}, z.core.$strip>, z.ZodObject<{
|
386
|
+
type: z.ZodString;
|
387
|
+
name: z.ZodString;
|
388
|
+
value: z.ZodNumber;
|
389
|
+
}, z.core.$strip>]>;
|
313
390
|
}, z.core.$strip>;
|
391
|
+
export interface IMetric extends z.infer<typeof MetricSchema> {
|
392
|
+
}
|
393
|
+
export interface IHealthMetric extends z.infer<typeof HealthMetricSchema> {
|
394
|
+
}
|
395
|
+
export interface IUserMetric extends z.infer<typeof UserMetricSchema> {
|
396
|
+
}
|
314
397
|
export const ModelErrorSchema: z.ZodObject<{
|
315
398
|
PK: z.ZodString;
|
316
399
|
messageHash: z.ZodOptional<z.ZodString>;
|
@@ -324,7 +407,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
324
407
|
datetime: z.ZodNumber;
|
325
408
|
archived: z.ZodOptional<z.ZodBoolean>;
|
326
409
|
count: z.ZodNumber;
|
327
|
-
category: z.
|
410
|
+
category: z.ZodEnum<{
|
411
|
+
SERVER: "SERVER";
|
412
|
+
CLIENT: "CLIENT";
|
413
|
+
}>;
|
328
414
|
}, z.core.$strip>;
|
329
415
|
export const RollupTopReferrersSchema: z.ZodObject<{
|
330
416
|
referrer: z.ZodString;
|
@@ -362,11 +448,19 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
362
448
|
href: z.ZodString;
|
363
449
|
count: z.ZodNumber;
|
364
450
|
}, z.core.$strip>;
|
451
|
+
export const RollupMetricSummarySchema: z.ZodObject<{
|
452
|
+
count: z.ZodNumber;
|
453
|
+
sum: z.ZodNumber;
|
454
|
+
average: z.ZodNumber;
|
455
|
+
}, z.core.$strip>;
|
365
456
|
export const RollupSchema: z.ZodObject<{
|
366
457
|
account: z.ZodString;
|
367
458
|
site: z.ZodString;
|
368
459
|
datetime: z.ZodNumber;
|
369
|
-
category: z.
|
460
|
+
category: z.ZodEnum<{
|
461
|
+
SERVER: "SERVER";
|
462
|
+
CLIENT: "CLIENT";
|
463
|
+
}>;
|
370
464
|
topReferrers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
371
465
|
referrer: z.ZodString;
|
372
466
|
count: z.ZodNumber;
|
@@ -403,7 +497,11 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
403
497
|
href: z.ZodString;
|
404
498
|
count: z.ZodNumber;
|
405
499
|
}, z.core.$strip>>>;
|
406
|
-
|
500
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
501
|
+
count: z.ZodNumber;
|
502
|
+
sum: z.ZodNumber;
|
503
|
+
average: z.ZodNumber;
|
504
|
+
}, z.core.$strip>>>;
|
407
505
|
}, z.core.$strip>;
|
408
506
|
export const PostEventDataSchema: z.ZodObject<{
|
409
507
|
eventName: z.ZodString;
|
@@ -466,6 +564,19 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
466
564
|
}, z.core.$strip>;
|
467
565
|
key: z.ZodString;
|
468
566
|
}, z.core.$strip>;
|
567
|
+
export const PostMetricDataSchema: z.ZodObject<{
|
568
|
+
type: z.ZodString;
|
569
|
+
name: z.ZodString;
|
570
|
+
value: z.ZodNumber;
|
571
|
+
}, z.core.$strip>;
|
572
|
+
export const PostMetricSchema: z.ZodObject<{
|
573
|
+
key: z.ZodString;
|
574
|
+
data: z.ZodObject<{
|
575
|
+
type: z.ZodString;
|
576
|
+
name: z.ZodString;
|
577
|
+
value: z.ZodNumber;
|
578
|
+
}, z.core.$strip>;
|
579
|
+
}, z.core.$strip>;
|
469
580
|
export const SiteDetailsSchema: z.ZodObject<{
|
470
581
|
site: z.ZodString;
|
471
582
|
account: z.ZodString;
|
@@ -503,7 +614,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
503
614
|
site: z.ZodString;
|
504
615
|
browser: z.ZodString;
|
505
616
|
count: z.ZodNumber;
|
506
|
-
category: z.
|
617
|
+
category: z.ZodEnum<{
|
618
|
+
SERVER: "SERVER";
|
619
|
+
CLIENT: "CLIENT";
|
620
|
+
}>;
|
507
621
|
}, z.core.$strip>>>;
|
508
622
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
509
623
|
account: z.ZodOptional<z.ZodString>;
|
@@ -511,14 +625,20 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
511
625
|
eventName: z.ZodString;
|
512
626
|
datetime: z.ZodNumber;
|
513
627
|
count: z.ZodNumber;
|
514
|
-
category: z.
|
628
|
+
category: z.ZodEnum<{
|
629
|
+
SERVER: "SERVER";
|
630
|
+
CLIENT: "CLIENT";
|
631
|
+
}>;
|
515
632
|
}, z.core.$strip>>>;
|
516
633
|
locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
517
634
|
account: z.ZodOptional<z.ZodString>;
|
518
635
|
datetime: z.ZodNumber;
|
519
636
|
site: z.ZodString;
|
520
637
|
countryRegion: z.ZodString;
|
521
|
-
category: z.
|
638
|
+
category: z.ZodEnum<{
|
639
|
+
SERVER: "SERVER";
|
640
|
+
CLIENT: "CLIENT";
|
641
|
+
}>;
|
522
642
|
count: z.ZodNumber;
|
523
643
|
}, z.core.$strip>>>;
|
524
644
|
queries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
@@ -529,7 +649,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
529
649
|
search: z.ZodOptional<z.ZodString>;
|
530
650
|
hash: z.ZodOptional<z.ZodString>;
|
531
651
|
count: z.ZodNumber;
|
532
|
-
category: z.
|
652
|
+
category: z.ZodEnum<{
|
653
|
+
SERVER: "SERVER";
|
654
|
+
CLIENT: "CLIENT";
|
655
|
+
}>;
|
533
656
|
}, z.core.$strip>>>;
|
534
657
|
referrers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
535
658
|
account: z.ZodOptional<z.ZodString>;
|
@@ -537,7 +660,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
537
660
|
site: z.ZodString;
|
538
661
|
referrer: z.ZodString;
|
539
662
|
count: z.ZodNumber;
|
540
|
-
category: z.
|
663
|
+
category: z.ZodEnum<{
|
664
|
+
SERVER: "SERVER";
|
665
|
+
CLIENT: "CLIENT";
|
666
|
+
}>;
|
541
667
|
}, z.core.$strip>>>;
|
542
668
|
resolutions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
543
669
|
account: z.ZodOptional<z.ZodString>;
|
@@ -545,7 +671,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
545
671
|
site: z.ZodString;
|
546
672
|
resolution: z.ZodString;
|
547
673
|
count: z.ZodNumber;
|
548
|
-
category: z.
|
674
|
+
category: z.ZodEnum<{
|
675
|
+
SERVER: "SERVER";
|
676
|
+
CLIENT: "CLIENT";
|
677
|
+
}>;
|
549
678
|
}, z.core.$strip>>>;
|
550
679
|
fingerprints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
551
680
|
account: z.ZodOptional<z.ZodString>;
|
@@ -553,14 +682,28 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
553
682
|
site: z.ZodString;
|
554
683
|
fingerprint: z.ZodString;
|
555
684
|
count: z.ZodNumber;
|
556
|
-
category: z.
|
685
|
+
category: z.ZodEnum<{
|
686
|
+
SERVER: "SERVER";
|
687
|
+
CLIENT: "CLIENT";
|
688
|
+
}>;
|
557
689
|
}, z.core.$strip>>>;
|
558
|
-
|
690
|
+
metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
559
691
|
account: z.ZodOptional<z.ZodString>;
|
560
|
-
datetime: z.ZodNumber;
|
561
692
|
site: z.ZodString;
|
562
|
-
|
563
|
-
|
693
|
+
datetime: z.ZodNumber;
|
694
|
+
category: z.ZodEnum<{
|
695
|
+
SERVER: "SERVER";
|
696
|
+
CLIENT: "CLIENT";
|
697
|
+
}>;
|
698
|
+
metric: z.ZodUnion<readonly [z.ZodObject<{
|
699
|
+
type: z.ZodLiteral<"health">;
|
700
|
+
responseTimeMs: z.ZodNumber;
|
701
|
+
success: z.ZodBoolean;
|
702
|
+
}, z.core.$strip>, z.ZodObject<{
|
703
|
+
type: z.ZodString;
|
704
|
+
name: z.ZodString;
|
705
|
+
value: z.ZodNumber;
|
706
|
+
}, z.core.$strip>]>;
|
564
707
|
}, z.core.$strip>>>;
|
565
708
|
languages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
566
709
|
account: z.ZodOptional<z.ZodString>;
|
@@ -568,13 +711,19 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
568
711
|
site: z.ZodString;
|
569
712
|
language: z.ZodString;
|
570
713
|
count: z.ZodNumber;
|
571
|
-
category: z.
|
714
|
+
category: z.ZodEnum<{
|
715
|
+
SERVER: "SERVER";
|
716
|
+
CLIENT: "CLIENT";
|
717
|
+
}>;
|
572
718
|
}, z.core.$strip>>>;
|
573
719
|
rollups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
574
720
|
account: z.ZodString;
|
575
721
|
site: z.ZodString;
|
576
722
|
datetime: z.ZodNumber;
|
577
|
-
category: z.
|
723
|
+
category: z.ZodEnum<{
|
724
|
+
SERVER: "SERVER";
|
725
|
+
CLIENT: "CLIENT";
|
726
|
+
}>;
|
578
727
|
topReferrers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
579
728
|
referrer: z.ZodString;
|
580
729
|
count: z.ZodNumber;
|
@@ -611,7 +760,11 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
611
760
|
href: z.ZodString;
|
612
761
|
count: z.ZodNumber;
|
613
762
|
}, z.core.$strip>>>;
|
614
|
-
|
763
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
764
|
+
count: z.ZodNumber;
|
765
|
+
sum: z.ZodNumber;
|
766
|
+
average: z.ZodNumber;
|
767
|
+
}, z.core.$strip>>>;
|
615
768
|
}, z.core.$strip>>>;
|
616
769
|
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
617
770
|
PK: z.ZodString;
|
@@ -626,14 +779,20 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
626
779
|
datetime: z.ZodNumber;
|
627
780
|
archived: z.ZodOptional<z.ZodBoolean>;
|
628
781
|
count: z.ZodNumber;
|
629
|
-
category: z.
|
782
|
+
category: z.ZodEnum<{
|
783
|
+
SERVER: "SERVER";
|
784
|
+
CLIENT: "CLIENT";
|
785
|
+
}>;
|
630
786
|
}, z.core.$strip>>>;
|
631
787
|
google: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
632
788
|
account: z.ZodString;
|
633
789
|
email: z.ZodString;
|
634
790
|
site: z.ZodString;
|
635
791
|
datetime: z.ZodNumber;
|
636
|
-
category: z.
|
792
|
+
category: z.ZodEnum<{
|
793
|
+
SERVER: "SERVER";
|
794
|
+
CLIENT: "CLIENT";
|
795
|
+
}>;
|
637
796
|
totals: z.ZodObject<{
|
638
797
|
clicks: z.ZodNumber;
|
639
798
|
impressions: z.ZodNumber;
|
@@ -652,7 +811,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
652
811
|
email: z.ZodString;
|
653
812
|
site: z.ZodString;
|
654
813
|
datetime: z.ZodNumber;
|
655
|
-
category: z.
|
814
|
+
category: z.ZodEnum<{
|
815
|
+
SERVER: "SERVER";
|
816
|
+
CLIENT: "CLIENT";
|
817
|
+
}>;
|
656
818
|
totals: z.ZodObject<{
|
657
819
|
clicks: z.ZodNumber;
|
658
820
|
impressions: z.ZodNumber;
|
@@ -671,7 +833,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
671
833
|
email: z.ZodString;
|
672
834
|
site: z.ZodString;
|
673
835
|
datetime: z.ZodNumber;
|
674
|
-
category: z.
|
836
|
+
category: z.ZodEnum<{
|
837
|
+
SERVER: "SERVER";
|
838
|
+
CLIENT: "CLIENT";
|
839
|
+
}>;
|
675
840
|
totals: z.ZodObject<{
|
676
841
|
clicks: z.ZodNumber;
|
677
842
|
impressions: z.ZodNumber;
|
@@ -733,8 +898,10 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
733
898
|
export type Language = z.infer<typeof LanguageSchema>;
|
734
899
|
export type Fingerprint = z.infer<typeof FingerprintSchema>;
|
735
900
|
export type Event = z.infer<typeof EventSchema>;
|
736
|
-
export type
|
901
|
+
export type MetricItem = z.infer<typeof MetricItemSchema>;
|
902
|
+
export type Metric = z.infer<typeof MetricSchema>;
|
737
903
|
export type ModelError = z.infer<typeof ModelErrorSchema>;
|
904
|
+
export type RollupMetricSummary = z.infer<typeof RollupMetricSummarySchema>;
|
738
905
|
export type Rollup = z.infer<typeof RollupSchema>;
|
739
906
|
export type SiteData = z.infer<typeof SiteDataSchema>;
|
740
907
|
export type SiteDetails = z.infer<typeof SiteDetailsSchema>;
|
@@ -744,6 +911,8 @@ declare module 'analytica.click/dist/ui/src/server/schema/index' {
|
|
744
911
|
export type PostSiteTrack = z.infer<typeof PostSiteTrackSchema>;
|
745
912
|
export type PostErrorData = z.infer<typeof PostErrorDataSchema>;
|
746
913
|
export type PostError = z.infer<typeof PostErrorSchema>;
|
914
|
+
export type PostMetricData = z.infer<typeof PostMetricDataSchema>;
|
915
|
+
export type PostMetric = z.infer<typeof PostMetricSchema>;
|
747
916
|
export type PostAccount = z.infer<typeof PostAccountSchema>;
|
748
917
|
export type DeleteAccount = z.infer<typeof DeleteAccountSchema>;
|
749
918
|
export type ArchiveErrors = z.infer<typeof ArchiveErrorsSchema>;
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
'use client';"use strict";var Q=Object.create;var w=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var re=(e,r)=>{for(var o in r)w(e,o,{get:r[o],enumerable:!0})},A=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Z(r))!ee.call(e,i)&&i!==o&&w(e,i,{get:()=>r[i],enumerable:!(t=Y(r,i))||t.enumerable});return e};var oe=(e,r,o)=>(o=e!=null?Q(V(e)):{},A(r||!e||!e.__esModule?w(o,"default",{value:e,enumerable:!0}):o,e)),te=e=>A(w({},"__esModule",{value:!0}),e);var ce={};re(ce,{AnalyticaClickProvider:()=>ie,AnalyticaConfigContext:()=>g,Modal:()=>C,errorTrack:()=>l,event:()=>I,getErrorKey:()=>D,page:()=>R,tokenMissing:()=>y,useAnalytica:()=>se});module.exports=te(ce);var _=require("react");var k=require("ag-common/dist/common/helpers/log"),v=oe(require("react"));var F=require("react");var le=require("cross-fetch/polyfill"),E=require("ag-common/dist/common/helpers/hashCode"),c=require("ag-common/dist/common/helpers/log"),M=require("ag-common/dist/common/helpers/object"),B=require("ag-common/dist/common/helpers/string/contains");var N=(e,r)=>{let o=[],t={},i=0;return Object.entries(e).forEach(([n,a])=>{i<r?o.push(a):t[n]=a,i+=1}),{part:o,rest:t}};var J=typeof window<"u"&&window.location.hostname==="localhost",m={},T,x,L=async()=>{try{if(Object.keys(m).length>100){let t=Object.keys(m)[0],i=m[t],n=await fetch(`${x}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:i.key,data:{...i.data,message:`error overload!: ${i.data.message||"?"}`}}])});if(m={},!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return{}}let{part:e,rest:r}=N(m,10);m=r;let o=await fetch(`${x}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(m).length>0?T=setTimeout(L,1e3):T=void 0}},l=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:o=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:t})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),o.length>0){let n=(0,B.containsInsensitive)(e.data.message,...o);if(n){(0,c.debug)("ignoring error, contains=",n);return}}if(J&&t)(0,c.debug)("allowing local error tracking due to devmode=true");else if(J)return(0,c.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!ne(e.data.message))return{};(0,c.debug)("error track",e.data.message,JSON.stringify(e));let i=D({...e.data,name:e.data.name??"unknown"});return m[i]=e,x=r,T??=setTimeout(L,500),{}};function ne(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,c.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,c.info)("empty message payload?"),!1):!0:((0,c.info)("no message?"),!1)}var D=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,o=/(at \S+?) \(\S+\)\s/gim,t=/^((%[cs])+\s*)+$/gim,i=/^color:/gim,n=[],a=e.message;(0,M.isJson)(a)?n=JSON.parse(a):n=[a];let s=n.findIndex(f=>f.match(t)),d=n.findIndex(f=>f.match(i));s>=0&&d>=0&&d===s+1&&(n=n.filter((f,G)=>![s,d].includes(G))),n=n.map(f=>f.includes(".js:")||f.includes("node_modules")?f.replace(o,"$1 (stacktrace)"):f.replace(r,"[date]")),a=JSON.stringify(n);let $=(0,E.hashCode)(a).toString();return(0,c.debug)("got errorKey=",a,$),$}catch{return(0,E.hashCode)(e.message).toString()}};async function b({ev:e,values:r}){if(!r.analyticaToken)return;let o={message:e.message,href:window.location.href,filename:e.filename,name:"",stack:e.error.stack};await l({...r,data:{key:r.analyticaToken,data:o}})}function z(e){(0,F.useEffect)(()=>{let r=o=>b({ev:o,values:e});if(e.analyticaToken)return window.addEventListener("error",r),()=>{try{window.removeEventListener("error",r)}catch{}}},[])}var H=require("react");function j(e){(0,H.useEffect)(()=>{if(window.consoleset||!e.analyticaToken)return;window.consoleset=!0;let r=window.console.error;window.console.error=(...t)=>{l({...e,data:{data:{href:window.location.href,message:JSON.stringify(t)},key:e.analyticaToken}}),r(...t)};let o=window.console.warn;window.console.warn=(...t)=>{l({...e,data:{data:{href:window.location.href,message:JSON.stringify(t)},key:e.analyticaToken}}),o(...t)}},[])}var y=e=>`[Analytica.${e}] Please load analytica token in AnalyticaClickProvider to use this component`;function W(e){if(global.nodeset||typeof window<"u"||!e.analyticaToken)return;global.nodeset=!0;let r=global.console.error;global.console.error=(...t)=>{l({...e,data:{data:{href:"server",message:JSON.stringify(t)},key:e.analyticaToken}}),r(...t)};let o=global.console.warn;global.console.warn=(...t)=>{l({...e,data:{data:{href:"server",message:JSON.stringify(t)},key:e.analyticaToken}}),o(...t)}}var K=require("react");var u=require("react/jsx-runtime"),ae={fontSize:"2rem"},h=class extends K.Component{constructor(r){super(r),this.state={hasError:void 0},this.seenError=!1}static getDerivedStateFromError(r){let o=typeof window<"u"&&window.location.href;return{hasError:{...r,message:r?.message??r,...r?.stack&&{error:{stack:r?.stack}},...o&&{href:o}}}}render(){let{hasError:r}=this.state,{children:o,notify:t}=this.props;return r?(t&&t(r),(0,u.jsx)(C,{open:!0,setOpen:()=>{},children:(0,u.jsxs)("div",{style:ae,children:["A fatal error has occurred - the admin has been notified.",(0,u.jsx)("button",{type:"button",onClick:()=>window.location.reload(),children:"Press here to restart app"})]})})):o}};var O=require("react/jsx-runtime"),U=({children:e})=>{let r=(0,v.useContext)(g);return j(r),z(r),W(r),(0,k.debug)("installed analytica.click error handlers"),r.analyticaToken?(0,O.jsx)(h,{notify:o=>b({ev:o,values:r}),children:e}):((0,k.warn)(y("ErrorBoundary")),(0,O.jsx)(v.default.Fragment,{children:e}))};var P=require("react/jsx-runtime"),g=(0,_.createContext)(void 0),ie=({children:e,values:r})=>(0,P.jsx)(g.Provider,{value:r,children:(0,P.jsx)(U,{children:e})});var S=require("react/jsx-runtime"),C=({open:e,setOpen:r,children:o})=>e?(0,S.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>r(!1),children:(0,S.jsx)("div",{style:{backgroundColor:"white",padding:"2rem",borderRadius:"8px",maxWidth:"500px",maxHeight:"80vh",overflow:"auto",position:"relative",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)"},onClick:t=>t.stopPropagation(),children:o})}):null;var De=require("cross-fetch/polyfill"),p=require("ag-common/dist/common/helpers/log"),I=async e=>{let{analyticaToken:r,overrideBaseUrl:o="https://analytica.click/api",eventName:t,devMode:i,valueOverrides:n}=e;if(!i&&typeof window<"u"&&window.location.hostname==="localhost")return(0,p.debug)(`local page ignored: ${JSON.stringify(e)}, to ${o}`),{};let a={eventName:t,browserFingerprint:n?.browserFingerprint,pageLocation:""};typeof window<"u"&&(a={...a,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof navigator<"u"&&(a={...a,browser:navigator.userAgent});try{let s=await fetch(`${o}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:a})});if(!s.ok){let d=await s.text();return(0,p.warn)("tracking error:"+d),{error:d}}}catch(s){let d=s instanceof Error?s.message:"Unknown error";return(0,p.warn)("tracking error:"+d),{error:d}}return{}},R=async e=>{let{analyticaToken:r,overrideBaseUrl:o="https://analytica.click/api",devMode:t,valueOverrides:i}=e;if(!t&&typeof window<"u"&&window.location.hostname==="localhost")return(0,p.debug)(`local page ignored: ${JSON.stringify(e)}, to ${o}`),{};let n={pageLocation:"",browserFingerprint:i?.browserFingerprint};if(typeof window<"u"&&(n={...n,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof document<"u"&&(n={...n,pageReferrer:document.referrer,pageTitle:document.title}),typeof navigator<"u"&&(n={...n,browserLanguage:navigator.language,browser:navigator.userAgent}),!n.pageLocation)return(0,p.warn)("no pageLocation"),{};try{let a=await fetch(`${o}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:n})});if(!a.ok){let s=await a.text();return(0,p.warn)("tracking error:"+s),{error:s}}}catch(a){let s=a instanceof Error?a.message:"Unknown error";return(0,p.warn)("tracking error:"+s),{error:s}}return{}};var X=require("ag-common/dist/common/helpers/log"),q=require("react");var se=()=>{let e=(0,q.useContext)(g);if(!e.analyticaToken){(0,X.warn)(y("useAnalytica"));let r=async()=>({error:"no token"});return{event:r,page:r}}return{event:r=>I({...r,...e}),page:r=>R({...r,...e})}};0&&(module.exports={AnalyticaClickProvider,AnalyticaConfigContext,Modal,errorTrack,event,getErrorKey,page,tokenMissing,useAnalytica});
|
1
|
+
'use client';"use strict";var Y=Object.create;var h=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var te=(e,r)=>{for(var t in r)h(e,t,{get:r[t],enumerable:!0})},N=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of V(r))!re.call(e,i)&&i!==t&&h(e,i,{get:()=>r[i],enumerable:!(o=Z(r,i))||o.enumerable});return e};var oe=(e,r,t)=>(t=e!=null?Y(ee(e)):{},N(r||!e||!e.__esModule?h(t,"default",{value:e,enumerable:!0}):t,e)),ne=e=>N(h({},"__esModule",{value:!0}),e);var de={};te(de,{AnalyticaClickProvider:()=>se,AnalyticaConfigContext:()=>y,Modal:()=>O,errorTrack:()=>p,event:()=>M,getErrorKey:()=>F,metric:()=>R,page:()=>$,tokenMissing:()=>u,useAnalytica:()=>ce});module.exports=ne(de);var X=require("react");var v=require("ag-common/dist/common/helpers/log"),T=oe(require("react"));var z=require("react");var pe=require("cross-fetch/polyfill"),E=require("ag-common/dist/common/helpers/hashCode"),f=require("ag-common/dist/common/helpers/log"),B=require("ag-common/dist/common/helpers/object"),D=require("ag-common/dist/common/helpers/string/contains");var A=(e,r)=>{let t=[],o={},i=0;return Object.entries(e).forEach(([n,a])=>{i<r?t.push(a):o[n]=a,i+=1}),{part:t,rest:o}};var J=typeof window<"u"&&window.location.hostname==="localhost",g={},x,b,L=async()=>{try{if(Object.keys(g).length>100){let o=Object.keys(g)[0],i=g[o],n=await fetch(`${b}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify([{key:i.key,data:{...i.data,message:`error overload!: ${i.data.message||"?"}`}}])});if(g={},!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return{}}let{part:e,rest:r}=A(g,10);g=r;let t=await fetch(`${b}/errors`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`)}catch(e){let r=e;return{error:r?.message??r.message}}finally{Object.keys(g).length>0?x=setTimeout(L,1e3):x=void 0}},p=async({data:e,overrideBaseUrl:r="https://analytica.click/api",ignoreBrowserErrors:t=["will be removed","performing full reload","tracking error","fetch RSC payload","perform a full reload","warnings#debug_enabled",'"digest"',"punycode"],devMode:o})=>{if(r||(r="https://analytica.click/api"),r.startsWith("/")&&typeof window>"u"&&(r="https://analytica.click/api"),t.length>0){let n=(0,D.containsInsensitive)(e.data.message,...t);if(n){(0,f.debug)("ignoring error, contains=",n);return}}if(J&&o)(0,f.debug)("allowing local error tracking due to devmode=true");else if(J)return(0,f.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${r}`),{};if(!ae(e.data.message))return{};(0,f.debug)("error track",e.data.message,JSON.stringify(e));let i=F({...e.data,name:e.data.name??"unknown"});return g[i]=e,b=r,x??=setTimeout(L,500),{}};function ae(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,f.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,f.info)("empty message payload?"),!1):!0:((0,f.info)("no message?"),!1)}var F=e=>{try{let r=/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/gim,t=/(at \S+?) \(\S+\)\s/gim,o=/^((%[cs])+\s*)+$/gim,i=/^color:/gim,n=[],a=e.message;(0,B.isJson)(a)?n=JSON.parse(a):n=[a];let s=n.findIndex(l=>l.match(o)),c=n.findIndex(l=>l.match(i));s>=0&&c>=0&&c===s+1&&(n=n.filter((l,Q)=>![s,c].includes(Q))),n=n.map(l=>l.includes(".js:")||l.includes("node_modules")?l.replace(t,"$1 (stacktrace)"):l.replace(r,"[date]")),a=JSON.stringify(n);let m=(0,E.hashCode)(a).toString();return(0,f.debug)("got errorKey=",a,m),m}catch{return(0,E.hashCode)(e.message).toString()}};async function C({ev:e,values:r}){if(!r.analyticaToken)return;let t={message:e.message,href:window.location.href,filename:e.filename,name:"",stack:e.error.stack};await p({...r,data:{key:r.analyticaToken,data:t}})}function H(e){(0,z.useEffect)(()=>{let r=t=>C({ev:t,values:e});if(e.analyticaToken)return window.addEventListener("error",r),()=>{try{window.removeEventListener("error",r)}catch{}}},[])}var U=require("react");function j(e){(0,U.useEffect)(()=>{if(window.consoleset||!e.analyticaToken)return;window.consoleset=!0;let r=window.console.error;window.console.error=(...o)=>{p({...e,data:{data:{href:window.location.href,message:JSON.stringify(o)},key:e.analyticaToken}}),r(...o)};let t=window.console.warn;window.console.warn=(...o)=>{p({...e,data:{data:{href:window.location.href,message:JSON.stringify(o)},key:e.analyticaToken}}),t(...o)}},[])}var u=e=>`[Analytica.${e}] Please load analytica token in AnalyticaClickProvider to use this component`;function W(e){if(global.nodeset||typeof window<"u"||!e.analyticaToken)return;global.nodeset=!0;let r=global.console.error;global.console.error=(...o)=>{p({...e,data:{data:{href:"server",message:JSON.stringify(o)},key:e.analyticaToken}}),r(...o)};let t=global.console.warn;global.console.warn=(...o)=>{p({...e,data:{data:{href:"server",message:JSON.stringify(o)},key:e.analyticaToken}}),t(...o)}}var K=require("react");var w=require("react/jsx-runtime"),ie={fontSize:"2rem"},k=class extends K.Component{constructor(r){super(r),this.state={hasError:void 0},this.seenError=!1}static getDerivedStateFromError(r){let t=typeof window<"u"&&window.location.href;return{hasError:{...r,message:r?.message??r,...r?.stack&&{error:{stack:r?.stack}},...t&&{href:t}}}}render(){let{hasError:r}=this.state,{children:t,notify:o}=this.props;return r?(o&&o(r),(0,w.jsx)(O,{open:!0,setOpen:()=>{},children:(0,w.jsxs)("div",{style:ie,children:["A fatal error has occurred - the admin has been notified.",(0,w.jsx)("button",{type:"button",onClick:()=>window.location.reload(),children:"Press here to restart app"})]})})):t}};var P=require("react/jsx-runtime"),_=({children:e})=>{let r=(0,T.useContext)(y);return j(r),H(r),W(r),(0,v.debug)("installed analytica.click error handlers"),r.analyticaToken?(0,P.jsx)(k,{notify:t=>C({ev:t,values:r}),children:e}):((0,v.warn)(u("ErrorBoundary")),(0,P.jsx)(T.default.Fragment,{children:e}))};var S=require("react/jsx-runtime"),y=(0,X.createContext)(void 0),se=({children:e,values:r})=>(0,S.jsx)(y.Provider,{value:r,children:(0,S.jsx)(_,{children:e})});var I=require("react/jsx-runtime"),O=({open:e,setOpen:r,children:t})=>e?(0,I.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>r(!1),children:(0,I.jsx)("div",{style:{backgroundColor:"white",padding:"2rem",borderRadius:"8px",maxWidth:"500px",maxHeight:"80vh",overflow:"auto",position:"relative",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)"},onClick:o=>o.stopPropagation(),children:t})}):null;var Fe=require("cross-fetch/polyfill"),d=require("ag-common/dist/common/helpers/log"),M=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",eventName:o,devMode:i,valueOverrides:n}=e;if(!i&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let a={eventName:o,browserFingerprint:n?.browserFingerprint,pageLocation:""};typeof window<"u"&&(a={...a,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof navigator<"u"&&(a={...a,browser:navigator.userAgent});try{let s=await fetch(`${t}/site/event`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:a})});if(!s.ok){let c=await s.text();return(0,d.warn)("tracking error:"+c),{error:c}}}catch(s){let c=s instanceof Error?s.message:"Unknown error";return(0,d.warn)("tracking error:"+c),{error:c}}return{}},$=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",devMode:o,valueOverrides:i}=e;if(!o&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local page ignored: ${JSON.stringify(e)}, to ${t}`),{};let n={pageLocation:"",browserFingerprint:i?.browserFingerprint};if(typeof window<"u"&&(n={...n,pageLocation:window.location.href,browserResolution:`${window.screen.width}:${window.screen.height}`}),typeof document<"u"&&(n={...n,pageReferrer:document.referrer,pageTitle:document.title}),typeof navigator<"u"&&(n={...n,browserLanguage:navigator.language,browser:navigator.userAgent}),!n.pageLocation)return(0,d.warn)("no pageLocation"),{};try{let a=await fetch(`${t}/site/tracking`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:n})});if(!a.ok){let s=await a.text();return(0,d.warn)("tracking error:"+s),{error:s}}}catch(a){let s=a instanceof Error?a.message:"Unknown error";return(0,d.warn)("tracking error:"+s),{error:s}}return{}},R=async e=>{let{analyticaToken:r,overrideBaseUrl:t="https://analytica.click/api",type:o,name:i,value:n,devMode:a}=e;if(!a&&typeof window<"u"&&window.location.hostname==="localhost")return(0,d.debug)(`local metric ignored: ${JSON.stringify(e)}, to ${t}`),{};if(o==="health")return(0,d.warn)('Type "health" is reserved for system metrics'),{error:'Type "health" is reserved for system metrics'};let s={type:o,name:i,value:n};try{let c=await fetch(`${t}/site/metric`,{method:"POST",headers:{"Content-Type":"application/json",authorization:""},body:JSON.stringify({key:r,data:s})});if(!c.ok){let m=await c.text();return(0,d.warn)("metric tracking error:"+m),{error:m}}}catch(c){let m=c instanceof Error?c.message:"Unknown error";return(0,d.warn)("metric tracking error:"+m),{error:m}}return{}};var q=require("ag-common/dist/common/helpers/log"),G=require("react");var ce=()=>{let e=(0,G.useContext)(y);if(!e.analyticaToken){(0,q.warn)(u("useAnalytica"));let r=async()=>({error:"no token"});return{event:r,page:r,metric:r}}return{event:r=>M({...r,...e}),page:r=>$({...r,...e}),metric:r=>R({...r,...e})}};0&&(module.exports={AnalyticaClickProvider,AnalyticaConfigContext,Modal,errorTrack,event,getErrorKey,metric,page,tokenMissing,useAnalytica});
|
@@ -1,4 +1,9 @@
|
|
1
1
|
import { z } from 'zod';
|
2
|
+
export declare const category: z.ZodEnum<{
|
3
|
+
SERVER: "SERVER";
|
4
|
+
CLIENT: "CLIENT";
|
5
|
+
}>;
|
6
|
+
export type Category = z.infer<typeof category>;
|
2
7
|
export declare const createSiteSchema: z.ZodObject<{
|
3
8
|
site: z.ZodString;
|
4
9
|
}, z.core.$strip>;
|
@@ -36,7 +41,10 @@ export declare const SeoResultSchema: z.ZodObject<{
|
|
36
41
|
email: z.ZodString;
|
37
42
|
site: z.ZodString;
|
38
43
|
datetime: z.ZodNumber;
|
39
|
-
category: z.
|
44
|
+
category: z.ZodEnum<{
|
45
|
+
SERVER: "SERVER";
|
46
|
+
CLIENT: "CLIENT";
|
47
|
+
}>;
|
40
48
|
totals: z.ZodObject<{
|
41
49
|
clicks: z.ZodNumber;
|
42
50
|
impressions: z.ZodNumber;
|
@@ -78,7 +86,10 @@ export declare const QuerySchema: z.ZodObject<{
|
|
78
86
|
search: z.ZodOptional<z.ZodString>;
|
79
87
|
hash: z.ZodOptional<z.ZodString>;
|
80
88
|
count: z.ZodNumber;
|
81
|
-
category: z.
|
89
|
+
category: z.ZodEnum<{
|
90
|
+
SERVER: "SERVER";
|
91
|
+
CLIENT: "CLIENT";
|
92
|
+
}>;
|
82
93
|
}, z.core.$strip>;
|
83
94
|
export declare const BrowserSchema: z.ZodObject<{
|
84
95
|
account: z.ZodOptional<z.ZodString>;
|
@@ -86,7 +97,10 @@ export declare const BrowserSchema: z.ZodObject<{
|
|
86
97
|
site: z.ZodString;
|
87
98
|
browser: z.ZodString;
|
88
99
|
count: z.ZodNumber;
|
89
|
-
category: z.
|
100
|
+
category: z.ZodEnum<{
|
101
|
+
SERVER: "SERVER";
|
102
|
+
CLIENT: "CLIENT";
|
103
|
+
}>;
|
90
104
|
}, z.core.$strip>;
|
91
105
|
export declare const ResolutionSchema: z.ZodObject<{
|
92
106
|
account: z.ZodOptional<z.ZodString>;
|
@@ -94,7 +108,10 @@ export declare const ResolutionSchema: z.ZodObject<{
|
|
94
108
|
site: z.ZodString;
|
95
109
|
resolution: z.ZodString;
|
96
110
|
count: z.ZodNumber;
|
97
|
-
category: z.
|
111
|
+
category: z.ZodEnum<{
|
112
|
+
SERVER: "SERVER";
|
113
|
+
CLIENT: "CLIENT";
|
114
|
+
}>;
|
98
115
|
}, z.core.$strip>;
|
99
116
|
export declare const ReferrerSchema: z.ZodObject<{
|
100
117
|
account: z.ZodOptional<z.ZodString>;
|
@@ -102,14 +119,20 @@ export declare const ReferrerSchema: z.ZodObject<{
|
|
102
119
|
site: z.ZodString;
|
103
120
|
referrer: z.ZodString;
|
104
121
|
count: z.ZodNumber;
|
105
|
-
category: z.
|
122
|
+
category: z.ZodEnum<{
|
123
|
+
SERVER: "SERVER";
|
124
|
+
CLIENT: "CLIENT";
|
125
|
+
}>;
|
106
126
|
}, z.core.$strip>;
|
107
127
|
export declare const LocationSchema: z.ZodObject<{
|
108
128
|
account: z.ZodOptional<z.ZodString>;
|
109
129
|
datetime: z.ZodNumber;
|
110
130
|
site: z.ZodString;
|
111
131
|
countryRegion: z.ZodString;
|
112
|
-
category: z.
|
132
|
+
category: z.ZodEnum<{
|
133
|
+
SERVER: "SERVER";
|
134
|
+
CLIENT: "CLIENT";
|
135
|
+
}>;
|
113
136
|
count: z.ZodNumber;
|
114
137
|
}, z.core.$strip>;
|
115
138
|
export declare const LanguageSchema: z.ZodObject<{
|
@@ -118,7 +141,10 @@ export declare const LanguageSchema: z.ZodObject<{
|
|
118
141
|
site: z.ZodString;
|
119
142
|
language: z.ZodString;
|
120
143
|
count: z.ZodNumber;
|
121
|
-
category: z.
|
144
|
+
category: z.ZodEnum<{
|
145
|
+
SERVER: "SERVER";
|
146
|
+
CLIENT: "CLIENT";
|
147
|
+
}>;
|
122
148
|
}, z.core.$strip>;
|
123
149
|
export declare const FingerprintSchema: z.ZodObject<{
|
124
150
|
account: z.ZodOptional<z.ZodString>;
|
@@ -126,7 +152,10 @@ export declare const FingerprintSchema: z.ZodObject<{
|
|
126
152
|
site: z.ZodString;
|
127
153
|
fingerprint: z.ZodString;
|
128
154
|
count: z.ZodNumber;
|
129
|
-
category: z.
|
155
|
+
category: z.ZodEnum<{
|
156
|
+
SERVER: "SERVER";
|
157
|
+
CLIENT: "CLIENT";
|
158
|
+
}>;
|
130
159
|
}, z.core.$strip>;
|
131
160
|
export declare const EventSchema: z.ZodObject<{
|
132
161
|
account: z.ZodOptional<z.ZodString>;
|
@@ -134,15 +163,54 @@ export declare const EventSchema: z.ZodObject<{
|
|
134
163
|
eventName: z.ZodString;
|
135
164
|
datetime: z.ZodNumber;
|
136
165
|
count: z.ZodNumber;
|
137
|
-
category: z.
|
166
|
+
category: z.ZodEnum<{
|
167
|
+
SERVER: "SERVER";
|
168
|
+
CLIENT: "CLIENT";
|
169
|
+
}>;
|
138
170
|
}, z.core.$strip>;
|
139
|
-
export declare const
|
140
|
-
|
141
|
-
datetime: z.ZodNumber;
|
142
|
-
site: z.ZodString;
|
171
|
+
export declare const HealthMetricSchema: z.ZodObject<{
|
172
|
+
type: z.ZodLiteral<"health">;
|
143
173
|
responseTimeMs: z.ZodNumber;
|
144
174
|
success: z.ZodBoolean;
|
145
175
|
}, z.core.$strip>;
|
176
|
+
export declare const UserMetricSchema: z.ZodObject<{
|
177
|
+
type: z.ZodString;
|
178
|
+
name: z.ZodString;
|
179
|
+
value: z.ZodNumber;
|
180
|
+
}, z.core.$strip>;
|
181
|
+
export declare const MetricItemSchema: z.ZodUnion<readonly [z.ZodObject<{
|
182
|
+
type: z.ZodLiteral<"health">;
|
183
|
+
responseTimeMs: z.ZodNumber;
|
184
|
+
success: z.ZodBoolean;
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
186
|
+
type: z.ZodString;
|
187
|
+
name: z.ZodString;
|
188
|
+
value: z.ZodNumber;
|
189
|
+
}, z.core.$strip>]>;
|
190
|
+
export declare const MetricSchema: z.ZodObject<{
|
191
|
+
account: z.ZodOptional<z.ZodString>;
|
192
|
+
site: z.ZodString;
|
193
|
+
datetime: z.ZodNumber;
|
194
|
+
category: z.ZodEnum<{
|
195
|
+
SERVER: "SERVER";
|
196
|
+
CLIENT: "CLIENT";
|
197
|
+
}>;
|
198
|
+
metric: z.ZodUnion<readonly [z.ZodObject<{
|
199
|
+
type: z.ZodLiteral<"health">;
|
200
|
+
responseTimeMs: z.ZodNumber;
|
201
|
+
success: z.ZodBoolean;
|
202
|
+
}, z.core.$strip>, z.ZodObject<{
|
203
|
+
type: z.ZodString;
|
204
|
+
name: z.ZodString;
|
205
|
+
value: z.ZodNumber;
|
206
|
+
}, z.core.$strip>]>;
|
207
|
+
}, z.core.$strip>;
|
208
|
+
export interface IMetric extends z.infer<typeof MetricSchema> {
|
209
|
+
}
|
210
|
+
export interface IHealthMetric extends z.infer<typeof HealthMetricSchema> {
|
211
|
+
}
|
212
|
+
export interface IUserMetric extends z.infer<typeof UserMetricSchema> {
|
213
|
+
}
|
146
214
|
export declare const ModelErrorSchema: z.ZodObject<{
|
147
215
|
PK: z.ZodString;
|
148
216
|
messageHash: z.ZodOptional<z.ZodString>;
|
@@ -156,7 +224,10 @@ export declare const ModelErrorSchema: z.ZodObject<{
|
|
156
224
|
datetime: z.ZodNumber;
|
157
225
|
archived: z.ZodOptional<z.ZodBoolean>;
|
158
226
|
count: z.ZodNumber;
|
159
|
-
category: z.
|
227
|
+
category: z.ZodEnum<{
|
228
|
+
SERVER: "SERVER";
|
229
|
+
CLIENT: "CLIENT";
|
230
|
+
}>;
|
160
231
|
}, z.core.$strip>;
|
161
232
|
export declare const RollupTopReferrersSchema: z.ZodObject<{
|
162
233
|
referrer: z.ZodString;
|
@@ -194,11 +265,19 @@ export declare const RollupTopErrorsSchema: z.ZodObject<{
|
|
194
265
|
href: z.ZodString;
|
195
266
|
count: z.ZodNumber;
|
196
267
|
}, z.core.$strip>;
|
268
|
+
export declare const RollupMetricSummarySchema: z.ZodObject<{
|
269
|
+
count: z.ZodNumber;
|
270
|
+
sum: z.ZodNumber;
|
271
|
+
average: z.ZodNumber;
|
272
|
+
}, z.core.$strip>;
|
197
273
|
export declare const RollupSchema: z.ZodObject<{
|
198
274
|
account: z.ZodString;
|
199
275
|
site: z.ZodString;
|
200
276
|
datetime: z.ZodNumber;
|
201
|
-
category: z.
|
277
|
+
category: z.ZodEnum<{
|
278
|
+
SERVER: "SERVER";
|
279
|
+
CLIENT: "CLIENT";
|
280
|
+
}>;
|
202
281
|
topReferrers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
203
282
|
referrer: z.ZodString;
|
204
283
|
count: z.ZodNumber;
|
@@ -235,7 +314,11 @@ export declare const RollupSchema: z.ZodObject<{
|
|
235
314
|
href: z.ZodString;
|
236
315
|
count: z.ZodNumber;
|
237
316
|
}, z.core.$strip>>>;
|
238
|
-
|
317
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
318
|
+
count: z.ZodNumber;
|
319
|
+
sum: z.ZodNumber;
|
320
|
+
average: z.ZodNumber;
|
321
|
+
}, z.core.$strip>>>;
|
239
322
|
}, z.core.$strip>;
|
240
323
|
export declare const PostEventDataSchema: z.ZodObject<{
|
241
324
|
eventName: z.ZodString;
|
@@ -298,6 +381,19 @@ export declare const PostErrorSchema: z.ZodObject<{
|
|
298
381
|
}, z.core.$strip>;
|
299
382
|
key: z.ZodString;
|
300
383
|
}, z.core.$strip>;
|
384
|
+
export declare const PostMetricDataSchema: z.ZodObject<{
|
385
|
+
type: z.ZodString;
|
386
|
+
name: z.ZodString;
|
387
|
+
value: z.ZodNumber;
|
388
|
+
}, z.core.$strip>;
|
389
|
+
export declare const PostMetricSchema: z.ZodObject<{
|
390
|
+
key: z.ZodString;
|
391
|
+
data: z.ZodObject<{
|
392
|
+
type: z.ZodString;
|
393
|
+
name: z.ZodString;
|
394
|
+
value: z.ZodNumber;
|
395
|
+
}, z.core.$strip>;
|
396
|
+
}, z.core.$strip>;
|
301
397
|
export declare const SiteDetailsSchema: z.ZodObject<{
|
302
398
|
site: z.ZodString;
|
303
399
|
account: z.ZodString;
|
@@ -335,7 +431,10 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
335
431
|
site: z.ZodString;
|
336
432
|
browser: z.ZodString;
|
337
433
|
count: z.ZodNumber;
|
338
|
-
category: z.
|
434
|
+
category: z.ZodEnum<{
|
435
|
+
SERVER: "SERVER";
|
436
|
+
CLIENT: "CLIENT";
|
437
|
+
}>;
|
339
438
|
}, z.core.$strip>>>;
|
340
439
|
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
341
440
|
account: z.ZodOptional<z.ZodString>;
|
@@ -343,14 +442,20 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
343
442
|
eventName: z.ZodString;
|
344
443
|
datetime: z.ZodNumber;
|
345
444
|
count: z.ZodNumber;
|
346
|
-
category: z.
|
445
|
+
category: z.ZodEnum<{
|
446
|
+
SERVER: "SERVER";
|
447
|
+
CLIENT: "CLIENT";
|
448
|
+
}>;
|
347
449
|
}, z.core.$strip>>>;
|
348
450
|
locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
349
451
|
account: z.ZodOptional<z.ZodString>;
|
350
452
|
datetime: z.ZodNumber;
|
351
453
|
site: z.ZodString;
|
352
454
|
countryRegion: z.ZodString;
|
353
|
-
category: z.
|
455
|
+
category: z.ZodEnum<{
|
456
|
+
SERVER: "SERVER";
|
457
|
+
CLIENT: "CLIENT";
|
458
|
+
}>;
|
354
459
|
count: z.ZodNumber;
|
355
460
|
}, z.core.$strip>>>;
|
356
461
|
queries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
@@ -361,7 +466,10 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
361
466
|
search: z.ZodOptional<z.ZodString>;
|
362
467
|
hash: z.ZodOptional<z.ZodString>;
|
363
468
|
count: z.ZodNumber;
|
364
|
-
category: z.
|
469
|
+
category: z.ZodEnum<{
|
470
|
+
SERVER: "SERVER";
|
471
|
+
CLIENT: "CLIENT";
|
472
|
+
}>;
|
365
473
|
}, z.core.$strip>>>;
|
366
474
|
referrers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
367
475
|
account: z.ZodOptional<z.ZodString>;
|
@@ -369,7 +477,10 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
369
477
|
site: z.ZodString;
|
370
478
|
referrer: z.ZodString;
|
371
479
|
count: z.ZodNumber;
|
372
|
-
category: z.
|
480
|
+
category: z.ZodEnum<{
|
481
|
+
SERVER: "SERVER";
|
482
|
+
CLIENT: "CLIENT";
|
483
|
+
}>;
|
373
484
|
}, z.core.$strip>>>;
|
374
485
|
resolutions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
375
486
|
account: z.ZodOptional<z.ZodString>;
|
@@ -377,7 +488,10 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
377
488
|
site: z.ZodString;
|
378
489
|
resolution: z.ZodString;
|
379
490
|
count: z.ZodNumber;
|
380
|
-
category: z.
|
491
|
+
category: z.ZodEnum<{
|
492
|
+
SERVER: "SERVER";
|
493
|
+
CLIENT: "CLIENT";
|
494
|
+
}>;
|
381
495
|
}, z.core.$strip>>>;
|
382
496
|
fingerprints: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
383
497
|
account: z.ZodOptional<z.ZodString>;
|
@@ -385,14 +499,28 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
385
499
|
site: z.ZodString;
|
386
500
|
fingerprint: z.ZodString;
|
387
501
|
count: z.ZodNumber;
|
388
|
-
category: z.
|
502
|
+
category: z.ZodEnum<{
|
503
|
+
SERVER: "SERVER";
|
504
|
+
CLIENT: "CLIENT";
|
505
|
+
}>;
|
389
506
|
}, z.core.$strip>>>;
|
390
|
-
|
507
|
+
metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
391
508
|
account: z.ZodOptional<z.ZodString>;
|
392
|
-
datetime: z.ZodNumber;
|
393
509
|
site: z.ZodString;
|
394
|
-
|
395
|
-
|
510
|
+
datetime: z.ZodNumber;
|
511
|
+
category: z.ZodEnum<{
|
512
|
+
SERVER: "SERVER";
|
513
|
+
CLIENT: "CLIENT";
|
514
|
+
}>;
|
515
|
+
metric: z.ZodUnion<readonly [z.ZodObject<{
|
516
|
+
type: z.ZodLiteral<"health">;
|
517
|
+
responseTimeMs: z.ZodNumber;
|
518
|
+
success: z.ZodBoolean;
|
519
|
+
}, z.core.$strip>, z.ZodObject<{
|
520
|
+
type: z.ZodString;
|
521
|
+
name: z.ZodString;
|
522
|
+
value: z.ZodNumber;
|
523
|
+
}, z.core.$strip>]>;
|
396
524
|
}, z.core.$strip>>>;
|
397
525
|
languages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
398
526
|
account: z.ZodOptional<z.ZodString>;
|
@@ -400,13 +528,19 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
400
528
|
site: z.ZodString;
|
401
529
|
language: z.ZodString;
|
402
530
|
count: z.ZodNumber;
|
403
|
-
category: z.
|
531
|
+
category: z.ZodEnum<{
|
532
|
+
SERVER: "SERVER";
|
533
|
+
CLIENT: "CLIENT";
|
534
|
+
}>;
|
404
535
|
}, z.core.$strip>>>;
|
405
536
|
rollups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
406
537
|
account: z.ZodString;
|
407
538
|
site: z.ZodString;
|
408
539
|
datetime: z.ZodNumber;
|
409
|
-
category: z.
|
540
|
+
category: z.ZodEnum<{
|
541
|
+
SERVER: "SERVER";
|
542
|
+
CLIENT: "CLIENT";
|
543
|
+
}>;
|
410
544
|
topReferrers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
411
545
|
referrer: z.ZodString;
|
412
546
|
count: z.ZodNumber;
|
@@ -443,7 +577,11 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
443
577
|
href: z.ZodString;
|
444
578
|
count: z.ZodNumber;
|
445
579
|
}, z.core.$strip>>>;
|
446
|
-
|
580
|
+
metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
581
|
+
count: z.ZodNumber;
|
582
|
+
sum: z.ZodNumber;
|
583
|
+
average: z.ZodNumber;
|
584
|
+
}, z.core.$strip>>>;
|
447
585
|
}, z.core.$strip>>>;
|
448
586
|
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
449
587
|
PK: z.ZodString;
|
@@ -458,14 +596,20 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
458
596
|
datetime: z.ZodNumber;
|
459
597
|
archived: z.ZodOptional<z.ZodBoolean>;
|
460
598
|
count: z.ZodNumber;
|
461
|
-
category: z.
|
599
|
+
category: z.ZodEnum<{
|
600
|
+
SERVER: "SERVER";
|
601
|
+
CLIENT: "CLIENT";
|
602
|
+
}>;
|
462
603
|
}, z.core.$strip>>>;
|
463
604
|
google: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
464
605
|
account: z.ZodString;
|
465
606
|
email: z.ZodString;
|
466
607
|
site: z.ZodString;
|
467
608
|
datetime: z.ZodNumber;
|
468
|
-
category: z.
|
609
|
+
category: z.ZodEnum<{
|
610
|
+
SERVER: "SERVER";
|
611
|
+
CLIENT: "CLIENT";
|
612
|
+
}>;
|
469
613
|
totals: z.ZodObject<{
|
470
614
|
clicks: z.ZodNumber;
|
471
615
|
impressions: z.ZodNumber;
|
@@ -484,7 +628,10 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
484
628
|
email: z.ZodString;
|
485
629
|
site: z.ZodString;
|
486
630
|
datetime: z.ZodNumber;
|
487
|
-
category: z.
|
631
|
+
category: z.ZodEnum<{
|
632
|
+
SERVER: "SERVER";
|
633
|
+
CLIENT: "CLIENT";
|
634
|
+
}>;
|
488
635
|
totals: z.ZodObject<{
|
489
636
|
clicks: z.ZodNumber;
|
490
637
|
impressions: z.ZodNumber;
|
@@ -503,7 +650,10 @@ export declare const SiteDataSchema: z.ZodObject<{
|
|
503
650
|
email: z.ZodString;
|
504
651
|
site: z.ZodString;
|
505
652
|
datetime: z.ZodNumber;
|
506
|
-
category: z.
|
653
|
+
category: z.ZodEnum<{
|
654
|
+
SERVER: "SERVER";
|
655
|
+
CLIENT: "CLIENT";
|
656
|
+
}>;
|
507
657
|
totals: z.ZodObject<{
|
508
658
|
clicks: z.ZodNumber;
|
509
659
|
impressions: z.ZodNumber;
|
@@ -565,8 +715,10 @@ export type Location = z.infer<typeof LocationSchema>;
|
|
565
715
|
export type Language = z.infer<typeof LanguageSchema>;
|
566
716
|
export type Fingerprint = z.infer<typeof FingerprintSchema>;
|
567
717
|
export type Event = z.infer<typeof EventSchema>;
|
568
|
-
export type
|
718
|
+
export type MetricItem = z.infer<typeof MetricItemSchema>;
|
719
|
+
export type Metric = z.infer<typeof MetricSchema>;
|
569
720
|
export type ModelError = z.infer<typeof ModelErrorSchema>;
|
721
|
+
export type RollupMetricSummary = z.infer<typeof RollupMetricSummarySchema>;
|
570
722
|
export type Rollup = z.infer<typeof RollupSchema>;
|
571
723
|
export type SiteData = z.infer<typeof SiteDataSchema>;
|
572
724
|
export type SiteDetails = z.infer<typeof SiteDetailsSchema>;
|
@@ -576,6 +728,8 @@ export type PostSiteTrackData = z.infer<typeof PostSiteTrackDataSchema>;
|
|
576
728
|
export type PostSiteTrack = z.infer<typeof PostSiteTrackSchema>;
|
577
729
|
export type PostErrorData = z.infer<typeof PostErrorDataSchema>;
|
578
730
|
export type PostError = z.infer<typeof PostErrorSchema>;
|
731
|
+
export type PostMetricData = z.infer<typeof PostMetricDataSchema>;
|
732
|
+
export type PostMetric = z.infer<typeof PostMetricSchema>;
|
579
733
|
export type PostAccount = z.infer<typeof PostAccountSchema>;
|
580
734
|
export type DeleteAccount = z.infer<typeof DeleteAccountSchema>;
|
581
735
|
export type ArchiveErrors = z.infer<typeof ArchiveErrorsSchema>;
|