Skip to content

Commit f43f336

Browse files
author
Jake Wood
committed
fix: target origin fix for integration testing
1 parent 4da5840 commit f43f336

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare global {
1919
}
2020

2121
export function getTargetOrigin() {
22-
return window.__tbxConfig?.targetOrigin || "https://app.testbox.com";
22+
return window.__tbxConfig?.targetOrigin || ".testbox.com";
2323
}
2424

2525
export function getLogLevel() {

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export function startTestBox(config?: TestBoxConfig) {
2828
}
2929

3030
window.addEventListener("message", (ev) => {
31-
if (!ev.origin.includes(".testbox.com")) {
31+
const targetOrigin = getTargetOrigin();
32+
if (!ev.origin.includes(targetOrigin)) {
3233
info("target-mismatch", {
3334
messageOrigin: ev.origin,
34-
targetOrigin: getTargetOrigin(),
35+
targetOrigin: targetOrigin,
3536
});
3637
return;
3738
}

0 commit comments

Comments
 (0)