@wvdsh/sdk-js 0.0.35 → 0.0.36
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/index.js +3 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7451,18 +7451,15 @@ var WavedashSDK = (() => {
|
|
|
7451
7451
|
pending.resolve(event.data.data);
|
|
7452
7452
|
}
|
|
7453
7453
|
} else if (event.data?.type === IFRAME_MESSAGE_TYPE.TAKE_FOCUS) {
|
|
7454
|
-
console.log("[IFRAME MESSENGER] Taking focus");
|
|
7455
7454
|
if (typeof document !== "undefined") {
|
|
7456
7455
|
const gameFocusTargets = document.getElementsByClassName("game-focus-target");
|
|
7457
7456
|
if (gameFocusTargets.length > 0) {
|
|
7458
|
-
console.log("[IFRAME MESSENGER] Focusing on game focus target");
|
|
7459
7457
|
gameFocusTargets[0].focus();
|
|
7460
7458
|
} else {
|
|
7461
7459
|
const focusableElement = document.querySelector(
|
|
7462
7460
|
"canvas, input, button, [tabindex]:not([tabindex='-1'])"
|
|
7463
7461
|
);
|
|
7464
7462
|
if (focusableElement) {
|
|
7465
|
-
console.log("[IFRAME MESSENGER] Focusing on fallback target");
|
|
7466
7463
|
focusableElement.focus();
|
|
7467
7464
|
}
|
|
7468
7465
|
}
|
|
@@ -7478,15 +7475,15 @@ var WavedashSDK = (() => {
|
|
|
7478
7475
|
}
|
|
7479
7476
|
/**
|
|
7480
7477
|
* Derive parent origin from iframe URL pattern
|
|
7481
|
-
* iframe: [gameSlug].builds.[parentDomain]
|
|
7478
|
+
* iframe: [gameSlug].builds.[parentDomain] or [gameSlug].sandbox.[parentDomain]
|
|
7482
7479
|
* parent: [parentDomain]
|
|
7483
7480
|
*/
|
|
7484
7481
|
deriveParentOrigin() {
|
|
7485
7482
|
if (typeof window === "undefined") return "";
|
|
7486
7483
|
const iframeHost = window.location.hostname;
|
|
7487
|
-
const match = iframeHost.match(/^[\w-]+\.builds\.(.+)$/);
|
|
7484
|
+
const match = iframeHost.match(/^[\w-]+\.(builds|sandbox)\.(.+)$/);
|
|
7488
7485
|
if (match) {
|
|
7489
|
-
const parentDomain = match[
|
|
7486
|
+
const parentDomain = match[2];
|
|
7490
7487
|
return `${window.location.protocol}//${parentDomain}`;
|
|
7491
7488
|
}
|
|
7492
7489
|
console.error(`Invalid iframe hostname pattern: ${iframeHost}`);
|