Skip to content

Commit

Permalink
Merge branch 'main' into refactor-country-props
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja authored Apr 18, 2024
2 parents 40bc510 + 2c745eb commit 2e0941a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ external hostname: string = "hostname"
@val @scope(("window", "location"))
external href: string = "href"

@val @scope(("window", "location"))
external protocol: string = "protocol"

let isSandbox = hostname === "beta.hyperswitch.io"

let isInteg = hostname === "dev.hyperswitch.io"
Expand Down
6 changes: 6 additions & 0 deletions src/orca-loader/Hyper.res
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ let make = (publishableKey, options: option<JSON.t>, analyticsInfo: option<JSON.
logger.setLogInfo(~value=Window.href, ~eventName=APP_INITIATED, ~timestamp=sdkTimestamp, ())
}
}->Sentry.sentryLogger
let isSecure = Window.protocol === "https:"
let isLocal = GlobalVars.sdkUrl->String.includes("localhost")
if !isSecure && !isLocal {
manageErrorWarning(HTTP_NOT_ALLOWED, ~dynamicStr=Window.href, ~logger, ())
Exn.raiseError("Insecure domain: " ++ Window.href)
}
switch Window.getHyper->Nullable.toOption {
| Some(hyperMethod) => {
logger.setLogInfo(
Expand Down

0 comments on commit 2e0941a

Please sign in to comment.