2022-03-31 08:45:47 +00:00
# embed-core
2022-04-15 17:55:36 +00:00
This is the vanilla JS core script that embeds Cal Link.
2022-03-31 08:45:47 +00:00
2022-04-04 15:44:04 +00:00
## How to use embed on any webpage no matter what framework
2022-05-18 16:25:30 +00:00
See < https: / / developer . cal . com / embed / install-with-javascript >
2022-03-31 08:45:47 +00:00
2022-04-15 17:55:36 +00:00
You can also see various example usages [here ](https://github.com/calcom/cal.com/blob/main/packages/embeds/embed-core/index.html )
2022-03-31 08:45:47 +00:00
## Development
2022-04-25 04:33:00 +00:00
Run the following command and then you can test the embed in the automatically opened page `http://localhost:3100`
2022-03-31 08:45:47 +00:00
```bash
yarn dev
```
2022-04-08 05:33:24 +00:00
## Running Tests
Ensure that App is running on port 3000 already and then run following command:
```bash
yarn test-playwright
```
2022-03-31 08:45:47 +00:00
## Shipping to Production
```bash
yarn build
```
2022-04-04 15:44:04 +00:00
Make `dist/embed.umd.js` servable on URL < http: // cal . com / embed . js >
2022-04-08 05:33:24 +00:00
## DX
- Hot reload doesn't work with CSS files in the way we use vite.
## Known Bugs and Upcoming Improvements
2022-04-04 15:44:04 +00:00
- Unsupported Browsers and versions. Documenting them and gracefully handling that.
2022-04-25 04:33:00 +00:00
- Need to create a booking Shell so that common changes for embed can be applied there.
2022-04-04 15:44:04 +00:00
- Accessibility and UI/UX Issues
2022-04-08 05:33:24 +00:00
- let user choose the loader for ModalBox
2022-04-04 15:44:04 +00:00
- If website owner links the booking page directly for an event, should the user be able to go to events-listing page using back button ?
2022-04-08 16:59:08 +00:00
- Let user specify both dark and light theme colors. Right now the colors specified are for light theme.
2022-04-25 04:33:00 +00:00
- Transparent support is not properly done for team links
- Maybe don't set border radius in inline mode or give option to configure border radius.
2022-04-14 02:47:34 +00:00
- 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
2022-04-25 04:33:00 +00:00
- Allow loader color customization using UI command itself too. Right now it's possible using CSS only.
2022-04-04 15:44:04 +00:00
2022-04-08 05:33:24 +00:00
- Automation Tests
- Run automation tests in CI
2022-05-05 14:29:49 +00:00
- Automation Tests are using snapshots of Booking Page which has current month which requires us to regenerate snapshots every month.
2022-04-08 05:33:24 +00:00
2022-04-04 15:44:04 +00:00
- Bundling Related
2022-04-08 05:33:24 +00:00
- Comments in CSS aren't stripped off
2022-04-04 15:44:04 +00:00
- 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.
2022-04-08 05:33:24 +00:00
- Color Scheme
- Need to reduce the number of colors on booking page, so that UI configuration is simpler
2022-04-04 15:44:04 +00:00
- 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 ?
2022-04-08 05:33:24 +00:00
2022-04-25 04:33:00 +00:00
- Option to disable redirect banner and let parent handle redirect.
2022-05-05 14:29:49 +00:00
2022-04-14 02:47:34 +00:00
- 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,
2022-04-04 15:44:04 +00:00
- UI Config Features
2022-05-05 14:29:49 +00:00
- How would the user add on hover styles just using style attribute ?
2022-04-08 05:33:24 +00:00
- If just iframe refreshes due to some reason, embed script can't replay the applied instructions.
2022-04-04 15:44:04 +00:00
- React Component
2022-04-14 02:47:34 +00:00
- `onClick` support with automatic preloading
- Shadow DOM is currently in open state, which probably means that any styling change on website can possibly impact loader.
2022-04-08 05:33:24 +00:00
2022-04-04 15:44:04 +00:00
## 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. ?
2022-04-08 05:33:24 +00:00
- Feature Documentation
- Inline mode doesn't cause any scroll in iframe by default. It more looks like it is part of the website.
2022-04-04 15:44:04 +00:00
- docs.cal.com
- A complete document on how to use embed
- app.cal.com
- Get Embed code for each event-type