@coasys/ad4m-connect 0.13.0-postmessage-ws-proxy.2 → 0.13.0-postmessage-ws-proxy.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.
- package/dist/core.js +5 -13
- package/dist/core.js.map +3 -3
- package/dist/index.js +5 -13
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11184,11 +11184,10 @@ var Ad4mConnect = class extends EventTarget {
|
|
|
11184
11184
|
setLocal("ad4m-last-host", JSON.stringify({ id: host.id, url: host.url, name: host.name, location: host.location }));
|
|
11185
11185
|
}
|
|
11186
11186
|
initializeEmbeddedMode() {
|
|
11187
|
-
var _a;
|
|
11188
11187
|
console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent");
|
|
11189
11188
|
window.addEventListener("message", (event) => __async(this, null, function* () {
|
|
11190
|
-
var
|
|
11191
|
-
if (((
|
|
11189
|
+
var _a;
|
|
11190
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "AD4M_CONFIG") {
|
|
11192
11191
|
if (event.source !== window.parent) {
|
|
11193
11192
|
console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");
|
|
11194
11193
|
return;
|
|
@@ -11225,8 +11224,8 @@ var Ad4mConnect = class extends EventTarget {
|
|
|
11225
11224
|
if (!event.origin || event.origin === "null") {
|
|
11226
11225
|
throw new Error("AD4M proxy mode requires a non-opaque parent origin. Ensure the host iframe is not sandboxed without allow-same-origin.");
|
|
11227
11226
|
}
|
|
11228
|
-
const
|
|
11229
|
-
const wsImpl = (url) => new PostMessageWebSocket(url,
|
|
11227
|
+
const parentOrigin = event.origin;
|
|
11228
|
+
const wsImpl = (url) => new PostMessageWebSocket(url, parentOrigin);
|
|
11230
11229
|
this.notifyConnectionChange("connecting");
|
|
11231
11230
|
this.ad4mClient = new Ad4mClient(
|
|
11232
11231
|
"http://proxy",
|
|
@@ -11277,14 +11276,7 @@ var Ad4mConnect = class extends EventTarget {
|
|
|
11277
11276
|
}
|
|
11278
11277
|
}));
|
|
11279
11278
|
console.log("[Ad4m Connect] Requesting AD4M config from parent window");
|
|
11280
|
-
|
|
11281
|
-
const referrerOrigin = document.referrer ? new URL(document.referrer).origin : null;
|
|
11282
|
-
if (referrerOrigin && ((_a = this.options.allowedOrigins) == null ? void 0 : _a.includes(referrerOrigin))) {
|
|
11283
|
-
parentOrigin = referrerOrigin;
|
|
11284
|
-
} else if (this.options.allowedOrigins && this.options.allowedOrigins.length === 1) {
|
|
11285
|
-
parentOrigin = this.options.allowedOrigins[0];
|
|
11286
|
-
}
|
|
11287
|
-
window.parent.postMessage({ type: "REQUEST_AD4M_CONFIG" }, parentOrigin);
|
|
11279
|
+
window.parent.postMessage({ type: "REQUEST_AD4M_CONFIG" }, "*");
|
|
11288
11280
|
}
|
|
11289
11281
|
buildAppInfo() {
|
|
11290
11282
|
return {
|