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.tsindex 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.tsindex 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?: UseAddAppMutaif (!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?: UseAddAppMutaif (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 callbacksgotoUrl(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.jsonindex 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxindex 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsindex 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,email: "[email protected]",- dirName: "caldavcalendar",} as AppMeta;export default metadata;diff --git a/packages/app-store/caldavcalendar/components/InstallAppButton.tsx b/packages/app-store/caldavcalendar/components/InstallAppButton.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsindex 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,email: "[email protected]",+ 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsindex 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,email: "[email protected]",- dirName: "office365calendar",} as AppMeta;export default metadata;diff --git a/packages/app-store/office365calendar/components/InstallAppButton.tsx b/packages/app-store/office365calendar/components/InstallAppButton.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.jsonindex 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxdeleted file mode 100644index 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.tsdeleted file mode 100644index 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.tsxindex 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 keysif (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.tsxindex 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 typeif (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 schemakeys: 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.tsindex 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;