refactor: Cal.diy (#28903)
* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: [email protected] <[email protected]> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
a17f28e9ab
commit
ab21c7f805
4080 files changed
+14403
-404922
No files matched your search
@@ -1,7 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import LicenseView from "./license-view";
|
||||
|
||||
export default function AdminBillingView() {
|
||||
return <LicenseView />;
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { signIn } from "next-auth/react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useRef, useEffect, useState } from "react";
|
||||
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { addRecentImpersonation } from "@calcom/lib/recentImpersonations";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { PanelCard } from "@calcom/ui/components/card";
|
||||
import { TextField } from "@calcom/ui/components/form";
|
||||
|
||||
import RecentImpersonationsList from "../../../components/settings/admin/RecentImpersonationsList";
|
||||
|
||||
const ImpersonationView = () => {
|
||||
const { t } = useLocale();
|
||||
const usernameRef = useRef<HTMLInputElement>(null);
|
||||
const searchParams = useSearchParams();
|
||||
const [refreshKey, setRefreshKey] = useState(0);
|
||||
|
||||
const username = searchParams?.get("username")?.toLowerCase();
|
||||
|
||||
useEffect(() => {
|
||||
if (username) {
|
||||
const enteredUsername = username.toLowerCase();
|
||||
addRecentImpersonation(enteredUsername);
|
||||
signIn("impersonation-auth", {
|
||||
username: enteredUsername,
|
||||
callbackUrl: `${WEBAPP_URL}/event-types`,
|
||||
});
|
||||
}
|
||||
}, [username]);
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
const enteredUsername = usernameRef.current?.value.toLowerCase();
|
||||
if (enteredUsername) {
|
||||
addRecentImpersonation(enteredUsername);
|
||||
setRefreshKey((prev) => prev + 1);
|
||||
signIn("impersonation-auth", {
|
||||
username: enteredUsername,
|
||||
callbackUrl: `${WEBAPP_URL}/event-types`,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleQuickImpersonate = (username: string) => {
|
||||
if (usernameRef.current) {
|
||||
usernameRef.current.value = username;
|
||||
}
|
||||
addRecentImpersonation(username);
|
||||
setRefreshKey((prev) => prev + 1);
|
||||
signIn("impersonation-auth", {
|
||||
username: username.toLowerCase(),
|
||||
callbackUrl: `${WEBAPP_URL}/event-types`,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<PanelCard title={t("user_impersonation_heading")} subtitle={t("impersonate_user_tip")}>
|
||||
<form className="p-4" onSubmit={handleSubmit}>
|
||||
<div className="flex items-center space-x-2 rtl:space-x-reverse">
|
||||
<TextField
|
||||
containerClassName="w-full"
|
||||
name=""
|
||||
addOnLeading={<>{process.env.NEXT_PUBLIC_WEBSITE_URL}/</>}
|
||||
ref={usernameRef}
|
||||
defaultValue={undefined}
|
||||
data-testid="admin-impersonation-input"
|
||||
/>
|
||||
<Button type="submit" data-testid="impersonation-submit">
|
||||
{t("impersonate")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</PanelCard>
|
||||
<RecentImpersonationsList key={refreshKey} onImpersonate={handleQuickImpersonate} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ImpersonationView;
|
||||
@@ -1,85 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { IS_CALCOM } from "@calcom/lib/constants";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { PanelCard } from "@calcom/ui/components/card";
|
||||
import { TextField } from "@calcom/ui/components/form";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
export default function LicenseView() {
|
||||
const { t } = useLocale();
|
||||
const [billingEmail, setBillingEmail] = useState("");
|
||||
|
||||
const resendEmailMutation = trpc.viewer.admin.resendPurchaseCompleteEmail.useMutation({
|
||||
onSuccess: () => {
|
||||
showToast(t("admin_license_resend_success"), "success");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message || t("admin_license_resend_error"), "error");
|
||||
},
|
||||
});
|
||||
|
||||
const billingPortalMutation = trpc.viewer.admin.billingPortalLink.useMutation({
|
||||
onSuccess: (data) => {
|
||||
if (!data?.url) {
|
||||
showToast(t("admin_license_portal_missing_url"), "error");
|
||||
return;
|
||||
}
|
||||
|
||||
window.open(data.url, "_blank", "noopener,noreferrer");
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(error.message || t("admin_license_portal_error"), "error");
|
||||
},
|
||||
});
|
||||
|
||||
const showResendSection = IS_CALCOM;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
{showResendSection && (
|
||||
<PanelCard title={t("admin_license_resend_title")} subtitle={t("admin_license_resend_description")}>
|
||||
<div className="p-4">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end">
|
||||
<TextField
|
||||
containerClassName="w-full"
|
||||
label={t("admin_license_billing_email_label")}
|
||||
name="billingEmail"
|
||||
type="email"
|
||||
placeholder={t("admin_license_billing_email_placeholder")}
|
||||
value={billingEmail}
|
||||
onChange={(event) => setBillingEmail(event.target.value)}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
loading={resendEmailMutation.isPending}
|
||||
disabled={!billingEmail.trim()}
|
||||
onClick={() => {
|
||||
resendEmailMutation.mutate({
|
||||
billingEmail: billingEmail.trim(),
|
||||
});
|
||||
}}>
|
||||
{t("admin_license_resend_button")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</PanelCard>
|
||||
)}
|
||||
|
||||
<PanelCard title={t("admin_license_portal_title")} subtitle={t("admin_license_portal_description")}>
|
||||
<div className="p-4">
|
||||
<Button
|
||||
type="button"
|
||||
loading={billingPortalMutation.isPending}
|
||||
onClick={() => billingPortalMutation.mutate({})}>
|
||||
{t("admin_license_portal_button")}
|
||||
</Button>
|
||||
</div>
|
||||
</PanelCard>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Alert } from "@calcom/ui/components/alert";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Form, TextField } from "@calcom/ui/components/form";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import type { TFunction } from "next-i18next";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
export const getFormSchema = (t: TFunction) => {
|
||||
return z.object({
|
||||
teamId: z.number(),
|
||||
targetOrgId: z.number(),
|
||||
teamSlugInOrganization: z.string().min(1),
|
||||
});
|
||||
};
|
||||
|
||||
export default function MoveTeamToOrgView() {
|
||||
const { t } = useLocale();
|
||||
const formSchema = getFormSchema(t);
|
||||
const formMethods = useForm({
|
||||
mode: "onSubmit",
|
||||
resolver: zodResolver(formSchema),
|
||||
});
|
||||
|
||||
const moveTeamMutation = trpc.viewer.admin.moveTeamToOrg.useMutation({
|
||||
onSuccess: (data) => {
|
||||
showToast(t(data.message), "success", 10000);
|
||||
},
|
||||
onError: (error) => {
|
||||
showToast(t(error.message), "error", 10000);
|
||||
},
|
||||
});
|
||||
|
||||
const { register } = formMethods;
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<Form
|
||||
className="space-y-3"
|
||||
noValidate={true}
|
||||
form={formMethods}
|
||||
handleSubmit={async (values) => {
|
||||
const parsedValues = formSchema.parse(values);
|
||||
moveTeamMutation.mutate(parsedValues);
|
||||
}}>
|
||||
<div className="space-y-3">
|
||||
<TextField
|
||||
{...register("teamId", { valueAsNumber: true })}
|
||||
type="number"
|
||||
label={t("team_id")}
|
||||
required
|
||||
placeholder={t("move_team_to_org_team_id_placeholder")}
|
||||
/>
|
||||
<TextField
|
||||
{...register("teamSlugInOrganization")}
|
||||
label={t("move_team_to_org_new_slug")}
|
||||
required
|
||||
placeholder={t("move_team_to_org_new_slug_placeholder")}
|
||||
/>
|
||||
<TextField
|
||||
{...register("targetOrgId", { valueAsNumber: true })}
|
||||
type="number"
|
||||
label={t("move_team_to_org_target_org_id")}
|
||||
required
|
||||
placeholder={t("move_team_to_org_target_org_id_placeholder")}
|
||||
/>
|
||||
<div className="mt-2 text-gray-600 text-sm">
|
||||
{t("organization_migration_move_team_footnote")}
|
||||
</div>
|
||||
</div>
|
||||
<Button type="submit" loading={moveTeamMutation.isPending}>
|
||||
{t("organization_migration_move_team")}
|
||||
</Button>
|
||||
</Form>
|
||||
|
||||
{moveTeamMutation.isSuccess && moveTeamMutation.data && (
|
||||
<Alert
|
||||
className="mt-6"
|
||||
severity="info"
|
||||
CustomIcon="check"
|
||||
title={t("move_team_to_org_migration_successful")}
|
||||
message={
|
||||
<div className="space-y-1">
|
||||
<p>
|
||||
<span className="font-medium">{t("team_id")}:</span> {moveTeamMutation.data.teamId}
|
||||
</p>
|
||||
{moveTeamMutation.data.oldTeamSlug && (
|
||||
<p>
|
||||
<span className="font-medium">{t("move_team_to_org_old_slug")}:</span>{" "}
|
||||
{moveTeamMutation.data.oldTeamSlug}
|
||||
</p>
|
||||
)}
|
||||
{moveTeamMutation.data.newTeamSlug && (
|
||||
<p>
|
||||
<span className="font-medium">{t("move_team_to_org_new_slug")}:</span>{" "}
|
||||
{moveTeamMutation.data.newTeamSlug}
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
<span className="font-medium">{t("organization_id")}:</span>{" "}
|
||||
{moveTeamMutation.data.organizationId}
|
||||
</p>
|
||||
{moveTeamMutation.data.organizationSlug && (
|
||||
<p>
|
||||
<span className="font-medium">{t("move_team_to_org_organization_slug")}:</span>{" "}
|
||||
{moveTeamMutation.data.organizationSlug}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user