Skip to content

fix: embed non-transparent dark background on success page#9085

Merged
zomars merged 11 commits intomainfrom
hariom/CAL-1752
Jun 7, 2023
Merged

fix: embed non-transparent dark background on success page#9085
zomars merged 11 commits intomainfrom
hariom/CAL-1752

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented May 24, 2023

What does this PR do?

Makes sure that embed is detected correctly on success page which would automatically remove color-scheme dark on that page.

Also, fixes a possible case of theme flicker.

Fixes #9084
Fixes #9173
Loom for bug demo

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

See loom

Followup

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@linear
Copy link
Copy Markdown

linear bot commented May 24, 2023

@vercel
Copy link
Copy Markdown

vercel bot commented May 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2023 11:53pm
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2023 11:53pm
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 6, 2023 11:53pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
api ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2023 11:53pm

@hariombalhara hariombalhara requested a review from zomars May 24, 2023 10:49
@github-actions github-actions bot added High priority Created by Linear-GitHub Sync linear Sync Github Issue from community members to Linear.app 🐛 bug Something isn't working labels May 24, 2023
name="embed"
clearQueryParamsOnClose={queryParamsForDialog}
onOpenChange={(open) => {
if (!open) window.resetEmbedStatus();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

resetEmbedStatus is not needed now as we haven't been using sessionStorage to detect embed mode. As sessionStorage was common for Embed Code Generator preview window and the app, it was to remove the side effect.

const embedNamespace =
typeof embedNameSpaceFromQueryParam === "string"
? embedNameSpaceFromQueryParam
: window.name.replace(/cal-embed=(.*)/, "$1").trim();
Copy link
Copy Markdown
Member Author

@hariombalhara hariombalhara May 24, 2023

Choose a reason for hiding this comment

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

const url = new URL(document.URL);
const namespace = url.searchParams.get("embed");
return namespace;
return embedNamespace;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Now namespace and embed mode are both derives from the same variable.


const searchParams = new URL(document.URL).searchParams;
const only = window.only;
const only = searchParams.get("only");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Get only param from here directly instead of relying on window.only which is set by playground index.html

embedInit();
const url = new URL(document.URL);
embedStore.theme = window?.getEmbedTheme?.() as UiConfig["theme"];
embedStore.theme = window?.getEmbedTheme?.();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Remove type assertion.

hideEventTypeDetails?: boolean;
theme?: EmbedThemeConfig;
// If theme not provided we would get null
theme?: EmbedThemeConfig | null;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

After type assertion was removed, it was found out that it should have null also as it's possible value

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 24, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Nine Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/[user]/book 253.37 KB 404.15 KB 115.47% (🟡 +0.27%)
/apps/installed/[category] 276.17 KB 426.96 KB 121.99% (🟡 +0.19%)
/d/[link]/book 253.01 KB 403.8 KB 115.37% (🟡 +0.27%)
/getting-started/[[...step]] 425.47 KB 576.25 KB 164.64% (🟡 +0.23%)
/new-booker/[user]/[type] 289.06 KB 439.85 KB 125.67% (🟡 +0.27%)
/new-booker/d/[link]/[slug] 289.06 KB 439.85 KB 125.67% (🟡 +0.27%)
/new-booker/team/[slug]/[type] 289.07 KB 439.85 KB 125.67% (🟡 +0.27%)
/settings/my-account/calendars 250.88 KB 401.66 KB 114.76% (🟡 +0.23%)
/team/[slug]/book 253.02 KB 403.8 KB 115.37% (🟡 +0.27%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@deploysentinel
Copy link
Copy Markdown

deploysentinel bot commented May 24, 2023

Current Playwright Test Results Summary

✅ 106 Passing - ❌ 1 Failing - ⚠️ 1 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 06/06/2023 11:50:44pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: fddacc5

Started: 06/06/2023 11:49:05pm UTC

❌ Failures

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Failure

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should be able to reschedule
Retry 2Retry 1Initial Attempt
Error: calNamespace is not defined
calNamespace is not defined
4.81% (13) 13 / 270 runs
failed over last 7 days
95.19% (257) 257 / 270 runs
flaked over last 7 days

⚠️ Flakes

📄   apps/web/playwright/booking-seats.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Reschedule for booking with seats -- old-booker Should reschedule booking with seats and if everyone rescheduled it should be deleted
Retry 1Initial Attempt
1.49% (6) 6 / 402 runs
failed over last 7 days
11.19% (45) 45 / 402 runs
flaked over last 7 days

View Detailed Build Results


@PeerRich PeerRich changed the title Embed: Fixes non-transparent dark background on success page fix: fix embed non-transparent dark background on success page May 24, 2023
@PeerRich PeerRich changed the title fix: fix embed non-transparent dark background on success page fix: embed non-transparent dark background on success page May 24, 2023
@PeerRich PeerRich removed the linear Sync Github Issue from community members to Linear.app label May 26, 2023
Copy link
Copy Markdown
Contributor

@zomars zomars left a comment

Choose a reason for hiding this comment

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

LGTM

@zomars zomars enabled auto-merge June 6, 2023 23:35
@zomars zomars added this pull request to the merge queue Jun 6, 2023
Merged via the queue into main with commit 6308955 Jun 7, 2023
@zomars zomars deleted the hariom/CAL-1752 branch June 7, 2023 00:10
zomars added a commit that referenced this pull request Jun 7, 2023
@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working core area: core, team members only High priority Created by Linear-GitHub Sync

Projects

None yet

3 participants