From 81e4241f8556cc1c0bebdd2b3c953727a443d049 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Tue, 10 Feb 2026 18:55:24 +0100 Subject: [PATCH] refactor: apply biome formatting to apps/web (#27692) * refactor: apply biome formatting to apps/web (batch 1) Formats apps/web non-modules directories: - apps/web/app - apps/web/lib - apps/web/pages - apps/web/styles - apps/web/server - apps/web/test - Root-level .ts and .mjs files Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to apps/web/modules (batch 2) Formats smaller apps/web/modules directories: - onboarding, data-table, users, apps, auth - integration-attribute-sync, shell, availability - feature-flags, team, webhooks, getting-started - feature-opt-in, troubleshooter, schedules, notifications - signup-view.tsx Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to apps/web/modules (batch 3) Formats medium apps/web/modules directories: - bookings - event-types - insights - embed Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to apps/web/modules/ee (batch 4) Formats apps/web/modules/ee directory. Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to apps/web (batch 5) Formats remaining apps/web directories: - apps/web/modules/settings - apps/web/modules/booking-audit - apps/web/playwright Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to apps/web/components (batch 6) Formats remaining apps/web/components files. Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to new apps/web files from main Formats newly added/modified files from main merge: - WorkflowStepContainer.tsx (resolved merge conflicts) - Newly moved files (blocklist, form-builder, schedules, etc.) - Other files modified in main Co-Authored-By: Claude Opus 4.5 * refactor: apply biome formatting to new apps/web files from main Co-Authored-By: Claude Opus 4.5 --------- Co-authored-by: Claude Opus 4.5 Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../(main-nav)/booking/[uid]/logs/page.tsx | 47 +- .../(main-nav)/event-types/page.tsx | 62 +- .../(main-nav)/teams/CTA.tsx | 2 +- .../apps/(homepage)/page.tsx | 15 +- .../routing-forms/[...pages]/FormEdit.tsx | 67 +- .../[...pages]/IncompleteBooking.tsx | 26 +- .../routing-forms/[...pages]/RouteBuilder.tsx | 4 +- .../apps/routing-forms/[...pages]/page.tsx | 2 +- .../(use-page-wrapper)/auth/error/page.tsx | 8 +- .../onboarding/getting-started/page.tsx | 4 +- .../onboarding/organization/brand/page.tsx | 1 - .../organization/invite/email/page.tsx | 1 - .../onboarding/personal/settings/page.tsx | 4 +- .../onboarding/teams/invite/email/page.tsx | 1 - .../admin/organizations/[id]/edit/page.tsx | 5 +- .../admin/organizations/page.tsx | 5 +- .../admin/workspace-platforms/page.tsx | 5 +- .../SettingsLayoutAppDirClient.tsx | 7 +- .../developer/oauth/page.tsx | 4 +- .../_components/AdvancedPermissionGroup.tsx | 8 +- .../teams/other/(main-page)/page.tsx | 6 +- .../teams/other/[id]/members/page.tsx | 4 +- .../settings/license-key/new/page.tsx | 4 +- apps/web/app/GeoContext.tsx | 8 +- apps/web/app/_trpc/trpc-client.ts | 4 +- apps/web/app/api/auth/oauth/token/route.ts | 5 +- .../handlers/calcomSignupHandler.test.ts | 27 +- .../signup/handlers/selfHostedHandler.test.ts | 23 +- .../auth/signup/handlers/selfHostedHandler.ts | 7 +- .../app/api/availability/calendar/route.ts | 3 +- apps/web/app/api/cron/credentials/route.ts | 28 +- .../selected-calendars/__tests__/cron.test.ts | 16 +- .../app/api/cron/selected-calendars/route.ts | 16 +- .../app/api/defaultResponderForAppDir.test.ts | 8 +- apps/web/app/api/ip/route.ts | 2 +- .../social/og/image/__tests__/route.test.ts | 18 +- apps/web/app/api/social/og/image/route.tsx | 12 +- .../retell-ai/__tests__/route.test.ts | 26 +- apps/web/app/e2e/session-warmup/page.tsx | 5 +- apps/web/app/notFoundClient.tsx | 10 +- apps/web/components/PageWrapper.tsx | 4 +- apps/web/components/PageWrapperAppDir.tsx | 1 - apps/web/components/apps/AppPage.tsx | 4 +- .../components/apps/CalendarListContainer.tsx | 6 +- .../components/apps/InstallAppButtonChild.tsx | 14 +- .../btcpayserver/BtcpayPaymentComponent.tsx | 300 ++--- .../apps/installation/EventTypesStepCard.tsx | 19 +- apps/web/components/apps/paypal/Setup.tsx | 6 +- .../apps/routing-forms/FormActions.tsx | 5 +- .../components/booking/BookingListItem.tsx | 25 +- .../components/booking/RoutingTraceSheet.tsx | 4 +- .../actions/BookingActionsDropdown.tsx | 52 +- .../booking/actions/bookingActions.ts | 10 +- apps/web/components/dialog/ReassignDialog.tsx | 74 +- apps/web/components/dialog/RerouteDialog.tsx | 2 +- .../dialog/WrongAssignmentDialog.tsx | 12 +- .../schemas/EventReservationSchema.tsx | 2 +- apps/web/lib/app-providers-app-dir.tsx | 2 +- apps/web/lib/app-providers.tsx | 14 +- .../lib/apps/categories/getServerSideProps.ts | 15 +- .../[[...step]]/getServerSideProps.ts | 801 ++++++++----- .../d/[link]/[slug]/getServerSideProps.tsx | 5 +- apps/web/lib/getThemeProviderProps.ts | 12 +- apps/web/lib/handleOrgRedirect.test.ts | 2 +- .../billing/useSubscribeTeamToStripe.ts | 6 +- .../useUpgradeTeamSubscriptionInStripe.ts | 6 +- .../oauth-clients/usePersistOAuthClient.ts | 12 +- .../team/[slug]/[type]/getServerSideProps.ts | 14 +- apps/web/lib/signup/getServerSideProps.tsx | 36 +- .../team/[slug]/[type]/getServerSideProps.tsx | 13 +- apps/web/lib/types/inferSSRProps.ts | 5 +- .../web/lib/video/[uid]/getServerSideProps.ts | 4 +- apps/web/modules/apps/[slug]/slug-view.tsx | 2 +- apps/web/modules/apps/components/AppCard.tsx | 152 +-- .../installation/[[...step]]/step-view.tsx | 5 +- apps/web/modules/auth/login-view.tsx | 109 +- .../modules/auth/oauth2/authorize-view.tsx | 89 +- apps/web/modules/auth/verify-email-view.tsx | 2 +- apps/web/modules/auth/verify-view.tsx | 4 +- .../availability/availability-view.tsx | 14 +- .../troubleshoot/troubleshoot-view.tsx | 3 +- .../components/BlockedEntriesTable.tsx | 4 +- .../components/BlocklistEntryDetailsSheet.tsx | 4 +- .../components/CreateBlocklistEntryModal.tsx | 6 +- .../components/BookingHistory.tsx | 735 ++++++------ .../components/BookingHistoryPage.tsx | 4 +- .../components/AvailableTimeSlots.tsx | 68 +- .../BookEventForm/BookEventForm.tsx | 8 +- .../modules/bookings/components/Booker.tsx | 21 +- .../components/BookingDetailsSheet.tsx | 30 +- .../bookings/components/DatePicker.tsx | 22 +- .../bookings/components/LargeCalendar.tsx | 2 +- .../components/SeatsAvailabilityText.tsx | 12 +- .../components/SlotSelectionModalHeader.tsx | 9 +- .../components/__mocks__/DryRunMessage.tsx | 2 +- .../components/event-meta/Details.tsx | 4 +- .../bookings/hooks/useActiveSegmentFromUrl.ts | 17 +- .../web/modules/bookings/hooks/useBookings.ts | 4 +- .../modules/bookings/hooks/useEventTypes.ts | 27 +- apps/web/modules/bookings/hooks/useSlots.ts | 9 +- ...ookings-single-view.getServerSideProps.tsx | 14 +- .../filters/BaseSelectFilterOptions.tsx | 19 +- .../filters/ColumnVisibilityButton.test.tsx | 6 +- .../filters/ColumnVisibilityButton.tsx | 2 +- .../components/filters/DateRangeFilter.tsx | 8 +- .../components/filters/FilterPopover.tsx | 8 +- .../segment/FilterSegmentSelect.tsx | 20 +- .../billing/components/DueInvoiceBanner.tsx | 3 +- .../ee/common/components/LicenseRequired.tsx | 15 +- .../components/CreateLicenseKeyForm.tsx | 447 ++++--- .../components/BulkDeleteBlocklistEntries.tsx | 53 +- .../admin/components/BulkDismissReports.tsx | 54 +- .../admin/views/SystemBlocklistView.tsx | 90 +- .../organizations/other-team-profile-view.tsx | 1 - .../organizations/privacy/blocklist-table.tsx | 80 +- apps/web/modules/ee/organizations/profile.tsx | 59 +- .../components/CreateANewPlatformForm.tsx | 5 +- .../modules/ee/posthog/PostHogPageView.tsx | 2 +- .../support/lib/freshchat/FreshChatScript.tsx | 3 +- .../lib/helpscout/HelpscoutMenuItem.tsx | 1 - .../support/lib/zendesk/ZendeskMenuItem.tsx | 1 - .../ee/teams/components/EditMemberSheet.tsx | 96 +- .../ee/teams/components/MemberList.tsx | 7 +- .../teams/components/RoundRobinSettings.tsx | 5 +- .../components/createButton/CreateButton.tsx | 52 +- .../ee/teams/views/team-profile-view.tsx | 29 +- .../ee/users/components/UsersTable.tsx | 1 - .../workflows/components/AddActionDialog.tsx | 2 +- .../workflows/components/CallDetailsSheet.tsx | 4 +- .../components/TimeTimeUnitInput.tsx | 11 +- .../components/VoiceSelectionDialog.tsx | 11 +- .../components/WorkflowDetailsPage.tsx | 84 +- .../components/WorkflowStepContainer.tsx | 1029 ++++++----------- .../ee/workflows/views/WorkflowPage.tsx | 17 +- apps/web/modules/embed/components/Embed.tsx | 438 +++---- .../embed/components/RoutingFormEmbed.tsx | 8 +- .../components/AddMembersWithSwitch.tsx | 5 +- .../components/DuplicateDialog.tsx | 2 +- .../components/EventTypeLayout.tsx | 15 +- .../components/EventTypeWebWrapper.tsx | 31 +- .../event-types/components/Segment.tsx | 4 +- .../components/locations/CalVideoSettings.tsx | 7 +- .../components/locations/HostLocations.tsx | 15 +- .../DisableReschedulingController.tsx | 9 +- .../tabs/advanced/EventAdvancedTab.tsx | 12 +- .../components/tabs/advanced/FormBuilder.tsx | 25 +- .../EventTeamAssignmentTabWebWrapper.tsx | 5 +- .../availability/EventAvailabilityTab.tsx | 18 +- .../tabs/limits/EventLimitsTabWebWrapper.tsx | 2 +- .../recurring/EventRecurringWebWrapper.tsx | 2 +- .../components/tabs/setup/EventSetupTab.tsx | 17 +- .../tabs/workflows/EventWorkflowsTab.tsx | 6 +- .../hooks/useTeamMembersWithSegment.tsx | 5 +- .../views/event-types-listing-view.tsx | 2 +- .../components/AssignFeatureSheet.tsx | 6 +- .../components/FlagAdminList.tsx | 19 +- .../form-builder/components/Components.tsx | 10 +- .../components/FormBuilderField.test.tsx | 3 +- .../components/FormBuilderField.tsx | 4 +- .../[[...step]]/onboarding-view.tsx | 54 +- .../modules/insights/components/ChartCard.tsx | 2 +- .../components/booking/CSATOverTimeChart.tsx | 1 - .../booking/HighestRatedMembersTable.tsx | 1 - .../booking/LowestRatedMembersTable.tsx | 1 - .../booking/MostBookedTeamMembersTable.tsx | 1 - .../booking/MostCancelledBookingsTables.tsx | 8 +- .../booking/NoShowHostsOverTimeChart.tsx | 6 +- .../components/booking/PopularEventsTable.tsx | 17 +- .../booking/RecentFeedbackTable.tsx | 18 +- .../components/filters/OrgTeamsFilter.tsx | 5 +- .../components/routing/RoutedToPerPeriod.tsx | 13 +- .../routing/RoutingFormResponsesTable.tsx | 8 +- .../insights/hooks/useInsightsColumns.tsx | 23 +- .../views/insights-call-history-view.tsx | 98 +- .../modules/insights/views/insights-view.tsx | 6 +- .../views/insights-virtual-queues-view.tsx | 2 +- .../EditIntegrationAttributeSyncCard.tsx | 5 +- .../components/FieldMappingBuilder.tsx | 4 +- .../IntegrationAttributeSyncCard.tsx | 62 +- .../components/RuleBuilder.tsx | 28 +- .../modules/notifications/hooks/useWebPush.ts | 2 +- .../onboarding/components/RoleSelector.tsx | 5 +- .../components/onboarding-browser-view.tsx | 7 +- .../onboarding-calendar-browser-view.tsx | 2 +- .../onboarding-invite-browser-view.tsx | 14 +- ...nboarding-migrate-members-browser-view.tsx | 1 - .../onboarding-migrate-teams-browser-view.tsx | 1 - .../modules/onboarding/hooks/useCreateTeam.ts | 6 +- .../onboarding/hooks/useMigrationFlow.ts | 1 - .../onboarding/hooks/useSubmitOnboarding.ts | 6 +- .../organization/migrate-teams/utils.ts | 1 - .../onboarding/store/onboarding-store.ts | 6 +- .../modules/schedules/components/Schedule.tsx | 2 +- .../hooks/useNonEmptyScheduleDays.ts | 6 +- .../modules/schedules/hooks/useSchedule.ts | 10 +- .../admin/oauth-clients-admin-view.tsx | 37 +- .../billing/components/BillingCredits.tsx | 137 +-- .../billing/components/InvoicesTable.tsx | 5 +- .../settings/developer/oauth-clients-view.tsx | 8 +- .../my-account/components/MailIcon.tsx | 8 +- .../settings/my-account/general-view.tsx | 81 +- .../my-account/out-of-office-view.tsx | 1 - .../settings/my-account/profile-view.tsx | 301 ++--- .../settings/oauth/OAuthClientsList.tsx | 4 +- .../oauth/create/NewOAuthClientButton.tsx | 8 +- .../oauth/create/OAuthClientCreateModal.tsx | 2 - .../oauth/view/OAuthClientDetailsDialog.tsx | 104 +- .../CreateOrEditOutOfOfficeModal.tsx | 4 +- .../outOfOffice/OutOfOfficeEntriesList.tsx | 27 +- .../settings/security/compliance-view.tsx | 34 +- .../compliance/compliance-documents.ts | 4 +- .../teams/new/create-new-team-view.tsx | 2 +- .../teams/new/invite/team-invite-view.tsx | 2 +- apps/web/modules/shell/UpgradeTip.tsx | 9 +- .../shell/components/GatedFeaturesModal.tsx | 16 +- .../modules/shell/navigation/Navigation.tsx | 56 +- .../shell/navigation/NavigationItem.tsx | 5 +- .../shell/navigation/useMobileMoreItems.ts | 2 +- .../shell/user-dropdown/DownloadIcons.tsx | 7 +- .../shell/user-dropdown/UserDropdown.tsx | 4 +- apps/web/modules/signup-view.tsx | 10 +- apps/web/modules/team/team-view.tsx | 14 +- apps/web/modules/team/type-view-cached.tsx | 5 +- .../components/CalendarToggleContainer.tsx | 3 +- .../components/EventScheduleItem.tsx | 23 +- .../components/EventTypeSelect.tsx | 10 +- .../components/Troubleshooter.tsx | 2 +- .../UserTable/EditSheet/EditUserForm.tsx | 28 +- .../UserTable/EditSheet/EditUserSheet.tsx | 130 +-- .../UserTable/PlatformManagedUsersTable.tsx | 12 +- .../users/components/UserTable/types.ts | 3 +- .../modules/users/lib/UserListTableUtils.ts | 23 +- .../modules/users/views/users-public-view.tsx | 7 +- .../components/WebhookTestDisclosure.tsx | 3 +- .../webhooks/views/webhook-new-skeleton.tsx | 2 +- apps/web/next-i18next.config.ts | 2 +- apps/web/pages/api/book/event.ts | 2 +- .../pages/api/book/recurring-event.test.ts | 4 +- apps/web/pages/api/book/recurring-event.ts | 2 +- apps/web/playwright/availability.e2e.ts | 4 +- .../playwright/booking-confirm-reject.e2e.ts | 6 +- apps/web/playwright/booking-pages.e2e.ts | 288 ++--- apps/web/playwright/duration-limits.e2e.ts | 60 +- apps/web/playwright/fixtures/users.ts | 8 +- apps/web/playwright/fixtures/workflows.ts | 5 +- apps/web/playwright/hash-my-url.e2e.ts | 2 +- apps/web/playwright/lib/loadJSON.ts | 4 +- .../oauth-authorize-approval-status.e2e.ts | 18 +- .../oauth/oauth-client-admin.e2e.ts | 2 +- .../playwright/oauth/oauth-client-helpers.ts | 9 +- .../oauth/oauth-refresh-tokens.e2e.ts | 3 +- .../assign-all-members-segment-filter.e2e.ts | 12 +- .../playwright/organization/booking.e2e.ts | 4 +- .../organization/organization-settings.e2e.ts | 137 +-- apps/web/playwright/profile.e2e.ts | 5 +- .../playwright/settings/upload-avatar.e2e.ts | 14 +- apps/web/playwright/signup.e2e.ts | 18 +- apps/web/playwright/webhook.e2e.ts | 4 +- apps/web/postcss.config.mjs | 4 +- apps/web/sentry.server.config.ts | 3 +- .../lib/[user]/[type]/getServerSideProps.ts | 50 +- .../server/lib/[user]/getServerSideProps.ts | 3 +- .../server/lib/router/getServerSideProps.ts | 3 +- apps/web/styles/globals.css | 2 +- apps/web/styles/raqb.css | 7 +- apps/web/test/lib/checkBookingLimits.test.ts | 8 +- apps/web/test/lib/checkDurationLimits.test.ts | 8 +- apps/web/test/lib/getSchedule.test.ts | 24 +- .../getSchedule/restrictionSchedule.test.ts | 2 +- .../web/test/lib/pagesAndRewritePaths.test.ts | 7 +- apps/web/trigger.version.ts | 2 +- 271 files changed, 3729 insertions(+), 4857 deletions(-) diff --git a/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx b/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx index 6127f1a5d4..90f4fa30b2 100644 --- a/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx +++ b/apps/web/app/(use-page-wrapper)/(main-nav)/booking/[uid]/logs/page.tsx @@ -1,6 +1,6 @@ // Added as a separate route for now to ease the testing of the audit logs feature // It partially matches the figma design - https://www.figma.com/design/wleA2SR6rn60EK7ORxAfMy/Cal.com-New-Features?node-id=5641-6732&p=f -// TOOD: Move it to the booking page side bar later +// TOOD: Move it to the booking page side bar later import { ShellMainAppDir } from "app/(use-page-wrapper)/(main-nav)/ShellMainAppDir"; import type { PageProps } from "app/_types"; import { _generateMetadata, getTranslate } from "app/_utils"; @@ -14,35 +14,34 @@ import { buildLegacyRequest } from "@lib/buildLegacyCtx"; import { BookingHistoryPage } from "@calcom/web/modules/booking-audit/components/BookingHistoryPage"; export const generateMetadata = async ({ params }: { params: Promise<{ uid: string }> }) => - await _generateMetadata( - (t) => t("booking_history"), - (t) => t("booking_history_description"), - undefined, - undefined, - `/booking/${(await params).uid}/logs` - ); + await _generateMetadata( + (t) => t("booking_history"), + (t) => t("booking_history_description"), + undefined, + undefined, + `/booking/${(await params).uid}/logs` + ); const Page = async ({ params }: PageProps) => { - const resolvedParams = await params; - const bookingUid = resolvedParams.uid; + const resolvedParams = await params; + const bookingUid = resolvedParams.uid; - if (!bookingUid || typeof bookingUid !== "string") { - redirect("/bookings/upcoming"); - } + if (!bookingUid || typeof bookingUid !== "string") { + redirect("/bookings/upcoming"); + } - const t = await getTranslate(); - const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) }); + const t = await getTranslate(); + const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) }); - if (!session?.user?.id) { - redirect("/auth/login"); - } + if (!session?.user?.id) { + redirect("/auth/login"); + } - return ( - - - - ); + return ( + + + + ); }; export default Page; - diff --git a/apps/web/app/(use-page-wrapper)/(main-nav)/event-types/page.tsx b/apps/web/app/(use-page-wrapper)/(main-nav)/event-types/page.tsx index 6d2a376017..3f880250b2 100644 --- a/apps/web/app/(use-page-wrapper)/(main-nav)/event-types/page.tsx +++ b/apps/web/app/(use-page-wrapper)/(main-nav)/event-types/page.tsx @@ -5,11 +5,7 @@ import type { RouterOutputs } from "@calcom/trpc/react"; import { eventTypesRouter } from "@calcom/trpc/server/routers/viewer/eventTypes/_router"; import { buildLegacyRequest } from "@lib/buildLegacyCtx"; import { createRouterCaller, getTRPCContext } from "app/_trpc/context"; -import type { - PageProps, - ReadonlyHeaders, - ReadonlyRequestCookies, -} from "app/_types"; +import type { PageProps, ReadonlyHeaders, ReadonlyRequestCookies } from "app/_types"; import { _generateMetadata } from "app/_utils"; import { unstable_cache } from "next/cache"; import { cookies, headers } from "next/headers"; @@ -26,26 +22,25 @@ const getCachedEventGroups: ( userIds?: number[] | undefined; upIds?: string[] | undefined; } -) => Promise = - unstable_cache( - async ( - headers: ReadonlyHeaders, - cookies: ReadonlyRequestCookies, - filters?: { - teamIds?: number[] | undefined; - userIds?: number[] | undefined; - upIds?: string[] | undefined; - } - ): Promise => { - const eventTypesCaller = await createRouterCaller( - eventTypesRouter, - await getTRPCContext(headers, cookies) - ); - return await eventTypesCaller.getUserEventGroups({ filters }); - }, - ["viewer.eventTypes.getUserEventGroups"], - { revalidate: 3600 } // seconds - ); +) => Promise = unstable_cache( + async ( + headers: ReadonlyHeaders, + cookies: ReadonlyRequestCookies, + filters?: { + teamIds?: number[] | undefined; + userIds?: number[] | undefined; + upIds?: string[] | undefined; + } + ): Promise => { + const eventTypesCaller = await createRouterCaller( + eventTypesRouter, + await getTRPCContext(headers, cookies) + ); + return await eventTypesCaller.getUserEventGroups({ filters }); + }, + ["viewer.eventTypes.getUserEventGroups"], + { revalidate: 3600 } // seconds +); const Page = async ({ searchParams }: PageProps): Promise => { const _searchParams = await searchParams; @@ -71,23 +66,12 @@ const Page = async ({ searchParams }: PageProps): Promise => { } const filters = getTeamsFiltersFromQuery(_searchParams); - const userEventGroupsData = await getCachedEventGroups( - _headers, - _cookies, - filters - ); + const userEventGroupsData = await getCachedEventGroups(_headers, _cookies, filters); - return ( - - ); + return ; }; -export const generateMetadata = async (): Promise< - ReturnType -> => +export const generateMetadata = async (): Promise> => await _generateMetadata( (t) => t("event_types_page_title"), (t) => t("event_types_page_subtitle"), diff --git a/apps/web/app/(use-page-wrapper)/(main-nav)/teams/CTA.tsx b/apps/web/app/(use-page-wrapper)/(main-nav)/teams/CTA.tsx index a39498673f..5a6921b8f1 100644 --- a/apps/web/app/(use-page-wrapper)/(main-nav)/teams/CTA.tsx +++ b/apps/web/app/(use-page-wrapper)/(main-nav)/teams/CTA.tsx @@ -15,7 +15,7 @@ export const TeamsCTA = () => { size="sm" type="button" onClick={() => { - posthog.capture("add_team_button_clicked") + posthog.capture("add_team_button_clicked"); }} href={`${WEBAPP_URL}/settings/teams/new?returnTo=${WEBAPP_URL}/teams`}> {t("new")} diff --git a/apps/web/app/(use-page-wrapper)/apps/(homepage)/page.tsx b/apps/web/app/(use-page-wrapper)/apps/(homepage)/page.tsx index 4eaa198fb4..4ffb2e4c3e 100644 --- a/apps/web/app/(use-page-wrapper)/apps/(homepage)/page.tsx +++ b/apps/web/app/(use-page-wrapper)/apps/(homepage)/page.tsx @@ -38,12 +38,15 @@ const ServerPage = async () => { const categoryQuery = appStore.map(({ categories }) => ({ categories: categories || [], })); - const categories = categoryQuery.reduce((c, app) => { - for (const category of app.categories) { - c[category] = c[category] ? c[category] + 1 : 1; - } - return c; - }, {} as Record); + const categories = categoryQuery.reduce( + (c, app) => { + for (const category of app.categories) { + c[category] = c[category] ? c[category] + 1 : 1; + } + return c; + }, + {} as Record + ); const props = { categories: Object.entries(categories) diff --git a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/FormEdit.tsx b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/FormEdit.tsx index 8c2146a84b..704789d8db 100644 --- a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/FormEdit.tsx +++ b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/FormEdit.tsx @@ -93,8 +93,7 @@ function Field({ } : null } - deleteField={router ? null : deleteField} - > + deleteField={router ? null : deleteField}>
{ - hookForm.setValue( - `${hookFieldNamespace}.identifier`, - e.target.value.toLowerCase(), - { shouldDirty: true } - ); + hookForm.setValue(`${hookFieldNamespace}.identifier`, e.target.value.toLowerCase(), { + shouldDirty: true, + }); }} />
@@ -164,9 +150,7 @@ function Field({ control={hookForm.control} defaultValue={routerField?.type} render={({ field: { value, onChange } }) => { - const defaultValue = FieldTypes.find( - (fieldType) => fieldType.value === value - ); + const defaultValue = FieldTypes.find((fieldType) => fieldType.value === value); if (disableTypeChange) { return (
@@ -179,15 +163,9 @@ function Field({ className={classNames( "h-8 w-full justify-between text-left text-sm", !!router && "bg-subtle cursor-not-allowed" - )} - > - - {defaultValue?.label || "Select field type"} - - + )}> + {defaultValue?.label || "Select field type"} +
@@ -304,9 +282,7 @@ const FormEdit = ({
{hookFormFields.map((field, key) => { - const existingField = Boolean( - (form.fields || []).find((f) => f.id === field.id) - ); + const existingField = Boolean((form.fields || []).find((f) => f.id === field.id)); const hasFormResponses = (form._count?.responses ?? 0) > 0; return ( {hookFormFields.length ? (
-
@@ -389,12 +359,7 @@ const FormEdit = ({ Fields are the form fields that the booker would see.

-
@@ -414,9 +379,7 @@ export default function FormEditPage({ {...props} appUrl={appUrl} permissions={permissions} - Page={({ hookForm, form }) => ( - - )} + Page={({ hookForm, form }) => } /> ); diff --git a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/IncompleteBooking.tsx b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/IncompleteBooking.tsx index e3ea981b47..da7c58be9d 100644 --- a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/IncompleteBooking.tsx +++ b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/IncompleteBooking.tsx @@ -88,8 +88,8 @@ function Page({ form }: { form: RoutingFormWithResponseCount }) { setSelectedCredential( credentialOptions - ? credentialOptions.find((option) => option.value === salesforceAction?.credentialId) ?? - selectedCredential + ? (credentialOptions.find((option) => option.value === salesforceAction?.credentialId) ?? + selectedCredential) : selectedCredential ); } @@ -128,17 +128,17 @@ function Page({ form }: { form: RoutingFormWithResponseCount }) {
form.setValue("teamMemberId", member.value)} - /> -
{ + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + form.setValue("teamMemberId", member.value); + } + }} + className={classNames( + "hover:bg-subtle focus:bg-subtle focus:ring-emphasis cursor-pointer items-center justify-between gap-0.5 rounded-sm py-2 outline-none focus:ring-2", + watchedTeamMemberId === member.value && "bg-subtle" + )}> +
+ form.setValue("teamMemberId", member.value)} + /> +
+ {member.label} + {watchedTeamMemberId === member.value && ( +
+ +
)} - /> - {member.label} - {watchedTeamMemberId === member.value && ( -
- -
- )} -
- +
+ )) )} {teamMemberOptions.length > 0 && ( diff --git a/apps/web/components/dialog/RerouteDialog.tsx b/apps/web/components/dialog/RerouteDialog.tsx index 837db6f9a3..e043ff2ae7 100644 --- a/apps/web/components/dialog/RerouteDialog.tsx +++ b/apps/web/components/dialog/RerouteDialog.tsx @@ -903,7 +903,7 @@ export const RerouteDialog = ({ isOpenDialog, setIsOpenDialog, booking }: Rerout return ( - + {t("close")} - diff --git a/apps/web/components/schemas/EventReservationSchema.tsx b/apps/web/components/schemas/EventReservationSchema.tsx index bccc587e3f..417bfc0b95 100644 --- a/apps/web/components/schemas/EventReservationSchema.tsx +++ b/apps/web/components/schemas/EventReservationSchema.tsx @@ -61,7 +61,7 @@ const EventReservationSchema: FC = ({ ? ({ "@type": "Person", name: organizer.name, email: organizer.email } as Person) : undefined, attendee: attendees?.map( - (person) => ({ "@type": "Person", name: person.name, email: person.email } as Person) + (person) => ({ "@type": "Person", name: person.name, email: person.email }) as Person ), location: location || undefined, description: description || undefined, diff --git a/apps/web/lib/app-providers-app-dir.tsx b/apps/web/lib/app-providers-app-dir.tsx index 7c116c492d..e76f17fb48 100644 --- a/apps/web/lib/app-providers-app-dir.tsx +++ b/apps/web/lib/app-providers-app-dir.tsx @@ -48,7 +48,7 @@ export type AppProps = Omit< const getEmbedNamespace = (searchParams: ReadonlyURLSearchParams) => { // Mostly embed query param should be available on server. Use that there. // Use the most reliable detection on client - return typeof window !== "undefined" ? window.getEmbedNamespace() : searchParams.get("embed") ?? null; + return typeof window !== "undefined" ? window.getEmbedNamespace() : (searchParams.get("embed") ?? null); }; type CalcomThemeProps = Readonly<{ diff --git a/apps/web/lib/app-providers.tsx b/apps/web/lib/app-providers.tsx index 21d2bc1441..05974e68ab 100644 --- a/apps/web/lib/app-providers.tsx +++ b/apps/web/lib/app-providers.tsx @@ -208,9 +208,9 @@ function getThemeProviderProps({ const themeSupport = isBookingPage ? ThemeSupport.Booking : // if isThemeSupported is explicitly false, we don't use theme there - props.isThemeSupported === false - ? ThemeSupport.None - : ThemeSupport.App; + props.isThemeSupported === false + ? ThemeSupport.None + : ThemeSupport.App; const isBookingPageThemeSupportRequired = themeSupport === ThemeSupport.Booking; const themeBasis = props.themeBasis; @@ -237,10 +237,10 @@ function getThemeProviderProps({ // Even though it's recommended to use different namespaces when you want to theme differently on the same page but if the embeds are on different pages, the problem can still arise `embed-theme-${embedNamespace}${appearanceIdSuffix}${embedExplicitlySetThemeSuffix}` : themeSupport === ThemeSupport.App - ? "app-theme" - : isBookingPageThemeSupportRequired - ? `booking-theme${appearanceIdSuffix}` - : undefined; + ? "app-theme" + : isBookingPageThemeSupportRequired + ? `booking-theme${appearanceIdSuffix}` + : undefined; return { storageKey, diff --git a/apps/web/lib/apps/categories/getServerSideProps.ts b/apps/web/lib/apps/categories/getServerSideProps.ts index 8b001f33c8..a57098e9e2 100644 --- a/apps/web/lib/apps/categories/getServerSideProps.ts +++ b/apps/web/lib/apps/categories/getServerSideProps.ts @@ -15,12 +15,15 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => appStore = await getAppRegistry(); } - const categories = appStore.reduce((c, app) => { - for (const category of app.categories) { - c[category] = c[category] ? c[category] + 1 : 1; - } - return c; - }, {} as Record); + const categories = appStore.reduce( + (c, app) => { + for (const category of app.categories) { + c[category] = c[category] ? c[category] + 1 : 1; + } + return c; + }, + {} as Record + ); return { props: { diff --git a/apps/web/lib/apps/installation/[[...step]]/getServerSideProps.ts b/apps/web/lib/apps/installation/[[...step]]/getServerSideProps.ts index 41635230fa..297c575f50 100644 --- a/apps/web/lib/apps/installation/[[...step]]/getServerSideProps.ts +++ b/apps/web/lib/apps/installation/[[...step]]/getServerSideProps.ts @@ -16,379 +16,578 @@ import { Prisma } from "@calcom/prisma/client"; import { eventTypeBookingFields } from "@calcom/prisma/zod-utils"; import { STEPS } from "../../../../modules/apps/installation/[[...step]]/constants"; -import type { OnboardingPageProps, TEventTypeGroup, TEventType } from "../../../../modules/apps/installation/[[...step]]/step-view"; +import type { + OnboardingPageProps, + TEventTypeGroup, + TEventType, +} from "../../../../modules/apps/installation/[[...step]]/step-view"; const eventTypeSelect: Prisma.EventTypeSelect = { - id: true, description: true, durationLimits: true, metadata: true, length: true, title: true, - position: true, recurringEvent: true, requiresConfirmation: true, canSendCalVideoTranscriptionEmails: true, - team: { select: { slug: true } }, schedulingType: true, teamId: true, users: { select: { username: true } }, - seatsPerTimeSlot: true, slug: true, locations: true, userId: true, destinationCalendar: true, - bookingFields: true, calVideoSettings: true, parentId: true, + id: true, + description: true, + durationLimits: true, + metadata: true, + length: true, + title: true, + position: true, + recurringEvent: true, + requiresConfirmation: true, + canSendCalVideoTranscriptionEmails: true, + team: { select: { slug: true } }, + schedulingType: true, + teamId: true, + users: { select: { username: true } }, + seatsPerTimeSlot: true, + slug: true, + locations: true, + userId: true, + destinationCalendar: true, + bookingFields: true, + calVideoSettings: true, + parentId: true, }; type EventTypeFromDb = Prisma.EventTypeGetPayload<{ - select: typeof eventTypeSelect; + select: typeof eventTypeSelect; }>; type MinimalUser = { - id: number; - username: string | null; - name: string | null; - avatarUrl: string | null; + id: number; + username: string | null; + name: string | null; + avatarUrl: string | null; }; type MinimalTeam = { - id: number; - name: string; - logoUrl: string | null; - isOrganization: boolean; + id: number; + name: string; + logoUrl: string | null; + isOrganization: boolean; }; type RedirectResult = { redirect: { permanent: boolean; destination: string } }; const mapEventType = (item: EventTypeFromDb): TEventType => { - let teamSlug = ""; - if (item.team) { - teamSlug = `team/${item.team.slug}`; - } - const userSlug = item?.users?.[0]?.username; - let urlPart = userSlug; - if (teamSlug) { - urlPart = teamSlug; - } + let teamSlug = ""; + if (item.team) { + teamSlug = `team/${item.team.slug}`; + } + const userSlug = item?.users?.[0]?.username; + let urlPart = userSlug; + if (teamSlug) { + urlPart = teamSlug; + } - return { - ...item, - URL: `${CAL_URL}/${urlPart}/${item.slug}`, - selected: false, - locations: item.locations as unknown as LocationObject[], - bookingFields: eventTypeBookingFields.parse(item.bookingFields || []), - }; + return { + ...item, + URL: `${CAL_URL}/${urlPart}/${item.slug}`, + selected: false, + locations: item.locations as unknown as LocationObject[], + bookingFields: eventTypeBookingFields.parse(item.bookingFields || []), + }; }; -const getUser = async (userId: number): Promise<(MinimalUser & { - teams: { id: number; name: string; logoUrl: string | null; isOrganization: boolean; parent: { id: number; name: string; logoUrl: string | null } | null }[]; -}) | null> => { - const userRepo = new UserRepository(prisma); - const userAdminTeams = await userRepo.getUserAdminTeams({ userId }); - - if (!userAdminTeams?.id) { - return null; - } - - const teams = userAdminTeams.teams.map(({ team }) => { +const getUser = async ( + userId: number +): Promise< + | (MinimalUser & { + teams: { + id: number; + name: string; + logoUrl: string | null; + isOrganization: boolean; + parent: { id: number; name: string; logoUrl: string | null } | null; + }[]; + }) + | null +> => { + const userRepo = new UserRepository(prisma); + const userAdminTeams = await userRepo.getUserAdminTeams({ userId }); + + if (!userAdminTeams?.id) { + return null; + } + + const teams = userAdminTeams.teams.map(({ team }) => { const parentLogoUrl = team.parent?.logoUrl; const parentName = team.parent?.name; - + let logoUrl = ""; if (team.parent) { - logoUrl = getPlaceholderAvatar(parentLogoUrl, parentName); + logoUrl = getPlaceholderAvatar(parentLogoUrl, parentName); } else { - logoUrl = getPlaceholderAvatar(team.logoUrl, team.name); + logoUrl = getPlaceholderAvatar(team.logoUrl, team.name); } return { ...team, logoUrl, }; }); - - return { - ...userAdminTeams, - teams, - }; - }; -const getOrgSubTeams = async (parentId: number): Promise<{ id: number; name: string; logoUrl: string | null; isOrganization: boolean; parent: { id: number; name: string; logoUrl: string | null } | null }[]> => { - const teams = await prisma.team.findMany({ - where: { - parentId, - }, - select: { - id: true, - name: true, - logoUrl: true, - isOrganization: true, - parent: { - select: { - logoUrl: true, - name: true, - id: true, - }, - }, - }, - }); - return teams.map((team) => { - const parentLogoUrl = team.parent?.logoUrl; - const parentName = team.parent?.name; - let logoUrl = ""; - if (team.parent) { - logoUrl = getPlaceholderAvatar(parentLogoUrl, parentName); - } else { - logoUrl = getPlaceholderAvatar(team.logoUrl, team.name); - } - return { - ...team, - logoUrl, - } - }); - }; - -const getAppBySlug = async (appSlug: string): Promise<{ slug: string; keys: Prisma.JsonValue; enabled: boolean; dirName: string; } | null> => { - const app = await prisma.app.findUnique({ - where: { slug: appSlug, enabled: true }, - select: { slug: true, keys: true, enabled: true, dirName: true }, - }); - return app; + return { + ...userAdminTeams, + teams, + }; }; -const getTeamEventTypes = async (teamIds: number[], isConferencing: boolean, eventTypeSelect: Prisma.EventTypeSelect): Promise => { - const teams = await prisma.team.findMany({ - where: { id: { in: teamIds }, isOrganization: false }, - select: { id: true, name: true, logoUrl: true, slug: true, isOrganization: true, eventTypes: { select: eventTypeSelect } }, - }); - return teams.map((team) => { - let filteredEventTypes = team.eventTypes; - if (isConferencing) { - filteredEventTypes = filterEventTypesWhereLocationUpdateIsAllowed(team.eventTypes); - } - return { - teamId: team.id, slug: team.slug, name: team.name, isOrganisation: team.isOrganization, - image: getPlaceholderAvatar(team.logoUrl, team.name), - eventTypes: (filteredEventTypes as unknown as EventTypeFromDb[]).map(mapEventType).sort((a, b) => (b.position || 0) - (a.position || 0)), - }; - }); -}; - -const getUserEventTypes = async (userId: number, isConferencing: boolean, eventTypeSelect: Prisma.EventTypeSelect): Promise => { - const user = await prisma.user.findUnique({ - where: { id: userId }, - select: { id: true, username: true, name: true, avatarUrl: true, eventTypes: { where: { teamId: null }, select: eventTypeSelect } }, - }); - - if (!user) return []; - - let filteredEventTypes = user.eventTypes; - if (isConferencing) { - filteredEventTypes = filterEventTypesWhereLocationUpdateIsAllowed(user.eventTypes); +const getOrgSubTeams = async ( + parentId: number +): Promise< + { + id: number; + name: string; + logoUrl: string | null; + isOrganization: boolean; + parent: { id: number; name: string; logoUrl: string | null } | null; + }[] +> => { + const teams = await prisma.team.findMany({ + where: { + parentId, + }, + select: { + id: true, + name: true, + logoUrl: true, + isOrganization: true, + parent: { + select: { + logoUrl: true, + name: true, + id: true, + }, + }, + }, + }); + return teams.map((team) => { + const parentLogoUrl = team.parent?.logoUrl; + const parentName = team.parent?.name; + let logoUrl = ""; + if (team.parent) { + logoUrl = getPlaceholderAvatar(parentLogoUrl, parentName); + } else { + logoUrl = getPlaceholderAvatar(team.logoUrl, team.name); } - return [{ - userId: user.id, slug: user.username, name: user.name, image: getPlaceholderAvatar(user.avatarUrl, user.name), - eventTypes: (filteredEventTypes as unknown as EventTypeFromDb[]).map(mapEventType).sort((a, b) => (b.position || 0) - (a.position || 0)), - }]; + return { + ...team, + logoUrl, + }; + }); +}; + +const getAppBySlug = async ( + appSlug: string +): Promise<{ slug: string; keys: Prisma.JsonValue; enabled: boolean; dirName: string } | null> => { + const app = await prisma.app.findUnique({ + where: { slug: appSlug, enabled: true }, + select: { slug: true, keys: true, enabled: true, dirName: true }, + }); + return app; +}; + +const getTeamEventTypes = async ( + teamIds: number[], + isConferencing: boolean, + eventTypeSelect: Prisma.EventTypeSelect +): Promise => { + const teams = await prisma.team.findMany({ + where: { id: { in: teamIds }, isOrganization: false }, + select: { + id: true, + name: true, + logoUrl: true, + slug: true, + isOrganization: true, + eventTypes: { select: eventTypeSelect }, + }, + }); + return teams.map((team) => { + let filteredEventTypes = team.eventTypes; + if (isConferencing) { + filteredEventTypes = filterEventTypesWhereLocationUpdateIsAllowed(team.eventTypes); + } + return { + teamId: team.id, + slug: team.slug, + name: team.name, + isOrganisation: team.isOrganization, + image: getPlaceholderAvatar(team.logoUrl, team.name), + eventTypes: (filteredEventTypes as unknown as EventTypeFromDb[]) + .map(mapEventType) + .sort((a, b) => (b.position || 0) - (a.position || 0)), + }; + }); +}; + +const getUserEventTypes = async ( + userId: number, + isConferencing: boolean, + eventTypeSelect: Prisma.EventTypeSelect +): Promise => { + const user = await prisma.user.findUnique({ + where: { id: userId }, + select: { + id: true, + username: true, + name: true, + avatarUrl: true, + eventTypes: { where: { teamId: null }, select: eventTypeSelect }, + }, + }); + + if (!user) return []; + + let filteredEventTypes = user.eventTypes; + if (isConferencing) { + filteredEventTypes = filterEventTypesWhereLocationUpdateIsAllowed(user.eventTypes); + } + return [ + { + userId: user.id, + slug: user.username, + name: user.name, + image: getPlaceholderAvatar(user.avatarUrl, user.name), + eventTypes: (filteredEventTypes as unknown as EventTypeFromDb[]) + .map(mapEventType) + .sort((a, b) => (b.position || 0) - (a.position || 0)), + }, + ]; }; const getEventTypes = async ({ - userId, - teamIds, - isConferencing = false, + userId, + teamIds, + isConferencing = false, }: { - userId: number; - teamIds?: number[]; - isConferencing?: boolean; + userId: number; + teamIds?: number[]; + isConferencing?: boolean; }): Promise => { - if (teamIds && teamIds.length > 0) { - return getTeamEventTypes(teamIds, isConferencing, eventTypeSelect); - } + if (teamIds && teamIds.length > 0) { + return getTeamEventTypes(teamIds, isConferencing, eventTypeSelect); + } - return getUserEventTypes(userId, isConferencing, eventTypeSelect); + return getUserEventTypes(userId, isConferencing, eventTypeSelect); }; -const getAppInstallsBySlug = async (appSlug: string, userId: number, teamIds?: number[]): Promise>[]> => { - if (teamIds?.length) { - return prisma.credential.findMany({ - where: { - OR: [ - { appId: appSlug, userId: userId }, - { appId: appSlug, teamId: { in: teamIds } } - ] - } - }); +const getAppInstallsBySlug = async ( + appSlug: string, + userId: number, + teamIds?: number[] +): Promise>[]> => { + if (teamIds?.length) { + return prisma.credential.findMany({ + where: { + OR: [ + { appId: appSlug, userId: userId }, + { appId: appSlug, teamId: { in: teamIds } }, + ], + }, + }); + } + + return prisma.credential.findMany({ + where: { appId: appSlug, userId: userId }, + }); +}; + +const handleAutoInstall = async ( + user: MinimalUser, + appMetadata: import("@calcom/types/App").AppMeta, + parsedAppSlug: string +): Promise => { + try { + const newCredential = await createDefaultInstallation({ + appType: appMetadata.type, + user: { id: user.id }, + slug: parsedAppSlug, + key: {}, + teamId: undefined, + }); + return newCredential.id; + } catch (error) { + if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === "P2002") { + const existing = await prisma.credential.findFirst({ + where: { appId: parsedAppSlug, userId: user.id, teamId: null }, + select: { id: true }, + }); + return existing?.id ?? null; } + return null; + } +}; - return prisma.credential.findMany({ - where: { appId: appSlug, userId: userId }, - }); - }; +const getEventTypeGroupsForStep = async ( + user: MinimalUser, + userTeams: MinimalTeam[], + parsedTeamIdParam: number | undefined, + isOrg: boolean, + isConferencing: boolean +): Promise => { + let groups: TEventTypeGroup[] | null = null; + if (isOrg) { + groups = await getEventTypes({ + userId: user.id, + teamIds: userTeams.map((item) => item.id), + isConferencing, + }); + } else if (parsedTeamIdParam) { + groups = await getEventTypes({ userId: user.id, teamIds: [parsedTeamIdParam], isConferencing }); + } else { + groups = await getEventTypes({ userId: user.id, isConferencing }); + } -const handleAutoInstall = async (user: MinimalUser, appMetadata: import("@calcom/types/App").AppMeta, parsedAppSlug: string): Promise => { - try { - const newCredential = await createDefaultInstallation({ - appType: appMetadata.type, - user: { id: user.id }, - slug: parsedAppSlug, - key: {}, - teamId: undefined, - }); - return newCredential.id; - } catch (error) { - if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === "P2002") { - const existing = await prisma.credential.findFirst({ - where: { appId: parsedAppSlug, userId: user.id, teamId: null }, - select: { id: true }, - }); - return existing?.id ?? null; + if (isConferencing && groups) { + const destinationCalendar = await prisma.destinationCalendar.findFirst({ + where: { userId: user.id, eventTypeId: null }, + }); + + groups.forEach((group) => { + group.eventTypes = group.eventTypes.map((eventType) => { + if (!eventType.destinationCalendar) { + return { ...eventType, destinationCalendar }; } - return null; - } + return eventType; + }); + }); + } + return groups; }; -const getEventTypeGroupsForStep = async (user: MinimalUser, userTeams: MinimalTeam[], parsedTeamIdParam: number | undefined, isOrg: boolean, isConferencing: boolean): Promise => { - let groups: TEventTypeGroup[] | null = null; - if (isOrg) { - groups = await getEventTypes({ userId: user.id, teamIds: userTeams.map((item) => item.id), isConferencing }); - } else if (parsedTeamIdParam) { - groups = await getEventTypes({ userId: user.id, teamIds: [parsedTeamIdParam], isConferencing }); +const getInitialStep = ( + parsedStepParam: string | undefined, + hasTeams: boolean, + showEventTypesStep: boolean, + parsedAppSlug: string, + isOAuth: boolean +): { step: string | undefined; redirect?: RedirectResult } => { + if (!hasTeams && parsedStepParam === AppOnboardingSteps.ACCOUNTS_STEP && showEventTypesStep && !isOAuth) { + return { + step: parsedStepParam, + redirect: { + redirect: { permanent: false, destination: `/apps/installation/event-types?slug=${parsedAppSlug}` }, + }, + }; + } + let step = parsedStepParam; + if (!parsedStepParam) { + if (hasTeams) { + step = AppOnboardingSteps.ACCOUNTS_STEP; } else { - groups = await getEventTypes({ userId: user.id, isConferencing }); + step = isOAuth ? AppOnboardingSteps.ACCOUNTS_STEP : AppOnboardingSteps.EVENT_TYPES_STEP; } - - if (isConferencing && groups) { - const destinationCalendar = await prisma.destinationCalendar.findFirst({ - where: { userId: user.id, eventTypeId: null }, - }); - - groups.forEach((group) => { - group.eventTypes = group.eventTypes.map((eventType) => { - if (!eventType.destinationCalendar) { - return { ...eventType, destinationCalendar }; - } - return eventType; - }); - }); - } - return groups; + } + return { step }; }; -const getInitialStep = (parsedStepParam: string | undefined, hasTeams: boolean, showEventTypesStep: boolean, parsedAppSlug: string, isOAuth: boolean): { step: string | undefined; redirect?: RedirectResult } => { - if (!hasTeams && parsedStepParam === AppOnboardingSteps.ACCOUNTS_STEP && showEventTypesStep && !isOAuth) { - return { - step: parsedStepParam, - redirect: { redirect: { permanent: false, destination: `/apps/installation/event-types?slug=${parsedAppSlug}` } } - }; - } - let step = parsedStepParam; - if (!parsedStepParam) { - if (hasTeams) { - step = AppOnboardingSteps.ACCOUNTS_STEP; - } else { - step = isOAuth ? AppOnboardingSteps.ACCOUNTS_STEP : AppOnboardingSteps.EVENT_TYPES_STEP; - } - } - return { step }; +const getAppAndMetadata = async ( + parsedAppSlug: string +): Promise<{ + app: { slug: string; keys: Prisma.JsonValue; enabled: boolean; dirName: string } | null; + appMetadata: import("@calcom/types/App").AppMeta | null; + redirect?: RedirectResult; +}> => { + const app = await getAppBySlug(parsedAppSlug); + if (!app) + return { + app: null, + appMetadata: null, + redirect: { redirect: { permanent: false, destination: "/apps" } }, + }; + const appMetadata = appStoreMetadata[app.dirName as keyof typeof appStoreMetadata]; + if (!appMetadata) + return { + app: null, + appMetadata: null, + redirect: { redirect: { permanent: false, destination: "/apps" } }, + }; + return { app, appMetadata }; }; -const getAppAndMetadata = async (parsedAppSlug: string): Promise<{ app: { slug: string; keys: Prisma.JsonValue; enabled: boolean; dirName: string } | null; appMetadata: import("@calcom/types/App").AppMeta | null; redirect?: RedirectResult }> => { - const app = await getAppBySlug(parsedAppSlug); - if (!app) return { app: null, appMetadata: null, redirect: { redirect: { permanent: false, destination: "/apps" } } }; - const appMetadata = appStoreMetadata[app.dirName as keyof typeof appStoreMetadata]; - if (!appMetadata) return { app: null, appMetadata: null, redirect: { redirect: { permanent: false, destination: "/apps" } } }; - return { app, appMetadata }; +const getCredentialId = ( + parsedTeamIdParam: number | undefined, + appInstalls: Prisma.CredentialGetPayload>[], + userId: number +): number | null => { + if (parsedTeamIdParam) { + return appInstalls.find((item) => item.teamId === parsedTeamIdParam)?.id ?? null; + } + return appInstalls.find((item) => item.userId === userId)?.id ?? null; }; -const getCredentialId = (parsedTeamIdParam: number | undefined, appInstalls: Prisma.CredentialGetPayload>[], userId: number): number | null => { - if (parsedTeamIdParam) { - return appInstalls.find((item) => item.teamId === parsedTeamIdParam)?.id ?? null; +const prepareUserTeams = async ( + user: MinimalUser & { teams: MinimalTeam[] }, + parsedTeamIdParam: number | undefined +): Promise<{ userTeams: MinimalTeam[]; isOrg: boolean; redirect?: RedirectResult }> => { + let userTeams = user.teams; + let isOrg = false; + if (parsedTeamIdParam) { + const currentTeam = userTeams.find((team: MinimalTeam) => team.id === parsedTeamIdParam); + if (!currentTeam?.id) + return { + userTeams: [], + isOrg: false, + redirect: { redirect: { permanent: false, destination: "/apps" } }, + }; + if (currentTeam.isOrganization) { + userTeams = [...userTeams, ...(await getOrgSubTeams(parsedTeamIdParam))]; + isOrg = true; } - return appInstalls.find((item) => item.userId === userId)?.id ?? null; + } + return { userTeams, isOrg }; }; -const prepareUserTeams = async (user: MinimalUser & { teams: MinimalTeam[] }, parsedTeamIdParam: number | undefined): Promise<{ userTeams: MinimalTeam[]; isOrg: boolean; redirect?: RedirectResult }> => { - let userTeams = user.teams; - let isOrg = false; - if (parsedTeamIdParam) { - const currentTeam = userTeams.find((team: MinimalTeam) => team.id === parsedTeamIdParam); - if (!currentTeam?.id) return { userTeams: [], isOrg: false, redirect: { redirect: { permanent: false, destination: "/apps" } } }; - if (currentTeam.isOrganization) { - userTeams = [...userTeams, ...await getOrgSubTeams(parsedTeamIdParam)]; - isOrg = true; - } - } - return { userTeams, isOrg }; +const getCredential = async ( + parsedTeamIdParam: number | undefined, + appInstalls: Prisma.CredentialGetPayload>[], + user: MinimalUser & { teams: MinimalTeam[] }, + initialStep: string, + appMetadata: import("@calcom/types/App").AppMeta, + parsedAppSlug: string +): Promise<{ credentialId: number | null; redirect?: RedirectResult }> => { + let credentialId = getCredentialId(parsedTeamIdParam, appInstalls, user.id); + if ( + !credentialId && + !user.teams.length && + initialStep === AppOnboardingSteps.EVENT_TYPES_STEP && + !appMetadata.isOAuth + ) { + credentialId = await handleAutoInstall(user, appMetadata, parsedAppSlug); + if (!credentialId) + return { credentialId: null, redirect: { redirect: { permanent: false, destination: "/apps" } } }; + } + return { credentialId }; }; -const getCredential = async (parsedTeamIdParam: number | undefined, appInstalls: Prisma.CredentialGetPayload>[], user: MinimalUser & { teams: MinimalTeam[] }, initialStep: string, appMetadata: import("@calcom/types/App").AppMeta, parsedAppSlug: string): Promise<{ credentialId: number | null; redirect?: RedirectResult }> => { - let credentialId = getCredentialId(parsedTeamIdParam, appInstalls, user.id); - if (!credentialId && !user.teams.length && initialStep === AppOnboardingSteps.EVENT_TYPES_STEP && !appMetadata.isOAuth) { - credentialId = await handleAutoInstall(user, appMetadata, parsedAppSlug); - if (!credentialId) return { credentialId: null, redirect: { redirect: { permanent: false, destination: "/apps" } } }; - } - return { credentialId }; -}; - -const getTeamsInstalled = (hasTeams: boolean, userTeams: MinimalTeam[], appInstalls: Prisma.CredentialGetPayload>[]): import("../../../../modules/apps/installation/[[...step]]/step-view").TTeams => { - if (!hasTeams) return []; - return userTeams.map((team: MinimalTeam) => ({ - ...team, alreadyInstalled: appInstalls.some((install) => !!install.teamId && install.teamId === team.id), - })); +const getTeamsInstalled = ( + hasTeams: boolean, + userTeams: MinimalTeam[], + appInstalls: Prisma.CredentialGetPayload>[] +): import("../../../../modules/apps/installation/[[...step]]/step-view").TTeams => { + if (!hasTeams) return []; + return userTeams.map((team: MinimalTeam) => ({ + ...team, + alreadyInstalled: appInstalls.some((install) => !!install.teamId && install.teamId === team.id), + })); }; const getParsedStep = (paramsStep: string | string[] | undefined): string | undefined => { - if (Array.isArray(paramsStep)) return paramsStep[0]; - return paramsStep; + if (Array.isArray(paramsStep)) return paramsStep[0]; + return paramsStep; }; -const getInstallationParams = async (context: GetServerSidePropsContext): Promise<{ parsedAppSlug: string; parsedStepParam: string | undefined; parsedTeamIdParam: number | undefined; sessionId: number | null }> => { - const { query, params, req } = context; - const parsedAppSlug = z.coerce.string().parse(query?.slug); - const parsedStepParam = z.string().optional().parse(getParsedStep(params?.step)); - const parsedTeamIdParam = z.coerce.number().optional().parse(query?.teamId); - const session = await getServerSession({ req }); - const sessionId = (session?.user as { id?: number })?.id ?? null; - return { parsedAppSlug, parsedStepParam, parsedTeamIdParam, sessionId }; +const getInstallationParams = async ( + context: GetServerSidePropsContext +): Promise<{ + parsedAppSlug: string; + parsedStepParam: string | undefined; + parsedTeamIdParam: number | undefined; + sessionId: number | null; +}> => { + const { query, params, req } = context; + const parsedAppSlug = z.coerce.string().parse(query?.slug); + const parsedStepParam = z.string().optional().parse(getParsedStep(params?.step)); + const parsedTeamIdParam = z.coerce.number().optional().parse(query?.teamId); + const session = await getServerSession({ req }); + const sessionId = (session?.user as { id?: number })?.id ?? null; + return { parsedAppSlug, parsedStepParam, parsedTeamIdParam, sessionId }; }; -export const getServerSideProps = async (context: GetServerSidePropsContext): Promise> => { - const { parsedAppSlug, parsedStepParam, parsedTeamIdParam, sessionId } = await getInstallationParams(context); - if (!sessionId) return { redirect: { permanent: false, destination: "/auth/login" } }; +export const getServerSideProps = async ( + context: GetServerSidePropsContext +): Promise> => { + const { parsedAppSlug, parsedStepParam, parsedTeamIdParam, sessionId } = + await getInstallationParams(context); + if (!sessionId) return { redirect: { permanent: false, destination: "/auth/login" } }; - const { app, appMetadata, redirect: appRedirect } = await getAppAndMetadata(parsedAppSlug); - if (appRedirect) return appRedirect; + const { app, appMetadata, redirect: appRedirect } = await getAppAndMetadata(parsedAppSlug); + if (appRedirect) return appRedirect; - const user = await getUser(sessionId); - if (!user?.username || !appMetadata) return { redirect: { permanent: false, destination: "/apps" } }; - const appMetadataFinal = appMetadata; + const user = await getUser(sessionId); + if (!user?.username || !appMetadata) return { redirect: { permanent: false, destination: "/apps" } }; + const appMetadataFinal = appMetadata; - const showEventTypesStep = appMetadataFinal.extendsFeature === "EventType" || isConferencingApp(appMetadataFinal.categories); - const { userTeams, isOrg, redirect: teamRedirect } = await prepareUserTeams(user, parsedTeamIdParam); - if (teamRedirect) return teamRedirect; - const { step: initialStep, redirect: stepRedirect } = getInitialStep(parsedStepParam, !!userTeams.length, showEventTypesStep, parsedAppSlug, !!appMetadataFinal.isOAuth); - if (stepRedirect) return stepRedirect; - if (!initialStep) { - return { redirect: { permanent: false, destination: "/apps" } }; + const showEventTypesStep = + appMetadataFinal.extendsFeature === "EventType" || isConferencingApp(appMetadataFinal.categories); + const { userTeams, isOrg, redirect: teamRedirect } = await prepareUserTeams(user, parsedTeamIdParam); + if (teamRedirect) return teamRedirect; + const { step: initialStep, redirect: stepRedirect } = getInitialStep( + parsedStepParam, + !!userTeams.length, + showEventTypesStep, + parsedAppSlug, + !!appMetadataFinal.isOAuth + ); + if (stepRedirect) return stepRedirect; + if (!initialStep) { + return { redirect: { permanent: false, destination: "/apps" } }; + } + + let initialStepValidated: (typeof STEPS)[number]; + try { + initialStepValidated = z.enum(STEPS).parse(initialStep); + } catch { + return { redirect: { permanent: false, destination: "/apps" } }; + } + + const appInstalls = await getAppInstallsBySlug( + parsedAppSlug, + user.id, + userTeams.map(({ id }: MinimalTeam) => id) + ); + const { credentialId, redirect: credRedirect } = await getCredential( + parsedTeamIdParam, + appInstalls, + user, + initialStepValidated, + appMetadataFinal, + parsedAppSlug + ); + if (credRedirect) return credRedirect; + + let eventTypeGroups = null; + if (initialStepValidated === AppOnboardingSteps.EVENT_TYPES_STEP) { + if (!showEventTypesStep) { + return { + redirect: { + permanent: false, + destination: `/apps/installed/${appMetadataFinal.categories[0]}?hl=${appMetadataFinal.slug}`, + }, + }; } + eventTypeGroups = await getEventTypeGroupsForStep( + user, + userTeams, + parsedTeamIdParam, + isOrg, + isConferencingApp(appMetadataFinal.categories) + ); + if (!credentialId) return { redirect: { permanent: false, destination: "/apps" } }; + } - let initialStepValidated: (typeof STEPS)[number]; - try { - initialStepValidated = z.enum(STEPS).parse(initialStep); - } catch { - return { redirect: { permanent: false, destination: "/apps" } }; - } + const personalAccount = { + id: user.id, + name: user.name, + avatarUrl: user.avatarUrl, + alreadyInstalled: appInstalls.some((install) => !install.teamId && install.userId === user.id), + }; + const teams = getTeamsInstalled(!!user.teams.length, userTeams, appInstalls); - const appInstalls = await getAppInstallsBySlug(parsedAppSlug, user.id, userTeams.map(({ id }: MinimalTeam) => id)); - const { credentialId, redirect: credRedirect } = await getCredential(parsedTeamIdParam, appInstalls, user, initialStepValidated, appMetadataFinal, parsedAppSlug); - if (credRedirect) return credRedirect; - - let eventTypeGroups = null; - if (initialStepValidated === AppOnboardingSteps.EVENT_TYPES_STEP) { - if (!showEventTypesStep) { - return { redirect: { permanent: false, destination: `/apps/installed/${appMetadataFinal.categories[0]}?hl=${appMetadataFinal.slug}` } }; - } - eventTypeGroups = await getEventTypeGroupsForStep(user, userTeams, parsedTeamIdParam, isOrg, isConferencingApp(appMetadataFinal.categories)); - if (!credentialId) return { redirect: { permanent: false, destination: "/apps" } }; - } - - const personalAccount = { - id: user.id, name: user.name, avatarUrl: user.avatarUrl, - alreadyInstalled: appInstalls.some((install) => !install.teamId && install.userId === user.id), - }; - const teams = getTeamsInstalled(!!user.teams.length, userTeams, appInstalls); - - return { - props: { - app, appMetadata: appMetadataFinal, showEventTypesStep, step: initialStepValidated, personalAccount, teams, - eventTypeGroups, userName: user.username, credentialId: credentialId || undefined, - isConferencing: isConferencingApp(appMetadataFinal.categories), isOrg, - installableOnTeams: !!appMetadataFinal?.concurrentMeetings || !isConferencingApp(appMetadataFinal.categories), - } as OnboardingPageProps, - }; + return { + props: { + app, + appMetadata: appMetadataFinal, + showEventTypesStep, + step: initialStepValidated, + personalAccount, + teams, + eventTypeGroups, + userName: user.username, + credentialId: credentialId || undefined, + isConferencing: isConferencingApp(appMetadataFinal.categories), + isOrg, + installableOnTeams: + !!appMetadataFinal?.concurrentMeetings || !isConferencingApp(appMetadataFinal.categories), + } as OnboardingPageProps, + }; }; diff --git a/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx b/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx index e64ca13558..ecb1ee61f2 100644 --- a/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx +++ b/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx @@ -82,8 +82,9 @@ async function getUserPageProps(context: GetServerSidePropsContext) { redirect: { permanent: false, // App Router doesn't have access to the current path directly, so we build it manually - destination: `${redirectWithOriginAndSearchString.origin ?? ""}/d/${link}/${slug}${redirectWithOriginAndSearchString.searchString - }`, + destination: `${redirectWithOriginAndSearchString.origin ?? ""}/d/${link}/${slug}${ + redirectWithOriginAndSearchString.searchString + }`, }, }; } diff --git a/apps/web/lib/getThemeProviderProps.ts b/apps/web/lib/getThemeProviderProps.ts index 99f7e247e6..69cf4255a0 100644 --- a/apps/web/lib/getThemeProviderProps.ts +++ b/apps/web/lib/getThemeProviderProps.ts @@ -96,8 +96,8 @@ export function getThemeProviderProps({ const themeSupport = isBookingPage ? ThemeSupport.Booking : props.isThemeSupported === false - ? ThemeSupport.None - : ThemeSupport.App; + ? ThemeSupport.None + : ThemeSupport.App; const themeQueryParam = searchParams?.get("theme") ?? ""; const themeParsed = z.enum(["light", "dark", "system", "auto"]).safeParse(themeQueryParam); @@ -133,10 +133,10 @@ export function getThemeProviderProps({ // Even though it's recommended to use different namespaces when you want to theme differently on the same page but if the embeds are on different pages, the problem can still arise `embed-theme-${embedNamespace}${appearanceIdSuffix}${embedExplicitlySetThemeSuffix}` : themeSupport === ThemeSupport.App - ? "app-theme" - : isBookingPageThemeSupportRequired - ? `booking-theme${appearanceIdSuffix}` - : undefined; + ? "app-theme" + : isBookingPageThemeSupportRequired + ? `booking-theme${appearanceIdSuffix}` + : undefined; const themeProviderProps = { storageKey, diff --git a/apps/web/lib/handleOrgRedirect.test.ts b/apps/web/lib/handleOrgRedirect.test.ts index c11f02586f..6056bab6f4 100644 --- a/apps/web/lib/handleOrgRedirect.test.ts +++ b/apps/web/lib/handleOrgRedirect.test.ts @@ -29,7 +29,7 @@ const createTestContext = (overrides?: { }, }, query: overrides?.query || {}, - } as unknown as GetServerSidePropsContext); + }) as unknown as GetServerSidePropsContext; const createTestRedirectParams = (overrides?: { slugs?: string[]; diff --git a/apps/web/lib/hooks/settings/platform/billing/useSubscribeTeamToStripe.ts b/apps/web/lib/hooks/settings/platform/billing/useSubscribeTeamToStripe.ts index 07eda93427..184c74d0aa 100644 --- a/apps/web/lib/hooks/settings/platform/billing/useSubscribeTeamToStripe.ts +++ b/apps/web/lib/hooks/settings/platform/billing/useSubscribeTeamToStripe.ts @@ -8,7 +8,11 @@ export const useSubscribeTeamToStripe = ( onSuccess, onError, teamId, - }: { teamId?: number | null; onSuccess: (redirectUrl: string) => void; onError: () => void } = { + }: { + teamId?: number | null; + onSuccess: (redirectUrl: string) => void; + onError: () => void; + } = { onSuccess: () => { return; }, diff --git a/apps/web/lib/hooks/settings/platform/billing/useUpgradeTeamSubscriptionInStripe.ts b/apps/web/lib/hooks/settings/platform/billing/useUpgradeTeamSubscriptionInStripe.ts index 14a456e069..89371cf27b 100644 --- a/apps/web/lib/hooks/settings/platform/billing/useUpgradeTeamSubscriptionInStripe.ts +++ b/apps/web/lib/hooks/settings/platform/billing/useUpgradeTeamSubscriptionInStripe.ts @@ -8,7 +8,11 @@ export const useUpgradeTeamSubscriptionInStripe = ( onSuccess, onError, teamId, - }: { teamId?: number | null; onSuccess: (redirectUrl: string) => void; onError: () => void } = { + }: { + teamId?: number | null; + onSuccess: (redirectUrl: string) => void; + onError: () => void; + } = { onSuccess: () => { return; }, diff --git a/apps/web/lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient.ts b/apps/web/lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient.ts index caf29cd434..92b3b65cfd 100644 --- a/apps/web/lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient.ts +++ b/apps/web/lib/hooks/settings/platform/oauth-clients/usePersistOAuthClient.ts @@ -143,7 +143,11 @@ export const useSubscribeTeamToStripe = ( onSuccess, onError, teamId, - }: { teamId?: number | null; onSuccess: (redirectUrl: string) => void; onError: () => void } = { + }: { + teamId?: number | null; + onSuccess: (redirectUrl: string) => void; + onError: () => void; + } = { onSuccess: () => { return; }, @@ -180,7 +184,11 @@ export const useUpgradeTeamSubscriptionInStripe = ( onSuccess, onError, teamId, - }: { teamId?: number | null; onSuccess: (redirectUrl: string) => void; onError: () => void } = { + }: { + teamId?: number | null; + onSuccess: (redirectUrl: string) => void; + onError: () => void; + } = { onSuccess: () => { return; }, diff --git a/apps/web/lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps.ts b/apps/web/lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps.ts index fee25b43d4..a6881912f0 100644 --- a/apps/web/lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps.ts +++ b/apps/web/lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps.ts @@ -62,14 +62,14 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => session?.user?.id ); - if (!eventData) { - return { - notFound: true, - } as const; - } - + if (!eventData) { return { - props: { + notFound: true, + } as const; + } + + return { + props: { eventData, entity: eventData.entity, eventTypeId: eventData.id, diff --git a/apps/web/lib/signup/getServerSideProps.tsx b/apps/web/lib/signup/getServerSideProps.tsx index 9d8c98604f..0bb15253fa 100644 --- a/apps/web/lib/signup/getServerSideProps.tsx +++ b/apps/web/lib/signup/getServerSideProps.tsx @@ -26,9 +26,8 @@ const querySchema = z.object({ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { const prisma = await import("@calcom/prisma").then((mod) => mod.default); const featuresRepository = new FeaturesRepository(prisma); - const emailVerificationEnabled = await featuresRepository.checkIfFeatureIsEnabledGlobally( - "email-verification" - ); + const emailVerificationEnabled = + await featuresRepository.checkIfFeatureIsEnabledGlobally("email-verification"); const signupDisabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("disable-signup"); const onboardingV3Enabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("onboarding-v3"); @@ -200,22 +199,25 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { props: { ...props, token, - prepopulateFormValues: !isOrgInviteByLink && isValidEmail - ? { - email: verificationToken.identifier, - username: isOrganizationOrATeamInOrganization - ? getOrgUsernameFromEmail( - verificationToken.identifier, - (isOrganization - ? tokenTeam.organizationSettings?.orgAutoAcceptEmail - : parentOrgSettings?.orgAutoAcceptEmail) || "" - ) - : slugify(username), - } - : null, + prepopulateFormValues: + !isOrgInviteByLink && isValidEmail + ? { + email: verificationToken.identifier, + username: isOrganizationOrATeamInOrganization + ? getOrgUsernameFromEmail( + verificationToken.identifier, + (isOrganization + ? tokenTeam.organizationSettings?.orgAutoAcceptEmail + : parentOrgSettings?.orgAutoAcceptEmail) || "" + ) + : slugify(username), + } + : null, orgSlug, orgAutoAcceptEmail: isOrgInviteByLink - ? tokenTeam?.organizationSettings?.orgAutoAcceptEmail ?? parentOrgSettings?.orgAutoAcceptEmail ?? null + ? (tokenTeam?.organizationSettings?.orgAutoAcceptEmail ?? + parentOrgSettings?.orgAutoAcceptEmail ?? + null) : null, }, }; diff --git a/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx b/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx index dbc5583f28..f271ddded0 100644 --- a/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx +++ b/apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx @@ -61,7 +61,12 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => // Redirect if no routing form response and redirect URL is configured // Don't redirect if this is a reschedule flow or seated booking flow const hasRoutingFormResponse = query["cal.routingFormResponseId"] || query["cal.queuedFormResponseId"]; - if (!hasRoutingFormResponse && !rescheduleUid && !bookingUid && eventData.redirectUrlOnNoRoutingFormResponse) { + if ( + !hasRoutingFormResponse && + !rescheduleUid && + !bookingUid && + eventData.redirectUrlOnNoRoutingFormResponse + ) { return { redirect: { destination: eventData.redirectUrlOnNoRoutingFormResponse, @@ -106,7 +111,11 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => const log = logger.getSubLogger({ prefix: ["team-event-ssr", `${teamSlug}/${meetingSlug}`] }); const featureRepo = new FeaturesRepository(prisma); const [eventHostsUserData, crmResult, teamHasApiV2Route, booking] = await Promise.all([ - getUsersData(team.isPrivate, eventTypeId, eventData.hosts.map((h) => h.user)).catch((err) => { + getUsersData( + team.isPrivate, + eventTypeId, + eventData.hosts.map((h) => h.user) + ).catch((err) => { log.error("Failed to get users data", err); throw err; }), diff --git a/apps/web/lib/types/inferSSRProps.ts b/apps/web/lib/types/inferSSRProps.ts index dcbab510e8..581829fc4f 100644 --- a/apps/web/lib/types/inferSSRProps.ts +++ b/apps/web/lib/types/inferSSRProps.ts @@ -5,6 +5,5 @@ type GetSSRResult = type GetSSRFn = (...args: any[]) => Promise>; -export type inferSSRProps> = TFn extends GetSSRFn - ? NonNullable - : never; +export type inferSSRProps> = + TFn extends GetSSRFn ? NonNullable : never; diff --git a/apps/web/lib/video/[uid]/getServerSideProps.ts b/apps/web/lib/video/[uid]/getServerSideProps.ts index a278f3f4c4..519bbda684 100644 --- a/apps/web/lib/video/[uid]/getServerSideProps.ts +++ b/apps/web/lib/video/[uid]/getServerSideProps.ts @@ -223,9 +223,9 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { }); const isAttendee = sessionUserEmail - ? bookingObj.attendees?.some( + ? (bookingObj.attendees?.some( (attendee) => attendee.email.toLowerCase() === sessionUserEmail.toLowerCase() - ) ?? false + ) ?? false) : false; // set meetingPassword for guests diff --git a/apps/web/modules/apps/[slug]/slug-view.tsx b/apps/web/modules/apps/[slug]/slug-view.tsx index ac3249d679..1716c984c1 100644 --- a/apps/web/modules/apps/[slug]/slug-view.tsx +++ b/apps/web/modules/apps/[slug]/slug-view.tsx @@ -66,7 +66,7 @@ function SingleAppPage(props: AppDataProps) { // privacy="https://zoom.us/privacy" body={ <> - { } + {} {/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via markdownToSafeHTML */}
diff --git a/apps/web/modules/apps/components/AppCard.tsx b/apps/web/modules/apps/components/AppCard.tsx index e987929114..a8b6713445 100644 --- a/apps/web/modules/apps/components/AppCard.tsx +++ b/apps/web/modules/apps/components/AppCard.tsx @@ -136,87 +136,89 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar color="secondary" className="flex w-32 grow justify-center" href={`/apps/${app.slug}`} - onClick={() => { posthog.capture("app_card_details_clicked", { slug: app.slug }) }} + onClick={() => { + posthog.capture("app_card_details_clicked", { slug: app.slug }); + }} data-testid={`app-store-app-card-${app.slug}`}> {t("details")} {app.isGlobal || - (credentials && credentials.length > 0 && allowedMultipleInstalls) || - (credentials && credentials.length > 0 && isRedirectApp(app.slug)) + (credentials && credentials.length > 0 && allowedMultipleInstalls) || + (credentials && credentials.length > 0 && isRedirectApp(app.slug)) ? !app.isGlobal && ( - !data.installed)} - wrapperClassName="[@media(max-width:260px)]:w-full" - render={({ useDefaultComponent, ...props }) => { - if (useDefaultComponent) { - props = { - ...props, - onClick: () => { - handleAppInstall(); - }, - loading: mutation.isPending, - }; - } else { - const originalOnClick = props.onClick; - props = { - ...props, - onClick: (e) => { - posthog.capture("app_install_button_clicked", { - slug: app.slug, - app_type: app.type, - is_redirect: isRedirectApp(app.slug), - is_conferencing: isConferencing(app.categories || []), - }); - originalOnClick?.(e); - }, - }; - } - return ( - - ); - }} - /> - ) + !data.installed)} + wrapperClassName="[@media(max-width:260px)]:w-full" + render={({ useDefaultComponent, ...props }) => { + if (useDefaultComponent) { + props = { + ...props, + onClick: () => { + handleAppInstall(); + }, + loading: mutation.isPending, + }; + } else { + const originalOnClick = props.onClick; + props = { + ...props, + onClick: (e) => { + posthog.capture("app_install_button_clicked", { + slug: app.slug, + app_type: app.type, + is_redirect: isRedirectApp(app.slug), + is_conferencing: isConferencing(app.categories || []), + }); + originalOnClick?.(e); + }, + }; + } + return ( + + ); + }} + /> + ) : credentials && - !appInstalled && ( - !data.installed)} - teamsPlanRequired={app.teamsPlanRequired} - render={({ useDefaultComponent, ...props }) => { - if (useDefaultComponent) { - props = { - ...props, - disabled: !!props.disabled, - onClick: () => { - handleAppInstall(); - }, - loading: mutation.isPending, - }; - } else { - const originalOnClick = props.onClick; - props = { - ...props, - onClick: (e) => { - posthog.capture("app_install_button_clicked", { - slug: app.slug, - app_type: app.type, - is_redirect: isRedirectApp(app.slug), - is_conferencing: isConferencing(app.categories || []), - }); - originalOnClick?.(e); - }, - }; - } - return ( - - ); - }} - /> - )} + !appInstalled && ( + !data.installed)} + teamsPlanRequired={app.teamsPlanRequired} + render={({ useDefaultComponent, ...props }) => { + if (useDefaultComponent) { + props = { + ...props, + disabled: !!props.disabled, + onClick: () => { + handleAppInstall(); + }, + loading: mutation.isPending, + }; + } else { + const originalOnClick = props.onClick; + props = { + ...props, + onClick: (e) => { + posthog.capture("app_install_button_clicked", { + slug: app.slug, + app_type: app.type, + is_redirect: isRedirectApp(app.slug), + is_conferencing: isConferencing(app.categories || []), + }); + originalOnClick?.(e); + }, + }; + } + return ( + + ); + }} + /> + )}
{appAdded > 0 && !isRedirectApp(app.slug) ? ( diff --git a/apps/web/modules/apps/installation/[[...step]]/step-view.tsx b/apps/web/modules/apps/installation/[[...step]]/step-view.tsx index d9f594df2f..d8e498c6c7 100644 --- a/apps/web/modules/apps/installation/[[...step]]/step-view.tsx +++ b/apps/web/modules/apps/installation/[[...step]]/step-view.tsx @@ -232,10 +232,7 @@ const OnboardingPage = ({ }; return ( -
+
diff --git a/apps/web/modules/auth/login-view.tsx b/apps/web/modules/auth/login-view.tsx index 4dc923e9a7..5edc63d02d 100644 --- a/apps/web/modules/auth/login-view.tsx +++ b/apps/web/modules/auth/login-view.tsx @@ -11,15 +11,8 @@ import { z } from "zod"; import { SAMLLogin } from "@calcom/web/modules/auth/components/SAMLLogin"; import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode"; -import { - LastUsed, - useLastUsed, -} from "@calcom/web/modules/auth/hooks/useLastUsed"; -import { - HOSTED_CAL_FEATURES, - WEBAPP_URL, - WEBSITE_URL, -} from "@calcom/lib/constants"; +import { LastUsed, useLastUsed } from "@calcom/web/modules/auth/hooks/useLastUsed"; +import { HOSTED_CAL_FEATURES, WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants"; import { emailRegex } from "@calcom/lib/emailSchema"; import { getSafeRedirectUrl } from "@calcom/lib/getSafeRedirectUrl"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; @@ -47,11 +40,7 @@ interface LoginValues { } const GoogleIcon = () => ( - Continue with Google Icon + Continue with Google Icon ); export type PageProps = inferSSRProps; export default function Login({ @@ -71,17 +60,13 @@ export default function Login({ .string() .min(1, `${t("error_required_field")}`) .regex(emailRegex, `${t("enter_valid_email")}`), - ...(totpEmail - ? {} - : { password: z.string().min(1, `${t("error_required_field")}`) }), + ...(totpEmail ? {} : { password: z.string().min(1, `${t("error_required_field")}`) }), }) // Passthrough other fields like totpCode .passthrough(); const methods = useForm({ resolver: zodResolver(formSchema) }); const { register, formState } = methods; - const [twoFactorRequired, setTwoFactorRequired] = useState( - !!totpEmail || false - ); + const [twoFactorRequired, setTwoFactorRequired] = useState(!!totpEmail || false); const [twoFactorLostAccess, setTwoFactorLostAccess] = useState(false); const [errorMessage, setErrorMessage] = useState(null); const [lastUsed, setLastUsed] = useLastUsed(); @@ -90,15 +75,9 @@ export default function Login({ // [ErrorCode.SecondFactorRequired]: t("2fa_enabled_instructions"), // Don't leak information about whether an email is registered or not [ErrorCode.IncorrectEmailPassword]: t("incorrect_email_password"), - [ErrorCode.IncorrectTwoFactorCode]: `${t("incorrect_2fa_code")} ${t( - "please_try_again" - )}`, - [ErrorCode.InternalServerError]: `${t("something_went_wrong")} ${t( - "please_try_again_and_contact_us" - )}`, - [ErrorCode.ThirdPartyIdentityProviderEnabled]: t( - "account_created_with_identity_provider" - ), + [ErrorCode.IncorrectTwoFactorCode]: `${t("incorrect_2fa_code")} ${t("please_try_again")}`, + [ErrorCode.InternalServerError]: `${t("something_went_wrong")} ${t("please_try_again_and_contact_us")}`, + [ErrorCode.ThirdPartyIdentityProviderEnabled]: t("account_created_with_identity_provider"), }; let callbackUrl = searchParams?.get("callbackUrl") || ""; @@ -138,8 +117,7 @@ export default function Login({ setErrorMessage(null); }} StartIcon="arrow-left" - color="minimal" - > + color="minimal"> {t("go_back")} {!twoFactorLostAccess ? ( @@ -150,8 +128,7 @@ export default function Login({ methods.setValue("totpCode", ""); }} StartIcon="lock" - color="minimal" - > + color="minimal"> {t("lost_access")} ) : null} @@ -163,8 +140,7 @@ export default function Login({ onClick={() => { window.location.replace("/"); }} - color="minimal" - > + color="minimal"> {t("cancel")} ); @@ -182,18 +158,14 @@ export default function Login({ else if (!res.error) { setLastUsed("credentials"); router.push(callbackUrl); - } else if (res.error === ErrorCode.SecondFactorRequired) - setTwoFactorRequired(true); - else if (res.error === ErrorCode.IncorrectBackupCode) - setErrorMessage(t("incorrect_backup_code")); - else if (res.error === ErrorCode.MissingBackupCodes) - setErrorMessage(t("missing_backup_codes")); + } else if (res.error === ErrorCode.SecondFactorRequired) setTwoFactorRequired(true); + else if (res.error === ErrorCode.IncorrectBackupCode) setErrorMessage(t("incorrect_backup_code")); + else if (res.error === ErrorCode.MissingBackupCodes) setErrorMessage(t("missing_backup_codes")); // fallback if error not found else setErrorMessage(errorMessages[res.error] || t("something_went_wrong")); }; - const { data, isPending, error } = - trpc.viewer.public.ssoConnections.useQuery(); + const { data, isPending, error } = trpc.viewer.public.ssoConnections.useQuery(); useEffect( function refactorMeWithoutEffect() { @@ -218,12 +190,10 @@ export default function Login({ ? !totpEmail ? TwoFactorFooter : ExternalTotpFooter - : process.env.NEXT_PUBLIC_DISABLE_SIGNUP !== "true" && - searchParams?.get("register") !== "false" - ? LoginFooter - : null - } - > + : process.env.NEXT_PUBLIC_DISABLE_SIGNUP !== "true" && searchParams?.get("register") !== "false" + ? LoginFooter + : null + }> {!twoFactorRequired && ( <> @@ -241,8 +211,7 @@ export default function Login({ await signIn("google", { callbackUrl, }); - }} - > + }}> {t("signin_with_google")} {lastUsed === "google" && } @@ -270,31 +239,19 @@ export default function Login({ )} -
+
- +
+ })}> + className="text-sm font-medium text-default"> {t("forgot")}
- {twoFactorRequired ? ( - !twoFactorLostAccess ? ( - - ) : ( - - ) - ) : null} + {twoFactorRequired ? !twoFactorLostAccess ? : : null} {errorMessage && }
diff --git a/apps/web/modules/auth/oauth2/authorize-view.tsx b/apps/web/modules/auth/oauth2/authorize-view.tsx index c66ba5d3c4..01a61eb853 100644 --- a/apps/web/modules/auth/oauth2/authorize-view.tsx +++ b/apps/web/modules/auth/oauth2/authorize-view.tsx @@ -29,11 +29,8 @@ export function Authorize() { const state = searchParams?.get("state") as string; const scope = searchParams?.get("scope") as string; const code_challenge = searchParams?.get("code_challenge") as string; - const code_challenge_method = searchParams?.get( - "code_challenge_method" - ) as string; - const show_account_selector = - searchParams?.get("show_account_selector") === "true"; + const code_challenge_method = searchParams?.get("code_challenge_method") as string; + const show_account_selector = searchParams?.get("show_account_selector") === "true"; const queryString = searchParams?.toString(); @@ -58,31 +55,26 @@ export function Authorize() { ); const { data, isPending: isPendingProfiles } = - trpc.viewer.loggedInViewerRouter.teamsAndUserProfilesQuery.useQuery( - undefined, - { - enabled: show_account_selector, - } - ); - - const generateAuthCodeMutation = - trpc.viewer.oAuth.generateAuthCode.useMutation({ - onSuccess: (data) => { - window.location.href = - data.redirectUrl ?? - `${client?.redirectUri}?code=${data.authorizationCode}&state=${state}`; - }, - onError: (error) => { - if (client?.redirectUri) { - redirectToOAuthError({ - redirectUri: client.redirectUri, - trpcError: error, - state, - }); - } - }, + trpc.viewer.loggedInViewerRouter.teamsAndUserProfilesQuery.useQuery(undefined, { + enabled: show_account_selector, }); + const generateAuthCodeMutation = trpc.viewer.oAuth.generateAuthCode.useMutation({ + onSuccess: (data) => { + window.location.href = + data.redirectUrl ?? `${client?.redirectUri}?code=${data.authorizationCode}&state=${state}`; + }, + onError: (error) => { + if (client?.redirectUri) { + redirectToOAuthError({ + redirectUri: client.redirectUri, + trpcError: error, + state, + }); + } + }, + }); + const mappedProfiles = data ? data .filter((profile) => !profile.readOnly) @@ -130,11 +122,7 @@ export function Authorize() { return
{getClientError.message}
; } - if ( - isPendingGetClient || - (show_account_selector && isPendingProfiles) || - status !== "authenticated" - ) { + if (isPendingGetClient || (show_account_selector && isPendingProfiles) || status !== "authenticated") { return <>; } @@ -147,9 +135,7 @@ export function Authorize() { return (
- - {t("authorizing")} - + {t("authorizing")}
); @@ -169,11 +155,7 @@ export function Authorize() {
- Logo + Logo
@@ -202,9 +184,7 @@ export function Authorize() { )} {show_account_selector && ( <> -
- {t("select_account_team")} -
+
{t("select_account_team")}
{ - if (!option) return; - onActorFilterChange(option.value || null); - }} - options={[{ label: t("all"), value: "" }, ...actorOptions]} - /> -
-
- ); +
+ - - )} - /> - - ( - - Booking Type - { - if (newValue.length > 0) onChange(newValue[0]); - }} - > - - Per Booking - - - Per User - - - - )} - /> - -
- ( - - Total entities included - onChange(+event.target.value)} - /> - - )} - /> - ( - - Fixed price per entity ($) - - onChange(+event.target.value * 100) - } - /> - - )} - /> -
- - ( - - Overages ($) - - onChange(+event.target.value * 100) - } - autoComplete="off" - /> - - )} - /> - - - - - - ) : ( - - -
- - Checkout URL -
- - -
-
- {couponCode && ( + ( - Coupon Code -
- - -
+ Billing Period + { + if (newValue.length > 0) onChange(newValue[0]); + }}> + + Monthly + + + Annually + +
)} - + /> + + ( + + Billing Email for Customer + + + )} + /> + + ( + + Booking Type + { + if (newValue.length > 0) onChange(newValue[0]); + }}> + + Per Booking + + + Per User + + + + )} + /> + +
+ ( + + Total entities included + onChange(+event.target.value)} + /> + + )} + /> + ( + + Fixed price per entity ($) + onChange(+event.target.value * 100)} + /> + + )} + />
- - - )} + + ( + + Overages ($) + onChange(+event.target.value * 100)} + autoComplete="off" + /> + + )} + /> + + + + + + ) : ( + + +
+ + Checkout URL +
+ + +
+
+ {couponCode && ( + + Coupon Code +
+ + +
+
+ )} + +
+
+
+ )}

@@ -427,8 +396,7 @@ function CreateCouponDialog({ type="button" className="cursor-pointer font-medium text-foreground underline underline-offset-2" /> - } - > + }> Create a coupon @@ -441,13 +409,11 @@ function CreateCouponDialog({ setCouponResult(null); couponMutation.mutate(values); })(event); - }} - > + }}> Create Coupon - Create a Stripe coupon with a promotion code restricted to a - specific customer. + Create a Stripe coupon with a promotion code restricted to a specific customer. @@ -478,11 +444,7 @@ function CreateCouponDialog({ render={({ field: { value, onChange } }) => ( Coupon Name (optional) - + )} /> @@ -512,12 +474,7 @@ function CreateCouponDialog({ render={({ field: { value, onChange } }) => ( Promo Code - + )} /> @@ -534,8 +491,7 @@ function CreateCouponDialog({ value={[value]} onValueChange={(newValue) => { if (newValue.length > 0) onChange(newValue[0]); - }} - > + }}> Percentage @@ -554,10 +510,7 @@ function CreateCouponDialog({ render={({ field: { value, onChange } }) => ( - Discount Amount{" "} - {couponForm.watch("discountType") === "percent" - ? "(%)" - : "(cents)"} + Discount Amount {couponForm.watch("discountType") === "percent" ? "(%)" : "(cents)"} { if (newValue) onChange(newValue); - }} - > + }}> @@ -624,15 +576,8 @@ function CreateCouponDialog({ )} - }> - Cancel - - diff --git a/apps/web/modules/ee/organizations/admin/components/BulkDeleteBlocklistEntries.tsx b/apps/web/modules/ee/organizations/admin/components/BulkDeleteBlocklistEntries.tsx index 6350714bf6..5bbe4aab7e 100644 --- a/apps/web/modules/ee/organizations/admin/components/BulkDeleteBlocklistEntries.tsx +++ b/apps/web/modules/ee/organizations/admin/components/BulkDeleteBlocklistEntries.tsx @@ -3,14 +3,10 @@ import { DataTableSelectionBar } from "~/data-table/components"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; -import { - DialogTrigger, - ConfirmationDialogContent, -} from "@calcom/ui/components/dialog"; +import { DialogTrigger, ConfirmationDialogContent } from "@calcom/ui/components/dialog"; import { showToast } from "@calcom/ui/components/toast"; -type BlocklistEntry = - RouterOutputs["viewer"]["admin"]["watchlist"]["list"]["rows"][number]; +type BlocklistEntry = RouterOutputs["viewer"]["admin"]["watchlist"]["list"]["rows"][number]; interface Props { entries: BlocklistEntry[]; @@ -21,26 +17,24 @@ export function BulkDeleteBlocklistEntries({ entries, onRemove }: Props) { const { t } = useLocale(); const utils = trpc.useUtils(); - const bulkDeleteMutation = trpc.viewer.admin.watchlist.bulkDelete.useMutation( - { - onSuccess: async (data) => { - await utils.viewer.admin.watchlist.list.invalidate(); - showToast( - data.failed === 0 - ? t("entries_deleted_successfully", { count: data.success }) - : t("entries_deleted_with_errors", { - success: data.success, - failed: data.failed, - }), - data.failed === 0 ? "success" : "warning" - ); - onRemove(); - }, - onError: (error) => { - showToast(error.message, "error"); - }, - } - ); + const bulkDeleteMutation = trpc.viewer.admin.watchlist.bulkDelete.useMutation({ + onSuccess: async (data) => { + await utils.viewer.admin.watchlist.list.invalidate(); + showToast( + data.failed === 0 + ? t("entries_deleted_successfully", { count: data.success }) + : t("entries_deleted_with_errors", { + success: data.success, + failed: data.failed, + }), + data.failed === 0 ? "success" : "warning" + ); + onRemove(); + }, + onError: (error) => { + showToast(error.message, "error"); + }, + }); return (

@@ -58,11 +52,8 @@ export function BulkDeleteBlocklistEntries({ entries, onRemove }: Props) { bulkDeleteMutation.mutate({ ids: entries.map((entry) => entry.id), }); - }} - > -

- {t("remove_entries_confirm", { count: entries.length })} -

+ }}> +

{t("remove_entries_confirm", { count: entries.length })}

); diff --git a/apps/web/modules/ee/organizations/admin/components/BulkDismissReports.tsx b/apps/web/modules/ee/organizations/admin/components/BulkDismissReports.tsx index a577d37f64..9a2ddcd821 100644 --- a/apps/web/modules/ee/organizations/admin/components/BulkDismissReports.tsx +++ b/apps/web/modules/ee/organizations/admin/components/BulkDismissReports.tsx @@ -3,14 +3,10 @@ import { DataTableSelectionBar } from "~/data-table/components"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; -import { - DialogTrigger, - ConfirmationDialogContent, -} from "@calcom/ui/components/dialog"; +import { DialogTrigger, ConfirmationDialogContent } from "@calcom/ui/components/dialog"; import { showToast } from "@calcom/ui/components/toast"; -type BookingReport = - RouterOutputs["viewer"]["admin"]["watchlist"]["listReports"]["rows"][number]; +type BookingReport = RouterOutputs["viewer"]["admin"]["watchlist"]["listReports"]["rows"][number]; interface Props { reports: BookingReport[]; @@ -21,26 +17,25 @@ export function BulkDismissReports({ reports, onRemove }: Props) { const { t } = useLocale(); const utils = trpc.useUtils(); - const bulkDismissMutation = - trpc.viewer.admin.watchlist.bulkDismiss.useMutation({ - onSuccess: async (data) => { - await utils.viewer.admin.watchlist.listReports.invalidate(); - await utils.viewer.admin.watchlist.pendingReportsCount.invalidate(); - showToast( - data.failed === 0 - ? t("reports_dismissed_successfully", { count: data.success }) - : t("reports_dismissed_with_errors", { - success: data.success, - failed: data.failed, - }), - data.failed === 0 ? "success" : "warning" - ); - onRemove(); - }, - onError: (error) => { - showToast(error.message, "error"); - }, - }); + const bulkDismissMutation = trpc.viewer.admin.watchlist.bulkDismiss.useMutation({ + onSuccess: async (data) => { + await utils.viewer.admin.watchlist.listReports.invalidate(); + await utils.viewer.admin.watchlist.pendingReportsCount.invalidate(); + showToast( + data.failed === 0 + ? t("reports_dismissed_successfully", { count: data.success }) + : t("reports_dismissed_with_errors", { + success: data.success, + failed: data.failed, + }), + data.failed === 0 ? "success" : "warning" + ); + onRemove(); + }, + onError: (error) => { + showToast(error.message, "error"); + }, + }); return ( @@ -58,11 +53,8 @@ export function BulkDismissReports({ reports, onRemove }: Props) { bulkDismissMutation.mutate({ emails: reports.map((group) => group.bookerEmail), }); - }} - > -

- {t("dismiss_reports_confirm", { count: reports.length })} -

+ }}> +

{t("dismiss_reports_confirm", { count: reports.length })}

); diff --git a/apps/web/modules/ee/organizations/admin/views/SystemBlocklistView.tsx b/apps/web/modules/ee/organizations/admin/views/SystemBlocklistView.tsx index 5b28c21975..9dd9b695b0 100644 --- a/apps/web/modules/ee/organizations/admin/views/SystemBlocklistView.tsx +++ b/apps/web/modules/ee/organizations/admin/views/SystemBlocklistView.tsx @@ -41,32 +41,28 @@ function SystemBlocklistContent() { const utils = trpc.useUtils(); - const { data: blockedData, isPending: isBlockedPending } = - trpc.viewer.admin.watchlist.list.useQuery( - { limit, offset, searchTerm }, - { placeholderData: keepPreviousData, enabled: activeView === "blocked" } - ); + const { data: blockedData, isPending: isBlockedPending } = trpc.viewer.admin.watchlist.list.useQuery( + { limit, offset, searchTerm }, + { placeholderData: keepPreviousData, enabled: activeView === "blocked" } + ); - const { data: reportsData, isPending: isReportsPending } = - trpc.viewer.admin.watchlist.listReports.useQuery( - { - limit, - offset, - searchTerm, - sortBy, - systemFilters: { systemStatus: ["PENDING"] }, - }, - { placeholderData: keepPreviousData, enabled: activeView === "pending" } - ); + const { data: reportsData, isPending: isReportsPending } = trpc.viewer.admin.watchlist.listReports.useQuery( + { + limit, + offset, + searchTerm, + sortBy, + systemFilters: { systemStatus: ["PENDING"] }, + }, + { placeholderData: keepPreviousData, enabled: activeView === "pending" } + ); - const { data: pendingReportsCount } = - trpc.viewer.admin.watchlist.pendingReportsCount.useQuery(); + const { data: pendingReportsCount } = trpc.viewer.admin.watchlist.pendingReportsCount.useQuery(); - const { data: entryDetails, isLoading: isDetailsLoading } = - trpc.viewer.admin.watchlist.getDetails.useQuery( - { id: selectedEntryId ?? "" }, - { enabled: !!selectedEntryId } - ); + const { data: entryDetails, isLoading: isDetailsLoading } = trpc.viewer.admin.watchlist.getDetails.useQuery( + { id: selectedEntryId ?? "" }, + { enabled: !!selectedEntryId } + ); const createEntry = trpc.viewer.admin.watchlist.create.useMutation({ onSuccess: async () => { @@ -90,19 +86,17 @@ function SystemBlocklistContent() { }, }); - const addToWatchlist = trpc.viewer.admin.watchlist.addToWatchlist.useMutation( - { - onSuccess: async () => { - await utils.viewer.admin.watchlist.listReports.invalidate(); - await utils.viewer.admin.watchlist.list.invalidate(); - await utils.viewer.admin.watchlist.pendingReportsCount.invalidate(); - showToast(t("system_blocklist_entry_created"), "success"); - }, - onError: (error) => { - showToast(error.message, "error"); - }, - } - ); + const addToWatchlist = trpc.viewer.admin.watchlist.addToWatchlist.useMutation({ + onSuccess: async () => { + await utils.viewer.admin.watchlist.listReports.invalidate(); + await utils.viewer.admin.watchlist.list.invalidate(); + await utils.viewer.admin.watchlist.pendingReportsCount.invalidate(); + showToast(t("system_blocklist_entry_created"), "success"); + }, + onError: (error) => { + showToast(error.message, "error"); + }, + }); const dismissReport = trpc.viewer.admin.watchlist.dismissReport.useMutation({ onSuccess: async () => { @@ -168,11 +162,7 @@ function SystemBlocklistContent() {
{activeView === "blocked" && ( - )} @@ -195,10 +185,7 @@ function SystemBlocklistContent() { onSelectEntry={setSelectedEntryId} enableRowSelection renderBulkActions={(selectedEntries, clearSelection) => ( - + )} /> ) : ( @@ -208,20 +195,13 @@ function SystemBlocklistContent() { totalRowCount={reportsData?.meta?.totalRowCount ?? 0} isPending={isReportsPending} limit={limit} - onAddToBlocklist={(email, type, onSuccess) => - addToWatchlist.mutate({ email, type }, { onSuccess }) - } - onDismiss={(email, onSuccess) => - dismissReport.mutate({ email }, { onSuccess }) - } + onAddToBlocklist={(email, type, onSuccess) => addToWatchlist.mutate({ email, type }, { onSuccess })} + onDismiss={(email, onSuccess) => dismissReport.mutate({ email }, { onSuccess })} isAddingToBlocklist={addToWatchlist.isPending} isDismissing={dismissReport.isPending} enableRowSelection renderBulkActions={(selectedReports, clearSelection) => ( - + )} /> )} diff --git a/apps/web/modules/ee/organizations/other-team-profile-view.tsx b/apps/web/modules/ee/organizations/other-team-profile-view.tsx index 6899d95b1f..71fbaf703e 100644 --- a/apps/web/modules/ee/organizations/other-team-profile-view.tsx +++ b/apps/web/modules/ee/organizations/other-team-profile-view.tsx @@ -267,7 +267,6 @@ const OtherTeamProfileView = () => { {/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via markdownToSafeHTML */}
diff --git a/apps/web/modules/ee/organizations/privacy/blocklist-table.tsx b/apps/web/modules/ee/organizations/privacy/blocklist-table.tsx index 9d2e666271..9c177564b2 100644 --- a/apps/web/modules/ee/organizations/privacy/blocklist-table.tsx +++ b/apps/web/modules/ee/organizations/privacy/blocklist-table.tsx @@ -63,8 +63,7 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) { { placeholderData: keepPreviousData, enabled: activeView === "pending" } ); - const { data: pendingReportsCount } = - trpc.viewer.organizations.pendingReportsCount.useQuery(); + const { data: pendingReportsCount } = trpc.viewer.organizations.pendingReportsCount.useQuery(); const { data: entryDetails, isLoading: isDetailsLoading } = trpc.viewer.organizations.getWatchlistEntryDetails.useQuery( @@ -72,29 +71,27 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) { { enabled: !!selectedEntryId } ); - const createEntry = - trpc.viewer.organizations.createWatchlistEntry.useMutation({ - onSuccess: async () => { - await utils.viewer.organizations.listWatchlistEntries.invalidate(); - showToast(t("blocklist_entry_created"), "success"); - setShowCreateModal(false); - }, - onError: (error) => { - showToast(error.message, "error"); - }, - }); + const createEntry = trpc.viewer.organizations.createWatchlistEntry.useMutation({ + onSuccess: async () => { + await utils.viewer.organizations.listWatchlistEntries.invalidate(); + showToast(t("blocklist_entry_created"), "success"); + setShowCreateModal(false); + }, + onError: (error) => { + showToast(error.message, "error"); + }, + }); - const deleteEntry = - trpc.viewer.organizations.deleteWatchlistEntry.useMutation({ - onSuccess: async () => { - await utils.viewer.organizations.listWatchlistEntries.invalidate(); - setSelectedEntryId(null); - showToast(t("blocklist_entry_deleted"), "success"); - }, - onError: (error) => { - showToast(error.message, "error"); - }, - }); + const deleteEntry = trpc.viewer.organizations.deleteWatchlistEntry.useMutation({ + onSuccess: async () => { + await utils.viewer.organizations.listWatchlistEntries.invalidate(); + setSelectedEntryId(null); + showToast(t("blocklist_entry_deleted"), "success"); + }, + onError: (error) => { + showToast(error.message, "error"); + }, + }); const addToWatchlist = trpc.viewer.organizations.addToWatchlist.useMutation({ onSuccess: async () => { @@ -108,17 +105,16 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) { }, }); - const dismissReport = - trpc.viewer.organizations.dismissBookingReport.useMutation({ - onSuccess: async () => { - await utils.viewer.organizations.listBookingReports.invalidate(); - await utils.viewer.organizations.pendingReportsCount.invalidate(); - showToast(t("booking_report_dismissed"), "success"); - }, - onError: (error) => { - showToast(error.message, "error"); - }, - }); + const dismissReport = trpc.viewer.organizations.dismissBookingReport.useMutation({ + onSuccess: async () => { + await utils.viewer.organizations.listBookingReports.invalidate(); + await utils.viewer.organizations.pendingReportsCount.invalidate(); + showToast(t("booking_report_dismissed"), "success"); + }, + onError: (error) => { + showToast(error.message, "error"); + }, + }); return ( <> @@ -173,11 +169,7 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
{permissions?.canCreate && ( - )} @@ -207,12 +199,8 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) { totalRowCount={reportsData?.meta?.totalRowCount ?? 0} isPending={isReportsPending} limit={limit} - onAddToBlocklist={(email, type, onSuccess) => - addToWatchlist.mutate({ email, type }, { onSuccess }) - } - onDismiss={(email, onSuccess) => - dismissReport.mutate({ email }, { onSuccess }) - } + onAddToBlocklist={(email, type, onSuccess) => addToWatchlist.mutate({ email, type }, { onSuccess })} + onDismiss={(email, onSuccess) => dismissReport.mutate({ email }, { onSuccess })} isAddingToBlocklist={addToWatchlist.isPending} isDismissing={dismissReport.isPending} /> diff --git a/apps/web/modules/ee/organizations/profile.tsx b/apps/web/modules/ee/organizations/profile.tsx index 14b1599a37..65faa54271 100644 --- a/apps/web/modules/ee/organizations/profile.tsx +++ b/apps/web/modules/ee/organizations/profile.tsx @@ -25,10 +25,7 @@ import { Form } from "@calcom/ui/components/form"; import { Label } from "@calcom/ui/components/form"; import { TextField } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; -import { - BannerUploader, - ImageUploader, -} from "@calcom/ui/components/image-uploader"; +import { BannerUploader, ImageUploader } from "@calcom/ui/components/image-uploader"; // if I include this in the above barrel import, I get a runtime error that the component is not exported. import { OrgBanner } from "@calcom/ui/components/organization-banner"; import { @@ -136,8 +133,7 @@ const OrgProfileView = ({ calVideoLogo: currentOrganisation?.calVideoLogo || "", slug: currentOrganisation?.slug || - ((currentOrganisation?.metadata as Prisma.JsonObject) - ?.requestedSlug as string) || + ((currentOrganisation?.metadata as Prisma.JsonObject)?.requestedSlug as string) || "", }; @@ -153,12 +149,8 @@ const OrgProfileView = ({
- -

- {currentOrganisation?.name} -

+ +

{currentOrganisation?.name}

{!isBioEmpty && ( <> @@ -179,8 +171,7 @@ const OrgProfileView = ({ onClick={() => { navigator.clipboard.writeText(orgBranding.fullDomain); showToast("Copied to clipboard", "success"); - }} - > + }}> {t("copy_link_org")}
@@ -205,10 +196,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { const mutation = trpc.viewer.organizations.update.useMutation({ onError: (err) => { // Handle JSON parsing errors from body size limit exceeded - if ( - err.message.includes("Unexpected token") && - err.message.includes("Body excee") - ) { + if (err.message.includes("Unexpected token") && err.message.includes("Body excee")) { showToast(t("converted_image_size_limit_exceed"), "error"); return; } @@ -258,8 +246,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { }; mutation.mutate(variables); - }} - > + }}>
{
@@ -285,10 +269,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { id="avatar-upload" buttonMsg={t("upload_logo")} handleAvatarChange={onChange} - imageSrc={getPlaceholderAvatar( - value, - form.getValues("name") - )} + imageSrc={getPlaceholderAvatar(value, form.getValues("name"))} triggerButtonColor="secondary" /> {showRemoveLogoButton && ( @@ -312,9 +293,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { - } + fallback={} size="lg" />
@@ -325,9 +304,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { buttonMsg={t("upload_cal_video_logo")} handleAvatarChange={onChange} imageSrc={value || undefined} - uploadInstruction={t( - "cal_video_logo_upload_instruction" - )} + uploadInstruction={t("cal_video_logo_upload_instruction")} triggerButtonColor="secondary" testId="cal-video-logo" /> @@ -360,9 +337,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { fallback={ !value ? (
-

- {t("no_target", { target: "banner" })} -

+

{t("no_target", { target: "banner" })}

{ size="sm" type="button" aria-label="copy organization id" - onClick={() => handleCopy(value.toString())} - > + onClick={() => handleCopy(value.toString())}> @@ -491,9 +465,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { md.render(form.getValues("bio") || "")} - setText={(value: string) => - form.setValue("bio", turndown(value), { shouldDirty: true }) - } + setText={(value: string) => form.setValue("bio", turndown(value), { shouldDirty: true })} excludedToolbarItems={["blockType"]} disableLists firstRender={firstRender} @@ -509,8 +481,7 @@ const OrgProfileForm = ({ defaultValues }: { defaultValues: FormValues }) => { color="primary" type="submit" loading={mutation.isPending} - disabled={isDisabled} - > + disabled={isDisabled}> {t("update")} diff --git a/apps/web/modules/ee/platform/components/CreateANewPlatformForm.tsx b/apps/web/modules/ee/platform/components/CreateANewPlatformForm.tsx index 46ed0fe6be..fc169c2280 100644 --- a/apps/web/modules/ee/platform/components/CreateANewPlatformForm.tsx +++ b/apps/web/modules/ee/platform/components/CreateANewPlatformForm.tsx @@ -7,7 +7,10 @@ import { useState } from "react"; import { Controller, useForm } from "react-hook-form"; import { uuid } from "short-uuid"; -import { deriveOrgNameFromEmail, deriveSlugFromEmail } from "~/ee/organizations/components/CreateANewOrganizationForm"; +import { + deriveOrgNameFromEmail, + deriveSlugFromEmail, +} from "~/ee/organizations/components/CreateANewOrganizationForm"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import slugify from "@calcom/lib/slugify"; import { UserPermissionRole } from "@calcom/prisma/enums"; diff --git a/apps/web/modules/ee/posthog/PostHogPageView.tsx b/apps/web/modules/ee/posthog/PostHogPageView.tsx index b9bcc36130..913863071a 100644 --- a/apps/web/modules/ee/posthog/PostHogPageView.tsx +++ b/apps/web/modules/ee/posthog/PostHogPageView.tsx @@ -19,7 +19,7 @@ export default function PostHogPageView() { const posthog = usePostHog(); useEffect(() => { - const shouldTrack = TRACKED_ROUTES.some(route => pathname?.startsWith(route)); + const shouldTrack = TRACKED_ROUTES.some((route) => pathname?.startsWith(route)); if (!shouldTrack) return; diff --git a/apps/web/modules/ee/support/lib/freshchat/FreshChatScript.tsx b/apps/web/modules/ee/support/lib/freshchat/FreshChatScript.tsx index d723386744..fbed863967 100644 --- a/apps/web/modules/ee/support/lib/freshchat/FreshChatScript.tsx +++ b/apps/web/modules/ee/support/lib/freshchat/FreshChatScript.tsx @@ -11,9 +11,8 @@ declare global { } } - const host = process.env.NEXT_PUBLIC_FRESHCHAT_HOST; - + const token = process.env.NEXT_PUBLIC_FRESHCHAT_TOKEN; export const isFreshChatEnabled = diff --git a/apps/web/modules/ee/support/lib/helpscout/HelpscoutMenuItem.tsx b/apps/web/modules/ee/support/lib/helpscout/HelpscoutMenuItem.tsx index d113a6d015..00ff648da9 100644 --- a/apps/web/modules/ee/support/lib/helpscout/HelpscoutMenuItem.tsx +++ b/apps/web/modules/ee/support/lib/helpscout/HelpscoutMenuItem.tsx @@ -20,7 +20,6 @@ export default function HelpscoutMenuItem(props: HelpscoutMenuItemProps) { onHelpItemSelect(); } - if (!process.env.NEXT_PUBLIC_HELPSCOUT_KEY) return null; return ( diff --git a/apps/web/modules/ee/support/lib/zendesk/ZendeskMenuItem.tsx b/apps/web/modules/ee/support/lib/zendesk/ZendeskMenuItem.tsx index 0c96adbeff..a76aa87ee2 100644 --- a/apps/web/modules/ee/support/lib/zendesk/ZendeskMenuItem.tsx +++ b/apps/web/modules/ee/support/lib/zendesk/ZendeskMenuItem.tsx @@ -3,7 +3,6 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; - const ZENDESK_KEY = process.env.NEXT_PUBLIC_ZENDESK_KEY; interface ZendeskMenuItemProps { diff --git a/apps/web/modules/ee/teams/components/EditMemberSheet.tsx b/apps/web/modules/ee/teams/components/EditMemberSheet.tsx index e7050a43c4..694217455b 100644 --- a/apps/web/modules/ee/teams/components/EditMemberSheet.tsx +++ b/apps/web/modules/ee/teams/components/EditMemberSheet.tsx @@ -12,13 +12,7 @@ import { Avatar } from "@calcom/ui/components/avatar"; import { Form } from "@calcom/ui/components/form"; import { ToggleGroup, Select } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; -import { - Sheet, - SheetContent, - SheetFooter, - SheetHeader, - SheetBody, -} from "@calcom/ui/components/sheet"; +import { Sheet, SheetContent, SheetFooter, SheetHeader, SheetBody } from "@calcom/ui/components/sheet"; import { Skeleton, Loader } from "@calcom/ui/components/skeleton"; import { showToast } from "@calcom/ui/components/toast"; import { Tooltip } from "@calcom/ui/components/tooltip"; @@ -56,9 +50,7 @@ export function EditMemberSheet({ (state) => [state.editMode, state.setEditMode, state.setMutationLoading], shallow ); - const [role, setRole] = useState( - selectedUser.customRoleId || selectedUser.role - ); + const [role, setRole] = useState(selectedUser.customRoleId || selectedUser.role); const name = selectedUser.name || (() => { @@ -69,19 +61,16 @@ export function EditMemberSheet({ const bookerUrl = selectedUser.bookerUrl; const utils = trpc.useUtils(); const bookerUrlWithoutProtocol = bookerUrl.replace(/^https?:\/\//, ""); - const bookingLink = selectedUser.username - ? `${bookerUrlWithoutProtocol}/${selectedUser.username}` - : ""; + const bookingLink = selectedUser.username ? `${bookerUrlWithoutProtocol}/${selectedUser.username}` : ""; // Load custom roles for the team - const { data: customRoles, isPending: isLoadingRoles } = - trpc.viewer.pbac.getTeamRoles.useQuery( - { teamId }, - { - enabled: !!teamId, - retry: false, // Don't retry if PBAC is not enabled - } - ); + const { data: customRoles, isPending: isLoadingRoles } = trpc.viewer.pbac.getTeamRoles.useQuery( + { teamId }, + { + enabled: !!teamId, + retry: false, // Don't retry if PBAC is not enabled + } + ); const options = useMemo(() => { // If we have custom roles, only show custom roles @@ -106,10 +95,7 @@ export function EditMemberSheet({ label: t("owner"), value: MembershipRole.OWNER, }, - ].filter( - ({ value }) => - value !== MembershipRole.OWNER || currentMember === MembershipRole.OWNER - ); + ].filter(({ value }) => value !== MembershipRole.OWNER || currentMember === MembershipRole.OWNER); }, [t, currentMember, customRoles]); // Determine if we should use Select (when custom roles exist) or ToggleGroup (traditional only) @@ -123,11 +109,10 @@ export function EditMemberSheet({ }, }); - const { data: getUserConnectedApps, isPending } = - trpc.viewer.teams.getUserConnectedApps.useQuery({ - userIds: [selectedUser.id], - teamId, - }); + const { data: getUserConnectedApps, isPending } = trpc.viewer.teams.getUserConnectedApps.useQuery({ + userIds: [selectedUser.id], + teamId, + }); const connectedApps = getUserConnectedApps?.[selectedUser.id]; @@ -206,32 +191,21 @@ export function EditMemberSheet({ onOpenChange={() => { setEditMode(false); dispatch({ type: "CLOSE_MODAL" }); - }} - > + }}> {!isPending && !isLoadingRoles ? ( -
+
- +

@@ -240,28 +214,16 @@ export function EditMemberSheet({

- {selectedUser.bio - ? selectedUser?.bio - : t("user_has_no_bio")} + {selectedUser.bio ? selectedUser?.bio : t("user_has_no_bio")}

-

- {t("profile")} -

- - +

{t("profile")}

+ + {!editMode ? ( {shouldUseSelect ? ( { @@ -1214,12 +1098,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({ />
-
+
Button color
-
+
Text color
- setIsBookingCustomizationOpen((val) => !val) - } - > + onOpenChange={() => setIsBookingCustomizationOpen((val) => !val)}>
{/* Conditionally render EmbedTheme only if NOT React Atom */} @@ -1298,9 +1169,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({ } setPreviewState((previewState) => { // Ensure theme is updated in config for all embed types - const newConfig = ( - currentConfig?: EmbedConfig - ) => ({ + const newConfig = (currentConfig?: EmbedConfig) => ({ ...(currentConfig ?? {}), theme: option.value, }); @@ -1308,21 +1177,15 @@ const EmbedTypeCodeAndPreviewDialogContent = ({ ...previewState, inline: { ...previewState.inline, - config: newConfig( - previewState.inline.config - ), + config: newConfig(previewState.inline.config), }, floatingPopup: { ...previewState.floatingPopup, - config: newConfig( - previewState.floatingPopup.config - ), + config: newConfig(previewState.floatingPopup.config), }, elementClick: { ...previewState.elementClick, - config: newConfig( - previewState.elementClick.config - ), + config: newConfig(previewState.elementClick.config), }, // Keep updating top-level theme for preview iframe theme: option.value, @@ -1348,9 +1211,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({ }); }} /> -
- {t("hide_eventtype_details")} -
+
{t("hide_eventtype_details")}
) : null} {/* Conditionally render Brand Colors only if NOT React Atom */} @@ -1369,14 +1230,11 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
{ addToPalette({ - [palette.name as keyof (typeof previewState)["palette"]]: - color, + [palette.name as keyof (typeof previewState)["palette"]]: color, }); }} /> @@ -1394,9 +1252,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({ } setPreviewState((previewState) => { // Ensure layout is updated in config for all embed types - const newConfig = ( - currentConfig?: EmbedConfig - ) => ({ + const newConfig = (currentConfig?: EmbedConfig) => ({ ...(currentConfig ?? {}), layout: option.value, }); @@ -1408,15 +1264,11 @@ const EmbedTypeCodeAndPreviewDialogContent = ({ }, floatingPopup: { ...previewState.floatingPopup, - config: newConfig( - previewState.floatingPopup.config - ), + config: newConfig(previewState.floatingPopup.config), }, elementClick: { ...previewState.elementClick, - config: newConfig( - previewState.elementClick.config - ), + config: newConfig(previewState.elementClick.config), }, // Keep updating top-level layout for preview iframe layout: option.value, @@ -1452,11 +1304,8 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
+ embedParams.embedTabName === tab.href.split("=")[1] ? "flex-1" : "hidden" + )}> {tab.type === "code" && ( )}
); } - if ( - embedType === "email" && - (tab.name !== "Preview" || !eventTypeData?.eventType) - ) - return; + if (embedType === "email" && (tab.name !== "Preview" || !eventTypeData?.eventType)) return; return ( -
+
-
+
); })} @@ -1529,10 +1359,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
)}
- + @@ -1593,13 +1418,9 @@ export const EmbedDialog = ({ // Must not set name when noQueryParam mode as required by Dialog component name: "embed", clearQueryParamsOnClose: queryParamsForDialog, - })} - > + })}> {!embedParams.embedType ? ( - + ) : ( ({ data-test-embed-url={embedUrl} data-testid="embed" type="button" - onClick={openEmbedModal} - > + onClick={openEmbedModal}> {children} ); diff --git a/apps/web/modules/embed/components/RoutingFormEmbed.tsx b/apps/web/modules/embed/components/RoutingFormEmbed.tsx index 23dbc75d4f..b55f802454 100644 --- a/apps/web/modules/embed/components/RoutingFormEmbed.tsx +++ b/apps/web/modules/embed/components/RoutingFormEmbed.tsx @@ -13,7 +13,7 @@ export const RoutingFormEmbedDialog = () => { const { t } = useLocale(); const { data: user } = trpc.viewer.me.get.useQuery(); const routingFormTypes = types.filter((type) => type.type !== "email"); - + // Add the headless option specifically for routing forms const headlessType = { title: t("use_my_own_form"), @@ -60,10 +60,8 @@ export const RoutingFormEmbedDialog = () => { ), }; - const routingFormTypesWithHeadless = IS_CALCOM - ? [...routingFormTypes, headlessType] - : routingFormTypes; - + const routingFormTypesWithHeadless = IS_CALCOM ? [...routingFormTypes, headlessType] : routingFormTypes; + return ( { } {...register("slug")} - onChange={(e) => { + onChange={(e) => { form.setValue("slug", slugify(e?.target.value), { shouldTouch: true }); }} /> diff --git a/apps/web/modules/event-types/components/EventTypeLayout.tsx b/apps/web/modules/event-types/components/EventTypeLayout.tsx index a8f04704fc..864fbc38d0 100644 --- a/apps/web/modules/event-types/components/EventTypeLayout.tsx +++ b/apps/web/modules/event-types/components/EventTypeLayout.tsx @@ -2,7 +2,10 @@ import { useMemo, useState, Suspense } from "react"; import type { UseFormReturn } from "react-hook-form"; import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager"; -import { EventTypeEmbedButton, EventTypeEmbedDialog } from "@calcom/web/modules/embed/components/EventTypeEmbed"; +import { + EventTypeEmbedButton, + EventTypeEmbedDialog, +} from "@calcom/web/modules/embed/components/EventTypeEmbed"; import type { FormValues } from "@calcom/features/eventtypes/lib/types"; import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -85,11 +88,13 @@ function EventTypeSingleLayout({ formMethods, }); const EventTypeTabs = tabsNavigation; - const permalink = `${bookerUrl}/${team ? `${!team.parentId ? "team/" : ""}${team.slug}` : formMethods.getValues("users")[0].username - }/${eventType.slug}`; + const permalink = `${bookerUrl}/${ + team ? `${!team.parentId ? "team/" : ""}${team.slug}` : formMethods.getValues("users")[0].username + }/${eventType.slug}`; - const embedLink = `${team ? `team/${team.slug}` : formMethods.getValues("users")[0].username - }/${formMethods.getValues("slug")}`; + const embedLink = `${ + team ? `team/${team.slug}` : formMethods.getValues("users")[0].username + }/${formMethods.getValues("slug")}`; const isManagedEvent = formMethods.getValues("schedulingType") === SchedulingType.MANAGED ? "_managed" : ""; const [Shell] = useMemo(() => { diff --git a/apps/web/modules/event-types/components/EventTypeWebWrapper.tsx b/apps/web/modules/event-types/components/EventTypeWebWrapper.tsx index 1184caef68..c3f72db123 100644 --- a/apps/web/modules/event-types/components/EventTypeWebWrapper.tsx +++ b/apps/web/modules/event-types/components/EventTypeWebWrapper.tsx @@ -45,30 +45,27 @@ type EventPermissions = { }; }; -const ManagedEventTypeDialog = dynamic(() => - import("@calcom/features/eventtypes/components/dialogs/ManagedEventDialog") +const ManagedEventTypeDialog = dynamic( + () => import("@calcom/features/eventtypes/components/dialogs/ManagedEventDialog") ); const AssignmentWarningDialog = dynamic(() => import("./dialogs/AssignmentWarningDialog")); -const EventSetupTab = dynamic( - () => import("./tabs/setup/EventSetupTabWebWrapper").then((mod) => mod), - { loading: () => null } -); +const EventSetupTab = dynamic(() => import("./tabs/setup/EventSetupTabWebWrapper").then((mod) => mod), { + loading: () => null, +}); const EventAvailabilityTab = dynamic(() => import("./tabs/availability/EventAvailabilityTabWebWrapper").then((mod) => mod) ); -const EventTeamAssignmentTab = dynamic(() => import("./tabs/assignment/EventTeamAssignmentTabWebWrapper").then((mod) => mod)); - -const EventLimitsTab = dynamic(() => - import("./tabs/limits/EventLimitsTabWebWrapper").then((mod) => mod) +const EventTeamAssignmentTab = dynamic(() => + import("./tabs/assignment/EventTeamAssignmentTabWebWrapper").then((mod) => mod) ); -const EventAdvancedTab = dynamic(() => - import("./tabs/advanced/EventAdvancedWebWrapper").then((mod) => mod) -); +const EventLimitsTab = dynamic(() => import("./tabs/limits/EventLimitsTabWebWrapper").then((mod) => mod)); + +const EventAdvancedTab = dynamic(() => import("./tabs/advanced/EventAdvancedWebWrapper").then((mod) => mod)); const EventInstantTab = dynamic(() => import("./tabs/instant/EventInstantTab").then((mod) => mod.EventInstantTab) @@ -78,9 +75,7 @@ const EventRecurringTab = dynamic(() => import("./tabs/recurring/EventRecurringWebWrapper").then((mod) => mod) ); -const EventAppsTab = dynamic(() => - import("./tabs/apps/EventAppsTab").then((mod) => mod.EventAppsTab) -); +const EventAppsTab = dynamic(() => import("./tabs/apps/EventAppsTab").then((mod) => mod.EventAppsTab)); const EventWorkflowsTab = dynamic(() => import("./tabs/workflows/EventWorkflowsTab")); @@ -88,9 +83,7 @@ const EventWebhooksTab = dynamic(() => import("./tabs/webhooks/EventWebhooksTab").then((mod) => mod.EventWebhooksTab) ); -const EventAITab = dynamic(() => - import("./tabs/ai/EventAITab").then((mod) => mod.EventAITab) -); +const EventAITab = dynamic(() => import("./tabs/ai/EventAITab").then((mod) => mod.EventAITab)); export type EventTypeWebWrapperProps = { id: number; diff --git a/apps/web/modules/event-types/components/Segment.tsx b/apps/web/modules/event-types/components/Segment.tsx index 90e0f61d6a..e8166ad99d 100644 --- a/apps/web/modules/event-types/components/Segment.tsx +++ b/apps/web/modules/event-types/components/Segment.tsx @@ -111,8 +111,8 @@ function MatchingTeamMembers({ // Check if queryValue has valid children properties value const hasValidValue = queryValue?.children1 ? Object.values(queryValue.children1).some( - (child) => child.properties?.value?.[0] !== undefined && child.properties?.value?.[0] !== null - ) + (child) => child.properties?.value?.[0] !== undefined && child.properties?.value?.[0] !== null + ) : false; const { data: matchingTeamMembersWithResult, isPending } = diff --git a/apps/web/modules/event-types/components/locations/CalVideoSettings.tsx b/apps/web/modules/event-types/components/locations/CalVideoSettings.tsx index 5eb5700c91..6ee6ba11f5 100644 --- a/apps/web/modules/event-types/components/locations/CalVideoSettings.tsx +++ b/apps/web/modules/event-types/components/locations/CalVideoSettings.tsx @@ -170,7 +170,12 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet /> {t("redirect_url")}
} + label={ +
+ {t("redirect_url")} + +
+ } defaultValue={calVideoSettings?.redirectUrlOnExit || ""} data-testid="calVideoSettings.redirectUrlOnExit" containerClassName="mt-4" diff --git a/apps/web/modules/event-types/components/locations/HostLocations.tsx b/apps/web/modules/event-types/components/locations/HostLocations.tsx index b7618a8459..aca7ecdec6 100644 --- a/apps/web/modules/event-types/components/locations/HostLocations.tsx +++ b/apps/web/modules/event-types/components/locations/HostLocations.tsx @@ -314,9 +314,15 @@ const HostLocationRow = ({ return ( <>
- +
-
{hostData?.name || `${t("user")} ${host.userId}`}
+
+ {hostData?.name || `${t("user")} ${host.userId}`} +
{hostData?.email &&
{hostData.email}
}
@@ -363,7 +369,10 @@ const HostLocationRow = ({ locationOption={pendingLocationOption} onSave={(inputValue) => { if (!pendingLocationOption) return; - onLocationChange(host.userId, buildHostLocation(host.userId, eventTypeId, pendingLocationOption, hostData, inputValue)); + onLocationChange( + host.userId, + buildHostLocation(host.userId, eventTypeId, pendingLocationOption, hostData, inputValue) + ); setPendingLocationOption(null); }} title="set_location" diff --git a/apps/web/modules/event-types/components/tabs/advanced/DisableReschedulingController.tsx b/apps/web/modules/event-types/components/tabs/advanced/DisableReschedulingController.tsx index eed517c21a..8bb3bd4d15 100644 --- a/apps/web/modules/event-types/components/tabs/advanced/DisableReschedulingController.tsx +++ b/apps/web/modules/event-types/components/tabs/advanced/DisableReschedulingController.tsx @@ -46,8 +46,9 @@ export default function DisableReschedulingController({ const [shouldShowRadioButtons, setShouldShowRadioButtons] = useState( disableRescheduling || - (currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0) || - eventType.disableRescheduling === true || false + (currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0) || + eventType.disableRescheduling === true || + false ); useEffect(() => { if (currentMinimumRescheduleNotice && currentMinimumRescheduleNotice > 0) { @@ -108,8 +109,8 @@ export default function DisableReschedulingController({ disableRescheduling ? "always" : currentMinimumRescheduleNotice !== null && currentMinimumRescheduleNotice > 0 - ? "notice" - : "always" + ? "notice" + : "always" } onValueChange={(val) => { const handler = (val: string) => { diff --git a/apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx b/apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx index a44fb9f3d4..2458794aeb 100644 --- a/apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx +++ b/apps/web/modules/event-types/components/tabs/advanced/EventAdvancedTab.tsx @@ -1079,10 +1079,10 @@ export const EventAdvancedTab = ({ multiLocation ? t("multilocation_doesnt_support_seats") : noShowFeeEnabled - ? t("no_show_fee_doesnt_support_seats") - : isRecurringEvent - ? t("recurring_event_doesnt_support_seats") - : undefined + ? t("no_show_fee_doesnt_support_seats") + : isRecurringEvent + ? t("recurring_event_doesnt_support_seats") + : undefined } onCheckedChange={(e) => { // Enabling seats will disable guests and requiring confirmation until fully supported @@ -1113,7 +1113,7 @@ export const EventAdvancedTab = ({ type="number" disabled={seatsLocked.disabled} //For old events if value > MAX_SEATS_PER_TIME_SLOT - value={value > MAX_SEATS_PER_TIME_SLOT ? MAX_SEATS_PER_TIME_SLOT : value ?? 1} + value={value > MAX_SEATS_PER_TIME_SLOT ? MAX_SEATS_PER_TIME_SLOT : (value ?? 1)} step={1} placeholder="1" min={1} @@ -1244,7 +1244,7 @@ export const EventAdvancedTab = ({ checked={value} onCheckedChange={(e) => { onChange(e); - const lockedTimeZone = e ? eventType.lockedTimeZone ?? "Europe/London" : null; + const lockedTimeZone = e ? (eventType.lockedTimeZone ?? "Europe/London") : null; formMethods.setValue("lockedTimeZone", lockedTimeZone, { shouldDirty: true }); }} data-testid="lock-timezone-toggle" diff --git a/apps/web/modules/event-types/components/tabs/advanced/FormBuilder.tsx b/apps/web/modules/event-types/components/tabs/advanced/FormBuilder.tsx index d2cb0fb024..d881a07f69 100644 --- a/apps/web/modules/event-types/components/tabs/advanced/FormBuilder.tsx +++ b/apps/web/modules/event-types/components/tabs/advanced/FormBuilder.tsx @@ -152,7 +152,9 @@ export const FormBuilder = function FormBuilder({ {LockedIcon}
-

{description}

+

+ {description} +

{showPhoneAndEmailToggle && ( { @@ -256,15 +258,18 @@ export const FormBuilder = function FormBuilder({ if (!fieldType) { throw new Error(`Invalid field type - ${field.type}`); } - const groupedBySourceLabel = sources.reduce((groupBy, source) => { - const item = groupBy[source.label] || []; - if (source.type === "user" || source.type === "default") { + const groupedBySourceLabel = sources.reduce( + (groupBy, source) => { + const item = groupBy[source.label] || []; + if (source.type === "user" || source.type === "default") { + return groupBy; + } + item.push(source); + groupBy[source.label] = item; return groupBy; - } - item.push(source); - groupBy[source.label] = item; - return groupBy; - }, {} as Record>); + }, + {} as Record> + ); return (
  • ); -} \ No newline at end of file +} diff --git a/apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTabWebWrapper.tsx b/apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTabWebWrapper.tsx index 4a3f10b2d7..3688d5ba76 100644 --- a/apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTabWebWrapper.tsx +++ b/apps/web/modules/event-types/components/tabs/assignment/EventTeamAssignmentTabWebWrapper.tsx @@ -1,7 +1,4 @@ -import { - EventTeamAssignmentTab, - type EventTeamAssignmentTabBaseProps, -} from "./EventTeamAssignmentTab"; +import { EventTeamAssignmentTab, type EventTeamAssignmentTabBaseProps } from "./EventTeamAssignmentTab"; const EventTeamAssignmentTabWebWrapper = ( props: Omit diff --git a/apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTab.tsx b/apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTab.tsx index 5da4564319..44efe31ff3 100644 --- a/apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTab.tsx +++ b/apps/web/modules/event-types/components/tabs/availability/EventAvailabilityTab.tsx @@ -479,15 +479,17 @@ const EventTypeSchedule = ({ if (schedulesQueryData.length === 0) { return ( - + {t("create")} - } - /> + + } + /> ); } diff --git a/apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx b/apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx index c783966906..70607aeb38 100644 --- a/apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx +++ b/apps/web/modules/event-types/components/tabs/limits/EventLimitsTabWebWrapper.tsx @@ -5,4 +5,4 @@ const EventLimitsTabWebWrapper = (props: EventLimitsTabProps) => { return ; }; -export default EventLimitsTabWebWrapper; \ No newline at end of file +export default EventLimitsTabWebWrapper; diff --git a/apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx b/apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx index 1034dc4b5c..846fa74869 100644 --- a/apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx +++ b/apps/web/modules/event-types/components/tabs/recurring/EventRecurringWebWrapper.tsx @@ -5,4 +5,4 @@ const EventRecurringWebWrapper = (props: EventRecurringTabProps) => { return ; }; -export default EventRecurringWebWrapper; \ No newline at end of file +export default EventRecurringWebWrapper; diff --git a/apps/web/modules/event-types/components/tabs/setup/EventSetupTab.tsx b/apps/web/modules/event-types/components/tabs/setup/EventSetupTab.tsx index 996301ff5f..7052383bd8 100644 --- a/apps/web/modules/event-types/components/tabs/setup/EventSetupTab.tsx +++ b/apps/web/modules/event-types/components/tabs/setup/EventSetupTab.tsx @@ -16,7 +16,14 @@ import turndown from "@calcom/lib/turndownService"; import { SchedulingType } from "@calcom/prisma/enums"; import classNames from "@calcom/ui/classNames"; import { Editor } from "@calcom/ui/components/editor"; -import { CheckboxField, Label, Select, SettingsToggle, TextAreaField, TextField } from "@calcom/ui/components/form"; +import { + CheckboxField, + Label, + Select, + SettingsToggle, + TextAreaField, + TextField, +} from "@calcom/ui/components/form"; import { Skeleton } from "@calcom/ui/components/skeleton"; import { Tooltip } from "@calcom/ui/components/tooltip"; @@ -144,10 +151,10 @@ export const EventSetupTab = ( md.render(formMethods.getValues("description") || "")} setText={(value: string) => { - // Clean up non-breaking spaces - const cleanedValue = value.replace(/ /g, ' '); - const markdownValue = turndown(cleanedValue); - formMethods.setValue("description", markdownValue, { shouldDirty: true }); + // Clean up non-breaking spaces + const cleanedValue = value.replace(/ /g, " "); + const markdownValue = turndown(cleanedValue); + formMethods.setValue("description", markdownValue, { shouldDirty: true }); }} excludedToolbarItems={["blockType"]} placeholder={t("quick_video_meeting")} diff --git a/apps/web/modules/event-types/components/tabs/workflows/EventWorkflowsTab.tsx b/apps/web/modules/event-types/components/tabs/workflows/EventWorkflowsTab.tsx index ef14b9f6b9..85114652df 100644 --- a/apps/web/modules/event-types/components/tabs/workflows/EventWorkflowsTab.tsx +++ b/apps/web/modules/event-types/components/tabs/workflows/EventWorkflowsTab.tsx @@ -148,8 +148,8 @@ const WorkflowListItem = (props: ItemProps) => { workflow.readOnly && props.isChildrenManagedEventType ? "locked_by_team_admin" : isActive - ? "turn_off" - : "turn_on" + ? "turn_off" + : "turn_on" ) as string }>
    @@ -203,7 +203,7 @@ function EventWorkflowsTab(props: Props) { const dataWf = data.workflows.find((wf) => wf.id === workflowOnEventType.id); return { ...workflowOnEventType, - readOnly: isChildrenManagedEventType && dataWf?.teamId ? true : dataWf?.readOnly ?? false, + readOnly: isChildrenManagedEventType && dataWf?.teamId ? true : (dataWf?.readOnly ?? false), } as WorkflowType; }); diff --git a/apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx b/apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx index d4492bdf93..7eed39f341 100644 --- a/apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx +++ b/apps/web/modules/event-types/hooks/useTeamMembersWithSegment.tsx @@ -1,7 +1,10 @@ import { useQuery } from "@tanstack/react-query"; import type { AttributesQueryValue } from "@calcom/lib/raqb/types"; import { trpc } from "@calcom/trpc/react"; -import { type UseTeamMembersWithSegmentProps, useProcessTeamMembersData } from "@calcom/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform"; +import { + type UseTeamMembersWithSegmentProps, + useProcessTeamMembersData, +} from "@calcom/atoms/event-types/hooks/useTeamMembersWithSegmentPlatform"; export const useTeamMembersWithSegment = ({ initialTeamMembers, diff --git a/apps/web/modules/event-types/views/event-types-listing-view.tsx b/apps/web/modules/event-types/views/event-types-listing-view.tsx index ae00c1a963..680260a10f 100644 --- a/apps/web/modules/event-types/views/event-types-listing-view.tsx +++ b/apps/web/modules/event-types/views/event-types-listing-view.tsx @@ -1105,4 +1105,4 @@ const EventTypesPage = ({ userEventGroupsData, user }: Props) => { export const SearchContext: React.Context = SearchContextInternal; -export default EventTypesPage; \ No newline at end of file +export default EventTypesPage; diff --git a/apps/web/modules/feature-flags/components/AssignFeatureSheet.tsx b/apps/web/modules/feature-flags/components/AssignFeatureSheet.tsx index f0e9868109..294d0586af 100644 --- a/apps/web/modules/feature-flags/components/AssignFeatureSheet.tsx +++ b/apps/web/modules/feature-flags/components/AssignFeatureSheet.tsx @@ -173,11 +173,7 @@ export function AssignFeatureSheet({ flag, open, onOpenChange }: AssignFeatureSh )}
  • - {}} - /> + {}} /> ))}
    diff --git a/apps/web/modules/feature-flags/components/FlagAdminList.tsx b/apps/web/modules/feature-flags/components/FlagAdminList.tsx index 1a7962dbf5..05459edc30 100644 --- a/apps/web/modules/feature-flags/components/FlagAdminList.tsx +++ b/apps/web/modules/feature-flags/components/FlagAdminList.tsx @@ -17,14 +17,17 @@ export const FlagAdminList = () => { const [selectedFlag, setSelectedFlag] = useState(null); const [sheetOpen, setSheetOpen] = useState(false); - const groupedFlags = data.reduce((acc, flag) => { - const type = flag.type || "OTHER"; - if (!acc[type]) { - acc[type] = []; - } - acc[type].push(flag); - return acc; - }, {} as Record); + const groupedFlags = data.reduce( + (acc, flag) => { + const type = flag.type || "OTHER"; + if (!acc[type]) { + acc[type] = []; + } + acc[type].push(flag); + return acc; + }, + {} as Record + ); const sortedTypes = Object.keys(groupedFlags).sort(); diff --git a/apps/web/modules/form-builder/components/Components.tsx b/apps/web/modules/form-builder/components/Components.tsx index 4a43c42ab3..2e0efcd029 100644 --- a/apps/web/modules/form-builder/components/Components.tsx +++ b/apps/web/modules/form-builder/components/Components.tsx @@ -66,7 +66,7 @@ type Component = name?: string; required?: boolean; translatedDefaultLabel?: string; - } + }, >( props: TProps ) => JSX.Element; @@ -79,7 +79,7 @@ type Component = variants: z.infer["variants"]; value: Record | string | undefined; setValue: (value: string | Record) => void; - } + }, >( props: TProps ) => JSX.Element; @@ -179,8 +179,8 @@ export const Components: Record = { variantField.name === "firstName" ? "given-name" : variantField.name === "lastName" - ? "family-name" - : undefined + ? "family-name" + : undefined } onChange={(e) => onChange(variantField.name, e.target.value)} /> @@ -465,7 +465,7 @@ export const Components: Record = { {option.value === "somewhereElse" ? t("somewhere_else") - : getCleanLabel(option.label) ?? ""} + : (getCleanLabel(option.label) ?? "")} {option.value === "phone" && ( diff --git a/apps/web/modules/form-builder/components/FormBuilderField.test.tsx b/apps/web/modules/form-builder/components/FormBuilderField.test.tsx index 8bfcc41808..7903f0c014 100644 --- a/apps/web/modules/form-builder/components/FormBuilderField.test.tsx +++ b/apps/web/modules/form-builder/components/FormBuilderField.test.tsx @@ -59,7 +59,8 @@ describe("FormBuilderField", () => { }); const component = { - getFieldInput: ({ label }: { label: string }) => screen.getByRole("textbox", { name: label }) as HTMLInputElement, + getFieldInput: ({ label }: { label: string }) => + screen.getByRole("textbox", { name: label }) as HTMLInputElement, fillFieldInput: ({ label, value }: { label: string; value: string }) => { fireEvent.change(component.getFieldInput({ label }), { target: { value } }); }, diff --git a/apps/web/modules/form-builder/components/FormBuilderField.tsx b/apps/web/modules/form-builder/components/FormBuilderField.tsx index f9aaf76826..d75f0b4379 100644 --- a/apps/web/modules/form-builder/components/FormBuilderField.tsx +++ b/apps/web/modules/form-builder/components/FormBuilderField.tsx @@ -25,9 +25,7 @@ const renderLabel = (field: Partial) => { if (field.labelAsSafeHtml) { return ( // biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via markdownToSafeHTML - + ); } return {field.label}; diff --git a/apps/web/modules/getting-started/[[...step]]/onboarding-view.tsx b/apps/web/modules/getting-started/[[...step]]/onboarding-view.tsx index fe5cfd5d16..c4401f06d2 100644 --- a/apps/web/modules/getting-started/[[...step]]/onboarding-view.tsx +++ b/apps/web/modules/getting-started/[[...step]]/onboarding-view.tsx @@ -41,33 +41,33 @@ const getStepsAndHeadersForUser = (t: TFunction) => { subtitle: string[]; skipText?: string; }[] = [ - { - title: t("welcome_to_cal_header", { appName: APP_NAME }), - subtitle: [t("we_just_need_basic_info")], - }, - { - title: t("connect_your_calendar"), - subtitle: [t("connect_your_calendar_instructions")], - skipText: t("connect_calendar_later"), - }, - { - title: t("connect_your_video_app"), - subtitle: [t("connect_your_video_app_instructions")], - skipText: t("set_up_later"), - }, - { - title: t("set_availability"), - subtitle: [ - `${t("set_availability_getting_started_subtitle_1")} ${t( - "set_availability_getting_started_subtitle_2" - )}`, - ], - }, - { - title: t("nearly_there"), - subtitle: [t("nearly_there_instructions")], - }, - ]; + { + title: t("welcome_to_cal_header", { appName: APP_NAME }), + subtitle: [t("we_just_need_basic_info")], + }, + { + title: t("connect_your_calendar"), + subtitle: [t("connect_your_calendar_instructions")], + skipText: t("connect_calendar_later"), + }, + { + title: t("connect_your_video_app"), + subtitle: [t("connect_your_video_app_instructions")], + skipText: t("set_up_later"), + }, + { + title: t("set_availability"), + subtitle: [ + `${t("set_availability_getting_started_subtitle_1")} ${t( + "set_availability_getting_started_subtitle_2" + )}`, + ], + }, + { + title: t("nearly_there"), + subtitle: [t("nearly_there_instructions")], + }, + ]; return { steps: [...BASE_STEPS], diff --git a/apps/web/modules/insights/components/ChartCard.tsx b/apps/web/modules/insights/components/ChartCard.tsx index 6dce15a072..0249761f52 100644 --- a/apps/web/modules/insights/components/ChartCard.tsx +++ b/apps/web/modules/insights/components/ChartCard.tsx @@ -25,7 +25,7 @@ export function ChartCard({ isPending, isError, ...panelCardProps -}: Omit & { +}: Omit & { legend?: Array; legendSize?: LegendSize; enabledLegend?: Array; diff --git a/apps/web/modules/insights/components/booking/CSATOverTimeChart.tsx b/apps/web/modules/insights/components/booking/CSATOverTimeChart.tsx index a704868e97..28f49b99ff 100644 --- a/apps/web/modules/insights/components/booking/CSATOverTimeChart.tsx +++ b/apps/web/modules/insights/components/booking/CSATOverTimeChart.tsx @@ -65,7 +65,6 @@ export const CSATOverTimeChart = () => { }, }); - return ( {isSuccess ? ( diff --git a/apps/web/modules/insights/components/booking/HighestRatedMembersTable.tsx b/apps/web/modules/insights/components/booking/HighestRatedMembersTable.tsx index 5c98822227..5daf228496 100644 --- a/apps/web/modules/insights/components/booking/HighestRatedMembersTable.tsx +++ b/apps/web/modules/insights/components/booking/HighestRatedMembersTable.tsx @@ -22,7 +22,6 @@ export const HighestRatedMembersTable = () => { } ); - return ( {isSuccess && data ? : null} diff --git a/apps/web/modules/insights/components/booking/LowestRatedMembersTable.tsx b/apps/web/modules/insights/components/booking/LowestRatedMembersTable.tsx index 1f4e2c2d5c..24cb9ac8a7 100644 --- a/apps/web/modules/insights/components/booking/LowestRatedMembersTable.tsx +++ b/apps/web/modules/insights/components/booking/LowestRatedMembersTable.tsx @@ -22,7 +22,6 @@ export const LowestRatedMembersTable = () => { } ); - return ( {isSuccess && data ? : null} diff --git a/apps/web/modules/insights/components/booking/MostBookedTeamMembersTable.tsx b/apps/web/modules/insights/components/booking/MostBookedTeamMembersTable.tsx index 43420e039c..06ed372b4d 100644 --- a/apps/web/modules/insights/components/booking/MostBookedTeamMembersTable.tsx +++ b/apps/web/modules/insights/components/booking/MostBookedTeamMembersTable.tsx @@ -22,7 +22,6 @@ export const MostBookedTeamMembersTable = () => { } ); - return ( {isSuccess && data ? : null} diff --git a/apps/web/modules/insights/components/booking/MostCancelledBookingsTables.tsx b/apps/web/modules/insights/components/booking/MostCancelledBookingsTables.tsx index 7321ce8f07..dbc2b19fac 100644 --- a/apps/web/modules/insights/components/booking/MostCancelledBookingsTables.tsx +++ b/apps/web/modules/insights/components/booking/MostCancelledBookingsTables.tsx @@ -11,16 +11,14 @@ export const MostCancelledBookingsTables = () => { const { t } = useLocale(); const insightsBookingParams = useInsightsBookingParameters(); - const { data, isSuccess, isPending, isError } = trpc.viewer.insights.membersWithMostCancelledBookings.useQuery( - insightsBookingParams, - { + const { data, isSuccess, isPending, isError } = + trpc.viewer.insights.membersWithMostCancelledBookings.useQuery(insightsBookingParams, { staleTime: 180000, refetchOnWindowFocus: false, trpc: { context: { skipBatch: true }, }, - } - ); + }); return ( diff --git a/apps/web/modules/insights/components/booking/NoShowHostsOverTimeChart.tsx b/apps/web/modules/insights/components/booking/NoShowHostsOverTimeChart.tsx index ad197870a0..f293d1d3fe 100644 --- a/apps/web/modules/insights/components/booking/NoShowHostsOverTimeChart.tsx +++ b/apps/web/modules/insights/components/booking/NoShowHostsOverTimeChart.tsx @@ -67,7 +67,11 @@ export const NoShowHostsOverTimeChart = () => { }); return ( - + {isSuccess ? (
    diff --git a/apps/web/modules/insights/components/booking/PopularEventsTable.tsx b/apps/web/modules/insights/components/booking/PopularEventsTable.tsx index 0aa2e50b70..83caa0b1b0 100644 --- a/apps/web/modules/insights/components/booking/PopularEventsTable.tsx +++ b/apps/web/modules/insights/components/booking/PopularEventsTable.tsx @@ -10,13 +10,16 @@ export const PopularEventsTable = () => { const { t } = useLocale(); const insightsBookingParams = useInsightsBookingParameters(); - const { data, isSuccess, isPending, isError } = trpc.viewer.insights.popularEvents.useQuery(insightsBookingParams, { - staleTime: 180000, - refetchOnWindowFocus: false, - trpc: { - context: { skipBatch: true }, - }, - }); + const { data, isSuccess, isPending, isError } = trpc.viewer.insights.popularEvents.useQuery( + insightsBookingParams, + { + staleTime: 180000, + refetchOnWindowFocus: false, + trpc: { + context: { skipBatch: true }, + }, + } + ); return ( diff --git a/apps/web/modules/insights/components/booking/RecentFeedbackTable.tsx b/apps/web/modules/insights/components/booking/RecentFeedbackTable.tsx index 22fc5f9c63..69b33823e6 100644 --- a/apps/web/modules/insights/components/booking/RecentFeedbackTable.tsx +++ b/apps/web/modules/insights/components/booking/RecentFeedbackTable.tsx @@ -11,14 +11,16 @@ export const RecentFeedbackTable = () => { const { t } = useLocale(); const insightsBookingParams = useInsightsBookingParameters(); - const { data, isSuccess, isPending, isError } = trpc.viewer.insights.recentRatings.useQuery(insightsBookingParams, { - staleTime: 180000, - refetchOnWindowFocus: false, - trpc: { - context: { skipBatch: true }, - }, - }); - + const { data, isSuccess, isPending, isError } = trpc.viewer.insights.recentRatings.useQuery( + insightsBookingParams, + { + staleTime: 180000, + refetchOnWindowFocus: false, + trpc: { + context: { skipBatch: true }, + }, + } + ); return ( diff --git a/apps/web/modules/insights/components/filters/OrgTeamsFilter.tsx b/apps/web/modules/insights/components/filters/OrgTeamsFilter.tsx index 33b79868f7..4853ae3555 100644 --- a/apps/web/modules/insights/components/filters/OrgTeamsFilter.tsx +++ b/apps/web/modules/insights/components/filters/OrgTeamsFilter.tsx @@ -1,10 +1,7 @@ import { useSession } from "next-auth/react"; import { useState } from "react"; -import { - FilterCheckboxField, - FilterCheckboxFieldsContainer, -} from "~/filters/components/TeamsFilter"; +import { FilterCheckboxField, FilterCheckboxFieldsContainer } from "~/filters/components/TeamsFilter"; import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; diff --git a/apps/web/modules/insights/components/routing/RoutedToPerPeriod.tsx b/apps/web/modules/insights/components/routing/RoutedToPerPeriod.tsx index 431e4f191d..eb0b663c1a 100644 --- a/apps/web/modules/insights/components/routing/RoutedToPerPeriod.tsx +++ b/apps/web/modules/insights/components/routing/RoutedToPerPeriod.tsx @@ -222,11 +222,14 @@ export function RoutedToPerPeriod() { }); return flattenedUsers.map((user) => { - const stats = uniquePeriods.reduce((acc, period) => { - const key = `${user.id}-${period.toISOString()}`; - acc[period.toISOString()] = statsMap.get(key) ?? 0; - return acc; - }, {} as { [key: string]: number }); + const stats = uniquePeriods.reduce( + (acc, period) => { + const key = `${user.id}-${period.toISOString()}`; + acc[period.toISOString()] = statsMap.get(key) ?? 0; + return acc; + }, + {} as { [key: string]: number } + ); return { id: user.id, diff --git a/apps/web/modules/insights/components/routing/RoutingFormResponsesTable.tsx b/apps/web/modules/insights/components/routing/RoutingFormResponsesTable.tsx index 1dfffe0917..256d815fe6 100644 --- a/apps/web/modules/insights/components/routing/RoutingFormResponsesTable.tsx +++ b/apps/web/modules/insights/components/routing/RoutingFormResponsesTable.tsx @@ -14,7 +14,13 @@ import { ZSingleSelectFilterValue, type FilterableColumn, } from "@calcom/features/data-table"; -import { DataTableWrapper, DataTableFilters, DataTableSegment, DataTableSkeleton, DateRangeFilter } from "@calcom/web/modules/data-table/components"; +import { + DataTableWrapper, + DataTableFilters, + DataTableSegment, + DataTableSkeleton, + DateRangeFilter, +} from "@calcom/web/modules/data-table/components"; import type { FilterType } from "@calcom/types/data-table"; import { useInsightsRoutingParameters } from "@calcom/web/modules/insights/hooks/useInsightsRoutingParameters"; import { trpc } from "@calcom/trpc/react"; diff --git a/apps/web/modules/insights/hooks/useInsightsColumns.tsx b/apps/web/modules/insights/hooks/useInsightsColumns.tsx index cdfadba02a..ccd35875e4 100644 --- a/apps/web/modules/insights/hooks/useInsightsColumns.tsx +++ b/apps/web/modules/insights/hooks/useInsightsColumns.tsx @@ -165,18 +165,21 @@ export const useInsightsColumns = ({ const filterType = isSingleSelect ? ColumnFilterType.SINGLE_SELECT : isNumber - ? ColumnFilterType.NUMBER - : isText - ? ColumnFilterType.TEXT - : ColumnFilterType.MULTI_SELECT; + ? ColumnFilterType.NUMBER + : isText + ? ColumnFilterType.TEXT + : ColumnFilterType.MULTI_SELECT; const optionMap = - fieldHeader.options?.reduce((acc, option) => { - if (option.id) { - acc[option.id] = option.label; - } - return acc; - }, {} as Record) ?? {}; + fieldHeader.options?.reduce( + (acc, option) => { + if (option.id) { + acc[option.id] = option.label; + } + return acc; + }, + {} as Record + ) ?? {}; return columnHelper.accessor((row) => row.fields.find((field) => field.fieldId === fieldHeader.id), { id: fieldHeader.id, diff --git a/apps/web/modules/insights/views/insights-call-history-view.tsx b/apps/web/modules/insights/views/insights-call-history-view.tsx index eb306d637c..5dbbf0d405 100644 --- a/apps/web/modules/insights/views/insights-call-history-view.tsx +++ b/apps/web/modules/insights/views/insights-call-history-view.tsx @@ -1,11 +1,6 @@ "use client"; -import { - getCoreRowModel, - getSortedRowModel, - useReactTable, - type ColumnDef, -} from "@tanstack/react-table"; +import { getCoreRowModel, getSortedRowModel, useReactTable, type ColumnDef } from "@tanstack/react-table"; import { usePathname } from "next/navigation"; import { useMemo, useState, useReducer } from "react"; @@ -15,17 +10,10 @@ import { convertFacetedValuesToMap, useDataTable, } from "@calcom/features/data-table"; -import { - DataTableWrapper, - DataTableToolbar, - DataTableFilters, -} from "~/data-table/components"; +import { DataTableWrapper, DataTableToolbar, DataTableFilters } from "~/data-table/components"; import { useSegments } from "~/data-table/hooks/useSegments"; import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; -import type { - CallDetailsState, - CallDetailsAction, -} from "@calcom/features/ee/workflows/lib/types"; +import type { CallDetailsState, CallDetailsAction } from "@calcom/features/ee/workflows/lib/types"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; @@ -60,10 +48,7 @@ const initialState: CallDetailsState = { }, }; -function reducer( - state: CallDetailsState, - action: CallDetailsAction -): CallDetailsState { +function reducer(state: CallDetailsState, action: CallDetailsAction): CallDetailsState { switch (action.type) { case "OPEN_CALL_DETAILS": return { ...state, callDetailsSheet: action.payload }; @@ -81,11 +66,7 @@ function CallHistoryTable(props: CallHistoryProps) { const pathname = usePathname(); if (!pathname) return null; return ( - + ); @@ -115,29 +96,20 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { return callsData.calls.map((call) => ({ id: call.call_id || Math.random().toString(), - time: call.start_timestamp - ? new Date(call.start_timestamp).toISOString() - : new Date().toISOString(), + time: call.start_timestamp ? new Date(call.start_timestamp).toISOString() : new Date().toISOString(), duration: Math.round((call.duration_ms || 0) / 1000), - channelType: (call.call_type || "phone_call") as - | "web_call" - | "phone_call", + channelType: (call.call_type || "phone_call") as "web_call" | "phone_call", sessionId: call.call_id || t("unknown"), endReason: call.disconnection_reason || t("unknown"), sessionStatus: - call.call_status === "ended" - ? "completed" - : call.call_status === "ongoing" - ? "ongoing" - : "failed", + call.call_status === "ended" ? "completed" : call.call_status === "ongoing" ? "ongoing" : "failed", userSentiment: call.call_analysis?.user_sentiment?.toLowerCase() === "positive" ? "positive" : call.call_analysis?.user_sentiment?.toLowerCase() === "negative" - ? "negative" - : "neutral", - from: - "from_number" in call ? call.from_number || t("unknown") : t("unknown"), + ? "negative" + : "neutral", + from: "from_number" in call ? call.from_number || t("unknown") : t("unknown"), to: "to_number" in call ? call.to_number || t("unknown") : t("unknown"), callCreated: call.call_analysis?.call_successful ?? true, inVoicemail: call.call_analysis?.in_voicemail ?? false, @@ -170,11 +142,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { const seconds = row.original.duration; const minutes = Math.floor(seconds / 60); const remainingSeconds = seconds % 60; - return ( - {`${minutes}:${remainingSeconds - .toString() - .padStart(2, "0")}`} - ); + return {`${minutes}:${remainingSeconds.toString().padStart(2, "0")}`}; }, }, { @@ -192,9 +160,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { accessorKey: "sessionId", header: t("session_id"), size: 210, - cell: ({ row }) => ( - {row.original.sessionId} - ), + cell: ({ row }) => {row.original.sessionId}, }, { id: "endReason", @@ -213,12 +179,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { }, cell: ({ row }) => { const status = row.original.sessionStatus; - const variant = - status === "completed" - ? "green" - : status === "ongoing" - ? "blue" - : "red"; + const variant = status === "completed" ? "green" : status === "ongoing" ? "blue" : "red"; return {status}; }, }, @@ -232,12 +193,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { }, cell: ({ row }) => { const sentiment = row.original.userSentiment; - const variant = - sentiment === "positive" - ? "green" - : sentiment === "negative" - ? "red" - : "gray"; + const variant = sentiment === "positive" ? "green" : sentiment === "negative" ? "red" : "gray"; return {sentiment}; }, }, @@ -261,11 +217,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { cell: ({ row }) => { const created = row.original.callCreated; const variant = created ? "green" : "red"; - return ( - - {created ? t("successful") : t("unsuccessful")} - - ); + return {created ? t("successful") : t("unsuccessful")}; }, }, { @@ -276,9 +228,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { cell: ({ row }) => { const inVoicemail = row.original.inVoicemail; const variant = inVoicemail ? "blue" : "gray"; - return ( - {inVoicemail ? t("yes") : t("no")} - ); + return {inVoicemail ? t("yes") : t("no")}; }, }, ], @@ -337,9 +287,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { paginationMode="standard" rowClassName="cursor-pointer hover:bg-subtle" onRowMouseclick={(row) => { - const callIndex = callHistoryData.findIndex( - (call) => call.id === row.original.id - ); + const callIndex = callHistoryData.findIndex((call) => call.id === row.original.id); if (callIndex !== -1 && callsData?.calls?.[callIndex]) { dispatch({ type: "OPEN_CALL_DETAILS", @@ -365,11 +313,7 @@ function CallHistoryContent({ org: _org }: CallHistoryProps) { EmptyView={ - {state.callDetailsSheet.showModal && ( - - )} + {state.callDetailsSheet.showModal && } ); } diff --git a/apps/web/modules/insights/views/insights-view.tsx b/apps/web/modules/insights/views/insights-view.tsx index 7b01419f04..0e6085214c 100644 --- a/apps/web/modules/insights/views/insights-view.tsx +++ b/apps/web/modules/insights/views/insights-view.tsx @@ -3,11 +3,7 @@ import { usePathname } from "next/navigation"; import { useState, useCallback } from "react"; -import { - DataTableProvider, - ColumnFilterType, - type FilterableColumn, -} from "@calcom/features/data-table"; +import { DataTableProvider, ColumnFilterType, type FilterableColumn } from "@calcom/features/data-table"; import { DataTableFilters, DateRangeFilter } from "~/data-table/components"; import type { FilterType } from "@calcom/types/data-table"; import { useDataTable } from "@calcom/features/data-table/hooks/useDataTable"; diff --git a/apps/web/modules/insights/views/insights-virtual-queues-view.tsx b/apps/web/modules/insights/views/insights-virtual-queues-view.tsx index cb30e0e4f3..68551c185f 100644 --- a/apps/web/modules/insights/views/insights-virtual-queues-view.tsx +++ b/apps/web/modules/insights/views/insights-virtual-queues-view.tsx @@ -31,7 +31,7 @@ export default function InsightsVirtualQueuesPage() { headline={t("no_routing_forms")} description={t("empty_routing_forms_description")} /> - ) + ); } return ( diff --git a/apps/web/modules/integration-attribute-sync/components/EditIntegrationAttributeSyncCard.tsx b/apps/web/modules/integration-attribute-sync/components/EditIntegrationAttributeSyncCard.tsx index e25361a7d8..d4865aa92f 100644 --- a/apps/web/modules/integration-attribute-sync/components/EditIntegrationAttributeSyncCard.tsx +++ b/apps/web/modules/integration-attribute-sync/components/EditIntegrationAttributeSyncCard.tsx @@ -2,7 +2,10 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { showToast } from "@calcom/ui/components/toast"; -import type { IntegrationAttributeSync, ISyncFormData } from "@calcom/features/ee/integration-attribute-sync/repositories/IIntegrationAttributeSyncRepository"; +import type { + IntegrationAttributeSync, + ISyncFormData, +} from "@calcom/features/ee/integration-attribute-sync/repositories/IIntegrationAttributeSyncRepository"; import IntegrationAttributeSyncCard from "./IntegrationAttributeSyncCard"; import type { IIntegrationAttributeSyncCardProps } from "./IntegrationAttributeSyncCard"; diff --git a/apps/web/modules/integration-attribute-sync/components/FieldMappingBuilder.tsx b/apps/web/modules/integration-attribute-sync/components/FieldMappingBuilder.tsx index e5b2dca7de..37ef592333 100644 --- a/apps/web/modules/integration-attribute-sync/components/FieldMappingBuilder.tsx +++ b/apps/web/modules/integration-attribute-sync/components/FieldMappingBuilder.tsx @@ -173,9 +173,7 @@ export const FieldMappingBuilder = ({ attributeOptions={attributeOptions} isLoading={isLoadingAttributes} error={ - duplicateIndices.has(index) - ? t("attribute_sync_duplicate_attribute_mapping") - : undefined + duplicateIndices.has(index) ? t("attribute_sync_duplicate_attribute_mapping") : undefined } /> )) diff --git a/apps/web/modules/integration-attribute-sync/components/IntegrationAttributeSyncCard.tsx b/apps/web/modules/integration-attribute-sync/components/IntegrationAttributeSyncCard.tsx index 7420c70f97..555e9f7d3e 100644 --- a/apps/web/modules/integration-attribute-sync/components/IntegrationAttributeSyncCard.tsx +++ b/apps/web/modules/integration-attribute-sync/components/IntegrationAttributeSyncCard.tsx @@ -40,9 +40,7 @@ export interface IIntegrationAttributeSyncCardProps { onDelete?: () => void; } -const IntegrationAttributeSyncCard = ( - props: IIntegrationAttributeSyncCardProps -) => { +const IntegrationAttributeSyncCard = (props: IIntegrationAttributeSyncCardProps) => { const { sync, credentialOptions, @@ -74,9 +72,7 @@ const IntegrationAttributeSyncCard = ( operator: RuleOperatorEnum.AND, conditions: [], }, - syncFieldMappings: Array.isArray(sync.syncFieldMappings) - ? sync.syncFieldMappings - : [], + syncFieldMappings: Array.isArray(sync.syncFieldMappings) ? sync.syncFieldMappings : [], } : { id: "", @@ -104,9 +100,7 @@ const IntegrationAttributeSyncCard = ( operator: RuleOperatorEnum.AND, conditions: [], }, - syncFieldMappings: Array.isArray(sync.syncFieldMappings) - ? sync.syncFieldMappings - : [], + syncFieldMappings: Array.isArray(sync.syncFieldMappings) ? sync.syncFieldMappings : [], }); } // Only need to run if the sync changes @@ -161,8 +155,7 @@ const IntegrationAttributeSyncCard = ( fn: handleDelete, } : undefined - } - > + }>
    @@ -192,26 +185,16 @@ const IntegrationAttributeSyncCard = ( Number(opt.value) === field.value - ) || null - } - onChange={(option) => - field.onChange(Number(option?.value)) - } + value={credentialOptions.find((opt) => Number(opt.value) === field.value) || null} + onChange={(option) => field.onChange(Number(option?.value))} /> {fieldState.error && ( -

    - {fieldState.error.message} -

    +

    {fieldState.error.message}

    )} )} /> -

    - {t("attribute_sync_credential_description")} -

    +

    {t("attribute_sync_credential_description")}

    @@ -247,16 +230,10 @@ const IntegrationAttributeSyncCard = ( validate: (mappings) => { const seenAttributes = new Set(); for (const mapping of mappings || []) { - if ( - mapping.attributeId && - seenAttributes.has(mapping.attributeId) - ) { - return t( - "attribute_sync_duplicate_attribute_mapping" - ); + if (mapping.attributeId && seenAttributes.has(mapping.attributeId)) { + return t("attribute_sync_duplicate_attribute_mapping"); } - if (mapping.attributeId) - seenAttributes.add(mapping.attributeId); + if (mapping.attributeId) seenAttributes.add(mapping.attributeId); } return true; }, @@ -264,16 +241,12 @@ const IntegrationAttributeSyncCard = ( render={({ field }) => ( - field.onChange(fieldMappings.mappings) - } + onChange={(fieldMappings) => field.onChange(fieldMappings.mappings)} attributeOptions={attributeOptions} /> )} /> -

    - {t("attribute_sync_field_mappings_description")} -

    +

    {t("attribute_sync_field_mappings_description")}

    @@ -282,11 +255,7 @@ const IntegrationAttributeSyncCard = ( {t("cancel")} )} -
    @@ -300,8 +269,7 @@ const IntegrationAttributeSyncCard = ( variety="danger" title={t("attribute_sync_delete_title")} confirmBtnText={t("delete")} - onConfirm={confirmDelete} - > + onConfirm={confirmDelete}> {t("attribute_sync_delete_confirmation")}
    diff --git a/apps/web/modules/integration-attribute-sync/components/RuleBuilder.tsx b/apps/web/modules/integration-attribute-sync/components/RuleBuilder.tsx index d68733a57f..0d13a19b29 100644 --- a/apps/web/modules/integration-attribute-sync/components/RuleBuilder.tsx +++ b/apps/web/modules/integration-attribute-sync/components/RuleBuilder.tsx @@ -64,7 +64,9 @@ const ConditionComponent = ({ }: ConditionComponentProps) => { const { t } = useLocale(); const conditionTypeOptions = getConditionTypeOptions(t); - const conditionTypeOption = conditionTypeOptions.find((opt: { value: ConditionIdentifierEnum; label: string }) => opt.value === condition.identifier); + const conditionTypeOption = conditionTypeOptions.find( + (opt: { value: ConditionIdentifierEnum; label: string }) => opt.value === condition.identifier + ); const handleTypeChange = (newType: { value: ConditionIdentifierEnum; label: string } | null) => { if (!newType) return; @@ -127,7 +129,9 @@ interface TeamConditionFieldsProps { const TeamConditionFields = ({ condition, onChange, teamOptions, isLoading }: TeamConditionFieldsProps) => { const { t } = useLocale(); const teamOperatorOptions = getTeamOperatorOptions(t); - const operatorOption = teamOperatorOptions.find((opt: { value: ConditionOperatorEnum; label: string }) => opt.value === condition.operator); + const operatorOption = teamOperatorOptions.find( + (opt: { value: ConditionOperatorEnum; label: string }) => opt.value === condition.operator + ); const isMulti = isArrayOperator(condition.operator); const selectedTeams = isMulti @@ -222,7 +226,9 @@ const AttributeConditionFields = ({ ? getOperatorOptionsForAttributeType(selectedAttribute.type, t) : []; - const operatorOption = operatorOptions.find((opt: { value: ConditionOperatorEnum; label: string }) => opt.value === condition.operator); + const operatorOption = operatorOptions.find( + (opt: { value: ConditionOperatorEnum; label: string }) => opt.value === condition.operator + ); const handleAttributeChange = (selected: { value: string; label: string } | null) => { if (!selected) return; @@ -309,7 +315,9 @@ const AttributeConditionFields = ({ })); const selectedValues = isMulti - ? valueOptions.filter((opt: { value: string; label: string }) => condition.value.includes(opt.value)) + ? valueOptions.filter((opt: { value: string; label: string }) => + condition.value.includes(opt.value) + ) : valueOptions.find((opt: { value: string; label: string }) => condition.value[0] === opt.value); return ( @@ -402,7 +410,9 @@ export const RuleBuilder = ({ }: RuleBuilderProps) => { const { t } = useLocale(); const parentOperatorOptions = getParentOperatorOptions(t); - const parentOperatorOption = parentOperatorOptions.find((opt: { value: RuleOperatorEnum; label: string }) => opt.value === value.operator); + const parentOperatorOption = parentOperatorOptions.find( + (opt: { value: RuleOperatorEnum; label: string }) => opt.value === value.operator + ); const isLoading = isLoadingTeams || isLoadingAttributes; const handleOperatorChange = (newOperator: { value: RuleOperatorEnum; label: string } | null) => { @@ -442,7 +452,9 @@ export const RuleBuilder = ({
    - {t("attribute_sync_user_filter_rules")} + + {t("attribute_sync_user_filter_rules")} +
    @@ -460,9 +472,7 @@ export const RuleBuilder = ({
    {value.conditions.length === 0 ? ( -
    - {t("attribute_sync_no_conditions")} -
    +
    {t("attribute_sync_no_conditions")}
    ) : ( value.conditions.map((condition: TAttributeSyncRuleCondition, index: number) => { const conditionWithId = ensureConditionHasId(condition); diff --git a/apps/web/modules/notifications/hooks/useWebPush.ts b/apps/web/modules/notifications/hooks/useWebPush.ts index 903da9852b..72443968b4 100644 --- a/apps/web/modules/notifications/hooks/useWebPush.ts +++ b/apps/web/modules/notifications/hooks/useWebPush.ts @@ -8,4 +8,4 @@ export function useWebPush() { throw new Error("useWebPush must be used within a WebPushProvider"); } return context; -} \ No newline at end of file +} diff --git a/apps/web/modules/onboarding/components/RoleSelector.tsx b/apps/web/modules/onboarding/components/RoleSelector.tsx index 207f107a98..e306cdb7a8 100644 --- a/apps/web/modules/onboarding/components/RoleSelector.tsx +++ b/apps/web/modules/onboarding/components/RoleSelector.tsx @@ -29,10 +29,7 @@ export const RoleSelector = ({ value, onValueChange, showInfoBadge = false }: Ro /> {showInfoBadge && }
    - {!showInfoBadge && ( - {t("onboarding_modify_roles_later")} - )} + {!showInfoBadge && {t("onboarding_modify_roles_later")}}
    ); }; - diff --git a/apps/web/modules/onboarding/components/onboarding-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-browser-view.tsx index 605bb347a0..d448cb3eeb 100644 --- a/apps/web/modules/onboarding/components/onboarding-browser-view.tsx +++ b/apps/web/modules/onboarding/components/onboarding-browser-view.tsx @@ -135,12 +135,7 @@ export const OnboardingBrowserView = ({
    {avatar && ( - + )}

    diff --git a/apps/web/modules/onboarding/components/onboarding-calendar-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-calendar-browser-view.tsx index 614d8a8c67..906c419246 100644 --- a/apps/web/modules/onboarding/components/onboarding-calendar-browser-view.tsx +++ b/apps/web/modules/onboarding/components/onboarding-calendar-browser-view.tsx @@ -75,7 +75,7 @@ export const OnboardingCalendarBrowserView = () => { onEmptyCellClick: () => {}, onDateChange: () => {}, showTimezone: true, - } satisfies CalendarComponentProps), + }) satisfies CalendarComponentProps, [startDate, endDate, events, hours] ); diff --git a/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx index d90ade065f..29eb63a3ae 100644 --- a/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx +++ b/apps/web/modules/onboarding/components/onboarding-invite-browser-view.tsx @@ -207,22 +207,12 @@ export const OnboardingInviteBrowserView = ({ {/* Organization Avatar - Overlaying the banner */} {useOrganizationInvites && avatar && (
    - +
    )} {!useOrganizationInvites && organizationBrand.banner && avatar && (
    - +
    )}

    diff --git a/apps/web/modules/onboarding/components/onboarding-migrate-members-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-migrate-members-browser-view.tsx index c1327ca419..25c989353d 100644 --- a/apps/web/modules/onboarding/components/onboarding-migrate-members-browser-view.tsx +++ b/apps/web/modules/onboarding/components/onboarding-migrate-members-browser-view.tsx @@ -186,4 +186,3 @@ export const OnboardingMigrateMembersBrowserView = ({
    ); }; - diff --git a/apps/web/modules/onboarding/components/onboarding-migrate-teams-browser-view.tsx b/apps/web/modules/onboarding/components/onboarding-migrate-teams-browser-view.tsx index 5fbe4f84dd..7be5f24145 100644 --- a/apps/web/modules/onboarding/components/onboarding-migrate-teams-browser-view.tsx +++ b/apps/web/modules/onboarding/components/onboarding-migrate-teams-browser-view.tsx @@ -188,4 +188,3 @@ export const OnboardingMigrateTeamsBrowserView = ({
    ); }; - diff --git a/apps/web/modules/onboarding/hooks/useCreateTeam.ts b/apps/web/modules/onboarding/hooks/useCreateTeam.ts index c635f9331a..6bdfba2452 100644 --- a/apps/web/modules/onboarding/hooks/useCreateTeam.ts +++ b/apps/web/modules/onboarding/hooks/useCreateTeam.ts @@ -13,7 +13,11 @@ type UseCreateTeamOptions = { }; export function useCreateTeam(options: UseCreateTeamOptions = {}) { - const { redirectBasePath = "/onboarding/teams", skipRedirectAfterInvite = false, isOnboarding = true } = options; + const { + redirectBasePath = "/onboarding/teams", + skipRedirectAfterInvite = false, + isOnboarding = true, + } = options; const router = useRouter(); const [isSubmitting, setIsSubmitting] = useState(false); const flags = useFlagMap(); diff --git a/apps/web/modules/onboarding/hooks/useMigrationFlow.ts b/apps/web/modules/onboarding/hooks/useMigrationFlow.ts index 92a79f4053..1a9617c41d 100644 --- a/apps/web/modules/onboarding/hooks/useMigrationFlow.ts +++ b/apps/web/modules/onboarding/hooks/useMigrationFlow.ts @@ -21,4 +21,3 @@ export const useMigrationFlow = () => { isLoading, }; }; - diff --git a/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts b/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts index 0c172b18d8..8b7529292f 100644 --- a/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts +++ b/apps/web/modules/onboarding/hooks/useSubmitOnboarding.ts @@ -55,9 +55,7 @@ export const useSubmitOnboarding = () => { let teamName: string | undefined = undefined; if (invite.team && invite.team.trim().length > 0) { - const matchingTeam = teams.find( - (team) => team.name.toLowerCase() === invite.team.toLowerCase() - ); + const matchingTeam = teams.find((team) => team.name.toLowerCase() === invite.team.toLowerCase()); if (matchingTeam?.isBeingMigrated && matchingTeam.id !== -1) { // Use team ID for migrated teams teamId = matchingTeam.id; @@ -111,7 +109,7 @@ export const useSubmitOnboarding = () => { showToast("Organization created successfully!", "success"); // Set flag to show welcome modal after redirect setShowNewOrgModalFlag(); - + // Check if this is a migration flow (user has already completed onboarding) const hasMigratedTeams = teams.some((team) => team.isBeingMigrated); if (hasMigratedTeams) { diff --git a/apps/web/modules/onboarding/organization/migrate-teams/utils.ts b/apps/web/modules/onboarding/organization/migrate-teams/utils.ts index a3f1e1c6a1..8780f987a9 100644 --- a/apps/web/modules/onboarding/organization/migrate-teams/utils.ts +++ b/apps/web/modules/onboarding/organization/migrate-teams/utils.ts @@ -12,4 +12,3 @@ export const getSuggestedSlug = ({ return teamSlug.replace(`${orgSlug}-`, "").replace(`-${orgSlug}`, ""); }; - diff --git a/apps/web/modules/onboarding/store/onboarding-store.ts b/apps/web/modules/onboarding/store/onboarding-store.ts index a45ff0f618..4245001864 100644 --- a/apps/web/modules/onboarding/store/onboarding-store.ts +++ b/apps/web/modules/onboarding/store/onboarding-store.ts @@ -98,7 +98,9 @@ export interface OnboardingState { setInviteRole: (role: InviteRole) => void; // Migration actions - setMigratedMembers: (members: { email: string; name?: string; teamId: number; role: "MEMBER" | "ADMIN" }[]) => void; + setMigratedMembers: ( + members: { email: string; name?: string; teamId: number; role: "MEMBER" | "ADMIN" }[] + ) => void; // Team actions setTeamDetails: (details: Partial) => void; @@ -204,7 +206,7 @@ export const useOnboardingStore = create()( { name: "cal-onboarding-storage", // Storage key storage: onboardingIndexedDBStorage, // Use IndexedDB instead of localStorage for larger capacity - // Version 0: Had issue with Image sizes being too large. + // Version 0: Had issue with Image sizes being too large. // Version 1: We fixed that and also migrated to version-1 to facilitate one-time cleanup of all oversized images. version: 1, migrate: (persistedState, version) => { diff --git a/apps/web/modules/schedules/components/Schedule.tsx b/apps/web/modules/schedules/components/Schedule.tsx index e8cae81dfd..261aebc8f3 100644 --- a/apps/web/modules/schedules/components/Schedule.tsx +++ b/apps/web/modules/schedules/components/Schedule.tsx @@ -11,7 +11,7 @@ import type { TimeRange } from "@calcom/types/schedule"; const Schedule = < TFieldValues extends FieldValues, - TPath extends FieldPathByValue + TPath extends FieldPathByValue, >(props: { name: TPath; control: Control; diff --git a/apps/web/modules/schedules/hooks/useNonEmptyScheduleDays.ts b/apps/web/modules/schedules/hooks/useNonEmptyScheduleDays.ts index 7771e665bc..5af5225183 100644 --- a/apps/web/modules/schedules/hooks/useNonEmptyScheduleDays.ts +++ b/apps/web/modules/schedules/hooks/useNonEmptyScheduleDays.ts @@ -8,7 +8,11 @@ const getNonEmptyScheduleDays = (slots?: Slots) => { const nonEmptyDays: string[] = []; Object.keys(slots).forEach((date) => { - if (slots[date].some((slot) => !(slot?.away && !slot.toUser && !slot.showNotePublicly) && slots[date].length > 0)) { + if ( + slots[date].some( + (slot) => !(slot?.away && !slot.toUser && !slot.showNotePublicly) && slots[date].length > 0 + ) + ) { nonEmptyDays.push(date); } }); diff --git a/apps/web/modules/schedules/hooks/useSchedule.ts b/apps/web/modules/schedules/hooks/useSchedule.ts index e89a58471b..53f01ba841 100644 --- a/apps/web/modules/schedules/hooks/useSchedule.ts +++ b/apps/web/modules/schedules/hooks/useSchedule.ts @@ -166,10 +166,7 @@ export const useSchedule = ({ }); if (teamScheduleV2.isSuccess && eventId && eventSlug) { - sdkActionManager?.fire( - "availabilityLoaded", - getAvailabilityLoadedEventPayload({ eventId, eventSlug }) - ); + sdkActionManager?.fire("availabilityLoaded", getAvailabilityLoadedEventPayload({ eventId, eventSlug })); } return { @@ -189,10 +186,7 @@ export const useSchedule = ({ }); if (schedule.isSuccess && eventId && eventSlug) { - sdkActionManager?.fire( - "availabilityLoaded", - getAvailabilityLoadedEventPayload({ eventId, eventSlug }) - ); + sdkActionManager?.fire("availabilityLoaded", getAvailabilityLoadedEventPayload({ eventId, eventSlug })); } return { diff --git a/apps/web/modules/settings/admin/oauth-clients-admin-view.tsx b/apps/web/modules/settings/admin/oauth-clients-admin-view.tsx index 2eeeaba2cc..6fc5599006 100644 --- a/apps/web/modules/settings/admin/oauth-clients-admin-view.tsx +++ b/apps/web/modules/settings/admin/oauth-clients-admin-view.tsx @@ -22,15 +22,19 @@ export default function OAuthClientsAdminView() { const [createdClient, setCreatedClient] = useState(null); const [selectedClient, setSelectedClient] = useState(null); - const { data: pendingClients, isLoading: isPendingClientsLoading } = trpc.viewer.oAuth.listClients.useQuery({ - status: "PENDING", - }); - const { data: rejectedClients, isLoading: isRejectedClientsLoading } = trpc.viewer.oAuth.listClients.useQuery({ - status: "REJECTED", - }); - const { data: approvedClients, isLoading: isApprovedClientsLoading } = trpc.viewer.oAuth.listClients.useQuery({ - status: "APPROVED", - }); + const { data: pendingClients, isLoading: isPendingClientsLoading } = trpc.viewer.oAuth.listClients.useQuery( + { + status: "PENDING", + } + ); + const { data: rejectedClients, isLoading: isRejectedClientsLoading } = + trpc.viewer.oAuth.listClients.useQuery({ + status: "REJECTED", + }); + const { data: approvedClients, isLoading: isApprovedClientsLoading } = + trpc.viewer.oAuth.listClients.useQuery({ + status: "APPROVED", + }); const createMutation = trpc.viewer.oAuth.createClient.useMutation({ onSuccess: async (data) => { @@ -53,10 +57,7 @@ export default function OAuthClientsAdminView() { const updateStatusMutation = trpc.viewer.oAuth.updateClient.useMutation({ onSuccess: async (data) => { - showToast( - t("oauth_client_status_updated", { name: data.name, status: data.status }), - "success" - ); + showToast(t("oauth_client_status_updated", { name: data.name, status: data.status }), "success"); setSelectedClient((prev) => { if (!prev) return prev; @@ -100,7 +101,11 @@ export default function OAuthClientsAdminView() { }; const handleReject = (input: { clientId: string; rejectionReason: string }) => { - updateStatusMutation.mutate({ clientId: input.clientId, status: "REJECTED", rejectionReason: input.rejectionReason }); + updateStatusMutation.mutate({ + clientId: input.clientId, + status: "REJECTED", + rejectionReason: input.rejectionReason, + }); }; if (isPendingClientsLoading || isRejectedClientsLoading || isApprovedClientsLoading) { @@ -108,9 +113,7 @@ export default function OAuthClientsAdminView() { } return ( - +

    {t("pending")}

    diff --git a/apps/web/modules/settings/billing/components/BillingCredits.tsx b/apps/web/modules/settings/billing/components/BillingCredits.tsx index 5bd0c8a8f7..62ab5be13b 100644 --- a/apps/web/modules/settings/billing/components/BillingCredits.tsx +++ b/apps/web/modules/settings/billing/components/BillingCredits.tsx @@ -41,13 +41,7 @@ type CreditRowProps = { className?: string; }; -const CreditRow = ({ - label, - value, - isBold = false, - underline, - className = "", -}: CreditRowProps) => { +const CreditRow = ({ label, value, isBold = false, underline, className = "" }: CreditRowProps) => { const numberFormatter = new Intl.NumberFormat(); return (
    + )}> + className={classNames("text-sm", isBold ? "font-semibold" : "font-medium leading-tight text-subtle")}> {label} + className={classNames(`text-sm`, isBold ? "font-semibold" : "font-medium leading-tight text-subtle")}> {numberFormatter.format(value)}
    @@ -87,10 +72,7 @@ const getMonthOptions = (): MonthOption[] => { let date = dayjs.utc(); let count = 0; - while ( - (date.isAfter(minDate) || date.isSame(minDate, "month")) && - count < 12 - ) { + while ((date.isAfter(minDate) || date.isSame(minDate, "month")) && count < 12) { const startDate = date.startOf("month"); const endDate = date.endOf("month"); options.push({ @@ -113,12 +95,9 @@ export default function BillingCredits() { const session = useSession(); const orgBranding = useOrgBranding(); const monthOptions = useMemo(() => getMonthOptions(), []); - const [selectedMonth, setSelectedMonth] = useState( - monthOptions[0] - ); + const [selectedMonth, setSelectedMonth] = useState(monthOptions[0]); const [isDownloading, setIsDownloading] = useState(false); - const [showMemberInvitationModal, setShowMemberInvitationModal] = - useState(false); + const [showMemberInvitationModal, setShowMemberInvitationModal] = useState(false); const utils = trpc.useUtils(); const { @@ -136,31 +115,24 @@ export default function BillingCredits() { const teamId: number | undefined = Number.isFinite(parsedTeamId) ? parsedTeamId : typeof orgId === "number" - ? orgId - : undefined; + ? orgId + : undefined; const tokens = (pathname ?? "").split("/").filter(Boolean); const settingsIndex = tokens.indexOf("settings"); const isOrgScopedPath = - settingsIndex >= 0 && - ["organizations", "teams"].includes(tokens[settingsIndex + 1]); + settingsIndex >= 0 && ["organizations", "teams"].includes(tokens[settingsIndex + 1]); - const shouldRender = - IS_SMS_CREDITS_ENABLED && - !(orgId && !isOrgScopedPath && !orgBranding?.slug); + const shouldRender = IS_SMS_CREDITS_ENABLED && !(orgId && !isOrgScopedPath && !orgBranding?.slug); - const { data: creditsData, isLoading } = - trpc.viewer.credits.getAllCredits.useQuery( - { teamId }, - { enabled: shouldRender } - ); - - const { data: teamPlanData } = trpc.viewer.teams.hasTeamPlan.useQuery( - undefined, - { - enabled: shouldRender && !teamId, - } + const { data: creditsData, isLoading } = trpc.viewer.credits.getAllCredits.useQuery( + { teamId }, + { enabled: shouldRender } ); + + const { data: teamPlanData } = trpc.viewer.teams.hasTeamPlan.useQuery(undefined, { + enabled: shouldRender && !teamId, + }); const isUserInTeam = teamPlanData?.hasTeamPlan ?? false; if (!shouldRender) return null; @@ -185,9 +157,7 @@ export default function BillingCredits() { endDate: selectedMonth.endDate, }); if (result?.csvData) { - const filename = `credit-expense-log-${selectedMonth.value - .toLowerCase() - .replace(" ", "-")}.csv`; + const filename = `credit-expense-log-${selectedMonth.value.toLowerCase().replace(" ", "-")}.csv`; downloadAsCsv(result.csvData, filename); } else { showToast(t("error_downloading_expense_log"), "error"); @@ -214,20 +184,15 @@ export default function BillingCredits() { const totalCredits = creditsData.credits.totalMonthlyCredits ?? 0; const totalUsed = creditsData.credits.totalCreditsUsedThisMonth ?? 0; - const teamCreditsPercentageUsed = - totalCredits > 0 ? (totalUsed / totalCredits) * 100 : 0; + const teamCreditsPercentageUsed = totalCredits > 0 ? (totalUsed / totalCredits) * 100 : 0; const numberFormatter = new Intl.NumberFormat(); return ( <>
    -

    - {t("credits")} -

    -

    - {t("view_and_manage_credits")} -

    +

    {t("credits")}

    +

    {t("view_and_manage_credits")}

    @@ -240,33 +205,20 @@ export default function BillingCredits() { isBold={true} underline="dashed" /> - +
    - +
    {/*750 credits per tip*/}

    - {orgSlug - ? t("credits_per_tip_org") - : t("credits_per_tip_teams")} + {orgSlug ? t("credits_per_tip_org") : t("credits_per_tip_teams")}

    -
    @@ -290,12 +242,8 @@ export default function BillingCredits() {

    - - {t("current_balance")} - {" "} - {numberFormatter.format( - creditsData.credits.additionalCredits - )} + {t("current_balance")}{" "} + {numberFormatter.format(creditsData.credits.additionalCredits)}

    @@ -304,10 +252,7 @@ export default function BillingCredits() {
    {/* Users who are part of a team cannot buy personal credits */} {teamId || !isUserInTeam ? ( - + - setValue("quantity", Number(e.target.value)) - } + onChange={(e) => setValue("quantity", Number(e.target.value))} min={50} addOnSuffix={<>{t("credits")}} /> @@ -333,17 +276,12 @@ export default function BillingCredits() { target="_blank" size="sm" type="submit" - data-testid="buy-credits" - > + data-testid="buy-credits"> {t("buy")} ) : null} - {errors.quantity && ( - - )} + {errors.quantity && }
    @@ -367,12 +305,7 @@ export default function BillingCredits() {
    -
    diff --git a/apps/web/modules/settings/billing/components/InvoicesTable.tsx b/apps/web/modules/settings/billing/components/InvoicesTable.tsx index b061ca4438..cc4ceabe16 100644 --- a/apps/web/modules/settings/billing/components/InvoicesTable.tsx +++ b/apps/web/modules/settings/billing/components/InvoicesTable.tsx @@ -143,7 +143,10 @@ function InvoicesTableContent() { }; return ( - } className="mt-5"> + } + className="mt-5"> {!data?.invoices.length && currentPage === 0 ? (
    {t("no_invoices_in_date_range")}
    ) : ( diff --git a/apps/web/modules/settings/developer/oauth-clients-view.tsx b/apps/web/modules/settings/developer/oauth-clients-view.tsx index 3cbcd0fc37..35a6711e85 100644 --- a/apps/web/modules/settings/developer/oauth-clients-view.tsx +++ b/apps/web/modules/settings/developer/oauth-clients-view.tsx @@ -105,7 +105,10 @@ const OAuthClientsView = () => { } const newOAuthClientButton = ( - setIsCreatingClient(true)} /> + setIsCreatingClient(true)} + /> ); return ( @@ -140,7 +143,8 @@ const OAuthClientsView = () => { className="rounded-b-lg rounded-t-none border-t-0" buttonRaw={newOAuthClientButton} /> - )}
    + )} +
    {submittedClient ? (