diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index d89bd84150..2198bf1ccc 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -4109,5 +4109,6 @@ "actor": "Actor", "timestamp": "Timestamp", "json": "JSON", + "hubspot_ignore_guests": "Do not create new records for guests added to the booking", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/app-store/hubspot/components/EventTypeAppCardInterface.tsx b/packages/app-store/hubspot/components/EventTypeAppCardInterface.tsx index 84f8ca2110..767b5a55ee 100644 --- a/packages/app-store/hubspot/components/EventTypeAppCardInterface.tsx +++ b/packages/app-store/hubspot/components/EventTypeAppCardInterface.tsx @@ -1,15 +1,28 @@ import { usePathname } from "next/navigation"; +import { useAppContextWithSchema } from "@calcom/app-store/EventTypeAppContext"; import AppCard from "@calcom/app-store/_components/AppCard"; import useIsAppEnabled from "@calcom/app-store/_utils/useIsAppEnabled"; import type { EventTypeAppCardComponent } from "@calcom/app-store/types"; import { WEBAPP_URL } from "@calcom/lib/constants"; +import { useLocale } from "@calcom/lib/hooks/useLocale"; +import { Section } from "@calcom/ui/components/section"; +import { Switch } from "@calcom/ui/components/form"; -const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({ app, eventType, onAppInstallSuccess }) { +import type { appDataSchema } from "../zod"; + +const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({ + app, + eventType, + onAppInstallSuccess, +}) { const pathname = usePathname(); - + const { t } = useLocale(); + const { getAppData, setAppData } = useAppContextWithSchema(); const { enabled, updateEnabled } = useIsAppEnabled(app); + const ignoreGuests = getAppData("ignoreGuests") ?? false; + return ( + hideSettingsIcon> + + + + { + setAppData("ignoreGuests", checked); + }} + /> + + + + ); }; -export default EventTypeAppCard; +export default EventTypeAppCard; \ No newline at end of file diff --git a/packages/app-store/hubspot/lib/CrmService.ts b/packages/app-store/hubspot/lib/CrmService.ts index 3468d23f7c..438b390753 100644 --- a/packages/app-store/hubspot/lib/CrmService.ts +++ b/packages/app-store/hubspot/lib/CrmService.ts @@ -6,6 +6,7 @@ import type { SimplePublicObject, SimplePublicObjectInput, } from "@hubspot/api-client/lib/codegen/crm/objects/meetings"; +import type { z } from "zod"; import { getLocation } from "@calcom/lib/CalEventParser"; import getLabelValueMapFromResponses from "@calcom/lib/bookings/getLabelValueMapFromResponses"; @@ -20,6 +21,7 @@ import type { CRM, ContactCreateInput, Contact, CrmEvent } from "@calcom/types/C import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug"; import refreshOAuthTokens from "../../_utils/oauth/refreshOAuthTokens"; import type { HubspotToken } from "../api/callback"; +import type { appDataSchema } from "../zod"; export default class HubspotCalendarService implements CRM { private url = ""; @@ -29,8 +31,9 @@ export default class HubspotCalendarService implements CRM { private client_id = ""; private client_secret = ""; private hubspotClient: hubspot.Client; + private appOptions: z.infer; - constructor(credential: CredentialPayload) { + constructor(credential: CredentialPayload, appOptions?: z.infer) { this.hubspotClient = new hubspot.Client(); this.integrationName = "hubspot_other_calendar"; @@ -38,6 +41,8 @@ export default class HubspotCalendarService implements CRM { this.auth = this.hubspotAuth(credential).then((r) => r); this.log = logger.getSubLogger({ prefix: [`[[lib] ${this.integrationName}`] }); + + this.appOptions = appOptions || {}; } private getHubspotMeetingBody = (event: CalendarEvent): string => { @@ -300,7 +305,7 @@ export default class HubspotCalendarService implements CRM { } getAppOptions() { - console.log("No options implemented"); + return this.appOptions; } async handleAttendeeNoShow() { diff --git a/packages/app-store/hubspot/zod.ts b/packages/app-store/hubspot/zod.ts index 8cfdc5ee22..64732e0740 100644 --- a/packages/app-store/hubspot/zod.ts +++ b/packages/app-store/hubspot/zod.ts @@ -2,7 +2,9 @@ import { z } from "zod"; import { eventTypeAppCardZod } from "../eventTypeAppCardZod"; -export const appDataSchema = eventTypeAppCardZod; +export const appDataSchema = eventTypeAppCardZod.extend({ + ignoreGuests: z.boolean().optional(), +}); export const appKeysSchema = z.object({ client_id: z.string().min(1),