nit changes
parent
f8caf08ccf
commit
af1030abc0
|
@ -125,4 +125,11 @@ SALESFORCE_CONSUMER_SECRET=""
|
|||
ZOHOCRM_CLIENT_ID=""
|
||||
ZOHOCRM_CLIENT_SECRET=""
|
||||
|
||||
# ALBY
|
||||
# Used for the Alby payment app / receiving Alby payments
|
||||
# Get it from: https://getalby.com/developer/oauth_clients
|
||||
# Set callbackUrl to /api/integrations/alby/alby-webhooks
|
||||
NEXT_PUBLIC_ALBY_CLIENT_ID=""
|
||||
NEXT_PUBLIC_ALBY_CLIENT_SECRET=""
|
||||
|
||||
# *********************************************************************************************************
|
||||
|
|
|
@ -230,12 +230,6 @@ AUTH_BEARER_TOKEN_VERCEL=
|
|||
E2E_TEST_APPLE_CALENDAR_EMAIL=""
|
||||
E2E_TEST_APPLE_CALENDAR_PASSWORD=""
|
||||
|
||||
# ALBY
|
||||
# Used for the Alby payment app / receiving Alby payments
|
||||
# Get it from: https://getalby.com/developer/oauth_clients
|
||||
NEXT_PUBLIC_ALBY_CLIENT_ID=
|
||||
NEXT_PUBLIC_ALBY_CLIENT_SECRET=
|
||||
|
||||
# - APP CREDENTIAL SYNC ***********************************************************************************
|
||||
# Used for self-hosters that are implementing Cal.com into their applications that already have certain integrations
|
||||
# Under settings/admin/apps ensure that all app secrets are set the same as the parent application
|
||||
|
|
|
@ -89,8 +89,7 @@ export const AppPage = ({
|
|||
|
||||
const [existingCredentials, setExistingCredentials] = useState<number[]>([]);
|
||||
const [showDisconnectIntegration, setShowDisconnectIntegration] = useState(false);
|
||||
// FIXME: remove hardcoding
|
||||
const showSetupIntegration = slug === "alby";
|
||||
|
||||
const appDbQuery = trpc.viewer.appCredentialsByType.useQuery(
|
||||
{ appType: type },
|
||||
{
|
||||
|
@ -215,21 +214,14 @@ export const AppPage = ({
|
|||
)}
|
||||
</div>
|
||||
) : showDisconnectIntegration ? (
|
||||
<div className="flex gap-2">
|
||||
{showSetupIntegration && (
|
||||
<Link href={`/apps/${slug}/setup`}>
|
||||
<Button color="secondary">Setup</Button>
|
||||
</Link>
|
||||
)}
|
||||
<DisconnectIntegration
|
||||
buttonProps={{ color: "secondary" }}
|
||||
label={t("disconnect")}
|
||||
credentialId={existingCredentials[0]}
|
||||
onSuccess={() => {
|
||||
appDbQuery.refetch();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<DisconnectIntegration
|
||||
buttonProps={{ color: "secondary" }}
|
||||
label={t("disconnect")}
|
||||
credentialId={existingCredentials[0]}
|
||||
onSuccess={() => {
|
||||
appDbQuery.refetch();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<InstallAppButton
|
||||
type={type}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { auth, Client, webln } from "@getalby/sdk";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useState, useCallback, useEffect } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
|
||||
|
@ -17,7 +18,7 @@ export interface IAlbySetupProps {
|
|||
}
|
||||
|
||||
export default function AlbySetup(props: IAlbySetupProps) {
|
||||
const params = globalThis.window && new URLSearchParams(window.location.search);
|
||||
const params = useSearchParams();
|
||||
if (params?.get("callback") === "true") {
|
||||
return <AlbySetupCallback />;
|
||||
}
|
||||
|
@ -27,13 +28,13 @@ export default function AlbySetup(props: IAlbySetupProps) {
|
|||
|
||||
function AlbySetupCallback() {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const params = useSearchParams();
|
||||
useEffect(() => {
|
||||
if (!window.opener) {
|
||||
setError("Something went wrong. Opener not available. Please contact support@getalby.com");
|
||||
return;
|
||||
}
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
const code = params.get("code");
|
||||
const error = params.get("error");
|
||||
|
||||
|
@ -86,7 +87,7 @@ function AlbySetupPage(props: IAlbySetupProps) {
|
|||
const authClient = new auth.OAuth2User({
|
||||
client_id: process.env.NEXT_PUBLIC_ALBY_CLIENT_ID,
|
||||
client_secret: process.env.NEXT_PUBLIC_ALBY_CLIENT_SECRET,
|
||||
callback: process.env.NEXT_PUBLIC_WEBAPP_URL + "/apps/alby/setup?callback=true",
|
||||
callback: `${process.env.NEXT_PUBLIC_WEBAPP_URL}/apps/alby/setup?callback=true`,
|
||||
scopes: ["invoices:read", "account:read"],
|
||||
user_agent: "cal.com",
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue