* revert * add incomplete-booking
This commit is contained in:
1 parent
b128579729
commit
ce87de4fc7
69 files changed
+567
-555
No files matched your search
@@ -20,7 +20,7 @@ const handler: AppDeclarativeHandler = {
|
||||
});
|
||||
},
|
||||
redirect: {
|
||||
url: "/routing/forms",
|
||||
url: "/apps/routing-forms/forms",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"variant": "other",
|
||||
"categories": ["automation"],
|
||||
"publisher": "Cal.com, Inc.",
|
||||
"simplePath": "/routing",
|
||||
"simplePath": "/apps/routing-forms",
|
||||
"email": "[email protected]",
|
||||
"licenseRequired": true,
|
||||
"teamsPlanRequired": {
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
|
||||
|
||||
import { getServerSidePropsForSingleFormView as getServerSidePropsSingleForm } from "../components/getServerSidePropsSingleForm";
|
||||
import { getServerSideProps as getServerSidePropsForms } from "./forms/getServerSideProps";
|
||||
import { getServerSideProps as getServerSidePropsRoutingLink } from "./routing-link/getServerSideProps";
|
||||
|
||||
export const routingServerSidePropsConfig: Record<string, AppGetServerSideProps> = {
|
||||
forms: getServerSidePropsForms,
|
||||
"form-edit": getServerSidePropsSingleForm,
|
||||
"route-builder": getServerSidePropsSingleForm,
|
||||
"routing-link": getServerSidePropsRoutingLink,
|
||||
reporting: getServerSidePropsSingleForm,
|
||||
"incomplete-booking": getServerSidePropsSingleForm,
|
||||
};
|
||||
@@ -1,11 +1,17 @@
|
||||
//TODO: Generate this file automatically so that like in Next.js file based routing can work automatically
|
||||
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
|
||||
|
||||
import { getServerSidePropsForSingleFormView as getServerSidePropsSingleForm } from "../components/getServerSidePropsSingleForm";
|
||||
import * as formEdit from "./form-edit/[...appPages]";
|
||||
import * as forms from "./forms/[...appPages]";
|
||||
// extracts getServerSideProps function from the client component
|
||||
import { getServerSideProps as getServerSidePropsForms } from "./forms/getServerSideProps";
|
||||
import * as IncompleteBooking from "./incomplete-booking/[...appPages]";
|
||||
import * as LayoutHandler from "./layout-handler/[...appPages]";
|
||||
import * as Reporting from "./reporting/[...appPages]";
|
||||
import * as RouteBuilder from "./route-builder/[...appPages]";
|
||||
import * as RoutingLink from "./routing-link/[...appPages]";
|
||||
import { getServerSideProps as getServerSidePropsRoutingLink } from "./routing-link/getServerSideProps";
|
||||
|
||||
const routingConfig = {
|
||||
"form-edit": formEdit,
|
||||
@@ -17,4 +23,13 @@ const routingConfig = {
|
||||
"incomplete-booking": IncompleteBooking,
|
||||
};
|
||||
|
||||
export const serverSidePropsConfig: Record<string, AppGetServerSideProps> = {
|
||||
forms: getServerSidePropsForms,
|
||||
"form-edit": getServerSidePropsSingleForm,
|
||||
"route-builder": getServerSidePropsSingleForm,
|
||||
"routing-link": getServerSidePropsRoutingLink,
|
||||
reporting: getServerSidePropsSingleForm,
|
||||
"incomplete-booking": getServerSidePropsSingleForm,
|
||||
};
|
||||
|
||||
export default routingConfig;
|
||||
@@ -481,5 +481,9 @@ export default function FormEditPage({
|
||||
}
|
||||
|
||||
FormEditPage.getLayout = (page: React.ReactElement) => {
|
||||
return <Shell withoutMain={true}>{page}</Shell>;
|
||||
return (
|
||||
<Shell backPath="/apps/routing-forms/forms" withoutMain={true}>
|
||||
{page}
|
||||
</Shell>
|
||||
);
|
||||
};
|
||||
@@ -1,3 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import type z from "zod";
|
||||
|
||||
|
||||
@@ -293,5 +293,9 @@ export default function ReporterWrapper({
|
||||
}
|
||||
|
||||
ReporterWrapper.getLayout = (page: React.ReactElement) => {
|
||||
return <Shell withoutMain={true}>{page}</Shell>;
|
||||
return (
|
||||
<Shell backPath="/apps/routing-forms/forms" withoutMain={true}>
|
||||
{page}
|
||||
</Shell>
|
||||
);
|
||||
};
|
||||
@@ -1092,7 +1092,11 @@ export default function RouteBuilder({
|
||||
}
|
||||
|
||||
RouteBuilder.getLayout = (page: React.ReactElement) => {
|
||||
return <Shell withoutMain={true}>{page}</Shell>;
|
||||
return (
|
||||
<Shell backPath="/apps/routing-forms/forms" withoutMain={true}>
|
||||
{page}
|
||||
</Shell>
|
||||
);
|
||||
};
|
||||
|
||||
export { getServerSideProps };
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { FormEvent } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
@@ -159,6 +160,9 @@ function RoutingForm({ form, profile, ...restProps }: Props) {
|
||||
<div>
|
||||
{!customPageMessage ? (
|
||||
<>
|
||||
<Head>
|
||||
<title>{`${form.name} | Cal.com Forms`}</title>
|
||||
</Head>
|
||||
<div className={classNames("mx-auto my-0 max-w-3xl", isEmbed ? "" : "md:my-24")}>
|
||||
<div className="w-full max-w-4xl ltr:mr-2 rtl:ml-2">
|
||||
<div className="main border-booker md:border-booker-width dark:bg-muted bg-default mx-0 rounded-md p-4 py-6 sm:-mx-4 sm:px-8 ">
|
||||
|
||||
@@ -24,6 +24,9 @@ export const getServerSideProps = async function getServerSideProps(
|
||||
const { currentOrgDomain } = orgDomainConfig(context.req);
|
||||
|
||||
const isEmbed = params.appPages[1] === "embed";
|
||||
if (context.query["flag.coep"] === "true") {
|
||||
context.res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
||||
}
|
||||
|
||||
const form = await prisma.app_RoutingForms_Form.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -93,7 +93,7 @@ test.describe("Routing Forms", () => {
|
||||
await gotoRoutingLink({ page, formId });
|
||||
await expect(page.locator("text=Test Form Name")).toBeVisible();
|
||||
|
||||
await page.goto(`routing/route-builder/${formId}`);
|
||||
await page.goto(`apps/routing-forms/route-builder/${formId}`);
|
||||
await disableForm(page);
|
||||
await gotoRoutingLink({ page, formId });
|
||||
await expect(page.getByTestId(`404-page`)).toBeVisible();
|
||||
@@ -101,12 +101,12 @@ test.describe("Routing Forms", () => {
|
||||
|
||||
test("recently added form appears first in the list", async ({ page }) => {
|
||||
await addForm(page, { name: "Test Form 1" });
|
||||
await page.goto(`routing/forms`);
|
||||
await page.goto(`apps/routing-forms/forms`);
|
||||
await page.waitForSelector('[data-testid="routing-forms-list"]');
|
||||
await expect(page.locator('[data-testid="routing-forms-list"] > div h1')).toHaveCount(1);
|
||||
|
||||
await addForm(page, { name: "Test Form 2" });
|
||||
await page.goto(`routing/forms`);
|
||||
await page.goto(`apps/routing-forms/forms`);
|
||||
await page.waitForSelector('[data-testid="routing-forms-list"]');
|
||||
await expect(page.locator('[data-testid="routing-forms-list"] > div h1')).toHaveCount(2);
|
||||
|
||||
@@ -351,7 +351,7 @@ test.describe("Routing Forms", () => {
|
||||
["event-routing", "Option-2", "Option-2", "Option-2", "Option-2", "", "", "", expect.any(String)],
|
||||
]);
|
||||
|
||||
await page.goto(`routing/route-builder/${routingForm.id}`);
|
||||
await page.goto(`apps/routing-forms/route-builder/${routingForm.id}`);
|
||||
const [download] = await Promise.all([
|
||||
// Start waiting for the download
|
||||
page.waitForEvent("download"),
|
||||
@@ -446,7 +446,7 @@ test.describe("Routing Forms", () => {
|
||||
test("Test preview should return correct route", async ({ page, users }) => {
|
||||
const user = await createUserAndLogin({ users, page });
|
||||
const routingForm = user.routingForms[0];
|
||||
await page.goto(`routing/form-edit/${routingForm.id}`);
|
||||
await page.goto(`apps/routing-forms/form-edit/${routingForm.id}`);
|
||||
await page.click('[data-testid="test-preview"]');
|
||||
|
||||
//event redirect
|
||||
@@ -696,7 +696,7 @@ async function addAllTypesOfFieldsAndSaveForm(
|
||||
page: Page,
|
||||
form: { description: string; label: string }
|
||||
) {
|
||||
await page.goto(`routing/form-edit/${formId}`);
|
||||
await page.goto(`apps/routing-forms/form-edit/${formId}`);
|
||||
await page.click('[data-testid="add-field"]');
|
||||
await page.fill('[data-testid="description"]', form.description);
|
||||
|
||||
@@ -752,7 +752,7 @@ async function addAllTypesOfFieldsAndSaveForm(
|
||||
}
|
||||
|
||||
async function addShortTextFieldAndSaveForm({ page, formId }: { page: Page; formId: string }) {
|
||||
await page.goto(`routing/form-edit/${formId}`);
|
||||
await page.goto(`apps/routing-forms/form-edit/${formId}`);
|
||||
await page.click('[data-testid="add-field"]');
|
||||
await page.locator(".data-testid-field-type").nth(0).click();
|
||||
await page.fill(`[name="fields.0.label"]`, "Short Text");
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function addOneFieldAndDescriptionAndSaveForm(
|
||||
page: Page,
|
||||
form: { description?: string; field?: { typeIndex: number; label: string } }
|
||||
) {
|
||||
await page.goto(`routing/form-edit/${formId}`);
|
||||
await page.goto(`apps/routing-forms/form-edit/${formId}`);
|
||||
await page.click('[data-testid="add-field"]');
|
||||
if (form.description) {
|
||||
await page.fill('[data-testid="description"]', form.description);
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function HowToUse() {
|
||||
<ol className="mb-5 ml-5 mt-5 list-decimal ltr:mr-5 rtl:ml-5">
|
||||
<li>
|
||||
Make sure that you have{" "}
|
||||
<Link href="/routing" className="text-subtle text-base">
|
||||
<Link href="/apps/routing-forms" className="text-subtle text-base">
|
||||
Routing Forms
|
||||
</Link>{" "}
|
||||
app installed
|
||||
|
||||
@@ -25,7 +25,7 @@ import { useAppTheme } from "./useAppTheme";
|
||||
const Layout = (props: LayoutProps) => {
|
||||
const { banners, bannersHeight } = useBanners();
|
||||
const pathname = usePathname();
|
||||
const isFullPageWithoutSidebar = pathname?.startsWith("/routing/reporting/");
|
||||
const isFullPageWithoutSidebar = pathname?.startsWith("/apps/routing-forms/reporting/");
|
||||
const pageTitle = typeof props.heading === "string" && !props.title ? props.heading : props.title;
|
||||
const withoutSeo = props.withoutSeo ?? props.withoutMain ?? false;
|
||||
|
||||
@@ -138,26 +138,23 @@ export function ShellMain(props: LayoutProps) {
|
||||
|
||||
const { buttonToShow, isLoading, enableNotifications, disableNotifications } = useNotifications();
|
||||
|
||||
const backPath = props.backPath;
|
||||
// Replace multiple leading slashes with a single slash
|
||||
// e.g., `//routing/forms` -> `/routing/forms`
|
||||
const validBackPath = typeof backPath === "string" ? backPath.replace(/^\/+/, "/") : null;
|
||||
|
||||
return (
|
||||
<>
|
||||
{(props.heading || !!backPath) && (
|
||||
{(props.heading || !!props.backPath) && (
|
||||
<div
|
||||
className={classNames(
|
||||
"flex items-center md:mb-6 md:mt-0",
|
||||
props.smallHeading ? "lg:mb-7" : "lg:mb-8",
|
||||
props.hideHeadingOnMobile ? "mb-0" : "mb-6"
|
||||
)}>
|
||||
{!!backPath && (
|
||||
{!!props.backPath && (
|
||||
<Button
|
||||
variant="icon"
|
||||
size="sm"
|
||||
color="minimal"
|
||||
onClick={() => (validBackPath ? router.push(validBackPath) : router.back())}
|
||||
onClick={() =>
|
||||
typeof props.backPath === "string" ? router.push(props.backPath as string) : router.back()
|
||||
}
|
||||
StartIcon="arrow-left"
|
||||
aria-label="Go Back"
|
||||
className="rounded-md ltr:mr-2 rtl:ml-2"
|
||||
|
||||
@@ -87,10 +87,10 @@ const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemTy
|
||||
icon: "ellipsis",
|
||||
},
|
||||
{
|
||||
name: "routing",
|
||||
href: "/routing/forms",
|
||||
icon: "split",
|
||||
isCurrent: ({ pathname }) => pathname?.startsWith("/routing/forms") ?? false,
|
||||
name: "routing_forms",
|
||||
href: "/apps/routing-forms/forms",
|
||||
icon: "file-text",
|
||||
isCurrent: ({ pathname }) => pathname?.startsWith("/apps/routing-forms/") ?? false,
|
||||
moreOnMobile: true,
|
||||
},
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -131,7 +131,7 @@ export interface App {
|
||||
isGlobal?: boolean;
|
||||
/**
|
||||
* For apps that are accessible on an alternate URL(which is simpler and shorter), this can be set.
|
||||
* e.g. Routing Forms App is available as /routing-forms in addition to regular /routing.
|
||||
* e.g. Routing Forms App is available as /routing-forms in addition to regular /apps/routing-forms.
|
||||
*/
|
||||
simplePath?: string;
|
||||
/** A contact email, mainly to ask for support */
|
||||
|
||||
@@ -39,6 +39,9 @@ vi.mock("next-seo", () => {
|
||||
|
||||
vi.mock("@calcom/lib/OgImages", async () => {
|
||||
return {
|
||||
constructAppImage() {
|
||||
return "constructAppImage";
|
||||
},
|
||||
constructGenericImage() {
|
||||
return "constructGenericImage";
|
||||
},
|
||||
@@ -139,6 +142,14 @@ describe("Tests for HeadSeo component", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("Should render with app props", async () => {
|
||||
const { container } = render(<HeadSeo {...basicProps} app={{} as HeadSeoProps["app"]} />);
|
||||
await waitFor(async () => {
|
||||
const mockedNextSeoEl = container.querySelector("#mocked-next-seo");
|
||||
expect(mockedNextSeoEl?.getAttribute("image")).toContain("constructAppImage");
|
||||
});
|
||||
});
|
||||
|
||||
test("Should render with meeting props", async () => {
|
||||
const { container } = render(<HeadSeo {...basicProps} meeting={{} as HeadSeoProps["meeting"]} />);
|
||||
await waitFor(async () => {
|
||||
|
||||
@@ -117,7 +117,6 @@ export const lucideIconList = new Set([
|
||||
"sliders-vertical",
|
||||
"smartphone",
|
||||
"sparkles",
|
||||
"split",
|
||||
"square-check",
|
||||
"star",
|
||||
"sun",
|
||||
|
||||
@@ -117,7 +117,6 @@ export type IconName =
|
||||
| "sliders-vertical"
|
||||
| "smartphone"
|
||||
| "sparkles"
|
||||
| "split"
|
||||
| "square-check"
|
||||
| "star"
|
||||
| "sun"
|
||||
|
||||
Reference in new issue
Block a user