Add config support in floatingButton api (#8986)
Co-authored-by: alannnc <[email protected]>
This commit is contained in:
1 parent
c7c75ff4d3
commit
933cc739bd
3 files changed
+18
-1
No files matched your search
@@ -333,6 +333,16 @@ Cal("init", "routingFormDark", {
|
||||
|
||||
if (only === "all" || only == "ns:floatingButton") {
|
||||
Cal.ns.floatingButton("floatingButton", {
|
||||
calLink: "pro",
|
||||
calLink: "pro/30min",
|
||||
config: {
|
||||
iframeAttrs: {
|
||||
id: "floatingtest",
|
||||
},
|
||||
name: "John",
|
||||
email: "[email protected]",
|
||||
notes: "Test Meeting",
|
||||
guests: ["[email protected]", "[email protected]"],
|
||||
theme: "dark",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -4,6 +4,7 @@ type ModalTargetDatasetProps = {
|
||||
calLink: string;
|
||||
calNamespace: string;
|
||||
calOrigin: string;
|
||||
calConfig: string;
|
||||
};
|
||||
|
||||
type CamelCase<T extends string> = T extends `${infer U}${infer V}` ? `${Uppercase<U>}${V}` : T;
|
||||
|
||||
@@ -435,6 +435,7 @@ class CalApi {
|
||||
buttonColor = "rgb(0, 0, 0)",
|
||||
buttonTextColor = "rgb(255, 255, 255)",
|
||||
calOrigin,
|
||||
config,
|
||||
}: {
|
||||
calLink: string;
|
||||
buttonText?: string;
|
||||
@@ -444,6 +445,7 @@ class CalApi {
|
||||
buttonColor?: string;
|
||||
buttonTextColor?: string;
|
||||
calOrigin?: string;
|
||||
config?: PrefillAndIframeAttrsConfig;
|
||||
}) {
|
||||
// validate(arguments[0], {
|
||||
// required: true,
|
||||
@@ -466,6 +468,10 @@ class CalApi {
|
||||
el.dataset.calLink = calLink;
|
||||
el.dataset.calNamespace = this.cal.namespace;
|
||||
el.dataset.calOrigin = calOrigin ?? "";
|
||||
if (config) {
|
||||
el.dataset.calConfig = JSON.stringify(config);
|
||||
}
|
||||
|
||||
if (attributes?.id) {
|
||||
el.id = attributes.id;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user