Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hariombalhara committed Oct 4, 2024
1 parent ab1eab9 commit 8e56ce6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/embeds/embed-core/src/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,16 +440,20 @@ export class Cal {
return Object.fromEntries(Object.entries(params).filter(([key, value]) => !excludeParam(key, value)));
}

private getQueryParamsFromPage() {
const queryParamsFromPage = getQueryParamsFromPage();
// Ensure valid params are used from the page.
return this.filterParams(queryParamsFromPage);
}

private buildFilteredQueryParams(queryParamsFromConfig: PrefillAndIframeAttrsConfig): URLSearchParams {
const queryParamsFromPageUrl = globalCal.config?.forwardQueryParams ? getQueryParamsFromPage() : {};
const queryParamsFromPageUrl = globalCal.config?.forwardQueryParams ? this.getQueryParamsFromPage() : {};

// Query Params via config have higher precedence
const mergedQueryParams = { ...queryParamsFromPageUrl, ...queryParamsFromConfig };

const filteredQueryParams = this.filterParams(mergedQueryParams);

const searchParams = new URLSearchParams();
for (const [key, value] of Object.entries(filteredQueryParams)) {
for (const [key, value] of Object.entries(mergedQueryParams)) {
if (value === undefined) {
continue;
}
Expand Down

0 comments on commit 8e56ce6

Please sign in to comment.