@gemx-dev/clarity-js 0.8.39

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.
Files changed (118) hide show
  1. package/README.md +1 -0
  2. package/build/clarity.extended.js +1 -0
  3. package/build/clarity.insight.js +1 -0
  4. package/build/clarity.js +6433 -0
  5. package/build/clarity.livechat.js +1 -0
  6. package/build/clarity.min.js +1 -0
  7. package/build/clarity.module.js +6429 -0
  8. package/build/clarity.performance.js +1 -0
  9. package/build/dynamic/clarity.crisp.js +1 -0
  10. package/build/dynamic/clarity.tidio.js +1 -0
  11. package/package.json +55 -0
  12. package/rollup.config.ts +161 -0
  13. package/src/clarity.ts +71 -0
  14. package/src/core/api.ts +8 -0
  15. package/src/core/config.ts +29 -0
  16. package/src/core/copy.ts +3 -0
  17. package/src/core/dynamic.ts +57 -0
  18. package/src/core/event.ts +53 -0
  19. package/src/core/hash.ts +19 -0
  20. package/src/core/history.ts +71 -0
  21. package/src/core/index.ts +81 -0
  22. package/src/core/measure.ts +19 -0
  23. package/src/core/report.ts +35 -0
  24. package/src/core/scrub.ts +202 -0
  25. package/src/core/task.ts +181 -0
  26. package/src/core/throttle.ts +46 -0
  27. package/src/core/time.ts +26 -0
  28. package/src/core/timeout.ts +10 -0
  29. package/src/core/version.ts +2 -0
  30. package/src/data/baseline.ts +162 -0
  31. package/src/data/compress.ts +31 -0
  32. package/src/data/consent.ts +75 -0
  33. package/src/data/custom.ts +23 -0
  34. package/src/data/dimension.ts +53 -0
  35. package/src/data/encode.ts +155 -0
  36. package/src/data/envelope.ts +53 -0
  37. package/src/data/extract.ts +211 -0
  38. package/src/data/index.ts +50 -0
  39. package/src/data/limit.ts +44 -0
  40. package/src/data/metadata.ts +408 -0
  41. package/src/data/metric.ts +51 -0
  42. package/src/data/ping.ts +36 -0
  43. package/src/data/signal.ts +30 -0
  44. package/src/data/summary.ts +34 -0
  45. package/src/data/token.ts +39 -0
  46. package/src/data/upgrade.ts +44 -0
  47. package/src/data/upload.ts +333 -0
  48. package/src/data/variable.ts +84 -0
  49. package/src/diagnostic/encode.ts +40 -0
  50. package/src/diagnostic/fraud.ts +37 -0
  51. package/src/diagnostic/index.ts +13 -0
  52. package/src/diagnostic/internal.ts +28 -0
  53. package/src/diagnostic/script.ts +35 -0
  54. package/src/dynamic/agent/blank.ts +2 -0
  55. package/src/dynamic/agent/crisp.ts +40 -0
  56. package/src/dynamic/agent/encode.ts +25 -0
  57. package/src/dynamic/agent/index.ts +8 -0
  58. package/src/dynamic/agent/livechat.ts +58 -0
  59. package/src/dynamic/agent/tidio.ts +44 -0
  60. package/src/global.ts +6 -0
  61. package/src/index.ts +9 -0
  62. package/src/insight/blank.ts +14 -0
  63. package/src/insight/encode.ts +61 -0
  64. package/src/insight/snapshot.ts +115 -0
  65. package/src/interaction/change.ts +38 -0
  66. package/src/interaction/click.ts +163 -0
  67. package/src/interaction/clipboard.ts +32 -0
  68. package/src/interaction/encode.ts +207 -0
  69. package/src/interaction/focus.ts +25 -0
  70. package/src/interaction/index.ts +60 -0
  71. package/src/interaction/input.ts +58 -0
  72. package/src/interaction/pointer.ts +137 -0
  73. package/src/interaction/resize.ts +50 -0
  74. package/src/interaction/scroll.ts +129 -0
  75. package/src/interaction/selection.ts +66 -0
  76. package/src/interaction/submit.ts +30 -0
  77. package/src/interaction/timeline.ts +69 -0
  78. package/src/interaction/unload.ts +26 -0
  79. package/src/interaction/visibility.ts +28 -0
  80. package/src/layout/animation.ts +133 -0
  81. package/src/layout/custom.ts +43 -0
  82. package/src/layout/discover.ts +31 -0
  83. package/src/layout/document.ts +46 -0
  84. package/src/layout/dom.ts +439 -0
  85. package/src/layout/encode.ts +154 -0
  86. package/src/layout/index.ts +42 -0
  87. package/src/layout/mutation.ts +412 -0
  88. package/src/layout/node.ts +294 -0
  89. package/src/layout/offset.ts +19 -0
  90. package/src/layout/region.ts +151 -0
  91. package/src/layout/schema.ts +63 -0
  92. package/src/layout/selector.ts +82 -0
  93. package/src/layout/style.ts +160 -0
  94. package/src/layout/target.ts +32 -0
  95. package/src/layout/traverse.ts +28 -0
  96. package/src/performance/blank.ts +10 -0
  97. package/src/performance/encode.ts +31 -0
  98. package/src/performance/index.ts +12 -0
  99. package/src/performance/interaction.ts +125 -0
  100. package/src/performance/navigation.ts +31 -0
  101. package/src/performance/observer.ts +112 -0
  102. package/src/queue.ts +33 -0
  103. package/test/core.test.ts +139 -0
  104. package/test/helper.ts +167 -0
  105. package/test/html/core.html +34 -0
  106. package/test/stub.test.ts +7 -0
  107. package/test/tsconfig.test.json +6 -0
  108. package/tsconfig.json +21 -0
  109. package/tslint.json +33 -0
  110. package/types/agent.d.ts +39 -0
  111. package/types/core.d.ts +150 -0
  112. package/types/data.d.ts +568 -0
  113. package/types/diagnostic.d.ts +24 -0
  114. package/types/global.d.ts +30 -0
  115. package/types/index.d.ts +40 -0
  116. package/types/interaction.d.ts +174 -0
  117. package/types/layout.d.ts +277 -0
  118. package/types/performance.d.ts +31 -0
