@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.
@@ -390,7 +390,7 @@ var EnrichHelper = /** @class */ (function () {
390
390
  * @param canvasId - ID for the canvas element
391
391
  * @returns Canvas info with cleanup function
392
392
  */
393
- function createParentWindowCanvas(iframeDoc) {
393
+ function createParentWindowCanvas(iframeDoc, portalCanvasId) {
394
394
  var _a, _b;
395
395
  // Check if we're inside an iframe
396
396
  if (iframeDoc.defaultView === ((_a = iframeDoc.defaultView) === null || _a === void 0 ? void 0 : _a.top)) {
@@ -409,10 +409,11 @@ function createParentWindowCanvas(iframeDoc) {
409
409
  if (!iframeParent)
410
410
  throw new Error('Iframe parent not found');
411
411
  // Create canvas as sibling to iframe
412
- var canvas_1 = parentDoc.getElementById("clarity-heatmap-canvas" /* Constant.HeatmapCanvas */);
412
+ var canvasId = "".concat("clarity-heatmap-canvas" /* Constant.HeatmapCanvas */, "-").concat(portalCanvasId);
413
+ var canvas_1 = parentDoc.getElementById(canvasId);
413
414
  if (canvas_1 === null) {
414
415
  canvas_1 = parentDoc.createElement('canvas');
415
- canvas_1.id = "clarity-heatmap-canvas" /* Constant.HeatmapCanvas */;
416
+ canvas_1.id = canvasId;
416
417
  canvas_1.width = 0;
417
418
  canvas_1.height = 0;
418
419
  canvas_1.style.position = "absolute" /* Constant.Absolute */;
@@ -795,7 +796,7 @@ var HeatmapHelper = /** @class */ (function () {
795
796
  var doc = _this.state.window.document;
796
797
  var win = _this.state.window;
797
798
  var de = doc.documentElement;
798
- var isPortalCanvas = _this.state.options.portalCanvas;
799
+ var isPortalCanvas = !!_this.state.options.portalCanvasId;
799
800
  if (isPortalCanvas)
800
801
  return _this.createPortalCanvas(doc, win, de);
801
802
  var canvas = doc.getElementById("clarity-heatmap-canvas" /* Constant.HeatmapCanvas */);
@@ -936,7 +937,7 @@ var HeatmapHelper = /** @class */ (function () {
936
937
  return __generator(this, function (_a) {
937
938
  switch (_a.label) {
938
939
  case 0:
939
- isPortalCanvas = this.state.options.portalCanvas;
940
+ isPortalCanvas = !!this.state.options.portalCanvasId;
940
941
  if (!isPortalCanvas)
941
942
  return [2 /*return*/];
942
943
  return [4 /*yield*/, waitForDialogsRendered()];
@@ -952,7 +953,7 @@ var HeatmapHelper = /** @class */ (function () {
952
953
  try {
953
954
  canvas = (_a = _this.parentCanvasInfo) === null || _a === void 0 ? void 0 : _a.canvas;
954
955
  if (!canvas) {
955
- _this.parentCanvasInfo = createParentWindowCanvas(doc);
956
+ _this.parentCanvasInfo = createParentWindowCanvas(doc, _this.state.options.portalCanvasId);
956
957
  canvas = _this.parentCanvasInfo.canvas;
957
958
  // Add event listeners only once when canvas is created
958
959
  win.addEventListener("scroll", _this.redraw, true);
@@ -963,7 +964,7 @@ var HeatmapHelper = /** @class */ (function () {
963
964
  }
964
965
  }
965
966
  canvas.width = de.clientWidth;
966
- canvas.height = de.clientHeight + 4; // TODO: GEMX VERIFY
967
+ canvas.height = de.clientHeight; // TODO: GEMX VERIFY
967
968
  canvas.style.top = '0';
968
969
  canvas.style.left = '0';
969
970
  canvas.getContext("2d" /* Constant.Context */).clearRect(0, 0, canvas.width, canvas.height);
@@ -2342,7 +2343,7 @@ var Visualizer = /** @class */ (function () {
2342
2343
  return false;
2343
2344
  }
2344
2345
  };
2345
- this.html = function (decoded, target, portalCanvas, hash, useproxy, logerror, shortCircuitStrategy) {
2346
+ this.html = function (decoded, target, portalCanvasId, hash, useproxy, logerror, shortCircuitStrategy) {
2346
2347
  if (hash === void 0) { hash = null; }
2347
2348
  if (shortCircuitStrategy === void 0) { shortCircuitStrategy = 0 /* ShortCircuitStrategy.None */; }
2348
2349
  return __awaiter(_this, void 0, void 0, function () {
@@ -2355,7 +2356,7 @@ var Visualizer = /** @class */ (function () {
2355
2356
  case 1:
2356
2357
  _b.trys.push([1, 10, , 11]);
2357
2358
  merged = this.merge(decoded);
2358
- return [4 /*yield*/, this.setup(target, { version: decoded[0].envelope.version, dom: merged.dom, useproxy: useproxy, portalCanvas: portalCanvas })];
2359
+ return [4 /*yield*/, this.setup(target, { version: decoded[0].envelope.version, dom: merged.dom, useproxy: useproxy, portalCanvasId: portalCanvasId })];
2359
2360
  case 2:
2360
2361
  _b.sent();
2361
2362
  _b.label = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemx-dev/clarity-visualize",
3
- "version": "0.8.57",
3
+ "version": "0.8.58",
4
4
  "description": "Clarity visualize",
5
5
  "author": "Microsoft Corp.",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "unpkg": "build/clarity.visualize.min.js",
10
10
  "types": "types/index.d.ts",
11
11
  "dependencies": {
12
- "@gemx-dev/clarity-decode": "^0.8.57"
12
+ "@gemx-dev/clarity-decode": "^0.8.58"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@rollup/plugin-commonjs": "^24.0.0",
@@ -289,7 +289,7 @@ export function applyBestCanvasStrategy(
289
289
 
290
290
  // Strategy 1: Parent window canvas (best for iframe contexts)
291
291
  if (selectedStrategy === 'auto' || selectedStrategy === 'parent-window') {
292
- const parentCanvas = createParentWindowCanvas(doc);
292
+ const parentCanvas = createParentWindowCanvas(doc, canvasId);
293
293
  if (parentCanvas) {
294
294
  return {
295
295
  canvas: parentCanvas.canvas,