clarity-visualize 0.8.52 → 0.8.54-beta

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.
@@ -14,20 +14,6 @@ PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
15
  /* global Reflect, Promise */
16
16
 
17
- var extendStatics = function(d, b) {
18
- extendStatics = Object.setPrototypeOf ||
19
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
20
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
21
- return extendStatics(d, b);
22
- };
23
-
24
- function __extends(d, b) {
25
- if (typeof b !== "function" && b !== null)
26
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27
- extendStatics(d, b);
28
- function __() { this.constructor = d; }
29
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
30
- }
31
17
 
32
18
  function __awaiter(thisArg, _arguments, P, generator) {
33
19
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -186,8 +172,10 @@ function hash (input, precision) {
186
172
  hash = Math.abs(hashOne + (hashTwo * 11579));
187
173
  return (precision ? hash % Math.pow(2, precision) : hash).toString(36);
188
174
  }
175
+ // Pre-computed exclude class names (replaces Constant.ExcludeClassNames.split())
176
+ var ExcludeClassNamesList = ["load", "active", "fixed", "visible", "focus", "show", "collaps", "animat"];
189
177
 
190
- var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* Constant.ExcludeClassNames */.split("," /* Constant.Comma */);
178
+ var excludeClassNames = ExcludeClassNamesList;
191
179
  var selectorMap = {};
192
180
  function reset$8() {
193
181
  selectorMap = {};
@@ -1457,14 +1445,16 @@ var LayoutHelper = /** @class */ (function () {
1457
1445
  }
1458
1446
  };
1459
1447
  this.customElement = function (event) {
1460
- if (!_this.state.window.customElements.get(event.data.name)) {
1461
- _this.state.window.customElements.define(event.data.name, /** @class */ (function (_super) {
1462
- __extends(class_1, _super);
1463
- function class_1() {
1464
- return _super !== null && _super.apply(this, arguments) || this;
1465
- }
1466
- return class_1;
1467
- }(_this.state.window.HTMLElement)));
1448
+ var tagName = event.data.name;
1449
+ if (!_this.state.window.customElements.get(tagName)) {
1450
+ try {
1451
+ // Use eval to create class in target window context (avoids ES5 transpilation issues)
1452
+ var EmptyElement = _this.state.window.eval('(class extends HTMLElement { constructor() { super(); } })');
1453
+ _this.state.window.customElements.define(tagName, EmptyElement);
1454
+ }
1455
+ catch (e) {
1456
+ console.error("Failed to define custom element ".concat(tagName, ":"), e);
1457
+ }
1468
1458
  }
1469
1459
  };
1470
1460
  this.exists = function (hash) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clarity-visualize",
3
- "version": "0.8.52",
3
+ "version": "0.8.54-beta",
4
4
  "description": "An analytics library that uses web page interactions to generate aggregated insights",
5
5
  "author": "Microsoft Corp.",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "url": "https://github.com/Microsoft/clarity/issues"
28
28
  },
29
29
  "dependencies": {
30
- "clarity-decode": "^0.8.52"
30
+ "clarity-decode": "^0.8.54-beta"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@rollup/plugin-commonjs": "^24.0.0",
package/src/layout.ts CHANGED
@@ -245,8 +245,17 @@ export class LayoutHelper {
245
245
  }
246
246
 
247
247
  public customElement = (event: DecodedLayout.CustomElementEvent): void => {
248
- if (!this.state.window.customElements.get(event.data.name)) {
249
- this.state.window.customElements.define(event.data.name, class extends (this.state.window as typeof window).HTMLElement {});
248
+ const tagName = event.data.name;
249
+ if (!this.state.window.customElements.get(tagName)) {
250
+ try {
251
+ // Use eval to create class in target window context (avoids ES5 transpilation issues)
252
+ const EmptyElement = (this.state.window as any).eval(
253
+ '(class extends HTMLElement { constructor() { super(); } })'
254
+ );
255
+ this.state.window.customElements.define(tagName, EmptyElement);
256
+ } catch (e) {
257
+ console.error(`Failed to define custom element ${tagName}:`, e);
258
+ }
250
259
  }
251
260
  }
252
261