@roomle/embedding-lib 9.1.0-alpha.1 → 9.1.0-alpha.3

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.
@@ -44,7 +44,7 @@ var t = class {
44
44
  }
45
45
  _handleMessage(e) {
46
46
  let t = e.ports && Array.isArray(e.ports) && e.ports.length > 0 ? e.ports[0] : null;
47
- if (e.data && (typeof e.data == "string" || e.data.type !== "connect_hi") && t) try {
47
+ if (e.data && typeof e.data == "string" && t) try {
48
48
  let n = JSON.parse(e.data);
49
49
  if (!this._execMessage) return t.postMessage(JSON.stringify({ error: this._side + " is not ready to handle messages" }));
50
50
  Array.isArray(n.args) || (n.args = [n.args]);
@@ -349,6 +349,7 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
349
349
  _configuratorSettings;
350
350
  _initData = {};
351
351
  _iframe;
352
+ _relays = /* @__PURE__ */ new Map();
352
353
  constructor(e, n, r, i, a) {
353
354
  if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
354
355
  if (U.has(n)) throw Error("There is already an instance on this DOM element");
@@ -371,8 +372,20 @@ var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t
371
372
  let s = this._createIframe();
372
373
  this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), U.set(n, !0);
373
374
  }
375
+ startRelay(e, t) {
376
+ this._relays.get(e)?.();
377
+ let n = t(this._iframe.contentWindow, new URL(this._iframe.src, location.href).origin);
378
+ this._relays.set(e, n);
379
+ let r = () => this._relays.get(e) === n;
380
+ return {
381
+ isCurrent: r,
382
+ stop: () => {
383
+ r() && (n(), this._relays.delete(e));
384
+ }
385
+ };
386
+ }
374
387
  teardown() {
375
- this._container && U.delete(this._container);
388
+ this._relays.forEach((e) => e()), this._relays.clear(), this._container && U.delete(this._container);
376
389
  let e = this._container.querySelector("iframe");
377
390
  e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
378
391
  }
@@ -43,7 +43,7 @@ var t = class {
43
43
  }
44
44
  _handleMessage(e) {
45
45
  let t = e.ports && Array.isArray(e.ports) && e.ports.length > 0 ? e.ports[0] : null;
46
- if (e.data && (typeof e.data == "string" || e.data.type !== "connect_hi") && t) try {
46
+ if (e.data && typeof e.data == "string" && t) try {
47
47
  let n = JSON.parse(e.data);
48
48
  if (!this._execMessage) return t.postMessage(JSON.stringify({ error: this._side + " is not ready to handle messages" }));
49
49
  Array.isArray(n.args) || (n.args = [n.args]);
@@ -331,6 +331,7 @@ var h = /\/v[23]\/?$/, g = {
331
331
  _configuratorSettings;
332
332
  _initData = {};
333
333
  _iframe;
334
+ _relays = /* @__PURE__ */ new Map();
334
335
  constructor(e, n, r, i, a) {
335
336
  if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
336
337
  if (I.has(n)) throw Error("There is already an instance on this DOM element");
@@ -346,8 +347,20 @@ var h = /\/v[23]\/?$/, g = {
346
347
  let s = this._createIframe();
347
348
  this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), I.set(n, !0);
348
349
  }
350
+ startRelay(e, t) {
351
+ this._relays.get(e)?.();
352
+ let n = t(this._iframe.contentWindow, new URL(this._iframe.src, location.href).origin);
353
+ this._relays.set(e, n);
354
+ let r = () => this._relays.get(e) === n;
355
+ return {
356
+ isCurrent: r,
357
+ stop: () => {
358
+ r() && (n(), this._relays.delete(e));
359
+ }
360
+ };
361
+ }
349
362
  teardown() {
350
- this._container && I.delete(this._container);
363
+ this._relays.forEach((e) => e()), this._relays.clear(), this._container && I.delete(this._container);
351
364
  let e = this._container.querySelector("iframe");
352
365
  e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
353
366
  }
package/sbom.cdx.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.6",
5
5
  "version": 1,
6
- "serialNumber": "urn:uuid:a8252949-0c15-59d2-887c-4cc1760a7e9f",
6
+ "serialNumber": "urn:uuid:c6e70339-8149-5e2e-826d-4da271be3165",
7
7
  "metadata": {
8
- "timestamp": "2026-11-04T14:09:49.000Z",
8
+ "timestamp": "2026-11-09T09:08:18.000Z",
9
9
  "component": {
10
10
  "type": "library",
11
11
  "name": "@roomle/embedding-lib",
12
- "version": "b55f81bd88edcfbc317af6fdae182ab75cbec998",
13
- "bom-ref": "@roomle/embedding-lib@b55f81bd88edcfbc317af6fdae182ab75cbec998"
12
+ "version": "5d3d52ca37742547fdded8befb045096fbca4756",
13
+ "bom-ref": "@roomle/embedding-lib@5d3d52ca37742547fdded8befb045096fbca4756"
14
14
  }
15
15
  },
16
16
  "components": [
@@ -351,7 +351,7 @@
351
351
  ],
352
352
  "dependencies": [
353
353
  {
354
- "ref": "@roomle/embedding-lib@b55f81bd88edcfbc317af6fdae182ab75cbec998"
354
+ "ref": "@roomle/embedding-lib@5d3d52ca37742547fdded8befb045096fbca4756"
355
355
  },
356
356
  {
357
357
  "ref": "pkg:npm/%40ai-sdk/anthropic@4.0.68"