+
{t("what_help_needed")}
+
{t("variable")}
+
{" "}
{`{${t("what_help_needed")
.replace(/[^a-zA-Z0-9 ]/g, "")
diff --git a/packages/features/ee/workflows/lib/actionHelperFunctions.ts b/packages/features/ee/workflows/lib/actionHelperFunctions.ts
index e07ddafb2d..965a0f8c52 100644
--- a/packages/features/ee/workflows/lib/actionHelperFunctions.ts
+++ b/packages/features/ee/workflows/lib/actionHelperFunctions.ts
@@ -1,5 +1,11 @@
import { WorkflowActions, WorkflowTemplates, WorkflowTriggerEvents } from "@prisma/client";
-import { whatsappEventCancelledTemplate, whatsappEventCompletedTemplate, whatsappEventRescheduledTemplate, whatsappReminderTemplate } from "../lib/reminders/templates/whatsapp";
+
+import {
+ whatsappEventCancelledTemplate,
+ whatsappEventCompletedTemplate,
+ whatsappEventRescheduledTemplate,
+ whatsappReminderTemplate,
+} from "../lib/reminders/templates/whatsapp";
export function isSMSAction(action: WorkflowActions) {
return action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.SMS_NUMBER;
@@ -10,46 +16,53 @@ export function isWhatsappAction(action: WorkflowActions) {
}
export function isSMSOrWhatsappAction(action: WorkflowActions) {
- return isSMSAction(action) || isWhatsappAction(action)
+ return isSMSAction(action) || isWhatsappAction(action);
}
export function isAttendeeAction(action: WorkflowActions) {
- return action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.EMAIL_ATTENDEE || action === WorkflowActions.WHATSAPP_ATTENDEE;
+ return (
+ action === WorkflowActions.SMS_ATTENDEE ||
+ action === WorkflowActions.EMAIL_ATTENDEE ||
+ action === WorkflowActions.WHATSAPP_ATTENDEE
+ );
}
export function getWhatsappTemplateForTrigger(trigger: WorkflowTriggerEvents): WorkflowTemplates {
- switch(trigger) {
+ switch (trigger) {
case "NEW_EVENT":
case "BEFORE_EVENT":
- return WorkflowTemplates.REMINDER
+ return WorkflowTemplates.REMINDER;
case "AFTER_EVENT":
- return WorkflowTemplates.COMPLETED
+ return WorkflowTemplates.COMPLETED;
case "EVENT_CANCELLED":
- return WorkflowTemplates.CANCELLED
+ return WorkflowTemplates.CANCELLED;
case "RESCHEDULE_EVENT":
- return WorkflowTemplates.RESCHEDULED
+ return WorkflowTemplates.RESCHEDULED;
default:
- return WorkflowTemplates.REMINDER
+ return WorkflowTemplates.REMINDER;
}
}
export function getWhatsappTemplateFunction(template: WorkflowTemplates): typeof whatsappReminderTemplate {
- switch(template) {
+ switch (template) {
case "CANCELLED":
- return whatsappEventCancelledTemplate
+ return whatsappEventCancelledTemplate;
case "COMPLETED":
- return whatsappEventCompletedTemplate
+ return whatsappEventCompletedTemplate;
case "RESCHEDULED":
- return whatsappEventRescheduledTemplate
+ return whatsappEventRescheduledTemplate;
case "CUSTOM":
case "REMINDER":
- return whatsappReminderTemplate
+ return whatsappReminderTemplate;
default:
- return whatsappReminderTemplate
+ return whatsappReminderTemplate;
}
}
-export function getWhatsappTemplateForAction(action: WorkflowActions, template: WorkflowTemplates): string | null {
- const templateFunction = getWhatsappTemplateFunction(template)
- return templateFunction(true, action)
+export function getWhatsappTemplateForAction(
+ action: WorkflowActions,
+ template: WorkflowTemplates
+): string | null {
+ const templateFunction = getWhatsappTemplateFunction(template);
+ return templateFunction(true, action);
}
diff --git a/packages/features/ee/workflows/lib/constants.ts b/packages/features/ee/workflows/lib/constants.ts
index 6dc4ecf54c..fee5c45549 100644
--- a/packages/features/ee/workflows/lib/constants.ts
+++ b/packages/features/ee/workflows/lib/constants.ts
@@ -25,19 +25,16 @@ export const WORKFLOW_TEMPLATES = [
WorkflowTemplates.REMINDER,
WorkflowTemplates.CANCELLED,
WorkflowTemplates.COMPLETED,
- WorkflowTemplates.RESCHEDULED
+ WorkflowTemplates.RESCHEDULED,
] as const;
-export const BASIC_WORKFLOW_TEMPLATES = [
- WorkflowTemplates.CUSTOM,
- WorkflowTemplates.REMINDER,
-] as const;
+export const BASIC_WORKFLOW_TEMPLATES = [WorkflowTemplates.CUSTOM, WorkflowTemplates.REMINDER] as const;
export const WHATSAPP_WORKFLOW_TEMPLATES = [
WorkflowTemplates.REMINDER,
WorkflowTemplates.COMPLETED,
WorkflowTemplates.CANCELLED,
- WorkflowTemplates.RESCHEDULED
+ WorkflowTemplates.RESCHEDULED,
] as const;
export const DYNAMIC_TEXT_VARIABLES = [
diff --git a/packages/features/ee/workflows/lib/getActionIcon.tsx b/packages/features/ee/workflows/lib/getActionIcon.tsx
index 8bcb4544e8..6b61c68b70 100644
--- a/packages/features/ee/workflows/lib/getActionIcon.tsx
+++ b/packages/features/ee/workflows/lib/getActionIcon.tsx
@@ -1,9 +1,9 @@
import type { WorkflowStep } from "@prisma/client";
+import { isSMSOrWhatsappAction } from "@calcom/features/ee/workflows/lib/actionHelperFunctions";
import { classNames } from "@calcom/lib";
import { WorkflowActions } from "@calcom/prisma/enums";
import { Zap, Smartphone, Mail, Bell } from "@calcom/ui/components/icon";
-import { isSMSOrWhatsappAction } from "@calcom/features/ee/workflows/lib/actionHelperFunctions";
export function getActionIcon(steps: WorkflowStep[], className?: string): JSX.Element {
if (steps.length === 0) {
diff --git a/packages/features/ee/workflows/lib/getOptions.ts b/packages/features/ee/workflows/lib/getOptions.ts
index 3aa5b09747..7dd3c0ee9f 100644
--- a/packages/features/ee/workflows/lib/getOptions.ts
+++ b/packages/features/ee/workflows/lib/getOptions.ts
@@ -3,7 +3,13 @@ import type { TFunction } from "next-i18next";
import { WorkflowActions } from "@calcom/prisma/enums";
import { isSMSOrWhatsappAction, isWhatsappAction } from "./actionHelperFunctions";
-import { TIME_UNIT, WHATSAPP_WORKFLOW_TEMPLATES, WORKFLOW_ACTIONS, BASIC_WORKFLOW_TEMPLATES, WORKFLOW_TRIGGER_EVENTS } from "./constants";
+import {
+ TIME_UNIT,
+ WHATSAPP_WORKFLOW_TEMPLATES,
+ WORKFLOW_ACTIONS,
+ BASIC_WORKFLOW_TEMPLATES,
+ WORKFLOW_TRIGGER_EVENTS,
+} from "./constants";
export function getWorkflowActionOptions(t: TFunction, isTeamsPlan?: boolean) {
return WORKFLOW_ACTIONS.filter((action) => action !== WorkflowActions.EMAIL_ADDRESS) //removing EMAIL_ADDRESS for now due to abuse episode
@@ -33,7 +39,8 @@ export function getWorkflowTimeUnitOptions(t: TFunction) {
}
export function getWorkflowTemplateOptions(t: TFunction, action: WorkflowActions | undefined) {
- const TEMPLATES = (action && isWhatsappAction(action)) ? WHATSAPP_WORKFLOW_TEMPLATES : BASIC_WORKFLOW_TEMPLATES;
+ const TEMPLATES =
+ action && isWhatsappAction(action) ? WHATSAPP_WORKFLOW_TEMPLATES : BASIC_WORKFLOW_TEMPLATES;
return TEMPLATES.map((template) => {
return { label: t(`${template.toLowerCase()}`), value: template };
}) as { label: string; value: any }[];
diff --git a/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts
index cb11e3942b..ae6d07d36d 100644
--- a/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts
+++ b/packages/features/ee/workflows/lib/reminders/reminderScheduler.ts
@@ -1,6 +1,7 @@
import type { Workflow, WorkflowsOnEventTypes, WorkflowStep } from "@prisma/client";
import type { MailData } from "@sendgrid/helpers/classes/mail";
+import { isWhatsappAction } from "@calcom/features/ee/workflows/lib/actionHelperFunctions";
import { SENDER_ID, SENDER_NAME } from "@calcom/lib/constants";
import { WorkflowTriggerEvents } from "@calcom/prisma/enums";
import { WorkflowActions } from "@calcom/prisma/enums";
@@ -10,8 +11,6 @@ import { scheduleEmailReminder } from "./emailReminderManager";
import { scheduleSMSReminder } from "./smsReminderManager";
import { scheduleWhatsappReminder } from "./whatsappReminderManager";
-import { isWhatsappAction } from "@calcom/features/ee/workflows/lib/actionHelperFunctions";
-
type ExtendedCalendarEvent = CalendarEvent & {
metadata?: { videoCallUrl: string | undefined };
eventType: { slug?: string };
@@ -113,7 +112,8 @@ export const scheduleWorkflowReminders = async (args: ScheduleWorkflowRemindersA
hideBranding
);
} else if (isWhatsappAction(step.action)) {
- const sendTo = step.action === WorkflowActions.WHATSAPP_ATTENDEE ? smsReminderNumber : step.sendTo;
+ const sendTo =
+ step.action === WorkflowActions.WHATSAPP_ATTENDEE ? smsReminderNumber : step.sendTo;
await scheduleWhatsappReminder(
evt,
sendTo,
@@ -208,7 +208,8 @@ export const sendCancelledReminders = async (args: SendCancelledRemindersArgs) =
hideBranding
);
} else if (isWhatsappAction(step.action)) {
- const sendTo = step.action === WorkflowActions.WHATSAPP_ATTENDEE ? smsReminderNumber : step.sendTo;
+ const sendTo =
+ step.action === WorkflowActions.WHATSAPP_ATTENDEE ? smsReminderNumber : step.sendTo;
await scheduleWhatsappReminder(
evt,
sendTo,
diff --git a/packages/features/ee/workflows/lib/reminders/smsProviders/twilioProvider.ts b/packages/features/ee/workflows/lib/reminders/smsProviders/twilioProvider.ts
index 24c5910825..d5eb0d1e2a 100644
--- a/packages/features/ee/workflows/lib/reminders/smsProviders/twilioProvider.ts
+++ b/packages/features/ee/workflows/lib/reminders/smsProviders/twilioProvider.ts
@@ -20,11 +20,11 @@ function assertTwilio(twilio: TwilioClient.Twilio | undefined): asserts twilio i
}
function getDefaultSender(whatsapp = false) {
- let defaultSender = process.env.TWILIO_PHONE_NUMBER
+ let defaultSender = process.env.TWILIO_PHONE_NUMBER;
if (whatsapp) {
- defaultSender = `whatsapp:+${process.env.TWILIO_WHATSAPP_PHONE_NUMBER}`
+ defaultSender = `whatsapp:+${process.env.TWILIO_WHATSAPP_PHONE_NUMBER}`;
}
- return defaultSender
+ return defaultSender;
}
function getSMSNumber(phone: string, whatsapp = false) {
@@ -43,7 +43,13 @@ export const sendSMS = async (phoneNumber: string, body: string, sender: string,
return response;
};
-export const scheduleSMS = async (phoneNumber: string, body: string, scheduledDate: Date, sender: string, whatsapp = false) => {
+export const scheduleSMS = async (
+ phoneNumber: string,
+ body: string,
+ scheduledDate: Date,
+ sender: string,
+ whatsapp = false
+) => {
assertTwilio(twilio);
const response = await twilio.messages.create({
body: body,
diff --git a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/index.ts b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/index.ts
index 9984ae8e80..36b6eb63e7 100644
--- a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/index.ts
+++ b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/index.ts
@@ -1,4 +1,4 @@
-export * from "./whatsappEventCancelledTemplate"
-export * from "./whatsappEventCompletedTemplate"
-export * from "./whatsappEventReminderTemplate"
-export * from "./whatsappEventRescheduledTemplate"
+export * from "./whatsappEventCancelledTemplate";
+export * from "./whatsappEventCompletedTemplate";
+export * from "./whatsappEventReminderTemplate";
+export * from "./whatsappEventRescheduledTemplate";
diff --git a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCancelledTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCancelledTemplate.ts
index d3406c4b8c..291874d478 100644
--- a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCancelledTemplate.ts
+++ b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCancelledTemplate.ts
@@ -1,6 +1,7 @@
-import dayjs from "@calcom/dayjs";
import { WorkflowActions } from "@prisma/client";
+import dayjs from "@calcom/dayjs";
+
export const whatsappEventCancelledTemplate = (
isEditingMode: boolean,
action?: WorkflowActions,
@@ -26,8 +27,8 @@ export const whatsappEventCancelledTemplate = (
const templateOne = `Hi${
name ? ` ${name}` : ``
- }, your meeting (*${eventName}*) with ${attendee} on ${eventDate} at ${startTime} ${timeZone} has been canceled.`
-
+ }, your meeting (*${eventName}*) with ${attendee} on ${eventDate} at ${startTime} ${timeZone} has been canceled.`;
+
//Twilio supports up to 1024 characters for whatsapp template messages
if (templateOne.length <= 1024) return templateOne;
diff --git a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCompletedTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCompletedTemplate.ts
index 78ead4f18a..4dc23ad93d 100644
--- a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCompletedTemplate.ts
+++ b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventCompletedTemplate.ts
@@ -1,6 +1,7 @@
-import dayjs from "@calcom/dayjs";
import { WorkflowActions } from "@prisma/client";
+import dayjs from "@calcom/dayjs";
+
export const whatsappEventCompletedTemplate = (
isEditingMode: boolean,
action?: WorkflowActions,
diff --git a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventRescheduledTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventRescheduledTemplate.ts
index f816981175..813560c9a8 100644
--- a/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventRescheduledTemplate.ts
+++ b/packages/features/ee/workflows/lib/reminders/templates/whatsapp/whatsappEventRescheduledTemplate.ts
@@ -1,4 +1,5 @@
import { WorkflowActions } from "@prisma/client";
+
import dayjs from "@calcom/dayjs";
export const whatsappEventRescheduledTemplate = (
@@ -27,8 +28,7 @@ export const whatsappEventRescheduledTemplate = (
const templateOne = `Hi${
name ? ` ${name}` : ``
}, your meeting (*${eventName}*) with ${attendee} on ${eventDate} at ${startTime} ${timeZone} has been rescheduled.`;
-
-
+
//Twilio supports up to 1024 characters for whatsapp template messages
if (templateOne.length <= 1024) return templateOne;
diff --git a/packages/features/ee/workflows/lib/reminders/whatsappReminderManager.ts b/packages/features/ee/workflows/lib/reminders/whatsappReminderManager.ts
index e3a3098ce0..77dc2ce07a 100644
--- a/packages/features/ee/workflows/lib/reminders/whatsappReminderManager.ts
+++ b/packages/features/ee/workflows/lib/reminders/whatsappReminderManager.ts
@@ -2,12 +2,17 @@ import type { TimeUnit } from "@prisma/client";
import { WorkflowTriggerEvents, WorkflowTemplates, WorkflowActions, WorkflowMethods } from "@prisma/client";
import dayjs from "@calcom/dayjs";
-import prisma from "@calcom/prisma";
import logger from "@calcom/lib/logger";
-import { BookingInfo, deleteScheduledSMSReminder, timeUnitLowerCase } from "./smsReminderManager";
+import prisma from "@calcom/prisma";
import * as twilio from "./smsProviders/twilioProvider";
-import { whatsappEventCancelledTemplate, whatsappEventCompletedTemplate, whatsappEventRescheduledTemplate, whatsappReminderTemplate } from "./templates/whatsapp";
+import { BookingInfo, deleteScheduledSMSReminder, timeUnitLowerCase } from "./smsReminderManager";
+import {
+ whatsappEventCancelledTemplate,
+ whatsappEventCompletedTemplate,
+ whatsappEventRescheduledTemplate,
+ whatsappReminderTemplate,
+} from "./templates/whatsapp";
const log = logger.getChildLogger({ prefix: ["[whatsappReminderManager]"] });
@@ -55,25 +60,57 @@ export const scheduleWhatsappReminder = async (
}
const name = action === WorkflowActions.WHATSAPP_ATTENDEE ? evt.attendees[0].name : evt.organizer.name;
- const attendeeName = action === WorkflowActions.WHATSAPP_ATTENDEE ? evt.organizer.name : evt.attendees[0].name;
+ const attendeeName =
+ action === WorkflowActions.WHATSAPP_ATTENDEE ? evt.organizer.name : evt.attendees[0].name;
const timeZone =
action === WorkflowActions.WHATSAPP_ATTENDEE ? evt.attendees[0].timeZone : evt.organizer.timeZone;
- switch(template) {
+ switch (template) {
case WorkflowTemplates.REMINDER:
- message = whatsappReminderTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) || message;
+ message =
+ whatsappReminderTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) ||
+ message;
break;
case WorkflowTemplates.CANCELLED:
- message = whatsappEventCancelledTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) || message;
- break
+ message =
+ whatsappEventCancelledTemplate(
+ false,
+ action,
+ evt.startTime,
+ evt.title,
+ timeZone,
+ attendeeName,
+ name
+ ) || message;
+ break;
case WorkflowTemplates.RESCHEDULED:
- message = whatsappEventRescheduledTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) || message;
+ message =
+ whatsappEventRescheduledTemplate(
+ false,
+ action,
+ evt.startTime,
+ evt.title,
+ timeZone,
+ attendeeName,
+ name
+ ) || message;
break;
case WorkflowTemplates.COMPLETED:
- message = whatsappEventCompletedTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) || message;
- break
+ message =
+ whatsappEventCompletedTemplate(
+ false,
+ action,
+ evt.startTime,
+ evt.title,
+ timeZone,
+ attendeeName,
+ name
+ ) || message;
+ break;
default:
- message = whatsappReminderTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) || message;
+ message =
+ whatsappReminderTemplate(false, action, evt.startTime, evt.title, timeZone, attendeeName, name) ||
+ message;
}
// Allows debugging generated whatsapp content without waiting for twilio to send whatsapp messages
diff --git a/packages/features/ee/workflows/pages/workflow.tsx b/packages/features/ee/workflows/pages/workflow.tsx
index c91b42d12e..836f676770 100644
--- a/packages/features/ee/workflows/pages/workflow.tsx
+++ b/packages/features/ee/workflows/pages/workflow.tsx
@@ -221,7 +221,7 @@ function WorkflowPage() {
//check if phone number is verified
if (
- (step.action === WorkflowActions.SMS_NUMBER || step.action === WorkflowActions.WHATSAPP_NUMBER) &&
+ (step.action === WorkflowActions.SMS_NUMBER || step.action === WorkflowActions.WHATSAPP_NUMBER) &&
!verifiedNumbers?.find((verifiedNumber) => verifiedNumber.phoneNumber === step.sendTo)
) {
isVerified = false;
diff --git a/packages/features/form-builder/FormBuilderFieldsSchema.ts b/packages/features/form-builder/FormBuilderFieldsSchema.ts
index cd8dd17f8c..fa50092ca6 100644
--- a/packages/features/form-builder/FormBuilderFieldsSchema.ts
+++ b/packages/features/form-builder/FormBuilderFieldsSchema.ts
@@ -71,9 +71,7 @@ const fieldSchema = z.object({
required: z.boolean().default(false).optional(),
hidden: z.boolean().optional(),
- editable: EditableSchema
- .default("user")
- .optional(),
+ editable: EditableSchema.default("user").optional(),
sources: z
.array(
z.object({