d07e86e4f3
* Prevent two payment apps from being enabled * Find the enabled payment app to update the event type * Add string * Add tests * Type fix * Abstract check for multiple payment app logic * Type check * Address feedback * chore: Enable One Payment App Per Event Type (#12414) Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: Morgan Vernay <morgan@cal.com> * Fix bug * Fix test * Clean up * Fix test * Fix test --------- Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Morgan Vernay <morgan@cal.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com>
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import type React from "react";
|
|
import type { z } from "zod";
|
|
|
|
import type { EventTypeFormMetadataSchema } from "@calcom/prisma/zod-utils";
|
|
import type { RouterOutputs } from "@calcom/trpc/react";
|
|
import type { ButtonProps } from "@calcom/ui";
|
|
|
|
export type IntegrationOAuthCallbackState = {
|
|
returnTo: string;
|
|
installGoogleVideo?: boolean;
|
|
teamId?: number;
|
|
};
|
|
|
|
export type CredentialOwner = {
|
|
name: string | null;
|
|
avatar?: string | null;
|
|
teamId?: number;
|
|
credentialId?: number;
|
|
readOnly?: boolean;
|
|
};
|
|
|
|
export type EventTypeAppCardApp = RouterOutputs["viewer"]["integrations"]["items"][number] & {
|
|
credentialOwner?: CredentialOwner;
|
|
credentialIds?: number[];
|
|
};
|
|
|
|
type AppScript = { attrs?: Record<string, string> } & { src?: string; content?: string };
|
|
|
|
export type Tag = {
|
|
scripts: AppScript[];
|
|
};
|
|
|
|
export interface InstallAppButtonProps {
|
|
render: (
|
|
renderProps: ButtonProps & {
|
|
/** Tells that the default render component should be used */
|
|
useDefaultComponent?: boolean;
|
|
isLoading?: boolean;
|
|
}
|
|
) => JSX.Element;
|
|
onChanged?: () => unknown;
|
|
disableInstall?: boolean;
|
|
}
|
|
export type EventTypeAppCardComponentProps = {
|
|
// Limit what data should be accessible to apps
|
|
eventType: Pick<
|
|
z.infer<typeof EventTypeModel>,
|
|
"id" | "title" | "description" | "teamId" | "length" | "recurringEvent" | "seatsPerTimeSlot" | "team"
|
|
> & {
|
|
URL: string;
|
|
};
|
|
app: EventTypeAppCardApp;
|
|
disabled?: boolean;
|
|
LockedIcon?: JSX.Element | false;
|
|
eventTypeFormMetadata?: z.infer<typeof EventTypeFormMetadataSchema>;
|
|
};
|
|
export type EventTypeAppCardComponent = React.FC<EventTypeAppCardComponentProps>;
|