@bunizao/contracts 0.23.0 → 0.24.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.
@@ -359,3 +359,106 @@ export interface SiteAnalyticsReportResult {
359
359
  }> | null;
360
360
  notices: string[];
361
361
  }
362
+ export declare const SITE_EXPLORE_ENDPOINT: '/api/analytics/explore';
363
+ export declare const SITE_EXPLORE_VIEWS: readonly ['traffic', 'decoy'];
364
+ export type SiteExploreView = typeof SITE_EXPLORE_VIEWS[number];
365
+ export declare const SITE_EXPLORE_RANGES: readonly ['24h', '7d', '30d', '90d'];
366
+ export type SiteExploreRange = typeof SITE_EXPLORE_RANGES[number];
367
+ export declare const SITE_EXPLORE_CLASSES: readonly ['human', 'bot', 'owner', 'all'];
368
+ export type SiteExploreClass = typeof SITE_EXPLORE_CLASSES[number];
369
+ export declare const SITE_EXPLORE_PARTS: readonly ['summary', 'panel', 'clicks', 'log'];
370
+ export type SiteExplorePart = typeof SITE_EXPLORE_PARTS[number];
371
+ export declare const SITE_EXPLORE_DIMS: {
372
+ readonly traffic: readonly ['page', 'section', 'referrer', 'channel', 'utm', 'country', 'city', 'device', 'browser', 'os', 'visitor'];
373
+ readonly decoy: readonly ['client', 'kind', 'reason', 'ua', 'path', 'network', 'country'];
374
+ };
375
+ export type SiteExploreDim<V extends SiteExploreView = SiteExploreView> = typeof SITE_EXPLORE_DIMS[V][number];
376
+ export declare const SITE_EXPLORE_METRICS: {
377
+ readonly traffic: readonly ['visitors', 'views', 'engagement', 'dwell'];
378
+ readonly decoy: readonly ['hits', 'clients', 'networks', 'named'];
379
+ };
380
+ export type SiteExploreMetric<V extends SiteExploreView = SiteExploreView> = typeof SITE_EXPLORE_METRICS[V][number];
381
+ export declare const SITE_EXPLORE_PANEL_LIMIT = 100;
382
+ export declare const SITE_EXPLORE_EMPTY = "(none)";
383
+ export interface SiteExploreSeries {
384
+ totals: Record<string, number>;
385
+ points: Record<string, number[]>;
386
+ }
387
+ export interface SiteExploreSummary {
388
+ view: SiteExploreView;
389
+ range: SiteExploreRange;
390
+ timezone: 'Australia/Melbourne';
391
+ bucket: 'hour' | 'day';
392
+ buckets: string[];
393
+ from: string;
394
+ to: string;
395
+ previousFrom: string | null;
396
+ current: SiteExploreSeries;
397
+ previous: SiteExploreSeries | null;
398
+ notices: Array<'compare_beyond_retention'>;
399
+ }
400
+ export interface SiteExploreRow {
401
+ key: string;
402
+ label: string;
403
+ count: number;
404
+ visitors: number;
405
+ }
406
+ export interface SiteExplorePanel {
407
+ dim: SiteExploreDim;
408
+ rows: SiteExploreRow[];
409
+ more: boolean;
410
+ }
411
+ export interface SiteExploreClickRow {
412
+ name: string;
413
+ label: string;
414
+ href: string;
415
+ clicks: number;
416
+ visitors: number;
417
+ }
418
+ export interface SiteExploreClicks {
419
+ rows: SiteExploreClickRow[];
420
+ more: boolean;
421
+ ignored: SiteExploreDim<'traffic'>[];
422
+ }
423
+ export interface SiteExploreVisit {
424
+ at: string;
425
+ until: string;
426
+ visitor: string;
427
+ session: string;
428
+ class: SiteAnalyticsTrafficClass;
429
+ country: string;
430
+ city: string;
431
+ network: string;
432
+ org: string;
433
+ device: string;
434
+ browser: string;
435
+ os: string;
436
+ entry: string;
437
+ referrer: string;
438
+ channel: string;
439
+ pages: number;
440
+ dwellMs: number;
441
+ interactions: number;
442
+ }
443
+ export interface SiteExploreDecoyHit {
444
+ at: string;
445
+ reason: string;
446
+ kind: string;
447
+ client: string;
448
+ ua: string;
449
+ path: string;
450
+ network: string;
451
+ org: string;
452
+ country: string;
453
+ method: string;
454
+ }
455
+ export type SiteExploreLog = {
456
+ view: 'traffic';
457
+ rows: SiteExploreVisit[];
458
+ more: boolean;
459
+ next: string | null;
460
+ } | {
461
+ view: 'decoy';
462
+ rows: SiteExploreDecoyHit[];
463
+ more: boolean;
464
+ };
package/dist/analytics.js CHANGED
@@ -36,6 +36,21 @@ var SITE_ANALYTICS_SURFACES = [
36
36
  "other"
37
37
  ];
38
38
  var SITE_ANALYTICS_REPORTS = ["overview", "pages", "clicks", "sources", "audience", "quality", "log", "visitor"];
