Skip to content

Commit fe92c71

Browse files
committed
fix, add webkit height fallback
1 parent 05af5e9 commit fe92c71

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

packages/core/src/elements/iframe.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { iframeStyles } from "../styles/styles";
2+
import {verificationUrl} from "../helpers/defaultConfig";
3+
24
import {ORBA_ONE_MESSAGE_CHANNEL,ORBA_ONE_SUCCESS,ORBA_ONE_CANCEL} from "./constants";
35

46
type State = "loading" | "success" | "error" | "idle";
@@ -50,17 +52,20 @@ export function iframeManager(
5052
}
5153

5254
function handler(event: any) {
53-
const json = JSON.parse(event.data);
54-
55-
if (json.status === ORBA_ONE_SUCCESS) {
56-
onSuccess(json);
57-
disconnect();
58-
} else if (json.status === ORBA_ONE_CANCEL) {
59-
onCancelled(json);
60-
disconnect();
61-
} else {
62-
onError(json);
55+
console.log(event)
56+
if (event.origin != verificationUrl) {
57+
const json = JSON.parse(event.data)
58+
if (json.status === ORBA_ONE_SUCCESS) {
59+
onSuccess(json);
60+
disconnect();
61+
} else if (json.status === ORBA_ONE_CANCEL) {
62+
onCancelled(json);
63+
disconnect();
64+
} else {
65+
onError(json);
66+
}
6367
}
68+
6469
}
6570

6671
return {
@@ -73,7 +78,7 @@ export function iframeManager(
7378
state = "loading";
7479
onChange(state);
7580
document.body.appendChild(iframe);
76-
window.addEventListener(ORBA_ONE_MESSAGE_CHANNEL, handler, false);
81+
window.addEventListener(ORBA_ONE_MESSAGE_CHANNEL, handler);
7782
}
7883
},
7984

packages/core/src/styles/styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const iframeStyles = `
2121
left: 0;
2222
width: 100vw;
2323
height: 100vh;
24+
height: -webkit-fill-available;
2425
border: none;
2526
`;
2627

0 commit comments

Comments
 (0)