Scheduling infrastructure for absolutely everyone.
Chore/salesforce prep work (#5648)
Omar Lópeza94d51c4bdad
diff --git a/.env.appStore.example b/.env.appStore.exampleindex 1d59c5172d1..dafa17f00ec 100644--- a/.env.appStore.example+++ b/.env.appStore.example@@ -11,6 +11,9 @@# - ZOOM# - GIPHY# - VITAL+# - ZAPIER+# - LARK+# - WEB3# - APP STORE **********************************************************************************************# ⚠️ ⚠️ ⚠️ THESE WILL BE MIGRATED TO THE DATABASE TO PREVENT AWS's 4KB ENV QUOTA ⚠️ ⚠️ ⚠️@@ -88,7 +91,7 @@ VITAL_REGION="us"# @see https://github.com/calcom/cal.com/blob/main/packages/app-store/zapier/README.mdZAPIER_INVITE_LINK=""-# - LARK+# - LARK# Needed to enable Lark Calendar integration and Login with Lark# @see <https://open.larksuite.com/document/ukTMukTMukTM/ukDNz4SO0MjL5QzM/g>LARK_OPEN_APP_ID=""diff --git a/README.md b/README.mdindex 2e2a933d524..bb706232894 100644--- a/README.md+++ b/README.md@@ -387,7 +387,7 @@ following4. Fill in any information you want in the "App info" tab5. Go to tab "Auth"6. Now copy the Client ID and Client Secret to your .env file into the `HUBSPOT_CLIENT_ID` and `HUBSPOT_CLIENT_SECRET` fields.-7. Set the Redirect URL for OAuth `<Cal.com URL>/api/integrations/hubspotothercalendar/callback` replacing Cal.com URL with the URI at which your application runs.+7. Set the Redirect URL for OAuth `<Cal.com URL>/api/integrations/hubspot/callback` replacing Cal.com URL with the URI at which your application runs.8. In the "Scopes" section at the bottom of the page, make sure you select "Read" and "Write" for scope called `crm.objects.contacts`9. Click the "Save" button at the bottom footer.10. You're good to go. Now you can see any booking in Cal.com created as a meeting in HubSpot for your contacts.diff --git a/jest.config.ts b/jest.config.tsindex 5145bfd33d4..0fbd0948835 100644--- a/jest.config.ts+++ b/jest.config.ts@@ -41,14 +41,14 @@ const config: Config = {},{displayName: "@calcom/closecom",- roots: ["<rootDir>/packages/app-store/closecomothercalendar"],+ roots: ["<rootDir>/packages/app-store/closecom"],testMatch: ["**/test/lib/**/*.(spec|test).(ts|tsx|js)"],transform: {"^.+\\.ts?$": "ts-jest",},transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"],testEnvironment: "jsdom",- setupFiles: ["<rootDir>/packages/app-store/closecomothercalendar/test/globals.ts"],+ setupFiles: ["<rootDir>/packages/app-store/closecom/test/globals.ts"],},{displayName: "@calcom/routing-forms",diff --git a/packages/app-store/_pages/setup/index.tsx b/packages/app-store/_pages/setup/index.tsxindex 9259f750adb..6d5ae061b64 100644--- a/packages/app-store/_pages/setup/index.tsx+++ b/packages/app-store/_pages/setup/index.tsx@@ -9,7 +9,7 @@ export const AppSetupMap = {"exchange2016-calendar": dynamic(() => import("../../exchange2016calendar/pages/setup")),"caldav-calendar": dynamic(() => import("../../caldavcalendar/pages/setup")),zapier: dynamic(() => import("../../zapier/pages/setup")),- closecom: dynamic(() => import("../../closecomothercalendar/pages/setup")),+ closecom: dynamic(() => import("../../closecom/pages/setup")),sendgrid: dynamic(() => import("../../sendgrid/pages/setup")),};diff --git a/packages/app-store/_utils/getCalendar.ts b/packages/app-store/_utils/getCalendar.tsindex 213f150ae0b..9ae28c128bb 100644--- a/packages/app-store/_utils/getCalendar.ts+++ b/packages/app-store/_utils/getCalendar.ts@@ -9,8 +9,8 @@ const log = logger.getChildLogger({ prefix: ["CalendarManager"] });export const getCalendar = (credential: CredentialPayload | null): Calendar | null => {if (!credential || !credential.key) return null;let { type: calendarType } = credential;- if (calendarType === "sendgrid_other_calendar") {- calendarType = "sendgrid";+ if (calendarType?.endsWith("_other_calendar")) {+ calendarType = calendarType.split("_other_calendar")[0];}const calendarApp = appStore[calendarType.split("_").join("") as keyof typeof appStore];if (!(calendarApp && "lib" in calendarApp && "CalendarService" in calendarApp.lib)) {diff --git a/packages/app-store/_utils/useAddAppMutation.ts b/packages/app-store/_utils/useAddAppMutation.tsindex e85de87d763..d2241dbac03 100644--- a/packages/app-store/_utils/useAddAppMutation.ts+++ b/packages/app-store/_utils/useAddAppMutation.ts@@ -36,8 +36,8 @@ function useAddAppMutation(_type: App["type"] | null, options?: UseAddAppMutatioisOmniInstall = variables.isOmniInstall;type = variables.type;}- if (type === "sendgrid_other_calendar") {- type = "sendgrid";+ if (type?.endsWith("_other_calendar")) {+ type = type.split("_other_calendar")[0];}const state: IntegrationOAuthCallbackState = {returnTo:@@ -73,7 +73,7 @@ function useAddAppMutation(_type: App["type"] | null, options?: UseAddAppMutatiogotoUrl(json.url, json.newTab);}- return { setupPending: !externalUrl && json.url.endsWith("/setup") };+ return { setupPending: externalUrl || json.url.endsWith("/setup") };}, options);return mutation;diff --git a/packages/app-store/apps.browser.generated.tsx b/packages/app-store/apps.browser.generated.tsxindex b51ea43323d..0da82056e88 100644--- a/packages/app-store/apps.browser.generated.tsx+++ b/packages/app-store/apps.browser.generated.tsx@@ -8,12 +8,12 @@ export const InstallAppButtonMap = {applecalendar: dynamic(() => import("./applecalendar/components/InstallAppButton")),around: dynamic(() => import("./around/components/InstallAppButton")),caldavcalendar: dynamic(() => import("./caldavcalendar/components/InstallAppButton")),- closecomothercalendar: dynamic(() => import("./closecomothercalendar/components/InstallAppButton")),+ closecom: dynamic(() => import("./closecom/components/InstallAppButton")),exchange2013calendar: dynamic(() => import("./exchange2013calendar/components/InstallAppButton")),exchange2016calendar: dynamic(() => import("./exchange2016calendar/components/InstallAppButton")),exchangecalendar: dynamic(() => import("./exchangecalendar/components/InstallAppButton")),googlecalendar: dynamic(() => import("./googlecalendar/components/InstallAppButton")),- hubspotothercalendar: dynamic(() => import("./hubspotothercalendar/components/InstallAppButton")),+ hubspot: dynamic(() => import("./hubspot/components/InstallAppButton")),huddle01video: dynamic(() => import("./huddle01video/components/InstallAppButton")),jitsivideo: dynamic(() => import("./jitsivideo/components/InstallAppButton")),larkcalendar: dynamic(() => import("./larkcalendar/components/InstallAppButton")),diff --git a/packages/app-store/apps.metadata.generated.ts b/packages/app-store/apps.metadata.generated.tsindex c875b7413c1..df6120d1076 100644--- a/packages/app-store/apps.metadata.generated.ts+++ b/packages/app-store/apps.metadata.generated.ts@@ -6,7 +6,7 @@ import { metadata as applecalendar_meta } from "./applecalendar/_metadata";import { metadata as around_meta } from "./around/_metadata";import { metadata as caldavcalendar_meta } from "./caldavcalendar/_metadata";import { metadata as campfire_meta } from "./campfire/_metadata";-import { metadata as closecomothercalendar_meta } from "./closecomothercalendar/_metadata";+import { metadata as closecom_meta } from "./closecom/_metadata";import { metadata as dailyvideo_meta } from "./dailyvideo/_metadata";import { metadata as routing_forms_meta } from "./ee/routing-forms/_metadata";import { metadata as exchange2013calendar_meta } from "./exchange2013calendar/_metadata";@@ -17,7 +17,7 @@ import { metadata as ga4_meta } from "./ga4/_metadata";import { metadata as giphy_meta } from "./giphy/_metadata";import { metadata as googlecalendar_meta } from "./googlecalendar/_metadata";import { metadata as googlevideo_meta } from "./googlevideo/_metadata";-import { metadata as hubspotothercalendar_meta } from "./hubspotothercalendar/_metadata";+import { metadata as hubspot_meta } from "./hubspot/_metadata";import { metadata as huddle01video_meta } from "./huddle01video/_metadata";import { metadata as jitsivideo_meta } from "./jitsivideo/_metadata";import { metadata as larkcalendar_meta } from "./larkcalendar/_metadata";@@ -49,7 +49,7 @@ export const appStoreMetadata = {around: around_meta,caldavcalendar: caldavcalendar_meta,campfire: campfire_meta,- closecomothercalendar: closecomothercalendar_meta,+ closecom: closecom_meta,dailyvideo: dailyvideo_meta,"routing-forms": routing_forms_meta,exchange2013calendar: exchange2013calendar_meta,@@ -60,7 +60,7 @@ export const appStoreMetadata = {giphy: giphy_meta,googlecalendar: googlecalendar_meta,googlevideo: googlevideo_meta,- hubspotothercalendar: hubspotothercalendar_meta,+ hubspot: hubspot_meta,huddle01video: huddle01video_meta,jitsivideo: jitsivideo_meta,larkcalendar: larkcalendar_meta,diff --git a/packages/app-store/apps.server.generated.ts b/packages/app-store/apps.server.generated.tsindex b5913fe584c..e4f65ae0984 100644--- a/packages/app-store/apps.server.generated.ts+++ b/packages/app-store/apps.server.generated.ts@@ -7,7 +7,7 @@ export const apiHandlers = {around: import("./around/api"),caldavcalendar: import("./caldavcalendar/api"),campfire: import("./campfire/api"),- closecomothercalendar: import("./closecomothercalendar/api"),+ closecom: import("./closecom/api"),"routing-forms": import("./ee/routing-forms/api"),exchange2013calendar: import("./exchange2013calendar/api"),exchange2016calendar: import("./exchange2016calendar/api"),@@ -16,7 +16,7 @@ export const apiHandlers = {ga4: import("./ga4/api"),giphy: import("./giphy/api"),googlecalendar: import("./googlecalendar/api"),- hubspotothercalendar: import("./hubspotothercalendar/api"),+ hubspot: import("./hubspot/api"),huddle01video: import("./huddle01video/api"),jitsivideo: import("./jitsivideo/api"),larkcalendar: import("./larkcalendar/api"),diff --git a/packages/app-store/closecomothercalendar/README.mdx b/packages/app-store/closecom/README.mdxsimilarity index 64%rename from packages/app-store/closecomothercalendar/README.mdxrename to packages/app-store/closecom/README.mdxindex e8b8be26946..4f94afbcca4 100644--- a/packages/app-store/closecomothercalendar/README.mdx+++ b/packages/app-store/closecom/README.mdx@@ -1,10 +1,10 @@---items:- - /api/app-store/closecomothercalendar/1.jpg- - /api/app-store/closecomothercalendar/2.jpg- - /api/app-store/closecomothercalendar/3.jpg- - /api/app-store/closecomothercalendar/4.jpg- - /api/app-store/closecomothercalendar/5.jpg+ - /api/app-store/closecom/1.jpg+ - /api/app-store/closecom/2.jpg+ - /api/app-store/closecom/3.jpg+ - /api/app-store/closecom/4.jpg+ - /api/app-store/closecom/5.jpg---- Close is a modern CRM with build-in sales communication tools for email, phone, SMS, and meetings.diff --git a/packages/app-store/closecomothercalendar/_metadata.ts b/packages/app-store/closecom/_metadata.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/_metadata.tsrename to packages/app-store/closecom/_metadata.tsdiff --git a/packages/app-store/closecomothercalendar/api/_getAdd.ts b/packages/app-store/closecom/api/_getAdd.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/api/_getAdd.tsrename to packages/app-store/closecom/api/_getAdd.tsdiff --git a/packages/app-store/closecomothercalendar/api/_postAdd.ts b/packages/app-store/closecom/api/_postAdd.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/api/_postAdd.tsrename to packages/app-store/closecom/api/_postAdd.tsdiff --git a/packages/app-store/closecomothercalendar/api/_postCheck.ts b/packages/app-store/closecom/api/_postCheck.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/api/_postCheck.tsrename to packages/app-store/closecom/api/_postCheck.tsdiff --git a/packages/app-store/closecomothercalendar/api/add.ts b/packages/app-store/closecom/api/add.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/api/add.tsrename to packages/app-store/closecom/api/add.tsdiff --git a/packages/app-store/closecomothercalendar/api/check.ts b/packages/app-store/closecom/api/check.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/api/check.tsrename to packages/app-store/closecom/api/check.tsdiff --git a/packages/app-store/closecomothercalendar/api/index.ts b/packages/app-store/closecom/api/index.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/api/index.tsrename to packages/app-store/closecom/api/index.tsdiff --git a/packages/app-store/closecomothercalendar/components/InstallAppButton.tsx b/packages/app-store/closecom/components/InstallAppButton.tsxsimilarity index 100%rename from packages/app-store/closecomothercalendar/components/InstallAppButton.tsxrename to packages/app-store/closecom/components/InstallAppButton.tsxdiff --git a/packages/app-store/closecomothercalendar/components/index.ts b/packages/app-store/closecom/components/index.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/components/index.tsrename to packages/app-store/closecom/components/index.tsdiff --git a/packages/app-store/closecomothercalendar/config.json b/packages/app-store/closecom/config.jsonsimilarity index 80%rename from packages/app-store/closecomothercalendar/config.jsonrename to packages/app-store/closecom/config.jsonindex c1bb3f781af..169a365efb8 100644--- a/packages/app-store/closecomothercalendar/config.json+++ b/packages/app-store/closecom/config.json@@ -4,8 +4,8 @@"title": "Close.com","slug": "closecom","type": "closecom_other_calendar",- "imageSrc": "/api/app-store/closecomothercalendar/icon.svg",- "logo": "/api/app-store/closecomothercalendar/icon.svg",+ "imageSrc": "/api/app-store/closecom/icon.svg",+ "logo": "/api/app-store/closecom/icon.svg","url": "https://cal.com/apps/closecom","variant": "other","categories": ["other"],diff --git a/packages/app-store/closecomothercalendar/index.ts b/packages/app-store/closecom/index.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/index.tsrename to packages/app-store/closecom/index.tsdiff --git a/packages/app-store/closecomothercalendar/lib/CalendarService.ts b/packages/app-store/closecom/lib/CalendarService.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/lib/CalendarService.tsrename to packages/app-store/closecom/lib/CalendarService.tsdiff --git a/packages/app-store/closecomothercalendar/lib/index.ts b/packages/app-store/closecom/lib/index.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/lib/index.tsrename to packages/app-store/closecom/lib/index.tsdiff --git a/packages/app-store/closecomothercalendar/package.json b/packages/app-store/closecom/package.jsonsimilarity index 100%rename from packages/app-store/closecomothercalendar/package.jsonrename to packages/app-store/closecom/package.jsondiff --git a/packages/app-store/closecomothercalendar/pages/setup/index.tsx b/packages/app-store/closecom/pages/setup/index.tsxsimilarity index 97%rename from packages/app-store/closecomothercalendar/pages/setup/index.tsxrename to packages/app-store/closecom/pages/setup/index.tsxindex d9ae9f1bfef..efc5b5434e6 100644--- a/packages/app-store/closecomothercalendar/pages/setup/index.tsx+++ b/packages/app-store/closecom/pages/setup/index.tsx@@ -42,7 +42,7 @@ export default function CloseComSetup() {<div>{/* eslint-disable @next/next/no-img-element */}<img- src="/api/app-store/closecomothercalendar/icon.svg"+ src="/api/app-store/closecom/icon.svg"alt="Apple Calendar"className="h-12 w-12 max-w-2xl"/>@@ -65,7 +65,7 @@ export default function CloseComSetup() {<Formform={form}handleSubmit={async (values) => {- const res = await fetch("/api/integrations/closecomothercalendar/add", {+ const res = await fetch("/api/integrations/closecom/add", {method: "POST",body: JSON.stringify(values),headers: {@@ -122,7 +122,7 @@ export default function CloseComSetup() {if (!check) return;const api_key = form.getValues("api_key");setTestLoading(true);- const res = await fetch("/api/integrations/closecomothercalendar/check", {+ const res = await fetch("/api/integrations/closecom/check", {method: "POST",body: JSON.stringify({ api_key }),headers: {diff --git a/packages/app-store/closecomothercalendar/static/1.jpg b/packages/app-store/closecom/static/1.jpgsimilarity index 100%rename from packages/app-store/closecomothercalendar/static/1.jpgrename to packages/app-store/closecom/static/1.jpgdiff --git a/packages/app-store/closecomothercalendar/static/2.jpg b/packages/app-store/closecom/static/2.jpgsimilarity index 100%rename from packages/app-store/closecomothercalendar/static/2.jpgrename to packages/app-store/closecom/static/2.jpgdiff --git a/packages/app-store/closecomothercalendar/static/3.jpg b/packages/app-store/closecom/static/3.jpgsimilarity index 100%rename from packages/app-store/closecomothercalendar/static/3.jpgrename to packages/app-store/closecom/static/3.jpgdiff --git a/packages/app-store/closecomothercalendar/static/4.jpg b/packages/app-store/closecom/static/4.jpgsimilarity index 100%rename from packages/app-store/closecomothercalendar/static/4.jpgrename to packages/app-store/closecom/static/4.jpgdiff --git a/packages/app-store/closecomothercalendar/static/5.jpg b/packages/app-store/closecom/static/5.jpgsimilarity index 100%rename from packages/app-store/closecomothercalendar/static/5.jpgrename to packages/app-store/closecom/static/5.jpgdiff --git a/packages/app-store/closecomothercalendar/static/icon.svg b/packages/app-store/closecom/static/icon.svgsimilarity index 100%rename from packages/app-store/closecomothercalendar/static/icon.svgrename to packages/app-store/closecom/static/icon.svgdiff --git a/packages/app-store/closecomothercalendar/test/globals.ts b/packages/app-store/closecom/test/globals.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/test/globals.tsrename to packages/app-store/closecom/test/globals.tsdiff --git a/packages/app-store/closecomothercalendar/test/lib/CalendarService.test.ts b/packages/app-store/closecom/test/lib/CalendarService.test.tssimilarity index 100%rename from packages/app-store/closecomothercalendar/test/lib/CalendarService.test.tsrename to packages/app-store/closecom/test/lib/CalendarService.test.tsdiff --git a/packages/app-store/hubspotothercalendar/README.mdx b/packages/app-store/hubspot/README.mdxsimilarity index 87%rename from packages/app-store/hubspotothercalendar/README.mdxrename to packages/app-store/hubspot/README.mdxindex 54ba72d9a78..ecce11527ae 100644--- a/packages/app-store/hubspotothercalendar/README.mdx+++ b/packages/app-store/hubspot/README.mdx@@ -1,6 +1,6 @@---items:- - /api/app-store/hubspotothercalendar/hubspot01.webp+ - /api/app-store/hubspot/hubspot01.webp---HubSpot is a cloud-based CRM designed to help align sales and marketing teams, foster sales enablement, boost ROI and optimize your inbound marketing strategy to generate more, qualified leads.diff --git a/packages/app-store/hubspotothercalendar/_metadata.ts b/packages/app-store/hubspot/_metadata.tssimilarity index 85%rename from packages/app-store/hubspotothercalendar/_metadata.tsrename to packages/app-store/hubspot/_metadata.tsindex 7a98ef37fd1..ddae52fc4df 100644--- a/packages/app-store/hubspotothercalendar/_metadata.ts+++ b/packages/app-store/hubspot/_metadata.ts@@ -7,9 +7,9 @@ export const metadata = {installed: !!process.env.HUBSPOT_CLIENT_ID,description: _package.description,type: "hubspot_other_calendar",- imageSrc: "/api/app-store/hubspotothercalendar/icon.svg",+ imageSrc: "/api/app-store/hubspot/icon.svg",variant: "other_calendar",- logo: "/api/app-store/hubspotothercalendar/icon.svg",+ logo: "/api/app-store/hubspot/icon.svg",publisher: "Cal.com",url: "https://hubspot.com/",verified: true,diff --git a/packages/app-store/hubspotothercalendar/api/add.ts b/packages/app-store/hubspot/api/add.tssimilarity index 91%rename from packages/app-store/hubspotothercalendar/api/add.tsrename to packages/app-store/hubspot/api/add.tsindex d1c54ff44cf..0cf581932bd 100644--- a/packages/app-store/hubspotothercalendar/api/add.ts+++ b/packages/app-store/hubspot/api/add.ts@@ -17,7 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)if (typeof appKeys.client_id === "string") client_id = appKeys.client_id;if (!client_id) return res.status(400).json({ message: "HubSpot client id missing." });- const redirectUri = WEBAPP_URL + "/api/integrations/hubspotothercalendar/callback";+ const redirectUri = WEBAPP_URL + "/api/integrations/hubspot/callback";const url = hubspotClient.oauth.getAuthorizationUrl(client_id, redirectUri, scopes.join(" "));res.status(200).json({ url });}diff --git a/packages/app-store/hubspotothercalendar/api/callback.ts b/packages/app-store/hubspot/api/callback.tssimilarity index 96%rename from packages/app-store/hubspotothercalendar/api/callback.tsrename to packages/app-store/hubspot/api/callback.tsindex 0ce34985224..ccc4dd8dfda 100644--- a/packages/app-store/hubspotothercalendar/api/callback.ts+++ b/packages/app-store/hubspot/api/callback.ts@@ -39,7 +39,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)const hubspotToken: HubspotToken = await hubspotClient.oauth.tokensApi.createToken("authorization_code",code,- WEBAPP_URL + "/api/integrations/hubspotothercalendar/callback",+ WEBAPP_URL + "/api/integrations/hubspot/callback",client_id,client_secret);diff --git a/packages/app-store/hubspotothercalendar/api/index.ts b/packages/app-store/hubspot/api/index.tssimilarity index 100%rename from packages/app-store/hubspotothercalendar/api/index.tsrename to packages/app-store/hubspot/api/index.tsdiff --git a/packages/app-store/hubspotothercalendar/components/InstallAppButton.tsx b/packages/app-store/hubspot/components/InstallAppButton.tsxsimilarity index 100%rename from packages/app-store/hubspotothercalendar/components/InstallAppButton.tsxrename to packages/app-store/hubspot/components/InstallAppButton.tsxdiff --git a/packages/app-store/hubspotothercalendar/components/index.ts b/packages/app-store/hubspot/components/index.tssimilarity index 100%rename from packages/app-store/hubspotothercalendar/components/index.tsrename to packages/app-store/hubspot/components/index.tsdiff --git a/packages/app-store/hubspotothercalendar/index.ts b/packages/app-store/hubspot/index.tssimilarity index 100%rename from packages/app-store/hubspotothercalendar/index.tsrename to packages/app-store/hubspot/index.tsdiff --git a/packages/app-store/hubspotothercalendar/lib/CalendarService.ts b/packages/app-store/hubspot/lib/CalendarService.tssimilarity index 98%rename from packages/app-store/hubspotothercalendar/lib/CalendarService.tsrename to packages/app-store/hubspot/lib/CalendarService.tsindex f8d3edc7bda..a9d7988dad7 100644--- a/packages/app-store/hubspotothercalendar/lib/CalendarService.ts+++ b/packages/app-store/hubspot/lib/CalendarService.ts@@ -23,7 +23,7 @@ import type { HubspotToken } from "../api/callback";const hubspotClient = new hubspot.Client();-export default class HubspotOtherCalendarService implements Calendar {+export default class HubspotCalendarService implements Calendar {private url = "";private integrationName = "";private auth: Promise<{ getToken: () => Promise<any> }>;@@ -168,7 +168,7 @@ export default class HubspotOtherCalendarService implements Calendar {const hubspotRefreshToken: HubspotToken = await hubspotClient.oauth.tokensApi.createToken("refresh_token",undefined,- WEBAPP_URL + "/api/integrations/hubspotothercalendar/callback",+ WEBAPP_URL + "/api/integrations/hubspot/callback",this.client_id,this.client_secret,refreshTokendiff --git a/packages/app-store/hubspotothercalendar/lib/index.ts b/packages/app-store/hubspot/lib/index.tssimilarity index 100%rename from packages/app-store/hubspotothercalendar/lib/index.tsrename to packages/app-store/hubspot/lib/index.tsdiff --git a/packages/app-store/hubspotothercalendar/package.json b/packages/app-store/hubspot/package.jsonsimilarity index 91%rename from packages/app-store/hubspotothercalendar/package.jsonrename to packages/app-store/hubspot/package.jsonindex f9292293a8c..9cf90e5cd35 100644--- a/packages/app-store/hubspotothercalendar/package.json+++ b/packages/app-store/hubspot/package.json@@ -1,6 +1,6 @@{"private": true,- "name": "@calcom/hubspotothercalendar",+ "name": "@calcom/hubspot","version": "0.0.0","main": "./index.ts","description": "HubSpot is a cloud-based CRM designed to help align sales and marketing teams, foster sales enablement, boost ROI and optimize your inbound marketing strategy to generate more, qualified leads.",diff --git a/packages/app-store/hubspotothercalendar/static/hubspot01.webp b/packages/app-store/hubspot/static/hubspot01.webpsimilarity index 100%rename from packages/app-store/hubspotothercalendar/static/hubspot01.webprename to packages/app-store/hubspot/static/hubspot01.webpdiff --git a/packages/app-store/hubspotothercalendar/static/icon.svg b/packages/app-store/hubspot/static/icon.svgsimilarity index 100%rename from packages/app-store/hubspotothercalendar/static/icon.svgrename to packages/app-store/hubspot/static/icon.svgdiff --git a/packages/app-store/index.ts b/packages/app-store/index.tsindex 40825324578..3fc35571bdb 100644--- a/packages/app-store/index.ts+++ b/packages/app-store/index.ts@@ -1,7 +1,7 @@// import * as example from "./_example";import * as applecalendar from "./applecalendar";import * as caldavcalendar from "./caldavcalendar";-import * as closecomothercalendar from "./closecomothercalendar";+import * as closecom from "./closecom";import * as dailyvideo from "./dailyvideo";import * as exchange2013calendar from "./exchange2013calendar";import * as exchange2016calendar from "./exchange2016calendar";@@ -9,7 +9,7 @@ import * as exchangecalendar from "./exchangecalendar";import * as giphy from "./giphy";import * as googlecalendar from "./googlecalendar";import * as googlevideo from "./googlevideo";-import * as hubspotothercalendar from "./hubspotothercalendar";+import * as hubspot from "./hubspot";import * as huddle01video from "./huddle01video";import * as jitsivideo from "./jitsivideo";import * as larkcalendar from "./larkcalendar";@@ -27,11 +27,11 @@ const appStore = {// example,applecalendar,caldavcalendar,- closecomothercalendar,+ closecom,dailyvideo,googlecalendar,googlevideo,- hubspotothercalendar,+ hubspot,huddle01video,jitsivideo,larkcalendar,diff --git a/packages/core/CalendarManager.ts b/packages/core/CalendarManager.tsindex 58c18e5e68b..379fd20bd0c 100644--- a/packages/core/CalendarManager.ts+++ b/packages/core/CalendarManager.ts@@ -190,6 +190,7 @@ export const createEvent = async (const uid: string = getUid(calEvent);const calendar = getCalendar(credential);let success = true;+ let calError: string | undefined = undefined;// Check if the disabledNotes flag is set to trueif (calEvent.hideCalendarNotes) {@@ -207,11 +208,13 @@ export const createEvent = async (if (error?.code === 404) {return undefined;}+ if (error?.calError) {+ calError = error.calError;+ }log.error("createEvent failed", error, calEvent);// @TODO: This code will be off till we can investigate an error with it//https://github.com/calcom/cal.com/issues/3949// await sendBrokenIntegrationEmail(calEvent, "calendar");- https: log.error("createEvent failed", error, calEvent);return undefined;}): undefined;@@ -223,6 +226,8 @@ export const createEvent = async (uid,createdEvent: creationResult,originalEvent: calEvent,+ calError,+ calWarnings: creationResult?.additionalInfo.calWarnings,};};@@ -235,6 +240,9 @@ export const updateEvent = async (const uid = getUid(calEvent);const calendar = getCalendar(credential);let success = false;+ let calError: string | undefined = undefined;+ let calWarnings: string[] | undefined = [];+if (bookingRefUid === "") {log.error("updateEvent failed", "bookingRefUid is empty", calEvent, credential);}@@ -251,10 +259,19 @@ export const updateEvent = async (// @see https://github.com/calcom/cal.com/issues/3949// await sendBrokenIntegrationEmail(calEvent, "calendar");log.error("updateEvent failed", e, calEvent);+ if (e?.calError) {+ calError = e.calError;+ }return undefined;}): undefined;+ if (Array.isArray(updatedResult)) {+ calWarnings = updatedResult.flatMap((res) => res.additionalInfo.calWarnings ?? []);+ } else {+ calWarnings = updatedResult?.additionalInfo.calWarnings;+ }+return {appName: credential.appName,type: credential.type,@@ -262,6 +279,8 @@ export const updateEvent = async (uid,updatedEvent: updatedResult,originalEvent: calEvent,+ calError,+ calWarnings,};};diff --git a/packages/emails/src/components/AppsStatus.tsx b/packages/emails/src/components/AppsStatus.tsxindex fee2760ede8..67f43488ad1 100644--- a/packages/emails/src/components/AppsStatus.tsx+++ b/packages/emails/src/components/AppsStatus.tsx@@ -15,8 +15,22 @@ export const AppsStatus = (props: { calEvent: CalendarEvent; t: TFunction }) =>{props.calEvent.appsStatus.map((status) => (<li key={status.type} style={{ fontWeight: 400 }}>{status.appName}{" "}- {status.success >= 1 && `✅ ${status.success > 1 ? `(x${status.success})` : ""}`}{" "}+ {status.success >= 1 && `✅ ${status.success > 1 ? `(x${status.success})` : ""}`}+ {status.warnings && status.warnings.length >= 1 && (+ <ul style={{ fontSize: "14px" }}>+ {status.warnings.map((warning, i) => (+ <li key={i}>{warning}</li>+ ))}+ </ul>+ )}{status.failures >= 1 && `❌ ${status.failures > 1 ? `(x${status.failures})` : ""}`}+ {status.errors.length >= 1 && (+ <ul>+ {status.errors.map((error, i) => (+ <li key={i}>{error}</li>+ ))}+ </ul>+ )}</li>))}</ul>diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.tsindex 0d039ff4bef..6bbbac33889 100644--- a/packages/features/bookings/lib/handleNewBooking.ts+++ b/packages/features/bookings/lib/handleNewBooking.ts@@ -788,6 +788,8 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) {type: app.type,success: app.success ? 1 : 0,failures: !app.success ? 1 : 0,+ errors: app.calError ? [app.calError] : [],+ warnings: app.calWarnings,}));if (reqAppsStatus === undefined) {@@ -803,6 +805,8 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) {const calcAppsStatus = reqAppsStatus.concat(resultStatus).reduce((prev, curr) => {if (prev[curr.type]) {prev[curr.type].success += curr.success;+ prev[curr.type].errors = prev[curr.type].errors.concat(curr.errors);+ prev[curr.type].warnings = prev[curr.type].warnings?.concat(curr.warnings || []);} else {prev[curr.type] = curr;}diff --git a/packages/lib/CalEventParser.ts b/packages/lib/CalEventParser.tsindex 5f79c6eca76..358a1a8698b 100644--- a/packages/lib/CalEventParser.ts+++ b/packages/lib/CalEventParser.ts@@ -78,12 +78,15 @@ export const getAppsStatus = (calEvent: CalendarEvent) => {return "";}return `\n${calEvent.attendees[0].language.translate("apps_status")}- \n${calEvent.appsStatus.map(- (app) =>- `\t${app.appName} ${app.success >= 1 && `✅ ${app.success > 1 ? `(x${app.success})` : ""}`} ${- app.failures >= 1 && `❌ ${app.failures > 1 ? `(x${app.failures})` : ""}`- }`- )}+ ${calEvent.appsStatus.map((app) => {+ return `\n- ${app.appName} ${+ app.success >= 1 ? `✅ ${app.success > 1 ? `(x${app.success})` : ""}` : ""+ }${+ app.warnings && app.warnings.length >= 1 ? app.warnings.map((warning) => `\n - ${warning}`) : ""+ } ${app.failures && app.failures >= 1 ? `❌ ${app.failures > 1 ? `(x${app.failures})` : ""}` : ""} ${+ app.errors && app.errors.length >= 1 ? app.errors.map((error) => `\n - ${error}`) : ""+ }`;+ })}`;};diff --git a/packages/lib/deriveAppDictKeyFromType.ts b/packages/lib/deriveAppDictKeyFromType.tsindex 9bdcaaf1366..a1313a4d679 100644--- a/packages/lib/deriveAppDictKeyFromType.ts+++ b/packages/lib/deriveAppDictKeyFromType.ts@@ -21,6 +21,7 @@ export function deriveAppDictKeyFromType(appType: string, dict: Record<string, ureturn appTypeVariant2;}+ // TODO: Deprecated?// Transform as last resort removing all underscores, applies to `hubspot_other_calendar` to be `hubsporothercalendar`// and `closecom_other_calendar` to be `closecomothercalendar`const appTypeVariant3 = appType.replace(/_/g, "");diff --git a/packages/prisma/seed-app-store.config.json b/packages/prisma/seed-app-store.config.jsonindex 829bcbf4612..48c442e7576 100644--- a/packages/prisma/seed-app-store.config.json+++ b/packages/prisma/seed-app-store.config.json@@ -108,6 +108,12 @@"slug": "sendgrid","type": "sendgrid_other_calendar"},+ {+ "dirName": "closecom",+ "categories": ["other"],+ "slug": "closecom",+ "type": "closecom_other_calendar"+ },{"dirName": "whatsapp","categories": ["video"],diff --git a/packages/prisma/seed-app-store.ts b/packages/prisma/seed-app-store.tsindex 2384ec9297b..155976df0c5 100644--- a/packages/prisma/seed-app-store.ts+++ b/packages/prisma/seed-app-store.ts@@ -233,13 +233,11 @@ export default async function main() {await createApp("jitsi", "jitsivideo", ["video"], "jitsi_video");// Other appsif (process.env.HUBSPOT_CLIENT_ID && process.env.HUBSPOT_CLIENT_SECRET) {- await createApp("hubspot", "hubspotothercalendar", ["other"], "hubspot_other_calendar", {+ await createApp("hubspot", "hubspot", ["other"], "hubspot_other_calendar", {client_id: process.env.HUBSPOT_CLIENT_ID,client_secret: process.env.HUBSPOT_CLIENT_SECRET,});}- // No need to check if environment variable is present, the API Key is set up by the user, not the system- await createApp("closecom", "closecomothercalendar", ["other"], "closecom_other_calendar");await createApp("wipe-my-cal", "wipemycalother", ["other"], "wipemycal_other");if (process.env.GIPHY_API_KEY) {await createApp("giphy", "giphy", ["other"], "giphy_other", {diff --git a/packages/prisma/zod-utils.ts b/packages/prisma/zod-utils.tsindex c5bf4f005aa..c999fa2efbb 100644--- a/packages/prisma/zod-utils.ts+++ b/packages/prisma/zod-utils.ts@@ -161,6 +161,8 @@ export const extendedBookingCreateBody = bookingCreateBodySchema.merge(success: z.number(),failures: z.number(),type: z.string(),+ errors: z.string().array(),+ warnings: z.string().array().optional(),})).optional(),diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.tsindex 56fa450be33..2dde1492cb3 100644--- a/packages/types/Calendar.d.ts+++ b/packages/types/Calendar.d.ts@@ -39,6 +39,7 @@ export type EventBusyDetails = EventBusyDate & {};export type CalendarServiceType = typeof Calendar;+export type AdditionalInfo = Record<string, unknown> & { calWarnings?: string[] };export type NewCalendarEventType = {uid: string;@@ -46,7 +47,7 @@ export type NewCalendarEventType = {type: string;password: string;url: string;- additionalInfo: Record<string, unknown>;+ additionalInfo: AdditionalInfo;};export type CalendarEventType = {@@ -119,6 +120,8 @@ export type AppsStatus = {type: typeof App["type"];success: number;failures: number;+ errors: string[];+ warnings?: string[];};// If modifying this interface, probably should update builders/calendarEvent filesdiff --git a/packages/types/EventManager.d.ts b/packages/types/EventManager.d.tsindex 1fc36a7bfd7..97759dbcf57 100644--- a/packages/types/EventManager.d.ts+++ b/packages/types/EventManager.d.ts@@ -22,6 +22,8 @@ export interface EventResult<T> {createdEvent?: T;updatedEvent?: T | T[];originalEvent: CalendarEvent;+ calError?: string;+ calWarnings?: string[];}export interface CreateUpdateResult {diff --git a/yarn.lock b/yarn.lockindex a6fd9110867..005cfc8b6cb 100644--- a/yarn.lock+++ b/yarn.lock@@ -7222,16 +7222,11 @@dependencies:"@types/node" "*"-"@types/node@*", "@types/[email protected]", "@types/node@>=8.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0":+"@types/node@*", "@types/[email protected]", "@types/node@>=8.1.0", "@types/node@^12.12.54", "@types/node@^12.12.6", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0":version "16.9.1"resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708"integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==-"@types/node@^12.12.54", "@types/node@^12.12.6":- version "12.20.55"- resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240"- integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==-"@types/nodemailer@^6.4.5":version "6.4.5"resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.5.tgz#09011ac73259245475d1688e4ba101860567dc39"