Skip to content

Commit

Permalink
fix(sdk): prevent lack of parent domain from throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Nov 23, 2023
1 parent 7bceba5 commit 35e0b88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/models/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ export const isConfigMessageEvent = (
event: MessageEvent
): event is ConfigMessageEvent => {
const queryParams = new URLSearchParams(window.location.search)
const parentDomain = queryParams.get(QueryParamKeys.PARENT_DOMAIN)

if (parentDomain === null) return false

const { origin: parentFrameOrigin } = new URL(
decodeURIComponent(queryParams.get(QueryParamKeys.PARENT_DOMAIN) ?? '')
decodeURIComponent(parentDomain)
)

if (event.origin !== parentFrameOrigin) return false
Expand Down

1 comment on commit 35e0b88

@vercel
Copy link

@vercel vercel bot commented on 35e0b88 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chitchatter – ./

chitchatter-git-main-jeremyckahn.vercel.app
chitchatter-jeremyckahn.vercel.app
chitchatter.vercel.app

Please sign in to comment.