* feat(appStore): add isOAuth config * refactor(appStore): EventTypeAppSettngsInterface * refactor(qr_code): split EventTypeAppCardInterface and EventTypeAppSettingsInterface * feat(appStore): redirect to onboarding for stripe and basecam * fix(ui/ScrollableArea): overflow indicator not working * feat(apps): new install app flow * fix(configureStep): get disabled props for settings * fix: getAppInstallsBySlug now use teamIds * chore: Alby to AppSettingsInterface * chore: Giphy to appsettings interface * chore: GTM migration * chore: GT4 - migration * chore: fathom migration * chore: paypal * feat: basecamp migration * feat: metapixel migration * feat:plausable * feat:stripe * fix merge issues * fix merge issues in new app install flow steps * wip: callback to onboarding * fix: imports * fix: more imports * feat: use redirect to onboarding on install flow * feat: New app install flow 2 (#14077) * fix: redirect to event-type after oauth flow * When clicking on install new app button, only redirect to the new app install flow if it is an oAuth app or an app that extends the EventType feature in it's config * code refactor, skip event-type step * removed extra consoles * so that no one can change the eventTypeId in url * theme support enabled * only pass eventTypeId instead of whole evetType obj to OmniInstallAppButton * fix: clicking on event-type gives error and redirects to /apps * saved appOnboardingRedirectUrl to OAuth State * fix: a user having no team breaks the onboarding flow * add optional chaining to appMetadata.extendsFeature and appMetadata.isOAuth; * encode appOnboardingRedirectUrl * fix: dark theme ui issues * skip configure step if no-event types if user/team does not have event-type then skip configure step and goto apps/installed/[category] * exclude calendars from apps- onboarding flow * Update getAppOnboardingRedirectUrl.ts * fix: On configure step, inputs aren't showing errors * change route from `apps/onboarding` to `apps/installation` * fix: flow not correctly working for teams * should only allow team ADMIN or OWER to install an app to team * Prevent two payment apps to be enabled * removed loading state * Fix type error * undo new-app-flow from OmniInstallAppButton * remove OAuth Step, handle step numbering * fix: redirect url * getAppOnboardingRedirectUrl refactor * for debugging * Revert "for debugging" This reverts commit b9362c1a8f47f2280e684c213d7ec08d04a8ac4c. * fix: added toaster * feat: added support to select multiple events (almost) * hide button * Move inner form outside outer form using portal Due to limitations with nested forms in React Hook Form, moved the inner form outside the outer form using a portal to ensure proper form handling. * submit buttons refs madness * removed configure step we had to use query params to manage selected event-types, between routes which was causing 2 issues: * each time we selected or unselected an event the whole page was reloaded including getserversideprops being called again and again * the form was reloaded causing more issues * removed extra unwanted code * small fix * fix: type error * fix: types * implemented suggested changes * removed step footer * fixed error.message * removed commented styles * removed step footer * fix: Display team event types instead of user's on event types step when team selected * fix: typo * removed shouldLockDisableProps * refactor setUpdatedEventTypesStatus, fix type * removed extra code * can't delete while saving * added translations * fix: loading in select account step, fix handle onSelect params type * Fix typo --------- Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> * fix: type errors * fix: failing tests --------- Co-authored-by: sean-brydon <sean@cal.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
embed-core
This is the vanilla JS core script that embeds Cal Link.
How to use embed on any webpage no matter what framework
See https://developer.cal.com/embed/install-with-javascript
You can also see various example usages here
Development
Run the following command and then you can test the embed in the automatically opened page http://localhost:3100
yarn dev
Running Tests
Ensure that the main App is running on port 3000 (e.g. yarn dx) already. Also ensure dev server for embed-core is running and then run the following command: Start the server on 3100 port
yarn dev
And from another terminal you can run the following command to execute tests:
yarn embed-tests-quick
Note: getEmbedIframe and addEmbedListeners work as a team but they only support opening up embed in a fresh load. Opening an embed closing it and then opening another embed isn't supported yet.
Shipping to Production
yarn build
Make dist/embed.umd.js servable on URL http://cal.com/embed.js
DX
- Hot reload doesn't work with CSS files in the way we use vite.
Steps to make a page compatible with Embed
- Define
mainclass on the element that has the entire content of the page with no auto margins- Adding
mainclass allows iframe height to adjust according to it, making sure that the content withinmainis visible without scrolling as long as device dimensions permit it. - It also becomes the area beyond which if the user clicks, modal-box would close.
- Adding
Known Bugs and Upcoming Improvements
-
Unsupported Browsers and versions. Documenting them and gracefully handling that.
-
Need to create a booking Shell so that common changes for embed can be applied there.
-
Accessibility and UI/UX Issues let the user choose the loader for ModalBox If the website owner links the booking page directly for an event, should the user be able to go to events-listing page using back button ? Let the user specify both dark and light theme colors. Right now the colors specified are for light theme.
- Transparent support is not properly done for team links
- Maybe don't set border-radius in inline mode or give an option to configure border-radius.
-
Branding
- Powered by Cal.com and 'Try it for free'. Should they be shown only for FREE account.
- Branding at the bottom has been removed for UI improvements, need to see where to add it.
-
API
- Allow loader color customization using UI command itself too. Right now it's possible using CSS only.
-
Automation Tests
- Run automation tests in CI
- Automation Tests are using snapshots of Booking Page which has current month which requires us to regenerate snapshots every month.
-
Bundling Related
- Comments in CSS aren't stripped off
-
Debuggability
- Send log messages from iframe to parent so that all logs can exist in a single queue forming a timeline.
- user should be able to use "on" instruction to understand what's going on in the system
- Error Tracking for embed.js
- Know where exactly it’s failing if it does.
- Send log messages from iframe to parent so that all logs can exist in a single queue forming a timeline.
-
Color Scheme
- Need to reduce the number of colors on booking page, so that UI configuration is simpler
-
Dev Experience/Ease of Installation
- Do we need a one liner(like
window.dataLayer.push) to inform SDK of something even if snippet is not yet on the page but would be there e.g. through GTM it would come late on the page ?
- Do we need a one liner(like
-
Option to disable redirect banner and let parent handle redirect.
-
Release Issues
- Compatibility Issue - When embed-iframe.js is updated in such a way that it is not compatible with embed.js, doing a release might break the embed for some time. e.g. iframeReady event let's say get's changed to something else
- Best Case scenario - App and Website goes live at the same time. A website using embed loads the same updated and thus compatible versions of embed.js and embed-iframe.js
- Worst case scenario - App goes live first, website PR isn't merged yet and thus a website using the embed would load updated version of embed-iframe but outdated version of embed.js possibly breaking the embed.
- Ideal Solution: It would be to keep the libraries versioned and embed.js should instruct app within iframe to load a particular version. But if we push a security fix, it is possible that someone is still enforcing embed to load version with security issue. Need to handle this.
- Quick Solution: Serve embed.js also from app, so that they go live together and there is only a slight chance of compatibility issues on going live. Note, that they can still occur as 2 different requests are sent at different times to fetch the libraries and deployments can go live in between,
- Compatibility Issue - When embed-iframe.js is updated in such a way that it is not compatible with embed.js, doing a release might break the embed for some time. e.g. iframeReady event let's say get's changed to something else
-
UI Config Features
- How would the user add on hover styles just using style attribute ?
-
If just iframe refreshes due to some reason, embed script can't replay the applied instructions.
-
React Component
onClicksupport with automatic preloading
-
Shadow DOM is currently in open state, which probably means that any styling change on website can impact loader.
Pending Documentation
-
READMEs
- How to make a new element configurable using UI instruction ?
- Why do we NOT want to provide completely flexible CSS customization by adding whatever CSS user wants. ?
- Feature Documentation
- Inline mode doesn't cause any scroll in iframe by default. It looks like it is part of the website.
-
cal.com/docs
- A complete document on how to use embed
-
app.cal.com
- Get Embed code for each event-type