@gemx-dev/clarity-visualize 0.8.57 → 0.8.58

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.
@@ -392,7 +392,7 @@ var EnrichHelper = /** @class */ (function () {
392
392
  * @param canvasId - ID for the canvas element
393
393
  * @returns Canvas info with cleanup function
394
394
  */
395
- function createParentWindowCanvas(iframeDoc) {
395
+ function createParentWindowCanvas(iframeDoc, portalCanvasId) {
396
396
  var _a, _b;
397
397
  // Check if we're inside an iframe
398
398
  if (iframeDoc.defaultView === ((_a = iframeDoc.defaultView) === null || _a === void 0 ? void 0 : _a.top)) {
@@ -411,10 +411,11 @@ function createParentWindowCanvas(iframeDoc) {
411
411
  if (!iframeParent)
412
412
  throw new Error('Iframe parent not found');
413
413
  // Create canvas as sibling to iframe
414
- var canvas_1 = parentDoc.getElementById("clarity-heatmap-canvas" /* Constant.HeatmapCanvas */);
414
+ var canvasId = "".concat("clarity-heatmap-canvas" /* Constant.HeatmapCanvas */, "-").concat(portalCanvasId);
415
+ var canvas_1 = parentDoc.getElementById(canvasId);
415
416
  if (canvas_1 === null) {
416
417
  canvas_1 = parentDoc.createElement('canvas');
417
- canvas_1.id = "clarity-heatmap-canvas" /* Constant.HeatmapCanvas */;
418
+ canvas_1.id = canvasId;
418
419
  canvas_1.width = 0;
419
420
  canvas_1.height = 0;
420
421
  canvas_1.style.position = "absolute" /* Constant.Absolute */;
@@ -797,7 +798,7 @@ var HeatmapHelper = /** @class */ (function () {
797
798
  var doc = _this.state.window.document;
798
799
  var win = _this.state.window;
799
800
  var de = doc.documentElement;
800
- var isPortalCanvas = _this.state.options.portalCanvas;
801
+ var isPortalCanvas = !!_this.state.options.portalCanvasId;
801
802
  if (isPortalCanvas)
802
803
  return _this.createPortalCanvas(doc, win, de);
803
804
  var canvas = doc.getElementById("clarity-heatmap-canvas" /* Constant.HeatmapCanvas */);
@@ -938,7 +939,7 @@ var HeatmapHelper = /** @class */ (function () {
938
939
  return __generator(this, function (_a) {
939
940
  switch (_a.label) {
940
941
  case 0:
941
- isPortalCanvas = this.state.options.portalCanvas;
942
+ isPortalCanvas = !!this.state.options.portalCanvasId;
942
943
  if (!isPortalCanvas)
943
944
  return [2 /*return*/];
944
945
  return [4 /*yield*/, waitForDialogsRendered()];
@@ -954,7 +955,7 @@ var HeatmapHelper = /** @class */ (function () {
954
955
  try {
955
956
  canvas = (_a = _this.parentCanvasInfo) === null || _a === void 0 ? void 0 : _a.canvas;
956
957
  if (!canvas) {
957
- _this.parentCanvasInfo = createParentWindowCanvas(doc);
958
+ _this.parentCanvasInfo = createParentWindowCanvas(doc, _this.state.options.portalCanvasId);
958
959
  canvas = _this.parentCanvasInfo.canvas;
959
960
  // Add event listeners only once when canvas is created
960
961
  win.addEventListener("scroll", _this.redraw, true);
@@ -965,7 +966,7 @@ var HeatmapHelper = /** @class */ (function () {
965
966
  }
966
967
  }
967
968
  canvas.width = de.clientWidth;
968
- canvas.height = de.clientHeight + 4; // TODO: GEMX VERIFY
969
+ canvas.height = de.clientHeight; // TODO: GEMX VERIFY
969
970
  canvas.style.top = '0';
970
971
  canvas.style.left = '0';
971
972
  canvas.getContext("2d" /* Constant.Context */).clearRect(0, 0, canvas.width, canvas.height);
@@ -2344,7 +2345,7 @@ var Visualizer = /** @class */ (function () {
2344
2345
  return false;
2345
2346
  }
2346
2347
  };
2347
- this.html = function (decoded, target, portalCanvas, hash, useproxy, logerror, shortCircuitStrategy) {
2348
+ this.html = function (decoded, target, portalCanvasId, hash, useproxy, logerror, shortCircuitStrategy) {
2348
2349
  if (hash === void 0) { hash = null; }
2349
2350
  if (shortCircuitStrategy === void 0) { shortCircuitStrategy = 0 /* ShortCircuitStrategy.None */; }
2350
2351
  return __awaiter(_this, void 0, void 0, function () {
@@ -2357,7 +2358,7 @@ var Visualizer = /** @class */ (function () {
2357
2358
  case 1:
2358
2359
  _b.trys.push([1, 10, , 11]);
2359
2360
  merged = this.merge(decoded);
2360
- return [4 /*yield*/, this.setup(target, { version: decoded[0].envelope.version, dom: merged.dom, useproxy: useproxy, portalCanvas: portalCanvas })];
2361
+ return [4 /*yield*/, this.setup(target, { version: decoded[0].envelope.version, dom: merged.dom, useproxy: useproxy, portalCanvasId: portalCanvasId })];
2361
2362
  case 2:
2362
2363
  _b.sent();
2363
2364
  _b.label = 3;