@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/core.js
CHANGED
|
@@ -11095,11 +11095,10 @@ var Ad4mConnect = class extends EventTarget {
|
|
|
11095
11095
|
setLocal("ad4m-last-host", JSON.stringify({ id: host.id, url: host.url, name: host.name, location: host.location }));
|
|
11096
11096
|
}
|
|
11097
11097
|
initializeEmbeddedMode() {
|
|
11098
|
-
var _a;
|
|
11099
11098
|
console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent");
|
|
11100
11099
|
window.addEventListener("message", (event) => __async(this, null, function* () {
|
|
11101
|
-
var
|
|
11102
|
-
if (((
|
|
11100
|
+
var _a;
|
|
11101
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "AD4M_CONFIG") {
|
|
11103
11102
|
if (event.source !== window.parent) {
|
|
11104
11103
|
console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");
|
|
11105
11104
|
return;
|
|
@@ -11136,8 +11135,8 @@ var Ad4mConnect = class extends EventTarget {
|
|
|
11136
11135
|
if (!event.origin || event.origin === "null") {
|
|
11137
11136
|
throw new Error("AD4M proxy mode requires a non-opaque parent origin. Ensure the host iframe is not sandboxed without allow-same-origin.");
|
|
11138
11137
|
}
|
|
11139
|
-
const
|
|
11140
|
-
const wsImpl = (url) => new PostMessageWebSocket(url,
|
|
11138
|
+
const parentOrigin = event.origin;
|
|
11139
|
+
const wsImpl = (url) => new PostMessageWebSocket(url, parentOrigin);
|
|
11141
11140
|
this.notifyConnectionChange("connecting");
|
|
11142
11141
|
this.ad4mClient = new Ad4mClient(
|
|
11143
11142
|
"http://proxy",
|
|
@@ -11188,14 +11187,7 @@ var Ad4mConnect = class extends EventTarget {
|
|
|
11188
11187
|
}
|
|
11189
11188
|
}));
|
|
11190
11189
|
console.log("[Ad4m Connect] Requesting AD4M config from parent window");
|
|
11191
|
-
|
|
11192
|
-
const referrerOrigin = document.referrer ? new URL(document.referrer).origin : null;
|
|
11193
|
-
if (referrerOrigin && ((_a = this.options.allowedOrigins) == null ? void 0 : _a.includes(referrerOrigin))) {
|
|
11194
|
-
parentOrigin = referrerOrigin;
|
|
11195
|
-
} else if (this.options.allowedOrigins && this.options.allowedOrigins.length === 1) {
|
|
11196
|
-
parentOrigin = this.options.allowedOrigins[0];
|
|
11197
|
-
}
|
|
11198
|
-
window.parent.postMessage({ type: "REQUEST_AD4M_CONFIG" }, parentOrigin);
|
|
11190
|
+
window.parent.postMessage({ type: "REQUEST_AD4M_CONFIG" }, "*");
|
|
11199
11191
|
}
|
|
11200
11192
|
buildAppInfo() {
|
|
11201
11193
|
return {
|