From 464343f5abb1dbc95560498ca7c7a9bfe5a32480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Thu, 28 Jul 2022 13:58:26 -0600 Subject: [PATCH] Refactors EE code (#3490) * WIP * WIP * Type and migration fixes * Adds missing default import * Fixes import * Fixes tRPC imports in App Store * Migrate stripe helpers * WIP * Type fixes * Type fix? * WIP * WIP * Update index.ts * Fixes * Update workflow.tsx * Moved queries to lib * Moves QueryCell * Migrates MultiSelectCheckboxes * WIP * CryptoSection type fixes * WIP * Import fixes * Build fixes * Update app-providers.tsx * Build fixes * Upgrades hookform zod resolvers * Build fixes * Cleanup * Build fixes * Relocates QueryCell to ui * Moved List and SkeletonLoader * Revert QueryCell migration * Can't use QueryCell here * oops * CryptoSection cleanup * Update app-providers.tsx * Moved ee to features * ee to features/ee * Removes @calcom/ee * Adds possible feature locations * Build fixes * Migrates stripe to app-store lib * Colocates stripe imports * Update subscription.ts * Submodule sync Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/api | 2 +- apps/console | 2 +- apps/web/components/App.tsx | 7 +- apps/web/components/SettingsShell.tsx | 5 +- apps/web/components/apps/AppCard.tsx | 3 +- apps/web/components/auth/SAMLLogin.tsx | 2 +- apps/web/components/booking/CancelBooking.tsx | 7 +- apps/web/components/booking/TimeOptions.tsx | 3 +- .../booking/pages/AvailabilityPage.tsx | 8 +- .../components/booking/pages/BookingPage.tsx | 16 +- .../components/dialog/EditLocationDialog.tsx | 12 +- .../eventtype/RecurringEventController.tsx | 2 +- .../integrations/CalendarListContainer.tsx | 6 +- .../integrations/DisconnectIntegration.tsx | 4 +- .../integrations/IntegrationListItem.tsx | 4 +- .../SubHeadingTitleWithConnections.tsx | 2 +- .../security/DisableUserImpersonation.tsx | 3 +- .../security/TwoFactorAuthSection.tsx | 3 +- .../team/DisableTeamImpersonation.tsx | 3 +- apps/web/components/team/MemberListItem.tsx | 4 +- .../team/SkeletonloaderTeamList.tsx | 6 +- apps/web/components/team/TeamListItem.tsx | 7 +- .../team/TeamSettingsRightSidebar.tsx | 2 +- apps/web/components/ui/form/Select.tsx | 4 +- .../webhook/WebhookListContainer.tsx | 6 +- .../components/webhook/WebhookListItem.tsx | 5 +- apps/web/ee/LICENSE | 42 --- apps/web/ee/README.md | 38 --- .../ee/components/support/ContactMenuItem.tsx | 13 - apps/web/lib/QueryCell.tsx | 5 +- apps/web/lib/app-providers.tsx | 37 ++- apps/web/lib/asStringOrNull.tsx | 5 + apps/web/lib/clock.ts | 3 +- apps/web/lib/core/i18n/i18n.utils.ts | 2 +- apps/web/lib/getting-started.tsx | 16 -- apps/web/lib/locationOptions.tsx | 36 --- apps/web/lib/parseDate.ts | 5 +- apps/web/lib/webhooks/subscriptions.tsx | 2 +- apps/web/middleware.ts | 2 +- apps/web/next.config.js | 3 +- apps/web/package.json | 7 +- apps/web/pages/[user].tsx | 13 +- apps/web/pages/[user]/book.tsx | 2 +- apps/web/pages/_app.tsx | 63 ++-- apps/web/pages/api/auth/[...nextauth].tsx | 6 +- apps/web/pages/api/auth/changepw.ts | 3 +- apps/web/pages/api/auth/reset-password.ts | 3 +- apps/web/pages/api/auth/signup.ts | 3 +- .../pages/api/auth/two-factor/totp/disable.ts | 3 +- .../pages/api/auth/two-factor/totp/enable.ts | 2 +- .../pages/api/auth/two-factor/totp/setup.ts | 2 +- apps/web/pages/api/availability/calendar.ts | 2 +- apps/web/pages/api/book/confirm.ts | 4 +- apps/web/pages/api/book/event.ts | 7 +- apps/web/pages/api/book/request-reschedule.ts | 4 +- apps/web/pages/api/cancel.ts | 18 +- apps/web/pages/api/collect-events.ts | 2 +- .../cron/workflows/scheduleEmailReminders.ts | 2 +- .../cron/workflows/scheduleSMSReminders.ts | 2 +- apps/web/pages/api/event-type/index.ts | 3 +- apps/web/pages/api/eventType.ts | 2 +- apps/web/pages/api/integrations.ts | 3 +- .../api/integrations/stripepayment/webhook.ts | 2 +- apps/web/pages/api/me.ts | 3 +- apps/web/pages/api/schedule/index.ts | 3 +- apps/web/pages/api/teams.ts | 3 +- apps/web/pages/api/teams/[team]/index.ts | 2 +- apps/web/pages/api/teams/[team]/invite.ts | 2 +- apps/web/pages/api/teams/[team]/membership.ts | 3 +- apps/web/pages/api/teams/[team]/profile.ts | 3 +- apps/web/pages/api/teams/[team]/upgrade.ts | 2 +- apps/web/pages/api/upgrade.ts | 4 +- apps/web/pages/api/user/[id].ts | 3 +- apps/web/pages/api/user/avatar.ts | 5 +- apps/web/pages/api/user/me.ts | 4 +- apps/web/pages/api/user/membership.ts | 3 +- apps/web/pages/api/user/profile.ts | 3 +- apps/web/pages/apps/categories/[category].tsx | 2 +- apps/web/pages/apps/categories/index.tsx | 2 +- apps/web/pages/apps/index.tsx | 2 +- apps/web/pages/apps/installed.tsx | 8 +- apps/web/pages/auth/login.tsx | 2 +- apps/web/pages/auth/signup.tsx | 2 +- apps/web/pages/auth/sso/[provider].tsx | 6 +- apps/web/pages/availability/[schedule].tsx | 6 +- apps/web/pages/availability/index.tsx | 2 +- apps/web/pages/availability/troubleshoot.tsx | 2 +- apps/web/pages/bookings/[status].tsx | 2 +- apps/web/pages/cancel/[uid].tsx | 4 +- apps/web/pages/d/[link]/[slug].tsx | 2 +- apps/web/pages/d/[link]/book.tsx | 2 +- apps/web/pages/event-types/[type].tsx | 10 +- apps/web/pages/event-types/index.tsx | 6 +- apps/web/pages/getting-started.tsx | 8 +- apps/web/pages/payment/[uid].tsx | 7 +- apps/web/pages/sandbox/Badge.tsx | 2 +- apps/web/pages/sandbox/List.tsx | 3 +- apps/web/pages/settings/developer.tsx | 2 +- apps/web/pages/settings/profile.tsx | 6 +- apps/web/pages/settings/security.tsx | 2 +- .../settings/teams/[id]/availability.tsx | 2 +- apps/web/pages/settings/teams/[id]/index.tsx | 6 +- apps/web/pages/success.tsx | 9 +- apps/web/pages/team/[slug].tsx | 6 +- apps/web/pages/team/[slug]/[type].tsx | 2 +- apps/web/pages/team/[slug]/book.tsx | 2 +- apps/web/pages/video/meeting-ended/[uid].tsx | 2 +- .../pages/video/meeting-not-started/[uid].tsx | 3 +- apps/web/pages/workflows/[workflow].tsx | 2 +- apps/web/pages/workflows/index.tsx | 2 +- apps/web/playwright/auth/auth-index.test.ts | 3 +- apps/web/playwright/change-username.test.ts | 7 +- apps/web/playwright/lib/teardown.ts | 2 +- apps/web/playwright/onboarding.test.ts | 2 +- apps/web/playwright/reschedule.test.ts | 2 +- apps/web/public/apps/metamask.svg | 61 ---- apps/web/tsconfig.json | 1 - apps/website | 2 +- package.json | 1 + packages/app-store/_utils/getCalendar.ts | 2 +- .../routing_forms/components/RoutingShell.tsx | 2 +- .../ee/routing_forms/components/SideBar.tsx | 3 +- .../pages/forms/[...appPages].tsx | 3 +- .../pages/routing-link/[...appPages].tsx | 3 +- .../playwright/config/globalSetup.ts | 3 +- .../playwright/config/globalTeardown.ts | 2 +- packages/app-store/locations.ts | 35 +++ packages/app-store/package.json | 7 +- .../app-store/stripepayment/api/callback.ts | 3 +- .../app-store/stripepayment/api/portal.ts | 4 +- .../stripepayment/api/subscription.ts | 9 +- .../lib/client/createPaymentLink.ts | 17 ++ .../stripepayment/lib/client/getStripe.ts} | 15 - .../stripepayment/lib/client/index.ts | 2 + .../stripepayment/lib}/constants.ts | 0 .../stripepayment/lib}/customer.ts | 3 +- .../stripepayment/lib}/downgrade.ts | 2 +- .../stripepayment/lib}/index.ts | 0 .../stripepayment/lib}/server.ts | 2 +- .../stripepayment/lib}/subscriptions.ts | 3 +- .../stripepayment/lib}/team-billing.ts | 2 +- .../stripepayment/lib}/utils.ts | 0 packages/app-store/stripepayment/package.json | 19 +- packages/app-store/tsconfig.json | 1 - packages/app-store/vital/lib/reschedule.ts | 2 +- .../wipemycalother/lib/reschedule.ts | 2 +- .../api/subscriptions/addSubscription.ts | 2 +- .../api/subscriptions/deleteSubscription.ts | 2 +- .../zapier/api/subscriptions/listBookings.ts | 2 +- .../app-store/zapier/api/subscriptions/me.ts | 2 +- .../core/builders/CalendarEvent/builder.ts | 2 +- packages/core/builders/CalendarEvent/class.ts | 2 +- packages/ee/index.ts | 1 - packages/ee/tsconfig.json | 8 - packages/emails/src/components/WhenInfo.tsx | 2 +- .../embed-core/playwright/lib/testUtils.ts | 2 +- packages/features/auth/README.md | 1 + packages/features/availability/README.md | 4 + packages/features/bookings/README.md | 1 + packages/features/calendars/README.md | 4 + packages/features/conferencing/README.md | 3 + packages/{ => features}/ee/LICENSE | 0 packages/{ => features}/ee/README.md | 0 .../api-keys/components}/ApiKeyDialogForm.tsx | 5 +- .../components}/ApiKeyListContainer.tsx | 28 +- .../api-keys/components}/ApiKeyListItem.tsx | 7 +- .../ee/api-keys/lib}/apiKeys.ts | 0 .../ee/api-keys/lib}/findValidApiKey.ts | 2 +- .../ee/common}/components/LicenseBanner.tsx | 3 +- .../ee/common}/components/LicenseRequired.tsx | 15 +- .../common/components/SamlConfiguration.tsx | 10 +- .../ee/common}/components/TrialBanner.tsx | 0 .../ee/common/lib}/checkPremiumUsername.ts | 0 .../ee/common}/server/checkLicense.ts | 0 .../components}/ImpersonatingBanner.tsx | 0 .../lib}/ImpersonationProvider.ts | 3 +- packages/features/ee/index.ts | 1 + packages/{ => features}/ee/package.json | 11 +- .../features/ee/payments/api}/webhook.ts | 4 +- .../ee/payments/components}/Payment.tsx | 2 +- .../ee/payments/components}/PaymentPage.tsx | 14 +- .../features/ee/payments/pages/payment.tsx | 16 +- .../ee/support/components/ContactMenuItem.tsx | 13 + .../ee/support/components}/HelpMenuItem.tsx | 3 +- .../lib/helpscout/HelpscoutMenuItem.tsx | 0 .../ee/support}/lib/helpscout/provider.tsx | 0 .../lib/helpscout/providerDynamic.tsx | 0 .../lib/intercom/IntercomMenuItem.tsx | 0 .../ee/support}/lib/intercom/provider.tsx | 0 .../support}/lib/intercom/providerDynamic.tsx | 0 .../ee/support}/lib/intercom/useIntercom.ts | 0 .../support}/lib/zendesk/ZendeskMenuItem.tsx | 0 .../features/ee/teams/api}/upgrade.ts | 5 +- .../components}/TeamAvailabilityModal.tsx | 12 +- .../components}/TeamAvailabilityScreen.tsx | 10 +- .../components}/TeamAvailabilityTimes.tsx | 3 +- .../features/ee/teams/pages}/availability.tsx | 17 +- .../ee}/web3/abis/abiWithGetBalance.json | 0 .../ee/web3/components}/CryptoSection.tsx | 45 ++- .../ee/web3}/contexts/contractsContext.tsx | 0 .../features/ee}/web3/utils/verifyAccount.ts | 0 .../workflows/api}/scheduleEmailReminders.ts | 6 +- .../ee/workflows/api}/scheduleSMSReminders.ts | 8 +- .../workflows/components}/AddActionDialog.tsx | 8 +- .../components}/NewWorkflowButton.tsx | 17 +- .../components}/WorkflowDetailsPage.tsx | 10 +- .../components}/WorkflowListPage.tsx | 6 +- .../components}/WorkflowStepContainer.tsx | 11 +- .../features/ee/workflows/lib}/constants.ts | 13 +- .../features/ee/workflows/lib}/getOptions.ts | 7 +- .../lib}/reminders/emailReminderManager.ts | 5 +- .../lib}/reminders/reminderScheduler.ts | 9 +- .../reminders/smsProviders/twilioProvider.ts | 0 .../lib}/reminders/smsReminderManager.ts | 5 +- .../templates/emailReminderTemplate.ts | 0 .../templates/smsReminderTemplate.ts | 0 .../features/ee/workflows/pages}/index.tsx | 13 +- .../features/ee/workflows/pages/workflow.tsx | 70 ++--- packages/features/index.ts | 1 + packages/features/links/README.md | 3 + packages/features/package.json | 8 + packages/features/tsconfig.json | 12 + packages/features/users/README.md | 1 + .../lib/getPlaceholderAvatar.tsx | 0 {apps/web => packages}/lib/hooks/useTheme.tsx | 0 packages/lib/index.ts | 1 + packages/lib/recurringStrings.ts | 2 +- packages/lib/server/checkUsername.ts | 2 +- {apps/web => packages}/lib/telemetry.ts | 6 +- {apps/web => packages}/lib/timeFormat.ts | 0 packages/stripe/LICENSE | 42 --- packages/stripe/README.md | 38 --- packages/stripe/package.json | 35 --- packages/stripe/tsconfig.json | 8 - packages/trpc/react/hooks/useMeQuery.ts | 13 + packages/trpc/server/routers/viewer.tsx | 2 +- .../trpc/server/routers/viewer/apiKeys.tsx | 2 +- .../trpc/server/routers/viewer/eventTypes.tsx | 2 +- packages/trpc/server/routers/viewer/teams.tsx | 16 +- .../trpc/server/routers/viewer/workflows.tsx | 6 +- .../web/components => packages}/ui/Badge.tsx | 2 +- .../ui}/ConfirmationDialogContent.tsx | 0 packages/ui/CustomBranding.tsx | 269 ++++++++++++++++++ .../web/lib => packages/ui}/ErrorBoundary.tsx | 0 {apps/web/components => packages/ui}/Kbar.tsx | 0 {apps/web/components => packages/ui}/List.tsx | 2 +- {apps/web/components => packages/ui}/Logo.tsx | 0 .../web/components => packages/ui}/Shell.tsx | 72 +++-- .../ui}/apps/SkeletonLoader.tsx | 5 +- .../ui/form/MultiSelectCheckboxes.tsx | 3 +- .../ui/form/PhoneInput.tsx | 0 packages/ui/form/PhoneInputLazy.tsx | 8 + .../ui/form/TimezoneSelect.tsx | 2 +- packages/ui/package.json | 6 +- packages/ui/tsconfig.json | 3 + packages/ui/v2/index.tsx | 37 ++- yarn.lock | 13 +- 257 files changed, 1000 insertions(+), 968 deletions(-) delete mode 100644 apps/web/ee/LICENSE delete mode 100644 apps/web/ee/README.md delete mode 100644 apps/web/ee/components/support/ContactMenuItem.tsx delete mode 100644 apps/web/lib/getting-started.tsx delete mode 100644 apps/web/lib/locationOptions.tsx delete mode 100644 apps/web/public/apps/metamask.svg create mode 100644 packages/app-store/stripepayment/lib/client/createPaymentLink.ts rename packages/{stripe/client.ts => app-store/stripepayment/lib/client/getStripe.ts} (56%) create mode 100644 packages/app-store/stripepayment/lib/client/index.ts rename packages/{stripe => app-store/stripepayment/lib}/constants.ts (100%) rename packages/{stripe => app-store/stripepayment/lib}/customer.ts (98%) rename packages/{stripe => app-store/stripepayment/lib}/downgrade.ts (98%) rename packages/{stripe => app-store/stripepayment/lib}/index.ts (100%) rename packages/{stripe => app-store/stripepayment/lib}/server.ts (98%) rename packages/{stripe => app-store/stripepayment/lib}/subscriptions.ts (97%) rename packages/{stripe => app-store/stripepayment/lib}/team-billing.ts (99%) rename packages/{stripe => app-store/stripepayment/lib}/utils.ts (100%) delete mode 100644 packages/ee/index.ts delete mode 100644 packages/ee/tsconfig.json create mode 100644 packages/features/auth/README.md create mode 100644 packages/features/availability/README.md create mode 100644 packages/features/bookings/README.md create mode 100644 packages/features/calendars/README.md create mode 100644 packages/features/conferencing/README.md rename packages/{ => features}/ee/LICENSE (100%) rename packages/{ => features}/ee/README.md (100%) rename {apps/web/ee/components/apiKeys => packages/features/ee/api-keys/components}/ApiKeyDialogForm.tsx (97%) rename {apps/web/ee/components/apiKeys => packages/features/ee/api-keys/components}/ApiKeyListContainer.tsx (82%) rename {apps/web/ee/components/apiKeys => packages/features/ee/api-keys/components}/ApiKeyListItem.tsx (95%) rename packages/{ee/lib/api => features/ee/api-keys/lib}/apiKeys.ts (100%) rename packages/{ee/lib/api => features/ee/api-keys/lib}/findValidApiKey.ts (89%) rename {apps/web/ee => packages/features/ee/common}/components/LicenseBanner.tsx (97%) rename {apps/web/ee => packages/features/ee/common}/components/LicenseRequired.tsx (82%) rename apps/web/ee/components/saml/Configuration.tsx => packages/features/ee/common/components/SamlConfiguration.tsx (96%) rename {apps/web/ee => packages/features/ee/common}/components/TrialBanner.tsx (100%) rename packages/{ee/lib/core => features/ee/common/lib}/checkPremiumUsername.ts (100%) rename packages/{ee => features/ee/common}/server/checkLicense.ts (100%) rename {apps/web/components/ui => packages/features/ee/impersonation/components}/ImpersonatingBanner.tsx (100%) rename {apps/web/ee/lib/impersonation => packages/features/ee/impersonation/lib}/ImpersonationProvider.ts (99%) create mode 100644 packages/features/ee/index.ts rename packages/{ => features}/ee/package.json (63%) rename {apps/web/ee/pages/api/integrations/stripepayment => packages/features/ee/payments/api}/webhook.ts (98%) rename {apps/web/ee/components/stripe => packages/features/ee/payments/components}/Payment.tsx (98%) rename {apps/web/ee/components/stripe => packages/features/ee/payments/components}/PaymentPage.tsx (94%) rename apps/web/ee/pages/payment/[uid].tsx => packages/features/ee/payments/pages/payment.tsx (87%) create mode 100644 packages/features/ee/support/components/ContactMenuItem.tsx rename {apps/web/ee/components/support => packages/features/ee/support/components}/HelpMenuItem.tsx (99%) rename {apps/web/ee => packages/features/ee/support}/lib/helpscout/HelpscoutMenuItem.tsx (100%) rename {apps/web/ee => packages/features/ee/support}/lib/helpscout/provider.tsx (100%) rename {apps/web/ee => packages/features/ee/support}/lib/helpscout/providerDynamic.tsx (100%) rename {apps/web/ee => packages/features/ee/support}/lib/intercom/IntercomMenuItem.tsx (100%) rename {apps/web/ee => packages/features/ee/support}/lib/intercom/provider.tsx (100%) rename {apps/web/ee => packages/features/ee/support}/lib/intercom/providerDynamic.tsx (100%) rename {apps/web/ee => packages/features/ee/support}/lib/intercom/useIntercom.ts (100%) rename {apps/web/ee => packages/features/ee/support}/lib/zendesk/ZendeskMenuItem.tsx (100%) rename {apps/web/ee/pages/api/teams/[team] => packages/features/ee/teams/api}/upgrade.ts (81%) rename {apps/web/ee/components/team/availability => packages/features/ee/teams/components}/TeamAvailabilityModal.tsx (91%) rename {apps/web/ee/components/team/availability => packages/features/ee/teams/components}/TeamAvailabilityScreen.tsx (94%) rename {apps/web/ee/components/team/availability => packages/features/ee/teams/components}/TeamAvailabilityTimes.tsx (98%) rename {apps/web/ee/pages/settings/teams/[id] => packages/features/ee/teams/pages}/availability.tsx (80%) rename {apps/web => packages/features/ee}/web3/abis/abiWithGetBalance.json (100%) rename {apps/web/ee/components/web3 => packages/features/ee/web3/components}/CryptoSection.tsx (75%) rename {apps/web => packages/features/ee/web3}/contexts/contractsContext.tsx (100%) rename {apps/web => packages/features/ee}/web3/utils/verifyAccount.ts (100%) rename {apps/web/ee/pages/api/cron/workflows => packages/features/ee/workflows/api}/scheduleEmailReminders.ts (95%) rename {apps/web/ee/pages/api/cron/workflows => packages/features/ee/workflows/api}/scheduleSMSReminders.ts (92%) rename {apps/web/ee/components/workflows => packages/features/ee/workflows/components}/AddActionDialog.tsx (95%) rename {apps/web/ee/components/workflows => packages/features/ee/workflows/components}/NewWorkflowButton.tsx (96%) rename {apps/web/ee/components/workflows => packages/features/ee/workflows/components}/WorkflowDetailsPage.tsx (93%) rename {apps/web/ee/components/workflows => packages/features/ee/workflows/components}/WorkflowListPage.tsx (98%) rename {apps/web/ee/components/workflows => packages/features/ee/workflows/components}/WorkflowStepContainer.tsx (99%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/constants.ts (58%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/getOptions.ts (86%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/reminders/emailReminderManager.ts (95%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/reminders/reminderScheduler.ts (94%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/reminders/smsProviders/twilioProvider.ts (100%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/reminders/smsReminderManager.ts (94%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/reminders/templates/emailReminderTemplate.ts (100%) rename {apps/web/ee/lib/workflows => packages/features/ee/workflows/lib}/reminders/templates/smsReminderTemplate.ts (100%) rename {apps/web/ee/pages/workflows => packages/features/ee/workflows/pages}/index.tsx (74%) rename apps/web/ee/pages/workflows/[workflow].tsx => packages/features/ee/workflows/pages/workflow.tsx (77%) create mode 100644 packages/features/index.ts create mode 100644 packages/features/links/README.md create mode 100644 packages/features/package.json create mode 100644 packages/features/tsconfig.json create mode 100644 packages/features/users/README.md rename {apps/web => packages}/lib/getPlaceholderAvatar.tsx (100%) rename {apps/web => packages}/lib/hooks/useTheme.tsx (100%) rename {apps/web => packages}/lib/telemetry.ts (95%) rename {apps/web => packages}/lib/timeFormat.ts (100%) delete mode 100644 packages/stripe/LICENSE delete mode 100644 packages/stripe/README.md delete mode 100644 packages/stripe/package.json delete mode 100644 packages/stripe/tsconfig.json create mode 100644 packages/trpc/react/hooks/useMeQuery.ts rename {apps/web/components => packages}/ui/Badge.tsx (93%) rename {apps/web/components/dialog => packages/ui}/ConfirmationDialogContent.tsx (100%) create mode 100644 packages/ui/CustomBranding.tsx rename {apps/web/lib => packages/ui}/ErrorBoundary.tsx (100%) rename {apps/web/components => packages/ui}/Kbar.tsx (100%) rename {apps/web/components => packages/ui}/List.tsx (97%) rename {apps/web/components => packages/ui}/Logo.tsx (100%) rename {apps/web/components => packages/ui}/Shell.tsx (92%) rename {apps/web/components => packages/ui}/apps/SkeletonLoader.tsx (92%) rename {apps/web/components => packages}/ui/form/MultiSelectCheckboxes.tsx (97%) rename {apps/web/components => packages}/ui/form/PhoneInput.tsx (100%) create mode 100644 packages/ui/form/PhoneInputLazy.tsx rename {apps/web/components => packages}/ui/form/TimezoneSelect.tsx (95%) diff --git a/apps/api b/apps/api index aba7b1ec1c..60c2f73607 160000 --- a/apps/api +++ b/apps/api @@ -1 +1 @@ -Subproject commit aba7b1ec1c9b5122609dea916c7b114e9a3ba66f +Subproject commit 60c2f736075122ec3b91a24ef612ad004d257cdb diff --git a/apps/console b/apps/console index ac2567263d..0f33218c84 160000 --- a/apps/console +++ b/apps/console @@ -1 +1 @@ -Subproject commit ac2567263de74449c6e4b98b468415ce1c1815d4 +Subproject commit 0f33218c84aac810efc3b8f2de483cbcb7c5836c diff --git a/apps/web/components/App.tsx b/apps/web/components/App.tsx index 3908a0efc4..d47a9136dc 100644 --- a/apps/web/components/App.tsx +++ b/apps/web/components/App.tsx @@ -3,16 +3,15 @@ import React, { useEffect, useState } from "react"; import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation"; import { InstallAppButton } from "@calcom/app-store/components"; +import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { App as AppType } from "@calcom/types/App"; import { Button, SkeletonButton } from "@calcom/ui"; +import Badge from "@calcom/ui/Badge"; import { Icon } from "@calcom/ui/Icon"; -import LicenseRequired from "@ee/components/LicenseRequired"; - -import Shell from "@components/Shell"; -import Badge from "@components/ui/Badge"; +import Shell from "@calcom/ui/Shell"; const Component = ({ name, diff --git a/apps/web/components/SettingsShell.tsx b/apps/web/components/SettingsShell.tsx index e3cb3c6d8b..fa777d088d 100644 --- a/apps/web/components/SettingsShell.tsx +++ b/apps/web/components/SettingsShell.tsx @@ -1,11 +1,10 @@ import React, { ComponentProps } from "react"; +import ErrorBoundary from "@calcom/ui/ErrorBoundary"; import { Icon } from "@calcom/ui/Icon"; - -import ErrorBoundary from "@lib/ErrorBoundary"; +import Shell from "@calcom/ui/Shell"; import NavTabs from "./NavTabs"; -import Shell from "./Shell"; const tabs = [ { diff --git a/apps/web/components/apps/AppCard.tsx b/apps/web/components/apps/AppCard.tsx index 6397b9e46b..dc1fdc0c49 100644 --- a/apps/web/components/apps/AppCard.tsx +++ b/apps/web/components/apps/AppCard.tsx @@ -1,10 +1,9 @@ import Link from "next/link"; import { trpc } from "@calcom/trpc/react"; +import Badge from "@calcom/ui/Badge"; import Button from "@calcom/ui/Button"; -import Badge from "@components/ui/Badge"; - interface AppCardProps { logo: string; name: string; diff --git a/apps/web/components/auth/SAMLLogin.tsx b/apps/web/components/auth/SAMLLogin.tsx index 62ec48ef0f..a675b90a5e 100644 --- a/apps/web/components/auth/SAMLLogin.tsx +++ b/apps/web/components/auth/SAMLLogin.tsx @@ -2,11 +2,11 @@ import { signIn } from "next-auth/react"; import { Dispatch, SetStateAction } from "react"; import { useFormContext } from "react-hook-form"; +import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; import { trpc } from "@calcom/trpc/react"; import Button from "@calcom/ui/Button"; import { useLocale } from "@lib/hooks/useLocale"; -import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry"; interface Props { email: string; diff --git a/apps/web/components/booking/CancelBooking.tsx b/apps/web/components/booking/CancelBooking.tsx index 9e88d49021..c3aa355c48 100644 --- a/apps/web/components/booking/CancelBooking.tsx +++ b/apps/web/components/booking/CancelBooking.tsx @@ -2,13 +2,12 @@ import { useRouter } from "next/router"; import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { RecurringEvent } from "@calcom/types/Calendar"; +import useTheme from "@calcom/lib/hooks/useTheme"; +import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; +import type { RecurringEvent } from "@calcom/types/Calendar"; import { Button } from "@calcom/ui/Button"; import { Icon } from "@calcom/ui/Icon"; -import useTheme from "@lib/hooks/useTheme"; -import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry"; - type Props = { booking: { title?: string; diff --git a/apps/web/components/booking/TimeOptions.tsx b/apps/web/components/booking/TimeOptions.tsx index 2db42d4836..f1916b0d14 100644 --- a/apps/web/components/booking/TimeOptions.tsx +++ b/apps/web/components/booking/TimeOptions.tsx @@ -2,8 +2,7 @@ import { FC, useEffect, useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import Switch from "@calcom/ui/Switch"; - -import TimezoneSelect, { ITimezoneOption } from "@components/ui/form/TimezoneSelect"; +import TimezoneSelect, { ITimezoneOption } from "@calcom/ui/form/TimezoneSelect"; import { is24h, timeZone } from "../../lib/clock"; diff --git a/apps/web/components/booking/pages/AvailabilityPage.tsx b/apps/web/components/booking/pages/AvailabilityPage.tsx index 26b7deaaa5..8ab45db6c0 100644 --- a/apps/web/components/booking/pages/AvailabilityPage.tsx +++ b/apps/web/components/booking/pages/AvailabilityPage.tsx @@ -1,7 +1,6 @@ // Get router variables import { EventType } from "@prisma/client"; import * as Collapsible from "@radix-ui/react-collapsible"; -import { useContracts } from "contexts/contractsContext"; import { TFunction } from "next-i18next"; import { useRouter } from "next/router"; import { useEffect, useMemo, useState } from "react"; @@ -16,11 +15,15 @@ import { useEmbedNonStylesConfig, useIsBackgroundTransparent, } from "@calcom/embed-core/embed-iframe"; +import { useContracts } from "@calcom/features/ee/web3/contexts/contractsContext"; import CustomBranding from "@calcom/lib/CustomBranding"; import classNames from "@calcom/lib/classNames"; import { CAL_URL, WEBSITE_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; +import useTheme from "@calcom/lib/hooks/useTheme"; import { getRecurringFreq } from "@calcom/lib/recurringStrings"; +import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; +import { detectBrowserTimeFormat } from "@calcom/lib/timeFormat"; import { localStorage } from "@calcom/lib/webstorage"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui/Icon"; @@ -29,10 +32,7 @@ import DatePicker from "@calcom/ui/booker/DatePicker"; import { timeZone as localStorageTimeZone } from "@lib/clock"; // import { timeZone } from "@lib/clock"; import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally"; -import useTheme from "@lib/hooks/useTheme"; import { isBrandingHidden } from "@lib/isBrandingHidden"; -import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry"; -import { detectBrowserTimeFormat } from "@lib/timeFormat"; import AvailableTimes from "@components/booking/AvailableTimes"; import TimeOptions from "@components/booking/TimeOptions"; diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx index 7c335f4725..bd1f36e060 100644 --- a/apps/web/components/booking/pages/BookingPage.tsx +++ b/apps/web/components/booking/pages/BookingPage.tsx @@ -1,9 +1,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { EventTypeCustomInputType, WorkflowActions } from "@prisma/client"; -import { useContracts } from "contexts/contractsContext"; import { isValidPhoneNumber } from "libphonenumber-js"; import { useSession } from "next-auth/react"; -import dynamic from "next/dynamic"; import Head from "next/head"; import { useRouter } from "next/router"; import { useEffect, useMemo, useState } from "react"; @@ -14,36 +12,37 @@ import { useMutation } from "react-query"; import { v4 as uuidv4 } from "uuid"; import { z } from "zod"; +import { createPaymentLink } from "@calcom/app-store/stripepayment/lib/client"; import dayjs from "@calcom/dayjs"; import { useEmbedNonStylesConfig, useIsBackgroundTransparent, useIsEmbed, } from "@calcom/embed-core/embed-iframe"; +import { useContracts } from "@calcom/features/ee/web3/contexts/contractsContext"; import CustomBranding from "@calcom/lib/CustomBranding"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; +import useTheme from "@calcom/lib/hooks/useTheme"; import { HttpError } from "@calcom/lib/http-error"; import { getEveryFreqFor } from "@calcom/lib/recurringStrings"; -import { createPaymentLink } from "@calcom/stripe/client"; +import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; import { Button } from "@calcom/ui/Button"; import { Icon } from "@calcom/ui/Icon"; import { Tooltip } from "@calcom/ui/Tooltip"; +import PhoneInput from "@calcom/ui/form/PhoneInputLazy"; import { EmailInput, Form } from "@calcom/ui/form/fields"; import { asStringOrNull } from "@lib/asStringOrNull"; import { timeZone } from "@lib/clock"; import { ensureArray } from "@lib/ensureArray"; -import useTheme from "@lib/hooks/useTheme"; import { LocationObject, LocationType } from "@lib/location"; import createBooking from "@lib/mutations/bookings/create-booking"; import createRecurringBooking from "@lib/mutations/bookings/create-recurring-booking"; import { parseDate, parseRecurringDates } from "@lib/parseDate"; import slugify from "@lib/slugify"; -import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry"; import AvatarGroup from "@components/ui/AvatarGroup"; -import type PhoneInputType from "@components/ui/form/PhoneInput"; import { BookPageProps } from "../../../pages/[user]/book"; import { HashLinkPageProps } from "../../../pages/d/[link]/book"; @@ -58,11 +57,6 @@ declare global { }; } -/** These are like 40kb that not every user needs */ -const PhoneInput = dynamic( - () => import("@components/ui/form/PhoneInput") -) as unknown as typeof PhoneInputType; - type BookingPageProps = (BookPageProps | TeamBookingPageProps | HashLinkPageProps) & { locationLabels: Record; }; diff --git a/apps/web/components/dialog/EditLocationDialog.tsx b/apps/web/components/dialog/EditLocationDialog.tsx index b768086af2..04d9d9e846 100644 --- a/apps/web/components/dialog/EditLocationDialog.tsx +++ b/apps/web/components/dialog/EditLocationDialog.tsx @@ -1,31 +1,25 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { isValidPhoneNumber } from "libphonenumber-js"; -import dynamic from "next/dynamic"; import { useEffect } from "react"; import { Controller, useForm, useWatch } from "react-hook-form"; import { z } from "zod"; -import classNames from "@calcom/lib/classNames"; +import { LocationOptionsToString } from "@calcom/app-store/locations"; +import { LocationType } from "@calcom/core/location"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui"; import { Dialog, DialogContent } from "@calcom/ui/Dialog"; import { Icon } from "@calcom/ui/Icon"; +import PhoneInput from "@calcom/ui/form/PhoneInputLazy"; import { Form } from "@calcom/ui/form/fields"; import { QueryCell } from "@lib/QueryCell"; import { linkValueToString } from "@lib/linkValueToString"; -import { LocationType } from "@lib/location"; -import { LocationOptionsToString } from "@lib/locationOptions"; import CheckboxField from "@components/ui/form/CheckboxField"; -import type PhoneInputType from "@components/ui/form/PhoneInput"; import Select from "@components/ui/form/Select"; -const PhoneInput = dynamic( - () => import("@components/ui/form/PhoneInput") -) as unknown as typeof PhoneInputType; - type BookingItem = inferQueryOutput<"viewer.bookings">["bookings"][number]; type OptionTypeBase = { diff --git a/apps/web/components/eventtype/RecurringEventController.tsx b/apps/web/components/eventtype/RecurringEventController.tsx index 3e90df32a6..7365477339 100644 --- a/apps/web/components/eventtype/RecurringEventController.tsx +++ b/apps/web/components/eventtype/RecurringEventController.tsx @@ -4,7 +4,7 @@ import { UseFormReturn } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Frequency } from "@calcom/prisma/zod-utils"; -import { RecurringEvent } from "@calcom/types/Calendar"; +import type { RecurringEvent } from "@calcom/types/Calendar"; import { Alert } from "@calcom/ui/Alert"; import Select from "@components/ui/form/Select"; diff --git a/apps/web/components/integrations/CalendarListContainer.tsx b/apps/web/components/integrations/CalendarListContainer.tsx index d2864bf265..2dd99a1310 100644 --- a/apps/web/components/integrations/CalendarListContainer.tsx +++ b/apps/web/components/integrations/CalendarListContainer.tsx @@ -7,15 +7,15 @@ import showToast from "@calcom/lib/notification"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/Alert"; import Button from "@calcom/ui/Button"; +import { List } from "@calcom/ui/List"; +import { ShellSubHeading } from "@calcom/ui/Shell"; import Switch from "@calcom/ui/Switch"; +import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader"; import { QueryCell } from "@lib/QueryCell"; import AdditionalCalendarSelector from "@components/AdditionalCalendarSelector"; import DestinationCalendarSelector from "@components/DestinationCalendarSelector"; -import { List } from "@components/List"; -import { ShellSubHeading } from "@components/Shell"; -import SkeletonLoader from "@components/apps/SkeletonLoader"; import DisconnectIntegration from "./DisconnectIntegration"; import IntegrationListItem from "./IntegrationListItem"; diff --git a/apps/web/components/integrations/DisconnectIntegration.tsx b/apps/web/components/integrations/DisconnectIntegration.tsx index ec74fea0b2..316e932548 100644 --- a/apps/web/components/integrations/DisconnectIntegration.tsx +++ b/apps/web/components/integrations/DisconnectIntegration.tsx @@ -1,14 +1,12 @@ import { useState } from "react"; -import { useMutation } from "react-query"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { ButtonBaseProps } from "@calcom/ui/Button"; +import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; import { Dialog } from "@calcom/ui/Dialog"; -import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; - export default function DisconnectIntegration(props: { /** Integration credential id */ id: number; diff --git a/apps/web/components/integrations/IntegrationListItem.tsx b/apps/web/components/integrations/IntegrationListItem.tsx index 9333c747b9..ca1cf52595 100644 --- a/apps/web/components/integrations/IntegrationListItem.tsx +++ b/apps/web/components/integrations/IntegrationListItem.tsx @@ -1,9 +1,9 @@ import Link from "next/link"; import { ReactNode } from "react"; -import classNames from "@lib/classNames"; +import { ListItem, ListItemText, ListItemTitle } from "@calcom/ui/List"; -import { ListItem, ListItemText, ListItemTitle } from "@components/List"; +import classNames from "@lib/classNames"; function IntegrationListItem(props: { imageSrc?: string; diff --git a/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx b/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx index 80d120d301..f6e083859d 100644 --- a/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx +++ b/apps/web/components/integrations/SubHeadingTitleWithConnections.tsx @@ -1,6 +1,6 @@ import { ReactNode } from "react"; -import Badge from "@components/ui/Badge"; +import Badge from "@calcom/ui/Badge"; function pluralize(opts: { num: number; plural: string; singular: string }) { if (opts.num === 0) { diff --git a/apps/web/components/security/DisableUserImpersonation.tsx b/apps/web/components/security/DisableUserImpersonation.tsx index 79b1f297c4..18269b3b13 100644 --- a/apps/web/components/security/DisableUserImpersonation.tsx +++ b/apps/web/components/security/DisableUserImpersonation.tsx @@ -1,10 +1,9 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; +import Badge from "@calcom/ui/Badge"; import Button from "@calcom/ui/Button"; -import Badge from "@components/ui/Badge"; - const DisableUserImpersonation = ({ disableImpersonation }: { disableImpersonation: boolean }) => { const utils = trpc.useContext(); diff --git a/apps/web/components/security/TwoFactorAuthSection.tsx b/apps/web/components/security/TwoFactorAuthSection.tsx index b21273fdd6..4a2b03325e 100644 --- a/apps/web/components/security/TwoFactorAuthSection.tsx +++ b/apps/web/components/security/TwoFactorAuthSection.tsx @@ -1,11 +1,10 @@ import { useState } from "react"; +import Badge from "@calcom/ui/Badge"; import Button from "@calcom/ui/Button"; import { useLocale } from "@lib/hooks/useLocale"; -import Badge from "@components/ui/Badge"; - import DisableTwoFactorModal from "./DisableTwoFactorModal"; import EnableTwoFactorModal from "./EnableTwoFactorModal"; diff --git a/apps/web/components/team/DisableTeamImpersonation.tsx b/apps/web/components/team/DisableTeamImpersonation.tsx index d1b75b5f7c..c88cf569bf 100644 --- a/apps/web/components/team/DisableTeamImpersonation.tsx +++ b/apps/web/components/team/DisableTeamImpersonation.tsx @@ -1,10 +1,9 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; +import Badge from "@calcom/ui/Badge"; import Button from "@calcom/ui/Button"; -import Badge from "@components/ui/Badge"; - const DisableTeamImpersonation = ({ teamId, memberId }: { teamId: number; memberId: number }) => { const { t } = useLocale(); diff --git a/apps/web/components/team/MemberListItem.tsx b/apps/web/components/team/MemberListItem.tsx index 4849c2ec9a..850b4a6f9b 100644 --- a/apps/web/components/team/MemberListItem.tsx +++ b/apps/web/components/team/MemberListItem.tsx @@ -3,11 +3,13 @@ import { signIn } from "next-auth/react"; import Link from "next/link"; import { useState } from "react"; +import TeamAvailabilityModal from "@calcom/features/ee/teams/components/TeamAvailabilityModal"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import Button from "@calcom/ui/Button"; +import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; import { Dialog, DialogTrigger } from "@calcom/ui/Dialog"; import Dropdown, { DropdownMenuContent, @@ -17,11 +19,9 @@ import Dropdown, { } from "@calcom/ui/Dropdown"; import { Icon } from "@calcom/ui/Icon"; import { Tooltip } from "@calcom/ui/Tooltip"; -import TeamAvailabilityModal from "@ee/components/team/availability/TeamAvailabilityModal"; import useCurrentUserId from "@lib/hooks/useCurrentUserId"; -import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; import Avatar from "@components/ui/Avatar"; import ModalContainer from "@components/ui/ModalContainer"; diff --git a/apps/web/components/team/SkeletonloaderTeamList.tsx b/apps/web/components/team/SkeletonloaderTeamList.tsx index 137b1be84b..8acb96d944 100644 --- a/apps/web/components/team/SkeletonloaderTeamList.tsx +++ b/apps/web/components/team/SkeletonloaderTeamList.tsx @@ -1,10 +1,6 @@ -import React from "react"; - import { SkeletonText } from "@calcom/ui"; -import { ShellSubHeading } from "@components/Shell"; - -function SkeletonLoaderTeamList({ className }: { className?: string }) { +function SkeletonLoaderTeamList() { return ( <>