Skip to content

Scheduling infrastructure for absolutely everyone.

Fix App Redirect logic to allow EventTypeApps requiring auth to correctly redirect (#5065)

Hariom Balhara4211ec1a82ca
diff --git a/packages/app-store/_utils/useAddAppMutation.ts b/packages/app-store/_utils/useAddAppMutation.ts
index 2093de6540a..228f4846c63 100644
--- a/packages/app-store/_utils/useAddAppMutation.ts
+++ b/packages/app-store/_utils/useAddAppMutation.ts
@@ -39,10 +39,15 @@ function useAddAppMutation(_type: App["type"] | null, options?: Parameters<typeo
}
const json = await res.json();
+
+ if (!isOmniInstall) {
+ window.location.href = json.url;
+ return;
+ }
// Skip redirection only if it is an OmniInstall and redirect URL isn't of some other origin
// This allows installation of apps like Stripe to still redirect to their authentication pages.
// 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
- if (!(isOmniInstall && !json.url.startsWith(window.location.origin))) {
+ if (!json.url.startsWith(window.location.origin)) {
window.location.href = json.url;
}
}, options);
diff --git a/packages/app-store/apps.browser.generated.tsx b/packages/app-store/apps.browser.generated.tsx
index da2438ae1b9..ea3bf0d08ea 100644
--- a/packages/app-store/apps.browser.generated.tsx
+++ b/packages/app-store/apps.browser.generated.tsx
@@ -21,7 +21,6 @@ export const InstallAppButtonMap = {
office365video: dynamic(() => import("./office365video/components/InstallAppButton")),
riverside: dynamic(() => import("./riverside/components/InstallAppButton")),
slackmessaging: dynamic(() => import("./slackmessaging/components/InstallAppButton")),
- stripepayment: dynamic(() => import("./stripepayment/components/InstallAppButton")),
tandemvideo: dynamic(() => import("./tandemvideo/components/InstallAppButton")),
vital: dynamic(() => import("./vital/components/InstallAppButton")),
whereby: dynamic(() => import("./whereby/components/InstallAppButton")),
diff --git a/packages/app-store/stripepayment/components/InstallAppButton.tsx b/packages/app-store/stripepayment/components/InstallAppButton.tsx
deleted file mode 100644
index 4e665f8ee6c..00000000000
--- a/packages/app-store/stripepayment/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("stripe_payment");
-
- return (
- <>
- {props.render({
- onClick() {
- mutation.mutate("");
- },
- loading: mutation.isLoading,
- })}
- </>
- );
-}
diff --git a/packages/app-store/wipemycalother/components/index.ts b/packages/app-store/wipemycalother/components/index.ts
index 1aa02304a29..09a14996358 100644
--- a/packages/app-store/wipemycalother/components/index.ts
+++ b/packages/app-store/wipemycalother/components/index.ts
@@ -1,2 +1 @@
-export { default as InstallAppButton } from "./InstallAppButton";
export { WipeMyCalActionButton } from "./wipeMyCalActionButton";