Compare commits

...
30 Commits
Author SHA1 Message Date
GitHub Actions 9caaa0af32 chore: release v4.9.2
Post release / release (push) Canceled after 0s
2025-01-17 22:03:02 +00:00
f411c6ed11 feat: Use dub.customer.list to issue dual-sided incentives (#18452)
* [FEAT] Use dub.customer to issue dual-sided incentives

* update dub implementation

* uncommit yarn.lock

* Update yarn.lock

* account for self-hosting

* remove comments

---------

Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2025-01-17 21:33:33 +00:00
Benny Joo 245196fbf3 chore: technical debt clearing - remove getServerSideProps for /event-types (#18733)
* chore: technical debt clearing - remove getServerSideProps for event-types

* refactor
2025-01-17 21:35:03 +01:00
Steven TeyandAlex van Andel 6be69b820c chore: Bump Dub version to fix createMany error (#18591)
Co-authored-by: Alex van Andel <me@alexvanandel.com>
2025-01-17 08:53:44 -07:00
Benny Joo b63c9791ec fix (#18718) 2025-01-17 10:48:31 -05:00
Anik Dhabal Babu 8cc61a1fe9 fix: Impersonation issue from userstable (#18608)
* fix: visible error in the userlist handler

* Uncommit yarn.lock

* update
2025-01-17 14:04:41 +00:00
Anik Dhabal Babu be2e1274ff fix: Getting an error with managed events when accessing through api/v1 (#18683)
* fix: getting error with managed events when get through api/v1

* update
2025-01-17 13:59:34 +00:00
Anik Dhabal Babu fa3b1c17ea fix: duplicating an event turns private link on (#18727) 2025-01-17 13:59:19 +00:00
Benny Joo 015edd3c9b chore: migrate /auth/new (#18732)
* move out of /future dir

* remove legacy pages
2025-01-17 06:46:59 -05:00
Benny Joo de05e8e989 chore: migrate /auth/error (#18730)
* migrate auth/error

* fix

* fix type check
2025-01-17 06:46:47 -05:00
Benny Joo 78a6963cd9 chore: clean up <HeadSeo> components where not needed (#18731)
* clean up headseo from d-type-view

* clean up headseo from bookings-single-view

* clean up headseo from team-view
2025-01-17 10:57:39 +00:00
Udit Takkar ea827ebbc6 fix: edit webhook time (#18549) 2025-01-17 08:56:50 +00:00
Joe Au-YeungandPeer Richelsen 08e58851e7 feat: Salesforce - write to field without validation (#18722)
* Allow user to select custom field type

* Get field value and write to field - ignoring field type

* Only validate field length if present

---------

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
2025-01-17 08:55:34 +00:00
Cao Hoang da1b8137c2 fix: filters ui breaking on mobile in routing insights page (#18713) 2025-01-17 09:40:16 +01:00
Anik Dhabal BabuandUdit Takkar d182e5c99a fix: Booking with the same email when using capital letters (#18694)
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
2025-01-17 09:37:10 +01:00
Nizzy 42259a113b fix: resize app-store images to use less bytes (#18675) 2025-01-17 09:35:01 +01:00
+8 6561b92f40 perf: Move CRM event creation to tasker (#18370)
* Upgrade jsforce to 3.6.2

* Refactor connecting to Salesforce

* Revert yarn.lock changes

* Add `TASKER_ENABLE_CRM_EVENT_CREATION` to .env

* Add createCRMEvent scheduler

* Schedule CRM event creating in `EventManager`

* Add calendar event builder for CRM tasks

* Do not write to person record if fields don't exist

* Change type to expect string from tasker

* Create CRM event

* Create booking references

* Type fixes

* Migrate callback endpoint

* Add jsforce node dependency

* Migrate add endpoint

* Import

* Import package into crmService

* Use new package types

* Type fix

* Update vite config

* Push updated lockfile

* Attempt to bump platform/libraries to unlock jsforce

* Also update lockfile, naturally

* bump platform libraries

* feat: salesforce to tasker improvements (#18419)

* feat: salesforce to tasker

* refactor: event manager

* tests: add unit tests for create CRM Event

* Update vite.config

* Add jsforce to vite config

* Revert mint.json changes

* Default to not enabling

* Revert yarn.lock changes

* Remove `TASKER_ENABLE_CRM_EVENT_CREATION` variable

* Revert yarn.lock changes

* feat: Round Robin weights future members toggle (#17782)

Co-authored-by: Omar López <zomars@me.com>

* detailed customer card (#18511)

Co-authored-by: Omar López <zomars@me.com>

* chore: app router - all sub-pages in `/apps` (#16976)

* chore: apps/[slug] remove pages router

* remove apps/[slug] pages from /future

* chore: apps/installed remove pages router

* chore: apps/installation remove pages router

* remove Head element

* fix metadata

* fix test

* fix another test

* chore: apps/categories remove pages router

* revert unneeded changes

* update middleware

* Remove <Head>

* remove unused import and code

* remove unused import and code again

* fix

* fix category page

* add split icon

* add /routing paths to middleware matcher

* wip

* remove HeadSeo from App.tsx

* clean up head-seo test

* add generateAppMetadata

* use generateAppMetadata in apps/[slug] page

* delete file

* remove log

* fix

* fix

* fix apps/installed pages

* fix cateogires pages

* fix

* fix imports

* wip

* fix

* fix

* fix metadata

* fix

* redirect /apps/routing-forms to /routing

* replace all usages of /apps/routing-forms to /routing

* better naming

* /routing -> /routing/forms

* fix

* fix

* fix

* fix

* remove backPath as it is irrelevant when withoutMain is true

* fix type checks

* fix type check in apps/[slug]

* refactors

* fix

* fix test

* fix

* fix

* fix

* Replace multiple leading slashes with a single slash

* migrate routing-forms too

* add re routing

* fix

* add redirection

---------

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>

* chore: app router 404 page (#18597)

* wip

* wip

* fix not found page

* render middleware for /settings pages

* fix

* remove global-error page

* add metadata to not-found page

* make not-found page static

* remove 404

* adding not-found to middleware is not necessary

* add every routes to config.matcher

* fix test

* fix style

* use i18n string

* fix tests

* fix

* fix

* revert unneeded changes

* fix

* fix

* fix

* fix style

* fix

* remove 404

* remove log

* fix

* fix

* fix

* fix

* better naming

* parallel testing

---------

Co-authored-by: Benny Joo <sldisek783@gmail.com>

* feat: render custom error page for unexpected sever error + remove` pages/_error` (#18606)

* remove page/_error

* refactor app/error

* fix: app/not-found cannot be a static page (#18610)

* Async False (#18611)

* chore: redirect to /500 if pathname does not exist + better error handling (#18615)

* fix lint error

* fix booking page and better error handling

* chore: gracefully handle 404s from pages router's dynamic pages + tests (#18618)

* restore pages/_error

* set custom header in pages/_error

* handle it in middleware

* add test

* remove logs

* better test description

* chore: try using custom 404 in pages/_error (#18622)

* fix: parsing teamId (#18623)

* chore: restore error pages for pages router (#18625)

* disable emails to all guests (#18628)

Co-authored-by: CarinaWolli <wollencarina@gmail.com>

* revert: "feat: bulk shorten links with dub.links.createMany (#18539)" (#18587)

This reverts commit 4902c6a0f8.

Co-authored-by: Alex van Andel <me@alexvanandel.com>

* chore: release v4.8.18

* fix: disable sending sms when email is present (#18632)

* fix: disable sending sms when email is present

* fix: update test

* fix: main lint errors (#18634)

* fix: error-page.tsx related lint errors

* fix: lint no continue-on-error

* Adding more lint fixes

* Bring back annotate code linting results

* Bring back linting continue-on-error

* Slimline lint

* feat: do not show automation webhooks in webhook list (#18607)

* fix: make ESLint work and fix lint errors that were undetected before (#18639)

* fix eslint config

* fix

* add it to dev dep

* fix

* sync eslint version

* force ts-node to compile our ESLint plugin's TS files into CommonJS (which ESLint requires)

* fix some lint errors

* fix lint errors

* remove duplicate classname

* make @typescript-eslint/ban-types a warn for packages/trpc files

* fix lint errors in trpc

* fix lint errors in trpc - 2

* fix

* fix

* fix lint warnings

* chore: clean up config.matcher in middleware (#18638)

Co-authored-by: Alex van Andel <me@alexvanandel.com>

* Allow lint to error but continue (unblock pipeline)

* fix: potential fix for flaky layout shift (#18651)

* potential fix: layout shift

* fix lint error

* feat: update translations via @replexica (#18598)

* chore: sync with main

* feat: update translations via @replexica

---------

Co-authored-by: Replexica <support@replexica.com>

* Update yarn.lock

* nit: let tasker handle payload stringification

---------

Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
Co-authored-by: Morgan Vernay <morgan@cal.com>
Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Nizzy <140507264+nizzyabi@users.noreply.github.com>
Co-authored-by: Benny Joo <sldisek783@gmail.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: GitHub Actions <github-actions@github.com>
Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com>
Co-authored-by: Calcom Bot <109866826+calcom-bot@users.noreply.github.com>
Co-authored-by: Replexica <support@replexica.com>
2025-01-16 22:07:30 -05:00
Benny Joo 9e5665f2fb Revert "fix: revert app router error pages (#18696)" (#18714)
This reverts commit 3cc5d9c065.
2025-01-16 16:53:47 -05:00
GitHub Actions 07778d22ed chore: release v4.9.1
Post release / release (push) Canceled after 0s
2025-01-16 18:01:24 +00:00
Joe Au-Yeung 56df8bdf7c feat: Salesforce - map booking questions to event record (#18532) 2025-01-16 12:28:07 -05:00
GitHub Actions a518c7152a chore: release v4.9.1-rc1
Post release / release (push) Canceled after 0s
2025-01-16 15:53:45 +00:00
Benny Joo c37a8a587b fix: add decoding logic to app router params (#18712)
* decode app router params in buildLegacyCtx

* add helpful comments

* add comment

* address comment
2025-01-16 15:14:03 +00:00
Alex van Andel b7f7c33afc feature: Allow non-calcom domains to run team slug pages (#18711) 2025-01-16 09:44:14 -03:00
Lauris Skraucis 1d449ecc6b fix: v2 booking guests (#18690)
* fix: v2 booking guests

* test
2025-01-16 11:20:18 +02:00
Lauris Skraucis f582faed2b fix: Booking atom phone booking field and booking fields order (#18678)
* chore: examples app make managed user admin

* fix: phone field not appearing

* fix: booking fields order

* feat: local libraries setup script

* chore: add log when parsing booking field fails

* fix: backwards compatbile name booking field

* chore: libraries publish support scripts

* chore: bump libraries

* docs

* fix: phone default field return label and placeholder

* fix: e2e tests
2025-01-16 11:10:06 +02:00
GitHub Actions 79a8ab79f8 chore: release v4.9.0
Post release / release (push) Canceled after 0s
2025-01-16 01:26:26 +00:00
Benny Joo ce87de4fc7 fix: Revert - chore: app router - all sub-pages in /apps #16976 (#18702)
* revert

* add incomplete-booking
2025-01-15 21:12:18 -03:00
Calcom BotandReplexica b128579729 feat: update translations via @replexica (#18699)
Co-authored-by: Replexica <support@replexica.com>
2025-01-15 20:38:44 +00:00
Benny Joo 3cc5d9c065 fix: revert app router error pages (#18696) 2025-01-15 16:47:30 -03:00
Benny Joo 7897e14273 fix: add back global-error.tsx (#18692) 2025-01-15 16:55:43 +00:00
207 changed files with 1839 additions and 1018 deletions
+8 -2
View File
@@ -355,13 +355,19 @@ E2E_TEST_OIDC_USER_PASSWORD=
# provide a value between 0 and 100 to ensure the percentage of traffic
# redirected from the legacy to the future pages
AB_TEST_BUCKET_PROBABILITY=50
APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED=0
APP_ROUTER_APPS_SLUG_ENABLED=0
APP_ROUTER_APPS_SLUG_SETUP_ENABLED=0
# whether we redirect to the future/apps/categories from /apps/categories or not
APP_ROUTER_APPS_CATEGORIES_ENABLED=0
# whether we redirect to the future/apps/categories/[category] from /apps/categories/[category] or not
APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED=0
APP_ROUTER_APPS_ENABLED=0
APP_ROUTER_TEAM_ENABLED=0
APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED=0
APP_ROUTER_AUTH_LOGIN_ENABLED=0
APP_ROUTER_AUTH_LOGOUT_ENABLED=0
APP_ROUTER_AUTH_NEW_ENABLED=0
APP_ROUTER_AUTH_SAML_ENABLED=0
APP_ROUTER_AUTH_ERROR_ENABLED=0
APP_ROUTER_AUTH_PLATFORM_ENABLED=0
APP_ROUTER_AUTH_OAUTH2_ENABLED=0
+6
View File
@@ -0,0 +1,6 @@
undecided:
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
View File
+7
View File
@@ -0,0 +1,7 @@
undecided:
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
- "@calcom/prisma"
+7
View File
@@ -0,0 +1,7 @@
undecided:
- "@calcom/app-store-cli"
- "@calcom/platform-constants"
- "@calcom/platform-enums"
- "@calcom/platform-types"
- "@calcom/platform-utils"
- "@calcom/prisma"
+18 -2
View File
@@ -2,6 +2,7 @@ import type { NextApiRequest } from "next";
import { getStripeCustomerIdFromUserId } from "@calcom/app-store/stripepayment/lib/customer";
import stripe from "@calcom/app-store/stripepayment/lib/server";
import { getDubCustomer } from "@calcom/features/auth/lib/dub";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";
import { HttpError } from "@calcom/lib/http-error";
@@ -192,11 +193,26 @@ const generateTeamCheckoutSession = async ({
pendingPaymentTeamId: number;
ownerId: number;
}) => {
const customer = await getStripeCustomerIdFromUserId(ownerId);
const [customer, dubCustomer] = await Promise.all([
getStripeCustomerIdFromUserId(ownerId),
getDubCustomer(ownerId.toString()),
]);
const session = await stripe.checkout.sessions.create({
customer,
mode: "subscription",
allow_promotion_codes: true,
...(dubCustomer?.discount?.couponId
? {
discounts: [
{
coupon:
process.env.NODE_ENV !== "production" && dubCustomer.discount.couponTestId
? dubCustomer.discount.couponTestId
: dubCustomer.discount.couponId,
},
],
}
: { allow_promotion_codes: true }),
success_url: `${WEBAPP_URL}/api/teams/api/create?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${WEBAPP_URL}/settings/my-account/profile`,
line_items: [
+1 -1
View File
@@ -29,7 +29,7 @@
"@axiomhq/winston": "^1.2.0",
"@calcom/platform-constants": "*",
"@calcom/platform-enums": "*",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.82",
"@calcom/platform-libraries": "npm:@calcom/platform-libraries@0.0.85",
"@calcom/platform-libraries-0.0.2": "npm:@calcom/platform-libraries@0.0.2",
"@calcom/platform-types": "*",
"@calcom/platform-utils": "*",
@@ -332,6 +332,7 @@ describe("Bookings Endpoints 2024-08-13", () => {
metadata: {
userId: "100",
},
guests: ["bob@gmail.com"],
};
const beforeCreate = new Date();
@@ -376,7 +377,9 @@ describe("Bookings Endpoints 2024-08-13", () => {
name: body.attendee.name,
email: body.attendee.email,
...body.bookingFieldsResponses,
guests: body.guests,
});
expect(data.guests).toEqual(body.guests);
// Check createdAt date is between the time of the request and after the request
const createdAtDate = new Date(data.createdAt);
@@ -146,6 +146,8 @@ export class InputBookingsService_2024_08_13 {
);
const endTime = startTime.plus({ minutes: lengthInMinutes });
const guests = inputBooking.guests;
return {
start: startTime.toISO(),
end: endTime.toISO(),
@@ -154,7 +156,7 @@ export class InputBookingsService_2024_08_13 {
language: inputBooking.attendee.language || "en",
metadata: inputBooking.metadata || {},
hasHashedBookingLink: false,
guests: inputBooking.guests,
guests,
// note(Lauris): responses with name and email are required by the handleNewBooking
responses: inputBooking.bookingFieldsResponses
? {
@@ -162,11 +164,13 @@ export class InputBookingsService_2024_08_13 {
name: inputBooking.attendee.name,
email: inputBooking.attendee.email ?? "",
attendeePhoneNumber: inputBooking.attendee.phoneNumber,
guests,
}
: {
name: inputBooking.attendee.name,
email: inputBooking.attendee.email ?? "",
attendeePhoneNumber: inputBooking.attendee.phoneNumber,
guests,
},
};
}
@@ -251,6 +255,8 @@ export class InputBookingsService_2024_08_13 {
inputBooking.attendee.timeZone
);
const guests = inputBooking.guests;
for (let i = 0; i < repeatsTimes; i++) {
const endTime = startTime.plus({ minutes: eventType.length });
@@ -263,15 +269,16 @@ export class InputBookingsService_2024_08_13 {
language: inputBooking.attendee.language || "en",
metadata: inputBooking.metadata || {},
hasHashedBookingLink: false,
guests: inputBooking.guests,
guests,
// note(Lauris): responses with name and email are required by the handleNewBooking
responses: inputBooking.bookingFieldsResponses
? {
...inputBooking.bookingFieldsResponses,
name: inputBooking.attendee.name,
email: inputBooking.attendee.email,
guests,
}
: { name: inputBooking.attendee.name, email: inputBooking.attendee.email },
: { name: inputBooking.attendee.name, email: inputBooking.attendee.email, guests },
schedulingType: eventType.schedulingType,
});
@@ -123,7 +123,6 @@ describe("Event types Endpoints", () => {
slug: "location",
required: false,
hidden: false,
disableOnPrefill: false,
};
const defaultResponseBookingFieldTitle = {
@@ -452,9 +451,6 @@ describe("Event types Endpoints", () => {
{ ...defaultResponseBookingFieldName, ...nameBookingField },
{ ...defaultResponseBookingFieldEmail },
{ ...defaultResponseBookingFieldLocation },
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
{
type: "select",
label: "select which language you want to learn",
@@ -466,7 +462,10 @@ describe("Event types Endpoints", () => {
hidden: false,
isDefault: false,
},
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldNotes },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
];
expect(createdEventType.bookingFields).toEqual(expectedBookingFields);
@@ -942,9 +941,6 @@ describe("Event types Endpoints", () => {
{ ...defaultResponseBookingFieldName, ...nameBookingField },
{ ...defaultResponseBookingFieldEmail },
{ ...defaultResponseBookingFieldLocation },
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
{
type: "select",
label: "select which language you want to learn",
@@ -956,7 +952,10 @@ describe("Event types Endpoints", () => {
hidden: false,
isDefault: false,
},
{ ...defaultResponseBookingFieldTitle },
{ ...defaultResponseBookingFieldNotes, ...notesBookingField },
{ ...defaultResponseBookingFieldGuests },
{ ...defaultResponseBookingFieldRescheduleReason },
];
expect(updatedEventType.bookingFields).toEqual(expectedBookingFields);
@@ -1163,10 +1162,7 @@ describe("Event types Endpoints", () => {
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
label: "",
placeholder: "",
},
{ isDefault: true, required: true, slug: "title", type: "text", disableOnPrefill: false, hidden: true },
{
@@ -1185,7 +1181,14 @@ describe("Event types Endpoints", () => {
disableOnPrefill: false,
hidden: false,
},
{ isDefault: true, type: "phone", slug: "attendeePhoneNumber", required: false, hidden: true },
{
disableOnPrefill: false,
isDefault: true,
type: "phone",
slug: "attendeePhoneNumber",
required: false,
hidden: true,
},
{
isDefault: true,
required: false,
@@ -1610,7 +1613,6 @@ describe("Event types Endpoints", () => {
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
@@ -1621,6 +1623,14 @@ describe("Event types Endpoints", () => {
disableOnPrefill: false,
hidden: true,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "multiemail",
@@ -1637,14 +1647,6 @@ describe("Event types Endpoints", () => {
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
]);
});
});
@@ -243,19 +243,7 @@ export class OutputEventTypesService_2024_06_14 {
}
}
const fields = [...transformBookingFieldsInternalToApi(knownBookingFields), ...unknownBookingFields];
// ensure additional notes are always at the end
return fields.sort((a, b) => {
if (!a?.slug || !b?.slug) return 0;
if (a.slug === "notes" && b.slug !== "notes") {
return 1;
}
if (b.slug === "notes" && a.slug !== "notes") {
return -1;
}
return 0;
});
return [...transformBookingFieldsInternalToApi(knownBookingFields), ...unknownBookingFields];
}
getDefaultBookingFields(isOrgTeamEvent: boolean) {
@@ -590,6 +590,7 @@ describe("Organizations Event Types Endpoints", () => {
slug: "attendeePhoneNumber",
required: true,
label: "Phone number",
hidden: true,
},
],
};
@@ -623,7 +624,6 @@ describe("Organizations Event Types Endpoints", () => {
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
@@ -632,6 +632,8 @@ describe("Organizations Event Types Endpoints", () => {
slug: "attendeePhoneNumber",
required: true,
hidden: true,
label: "Phone number",
disableOnPrefill: false,
},
{
isDefault: true,
@@ -641,6 +643,14 @@ describe("Organizations Event Types Endpoints", () => {
disableOnPrefill: false,
hidden: true,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "multiemail",
@@ -657,14 +667,6 @@ describe("Organizations Event Types Endpoints", () => {
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
type: "textarea",
slug: "notes",
required: false,
disableOnPrefill: false,
hidden: false,
},
]);
});
});
@@ -771,13 +773,19 @@ describe("Organizations Event Types Endpoints", () => {
expect(fetchedEventType.bookingFields).toEqual([
{ isDefault: true, required: true, slug: "name", type: "name", disableOnPrefill: false },
{ isDefault: true, required: true, slug: "email", type: "email", disableOnPrefill: false },
{ isDefault: true, type: "phone", slug: "attendeePhoneNumber", required: false, hidden: true },
{
disableOnPrefill: false,
isDefault: true,
type: "phone",
slug: "attendeePhoneNumber",
required: false,
hidden: true,
},
{
isDefault: true,
type: "radioInput",
slug: "location",
required: false,
disableOnPrefill: false,
hidden: false,
},
{
@@ -788,6 +796,14 @@ describe("Organizations Event Types Endpoints", () => {
disableOnPrefill: false,
hidden: true,
},
{
isDefault: true,
required: false,
slug: "notes",
type: "textarea",
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
required: false,
@@ -804,14 +820,6 @@ describe("Organizations Event Types Endpoints", () => {
disableOnPrefill: false,
hidden: false,
},
{
isDefault: true,
required: false,
slug: "notes",
type: "textarea",
disableOnPrefill: false,
hidden: false,
},
]);
});
});
@@ -387,7 +387,6 @@ describe("Organizations User OOO Endpoints", () => {
}
// test sort
expect(data[1].id).toEqual(oooCreatedViaApiId);
});
});
+5 -2
View File
@@ -5,12 +5,15 @@ import { NextResponse, URLPattern } from "next/server";
import { FUTURE_ROUTES_ENABLED_COOKIE_NAME, FUTURE_ROUTES_OVERRIDE_COOKIE_NAME } from "@calcom/lib/constants";
const ROUTES: [URLPattern, boolean][] = [
["/apps/installed/:category", process.env.APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED === "1"] as const,
["/apps/:slug", process.env.APP_ROUTER_APPS_SLUG_ENABLED === "1"] as const,
["/apps/:slug/setup", process.env.APP_ROUTER_APPS_SLUG_SETUP_ENABLED === "1"] as const,
["/apps/categories", process.env.APP_ROUTER_APPS_CATEGORIES_ENABLED === "1"] as const,
["/apps/categories/:category", process.env.APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED === "1"] as const,
["/auth/forgot-password/:path*", process.env.APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED === "1"] as const,
["/auth/login", process.env.APP_ROUTER_AUTH_LOGIN_ENABLED === "1"] as const,
["/auth/logout", process.env.APP_ROUTER_AUTH_LOGOUT_ENABLED === "1"] as const,
["/auth/new", process.env.APP_ROUTER_AUTH_NEW_ENABLED === "1"] as const,
["/auth/saml-idp", process.env.APP_ROUTER_AUTH_SAML_ENABLED === "1"] as const,
["/auth/error", process.env.APP_ROUTER_AUTH_ERROR_ENABLED === "1"] as const,
["/auth/platform/:path*", process.env.APP_ROUTER_AUTH_PLATFORM_ENABLED === "1"] as const,
["/auth/oauth2/:path*", process.env.APP_ROUTER_AUTH_OAUTH2_ENABLED === "1"] as const,
["/team", process.env.APP_ROUTER_TEAM_ENABLED === "1"] as const,
+5 -26
View File
@@ -3,8 +3,8 @@ import i18next from "i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { headers } from "next/headers";
import type { AppImageProps, MeetingImageProps } from "@calcom/lib/OgImages";
import { constructGenericImage, constructAppImage, constructMeetingImage } from "@calcom/lib/OgImages";
import type { MeetingImageProps } from "@calcom/lib/OgImages";
import { constructGenericImage, constructMeetingImage } from "@calcom/lib/OgImages";
import { IS_CALCOM, WEBAPP_URL, APP_NAME, SEO_IMG_OGIMG, CAL_URL } from "@calcom/lib/constants";
import { buildCanonical } from "@calcom/lib/next-seo.config";
import { truncateOnWord } from "@calcom/lib/text";
@@ -62,18 +62,17 @@ const _generateMetadataWithoutImage = async (
const t = await getTranslationWithCache(locale);
const title = getTitle(t);
const description = getDescription(t);
const titleSuffix = `| ${APP_NAME}`;
const displayedTitle = title.includes(titleSuffix) || hideBranding ? title : `${title} ${titleSuffix}`;
const metadataBase = new URL(IS_CALCOM ? "https://cal.com" : WEBAPP_URL);
const truncatedDescription = truncateOnWord(getDescription(t), 158);
return {
title: title.length === 0 ? APP_NAME : displayedTitle,
description: truncatedDescription,
description,
alternates: { canonical },
openGraph: {
description: truncatedDescription,
description: truncateOnWord(description, 158),
url: canonical,
type: "website",
siteName: APP_NAME,
@@ -106,26 +105,6 @@ export const _generateMetadata = async (
};
};
export const generateAppMetadata = async (
app: AppImageProps,
getTitle: (t: TFunction<string, undefined>) => string,
getDescription: (t: TFunction<string, undefined>) => string,
hideBranding?: boolean,
origin?: string
) => {
const metadata = await _generateMetadataWithoutImage(getTitle, getDescription, hideBranding, origin);
const image = SEO_IMG_OGIMG + constructAppImage({ ...app, description: metadata.description });
return {
...metadata,
openGraph: {
...metadata.openGraph,
images: [image],
},
};
};
export const generateMeetingMetadata = async (
meeting: MeetingImageProps,
getTitle: (t: TFunction<string, undefined>) => string,
-68
View File
@@ -1,68 +0,0 @@
import type { PageProps as _PageProps } from "app/_types";
import { generateAppMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { notFound } from "next/navigation";
import { z } from "zod";
import { AppRepository } from "@calcom/lib/server/repository/app";
import { isPrismaAvailableCheck } from "@calcom/prisma/is-prisma-available-check";
import { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
import AppView from "~/apps/[slug]/slug-view";
const paramsSchema = z.object({
slug: z.string(),
});
export const generateMetadata = async ({ params }: _PageProps) => {
const p = paramsSchema.safeParse(params);
if (!p.success) {
return notFound();
}
const props = await getStaticProps(p.data.slug);
if (!props) {
notFound();
}
const { name, logo, description } = props.data;
return await generateAppMetadata(
{ slug: logo, name, description },
() => name,
() => description
);
};
export const generateStaticParams = async () => {
const isPrismaAvailable = await isPrismaAvailableCheck();
if (!isPrismaAvailable) {
// Database is not available at build time. Make sure we fall back to building these pages on demand
return [];
}
const appStore = await AppRepository.findAppStore();
return appStore.map(({ slug }) => ({ slug }));
};
async function Page({ params }: _PageProps) {
const p = paramsSchema.safeParse(params);
if (!p.success) {
return notFound();
}
const props = await getStaticProps(p.data.slug);
if (!props) {
notFound();
}
return <AppView {...props} />;
}
export default WithLayout({ getLayout: null, ServerPage: Page });
export const dynamic = "force-static";
@@ -1,40 +0,0 @@
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { redirect } from "next/navigation";
import { z } from "zod";
import { AppCategories } from "@calcom/prisma/enums";
import { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
import CategoryPage from "~/apps/categories/[category]/category-view";
const querySchema = z.object({
category: z.enum(Object.values(AppCategories) as [AppCategories, ...AppCategories[]]),
});
export const generateMetadata = async () => {
return await _generateMetadata(
(t) => t("app_store"),
(t) => t("app_store_description")
);
};
export const generateStaticParams = async () => {
const paths = Object.keys(AppCategories);
return paths.map((category) => ({ category }));
};
async function Page({ params, searchParams }: PageProps) {
const parsed = querySchema.safeParse({ ...params, ...searchParams });
if (!parsed.success) {
redirect("/apps/categories/calendar");
}
const props = await getStaticProps(parsed.data.category);
return <CategoryPage {...props} />;
}
export default WithLayout({ getLayout: null, ServerPage: Page });
@@ -1,32 +0,0 @@
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { redirect } from "next/navigation";
import { z } from "zod";
import { AppCategories } from "@calcom/prisma/enums";
import InstalledApps from "~/apps/installed/[category]/installed-category-view";
const querySchema = z.object({
category: z.nativeEnum(AppCategories),
});
export const generateMetadata = async () => {
return await _generateMetadata(
(t) => t("installed_apps"),
(t) => t("manage_your_connected_apps")
);
};
const InstalledAppsWrapper = async ({ params }: PageProps) => {
const parsedParams = querySchema.safeParse(params);
if (!parsedParams.success) {
redirect("/apps/installed/calendar");
}
return <InstalledApps category={parsedParams.data.category} />;
};
export default WithLayout({ getLayout: null, ServerPage: InstalledAppsWrapper });
@@ -1 +0,0 @@
export { default } from "app/routing-forms/[...pages]/page";
-1
View File
@@ -1 +0,0 @@
export { default } from "app/routing-forms/page";
+47
View File
@@ -0,0 +1,47 @@
import type { PageProps } from "app/_types";
import { _generateMetadata, getTranslate } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import Link from "next/link";
import { z } from "zod";
import { Button, Icon } from "@calcom/ui";
import AuthContainer from "@components/ui/AuthContainer";
export const generateMetadata = async () => {
return await _generateMetadata(
(t) => t("error"),
() => ""
);
};
const querySchema = z.object({
error: z.string().optional(),
});
const ServerPage = async ({ searchParams }: PageProps) => {
const t = await getTranslate();
const { error } = querySchema.parse({ error: searchParams?.error || undefined });
const errorMsg = error || t("error_during_login");
return (
<AuthContainer title="" description="" isAppDir={true}>
<div>
<div className="bg-error mx-auto flex h-12 w-12 items-center justify-center rounded-full">
<Icon name="x" className="h-6 w-6 text-red-600" />
</div>
<div className="mt-3 text-center sm:mt-5">
<h3 className="text-emphasis text-lg font-medium leading-6" id="modal-title">
{errorMsg}
</h3>
</div>
</div>
<div className="mt-5 sm:mt-6">
<Link href="/auth/login">
<Button className="flex w-full justify-center">{t("go_back_login")}</Button>
</Link>
</div>
</AuthContainer>
);
};
export default WithLayout({ ServerPage })<"P">;
+3 -3
View File
@@ -12,12 +12,12 @@ import { ErrorPage } from "@components/error/error-page";
const log = logger.getSubLogger({ prefix: ["[error]"] });
type ErrorProps = {
export type ErrorProps = {
error: Error;
reset: () => void;
reset?: () => void;
};
export default function Error({ error, reset }: ErrorProps) {
export default function Error({ error }: ErrorProps) {
React.useEffect(() => {
log.error(error);
+20 -4
View File
@@ -1,8 +1,14 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { cookies, headers } from "next/headers";
import { redirect } from "next/navigation";
import { getServerSideProps } from "@lib/event-types/getServerSideProps";
import { getServerSessionForAppDir } from "@calcom/features/auth/lib/get-server-session-for-app-dir";
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { ssrInit } from "@server/lib/ssr";
import EventTypes from "~/event-types/views/event-types-listing-view";
@@ -12,6 +18,16 @@ export const generateMetadata = async () =>
(t) => t("event_types_page_subtitle")
);
const getData = withAppDirSsr(getServerSideProps);
const Page = async ({ params, searchParams }: PageProps) => {
const context = buildLegacyCtx(headers(), cookies(), params, searchParams);
const session = await getServerSessionForAppDir();
if (!session?.user?.id) {
redirect("/auth/login");
}
export default WithLayout({ getLayout: null, getData, Page: EventTypes })<"P">;
await ssrInit(context);
return <EventTypes />;
};
export default WithLayout({ ServerPage: Page })<"P">;
+45
View File
@@ -0,0 +1,45 @@
import { Prisma } from "@prisma/client";
import { withAppDirSsg } from "app/WithAppDirSsg";
import type { PageProps as _PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { cookies, headers } from "next/headers";
import { AppRepository } from "@calcom/lib/server/repository/app";
import { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
import type { PageProps } from "~/apps/[slug]/slug-view";
import Page from "~/apps/[slug]/slug-view";
const getData = withAppDirSsg<PageProps>(getStaticProps, "future/apps/[slug]");
export const generateMetadata = async ({ params, searchParams }: _PageProps) => {
const legacyContext = buildLegacyCtx(headers(), cookies(), params, searchParams);
const res = await getData(legacyContext);
return await _generateMetadata(
() => res?.data.name ?? "",
() => res?.data.description ?? ""
);
};
export const generateStaticParams = async () => {
try {
const appStore = await AppRepository.findAppStore();
return appStore.map(({ slug }) => ({ slug }));
} catch (e: unknown) {
if (e instanceof Prisma.PrismaClientInitializationError) {
// Database is not available at build time, but that's ok – we fall back to resolving paths on demand
} else {
throw e;
}
}
return [];
};
export default WithLayout({ getLayout: null, Page, getData });
export const dynamic = "force-static";
@@ -2,34 +2,16 @@ import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps as _PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { notFound } from "next/navigation";
import { z } from "zod";
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import Page, { type PageProps } from "~/apps/[slug]/setup/setup-view";
const paramsSchema = z.object({
slug: z.string(),
});
export const generateMetadata = async ({ params }: _PageProps) => {
const p = paramsSchema.safeParse(params);
if (!p.success) {
return notFound();
}
const metadata = await _generateMetadata(
() => `${p.data.slug}`,
return await _generateMetadata(
() => `${params.slug}`,
() => ""
);
return {
...metadata,
robots: {
follow: false,
index: false,
},
};
};
const getData = withAppDirSsr<PageProps>(getServerSideProps);
@@ -0,0 +1,34 @@
import { withAppDirSsg } from "app/WithAppDirSsg";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { AppCategories } from "@calcom/prisma/enums";
import { isPrismaAvailableCheck } from "@calcom/prisma/is-prisma-available-check";
import { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
import CategoryPage, { type PageProps } from "~/apps/categories/[category]/category-view";
export const generateMetadata = async () => {
return await _generateMetadata(
(t) => t("app_store"),
(t) => t("app_store_description")
);
};
export const generateStaticParams = async () => {
const paths = Object.keys(AppCategories);
const isPrismaAvailable = await isPrismaAvailableCheck();
if (!isPrismaAvailable) {
// Database is not available at build time. Make sure we fall back to building these pages on demand
return [];
}
return paths.map((category) => ({ category }));
};
const getData = withAppDirSsg<PageProps>(getStaticProps, "future/apps/categories/[category]");
export default WithLayout({ getData, Page: CategoryPage, getLayout: null })<"P">;
export const dynamic = "force-static";
@@ -12,6 +12,7 @@ import Page from "~/apps/installation/[[...step]]/step-view";
export const generateMetadata = async ({ params, searchParams }: PageProps) => {
const legacyCtx = buildLegacyCtx(headers(), cookies(), params, searchParams);
const { appMetadata } = await getData(legacyCtx);
return await _generateMetadata(
(t) => `${t("install")} ${appMetadata?.name ?? ""}`,
@@ -0,0 +1,18 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSidePropsAppDir } from "@lib/apps/installed/[category]/getServerSideProps";
import Page from "~/apps/installed/[category]/installed-category-view";
export const generateMetadata = async () => {
return await _generateMetadata(
(t) => t("installed_apps"),
(t) => t("manage_your_connected_apps")
);
};
const getData = withAppDirSsr(getServerSidePropsAppDir);
export default WithLayout({ getLayout: null, getData, Page });
-19
View File
@@ -1,19 +0,0 @@
import { withAppDirSsg } from "app/WithAppDirSsg";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getStaticProps } from "@server/lib/auth/error/getStaticProps";
import Page from "~/auth/error/error-view";
export const generateMetadata = async () => {
return await _generateMetadata(
() => "Error",
() => ""
);
};
const getData = withAppDirSsg(getStaticProps, "future/auth/error");
export default WithLayout({ getData, Page, getLayout: null })<"P">;
export const dynamic = "force-static";
@@ -10,10 +10,10 @@ const paramsSchema = z
pages: [],
});
const Page = ({ params }: PageProps) => {
const { pages } = paramsSchema.parse(params);
const Page = ({ params, searchParams }: PageProps) => {
const { pages } = paramsSchema.parse({ ...params, ...searchParams });
redirect(`/routing/${pages.length ? pages.join("/") : ""}`);
redirect(`/apps/routing-forms/${pages.length ? pages.join("/") : ""}`);
};
export default Page;
@@ -1,7 +1,7 @@
import { redirect } from "next/navigation";
const Page = async () => {
redirect("/routing/forms");
const Page = () => {
redirect("/apps/routing-forms/forms");
};
export default Page;
+18
View File
@@ -0,0 +1,18 @@
"use client";
import { type NextPage } from "next";
import CustomError from "./error";
import type { ErrorProps } from "./error";
export const GlobalError: NextPage<ErrorProps> = (props) => {
return (
<html>
<body>
<CustomError {...props} />
</body>
</html>
);
};
export default GlobalError;
+4 -1
View File
@@ -1 +1,4 @@
export { default, generateMetadata } from "app/team/[slug]/page";
import Page from "app/team/[slug]/page";
export { generateMetadata } from "app/team/[slug]/page";
export default Page;
@@ -1 +1,4 @@
export { default, generateMetadata } from "app/team/[slug]/[type]/page";
import Page from "app/team/[slug]/[type]/page";
export { generateMetadata } from "app/team/[slug]/[type]/page";
export default Page;
@@ -1 +1,4 @@
export { default, generateMetadata } from "app/team/[slug]/page";
import Page from "app/team/[slug]/page";
export { generateMetadata } from "app/team/[slug]/page";
export default Page;
-70
View File
@@ -1,70 +0,0 @@
import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import type { GetServerSidePropsResult } from "next";
import { cookies, headers } from "next/headers";
import { notFound } from "next/navigation";
import z from "zod";
import { buildLegacyCtx } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/routing/[...pages]/getServerSideProps";
import RoutingFormsPage, { getLayout } from "~/routing/[...pages]/pages-view";
const paramsSchema = z.object({
pages: z.array(z.string()),
});
export const generateMetadata = async ({ params, searchParams }: PageProps) => {
const p = paramsSchema.safeParse(params);
if (!p.success) {
return notFound();
}
const ctx = buildLegacyCtx(headers(), cookies(), params, searchParams);
const data = await getData({
...ctx,
params: {
slug: "routing-forms",
pages: params.pages,
},
});
const form = "form" in data ? (data.form as { name?: string; description?: string }) : null;
const formName = form?.name;
const formDescription = form?.description;
const { pages } = p.data;
if (pages.includes("routing-link")) {
return await _generateMetadata(
() => `${formName} | Cal.com Forms`,
() => "",
true
);
}
return await _generateMetadata(
(t) => formName ?? t("routing_forms"),
(t) => formDescription ?? t("routing_forms_description")
);
};
const getData = withAppDirSsr<GetServerSidePropsResult<any>>(getServerSideProps);
const ServerPage = async ({ params, searchParams }: PageProps) => {
const ctx = buildLegacyCtx(headers(), cookies(), params, searchParams);
const props = await getData({
...ctx,
params: {
slug: "routing-forms",
pages: params.pages,
},
});
return <RoutingFormsPage {...props} />;
};
export default WithLayout({
getLayout,
ServerPage,
});
-7
View File
@@ -1,7 +0,0 @@
import { redirect } from "next/navigation";
const Page = async () => {
redirect("/routing/forms");
};
export default Page;
+6
View File
@@ -1,6 +1,7 @@
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import Shell from "@calcom/features/shell/Shell";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { HeadSeo } from "@calcom/ui";
import type { AppPageProps } from "./AppPage";
import { AppPage } from "./AppPage";
@@ -13,6 +14,11 @@ const ShellHeading = () => {
export default function WrappedApp(props: AppPageProps) {
return (
<Shell smallHeading isPublic hideHeadingOnMobile heading={<ShellHeading />} backPath="/apps" withoutSeo>
<HeadSeo
title={props.name}
description={props.description}
app={{ slug: props.logo, name: props.name, description: props.description }}
/>
{props.licenseRequired ? (
<LicenseRequired>
<AppPage {...props} />
+1 -1
View File
@@ -807,7 +807,7 @@ const RerouteDialogContentAndFooterWithFormResponse = ({
<div>
<Link
className="text-emphasis text-semibold font-cal mb-4 flex underline"
href={`/routing/form-edit/${form.id}`}
href={`/apps/routing-forms/form-edit/${form.id}`}
target="_blank">
{form.name}
</Link>
+2 -1
View File
@@ -11,12 +11,13 @@ interface Props {
showLogo?: boolean;
heading?: string;
loading?: boolean;
isAppDir?: boolean;
}
export default function AuthContainer(props: React.PropsWithChildren<Props>) {
return (
<div className="bg-subtle dark:bg-darkgray-50 flex min-h-screen flex-col justify-center py-12 sm:px-6 lg:px-8">
<HeadSeo title={props.title} description={props.description} />
{!props.isAppDir ? <HeadSeo title={props.title} description={props.description} /> : null}
{props.showLogo && <Logo small inline={false} className="mx-auto mb-auto" />}
<div className={classNames(props.showLogo ? "text-center" : "", "sm:mx-auto sm:w-full sm:max-w-md")}>
@@ -2,6 +2,7 @@ import type { GetServerSidePropsContext, GetServerSidePropsResult } from "next";
import { z } from "zod";
import { getAppWithMetadata } from "@calcom/app-store/_appRegistry";
import RoutingFormsRoutingConfig from "@calcom/app-store/routing-forms/pages/app-routing.config";
import TypeformRoutingConfig from "@calcom/app-store/typeform/pages/app-routing.config";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import prisma from "@calcom/prisma";
@@ -31,6 +32,7 @@ type NotFound = {
// TODO: It is a candidate for apps.*.generated.*
const AppsRouting = {
"routing-forms": RoutingFormsRoutingConfig,
typeform: TypeformRoutingConfig,
};
+19 -11
View File
@@ -1,5 +1,7 @@
import fs from "fs";
import matter from "gray-matter";
import MarkdownIt from "markdown-it";
import type { GetStaticPropsContext } from "next";
import path from "path";
import { z } from "zod";
@@ -8,6 +10,8 @@ import { getAppAssetFullPath } from "@calcom/app-store/getAppAssetFullPath";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
const md = new MarkdownIt("default", { html: true, breaks: true });
export const sourceSchema = z.object({
content: z.string(),
data: z.object({
@@ -25,15 +29,15 @@ export const sourceSchema = z.object({
}),
});
export type AppDataProps = NonNullable<Awaited<ReturnType<typeof getStaticProps>>>;
export const getStaticProps = async (ctx: GetStaticPropsContext) => {
if (typeof ctx.params?.slug !== "string") return { notFound: true } as const;
export const getStaticProps = async (slug: string) => {
const appMeta = await getAppWithMetadata({
slug,
slug: ctx.params?.slug,
});
const appFromDb = await prisma.app.findUnique({
where: { slug: slug.toLowerCase() },
where: { slug: ctx.params.slug.toLowerCase() },
});
const isAppAvailableInFileSystem = appMeta;
@@ -41,14 +45,16 @@ export const getStaticProps = async (slug: string) => {
if (!IS_PRODUCTION && isAppDisabled) {
return {
isAppDisabled: true as const,
data: {
...appMeta,
props: {
isAppDisabled: true as const,
data: {
...appMeta,
},
},
};
}
if (!appFromDb || !appMeta || isAppDisabled) return null;
if (!appFromDb || !appMeta || isAppDisabled) return { notFound: true } as const;
const isTemplate = appMeta.isTemplate;
const appDirname = path.join(isTemplate ? "templates" : "", appFromDb.dirName);
@@ -79,8 +85,10 @@ export const getStaticProps = async (slug: string) => {
});
}
return {
isAppDisabled: false as const,
source: { content, data },
data: appMeta,
props: {
isAppDisabled: false as const,
source: { content, data },
data: appMeta,
},
};
};
@@ -1,10 +1,12 @@
import type { GetStaticPropsContext } from "next";
import { getAppRegistry } from "@calcom/app-store/_appRegistry";
import prisma from "@calcom/prisma";
import type { AppCategories } from "@calcom/prisma/enums";
export type CategoryDataProps = NonNullable<Awaited<ReturnType<typeof getStaticProps>>>;
export const getStaticProps = async (context: GetStaticPropsContext) => {
const category = context.params?.category as AppCategories;
export const getStaticProps = async (category: AppCategories) => {
const appQuery = await prisma.app.findMany({
where: {
categories: {
@@ -22,7 +24,8 @@ export const getStaticProps = async (category: AppCategories) => {
const apps = appStore.filter((app) => dbAppsSlugs.includes(app.slug));
return {
apps,
category,
props: {
apps,
},
};
};
@@ -0,0 +1,78 @@
import type { GetServerSidePropsContext } from "next";
import { z } from "zod";
import { AppCategories } from "@calcom/prisma/enums";
export type querySchemaType = z.infer<typeof querySchema>;
export const querySchema = z.object({
category: z.nativeEnum(AppCategories),
});
export async function getServerSideProps(ctx: GetServerSidePropsContext) {
// get return-to cookie and redirect if needed
const { cookies } = ctx.req;
const returnTo = cookies["return-to"];
if (cookies && returnTo) {
ctx.res.setHeader("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
const redirect = {
redirect: {
destination: `${returnTo}`,
permanent: false,
},
} as const;
return redirect;
}
const params = querySchema.safeParse(ctx.params);
if (!params.success) {
const notFound = { notFound: true } as const;
return notFound;
}
return {
props: {
category: params.data.category,
},
};
}
export async function getServerSidePropsAppDir(ctx: GetServerSidePropsContext) {
// get return-to cookie and redirect if needed
const { cookies } = ctx.req;
const returnTo = cookies["return-to"];
if (cookies && returnTo) {
const NextResponse = await import("next/server").then((mod) => mod.NextResponse);
const response = NextResponse.next();
response.headers.set("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
const redirect = {
redirect: {
destination: `${returnTo}`,
permanent: false,
},
} as const;
return redirect;
}
const params = querySchema.safeParse(ctx.params);
if (!params.success) {
const notFound = { notFound: true } as const;
return notFound;
}
return {
props: {
category: params.data.category,
},
};
}
@@ -0,0 +1,3 @@
export async function getServerSideProps() {
return { redirect: { permanent: false, destination: "/apps/installed/calendar" } };
}
+23 -1
View File
@@ -26,6 +26,25 @@ const buildLegacyCookies = (cookies: ReadonlyRequestCookies) => {
return createProxifiedObject(cookiesObject);
};
function decodeParams(params: Params): Params {
return Object.entries(params).reduce((acc, [key, value]) => {
// Handle array values
if (Array.isArray(value)) {
acc[key] = value.map((item) => decodeURIComponent(item));
return acc;
}
// Handle single values
if (value !== undefined) {
acc[key] = decodeURIComponent(value);
} else {
acc[key] = value;
}
return acc;
}, {} as Params);
}
export const buildLegacyCtx = (
headers: ReadonlyHeaders,
cookies: ReadonlyRequestCookies,
@@ -34,7 +53,10 @@ export const buildLegacyCtx = (
) => {
return {
query: { ...searchParams, ...params },
params,
// decoding is required to be backward compatible with Pages Router
// because Next.js App Router does not auto-decode query params while Pages Router does
// e.g., params: { name: "John%20Doe" } => params: { name: "John Doe" }
params: decodeParams(params),
req: { headers: buildLegacyHeaders(headers), cookies: buildLegacyCookies(cookies) },
res: new Proxy(Object.create(null), {
// const { req, res } = ctx - valid
@@ -1,21 +0,0 @@
import type { GetServerSidePropsContext } from "next";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { ssrInit } from "@server/lib/ssr";
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
const ssr = await ssrInit(context);
const session = await getServerSession({ req: context.req });
if (!session) {
return {
redirect: {
permanent: false,
destination: "/auth/login",
},
};
}
return { props: { trpcState: ssr.dehydrate() } };
};
@@ -1,118 +0,0 @@
import type { GetServerSidePropsContext, GetServerSidePropsResult } from "next";
import { z } from "zod";
import { getAppWithMetadata } from "@calcom/app-store/_appRegistry";
import { routingServerSidePropsConfig } from "@calcom/app-store/routing-forms/pages/app-routing-server.config";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import { prisma } from "@calcom/prisma";
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
import type { AppProps } from "@lib/app-providers";
import { ssrInit } from "@server/lib/ssr";
type RoutingPageType = {
getServerSideProps?: AppGetServerSideProps;
// A component than can accept any properties
// eslint-disable-next-line @typescript-eslint/no-explicit-any
default: ((props: any) => JSX.Element) &
Pick<AppProps["Component"], "isBookingPage" | "getLayout" | "PageWrapper">;
};
type Found = {
notFound: false;
getServerSideProps: RoutingPageType["getServerSideProps"];
};
type NotFound = {
notFound: true;
};
function getRoute(pages: string[]) {
const mainPage = pages[0];
const getServerSideProps = routingServerSidePropsConfig[mainPage] as RoutingPageType["getServerSideProps"];
if (!getServerSideProps || typeof getServerSideProps !== "function") {
return {
notFound: true,
} as NotFound;
}
return { notFound: false, getServerSideProps } as Found;
}
const paramsSchema = z.object({
slug: z.string(),
pages: z.array(z.string()),
});
export async function getServerSideProps(
context: GetServerSidePropsContext
): Promise<GetServerSidePropsResult<any>> {
const { params, req } = context;
if (!params) {
return {
notFound: true,
};
}
const parsedParams = paramsSchema.safeParse(params);
if (!parsedParams.success) {
return {
notFound: true,
};
}
const appName = parsedParams.data.slug;
const pages = parsedParams.data.pages;
const route = getRoute(pages);
if (route.notFound) {
return { notFound: true };
}
if (route.getServerSideProps) {
params.appPages = pages.slice(1);
const session = await getServerSession({ req });
const user = session?.user;
const app = await getAppWithMetadata({ slug: appName });
if (!app) {
return {
notFound: true,
};
}
const result = await route.getServerSideProps(
context as GetServerSidePropsContext<{
slug: string;
pages: string[];
appPages: string[];
}>,
prisma,
user,
ssrInit
);
if (result.notFound) {
return { notFound: true };
}
if (result.redirect) {
return { redirect: result.redirect };
}
return {
props: {
appName,
appUrl: app.simplePath,
...result.props,
},
};
} else {
return {
props: {
appName,
},
};
}
}
@@ -5,8 +5,8 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import type { GetBookingType } from "@calcom/features/bookings/lib/get-booking";
import { getBookingForReschedule } from "@calcom/features/bookings/lib/get-booking";
import { getSlugOrRequestedSlug, orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
import { getOrganizationSEOSettings } from "@calcom/features/ee/organizations/lib/orgSettings";
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
import slugify from "@calcom/lib/slugify";
import prisma from "@calcom/prisma";
import { RedirectType } from "@calcom/prisma/client";
@@ -179,7 +179,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
eventData,
});
const organizationSettings = OrganizationRepository.utils.getOrganizationSEOSettings(team);
const organizationSettings = getOrganizationSEOSettings(team);
const allowSEOIndexing = organizationSettings?.allowSEOIndexing ?? false;
if (!eventData) {
@@ -1,13 +1,17 @@
import type { GetServerSidePropsContext } from "next";
import { orgDomainConfig } from "@calcom/features/ee/organizations/lib/orgDomains";
import {
getOrganizationSettings,
getVerifiedDomain,
} from "@calcom/features/ee/organizations/lib/orgSettings";
import { getFeatureFlag } from "@calcom/features/flags/server/utils";
import { IS_CALCOM } from "@calcom/lib/constants";
import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client";
import logger from "@calcom/lib/logger";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import { getTeamWithMembers } from "@calcom/lib/server/queries/teams";
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
import slugify from "@calcom/lib/slugify";
import { stripMarkdown } from "@calcom/lib/stripMarkdown";
import prisma from "@calcom/prisma";
@@ -30,8 +34,13 @@ function getOrgProfileRedirectToVerifiedDomain(
if (!team.isOrganization) {
return null;
}
// when this is not on a Cal.com page we don't auto redirect -
// good for diagnosis purposes.
if (!IS_CALCOM) {
return null;
}
const verifiedDomain = OrganizationRepository.utils.getVerifiedDomain(settings);
const verifiedDomain = getVerifiedDomain(settings);
if (!settings.orgProfileRedirectsToVerifiedDomain || !verifiedDomain) {
return null;
@@ -145,7 +154,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
} as const;
}
const organizationSettings = OrganizationRepository.utils.getOrganizationSettings(team);
const organizationSettings = getOrganizationSettings(team);
const allowSEOIndexing = organizationSettings?.allowSEOIndexing ?? false;
const redirectToVerifiedDomain = organizationSettings
+25 -15
View File
@@ -63,9 +63,11 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
requestHeaders.set("x-csp-enforce", "true");
}
if (url.pathname.startsWith("/apps/installed")) {
if (url.pathname.startsWith("/future/apps/installed")) {
const returnTo = req.cookies.get("return-to")?.value;
if (returnTo !== undefined) {
requestHeaders.set("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
let validPathname = returnTo;
try {
@@ -74,14 +76,8 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
const nextUrl = url.clone();
nextUrl.pathname = validPathname;
const response = NextResponse.redirect(nextUrl);
response.cookies.set("return-to", "", {
expires: new Date(0),
path: "/",
});
return response;
// TODO: Consider using responseWithHeaders here
return NextResponse.redirect(nextUrl, { headers: requestHeaders });
}
}
@@ -111,10 +107,9 @@ const routingForms = {
handleRewrite: (url: URL) => {
// Don't 404 old routing_forms links
if (url.pathname.startsWith("/apps/routing_forms")) {
url.pathname = url.pathname.replace(/^\/apps\/routing_forms($|\/)/, "/routing/");
url.pathname = url.pathname.replace(/^\/apps\/routing_forms($|\/)/, "/apps/routing-forms/");
return NextResponse.rewrite(url);
}
return null;
},
};
@@ -172,11 +167,26 @@ export const config = {
"/api/trpc/:path*",
"/login",
"/auth/login",
"/apps/:path*",
"/getting-started/:path*",
"/workflows/:path*",
"/auth/error",
/**
* Paths required by routingForms.handle
*/
"/apps/routing_forms/:path*",
"/event-types/:path*",
"/routing/:path*",
"/apps/installed/:category/",
"/future/apps/installed/:category/",
"/apps/:slug/",
"/future/apps/:slug/",
"/apps/:slug/setup/",
"/future/apps/:slug/setup/",
"/apps/categories/",
"/future/apps/categories/",
"/apps/categories/:category/",
"/future/apps/categories/:category/",
"/workflows/:path*",
"/getting-started/:path*",
"/apps",
"/bookings/:path*",
"/video/:path*",
"/teams/:path*",
@@ -1,5 +1,6 @@
"use client";
import RoutingFormsRoutingConfig from "@calcom/app-store/routing-forms/pages/app-routing.config";
import TypeformRoutingConfig from "@calcom/app-store/typeform/pages/app-routing.config";
import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback";
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
@@ -28,6 +29,7 @@ type NotFound = {
// TODO: It is a candidate for apps.*.generated.*
const AppsRouting = {
"routing-forms": RoutingFormsRoutingConfig,
typeform: TypeformRoutingConfig,
};
@@ -7,6 +7,7 @@ import { AppSetupPage } from "@calcom/app-store/_pages/setup";
import type { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import { HeadSeo } from "@calcom/ui";
export type PageProps = inferSSRProps<typeof getServerSideProps>;
@@ -27,5 +28,11 @@ export default function SetupInformation(props: PageProps) {
router.replace(`/auth/login?${urlSearchParams.toString()}`);
}
return <AppSetupPage slug={slug} {...props} />;
return (
<>
{/* So that the set up page does not get indexed by search engines */}
<HeadSeo nextSeoProps={{ noindex: true, nofollow: true }} title={`${slug} | Cal.com`} description="" />
<AppSetupPage slug={slug} {...props} />
</>
);
}
+8 -2
View File
@@ -1,5 +1,7 @@
"use client";
import MarkdownIt from "markdown-it";
import type { InferGetStaticPropsType } from "next";
import Link from "next/link";
import { IS_PRODUCTION } from "@calcom/lib/constants";
@@ -7,12 +9,16 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import { showToast } from "@calcom/ui";
import type { AppDataProps } from "@lib/apps/[slug]/getStaticProps";
import type { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
import useRouterQuery from "@lib/hooks/useRouterQuery";
import App from "@components/apps/App";
function SingleAppPage(props: AppDataProps) {
const md = new MarkdownIt("default", { html: true, breaks: true });
export type PageProps = InferGetStaticPropsType<typeof getStaticProps>;
function SingleAppPage(props: PageProps) {
const { error, setQuery: setError } = useRouterQuery("error");
const { t } = useLocale();
if (error === "account_already_linked") {
@@ -1,15 +1,20 @@
"use client";
import type { InferGetStaticPropsType } from "next";
import Link from "next/link";
import Shell from "@calcom/features/shell/Shell";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { AppCard, SkeletonText } from "@calcom/ui";
import type { CategoryDataProps } from "@lib/apps/categories/[category]/getStaticProps";
import type { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
export default function Apps({ apps, category }: CategoryDataProps) {
export type PageProps = InferGetStaticPropsType<typeof getStaticProps>;
export default function Apps({ apps }: PageProps) {
const searchParams = useCompatSearchParams();
const { t, isLocaleReady } = useLocale();
const category = searchParams?.get("category");
return (
<>
@@ -1,5 +1,6 @@
"use client";
import Head from "next/head";
import { usePathname, useRouter } from "next/navigation";
import { useEffect, useMemo, useRef, useState } from "react";
import { useForm } from "react-hook-form";
@@ -225,6 +226,12 @@ const OnboardingPage = ({
key={pathname}
className="dark:bg-brand dark:text-brand-contrast text-emphasis min-h-screen px-4"
data-testid="onboarding">
<Head>
<title>
{t("install")} {appMetadata?.name ?? ""}
</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<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}>
@@ -8,9 +8,11 @@ import type { UpdateUsersDefaultConferencingAppParams } from "@calcom/features/a
import DisconnectIntegrationModal from "@calcom/features/apps/components/DisconnectIntegrationModal";
import type { RemoveAppParams } from "@calcom/features/apps/components/DisconnectIntegrationModal";
import type { BulkUpdatParams } from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { AppCategories } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import type { Icon } from "@calcom/ui";
import {
AppSkeletonLoader as SkeletonLoader,
@@ -21,6 +23,7 @@ import {
} from "@calcom/ui";
import { QueryCell } from "@lib/QueryCell";
import type { querySchemaType, getServerSideProps } from "@lib/apps/installed/[category]/getServerSideProps";
import { CalendarListContainer } from "@components/apps/CalendarListContainer";
import InstalledAppsLayout from "@components/apps/layouts/InstalledAppsLayout";
@@ -180,13 +183,13 @@ type ModalState = {
teamId?: number;
};
type PageProps = {
category: AppCategories;
};
export type PageProps = inferSSRProps<typeof getServerSideProps>;
export default function InstalledApps({ category }: PageProps) {
export default function InstalledApps(props: PageProps) {
const searchParams = useCompatSearchParams();
const { t } = useLocale();
const utils = trpc.useUtils();
const category = searchParams?.get("category") as querySchemaType["category"];
const categoryList: AppCategories[] = Object.values(AppCategories).filter((category) => {
// Exclude calendar and other from categoryList, we handle those slightly differently below
return !(category in { other: null, calendar: null });
+1 -3
View File
@@ -9,13 +9,11 @@ import { Button, Icon } from "@calcom/ui";
import AuthContainer from "@components/ui/AuthContainer";
import type { PageProps } from "@server/lib/auth/error/getStaticProps";
const querySchema = z.object({
error: z.string().optional(),
});
export default function Error(props: PageProps) {
export default function Error() {
const { t } = useLocale();
const searchParams = useSearchParams();
const { error } = querySchema.parse({ error: searchParams?.get("error") || undefined });
@@ -19,7 +19,6 @@ import type { nameObjectSchema } from "@calcom/core/event";
import { getEventName } from "@calcom/core/event";
import type { ConfigType } from "@calcom/dayjs";
import dayjs from "@calcom/dayjs";
import { getOrgFullOrigin } from "@calcom/ee/organizations/lib/orgDomains";
import {
useEmbedNonStylesConfig,
useIsBackgroundTransparent,
@@ -61,7 +60,6 @@ import {
showToast,
EmptyScreen,
Icon,
HeadSeo,
} from "@calcom/ui";
import CancelBooking from "@calcom/web/components/booking/CancelBooking";
import EventReservationSchema from "@calcom/web/components/schemas/EventReservationSchema";
@@ -109,7 +107,7 @@ export default function Success(props: PageProps) {
const routerQuery = useRouterQuery();
const pathname = usePathname();
const searchParams = useCompatSearchParams();
const { eventType, bookingInfo, requiresLoginToUpdate, orgSlug, rescheduledToUid } = props;
const { eventType, bookingInfo, requiresLoginToUpdate, rescheduledToUid } = props;
const {
allRemainingBookings,
@@ -348,10 +346,6 @@ export default function Success(props: PageProps) {
brandColor: props.profile.brandColor,
darkBrandColor: props.profile.darkBrandColor,
});
const title = t(
`booking_${needsConfirmation ? "submitted" : "confirmed"}${props.recurringBookings ? "_recurring" : ""}`
);
const locationToDisplay = getSuccessPageLocationMessage(
locationVideoCallUrl ? locationVideoCallUrl : location,
t,
@@ -440,7 +434,6 @@ export default function Success(props: PageProps) {
</Link>
</div>
)}
<HeadSeo origin={getOrgFullOrigin(orgSlug)} title={title} description={title} />
<BookingPageTagManager
eventType={{ ...eventType, metadata: eventTypeMetaDataSchemaWithTypedApps.parse(eventType.metadata) }}
/>
@@ -2,7 +2,6 @@
import { Booker } from "@calcom/atoms/monorepo";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import { BookerSeo } from "@calcom/features/bookings/components/BookerSeo";
import { type PageProps } from "@lib/d/[link]/[slug]/getServerSideProps";
@@ -20,13 +19,6 @@ export default function Type({
}: PageProps) {
return (
<main className={getBookerWrapperClasses({ isEmbed: !!isEmbed })}>
<BookerSeo
username={user}
eventSlug={slug}
rescheduleUid={booking?.uid}
hideBranding={isBrandingHidden}
entity={entity}
/>
<Booker
username={user}
eventSlug={slug}
@@ -944,7 +944,6 @@ const InfiniteScrollMain = ({
const EventTypesPage: React.FC = () => {
const { t } = useLocale();
const searchParams = useSearchParams();
const { data: user } = useMeQuery();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_showProfileBanner, setShowProfileBanner] = useState(false);
@@ -1,76 +0,0 @@
"use client";
import { useParams } from "next/navigation";
import RoutingFormsRoutingConfig from "@calcom/app-store/routing-forms/pages/app-routing.config";
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import type { AppProps } from "@lib/app-providers";
import type { getServerSideProps } from "@lib/apps/[slug]/[...pages]/getServerSideProps";
type RoutingPageType = {
getServerSideProps: AppGetServerSideProps;
// A component than can accept any properties
// eslint-disable-next-line @typescript-eslint/no-explicit-any
default: ((props: any) => JSX.Element) &
Pick<AppProps["Component"], "isBookingPage" | "getLayout" | "PageWrapper">;
};
type Found = {
notFound: false;
Component: RoutingPageType["default"];
getServerSideProps: RoutingPageType["getServerSideProps"];
};
type NotFound = {
notFound: true;
};
function getRoute(pages: string[]) {
const routingConfig = RoutingFormsRoutingConfig as unknown as Record<string, RoutingPageType>;
const mainPage = pages[0];
const appPage = routingConfig.layoutHandler || (routingConfig[mainPage] as RoutingPageType);
if (!appPage) {
return {
notFound: true,
} as NotFound;
}
return { notFound: false, Component: appPage.default, ...appPage } as Found;
}
export type PageProps = inferSSRProps<typeof getServerSideProps>;
const RoutingFormsPage: RoutingPageType["default"] = function RoutingFormsPage(props: PageProps) {
const params = useParams();
const _pages = params?.pages ?? [];
const pages = Array.isArray(_pages) ? _pages : _pages.split("/");
const route = getRoute(pages);
const componentProps = {
...props,
pages: pages.slice(1),
};
if (!route || route.notFound) {
throw new Error("Route can't be undefined");
}
return <route.Component {...componentProps} />;
};
export const getLayout: NonNullable<(typeof RoutingFormsPage)["getLayout"]> = (page) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const params = useParams();
const _pages = params?.pages ?? [];
const pages = Array.isArray(_pages) ? _pages : _pages.split("/");
const route = getRoute(pages as string[]);
if (route.notFound) {
return null;
}
if (!route.Component.getLayout) {
return page;
}
return route.Component.getLayout(page);
};
export default RoutingFormsPage;
+2 -26
View File
@@ -12,7 +12,6 @@ import { usePathname } from "next/navigation";
import { useEffect } from "react";
import { sdkActionManager, useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
import EventTypeDescription from "@calcom/features/eventtypes/components/EventTypeDescription";
import { getOrgOrTeamAvatar } from "@calcom/lib/defaultAvatarImage";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -20,7 +19,7 @@ import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
import useTheme from "@calcom/lib/hooks/useTheme";
import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
import { Avatar, Button, HeadSeo, UnpublishedEntity, UserAvatarGroup } from "@calcom/ui";
import { Avatar, Button, UnpublishedEntity, UserAvatarGroup } from "@calcom/ui";
import { useToggleQuery } from "@lib/hooks/useToggleQuery";
import type { getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
@@ -29,14 +28,7 @@ import type { inferSSRProps } from "@lib/types/inferSSRProps";
import Team from "@components/team/screens/Team";
export type PageProps = inferSSRProps<typeof getServerSideProps>;
function TeamPage({
team,
considerUnpublished,
markdownStrippedBio,
isValidOrgDomain,
currentOrgDomain,
isSEOIndexable,
}: PageProps) {
function TeamPage({ team, considerUnpublished, isValidOrgDomain }: PageProps) {
useTheme(team.theme);
const routerQuery = useRouterQuery();
const pathname = usePathname();
@@ -165,22 +157,6 @@ function TeamPage({
return (
<>
<HeadSeo
origin={getOrgFullOrigin(currentOrgDomain)}
title={teamName}
description={teamName}
meeting={{
title: markdownStrippedBio,
profile: {
name: `${team.name}`,
image: profileImageSrc,
},
}}
nextSeoProps={{
nofollow: !isSEOIndexable,
noindex: !isSEOIndexable,
}}
/>
<main className="dark:bg-darkgray-50 bg-subtle mx-auto max-w-3xl rounded-md px-4 pb-12 pt-12">
<div className="mx-auto mb-8 max-w-3xl text-center">
<div className="relative">
+1 -1
View File
@@ -295,7 +295,7 @@ const nextConfig = {
const beforeFiles = [
{
source: "/forms/:formQuery*",
destination: "/routing/routing-link/:formQuery*",
destination: "/apps/routing-forms/routing-link/:formQuery*",
},
{
source: "/success/:path*",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@calcom/web",
"version": "4.8.19",
"version": "4.9.2",
"private": true,
"scripts": {
"analyze": "ANALYZE=true next build",
+15
View File
@@ -0,0 +1,15 @@
import { getServerSideProps } from "@lib/apps/[slug]/[...pages]/getServerSideProps";
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/[slug]/[...pages]/pages-view";
import PagesView, { getLayout } from "~/apps/[slug]/[...pages]/pages-view";
const Page = (props: PageProps) => <PagesView {...props} />;
Page.PageWrapper = PageWrapper;
Page.getLayout = getLayout;
export { getServerSideProps };
export default Page;
+39
View File
@@ -0,0 +1,39 @@
import { Prisma } from "@prisma/client";
import type { GetStaticPaths } from "next";
import { AppRepository } from "@calcom/lib/server/repository/app";
import { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/[slug]/slug-view";
import SingleAppPage from "~/apps/[slug]/slug-view";
const Page = (props: PageProps) => <SingleAppPage {...props} />;
export const getStaticPaths: GetStaticPaths<{ slug: string }> = async () => {
let paths: { params: { slug: string } }[] = [];
try {
const appStore = await AppRepository.findAppStore();
paths = appStore.map(({ slug }) => ({ params: { slug } }));
} catch (e: unknown) {
if (e instanceof Prisma.PrismaClientInitializationError) {
// Database is not available at build time, but that's ok – we fall back to resolving paths on demand
} else {
throw e;
}
}
return {
paths,
fallback: "blocking",
};
};
export { getStaticProps };
Page.PageWrapper = PageWrapper;
export default Page;
+14
View File
@@ -0,0 +1,14 @@
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/[slug]/setup/setup-view";
import SetupView from "~/apps/[slug]/setup/setup-view";
const Page = (props: PageProps) => <SetupView {...props} />;
Page.PageWrapper = PageWrapper;
export { getServerSideProps };
export default Page;
@@ -0,0 +1,33 @@
import { AppCategories } from "@calcom/prisma/enums";
import { isPrismaAvailableCheck } from "@calcom/prisma/is-prisma-available-check";
import { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/categories/[category]/category-view";
import CategoryView from "~/apps/categories/[category]/category-view";
const Page = (props: PageProps) => <CategoryView {...props} />;
Page.PageWrapper = PageWrapper;
export const getStaticPaths = async () => {
const paths = Object.keys(AppCategories);
const isPrismaAvailable = await isPrismaAvailableCheck();
if (!isPrismaAvailable) {
// Database is not available at build time. Make sure we fall back to building these pages on demand
return {
paths: [],
fallback: "blocking",
};
}
return {
paths: paths.map((category) => ({ params: { category } })),
fallback: false,
};
};
export default Page;
export { getStaticProps };
+12
View File
@@ -0,0 +1,12 @@
import { getServerSideProps } from "@lib/apps/categories/getServerSideProps";
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/categories/categories-view";
import Apps from "~/apps/categories/categories-view";
const Page = (props: PageProps) => <Apps {...props} />;
Page.PageWrapper = PageWrapper;
export default Page;
export { getServerSideProps };
@@ -0,0 +1,12 @@
import PageWrapper from "@components/PageWrapper";
import type { OnboardingPageProps } from "~/apps/installation/[[...step]]/step-view";
import StepView from "~/apps/installation/[[...step]]/step-view";
const Page = (props: OnboardingPageProps) => <StepView {...props} />;
Page.PageWrapper = PageWrapper;
export { getServerSideProps } from "@lib/apps/installation/[[...step]]/getServerSideProps";
export default Page;
@@ -0,0 +1,12 @@
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "~/apps/installed/[category]/installed-category-view";
import InstalledApps from "~/apps/installed/[category]/installed-category-view";
const Page = (props: PageProps) => <InstalledApps {...props} />;
Page.PageWrapper = PageWrapper;
export { getServerSideProps } from "@lib/apps/installed/[category]/getServerSideProps";
export default Page;
+7
View File
@@ -0,0 +1,7 @@
export { getServerSideProps } from "@lib/apps/installed/getServerSideProps";
function RedirectPage() {
return;
}
export default RedirectPage;
-11
View File
@@ -1,11 +0,0 @@
import PageWrapper from "@components/PageWrapper";
import type { PageProps } from "@server/lib/auth/error/getStaticProps";
import { getStaticProps } from "@server/lib/auth/error/getStaticProps";
import Error from "~/auth/error/error-view";
const Page = (props: PageProps) => <Error {...props} />;
Page.PageWrapper = PageWrapper;
export default Page;
export { getStaticProps };
-6
View File
@@ -1,6 +0,0 @@
export default function NewUserPage() {
if (typeof window !== "undefined") {
window.location.assign(process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com");
}
return null;
}
@@ -0,0 +1,25 @@
import type { GetServerSidePropsContext } from "next";
import z from "zod";
const paramsSchema = z
.object({
pages: z.array(z.string()),
})
.catch({
pages: [],
});
export default function RoutingForms() {
return null;
}
export const getServerSideProps = (context: GetServerSidePropsContext) => {
const { pages } = paramsSchema.parse(context.params);
return {
redirect: {
destination: `/apps/routing-forms/${pages.length ? pages.join("/") : ""}`,
permanent: false,
},
};
};
+12
View File
@@ -0,0 +1,12 @@
export default function RoutingFormsIndex() {
return null;
}
export const getServerSideProps = () => {
return {
redirect: {
destination: `/apps/routing-forms/forms`,
permanent: false,
},
};
};
-6
View File
@@ -570,12 +570,6 @@
<path d="M4 17v2" ></path>
<path d="M5 18H3" ></path>
</symbol>
<symbol class="lucide lucide-split" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="split">
<path d="M16 3h5v5" ></path>
<path d="M8 3H3v5" ></path>
<path d="M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3" ></path>
<path d="m15 9 6-6" ></path>
</symbol>
<symbol class="lucide lucide-square-check" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="square-check">
<rect width="18" height="18" x="3" y="3" rx="2" ></rect>
<path d="m9 12 2 2 4-4" ></path>

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

@@ -2926,5 +2926,6 @@
"managed_users": "المستخدمون المُدارون",
"managed_users_description": "عرض جميع المستخدمين المُدارين الذين تم إنشاؤهم بواسطة عميل OAuth الخاص بك",
"select_oAuth_client": "اختر عميل OAuth",
"on_every_instance": "في كل مثيل",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ أضف السلاسل الجديدة أعلاه هنا ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "İdarə edilən istifadəçilər",
"managed_users_description": "OAuth müştəriniz tərəfindən yaradılmış bütün idarə edilən istifadəçiləri görün",
"select_oAuth_client": "OAuth müştərisini seçin",
"on_every_instance": "Hər nümunədə",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Yeni sətirləri bura əlavə edin ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Управлявани потребители",
"managed_users_description": "Вижте всички управлявани потребители, създадени от вашия OAuth клиент",
"select_oAuth_client": "Изберете OAuth клиент",
"on_every_instance": "При всяко изпълнение",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Добавете новите си низове над този ред ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Usuaris gestionats",
"managed_users_description": "Veure tots els usuaris gestionats creats pel teu client OAuth",
"select_oAuth_client": "Selecciona el client OAuth",
"on_every_instance": "A cada instància",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Afegiu les vostres noves cadenes a dalt ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Spravovaní uživatelé",
"managed_users_description": "Zobrazit všechny spravované uživatele vytvořené vaším OAuth klientem",
"select_oAuth_client": "Vybrat OAuth klienta",
"on_every_instance": "Na každé instanci",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Přidejte své nové řetězce nahoru ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Administrerede brugere",
"managed_users_description": "Se alle administrerede brugere oprettet af din OAuth-klient",
"select_oAuth_client": "Vælg OAuth-klient",
"on_every_instance": "På hver forekomst",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Tilføj dine nye strenge ovenfor her ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Verwaltete Benutzer",
"managed_users_description": "Sehen Sie alle verwalteten Benutzer, die von Ihrem OAuth-Client erstellt wurden",
"select_oAuth_client": "OAuth-Client auswählen",
"on_every_instance": "Bei jeder Instanz",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Fügen Sie Ihre neuen Code-Zeilen über dieser hinzu ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Διαχειριζόμενοι χρήστες",
"managed_users_description": "Δείτε όλους τους διαχειριζόμενους χρήστες που δημιουργήθηκαν από το OAuth client σας",
"select_oAuth_client": "Επιλέξτε OAuth Client",
"on_every_instance": "Σε κάθε περίπτωση",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Προσθέστε τις νέες συμβολοσειρές σας πάνω από εδώ ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Usuarios administrados",
"managed_users_description": "Ver todos los usuarios administrados creados por tu cliente OAuth",
"select_oAuth_client": "Seleccionar cliente OAuth",
"on_every_instance": "En cada instancia",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Agrega tus nuevas cadenas arriba de esta línea ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Usuarios gestionados",
"managed_users_description": "Ver todos los usuarios gestionados creados por tu cliente OAuth",
"select_oAuth_client": "Seleccionar cliente OAuth",
"on_every_instance": "En cada instancia",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Agregue sus nuevas cadenas arriba ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Hallatavad kasutajad",
"managed_users_description": "Vaata kõiki hallatavaid kasutajaid, mis on loodud sinu OAuth kliendi poolt",
"select_oAuth_client": "Vali OAuth klient",
"on_every_instance": "Igal korral",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Kudeatutako erabiltzaileak",
"managed_users_description": "Ikusi zure OAuth bezeroak sortutako kudeatutako erabiltzaile guztiak",
"select_oAuth_client": "Hautatu OAuth bezeroa",
"on_every_instance": "Instantzia bakoitzean",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Gehitu zure kate berriak honen gainean ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Hallinnoidut käyttäjät",
"managed_users_description": "Näe kaikki OAuth-asiakassovelluksesi luomat hallinnoidut käyttäjät",
"select_oAuth_client": "Valitse OAuth-asiakassovellus",
"on_every_instance": "Jokaisessa instanssissa",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Lisää uudet merkkijonot tämän yläpuolelle ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Utilisateurs gérés",
"managed_users_description": "Voir tous les utilisateurs gérés créés par votre client OAuth",
"select_oAuth_client": "Sélectionner le client OAuth",
"on_every_instance": "Sur chaque instance",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Ajoutez vos nouvelles chaînes ci-dessus ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "משתמשים מנוהלים",
"managed_users_description": "צפה בכל המשתמשים המנוהלים שנוצרו על ידי לקוח OAuth שלך",
"select_oAuth_client": "בחר לקוח OAuth",
"on_every_instance": "בכל מופע",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Kezelt felhasználók",
"managed_users_description": "Az OAuth kliense által létrehozott összes kezelt felhasználó megtekintése",
"select_oAuth_client": "OAuth kliens kiválasztása",
"on_every_instance": "Minden példányon",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Adja hozzá az új karakterláncokat fent ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "Utenti gestiti",
"managed_users_description": "Visualizza tutti gli utenti gestiti creati dal tuo client OAuth",
"select_oAuth_client": "Seleziona client OAuth",
"on_every_instance": "Su ogni istanza",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Aggiungi le tue nuove stringhe qui sopra ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
@@ -2926,5 +2926,6 @@
"managed_users": "管理対象ユーザー",
"managed_users_description": "OAuthクライアントによって作成された管理対象ユーザーをすべて表示",
"select_oAuth_client": "OAuthクライアントを選択",
"on_every_instance": "すべてのインスタンスで",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ この上に新しい文字列を追加してください ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}

Some files were not shown because too many files have changed in this diff Show More