@@ -0,0 +1,139 @@
1
+ import { assert } from "chai";
2
+ import { Browser, Page } from "playwright";
3
+ import { changes, clicks, inputs, launch, markup, node, text } from "./helper";
4
+ import { decode } from "clarity-decode";
5
+
6
+ let browser: Browser;
7
+ let page: Page;
8
+
9
+ describe("Core Tests", () => {
10
+ before(async () => {
11
+ browser = await launch();
12
+ });
13
+
14
+ beforeEach(async () => {
15
+ page = await browser.newPage();
16
+ await page.goto("about:blank");
17
+ });
18
+
19
+ afterEach(async () => {
20
+ await page.close();
21
+ });
22
+
23
+ after(async () => {
24
+ await browser.close();
25
+ browser = null;
26
+ });
27
+
28
+ it("should mask sensitive content by default", async () => {
29
+ let encoded: string[] = await markup(page, "core.html");
30
+ let decoded = encoded.map((x) => decode(x));
31
+ let heading = text(decoded, "one");
32
+ let address = text(decoded, "two");
33
+ let email = node(decoded, "attributes.id", "eml");
34
+ let password = node(decoded, "attributes.id", "pwd");
35
+ let search = node(decoded, "attributes.id", "search");
36
+ let card = node(decoded, "attributes.id", "cardnum");
37
+ let option = text(decoded, "option1");
38
+ let textarea = text(decoded, "textarea");
39
+ let click = clicks(decoded)[0];
40
+ let input = inputs(decoded)[0];
41
+ let group = changes(decoded);
42
+
43
+ // Non-sensitive fields continue to pass through with sensitive bits masked off
44
+ assert.equal(heading, "Thanks for your order #▫▪▪▫▫▫▪▪");
45
+
46
+ // Sensitive fields, including input fields, are randomized and masked
47
+ assert.equal(address, "•••••• ••••• ••••• ••••• ••••• •••••");
48
+ assert.equal(email.attributes.value, "••••• •••• •••• ••••");
49
+ assert.equal(password.attributes.value, "••••");
50
+ assert.equal(search.attributes.value, "••••• •••• ••••");
51
+ assert.equal(card.attributes.value, "•••••");
52
+ assert.equal(textarea, "••••• •••••");
53
+ assert.equal(option, "• •••••");
54
+
55
+ // Clicked text and input value should be consistent with uber masking configuration
56
+ assert.equal(click.data.text, "Hello ▪▪▪▫▪");
57
+ assert.equal(input.data.value, "••••• •••• •••• ••••");
58
+ assert.equal(group.length, 2);
59
+ // Search change - we should captured mangled input and hash
60
+ assert.equal(group[0].data.type, "search");
61
+ assert.equal(group[0].data.value, "••••• •••• •••• ••••");
62
+ assert.equal(group[0].data.checksum, "4y7m6");
63
+ // Password change - we should capture placholder value and empty hash
64
+ assert.equal(group[1].data.type, "password");
65
+ assert.equal(group[1].data.value, "••••");
66
+ assert.equal(group[1].data.checksum, "");
67
+ });
68
+
69
+ it("should mask all text in strict mode", async () => {
70
+ let encoded: string[] = await markup(page, "core.html", { content: false });
71
+ let decoded = encoded.map((x) => decode(x));
72
+ let heading = text(decoded, "one");
73
+ let address = text(decoded, "two");
74
+ let email = node(decoded, "attributes.id", "eml");
75
+ let password = node(decoded, "attributes.id", "pwd");
76
+ let search = node(decoded, "attributes.id", "search");
77
+ let card = node(decoded, "attributes.id", "cardnum");
78
+ let click = clicks(decoded)[0];
79
+ let input = inputs(decoded)[0];
80
+ let option = text(decoded, "option1");
81
+
82
+ // All fields are randomized and masked
83
+ assert.equal(heading, "• ••••• ••••• ••••• ••••• •••••");
84
+ assert.equal(address, "•••••• ••••• ••••• ••••• ••••• •••••");
85
+ assert.equal(email.attributes.value, "••••• •••• •••• ••••");
86
+ assert.equal(password.attributes.value, "••••");
87
+ assert.equal(search.attributes.value, "••••• •••• ••••");
88
+ assert.equal(card.attributes.value, "•••••");
89
+ assert.equal(option, "• •••••");
90
+
91
+ // Clicked text and input value should also be masked in strict mode
92
+ assert.equal(click.data.text, "••••• •••• ••••");
93
+ assert.equal(input.data.value, "••••• •••• •••• ••••");
94
+ });
95
+
96
+ it("should unmask non-sensitive text in relaxed mode", async () => {
97
+ let encoded: string[] = await markup(page, "core.html", { unmask: ["body"] });
98
+ let decoded = encoded.map((x) => decode(x));
99
+ let heading = text(decoded, "one");
100
+ let address = text(decoded, "two");
101
+ let email = node(decoded, "attributes.id", "eml");
102
+ let password = node(decoded, "attributes.id", "pwd");
103
+ let search = node(decoded, "attributes.id", "search");
104
+ let card = node(decoded, "attributes.id", "cardnum");
105
+ let click = clicks(decoded)[0];
106
+ let input = inputs(decoded)[0];
107
+ let option = text(decoded, "option1");
108
+
109
+ // Text flows through unmasked for non-sensitive fields, with exception of input fields
110
+ assert.equal(heading, "Thanks for your order #2AB700GH");
111
+ assert.equal(address, "1 Microsoft Way, Redmond, WA - 98052");
112
+ assert.equal(search.attributes.value, "••••• •••• ••••");
113
+ assert.equal(option, "• •••••");
114
+
115
+ // Sensitive fields are still masked
116
+ assert.equal(email.attributes.value, "••••• •••• •••• ••••");
117
+ assert.equal(password.attributes.value, "••••");
118
+ assert.equal(card.attributes.value, "•••••");
119
+
120
+ // Clicked text comes through unmasked in relaxed mode but input is still masked
121
+ assert.equal(click.data.text, "Hello Wor1d");
122
+ assert.equal(input.data.value, "••••• •••• •••• ••••");
123
+ });
124
+
125
+ it("should respect mask config even in relaxed mode", async () => {
126
+ let encoded: string[] = await markup(page, "core.html", { mask: ["#mask"], unmask: ["body"] });
127
+ let decoded = encoded.map((x) => decode(x));
128
+ let subtree = text(decoded, "child");
129
+ let click = clicks(decoded)[0];
130
+ let input = inputs(decoded)[0];
131
+
132
+ // Masked sub-trees continue to stay masked
133
+ assert.equal(subtree, "••••• •••••");
134
+
135
+ // Clicked text is masked due to masked configuration and input value is also masked
136
+ assert.equal(click.data.text, "••••• •••• ••••");
137
+ assert.equal(input.data.value, "••••• •••• •••• ••••");
138
+ });
139
+ });
package/test/helper.ts ADDED
@@ -0,0 +1,167 @@
1
+ import { Core, Data, decode, Interaction, Layout } from "clarity-decode";
2
+ import * as fs from "fs";
3
+ import * as url from "url";
4
+ import * as path from "path";
5
+ import { Browser, Page, chromium } from "playwright";
6
+
7
+ export async function launch(): Promise<Browser> {
8
+ return chromium.launch({ headless: false, args: ["--no-sandbox"] });
9
+ }
10
+
11
+ export async function markup(page: Page, file: string, override: Core.Config = null): Promise<string[]> {
12
+ const htmlPath = path.resolve(__dirname, `./html/${file}`);
13
+ const htmlFileUrl = url.pathToFileURL(htmlPath).toString();
14
+ const html = fs.readFileSync(htmlPath, "utf8");
15
+ await Promise.all([page.goto(htmlFileUrl), page.waitForNavigation()]);
16
+ await page.setContent(
17
+ html.replace(
18
+ "</body>",
19
+ `
20
+ <script>
21
+ window.payloads = [];
22
+ ${fs.readFileSync(path.resolve(__dirname, `../build/clarity.min.js`), "utf8")};
23
+ clarity("start", ${config(override)});
24
+ </script>
25
+ </body>
26
+ `
27
+ )
28
+ );
29
+ await page.hover("#two");
30
+ await page.click("#child");
31
+ await page.locator("#search").fill("");
32
+ await page.locator("#search").type("query with numb3rs");
33
+ await page.locator("#pwd").type("p1ssw0rd");
34
+ await page.locator("#eml").fill("");
35
+ await page.locator("#eml").type("hello@world.com");
36
+ await page.waitForFunction("payloads && payloads.length > 2");
37
+ return await page.evaluate("payloads");
38
+ }
39
+
40
+ export function clicks(decoded: Data.DecodedPayload[]): Interaction.ClickEvent[] {
41
+ let output: Interaction.ClickEvent[] = [];
42
+ for (let i = decoded.length - 1; i >= 0; i--) {
43
+ if (decoded[i].click) {
44
+ for (let j = 0; j < decoded[i].click.length; j++) {
45
+ output.push(decoded[i].click[j]);
46
+ }
47
+ }
48
+ }
49
+ return output;
50
+ }
51
+
52
+ export function inputs(decoded: Data.DecodedPayload[]): Interaction.InputEvent[] {
53
+ let output: Interaction.InputEvent[] = [];
54
+ for (let i = decoded.length - 1; i >= 0; i--) {
55
+ if (decoded[i].input) {
56
+ for (let j = 0; j < decoded[i].input.length; j++) {
57
+ output.push(decoded[i].input[j]);
58
+ }
59
+ }
60
+ }
61
+ return output;
62
+ }
63
+
64
+ export function changes(decoded: Data.DecodedPayload[]): Interaction.ChangeEvent[] {
65
+ let output: Interaction.ChangeEvent[] = [];
66
+ for (let i = decoded.length - 1; i >= 0; i--) {
67
+ if (decoded[i].change) {
68
+ for (let j = 0; j < decoded[i].change.length; j++) {
69
+ output.push(decoded[i].change[j]);
70
+ }
71
+ }
72
+ }
73
+ return output;
74
+ }
75
+
76
+ export function node(
77
+ decoded: Data.DecodedPayload[],
78
+ key: string,
79
+ value: string | number,
80
+ tag: string = null
81
+ ): Layout.DomData {
82
+ let sub = null;
83
+
84
+ // Exploding nested keys into key and sub key
85
+ if (key.indexOf(".") > 0) {
86
+ const parts = key.split(".");
87
+ if (parts.length === 2) {
88
+ key = parts[0];
89
+ sub = parts[1];
90
+ }
91
+ }
92
+
93
+ // Walking over the decoded payload to find the right match
94
+ for (let i = decoded.length - 1; i >= 0; i--) {
95
+ if (decoded[i].dom) {
96
+ for (let j = 0; j < decoded[i].dom.length; j++) {
97
+ if (decoded[i].dom[j].data) {
98
+ for (let k = 0; k < decoded[i].dom[j].data.length; k++) {
99
+ let d = decoded[i].dom[j].data[k];
100
+ if ((sub && d[key] && d[key][sub] === value) || (d[key] && d[key] === value)) {
101
+ if ((tag && d.tag === tag) || tag === null) {
102
+ return d;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ return null;
111
+ }
112
+
113
+ export function text(decoded: Data.DecodedPayload[], id: string): string {
114
+ let parent = node(decoded, "attributes.id", id);
115
+ if (parent) {
116
+ let child = node(decoded, "parent", parent.id, "*T");
117
+ if (child && child.value) {
118
+ return child.value;
119
+ }
120
+ }
121
+ return null;
122
+ }
123
+
124
+ function config(override: Core.Config): string {
125
+ const settings = {
126
+ delay: 100,
127
+ content: true,
128
+ fraud: [],
129
+ regions: [],
130
+ mask: [],
131
+ unmask: [],
132
+ upload: (payload) => {
133
+ window["payloads"].push(payload);
134
+ window["clarity"]("upgrade", "test");
135
+ },
136
+ };
137
+
138
+ // Process overrides
139
+ if (override) {
140
+ for (let key of Object.keys(override)) {
141
+ settings[key] = override[key];
142
+ }
143
+ }
144
+
145
+ // Serialize configuration
146
+ let output = "";
147
+ for (let key of Object.keys(settings)) {
148
+ switch (key) {
149
+ case "upload":
150
+ output += `${JSON.stringify(key)}: ${settings[key].toString()},`;
151
+ break;
152
+ case "projectId":
153
+ case "mask":
154
+ case "unmask":
155
+ case "regions":
156
+ case "cookies":
157
+ case "fraud":
158
+ output += `${JSON.stringify(key)}: ${JSON.stringify(settings[key])},`;
159
+ break;
160
+ default:
161
+ output += `${JSON.stringify(key)}: ${settings[key]},`;
162
+ break;
163
+ }
164
+ }
165
+ output += `"projectId": "test"`;
166
+ return "{" + output + "}";
167
+ }
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Core Tests</title>
5
+ <style>
6
+ input,
7
+ textarea,
8
+ select {
9
+ margin: 10px;
10
+ display: block;
11
+ }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <div>
16
+ <h1 id="one">Thanks for your order #2AB700GH</h1>
17
+ <p id="two" class="address-details">1 Microsoft Way, Redmond, WA - 98052</p>
18
+ </div>
19
+ <div id="mask">
20
+ <span id="child">Hello Wor1d</span>
21
+ </div>
22
+ <form name="login">
23
+ <input type="email" id="eml" title="Email" value="random@email.test" />
24
+ <input type="password" id="pwd" title="Password" maxlength="16" value="passw0rd" />
25
+ <input type="search" id="search" title="Search" value="hello w0rld" />
26
+ <input type="text" id="cardnum" title="CC" value="1234" />
27
+ <textarea id="textarea" autocapitalize="off" role="combobox" rows="5" placeholder="" spellcheck="false">Hell0 World</textarea>
28
+ <select id="select" ng-options="origin.code" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
29
+ <option id="option1" label="Halifax" value="string:YHZ">Halifax</option>
30
+ <option id="option2" label="Montréal" value="string:YUL" selected="selected">Montréal</option>
31
+ </select>
32
+ </form>
33
+ </body>
34
+ </html>
@@ -0,0 +1,7 @@
1
+ import { assert } from 'chai';
2
+
3
+ describe('Stub Tests! Replace with working real tests!', () => {
4
+ it('should be a successful test', () => {
5
+ assert.isTrue(true);
6
+ });
7
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs"
5
+ }
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "esnext",
4
+ "target": "es5",
5
+ "lib": ["es6", "dom", "es2016", "es2017"],
6
+ "moduleResolution": "node",
7
+ "forceConsistentCasingInFileNames": true,
8
+ "noImplicitReturns": true,
9
+ "noUnusedLocals": true,
10
+ "noUnusedParameters": true,
11
+ "resolveJsonModule": true,
12
+ "esModuleInterop": true,
13
+ "baseUrl": ".",
14
+ "paths": {
15
+ "@src/*": ["src/*"],
16
+ "@clarity-types/*": ["types/*"]
17
+ }
18
+ },
19
+ "include":["src/**/*.ts","types/**/*.d.ts", "rollup.config.ts"],
20
+ "exclude": ["test", "node_modules", "build"]
21
+ }
package/tslint.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "extends": "tslint:recommended",
3
+ "rules": {
4
+ "max-line-length": [
5
+ true,
6
+ 140
7
+ ],
8
+ "no-console": [
9
+ false
10
+ ],
11
+ "no-string-literal": false,
12
+ "prefer-const": false,
13
+ "prefer-for-of": false,
14
+ "object-literal-sort-keys": false,
15
+ "one-variable-per-declaration": false,
16
+ "trailing-comma": [
17
+ false
18
+ ],
19
+ "variable-name": false,
20
+ "interface-name": false,
21
+ "interface-over-type-literal": false,
22
+ "only-arrow-functions": false,
23
+ "typedef": [
24
+ true,
25
+ "call-signature",
26
+ "parameter",
27
+ "property-declaration",
28
+ "member-variable-declaration",
29
+ "object-destructuring",
30
+ "array-destructuring"
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,39 @@
1
+ export const enum Action {
2
+ AgentOnline,
3
+ AgentOffline,
4
+ AgentHidden,
5
+ AgentMaximized,
6
+ AgentMinimized,
7
+ AgentMessage,
8
+ HumanMessage,
9
+ }
10
+
11
+ export const enum AuthorType {
12
+ Agent = "agent",
13
+ Customer = "customer",
14
+ }
15
+
16
+ export const enum Visibility {
17
+ Maximized = "maximized",
18
+ Minimized = "minimized",
19
+ Hidden = "hidden",
20
+ }
21
+
22
+ export const enum Availability {
23
+ Online = "online",
24
+ Offline = "offline",
25
+ }
26
+
27
+ export interface VisibilityEvent {
28
+ visibility: Visibility;
29
+ }
30
+
31
+ export interface AvailabilityEvent {
32
+ availability: Availability;
33
+ }
34
+
35
+ export interface NewEvent {
36
+ author: {
37
+ type: AuthorType;
38
+ };
39
+ }
@@ -0,0 +1,150 @@
1
+ import * as Data from "./data";
2
+
3
+ type TaskFunction = () => Promise<void>;
4
+ type TaskResolve = () => void;
5
+ type UploadCallback = (data: string) => void;
6
+ type Region = [number /* RegionId */, string /* Query Selector */];
7
+ type Checksum = [number /* FraudId */, string /* Query Selector */];
8
+
9
+ /* Enum */
10
+
11
+ export const enum Priority {
12
+ Normal = 0,
13
+ High = 1
14
+ }
15
+
16
+ export const enum Time {
17
+ Second = 1000,
18
+ Minute = 60 * 1000,
19
+ Hour = 60 * 60 * 1000,
20
+ Day = 24 * 60 * 60 * 1000
21
+ }
22
+
23
+ export const enum Task {
24
+ Wait = 0,
25
+ Run = 1,
26
+ Stop = 2
27
+ }
28
+
29
+ export const enum ExtractSource {
30
+ Javascript = 0,
31
+ Cookie = 1,
32
+ Text = 2,
33
+ Fragment = 3,
34
+ Hash = 4
35
+ }
36
+
37
+ export const enum Type {
38
+ Array = 1,
39
+ Object = 2,
40
+ Simple = 3
41
+ }
42
+
43
+ export type Syntax = {
44
+ name: string,
45
+ type: Type,
46
+ condition: string
47
+ }
48
+
49
+ export const enum Privacy {
50
+ None = 0,
51
+ Sensitive = 1,
52
+ Text = 2,
53
+ TextImage = 3,
54
+ Exclude = 4,
55
+ Snapshot = 5
56
+ }
57
+
58
+ /* Helper Interfaces */
59
+
60
+ export interface Module {
61
+ start: () => void;
62
+ stop: () => void;
63
+ }
64
+
65
+ export interface Tasks {
66
+ [key: number]: TaskInfo;
67
+ }
68
+
69
+ export interface TaskInfo {
70
+ start: number;
71
+ calls: number;
72
+ yield: number;
73
+ }
74
+
75
+ export interface Timer {
76
+ id: string;
77
+ cost: Data.Metric;
78
+ }
79
+
80
+ export interface RequestIdleCallbackOptions {
81
+ timeout: number;
82
+ }
83
+
84
+ export interface RequestIdleCallbackDeadline {
85
+ didTimeout: boolean;
86
+ timeRemaining: (() => number);
87
+ }
88
+
89
+ export interface AsyncTask {
90
+ task: TaskFunction;
91
+ resolve: TaskResolve;
92
+ id: string;
93
+ }
94
+
95
+ export interface OffsetDistance {
96
+ x: number;
97
+ y: number;
98
+ }
99
+
100
+ export interface BrowserEvent {
101
+ event: string;
102
+ listener: EventListener;
103
+ options: {
104
+ capture: boolean;
105
+ passive: boolean;
106
+ };
107
+ }
108
+
109
+ export interface Report {
110
+ v: string; // Version
111
+ p: string; // Project Id
112
+ u: string; // User Id
113
+ s: string; // Session Id
114
+ n: number; // Page Number
115
+ m?: string; // Message, optional
116
+ e?: string; // Error Stack, optional
117
+ }
118
+
119
+ export interface Config {
120
+ projectId?: string;
121
+ delay?: number;
122
+ lean?: boolean;
123
+ lite?: boolean;
124
+ track?: boolean;
125
+ content?: boolean;
126
+ drop?: string[];
127
+ mask?: string[];
128
+ unmask?: string[];
129
+ regions?: Region[];
130
+ cookies?: string[];
131
+ fraud?: boolean;
132
+ checksum?: Checksum[];
133
+ report?: string;
134
+ upload?: string | UploadCallback;
135
+ fallback?: string;
136
+ upgrade?: (key: string) => void;
137
+ action?: (key: string) => void;
138
+ dob?: number;
139
+ delayDom?: boolean;
140
+ throttleDom?: boolean;
141
+ conversions?: boolean;
142
+ includeSubdomains?: boolean;
143
+ }
144
+
145
+ export const enum Constant {
146
+ Zone = "Zone",
147
+ Symbol = "__symbol__",
148
+ AddEventListener = "addEventListener",
149
+ RemoveEventListener = "removeEventListener"
150
+ }