Skip to content

Commit

Permalink
⚡ (calCom) Add phone prefill option
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jan 8, 2024
1 parent 311753f commit 73d68f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/forge/blocks/calCom/actions/bookEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export const bookEvent = createAction({
label: 'Email',
placeholder: 'johndoe@gmail.com',
}),
phone: option.string.layout({
accordion: 'Prefill information',
label: 'Phone number',
placeholder: '+919999999999',
}),
saveBookedDateInVariableId: option.string.layout({
label: 'Save booked date',
inputType: 'variableDropdown',
Expand Down Expand Up @@ -61,6 +66,7 @@ export const bookEvent = createAction({
name: options.name ?? null,
email: options.email ?? null,
layout: parseLayoutAttr(options.layout),
phone: options.phone ?? null,
},
content: `(function (C, A, L) {
let p = function (a, ar) {
Expand Down Expand Up @@ -94,13 +100,19 @@ export const bookEvent = createAction({
})(window, baseUrl + "/embed/embed.js", "init");
Cal("init", { origin: baseUrl });
const location = phone ? JSON.stringify({
value: "phone",
optionValue: phone
}) : undefined
Cal("inline", {
elementOrSelector: typebotElement,
calLink: link,
layout,
config: {
name: name ?? undefined,
email: email ?? undefined,
location
}
});
Expand Down

0 comments on commit 73d68f0

Please sign in to comment.