merge with remote
commit
d6ff14ce91
|
@ -128,7 +128,7 @@ 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
|
||||
# Set callbackUrl to YOUR_APP_DOMAIN/api/integrations/alby/alby-webhook
|
||||
NEXT_PUBLIC_ALBY_CLIENT_ID=""
|
||||
NEXT_PUBLIC_ALBY_CLIENT_SECRET=""
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import type { InferGetStaticPropsType } from "next";
|
||||
import type { InferGetServerSidePropsType } from "next";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
|
||||
import { AppSetupPage } from "@calcom/app-store/_pages/setup";
|
||||
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
|
||||
import type { getStaticProps } from "@calcom/app-store/_pages/setup/_getStaticProps";
|
||||
import { HeadSeo } from "@calcom/ui";
|
||||
|
||||
import PageWrapper from "@components/PageWrapper";
|
||||
|
||||
export default function SetupInformation(props: InferGetStaticPropsType<typeof getStaticProps>) {
|
||||
export default function SetupInformation(props: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
const searchParams = useSearchParams();
|
||||
const router = useRouter();
|
||||
const slug = searchParams?.get("slug") as string;
|
||||
|
|
|
@ -22,7 +22,7 @@ export function AlbyPriceComponent({ displaySymbol, price }: AlbyPriceComponentP
|
|||
<Tooltip content={fiatValue}>
|
||||
<div className="inline-flex items-center justify-center">
|
||||
{displaySymbol && <SatSymbol className="h-4 w-4" />}
|
||||
{price}
|
||||
{price} sats
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
|||
const session = await getServerSession({ req, res });
|
||||
|
||||
if (!session?.user?.id) {
|
||||
return res.status(401).json({ message: "You must be logged in to do this" });
|
||||
return res.writeHead(401).end();
|
||||
}
|
||||
|
||||
const credentials = await prisma.credential.findFirst({
|
||||
|
@ -26,7 +26,10 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
|||
lightningAddress: null,
|
||||
};
|
||||
if (credentials?.key) {
|
||||
const { account_lightning_address, account_email } = credentials.key;
|
||||
const { account_lightning_address, account_email } = credentials.key as {
|
||||
account_lightning_address?: string;
|
||||
account_email?: string;
|
||||
};
|
||||
if (account_lightning_address) {
|
||||
props.lightningAddress = account_lightning_address;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { InferGetStaticPropsType } from "next";
|
||||
import type { InferGetServerSidePropsType } from "next";
|
||||
import { Trans } from "next-i18next";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
|
@ -9,11 +9,11 @@ import { trpc } from "@calcom/trpc/react";
|
|||
import { Button, Tooltip, showToast } from "@calcom/ui";
|
||||
import { Clipboard } from "@calcom/ui/components/icon";
|
||||
|
||||
import type { getStaticProps } from "./_getStaticProps";
|
||||
import type { getServerSideProps } from "./_getServerSideProps";
|
||||
|
||||
const MAKE = "make";
|
||||
|
||||
export default function MakeSetup({ inviteLink }: InferGetStaticPropsType<typeof getStaticProps>) {
|
||||
export default function MakeSetup({ inviteLink }: InferGetServerSidePropsType<typeof getServerSideProps>) {
|
||||
const [newApiKeys, setNewApiKeys] = useState<Record<string, string>>({});
|
||||
|
||||
const { t } = useLocale();
|
||||
|
|
|
@ -86,12 +86,18 @@ export const BaseScheduledEmail = (
|
|||
{props.includeAppsStatus && <AppsStatus calEvent={props.calEvent} t={t} />}
|
||||
<UserFieldsResponses calEvent={props.calEvent} />
|
||||
{props.calEvent.paymentInfo?.amount && (
|
||||
// TODO: extract currency handling
|
||||
// see packages/features/bookings/components/event-meta/Price.tsx
|
||||
<Info
|
||||
label={props.calEvent.paymentInfo?.paymentOption === "HOLD" ? t("no_show_fee") : t("price")}
|
||||
description={new Intl.NumberFormat(props.attendee.language.locale, {
|
||||
style: "currency",
|
||||
currency: props.calEvent.paymentInfo?.currency || "USD",
|
||||
}).format(props.calEvent.paymentInfo?.amount / 100.0)}
|
||||
label={props.calEvent.paymentInfo.paymentOption === "HOLD" ? t("no_show_fee") : t("price")}
|
||||
description={
|
||||
props.calEvent.paymentInfo.currency !== "BTC"
|
||||
? new Intl.NumberFormat(props.attendee.language.locale, {
|
||||
style: "currency",
|
||||
currency: props.calEvent.paymentInfo.currency || "USD",
|
||||
}).format(props.calEvent.paymentInfo.amount / 100.0)
|
||||
: `${props.calEvent.paymentInfo.amount} sats`
|
||||
}
|
||||
withSpacer
|
||||
/>
|
||||
)}
|
||||
|
|
|
@ -2,6 +2,8 @@ import dynamic from "next/dynamic";
|
|||
|
||||
import type { EventPrice } from "../../types";
|
||||
|
||||
// TODO: importing dynamically like this makes it difficult
|
||||
// to extract currency formatting (currently duplicated in BaseScheduledEmail.tsx)
|
||||
const AlbyPriceComponent = dynamic(
|
||||
() => import("@calcom/app-store/alby/components/AlbyPriceComponent").then((m) => m.AlbyPriceComponent),
|
||||
{
|
||||
|
|
|
@ -130,7 +130,11 @@ const PaymentPage: FC<PaymentPageProps> = (props) => {
|
|||
{props.payment.paymentOption === "HOLD" ? t("no_show_fee") : t("price")}
|
||||
</div>
|
||||
<div className="col-span-2 mb-6 font-semibold">
|
||||
<Price currency={paymentAppData.currency} price={paymentAppData.price} />
|
||||
<Price
|
||||
currency={paymentAppData.currency}
|
||||
price={paymentAppData.price}
|
||||
displayAlternateSymbol={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,6 +44,13 @@ export async function handlePaymentSuccess(paymentId: number, bookingId: number)
|
|||
destinationCalendar: true,
|
||||
},
|
||||
},
|
||||
payment: {
|
||||
select: {
|
||||
amount: true,
|
||||
currency: true,
|
||||
paymentOption: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -97,6 +104,11 @@ export async function handlePaymentSuccess(paymentId: number, bookingId: number)
|
|||
uid: booking.uid,
|
||||
destinationCalendar: selectedDestinationCalendar ? [selectedDestinationCalendar] : [],
|
||||
recurringEvent: parseRecurringEvent(eventTypeRaw?.recurringEvent),
|
||||
paymentInfo: booking.payment?.[0] && {
|
||||
amount: booking.payment[0].amount,
|
||||
currency: booking.payment[0].currency,
|
||||
paymentOption: booking.payment[0].paymentOption,
|
||||
},
|
||||
};
|
||||
|
||||
if (booking.location) evt.location = booking.location;
|
||||
|
|
|
@ -185,7 +185,6 @@ export const integrationsHandler = async ({ ctx, input }: IntegrationsOptions) =
|
|||
invalidCredentialIds,
|
||||
teams,
|
||||
isInstalled: !!userCredentialIds.length || !!teams.length || app.isGlobal,
|
||||
// FIXME: remove hardcoding and add per-app validation
|
||||
isSetupAlready,
|
||||
};
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue