cal.pub0.org/packages/embeds/embed-core
Omar López 54cefcb16e
Upgrades yarn v1 to v3. Improves CI times by 2x (#7738)
* Create env file workflow

* Add env-cache

* Fix env setter

* Fix

* Another fix

* Fix

* Fix

* Fixes

* FFS

* Fix

* Fix

* Fix

* Fix

* Fix

* Cache fixes

* Fixes

* Adds skipping steps

* db-cache fixes

* Test

* Cache fixes

* e2e

* Possible caching conflicts

* Running out of ideas

* Caching is hard

* One more time

* cache-build not skipping

* Fingers crossed

* a

* Test

* Pls

* Please

* LFG

* Build fix

* fix

* Whitespace!!

* Zomars/cal 884 paid events not sending the link (#7318)

* WIP

* Sends correct emails for paid bookings

* Update PaymentService.ts

* Update webhook.ts

* Update webhook.ts

* Update settings back button redirect link (#7403)

* fix(schedule): close on click #7143

* fix(EventSetupTab): validLocations length will always match validLocations length #7138

* fix(SettingsLayout): go back to right route #7379

* feat: get country code from ip geolocation (#6880)

* feat: get coutnry code from ip geolocation

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

* fix: create new api route for fetching code

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

* chore: replace city with country

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

* refactor: create hook for country

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

---------

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

* Team Workflows (#7038)

Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>

* Add destination calendar name to DestinationCalendarSelector (#6701)

* Add destination calendar name

* Type fix

* Search through calendars only for destination calendar credential

* Refactor get connected calendars

* Clean up

---------

Co-authored-by: zomars <zomars@me.com>

* Update viewer.tsx (#7428)

* Fix - add team members to emails (#7207)

* On booking add team members & translation

* Add team members to round robin create

* Only update calendars on reschedule if there is a calendar reference

* Send email on reschedules

* Send team email on cancelled event

* Add team members to calendar event description

* Clean up

* Convert other emails to organizer & teams

* Type check fixes

* More type fixes

* Change organizer scheduled input to an object

* early return updateCalendarEvent

* Introduce team member type

* Fix type errors

* Put team members before attendees

* Remove lodash cloneDeep

* Update packages/core/EventManager.ts

Co-authored-by: Omar López <zomars@me.com>

* Remove booking select object

* Revert "Remove booking select object"

This reverts commit 9f121ff4eb.

* Refactor email manager (#7270)

Co-authored-by: zomars <zomars@me.com>

* Type change

* Remove conditional check for updateAllCalendarEvents

---------

Co-authored-by: zomars <zomars@me.com>

* Typefix

* Updates webhook response

* Update pr.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Is this redundant?

* Removed setup

* Update action.yml

* Update action.yml

* Consolitades setup step

* Revert "Consolitades setup step"

This reverts commit 5e8d1983cc.

* Fix?

* One more time

* Revert "One more time"

This reverts commit fd8b559a13.

* Benchmarking buildjet

* Update action.yml

* Re-introduce setup

* Adds embeds to missing pro cache

* Lint fixes

* Adds prettier ignore

* Upgrades to yarn 3

* Updates lockfile

* Reverts CI to ubuntu

* Testing new yarn install

* We cannot use immutable due to our private submodules

* Adds CI skip

* Fixes

* Adds plugin

* Forces local embed package

* Moves eslint to root

* Update yarn.lock

* Playwright fixes

* Embed test fixes

* Splits embed react tests

* Splits embed react tests

* Removes install step to benchmark

* Update playwright.config.ts

* One playwright config for all

* More test fixes

* Update basic.e2e.ts

* Added typescript as a global monorepo dev

* Update to v18

* Update yarn.lock

* Update env-create-file.yml

* Update .github/workflows/pr.yml

---------

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Esaú Morais <55207584+esau-morais@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
2023-03-15 15:01:04 -07:00
..
playwright Upgrades yarn v1 to v3. Improves CI times by 2x (#7738) 2023-03-15 15:01:04 -07:00
src fixes #7548 - Scroll bar because auto height adjustment doesn't take <0.5 values into account (#7549) 2023-03-15 14:25:11 +05:30
.gitignore Embed Miscellaneous Improvements and Fixes (#2499) 2022-04-25 10:03:00 +05:30
LICENSE Add licenses to embeds (#2984) 2022-06-07 08:25:55 +00:00
README.md Formatting 2023-01-04 13:49:20 -07:00
embed-iframe.ts Fix @calcom/embed-react installation with TS project (#2870) 2022-05-27 09:37:02 -06:00
env.d.ts Fix @calcom/embed-react installation with TS project (#2870) 2022-05-27 09:37:02 -06:00
index.html Test/Embed/Reschedule (#6056) 2022-12-18 19:24:44 +00:00
index.ts Fix @calcom/embed-react installation with TS project (#2870) 2022-05-27 09:37:02 -06:00
package.json Upgrades yarn v1 to v3. Improves CI times by 2x (#7738) 2023-03-15 15:01:04 -07:00
preview.html feat: v2 embed (#4477) 2022-09-15 05:34:11 +00:00
tailwind.config.js Embed Miscellaneous Improvements and Fixes (#2499) 2022-04-25 10:03:00 +05:30
tsconfig.json Fix @calcom/embed-react installation with TS project (#2870) 2022-05-27 09:37:02 -06:00
vite.config.js Upgrade vite (#7197) 2023-02-20 17:50:40 +00:00

README.md

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 main class on the element that has the entire content of the page with no auto margins
    • Adding main class allows iframe height to adjust according to it, making sure that the content within main is 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.

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 its failing if it does.
  • 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 ?
  • 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,
  • 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

    • onClick support 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.
  • docs.cal.com

    • A complete document on how to use embed
  • app.cal.com

    • Get Embed code for each event-type