refactor: apply biome formatting to apps/web (#27692)
* refactor: apply biome formatting to apps/web (batch 1) Formats apps/web non-modules directories: - apps/web/app - apps/web/lib - apps/web/pages - apps/web/styles - apps/web/server - apps/web/test - Root-level .ts and .mjs files Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to apps/web/modules (batch 2) Formats smaller apps/web/modules directories: - onboarding, data-table, users, apps, auth - integration-attribute-sync, shell, availability - feature-flags, team, webhooks, getting-started - feature-opt-in, troubleshooter, schedules, notifications - signup-view.tsx Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to apps/web/modules (batch 3) Formats medium apps/web/modules directories: - bookings - event-types - insights - embed Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to apps/web/modules/ee (batch 4) Formats apps/web/modules/ee directory. Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to apps/web (batch 5) Formats remaining apps/web directories: - apps/web/modules/settings - apps/web/modules/booking-audit - apps/web/playwright Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to apps/web/components (batch 6) Formats remaining apps/web/components files. Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to new apps/web files from main Formats newly added/modified files from main merge: - WorkflowStepContainer.tsx (resolved merge conflicts) - Newly moved files (blocklist, form-builder, schedules, etc.) - Other files modified in main Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: apply biome formatting to new apps/web files from main Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
271 files changed
+3729
-4857
No files matched your search
@@ -66,7 +66,7 @@ function SingleAppPage(props: AppDataProps) {
|
||||
// privacy="https://zoom.us/privacy"
|
||||
body={
|
||||
<>
|
||||
{ }
|
||||
{}
|
||||
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via markdownToSafeHTML */}
|
||||
<div dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(source.content) }} />
|
||||
</>
|
||||
|
||||
@@ -136,87 +136,89 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
|
||||
color="secondary"
|
||||
className="flex w-32 grow justify-center"
|
||||
href={`/apps/${app.slug}`}
|
||||
onClick={() => { posthog.capture("app_card_details_clicked", { slug: app.slug }) }}
|
||||
onClick={() => {
|
||||
posthog.capture("app_card_details_clicked", { slug: app.slug });
|
||||
}}
|
||||
data-testid={`app-store-app-card-${app.slug}`}>
|
||||
{t("details")}
|
||||
</Button>
|
||||
{app.isGlobal ||
|
||||
(credentials && credentials.length > 0 && allowedMultipleInstalls) ||
|
||||
(credentials && credentials.length > 0 && isRedirectApp(app.slug))
|
||||
(credentials && credentials.length > 0 && allowedMultipleInstalls) ||
|
||||
(credentials && credentials.length > 0 && isRedirectApp(app.slug))
|
||||
? !app.isGlobal && (
|
||||
<InstallAppButton
|
||||
type={app.type}
|
||||
teamsPlanRequired={app.teamsPlanRequired}
|
||||
disableInstall={!!app.dependencies && !app.dependencyData?.some((data) => !data.installed)}
|
||||
wrapperClassName="[@media(max-width:260px)]:w-full"
|
||||
render={({ useDefaultComponent, ...props }) => {
|
||||
if (useDefaultComponent) {
|
||||
props = {
|
||||
...props,
|
||||
onClick: () => {
|
||||
handleAppInstall();
|
||||
},
|
||||
loading: mutation.isPending,
|
||||
};
|
||||
} else {
|
||||
const originalOnClick = props.onClick;
|
||||
props = {
|
||||
...props,
|
||||
onClick: (e) => {
|
||||
posthog.capture("app_install_button_clicked", {
|
||||
slug: app.slug,
|
||||
app_type: app.type,
|
||||
is_redirect: isRedirectApp(app.slug),
|
||||
is_conferencing: isConferencing(app.categories || []),
|
||||
});
|
||||
originalOnClick?.(e);
|
||||
},
|
||||
};
|
||||
}
|
||||
return (
|
||||
<InstallAppButtonChild paid={app.paid} isRedirect={isRedirectApp(app.slug)} {...props} />
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
<InstallAppButton
|
||||
type={app.type}
|
||||
teamsPlanRequired={app.teamsPlanRequired}
|
||||
disableInstall={!!app.dependencies && !app.dependencyData?.some((data) => !data.installed)}
|
||||
wrapperClassName="[@media(max-width:260px)]:w-full"
|
||||
render={({ useDefaultComponent, ...props }) => {
|
||||
if (useDefaultComponent) {
|
||||
props = {
|
||||
...props,
|
||||
onClick: () => {
|
||||
handleAppInstall();
|
||||
},
|
||||
loading: mutation.isPending,
|
||||
};
|
||||
} else {
|
||||
const originalOnClick = props.onClick;
|
||||
props = {
|
||||
...props,
|
||||
onClick: (e) => {
|
||||
posthog.capture("app_install_button_clicked", {
|
||||
slug: app.slug,
|
||||
app_type: app.type,
|
||||
is_redirect: isRedirectApp(app.slug),
|
||||
is_conferencing: isConferencing(app.categories || []),
|
||||
});
|
||||
originalOnClick?.(e);
|
||||
},
|
||||
};
|
||||
}
|
||||
return (
|
||||
<InstallAppButtonChild paid={app.paid} isRedirect={isRedirectApp(app.slug)} {...props} />
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
: credentials &&
|
||||
!appInstalled && (
|
||||
<InstallAppButton
|
||||
type={app.type}
|
||||
wrapperClassName="[@media(max-width:260px)]:w-full"
|
||||
disableInstall={!!app.dependencies && app.dependencyData?.some((data) => !data.installed)}
|
||||
teamsPlanRequired={app.teamsPlanRequired}
|
||||
render={({ useDefaultComponent, ...props }) => {
|
||||
if (useDefaultComponent) {
|
||||
props = {
|
||||
...props,
|
||||
disabled: !!props.disabled,
|
||||
onClick: () => {
|
||||
handleAppInstall();
|
||||
},
|
||||
loading: mutation.isPending,
|
||||
};
|
||||
} else {
|
||||
const originalOnClick = props.onClick;
|
||||
props = {
|
||||
...props,
|
||||
onClick: (e) => {
|
||||
posthog.capture("app_install_button_clicked", {
|
||||
slug: app.slug,
|
||||
app_type: app.type,
|
||||
is_redirect: isRedirectApp(app.slug),
|
||||
is_conferencing: isConferencing(app.categories || []),
|
||||
});
|
||||
originalOnClick?.(e);
|
||||
},
|
||||
};
|
||||
}
|
||||
return (
|
||||
<InstallAppButtonChild paid={app.paid} isRedirect={isRedirectApp(app.slug)} {...props} />
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
!appInstalled && (
|
||||
<InstallAppButton
|
||||
type={app.type}
|
||||
wrapperClassName="[@media(max-width:260px)]:w-full"
|
||||
disableInstall={!!app.dependencies && app.dependencyData?.some((data) => !data.installed)}
|
||||
teamsPlanRequired={app.teamsPlanRequired}
|
||||
render={({ useDefaultComponent, ...props }) => {
|
||||
if (useDefaultComponent) {
|
||||
props = {
|
||||
...props,
|
||||
disabled: !!props.disabled,
|
||||
onClick: () => {
|
||||
handleAppInstall();
|
||||
},
|
||||
loading: mutation.isPending,
|
||||
};
|
||||
} else {
|
||||
const originalOnClick = props.onClick;
|
||||
props = {
|
||||
...props,
|
||||
onClick: (e) => {
|
||||
posthog.capture("app_install_button_clicked", {
|
||||
slug: app.slug,
|
||||
app_type: app.type,
|
||||
is_redirect: isRedirectApp(app.slug),
|
||||
is_conferencing: isConferencing(app.categories || []),
|
||||
});
|
||||
originalOnClick?.(e);
|
||||
},
|
||||
};
|
||||
}
|
||||
return (
|
||||
<InstallAppButtonChild paid={app.paid} isRedirect={isRedirectApp(app.slug)} {...props} />
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="max-w-44 absolute right-0 mr-4 flex flex-wrap justify-end gap-1">
|
||||
{appAdded > 0 && !isRedirectApp(app.slug) ? (
|
||||
|
||||
@@ -232,10 +232,7 @@ const OnboardingPage = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
key={pathname}
|
||||
className="text-emphasis min-h-screen px-4"
|
||||
data-testid="onboarding">
|
||||
<div key={pathname} className="text-emphasis min-h-screen px-4" data-testid="onboarding">
|
||||
<div className="mx-auto py-6 sm:px-4 md:py-24">
|
||||
<div className="relative">
|
||||
<div className="sm:mx-auto sm:w-full sm:max-w-[600px]" ref={formPortalRef}>
|
||||
|
||||
@@ -11,15 +11,8 @@ import { z } from "zod";
|
||||
|
||||
import { SAMLLogin } from "@calcom/web/modules/auth/components/SAMLLogin";
|
||||
import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";
|
||||
import {
|
||||
LastUsed,
|
||||
useLastUsed,
|
||||
} from "@calcom/web/modules/auth/hooks/useLastUsed";
|
||||
import {
|
||||
HOSTED_CAL_FEATURES,
|
||||
WEBAPP_URL,
|
||||
WEBSITE_URL,
|
||||
} from "@calcom/lib/constants";
|
||||
import { LastUsed, useLastUsed } from "@calcom/web/modules/auth/hooks/useLastUsed";
|
||||
import { HOSTED_CAL_FEATURES, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import { emailRegex } from "@calcom/lib/emailSchema";
|
||||
import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl";
|
||||
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
||||
@@ -47,11 +40,7 @@ interface LoginValues {
|
||||
}
|
||||
|
||||
const GoogleIcon = () => (
|
||||
<img
|
||||
className="mr-2 w-4 h-4 text-subtle"
|
||||
src="/google-icon-colored.svg"
|
||||
alt="Continue with Google Icon"
|
||||
/>
|
||||
<img className="mr-2 w-4 h-4 text-subtle" src="/google-icon-colored.svg" alt="Continue with Google Icon" />
|
||||
);
|
||||
export type PageProps = inferSSRProps<typeof getServerSideProps>;
|
||||
export default function Login({
|
||||
@@ -71,17 +60,13 @@ export default function Login({
|
||||
.string()
|
||||
.min(1, `${t("error_required_field")}`)
|
||||
.regex(emailRegex, `${t("enter_valid_email")}`),
|
||||
...(totpEmail
|
||||
? {}
|
||||
: { password: z.string().min(1, `${t("error_required_field")}`) }),
|
||||
...(totpEmail ? {} : { password: z.string().min(1, `${t("error_required_field")}`) }),
|
||||
})
|
||||
// Passthrough other fields like totpCode
|
||||
.passthrough();
|
||||
const methods = useForm<LoginValues>({ resolver: zodResolver(formSchema) });
|
||||
const { register, formState } = methods;
|
||||
const [twoFactorRequired, setTwoFactorRequired] = useState(
|
||||
!!totpEmail || false
|
||||
);
|
||||
const [twoFactorRequired, setTwoFactorRequired] = useState(!!totpEmail || false);
|
||||
const [twoFactorLostAccess, setTwoFactorLostAccess] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
const [lastUsed, setLastUsed] = useLastUsed();
|
||||
@@ -90,15 +75,9 @@ export default function Login({
|
||||
// [ErrorCode.SecondFactorRequired]: t("2fa_enabled_instructions"),
|
||||
// Don't leak information about whether an email is registered or not
|
||||
[ErrorCode.IncorrectEmailPassword]: t("incorrect_email_password"),
|
||||
[ErrorCode.IncorrectTwoFactorCode]: `${t("incorrect_2fa_code")} ${t(
|
||||
"please_try_again"
|
||||
)}`,
|
||||
[ErrorCode.InternalServerError]: `${t("something_went_wrong")} ${t(
|
||||
"please_try_again_and_contact_us"
|
||||
)}`,
|
||||
[ErrorCode.ThirdPartyIdentityProviderEnabled]: t(
|
||||
"account_created_with_identity_provider"
|
||||
),
|
||||
[ErrorCode.IncorrectTwoFactorCode]: `${t("incorrect_2fa_code")} ${t("please_try_again")}`,
|
||||
[ErrorCode.InternalServerError]: `${t("something_went_wrong")} ${t("please_try_again_and_contact_us")}`,
|
||||
[ErrorCode.ThirdPartyIdentityProviderEnabled]: t("account_created_with_identity_provider"),
|
||||
};
|
||||
|
||||
let callbackUrl = searchParams?.get("callbackUrl") || "";
|
||||
@@ -138,8 +117,7 @@ export default function Login({
|
||||
setErrorMessage(null);
|
||||
}}
|
||||
StartIcon="arrow-left"
|
||||
color="minimal"
|
||||
>
|
||||
color="minimal">
|
||||
{t("go_back")}
|
||||
</Button>
|
||||
{!twoFactorLostAccess ? (
|
||||
@@ -150,8 +128,7 @@ export default function Login({
|
||||
methods.setValue("totpCode", "");
|
||||
}}
|
||||
StartIcon="lock"
|
||||
color="minimal"
|
||||
>
|
||||
color="minimal">
|
||||
{t("lost_access")}
|
||||
</Button>
|
||||
) : null}
|
||||
@@ -163,8 +140,7 @@ export default function Login({
|
||||
onClick={() => {
|
||||
window.location.replace("/");
|
||||
}}
|
||||
color="minimal"
|
||||
>
|
||||
color="minimal">
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
);
|
||||
@@ -182,18 +158,14 @@ export default function Login({
|
||||
else if (!res.error) {
|
||||
setLastUsed("credentials");
|
||||
router.push(callbackUrl);
|
||||
} else if (res.error === ErrorCode.SecondFactorRequired)
|
||||
setTwoFactorRequired(true);
|
||||
else if (res.error === ErrorCode.IncorrectBackupCode)
|
||||
setErrorMessage(t("incorrect_backup_code"));
|
||||
else if (res.error === ErrorCode.MissingBackupCodes)
|
||||
setErrorMessage(t("missing_backup_codes"));
|
||||
} else if (res.error === ErrorCode.SecondFactorRequired) setTwoFactorRequired(true);
|
||||
else if (res.error === ErrorCode.IncorrectBackupCode) setErrorMessage(t("incorrect_backup_code"));
|
||||
else if (res.error === ErrorCode.MissingBackupCodes) setErrorMessage(t("missing_backup_codes"));
|
||||
// fallback if error not found
|
||||
else setErrorMessage(errorMessages[res.error] || t("something_went_wrong"));
|
||||
};
|
||||
|
||||
const { data, isPending, error } =
|
||||
trpc.viewer.public.ssoConnections.useQuery();
|
||||
const { data, isPending, error } = trpc.viewer.public.ssoConnections.useQuery();
|
||||
|
||||
useEffect(
|
||||
function refactorMeWithoutEffect() {
|
||||
@@ -218,12 +190,10 @@ export default function Login({
|
||||
? !totpEmail
|
||||
? TwoFactorFooter
|
||||
: ExternalTotpFooter
|
||||
: process.env.NEXT_PUBLIC_DISABLE_SIGNUP !== "true" &&
|
||||
searchParams?.get("register") !== "false"
|
||||
? LoginFooter
|
||||
: null
|
||||
}
|
||||
>
|
||||
: process.env.NEXT_PUBLIC_DISABLE_SIGNUP !== "true" && searchParams?.get("register") !== "false"
|
||||
? LoginFooter
|
||||
: null
|
||||
}>
|
||||
<FormProvider {...methods}>
|
||||
{!twoFactorRequired && (
|
||||
<>
|
||||
@@ -241,8 +211,7 @@ export default function Login({
|
||||
await signIn("google", {
|
||||
callbackUrl,
|
||||
});
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<span>{t("signin_with_google")}</span>
|
||||
{lastUsed === "google" && <LastUsed />}
|
||||
</Button>
|
||||
@@ -270,31 +239,19 @@ export default function Login({
|
||||
</>
|
||||
)}
|
||||
|
||||
<form
|
||||
onSubmit={methods.handleSubmit(onSubmit)}
|
||||
noValidate
|
||||
data-testid="login-form"
|
||||
>
|
||||
<form onSubmit={methods.handleSubmit(onSubmit)} noValidate data-testid="login-form">
|
||||
<div>
|
||||
<input
|
||||
defaultValue={csrfToken || undefined}
|
||||
type="hidden"
|
||||
hidden
|
||||
{...register("csrfToken")}
|
||||
/>
|
||||
<input defaultValue={csrfToken || undefined} type="hidden" hidden {...register("csrfToken")} />
|
||||
</div>
|
||||
<div className="stack-y-6">
|
||||
<div
|
||||
className={classNames("stack-y-6", {
|
||||
hidden: twoFactorRequired,
|
||||
})}
|
||||
>
|
||||
})}>
|
||||
<EmailField
|
||||
id="email"
|
||||
label={t("email_address")}
|
||||
defaultValue={
|
||||
totpEmail || (searchParams?.get("email") as string)
|
||||
}
|
||||
defaultValue={totpEmail || (searchParams?.get("email") as string)}
|
||||
placeholder="[email protected]"
|
||||
required
|
||||
autoComplete="email"
|
||||
@@ -312,33 +269,23 @@ export default function Login({
|
||||
<Link
|
||||
href="/auth/forgot-password"
|
||||
tabIndex={-1}
|
||||
className="text-sm font-medium text-default"
|
||||
>
|
||||
className="text-sm font-medium text-default">
|
||||
{t("forgot")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{twoFactorRequired ? (
|
||||
!twoFactorLostAccess ? (
|
||||
<TwoFactor center />
|
||||
) : (
|
||||
<BackupCode center />
|
||||
)
|
||||
) : null}
|
||||
{twoFactorRequired ? !twoFactorLostAccess ? <TwoFactor center /> : <BackupCode center /> : null}
|
||||
|
||||
{errorMessage && <Alert severity="error" title={errorMessage} />}
|
||||
<Button
|
||||
type="submit"
|
||||
color="secondary"
|
||||
disabled={formState.isSubmitting}
|
||||
className="justify-center w-full"
|
||||
>
|
||||
className="justify-center w-full">
|
||||
<span>{twoFactorRequired ? t("submit") : t("sign_in")}</span>
|
||||
{lastUsed === "credentials" && !twoFactorRequired && (
|
||||
<LastUsed className="text-gray-600" />
|
||||
)}
|
||||
{lastUsed === "credentials" && !twoFactorRequired && <LastUsed className="text-gray-600" />}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -29,11 +29,8 @@ export function Authorize() {
|
||||
const state = searchParams?.get("state") as string;
|
||||
const scope = searchParams?.get("scope") as string;
|
||||
const code_challenge = searchParams?.get("code_challenge") as string;
|
||||
const code_challenge_method = searchParams?.get(
|
||||
"code_challenge_method"
|
||||
) as string;
|
||||
const show_account_selector =
|
||||
searchParams?.get("show_account_selector") === "true";
|
||||
const code_challenge_method = searchParams?.get("code_challenge_method") as string;
|
||||
const show_account_selector = searchParams?.get("show_account_selector") === "true";
|
||||
|
||||
const queryString = searchParams?.toString();
|
||||
|
||||
@@ -58,31 +55,26 @@ export function Authorize() {
|
||||
);
|
||||
|
||||
const { data, isPending: isPendingProfiles } =
|
||||
trpc.viewer.loggedInViewerRouter.teamsAndUserProfilesQuery.useQuery(
|
||||
undefined,
|
||||
{
|
||||
enabled: show_account_selector,
|
||||
}
|
||||
);
|
||||
|
||||
const generateAuthCodeMutation =
|
||||
trpc.viewer.oAuth.generateAuthCode.useMutation({
|
||||
onSuccess: (data) => {
|
||||
window.location.href =
|
||||
data.redirectUrl ??
|
||||
`${client?.redirectUri}?code=${data.authorizationCode}&state=${state}`;
|
||||
},
|
||||
onError: (error) => {
|
||||
if (client?.redirectUri) {
|
||||
redirectToOAuthError({
|
||||
redirectUri: client.redirectUri,
|
||||
trpcError: error,
|
||||
state,
|
||||
});
|
||||
}
|
||||
},
|
||||
trpc.viewer.loggedInViewerRouter.teamsAndUserProfilesQuery.useQuery(undefined, {
|
||||
enabled: show_account_selector,
|
||||
});
|
||||
|
||||
const generateAuthCodeMutation = trpc.viewer.oAuth.generateAuthCode.useMutation({
|
||||
onSuccess: (data) => {
|
||||
window.location.href =
|
||||
data.redirectUrl ?? `${client?.redirectUri}?code=${data.authorizationCode}&state=${state}`;
|
||||
},
|
||||
onError: (error) => {
|
||||
if (client?.redirectUri) {
|
||||
redirectToOAuthError({
|
||||
redirectUri: client.redirectUri,
|
||||
trpcError: error,
|
||||
state,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const mappedProfiles = data
|
||||
? data
|
||||
.filter((profile) => !profile.readOnly)
|
||||
@@ -130,11 +122,7 @@ export function Authorize() {
|
||||
return <div>{getClientError.message}</div>;
|
||||
}
|
||||
|
||||
if (
|
||||
isPendingGetClient ||
|
||||
(show_account_selector && isPendingProfiles) ||
|
||||
status !== "authenticated"
|
||||
) {
|
||||
if (isPendingGetClient || (show_account_selector && isPendingProfiles) || status !== "authenticated") {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
@@ -147,9 +135,7 @@ export function Authorize() {
|
||||
return (
|
||||
<div className="flex justify-center pt-32">
|
||||
<div className="flex items-center space-x-3">
|
||||
<span className="text-lg font-medium text-gray-700">
|
||||
{t("authorizing")}
|
||||
</span>
|
||||
<span className="text-lg font-medium text-gray-700">{t("authorizing")}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -169,11 +155,7 @@ export function Authorize() {
|
||||
<div className="relative -ml-6 w-24 h-24">
|
||||
<div className="flex absolute inset-0 justify-center items-center">
|
||||
<div className="bg-default flex h-[70px] w-[70px] items-center justify-center rounded-full">
|
||||
<img
|
||||
src="/cal-com-icon.svg"
|
||||
alt="Logo"
|
||||
className="w-16 h-16 rounded-full"
|
||||
/>
|
||||
<img src="/cal-com-icon.svg" alt="Logo" className="w-16 h-16 rounded-full" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -202,9 +184,7 @@ export function Authorize() {
|
||||
)}
|
||||
{show_account_selector && (
|
||||
<>
|
||||
<div className="mb-1 text-sm font-medium">
|
||||
{t("select_account_team")}
|
||||
</div>
|
||||
<div className="mb-1 text-sm font-medium">{t("select_account_team")}</div>
|
||||
<Select
|
||||
isSearchable={true}
|
||||
id="account-select"
|
||||
@@ -257,9 +237,7 @@ export function Authorize() {
|
||||
<div className="mb-1 text-sm font-medium">
|
||||
{t("allow_client_to_do", { clientName: client.name })}
|
||||
</div>
|
||||
<div className="text-sm">
|
||||
{t("oauth_access_information", { appName: APP_NAME })}
|
||||
</div>{" "}
|
||||
<div className="text-sm">{t("oauth_access_information", { appName: APP_NAME })}</div>{" "}
|
||||
</div>
|
||||
</div>
|
||||
<div className="-mx-9 mb-4 border-b border-subtle border-" />
|
||||
@@ -274,11 +252,8 @@ export function Authorize() {
|
||||
if (state) {
|
||||
params.set("state", state);
|
||||
}
|
||||
window.location.href = `${
|
||||
client.redirectUri
|
||||
}${separator}${params.toString()}`;
|
||||
}}
|
||||
>
|
||||
window.location.href = `${client.redirectUri}${separator}${params.toString()}`;
|
||||
}}>
|
||||
{t("go_back")}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -291,13 +266,11 @@ export function Authorize() {
|
||||
? selectedAccount?.value.substring(5)
|
||||
: undefined, // team account starts with /team/<slug>
|
||||
codeChallenge: code_challenge || undefined,
|
||||
codeChallengeMethod:
|
||||
(code_challenge_method as "S256") || undefined,
|
||||
codeChallengeMethod: (code_challenge_method as "S256") || undefined,
|
||||
state,
|
||||
});
|
||||
}}
|
||||
data-testid="allow-button"
|
||||
>
|
||||
data-testid="allow-button">
|
||||
{t("allow")}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -335,9 +308,7 @@ function buildOAuthErrorRedirectUrl({
|
||||
errorParams.append("state", state);
|
||||
}
|
||||
|
||||
return `${redirectUri}${
|
||||
redirectUri.includes("?") ? "&" : "?"
|
||||
}${errorParams.toString()}`;
|
||||
return `${redirectUri}${redirectUri.includes("?") ? "&" : "?"}${errorParams.toString()}`;
|
||||
}
|
||||
|
||||
function redirectToOAuthError({
|
||||
|
||||
@@ -18,7 +18,7 @@ const EMAIL_CLIENTS = [
|
||||
{
|
||||
name: "Gmail",
|
||||
icon: "/email-clients/gmail.svg",
|
||||
href: 'https://mail.google.com/mail/u/0/#search/%22api%2Fauth%2Fverify-email%22',
|
||||
href: "https://mail.google.com/mail/u/0/#search/%22api%2Fauth%2Fverify-email%22",
|
||||
},
|
||||
{
|
||||
name: "Outlook",
|
||||
|
||||
@@ -176,8 +176,8 @@ export default function Verify({ EMAIL_FROM }: { EMAIL_FROM?: string }) {
|
||||
{hasPaymentFailed
|
||||
? t("your_payment_failed")
|
||||
: isPremiumUsername
|
||||
? t("payment_successful")
|
||||
: t("check_your_inbox")}
|
||||
? t("payment_successful")
|
||||
: t("check_your_inbox")}
|
||||
</h3>
|
||||
{hasPaymentFailed && <p className="my-6">{t("account_created_premium_not_reserved")}</p>}
|
||||
<p className="text-muted dark:text-subtle text-base font-normal">
|
||||
|
||||
@@ -193,8 +193,18 @@ export const AvailabilityCTA = ({ canViewTeamAvailability }: AvailabilityCTAProp
|
||||
|
||||
const toggleGroupOptions = [
|
||||
{ value: "mine", label: t("my_availability") },
|
||||
...(canViewTeamAvailability ? [{ value: "team", label: t("team_availability"), onClick: () => { posthog.capture("team_availability_toggle_clicked") } }] : []),
|
||||
]
|
||||
...(canViewTeamAvailability
|
||||
? [
|
||||
{
|
||||
value: "team",
|
||||
label: t("team_availability"),
|
||||
onClick: () => {
|
||||
posthog.capture("team_availability_toggle_clicked");
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
// Get a new searchParams string by merging the current
|
||||
// searchParams with a provided key/value pair
|
||||
|
||||
@@ -6,7 +6,8 @@ import { Suspense } from "react";
|
||||
import { Loader } from "@calcom/ui/components/skeleton";
|
||||
|
||||
const TroubleshooterClientOnly = dynamic(
|
||||
() => import("@calcom/web/modules/troubleshooter/components/Troubleshooter").then((mod) => mod.Troubleshooter),
|
||||
() =>
|
||||
import("@calcom/web/modules/troubleshooter/components/Troubleshooter").then((mod) => mod.Troubleshooter),
|
||||
{
|
||||
ssr: false,
|
||||
}
|
||||
|
||||
@@ -208,7 +208,9 @@ export function BlockedEntriesTable<T extends BlocklistEntry>({
|
||||
isPending={isDeleting}
|
||||
onConfirm={confirmDelete}>
|
||||
{t(
|
||||
isSystem ? "remove_value_from_system_blocklist_description" : "remove_value_from_blocklist_description"
|
||||
isSystem
|
||||
? "remove_value_from_system_blocklist_description"
|
||||
: "remove_value_from_blocklist_description"
|
||||
)}
|
||||
</ConfirmationDialogContent>
|
||||
</Dialog>
|
||||
|
||||
@@ -98,8 +98,8 @@ export function BlocklistEntryDetailsSheet<T extends BlocklistEntry>({
|
||||
{detailsData.entry.source === "MANUAL"
|
||||
? t("manual")
|
||||
: detailsData.entry.source === "FREE_DOMAIN_POLICY"
|
||||
? t("free_domain_policy")
|
||||
: t("automatic")}
|
||||
? t("free_domain_policy")
|
||||
: t("automatic")}
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -160,7 +160,11 @@ export function CreateBlocklistEntryModal({
|
||||
</div>
|
||||
|
||||
<DialogFooter className="mt-6">
|
||||
<Button type="button" color="secondary" onClick={handleClose} disabled={isSubmitting || isPending}>
|
||||
<Button
|
||||
type="button"
|
||||
color="secondary"
|
||||
onClick={handleClose}
|
||||
disabled={isSubmitting || isPending}>
|
||||
{t("cancel")}
|
||||
</Button>
|
||||
<Button type="submit" loading={isSubmitting || isPending} disabled={isSubmitting || isPending}>
|
||||
|
||||
@@ -14,114 +14,114 @@ import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
|
||||
interface BookingHistoryProps {
|
||||
bookingUid: string;
|
||||
bookingUid: string;
|
||||
}
|
||||
|
||||
type TranslationComponent = {
|
||||
type: "link";
|
||||
href: string;
|
||||
type: "link";
|
||||
href: string;
|
||||
};
|
||||
|
||||
type TranslationWithParams = {
|
||||
key: string;
|
||||
params?: Record<string, string | number>;
|
||||
components?: TranslationComponent[];
|
||||
key: string;
|
||||
params?: Record<string, string | number>;
|
||||
components?: TranslationComponent[];
|
||||
};
|
||||
|
||||
type AuditLog = {
|
||||
id: string;
|
||||
action: string;
|
||||
type: string;
|
||||
timestamp: string;
|
||||
source: string;
|
||||
displayJson?: Record<string, unknown> | null;
|
||||
actionDisplayTitle: TranslationWithParams;
|
||||
displayFields?: Array<{ labelKey: string; valueKey?: string; value?: string; values?: string[] }> | null;
|
||||
actor: {
|
||||
type: AuditActorType;
|
||||
displayName: string | null;
|
||||
displayEmail: string | null;
|
||||
displayAvatar: string | null;
|
||||
};
|
||||
impersonatedBy?: {
|
||||
displayName: string;
|
||||
displayEmail: string | null;
|
||||
displayAvatar: string | null;
|
||||
} | null;
|
||||
hasError?: boolean;
|
||||
id: string;
|
||||
action: string;
|
||||
type: string;
|
||||
timestamp: string;
|
||||
source: string;
|
||||
displayJson?: Record<string, unknown> | null;
|
||||
actionDisplayTitle: TranslationWithParams;
|
||||
displayFields?: Array<{ labelKey: string; valueKey?: string; value?: string; values?: string[] }> | null;
|
||||
actor: {
|
||||
type: AuditActorType;
|
||||
displayName: string | null;
|
||||
displayEmail: string | null;
|
||||
displayAvatar: string | null;
|
||||
};
|
||||
impersonatedBy?: {
|
||||
displayName: string;
|
||||
displayEmail: string | null;
|
||||
displayAvatar: string | null;
|
||||
} | null;
|
||||
hasError?: boolean;
|
||||
};
|
||||
|
||||
interface BookingLogsFiltersProps {
|
||||
searchTerm: string;
|
||||
onSearchChange: (value: string) => void;
|
||||
actorFilter: string | null;
|
||||
onActorFilterChange: (value: string | null) => void;
|
||||
actorOptions: Array<{ label: string; value: string }>;
|
||||
searchTerm: string;
|
||||
onSearchChange: (value: string) => void;
|
||||
actorFilter: string | null;
|
||||
onActorFilterChange: (value: string | null) => void;
|
||||
actorOptions: Array<{ label: string; value: string }>;
|
||||
}
|
||||
|
||||
interface BookingLogsTimelineProps {
|
||||
logs: AuditLog[];
|
||||
logs: AuditLog[];
|
||||
}
|
||||
|
||||
const ACTION_ICON_MAP: Record<string, IconName> = {
|
||||
CREATED: "calendar",
|
||||
CANCELLED: "ban",
|
||||
REJECTED: "ban",
|
||||
ACCEPTED: "check",
|
||||
RESCHEDULED: "pencil",
|
||||
RESCHEDULE_REQUESTED: "pencil",
|
||||
REASSIGNMENT: "user-check",
|
||||
ATTENDEE_ADDED: "user-check",
|
||||
ATTENDEE_REMOVED: "user-check",
|
||||
LOCATION_CHANGED: "map-pin",
|
||||
NO_SHOW_UPDATED: "ban",
|
||||
CREATED: "calendar",
|
||||
CANCELLED: "ban",
|
||||
REJECTED: "ban",
|
||||
ACCEPTED: "check",
|
||||
RESCHEDULED: "pencil",
|
||||
RESCHEDULE_REQUESTED: "pencil",
|
||||
REASSIGNMENT: "user-check",
|
||||
ATTENDEE_ADDED: "user-check",
|
||||
ATTENDEE_REMOVED: "user-check",
|
||||
LOCATION_CHANGED: "map-pin",
|
||||
NO_SHOW_UPDATED: "ban",
|
||||
} as const;
|
||||
|
||||
const ACTOR_ROLE_LABEL_MAP: Record<AuditActorType, string | null> = {
|
||||
GUEST: "guest",
|
||||
ATTENDEE: "attendee",
|
||||
SYSTEM: null,
|
||||
USER: null,
|
||||
APP: null,
|
||||
GUEST: "guest",
|
||||
ATTENDEE: "attendee",
|
||||
SYSTEM: null,
|
||||
USER: null,
|
||||
APP: null,
|
||||
} as const;
|
||||
|
||||
function BookingLogsFilters({
|
||||
searchTerm,
|
||||
onSearchChange,
|
||||
actorFilter,
|
||||
onActorFilterChange,
|
||||
actorOptions,
|
||||
searchTerm,
|
||||
onSearchChange,
|
||||
actorFilter,
|
||||
onActorFilterChange,
|
||||
actorOptions,
|
||||
}: BookingLogsFiltersProps) {
|
||||
const { t } = useLocale();
|
||||
const { t } = useLocale();
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2 items-start">
|
||||
<div className="flex-1 min-w-[200px]">
|
||||
<FilterSearchField
|
||||
size="sm"
|
||||
value={searchTerm}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
containerClassName=""
|
||||
/>
|
||||
</div>
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2 items-start">
|
||||
<div className="flex-1 min-w-[200px]">
|
||||
<FilterSearchField
|
||||
size="sm"
|
||||
value={searchTerm}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
containerClassName=""
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="min-w-[140px]">
|
||||
<Select
|
||||
size="sm"
|
||||
value={
|
||||
actorFilter
|
||||
? { label: `${t("actor")}: ${actorFilter}`, value: actorFilter }
|
||||
: { label: `${t("actor")}: ${t("all")}`, value: "" }
|
||||
}
|
||||
onChange={(option) => {
|
||||
if (!option) return;
|
||||
onActorFilterChange(option.value || null);
|
||||
}}
|
||||
options={[{ label: t("all"), value: "" }, ...actorOptions]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
<div className="min-w-[140px]">
|
||||
<Select
|
||||
size="sm"
|
||||
value={
|
||||
actorFilter
|
||||
? { label: `${t("actor")}: ${actorFilter}`, value: actorFilter }
|
||||
: { label: `${t("actor")}: ${t("all")}`, value: "" }
|
||||
}
|
||||
onChange={(option) => {
|
||||
if (!option) return;
|
||||
onActorFilterChange(option.value || null);
|
||||
}}
|
||||
options={[{ label: t("all"), value: "" }, ...actorOptions]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,335 +129,338 @@ function BookingLogsFilters({
|
||||
* Handles translations with embedded components (e.g., links) for proper i18n support
|
||||
*/
|
||||
function ActionTitle({ actionDisplayTitle }: { actionDisplayTitle: TranslationWithParams }) {
|
||||
const { t } = useLocale();
|
||||
const { t } = useLocale();
|
||||
|
||||
if (actionDisplayTitle.components?.length) {
|
||||
return (
|
||||
<ServerTrans
|
||||
t={t}
|
||||
i18nKey={actionDisplayTitle.key}
|
||||
values={actionDisplayTitle.params}
|
||||
components={actionDisplayTitle.components.map((comp) =>
|
||||
comp.type === "link" ? (
|
||||
<Link key={comp.href} href={comp.href} className="text-emphasis underline hover:no-underline" />
|
||||
) : (
|
||||
<span key={comp.href} />
|
||||
)
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (actionDisplayTitle.components?.length) {
|
||||
return (
|
||||
<ServerTrans
|
||||
t={t}
|
||||
i18nKey={actionDisplayTitle.key}
|
||||
values={actionDisplayTitle.params}
|
||||
components={actionDisplayTitle.components.map((comp) =>
|
||||
comp.type === "link" ? (
|
||||
<Link key={comp.href} href={comp.href} className="text-emphasis underline hover:no-underline" />
|
||||
) : (
|
||||
<span key={comp.href} />
|
||||
)
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <>{t(actionDisplayTitle.key, actionDisplayTitle.params)}</>;
|
||||
return <>{t(actionDisplayTitle.key, actionDisplayTitle.params)}</>;
|
||||
}
|
||||
|
||||
interface JsonViewerProps {
|
||||
data: Record<string, unknown> | null;
|
||||
data: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
function JsonViewer({ data }: JsonViewerProps) {
|
||||
if (!data || Object.keys(data).length === 0) {
|
||||
return null;
|
||||
}
|
||||
if (!data || Object.keys(data).length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const jsonString = JSON.stringify(data, null, 2);
|
||||
const lines = jsonString.split("\n");
|
||||
const lineCount = lines.length;
|
||||
const lineNumberWidth = Math.max(2, Math.ceil(Math.log10(lineCount)) + 1);
|
||||
const jsonString = JSON.stringify(data, null, 2);
|
||||
const lines = jsonString.split("\n");
|
||||
const lineCount = lines.length;
|
||||
const lineNumberWidth = Math.max(2, Math.ceil(Math.log10(lineCount)) + 1);
|
||||
|
||||
return (
|
||||
<div className="bg-default p-3 rounded-md text-[10px] overflow-x-auto font-mono">
|
||||
{lines.map((line, idx) => (
|
||||
<div key={idx} className="flex gap-2">
|
||||
<span
|
||||
className="text-subtle select-none text-right shrink-0"
|
||||
style={{ minWidth: `${lineNumberWidth}ch` }}>
|
||||
{idx + 1}
|
||||
</span>
|
||||
<span className="text-default whitespace-pre-wrap break-all">{line || " "}</span>
|
||||
</div>
|
||||
))}
|
||||
return (
|
||||
<div className="bg-default p-3 rounded-md text-[10px] overflow-x-auto font-mono">
|
||||
{lines.map((line, idx) => (
|
||||
<div key={idx} className="flex gap-2">
|
||||
<span
|
||||
className="text-subtle select-none text-right shrink-0"
|
||||
style={{ minWidth: `${lineNumberWidth}ch` }}>
|
||||
{idx + 1}
|
||||
</span>
|
||||
<span className="text-default whitespace-pre-wrap break-all">{line || " "}</span>
|
||||
</div>
|
||||
);
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface DisplayFieldValueProps {
|
||||
field: {
|
||||
valueKey?: string;
|
||||
value?: string;
|
||||
values?: string[];
|
||||
};
|
||||
field: {
|
||||
valueKey?: string;
|
||||
value?: string;
|
||||
values?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
function DisplayFieldValue({ field }: DisplayFieldValueProps) {
|
||||
const { t } = useLocale();
|
||||
const { t } = useLocale();
|
||||
|
||||
if (field.values) {
|
||||
return (
|
||||
<span className="flex flex-col">
|
||||
{field.values.map((v, i) => (
|
||||
<span className="p-0.5" key={i}>
|
||||
{v}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (field.values) {
|
||||
return (
|
||||
<span className="flex flex-col">
|
||||
{field.values.map((v, i) => (
|
||||
<span className="p-0.5" key={i}>
|
||||
{v}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return <>{field.value ?? (field.valueKey ? t(field.valueKey) : "")}</>;
|
||||
return <>{field.value ?? (field.valueKey ? t(field.valueKey) : "")}</>;
|
||||
}
|
||||
|
||||
function BookingLogsTimeline({ logs }: BookingLogsTimelineProps) {
|
||||
const { t } = useLocale();
|
||||
const [expandedLogIds, setExpandedLogIds] = useState<Set<string>>(new Set());
|
||||
const [showJsonMap, setShowJsonMap] = useState<Record<string, boolean>>({});
|
||||
const { t } = useLocale();
|
||||
const [expandedLogIds, setExpandedLogIds] = useState<Set<string>>(new Set());
|
||||
const [showJsonMap, setShowJsonMap] = useState<Record<string, boolean>>({});
|
||||
|
||||
const toggleExpand = (logId: string) => {
|
||||
setExpandedLogIds((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
if (newSet.has(logId)) {
|
||||
newSet.delete(logId);
|
||||
} else {
|
||||
newSet.add(logId);
|
||||
}
|
||||
return newSet;
|
||||
});
|
||||
};
|
||||
const toggleExpand = (logId: string) => {
|
||||
setExpandedLogIds((prev) => {
|
||||
const newSet = new Set(prev);
|
||||
if (newSet.has(logId)) {
|
||||
newSet.delete(logId);
|
||||
} else {
|
||||
newSet.add(logId);
|
||||
}
|
||||
return newSet;
|
||||
});
|
||||
};
|
||||
|
||||
const toggleJson = (logId: string) => {
|
||||
setShowJsonMap((prev) => ({
|
||||
...prev,
|
||||
[logId]: !prev[logId],
|
||||
}));
|
||||
};
|
||||
|
||||
if (logs.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-12">
|
||||
<p className="text-muted">{t("no_audit_logs_found")}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const toggleJson = (logId: string) => {
|
||||
setShowJsonMap((prev) => ({
|
||||
...prev,
|
||||
[logId]: !prev[logId],
|
||||
}));
|
||||
};
|
||||
|
||||
if (logs.length === 0) {
|
||||
return (
|
||||
<div className="flex flex-col gap-0.5">
|
||||
{logs.map((log, index) => {
|
||||
const isLast = index === logs.length - 1;
|
||||
const isExpanded = expandedLogIds.has(log.id);
|
||||
const showJson = showJsonMap[log.id] || false;
|
||||
const actorRole = ACTOR_ROLE_LABEL_MAP[log.actor.type] ?? null;
|
||||
return (
|
||||
<div key={log.id} className="flex gap-1">
|
||||
<div className="flex flex-col items-center self-stretch">
|
||||
<div className="pt-2 shrink-0">
|
||||
<div className="bg-subtle rounded-[3.556px] p-1 flex items-center justify-center w-4 h-4">
|
||||
<Icon name={log.hasError ? "triangle-alert" : (ACTION_ICON_MAP[log.action] ?? "sparkles")} className={`h-3 w-3 ${log.hasError ? "text-attention" : "text-subtle"}`} />
|
||||
</div>
|
||||
</div>
|
||||
{!isLast && <div className="w-px bg-subtle flex-1 min-h-0" />}
|
||||
</div>
|
||||
|
||||
<div className="flex-1 rounded-lg py-2">
|
||||
<div className="px-3 mb-2">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="text-sm font-medium leading-4 text-emphasis">
|
||||
<ActionTitle actionDisplayTitle={log.actionDisplayTitle} />
|
||||
</h3>
|
||||
<div className="flex items-center gap-1 mt-1 text-xs text-subtle">
|
||||
{log.actor.displayAvatar && (
|
||||
<Avatar
|
||||
size="xs"
|
||||
imageSrc={log.actor.displayAvatar}
|
||||
alt={log.actor.displayName || ""}
|
||||
/>
|
||||
)}
|
||||
<span>
|
||||
{log.actor.displayName}
|
||||
{actorRole && <span>{` (${t(actorRole)})`}</span>}
|
||||
</span>
|
||||
<span>•</span>
|
||||
<span>{dayjs(log.timestamp).fromNow()}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-3">
|
||||
<div className="bg-muted rounded-lg border border-muted">
|
||||
<div className="py-1">
|
||||
<Button
|
||||
color="minimal"
|
||||
size="sm"
|
||||
onClick={() => toggleExpand(log.id)}
|
||||
StartIcon={isExpanded ? "chevron-down" : "chevron-right"}
|
||||
className="justify-start text-xs font-medium text-subtle h-6">
|
||||
{isExpanded ? t("hide_details") : t("show_details")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{isExpanded && (
|
||||
<div className="bg-default rounded-lg m-0.5 text-xs">
|
||||
{/* Render displayFields if available, otherwise show type */}
|
||||
{log.displayFields && log.displayFields.length > 0
|
||||
? log.displayFields.map((field, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">{t(field.labelKey)}</span>
|
||||
<span className="font-medium">
|
||||
<DisplayFieldValue field={field} />
|
||||
</span>
|
||||
</div>
|
||||
))
|
||||
: null}
|
||||
<div className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">{t("actor")}</span>
|
||||
<span className="text-default">{log.actor.displayName || log.actor.type}</span>
|
||||
</div>
|
||||
{log.impersonatedBy && (
|
||||
<div className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">
|
||||
{t("booking_audit_action.actor_impersonated_by", {
|
||||
actor: log.actor.displayName,
|
||||
})}
|
||||
</span>
|
||||
<span className="text-default">{log.impersonatedBy.displayName}</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">
|
||||
{t("booking_audit_action.source")}
|
||||
</span>
|
||||
<span className="text-default">{log.source}</span>
|
||||
</div>
|
||||
<div className="flex items-start gap-2 py-2 px-3 border-b border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">{t("timestamp")}</span>
|
||||
<span className="text-default">
|
||||
{dayjs(log.timestamp).format("YYYY-MM-DD HH:mm:ss")}
|
||||
</span>
|
||||
</div>
|
||||
{log.displayJson && Object.keys(log.displayJson).length > 0 && (
|
||||
<div>
|
||||
<div className="flex flex-col items-start gap-2 py-1 px-3 border-b border-subtle">
|
||||
<Button
|
||||
color="minimal"
|
||||
size="sm"
|
||||
onClick={() => toggleJson(log.id)}
|
||||
StartIcon={showJson ? "chevron-down" : "chevron-right"}
|
||||
className="-ml-3 h-6 px-2 font-medium text-xs">
|
||||
{t("json")}
|
||||
</Button>
|
||||
</div>
|
||||
<div>{showJson && <JsonViewer data={log.displayJson} />}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="text-center py-12">
|
||||
<p className="text-muted">{t("no_audit_logs_found")}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-0.5">
|
||||
{logs.map((log, index) => {
|
||||
const isLast = index === logs.length - 1;
|
||||
const isExpanded = expandedLogIds.has(log.id);
|
||||
const showJson = showJsonMap[log.id] || false;
|
||||
const actorRole = ACTOR_ROLE_LABEL_MAP[log.actor.type] ?? null;
|
||||
return (
|
||||
<div key={log.id} className="flex gap-1">
|
||||
<div className="flex flex-col items-center self-stretch">
|
||||
<div className="pt-2 shrink-0">
|
||||
<div className="bg-subtle rounded-[3.556px] p-1 flex items-center justify-center w-4 h-4">
|
||||
<Icon
|
||||
name={log.hasError ? "triangle-alert" : (ACTION_ICON_MAP[log.action] ?? "sparkles")}
|
||||
className={`h-3 w-3 ${log.hasError ? "text-attention" : "text-subtle"}`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{!isLast && <div className="w-px bg-subtle flex-1 min-h-0" />}
|
||||
</div>
|
||||
|
||||
<div className="flex-1 rounded-lg py-2">
|
||||
<div className="px-3 mb-2">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="text-sm font-medium leading-4 text-emphasis">
|
||||
<ActionTitle actionDisplayTitle={log.actionDisplayTitle} />
|
||||
</h3>
|
||||
<div className="flex items-center gap-1 mt-1 text-xs text-subtle">
|
||||
{log.actor.displayAvatar && (
|
||||
<Avatar
|
||||
size="xs"
|
||||
imageSrc={log.actor.displayAvatar}
|
||||
alt={log.actor.displayName || ""}
|
||||
/>
|
||||
)}
|
||||
<span>
|
||||
{log.actor.displayName}
|
||||
{actorRole && <span>{` (${t(actorRole)})`}</span>}
|
||||
</span>
|
||||
<span>•</span>
|
||||
<span>{dayjs(log.timestamp).fromNow()}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-3">
|
||||
<div className="bg-muted rounded-lg border border-muted">
|
||||
<div className="py-1">
|
||||
<Button
|
||||
color="minimal"
|
||||
size="sm"
|
||||
onClick={() => toggleExpand(log.id)}
|
||||
StartIcon={isExpanded ? "chevron-down" : "chevron-right"}
|
||||
className="justify-start text-xs font-medium text-subtle h-6">
|
||||
{isExpanded ? t("hide_details") : t("show_details")}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{isExpanded && (
|
||||
<div className="bg-default rounded-lg m-0.5 text-xs">
|
||||
{/* Render displayFields if available, otherwise show type */}
|
||||
{log.displayFields && log.displayFields.length > 0
|
||||
? log.displayFields.map((field, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">{t(field.labelKey)}</span>
|
||||
<span className="font-medium">
|
||||
<DisplayFieldValue field={field} />
|
||||
</span>
|
||||
</div>
|
||||
))
|
||||
: null}
|
||||
<div className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">{t("actor")}</span>
|
||||
<span className="text-default">{log.actor.displayName || log.actor.type}</span>
|
||||
</div>
|
||||
{log.impersonatedBy && (
|
||||
<div className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">
|
||||
{t("booking_audit_action.actor_impersonated_by", {
|
||||
actor: log.actor.displayName,
|
||||
})}
|
||||
</span>
|
||||
<span className="text-default">{log.impersonatedBy.displayName}</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-start gap-2 py-2 border-b px-3 border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">
|
||||
{t("booking_audit_action.source")}
|
||||
</span>
|
||||
<span className="text-default">{log.source}</span>
|
||||
</div>
|
||||
<div className="flex items-start gap-2 py-2 px-3 border-b border-subtle">
|
||||
<span className="font-medium text-emphasis w-[140px]">{t("timestamp")}</span>
|
||||
<span className="text-default">
|
||||
{dayjs(log.timestamp).format("YYYY-MM-DD HH:mm:ss")}
|
||||
</span>
|
||||
</div>
|
||||
{log.displayJson && Object.keys(log.displayJson).length > 0 && (
|
||||
<div>
|
||||
<div className="flex flex-col items-start gap-2 py-1 px-3 border-b border-subtle">
|
||||
<Button
|
||||
color="minimal"
|
||||
size="sm"
|
||||
onClick={() => toggleJson(log.id)}
|
||||
StartIcon={showJson ? "chevron-down" : "chevron-right"}
|
||||
className="-ml-3 h-6 px-2 font-medium text-xs">
|
||||
{t("json")}
|
||||
</Button>
|
||||
</div>
|
||||
<div>{showJson && <JsonViewer data={log.displayJson} />}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function useBookingLogsFilters(auditLogs: AuditLog[], searchTerm: string, actorFilter: string | null) {
|
||||
const filteredLogs = auditLogs.filter((log) => {
|
||||
const doesMatchDisplayFields = (): boolean => {
|
||||
return (
|
||||
log.displayFields?.some((field) => {
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
return (
|
||||
field.valueKey?.toLowerCase().includes(searchLower) ||
|
||||
field.labelKey?.toLowerCase().includes(searchLower) ||
|
||||
field.value?.toLowerCase().includes(searchLower) ||
|
||||
field.values?.some((v) => v.toLowerCase().includes(searchLower))
|
||||
);
|
||||
}) ?? false
|
||||
);
|
||||
};
|
||||
const filteredLogs = auditLogs.filter((log) => {
|
||||
const doesMatchDisplayFields = (): boolean => {
|
||||
return (
|
||||
log.displayFields?.some((field) => {
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
return (
|
||||
field.valueKey?.toLowerCase().includes(searchLower) ||
|
||||
field.labelKey?.toLowerCase().includes(searchLower) ||
|
||||
field.value?.toLowerCase().includes(searchLower) ||
|
||||
field.values?.some((v) => v.toLowerCase().includes(searchLower))
|
||||
);
|
||||
}) ?? false
|
||||
);
|
||||
};
|
||||
|
||||
const doesMatchActionDisplayTitle = (): boolean => {
|
||||
return (
|
||||
log.actionDisplayTitle.key?.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
Object.values(log.actionDisplayTitle.params ?? {}).some((param) =>
|
||||
param?.toString().toLowerCase().includes(searchTerm.toLowerCase())
|
||||
)
|
||||
);
|
||||
};
|
||||
const doesMatchActionDisplayTitle = (): boolean => {
|
||||
return (
|
||||
log.actionDisplayTitle.key?.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
Object.values(log.actionDisplayTitle.params ?? {}).some((param) =>
|
||||
param?.toString().toLowerCase().includes(searchTerm.toLowerCase())
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
const matchesSearch =
|
||||
!searchTerm ||
|
||||
log.action.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
log.actor.displayName?.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
doesMatchDisplayFields() ||
|
||||
doesMatchActionDisplayTitle();
|
||||
const matchesSearch =
|
||||
!searchTerm ||
|
||||
log.action.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
log.actor.displayName?.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
doesMatchDisplayFields() ||
|
||||
doesMatchActionDisplayTitle();
|
||||
|
||||
const matchesActor = !actorFilter || log.actor.displayName === actorFilter;
|
||||
const matchesActor = !actorFilter || log.actor.displayName === actorFilter;
|
||||
|
||||
return matchesSearch && matchesActor;
|
||||
});
|
||||
return matchesSearch && matchesActor;
|
||||
});
|
||||
|
||||
const uniqueActorNames = Array.from(
|
||||
new Set(auditLogs.map((log) => log.actor.displayName).filter((name): name is string => Boolean(name)))
|
||||
);
|
||||
const uniqueActorNames = Array.from(
|
||||
new Set(auditLogs.map((log) => log.actor.displayName).filter((name): name is string => Boolean(name)))
|
||||
);
|
||||
|
||||
const actorOptions = uniqueActorNames.map((actorName) => ({
|
||||
label: actorName,
|
||||
value: actorName,
|
||||
}));
|
||||
const actorOptions = uniqueActorNames.map((actorName) => ({
|
||||
label: actorName,
|
||||
value: actorName,
|
||||
}));
|
||||
|
||||
return { filteredLogs, actorOptions };
|
||||
return { filteredLogs, actorOptions };
|
||||
}
|
||||
|
||||
export function BookingHistory({ bookingUid }: BookingHistoryProps) {
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [actorFilter, setActorFilter] = useState<string | null>(null);
|
||||
const { t } = useLocale();
|
||||
const { data, isLoading, error } = trpc.viewer.bookings.getBookingHistory.useQuery({
|
||||
bookingUid,
|
||||
});
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [actorFilter, setActorFilter] = useState<string | null>(null);
|
||||
const { t } = useLocale();
|
||||
const { data, isLoading, error } = trpc.viewer.bookings.getBookingHistory.useQuery({
|
||||
bookingUid,
|
||||
});
|
||||
|
||||
const auditLogs = data?.auditLogs || [];
|
||||
const auditLogs = data?.auditLogs || [];
|
||||
|
||||
const { filteredLogs, actorOptions } = useBookingLogsFilters(auditLogs, searchTerm, actorFilter);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-12">
|
||||
<div className="text-center">
|
||||
<p className="text-red-600 font-medium">{t("error_loading_booking_logs")}</p>
|
||||
<p className="text-sm text-gray-500 mt-2">{error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<SkeletonText className="h-12 w-full" />
|
||||
<SkeletonText className="h-24 w-full" />
|
||||
<SkeletonText className="h-24 w-full" />
|
||||
<SkeletonText className="h-24 w-full" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const { filteredLogs, actorOptions } = useBookingLogsFilters(auditLogs, searchTerm, actorFilter);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<BookingLogsFilters
|
||||
searchTerm={searchTerm}
|
||||
onSearchChange={setSearchTerm}
|
||||
actorFilter={actorFilter}
|
||||
onActorFilterChange={setActorFilter}
|
||||
actorOptions={actorOptions}
|
||||
/>
|
||||
|
||||
<BookingLogsTimeline logs={filteredLogs} />
|
||||
<div className="flex items-center justify-center py-12">
|
||||
<div className="text-center">
|
||||
<p className="text-red-600 font-medium">{t("error_loading_booking_logs")}</p>
|
||||
<p className="text-sm text-gray-500 mt-2">{error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<SkeletonText className="h-12 w-full" />
|
||||
<SkeletonText className="h-24 w-full" />
|
||||
<SkeletonText className="h-24 w-full" />
|
||||
<SkeletonText className="h-24 w-full" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<BookingLogsFilters
|
||||
searchTerm={searchTerm}
|
||||
onSearchChange={setSearchTerm}
|
||||
actorFilter={actorFilter}
|
||||
onActorFilterChange={setActorFilter}
|
||||
actorOptions={actorOptions}
|
||||
/>
|
||||
|
||||
<BookingLogsTimeline logs={filteredLogs} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import { BookingHistory } from "./BookingHistory";
|
||||
|
||||
interface BookingHistoryPageProps {
|
||||
bookingUid: string;
|
||||
bookingUid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11,5 +11,5 @@ interface BookingHistoryPageProps {
|
||||
* Adds page-specific styling and layout for the booking history view
|
||||
*/
|
||||
export function BookingHistoryPage({ bookingUid }: BookingHistoryPageProps) {
|
||||
return <BookingHistory bookingUid={bookingUid} />;
|
||||
return <BookingHistory bookingUid={bookingUid} />;
|
||||
}
|
||||
@@ -28,10 +28,7 @@ type AvailableTimeSlotsProps = {
|
||||
seatsPerTimeSlot?: number | null;
|
||||
showAvailableSeatsCount?: boolean | null;
|
||||
event: {
|
||||
data?: Pick<
|
||||
BookerEvent,
|
||||
"length" | "bookingFields" | "price" | "currency" | "metadata"
|
||||
> | null;
|
||||
data?: Pick<BookerEvent, "length" | "bookingFields" | "price" | "currency" | "metadata"> | null;
|
||||
};
|
||||
customClassNames?: {
|
||||
availableTimeSlotsContainer?: string;
|
||||
@@ -86,18 +83,15 @@ export const AvailableTimeSlots = ({
|
||||
}: AvailableTimeSlotsProps) => {
|
||||
const selectedDate = useBookerStoreContext((state) => state.selectedDate);
|
||||
|
||||
const setSeatedEventData = useBookerStoreContext(
|
||||
(state) => state.setSeatedEventData
|
||||
);
|
||||
const setSeatedEventData = useBookerStoreContext((state) => state.setSeatedEventData);
|
||||
const date = selectedDate || dayjs().format("YYYY-MM-DD");
|
||||
const [layout] = useBookerStoreContext((state) => [state.layout]);
|
||||
const isColumnView = layout === BookerLayouts.COLUMN_VIEW;
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const { setTentativeSelectedTimeslots, tentativeSelectedTimeslots } =
|
||||
useBookerStoreContext((state) => ({
|
||||
setTentativeSelectedTimeslots: state.setTentativeSelectedTimeslots,
|
||||
tentativeSelectedTimeslots: state.tentativeSelectedTimeslots,
|
||||
}));
|
||||
const { setTentativeSelectedTimeslots, tentativeSelectedTimeslots } = useBookerStoreContext((state) => ({
|
||||
setTentativeSelectedTimeslots: state.setTentativeSelectedTimeslots,
|
||||
tentativeSelectedTimeslots: state.tentativeSelectedTimeslots,
|
||||
}));
|
||||
|
||||
const onTentativeTimeSelect = ({
|
||||
time,
|
||||
@@ -135,22 +129,13 @@ export const AvailableTimeSlots = ({
|
||||
return [];
|
||||
}, [date, extraDays, nonEmptyScheduleDaysFromSelectedDate]);
|
||||
|
||||
const { slotsPerDay, toggleConfirmButton } = useSlotsForAvailableDates(
|
||||
dates,
|
||||
scheduleData?.slots
|
||||
);
|
||||
const { slotsPerDay, toggleConfirmButton } = useSlotsForAvailableDates(dates, scheduleData?.slots);
|
||||
|
||||
const overlayCalendarToggled =
|
||||
getQueryParam("overlayCalendar") === "true" ||
|
||||
localStorage.getItem("overlayCalendarSwitchDefault");
|
||||
getQueryParam("overlayCalendar") === "true" || localStorage.getItem("overlayCalendarSwitchDefault");
|
||||
|
||||
const onTimeSelect = useCallback(
|
||||
(
|
||||
time: string,
|
||||
attendees: number,
|
||||
seatsPerTimeSlot?: number | null,
|
||||
bookingUid?: string
|
||||
) => {
|
||||
(time: string, attendees: number, seatsPerTimeSlot?: number | null, bookingUid?: string) => {
|
||||
// Temporarily allow disabling it, till we are sure that it doesn't cause any significant load on the system
|
||||
if (PUBLIC_INVALIDATE_AVAILABLE_SLOTS_ON_BOOKING_FORM) {
|
||||
// Ensures that user has latest available slots when they are about to confirm the booking by filling up the details
|
||||
@@ -201,13 +186,7 @@ export const AvailableTimeSlots = ({
|
||||
);
|
||||
}
|
||||
},
|
||||
[
|
||||
overlayCalendarToggled,
|
||||
onTimeSelect,
|
||||
seatsPerTimeSlot,
|
||||
skipConfirmStep,
|
||||
toggleConfirmButton,
|
||||
]
|
||||
[overlayCalendarToggled, onTimeSelect, seatsPerTimeSlot, skipConfirmStep, toggleConfirmButton]
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -217,8 +196,7 @@ export const AvailableTimeSlots = ({
|
||||
`flex`,
|
||||
hideAvailableTimesHeader && "hidden",
|
||||
`${customClassNames?.availableTimeSlotsContainer}`
|
||||
)}
|
||||
>
|
||||
)}>
|
||||
{isLoading ? (
|
||||
<div className="mb-3 h-8" />
|
||||
) : (
|
||||
@@ -229,19 +207,15 @@ export const AvailableTimeSlots = ({
|
||||
return (
|
||||
<AvailableTimesHeader
|
||||
customClassNames={{
|
||||
availableTimeSlotsHeaderContainer:
|
||||
customClassNames?.availableTimeSlotsHeaderContainer,
|
||||
availableTimeSlotsTitle:
|
||||
customClassNames?.availableTimeSlotsTitle,
|
||||
availableTimeSlotsTimeFormatToggle:
|
||||
customClassNames?.availableTimeSlotsTimeFormatToggle,
|
||||
availableTimeSlotsHeaderContainer: customClassNames?.availableTimeSlotsHeaderContainer,
|
||||
availableTimeSlotsTitle: customClassNames?.availableTimeSlotsTitle,
|
||||
availableTimeSlotsTimeFormatToggle: customClassNames?.availableTimeSlotsTimeFormatToggle,
|
||||
}}
|
||||
key={slots.date}
|
||||
date={dayjs(slots.date)}
|
||||
showTimeFormatToggle={!isColumnView && !isOOODay}
|
||||
availableMonth={
|
||||
dayjs(selectedDate).format("MM") !==
|
||||
dayjs(slots.date).format("MM")
|
||||
dayjs(selectedDate).format("MM") !== dayjs(slots.date).format("MM")
|
||||
? dayjs(slots.date).format("MMM")
|
||||
: undefined
|
||||
}
|
||||
@@ -257,19 +231,13 @@ export const AvailableTimeSlots = ({
|
||||
limitHeight && "no-scrollbar grow overflow-auto md:h-[400px]",
|
||||
!limitHeight && "flex h-full w-full flex-row gap-4",
|
||||
`${customClassNames?.availableTimeSlotsContainer}`
|
||||
)}
|
||||
>
|
||||
)}>
|
||||
{isLoading && // Shows exact amount of days as skeleton.
|
||||
Array.from({ length: 1 + (extraDays ?? 0) }).map((_, i) => (
|
||||
<AvailableTimesSkeleton key={i} />
|
||||
))}
|
||||
Array.from({ length: 1 + (extraDays ?? 0) }).map((_, i) => <AvailableTimesSkeleton key={i} />)}
|
||||
{!isLoading &&
|
||||
slotsPerDay.length > 0 &&
|
||||
slotsPerDay.map((slots) => (
|
||||
<div
|
||||
key={slots.date}
|
||||
className="no-scrollbar overflow-x-hidden! h-full w-full overflow-y-auto"
|
||||
>
|
||||
<div key={slots.date} className="no-scrollbar overflow-x-hidden! h-full w-full overflow-y-auto">
|
||||
<AvailableTimes
|
||||
className={customClassNames?.availableTimeSlotsContainer}
|
||||
customClassNames={customClassNames?.availableTimes}
|
||||
|
||||
@@ -295,10 +295,10 @@ export const BookEventForm = ({
|
||||
{rescheduleUid && bookingData
|
||||
? t("reschedule")
|
||||
: renderConfirmNotVerifyEmailButtonCond
|
||||
? isPaidEvent
|
||||
? t("pay_and_book")
|
||||
: t("confirm")
|
||||
: t("verify_email_button")}
|
||||
? isPaidEvent
|
||||
? t("pay_and_book")
|
||||
: t("confirm")
|
||||
: t("verify_email_button")}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -253,12 +253,12 @@ const BookerComponent = ({
|
||||
|
||||
const unavailableTimeSlots = isQuickAvailabilityCheckFeatureEnabled
|
||||
? allSelectedTimeslots.filter((slot) => {
|
||||
return !isTimeSlotAvailable({
|
||||
scheduleData: schedule?.data ?? null,
|
||||
slotToCheckInIso: slot,
|
||||
quickAvailabilityChecks: slots.quickAvailabilityChecks,
|
||||
});
|
||||
})
|
||||
return !isTimeSlotAvailable({
|
||||
scheduleData: schedule?.data ?? null,
|
||||
slotToCheckInIso: slot,
|
||||
quickAvailabilityChecks: slots.quickAvailabilityChecks,
|
||||
});
|
||||
})
|
||||
: [];
|
||||
|
||||
const slot = getQueryParam("slot");
|
||||
@@ -401,7 +401,7 @@ const BookerComponent = ({
|
||||
className={classNames(
|
||||
layout === BookerLayouts.MONTH_VIEW && "fixed top-4 z-10 ltr:right-4 rtl:left-4",
|
||||
(layout === BookerLayouts.COLUMN_VIEW || layout === BookerLayouts.WEEK_VIEW) &&
|
||||
"bg-default dark:bg-cal-muted sticky top-0 z-10"
|
||||
"bg-default dark:bg-cal-muted sticky top-0 z-10"
|
||||
)}>
|
||||
{isPlatform && layout === BookerLayouts.MONTH_VIEW ? (
|
||||
<></>
|
||||
@@ -503,7 +503,10 @@ const BookerComponent = ({
|
||||
visible={bookerState !== "booking" && layout === BookerLayouts.MONTH_VIEW}
|
||||
{...fadeInLeft}
|
||||
initial="visible"
|
||||
className={classNames("md:border-subtle -ml-px h-full shrink px-5 py-3 lg:w-(--booker-main-width)", hideEventTypeDetails ? "" : "md:border-l")}>
|
||||
className={classNames(
|
||||
"md:border-subtle -ml-px h-full shrink px-5 py-3 lg:w-(--booker-main-width)",
|
||||
hideEventTypeDetails ? "" : "md:border-l"
|
||||
)}>
|
||||
<DatePicker
|
||||
classNames={customClassNames?.datePickerCustomClassNames}
|
||||
event={event}
|
||||
@@ -539,7 +542,7 @@ const BookerComponent = ({
|
||||
className={classNames(
|
||||
"border-subtle rtl:border-default flex h-full w-full flex-col overflow-x-auto px-5 py-3 pb-0 rtl:border-r ltr:md:border-l",
|
||||
layout === BookerLayouts.MONTH_VIEW &&
|
||||
"h-full overflow-hidden md:w-(--booker-timeslots-width)",
|
||||
"h-full overflow-hidden md:w-(--booker-timeslots-width)",
|
||||
layout !== BookerLayouts.MONTH_VIEW && "sticky top-0"
|
||||
)}
|
||||
ref={timeslotsRef}
|
||||
|
||||
@@ -93,14 +93,23 @@ interface BookingDetailsSheetInnerProps {
|
||||
}
|
||||
|
||||
function useActiveSegment(bookingAuditEnabled: boolean) {
|
||||
const [activeSegment, setActiveSegmentInStore] = useBookingDetailsSheetStore((state) => [state.activeSegment, state.setActiveSegment]);
|
||||
const [activeSegment, setActiveSegmentInStore] = useBookingDetailsSheetStore((state) => [
|
||||
state.activeSegment,
|
||||
state.setActiveSegment,
|
||||
]);
|
||||
|
||||
const getDerivedActiveSegment = ({ activeSegment, bookingAuditEnabled }: { activeSegment: "info" | "history" | null, bookingAuditEnabled: boolean }) => {
|
||||
const getDerivedActiveSegment = ({
|
||||
activeSegment,
|
||||
bookingAuditEnabled,
|
||||
}: {
|
||||
activeSegment: "info" | "history" | null;
|
||||
bookingAuditEnabled: boolean;
|
||||
}) => {
|
||||
if (!bookingAuditEnabled && activeSegment === "history") {
|
||||
return "info";
|
||||
}
|
||||
return activeSegment ?? "info";
|
||||
}
|
||||
};
|
||||
|
||||
const derivedActiveSegment = getDerivedActiveSegment({ activeSegment, bookingAuditEnabled });
|
||||
|
||||
@@ -195,15 +204,15 @@ function BookingDetailsSheetInner({
|
||||
const recurringInfo =
|
||||
booking.recurringEventId && booking.eventType?.recurringEvent
|
||||
? {
|
||||
count: booking.eventType.recurringEvent.count,
|
||||
recurringEvent: booking.eventType.recurringEvent,
|
||||
}
|
||||
count: booking.eventType.recurringEvent.count,
|
||||
recurringEvent: booking.eventType.recurringEvent,
|
||||
}
|
||||
: null;
|
||||
|
||||
const customResponses = booking.responses
|
||||
? Object.entries(booking.responses as Record<string, unknown>)
|
||||
.filter(([fieldName]) => shouldShowFieldInCustomResponses(fieldName))
|
||||
.map(([question, answer]) => [question, answer] as [string, unknown])
|
||||
.filter(([fieldName]) => shouldShowFieldInCustomResponses(fieldName))
|
||||
.map(([question, answer]) => [question, answer] as [string, unknown])
|
||||
: [];
|
||||
|
||||
const reason = booking.assignmentReason?.[0];
|
||||
@@ -284,7 +293,10 @@ function BookingDetailsSheetInner({
|
||||
|
||||
{bookingAuditEnabled && (
|
||||
<SegmentedControl
|
||||
data={[{ value: "info", label: t("info") }, { value: "history", label: t("history") }]}
|
||||
data={[
|
||||
{ value: "info", label: t("info") },
|
||||
{ value: "history", label: t("history") },
|
||||
]}
|
||||
value={activeSegment}
|
||||
onChange={(value) => setActiveSegment(value)}
|
||||
/>
|
||||
|
||||
@@ -33,8 +33,8 @@ const useMoveToNextMonthOnNoAvailability = ({
|
||||
};
|
||||
}
|
||||
|
||||
const nonEmptyScheduleDaysInBrowsingMonth = nonEmptyScheduleDays.filter(
|
||||
(date) => dayjs(date).isSame(browsingDate, "month")
|
||||
const nonEmptyScheduleDaysInBrowsingMonth = nonEmptyScheduleDays.filter((date) =>
|
||||
dayjs(date).isSame(browsingDate, "month")
|
||||
);
|
||||
|
||||
const moveToNextMonthOnNoAvailability = () => {
|
||||
@@ -42,10 +42,7 @@ const useMoveToNextMonthOnNoAvailability = ({
|
||||
const browsingMonth = browsingDate.format("YYYY-MM");
|
||||
// Not meeting the criteria to move to next month
|
||||
// Has to be currentMonth and it must have all days unbookable
|
||||
if (
|
||||
currentMonth != browsingMonth ||
|
||||
nonEmptyScheduleDaysInBrowsingMonth.length
|
||||
) {
|
||||
if (currentMonth != browsingMonth || nonEmptyScheduleDaysInBrowsingMonth.length) {
|
||||
return;
|
||||
}
|
||||
onMonthChange(browsingDate.add(1, "month"));
|
||||
@@ -105,13 +102,12 @@ export const DatePicker = ({
|
||||
const nonEmptyScheduleDays = useNonEmptyScheduleDays(slots);
|
||||
const browsingDate = month ? dayjs(month) : dayjs().startOf("month");
|
||||
|
||||
const { moveToNextMonthOnNoAvailability } =
|
||||
useMoveToNextMonthOnNoAvailability({
|
||||
browsingDate,
|
||||
nonEmptyScheduleDays,
|
||||
onMonthChange,
|
||||
isLoading: isLoading ?? true,
|
||||
});
|
||||
const { moveToNextMonthOnNoAvailability } = useMoveToNextMonthOnNoAvailability({
|
||||
browsingDate,
|
||||
nonEmptyScheduleDays,
|
||||
onMonthChange,
|
||||
isLoading: isLoading ?? true,
|
||||
});
|
||||
moveToNextMonthOnNoAvailability();
|
||||
|
||||
// Determine if this is a compact sidebar view based on layout
|
||||
|
||||
@@ -45,7 +45,7 @@ export const LargeCalendar = ({
|
||||
|
||||
// HACK: force rerender when overlay events change
|
||||
// Sine we dont use react router here we need to force rerender (ATOM SUPPORT)
|
||||
useEffect(() => { }, [displayOverlay]);
|
||||
useEffect(() => {}, [displayOverlay]);
|
||||
|
||||
const overlayEventsForDate = useMemo(() => {
|
||||
if (!overlayEvents || !displayOverlay) return [];
|
||||
|
||||
@@ -39,12 +39,12 @@ export const SeatsAvailabilityText = ({
|
||||
count: availableSeats,
|
||||
})}`
|
||||
: isNearlyFull
|
||||
? t("seats_nearly_full")
|
||||
: isHalfFull
|
||||
? t("seats_half_full")
|
||||
: t("seats_available", {
|
||||
count: availableSeats,
|
||||
})}
|
||||
? t("seats_nearly_full")
|
||||
: isHalfFull
|
||||
? t("seats_half_full")
|
||||
: t("seats_available", {
|
||||
count: availableSeats,
|
||||
})}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
@@ -29,10 +29,7 @@ type TimezoneSelectProps = Omit<
|
||||
};
|
||||
|
||||
const WebTimezoneSelect: ComponentType<TimezoneSelectProps> = dynamic(
|
||||
() =>
|
||||
import("@calcom/web/modules/timezone/components/TimezoneSelect").then(
|
||||
(mod) => mod.TimezoneSelect
|
||||
),
|
||||
() => import("@calcom/web/modules/timezone/components/TimezoneSelect").then((mod) => mod.TimezoneSelect),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => <LoadingState />,
|
||||
@@ -104,9 +101,7 @@ export const SlotSelectionModalHeader = ({
|
||||
<span className="text-default text-sm">{formattedDate.fullDate}</span>
|
||||
</div>
|
||||
|
||||
{event && (
|
||||
<EventDetails event={event} blocks={[EventDetailBlocks.DURATION]} />
|
||||
)}
|
||||
{event && <EventDetails event={event} blocks={[EventDetailBlocks.DURATION]} />}
|
||||
|
||||
<div className="mb-0 flex items-center gap-2 text-default text-sm">
|
||||
<Icon name="globe" className="h-4 w-4 shrink-0 text-subtle" />
|
||||
|
||||
@@ -3,4 +3,4 @@ vi.mock("../DryRunMessage", () => ({
|
||||
DryRunMessage: ({ isEmbed }: { isEmbed: boolean }) => (
|
||||
<div data-testid="dry-run-message">Mock Dry Run Message</div>
|
||||
),
|
||||
}));
|
||||
}));
|
||||
@@ -110,7 +110,9 @@ export const EventMetaBlock = ({
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
<div className={classNames("relative z-10 max-w-full wrap-break-word", contentClassName)}>{children}</div>
|
||||
<div className={classNames("relative z-10 max-w-full wrap-break-word", contentClassName)}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { useQueryState } from "nuqs";
|
||||
|
||||
export function useActiveSegmentFromUrl() {
|
||||
return useQueryState<"info" | "history">("activeSegment", {
|
||||
defaultValue: "info",
|
||||
parse: (value) => {
|
||||
if (!value) return "info";
|
||||
if (value === "history") return "history";
|
||||
return "info";
|
||||
},
|
||||
});
|
||||
return useQueryState<"info" | "history">("activeSegment", {
|
||||
defaultValue: "info",
|
||||
parse: (value) => {
|
||||
if (!value) return "info";
|
||||
if (value === "history") return "history";
|
||||
return "info";
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -309,8 +309,8 @@ export const useBookings = ({ event, hashedLink, bookingForm, metadata, isBookin
|
||||
const validDuration = event.data?.isDynamic
|
||||
? duration || event.data?.length
|
||||
: duration && event.data?.metadata?.multipleDuration?.includes(duration)
|
||||
? duration
|
||||
: event.data?.length;
|
||||
? duration
|
||||
: event.data?.length;
|
||||
|
||||
if (isRescheduling) {
|
||||
sdkActionManager?.fire("rescheduleBookingSuccessful", {
|
||||
|
||||
@@ -20,19 +20,22 @@ export function useEventTypes() {
|
||||
const individualEvents = eventTypes.filter((el) => !el.team);
|
||||
|
||||
// Group team events by team
|
||||
const teamEventsMap = eventTypes.reduce((acc, event) => {
|
||||
if (!event.team) return acc;
|
||||
const teamEventsMap = eventTypes.reduce(
|
||||
(acc, event) => {
|
||||
if (!event.team) return acc;
|
||||
|
||||
const teamId = event.team.id;
|
||||
if (!acc[teamId]) {
|
||||
acc[teamId] = {
|
||||
teamName: event.team.name,
|
||||
events: [],
|
||||
};
|
||||
}
|
||||
acc[teamId].events.push(event);
|
||||
return acc;
|
||||
}, {} as Record<number, { teamName: string; events: typeof eventTypes }>);
|
||||
const teamId = event.team.id;
|
||||
if (!acc[teamId]) {
|
||||
acc[teamId] = {
|
||||
teamName: event.team.name,
|
||||
events: [],
|
||||
};
|
||||
}
|
||||
acc[teamId].events.push(event);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<number, { teamName: string; events: typeof eventTypes }>
|
||||
);
|
||||
|
||||
// Create flat array with section markers
|
||||
const flatArray: FacetedValue[] = [];
|
||||
|
||||
@@ -140,9 +140,12 @@ export const useSlots = (event: { id: number; length: number } | null) => {
|
||||
useEffect(() => {
|
||||
handleReserveSlot();
|
||||
|
||||
const interval = setInterval(() => {
|
||||
handleReserveSlot();
|
||||
}, parseInt(MINUTES_TO_BOOK) * 60 * 1000 - 2000);
|
||||
const interval = setInterval(
|
||||
() => {
|
||||
handleReserveSlot();
|
||||
},
|
||||
parseInt(MINUTES_TO_BOOK) * 60 * 1000 - 2000
|
||||
);
|
||||
|
||||
return () => {
|
||||
handleRemoveSlot();
|
||||
|
||||
@@ -237,8 +237,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
// Filter out organizer information if hideOrganizerEmail is true
|
||||
const sanitizedPreviousBooking =
|
||||
eventType.hideOrganizerEmail &&
|
||||
previousBooking &&
|
||||
previousBooking.rescheduledBy === bookingInfo.user?.email
|
||||
previousBooking &&
|
||||
previousBooking.rescheduledBy === bookingInfo.user?.email
|
||||
? { ...previousBooking, rescheduledBy: bookingInfo.user?.name }
|
||||
: previousBooking;
|
||||
|
||||
@@ -251,11 +251,11 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
hideBranding: isPlatformBooking
|
||||
? true
|
||||
: await shouldHideBrandingForEvent({
|
||||
eventTypeId: eventType.id,
|
||||
team: eventType?.parent?.team ?? eventType?.team,
|
||||
owner: eventType.users[0] ?? null,
|
||||
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
|
||||
}),
|
||||
eventTypeId: eventType.id,
|
||||
team: eventType?.parent?.team ?? eventType?.team,
|
||||
owner: eventType.users[0] ?? null,
|
||||
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
|
||||
}),
|
||||
profile,
|
||||
eventType,
|
||||
recurringBookings: await getRecurringBookings(bookingInfo.recurringEventId),
|
||||
|
||||
@@ -24,21 +24,18 @@ import type {
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
|
||||
type FilterableColumn = Extract<
|
||||
_FilterableColumn,
|
||||
{ type: Extract<FilterType, "ms" | "ss"> }
|
||||
>;
|
||||
type FilterableColumn = Extract<_FilterableColumn, { type: Extract<FilterType, "ms" | "ss"> }>;
|
||||
|
||||
type FilterableSelectColumn<T extends Extract<FilterType, "ms" | "ss">> =
|
||||
Extract<FilterableColumn, { type: T }>;
|
||||
type FilterableSelectColumn<T extends Extract<FilterType, "ms" | "ss">> = Extract<
|
||||
FilterableColumn,
|
||||
{ type: T }
|
||||
>;
|
||||
|
||||
type FilterValue<T extends Extract<FilterType, "ms" | "ss">> = ReturnType<
|
||||
typeof useFilterValue<T, FilterValueSchema<T>>
|
||||
>;
|
||||
|
||||
export type BaseSelectFilterOptionsProps<
|
||||
T extends Extract<FilterType, "ms" | "ss">
|
||||
> = {
|
||||
export type BaseSelectFilterOptionsProps<T extends Extract<FilterType, "ms" | "ss">> = {
|
||||
column: FilterableSelectColumn<T>;
|
||||
filterValueSchema: FilterValueSchema<T>;
|
||||
isOptionSelected: (filterValue: FilterValue<T> | undefined, optionValue: string | number) => boolean;
|
||||
@@ -87,9 +84,7 @@ function getSectionedOptions(options: FacetedValue[]) {
|
||||
return sectionedOptions;
|
||||
}
|
||||
|
||||
export function BaseSelectFilterOptions<
|
||||
T extends Extract<FilterType, "ms" | "ss">
|
||||
>({
|
||||
export function BaseSelectFilterOptions<T extends Extract<FilterType, "ms" | "ss">>({
|
||||
column,
|
||||
filterValueSchema,
|
||||
isOptionSelected,
|
||||
|
||||
@@ -30,7 +30,7 @@ const TestWrapper = () => {
|
||||
}, [table]);
|
||||
|
||||
return <ColumnVisibilityButton table={table} />;
|
||||
}
|
||||
};
|
||||
|
||||
describe("ColumnVisibilityButton", () => {
|
||||
beforeEach(() => {
|
||||
@@ -48,7 +48,9 @@ describe("ColumnVisibilityButton", () => {
|
||||
|
||||
await waitFor(() => {
|
||||
expect(tableRef).not.toBeNull();
|
||||
const allVisible = tableRef!.getAllLeafColumns().every((col: Column<{ a: number; b: number; c: number }, unknown>) => col.getIsVisible());
|
||||
const allVisible = tableRef!
|
||||
.getAllLeafColumns()
|
||||
.every((col: Column<{ a: number; b: number; c: number }, unknown>) => col.getIsVisible());
|
||||
expect(allVisible).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
|
||||
|
||||
import { forwardRef, useState } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
@@ -70,8 +70,8 @@ export const DateRangeFilter = ({
|
||||
forceCustomOnly
|
||||
? CUSTOM_PRESET
|
||||
: filterValue?.data.preset
|
||||
? compatiblePresets.find((o) => o.value === filterValue.data.preset) ?? DEFAULT_PRESET
|
||||
: DEFAULT_PRESET
|
||||
? (compatiblePresets.find((o) => o.value === filterValue.data.preset) ?? DEFAULT_PRESET)
|
||||
: DEFAULT_PRESET
|
||||
);
|
||||
|
||||
const convertTimestamp = useCallback(
|
||||
@@ -201,8 +201,8 @@ export const DateRangeFilter = ({
|
||||
range === "past"
|
||||
? currentDate.subtract(2, "year").toDate()
|
||||
: range === "future"
|
||||
? currentDate.toDate()
|
||||
: null
|
||||
? currentDate.toDate()
|
||||
: null
|
||||
}
|
||||
maxDate={range === "past" ? currentDate.toDate() : undefined}
|
||||
disabled={false}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import startCase from "lodash/startCase";
|
||||
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
@@ -8,7 +7,12 @@ import type { IconName } from "@calcom/ui/components/icon";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@calcom/ui/components/popover";
|
||||
|
||||
import { useFilterValue } from "@calcom/features/data-table/hooks";
|
||||
import { type FilterableColumn, type FilterValue, ZFilterValue, ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import {
|
||||
type FilterableColumn,
|
||||
type FilterValue,
|
||||
ZFilterValue,
|
||||
ColumnFilterType,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import {
|
||||
isSingleSelectFilterValue,
|
||||
isMultiSelectFilterValue,
|
||||
|
||||
@@ -48,7 +48,6 @@ export function FilterSegmentSelect({ shortLabel }: Props = {}) {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
|
||||
const submenuItems: SubmenuItem[] = [
|
||||
{
|
||||
iconName: "square-pen",
|
||||
@@ -144,12 +143,11 @@ export function FilterSegmentSelect({ shortLabel }: Props = {}) {
|
||||
}, [segments, t]);
|
||||
|
||||
if (!isSegmentEnabled) {
|
||||
|
||||
return(
|
||||
<Button color="secondary" StartIcon="list-filter" EndIcon="chevron-down" disabled>
|
||||
return (
|
||||
<Button color="secondary" StartIcon="list-filter" EndIcon="chevron-down" disabled>
|
||||
{t("segment")}
|
||||
</Button>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -193,7 +191,11 @@ export function FilterSegmentSelect({ shortLabel }: Props = {}) {
|
||||
submenuItems={items}
|
||||
segment={segment}
|
||||
onSelect={() => {
|
||||
if (selectedSegment && selectedSegment.type === segment.type && selectedSegment.id === segment.id) {
|
||||
if (
|
||||
selectedSegment &&
|
||||
selectedSegment.type === segment.type &&
|
||||
selectedSegment.id === segment.id
|
||||
) {
|
||||
clearAll();
|
||||
} else {
|
||||
if (segment.type === "system") {
|
||||
@@ -203,9 +205,9 @@ export function FilterSegmentSelect({ shortLabel }: Props = {}) {
|
||||
}
|
||||
}
|
||||
}}>
|
||||
{selectedSegment && selectedSegment.type === segment.type && selectedSegment.id === segment.id && (
|
||||
<Icon name="check" className="ml-3 h-4 w-4" />
|
||||
)}
|
||||
{selectedSegment &&
|
||||
selectedSegment.type === segment.type &&
|
||||
selectedSegment.id === segment.id && <Icon name="check" className="ml-3 h-4 w-4" />}
|
||||
<span className="ml-3">{segment.name}</span>
|
||||
</DropdownItemWithSubmenu>
|
||||
);
|
||||
|
||||
@@ -19,8 +19,7 @@ export function DueInvoiceBanner({ data }: DueInvoiceBannerProps) {
|
||||
const hasBlocking = blockingProrations.length > 0;
|
||||
|
||||
// Use Stripe invoice URL if available, otherwise fall back to billing settings
|
||||
const paymentUrl =
|
||||
displayProration.invoiceUrl ?? `/settings/teams/${displayProration.teamId}/billing`;
|
||||
const paymentUrl = displayProration.invoiceUrl ?? `/settings/teams/${displayProration.teamId}/billing`;
|
||||
|
||||
return (
|
||||
<TopBanner
|
||||
|
||||
@@ -72,13 +72,12 @@ const LicenseRequired = ({ children, as = "", ...rest }: LicenseRequiredProps) =
|
||||
export const withLicenseRequired =
|
||||
<T extends JSX.IntrinsicAttributes>(Component: ComponentType<T>) =>
|
||||
// eslint-disable-next-line react/display-name
|
||||
(hocProps: T) =>
|
||||
(
|
||||
<div>
|
||||
<LicenseRequired>
|
||||
<Component {...hocProps} />
|
||||
</LicenseRequired>
|
||||
</div>
|
||||
);
|
||||
(hocProps: T) => (
|
||||
<div>
|
||||
<LicenseRequired>
|
||||
<Component {...hocProps} />
|
||||
</LicenseRequired>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default LicenseRequired;
|
||||
@@ -38,13 +38,7 @@ import {
|
||||
import { Field, FieldLabel } from "@coss/ui/components/field";
|
||||
import { Form } from "@coss/ui/components/form";
|
||||
import { Input } from "@coss/ui/components/input";
|
||||
import {
|
||||
Select,
|
||||
SelectItem,
|
||||
SelectPopup,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@coss/ui/components/select";
|
||||
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "@coss/ui/components/select";
|
||||
import { ToggleGroup, Toggle } from "@coss/ui/components/toggle-group";
|
||||
|
||||
function CopyButton({ value }: { value: string }) {
|
||||
@@ -101,18 +95,10 @@ interface CouponFormValues {
|
||||
durationInMonths: number;
|
||||
}
|
||||
|
||||
const CreateANewLicenseKeyFormChild = ({
|
||||
session,
|
||||
}: {
|
||||
session: Ensure<SessionContextValue, "data">;
|
||||
}) => {
|
||||
const CreateANewLicenseKeyFormChild = ({ session }: { session: Ensure<SessionContextValue, "data"> }) => {
|
||||
const { t } = useLocale();
|
||||
const [serverErrorMessage, setServerErrorMessage] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
const [stripeCheckoutUrl, setStripeCheckoutUrl] = useState<string | null>(
|
||||
null
|
||||
);
|
||||
const [serverErrorMessage, setServerErrorMessage] = useState<string | null>(null);
|
||||
const [stripeCheckoutUrl, setStripeCheckoutUrl] = useState<string | null>(null);
|
||||
const [couponCode, setCouponCode] = useState<string | null>(null);
|
||||
const isAdmin = session.data.user.role === UserPermissionRole.ADMIN;
|
||||
|
||||
@@ -127,20 +113,15 @@ const CreateANewLicenseKeyFormChild = ({
|
||||
},
|
||||
});
|
||||
|
||||
const licenseMutation = trpc.viewer.admin.createSelfHostedLicense.useMutation(
|
||||
{
|
||||
onSuccess: async (values) => {
|
||||
showToast(
|
||||
"Success: We have created a stripe payment URL for this billing email",
|
||||
"success"
|
||||
);
|
||||
setStripeCheckoutUrl(values.stripeCheckoutUrl);
|
||||
},
|
||||
onError: async (err) => {
|
||||
setServerErrorMessage(err.message);
|
||||
},
|
||||
}
|
||||
);
|
||||
const licenseMutation = trpc.viewer.admin.createSelfHostedLicense.useMutation({
|
||||
onSuccess: async (values) => {
|
||||
showToast("Success: We have created a stripe payment URL for this billing email", "success");
|
||||
setStripeCheckoutUrl(values.stripeCheckoutUrl);
|
||||
},
|
||||
onError: async (err) => {
|
||||
setServerErrorMessage(err.message);
|
||||
},
|
||||
});
|
||||
|
||||
const watchedBillingPeriod = licenseForm.watch("billingPeriod");
|
||||
const watchedBillingEmail = licenseForm.watch("billingEmail");
|
||||
@@ -162,196 +143,184 @@ const CreateANewLicenseKeyFormChild = ({
|
||||
</CardFrameDescription>
|
||||
</CardFrameHeader>
|
||||
|
||||
{!stripeCheckoutUrl ? (
|
||||
<Card>
|
||||
<CardPanel>
|
||||
<Form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
licenseForm.handleSubmit((values) => {
|
||||
licenseMutation.mutate(values);
|
||||
})(event);
|
||||
}}
|
||||
>
|
||||
{serverErrorMessage && (
|
||||
<Alert variant="error">
|
||||
<AlertDescription>{serverErrorMessage}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{!stripeCheckoutUrl ? (
|
||||
<Card>
|
||||
<CardPanel>
|
||||
<Form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
licenseForm.handleSubmit((values) => {
|
||||
licenseMutation.mutate(values);
|
||||
})(event);
|
||||
}}>
|
||||
{serverErrorMessage && (
|
||||
<Alert variant="error">
|
||||
<AlertDescription>{serverErrorMessage}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<Controller
|
||||
name="billingPeriod"
|
||||
control={licenseForm.control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Billing Period</FieldLabel>
|
||||
<ToggleGroup
|
||||
className="w-full"
|
||||
variant="outline"
|
||||
value={[value]}
|
||||
onValueChange={(newValue) => {
|
||||
if (newValue.length > 0) onChange(newValue[0]);
|
||||
}}
|
||||
>
|
||||
<Toggle value="MONTHLY" className="flex-1">
|
||||
Monthly
|
||||
</Toggle>
|
||||
<Toggle value="ANNUALLY" className="flex-1">
|
||||
Annually
|
||||
</Toggle>
|
||||
</ToggleGroup>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="billingEmail"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: t("must_enter_billing_email") }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Billing Email for Customer</FieldLabel>
|
||||
<Input
|
||||
placeholder="[email protected]"
|
||||
disabled={!isAdmin}
|
||||
defaultValue={value}
|
||||
onChange={onChange}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="billingType"
|
||||
control={licenseForm.control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Booking Type</FieldLabel>
|
||||
<ToggleGroup
|
||||
className="w-full"
|
||||
variant="outline"
|
||||
value={[value]}
|
||||
onValueChange={(newValue) => {
|
||||
if (newValue.length > 0) onChange(newValue[0]);
|
||||
}}
|
||||
>
|
||||
<Toggle value="PER_BOOKING" className="flex-1">
|
||||
Per Booking
|
||||
</Toggle>
|
||||
<Toggle value="PER_USER" className="flex-1">
|
||||
Per User
|
||||
</Toggle>
|
||||
</ToggleGroup>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="flex flex-wrap gap-2 *:flex-1">
|
||||
<Controller
|
||||
name="entityCount"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: "Must enter a total of billable users" }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Total entities included</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
placeholder="100"
|
||||
defaultValue={value}
|
||||
onChange={(event) => onChange(+event.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="entityPrice"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: "Must enter fixed price per user" }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Fixed price per entity ($)</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
defaultValue={value / 100}
|
||||
onChange={(event) =>
|
||||
onChange(+event.target.value * 100)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Controller
|
||||
name="overages"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: "Must enter overages" }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Overages ($)</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
placeholder="0.99"
|
||||
disabled={!isAdmin}
|
||||
defaultValue={value / 100}
|
||||
onChange={(event) =>
|
||||
onChange(+event.target.value * 100)
|
||||
}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={
|
||||
licenseForm.formState.isSubmitting ||
|
||||
licenseMutation.isPending
|
||||
}
|
||||
className="w-full"
|
||||
>
|
||||
{t("continue")} - {calculateMonthlyPrice()}
|
||||
</Button>
|
||||
</Form>
|
||||
</CardPanel>
|
||||
</Card>
|
||||
) : (
|
||||
<Card>
|
||||
<CardPanel>
|
||||
<div className="flex flex-col gap-4">
|
||||
<Field>
|
||||
<FieldLabel>Checkout URL</FieldLabel>
|
||||
<div className="flex w-full items-center gap-1">
|
||||
<Input disabled value={stripeCheckoutUrl} className="min-w-0 flex-1" />
|
||||
<CopyButton value={stripeCheckoutUrl} />
|
||||
</div>
|
||||
</Field>
|
||||
{couponCode && (
|
||||
<Controller
|
||||
name="billingPeriod"
|
||||
control={licenseForm.control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Coupon Code</FieldLabel>
|
||||
<div className="flex w-full items-center gap-1">
|
||||
<Input disabled value={couponCode} className="min-w-0 flex-1" />
|
||||
<CopyButton value={couponCode} />
|
||||
</div>
|
||||
<FieldLabel>Billing Period</FieldLabel>
|
||||
<ToggleGroup
|
||||
className="w-full"
|
||||
variant="outline"
|
||||
value={[value]}
|
||||
onValueChange={(newValue) => {
|
||||
if (newValue.length > 0) onChange(newValue[0]);
|
||||
}}>
|
||||
<Toggle value="MONTHLY" className="flex-1">
|
||||
Monthly
|
||||
</Toggle>
|
||||
<Toggle value="ANNUALLY" className="flex-1">
|
||||
Annually
|
||||
</Toggle>
|
||||
</ToggleGroup>
|
||||
</Field>
|
||||
)}
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="w-full"
|
||||
onClick={() => {
|
||||
licenseForm.reset();
|
||||
setStripeCheckoutUrl(null);
|
||||
setCouponCode(null);
|
||||
}}
|
||||
>
|
||||
Back
|
||||
</Button>
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="billingEmail"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: t("must_enter_billing_email") }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Billing Email for Customer</FieldLabel>
|
||||
<Input
|
||||
placeholder="[email protected]"
|
||||
disabled={!isAdmin}
|
||||
defaultValue={value}
|
||||
onChange={onChange}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="billingType"
|
||||
control={licenseForm.control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Booking Type</FieldLabel>
|
||||
<ToggleGroup
|
||||
className="w-full"
|
||||
variant="outline"
|
||||
value={[value]}
|
||||
onValueChange={(newValue) => {
|
||||
if (newValue.length > 0) onChange(newValue[0]);
|
||||
}}>
|
||||
<Toggle value="PER_BOOKING" className="flex-1">
|
||||
Per Booking
|
||||
</Toggle>
|
||||
<Toggle value="PER_USER" className="flex-1">
|
||||
Per User
|
||||
</Toggle>
|
||||
</ToggleGroup>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="flex flex-wrap gap-2 *:flex-1">
|
||||
<Controller
|
||||
name="entityCount"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: "Must enter a total of billable users" }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Total entities included</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
placeholder="100"
|
||||
defaultValue={value}
|
||||
onChange={(event) => onChange(+event.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
name="entityPrice"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: "Must enter fixed price per user" }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Fixed price per entity ($)</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
defaultValue={value / 100}
|
||||
onChange={(event) => onChange(+event.target.value * 100)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</CardPanel>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<Controller
|
||||
name="overages"
|
||||
control={licenseForm.control}
|
||||
rules={{ required: "Must enter overages" }}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Overages ($)</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
placeholder="0.99"
|
||||
disabled={!isAdmin}
|
||||
defaultValue={value / 100}
|
||||
onChange={(event) => onChange(+event.target.value * 100)}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={licenseForm.formState.isSubmitting || licenseMutation.isPending}
|
||||
className="w-full">
|
||||
{t("continue")} - {calculateMonthlyPrice()}
|
||||
</Button>
|
||||
</Form>
|
||||
</CardPanel>
|
||||
</Card>
|
||||
) : (
|
||||
<Card>
|
||||
<CardPanel>
|
||||
<div className="flex flex-col gap-4">
|
||||
<Field>
|
||||
<FieldLabel>Checkout URL</FieldLabel>
|
||||
<div className="flex w-full items-center gap-1">
|
||||
<Input disabled value={stripeCheckoutUrl} className="min-w-0 flex-1" />
|
||||
<CopyButton value={stripeCheckoutUrl} />
|
||||
</div>
|
||||
</Field>
|
||||
{couponCode && (
|
||||
<Field>
|
||||
<FieldLabel>Coupon Code</FieldLabel>
|
||||
<div className="flex w-full items-center gap-1">
|
||||
<Input disabled value={couponCode} className="min-w-0 flex-1" />
|
||||
<CopyButton value={couponCode} />
|
||||
</div>
|
||||
</Field>
|
||||
)}
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="w-full"
|
||||
onClick={() => {
|
||||
licenseForm.reset();
|
||||
setStripeCheckoutUrl(null);
|
||||
setCouponCode(null);
|
||||
}}>
|
||||
Back
|
||||
</Button>
|
||||
</div>
|
||||
</CardPanel>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<CardFrameFooter>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
@@ -427,8 +396,7 @@ function CreateCouponDialog({
|
||||
type="button"
|
||||
className="cursor-pointer font-medium text-foreground underline underline-offset-2"
|
||||
/>
|
||||
}
|
||||
>
|
||||
}>
|
||||
Create a coupon
|
||||
</DialogTrigger>
|
||||
<DialogPopup className="sm:max-w-md">
|
||||
@@ -441,13 +409,11 @@ function CreateCouponDialog({
|
||||
setCouponResult(null);
|
||||
couponMutation.mutate(values);
|
||||
})(event);
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Create Coupon</DialogTitle>
|
||||
<DialogDescription>
|
||||
Create a Stripe coupon with a promotion code restricted to a
|
||||
specific customer.
|
||||
Create a Stripe coupon with a promotion code restricted to a specific customer.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogPanel className="flex flex-col gap-4">
|
||||
@@ -478,11 +444,7 @@ function CreateCouponDialog({
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Coupon Name (optional)</FieldLabel>
|
||||
<Input
|
||||
placeholder="e.g. ACME Corp Discount"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
<Input placeholder="e.g. ACME Corp Discount" value={value} onChange={onChange} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
@@ -512,12 +474,7 @@ function CreateCouponDialog({
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>Promo Code</FieldLabel>
|
||||
<Input
|
||||
placeholder="e.g. ACME50OFF"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
required
|
||||
/>
|
||||
<Input placeholder="e.g. ACME50OFF" value={value} onChange={onChange} required />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
@@ -534,8 +491,7 @@ function CreateCouponDialog({
|
||||
value={[value]}
|
||||
onValueChange={(newValue) => {
|
||||
if (newValue.length > 0) onChange(newValue[0]);
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<Toggle value="percent" className="flex-1">
|
||||
Percentage
|
||||
</Toggle>
|
||||
@@ -554,10 +510,7 @@ function CreateCouponDialog({
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Field>
|
||||
<FieldLabel>
|
||||
Discount Amount{" "}
|
||||
{couponForm.watch("discountType") === "percent"
|
||||
? "(%)"
|
||||
: "(cents)"}
|
||||
Discount Amount {couponForm.watch("discountType") === "percent" ? "(%)" : "(cents)"}
|
||||
</FieldLabel>
|
||||
<Input
|
||||
type="number"
|
||||
@@ -583,8 +536,7 @@ function CreateCouponDialog({
|
||||
value={value}
|
||||
onValueChange={(newValue) => {
|
||||
if (newValue) onChange(newValue);
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select duration" />
|
||||
</SelectTrigger>
|
||||
@@ -624,15 +576,8 @@ function CreateCouponDialog({
|
||||
)}
|
||||
</DialogPanel>
|
||||
<DialogFooter variant="bare">
|
||||
<DialogClose render={<Button variant="ghost" />}>
|
||||
Cancel
|
||||
</DialogClose>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={
|
||||
couponForm.formState.isSubmitting || couponMutation.isPending
|
||||
}
|
||||
>
|
||||
<DialogClose render={<Button variant="ghost" />}>Cancel</DialogClose>
|
||||
<Button type="submit" disabled={couponForm.formState.isSubmitting || couponMutation.isPending}>
|
||||
Create Coupon
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -3,14 +3,10 @@ import { DataTableSelectionBar } from "~/data-table/components";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import {
|
||||
DialogTrigger,
|
||||
ConfirmationDialogContent,
|
||||
} from "@calcom/ui/components/dialog";
|
||||
import { DialogTrigger, ConfirmationDialogContent } from "@calcom/ui/components/dialog";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
type BlocklistEntry =
|
||||
RouterOutputs["viewer"]["admin"]["watchlist"]["list"]["rows"][number];
|
||||
type BlocklistEntry = RouterOutputs["viewer"]["admin"]["watchlist"]["list"]["rows"][number];
|
||||
|
||||
interface Props {
|
||||
entries: BlocklistEntry[];
|
||||
@@ -21,26 +17,24 @@ export function BulkDeleteBlocklistEntries({ entries, onRemove }: Props) {
|
||||
const { t } = useLocale();
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
const bulkDeleteMutation = trpc.viewer.admin.watchlist.bulkDelete.useMutation(
|
||||
{
|
||||
onSuccess: async (data) => {
|
||||
await utils.viewer.admin.watchlist.list.invalidate();
|
||||
showToast(
|
||||
data.failed === 0
|
||||
? t("entries_deleted_successfully", { count: data.success })
|
||||
: t("entries_deleted_with_errors", {
|
||||
success: data.success,
|
||||
failed: data.failed,
|
||||
}),
|
||||
data.failed === 0 ? "success" : "warning"
|
||||
);
|
||||
onRemove();
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
}
|
||||
);
|
||||
const bulkDeleteMutation = trpc.viewer.admin.watchlist.bulkDelete.useMutation({
|
||||
onSuccess: async (data) => {
|
||||
await utils.viewer.admin.watchlist.list.invalidate();
|
||||
showToast(
|
||||
data.failed === 0
|
||||
? t("entries_deleted_successfully", { count: data.success })
|
||||
: t("entries_deleted_with_errors", {
|
||||
success: data.success,
|
||||
failed: data.failed,
|
||||
}),
|
||||
data.failed === 0 ? "success" : "warning"
|
||||
);
|
||||
onRemove();
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Dialog>
|
||||
@@ -58,11 +52,8 @@ export function BulkDeleteBlocklistEntries({ entries, onRemove }: Props) {
|
||||
bulkDeleteMutation.mutate({
|
||||
ids: entries.map((entry) => entry.id),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<p className="mt-5">
|
||||
{t("remove_entries_confirm", { count: entries.length })}
|
||||
</p>
|
||||
}}>
|
||||
<p className="mt-5">{t("remove_entries_confirm", { count: entries.length })}</p>
|
||||
</ConfirmationDialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@@ -3,14 +3,10 @@ import { DataTableSelectionBar } from "~/data-table/components";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import {
|
||||
DialogTrigger,
|
||||
ConfirmationDialogContent,
|
||||
} from "@calcom/ui/components/dialog";
|
||||
import { DialogTrigger, ConfirmationDialogContent } from "@calcom/ui/components/dialog";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
type BookingReport =
|
||||
RouterOutputs["viewer"]["admin"]["watchlist"]["listReports"]["rows"][number];
|
||||
type BookingReport = RouterOutputs["viewer"]["admin"]["watchlist"]["listReports"]["rows"][number];
|
||||
|
||||
interface Props {
|
||||
reports: BookingReport[];
|
||||
@@ -21,26 +17,25 @@ export function BulkDismissReports({ reports, onRemove }: Props) {
|
||||
const { t } = useLocale();
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
const bulkDismissMutation =
|
||||
trpc.viewer.admin.watchlist.bulkDismiss.useMutation({
|
||||
onSuccess: async (data) => {
|
||||
await utils.viewer.admin.watchlist.listReports.invalidate();
|
||||
await utils.viewer.admin.watchlist.pendingReportsCount.invalidate();
|
||||
showToast(
|
||||
data.failed === 0
|
||||
? t("reports_dismissed_successfully", { count: data.success })
|
||||
: t("reports_dismissed_with_errors", {
|
||||
success: data.success,
|
||||
failed: data.failed,
|
||||
}),
|
||||
data.failed === 0 ? "success" : "warning"
|
||||
);
|
||||
onRemove();
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
const bulkDismissMutation = trpc.viewer.admin.watchlist.bulkDismiss.useMutation({
|
||||
onSuccess: async (data) => {
|
||||
await utils.viewer.admin.watchlist.listReports.invalidate();
|
||||
await utils.viewer.admin.watchlist.pendingReportsCount.invalidate();
|
||||
showToast(
|
||||
data.failed === 0
|
||||
? t("reports_dismissed_successfully", { count: data.success })
|
||||
: t("reports_dismissed_with_errors", {
|
||||
success: data.success,
|
||||
failed: data.failed,
|
||||
}),
|
||||
data.failed === 0 ? "success" : "warning"
|
||||
);
|
||||
onRemove();
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Dialog>
|
||||
@@ -58,11 +53,8 @@ export function BulkDismissReports({ reports, onRemove }: Props) {
|
||||
bulkDismissMutation.mutate({
|
||||
emails: reports.map((group) => group.bookerEmail),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<p className="mt-5">
|
||||
{t("dismiss_reports_confirm", { count: reports.length })}
|
||||
</p>
|
||||
}}>
|
||||
<p className="mt-5">{t("dismiss_reports_confirm", { count: reports.length })}</p>
|
||||
</ConfirmationDialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@@ -41,32 +41,28 @@ function SystemBlocklistContent() {
|
||||
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
const { data: blockedData, isPending: isBlockedPending } =
|
||||
trpc.viewer.admin.watchlist.list.useQuery(
|
||||
{ limit, offset, searchTerm },
|
||||
{ placeholderData: keepPreviousData, enabled: activeView === "blocked" }
|
||||
);
|
||||
const { data: blockedData, isPending: isBlockedPending } = trpc.viewer.admin.watchlist.list.useQuery(
|
||||
{ limit, offset, searchTerm },
|
||||
{ placeholderData: keepPreviousData, enabled: activeView === "blocked" }
|
||||
);
|
||||
|
||||
const { data: reportsData, isPending: isReportsPending } =
|
||||
trpc.viewer.admin.watchlist.listReports.useQuery(
|
||||
{
|
||||
limit,
|
||||
offset,
|
||||
searchTerm,
|
||||
sortBy,
|
||||
systemFilters: { systemStatus: ["PENDING"] },
|
||||
},
|
||||
{ placeholderData: keepPreviousData, enabled: activeView === "pending" }
|
||||
);
|
||||
const { data: reportsData, isPending: isReportsPending } = trpc.viewer.admin.watchlist.listReports.useQuery(
|
||||
{
|
||||
limit,
|
||||
offset,
|
||||
searchTerm,
|
||||
sortBy,
|
||||
systemFilters: { systemStatus: ["PENDING"] },
|
||||
},
|
||||
{ placeholderData: keepPreviousData, enabled: activeView === "pending" }
|
||||
);
|
||||
|
||||
const { data: pendingReportsCount } =
|
||||
trpc.viewer.admin.watchlist.pendingReportsCount.useQuery();
|
||||
const { data: pendingReportsCount } = trpc.viewer.admin.watchlist.pendingReportsCount.useQuery();
|
||||
|
||||
const { data: entryDetails, isLoading: isDetailsLoading } =
|
||||
trpc.viewer.admin.watchlist.getDetails.useQuery(
|
||||
{ id: selectedEntryId ?? "" },
|
||||
{ enabled: !!selectedEntryId }
|
||||
);
|
||||
const { data: entryDetails, isLoading: isDetailsLoading } = trpc.viewer.admin.watchlist.getDetails.useQuery(
|
||||
{ id: selectedEntryId ?? "" },
|
||||
{ enabled: !!selectedEntryId }
|
||||
);
|
||||
|
||||
const createEntry = trpc.viewer.admin.watchlist.create.useMutation({
|
||||
onSuccess: async () => {
|
||||
@@ -90,19 +86,17 @@ function SystemBlocklistContent() {
|
||||
},
|
||||
});
|
||||
|
||||
const addToWatchlist = trpc.viewer.admin.watchlist.addToWatchlist.useMutation(
|
||||
{
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.admin.watchlist.listReports.invalidate();
|
||||
await utils.viewer.admin.watchlist.list.invalidate();
|
||||
await utils.viewer.admin.watchlist.pendingReportsCount.invalidate();
|
||||
showToast(t("system_blocklist_entry_created"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
}
|
||||
);
|
||||
const addToWatchlist = trpc.viewer.admin.watchlist.addToWatchlist.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.admin.watchlist.listReports.invalidate();
|
||||
await utils.viewer.admin.watchlist.list.invalidate();
|
||||
await utils.viewer.admin.watchlist.pendingReportsCount.invalidate();
|
||||
showToast(t("system_blocklist_entry_created"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
|
||||
const dismissReport = trpc.viewer.admin.watchlist.dismissReport.useMutation({
|
||||
onSuccess: async () => {
|
||||
@@ -168,11 +162,7 @@ function SystemBlocklistContent() {
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{activeView === "blocked" && (
|
||||
<Button
|
||||
color="primary"
|
||||
StartIcon="plus"
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
>
|
||||
<Button color="primary" StartIcon="plus" onClick={() => setShowCreateModal(true)}>
|
||||
{t("add")}
|
||||
</Button>
|
||||
)}
|
||||
@@ -195,10 +185,7 @@ function SystemBlocklistContent() {
|
||||
onSelectEntry={setSelectedEntryId}
|
||||
enableRowSelection
|
||||
renderBulkActions={(selectedEntries, clearSelection) => (
|
||||
<BulkDeleteBlocklistEntries
|
||||
entries={selectedEntries}
|
||||
onRemove={clearSelection}
|
||||
/>
|
||||
<BulkDeleteBlocklistEntries entries={selectedEntries} onRemove={clearSelection} />
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
@@ -208,20 +195,13 @@ function SystemBlocklistContent() {
|
||||
totalRowCount={reportsData?.meta?.totalRowCount ?? 0}
|
||||
isPending={isReportsPending}
|
||||
limit={limit}
|
||||
onAddToBlocklist={(email, type, onSuccess) =>
|
||||
addToWatchlist.mutate({ email, type }, { onSuccess })
|
||||
}
|
||||
onDismiss={(email, onSuccess) =>
|
||||
dismissReport.mutate({ email }, { onSuccess })
|
||||
}
|
||||
onAddToBlocklist={(email, type, onSuccess) => addToWatchlist.mutate({ email, type }, { onSuccess })}
|
||||
onDismiss={(email, onSuccess) => dismissReport.mutate({ email }, { onSuccess })}
|
||||
isAddingToBlocklist={addToWatchlist.isPending}
|
||||
isDismissing={dismissReport.isPending}
|
||||
enableRowSelection
|
||||
renderBulkActions={(selectedReports, clearSelection) => (
|
||||
<BulkDismissReports
|
||||
reports={selectedReports}
|
||||
onRemove={clearSelection}
|
||||
/>
|
||||
<BulkDismissReports reports={selectedReports} onRemove={clearSelection} />
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -267,7 +267,6 @@ const OtherTeamProfileView = () => {
|
||||
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via markdownToSafeHTML */}
|
||||
<div
|
||||
className=" text-subtle wrap-break-word text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
|
||||
|
||||
dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(team.bio) }}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -63,8 +63,7 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
{ placeholderData: keepPreviousData, enabled: activeView === "pending" }
|
||||
);
|
||||
|
||||
const { data: pendingReportsCount } =
|
||||
trpc.viewer.organizations.pendingReportsCount.useQuery();
|
||||
const { data: pendingReportsCount } = trpc.viewer.organizations.pendingReportsCount.useQuery();
|
||||
|
||||
const { data: entryDetails, isLoading: isDetailsLoading } =
|
||||
trpc.viewer.organizations.getWatchlistEntryDetails.useQuery(
|
||||
@@ -72,29 +71,27 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
{ enabled: !!selectedEntryId }
|
||||
);
|
||||
|
||||
const createEntry =
|
||||
trpc.viewer.organizations.createWatchlistEntry.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.organizations.listWatchlistEntries.invalidate();
|
||||
showToast(t("blocklist_entry_created"), "success");
|
||||
setShowCreateModal(false);
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
const createEntry = trpc.viewer.organizations.createWatchlistEntry.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.organizations.listWatchlistEntries.invalidate();
|
||||
showToast(t("blocklist_entry_created"), "success");
|
||||
setShowCreateModal(false);
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
|
||||
const deleteEntry =
|
||||
trpc.viewer.organizations.deleteWatchlistEntry.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.organizations.listWatchlistEntries.invalidate();
|
||||
setSelectedEntryId(null);
|
||||
showToast(t("blocklist_entry_deleted"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
const deleteEntry = trpc.viewer.organizations.deleteWatchlistEntry.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.organizations.listWatchlistEntries.invalidate();
|
||||
setSelectedEntryId(null);
|
||||
showToast(t("blocklist_entry_deleted"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
|
||||
const addToWatchlist = trpc.viewer.organizations.addToWatchlist.useMutation({
|
||||
onSuccess: async () => {
|
||||
@@ -108,17 +105,16 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
},
|
||||
});
|
||||
|
||||
const dismissReport =
|
||||
trpc.viewer.organizations.dismissBookingReport.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.organizations.listBookingReports.invalidate();
|
||||
await utils.viewer.organizations.pendingReportsCount.invalidate();
|
||||
showToast(t("booking_report_dismissed"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
const dismissReport = trpc.viewer.organizations.dismissBookingReport.useMutation({
|
||||
onSuccess: async () => {
|
||||
await utils.viewer.organizations.listBookingReports.invalidate();
|
||||
await utils.viewer.organizations.pendingReportsCount.invalidate();
|
||||
showToast(t("booking_report_dismissed"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message, "error");
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -173,11 +169,7 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{permissions?.canCreate && (
|
||||
<Button
|
||||
color="primary"
|
||||
StartIcon="plus"
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
>
|
||||
<Button color="primary" StartIcon="plus" onClick={() => setShowCreateModal(true)}>
|
||||
{t("add")}
|
||||
</Button>
|
||||
)}
|
||||
@@ -207,12 +199,8 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
totalRowCount={reportsData?.meta?.totalRowCount ?? 0}
|
||||
isPending={isReportsPending}
|
||||
limit={limit}
|
||||
onAddToBlocklist={(email, type, onSuccess) =>
|
||||
addToWatchlist.mutate({ email, type }, { onSuccess })
|
||||
}
|
||||
onDismiss={(email, onSuccess) =>
|
||||
dismissReport.mutate({ email }, { onSuccess })
|
||||
}
|
||||
onAddToBlocklist={(email, type, onSuccess) => addToWatchlist.mutate({ email, type }, { onSuccess })}
|
||||
onDismiss={(email, onSuccess) => dismissReport.mutate({ email }, { onSuccess })}
|
||||
isAddingToBlocklist={addToWatchlist.isPending}
|
||||
isDismissing={dismissReport.isPending}
|
||||
/>
|
||||
|
||||
@@ -25,10 +25,7 @@ import { Form } from "@calcom/ui/components/form";
|
||||
import { Label } from "@calcom/ui/components/form";
|
||||
import { TextField } from "@calcom/ui/components/form";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
import {
|
||||
BannerUploader,
|
||||
ImageUploader,
|
||||
} from "@calcom/ui/components/image-uploader";
|
||||
import { BannerUploader, ImageUploader } from "@calcom/ui/components/image-uploader";
|
||||
// if I include this in the above barrel import, I get a runtime error that the component is not exported.
|
||||
import { OrgBanner } from "@calcom/ui/components/organization-banner";
|
||||
import {
|
||||
@@ -136,8 +133,7 @@ const OrgProfileView = ({
|
||||
calVideoLogo: currentOrganisation?.calVideoLogo || "",
|
||||
slug:
|
||||
currentOrganisation?.slug ||
|
||||
((currentOrganisation?.metadata as Prisma.JsonObject)
|
||||
?.requestedSlug as string) ||
|
||||
((currentOrganisation?.metadata as Prisma.JsonObject)?.requestedSlug as string) ||
|
||||
"",
|
||||
};
|
||||
|
||||
@@ -153,12 +149,8 @@ const OrgProfileView = ({
|
||||
<div className="border-subtle flex rounded-b-md border border-t-0 px-4 py-8 sm:px-6">
|
||||
<div className="grow">
|
||||
<div>
|
||||
<Label className="text-emphasis">
|
||||
{t("organization_name")}
|
||||
</Label>
|
||||
<p className="text-default text-sm">
|
||||
{currentOrganisation?.name}
|
||||
</p>
|
||||
<Label className="text-emphasis">{t("organization_name")}</Label>
|
||||
<p className="text-default text-sm">{currentOrganisation?.name}</p>
|
||||
</div>
|
||||
{!isBioEmpty && (
|
||||
<>
|
||||
@@ -179,8 +171,7 @@ const OrgProfileView = ({
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(orgBranding.fullDomain);
|
||||
showToast("Copied to clipboard", "success");
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{t("copy_link_org")}
|
||||
</LinkIconButton>
|
||||
</div>
|
||||
@@ -205,10 +196,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
const mutation = trpc.viewer.organizations.update.useMutation({
|
||||
onError: (err) => {
|
||||
// Handle JSON parsing errors from body size limit exceeded
|
||||
if (
|
||||
err.message.includes("Unexpected token") &&
|
||||
err.message.includes("Body excee")
|
||||
) {
|
||||
if (err.message.includes("Unexpected token") && err.message.includes("Body excee")) {
|
||||
showToast(t("converted_image_size_limit_exceed"), "error");
|
||||
return;
|
||||
}
|
||||
@@ -258,8 +246,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
};
|
||||
|
||||
mutation.mutate(variables);
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<div className="border-subtle border-x px-4 py-8 sm:px-6">
|
||||
<div className="grid grid-cols-2 gap-8">
|
||||
<Controller
|
||||
@@ -272,10 +259,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
<Avatar
|
||||
data-testid="profile-upload-logo"
|
||||
alt={form.getValues("name")}
|
||||
imageSrc={getPlaceholderAvatar(
|
||||
value,
|
||||
form.getValues("name")
|
||||
)}
|
||||
imageSrc={getPlaceholderAvatar(value, form.getValues("name"))}
|
||||
size="lg"
|
||||
/>
|
||||
<div>
|
||||
@@ -285,10 +269,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
id="avatar-upload"
|
||||
buttonMsg={t("upload_logo")}
|
||||
handleAvatarChange={onChange}
|
||||
imageSrc={getPlaceholderAvatar(
|
||||
value,
|
||||
form.getValues("name")
|
||||
)}
|
||||
imageSrc={getPlaceholderAvatar(value, form.getValues("name"))}
|
||||
triggerButtonColor="secondary"
|
||||
/>
|
||||
{showRemoveLogoButton && (
|
||||
@@ -312,9 +293,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
<Avatar
|
||||
alt="calVideoLogo"
|
||||
imageSrc={value}
|
||||
fallback={
|
||||
<Icon name="plus" className="text-subtle h-6 w-6" />
|
||||
}
|
||||
fallback={<Icon name="plus" className="text-subtle h-6 w-6" />}
|
||||
size="lg"
|
||||
/>
|
||||
<div>
|
||||
@@ -325,9 +304,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
buttonMsg={t("upload_cal_video_logo")}
|
||||
handleAvatarChange={onChange}
|
||||
imageSrc={value || undefined}
|
||||
uploadInstruction={t(
|
||||
"cal_video_logo_upload_instruction"
|
||||
)}
|
||||
uploadInstruction={t("cal_video_logo_upload_instruction")}
|
||||
triggerButtonColor="secondary"
|
||||
testId="cal-video-logo"
|
||||
/>
|
||||
@@ -360,9 +337,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
fallback={
|
||||
!value ? (
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
<p className="text-muted text-sm">
|
||||
{t("no_target", { target: "banner" })}
|
||||
</p>
|
||||
<p className="text-muted text-sm">{t("no_target", { target: "banner" })}</p>
|
||||
<div className="hidden">
|
||||
<BannerUploader
|
||||
height={500}
|
||||
@@ -477,8 +452,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
size="sm"
|
||||
type="button"
|
||||
aria-label="copy organization id"
|
||||
onClick={() => handleCopy(value.toString())}
|
||||
>
|
||||
onClick={() => handleCopy(value.toString())}>
|
||||
<Icon name="copy" className="ml-1 h-4 w-4" />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
@@ -491,9 +465,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
<Label>{t("about")}</Label>
|
||||
<Editor
|
||||
getText={() => md.render(form.getValues("bio") || "")}
|
||||
setText={(value: string) =>
|
||||
form.setValue("bio", turndown(value), { shouldDirty: true })
|
||||
}
|
||||
setText={(value: string) => form.setValue("bio", turndown(value), { shouldDirty: true })}
|
||||
excludedToolbarItems={["blockType"]}
|
||||
disableLists
|
||||
firstRender={firstRender}
|
||||
@@ -509,8 +481,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => {
|
||||
color="primary"
|
||||
type="submit"
|
||||
loading={mutation.isPending}
|
||||
disabled={isDisabled}
|
||||
>
|
||||
disabled={isDisabled}>
|
||||
{t("update")}
|
||||
</Button>
|
||||
</SectionBottomActions>
|
||||
|
||||
@@ -7,7 +7,10 @@ import { useState } from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { uuid } from "short-uuid";
|
||||
|
||||
import { deriveOrgNameFromEmail, deriveSlugFromEmail } from "~/ee/organizations/components/CreateANewOrganizationForm";
|
||||
import {
|
||||
deriveOrgNameFromEmail,
|
||||
deriveSlugFromEmail,
|
||||
} from "~/ee/organizations/components/CreateANewOrganizationForm";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
import { UserPermissionRole } from "@calcom/prisma/enums";
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function PostHogPageView() {
|
||||
const posthog = usePostHog();
|
||||
|
||||
useEffect(() => {
|
||||
const shouldTrack = TRACKED_ROUTES.some(route => pathname?.startsWith(route));
|
||||
const shouldTrack = TRACKED_ROUTES.some((route) => pathname?.startsWith(route));
|
||||
|
||||
if (!shouldTrack) return;
|
||||
|
||||
|
||||
@@ -11,9 +11,8 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const host = process.env.NEXT_PUBLIC_FRESHCHAT_HOST;
|
||||
|
||||
|
||||
const token = process.env.NEXT_PUBLIC_FRESHCHAT_TOKEN;
|
||||
|
||||
export const isFreshChatEnabled =
|
||||
|
||||
@@ -20,7 +20,6 @@ export default function HelpscoutMenuItem(props: HelpscoutMenuItemProps) {
|
||||
onHelpItemSelect();
|
||||
}
|
||||
|
||||
|
||||
if (!process.env.NEXT_PUBLIC_HELPSCOUT_KEY) return null;
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useState } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
|
||||
const ZENDESK_KEY = process.env.NEXT_PUBLIC_ZENDESK_KEY;
|
||||
|
||||
interface ZendeskMenuItemProps {
|
||||
|
||||
@@ -12,13 +12,7 @@ import { Avatar } from "@calcom/ui/components/avatar";
|
||||
import { Form } from "@calcom/ui/components/form";
|
||||
import { ToggleGroup, Select } from "@calcom/ui/components/form";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
import {
|
||||
Sheet,
|
||||
SheetContent,
|
||||
SheetFooter,
|
||||
SheetHeader,
|
||||
SheetBody,
|
||||
} from "@calcom/ui/components/sheet";
|
||||
import { Sheet, SheetContent, SheetFooter, SheetHeader, SheetBody } from "@calcom/ui/components/sheet";
|
||||
import { Skeleton, Loader } from "@calcom/ui/components/skeleton";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
import { Tooltip } from "@calcom/ui/components/tooltip";
|
||||
@@ -56,9 +50,7 @@ export function EditMemberSheet({
|
||||
(state) => [state.editMode, state.setEditMode, state.setMutationLoading],
|
||||
shallow
|
||||
);
|
||||
const [role, setRole] = useState<string>(
|
||||
selectedUser.customRoleId || selectedUser.role
|
||||
);
|
||||
const [role, setRole] = useState<string>(selectedUser.customRoleId || selectedUser.role);
|
||||
const name =
|
||||
selectedUser.name ||
|
||||
(() => {
|
||||
@@ -69,19 +61,16 @@ export function EditMemberSheet({
|
||||
const bookerUrl = selectedUser.bookerUrl;
|
||||
const utils = trpc.useUtils();
|
||||
const bookerUrlWithoutProtocol = bookerUrl.replace(/^https?:\/\//, "");
|
||||
const bookingLink = selectedUser.username
|
||||
? `${bookerUrlWithoutProtocol}/${selectedUser.username}`
|
||||
: "";
|
||||
const bookingLink = selectedUser.username ? `${bookerUrlWithoutProtocol}/${selectedUser.username}` : "";
|
||||
|
||||
// Load custom roles for the team
|
||||
const { data: customRoles, isPending: isLoadingRoles } =
|
||||
trpc.viewer.pbac.getTeamRoles.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
enabled: !!teamId,
|
||||
retry: false, // Don't retry if PBAC is not enabled
|
||||
}
|
||||
);
|
||||
const { data: customRoles, isPending: isLoadingRoles } = trpc.viewer.pbac.getTeamRoles.useQuery(
|
||||
{ teamId },
|
||||
{
|
||||
enabled: !!teamId,
|
||||
retry: false, // Don't retry if PBAC is not enabled
|
||||
}
|
||||
);
|
||||
|
||||
const options = useMemo(() => {
|
||||
// If we have custom roles, only show custom roles
|
||||
@@ -106,10 +95,7 @@ export function EditMemberSheet({
|
||||
label: t("owner"),
|
||||
value: MembershipRole.OWNER,
|
||||
},
|
||||
].filter(
|
||||
({ value }) =>
|
||||
value !== MembershipRole.OWNER || currentMember === MembershipRole.OWNER
|
||||
);
|
||||
].filter(({ value }) => value !== MembershipRole.OWNER || currentMember === MembershipRole.OWNER);
|
||||
}, [t, currentMember, customRoles]);
|
||||
|
||||
// Determine if we should use Select (when custom roles exist) or ToggleGroup (traditional only)
|
||||
@@ -123,11 +109,10 @@ export function EditMemberSheet({
|
||||
},
|
||||
});
|
||||
|
||||
const { data: getUserConnectedApps, isPending } =
|
||||
trpc.viewer.teams.getUserConnectedApps.useQuery({
|
||||
userIds: [selectedUser.id],
|
||||
teamId,
|
||||
});
|
||||
const { data: getUserConnectedApps, isPending } = trpc.viewer.teams.getUserConnectedApps.useQuery({
|
||||
userIds: [selectedUser.id],
|
||||
teamId,
|
||||
});
|
||||
|
||||
const connectedApps = getUserConnectedApps?.[selectedUser.id];
|
||||
|
||||
@@ -206,32 +191,21 @@ export function EditMemberSheet({
|
||||
onOpenChange={() => {
|
||||
setEditMode(false);
|
||||
dispatch({ type: "CLOSE_MODAL" });
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<SheetContent className="bg-cal-muted">
|
||||
{!isPending && !isLoadingRoles ? (
|
||||
<Form
|
||||
form={form}
|
||||
handleSubmit={changeRole}
|
||||
className="flex h-full flex-col"
|
||||
>
|
||||
<Form form={form} handleSubmit={changeRole} className="flex h-full flex-col">
|
||||
<SheetHeader showCloseButton={false} className="w-full">
|
||||
<div className="border-subtle bg-default w-full rounded-xl border p-4">
|
||||
<div
|
||||
className="block w-full rounded-lg ring-1 ring-[#0000000F]"
|
||||
style={{
|
||||
background:
|
||||
"linear-gradient(to top right, var(--cal-bg-emphasis), var(--cal-bg))",
|
||||
background: "linear-gradient(to top right, var(--cal-bg-emphasis), var(--cal-bg))",
|
||||
height: "110px",
|
||||
}}
|
||||
/>
|
||||
<div className="bg-default ml-3 w-fit translate-y-[-50%] rounded-full p-1 ring-1 ring-[#0000000F]">
|
||||
<Avatar
|
||||
asChild
|
||||
size="lg"
|
||||
alt={`${name} avatar`}
|
||||
imageSrc={selectedUser.avatarUrl}
|
||||
/>
|
||||
<Avatar asChild size="lg" alt={`${name} avatar`} imageSrc={selectedUser.avatarUrl} />
|
||||
</div>
|
||||
<Skeleton as="p" waitForTranslation={false}>
|
||||
<h2 className="text-emphasis font-sans text-2xl font-semibold">
|
||||
@@ -240,28 +214,16 @@ export function EditMemberSheet({
|
||||
</Skeleton>
|
||||
<Skeleton as="p" waitForTranslation={false}>
|
||||
<p className="text-subtle max-h-[3em] overflow-hidden text-ellipsis text-sm font-normal">
|
||||
{selectedUser.bio
|
||||
? selectedUser?.bio
|
||||
: t("user_has_no_bio")}
|
||||
{selectedUser.bio ? selectedUser?.bio : t("user_has_no_bio")}
|
||||
</p>
|
||||
</Skeleton>
|
||||
</div>
|
||||
</SheetHeader>
|
||||
<SheetBody className="stack-y-4 flex flex-col p-4">
|
||||
<div className="stack-y-4 mb-4 flex flex-col">
|
||||
<h3 className="text-emphasis mb-1 text-base font-semibold">
|
||||
{t("profile")}
|
||||
</h3>
|
||||
<DisplayInfo
|
||||
label="Cal"
|
||||
value={bookingLink}
|
||||
icon="external-link"
|
||||
/>
|
||||
<DisplayInfo
|
||||
label={t("email")}
|
||||
value={selectedUser.email}
|
||||
icon="at-sign"
|
||||
/>
|
||||
<h3 className="text-emphasis mb-1 text-base font-semibold">{t("profile")}</h3>
|
||||
<DisplayInfo label="Cal" value={bookingLink} icon="external-link" />
|
||||
<DisplayInfo label={t("email")} value={selectedUser.email} icon="at-sign" />
|
||||
{!editMode ? (
|
||||
<DisplayInfo
|
||||
label={t("role")}
|
||||
@@ -277,9 +239,7 @@ export function EditMemberSheet({
|
||||
<div className="flex flex-1">
|
||||
{shouldUseSelect ? (
|
||||
<Select
|
||||
value={options.find(
|
||||
(option) => option.value === form.watch("role")
|
||||
)}
|
||||
value={options.find((option) => option.value === form.watch("role"))}
|
||||
onChange={(selectedOption: any) => {
|
||||
if (selectedOption) {
|
||||
form.setValue("role", selectedOption.value);
|
||||
@@ -287,9 +247,7 @@ export function EditMemberSheet({
|
||||
}}
|
||||
options={options}
|
||||
isDisabled={isLoadingRoles}
|
||||
placeholder={
|
||||
isLoadingRoles ? t("loading") : t("select_role")
|
||||
}
|
||||
placeholder={isLoadingRoles ? t("loading") : t("select_role")}
|
||||
className="flex-1"
|
||||
/>
|
||||
) : (
|
||||
@@ -309,9 +267,7 @@ export function EditMemberSheet({
|
||||
<div className="flex items-center gap-6">
|
||||
<div className="flex w-[110px] items-center gap-2">
|
||||
<Icon className="text-subtle h-4 w-4" name="grid-3x3" />
|
||||
<label className="text-subtle text-sm font-medium">
|
||||
{t("apps")}
|
||||
</label>
|
||||
<label className="text-subtle text-sm font-medium">{t("apps")}</label>
|
||||
</div>
|
||||
<div className="flex flex-1">
|
||||
{!connectedApps ? (
|
||||
|
||||
@@ -25,7 +25,12 @@ import {
|
||||
useColumnFilters,
|
||||
convertFacetedValuesToMap,
|
||||
} from "@calcom/features/data-table";
|
||||
import { DataTableToolbar, DataTableFilters, DataTableWrapper, DataTableSelectionBar } from "~/data-table/components";
|
||||
import {
|
||||
DataTableToolbar,
|
||||
DataTableFilters,
|
||||
DataTableWrapper,
|
||||
DataTableSelectionBar,
|
||||
} from "~/data-table/components";
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
|
||||
|
||||
@@ -36,10 +36,7 @@ const RoundRobinSettings = ({ team }: RoundRobinSettingsProps) => {
|
||||
},
|
||||
});
|
||||
|
||||
const [watchedResetInterval, watchedTimestampBasis] = form.watch([
|
||||
"rrResetInterval",
|
||||
"rrTimestampBasis",
|
||||
]);
|
||||
const [watchedResetInterval, watchedTimestampBasis] = form.watch(["rrResetInterval", "rrTimestampBasis"]);
|
||||
const hasChanges =
|
||||
watchedResetInterval !== initialResetInterval || watchedTimestampBasis !== initialTimestampBasis;
|
||||
|
||||
|
||||
@@ -72,12 +72,8 @@ export function CreateButton(props: CreateBtnProps) {
|
||||
// inject selection data into url for correct router history
|
||||
const openModal = (option: Option) => {
|
||||
const _searchParams = new URLSearchParams(searchParams.toString());
|
||||
function setParamsIfDefined(
|
||||
key: string,
|
||||
value: string | number | boolean | null | undefined
|
||||
) {
|
||||
if (value !== undefined && value !== null)
|
||||
_searchParams.set(key, value.toString());
|
||||
function setParamsIfDefined(key: string, value: string | number | boolean | null | undefined) {
|
||||
if (value !== undefined && value !== null) _searchParams.set(key, value.toString());
|
||||
}
|
||||
setParamsIfDefined("dialog", "new");
|
||||
setParamsIfDefined("eventPage", option.slug);
|
||||
@@ -96,8 +92,8 @@ export function CreateButton(props: CreateBtnProps) {
|
||||
CreateDialog
|
||||
? openModal(options[0])
|
||||
: createFunction
|
||||
? createFunction(options[0].teamId || undefined)
|
||||
: null
|
||||
? createFunction(options[0].teamId || undefined)
|
||||
: null
|
||||
}
|
||||
data-testid="create-button"
|
||||
StartIcon={startIcon}
|
||||
@@ -105,12 +101,8 @@ export function CreateButton(props: CreateBtnProps) {
|
||||
size="sm"
|
||||
loading={isPending}
|
||||
variant={disableMobileButton ? "button" : "fab"}
|
||||
className={classNames(
|
||||
disableMobileButton && "md:min-h-min md:min-w-min",
|
||||
className
|
||||
)}
|
||||
{...restProps}
|
||||
>
|
||||
className={classNames(disableMobileButton && "md:min-h-min md:min-w-min", className)}
|
||||
{...restProps}>
|
||||
{buttonText ? buttonText : t("new")}
|
||||
</Button>
|
||||
) : (
|
||||
@@ -123,20 +115,12 @@ export function CreateButton(props: CreateBtnProps) {
|
||||
size="sm"
|
||||
data-testid="create-button-dropdown"
|
||||
loading={isPending}
|
||||
className={classNames(
|
||||
disableMobileButton && "md:min-h-min md:min-w-min",
|
||||
className
|
||||
)}
|
||||
{...restProps}
|
||||
>
|
||||
className={classNames(disableMobileButton && "md:min-h-min md:min-w-min", className)}
|
||||
{...restProps}>
|
||||
{buttonText ? buttonText : t("new")}
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
sideOffset={14}
|
||||
align="end"
|
||||
className="scroll-bar max-h-60 overflow-y-auto"
|
||||
>
|
||||
<DropdownMenuContent sideOffset={14} align="end" className="scroll-bar max-h-60 overflow-y-auto">
|
||||
<DropdownMenuLabel>
|
||||
<div className="w-48 text-left text-xs">{subtitle}</div>
|
||||
</DropdownMenuLabel>
|
||||
@@ -145,24 +129,14 @@ export function CreateButton(props: CreateBtnProps) {
|
||||
<DropdownItem
|
||||
type="button"
|
||||
data-testid={`option${option.teamId ? "-team" : ""}-${idx}`}
|
||||
CustomStartIcon={
|
||||
<Avatar
|
||||
alt={option.label || ""}
|
||||
imageSrc={option.image}
|
||||
size="sm"
|
||||
/>
|
||||
}
|
||||
CustomStartIcon={<Avatar alt={option.label || ""} imageSrc={option.image} size="sm" />}
|
||||
onClick={() =>
|
||||
CreateDialog
|
||||
? openModal(option)
|
||||
: createFunction
|
||||
? createFunction(
|
||||
option.teamId || undefined,
|
||||
option.platform
|
||||
)
|
||||
: null
|
||||
}
|
||||
>
|
||||
? createFunction(option.teamId || undefined, option.platform)
|
||||
: null
|
||||
}>
|
||||
{" "}
|
||||
{/*improve this code */}
|
||||
<span>{option.label}</span>
|
||||
|
||||
@@ -48,8 +48,6 @@ import { revalidateTeamsList } from "@calcom/web/app/(use-page-wrapper)/(main-na
|
||||
|
||||
const regex = new RegExp("^[a-zA-Z0-9-]*$");
|
||||
|
||||
|
||||
|
||||
const SkeletonLoader = () => {
|
||||
return (
|
||||
<SkeletonContainer>
|
||||
@@ -255,22 +253,19 @@ const TeamProfileForm = ({ team, teamId }: TeamProfileFormProps) => {
|
||||
const router = useRouter();
|
||||
|
||||
const teamProfileFormSchema = z.object({
|
||||
id: z.number(),
|
||||
name: z
|
||||
.string()
|
||||
.trim()
|
||||
.min(1,t("must_enter_team_name")),
|
||||
slug: z
|
||||
.string()
|
||||
.regex(regex, {
|
||||
message: "Url can only have alphanumeric characters(a-z, 0-9) and hyphen(-) symbol.",
|
||||
})
|
||||
.min(1, t("team_url_required")),
|
||||
logo: z.string().nullable(),
|
||||
bio: z.string(),
|
||||
});
|
||||
id: z.number(),
|
||||
name: z.string().trim().min(1, t("must_enter_team_name")),
|
||||
slug: z
|
||||
.string()
|
||||
.regex(regex, {
|
||||
message: "Url can only have alphanumeric characters(a-z, 0-9) and hyphen(-) symbol.",
|
||||
})
|
||||
.min(1, t("team_url_required")),
|
||||
logo: z.string().nullable(),
|
||||
bio: z.string(),
|
||||
});
|
||||
|
||||
type FormValues = z.infer<typeof teamProfileFormSchema>;
|
||||
type FormValues = z.infer<typeof teamProfileFormSchema>;
|
||||
|
||||
const mutation = trpc.viewer.teams.update.useMutation({
|
||||
onError: (err) => {
|
||||
|
||||
@@ -347,7 +347,6 @@ const DeleteUserDialog = ({
|
||||
onClose: () => void;
|
||||
}) => {
|
||||
return (
|
||||
|
||||
<Dialog name="delete-user" open={!!user} onOpenChange={(open) => (open ? () => {} : onClose())}>
|
||||
<ConfirmationDialogContent
|
||||
title="Delete User"
|
||||
|
||||
@@ -59,7 +59,7 @@ type AddActionFormValues = {
|
||||
numberRequired?: boolean;
|
||||
senderId?: string;
|
||||
senderName?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export const AddActionDialog = (props: IAddActionDialog) => {
|
||||
const { t } = useLocale();
|
||||
|
||||
@@ -96,8 +96,8 @@ export function CallDetailsSheet({ state, dispatch }: CallDetailsSheetProps) {
|
||||
selectedCall.call_analysis?.user_sentiment === "Positive"
|
||||
? "green"
|
||||
: selectedCall.call_analysis?.user_sentiment === "Negative"
|
||||
? "red"
|
||||
: "gray"
|
||||
? "red"
|
||||
: "gray"
|
||||
}>
|
||||
{selectedCall.call_analysis?.user_sentiment || "Unknown"}
|
||||
</Badge>
|
||||
|
||||
@@ -51,10 +51,13 @@ export const TimeTimeUnitInput = (props: Props) => {
|
||||
const form = useFormContext();
|
||||
|
||||
const { t } = useLocale();
|
||||
const timeUnitOptions = TIME_UNITS.reduce((acc, option) => {
|
||||
acc[option] = t(`${option.toLowerCase()}_timeUnit`);
|
||||
return acc;
|
||||
}, {} as { [x: string]: string });
|
||||
const timeUnitOptions = TIME_UNITS.reduce(
|
||||
(acc, option) => {
|
||||
acc[option] = t(`${option.toLowerCase()}_timeUnit`);
|
||||
return acc;
|
||||
},
|
||||
{} as { [x: string]: string }
|
||||
);
|
||||
return (
|
||||
<div className="flex">
|
||||
<div className="grow">
|
||||
|
||||
@@ -59,10 +59,13 @@ function VoiceSelectionContent({
|
||||
|
||||
const { data: voices, isLoading } = trpc.viewer.aiVoiceAgent.listVoices.useQuery();
|
||||
|
||||
const handleUseVoice = useCallback((voiceId: string) => {
|
||||
onVoiceSelect(voiceId);
|
||||
showToast("Voice selected successfully", "success");
|
||||
}, [onVoiceSelect]);
|
||||
const handleUseVoice = useCallback(
|
||||
(voiceId: string) => {
|
||||
onVoiceSelect(voiceId);
|
||||
showToast("Voice selected successfully", "success");
|
||||
},
|
||||
[onVoiceSelect]
|
||||
);
|
||||
|
||||
const voiceData: Voice[] = useMemo(() => {
|
||||
if (!voices) return [];
|
||||
|
||||
@@ -13,11 +13,7 @@ import { ALLOWED_FORM_WORKFLOW_ACTIONS } from "@calcom/features/ee/workflows/lib
|
||||
import emailReminderTemplate from "@calcom/features/ee/workflows/lib/reminders/templates/emailReminderTemplate";
|
||||
import type { FormValues } from "@calcom/features/ee/workflows/lib/types";
|
||||
import type { WorkflowPermissions } from "@calcom/features/workflows/repositories/WorkflowPermissionsRepository";
|
||||
import {
|
||||
SENDER_ID,
|
||||
SENDER_NAME,
|
||||
SCANNING_WORKFLOW_STEPS,
|
||||
} from "@calcom/lib/constants";
|
||||
import { SENDER_ID, SENDER_NAME, SCANNING_WORKFLOW_STEPS } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat";
|
||||
import { WorkflowActions } from "@calcom/prisma/enums";
|
||||
@@ -27,10 +23,7 @@ import { Button } from "@calcom/ui/components/button";
|
||||
import { FormCard, FormCardBody } from "@calcom/ui/components/card";
|
||||
import type { MultiSelectCheckboxesOptionType as Option } from "@calcom/ui/components/form";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
import {
|
||||
useHasPaidPlan,
|
||||
useHasActiveTeamPlan,
|
||||
} from "@calcom/web/modules/billing/hooks/useHasPaidPlan";
|
||||
import { useHasPaidPlan, useHasActiveTeamPlan } from "@calcom/web/modules/billing/hooks/useHasPaidPlan";
|
||||
|
||||
import { AddActionDialog } from "./AddActionDialog";
|
||||
import WorkflowStepContainer from "./WorkflowStepContainer";
|
||||
@@ -77,28 +70,20 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
const eventTypeId = searchParams?.get("eventTypeId");
|
||||
|
||||
// Get base action options and transform them for form triggers
|
||||
const { data: baseActionOptions } =
|
||||
trpc.viewer.workflows.getWorkflowActionOptions.useQuery();
|
||||
const { data: baseActionOptions } = trpc.viewer.workflows.getWorkflowActionOptions.useQuery();
|
||||
|
||||
const transformedActionOptions = baseActionOptions
|
||||
? baseActionOptions
|
||||
.filter((option) => {
|
||||
const isFormWorkflowWithInvalidSteps =
|
||||
isFormTrigger(form.getValues("trigger")) &&
|
||||
!ALLOWED_FORM_WORKFLOW_ACTIONS.some(
|
||||
(action) => action === option.value
|
||||
);
|
||||
!ALLOWED_FORM_WORKFLOW_ACTIONS.some((action) => action === option.value);
|
||||
|
||||
const isSelectAllCalAiAction =
|
||||
isCalAIAction(option.value) && form.watch("selectAll");
|
||||
const isSelectAllCalAiAction = isCalAIAction(option.value) && form.watch("selectAll");
|
||||
|
||||
const isOrgCalAiAction = isCalAIAction(option.value) && isOrg;
|
||||
|
||||
if (
|
||||
isFormWorkflowWithInvalidSteps ||
|
||||
isSelectAllCalAiAction ||
|
||||
isOrgCalAiAction
|
||||
) {
|
||||
if (isFormWorkflowWithInvalidSteps || isSelectAllCalAiAction || isOrgCalAiAction) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -115,8 +100,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
const needsTeamsUpgrade =
|
||||
isFormTrigger(form.getValues("trigger")) && !hasActiveTeamPlan;
|
||||
const needsTeamsUpgrade = isFormTrigger(form.getValues("trigger")) && !hasActiveTeamPlan;
|
||||
|
||||
return {
|
||||
...option,
|
||||
@@ -133,13 +117,8 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
: [];
|
||||
|
||||
useEffect(() => {
|
||||
const matchingOption = allOptions.find(
|
||||
(option) => option.value === eventTypeId
|
||||
);
|
||||
if (
|
||||
matchingOption &&
|
||||
!selectedOptions.find((option) => option.value === eventTypeId)
|
||||
) {
|
||||
const matchingOption = allOptions.find((option) => option.value === eventTypeId);
|
||||
if (matchingOption && !selectedOptions.find((option) => option.value === eventTypeId)) {
|
||||
const newOptions = [...selectedOptions, matchingOption];
|
||||
setSelectedOptions(newOptions);
|
||||
form.setValue("activeOn", newOptions);
|
||||
@@ -162,9 +141,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
})[0].id - 1
|
||||
: 0;
|
||||
|
||||
const timeFormat = getTimeFormatStringFromUserTimeFormat(
|
||||
props.user.timeFormat
|
||||
);
|
||||
const timeFormat = getTimeFormatStringFromUserTimeFormat(props.user.timeFormat);
|
||||
|
||||
const template = isFormTrigger(form.getValues("trigger"))
|
||||
? WorkflowTemplates.CUSTOM
|
||||
@@ -197,9 +174,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
template,
|
||||
numberRequired: numberRequired || false,
|
||||
sender: isSMSAction(action) ? sender || SENDER_ID : SENDER_ID,
|
||||
senderName: !isSMSAction(action)
|
||||
? senderName || SENDER_NAME
|
||||
: SENDER_NAME,
|
||||
senderName: !isSMSAction(action) ? senderName || SENDER_NAME : SENDER_NAME,
|
||||
numberVerificationPending: false,
|
||||
includeCalendarEvent: false,
|
||||
verifiedAt: SCANNING_WORKFLOW_STEPS ? null : new Date(),
|
||||
@@ -210,10 +185,8 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
form.setValue("steps", steps);
|
||||
};
|
||||
|
||||
const {
|
||||
outboundAgentQueries: agentQueriesTrpc,
|
||||
inboundAgentQueries: inboundAgentQueriesTrpc,
|
||||
} = useAgentsData(form);
|
||||
const { outboundAgentQueries: agentQueriesTrpc, inboundAgentQueries: inboundAgentQueriesTrpc } =
|
||||
useAgentsData(form);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -226,12 +199,9 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
<div className="border-subtle text-subtle ml-1 rounded-lg border p-1">
|
||||
<Icon name="zap" size="16" />
|
||||
</div>
|
||||
<div className="text-sm font-medium leading-none">
|
||||
{t("trigger")}
|
||||
</div>
|
||||
<div className="text-sm font-medium leading-none">{t("trigger")}</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
}>
|
||||
<FormCardBody className="border-muted">
|
||||
<WorkflowStepContainer
|
||||
form={form}
|
||||
@@ -258,8 +228,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
const agentData = agentQueriesTrpc[index]?.data;
|
||||
const isAgentLoading = agentQueriesTrpc[index]?.isPending;
|
||||
const inboundAgentData = inboundAgentQueriesTrpc[index]?.data;
|
||||
const isInboundAgentLoading =
|
||||
inboundAgentQueriesTrpc[index]?.isPending;
|
||||
const isInboundAgentLoading = inboundAgentQueriesTrpc[index]?.isPending;
|
||||
|
||||
return (
|
||||
<div key={index}>
|
||||
@@ -272,9 +241,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
<div className="border-subtle text-subtle rounded-lg border p-1">
|
||||
<Icon name="arrow-right" size="16" />
|
||||
</div>
|
||||
<div className="text-sm font-medium leading-none">
|
||||
{t("action")}
|
||||
</div>
|
||||
<div className="text-sm font-medium leading-none">{t("action")}</div>
|
||||
</div>
|
||||
}
|
||||
deleteField={
|
||||
@@ -293,16 +260,11 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
} else {
|
||||
const steps = form.getValues("steps");
|
||||
const updatedSteps = steps
|
||||
?.filter(
|
||||
(currStep) => currStep.id !== step.id
|
||||
)
|
||||
?.filter((currStep) => currStep.id !== step.id)
|
||||
.map((s) => {
|
||||
const updatedStep = s;
|
||||
if (
|
||||
step.stepNumber < updatedStep.stepNumber
|
||||
) {
|
||||
updatedStep.stepNumber =
|
||||
updatedStep.stepNumber - 1;
|
||||
if (step.stepNumber < updatedStep.stepNumber) {
|
||||
updatedStep.stepNumber = updatedStep.stepNumber - 1;
|
||||
}
|
||||
return updatedStep;
|
||||
});
|
||||
@@ -314,8 +276,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
},
|
||||
}
|
||||
: null
|
||||
}
|
||||
>
|
||||
}>
|
||||
<FormCardBody className="border-muted">
|
||||
<WorkflowStepContainer
|
||||
form={form}
|
||||
@@ -355,8 +316,7 @@ export default function WorkflowDetailsPage(props: Props) {
|
||||
type="button"
|
||||
onClick={() => setIsAddActionDialogOpen(true)}
|
||||
color="secondary"
|
||||
className="bg-default"
|
||||
>
|
||||
className="bg-default">
|
||||
{t("add_action")}
|
||||
</Button>
|
||||
</>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -145,11 +145,11 @@ function WorkflowPage({
|
||||
workflow && hasPermissions(workflow)
|
||||
? workflow?.permissions
|
||||
: {
|
||||
canUpdate: !teamId,
|
||||
canView: !teamId,
|
||||
canDelete: !teamId,
|
||||
readOnly: !!teamId,
|
||||
};
|
||||
canUpdate: !teamId,
|
||||
canView: !teamId,
|
||||
canDelete: !teamId,
|
||||
readOnly: !!teamId,
|
||||
};
|
||||
|
||||
// Watch for form name changes
|
||||
const watchedName = form.watch("name");
|
||||
@@ -256,9 +256,9 @@ function WorkflowPage({
|
||||
);
|
||||
activeOn = workflowData.activeOn
|
||||
? workflowData.activeOn.map((active) => ({
|
||||
value: active.eventType.id.toString(),
|
||||
label: active.eventType.slug,
|
||||
}))
|
||||
value: active.eventType.id.toString(),
|
||||
label: active.eventType.slug,
|
||||
}))
|
||||
: undefined;
|
||||
}
|
||||
}
|
||||
@@ -464,7 +464,6 @@ function WorkflowPage({
|
||||
/>
|
||||
) : (
|
||||
<div className="group flex min-w-0 items-center gap-1">
|
||||
|
||||
<span
|
||||
className="text-default hover:bg-cal-muted min-w-0 cursor-pointer truncate whitespace-nowrap rounded p-1 text-sm font-semibold leading-none"
|
||||
onClick={() => setIsEditingName(true)}>
|
||||
|
||||
@@ -18,21 +18,14 @@ import {
|
||||
useBookerStoreContext,
|
||||
} from "@calcom/features/bookings/Booker/BookerStoreProvider";
|
||||
import { useInitializeBookerStore } from "@calcom/features/bookings/Booker/store";
|
||||
import {
|
||||
useEvent,
|
||||
useScheduleForEvent,
|
||||
} from "@calcom/web/modules/schedules/hooks/useEvent";
|
||||
import { useEvent, useScheduleForEvent } from "@calcom/web/modules/schedules/hooks/useEvent";
|
||||
import DatePicker from "@calcom/features/calendars/components/DatePicker";
|
||||
import { Dialog } from "@calcom/features/components/controlled-dialog";
|
||||
import { TimezoneSelect } from "@calcom/web/modules/timezone/components/TimezoneSelect";
|
||||
import type { Slot } from "~/schedules/lib/types";
|
||||
import { useNonEmptyScheduleDays } from "@calcom/web/modules/schedules/hooks/useNonEmptyScheduleDays";
|
||||
import { useSlotsForDate } from "@calcom/web/modules/schedules/hooks/useSlotsForDate";
|
||||
import {
|
||||
APP_NAME,
|
||||
DEFAULT_LIGHT_BRAND_COLOR,
|
||||
DEFAULT_DARK_BRAND_COLOR,
|
||||
} from "@calcom/lib/constants";
|
||||
import { APP_NAME, DEFAULT_LIGHT_BRAND_COLOR, DEFAULT_DARK_BRAND_COLOR } from "@calcom/lib/constants";
|
||||
import { weekdayToWeekIndex } from "@calcom/lib/dayjs";
|
||||
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
@@ -40,11 +33,7 @@ import { BookerLayouts } from "@calcom/prisma/zod-utils";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import {
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogClose,
|
||||
} from "@calcom/ui/components/dialog";
|
||||
import { DialogContent, DialogFooter, DialogClose } from "@calcom/ui/components/dialog";
|
||||
import { Select, ColorPicker } from "@calcom/ui/components/form";
|
||||
import { Label } from "@calcom/ui/components/form";
|
||||
import { TextField } from "@calcom/ui/components/form";
|
||||
@@ -68,9 +57,7 @@ import type {
|
||||
EmbedConfig,
|
||||
} from "@calcom/features/embed/types";
|
||||
|
||||
type EventType =
|
||||
| RouterOutputs["viewer"]["eventTypes"]["get"]["eventType"]
|
||||
| undefined;
|
||||
type EventType = RouterOutputs["viewer"]["eventTypes"]["get"]["eventType"] | undefined;
|
||||
type EmbedDialogProps = {
|
||||
types: EmbedTypes;
|
||||
tabs: EmbedTabs;
|
||||
@@ -113,11 +100,7 @@ function chooseTimezone({
|
||||
userSettingsTimezone: string | undefined;
|
||||
}) {
|
||||
// We prefer user's timezone configured in settings at the moment - Might be a better idea to prefer timezoneFromTimePreferences over user settings as the user might be in different timezone
|
||||
return (
|
||||
timezoneFromBookerStore ??
|
||||
userSettingsTimezone ??
|
||||
timezoneFromTimePreferences
|
||||
);
|
||||
return timezoneFromBookerStore ?? userSettingsTimezone ?? timezoneFromTimePreferences;
|
||||
}
|
||||
|
||||
function useRouterHelpers() {
|
||||
@@ -167,10 +150,7 @@ function useEmbedGoto(noQueryParamMode = false) {
|
||||
}));
|
||||
} else {
|
||||
const validQueryParams = Object.fromEntries(
|
||||
Object.entries(props).filter(([_, value]) => value !== null) as [
|
||||
string,
|
||||
string
|
||||
][]
|
||||
Object.entries(props).filter(([_, value]) => value !== null) as [string, string][]
|
||||
);
|
||||
goto(validQueryParams);
|
||||
}
|
||||
@@ -228,15 +208,11 @@ const ChooseEmbedTypesDialogContent = ({
|
||||
return (
|
||||
<DialogContent className="rounded-lg p-10" type="creation" size="lg">
|
||||
<div className="mb-2">
|
||||
<h3
|
||||
className="font-cal text-emphasis mb-2 text-2xl font-semibold leading-none"
|
||||
id="modal-title">
|
||||
<h3 className="font-cal text-emphasis mb-2 text-2xl font-semibold leading-none" id="modal-title">
|
||||
{t("how_you_want_add_cal_site", { appName: APP_NAME })}
|
||||
</h3>
|
||||
<div>
|
||||
<p className="text-subtle text-sm">
|
||||
{t("choose_ways_put_cal_site", { appName: APP_NAME })}
|
||||
</p>
|
||||
<p className="text-subtle text-sm">{t("choose_ways_put_cal_site", { appName: APP_NAME })}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="items-start stack-y-2 md:flex md:stack-y-0">
|
||||
@@ -247,23 +223,17 @@ const ChooseEmbedTypesDialogContent = ({
|
||||
data-testid={embed.type}
|
||||
onClick={() => {
|
||||
if (embed.type === "headless") {
|
||||
window.open(
|
||||
"https://cal.com/help/routing/headless-routing",
|
||||
"_blank"
|
||||
);
|
||||
window.open("https://cal.com/help/routing/headless-routing", "_blank");
|
||||
} else {
|
||||
gotoState({
|
||||
embedType: embed.type as EmbedType,
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<div className="bg-default order-0 box-border flex-none rounded-md border border-solid transition dark:bg-transparent dark:invert">
|
||||
{embed.illustration}
|
||||
</div>
|
||||
<div className="text-emphasis mt-4 font-semibold">
|
||||
{embed.title}
|
||||
</div>
|
||||
<div className="text-emphasis mt-4 font-semibold">{embed.title}</div>
|
||||
<p className="text-subtle mt-2 text-sm">{embed.subtitle}</p>
|
||||
</button>
|
||||
))}
|
||||
@@ -290,8 +260,7 @@ const EmailEmbed = ({
|
||||
userSettingsTimezone?: string;
|
||||
}) => {
|
||||
const { t, i18n } = useLocale();
|
||||
const { timezoneFromBookerStore, timezoneFromTimePreferences } =
|
||||
useBookerTime();
|
||||
const { timezoneFromBookerStore, timezoneFromTimePreferences } = useBookerTime();
|
||||
const timezone = chooseTimezone({
|
||||
timezoneFromBookerStore,
|
||||
timezoneFromTimePreferences,
|
||||
@@ -319,22 +288,17 @@ const EmailEmbed = ({
|
||||
(state) => [state.month, state.selectedDate, state.selectedDatesAndTimes],
|
||||
shallow
|
||||
);
|
||||
const [
|
||||
setSelectedDate,
|
||||
setMonth,
|
||||
setSelectedDatesAndTimes,
|
||||
setSelectedTimeslot,
|
||||
setTimezone,
|
||||
] = useBookerStoreContext(
|
||||
(state) => [
|
||||
state.setSelectedDate,
|
||||
state.setMonth,
|
||||
state.setSelectedDatesAndTimes,
|
||||
state.setSelectedTimeslot,
|
||||
state.setTimezone,
|
||||
],
|
||||
shallow
|
||||
);
|
||||
const [setSelectedDate, setMonth, setSelectedDatesAndTimes, setSelectedTimeslot, setTimezone] =
|
||||
useBookerStoreContext(
|
||||
(state) => [
|
||||
state.setSelectedDate,
|
||||
state.setMonth,
|
||||
state.setSelectedDatesAndTimes,
|
||||
state.setSelectedTimeslot,
|
||||
state.setTimezone,
|
||||
],
|
||||
shallow
|
||||
);
|
||||
const event = useEvent();
|
||||
const schedule = useScheduleForEvent({
|
||||
orgSlug,
|
||||
@@ -351,10 +315,8 @@ const EmailEmbed = ({
|
||||
return null;
|
||||
}
|
||||
if (selectedDatesAndTimes && selectedDatesAndTimes[eventType.slug]) {
|
||||
const selectedDatesAndTimesForEvent =
|
||||
selectedDatesAndTimes[eventType.slug];
|
||||
const selectedSlots =
|
||||
selectedDatesAndTimesForEvent[selectedDate as string] ?? [];
|
||||
const selectedDatesAndTimesForEvent = selectedDatesAndTimes[eventType.slug];
|
||||
const selectedSlots = selectedDatesAndTimesForEvent[selectedDate as string] ?? [];
|
||||
if (selectedSlots?.includes(time)) {
|
||||
// Checks whether a user has removed all their timeSlots and thus removes it from the selectedDatesAndTimesForEvent state
|
||||
if (selectedSlots?.length > 1) {
|
||||
@@ -362,9 +324,7 @@ const EmailEmbed = ({
|
||||
...selectedDatesAndTimes,
|
||||
[eventType.slug]: {
|
||||
...selectedDatesAndTimesForEvent,
|
||||
[selectedDate as string]: selectedSlots?.filter(
|
||||
(slot: string) => slot !== time
|
||||
),
|
||||
[selectedDate as string]: selectedSlots?.filter((slot: string) => slot !== time),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -442,9 +402,7 @@ const EmailEmbed = ({
|
||||
locale={i18n.language}
|
||||
browsingDate={month ? dayjs(month) : undefined}
|
||||
selected={dayjs(selectedDate)}
|
||||
weekStart={weekdayToWeekIndex(
|
||||
event?.data?.subsetOfUsers?.[0]?.weekStart
|
||||
)}
|
||||
weekStart={weekdayToWeekIndex(event?.data?.subsetOfUsers?.[0]?.weekStart)}
|
||||
eventSlug={eventType?.slug}
|
||||
/>
|
||||
</CollapsibleContent>
|
||||
@@ -462,9 +420,7 @@ const EmailEmbed = ({
|
||||
selectedDatesAndTimes &&
|
||||
selectedDatesAndTimes[eventType.slug] &&
|
||||
selectedDatesAndTimes[eventType.slug][selectedDate as string]
|
||||
? selectedDatesAndTimes[eventType.slug][
|
||||
selectedDate as string
|
||||
]
|
||||
? selectedDatesAndTimes[eventType.slug][selectedDate as string]
|
||||
: undefined
|
||||
}
|
||||
handleSlotClick={handleSlotClick}
|
||||
@@ -482,9 +438,7 @@ const EmailEmbed = ({
|
||||
<div className="text-default mb-[9px] text-sm">{t("duration")}</div>
|
||||
{durationsOptions.length > 0 ? (
|
||||
<Select<{ label: string; value: number }>
|
||||
value={durationsOptions.find(
|
||||
(option) => option.value === selectedDuration
|
||||
)}
|
||||
value={durationsOptions.find((option) => option.value === selectedDuration)}
|
||||
options={durationsOptions}
|
||||
onChange={(option) => {
|
||||
setSelectedDuration(option?.value);
|
||||
@@ -506,11 +460,7 @@ const EmailEmbed = ({
|
||||
<Collapsible open>
|
||||
<CollapsibleContent>
|
||||
<div className="text-default mb-[9px] text-sm">{t("timezone")}</div>
|
||||
<TimezoneSelect
|
||||
id="timezone"
|
||||
value={timezone}
|
||||
onChange={({ value }) => setTimezone(value)}
|
||||
/>
|
||||
<TimezoneSelect id="timezone" value={timezone} onChange={({ value }) => setTimezone(value)} />
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
</div>
|
||||
@@ -539,8 +489,7 @@ const EmailEmbedPreview = ({
|
||||
userSettingsTimezone?: string;
|
||||
}) => {
|
||||
const { t } = useLocale();
|
||||
const { timeFormat, timezoneFromBookerStore, timezoneFromTimePreferences } =
|
||||
useBookerTime();
|
||||
const { timeFormat, timezoneFromBookerStore, timezoneFromTimePreferences } = useBookerTime();
|
||||
const timezone = chooseTimezone({
|
||||
timezoneFromBookerStore,
|
||||
timezoneFromTimePreferences,
|
||||
@@ -564,8 +513,7 @@ const EmailEmbedPreview = ({
|
||||
overflowY: "auto",
|
||||
backgroundColor: "white",
|
||||
}}
|
||||
ref={emailContentRef}
|
||||
>
|
||||
ref={emailContentRef}>
|
||||
<div
|
||||
style={{
|
||||
fontStyle: "normal",
|
||||
@@ -574,8 +522,7 @@ const EmailEmbedPreview = ({
|
||||
lineHeight: "19px",
|
||||
marginTop: "15px",
|
||||
marginBottom: "15px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<b style={{ color: "black" }}> {eventType.title}</b>
|
||||
</div>
|
||||
<div
|
||||
@@ -585,10 +532,8 @@ const EmailEmbedPreview = ({
|
||||
fontSize: "14px",
|
||||
lineHeight: "17px",
|
||||
color: "#333333",
|
||||
}}
|
||||
>
|
||||
{t("duration")}:{" "}
|
||||
<b style={{ color: "black" }}>{selectedDuration} mins</b>
|
||||
}}>
|
||||
{t("duration")}: <b style={{ color: "black" }}>{selectedDuration} mins</b>
|
||||
</div>
|
||||
<div>
|
||||
<b style={{ color: "black" }}>
|
||||
@@ -599,8 +544,7 @@ const EmailEmbedPreview = ({
|
||||
fontSize: "14px",
|
||||
lineHeight: "17px",
|
||||
color: "#333333",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{t("timezone")}: <b style={{ color: "black" }}>{timezone}</b>
|
||||
</span>
|
||||
</b>
|
||||
@@ -624,13 +568,10 @@ const EmailEmbedPreview = ({
|
||||
textAlign: "left",
|
||||
borderCollapse: "collapse",
|
||||
borderSpacing: "0px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td
|
||||
style={{ textAlign: "left", marginTop: "16px" }}
|
||||
>
|
||||
<td style={{ textAlign: "left", marginTop: "16px" }}>
|
||||
<span
|
||||
style={{
|
||||
fontSize: "14px",
|
||||
@@ -638,8 +579,7 @@ const EmailEmbedPreview = ({
|
||||
paddingBottom: "8px",
|
||||
color: "rgb(26, 26, 26)",
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{selectedDate}
|
||||
|
||||
</span>
|
||||
@@ -651,20 +591,15 @@ const EmailEmbedPreview = ({
|
||||
style={{
|
||||
borderCollapse: "separate",
|
||||
borderSpacing: "0px 4px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<tbody>
|
||||
<tr style={{ height: "25px" }}>
|
||||
{sortedTimes?.length > 0 &&
|
||||
sortedTimes.map((time) => {
|
||||
// If teamId is present on eventType and is not null, it means it is a team event.
|
||||
// So we add 'team/' to the url.
|
||||
const bookingURL = `${
|
||||
eventType.bookerUrl
|
||||
}/${
|
||||
eventType.teamId !== null
|
||||
? "team/"
|
||||
: ""
|
||||
const bookingURL = `${eventType.bookerUrl}/${
|
||||
eventType.teamId !== null ? "team/" : ""
|
||||
}${username}/${
|
||||
eventType.slug
|
||||
}?duration=${selectedDuration}&date=${key}&month=${month}&slot=${time}&cal.tz=${timezone}`;
|
||||
@@ -680,45 +615,34 @@ const EmailEmbedPreview = ({
|
||||
height: "24px",
|
||||
border: "1px solid #111827",
|
||||
borderRadius: "3px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<table style={{ height: "21px" }}>
|
||||
<tbody>
|
||||
<tr style={{ height: "21px" }}>
|
||||
<td
|
||||
style={{ width: "7px" }}
|
||||
/>
|
||||
<td style={{ width: "7px" }} />
|
||||
<td
|
||||
style={{
|
||||
width: "50px",
|
||||
textAlign: "center",
|
||||
marginRight: "1px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<a
|
||||
href={bookingURL}
|
||||
className="spot"
|
||||
style={{
|
||||
fontFamily:
|
||||
'"Proxima Nova", sans-serif',
|
||||
fontFamily: '"Proxima Nova", sans-serif',
|
||||
textDecoration: "none",
|
||||
textAlign: "center",
|
||||
color: "#111827",
|
||||
fontSize: "12px",
|
||||
lineHeight: "16px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<b
|
||||
style={{
|
||||
fontWeight: "normal",
|
||||
textDecoration:
|
||||
"none",
|
||||
}}
|
||||
>
|
||||
{dayjs
|
||||
.utc(time)
|
||||
.tz(timezone)
|
||||
.format(timeFormat)}
|
||||
textDecoration: "none",
|
||||
}}>
|
||||
{dayjs.utc(time).tz(timezone).format(timeFormat)}
|
||||
|
||||
</b>
|
||||
</a>
|
||||
@@ -747,8 +671,7 @@ const EmailEmbedPreview = ({
|
||||
textDecoration: "none",
|
||||
cursor: "pointer",
|
||||
color: "black",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{t("see_all_available_times")}
|
||||
</a>
|
||||
</div>
|
||||
@@ -760,8 +683,7 @@ const EmailEmbedPreview = ({
|
||||
borderTop: "1px solid #CCCCCC",
|
||||
marginTop: "8px",
|
||||
paddingTop: "8px",
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<span>{t("powered_by")}</span>{" "}
|
||||
<b style={{ color: "black" }}>
|
||||
<span> Cal.com</span>
|
||||
@@ -792,8 +714,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
const { t } = useLocale();
|
||||
const searchParams = useCompatSearchParams();
|
||||
const pathname = usePathname();
|
||||
const { resetState, gotoState, gotoEmbedTypeSelectionState } =
|
||||
useEmbedGoto(noQueryParamMode);
|
||||
const { resetState, gotoState, gotoEmbedTypeSelectionState } = useEmbedGoto(noQueryParamMode);
|
||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||
const dialogContentRef = useRef<HTMLDivElement>(null);
|
||||
const emailContentRef = useRef<HTMLDivElement>(null);
|
||||
@@ -844,10 +765,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
}),
|
||||
};
|
||||
});
|
||||
const embedCodeRefs: Record<
|
||||
(typeof tabs)[0]["name"],
|
||||
RefObject<HTMLTextAreaElement>
|
||||
> = {};
|
||||
const embedCodeRefs: Record<(typeof tabs)[0]["name"], RefObject<HTMLTextAreaElement>> = {};
|
||||
tabs
|
||||
.filter((tab) => tab.type === "code")
|
||||
.forEach((codeTab) => {
|
||||
@@ -856,14 +774,10 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
|
||||
const refOfEmbedCodesRefs = useRef(embedCodeRefs);
|
||||
const embed = types.find((embed) => embed.type === embedType);
|
||||
const [selectedDuration, setSelectedDuration] = useState(
|
||||
eventTypeData?.eventType.length
|
||||
);
|
||||
const [selectedDuration, setSelectedDuration] = useState(eventTypeData?.eventType.length);
|
||||
|
||||
const [isEmbedCustomizationOpen, setIsEmbedCustomizationOpen] =
|
||||
useState(true);
|
||||
const [isBookingCustomizationOpen, setIsBookingCustomizationOpen] =
|
||||
useState(true);
|
||||
const [isEmbedCustomizationOpen, setIsEmbedCustomizationOpen] = useState(true);
|
||||
const [isBookingCustomizationOpen, setIsBookingCustomizationOpen] = useState(true);
|
||||
const defaultConfig = {
|
||||
layout: BookerLayouts.MONTH_VIEW,
|
||||
useSlotsViewOnSmallScreen: "true" as const,
|
||||
@@ -941,13 +855,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
);
|
||||
};
|
||||
|
||||
const inlineEmbedDimensionUpdate = ({
|
||||
width,
|
||||
height,
|
||||
}: {
|
||||
width: string;
|
||||
height: string;
|
||||
}) => {
|
||||
const inlineEmbedDimensionUpdate = ({ width, height }: { width: string; height: string }) => {
|
||||
iframeRef.current?.contentWindow?.postMessage(
|
||||
{
|
||||
mode: "cal:preview",
|
||||
@@ -1039,22 +947,18 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
enableOverflow
|
||||
ref={dialogContentRef}
|
||||
className="rounded-lg p-0.5 sm:max-w-7xl!"
|
||||
type="creation"
|
||||
>
|
||||
type="creation">
|
||||
<div className="flex">
|
||||
<div className="bg-cal-muted flex h-[95vh] w-1/3 flex-col overflow-y-auto p-8">
|
||||
<h3
|
||||
className="text-emphasis mb-2.5 flex items-center text-xl font-semibold leading-5"
|
||||
id="modal-title"
|
||||
>
|
||||
id="modal-title">
|
||||
<button className="h-6 w-6" onClick={gotoEmbedTypeSelectionState}>
|
||||
<Icon name="arrow-left" className="mr-4 w-4" />
|
||||
</button>
|
||||
{embed.title}
|
||||
</h3>
|
||||
<h4 className="text-subtle mb-6 text-sm font-normal">
|
||||
{embed.subtitle}
|
||||
</h4>
|
||||
<h4 className="text-subtle mb-6 text-sm font-normal">{embed.subtitle}</h4>
|
||||
{eventTypeData?.eventType && embedType === "email" ? (
|
||||
<EmailEmbed
|
||||
eventType={eventTypeData?.eventType}
|
||||
@@ -1067,82 +971,68 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
/>
|
||||
) : (
|
||||
<div className="flex flex-col">
|
||||
<div
|
||||
className={classNames(
|
||||
"font-medium",
|
||||
embedType === "element-click" ? "hidden" : ""
|
||||
)}
|
||||
>
|
||||
<div className={classNames("font-medium", embedType === "element-click" ? "hidden" : "")}>
|
||||
<Collapsible
|
||||
open={isEmbedCustomizationOpen}
|
||||
onOpenChange={() =>
|
||||
setIsEmbedCustomizationOpen((val) => !val)
|
||||
}
|
||||
>
|
||||
onOpenChange={() => setIsEmbedCustomizationOpen((val) => !val)}>
|
||||
<CollapsibleContent className="text-sm">
|
||||
{/* Conditionally render Window Sizing only if inline embed AND NOT React Atom */}
|
||||
{embedType === "inline" &&
|
||||
embedParams.embedTabName !== EmbedTabName.ATOM_REACT && (
|
||||
<div>
|
||||
{/*TODO: Add Auto/Fixed toggle from Figma */}
|
||||
<div className="text-default mb-[9px] text-sm">
|
||||
Window sizing
|
||||
</div>
|
||||
<div className="justify-left mb-6 flex items-center font-normal! ">
|
||||
<div className="mr-[9px]">
|
||||
<TextField
|
||||
labelProps={{ className: "hidden" }}
|
||||
className="focus:ring-offset-0"
|
||||
required
|
||||
value={previewState.inline.width}
|
||||
onChange={(e) => {
|
||||
setPreviewState((previewState) => {
|
||||
const width = e.target.value || "100%";
|
||||
|
||||
return {
|
||||
...previewState,
|
||||
inline: {
|
||||
...previewState.inline,
|
||||
width,
|
||||
},
|
||||
};
|
||||
});
|
||||
}}
|
||||
addOnLeading={<>W</>}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{embedType === "inline" && embedParams.embedTabName !== EmbedTabName.ATOM_REACT && (
|
||||
<div>
|
||||
{/*TODO: Add Auto/Fixed toggle from Figma */}
|
||||
<div className="text-default mb-[9px] text-sm">Window sizing</div>
|
||||
<div className="justify-left mb-6 flex items-center font-normal! ">
|
||||
<div className="mr-[9px]">
|
||||
<TextField
|
||||
labelProps={{ className: "hidden" }}
|
||||
className="focus:ring-offset-0"
|
||||
value={previewState.inline.height}
|
||||
required
|
||||
value={previewState.inline.width}
|
||||
onChange={(e) => {
|
||||
const height = e.target.value || "100%";
|
||||
|
||||
setPreviewState((previewState) => {
|
||||
const width = e.target.value || "100%";
|
||||
|
||||
return {
|
||||
...previewState,
|
||||
inline: {
|
||||
...previewState.inline,
|
||||
height,
|
||||
width,
|
||||
},
|
||||
};
|
||||
});
|
||||
}}
|
||||
addOnLeading={<>H</>}
|
||||
addOnLeading={<>W</>}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<TextField
|
||||
labelProps={{ className: "hidden" }}
|
||||
className="focus:ring-offset-0"
|
||||
value={previewState.inline.height}
|
||||
required
|
||||
onChange={(e) => {
|
||||
const height = e.target.value || "100%";
|
||||
|
||||
setPreviewState((previewState) => {
|
||||
return {
|
||||
...previewState,
|
||||
inline: {
|
||||
...previewState.inline,
|
||||
height,
|
||||
},
|
||||
};
|
||||
});
|
||||
}}
|
||||
addOnLeading={<>H</>}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={classNames(
|
||||
"items-center justify-between",
|
||||
embedType === "floating-popup"
|
||||
? "text-emphasis"
|
||||
: "hidden"
|
||||
)}
|
||||
>
|
||||
embedType === "floating-popup" ? "text-emphasis" : "hidden"
|
||||
)}>
|
||||
<div className="mb-2 text-sm">Button text</div>
|
||||
{/* Default Values should come from preview iframe */}
|
||||
<TextField
|
||||
@@ -1168,8 +1058,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
embedType === "floating-popup"
|
||||
? "text-emphasis space-x-2 rtl:space-x-reverse"
|
||||
: "hidden"
|
||||
)}
|
||||
>
|
||||
)}>
|
||||
<Switch
|
||||
defaultChecked={true}
|
||||
onCheckedChange={(checked) => {
|
||||
@@ -1184,18 +1073,13 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<div className="text-default my-2 text-sm">
|
||||
Display calendar icon
|
||||
</div>
|
||||
<div className="text-default my-2 text-sm">Display calendar icon</div>
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mt-4 items-center justify-between",
|
||||
embedType === "floating-popup"
|
||||
? "text-emphasis"
|
||||
: "hidden"
|
||||
)}
|
||||
>
|
||||
embedType === "floating-popup" ? "text-emphasis" : "hidden"
|
||||
)}>
|
||||
<div className="mb-2">Position of button</div>
|
||||
<Select
|
||||
onChange={(position) => {
|
||||
@@ -1214,12 +1098,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-3 flex flex-col xl:flex-row xl:justify-between">
|
||||
<div
|
||||
className={classNames(
|
||||
"mt-4",
|
||||
embedType === "floating-popup" ? "" : "hidden"
|
||||
)}
|
||||
>
|
||||
<div className={classNames("mt-4", embedType === "floating-popup" ? "" : "hidden")}>
|
||||
<div className="whitespace-nowrap">Button color</div>
|
||||
<div className="mt-2 w-40 xl:mt-0 xl:w-full">
|
||||
<ColorPicker
|
||||
@@ -1241,12 +1120,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mt-4",
|
||||
embedType === "floating-popup" ? "" : "hidden"
|
||||
)}
|
||||
>
|
||||
<div className={classNames("mt-4", embedType === "floating-popup" ? "" : "hidden")}>
|
||||
<div className="whitespace-nowrap">Text color</div>
|
||||
<div className="mb-6 mt-2 w-40 xl:mt-0 xl:w-full">
|
||||
<ColorPicker
|
||||
@@ -1275,10 +1149,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
<div className="font-medium">
|
||||
<Collapsible
|
||||
open={isBookingCustomizationOpen}
|
||||
onOpenChange={() =>
|
||||
setIsBookingCustomizationOpen((val) => !val)
|
||||
}
|
||||
>
|
||||
onOpenChange={() => setIsBookingCustomizationOpen((val) => !val)}>
|
||||
<CollapsibleContent>
|
||||
<div className="text-sm">
|
||||
{/* Conditionally render EmbedTheme only if NOT React Atom */}
|
||||
@@ -1298,9 +1169,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
}
|
||||
setPreviewState((previewState) => {
|
||||
// Ensure theme is updated in config for all embed types
|
||||
const newConfig = (
|
||||
currentConfig?: EmbedConfig
|
||||
) => ({
|
||||
const newConfig = (currentConfig?: EmbedConfig) => ({
|
||||
...(currentConfig ?? {}),
|
||||
theme: option.value,
|
||||
});
|
||||
@@ -1308,21 +1177,15 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
...previewState,
|
||||
inline: {
|
||||
...previewState.inline,
|
||||
config: newConfig(
|
||||
previewState.inline.config
|
||||
),
|
||||
config: newConfig(previewState.inline.config),
|
||||
},
|
||||
floatingPopup: {
|
||||
...previewState.floatingPopup,
|
||||
config: newConfig(
|
||||
previewState.floatingPopup.config
|
||||
),
|
||||
config: newConfig(previewState.floatingPopup.config),
|
||||
},
|
||||
elementClick: {
|
||||
...previewState.elementClick,
|
||||
config: newConfig(
|
||||
previewState.elementClick.config
|
||||
),
|
||||
config: newConfig(previewState.elementClick.config),
|
||||
},
|
||||
// Keep updating top-level theme for preview iframe
|
||||
theme: option.value,
|
||||
@@ -1348,9 +1211,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<div className="text-default text-sm">
|
||||
{t("hide_eventtype_details")}
|
||||
</div>
|
||||
<div className="text-default text-sm">{t("hide_eventtype_details")}</div>
|
||||
</div>
|
||||
) : null}
|
||||
{/* Conditionally render Brand Colors only if NOT React Atom */}
|
||||
@@ -1369,14 +1230,11 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
<div className="w-full">
|
||||
<ColorPicker
|
||||
popoverAlign="start"
|
||||
container={
|
||||
dialogContentRef?.current ?? undefined
|
||||
}
|
||||
container={dialogContentRef?.current ?? undefined}
|
||||
defaultValue={paletteDefaultValue(palette.name)}
|
||||
onChange={(color) => {
|
||||
addToPalette({
|
||||
[palette.name as keyof (typeof previewState)["palette"]]:
|
||||
color,
|
||||
[palette.name as keyof (typeof previewState)["palette"]]: color,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
@@ -1394,9 +1252,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
}
|
||||
setPreviewState((previewState) => {
|
||||
// Ensure layout is updated in config for all embed types
|
||||
const newConfig = (
|
||||
currentConfig?: EmbedConfig
|
||||
) => ({
|
||||
const newConfig = (currentConfig?: EmbedConfig) => ({
|
||||
...(currentConfig ?? {}),
|
||||
layout: option.value,
|
||||
});
|
||||
@@ -1408,15 +1264,11 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
},
|
||||
floatingPopup: {
|
||||
...previewState.floatingPopup,
|
||||
config: newConfig(
|
||||
previewState.floatingPopup.config
|
||||
),
|
||||
config: newConfig(previewState.floatingPopup.config),
|
||||
},
|
||||
elementClick: {
|
||||
...previewState.elementClick,
|
||||
config: newConfig(
|
||||
previewState.elementClick.config
|
||||
),
|
||||
config: newConfig(previewState.elementClick.config),
|
||||
},
|
||||
// Keep updating top-level layout for preview iframe
|
||||
layout: option.value,
|
||||
@@ -1452,11 +1304,8 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
<div
|
||||
key={tab.href}
|
||||
className={classNames(
|
||||
embedParams.embedTabName === tab.href.split("=")[1]
|
||||
? "flex-1"
|
||||
: "hidden"
|
||||
)}
|
||||
>
|
||||
embedParams.embedTabName === tab.href.split("=")[1] ? "flex-1" : "hidden"
|
||||
)}>
|
||||
{tab.type === "code" && (
|
||||
<tab.Component
|
||||
namespace={namespace}
|
||||
@@ -1467,27 +1316,16 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
className={
|
||||
embedParams.embedTabName === "embed-preview"
|
||||
? "mt-2 block"
|
||||
: "hidden"
|
||||
}
|
||||
className={embedParams.embedTabName === "embed-preview" ? "mt-2 block" : "hidden"}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
embedType === "email" &&
|
||||
(tab.name !== "Preview" || !eventTypeData?.eventType)
|
||||
)
|
||||
return;
|
||||
if (embedType === "email" && (tab.name !== "Preview" || !eventTypeData?.eventType)) return;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={tab.href}
|
||||
className={classNames("flex grow flex-col")}
|
||||
>
|
||||
<div key={tab.href} className={classNames("flex grow flex-col")}>
|
||||
<div className="flex h-[55vh] grow flex-col">
|
||||
<EmailEmbedPreview
|
||||
selectedDuration={selectedDuration}
|
||||
@@ -1499,20 +1337,12 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
month={month as string}
|
||||
selectedDateAndTime={
|
||||
selectedDatesAndTimes
|
||||
? selectedDatesAndTimes[
|
||||
eventTypeData?.eventType.slug as string
|
||||
]
|
||||
? selectedDatesAndTimes[eventTypeData?.eventType.slug as string]
|
||||
: {}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
embedParams.embedTabName === "embed-preview"
|
||||
? "mt-2 block"
|
||||
: "hidden"
|
||||
}
|
||||
/>
|
||||
<div className={embedParams.embedTabName === "embed-preview" ? "mt-2 block" : "hidden"} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@@ -1529,10 +1359,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<DialogFooter
|
||||
className="mt-10 flex-row-reverse gap-x-2"
|
||||
showDivider
|
||||
>
|
||||
<DialogFooter className="mt-10 flex-row-reverse gap-x-2" showDivider>
|
||||
<DialogClose />
|
||||
<Button
|
||||
type="submit"
|
||||
@@ -1545,16 +1372,14 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
(tab) => tab.href === `embedTabName=${currentTabHref}`
|
||||
)?.name;
|
||||
if (!currentTabName) return;
|
||||
const currentTabCodeEl =
|
||||
refOfEmbedCodesRefs.current[currentTabName].current;
|
||||
const currentTabCodeEl = refOfEmbedCodesRefs.current[currentTabName].current;
|
||||
if (!currentTabCodeEl) {
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(currentTabCodeEl.value);
|
||||
showToast(t("code_copied"), "success");
|
||||
}
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{embedType === "email" ? t("copy") : t("copy_code")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
@@ -1593,13 +1418,9 @@ export const EmbedDialog = ({
|
||||
// Must not set name when noQueryParam mode as required by Dialog component
|
||||
name: "embed",
|
||||
clearQueryParamsOnClose: queryParamsForDialog,
|
||||
})}
|
||||
>
|
||||
})}>
|
||||
{!embedParams.embedType ? (
|
||||
<ChooseEmbedTypesDialogContent
|
||||
types={types}
|
||||
noQueryParamMode={noQueryParamMode}
|
||||
/>
|
||||
<ChooseEmbedTypesDialogContent types={types} noQueryParamMode={noQueryParamMode} />
|
||||
) : (
|
||||
<EmbedTypeCodeAndPreviewDialogContent
|
||||
embedType={embedParams.embedType as EmbedType}
|
||||
@@ -1657,8 +1478,7 @@ export const EmbedButton = <T extends React.ElementType = typeof Button>({
|
||||
data-test-embed-url={embedUrl}
|
||||
data-testid="embed"
|
||||
type="button"
|
||||
onClick={openEmbedModal}
|
||||
>
|
||||
onClick={openEmbedModal}>
|
||||
{children}
|
||||
</Component>
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ export const RoutingFormEmbedDialog = () => {
|
||||
const { t } = useLocale();
|
||||
const { data: user } = trpc.viewer.me.get.useQuery();
|
||||
const routingFormTypes = types.filter((type) => type.type !== "email");
|
||||
|
||||
|
||||
// Add the headless option specifically for routing forms
|
||||
const headlessType = {
|
||||
title: t("use_my_own_form"),
|
||||
@@ -60,10 +60,8 @@ export const RoutingFormEmbedDialog = () => {
|
||||
),
|
||||
};
|
||||
|
||||
const routingFormTypesWithHeadless = IS_CALCOM
|
||||
? [...routingFormTypes, headlessType]
|
||||
: routingFormTypes;
|
||||
|
||||
const routingFormTypesWithHeadless = IS_CALCOM ? [...routingFormTypes, headlessType] : routingFormTypes;
|
||||
|
||||
return (
|
||||
<EmbedDialog
|
||||
types={routingFormTypesWithHeadless}
|
||||
|
||||
@@ -16,7 +16,10 @@ import type { Options } from "react-select";
|
||||
import { AddMembersWithSwitchWebWrapper } from "./AddMembersWithSwitchWebWrapper";
|
||||
|
||||
import AssignAllTeamMembers from "@calcom/features/eventtypes/components/AssignAllTeamMembers";
|
||||
import type { CheckedSelectOption, CheckedTeamSelectCustomClassNames } from "@calcom/features/eventtypes/components/CheckedTeamSelect";
|
||||
import type {
|
||||
CheckedSelectOption,
|
||||
CheckedTeamSelectCustomClassNames,
|
||||
} from "@calcom/features/eventtypes/components/CheckedTeamSelect";
|
||||
import CheckedTeamSelect from "@calcom/features/eventtypes/components/CheckedTeamSelect";
|
||||
|
||||
interface IUserToValue {
|
||||
|
||||
@@ -158,7 +158,7 @@ const DuplicateDialog = () => {
|
||||
</>
|
||||
}
|
||||
{...register("slug")}
|
||||
onChange={(e) => {
|
||||
onChange={(e) => {
|
||||
form.setValue("slug", slugify(e?.target.value), { shouldTouch: true });
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -2,7 +2,10 @@ import { useMemo, useState, Suspense } from "react";
|
||||
import type { UseFormReturn } from "react-hook-form";
|
||||
|
||||
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
|
||||
import { EventTypeEmbedButton, EventTypeEmbedDialog } from "@calcom/web/modules/embed/components/EventTypeEmbed";
|
||||
import {
|
||||
EventTypeEmbedButton,
|
||||
EventTypeEmbedDialog,
|
||||
} from "@calcom/web/modules/embed/components/EventTypeEmbed";
|
||||
import type { FormValues } from "@calcom/features/eventtypes/lib/types";
|
||||
import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
@@ -85,11 +88,13 @@ function EventTypeSingleLayout({
|
||||
formMethods,
|
||||
});
|
||||
const EventTypeTabs = tabsNavigation;
|
||||
const permalink = `${bookerUrl}/${team ? `${!team.parentId ? "team/" : ""}${team.slug}` : formMethods.getValues("users")[0].username
|
||||
}/${eventType.slug}`;
|
||||
const permalink = `${bookerUrl}/${
|
||||
team ? `${!team.parentId ? "team/" : ""}${team.slug}` : formMethods.getValues("users")[0].username
|
||||
}/${eventType.slug}`;
|
||||
|
||||
const embedLink = `${team ? `team/${team.slug}` : formMethods.getValues("users")[0].username
|
||||
}/${formMethods.getValues("slug")}`;
|
||||
const embedLink = `${
|
||||
team ? `team/${team.slug}` : formMethods.getValues("users")[0].username
|
||||
}/${formMethods.getValues("slug")}`;
|
||||
const isManagedEvent = formMethods.getValues("schedulingType") === SchedulingType.MANAGED ? "_managed" : "";
|
||||
|
||||
const [Shell] = useMemo(() => {
|
||||
|
||||
@@ -45,30 +45,27 @@ type EventPermissions = {
|
||||
};
|
||||
};
|
||||
|
||||
const ManagedEventTypeDialog = dynamic(() =>
|
||||
import("@calcom/features/eventtypes/components/dialogs/ManagedEventDialog")
|
||||
const ManagedEventTypeDialog = dynamic(
|
||||
() => import("@calcom/features/eventtypes/components/dialogs/ManagedEventDialog")
|
||||
);
|
||||
|
||||
const AssignmentWarningDialog = dynamic(() => import("./dialogs/AssignmentWarningDialog"));
|
||||
|
||||
const EventSetupTab = dynamic(
|
||||
() => import("./tabs/setup/EventSetupTabWebWrapper").then((mod) => mod),
|
||||
{ loading: () => null }
|
||||
);
|
||||
const EventSetupTab = dynamic(() => import("./tabs/setup/EventSetupTabWebWrapper").then((mod) => mod), {
|
||||
loading: () => null,
|
||||
});
|
||||
|
||||
const EventAvailabilityTab = dynamic(() =>
|
||||
import("./tabs/availability/EventAvailabilityTabWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventTeamAssignmentTab = dynamic(() => import("./tabs/assignment/EventTeamAssignmentTabWebWrapper").then((mod) => mod));
|
||||
|
||||
const EventLimitsTab = dynamic(() =>
|
||||
import("./tabs/limits/EventLimitsTabWebWrapper").then((mod) => mod)
|
||||
const EventTeamAssignmentTab = dynamic(() =>
|
||||
import("./tabs/assignment/EventTeamAssignmentTabWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventAdvancedTab = dynamic(() =>
|
||||
import("./tabs/advanced/EventAdvancedWebWrapper").then((mod) => mod)
|
||||
);
|
||||
const EventLimitsTab = dynamic(() => import("./tabs/limits/EventLimitsTabWebWrapper").then((mod) => mod));
|
||||
|
||||
const EventAdvancedTab = dynamic(() => import("./tabs/advanced/EventAdvancedWebWrapper").then((mod) => mod));
|
||||
|
||||
const EventInstantTab = dynamic(() =>
|
||||
import("./tabs/instant/EventInstantTab").then((mod) => mod.EventInstantTab)
|
||||
@@ -78,9 +75,7 @@ const EventRecurringTab = dynamic(() =>
|
||||
import("./tabs/recurring/EventRecurringWebWrapper").then((mod) => mod)
|
||||
);
|
||||
|
||||
const EventAppsTab = dynamic(() =>
|
||||
import("./tabs/apps/EventAppsTab").then((mod) => mod.EventAppsTab)
|
||||
);
|
||||
const EventAppsTab = dynamic(() => import("./tabs/apps/EventAppsTab").then((mod) => mod.EventAppsTab));
|
||||
|
||||
const EventWorkflowsTab = dynamic(() => import("./tabs/workflows/EventWorkflowsTab"));
|
||||
|
||||
@@ -88,9 +83,7 @@ const EventWebhooksTab = dynamic(() =>
|
||||
import("./tabs/webhooks/EventWebhooksTab").then((mod) => mod.EventWebhooksTab)
|
||||
);
|
||||
|
||||
const EventAITab = dynamic(() =>
|
||||
import("./tabs/ai/EventAITab").then((mod) => mod.EventAITab)
|
||||
);
|
||||
const EventAITab = dynamic(() => import("./tabs/ai/EventAITab").then((mod) => mod.EventAITab));
|
||||
|
||||
export type EventTypeWebWrapperProps = {
|
||||
id: number;
|
||||
|
||||
@@ -111,8 +111,8 @@ function MatchingTeamMembers({
|
||||
// Check if queryValue has valid children properties value
|
||||
const hasValidValue = queryValue?.children1
|
||||
? Object.values(queryValue.children1).some(
|
||||
(child) => child.properties?.value?.[0] !== undefined && child.properties?.value?.[0] !== null
|
||||
)
|
||||
(child) => child.properties?.value?.[0] !== undefined && child.properties?.value?.[0] !== null
|
||||
)
|
||||
: false;
|
||||
|
||||
const { data: matchingTeamMembersWithResult, isPending } =
|
||||
|
||||
@@ -170,7 +170,12 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
|
||||
/>
|
||||
|
||||
<TextField
|
||||
label={<div className="flex gap-1 items-center">{t("redirect_url")}<InfoBadge content={t("enter_redirect_url_on_exit_description")} /></div>}
|
||||
label={
|
||||
<div className="flex gap-1 items-center">
|
||||
{t("redirect_url")}
|
||||
<InfoBadge content={t("enter_redirect_url_on_exit_description")} />
|
||||
</div>
|
||||
}
|
||||
defaultValue={calVideoSettings?.redirectUrlOnExit || ""}
|
||||
data-testid="calVideoSettings.redirectUrlOnExit"
|
||||
containerClassName="mt-4"
|
||||
|
||||
@@ -314,9 +314,15 @@ const HostLocationRow = ({
|
||||
return (
|
||||
<>
|
||||
<div className="border-subtle flex items-center gap-3 border-b px-3 py-3 last:border-b-0">
|
||||
<Avatar size="sm" imageSrc={hostData?.avatarUrl || undefined} alt={hostData?.name || `${t("user")} ${host.userId}`} />
|
||||
<Avatar
|
||||
size="sm"
|
||||
imageSrc={hostData?.avatarUrl || undefined}
|
||||
alt={hostData?.name || `${t("user")} ${host.userId}`}
|
||||
/>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="text-emphasis truncate text-sm font-medium">{hostData?.name || `${t("user")} ${host.userId}`}</div>
|
||||
<div className="text-emphasis truncate text-sm font-medium">
|
||||
{hostData?.name || `${t("user")} ${host.userId}`}
|
||||
</div>
|
||||
{hostData?.email && <div className="text-subtle truncate text-xs">{hostData.email}</div>}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -363,7 +369,10 @@ const HostLocationRow = ({
|
||||
locationOption={pendingLocationOption}
|
||||
onSave={(inputValue) => {
|
||||
if (!pendingLocationOption) return;
|
||||
onLocationChange(host.userId, buildHostLocation(host.userId, eventTypeId, pendingLocationOption, hostData, inputValue));
|
||||
onLocationChange(
|
||||
host.userId,
|
||||
buildHostLocation(host.userId, eventTypeId, pendingLocationOption, hostData, inputValue)
|
||||
);
|
||||
setPendingLocationOption(null);
|
||||
}}
|
||||
title="set_location"
|
||||
|
||||
+5
-4
@@ -46,8 +46,9 @@ export default function DisableReschedulingController({
|
||||
|
||||
const [shouldShowRadioButtons, setShouldShowRadioButtons] = useState(
|
||||
disableRescheduling ||
|
||||
(currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0) ||
|
||||
eventType.disableRescheduling === true || false
|
||||
(currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0) ||
|
||||
eventType.disableRescheduling === true ||
|
||||
false
|
||||
);
|
||||
useEffect(() => {
|
||||
if (currentMinimumRescheduleNotice && currentMinimumRescheduleNotice > 0) {
|
||||
@@ -108,8 +109,8 @@ export default function DisableReschedulingController({
|
||||
disableRescheduling
|
||||
? "always"
|
||||
: currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0
|
||||
? "notice"
|
||||
: "always"
|
||||
? "notice"
|
||||
: "always"
|
||||
}
|
||||
onValueChange={(val) => {
|
||||
const handler = (val: string) => {
|
||||
|
||||
@@ -1079,10 +1079,10 @@ export const EventAdvancedTab = ({
|
||||
multiLocation
|
||||
? t("multilocation_doesnt_support_seats")
|
||||
: noShowFeeEnabled
|
||||
? t("no_show_fee_doesnt_support_seats")
|
||||
: isRecurringEvent
|
||||
? t("recurring_event_doesnt_support_seats")
|
||||
: undefined
|
||||
? t("no_show_fee_doesnt_support_seats")
|
||||
: isRecurringEvent
|
||||
? t("recurring_event_doesnt_support_seats")
|
||||
: undefined
|
||||
}
|
||||
onCheckedChange={(e) => {
|
||||
// Enabling seats will disable guests and requiring confirmation until fully supported
|
||||
@@ -1113,7 +1113,7 @@ export const EventAdvancedTab = ({
|
||||
type="number"
|
||||
disabled={seatsLocked.disabled}
|
||||
//For old events if value > MAX_SEATS_PER_TIME_SLOT
|
||||
value={value > MAX_SEATS_PER_TIME_SLOT ? MAX_SEATS_PER_TIME_SLOT : value ?? 1}
|
||||
value={value > MAX_SEATS_PER_TIME_SLOT ? MAX_SEATS_PER_TIME_SLOT : (value ?? 1)}
|
||||
step={1}
|
||||
placeholder="1"
|
||||
min={1}
|
||||
@@ -1244,7 +1244,7 @@ export const EventAdvancedTab = ({
|
||||
checked={value}
|
||||
onCheckedChange={(e) => {
|
||||
onChange(e);
|
||||
const lockedTimeZone = e ? eventType.lockedTimeZone ?? "Europe/London" : null;
|
||||
const lockedTimeZone = e ? (eventType.lockedTimeZone ?? "Europe/London") : null;
|
||||
formMethods.setValue("lockedTimeZone", lockedTimeZone, { shouldDirty: true });
|
||||
}}
|
||||
data-testid="lock-timezone-toggle"
|
||||
|
||||
@@ -152,7 +152,9 @@ export const FormBuilder = function FormBuilder({
|
||||
{LockedIcon}
|
||||
</div>
|
||||
<div className="flex items-start justify-between">
|
||||
<p className="text-subtle mt-1 max-w-[280px] wrap-break-word text-sm sm:max-w-[500px]">{description}</p>
|
||||
<p className="text-subtle mt-1 max-w-[280px] wrap-break-word text-sm sm:max-w-[500px]">
|
||||
{description}
|
||||
</p>
|
||||
{showPhoneAndEmailToggle && (
|
||||
<ToggleGroup
|
||||
value={(() => {
|
||||
@@ -256,15 +258,18 @@ export const FormBuilder = function FormBuilder({
|
||||
if (!fieldType) {
|
||||
throw new Error(`Invalid field type - ${field.type}`);
|
||||
}
|
||||
const groupedBySourceLabel = sources.reduce((groupBy, source) => {
|
||||
const item = groupBy[source.label] || [];
|
||||
if (source.type === "user" || source.type === "default") {
|
||||
const groupedBySourceLabel = sources.reduce(
|
||||
(groupBy, source) => {
|
||||
const item = groupBy[source.label] || [];
|
||||
if (source.type === "user" || source.type === "default") {
|
||||
return groupBy;
|
||||
}
|
||||
item.push(source);
|
||||
groupBy[source.label] = item;
|
||||
return groupBy;
|
||||
}
|
||||
item.push(source);
|
||||
groupBy[source.label] = item;
|
||||
return groupBy;
|
||||
}, {} as Record<string, NonNullable<(typeof field)["sources"]>>);
|
||||
},
|
||||
{} as Record<string, NonNullable<(typeof field)["sources"]>>
|
||||
);
|
||||
|
||||
return (
|
||||
<li
|
||||
@@ -1056,4 +1061,4 @@ function VariantFields({
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
EventTeamAssignmentTab,
|
||||
type EventTeamAssignmentTabBaseProps,
|
||||
} from "./EventTeamAssignmentTab";
|
||||
import { EventTeamAssignmentTab, type EventTeamAssignmentTabBaseProps } from "./EventTeamAssignmentTab";
|
||||
|
||||
const EventTeamAssignmentTabWebWrapper = (
|
||||
props: Omit<EventTeamAssignmentTabBaseProps, "isSegmentApplicable">
|
||||
|
||||
@@ -479,15 +479,17 @@ const EventTypeSchedule = ({
|
||||
|
||||
if (schedulesQueryData.length === 0) {
|
||||
return (
|
||||
<EmptyScreen
|
||||
Icon="clock"
|
||||
headline={t("create_availability_schedule")}
|
||||
description={t("no_schedules_created_yet")}
|
||||
className="w-full"
|
||||
buttonRaw={<Button href="/availability" StartIcon="plus">
|
||||
<EmptyScreen
|
||||
Icon="clock"
|
||||
headline={t("create_availability_schedule")}
|
||||
description={t("no_schedules_created_yet")}
|
||||
className="w-full"
|
||||
buttonRaw={
|
||||
<Button href="/availability" StartIcon="plus">
|
||||
{t("create")}
|
||||
</Button>}
|
||||
/>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@ const EventLimitsTabWebWrapper = (props: EventLimitsTabProps) => {
|
||||
return <EventLimitsTab {...props} />;
|
||||
};
|
||||
|
||||
export default EventLimitsTabWebWrapper;
|
||||
export default EventLimitsTabWebWrapper;
|
||||
@@ -5,4 +5,4 @@ const EventRecurringWebWrapper = (props: EventRecurringTabProps) => {
|
||||
return <EventRecurringTab {...props} />;
|
||||
};
|
||||
|
||||
export default EventRecurringWebWrapper;
|
||||
export default EventRecurringWebWrapper;
|
||||
@@ -16,7 +16,14 @@ import turndown from "@calcom/lib/turndownService";
|
||||
import { SchedulingType } from "@calcom/prisma/enums";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Editor } from "@calcom/ui/components/editor";
|
||||
import { CheckboxField, Label, Select, SettingsToggle, TextAreaField, TextField } from "@calcom/ui/components/form";
|
||||
import {
|
||||
CheckboxField,
|
||||
Label,
|
||||
Select,
|
||||
SettingsToggle,
|
||||
TextAreaField,
|
||||
TextField,
|
||||
} from "@calcom/ui/components/form";
|
||||
import { Skeleton } from "@calcom/ui/components/skeleton";
|
||||
import { Tooltip } from "@calcom/ui/components/tooltip";
|
||||
|
||||
@@ -144,10 +151,10 @@ export const EventSetupTab = (
|
||||
<Editor
|
||||
getText={() => md.render(formMethods.getValues("description") || "")}
|
||||
setText={(value: string) => {
|
||||
// Clean up non-breaking spaces
|
||||
const cleanedValue = value.replace(/ /g, ' ');
|
||||
const markdownValue = turndown(cleanedValue);
|
||||
formMethods.setValue("description", markdownValue, { shouldDirty: true });
|
||||
// Clean up non-breaking spaces
|
||||
const cleanedValue = value.replace(/ /g, " ");
|
||||
const markdownValue = turndown(cleanedValue);
|
||||
formMethods.setValue("description", markdownValue, { shouldDirty: true });
|
||||
}}
|
||||
excludedToolbarItems={["blockType"]}
|
||||
placeholder={t("quick_video_meeting")}
|
||||
|
||||
@@ -148,8 +148,8 @@ const WorkflowListItem = (props: ItemProps) => {
|
||||
workflow.readOnly && props.isChildrenManagedEventType
|
||||
? "locked_by_team_admin"
|
||||
: isActive
|
||||
? "turn_off"
|
||||
: "turn_on"
|
||||
? "turn_off"
|
||||
: "turn_on"
|
||||
) as string
|
||||
}>
|
||||
<div className="flex items-center ltr:mr-2 rtl:ml-2">
|
||||
@@ -203,7 +203,7 @@ function EventWorkflowsTab(props: Props) {
|
||||
const dataWf = data.workflows.find((wf) => wf.id === workflowOnEventType.id);
|
||||
return {
|
||||
...workflowOnEventType,
|
||||
readOnly: isChildrenManagedEventType && dataWf?.teamId ? true : dataWf?.readOnly ?? false,
|
||||
readOnly: isChildrenManagedEventType && dataWf?.teamId ? true : (dataWf?.readOnly ?? false),
|
||||
} as WorkflowType;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { type UseTeamMembersWithSegmentProps, useProcessTeamMembersData } from "@calcom/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform";
|
||||
import {
|
||||
type UseTeamMembersWithSegmentProps,
|
||||
useProcessTeamMembersData,
|
||||
} from "@calcom/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform";
|
||||
|
||||
export const useTeamMembersWithSegment = ({
|
||||
initialTeamMembers,
|
||||
|
||||
@@ -1105,4 +1105,4 @@ const EventTypesPage = ({ userEventGroupsData, user }: Props) => {
|
||||
|
||||
export const SearchContext: React.Context<SearchContextType | undefined> = SearchContextInternal;
|
||||
|
||||
export default EventTypesPage;
|
||||
export default EventTypesPage;
|
||||
@@ -173,11 +173,7 @@ export function AssignFeatureSheet({ flag, open, onOpenChange }: AssignFeatureSh
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Checkbox
|
||||
checked={team.hasFeature}
|
||||
disabled={isLoading}
|
||||
onCheckedChange={() => {}}
|
||||
/>
|
||||
<Checkbox checked={team.hasFeature} disabled={isLoading} onCheckedChange={() => {}} />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -17,14 +17,17 @@ export const FlagAdminList = () => {
|
||||
const [selectedFlag, setSelectedFlag] = useState<Flag | null>(null);
|
||||
const [sheetOpen, setSheetOpen] = useState(false);
|
||||
|
||||
const groupedFlags = data.reduce((acc, flag) => {
|
||||
const type = flag.type || "OTHER";
|
||||
if (!acc[type]) {
|
||||
acc[type] = [];
|
||||
}
|
||||
acc[type].push(flag);
|
||||
return acc;
|
||||
}, {} as Record<string, typeof data>);
|
||||
const groupedFlags = data.reduce(
|
||||
(acc, flag) => {
|
||||
const type = flag.type || "OTHER";
|
||||
if (!acc[type]) {
|
||||
acc[type] = [];
|
||||
}
|
||||
acc[type].push(flag);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, typeof data>
|
||||
);
|
||||
|
||||
const sortedTypes = Object.keys(groupedFlags).sort();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ type Component =
|
||||
name?: string;
|
||||
required?: boolean;
|
||||
translatedDefaultLabel?: string;
|
||||
}
|
||||
},
|
||||
>(
|
||||
props: TProps
|
||||
) => JSX.Element;
|
||||
@@ -79,7 +79,7 @@ type Component =
|
||||
variants: z.infer<typeof variantsConfigSchema>["variants"];
|
||||
value: Record<string, string> | string | undefined;
|
||||
setValue: (value: string | Record<string, string>) => void;
|
||||
}
|
||||
},
|
||||
>(
|
||||
props: TProps
|
||||
) => JSX.Element;
|
||||
@@ -179,8 +179,8 @@ export const Components: Record<FieldType, Component> = {
|
||||
variantField.name === "firstName"
|
||||
? "given-name"
|
||||
: variantField.name === "lastName"
|
||||
? "family-name"
|
||||
: undefined
|
||||
? "family-name"
|
||||
: undefined
|
||||
}
|
||||
onChange={(e) => onChange(variantField.name, e.target.value)}
|
||||
/>
|
||||
@@ -465,7 +465,7 @@ export const Components: Record<FieldType, Component> = {
|
||||
<span className="text-emphasis me-2 ms-2 text-sm">
|
||||
{option.value === "somewhereElse"
|
||||
? t("somewhere_else")
|
||||
: getCleanLabel(option.label) ?? ""}
|
||||
: (getCleanLabel(option.label) ?? "")}
|
||||
</span>
|
||||
<span>
|
||||
{option.value === "phone" && (
|
||||
|
||||
@@ -59,7 +59,8 @@ describe("FormBuilderField", () => {
|
||||
});
|
||||
|
||||
const component = {
|
||||
getFieldInput: ({ label }: { label: string }) => screen.getByRole("textbox", { name: label }) as HTMLInputElement,
|
||||
getFieldInput: ({ label }: { label: string }) =>
|
||||
screen.getByRole("textbox", { name: label }) as HTMLInputElement,
|
||||
fillFieldInput: ({ label, value }: { label: string; value: string }) => {
|
||||
fireEvent.change(component.getFieldInput({ label }), { target: { value } });
|
||||
},
|
||||
|
||||
@@ -25,9 +25,7 @@ const renderLabel = (field: Partial<RhfFormField>) => {
|
||||
if (field.labelAsSafeHtml) {
|
||||
return (
|
||||
// biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via markdownToSafeHTML
|
||||
<span
|
||||
dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(field.labelAsSafeHtml) }}
|
||||
/>
|
||||
<span dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(field.labelAsSafeHtml) }} />
|
||||
);
|
||||
}
|
||||
return <span>{field.label}</span>;
|
||||
|
||||
@@ -41,33 +41,33 @@ const getStepsAndHeadersForUser = (t: TFunction) => {
|
||||
subtitle: string[];
|
||||
skipText?: string;
|
||||
}[] = [
|
||||
{
|
||||
title: t("welcome_to_cal_header", { appName: APP_NAME }),
|
||||
subtitle: [t("we_just_need_basic_info")],
|
||||
},
|
||||
{
|
||||
title: t("connect_your_calendar"),
|
||||
subtitle: [t("connect_your_calendar_instructions")],
|
||||
skipText: t("connect_calendar_later"),
|
||||
},
|
||||
{
|
||||
title: t("connect_your_video_app"),
|
||||
subtitle: [t("connect_your_video_app_instructions")],
|
||||
skipText: t("set_up_later"),
|
||||
},
|
||||
{
|
||||
title: t("set_availability"),
|
||||
subtitle: [
|
||||
`${t("set_availability_getting_started_subtitle_1")} ${t(
|
||||
"set_availability_getting_started_subtitle_2"
|
||||
)}`,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t("nearly_there"),
|
||||
subtitle: [t("nearly_there_instructions")],
|
||||
},
|
||||
];
|
||||
{
|
||||
title: t("welcome_to_cal_header", { appName: APP_NAME }),
|
||||
subtitle: [t("we_just_need_basic_info")],
|
||||
},
|
||||
{
|
||||
title: t("connect_your_calendar"),
|
||||
subtitle: [t("connect_your_calendar_instructions")],
|
||||
skipText: t("connect_calendar_later"),
|
||||
},
|
||||
{
|
||||
title: t("connect_your_video_app"),
|
||||
subtitle: [t("connect_your_video_app_instructions")],
|
||||
skipText: t("set_up_later"),
|
||||
},
|
||||
{
|
||||
title: t("set_availability"),
|
||||
subtitle: [
|
||||
`${t("set_availability_getting_started_subtitle_1")} ${t(
|
||||
"set_availability_getting_started_subtitle_2"
|
||||
)}`,
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t("nearly_there"),
|
||||
subtitle: [t("nearly_there_instructions")],
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
steps: [...BASE_STEPS],
|
||||
|
||||
@@ -25,7 +25,7 @@ export function ChartCard({
|
||||
isPending,
|
||||
isError,
|
||||
...panelCardProps
|
||||
}: Omit<PanelCardProps, 'children'> & {
|
||||
}: Omit<PanelCardProps, "children"> & {
|
||||
legend?: Array<LegendItem>;
|
||||
legendSize?: LegendSize;
|
||||
enabledLegend?: Array<LegendItem>;
|
||||
|
||||
@@ -65,7 +65,6 @@ export const CSATOverTimeChart = () => {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
return (
|
||||
<ChartCard title={t("csat_over_time")} className="h-full" isPending={isPending} isError={isError}>
|
||||
{isSuccess ? (
|
||||
|
||||
@@ -22,7 +22,6 @@ export const HighestRatedMembersTable = () => {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<ChartCard title={t("highest_rated")} isPending={isPending} isError={isError}>
|
||||
{isSuccess && data ? <UserStatsTable data={data} /> : null}
|
||||
|
||||
@@ -22,7 +22,6 @@ export const LowestRatedMembersTable = () => {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<ChartCard title={t("lowest_rated")} isPending={isPending} isError={isError}>
|
||||
{isSuccess && data ? <UserStatsTable data={data} /> : null}
|
||||
|
||||
@@ -22,7 +22,6 @@ export const MostBookedTeamMembersTable = () => {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<ChartCard title={t("most_bookings_scheduled")} isPending={isPending} isError={isError}>
|
||||
{isSuccess && data ? <UserStatsTable data={data} /> : null}
|
||||
|
||||
@@ -11,16 +11,14 @@ export const MostCancelledBookingsTables = () => {
|
||||
const { t } = useLocale();
|
||||
const insightsBookingParams = useInsightsBookingParameters();
|
||||
|
||||
const { data, isSuccess, isPending, isError } = trpc.viewer.insights.membersWithMostCancelledBookings.useQuery(
|
||||
insightsBookingParams,
|
||||
{
|
||||
const { data, isSuccess, isPending, isError } =
|
||||
trpc.viewer.insights.membersWithMostCancelledBookings.useQuery(insightsBookingParams, {
|
||||
staleTime: 180000,
|
||||
refetchOnWindowFocus: false,
|
||||
trpc: {
|
||||
context: { skipBatch: true },
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<ChartCard title={t("most_cancelled_bookings")} isPending={isPending} isError={isError}>
|
||||
|
||||
@@ -67,7 +67,11 @@ export const NoShowHostsOverTimeChart = () => {
|
||||
});
|
||||
|
||||
return (
|
||||
<ChartCard title={t("no_show_hosts_over_time")} className="h-full" isPending={isPending} isError={isError}>
|
||||
<ChartCard
|
||||
title={t("no_show_hosts_over_time")}
|
||||
className="h-full"
|
||||
isPending={isPending}
|
||||
isError={isError}>
|
||||
{isSuccess ? (
|
||||
<div className="linechart ml-4 mt-4 h-80 sm:ml-0">
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
|
||||
@@ -10,13 +10,16 @@ export const PopularEventsTable = () => {
|
||||
const { t } = useLocale();
|
||||
const insightsBookingParams = useInsightsBookingParameters();
|
||||
|
||||
const { data, isSuccess, isPending, isError } = trpc.viewer.insights.popularEvents.useQuery(insightsBookingParams, {
|
||||
staleTime: 180000,
|
||||
refetchOnWindowFocus: false,
|
||||
trpc: {
|
||||
context: { skipBatch: true },
|
||||
},
|
||||
});
|
||||
const { data, isSuccess, isPending, isError } = trpc.viewer.insights.popularEvents.useQuery(
|
||||
insightsBookingParams,
|
||||
{
|
||||
staleTime: 180000,
|
||||
refetchOnWindowFocus: false,
|
||||
trpc: {
|
||||
context: { skipBatch: true },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<ChartCard title={t("popular_events")} isPending={isPending} isError={isError}>
|
||||
|
||||
@@ -11,14 +11,16 @@ export const RecentFeedbackTable = () => {
|
||||
const { t } = useLocale();
|
||||
const insightsBookingParams = useInsightsBookingParameters();
|
||||
|
||||
const { data, isSuccess, isPending, isError } = trpc.viewer.insights.recentRatings.useQuery(insightsBookingParams, {
|
||||
staleTime: 180000,
|
||||
refetchOnWindowFocus: false,
|
||||
trpc: {
|
||||
context: { skipBatch: true },
|
||||
},
|
||||
});
|
||||
|
||||
const { data, isSuccess, isPending, isError } = trpc.viewer.insights.recentRatings.useQuery(
|
||||
insightsBookingParams,
|
||||
{
|
||||
staleTime: 180000,
|
||||
refetchOnWindowFocus: false,
|
||||
trpc: {
|
||||
context: { skipBatch: true },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<ChartCard title={t("recent_ratings")} isPending={isPending} isError={isError}>
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useState } from "react";
|
||||
|
||||
import {
|
||||
FilterCheckboxField,
|
||||
FilterCheckboxFieldsContainer,
|
||||
} from "~/filters/components/TeamsFilter";
|
||||
import { FilterCheckboxField, FilterCheckboxFieldsContainer } from "~/filters/components/TeamsFilter";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
@@ -222,11 +222,14 @@ export function RoutedToPerPeriod() {
|
||||
});
|
||||
|
||||
return flattenedUsers.map((user) => {
|
||||
const stats = uniquePeriods.reduce((acc, period) => {
|
||||
const key = `${user.id}-${period.toISOString()}`;
|
||||
acc[period.toISOString()] = statsMap.get(key) ?? 0;
|
||||
return acc;
|
||||
}, {} as { [key: string]: number });
|
||||
const stats = uniquePeriods.reduce(
|
||||
(acc, period) => {
|
||||
const key = `${user.id}-${period.toISOString()}`;
|
||||
acc[period.toISOString()] = statsMap.get(key) ?? 0;
|
||||
return acc;
|
||||
},
|
||||
{} as { [key: string]: number }
|
||||
);
|
||||
|
||||
return {
|
||||
id: user.id,
|
||||
|
||||
@@ -14,7 +14,13 @@ import {
|
||||
ZSingleSelectFilterValue,
|
||||
type FilterableColumn,
|
||||
} from "@calcom/features/data-table";
|
||||
import { DataTableWrapper, DataTableFilters, DataTableSegment, DataTableSkeleton, DateRangeFilter } from "@calcom/web/modules/data-table/components";
|
||||
import {
|
||||
DataTableWrapper,
|
||||
DataTableFilters,
|
||||
DataTableSegment,
|
||||
DataTableSkeleton,
|
||||
DateRangeFilter,
|
||||
} from "@calcom/web/modules/data-table/components";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { useInsightsRoutingParameters } from "@calcom/web/modules/insights/hooks/useInsightsRoutingParameters";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user