Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.d.ts « types « CoreVue « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3cd3a21727333ef1802dac0d53447c8845d1258b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

import { IAngularStatic } from 'angular';

/**
 * global ajax queue
 *
 * @type {Array} array holding XhrRequests with automatic cleanup
 */
interface GlobalAjaxQueue extends Array<XMLHttpRequest|null> {
  active:number;

  /**
   * Removes all finished requests from the queue.
   *
   * @return {void}
   */
  clean();

  /**
   * Extend Array.push with automatic cleanup for finished requests
   *
   * @return {Object}
   */
  push();

  /**
   * Extend with abort function to abort all queued requests
   *
   * @return {void}
   */
  abort();
}

interface PiwikPopoverGlobal {
  isOpen();
}

let Piwik_Popover: PiwikPopoverGlobal;

interface PiwikHelperGlobal {
  escape(text: string): string;
  redirect(params: any);
  htmlDecode(encoded: string): string;
}

let piwikHelper: PiwikHelperGlobal;

interface BroadcastGlobal {
  getValueFromUrl(paramName: string, url?: string): string;
  getValueFromHash(paramName: string, url?: string): string;
  isWidgetizeRequestWithoutSession(): boolean;
}

let broadcast: BroadcastGlobal;

interface PiwikGlobal {
  timezoneOffset: number;
  addCustomPeriod: (name: string, periodClass: any) => void;
  shouldPropagateTokenAuth: boolean;
  token_auth: string;
  idSite: string|number;
  siteName: string;
  period?: string;
  currentDateString?: string;
  startDateString?: string;
  endDateString?: string;
  userCapabilities: string[];
  piwik_url: string;
  helper: PiwikHelperGlobal;
  broadcast: BroadcastGlobal;

  updatePeriodParamsFromUrl(): void;
  updateDateInTitle(date: string, period: string): void;
  hasUserCapability(capability: string): boolean;
}

let piwik: PiwikGlobal;

// add the objects to Window so we can access them through window if needed
declare global {
  interface Window {
    angular: IAngularStatic;
    globalAjaxQueue: GlobalAjaxQueue;
    piwik: PiwikGlobal;
    piwikHelper: PiwikHelperGlobal;
    broadcast: BroadcastGlobal;
    hasBlockedContent: boolean;

    _pk_translate(translationStringId: string, values: string[]): string;
  }
}