39
+ var SITE_EXPLORE_ENDPOINT = "/api/analytics/explore";
40
+ var SITE_EXPLORE_VIEWS = ["traffic", "decoy"];
41
+ var SITE_EXPLORE_RANGES = ["24h", "7d", "30d", "90d"];
42
+ var SITE_EXPLORE_CLASSES = ["human", "bot", "owner", "all"];
43
+ var SITE_EXPLORE_PARTS = ["summary", "panel", "clicks", "log"];
44
+ var SITE_EXPLORE_DIMS = {
45
+ traffic: ["page", "section", "referrer", "channel", "utm", "country", "city", "device", "browser", "os", "visitor"],
46
+ decoy: ["client", "kind", "reason", "ua", "path", "network", "country"]
47
+ };
48
+ var SITE_EXPLORE_METRICS = {
49
+ traffic: ["visitors", "views", "engagement", "dwell"],
50
+ decoy: ["hits", "clients", "networks", "named"]
51
+ };
52
+ var SITE_EXPLORE_PANEL_LIMIT = 100;
53
+ var SITE_EXPLORE_EMPTY = "(none)";
39
54
  export {
40
55
  BLOG_ANALYTICS_ARTICLE_ENDPOINT,
41
56
  BLOG_ANALYTICS_COMPLETION_SCROLL_DEPTH,
@@ -53,5 +68,14 @@ export {
53
68
  SITE_ANALYTICS_REPORTS,
54
69
  SITE_ANALYTICS_REPORT_ENDPOINT,
55
70
  SITE_ANALYTICS_SESSION_IDLE_MS,
56
- SITE_ANALYTICS_SURFACES
71
+ SITE_ANALYTICS_SURFACES,
72
+ SITE_EXPLORE_CLASSES,
73
+ SITE_EXPLORE_DIMS,
74
+ SITE_EXPLORE_EMPTY,
75
+ SITE_EXPLORE_ENDPOINT,
76
+ SITE_EXPLORE_METRICS,
77
+ SITE_EXPLORE_PANEL_LIMIT,
78
+ SITE_EXPLORE_PARTS,
79
+ SITE_EXPLORE_RANGES,
80
+ SITE_EXPLORE_VIEWS
57
81
  };
package/dist/index.js CHANGED
@@ -36,6 +36,21 @@ var SITE_ANALYTICS_SURFACES = [
36
36
  "other"
37
37
  ];
38
38
  var SITE_ANALYTICS_REPORTS = ["overview", "pages", "clicks", "sources", "audience", "quality", "log", "visitor"];
39
+ var SITE_EXPLORE_ENDPOINT = "/api/analytics/explore";
40
+ var SITE_EXPLORE_VIEWS = ["traffic", "decoy"];
41
+ var SITE_EXPLORE_RANGES = ["24h", "7d", "30d", "90d"];
42
+ var SITE_EXPLORE_CLASSES = ["human", "bot", "owner", "all"];
43
+ var SITE_EXPLORE_PARTS = ["summary", "panel", "clicks", "log"];
44
+ var SITE_EXPLORE_DIMS = {
45
+ traffic: ["page", "section", "referrer", "channel", "utm", "country", "city", "device", "browser", "os", "visitor"],
46
+ decoy: ["client", "kind", "reason", "ua", "path", "network", "country"]
47
+ };
48
+ var SITE_EXPLORE_METRICS = {
49
+ traffic: ["visitors", "views", "engagement", "dwell"],
50
+ decoy: ["hits", "clients", "networks", "named"]
51
+ };
52
+ var SITE_EXPLORE_PANEL_LIMIT = 100;
53
+ var SITE_EXPLORE_EMPTY = "(none)";
39
54
  // src/admin.ts
40
55
  var ADMIN_COMMENT_REJECT_REASONS = ["spam", "promotional", "abuse", "off_topic", "personal_info"];
41
56
  var ADMIN_ACTIVITY_EVENTS = [
@@ -408,6 +423,15 @@ export {
408
423
  SITE_ANALYTICS_REPORT_ENDPOINT,
409
424
  SITE_ANALYTICS_SESSION_IDLE_MS,
410
425
  SITE_ANALYTICS_SURFACES,
426
+ SITE_EXPLORE_CLASSES,
427
+ SITE_EXPLORE_DIMS,
428
+ SITE_EXPLORE_EMPTY,
429
+ SITE_EXPLORE_ENDPOINT,
430
+ SITE_EXPLORE_METRICS,
431
+ SITE_EXPLORE_PANEL_LIMIT,
432
+ SITE_EXPLORE_PARTS,
433
+ SITE_EXPLORE_RANGES,
434
+ SITE_EXPLORE_VIEWS,
411
435
  SUBSCRIPTION_SOURCES,
412
436
  TELEGRAM_OPS_BASE_PATH,
413
437
  TELEGRAM_OPS_BROADCASTS_PATH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunizao/contracts",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Shared TypeScript contracts for buxx.me services and clients.",
5
5
  "type": "module",
6
6
  "sideEffects": false,