@gemx-dev/clarity-visualize 0.8.57 → 0.8.59

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