Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Embed: Get correct snippet for Org events #12380

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Nov 16, 2023

What does this PR do?

This makes the embed snippet now work with org events without any manual change's requirement.

E2E Tests

  • Added e2e tests to verify that the orgSlug is present in code and bookerUrl for all types of embeds.
  • Now non-org event-types also verify their code
  • Code Verification is using eslint and node-html-parser to validate that valid JS code is there in snippets.

Fixes #11644

Type of change

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

How should this be tested?

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Copy link

vercel bot commented Nov 16, 2023

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

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 16, 2023 0:08am
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 16, 2023 0:08am
dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 16, 2023 0:08am
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Nov 16, 2023 0:08am
cal-demo ⬜️ Ignored (Inspect) Visit Preview Nov 16, 2023 0:08am
qa ⬜️ Ignored (Inspect) Visit Preview Nov 16, 2023 0:08am
ui ⬜️ Ignored (Inspect) Visit Preview Nov 16, 2023 0:08am

@hariombalhara
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Contributor

github-actions bot commented Nov 16, 2023

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes!

Copy link
Contributor

github-actions bot commented Nov 16, 2023

📦 Next.js Bundle Analysis for @calcom/web

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

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

deploysentinel bot commented Nov 16, 2023

Current Playwright Test Results Summary

✅ 318 Passing - ⚠️ 3 Flaky

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

(Last updated on 11/16/2023 12:15:52pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: f88bd5b

Started: 11/16/2023 12:09:52pm UTC

⚠️ Flakes

📄   apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Stripe integration Change stripe presented currency Should be able to change currency
Retry 1Initial Attempt
0% (0) 0 / 290 runs
failed over last 7 days
1.72% (5) 5 / 290 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1Initial Attempt
1.29% (4) 4 / 310 runs
failed over last 7 days
56.77% (176) 176 / 310 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
17.42% (54) 54 / 310 runs
failed over last 7 days
77.74% (241) 241 / 310 runs
flaked over last 7 days

View Detailed Build Results


@hariombalhara hariombalhara force-pushed the 11-16-fix_Provide_calOrigin_for_organization_embeds branch from 605c46b to 1df00cb Compare November 16, 2023 06:51
@hariombalhara hariombalhara force-pushed the 11-16-fix_Provide_calOrigin_for_organization_embeds branch from 1df00cb to c0c9687 Compare November 16, 2023 07:02
@hariombalhara hariombalhara force-pushed the 11-16-fix_Provide_calOrigin_for_organization_embeds branch from c0c9687 to bc4361a Compare November 16, 2023 07:06
@hariombalhara hariombalhara marked this pull request as ready for review November 16, 2023 07:06
@hariombalhara hariombalhara requested a review from a team November 16, 2023 07:15
@hariombalhara hariombalhara self-assigned this Nov 16, 2023
@hariombalhara hariombalhara changed the title fix: Provide calOrigin for organization embeds fix: Embed: Get correct snippet for Org events Nov 16, 2023
@hariombalhara hariombalhara force-pushed the 11-16-fix_Provide_calOrigin_for_organization_embeds branch from bc4361a to 436f357 Compare November 16, 2023 08:07
@hariombalhara hariombalhara force-pushed the 11-16-fix_Provide_calOrigin_for_organization_embeds branch from 436f357 to 35e9eba Compare November 16, 2023 08:51
@hariombalhara hariombalhara force-pushed the 11-16-fix_Provide_calOrigin_for_organization_embeds branch from 35e9eba to caf63f0 Compare November 16, 2023 09:03
Copy link
Member Author

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

Self review done

});
});

test.describe("Organization", () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

New tests to verify the code for organization events.

@@ -427,7 +427,7 @@ const createUserFixture = (user: UserWithIncludes, page: Page) => {
}
return membership;
},
getOrg: async () => {
getOrgMembership: async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to better convey what it does.

page.locator(`[data-testid=${embedType}]`).click();
}

async function gotToPreviewTab(page: Page) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to goToPreviewTab - Typo fix

Comment on lines +107 to +109
return `./${path.replace(/\\/g, "/")}/${moduleName
.replace(/\/index\.ts|\/index\.tsx/, "")
.replace(/\.tsx$|\.ts$/, "")}`;
Copy link
Member Author

Choose a reason for hiding this comment

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

Prettier autofix

@@ -53,7 +55,7 @@ export const Codes = {
return code`
import { getCalApi } from "@calcom/embed-react";
import { useEffect } from "react";
export default function App() {
export default function MyApp() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to make it same as inline embed code

Copy link
Member

@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.

Great work @hariombalhara looks good enough to merge

@zomars zomars merged commit c9b50ff into main Nov 27, 2023
37 checks passed
@zomars zomars deleted the 11-16-fix_Provide_calOrigin_for_organization_embeds branch November 27, 2023 17:38
jakazzy pushed a commit to jakazzy/cal.com that referenced this pull request Dec 5, 2023
hbjORbj pushed a commit to codemod-com/cal.com-demo that referenced this pull request Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only embed area: embed, widget, react embed Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-2561] make react embed work for orgs
3 participants