Skip to content

Scheduling infrastructure for absolutely everyone.

Refactor app store & fix admin apps list bugs (#7812)

Joe Au-Yeungf6f257c70597
diff --git a/packages/app-store-cli/src/core.ts b/packages/app-store-cli/src/core.ts
index e19dda35e49..7c06fbf1728 100644
--- a/packages/app-store-cli/src/core.ts
+++ b/packages/app-store-cli/src/core.ts
@@ -112,6 +112,7 @@ export const BaseAppFork = {
isTemplate,
// Store the template used to create an app
__template: template,
+ dirName: slug,
};
const currentConfig = JSON.parse(fs.readFileSync(`${appDirPath}/config.json`).toString());
config = {
diff --git a/packages/app-store/_utils/useAddAppMutation.ts b/packages/app-store/_utils/useAddAppMutation.ts
index 48dc918af03..3bfd2770cc5 100644
--- a/packages/app-store/_utils/useAddAppMutation.ts
+++ b/packages/app-store/_utils/useAddAppMutation.ts
@@ -73,7 +73,7 @@ function useAddAppMutation(_type: App["type"] | null, allOptions?: UseAddAppMuta
if (!isOmniInstall) {
gotoUrl(json.url, json.newTab);
- return;
+ return { setupPending: externalUrl || json.url.endsWith("/setup") };
}
// Skip redirection only if it is an OmniInstall and redirect URL isn't of some other origin
@@ -83,7 +83,7 @@ function useAddAppMutation(_type: App["type"] | null, allOptions?: UseAddAppMuta
if (externalUrl) {
// TODO: For Omni installation to authenticate and come back to the page where installation was initiated, some changes need to be done in all apps' add callbacks
gotoUrl(json.url, json.newTab);
- return;
+ return { setupPending: externalUrl };
}
return { setupPending: externalUrl || json.url.endsWith("/setup") };
diff --git a/packages/app-store/amie/config.json b/packages/app-store/amie/config.json
index 512bcadeca3..b83e145802c 100644
--- a/packages/app-store/amie/config.json
+++ b/packages/app-store/amie/config.json
@@ -12,5 +12,6 @@
"email": "[email protected]",
"description": "The joyful productivity app\r\r",
"__createdUsingCli": true,
- "dependencies": ["google-calendar"]
+ "dependencies": ["google-calendar"],
+ "dirName": "amie"
}
diff --git a/packages/app-store/applecalendar/components/InstallAppButton.tsx b/packages/app-store/applecalendar/components/InstallAppButton.tsx
deleted file mode 100644
index 70d8acf4275..00000000000
--- a/packages/app-store/applecalendar/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("apple_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/applecalendar/components/index.ts b/packages/app-store/applecalendar/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/applecalendar/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/apps.browser.generated.tsx b/packages/app-store/apps.browser.generated.tsx
index 04b0adc9df0..4dd1597af48 100644
--- a/packages/app-store/apps.browser.generated.tsx
+++ b/packages/app-store/apps.browser.generated.tsx
@@ -5,27 +5,10 @@
import dynamic from "next/dynamic";
export const InstallAppButtonMap = {
- applecalendar: dynamic(() => import("./applecalendar/components/InstallAppButton")),
- around: dynamic(() => import("./around/components/InstallAppButton")),
- caldavcalendar: dynamic(() => import("./caldavcalendar/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")),
- hubspot: dynamic(() => import("./hubspot/components/InstallAppButton")),
- huddle01video: dynamic(() => import("./huddle01video/components/InstallAppButton")),
- jitsivideo: dynamic(() => import("./jitsivideo/components/InstallAppButton")),
- larkcalendar: dynamic(() => import("./larkcalendar/components/InstallAppButton")),
- office365calendar: dynamic(() => import("./office365calendar/components/InstallAppButton")),
office365video: dynamic(() => import("./office365video/components/InstallAppButton")),
- riverside: dynamic(() => import("./riverside/components/InstallAppButton")),
- tandemvideo: dynamic(() => import("./tandemvideo/components/InstallAppButton")),
vital: dynamic(() => import("./vital/components/InstallAppButton")),
- whereby: dynamic(() => import("./whereby/components/InstallAppButton")),
- wipemycalother: dynamic(() => import("./wipemycalother/components/InstallAppButton")),
- zapier: dynamic(() => import("./zapier/components/InstallAppButton")),
- zoomvideo: dynamic(() => import("./zoomvideo/components/InstallAppButton")),
};
export const AppSettingsComponentsMap = {
"general-app-settings": dynamic(() =>
diff --git a/packages/app-store/around/components/InstallAppButton.tsx b/packages/app-store/around/components/InstallAppButton.tsx
deleted file mode 100644
index 454d10eb7b3..00000000000
--- a/packages/app-store/around/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("around_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/around/components/index.ts b/packages/app-store/around/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/around/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/caldavcalendar/_metadata.ts b/packages/app-store/caldavcalendar/_metadata.ts
index 89b6416a415..ba13cf77e76 100644
--- a/packages/app-store/caldavcalendar/_metadata.ts
+++ b/packages/app-store/caldavcalendar/_metadata.ts
@@ -21,7 +21,6 @@ export const metadata = {
url: "https://cal.com/",
verified: true,
- dirName: "caldavcalendar",
} as AppMeta;
export default metadata;
diff --git a/packages/app-store/caldavcalendar/components/InstallAppButton.tsx b/packages/app-store/caldavcalendar/components/InstallAppButton.tsx
deleted file mode 100644
index 5cff6a6206e..00000000000
--- a/packages/app-store/caldavcalendar/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("caldav_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/caldavcalendar/components/index.ts b/packages/app-store/caldavcalendar/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/caldavcalendar/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/caldavcalendar/index.ts b/packages/app-store/caldavcalendar/index.ts
index bca520a8ece..4ef9330ee84 100644
--- a/packages/app-store/caldavcalendar/index.ts
+++ b/packages/app-store/caldavcalendar/index.ts
@@ -21,6 +21,7 @@ export const metadata = {
url: "https://cal.com/",
verified: true,
+ dirName: "caldavcalendar",
} as App;
export * as api from "./api";
diff --git a/packages/app-store/closecom/components/InstallAppButton.tsx b/packages/app-store/closecom/components/InstallAppButton.tsx
deleted file mode 100644
index 8aab36df70e..00000000000
--- a/packages/app-store/closecom/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("closecom_other_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/closecom/components/index.ts b/packages/app-store/closecom/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/closecom/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/exchangecalendar/components/InstallAppButton.tsx b/packages/app-store/exchangecalendar/components/InstallAppButton.tsx
deleted file mode 100644
index 3e9fa782698..00000000000
--- a/packages/app-store/exchangecalendar/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("exchange_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/exchangecalendar/components/index.ts b/packages/app-store/exchangecalendar/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/exchangecalendar/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/googlecalendar/components/InstallAppButton.tsx b/packages/app-store/googlecalendar/components/InstallAppButton.tsx
deleted file mode 100644
index f059a138eb1..00000000000
--- a/packages/app-store/googlecalendar/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("google_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/googlecalendar/components/index.ts b/packages/app-store/googlecalendar/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/googlecalendar/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/hubspot/components/InstallAppButton.tsx b/packages/app-store/hubspot/components/InstallAppButton.tsx
deleted file mode 100644
index 459c786f44f..00000000000
--- a/packages/app-store/hubspot/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("hubspot_other_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/hubspot/components/index.ts b/packages/app-store/hubspot/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/hubspot/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/huddle01video/components/InstallAppButton.tsx b/packages/app-store/huddle01video/components/InstallAppButton.tsx
deleted file mode 100644
index e1b7ddf69a6..00000000000
--- a/packages/app-store/huddle01video/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("huddle01_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/huddle01video/components/index.ts b/packages/app-store/huddle01video/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/huddle01video/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/jitsivideo/components/InstallAppButton.tsx b/packages/app-store/jitsivideo/components/InstallAppButton.tsx
deleted file mode 100644
index 048c5d97006..00000000000
--- a/packages/app-store/jitsivideo/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("jitsi_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/jitsivideo/components/index.ts b/packages/app-store/jitsivideo/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/jitsivideo/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/larkcalendar/components/InstallAppButton.tsx b/packages/app-store/larkcalendar/components/InstallAppButton.tsx
deleted file mode 100644
index fb58420a309..00000000000
--- a/packages/app-store/larkcalendar/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("lark_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/larkcalendar/components/index.ts b/packages/app-store/larkcalendar/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/larkcalendar/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/office365calendar/_metadata.ts b/packages/app-store/office365calendar/_metadata.ts
index 42d45f7723f..4c6dcb92ca6 100644
--- a/packages/app-store/office365calendar/_metadata.ts
+++ b/packages/app-store/office365calendar/_metadata.ts
@@ -20,7 +20,6 @@ export const metadata = {
url: "https://cal.com/",
verified: true,
- dirName: "office365calendar",
} as AppMeta;
export default metadata;
diff --git a/packages/app-store/office365calendar/components/InstallAppButton.tsx b/packages/app-store/office365calendar/components/InstallAppButton.tsx
deleted file mode 100644
index 76b2bc355a1..00000000000
--- a/packages/app-store/office365calendar/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("office365_calendar");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/office365calendar/components/index.ts b/packages/app-store/office365calendar/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/office365calendar/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/office365video/config.json b/packages/app-store/office365video/config.json
index b29650927e8..6f0ba838e33 100644
--- a/packages/app-store/office365video/config.json
+++ b/packages/app-store/office365video/config.json
@@ -22,5 +22,6 @@
"type": "integrations:office365_video",
"label": "MS Teams"
}
- }
+ },
+ "dirName": "office365video"
}
diff --git a/packages/app-store/riverside/components/InstallAppButton.tsx b/packages/app-store/riverside/components/InstallAppButton.tsx
deleted file mode 100644
index 59c84fda451..00000000000
--- a/packages/app-store/riverside/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("riverside_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/riverside/components/index.ts b/packages/app-store/riverside/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/riverside/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/tandemvideo/components/InstallAppButton.tsx b/packages/app-store/tandemvideo/components/InstallAppButton.tsx
deleted file mode 100644
index 3a1492866cc..00000000000
--- a/packages/app-store/tandemvideo/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("tandem_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/tandemvideo/components/index.ts b/packages/app-store/tandemvideo/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/tandemvideo/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/whereby/components/InstallAppButton.tsx b/packages/app-store/whereby/components/InstallAppButton.tsx
deleted file mode 100644
index 7ba763e1a35..00000000000
--- a/packages/app-store/whereby/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("whereby_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/whereby/components/index.ts b/packages/app-store/whereby/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/whereby/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/wipemycalother/components/InstallAppButton.tsx b/packages/app-store/wipemycalother/components/InstallAppButton.tsx
deleted file mode 100644
index 2c755ed4ae3..00000000000
--- a/packages/app-store/wipemycalother/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("wipemycal_other");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/zapier/components/InstallAppButton.tsx b/packages/app-store/zapier/components/InstallAppButton.tsx
deleted file mode 100644
index e3b85e611b4..00000000000
--- a/packages/app-store/zapier/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("zapier_automation");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/zapier/components/index.ts b/packages/app-store/zapier/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/zapier/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/app-store/zoomvideo/components/InstallAppButton.tsx b/packages/app-store/zoomvideo/components/InstallAppButton.tsx
deleted file mode 100644
index 12d090fbe09..00000000000
--- a/packages/app-store/zoomvideo/components/InstallAppButton.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import type { InstallAppButtonProps } from "@calcom/app-store/types";
-
-import useAddAppMutation from "../../_utils/useAddAppMutation";
-
-export default function InstallAppButton(props: InstallAppButtonProps) {
- const mutation = useAddAppMutation("zoom_video");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/zoomvideo/components/index.ts b/packages/app-store/zoomvideo/components/index.ts
deleted file mode 100644
index 0d6008d4caa..00000000000
--- a/packages/app-store/zoomvideo/components/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default as InstallAppButton } from "./InstallAppButton";
diff --git a/packages/features/apps/AdminAppsList.tsx b/packages/features/apps/AdminAppsList.tsx
index 03179288a76..8f04731c557 100644
--- a/packages/features/apps/AdminAppsList.tsx
+++ b/packages/features/apps/AdminAppsList.tsx
@@ -49,7 +49,7 @@ const IntegrationContainer = ({
const utils = trpc.useContext();
const [disableDialog, setDisableDialog] = useState(false);
- const showKeyModal = () => {
+ const showKeyModal = (fromEnabled?: boolean) => {
// FIXME: This is preventing the modal from opening for apps that has null keys
if (app.keys) {
handleModelOpen({
@@ -58,6 +58,8 @@ const IntegrationContainer = ({
slug: app.slug,
type: app.type,
isOpen: "editKeys",
+ fromEnabled,
+ appName: app.name,
});
}
};
@@ -99,6 +101,8 @@ const IntegrationContainer = ({
onClick={() => {
if (app.enabled) {
setDisableDialog(true);
+ } else if (app.keys) {
+ showKeyModal(true);
} else {
enableAppMutation.mutate({ slug: app.slug, enabled: app.enabled });
}
@@ -179,9 +183,12 @@ const EditKeysModal: FC<{
isOpen: boolean;
keys: App["keys"];
handleModelClose: () => void;
+ fromEnabled?: boolean;
+ appName?: string;
}> = (props) => {
+ const utils = trpc.useContext();
const { t } = useLocale();
- const { dirName, slug, type, isOpen, keys, handleModelClose } = props;
+ const { dirName, slug, type, isOpen, keys, handleModelClose, fromEnabled, appName } = props;
const appKeySchema = appKeysSchemas[dirName as keyof typeof appKeysSchemas];
const formMethods = useForm({
@@ -190,7 +197,8 @@ const EditKeysModal: FC<{
const saveKeysMutation = trpc.viewer.appsRouter.saveKeys.useMutation({
onSuccess: () => {
- showToast(t("keys_have_been_saved"), "success");
+ showToast(fromEnabled ? t("app_is_enabled", { appName }) : t("keys_have_been_saved"), "success");
+ utils.viewer.appsRouter.listLocal.invalidate();
handleModelClose();
},
onError: (error) => {
@@ -211,6 +219,7 @@ const EditKeysModal: FC<{
type,
keys: values,
dirName,
+ fromEnabled,
})
}
className="px-4 pb-4">
@@ -251,6 +260,8 @@ interface EditModalState extends Pick<App, "keys"> {
dirName: string;
type: string;
slug: string;
+ fromEnabled?: boolean;
+ appName?: string;
}
const AdminAppsListContainer = () => {
@@ -310,6 +321,8 @@ const AdminAppsListContainer = () => {
isOpen={modalState.isOpen === "editKeys"}
slug={modalState.slug}
type={modalState.type}
+ fromEnabled={modalState.fromEnabled}
+ appName={modalState.appName}
/>
</>
);
diff --git a/packages/trpc/server/routers/viewer/apps.tsx b/packages/trpc/server/routers/viewer/apps.tsx
index 1c8962ee259..b2e1fb71ce5 100644
--- a/packages/trpc/server/routers/viewer/apps.tsx
+++ b/packages/trpc/server/routers/viewer/apps.tsx
@@ -135,10 +135,11 @@ export const appsRouter = router({
([appMetadata?.category] as AppCategories[]) ||
undefined,
keys: undefined,
+ enabled: !input.enabled,
},
});
- // If disabling an app then we need to alert users basesd on the app type
+ // If disabling an app then we need to alert users based on the app type
if (input.enabled) {
if (app.categories.some((category) => ["calendar", "video"].includes(category))) {
// Find all users with the app credentials
@@ -240,10 +241,12 @@ export const appsRouter = router({
type: z.string(),
// Validate w/ app specific schema
keys: z.unknown(),
+ fromEnabled: z.boolean().optional(),
})
)
.mutation(async ({ ctx, input }) => {
- const appKey = deriveAppDictKeyFromType(input.type, appKeysSchemas);
+ let appKey = deriveAppDictKeyFromType(input.type, appKeysSchemas);
+ if (!appKey) appKey = deriveAppDictKeyFromType(input.slug, appKeysSchemas);
const keysSchema = appKeysSchemas[appKey as keyof typeof appKeysSchemas];
const keys = keysSchema.parse(input.keys);
@@ -258,7 +261,7 @@ export const appsRouter = router({
where: {
slug: input.slug,
},
- update: { keys },
+ update: { keys, ...(input.fromEnabled && { enabled: true }) },
create: {
slug: input.slug,
dirName: appMetadata?.dirName || appMetadata?.slug || "",
@@ -267,6 +270,7 @@ export const appsRouter = router({
([appMetadata?.category] as AppCategories[]) ||
undefined,
keys: (input.keys as Prisma.InputJsonObject) || undefined,
+ ...(input.fromEnabled && { enabled: true }),
},
});
}),
diff --git a/packages/types/App.d.ts b/packages/types/App.d.ts
index 79fba3c7294..de0862634cf 100644
--- a/packages/types/App.d.ts
+++ b/packages/types/App.d.ts
@@ -135,6 +135,10 @@ export interface App {
licenseRequired?: boolean;
isProOnly?: boolean;
appData?: AppData;
+ /**
+ * @deprecated
+ * Used only by legacy apps which had slug different from their directory name.
+ */
dirName?: string;
isTemplate?: boolean;
__template?: string;