Embed Miscellaneous Improvements and Fixes (#2499)
This commit is contained in:
1 parent
53d7e57142
commit
93c75b5fef
83 files changed
+1139
-746
No files matched your search
@@ -9,8 +9,8 @@ The Embed allows your website visitors to book a meeting with you directly from
|
||||
## Install on any website
|
||||
|
||||
- _Step-1._ Install the Vanilla JS Snippet
|
||||
|
||||
```javascript
|
||||
```html
|
||||
<script>
|
||||
(function (C, A, L) {
|
||||
let p = function (a, ar) {
|
||||
a.q.push(ar);
|
||||
@@ -38,14 +38,10 @@ The Embed allows your website visitors to book a meeting with you directly from
|
||||
}
|
||||
p(cal, ar);
|
||||
};
|
||||
})(window, "https://cal.com/embed.js", "init");
|
||||
```
|
||||
|
||||
- _Step-2_. Initialize it
|
||||
|
||||
```javascript
|
||||
Cal("init")
|
||||
```
|
||||
})(window, "https://cal.com/embed.js", "init");
|
||||
Cal("init")
|
||||
</script>
|
||||
```
|
||||
|
||||
## Install with a Framework
|
||||
|
||||
@@ -72,18 +68,20 @@ Show the embed inline inside a container element. It would take the width and he
|
||||
<details>
|
||||
<summary>_Vanilla JS_</summary>
|
||||
|
||||
```javascript
|
||||
Cal("inline", {
|
||||
elementOrSelector: "Your Embed Container Selector Path", // You can also provide an element directly
|
||||
calLink: "jane", // The link that you want to embed. It would open https://cal.com/jane in embed
|
||||
config: {
|
||||
name: "John Doe", // Prefill Name
|
||||
email: "john[email protected]", // Prefill Email
|
||||
notes: "Test Meeting", // Prefill Notes
|
||||
guests: ["[email protected]", "[email protected]"], // Prefill Guests
|
||||
theme: "dark", // "dark" or "light" theme
|
||||
},
|
||||
});
|
||||
```html
|
||||
<script>
|
||||
Cal("inline", {
|
||||
elementOrSelector: "Your Embed Container Selector Path", // You can also provide an element directly
|
||||
calLink: "jane", // The link that you want to embed. It would open https://cal.com/jane in embed
|
||||
config: {
|
||||
name: "John Doe", // Prefill Name
|
||||
email: "[email protected]", // Prefill Email
|
||||
notes: "Test Meeting", // Prefill Notes
|
||||
guests: ["[email protected]", "[email protected]"], // Prefill Guests
|
||||
theme: "dark", // "dark" or "light" theme
|
||||
},
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -146,8 +144,10 @@ Consider an instruction as a function with that name and that would be called wi
|
||||
|
||||
Appends embed inline as the child of the element.
|
||||
|
||||
```javascript
|
||||
```html
|
||||
<script>
|
||||
Cal("inline", { elementOrSelector, calLink });
|
||||
</script>
|
||||
````
|
||||
|
||||
- `elementOrSelector` - Give it either a valid CSS selector or an HTMLElement instance directly
|
||||
@@ -158,8 +158,10 @@ Cal("inline", { elementOrSelector, calLink });
|
||||
|
||||
Configure UI for embed. Make it look part of your webpage.
|
||||
|
||||
```javascript
|
||||
```html
|
||||
<script>
|
||||
Cal("inline", { styles });
|
||||
</script>
|
||||
```
|
||||
|
||||
- `styles` - It supports styling for `body` and `eventTypeListItem`. Right now we support just background on these two.
|
||||
@@ -170,15 +172,18 @@ Usage:
|
||||
|
||||
If you want to open cal link on some action. Make it pop open instantly by preloading it.
|
||||
|
||||
```javascript
|
||||
```html
|
||||
<script>
|
||||
Cal("preload", { calLink });
|
||||
</script>
|
||||
```
|
||||
|
||||
- `calLink` - Cal Link that you want to embed e.g. john. Just give the username. No need to give the full URL [https://cal.com/john]()
|
||||
|
||||
## Actions
|
||||
You can listen to an action that occurs in embedded cal link as follows. You can think of them as DOM events. We are avoiding the term "events" to not confuse it with Cal Events.
|
||||
```javascript
|
||||
```html
|
||||
<script>
|
||||
Cal("on", {
|
||||
action: "ANY_ACTION_NAME",
|
||||
callback: (e)=>{
|
||||
@@ -188,6 +193,7 @@ Cal("on", {
|
||||
const {data, type, namespace} = e.detail;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
Following are the list of supported actions.
|
||||
|
||||
Reference in new issue
Block a user