From 8bdfc0686f8055eefd38f339370a69128d213611 Mon Sep 17 00:00:00 2001 From: Matti Nannt Date: Mon, 20 Oct 2025 16:28:14 +0200 Subject: [PATCH] chore: apply prettier formatting (#6719) --- .github/copilot-instructions.md | 6 +- .../components/ConnectWithFormbricks.tsx | 4 +- .../OnboardingSetupInstructions.tsx | 8 +- .../[environmentId]/connect/page.tsx | 4 +- .../[environmentId]/layout.test.tsx | 2 +- .../environments/[environmentId]/layout.tsx | 4 +- .../components/XMTemplateList.test.tsx | 2 +- .../components/XMTemplateList.tsx | 10 +- .../[environmentId]/xm-templates/lib/utils.ts | 2 +- .../[environmentId]/xm-templates/page.tsx | 6 +- .../app/(app)/(onboarding)/lib/onboarding.ts | 4 +- .../[organizationId]/landing/layout.test.tsx | 6 +- .../[organizationId]/landing/layout.tsx | 4 +- .../[organizationId]/landing/page.test.tsx | 8 +- .../[organizationId]/landing/page.tsx | 2 +- .../[organizationId]/layout.test.tsx | 6 +- .../organizations/[organizationId]/layout.tsx | 6 +- .../projects/new/channel/page.test.tsx | 6 +- .../projects/new/channel/page.tsx | 6 +- .../projects/new/layout.test.tsx | 8 +- .../[organizationId]/projects/new/layout.tsx | 4 +- .../projects/new/mode/page.test.tsx | 6 +- .../projects/new/mode/page.tsx | 6 +- .../components/ProjectSettings.test.tsx | 2 +- .../settings/components/ProjectSettings.tsx | 28 +- .../projects/new/settings/page.test.tsx | 8 +- .../projects/new/settings/page.tsx | 8 +- .../components/OnboardingOptionsContainer.tsx | 2 +- .../[environmentId]/layout.test.tsx | 4 +- .../environments/[environmentId]/layout.tsx | 2 +- .../components/ConfirmationPage.tsx | 4 +- .../contacts/[contactId]/page.test.tsx | 2 +- .../(contacts)/contacts/page.test.tsx | 2 +- .../environments/[environmentId]/actions.ts | 8 +- .../components/EnvironmentLayout.test.tsx | 16 +- .../components/EnvironmentLayout.tsx | 2 +- .../EnvironmentStorageHandler.test.tsx | 2 +- .../components/EnvironmentStorageHandler.tsx | 2 +- .../components/EnvironmentSwitch.tsx | 6 +- .../components/NavigationLink.tsx | 4 +- .../components/ResponseFilterContext.test.tsx | 6 +- .../components/ResponseFilterContext.tsx | 2 +- .../components/TopControlBar.tsx | 4 +- .../components/WidgetStatusIndicator.tsx | 4 +- .../components/environment-breadcrumb.tsx | 8 +- .../components/organization-breadcrumb.tsx | 20 +- .../components/project-and-org-switch.tsx | 2 +- .../components/project-breadcrumb.tsx | 12 +- .../[environmentId]/layout.test.tsx | 8 +- .../environments/[environmentId]/layout.tsx | 2 +- .../[environmentId]/lib/organization.ts | 2 +- .../[environmentId]/lib/project.ts | 2 +- .../[environmentId]/page.test.tsx | 6 +- .../environments/[environmentId]/page.tsx | 2 +- .../(setup)/app-connection/loading.test.tsx | 2 +- .../(setup)/app-connection/page.test.tsx | 2 +- .../project/general/loading.test.tsx | 2 +- .../project/general/page.test.tsx | 2 +- .../project/integrations/actions.ts | 6 +- .../components/AddIntegrationModal.test.tsx | 4 +- .../components/AirtableWrapper.test.tsx | 2 +- .../airtable/components/AirtableWrapper.tsx | 8 +- .../components/BaseSelectDropdown.tsx | 6 +- .../components/ManageIntegration.test.tsx | 2 +- .../airtable/components/ManageIntegration.tsx | 14 +- .../integrations/airtable/page.test.tsx | 14 +- .../project/integrations/airtable/page.tsx | 6 +- .../integrations/google-sheets/actions.ts | 4 +- .../components/AddIntegrationModal.test.tsx | 2 +- .../components/GoogleSheetWrapper.test.tsx | 4 +- .../components/GoogleSheetWrapper.tsx | 8 +- .../components/ManageIntegration.test.tsx | 2 +- .../components/ManageIntegration.tsx | 12 +- .../integrations/google-sheets/loading.tsx | 2 +- .../integrations/google-sheets/page.test.tsx | 12 +- .../integrations/google-sheets/page.tsx | 4 +- .../project/integrations/lib/surveys.test.ts | 6 +- .../project/integrations/lib/surveys.ts | 6 +- .../project/integrations/lib/webhook.test.ts | 2 +- .../project/integrations/lib/webhook.ts | 2 +- .../components/AddIntegrationModal.test.tsx | 2 +- .../notion/components/ManageIntegration.tsx | 14 +- .../notion/components/NotionWrapper.test.tsx | 2 +- .../notion/components/NotionWrapper.tsx | 8 +- .../project/integrations/notion/loading.tsx | 2 +- .../project/integrations/notion/page.test.tsx | 12 +- .../project/integrations/notion/page.tsx | 4 +- .../project/integrations/page.test.tsx | 10 +- .../project/integrations/page.tsx | 8 +- .../project/integrations/slack/actions.ts | 4 +- .../AddChannelMappingModal.test.tsx | 2 +- .../components/ManageIntegration.test.tsx | 2 +- .../slack/components/ManageIntegration.tsx | 12 +- .../slack/components/SlackWrapper.test.tsx | 6 +- .../slack/components/SlackWrapper.tsx | 12 +- .../project/integrations/slack/page.test.tsx | 12 +- .../project/integrations/slack/page.tsx | 4 +- .../project/languages/loading.test.tsx | 2 +- .../project/languages/page.test.tsx | 2 +- .../project/look/loading.test.tsx | 2 +- .../project/look/page.test.tsx | 2 +- .../[environmentId]/project/page.test.tsx | 2 +- .../project/tags/loading.test.tsx | 2 +- .../project/tags/page.test.tsx | 2 +- .../project/teams/page.test.tsx | 2 +- .../components/AccountSettingsNavbar.test.tsx | 2 +- .../components/AccountSettingsNavbar.tsx | 2 +- .../settings/(account)/layout.test.tsx | 4 +- .../settings/(account)/layout.tsx | 2 +- .../(account)/notifications/actions.ts | 4 +- .../notifications/components/EditAlerts.tsx | 2 +- .../components/IntegrationsTip.tsx | 2 +- .../components/NotificationSwitch.tsx | 4 +- .../(account)/notifications/loading.tsx | 2 +- .../(account)/notifications/page.test.tsx | 2 +- .../settings/(account)/notifications/page.tsx | 6 +- .../settings/(account)/profile/actions.ts | 12 +- .../profile/components/AccountSecurity.tsx | 6 +- .../profile/components/DeleteAccount.tsx | 6 +- .../components/EditProfileDetailsForm.tsx | 16 +- .../password-confirmation-modal.tsx | 10 +- .../(account)/profile/lib/user.test.ts | 2 +- .../settings/(account)/profile/lib/user.ts | 2 +- .../settings/(account)/profile/loading.tsx | 2 +- .../settings/(account)/profile/page.test.tsx | 10 +- .../OrganizationSettingsNavbar.test.tsx | 2 +- .../components/OrganizationSettingsNavbar.tsx | 4 +- .../(organization)/enterprise/page.test.tsx | 10 +- .../(organization)/enterprise/page.tsx | 6 +- .../(organization)/general/actions.ts | 8 +- .../components/DeleteOrganization.test.tsx | 4 +- .../general/components/DeleteOrganization.tsx | 10 +- .../EditOrganizationNameForm.test.tsx | 2 +- .../components/EditOrganizationNameForm.tsx | 14 +- .../(organization)/general/loading.test.tsx | 4 +- .../(organization)/general/page.test.tsx | 6 +- .../settings/(organization)/layout.test.tsx | 4 +- .../settings/(organization)/layout.tsx | 2 +- .../(organization)/teams/page.test.tsx | 2 +- .../settings/components/SettingsCard.test.tsx | 2 +- .../components/SettingsTitle.test.tsx | 2 +- .../surveys/[surveyId]/(analysis)/actions.ts | 8 +- .../components/EmptyInAppSurveys.tsx | 2 +- .../SurveyAnalysisNavigation.test.tsx | 16 +- .../components/SurveyAnalysisNavigation.tsx | 4 +- .../[surveyId]/(analysis)/layout.test.tsx | 6 +- .../surveys/[surveyId]/(analysis)/layout.tsx | 4 +- .../components/ResponseDataView.test.tsx | 2 +- .../responses/components/ResponseDataView.tsx | 2 +- .../components/ResponsePage.test.tsx | 4 +- .../responses/components/ResponsePage.tsx | 12 +- .../components/ResponseTable.test.tsx | 6 +- .../responses/components/ResponseTable.tsx | 28 +- .../components/ResponseTableCell.tsx | 6 +- .../components/ResponseTableColumns.test.tsx | 8 +- .../(analysis)/responses/page.test.tsx | 12 +- .../[surveyId]/(analysis)/summary/actions.ts | 6 +- .../summary/components/AddressSummary.tsx | 8 +- .../summary/components/CTASummary.tsx | 2 +- .../summary/components/CalSummary.tsx | 4 +- .../summary/components/ConsentSummary.tsx | 2 +- .../summary/components/ContactInfoSummary.tsx | 8 +- .../components/DateQuestionSummary.tsx | 10 +- .../components/FileUploadSummary.test.tsx | 2 +- .../summary/components/FileUploadSummary.tsx | 10 +- .../components/HiddenFieldsSummary.tsx | 8 +- .../components/MatrixQuestionSummary.tsx | 2 +- .../components/MultipleChoiceSummary.tsx | 12 +- .../summary/components/NPSSummary.tsx | 2 +- .../summary/components/OpenTextSummary.tsx | 10 +- .../components/PictureChoiceSummary.tsx | 6 +- .../summary/components/RankingSummary.tsx | 4 +- .../summary/components/RatingSummary.tsx | 6 +- .../summary/components/SuccessMessage.tsx | 2 +- .../summary/components/SummaryList.test.tsx | 8 +- .../summary/components/SummaryList.tsx | 14 +- .../summary/components/SummaryMetadata.tsx | 4 +- .../summary/components/SummaryPage.tsx | 10 +- .../summary/components/SurveyAnalysisCTA.tsx | 18 +- .../summary/components/base-card.tsx | 2 +- .../summary/components/interactive-card.tsx | 2 +- .../summary/components/share-survey-modal.tsx | 32 +- .../shareEmbedModal/anonymous-links-tab.tsx | 14 +- .../shareEmbedModal/app-tab.test.tsx | 4 +- .../components/shareEmbedModal/app-tab.tsx | 8 +- .../shareEmbedModal/disable-link-modal.tsx | 2 +- .../documentation-links-section.tsx | 4 +- .../shareEmbedModal/documentation-links.tsx | 2 +- .../shareEmbedModal/dynamic-popup-tab.tsx | 4 +- .../shareEmbedModal/email-tab.test.tsx | 2 +- .../components/shareEmbedModal/email-tab.tsx | 10 +- .../link-settings-tab.test.tsx | 6 +- .../shareEmbedModal/link-settings-tab.tsx | 12 +- .../personal-links-tab.test.tsx | 4 +- .../shareEmbedModal/personal-links-tab.tsx | 12 +- .../shareEmbedModal/qr-code-tab.tsx | 6 +- .../components/shareEmbedModal/share-view.tsx | 4 +- .../shareEmbedModal/social-media-tab.tsx | 6 +- .../shareEmbedModal/success-view.tsx | 4 +- .../shareEmbedModal/website-embed-tab.tsx | 6 +- .../summary/components/stat-card.tsx | 2 +- .../summary/lib/emailTemplate.test.tsx | 10 +- .../(analysis)/summary/lib/survey.ts | 2 +- .../summary/lib/surveySummary.test.ts | 12 +- .../[surveyId]/(analysis)/summary/loading.tsx | 2 +- .../(analysis)/summary/page.test.tsx | 12 +- .../[surveyId]/(analysis)/summary/page.tsx | 2 +- .../surveys/[surveyId]/actions.ts | 10 +- .../components/CustomFilter.test.tsx | 10 +- .../[surveyId]/components/CustomFilter.tsx | 32 +- .../components/QuestionFilterComboBox.tsx | 10 +- .../components/QuestionsComboBox.tsx | 22 +- .../components/ResponseFilter.test.tsx | 6 +- .../[surveyId]/components/ResponseFilter.tsx | 10 +- .../components/SurveyStatusDropdown.tsx | 10 +- .../surveys/[surveyId]/layout.test.tsx | 2 +- .../[environmentId]/surveys/loading.test.tsx | 2 +- apps/web/app/(app)/layout.test.tsx | 2 +- apps/web/app/(app)/layout.tsx | 4 +- .../organizations/[organizationId]/route.ts | 8 +- .../(redirects)/projects/[projectId]/route.ts | 6 +- .../app/ClientEnvironmentRedirect.test.tsx | 2 +- apps/web/app/ClientEnvironmentRedirect.tsx | 2 +- .../pipeline/lib/handleIntegrations.test.ts | 20 +- .../pipeline/lib/handleIntegrations.ts | 18 +- apps/web/app/api/(internal)/pipeline/route.ts | 10 +- apps/web/app/api/auth/[...nextauth]/route.ts | 6 +- .../app/api/google-sheet/callback/route.ts | 2 +- apps/web/app/api/google-sheet/route.ts | 6 +- apps/web/app/api/lib/utils.ts | 4 +- .../app/sync/[userId]/route.ts | 10 +- .../app/sync/lib/contact.test.ts | 2 +- .../app/sync/lib/survey.test.ts | 10 +- .../[environmentId]/app/sync/lib/survey.ts | 12 +- .../[environmentId]/app/sync/lib/utils.ts | 2 +- .../displays/lib/display.test.ts | 2 +- .../[environmentId]/displays/lib/display.ts | 2 +- .../client/[environmentId]/displays/route.ts | 8 +- .../[environmentId]/environment/lib/data.ts | 4 +- .../[environmentId]/environment/route.ts | 6 +- .../[responseId]/lib/response.test.ts | 4 +- .../responses/[responseId]/lib/response.ts | 4 +- .../responses/[responseId]/route.ts | 8 +- .../responses/lib/response.test.ts | 14 +- .../[environmentId]/responses/lib/response.ts | 14 +- .../client/[environmentId]/responses/route.ts | 16 +- .../client/[environmentId]/storage/route.ts | 6 +- .../integrations/airtable/callback/route.ts | 6 +- .../app/api/v1/integrations/airtable/route.ts | 4 +- .../v1/integrations/airtable/tables/route.ts | 6 +- .../v1/integrations/notion/callback/route.ts | 4 +- .../app/api/v1/integrations/notion/route.ts | 2 +- .../v1/integrations/slack/callback/route.ts | 8 +- .../app/api/v1/integrations/slack/route.ts | 2 +- .../action-classes/[actionClassId]/route.ts | 8 +- .../action-classes/lib/action-classes.ts | 2 +- .../api/v1/management/action-classes/route.ts | 8 +- .../api/v1/management/me/lib/utils.test.ts | 6 +- .../web/app/api/v1/management/me/lib/utils.ts | 2 +- .../[responseId]/lib/response.test.ts | 4 +- .../responses/[responseId]/lib/response.ts | 4 +- .../responses/[responseId]/route.ts | 6 +- .../management/responses/lib/response.test.ts | 12 +- .../v1/management/responses/lib/response.ts | 18 +- .../app/api/v1/management/responses/route.ts | 8 +- .../surveys/[surveyId]/lib/surveys.test.ts | 2 +- .../surveys/[surveyId]/lib/surveys.ts | 2 +- .../v1/management/surveys/[surveyId]/route.ts | 8 +- .../surveys/[surveyId]/singleUseIds/route.ts | 2 +- .../v1/management/surveys/lib/surveys.test.ts | 6 +- .../api/v1/management/surveys/lib/surveys.ts | 6 +- .../v1/management/surveys/lib/utils.test.ts | 6 +- .../api/v1/management/surveys/lib/utils.ts | 4 +- .../app/api/v1/management/surveys/route.ts | 8 +- .../v1/webhooks/[webhookId]/lib/webhook.ts | 2 +- .../app/api/v1/webhooks/[webhookId]/route.ts | 4 +- .../app/api/v1/webhooks/lib/webhook.test.ts | 6 +- apps/web/app/api/v1/webhooks/lib/webhook.ts | 6 +- apps/web/app/api/v1/webhooks/route.ts | 4 +- .../displays/lib/display.test.ts | 2 +- .../[environmentId]/displays/lib/display.ts | 6 +- .../client/[environmentId]/displays/route.ts | 4 +- .../responses/lib/recaptcha.ts | 2 +- .../responses/lib/response.test.ts | 18 +- .../[environmentId]/responses/lib/response.ts | 14 +- .../responses/lib/utils.test.ts | 8 +- .../[environmentId]/responses/lib/utils.ts | 4 +- .../client/[environmentId]/responses/route.ts | 12 +- apps/web/app/error.tsx | 4 +- .../app/intercom/IntercomClientWrapper.tsx | 2 +- apps/web/app/layout.test.tsx | 4 +- apps/web/app/layout.tsx | 6 +- apps/web/app/lib/pipelines.test.ts | 2 +- apps/web/app/lib/pipelines.ts | 2 +- apps/web/app/lib/singleUseSurveys.test.ts | 2 +- apps/web/app/lib/singleUseSurveys.ts | 2 +- apps/web/app/lib/surveys/surveys.test.ts | 10 +- apps/web/app/middleware/domain-utils.ts | 2 +- apps/web/app/not-found.tsx | 2 +- apps/web/app/page.tsx | 6 +- .../app/setup/organization/create/actions.ts | 4 +- .../[accessType]/[fileName]/lib/audit-logs.ts | 2 +- apps/web/instrumentation-node.ts | 2 +- apps/web/instrumentation.ts | 2 +- apps/web/lib/display/tests/display.test.ts | 2 +- apps/web/lib/googleSheet/service.ts | 14 +- apps/web/lib/language/tests/language.test.ts | 2 +- apps/web/lib/notion/service.ts | 4 +- apps/web/lib/organization/service.test.ts | 4 +- apps/web/lib/organization/service.ts | 8 +- apps/web/lib/posthogServer.ts | 2 +- apps/web/lib/response/service.ts | 10 +- .../lib/response/tests/__mocks__/data.mock.ts | 2 +- apps/web/lib/response/tests/response.test.ts | 2 +- apps/web/lib/survey/service.test.ts | 14 +- apps/web/lib/survey/service.ts | 8 +- apps/web/lib/survey/utils.test.ts | 2 +- apps/web/lib/survey/utils.ts | 2 +- apps/web/lib/surveyLogic/utils.ts | 2 +- apps/web/lib/tag/service.test.ts | 2 +- apps/web/lib/tag/service.ts | 2 +- apps/web/lib/user/service.test.ts | 2 +- apps/web/lib/user/service.ts | 4 +- .../action-client-middleware.test.ts | 4 +- .../action-client/action-client-middleware.ts | 8 +- apps/web/lib/utils/action-client/index.ts | 10 +- apps/web/lib/utils/helper.test.ts | 2 +- apps/web/lib/utils/helper.ts | 2 +- apps/web/lib/utils/locale.test.ts | 2 +- apps/web/lib/utils/locale.ts | 2 +- apps/web/lib/utils/services.test.ts | 4 +- apps/web/lib/utils/services.ts | 4 +- apps/web/lib/utils/single-use-surveys.test.ts | 4 +- apps/web/lib/utils/single-use-surveys.ts | 2 +- apps/web/lib/utils/templates.test.ts | 4 +- apps/web/lib/utils/templates.ts | 4 +- apps/web/middleware.ts | 8 +- .../components/DeleteAccountModal/actions.ts | 2 +- .../components/DeleteAccountModal/index.tsx | 6 +- .../components/LanguageDropdown.test.tsx | 2 +- .../components/LanguageDropdown.tsx | 6 +- .../components/ShareSurveyLink/index.test.tsx | 2 +- .../components/ShareSurveyLink/index.tsx | 4 +- .../components/SingleResponseCard/actions.ts | 4 +- .../components/HiddenFields.tsx | 2 +- .../components/QuestionSkip.test.tsx | 2 +- .../components/ResponseTagsWrapper.test.tsx | 2 +- .../components/ResponseTagsWrapper.tsx | 10 +- .../components/ResponseVariables.tsx | 2 +- .../SingleResponseCardHeader.test.tsx | 2 +- .../components/SingleResponseCardHeader.tsx | 12 +- .../components/SingleResponseCard/index.tsx | 4 +- .../tests/authenticated-api-client.test.ts | 2 +- apps/web/modules/api/v2/health/lib/openapi.ts | 2 +- apps/web/modules/api/v2/lib/question.ts | 4 +- .../modules/api/v2/lib/tests/question.test.ts | 2 +- .../lib/contact-attribute-key.ts | 4 +- .../[contactAttributeKeyId]/lib/openapi.ts | 6 +- .../lib/tests/contact-attribute-key.test.ts | 2 +- .../[contactAttributeKeyId]/route.ts | 4 +- .../lib/contact-attribute-key.ts | 10 +- .../contact-attribute-keys/lib/openapi.ts | 4 +- .../lib/tests/contact-attribute-key.test.ts | 8 +- .../lib/tests/utils.test.ts | 2 +- .../contact-attribute-keys/lib/utils.ts | 2 +- .../contact-attribute-keys/route.ts | 2 +- .../types/contact-attribute-keys.ts | 2 +- .../modules/api/v2/management/lib/helper.ts | 2 +- .../v2/management/lib/tests/helper.test.ts | 4 +- .../responses/[responseId]/lib/display.ts | 2 +- .../responses/[responseId]/lib/openapi.ts | 4 +- .../responses/[responseId]/lib/response.ts | 12 +- .../[responseId]/lib/tests/response.test.ts | 2 +- .../[responseId]/lib/tests/utils.test.ts | 2 +- .../responses/[responseId]/lib/utils.ts | 4 +- .../responses/[responseId]/route.ts | 2 +- .../v2/management/responses/lib/openapi.ts | 4 +- .../management/responses/lib/organization.ts | 2 +- .../v2/management/responses/lib/response.ts | 8 +- .../lib/tests/__mocks__/response.mock.ts | 2 +- .../responses/lib/tests/organization.test.ts | 4 +- .../responses/lib/tests/response.test.ts | 6 +- .../responses/lib/tests/utils.test.ts | 4 +- .../api/v2/management/responses/lib/utils.ts | 2 +- .../api/v2/management/responses/route.ts | 4 +- .../management/responses/types/responses.ts | 2 +- .../segments/[segmentId]/lib/contact.ts | 8 +- .../segments/[segmentId]/lib/openapi.ts | 2 +- .../lib/tests/contact-attribute-key.test.ts | 2 +- .../[segmentId]/lib/tests/contact.test.ts | 2 +- .../segments/[segmentId]/types/contact.ts | 2 +- .../contact-links/segments/lib/openapi.ts | 2 +- .../surveys/[surveyId]/lib/openapi.ts | 4 +- .../api/v2/management/surveys/lib/openapi.ts | 6 +- .../webhooks/[webhookId]/lib/openapi.ts | 6 +- .../[webhookId]/lib/tests/webhook.test.ts | 6 +- .../webhooks/[webhookId]/lib/webhook.ts | 4 +- .../management/webhooks/[webhookId]/route.ts | 4 +- .../api/v2/management/webhooks/lib/openapi.ts | 4 +- .../webhooks/lib/tests/utils.test.ts | 2 +- .../webhooks/lib/tests/webhook.test.ts | 4 +- .../api/v2/management/webhooks/lib/utils.ts | 2 +- .../api/v2/management/webhooks/lib/webhook.ts | 6 +- .../api/v2/management/webhooks/route.ts | 2 +- .../v2/management/webhooks/types/webhooks.ts | 2 +- apps/web/modules/api/v2/me/lib/openapi.ts | 2 +- apps/web/modules/api/v2/me/route.ts | 4 +- apps/web/modules/api/v2/openapi-document.ts | 28 +- .../[organizationId]/lib/utils.ts | 2 +- .../project-teams/lib/openapi.ts | 6 +- .../project-teams/lib/project-teams.ts | 8 +- .../lib/tests/project-teams.test.ts | 6 +- .../project-teams/lib/utils.ts | 6 +- .../[organizationId]/project-teams/route.ts | 6 +- .../project-teams/types/project-teams.ts | 2 +- .../teams/[teamId]/lib/openapi.ts | 6 +- .../teams/[teamId]/lib/teams.ts | 4 +- .../[organizationId]/teams/[teamId]/route.ts | 6 +- .../[organizationId]/teams/lib/openapi.ts | 6 +- .../[organizationId]/teams/lib/teams.ts | 6 +- .../teams/lib/tests/teams.test.ts | 2 +- .../teams/lib/tests/utils.test.ts | 2 +- .../[organizationId]/teams/lib/utils.ts | 2 +- .../[organizationId]/teams/route.ts | 6 +- .../[organizationId]/teams/types/teams.ts | 2 +- .../[organizationId]/users/lib/openapi.ts | 6 +- .../users/lib/tests/users.test.ts | 2 +- .../users/lib/tests/utils.test.ts | 2 +- .../[organizationId]/users/lib/users.ts | 8 +- .../[organizationId]/users/lib/utils.ts | 2 +- .../[organizationId]/users/route.ts | 8 +- .../[organizationId]/users/types/users.ts | 2 +- apps/web/modules/api/v2/roles/lib/openapi.ts | 2 +- .../modules/api/v2/roles/lib/utils.test.ts | 2 +- apps/web/modules/api/v2/roles/lib/utils.ts | 4 +- apps/web/modules/api/v2/roles/route.ts | 2 +- apps/web/modules/auth/actions.ts | 4 +- .../components/back-to-login-button.test.tsx | 2 +- .../auth/components/back-to-login-button.tsx | 2 +- .../modules/auth/components/form-wrapper.tsx | 2 +- .../auth/components/testimonial.test.tsx | 2 +- .../modules/auth/components/testimonial.tsx | 4 +- .../page.tsx | 6 +- .../auth/forgot-password/actions.test.ts | 2 +- .../modules/auth/forgot-password/actions.ts | 6 +- .../components/forgot-password-form.tsx | 8 +- .../auth/forgot-password/reset/actions.ts | 6 +- .../components/reset-password-form.test.tsx | 2 +- .../reset/components/reset-password-form.tsx | 12 +- .../modules/auth/hooks/use-sign-out.test.tsx | 2 +- apps/web/modules/auth/hooks/use-sign-out.ts | 4 +- .../modules/auth/invite/lib/invite.test.ts | 2 +- apps/web/modules/auth/invite/lib/invite.ts | 2 +- apps/web/modules/auth/invite/lib/team.ts | 4 +- apps/web/modules/auth/invite/page.test.tsx | 2 +- apps/web/modules/auth/invite/page.tsx | 8 +- apps/web/modules/auth/layout.tsx | 6 +- apps/web/modules/auth/lib/brevo.test.ts | 2 +- apps/web/modules/auth/lib/brevo.ts | 4 +- apps/web/modules/auth/lib/user.ts | 2 +- apps/web/modules/auth/login/page.tsx | 2 +- .../page.test.tsx | 4 +- apps/web/modules/auth/signup/actions.ts | 6 +- .../signup/components/signup-form.test.tsx | 4 +- .../auth/signup/components/signup-form.tsx | 18 +- .../lib/__tests__/__mocks__/team-mocks.ts | 2 +- .../auth/signup/lib/__tests__/team.test.ts | 2 +- apps/web/modules/auth/signup/lib/invite.ts | 2 +- apps/web/modules/auth/signup/lib/team.ts | 4 +- apps/web/modules/auth/signup/page.test.tsx | 8 +- apps/web/modules/auth/signup/page.tsx | 2 +- .../verification-requested/actions.test.ts | 4 +- .../auth/verification-requested/actions.ts | 6 +- .../components/request-verification-email.tsx | 4 +- .../auth/verification-requested/page.test.tsx | 4 +- .../auth/verification-requested/page.tsx | 4 +- .../auth/verify-email-change/actions.ts | 2 +- .../components/email-change-sign-in.test.tsx | 2 +- .../components/email-change-sign-in.tsx | 2 +- .../rate-limit/rate-limit-configs.test.ts | 2 +- .../core/rate-limit/rate-limit-load.test.ts | 2 +- .../web/modules/core/rate-limit/rate-limit.ts | 4 +- apps/web/modules/ee/audit-logs/lib/handler.ts | 2 +- apps/web/modules/ee/audit-logs/lib/service.ts | 2 +- .../ee/auth/saml/api/authorize/route.ts | 4 +- .../ee/auth/saml/api/callback/route.ts | 2 +- .../modules/ee/auth/saml/api/token/route.ts | 2 +- .../auth/saml/api/userinfo/lib/utils.test.ts | 2 +- apps/web/modules/ee/auth/saml/lib/jackson.ts | 2 +- .../ee/auth/saml/lib/preload-connection.ts | 2 +- .../ee/auth/saml/lib/tests/jackson.test.ts | 4 +- .../saml/lib/tests/preload-connection.test.ts | 2 +- apps/web/modules/ee/billing/actions.ts | 6 +- .../api/lib/checkout-session-completed.ts | 4 +- .../api/lib/create-customer-portal-session.ts | 2 +- .../ee/billing/api/lib/create-subscription.ts | 4 +- .../ee/billing/api/lib/invoice-finalized.ts | 2 +- .../api/lib/is-subscription-cancelled.ts | 4 +- .../ee/billing/api/lib/stripe-webhook.ts | 4 +- .../lib/subscription-created-or-updated.ts | 6 +- .../billing/api/lib/subscription-deleted.ts | 4 +- apps/web/modules/ee/billing/api/route.ts | 2 +- .../ee/billing/components/billing-slider.tsx | 2 +- apps/web/modules/ee/billing/page.tsx | 2 +- .../components/attributes-section.test.tsx | 6 +- .../components/delete-contact-button.test.tsx | 2 +- .../components/delete-contact-button.tsx | 8 +- .../[contactId]/components/response-feed.tsx | 12 +- .../components/response-section.test.tsx | 14 +- .../components/response-section.tsx | 8 +- .../components/response-timeline.test.tsx | 2 +- .../components/response-timeline.tsx | 2 +- apps/web/modules/ee/contacts/actions.ts | 4 +- .../contacts/[userId]/attributes/route.ts | 8 +- .../contacts/[userId]/lib/attributes.ts | 2 +- .../[userId]/lib/person-state.test.ts | 6 +- .../contacts/[userId]/lib/person-state.ts | 6 +- .../contacts/[userId]/lib/segments.test.ts | 10 +- .../identify/contacts/[userId]/route.ts | 8 +- .../[environmentId]/user/lib/segments.test.ts | 4 +- .../user/lib/update-user.test.ts | 2 +- .../[environmentId]/user/lib/update-user.ts | 4 +- .../v1/client/[environmentId]/user/route.ts | 6 +- .../lib/contact-attribute-key.ts | 2 +- .../[contactAttributeKeyId]/route.ts | 4 +- .../lib/contact-attribute-keys.test.ts | 4 +- .../lib/contact-attribute-keys.ts | 4 +- .../contact-attribute-keys/route.ts | 6 +- .../v1/management/contact-attributes/route.ts | 2 +- .../contacts/[contactId]/lib/contact.ts | 4 +- .../v1/management/contacts/lib/contacts.ts | 4 +- .../api/v1/management/contacts/route.ts | 2 +- .../management/contacts/bulk/lib/contact.ts | 4 +- .../management/contacts/bulk/lib/openapi.ts | 4 +- .../contacts/bulk/lib/tests/contact.test.ts | 2 +- .../management/contacts/lib/contact.test.ts | 2 +- .../api/v2/management/contacts/lib/contact.ts | 4 +- .../api/v2/management/contacts/lib/openapi.ts | 2 +- .../api/v2/management/contacts/route.ts | 2 +- .../contacts/components/contact-data-view.tsx | 2 +- .../components/contact-table-column.tsx | 2 +- .../contacts-secondary-navigation.tsx | 2 +- .../ee/contacts/components/contacts-table.tsx | 24 +- .../upload-contacts-attribute-combobox.tsx | 4 +- .../components/upload-contacts-attribute.tsx | 4 +- apps/web/modules/ee/contacts/layout.tsx | 6 +- .../ee/contacts/lib/attributes.test.ts | 4 +- .../web/modules/ee/contacts/lib/attributes.ts | 6 +- .../ee/contacts/lib/contact-attributes.ts | 2 +- .../contacts/lib/contact-survey-link.test.ts | 6 +- .../ee/contacts/lib/contact-survey-link.ts | 6 +- apps/web/modules/ee/contacts/lib/contacts.ts | 10 +- .../web/modules/ee/contacts/lib/utils.test.ts | 2 +- apps/web/modules/ee/contacts/lib/utils.ts | 2 +- .../modules/ee/contacts/segments/actions.ts | 8 +- .../components/add-filter-modal.test.tsx | 2 +- .../segments/components/add-filter-modal.tsx | 8 +- .../components/create-segment-modal.test.tsx | 6 +- .../components/create-segment-modal.tsx | 16 +- .../components/edit-segment-modal.test.tsx | 2 +- .../components/edit-segment-modal.tsx | 10 +- .../components/segment-activity-tab.test.tsx | 4 +- .../components/segment-activity-tab.tsx | 4 +- .../components/segment-editor.test.tsx | 2 +- .../segments/components/segment-editor.tsx | 10 +- .../components/segment-filter.test.tsx | 4 +- .../components/segment-settings.test.tsx | 4 +- .../segments/components/segment-settings.tsx | 14 +- .../segment-table-data-row-container.test.tsx | 2 +- .../segment-table-data-row-container.tsx | 2 +- .../segments/components/segment-table.tsx | 2 +- .../components/targeting-card.test.tsx | 2 +- .../segments/components/targeting-card.tsx | 30 +- .../segments/lib/filter/prisma-query.ts | 2 +- .../ee/contacts/segments/lib/helper.test.ts | 4 +- .../ee/contacts/segments/lib/helper.ts | 4 +- .../ee/contacts/segments/lib/segments.test.ts | 6 +- .../ee/contacts/segments/lib/segments.ts | 6 +- .../modules/ee/contacts/segments/loading.tsx | 2 +- .../ee/contacts/segments/page.test.tsx | 8 +- apps/web/modules/ee/languages/loading.tsx | 2 +- .../ee/license-check/lib/utils.test.ts | 4 +- .../web/modules/ee/license-check/lib/utils.ts | 2 +- .../components/default-language-select.tsx | 6 +- .../components/edit-language.tsx | 10 +- .../components/language-indicator.tsx | 2 +- .../components/language-labels.tsx | 4 +- .../components/language-row.tsx | 4 +- .../components/language-select.tsx | 6 +- .../components/language-toggle.tsx | 4 +- .../components/multi-language-card.tsx | 16 +- .../ee/multi-language-surveys/lib/actions.ts | 8 +- apps/web/modules/ee/quotas/actions.ts | 8 +- .../components/ending-card-selector.tsx | 6 +- .../components/quota-condition-builder.tsx | 10 +- .../ee/quotas/components/quota-list.tsx | 6 +- .../ee/quotas/components/quota-modal.test.tsx | 2 +- .../ee/quotas/components/quota-modal.tsx | 34 +-- .../ee/quotas/components/quotas-card.test.tsx | 2 +- .../ee/quotas/components/quotas-card.tsx | 18 +- .../ee/quotas/components/quotas-summary.tsx | 2 +- .../single-response-card-quotas.tsx | 2 +- .../ee/quotas/lib/evaluation-service.test.ts | 2 +- .../ee/quotas/lib/evaluation-service.ts | 2 +- .../web/modules/ee/quotas/lib/helpers.test.ts | 2 +- apps/web/modules/ee/quotas/lib/quota-link.ts | 2 +- apps/web/modules/ee/quotas/lib/quotas.test.ts | 2 +- apps/web/modules/ee/quotas/lib/quotas.ts | 2 +- apps/web/modules/ee/quotas/lib/utils.test.ts | 6 +- apps/web/modules/ee/quotas/lib/utils.ts | 6 +- .../web/modules/ee/role-management/actions.ts | 8 +- .../components/add-member-role.tsx | 8 +- .../modules/ee/role-management/lib/invite.ts | 2 +- .../ee/role-management/lib/membership.ts | 2 +- .../ee/sso/components/azure-button.test.tsx | 2 +- .../ee/sso/components/azure-button.tsx | 6 +- .../ee/sso/components/github-button.test.tsx | 2 +- .../ee/sso/components/github-button.tsx | 4 +- .../ee/sso/components/google-button.test.tsx | 2 +- .../ee/sso/components/google-button.tsx | 4 +- .../ee/sso/components/open-id-button.test.tsx | 2 +- .../ee/sso/components/open-id-button.tsx | 6 +- .../ee/sso/components/saml-button.test.tsx | 4 +- .../modules/ee/sso/components/saml-button.tsx | 8 +- .../modules/ee/sso/components/sso-options.tsx | 2 +- apps/web/modules/ee/sso/lib/providers.ts | 8 +- apps/web/modules/ee/sso/lib/sso-handlers.ts | 10 +- apps/web/modules/ee/sso/lib/team.ts | 8 +- .../ee/sso/lib/tests/__mock__/team.mock.ts | 2 +- .../ee/sso/lib/tests/sso-handlers.test.ts | 6 +- .../web/modules/ee/sso/lib/tests/team.test.ts | 4 +- apps/web/modules/ee/teams/lib/roles.test.ts | 2 +- apps/web/modules/ee/teams/lib/roles.ts | 6 +- .../components/access-table.test.tsx | 4 +- .../project-teams/components/access-table.tsx | 2 +- .../components/access-view.test.tsx | 2 +- .../project-teams/components/access-view.tsx | 2 +- .../project-teams/components/manage-team.tsx | 4 +- .../ee/teams/project-teams/lib/team.ts | 4 +- .../ee/teams/project-teams/loading.tsx | 2 +- .../ee/teams/project-teams/page.test.tsx | 4 +- .../web/modules/ee/teams/team-list/actions.ts | 4 +- .../components/create-team-button.tsx | 4 +- .../components/create-team-modal.test.tsx | 4 +- .../components/create-team-modal.tsx | 10 +- .../components/manage-team-button.tsx | 2 +- .../team-settings/delete-team.test.tsx | 4 +- .../components/team-settings/delete-team.tsx | 8 +- .../team-settings-modal.test.tsx | 6 +- .../team-settings/team-settings-modal.tsx | 16 +- .../team-list/components/teams-table.test.tsx | 4 +- .../team-list/components/teams-table.tsx | 8 +- .../teams/team-list/components/teams-view.tsx | 2 +- .../modules/ee/teams/team-list/lib/project.ts | 4 +- .../ee/teams/team-list/lib/team.test.ts | 2 +- .../modules/ee/teams/team-list/lib/team.ts | 12 +- .../modules/ee/teams/team-list/types/team.ts | 2 +- .../web/modules/ee/two-factor-auth/actions.ts | 4 +- .../components/confirm-password-form.tsx | 10 +- .../disable-two-factor-modal.test.tsx | 2 +- .../components/disable-two-factor-modal.tsx | 16 +- .../components/display-backup-codes.tsx | 2 +- .../components/enable-two-factor-modal.tsx | 6 +- .../components/enter-code.test.tsx | 2 +- .../two-factor-auth/components/enter-code.tsx | 8 +- .../components/scan-qr-code.tsx | 2 +- .../components/two-factor-backup.tsx | 4 +- .../two-factor-auth/components/two-factor.tsx | 4 +- .../lib/two-factor-auth.test.ts | 6 +- .../ee/two-factor-auth/lib/two-factor-auth.ts | 8 +- .../whitelabel/email-customization/actions.ts | 6 +- .../email-customization/lib/organization.ts | 2 +- .../ee/whitelabel/remove-branding/actions.ts | 6 +- .../components/branding-settings-card.tsx | 2 +- .../components/edit-branding.tsx | 6 +- .../remove-branding/lib/project.test.ts | 2 +- .../whitelabel/remove-branding/lib/project.ts | 10 +- .../email/components/email-template.tsx | 2 +- .../emails/auth/forgot-password-email.tsx | 2 +- .../emails/auth/new-email-verification.tsx | 2 +- .../auth/password-reset-notify-email.tsx | 2 +- .../email/emails/auth/verification-email.tsx | 2 +- .../email-customization-preview-email.tsx | 2 +- .../emails/invite/invite-accepted-email.tsx | 2 +- .../email/emails/invite/invite-email.tsx | 2 +- apps/web/modules/email/emails/lib/utils.tsx | 2 +- .../survey/embed-survey-preview-email.tsx | 2 +- .../email/emails/survey/link-survey-email.tsx | 2 +- .../emails/survey/response-finished-email.tsx | 6 +- .../modules/environments/lib/utils.test.ts | 16 +- apps/web/modules/environments/lib/utils.ts | 6 +- .../environments/types/environment-auth.ts | 2 +- .../modules/integrations/webhooks/actions.ts | 4 +- .../components/add-webhook-button.tsx | 2 +- .../webhooks/components/add-webhook-modal.tsx | 18 +- .../components/survey-checkbox-group.tsx | 2 +- .../components/trigger-checkbox-group.tsx | 2 +- .../components/webhook-detail-modal.test.tsx | 2 +- .../components/webhook-detail-modal.tsx | 10 +- .../components/webhook-settings-tab.tsx | 16 +- .../webhooks/components/webhook-table.tsx | 4 +- .../integrations/webhooks/lib/webhook.ts | 4 +- apps/web/modules/organization/actions.ts | 6 +- .../CreateOrganizationModal/index.test.tsx | 2 +- .../CreateOrganizationModal/index.tsx | 12 +- .../modules/organization/lib/utils.test.ts | 4 +- apps/web/modules/organization/lib/utils.ts | 4 +- .../organization/settings/api-keys/actions.ts | 4 +- .../api-keys/components/add-api-key-modal.tsx | 14 +- .../api-keys/components/api-key-list.tsx | 2 +- .../components/view-permission-modal.tsx | 10 +- .../settings/api-keys/lib/projects.ts | 2 +- .../settings/api-keys/loading.tsx | 2 +- .../settings/api-keys/page.test.tsx | 6 +- .../organization/settings/teams/actions.ts | 10 +- .../edit-memberships/edit-memberships.tsx | 4 +- .../edit-memberships/member-actions.tsx | 14 +- .../edit-memberships/members-info.test.tsx | 6 +- .../edit-memberships/members-info.tsx | 6 +- .../organization-actions.test.tsx | 6 +- .../edit-memberships/organization-actions.tsx | 14 +- .../invite-member/bulk-invite-tab.tsx | 8 +- .../invite-member/individual-invite-tab.tsx | 18 +- .../invite-member/invite-member-modal.tsx | 6 +- .../invite-member/share-invite-modal.tsx | 6 +- .../teams/components/members-view.test.tsx | 6 +- .../teams/components/members-view.tsx | 6 +- .../settings/teams/lib/invite.test.ts | 2 +- .../organization/settings/teams/lib/invite.ts | 6 +- .../settings/teams/lib/membership.ts | 6 +- .../settings/teams/lib/utils.test.ts | 2 +- .../organization/settings/teams/page.test.tsx | 4 +- .../create-project-modal/index.test.tsx | 6 +- .../components/create-project-modal/index.tsx | 16 +- .../project-limit-modal/index.test.tsx | 2 +- .../components/project-limit-modal/index.tsx | 2 +- .../(setup)/app-connection/loading.tsx | 2 +- .../settings/(setup)/app-connection/page.tsx | 2 +- .../(setup)/components/ActionDetailModal.tsx | 4 +- .../(setup)/components/ActionRowData.test.tsx | 2 +- .../(setup)/components/ActionRowData.tsx | 4 +- .../(setup)/components/ActionSettingsTab.tsx | 16 +- .../(setup)/components/AddActionModal.tsx | 8 +- .../components/action-settings-card.tsx | 10 +- apps/web/modules/projects/settings/actions.ts | 8 +- .../project-config-navigation.test.tsx | 2 +- .../components/project-config-navigation.tsx | 2 +- .../projects/settings/general/actions.ts | 4 +- .../components/delete-project-render.tsx | 10 +- .../components/delete-project.test.tsx | 4 +- .../general/components/delete-project.tsx | 4 +- .../components/edit-project-name-form.tsx | 14 +- .../components/edit-waiting-time-form.tsx | 12 +- .../projects/settings/general/loading.tsx | 2 +- .../projects/settings/general/page.test.tsx | 4 +- .../modules/projects/settings/layout.test.tsx | 4 +- apps/web/modules/projects/settings/layout.tsx | 2 +- .../projects/settings/lib/project.test.ts | 4 +- .../modules/projects/settings/lib/project.ts | 6 +- .../modules/projects/settings/lib/tag.test.ts | 2 +- apps/web/modules/projects/settings/lib/tag.ts | 4 +- .../components/edit-placement-form.test.tsx | 4 +- .../look/components/edit-placement-form.tsx | 12 +- .../look/components/theme-styling.test.tsx | 2 +- .../look/components/theme-styling.tsx | 20 +- .../projects/settings/look/lib/project.ts | 2 +- .../projects/settings/look/loading.tsx | 2 +- .../projects/settings/look/page.test.tsx | 4 +- .../modules/projects/settings/tags/actions.ts | 4 +- .../tags/components/edit-tags-wrapper.tsx | 4 +- .../tags/components/merge-tags-combobox.tsx | 4 +- .../tags/components/single-tag.test.tsx | 8 +- .../settings/tags/components/single-tag.tsx | 12 +- .../projects/settings/tags/loading.tsx | 2 +- .../projects/settings/tags/page.test.tsx | 2 +- .../setup/(fresh-instance)/intro/page.tsx | 4 +- .../modules/setup/(fresh-instance)/layout.tsx | 4 +- .../(fresh-instance)/signup/page.test.tsx | 6 +- .../setup/(fresh-instance)/signup/page.tsx | 2 +- apps/web/modules/setup/layout.tsx | 2 +- .../[organizationId]/invite/actions.ts | 8 +- .../invite/components/invite-members.test.tsx | 2 +- .../invite/components/invite-members.tsx | 14 +- .../invite/lib/invite.test.ts | 4 +- .../[organizationId]/invite/lib/invite.ts | 4 +- .../[organizationId]/invite/page.test.tsx | 4 +- .../[organizationId]/invite/page.tsx | 8 +- .../components/create-organization.test.tsx | 2 +- .../create/components/create-organization.tsx | 8 +- .../removed-from-organization.test.tsx | 2 +- .../components/removed-from-organization.tsx | 6 +- .../setup/organization/create/page.test.tsx | 8 +- .../setup/organization/create/page.tsx | 8 +- apps/web/modules/storage/service.ts | 4 +- apps/web/modules/storage/utils.test.ts | 10 +- apps/web/modules/storage/utils.ts | 2 +- .../edit-public-survey-alert-dialog/index.tsx | 2 +- .../components/multi-lang-wrapper.test.tsx | 4 +- .../question-form-input/utils.test.ts | 4 +- .../components/question-form-input/utils.ts | 4 +- .../components/template-list/actions.ts | 6 +- .../start-from-scratch-template.test.tsx | 2 +- .../start-from-scratch-template.tsx | 6 +- .../components/template-filters.tsx | 2 +- .../components/template-tags.tsx | 4 +- .../template-list/components/template.tsx | 4 +- .../components/template-list/index.test.tsx | 2 +- .../survey/components/template-list/index.tsx | 4 +- .../template-list/lib/survey.test.ts | 14 +- .../components/template-list/lib/survey.ts | 10 +- .../template-list/lib/utils.test.ts | 4 +- .../components/template-list/lib/utils.ts | 4 +- apps/web/modules/survey/editor/actions.ts | 20 +- .../components/add-action-modal.test.tsx | 6 +- .../editor/components/add-action-modal.tsx | 8 +- .../components/add-question-button.test.tsx | 12 +- .../editor/components/add-question-button.tsx | 14 +- .../editor/components/advanced-settings.tsx | 2 +- .../editor/components/color-survey-bg.tsx | 2 +- .../contact-info-question-form.test.tsx | 2 +- .../components/create-new-action-tab.tsx | 14 +- .../editor/components/editor-card-menu.tsx | 24 +- .../file-upload-question-form.test.tsx | 2 +- .../components/form-styling-settings.tsx | 12 +- .../components/how-to-send-card.test.tsx | 2 +- .../editor/components/how-to-send-card.tsx | 12 +- .../components/logic-editor-actions.tsx | 26 +- .../components/open-question-form.test.tsx | 4 +- .../editor/components/option-ids.test.tsx | 2 +- .../survey/editor/components/option-ids.tsx | 6 +- .../picture-selection-form.test.tsx | 6 +- .../editor/components/placement.test.tsx | 2 +- .../survey/editor/components/placement.tsx | 4 +- .../editor/components/question-card.test.tsx | 2 +- .../components/questions-droppable.test.tsx | 2 +- .../components/recontact-options-card.tsx | 8 +- .../editor/components/redirect-url-form.tsx | 6 +- .../components/response-options-card.tsx | 12 +- .../editor/components/saved-actions-tab.tsx | 6 +- .../editor/components/settings-view.test.tsx | 2 +- .../editor/components/settings-view.tsx | 10 +- .../editor/components/styling-view.test.tsx | 2 +- .../survey/editor/components/styling-view.tsx | 18 +- .../editor/components/survey-editor-tabs.tsx | 4 +- .../editor/components/survey-editor.test.tsx | 4 +- .../components/survey-menu-bar.test.tsx | 8 +- .../editor/components/survey-menu-bar.tsx | 12 +- .../components/survey-placement-card.test.tsx | 2 +- .../components/survey-placement-card.tsx | 6 +- .../components/survey-variables-card.test.tsx | 2 +- .../components/survey-variables-card.tsx | 4 +- .../components/targeting-locked-card.test.tsx | 2 +- .../components/targeting-locked-card.tsx | 2 +- .../editor/components/unsplash-images.tsx | 6 +- .../editor/components/update-question-id.tsx | 6 +- .../components/when-to-send-card.test.tsx | 2 +- .../editor/components/when-to-send-card.tsx | 14 +- .../modules/survey/editor/lib/action-utils.ts | 2 +- .../editor/lib/shared-conditions-factory.ts | 20 +- .../modules/survey/editor/lib/survey.test.ts | 6 +- apps/web/modules/survey/editor/lib/survey.ts | 10 +- .../modules/survey/editor/lib/team.test.ts | 2 +- apps/web/modules/survey/editor/lib/team.ts | 2 +- .../follow-up-action-multi-email-input.tsx | 2 +- .../components/follow-up-email.test.tsx | 2 +- .../follow-ups/components/follow-up-email.tsx | 8 +- .../follow-ups/components/follow-up-item.tsx | 12 +- .../components/follow-up-modal.test.tsx | 2 +- .../follow-ups/components/follow-ups-view.tsx | 8 +- .../modules/survey/follow-ups/lib/email.ts | 4 +- .../survey/follow-ups/lib/follow-ups.test.ts | 8 +- .../survey/follow-ups/lib/follow-ups.ts | 18 +- .../survey/follow-ups/lib/utils.test.ts | 2 +- .../modules/survey/follow-ups/lib/utils.ts | 2 +- .../survey/hooks/useSingleUseId.test.tsx | 4 +- .../modules/survey/hooks/useSingleUseId.tsx | 6 +- .../modules/survey/lib/action-class.test.ts | 2 +- apps/web/modules/survey/lib/action-class.ts | 2 +- apps/web/modules/survey/lib/survey.ts | 2 +- apps/web/modules/survey/link/actions.ts | 6 +- .../link/components/link-survey-wrapper.tsx | 8 +- .../link/components/link-survey.test.tsx | 2 +- .../survey/link/components/link-survey.tsx | 10 +- .../link/components/pin-screen.test.tsx | 2 +- .../survey/link/components/pin-screen.tsx | 8 +- .../link/components/survey-inactive.tsx | 4 +- .../components/survey-loading-animation.tsx | 4 +- .../link/components/survey-renderer.test.tsx | 8 +- .../link/components/verify-email.test.tsx | 2 +- .../survey/link/contact-survey/page.test.tsx | 6 +- .../survey/link/contact-survey/page.tsx | 4 +- apps/web/modules/survey/link/lib/data.ts | 4 +- .../modules/survey/link/lib/helper.test.ts | 2 +- .../survey/link/lib/metadata-utils.test.ts | 4 +- .../modules/survey/link/lib/metadata-utils.ts | 2 +- .../modules/survey/link/lib/project.test.ts | 2 +- apps/web/modules/survey/link/lib/project.ts | 2 +- apps/web/modules/survey/link/metadata.test.ts | 2 +- apps/web/modules/survey/link/metadata.ts | 2 +- apps/web/modules/survey/link/page.test.tsx | 12 +- apps/web/modules/survey/link/page.tsx | 10 +- apps/web/modules/survey/list/actions.ts | 6 +- .../list/components/copy-survey-form.test.tsx | 4 +- .../list/components/copy-survey-form.tsx | 10 +- .../components/copy-survey-modal.test.tsx | 2 +- .../list/components/copy-survey-modal.tsx | 4 +- .../survey/list/components/sort-option.tsx | 2 +- .../list/components/survey-card.test.tsx | 2 +- .../survey/list/components/survey-card.tsx | 8 +- .../components/survey-copy-options.test.tsx | 6 +- .../list/components/survey-copy-options.tsx | 6 +- .../components/survey-dropdown-menu.test.tsx | 4 +- .../list/components/survey-dropdown-menu.tsx | 30 +- .../components/survey-filter-dropdown.tsx | 4 +- .../survey/list/components/survey-filters.tsx | 12 +- .../list/components/survey-list.test.tsx | 8 +- .../survey/list/components/survey-list.tsx | 10 +- .../survey/list/lib/environment.test.ts | 2 +- .../modules/survey/list/lib/environment.ts | 2 +- .../modules/survey/list/lib/project.test.ts | 4 +- apps/web/modules/survey/list/lib/project.ts | 4 +- .../modules/survey/list/lib/survey.test.ts | 12 +- apps/web/modules/survey/list/lib/survey.ts | 16 +- apps/web/modules/survey/list/loading.tsx | 2 +- apps/web/modules/survey/list/page.test.tsx | 2 +- apps/web/modules/survey/list/page.tsx | 8 +- .../templates/components/back-button.tsx | 2 +- .../components/template-container.tsx | 8 +- .../survey/templates/lib/minimal-survey.ts | 2 +- apps/web/modules/survey/templates/page.tsx | 2 +- .../action-name-description-fields/index.tsx | 4 +- .../ui/components/alert-dialog/index.test.tsx | 2 +- .../web/modules/ui/components/alert/index.tsx | 2 +- .../background-styling-card/index.tsx | 10 +- .../survey-bg-selector-tab.tsx | 6 +- .../modules/ui/components/button/index.tsx | 2 +- .../modules/ui/components/calendar/index.tsx | 2 +- .../card-arrangement-tabs/index.tsx | 6 +- .../card-styling-settings/index.tsx | 16 +- apps/web/modules/ui/components/card/index.tsx | 2 +- .../modules/ui/components/checkbox/index.tsx | 2 +- .../ui/components/client-logo/index.tsx | 2 +- .../components/client-logout/index.test.tsx | 2 +- .../ui/components/client-logout/index.tsx | 2 +- .../ui/components/code-action-form/index.tsx | 4 +- .../ui/components/code-block/index.tsx | 2 +- .../components/popover-picker.tsx | 2 +- .../ui/components/color-picker/index.tsx | 2 +- .../ui/components/command/index.test.tsx | 2 +- .../modules/ui/components/command/index.tsx | 6 +- .../ui/components/conditions-editor/index.tsx | 10 +- .../ui/components/conditions-editor/types.ts | 2 +- .../confirm-delete-segment-modal/index.tsx | 6 +- .../components/confirmation-modal/index.tsx | 6 +- .../components/connect-integration/index.tsx | 4 +- .../components/data-table-header.tsx | 4 +- .../data-table-settings-modal-item.tsx | 2 +- .../components/data-table-settings-modal.tsx | 16 +- .../components/data-table-toolbar.tsx | 4 +- .../components/selection-column.tsx | 2 +- .../ui/components/date-picker/index.tsx | 6 +- .../decrement-quotas-checkbox/index.tsx | 2 +- .../ui/components/delete-dialog/index.tsx | 4 +- .../modules/ui/components/dialog/index.tsx | 2 +- .../ui/components/dropdown-menu/index.tsx | 2 +- .../ui/components/dropdown-selector/index.tsx | 2 +- .../components/add-variables-dropdown.tsx | 2 +- .../components/empty-space-filler/index.tsx | 2 +- .../components/environment-notice/index.tsx | 2 +- .../environmentId-base-layout/index.tsx | 6 +- .../file-input/components/uploader.test.tsx | 2 +- .../file-input/components/uploader.tsx | 4 +- .../file-input/components/video-settings.tsx | 6 +- .../ui/components/file-input/lib/actions.ts | 2 +- .../components/file-upload-response/index.tsx | 2 +- apps/web/modules/ui/components/form/index.tsx | 2 +- .../ui/components/go-back-button/index.tsx | 2 +- .../modules/ui/components/iconbar/index.tsx | 2 +- .../ui/components/input-combo-box/index.tsx | 24 +- .../web/modules/ui/components/input/index.tsx | 2 +- .../ui/components/integration-card/index.tsx | 2 +- .../web/modules/ui/components/label/index.tsx | 2 +- .../limits-reached-banner/index.tsx | 3 +- .../components/load-segment-modal/index.tsx | 6 +- .../ui/components/modal-with-tabs/index.tsx | 2 +- .../ui/components/multi-select/badge.tsx | 2 +- .../ui/components/multi-select/index.tsx | 4 +- .../components/css-selector.tsx | 6 +- .../components/inner-html-selector.tsx | 6 +- .../components/page-url-selector.test.tsx | 2 +- .../components/page-url-selector.tsx | 28 +- .../components/no-code-action-form/index.tsx | 8 +- .../ui/components/option-card/index.tsx | 2 +- .../modules/ui/components/otp-input/index.tsx | 2 +- .../ui/components/page-header/stories.tsx | 2 +- .../ui/components/password-input/index.tsx | 2 +- .../picture-selection-response/index.tsx | 2 +- .../modules/ui/components/popover/index.tsx | 2 +- .../preview-survey/components/modal.tsx | 2 +- .../ui/components/preview-survey/index.tsx | 8 +- .../question-toggle-table/index.tsx | 4 +- .../ui/components/radio-group/index.tsx | 2 +- .../ui/components/rating-response/index.tsx | 2 +- .../reset-progress-button/index.tsx | 2 +- .../ui/components/response-badges/index.tsx | 2 +- .../save-as-new-segment-modal/index.tsx | 14 +- .../ui/components/search-bar/index.tsx | 2 +- .../components/secondary-navigation/index.tsx | 2 +- .../modules/ui/components/select/index.tsx | 2 +- .../modules/ui/components/separator/index.tsx | 2 +- .../web/modules/ui/components/sheet/index.tsx | 2 +- .../shuffle-option-select/index.tsx | 14 +- .../modules/ui/components/sidebar/index.tsx | 8 +- .../modules/ui/components/slider/index.tsx | 2 +- .../ui/components/styling-tabs/index.tsx | 2 +- .../survey-status-indicator/index.tsx | 2 +- .../modules/ui/components/survey/index.tsx | 2 +- .../modules/ui/components/switch/index.tsx | 2 +- .../ui/components/tab-toggle/index.tsx | 2 +- .../web/modules/ui/components/table/index.tsx | 2 +- apps/web/modules/ui/components/tabs/index.tsx | 2 +- apps/web/modules/ui/components/tag/index.tsx | 2 +- .../ui/components/tags-combobox/index.tsx | 4 +- .../theme-styling-preview-survey/index.tsx | 10 +- .../modules/ui/components/tooltip/index.tsx | 2 +- .../ui/components/typography/index.tsx | 2 +- .../ui/components/upgrade-prompt/index.tsx | 2 +- apps/web/modules/utils/hooks/actions.ts | 4 +- .../playwright/api/management/webhook.spec.ts | 2 +- .../api/organization/project-team.spec.ts | 2 +- .../playwright/api/organization/team.spec.ts | 2 +- .../playwright/api/organization/user.spec.ts | 2 +- apps/web/playwright/api/role.spec.ts | 2 +- apps/web/sentry.edge.config.ts | 2 +- apps/web/sentry.server.config.ts | 2 +- apps/web/tolgee/language.ts | 2 +- helm-chart/README.md | 275 +++++++++--------- packages/cache/.cursor/rules/cache-package.md | 61 ++-- .../src/components/buttons/back-button.tsx | 2 +- .../src/components/general/cal-embed.tsx | 2 +- .../src/components/general/ending-card.tsx | 10 +- .../general/error-component.test.tsx | 2 +- .../components/general/error-component.tsx | 2 +- .../src/components/general/file-input.tsx | 6 +- .../surveys/src/components/general/input.tsx | 2 +- .../components/general/language-switch.tsx | 10 +- .../src/components/general/progress-bar.tsx | 4 +- .../general/question-conditional.tsx | 20 +- .../general/question-media.test.tsx | 2 +- .../src/components/general/question-media.tsx | 4 +- .../src/components/general/render-survey.tsx | 2 +- .../general/response-error-component.tsx | 4 +- .../general/survey-close-button.tsx | 4 +- .../questions/address-question.test.tsx | 2 +- .../components/questions/address-question.tsx | 8 +- .../src/components/questions/cal-question.tsx | 8 +- .../questions/contact-info-question.test.tsx | 2 +- .../questions/contact-info-question.tsx | 6 +- .../components/questions/date-question.tsx | 12 +- .../questions/file-upload-question.tsx | 12 +- .../questions/matrix-question.test.tsx | 2 +- .../questions/nps-question.test.tsx | 2 +- .../src/components/questions/nps-question.tsx | 6 +- .../questions/picture-selection-question.tsx | 8 +- .../components/questions/rating-question.tsx | 8 +- .../wrappers/auto-close-wrapper.test.tsx | 2 +- .../wrappers/auto-close-wrapper.tsx | 2 +- .../wrappers/scrollable-container.tsx | 2 +- .../wrappers/stacked-cards-container.tsx | 2 +- .../components/wrappers/survey-container.tsx | 2 +- packages/surveys/src/index.ts | 4 +- packages/surveys/src/lib/api-client.ts | 2 +- packages/surveys/src/lib/response-queue.ts | 4 +- .../surveys/src/lib/response.queue.test.ts | 2 +- packages/surveys/src/lib/styles.ts | 6 +- playwright.config.ts | 4 +- 1076 files changed, 3018 insertions(+), 2991 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 2e45d4b8c0..c2edec8552 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -16,17 +16,17 @@ When generating test files inside the "/app/web" path, follow these rules: - When using "screen.getByText" check for the tolgee string if it is being used in the file. - The types for mocked variables can be found in the "packages/types" path. Be sure that every imported type exists before using it. Don't create types that are not already in the codebase. - When mocking data check if the properties added are part of the type of the object being mocked. Only specify known properties, don't use properties that are not part of the type. - + If it's a test for a ".tsx" file, follow these extra instructions: - Add this code inside the "describe" block and before any test: afterEach(() => { - cleanup(); +cleanup(); }); - The "afterEach" function should only have the "cleanup()" line inside it and should be adde to the "vitest" imports. - For click events, import userEvent from "@testing-library/user-event" - Mock other components that can make the text more complex and but at the same time mocking it wouldn't make the test flaky. It's ok to leave basic and simple components. - You don't need to mock @tolgee/react -- Use "import "@testing-library/jest-dom/vitest";" \ No newline at end of file +- Use "import "@testing-library/jest-dom/vitest";" diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/ConnectWithFormbricks.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/ConnectWithFormbricks.tsx index 4adb4efa7f..6ea3a154e7 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/ConnectWithFormbricks.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/ConnectWithFormbricks.tsx @@ -1,13 +1,13 @@ "use client"; -import { cn } from "@/lib/cn"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { ArrowRight } from "lucide-react"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TProjectConfigChannel } from "@formbricks/types/project"; +import { cn } from "@/lib/cn"; +import { Button } from "@/modules/ui/components/button"; import { OnboardingSetupInstructions } from "./OnboardingSetupInstructions"; interface ConnectWithFormbricksProps { diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/OnboardingSetupInstructions.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/OnboardingSetupInstructions.tsx index 5cec685a3a..404b10ce41 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/OnboardingSetupInstructions.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/components/OnboardingSetupInstructions.tsx @@ -1,15 +1,15 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { CodeBlock } from "@/modules/ui/components/code-block"; -import { Html5Icon, NpmIcon } from "@/modules/ui/components/icons"; -import { TabBar } from "@/modules/ui/components/tab-bar"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; import "prismjs/themes/prism.css"; import { useState } from "react"; import toast from "react-hot-toast"; import { TProjectConfigChannel } from "@formbricks/types/project"; +import { Button } from "@/modules/ui/components/button"; +import { CodeBlock } from "@/modules/ui/components/code-block"; +import { Html5Icon, NpmIcon } from "@/modules/ui/components/icons"; +import { TabBar } from "@/modules/ui/components/tab-bar"; const tabs = [ { id: "html", label: "HTML", icon: }, diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/page.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/page.tsx index 9501019709..06797604ee 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/page.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/connect/page.tsx @@ -1,3 +1,5 @@ +import { XIcon } from "lucide-react"; +import Link from "next/link"; import { ConnectWithFormbricks } from "@/app/(app)/(onboarding)/environments/[environmentId]/connect/components/ConnectWithFormbricks"; import { getEnvironment } from "@/lib/environment/service"; import { getPublicDomain } from "@/lib/getPublicUrl"; @@ -5,8 +7,6 @@ import { getProjectByEnvironmentId } from "@/lib/project/service"; import { Button } from "@/modules/ui/components/button"; import { Header } from "@/modules/ui/components/header"; import { getTranslate } from "@/tolgee/server"; -import { XIcon } from "lucide-react"; -import Link from "next/link"; interface ConnectPageProps { params: Promise<{ diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.test.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.test.tsx index a74d0204df..155021d98b 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.test.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.test.tsx @@ -1,8 +1,8 @@ -import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import OnboardingLayout from "./layout"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.tsx index ad9c6e813c..fe30ddd901 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/layout.tsx @@ -1,8 +1,8 @@ -import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; -import { authOptions } from "@/modules/auth/lib/authOptions"; import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; import { AuthorizationError } from "@formbricks/types/errors"; +import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; +import { authOptions } from "@/modules/auth/lib/authOptions"; const OnboardingLayout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.test.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.test.tsx index b6c2fc6385..9fa830e912 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.test.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.test.tsx @@ -1,9 +1,9 @@ -import { createSurveyAction } from "@/modules/survey/components/template-list/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { createSurveyAction } from "@/modules/survey/components/template-list/actions"; import { XMTemplateList } from "./XMTemplateList"; // Prepare push mock and module mocks before importing component diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.tsx index 1856d8e6a2..3726befc98 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList.tsx @@ -1,10 +1,5 @@ "use client"; -import { replacePresetPlaceholders } from "@/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/utils"; -import { getXMTemplates } from "@/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/xm-templates"; -import { OnboardingOptionsContainer } from "@/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { createSurveyAction } from "@/modules/survey/components/template-list/actions"; import { useTranslate } from "@tolgee/react"; import { ActivityIcon, ShoppingCartIcon, SmileIcon, StarIcon, ThumbsUpIcon, UsersIcon } from "lucide-react"; import { useRouter } from "next/navigation"; @@ -14,6 +9,11 @@ import { TProject } from "@formbricks/types/project"; import { TSurveyCreateInput } from "@formbricks/types/surveys/types"; import { TXMTemplate } from "@formbricks/types/templates"; import { TUser } from "@formbricks/types/user"; +import { replacePresetPlaceholders } from "@/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/utils"; +import { getXMTemplates } from "@/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/xm-templates"; +import { OnboardingOptionsContainer } from "@/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { createSurveyAction } from "@/modules/survey/components/template-list/actions"; interface XMTemplateListProps { project: TProject; diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/utils.ts b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/utils.ts index f45fdc11bf..5f5e4c170b 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/utils.ts +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/lib/utils.ts @@ -1,6 +1,6 @@ -import { replaceQuestionPresetPlaceholders } from "@/lib/utils/templates"; import { TProject } from "@formbricks/types/project"; import { TXMTemplate } from "@formbricks/types/templates"; +import { replaceQuestionPresetPlaceholders } from "@/lib/utils/templates"; // replace all occurences of projectName with the actual project name in the current template export const replacePresetPlaceholders = (template: TXMTemplate, project: TProject) => { diff --git a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/page.tsx b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/page.tsx index bed5a872ca..a7f02c7f25 100644 --- a/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/page.tsx +++ b/apps/web/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/page.tsx @@ -1,3 +1,6 @@ +import { XIcon } from "lucide-react"; +import { getServerSession } from "next-auth"; +import Link from "next/link"; import { XMTemplateList } from "@/app/(app)/(onboarding)/environments/[environmentId]/xm-templates/components/XMTemplateList"; import { getEnvironment } from "@/lib/environment/service"; import { getProjectByEnvironmentId, getUserProjects } from "@/lib/project/service"; @@ -7,9 +10,6 @@ import { authOptions } from "@/modules/auth/lib/authOptions"; import { Button } from "@/modules/ui/components/button"; import { Header } from "@/modules/ui/components/header"; import { getTranslate } from "@/tolgee/server"; -import { XIcon } from "lucide-react"; -import { getServerSession } from "next-auth"; -import Link from "next/link"; interface XMTemplatePageProps { params: Promise<{ diff --git a/apps/web/app/(app)/(onboarding)/lib/onboarding.ts b/apps/web/app/(app)/(onboarding)/lib/onboarding.ts index fb6bd66618..998fdb501e 100644 --- a/apps/web/app/(app)/(onboarding)/lib/onboarding.ts +++ b/apps/web/app/(app)/(onboarding)/lib/onboarding.ts @@ -1,12 +1,12 @@ "use server"; -import { TOrganizationTeam } from "@/app/(app)/(onboarding)/types/onboarding"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { TOrganizationTeam } from "@/app/(app)/(onboarding)/types/onboarding"; +import { validateInputs } from "@/lib/utils/validate"; export const getTeamsByOrganizationId = reactCache( async (organizationId: string): Promise => { diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.test.tsx index ff66ea3e34..511f89637e 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.test.tsx @@ -1,11 +1,11 @@ -import { getEnvironments } from "@/lib/environment/service"; -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { getUserProjects } from "@/lib/project/service"; import "@testing-library/jest-dom/vitest"; import { cleanup } from "@testing-library/preact"; import { getServerSession } from "next-auth"; import { notFound, redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getEnvironments } from "@/lib/environment/service"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { getUserProjects } from "@/lib/project/service"; import LandingLayout from "./layout"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.tsx index 54c40b9ae4..e635d06efe 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/layout.tsx @@ -1,9 +1,9 @@ +import { getServerSession } from "next-auth"; +import { notFound, redirect } from "next/navigation"; import { getEnvironments } from "@/lib/environment/service"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getUserProjects } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; -import { getServerSession } from "next-auth"; -import { notFound, redirect } from "next/navigation"; const LandingLayout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.test.tsx index ada3edd473..28a797e172 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.test.tsx @@ -1,12 +1,12 @@ +import "@testing-library/jest-dom/vitest"; +import { cleanup, render, screen } from "@testing-library/react"; +import { notFound, redirect } from "next/navigation"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getOrganizationsByUserId } from "@/lib/organization/service"; import { getUser } from "@/lib/user/service"; import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import { getTranslate } from "@/tolgee/server"; -import "@testing-library/jest-dom/vitest"; -import { cleanup, render, screen } from "@testing-library/react"; -import { notFound, redirect } from "next/navigation"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; vi.mock("@/modules/ee/license-check/lib/license", () => ({ getEnterpriseLicense: vi.fn().mockResolvedValue({ diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.tsx index 9d669de9d0..cc95e1a9a5 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/landing/page.tsx @@ -1,3 +1,4 @@ +import { notFound, redirect } from "next/navigation"; import { LandingSidebar } from "@/app/(app)/(onboarding)/organizations/[organizationId]/landing/components/landing-sidebar"; import { ProjectAndOrgSwitch } from "@/app/(app)/environments/[environmentId]/components/project-and-org-switch"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; @@ -9,7 +10,6 @@ import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import { Header } from "@/modules/ui/components/header"; import { getTranslate } from "@/tolgee/server"; -import { notFound, redirect } from "next/navigation"; const Page = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.test.tsx index d055ba8dd6..d2b2ce7ce4 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.test.tsx @@ -1,6 +1,3 @@ -import { canUserAccessOrganization } from "@/lib/organization/auth"; -import { getOrganization } from "@/lib/organization/service"; -import { getUser } from "@/lib/user/service"; import "@testing-library/jest-dom/vitest"; import { act, cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; @@ -9,6 +6,9 @@ import React from "react"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TUser } from "@formbricks/types/user"; +import { canUserAccessOrganization } from "@/lib/organization/auth"; +import { getOrganization } from "@/lib/organization/service"; +import { getUser } from "@/lib/user/service"; import ProjectOnboardingLayout from "./layout"; // Mock all the modules and functions that this layout uses: diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.tsx index ecbf50a87f..bf6ded3b4a 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/layout.tsx @@ -1,3 +1,6 @@ +import { getServerSession } from "next-auth"; +import { redirect } from "next/navigation"; +import { AuthorizationError } from "@formbricks/types/errors"; import { PosthogIdentify } from "@/app/(app)/environments/[environmentId]/components/PosthogIdentify"; import { IS_POSTHOG_CONFIGURED } from "@/lib/constants"; import { canUserAccessOrganization } from "@/lib/organization/auth"; @@ -6,9 +9,6 @@ import { getUser } from "@/lib/user/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { ToasterClient } from "@/modules/ui/components/toaster-client"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { redirect } from "next/navigation"; -import { AuthorizationError } from "@formbricks/types/errors"; const ProjectOnboardingLayout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.test.tsx index 5bf53e2d43..e5d0d06bf7 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.test.tsx @@ -1,10 +1,10 @@ -import { getUserProjects } from "@/lib/project/service"; -import { getOrganizationAuth } from "@/modules/organization/lib/utils"; -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getUserProjects } from "@/lib/project/service"; +import { getOrganizationAuth } from "@/modules/organization/lib/utils"; +import { getTranslate } from "@/tolgee/server"; import Page from "./page"; const mockTranslate = vi.fn((key) => key); diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.tsx index 13da215193..fae54bef27 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/channel/page.tsx @@ -1,12 +1,12 @@ +import { PictureInPicture2Icon, SendIcon, XIcon } from "lucide-react"; +import Link from "next/link"; +import { redirect } from "next/navigation"; import { OnboardingOptionsContainer } from "@/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer"; import { getUserProjects } from "@/lib/project/service"; import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import { Button } from "@/modules/ui/components/button"; import { Header } from "@/modules/ui/components/header"; import { getTranslate } from "@/tolgee/server"; -import { PictureInPicture2Icon, SendIcon, XIcon } from "lucide-react"; -import Link from "next/link"; -import { redirect } from "next/navigation"; interface ChannelPageProps { params: Promise<{ diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.test.tsx index c99156edb8..edb314c62c 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.test.tsx @@ -1,7 +1,3 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { getOrganization } from "@/lib/organization/service"; -import { getOrganizationProjectsCount } from "@/lib/project/service"; -import { getOrganizationProjectsLimit } from "@/modules/ee/license-check/lib/utils"; import "@testing-library/jest-dom/vitest"; import { cleanup } from "@testing-library/react"; import { getServerSession } from "next-auth"; @@ -9,6 +5,10 @@ import { notFound, redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TMembership } from "@formbricks/types/memberships"; import { TOrganization } from "@formbricks/types/organizations"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { getOrganization } from "@/lib/organization/service"; +import { getOrganizationProjectsCount } from "@/lib/project/service"; +import { getOrganizationProjectsLimit } from "@/modules/ee/license-check/lib/utils"; import OnboardingLayout from "./layout"; // Mock environment variables diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.tsx index 191bc448db..91eac2e6ba 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/layout.tsx @@ -1,3 +1,5 @@ +import { getServerSession } from "next-auth"; +import { notFound, redirect } from "next/navigation"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getAccessFlags } from "@/lib/membership/utils"; import { getOrganization } from "@/lib/organization/service"; @@ -5,8 +7,6 @@ import { getOrganizationProjectsCount } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getOrganizationProjectsLimit } from "@/modules/ee/license-check/lib/utils"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { notFound, redirect } from "next/navigation"; const OnboardingLayout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.test.tsx index b7b71e1c64..5a1f60e908 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.test.tsx @@ -1,10 +1,10 @@ -import { getUserProjects } from "@/lib/project/service"; -import { getOrganizationAuth } from "@/modules/organization/lib/utils"; -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getUserProjects } from "@/lib/project/service"; +import { getOrganizationAuth } from "@/modules/organization/lib/utils"; +import { getTranslate } from "@/tolgee/server"; import Page from "./page"; const mockTranslate = vi.fn((key) => key); diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.tsx index f572d023de..53ba6e443c 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/mode/page.tsx @@ -1,12 +1,12 @@ +import { HeartIcon, ListTodoIcon, XIcon } from "lucide-react"; +import Link from "next/link"; +import { redirect } from "next/navigation"; import { OnboardingOptionsContainer } from "@/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer"; import { getUserProjects } from "@/lib/project/service"; import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import { Button } from "@/modules/ui/components/button"; import { Header } from "@/modules/ui/components/header"; import { getTranslate } from "@/tolgee/server"; -import { HeartIcon, ListTodoIcon, XIcon } from "lucide-react"; -import Link from "next/link"; -import { redirect } from "next/navigation"; interface ModePageProps { params: Promise<{ diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.test.tsx index 56e929042d..d8c8ad9850 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.test.tsx @@ -1,9 +1,9 @@ -import { createProjectAction } from "@/app/(app)/environments/[environmentId]/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { toast } from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { createProjectAction } from "@/app/(app)/environments/[environmentId]/actions"; import { ProjectSettings } from "./ProjectSettings"; // Mocks before imports diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.tsx index ac8b023dc6..5449748cbb 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings.tsx @@ -1,5 +1,19 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import Image from "next/image"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import { toast } from "react-hot-toast"; +import { + TProjectConfigChannel, + TProjectConfigIndustry, + TProjectMode, + TProjectUpdateInput, + ZProjectUpdateInput, +} from "@formbricks/types/project"; import { createProjectAction } from "@/app/(app)/environments/[environmentId]/actions"; import { previewSurvey } from "@/app/lib/templates"; import { FORMBRICKS_SURVEYS_FILTERS_KEY_LS } from "@/lib/localStorage"; @@ -20,20 +34,6 @@ import { import { Input } from "@/modules/ui/components/input"; import { MultiSelect } from "@/modules/ui/components/multi-select"; import { SurveyInline } from "@/modules/ui/components/survey"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import Image from "next/image"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { toast } from "react-hot-toast"; -import { - TProjectConfigChannel, - TProjectConfigIndustry, - TProjectMode, - TProjectUpdateInput, - ZProjectUpdateInput, -} from "@formbricks/types/project"; interface ProjectSettingsProps { organizationId: string; diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.test.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.test.tsx index bfb4ef9aaf..e56b49209f 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.test.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.test.tsx @@ -1,11 +1,11 @@ -import { getTeamsByOrganizationId } from "@/app/(app)/(onboarding)/lib/onboarding"; -import { getUserProjects } from "@/lib/project/service"; -import { getAccessControlPermission } from "@/modules/ee/license-check/lib/utils"; -import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getTeamsByOrganizationId } from "@/app/(app)/(onboarding)/lib/onboarding"; +import { getUserProjects } from "@/lib/project/service"; +import { getAccessControlPermission } from "@/modules/ee/license-check/lib/utils"; +import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ DEFAULT_BRAND_COLOR: "#fff" })); diff --git a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.tsx b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.tsx index cdd755bd94..6f6dc875a3 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/page.tsx @@ -1,3 +1,7 @@ +import { XIcon } from "lucide-react"; +import Link from "next/link"; +import { redirect } from "next/navigation"; +import { TProjectConfigChannel, TProjectConfigIndustry, TProjectMode } from "@formbricks/types/project"; import { getTeamsByOrganizationId } from "@/app/(app)/(onboarding)/lib/onboarding"; import { ProjectSettings } from "@/app/(app)/(onboarding)/organizations/[organizationId]/projects/new/settings/components/ProjectSettings"; import { DEFAULT_BRAND_COLOR } from "@/lib/constants"; @@ -7,10 +11,6 @@ import { getOrganizationAuth } from "@/modules/organization/lib/utils"; import { Button } from "@/modules/ui/components/button"; import { Header } from "@/modules/ui/components/header"; import { getTranslate } from "@/tolgee/server"; -import { XIcon } from "lucide-react"; -import Link from "next/link"; -import { redirect } from "next/navigation"; -import { TProjectConfigChannel, TProjectConfigIndustry, TProjectMode } from "@formbricks/types/project"; interface ProjectSettingsPageProps { params: Promise<{ diff --git a/apps/web/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer.tsx b/apps/web/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer.tsx index 1ef248622d..eac172c388 100644 --- a/apps/web/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer.tsx +++ b/apps/web/app/(app)/(onboarding)/organizations/components/OnboardingOptionsContainer.tsx @@ -1,7 +1,7 @@ -import { OptionCard } from "@/modules/ui/components/option-card"; import { LucideProps } from "lucide-react"; import Link from "next/link"; import { ForwardRefExoticComponent, RefAttributes } from "react"; +import { OptionCard } from "@/modules/ui/components/option-card"; interface OnboardingOptionsContainerProps { options: { diff --git a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.test.tsx b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.test.tsx index 97041bcd13..00a729b94a 100644 --- a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.test.tsx +++ b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.test.tsx @@ -1,5 +1,3 @@ -import { getEnvironment } from "@/lib/environment/service"; -import { environmentIdLayoutChecks } from "@/modules/environments/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { Session } from "next-auth"; import { redirect } from "next/navigation"; @@ -7,6 +5,8 @@ import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TOrganization } from "@formbricks/types/organizations"; import { TUser } from "@formbricks/types/user"; +import { getEnvironment } from "@/lib/environment/service"; +import { environmentIdLayoutChecks } from "@/modules/environments/lib/utils"; import SurveyEditorEnvironmentLayout from "./layout"; // Mock sub-components to render identifiable elements diff --git a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.tsx b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.tsx index a1bf4cb53c..7311ef319e 100644 --- a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.tsx +++ b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/layout.tsx @@ -1,7 +1,7 @@ +import { redirect } from "next/navigation"; import { getEnvironment } from "@/lib/environment/service"; import { environmentIdLayoutChecks } from "@/modules/environments/lib/utils"; import { EnvironmentIdBaseLayout } from "@/modules/ui/components/environmentId-base-layout"; -import { redirect } from "next/navigation"; const SurveyEditorEnvironmentLayout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/billing-confirmation/components/ConfirmationPage.tsx b/apps/web/app/(app)/billing-confirmation/components/ConfirmationPage.tsx index 5efe541992..0f5292991d 100644 --- a/apps/web/app/(app)/billing-confirmation/components/ConfirmationPage.tsx +++ b/apps/web/app/(app)/billing-confirmation/components/ConfirmationPage.tsx @@ -1,10 +1,10 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { Confetti } from "@/modules/ui/components/confetti"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; import { useEffect, useState } from "react"; +import { Button } from "@/modules/ui/components/button"; +import { Confetti } from "@/modules/ui/components/confetti"; interface ConfirmationPageProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/[contactId]/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/[contactId]/page.test.tsx index 0076f2b961..e5b53319b9 100644 --- a/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/[contactId]/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/[contactId]/page.test.tsx @@ -1,5 +1,5 @@ -import { SingleContactPage } from "@/modules/ee/contacts/[contactId]/page"; import { describe, expect, test, vi } from "vitest"; +import { SingleContactPage } from "@/modules/ee/contacts/[contactId]/page"; import Page from "./page"; // mock constants diff --git a/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/page.test.tsx index 921bf9edf3..c8403dce57 100644 --- a/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/(contacts)/contacts/page.test.tsx @@ -1,5 +1,5 @@ -import { ContactsPage } from "@/modules/ee/contacts/page"; import { describe, expect, test, vi } from "vitest"; +import { ContactsPage } from "@/modules/ee/contacts/page"; import Page from "./page"; // Mock the actual ContactsPage component diff --git a/apps/web/app/(app)/environments/[environmentId]/actions.ts b/apps/web/app/(app)/environments/[environmentId]/actions.ts index b5ac06ec76..1eae68d0d3 100644 --- a/apps/web/app/(app)/environments/[environmentId]/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { ZProjectUpdateInput } from "@formbricks/types/project"; import { getOrganization } from "@/lib/organization/service"; import { getOrganizationProjectsCount } from "@/lib/project/service"; import { updateUser } from "@/lib/user/service"; @@ -12,10 +16,6 @@ import { getOrganizationProjectsLimit, } from "@/modules/ee/license-check/lib/utils"; import { createProject } from "@/modules/projects/settings/lib/project"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { ZProjectUpdateInput } from "@formbricks/types/project"; const ZCreateProjectAction = z.object({ organizationId: ZId, diff --git a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.test.tsx index c01fd7e46d..e33fa11b36 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.test.tsx @@ -1,3 +1,11 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import type { Session } from "next-auth"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TMembership } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; +import { TProject } from "@formbricks/types/project"; +import { TUser } from "@formbricks/types/user"; import { getOrganizationsByUserId } from "@/app/(app)/environments/[environmentId]/lib/organization"; import { getProjectsByUserId } from "@/app/(app)/environments/[environmentId]/lib/project"; import { getEnvironment, getEnvironments } from "@/lib/environment/service"; @@ -15,14 +23,6 @@ import { } from "@/modules/ee/license-check/lib/utils"; import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; import { getTeamsByOrganizationId } from "@/modules/ee/teams/team-list/lib/team"; -import { cleanup, render, screen } from "@testing-library/react"; -import type { Session } from "next-auth"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TMembership } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; -import { TProject } from "@formbricks/types/project"; -import { TUser } from "@formbricks/types/user"; // Mock services and utils vi.mock("@/lib/environment/service", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.tsx b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.tsx index 38fbbea3b9..d546db9c9a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentLayout.tsx @@ -1,3 +1,4 @@ +import type { Session } from "next-auth"; import { MainNavigation } from "@/app/(app)/environments/[environmentId]/components/MainNavigation"; import { TopControlBar } from "@/app/(app)/environments/[environmentId]/components/TopControlBar"; import { getOrganizationsByUserId } from "@/app/(app)/environments/[environmentId]/lib/organization"; @@ -21,7 +22,6 @@ import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; import { LimitsReachedBanner } from "@/modules/ui/components/limits-reached-banner"; import { PendingDowngradeBanner } from "@/modules/ui/components/pending-downgrade-banner"; import { getTranslate } from "@/tolgee/server"; -import type { Session } from "next-auth"; interface EnvironmentLayoutProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.test.tsx b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.test.tsx index 20fe547b83..bb98e789ea 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.test.tsx @@ -1,6 +1,6 @@ -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { render } from "@testing-library/react"; import { describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import EnvironmentStorageHandler from "./EnvironmentStorageHandler"; describe("EnvironmentStorageHandler", () => { diff --git a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.tsx b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.tsx index 448e615dff..79bd2288c8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentStorageHandler.tsx @@ -1,7 +1,7 @@ "use client"; -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { useEffect } from "react"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; interface EnvironmentStorageHandlerProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentSwitch.tsx b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentSwitch.tsx index 6e0420c5ec..6542ca8600 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentSwitch.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/EnvironmentSwitch.tsx @@ -1,12 +1,12 @@ "use client"; -import { cn } from "@/lib/cn"; -import { Label } from "@/modules/ui/components/label"; -import { Switch } from "@/modules/ui/components/switch"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; +import { cn } from "@/lib/cn"; +import { Label } from "@/modules/ui/components/label"; +import { Switch } from "@/modules/ui/components/switch"; interface EnvironmentSwitchProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/NavigationLink.tsx b/apps/web/app/(app)/environments/[environmentId]/components/NavigationLink.tsx index 102dba68f5..9254c7822a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/NavigationLink.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/NavigationLink.tsx @@ -1,7 +1,7 @@ -import { cn } from "@/lib/cn"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import Link from "next/link"; import React from "react"; +import { cn } from "@/lib/cn"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; interface NavigationLinkProps { href: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.test.tsx b/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.test.tsx index c78d71799c..43c6b9bce8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.test.tsx @@ -1,9 +1,9 @@ -import { QuestionOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; -import { QuestionFilterOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter"; -import { getTodayDate } from "@/app/lib/surveys/surveys"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { QuestionOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; +import { QuestionFilterOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter"; +import { getTodayDate } from "@/app/lib/surveys/surveys"; import { ResponseFilterProvider, useResponseFilter } from "./ResponseFilterContext"; // Mock the getTodayDate function diff --git a/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.tsx b/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.tsx index 850288a0e2..99e2f29a69 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/ResponseFilterContext.tsx @@ -1,12 +1,12 @@ "use client"; +import React, { createContext, useCallback, useContext, useState } from "react"; import { QuestionOption, QuestionOptions, } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; import { QuestionFilterOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter"; import { getTodayDate } from "@/app/lib/surveys/surveys"; -import React, { createContext, useCallback, useContext, useState } from "react"; export interface FilterValue { questionType: Partial; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/TopControlBar.tsx b/apps/web/app/(app)/environments/[environmentId]/components/TopControlBar.tsx index a73f2e2e1f..94f06d7a07 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/TopControlBar.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/TopControlBar.tsx @@ -1,10 +1,10 @@ "use client"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TOrganizationRole } from "@formbricks/types/memberships"; import { ProjectAndOrgSwitch } from "@/app/(app)/environments/[environmentId]/components/project-and-org-switch"; import { useEnvironment } from "@/app/(app)/environments/[environmentId]/context/environment-context"; import { getAccessFlags } from "@/lib/membership/utils"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TOrganizationRole } from "@formbricks/types/memberships"; interface TopControlBarProps { environments: TEnvironment[]; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/WidgetStatusIndicator.tsx b/apps/web/app/(app)/environments/[environmentId]/components/WidgetStatusIndicator.tsx index e5a63bb16c..dc653e6a03 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/WidgetStatusIndicator.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/WidgetStatusIndicator.tsx @@ -1,11 +1,11 @@ "use client"; -import { cn } from "@/lib/cn"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { AlertTriangleIcon, CheckIcon, RotateCcwIcon } from "lucide-react"; import { useRouter } from "next/navigation"; import { TEnvironment } from "@formbricks/types/environment"; +import { cn } from "@/lib/cn"; +import { Button } from "@/modules/ui/components/button"; interface WidgetStatusIndicatorProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/environment-breadcrumb.tsx b/apps/web/app/(app)/environments/[environmentId]/components/environment-breadcrumb.tsx index 16852fe8ac..4afe0e5cdb 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/environment-breadcrumb.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/environment-breadcrumb.tsx @@ -1,5 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { ChevronDownIcon, CircleHelpIcon, Code2Icon, Loader2 } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; import { BreadcrumbItem } from "@/modules/ui/components/breadcrumb"; import { DropdownMenu, @@ -9,10 +13,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; -import { useTranslate } from "@tolgee/react"; -import { ChevronDownIcon, CircleHelpIcon, Code2Icon, Loader2 } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; export const EnvironmentBreadcrumb = ({ environments, diff --git a/apps/web/app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsx b/apps/web/app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsx index 6e0f5131a8..7fadb7f1ae 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/organization-breadcrumb.tsx @@ -1,15 +1,5 @@ "use client"; -import { CreateOrganizationModal } from "@/modules/organization/components/CreateOrganizationModal"; -import { BreadcrumbItem } from "@/modules/ui/components/breadcrumb"; -import { - DropdownMenu, - DropdownMenuCheckboxItem, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@/modules/ui/components/dropdown-menu"; import * as Sentry from "@sentry/nextjs"; import { useTranslate } from "@tolgee/react"; import { @@ -23,6 +13,16 @@ import { import { usePathname, useRouter } from "next/navigation"; import { useState } from "react"; import { logger } from "@formbricks/logger"; +import { CreateOrganizationModal } from "@/modules/organization/components/CreateOrganizationModal"; +import { BreadcrumbItem } from "@/modules/ui/components/breadcrumb"; +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/modules/ui/components/dropdown-menu"; interface OrganizationBreadcrumbProps { currentOrganizationId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/project-and-org-switch.tsx b/apps/web/app/(app)/environments/[environmentId]/components/project-and-org-switch.tsx index ffea379f70..097b885ddb 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/project-and-org-switch.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/project-and-org-switch.tsx @@ -1,10 +1,10 @@ "use client"; +import { useMemo } from "react"; import { EnvironmentBreadcrumb } from "@/app/(app)/environments/[environmentId]/components/environment-breadcrumb"; import { OrganizationBreadcrumb } from "@/app/(app)/environments/[environmentId]/components/organization-breadcrumb"; import { ProjectBreadcrumb } from "@/app/(app)/environments/[environmentId]/components/project-breadcrumb"; import { Breadcrumb, BreadcrumbList } from "@/modules/ui/components/breadcrumb"; -import { useMemo } from "react"; interface ProjectAndOrgSwitchProps { currentOrganizationId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx b/apps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx index f18a5ea430..ab1be23c4a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/components/project-breadcrumb.tsx @@ -1,5 +1,11 @@ "use client"; +import * as Sentry from "@sentry/nextjs"; +import { useTranslate } from "@tolgee/react"; +import { ChevronDownIcon, ChevronRightIcon, CogIcon, FolderOpenIcon, Loader2, PlusIcon } from "lucide-react"; +import { usePathname, useRouter } from "next/navigation"; +import { useState } from "react"; +import { logger } from "@formbricks/logger"; import { CreateProjectModal } from "@/modules/projects/components/create-project-modal"; import { ProjectLimitModal } from "@/modules/projects/components/project-limit-modal"; import { BreadcrumbItem } from "@/modules/ui/components/breadcrumb"; @@ -12,12 +18,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { ModalButton } from "@/modules/ui/components/upgrade-prompt"; -import * as Sentry from "@sentry/nextjs"; -import { useTranslate } from "@tolgee/react"; -import { ChevronDownIcon, ChevronRightIcon, CogIcon, FolderOpenIcon, Loader2, PlusIcon } from "lucide-react"; -import { usePathname, useRouter } from "next/navigation"; -import { useState } from "react"; -import { logger } from "@formbricks/logger"; interface ProjectBreadcrumbProps { currentProjectId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx index cc720bdd6b..78a3c646af 100644 --- a/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/layout.test.tsx @@ -1,7 +1,3 @@ -import { getEnvironment } from "@/lib/environment/service"; -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { getProjectByEnvironmentId } from "@/lib/project/service"; -import { environmentIdLayoutChecks } from "@/modules/environments/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { Session } from "next-auth"; import { redirect } from "next/navigation"; @@ -11,6 +7,10 @@ import { TMembership } from "@formbricks/types/memberships"; import { TOrganization } from "@formbricks/types/organizations"; import { TProject } from "@formbricks/types/project"; import { TUser } from "@formbricks/types/user"; +import { getEnvironment } from "@/lib/environment/service"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; +import { environmentIdLayoutChecks } from "@/modules/environments/lib/utils"; import EnvLayout from "./layout"; // Mock sub-components to render identifiable elements diff --git a/apps/web/app/(app)/environments/[environmentId]/layout.tsx b/apps/web/app/(app)/environments/[environmentId]/layout.tsx index 85c60fd654..feb25e8fa9 100644 --- a/apps/web/app/(app)/environments/[environmentId]/layout.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/layout.tsx @@ -1,3 +1,4 @@ +import { redirect } from "next/navigation"; import { EnvironmentLayout } from "@/app/(app)/environments/[environmentId]/components/EnvironmentLayout"; import { EnvironmentContextWrapper } from "@/app/(app)/environments/[environmentId]/context/environment-context"; import { getEnvironment } from "@/lib/environment/service"; @@ -5,7 +6,6 @@ import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { environmentIdLayoutChecks } from "@/modules/environments/lib/utils"; import { EnvironmentIdBaseLayout } from "@/modules/ui/components/environmentId-base-layout"; -import { redirect } from "next/navigation"; import EnvironmentStorageHandler from "./components/EnvironmentStorageHandler"; const EnvLayout = async (props: { diff --git a/apps/web/app/(app)/environments/[environmentId]/lib/organization.ts b/apps/web/app/(app)/environments/[environmentId]/lib/organization.ts index 4ed0849f27..fccf0224ed 100644 --- a/apps/web/app/(app)/environments/[environmentId]/lib/organization.ts +++ b/apps/web/app/(app)/environments/[environmentId]/lib/organization.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZString } from "@formbricks/types/common"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const getOrganizationsByUserId = reactCache( async (userId: string): Promise<{ id: string; name: string }[]> => { diff --git a/apps/web/app/(app)/environments/[environmentId]/lib/project.ts b/apps/web/app/(app)/environments/[environmentId]/lib/project.ts index c4d6bb62cd..059ed751bf 100644 --- a/apps/web/app/(app)/environments/[environmentId]/lib/project.ts +++ b/apps/web/app/(app)/environments/[environmentId]/lib/project.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZString } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; import { TMembership, ZMembership } from "@formbricks/types/memberships"; +import { validateInputs } from "@/lib/utils/validate"; export const getProjectsByUserId = reactCache( async (userId: string, orgMembership: TMembership): Promise<{ id: string; name: string }[]> => { diff --git a/apps/web/app/(app)/environments/[environmentId]/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/page.test.tsx index bd7c0b963c..841f7f1b1c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/page.test.tsx @@ -1,10 +1,10 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { getAccessFlags } from "@/lib/membership/utils"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TMembership } from "@formbricks/types/memberships"; import { TOrganization, TOrganizationBilling } from "@formbricks/types/organizations"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { getAccessFlags } from "@/lib/membership/utils"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import EnvironmentPage from "./page"; vi.mock("@/lib/membership/service", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/page.tsx b/apps/web/app/(app)/environments/[environmentId]/page.tsx index 66388d58fc..1ef791e033 100644 --- a/apps/web/app/(app)/environments/[environmentId]/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/page.tsx @@ -1,8 +1,8 @@ +import { redirect } from "next/navigation"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getAccessFlags } from "@/lib/membership/utils"; import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { redirect } from "next/navigation"; const EnvironmentPage = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/loading.test.tsx index 33cf380178..e67fca7b86 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/loading.test.tsx @@ -1,5 +1,5 @@ -import { AppConnectionLoading as OriginalAppConnectionLoading } from "@/modules/projects/settings/(setup)/app-connection/loading"; import { describe, expect, test, vi } from "vitest"; +import { AppConnectionLoading as OriginalAppConnectionLoading } from "@/modules/projects/settings/(setup)/app-connection/loading"; import AppConnectionLoading from "./loading"; // Mock the original component to ensure we are testing the re-export diff --git a/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/page.test.tsx index 3458738c67..4425d274b6 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/(setup)/app-connection/page.test.tsx @@ -1,5 +1,5 @@ -import { AppConnectionPage as OriginalAppConnectionPage } from "@/modules/projects/settings/(setup)/app-connection/page"; import { describe, expect, test, vi } from "vitest"; +import { AppConnectionPage as OriginalAppConnectionPage } from "@/modules/projects/settings/(setup)/app-connection/page"; import AppConnectionPage from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/general/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/general/loading.test.tsx index ff4928e52f..20636867b8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/general/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/general/loading.test.tsx @@ -1,5 +1,5 @@ -import { GeneralSettingsLoading as OriginalGeneralSettingsLoading } from "@/modules/projects/settings/general/loading"; import { describe, expect, test, vi } from "vitest"; +import { GeneralSettingsLoading as OriginalGeneralSettingsLoading } from "@/modules/projects/settings/general/loading"; import GeneralSettingsLoadingPage from "./loading"; // Mock the original component to ensure we are testing the re-export diff --git a/apps/web/app/(app)/environments/[environmentId]/project/general/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/general/page.test.tsx index 489f33a4c7..34801faeb2 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/general/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/general/page.test.tsx @@ -1,5 +1,5 @@ -import { GeneralSettingsPage } from "@/modules/projects/settings/general/page"; import { describe, expect, test, vi } from "vitest"; +import { GeneralSettingsPage } from "@/modules/projects/settings/general/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/actions.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/actions.ts index 79d6546cfe..08670dbc00 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { ZIntegrationInput } from "@formbricks/types/integration"; import { createOrUpdateIntegration, deleteIntegration } from "@/lib/integration/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; @@ -11,9 +14,6 @@ import { getProjectIdFromIntegrationId, } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { ZIntegrationInput } from "@formbricks/types/integration"; const ZCreateOrUpdateIntegrationAction = z.object({ environmentId: ZId, diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AddIntegrationModal.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AddIntegrationModal.test.tsx index 45859167c0..829a87543e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AddIntegrationModal.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AddIntegrationModal.test.tsx @@ -1,5 +1,3 @@ -import { createOrUpdateIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; -import { fetchTables } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/lib/airtable"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { useRouter } from "next/navigation"; @@ -13,6 +11,8 @@ import { TIntegrationAirtableTables, } from "@formbricks/types/integration/airtable"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { createOrUpdateIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; +import { fetchTables } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/lib/airtable"; import { AddIntegrationModal } from "./AddIntegrationModal"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.test.tsx index 5013929ca4..bac653c650 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.test.tsx @@ -1,9 +1,9 @@ -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/lib/airtable"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/lib/airtable"; import { AirtableWrapper } from "./AirtableWrapper"; // Mock child components diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.tsx index 045c80ad80..2a5cbca21a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper.tsx @@ -1,15 +1,15 @@ "use client"; -import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration"; -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/lib/airtable"; -import airtableLogo from "@/images/airtableLogo.svg"; -import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; import { useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationItem } from "@formbricks/types/integration"; import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/lib/airtable"; +import airtableLogo from "@/images/airtableLogo.svg"; +import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; interface AirtableWrapperProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/BaseSelectDropdown.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/BaseSelectDropdown.tsx index 032c1f39ea..bc89d74ed5 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/BaseSelectDropdown.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/BaseSelectDropdown.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { Control, Controller, UseFormSetValue } from "react-hook-form"; +import { TIntegrationItem } from "@formbricks/types/integration"; import { Label } from "@/modules/ui/components/label"; import { Select, @@ -8,9 +11,6 @@ import { SelectTrigger, SelectValue, } from "@/modules/ui/components/select"; -import { useTranslate } from "@tolgee/react"; -import { Control, Controller, UseFormSetValue } from "react-hook-form"; -import { TIntegrationItem } from "@formbricks/types/integration"; import { IntegrationModalInputs } from "../lib/types"; interface BaseSelectProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.test.tsx index d21c18caf4..8191e0bab1 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.test.tsx @@ -1,9 +1,9 @@ -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationAirtable, TIntegrationAirtableConfig } from "@formbricks/types/integration/airtable"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { ManageIntegration } from "./ManageIntegration"; vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.tsx index be64c19178..a6d7312dbe 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/components/ManageIntegration.tsx @@ -1,12 +1,5 @@ "use client"; -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; -import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AddIntegrationModal"; -import { timeSince } from "@/lib/time"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Button } from "@/modules/ui/components/button"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { useTranslate } from "@tolgee/react"; import { Trash2Icon } from "lucide-react"; import { useState } from "react"; @@ -16,6 +9,13 @@ import { TIntegrationItem } from "@formbricks/types/integration"; import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; +import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AddIntegrationModal"; +import { timeSince } from "@/lib/time"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Button } from "@/modules/ui/components/button"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; +import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { IntegrationModalInputs } from "../lib/types"; interface ManageIntegrationProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.test.tsx index 4c52f1bce7..3e16fded46 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.test.tsx @@ -1,10 +1,3 @@ -import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; -import { getAirtableTables } from "@/lib/airtable/service"; -import { WEBAPP_URL } from "@/lib/constants"; -import { getIntegrations } from "@/lib/integration/service"; -import { findMatchingLocale } from "@/lib/utils/locale"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { cleanup, render, screen } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -12,6 +5,13 @@ import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationItem } from "@formbricks/types/integration"; import { TIntegrationAirtable, TIntegrationAirtableCredential } from "@formbricks/types/integration/airtable"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; +import { getAirtableTables } from "@/lib/airtable/service"; +import { WEBAPP_URL } from "@/lib/constants"; +import { getIntegrations } from "@/lib/integration/service"; +import { findMatchingLocale } from "@/lib/utils/locale"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import Page from "./page"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.tsx index d356837186..a47c473316 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/airtable/page.tsx @@ -1,3 +1,6 @@ +import { redirect } from "next/navigation"; +import { TIntegrationItem } from "@formbricks/types/integration"; +import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; import { AirtableWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/airtable/components/AirtableWrapper"; import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; import { getAirtableTables } from "@/lib/airtable/service"; @@ -9,9 +12,6 @@ import { GoBackButton } from "@/modules/ui/components/go-back-button"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { redirect } from "next/navigation"; -import { TIntegrationItem } from "@formbricks/types/integration"; -import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; const Page = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/actions.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/actions.ts index 9e23cd3bff..0644ed8ba2 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/actions.ts @@ -1,11 +1,11 @@ "use server"; +import { z } from "zod"; +import { ZIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; import { getSpreadsheetNameById } from "@/lib/googleSheet/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { getOrganizationIdFromEnvironmentId, getProjectIdFromEnvironmentId } from "@/lib/utils/helper"; -import { z } from "zod"; -import { ZIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; const ZGetSpreadsheetNameByIdAction = z.object({ googleSheetIntegration: ZIntegrationGoogleSheets, diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/AddIntegrationModal.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/AddIntegrationModal.test.tsx index d8e5fa48b9..0278551501 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/AddIntegrationModal.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/AddIntegrationModal.test.tsx @@ -1,4 +1,3 @@ -import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/AddIntegrationModal"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -7,6 +6,7 @@ import { TIntegrationGoogleSheetsConfigData, } from "@formbricks/types/integration/google-sheet"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/AddIntegrationModal"; // Mock actions and utilities vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.test.tsx index fbdbf9756e..e792081975 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.test.tsx @@ -1,5 +1,3 @@ -import { GoogleSheetWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper"; -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/lib/google"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; @@ -9,6 +7,8 @@ import { TIntegrationGoogleSheetsCredential, } from "@formbricks/types/integration/google-sheet"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { GoogleSheetWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/lib/google"; // Mock child components and functions vi.mock( diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.tsx index e219ed91c0..125c0a5f46 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper.tsx @@ -1,9 +1,5 @@ "use client"; -import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration"; -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/lib/google"; -import googleSheetLogo from "@/images/googleSheetsLogo.png"; -import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; import { useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { @@ -12,6 +8,10 @@ import { } from "@formbricks/types/integration/google-sheet"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/lib/google"; +import googleSheetLogo from "@/images/googleSheetsLogo.png"; +import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; import { AddIntegrationModal } from "./AddIntegrationModal"; interface GoogleSheetWrapperProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.test.tsx index 4443409e09..22cb56eb77 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.test.tsx @@ -1,9 +1,9 @@ -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { ManageIntegration } from "./ManageIntegration"; vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.tsx index 4de0d6d7ae..cb64e0a695 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/ManageIntegration.tsx @@ -1,11 +1,5 @@ "use client"; -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; -import { timeSince } from "@/lib/time"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Button } from "@/modules/ui/components/button"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { useTranslate } from "@tolgee/react"; import { Trash2Icon } from "lucide-react"; import { useState } from "react"; @@ -16,6 +10,12 @@ import { TIntegrationGoogleSheetsConfigData, } from "@formbricks/types/integration/google-sheet"; import { TUserLocale } from "@formbricks/types/user"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; +import { timeSince } from "@/lib/time"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Button } from "@/modules/ui/components/button"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; +import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; interface ManageIntegrationProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/loading.tsx index 28cebefeaf..6ef7a18ddf 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/loading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/loading.tsx @@ -1,8 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { Button } from "@/modules/ui/components/button"; import { GoBackButton } from "@/modules/ui/components/go-back-button"; -import { useTranslate } from "@tolgee/react"; const Loading = () => { const { t } = useTranslate(); diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.test.tsx index 927eec505a..a27156fa9e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.test.tsx @@ -1,9 +1,3 @@ -import Page from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page"; -import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; -import { getIntegrations } from "@/lib/integration/service"; -import { findMatchingLocale } from "@/lib/utils/locale"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { cleanup, render, screen } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -13,6 +7,12 @@ import { TIntegrationGoogleSheetsCredential, } from "@formbricks/types/integration/google-sheet"; import { TSurvey } from "@formbricks/types/surveys/types"; +import Page from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page"; +import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; +import { getIntegrations } from "@/lib/integration/service"; +import { findMatchingLocale } from "@/lib/utils/locale"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; // Mock dependencies vi.mock( diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.tsx index a57c901388..bb1f6d2396 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/google-sheets/page.tsx @@ -1,3 +1,5 @@ +import { redirect } from "next/navigation"; +import { TIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; import { GoogleSheetWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/google-sheets/components/GoogleSheetWrapper"; import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; import { @@ -13,8 +15,6 @@ import { GoBackButton } from "@/modules/ui/components/go-back-button"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { redirect } from "next/navigation"; -import { TIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; const Page = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.test.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.test.ts index 5bab761775..6b0ea900fc 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.test.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.test.ts @@ -1,12 +1,12 @@ -import { selectSurvey } from "@/lib/survey/service"; -import { transformPrismaSurvey } from "@/lib/survey/utils"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { selectSurvey } from "@/lib/survey/service"; +import { transformPrismaSurvey } from "@/lib/survey/utils"; +import { validateInputs } from "@/lib/utils/validate"; import { getSurveys } from "./surveys"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.ts index 4a17466db1..c0d0d77c87 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/surveys.ts @@ -1,7 +1,4 @@ import "server-only"; -import { selectSurvey } from "@/lib/survey/service"; -import { transformPrismaSurvey } from "@/lib/survey/utils"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -9,6 +6,9 @@ import { logger } from "@formbricks/logger"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { selectSurvey } from "@/lib/survey/service"; +import { transformPrismaSurvey } from "@/lib/survey/utils"; +import { validateInputs } from "@/lib/utils/validate"; export const getSurveys = reactCache(async (environmentId: string): Promise => { validateInputs([environmentId, ZId]); diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.test.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.test.ts index a0a0d31cc8..a8e158d6ee 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.test.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.test.ts @@ -1,8 +1,8 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { getWebhookCountBySource } from "./webhook"; vi.mock("@/lib/utils/validate"); diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.ts index 54df0cc2bc..6d4d1ea643 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/lib/webhook.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma, Webhook } from "@prisma/client"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const getWebhookCountBySource = async ( environmentId: string, diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.test.tsx index cd8cc30bf8..f7b01a160d 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal.test.tsx @@ -1,4 +1,3 @@ -import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -9,6 +8,7 @@ import { TIntegrationNotionDatabase, } from "@formbricks/types/integration/notion"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal"; // Mock actions and utilities vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/ManageIntegration.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/ManageIntegration.tsx index b0423b659d..925ee70b27 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/ManageIntegration.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/ManageIntegration.tsx @@ -1,12 +1,5 @@ "use client"; -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; -import { timeSince } from "@/lib/time"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Button } from "@/modules/ui/components/button"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { RefreshCcwIcon, Trash2Icon } from "lucide-react"; import React, { useState } from "react"; @@ -14,6 +7,13 @@ import toast from "react-hot-toast"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationNotion, TIntegrationNotionConfigData } from "@formbricks/types/integration/notion"; import { TUserLocale } from "@formbricks/types/user"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; +import { timeSince } from "@/lib/time"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Button } from "@/modules/ui/components/button"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; +import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; interface ManageIntegrationProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.test.tsx index ae94f488c4..a19e5f32e1 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.test.tsx @@ -1,10 +1,10 @@ -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/lib/notion"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationNotion, TIntegrationNotionCredential } from "@formbricks/types/integration/notion"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/lib/notion"; import { NotionWrapper } from "./NotionWrapper"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.tsx index dac6ef89a5..3066f0c37d 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper.tsx @@ -1,9 +1,5 @@ "use client"; -import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal"; -import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/ManageIntegration"; -import notionLogo from "@/images/notion.png"; -import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; import { useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { @@ -13,6 +9,10 @@ import { } from "@formbricks/types/integration/notion"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { AddIntegrationModal } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/AddIntegrationModal"; +import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/ManageIntegration"; +import notionLogo from "@/images/notion.png"; +import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; import { authorize } from "../lib/notion"; interface NotionWrapperProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/loading.tsx index bf63835b39..a9c843edaa 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/loading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/loading.tsx @@ -1,8 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { Button } from "@/modules/ui/components/button"; import { GoBackButton } from "@/modules/ui/components/go-back-button"; -import { useTranslate } from "@tolgee/react"; const Loading = () => { const { t } = useTranslate(); diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.test.tsx index 5af6b66144..5093713d53 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.test.tsx @@ -1,3 +1,9 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import { redirect } from "next/navigation"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TIntegrationNotion, TIntegrationNotionDatabase } from "@formbricks/types/integration/notion"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; import Page from "@/app/(app)/environments/[environmentId]/project/integrations/notion/page"; import { getIntegrationByType } from "@/lib/integration/service"; @@ -5,12 +11,6 @@ import { getNotionDatabases } from "@/lib/notion/service"; import { findMatchingLocale } from "@/lib/utils/locale"; import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; -import { cleanup, render, screen } from "@testing-library/react"; -import { redirect } from "next/navigation"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TIntegrationNotion, TIntegrationNotionDatabase } from "@formbricks/types/integration/notion"; -import { TSurvey } from "@formbricks/types/surveys/types"; // Mock dependencies vi.mock( diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.tsx index 91de59921d..b53818924d 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/notion/page.tsx @@ -1,3 +1,5 @@ +import { redirect } from "next/navigation"; +import { TIntegrationNotion, TIntegrationNotionDatabase } from "@formbricks/types/integration/notion"; import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; import { NotionWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/notion/components/NotionWrapper"; import { @@ -15,8 +17,6 @@ import { GoBackButton } from "@/modules/ui/components/go-back-button"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { redirect } from "next/navigation"; -import { TIntegrationNotion, TIntegrationNotionDatabase } from "@formbricks/types/integration/notion"; const Page = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.test.tsx index 688011fe36..d4c7366146 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.test.tsx @@ -1,13 +1,13 @@ -import { getWebhookCountBySource } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/webhook"; -import Page from "@/app/(app)/environments/[environmentId]/project/integrations/page"; -import { getIntegrations } from "@/lib/integration/service"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { cleanup, render, screen } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegration } from "@formbricks/types/integration"; +import { getWebhookCountBySource } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/webhook"; +import Page from "@/app/(app)/environments/[environmentId]/project/integrations/page"; +import { getIntegrations } from "@/lib/integration/service"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; // Mock dependencies vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/lib/webhook", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.tsx index 69bcccf248..9fbb66c31f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/page.tsx @@ -1,3 +1,7 @@ +import { TFnType } from "@tolgee/react"; +import Image from "next/image"; +import { redirect } from "next/navigation"; +import { TIntegrationType } from "@formbricks/types/integration"; import { getWebhookCountBySource } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/webhook"; import ActivePiecesLogo from "@/images/activepieces.webp"; import AirtableLogo from "@/images/airtableLogo.svg"; @@ -16,10 +20,6 @@ import { Card } from "@/modules/ui/components/integration-card"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { TFnType } from "@tolgee/react"; -import Image from "next/image"; -import { redirect } from "next/navigation"; -import { TIntegrationType } from "@formbricks/types/integration"; const getStatusText = (count: number, t: TFnType, type: string) => { if (count === 1) return `1 ${type}`; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/actions.ts b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/actions.ts index cd2cbf1248..3c273952ac 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/actions.ts @@ -1,11 +1,11 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { getSlackChannels } from "@/lib/slack/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { getOrganizationIdFromEnvironmentId, getProjectIdFromEnvironmentId } from "@/lib/utils/helper"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZGetSlackChannelsAction = z.object({ environmentId: ZId, diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/AddChannelMappingModal.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/AddChannelMappingModal.test.tsx index c087a991b0..9982773040 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/AddChannelMappingModal.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/AddChannelMappingModal.test.tsx @@ -1,4 +1,3 @@ -import { createOrUpdateIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -9,6 +8,7 @@ import { TIntegrationSlackCredential, } from "@formbricks/types/integration/slack"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { createOrUpdateIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { AddChannelMappingModal } from "./AddChannelMappingModal"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.test.tsx index 0ce156ac72..f76a5e4541 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.test.tsx @@ -1,9 +1,9 @@ -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationSlack, TIntegrationSlackConfigData } from "@formbricks/types/integration/slack"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; import { ManageIntegration } from "./ManageIntegration"; vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.tsx index c8abb6021b..802d7aa46e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration.tsx @@ -1,11 +1,5 @@ "use client"; -import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; -import { timeSince } from "@/lib/time"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Button } from "@/modules/ui/components/button"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { T, useTranslate } from "@tolgee/react"; import { Trash2Icon } from "lucide-react"; import React, { useState } from "react"; @@ -13,6 +7,12 @@ import toast from "react-hot-toast"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationSlack, TIntegrationSlackConfigData } from "@formbricks/types/integration/slack"; import { TUserLocale } from "@formbricks/types/user"; +import { deleteIntegrationAction } from "@/app/(app)/environments/[environmentId]/project/integrations/actions"; +import { timeSince } from "@/lib/time"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Button } from "@/modules/ui/components/button"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; +import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; interface ManageIntegrationProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.test.tsx index b3c23d4e19..d67ab93c67 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.test.tsx @@ -1,6 +1,3 @@ -import { getSlackChannelsAction } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/actions"; -import { SlackWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper"; -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/lib/slack"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -9,6 +6,9 @@ import { TIntegrationItem } from "@formbricks/types/integration"; import { TIntegrationSlack, TIntegrationSlackCredential } from "@formbricks/types/integration/slack"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { getSlackChannelsAction } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/actions"; +import { SlackWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/lib/slack"; // Mock child components and actions vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/slack/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.tsx index 7f8b182736..47ed0dee36 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper.tsx @@ -1,17 +1,17 @@ "use client"; -import { getSlackChannelsAction } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/actions"; -import { AddChannelMappingModal } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/AddChannelMappingModal"; -import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration"; -import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/lib/slack"; -import slackLogo from "@/images/slacklogo.png"; -import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; import { useCallback, useEffect, useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TIntegrationItem } from "@formbricks/types/integration"; import { TIntegrationSlack, TIntegrationSlackConfigData } from "@formbricks/types/integration/slack"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { getSlackChannelsAction } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/actions"; +import { AddChannelMappingModal } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/AddChannelMappingModal"; +import { ManageIntegration } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/ManageIntegration"; +import { authorize } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/lib/slack"; +import slackLogo from "@/images/slacklogo.png"; +import { ConnectIntegration } from "@/modules/ui/components/connect-integration"; interface SlackWrapperProps { isEnabled: boolean; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.test.tsx index 8a02a5662b..b5643e9e66 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.test.tsx @@ -1,3 +1,9 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import { redirect } from "next/navigation"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TIntegrationSlack, TIntegrationSlackCredential } from "@formbricks/types/integration/slack"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; import { SlackWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper"; import Page from "@/app/(app)/environments/[environmentId]/project/integrations/slack/page"; @@ -5,12 +11,6 @@ import { getIntegrationByType } from "@/lib/integration/service"; import { findMatchingLocale } from "@/lib/utils/locale"; import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; -import { cleanup, render, screen } from "@testing-library/react"; -import { redirect } from "next/navigation"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TIntegrationSlack, TIntegrationSlackCredential } from "@formbricks/types/integration/slack"; -import { TSurvey } from "@formbricks/types/surveys/types"; // Mock dependencies vi.mock("@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.tsx b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.tsx index 0c0dcec024..360829ea0e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/integrations/slack/page.tsx @@ -1,3 +1,5 @@ +import { redirect } from "next/navigation"; +import { TIntegrationSlack } from "@formbricks/types/integration/slack"; import { getSurveys } from "@/app/(app)/environments/[environmentId]/project/integrations/lib/surveys"; import { SlackWrapper } from "@/app/(app)/environments/[environmentId]/project/integrations/slack/components/SlackWrapper"; import { SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, WEBAPP_URL } from "@/lib/constants"; @@ -8,8 +10,6 @@ import { GoBackButton } from "@/modules/ui/components/go-back-button"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { redirect } from "next/navigation"; -import { TIntegrationSlack } from "@formbricks/types/integration/slack"; const Page = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/project/languages/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/languages/loading.test.tsx index df5b013693..2202a8aac6 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/languages/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/languages/loading.test.tsx @@ -1,5 +1,5 @@ -import { LanguagesLoading as OriginalLanguagesLoading } from "@/modules/ee/languages/loading"; import { describe, expect, test, vi } from "vitest"; +import { LanguagesLoading as OriginalLanguagesLoading } from "@/modules/ee/languages/loading"; import LanguagesLoading from "./loading"; // Mock the original component to ensure we are testing the re-export diff --git a/apps/web/app/(app)/environments/[environmentId]/project/languages/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/languages/page.test.tsx index 740381159a..2931981bbf 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/languages/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/languages/page.test.tsx @@ -1,5 +1,5 @@ -import { LanguagesPage } from "@/modules/ee/languages/page"; import { describe, expect, test, vi } from "vitest"; +import { LanguagesPage } from "@/modules/ee/languages/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/look/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/look/loading.test.tsx index 4c0c7e61bf..e20338d0de 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/look/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/look/loading.test.tsx @@ -1,5 +1,5 @@ -import { ProjectLookSettingsLoading as OriginalProjectLookSettingsLoading } from "@/modules/projects/settings/look/loading"; import { describe, expect, test, vi } from "vitest"; +import { ProjectLookSettingsLoading as OriginalProjectLookSettingsLoading } from "@/modules/projects/settings/look/loading"; import ProjectLookSettingsLoading from "./loading"; // Mock the original component to ensure we are testing the re-export diff --git a/apps/web/app/(app)/environments/[environmentId]/project/look/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/look/page.test.tsx index 4d04031bec..5a3d60eff4 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/look/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/look/page.test.tsx @@ -1,5 +1,5 @@ -import { ProjectLookSettingsPage } from "@/modules/projects/settings/look/page"; import { describe, expect, test, vi } from "vitest"; +import { ProjectLookSettingsPage } from "@/modules/projects/settings/look/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/page.test.tsx index e890bce703..eff3cf2a07 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/page.test.tsx @@ -1,5 +1,5 @@ -import { ProjectSettingsPage } from "@/modules/projects/settings/page"; import { describe, expect, test, vi } from "vitest"; +import { ProjectSettingsPage } from "@/modules/projects/settings/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/tags/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/tags/loading.test.tsx index 836ab270ea..b6821578ef 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/tags/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/tags/loading.test.tsx @@ -1,5 +1,5 @@ -import { TagsLoading as OriginalTagsLoading } from "@/modules/projects/settings/tags/loading"; import { describe, expect, test, vi } from "vitest"; +import { TagsLoading as OriginalTagsLoading } from "@/modules/projects/settings/tags/loading"; import TagsLoading from "./loading"; // Mock the original component to ensure we are testing the re-export diff --git a/apps/web/app/(app)/environments/[environmentId]/project/tags/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/tags/page.test.tsx index 0c69c66468..07d84920e9 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/tags/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/tags/page.test.tsx @@ -1,5 +1,5 @@ -import { TagsPage } from "@/modules/projects/settings/tags/page"; import { describe, expect, test, vi } from "vitest"; +import { TagsPage } from "@/modules/projects/settings/tags/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/project/teams/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/project/teams/page.test.tsx index 6d1b01200e..a8651a90de 100644 --- a/apps/web/app/(app)/environments/[environmentId]/project/teams/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/project/teams/page.test.tsx @@ -1,5 +1,5 @@ -import { ProjectTeams } from "@/modules/ee/teams/project-teams/page"; import { describe, expect, test, vi } from "vitest"; +import { ProjectTeams } from "@/modules/ee/teams/project-teams/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.test.tsx index ac5569d1a6..83afc6ac73 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.test.tsx @@ -1,7 +1,7 @@ -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { cleanup, render } from "@testing-library/react"; import { usePathname } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { AccountSettingsNavbar } from "./AccountSettingsNavbar"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.tsx index 2027bf92ef..6d8c75e9cf 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar.tsx @@ -1,8 +1,8 @@ "use client"; -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { useTranslate } from "@tolgee/react"; import { usePathname } from "next/navigation"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; interface AccountSettingsNavbarProps { environmentId?: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.test.tsx index 8107a446af..1f9aeb0a26 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.test.tsx @@ -1,10 +1,10 @@ -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getProjectByEnvironmentId } from "@/lib/project/service"; import { cleanup, render, screen } from "@testing-library/react"; import { Session, getServerSession } from "next-auth"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TProject } from "@formbricks/types/project"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; import AccountSettingsLayout from "./layout"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.tsx index 7dbd8b6bad..204ae44f8f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/layout.tsx @@ -1,8 +1,8 @@ +import { getServerSession } from "next-auth"; import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; const AccountSettingsLayout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/actions.ts b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/actions.ts index c9a59aafc3..b2043a4d0c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/actions.ts @@ -1,11 +1,11 @@ "use server"; +import { z } from "zod"; +import { ZUserNotificationSettings } from "@formbricks/types/user"; import { getUser, updateUser } from "@/lib/user/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; -import { z } from "zod"; -import { ZUserNotificationSettings } from "@formbricks/types/user"; const ZUpdateNotificationSettingsAction = z.object({ notificationSettings: ZUserNotificationSettings, diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/EditAlerts.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/EditAlerts.tsx index 4871acbe38..73a0e5b43c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/EditAlerts.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/EditAlerts.tsx @@ -1,10 +1,10 @@ "use client"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { HelpCircleIcon, UsersIcon } from "lucide-react"; import Link from "next/link"; import { TUser } from "@formbricks/types/user"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { Membership } from "../types"; import { NotificationSwitch } from "./NotificationSwitch"; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/IntegrationsTip.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/IntegrationsTip.tsx index 4c080a7c78..ffdd0f5c6b 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/IntegrationsTip.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/IntegrationsTip.tsx @@ -1,7 +1,7 @@ "use client"; -import { SlackIcon } from "@/modules/ui/components/icons"; import { useTranslate } from "@tolgee/react"; +import { SlackIcon } from "@/modules/ui/components/icons"; interface IntegrationsTipProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/NotificationSwitch.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/NotificationSwitch.tsx index deedc049b5..7e963f5616 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/NotificationSwitch.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/components/NotificationSwitch.tsx @@ -1,12 +1,12 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Switch } from "@/modules/ui/components/switch"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; import { useEffect, useState } from "react"; import toast from "react-hot-toast"; import { TUserNotificationSettings } from "@formbricks/types/user"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Switch } from "@/modules/ui/components/switch"; import { updateNotificationSettingsAction } from "../actions"; interface NotificationSwitchProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/loading.tsx index 2b074d0963..c5a165bcf6 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/loading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/loading.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { LoadingCard } from "@/app/(app)/components/LoadingCard"; import { AccountSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; const Loading = () => { const { t } = useTranslate(); diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.test.tsx index 40a86c30cd..1da431461d 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.test.tsx @@ -1,9 +1,9 @@ -import { getUser } from "@/lib/user/service"; import { cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TUser } from "@formbricks/types/user"; +import { getUser } from "@/lib/user/service"; import { EditAlerts } from "./components/EditAlerts"; import Page from "./page"; import { Membership } from "./types"; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.tsx index 8cc08c7b02..1f1e78737a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/notifications/page.tsx @@ -1,3 +1,6 @@ +import { getServerSession } from "next-auth"; +import { prisma } from "@formbricks/database"; +import { TUserNotificationSettings } from "@formbricks/types/user"; import { AccountSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { getUser } from "@/lib/user/service"; @@ -5,9 +8,6 @@ import { authOptions } from "@/modules/auth/lib/authOptions"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { prisma } from "@formbricks/database"; -import { TUserNotificationSettings } from "@formbricks/types/user"; import { EditAlerts } from "./components/EditAlerts"; import { IntegrationsTip } from "./components/IntegrationsTip"; import type { Membership } from "./types"; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/actions.ts b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/actions.ts index 59c9215141..60a18b0db3 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/actions.ts @@ -1,5 +1,11 @@ "use server"; +import { AuthenticationError, AuthorizationError, OperationNotAllowedError } from "@formbricks/types/errors"; +import { + TUserPersonalInfoUpdateInput, + TUserUpdateInput, + ZUserPersonalInfoUpdateInput, +} from "@formbricks/types/user"; import { getIsEmailUnique, verifyUserPassword, @@ -13,12 +19,6 @@ import { applyRateLimit } from "@/modules/core/rate-limit/helpers"; import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { sendForgotPasswordEmail, sendVerificationNewEmail } from "@/modules/email"; -import { AuthenticationError, AuthorizationError, OperationNotAllowedError } from "@formbricks/types/errors"; -import { - TUserPersonalInfoUpdateInput, - TUserUpdateInput, - ZUserPersonalInfoUpdateInput, -} from "@formbricks/types/user"; function buildUserUpdatePayload(parsedInput: any): TUserUpdateInput { return { diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/AccountSecurity.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/AccountSecurity.tsx index 5c7da78c6d..8dca0f4cd4 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/AccountSecurity.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/AccountSecurity.tsx @@ -1,11 +1,11 @@ "use client"; -import { DisableTwoFactorModal } from "@/modules/ee/two-factor-auth/components/disable-two-factor-modal"; -import { EnableTwoFactorModal } from "@/modules/ee/two-factor-auth/components/enable-two-factor-modal"; -import { Switch } from "@/modules/ui/components/switch"; import { useTranslate } from "@tolgee/react"; import { useState } from "react"; import { TUser } from "@formbricks/types/user"; +import { DisableTwoFactorModal } from "@/modules/ee/two-factor-auth/components/disable-two-factor-modal"; +import { EnableTwoFactorModal } from "@/modules/ee/two-factor-auth/components/enable-two-factor-modal"; +import { Switch } from "@/modules/ui/components/switch"; interface AccountSecurityProps { user: TUser; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx index a83687403d..f13e07f9d0 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/DeleteAccount.tsx @@ -1,13 +1,13 @@ "use client"; -import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; -import { Button } from "@/modules/ui/components/button"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import type { Session } from "next-auth"; import { useState } from "react"; import { TOrganization } from "@formbricks/types/organizations"; import { TUser } from "@formbricks/types/user"; +import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; +import { Button } from "@/modules/ui/components/button"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; export const DeleteAccount = ({ session, diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/EditProfileDetailsForm.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/EditProfileDetailsForm.tsx index 9d1c5017b4..273c58917f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/EditProfileDetailsForm.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/EditProfileDetailsForm.tsx @@ -1,5 +1,13 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { ChevronDownIcon } from "lucide-react"; +import { useState } from "react"; +import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { TUser, TUserUpdateInput, ZUser, ZUserEmail } from "@formbricks/types/user"; import { PasswordConfirmationModal } from "@/app/(app)/environments/[environmentId]/settings/(account)/profile/components/password-confirmation-modal"; import { appLanguages } from "@/lib/i18n/utils"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; @@ -15,14 +23,6 @@ import { import { FormControl, FormError, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { ChevronDownIcon } from "lucide-react"; -import { useState } from "react"; -import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; -import { TUser, TUserUpdateInput, ZUser, ZUserEmail } from "@formbricks/types/user"; import { resetPasswordAction, updateUserAction } from "../actions"; // Schema & types diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/password-confirmation-modal.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/password-confirmation-modal.tsx index 0cd3edca87..20502aa74e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/password-confirmation-modal.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/components/password-confirmation-modal.tsx @@ -1,5 +1,10 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; +import { z } from "zod"; +import { ZUserPassword } from "@formbricks/types/user"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -12,11 +17,6 @@ import { } from "@/modules/ui/components/dialog"; import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; import { PasswordInput } from "@/modules/ui/components/password-input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; -import { z } from "zod"; -import { ZUserPassword } from "@formbricks/types/user"; interface PasswordConfirmationModalProps { open: boolean; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.test.ts b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.test.ts index b16aca023f..c76591775e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.test.ts +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.test.ts @@ -1,7 +1,7 @@ -import { verifyPassword as mockVerifyPasswordImported } from "@/modules/auth/lib/utils"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { verifyPassword as mockVerifyPasswordImported } from "@/modules/auth/lib/utils"; import { getIsEmailUnique, verifyUserPassword } from "./user"; vi.mock("@/modules/auth/lib/utils", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.ts b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.ts index 78f8a7f154..706f2c8e68 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.ts +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/lib/user.ts @@ -1,8 +1,8 @@ -import { verifyPassword } from "@/modules/auth/lib/utils"; import { User } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { verifyPassword } from "@/modules/auth/lib/utils"; export const getUserById = reactCache( async (userId: string): Promise> => { diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/loading.tsx index 4ed2c7aafc..9ec1e9b62a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/loading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/loading.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { LoadingCard } from "@/app/(app)/components/LoadingCard"; import { AccountSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(account)/components/AccountSettingsNavbar"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; const Loading = () => { const { t } = useTranslate(); diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/page.test.tsx index 4384b94825..727e780c97 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(account)/profile/page.test.tsx @@ -1,13 +1,13 @@ -import { getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; -import { getUser } from "@/lib/user/service"; -import { getIsMultiOrgEnabled, getIsTwoFactorAuthEnabled } from "@/modules/ee/license-check/lib/utils"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import { Session } from "next-auth"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TUser } from "@formbricks/types/user"; +import { getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; +import { getUser } from "@/lib/user/service"; +import { getIsMultiOrgEnabled, getIsTwoFactorAuthEnabled } from "@/modules/ee/license-check/lib/utils"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import Page from "./page"; // Mock services and utils diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.test.tsx index 2ee8118f83..960524917b 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.test.tsx @@ -1,8 +1,8 @@ -import { getAccessFlags } from "@/lib/membership/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { usePathname } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganizationRole } from "@formbricks/types/memberships"; +import { getAccessFlags } from "@/lib/membership/utils"; import { OrganizationSettingsNavbar } from "./OrganizationSettingsNavbar"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.tsx index 5543f75fd7..cb7930fcbb 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar.tsx @@ -1,10 +1,10 @@ "use client"; -import { getAccessFlags } from "@/lib/membership/utils"; -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { useTranslate } from "@tolgee/react"; import { usePathname } from "next/navigation"; import { TOrganizationRole } from "@formbricks/types/memberships"; +import { getAccessFlags } from "@/lib/membership/utils"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; interface OrganizationSettingsNavbarProps { environmentId?: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.test.tsx index 7f8057250f..ee78d2fb1b 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.test.tsx @@ -1,8 +1,3 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { getAccessFlags } from "@/lib/membership/utils"; -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getUser } from "@/lib/user/service"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; @@ -10,6 +5,11 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TMembership } from "@formbricks/types/memberships"; import { TOrganization, TOrganizationBilling } from "@formbricks/types/organizations"; import { TUser } from "@formbricks/types/user"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { getAccessFlags } from "@/lib/membership/utils"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getUser } from "@/lib/user/service"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; vi.mock("@formbricks/database", () => ({ prisma: { diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx index 1da686e2dc..37e8ffd018 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/enterprise/page.tsx @@ -1,3 +1,6 @@ +import { CheckIcon } from "lucide-react"; +import Link from "next/link"; +import { notFound } from "next/navigation"; import { OrganizationSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { getEnterpriseLicense } from "@/modules/ee/license-check/lib/license"; @@ -6,9 +9,6 @@ import { Button } from "@/modules/ui/components/button"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { CheckIcon } from "lucide-react"; -import Link from "next/link"; -import { notFound } from "next/navigation"; const Page = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/actions.ts b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/actions.ts index 1f5b1a23c8..91246bca6c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/actions.ts @@ -1,15 +1,15 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { ZOrganizationUpdateInput } from "@formbricks/types/organizations"; import { deleteOrganization, getOrganization, updateOrganization } from "@/lib/organization/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { ZOrganizationUpdateInput } from "@formbricks/types/organizations"; const ZUpdateOrganizationNameAction = z.object({ organizationId: ZId, diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.test.tsx index 1a26159286..5ed92948e3 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.test.tsx @@ -1,11 +1,11 @@ -import { deleteOrganizationAction } from "@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions"; -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { cleanup, render, screen, waitFor, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { useRouter } from "next/navigation"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization, TOrganizationBilling } from "@formbricks/types/organizations"; +import { deleteOrganizationAction } from "@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { DeleteOrganization } from "./DeleteOrganization"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.tsx index 5e8780840d..4370ae576f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/DeleteOrganization.tsx @@ -1,16 +1,16 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { Dispatch, SetStateAction, useState } from "react"; +import toast from "react-hot-toast"; +import { TOrganization } from "@formbricks/types/organizations"; import { deleteOrganizationAction } from "@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions"; import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { Alert, AlertDescription } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { Dispatch, SetStateAction, useState } from "react"; -import toast from "react-hot-toast"; -import { TOrganization } from "@formbricks/types/organizations"; type DeleteOrganizationProps = { organization: TOrganization; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.test.tsx index 22077eef50..cd8ded8e39 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.test.tsx @@ -1,9 +1,9 @@ -import { updateOrganizationNameAction } from "@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; +import { updateOrganizationNameAction } from "@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions"; import { EditOrganizationNameForm } from "./EditOrganizationNameForm"; vi.mock("@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.tsx index e106791070..e278491223 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/components/EditOrganizationNameForm.tsx @@ -1,5 +1,12 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { TOrganizationRole } from "@formbricks/types/memberships"; +import { TOrganization, ZOrganization } from "@formbricks/types/organizations"; import { updateOrganizationNameAction } from "@/app/(app)/environments/[environmentId]/settings/(organization)/general/actions"; import { getAccessFlags } from "@/lib/membership/utils"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; @@ -14,13 +21,6 @@ import { FormProvider, } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; -import { TOrganizationRole } from "@formbricks/types/memberships"; -import { TOrganization, ZOrganization } from "@formbricks/types/organizations"; interface EditOrganizationNameProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/loading.test.tsx index a6f8614d08..4f587c32d1 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/loading.test.tsx @@ -1,8 +1,8 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { OrganizationSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { getTranslate } from "@/tolgee/server"; -import { cleanup, render, screen } from "@testing-library/react"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import Loading from "./loading"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/page.test.tsx index d7633f3188..722d5073bd 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/general/page.test.tsx @@ -1,3 +1,6 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TUser } from "@formbricks/types/user"; import { OrganizationSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar"; import { FB_LOGO_URL, IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { getUser } from "@/lib/user/service"; @@ -7,9 +10,6 @@ import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { IdBadge } from "@/modules/ui/components/id-badge"; import { getTranslate } from "@/tolgee/server"; -import { cleanup, render, screen } from "@testing-library/react"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TUser } from "@formbricks/types/user"; import { DeleteOrganization } from "./components/DeleteOrganization"; import { EditOrganizationNameForm } from "./components/EditOrganizationNameForm"; import Page from "./page"; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.test.tsx index 6c45e9fe58..739b04d769 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.test.tsx @@ -1,10 +1,10 @@ -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getProjectByEnvironmentId } from "@/lib/project/service"; import { cleanup, render, screen } from "@testing-library/react"; import { Session, getServerSession } from "next-auth"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TProject } from "@formbricks/types/project"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; import OrganizationSettingsLayout from "./layout"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.tsx index da17518960..2fcc493f9c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/layout.tsx @@ -1,8 +1,8 @@ +import { getServerSession } from "next-auth"; import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; const Layout = async (props) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/teams/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/teams/page.test.tsx index 6c2f321196..4d0fdf77f4 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/teams/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/(organization)/teams/page.test.tsx @@ -1,5 +1,5 @@ -import { TeamsPage } from "@/modules/organization/settings/teams/page"; import { describe, expect, test, vi } from "vitest"; +import { TeamsPage } from "@/modules/organization/settings/teams/page"; import Page from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsCard.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsCard.test.tsx index 3bda6fef32..15adf1c9e1 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsCard.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsCard.test.tsx @@ -1,6 +1,6 @@ -import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; vi.mock("@/modules/ui/components/badge", () => ({ Badge: ({ text }) =>
{text}
, diff --git a/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsTitle.test.tsx b/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsTitle.test.tsx index c050c2920f..fdcd63ff10 100644 --- a/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsTitle.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/settings/components/SettingsTitle.test.tsx @@ -1,6 +1,6 @@ -import { SettingsTitle } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsTitle"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test } from "vitest"; +import { SettingsTitle } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsTitle"; describe("SettingsTitle", () => { afterEach(() => { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions.ts b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions.ts index 43b6aacdba..5bff904da7 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions.ts @@ -1,13 +1,13 @@ "use server"; -import { getResponseCountBySurveyId, getResponses } from "@/lib/response/service"; -import { authenticatedActionClient } from "@/lib/utils/action-client"; -import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; -import { getOrganizationIdFromSurveyId, getProjectIdFromSurveyId } from "@/lib/utils/helper"; import { revalidatePath } from "next/cache"; import { z } from "zod"; import { ZId } from "@formbricks/types/common"; import { ZResponseFilterCriteria } from "@formbricks/types/responses"; +import { getResponseCountBySurveyId, getResponses } from "@/lib/response/service"; +import { authenticatedActionClient } from "@/lib/utils/action-client"; +import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; +import { getOrganizationIdFromSurveyId, getProjectIdFromSurveyId } from "@/lib/utils/helper"; import { getSurveySummary } from "./summary/lib/surveySummary"; export const revalidateSurveyIdPath = async (environmentId: string, surveyId: string) => { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/EmptyInAppSurveys.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/EmptyInAppSurveys.tsx index e5cc89f444..3a261e05a5 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/EmptyInAppSurveys.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/EmptyInAppSurveys.tsx @@ -1,10 +1,10 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { Unplug } from "lucide-react"; import Link from "next/link"; import { TEnvironment } from "@formbricks/types/environment"; +import { Button } from "@/modules/ui/components/button"; interface TEmptyAppSurveysProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.test.tsx index 39aa347102..b45177fa49 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.test.tsx @@ -1,11 +1,3 @@ -import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { - getResponseCountAction, - revalidateSurveyIdPath, -} from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; -import { SurveyAnalysisNavigation } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation"; -import { getFormattedFilters } from "@/app/lib/surveys/surveys"; -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { act, cleanup, render, waitFor } from "@testing-library/react"; import { useParams, usePathname, useSearchParams } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; @@ -16,6 +8,14 @@ import { TSurveyQuestion, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { + getResponseCountAction, + revalidateSurveyIdPath, +} from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; +import { SurveyAnalysisNavigation } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation"; +import { getFormattedFilters } from "@/app/lib/surveys/surveys"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; vi.mock("@/lib/constants", () => ({ IS_FORMBRICKS_CLOUD: false, diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.tsx index f821921e14..f6b2b39638 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation.tsx @@ -1,11 +1,11 @@ "use client"; -import { revalidateSurveyIdPath } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { useTranslate } from "@tolgee/react"; import { InboxIcon, PresentationIcon } from "lucide-react"; import { usePathname } from "next/navigation"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { revalidateSurveyIdPath } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; interface SurveyAnalysisNavigationProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.test.tsx index 267a04f952..338599c246 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.test.tsx @@ -1,10 +1,10 @@ -import { getResponseCountBySurveyId } from "@/lib/response/service"; -import { getSurvey } from "@/lib/survey/service"; -import { authOptions } from "@/modules/auth/lib/authOptions"; import { cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getResponseCountBySurveyId } from "@/lib/response/service"; +import { getSurvey } from "@/lib/survey/service"; +import { authOptions } from "@/modules/auth/lib/authOptions"; import SurveyLayout, { generateMetadata } from "./layout"; vi.mock("@/lib/response/service", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.tsx index 1eb4de6d19..ef78ab7323 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/layout.tsx @@ -1,8 +1,8 @@ +import { Metadata } from "next"; +import { getServerSession } from "next-auth"; import { getResponseCountBySurveyId } from "@/lib/response/service"; import { getSurvey } from "@/lib/survey/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; -import { Metadata } from "next"; -import { getServerSession } from "next-auth"; type Props = { params: Promise<{ surveyId: string; environmentId: string }>; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.test.tsx index 04254ffb65..a0c2d78293 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.test.tsx @@ -1,4 +1,3 @@ -import { ResponseTable } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; @@ -6,6 +5,7 @@ import { TResponse, TResponseDataValue } from "@formbricks/types/responses"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { ResponseTable } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable"; import { ResponseDataView, extractResponseData, diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsx index bfbc0e5e94..952ad204b3 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsx @@ -1,6 +1,5 @@ "use client"; -import { ResponseTable } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable"; import { TFnType, useTranslate } from "@tolgee/react"; import React from "react"; import { TEnvironment } from "@formbricks/types/environment"; @@ -9,6 +8,7 @@ import { TResponseDataValue, TResponseTableData, TResponseWithQuotas } from "@fo import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { ResponseTable } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable"; interface ResponseDataViewProps { survey: TSurvey; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.test.tsx index e62dc0ebae..f485213821 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.test.tsx @@ -1,5 +1,3 @@ -import { ResponseDataView } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView"; -import { ResponsePage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage"; import { act, cleanup, render, screen, waitFor } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; @@ -7,6 +5,8 @@ import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { ResponseDataView } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView"; +import { ResponsePage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage"; vi.mock("@/app/(app)/environments/[environmentId]/components/ResponseFilterContext", () => ({ useResponseFilter: vi.fn(), diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.tsx index 10fd567b57..f8c8c92645 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage.tsx @@ -1,11 +1,5 @@ "use client"; -import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { getResponsesAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; -import { ResponseDataView } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView"; -import { CustomFilter } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter"; -import { getFormattedFilters } from "@/app/lib/surveys/surveys"; -import { replaceHeadlineRecall } from "@/lib/utils/recall"; import { useSearchParams } from "next/navigation"; import { useCallback, useEffect, useMemo, useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; @@ -14,6 +8,12 @@ import { TResponseWithQuotas } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { getResponsesAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; +import { ResponseDataView } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView"; +import { CustomFilter } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter"; +import { getFormattedFilters } from "@/app/lib/surveys/surveys"; +import { replaceHeadlineRecall } from "@/lib/utils/recall"; interface ResponsePageProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.test.tsx index d7d4d4c209..78c10a2fe9 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.test.tsx @@ -1,6 +1,3 @@ -import { ResponseTable } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable"; -import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; @@ -10,6 +7,9 @@ import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUserLocale } from "@formbricks/types/user"; +import { ResponseTable } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable"; +import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; vi.mock("@sentry/nextjs", () => ({ captureException: vi.fn() })); diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.tsx index de6357c6f3..f3aca83057 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTable.tsx @@ -1,19 +1,5 @@ "use client"; -import { ResponseCardModal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseCardModal"; -import { ResponseTableCell } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableCell"; -import { generateResponseTableColumns } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableColumns"; -import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; -import { downloadResponsesFile } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/utils"; -import { deleteResponseAction } from "@/modules/analysis/components/SingleResponseCard/actions"; -import { Button } from "@/modules/ui/components/button"; -import { - DataTableHeader, - DataTableSettingsModal, - DataTableToolbar, -} from "@/modules/ui/components/data-table"; -import { Skeleton } from "@/modules/ui/components/skeleton"; -import { Table, TableBody, TableCell, TableHeader, TableRow } from "@/modules/ui/components/table"; import { DndContext, type DragEndEvent, @@ -38,6 +24,20 @@ import { TResponseTableData, TResponseWithQuotas } from "@formbricks/types/respo import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { ResponseCardModal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseCardModal"; +import { ResponseTableCell } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableCell"; +import { generateResponseTableColumns } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableColumns"; +import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; +import { downloadResponsesFile } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/utils"; +import { deleteResponseAction } from "@/modules/analysis/components/SingleResponseCard/actions"; +import { Button } from "@/modules/ui/components/button"; +import { + DataTableHeader, + DataTableSettingsModal, + DataTableToolbar, +} from "@/modules/ui/components/data-table"; +import { Skeleton } from "@/modules/ui/components/skeleton"; +import { Table, TableBody, TableCell, TableHeader, TableRow } from "@/modules/ui/components/table"; interface ResponseTableProps { data: TResponseTableData[]; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableCell.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableCell.tsx index 75e5e90e96..aee5297421 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableCell.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableCell.tsx @@ -1,9 +1,9 @@ -import { cn } from "@/lib/cn"; -import { getCommonPinningStyles } from "@/modules/ui/components/data-table/lib/utils"; -import { TableCell } from "@/modules/ui/components/table"; import { Cell, Row, flexRender } from "@tanstack/react-table"; import { Maximize2Icon } from "lucide-react"; import { TResponse, TResponseTableData } from "@formbricks/types/responses"; +import { cn } from "@/lib/cn"; +import { getCommonPinningStyles } from "@/modules/ui/components/data-table/lib/utils"; +import { TableCell } from "@/modules/ui/components/table"; interface ResponseTableCellProps { cell: Cell; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableColumns.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableColumns.test.tsx index 3625b52f0c..1e12346b22 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableColumns.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponseTableColumns.test.tsx @@ -1,7 +1,3 @@ -import { extractChoiceIdsFromResponse } from "@/lib/response/utils"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { getFormattedDateTimeString } from "@/lib/utils/datetime"; -import { getSelectionColumn } from "@/modules/ui/components/data-table"; import { cleanup } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TResponseTableData } from "@formbricks/types/responses"; @@ -12,6 +8,10 @@ import { TSurveyVariable, } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; +import { extractChoiceIdsFromResponse } from "@/lib/response/utils"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { getFormattedDateTimeString } from "@/lib/utils/datetime"; +import { getSelectionColumn } from "@/modules/ui/components/data-table"; import { generateResponseTableColumns } from "./ResponseTableColumns"; // Mock TFnType diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/page.test.tsx index bde5911168..32431c969a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/page.test.tsx @@ -1,3 +1,9 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TTag } from "@formbricks/types/tags"; +import { TUser, TUserLocale } from "@formbricks/types/user"; import { ResponseFilterProvider } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; import { SurveyAnalysisNavigation } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation"; import { ResponsePage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/responses/components/ResponsePage"; @@ -15,12 +21,6 @@ import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; import { getOrganizationBilling } from "@/modules/survey/lib/survey"; -import { cleanup, render, screen } from "@testing-library/react"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TTag } from "@formbricks/types/tags"; -import { TUser, TUserLocale } from "@formbricks/types/user"; vi.mock( "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation", diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions.ts b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions.ts index cf305da2ae..eacb6e70b5 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError, ResourceNotFoundError, UnknownError } from "@formbricks/types/errors"; import { getEmailTemplateHtml } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/emailTemplate"; import { getSurvey, updateSurvey } from "@/lib/survey/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; @@ -12,9 +15,6 @@ import { generatePersonalLinks } from "@/modules/ee/contacts/lib/contacts"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { getOrganizationLogoUrl } from "@/modules/ee/whitelabel/email-customization/lib/organization"; import { sendEmbedSurveyPreviewEmail } from "@/modules/email"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError, ResourceNotFoundError, UnknownError } from "@formbricks/types/errors"; import { deleteResponsesAndDisplaysForSurvey } from "./lib/survey"; const ZSendEmbedSurveyPreviewEmailAction = z.object({ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/AddressSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/AddressSummary.tsx index 0e9b68515b..2330f3da8c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/AddressSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/AddressSummary.tsx @@ -1,13 +1,13 @@ "use client"; -import { timeSince } from "@/lib/time"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { ArrayResponse } from "@/modules/ui/components/array-response"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; import { TSurvey, TSurveyQuestionSummaryAddress } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { ArrayResponse } from "@/modules/ui/components/array-response"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface AddressSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CTASummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CTASummary.tsx index ed8fa7f5b1..0446c578ea 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CTASummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CTASummary.tsx @@ -1,9 +1,9 @@ "use client"; -import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import { InboxIcon } from "lucide-react"; import { TSurvey, TSurveyQuestionSummaryCta } from "@formbricks/types/surveys/types"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { convertFloatToNDecimal } from "../lib/utils"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CalSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CalSummary.tsx index 3566a2afdd..5df8df73b5 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CalSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/CalSummary.tsx @@ -1,9 +1,9 @@ "use client"; -import { convertFloatToNDecimal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; -import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import { TSurvey, TSurveyQuestionSummaryCal } from "@formbricks/types/surveys/types"; +import { convertFloatToNDecimal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface CalSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ConsentSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ConsentSummary.tsx index 73f1a243a3..d692778993 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ConsentSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ConsentSummary.tsx @@ -1,6 +1,5 @@ "use client"; -import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import { TI18nString, @@ -9,6 +8,7 @@ import { TSurveyQuestionSummaryConsent, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { convertFloatToNDecimal } from "../lib/utils"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ContactInfoSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ContactInfoSummary.tsx index 2aecef1db6..71275a019b 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ContactInfoSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ContactInfoSummary.tsx @@ -1,13 +1,13 @@ "use client"; -import { timeSince } from "@/lib/time"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { ArrayResponse } from "@/modules/ui/components/array-response"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; import { TSurvey, TSurveyQuestionSummaryContactInfo } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { ArrayResponse } from "@/modules/ui/components/array-response"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface ContactInfoSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/DateQuestionSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/DateQuestionSummary.tsx index a2fa7558a3..c04257cfe8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/DateQuestionSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/DateQuestionSummary.tsx @@ -1,15 +1,15 @@ "use client"; -import { timeSince } from "@/lib/time"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { formatDateWithOrdinal } from "@/lib/utils/datetime"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; import { useState } from "react"; import { TSurvey, TSurveyQuestionSummaryDate } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { formatDateWithOrdinal } from "@/lib/utils/datetime"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; +import { Button } from "@/modules/ui/components/button"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface DateQuestionSummary { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.test.tsx index b640e5e8b2..08ad1c1df5 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.test.tsx @@ -1,4 +1,3 @@ -import { FileUploadSummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; @@ -8,6 +7,7 @@ import { TSurveyQuestionSummaryFileUpload, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { FileUploadSummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary"; // Mock child components and hooks vi.mock("@/modules/ui/components/avatars", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.tsx index 5e167a9848..7091cb2f6a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/FileUploadSummary.tsx @@ -1,16 +1,16 @@ "use client"; -import { timeSince } from "@/lib/time"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { getOriginalFileNameFromUrl } from "@/modules/storage/utils"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { DownloadIcon, FileIcon } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; import { TSurvey, TSurveyQuestionSummaryFileUpload } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { getOriginalFileNameFromUrl } from "@/modules/storage/utils"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; +import { Button } from "@/modules/ui/components/button"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface FileUploadSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/HiddenFieldsSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/HiddenFieldsSummary.tsx index e4210bde63..272f2a19a6 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/HiddenFieldsSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/HiddenFieldsSummary.tsx @@ -1,15 +1,15 @@ "use client"; -import { timeSince } from "@/lib/time"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { InboxIcon, Link, MessageSquareTextIcon } from "lucide-react"; import { useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TSurveyQuestionSummaryHiddenFields } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; +import { Button } from "@/modules/ui/components/button"; interface HiddenFieldsSummaryProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MatrixQuestionSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MatrixQuestionSummary.tsx index 2b249875ba..750d356d6a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MatrixQuestionSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MatrixQuestionSummary.tsx @@ -1,6 +1,5 @@ "use client"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { TI18nString, @@ -9,6 +8,7 @@ import { TSurveyQuestionSummaryMatrix, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface MatrixQuestionSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MultipleChoiceSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MultipleChoiceSummary.tsx index 129f03eb16..592cb4af6e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MultipleChoiceSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MultipleChoiceSummary.tsx @@ -1,11 +1,5 @@ "use client"; -import { getChoiceIdByValue } from "@/lib/response/utils"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; -import { Button } from "@/modules/ui/components/button"; -import { IdBadge } from "@/modules/ui/components/id-badge"; -import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import { InboxIcon } from "lucide-react"; import Link from "next/link"; @@ -18,6 +12,12 @@ import { TSurveyQuestionTypeEnum, TSurveyType, } from "@formbricks/types/surveys/types"; +import { getChoiceIdByValue } from "@/lib/response/utils"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; +import { Button } from "@/modules/ui/components/button"; +import { IdBadge } from "@/modules/ui/components/id-badge"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { convertFloatToNDecimal } from "../lib/utils"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/NPSSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/NPSSummary.tsx index fc119fef50..76138545f0 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/NPSSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/NPSSummary.tsx @@ -1,6 +1,5 @@ "use client"; -import { HalfCircle, ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import { TI18nString, @@ -9,6 +8,7 @@ import { TSurveyQuestionSummaryNps, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { HalfCircle, ProgressBar } from "@/modules/ui/components/progress-bar"; import { convertFloatToNDecimal } from "../lib/utils"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/OpenTextSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/OpenTextSummary.tsx index 6465a02ac5..eefce91b89 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/OpenTextSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/OpenTextSummary.tsx @@ -1,16 +1,16 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import Link from "next/link"; +import { useState } from "react"; +import { TSurvey, TSurveyQuestionSummaryOpenText } from "@formbricks/types/surveys/types"; +import { TUserLocale } from "@formbricks/types/user"; import { timeSince } from "@/lib/time"; import { getContactIdentifier } from "@/lib/utils/contact"; import { renderHyperlinkedContent } from "@/modules/analysis/utils"; import { PersonAvatar } from "@/modules/ui/components/avatars"; import { Button } from "@/modules/ui/components/button"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/modules/ui/components/table"; -import { useTranslate } from "@tolgee/react"; -import Link from "next/link"; -import { useState } from "react"; -import { TSurvey, TSurveyQuestionSummaryOpenText } from "@formbricks/types/surveys/types"; -import { TUserLocale } from "@formbricks/types/user"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface OpenTextSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/PictureChoiceSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/PictureChoiceSummary.tsx index 2e225714e4..cbcb4eeaec 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/PictureChoiceSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/PictureChoiceSummary.tsx @@ -1,8 +1,5 @@ "use client"; -import { getChoiceIdByValue } from "@/lib/response/utils"; -import { IdBadge } from "@/modules/ui/components/id-badge"; -import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import { InboxIcon } from "lucide-react"; import Image from "next/image"; @@ -13,6 +10,9 @@ import { TSurveyQuestionSummaryPictureSelection, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { getChoiceIdByValue } from "@/lib/response/utils"; +import { IdBadge } from "@/modules/ui/components/id-badge"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { convertFloatToNDecimal } from "../lib/utils"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RankingSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RankingSummary.tsx index 95e0106eed..6751fada84 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RankingSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RankingSummary.tsx @@ -1,7 +1,7 @@ -import { getChoiceIdByValue } from "@/lib/response/utils"; -import { IdBadge } from "@/modules/ui/components/id-badge"; import { useTranslate } from "@tolgee/react"; import { TSurvey, TSurveyQuestionSummaryRanking } from "@formbricks/types/surveys/types"; +import { getChoiceIdByValue } from "@/lib/response/utils"; +import { IdBadge } from "@/modules/ui/components/id-badge"; import { convertFloatToNDecimal } from "../lib/utils"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RatingSummary.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RatingSummary.tsx index 675c4f703f..c473bc753e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RatingSummary.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/RatingSummary.tsx @@ -1,8 +1,5 @@ "use client"; -import { convertFloatToNDecimal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; -import { ProgressBar } from "@/modules/ui/components/progress-bar"; -import { RatingResponse } from "@/modules/ui/components/rating-response"; import { useTranslate } from "@tolgee/react"; import { CircleSlash2, SmileIcon, StarIcon } from "lucide-react"; import { useMemo } from "react"; @@ -13,6 +10,9 @@ import { TSurveyQuestionSummaryRating, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { convertFloatToNDecimal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; +import { RatingResponse } from "@/modules/ui/components/rating-response"; import { QuestionSummaryHeader } from "./QuestionSummaryHeader"; interface RatingSummaryProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SuccessMessage.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SuccessMessage.tsx index e68f83c50c..b793e4af43 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SuccessMessage.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SuccessMessage.tsx @@ -1,12 +1,12 @@ "use client"; -import { Confetti } from "@/modules/ui/components/confetti"; import { useTranslate } from "@tolgee/react"; import { useSearchParams } from "next/navigation"; import { useEffect, useState } from "react"; import toast from "react-hot-toast"; import { TEnvironment } from "@formbricks/types/environment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { Confetti } from "@/modules/ui/components/confetti"; interface SummaryMetadataProps { environment: TEnvironment; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.test.tsx index 6a09f503da..8138eaec7f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.test.tsx @@ -1,7 +1,3 @@ -import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { MultipleChoiceSummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MultipleChoiceSummary"; -import { constructToastMessage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; -import { OptionsType } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; import { cleanup, render, screen } from "@testing-library/react"; import { toast } from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -13,6 +9,10 @@ import { TSurveySummary, } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { MultipleChoiceSummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/MultipleChoiceSummary"; +import { constructToastMessage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; +import { OptionsType } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; import { SummaryList } from "./SummaryList"; // Mock child components diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.tsx index 513eaa9015..64efb24b66 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryList.tsx @@ -1,5 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { toast } from "react-hot-toast"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TI18nString, TSurveyQuestionId, TSurveySummary } from "@formbricks/types/surveys/types"; +import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TUserLocale } from "@formbricks/types/user"; import { SelectedFilterValue, useResponseFilter, @@ -24,13 +31,6 @@ import { OptionsType } from "@/app/(app)/environments/[environmentId]/surveys/[s import { getLocalizedValue } from "@/lib/i18n/utils"; import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { SkeletonLoader } from "@/modules/ui/components/skeleton-loader"; -import { useTranslate } from "@tolgee/react"; -import { toast } from "react-hot-toast"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TI18nString, TSurveyQuestionId, TSurveySummary } from "@formbricks/types/surveys/types"; -import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TUserLocale } from "@formbricks/types/user"; import { AddressSummary } from "./AddressSummary"; interface SummaryListProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryMetadata.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryMetadata.tsx index cf327e183d..faff792a08 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryMetadata.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryMetadata.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { TSurveySummary } from "@formbricks/types/surveys/types"; import { InteractiveCard } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/interactive-card"; import { StatCard } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/stat-card"; import { cn } from "@/modules/ui/lib/utils"; -import { useTranslate } from "@tolgee/react"; -import { TSurveySummary } from "@formbricks/types/surveys/types"; interface SummaryMetadataProps { surveySummary: TSurveySummary["meta"]; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx index f91066f4b3..06edd27fe9 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage.tsx @@ -1,5 +1,10 @@ "use client"; +import { useSearchParams } from "next/navigation"; +import { useEffect, useMemo, useState } from "react"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TSurvey, TSurveySummary } from "@formbricks/types/surveys/types"; +import { TUserLocale } from "@formbricks/types/user"; import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; import { getSurveySummaryAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/actions"; import ScrollToTop from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/ScrollToTop"; @@ -8,11 +13,6 @@ import { CustomFilter } from "@/app/(app)/environments/[environmentId]/surveys/[ import { getFormattedFilters } from "@/app/lib/surveys/surveys"; import { replaceHeadlineRecall } from "@/lib/utils/recall"; import { QuotasSummary } from "@/modules/ee/quotas/components/quotas-summary"; -import { useSearchParams } from "next/navigation"; -import { useEffect, useMemo, useState } from "react"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TSurvey, TSurveySummary } from "@formbricks/types/surveys/types"; -import { TUserLocale } from "@formbricks/types/user"; import { SummaryList } from "./SummaryList"; import { SummaryMetadata } from "./SummaryMetadata"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SurveyAnalysisCTA.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SurveyAnalysisCTA.tsx index 197eabd171..ba5b234c41 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SurveyAnalysisCTA.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SurveyAnalysisCTA.tsx @@ -1,5 +1,14 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { BellRing, Eye, ListRestart, SquarePenIcon } from "lucide-react"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { useEffect, useState } from "react"; +import toast from "react-hot-toast"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TSegment } from "@formbricks/types/segment"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TUser } from "@formbricks/types/user"; import { useEnvironment } from "@/app/(app)/environments/[environmentId]/context/environment-context"; import { SuccessMessage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SuccessMessage"; import { ShareSurveyModal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/share-survey-modal"; @@ -11,15 +20,6 @@ import { copySurveyToOtherEnvironmentAction } from "@/modules/survey/list/action import { Button } from "@/modules/ui/components/button"; import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; import { IconBar } from "@/modules/ui/components/iconbar"; -import { useTranslate } from "@tolgee/react"; -import { BellRing, Eye, ListRestart, SquarePenIcon } from "lucide-react"; -import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { useEffect, useState } from "react"; -import toast from "react-hot-toast"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TSegment } from "@formbricks/types/segment"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TUser } from "@formbricks/types/user"; import { resetSurveyAction } from "../actions"; interface SurveyAnalysisCTAProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card.tsx index f8e59817a3..d5ae2ad8b6 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card.tsx @@ -1,8 +1,8 @@ "use client"; +import { ReactNode } from "react"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { cn } from "@/modules/ui/lib/utils"; -import { ReactNode } from "react"; interface BaseCardProps { label: ReactNode; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/interactive-card.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/interactive-card.tsx index f6ceb648a3..d34a757bc6 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/interactive-card.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/interactive-card.tsx @@ -1,7 +1,7 @@ "use client"; -import { BaseCard } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card"; import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"; +import { BaseCard } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card"; interface InteractiveCardProps { tab: "dropOffs" | "quotas"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/share-survey-modal.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/share-survey-modal.tsx index b40f37f7f1..75cbb1151c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/share-survey-modal.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/share-survey-modal.tsx @@ -1,5 +1,21 @@ "use client"; +import { VisuallyHidden } from "@radix-ui/react-visually-hidden"; +import { useTranslate } from "@tolgee/react"; +import { + Code2Icon, + LinkIcon, + MailIcon, + QrCodeIcon, + Settings, + Share2Icon, + SquareStack, + UserIcon, +} from "lucide-react"; +import { useCallback, useEffect, useMemo, useState } from "react"; +import { TSegment } from "@formbricks/types/segment"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TUser } from "@formbricks/types/user"; import { AnonymousLinksTab } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/anonymous-links-tab"; import { AppTab } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab"; import { DynamicPopupTab } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/dynamic-popup-tab"; @@ -17,22 +33,6 @@ import { } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/types/share"; import { getSurveyUrl } from "@/modules/analysis/utils"; import { Dialog, DialogContent, DialogTitle } from "@/modules/ui/components/dialog"; -import { VisuallyHidden } from "@radix-ui/react-visually-hidden"; -import { useTranslate } from "@tolgee/react"; -import { - Code2Icon, - LinkIcon, - MailIcon, - QrCodeIcon, - Settings, - Share2Icon, - SquareStack, - UserIcon, -} from "lucide-react"; -import { useCallback, useEffect, useMemo, useState } from "react"; -import { TSegment } from "@formbricks/types/segment"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TUser } from "@formbricks/types/user"; import { ShareView } from "./shareEmbedModal/share-view"; import { SuccessView } from "./shareEmbedModal/success-view"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/anonymous-links-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/anonymous-links-tab.tsx index a0ec4d7c9a..810f36c539 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/anonymous-links-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/anonymous-links-tab.tsx @@ -1,5 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { CirclePlayIcon, CopyIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import toast from "react-hot-toast"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TUserLocale } from "@formbricks/types/user"; import { updateSingleUseLinksAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions"; import { DisableLinkModal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/disable-link-modal"; import { DocumentationLinks } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links"; @@ -9,13 +16,6 @@ import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-to import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { CirclePlayIcon, CopyIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import toast from "react-hot-toast"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TUserLocale } from "@formbricks/types/user"; interface AnonymousLinksTabProps { survey: TSurvey; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.test.tsx index 9162e7a5ef..921f719d57 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.test.tsx @@ -1,5 +1,3 @@ -import { EnvironmentContextWrapper } from "@/app/(app)/environments/[environmentId]/context/environment-context"; -import { SurveyContextWrapper } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; @@ -8,6 +6,8 @@ import { TEnvironment } from "@formbricks/types/environment"; import { TProject } from "@formbricks/types/project"; import { TBaseFilter, TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyWelcomeCard } from "@formbricks/types/surveys/types"; +import { EnvironmentContextWrapper } from "@/app/(app)/environments/[environmentId]/context/environment-context"; +import { SurveyContextWrapper } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; import { AppTab } from "./app-tab"; // Mock Next.js Link component diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.tsx index 8c963034bd..adaba91e5f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/app-tab.tsx @@ -1,9 +1,5 @@ "use client"; -import { useEnvironment } from "@/app/(app)/environments/[environmentId]/context/environment-context"; -import { useSurvey } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; -import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; -import { H4, InlineSmall, Small } from "@/modules/ui/components/typography"; import { useTranslate } from "@tolgee/react"; import { CodeXmlIcon, @@ -17,6 +13,10 @@ import Link from "next/link"; import { ReactNode, useMemo } from "react"; import { TActionClass } from "@formbricks/types/action-classes"; import { TSegment } from "@formbricks/types/segment"; +import { useEnvironment } from "@/app/(app)/environments/[environmentId]/context/environment-context"; +import { useSurvey } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; +import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; +import { H4, InlineSmall, Small } from "@/modules/ui/components/typography"; import { DocumentationLinksSection } from "./documentation-links-section"; const createDocumentationLinks = (t: ReturnType["t"]) => [ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/disable-link-modal.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/disable-link-modal.tsx index 145da025e0..b006158a11 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/disable-link-modal.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/disable-link-modal.tsx @@ -1,3 +1,4 @@ +import { useTranslate } from "@tolgee/react"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -7,7 +8,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; interface DisableLinkModalProps { open: boolean; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links-section.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links-section.tsx index eef4afb604..3d4ae641a4 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links-section.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links-section.tsx @@ -1,10 +1,10 @@ "use client"; -import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; -import { H4 } from "@/modules/ui/components/typography"; import { useTranslate } from "@tolgee/react"; import { ArrowUpRight } from "lucide-react"; import Link from "next/link"; +import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; +import { H4 } from "@/modules/ui/components/typography"; interface DocumentationLink { href: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links.tsx index 55d652c1af..9ce25ef096 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links.tsx @@ -1,8 +1,8 @@ "use client"; -import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; +import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; interface DocumentationLinksProps { links: { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/dynamic-popup-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/dynamic-popup-tab.tsx index bbb81a10d5..8daace6247 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/dynamic-popup-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/dynamic-popup-tab.tsx @@ -1,9 +1,9 @@ "use client"; -import { DocumentationLinks } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links"; -import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; +import { DocumentationLinks } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links"; +import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; interface DynamicPopupTabProps { environmentId: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.test.tsx index dbc8b3ceb9..b837bc00b4 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.test.tsx @@ -1,9 +1,9 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { AuthenticationError } from "@formbricks/types/errors"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { getEmailHtmlAction, sendEmbedSurveyPreviewEmailAction } from "../../actions"; import { EmailTab } from "./email-tab"; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.tsx index 4ccd6cbbe6..0d43b0a8c0 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/email-tab.tsx @@ -1,16 +1,16 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Button } from "@/modules/ui/components/button"; -import { CodeBlock } from "@/modules/ui/components/code-block"; -import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; -import { TabBar } from "@/modules/ui/components/tab-bar"; import { useTranslate } from "@tolgee/react"; import DOMPurify from "dompurify"; import { CopyIcon, SendIcon } from "lucide-react"; import { useEffect, useMemo, useState } from "react"; import toast from "react-hot-toast"; import { AuthenticationError } from "@formbricks/types/errors"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Button } from "@/modules/ui/components/button"; +import { CodeBlock } from "@/modules/ui/components/code-block"; +import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; +import { TabBar } from "@/modules/ui/components/tab-bar"; import { getEmailHtmlAction, sendEmbedSurveyPreviewEmailAction } from "../../actions"; interface EmailTabProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.test.tsx index f5daea5771..e2e35ff2c5 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.test.tsx @@ -1,12 +1,12 @@ -import { useSurvey } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; -import { createI18nString, extractLanguageCodes, getEnabledLanguages } from "@/lib/i18n/utils"; -import { updateSurveyAction } from "@/modules/survey/editor/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import { TSurvey, TSurveyLanguage } from "@formbricks/types/surveys/types"; +import { useSurvey } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; +import { createI18nString, extractLanguageCodes, getEnabledLanguages } from "@/lib/i18n/utils"; +import { updateSurveyAction } from "@/modules/survey/editor/actions"; import { LinkSettingsTab } from "./link-settings-tab"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.tsx index 5786ac1159..f1492d350f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/link-settings-tab.tsx @@ -1,5 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useMemo, useState } from "react"; +import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; +import { TI18nString, TSurvey, TSurveyMetadata } from "@formbricks/types/surveys/types"; import { useSurvey } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/context/survey-context"; import { createI18nString, extractLanguageCodes, getEnabledLanguages } from "@/lib/i18n/utils"; import { updateSurveyAction } from "@/modules/survey/editor/actions"; @@ -22,12 +28,6 @@ import { SelectTrigger, SelectValue, } from "@/modules/ui/components/select"; -import { useTranslate } from "@tolgee/react"; -import { useMemo, useState } from "react"; -import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; -import { TI18nString, TSurvey, TSurveyMetadata } from "@formbricks/types/surveys/types"; interface LinkSettingsTabProps { isReadOnly: boolean; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.test.tsx index e7e0ad8d83..180cdbdf85 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.test.tsx @@ -1,9 +1,9 @@ -import { generatePersonalLinksAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; import "@testing-library/jest-dom/vitest"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { generatePersonalLinksAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/actions"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { PersonalLinksTab } from "./personal-links-tab"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.tsx index 9b6963eb4c..6713d6da2e 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/personal-links-tab.tsx @@ -1,5 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { DownloadIcon } from "lucide-react"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { TSegment } from "@formbricks/types/segment"; import { DocumentationLinks } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/documentation-links"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { Button } from "@/modules/ui/components/button"; @@ -20,12 +26,6 @@ import { SelectValue, } from "@/modules/ui/components/select"; import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; -import { useTranslate } from "@tolgee/react"; -import { DownloadIcon } from "lucide-react"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { TSegment } from "@formbricks/types/segment"; import { generatePersonalLinksAction } from "../../actions"; interface PersonalLinksTabProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/qr-code-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/qr-code-tab.tsx index 8589f81b60..12058b980c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/qr-code-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/qr-code-tab.tsx @@ -1,14 +1,14 @@ "use client"; -import { getQRCodeOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/get-qr-code-options"; -import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { Download, LoaderCircle } from "lucide-react"; import QRCodeStyling from "qr-code-styling"; import { useEffect, useRef, useState } from "react"; import { toast } from "react-hot-toast"; import { logger } from "@formbricks/logger"; +import { getQRCodeOptions } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/get-qr-code-options"; +import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; +import { Button } from "@/modules/ui/components/button"; interface QRCodeTabProps { surveyUrl: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/share-view.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/share-view.tsx index 4978d15a19..31583d8c40 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/share-view.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/share-view.tsx @@ -1,5 +1,7 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useEffect, useState } from "react"; import { TabContainer } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/tab-container"; import { LinkTabsType, @@ -21,8 +23,6 @@ import { } from "@/modules/ui/components/sidebar"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { Small } from "@/modules/ui/components/typography"; -import { useTranslate } from "@tolgee/react"; -import { useEffect, useState } from "react"; interface ShareViewProps { tabs: Array<{ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/social-media-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/social-media-tab.tsx index d64f3ca367..498ebb294f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/social-media-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/social-media-tab.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { AlertCircleIcon } from "lucide-react"; +import { useMemo } from "react"; import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; import { FacebookIcon } from "@/modules/ui/components/icons/facebook-icon"; @@ -7,9 +10,6 @@ import { LinkedinIcon } from "@/modules/ui/components/icons/linkedin-icon"; import { RedditIcon } from "@/modules/ui/components/icons/reddit-icon"; import { ThreadsIcon } from "@/modules/ui/components/icons/threads-icon"; import { XIcon } from "@/modules/ui/components/icons/x-icon"; -import { useTranslate } from "@tolgee/react"; -import { AlertCircleIcon } from "lucide-react"; -import { useMemo } from "react"; interface SocialMediaTabProps { surveyUrl: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/success-view.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/success-view.tsx index 0da4a8de9c..647f46be57 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/success-view.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/success-view.tsx @@ -1,11 +1,11 @@ -import { ShareSurveyLink } from "@/modules/analysis/components/ShareSurveyLink"; -import { Badge } from "@/modules/ui/components/badge"; import { useTranslate } from "@tolgee/react"; import { BellRing, BlocksIcon, Share2Icon, UserIcon } from "lucide-react"; import Link from "next/link"; import React from "react"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUser } from "@formbricks/types/user"; +import { ShareSurveyLink } from "@/modules/analysis/components/ShareSurveyLink"; +import { Badge } from "@/modules/ui/components/badge"; interface SuccessViewProps { survey: TSurvey; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/website-embed-tab.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/website-embed-tab.tsx index 6799b6cc55..963b3bbf5c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/website-embed-tab.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/shareEmbedModal/website-embed-tab.tsx @@ -1,12 +1,12 @@ "use client"; -import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; -import { Button } from "@/modules/ui/components/button"; -import { CodeBlock } from "@/modules/ui/components/code-block"; import { useTranslate } from "@tolgee/react"; import { CopyIcon } from "lucide-react"; import { useState } from "react"; import toast from "react-hot-toast"; +import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; +import { Button } from "@/modules/ui/components/button"; +import { CodeBlock } from "@/modules/ui/components/code-block"; interface WebsiteEmbedTabProps { surveyUrl: string; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/stat-card.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/stat-card.tsx index 4c194295e5..5d625556b1 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/stat-card.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/stat-card.tsx @@ -1,7 +1,7 @@ "use client"; -import { BaseCard } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card"; import { ReactNode } from "react"; +import { BaseCard } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/base-card"; interface StatCardProps { label: ReactNode; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/emailTemplate.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/emailTemplate.test.tsx index b94790b905..a413bfda35 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/emailTemplate.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/emailTemplate.test.tsx @@ -1,13 +1,13 @@ -import { getPublicDomain } from "@/lib/getPublicUrl"; -import { getProjectByEnvironmentId } from "@/lib/project/service"; -import { getSurvey } from "@/lib/survey/service"; -import { getStyling } from "@/lib/utils/styling"; -import { getPreviewEmailTemplateHtml } from "@/modules/email/components/preview-email-template"; import { cleanup } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TProject } from "@formbricks/types/project"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getPublicDomain } from "@/lib/getPublicUrl"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; +import { getSurvey } from "@/lib/survey/service"; +import { getStyling } from "@/lib/utils/styling"; +import { getPreviewEmailTemplateHtml } from "@/modules/email/components/preview-email-template"; import { getEmailTemplateHtml } from "./emailTemplate"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey.ts b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey.ts index 019734b6e6..f0d995ff7c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey.ts +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey.ts @@ -1,8 +1,8 @@ import "server-only"; -import { convertFloatTo2Decimal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { convertFloatTo2Decimal } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/utils"; export const deleteResponsesAndDisplaysForSurvey = async ( surveyId: string diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.test.ts b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.test.ts index 1da975bb65..ff95678b15 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.test.ts +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary.test.ts @@ -1,9 +1,3 @@ -import { getQuotasSummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey"; -import { getDisplayCountBySurveyId } from "@/lib/display/service"; -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { getResponseCountBySurveyId } from "@/lib/response/service"; -import { getSurvey } from "@/lib/survey/service"; -import { evaluateLogic, performActions } from "@/lib/surveyLogic/utils"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -16,6 +10,12 @@ import { TSurveyQuestionTypeEnum, TSurveySummary, } from "@formbricks/types/surveys/types"; +import { getQuotasSummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/survey"; +import { getDisplayCountBySurveyId } from "@/lib/display/service"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { getResponseCountBySurveyId } from "@/lib/response/service"; +import { getSurvey } from "@/lib/survey/service"; +import { evaluateLogic, performActions } from "@/lib/surveyLogic/utils"; import { getQuestionSummary, getResponsesForSummary, diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/loading.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/loading.tsx index 7cabd0bae8..37a5999a2f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/loading.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/loading.tsx @@ -1,9 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { SkeletonLoader } from "@/modules/ui/components/skeleton-loader"; -import { useTranslate } from "@tolgee/react"; const Loading = () => { const { t } = useTranslate(); diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.test.tsx index e122d662ab..d42a4e0b6c 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.test.tsx @@ -1,3 +1,9 @@ +import { cleanup, render, screen } from "@testing-library/react"; +import { notFound } from "next/navigation"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TUser } from "@formbricks/types/user"; import { ResponseFilterProvider } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; import { SurveyAnalysisNavigation } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation"; import { SummaryPage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage"; @@ -13,12 +19,6 @@ import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; import { getOrganizationBilling } from "@/modules/survey/lib/survey"; -import { cleanup, render, screen } from "@testing-library/react"; -import { notFound } from "next/navigation"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TUser } from "@formbricks/types/user"; vi.mock("@/lib/constants", () => ({ IS_FORMBRICKS_CLOUD: false, diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx index c835eba6c4..36e9bb19e8 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/page.tsx @@ -1,3 +1,4 @@ +import { notFound } from "next/navigation"; import { SurveyAnalysisNavigation } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/components/SurveyAnalysisNavigation"; import { SummaryPage } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SummaryPage"; import { SurveyAnalysisCTA } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/components/SurveyAnalysisCTA"; @@ -15,7 +16,6 @@ import { IdBadge } from "@/modules/ui/components/id-badge"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { notFound } from "next/navigation"; const SurveyPage = async (props: { params: Promise<{ environmentId: string; surveyId: string }> }) => { const params = await props.params; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions.ts b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions.ts index c036181157..91100b25e3 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions.ts +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions.ts @@ -1,5 +1,10 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZResponseFilterCriteria } from "@formbricks/types/responses"; +import { TSurvey, ZSurvey } from "@formbricks/types/surveys/types"; import { getOrganization } from "@/lib/organization/service"; import { getResponseDownloadFile, getResponseFilteringValues } from "@/lib/response/service"; import { getSurvey, updateSurvey } from "@/lib/survey/service"; @@ -15,11 +20,6 @@ import { getQuotas } from "@/modules/ee/quotas/lib/quotas"; import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; import { checkSpamProtectionPermission } from "@/modules/survey/lib/permission"; import { getOrganizationBilling } from "@/modules/survey/lib/survey"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZResponseFilterCriteria } from "@formbricks/types/responses"; -import { TSurvey, ZSurvey } from "@formbricks/types/surveys/types"; const ZGetResponsesDownloadUrlAction = z.object({ surveyId: ZId, diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.test.tsx index 226ab68c1c..1a619bc4ad 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.test.tsx @@ -1,14 +1,14 @@ -import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; -import { getFormattedFilters, getTodayDate } from "@/app/lib/surveys/surveys"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { format } from "date-fns"; import { useParams } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; +import { getFormattedFilters, getTodayDate } from "@/app/lib/surveys/surveys"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; import { CustomFilter } from "./CustomFilter"; vi.mock("@/app/(app)/environments/[environmentId]/components/ResponseFilterContext", () => ({ diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsx index 3fec48bd48..c7c1980114 100755 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsx @@ -1,21 +1,5 @@ "use client"; -import { - DateRange, - useResponseFilter, -} from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; -import { downloadResponsesFile } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/utils"; -import { getFormattedFilters, getTodayDate } from "@/app/lib/surveys/surveys"; -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; -import { Calendar } from "@/modules/ui/components/calendar"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/modules/ui/components/dropdown-menu"; -import { cn } from "@/modules/ui/lib/utils"; import * as Sentry from "@sentry/nextjs"; import { TFnType, useTranslate } from "@tolgee/react"; import { @@ -37,6 +21,22 @@ import { ArrowDownToLineIcon, ChevronDown, ChevronUp, DownloadIcon, Loader2Icon import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import toast from "react-hot-toast"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { + DateRange, + useResponseFilter, +} from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { getResponsesDownloadUrlAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; +import { downloadResponsesFile } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/utils"; +import { getFormattedFilters, getTodayDate } from "@/app/lib/surveys/surveys"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; +import { Calendar } from "@/modules/ui/components/calendar"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/modules/ui/components/dropdown-menu"; +import { cn } from "@/modules/ui/lib/utils"; import { ResponseFilter } from "./ResponseFilter"; enum DateSelected { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionFilterComboBox.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionFilterComboBox.tsx index c68c728b9a..a79bad6ffe 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionFilterComboBox.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionFilterComboBox.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import clsx from "clsx"; +import { ChevronDown, ChevronUp, X } from "lucide-react"; +import * as React from "react"; +import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { OptionsType } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; import { getLocalizedValue } from "@/lib/i18n/utils"; import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; @@ -17,11 +22,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import clsx from "clsx"; -import { ChevronDown, ChevronUp, X } from "lucide-react"; -import * as React from "react"; -import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; type QuestionFilterComboBoxProps = { filterOptions: string[] | undefined; diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox.tsx index 360c85b659..8d4d996010 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox.tsx @@ -1,16 +1,5 @@ "use client"; -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, -} from "@/modules/ui/components/command"; -import { NetPromoterScoreIcon } from "@/modules/ui/components/icons"; import { useTranslate } from "@tolgee/react"; import clsx from "clsx"; import { @@ -41,6 +30,17 @@ import { } from "lucide-react"; import { Fragment, useRef, useState } from "react"; import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "@/modules/ui/components/command"; +import { NetPromoterScoreIcon } from "@/modules/ui/components/icons"; export enum OptionsType { QUESTIONS = "Questions", diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.test.tsx index e02ee48108..51dedba29a 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.test.tsx @@ -1,12 +1,12 @@ -import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { getSurveyFilterDataAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; -import { generateQuestionAndFilterOptions } from "@/app/lib/surveys/surveys"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { useParams } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { useResponseFilter } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { getSurveyFilterDataAction } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/actions"; +import { generateQuestionAndFilterOptions } from "@/app/lib/surveys/surveys"; import { ResponseFilter } from "./ResponseFilter"; // Mock dependencies diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.tsx index 595c62a53b..45b8580151 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/ResponseFilter.tsx @@ -1,5 +1,10 @@ "use client"; +import { useAutoAnimate } from "@formkit/auto-animate/react"; +import { useTranslate } from "@tolgee/react"; +import { ChevronDown, ChevronUp, Plus, TrashIcon } from "lucide-react"; +import React, { useEffect, useState } from "react"; +import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { SelectedFilterValue, TResponseStatus, @@ -17,11 +22,6 @@ import { SelectTrigger, SelectValue, } from "@/modules/ui/components/select"; -import { useAutoAnimate } from "@formkit/auto-animate/react"; -import { useTranslate } from "@tolgee/react"; -import { ChevronDown, ChevronUp, Plus, TrashIcon } from "lucide-react"; -import React, { useEffect, useState } from "react"; -import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { OptionsType, QuestionOption, QuestionsComboBox } from "./QuestionsComboBox"; export type QuestionFilterOptions = { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/SurveyStatusDropdown.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/SurveyStatusDropdown.tsx index 7aa49e65b7..1110264bee 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/SurveyStatusDropdown.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/SurveyStatusDropdown.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import toast from "react-hot-toast"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { Select, @@ -9,11 +14,6 @@ import { SelectValue, } from "@/modules/ui/components/select"; import { SurveyStatusIndicator } from "@/modules/ui/components/survey-status-indicator"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import toast from "react-hot-toast"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TSurvey } from "@formbricks/types/surveys/types"; import { updateSurveyAction } from "../actions"; interface SurveyStatusDropdownProps { diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/layout.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/layout.test.tsx index fa360506bc..671567d473 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/layout.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/layout.test.tsx @@ -1,9 +1,9 @@ // Import the mocked function to access it in tests -import { getSurvey } from "@/lib/survey/service"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getSurvey } from "@/lib/survey/service"; import SurveyLayout from "./layout"; // Mock the getSurvey function diff --git a/apps/web/app/(app)/environments/[environmentId]/surveys/loading.test.tsx b/apps/web/app/(app)/environments/[environmentId]/surveys/loading.test.tsx index 2e0b7c7eb3..361c21670f 100644 --- a/apps/web/app/(app)/environments/[environmentId]/surveys/loading.test.tsx +++ b/apps/web/app/(app)/environments/[environmentId]/surveys/loading.test.tsx @@ -1,5 +1,5 @@ -import { SurveyListLoading as OriginalSurveyListLoading } from "@/modules/survey/list/loading"; import { describe, expect, test, vi } from "vitest"; +import { SurveyListLoading as OriginalSurveyListLoading } from "@/modules/survey/list/loading"; import SurveyListLoading from "./loading"; // Mock the original component to ensure we are testing the re-export diff --git a/apps/web/app/(app)/layout.test.tsx b/apps/web/app/(app)/layout.test.tsx index c62f9cc504..23512b5574 100644 --- a/apps/web/app/(app)/layout.test.tsx +++ b/apps/web/app/(app)/layout.test.tsx @@ -1,9 +1,9 @@ -import { getUser } from "@/lib/user/service"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TUser } from "@formbricks/types/user"; +import { getUser } from "@/lib/user/service"; import AppLayout from "./layout"; vi.mock("next-auth", () => ({ diff --git a/apps/web/app/(app)/layout.tsx b/apps/web/app/(app)/layout.tsx index 99339d2d8c..c515fabf3d 100644 --- a/apps/web/app/(app)/layout.tsx +++ b/apps/web/app/(app)/layout.tsx @@ -1,3 +1,5 @@ +import { getServerSession } from "next-auth"; +import { Suspense } from "react"; import { IntercomClientWrapper } from "@/app/intercom/IntercomClientWrapper"; import { IS_POSTHOG_CONFIGURED, POSTHOG_API_HOST, POSTHOG_API_KEY } from "@/lib/constants"; import { getUser } from "@/lib/user/service"; @@ -6,8 +8,6 @@ import { ClientLogout } from "@/modules/ui/components/client-logout"; import { NoMobileOverlay } from "@/modules/ui/components/no-mobile-overlay"; import { PHProvider, PostHogPageview } from "@/modules/ui/components/post-hog-client"; import { ToasterClient } from "@/modules/ui/components/toaster-client"; -import { getServerSession } from "next-auth"; -import { Suspense } from "react"; const AppLayout = async ({ children }) => { const session = await getServerSession(authOptions); diff --git a/apps/web/app/(redirects)/organizations/[organizationId]/route.ts b/apps/web/app/(redirects)/organizations/[organizationId]/route.ts index 0c9ce6d7a5..12ed5cef48 100644 --- a/apps/web/app/(redirects)/organizations/[organizationId]/route.ts +++ b/apps/web/app/(redirects)/organizations/[organizationId]/route.ts @@ -1,13 +1,13 @@ +import { getServerSession } from "next-auth"; +import { redirect } from "next/navigation"; +import { notFound } from "next/navigation"; +import { AuthenticationError, AuthorizationError } from "@formbricks/types/errors"; import { hasOrganizationAccess } from "@/lib/auth"; import { getEnvironments } from "@/lib/environment/service"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getAccessFlags } from "@/lib/membership/utils"; import { getUserProjects } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; -import { getServerSession } from "next-auth"; -import { redirect } from "next/navigation"; -import { notFound } from "next/navigation"; -import { AuthenticationError, AuthorizationError } from "@formbricks/types/errors"; export const GET = async (_: Request, context: { params: Promise<{ organizationId: string }> }) => { const params = await context?.params; diff --git a/apps/web/app/(redirects)/projects/[projectId]/route.ts b/apps/web/app/(redirects)/projects/[projectId]/route.ts index 28713414b7..d00ab3dea9 100644 --- a/apps/web/app/(redirects)/projects/[projectId]/route.ts +++ b/apps/web/app/(redirects)/projects/[projectId]/route.ts @@ -1,10 +1,10 @@ +import { getServerSession } from "next-auth"; +import { notFound, redirect } from "next/navigation"; +import { AuthenticationError, AuthorizationError } from "@formbricks/types/errors"; import { hasOrganizationAccess } from "@/lib/auth"; import { getEnvironments } from "@/lib/environment/service"; import { getProject } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; -import { getServerSession } from "next-auth"; -import { notFound, redirect } from "next/navigation"; -import { AuthenticationError, AuthorizationError } from "@formbricks/types/errors"; export const GET = async (_: Request, context: { params: Promise<{ projectId: string }> }) => { const params = await context?.params; diff --git a/apps/web/app/ClientEnvironmentRedirect.test.tsx b/apps/web/app/ClientEnvironmentRedirect.test.tsx index dffef885db..2eb041a683 100644 --- a/apps/web/app/ClientEnvironmentRedirect.test.tsx +++ b/apps/web/app/ClientEnvironmentRedirect.test.tsx @@ -1,8 +1,8 @@ -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import "@testing-library/jest-dom/vitest"; import { cleanup, render } from "@testing-library/react"; import { useRouter } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import ClientEnvironmentRedirect from "./ClientEnvironmentRedirect"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/app/ClientEnvironmentRedirect.tsx b/apps/web/app/ClientEnvironmentRedirect.tsx index 0c6afbd147..bf08186de9 100644 --- a/apps/web/app/ClientEnvironmentRedirect.tsx +++ b/apps/web/app/ClientEnvironmentRedirect.tsx @@ -1,8 +1,8 @@ "use client"; -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; interface ClientEnvironmentRedirectProps { userEnvironments: string[]; diff --git a/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.test.ts b/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.test.ts index f99b356523..6b44e87f8f 100644 --- a/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.test.ts +++ b/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.test.ts @@ -1,13 +1,3 @@ -import { TPipelineInput } from "@/app/api/(internal)/pipeline/types/pipelines"; -import { writeData as airtableWriteData } from "@/lib/airtable/service"; -import { writeData as googleSheetWriteData } from "@/lib/googleSheet/service"; -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { writeData as writeNotionData } from "@/lib/notion/service"; -import { processResponseData } from "@/lib/responses"; -import { writeDataToSlack } from "@/lib/slack/service"; -import { getFormattedDateTimeString } from "@/lib/utils/datetime"; -import { parseRecallInfo } from "@/lib/utils/recall"; -import { truncateText } from "@/lib/utils/strings"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { logger } from "@formbricks/logger"; import { @@ -39,6 +29,16 @@ import { TSurveyPictureSelectionQuestion, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { TPipelineInput } from "@/app/api/(internal)/pipeline/types/pipelines"; +import { writeData as airtableWriteData } from "@/lib/airtable/service"; +import { writeData as googleSheetWriteData } from "@/lib/googleSheet/service"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { writeData as writeNotionData } from "@/lib/notion/service"; +import { processResponseData } from "@/lib/responses"; +import { writeDataToSlack } from "@/lib/slack/service"; +import { getFormattedDateTimeString } from "@/lib/utils/datetime"; +import { parseRecallInfo } from "@/lib/utils/recall"; +import { truncateText } from "@/lib/utils/strings"; import { handleIntegrations } from "./handleIntegrations"; // Mock dependencies diff --git a/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.ts b/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.ts index f267a66fc2..7e3abcfb35 100644 --- a/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.ts +++ b/apps/web/app/api/(internal)/pipeline/lib/handleIntegrations.ts @@ -1,3 +1,12 @@ +import { logger } from "@formbricks/logger"; +import { Result } from "@formbricks/types/error-handlers"; +import { TIntegration, TIntegrationType } from "@formbricks/types/integration"; +import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; +import { TIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; +import { TIntegrationNotion, TIntegrationNotionConfigData } from "@formbricks/types/integration/notion"; +import { TIntegrationSlack } from "@formbricks/types/integration/slack"; +import { TResponseMeta } from "@formbricks/types/responses"; +import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TPipelineInput } from "@/app/api/(internal)/pipeline/types/pipelines"; import { writeData as airtableWriteData } from "@/lib/airtable/service"; import { NOTION_RICH_TEXT_LIMIT } from "@/lib/constants"; @@ -9,15 +18,6 @@ import { writeDataToSlack } from "@/lib/slack/service"; import { getFormattedDateTimeString } from "@/lib/utils/datetime"; import { parseRecallInfo } from "@/lib/utils/recall"; import { truncateText } from "@/lib/utils/strings"; -import { logger } from "@formbricks/logger"; -import { Result } from "@formbricks/types/error-handlers"; -import { TIntegration, TIntegrationType } from "@formbricks/types/integration"; -import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; -import { TIntegrationGoogleSheets } from "@formbricks/types/integration/google-sheet"; -import { TIntegrationNotion, TIntegrationNotionConfigData } from "@formbricks/types/integration/notion"; -import { TIntegrationSlack } from "@formbricks/types/integration/slack"; -import { TResponseMeta } from "@formbricks/types/responses"; -import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; const convertMetaObjectToString = (metadata: TResponseMeta): string => { let result: string[] = []; diff --git a/apps/web/app/api/(internal)/pipeline/route.ts b/apps/web/app/api/(internal)/pipeline/route.ts index 08ad54628a..e3f26dfa81 100644 --- a/apps/web/app/api/(internal)/pipeline/route.ts +++ b/apps/web/app/api/(internal)/pipeline/route.ts @@ -1,3 +1,8 @@ +import { PipelineTriggers, Webhook } from "@prisma/client"; +import { headers } from "next/headers"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; import { ZPipelineInput } from "@/app/api/(internal)/pipeline/types/pipelines"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; @@ -12,11 +17,6 @@ import { TAuditStatus, UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit- import { sendResponseFinishedEmail } from "@/modules/email"; import { sendFollowUpsForResponse } from "@/modules/survey/follow-ups/lib/follow-ups"; import { FollowUpSendError } from "@/modules/survey/follow-ups/types/follow-up"; -import { PipelineTriggers, Webhook } from "@prisma/client"; -import { headers } from "next/headers"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; import { handleIntegrations } from "./lib/handleIntegrations"; export const POST = async (request: Request) => { diff --git a/apps/web/app/api/auth/[...nextauth]/route.ts b/apps/web/app/api/auth/[...nextauth]/route.ts index b0a1e8403d..dec3841c7a 100644 --- a/apps/web/app/api/auth/[...nextauth]/route.ts +++ b/apps/web/app/api/auth/[...nextauth]/route.ts @@ -1,10 +1,10 @@ +import * as Sentry from "@sentry/nextjs"; +import NextAuth from "next-auth"; +import { logger } from "@formbricks/logger"; import { IS_PRODUCTION, SENTRY_DSN } from "@/lib/constants"; import { authOptions as baseAuthOptions } from "@/modules/auth/lib/authOptions"; import { queueAuditEventBackground } from "@/modules/ee/audit-logs/lib/handler"; import { TAuditStatus, UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; -import * as Sentry from "@sentry/nextjs"; -import NextAuth from "next-auth"; -import { logger } from "@formbricks/logger"; export const fetchCache = "force-no-store"; diff --git a/apps/web/app/api/google-sheet/callback/route.ts b/apps/web/app/api/google-sheet/callback/route.ts index 61ee499e2e..94b6a3254a 100644 --- a/apps/web/app/api/google-sheet/callback/route.ts +++ b/apps/web/app/api/google-sheet/callback/route.ts @@ -1,3 +1,4 @@ +import { google } from "googleapis"; import { responses } from "@/app/lib/api/response"; import { GOOGLE_SHEETS_CLIENT_ID, @@ -6,7 +7,6 @@ import { WEBAPP_URL, } from "@/lib/constants"; import { createOrUpdateIntegration } from "@/lib/integration/service"; -import { google } from "googleapis"; export const GET = async (req: Request) => { const url = req.url; diff --git a/apps/web/app/api/google-sheet/route.ts b/apps/web/app/api/google-sheet/route.ts index aeee2a666b..8c30687af3 100644 --- a/apps/web/app/api/google-sheet/route.ts +++ b/apps/web/app/api/google-sheet/route.ts @@ -1,3 +1,6 @@ +import { google } from "googleapis"; +import { getServerSession } from "next-auth"; +import { NextRequest } from "next/server"; import { responses } from "@/app/lib/api/response"; import { GOOGLE_SHEETS_CLIENT_ID, @@ -6,9 +9,6 @@ import { } from "@/lib/constants"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { authOptions } from "@/modules/auth/lib/authOptions"; -import { google } from "googleapis"; -import { getServerSession } from "next-auth"; -import { NextRequest } from "next/server"; const scopes = [ "https://www.googleapis.com/auth/spreadsheets", diff --git a/apps/web/app/api/lib/utils.ts b/apps/web/app/api/lib/utils.ts index 65d076c7fb..7cf869a09c 100644 --- a/apps/web/app/api/lib/utils.ts +++ b/apps/web/app/api/lib/utils.ts @@ -1,8 +1,8 @@ +import { Organization } from "@prisma/client"; +import { logger } from "@formbricks/logger"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { getMonthlyOrganizationResponseCount } from "@/lib/organization/service"; import { sendPlanLimitsReachedEventToPosthogWeekly } from "@/lib/posthogServer"; -import { Organization } from "@prisma/client"; -import { logger } from "@formbricks/logger"; export const handleBillingLimitsCheck = async ( environmentId: string, diff --git a/apps/web/app/api/v1/client/[environmentId]/app/sync/[userId]/route.ts b/apps/web/app/api/v1/client/[environmentId]/app/sync/[userId]/route.ts index eb26991a3a..82cd7c5a42 100644 --- a/apps/web/app/api/v1/client/[environmentId]/app/sync/[userId]/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/app/sync/[userId]/route.ts @@ -1,5 +1,10 @@ // Deprecated: This api route is deprecated now and will be removed in the future. // Deprecated: This is currently only being used for the older react native SDKs. Please upgrade to the latest SDKs. +import { NextRequest, userAgent } from "next/server"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { TJsPeopleUserIdInput, ZJsPeopleUserIdInput } from "@formbricks/types/js"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getContactByUserId } from "@/app/api/v1/client/[environmentId]/app/sync/lib/contact"; import { getSyncSurveys } from "@/app/api/v1/client/[environmentId]/app/sync/lib/survey"; import { replaceAttributeRecall } from "@/app/api/v1/client/[environmentId]/app/sync/lib/utils"; @@ -19,11 +24,6 @@ import { } from "@/lib/posthogServer"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { COLOR_DEFAULTS } from "@/lib/styling/constants"; -import { NextRequest, userAgent } from "next/server"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { TJsPeopleUserIdInput, ZJsPeopleUserIdInput } from "@formbricks/types/js"; -import { TSurvey } from "@formbricks/types/surveys/types"; const validateInput = ( environmentId: string, diff --git a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/contact.test.ts b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/contact.test.ts index 0b6ec3fc51..4c2a826cef 100644 --- a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/contact.test.ts +++ b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/contact.test.ts @@ -1,6 +1,6 @@ -import { TContact } from "@/modules/ee/contacts/types/contact"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { TContact } from "@/modules/ee/contacts/types/contact"; import { getContactByUserId } from "./contact"; // Mock prisma diff --git a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.test.ts b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.test.ts index 1c6dd0473c..62cbe1259c 100644 --- a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.test.ts +++ b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.test.ts @@ -1,8 +1,3 @@ -import { getProjectByEnvironmentId } from "@/lib/project/service"; -import { getSurveys } from "@/lib/survey/service"; -import { anySurveyHasFilters } from "@/lib/survey/utils"; -import { diffInDays } from "@/lib/utils/datetime"; -import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -11,6 +6,11 @@ import { DatabaseError } from "@formbricks/types/errors"; import { TProject } from "@formbricks/types/project"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; +import { getSurveys } from "@/lib/survey/service"; +import { anySurveyHasFilters } from "@/lib/survey/utils"; +import { diffInDays } from "@/lib/utils/datetime"; +import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { getSyncSurveys } from "./survey"; vi.mock("@/lib/project/service", () => ({ diff --git a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.ts b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.ts index 349cda6cfd..307b04d493 100644 --- a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.ts +++ b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/survey.ts @@ -1,10 +1,4 @@ import "server-only"; -import { getProjectByEnvironmentId } from "@/lib/project/service"; -import { getSurveys } from "@/lib/survey/service"; -import { anySurveyHasFilters } from "@/lib/survey/utils"; -import { diffInDays } from "@/lib/utils/datetime"; -import { validateInputs } from "@/lib/utils/validate"; -import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -12,6 +6,12 @@ import { logger } from "@formbricks/logger"; import { ZId } from "@formbricks/types/common"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; +import { getSurveys } from "@/lib/survey/service"; +import { anySurveyHasFilters } from "@/lib/survey/utils"; +import { diffInDays } from "@/lib/utils/datetime"; +import { validateInputs } from "@/lib/utils/validate"; +import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; export const getSyncSurveys = reactCache( async ( diff --git a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/utils.ts b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/utils.ts index f48c6187c5..4ee1d7967b 100644 --- a/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/utils.ts +++ b/apps/web/app/api/v1/client/[environmentId]/app/sync/lib/utils.ts @@ -1,6 +1,6 @@ -import { parseRecallInfo } from "@/lib/utils/recall"; import { TAttributes } from "@formbricks/types/attributes"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { parseRecallInfo } from "@/lib/utils/recall"; export const replaceAttributeRecall = (survey: TSurvey, attributes: TAttributes): TSurvey => { const surveyTemp = structuredClone(survey); diff --git a/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.test.ts b/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.test.ts index 41c5ccc68b..5b6e3e1680 100644 --- a/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.test.ts +++ b/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.test.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TDisplayCreateInput } from "@formbricks/types/displays"; import { DatabaseError, ResourceNotFoundError, ValidationError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { getContactByUserId } from "./contact"; import { createDisplay } from "./display"; diff --git a/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.ts b/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.ts index 070495f647..4fc2663699 100644 --- a/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.ts +++ b/apps/web/app/api/v1/client/[environmentId]/displays/lib/display.ts @@ -1,8 +1,8 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { TDisplayCreateInput, ZDisplayCreateInput } from "@formbricks/types/displays"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { getContactByUserId } from "./contact"; export const createDisplay = async (displayInput: TDisplayCreateInput): Promise<{ id: string }> => { diff --git a/apps/web/app/api/v1/client/[environmentId]/displays/route.ts b/apps/web/app/api/v1/client/[environmentId]/displays/route.ts index c46528bc62..b6167e4849 100644 --- a/apps/web/app/api/v1/client/[environmentId]/displays/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/displays/route.ts @@ -1,12 +1,12 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { ZDisplayCreateInput } from "@formbricks/types/displays"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { capturePosthogEnvironmentEvent } from "@/lib/posthogServer"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { ZDisplayCreateInput } from "@formbricks/types/displays"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; import { createDisplay } from "./lib/display"; interface Context { diff --git a/apps/web/app/api/v1/client/[environmentId]/environment/lib/data.ts b/apps/web/app/api/v1/client/[environmentId]/environment/lib/data.ts index 29913f2a53..67dd557096 100644 --- a/apps/web/app/api/v1/client/[environmentId]/environment/lib/data.ts +++ b/apps/web/app/api/v1/client/[environmentId]/environment/lib/data.ts @@ -1,6 +1,4 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; -import { transformPrismaSurvey } from "@/modules/survey/lib/utils"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; @@ -11,6 +9,8 @@ import { TJsEnvironmentStateProject, TJsEnvironmentStateSurvey, } from "@formbricks/types/js"; +import { validateInputs } from "@/lib/utils/validate"; +import { transformPrismaSurvey } from "@/modules/survey/lib/utils"; /** * Optimized data fetcher for environment state diff --git a/apps/web/app/api/v1/client/[environmentId]/environment/route.ts b/apps/web/app/api/v1/client/[environmentId]/environment/route.ts index 0af490e9c7..153316acd7 100644 --- a/apps/web/app/api/v1/client/[environmentId]/environment/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/environment/route.ts @@ -1,9 +1,9 @@ -import { getEnvironmentState } from "@/app/api/v1/client/[environmentId]/environment/lib/environmentState"; -import { responses } from "@/app/lib/api/response"; -import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { NextRequest } from "next/server"; import { logger } from "@formbricks/logger"; import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { getEnvironmentState } from "@/app/api/v1/client/[environmentId]/environment/lib/environmentState"; +import { responses } from "@/app/lib/api/response"; +import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; export const OPTIONS = async (): Promise => { return responses.successResponse( diff --git a/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.test.ts b/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.test.ts index 55e2f803f6..323300b8a0 100644 --- a/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.test.ts +++ b/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.test.ts @@ -1,9 +1,9 @@ -import { updateResponse } from "@/lib/response/service"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TResponse } from "@formbricks/types/responses"; +import { updateResponse } from "@/lib/response/service"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { updateResponseWithQuotaEvaluation } from "./response"; vi.mock("@/lib/response/service"); diff --git a/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.ts b/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.ts index 092e105c31..eedc4e4b14 100644 --- a/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.ts +++ b/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/lib/response.ts @@ -1,8 +1,8 @@ -import { updateResponse } from "@/lib/response/service"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { prisma } from "@formbricks/database"; import { TResponseWithQuotaFull } from "@formbricks/types/quota"; import { TResponseUpdateInput } from "@formbricks/types/responses"; +import { updateResponse } from "@/lib/response/service"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; export const updateResponseWithQuotaEvaluation = async ( responseId: string, diff --git a/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/route.ts b/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/route.ts index a139ed6967..746e2947ac 100644 --- a/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/responses/[responseId]/route.ts @@ -1,3 +1,7 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZResponseUpdateInput } from "@formbricks/types/responses"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; @@ -7,10 +11,6 @@ import { getSurvey } from "@/lib/survey/service"; import { validateOtherOptionLengthForMultipleChoice } from "@/modules/api/v2/lib/question"; import { createQuotaFullObject } from "@/modules/ee/quotas/lib/helpers"; import { validateFileUploads } from "@/modules/storage/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZResponseUpdateInput } from "@formbricks/types/responses"; import { updateResponseWithQuotaEvaluation } from "./lib/response"; export const OPTIONS = async (): Promise => { diff --git a/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.test.ts b/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.test.ts index 9b6827eaf9..48a87da33a 100644 --- a/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.test.ts +++ b/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.test.ts @@ -1,10 +1,3 @@ -import { - getMonthlyOrganizationResponseCount, - getOrganizationByEnvironmentId, -} from "@/lib/organization/service"; -import { sendPlanLimitsReachedEventToPosthogWeekly } from "@/lib/posthogServer"; -import { calculateTtcTotal } from "@/lib/response/utils"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -12,6 +5,13 @@ import { logger } from "@formbricks/logger"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TResponseInput } from "@formbricks/types/responses"; +import { + getMonthlyOrganizationResponseCount, + getOrganizationByEnvironmentId, +} from "@/lib/organization/service"; +import { sendPlanLimitsReachedEventToPosthogWeekly } from "@/lib/posthogServer"; +import { calculateTtcTotal } from "@/lib/response/utils"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { createResponse, createResponseWithQuotaEvaluation } from "./response"; let mockIsFormbricksCloud = false; diff --git a/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.ts b/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.ts index 8eeb2c334f..bd67f3150c 100644 --- a/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.ts +++ b/apps/web/app/api/v1/client/[environmentId]/responses/lib/response.ts @@ -1,11 +1,4 @@ import "server-only"; -import { handleBillingLimitsCheck } from "@/app/api/lib/utils"; -import { buildPrismaResponseData } from "@/app/api/v1/lib/utils"; -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { calculateTtcTotal } from "@/lib/response/utils"; -import { captureTelemetry } from "@/lib/telemetry"; -import { validateInputs } from "@/lib/utils/validate"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { TContactAttributes } from "@formbricks/types/contact-attribute"; @@ -13,6 +6,13 @@ import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TResponseWithQuotaFull } from "@formbricks/types/quota"; import { TResponse, TResponseInput, ZResponseInput } from "@formbricks/types/responses"; import { TTag } from "@formbricks/types/tags"; +import { handleBillingLimitsCheck } from "@/app/api/lib/utils"; +import { buildPrismaResponseData } from "@/app/api/v1/lib/utils"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { calculateTtcTotal } from "@/lib/response/utils"; +import { captureTelemetry } from "@/lib/telemetry"; +import { validateInputs } from "@/lib/utils/validate"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { getContactByUserId } from "./contact"; export const responseSelection = { diff --git a/apps/web/app/api/v1/client/[environmentId]/responses/route.ts b/apps/web/app/api/v1/client/[environmentId]/responses/route.ts index 90b257b874..7d6f80a871 100644 --- a/apps/web/app/api/v1/client/[environmentId]/responses/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/responses/route.ts @@ -1,3 +1,11 @@ +import { headers } from "next/headers"; +import { NextRequest } from "next/server"; +import { UAParser } from "ua-parser-js"; +import { logger } from "@formbricks/logger"; +import { ZId } from "@formbricks/types/common"; +import { InvalidInputError } from "@formbricks/types/errors"; +import { TResponseWithQuotaFull } from "@formbricks/types/quota"; +import { TResponseInput, ZResponseInput } from "@formbricks/types/responses"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; @@ -7,14 +15,6 @@ import { getSurvey } from "@/lib/survey/service"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { createQuotaFullObject } from "@/modules/ee/quotas/lib/helpers"; import { validateFileUploads } from "@/modules/storage/utils"; -import { headers } from "next/headers"; -import { NextRequest } from "next/server"; -import { UAParser } from "ua-parser-js"; -import { logger } from "@formbricks/logger"; -import { ZId } from "@formbricks/types/common"; -import { InvalidInputError } from "@formbricks/types/errors"; -import { TResponseWithQuotaFull } from "@formbricks/types/quota"; -import { TResponseInput, ZResponseInput } from "@formbricks/types/responses"; import { createResponseWithQuotaEvaluation } from "./lib/response"; interface Context { diff --git a/apps/web/app/api/v1/client/[environmentId]/storage/route.ts b/apps/web/app/api/v1/client/[environmentId]/storage/route.ts index 13a7aef965..e8fb022daf 100644 --- a/apps/web/app/api/v1/client/[environmentId]/storage/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/storage/route.ts @@ -1,3 +1,6 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { TUploadPrivateFileRequest, ZUploadPrivateFileRequest } from "@formbricks/types/storage"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; @@ -8,9 +11,6 @@ import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { getBiggerUploadFileSizePermission } from "@/modules/ee/license-check/lib/utils"; import { getSignedUrlForUpload } from "@/modules/storage/service"; import { getErrorResponseFromStorageError } from "@/modules/storage/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { TUploadPrivateFileRequest, ZUploadPrivateFileRequest } from "@formbricks/types/storage"; interface Context { params: Promise<{ diff --git a/apps/web/app/api/v1/integrations/airtable/callback/route.ts b/apps/web/app/api/v1/integrations/airtable/callback/route.ts index 45521fd5db..11c55bfdc7 100644 --- a/apps/web/app/api/v1/integrations/airtable/callback/route.ts +++ b/apps/web/app/api/v1/integrations/airtable/callback/route.ts @@ -1,12 +1,12 @@ +import { NextRequest } from "next/server"; +import * as z from "zod"; +import { logger } from "@formbricks/logger"; import { responses } from "@/app/lib/api/response"; import { TSessionAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { fetchAirtableAuthToken } from "@/lib/airtable/service"; import { AIRTABLE_CLIENT_ID, WEBAPP_URL } from "@/lib/constants"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { createOrUpdateIntegration } from "@/lib/integration/service"; -import { NextRequest } from "next/server"; -import * as z from "zod"; -import { logger } from "@formbricks/logger"; const getEmail = async (token: string) => { const req_ = await fetch("https://api.airtable.com/v0/meta/whoami", { diff --git a/apps/web/app/api/v1/integrations/airtable/route.ts b/apps/web/app/api/v1/integrations/airtable/route.ts index 4d73f27350..c3eece0bf8 100644 --- a/apps/web/app/api/v1/integrations/airtable/route.ts +++ b/apps/web/app/api/v1/integrations/airtable/route.ts @@ -1,9 +1,9 @@ +import crypto from "crypto"; +import { NextRequest } from "next/server"; import { responses } from "@/app/lib/api/response"; import { TSessionAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { AIRTABLE_CLIENT_ID, WEBAPP_URL } from "@/lib/constants"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; -import crypto from "crypto"; -import { NextRequest } from "next/server"; const scope = `data.records:read data.records:write schema.bases:read schema.bases:write user.email:read`; diff --git a/apps/web/app/api/v1/integrations/airtable/tables/route.ts b/apps/web/app/api/v1/integrations/airtable/tables/route.ts index bfc3d16500..8f477b4327 100644 --- a/apps/web/app/api/v1/integrations/airtable/tables/route.ts +++ b/apps/web/app/api/v1/integrations/airtable/tables/route.ts @@ -1,11 +1,11 @@ +import { NextRequest } from "next/server"; +import * as z from "zod"; +import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; import { responses } from "@/app/lib/api/response"; import { TSessionAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { getTables } from "@/lib/airtable/service"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { getIntegrationByType } from "@/lib/integration/service"; -import { NextRequest } from "next/server"; -import * as z from "zod"; -import { TIntegrationAirtable } from "@formbricks/types/integration/airtable"; export const GET = withV1ApiWrapper({ handler: async ({ diff --git a/apps/web/app/api/v1/integrations/notion/callback/route.ts b/apps/web/app/api/v1/integrations/notion/callback/route.ts index 9b033adbd6..69014458bb 100644 --- a/apps/web/app/api/v1/integrations/notion/callback/route.ts +++ b/apps/web/app/api/v1/integrations/notion/callback/route.ts @@ -1,3 +1,5 @@ +import { NextRequest } from "next/server"; +import { TIntegrationNotionConfigData, TIntegrationNotionInput } from "@formbricks/types/integration/notion"; import { responses } from "@/app/lib/api/response"; import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { @@ -9,8 +11,6 @@ import { } from "@/lib/constants"; import { symmetricEncrypt } from "@/lib/crypto"; import { createOrUpdateIntegration, getIntegrationByType } from "@/lib/integration/service"; -import { NextRequest } from "next/server"; -import { TIntegrationNotionConfigData, TIntegrationNotionInput } from "@formbricks/types/integration/notion"; export const GET = withV1ApiWrapper({ handler: async ({ req }: { req: NextRequest }) => { diff --git a/apps/web/app/api/v1/integrations/notion/route.ts b/apps/web/app/api/v1/integrations/notion/route.ts index 32b01e67e5..3f9964c905 100644 --- a/apps/web/app/api/v1/integrations/notion/route.ts +++ b/apps/web/app/api/v1/integrations/notion/route.ts @@ -1,3 +1,4 @@ +import { NextRequest } from "next/server"; import { responses } from "@/app/lib/api/response"; import { TSessionAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { @@ -7,7 +8,6 @@ import { NOTION_REDIRECT_URI, } from "@/lib/constants"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; -import { NextRequest } from "next/server"; export const GET = withV1ApiWrapper({ handler: async ({ diff --git a/apps/web/app/api/v1/integrations/slack/callback/route.ts b/apps/web/app/api/v1/integrations/slack/callback/route.ts index 341b02fb07..6c8823aa64 100644 --- a/apps/web/app/api/v1/integrations/slack/callback/route.ts +++ b/apps/web/app/api/v1/integrations/slack/callback/route.ts @@ -1,13 +1,13 @@ -import { responses } from "@/app/lib/api/response"; -import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; -import { SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, WEBAPP_URL } from "@/lib/constants"; -import { createOrUpdateIntegration, getIntegrationByType } from "@/lib/integration/service"; import { NextRequest } from "next/server"; import { TIntegrationSlackConfig, TIntegrationSlackConfigData, TIntegrationSlackCredential, } from "@formbricks/types/integration/slack"; +import { responses } from "@/app/lib/api/response"; +import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; +import { SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, WEBAPP_URL } from "@/lib/constants"; +import { createOrUpdateIntegration, getIntegrationByType } from "@/lib/integration/service"; export const GET = withV1ApiWrapper({ handler: async ({ req }: { req: NextRequest }) => { diff --git a/apps/web/app/api/v1/integrations/slack/route.ts b/apps/web/app/api/v1/integrations/slack/route.ts index 62cab41c6d..7c4f06f809 100644 --- a/apps/web/app/api/v1/integrations/slack/route.ts +++ b/apps/web/app/api/v1/integrations/slack/route.ts @@ -1,8 +1,8 @@ +import { NextRequest } from "next/server"; import { responses } from "@/app/lib/api/response"; import { TSessionAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { SLACK_AUTH_URL, SLACK_CLIENT_ID, SLACK_CLIENT_SECRET } from "@/lib/constants"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; -import { NextRequest } from "next/server"; export const GET = withV1ApiWrapper({ handler: async ({ diff --git a/apps/web/app/api/v1/management/action-classes/[actionClassId]/route.ts b/apps/web/app/api/v1/management/action-classes/[actionClassId]/route.ts index 5577abdaf2..1f168aacd0 100644 --- a/apps/web/app/api/v1/management/action-classes/[actionClassId]/route.ts +++ b/apps/web/app/api/v1/management/action-classes/[actionClassId]/route.ts @@ -1,13 +1,13 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { TActionClass, ZActionClassInput } from "@formbricks/types/action-classes"; +import { TAuthenticationApiKey } from "@formbricks/types/auth"; import { handleErrorResponse } from "@/app/api/v1/auth"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { deleteActionClass, getActionClass, updateActionClass } from "@/lib/actionClass/service"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { TActionClass, ZActionClassInput } from "@formbricks/types/action-classes"; -import { TAuthenticationApiKey } from "@formbricks/types/auth"; const fetchAndAuthorizeActionClass = async ( authentication: TAuthenticationApiKey, diff --git a/apps/web/app/api/v1/management/action-classes/lib/action-classes.ts b/apps/web/app/api/v1/management/action-classes/lib/action-classes.ts index b824233b40..0c3f689dd3 100644 --- a/apps/web/app/api/v1/management/action-classes/lib/action-classes.ts +++ b/apps/web/app/api/v1/management/action-classes/lib/action-classes.ts @@ -1,13 +1,13 @@ "use server"; import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { TActionClass } from "@formbricks/types/action-classes"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; const selectActionClass = { id: true, diff --git a/apps/web/app/api/v1/management/action-classes/route.ts b/apps/web/app/api/v1/management/action-classes/route.ts index b342f6ed91..a258769e71 100644 --- a/apps/web/app/api/v1/management/action-classes/route.ts +++ b/apps/web/app/api/v1/management/action-classes/route.ts @@ -1,12 +1,12 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { TActionClass, ZActionClassInput } from "@formbricks/types/action-classes"; +import { DatabaseError } from "@formbricks/types/errors"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { createActionClass } from "@/lib/actionClass/service"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { TActionClass, ZActionClassInput } from "@formbricks/types/action-classes"; -import { DatabaseError } from "@formbricks/types/errors"; import { getActionClasses } from "./lib/action-classes"; export const GET = withV1ApiWrapper({ diff --git a/apps/web/app/api/v1/management/me/lib/utils.test.ts b/apps/web/app/api/v1/management/me/lib/utils.test.ts index 4e1633187e..d5d1ed79cd 100644 --- a/apps/web/app/api/v1/management/me/lib/utils.test.ts +++ b/apps/web/app/api/v1/management/me/lib/utils.test.ts @@ -1,10 +1,10 @@ -import { getSessionUser } from "@/app/api/v1/management/me/lib/utils"; -import { authOptions } from "@/modules/auth/lib/authOptions"; -import { mockUser } from "@/modules/auth/lib/mock-data"; import { cleanup } from "@testing-library/react"; import { NextApiRequest, NextApiResponse } from "next"; import { getServerSession } from "next-auth"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getSessionUser } from "@/app/api/v1/management/me/lib/utils"; +import { authOptions } from "@/modules/auth/lib/authOptions"; +import { mockUser } from "@/modules/auth/lib/mock-data"; vi.mock("next-auth", () => ({ getServerSession: vi.fn(), diff --git a/apps/web/app/api/v1/management/me/lib/utils.ts b/apps/web/app/api/v1/management/me/lib/utils.ts index f2aa079838..450e97274f 100644 --- a/apps/web/app/api/v1/management/me/lib/utils.ts +++ b/apps/web/app/api/v1/management/me/lib/utils.ts @@ -1,7 +1,7 @@ -import { authOptions } from "@/modules/auth/lib/authOptions"; import { NextApiRequest, NextApiResponse } from "next"; import type { Session } from "next-auth"; import { getServerSession } from "next-auth"; +import { authOptions } from "@/modules/auth/lib/authOptions"; export const getSessionUser = async (req?: NextApiRequest, res?: NextApiResponse) => { // check for session (browser usage) diff --git a/apps/web/app/api/v1/management/responses/[responseId]/lib/response.test.ts b/apps/web/app/api/v1/management/responses/[responseId]/lib/response.test.ts index 6e812896a1..ebaf4527ae 100644 --- a/apps/web/app/api/v1/management/responses/[responseId]/lib/response.test.ts +++ b/apps/web/app/api/v1/management/responses/[responseId]/lib/response.test.ts @@ -1,8 +1,8 @@ -import { updateResponse } from "@/lib/response/service"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TResponse, TResponseInput } from "@formbricks/types/responses"; +import { updateResponse } from "@/lib/response/service"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { updateResponseWithQuotaEvaluation } from "./response"; vi.mock("@/lib/response/service"); diff --git a/apps/web/app/api/v1/management/responses/[responseId]/lib/response.ts b/apps/web/app/api/v1/management/responses/[responseId]/lib/response.ts index 887117fd27..c5e6c51e94 100644 --- a/apps/web/app/api/v1/management/responses/[responseId]/lib/response.ts +++ b/apps/web/app/api/v1/management/responses/[responseId]/lib/response.ts @@ -1,8 +1,8 @@ import "server-only"; -import { updateResponse } from "@/lib/response/service"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { prisma } from "@formbricks/database"; import { TResponse, TResponseInput } from "@formbricks/types/responses"; +import { updateResponse } from "@/lib/response/service"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; export const updateResponseWithQuotaEvaluation = async ( responseId: string, diff --git a/apps/web/app/api/v1/management/responses/[responseId]/route.ts b/apps/web/app/api/v1/management/responses/[responseId]/route.ts index 1272f1026e..ed794676f2 100644 --- a/apps/web/app/api/v1/management/responses/[responseId]/route.ts +++ b/apps/web/app/api/v1/management/responses/[responseId]/route.ts @@ -1,3 +1,6 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { ZResponseUpdateInput } from "@formbricks/types/responses"; import { handleErrorResponse } from "@/app/api/v1/auth"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; @@ -6,9 +9,6 @@ import { deleteResponse, getResponse } from "@/lib/response/service"; import { getSurvey } from "@/lib/survey/service"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; import { validateFileUploads } from "@/modules/storage/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { ZResponseUpdateInput } from "@formbricks/types/responses"; import { updateResponseWithQuotaEvaluation } from "./lib/response"; async function fetchAndAuthorizeResponse( diff --git a/apps/web/app/api/v1/management/responses/lib/response.test.ts b/apps/web/app/api/v1/management/responses/lib/response.test.ts index 60405a8c98..3408b0cde6 100644 --- a/apps/web/app/api/v1/management/responses/lib/response.test.ts +++ b/apps/web/app/api/v1/management/responses/lib/response.test.ts @@ -1,3 +1,9 @@ +import { Organization, Prisma, Response as ResponsePrisma } from "@prisma/client"; +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TResponse, TResponseInput } from "@formbricks/types/responses"; import { getMonthlyOrganizationResponseCount, getOrganizationByEnvironmentId, @@ -6,12 +12,6 @@ import { sendPlanLimitsReachedEventToPosthogWeekly } from "@/lib/posthogServer"; import { getResponseContact } from "@/lib/response/service"; import { calculateTtcTotal } from "@/lib/response/utils"; import { validateInputs } from "@/lib/utils/validate"; -import { Organization, Prisma, Response as ResponsePrisma } from "@prisma/client"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TResponse, TResponseInput } from "@formbricks/types/responses"; import { getContactByUserId } from "./contact"; import { createResponse, getResponsesByEnvironmentIds } from "./response"; diff --git a/apps/web/app/api/v1/management/responses/lib/response.ts b/apps/web/app/api/v1/management/responses/lib/response.ts index 17ec41587b..5c6ec48ad6 100644 --- a/apps/web/app/api/v1/management/responses/lib/response.ts +++ b/apps/web/app/api/v1/management/responses/lib/response.ts @@ -1,4 +1,13 @@ import "server-only"; +import { Prisma } from "@prisma/client"; +import { cache as reactCache } from "react"; +import { prisma } from "@formbricks/database"; +import { PrismaErrorType } from "@formbricks/database/types/error"; +import { ZId, ZOptionalNumber } from "@formbricks/types/common"; +import { TContactAttributes } from "@formbricks/types/contact-attribute"; +import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TResponse, TResponseInput, ZResponseInput } from "@formbricks/types/responses"; +import { TTag } from "@formbricks/types/tags"; import { handleBillingLimitsCheck } from "@/app/api/lib/utils"; import { buildPrismaResponseData } from "@/app/api/v1/lib/utils"; import { RESPONSES_PER_PAGE } from "@/lib/constants"; @@ -9,15 +18,6 @@ import { getSurvey } from "@/lib/survey/service"; import { captureTelemetry } from "@/lib/telemetry"; import { validateInputs } from "@/lib/utils/validate"; import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; -import { Prisma } from "@prisma/client"; -import { cache as reactCache } from "react"; -import { prisma } from "@formbricks/database"; -import { PrismaErrorType } from "@formbricks/database/types/error"; -import { ZId, ZOptionalNumber } from "@formbricks/types/common"; -import { TContactAttributes } from "@formbricks/types/contact-attribute"; -import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TResponse, TResponseInput, ZResponseInput } from "@formbricks/types/responses"; -import { TTag } from "@formbricks/types/tags"; import { getContactByUserId } from "./contact"; export const responseSelection = { diff --git a/apps/web/app/api/v1/management/responses/route.ts b/apps/web/app/api/v1/management/responses/route.ts index 8701c94381..85518108e3 100644 --- a/apps/web/app/api/v1/management/responses/route.ts +++ b/apps/web/app/api/v1/management/responses/route.ts @@ -1,13 +1,13 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; +import { TResponse, TResponseInput, ZResponseInput } from "@formbricks/types/responses"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { getSurvey } from "@/lib/survey/service"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; import { validateFileUploads } from "@/modules/storage/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; -import { TResponse, TResponseInput, ZResponseInput } from "@formbricks/types/responses"; import { createResponseWithQuotaEvaluation, getResponses, diff --git a/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.test.ts b/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.test.ts index ac3de3c281..f5a9a6054a 100644 --- a/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.test.ts +++ b/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.test.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { deleteSurvey } from "./surveys"; vi.mock("@/lib/utils/validate", () => ({ diff --git a/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.ts b/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.ts index ac7411e870..bf27eb98f9 100644 --- a/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.ts +++ b/apps/web/app/api/v1/management/surveys/[surveyId]/lib/surveys.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const deleteSurvey = async (surveyId: string) => { validateInputs([surveyId, z.string().cuid2()]); diff --git a/apps/web/app/api/v1/management/surveys/[surveyId]/route.ts b/apps/web/app/api/v1/management/surveys/[surveyId]/route.ts index b0a3a71c6a..e4666971c3 100644 --- a/apps/web/app/api/v1/management/surveys/[surveyId]/route.ts +++ b/apps/web/app/api/v1/management/surveys/[surveyId]/route.ts @@ -1,3 +1,7 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { TAuthenticationApiKey } from "@formbricks/types/auth"; +import { ZSurveyUpdateInput } from "@formbricks/types/surveys/types"; import { handleErrorResponse } from "@/app/api/v1/auth"; import { deleteSurvey } from "@/app/api/v1/management/surveys/[surveyId]/lib/surveys"; import { checkFeaturePermissions } from "@/app/api/v1/management/surveys/lib/utils"; @@ -7,10 +11,6 @@ import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { getSurvey, updateSurvey } from "@/lib/survey/service"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { TAuthenticationApiKey } from "@formbricks/types/auth"; -import { ZSurveyUpdateInput } from "@formbricks/types/surveys/types"; const fetchAndAuthorizeSurvey = async ( surveyId: string, diff --git a/apps/web/app/api/v1/management/surveys/[surveyId]/singleUseIds/route.ts b/apps/web/app/api/v1/management/surveys/[surveyId]/singleUseIds/route.ts index fc25a9cafc..38a65abc74 100644 --- a/apps/web/app/api/v1/management/surveys/[surveyId]/singleUseIds/route.ts +++ b/apps/web/app/api/v1/management/surveys/[surveyId]/singleUseIds/route.ts @@ -1,3 +1,4 @@ +import { NextRequest } from "next/server"; import { handleErrorResponse } from "@/app/api/v1/auth"; import { responses } from "@/app/lib/api/response"; import { TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; @@ -5,7 +6,6 @@ import { getPublicDomain } from "@/lib/getPublicUrl"; import { getSurvey } from "@/lib/survey/service"; import { generateSurveySingleUseIds } from "@/lib/utils/single-use-surveys"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; export const GET = withV1ApiWrapper({ handler: async ({ diff --git a/apps/web/app/api/v1/management/surveys/lib/surveys.test.ts b/apps/web/app/api/v1/management/surveys/lib/surveys.test.ts index 35d96dc00c..f23db2cfbf 100644 --- a/apps/web/app/api/v1/management/surveys/lib/surveys.test.ts +++ b/apps/web/app/api/v1/management/surveys/lib/surveys.test.ts @@ -1,12 +1,12 @@ -import { selectSurvey } from "@/lib/survey/service"; -import { transformPrismaSurvey } from "@/lib/survey/utils"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { selectSurvey } from "@/lib/survey/service"; +import { transformPrismaSurvey } from "@/lib/survey/utils"; +import { validateInputs } from "@/lib/utils/validate"; import { getSurveys } from "./surveys"; // Mock dependencies diff --git a/apps/web/app/api/v1/management/surveys/lib/surveys.ts b/apps/web/app/api/v1/management/surveys/lib/surveys.ts index f9f8f5946a..e916500a37 100644 --- a/apps/web/app/api/v1/management/surveys/lib/surveys.ts +++ b/apps/web/app/api/v1/management/surveys/lib/surveys.ts @@ -1,7 +1,4 @@ import "server-only"; -import { selectSurvey } from "@/lib/survey/service"; -import { transformPrismaSurvey } from "@/lib/survey/utils"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -9,6 +6,9 @@ import { logger } from "@formbricks/logger"; import { ZId, ZOptionalNumber } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { selectSurvey } from "@/lib/survey/service"; +import { transformPrismaSurvey } from "@/lib/survey/utils"; +import { validateInputs } from "@/lib/utils/validate"; export const getSurveys = reactCache( async (environmentIds: string[], limit?: number, offset?: number): Promise => { diff --git a/apps/web/app/api/v1/management/surveys/lib/utils.test.ts b/apps/web/app/api/v1/management/surveys/lib/utils.test.ts index 75a0a77f57..94053d141c 100644 --- a/apps/web/app/api/v1/management/surveys/lib/utils.test.ts +++ b/apps/web/app/api/v1/management/surveys/lib/utils.test.ts @@ -1,12 +1,12 @@ -import { responses } from "@/app/lib/api/response"; -import { getIsSpamProtectionEnabled, getMultiLanguagePermission } from "@/modules/ee/license-check/lib/utils"; -import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; import { describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TSurveyCreateInputWithEnvironmentId, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { responses } from "@/app/lib/api/response"; +import { getIsSpamProtectionEnabled, getMultiLanguagePermission } from "@/modules/ee/license-check/lib/utils"; +import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; import { checkFeaturePermissions } from "./utils"; // Mock dependencies diff --git a/apps/web/app/api/v1/management/surveys/lib/utils.ts b/apps/web/app/api/v1/management/surveys/lib/utils.ts index 9aff1cc306..2c485136ff 100644 --- a/apps/web/app/api/v1/management/surveys/lib/utils.ts +++ b/apps/web/app/api/v1/management/surveys/lib/utils.ts @@ -1,8 +1,8 @@ +import { TOrganization } from "@formbricks/types/organizations"; +import { TSurveyCreateInputWithEnvironmentId } from "@formbricks/types/surveys/types"; import { responses } from "@/app/lib/api/response"; import { getIsSpamProtectionEnabled, getMultiLanguagePermission } from "@/modules/ee/license-check/lib/utils"; import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; -import { TOrganization } from "@formbricks/types/organizations"; -import { TSurveyCreateInputWithEnvironmentId } from "@formbricks/types/surveys/types"; export const checkFeaturePermissions = async ( surveyData: TSurveyCreateInputWithEnvironmentId, diff --git a/apps/web/app/api/v1/management/surveys/route.ts b/apps/web/app/api/v1/management/surveys/route.ts index eb3f4d8a0e..75afd28ca7 100644 --- a/apps/web/app/api/v1/management/surveys/route.ts +++ b/apps/web/app/api/v1/management/surveys/route.ts @@ -1,3 +1,7 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { DatabaseError } from "@formbricks/types/errors"; +import { ZSurveyCreateInputWithEnvironmentId } from "@formbricks/types/surveys/types"; import { checkFeaturePermissions } from "@/app/api/v1/management/surveys/lib/utils"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; @@ -5,10 +9,6 @@ import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { createSurvey } from "@/lib/survey/service"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { DatabaseError } from "@formbricks/types/errors"; -import { ZSurveyCreateInputWithEnvironmentId } from "@formbricks/types/surveys/types"; import { getSurveys } from "./lib/surveys"; export const GET = withV1ApiWrapper({ diff --git a/apps/web/app/api/v1/webhooks/[webhookId]/lib/webhook.ts b/apps/web/app/api/v1/webhooks/[webhookId]/lib/webhook.ts index aab8feb095..63a1e508fe 100644 --- a/apps/web/app/api/v1/webhooks/[webhookId]/lib/webhook.ts +++ b/apps/web/app/api/v1/webhooks/[webhookId]/lib/webhook.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma, Webhook } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId } from "@formbricks/types/common"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const deleteWebhook = async (id: string): Promise => { validateInputs([id, ZId]); diff --git a/apps/web/app/api/v1/webhooks/[webhookId]/route.ts b/apps/web/app/api/v1/webhooks/[webhookId]/route.ts index 7653b7eaa4..97936b0ac9 100644 --- a/apps/web/app/api/v1/webhooks/[webhookId]/route.ts +++ b/apps/web/app/api/v1/webhooks/[webhookId]/route.ts @@ -1,9 +1,9 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; import { deleteWebhook, getWebhook } from "@/app/api/v1/webhooks/[webhookId]/lib/webhook"; import { responses } from "@/app/lib/api/response"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; export const GET = withV1ApiWrapper({ handler: async ({ diff --git a/apps/web/app/api/v1/webhooks/lib/webhook.test.ts b/apps/web/app/api/v1/webhooks/lib/webhook.test.ts index 5919fd2bb7..2fb5be04d7 100644 --- a/apps/web/app/api/v1/webhooks/lib/webhook.test.ts +++ b/apps/web/app/api/v1/webhooks/lib/webhook.test.ts @@ -1,11 +1,11 @@ -import { createWebhook } from "@/app/api/v1/webhooks/lib/webhook"; -import { TWebhookInput } from "@/app/api/v1/webhooks/types/webhooks"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma, WebhookSource } from "@prisma/client"; import { cleanup } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, ValidationError } from "@formbricks/types/errors"; +import { createWebhook } from "@/app/api/v1/webhooks/lib/webhook"; +import { TWebhookInput } from "@/app/api/v1/webhooks/types/webhooks"; +import { validateInputs } from "@/lib/utils/validate"; vi.mock("@formbricks/database", () => ({ prisma: { diff --git a/apps/web/app/api/v1/webhooks/lib/webhook.ts b/apps/web/app/api/v1/webhooks/lib/webhook.ts index 456bfe031b..d7ab77b990 100644 --- a/apps/web/app/api/v1/webhooks/lib/webhook.ts +++ b/apps/web/app/api/v1/webhooks/lib/webhook.ts @@ -1,10 +1,10 @@ -import { TWebhookInput, ZWebhookInput } from "@/app/api/v1/webhooks/types/webhooks"; -import { ITEMS_PER_PAGE } from "@/lib/constants"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma, Webhook } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { ZId, ZOptionalNumber } from "@formbricks/types/common"; import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; +import { TWebhookInput, ZWebhookInput } from "@/app/api/v1/webhooks/types/webhooks"; +import { ITEMS_PER_PAGE } from "@/lib/constants"; +import { validateInputs } from "@/lib/utils/validate"; export const createWebhook = async (webhookInput: TWebhookInput): Promise => { validateInputs([webhookInput, ZWebhookInput]); diff --git a/apps/web/app/api/v1/webhooks/route.ts b/apps/web/app/api/v1/webhooks/route.ts index 64d45f3610..9a32a69027 100644 --- a/apps/web/app/api/v1/webhooks/route.ts +++ b/apps/web/app/api/v1/webhooks/route.ts @@ -1,11 +1,11 @@ +import { NextRequest } from "next/server"; +import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; import { createWebhook, getWebhooks } from "@/app/api/v1/webhooks/lib/webhook"; import { ZWebhookInput } from "@/app/api/v1/webhooks/types/webhooks"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; export const GET = withV1ApiWrapper({ handler: async ({ authentication }: { authentication: NonNullable }) => { diff --git a/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.test.ts b/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.test.ts index 15c7b7f1c3..00b2dbb921 100644 --- a/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.test.ts +++ b/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.test.ts @@ -1,8 +1,8 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, ResourceNotFoundError, ValidationError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { TDisplayCreateInputV2 } from "../types/display"; import { doesContactExist } from "./contact"; import { createDisplay } from "./display"; diff --git a/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.ts b/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.ts index ebe030bfa2..b8a2d7526f 100644 --- a/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.ts +++ b/apps/web/app/api/v2/client/[environmentId]/displays/lib/display.ts @@ -1,11 +1,11 @@ +import { Prisma } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TDisplayCreateInputV2, ZDisplayCreateInputV2, } from "@/app/api/v2/client/[environmentId]/displays/types/display"; import { validateInputs } from "@/lib/utils/validate"; -import { Prisma } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { doesContactExist } from "./contact"; export const createDisplay = async (displayInput: TDisplayCreateInputV2): Promise<{ id: string }> => { diff --git a/apps/web/app/api/v2/client/[environmentId]/displays/route.ts b/apps/web/app/api/v2/client/[environmentId]/displays/route.ts index e60805dbc0..ba17c55a4e 100644 --- a/apps/web/app/api/v2/client/[environmentId]/displays/route.ts +++ b/apps/web/app/api/v2/client/[environmentId]/displays/route.ts @@ -1,10 +1,10 @@ +import { logger } from "@formbricks/logger"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; import { ZDisplayCreateInputV2 } from "@/app/api/v2/client/[environmentId]/displays/types/display"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { capturePosthogEnvironmentEvent } from "@/lib/posthogServer"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { logger } from "@formbricks/logger"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; import { createDisplay } from "./lib/display"; interface Context { diff --git a/apps/web/app/api/v2/client/[environmentId]/responses/lib/recaptcha.ts b/apps/web/app/api/v2/client/[environmentId]/responses/lib/recaptcha.ts index 9776ccbc55..e2fe90b74c 100644 --- a/apps/web/app/api/v2/client/[environmentId]/responses/lib/recaptcha.ts +++ b/apps/web/app/api/v2/client/[environmentId]/responses/lib/recaptcha.ts @@ -1,5 +1,5 @@ -import { RECAPTCHA_SECRET_KEY, RECAPTCHA_SITE_KEY } from "@/lib/constants"; import { logger } from "@formbricks/logger"; +import { RECAPTCHA_SECRET_KEY, RECAPTCHA_SITE_KEY } from "@/lib/constants"; /** * Verifies a reCAPTCHA token with Google's reCAPTCHA API diff --git a/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.test.ts b/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.test.ts index beeb13e874..8dec93258b 100644 --- a/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.test.ts +++ b/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.test.ts @@ -1,3 +1,12 @@ +import { Prisma } from "@prisma/client"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { TContactAttributes } from "@formbricks/types/contact-attribute"; +import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TResponseWithQuotaFull, TSurveyQuota } from "@formbricks/types/quota"; +import { TResponse } from "@formbricks/types/responses"; +import { TTag } from "@formbricks/types/tags"; import { TResponseInputV2 } from "@/app/api/v2/client/[environmentId]/responses/types/response"; import { getMonthlyOrganizationResponseCount, @@ -8,15 +17,6 @@ import { calculateTtcTotal } from "@/lib/response/utils"; import { captureTelemetry } from "@/lib/telemetry"; import { validateInputs } from "@/lib/utils/validate"; import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; -import { Prisma } from "@prisma/client"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { TContactAttributes } from "@formbricks/types/contact-attribute"; -import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TResponseWithQuotaFull, TSurveyQuota } from "@formbricks/types/quota"; -import { TResponse } from "@formbricks/types/responses"; -import { TTag } from "@formbricks/types/tags"; import { getContact } from "./contact"; import { createResponse, createResponseWithQuotaEvaluation } from "./response"; diff --git a/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.ts b/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.ts index 14470cdac2..c1942c9d48 100644 --- a/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.ts +++ b/apps/web/app/api/v2/client/[environmentId]/responses/lib/response.ts @@ -1,4 +1,11 @@ import "server-only"; +import { Prisma } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { TContactAttributes } from "@formbricks/types/contact-attribute"; +import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TResponseWithQuotaFull } from "@formbricks/types/quota"; +import { TResponse, ZResponseInput } from "@formbricks/types/responses"; +import { TTag } from "@formbricks/types/tags"; import { handleBillingLimitsCheck } from "@/app/api/lib/utils"; import { responseSelection } from "@/app/api/v1/client/[environmentId]/responses/lib/response"; import { TResponseInputV2 } from "@/app/api/v2/client/[environmentId]/responses/types/response"; @@ -7,13 +14,6 @@ import { calculateTtcTotal } from "@/lib/response/utils"; import { captureTelemetry } from "@/lib/telemetry"; import { validateInputs } from "@/lib/utils/validate"; import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; -import { Prisma } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { TContactAttributes } from "@formbricks/types/contact-attribute"; -import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TResponseWithQuotaFull } from "@formbricks/types/quota"; -import { TResponse, ZResponseInput } from "@formbricks/types/responses"; -import { TTag } from "@formbricks/types/tags"; import { getContact } from "./contact"; export const createResponseWithQuotaEvaluation = async ( diff --git a/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.test.ts b/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.test.ts index a2701948ea..97add5368e 100644 --- a/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.test.ts +++ b/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.test.ts @@ -1,3 +1,7 @@ +import { Organization } from "@prisma/client"; +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { logger } from "@formbricks/logger"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getOrganizationBillingByEnvironmentId } from "@/app/api/v2/client/[environmentId]/responses/lib/organization"; import { verifyRecaptchaToken } from "@/app/api/v2/client/[environmentId]/responses/lib/recaptcha"; import { checkSurveyValidity } from "@/app/api/v2/client/[environmentId]/responses/lib/utils"; @@ -5,10 +9,6 @@ import { TResponseInputV2 } from "@/app/api/v2/client/[environmentId]/responses/ import { responses } from "@/app/lib/api/response"; import { symmetricDecrypt } from "@/lib/crypto"; import { getIsSpamProtectionEnabled } from "@/modules/ee/license-check/lib/utils"; -import { Organization } from "@prisma/client"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { logger } from "@formbricks/logger"; -import { TSurvey } from "@formbricks/types/surveys/types"; vi.mock("@/lib/i18n/utils", () => ({ getLocalizedValue: vi.fn().mockImplementation((value, language) => { diff --git a/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.ts b/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.ts index 2a20085738..8cf037acba 100644 --- a/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.ts +++ b/apps/web/app/api/v2/client/[environmentId]/responses/lib/utils.ts @@ -1,3 +1,5 @@ +import { logger } from "@formbricks/logger"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getOrganizationBillingByEnvironmentId } from "@/app/api/v2/client/[environmentId]/responses/lib/organization"; import { verifyRecaptchaToken } from "@/app/api/v2/client/[environmentId]/responses/lib/recaptcha"; import { TResponseInputV2 } from "@/app/api/v2/client/[environmentId]/responses/types/response"; @@ -5,8 +7,6 @@ import { responses } from "@/app/lib/api/response"; import { ENCRYPTION_KEY } from "@/lib/constants"; import { symmetricDecrypt } from "@/lib/crypto"; import { getIsSpamProtectionEnabled } from "@/modules/ee/license-check/lib/utils"; -import { logger } from "@formbricks/logger"; -import { TSurvey } from "@formbricks/types/surveys/types"; export const RECAPTCHA_VERIFICATION_ERROR_CODE = "recaptcha_verification_failed"; diff --git a/apps/web/app/api/v2/client/[environmentId]/responses/route.ts b/apps/web/app/api/v2/client/[environmentId]/responses/route.ts index e519069af0..56fb984ac7 100644 --- a/apps/web/app/api/v2/client/[environmentId]/responses/route.ts +++ b/apps/web/app/api/v2/client/[environmentId]/responses/route.ts @@ -1,3 +1,9 @@ +import { headers } from "next/headers"; +import { UAParser } from "ua-parser-js"; +import { logger } from "@formbricks/logger"; +import { ZId } from "@formbricks/types/common"; +import { InvalidInputError } from "@formbricks/types/errors"; +import { TResponseWithQuotaFull } from "@formbricks/types/quota"; import { checkSurveyValidity } from "@/app/api/v2/client/[environmentId]/responses/lib/utils"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; @@ -7,12 +13,6 @@ import { getSurvey } from "@/lib/survey/service"; import { validateOtherOptionLengthForMultipleChoice } from "@/modules/api/v2/lib/question"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { createQuotaFullObject } from "@/modules/ee/quotas/lib/helpers"; -import { headers } from "next/headers"; -import { UAParser } from "ua-parser-js"; -import { logger } from "@formbricks/logger"; -import { ZId } from "@formbricks/types/common"; -import { InvalidInputError } from "@formbricks/types/errors"; -import { TResponseWithQuotaFull } from "@formbricks/types/quota"; import { createResponseWithQuotaEvaluation } from "./lib/response"; import { TResponseInputV2, ZResponseInputV2 } from "./types/response"; diff --git a/apps/web/app/error.tsx b/apps/web/app/error.tsx index 62711994f0..98f5e3e9ed 100644 --- a/apps/web/app/error.tsx +++ b/apps/web/app/error.tsx @@ -1,11 +1,11 @@ "use client"; // Error components must be Client components -import { Button } from "@/modules/ui/components/button"; -import { ErrorComponent } from "@/modules/ui/components/error-component"; import * as Sentry from "@sentry/nextjs"; import { TFnType, useTranslate } from "@tolgee/react"; import { type ClientErrorType, getClientErrorData } from "@formbricks/types/errors"; +import { Button } from "@/modules/ui/components/button"; +import { ErrorComponent } from "@/modules/ui/components/error-component"; /** * Get translated error messages based on error type diff --git a/apps/web/app/intercom/IntercomClientWrapper.tsx b/apps/web/app/intercom/IntercomClientWrapper.tsx index 331c93083a..488e0fe898 100644 --- a/apps/web/app/intercom/IntercomClientWrapper.tsx +++ b/apps/web/app/intercom/IntercomClientWrapper.tsx @@ -1,6 +1,6 @@ -import { INTERCOM_APP_ID, INTERCOM_SECRET_KEY, IS_INTERCOM_CONFIGURED } from "@/lib/constants"; import { createHmac } from "crypto"; import type { TUser } from "@formbricks/types/user"; +import { INTERCOM_APP_ID, INTERCOM_SECRET_KEY, IS_INTERCOM_CONFIGURED } from "@/lib/constants"; import { IntercomClient } from "./IntercomClient"; interface IntercomClientWrapperProps { diff --git a/apps/web/app/layout.test.tsx b/apps/web/app/layout.test.tsx index 4c3f4031d5..2c9eec3088 100644 --- a/apps/web/app/layout.test.tsx +++ b/apps/web/app/layout.test.tsx @@ -1,10 +1,10 @@ -import { getLocale } from "@/tolgee/language"; -import { getTolgee } from "@/tolgee/server"; import { cleanup } from "@testing-library/react"; import { TolgeeInstance } from "@tolgee/react"; import React from "react"; import { renderToString } from "react-dom/server"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import { getLocale } from "@/tolgee/language"; +import { getTolgee } from "@/tolgee/server"; import RootLayout, { metadata } from "./layout"; // Mock dependencies for the layout diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index eb6eaef0aa..dd4fb1b441 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,11 +1,11 @@ +import { TolgeeStaticData } from "@tolgee/react"; +import { Metadata } from "next"; +import React from "react"; import { SentryProvider } from "@/app/sentry/SentryProvider"; import { IS_PRODUCTION, SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE } from "@/lib/constants"; import { TolgeeNextProvider } from "@/tolgee/client"; import { getLocale } from "@/tolgee/language"; import { getTolgee } from "@/tolgee/server"; -import { TolgeeStaticData } from "@tolgee/react"; -import { Metadata } from "next"; -import React from "react"; import "../modules/ui/globals.css"; export const metadata: Metadata = { diff --git a/apps/web/app/lib/pipelines.test.ts b/apps/web/app/lib/pipelines.test.ts index 73e0f9bee7..9a857b3971 100644 --- a/apps/web/app/lib/pipelines.test.ts +++ b/apps/web/app/lib/pipelines.test.ts @@ -1,8 +1,8 @@ -import { TPipelineInput } from "@/app/lib/types/pipelines"; import { PipelineTriggers } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { logger } from "@formbricks/logger"; import { TResponse } from "@formbricks/types/responses"; +import { TPipelineInput } from "@/app/lib/types/pipelines"; import { sendToPipeline } from "./pipelines"; // Mock the constants module diff --git a/apps/web/app/lib/pipelines.ts b/apps/web/app/lib/pipelines.ts index b80bf59ef7..ea74a800ae 100644 --- a/apps/web/app/lib/pipelines.ts +++ b/apps/web/app/lib/pipelines.ts @@ -1,6 +1,6 @@ +import { logger } from "@formbricks/logger"; import { TPipelineInput } from "@/app/lib/types/pipelines"; import { CRON_SECRET, WEBAPP_URL } from "@/lib/constants"; -import { logger } from "@formbricks/logger"; export const sendToPipeline = async ({ event, surveyId, environmentId, response }: TPipelineInput) => { if (!CRON_SECRET) { diff --git a/apps/web/app/lib/singleUseSurveys.test.ts b/apps/web/app/lib/singleUseSurveys.test.ts index b9505ce72c..a2cc700c9f 100644 --- a/apps/web/app/lib/singleUseSurveys.test.ts +++ b/apps/web/app/lib/singleUseSurveys.test.ts @@ -1,6 +1,6 @@ -import * as crypto from "@/lib/crypto"; import cuid2 from "@paralleldrive/cuid2"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import * as crypto from "@/lib/crypto"; import { generateSurveySingleUseId, validateSurveySingleUseId } from "./singleUseSurveys"; // Mock the crypto module diff --git a/apps/web/app/lib/singleUseSurveys.ts b/apps/web/app/lib/singleUseSurveys.ts index eee1005fe5..add2d0c811 100644 --- a/apps/web/app/lib/singleUseSurveys.ts +++ b/apps/web/app/lib/singleUseSurveys.ts @@ -1,6 +1,6 @@ +import cuid2 from "@paralleldrive/cuid2"; import { ENCRYPTION_KEY } from "@/lib/constants"; import { symmetricDecrypt, symmetricEncrypt } from "@/lib/crypto"; -import cuid2 from "@paralleldrive/cuid2"; // generate encrypted single use id for the survey export const generateSurveySingleUseId = (isEncrypted: boolean): string => { diff --git a/apps/web/app/lib/surveys/surveys.test.ts b/apps/web/app/lib/surveys/surveys.test.ts index 8e7e13d027..4be3c9bfd8 100644 --- a/apps/web/app/lib/surveys/surveys.test.ts +++ b/apps/web/app/lib/surveys/surveys.test.ts @@ -1,8 +1,3 @@ -import { - DateRange, - SelectedFilterValue, -} from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; -import { OptionsType } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; import "@testing-library/jest-dom/vitest"; import { cleanup } from "@testing-library/react"; import { afterEach, describe, expect, test } from "vitest"; @@ -14,6 +9,11 @@ import { TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; +import { + DateRange, + SelectedFilterValue, +} from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; +import { OptionsType } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/QuestionsComboBox"; import { generateQuestionAndFilterOptions, getFormattedFilters, getTodayDate } from "./surveys"; describe("surveys", () => { diff --git a/apps/web/app/middleware/domain-utils.ts b/apps/web/app/middleware/domain-utils.ts index dd5c284966..9544aebd15 100644 --- a/apps/web/app/middleware/domain-utils.ts +++ b/apps/web/app/middleware/domain-utils.ts @@ -1,5 +1,5 @@ -import { env } from "@/lib/env"; import { NextRequest } from "next/server"; +import { env } from "@/lib/env"; /** * Get the public domain from PUBLIC_URL environment variable diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx index a48fa6a5d0..4b4ee9885e 100644 --- a/apps/web/app/not-found.tsx +++ b/apps/web/app/not-found.tsx @@ -1,5 +1,5 @@ -import { Button } from "@/modules/ui/components/button"; import Link from "next/link"; +import { Button } from "@/modules/ui/components/button"; const NotFound = () => { return ( diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 39950f14b7..793b66b937 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -1,3 +1,6 @@ +import type { Session } from "next-auth"; +import { getServerSession } from "next-auth"; +import { redirect } from "next/navigation"; import ClientEnvironmentRedirect from "@/app/ClientEnvironmentRedirect"; import { getIsFreshInstance } from "@/lib/instance/service"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; @@ -7,9 +10,6 @@ import { getUserProjectEnvironmentsByOrganizationIds } from "@/lib/project/servi import { getUser } from "@/lib/user/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { ClientLogout } from "@/modules/ui/components/client-logout"; -import type { Session } from "next-auth"; -import { getServerSession } from "next-auth"; -import { redirect } from "next/navigation"; const Page = async () => { const session: Session | null = await getServerSession(authOptions); diff --git a/apps/web/app/setup/organization/create/actions.ts b/apps/web/app/setup/organization/create/actions.ts index fde25c06c9..4d30fc504a 100644 --- a/apps/web/app/setup/organization/create/actions.ts +++ b/apps/web/app/setup/organization/create/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; import { gethasNoOrganizations } from "@/lib/instance/service"; import { createMembership } from "@/lib/membership/service"; import { createOrganization } from "@/lib/organization/service"; @@ -7,8 +9,6 @@ import { authenticatedActionClient } from "@/lib/utils/action-client"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; -import { z } from "zod"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; const ZCreateOrganizationAction = z.object({ organizationName: z.string(), diff --git a/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/audit-logs.ts b/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/audit-logs.ts index 674695b5df..a183da7d6b 100644 --- a/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/audit-logs.ts +++ b/apps/web/app/storage/[environmentId]/[accessType]/[fileName]/lib/audit-logs.ts @@ -1,7 +1,7 @@ +import { logger } from "@formbricks/logger"; import { getOrganizationIdFromEnvironmentId } from "@/lib/utils/helper"; import { queueAuditEvent } from "@/modules/ee/audit-logs/lib/handler"; import { TAuditStatus, UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; -import { logger } from "@formbricks/logger"; const getOrgId = async (environmentId: string): Promise => { try { diff --git a/apps/web/instrumentation-node.ts b/apps/web/instrumentation-node.ts index 3e43e9f5c1..fdc9436747 100644 --- a/apps/web/instrumentation-node.ts +++ b/apps/web/instrumentation-node.ts @@ -1,5 +1,4 @@ // instrumentation-node.ts -import { env } from "@/lib/env"; import { PrometheusExporter } from "@opentelemetry/exporter-prometheus"; import { HostMetrics } from "@opentelemetry/host-metrics"; import { registerInstrumentations } from "@opentelemetry/instrumentation"; @@ -14,6 +13,7 @@ import { } from "@opentelemetry/resources"; import { MeterProvider } from "@opentelemetry/sdk-metrics"; import { logger } from "@formbricks/logger"; +import { env } from "@/lib/env"; const exporter = new PrometheusExporter({ port: env.PROMETHEUS_EXPORTER_PORT ? parseInt(env.PROMETHEUS_EXPORTER_PORT) : 9464, diff --git a/apps/web/instrumentation.ts b/apps/web/instrumentation.ts index 2ee81ec52b..ed4ae703f1 100644 --- a/apps/web/instrumentation.ts +++ b/apps/web/instrumentation.ts @@ -1,5 +1,5 @@ -import { IS_PRODUCTION, PROMETHEUS_ENABLED, SENTRY_DSN } from "@/lib/constants"; import * as Sentry from "@sentry/nextjs"; +import { IS_PRODUCTION, PROMETHEUS_ENABLED, SENTRY_DSN } from "@/lib/constants"; export const onRequestError = Sentry.captureRequestError; diff --git a/apps/web/lib/display/tests/display.test.ts b/apps/web/lib/display/tests/display.test.ts index ada1880765..a84fa934cd 100644 --- a/apps/web/lib/display/tests/display.test.ts +++ b/apps/web/lib/display/tests/display.test.ts @@ -9,12 +9,12 @@ import { mockSurveyId, } from "./__mocks__/data.mock"; import { prisma } from "@/lib/__mocks__/database"; -import { createDisplay } from "@/app/api/v1/client/[environmentId]/displays/lib/display"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { testInputValidation } from "vitestSetup"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { DatabaseError } from "@formbricks/types/errors"; +import { createDisplay } from "@/app/api/v1/client/[environmentId]/displays/lib/display"; import { deleteDisplay } from "../service"; beforeEach(() => { diff --git a/apps/web/lib/googleSheet/service.ts b/apps/web/lib/googleSheet/service.ts index b927e6f134..1a613752f6 100644 --- a/apps/web/lib/googleSheet/service.ts +++ b/apps/web/lib/googleSheet/service.ts @@ -1,11 +1,4 @@ import "server-only"; -import { - GOOGLE_SHEETS_CLIENT_ID, - GOOGLE_SHEETS_CLIENT_SECRET, - GOOGLE_SHEETS_REDIRECT_URL, -} from "@/lib/constants"; -import { GOOGLE_SHEET_MESSAGE_LIMIT } from "@/lib/constants"; -import { createOrUpdateIntegration } from "@/lib/integration/service"; import { Prisma } from "@prisma/client"; import { z } from "zod"; import { ZString } from "@formbricks/types/common"; @@ -14,6 +7,13 @@ import { TIntegrationGoogleSheets, ZIntegrationGoogleSheets, } from "@formbricks/types/integration/google-sheet"; +import { + GOOGLE_SHEETS_CLIENT_ID, + GOOGLE_SHEETS_CLIENT_SECRET, + GOOGLE_SHEETS_REDIRECT_URL, +} from "@/lib/constants"; +import { GOOGLE_SHEET_MESSAGE_LIMIT } from "@/lib/constants"; +import { createOrUpdateIntegration } from "@/lib/integration/service"; import { truncateText } from "../utils/strings"; import { validateInputs } from "../utils/validate"; diff --git a/apps/web/lib/language/tests/language.test.ts b/apps/web/lib/language/tests/language.test.ts index 8a299a835c..535ee1fb5e 100644 --- a/apps/web/lib/language/tests/language.test.ts +++ b/apps/web/lib/language/tests/language.test.ts @@ -6,12 +6,12 @@ import { mockProjectId, mockUpdatedLanguage, } from "./__mocks__/data.mock"; -import { getProject } from "@/lib/project/service"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, ValidationError } from "@formbricks/types/errors"; import { TProject } from "@formbricks/types/project"; +import { getProject } from "@/lib/project/service"; import { createLanguage, deleteLanguage, updateLanguage } from "../service"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/lib/notion/service.ts b/apps/web/lib/notion/service.ts index d508473783..fe981ae17e 100644 --- a/apps/web/lib/notion/service.ts +++ b/apps/web/lib/notion/service.ts @@ -1,10 +1,10 @@ -import { ENCRYPTION_KEY } from "@/lib/constants"; -import { symmetricDecrypt } from "@/lib/crypto"; import { TIntegrationNotion, TIntegrationNotionConfig, TIntegrationNotionDatabase, } from "@formbricks/types/integration/notion"; +import { ENCRYPTION_KEY } from "@/lib/constants"; +import { symmetricDecrypt } from "@/lib/crypto"; import { getIntegrationByType } from "../integration/service"; const fetchPages = async (config: TIntegrationNotionConfig) => { diff --git a/apps/web/lib/organization/service.test.ts b/apps/web/lib/organization/service.test.ts index 546253983a..f38436f69f 100644 --- a/apps/web/lib/organization/service.test.ts +++ b/apps/web/lib/organization/service.test.ts @@ -1,9 +1,9 @@ -import { BILLING_LIMITS, PROJECT_FEATURE_KEYS } from "@/lib/constants"; -import { updateUser } from "@/lib/user/service"; import { Prisma } from "@prisma/client"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { BILLING_LIMITS, PROJECT_FEATURE_KEYS } from "@/lib/constants"; +import { updateUser } from "@/lib/user/service"; import { createOrganization, getOrganization, diff --git a/apps/web/lib/organization/service.ts b/apps/web/lib/organization/service.ts index 93a3e7d55a..83a2c8edf1 100644 --- a/apps/web/lib/organization/service.ts +++ b/apps/web/lib/organization/service.ts @@ -1,8 +1,4 @@ import "server-only"; -import { BILLING_LIMITS, ITEMS_PER_PAGE, PROJECT_FEATURE_KEYS } from "@/lib/constants"; -import { getProjects } from "@/lib/project/service"; -import { updateUser } from "@/lib/user/service"; -import { getBillingPeriodStartDate } from "@/lib/utils/billing"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -17,6 +13,10 @@ import { ZOrganizationCreateInput, } from "@formbricks/types/organizations"; import { TUserNotificationSettings } from "@formbricks/types/user"; +import { BILLING_LIMITS, ITEMS_PER_PAGE, PROJECT_FEATURE_KEYS } from "@/lib/constants"; +import { getProjects } from "@/lib/project/service"; +import { updateUser } from "@/lib/user/service"; +import { getBillingPeriodStartDate } from "@/lib/utils/billing"; import { validateInputs } from "../utils/validate"; export const select: Prisma.OrganizationSelect = { diff --git a/apps/web/lib/posthogServer.ts b/apps/web/lib/posthogServer.ts index e5c08640a0..175660fd1b 100644 --- a/apps/web/lib/posthogServer.ts +++ b/apps/web/lib/posthogServer.ts @@ -1,8 +1,8 @@ -import { cache } from "@/lib/cache"; import { PostHog } from "posthog-node"; import { createCacheKey } from "@formbricks/cache"; import { logger } from "@formbricks/logger"; import { TOrganizationBillingPlan, TOrganizationBillingPlanLimits } from "@formbricks/types/organizations"; +import { cache } from "@/lib/cache"; import { IS_POSTHOG_CONFIGURED, IS_PRODUCTION, POSTHOG_API_HOST, POSTHOG_API_KEY } from "./constants"; const enabled = IS_PRODUCTION && IS_POSTHOG_CONFIGURED; diff --git a/apps/web/lib/response/service.ts b/apps/web/lib/response/service.ts index 9e84cf6a75..00165050a3 100644 --- a/apps/web/lib/response/service.ts +++ b/apps/web/lib/response/service.ts @@ -1,9 +1,4 @@ import "server-only"; -import { getIsQuotasEnabled } from "@/modules/ee/license-check/lib/utils"; -import { reduceQuotaLimits } from "@/modules/ee/quotas/lib/quotas"; -import { deleteFile } from "@/modules/storage/service"; -import { getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; -import { getOrganizationBilling } from "@/modules/survey/lib/survey"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; @@ -22,6 +17,11 @@ import { } from "@formbricks/types/responses"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; +import { getIsQuotasEnabled } from "@/modules/ee/license-check/lib/utils"; +import { reduceQuotaLimits } from "@/modules/ee/quotas/lib/quotas"; +import { deleteFile } from "@/modules/storage/service"; +import { getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; +import { getOrganizationBilling } from "@/modules/survey/lib/survey"; import { ITEMS_PER_PAGE } from "../constants"; import { deleteDisplay } from "../display/service"; import { getSurvey } from "../survey/service"; diff --git a/apps/web/lib/response/tests/__mocks__/data.mock.ts b/apps/web/lib/response/tests/__mocks__/data.mock.ts index f17dab7f2f..99c5ea18b5 100644 --- a/apps/web/lib/response/tests/__mocks__/data.mock.ts +++ b/apps/web/lib/response/tests/__mocks__/data.mock.ts @@ -1,4 +1,3 @@ -import { mockWelcomeCard } from "@/lib/i18n/i18n.mock"; import { Prisma } from "@prisma/client"; import { isAfter, isBefore, isSameDay } from "date-fns"; import { TDisplay } from "@formbricks/types/displays"; @@ -6,6 +5,7 @@ import { TSurveyQuota } from "@formbricks/types/quota"; import { TResponse, TResponseFilterCriteria, TResponseUpdateInput } from "@formbricks/types/responses"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; +import { mockWelcomeCard } from "@/lib/i18n/i18n.mock"; import { responseSelection } from "../../service"; import { constantsForTests } from "../constants"; diff --git a/apps/web/lib/response/tests/response.test.ts b/apps/web/lib/response/tests/response.test.ts index 063033bfe4..b2878be154 100644 --- a/apps/web/lib/response/tests/response.test.ts +++ b/apps/web/lib/response/tests/response.test.ts @@ -12,7 +12,6 @@ import { mockTags, } from "./__mocks__/data.mock"; import { prisma } from "@/lib/__mocks__/database"; -import { getSurveySummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { testInputValidation } from "vitestSetup"; @@ -20,6 +19,7 @@ import { PrismaErrorType } from "@formbricks/database/types/error"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TResponse } from "@formbricks/types/responses"; import { TTag } from "@formbricks/types/tags"; +import { getSurveySummary } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/summary/lib/surveySummary"; import { mockContactAttributeKey, mockOrganizationOutput, diff --git a/apps/web/lib/survey/service.test.ts b/apps/web/lib/survey/service.test.ts index b6377ad653..4253c78a12 100644 --- a/apps/web/lib/survey/service.test.ts +++ b/apps/web/lib/survey/service.test.ts @@ -1,11 +1,4 @@ import { prisma } from "@/lib/__mocks__/database"; -import { getActionClasses } from "@/lib/actionClass/service"; -import { - getOrganizationByEnvironmentId, - subscribeOrganizationMembersToSurveyResponses, -} from "@/lib/organization/service"; -import { capturePosthogEnvironmentEvent } from "@/lib/posthogServer"; -import { evaluateLogic } from "@/lib/surveyLogic/utils"; import { ActionClass, Prisma, Survey } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { testInputValidation } from "vitestSetup"; @@ -15,6 +8,13 @@ import { TActionClass } from "@formbricks/types/action-classes"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyCreateInput, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getActionClasses } from "@/lib/actionClass/service"; +import { + getOrganizationByEnvironmentId, + subscribeOrganizationMembersToSurveyResponses, +} from "@/lib/organization/service"; +import { capturePosthogEnvironmentEvent } from "@/lib/posthogServer"; +import { evaluateLogic } from "@/lib/surveyLogic/utils"; import { mockActionClass, mockId, diff --git a/apps/web/lib/survey/service.ts b/apps/web/lib/survey/service.ts index 781d43e2ef..6f3a801b07 100644 --- a/apps/web/lib/survey/service.ts +++ b/apps/web/lib/survey/service.ts @@ -1,8 +1,4 @@ import "server-only"; -import { - getOrganizationByEnvironmentId, - subscribeOrganizationMembersToSurveyResponses, -} from "@/lib/organization/service"; import { ActionClass, Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -11,6 +7,10 @@ import { ZId, ZOptionalNumber } from "@formbricks/types/common"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSegment, ZSegmentFilters } from "@formbricks/types/segment"; import { TSurvey, TSurveyCreateInput, ZSurvey, ZSurveyCreateInput } from "@formbricks/types/surveys/types"; +import { + getOrganizationByEnvironmentId, + subscribeOrganizationMembersToSurveyResponses, +} from "@/lib/organization/service"; import { getActionClasses } from "../actionClass/service"; import { ITEMS_PER_PAGE } from "../constants"; import { capturePosthogEnvironmentEvent } from "../posthogServer"; diff --git a/apps/web/lib/survey/utils.test.ts b/apps/web/lib/survey/utils.test.ts index a8e2306d43..fd2426cd98 100644 --- a/apps/web/lib/survey/utils.test.ts +++ b/apps/web/lib/survey/utils.test.ts @@ -1,9 +1,9 @@ -import * as fileValidation from "@/modules/storage/utils"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { InvalidInputError } from "@formbricks/types/errors"; import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import * as fileValidation from "@/modules/storage/utils"; import { anySurveyHasFilters, checkForInvalidImagesInQuestions, transformPrismaSurvey } from "./utils"; describe("transformPrismaSurvey", () => { diff --git a/apps/web/lib/survey/utils.ts b/apps/web/lib/survey/utils.ts index 7af2cc58fe..5901b5e054 100644 --- a/apps/web/lib/survey/utils.ts +++ b/apps/web/lib/survey/utils.ts @@ -1,9 +1,9 @@ import "server-only"; -import { isValidImageFile } from "@/modules/storage/utils"; import { InvalidInputError } from "@formbricks/types/errors"; import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { isValidImageFile } from "@/modules/storage/utils"; export const transformPrismaSurvey = ( surveyPrisma: any diff --git a/apps/web/lib/surveyLogic/utils.ts b/apps/web/lib/surveyLogic/utils.ts index 2528505ebb..1ecde53ba2 100644 --- a/apps/web/lib/surveyLogic/utils.ts +++ b/apps/web/lib/surveyLogic/utils.ts @@ -1,4 +1,3 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; import { createId } from "@paralleldrive/cuid2"; import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { TResponseData, TResponseVariables } from "@formbricks/types/responses"; @@ -13,6 +12,7 @@ import { TSurveyQuestionTypeEnum, TSurveyVariable, } from "@formbricks/types/surveys/types"; +import { getLocalizedValue } from "@/lib/i18n/utils"; type TCondition = TSingleCondition | TConditionGroup; diff --git a/apps/web/lib/tag/service.test.ts b/apps/web/lib/tag/service.test.ts index f18212be27..774b50c6c4 100644 --- a/apps/web/lib/tag/service.test.ts +++ b/apps/web/lib/tag/service.test.ts @@ -1,9 +1,9 @@ -import { TagError } from "@/modules/projects/settings/types/tag"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { TTag } from "@formbricks/types/tags"; +import { TagError } from "@/modules/projects/settings/types/tag"; import { createTag, getTag, getTagsByEnvironmentId } from "./service"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/lib/tag/service.ts b/apps/web/lib/tag/service.ts index 03f0655312..aa3a722741 100644 --- a/apps/web/lib/tag/service.ts +++ b/apps/web/lib/tag/service.ts @@ -1,5 +1,4 @@ import "server-only"; -import { TagError } from "@/modules/projects/settings/types/tag"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -7,6 +6,7 @@ import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId, ZOptionalNumber, ZString } from "@formbricks/types/common"; import { Result, err, ok } from "@formbricks/types/error-handlers"; import { TTag } from "@formbricks/types/tags"; +import { TagError } from "@/modules/projects/settings/types/tag"; import { ITEMS_PER_PAGE } from "../constants"; import { validateInputs } from "../utils/validate"; diff --git a/apps/web/lib/user/service.test.ts b/apps/web/lib/user/service.test.ts index a2f0b0296c..790eb14b61 100644 --- a/apps/web/lib/user/service.test.ts +++ b/apps/web/lib/user/service.test.ts @@ -1,4 +1,3 @@ -import { deleteOrganization, getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; import { IdentityProvider, Prisma } from "@prisma/client"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -6,6 +5,7 @@ import { PrismaErrorType } from "@formbricks/database/types/error"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TOrganization } from "@formbricks/types/organizations"; import { TUserLocale, TUserUpdateInput } from "@formbricks/types/user"; +import { deleteOrganization, getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; import { deleteUser, getUser, getUserByEmail, getUsersWithOrganization, updateUser } from "./service"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/lib/user/service.ts b/apps/web/lib/user/service.ts index abe8a05e9f..239e3849b2 100644 --- a/apps/web/lib/user/service.ts +++ b/apps/web/lib/user/service.ts @@ -1,6 +1,4 @@ import "server-only"; -import { deleteOrganization, getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; -import { deleteBrevoCustomerByEmail } from "@/modules/auth/lib/brevo"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; @@ -9,6 +7,8 @@ import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId } from "@formbricks/types/common"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TUser, TUserLocale, TUserUpdateInput, ZUserUpdateInput } from "@formbricks/types/user"; +import { deleteOrganization, getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; +import { deleteBrevoCustomerByEmail } from "@/modules/auth/lib/brevo"; import { validateInputs } from "../utils/validate"; const responseSelection = { diff --git a/apps/web/lib/utils/action-client/action-client-middleware.test.ts b/apps/web/lib/utils/action-client/action-client-middleware.test.ts index 71709fc7c9..d345e1cb39 100644 --- a/apps/web/lib/utils/action-client/action-client-middleware.test.ts +++ b/apps/web/lib/utils/action-client/action-client-middleware.test.ts @@ -1,10 +1,10 @@ -import { getMembershipRole } from "@/lib/membership/hooks/actions"; -import { getProjectPermissionByUserId, getTeamRoleByTeamIdUserId } from "@/modules/ee/teams/lib/roles"; import { cleanup } from "@testing-library/react"; import { returnValidationErrors } from "next-safe-action"; import { afterEach, describe, expect, test, vi } from "vitest"; import { ZodIssue, z } from "zod"; import { AuthorizationError } from "@formbricks/types/errors"; +import { getMembershipRole } from "@/lib/membership/hooks/actions"; +import { getProjectPermissionByUserId, getTeamRoleByTeamIdUserId } from "@/modules/ee/teams/lib/roles"; import { checkAuthorizationUpdated, formatErrors } from "./action-client-middleware"; vi.mock("@/lib/membership/hooks/actions", () => ({ diff --git a/apps/web/lib/utils/action-client/action-client-middleware.ts b/apps/web/lib/utils/action-client/action-client-middleware.ts index 60425a9438..47a458ee21 100644 --- a/apps/web/lib/utils/action-client/action-client-middleware.ts +++ b/apps/web/lib/utils/action-client/action-client-middleware.ts @@ -1,11 +1,11 @@ -import { getMembershipRole } from "@/lib/membership/hooks/actions"; -import { getProjectPermissionByUserId, getTeamRoleByTeamIdUserId } from "@/modules/ee/teams/lib/roles"; -import { type TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; -import { type TTeamRole } from "@/modules/ee/teams/team-list/types/team"; import { returnValidationErrors } from "next-safe-action"; import { ZodIssue, z } from "zod"; import { AuthorizationError } from "@formbricks/types/errors"; import { type TOrganizationRole } from "@formbricks/types/memberships"; +import { getMembershipRole } from "@/lib/membership/hooks/actions"; +import { getProjectPermissionByUserId, getTeamRoleByTeamIdUserId } from "@/modules/ee/teams/lib/roles"; +import { type TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; +import { type TTeamRole } from "@/modules/ee/teams/team-list/types/team"; export const formatErrors = (issues: ZodIssue[]): Record => { return { diff --git a/apps/web/lib/utils/action-client/index.ts b/apps/web/lib/utils/action-client/index.ts index 5f6ce676c9..9698b8d6b9 100644 --- a/apps/web/lib/utils/action-client/index.ts +++ b/apps/web/lib/utils/action-client/index.ts @@ -1,8 +1,3 @@ -import { AUDIT_LOG_ENABLED, AUDIT_LOG_GET_USER_IP } from "@/lib/constants"; -import { getUser } from "@/lib/user/service"; -import { getClientIpFromHeaders } from "@/lib/utils/client-ip"; -import { authOptions } from "@/modules/auth/lib/authOptions"; -import { UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; import * as Sentry from "@sentry/nextjs"; import { getServerSession } from "next-auth"; import { DEFAULT_SERVER_ERROR_MESSAGE, createSafeActionClient } from "next-safe-action"; @@ -17,6 +12,11 @@ import { TooManyRequestsError, UnknownError, } from "@formbricks/types/errors"; +import { AUDIT_LOG_ENABLED, AUDIT_LOG_GET_USER_IP } from "@/lib/constants"; +import { getUser } from "@/lib/user/service"; +import { getClientIpFromHeaders } from "@/lib/utils/client-ip"; +import { authOptions } from "@/modules/auth/lib/authOptions"; +import { UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; import { ActionClientCtx } from "./types/context"; export const actionClient = createSafeActionClient({ diff --git a/apps/web/lib/utils/helper.test.ts b/apps/web/lib/utils/helper.test.ts index 1ba42be0f8..425af1ba9a 100644 --- a/apps/web/lib/utils/helper.test.ts +++ b/apps/web/lib/utils/helper.test.ts @@ -1,6 +1,6 @@ -import * as services from "@/lib/utils/services"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { ResourceNotFoundError } from "@formbricks/types/errors"; +import * as services from "@/lib/utils/services"; import { getEnvironmentIdFromResponseId, getEnvironmentIdFromSegmentId, diff --git a/apps/web/lib/utils/helper.ts b/apps/web/lib/utils/helper.ts index 89b7df01fc..7358c32ed8 100644 --- a/apps/web/lib/utils/helper.ts +++ b/apps/web/lib/utils/helper.ts @@ -1,3 +1,4 @@ +import { ResourceNotFoundError } from "@formbricks/types/errors"; import { getActionClass, getApiKey, @@ -15,7 +16,6 @@ import { getTeam, getWebhook, } from "@/lib/utils/services"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; export const getFormattedErrorMessage = (result): string => { let message = ""; diff --git a/apps/web/lib/utils/locale.test.ts b/apps/web/lib/utils/locale.test.ts index e4701f06e8..6c9ec1a6ff 100644 --- a/apps/web/lib/utils/locale.test.ts +++ b/apps/web/lib/utils/locale.test.ts @@ -1,6 +1,6 @@ -import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from "@/lib/constants"; import * as nextHeaders from "next/headers"; import { describe, expect, test, vi } from "vitest"; +import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from "@/lib/constants"; import { findMatchingLocale } from "./locale"; // Mock the Next.js headers function diff --git a/apps/web/lib/utils/locale.ts b/apps/web/lib/utils/locale.ts index 63ebdc2cb0..4af8de9743 100644 --- a/apps/web/lib/utils/locale.ts +++ b/apps/web/lib/utils/locale.ts @@ -1,6 +1,6 @@ -import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from "@/lib/constants"; import { headers } from "next/headers"; import { TUserLocale } from "@formbricks/types/user"; +import { AVAILABLE_LOCALES, DEFAULT_LOCALE } from "@/lib/constants"; export const findMatchingLocale = async (): Promise => { const headersList = await headers(); diff --git a/apps/web/lib/utils/services.test.ts b/apps/web/lib/utils/services.test.ts index e124ddb899..aa834b5d2a 100644 --- a/apps/web/lib/utils/services.test.ts +++ b/apps/web/lib/utils/services.test.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; -import { getQuota as getQuotaService } from "@/modules/ee/quotas/lib/quotas"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurveyQuota } from "@formbricks/types/quota"; +import { validateInputs } from "@/lib/utils/validate"; +import { getQuota as getQuotaService } from "@/modules/ee/quotas/lib/quotas"; import { getActionClass, getApiKey, diff --git a/apps/web/lib/utils/services.ts b/apps/web/lib/utils/services.ts index 64ac23bb57..42faad4a24 100644 --- a/apps/web/lib/utils/services.ts +++ b/apps/web/lib/utils/services.ts @@ -1,12 +1,12 @@ "use server"; -import { validateInputs } from "@/lib/utils/validate"; -import { getQuota as getQuotaService } from "@/modules/ee/quotas/lib/quotas"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId, ZString } from "@formbricks/types/common"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { getQuota as getQuotaService } from "@/modules/ee/quotas/lib/quotas"; export const getActionClass = reactCache( async (actionClassId: string): Promise<{ environmentId: string } | null> => { diff --git a/apps/web/lib/utils/single-use-surveys.test.ts b/apps/web/lib/utils/single-use-surveys.test.ts index ccd2813b24..40c50a1d3e 100644 --- a/apps/web/lib/utils/single-use-surveys.test.ts +++ b/apps/web/lib/utils/single-use-surveys.test.ts @@ -1,7 +1,7 @@ -import * as crypto from "@/lib/crypto"; -import { env } from "@/lib/env"; import cuid2 from "@paralleldrive/cuid2"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import * as crypto from "@/lib/crypto"; +import { env } from "@/lib/env"; import { generateSurveySingleUseId, generateSurveySingleUseIds } from "./single-use-surveys"; vi.mock("@/lib/crypto", () => ({ diff --git a/apps/web/lib/utils/single-use-surveys.ts b/apps/web/lib/utils/single-use-surveys.ts index 05af0a193b..8a7cf4a96c 100644 --- a/apps/web/lib/utils/single-use-surveys.ts +++ b/apps/web/lib/utils/single-use-surveys.ts @@ -1,6 +1,6 @@ +import cuid2 from "@paralleldrive/cuid2"; import { symmetricEncrypt } from "@/lib/crypto"; import { env } from "@/lib/env"; -import cuid2 from "@paralleldrive/cuid2"; // generate encrypted single use id for the survey export const generateSurveySingleUseId = (isEncrypted: boolean): string => { diff --git a/apps/web/lib/utils/templates.test.ts b/apps/web/lib/utils/templates.test.ts index 421f8fd623..a276673b2b 100644 --- a/apps/web/lib/utils/templates.test.ts +++ b/apps/web/lib/utils/templates.test.ts @@ -1,9 +1,9 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { TProject } from "@formbricks/types/project"; import { TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TTemplate } from "@formbricks/types/templates"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { replacePresetPlaceholders, replaceQuestionPresetPlaceholders } from "./templates"; // Mock the imported functions diff --git a/apps/web/lib/utils/templates.ts b/apps/web/lib/utils/templates.ts index 3506caf358..237f592fc8 100644 --- a/apps/web/lib/utils/templates.ts +++ b/apps/web/lib/utils/templates.ts @@ -1,8 +1,8 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { TProject } from "@formbricks/types/project"; import { TSurveyQuestion } from "@formbricks/types/surveys/types"; import { TTemplate } from "@formbricks/types/templates"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { structuredClone } from "@/lib/pollyfills/structuredClone"; export const replaceQuestionPresetPlaceholders = ( question: TSurveyQuestion, diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index 257786cc0c..59db56d4f5 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -1,11 +1,11 @@ -import { isPublicDomainConfigured, isRequestFromPublicDomain } from "@/app/middleware/domain-utils"; -import { isAuthProtectedRoute, isRouteAllowedForDomain } from "@/app/middleware/endpoint-validator"; -import { WEBAPP_URL } from "@/lib/constants"; -import { isValidCallbackUrl } from "@/lib/utils/url"; import { getToken } from "next-auth/jwt"; import { NextRequest, NextResponse } from "next/server"; import { v4 as uuidv4 } from "uuid"; import { logger } from "@formbricks/logger"; +import { isPublicDomainConfigured, isRequestFromPublicDomain } from "@/app/middleware/domain-utils"; +import { isAuthProtectedRoute, isRouteAllowedForDomain } from "@/app/middleware/endpoint-validator"; +import { WEBAPP_URL } from "@/lib/constants"; +import { isValidCallbackUrl } from "@/lib/utils/url"; const handleAuth = async (request: NextRequest): Promise => { const token = await getToken({ req: request as any }); diff --git a/apps/web/modules/account/components/DeleteAccountModal/actions.ts b/apps/web/modules/account/components/DeleteAccountModal/actions.ts index 5755f19a3d..4738e8b2b3 100644 --- a/apps/web/modules/account/components/DeleteAccountModal/actions.ts +++ b/apps/web/modules/account/components/DeleteAccountModal/actions.ts @@ -1,12 +1,12 @@ "use server"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; import { getOrganizationsWhereUserIsSingleOwner } from "@/lib/organization/service"; import { deleteUser, getUser } from "@/lib/user/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; export const deleteUserAction = authenticatedActionClient.action( withAuditLogging( diff --git a/apps/web/modules/account/components/DeleteAccountModal/index.tsx b/apps/web/modules/account/components/DeleteAccountModal/index.tsx index 6f80722bed..ba0176d0e5 100644 --- a/apps/web/modules/account/components/DeleteAccountModal/index.tsx +++ b/apps/web/modules/account/components/DeleteAccountModal/index.tsx @@ -1,13 +1,13 @@ "use client"; -import { useSignOut } from "@/modules/auth/hooks/use-sign-out"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { Input } from "@/modules/ui/components/input"; import { T, useTranslate } from "@tolgee/react"; import { Dispatch, SetStateAction, useState } from "react"; import toast from "react-hot-toast"; import { TOrganization } from "@formbricks/types/organizations"; import { TUser } from "@formbricks/types/user"; +import { useSignOut } from "@/modules/auth/hooks/use-sign-out"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; +import { Input } from "@/modules/ui/components/input"; import { deleteUserAction } from "./actions"; interface DeleteAccountModalProps { diff --git a/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.test.tsx b/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.test.tsx index dec906f64b..4062b25044 100644 --- a/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.test.tsx +++ b/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.test.tsx @@ -1,9 +1,9 @@ -import { getEnabledLanguages } from "@/lib/i18n/utils"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import { TSurvey, TSurveyLanguage } from "@formbricks/types/surveys/types"; +import { getEnabledLanguages } from "@/lib/i18n/utils"; import { LanguageDropdown } from "./LanguageDropdown"; vi.mock("@/lib/i18n/utils", () => ({ diff --git a/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.tsx b/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.tsx index a2ee9222b4..84b6e223a5 100644 --- a/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.tsx +++ b/apps/web/modules/analysis/components/ShareSurveyLink/components/LanguageDropdown.tsx @@ -1,11 +1,11 @@ -import { getEnabledLanguages } from "@/lib/i18n/utils"; -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; -import { Button } from "@/modules/ui/components/button"; import { Languages } from "lucide-react"; import { useRef, useState } from "react"; import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { getEnabledLanguages } from "@/lib/i18n/utils"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; +import { Button } from "@/modules/ui/components/button"; interface LanguageDropdownProps { survey: TSurvey; diff --git a/apps/web/modules/analysis/components/ShareSurveyLink/index.test.tsx b/apps/web/modules/analysis/components/ShareSurveyLink/index.test.tsx index f00c08cd40..4315f31bec 100644 --- a/apps/web/modules/analysis/components/ShareSurveyLink/index.test.tsx +++ b/apps/web/modules/analysis/components/ShareSurveyLink/index.test.tsx @@ -1,9 +1,9 @@ -import { ShareSurveyLink } from "@/modules/analysis/components/ShareSurveyLink/index"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { toast } from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { ShareSurveyLink } from "@/modules/analysis/components/ShareSurveyLink/index"; import { getSurveyUrl } from "../../utils"; vi.mock("react-hot-toast", () => ({ diff --git a/apps/web/modules/analysis/components/ShareSurveyLink/index.tsx b/apps/web/modules/analysis/components/ShareSurveyLink/index.tsx index 7347cb8e5a..28ae22b6c7 100644 --- a/apps/web/modules/analysis/components/ShareSurveyLink/index.tsx +++ b/apps/web/modules/analysis/components/ShareSurveyLink/index.tsx @@ -1,12 +1,12 @@ "use client"; -import { useSingleUseId } from "@/modules/survey/hooks/useSingleUseId"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { Copy, SquareArrowOutUpRight } from "lucide-react"; import { toast } from "react-hot-toast"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { useSingleUseId } from "@/modules/survey/hooks/useSingleUseId"; +import { Button } from "@/modules/ui/components/button"; import { getSurveyUrl } from "../../utils"; import { LanguageDropdown } from "./components/LanguageDropdown"; import { SurveyLinkDisplay } from "./components/SurveyLinkDisplay"; diff --git a/apps/web/modules/analysis/components/SingleResponseCard/actions.ts b/apps/web/modules/analysis/components/SingleResponseCard/actions.ts index 50143462c4..a6f3dea0fd 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/actions.ts +++ b/apps/web/modules/analysis/components/SingleResponseCard/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { deleteResponse, getResponse } from "@/lib/response/service"; import { createTag } from "@/lib/tag/service"; import { addTagToRespone, deleteTagOnResponse } from "@/lib/tagOnResponse/service"; @@ -15,8 +17,6 @@ import { } from "@/lib/utils/helper"; import { getTag } from "@/lib/utils/services"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZCreateTagAction = z.object({ environmentId: ZId, diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/HiddenFields.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/HiddenFields.tsx index b3e7463f47..0b364a4ed5 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/HiddenFields.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/HiddenFields.tsx @@ -1,10 +1,10 @@ "use client"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { EyeOffIcon } from "lucide-react"; import { TResponseData } from "@formbricks/types/responses"; import { TSurveyHiddenFields } from "@formbricks/types/surveys/types"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; interface HiddenFieldsProps { hiddenFields: TSurveyHiddenFields; diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/QuestionSkip.test.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/QuestionSkip.test.tsx index 0257a368c0..895236d261 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/QuestionSkip.test.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/QuestionSkip.test.tsx @@ -1,7 +1,7 @@ -import { parseRecallInfo } from "@/lib/utils/recall"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurveyQuestion } from "@formbricks/types/surveys/types"; +import { parseRecallInfo } from "@/lib/utils/recall"; import { QuestionSkip } from "./QuestionSkip"; vi.mock("@/modules/ui/components/tooltip", () => ({ diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.test.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.test.tsx index 31cbe8bd44..87f46de3af 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.test.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.test.tsx @@ -1,10 +1,10 @@ -import { TagError } from "@/modules/projects/settings/types/tag"; import "@testing-library/jest-dom/vitest"; import { act, cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TTag } from "@formbricks/types/tags"; +import { TagError } from "@/modules/projects/settings/types/tag"; import { createTagAction, createTagToResponseAction, deleteTagOnResponseAction } from "../actions"; import { ResponseTagsWrapper } from "./ResponseTagsWrapper"; diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.tsx index 408916bb48..7200b46171 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseTagsWrapper.tsx @@ -1,16 +1,16 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { TagError } from "@/modules/projects/settings/types/tag"; -import { Button } from "@/modules/ui/components/button"; -import { Tag } from "@/modules/ui/components/tag"; -import { TagsCombobox } from "@/modules/ui/components/tags-combobox"; import { useTranslate } from "@tolgee/react"; import { AlertCircleIcon, SettingsIcon } from "lucide-react"; import { useRouter } from "next/navigation"; import React, { useEffect, useState } from "react"; import toast from "react-hot-toast"; import { TTag } from "@formbricks/types/tags"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { TagError } from "@/modules/projects/settings/types/tag"; +import { Button } from "@/modules/ui/components/button"; +import { Tag } from "@/modules/ui/components/tag"; +import { TagsCombobox } from "@/modules/ui/components/tags-combobox"; import { createTagAction, createTagToResponseAction, deleteTagOnResponseAction } from "../actions"; interface ResponseTagsWrapperProps { diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseVariables.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseVariables.tsx index 2ac1d1b127..4084d92c8f 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseVariables.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/ResponseVariables.tsx @@ -1,10 +1,10 @@ "use client"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { FileDigitIcon, FileType2Icon } from "lucide-react"; import { TResponseVariables } from "@formbricks/types/responses"; import { TSurveyVariables } from "@formbricks/types/surveys/types"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; interface HiddenFieldsProps { variables: TSurveyVariables; diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.test.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.test.tsx index c0817faed9..d404befdfa 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.test.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.test.tsx @@ -1,4 +1,3 @@ -import { isSubmissionTimeMoreThan5Minutes } from "@/modules/analysis/components/SingleResponseCard/util"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; @@ -6,6 +5,7 @@ import { TEnvironment } from "@formbricks/types/environment"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUser } from "@formbricks/types/user"; +import { isSubmissionTimeMoreThan5Minutes } from "@/modules/analysis/components/SingleResponseCard/util"; import { SingleResponseCardHeader } from "./SingleResponseCardHeader"; // Mocks diff --git a/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.tsx b/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.tsx index b773940a23..213687c425 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/components/SingleResponseCardHeader.tsx @@ -1,11 +1,5 @@ "use client"; -import { timeSince } from "@/lib/time"; -import { getContactIdentifier } from "@/lib/utils/contact"; -import { PersonAvatar } from "@/modules/ui/components/avatars"; -import { IdBadge } from "@/modules/ui/components/id-badge"; -import { SurveyStatusIndicator } from "@/modules/ui/components/survey-status-indicator"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { LanguagesIcon, TrashIcon } from "lucide-react"; import Link from "next/link"; @@ -15,6 +9,12 @@ import { TEnvironment } from "@formbricks/types/environment"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { getContactIdentifier } from "@/lib/utils/contact"; +import { PersonAvatar } from "@/modules/ui/components/avatars"; +import { IdBadge } from "@/modules/ui/components/id-badge"; +import { SurveyStatusIndicator } from "@/modules/ui/components/survey-status-indicator"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { isSubmissionTimeMoreThan5Minutes } from "../util"; interface TooltipRendererProps { diff --git a/apps/web/modules/analysis/components/SingleResponseCard/index.tsx b/apps/web/modules/analysis/components/SingleResponseCard/index.tsx index 4fbd352d3b..7bdd15ab54 100644 --- a/apps/web/modules/analysis/components/SingleResponseCard/index.tsx +++ b/apps/web/modules/analysis/components/SingleResponseCard/index.tsx @@ -1,7 +1,5 @@ "use client"; -import { DecrementQuotasCheckbox } from "@/modules/ui/components/decrement-quotas-checkbox"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; import { useState } from "react"; @@ -11,6 +9,8 @@ import { TResponse, TResponseWithQuotas } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { DecrementQuotasCheckbox } from "@/modules/ui/components/decrement-quotas-checkbox"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { deleteResponseAction, getResponseAction } from "./actions"; import { ResponseTagsWrapper } from "./components/ResponseTagsWrapper"; import { SingleResponseCardBody } from "./components/SingleResponseCardBody"; diff --git a/apps/web/modules/api/v2/auth/tests/authenticated-api-client.test.ts b/apps/web/modules/api/v2/auth/tests/authenticated-api-client.test.ts index 900633e62b..c620d7549b 100644 --- a/apps/web/modules/api/v2/auth/tests/authenticated-api-client.test.ts +++ b/apps/web/modules/api/v2/auth/tests/authenticated-api-client.test.ts @@ -1,5 +1,5 @@ -import { logApiRequest } from "@/modules/api/v2/lib/utils"; import { describe, expect, test, vi } from "vitest"; +import { logApiRequest } from "@/modules/api/v2/lib/utils"; import { apiWrapper } from "../api-wrapper"; import { authenticatedApiClient } from "../authenticated-api-client"; diff --git a/apps/web/modules/api/v2/health/lib/openapi.ts b/apps/web/modules/api/v2/health/lib/openapi.ts index a8b82c79ee..86a3183b64 100644 --- a/apps/web/modules/api/v2/health/lib/openapi.ts +++ b/apps/web/modules/api/v2/health/lib/openapi.ts @@ -1,6 +1,6 @@ +import { ZodOpenApiOperationObject } from "zod-openapi"; import { ZOverallHealthStatus } from "@/modules/api/v2/health/types/health-status"; import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; -import { ZodOpenApiOperationObject } from "zod-openapi"; export const healthCheckEndpoint: ZodOpenApiOperationObject = { tags: ["Health"], diff --git a/apps/web/modules/api/v2/lib/question.ts b/apps/web/modules/api/v2/lib/question.ts index 232b2d01a0..f77bbd6bad 100644 --- a/apps/web/modules/api/v2/lib/question.ts +++ b/apps/web/modules/api/v2/lib/question.ts @@ -1,11 +1,11 @@ -import { MAX_OTHER_OPTION_LENGTH } from "@/lib/constants"; -import { getLocalizedValue } from "@/lib/i18n/utils"; import { TResponseData } from "@formbricks/types/responses"; import { TSurveyQuestion, TSurveyQuestionChoice, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { MAX_OTHER_OPTION_LENGTH } from "@/lib/constants"; +import { getLocalizedValue } from "@/lib/i18n/utils"; /** * Helper function to check if a string value is a valid "other" option diff --git a/apps/web/modules/api/v2/lib/tests/question.test.ts b/apps/web/modules/api/v2/lib/tests/question.test.ts index 4f9568cf47..4d26520b94 100644 --- a/apps/web/modules/api/v2/lib/tests/question.test.ts +++ b/apps/web/modules/api/v2/lib/tests/question.test.ts @@ -1,10 +1,10 @@ -import { MAX_OTHER_OPTION_LENGTH } from "@/lib/constants"; import { describe, expect, test, vi } from "vitest"; import { TSurveyQuestion, TSurveyQuestionChoice, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { MAX_OTHER_OPTION_LENGTH } from "@/lib/constants"; import { validateOtherOptionLength, validateOtherOptionLengthForMultipleChoice } from "../question"; vi.mock("@/lib/i18n/utils", () => ({ diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts index f001f8b074..7889abfdeb 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts @@ -1,10 +1,10 @@ -import { TContactAttributeKeyUpdateSchema } from "@/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { ContactAttributeKey, Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { TContactAttributeKeyUpdateSchema } from "@/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; export const getContactAttributeKey = reactCache(async (contactAttributeKeyId: string) => { try { diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/openapi.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/openapi.ts index d4eee3481b..21f81aed99 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/openapi.ts @@ -1,11 +1,11 @@ +import { z } from "zod"; +import { ZodOpenApiOperationObject } from "zod-openapi"; +import { ZContactAttributeKey } from "@formbricks/database/zod/contact-attribute-keys"; import { ZContactAttributeKeyIdSchema, ZContactAttributeKeyUpdateSchema, } from "@/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; -import { z } from "zod"; -import { ZodOpenApiOperationObject } from "zod-openapi"; -import { ZContactAttributeKey } from "@formbricks/database/zod/contact-attribute-keys"; export const getContactAttributeKeyEndpoint: ZodOpenApiOperationObject = { operationId: "getContactAttributeKey", diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/tests/contact-attribute-key.test.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/tests/contact-attribute-key.test.ts index 0b8361dbaf..e29f13e8a6 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/tests/contact-attribute-key.test.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/lib/tests/contact-attribute-key.test.ts @@ -1,8 +1,8 @@ -import { TContactAttributeKeyUpdateSchema } from "@/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { ContactAttributeKey, Prisma } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; +import { TContactAttributeKeyUpdateSchema } from "@/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { deleteContactAttributeKey, getContactAttributeKey, diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts index 6f58345fd8..b9777ffb6c 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts @@ -1,3 +1,5 @@ +import { NextRequest } from "next/server"; +import { z } from "zod"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -12,8 +14,6 @@ import { } from "@/modules/api/v2/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { z } from "zod"; export const GET = async ( request: NextRequest, diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/contact-attribute-key.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/contact-attribute-key.ts index fb09bcb952..9478e2cfbd 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/contact-attribute-key.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/contact-attribute-key.ts @@ -1,14 +1,14 @@ +import { ContactAttributeKey, Prisma } from "@prisma/client"; +import { cache as reactCache } from "react"; +import { prisma } from "@formbricks/database"; +import { PrismaErrorType } from "@formbricks/database/types/error"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { getContactAttributeKeysQuery } from "@/modules/api/v2/management/contact-attribute-keys/lib/utils"; import { TContactAttributeKeyInput, TGetContactAttributeKeysFilter, } from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; -import { ContactAttributeKey, Prisma } from "@prisma/client"; -import { cache as reactCache } from "react"; -import { prisma } from "@formbricks/database"; -import { PrismaErrorType } from "@formbricks/database/types/error"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; export const getContactAttributeKeys = reactCache( async (environmentIds: string[], params: TGetContactAttributeKeysFilter) => { diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/openapi.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/openapi.ts index 760c7d949c..08a957b294 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/openapi.ts @@ -1,3 +1,5 @@ +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { ZContactAttributeKey } from "@formbricks/database/zod/contact-attribute-keys"; import { deleteContactAttributeKeyEndpoint, getContactAttributeKeyEndpoint, @@ -9,8 +11,6 @@ import { } from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { managementServer } from "@/modules/api/v2/management/lib/openapi"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; -import { ZContactAttributeKey } from "@formbricks/database/zod/contact-attribute-keys"; export const getContactAttributeKeysEndpoint: ZodOpenApiOperationObject = { operationId: "getContactAttributeKeys", diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/contact-attribute-key.test.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/contact-attribute-key.test.ts index 455d09afb7..bb2f78d502 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/contact-attribute-key.test.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/contact-attribute-key.test.ts @@ -1,11 +1,11 @@ -import { - TContactAttributeKeyInput, - TGetContactAttributeKeysFilter, -} from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { ContactAttributeKey, Prisma } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; +import { + TContactAttributeKeyInput, + TGetContactAttributeKeysFilter, +} from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { createContactAttributeKey, getContactAttributeKeys } from "../contact-attribute-key"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/utils.test.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/utils.test.ts index 4146b1f677..7f18a72759 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/utils.test.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/tests/utils.test.ts @@ -1,5 +1,5 @@ -import { TGetContactAttributeKeysFilter } from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import { TGetContactAttributeKeysFilter } from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { getContactAttributeKeysQuery } from "../utils"; describe("getContactAttributeKeysQuery", () => { diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/utils.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/utils.ts index 5d4e1881c4..7254499564 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/lib/utils.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/lib/utils.ts @@ -1,6 +1,6 @@ +import { Prisma } from "@prisma/client"; import { TGetContactAttributeKeysFilter } from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; -import { Prisma } from "@prisma/client"; export const getContactAttributeKeysQuery = ( environmentIds: string[], diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/route.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/route.ts index 719cade8c8..4a8e521073 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/route.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/route.ts @@ -1,3 +1,4 @@ +import { NextRequest } from "next/server"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -11,7 +12,6 @@ import { } from "@/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; export const GET = async (request: NextRequest) => authenticatedApiClient({ diff --git a/apps/web/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys.ts b/apps/web/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys.ts index 386d966c53..11976ab45c 100644 --- a/apps/web/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys.ts +++ b/apps/web/modules/api/v2/management/contact-attribute-keys/types/contact-attribute-keys.ts @@ -1,7 +1,7 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { extendZodWithOpenApi } from "zod-openapi"; import { ZContactAttributeKey } from "@formbricks/database/zod/contact-attribute-keys"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; extendZodWithOpenApi(z); diff --git a/apps/web/modules/api/v2/management/lib/helper.ts b/apps/web/modules/api/v2/management/lib/helper.ts index 7b6be72c1d..4a4f261fd2 100644 --- a/apps/web/modules/api/v2/management/lib/helper.ts +++ b/apps/web/modules/api/v2/management/lib/helper.ts @@ -1,9 +1,9 @@ +import { Result, ok } from "@formbricks/types/error-handlers"; import { fetchEnvironmentId, fetchEnvironmentIdFromSurveyIds, } from "@/modules/api/v2/management/lib/services"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; -import { Result, ok } from "@formbricks/types/error-handlers"; export const getEnvironmentId = async ( id: string, diff --git a/apps/web/modules/api/v2/management/lib/tests/helper.test.ts b/apps/web/modules/api/v2/management/lib/tests/helper.test.ts index e2558706b5..1f56d63769 100644 --- a/apps/web/modules/api/v2/management/lib/tests/helper.test.ts +++ b/apps/web/modules/api/v2/management/lib/tests/helper.test.ts @@ -1,8 +1,8 @@ -import { fetchEnvironmentIdFromSurveyIds } from "@/modules/api/v2/management/lib/services"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { createId } from "@paralleldrive/cuid2"; import { describe, expect, test, vi } from "vitest"; import { err, ok } from "@formbricks/types/error-handlers"; +import { fetchEnvironmentIdFromSurveyIds } from "@/modules/api/v2/management/lib/services"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { getEnvironmentId, getEnvironmentIdFromSurveyIds } from "../helper"; import { fetchEnvironmentId } from "../services"; diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/lib/display.ts b/apps/web/modules/api/v2/management/responses/[responseId]/lib/display.ts index 3b3fd92a5a..ea16d30217 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/lib/display.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/lib/display.ts @@ -1,8 +1,8 @@ -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; export const deleteDisplay = async (displayId: string): Promise> => { try { diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/lib/openapi.ts b/apps/web/modules/api/v2/management/responses/[responseId]/lib/openapi.ts index cfe5da2bef..67e0f2d1e6 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/lib/openapi.ts @@ -1,9 +1,9 @@ -import { ZResponseIdSchema } from "@/modules/api/v2/management/responses/[responseId]/types/responses"; -import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; import { z } from "zod"; import { ZodOpenApiOperationObject } from "zod-openapi"; import { ZResponse } from "@formbricks/database/zod/responses"; import { ZResponseInput } from "@formbricks/types/responses"; +import { ZResponseIdSchema } from "@/modules/api/v2/management/responses/[responseId]/types/responses"; +import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; export const getResponseEndpoint: ZodOpenApiOperationObject = { operationId: "getResponse", diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/lib/response.ts b/apps/web/modules/api/v2/management/responses/[responseId]/lib/response.ts index f6cea6e297..6f981e5292 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/lib/response.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/lib/response.ts @@ -1,15 +1,15 @@ -import { deleteDisplay } from "@/modules/api/v2/management/responses/[responseId]/lib/display"; -import { getSurveyQuestions } from "@/modules/api/v2/management/responses/[responseId]/lib/survey"; -import { findAndDeleteUploadedFilesInResponse } from "@/modules/api/v2/management/responses/[responseId]/lib/utils"; -import { ZResponseUpdateSchema } from "@/modules/api/v2/management/responses/[responseId]/types/responses"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { Prisma, Response } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { deleteDisplay } from "@/modules/api/v2/management/responses/[responseId]/lib/display"; +import { getSurveyQuestions } from "@/modules/api/v2/management/responses/[responseId]/lib/survey"; +import { findAndDeleteUploadedFilesInResponse } from "@/modules/api/v2/management/responses/[responseId]/lib/utils"; +import { ZResponseUpdateSchema } from "@/modules/api/v2/management/responses/[responseId]/types/responses"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; export const getResponse = reactCache(async (responseId: string) => { try { diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/response.test.ts b/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/response.test.ts index a009a5cb38..82ad68306d 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/response.test.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/response.test.ts @@ -1,11 +1,11 @@ import { response, responseId, responseInput, survey } from "./__mocks__/response.mock"; -import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ok, okVoid } from "@formbricks/types/error-handlers"; import { TSurveyQuota } from "@formbricks/types/quota"; +import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; import { deleteDisplay } from "../display"; import { deleteResponse, getResponse, updateResponse, updateResponseWithQuotaEvaluation } from "../response"; import { getSurveyQuestions } from "../survey"; diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/utils.test.ts b/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/utils.test.ts index f061b8d423..5d98879a37 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/utils.test.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/lib/tests/utils.test.ts @@ -1,8 +1,8 @@ import { environmentId, fileUploadQuestion, openTextQuestion, responseData } from "./__mocks__/utils.mock"; -import { deleteFile } from "@/modules/storage/service"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { logger } from "@formbricks/logger"; import { okVoid } from "@formbricks/types/error-handlers"; +import { deleteFile } from "@/modules/storage/service"; import { findAndDeleteUploadedFilesInResponse } from "../utils"; vi.mock("@formbricks/logger", () => ({ diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/lib/utils.ts b/apps/web/modules/api/v2/management/responses/[responseId]/lib/utils.ts index 0efeb97719..b5cac7802c 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/lib/utils.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/lib/utils.ts @@ -1,9 +1,9 @@ -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; -import { deleteFile } from "@/modules/storage/service"; import { Response, Survey } from "@prisma/client"; import { logger } from "@formbricks/logger"; import { Result, okVoid } from "@formbricks/types/error-handlers"; import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; +import { deleteFile } from "@/modules/storage/service"; export const findAndDeleteUploadedFilesInResponse = async ( responseData: Response["data"], diff --git a/apps/web/modules/api/v2/management/responses/[responseId]/route.ts b/apps/web/modules/api/v2/management/responses/[responseId]/route.ts index 05c40bc9fc..74c65fbe17 100644 --- a/apps/web/modules/api/v2/management/responses/[responseId]/route.ts +++ b/apps/web/modules/api/v2/management/responses/[responseId]/route.ts @@ -1,3 +1,4 @@ +import { z } from "zod"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { validateOtherOptionLengthForMultipleChoice } from "@/modules/api/v2/lib/question"; import { responses } from "@/modules/api/v2/lib/response"; @@ -12,7 +13,6 @@ import { getSurveyQuestions } from "@/modules/api/v2/management/responses/[respo import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; import { validateFileUploads } from "@/modules/storage/utils"; -import { z } from "zod"; import { ZResponseIdSchema, ZResponseUpdateSchema } from "./types/responses"; export const GET = async (request: Request, props: { params: Promise<{ responseId: string }> }) => diff --git a/apps/web/modules/api/v2/management/responses/lib/openapi.ts b/apps/web/modules/api/v2/management/responses/lib/openapi.ts index b99eafae66..5f81e99642 100644 --- a/apps/web/modules/api/v2/management/responses/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/responses/lib/openapi.ts @@ -1,3 +1,5 @@ +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { ZResponse } from "@formbricks/database/zod/responses"; import { managementServer } from "@/modules/api/v2/management/lib/openapi"; import { deleteResponseEndpoint, @@ -6,8 +8,6 @@ import { } from "@/modules/api/v2/management/responses/[responseId]/lib/openapi"; import { ZGetResponsesFilter, ZResponseInput } from "@/modules/api/v2/management/responses/types/responses"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; -import { ZResponse } from "@formbricks/database/zod/responses"; export const getResponsesEndpoint: ZodOpenApiOperationObject = { operationId: "getResponses", diff --git a/apps/web/modules/api/v2/management/responses/lib/organization.ts b/apps/web/modules/api/v2/management/responses/lib/organization.ts index cb15fc497a..bf9564c57a 100644 --- a/apps/web/modules/api/v2/management/responses/lib/organization.ts +++ b/apps/web/modules/api/v2/management/responses/lib/organization.ts @@ -1,7 +1,7 @@ -import { getBillingPeriodStartDate } from "@/lib/utils/billing"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { err, ok } from "@formbricks/types/error-handlers"; +import { getBillingPeriodStartDate } from "@/lib/utils/billing"; export const getOrganizationIdFromEnvironmentId = reactCache(async (environmentId: string) => { try { diff --git a/apps/web/modules/api/v2/management/responses/lib/response.ts b/apps/web/modules/api/v2/management/responses/lib/response.ts index bc5af9eeab..f8b242c98f 100644 --- a/apps/web/modules/api/v2/management/responses/lib/response.ts +++ b/apps/web/modules/api/v2/management/responses/lib/response.ts @@ -1,4 +1,8 @@ import "server-only"; +import { Prisma, Response } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { sendPlanLimitsReachedEventToPosthogWeekly } from "@/lib/posthogServer"; import { calculateTtcTotal } from "@/lib/response/utils"; @@ -13,10 +17,6 @@ import { TGetResponsesFilter, TResponseInput } from "@/modules/api/v2/management import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { ApiResponseWithMeta } from "@/modules/api/v2/types/api-success"; import { evaluateResponseQuotas } from "@/modules/ee/quotas/lib/evaluation-service"; -import { Prisma, Response } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; export const getResponses = async ( environmentIds: string[], diff --git a/apps/web/modules/api/v2/management/responses/lib/tests/__mocks__/response.mock.ts b/apps/web/modules/api/v2/management/responses/lib/tests/__mocks__/response.mock.ts index 8f502d87db..0812439b6a 100644 --- a/apps/web/modules/api/v2/management/responses/lib/tests/__mocks__/response.mock.ts +++ b/apps/web/modules/api/v2/management/responses/lib/tests/__mocks__/response.mock.ts @@ -1,5 +1,5 @@ -import { TGetResponsesFilter } from "@/modules/api/v2/management/responses/types/responses"; import { Organization, Response } from "@prisma/client"; +import { TGetResponsesFilter } from "@/modules/api/v2/management/responses/types/responses"; export const responseInput: Omit = { surveyId: "lygo31gfsexlr4lh6rq8dxyl", diff --git a/apps/web/modules/api/v2/management/responses/lib/tests/organization.test.ts b/apps/web/modules/api/v2/management/responses/lib/tests/organization.test.ts index d908a5d1b4..12e778aac8 100644 --- a/apps/web/modules/api/v2/management/responses/lib/tests/organization.test.ts +++ b/apps/web/modules/api/v2/management/responses/lib/tests/organization.test.ts @@ -5,14 +5,14 @@ import { organizationEnvironments, organizationId, } from "./__mocks__/organization.mock"; +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { prisma } from "@formbricks/database"; import { getAllEnvironmentsFromOrganizationId, getMonthlyOrganizationResponseCount, getOrganizationBilling, getOrganizationIdFromEnvironmentId, } from "@/modules/api/v2/management/responses/lib/organization"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { prisma } from "@formbricks/database"; vi.mock("@formbricks/database", () => ({ prisma: { diff --git a/apps/web/modules/api/v2/management/responses/lib/tests/response.test.ts b/apps/web/modules/api/v2/management/responses/lib/tests/response.test.ts index 65e981e60f..4aa6fdb052 100644 --- a/apps/web/modules/api/v2/management/responses/lib/tests/response.test.ts +++ b/apps/web/modules/api/v2/management/responses/lib/tests/response.test.ts @@ -9,15 +9,15 @@ import { responseInputWithoutDisplay, responseInputWithoutTtc, } from "./__mocks__/response.mock"; +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { prisma } from "@formbricks/database"; +import { err, ok } from "@formbricks/types/error-handlers"; import { sendPlanLimitsReachedEventToPosthogWeekly } from "@/lib/posthogServer"; import { getMonthlyOrganizationResponseCount, getOrganizationBilling, getOrganizationIdFromEnvironmentId, } from "@/modules/api/v2/management/responses/lib/organization"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { prisma } from "@formbricks/database"; -import { err, ok } from "@formbricks/types/error-handlers"; import { createResponse, getResponses } from "../response"; vi.mock("@/lib/posthogServer", () => ({ diff --git a/apps/web/modules/api/v2/management/responses/lib/tests/utils.test.ts b/apps/web/modules/api/v2/management/responses/lib/tests/utils.test.ts index 4c4331b6a2..fea6201e81 100644 --- a/apps/web/modules/api/v2/management/responses/lib/tests/utils.test.ts +++ b/apps/web/modules/api/v2/management/responses/lib/tests/utils.test.ts @@ -1,7 +1,7 @@ -import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; -import { TGetResponsesFilter } from "@/modules/api/v2/management/responses/types/responses"; import { Prisma } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; +import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; +import { TGetResponsesFilter } from "@/modules/api/v2/management/responses/types/responses"; import { getResponsesQuery } from "../utils"; vi.mock("@/modules/api/v2/management/lib/utils", () => ({ diff --git a/apps/web/modules/api/v2/management/responses/lib/utils.ts b/apps/web/modules/api/v2/management/responses/lib/utils.ts index b1d2df134d..6285a9727e 100644 --- a/apps/web/modules/api/v2/management/responses/lib/utils.ts +++ b/apps/web/modules/api/v2/management/responses/lib/utils.ts @@ -1,6 +1,6 @@ +import { Prisma } from "@prisma/client"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { TGetResponsesFilter } from "@/modules/api/v2/management/responses/types/responses"; -import { Prisma } from "@prisma/client"; export const getResponsesQuery = (environmentIds: string[], params?: TGetResponsesFilter) => { let query: Prisma.ResponseFindManyArgs = { diff --git a/apps/web/modules/api/v2/management/responses/route.ts b/apps/web/modules/api/v2/management/responses/route.ts index 04b0c7d0eb..25af9b3d26 100644 --- a/apps/web/modules/api/v2/management/responses/route.ts +++ b/apps/web/modules/api/v2/management/responses/route.ts @@ -1,3 +1,5 @@ +import { Response } from "@prisma/client"; +import { NextRequest } from "next/server"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { validateOtherOptionLengthForMultipleChoice } from "@/modules/api/v2/lib/question"; import { responses } from "@/modules/api/v2/lib/response"; @@ -8,8 +10,6 @@ import { ZGetResponsesFilter, ZResponseInput } from "@/modules/api/v2/management import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; import { validateFileUploads } from "@/modules/storage/utils"; -import { Response } from "@prisma/client"; -import { NextRequest } from "next/server"; import { createResponseWithQuotaEvaluation, getResponses } from "./lib/response"; export const GET = async (request: NextRequest) => diff --git a/apps/web/modules/api/v2/management/responses/types/responses.ts b/apps/web/modules/api/v2/management/responses/types/responses.ts index 96a1655929..80897e11c0 100644 --- a/apps/web/modules/api/v2/management/responses/types/responses.ts +++ b/apps/web/modules/api/v2/management/responses/types/responses.ts @@ -1,6 +1,6 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { ZResponse } from "@formbricks/database/zod/responses"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; export const ZGetResponsesFilter = ZGetFilter.extend({ surveyId: z.string().cuid2().optional(), diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact.ts index 034f2276d3..a17ee8b5ba 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact.ts @@ -1,12 +1,12 @@ +import { cache as reactCache } from "react"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { err, ok } from "@formbricks/types/error-handlers"; import { getContactAttributeKeys } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact-attribute-key"; import { getSegment } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/segment"; import { getSurvey } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/surveys"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { segmentFilterToPrismaQuery } from "@/modules/ee/contacts/segments/lib/filter/prisma-query"; -import { cache as reactCache } from "react"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { err, ok } from "@formbricks/types/error-handlers"; export const getContactsInSegment = reactCache( async (surveyId: string, segmentId: string, limit: number, skip: number, attributeKeys?: string) => { diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/openapi.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/openapi.ts index 6ef2540bd8..c1c4201327 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/openapi.ts @@ -1,10 +1,10 @@ +import { ZodOpenApiOperationObject } from "zod-openapi"; import { ZContactLinkResponse, ZContactLinksBySegmentParams, ZContactLinksBySegmentQuery, } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/types/contact"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { ZodOpenApiOperationObject } from "zod-openapi"; export const getContactLinksBySegmentEndpoint: ZodOpenApiOperationObject = { operationId: "getContactLinksBySegment", diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact-attribute-key.test.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact-attribute-key.test.ts index d681c33543..93609177f7 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact-attribute-key.test.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact-attribute-key.test.ts @@ -1,6 +1,6 @@ -import { getContactAttributeKeys } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact-attribute-key"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { getContactAttributeKeys } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/contact-attribute-key"; // Mock dependencies vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact.test.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact.test.ts index aaa19896b4..9401d28897 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact.test.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/tests/contact.test.ts @@ -1,8 +1,8 @@ -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { SurveyStatus, SurveyType } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import type { TBaseFilters } from "@formbricks/types/segment"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { getContactsInSegment } from "../contact"; import { getSegment } from "../segment"; import { getSurvey } from "../surveys"; diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/types/contact.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/types/contact.ts index eb6186c782..4094ba1681 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/types/contact.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/types/contact.ts @@ -1,6 +1,6 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { extendZodWithOpenApi } from "zod-openapi"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; extendZodWithOpenApi(z); diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/lib/openapi.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/lib/openapi.ts index 832a6dc58f..27572c0e4e 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/lib/openapi.ts @@ -1,6 +1,6 @@ +import { ZodOpenApiPathsObject } from "zod-openapi"; import { managementServer } from "@/modules/api/v2/management/lib/openapi"; import { getContactLinksBySegmentEndpoint } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/[segmentId]/lib/openapi"; -import { ZodOpenApiPathsObject } from "zod-openapi"; export const surveyContactLinksBySegmentPaths: ZodOpenApiPathsObject = { "/surveys/{surveyId}/contact-links/segments/{segmentId}": { diff --git a/apps/web/modules/api/v2/management/surveys/[surveyId]/lib/openapi.ts b/apps/web/modules/api/v2/management/surveys/[surveyId]/lib/openapi.ts index f218a40725..55e9e82fdf 100644 --- a/apps/web/modules/api/v2/management/surveys/[surveyId]/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/surveys/[surveyId]/lib/openapi.ts @@ -1,8 +1,8 @@ -import { surveyIdSchema } from "@/modules/api/v2/management/surveys/[surveyId]/types/survey"; -import { ZSurveyInput } from "@/modules/api/v2/management/surveys/types/surveys"; import { z } from "zod"; import { ZodOpenApiOperationObject } from "zod-openapi"; import { ZSurveyWithoutQuestionType } from "@formbricks/database/zod/surveys"; +import { surveyIdSchema } from "@/modules/api/v2/management/surveys/[surveyId]/types/survey"; +import { ZSurveyInput } from "@/modules/api/v2/management/surveys/types/surveys"; export const getSurveyEndpoint: ZodOpenApiOperationObject = { operationId: "getSurvey", diff --git a/apps/web/modules/api/v2/management/surveys/lib/openapi.ts b/apps/web/modules/api/v2/management/surveys/lib/openapi.ts index 5239f3d981..558a7b4024 100644 --- a/apps/web/modules/api/v2/management/surveys/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/surveys/lib/openapi.ts @@ -1,9 +1,9 @@ -import { managementServer } from "@/modules/api/v2/management/lib/openapi"; -import { getPersonalizedSurveyLink } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/contacts/[contactId]/lib/openapi"; -import { ZGetSurveysFilter, ZSurveyInput } from "@/modules/api/v2/management/surveys/types/surveys"; import { z } from "zod"; import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; import { ZSurveyWithoutQuestionType } from "@formbricks/database/zod/surveys"; +import { managementServer } from "@/modules/api/v2/management/lib/openapi"; +import { getPersonalizedSurveyLink } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/contacts/[contactId]/lib/openapi"; +import { ZGetSurveysFilter, ZSurveyInput } from "@/modules/api/v2/management/surveys/types/surveys"; export const getSurveysEndpoint: ZodOpenApiOperationObject = { operationId: "getSurveys", diff --git a/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/openapi.ts b/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/openapi.ts index 2790d0b8c7..724352aeb0 100644 --- a/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/openapi.ts @@ -1,9 +1,9 @@ -import { ZWebhookIdSchema } from "@/modules/api/v2/management/webhooks/[webhookId]/types/webhooks"; -import { ZWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; -import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; import { z } from "zod"; import { ZodOpenApiOperationObject } from "zod-openapi"; import { ZWebhook } from "@formbricks/database/zod/webhooks"; +import { ZWebhookIdSchema } from "@/modules/api/v2/management/webhooks/[webhookId]/types/webhooks"; +import { ZWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; +import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; export const getWebhookEndpoint: ZodOpenApiOperationObject = { operationId: "getWebhook", diff --git a/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/tests/webhook.test.ts b/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/tests/webhook.test.ts index 851e196ec4..bca20af319 100644 --- a/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/tests/webhook.test.ts +++ b/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/tests/webhook.test.ts @@ -1,11 +1,11 @@ +import { describe, expect, test, vi } from "vitest"; +import { z } from "zod"; +import { prisma } from "@formbricks/database"; import { mockedPrismaWebhookUpdateReturn, prismaNotFoundError, } from "@/modules/api/v2/management/webhooks/[webhookId]/lib/tests/mocks/webhook.mock"; import { ZWebhookUpdateSchema } from "@/modules/api/v2/management/webhooks/[webhookId]/types/webhooks"; -import { describe, expect, test, vi } from "vitest"; -import { z } from "zod"; -import { prisma } from "@formbricks/database"; import { deleteWebhook, getWebhook, updateWebhook } from "../webhook"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/webhook.ts b/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/webhook.ts index 7201315c9c..438cd50810 100644 --- a/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/webhook.ts +++ b/apps/web/modules/api/v2/management/webhooks/[webhookId]/lib/webhook.ts @@ -1,10 +1,10 @@ -import { ZWebhookUpdateSchema } from "@/modules/api/v2/management/webhooks/[webhookId]/types/webhooks"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { Prisma, Webhook } from "@prisma/client"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { ZWebhookUpdateSchema } from "@/modules/api/v2/management/webhooks/[webhookId]/types/webhooks"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; export const getWebhook = async (webhookId: string) => { try { diff --git a/apps/web/modules/api/v2/management/webhooks/[webhookId]/route.ts b/apps/web/modules/api/v2/management/webhooks/[webhookId]/route.ts index dbf7ee5a6f..d29b991cf9 100644 --- a/apps/web/modules/api/v2/management/webhooks/[webhookId]/route.ts +++ b/apps/web/modules/api/v2/management/webhooks/[webhookId]/route.ts @@ -1,3 +1,5 @@ +import { NextRequest } from "next/server"; +import { z } from "zod"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -13,8 +15,6 @@ import { } from "@/modules/api/v2/management/webhooks/[webhookId]/types/webhooks"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { z } from "zod"; export const GET = async (request: NextRequest, props: { params: Promise<{ webhookId: string }> }) => authenticatedApiClient({ diff --git a/apps/web/modules/api/v2/management/webhooks/lib/openapi.ts b/apps/web/modules/api/v2/management/webhooks/lib/openapi.ts index 8d78d56472..3929062538 100644 --- a/apps/web/modules/api/v2/management/webhooks/lib/openapi.ts +++ b/apps/web/modules/api/v2/management/webhooks/lib/openapi.ts @@ -1,3 +1,5 @@ +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { ZWebhook } from "@formbricks/database/zod/webhooks"; import { managementServer } from "@/modules/api/v2/management/lib/openapi"; import { deleteWebhookEndpoint, @@ -6,8 +8,6 @@ import { } from "@/modules/api/v2/management/webhooks/[webhookId]/lib/openapi"; import { ZGetWebhooksFilter, ZWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; -import { ZWebhook } from "@formbricks/database/zod/webhooks"; export const getWebhooksEndpoint: ZodOpenApiOperationObject = { operationId: "getWebhooks", diff --git a/apps/web/modules/api/v2/management/webhooks/lib/tests/utils.test.ts b/apps/web/modules/api/v2/management/webhooks/lib/tests/utils.test.ts index c95bede10a..316954bdcf 100644 --- a/apps/web/modules/api/v2/management/webhooks/lib/tests/utils.test.ts +++ b/apps/web/modules/api/v2/management/webhooks/lib/tests/utils.test.ts @@ -1,6 +1,6 @@ +import { describe, expect, test, vi } from "vitest"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { TGetWebhooksFilter } from "@/modules/api/v2/management/webhooks/types/webhooks"; -import { describe, expect, test, vi } from "vitest"; import { getWebhooksQuery } from "../utils"; vi.mock("@/modules/api/v2/management/lib/utils", () => ({ diff --git a/apps/web/modules/api/v2/management/webhooks/lib/tests/webhook.test.ts b/apps/web/modules/api/v2/management/webhooks/lib/tests/webhook.test.ts index 6ee7c6c460..2ba67a31a0 100644 --- a/apps/web/modules/api/v2/management/webhooks/lib/tests/webhook.test.ts +++ b/apps/web/modules/api/v2/management/webhooks/lib/tests/webhook.test.ts @@ -1,8 +1,8 @@ -import { captureTelemetry } from "@/lib/telemetry"; -import { TGetWebhooksFilter, TWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; import { WebhookSource } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { captureTelemetry } from "@/lib/telemetry"; +import { TGetWebhooksFilter, TWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; import { createWebhook, getWebhooks } from "../webhook"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/api/v2/management/webhooks/lib/utils.ts b/apps/web/modules/api/v2/management/webhooks/lib/utils.ts index aac2e20fa6..4d23b4ec77 100644 --- a/apps/web/modules/api/v2/management/webhooks/lib/utils.ts +++ b/apps/web/modules/api/v2/management/webhooks/lib/utils.ts @@ -1,6 +1,6 @@ +import { Prisma } from "@prisma/client"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { TGetWebhooksFilter } from "@/modules/api/v2/management/webhooks/types/webhooks"; -import { Prisma } from "@prisma/client"; export const getWebhooksQuery = (environmentIds: string[], params?: TGetWebhooksFilter) => { let query: Prisma.WebhookFindManyArgs = { diff --git a/apps/web/modules/api/v2/management/webhooks/lib/webhook.ts b/apps/web/modules/api/v2/management/webhooks/lib/webhook.ts index 9189eace74..d0fc369fc8 100644 --- a/apps/web/modules/api/v2/management/webhooks/lib/webhook.ts +++ b/apps/web/modules/api/v2/management/webhooks/lib/webhook.ts @@ -1,11 +1,11 @@ +import { Prisma, Webhook } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { captureTelemetry } from "@/lib/telemetry"; import { getWebhooksQuery } from "@/modules/api/v2/management/webhooks/lib/utils"; import { TGetWebhooksFilter, TWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { ApiResponseWithMeta } from "@/modules/api/v2/types/api-success"; -import { Prisma, Webhook } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; export const getWebhooks = async ( environmentIds: string[], diff --git a/apps/web/modules/api/v2/management/webhooks/route.ts b/apps/web/modules/api/v2/management/webhooks/route.ts index ff00ad30ce..9da53017d9 100644 --- a/apps/web/modules/api/v2/management/webhooks/route.ts +++ b/apps/web/modules/api/v2/management/webhooks/route.ts @@ -1,3 +1,4 @@ +import { NextRequest } from "next/server"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -5,7 +6,6 @@ import { getEnvironmentIdFromSurveyIds } from "@/modules/api/v2/management/lib/h import { createWebhook, getWebhooks } from "@/modules/api/v2/management/webhooks/lib/webhook"; import { ZGetWebhooksFilter, ZWebhookInput } from "@/modules/api/v2/management/webhooks/types/webhooks"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; export const GET = async (request: NextRequest) => authenticatedApiClient({ diff --git a/apps/web/modules/api/v2/management/webhooks/types/webhooks.ts b/apps/web/modules/api/v2/management/webhooks/types/webhooks.ts index e049c92413..f441fbf25d 100644 --- a/apps/web/modules/api/v2/management/webhooks/types/webhooks.ts +++ b/apps/web/modules/api/v2/management/webhooks/types/webhooks.ts @@ -1,6 +1,6 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { ZWebhook } from "@formbricks/database/zod/webhooks"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; export const ZGetWebhooksFilter = ZGetFilter.extend({ surveyIds: z.array(z.string().cuid2()).optional(), diff --git a/apps/web/modules/api/v2/me/lib/openapi.ts b/apps/web/modules/api/v2/me/lib/openapi.ts index f562cdbe97..d782f6bbf6 100644 --- a/apps/web/modules/api/v2/me/lib/openapi.ts +++ b/apps/web/modules/api/v2/me/lib/openapi.ts @@ -1,6 +1,6 @@ -import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; import { ZApiKeyData } from "@formbricks/database/zod/api-keys"; +import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; export const getMeEndpoint: ZodOpenApiOperationObject = { operationId: "me", diff --git a/apps/web/modules/api/v2/me/route.ts b/apps/web/modules/api/v2/me/route.ts index ed6a124c84..ad8b39601e 100644 --- a/apps/web/modules/api/v2/me/route.ts +++ b/apps/web/modules/api/v2/me/route.ts @@ -1,9 +1,9 @@ +import { NextRequest } from "next/server"; +import { OrganizationAccessType } from "@formbricks/types/api-key"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; import { hasOrganizationAccess } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { OrganizationAccessType } from "@formbricks/types/api-key"; export const GET = async (request: NextRequest) => authenticatedApiClient({ diff --git a/apps/web/modules/api/v2/openapi-document.ts b/apps/web/modules/api/v2/openapi-document.ts index c08124d3a1..464aff67f0 100644 --- a/apps/web/modules/api/v2/openapi-document.ts +++ b/apps/web/modules/api/v2/openapi-document.ts @@ -1,17 +1,3 @@ -import { healthPaths } from "@/modules/api/v2/health/lib/openapi"; -import { ZOverallHealthStatus } from "@/modules/api/v2/health/types/health-status"; -import { contactAttributeKeyPaths } from "@/modules/api/v2/management/contact-attribute-keys/lib/openapi"; -import { responsePaths } from "@/modules/api/v2/management/responses/lib/openapi"; -import { surveyContactLinksBySegmentPaths } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/lib/openapi"; -import { surveyPaths } from "@/modules/api/v2/management/surveys/lib/openapi"; -import { webhookPaths } from "@/modules/api/v2/management/webhooks/lib/openapi"; -import { mePaths } from "@/modules/api/v2/me/lib/openapi"; -import { projectTeamPaths } from "@/modules/api/v2/organizations/[organizationId]/project-teams/lib/openapi"; -import { teamPaths } from "@/modules/api/v2/organizations/[organizationId]/teams/lib/openapi"; -import { userPaths } from "@/modules/api/v2/organizations/[organizationId]/users/lib/openapi"; -import { rolePaths } from "@/modules/api/v2/roles/lib/openapi"; -import { bulkContactPaths } from "@/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi"; -import { contactPaths } from "@/modules/ee/contacts/api/v2/management/contacts/lib/openapi"; import * as yaml from "yaml"; import { z } from "zod"; import { createDocument, extendZodWithOpenApi } from "zod-openapi"; @@ -26,6 +12,20 @@ import { ZSurveyWithoutQuestionType } from "@formbricks/database/zod/surveys"; import { ZTeam } from "@formbricks/database/zod/teams"; import { ZUser } from "@formbricks/database/zod/users"; import { ZWebhook } from "@formbricks/database/zod/webhooks"; +import { healthPaths } from "@/modules/api/v2/health/lib/openapi"; +import { ZOverallHealthStatus } from "@/modules/api/v2/health/types/health-status"; +import { contactAttributeKeyPaths } from "@/modules/api/v2/management/contact-attribute-keys/lib/openapi"; +import { responsePaths } from "@/modules/api/v2/management/responses/lib/openapi"; +import { surveyContactLinksBySegmentPaths } from "@/modules/api/v2/management/surveys/[surveyId]/contact-links/segments/lib/openapi"; +import { surveyPaths } from "@/modules/api/v2/management/surveys/lib/openapi"; +import { webhookPaths } from "@/modules/api/v2/management/webhooks/lib/openapi"; +import { mePaths } from "@/modules/api/v2/me/lib/openapi"; +import { projectTeamPaths } from "@/modules/api/v2/organizations/[organizationId]/project-teams/lib/openapi"; +import { teamPaths } from "@/modules/api/v2/organizations/[organizationId]/teams/lib/openapi"; +import { userPaths } from "@/modules/api/v2/organizations/[organizationId]/users/lib/openapi"; +import { rolePaths } from "@/modules/api/v2/roles/lib/openapi"; +import { bulkContactPaths } from "@/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi"; +import { contactPaths } from "@/modules/ee/contacts/api/v2/management/contacts/lib/openapi"; extendZodWithOpenApi(z); diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/lib/utils.ts b/apps/web/modules/api/v2/organizations/[organizationId]/lib/utils.ts index fa8d52b86b..6807ca1fc1 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/lib/utils.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/lib/utils.ts @@ -1,7 +1,7 @@ -import { hasOrganizationAccess } from "@/modules/organization/settings/api-keys/lib/utils"; import { logger } from "@formbricks/logger"; import { OrganizationAccessType } from "@formbricks/types/api-key"; import { TAuthenticationApiKey } from "@formbricks/types/auth"; +import { hasOrganizationAccess } from "@/modules/organization/settings/api-keys/lib/utils"; export const hasOrganizationIdAndAccess = ( paramOrganizationId: string, diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/openapi.ts b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/openapi.ts index 910f701e17..f242ebde7e 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/openapi.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/openapi.ts @@ -1,3 +1,6 @@ +import { z } from "zod"; +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { ZProjectTeam } from "@formbricks/database/zod/project-teams"; import { ZGetProjectTeamUpdateFilter, ZGetProjectTeamsFilter, @@ -6,9 +9,6 @@ import { import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; import { organizationServer } from "@/modules/api/v2/organizations/lib/openapi"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { z } from "zod"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; -import { ZProjectTeam } from "@formbricks/database/zod/project-teams"; export const getProjectTeamsEndpoint: ZodOpenApiOperationObject = { operationId: "getProjectTeams", diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/project-teams.ts b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/project-teams.ts index aab6679591..26d081280f 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/project-teams.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/project-teams.ts @@ -1,3 +1,7 @@ +import { ProjectTeam } from "@prisma/client"; +import { z } from "zod"; +import { prisma } from "@formbricks/database"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { captureTelemetry } from "@/lib/telemetry"; import { getProjectTeamsQuery } from "@/modules/api/v2/organizations/[organizationId]/project-teams/lib/utils"; import { @@ -7,10 +11,6 @@ import { } from "@/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { ApiResponseWithMeta } from "@/modules/api/v2/types/api-success"; -import { ProjectTeam } from "@prisma/client"; -import { z } from "zod"; -import { prisma } from "@formbricks/database"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; export const getProjectTeams = async ( organizationId: string, diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/tests/project-teams.test.ts b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/tests/project-teams.test.ts index e5ba8ae9a8..894cbe8f68 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/tests/project-teams.test.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/tests/project-teams.test.ts @@ -1,11 +1,11 @@ +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { TypeOf } from "zod"; +import { prisma } from "@formbricks/database"; import { TGetProjectTeamsFilter, TProjectTeamInput, ZProjectZTeamUpdateSchema, } from "@/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { TypeOf } from "zod"; -import { prisma } from "@formbricks/database"; import { createProjectTeam, deleteProjectTeam, getProjectTeams, updateProjectTeam } from "../project-teams"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/utils.ts b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/utils.ts index 2186565b07..9fca0b61bc 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/utils.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/lib/utils.ts @@ -1,11 +1,11 @@ -import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; -import { TGetProjectTeamsFilter } from "@/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { TAuthenticationApiKey } from "@formbricks/types/auth"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; +import { TGetProjectTeamsFilter } from "@/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; export const getProjectTeamsQuery = (organizationId: string, params: TGetProjectTeamsFilter) => { const { teamId, projectId } = params || {}; diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/route.ts b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/route.ts index 6bc9b2d6d7..a370e5641e 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/route.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/route.ts @@ -1,3 +1,6 @@ +import { z } from "zod"; +import { logger } from "@formbricks/logger"; +import { OrganizationAccessType } from "@formbricks/types/api-key"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -5,9 +8,6 @@ import { hasOrganizationIdAndAccess } from "@/modules/api/v2/organizations/[orga import { checkAuthenticationAndAccess } from "@/modules/api/v2/organizations/[organizationId]/project-teams/lib/utils"; import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; import { UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; -import { z } from "zod"; -import { logger } from "@formbricks/logger"; -import { OrganizationAccessType } from "@formbricks/types/api-key"; import { createProjectTeam, deleteProjectTeam, diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams.ts b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams.ts index d852852bd7..78ab7c9fa4 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/project-teams/types/project-teams.ts @@ -1,6 +1,6 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { ZProjectTeam } from "@formbricks/database/zod/project-teams"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; export const ZGetProjectTeamsFilter = ZGetFilter.extend({ teamId: z.string().cuid2().optional(), diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/openapi.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/openapi.ts index 8460a33702..5ed037dfb6 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/openapi.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/openapi.ts @@ -1,10 +1,10 @@ +import { z } from "zod"; +import { ZodOpenApiOperationObject } from "zod-openapi"; +import { ZTeam } from "@formbricks/database/zod/teams"; import { ZTeamIdSchema } from "@/modules/api/v2/organizations/[organizationId]/teams/[teamId]/types/teams"; import { ZTeamInput } from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams"; import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; -import { z } from "zod"; -import { ZodOpenApiOperationObject } from "zod-openapi"; -import { ZTeam } from "@formbricks/database/zod/teams"; export const getTeamEndpoint: ZodOpenApiOperationObject = { operationId: "getTeam", diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/teams.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/teams.ts index f10e564c21..58260b7db1 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/teams.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/lib/teams.ts @@ -1,11 +1,11 @@ -import { ZTeamUpdateSchema } from "@/modules/api/v2/organizations/[organizationId]/teams/[teamId]/types/teams"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { Prisma, Team } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { ZTeamUpdateSchema } from "@/modules/api/v2/organizations/[organizationId]/teams/[teamId]/types/teams"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; export const getTeam = reactCache(async (organizationId: string, teamId: string) => { try { diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/route.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/route.ts index 192dda1a85..6f02e8c8ad 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/route.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/[teamId]/route.ts @@ -1,3 +1,6 @@ +import { z } from "zod"; +import { logger } from "@formbricks/logger"; +import { OrganizationAccessType } from "@formbricks/types/api-key"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -14,9 +17,6 @@ import { import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; -import { z } from "zod"; -import { logger } from "@formbricks/logger"; -import { OrganizationAccessType } from "@formbricks/types/api-key"; export const GET = async ( request: Request, diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/openapi.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/openapi.ts index da641c289c..40077b4876 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/openapi.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/openapi.ts @@ -1,3 +1,6 @@ +import { z } from "zod"; +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { ZTeam } from "@formbricks/database/zod/teams"; import { deleteTeamEndpoint, getTeamEndpoint, @@ -10,9 +13,6 @@ import { import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; import { organizationServer } from "@/modules/api/v2/organizations/lib/openapi"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { z } from "zod"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; -import { ZTeam } from "@formbricks/database/zod/teams"; export const getTeamsEndpoint: ZodOpenApiOperationObject = { operationId: "getTeams", diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/teams.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/teams.ts index 5c0d50da28..3f6fb32020 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/teams.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/teams.ts @@ -1,4 +1,7 @@ import "server-only"; +import { Team } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { captureTelemetry } from "@/lib/telemetry"; import { getTeamsQuery } from "@/modules/api/v2/organizations/[organizationId]/teams/lib/utils"; import { @@ -7,9 +10,6 @@ import { } from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { ApiResponseWithMeta } from "@/modules/api/v2/types/api-success"; -import { Team } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; export const createTeam = async ( teamInput: TTeamInput, diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/teams.test.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/teams.test.ts index 9a27b6a510..d0388a3000 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/teams.test.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/teams.test.ts @@ -1,6 +1,6 @@ -import { TGetTeamsFilter } from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { TGetTeamsFilter } from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams"; import { createTeam, getTeams } from "../teams"; // Define a mock team object diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/utils.test.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/utils.test.ts index 126b43d5f8..b38ccfd6f0 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/utils.test.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/tests/utils.test.ts @@ -1,6 +1,6 @@ -import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { Prisma } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; +import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { getTeamsQuery } from "../utils"; // Mock the common utils functions diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/utils.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/utils.ts index 1e05db0401..b89b5f3813 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/utils.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/lib/utils.ts @@ -1,6 +1,6 @@ +import { Prisma } from "@prisma/client"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { TGetTeamsFilter } from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams"; -import { Prisma } from "@prisma/client"; export const getTeamsQuery = (organizationId: string, params?: TGetTeamsFilter) => { let query: Prisma.TeamFindManyArgs = { diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/route.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/route.ts index 9bd39877cc..3dd0cc3d71 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/route.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/route.ts @@ -1,3 +1,6 @@ +import { NextRequest } from "next/server"; +import { z } from "zod"; +import { OrganizationAccessType } from "@formbricks/types/api-key"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -8,9 +11,6 @@ import { ZTeamInput, } from "@/modules/api/v2/organizations/[organizationId]/teams/types/teams"; import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; -import { NextRequest } from "next/server"; -import { z } from "zod"; -import { OrganizationAccessType } from "@formbricks/types/api-key"; export const GET = async (request: NextRequest, props: { params: Promise<{ organizationId: string }> }) => authenticatedApiClient({ diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/teams/types/teams.ts b/apps/web/modules/api/v2/organizations/[organizationId]/teams/types/teams.ts index 60810b497d..879331f5d1 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/teams/types/teams.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/teams/types/teams.ts @@ -1,6 +1,6 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { ZTeam } from "@formbricks/database/zod/teams"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; export const ZGetTeamsFilter = ZGetFilter.refine( (data) => { diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/openapi.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/openapi.ts index 966f1e4440..2d8028e776 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/openapi.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/openapi.ts @@ -1,3 +1,6 @@ +import { z } from "zod"; +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { ZUser } from "@formbricks/database/zod/users"; import { ZOrganizationIdSchema } from "@/modules/api/v2/organizations/[organizationId]/types/organizations"; import { ZGetUsersFilter, @@ -6,9 +9,6 @@ import { } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; import { organizationServer } from "@/modules/api/v2/organizations/lib/openapi"; import { makePartialSchema, responseWithMetaSchema } from "@/modules/api/v2/types/openapi-response"; -import { z } from "zod"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; -import { ZUser } from "@formbricks/database/zod/users"; export const getUsersEndpoint: ZodOpenApiOperationObject = { operationId: "getUsers", diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/users.test.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/users.test.ts index 186f132a81..dabf55e1cc 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/users.test.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/users.test.ts @@ -1,6 +1,6 @@ -import { TGetUsersFilter } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; import { describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { TGetUsersFilter } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; import { createUser, getUsers, updateUser } from "../users"; const mockUser = { diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/utils.test.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/utils.test.ts index df626d9b9c..cbe15b97b8 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/utils.test.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/tests/utils.test.ts @@ -1,6 +1,6 @@ +import { describe, expect, test, vi } from "vitest"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { TGetUsersFilter } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; -import { describe, expect, test, vi } from "vitest"; import { getUsersQuery } from "../utils"; vi.mock("@/modules/api/v2/management/lib/utils", () => ({ diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/users.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/users.ts index f421e032f3..ef81b32cde 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/users.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/users.ts @@ -1,3 +1,7 @@ +import { OrganizationRole, Prisma, TeamUserRole } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { TUser } from "@formbricks/database/zod/users"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { captureTelemetry } from "@/lib/telemetry"; import { getUsersQuery } from "@/modules/api/v2/organizations/[organizationId]/users/lib/utils"; import { @@ -7,10 +11,6 @@ import { } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { ApiResponseWithMeta } from "@/modules/api/v2/types/api-success"; -import { OrganizationRole, Prisma, TeamUserRole } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { TUser } from "@formbricks/database/zod/users"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; export const getUsers = async ( organizationId: string, diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/utils.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/utils.ts index f27ece8677..05241b95f7 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/utils.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/lib/utils.ts @@ -1,6 +1,6 @@ +import { Prisma } from "@prisma/client"; import { buildCommonFilterQuery, pickCommonFilter } from "@/modules/api/v2/management/lib/utils"; import { TGetUsersFilter } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; -import { Prisma } from "@prisma/client"; export const getUsersQuery = (organizationId: string, params?: TGetUsersFilter) => { let query: Prisma.UserFindManyArgs = { diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/route.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/route.ts index e970c81b9a..927fb19ec5 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/route.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/route.ts @@ -1,3 +1,7 @@ +import { NextRequest } from "next/server"; +import { z } from "zod"; +import { logger } from "@formbricks/logger"; +import { OrganizationAccessType } from "@formbricks/types/api-key"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; @@ -15,10 +19,6 @@ import { ZUserInputPatch, } from "@/modules/api/v2/organizations/[organizationId]/users/types/users"; import { UNKNOWN_DATA } from "@/modules/ee/audit-logs/types/audit-log"; -import { NextRequest } from "next/server"; -import { z } from "zod"; -import { logger } from "@formbricks/logger"; -import { OrganizationAccessType } from "@formbricks/types/api-key"; export const GET = async (request: NextRequest, props: { params: Promise<{ organizationId: string }> }) => authenticatedApiClient({ diff --git a/apps/web/modules/api/v2/organizations/[organizationId]/users/types/users.ts b/apps/web/modules/api/v2/organizations/[organizationId]/users/types/users.ts index 17458716e6..447a4aeb94 100644 --- a/apps/web/modules/api/v2/organizations/[organizationId]/users/types/users.ts +++ b/apps/web/modules/api/v2/organizations/[organizationId]/users/types/users.ts @@ -1,7 +1,7 @@ -import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; import { z } from "zod"; import { ZUser } from "@formbricks/database/zod/users"; import { ZUserName } from "@formbricks/types/user"; +import { ZGetFilter } from "@/modules/api/v2/types/api-filter"; export const ZGetUsersFilter = ZGetFilter.extend({ id: z.string().optional(), diff --git a/apps/web/modules/api/v2/roles/lib/openapi.ts b/apps/web/modules/api/v2/roles/lib/openapi.ts index 8f45c1bc12..0514b1f03f 100644 --- a/apps/web/modules/api/v2/roles/lib/openapi.ts +++ b/apps/web/modules/api/v2/roles/lib/openapi.ts @@ -1,6 +1,6 @@ -import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; import { ZRoles } from "@formbricks/database/zod/roles"; +import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; export const getRolesEndpoint: ZodOpenApiOperationObject = { operationId: "getRoles", diff --git a/apps/web/modules/api/v2/roles/lib/utils.test.ts b/apps/web/modules/api/v2/roles/lib/utils.test.ts index 3137be94c8..28ee6b538e 100644 --- a/apps/web/modules/api/v2/roles/lib/utils.test.ts +++ b/apps/web/modules/api/v2/roles/lib/utils.test.ts @@ -1,6 +1,6 @@ -import * as constants from "@/lib/constants"; import { OrganizationRole } from "@prisma/client"; import { describe, expect, test, vi } from "vitest"; +import * as constants from "@/lib/constants"; import { getRoles } from "./utils"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/api/v2/roles/lib/utils.ts b/apps/web/modules/api/v2/roles/lib/utils.ts index 47db5d41f3..1a967f16c8 100644 --- a/apps/web/modules/api/v2/roles/lib/utils.ts +++ b/apps/web/modules/api/v2/roles/lib/utils.ts @@ -1,7 +1,7 @@ -import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { OrganizationRole } from "@prisma/client"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; export const getRoles = (): Result<{ data: string[] }, ApiErrorResponseV2> => { try { diff --git a/apps/web/modules/api/v2/roles/route.ts b/apps/web/modules/api/v2/roles/route.ts index 3989e1c37f..1209f6e738 100644 --- a/apps/web/modules/api/v2/roles/route.ts +++ b/apps/web/modules/api/v2/roles/route.ts @@ -1,8 +1,8 @@ +import { NextRequest } from "next/server"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; import { getRoles } from "@/modules/api/v2/roles/lib/utils"; -import { NextRequest } from "next/server"; export const GET = async (request: NextRequest) => authenticatedApiClient({ diff --git a/apps/web/modules/auth/actions.ts b/apps/web/modules/auth/actions.ts index 707f001781..4dc9b7cf80 100644 --- a/apps/web/modules/auth/actions.ts +++ b/apps/web/modules/auth/actions.ts @@ -1,10 +1,10 @@ "use server"; +import { z } from "zod"; +import { InvalidInputError } from "@formbricks/types/errors"; import { createEmailToken } from "@/lib/jwt"; import { getUserByEmail } from "@/lib/user/service"; import { actionClient } from "@/lib/utils/action-client"; -import { z } from "zod"; -import { InvalidInputError } from "@formbricks/types/errors"; const ZCreateEmailTokenAction = z.object({ email: z.string().min(5).max(255).email({ message: "Invalid email" }), diff --git a/apps/web/modules/auth/components/back-to-login-button.test.tsx b/apps/web/modules/auth/components/back-to-login-button.test.tsx index 6721531079..91f02e34e9 100644 --- a/apps/web/modules/auth/components/back-to-login-button.test.tsx +++ b/apps/web/modules/auth/components/back-to-login-button.test.tsx @@ -1,8 +1,8 @@ -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { TFnType } from "@tolgee/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getTranslate } from "@/tolgee/server"; import { BackToLoginButton } from "./back-to-login-button"; vi.mock("@/tolgee/server", () => ({ diff --git a/apps/web/modules/auth/components/back-to-login-button.tsx b/apps/web/modules/auth/components/back-to-login-button.tsx index fe78378895..914aab4f1f 100644 --- a/apps/web/modules/auth/components/back-to-login-button.tsx +++ b/apps/web/modules/auth/components/back-to-login-button.tsx @@ -1,6 +1,6 @@ +import Link from "next/link"; import { Button } from "@/modules/ui/components/button"; import { getTranslate } from "@/tolgee/server"; -import Link from "next/link"; export const BackToLoginButton = async () => { const t = await getTranslate(); diff --git a/apps/web/modules/auth/components/form-wrapper.tsx b/apps/web/modules/auth/components/form-wrapper.tsx index 0439d8f96d..72f5714dd6 100644 --- a/apps/web/modules/auth/components/form-wrapper.tsx +++ b/apps/web/modules/auth/components/form-wrapper.tsx @@ -1,5 +1,5 @@ -import { Logo } from "@/modules/ui/components/logo"; import Link from "next/link"; +import { Logo } from "@/modules/ui/components/logo"; interface FormWrapperProps { children: React.ReactNode; diff --git a/apps/web/modules/auth/components/testimonial.test.tsx b/apps/web/modules/auth/components/testimonial.test.tsx index c6fae82825..700ca2d20f 100644 --- a/apps/web/modules/auth/components/testimonial.test.tsx +++ b/apps/web/modules/auth/components/testimonial.test.tsx @@ -1,8 +1,8 @@ -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { TFnType } from "@tolgee/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getTranslate } from "@/tolgee/server"; import { Testimonial } from "./testimonial"; vi.mock("@/tolgee/server", () => ({ diff --git a/apps/web/modules/auth/components/testimonial.tsx b/apps/web/modules/auth/components/testimonial.tsx index 23567afade..22ef4badf9 100644 --- a/apps/web/modules/auth/components/testimonial.tsx +++ b/apps/web/modules/auth/components/testimonial.tsx @@ -1,8 +1,8 @@ +import { CheckCircle2Icon } from "lucide-react"; +import Image from "next/image"; import CalComLogo from "@/images/cal-logo-light.svg"; import Peer from "@/images/peer.webp"; import { getTranslate } from "@/tolgee/server"; -import { CheckCircle2Icon } from "lucide-react"; -import Image from "next/image"; export const Testimonial = async () => { const t = await getTranslate(); diff --git a/apps/web/modules/auth/email-change-without-verification-success/page.tsx b/apps/web/modules/auth/email-change-without-verification-success/page.tsx index 29a1720b10..0e02222689 100644 --- a/apps/web/modules/auth/email-change-without-verification-success/page.tsx +++ b/apps/web/modules/auth/email-change-without-verification-success/page.tsx @@ -1,10 +1,10 @@ +import { getServerSession } from "next-auth"; +import type { Session } from "next-auth"; +import { redirect } from "next/navigation"; import { BackToLoginButton } from "@/modules/auth/components/back-to-login-button"; import { FormWrapper } from "@/modules/auth/components/form-wrapper"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import type { Session } from "next-auth"; -import { redirect } from "next/navigation"; export const EmailChangeWithoutVerificationSuccessPage = async () => { const t = await getTranslate(); diff --git a/apps/web/modules/auth/forgot-password/actions.test.ts b/apps/web/modules/auth/forgot-password/actions.test.ts index f335f1a43e..98407aedd0 100644 --- a/apps/web/modules/auth/forgot-password/actions.test.ts +++ b/apps/web/modules/auth/forgot-password/actions.test.ts @@ -1,9 +1,9 @@ +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { getUserByEmail } from "@/modules/auth/lib/user"; // Import mocked functions import { applyIPRateLimit } from "@/modules/core/rate-limit/helpers"; import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { sendForgotPasswordEmail } from "@/modules/email"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { forgotPasswordAction } from "./actions"; // Mock dependencies diff --git a/apps/web/modules/auth/forgot-password/actions.ts b/apps/web/modules/auth/forgot-password/actions.ts index 2b14a1560c..2b59762a23 100644 --- a/apps/web/modules/auth/forgot-password/actions.ts +++ b/apps/web/modules/auth/forgot-password/actions.ts @@ -1,14 +1,14 @@ "use server"; +import { z } from "zod"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { ZUserEmail } from "@formbricks/types/user"; import { PASSWORD_RESET_DISABLED } from "@/lib/constants"; import { actionClient } from "@/lib/utils/action-client"; import { getUserByEmail } from "@/modules/auth/lib/user"; import { applyIPRateLimit } from "@/modules/core/rate-limit/helpers"; import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { sendForgotPasswordEmail } from "@/modules/email"; -import { z } from "zod"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { ZUserEmail } from "@formbricks/types/user"; const ZForgotPasswordAction = z.object({ email: ZUserEmail, diff --git a/apps/web/modules/auth/forgot-password/components/forgot-password-form.tsx b/apps/web/modules/auth/forgot-password/components/forgot-password-form.tsx index 817c453585..6a69fc8959 100644 --- a/apps/web/modules/auth/forgot-password/components/forgot-password-form.tsx +++ b/apps/web/modules/auth/forgot-password/components/forgot-password-form.tsx @@ -1,9 +1,5 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { forgotPasswordAction } from "@/modules/auth/forgot-password/actions"; -import { Button } from "@/modules/ui/components/button"; -import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; import { zodResolver } from "@hookform/resolvers/zod"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; @@ -11,6 +7,10 @@ import { useRouter } from "next/navigation"; import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; import toast from "react-hot-toast"; import { z } from "zod"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { forgotPasswordAction } from "@/modules/auth/forgot-password/actions"; +import { Button } from "@/modules/ui/components/button"; +import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; const ZForgotPasswordForm = z.object({ email: z.string().email(), diff --git a/apps/web/modules/auth/forgot-password/reset/actions.ts b/apps/web/modules/auth/forgot-password/reset/actions.ts index 585dc70966..71303a2e18 100644 --- a/apps/web/modules/auth/forgot-password/reset/actions.ts +++ b/apps/web/modules/auth/forgot-password/reset/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZUserPassword } from "@formbricks/types/user"; import { hashPassword } from "@/lib/auth"; import { verifyToken } from "@/lib/jwt"; import { actionClient } from "@/lib/utils/action-client"; @@ -7,9 +10,6 @@ import { ActionClientCtx } from "@/lib/utils/action-client/types/context"; import { getUser, updateUser } from "@/modules/auth/lib/user"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { sendPasswordResetNotifyEmail } from "@/modules/email"; -import { z } from "zod"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZUserPassword } from "@formbricks/types/user"; const ZResetPasswordAction = z.object({ token: z.string(), diff --git a/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.test.tsx b/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.test.tsx index 7feb91e40f..c36a2d3f7f 100644 --- a/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.test.tsx +++ b/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.test.tsx @@ -1,10 +1,10 @@ -import { resetPasswordAction } from "@/modules/auth/forgot-password/reset/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { useRouter, useSearchParams } from "next/navigation"; import { toast } from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { resetPasswordAction } from "@/modules/auth/forgot-password/reset/actions"; import { ResetPasswordForm } from "./reset-password-form"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.tsx b/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.tsx index 36a7284001..1f25e2c7bc 100644 --- a/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.tsx +++ b/apps/web/modules/auth/forgot-password/reset/components/reset-password-form.tsx @@ -1,11 +1,5 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { resetPasswordAction } from "@/modules/auth/forgot-password/reset/actions"; -import { PasswordChecks } from "@/modules/auth/signup/components/password-checks"; -import { Button } from "@/modules/ui/components/button"; -import { FormField } from "@/modules/ui/components/form"; -import { PasswordInput } from "@/modules/ui/components/password-input"; import { zodResolver } from "@hookform/resolvers/zod"; import { useTranslate } from "@tolgee/react"; import { useRouter, useSearchParams } from "next/navigation"; @@ -13,6 +7,12 @@ import { SubmitHandler, useForm } from "react-hook-form"; import { toast } from "react-hot-toast"; import { z } from "zod"; import { ZUserPassword } from "@formbricks/types/user"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { resetPasswordAction } from "@/modules/auth/forgot-password/reset/actions"; +import { PasswordChecks } from "@/modules/auth/signup/components/password-checks"; +import { Button } from "@/modules/ui/components/button"; +import { FormField } from "@/modules/ui/components/form"; +import { PasswordInput } from "@/modules/ui/components/password-input"; const ZPasswordResetForm = z.object({ password: ZUserPassword, diff --git a/apps/web/modules/auth/hooks/use-sign-out.test.tsx b/apps/web/modules/auth/hooks/use-sign-out.test.tsx index f3ffe20b00..820860abc6 100644 --- a/apps/web/modules/auth/hooks/use-sign-out.test.tsx +++ b/apps/web/modules/auth/hooks/use-sign-out.test.tsx @@ -1,9 +1,9 @@ -import { logSignOutAction } from "@/modules/auth/actions/sign-out"; import "@testing-library/jest-dom/vitest"; import { cleanup, renderHook } from "@testing-library/react"; import { signOut } from "next-auth/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { logger } from "@formbricks/logger"; +import { logSignOutAction } from "@/modules/auth/actions/sign-out"; // Import the actual hook (unmock it for testing) vi.unmock("@/modules/auth/hooks/use-sign-out"); diff --git a/apps/web/modules/auth/hooks/use-sign-out.ts b/apps/web/modules/auth/hooks/use-sign-out.ts index e8cffa54f5..7422abd50f 100644 --- a/apps/web/modules/auth/hooks/use-sign-out.ts +++ b/apps/web/modules/auth/hooks/use-sign-out.ts @@ -1,7 +1,7 @@ -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; -import { logSignOutAction } from "@/modules/auth/actions/sign-out"; import { signOut } from "next-auth/react"; import { logger } from "@formbricks/logger"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; +import { logSignOutAction } from "@/modules/auth/actions/sign-out"; interface UseSignOutOptions { reason?: diff --git a/apps/web/modules/auth/invite/lib/invite.test.ts b/apps/web/modules/auth/invite/lib/invite.test.ts index 593e7e7543..80b4c05111 100644 --- a/apps/web/modules/auth/invite/lib/invite.test.ts +++ b/apps/web/modules/auth/invite/lib/invite.test.ts @@ -1,8 +1,8 @@ -import { type InviteWithCreator } from "@/modules/auth/invite/types/invites"; import { Prisma } from "@prisma/client"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { type InviteWithCreator } from "@/modules/auth/invite/types/invites"; import { deleteInvite, getInvite } from "./invite"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/auth/invite/lib/invite.ts b/apps/web/modules/auth/invite/lib/invite.ts index cc5b98b002..95144f0b78 100644 --- a/apps/web/modules/auth/invite/lib/invite.ts +++ b/apps/web/modules/auth/invite/lib/invite.ts @@ -1,8 +1,8 @@ -import { type InviteWithCreator } from "@/modules/auth/invite/types/invites"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { type InviteWithCreator } from "@/modules/auth/invite/types/invites"; export const deleteInvite = async (inviteId: string): Promise => { try { diff --git a/apps/web/modules/auth/invite/lib/team.ts b/apps/web/modules/auth/invite/lib/team.ts index e6da07f798..6bfc28dc01 100644 --- a/apps/web/modules/auth/invite/lib/team.ts +++ b/apps/web/modules/auth/invite/lib/team.ts @@ -1,9 +1,9 @@ import "server-only"; -import { getAccessFlags } from "@/lib/membership/utils"; -import { CreateMembershipInvite } from "@/modules/auth/invite/types/invites"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { getAccessFlags } from "@/lib/membership/utils"; +import { CreateMembershipInvite } from "@/modules/auth/invite/types/invites"; export const createTeamMembership = async (invite: CreateMembershipInvite, userId: string): Promise => { const teamIds = invite.teamIds || []; diff --git a/apps/web/modules/auth/invite/page.test.tsx b/apps/web/modules/auth/invite/page.test.tsx index 1e3b049ef9..b93d3b95e1 100644 --- a/apps/web/modules/auth/invite/page.test.tsx +++ b/apps/web/modules/auth/invite/page.test.tsx @@ -1,8 +1,8 @@ -import { verifyInviteToken } from "@/lib/jwt"; import "@testing-library/jest-dom/vitest"; import { cleanup } from "@testing-library/preact"; import { getServerSession } from "next-auth"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { verifyInviteToken } from "@/lib/jwt"; import { getInvite } from "./lib/invite"; import { InvitePage } from "./page"; diff --git a/apps/web/modules/auth/invite/page.tsx b/apps/web/modules/auth/invite/page.tsx index 91d6d5b282..5acf65172f 100644 --- a/apps/web/modules/auth/invite/page.tsx +++ b/apps/web/modules/auth/invite/page.tsx @@ -1,3 +1,7 @@ +import { getServerSession } from "next-auth"; +import Link from "next/link"; +import { after } from "next/server"; +import { logger } from "@formbricks/logger"; import { WEBAPP_URL } from "@/lib/constants"; import { verifyInviteToken } from "@/lib/jwt"; import { createMembership } from "@/lib/membership/service"; @@ -8,10 +12,6 @@ import { authOptions } from "@/modules/auth/lib/authOptions"; import { sendInviteAcceptedEmail } from "@/modules/email"; import { Button } from "@/modules/ui/components/button"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import Link from "next/link"; -import { after } from "next/server"; -import { logger } from "@formbricks/logger"; import { ContentLayout } from "./components/content-layout"; interface InvitePageProps { diff --git a/apps/web/modules/auth/layout.tsx b/apps/web/modules/auth/layout.tsx index 85221abc16..a9e3631f1e 100644 --- a/apps/web/modules/auth/layout.tsx +++ b/apps/web/modules/auth/layout.tsx @@ -1,9 +1,9 @@ -import { getIsFreshInstance } from "@/lib/instance/service"; -import { authOptions } from "@/modules/auth/lib/authOptions"; -import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; import { getServerSession } from "next-auth"; import { redirect } from "next/navigation"; import { Toaster } from "react-hot-toast"; +import { getIsFreshInstance } from "@/lib/instance/service"; +import { authOptions } from "@/modules/auth/lib/authOptions"; +import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; export const AuthLayout = async ({ children }: { children: React.ReactNode }) => { const [session, isFreshInstance, isMultiOrgEnabled] = await Promise.all([ diff --git a/apps/web/modules/auth/lib/brevo.test.ts b/apps/web/modules/auth/lib/brevo.test.ts index 49bc1bec5c..93586aa6bf 100644 --- a/apps/web/modules/auth/lib/brevo.test.ts +++ b/apps/web/modules/auth/lib/brevo.test.ts @@ -1,6 +1,6 @@ -import { validateInputs } from "@/lib/utils/validate"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { logger } from "@formbricks/logger"; +import { validateInputs } from "@/lib/utils/validate"; import { createBrevoCustomer, deleteBrevoCustomerByEmail, updateBrevoCustomer } from "./brevo"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/auth/lib/brevo.ts b/apps/web/modules/auth/lib/brevo.ts index 38f883d580..ecb72db6e6 100644 --- a/apps/web/modules/auth/lib/brevo.ts +++ b/apps/web/modules/auth/lib/brevo.ts @@ -1,8 +1,8 @@ -import { BREVO_API_KEY, BREVO_LIST_ID } from "@/lib/constants"; -import { validateInputs } from "@/lib/utils/validate"; import { logger } from "@formbricks/logger"; import { ZId } from "@formbricks/types/common"; import { TUserEmail, ZUserEmail } from "@formbricks/types/user"; +import { BREVO_API_KEY, BREVO_LIST_ID } from "@/lib/constants"; +import { validateInputs } from "@/lib/utils/validate"; type BrevoCreateContact = { email?: string; diff --git a/apps/web/modules/auth/lib/user.ts b/apps/web/modules/auth/lib/user.ts index 69ea460847..049fa2683f 100644 --- a/apps/web/modules/auth/lib/user.ts +++ b/apps/web/modules/auth/lib/user.ts @@ -1,4 +1,3 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -6,6 +5,7 @@ import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId } from "@formbricks/types/common"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TUserCreateInput, TUserUpdateInput, ZUserEmail, ZUserUpdateInput } from "@formbricks/types/user"; +import { validateInputs } from "@/lib/utils/validate"; export const updateUser = async (id: string, data: TUserUpdateInput) => { validateInputs([id, ZId], [data, ZUserUpdateInput.partial()]); diff --git a/apps/web/modules/auth/login/page.tsx b/apps/web/modules/auth/login/page.tsx index b5cd081e6d..025d50d4d2 100644 --- a/apps/web/modules/auth/login/page.tsx +++ b/apps/web/modules/auth/login/page.tsx @@ -1,3 +1,4 @@ +import { Metadata } from "next"; import { AZURE_OAUTH_ENABLED, EMAIL_AUTH_ENABLED, @@ -18,7 +19,6 @@ import { getIsSamlSsoEnabled, getIsSsoEnabled, } from "@/modules/ee/license-check/lib/utils"; -import { Metadata } from "next"; import { LoginForm } from "./components/login-form"; export const metadata: Metadata = { diff --git a/apps/web/modules/auth/signup-without-verification-success/page.test.tsx b/apps/web/modules/auth/signup-without-verification-success/page.test.tsx index 93c4ef2018..86867bc6ae 100644 --- a/apps/web/modules/auth/signup-without-verification-success/page.test.tsx +++ b/apps/web/modules/auth/signup-without-verification-success/page.test.tsx @@ -1,8 +1,8 @@ -import { getEmailFromEmailToken } from "@/lib/jwt"; -import { SignupWithoutVerificationSuccessPage } from "@/modules/auth/signup-without-verification-success/page"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getEmailFromEmailToken } from "@/lib/jwt"; +import { SignupWithoutVerificationSuccessPage } from "@/modules/auth/signup-without-verification-success/page"; vi.mock("@/tolgee/server", () => ({ getTranslate: async () => (key: string) => key, diff --git a/apps/web/modules/auth/signup/actions.ts b/apps/web/modules/auth/signup/actions.ts index d72bad55ba..8691071c08 100644 --- a/apps/web/modules/auth/signup/actions.ts +++ b/apps/web/modules/auth/signup/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { InvalidInputError, UnknownError } from "@formbricks/types/errors"; +import { ZUser, ZUserEmail, ZUserLocale, ZUserName, ZUserPassword } from "@formbricks/types/user"; import { hashPassword } from "@/lib/auth"; import { IS_TURNSTILE_CONFIGURED, TURNSTILE_SECRET_KEY } from "@/lib/constants"; import { verifyInviteToken } from "@/lib/jwt"; @@ -16,9 +19,6 @@ import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; import { sendInviteAcceptedEmail, sendVerificationEmail } from "@/modules/email"; -import { z } from "zod"; -import { InvalidInputError, UnknownError } from "@formbricks/types/errors"; -import { ZUser, ZUserEmail, ZUserLocale, ZUserName, ZUserPassword } from "@formbricks/types/user"; const ZCreatedUser = ZUser.pick({ name: true, diff --git a/apps/web/modules/auth/signup/components/signup-form.test.tsx b/apps/web/modules/auth/signup/components/signup-form.test.tsx index 1e9f66d1e0..06a28eea11 100644 --- a/apps/web/modules/auth/signup/components/signup-form.test.tsx +++ b/apps/web/modules/auth/signup/components/signup-form.test.tsx @@ -1,10 +1,10 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { createUserAction } from "@/modules/auth/signup/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import { useSearchParams } from "next/navigation"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { createUserAction } from "@/modules/auth/signup/actions"; import { createEmailTokenAction } from "../../../auth/actions"; import { SignupForm } from "./signup-form"; diff --git a/apps/web/modules/auth/signup/components/signup-form.tsx b/apps/web/modules/auth/signup/components/signup-form.tsx index e2494dd80f..6f43a9aa6d 100644 --- a/apps/web/modules/auth/signup/components/signup-form.tsx +++ b/apps/web/modules/auth/signup/components/signup-form.tsx @@ -1,14 +1,5 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { createUserAction } from "@/modules/auth/signup/actions"; -import { TermsPrivacyLinks } from "@/modules/auth/signup/components/terms-privacy-links"; -import { captureFailedSignup } from "@/modules/auth/signup/lib/utils"; -import { SSOOptions } from "@/modules/ee/sso/components/sso-options"; -import { Button } from "@/modules/ui/components/button"; -import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; -import { PasswordInput } from "@/modules/ui/components/password-input"; import { zodResolver } from "@hookform/resolvers/zod"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; @@ -19,6 +10,15 @@ import toast from "react-hot-toast"; import Turnstile, { useTurnstile } from "react-turnstile"; import { z } from "zod"; import { TUserLocale, ZUserName, ZUserPassword } from "@formbricks/types/user"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { createUserAction } from "@/modules/auth/signup/actions"; +import { TermsPrivacyLinks } from "@/modules/auth/signup/components/terms-privacy-links"; +import { captureFailedSignup } from "@/modules/auth/signup/lib/utils"; +import { SSOOptions } from "@/modules/ee/sso/components/sso-options"; +import { Button } from "@/modules/ui/components/button"; +import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; +import { PasswordInput } from "@/modules/ui/components/password-input"; import { createEmailTokenAction } from "../../../auth/actions"; import { PasswordChecks } from "./password-checks"; diff --git a/apps/web/modules/auth/signup/lib/__tests__/__mocks__/team-mocks.ts b/apps/web/modules/auth/signup/lib/__tests__/__mocks__/team-mocks.ts index 760af81898..1ae66cf183 100644 --- a/apps/web/modules/auth/signup/lib/__tests__/__mocks__/team-mocks.ts +++ b/apps/web/modules/auth/signup/lib/__tests__/__mocks__/team-mocks.ts @@ -1,5 +1,5 @@ -import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; import { OrganizationRole, Team, TeamUserRole } from "@prisma/client"; +import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; /** * Common constants and IDs used across tests diff --git a/apps/web/modules/auth/signup/lib/__tests__/team.test.ts b/apps/web/modules/auth/signup/lib/__tests__/team.test.ts index e622a2c5e7..026c1e4094 100644 --- a/apps/web/modules/auth/signup/lib/__tests__/team.test.ts +++ b/apps/web/modules/auth/signup/lib/__tests__/team.test.ts @@ -1,8 +1,8 @@ import { MOCK_IDS, MOCK_INVITE, MOCK_TEAM, MOCK_TEAM_USER } from "./__mocks__/team-mocks"; -import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; import { OrganizationRole } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; import { createTeamMembership } from "../team"; // Setup all mocks diff --git a/apps/web/modules/auth/signup/lib/invite.ts b/apps/web/modules/auth/signup/lib/invite.ts index 76faf50eba..5c486e6c56 100644 --- a/apps/web/modules/auth/signup/lib/invite.ts +++ b/apps/web/modules/auth/signup/lib/invite.ts @@ -1,9 +1,9 @@ -import { InviteWithCreator } from "@/modules/auth/signup/types/invites"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { InviteWithCreator } from "@/modules/auth/signup/types/invites"; export const deleteInvite = async (inviteId: string): Promise => { try { diff --git a/apps/web/modules/auth/signup/lib/team.ts b/apps/web/modules/auth/signup/lib/team.ts index df18080f1c..1fd81fe294 100644 --- a/apps/web/modules/auth/signup/lib/team.ts +++ b/apps/web/modules/auth/signup/lib/team.ts @@ -1,11 +1,11 @@ import "server-only"; -import { getAccessFlags } from "@/lib/membership/utils"; -import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError } from "@formbricks/types/errors"; +import { getAccessFlags } from "@/lib/membership/utils"; +import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; export const createTeamMembership = async (invite: CreateMembershipInvite, userId: string): Promise => { const teamIds = invite.teamIds || []; diff --git a/apps/web/modules/auth/signup/page.test.tsx b/apps/web/modules/auth/signup/page.test.tsx index 06bd5d1346..4aeddf4fe5 100644 --- a/apps/web/modules/auth/signup/page.test.tsx +++ b/apps/web/modules/auth/signup/page.test.tsx @@ -1,3 +1,7 @@ +import "@testing-library/jest-dom/vitest"; +import { cleanup, render, screen } from "@testing-library/react"; +import { notFound } from "next/navigation"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { verifyInviteToken } from "@/lib/jwt"; import { findMatchingLocale } from "@/lib/utils/locale"; import { getIsValidInviteToken } from "@/modules/auth/signup/lib/invite"; @@ -6,10 +10,6 @@ import { getIsSamlSsoEnabled, getIsSsoEnabled, } from "@/modules/ee/license-check/lib/utils"; -import "@testing-library/jest-dom/vitest"; -import { cleanup, render, screen } from "@testing-library/react"; -import { notFound } from "next/navigation"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { SignupPage } from "./page"; // Mock the necessary dependencies diff --git a/apps/web/modules/auth/signup/page.tsx b/apps/web/modules/auth/signup/page.tsx index bb77802851..5acf0767f6 100644 --- a/apps/web/modules/auth/signup/page.tsx +++ b/apps/web/modules/auth/signup/page.tsx @@ -1,3 +1,4 @@ +import { notFound } from "next/navigation"; import { AZURE_OAUTH_ENABLED, EMAIL_AUTH_ENABLED, @@ -26,7 +27,6 @@ import { getIsSamlSsoEnabled, getIsSsoEnabled, } from "@/modules/ee/license-check/lib/utils"; -import { notFound } from "next/navigation"; import { SignupForm } from "./components/signup-form"; export const SignupPage = async ({ searchParams: searchParamsProps }) => { diff --git a/apps/web/modules/auth/verification-requested/actions.test.ts b/apps/web/modules/auth/verification-requested/actions.test.ts index f9d329c5a9..02f7eec478 100644 --- a/apps/web/modules/auth/verification-requested/actions.test.ts +++ b/apps/web/modules/auth/verification-requested/actions.test.ts @@ -1,11 +1,11 @@ +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; import { getUserByEmail } from "@/modules/auth/lib/user"; // Import mocked functions import { applyIPRateLimit } from "@/modules/core/rate-limit/helpers"; import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { sendVerificationEmail } from "@/modules/email"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; import { resendVerificationEmailAction } from "./actions"; // Mock dependencies diff --git a/apps/web/modules/auth/verification-requested/actions.ts b/apps/web/modules/auth/verification-requested/actions.ts index 485147e38b..313b6eb15b 100644 --- a/apps/web/modules/auth/verification-requested/actions.ts +++ b/apps/web/modules/auth/verification-requested/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZUserEmail } from "@formbricks/types/user"; import { actionClient } from "@/lib/utils/action-client"; import { ActionClientCtx } from "@/lib/utils/action-client/types/context"; import { getUserByEmail } from "@/modules/auth/lib/user"; @@ -7,9 +10,6 @@ import { applyIPRateLimit } from "@/modules/core/rate-limit/helpers"; import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { sendVerificationEmail } from "@/modules/email"; -import { z } from "zod"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZUserEmail } from "@formbricks/types/user"; const ZResendVerificationEmailAction = z.object({ email: ZUserEmail, diff --git a/apps/web/modules/auth/verification-requested/components/request-verification-email.tsx b/apps/web/modules/auth/verification-requested/components/request-verification-email.tsx index 8bc1fa0537..edd76026aa 100644 --- a/apps/web/modules/auth/verification-requested/components/request-verification-email.tsx +++ b/apps/web/modules/auth/verification-requested/components/request-verification-email.tsx @@ -1,10 +1,10 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { useEffect } from "react"; import toast from "react-hot-toast"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Button } from "@/modules/ui/components/button"; import { resendVerificationEmailAction } from "../actions"; interface RequestVerificationEmailProps { diff --git a/apps/web/modules/auth/verification-requested/page.test.tsx b/apps/web/modules/auth/verification-requested/page.test.tsx index 345e23abb9..fd3f9d999a 100644 --- a/apps/web/modules/auth/verification-requested/page.test.tsx +++ b/apps/web/modules/auth/verification-requested/page.test.tsx @@ -1,8 +1,8 @@ -import { getEmailFromEmailToken } from "@/lib/jwt"; -import { VerificationRequestedPage } from "@/modules/auth/verification-requested/page"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { getEmailFromEmailToken } from "@/lib/jwt"; +import { VerificationRequestedPage } from "@/modules/auth/verification-requested/page"; vi.mock("@/lib/jwt", () => ({ getEmailFromEmailToken: vi.fn(), diff --git a/apps/web/modules/auth/verification-requested/page.tsx b/apps/web/modules/auth/verification-requested/page.tsx index 62f7bd58b8..7640c0f63f 100644 --- a/apps/web/modules/auth/verification-requested/page.tsx +++ b/apps/web/modules/auth/verification-requested/page.tsx @@ -1,9 +1,9 @@ +import { logger } from "@formbricks/logger"; +import { ZUserEmail } from "@formbricks/types/user"; import { getEmailFromEmailToken } from "@/lib/jwt"; import { FormWrapper } from "@/modules/auth/components/form-wrapper"; import { RequestVerificationEmail } from "@/modules/auth/verification-requested/components/request-verification-email"; import { T, getTranslate } from "@/tolgee/server"; -import { logger } from "@formbricks/logger"; -import { ZUserEmail } from "@formbricks/types/user"; export const VerificationRequestedPage = async ({ searchParams }) => { const t = await getTranslate(); diff --git a/apps/web/modules/auth/verify-email-change/actions.ts b/apps/web/modules/auth/verify-email-change/actions.ts index 952b008b94..ba8bb2dbfd 100644 --- a/apps/web/modules/auth/verify-email-change/actions.ts +++ b/apps/web/modules/auth/verify-email-change/actions.ts @@ -1,12 +1,12 @@ "use server"; +import { z } from "zod"; import { verifyEmailChangeToken } from "@/lib/jwt"; import { actionClient } from "@/lib/utils/action-client"; import { ActionClientCtx } from "@/lib/utils/action-client/types/context"; import { updateBrevoCustomer } from "@/modules/auth/lib/brevo"; import { getUser, updateUser } from "@/modules/auth/lib/user"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; -import { z } from "zod"; export const verifyEmailChangeAction = actionClient.schema(z.object({ token: z.string() })).action( withAuditLogging( diff --git a/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.test.tsx b/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.test.tsx index 7b48981eca..717211e068 100644 --- a/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.test.tsx +++ b/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.test.tsx @@ -1,8 +1,8 @@ -import { verifyEmailChangeAction } from "@/modules/auth/verify-email-change/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import { signOut } from "next-auth/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { verifyEmailChangeAction } from "@/modules/auth/verify-email-change/actions"; import { EmailChangeSignIn } from "./email-change-sign-in"; // Mock dependencies diff --git a/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.tsx b/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.tsx index 7b8c0d6db5..869fec0700 100644 --- a/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.tsx +++ b/apps/web/modules/auth/verify-email-change/components/email-change-sign-in.tsx @@ -1,9 +1,9 @@ "use client"; -import { verifyEmailChangeAction } from "@/modules/auth/verify-email-change/actions"; import { useTranslate } from "@tolgee/react"; import { signOut } from "next-auth/react"; import { useEffect, useState } from "react"; +import { verifyEmailChangeAction } from "@/modules/auth/verify-email-change/actions"; interface EmailChangeSignInProps { token: string; diff --git a/apps/web/modules/core/rate-limit/rate-limit-configs.test.ts b/apps/web/modules/core/rate-limit/rate-limit-configs.test.ts index feb1502876..f7cd0c74b0 100644 --- a/apps/web/modules/core/rate-limit/rate-limit-configs.test.ts +++ b/apps/web/modules/core/rate-limit/rate-limit-configs.test.ts @@ -1,5 +1,5 @@ -import { ZRateLimitConfig } from "@/modules/core/rate-limit/types/rate-limit"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import { ZRateLimitConfig } from "@/modules/core/rate-limit/types/rate-limit"; import { applyRateLimit } from "./helpers"; import { checkRateLimit } from "./rate-limit"; import { rateLimitConfigs } from "./rate-limit-configs"; diff --git a/apps/web/modules/core/rate-limit/rate-limit-load.test.ts b/apps/web/modules/core/rate-limit/rate-limit-load.test.ts index 5fd9e88c3c..aa7acb7eda 100644 --- a/apps/web/modules/core/rate-limit/rate-limit-load.test.ts +++ b/apps/web/modules/core/rate-limit/rate-limit-load.test.ts @@ -1,5 +1,5 @@ -import { cache } from "@/lib/cache"; import { afterAll, beforeAll, describe, expect, test } from "vitest"; +import { cache } from "@/lib/cache"; import { applyRateLimit } from "./helpers"; import { checkRateLimit } from "./rate-limit"; import { TRateLimitConfig } from "./types/rate-limit"; diff --git a/apps/web/modules/core/rate-limit/rate-limit.ts b/apps/web/modules/core/rate-limit/rate-limit.ts index b6f1f6ec5f..e3f908ce1f 100644 --- a/apps/web/modules/core/rate-limit/rate-limit.ts +++ b/apps/web/modules/core/rate-limit/rate-limit.ts @@ -1,9 +1,9 @@ -import { cache } from "@/lib/cache"; -import { RATE_LIMITING_DISABLED, SENTRY_DSN } from "@/lib/constants"; import * as Sentry from "@sentry/nextjs"; import { createCacheKey } from "@formbricks/cache"; import { logger } from "@formbricks/logger"; import { Result, ok } from "@formbricks/types/error-handlers"; +import { cache } from "@/lib/cache"; +import { RATE_LIMITING_DISABLED, SENTRY_DSN } from "@/lib/constants"; import { TRateLimitConfig, type TRateLimitResponse } from "./types/rate-limit"; /** diff --git a/apps/web/modules/ee/audit-logs/lib/handler.ts b/apps/web/modules/ee/audit-logs/lib/handler.ts index e440330b83..bd9fc2e0e5 100644 --- a/apps/web/modules/ee/audit-logs/lib/handler.ts +++ b/apps/web/modules/ee/audit-logs/lib/handler.ts @@ -1,3 +1,4 @@ +import { logger } from "@formbricks/logger"; import { AUDIT_LOG_ENABLED, AUDIT_LOG_GET_USER_IP } from "@/lib/constants"; import { ActionClientCtx, AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { getClientIpFromHeaders } from "@/lib/utils/client-ip"; @@ -13,7 +14,6 @@ import { UNKNOWN_DATA, } from "@/modules/ee/audit-logs/types/audit-log"; import { getIsAuditLogsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { logger } from "@formbricks/logger"; /** * Builds an audit event and logs it. diff --git a/apps/web/modules/ee/audit-logs/lib/service.ts b/apps/web/modules/ee/audit-logs/lib/service.ts index 2af4d79f18..20fca274e8 100644 --- a/apps/web/modules/ee/audit-logs/lib/service.ts +++ b/apps/web/modules/ee/audit-logs/lib/service.ts @@ -1,5 +1,5 @@ -import { type TAuditLogEvent, ZAuditLogEventSchema } from "@/modules/ee/audit-logs/types/audit-log"; import { logger } from "@formbricks/logger"; +import { type TAuditLogEvent, ZAuditLogEventSchema } from "@/modules/ee/audit-logs/types/audit-log"; const validateEvent = (event: TAuditLogEvent): void => { const result = ZAuditLogEventSchema.safeParse(event); diff --git a/apps/web/modules/ee/auth/saml/api/authorize/route.ts b/apps/web/modules/ee/auth/saml/api/authorize/route.ts index 9492508261..944b82b23e 100644 --- a/apps/web/modules/ee/auth/saml/api/authorize/route.ts +++ b/apps/web/modules/ee/auth/saml/api/authorize/route.ts @@ -1,8 +1,8 @@ +import type { OAuthReq } from "@boxyhq/saml-jackson"; +import { NextRequest, NextResponse } from "next/server"; import { responses } from "@/app/lib/api/response"; import jackson from "@/modules/ee/auth/saml/lib/jackson"; import { getIsSamlSsoEnabled } from "@/modules/ee/license-check/lib/utils"; -import type { OAuthReq } from "@boxyhq/saml-jackson"; -import { NextRequest, NextResponse } from "next/server"; export const GET = async (req: NextRequest) => { const jacksonInstance = await jackson(); diff --git a/apps/web/modules/ee/auth/saml/api/callback/route.ts b/apps/web/modules/ee/auth/saml/api/callback/route.ts index c598aa751f..bcfbda0268 100644 --- a/apps/web/modules/ee/auth/saml/api/callback/route.ts +++ b/apps/web/modules/ee/auth/saml/api/callback/route.ts @@ -1,6 +1,6 @@ +import { redirect } from "next/navigation"; import { responses } from "@/app/lib/api/response"; import jackson from "@/modules/ee/auth/saml/lib/jackson"; -import { redirect } from "next/navigation"; interface SAMLCallbackBody { RelayState: string; diff --git a/apps/web/modules/ee/auth/saml/api/token/route.ts b/apps/web/modules/ee/auth/saml/api/token/route.ts index 26ba16800e..5eb9c5e267 100644 --- a/apps/web/modules/ee/auth/saml/api/token/route.ts +++ b/apps/web/modules/ee/auth/saml/api/token/route.ts @@ -1,6 +1,6 @@ +import { OAuthTokenReq } from "@boxyhq/saml-jackson"; import { responses } from "@/app/lib/api/response"; import jackson from "@/modules/ee/auth/saml/lib/jackson"; -import { OAuthTokenReq } from "@boxyhq/saml-jackson"; export const POST = async (req: Request) => { const jacksonInstance = await jackson(); diff --git a/apps/web/modules/ee/auth/saml/api/userinfo/lib/utils.test.ts b/apps/web/modules/ee/auth/saml/api/userinfo/lib/utils.test.ts index 47bb0bc4a5..6ba6458b78 100644 --- a/apps/web/modules/ee/auth/saml/api/userinfo/lib/utils.test.ts +++ b/apps/web/modules/ee/auth/saml/api/userinfo/lib/utils.test.ts @@ -1,5 +1,5 @@ -import { responses } from "@/app/lib/api/response"; import { describe, expect, test, vi } from "vitest"; +import { responses } from "@/app/lib/api/response"; import { extractAuthToken } from "./utils"; vi.mock("@/app/lib/api/response", () => ({ diff --git a/apps/web/modules/ee/auth/saml/lib/jackson.ts b/apps/web/modules/ee/auth/saml/lib/jackson.ts index 2b883c9316..8766c3c50d 100644 --- a/apps/web/modules/ee/auth/saml/lib/jackson.ts +++ b/apps/web/modules/ee/auth/saml/lib/jackson.ts @@ -1,9 +1,9 @@ "use server"; +import type { IConnectionAPIController, IOAuthController, JacksonOption } from "@boxyhq/saml-jackson"; import { SAML_AUDIENCE, SAML_DATABASE_URL, SAML_PATH, WEBAPP_URL } from "@/lib/constants"; import { preloadConnection } from "@/modules/ee/auth/saml/lib/preload-connection"; import { getIsSamlSsoEnabled } from "@/modules/ee/license-check/lib/utils"; -import type { IConnectionAPIController, IOAuthController, JacksonOption } from "@boxyhq/saml-jackson"; const opts: JacksonOption = { externalUrl: WEBAPP_URL, diff --git a/apps/web/modules/ee/auth/saml/lib/preload-connection.ts b/apps/web/modules/ee/auth/saml/lib/preload-connection.ts index 70a0a14d5b..ea5343a06f 100644 --- a/apps/web/modules/ee/auth/saml/lib/preload-connection.ts +++ b/apps/web/modules/ee/auth/saml/lib/preload-connection.ts @@ -1,9 +1,9 @@ -import { SAML_PRODUCT, SAML_TENANT, SAML_XML_DIR, WEBAPP_URL } from "@/lib/constants"; import { SAMLSSOConnectionWithEncodedMetadata, SAMLSSORecord } from "@boxyhq/saml-jackson"; import { ConnectionAPIController } from "@boxyhq/saml-jackson/dist/controller/api"; import fs from "fs/promises"; import path from "path"; import { logger } from "@formbricks/logger"; +import { SAML_PRODUCT, SAML_TENANT, SAML_XML_DIR, WEBAPP_URL } from "@/lib/constants"; const getPreloadedConnectionFile = async () => { const preloadedConnections = await fs.readdir(path.join(SAML_XML_DIR)); diff --git a/apps/web/modules/ee/auth/saml/lib/tests/jackson.test.ts b/apps/web/modules/ee/auth/saml/lib/tests/jackson.test.ts index 74bd151abd..23416c9007 100644 --- a/apps/web/modules/ee/auth/saml/lib/tests/jackson.test.ts +++ b/apps/web/modules/ee/auth/saml/lib/tests/jackson.test.ts @@ -1,8 +1,8 @@ +import { controllers } from "@boxyhq/saml-jackson"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { SAML_AUDIENCE, SAML_DATABASE_URL, SAML_PATH, WEBAPP_URL } from "@/lib/constants"; import { preloadConnection } from "@/modules/ee/auth/saml/lib/preload-connection"; import { getIsSamlSsoEnabled } from "@/modules/ee/license-check/lib/utils"; -import { controllers } from "@boxyhq/saml-jackson"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import init from "../jackson"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/ee/auth/saml/lib/tests/preload-connection.test.ts b/apps/web/modules/ee/auth/saml/lib/tests/preload-connection.test.ts index c122d57ec6..fb58c2067d 100644 --- a/apps/web/modules/ee/auth/saml/lib/tests/preload-connection.test.ts +++ b/apps/web/modules/ee/auth/saml/lib/tests/preload-connection.test.ts @@ -1,8 +1,8 @@ -import { SAML_PRODUCT, SAML_TENANT, SAML_XML_DIR, WEBAPP_URL } from "@/lib/constants"; import fs from "fs/promises"; import path from "path"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { logger } from "@formbricks/logger"; +import { SAML_PRODUCT, SAML_TENANT, SAML_XML_DIR, WEBAPP_URL } from "@/lib/constants"; import { preloadConnection } from "../preload-connection"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/ee/billing/actions.ts b/apps/web/modules/ee/billing/actions.ts index b27541dc3c..ad1d7d92b9 100644 --- a/apps/web/modules/ee/billing/actions.ts +++ b/apps/web/modules/ee/billing/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { AuthorizationError, ResourceNotFoundError } from "@formbricks/types/errors"; import { STRIPE_PRICE_LOOKUP_KEYS, WEBAPP_URL } from "@/lib/constants"; import { getOrganization } from "@/lib/organization/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; @@ -10,9 +13,6 @@ import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { createCustomerPortalSession } from "@/modules/ee/billing/api/lib/create-customer-portal-session"; import { createSubscription } from "@/modules/ee/billing/api/lib/create-subscription"; import { isSubscriptionCancelled } from "@/modules/ee/billing/api/lib/is-subscription-cancelled"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { AuthorizationError, ResourceNotFoundError } from "@formbricks/types/errors"; const ZUpgradePlanAction = z.object({ environmentId: ZId, diff --git a/apps/web/modules/ee/billing/api/lib/checkout-session-completed.ts b/apps/web/modules/ee/billing/api/lib/checkout-session-completed.ts index 55da0a307c..f6085c6c05 100644 --- a/apps/web/modules/ee/billing/api/lib/checkout-session-completed.ts +++ b/apps/web/modules/ee/billing/api/lib/checkout-session-completed.ts @@ -1,8 +1,8 @@ +import Stripe from "stripe"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; import { STRIPE_API_VERSION } from "@/lib/constants"; import { env } from "@/lib/env"; import { getOrganization } from "@/lib/organization/service"; -import Stripe from "stripe"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; const stripe = new Stripe(env.STRIPE_SECRET_KEY!, { // https://github.com/stripe/stripe-node#configuration diff --git a/apps/web/modules/ee/billing/api/lib/create-customer-portal-session.ts b/apps/web/modules/ee/billing/api/lib/create-customer-portal-session.ts index 07466d33ef..eae3c8c225 100644 --- a/apps/web/modules/ee/billing/api/lib/create-customer-portal-session.ts +++ b/apps/web/modules/ee/billing/api/lib/create-customer-portal-session.ts @@ -1,6 +1,6 @@ +import Stripe from "stripe"; import { STRIPE_API_VERSION } from "@/lib/constants"; import { env } from "@/lib/env"; -import Stripe from "stripe"; export const createCustomerPortalSession = async (stripeCustomerId: string, returnUrl: string) => { if (!env.STRIPE_SECRET_KEY) throw new Error("Stripe is not enabled; STRIPE_SECRET_KEY is not set."); diff --git a/apps/web/modules/ee/billing/api/lib/create-subscription.ts b/apps/web/modules/ee/billing/api/lib/create-subscription.ts index cd581b1608..ea4819899f 100644 --- a/apps/web/modules/ee/billing/api/lib/create-subscription.ts +++ b/apps/web/modules/ee/billing/api/lib/create-subscription.ts @@ -1,8 +1,8 @@ +import Stripe from "stripe"; +import { logger } from "@formbricks/logger"; import { STRIPE_API_VERSION, STRIPE_PRICE_LOOKUP_KEYS, WEBAPP_URL } from "@/lib/constants"; import { env } from "@/lib/env"; import { getOrganization } from "@/lib/organization/service"; -import Stripe from "stripe"; -import { logger } from "@formbricks/logger"; const stripe = new Stripe(env.STRIPE_SECRET_KEY!, { apiVersion: STRIPE_API_VERSION, diff --git a/apps/web/modules/ee/billing/api/lib/invoice-finalized.ts b/apps/web/modules/ee/billing/api/lib/invoice-finalized.ts index c829802c2f..b2522af991 100644 --- a/apps/web/modules/ee/billing/api/lib/invoice-finalized.ts +++ b/apps/web/modules/ee/billing/api/lib/invoice-finalized.ts @@ -1,5 +1,5 @@ -import { getOrganization, updateOrganization } from "@/lib/organization/service"; import Stripe from "stripe"; +import { getOrganization, updateOrganization } from "@/lib/organization/service"; export const handleInvoiceFinalized = async (event: Stripe.Event) => { const invoice = event.data.object as Stripe.Invoice; diff --git a/apps/web/modules/ee/billing/api/lib/is-subscription-cancelled.ts b/apps/web/modules/ee/billing/api/lib/is-subscription-cancelled.ts index 4406d59da7..0dff1b77a6 100644 --- a/apps/web/modules/ee/billing/api/lib/is-subscription-cancelled.ts +++ b/apps/web/modules/ee/billing/api/lib/is-subscription-cancelled.ts @@ -1,8 +1,8 @@ +import Stripe from "stripe"; +import { logger } from "@formbricks/logger"; import { STRIPE_API_VERSION } from "@/lib/constants"; import { env } from "@/lib/env"; import { getOrganization } from "@/lib/organization/service"; -import Stripe from "stripe"; -import { logger } from "@formbricks/logger"; const stripe = new Stripe(env.STRIPE_SECRET_KEY!, { apiVersion: STRIPE_API_VERSION, diff --git a/apps/web/modules/ee/billing/api/lib/stripe-webhook.ts b/apps/web/modules/ee/billing/api/lib/stripe-webhook.ts index c93bb0ae88..ceee14203c 100644 --- a/apps/web/modules/ee/billing/api/lib/stripe-webhook.ts +++ b/apps/web/modules/ee/billing/api/lib/stripe-webhook.ts @@ -1,11 +1,11 @@ +import Stripe from "stripe"; +import { logger } from "@formbricks/logger"; import { STRIPE_API_VERSION } from "@/lib/constants"; import { env } from "@/lib/env"; import { handleCheckoutSessionCompleted } from "@/modules/ee/billing/api/lib/checkout-session-completed"; import { handleInvoiceFinalized } from "@/modules/ee/billing/api/lib/invoice-finalized"; import { handleSubscriptionCreatedOrUpdated } from "@/modules/ee/billing/api/lib/subscription-created-or-updated"; import { handleSubscriptionDeleted } from "@/modules/ee/billing/api/lib/subscription-deleted"; -import Stripe from "stripe"; -import { logger } from "@formbricks/logger"; const stripe = new Stripe(env.STRIPE_SECRET_KEY!, { apiVersion: STRIPE_API_VERSION, diff --git a/apps/web/modules/ee/billing/api/lib/subscription-created-or-updated.ts b/apps/web/modules/ee/billing/api/lib/subscription-created-or-updated.ts index 883d2da909..d7c7d56b9f 100644 --- a/apps/web/modules/ee/billing/api/lib/subscription-created-or-updated.ts +++ b/apps/web/modules/ee/billing/api/lib/subscription-created-or-updated.ts @@ -1,6 +1,3 @@ -import { PROJECT_FEATURE_KEYS, STRIPE_API_VERSION } from "@/lib/constants"; -import { env } from "@/lib/env"; -import { getOrganization, updateOrganization } from "@/lib/organization/service"; import Stripe from "stripe"; import { logger } from "@formbricks/logger"; import { ResourceNotFoundError } from "@formbricks/types/errors"; @@ -10,6 +7,9 @@ import { ZOrganizationBillingPeriod, ZOrganizationBillingPlan, } from "@formbricks/types/organizations"; +import { PROJECT_FEATURE_KEYS, STRIPE_API_VERSION } from "@/lib/constants"; +import { env } from "@/lib/env"; +import { getOrganization, updateOrganization } from "@/lib/organization/service"; const stripe = new Stripe(env.STRIPE_SECRET_KEY!, { // https://github.com/stripe/stripe-node#configuration diff --git a/apps/web/modules/ee/billing/api/lib/subscription-deleted.ts b/apps/web/modules/ee/billing/api/lib/subscription-deleted.ts index 3ba799dd83..4e96123546 100644 --- a/apps/web/modules/ee/billing/api/lib/subscription-deleted.ts +++ b/apps/web/modules/ee/billing/api/lib/subscription-deleted.ts @@ -1,8 +1,8 @@ -import { BILLING_LIMITS, PROJECT_FEATURE_KEYS } from "@/lib/constants"; -import { getOrganization, updateOrganization } from "@/lib/organization/service"; import Stripe from "stripe"; import { logger } from "@formbricks/logger"; import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { BILLING_LIMITS, PROJECT_FEATURE_KEYS } from "@/lib/constants"; +import { getOrganization, updateOrganization } from "@/lib/organization/service"; export const handleSubscriptionDeleted = async (event: Stripe.Event) => { const stripeSubscriptionObject = event.data.object as Stripe.Subscription; diff --git a/apps/web/modules/ee/billing/api/route.ts b/apps/web/modules/ee/billing/api/route.ts index 5efefab5b3..0d0a0b12dc 100644 --- a/apps/web/modules/ee/billing/api/route.ts +++ b/apps/web/modules/ee/billing/api/route.ts @@ -1,7 +1,7 @@ -import { webhookHandler } from "@/modules/ee/billing/api/lib/stripe-webhook"; import { headers } from "next/headers"; import { NextResponse } from "next/server"; import { logger } from "@formbricks/logger"; +import { webhookHandler } from "@/modules/ee/billing/api/lib/stripe-webhook"; export const POST = async (request: Request) => { try { diff --git a/apps/web/modules/ee/billing/components/billing-slider.tsx b/apps/web/modules/ee/billing/components/billing-slider.tsx index 7f43bb53f7..afae94de1d 100644 --- a/apps/web/modules/ee/billing/components/billing-slider.tsx +++ b/apps/web/modules/ee/billing/components/billing-slider.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as SliderPrimitive from "@radix-ui/react-slider"; import { useTranslate } from "@tolgee/react"; import * as React from "react"; +import { cn } from "@/lib/cn"; interface SliderProps { className?: string; diff --git a/apps/web/modules/ee/billing/page.tsx b/apps/web/modules/ee/billing/page.tsx index 954c80dd41..5245fbe248 100644 --- a/apps/web/modules/ee/billing/page.tsx +++ b/apps/web/modules/ee/billing/page.tsx @@ -1,3 +1,4 @@ +import { notFound } from "next/navigation"; import { OrganizationSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { PROJECT_FEATURE_KEYS, STRIPE_PRICE_LOOKUP_KEYS } from "@/lib/constants"; @@ -10,7 +11,6 @@ import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { notFound } from "next/navigation"; import { PricingTable } from "./components/pricing-table"; export const PricingPage = async (props) => { diff --git a/apps/web/modules/ee/contacts/[contactId]/components/attributes-section.test.tsx b/apps/web/modules/ee/contacts/[contactId]/components/attributes-section.test.tsx index e7f1a6093f..ae15540b00 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/attributes-section.test.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/attributes-section.test.tsx @@ -1,10 +1,10 @@ -import { getResponsesByContactId } from "@/lib/response/service"; -import { getContactAttributes } from "@/modules/ee/contacts/lib/contact-attributes"; -import { getContact } from "@/modules/ee/contacts/lib/contacts"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TResponse } from "@formbricks/types/responses"; +import { getResponsesByContactId } from "@/lib/response/service"; +import { getContactAttributes } from "@/modules/ee/contacts/lib/contact-attributes"; +import { getContact } from "@/modules/ee/contacts/lib/contacts"; import { AttributesSection } from "./attributes-section"; vi.mock("@/lib/response/service", () => ({ diff --git a/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.test.tsx b/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.test.tsx index a272b63256..76d2f60378 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.test.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.test.tsx @@ -1,4 +1,3 @@ -import { deleteContactAction } from "@/modules/ee/contacts/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; @@ -7,6 +6,7 @@ import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.share import { useRouter } from "next/navigation"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { deleteContactAction } from "@/modules/ee/contacts/actions"; import { DeleteContactButton } from "./delete-contact-button"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.tsx b/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.tsx index 26bb69ce92..9ee97cd9e9 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/delete-contact-button.tsx @@ -1,14 +1,14 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { deleteContactAction } from "@/modules/ee/contacts/actions"; -import { Button } from "@/modules/ui/components/button"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { useTranslate } from "@tolgee/react"; import { TrashIcon } from "lucide-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; import toast from "react-hot-toast"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { deleteContactAction } from "@/modules/ee/contacts/actions"; +import { Button } from "@/modules/ui/components/button"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; interface DeleteContactButtonProps { environmentId: string; diff --git a/apps/web/modules/ee/contacts/[contactId]/components/response-feed.tsx b/apps/web/modules/ee/contacts/[contactId]/components/response-feed.tsx index 7d1cb90872..00a5133943 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/response-feed.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/response-feed.tsx @@ -1,5 +1,11 @@ "use client"; +import { useEffect, useState } from "react"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TResponseWithQuotas } from "@formbricks/types/responses"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TTag } from "@formbricks/types/tags"; +import { TUser, TUserLocale } from "@formbricks/types/user"; import { useMembershipRole } from "@/lib/membership/hooks/useMembershipRole"; import { getAccessFlags } from "@/lib/membership/utils"; import { replaceHeadlineRecall } from "@/lib/utils/recall"; @@ -7,12 +13,6 @@ import { SingleResponseCard } from "@/modules/analysis/components/SingleResponse import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { getTeamPermissionFlags } from "@/modules/ee/teams/utils/teams"; import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; -import { useEffect, useState } from "react"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TResponseWithQuotas } from "@formbricks/types/responses"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TTag } from "@formbricks/types/tags"; -import { TUser, TUserLocale } from "@formbricks/types/user"; interface ResponseTimelineProps { surveys: TSurvey[]; diff --git a/apps/web/modules/ee/contacts/[contactId]/components/response-section.test.tsx b/apps/web/modules/ee/contacts/[contactId]/components/response-section.test.tsx index cddfd0b5ee..123ddc8d2f 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/response-section.test.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/response-section.test.tsx @@ -1,10 +1,3 @@ -import { getProjectByEnvironmentId } from "@/lib/project/service"; -import { getResponsesByContactId } from "@/lib/response/service"; -import { getSurveys } from "@/lib/survey/service"; -import { getUser } from "@/lib/user/service"; -import { findMatchingLocale } from "@/lib/utils/locale"; -import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { TFnType } from "@tolgee/react"; @@ -12,6 +5,13 @@ import { getServerSession } from "next-auth"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TTag } from "@formbricks/types/tags"; +import { getProjectByEnvironmentId } from "@/lib/project/service"; +import { getResponsesByContactId } from "@/lib/response/service"; +import { getSurveys } from "@/lib/survey/service"; +import { getUser } from "@/lib/user/service"; +import { findMatchingLocale } from "@/lib/utils/locale"; +import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; +import { getTranslate } from "@/tolgee/server"; import { ResponseSection } from "./response-section"; vi.mock("@/lib/project/service", () => ({ diff --git a/apps/web/modules/ee/contacts/[contactId]/components/response-section.tsx b/apps/web/modules/ee/contacts/[contactId]/components/response-section.tsx index c447a832f2..20f6e884cb 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/response-section.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/response-section.tsx @@ -1,3 +1,7 @@ +import { getServerSession } from "next-auth"; +import { TEnvironment } from "@formbricks/types/environment"; +import { TSurvey } from "@formbricks/types/surveys/types"; +import { TTag } from "@formbricks/types/tags"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { getResponsesByContactId } from "@/lib/response/service"; import { getSurveys } from "@/lib/survey/service"; @@ -6,10 +10,6 @@ import { findMatchingLocale } from "@/lib/utils/locale"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { TEnvironment } from "@formbricks/types/environment"; -import { TSurvey } from "@formbricks/types/surveys/types"; -import { TTag } from "@formbricks/types/tags"; import { ResponseTimeline } from "./response-timeline"; interface ResponseSectionProps { diff --git a/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.test.tsx b/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.test.tsx index 532ff786f0..14e77b2d7b 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.test.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.test.tsx @@ -1,4 +1,3 @@ -import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { useTranslate } from "@tolgee/react"; @@ -8,6 +7,7 @@ import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser } from "@formbricks/types/user"; +import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { ResponseTimeline } from "./response-timeline"; vi.mock("@tolgee/react", () => ({ diff --git a/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.tsx b/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.tsx index 4054465c65..0bf67457ee 100644 --- a/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.tsx +++ b/apps/web/modules/ee/contacts/[contactId]/components/response-timeline.tsx @@ -1,6 +1,5 @@ "use client"; -import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { useTranslate } from "@tolgee/react"; import { ArrowDownUpIcon } from "lucide-react"; import { useEffect, useState } from "react"; @@ -9,6 +8,7 @@ import { TResponseWithQuotas } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TTag } from "@formbricks/types/tags"; import { TUser, TUserLocale } from "@formbricks/types/user"; +import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { ResponseFeed } from "./response-feed"; interface ResponseTimelineProps { diff --git a/apps/web/modules/ee/contacts/actions.ts b/apps/web/modules/ee/contacts/actions.ts index 16bdc2caf5..5f4a62ce34 100644 --- a/apps/web/modules/ee/contacts/actions.ts +++ b/apps/web/modules/ee/contacts/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -10,8 +12,6 @@ import { getProjectIdFromEnvironmentId, } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; import { createContactsFromCSV, deleteContact, getContacts } from "./lib/contacts"; import { ZContactCSVAttributeMap, diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/contacts/[userId]/attributes/route.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/contacts/[userId]/attributes/route.ts index e7d1ebb184..1a143c8e60 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/contacts/[userId]/attributes/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/contacts/[userId]/attributes/route.ts @@ -1,12 +1,12 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZJsContactsUpdateAttributeInput } from "@formbricks/types/js"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { updateAttributes } from "@/modules/ee/contacts/lib/attributes"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZJsContactsUpdateAttributeInput } from "@formbricks/types/js"; import { getContactByUserIdWithAttributes } from "./lib/contact"; const validateParams = ( diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/attributes.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/attributes.ts index eeb979853c..bba573651d 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/attributes.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/attributes.ts @@ -1,7 +1,7 @@ -import { validateInputs } from "@/lib/utils/validate"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; +import { validateInputs } from "@/lib/utils/validate"; export const getContactAttributes = reactCache(async (contactId: string): Promise> => { validateInputs([contactId, ZId]); diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.test.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.test.ts index 7ee298c0ca..b73d1463bd 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.test.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.test.ts @@ -1,11 +1,11 @@ -import { getEnvironment } from "@/lib/environment/service"; -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getPersonSegmentIds } from "@/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TEnvironment } from "@formbricks/types/environment"; import { ResourceNotFoundError } from "@formbricks/types/errors"; import { TOrganization } from "@formbricks/types/organizations"; +import { getEnvironment } from "@/lib/environment/service"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getPersonSegmentIds } from "@/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments"; import { getContactByUserId } from "./contact"; import { getPersonState } from "./person-state"; diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.ts index 4eddf05bc1..0cfe5b62cc 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/person-state.ts @@ -1,11 +1,11 @@ +import { prisma } from "@formbricks/database"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { TJsPersonState } from "@formbricks/types/js"; import { getEnvironment } from "@/lib/environment/service"; import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { getContactAttributes } from "@/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/attributes"; import { getContactByUserId } from "@/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/contact"; import { getPersonSegmentIds } from "@/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments"; -import { prisma } from "@formbricks/database"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; -import { TJsPersonState } from "@formbricks/types/js"; /** * diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/segments.test.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/segments.test.ts index 304b86c1a5..bb90e8b6b4 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/segments.test.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/lib/segments.test.ts @@ -1,14 +1,14 @@ -import { - getPersonSegmentIds, - getSegments, -} from "@/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments"; -import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { DatabaseError } from "@formbricks/types/errors"; import { TBaseFilter } from "@formbricks/types/segment"; +import { + getPersonSegmentIds, + getSegments, +} from "@/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments"; +import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; // Mock the cache functions vi.mock("@/lib/cache", () => ({ diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/route.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/route.ts index 307aaddee0..95aa04b600 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/identify/contacts/[userId]/route.ts @@ -1,11 +1,11 @@ -import { responses } from "@/app/lib/api/response"; -import { transformErrorToDetails } from "@/app/lib/api/validator"; -import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; -import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { NextRequest, userAgent } from "next/server"; import { logger } from "@formbricks/logger"; import { ResourceNotFoundError } from "@formbricks/types/errors"; import { ZJsUserIdentifyInput } from "@formbricks/types/js"; +import { responses } from "@/app/lib/api/response"; +import { transformErrorToDetails } from "@/app/lib/api/validator"; +import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; +import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { getPersonState } from "./lib/person-state"; export const OPTIONS = async (): Promise => { diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments.test.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments.test.ts index 0a6b71d65c..593c3d0781 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments.test.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/segments.test.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; -import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; import { TBaseFilter } from "@formbricks/types/segment"; +import { validateInputs } from "@/lib/utils/validate"; +import { evaluateSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { getPersonSegmentIds, getSegments } from "./segments"; // Mock the cache functions diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.test.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.test.ts index 434aa4ee3b..b157633488 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.test.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.test.ts @@ -1,7 +1,7 @@ -import { updateAttributes } from "@/modules/ee/contacts/lib/attributes"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { updateAttributes } from "@/modules/ee/contacts/lib/attributes"; import { getPersonSegmentIds } from "./segments"; import { updateUser } from "./update-user"; diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.ts index bd6cb78a53..4f150b5c28 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/lib/update-user.ts @@ -1,9 +1,9 @@ -import { cache } from "@/lib/cache"; -import { updateAttributes } from "@/modules/ee/contacts/lib/attributes"; import { createCacheKey } from "@formbricks/cache"; import { prisma } from "@formbricks/database"; import { ResourceNotFoundError } from "@formbricks/types/errors"; import { TJsPersonState } from "@formbricks/types/js"; +import { cache } from "@/lib/cache"; +import { updateAttributes } from "@/modules/ee/contacts/lib/attributes"; import { getPersonSegmentIds } from "./segments"; /** diff --git a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/route.ts b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/route.ts index 9812db9f7c..844e8e2bb1 100644 --- a/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/client/[environmentId]/user/route.ts @@ -1,11 +1,11 @@ -import { responses } from "@/app/lib/api/response"; -import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; -import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { NextRequest, userAgent } from "next/server"; import { logger } from "@formbricks/logger"; import { TContactAttributes } from "@formbricks/types/contact-attribute"; import { ResourceNotFoundError } from "@formbricks/types/errors"; import { TJsPersonState } from "@formbricks/types/js"; +import { responses } from "@/app/lib/api/response"; +import { withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; +import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { updateUser } from "./lib/update-user"; export const OPTIONS = async (): Promise => { diff --git a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts index 1b8ff8ace7..bc65681fc7 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/lib/contact-attribute-key.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { TContactAttributeKeyUpdateInput, ZContactAttributeKeyUpdateInput, diff --git a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts index 301d1d741b..2a1f286f82 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/route.ts @@ -1,10 +1,10 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; import { handleErrorResponse } from "@/app/api/v1/auth"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; import { deleteContactAttributeKey, getContactAttributeKey, diff --git a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.test.ts b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.test.ts index 4cd3f44215..6fa31e494e 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.test.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.test.ts @@ -1,11 +1,11 @@ -import { MAX_ATTRIBUTE_CLASSES_PER_ENVIRONMENT } from "@/lib/constants"; -import { TContactAttributeKeyCreateInput } from "@/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { TContactAttributeKeyType } from "@formbricks/types/contact-attribute-key"; import { DatabaseError, OperationNotAllowedError } from "@formbricks/types/errors"; +import { MAX_ATTRIBUTE_CLASSES_PER_ENVIRONMENT } from "@/lib/constants"; +import { TContactAttributeKeyCreateInput } from "@/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { createContactAttributeKey, getContactAttributeKeys } from "./contact-attribute-keys"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.ts b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.ts index c4b1c8e0b2..b49853d1c4 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/lib/contact-attribute-keys.ts @@ -1,11 +1,11 @@ -import { MAX_ATTRIBUTE_CLASSES_PER_ENVIRONMENT } from "@/lib/constants"; -import { TContactAttributeKeyCreateInput } from "@/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { DatabaseError, OperationNotAllowedError } from "@formbricks/types/errors"; +import { MAX_ATTRIBUTE_CLASSES_PER_ENVIRONMENT } from "@/lib/constants"; +import { TContactAttributeKeyCreateInput } from "@/modules/ee/contacts/api/v1/management/contact-attribute-keys/[contactAttributeKeyId]/types/contact-attribute-keys"; export const getContactAttributeKeys = reactCache( async (environmentIds: string[]): Promise => { diff --git a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/route.ts b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/route.ts index 78657db0c4..81d6b0664d 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contact-attribute-keys/route.ts @@ -1,11 +1,11 @@ +import { NextRequest } from "next/server"; +import { logger } from "@formbricks/logger"; +import { DatabaseError } from "@formbricks/types/errors"; import { responses } from "@/app/lib/api/response"; import { transformErrorToDetails } from "@/app/lib/api/validator"; import { TApiAuditLog, TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; -import { logger } from "@formbricks/logger"; -import { DatabaseError } from "@formbricks/types/errors"; import { ZContactAttributeKeyCreateInput } from "./[contactAttributeKeyId]/types/contact-attribute-keys"; import { createContactAttributeKey, getContactAttributeKeys } from "./lib/contact-attribute-keys"; diff --git a/apps/web/modules/ee/contacts/api/v1/management/contact-attributes/route.ts b/apps/web/modules/ee/contacts/api/v1/management/contact-attributes/route.ts index 21e6d63b37..fbf716da31 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contact-attributes/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contact-attributes/route.ts @@ -1,7 +1,7 @@ +import { DatabaseError } from "@formbricks/types/errors"; import { responses } from "@/app/lib/api/response"; import { TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { DatabaseError } from "@formbricks/types/errors"; import { getContactAttributes } from "./lib/contact-attributes"; export const GET = withV1ApiWrapper({ diff --git a/apps/web/modules/ee/contacts/api/v1/management/contacts/[contactId]/lib/contact.ts b/apps/web/modules/ee/contacts/api/v1/management/contacts/[contactId]/lib/contact.ts index 10f78616c9..4aad78c4a2 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contacts/[contactId]/lib/contact.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contacts/[contactId]/lib/contact.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; -import { TContact } from "@/modules/ee/contacts/types/contact"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { TContact } from "@/modules/ee/contacts/types/contact"; export const getContact = reactCache(async (contactId: string): Promise => { validateInputs([contactId, ZId]); diff --git a/apps/web/modules/ee/contacts/api/v1/management/contacts/lib/contacts.ts b/apps/web/modules/ee/contacts/api/v1/management/contacts/lib/contacts.ts index bbfa16e096..ddd6d1fac3 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contacts/lib/contacts.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contacts/lib/contacts.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; -import { TContact } from "@/modules/ee/contacts/types/contact"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { TContact } from "@/modules/ee/contacts/types/contact"; export const getContacts = reactCache(async (environmentIds: string[]): Promise => { validateInputs([environmentIds, ZId.array()]); diff --git a/apps/web/modules/ee/contacts/api/v1/management/contacts/route.ts b/apps/web/modules/ee/contacts/api/v1/management/contacts/route.ts index 67c7162d0b..3d03a1698d 100644 --- a/apps/web/modules/ee/contacts/api/v1/management/contacts/route.ts +++ b/apps/web/modules/ee/contacts/api/v1/management/contacts/route.ts @@ -1,7 +1,7 @@ +import { DatabaseError } from "@formbricks/types/errors"; import { responses } from "@/app/lib/api/response"; import { TApiKeyAuthentication, withV1ApiWrapper } from "@/app/lib/api/with-api-logging"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { DatabaseError } from "@formbricks/types/errors"; import { getContacts } from "./lib/contacts"; export const GET = withV1ApiWrapper({ diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/contact.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/contact.ts index aa3a89db55..915e6a24a1 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/contact.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/contact.ts @@ -1,10 +1,10 @@ -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; -import { TContactBulkUploadContact } from "@/modules/ee/contacts/types/contact"; import { createId } from "@paralleldrive/cuid2"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; +import { TContactBulkUploadContact } from "@/modules/ee/contacts/types/contact"; export const upsertBulkContacts = async ( contacts: TContactBulkUploadContact[], diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi.ts index d6ca656a74..a3d8acc1cb 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/openapi.ts @@ -1,7 +1,7 @@ -import { managementServer } from "@/modules/api/v2/management/lib/openapi"; -import { ZContactBulkUploadRequest } from "@/modules/ee/contacts/types/contact"; import { z } from "zod"; import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; +import { managementServer } from "@/modules/api/v2/management/lib/openapi"; +import { ZContactBulkUploadRequest } from "@/modules/ee/contacts/types/contact"; const bulkContactEndpoint: ZodOpenApiOperationObject = { operationId: "uploadBulkContacts", diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/tests/contact.test.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/tests/contact.test.ts index 6887314fa2..2862329dfb 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/tests/contact.test.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/bulk/lib/tests/contact.test.ts @@ -1,6 +1,6 @@ -import { upsertBulkContacts } from "@/modules/ee/contacts/api/v2/management/contacts/bulk/lib/contact"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { upsertBulkContacts } from "@/modules/ee/contacts/api/v2/management/contacts/bulk/lib/contact"; // Ensure that createId always returns "mock-id" for predictability vi.mock("@paralleldrive/cuid2", () => ({ diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.test.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.test.ts index 2c6b9e8e68..129eb2cdeb 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.test.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.test.ts @@ -1,7 +1,7 @@ -import { TContactCreateRequest } from "@/modules/ee/contacts/types/contact"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import { TContactCreateRequest } from "@/modules/ee/contacts/types/contact"; import { createContact } from "./contact"; // Mock prisma diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.ts index d61960e0ff..f0d23e2144 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/contact.ts @@ -1,7 +1,7 @@ -import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; -import { TContactCreateRequest, TContactResponse } from "@/modules/ee/contacts/types/contact"; import { prisma } from "@formbricks/database"; import { Result, err, ok } from "@formbricks/types/error-handlers"; +import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; +import { TContactCreateRequest, TContactResponse } from "@/modules/ee/contacts/types/contact"; export const createContact = async ( contactData: TContactCreateRequest diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/openapi.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/openapi.ts index 30f7ac0436..b545b9da23 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/openapi.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/lib/openapi.ts @@ -1,7 +1,7 @@ +import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; import { managementServer } from "@/modules/api/v2/management/lib/openapi"; import { makePartialSchema } from "@/modules/api/v2/types/openapi-response"; import { ZContactCreateRequest, ZContactResponse } from "@/modules/ee/contacts/types/contact"; -import { ZodOpenApiOperationObject, ZodOpenApiPathsObject } from "zod-openapi"; export const createContactEndpoint: ZodOpenApiOperationObject = { operationId: "createContact", diff --git a/apps/web/modules/ee/contacts/api/v2/management/contacts/route.ts b/apps/web/modules/ee/contacts/api/v2/management/contacts/route.ts index bd7f0097ce..c1f2178662 100644 --- a/apps/web/modules/ee/contacts/api/v2/management/contacts/route.ts +++ b/apps/web/modules/ee/contacts/api/v2/management/contacts/route.ts @@ -1,3 +1,4 @@ +import { NextRequest } from "next/server"; import { authenticatedApiClient } from "@/modules/api/v2/auth/authenticated-api-client"; import { responses } from "@/modules/api/v2/lib/response"; import { handleApiError } from "@/modules/api/v2/lib/utils"; @@ -5,7 +6,6 @@ import { createContact } from "@/modules/ee/contacts/api/v2/management/contacts/ import { ZContactCreateRequest } from "@/modules/ee/contacts/types/contact"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; import { hasPermission } from "@/modules/organization/settings/api-keys/lib/utils"; -import { NextRequest } from "next/server"; export const POST = async (request: NextRequest) => authenticatedApiClient({ diff --git a/apps/web/modules/ee/contacts/components/contact-data-view.tsx b/apps/web/modules/ee/contacts/components/contact-data-view.tsx index d31be3fd10..1611df1c04 100644 --- a/apps/web/modules/ee/contacts/components/contact-data-view.tsx +++ b/apps/web/modules/ee/contacts/components/contact-data-view.tsx @@ -1,12 +1,12 @@ "use client"; -import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; import { debounce } from "lodash"; import dynamic from "next/dynamic"; import { useEffect, useMemo, useRef, useState } from "react"; import toast from "react-hot-toast"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TEnvironment } from "@formbricks/types/environment"; +import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; import { getContactsAction } from "../actions"; import { TContactTableData, TContactWithAttributes } from "../types/contact"; diff --git a/apps/web/modules/ee/contacts/components/contact-table-column.tsx b/apps/web/modules/ee/contacts/components/contact-table-column.tsx index e10e92cfb2..4dd4fa5d1d 100644 --- a/apps/web/modules/ee/contacts/components/contact-table-column.tsx +++ b/apps/web/modules/ee/contacts/components/contact-table-column.tsx @@ -1,9 +1,9 @@ "use client"; +import { ColumnDef } from "@tanstack/react-table"; import { getSelectionColumn } from "@/modules/ui/components/data-table"; import { HighlightedText } from "@/modules/ui/components/highlighted-text"; import { IdBadge } from "@/modules/ui/components/id-badge"; -import { ColumnDef } from "@tanstack/react-table"; import { TContactTableData } from "../types/contact"; export const generateContactTableColumns = ( diff --git a/apps/web/modules/ee/contacts/components/contacts-secondary-navigation.tsx b/apps/web/modules/ee/contacts/components/contacts-secondary-navigation.tsx index 7d24800000..02bf93eab6 100644 --- a/apps/web/modules/ee/contacts/components/contacts-secondary-navigation.tsx +++ b/apps/web/modules/ee/contacts/components/contacts-secondary-navigation.tsx @@ -1,7 +1,7 @@ +import { TProject } from "@formbricks/types/project"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { getTranslate } from "@/tolgee/server"; -import { TProject } from "@formbricks/types/project"; interface PersonSecondaryNavigationProps { activeId: string; diff --git a/apps/web/modules/ee/contacts/components/contacts-table.tsx b/apps/web/modules/ee/contacts/components/contacts-table.tsx index ffe1fba3b2..669d18e4ad 100644 --- a/apps/web/modules/ee/contacts/components/contacts-table.tsx +++ b/apps/web/modules/ee/contacts/components/contacts-table.tsx @@ -1,17 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { deleteContactAction } from "@/modules/ee/contacts/actions"; -import { Button } from "@/modules/ui/components/button"; -import { - DataTableHeader, - DataTableSettingsModal, - DataTableToolbar, -} from "@/modules/ui/components/data-table"; -import { getCommonPinningStyles } from "@/modules/ui/components/data-table/lib/utils"; -import { SearchBar } from "@/modules/ui/components/search-bar"; -import { Skeleton } from "@/modules/ui/components/skeleton"; -import { Table, TableBody, TableCell, TableHeader, TableRow } from "@/modules/ui/components/table"; import { DndContext, type DragEndEvent, @@ -29,6 +17,18 @@ import { VisibilityState, flexRender, getCoreRowModel, useReactTable } from "@ta import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; import { useEffect, useMemo, useState } from "react"; +import { cn } from "@/lib/cn"; +import { deleteContactAction } from "@/modules/ee/contacts/actions"; +import { Button } from "@/modules/ui/components/button"; +import { + DataTableHeader, + DataTableSettingsModal, + DataTableToolbar, +} from "@/modules/ui/components/data-table"; +import { getCommonPinningStyles } from "@/modules/ui/components/data-table/lib/utils"; +import { SearchBar } from "@/modules/ui/components/search-bar"; +import { Skeleton } from "@/modules/ui/components/skeleton"; +import { Table, TableBody, TableCell, TableHeader, TableRow } from "@/modules/ui/components/table"; import { TContactTableData } from "../types/contact"; import { generateContactTableColumns } from "./contact-table-column"; diff --git a/apps/web/modules/ee/contacts/components/upload-contacts-attribute-combobox.tsx b/apps/web/modules/ee/contacts/components/upload-contacts-attribute-combobox.tsx index caa92a1867..8de54bc2f5 100644 --- a/apps/web/modules/ee/contacts/components/upload-contacts-attribute-combobox.tsx +++ b/apps/web/modules/ee/contacts/components/upload-contacts-attribute-combobox.tsx @@ -1,5 +1,7 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useEffect } from "react"; import { Button } from "@/modules/ui/components/button"; import { Command, @@ -9,8 +11,6 @@ import { CommandList, } from "@/modules/ui/components/command"; import { Popover, PopoverContent, PopoverTrigger } from "@/modules/ui/components/popover"; -import { useTranslate } from "@tolgee/react"; -import { useEffect } from "react"; type Key = { label: string; diff --git a/apps/web/modules/ee/contacts/components/upload-contacts-attribute.tsx b/apps/web/modules/ee/contacts/components/upload-contacts-attribute.tsx index aa532ab534..420b319b13 100644 --- a/apps/web/modules/ee/contacts/components/upload-contacts-attribute.tsx +++ b/apps/web/modules/ee/contacts/components/upload-contacts-attribute.tsx @@ -1,11 +1,11 @@ "use client"; -import { UploadContactsAttributeCombobox } from "@/modules/ee/contacts/components/upload-contacts-attribute-combobox"; -import { Badge } from "@/modules/ui/components/badge"; import { createId } from "@paralleldrive/cuid2"; import { useTranslate } from "@tolgee/react"; import { useEffect, useMemo, useState } from "react"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import { UploadContactsAttributeCombobox } from "@/modules/ee/contacts/components/upload-contacts-attribute-combobox"; +import { Badge } from "@/modules/ui/components/badge"; interface UploadContactsAttributesProps { attributeMap: Record; diff --git a/apps/web/modules/ee/contacts/layout.tsx b/apps/web/modules/ee/contacts/layout.tsx index f9d5b029d3..dcc0507c4a 100644 --- a/apps/web/modules/ee/contacts/layout.tsx +++ b/apps/web/modules/ee/contacts/layout.tsx @@ -1,3 +1,6 @@ +import { getServerSession } from "next-auth"; +import { redirect } from "next/navigation"; +import { AuthorizationError } from "@formbricks/types/errors"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getAccessFlags } from "@/lib/membership/utils"; @@ -5,9 +8,6 @@ import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { getProjectByEnvironmentId } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { redirect } from "next/navigation"; -import { AuthorizationError } from "@formbricks/types/errors"; const ConfigLayout = async (props) => { const params = await props.params; diff --git a/apps/web/modules/ee/contacts/lib/attributes.test.ts b/apps/web/modules/ee/contacts/lib/attributes.test.ts index 60584743cc..f340e18d8f 100644 --- a/apps/web/modules/ee/contacts/lib/attributes.test.ts +++ b/apps/web/modules/ee/contacts/lib/attributes.test.ts @@ -1,8 +1,8 @@ -import { getContactAttributeKeys } from "@/modules/ee/contacts/lib/contact-attribute-keys"; -import { hasEmailAttribute } from "@/modules/ee/contacts/lib/contact-attributes"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import { getContactAttributeKeys } from "@/modules/ee/contacts/lib/contact-attribute-keys"; +import { hasEmailAttribute } from "@/modules/ee/contacts/lib/contact-attributes"; import { updateAttributes } from "./attributes"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/ee/contacts/lib/attributes.ts b/apps/web/modules/ee/contacts/lib/attributes.ts index 394ce5a507..ba216df064 100644 --- a/apps/web/modules/ee/contacts/lib/attributes.ts +++ b/apps/web/modules/ee/contacts/lib/attributes.ts @@ -1,10 +1,10 @@ +import { prisma } from "@formbricks/database"; +import { ZId, ZString } from "@formbricks/types/common"; +import { TContactAttributes, ZContactAttributes } from "@formbricks/types/contact-attribute"; import { MAX_ATTRIBUTE_CLASSES_PER_ENVIRONMENT } from "@/lib/constants"; import { validateInputs } from "@/lib/utils/validate"; import { getContactAttributeKeys } from "@/modules/ee/contacts/lib/contact-attribute-keys"; import { hasEmailAttribute } from "@/modules/ee/contacts/lib/contact-attributes"; -import { prisma } from "@formbricks/database"; -import { ZId, ZString } from "@formbricks/types/common"; -import { TContactAttributes, ZContactAttributes } from "@formbricks/types/contact-attribute"; export const updateAttributes = async ( contactId: string, diff --git a/apps/web/modules/ee/contacts/lib/contact-attributes.ts b/apps/web/modules/ee/contacts/lib/contact-attributes.ts index f236601b48..bf9d0bad08 100644 --- a/apps/web/modules/ee/contacts/lib/contact-attributes.ts +++ b/apps/web/modules/ee/contacts/lib/contact-attributes.ts @@ -1,4 +1,3 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -6,6 +5,7 @@ import { ZId } from "@formbricks/types/common"; import { TContactAttributes } from "@formbricks/types/contact-attribute"; import { DatabaseError } from "@formbricks/types/errors"; import { ZUserEmail } from "@formbricks/types/user"; +import { validateInputs } from "@/lib/utils/validate"; const selectContactAttribute = { value: true, diff --git a/apps/web/modules/ee/contacts/lib/contact-survey-link.test.ts b/apps/web/modules/ee/contacts/lib/contact-survey-link.test.ts index 0699095e2c..0249313b11 100644 --- a/apps/web/modules/ee/contacts/lib/contact-survey-link.test.ts +++ b/apps/web/modules/ee/contacts/lib/contact-survey-link.test.ts @@ -1,11 +1,11 @@ +import jwt from "jsonwebtoken"; +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { ENCRYPTION_KEY } from "@/lib/constants"; import * as crypto from "@/lib/crypto"; import { getPublicDomain } from "@/lib/getPublicUrl"; import { generateSurveySingleUseId } from "@/lib/utils/single-use-surveys"; import { getSurvey } from "@/modules/survey/lib/survey"; -import jwt from "jsonwebtoken"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { TSurvey } from "@formbricks/types/surveys/types"; import * as contactSurveyLink from "./contact-survey-link"; // Mock all modules needed (this gets hoisted to the top of the file) diff --git a/apps/web/modules/ee/contacts/lib/contact-survey-link.ts b/apps/web/modules/ee/contacts/lib/contact-survey-link.ts index 8ec376096d..bd57efc230 100644 --- a/apps/web/modules/ee/contacts/lib/contact-survey-link.ts +++ b/apps/web/modules/ee/contacts/lib/contact-survey-link.ts @@ -1,12 +1,12 @@ +import jwt from "jsonwebtoken"; +import { logger } from "@formbricks/logger"; +import { Result, err, ok } from "@formbricks/types/error-handlers"; import { ENCRYPTION_KEY } from "@/lib/constants"; import { symmetricDecrypt, symmetricEncrypt } from "@/lib/crypto"; import { getPublicDomain } from "@/lib/getPublicUrl"; import { generateSurveySingleUseId } from "@/lib/utils/single-use-surveys"; import { ApiErrorResponseV2 } from "@/modules/api/v2/types/api-error"; import { getSurvey } from "@/modules/survey/lib/survey"; -import jwt from "jsonwebtoken"; -import { logger } from "@formbricks/logger"; -import { Result, err, ok } from "@formbricks/types/error-handlers"; // Creates an encrypted personalized survey link for a contact export const getContactSurveyLink = async ( diff --git a/apps/web/modules/ee/contacts/lib/contacts.ts b/apps/web/modules/ee/contacts/lib/contacts.ts index a6a2a6bf0b..f5cc893b28 100644 --- a/apps/web/modules/ee/contacts/lib/contacts.ts +++ b/apps/web/modules/ee/contacts/lib/contacts.ts @@ -1,15 +1,15 @@ import "server-only"; -import { ITEMS_PER_PAGE } from "@/lib/constants"; -import { validateInputs } from "@/lib/utils/validate"; -import { getContactSurveyLink } from "@/modules/ee/contacts/lib/contact-survey-link"; -import { segmentFilterToPrismaQuery } from "@/modules/ee/contacts/segments/lib/filter/prisma-query"; -import { getSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { ZId, ZOptionalNumber, ZOptionalString } from "@formbricks/types/common"; import { DatabaseError, ValidationError } from "@formbricks/types/errors"; +import { ITEMS_PER_PAGE } from "@/lib/constants"; +import { validateInputs } from "@/lib/utils/validate"; +import { getContactSurveyLink } from "@/modules/ee/contacts/lib/contact-survey-link"; +import { segmentFilterToPrismaQuery } from "@/modules/ee/contacts/segments/lib/filter/prisma-query"; +import { getSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { TContact, TContactWithAttributes, diff --git a/apps/web/modules/ee/contacts/lib/utils.test.ts b/apps/web/modules/ee/contacts/lib/utils.test.ts index d102e6a1f2..54fd9ff413 100644 --- a/apps/web/modules/ee/contacts/lib/utils.test.ts +++ b/apps/web/modules/ee/contacts/lib/utils.test.ts @@ -1,5 +1,5 @@ -import { TTransformPersonInput } from "@/modules/ee/contacts/types/contact"; import { describe, expect, test } from "vitest"; +import { TTransformPersonInput } from "@/modules/ee/contacts/types/contact"; import { convertPrismaContactAttributes, getContactIdentifier, transformPrismaContact } from "./utils"; const mockPrismaAttributes = [ diff --git a/apps/web/modules/ee/contacts/lib/utils.ts b/apps/web/modules/ee/contacts/lib/utils.ts index 2f15f72595..f162b8d7b9 100644 --- a/apps/web/modules/ee/contacts/lib/utils.ts +++ b/apps/web/modules/ee/contacts/lib/utils.ts @@ -1,6 +1,6 @@ -import { TContactWithAttributes, TTransformPersonInput } from "@/modules/ee/contacts/types/contact"; import { Prisma } from "@prisma/client"; import { TContactAttributes } from "@formbricks/types/contact-attribute"; +import { TContactWithAttributes, TTransformPersonInput } from "@/modules/ee/contacts/types/contact"; export const getContactIdentifier = (contactAttributes: TContactAttributes | null): string => { return contactAttributes?.email ?? contactAttributes?.userId ?? ""; diff --git a/apps/web/modules/ee/contacts/segments/actions.ts b/apps/web/modules/ee/contacts/segments/actions.ts index 136c213080..82725f9a4a 100644 --- a/apps/web/modules/ee/contacts/segments/actions.ts +++ b/apps/web/modules/ee/contacts/segments/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { ZSegmentCreateInput, ZSegmentFilters, ZSegmentUpdateInput } from "@formbricks/types/segment"; import { getOrganization } from "@/lib/organization/service"; import { loadNewSegmentInSurvey } from "@/lib/survey/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; @@ -26,10 +30,6 @@ import { updateSegment, } from "@/modules/ee/contacts/segments/lib/segments"; import { getIsContactsEnabled } from "@/modules/ee/license-check/lib/utils"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { ZSegmentCreateInput, ZSegmentFilters, ZSegmentUpdateInput } from "@formbricks/types/segment"; const checkAdvancedTargetingPermission = async (organizationId: string) => { const organization = await getOrganization(organizationId); diff --git a/apps/web/modules/ee/contacts/segments/components/add-filter-modal.test.tsx b/apps/web/modules/ee/contacts/segments/components/add-filter-modal.test.tsx index 65158153ce..e12dbac82d 100644 --- a/apps/web/modules/ee/contacts/segments/components/add-filter-modal.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/add-filter-modal.test.tsx @@ -1,10 +1,10 @@ -import { AddFilterModal } from "@/modules/ee/contacts/segments/components/add-filter-modal"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; // Added waitFor import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; +import { AddFilterModal } from "@/modules/ee/contacts/segments/components/add-filter-modal"; // Mock the Dialog components vi.mock("@/modules/ui/components/dialog", () => ({ diff --git a/apps/web/modules/ee/contacts/segments/components/add-filter-modal.tsx b/apps/web/modules/ee/contacts/segments/components/add-filter-modal.tsx index ea3040fe6d..b78103a04b 100644 --- a/apps/web/modules/ee/contacts/segments/components/add-filter-modal.tsx +++ b/apps/web/modules/ee/contacts/segments/components/add-filter-modal.tsx @@ -1,9 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle } from "@/modules/ui/components/dialog"; -import { Input } from "@/modules/ui/components/input"; -import { TabBar } from "@/modules/ui/components/tab-bar"; import { createId } from "@paralleldrive/cuid2"; import { useTranslate } from "@tolgee/react"; import { FingerprintIcon, MonitorSmartphoneIcon, TagIcon, Users2Icon } from "lucide-react"; @@ -15,6 +11,10 @@ import type { TSegmentAttributeFilter, TSegmentPersonFilter, } from "@formbricks/types/segment"; +import { cn } from "@/lib/cn"; +import { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle } from "@/modules/ui/components/dialog"; +import { Input } from "@/modules/ui/components/input"; +import { TabBar } from "@/modules/ui/components/tab-bar"; import AttributeTabContent from "./attribute-tab-content"; import FilterButton from "./filter-button"; diff --git a/apps/web/modules/ee/contacts/segments/components/create-segment-modal.test.tsx b/apps/web/modules/ee/contacts/segments/components/create-segment-modal.test.tsx index d896e5b248..ced1ecc690 100644 --- a/apps/web/modules/ee/contacts/segments/components/create-segment-modal.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/create-segment-modal.test.tsx @@ -1,6 +1,3 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; -import { CreateSegmentModal } from "@/modules/ee/contacts/segments/components/create-segment-modal"; import { cleanup, render, screen, waitFor, within } from "@testing-library/react"; // Import within import userEvent from "@testing-library/user-event"; @@ -9,6 +6,9 @@ import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; +import { CreateSegmentModal } from "@/modules/ee/contacts/segments/components/create-segment-modal"; // Mock dependencies vi.mock("react-hot-toast", () => ({ diff --git a/apps/web/modules/ee/contacts/segments/components/create-segment-modal.tsx b/apps/web/modules/ee/contacts/segments/components/create-segment-modal.tsx index f7706d4d5d..0b3b4e8cbe 100644 --- a/apps/web/modules/ee/contacts/segments/components/create-segment-modal.tsx +++ b/apps/web/modules/ee/contacts/segments/components/create-segment-modal.tsx @@ -1,5 +1,13 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { FilterIcon, PlusIcon, UsersIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useMemo, useState } from "react"; +import toast from "react-hot-toast"; +import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import type { TBaseFilter, TSegment } from "@formbricks/types/segment"; +import { ZSegmentFilters } from "@formbricks/types/segment"; import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; @@ -14,14 +22,6 @@ import { DialogTitle, } from "@/modules/ui/components/dialog"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { FilterIcon, PlusIcon, UsersIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useMemo, useState } from "react"; -import toast from "react-hot-toast"; -import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; -import type { TBaseFilter, TSegment } from "@formbricks/types/segment"; -import { ZSegmentFilters } from "@formbricks/types/segment"; import { AddFilterModal } from "./add-filter-modal"; import { SegmentEditor } from "./segment-editor"; diff --git a/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.test.tsx b/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.test.tsx index c279b44978..df822dce82 100644 --- a/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.test.tsx @@ -1,8 +1,8 @@ -import { EditSegmentModal } from "@/modules/ee/contacts/segments/components/edit-segment-modal"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSegmentWithSurveyNames } from "@formbricks/types/segment"; +import { EditSegmentModal } from "@/modules/ee/contacts/segments/components/edit-segment-modal"; // Mock child components vi.mock("@/modules/ee/contacts/segments/components/segment-settings", () => ({ diff --git a/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.tsx b/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.tsx index b86d17efb7..7e7df7eac6 100644 --- a/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.tsx +++ b/apps/web/modules/ee/contacts/segments/components/edit-segment-modal.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { UsersIcon } from "lucide-react"; +import { useEffect, useState } from "react"; +import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import { TSegment, TSegmentWithSurveyNames } from "@formbricks/types/segment"; import { SegmentSettings } from "@/modules/ee/contacts/segments/components/segment-settings"; import { Dialog, @@ -9,11 +14,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { UsersIcon } from "lucide-react"; -import { useEffect, useState } from "react"; -import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; -import { TSegment, TSegmentWithSurveyNames } from "@formbricks/types/segment"; import { SegmentActivityTab } from "./segment-activity-tab"; interface EditSegmentModalProps { diff --git a/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.test.tsx b/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.test.tsx index c17a193c2d..2931ec3570 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.test.tsx @@ -1,8 +1,8 @@ -import { convertDateTimeStringShort } from "@/lib/time"; -import { SegmentActivityTab } from "@/modules/ee/contacts/segments/components/segment-activity-tab"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSegment } from "@formbricks/types/segment"; +import { convertDateTimeStringShort } from "@/lib/time"; +import { SegmentActivityTab } from "@/modules/ee/contacts/segments/components/segment-activity-tab"; const mockSegmentBase: TSegment & { activeSurveys: string[]; inactiveSurveys: string[] } = { id: "seg123", diff --git a/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.tsx b/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.tsx index e081c1b718..6b262132a4 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-activity-tab.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { TSegment } from "@formbricks/types/segment"; import { convertDateTimeStringShort } from "@/lib/time"; import { IdBadge } from "@/modules/ui/components/id-badge"; import { Label } from "@/modules/ui/components/label"; -import { useTranslate } from "@tolgee/react"; -import { TSegment } from "@formbricks/types/segment"; interface SegmentActivityTabProps { environmentId: string; diff --git a/apps/web/modules/ee/contacts/segments/components/segment-editor.test.tsx b/apps/web/modules/ee/contacts/segments/components/segment-editor.test.tsx index f2ca8a9f9d..aaeb678ef5 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-editor.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-editor.test.tsx @@ -1,9 +1,9 @@ -import * as segmentUtils from "@/modules/ee/contacts/segments/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TBaseFilter, TBaseFilters, TSegment } from "@formbricks/types/segment"; +import * as segmentUtils from "@/modules/ee/contacts/segments/lib/utils"; import { SegmentEditor } from "./segment-editor"; // Mock child components diff --git a/apps/web/modules/ee/contacts/segments/components/segment-editor.tsx b/apps/web/modules/ee/contacts/segments/components/segment-editor.tsx index 5b3ae7e270..9c3119b04a 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-editor.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-editor.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { ArrowDownIcon, ArrowUpIcon, MoreVertical, Trash2 } from "lucide-react"; +import { useState } from "react"; +import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import type { TBaseFilter, TBaseFilters, TSegment, TSegmentConnector } from "@formbricks/types/segment"; import { cn } from "@/lib/cn"; import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { @@ -18,11 +23,6 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; -import { useTranslate } from "@tolgee/react"; -import { ArrowDownIcon, ArrowUpIcon, MoreVertical, Trash2 } from "lucide-react"; -import { useState } from "react"; -import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; -import type { TBaseFilter, TBaseFilters, TSegment, TSegmentConnector } from "@formbricks/types/segment"; import { AddFilterModal } from "./add-filter-modal"; import { SegmentFilter } from "./segment-filter"; diff --git a/apps/web/modules/ee/contacts/segments/components/segment-filter.test.tsx b/apps/web/modules/ee/contacts/segments/components/segment-filter.test.tsx index a7de702ad7..0cde7216c2 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-filter.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-filter.test.tsx @@ -1,5 +1,3 @@ -import { SegmentFilter } from "@/modules/ee/contacts/segments/components/segment-filter"; -import * as segmentUtils from "@/modules/ee/contacts/segments/lib/utils"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -11,6 +9,8 @@ import { TSegmentPersonFilter, TSegmentSegmentFilter, } from "@formbricks/types/segment"; +import { SegmentFilter } from "@/modules/ee/contacts/segments/components/segment-filter"; +import * as segmentUtils from "@/modules/ee/contacts/segments/lib/utils"; // Mock ResizeObserver const ResizeObserverMock = vi.fn(() => ({ diff --git a/apps/web/modules/ee/contacts/segments/components/segment-settings.test.tsx b/apps/web/modules/ee/contacts/segments/components/segment-settings.test.tsx index b14d882985..1038c4e3d7 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-settings.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-settings.test.tsx @@ -1,10 +1,10 @@ -import * as helper from "@/lib/utils/helper"; -import * as actions from "@/modules/ee/contacts/segments/actions"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { SafeParseReturnType } from "zod"; import { TBaseFilters, ZSegmentFilters } from "@formbricks/types/segment"; +import * as helper from "@/lib/utils/helper"; +import * as actions from "@/modules/ee/contacts/segments/actions"; import { SegmentSettings } from "./segment-settings"; // Mock dependencies diff --git a/apps/web/modules/ee/contacts/segments/components/segment-settings.tsx b/apps/web/modules/ee/contacts/segments/components/segment-settings.tsx index fb72f3ae1f..278b64cb07 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-settings.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-settings.tsx @@ -1,12 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { structuredClone } from "@/lib/pollyfills/structuredClone"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { deleteSegmentAction, updateSegmentAction } from "@/modules/ee/contacts/segments/actions"; -import { Button } from "@/modules/ui/components/button"; -import { ConfirmDeleteSegmentModal } from "@/modules/ui/components/confirm-delete-segment-modal"; -import { Input } from "@/modules/ui/components/input"; import { useTranslate } from "@tolgee/react"; import { FilterIcon, Trash2 } from "lucide-react"; import { useRouter } from "next/navigation"; @@ -15,6 +8,13 @@ import toast from "react-hot-toast"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import type { TBaseFilter, TSegment, TSegmentWithSurveyNames } from "@formbricks/types/segment"; import { ZSegmentFilters } from "@formbricks/types/segment"; +import { cn } from "@/lib/cn"; +import { structuredClone } from "@/lib/pollyfills/structuredClone"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { deleteSegmentAction, updateSegmentAction } from "@/modules/ee/contacts/segments/actions"; +import { Button } from "@/modules/ui/components/button"; +import { ConfirmDeleteSegmentModal } from "@/modules/ui/components/confirm-delete-segment-modal"; +import { Input } from "@/modules/ui/components/input"; import { AddFilterModal } from "./add-filter-modal"; import { SegmentEditor } from "./segment-editor"; diff --git a/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.test.tsx b/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.test.tsx index 898332707f..9a1088e587 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.test.tsx @@ -1,9 +1,9 @@ -import { getSurveysBySegmentId } from "@/lib/survey/service"; import { cleanup } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getSurveysBySegmentId } from "@/lib/survey/service"; import { SegmentTableDataRow } from "./segment-table-data-row"; import { SegmentTableDataRowContainer } from "./segment-table-data-row-container"; diff --git a/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.tsx b/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.tsx index 508964932d..8e33b7089e 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-table-data-row-container.tsx @@ -1,6 +1,6 @@ -import { getSurveysBySegmentId } from "@/lib/survey/service"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; +import { getSurveysBySegmentId } from "@/lib/survey/service"; import { SegmentTableDataRow } from "./segment-table-data-row"; type TSegmentTableDataRowProps = { diff --git a/apps/web/modules/ee/contacts/segments/components/segment-table.tsx b/apps/web/modules/ee/contacts/segments/components/segment-table.tsx index 27de910359..5281bd0be2 100644 --- a/apps/web/modules/ee/contacts/segments/components/segment-table.tsx +++ b/apps/web/modules/ee/contacts/segments/components/segment-table.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; +import { getTranslate } from "@/tolgee/server"; import { SegmentTableDataRowContainer } from "./segment-table-data-row-container"; type TSegmentTableProps = { diff --git a/apps/web/modules/ee/contacts/segments/components/targeting-card.test.tsx b/apps/web/modules/ee/contacts/segments/components/targeting-card.test.tsx index 6291d2cb8e..6bfee2baae 100644 --- a/apps/web/modules/ee/contacts/segments/components/targeting-card.test.tsx +++ b/apps/web/modules/ee/contacts/segments/components/targeting-card.test.tsx @@ -1,10 +1,10 @@ -import { TargetingCard } from "@/modules/ee/contacts/segments/components/targeting-card"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { TargetingCard } from "@/modules/ee/contacts/segments/components/targeting-card"; // Mock Data (Moved from mocks.ts) const mockInitialSegment: TSegment = { diff --git a/apps/web/modules/ee/contacts/segments/components/targeting-card.tsx b/apps/web/modules/ee/contacts/segments/components/targeting-card.tsx index 8aa853dffd..549e37bc6e 100644 --- a/apps/web/modules/ee/contacts/segments/components/targeting-card.tsx +++ b/apps/web/modules/ee/contacts/segments/components/targeting-card.tsx @@ -1,5 +1,20 @@ "use client"; +import * as Collapsible from "@radix-ui/react-collapsible"; +import { useTranslate } from "@tolgee/react"; +import { AlertCircle, CheckIcon, ChevronDownIcon, ChevronUpIcon, PencilIcon } from "lucide-react"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; +import React, { useEffect, useMemo, useState } from "react"; +import toast from "react-hot-toast"; +import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import type { + TBaseFilter, + TSegment, + TSegmentCreateInput, + TSegmentUpdateInput, +} from "@formbricks/types/segment"; +import type { TSurvey } from "@formbricks/types/surveys/types"; import { cn } from "@/lib/cn"; import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { @@ -16,21 +31,6 @@ import { LoadSegmentModal } from "@/modules/ui/components/load-segment-modal"; import { SaveAsNewSegmentModal } from "@/modules/ui/components/save-as-new-segment-modal"; import { SegmentTitle } from "@/modules/ui/components/segment-title"; import { TargetingIndicator } from "@/modules/ui/components/targeting-indicator"; -import * as Collapsible from "@radix-ui/react-collapsible"; -import { useTranslate } from "@tolgee/react"; -import { AlertCircle, CheckIcon, ChevronDownIcon, ChevronUpIcon, PencilIcon } from "lucide-react"; -import Link from "next/link"; -import { useRouter } from "next/navigation"; -import React, { useEffect, useMemo, useState } from "react"; -import toast from "react-hot-toast"; -import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; -import type { - TBaseFilter, - TSegment, - TSegmentCreateInput, - TSegmentUpdateInput, -} from "@formbricks/types/segment"; -import type { TSurvey } from "@formbricks/types/surveys/types"; import { AddFilterModal } from "./add-filter-modal"; import { SegmentEditor } from "./segment-editor"; diff --git a/apps/web/modules/ee/contacts/segments/lib/filter/prisma-query.ts b/apps/web/modules/ee/contacts/segments/lib/filter/prisma-query.ts index 0100553e8e..ba3ffa4c1e 100644 --- a/apps/web/modules/ee/contacts/segments/lib/filter/prisma-query.ts +++ b/apps/web/modules/ee/contacts/segments/lib/filter/prisma-query.ts @@ -1,4 +1,3 @@ -import { isResourceFilter } from "@/modules/ee/contacts/segments/lib/utils"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { logger } from "@formbricks/logger"; @@ -11,6 +10,7 @@ import { TSegmentPersonFilter, TSegmentSegmentFilter, } from "@formbricks/types/segment"; +import { isResourceFilter } from "@/modules/ee/contacts/segments/lib/utils"; import { getSegment } from "../segments"; // Type for the result of the segment filter to prisma query generation diff --git a/apps/web/modules/ee/contacts/segments/lib/helper.test.ts b/apps/web/modules/ee/contacts/segments/lib/helper.test.ts index 6a78b9fd98..86418a6b1e 100644 --- a/apps/web/modules/ee/contacts/segments/lib/helper.test.ts +++ b/apps/web/modules/ee/contacts/segments/lib/helper.test.ts @@ -1,8 +1,8 @@ -import { checkForRecursiveSegmentFilter } from "@/modules/ee/contacts/segments/lib/helper"; -import { getSegment } from "@/modules/ee/contacts/segments/lib/segments"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { InvalidInputError } from "@formbricks/types/errors"; import { TBaseFilters, TSegment } from "@formbricks/types/segment"; +import { checkForRecursiveSegmentFilter } from "@/modules/ee/contacts/segments/lib/helper"; +import { getSegment } from "@/modules/ee/contacts/segments/lib/segments"; // Mock dependencies vi.mock("@/modules/ee/contacts/segments/lib/segments", () => ({ diff --git a/apps/web/modules/ee/contacts/segments/lib/helper.ts b/apps/web/modules/ee/contacts/segments/lib/helper.ts index c0918e0a40..f31b71a106 100644 --- a/apps/web/modules/ee/contacts/segments/lib/helper.ts +++ b/apps/web/modules/ee/contacts/segments/lib/helper.ts @@ -1,7 +1,7 @@ -import { getSegment } from "@/modules/ee/contacts/segments/lib/segments"; -import { isResourceFilter } from "@/modules/ee/contacts/segments/lib/utils"; import { InvalidInputError } from "@formbricks/types/errors"; import { TBaseFilters } from "@formbricks/types/segment"; +import { getSegment } from "@/modules/ee/contacts/segments/lib/segments"; +import { isResourceFilter } from "@/modules/ee/contacts/segments/lib/utils"; /** * Checks if a segment filter contains a recursive reference to itself diff --git a/apps/web/modules/ee/contacts/segments/lib/segments.test.ts b/apps/web/modules/ee/contacts/segments/lib/segments.test.ts index 9dc904c05b..f1ed2792e6 100644 --- a/apps/web/modules/ee/contacts/segments/lib/segments.test.ts +++ b/apps/web/modules/ee/contacts/segments/lib/segments.test.ts @@ -1,6 +1,3 @@ -import { getEnvironment } from "@/lib/environment/service"; -import { getSurvey } from "@/lib/survey/service"; -import { validateInputs } from "@/lib/utils/validate"; import { createId } from "@paralleldrive/cuid2"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; @@ -20,6 +17,9 @@ import { TSegmentUpdateInput, } from "@formbricks/types/segment"; import { TSegmentFilter } from "@formbricks/types/segment"; +import { getEnvironment } from "@/lib/environment/service"; +import { getSurvey } from "@/lib/survey/service"; +import { validateInputs } from "@/lib/utils/validate"; import { PrismaSegment, cloneSegment, diff --git a/apps/web/modules/ee/contacts/segments/lib/segments.ts b/apps/web/modules/ee/contacts/segments/lib/segments.ts index dd33fc5524..dc3990226a 100644 --- a/apps/web/modules/ee/contacts/segments/lib/segments.ts +++ b/apps/web/modules/ee/contacts/segments/lib/segments.ts @@ -1,6 +1,3 @@ -import { getSurvey } from "@/lib/survey/service"; -import { validateInputs } from "@/lib/utils/validate"; -import { isResourceFilter, searchForAttributeKeyInSegment } from "@/modules/ee/contacts/segments/lib/utils"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -29,6 +26,9 @@ import { ZSegmentFilters, ZSegmentUpdateInput, } from "@formbricks/types/segment"; +import { getSurvey } from "@/lib/survey/service"; +import { validateInputs } from "@/lib/utils/validate"; +import { isResourceFilter, searchForAttributeKeyInSegment } from "@/modules/ee/contacts/segments/lib/utils"; export type PrismaSegment = Prisma.SegmentGetPayload<{ include: { diff --git a/apps/web/modules/ee/contacts/segments/loading.tsx b/apps/web/modules/ee/contacts/segments/loading.tsx index a2222ab402..bea7b59422 100644 --- a/apps/web/modules/ee/contacts/segments/loading.tsx +++ b/apps/web/modules/ee/contacts/segments/loading.tsx @@ -1,8 +1,8 @@ +import { UsersIcon } from "lucide-react"; import { ContactsSecondaryNavigation } from "@/modules/ee/contacts/components/contacts-secondary-navigation"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { UsersIcon } from "lucide-react"; const Loading = async () => { const t = await getTranslate(); diff --git a/apps/web/modules/ee/contacts/segments/page.test.tsx b/apps/web/modules/ee/contacts/segments/page.test.tsx index cca7bbacd1..7c55d07118 100644 --- a/apps/web/modules/ee/contacts/segments/page.test.tsx +++ b/apps/web/modules/ee/contacts/segments/page.test.tsx @@ -1,4 +1,8 @@ // Import the actual constants module to get its type/shape for mocking +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import { TSegment } from "@formbricks/types/segment"; import * as constants from "@/lib/constants"; import { ContactsSecondaryNavigation } from "@/modules/ee/contacts/components/contacts-secondary-navigation"; import { getContactAttributeKeys } from "@/modules/ee/contacts/lib/contact-attribute-keys"; @@ -10,10 +14,6 @@ import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth" import { PageHeader } from "@/modules/ui/components/page-header"; import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { getTranslate } from "@/tolgee/server"; -import { cleanup, render, screen } from "@testing-library/react"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; -import { TSegment } from "@formbricks/types/segment"; import { CreateSegmentModal } from "./components/create-segment-modal"; import { SegmentsPage } from "./page"; diff --git a/apps/web/modules/ee/languages/loading.tsx b/apps/web/modules/ee/languages/loading.tsx index 0b91146d0d..60b106e6fd 100644 --- a/apps/web/modules/ee/languages/loading.tsx +++ b/apps/web/modules/ee/languages/loading.tsx @@ -1,11 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { LanguageLabels } from "@/modules/ee/multi-language-surveys/components/language-labels"; import { ProjectConfigNavigation } from "@/modules/projects/settings/components/project-config-navigation"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; export const LanguagesLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/ee/license-check/lib/utils.test.ts b/apps/web/modules/ee/license-check/lib/utils.test.ts index 2328ff0e39..0c9860ac64 100644 --- a/apps/web/modules/ee/license-check/lib/utils.test.ts +++ b/apps/web/modules/ee/license-check/lib/utils.test.ts @@ -1,7 +1,7 @@ -import * as constants from "@/lib/constants"; -import { TEnterpriseLicenseFeatures } from "@/modules/ee/license-check/types/enterprise-license"; import { Organization } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import * as constants from "@/lib/constants"; +import { TEnterpriseLicenseFeatures } from "@/modules/ee/license-check/types/enterprise-license"; import * as licenseModule from "./license"; import { getAccessControlPermission, diff --git a/apps/web/modules/ee/license-check/lib/utils.ts b/apps/web/modules/ee/license-check/lib/utils.ts index 5ab7abe0d3..8a1ebfb9e9 100644 --- a/apps/web/modules/ee/license-check/lib/utils.ts +++ b/apps/web/modules/ee/license-check/lib/utils.ts @@ -1,4 +1,5 @@ import "server-only"; +import { Organization } from "@prisma/client"; import { AUDIT_LOG_ENABLED, IS_FORMBRICKS_CLOUD, @@ -6,7 +7,6 @@ import { PROJECT_FEATURE_KEYS, } from "@/lib/constants"; import { TEnterpriseLicenseFeatures } from "@/modules/ee/license-check/types/enterprise-license"; -import { Organization } from "@prisma/client"; import { getEnterpriseLicense, getLicenseFeatures } from "./license"; // Helper function for feature permissions (e.g., removeBranding, whitelabel) diff --git a/apps/web/modules/ee/multi-language-surveys/components/default-language-select.tsx b/apps/web/modules/ee/multi-language-surveys/components/default-language-select.tsx index 09cf8caf2e..0083db06dc 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/default-language-select.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/default-language-select.tsx @@ -1,5 +1,8 @@ "use client"; +import { Language } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import { DefaultTag } from "@/modules/ui/components/default-tag"; import { Label } from "@/modules/ui/components/label"; import { @@ -9,9 +12,6 @@ import { SelectTrigger, SelectValue, } from "@/modules/ui/components/select"; -import { Language } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import type { ConfirmationModalProps } from "./multi-language-card"; interface DefaultLanguageSelectProps { diff --git a/apps/web/modules/ee/multi-language-surveys/components/edit-language.tsx b/apps/web/modules/ee/multi-language-surveys/components/edit-language.tsx index 9ad2cdf890..c2c77e51e0 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/edit-language.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/edit-language.tsx @@ -1,10 +1,5 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { Alert, AlertDescription } from "@/modules/ui/components/alert"; -import { Button } from "@/modules/ui/components/button"; -import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; -import { ModalButton, UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { Language } from "@prisma/client"; import { TFnType, useTranslate } from "@tolgee/react"; import { PlusIcon } from "lucide-react"; @@ -14,6 +9,11 @@ import { toast } from "react-hot-toast"; import { iso639Languages } from "@formbricks/i18n-utils/src/utils"; import type { TProject } from "@formbricks/types/project"; import { TUserLocale } from "@formbricks/types/user"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { Alert, AlertDescription } from "@/modules/ui/components/alert"; +import { Button } from "@/modules/ui/components/button"; +import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; +import { ModalButton, UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { createLanguageAction, deleteLanguageAction, diff --git a/apps/web/modules/ee/multi-language-surveys/components/language-indicator.tsx b/apps/web/modules/ee/multi-language-surveys/components/language-indicator.tsx index deae75c371..968b5feb3a 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/language-indicator.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/language-indicator.tsx @@ -1,8 +1,8 @@ -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; import { ChevronDown } from "lucide-react"; import { useRef, useState } from "react"; import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import type { TSurveyLanguage } from "@formbricks/types/surveys/types"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; interface LanguageIndicatorProps { selectedLanguageCode: string; diff --git a/apps/web/modules/ee/multi-language-surveys/components/language-labels.tsx b/apps/web/modules/ee/multi-language-surveys/components/language-labels.tsx index 6cc9ac8034..397c6463a9 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/language-labels.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/language-labels.tsx @@ -1,9 +1,9 @@ "use client"; -import { Label } from "@/modules/ui/components/label"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { TFnType, useTranslate } from "@tolgee/react"; import { InfoIcon } from "lucide-react"; +import { Label } from "@/modules/ui/components/label"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; export function LanguageLabels() { const { t } = useTranslate(); diff --git a/apps/web/modules/ee/multi-language-surveys/components/language-row.tsx b/apps/web/modules/ee/multi-language-surveys/components/language-row.tsx index f3da260972..09d68483fb 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/language-row.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/language-row.tsx @@ -1,10 +1,10 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { Input } from "@/modules/ui/components/input"; import { Language } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { TUserLocale } from "@formbricks/types/user"; +import { Button } from "@/modules/ui/components/button"; +import { Input } from "@/modules/ui/components/input"; import { LanguageSelect } from "./language-select"; interface LanguageRowProps { diff --git a/apps/web/modules/ee/multi-language-surveys/components/language-select.tsx b/apps/web/modules/ee/multi-language-surveys/components/language-select.tsx index 38d7a9ed4c..094aefdc9e 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/language-select.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/language-select.tsx @@ -1,14 +1,14 @@ "use client"; -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; -import { Button } from "@/modules/ui/components/button"; -import { Input } from "@/modules/ui/components/input"; import { Language } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { ChevronDown } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import { TIso639Language, iso639Languages } from "@formbricks/i18n-utils/src/utils"; import { TUserLocale } from "@formbricks/types/user"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; +import { Button } from "@/modules/ui/components/button"; +import { Input } from "@/modules/ui/components/input"; interface LanguageSelectProps { language: Language; diff --git a/apps/web/modules/ee/multi-language-surveys/components/language-toggle.tsx b/apps/web/modules/ee/multi-language-surveys/components/language-toggle.tsx index b70d11e3db..20037cb85b 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/language-toggle.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/language-toggle.tsx @@ -1,11 +1,11 @@ "use client"; -import { Label } from "@/modules/ui/components/label"; -import { Switch } from "@/modules/ui/components/switch"; import { Language } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { getLanguageLabel } from "@formbricks/i18n-utils/src/utils"; import type { TUserLocale } from "@formbricks/types/user"; +import { Label } from "@/modules/ui/components/label"; +import { Switch } from "@/modules/ui/components/switch"; interface LanguageToggleProps { language: Language; diff --git a/apps/web/modules/ee/multi-language-surveys/components/multi-language-card.tsx b/apps/web/modules/ee/multi-language-surveys/components/multi-language-card.tsx index afb1f491aa..7b949164d3 100644 --- a/apps/web/modules/ee/multi-language-surveys/components/multi-language-card.tsx +++ b/apps/web/modules/ee/multi-language-surveys/components/multi-language-card.tsx @@ -1,13 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { addMultiLanguageLabels, extractLanguageCodes } from "@/lib/i18n/utils"; -import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; -import { Button } from "@/modules/ui/components/button"; -import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; -import { Label } from "@/modules/ui/components/label"; -import { Switch } from "@/modules/ui/components/switch"; -import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { Language } from "@prisma/client"; import * as Collapsible from "@radix-ui/react-collapsible"; @@ -18,6 +10,14 @@ import type { FC } from "react"; import { useEffect, useMemo, useState } from "react"; import type { TSurvey, TSurveyLanguage, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { cn } from "@/lib/cn"; +import { addMultiLanguageLabels, extractLanguageCodes } from "@/lib/i18n/utils"; +import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; +import { Button } from "@/modules/ui/components/button"; +import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; +import { Label } from "@/modules/ui/components/label"; +import { Switch } from "@/modules/ui/components/switch"; +import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { DefaultLanguageSelect } from "./default-language-select"; import { SecondaryLanguageSelect } from "./secondary-language-select"; diff --git a/apps/web/modules/ee/multi-language-surveys/lib/actions.ts b/apps/web/modules/ee/multi-language-surveys/lib/actions.ts index c513052593..1e0f69cfab 100644 --- a/apps/web/modules/ee/multi-language-surveys/lib/actions.ts +++ b/apps/web/modules/ee/multi-language-surveys/lib/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZLanguageInput } from "@formbricks/types/project"; import { createLanguage, deleteLanguage, @@ -18,10 +22,6 @@ import { } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getMultiLanguagePermission } from "@/modules/ee/license-check/lib/utils"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZLanguageInput } from "@formbricks/types/project"; const ZCreateLanguageAction = z.object({ projectId: ZId, diff --git a/apps/web/modules/ee/quotas/actions.ts b/apps/web/modules/ee/quotas/actions.ts index d65a97c56b..7633e69607 100644 --- a/apps/web/modules/ee/quotas/actions.ts +++ b/apps/web/modules/ee/quotas/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { ZSurveyQuotaInput } from "@formbricks/types/quota"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -14,10 +18,6 @@ import { getIsQuotasEnabled } from "@/modules/ee/license-check/lib/utils"; import { getQuotaLinkCountByQuotaId } from "@/modules/ee/quotas/lib/quota-link"; import { createQuota, deleteQuota, updateQuota } from "@/modules/ee/quotas/lib/quotas"; import { getOrganizationBilling } from "@/modules/survey/lib/survey"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { ZSurveyQuotaInput } from "@formbricks/types/quota"; const ZDeleteQuotaAction = z.object({ quotaId: ZId, diff --git a/apps/web/modules/ee/quotas/components/ending-card-selector.tsx b/apps/web/modules/ee/quotas/components/ending-card-selector.tsx index 21912fb3cd..67820e4315 100644 --- a/apps/web/modules/ee/quotas/components/ending-card-selector.tsx +++ b/apps/web/modules/ee/quotas/components/ending-card-selector.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { HandshakeIcon, Undo2Icon } from "lucide-react"; +import { TSurveyEndings } from "@formbricks/types/surveys/types"; import { getLocalizedValue } from "@/lib/i18n/utils"; import { Select, @@ -9,9 +12,6 @@ import { SelectTrigger, SelectValue, } from "@/modules/ui/components/select"; -import { useTranslate } from "@tolgee/react"; -import { HandshakeIcon, Undo2Icon } from "lucide-react"; -import { TSurveyEndings } from "@formbricks/types/surveys/types"; interface EndingCardSelectorProps { endings: TSurveyEndings; diff --git a/apps/web/modules/ee/quotas/components/quota-condition-builder.tsx b/apps/web/modules/ee/quotas/components/quota-condition-builder.tsx index 5e92b21130..92c5374a3f 100644 --- a/apps/web/modules/ee/quotas/components/quota-condition-builder.tsx +++ b/apps/web/modules/ee/quotas/components/quota-condition-builder.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useCallback, useMemo } from "react"; +import { FieldErrors } from "react-hook-form"; +import { TSurveyQuotaInput, TSurveyQuotaLogic } from "@formbricks/types/quota"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { TQuotaConditionGroup, createSharedConditionsFactory, @@ -7,11 +12,6 @@ import { quotaConditionsToGeneric, } from "@/modules/survey/editor/lib/shared-conditions-factory"; import { ConditionsEditor } from "@/modules/ui/components/conditions-editor"; -import { useTranslate } from "@tolgee/react"; -import { useCallback, useMemo } from "react"; -import { FieldErrors } from "react-hook-form"; -import { TSurveyQuotaInput, TSurveyQuotaLogic } from "@formbricks/types/quota"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface QuotaConditionBuilderProps { survey: TSurvey; diff --git a/apps/web/modules/ee/quotas/components/quota-list.tsx b/apps/web/modules/ee/quotas/components/quota-list.tsx index c9e5d7ba17..52d1e0122d 100644 --- a/apps/web/modules/ee/quotas/components/quota-list.tsx +++ b/apps/web/modules/ee/quotas/components/quota-list.tsx @@ -1,11 +1,11 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { Label } from "@/modules/ui/components/label"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { CopyIcon, Trash2Icon } from "lucide-react"; import { TSurveyQuota } from "@formbricks/types/quota"; +import { Button } from "@/modules/ui/components/button"; +import { Label } from "@/modules/ui/components/label"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; interface QuotaListProps { quotas: TSurveyQuota[]; diff --git a/apps/web/modules/ee/quotas/components/quota-modal.test.tsx b/apps/web/modules/ee/quotas/components/quota-modal.test.tsx index e2643cca3f..4015c3eec1 100644 --- a/apps/web/modules/ee/quotas/components/quota-modal.test.tsx +++ b/apps/web/modules/ee/quotas/components/quota-modal.test.tsx @@ -1,10 +1,10 @@ -import { createQuotaAction, updateQuotaAction } from "@/modules/ee/quotas/actions"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { createQuotaAction, updateQuotaAction } from "@/modules/ee/quotas/actions"; import { QuotaModal } from "./quota-modal"; // Mock @paralleldrive/cuid2 diff --git a/apps/web/modules/ee/quotas/components/quota-modal.tsx b/apps/web/modules/ee/quotas/components/quota-modal.tsx index 0e909cceb0..16a017666f 100644 --- a/apps/web/modules/ee/quotas/components/quota-modal.tsx +++ b/apps/web/modules/ee/quotas/components/quota-modal.tsx @@ -1,5 +1,22 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { createId } from "@paralleldrive/cuid2"; +import { useTranslate } from "@tolgee/react"; +import { PieChart, Trash2Icon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useCallback, useEffect, useMemo, useState } from "react"; +import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { + TSurveyQuota, + TSurveyQuotaInput, + TSurveyQuotaLogic, + ZSurveyQuotaAction, + ZSurveyQuotaInput, +} from "@formbricks/types/quota"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createQuotaAction, updateQuotaAction } from "@/modules/ee/quotas/actions"; import { EndingCardSelector } from "@/modules/ee/quotas/components/ending-card-selector"; @@ -33,23 +50,6 @@ import { SelectValue, } from "@/modules/ui/components/select"; import { Switch } from "@/modules/ui/components/switch"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { createId } from "@paralleldrive/cuid2"; -import { useTranslate } from "@tolgee/react"; -import { PieChart, Trash2Icon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useCallback, useEffect, useMemo, useState } from "react"; -import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; -import { - TSurveyQuota, - TSurveyQuotaInput, - TSurveyQuotaLogic, - ZSurveyQuotaAction, - ZSurveyQuotaInput, -} from "@formbricks/types/quota"; -import { TSurvey } from "@formbricks/types/surveys/types"; import { QuotaConditionBuilder } from "./quota-condition-builder"; interface QuotaModalProps { diff --git a/apps/web/modules/ee/quotas/components/quotas-card.test.tsx b/apps/web/modules/ee/quotas/components/quotas-card.test.tsx index ca795313ec..74763d10ed 100644 --- a/apps/web/modules/ee/quotas/components/quotas-card.test.tsx +++ b/apps/web/modules/ee/quotas/components/quotas-card.test.tsx @@ -1,10 +1,10 @@ -import { deleteQuotaAction, getQuotaResponseCountAction } from "@/modules/ee/quotas/actions"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { deleteQuotaAction, getQuotaResponseCountAction } from "@/modules/ee/quotas/actions"; import { QuotasCard } from "./quotas-card"; // Mock server actions diff --git a/apps/web/modules/ee/quotas/components/quotas-card.tsx b/apps/web/modules/ee/quotas/components/quotas-card.tsx index d1346ac765..15631d661c 100644 --- a/apps/web/modules/ee/quotas/components/quotas-card.tsx +++ b/apps/web/modules/ee/quotas/components/quotas-card.tsx @@ -1,5 +1,14 @@ "use client"; +import { useAutoAnimate } from "@formkit/auto-animate/react"; +import * as Collapsible from "@radix-ui/react-collapsible"; +import { TFnType, useTranslate } from "@tolgee/react"; +import { CheckIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import toast from "react-hot-toast"; +import { TSurveyQuota, TSurveyQuotaInput } from "@formbricks/types/quota"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createQuotaAction, @@ -10,15 +19,6 @@ import { Button } from "@/modules/ui/components/button"; import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; -import { useAutoAnimate } from "@formkit/auto-animate/react"; -import * as Collapsible from "@radix-ui/react-collapsible"; -import { TFnType, useTranslate } from "@tolgee/react"; -import { CheckIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import toast from "react-hot-toast"; -import { TSurveyQuota, TSurveyQuotaInput } from "@formbricks/types/quota"; -import { TSurvey } from "@formbricks/types/surveys/types"; import { QuotaList } from "./quota-list"; import { QuotaModal } from "./quota-modal"; diff --git a/apps/web/modules/ee/quotas/components/quotas-summary.tsx b/apps/web/modules/ee/quotas/components/quotas-summary.tsx index 7f425df5b0..e0a9c8d1b2 100644 --- a/apps/web/modules/ee/quotas/components/quotas-summary.tsx +++ b/apps/web/modules/ee/quotas/components/quotas-summary.tsx @@ -1,6 +1,6 @@ -import { ProgressBar } from "@/modules/ui/components/progress-bar"; import { useTranslate } from "@tolgee/react"; import type { TSurveySummary } from "@formbricks/types/surveys/types"; +import { ProgressBar } from "@/modules/ui/components/progress-bar"; interface QuotasSummaryProps { quotas: TSurveySummary["quotas"]; diff --git a/apps/web/modules/ee/quotas/components/single-response-card-quotas.tsx b/apps/web/modules/ee/quotas/components/single-response-card-quotas.tsx index b92f2648ce..684220a1f2 100644 --- a/apps/web/modules/ee/quotas/components/single-response-card-quotas.tsx +++ b/apps/web/modules/ee/quotas/components/single-response-card-quotas.tsx @@ -1,6 +1,6 @@ -import { ResponseBadges } from "@/modules/ui/components/response-badges"; import { useTranslate } from "@tolgee/react"; import { TResponseWithQuotas } from "@formbricks/types/responses"; +import { ResponseBadges } from "@/modules/ui/components/response-badges"; interface ResponseCardQuotasProps { quotas: TResponseWithQuotas["quotas"]; diff --git a/apps/web/modules/ee/quotas/lib/evaluation-service.test.ts b/apps/web/modules/ee/quotas/lib/evaluation-service.test.ts index 82454f3337..1ddc138783 100644 --- a/apps/web/modules/ee/quotas/lib/evaluation-service.test.ts +++ b/apps/web/modules/ee/quotas/lib/evaluation-service.test.ts @@ -1,4 +1,3 @@ -import { getSurvey } from "@/lib/survey/service"; import { Response } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -7,6 +6,7 @@ import { TSurveyQuota } from "@formbricks/types/quota"; import { TResponseData, TResponseVariables } from "@formbricks/types/responses"; import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getSurvey } from "@/lib/survey/service"; import { QuotaEvaluationInput, evaluateResponseQuotas } from "./evaluation-service"; import { getQuotas } from "./quotas"; import { evaluateQuotas, handleQuotas } from "./utils"; diff --git a/apps/web/modules/ee/quotas/lib/evaluation-service.ts b/apps/web/modules/ee/quotas/lib/evaluation-service.ts index 6f39252343..ad5a406555 100644 --- a/apps/web/modules/ee/quotas/lib/evaluation-service.ts +++ b/apps/web/modules/ee/quotas/lib/evaluation-service.ts @@ -1,9 +1,9 @@ import "server-only"; -import { getSurvey } from "@/lib/survey/service"; import { Prisma, Response } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { TSurveyQuota } from "@formbricks/types/quota"; +import { getSurvey } from "@/lib/survey/service"; import { getQuotas } from "./quotas"; import { evaluateQuotas, handleQuotas } from "./utils"; diff --git a/apps/web/modules/ee/quotas/lib/helpers.test.ts b/apps/web/modules/ee/quotas/lib/helpers.test.ts index 4ec481f299..3e5ab46497 100644 --- a/apps/web/modules/ee/quotas/lib/helpers.test.ts +++ b/apps/web/modules/ee/quotas/lib/helpers.test.ts @@ -1,5 +1,5 @@ -import { createQuotaFullObject } from "@/modules/ee/quotas/lib/helpers"; import { describe, expect, test } from "vitest"; +import { createQuotaFullObject } from "@/modules/ee/quotas/lib/helpers"; describe("helpers", () => { describe("createQuotaFullObject", () => { diff --git a/apps/web/modules/ee/quotas/lib/quota-link.ts b/apps/web/modules/ee/quotas/lib/quota-link.ts index a3ebfc2cf8..578da6311e 100644 --- a/apps/web/modules/ee/quotas/lib/quota-link.ts +++ b/apps/web/modules/ee/quotas/lib/quota-link.ts @@ -1,10 +1,10 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const getQuotaLinkCountByQuotaId = reactCache(async (quotaId: string): Promise => { try { diff --git a/apps/web/modules/ee/quotas/lib/quotas.test.ts b/apps/web/modules/ee/quotas/lib/quotas.test.ts index b8ee8cceec..7b15da2d08 100644 --- a/apps/web/modules/ee/quotas/lib/quotas.test.ts +++ b/apps/web/modules/ee/quotas/lib/quotas.test.ts @@ -1,4 +1,3 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -9,6 +8,7 @@ import { ValidationError, } from "@formbricks/types/errors"; import { TSurveyQuota, TSurveyQuotaInput } from "@formbricks/types/quota"; +import { validateInputs } from "@/lib/utils/validate"; import { createQuota, deleteQuota, getQuota, getQuotas, reduceQuotaLimits, updateQuota } from "./quotas"; // Mock dependencies diff --git a/apps/web/modules/ee/quotas/lib/quotas.ts b/apps/web/modules/ee/quotas/lib/quotas.ts index 90eee07341..482867fc80 100644 --- a/apps/web/modules/ee/quotas/lib/quotas.ts +++ b/apps/web/modules/ee/quotas/lib/quotas.ts @@ -1,5 +1,4 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -7,6 +6,7 @@ import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId } from "@formbricks/types/common"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurveyQuota, TSurveyQuotaInput } from "@formbricks/types/quota"; +import { validateInputs } from "@/lib/utils/validate"; export const getQuota = reactCache(async (quotaId: string): Promise => { try { diff --git a/apps/web/modules/ee/quotas/lib/utils.test.ts b/apps/web/modules/ee/quotas/lib/utils.test.ts index 5ec128965e..1897b9fa2c 100644 --- a/apps/web/modules/ee/quotas/lib/utils.test.ts +++ b/apps/web/modules/ee/quotas/lib/utils.test.ts @@ -1,6 +1,3 @@ -import { updateResponse } from "@/lib/response/service"; -import { evaluateLogic } from "@/lib/surveyLogic/utils"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -9,6 +6,9 @@ import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TResponseData, TResponseVariables } from "@formbricks/types/responses"; import { TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { updateResponse } from "@/lib/response/service"; +import { evaluateLogic } from "@/lib/surveyLogic/utils"; +import { validateInputs } from "@/lib/utils/validate"; import { evaluateQuotas, handleQuotas, upsertResponseQuotaLinks } from "./utils"; // Mock dependencies diff --git a/apps/web/modules/ee/quotas/lib/utils.ts b/apps/web/modules/ee/quotas/lib/utils.ts index c6d96b71b9..92261126b6 100644 --- a/apps/web/modules/ee/quotas/lib/utils.ts +++ b/apps/web/modules/ee/quotas/lib/utils.ts @@ -1,13 +1,13 @@ import "server-only"; -import { updateResponse } from "@/lib/response/service"; -import { evaluateLogic } from "@/lib/surveyLogic/utils"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { logger } from "@formbricks/logger"; import { ZId } from "@formbricks/types/common"; import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TResponseData, TResponseVariables } from "@formbricks/types/responses"; +import { updateResponse } from "@/lib/response/service"; +import { evaluateLogic } from "@/lib/surveyLogic/utils"; +import { validateInputs } from "@/lib/utils/validate"; /** * Evaluates quotas against response data to determine screening status diff --git a/apps/web/modules/ee/role-management/actions.ts b/apps/web/modules/ee/role-management/actions.ts index 7fb48df0d5..5dd3917146 100644 --- a/apps/web/modules/ee/role-management/actions.ts +++ b/apps/web/modules/ee/role-management/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId, ZUuid } from "@formbricks/types/common"; +import { AuthenticationError, OperationNotAllowedError, ValidationError } from "@formbricks/types/errors"; +import { ZMembershipUpdateInput } from "@formbricks/types/memberships"; import { IS_FORMBRICKS_CLOUD, USER_MANAGEMENT_MINIMUM_ROLE } from "@/lib/constants"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getUserManagementAccess } from "@/lib/membership/utils"; @@ -13,10 +17,6 @@ import { updateInvite } from "@/modules/ee/role-management/lib/invite"; import { updateMembership } from "@/modules/ee/role-management/lib/membership"; import { ZInviteUpdateInput } from "@/modules/ee/role-management/types/invites"; import { getInvite } from "@/modules/organization/settings/teams/lib/invite"; -import { z } from "zod"; -import { ZId, ZUuid } from "@formbricks/types/common"; -import { AuthenticationError, OperationNotAllowedError, ValidationError } from "@formbricks/types/errors"; -import { ZMembershipUpdateInput } from "@formbricks/types/memberships"; export const checkRoleManagementPermission = async (organizationId: string) => { const organization = await getOrganization(organizationId); diff --git a/apps/web/modules/ee/role-management/components/add-member-role.tsx b/apps/web/modules/ee/role-management/components/add-member-role.tsx index ec5ec48f2e..079df37ead 100644 --- a/apps/web/modules/ee/role-management/components/add-member-role.tsx +++ b/apps/web/modules/ee/role-management/components/add-member-role.tsx @@ -1,5 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useMemo } from "react"; +import { type Control, Controller } from "react-hook-form"; +import { TOrganizationRole } from "@formbricks/types/memberships"; import { getAccessFlags } from "@/lib/membership/utils"; import { Label } from "@/modules/ui/components/label"; import { @@ -11,10 +15,6 @@ import { SelectValue, } from "@/modules/ui/components/select"; import { Muted, P } from "@/modules/ui/components/typography"; -import { useTranslate } from "@tolgee/react"; -import { useMemo } from "react"; -import { type Control, Controller } from "react-hook-form"; -import { TOrganizationRole } from "@formbricks/types/memberships"; interface AddMemberRoleProps { control: Control<{ name: string; email: string; role: TOrganizationRole; teamIds: string[] }>; diff --git a/apps/web/modules/ee/role-management/lib/invite.ts b/apps/web/modules/ee/role-management/lib/invite.ts index 0c2bbd2b5a..f499e379e6 100644 --- a/apps/web/modules/ee/role-management/lib/invite.ts +++ b/apps/web/modules/ee/role-management/lib/invite.ts @@ -1,8 +1,8 @@ -import { type TInviteUpdateInput } from "@/modules/ee/role-management/types/invites"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { type TInviteUpdateInput } from "@/modules/ee/role-management/types/invites"; export const updateInvite = async (inviteId: string, data: TInviteUpdateInput): Promise => { try { diff --git a/apps/web/modules/ee/role-management/lib/membership.ts b/apps/web/modules/ee/role-management/lib/membership.ts index be1baedd73..5aba050f0e 100644 --- a/apps/web/modules/ee/role-management/lib/membership.ts +++ b/apps/web/modules/ee/role-management/lib/membership.ts @@ -1,11 +1,11 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZString } from "@formbricks/types/common"; import { ResourceNotFoundError } from "@formbricks/types/errors"; import { TMembership, TMembershipUpdateInput, ZMembershipUpdateInput } from "@formbricks/types/memberships"; +import { validateInputs } from "@/lib/utils/validate"; export const updateMembership = async ( userId: string, diff --git a/apps/web/modules/ee/sso/components/azure-button.test.tsx b/apps/web/modules/ee/sso/components/azure-button.test.tsx index 585e175787..fb94688473 100644 --- a/apps/web/modules/ee/sso/components/azure-button.test.tsx +++ b/apps/web/modules/ee/sso/components/azure-button.test.tsx @@ -1,7 +1,7 @@ -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { signIn } from "next-auth/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { AzureButton } from "./azure-button"; // Mock next-auth/react diff --git a/apps/web/modules/ee/sso/components/azure-button.tsx b/apps/web/modules/ee/sso/components/azure-button.tsx index 00a59d9838..4541bf338e 100644 --- a/apps/web/modules/ee/sso/components/azure-button.tsx +++ b/apps/web/modules/ee/sso/components/azure-button.tsx @@ -1,12 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { signIn } from "next-auth/react"; +import { useCallback, useEffect } from "react"; import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; import { Button } from "@/modules/ui/components/button"; import { MicrosoftIcon } from "@/modules/ui/components/icons"; -import { useTranslate } from "@tolgee/react"; -import { signIn } from "next-auth/react"; -import { useCallback, useEffect } from "react"; interface AzureButtonProps { inviteUrl?: string; diff --git a/apps/web/modules/ee/sso/components/github-button.test.tsx b/apps/web/modules/ee/sso/components/github-button.test.tsx index e5341f1e89..24749efd22 100644 --- a/apps/web/modules/ee/sso/components/github-button.test.tsx +++ b/apps/web/modules/ee/sso/components/github-button.test.tsx @@ -1,7 +1,7 @@ -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { signIn } from "next-auth/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { GithubButton } from "./github-button"; // Mock next-auth/react diff --git a/apps/web/modules/ee/sso/components/github-button.tsx b/apps/web/modules/ee/sso/components/github-button.tsx index cb85307e7c..45c9c504d0 100644 --- a/apps/web/modules/ee/sso/components/github-button.tsx +++ b/apps/web/modules/ee/sso/components/github-button.tsx @@ -1,11 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { signIn } from "next-auth/react"; import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; import { Button } from "@/modules/ui/components/button"; import { GithubIcon } from "@/modules/ui/components/icons"; -import { useTranslate } from "@tolgee/react"; -import { signIn } from "next-auth/react"; interface GithubButtonProps { inviteUrl?: string; diff --git a/apps/web/modules/ee/sso/components/google-button.test.tsx b/apps/web/modules/ee/sso/components/google-button.test.tsx index ca1946a5ff..e0e86d2f19 100644 --- a/apps/web/modules/ee/sso/components/google-button.test.tsx +++ b/apps/web/modules/ee/sso/components/google-button.test.tsx @@ -1,7 +1,7 @@ -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { signIn } from "next-auth/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { GoogleButton } from "./google-button"; // Mock next-auth/react diff --git a/apps/web/modules/ee/sso/components/google-button.tsx b/apps/web/modules/ee/sso/components/google-button.tsx index e4f9546024..56cba84fcb 100644 --- a/apps/web/modules/ee/sso/components/google-button.tsx +++ b/apps/web/modules/ee/sso/components/google-button.tsx @@ -1,11 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { signIn } from "next-auth/react"; import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; import { Button } from "@/modules/ui/components/button"; import { GoogleIcon } from "@/modules/ui/components/icons"; -import { useTranslate } from "@tolgee/react"; -import { signIn } from "next-auth/react"; interface GoogleButtonProps { inviteUrl?: string; diff --git a/apps/web/modules/ee/sso/components/open-id-button.test.tsx b/apps/web/modules/ee/sso/components/open-id-button.test.tsx index 7af4600a8e..7c0e95f2b2 100644 --- a/apps/web/modules/ee/sso/components/open-id-button.test.tsx +++ b/apps/web/modules/ee/sso/components/open-id-button.test.tsx @@ -1,7 +1,7 @@ -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { signIn } from "next-auth/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { OpenIdButton } from "./open-id-button"; // Mock next-auth/react diff --git a/apps/web/modules/ee/sso/components/open-id-button.tsx b/apps/web/modules/ee/sso/components/open-id-button.tsx index 6fc1a6e4e6..bbef9cd660 100644 --- a/apps/web/modules/ee/sso/components/open-id-button.tsx +++ b/apps/web/modules/ee/sso/components/open-id-button.tsx @@ -1,11 +1,11 @@ "use client"; -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; -import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { signIn } from "next-auth/react"; import { useCallback, useEffect } from "react"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; +import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; +import { Button } from "@/modules/ui/components/button"; interface OpenIdButtonProps { inviteUrl?: string; diff --git a/apps/web/modules/ee/sso/components/saml-button.test.tsx b/apps/web/modules/ee/sso/components/saml-button.test.tsx index 472d2cc2a0..c8d378b0d4 100644 --- a/apps/web/modules/ee/sso/components/saml-button.test.tsx +++ b/apps/web/modules/ee/sso/components/saml-button.test.tsx @@ -1,9 +1,9 @@ -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; -import { doesSamlConnectionExistAction } from "@/modules/ee/sso/actions"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import { signIn } from "next-auth/react"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; +import { doesSamlConnectionExistAction } from "@/modules/ee/sso/actions"; import { SamlButton } from "./saml-button"; // Mock next-auth/react diff --git a/apps/web/modules/ee/sso/components/saml-button.tsx b/apps/web/modules/ee/sso/components/saml-button.tsx index 80c21542a6..a2527565ac 100644 --- a/apps/web/modules/ee/sso/components/saml-button.tsx +++ b/apps/web/modules/ee/sso/components/saml-button.tsx @@ -1,14 +1,14 @@ "use client"; -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; -import { doesSamlConnectionExistAction } from "@/modules/ee/sso/actions"; -import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { LockIcon } from "lucide-react"; import { signIn } from "next-auth/react"; import { useState } from "react"; import toast from "react-hot-toast"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; +import { doesSamlConnectionExistAction } from "@/modules/ee/sso/actions"; +import { getCallbackUrl } from "@/modules/ee/sso/lib/utils"; +import { Button } from "@/modules/ui/components/button"; interface SamlButtonProps { inviteUrl?: string; diff --git a/apps/web/modules/ee/sso/components/sso-options.tsx b/apps/web/modules/ee/sso/components/sso-options.tsx index eeba7ef89f..d31cecb715 100644 --- a/apps/web/modules/ee/sso/components/sso-options.tsx +++ b/apps/web/modules/ee/sso/components/sso-options.tsx @@ -1,8 +1,8 @@ "use client"; -import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { useTranslate } from "@tolgee/react"; import { useEffect, useState } from "react"; +import { FORMBRICKS_LOGGED_IN_WITH_LS } from "@/lib/localStorage"; import { AzureButton } from "./azure-button"; import { GithubButton } from "./github-button"; import { GoogleButton } from "./google-button"; diff --git a/apps/web/modules/ee/sso/lib/providers.ts b/apps/web/modules/ee/sso/lib/providers.ts index 530c27b238..6893e47594 100644 --- a/apps/web/modules/ee/sso/lib/providers.ts +++ b/apps/web/modules/ee/sso/lib/providers.ts @@ -1,3 +1,7 @@ +import type { IdentityProvider } from "@prisma/client"; +import AzureAD from "next-auth/providers/azure-ad"; +import GitHubProvider from "next-auth/providers/github"; +import GoogleProvider from "next-auth/providers/google"; import { AZUREAD_CLIENT_ID, AZUREAD_CLIENT_SECRET, @@ -13,10 +17,6 @@ import { OIDC_SIGNING_ALGORITHM, WEBAPP_URL, } from "@/lib/constants"; -import type { IdentityProvider } from "@prisma/client"; -import AzureAD from "next-auth/providers/azure-ad"; -import GitHubProvider from "next-auth/providers/github"; -import GoogleProvider from "next-auth/providers/google"; export const getSSOProviders = () => [ GitHubProvider({ diff --git a/apps/web/modules/ee/sso/lib/sso-handlers.ts b/apps/web/modules/ee/sso/lib/sso-handlers.ts index 0553c3747a..fc3796b2b8 100644 --- a/apps/web/modules/ee/sso/lib/sso-handlers.ts +++ b/apps/web/modules/ee/sso/lib/sso-handlers.ts @@ -1,3 +1,8 @@ +import type { IdentityProvider, Organization } from "@prisma/client"; +import type { Account } from "next-auth"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import type { TUser, TUserNotificationSettings } from "@formbricks/types/user"; import { createAccount } from "@/lib/account/service"; import { DEFAULT_TEAM_ID, SKIP_INVITE_FOR_SSO } from "@/lib/constants"; import { getIsFreshInstance } from "@/lib/instance/service"; @@ -17,11 +22,6 @@ import { } from "@/modules/ee/license-check/lib/utils"; import { getFirstOrganization } from "@/modules/ee/sso/lib/organization"; import { createDefaultTeamMembership, getOrganizationByTeamId } from "@/modules/ee/sso/lib/team"; -import type { IdentityProvider, Organization } from "@prisma/client"; -import type { Account } from "next-auth"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import type { TUser, TUserNotificationSettings } from "@formbricks/types/user"; export const handleSsoCallback = async ({ user, diff --git a/apps/web/modules/ee/sso/lib/team.ts b/apps/web/modules/ee/sso/lib/team.ts index 81f1aefdcb..8433ace980 100644 --- a/apps/web/modules/ee/sso/lib/team.ts +++ b/apps/web/modules/ee/sso/lib/team.ts @@ -1,13 +1,13 @@ import "server-only"; -import { DEFAULT_TEAM_ID } from "@/lib/constants"; -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { validateInputs } from "@/lib/utils/validate"; -import { createTeamMembership } from "@/modules/auth/signup/lib/team"; import { Organization, Team } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; +import { DEFAULT_TEAM_ID } from "@/lib/constants"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { validateInputs } from "@/lib/utils/validate"; +import { createTeamMembership } from "@/modules/auth/signup/lib/team"; export const getOrganizationByTeamId = reactCache(async (teamId: string): Promise => { validateInputs([teamId, z.string().cuid2()]); diff --git a/apps/web/modules/ee/sso/lib/tests/__mock__/team.mock.ts b/apps/web/modules/ee/sso/lib/tests/__mock__/team.mock.ts index 760af81898..1ae66cf183 100644 --- a/apps/web/modules/ee/sso/lib/tests/__mock__/team.mock.ts +++ b/apps/web/modules/ee/sso/lib/tests/__mock__/team.mock.ts @@ -1,5 +1,5 @@ -import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; import { OrganizationRole, Team, TeamUserRole } from "@prisma/client"; +import { CreateMembershipInvite } from "@/modules/auth/signup/types/invites"; /** * Common constants and IDs used across tests diff --git a/apps/web/modules/ee/sso/lib/tests/sso-handlers.test.ts b/apps/web/modules/ee/sso/lib/tests/sso-handlers.test.ts index e1aae61e3a..72b4ae60ef 100644 --- a/apps/web/modules/ee/sso/lib/tests/sso-handlers.test.ts +++ b/apps/web/modules/ee/sso/lib/tests/sso-handlers.test.ts @@ -1,3 +1,6 @@ +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { prisma } from "@formbricks/database"; +import type { TUser } from "@formbricks/types/user"; import { createMembership } from "@/lib/membership/service"; import { createOrganization, getOrganization } from "@/lib/organization/service"; import { findMatchingLocale } from "@/lib/utils/locale"; @@ -11,9 +14,6 @@ import { getIsSsoEnabled, } from "@/modules/ee/license-check/lib/utils"; import { createDefaultTeamMembership, getOrganizationByTeamId } from "@/modules/ee/sso/lib/team"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { prisma } from "@formbricks/database"; -import type { TUser } from "@formbricks/types/user"; import { handleSsoCallback } from "../sso-handlers"; import { mockAccount, diff --git a/apps/web/modules/ee/sso/lib/tests/team.test.ts b/apps/web/modules/ee/sso/lib/tests/team.test.ts index 632c4b81a3..89986775e2 100644 --- a/apps/web/modules/ee/sso/lib/tests/team.test.ts +++ b/apps/web/modules/ee/sso/lib/tests/team.test.ts @@ -1,8 +1,8 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { validateInputs } from "@/lib/utils/validate"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { validateInputs } from "@/lib/utils/validate"; import { createDefaultTeamMembership, getOrganizationByTeamId } from "../team"; import { MOCK_DEFAULT_TEAM, diff --git a/apps/web/modules/ee/teams/lib/roles.test.ts b/apps/web/modules/ee/teams/lib/roles.test.ts index f75b19d1a2..332689ab6f 100644 --- a/apps/web/modules/ee/teams/lib/roles.test.ts +++ b/apps/web/modules/ee/teams/lib/roles.test.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, UnknownError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { getProjectPermissionByUserId, getTeamRoleByTeamIdUserId } from "./roles"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/ee/teams/lib/roles.ts b/apps/web/modules/ee/teams/lib/roles.ts index 59c4c1ff21..9ca0cb0d7d 100644 --- a/apps/web/modules/ee/teams/lib/roles.ts +++ b/apps/web/modules/ee/teams/lib/roles.ts @@ -1,13 +1,13 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; -import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; -import { TTeamRole } from "@/modules/ee/teams/team-list/types/team"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { ZId, ZString } from "@formbricks/types/common"; import { DatabaseError, UnknownError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; +import { TTeamRole } from "@/modules/ee/teams/team-list/types/team"; export const getProjectPermissionByUserId = reactCache( async (userId: string, projectId: string): Promise => { diff --git a/apps/web/modules/ee/teams/project-teams/components/access-table.test.tsx b/apps/web/modules/ee/teams/project-teams/components/access-table.test.tsx index f08992510b..ed427b9a3f 100644 --- a/apps/web/modules/ee/teams/project-teams/components/access-table.test.tsx +++ b/apps/web/modules/ee/teams/project-teams/components/access-table.test.tsx @@ -1,7 +1,7 @@ -import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; -import { TeamPermissionMapping } from "@/modules/ee/teams/utils/teams"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; +import { TeamPermissionMapping } from "@/modules/ee/teams/utils/teams"; import { AccessTable } from "./access-table"; vi.mock("@tolgee/react", () => ({ diff --git a/apps/web/modules/ee/teams/project-teams/components/access-table.tsx b/apps/web/modules/ee/teams/project-teams/components/access-table.tsx index 2afff665c9..1722a25691 100644 --- a/apps/web/modules/ee/teams/project-teams/components/access-table.tsx +++ b/apps/web/modules/ee/teams/project-teams/components/access-table.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; import { TeamPermissionMapping } from "@/modules/ee/teams/utils/teams"; import { IdBadge } from "@/modules/ui/components/id-badge"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/modules/ui/components/table"; -import { useTranslate } from "@tolgee/react"; interface AccessTableProps { teams: TProjectTeam[]; diff --git a/apps/web/modules/ee/teams/project-teams/components/access-view.test.tsx b/apps/web/modules/ee/teams/project-teams/components/access-view.test.tsx index fd888856ea..0f3e541cf5 100644 --- a/apps/web/modules/ee/teams/project-teams/components/access-view.test.tsx +++ b/apps/web/modules/ee/teams/project-teams/components/access-view.test.tsx @@ -1,6 +1,6 @@ -import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; import { AccessView } from "./access-view"; vi.mock("@/app/(app)/environments/[environmentId]/settings/components/SettingsCard", () => ({ diff --git a/apps/web/modules/ee/teams/project-teams/components/access-view.tsx b/apps/web/modules/ee/teams/project-teams/components/access-view.tsx index 843f557c95..42a8d8880e 100644 --- a/apps/web/modules/ee/teams/project-teams/components/access-view.tsx +++ b/apps/web/modules/ee/teams/project-teams/components/access-view.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { AccessTable } from "@/modules/ee/teams/project-teams/components/access-table"; import { ManageTeam } from "@/modules/ee/teams/project-teams/components/manage-team"; import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; -import { useTranslate } from "@tolgee/react"; interface AccessViewProps { teams: TProjectTeam[]; diff --git a/apps/web/modules/ee/teams/project-teams/components/manage-team.tsx b/apps/web/modules/ee/teams/project-teams/components/manage-team.tsx index e0ee01f225..525e5d8a82 100644 --- a/apps/web/modules/ee/teams/project-teams/components/manage-team.tsx +++ b/apps/web/modules/ee/teams/project-teams/components/manage-team.tsx @@ -1,9 +1,9 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; +import { Button } from "@/modules/ui/components/button"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; interface ManageTeamProps { environmentId: string; diff --git a/apps/web/modules/ee/teams/project-teams/lib/team.ts b/apps/web/modules/ee/teams/project-teams/lib/team.ts index f7628feac5..77859d8714 100644 --- a/apps/web/modules/ee/teams/project-teams/lib/team.ts +++ b/apps/web/modules/ee/teams/project-teams/lib/team.ts @@ -1,11 +1,11 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; -import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { ZId } from "@formbricks/types/common"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { TProjectTeam } from "@/modules/ee/teams/project-teams/types/team"; export const getTeamsByProjectId = reactCache(async (projectId: string): Promise => { validateInputs([projectId, ZId]); diff --git a/apps/web/modules/ee/teams/project-teams/loading.tsx b/apps/web/modules/ee/teams/project-teams/loading.tsx index fe0d0a7a11..bc5289331a 100644 --- a/apps/web/modules/ee/teams/project-teams/loading.tsx +++ b/apps/web/modules/ee/teams/project-teams/loading.tsx @@ -1,9 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { ProjectConfigNavigation } from "@/modules/projects/settings/components/project-config-navigation"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; export const TeamsLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/ee/teams/project-teams/page.test.tsx b/apps/web/modules/ee/teams/project-teams/page.test.tsx index b044b964b6..71bd9d09ab 100644 --- a/apps/web/modules/ee/teams/project-teams/page.test.tsx +++ b/apps/web/modules/ee/teams/project-teams/page.test.tsx @@ -1,7 +1,7 @@ -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { getTranslate } from "@/tolgee/server"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { getTranslate } from "@/tolgee/server"; import { getTeamsByProjectId } from "./lib/team"; import { ProjectTeams } from "./page"; diff --git a/apps/web/modules/ee/teams/team-list/actions.ts b/apps/web/modules/ee/teams/team-list/actions.ts index 126b7badb3..447e6a8b31 100644 --- a/apps/web/modules/ee/teams/team-list/actions.ts +++ b/apps/web/modules/ee/teams/team-list/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -14,8 +16,6 @@ import { updateTeamDetails, } from "@/modules/ee/teams/team-list/lib/team"; import { ZTeamSettingsFormSchema } from "@/modules/ee/teams/team-list/types/team"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZCreateTeamAction = z.object({ organizationId: z.string().cuid(), diff --git a/apps/web/modules/ee/teams/team-list/components/create-team-button.tsx b/apps/web/modules/ee/teams/team-list/components/create-team-button.tsx index 66f6ec3809..31338768d0 100644 --- a/apps/web/modules/ee/teams/team-list/components/create-team-button.tsx +++ b/apps/web/modules/ee/teams/team-list/components/create-team-button.tsx @@ -1,9 +1,9 @@ "use client"; -import { CreateTeamModal } from "@/modules/ee/teams/team-list/components/create-team-modal"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { useState } from "react"; +import { CreateTeamModal } from "@/modules/ee/teams/team-list/components/create-team-modal"; +import { Button } from "@/modules/ui/components/button"; interface CreateTeamButtonProps { organizationId: string; diff --git a/apps/web/modules/ee/teams/team-list/components/create-team-modal.test.tsx b/apps/web/modules/ee/teams/team-list/components/create-team-modal.test.tsx index f5f2d3b2cc..e0657d9e39 100644 --- a/apps/web/modules/ee/teams/team-list/components/create-team-modal.test.tsx +++ b/apps/web/modules/ee/teams/team-list/components/create-team-modal.test.tsx @@ -1,9 +1,9 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { createTeamAction } from "@/modules/ee/teams/team-list/actions"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { createTeamAction } from "@/modules/ee/teams/team-list/actions"; import { CreateTeamModal } from "./create-team-modal"; vi.mock("@/modules/ui/components/dialog", () => ({ diff --git a/apps/web/modules/ee/teams/team-list/components/create-team-modal.tsx b/apps/web/modules/ee/teams/team-list/components/create-team-modal.tsx index a8a94a074c..cdff9af7be 100644 --- a/apps/web/modules/ee/teams/team-list/components/create-team-modal.tsx +++ b/apps/web/modules/ee/teams/team-list/components/create-team-modal.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { UsersIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import toast from "react-hot-toast"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createTeamAction } from "@/modules/ee/teams/team-list/actions"; import { Button } from "@/modules/ui/components/button"; @@ -13,11 +18,6 @@ import { } from "@/modules/ui/components/dialog"; import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; -import { useTranslate } from "@tolgee/react"; -import { UsersIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import toast from "react-hot-toast"; interface CreateTeamModalProps { open: boolean; diff --git a/apps/web/modules/ee/teams/team-list/components/manage-team-button.tsx b/apps/web/modules/ee/teams/team-list/components/manage-team-button.tsx index cfdc07f6c6..c1fab29a47 100644 --- a/apps/web/modules/ee/teams/team-list/components/manage-team-button.tsx +++ b/apps/web/modules/ee/teams/team-list/components/manage-team-button.tsx @@ -1,8 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { Button } from "@/modules/ui/components/button"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; -import { useTranslate } from "@tolgee/react"; interface ManageTeamButtonProps { onClick: () => void; diff --git a/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.test.tsx b/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.test.tsx index 70557f7f2b..06c7f9cbdd 100644 --- a/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.test.tsx +++ b/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.test.tsx @@ -1,9 +1,9 @@ -import { deleteTeamAction } from "@/modules/ee/teams/team-list/actions"; -import { TTeam } from "@/modules/ee/teams/team-list/types/team"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { deleteTeamAction } from "@/modules/ee/teams/team-list/actions"; +import { TTeam } from "@/modules/ee/teams/team-list/types/team"; import { DeleteTeam } from "./delete-team"; vi.mock("@/modules/ui/components/label", () => ({ diff --git a/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.tsx b/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.tsx index feecc3cf1f..5d15f69e41 100644 --- a/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.tsx +++ b/apps/web/modules/ee/teams/team-list/components/team-settings/delete-team.tsx @@ -1,14 +1,14 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import toast from "react-hot-toast"; import { deleteTeamAction } from "@/modules/ee/teams/team-list/actions"; import { TTeam } from "@/modules/ee/teams/team-list/types/team"; import { Button } from "@/modules/ui/components/button"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import toast from "react-hot-toast"; interface DeleteTeamProps { teamId: TTeam["id"]; diff --git a/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.test.tsx b/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.test.tsx index 41d32151a4..d462b1cfa6 100644 --- a/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.test.tsx +++ b/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.test.tsx @@ -1,10 +1,10 @@ -import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; -import { updateTeamDetailsAction } from "@/modules/ee/teams/team-list/actions"; -import { TOrganizationMember, TTeamDetails, ZTeamRole } from "@/modules/ee/teams/team-list/types/team"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; +import { updateTeamDetailsAction } from "@/modules/ee/teams/team-list/actions"; +import { TOrganizationMember, TTeamDetails, ZTeamRole } from "@/modules/ee/teams/team-list/types/team"; import { TeamSettingsModal } from "./team-settings-modal"; // Mock the Dialog components diff --git a/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.tsx b/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.tsx index 81ab8aa964..440800813c 100644 --- a/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.tsx +++ b/apps/web/modules/ee/teams/team-list/components/team-settings/team-settings-modal.tsx @@ -1,5 +1,13 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { PlusIcon, Trash2Icon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useMemo } from "react"; +import { FormProvider, SubmitHandler, useForm, useWatch } from "react-hook-form"; +import toast from "react-hot-toast"; +import { TOrganizationRole } from "@formbricks/types/memberships"; import { getAccessFlags } from "@/lib/membership/utils"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; @@ -37,14 +45,6 @@ import { } from "@/modules/ui/components/select"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { Muted } from "@/modules/ui/components/typography"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { PlusIcon, Trash2Icon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useMemo } from "react"; -import { FormProvider, SubmitHandler, useForm, useWatch } from "react-hook-form"; -import toast from "react-hot-toast"; -import { TOrganizationRole } from "@formbricks/types/memberships"; interface TeamSettingsModalProps { open: boolean; diff --git a/apps/web/modules/ee/teams/team-list/components/teams-table.test.tsx b/apps/web/modules/ee/teams/team-list/components/teams-table.test.tsx index 6791ec770c..14c165d22a 100644 --- a/apps/web/modules/ee/teams/team-list/components/teams-table.test.tsx +++ b/apps/web/modules/ee/teams/team-list/components/teams-table.test.tsx @@ -1,9 +1,9 @@ -import { getTeamDetailsAction, getTeamRoleAction } from "@/modules/ee/teams/team-list/actions"; -import { TOrganizationMember, TOtherTeam, TUserTeam } from "@/modules/ee/teams/team-list/types/team"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getTeamDetailsAction, getTeamRoleAction } from "@/modules/ee/teams/team-list/actions"; +import { TOrganizationMember, TOtherTeam, TUserTeam } from "@/modules/ee/teams/team-list/types/team"; import { TeamsTable } from "./teams-table"; vi.mock("@/modules/ee/teams/team-list/components/create-team-button", () => ({ diff --git a/apps/web/modules/ee/teams/team-list/components/teams-table.tsx b/apps/web/modules/ee/teams/team-list/components/teams-table.tsx index c2544936e3..be917b2187 100644 --- a/apps/web/modules/ee/teams/team-list/components/teams-table.tsx +++ b/apps/web/modules/ee/teams/team-list/components/teams-table.tsx @@ -1,5 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useState } from "react"; +import toast from "react-hot-toast"; +import { TOrganizationRole } from "@formbricks/types/memberships"; import { getAccessFlags } from "@/lib/membership/utils"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { getTeamDetailsAction, getTeamRoleAction } from "@/modules/ee/teams/team-list/actions"; @@ -16,10 +20,6 @@ import { } from "@/modules/ee/teams/team-list/types/team"; import { Badge } from "@/modules/ui/components/badge"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/modules/ui/components/table"; -import { useTranslate } from "@tolgee/react"; -import { useState } from "react"; -import toast from "react-hot-toast"; -import { TOrganizationRole } from "@formbricks/types/memberships"; interface TeamsTableProps { teams: { userTeams: TUserTeam[]; otherTeams: TOtherTeam[] }; diff --git a/apps/web/modules/ee/teams/team-list/components/teams-view.tsx b/apps/web/modules/ee/teams/team-list/components/teams-view.tsx index 7b8ff24bb1..8447c8e622 100644 --- a/apps/web/modules/ee/teams/team-list/components/teams-view.tsx +++ b/apps/web/modules/ee/teams/team-list/components/teams-view.tsx @@ -1,3 +1,4 @@ +import { TOrganizationRole } from "@formbricks/types/memberships"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { TeamsTable } from "@/modules/ee/teams/team-list/components/teams-table"; @@ -6,7 +7,6 @@ import { getTeams } from "@/modules/ee/teams/team-list/lib/team"; import { getMembersByOrganizationId } from "@/modules/organization/settings/teams/lib/membership"; import { ModalButton, UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { getTranslate } from "@/tolgee/server"; -import { TOrganizationRole } from "@formbricks/types/memberships"; interface TeamsViewProps { organizationId: string; diff --git a/apps/web/modules/ee/teams/team-list/lib/project.ts b/apps/web/modules/ee/teams/team-list/lib/project.ts index 9b3549440c..5f620ff81d 100644 --- a/apps/web/modules/ee/teams/team-list/lib/project.ts +++ b/apps/web/modules/ee/teams/team-list/lib/project.ts @@ -1,12 +1,12 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; -import { TOrganizationProject } from "@/modules/ee/teams/team-list/types/project"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { ZString } from "@formbricks/types/common"; import { DatabaseError, UnknownError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { TOrganizationProject } from "@/modules/ee/teams/team-list/types/project"; export const getProjectsByOrganizationId = reactCache( async (organizationId: string): Promise => { diff --git a/apps/web/modules/ee/teams/team-list/lib/team.test.ts b/apps/web/modules/ee/teams/team-list/lib/team.test.ts index 4be7d21984..da3779d8aa 100644 --- a/apps/web/modules/ee/teams/team-list/lib/team.test.ts +++ b/apps/web/modules/ee/teams/team-list/lib/team.test.ts @@ -1,8 +1,8 @@ -import { TTeamSettingsFormSchema } from "@/modules/ee/teams/team-list/types/team"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TTeamSettingsFormSchema } from "@/modules/ee/teams/team-list/types/team"; import { createTeam, deleteTeam, diff --git a/apps/web/modules/ee/teams/team-list/lib/team.ts b/apps/web/modules/ee/teams/team-list/lib/team.ts index ca9fafa4a0..3b34f54ccd 100644 --- a/apps/web/modules/ee/teams/team-list/lib/team.ts +++ b/apps/web/modules/ee/teams/team-list/lib/team.ts @@ -1,4 +1,10 @@ import "server-only"; +import { Prisma } from "@prisma/client"; +import { cache as reactCache } from "react"; +import { z } from "zod"; +import { prisma } from "@formbricks/database"; +import { ZId } from "@formbricks/types/common"; +import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { validateInputs } from "@/lib/utils/validate"; import { TOrganizationTeam, @@ -8,12 +14,6 @@ import { TUserTeam, ZTeamSettingsFormSchema, } from "@/modules/ee/teams/team-list/types/team"; -import { Prisma } from "@prisma/client"; -import { cache as reactCache } from "react"; -import { z } from "zod"; -import { prisma } from "@formbricks/database"; -import { ZId } from "@formbricks/types/common"; -import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; export const getTeamsByOrganizationId = reactCache( async (organizationId: string): Promise => { diff --git a/apps/web/modules/ee/teams/team-list/types/team.ts b/apps/web/modules/ee/teams/team-list/types/team.ts index b96a8bb281..2678f137cb 100644 --- a/apps/web/modules/ee/teams/team-list/types/team.ts +++ b/apps/web/modules/ee/teams/team-list/types/team.ts @@ -1,7 +1,7 @@ -import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { z } from "zod"; import { ZId } from "@formbricks/types/common"; import { ZOrganizationRole } from "@formbricks/types/memberships"; +import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; export const ZTeamRole = z.enum(["admin", "contributor"]); export type TTeamRole = z.infer; diff --git a/apps/web/modules/ee/two-factor-auth/actions.ts b/apps/web/modules/ee/two-factor-auth/actions.ts index 05d7d5367c..13eeb31759 100644 --- a/apps/web/modules/ee/two-factor-auth/actions.ts +++ b/apps/web/modules/ee/two-factor-auth/actions.ts @@ -1,11 +1,11 @@ "use server"; +import { z } from "zod"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getIsTwoFactorAuthEnabled } from "@/modules/ee/license-check/lib/utils"; -import { z } from "zod"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; import { disableTwoFactorAuth, enableTwoFactorAuth, setupTwoFactorAuth } from "./lib/two-factor-auth"; const ZSetupTwoFactorAuthAction = z.object({ diff --git a/apps/web/modules/ee/two-factor-auth/components/confirm-password-form.tsx b/apps/web/modules/ee/two-factor-auth/components/confirm-password-form.tsx index 12a615c7e1..1d65703bcc 100644 --- a/apps/web/modules/ee/two-factor-auth/components/confirm-password-form.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/confirm-password-form.tsx @@ -1,16 +1,16 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { setupTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; -import { Button } from "@/modules/ui/components/button"; -import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; -import { PasswordInput } from "@/modules/ui/components/password-input"; import { zodResolver } from "@hookform/resolvers/zod"; import { useTranslate } from "@tolgee/react"; import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; import toast from "react-hot-toast"; import { z } from "zod"; import { ZUserPassword } from "@formbricks/types/user"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { setupTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; +import { Button } from "@/modules/ui/components/button"; +import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; +import { PasswordInput } from "@/modules/ui/components/password-input"; import { EnableTwoFactorModalStep } from "./enable-two-factor-modal"; const ZConfirmPasswordFormState = z.object({ diff --git a/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.test.tsx b/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.test.tsx index 72a37a1707..07e202b316 100644 --- a/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.test.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.test.tsx @@ -1,8 +1,8 @@ -import { disableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { disableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; import { DisableTwoFactorModal } from "./disable-two-factor-modal"; // Mock the Dialog components diff --git a/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.tsx b/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.tsx index 7cca798aa8..a54f1abbad 100644 --- a/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/disable-two-factor-modal.tsx @@ -1,5 +1,13 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { ZUserPassword } from "@formbricks/types/user"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { disableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; import { Button } from "@/modules/ui/components/button"; @@ -16,14 +24,6 @@ import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/compon import { Input } from "@/modules/ui/components/input"; import { OTPInput } from "@/modules/ui/components/otp-input"; import { PasswordInput } from "@/modules/ui/components/password-input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import { FormProvider, SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; -import { ZUserPassword } from "@formbricks/types/user"; const ZDisableTwoFactorFormState = z .object({ diff --git a/apps/web/modules/ee/two-factor-auth/components/display-backup-codes.tsx b/apps/web/modules/ee/two-factor-auth/components/display-backup-codes.tsx index 54b9d83d8b..8ebefa299f 100644 --- a/apps/web/modules/ee/two-factor-auth/components/display-backup-codes.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/display-backup-codes.tsx @@ -1,8 +1,8 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { toast } from "react-hot-toast"; +import { Button } from "@/modules/ui/components/button"; interface DisplayBackupCodesProps { backupCodes: string[]; diff --git a/apps/web/modules/ee/two-factor-auth/components/enable-two-factor-modal.tsx b/apps/web/modules/ee/two-factor-auth/components/enable-two-factor-modal.tsx index 3eeb19ce2e..5873e105a7 100644 --- a/apps/web/modules/ee/two-factor-auth/components/enable-two-factor-modal.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/enable-two-factor-modal.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; import { ConfirmPasswordForm } from "@/modules/ee/two-factor-auth/components/confirm-password-form"; import { DisplayBackupCodes } from "@/modules/ee/two-factor-auth/components/display-backup-codes"; import { EnterCode } from "@/modules/ee/two-factor-auth/components/enter-code"; @@ -12,9 +15,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; export type EnableTwoFactorModalStep = "confirmPassword" | "scanQRCode" | "enterCode" | "backupCodes"; diff --git a/apps/web/modules/ee/two-factor-auth/components/enter-code.test.tsx b/apps/web/modules/ee/two-factor-auth/components/enter-code.test.tsx index 9103564d64..c9940d81d2 100644 --- a/apps/web/modules/ee/two-factor-auth/components/enter-code.test.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/enter-code.test.tsx @@ -1,8 +1,8 @@ -import { enableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { enableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; import { EnterCode } from "./enter-code"; vi.mock("@tolgee/react", () => ({ diff --git a/apps/web/modules/ee/two-factor-auth/components/enter-code.tsx b/apps/web/modules/ee/two-factor-auth/components/enter-code.tsx index b158e0c7ef..12667909df 100644 --- a/apps/web/modules/ee/two-factor-auth/components/enter-code.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/enter-code.tsx @@ -1,13 +1,13 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { enableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; -import { Button } from "@/modules/ui/components/button"; -import { OTPInput } from "@/modules/ui/components/otp-input"; import { useTranslate } from "@tolgee/react"; import { Controller, SubmitHandler, useForm } from "react-hook-form"; import toast from "react-hot-toast"; import { z } from "zod"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { enableTwoFactorAuthAction } from "@/modules/ee/two-factor-auth/actions"; +import { Button } from "@/modules/ui/components/button"; +import { OTPInput } from "@/modules/ui/components/otp-input"; import { EnableTwoFactorModalStep } from "./enable-two-factor-modal"; interface EnterCodeProps { diff --git a/apps/web/modules/ee/two-factor-auth/components/scan-qr-code.tsx b/apps/web/modules/ee/two-factor-auth/components/scan-qr-code.tsx index 84bea36a1b..e83912798c 100644 --- a/apps/web/modules/ee/two-factor-auth/components/scan-qr-code.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/scan-qr-code.tsx @@ -1,10 +1,10 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { CopyIcon } from "lucide-react"; import Image from "next/image"; import { toast } from "react-hot-toast"; +import { Button } from "@/modules/ui/components/button"; import { EnableTwoFactorModalStep } from "./enable-two-factor-modal"; interface ScanQRCodeProps { diff --git a/apps/web/modules/ee/two-factor-auth/components/two-factor-backup.tsx b/apps/web/modules/ee/two-factor-auth/components/two-factor-backup.tsx index e1aae0de08..7fab51ff6c 100644 --- a/apps/web/modules/ee/two-factor-auth/components/two-factor-backup.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/two-factor-backup.tsx @@ -1,9 +1,9 @@ "use client"; -import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; import { useTranslate } from "@tolgee/react"; import { UseFormReturn } from "react-hook-form"; +import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; interface TwoFactorBackupProps { form: UseFormReturn< diff --git a/apps/web/modules/ee/two-factor-auth/components/two-factor.tsx b/apps/web/modules/ee/two-factor-auth/components/two-factor.tsx index f7f839b97d..0d013a122c 100644 --- a/apps/web/modules/ee/two-factor-auth/components/two-factor.tsx +++ b/apps/web/modules/ee/two-factor-auth/components/two-factor.tsx @@ -1,9 +1,9 @@ "use client"; -import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; -import { OTPInput } from "@/modules/ui/components/otp-input"; import { useTranslate } from "@tolgee/react"; import { UseFormReturn } from "react-hook-form"; +import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; +import { OTPInput } from "@/modules/ui/components/otp-input"; interface TwoFactorProps { form: UseFormReturn< diff --git a/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.test.ts b/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.test.ts index a1878161d3..9fbc4ea80b 100644 --- a/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.test.ts +++ b/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.test.ts @@ -1,9 +1,9 @@ -import { symmetricDecrypt, symmetricEncrypt } from "@/lib/crypto"; -import { totpAuthenticatorCheck } from "@/modules/auth/lib/totp"; -import { verifyPassword } from "@/modules/auth/lib/utils"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { symmetricDecrypt, symmetricEncrypt } from "@/lib/crypto"; +import { totpAuthenticatorCheck } from "@/modules/auth/lib/totp"; +import { verifyPassword } from "@/modules/auth/lib/utils"; import { disableTwoFactorAuth, enableTwoFactorAuth, setupTwoFactorAuth } from "./two-factor-auth"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.ts b/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.ts index 7cb82a9c63..8543c5c314 100644 --- a/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.ts +++ b/apps/web/modules/ee/two-factor-auth/lib/two-factor-auth.ts @@ -1,12 +1,12 @@ -import { ENCRYPTION_KEY } from "@/lib/constants"; -import { symmetricDecrypt, symmetricEncrypt } from "@/lib/crypto"; -import { totpAuthenticatorCheck } from "@/modules/auth/lib/totp"; -import { verifyPassword } from "@/modules/auth/lib/utils"; import crypto from "crypto"; import { authenticator } from "otplib"; import qrcode from "qrcode"; import { prisma } from "@formbricks/database"; import { InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { ENCRYPTION_KEY } from "@/lib/constants"; +import { symmetricDecrypt, symmetricEncrypt } from "@/lib/crypto"; +import { totpAuthenticatorCheck } from "@/modules/auth/lib/totp"; +import { verifyPassword } from "@/modules/auth/lib/utils"; export const setupTwoFactorAuth = async ( userId: string, diff --git a/apps/web/modules/ee/whitelabel/email-customization/actions.ts b/apps/web/modules/ee/whitelabel/email-customization/actions.ts index 09b2b37c6c..6433b09613 100644 --- a/apps/web/modules/ee/whitelabel/email-customization/actions.ts +++ b/apps/web/modules/ee/whitelabel/email-customization/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; import { getOrganization } from "@/lib/organization/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; @@ -11,9 +14,6 @@ import { updateOrganizationEmailLogoUrl, } from "@/modules/ee/whitelabel/email-customization/lib/organization"; import { sendEmailCustomizationPreviewEmail } from "@/modules/email"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; export const checkWhiteLabelPermission = async (organizationId: string) => { const organization = await getOrganization(organizationId); diff --git a/apps/web/modules/ee/whitelabel/email-customization/lib/organization.ts b/apps/web/modules/ee/whitelabel/email-customization/lib/organization.ts index 3a87cbda12..47ce37e984 100644 --- a/apps/web/modules/ee/whitelabel/email-customization/lib/organization.ts +++ b/apps/web/modules/ee/whitelabel/email-customization/lib/organization.ts @@ -1,11 +1,11 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId, ZString } from "@formbricks/types/common"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const updateOrganizationEmailLogoUrl = async ( organizationId: string, diff --git a/apps/web/modules/ee/whitelabel/remove-branding/actions.ts b/apps/web/modules/ee/whitelabel/remove-branding/actions.ts index 9c733dd2ba..cbd31df74d 100644 --- a/apps/web/modules/ee/whitelabel/remove-branding/actions.ts +++ b/apps/web/modules/ee/whitelabel/remove-branding/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; import { getOrganization } from "@/lib/organization/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; @@ -10,9 +13,6 @@ import { getRemoveBrandingPermission } from "@/modules/ee/license-check/lib/util import { updateProjectBranding } from "@/modules/ee/whitelabel/remove-branding/lib/project"; import { ZProjectUpdateBrandingInput } from "@/modules/ee/whitelabel/remove-branding/types/project"; import { getProject } from "@/modules/survey/editor/lib/project"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; const ZUpdateProjectAction = z.object({ projectId: ZId, diff --git a/apps/web/modules/ee/whitelabel/remove-branding/components/branding-settings-card.tsx b/apps/web/modules/ee/whitelabel/remove-branding/components/branding-settings-card.tsx index 62a8815999..61d8aee0f3 100644 --- a/apps/web/modules/ee/whitelabel/remove-branding/components/branding-settings-card.tsx +++ b/apps/web/modules/ee/whitelabel/remove-branding/components/branding-settings-card.tsx @@ -1,10 +1,10 @@ +import { Project } from "@prisma/client"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { EditBranding } from "@/modules/ee/whitelabel/remove-branding/components/edit-branding"; import { Alert, AlertDescription } from "@/modules/ui/components/alert"; import { ModalButton, UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import { getTranslate } from "@/tolgee/server"; -import { Project } from "@prisma/client"; interface BrandingSettingsCardProps { canRemoveBranding: boolean; diff --git a/apps/web/modules/ee/whitelabel/remove-branding/components/edit-branding.tsx b/apps/web/modules/ee/whitelabel/remove-branding/components/edit-branding.tsx index 7cc2566972..4a62925b3c 100644 --- a/apps/web/modules/ee/whitelabel/remove-branding/components/edit-branding.tsx +++ b/apps/web/modules/ee/whitelabel/remove-branding/components/edit-branding.tsx @@ -1,13 +1,13 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useState } from "react"; +import toast from "react-hot-toast"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { updateProjectBrandingAction } from "@/modules/ee/whitelabel/remove-branding/actions"; import { TProjectUpdateBrandingInput } from "@/modules/ee/whitelabel/remove-branding/types/project"; import { Label } from "@/modules/ui/components/label"; import { Switch } from "@/modules/ui/components/switch"; -import { useTranslate } from "@tolgee/react"; -import { useState } from "react"; -import toast from "react-hot-toast"; interface EditBrandingProps { type: "linkSurvey" | "appSurvey"; diff --git a/apps/web/modules/ee/whitelabel/remove-branding/lib/project.test.ts b/apps/web/modules/ee/whitelabel/remove-branding/lib/project.test.ts index f7dbf8bd9e..59f4b96a5c 100644 --- a/apps/web/modules/ee/whitelabel/remove-branding/lib/project.test.ts +++ b/apps/web/modules/ee/whitelabel/remove-branding/lib/project.test.ts @@ -1,7 +1,7 @@ -import { validateInputs } from "@/lib/utils/validate"; import { afterEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { ValidationError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { TProjectUpdateBrandingInput } from "../types/project"; import { updateProjectBranding } from "./project"; diff --git a/apps/web/modules/ee/whitelabel/remove-branding/lib/project.ts b/apps/web/modules/ee/whitelabel/remove-branding/lib/project.ts index 791b2e6bf7..5930a1af7a 100644 --- a/apps/web/modules/ee/whitelabel/remove-branding/lib/project.ts +++ b/apps/web/modules/ee/whitelabel/remove-branding/lib/project.ts @@ -1,14 +1,14 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; -import { - TProjectUpdateBrandingInput, - ZProjectUpdateBrandingInput, -} from "@/modules/ee/whitelabel/remove-branding/types/project"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { ZId } from "@formbricks/types/common"; import { ValidationError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { + TProjectUpdateBrandingInput, + ZProjectUpdateBrandingInput, +} from "@/modules/ee/whitelabel/remove-branding/types/project"; export const updateProjectBranding = async ( projectId: string, diff --git a/apps/web/modules/email/components/email-template.tsx b/apps/web/modules/email/components/email-template.tsx index 0bc9db0a20..ff11000671 100644 --- a/apps/web/modules/email/components/email-template.tsx +++ b/apps/web/modules/email/components/email-template.tsx @@ -1,7 +1,7 @@ -import { FB_LOGO_URL, IMPRINT_ADDRESS, IMPRINT_URL, PRIVACY_URL } from "@/lib/constants"; import { Body, Container, Html, Img, Link, Section, Tailwind, Text } from "@react-email/components"; import { TFnType } from "@tolgee/react"; import React from "react"; +import { FB_LOGO_URL, IMPRINT_ADDRESS, IMPRINT_URL, PRIVACY_URL } from "@/lib/constants"; const fbLogoUrl = FB_LOGO_URL; const logoLink = "https://formbricks.com?utm_source=email_header&utm_medium=email"; diff --git a/apps/web/modules/email/emails/auth/forgot-password-email.tsx b/apps/web/modules/email/emails/auth/forgot-password-email.tsx index 45ba88c873..27d60159fa 100644 --- a/apps/web/modules/email/emails/auth/forgot-password-email.tsx +++ b/apps/web/modules/email/emails/auth/forgot-password-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailButton } from "../../components/email-button"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/auth/new-email-verification.tsx b/apps/web/modules/email/emails/auth/new-email-verification.tsx index f7c4451ec3..357957124d 100644 --- a/apps/web/modules/email/emails/auth/new-email-verification.tsx +++ b/apps/web/modules/email/emails/auth/new-email-verification.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Link, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailButton } from "../../components/email-button"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/auth/password-reset-notify-email.tsx b/apps/web/modules/email/emails/auth/password-reset-notify-email.tsx index a3799a736e..009a57f971 100644 --- a/apps/web/modules/email/emails/auth/password-reset-notify-email.tsx +++ b/apps/web/modules/email/emails/auth/password-reset-notify-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/auth/verification-email.tsx b/apps/web/modules/email/emails/auth/verification-email.tsx index c68ac0f018..a7ae58dfea 100644 --- a/apps/web/modules/email/emails/auth/verification-email.tsx +++ b/apps/web/modules/email/emails/auth/verification-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Link, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailButton } from "../../components/email-button"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/general/email-customization-preview-email.tsx b/apps/web/modules/email/emails/general/email-customization-preview-email.tsx index 252e15fe48..a0fed09bad 100644 --- a/apps/web/modules/email/emails/general/email-customization-preview-email.tsx +++ b/apps/web/modules/email/emails/general/email-customization-preview-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailTemplate } from "../../components/email-template"; interface EmailCustomizationPreviewEmailProps { diff --git a/apps/web/modules/email/emails/invite/invite-accepted-email.tsx b/apps/web/modules/email/emails/invite/invite-accepted-email.tsx index 12a06cc140..e827c8e654 100644 --- a/apps/web/modules/email/emails/invite/invite-accepted-email.tsx +++ b/apps/web/modules/email/emails/invite/invite-accepted-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/invite/invite-email.tsx b/apps/web/modules/email/emails/invite/invite-email.tsx index 9a4e6a1ed6..4224cd55e4 100644 --- a/apps/web/modules/email/emails/invite/invite-email.tsx +++ b/apps/web/modules/email/emails/invite/invite-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailButton } from "../../components/email-button"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/lib/utils.tsx b/apps/web/modules/email/emails/lib/utils.tsx index 9f48f0b457..16f99f04dc 100644 --- a/apps/web/modules/email/emails/lib/utils.tsx +++ b/apps/web/modules/email/emails/lib/utils.tsx @@ -1,8 +1,8 @@ -import { getOriginalFileNameFromUrl } from "@/modules/storage/utils"; import { Column, Container, Img, Link, Row, Text } from "@react-email/components"; import { TFnType } from "@tolgee/react"; import { FileIcon } from "lucide-react"; import { TSurveyQuestionType, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getOriginalFileNameFromUrl } from "@/modules/storage/utils"; export const renderEmailResponseValue = async ( response: string | string[], diff --git a/apps/web/modules/email/emails/survey/embed-survey-preview-email.tsx b/apps/web/modules/email/emails/survey/embed-survey-preview-email.tsx index 4a57ed60d4..e818eb0723 100644 --- a/apps/web/modules/email/emails/survey/embed-survey-preview-email.tsx +++ b/apps/web/modules/email/emails/survey/embed-survey-preview-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailTemplate } from "../../components/email-template"; interface EmbedSurveyPreviewEmailProps { diff --git a/apps/web/modules/email/emails/survey/link-survey-email.tsx b/apps/web/modules/email/emails/survey/link-survey-email.tsx index 69267c07c9..df093a9f7b 100644 --- a/apps/web/modules/email/emails/survey/link-survey-email.tsx +++ b/apps/web/modules/email/emails/survey/link-survey-email.tsx @@ -1,6 +1,6 @@ -import { getTranslate } from "@/tolgee/server"; import { Container, Heading, Text } from "@react-email/components"; import React from "react"; +import { getTranslate } from "@/tolgee/server"; import { EmailButton } from "../../components/email-button"; import { EmailFooter } from "../../components/email-footer"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/email/emails/survey/response-finished-email.tsx b/apps/web/modules/email/emails/survey/response-finished-email.tsx index 863a05e393..d0da02914f 100644 --- a/apps/web/modules/email/emails/survey/response-finished-email.tsx +++ b/apps/web/modules/email/emails/survey/response-finished-email.tsx @@ -1,11 +1,11 @@ -import { getQuestionResponseMapping } from "@/lib/responses"; -import { renderEmailResponseValue } from "@/modules/email/emails/lib/utils"; -import { getTranslate } from "@/tolgee/server"; import { Column, Container, Heading, Hr, Link, Row, Section, Text } from "@react-email/components"; import { FileDigitIcon, FileType2Icon } from "lucide-react"; import type { TOrganization } from "@formbricks/types/organizations"; import type { TResponse } from "@formbricks/types/responses"; import { type TSurvey } from "@formbricks/types/surveys/types"; +import { getQuestionResponseMapping } from "@/lib/responses"; +import { renderEmailResponseValue } from "@/modules/email/emails/lib/utils"; +import { getTranslate } from "@/tolgee/server"; import { EmailButton } from "../../components/email-button"; import { EmailTemplate } from "../../components/email-template"; diff --git a/apps/web/modules/environments/lib/utils.test.ts b/apps/web/modules/environments/lib/utils.test.ts index 851984f525..f4d8a06ac2 100644 --- a/apps/web/modules/environments/lib/utils.test.ts +++ b/apps/web/modules/environments/lib/utils.test.ts @@ -1,4 +1,12 @@ // utils.test.ts +import { getServerSession } from "next-auth"; +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { TEnvironment } from "@formbricks/types/environment"; +import { AuthorizationError } from "@formbricks/types/errors"; +import { TMembership } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; +import { TProject } from "@formbricks/types/project"; +import { TUser } from "@formbricks/types/user"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { getEnvironment } from "@/lib/environment/service"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; @@ -10,14 +18,6 @@ import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; import { getTeamPermissionFlags } from "@/modules/ee/teams/utils/teams"; // Pull in the mocked implementations to configure them in tests import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { TEnvironment } from "@formbricks/types/environment"; -import { AuthorizationError } from "@formbricks/types/errors"; -import { TMembership } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; -import { TProject } from "@formbricks/types/project"; -import { TUser } from "@formbricks/types/user"; import { environmentIdLayoutChecks, getEnvironmentAuth } from "./utils"; // Mock all external dependencies diff --git a/apps/web/modules/environments/lib/utils.ts b/apps/web/modules/environments/lib/utils.ts index 5011452cd9..be13d22671 100644 --- a/apps/web/modules/environments/lib/utils.ts +++ b/apps/web/modules/environments/lib/utils.ts @@ -1,3 +1,6 @@ +import { getServerSession } from "next-auth"; +import { cache as reactCache } from "react"; +import { AuthorizationError } from "@formbricks/types/errors"; import { hasUserEnvironmentAccess } from "@/lib/environment/auth"; import { getEnvironment } from "@/lib/environment/service"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; @@ -9,9 +12,6 @@ import { authOptions } from "@/modules/auth/lib/authOptions"; import { getProjectPermissionByUserId } from "@/modules/ee/teams/lib/roles"; import { getTeamPermissionFlags } from "@/modules/ee/teams/utils/teams"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { cache as reactCache } from "react"; -import { AuthorizationError } from "@formbricks/types/errors"; import { TEnvironmentAuth } from "../types/environment-auth"; /** diff --git a/apps/web/modules/environments/types/environment-auth.ts b/apps/web/modules/environments/types/environment-auth.ts index 2b8fa0f6dc..7c087de969 100644 --- a/apps/web/modules/environments/types/environment-auth.ts +++ b/apps/web/modules/environments/types/environment-auth.ts @@ -1,10 +1,10 @@ -import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { z } from "zod"; import { ZEnvironment } from "@formbricks/types/environment"; import { ZMembership } from "@formbricks/types/memberships"; import { ZOrganization } from "@formbricks/types/organizations"; import { ZProject } from "@formbricks/types/project"; import { ZUser } from "@formbricks/types/user"; +import { ZTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; export const ZEnvironmentAuth = z.object({ environment: ZEnvironment, diff --git a/apps/web/modules/integrations/webhooks/actions.ts b/apps/web/modules/integrations/webhooks/actions.ts index 4d9e486e8e..ece0c2c089 100644 --- a/apps/web/modules/integrations/webhooks/actions.ts +++ b/apps/web/modules/integrations/webhooks/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -18,8 +20,6 @@ import { updateWebhook, } from "@/modules/integrations/webhooks/lib/webhook"; import { ZWebhookInput } from "@/modules/integrations/webhooks/types/webhooks"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZCreateWebhookAction = z.object({ environmentId: ZId, diff --git a/apps/web/modules/integrations/webhooks/components/add-webhook-button.tsx b/apps/web/modules/integrations/webhooks/components/add-webhook-button.tsx index 25b5a0ca06..89a751a0ef 100644 --- a/apps/web/modules/integrations/webhooks/components/add-webhook-button.tsx +++ b/apps/web/modules/integrations/webhooks/components/add-webhook-button.tsx @@ -1,11 +1,11 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { Webhook } from "lucide-react"; import { useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { Button } from "@/modules/ui/components/button"; import { AddWebhookModal } from "./add-webhook-modal"; interface AddWebhookButtonProps { diff --git a/apps/web/modules/integrations/webhooks/components/add-webhook-modal.tsx b/apps/web/modules/integrations/webhooks/components/add-webhook-modal.tsx index e4326e7193..abe8feff23 100644 --- a/apps/web/modules/integrations/webhooks/components/add-webhook-modal.tsx +++ b/apps/web/modules/integrations/webhooks/components/add-webhook-modal.tsx @@ -1,5 +1,14 @@ "use client"; +import { PipelineTriggers } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import clsx from "clsx"; +import { Webhook } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { SurveyCheckboxGroup } from "@/modules/integrations/webhooks/components/survey-checkbox-group"; import { TriggerCheckboxGroup } from "@/modules/integrations/webhooks/components/trigger-checkbox-group"; @@ -16,15 +25,6 @@ import { } from "@/modules/ui/components/dialog"; import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; -import { PipelineTriggers } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import clsx from "clsx"; -import { Webhook } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { TSurvey } from "@formbricks/types/surveys/types"; import { createWebhookAction, testEndpointAction } from "../actions"; import { TWebhookInput } from "../types/webhooks"; diff --git a/apps/web/modules/integrations/webhooks/components/survey-checkbox-group.tsx b/apps/web/modules/integrations/webhooks/components/survey-checkbox-group.tsx index 78a8b5fc6c..1e1f46e4f4 100644 --- a/apps/web/modules/integrations/webhooks/components/survey-checkbox-group.tsx +++ b/apps/web/modules/integrations/webhooks/components/survey-checkbox-group.tsx @@ -1,9 +1,9 @@ "use client"; -import { Checkbox } from "@/modules/ui/components/checkbox"; import { useTranslate } from "@tolgee/react"; import React from "react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { Checkbox } from "@/modules/ui/components/checkbox"; interface SurveyCheckboxGroupProps { surveys: TSurvey[]; diff --git a/apps/web/modules/integrations/webhooks/components/trigger-checkbox-group.tsx b/apps/web/modules/integrations/webhooks/components/trigger-checkbox-group.tsx index 1c0ec0cda5..70d41b9ec8 100644 --- a/apps/web/modules/integrations/webhooks/components/trigger-checkbox-group.tsx +++ b/apps/web/modules/integrations/webhooks/components/trigger-checkbox-group.tsx @@ -1,9 +1,9 @@ "use client"; -import { Checkbox } from "@/modules/ui/components/checkbox"; import { PipelineTriggers } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import React from "react"; +import { Checkbox } from "@/modules/ui/components/checkbox"; interface TriggerCheckboxGroupProps { selectedTriggers: PipelineTriggers[]; diff --git a/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.test.tsx b/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.test.tsx index 5b9df4bea9..b197cb545c 100644 --- a/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.test.tsx +++ b/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.test.tsx @@ -1,9 +1,9 @@ -import { WebhookModal } from "@/modules/integrations/webhooks/components/webhook-detail-modal"; import { Webhook } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { WebhookModal } from "@/modules/integrations/webhooks/components/webhook-detail-modal"; // Mock the Dialog components vi.mock("@/modules/ui/components/dialog", () => ({ diff --git a/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.tsx b/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.tsx index 9a940eeba1..ca4aacff4d 100644 --- a/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.tsx +++ b/apps/web/modules/integrations/webhooks/components/webhook-detail-modal.tsx @@ -1,5 +1,10 @@ "use client"; +import { Webhook } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { WebhookIcon } from "lucide-react"; +import { useEffect, useState } from "react"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { WebhookOverviewTab } from "@/modules/integrations/webhooks/components/webhook-overview-tab"; import { WebhookSettingsTab } from "@/modules/integrations/webhooks/components/webhook-settings-tab"; import { @@ -10,11 +15,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { Webhook } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { WebhookIcon } from "lucide-react"; -import { useEffect, useState } from "react"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface WebhookModalProps { open: boolean; diff --git a/apps/web/modules/integrations/webhooks/components/webhook-settings-tab.tsx b/apps/web/modules/integrations/webhooks/components/webhook-settings-tab.tsx index 0d143f02b3..c262cb7d40 100644 --- a/apps/web/modules/integrations/webhooks/components/webhook-settings-tab.tsx +++ b/apps/web/modules/integrations/webhooks/components/webhook-settings-tab.tsx @@ -1,13 +1,5 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { SurveyCheckboxGroup } from "@/modules/integrations/webhooks/components/survey-checkbox-group"; -import { TriggerCheckboxGroup } from "@/modules/integrations/webhooks/components/trigger-checkbox-group"; -import { validWebHookURL } from "@/modules/integrations/webhooks/lib/utils"; -import { Button } from "@/modules/ui/components/button"; -import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { Input } from "@/modules/ui/components/input"; -import { Label } from "@/modules/ui/components/label"; import { PipelineTriggers, Webhook } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import clsx from "clsx"; @@ -18,6 +10,14 @@ import { useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "react-hot-toast"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { SurveyCheckboxGroup } from "@/modules/integrations/webhooks/components/survey-checkbox-group"; +import { TriggerCheckboxGroup } from "@/modules/integrations/webhooks/components/trigger-checkbox-group"; +import { validWebHookURL } from "@/modules/integrations/webhooks/lib/utils"; +import { Button } from "@/modules/ui/components/button"; +import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; +import { Input } from "@/modules/ui/components/input"; +import { Label } from "@/modules/ui/components/label"; import { deleteWebhookAction, testEndpointAction, updateWebhookAction } from "../actions"; import { TWebhookInput } from "../types/webhooks"; diff --git a/apps/web/modules/integrations/webhooks/components/webhook-table.tsx b/apps/web/modules/integrations/webhooks/components/webhook-table.tsx index f173e0cb34..ca52b08196 100644 --- a/apps/web/modules/integrations/webhooks/components/webhook-table.tsx +++ b/apps/web/modules/integrations/webhooks/components/webhook-table.tsx @@ -1,12 +1,12 @@ "use client"; -import { WebhookModal } from "@/modules/integrations/webhooks/components/webhook-detail-modal"; -import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { Webhook } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { type JSX, useState } from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { WebhookModal } from "@/modules/integrations/webhooks/components/webhook-detail-modal"; +import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; interface WebhookTableProps { environment: TEnvironment; diff --git a/apps/web/modules/integrations/webhooks/lib/webhook.ts b/apps/web/modules/integrations/webhooks/lib/webhook.ts index 26611eb229..cd5c5a8b86 100644 --- a/apps/web/modules/integrations/webhooks/lib/webhook.ts +++ b/apps/web/modules/integrations/webhooks/lib/webhook.ts @@ -1,5 +1,3 @@ -import { validateInputs } from "@/lib/utils/validate"; -import { isDiscordWebhook } from "@/modules/integrations/webhooks/lib/utils"; import { Prisma, Webhook } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; @@ -10,6 +8,8 @@ import { ResourceNotFoundError, UnknownError, } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; +import { isDiscordWebhook } from "@/modules/integrations/webhooks/lib/utils"; import { TWebhookInput } from "../types/webhooks"; export const updateWebhook = async ( diff --git a/apps/web/modules/organization/actions.ts b/apps/web/modules/organization/actions.ts index 9f95190999..1d7d49148f 100644 --- a/apps/web/modules/organization/actions.ts +++ b/apps/web/modules/organization/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { TUserNotificationSettings } from "@formbricks/types/user"; import { createMembership } from "@/lib/membership/service"; import { createOrganization } from "@/lib/organization/service"; import { updateUser } from "@/lib/user/service"; @@ -8,9 +11,6 @@ import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/co import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; import { createProject } from "@/modules/projects/settings/lib/project"; -import { z } from "zod"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { TUserNotificationSettings } from "@formbricks/types/user"; const ZCreateOrganizationAction = z.object({ organizationName: z.string().min(1, "Organization name must be at least 1 character long"), diff --git a/apps/web/modules/organization/components/CreateOrganizationModal/index.test.tsx b/apps/web/modules/organization/components/CreateOrganizationModal/index.test.tsx index 2688acd7ed..c00fe47b4f 100644 --- a/apps/web/modules/organization/components/CreateOrganizationModal/index.test.tsx +++ b/apps/web/modules/organization/components/CreateOrganizationModal/index.test.tsx @@ -1,9 +1,9 @@ -import { createOrganizationAction } from "@/modules/organization/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { createOrganizationAction } from "@/modules/organization/actions"; import { CreateOrganizationModal } from "./index"; vi.mock("@/modules/ui/components/dialog", () => ({ diff --git a/apps/web/modules/organization/components/CreateOrganizationModal/index.tsx b/apps/web/modules/organization/components/CreateOrganizationModal/index.tsx index c2aeb69013..f82b5cfd39 100644 --- a/apps/web/modules/organization/components/CreateOrganizationModal/index.tsx +++ b/apps/web/modules/organization/components/CreateOrganizationModal/index.tsx @@ -1,5 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { PlusCircleIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import toast from "react-hot-toast"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createOrganizationAction } from "@/modules/organization/actions"; import { Button } from "@/modules/ui/components/button"; @@ -14,12 +20,6 @@ import { } from "@/modules/ui/components/dialog"; import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; -import { useTranslate } from "@tolgee/react"; -import { PlusCircleIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; interface CreateOrganizationModalProps { open: boolean; diff --git a/apps/web/modules/organization/lib/utils.test.ts b/apps/web/modules/organization/lib/utils.test.ts index 0bddfbcf0b..0ff0c0a3ed 100644 --- a/apps/web/modules/organization/lib/utils.test.ts +++ b/apps/web/modules/organization/lib/utils.test.ts @@ -1,9 +1,9 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { getOrganization } from "@/lib/organization/service"; import { getServerSession } from "next-auth"; import { describe, expect, test, vi } from "vitest"; import { TMembership } from "@formbricks/types/memberships"; import { TOrganization } from "@formbricks/types/organizations"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { getOrganization } from "@/lib/organization/service"; import { getOrganizationAuth } from "./utils"; vi.mock("@/lib/membership/service", () => ({ diff --git a/apps/web/modules/organization/lib/utils.ts b/apps/web/modules/organization/lib/utils.ts index 26a26f6699..301545fe11 100644 --- a/apps/web/modules/organization/lib/utils.ts +++ b/apps/web/modules/organization/lib/utils.ts @@ -1,10 +1,10 @@ +import { getServerSession } from "next-auth"; +import { cache as reactCache } from "react"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { getAccessFlags } from "@/lib/membership/utils"; import { getOrganization } from "@/lib/organization/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { cache as reactCache } from "react"; import { TOrganizationAuth } from "../types/organization-auth"; /** diff --git a/apps/web/modules/organization/settings/api-keys/actions.ts b/apps/web/modules/organization/settings/api-keys/actions.ts index 8dc80e8297..c607f732fa 100644 --- a/apps/web/modules/organization/settings/api-keys/actions.ts +++ b/apps/web/modules/organization/settings/api-keys/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -10,8 +12,6 @@ import { deleteApiKey, updateApiKey, } from "@/modules/organization/settings/api-keys/lib/api-key"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; import { ZApiKeyCreateInput, ZApiKeyUpdateInput } from "./types/api-keys"; const ZDeleteApiKeyAction = z.object({ diff --git a/apps/web/modules/organization/settings/api-keys/components/add-api-key-modal.tsx b/apps/web/modules/organization/settings/api-keys/components/add-api-key-modal.tsx index c733a1ce62..f5829720f0 100644 --- a/apps/web/modules/organization/settings/api-keys/components/add-api-key-modal.tsx +++ b/apps/web/modules/organization/settings/api-keys/components/add-api-key-modal.tsx @@ -1,5 +1,12 @@ "use client"; +import { ApiKeyPermission } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { ChevronDownIcon, Trash2Icon } from "lucide-react"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import { toast } from "react-hot-toast"; +import { TOrganizationAccess } from "@formbricks/types/api-key"; import { TOrganizationProject } from "@/modules/organization/settings/api-keys/types/api-keys"; import { Alert, AlertTitle } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; @@ -20,13 +27,6 @@ import { import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; import { Switch } from "@/modules/ui/components/switch"; -import { ApiKeyPermission } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { ChevronDownIcon, Trash2Icon } from "lucide-react"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { toast } from "react-hot-toast"; -import { TOrganizationAccess } from "@formbricks/types/api-key"; interface AddApiKeyModalProps { open: boolean; diff --git a/apps/web/modules/organization/settings/api-keys/components/api-key-list.tsx b/apps/web/modules/organization/settings/api-keys/components/api-key-list.tsx index 84525a2fe7..4934494817 100644 --- a/apps/web/modules/organization/settings/api-keys/components/api-key-list.tsx +++ b/apps/web/modules/organization/settings/api-keys/components/api-key-list.tsx @@ -1,6 +1,6 @@ +import { TUserLocale } from "@formbricks/types/user"; import { getApiKeysWithEnvironmentPermissions } from "@/modules/organization/settings/api-keys/lib/api-key"; import { TOrganizationProject } from "@/modules/organization/settings/api-keys/types/api-keys"; -import { TUserLocale } from "@formbricks/types/user"; import { EditAPIKeys } from "./edit-api-keys"; interface ApiKeyListProps { diff --git a/apps/web/modules/organization/settings/api-keys/components/view-permission-modal.tsx b/apps/web/modules/organization/settings/api-keys/components/view-permission-modal.tsx index cfae47b16b..cd59579e8f 100644 --- a/apps/web/modules/organization/settings/api-keys/components/view-permission-modal.tsx +++ b/apps/web/modules/organization/settings/api-keys/components/view-permission-modal.tsx @@ -1,5 +1,10 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { useEffect } from "react"; +import { useForm } from "react-hook-form"; +import { TOrganizationAccess } from "@formbricks/types/api-key"; import { TApiKeyUpdateInput, TApiKeyWithEnvironmentPermission, @@ -19,11 +24,6 @@ import { DropdownMenu, DropdownMenuTrigger } from "@/modules/ui/components/dropd import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; import { Switch } from "@/modules/ui/components/switch"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { useEffect } from "react"; -import { useForm } from "react-hook-form"; -import { TOrganizationAccess } from "@formbricks/types/api-key"; interface ViewPermissionModalProps { open: boolean; diff --git a/apps/web/modules/organization/settings/api-keys/lib/projects.ts b/apps/web/modules/organization/settings/api-keys/lib/projects.ts index 05fdfdb41e..fbde452734 100644 --- a/apps/web/modules/organization/settings/api-keys/lib/projects.ts +++ b/apps/web/modules/organization/settings/api-keys/lib/projects.ts @@ -1,8 +1,8 @@ -import { TOrganizationProject } from "@/modules/organization/settings/api-keys/types/api-keys"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { TOrganizationProject } from "@/modules/organization/settings/api-keys/types/api-keys"; export const getProjectsByOrganizationId = reactCache( async (organizationId: string): Promise => { diff --git a/apps/web/modules/organization/settings/api-keys/loading.tsx b/apps/web/modules/organization/settings/api-keys/loading.tsx index a273426e37..c2e625b5bd 100644 --- a/apps/web/modules/organization/settings/api-keys/loading.tsx +++ b/apps/web/modules/organization/settings/api-keys/loading.tsx @@ -1,9 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { OrganizationSettingsNavbar } from "@/app/(app)/environments/[environmentId]/settings/(organization)/components/OrganizationSettingsNavbar"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; const LoadingCard = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/organization/settings/api-keys/page.test.tsx b/apps/web/modules/organization/settings/api-keys/page.test.tsx index 6dfa0b742f..5d7d963e4f 100644 --- a/apps/web/modules/organization/settings/api-keys/page.test.tsx +++ b/apps/web/modules/organization/settings/api-keys/page.test.tsx @@ -1,10 +1,10 @@ +import "@testing-library/jest-dom/vitest"; +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, describe, expect, test, vi } from "vitest"; import { findMatchingLocale } from "@/lib/utils/locale"; import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { getProjectsByOrganizationId } from "@/modules/organization/settings/api-keys/lib/projects"; import { TOrganizationProject } from "@/modules/organization/settings/api-keys/types/api-keys"; -import "@testing-library/jest-dom/vitest"; -import { cleanup, render, screen } from "@testing-library/react"; -import { afterEach, describe, expect, test, vi } from "vitest"; import { APIKeysPage } from "./page"; vi.mock("@/modules/ui/components/page-content-wrapper", () => ({ diff --git a/apps/web/modules/organization/settings/teams/actions.ts b/apps/web/modules/organization/settings/teams/actions.ts index 9df2ce6427..82fa15dbe8 100644 --- a/apps/web/modules/organization/settings/teams/actions.ts +++ b/apps/web/modules/organization/settings/teams/actions.ts @@ -1,5 +1,10 @@ "use server"; +import { OrganizationRole } from "@prisma/client"; +import { z } from "zod"; +import { ZId, ZUuid } from "@formbricks/types/common"; +import { AuthenticationError, OperationNotAllowedError, ValidationError } from "@formbricks/types/errors"; +import { ZOrganizationRole } from "@formbricks/types/memberships"; import { INVITE_DISABLED, IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { createInviteToken } from "@/lib/jwt"; import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; @@ -17,11 +22,6 @@ import { getMembershipsByUserId, getOrganizationOwnerCount, } from "@/modules/organization/settings/teams/lib/membership"; -import { OrganizationRole } from "@prisma/client"; -import { z } from "zod"; -import { ZId, ZUuid } from "@formbricks/types/common"; -import { AuthenticationError, OperationNotAllowedError, ValidationError } from "@formbricks/types/errors"; -import { ZOrganizationRole } from "@formbricks/types/memberships"; import { deleteInvite, getInvite, inviteUser, resendInvite } from "./lib/invite"; const ZDeleteInviteAction = z.object({ diff --git a/apps/web/modules/organization/settings/teams/components/edit-memberships/edit-memberships.tsx b/apps/web/modules/organization/settings/teams/components/edit-memberships/edit-memberships.tsx index ed81ba1d8b..c4f4ad77a6 100644 --- a/apps/web/modules/organization/settings/teams/components/edit-memberships/edit-memberships.tsx +++ b/apps/web/modules/organization/settings/teams/components/edit-memberships/edit-memberships.tsx @@ -1,10 +1,10 @@ +import { TOrganizationRole } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { MembersInfo } from "@/modules/organization/settings/teams/components/edit-memberships/members-info"; import { getInvitesByOrganizationId } from "@/modules/organization/settings/teams/lib/invite"; import { getMembershipByOrganizationId } from "@/modules/organization/settings/teams/lib/membership"; import { getTranslate } from "@/tolgee/server"; -import { TOrganizationRole } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; interface EditMembershipsProps { organization: TOrganization; diff --git a/apps/web/modules/organization/settings/teams/components/edit-memberships/member-actions.tsx b/apps/web/modules/organization/settings/teams/components/edit-memberships/member-actions.tsx index 7c07d1d455..0484335b0c 100644 --- a/apps/web/modules/organization/settings/teams/components/edit-memberships/member-actions.tsx +++ b/apps/web/modules/organization/settings/teams/components/edit-memberships/member-actions.tsx @@ -1,5 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { SendHorizonalIcon, ShareIcon, TrashIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useMemo, useState } from "react"; +import toast from "react-hot-toast"; +import { TMember } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createInviteTokenAction, @@ -12,13 +19,6 @@ import { TInvite } from "@/modules/organization/settings/teams/types/invites"; import { Button } from "@/modules/ui/components/button"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; -import { useTranslate } from "@tolgee/react"; -import { SendHorizonalIcon, ShareIcon, TrashIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useMemo, useState } from "react"; -import toast from "react-hot-toast"; -import { TMember } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; interface MemberActionsProps { organization: TOrganization; diff --git a/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.test.tsx b/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.test.tsx index ffb2844cf0..4953da1733 100644 --- a/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.test.tsx +++ b/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.test.tsx @@ -1,11 +1,11 @@ -import { getAccessFlags } from "@/lib/membership/utils"; -import { isInviteExpired } from "@/modules/organization/settings/teams/lib/utils"; -import { TInvite } from "@/modules/organization/settings/teams/types/invites"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TMember } from "@formbricks/types/memberships"; import { TOrganization } from "@formbricks/types/organizations"; +import { getAccessFlags } from "@/lib/membership/utils"; +import { isInviteExpired } from "@/modules/organization/settings/teams/lib/utils"; +import { TInvite } from "@/modules/organization/settings/teams/types/invites"; import { MembersInfo } from "./members-info"; vi.mock("@/modules/ee/role-management/components/edit-membership-role", () => ({ diff --git a/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.tsx b/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.tsx index bf1a7e79d7..bf0643aca1 100644 --- a/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.tsx +++ b/apps/web/modules/organization/settings/teams/components/edit-memberships/members-info.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { TMember, TOrganizationRole } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; import { getAccessFlags } from "@/lib/membership/utils"; import { getFormattedDateTimeString } from "@/lib/utils/datetime"; import { EditMembershipRole } from "@/modules/ee/role-management/components/edit-membership-role"; @@ -8,9 +11,6 @@ import { isInviteExpired } from "@/modules/organization/settings/teams/lib/utils import { TInvite } from "@/modules/organization/settings/teams/types/invites"; import { Badge } from "@/modules/ui/components/badge"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; -import { useTranslate } from "@tolgee/react"; -import { TMember, TOrganizationRole } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; interface MembersInfoProps { organization: TOrganization; diff --git a/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.test.tsx b/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.test.tsx index 45f9ca808d..359149332e 100644 --- a/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.test.tsx +++ b/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.test.tsx @@ -1,12 +1,12 @@ -import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; -import { inviteUserAction, leaveOrganizationAction } from "@/modules/organization/settings/teams/actions"; -import { InviteMemberModal } from "@/modules/organization/settings/teams/components/invite-member/invite-member-modal"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; import { useRouter } from "next/navigation"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; +import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; +import { inviteUserAction, leaveOrganizationAction } from "@/modules/organization/settings/teams/actions"; +import { InviteMemberModal } from "@/modules/organization/settings/teams/components/invite-member/invite-member-modal"; import { OrganizationActions } from "./organization-actions"; // Mock the next/navigation module diff --git a/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.tsx b/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.tsx index 77d62b33df..7f771f005b 100644 --- a/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.tsx +++ b/apps/web/modules/organization/settings/teams/components/edit-memberships/organization-actions.tsx @@ -1,5 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { XIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import toast from "react-hot-toast"; +import { TOrganizationRole } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { getAccessFlags } from "@/lib/membership/utils"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; @@ -16,13 +23,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { XIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import toast from "react-hot-toast"; -import { TOrganizationRole } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; interface OrganizationActionsProps { role: TOrganizationRole; diff --git a/apps/web/modules/organization/settings/teams/components/invite-member/bulk-invite-tab.tsx b/apps/web/modules/organization/settings/teams/components/invite-member/bulk-invite-tab.tsx index 0964d71f84..d1f49427a0 100644 --- a/apps/web/modules/organization/settings/teams/components/invite-member/bulk-invite-tab.tsx +++ b/apps/web/modules/organization/settings/teams/components/invite-member/bulk-invite-tab.tsx @@ -1,9 +1,5 @@ "use client"; -import { ZInvitees } from "@/modules/organization/settings/teams/types/invites"; -import { Alert, AlertDescription } from "@/modules/ui/components/alert"; -import { Button } from "@/modules/ui/components/button"; -import { Uploader } from "@/modules/ui/components/file-input/components/uploader"; import { useTranslate } from "@tolgee/react"; import { XIcon } from "lucide-react"; import Link from "next/link"; @@ -11,6 +7,10 @@ import Papa, { type ParseResult } from "papaparse"; import { useState } from "react"; import toast from "react-hot-toast"; import { TOrganizationRole } from "@formbricks/types/memberships"; +import { ZInvitees } from "@/modules/organization/settings/teams/types/invites"; +import { Alert, AlertDescription } from "@/modules/ui/components/alert"; +import { Button } from "@/modules/ui/components/button"; +import { Uploader } from "@/modules/ui/components/file-input/components/uploader"; interface BulkInviteTabProps { setOpen: (v: boolean) => void; diff --git a/apps/web/modules/organization/settings/teams/components/invite-member/individual-invite-tab.tsx b/apps/web/modules/organization/settings/teams/components/invite-member/individual-invite-tab.tsx index b40a124a2d..d745d98817 100644 --- a/apps/web/modules/organization/settings/teams/components/invite-member/individual-invite-tab.tsx +++ b/apps/web/modules/organization/settings/teams/components/invite-member/individual-invite-tab.tsx @@ -1,14 +1,5 @@ "use client"; -import { AddMemberRole } from "@/modules/ee/role-management/components/add-member-role"; -import { TOrganizationTeam } from "@/modules/ee/teams/team-list/types/team"; -import { Alert, AlertDescription } from "@/modules/ui/components/alert"; -import { Button } from "@/modules/ui/components/button"; -import { FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; -import { Label } from "@/modules/ui/components/label"; -import { MultiSelect } from "@/modules/ui/components/multi-select"; -import { Small } from "@/modules/ui/components/typography"; import { zodResolver } from "@hookform/resolvers/zod"; import { OrganizationRole } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; @@ -18,6 +9,15 @@ import { FormProvider, useForm } from "react-hook-form"; import { z } from "zod"; import { TOrganizationRole, ZOrganizationRole } from "@formbricks/types/memberships"; import { ZUserName } from "@formbricks/types/user"; +import { AddMemberRole } from "@/modules/ee/role-management/components/add-member-role"; +import { TOrganizationTeam } from "@/modules/ee/teams/team-list/types/team"; +import { Alert, AlertDescription } from "@/modules/ui/components/alert"; +import { Button } from "@/modules/ui/components/button"; +import { FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; +import { Label } from "@/modules/ui/components/label"; +import { MultiSelect } from "@/modules/ui/components/multi-select"; +import { Small } from "@/modules/ui/components/typography"; interface IndividualInviteTabProps { setOpen: (v: boolean) => void; diff --git a/apps/web/modules/organization/settings/teams/components/invite-member/invite-member-modal.tsx b/apps/web/modules/organization/settings/teams/components/invite-member/invite-member-modal.tsx index 6f672c9296..0810875373 100644 --- a/apps/web/modules/organization/settings/teams/components/invite-member/invite-member-modal.tsx +++ b/apps/web/modules/organization/settings/teams/components/invite-member/invite-member-modal.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useState } from "react"; +import { TOrganizationRole } from "@formbricks/types/memberships"; import { TOrganizationTeam } from "@/modules/ee/teams/team-list/types/team"; import { Dialog, @@ -10,9 +13,6 @@ import { DialogTitle, } from "@/modules/ui/components/dialog"; import { TabToggle } from "@/modules/ui/components/tab-toggle"; -import { useTranslate } from "@tolgee/react"; -import { useState } from "react"; -import { TOrganizationRole } from "@formbricks/types/memberships"; import { BulkInviteTab } from "./bulk-invite-tab"; import { IndividualInviteTab } from "./individual-invite-tab"; diff --git a/apps/web/modules/organization/settings/teams/components/invite-member/share-invite-modal.tsx b/apps/web/modules/organization/settings/teams/components/invite-member/share-invite-modal.tsx index 1ee4ff9552..c6ebd8ef17 100644 --- a/apps/web/modules/organization/settings/teams/components/invite-member/share-invite-modal.tsx +++ b/apps/web/modules/organization/settings/teams/components/invite-member/share-invite-modal.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { CheckIcon, CopyIcon } from "lucide-react"; +import toast from "react-hot-toast"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -10,9 +13,6 @@ import { DialogTitle, } from "@/modules/ui/components/dialog"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { CheckIcon, CopyIcon } from "lucide-react"; -import toast from "react-hot-toast"; interface ShareInviteModalProps { inviteToken: string; diff --git a/apps/web/modules/organization/settings/teams/components/members-view.test.tsx b/apps/web/modules/organization/settings/teams/components/members-view.test.tsx index ded36b93cd..aac210ba24 100644 --- a/apps/web/modules/organization/settings/teams/components/members-view.test.tsx +++ b/apps/web/modules/organization/settings/teams/components/members-view.test.tsx @@ -1,10 +1,10 @@ -import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; -import { getTeamsByOrganizationId } from "@/modules/ee/teams/team-list/lib/team"; -import { getMembershipsByUserId } from "@/modules/organization/settings/teams/lib/membership"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TOrganizationRole } from "@formbricks/types/memberships"; +import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; +import { getTeamsByOrganizationId } from "@/modules/ee/teams/team-list/lib/team"; +import { getMembershipsByUserId } from "@/modules/organization/settings/teams/lib/membership"; import { MembersLoading, MembersView } from "./members-view"; vi.mock("@/app/(app)/environments/[environmentId]/settings/components/SettingsCard", () => ({ diff --git a/apps/web/modules/organization/settings/teams/components/members-view.tsx b/apps/web/modules/organization/settings/teams/components/members-view.tsx index d3a6d90698..0d78907175 100644 --- a/apps/web/modules/organization/settings/teams/components/members-view.tsx +++ b/apps/web/modules/organization/settings/teams/components/members-view.tsx @@ -1,3 +1,6 @@ +import { Suspense } from "react"; +import { TOrganizationRole } from "@formbricks/types/memberships"; +import { TOrganization } from "@formbricks/types/organizations"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { INVITE_DISABLED, IS_FORMBRICKS_CLOUD, IS_STORAGE_CONFIGURED } from "@/lib/constants"; import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; @@ -7,9 +10,6 @@ import { EditMemberships } from "@/modules/organization/settings/teams/component import { OrganizationActions } from "@/modules/organization/settings/teams/components/edit-memberships/organization-actions"; import { getMembershipsByUserId } from "@/modules/organization/settings/teams/lib/membership"; import { getTranslate } from "@/tolgee/server"; -import { Suspense } from "react"; -import { TOrganizationRole } from "@formbricks/types/memberships"; -import { TOrganization } from "@formbricks/types/organizations"; interface MembersViewProps { membershipRole?: TOrganizationRole; diff --git a/apps/web/modules/organization/settings/teams/lib/invite.test.ts b/apps/web/modules/organization/settings/teams/lib/invite.test.ts index 39c1349a41..1ca6cd7281 100644 --- a/apps/web/modules/organization/settings/teams/lib/invite.test.ts +++ b/apps/web/modules/organization/settings/teams/lib/invite.test.ts @@ -1,4 +1,3 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { Invite, Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -8,6 +7,7 @@ import { ResourceNotFoundError, ValidationError, } from "@formbricks/types/errors"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; import { TInvitee } from "../types/invites"; import { deleteInvite, getInvite, getInvitesByOrganizationId, inviteUser, resendInvite } from "./invite"; diff --git a/apps/web/modules/organization/settings/teams/lib/invite.ts b/apps/web/modules/organization/settings/teams/lib/invite.ts index 3adda0e2d5..0f06e9fa23 100644 --- a/apps/web/modules/organization/settings/teams/lib/invite.ts +++ b/apps/web/modules/organization/settings/teams/lib/invite.ts @@ -1,6 +1,3 @@ -import { ITEMS_PER_PAGE } from "@/lib/constants"; -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { validateInputs } from "@/lib/utils/validate"; import { Invite, Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; @@ -11,6 +8,9 @@ import { ResourceNotFoundError, ValidationError, } from "@formbricks/types/errors"; +import { ITEMS_PER_PAGE } from "@/lib/constants"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { validateInputs } from "@/lib/utils/validate"; import { type InviteWithCreator, type TInvite, type TInvitee } from "../types/invites"; export const resendInvite = async (inviteId: string): Promise> => { diff --git a/apps/web/modules/organization/settings/teams/lib/membership.ts b/apps/web/modules/organization/settings/teams/lib/membership.ts index 34abd69142..6353e0bd80 100644 --- a/apps/web/modules/organization/settings/teams/lib/membership.ts +++ b/apps/web/modules/organization/settings/teams/lib/membership.ts @@ -1,7 +1,4 @@ import "server-only"; -import { ITEMS_PER_PAGE } from "@/lib/constants"; -import { validateInputs } from "@/lib/utils/validate"; -import { TOrganizationMember } from "@/modules/ee/teams/team-list/types/team"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; @@ -9,6 +6,9 @@ import { logger } from "@formbricks/logger"; import { ZOptionalNumber, ZString } from "@formbricks/types/common"; import { DatabaseError, UnknownError } from "@formbricks/types/errors"; import { TMember, TMembership } from "@formbricks/types/memberships"; +import { ITEMS_PER_PAGE } from "@/lib/constants"; +import { validateInputs } from "@/lib/utils/validate"; +import { TOrganizationMember } from "@/modules/ee/teams/team-list/types/team"; export const getMembershipByOrganizationId = reactCache( async (organizationId: string, page?: number): Promise => { diff --git a/apps/web/modules/organization/settings/teams/lib/utils.test.ts b/apps/web/modules/organization/settings/teams/lib/utils.test.ts index 175663b38b..fff59cc017 100644 --- a/apps/web/modules/organization/settings/teams/lib/utils.test.ts +++ b/apps/web/modules/organization/settings/teams/lib/utils.test.ts @@ -1,5 +1,5 @@ -import { TInvite } from "@/modules/organization/settings/teams/types/invites"; import { describe, expect, test } from "vitest"; +import { TInvite } from "@/modules/organization/settings/teams/types/invites"; import { isInviteExpired } from "./utils"; describe("isInviteExpired", () => { diff --git a/apps/web/modules/organization/settings/teams/page.test.tsx b/apps/web/modules/organization/settings/teams/page.test.tsx index b5be315092..b63fc9e931 100644 --- a/apps/web/modules/organization/settings/teams/page.test.tsx +++ b/apps/web/modules/organization/settings/teams/page.test.tsx @@ -1,8 +1,8 @@ -import { getAccessControlPermission } from "@/modules/ee/license-check/lib/utils"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getAccessControlPermission } from "@/modules/ee/license-check/lib/utils"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TeamsPage } from "./page"; vi.mock( diff --git a/apps/web/modules/projects/components/create-project-modal/index.test.tsx b/apps/web/modules/projects/components/create-project-modal/index.test.tsx index f9c6e6960b..96a7d26a9f 100644 --- a/apps/web/modules/projects/components/create-project-modal/index.test.tsx +++ b/apps/web/modules/projects/components/create-project-modal/index.test.tsx @@ -1,10 +1,10 @@ -import { createProjectAction } from "@/app/(app)/environments/[environmentId]/actions"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { getTeamsByOrganizationIdAction } from "@/modules/projects/settings/actions"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { toast } from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { createProjectAction } from "@/app/(app)/environments/[environmentId]/actions"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { getTeamsByOrganizationIdAction } from "@/modules/projects/settings/actions"; import { CreateProjectModal } from "./index"; // Mock dependencies diff --git a/apps/web/modules/projects/components/create-project-modal/index.tsx b/apps/web/modules/projects/components/create-project-modal/index.tsx index d170d522b3..aba28fd9d7 100644 --- a/apps/web/modules/projects/components/create-project-modal/index.tsx +++ b/apps/web/modules/projects/components/create-project-modal/index.tsx @@ -1,5 +1,13 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { useEffect, useState } from "react"; +import { useForm } from "react-hook-form"; +import { toast } from "react-hot-toast"; +import { z } from "zod"; +import { ZProject } from "@formbricks/types/project"; import { TOrganizationTeam } from "@/app/(app)/(onboarding)/types/onboarding"; import { createProjectAction } from "@/app/(app)/environments/[environmentId]/actions"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; @@ -24,14 +32,6 @@ import { } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; import { MultiSelect } from "@/modules/ui/components/multi-select"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { useEffect, useState } from "react"; -import { useForm } from "react-hook-form"; -import { toast } from "react-hot-toast"; -import { z } from "zod"; -import { ZProject } from "@formbricks/types/project"; const ZCreateProjectForm = z.object({ name: ZProject.shape.name, diff --git a/apps/web/modules/projects/components/project-limit-modal/index.test.tsx b/apps/web/modules/projects/components/project-limit-modal/index.test.tsx index 121bc9b7d0..479e570299 100644 --- a/apps/web/modules/projects/components/project-limit-modal/index.test.tsx +++ b/apps/web/modules/projects/components/project-limit-modal/index.test.tsx @@ -1,7 +1,7 @@ -import { ModalButton } from "@/modules/ui/components/upgrade-prompt"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { ModalButton } from "@/modules/ui/components/upgrade-prompt"; import { ProjectLimitModal } from "./index"; vi.mock("@/modules/ui/components/dialog", () => ({ diff --git a/apps/web/modules/projects/components/project-limit-modal/index.tsx b/apps/web/modules/projects/components/project-limit-modal/index.tsx index 1f5dcd5178..7fd50a17bd 100644 --- a/apps/web/modules/projects/components/project-limit-modal/index.tsx +++ b/apps/web/modules/projects/components/project-limit-modal/index.tsx @@ -1,8 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { Dialog, DialogContent } from "@/modules/ui/components/dialog"; import { ModalButton, UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; -import { useTranslate } from "@tolgee/react"; interface ProjectLimitModalProps { open: boolean; diff --git a/apps/web/modules/projects/settings/(setup)/app-connection/loading.tsx b/apps/web/modules/projects/settings/(setup)/app-connection/loading.tsx index 3dd0c88e65..4017e052f6 100644 --- a/apps/web/modules/projects/settings/(setup)/app-connection/loading.tsx +++ b/apps/web/modules/projects/settings/(setup)/app-connection/loading.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { LoadingCard } from "@/app/(app)/components/LoadingCard"; import { ProjectConfigNavigation } from "@/modules/projects/settings/components/project-config-navigation"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; export const AppConnectionLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/projects/settings/(setup)/app-connection/page.tsx b/apps/web/modules/projects/settings/(setup)/app-connection/page.tsx index 02b45cbfac..89bb629e18 100644 --- a/apps/web/modules/projects/settings/(setup)/app-connection/page.tsx +++ b/apps/web/modules/projects/settings/(setup)/app-connection/page.tsx @@ -1,5 +1,6 @@ "use server"; +import Link from "next/link"; import { WidgetStatusIndicator } from "@/app/(app)/environments/[environmentId]/components/WidgetStatusIndicator"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { getActionClasses } from "@/lib/actionClass/service"; @@ -13,7 +14,6 @@ import { IdBadge } from "@/modules/ui/components/id-badge"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import Link from "next/link"; import { ActionSettingsCard } from "../components/action-settings-card"; export const AppConnectionPage = async ({ params }: { params: Promise<{ environmentId: string }> }) => { diff --git a/apps/web/modules/projects/settings/(setup)/components/ActionDetailModal.tsx b/apps/web/modules/projects/settings/(setup)/components/ActionDetailModal.tsx index 66cfcbf6e2..051b7f3beb 100644 --- a/apps/web/modules/projects/settings/(setup)/components/ActionDetailModal.tsx +++ b/apps/web/modules/projects/settings/(setup)/components/ActionDetailModal.tsx @@ -1,10 +1,10 @@ "use client"; -import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils"; -import { ModalWithTabs } from "@/modules/ui/components/modal-with-tabs"; import { useTranslate } from "@tolgee/react"; import { TActionClass } from "@formbricks/types/action-classes"; import { TEnvironment } from "@formbricks/types/environment"; +import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils"; +import { ModalWithTabs } from "@/modules/ui/components/modal-with-tabs"; import { ActionActivityTab } from "./ActionActivityTab"; import { ActionSettingsTab } from "./ActionSettingsTab"; diff --git a/apps/web/modules/projects/settings/(setup)/components/ActionRowData.test.tsx b/apps/web/modules/projects/settings/(setup)/components/ActionRowData.test.tsx index 1d44306363..6ecef4b19b 100644 --- a/apps/web/modules/projects/settings/(setup)/components/ActionRowData.test.tsx +++ b/apps/web/modules/projects/settings/(setup)/components/ActionRowData.test.tsx @@ -1,7 +1,7 @@ -import { timeSince } from "@/lib/time"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TActionClass } from "@formbricks/types/action-classes"; +import { timeSince } from "@/lib/time"; import { ActionClassDataRow } from "./ActionRowData"; vi.mock("@/lib/time", () => ({ diff --git a/apps/web/modules/projects/settings/(setup)/components/ActionRowData.tsx b/apps/web/modules/projects/settings/(setup)/components/ActionRowData.tsx index 86e3b94fe7..1f72cf55bc 100644 --- a/apps/web/modules/projects/settings/(setup)/components/ActionRowData.tsx +++ b/apps/web/modules/projects/settings/(setup)/components/ActionRowData.tsx @@ -1,7 +1,7 @@ -import { timeSince } from "@/lib/time"; -import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils"; import { TActionClass } from "@formbricks/types/action-classes"; import { TUserLocale } from "@formbricks/types/user"; +import { timeSince } from "@/lib/time"; +import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils"; export const ActionClassDataRow = ({ actionClass, diff --git a/apps/web/modules/projects/settings/(setup)/components/ActionSettingsTab.tsx b/apps/web/modules/projects/settings/(setup)/components/ActionSettingsTab.tsx index 28a08d7be6..c36681a8d3 100644 --- a/apps/web/modules/projects/settings/(setup)/components/ActionSettingsTab.tsx +++ b/apps/web/modules/projects/settings/(setup)/components/ActionSettingsTab.tsx @@ -1,5 +1,13 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { TrashIcon } from "lucide-react"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; +import { useMemo, useState } from "react"; +import { FormProvider, useForm } from "react-hook-form"; +import { toast } from "react-hot-toast"; +import { TActionClass, TActionClassInput } from "@formbricks/types/action-classes"; import { deleteActionClassAction, updateActionClassAction, @@ -15,14 +23,6 @@ import { Button } from "@/modules/ui/components/button"; import { CodeActionForm } from "@/modules/ui/components/code-action-form"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { NoCodeActionForm } from "@/modules/ui/components/no-code-action-form"; -import { useTranslate } from "@tolgee/react"; -import { TrashIcon } from "lucide-react"; -import Link from "next/link"; -import { useRouter } from "next/navigation"; -import { useMemo, useState } from "react"; -import { FormProvider, useForm } from "react-hook-form"; -import { toast } from "react-hot-toast"; -import { TActionClass, TActionClassInput } from "@formbricks/types/action-classes"; interface ActionSettingsTabProps { actionClass: TActionClass; diff --git a/apps/web/modules/projects/settings/(setup)/components/AddActionModal.tsx b/apps/web/modules/projects/settings/(setup)/components/AddActionModal.tsx index 47a5a12d14..96e5b60b94 100644 --- a/apps/web/modules/projects/settings/(setup)/components/AddActionModal.tsx +++ b/apps/web/modules/projects/settings/(setup)/components/AddActionModal.tsx @@ -1,5 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { MousePointerClickIcon } from "lucide-react"; +import { useState } from "react"; +import { TActionClass } from "@formbricks/types/action-classes"; import { CreateNewActionTab } from "@/modules/survey/editor/components/create-new-action-tab"; import { Dialog, @@ -9,10 +13,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { MousePointerClickIcon } from "lucide-react"; -import { useState } from "react"; -import { TActionClass } from "@formbricks/types/action-classes"; interface AddActionModalProps { environmentId: string; diff --git a/apps/web/modules/projects/settings/(setup)/components/action-settings-card.tsx b/apps/web/modules/projects/settings/(setup)/components/action-settings-card.tsx index b46d1c5500..f1702401ec 100644 --- a/apps/web/modules/projects/settings/(setup)/components/action-settings-card.tsx +++ b/apps/web/modules/projects/settings/(setup)/components/action-settings-card.tsx @@ -1,15 +1,15 @@ "use client"; -import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; -import { ActionClassesTable } from "@/modules/projects/settings/(setup)/components/ActionClassesTable"; -import { ActionClassDataRow } from "@/modules/projects/settings/(setup)/components/ActionRowData"; -import { ActionTableHeading } from "@/modules/projects/settings/(setup)/components/ActionTableHeading"; -import { AddActionModal } from "@/modules/projects/settings/(setup)/components/AddActionModal"; import { useTranslate } from "@tolgee/react"; import { useState } from "react"; import { TActionClass } from "@formbricks/types/action-classes"; import { TEnvironment } from "@formbricks/types/environment"; import { TUserLocale } from "@formbricks/types/user"; +import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; +import { ActionClassesTable } from "@/modules/projects/settings/(setup)/components/ActionClassesTable"; +import { ActionClassDataRow } from "@/modules/projects/settings/(setup)/components/ActionRowData"; +import { ActionTableHeading } from "@/modules/projects/settings/(setup)/components/ActionTableHeading"; +import { AddActionModal } from "@/modules/projects/settings/(setup)/components/AddActionModal"; interface ActionSettingsCardProps { environment: TEnvironment; diff --git a/apps/web/modules/projects/settings/actions.ts b/apps/web/modules/projects/settings/actions.ts index d5a162cfb5..0e89ac63ea 100644 --- a/apps/web/modules/projects/settings/actions.ts +++ b/apps/web/modules/projects/settings/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { OperationNotAllowedError } from "@formbricks/types/errors"; +import { ZProjectUpdateInput } from "@formbricks/types/project"; import { getTeamsByOrganizationId } from "@/app/(app)/(onboarding)/lib/onboarding"; import { getOrganization } from "@/lib/organization/service"; import { getProject } from "@/lib/project/service"; @@ -10,10 +14,6 @@ import { getOrganizationIdFromProjectId } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { getRemoveBrandingPermission } from "@/modules/ee/license-check/lib/utils"; import { updateProject } from "@/modules/projects/settings/lib/project"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { OperationNotAllowedError } from "@formbricks/types/errors"; -import { ZProjectUpdateInput } from "@formbricks/types/project"; const ZUpdateProjectAction = z.object({ projectId: ZId, diff --git a/apps/web/modules/projects/settings/components/project-config-navigation.test.tsx b/apps/web/modules/projects/settings/components/project-config-navigation.test.tsx index fb5a7ea03f..c57b4aaa31 100644 --- a/apps/web/modules/projects/settings/components/project-config-navigation.test.tsx +++ b/apps/web/modules/projects/settings/components/project-config-navigation.test.tsx @@ -1,6 +1,6 @@ -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { cleanup, render } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { ProjectConfigNavigation } from "./project-config-navigation"; vi.mock("@/modules/ui/components/secondary-navigation", () => ({ diff --git a/apps/web/modules/projects/settings/components/project-config-navigation.tsx b/apps/web/modules/projects/settings/components/project-config-navigation.tsx index fb31758d7a..458d291e37 100644 --- a/apps/web/modules/projects/settings/components/project-config-navigation.tsx +++ b/apps/web/modules/projects/settings/components/project-config-navigation.tsx @@ -1,9 +1,9 @@ "use client"; -import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; import { useTranslate } from "@tolgee/react"; import { BlocksIcon, BrushIcon, LanguagesIcon, ListChecksIcon, TagIcon, UsersIcon } from "lucide-react"; import { usePathname } from "next/navigation"; +import { SecondaryNavigation } from "@/modules/ui/components/secondary-navigation"; interface ProjectConfigNavigationProps { activeId: string; diff --git a/apps/web/modules/projects/settings/general/actions.ts b/apps/web/modules/projects/settings/general/actions.ts index f5c1a382be..791a76472a 100644 --- a/apps/web/modules/projects/settings/general/actions.ts +++ b/apps/web/modules/projects/settings/general/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { getProject, getUserProjects } from "@/lib/project/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; @@ -7,8 +9,6 @@ import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/co import { getOrganizationIdFromProjectId } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { deleteProject } from "@/modules/projects/settings/lib/project"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZProjectDeleteAction = z.object({ projectId: ZId, diff --git a/apps/web/modules/projects/settings/general/components/delete-project-render.tsx b/apps/web/modules/projects/settings/general/components/delete-project-render.tsx index 94d83f916d..95d16a4a13 100644 --- a/apps/web/modules/projects/settings/general/components/delete-project-render.tsx +++ b/apps/web/modules/projects/settings/general/components/delete-project-render.tsx @@ -1,5 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import toast from "react-hot-toast"; +import { TProject } from "@formbricks/types/project"; import { FORMBRICKS_ENVIRONMENT_ID_LS } from "@/lib/localStorage"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { truncate } from "@/lib/utils/strings"; @@ -7,11 +12,6 @@ import { deleteProjectAction } from "@/modules/projects/settings/general/actions import { Alert, AlertDescription } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import toast from "react-hot-toast"; -import { TProject } from "@formbricks/types/project"; interface DeleteProjectRenderProps { isDeleteDisabled: boolean; diff --git a/apps/web/modules/projects/settings/general/components/delete-project.test.tsx b/apps/web/modules/projects/settings/general/components/delete-project.test.tsx index fa140f6a5c..ed8d116b9a 100644 --- a/apps/web/modules/projects/settings/general/components/delete-project.test.tsx +++ b/apps/web/modules/projects/settings/general/components/delete-project.test.tsx @@ -1,10 +1,10 @@ -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getUserProjects } from "@/lib/project/service"; import { cleanup, render, screen } from "@testing-library/react"; import { getServerSession } from "next-auth"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TProject } from "@formbricks/types/project"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getUserProjects } from "@/lib/project/service"; import { DeleteProject } from "./delete-project"; vi.mock("@/modules/projects/settings/general/components/delete-project-render", () => ({ diff --git a/apps/web/modules/projects/settings/general/components/delete-project.tsx b/apps/web/modules/projects/settings/general/components/delete-project.tsx index fae074cdc9..8b0c8d8f58 100644 --- a/apps/web/modules/projects/settings/general/components/delete-project.tsx +++ b/apps/web/modules/projects/settings/general/components/delete-project.tsx @@ -1,10 +1,10 @@ +import { getServerSession } from "next-auth"; +import { TProject } from "@formbricks/types/project"; import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { getUserProjects } from "@/lib/project/service"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { DeleteProjectRender } from "@/modules/projects/settings/general/components/delete-project-render"; import { getTranslate } from "@/tolgee/server"; -import { getServerSession } from "next-auth"; -import { TProject } from "@formbricks/types/project"; interface DeleteProjectProps { environmentId: string; diff --git a/apps/web/modules/projects/settings/general/components/edit-project-name-form.tsx b/apps/web/modules/projects/settings/general/components/edit-project-name-form.tsx index 681f977997..8acacab16e 100644 --- a/apps/web/modules/projects/settings/general/components/edit-project-name-form.tsx +++ b/apps/web/modules/projects/settings/general/components/edit-project-name-form.tsx @@ -1,5 +1,12 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { useRouter } from "next/navigation"; +import { SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { TProject, ZProject } from "@formbricks/types/project"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { updateProjectAction } from "@/modules/projects/settings/actions"; import { Alert, AlertDescription } from "@/modules/ui/components/alert"; @@ -13,13 +20,6 @@ import { FormProvider, } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { useRouter } from "next/navigation"; -import { SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; -import { TProject, ZProject } from "@formbricks/types/project"; interface EditProjectNameProps { project: TProject; diff --git a/apps/web/modules/projects/settings/general/components/edit-waiting-time-form.tsx b/apps/web/modules/projects/settings/general/components/edit-waiting-time-form.tsx index 77b8f11d5e..06e4608502 100644 --- a/apps/web/modules/projects/settings/general/components/edit-waiting-time-form.tsx +++ b/apps/web/modules/projects/settings/general/components/edit-waiting-time-form.tsx @@ -1,5 +1,11 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; +import { TProject, ZProject } from "@formbricks/types/project"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { Alert, AlertDescription } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; @@ -12,12 +18,6 @@ import { FormProvider, } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; -import { TProject, ZProject } from "@formbricks/types/project"; import { updateProjectAction } from "../../actions"; interface EditWaitingTimeProps { diff --git a/apps/web/modules/projects/settings/general/loading.tsx b/apps/web/modules/projects/settings/general/loading.tsx index b765f3a5bd..9bfa9d2459 100644 --- a/apps/web/modules/projects/settings/general/loading.tsx +++ b/apps/web/modules/projects/settings/general/loading.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { LoadingCard } from "@/app/(app)/components/LoadingCard"; import { ProjectConfigNavigation } from "@/modules/projects/settings/components/project-config-navigation"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; export const GeneralSettingsLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/projects/settings/general/page.test.tsx b/apps/web/modules/projects/settings/general/page.test.tsx index 10e9116ef8..2af36f6129 100644 --- a/apps/web/modules/projects/settings/general/page.test.tsx +++ b/apps/web/modules/projects/settings/general/page.test.tsx @@ -1,8 +1,8 @@ -import { getProjects } from "@/lib/project/service"; -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; +import { getProjects } from "@/lib/project/service"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { GeneralSettingsPage } from "./page"; vi.mock("@/modules/projects/settings/components/project-config-navigation", () => ({ diff --git a/apps/web/modules/projects/settings/layout.test.tsx b/apps/web/modules/projects/settings/layout.test.tsx index 00f6bd02fe..991f7f284a 100644 --- a/apps/web/modules/projects/settings/layout.test.tsx +++ b/apps/web/modules/projects/settings/layout.test.tsx @@ -1,8 +1,8 @@ -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { cleanup } from "@testing-library/react"; import { redirect } from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { ProjectSettingsLayout } from "./layout"; vi.mock("next/navigation", () => ({ diff --git a/apps/web/modules/projects/settings/layout.tsx b/apps/web/modules/projects/settings/layout.tsx index 123922e58a..22fdb6cfa0 100644 --- a/apps/web/modules/projects/settings/layout.tsx +++ b/apps/web/modules/projects/settings/layout.tsx @@ -1,6 +1,6 @@ -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { Metadata } from "next"; import { redirect } from "next/navigation"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; export const metadata: Metadata = { title: "Configuration", diff --git a/apps/web/modules/projects/settings/lib/project.test.ts b/apps/web/modules/projects/settings/lib/project.test.ts index dd0ec7b482..e700bdd932 100644 --- a/apps/web/modules/projects/settings/lib/project.test.ts +++ b/apps/web/modules/projects/settings/lib/project.test.ts @@ -1,5 +1,3 @@ -import { createEnvironment } from "@/lib/environment/service"; -import { deleteFilesByEnvironmentId } from "@/modules/storage/service"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; @@ -8,6 +6,8 @@ import { StorageErrorCode } from "@formbricks/storage"; import { TEnvironment } from "@formbricks/types/environment"; import { DatabaseError, InvalidInputError, ValidationError } from "@formbricks/types/errors"; import { ZProject } from "@formbricks/types/project"; +import { createEnvironment } from "@/lib/environment/service"; +import { deleteFilesByEnvironmentId } from "@/modules/storage/service"; import { createProject, deleteProject, updateProject } from "./project"; const baseProject = { diff --git a/apps/web/modules/projects/settings/lib/project.ts b/apps/web/modules/projects/settings/lib/project.ts index 887ff19c54..ed6da910e8 100644 --- a/apps/web/modules/projects/settings/lib/project.ts +++ b/apps/web/modules/projects/settings/lib/project.ts @@ -1,7 +1,4 @@ import "server-only"; -import { createEnvironment } from "@/lib/environment/service"; -import { validateInputs } from "@/lib/utils/validate"; -import { deleteFilesByEnvironmentId } from "@/modules/storage/service"; import { Prisma } from "@prisma/client"; import { z } from "zod"; import { prisma } from "@formbricks/database"; @@ -10,6 +7,9 @@ import { logger } from "@formbricks/logger"; import { ZId, ZString } from "@formbricks/types/common"; import { DatabaseError, InvalidInputError, ValidationError } from "@formbricks/types/errors"; import { TProject, TProjectUpdateInput, ZProject, ZProjectUpdateInput } from "@formbricks/types/project"; +import { createEnvironment } from "@/lib/environment/service"; +import { validateInputs } from "@/lib/utils/validate"; +import { deleteFilesByEnvironmentId } from "@/modules/storage/service"; const selectProject = { id: true, diff --git a/apps/web/modules/projects/settings/lib/tag.test.ts b/apps/web/modules/projects/settings/lib/tag.test.ts index 06a4028f82..b06931f7ea 100644 --- a/apps/web/modules/projects/settings/lib/tag.test.ts +++ b/apps/web/modules/projects/settings/lib/tag.test.ts @@ -1,10 +1,10 @@ -import { TagError } from "@/modules/projects/settings/types/tag"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ok } from "@formbricks/types/error-handlers"; import { TTag } from "@formbricks/types/tags"; +import { TagError } from "@/modules/projects/settings/types/tag"; import { deleteTag, mergeTags, updateTagName } from "./tag"; const baseTag: TTag = { diff --git a/apps/web/modules/projects/settings/lib/tag.ts b/apps/web/modules/projects/settings/lib/tag.ts index bb25f0f2f3..73505fe78f 100644 --- a/apps/web/modules/projects/settings/lib/tag.ts +++ b/apps/web/modules/projects/settings/lib/tag.ts @@ -1,12 +1,12 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; -import { TagError } from "@/modules/projects/settings/types/tag"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { PrismaErrorType } from "@formbricks/database/types/error"; import { ZId } from "@formbricks/types/common"; import { Result, err, ok } from "@formbricks/types/error-handlers"; import { TTag } from "@formbricks/types/tags"; +import { validateInputs } from "@/lib/utils/validate"; +import { TagError } from "@/modules/projects/settings/types/tag"; export const deleteTag = async ( id: string diff --git a/apps/web/modules/projects/settings/look/components/edit-placement-form.test.tsx b/apps/web/modules/projects/settings/look/components/edit-placement-form.test.tsx index c1c272b59e..27b2db3cac 100644 --- a/apps/web/modules/projects/settings/look/components/edit-placement-form.test.tsx +++ b/apps/web/modules/projects/settings/look/components/edit-placement-form.test.tsx @@ -1,10 +1,10 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { updateProjectAction } from "@/modules/projects/settings/actions"; import { Project } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { updateProjectAction } from "@/modules/projects/settings/actions"; import { EditPlacementForm } from "./edit-placement-form"; const baseProject: Project = { diff --git a/apps/web/modules/projects/settings/look/components/edit-placement-form.tsx b/apps/web/modules/projects/settings/look/components/edit-placement-form.tsx index 70c432ee86..73f4477995 100644 --- a/apps/web/modules/projects/settings/look/components/edit-placement-form.tsx +++ b/apps/web/modules/projects/settings/look/components/edit-placement-form.tsx @@ -1,5 +1,11 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { Project } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { z } from "zod"; import { cn } from "@/lib/cn"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { updateProjectAction } from "@/modules/projects/settings/actions"; @@ -9,12 +15,6 @@ import { FormControl, FormField, FormItem, FormLabel, FormProvider } from "@/mod import { Label } from "@/modules/ui/components/label"; import { getPlacementStyle } from "@/modules/ui/components/preview-survey/lib/utils"; import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { Project } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { z } from "zod"; interface EditPlacementProps { project: Project; diff --git a/apps/web/modules/projects/settings/look/components/theme-styling.test.tsx b/apps/web/modules/projects/settings/look/components/theme-styling.test.tsx index 4e3ae5f3ec..8ce63f62d9 100644 --- a/apps/web/modules/projects/settings/look/components/theme-styling.test.tsx +++ b/apps/web/modules/projects/settings/look/components/theme-styling.test.tsx @@ -1,9 +1,9 @@ -import { updateProjectAction } from "@/modules/projects/settings/actions"; import { Project } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { updateProjectAction } from "@/modules/projects/settings/actions"; import { ThemeStyling } from "./theme-styling"; const baseProject: Project = { diff --git a/apps/web/modules/projects/settings/look/components/theme-styling.tsx b/apps/web/modules/projects/settings/look/components/theme-styling.tsx index c6e27ba10d..9bd5ea7def 100644 --- a/apps/web/modules/projects/settings/look/components/theme-styling.tsx +++ b/apps/web/modules/projects/settings/look/components/theme-styling.tsx @@ -1,5 +1,15 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { Project } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { RotateCcwIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useCallback, useState } from "react"; +import { SubmitHandler, UseFormReturn, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { TProjectStyling, ZProjectStyling } from "@formbricks/types/project"; +import { TSurveyStyling, TSurveyType } from "@formbricks/types/surveys/types"; import { previewSurvey } from "@/app/lib/templates"; import { defaultStyling } from "@/lib/styling/constants"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; @@ -20,16 +30,6 @@ import { } from "@/modules/ui/components/form"; import { Switch } from "@/modules/ui/components/switch"; import { ThemeStylingPreviewSurvey } from "@/modules/ui/components/theme-styling-preview-survey"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { Project } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { RotateCcwIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useCallback, useState } from "react"; -import { SubmitHandler, UseFormReturn, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { TProjectStyling, ZProjectStyling } from "@formbricks/types/project"; -import { TSurveyStyling, TSurveyType } from "@formbricks/types/surveys/types"; interface ThemeStylingProps { project: Project; diff --git a/apps/web/modules/projects/settings/look/lib/project.ts b/apps/web/modules/projects/settings/look/lib/project.ts index 76667d3e5d..504956f5f3 100644 --- a/apps/web/modules/projects/settings/look/lib/project.ts +++ b/apps/web/modules/projects/settings/look/lib/project.ts @@ -1,10 +1,10 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma, Project } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const getProjectByEnvironmentId = reactCache( async (environmentId: string): Promise => { diff --git a/apps/web/modules/projects/settings/look/loading.tsx b/apps/web/modules/projects/settings/look/loading.tsx index 3fe4298cff..8a045c2b76 100644 --- a/apps/web/modules/projects/settings/look/loading.tsx +++ b/apps/web/modules/projects/settings/look/loading.tsx @@ -1,5 +1,6 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { cn } from "@/lib/cn"; import { ProjectConfigNavigation } from "@/modules/projects/settings/components/project-config-navigation"; @@ -10,7 +11,6 @@ import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper import { PageHeader } from "@/modules/ui/components/page-header"; import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; import { Switch } from "@/modules/ui/components/switch"; -import { useTranslate } from "@tolgee/react"; export const ProjectLookSettingsLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/projects/settings/look/page.test.tsx b/apps/web/modules/projects/settings/look/page.test.tsx index 77f79663ce..9fa3bcd6b7 100644 --- a/apps/web/modules/projects/settings/look/page.test.tsx +++ b/apps/web/modules/projects/settings/look/page.test.tsx @@ -1,8 +1,8 @@ -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; -import { getProjectByEnvironmentId } from "@/modules/projects/settings/look/lib/project"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; +import { getProjectByEnvironmentId } from "@/modules/projects/settings/look/lib/project"; import { EditLogo } from "./components/edit-logo"; import { ThemeStyling } from "./components/theme-styling"; import { ProjectLookSettingsPage } from "./page"; diff --git a/apps/web/modules/projects/settings/tags/actions.ts b/apps/web/modules/projects/settings/tags/actions.ts index 70977ea978..d6473d605a 100644 --- a/apps/web/modules/projects/settings/tags/actions.ts +++ b/apps/web/modules/projects/settings/tags/actions.ts @@ -1,5 +1,7 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { getTag } from "@/lib/tag/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; @@ -13,8 +15,6 @@ import { } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { deleteTag, mergeTags, updateTagName } from "@/modules/projects/settings/lib/tag"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZDeleteTagAction = z.object({ tagId: ZId, diff --git a/apps/web/modules/projects/settings/tags/components/edit-tags-wrapper.tsx b/apps/web/modules/projects/settings/tags/components/edit-tags-wrapper.tsx index 9c816b3c29..4997d8d1d9 100644 --- a/apps/web/modules/projects/settings/tags/components/edit-tags-wrapper.tsx +++ b/apps/web/modules/projects/settings/tags/components/edit-tags-wrapper.tsx @@ -1,11 +1,11 @@ "use client"; -import { SingleTag } from "@/modules/projects/settings/tags/components/single-tag"; -import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; import { useTranslate } from "@tolgee/react"; import React from "react"; import { TEnvironment } from "@formbricks/types/environment"; import { TTag, TTagsCount } from "@formbricks/types/tags"; +import { SingleTag } from "@/modules/projects/settings/tags/components/single-tag"; +import { EmptySpaceFiller } from "@/modules/ui/components/empty-space-filler"; interface EditTagsWrapperProps { environment: TEnvironment; diff --git a/apps/web/modules/projects/settings/tags/components/merge-tags-combobox.tsx b/apps/web/modules/projects/settings/tags/components/merge-tags-combobox.tsx index 12ec7c3ae8..9e2b829c75 100644 --- a/apps/web/modules/projects/settings/tags/components/merge-tags-combobox.tsx +++ b/apps/web/modules/projects/settings/tags/components/merge-tags-combobox.tsx @@ -1,5 +1,7 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useState } from "react"; import { Button } from "@/modules/ui/components/button"; import { Command, @@ -10,8 +12,6 @@ import { CommandList, } from "@/modules/ui/components/command"; import { Popover, PopoverContent, PopoverTrigger } from "@/modules/ui/components/popover"; -import { useTranslate } from "@tolgee/react"; -import { useState } from "react"; interface MergeTagsComboboxProps { tags: Tag[]; diff --git a/apps/web/modules/projects/settings/tags/components/single-tag.test.tsx b/apps/web/modules/projects/settings/tags/components/single-tag.test.tsx index a7f53c66cb..17a15151f4 100644 --- a/apps/web/modules/projects/settings/tags/components/single-tag.test.tsx +++ b/apps/web/modules/projects/settings/tags/components/single-tag.test.tsx @@ -1,13 +1,13 @@ +import { cleanup, fireEvent, render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { TTag } from "@formbricks/types/tags"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { deleteTagAction, mergeTagsAction, updateTagNameAction, } from "@/modules/projects/settings/tags/actions"; -import { cleanup, fireEvent, render, screen } from "@testing-library/react"; -import userEvent from "@testing-library/user-event"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { TTag } from "@formbricks/types/tags"; import { SingleTag } from "./single-tag"; vi.mock("@/modules/ui/components/delete-dialog", () => ({ diff --git a/apps/web/modules/projects/settings/tags/components/single-tag.tsx b/apps/web/modules/projects/settings/tags/components/single-tag.tsx index f67736719f..d468f34799 100644 --- a/apps/web/modules/projects/settings/tags/components/single-tag.tsx +++ b/apps/web/modules/projects/settings/tags/components/single-tag.tsx @@ -1,5 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { AlertCircleIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import React, { useState } from "react"; +import { toast } from "react-hot-toast"; +import { TTag } from "@formbricks/types/tags"; import { cn } from "@/lib/cn"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { @@ -13,12 +19,6 @@ import { Button } from "@/modules/ui/components/button"; import { DeleteDialog } from "@/modules/ui/components/delete-dialog"; import { Input } from "@/modules/ui/components/input"; import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; -import { useTranslate } from "@tolgee/react"; -import { AlertCircleIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import React, { useState } from "react"; -import { toast } from "react-hot-toast"; -import { TTag } from "@formbricks/types/tags"; interface SingleTagProps { tagId: string; diff --git a/apps/web/modules/projects/settings/tags/loading.tsx b/apps/web/modules/projects/settings/tags/loading.tsx index 6980e43a7d..cba88d5774 100644 --- a/apps/web/modules/projects/settings/tags/loading.tsx +++ b/apps/web/modules/projects/settings/tags/loading.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { SettingsCard } from "@/app/(app)/environments/[environmentId]/settings/components/SettingsCard"; import { ProjectConfigNavigation } from "@/modules/projects/settings/components/project-config-navigation"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; export const TagsLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/projects/settings/tags/page.test.tsx b/apps/web/modules/projects/settings/tags/page.test.tsx index 691f6b3b7d..8dee8e3a65 100644 --- a/apps/web/modules/projects/settings/tags/page.test.tsx +++ b/apps/web/modules/projects/settings/tags/page.test.tsx @@ -1,6 +1,6 @@ -import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { TagsPage } from "./page"; vi.mock("@/app/(app)/environments/[environmentId]/settings/components/SettingsCard", () => ({ diff --git a/apps/web/modules/setup/(fresh-instance)/intro/page.tsx b/apps/web/modules/setup/(fresh-instance)/intro/page.tsx index a65a7b383c..e170f67a4c 100644 --- a/apps/web/modules/setup/(fresh-instance)/intro/page.tsx +++ b/apps/web/modules/setup/(fresh-instance)/intro/page.tsx @@ -1,8 +1,8 @@ +import { Metadata } from "next"; +import Link from "next/link"; import { Button } from "@/modules/ui/components/button"; import { getTranslate } from "@/tolgee/server"; import { T } from "@/tolgee/server"; -import { Metadata } from "next"; -import Link from "next/link"; export const metadata: Metadata = { title: "Intro", diff --git a/apps/web/modules/setup/(fresh-instance)/layout.tsx b/apps/web/modules/setup/(fresh-instance)/layout.tsx index 33b85cdba4..2a44847d6a 100644 --- a/apps/web/modules/setup/(fresh-instance)/layout.tsx +++ b/apps/web/modules/setup/(fresh-instance)/layout.tsx @@ -1,7 +1,7 @@ -import { getIsFreshInstance } from "@/lib/instance/service"; -import { authOptions } from "@/modules/auth/lib/authOptions"; import { getServerSession } from "next-auth"; import { notFound } from "next/navigation"; +import { getIsFreshInstance } from "@/lib/instance/service"; +import { authOptions } from "@/modules/auth/lib/authOptions"; export const FreshInstanceLayout = async ({ children }: { children: React.ReactNode }) => { const session = await getServerSession(authOptions); diff --git a/apps/web/modules/setup/(fresh-instance)/signup/page.test.tsx b/apps/web/modules/setup/(fresh-instance)/signup/page.test.tsx index 01a20d0e06..b4aff3a86f 100644 --- a/apps/web/modules/setup/(fresh-instance)/signup/page.test.tsx +++ b/apps/web/modules/setup/(fresh-instance)/signup/page.test.tsx @@ -1,9 +1,9 @@ -import { findMatchingLocale } from "@/lib/utils/locale"; -import { getIsSamlSsoEnabled, getIsSsoEnabled } from "@/modules/ee/license-check/lib/utils"; -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { render, screen } from "@testing-library/react"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import { findMatchingLocale } from "@/lib/utils/locale"; +import { getIsSamlSsoEnabled, getIsSsoEnabled } from "@/modules/ee/license-check/lib/utils"; +import { getTranslate } from "@/tolgee/server"; import { SignupPage } from "./page"; // Mock dependencies diff --git a/apps/web/modules/setup/(fresh-instance)/signup/page.tsx b/apps/web/modules/setup/(fresh-instance)/signup/page.tsx index 66a3ba9c92..bd2d1bd918 100644 --- a/apps/web/modules/setup/(fresh-instance)/signup/page.tsx +++ b/apps/web/modules/setup/(fresh-instance)/signup/page.tsx @@ -1,3 +1,4 @@ +import { Metadata } from "next"; import { AZURE_OAUTH_ENABLED, EMAIL_AUTH_ENABLED, @@ -19,7 +20,6 @@ import { findMatchingLocale } from "@/lib/utils/locale"; import { SignupForm } from "@/modules/auth/signup/components/signup-form"; import { getIsSamlSsoEnabled, getIsSsoEnabled } from "@/modules/ee/license-check/lib/utils"; import { getTranslate } from "@/tolgee/server"; -import { Metadata } from "next"; export const metadata: Metadata = { title: "Sign up", diff --git a/apps/web/modules/setup/layout.tsx b/apps/web/modules/setup/layout.tsx index 2e4722ec5f..5a7d4c6e86 100644 --- a/apps/web/modules/setup/layout.tsx +++ b/apps/web/modules/setup/layout.tsx @@ -1,5 +1,5 @@ -import { FormbricksLogo } from "@/modules/ui/components/formbricks-logo"; import { Toaster } from "react-hot-toast"; +import { FormbricksLogo } from "@/modules/ui/components/formbricks-logo"; export const SetupLayout = ({ children }: { children: React.ReactNode }) => { return ( diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/actions.ts b/apps/web/modules/setup/organization/[organizationId]/invite/actions.ts index 30c4b7aa9e..7341c17d40 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/actions.ts +++ b/apps/web/modules/setup/organization/[organizationId]/invite/actions.ts @@ -1,5 +1,9 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; +import { AuthenticationError } from "@formbricks/types/errors"; +import { ZUserEmail, ZUserName } from "@formbricks/types/user"; import { INVITE_DISABLED } from "@/lib/constants"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; @@ -7,10 +11,6 @@ import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/co import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { sendInviteMemberEmail } from "@/modules/email"; import { inviteUser } from "@/modules/setup/organization/[organizationId]/invite/lib/invite"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; -import { AuthenticationError } from "@formbricks/types/errors"; -import { ZUserEmail, ZUserName } from "@formbricks/types/user"; const ZInviteOrganizationMemberAction = z.object({ email: ZUserEmail, diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.test.tsx b/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.test.tsx index a741760aba..762c4d420e 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.test.tsx +++ b/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.test.tsx @@ -1,8 +1,8 @@ -import { inviteOrganizationMemberAction } from "@/modules/setup/organization/[organizationId]/invite/actions"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import { useRouter } from "next/navigation"; import { toast } from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { inviteOrganizationMemberAction } from "@/modules/setup/organization/[organizationId]/invite/actions"; import { InviteMembers } from "./invite-members"; // Mock next/navigation diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.tsx b/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.tsx index 3a301c7a64..4b6b5b69a4 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.tsx +++ b/apps/web/modules/setup/organization/[organizationId]/invite/components/invite-members.tsx @@ -1,5 +1,12 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { PlusIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { useForm } from "react-hook-form"; +import { toast } from "react-hot-toast"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { inviteOrganizationMemberAction } from "@/modules/setup/organization/[organizationId]/invite/actions"; import { @@ -10,13 +17,6 @@ import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/ale import { Button } from "@/modules/ui/components/button"; import { FormControl, FormError, FormField, FormItem, FormProvider } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { PlusIcon } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { toast } from "react-hot-toast"; interface InviteMembersProps { IS_SMTP_CONFIGURED: boolean; diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.test.ts b/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.test.ts index 377fb5447e..6be320a0c4 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.test.ts +++ b/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.test.ts @@ -1,9 +1,9 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { TInvitee } from "@/modules/setup/organization/[organizationId]/invite/types/invites"; import { Invite, Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { TInvitee } from "@/modules/setup/organization/[organizationId]/invite/types/invites"; import { inviteUser } from "./invite"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.ts b/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.ts index a394dce2c2..57b6c89dec 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.ts +++ b/apps/web/modules/setup/organization/[organizationId]/invite/lib/invite.ts @@ -1,8 +1,8 @@ -import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; -import { TInvitee } from "@/modules/setup/organization/[organizationId]/invite/types/invites"; import { Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { DatabaseError, InvalidInputError } from "@formbricks/types/errors"; +import { getMembershipByUserIdOrganizationId } from "@/lib/membership/service"; +import { TInvitee } from "@/modules/setup/organization/[organizationId]/invite/types/invites"; export const inviteUser = async ({ invitee, diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/page.test.tsx b/apps/web/modules/setup/organization/[organizationId]/invite/page.test.tsx index 7521b00510..70403707ee 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/page.test.tsx +++ b/apps/web/modules/setup/organization/[organizationId]/invite/page.test.tsx @@ -1,11 +1,11 @@ -import * as constants from "@/lib/constants"; -import * as roleAccess from "@/lib/organization/auth"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import * as nextAuth from "next-auth"; import * as nextNavigation from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; import { AuthenticationError } from "@formbricks/types/errors"; +import * as constants from "@/lib/constants"; +import * as roleAccess from "@/lib/organization/auth"; import { InvitePage } from "./page"; // Mock environment variables diff --git a/apps/web/modules/setup/organization/[organizationId]/invite/page.tsx b/apps/web/modules/setup/organization/[organizationId]/invite/page.tsx index 0cce8e607d..69d143bfb9 100644 --- a/apps/web/modules/setup/organization/[organizationId]/invite/page.tsx +++ b/apps/web/modules/setup/organization/[organizationId]/invite/page.tsx @@ -1,12 +1,12 @@ +import { Metadata } from "next"; +import { getServerSession } from "next-auth"; +import { notFound } from "next/navigation"; +import { AuthenticationError } from "@formbricks/types/errors"; import { SMTP_HOST, SMTP_PASSWORD, SMTP_PORT, SMTP_USER } from "@/lib/constants"; import { verifyUserRoleAccess } from "@/lib/organization/auth"; import { authOptions } from "@/modules/auth/lib/authOptions"; import { InviteMembers } from "@/modules/setup/organization/[organizationId]/invite/components/invite-members"; import { getTranslate } from "@/tolgee/server"; -import { Metadata } from "next"; -import { getServerSession } from "next-auth"; -import { notFound } from "next/navigation"; -import { AuthenticationError } from "@formbricks/types/errors"; export const metadata: Metadata = { title: "Invite", diff --git a/apps/web/modules/setup/organization/create/components/create-organization.test.tsx b/apps/web/modules/setup/organization/create/components/create-organization.test.tsx index 49c2b913e1..8ff4f1006d 100644 --- a/apps/web/modules/setup/organization/create/components/create-organization.test.tsx +++ b/apps/web/modules/setup/organization/create/components/create-organization.test.tsx @@ -1,10 +1,10 @@ -import { createOrganizationAction } from "@/app/setup/organization/create/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { useRouter } from "next/navigation"; import { toast } from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { createOrganizationAction } from "@/app/setup/organization/create/actions"; import { CreateOrganization } from "./create-organization"; // Mock dependencies diff --git a/apps/web/modules/setup/organization/create/components/create-organization.tsx b/apps/web/modules/setup/organization/create/components/create-organization.tsx index b1032f8340..e43b87ba82 100644 --- a/apps/web/modules/setup/organization/create/components/create-organization.tsx +++ b/apps/web/modules/setup/organization/create/components/create-organization.tsx @@ -1,9 +1,5 @@ "use client"; -import { createOrganizationAction } from "@/app/setup/organization/create/actions"; -import { Button } from "@/modules/ui/components/button"; -import { FormControl, FormError, FormField, FormItem, FormProvider } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; import { zodResolver } from "@hookform/resolvers/zod"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; @@ -12,6 +8,10 @@ import { SubmitHandler, useForm } from "react-hook-form"; import { toast } from "react-hot-toast"; import { z } from "zod"; import { ZOrganization } from "@formbricks/types/organizations"; +import { createOrganizationAction } from "@/app/setup/organization/create/actions"; +import { Button } from "@/modules/ui/components/button"; +import { FormControl, FormError, FormField, FormItem, FormProvider } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; const ZCreateOrganizationFormSchema = ZOrganization.pick({ name: true }); type TCreateOrganizationForm = z.infer; diff --git a/apps/web/modules/setup/organization/create/components/removed-from-organization.test.tsx b/apps/web/modules/setup/organization/create/components/removed-from-organization.test.tsx index 2677af0c3a..0a8ce9b3c7 100644 --- a/apps/web/modules/setup/organization/create/components/removed-from-organization.test.tsx +++ b/apps/web/modules/setup/organization/create/components/removed-from-organization.test.tsx @@ -1,9 +1,9 @@ -import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TUser } from "@formbricks/types/user"; +import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; import { RemovedFromOrganization } from "./removed-from-organization"; // Mock DeleteAccountModal diff --git a/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx b/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx index 32e0ff9e1d..ff41b07929 100644 --- a/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx +++ b/apps/web/modules/setup/organization/create/components/removed-from-organization.tsx @@ -1,11 +1,11 @@ "use client"; -import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; -import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { useState } from "react"; import { TUser } from "@formbricks/types/user"; +import { DeleteAccountModal } from "@/modules/account/components/DeleteAccountModal"; +import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; +import { Button } from "@/modules/ui/components/button"; interface RemovedFromOrganizationProps { isFormbricksCloud: boolean; diff --git a/apps/web/modules/setup/organization/create/page.test.tsx b/apps/web/modules/setup/organization/create/page.test.tsx index 62bcd9fdd7..80f7922a4d 100644 --- a/apps/web/modules/setup/organization/create/page.test.tsx +++ b/apps/web/modules/setup/organization/create/page.test.tsx @@ -1,13 +1,13 @@ -import * as instanceService from "@/lib/instance/service"; -import * as organizationService from "@/lib/organization/service"; -import * as userService from "@/lib/user/service"; -import * as licenseCheck from "@/modules/ee/license-check/lib/utils"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import * as nextAuth from "next-auth"; import * as nextNavigation from "next/navigation"; import { afterEach, describe, expect, test, vi } from "vitest"; import { AuthenticationError } from "@formbricks/types/errors"; +import * as instanceService from "@/lib/instance/service"; +import * as organizationService from "@/lib/organization/service"; +import * as userService from "@/lib/user/service"; +import * as licenseCheck from "@/modules/ee/license-check/lib/utils"; import { CreateOrganizationPage } from "./page"; // Mock environment variables diff --git a/apps/web/modules/setup/organization/create/page.tsx b/apps/web/modules/setup/organization/create/page.tsx index a77fd27d79..313a17dcbc 100644 --- a/apps/web/modules/setup/organization/create/page.tsx +++ b/apps/web/modules/setup/organization/create/page.tsx @@ -1,3 +1,7 @@ +import { Metadata } from "next"; +import { getServerSession } from "next-auth"; +import { notFound } from "next/navigation"; +import { AuthenticationError } from "@formbricks/types/errors"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { gethasNoOrganizations } from "@/lib/instance/service"; import { getOrganizationsByUserId } from "@/lib/organization/service"; @@ -7,10 +11,6 @@ import { getIsMultiOrgEnabled } from "@/modules/ee/license-check/lib/utils"; import { RemovedFromOrganization } from "@/modules/setup/organization/create/components/removed-from-organization"; import { ClientLogout } from "@/modules/ui/components/client-logout"; import { getTranslate } from "@/tolgee/server"; -import { Metadata } from "next"; -import { getServerSession } from "next-auth"; -import { notFound } from "next/navigation"; -import { AuthenticationError } from "@formbricks/types/errors"; import { CreateOrganization } from "./components/create-organization"; export const metadata: Metadata = { diff --git a/apps/web/modules/storage/service.ts b/apps/web/modules/storage/service.ts index 5a0917f44b..bcfaf2d311 100644 --- a/apps/web/modules/storage/service.ts +++ b/apps/web/modules/storage/service.ts @@ -1,5 +1,3 @@ -import { WEBAPP_URL } from "@/lib/constants"; -import { getPublicDomain } from "@/lib/getPublicUrl"; import { randomUUID } from "crypto"; import { logger } from "@formbricks/logger"; import { @@ -12,6 +10,8 @@ import { } from "@formbricks/storage"; import { Result, err, ok } from "@formbricks/types/error-handlers"; import { TAccessType } from "@formbricks/types/storage"; +import { WEBAPP_URL } from "@/lib/constants"; +import { getPublicDomain } from "@/lib/getPublicUrl"; import { sanitizeFileName } from "./utils"; export const getSignedUrlForUpload = async ( diff --git a/apps/web/modules/storage/utils.test.ts b/apps/web/modules/storage/utils.test.ts index bc3d568c17..e8c96869aa 100644 --- a/apps/web/modules/storage/utils.test.ts +++ b/apps/web/modules/storage/utils.test.ts @@ -1,3 +1,8 @@ +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { StorageErrorCode } from "@formbricks/storage"; +import { TResponseData } from "@formbricks/types/responses"; +import { ZAllowedFileExtension } from "@formbricks/types/storage"; +import { TSurveyQuestion } from "@formbricks/types/surveys/types"; import { isAllowedFileExtension, isValidFileTypeForExtension, @@ -6,11 +11,6 @@ import { validateFileUploads, validateSingleFile, } from "@/modules/storage/utils"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { StorageErrorCode } from "@formbricks/storage"; -import { TResponseData } from "@formbricks/types/responses"; -import { ZAllowedFileExtension } from "@formbricks/types/storage"; -import { TSurveyQuestion } from "@formbricks/types/surveys/types"; // Mock the getOriginalFileNameFromUrl function const mockGetOriginalFileNameFromUrl = vi.hoisted(() => vi.fn()); diff --git a/apps/web/modules/storage/utils.ts b/apps/web/modules/storage/utils.ts index 37f4825417..3fd1611db0 100644 --- a/apps/web/modules/storage/utils.ts +++ b/apps/web/modules/storage/utils.ts @@ -1,9 +1,9 @@ -import { responses } from "@/app/lib/api/response"; import { logger } from "@formbricks/logger"; import { StorageError, StorageErrorCode } from "@formbricks/storage"; import { TResponseData } from "@formbricks/types/responses"; import { TAllowedFileExtension, ZAllowedFileExtension, mimeTypes } from "@formbricks/types/storage"; import { TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { responses } from "@/app/lib/api/response"; export const getOriginalFileNameFromUrl = (fileURL: string) => { try { diff --git a/apps/web/modules/survey/components/edit-public-survey-alert-dialog/index.tsx b/apps/web/modules/survey/components/edit-public-survey-alert-dialog/index.tsx index dd8b5b8bae..9b874365ea 100644 --- a/apps/web/modules/survey/components/edit-public-survey-alert-dialog/index.tsx +++ b/apps/web/modules/survey/components/edit-public-survey-alert-dialog/index.tsx @@ -1,3 +1,4 @@ +import { useTranslate } from "@tolgee/react"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -8,7 +9,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; interface EditPublicSurveyAlertDialogProps { open: boolean; diff --git a/apps/web/modules/survey/components/question-form-input/components/multi-lang-wrapper.test.tsx b/apps/web/modules/survey/components/question-form-input/components/multi-lang-wrapper.test.tsx index 129483054b..ca0e2f9fc0 100644 --- a/apps/web/modules/survey/components/question-form-input/components/multi-lang-wrapper.test.tsx +++ b/apps/web/modules/survey/components/question-form-input/components/multi-lang-wrapper.test.tsx @@ -1,11 +1,11 @@ -import { getEnabledLanguages } from "@/lib/i18n/utils"; -import { headlineToRecall } from "@/lib/utils/recall"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TLanguage } from "@formbricks/types/project"; import { TI18nString, TSurvey, TSurveyLanguage } from "@formbricks/types/surveys/types"; +import { getEnabledLanguages } from "@/lib/i18n/utils"; +import { headlineToRecall } from "@/lib/utils/recall"; import { MultiLangWrapper } from "./multi-lang-wrapper"; vi.mock("@/lib/i18n/utils", () => ({ diff --git a/apps/web/modules/survey/components/question-form-input/utils.test.ts b/apps/web/modules/survey/components/question-form-input/utils.test.ts index 4ce0a335a7..e7da58324d 100644 --- a/apps/web/modules/survey/components/question-form-input/utils.test.ts +++ b/apps/web/modules/survey/components/question-form-input/utils.test.ts @@ -1,5 +1,3 @@ -import { createI18nString } from "@/lib/i18n/utils"; -import * as i18nUtils from "@/lib/i18n/utils"; import "@testing-library/jest-dom/vitest"; import { TFnType } from "@tolgee/react"; import { beforeEach, describe, expect, test, vi } from "vitest"; @@ -10,6 +8,8 @@ import { TSurveyQuestion, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { createI18nString } from "@/lib/i18n/utils"; +import * as i18nUtils from "@/lib/i18n/utils"; import { determineImageUploaderVisibility, getChoiceLabel, diff --git a/apps/web/modules/survey/components/question-form-input/utils.ts b/apps/web/modules/survey/components/question-form-input/utils.ts index 6de1b91415..2e03f8e2e5 100644 --- a/apps/web/modules/survey/components/question-form-input/utils.ts +++ b/apps/web/modules/survey/components/question-form-input/utils.ts @@ -1,5 +1,3 @@ -import { createI18nString } from "@/lib/i18n/utils"; -import { isLabelValidForAllLanguages } from "@/lib/i18n/utils"; import { TFnType } from "@tolgee/react"; import { TI18nString, @@ -8,6 +6,8 @@ import { TSurveyMultipleChoiceQuestion, TSurveyQuestion, } from "@formbricks/types/surveys/types"; +import { createI18nString } from "@/lib/i18n/utils"; +import { isLabelValidForAllLanguages } from "@/lib/i18n/utils"; // Function to get index for choice /rowLabel /columnLabel export const getIndex = (id: string, isChoice: boolean) => { diff --git a/apps/web/modules/survey/components/template-list/actions.ts b/apps/web/modules/survey/components/template-list/actions.ts index 4f32ee1c39..53f611aa9c 100644 --- a/apps/web/modules/survey/components/template-list/actions.ts +++ b/apps/web/modules/survey/components/template-list/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZSurveyCreateInput } from "@formbricks/types/surveys/types"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -10,9 +13,6 @@ import { createSurvey } from "@/modules/survey/components/template-list/lib/surv import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; import { checkSpamProtectionPermission } from "@/modules/survey/lib/permission"; import { getOrganizationBilling } from "@/modules/survey/lib/survey"; -import { z } from "zod"; -import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZSurveyCreateInput } from "@formbricks/types/surveys/types"; const ZCreateSurveyAction = z.object({ environmentId: z.string().cuid2(), diff --git a/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.test.tsx b/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.test.tsx index 1746ff5867..c0b052a847 100644 --- a/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.test.tsx +++ b/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.test.tsx @@ -1,9 +1,9 @@ -import { customSurveyTemplate } from "@/app/lib/templates"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TTemplate } from "@formbricks/types/templates"; +import { customSurveyTemplate } from "@/app/lib/templates"; import { replacePresetPlaceholders } from "../lib/utils"; import { StartFromScratchTemplate } from "./start-from-scratch-template"; diff --git a/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.tsx b/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.tsx index a2b003badc..de66753cca 100644 --- a/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.tsx +++ b/apps/web/modules/survey/components/template-list/components/start-from-scratch-template.tsx @@ -1,12 +1,12 @@ "use client"; -import { customSurveyTemplate } from "@/app/lib/templates"; -import { cn } from "@/lib/cn"; -import { Button } from "@/modules/ui/components/button"; import { Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { PlusCircleIcon } from "lucide-react"; import { TTemplate } from "@formbricks/types/templates"; +import { customSurveyTemplate } from "@/app/lib/templates"; +import { cn } from "@/lib/cn"; +import { Button } from "@/modules/ui/components/button"; import { replacePresetPlaceholders } from "../lib/utils"; interface StartFromScratchTemplateProps { diff --git a/apps/web/modules/survey/components/template-list/components/template-filters.tsx b/apps/web/modules/survey/components/template-list/components/template-filters.tsx index 5899d5bf63..a2063341ad 100644 --- a/apps/web/modules/survey/components/template-list/components/template-filters.tsx +++ b/apps/web/modules/survey/components/template-list/components/template-filters.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import { useTranslate } from "@tolgee/react"; import { TTemplateFilter } from "@formbricks/types/templates"; +import { cn } from "@/lib/cn"; import { getChannelMapping, getIndustryMapping, getRoleMapping } from "../lib/utils"; interface TemplateFiltersProps { diff --git a/apps/web/modules/survey/components/template-list/components/template-tags.tsx b/apps/web/modules/survey/components/template-list/components/template-tags.tsx index 2a308872d4..c059c5eba1 100644 --- a/apps/web/modules/survey/components/template-list/components/template-tags.tsx +++ b/apps/web/modules/survey/components/template-list/components/template-tags.tsx @@ -1,12 +1,12 @@ "use client"; -import { cn } from "@/lib/cn"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { TFnType, useTranslate } from "@tolgee/react"; import { SplitIcon } from "lucide-react"; import { useMemo } from "react"; import { TProjectConfigChannel, TProjectConfigIndustry } from "@formbricks/types/project"; import { TTemplate, TTemplateFilter, TTemplateRole } from "@formbricks/types/templates"; +import { cn } from "@/lib/cn"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { getChannelMapping, getIndustryMapping, getRoleMapping } from "../lib/utils"; interface TemplateTagsProps { diff --git a/apps/web/modules/survey/components/template-list/components/template.tsx b/apps/web/modules/survey/components/template-list/components/template.tsx index 83e0ea86e3..b494f79f73 100644 --- a/apps/web/modules/survey/components/template-list/components/template.tsx +++ b/apps/web/modules/survey/components/template-list/components/template.tsx @@ -1,10 +1,10 @@ "use client"; -import { cn } from "@/lib/cn"; -import { Button } from "@/modules/ui/components/button"; import { Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { TTemplate, TTemplateFilter } from "@formbricks/types/templates"; +import { cn } from "@/lib/cn"; +import { Button } from "@/modules/ui/components/button"; import { replacePresetPlaceholders } from "../lib/utils"; import { TemplateTags } from "./template-tags"; diff --git a/apps/web/modules/survey/components/template-list/index.test.tsx b/apps/web/modules/survey/components/template-list/index.test.tsx index 28e6d2e994..18ed6b90f9 100644 --- a/apps/web/modules/survey/components/template-list/index.test.tsx +++ b/apps/web/modules/survey/components/template-list/index.test.tsx @@ -1,4 +1,3 @@ -import { templates } from "@/app/lib/templates"; import { Project } from "@prisma/client"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; @@ -7,6 +6,7 @@ import { useRouter } from "next/navigation"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TTemplate } from "@formbricks/types/templates"; +import { templates } from "@/app/lib/templates"; import { createSurveyAction } from "./actions"; import { TemplateList } from "./index"; diff --git a/apps/web/modules/survey/components/template-list/index.tsx b/apps/web/modules/survey/components/template-list/index.tsx index 6fed55802c..ad0717f3c9 100644 --- a/apps/web/modules/survey/components/template-list/index.tsx +++ b/apps/web/modules/survey/components/template-list/index.tsx @@ -1,7 +1,5 @@ "use client"; -import { templates } from "@/app/lib/templates"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; @@ -10,6 +8,8 @@ import toast from "react-hot-toast"; import { ZProjectConfigChannel, ZProjectConfigIndustry } from "@formbricks/types/project"; import { TSurveyCreateInput, TSurveyType } from "@formbricks/types/surveys/types"; import { TTemplate, TTemplateFilter, ZTemplateRole } from "@formbricks/types/templates"; +import { templates } from "@/app/lib/templates"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { createSurveyAction } from "./actions"; import { StartFromScratchTemplate } from "./components/start-from-scratch-template"; import { Template } from "./components/template"; diff --git a/apps/web/modules/survey/components/template-list/lib/survey.test.ts b/apps/web/modules/survey/components/template-list/lib/survey.test.ts index 1acef64f7f..000f600e4f 100644 --- a/apps/web/modules/survey/components/template-list/lib/survey.test.ts +++ b/apps/web/modules/survey/components/template-list/lib/survey.test.ts @@ -1,10 +1,3 @@ -import { - getOrganizationByEnvironmentId, - subscribeOrganizationMembersToSurveyResponses, -} from "@/lib/organization/service"; -import { capturePosthogEnvironmentEvent } from "@/lib/posthogServer"; -import { getActionClasses } from "@/modules/survey/lib/action-class"; -import { selectSurvey } from "@/modules/survey/lib/survey"; import { ActionClass, Prisma } from "@prisma/client"; import "@testing-library/jest-dom/vitest"; import { beforeEach, describe, expect, test, vi } from "vitest"; @@ -12,6 +5,13 @@ import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurveyCreateInput } from "@formbricks/types/surveys/types"; +import { + getOrganizationByEnvironmentId, + subscribeOrganizationMembersToSurveyResponses, +} from "@/lib/organization/service"; +import { capturePosthogEnvironmentEvent } from "@/lib/posthogServer"; +import { getActionClasses } from "@/modules/survey/lib/action-class"; +import { selectSurvey } from "@/modules/survey/lib/survey"; import { createSurvey, handleTriggerUpdates } from "./survey"; // Mock dependencies diff --git a/apps/web/modules/survey/components/template-list/lib/survey.ts b/apps/web/modules/survey/components/template-list/lib/survey.ts index eb2bb5d925..df3c4a3b7d 100644 --- a/apps/web/modules/survey/components/template-list/lib/survey.ts +++ b/apps/web/modules/survey/components/template-list/lib/survey.ts @@ -1,3 +1,8 @@ +import { ActionClass, Prisma } from "@prisma/client"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TSurvey, TSurveyCreateInput } from "@formbricks/types/surveys/types"; import { getOrganizationByEnvironmentId, subscribeOrganizationMembersToSurveyResponses, @@ -7,11 +12,6 @@ import { checkForInvalidImagesInQuestions } from "@/lib/survey/utils"; import { TriggerUpdate } from "@/modules/survey/editor/types/survey-trigger"; import { getActionClasses } from "@/modules/survey/lib/action-class"; import { selectSurvey } from "@/modules/survey/lib/survey"; -import { ActionClass, Prisma } from "@prisma/client"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TSurvey, TSurveyCreateInput } from "@formbricks/types/surveys/types"; export const createSurvey = async ( environmentId: string, diff --git a/apps/web/modules/survey/components/template-list/lib/utils.test.ts b/apps/web/modules/survey/components/template-list/lib/utils.test.ts index 611f11ec64..d3108d836f 100644 --- a/apps/web/modules/survey/components/template-list/lib/utils.test.ts +++ b/apps/web/modules/survey/components/template-list/lib/utils.test.ts @@ -1,10 +1,10 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { structuredClone } from "@/lib/pollyfills/structuredClone"; import "@testing-library/jest-dom/vitest"; import { describe, expect, test, vi } from "vitest"; import { TProject } from "@formbricks/types/project"; import { TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TTemplate } from "@formbricks/types/templates"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { getChannelMapping, getIndustryMapping, diff --git a/apps/web/modules/survey/components/template-list/lib/utils.ts b/apps/web/modules/survey/components/template-list/lib/utils.ts index fccc7bf543..91c4109173 100644 --- a/apps/web/modules/survey/components/template-list/lib/utils.ts +++ b/apps/web/modules/survey/components/template-list/lib/utils.ts @@ -1,9 +1,9 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { structuredClone } from "@/lib/pollyfills/structuredClone"; import { TFnType } from "@tolgee/react"; import { TProject, TProjectConfigChannel, TProjectConfigIndustry } from "@formbricks/types/project"; import { TSurveyQuestion } from "@formbricks/types/surveys/types"; import { TTemplate, TTemplateRole } from "@formbricks/types/templates"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { structuredClone } from "@/lib/pollyfills/structuredClone"; export const replaceQuestionPresetPlaceholders = ( question: TSurveyQuestion, diff --git a/apps/web/modules/survey/editor/actions.ts b/apps/web/modules/survey/editor/actions.ts index c8f22272bb..8de3ad3bc8 100644 --- a/apps/web/modules/survey/editor/actions.ts +++ b/apps/web/modules/survey/editor/actions.ts @@ -1,15 +1,20 @@ "use server"; +import { revalidatePath } from "next/cache"; +import { z } from "zod"; +import { ZActionClassInput } from "@formbricks/types/action-classes"; +import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TSurvey, ZSurvey } from "@formbricks/types/surveys/types"; import { UNSPLASH_ACCESS_KEY, UNSPLASH_ALLOWED_DOMAINS } from "@/lib/constants"; import { actionClient, authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; import { - getOrganizationIdFromEnvironmentId, - getOrganizationIdFromProjectId, - getOrganizationIdFromSurveyId, - getProjectIdFromEnvironmentId, - getProjectIdFromSurveyId, + getOrganizationIdFromEnvironmentId, + getOrganizationIdFromProjectId, + getOrganizationIdFromSurveyId, + getProjectIdFromEnvironmentId, + getProjectIdFromSurveyId, } from "@/lib/utils/helper"; import { withAuditLogging } from "@/modules/ee/audit-logs/lib/handler"; import { checkMultiLanguagePermission } from "@/modules/ee/multi-language-surveys/lib/actions"; @@ -19,11 +24,6 @@ import { updateSurvey } from "@/modules/survey/editor/lib/survey"; import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; import { checkSpamProtectionPermission } from "@/modules/survey/lib/permission"; import { getOrganizationBilling, getSurvey } from "@/modules/survey/lib/survey"; -import { ZActionClassInput } from "@formbricks/types/action-classes"; -import { OperationNotAllowedError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TSurvey, ZSurvey } from "@formbricks/types/surveys/types"; -import { revalidatePath } from "next/cache"; -import { z } from "zod"; import { getProject } from "./lib/project"; /** diff --git a/apps/web/modules/survey/editor/components/add-action-modal.test.tsx b/apps/web/modules/survey/editor/components/add-action-modal.test.tsx index 63a4ddb7ef..5d0717db4a 100644 --- a/apps/web/modules/survey/editor/components/add-action-modal.test.tsx +++ b/apps/web/modules/survey/editor/components/add-action-modal.test.tsx @@ -1,11 +1,11 @@ -import { AddActionModal } from "@/modules/survey/editor/components/add-action-modal"; -import { CreateNewActionTab } from "@/modules/survey/editor/components/create-new-action-tab"; -import { SavedActionsTab } from "@/modules/survey/editor/components/saved-actions-tab"; import { ActionClass } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { AddActionModal } from "@/modules/survey/editor/components/add-action-modal"; +import { CreateNewActionTab } from "@/modules/survey/editor/components/create-new-action-tab"; +import { SavedActionsTab } from "@/modules/survey/editor/components/saved-actions-tab"; // Mock child components vi.mock("@/modules/survey/editor/components/create-new-action-tab", () => ({ diff --git a/apps/web/modules/survey/editor/components/add-action-modal.tsx b/apps/web/modules/survey/editor/components/add-action-modal.tsx index 0298f7efe4..f51370267c 100644 --- a/apps/web/modules/survey/editor/components/add-action-modal.tsx +++ b/apps/web/modules/survey/editor/components/add-action-modal.tsx @@ -1,5 +1,9 @@ "use client"; +import { ActionClass } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { useEffect, useState } from "react"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { CreateNewActionTab } from "@/modules/survey/editor/components/create-new-action-tab"; import { SavedActionsTab } from "@/modules/survey/editor/components/saved-actions-tab"; import { @@ -10,10 +14,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { ActionClass } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { useEffect, useState } from "react"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface AddActionModalProps { open: boolean; diff --git a/apps/web/modules/survey/editor/components/add-question-button.test.tsx b/apps/web/modules/survey/editor/components/add-question-button.test.tsx index aabb06d6ae..24e0e8fbd1 100644 --- a/apps/web/modules/survey/editor/components/add-question-button.test.tsx +++ b/apps/web/modules/survey/editor/components/add-question-button.test.tsx @@ -1,3 +1,9 @@ +import { createId } from "@paralleldrive/cuid2"; +import { Project } from "@prisma/client"; +// Import React for the mock +import { cleanup, fireEvent, render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { AddQuestionButton } from "@/modules/survey/editor/components/add-question-button"; import { TQuestion, @@ -5,12 +11,6 @@ import { getQuestionDefaults, getQuestionTypes, } from "@/modules/survey/lib/questions"; -import { createId } from "@paralleldrive/cuid2"; -import { Project } from "@prisma/client"; -// Import React for the mock -import { cleanup, fireEvent, render, screen } from "@testing-library/react"; -import userEvent from "@testing-library/user-event"; -import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; // Mock dependencies vi.mock("@/lib/cn", () => ({ diff --git a/apps/web/modules/survey/editor/components/add-question-button.tsx b/apps/web/modules/survey/editor/components/add-question-button.tsx index 83fc8d425a..b3b7959b03 100644 --- a/apps/web/modules/survey/editor/components/add-question-button.tsx +++ b/apps/web/modules/survey/editor/components/add-question-button.tsx @@ -1,12 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { - getCXQuestionTypes, - getQuestionDefaults, - getQuestionTypes, - universalQuestionPresets, -} from "@/modules/survey/lib/questions"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { createId } from "@paralleldrive/cuid2"; import { Project } from "@prisma/client"; @@ -14,6 +7,13 @@ import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; import { PlusIcon } from "lucide-react"; import { useState } from "react"; +import { cn } from "@/lib/cn"; +import { + getCXQuestionTypes, + getQuestionDefaults, + getQuestionTypes, + universalQuestionPresets, +} from "@/modules/survey/lib/questions"; interface AddQuestionButtonProps { addQuestion: (question: any) => void; diff --git a/apps/web/modules/survey/editor/components/advanced-settings.tsx b/apps/web/modules/survey/editor/components/advanced-settings.tsx index 3ad46b911a..e58778a8c7 100644 --- a/apps/web/modules/survey/editor/components/advanced-settings.tsx +++ b/apps/web/modules/survey/editor/components/advanced-settings.tsx @@ -1,7 +1,7 @@ +import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { ConditionalLogic } from "@/modules/survey/editor/components/conditional-logic"; import { OptionIds } from "@/modules/survey/editor/components/option-ids"; import { UpdateQuestionId } from "@/modules/survey/editor/components/update-question-id"; -import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; interface AdvancedSettingsProps { question: TSurveyQuestion; diff --git a/apps/web/modules/survey/editor/components/color-survey-bg.tsx b/apps/web/modules/survey/editor/components/color-survey-bg.tsx index 31aac3beb6..03445af467 100644 --- a/apps/web/modules/survey/editor/components/color-survey-bg.tsx +++ b/apps/web/modules/survey/editor/components/color-survey-bg.tsx @@ -1,5 +1,5 @@ -import { ColorPicker } from "@/modules/ui/components/color-picker"; import { useState } from "react"; +import { ColorPicker } from "@/modules/ui/components/color-picker"; interface ColorSurveyBgProps { handleBgChange: (bg: string, bgType: string) => void; diff --git a/apps/web/modules/survey/editor/components/contact-info-question-form.test.tsx b/apps/web/modules/survey/editor/components/contact-info-question-form.test.tsx index 348fa8010c..d606a3e6d5 100755 --- a/apps/web/modules/survey/editor/components/contact-info-question-form.test.tsx +++ b/apps/web/modules/survey/editor/components/contact-info-question-form.test.tsx @@ -1,4 +1,3 @@ -import { createI18nString } from "@/lib/i18n/utils"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { @@ -6,6 +5,7 @@ import { TSurveyContactInfoQuestion, TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; +import { createI18nString } from "@/lib/i18n/utils"; import { ContactInfoQuestionForm } from "./contact-info-question-form"; // Mock QuestionFormInput component diff --git a/apps/web/modules/survey/editor/components/create-new-action-tab.tsx b/apps/web/modules/survey/editor/components/create-new-action-tab.tsx index df63dbb5fe..5dd76f5bf8 100644 --- a/apps/web/modules/survey/editor/components/create-new-action-tab.tsx +++ b/apps/web/modules/survey/editor/components/create-new-action-tab.tsx @@ -1,12 +1,5 @@ "use client"; -import { ActionNameDescriptionFields } from "@/modules/ui/components/action-name-description-fields"; -import { Button } from "@/modules/ui/components/button"; -import { CodeActionForm } from "@/modules/ui/components/code-action-form"; -import { FormField } from "@/modules/ui/components/form"; -import { Label } from "@/modules/ui/components/label"; -import { NoCodeActionForm } from "@/modules/ui/components/no-code-action-form"; -import { TabToggle } from "@/modules/ui/components/tab-toggle"; import { ActionClass } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; @@ -15,6 +8,13 @@ import { FormProvider, useForm } from "react-hook-form"; import toast from "react-hot-toast"; import { TActionClassInput } from "@formbricks/types/action-classes"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { ActionNameDescriptionFields } from "@/modules/ui/components/action-name-description-fields"; +import { Button } from "@/modules/ui/components/button"; +import { CodeActionForm } from "@/modules/ui/components/code-action-form"; +import { FormField } from "@/modules/ui/components/form"; +import { Label } from "@/modules/ui/components/label"; +import { NoCodeActionForm } from "@/modules/ui/components/no-code-action-form"; +import { TabToggle } from "@/modules/ui/components/tab-toggle"; import { createActionClassAction } from "../actions"; import { buildActionObject } from "../lib/action-builder"; import { createActionClassZodResolver, useActionClassKeys, validatePermissions } from "../lib/action-utils"; diff --git a/apps/web/modules/survey/editor/components/editor-card-menu.tsx b/apps/web/modules/survey/editor/components/editor-card-menu.tsx index 68bdfa5599..79b9d4983b 100644 --- a/apps/web/modules/survey/editor/components/editor-card-menu.tsx +++ b/apps/web/modules/survey/editor/components/editor-card-menu.tsx @@ -1,5 +1,17 @@ "use client"; +import { createId } from "@paralleldrive/cuid2"; +import { Project } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { ArrowDownIcon, ArrowUpIcon, CopyIcon, EllipsisIcon, TrashIcon } from "lucide-react"; +import { useState } from "react"; +import { + TSurvey, + TSurveyEndScreenCard, + TSurveyQuestion, + TSurveyQuestionTypeEnum, + TSurveyRedirectUrlCard, +} from "@formbricks/types/surveys/types"; import { getCXQuestionNameMap, getQuestionDefaults, @@ -18,18 +30,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { TooltipRenderer } from "@/modules/ui/components/tooltip"; -import { createId } from "@paralleldrive/cuid2"; -import { Project } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { ArrowDownIcon, ArrowUpIcon, CopyIcon, EllipsisIcon, TrashIcon } from "lucide-react"; -import { useState } from "react"; -import { - TSurvey, - TSurveyEndScreenCard, - TSurveyQuestion, - TSurveyQuestionTypeEnum, - TSurveyRedirectUrlCard, -} from "@formbricks/types/surveys/types"; interface EditorCardMenuProps { survey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/file-upload-question-form.test.tsx b/apps/web/modules/survey/editor/components/file-upload-question-form.test.tsx index 314cb9ef75..d806c0b0d3 100644 --- a/apps/web/modules/survey/editor/components/file-upload-question-form.test.tsx +++ b/apps/web/modules/survey/editor/components/file-upload-question-form.test.tsx @@ -1,9 +1,9 @@ -import { createI18nString } from "@/lib/i18n/utils"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { toast } from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurveyFileUploadQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { createI18nString } from "@/lib/i18n/utils"; import { FileUploadQuestionForm } from "./file-upload-question-form"; // Mock dependencies diff --git a/apps/web/modules/survey/editor/components/form-styling-settings.tsx b/apps/web/modules/survey/editor/components/form-styling-settings.tsx index e59db522d7..ebfd806eb7 100644 --- a/apps/web/modules/survey/editor/components/form-styling-settings.tsx +++ b/apps/web/modules/survey/editor/components/form-styling-settings.tsx @@ -1,11 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { COLOR_DEFAULTS } from "@/lib/styling/constants"; -import { mixColor } from "@/lib/utils/colors"; -import { Button } from "@/modules/ui/components/button"; -import { ColorPicker } from "@/modules/ui/components/color-picker"; -import { FormControl, FormDescription, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; @@ -14,6 +8,12 @@ import React from "react"; import { UseFormReturn } from "react-hook-form"; import { TProjectStyling } from "@formbricks/types/project"; import { TSurveyStyling } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { COLOR_DEFAULTS } from "@/lib/styling/constants"; +import { mixColor } from "@/lib/utils/colors"; +import { Button } from "@/modules/ui/components/button"; +import { ColorPicker } from "@/modules/ui/components/color-picker"; +import { FormControl, FormDescription, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; type FormStylingSettingsProps = { open: boolean; diff --git a/apps/web/modules/survey/editor/components/how-to-send-card.test.tsx b/apps/web/modules/survey/editor/components/how-to-send-card.test.tsx index 4a36af9d45..a20f5c9a6c 100644 --- a/apps/web/modules/survey/editor/components/how-to-send-card.test.tsx +++ b/apps/web/modules/survey/editor/components/how-to-send-card.test.tsx @@ -1,4 +1,3 @@ -import { getDefaultEndingCard } from "@/app/lib/survey-builder"; import { Environment } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; @@ -6,6 +5,7 @@ import { afterEach, describe, expect, test, vi } from "vitest"; import { TLanguage } from "@formbricks/types/project"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyLanguage } from "@formbricks/types/surveys/types"; +import { getDefaultEndingCard } from "@/app/lib/survey-builder"; import { HowToSendCard } from "./how-to-send-card"; // Mock constants diff --git a/apps/web/modules/survey/editor/components/how-to-send-card.tsx b/apps/web/modules/survey/editor/components/how-to-send-card.tsx index a157ee399f..905630b220 100644 --- a/apps/web/modules/survey/editor/components/how-to-send-card.tsx +++ b/apps/web/modules/survey/editor/components/how-to-send-card.tsx @@ -1,11 +1,5 @@ "use client"; -import { getDefaultEndingCard } from "@/app/lib/survey-builder"; -import { cn } from "@/lib/cn"; -import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; -import { Badge } from "@/modules/ui/components/badge"; -import { Label } from "@/modules/ui/components/label"; -import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { Environment } from "@prisma/client"; import * as Collapsible from "@radix-ui/react-collapsible"; @@ -14,6 +8,12 @@ import { CheckIcon, LinkIcon, MonitorIcon } from "lucide-react"; import { useEffect, useState } from "react"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyType } from "@formbricks/types/surveys/types"; +import { getDefaultEndingCard } from "@/app/lib/survey-builder"; +import { cn } from "@/lib/cn"; +import { Alert, AlertButton, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; +import { Badge } from "@/modules/ui/components/badge"; +import { Label } from "@/modules/ui/components/label"; +import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; interface HowToSendCardProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/logic-editor-actions.tsx b/apps/web/modules/survey/editor/components/logic-editor-actions.tsx index 1a2c098d37..ad9c5679b1 100644 --- a/apps/web/modules/survey/editor/components/logic-editor-actions.tsx +++ b/apps/web/modules/survey/editor/components/logic-editor-actions.tsx @@ -1,5 +1,18 @@ "use client"; +import { createId } from "@paralleldrive/cuid2"; +import { useTranslate } from "@tolgee/react"; +import { CopyIcon, CornerDownRightIcon, EllipsisVerticalIcon, PlusIcon, TrashIcon } from "lucide-react"; +import { + TActionNumberVariableCalculateOperator, + TActionObjective, + TActionTextVariableCalculateOperator, + TActionVariableValueType, + TSurvey, + TSurveyLogic, + TSurveyLogicAction, + TSurveyQuestion, +} from "@formbricks/types/surveys/types"; import { getUpdatedActionBody } from "@/lib/surveyLogic/utils"; import { getActionObjectiveOptions, @@ -18,19 +31,6 @@ import { } from "@/modules/ui/components/dropdown-menu"; import { InputCombobox } from "@/modules/ui/components/input-combo-box"; import { cn } from "@/modules/ui/lib/utils"; -import { createId } from "@paralleldrive/cuid2"; -import { useTranslate } from "@tolgee/react"; -import { CopyIcon, CornerDownRightIcon, EllipsisVerticalIcon, PlusIcon, TrashIcon } from "lucide-react"; -import { - TActionNumberVariableCalculateOperator, - TActionObjective, - TActionTextVariableCalculateOperator, - TActionVariableValueType, - TSurvey, - TSurveyLogic, - TSurveyLogicAction, - TSurveyQuestion, -} from "@formbricks/types/surveys/types"; interface LogicEditorActions { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/open-question-form.test.tsx b/apps/web/modules/survey/editor/components/open-question-form.test.tsx index 2a7a7f05ef..b0a9e61aed 100644 --- a/apps/web/modules/survey/editor/components/open-question-form.test.tsx +++ b/apps/web/modules/survey/editor/components/open-question-form.test.tsx @@ -1,11 +1,11 @@ -import { createI18nString } from "@/lib/i18n/utils"; -import { OpenQuestionForm } from "@/modules/survey/editor/components/open-question-form"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; // Import fireEvent, remove rtlRerender if not used elsewhere import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyOpenTextQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { createI18nString } from "@/lib/i18n/utils"; +import { OpenQuestionForm } from "@/modules/survey/editor/components/open-question-form"; // Mock dependencies vi.mock("@/lib/i18n/utils", () => ({ diff --git a/apps/web/modules/survey/editor/components/option-ids.test.tsx b/apps/web/modules/survey/editor/components/option-ids.test.tsx index 05783d47bd..b303f5296d 100644 --- a/apps/web/modules/survey/editor/components/option-ids.test.tsx +++ b/apps/web/modules/survey/editor/components/option-ids.test.tsx @@ -1,8 +1,8 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getLocalizedValue } from "@/lib/i18n/utils"; import { OptionIds } from "./option-ids"; vi.mock("@/lib/i18n/utils", () => ({ diff --git a/apps/web/modules/survey/editor/components/option-ids.tsx b/apps/web/modules/survey/editor/components/option-ids.tsx index b437079fab..94abb2969a 100644 --- a/apps/web/modules/survey/editor/components/option-ids.tsx +++ b/apps/web/modules/survey/editor/components/option-ids.tsx @@ -1,9 +1,9 @@ -import { getLocalizedValue } from "@/lib/i18n/utils"; -import { IdBadge } from "@/modules/ui/components/id-badge"; -import { Label } from "@/modules/ui/components/label"; import { useTranslate } from "@tolgee/react"; import Image from "next/image"; import { TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getLocalizedValue } from "@/lib/i18n/utils"; +import { IdBadge } from "@/modules/ui/components/id-badge"; +import { Label } from "@/modules/ui/components/label"; interface OptionIdsProps { question: TSurveyQuestion; diff --git a/apps/web/modules/survey/editor/components/picture-selection-form.test.tsx b/apps/web/modules/survey/editor/components/picture-selection-form.test.tsx index 44cec49138..ee061d726e 100644 --- a/apps/web/modules/survey/editor/components/picture-selection-form.test.tsx +++ b/apps/web/modules/survey/editor/components/picture-selection-form.test.tsx @@ -1,6 +1,3 @@ -import { createI18nString } from "@/lib/i18n/utils"; -import { PictureSelectionForm } from "@/modules/survey/editor/components/picture-selection-form"; -import { FileInput } from "@/modules/ui/components/file-input"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; @@ -11,6 +8,9 @@ import { TSurveyQuestionTypeEnum, } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { createI18nString } from "@/lib/i18n/utils"; +import { PictureSelectionForm } from "@/modules/survey/editor/components/picture-selection-form"; +import { FileInput } from "@/modules/ui/components/file-input"; vi.mock("@formkit/auto-animate/react", () => ({ useAutoAnimate: () => [vi.fn()], diff --git a/apps/web/modules/survey/editor/components/placement.test.tsx b/apps/web/modules/survey/editor/components/placement.test.tsx index 690c68094f..110e41c343 100644 --- a/apps/web/modules/survey/editor/components/placement.test.tsx +++ b/apps/web/modules/survey/editor/components/placement.test.tsx @@ -1,8 +1,8 @@ -import { Placement } from "@/modules/survey/editor/components/placement"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TPlacement } from "@formbricks/types/common"; +import { Placement } from "@/modules/survey/editor/components/placement"; // Mock useTranslate const mockSetCurrentPlacement = vi.fn(); diff --git a/apps/web/modules/survey/editor/components/placement.tsx b/apps/web/modules/survey/editor/components/placement.tsx index 86e1b9788e..4f001079a3 100644 --- a/apps/web/modules/survey/editor/components/placement.tsx +++ b/apps/web/modules/survey/editor/components/placement.tsx @@ -1,11 +1,11 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { TPlacement } from "@formbricks/types/common"; import { cn } from "@/lib/cn"; import { Label } from "@/modules/ui/components/label"; import { getPlacementStyle } from "@/modules/ui/components/preview-survey/lib/utils"; import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; -import { useTranslate } from "@tolgee/react"; -import { TPlacement } from "@formbricks/types/common"; interface TPlacementProps { currentPlacement: TPlacement; diff --git a/apps/web/modules/survey/editor/components/question-card.test.tsx b/apps/web/modules/survey/editor/components/question-card.test.tsx index 4843a3570e..0f5b537053 100644 --- a/apps/web/modules/survey/editor/components/question-card.test.tsx +++ b/apps/web/modules/survey/editor/components/question-card.test.tsx @@ -1,10 +1,10 @@ -import { QuestionCard } from "@/modules/survey/editor/components/question-card"; import { Project } from "@prisma/client"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; // Import waitFor import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { QuestionCard } from "@/modules/survey/editor/components/question-card"; // Mock child components vi.mock("@/modules/survey/components/question-form-input", () => ({ diff --git a/apps/web/modules/survey/editor/components/questions-droppable.test.tsx b/apps/web/modules/survey/editor/components/questions-droppable.test.tsx index d50eaf8a5d..97cbc12584 100755 --- a/apps/web/modules/survey/editor/components/questions-droppable.test.tsx +++ b/apps/web/modules/survey/editor/components/questions-droppable.test.tsx @@ -1,8 +1,8 @@ -import { QuestionsDroppable } from "@/modules/survey/editor/components/questions-droppable"; import { Project } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { QuestionsDroppable } from "@/modules/survey/editor/components/questions-droppable"; // Mock the QuestionCard component vi.mock("@/modules/survey/editor/components/question-card", () => ({ diff --git a/apps/web/modules/survey/editor/components/recontact-options-card.tsx b/apps/web/modules/survey/editor/components/recontact-options-card.tsx index 9305c33cc8..a849debc3d 100644 --- a/apps/web/modules/survey/editor/components/recontact-options-card.tsx +++ b/apps/web/modules/survey/editor/components/recontact-options-card.tsx @@ -1,9 +1,5 @@ "use client"; -import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; -import { Input } from "@/modules/ui/components/input"; -import { Label } from "@/modules/ui/components/label"; -import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; @@ -11,6 +7,10 @@ import { CheckIcon } from "lucide-react"; import Link from "next/link"; import { useEffect, useMemo, useState } from "react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; +import { Input } from "@/modules/ui/components/input"; +import { Label } from "@/modules/ui/components/label"; +import { RadioGroup, RadioGroupItem } from "@/modules/ui/components/radio-group"; interface DisplayOption { id: "displayOnce" | "displayMultiple" | "respondMultiple" | "displaySome"; diff --git a/apps/web/modules/survey/editor/components/redirect-url-form.tsx b/apps/web/modules/survey/editor/components/redirect-url-form.tsx index 6262f2384b..fda0da8e83 100644 --- a/apps/web/modules/survey/editor/components/redirect-url-form.tsx +++ b/apps/web/modules/survey/editor/components/redirect-url-form.tsx @@ -1,12 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useRef } from "react"; +import { TSurvey, TSurveyRedirectUrlCard } from "@formbricks/types/surveys/types"; import { headlineToRecall, recallToHeadline } from "@/lib/utils/recall"; import { RecallWrapper } from "@/modules/survey/components/question-form-input/components/recall-wrapper"; import { Input } from "@/modules/ui/components/input"; import { Label } from "@/modules/ui/components/label"; -import { useTranslate } from "@tolgee/react"; -import { useRef } from "react"; -import { TSurvey, TSurveyRedirectUrlCard } from "@formbricks/types/surveys/types"; interface RedirectUrlFormProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/response-options-card.tsx b/apps/web/modules/survey/editor/components/response-options-card.tsx index 535ae25f4c..4ace0fda93 100644 --- a/apps/web/modules/survey/editor/components/response-options-card.tsx +++ b/apps/web/modules/survey/editor/components/response-options-card.tsx @@ -1,11 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; -import { Alert, AlertTitle } from "@/modules/ui/components/alert"; -import { Input } from "@/modules/ui/components/input"; -import { Label } from "@/modules/ui/components/label"; -import { Slider } from "@/modules/ui/components/slider"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; @@ -13,6 +7,12 @@ import { CheckIcon } from "lucide-react"; import { KeyboardEventHandler, useEffect, useState } from "react"; import toast from "react-hot-toast"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; +import { Alert, AlertTitle } from "@/modules/ui/components/alert"; +import { Input } from "@/modules/ui/components/input"; +import { Label } from "@/modules/ui/components/label"; +import { Slider } from "@/modules/ui/components/slider"; interface ResponseOptionsCardProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/saved-actions-tab.tsx b/apps/web/modules/survey/editor/components/saved-actions-tab.tsx index a46d678dab..32424ddc8e 100644 --- a/apps/web/modules/survey/editor/components/saved-actions-tab.tsx +++ b/apps/web/modules/survey/editor/components/saved-actions-tab.tsx @@ -1,12 +1,12 @@ "use client"; -import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils"; -import { ActionClassInfo } from "@/modules/ui/components/action-class-info"; -import { Input } from "@/modules/ui/components/input"; import { ActionClass } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { useState } from "react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { ACTION_TYPE_ICON_LOOKUP } from "@/modules/projects/settings/(setup)/app-connection/utils"; +import { ActionClassInfo } from "@/modules/ui/components/action-class-info"; +import { Input } from "@/modules/ui/components/input"; interface SavedActionsTabProps { actionClasses: ActionClass[]; diff --git a/apps/web/modules/survey/editor/components/settings-view.test.tsx b/apps/web/modules/survey/editor/components/settings-view.test.tsx index 60e158fe0f..53ffe9fca2 100644 --- a/apps/web/modules/survey/editor/components/settings-view.test.tsx +++ b/apps/web/modules/survey/editor/components/settings-view.test.tsx @@ -1,10 +1,10 @@ -import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { ActionClass, Environment, OrganizationRole } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { SettingsView } from "./settings-view"; // Mock child components diff --git a/apps/web/modules/survey/editor/components/settings-view.tsx b/apps/web/modules/survey/editor/components/settings-view.tsx index 5397c7ba6f..1599e6a272 100644 --- a/apps/web/modules/survey/editor/components/settings-view.tsx +++ b/apps/web/modules/survey/editor/components/settings-view.tsx @@ -1,3 +1,8 @@ +import { ActionClass, Environment, OrganizationRole } from "@prisma/client"; +import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; +import { TSurveyQuota } from "@formbricks/types/quota"; +import { TSegment } from "@formbricks/types/segment"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { TargetingCard } from "@/modules/ee/contacts/segments/components/targeting-card"; import { QuotasCard } from "@/modules/ee/quotas/components/quotas-card"; import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; @@ -7,11 +12,6 @@ import { ResponseOptionsCard } from "@/modules/survey/editor/components/response import { SurveyPlacementCard } from "@/modules/survey/editor/components/survey-placement-card"; import { TargetingLockedCard } from "@/modules/survey/editor/components/targeting-locked-card"; import { WhenToSendCard } from "@/modules/survey/editor/components/when-to-send-card"; -import { ActionClass, Environment, OrganizationRole } from "@prisma/client"; -import { TContactAttributeKey } from "@formbricks/types/contact-attribute-key"; -import { TSurveyQuota } from "@formbricks/types/quota"; -import { TSegment } from "@formbricks/types/segment"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface SettingsViewProps { environment: Pick; diff --git a/apps/web/modules/survey/editor/components/styling-view.test.tsx b/apps/web/modules/survey/editor/components/styling-view.test.tsx index 68d2620c2f..c7bc666c24 100644 --- a/apps/web/modules/survey/editor/components/styling-view.test.tsx +++ b/apps/web/modules/survey/editor/components/styling-view.test.tsx @@ -1,4 +1,3 @@ -import { defaultStyling } from "@/lib/styling/constants"; import { Project } from "@prisma/client"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; @@ -6,6 +5,7 @@ import { FormProvider, useForm } from "react-hook-form"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyStyling } from "@formbricks/types/surveys/types"; +import { defaultStyling } from "@/lib/styling/constants"; // Import actual components import { StylingView } from "./styling-view"; diff --git a/apps/web/modules/survey/editor/components/styling-view.tsx b/apps/web/modules/survey/editor/components/styling-view.tsx index 416e9c01f0..04dd7c3c19 100644 --- a/apps/web/modules/survey/editor/components/styling-view.tsx +++ b/apps/web/modules/survey/editor/components/styling-view.tsx @@ -1,5 +1,14 @@ "use client"; +import { Project } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { RotateCcwIcon } from "lucide-react"; +import Link from "next/link"; +import React, { useEffect, useMemo, useState } from "react"; +import { UseFormReturn, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { TProjectStyling } from "@formbricks/types/project"; +import { TSurvey, TSurveyStyling } from "@formbricks/types/surveys/types"; import { defaultStyling } from "@/lib/styling/constants"; import { FormStylingSettings } from "@/modules/survey/editor/components/form-styling-settings"; import { AlertDialog } from "@/modules/ui/components/alert-dialog"; @@ -15,15 +24,6 @@ import { FormProvider, } from "@/modules/ui/components/form"; import { Switch } from "@/modules/ui/components/switch"; -import { Project } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { RotateCcwIcon } from "lucide-react"; -import Link from "next/link"; -import React, { useEffect, useMemo, useState } from "react"; -import { UseFormReturn, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { TProjectStyling } from "@formbricks/types/project"; -import { TSurvey, TSurveyStyling } from "@formbricks/types/surveys/types"; interface StylingViewProps { environmentId: string; diff --git a/apps/web/modules/survey/editor/components/survey-editor-tabs.tsx b/apps/web/modules/survey/editor/components/survey-editor-tabs.tsx index 8bfb16c4d2..98b7511f77 100644 --- a/apps/web/modules/survey/editor/components/survey-editor-tabs.tsx +++ b/apps/web/modules/survey/editor/components/survey-editor-tabs.tsx @@ -1,11 +1,11 @@ "use client"; -import { cn } from "@/lib/cn"; -import { ProBadge } from "@/modules/ui/components/pro-badge"; import { useTranslate } from "@tolgee/react"; import { MailIcon, PaintbrushIcon, Rows3Icon, SettingsIcon } from "lucide-react"; import { type JSX, useMemo } from "react"; import { TSurveyEditorTabs } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { ProBadge } from "@/modules/ui/components/pro-badge"; interface Tab { id: TSurveyEditorTabs; diff --git a/apps/web/modules/survey/editor/components/survey-editor.test.tsx b/apps/web/modules/survey/editor/components/survey-editor.test.tsx index 145ae23c52..8b433045c4 100644 --- a/apps/web/modules/survey/editor/components/survey-editor.test.tsx +++ b/apps/web/modules/survey/editor/components/survey-editor.test.tsx @@ -1,5 +1,3 @@ -import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; -import { refetchProjectAction } from "@/modules/survey/editor/actions"; import { Environment, Language, OrganizationRole, Project } from "@prisma/client"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; @@ -7,6 +5,8 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TLanguage } from "@formbricks/types/project"; import { TSurvey, TSurveyOpenTextQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; +import { refetchProjectAction } from "@/modules/survey/editor/actions"; import { SurveyEditor } from "./survey-editor"; // Mock child components and hooks diff --git a/apps/web/modules/survey/editor/components/survey-menu-bar.test.tsx b/apps/web/modules/survey/editor/components/survey-menu-bar.test.tsx index b4e3c27a7a..67b09b82cb 100644 --- a/apps/web/modules/survey/editor/components/survey-menu-bar.test.tsx +++ b/apps/web/modules/survey/editor/components/survey-menu-bar.test.tsx @@ -1,12 +1,12 @@ -import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; -import { updateSurveyAction } from "@/modules/survey/editor/actions"; -import { SurveyMenuBar } from "@/modules/survey/editor/components/survey-menu-bar"; -import { isSurveyValid } from "@/modules/survey/editor/lib/validation"; import { Project } from "@prisma/client"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyOpenTextQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; +import { updateSurveyAction } from "@/modules/survey/editor/actions"; +import { SurveyMenuBar } from "@/modules/survey/editor/components/survey-menu-bar"; +import { isSurveyValid } from "@/modules/survey/editor/lib/validation"; // Mock dependencies vi.mock("@/lib/utils/helper", () => ({ diff --git a/apps/web/modules/survey/editor/components/survey-menu-bar.tsx b/apps/web/modules/survey/editor/components/survey-menu-bar.tsx index 7f6dafccef..9871b7cf46 100644 --- a/apps/web/modules/survey/editor/components/survey-menu-bar.tsx +++ b/apps/web/modules/survey/editor/components/survey-menu-bar.tsx @@ -1,11 +1,5 @@ "use client"; -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; -import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; -import { AlertDialog } from "@/modules/ui/components/alert-dialog"; -import { Button } from "@/modules/ui/components/button"; -import { Input } from "@/modules/ui/components/input"; import { Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { isEqual } from "lodash"; @@ -23,6 +17,12 @@ import { ZSurveyEndScreenCard, ZSurveyRedirectUrlCard, } from "@formbricks/types/surveys/types"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { createSegmentAction } from "@/modules/ee/contacts/segments/actions"; +import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; +import { AlertDialog } from "@/modules/ui/components/alert-dialog"; +import { Button } from "@/modules/ui/components/button"; +import { Input } from "@/modules/ui/components/input"; import { updateSurveyAction } from "../actions"; import { isSurveyValid } from "../lib/validation"; diff --git a/apps/web/modules/survey/editor/components/survey-placement-card.test.tsx b/apps/web/modules/survey/editor/components/survey-placement-card.test.tsx index aee40fee5a..4cbcb872ed 100644 --- a/apps/web/modules/survey/editor/components/survey-placement-card.test.tsx +++ b/apps/web/modules/survey/editor/components/survey-placement-card.test.tsx @@ -1,9 +1,9 @@ -import { SurveyPlacementCard } from "@/modules/survey/editor/components/survey-placement-card"; import { cleanup, fireEvent, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TPlacement } from "@formbricks/types/common"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { SurveyPlacementCard } from "@/modules/survey/editor/components/survey-placement-card"; // Mock the Placement component vi.mock("@/modules/survey/editor/components/placement", () => ({ diff --git a/apps/web/modules/survey/editor/components/survey-placement-card.tsx b/apps/web/modules/survey/editor/components/survey-placement-card.tsx index ff03e873d4..91a2c18677 100644 --- a/apps/web/modules/survey/editor/components/survey-placement-card.tsx +++ b/apps/web/modules/survey/editor/components/survey-placement-card.tsx @@ -1,8 +1,5 @@ "use client"; -import { Placement } from "@/modules/survey/editor/components/placement"; -import { Label } from "@/modules/ui/components/label"; -import { Switch } from "@/modules/ui/components/switch"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; @@ -11,6 +8,9 @@ import Link from "next/link"; import { useState } from "react"; import { TPlacement } from "@formbricks/types/common"; import { TSurvey, TSurveyProjectOverwrites } from "@formbricks/types/surveys/types"; +import { Placement } from "@/modules/survey/editor/components/placement"; +import { Label } from "@/modules/ui/components/label"; +import { Switch } from "@/modules/ui/components/switch"; interface SurveyPlacementCardProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/survey-variables-card.test.tsx b/apps/web/modules/survey/editor/components/survey-variables-card.test.tsx index fb79452ae9..4f4e4ea606 100644 --- a/apps/web/modules/survey/editor/components/survey-variables-card.test.tsx +++ b/apps/web/modules/survey/editor/components/survey-variables-card.test.tsx @@ -1,8 +1,8 @@ -import { SurveyVariablesCard } from "@/modules/survey/editor/components/survey-variables-card"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyVariable } from "@formbricks/types/surveys/types"; +import { SurveyVariablesCard } from "@/modules/survey/editor/components/survey-variables-card"; // Mock the child component vi.mock("@/modules/survey/editor/components/survey-variables-card-item", () => ({ diff --git a/apps/web/modules/survey/editor/components/survey-variables-card.tsx b/apps/web/modules/survey/editor/components/survey-variables-card.tsx index da9a64d678..6f4c2beb88 100644 --- a/apps/web/modules/survey/editor/components/survey-variables-card.tsx +++ b/apps/web/modules/survey/editor/components/survey-variables-card.tsx @@ -1,13 +1,13 @@ "use client"; -import { cn } from "@/lib/cn"; -import { SurveyVariablesCardItem } from "@/modules/survey/editor/components/survey-variables-card-item"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; import { FileDigitIcon } from "lucide-react"; import { TSurveyQuota } from "@formbricks/types/quota"; import { TSurvey, TSurveyQuestionId } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { SurveyVariablesCardItem } from "@/modules/survey/editor/components/survey-variables-card-item"; interface SurveyVariablesCardProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/targeting-locked-card.test.tsx b/apps/web/modules/survey/editor/components/targeting-locked-card.test.tsx index b7e60d0840..f94d3894ee 100644 --- a/apps/web/modules/survey/editor/components/targeting-locked-card.test.tsx +++ b/apps/web/modules/survey/editor/components/targeting-locked-card.test.tsx @@ -1,7 +1,7 @@ -import { TargetingLockedCard } from "@/modules/survey/editor/components/targeting-locked-card"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { TargetingLockedCard } from "@/modules/survey/editor/components/targeting-locked-card"; interface UpgradePromptButton { text: string; diff --git a/apps/web/modules/survey/editor/components/targeting-locked-card.tsx b/apps/web/modules/survey/editor/components/targeting-locked-card.tsx index 5af7760372..2644b2e267 100644 --- a/apps/web/modules/survey/editor/components/targeting-locked-card.tsx +++ b/apps/web/modules/survey/editor/components/targeting-locked-card.tsx @@ -1,10 +1,10 @@ "use client"; -import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; import { LockIcon } from "lucide-react"; import { useState } from "react"; +import { UpgradePrompt } from "@/modules/ui/components/upgrade-prompt"; interface TargetingLockedCardProps { isFormbricksCloud: boolean; diff --git a/apps/web/modules/survey/editor/components/unsplash-images.tsx b/apps/web/modules/survey/editor/components/unsplash-images.tsx index e7a76c22b9..9759246d0e 100644 --- a/apps/web/modules/survey/editor/components/unsplash-images.tsx +++ b/apps/web/modules/survey/editor/components/unsplash-images.tsx @@ -1,8 +1,5 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { Input } from "@/modules/ui/components/input"; -import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; import { useTranslate } from "@tolgee/react"; import { debounce } from "lodash"; import { SearchIcon } from "lucide-react"; @@ -10,6 +7,9 @@ import UnsplashImage from "next/image"; import { useEffect, useRef, useState } from "react"; import toast from "react-hot-toast"; import { TSurveyBackgroundBgType } from "@formbricks/types/surveys/types"; +import { Button } from "@/modules/ui/components/button"; +import { Input } from "@/modules/ui/components/input"; +import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; import { getImagesFromUnsplashAction, triggerDownloadUnsplashImageAction } from "../actions"; interface ImageFromUnsplashSurveyBgProps { diff --git a/apps/web/modules/survey/editor/components/update-question-id.tsx b/apps/web/modules/survey/editor/components/update-question-id.tsx index 7c11962f88..c3fb5ac515 100644 --- a/apps/web/modules/survey/editor/components/update-question-id.tsx +++ b/apps/web/modules/survey/editor/components/update-question-id.tsx @@ -1,13 +1,13 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { Input } from "@/modules/ui/components/input"; -import { Label } from "@/modules/ui/components/label"; import { useTranslate } from "@tolgee/react"; import { useState } from "react"; import toast from "react-hot-toast"; import { TSurvey, TSurveyQuestion } from "@formbricks/types/surveys/types"; import { validateId } from "@formbricks/types/surveys/validation"; +import { Button } from "@/modules/ui/components/button"; +import { Input } from "@/modules/ui/components/input"; +import { Label } from "@/modules/ui/components/label"; interface UpdateQuestionIdProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/components/when-to-send-card.test.tsx b/apps/web/modules/survey/editor/components/when-to-send-card.test.tsx index e1781bbd40..b654422933 100644 --- a/apps/web/modules/survey/editor/components/when-to-send-card.test.tsx +++ b/apps/web/modules/survey/editor/components/when-to-send-card.test.tsx @@ -1,10 +1,10 @@ -import { AddActionModal } from "@/modules/survey/editor/components/add-action-modal"; import { ActionClass, OrganizationRole } from "@prisma/client"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; // Adjust path as necessary import { TSurvey, TSurveyQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { AddActionModal } from "@/modules/survey/editor/components/add-action-modal"; import { WhenToSendCard } from "./when-to-send-card"; // Mock environment-dependent modules diff --git a/apps/web/modules/survey/editor/components/when-to-send-card.tsx b/apps/web/modules/survey/editor/components/when-to-send-card.tsx index b312fa0a03..874d83b84c 100644 --- a/apps/web/modules/survey/editor/components/when-to-send-card.tsx +++ b/apps/web/modules/survey/editor/components/when-to-send-card.tsx @@ -1,5 +1,12 @@ "use client"; +import { useAutoAnimate } from "@formkit/auto-animate/react"; +import { ActionClass, OrganizationRole } from "@prisma/client"; +import * as Collapsible from "@radix-ui/react-collapsible"; +import { useTranslate } from "@tolgee/react"; +import { CheckIcon, PlusIcon, Trash2Icon } from "lucide-react"; +import { useEffect, useMemo, useState } from "react"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { getAccessFlags } from "@/lib/membership/utils"; import { TTeamPermission } from "@/modules/ee/teams/project-teams/types/team"; import { getTeamPermissionFlags } from "@/modules/ee/teams/utils/teams"; @@ -9,13 +16,6 @@ import { ActionClassInfo } from "@/modules/ui/components/action-class-info"; import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; import { Button } from "@/modules/ui/components/button"; import { Input } from "@/modules/ui/components/input"; -import { useAutoAnimate } from "@formkit/auto-animate/react"; -import { ActionClass, OrganizationRole } from "@prisma/client"; -import * as Collapsible from "@radix-ui/react-collapsible"; -import { useTranslate } from "@tolgee/react"; -import { CheckIcon, PlusIcon, Trash2Icon } from "lucide-react"; -import { useEffect, useMemo, useState } from "react"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface WhenToSendCardProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/editor/lib/action-utils.ts b/apps/web/modules/survey/editor/lib/action-utils.ts index 06d873876a..452f026252 100644 --- a/apps/web/modules/survey/editor/lib/action-utils.ts +++ b/apps/web/modules/survey/editor/lib/action-utils.ts @@ -1,4 +1,3 @@ -import { isValidCssSelector } from "@/app/lib/actionClass/actionClass"; import { zodResolver } from "@hookform/resolvers/zod"; import { TFnType } from "@tolgee/react"; import { useMemo } from "react"; @@ -9,6 +8,7 @@ import { TActionClassInputCode, ZActionClassInput, } from "@formbricks/types/action-classes"; +import { isValidCssSelector } from "@/app/lib/actionClass/actionClass"; /** * Extract action class keys from code-type action classes diff --git a/apps/web/modules/survey/editor/lib/shared-conditions-factory.ts b/apps/web/modules/survey/editor/lib/shared-conditions-factory.ts index e374098e07..c93b7fdbfc 100644 --- a/apps/web/modules/survey/editor/lib/shared-conditions-factory.ts +++ b/apps/web/modules/survey/editor/lib/shared-conditions-factory.ts @@ -1,3 +1,13 @@ +import { createId } from "@paralleldrive/cuid2"; +import { TFnType } from "@tolgee/react"; +import { TSurveyQuotaLogic } from "@formbricks/types/quota"; +import { + TConditionGroup, + TSingleCondition, + TSurvey, + TSurveyLogicConditionsOperator, + TSurveyQuestionTypeEnum, +} from "@formbricks/types/surveys/types"; import { addConditionBelow, createGroupFromResource, @@ -19,16 +29,6 @@ import { TConditionsEditorConfig, TGenericConditionGroup, } from "@/modules/ui/components/conditions-editor/types"; -import { createId } from "@paralleldrive/cuid2"; -import { TFnType } from "@tolgee/react"; -import { TSurveyQuotaLogic } from "@formbricks/types/quota"; -import { - TConditionGroup, - TSingleCondition, - TSurvey, - TSurveyLogicConditionsOperator, - TSurveyQuestionTypeEnum, -} from "@formbricks/types/surveys/types"; // Factory parameters interface export interface SharedConditionsFactoryParams { diff --git a/apps/web/modules/survey/editor/lib/survey.test.ts b/apps/web/modules/survey/editor/lib/survey.test.ts index 7169f53656..7821a7cea4 100644 --- a/apps/web/modules/survey/editor/lib/survey.test.ts +++ b/apps/web/modules/survey/editor/lib/survey.test.ts @@ -1,12 +1,12 @@ -import { getActionClasses } from "@/modules/survey/lib/action-class"; -import { getOrganizationAIKeys, getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; -import { getSurvey } from "@/modules/survey/lib/survey"; import { ActionClass, Prisma } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSegment } from "@formbricks/types/segment"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getActionClasses } from "@/modules/survey/lib/action-class"; +import { getOrganizationAIKeys, getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; +import { getSurvey } from "@/modules/survey/lib/survey"; import { checkTriggersValidity, handleTriggerUpdates, updateSurvey } from "./survey"; // Mock dependencies diff --git a/apps/web/modules/survey/editor/lib/survey.ts b/apps/web/modules/survey/editor/lib/survey.ts index 2beff05cd2..14a9694a17 100644 --- a/apps/web/modules/survey/editor/lib/survey.ts +++ b/apps/web/modules/survey/editor/lib/survey.ts @@ -1,14 +1,14 @@ -import { checkForInvalidImagesInQuestions } from "@/lib/survey/utils"; -import { TriggerUpdate } from "@/modules/survey/editor/types/survey-trigger"; -import { getActionClasses } from "@/modules/survey/lib/action-class"; -import { getOrganizationAIKeys, getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; -import { getSurvey, selectSurvey } from "@/modules/survey/lib/survey"; import { ActionClass, Prisma } from "@prisma/client"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSegment, ZSegmentFilters } from "@formbricks/types/segment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { checkForInvalidImagesInQuestions } from "@/lib/survey/utils"; +import { TriggerUpdate } from "@/modules/survey/editor/types/survey-trigger"; +import { getActionClasses } from "@/modules/survey/lib/action-class"; +import { getOrganizationAIKeys, getOrganizationIdFromEnvironmentId } from "@/modules/survey/lib/organization"; +import { getSurvey, selectSurvey } from "@/modules/survey/lib/survey"; export const updateSurvey = async (updatedSurvey: TSurvey): Promise => { try { diff --git a/apps/web/modules/survey/editor/lib/team.test.ts b/apps/web/modules/survey/editor/lib/team.test.ts index 02d6ec8ee6..a05237215d 100644 --- a/apps/web/modules/survey/editor/lib/team.test.ts +++ b/apps/web/modules/survey/editor/lib/team.test.ts @@ -1,6 +1,6 @@ -import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; +import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; import { getTeamMemberDetails } from "./team"; // Mock prisma diff --git a/apps/web/modules/survey/editor/lib/team.ts b/apps/web/modules/survey/editor/lib/team.ts index baccbd2184..6f49012917 100644 --- a/apps/web/modules/survey/editor/lib/team.ts +++ b/apps/web/modules/survey/editor/lib/team.ts @@ -1,6 +1,6 @@ -import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; +import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; export const getTeamMemberDetails = reactCache(async (teamIds: string[]): Promise => { if (teamIds.length === 0) { diff --git a/apps/web/modules/survey/follow-ups/components/follow-up-action-multi-email-input.tsx b/apps/web/modules/survey/follow-ups/components/follow-up-action-multi-email-input.tsx index 7a7b125499..4f0e60ce06 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-up-action-multi-email-input.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-up-action-multi-email-input.tsx @@ -1,6 +1,6 @@ +import React, { useState } from "react"; import { isValidEmail } from "@/lib/utils/email"; import { cn } from "@/modules/ui/lib/utils"; -import React, { useState } from "react"; interface FollowUpActionMultiEmailInputProps { emails: string[]; diff --git a/apps/web/modules/survey/follow-ups/components/follow-up-email.test.tsx b/apps/web/modules/survey/follow-ups/components/follow-up-email.test.tsx index 30120f81bf..6364b9f7e7 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-up-email.test.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-up-email.test.tsx @@ -1,10 +1,10 @@ -import { getTranslate } from "@/tolgee/server"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { DefaultParamType, TFnType, TranslationKey } from "@tolgee/react/server"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getTranslate } from "@/tolgee/server"; import { FollowUpEmail } from "./follow-up-email"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/survey/follow-ups/components/follow-up-email.tsx b/apps/web/modules/survey/follow-ups/components/follow-up-email.tsx index bbee735da4..4a4ca39400 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-up-email.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-up-email.tsx @@ -1,7 +1,3 @@ -import { FB_LOGO_URL, IMPRINT_ADDRESS, IMPRINT_URL, PRIVACY_URL } from "@/lib/constants"; -import { getQuestionResponseMapping } from "@/lib/responses"; -import { renderEmailResponseValue } from "@/modules/email/emails/lib/utils"; -import { getTranslate } from "@/tolgee/server"; import { Body, Column, @@ -20,6 +16,10 @@ import React from "react"; import { TSurveyFollowUp } from "@formbricks/database/types/survey-follow-up"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { FB_LOGO_URL, IMPRINT_ADDRESS, IMPRINT_URL, PRIVACY_URL } from "@/lib/constants"; +import { getQuestionResponseMapping } from "@/lib/responses"; +import { renderEmailResponseValue } from "@/modules/email/emails/lib/utils"; +import { getTranslate } from "@/tolgee/server"; const fbLogoUrl = FB_LOGO_URL; const logoLink = "https://formbricks.com?utm_source=email_header&utm_medium=email"; diff --git a/apps/web/modules/survey/follow-ups/components/follow-up-item.tsx b/apps/web/modules/survey/follow-ups/components/follow-up-item.tsx index 6f8404dca0..6945e3b168 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-up-item.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-up-item.tsx @@ -1,11 +1,5 @@ "use client"; -import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; -import { FollowUpModal } from "@/modules/survey/follow-ups/components/follow-up-modal"; -import { Badge } from "@/modules/ui/components/badge"; -import { Button } from "@/modules/ui/components/button"; -import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { createId } from "@paralleldrive/cuid2"; import { useTranslate } from "@tolgee/react"; import { CopyIcon, Trash2Icon } from "lucide-react"; @@ -13,6 +7,12 @@ import { useCallback, useMemo, useState } from "react"; import { TSurveyFollowUp } from "@formbricks/database/types/survey-follow-up"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; +import { FollowUpModal } from "@/modules/survey/follow-ups/components/follow-up-modal"; +import { Badge } from "@/modules/ui/components/badge"; +import { Button } from "@/modules/ui/components/button"; +import { ConfirmationModal } from "@/modules/ui/components/confirmation-modal"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; interface FollowUpItemProps { followUp: TSurveyFollowUp; diff --git a/apps/web/modules/survey/follow-ups/components/follow-up-modal.test.tsx b/apps/web/modules/survey/follow-ups/components/follow-up-modal.test.tsx index d90d6949d8..f12493f3fa 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-up-modal.test.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-up-modal.test.tsx @@ -1,9 +1,9 @@ -import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; import { FollowUpModal } from "./follow-up-modal"; // Mock react-hook-form diff --git a/apps/web/modules/survey/follow-ups/components/follow-ups-view.tsx b/apps/web/modules/survey/follow-ups/components/follow-ups-view.tsx index 32a2f63545..5e433a6a71 100644 --- a/apps/web/modules/survey/follow-ups/components/follow-ups-view.tsx +++ b/apps/web/modules/survey/follow-ups/components/follow-ups-view.tsx @@ -1,15 +1,15 @@ "use client"; -import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; -import { FollowUpItem } from "@/modules/survey/follow-ups/components/follow-up-item"; -import { FollowUpModal } from "@/modules/survey/follow-ups/components/follow-up-modal"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { LockIcon, MailIcon } from "lucide-react"; import { useState } from "react"; import { TSurveyFollowUp } from "@formbricks/database/types/survey-follow-up"; import { TSurvey } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { TFollowUpEmailToUser } from "@/modules/survey/editor/types/survey-follow-up"; +import { FollowUpItem } from "@/modules/survey/follow-ups/components/follow-up-item"; +import { FollowUpModal } from "@/modules/survey/follow-ups/components/follow-up-modal"; +import { Button } from "@/modules/ui/components/button"; interface FollowUpsViewProps { localSurvey: TSurvey; diff --git a/apps/web/modules/survey/follow-ups/lib/email.ts b/apps/web/modules/survey/follow-ups/lib/email.ts index b179252df6..34253f15b8 100644 --- a/apps/web/modules/survey/follow-ups/lib/email.ts +++ b/apps/web/modules/survey/follow-ups/lib/email.ts @@ -1,9 +1,9 @@ -import { sendEmail } from "@/modules/email"; -import { FollowUpEmail } from "@/modules/survey/follow-ups/components/follow-up-email"; import { render } from "@react-email/components"; import { TSurveyFollowUp } from "@formbricks/database/types/survey-follow-up"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { sendEmail } from "@/modules/email"; +import { FollowUpEmail } from "@/modules/survey/follow-ups/components/follow-up-email"; export const sendFollowUpEmail = async ({ followUp, diff --git a/apps/web/modules/survey/follow-ups/lib/follow-ups.test.ts b/apps/web/modules/survey/follow-ups/lib/follow-ups.test.ts index 3f8ff7712b..7911a7d9d2 100644 --- a/apps/web/modules/survey/follow-ups/lib/follow-ups.test.ts +++ b/apps/web/modules/survey/follow-ups/lib/follow-ups.test.ts @@ -1,11 +1,11 @@ -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getResponse } from "@/lib/response/service"; -import { getSurvey } from "@/lib/survey/service"; -import { FollowUpSendError } from "@/modules/survey/follow-ups/types/follow-up"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganization } from "@formbricks/types/organizations"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getResponse } from "@/lib/response/service"; +import { getSurvey } from "@/lib/survey/service"; +import { FollowUpSendError } from "@/modules/survey/follow-ups/types/follow-up"; import { sendFollowUpEmail } from "./email"; import { sendFollowUpsForResponse } from "./follow-ups"; import { getSurveyFollowUpsPermission } from "./utils"; diff --git a/apps/web/modules/survey/follow-ups/lib/follow-ups.ts b/apps/web/modules/survey/follow-ups/lib/follow-ups.ts index bc83f7a82c..be4e403c75 100644 --- a/apps/web/modules/survey/follow-ups/lib/follow-ups.ts +++ b/apps/web/modules/survey/follow-ups/lib/follow-ups.ts @@ -1,12 +1,3 @@ -import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; -import { getResponse } from "@/lib/response/service"; -import { getSurvey } from "@/lib/survey/service"; -import { validateInputs } from "@/lib/utils/validate"; -import { applyRateLimit } from "@/modules/core/rate-limit/helpers"; -import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; -import { sendFollowUpEmail } from "@/modules/survey/follow-ups/lib/email"; -import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; -import { FollowUpResult, FollowUpSendError } from "@/modules/survey/follow-ups/types/follow-up"; import { z } from "zod"; import { TSurveyFollowUp } from "@formbricks/database/types/survey-follow-up"; import { logger } from "@formbricks/logger"; @@ -16,6 +7,15 @@ import { ValidationError } from "@formbricks/types/errors"; import { TOrganization } from "@formbricks/types/organizations"; import { TResponse } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; +import { getResponse } from "@/lib/response/service"; +import { getSurvey } from "@/lib/survey/service"; +import { validateInputs } from "@/lib/utils/validate"; +import { applyRateLimit } from "@/modules/core/rate-limit/helpers"; +import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; +import { sendFollowUpEmail } from "@/modules/survey/follow-ups/lib/email"; +import { getSurveyFollowUpsPermission } from "@/modules/survey/follow-ups/lib/utils"; +import { FollowUpResult, FollowUpSendError } from "@/modules/survey/follow-ups/types/follow-up"; const evaluateFollowUp = async ( followUp: TSurveyFollowUp, diff --git a/apps/web/modules/survey/follow-ups/lib/utils.test.ts b/apps/web/modules/survey/follow-ups/lib/utils.test.ts index 92179c65c2..f139b2ce82 100644 --- a/apps/web/modules/survey/follow-ups/lib/utils.test.ts +++ b/apps/web/modules/survey/follow-ups/lib/utils.test.ts @@ -1,6 +1,6 @@ -import * as constants from "@/lib/constants"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { TOrganizationBillingPlan } from "@formbricks/types/organizations"; +import * as constants from "@/lib/constants"; import { getSurveyFollowUpsPermission } from "./utils"; vi.mock("@/lib/constants", async () => { diff --git a/apps/web/modules/survey/follow-ups/lib/utils.ts b/apps/web/modules/survey/follow-ups/lib/utils.ts index 20c6dd7b4f..37d125ad7d 100644 --- a/apps/web/modules/survey/follow-ups/lib/utils.ts +++ b/apps/web/modules/survey/follow-ups/lib/utils.ts @@ -1,5 +1,5 @@ -import { IS_FORMBRICKS_CLOUD, PROJECT_FEATURE_KEYS } from "@/lib/constants"; import { Organization } from "@prisma/client"; +import { IS_FORMBRICKS_CLOUD, PROJECT_FEATURE_KEYS } from "@/lib/constants"; export const getSurveyFollowUpsPermission = async ( billingPlan: Organization["billing"]["plan"] diff --git a/apps/web/modules/survey/hooks/useSingleUseId.test.tsx b/apps/web/modules/survey/hooks/useSingleUseId.test.tsx index b06d365700..723a53f27f 100644 --- a/apps/web/modules/survey/hooks/useSingleUseId.test.tsx +++ b/apps/web/modules/survey/hooks/useSingleUseId.test.tsx @@ -1,9 +1,9 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { generateSingleUseIdsAction } from "@/modules/survey/list/actions"; import { act, renderHook, waitFor } from "@testing-library/react"; import toast from "react-hot-toast"; import { describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { generateSingleUseIdsAction } from "@/modules/survey/list/actions"; import { useSingleUseId } from "./useSingleUseId"; // Mock external functions diff --git a/apps/web/modules/survey/hooks/useSingleUseId.tsx b/apps/web/modules/survey/hooks/useSingleUseId.tsx index 650cea158e..979cf35140 100644 --- a/apps/web/modules/survey/hooks/useSingleUseId.tsx +++ b/apps/web/modules/survey/hooks/useSingleUseId.tsx @@ -1,9 +1,9 @@ -import { getFormattedErrorMessage } from "@/lib/utils/helper"; -import { generateSingleUseIdsAction } from "@/modules/survey/list/actions"; -import type { TSurvey as TSurveyList } from "@/modules/survey/list/types/surveys"; import { useCallback, useEffect, useState } from "react"; import toast from "react-hot-toast"; import type { TSurvey } from "@formbricks/types/surveys/types"; +import { getFormattedErrorMessage } from "@/lib/utils/helper"; +import { generateSingleUseIdsAction } from "@/modules/survey/list/actions"; +import type { TSurvey as TSurveyList } from "@/modules/survey/list/types/surveys"; export const useSingleUseId = (survey: TSurvey | TSurveyList, isReadOnly: boolean) => { const [singleUseId, setSingleUseId] = useState(); diff --git a/apps/web/modules/survey/lib/action-class.test.ts b/apps/web/modules/survey/lib/action-class.test.ts index 982ffda6d0..36ee3ffc9d 100644 --- a/apps/web/modules/survey/lib/action-class.test.ts +++ b/apps/web/modules/survey/lib/action-class.test.ts @@ -1,8 +1,8 @@ -import { validateInputs } from "@/lib/utils/validate"; import { type ActionClass } from "@prisma/client"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, ValidationError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { getActionClasses } from "./action-class"; vi.mock("@/lib/utils/validate"); diff --git a/apps/web/modules/survey/lib/action-class.ts b/apps/web/modules/survey/lib/action-class.ts index 5e7e8bd29f..b18568aa8b 100644 --- a/apps/web/modules/survey/lib/action-class.ts +++ b/apps/web/modules/survey/lib/action-class.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { ActionClass } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const getActionClasses = reactCache(async (environmentId: string): Promise => { validateInputs([environmentId, z.string().cuid2()]); diff --git a/apps/web/modules/survey/lib/survey.ts b/apps/web/modules/survey/lib/survey.ts index 486e87ad89..1a8e214ee7 100644 --- a/apps/web/modules/survey/lib/survey.ts +++ b/apps/web/modules/survey/lib/survey.ts @@ -1,9 +1,9 @@ -import { transformPrismaSurvey } from "@/modules/survey/lib/utils"; import { Organization, Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { transformPrismaSurvey } from "@/modules/survey/lib/utils"; export const selectSurvey = { id: true, diff --git a/apps/web/modules/survey/link/actions.ts b/apps/web/modules/survey/link/actions.ts index ca321b2e65..78cab4814c 100644 --- a/apps/web/modules/survey/link/actions.ts +++ b/apps/web/modules/survey/link/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ZLinkSurveyEmailData } from "@formbricks/types/email"; +import { InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; import { actionClient } from "@/lib/utils/action-client"; import { getOrganizationIdFromSurveyId } from "@/lib/utils/helper"; import { applyIPRateLimit } from "@/modules/core/rate-limit/helpers"; @@ -7,9 +10,6 @@ import { rateLimitConfigs } from "@/modules/core/rate-limit/rate-limit-configs"; import { getOrganizationLogoUrl } from "@/modules/ee/whitelabel/email-customization/lib/organization"; import { sendLinkSurveyToVerifiedEmail } from "@/modules/email"; import { getSurveyWithMetadata, isSurveyResponsePresent } from "@/modules/survey/link/lib/data"; -import { z } from "zod"; -import { ZLinkSurveyEmailData } from "@formbricks/types/email"; -import { InvalidInputError, ResourceNotFoundError } from "@formbricks/types/errors"; export const sendLinkSurveyEmailAction = actionClient .schema(ZLinkSurveyEmailData) diff --git a/apps/web/modules/survey/link/components/link-survey-wrapper.tsx b/apps/web/modules/survey/link/components/link-survey-wrapper.tsx index 99a6d38477..72fcd79afa 100644 --- a/apps/web/modules/survey/link/components/link-survey-wrapper.tsx +++ b/apps/web/modules/survey/link/components/link-survey-wrapper.tsx @@ -1,13 +1,13 @@ +import { Project, SurveyType } from "@prisma/client"; +import { type JSX, useState } from "react"; +import { TProjectStyling } from "@formbricks/types/project"; +import { TSurveyStyling } from "@formbricks/types/surveys/types"; import { cn } from "@/lib/cn"; import { LegalFooter } from "@/modules/survey/link/components/legal-footer"; import { SurveyLoadingAnimation } from "@/modules/survey/link/components/survey-loading-animation"; import { ClientLogo } from "@/modules/ui/components/client-logo"; import { MediaBackground } from "@/modules/ui/components/media-background"; import { ResetProgressButton } from "@/modules/ui/components/reset-progress-button"; -import { Project, SurveyType } from "@prisma/client"; -import { type JSX, useState } from "react"; -import { TProjectStyling } from "@formbricks/types/project"; -import { TSurveyStyling } from "@formbricks/types/surveys/types"; interface LinkSurveyWrapperProps { children: JSX.Element; diff --git a/apps/web/modules/survey/link/components/link-survey.test.tsx b/apps/web/modules/survey/link/components/link-survey.test.tsx index 33f94cf6f8..5e8c0ec1cb 100644 --- a/apps/web/modules/survey/link/components/link-survey.test.tsx +++ b/apps/web/modules/survey/link/components/link-survey.test.tsx @@ -1,10 +1,10 @@ -import * as utils from "@/modules/survey/link/lib/utils"; import { render, screen, waitFor } from "@testing-library/react"; import * as navigation from "next/navigation"; import React from "react"; import { beforeEach, describe, expect, test, vi } from "vitest"; import type { TResponseData } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; +import * as utils from "@/modules/survey/link/lib/utils"; import { LinkSurvey } from "./link-survey"; // Allow tests to control search params via a module-level variable. diff --git a/apps/web/modules/survey/link/components/link-survey.tsx b/apps/web/modules/survey/link/components/link-survey.tsx index e6c128858d..3a54a70d7b 100644 --- a/apps/web/modules/survey/link/components/link-survey.tsx +++ b/apps/web/modules/survey/link/components/link-survey.tsx @@ -1,15 +1,15 @@ "use client"; -import { LinkSurveyWrapper } from "@/modules/survey/link/components/link-survey-wrapper"; -import { SurveyLinkUsed } from "@/modules/survey/link/components/survey-link-used"; -import { VerifyEmail } from "@/modules/survey/link/components/verify-email"; -import { getPrefillValue } from "@/modules/survey/link/lib/utils"; -import { SurveyInline } from "@/modules/ui/components/survey"; import { Project, Response } from "@prisma/client"; import { useSearchParams } from "next/navigation"; import { useEffect, useMemo, useState } from "react"; import { TResponseData, TResponseHiddenFieldValue } from "@formbricks/types/responses"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { LinkSurveyWrapper } from "@/modules/survey/link/components/link-survey-wrapper"; +import { SurveyLinkUsed } from "@/modules/survey/link/components/survey-link-used"; +import { VerifyEmail } from "@/modules/survey/link/components/verify-email"; +import { getPrefillValue } from "@/modules/survey/link/lib/utils"; +import { SurveyInline } from "@/modules/ui/components/survey"; let setQuestionId = (_: string) => {}; let setResponseData = (_: TResponseData) => {}; diff --git a/apps/web/modules/survey/link/components/pin-screen.test.tsx b/apps/web/modules/survey/link/components/pin-screen.test.tsx index 5f3b21cba4..d5e5ccf78b 100644 --- a/apps/web/modules/survey/link/components/pin-screen.test.tsx +++ b/apps/web/modules/survey/link/components/pin-screen.test.tsx @@ -1,9 +1,9 @@ -import { validateSurveyPinAction } from "@/modules/survey/link/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { validateSurveyPinAction } from "@/modules/survey/link/actions"; import { PinScreen } from "./pin-screen"; vi.mock("@/modules/survey/link/actions", () => ({ diff --git a/apps/web/modules/survey/link/components/pin-screen.tsx b/apps/web/modules/survey/link/components/pin-screen.tsx index 2d04a42dd3..ecfacf79b9 100644 --- a/apps/web/modules/survey/link/components/pin-screen.tsx +++ b/apps/web/modules/survey/link/components/pin-screen.tsx @@ -1,14 +1,14 @@ "use client"; +import { Project, Response } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { useCallback, useEffect, useState } from "react"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { cn } from "@/lib/cn"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { validateSurveyPinAction } from "@/modules/survey/link/actions"; import { LinkSurvey } from "@/modules/survey/link/components/link-survey"; import { OTPInput } from "@/modules/ui/components/otp-input"; -import { Project, Response } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { useCallback, useEffect, useState } from "react"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface PinScreenProps { surveyId: string; diff --git a/apps/web/modules/survey/link/components/survey-inactive.tsx b/apps/web/modules/survey/link/components/survey-inactive.tsx index 695e1eedaa..d9651c578c 100644 --- a/apps/web/modules/survey/link/components/survey-inactive.tsx +++ b/apps/web/modules/survey/link/components/survey-inactive.tsx @@ -1,10 +1,10 @@ -import { Button } from "@/modules/ui/components/button"; -import { getTranslate } from "@/tolgee/server"; import { Project } from "@prisma/client"; import { CalendarClockIcon, CheckCircle2Icon, HelpCircleIcon, PauseCircleIcon } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { TSurveyClosedMessage } from "@formbricks/types/surveys/types"; +import { Button } from "@/modules/ui/components/button"; +import { getTranslate } from "@/tolgee/server"; import footerLogo from "../lib/footerlogo.svg"; export const SurveyInactive = async ({ diff --git a/apps/web/modules/survey/link/components/survey-loading-animation.tsx b/apps/web/modules/survey/link/components/survey-loading-animation.tsx index 6e3cf70e40..fc1fdef18f 100644 --- a/apps/web/modules/survey/link/components/survey-loading-animation.tsx +++ b/apps/web/modules/survey/link/components/survey-loading-animation.tsx @@ -1,8 +1,8 @@ +import Image from "next/image"; +import { useCallback, useEffect, useState } from "react"; import Logo from "@/images/powered-by-formbricks.svg"; import { cn } from "@/lib/cn"; import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; -import Image from "next/image"; -import { useCallback, useEffect, useState } from "react"; interface SurveyLoadingAnimationProps { isWelcomeCardEnabled: boolean; diff --git a/apps/web/modules/survey/link/components/survey-renderer.test.tsx b/apps/web/modules/survey/link/components/survey-renderer.test.tsx index 9cf4a4d87b..5239bb0276 100644 --- a/apps/web/modules/survey/link/components/survey-renderer.test.tsx +++ b/apps/web/modules/survey/link/components/survey-renderer.test.tsx @@ -1,7 +1,3 @@ -import { getResponseCountBySurveyId } from "@/modules/survey/lib/response"; -import { getOrganizationBilling } from "@/modules/survey/lib/survey"; -import { getEmailVerificationDetails } from "@/modules/survey/link/lib/helper"; -import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project"; import { Organization } from "@prisma/client"; import "@testing-library/jest-dom/vitest"; import { cleanup } from "@testing-library/react"; @@ -9,6 +5,10 @@ import { notFound } from "next/navigation"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TLanguage } from "@formbricks/types/project"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getResponseCountBySurveyId } from "@/modules/survey/lib/response"; +import { getOrganizationBilling } from "@/modules/survey/lib/survey"; +import { getEmailVerificationDetails } from "@/modules/survey/link/lib/helper"; +import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project"; import { renderSurvey } from "./survey-renderer"; // Mock dependencies diff --git a/apps/web/modules/survey/link/components/verify-email.test.tsx b/apps/web/modules/survey/link/components/verify-email.test.tsx index 19988b89c5..c1fa1326f7 100644 --- a/apps/web/modules/survey/link/components/verify-email.test.tsx +++ b/apps/web/modules/survey/link/components/verify-email.test.tsx @@ -1,9 +1,9 @@ -import { isSurveyResponsePresentAction, sendLinkSurveyEmailAction } from "@/modules/survey/link/actions"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import type { TSurvey } from "@formbricks/types/surveys/types"; +import { isSurveyResponsePresentAction, sendLinkSurveyEmailAction } from "@/modules/survey/link/actions"; import { VerifyEmail } from "./verify-email"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/survey/link/contact-survey/page.test.tsx b/apps/web/modules/survey/link/contact-survey/page.test.tsx index c6cec23bc1..17e6fcf03a 100644 --- a/apps/web/modules/survey/link/contact-survey/page.test.tsx +++ b/apps/web/modules/survey/link/contact-survey/page.test.tsx @@ -1,11 +1,11 @@ +import "@testing-library/jest-dom/vitest"; +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, describe, expect, test, vi } from "vitest"; import { verifyContactSurveyToken } from "@/modules/ee/contacts/lib/contact-survey-link"; import { getSurvey } from "@/modules/survey/lib/survey"; import { renderSurvey } from "@/modules/survey/link/components/survey-renderer"; import { getExistingContactResponse } from "@/modules/survey/link/lib/data"; import { getBasicSurveyMetadata } from "@/modules/survey/link/lib/metadata-utils"; -import "@testing-library/jest-dom/vitest"; -import { cleanup, render, screen } from "@testing-library/react"; -import { afterEach, describe, expect, test, vi } from "vitest"; import { ContactSurveyPage, generateMetadata } from "./page"; vi.mock("@/lib/constants", () => ({ diff --git a/apps/web/modules/survey/link/contact-survey/page.tsx b/apps/web/modules/survey/link/contact-survey/page.tsx index ec86d6a77a..f17da4e4ca 100644 --- a/apps/web/modules/survey/link/contact-survey/page.tsx +++ b/apps/web/modules/survey/link/contact-survey/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; +import { notFound } from "next/navigation"; import { verifyContactSurveyToken } from "@/modules/ee/contacts/lib/contact-survey-link"; import { getSurvey } from "@/modules/survey/lib/survey"; import { SurveyInactive } from "@/modules/survey/link/components/survey-inactive"; @@ -7,8 +9,6 @@ import { checkAndValidateSingleUseId } from "@/modules/survey/link/lib/helper"; import { getBasicSurveyMetadata } from "@/modules/survey/link/lib/metadata-utils"; import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project"; import { getTranslate } from "@/tolgee/server"; -import type { Metadata } from "next"; -import { notFound } from "next/navigation"; interface ContactSurveyPageProps { params: Promise<{ diff --git a/apps/web/modules/survey/link/lib/data.ts b/apps/web/modules/survey/link/lib/data.ts index d370669c0f..31f1e7c332 100644 --- a/apps/web/modules/survey/link/lib/data.ts +++ b/apps/web/modules/survey/link/lib/data.ts @@ -1,12 +1,12 @@ import "server-only"; -import { cache } from "@/lib/cache"; -import { transformPrismaSurvey } from "@/modules/survey/lib/utils"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { createCacheKey } from "@formbricks/cache"; import { prisma } from "@formbricks/database"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { cache } from "@/lib/cache"; +import { transformPrismaSurvey } from "@/modules/survey/lib/utils"; /** * Comprehensive survey data fetcher for link surveys diff --git a/apps/web/modules/survey/link/lib/helper.test.ts b/apps/web/modules/survey/link/lib/helper.test.ts index 2f69b2ea94..8c8ce51e6c 100644 --- a/apps/web/modules/survey/link/lib/helper.test.ts +++ b/apps/web/modules/survey/link/lib/helper.test.ts @@ -1,6 +1,6 @@ +import { beforeEach, describe, expect, test, vi } from "vitest"; import { validateSurveySingleUseId } from "@/app/lib/singleUseSurveys"; import { verifyTokenForLinkSurvey } from "@/lib/jwt"; -import { beforeEach, describe, expect, test, vi } from "vitest"; import { checkAndValidateSingleUseId, getEmailVerificationDetails } from "./helper"; vi.mock("@/lib/jwt", () => ({ diff --git a/apps/web/modules/survey/link/lib/metadata-utils.test.ts b/apps/web/modules/survey/link/lib/metadata-utils.test.ts index c22511d51e..b4b041b895 100644 --- a/apps/web/modules/survey/link/lib/metadata-utils.test.ts +++ b/apps/web/modules/survey/link/lib/metadata-utils.test.ts @@ -1,9 +1,9 @@ +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { TSurvey, TSurveyWelcomeCard } from "@formbricks/types/surveys/types"; import { getPublicDomain } from "@/lib/getPublicUrl"; import { COLOR_DEFAULTS } from "@/lib/styling/constants"; import { getSurvey } from "@/modules/survey/lib/survey"; import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project"; -import { beforeEach, describe, expect, test, vi } from "vitest"; -import { TSurvey, TSurveyWelcomeCard } from "@formbricks/types/surveys/types"; import { getBasicSurveyMetadata, getBrandColorForURL, diff --git a/apps/web/modules/survey/link/lib/metadata-utils.ts b/apps/web/modules/survey/link/lib/metadata-utils.ts index 8d155c1b79..c1eed2f111 100644 --- a/apps/web/modules/survey/link/lib/metadata-utils.ts +++ b/apps/web/modules/survey/link/lib/metadata-utils.ts @@ -1,9 +1,9 @@ +import { Metadata } from "next"; import { IS_FORMBRICKS_CLOUD } from "@/lib/constants"; import { getPublicDomain } from "@/lib/getPublicUrl"; import { getLocalizedValue } from "@/lib/i18n/utils"; import { COLOR_DEFAULTS } from "@/lib/styling/constants"; import { getSurvey } from "@/modules/survey/lib/survey"; -import { Metadata } from "next"; type TBasicSurveyMetadata = { title: string; diff --git a/apps/web/modules/survey/link/lib/project.test.ts b/apps/web/modules/survey/link/lib/project.test.ts index 2220c70b4a..f87c2c29bb 100644 --- a/apps/web/modules/survey/link/lib/project.test.ts +++ b/apps/web/modules/survey/link/lib/project.test.ts @@ -1,9 +1,9 @@ -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import "@testing-library/jest-dom/vitest"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { getProjectByEnvironmentId } from "./project"; vi.mock("@/lib/utils/validate", () => ({ diff --git a/apps/web/modules/survey/link/lib/project.ts b/apps/web/modules/survey/link/lib/project.ts index baee5af7ef..16597a7aac 100644 --- a/apps/web/modules/survey/link/lib/project.ts +++ b/apps/web/modules/survey/link/lib/project.ts @@ -1,11 +1,11 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Prisma, Project } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { ZId } from "@formbricks/types/common"; import { DatabaseError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const getProjectByEnvironmentId = reactCache( async ( diff --git a/apps/web/modules/survey/link/metadata.test.ts b/apps/web/modules/survey/link/metadata.test.ts index 00ff1385cd..250cd99fd3 100644 --- a/apps/web/modules/survey/link/metadata.test.ts +++ b/apps/web/modules/survey/link/metadata.test.ts @@ -1,6 +1,6 @@ -import { getSurveyMetadata } from "@/modules/survey/link/lib/data"; import { notFound } from "next/navigation"; import { beforeEach, describe, expect, test, vi } from "vitest"; +import { getSurveyMetadata } from "@/modules/survey/link/lib/data"; import { getBasicSurveyMetadata, getSurveyOpenGraphMetadata } from "./lib/metadata-utils"; import { getMetadataForLinkSurvey } from "./metadata"; diff --git a/apps/web/modules/survey/link/metadata.ts b/apps/web/modules/survey/link/metadata.ts index bed68ac462..e56abacbbe 100644 --- a/apps/web/modules/survey/link/metadata.ts +++ b/apps/web/modules/survey/link/metadata.ts @@ -1,6 +1,6 @@ -import { getSurveyMetadata } from "@/modules/survey/link/lib/data"; import { Metadata } from "next"; import { notFound } from "next/navigation"; +import { getSurveyMetadata } from "@/modules/survey/link/lib/data"; import { getBasicSurveyMetadata, getSurveyOpenGraphMetadata } from "./lib/metadata-utils"; export const getMetadataForLinkSurvey = async ( diff --git a/apps/web/modules/survey/link/page.test.tsx b/apps/web/modules/survey/link/page.test.tsx index f53379c6cf..868e20fd66 100644 --- a/apps/web/modules/survey/link/page.test.tsx +++ b/apps/web/modules/survey/link/page.test.tsx @@ -1,3 +1,9 @@ +import "@testing-library/jest-dom/vitest"; +import { cleanup, render } from "@testing-library/react"; +import { notFound } from "next/navigation"; +import { afterEach, describe, expect, test, vi } from "vitest"; +import { logger } from "@formbricks/logger"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { validateSurveySingleUseId } from "@/app/lib/singleUseSurveys"; import { getSurvey } from "@/modules/survey/lib/survey"; import { SurveyInactive } from "@/modules/survey/link/components/survey-inactive"; @@ -5,12 +11,6 @@ import { renderSurvey } from "@/modules/survey/link/components/survey-renderer"; import { getResponseBySingleUseId, getSurveyWithMetadata } from "@/modules/survey/link/lib/data"; import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project"; import { getMetadataForLinkSurvey } from "@/modules/survey/link/metadata"; -import "@testing-library/jest-dom/vitest"; -import { cleanup, render } from "@testing-library/react"; -import { notFound } from "next/navigation"; -import { afterEach, describe, expect, test, vi } from "vitest"; -import { logger } from "@formbricks/logger"; -import { TSurvey } from "@formbricks/types/surveys/types"; import { LinkSurveyPage, generateMetadata } from "./page"; // Mock server-side constants to prevent client-side access diff --git a/apps/web/modules/survey/link/page.tsx b/apps/web/modules/survey/link/page.tsx index 53a58f649d..f476042e35 100644 --- a/apps/web/modules/survey/link/page.tsx +++ b/apps/web/modules/survey/link/page.tsx @@ -1,14 +1,14 @@ +import type { Metadata } from "next"; +import { notFound } from "next/navigation"; +import { logger } from "@formbricks/logger"; +import { ZId } from "@formbricks/types/common"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { SurveyInactive } from "@/modules/survey/link/components/survey-inactive"; import { renderSurvey } from "@/modules/survey/link/components/survey-renderer"; import { getResponseBySingleUseId, getSurveyWithMetadata } from "@/modules/survey/link/lib/data"; import { checkAndValidateSingleUseId } from "@/modules/survey/link/lib/helper"; import { getProjectByEnvironmentId } from "@/modules/survey/link/lib/project"; import { getMetadataForLinkSurvey } from "@/modules/survey/link/metadata"; -import type { Metadata } from "next"; -import { notFound } from "next/navigation"; -import { logger } from "@formbricks/logger"; -import { ZId } from "@formbricks/types/common"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface LinkSurveyPageProps { params: Promise<{ diff --git a/apps/web/modules/survey/list/actions.ts b/apps/web/modules/survey/list/actions.ts index 70876fe58b..74eddd7370 100644 --- a/apps/web/modules/survey/list/actions.ts +++ b/apps/web/modules/survey/list/actions.ts @@ -1,5 +1,8 @@ "use server"; +import { z } from "zod"; +import { ResourceNotFoundError } from "@formbricks/types/errors"; +import { ZSurveyFilterCriteria } from "@formbricks/types/surveys/types"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; import { AuthenticatedActionClientCtx } from "@/lib/utils/action-client/types/context"; @@ -19,9 +22,6 @@ import { getSurvey, getSurveys, } from "@/modules/survey/list/lib/survey"; -import { z } from "zod"; -import { ResourceNotFoundError } from "@formbricks/types/errors"; -import { ZSurveyFilterCriteria } from "@formbricks/types/surveys/types"; const ZGetSurveyAction = z.object({ surveyId: z.string().cuid2(), diff --git a/apps/web/modules/survey/list/components/copy-survey-form.test.tsx b/apps/web/modules/survey/list/components/copy-survey-form.test.tsx index 142a786f9c..7dffe4403c 100644 --- a/apps/web/modules/survey/list/components/copy-survey-form.test.tsx +++ b/apps/web/modules/survey/list/components/copy-survey-form.test.tsx @@ -1,9 +1,9 @@ -import { copySurveyToOtherEnvironmentAction } from "@/modules/survey/list/actions"; -import { TUserProject } from "@/modules/survey/list/types/projects"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { copySurveyToOtherEnvironmentAction } from "@/modules/survey/list/actions"; +import { TUserProject } from "@/modules/survey/list/types/projects"; import { CopySurveyForm } from "./copy-survey-form"; // Mock dependencies diff --git a/apps/web/modules/survey/list/components/copy-survey-form.tsx b/apps/web/modules/survey/list/components/copy-survey-form.tsx index 4e8de38e43..58c84ae925 100644 --- a/apps/web/modules/survey/list/components/copy-survey-form.tsx +++ b/apps/web/modules/survey/list/components/copy-survey-form.tsx @@ -1,5 +1,10 @@ "use client"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { useTranslate } from "@tolgee/react"; +import { AlertCircleIcon } from "lucide-react"; +import { useFieldArray, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { copySurveyToOtherEnvironmentAction } from "@/modules/survey/list/actions"; import { TUserProject } from "@/modules/survey/list/types/projects"; @@ -8,11 +13,6 @@ import { Button } from "@/modules/ui/components/button"; import { Checkbox } from "@/modules/ui/components/checkbox"; import { FormControl, FormField, FormItem, FormProvider } from "@/modules/ui/components/form"; import { Label } from "@/modules/ui/components/label"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useTranslate } from "@tolgee/react"; -import { AlertCircleIcon } from "lucide-react"; -import { useFieldArray, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; interface CopySurveyFormProps { readonly defaultProjects: TUserProject[]; diff --git a/apps/web/modules/survey/list/components/copy-survey-modal.test.tsx b/apps/web/modules/survey/list/components/copy-survey-modal.test.tsx index e2f6ebdc51..fd818aabea 100644 --- a/apps/web/modules/survey/list/components/copy-survey-modal.test.tsx +++ b/apps/web/modules/survey/list/components/copy-survey-modal.test.tsx @@ -1,7 +1,7 @@ -import { TSurvey } from "@/modules/survey/list/types/surveys"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { TSurvey } from "@/modules/survey/list/types/surveys"; import { CopySurveyModal } from "./copy-survey-modal"; // Mock dependencies diff --git a/apps/web/modules/survey/list/components/copy-survey-modal.tsx b/apps/web/modules/survey/list/components/copy-survey-modal.tsx index d2450fb59e..ee23b3547c 100644 --- a/apps/web/modules/survey/list/components/copy-survey-modal.tsx +++ b/apps/web/modules/survey/list/components/copy-survey-modal.tsx @@ -1,5 +1,7 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { MousePointerClickIcon } from "lucide-react"; import { TSurvey } from "@/modules/survey/list/types/surveys"; import { Dialog, @@ -9,8 +11,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { MousePointerClickIcon } from "lucide-react"; import SurveyCopyOptions from "./survey-copy-options"; interface CopySurveyModalProps { diff --git a/apps/web/modules/survey/list/components/sort-option.tsx b/apps/web/modules/survey/list/components/sort-option.tsx index d091147c3f..e6fb896e76 100644 --- a/apps/web/modules/survey/list/components/sort-option.tsx +++ b/apps/web/modules/survey/list/components/sort-option.tsx @@ -1,7 +1,7 @@ "use client"; -import { DropdownMenuItem } from "@/modules/ui/components/dropdown-menu"; import { TSortOption, TSurveyFilters } from "@formbricks/types/surveys/types"; +import { DropdownMenuItem } from "@/modules/ui/components/dropdown-menu"; interface SortOptionProps { option: TSortOption; diff --git a/apps/web/modules/survey/list/components/survey-card.test.tsx b/apps/web/modules/survey/list/components/survey-card.test.tsx index ef33957b3c..0623f800ad 100644 --- a/apps/web/modules/survey/list/components/survey-card.test.tsx +++ b/apps/web/modules/survey/list/components/survey-card.test.tsx @@ -1,6 +1,6 @@ -import { TSurvey } from "@/modules/survey/list/types/surveys"; import { cleanup, render, screen } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { TSurvey } from "@/modules/survey/list/types/surveys"; import { SurveyCard } from "./survey-card"; // Mock constants diff --git a/apps/web/modules/survey/list/components/survey-card.tsx b/apps/web/modules/survey/list/components/survey-card.tsx index 77171feacb..4dfa5ef830 100644 --- a/apps/web/modules/survey/list/components/survey-card.tsx +++ b/apps/web/modules/survey/list/components/survey-card.tsx @@ -1,15 +1,15 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import Link from "next/link"; +import { useMemo } from "react"; +import { TUserLocale } from "@formbricks/types/user"; import { cn } from "@/lib/cn"; import { convertDateString, timeSince } from "@/lib/time"; import { useSingleUseId } from "@/modules/survey/hooks/useSingleUseId"; import { SurveyTypeIndicator } from "@/modules/survey/list/components/survey-type-indicator"; import { TSurvey } from "@/modules/survey/list/types/surveys"; import { SurveyStatusIndicator } from "@/modules/ui/components/survey-status-indicator"; -import { useTranslate } from "@tolgee/react"; -import Link from "next/link"; -import { useMemo } from "react"; -import { TUserLocale } from "@formbricks/types/user"; import { SurveyDropDownMenu } from "./survey-dropdown-menu"; interface SurveyCardProps { diff --git a/apps/web/modules/survey/list/components/survey-copy-options.test.tsx b/apps/web/modules/survey/list/components/survey-copy-options.test.tsx index c23d03db2f..2da0158cb8 100644 --- a/apps/web/modules/survey/list/components/survey-copy-options.test.tsx +++ b/apps/web/modules/survey/list/components/survey-copy-options.test.tsx @@ -1,10 +1,10 @@ +import { cleanup, render, screen, waitFor } from "@testing-library/react"; +import toast from "react-hot-toast"; +import { afterEach, describe, expect, test, vi } from "vitest"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { getProjectsByEnvironmentIdAction } from "@/modules/survey/list/actions"; import { TUserProject } from "@/modules/survey/list/types/projects"; import { TSurvey } from "@/modules/survey/list/types/surveys"; -import { cleanup, render, screen, waitFor } from "@testing-library/react"; -import toast from "react-hot-toast"; -import { afterEach, describe, expect, test, vi } from "vitest"; import SurveyCopyOptions from "./survey-copy-options"; // Mock dependencies diff --git a/apps/web/modules/survey/list/components/survey-copy-options.tsx b/apps/web/modules/survey/list/components/survey-copy-options.tsx index bba5c042c9..bd6399aee8 100644 --- a/apps/web/modules/survey/list/components/survey-copy-options.tsx +++ b/apps/web/modules/survey/list/components/survey-copy-options.tsx @@ -1,12 +1,12 @@ "use client"; +import { Loader2 } from "lucide-react"; +import { useEffect, useState } from "react"; +import toast from "react-hot-toast"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { getProjectsByEnvironmentIdAction } from "@/modules/survey/list/actions"; import { TUserProject } from "@/modules/survey/list/types/projects"; import { TSurvey } from "@/modules/survey/list/types/surveys"; -import { Loader2 } from "lucide-react"; -import { useEffect, useState } from "react"; -import toast from "react-hot-toast"; import { CopySurveyForm } from "./copy-survey-form"; interface SurveyCopyOptionsProps { diff --git a/apps/web/modules/survey/list/components/survey-dropdown-menu.test.tsx b/apps/web/modules/survey/list/components/survey-dropdown-menu.test.tsx index a62635450a..734be64a5b 100644 --- a/apps/web/modules/survey/list/components/survey-dropdown-menu.test.tsx +++ b/apps/web/modules/survey/list/components/survey-dropdown-menu.test.tsx @@ -1,10 +1,10 @@ // Import the actions to access mocked functions -import { deleteSurveyAction } from "@/modules/survey/list/actions"; -import { TSurvey } from "@/modules/survey/list/types/surveys"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import { userEvent } from "@testing-library/user-event"; import toast from "react-hot-toast"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { deleteSurveyAction } from "@/modules/survey/list/actions"; +import { TSurvey } from "@/modules/survey/list/types/surveys"; import { SurveyDropDownMenu } from "./survey-dropdown-menu"; // Cast to mocked functions diff --git a/apps/web/modules/survey/list/components/survey-dropdown-menu.tsx b/apps/web/modules/survey/list/components/survey-dropdown-menu.tsx index 3512499dbc..4321951aad 100644 --- a/apps/web/modules/survey/list/components/survey-dropdown-menu.tsx +++ b/apps/web/modules/survey/list/components/survey-dropdown-menu.tsx @@ -1,5 +1,20 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { + ArrowUpFromLineIcon, + CopyIcon, + EyeIcon, + LinkIcon, + MoreVertical, + SquarePenIcon, + TrashIcon, +} from "lucide-react"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; +import { useEffect, useMemo, useState } from "react"; +import toast from "react-hot-toast"; +import { logger } from "@formbricks/logger"; import { cn } from "@/lib/cn"; import { getFormattedErrorMessage } from "@/lib/utils/helper"; import { EditPublicSurveyAlertDialog } from "@/modules/survey/components/edit-public-survey-alert-dialog"; @@ -18,21 +33,6 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; -import { useTranslate } from "@tolgee/react"; -import { - ArrowUpFromLineIcon, - CopyIcon, - EyeIcon, - LinkIcon, - MoreVertical, - SquarePenIcon, - TrashIcon, -} from "lucide-react"; -import Link from "next/link"; -import { useRouter } from "next/navigation"; -import { useEffect, useMemo, useState } from "react"; -import toast from "react-hot-toast"; -import { logger } from "@formbricks/logger"; import { CopySurveyModal } from "./copy-survey-modal"; interface SurveyDropDownMenuProps { diff --git a/apps/web/modules/survey/list/components/survey-filter-dropdown.tsx b/apps/web/modules/survey/list/components/survey-filter-dropdown.tsx index 63bdb6cc94..ffbb263bfd 100644 --- a/apps/web/modules/survey/list/components/survey-filter-dropdown.tsx +++ b/apps/web/modules/survey/list/components/survey-filter-dropdown.tsx @@ -1,5 +1,7 @@ "use client"; +import { ChevronDownIcon } from "lucide-react"; +import { TFilterOption } from "@formbricks/types/surveys/types"; import { Checkbox } from "@/modules/ui/components/checkbox"; import { DropdownMenu, @@ -7,8 +9,6 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; -import { ChevronDownIcon } from "lucide-react"; -import { TFilterOption } from "@formbricks/types/surveys/types"; interface SurveyFilterDropdownProps { title: string; diff --git a/apps/web/modules/survey/list/components/survey-filters.tsx b/apps/web/modules/survey/list/components/survey-filters.tsx index 94f7f2f46b..d8862daa9c 100644 --- a/apps/web/modules/survey/list/components/survey-filters.tsx +++ b/apps/web/modules/survey/list/components/survey-filters.tsx @@ -1,5 +1,11 @@ "use client"; +import { TFnType, useTranslate } from "@tolgee/react"; +import { ChevronDownIcon, X } from "lucide-react"; +import { useState } from "react"; +import { useDebounce } from "react-use"; +import { TProjectConfigChannel } from "@formbricks/types/project"; +import { TFilterOption, TSortOption, TSurveyFilters } from "@formbricks/types/surveys/types"; import { SortOption } from "@/modules/survey/list/components/sort-option"; import { initialFilters } from "@/modules/survey/list/components/survey-list"; import { Button } from "@/modules/ui/components/button"; @@ -9,12 +15,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { SearchBar } from "@/modules/ui/components/search-bar"; -import { TFnType, useTranslate } from "@tolgee/react"; -import { ChevronDownIcon, X } from "lucide-react"; -import { useState } from "react"; -import { useDebounce } from "react-use"; -import { TProjectConfigChannel } from "@formbricks/types/project"; -import { TFilterOption, TSortOption, TSurveyFilters } from "@formbricks/types/surveys/types"; import { SurveyFilterDropdown } from "./survey-filter-dropdown"; interface SurveyFilterProps { diff --git a/apps/web/modules/survey/list/components/survey-list.test.tsx b/apps/web/modules/survey/list/components/survey-list.test.tsx index aa9307070d..40b7febc35 100644 --- a/apps/web/modules/survey/list/components/survey-list.test.tsx +++ b/apps/web/modules/survey/list/components/survey-list.test.tsx @@ -1,7 +1,3 @@ -import { FORMBRICKS_SURVEYS_FILTERS_KEY_LS } from "@/lib/localStorage"; -import { getSurveysAction } from "@/modules/survey/list/actions"; -import { getFormattedFilters } from "@/modules/survey/list/lib/utils"; -import { TSurvey } from "@/modules/survey/list/types/surveys"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { cleanup, render, screen, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; @@ -9,6 +5,10 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TProjectConfigChannel } from "@formbricks/types/project"; import { TSurveyFilters } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { FORMBRICKS_SURVEYS_FILTERS_KEY_LS } from "@/lib/localStorage"; +import { getSurveysAction } from "@/modules/survey/list/actions"; +import { getFormattedFilters } from "@/modules/survey/list/lib/utils"; +import { TSurvey } from "@/modules/survey/list/types/surveys"; import { SurveyCard } from "./survey-card"; import { SurveysList, initialFilters as surveyFiltersInitialFiltersFromModule } from "./survey-list"; import { SurveyLoading } from "./survey-loading"; diff --git a/apps/web/modules/survey/list/components/survey-list.tsx b/apps/web/modules/survey/list/components/survey-list.tsx index 10cab6b964..23c4968623 100644 --- a/apps/web/modules/survey/list/components/survey-list.tsx +++ b/apps/web/modules/survey/list/components/survey-list.tsx @@ -1,10 +1,5 @@ "use client"; -import { FORMBRICKS_SURVEYS_FILTERS_KEY_LS } from "@/lib/localStorage"; -import { getSurveysAction } from "@/modules/survey/list/actions"; -import { getFormattedFilters } from "@/modules/survey/list/lib/utils"; -import { TSurvey } from "@/modules/survey/list/types/surveys"; -import { Button } from "@/modules/ui/components/button"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { useTranslate } from "@tolgee/react"; import { useRouter } from "next/navigation"; @@ -13,6 +8,11 @@ import { wrapThrows } from "@formbricks/types/error-handlers"; import { TProjectConfigChannel } from "@formbricks/types/project"; import { TSurveyFilters } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { FORMBRICKS_SURVEYS_FILTERS_KEY_LS } from "@/lib/localStorage"; +import { getSurveysAction } from "@/modules/survey/list/actions"; +import { getFormattedFilters } from "@/modules/survey/list/lib/utils"; +import { TSurvey } from "@/modules/survey/list/types/surveys"; +import { Button } from "@/modules/ui/components/button"; import { SurveyCard } from "./survey-card"; import { SurveyFilters } from "./survey-filters"; import { SurveyLoading } from "./survey-loading"; diff --git a/apps/web/modules/survey/list/lib/environment.test.ts b/apps/web/modules/survey/list/lib/environment.test.ts index 3e8149e22c..920b08b6d9 100644 --- a/apps/web/modules/survey/list/lib/environment.test.ts +++ b/apps/web/modules/survey/list/lib/environment.test.ts @@ -1,11 +1,11 @@ // Retain only vitest import here // Import modules after mocks -import { validateInputs } from "@/lib/utils/validate"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; import { doesEnvironmentExist, getEnvironment, getProjectIdIfEnvironmentExists } from "./environment"; vi.mock("@/lib/utils/validate"); diff --git a/apps/web/modules/survey/list/lib/environment.ts b/apps/web/modules/survey/list/lib/environment.ts index f1928e3629..2cc509ed47 100644 --- a/apps/web/modules/survey/list/lib/environment.ts +++ b/apps/web/modules/survey/list/lib/environment.ts @@ -1,11 +1,11 @@ import "server-only"; -import { validateInputs } from "@/lib/utils/validate"; import { Environment, Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { z } from "zod"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { validateInputs } from "@/lib/utils/validate"; export const doesEnvironmentExist = reactCache(async (environmentId: string): Promise => { const environment = await prisma.environment.findUnique({ diff --git a/apps/web/modules/survey/list/lib/project.test.ts b/apps/web/modules/survey/list/lib/project.test.ts index 720e1193e0..3c7cbc5f65 100644 --- a/apps/web/modules/survey/list/lib/project.test.ts +++ b/apps/web/modules/survey/list/lib/project.test.ts @@ -1,9 +1,9 @@ -import { TUserProject } from "@/modules/survey/list/types/projects"; -import { TProjectWithLanguages } from "@/modules/survey/list/types/surveys"; import { Prisma } from "@prisma/client"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { prisma } from "@formbricks/database"; import { DatabaseError, ValidationError } from "@formbricks/types/errors"; +import { TUserProject } from "@/modules/survey/list/types/projects"; +import { TProjectWithLanguages } from "@/modules/survey/list/types/surveys"; import { getProjectWithLanguagesByEnvironmentId, getUserProjects } from "./project"; vi.mock("@formbricks/database", () => ({ diff --git a/apps/web/modules/survey/list/lib/project.ts b/apps/web/modules/survey/list/lib/project.ts index 5ab4c36fea..c0baeb8fce 100644 --- a/apps/web/modules/survey/list/lib/project.ts +++ b/apps/web/modules/survey/list/lib/project.ts @@ -1,11 +1,11 @@ import "server-only"; -import { TUserProject } from "@/modules/survey/list/types/projects"; -import { TProjectWithLanguages } from "@/modules/survey/list/types/surveys"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { DatabaseError, ValidationError } from "@formbricks/types/errors"; +import { TUserProject } from "@/modules/survey/list/types/projects"; +import { TProjectWithLanguages } from "@/modules/survey/list/types/surveys"; export const getProjectWithLanguagesByEnvironmentId = reactCache( async (environmentId: string): Promise => { diff --git a/apps/web/modules/survey/list/lib/survey.test.ts b/apps/web/modules/survey/list/lib/survey.test.ts index d83aafe497..9222a91a86 100644 --- a/apps/web/modules/survey/list/lib/survey.test.ts +++ b/apps/web/modules/survey/list/lib/survey.test.ts @@ -1,9 +1,3 @@ -import { checkForInvalidImagesInQuestions } from "@/lib/survey/utils"; -import { validateInputs } from "@/lib/utils/validate"; -import { getIsQuotasEnabled } from "@/modules/ee/license-check/lib/utils"; -import { buildOrderByClause, buildWhereClause } from "@/modules/survey/lib/utils"; -import { doesEnvironmentExist } from "@/modules/survey/list/lib/environment"; -import { getProjectWithLanguagesByEnvironmentId } from "@/modules/survey/list/lib/project"; import { createId } from "@paralleldrive/cuid2"; import { Prisma } from "@prisma/client"; import { cache as reactCache } from "react"; @@ -12,6 +6,12 @@ import { prisma } from "@formbricks/database"; import { logger } from "@formbricks/logger"; import { TActionClassType } from "@formbricks/types/action-classes"; import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { checkForInvalidImagesInQuestions } from "@/lib/survey/utils"; +import { validateInputs } from "@/lib/utils/validate"; +import { getIsQuotasEnabled } from "@/modules/ee/license-check/lib/utils"; +import { buildOrderByClause, buildWhereClause } from "@/modules/survey/lib/utils"; +import { doesEnvironmentExist } from "@/modules/survey/list/lib/environment"; +import { getProjectWithLanguagesByEnvironmentId } from "@/modules/survey/list/lib/project"; import { TProjectWithLanguages, TSurvey } from "../types/surveys"; // Import the module to be tested import { diff --git a/apps/web/modules/survey/list/lib/survey.ts b/apps/web/modules/survey/list/lib/survey.ts index a5c4766d57..a8c134eeb0 100644 --- a/apps/web/modules/survey/list/lib/survey.ts +++ b/apps/web/modules/survey/list/lib/survey.ts @@ -1,4 +1,12 @@ import "server-only"; +import { createId } from "@paralleldrive/cuid2"; +import { Prisma } from "@prisma/client"; +import { cache as reactCache } from "react"; +import { z } from "zod"; +import { prisma } from "@formbricks/database"; +import { logger } from "@formbricks/logger"; +import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; +import { TSurveyFilterCriteria } from "@formbricks/types/surveys/types"; import { getOrganizationByEnvironmentId } from "@/lib/organization/service"; import { checkForInvalidImagesInQuestions } from "@/lib/survey/utils"; import { validateInputs } from "@/lib/utils/validate"; @@ -8,14 +16,6 @@ import { buildOrderByClause, buildWhereClause } from "@/modules/survey/lib/utils import { doesEnvironmentExist } from "@/modules/survey/list/lib/environment"; import { getProjectWithLanguagesByEnvironmentId } from "@/modules/survey/list/lib/project"; import { TProjectWithLanguages, TSurvey } from "@/modules/survey/list/types/surveys"; -import { createId } from "@paralleldrive/cuid2"; -import { Prisma } from "@prisma/client"; -import { cache as reactCache } from "react"; -import { z } from "zod"; -import { prisma } from "@formbricks/database"; -import { logger } from "@formbricks/logger"; -import { DatabaseError, ResourceNotFoundError } from "@formbricks/types/errors"; -import { TSurveyFilterCriteria } from "@formbricks/types/surveys/types"; export const surveySelect: Prisma.SurveySelect = { id: true, diff --git a/apps/web/modules/survey/list/loading.tsx b/apps/web/modules/survey/list/loading.tsx index 400517e047..f2361a1910 100644 --- a/apps/web/modules/survey/list/loading.tsx +++ b/apps/web/modules/survey/list/loading.tsx @@ -1,9 +1,9 @@ "use client"; +import { useTranslate } from "@tolgee/react"; import { SurveyLoading } from "@/modules/survey/list/components/survey-loading"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { useTranslate } from "@tolgee/react"; export const SurveyListLoading = () => { const { t } = useTranslate(); diff --git a/apps/web/modules/survey/list/page.test.tsx b/apps/web/modules/survey/list/page.test.tsx index ff3559513b..3a2c6c5038 100644 --- a/apps/web/modules/survey/list/page.test.tsx +++ b/apps/web/modules/survey/list/page.test.tsx @@ -1,10 +1,10 @@ -import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import { Session } from "next-auth"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; import { TEnvironment } from "@formbricks/types/environment"; import { TProject } from "@formbricks/types/project"; +import { TEnvironmentAuth } from "@/modules/environments/types/environment-auth"; import { SurveysPage } from "./page"; // Mock all dependencies diff --git a/apps/web/modules/survey/list/page.tsx b/apps/web/modules/survey/list/page.tsx index 49cd0e3f30..6485208b4a 100644 --- a/apps/web/modules/survey/list/page.tsx +++ b/apps/web/modules/survey/list/page.tsx @@ -1,3 +1,7 @@ +import { PlusIcon } from "lucide-react"; +import { Metadata } from "next"; +import Link from "next/link"; +import { redirect } from "next/navigation"; import { DEFAULT_LOCALE, SURVEYS_PER_PAGE } from "@/lib/constants"; import { getPublicDomain } from "@/lib/getPublicUrl"; import { getUserLocale } from "@/lib/user/service"; @@ -10,10 +14,6 @@ import { Button } from "@/modules/ui/components/button"; import { PageContentWrapper } from "@/modules/ui/components/page-content-wrapper"; import { PageHeader } from "@/modules/ui/components/page-header"; import { getTranslate } from "@/tolgee/server"; -import { PlusIcon } from "lucide-react"; -import { Metadata } from "next"; -import Link from "next/link"; -import { redirect } from "next/navigation"; export const metadata: Metadata = { title: "Your Surveys", diff --git a/apps/web/modules/survey/templates/components/back-button.tsx b/apps/web/modules/survey/templates/components/back-button.tsx index e1d60675c6..b0203974d4 100644 --- a/apps/web/modules/survey/templates/components/back-button.tsx +++ b/apps/web/modules/survey/templates/components/back-button.tsx @@ -1,9 +1,9 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { ArrowLeftIcon } from "lucide-react"; import { useRouter } from "next/navigation"; +import { Button } from "@/modules/ui/components/button"; interface BackButtonProps { path?: string; diff --git a/apps/web/modules/survey/templates/components/template-container.tsx b/apps/web/modules/survey/templates/components/template-container.tsx index 9701bf8ba2..97ecd6dcaa 100644 --- a/apps/web/modules/survey/templates/components/template-container.tsx +++ b/apps/web/modules/survey/templates/components/template-container.tsx @@ -1,14 +1,14 @@ "use client"; +import type { Environment, Project } from "@prisma/client"; +import { useTranslate } from "@tolgee/react"; +import { useState } from "react"; +import type { TTemplate } from "@formbricks/types/templates"; import { customSurveyTemplate } from "@/app/lib/templates"; import { TemplateList } from "@/modules/survey/components/template-list"; import { MenuBar } from "@/modules/survey/templates/components/menu-bar"; import { PreviewSurvey } from "@/modules/ui/components/preview-survey"; import { SearchBar } from "@/modules/ui/components/search-bar"; -import type { Environment, Project } from "@prisma/client"; -import { useTranslate } from "@tolgee/react"; -import { useState } from "react"; -import type { TTemplate } from "@formbricks/types/templates"; import { getMinimalSurvey } from "../lib/minimal-survey"; type TemplateContainerWithPreviewProps = { diff --git a/apps/web/modules/survey/templates/lib/minimal-survey.ts b/apps/web/modules/survey/templates/lib/minimal-survey.ts index 2d3a67a70b..0472cffcea 100644 --- a/apps/web/modules/survey/templates/lib/minimal-survey.ts +++ b/apps/web/modules/survey/templates/lib/minimal-survey.ts @@ -1,6 +1,6 @@ -import { getDefaultEndingCard, getDefaultWelcomeCard } from "@/app/lib/survey-builder"; import { TFnType } from "@tolgee/react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { getDefaultEndingCard, getDefaultWelcomeCard } from "@/app/lib/survey-builder"; export const getMinimalSurvey = (t: TFnType): TSurvey => ({ id: "someUniqueId1", diff --git a/apps/web/modules/survey/templates/page.tsx b/apps/web/modules/survey/templates/page.tsx index b52fe7c57b..187fd730a8 100644 --- a/apps/web/modules/survey/templates/page.tsx +++ b/apps/web/modules/survey/templates/page.tsx @@ -1,7 +1,7 @@ +import { redirect } from "next/navigation"; import { getEnvironmentAuth } from "@/modules/environments/lib/utils"; import { getProjectWithTeamIdsByEnvironmentId } from "@/modules/survey/lib/project"; import { getTranslate } from "@/tolgee/server"; -import { redirect } from "next/navigation"; import { TemplateContainerWithPreview } from "./components/template-container"; interface SurveyTemplateProps { diff --git a/apps/web/modules/ui/components/action-name-description-fields/index.tsx b/apps/web/modules/ui/components/action-name-description-fields/index.tsx index 787a244d96..bd23016832 100644 --- a/apps/web/modules/ui/components/action-name-description-fields/index.tsx +++ b/apps/web/modules/ui/components/action-name-description-fields/index.tsx @@ -1,8 +1,8 @@ -import { FormControl, FormError, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; import { useTranslate } from "@tolgee/react"; import { Control } from "react-hook-form"; import { TActionClassInput } from "@formbricks/types/action-classes"; +import { FormControl, FormError, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; interface ActionNameDescriptionFieldsProps { control: Control; diff --git a/apps/web/modules/ui/components/alert-dialog/index.test.tsx b/apps/web/modules/ui/components/alert-dialog/index.test.tsx index afc1060d28..b77df576ed 100644 --- a/apps/web/modules/ui/components/alert-dialog/index.test.tsx +++ b/apps/web/modules/ui/components/alert-dialog/index.test.tsx @@ -1,7 +1,7 @@ -import { AlertDialog } from "@/modules/ui/components/alert-dialog"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { AlertDialog } from "@/modules/ui/components/alert-dialog"; // Mock the Dialog components vi.mock("@/modules/ui/components/dialog", () => ({ diff --git a/apps/web/modules/ui/components/alert/index.tsx b/apps/web/modules/ui/components/alert/index.tsx index f0a79d75d4..d73393f596 100644 --- a/apps/web/modules/ui/components/alert/index.tsx +++ b/apps/web/modules/ui/components/alert/index.tsx @@ -1,6 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; import { VariantProps, cva } from "class-variance-authority"; import { AlertCircleIcon, @@ -11,6 +10,7 @@ import { } from "lucide-react"; import * as React from "react"; import { createContext, useContext, useMemo } from "react"; +import { cn } from "@/lib/cn"; import { Button, ButtonProps } from "../button"; // Create a context to share variant and size with child components diff --git a/apps/web/modules/ui/components/background-styling-card/index.tsx b/apps/web/modules/ui/components/background-styling-card/index.tsx index a43b5a79e4..1a672ea254 100644 --- a/apps/web/modules/ui/components/background-styling-card/index.tsx +++ b/apps/web/modules/ui/components/background-styling-card/index.tsx @@ -1,10 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { SurveyBgSelectorTab } from "@/modules/ui/components/background-styling-card/survey-bg-selector-tab"; -import { Badge } from "@/modules/ui/components/badge"; -import { FormControl, FormDescription, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; -import { Slider } from "@/modules/ui/components/slider"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import * as Collapsible from "@radix-ui/react-collapsible"; import { useTranslate } from "@tolgee/react"; @@ -12,6 +7,11 @@ import { CheckIcon } from "lucide-react"; import { UseFormReturn } from "react-hook-form"; import { TProjectStyling } from "@formbricks/types/project"; import { TSurveyStyling } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { SurveyBgSelectorTab } from "@/modules/ui/components/background-styling-card/survey-bg-selector-tab"; +import { Badge } from "@/modules/ui/components/badge"; +import { FormControl, FormDescription, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; +import { Slider } from "@/modules/ui/components/slider"; interface BackgroundStylingCardProps { open: boolean; diff --git a/apps/web/modules/ui/components/background-styling-card/survey-bg-selector-tab.tsx b/apps/web/modules/ui/components/background-styling-card/survey-bg-selector-tab.tsx index 657e2305d1..ca3599e8c3 100644 --- a/apps/web/modules/ui/components/background-styling-card/survey-bg-selector-tab.tsx +++ b/apps/web/modules/ui/components/background-styling-card/survey-bg-selector-tab.tsx @@ -1,13 +1,13 @@ "use client"; +import { useAutoAnimate } from "@formkit/auto-animate/react"; +import { useTranslate } from "@tolgee/react"; +import { useEffect, useState } from "react"; import { AnimatedSurveyBg } from "@/modules/survey/editor/components/animated-survey-bg"; import { ColorSurveyBg } from "@/modules/survey/editor/components/color-survey-bg"; import { UploadImageSurveyBg } from "@/modules/survey/editor/components/image-survey-bg"; import { ImageFromUnsplashSurveyBg } from "@/modules/survey/editor/components/unsplash-images"; import { TabBar } from "@/modules/ui/components/tab-bar"; -import { useAutoAnimate } from "@formkit/auto-animate/react"; -import { useTranslate } from "@tolgee/react"; -import { useEffect, useState } from "react"; interface SurveyBgSelectorTabProps { handleBgChange: (bg: string, bgType: string) => void; diff --git a/apps/web/modules/ui/components/button/index.tsx b/apps/web/modules/ui/components/button/index.tsx index 06456198e9..beaa0fb43f 100644 --- a/apps/web/modules/ui/components/button/index.tsx +++ b/apps/web/modules/ui/components/button/index.tsx @@ -1,8 +1,8 @@ -import { cn } from "@/modules/ui/lib/utils"; import { Slot } from "@radix-ui/react-slot"; import { type VariantProps, cva } from "class-variance-authority"; import { Loader2 } from "lucide-react"; import * as React from "react"; +import { cn } from "@/modules/ui/lib/utils"; const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", diff --git a/apps/web/modules/ui/components/calendar/index.tsx b/apps/web/modules/ui/components/calendar/index.tsx index 0d9d3847f0..0cc7043198 100644 --- a/apps/web/modules/ui/components/calendar/index.tsx +++ b/apps/web/modules/ui/components/calendar/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import { ChevronLeft, ChevronRight } from "lucide-react"; import * as React from "react"; import { Chevron, DayPicker } from "react-day-picker"; +import { cn } from "@/lib/cn"; export type CalendarProps = React.ComponentProps; diff --git a/apps/web/modules/ui/components/card-arrangement-tabs/index.tsx b/apps/web/modules/ui/components/card-arrangement-tabs/index.tsx index 309e755ab2..67d1ae9894 100644 --- a/apps/web/modules/ui/components/card-arrangement-tabs/index.tsx +++ b/apps/web/modules/ui/components/card-arrangement-tabs/index.tsx @@ -1,12 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { TCardArrangementOptions } from "@formbricks/types/styling"; +import { TSurveyType } from "@formbricks/types/surveys/types"; import { CasualCardArrangementIcon } from "@/modules/ui/components/icons/casual-card-arrangement-icon"; import { SimpleCardsArrangementIcon } from "@/modules/ui/components/icons/simple-card-arrangement-icon"; import { StraightCardArrangementIcon } from "@/modules/ui/components/icons/straight-card-arrangement-icon"; import { StylingTabs } from "@/modules/ui/components/styling-tabs"; -import { useTranslate } from "@tolgee/react"; -import { TCardArrangementOptions } from "@formbricks/types/styling"; -import { TSurveyType } from "@formbricks/types/surveys/types"; interface CardArrangementTabsProps { surveyType: TSurveyType; diff --git a/apps/web/modules/ui/components/card-styling-settings/index.tsx b/apps/web/modules/ui/components/card-styling-settings/index.tsx index 6f7e8e286f..bdfd75038a 100644 --- a/apps/web/modules/ui/components/card-styling-settings/index.tsx +++ b/apps/web/modules/ui/components/card-styling-settings/index.tsx @@ -1,13 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { COLOR_DEFAULTS } from "@/lib/styling/constants"; -import { Badge } from "@/modules/ui/components/badge"; -import { CardArrangementTabs } from "@/modules/ui/components/card-arrangement-tabs"; -import { ColorPicker } from "@/modules/ui/components/color-picker"; -import { FormControl, FormDescription, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; -import { Slider } from "@/modules/ui/components/slider"; -import { Switch } from "@/modules/ui/components/switch"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { Project } from "@prisma/client"; import * as Collapsible from "@radix-ui/react-collapsible"; @@ -17,6 +9,14 @@ import React from "react"; import { UseFormReturn } from "react-hook-form"; import { TProjectStyling } from "@formbricks/types/project"; import { TSurveyStyling, TSurveyType } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { COLOR_DEFAULTS } from "@/lib/styling/constants"; +import { Badge } from "@/modules/ui/components/badge"; +import { CardArrangementTabs } from "@/modules/ui/components/card-arrangement-tabs"; +import { ColorPicker } from "@/modules/ui/components/color-picker"; +import { FormControl, FormDescription, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; +import { Slider } from "@/modules/ui/components/slider"; +import { Switch } from "@/modules/ui/components/switch"; type CardStylingSettingsProps = { open: boolean; diff --git a/apps/web/modules/ui/components/card/index.tsx b/apps/web/modules/ui/components/card/index.tsx index 56bf95a5c0..d6f6a6fc3c 100644 --- a/apps/web/modules/ui/components/card/index.tsx +++ b/apps/web/modules/ui/components/card/index.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/cn"; import * as React from "react"; +import { cn } from "@/lib/cn"; interface CardProps extends React.HTMLAttributes { label?: string; diff --git a/apps/web/modules/ui/components/checkbox/index.tsx b/apps/web/modules/ui/components/checkbox/index.tsx index 907fa06633..49aaee1980 100644 --- a/apps/web/modules/ui/components/checkbox/index.tsx +++ b/apps/web/modules/ui/components/checkbox/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; import { Check } from "lucide-react"; import * as React from "react"; +import { cn } from "@/lib/cn"; const Checkbox = React.forwardRef( ({ className, ...props }, ref) => ( diff --git a/apps/web/modules/ui/components/client-logo/index.tsx b/apps/web/modules/ui/components/client-logo/index.tsx index 0d382c4732..95499eaff4 100644 --- a/apps/web/modules/ui/components/client-logo/index.tsx +++ b/apps/web/modules/ui/components/client-logo/index.tsx @@ -1,11 +1,11 @@ "use client"; -import { cn } from "@/lib/cn"; import { Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { ArrowUpRight } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; +import { cn } from "@/lib/cn"; interface ClientLogoProps { environmentId?: string; diff --git a/apps/web/modules/ui/components/client-logout/index.test.tsx b/apps/web/modules/ui/components/client-logout/index.test.tsx index ad077e445e..937659be72 100644 --- a/apps/web/modules/ui/components/client-logout/index.test.tsx +++ b/apps/web/modules/ui/components/client-logout/index.test.tsx @@ -1,6 +1,6 @@ -import { useSignOut } from "@/modules/auth/hooks/use-sign-out"; import { render } from "@testing-library/react"; import { type MockedFunction, beforeEach, describe, expect, test, vi } from "vitest"; +import { useSignOut } from "@/modules/auth/hooks/use-sign-out"; import { ClientLogout } from "./index"; // Mock next-auth/react diff --git a/apps/web/modules/ui/components/client-logout/index.tsx b/apps/web/modules/ui/components/client-logout/index.tsx index 5ecc6572d5..ccc7905d2b 100644 --- a/apps/web/modules/ui/components/client-logout/index.tsx +++ b/apps/web/modules/ui/components/client-logout/index.tsx @@ -1,7 +1,7 @@ "use client"; -import { useSignOut } from "@/modules/auth/hooks/use-sign-out"; import { useEffect } from "react"; +import { useSignOut } from "@/modules/auth/hooks/use-sign-out"; export const ClientLogout = () => { const { signOut: signOutWithAudit } = useSignOut(); diff --git a/apps/web/modules/ui/components/code-action-form/index.tsx b/apps/web/modules/ui/components/code-action-form/index.tsx index 8c9eddf841..de5c0d9fed 100644 --- a/apps/web/modules/ui/components/code-action-form/index.tsx +++ b/apps/web/modules/ui/components/code-action-form/index.tsx @@ -1,10 +1,10 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { Terminal } from "lucide-react"; import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; import { FormControl, FormError, FormField, FormItem, FormLabel } from "@/modules/ui/components/form"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { Terminal } from "lucide-react"; interface CodeActionFormProps { form: any; diff --git a/apps/web/modules/ui/components/code-block/index.tsx b/apps/web/modules/ui/components/code-block/index.tsx index 30c40abd27..02faf5208b 100644 --- a/apps/web/modules/ui/components/code-block/index.tsx +++ b/apps/web/modules/ui/components/code-block/index.tsx @@ -1,12 +1,12 @@ "use client"; -import { cn } from "@/lib/cn"; import { useTranslate } from "@tolgee/react"; import { CopyIcon } from "lucide-react"; import Prism from "prismjs"; import "prismjs/themes/prism.css"; import React, { useEffect } from "react"; import toast from "react-hot-toast"; +import { cn } from "@/lib/cn"; import "./style.css"; interface CodeBlockProps { diff --git a/apps/web/modules/ui/components/color-picker/components/popover-picker.tsx b/apps/web/modules/ui/components/color-picker/components/popover-picker.tsx index e0092c1b04..2c7fbae031 100644 --- a/apps/web/modules/ui/components/color-picker/components/popover-picker.tsx +++ b/apps/web/modules/ui/components/color-picker/components/popover-picker.tsx @@ -1,6 +1,6 @@ -import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; import { useCallback, useRef, useState } from "react"; import { HexColorPicker } from "react-colorful"; +import { useClickOutside } from "@/lib/utils/hooks/useClickOutside"; interface PopoverPickerProps { color: string; diff --git a/apps/web/modules/ui/components/color-picker/index.tsx b/apps/web/modules/ui/components/color-picker/index.tsx index df5e15c07c..e0d0a88993 100644 --- a/apps/web/modules/ui/components/color-picker/index.tsx +++ b/apps/web/modules/ui/components/color-picker/index.tsx @@ -1,8 +1,8 @@ "use client"; +import { HexColorInput } from "react-colorful"; import { cn } from "@/lib/cn"; import { PopoverPicker } from "@/modules/ui/components/color-picker/components/popover-picker"; -import { HexColorInput } from "react-colorful"; interface ColorPickerProps { color: string; diff --git a/apps/web/modules/ui/components/command/index.test.tsx b/apps/web/modules/ui/components/command/index.test.tsx index fe203e6809..e295bf3d82 100644 --- a/apps/web/modules/ui/components/command/index.test.tsx +++ b/apps/web/modules/ui/components/command/index.test.tsx @@ -1,6 +1,6 @@ -import { CommandDialog, CommandSeparator, CommandShortcut } from "@/modules/ui/components/command/index"; import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import { afterEach, describe, expect, test, vi } from "vitest"; +import { CommandDialog, CommandSeparator, CommandShortcut } from "@/modules/ui/components/command/index"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "."; window.HTMLElement.prototype.scrollIntoView = vi.fn(); diff --git a/apps/web/modules/ui/components/command/index.tsx b/apps/web/modules/ui/components/command/index.tsx index 7ad108bd44..8178753a07 100644 --- a/apps/web/modules/ui/components/command/index.tsx +++ b/apps/web/modules/ui/components/command/index.tsx @@ -1,5 +1,8 @@ "use client"; +import { Command as CommandPrimitive } from "cmdk"; +import { SearchIcon } from "lucide-react"; +import * as React from "react"; import { Dialog, DialogContent, @@ -8,9 +11,6 @@ import { DialogTitle, } from "@/modules/ui/components/dialog"; import { cn } from "@/modules/ui/lib/utils"; -import { Command as CommandPrimitive } from "cmdk"; -import { SearchIcon } from "lucide-react"; -import * as React from "react"; function Command({ className, ...props }: React.ComponentProps) { return ( diff --git a/apps/web/modules/ui/components/conditions-editor/index.tsx b/apps/web/modules/ui/components/conditions-editor/index.tsx index be42f7bb9b..c4e8223c76 100644 --- a/apps/web/modules/ui/components/conditions-editor/index.tsx +++ b/apps/web/modules/ui/components/conditions-editor/index.tsx @@ -1,5 +1,10 @@ "use client"; +import { useAutoAnimate } from "@formkit/auto-animate/react"; +import { useTranslate } from "@tolgee/react"; +import { CopyIcon, EllipsisVerticalIcon, PlusIcon, TrashIcon, WorkflowIcon } from "lucide-react"; +import { FieldErrors } from "react-hook-form"; +import { TSurveyQuotaInput } from "@formbricks/types/quota"; import { Button } from "@/modules/ui/components/button"; import { isConditionGroup } from "@/modules/ui/components/conditions-editor/lib/utils"; import { @@ -17,11 +22,6 @@ import { SelectValue, } from "@/modules/ui/components/select"; import { cn } from "@/modules/ui/lib/utils"; -import { useAutoAnimate } from "@formkit/auto-animate/react"; -import { useTranslate } from "@tolgee/react"; -import { CopyIcon, EllipsisVerticalIcon, PlusIcon, TrashIcon, WorkflowIcon } from "lucide-react"; -import { FieldErrors } from "react-hook-form"; -import { TSurveyQuotaInput } from "@formbricks/types/quota"; import { TConditionsEditorCallbacks, TConditionsEditorConfig, diff --git a/apps/web/modules/ui/components/conditions-editor/types.ts b/apps/web/modules/ui/components/conditions-editor/types.ts index ad3bf8bdc3..242034870d 100644 --- a/apps/web/modules/ui/components/conditions-editor/types.ts +++ b/apps/web/modules/ui/components/conditions-editor/types.ts @@ -1,5 +1,5 @@ -import { TComboboxGroupedOption, TComboboxOption } from "@/modules/ui/components/input-combo-box"; import { TConnector } from "@formbricks/types/surveys/types"; +import { TComboboxGroupedOption, TComboboxOption } from "@/modules/ui/components/input-combo-box"; export interface TGenericCondition { id: string; diff --git a/apps/web/modules/ui/components/confirm-delete-segment-modal/index.tsx b/apps/web/modules/ui/components/confirm-delete-segment-modal/index.tsx index 22ee5fd7bd..71e699da0b 100644 --- a/apps/web/modules/ui/components/confirm-delete-segment-modal/index.tsx +++ b/apps/web/modules/ui/components/confirm-delete-segment-modal/index.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import React, { useMemo } from "react"; +import { TSegmentWithSurveyNames } from "@formbricks/types/segment"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -10,9 +13,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import React, { useMemo } from "react"; -import { TSegmentWithSurveyNames } from "@formbricks/types/segment"; interface ConfirmDeleteSegmentModalProps { open: boolean; diff --git a/apps/web/modules/ui/components/confirmation-modal/index.tsx b/apps/web/modules/ui/components/confirmation-modal/index.tsx index 85146c2488..7210c0233a 100644 --- a/apps/web/modules/ui/components/confirmation-modal/index.tsx +++ b/apps/web/modules/ui/components/confirmation-modal/index.tsx @@ -1,5 +1,8 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { CircleAlert } from "lucide-react"; +import React from "react"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -10,9 +13,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { CircleAlert } from "lucide-react"; -import React from "react"; interface SecondaryButtonProps { text: string; diff --git a/apps/web/modules/ui/components/connect-integration/index.tsx b/apps/web/modules/ui/components/connect-integration/index.tsx index 984aba3221..206d106357 100644 --- a/apps/web/modules/ui/components/connect-integration/index.tsx +++ b/apps/web/modules/ui/components/connect-integration/index.tsx @@ -1,7 +1,5 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; -import { FormbricksLogo } from "@/modules/ui/components/formbricks-logo"; import { useTranslate } from "@tolgee/react"; import Image, { StaticImageData } from "next/image"; import Link from "next/link"; @@ -9,6 +7,8 @@ import { useSearchParams } from "next/navigation"; import { useEffect, useState } from "react"; import toast from "react-hot-toast"; import { TIntegrationType } from "@formbricks/types/integration"; +import { Button } from "@/modules/ui/components/button"; +import { FormbricksLogo } from "@/modules/ui/components/formbricks-logo"; import { getIntegrationDetails } from "./lib/utils"; interface ConnectIntegrationProps { diff --git a/apps/web/modules/ui/components/data-table/components/data-table-header.tsx b/apps/web/modules/ui/components/data-table/components/data-table-header.tsx index f2e86389d6..8f15a12de9 100644 --- a/apps/web/modules/ui/components/data-table/components/data-table-header.tsx +++ b/apps/web/modules/ui/components/data-table/components/data-table-header.tsx @@ -1,10 +1,10 @@ -import { cn } from "@/lib/cn"; -import { TableHead } from "@/modules/ui/components/table"; import { useSortable } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { Header, flexRender } from "@tanstack/react-table"; import { GripVerticalIcon } from "lucide-react"; import { CSSProperties } from "react"; +import { cn } from "@/lib/cn"; +import { TableHead } from "@/modules/ui/components/table"; import { getCommonPinningStyles } from "../lib/utils"; import { ColumnSettingsDropdown } from "./column-settings-dropdown"; diff --git a/apps/web/modules/ui/components/data-table/components/data-table-settings-modal-item.tsx b/apps/web/modules/ui/components/data-table/components/data-table-settings-modal-item.tsx index bd23e3dcd8..9ea2b31e52 100644 --- a/apps/web/modules/ui/components/data-table/components/data-table-settings-modal-item.tsx +++ b/apps/web/modules/ui/components/data-table/components/data-table-settings-modal-item.tsx @@ -1,11 +1,11 @@ "use client"; -import { Switch } from "@/modules/ui/components/switch"; import { useSortable } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { Column, Table, flexRender } from "@tanstack/react-table"; import { GripVertical } from "lucide-react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { Switch } from "@/modules/ui/components/switch"; interface DataTableSettingsModalItemProps { column: Column; diff --git a/apps/web/modules/ui/components/data-table/components/data-table-settings-modal.tsx b/apps/web/modules/ui/components/data-table/components/data-table-settings-modal.tsx index 9f6ab51ed1..6cba22a35d 100644 --- a/apps/web/modules/ui/components/data-table/components/data-table-settings-modal.tsx +++ b/apps/web/modules/ui/components/data-table/components/data-table-settings-modal.tsx @@ -1,13 +1,5 @@ "use client"; -import { - Dialog, - DialogBody, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from "@/modules/ui/components/dialog"; import { DndContext, DragEndEvent, @@ -22,6 +14,14 @@ import { useTranslate } from "@tolgee/react"; import { SettingsIcon } from "lucide-react"; import { useMemo } from "react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { + Dialog, + DialogBody, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "@/modules/ui/components/dialog"; import { DataTableSettingsModalItem } from "./data-table-settings-modal-item"; interface DataTableSettingsModalProps { diff --git a/apps/web/modules/ui/components/data-table/components/data-table-toolbar.tsx b/apps/web/modules/ui/components/data-table/components/data-table-toolbar.tsx index ed493dfedc..32830fe67c 100644 --- a/apps/web/modules/ui/components/data-table/components/data-table-toolbar.tsx +++ b/apps/web/modules/ui/components/data-table/components/data-table-toolbar.tsx @@ -1,12 +1,12 @@ "use client"; -import { cn } from "@/lib/cn"; -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { Table } from "@tanstack/react-table"; import { useTranslate } from "@tolgee/react"; import { MoveVerticalIcon, RefreshCcwIcon, SettingsIcon } from "lucide-react"; import { useRouter } from "next/navigation"; import toast from "react-hot-toast"; +import { cn } from "@/lib/cn"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { SelectedRowSettings } from "./selected-row-settings"; interface DataTableToolbarProps { diff --git a/apps/web/modules/ui/components/data-table/components/selection-column.tsx b/apps/web/modules/ui/components/data-table/components/selection-column.tsx index b750fe0874..9b16574f3d 100644 --- a/apps/web/modules/ui/components/data-table/components/selection-column.tsx +++ b/apps/web/modules/ui/components/data-table/components/selection-column.tsx @@ -1,7 +1,7 @@ "use client"; -import { Checkbox } from "@/modules/ui/components/checkbox"; import { ColumnDef } from "@tanstack/react-table"; +import { Checkbox } from "@/modules/ui/components/checkbox"; export const getSelectionColumn = (): ColumnDef => { return { diff --git a/apps/web/modules/ui/components/date-picker/index.tsx b/apps/web/modules/ui/components/date-picker/index.tsx index fe6b8a7e1e..cd1cd1ded6 100644 --- a/apps/web/modules/ui/components/date-picker/index.tsx +++ b/apps/web/modules/ui/components/date-picker/index.tsx @@ -1,13 +1,13 @@ "use client"; -import { cn } from "@/lib/cn"; -import { Button } from "@/modules/ui/components/button"; -import { Popover, PopoverContent, PopoverTrigger } from "@/modules/ui/components/popover"; import { useTranslate } from "@tolgee/react"; import { format } from "date-fns"; import { CalendarCheckIcon, CalendarIcon, XIcon } from "lucide-react"; import { useRef, useState } from "react"; import Calendar from "react-calendar"; +import { cn } from "@/lib/cn"; +import { Button } from "@/modules/ui/components/button"; +import { Popover, PopoverContent, PopoverTrigger } from "@/modules/ui/components/popover"; import "./styles.css"; const getOrdinalSuffix = (day: number) => { diff --git a/apps/web/modules/ui/components/decrement-quotas-checkbox/index.tsx b/apps/web/modules/ui/components/decrement-quotas-checkbox/index.tsx index 9c98612abd..ae897ee9cd 100644 --- a/apps/web/modules/ui/components/decrement-quotas-checkbox/index.tsx +++ b/apps/web/modules/ui/components/decrement-quotas-checkbox/index.tsx @@ -1,5 +1,5 @@ -import { Checkbox } from "@/modules/ui/components/checkbox"; import { useTranslate } from "@tolgee/react"; +import { Checkbox } from "@/modules/ui/components/checkbox"; interface DecrementQuotasCheckboxProps { title: string; diff --git a/apps/web/modules/ui/components/delete-dialog/index.tsx b/apps/web/modules/ui/components/delete-dialog/index.tsx index cac255727e..8ab4c464e2 100644 --- a/apps/web/modules/ui/components/delete-dialog/index.tsx +++ b/apps/web/modules/ui/components/delete-dialog/index.tsx @@ -1,5 +1,7 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { CircleAlert, TrashIcon } from "lucide-react"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -10,8 +12,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useTranslate } from "@tolgee/react"; -import { CircleAlert, TrashIcon } from "lucide-react"; interface DeleteDialogProps { open: boolean; diff --git a/apps/web/modules/ui/components/dialog/index.tsx b/apps/web/modules/ui/components/dialog/index.tsx index e30911f722..5e904c8d18 100644 --- a/apps/web/modules/ui/components/dialog/index.tsx +++ b/apps/web/modules/ui/components/dialog/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import { X } from "lucide-react"; import * as React from "react"; +import { cn } from "@/lib/cn"; const Dialog = DialogPrimitive.Root; diff --git a/apps/web/modules/ui/components/dropdown-menu/index.tsx b/apps/web/modules/ui/components/dropdown-menu/index.tsx index 6ed7e36c90..96fe0cf0d1 100644 --- a/apps/web/modules/ui/components/dropdown-menu/index.tsx +++ b/apps/web/modules/ui/components/dropdown-menu/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; import { Check, ChevronRight, Circle } from "lucide-react"; import * as React from "react"; +import { cn } from "@/lib/cn"; const DropdownMenu: React.ComponentType = DropdownMenuPrimitive.Root; diff --git a/apps/web/modules/ui/components/dropdown-selector/index.tsx b/apps/web/modules/ui/components/dropdown-selector/index.tsx index 8071e33d20..4368780eb5 100644 --- a/apps/web/modules/ui/components/dropdown-selector/index.tsx +++ b/apps/web/modules/ui/components/dropdown-selector/index.tsx @@ -1,3 +1,4 @@ +import { ChevronDownIcon } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, @@ -6,7 +7,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { Label } from "@/modules/ui/components/label"; -import { ChevronDownIcon } from "lucide-react"; interface DropdownSelectorProps { label?: string; diff --git a/apps/web/modules/ui/components/editor/components/add-variables-dropdown.tsx b/apps/web/modules/ui/components/editor/components/add-variables-dropdown.tsx index 90400b65e5..f244596f30 100644 --- a/apps/web/modules/ui/components/editor/components/add-variables-dropdown.tsx +++ b/apps/web/modules/ui/components/editor/components/add-variables-dropdown.tsx @@ -1,10 +1,10 @@ +import { ChevronDownIcon } from "lucide-react"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; -import { ChevronDownIcon } from "lucide-react"; interface IAddVariablesDropdown { addVariable: (variable: string) => void; diff --git a/apps/web/modules/ui/components/empty-space-filler/index.tsx b/apps/web/modules/ui/components/empty-space-filler/index.tsx index dd6836e487..a85275dbd6 100644 --- a/apps/web/modules/ui/components/empty-space-filler/index.tsx +++ b/apps/web/modules/ui/components/empty-space-filler/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { Skeleton } from "@/modules/ui/components/skeleton"; import { useTranslate } from "@tolgee/react"; import Link from "next/link"; import { TEnvironment } from "@formbricks/types/environment"; +import { Skeleton } from "@/modules/ui/components/skeleton"; type EmptySpaceFillerProps = { type: "table" | "response" | "event" | "linkResponse" | "tag" | "summary"; diff --git a/apps/web/modules/ui/components/environment-notice/index.tsx b/apps/web/modules/ui/components/environment-notice/index.tsx index 468de9713a..ada92b62bd 100644 --- a/apps/web/modules/ui/components/environment-notice/index.tsx +++ b/apps/web/modules/ui/components/environment-notice/index.tsx @@ -1,8 +1,8 @@ +import Link from "next/link"; import { WEBAPP_URL } from "@/lib/constants"; import { getEnvironment, getEnvironments } from "@/lib/environment/service"; import { Alert, AlertButton, AlertTitle } from "@/modules/ui/components/alert"; import { getTranslate } from "@/tolgee/server"; -import Link from "next/link"; interface EnvironmentNoticeProps { environmentId: string; diff --git a/apps/web/modules/ui/components/environmentId-base-layout/index.tsx b/apps/web/modules/ui/components/environmentId-base-layout/index.tsx index b7ce56a6c3..0c32b14128 100644 --- a/apps/web/modules/ui/components/environmentId-base-layout/index.tsx +++ b/apps/web/modules/ui/components/environmentId-base-layout/index.tsx @@ -1,10 +1,10 @@ +import { Session } from "next-auth"; +import { TOrganization } from "@formbricks/types/organizations"; +import { TUser } from "@formbricks/types/user"; import { PosthogIdentify } from "@/app/(app)/environments/[environmentId]/components/PosthogIdentify"; import { ResponseFilterProvider } from "@/app/(app)/environments/[environmentId]/components/ResponseFilterContext"; import { IS_POSTHOG_CONFIGURED } from "@/lib/constants"; import { ToasterClient } from "@/modules/ui/components/toaster-client"; -import { Session } from "next-auth"; -import { TOrganization } from "@formbricks/types/organizations"; -import { TUser } from "@formbricks/types/user"; interface EnvironmentIdBaseLayoutProps { children: React.ReactNode; diff --git a/apps/web/modules/ui/components/file-input/components/uploader.test.tsx b/apps/web/modules/ui/components/file-input/components/uploader.test.tsx index 991aa1db58..acbdf411fe 100644 --- a/apps/web/modules/ui/components/file-input/components/uploader.test.tsx +++ b/apps/web/modules/ui/components/file-input/components/uploader.test.tsx @@ -1,8 +1,8 @@ -import { showStorageNotConfiguredToast } from "@/modules/ui/components/storage-not-configured-toast/lib/utils"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { TAllowedFileExtension } from "@formbricks/types/storage"; +import { showStorageNotConfiguredToast } from "@/modules/ui/components/storage-not-configured-toast/lib/utils"; import { Uploader } from "./uploader"; vi.mock("@/modules/ui/components/storage-not-configured-toast/lib/utils", () => ({ diff --git a/apps/web/modules/ui/components/file-input/components/uploader.tsx b/apps/web/modules/ui/components/file-input/components/uploader.tsx index 4ca167b1b1..5271a2edf2 100644 --- a/apps/web/modules/ui/components/file-input/components/uploader.tsx +++ b/apps/web/modules/ui/components/file-input/components/uploader.tsx @@ -1,8 +1,8 @@ -import { cn } from "@/lib/cn"; -import { showStorageNotConfiguredToast } from "@/modules/ui/components/storage-not-configured-toast/lib/utils"; import { ArrowUpFromLineIcon } from "lucide-react"; import React from "react"; import { TAllowedFileExtension } from "@formbricks/types/storage"; +import { cn } from "@/lib/cn"; +import { showStorageNotConfiguredToast } from "@/modules/ui/components/storage-not-configured-toast/lib/utils"; interface UploaderProps { id: string; diff --git a/apps/web/modules/ui/components/file-input/components/video-settings.tsx b/apps/web/modules/ui/components/file-input/components/video-settings.tsx index e3ef8e0bb5..555d6fc5e0 100644 --- a/apps/web/modules/ui/components/file-input/components/video-settings.tsx +++ b/apps/web/modules/ui/components/file-input/components/video-settings.tsx @@ -1,13 +1,13 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useState } from "react"; +import { toast } from "react-hot-toast"; import { checkForYoutubeUrl, convertToEmbedUrl, extractYoutubeId } from "@/lib/utils/video-upload"; import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; import { Alert, AlertTitle } from "@/modules/ui/components/alert"; import { Button } from "@/modules/ui/components/button"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { useState } from "react"; -import { toast } from "react-hot-toast"; import { Label } from "../../label"; import { checkForYoutubePrivacyMode } from "../lib/utils"; diff --git a/apps/web/modules/ui/components/file-input/lib/actions.ts b/apps/web/modules/ui/components/file-input/lib/actions.ts index f849b23953..c760f43348 100644 --- a/apps/web/modules/ui/components/file-input/lib/actions.ts +++ b/apps/web/modules/ui/components/file-input/lib/actions.ts @@ -1,7 +1,7 @@ "use server"; -import { authenticatedActionClient } from "@/lib/utils/action-client"; import { z } from "zod"; +import { authenticatedActionClient } from "@/lib/utils/action-client"; const ZConvertHeicToJpegInput = z.object({ file: z.instanceof(File), diff --git a/apps/web/modules/ui/components/file-upload-response/index.tsx b/apps/web/modules/ui/components/file-upload-response/index.tsx index 774c3a036f..bbac7c8149 100644 --- a/apps/web/modules/ui/components/file-upload-response/index.tsx +++ b/apps/web/modules/ui/components/file-upload-response/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { getOriginalFileNameFromUrl } from "@/modules/storage/utils"; import { useTranslate } from "@tolgee/react"; import { DownloadIcon } from "lucide-react"; +import { getOriginalFileNameFromUrl } from "@/modules/storage/utils"; interface FileUploadResponseProps { selected: string[]; diff --git a/apps/web/modules/ui/components/form/index.tsx b/apps/web/modules/ui/components/form/index.tsx index 8326f4a268..4849cc4c52 100644 --- a/apps/web/modules/ui/components/form/index.tsx +++ b/apps/web/modules/ui/components/form/index.tsx @@ -1,6 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; import * as LabelPrimitive from "@radix-ui/react-label"; import { Slot } from "@radix-ui/react-slot"; import * as React from "react"; @@ -12,6 +11,7 @@ import { FormProvider, useFormContext, } from "react-hook-form"; +import { cn } from "@/lib/cn"; import { Label } from "../label"; type FormFieldContextValue< diff --git a/apps/web/modules/ui/components/go-back-button/index.tsx b/apps/web/modules/ui/components/go-back-button/index.tsx index 8e09310b83..43f279b89d 100644 --- a/apps/web/modules/ui/components/go-back-button/index.tsx +++ b/apps/web/modules/ui/components/go-back-button/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { ArrowLeftIcon } from "lucide-react"; import { useRouter } from "next/navigation"; +import { Button } from "@/modules/ui/components/button"; export const GoBackButton = ({ url }: { url?: string }) => { const router = useRouter(); diff --git a/apps/web/modules/ui/components/iconbar/index.tsx b/apps/web/modules/ui/components/iconbar/index.tsx index dfc88e7273..a3c7b3c567 100644 --- a/apps/web/modules/ui/components/iconbar/index.tsx +++ b/apps/web/modules/ui/components/iconbar/index.tsx @@ -1,5 +1,5 @@ -import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { LucideIcon } from "lucide-react"; +import { TooltipRenderer } from "@/modules/ui/components/tooltip"; import { Button } from "../button"; interface IconAction { diff --git a/apps/web/modules/ui/components/input-combo-box/index.tsx b/apps/web/modules/ui/components/input-combo-box/index.tsx index cf399f4333..654c80529b 100644 --- a/apps/web/modules/ui/components/input-combo-box/index.tsx +++ b/apps/web/modules/ui/components/input-combo-box/index.tsx @@ -1,5 +1,17 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { CheckIcon, ChevronDownIcon, LucideProps, XIcon } from "lucide-react"; +import Image from "next/image"; +import React, { + ForwardRefExoticComponent, + Fragment, + RefAttributes, + useEffect, + useMemo, + useRef, + useState, +} from "react"; import { cn } from "@/lib/cn"; import { Command, @@ -21,18 +33,6 @@ import { DropdownMenuTrigger, } from "@/modules/ui/components/dropdown-menu"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { CheckIcon, ChevronDownIcon, LucideProps, XIcon } from "lucide-react"; -import Image from "next/image"; -import React, { - ForwardRefExoticComponent, - Fragment, - RefAttributes, - useEffect, - useMemo, - useRef, - useState, -} from "react"; export interface TComboboxOption { icon?: ForwardRefExoticComponent & RefAttributes>; diff --git a/apps/web/modules/ui/components/input/index.tsx b/apps/web/modules/ui/components/input/index.tsx index 6aeb86b4ce..28e43e6688 100644 --- a/apps/web/modules/ui/components/input/index.tsx +++ b/apps/web/modules/ui/components/input/index.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/cn"; import * as React from "react"; +import { cn } from "@/lib/cn"; export interface InputProps extends Omit, "crossOrigin" | "dangerouslySetInnerHTML"> { diff --git a/apps/web/modules/ui/components/integration-card/index.tsx b/apps/web/modules/ui/components/integration-card/index.tsx index 914682166f..adc5999141 100644 --- a/apps/web/modules/ui/components/integration-card/index.tsx +++ b/apps/web/modules/ui/components/integration-card/index.tsx @@ -1,7 +1,7 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import Link from "next/link"; +import { Button } from "@/modules/ui/components/button"; interface CardProps { connectText?: string; diff --git a/apps/web/modules/ui/components/label/index.tsx b/apps/web/modules/ui/components/label/index.tsx index 9866a1d00e..a27987a83d 100644 --- a/apps/web/modules/ui/components/label/index.tsx +++ b/apps/web/modules/ui/components/label/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import * as LabelPrimitive from "@radix-ui/react-label"; import * as React from "react"; +import { cn } from "@/lib/cn"; type LabelType = React.ForwardRefExoticComponent< React.PropsWithoutRef> & diff --git a/apps/web/modules/ui/components/limits-reached-banner/index.tsx b/apps/web/modules/ui/components/limits-reached-banner/index.tsx index 3c2019bb4e..4616d42429 100644 --- a/apps/web/modules/ui/components/limits-reached-banner/index.tsx +++ b/apps/web/modules/ui/components/limits-reached-banner/index.tsx @@ -53,7 +53,8 @@ export const LimitsReachedBanner = ({ ) : null} {isPeopleLimitReached && !isResponseLimitReached ? ( <> - {t("common.you_have_reached_your_monthly_miu_limit_of")} {orgBillingPeopleLimit}.{" "} + {t("common.you_have_reached_your_monthly_miu_limit_of")} {orgBillingPeopleLimit} + .{" "} ) : null} {!isPeopleLimitReached && isResponseLimitReached ? ( diff --git a/apps/web/modules/ui/components/load-segment-modal/index.tsx b/apps/web/modules/ui/components/load-segment-modal/index.tsx index 792f815615..127040b207 100644 --- a/apps/web/modules/ui/components/load-segment-modal/index.tsx +++ b/apps/web/modules/ui/components/load-segment-modal/index.tsx @@ -1,14 +1,14 @@ "use client"; -import { cn } from "@/lib/cn"; -import { formatDate, timeSinceDate } from "@/lib/time"; -import { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle } from "@/modules/ui/components/dialog"; import { useTranslate } from "@tolgee/react"; import { Loader2, UsersIcon } from "lucide-react"; import { useState } from "react"; import toast from "react-hot-toast"; import { TSegment, ZSegmentFilters } from "@formbricks/types/segment"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/cn"; +import { formatDate, timeSinceDate } from "@/lib/time"; +import { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle } from "@/modules/ui/components/dialog"; interface SegmentDetailProps { segment: TSegment; diff --git a/apps/web/modules/ui/components/modal-with-tabs/index.tsx b/apps/web/modules/ui/components/modal-with-tabs/index.tsx index 5e725e1c97..5bc12067c5 100644 --- a/apps/web/modules/ui/components/modal-with-tabs/index.tsx +++ b/apps/web/modules/ui/components/modal-with-tabs/index.tsx @@ -1,3 +1,4 @@ +import { useEffect, useState } from "react"; import { Dialog, DialogBody, @@ -6,7 +7,6 @@ import { DialogHeader, DialogTitle, } from "@/modules/ui/components/dialog"; -import { useEffect, useState } from "react"; interface ModalWithTabsProps { open: boolean; diff --git a/apps/web/modules/ui/components/multi-select/badge.tsx b/apps/web/modules/ui/components/multi-select/badge.tsx index 88b3884aa0..02149b51de 100644 --- a/apps/web/modules/ui/components/multi-select/badge.tsx +++ b/apps/web/modules/ui/components/multi-select/badge.tsx @@ -1,6 +1,6 @@ -import { cn } from "@/lib/cn"; import { type VariantProps, cva } from "class-variance-authority"; import * as React from "react"; +import { cn } from "@/lib/cn"; const badgeVariants = cva( "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", diff --git a/apps/web/modules/ui/components/multi-select/index.tsx b/apps/web/modules/ui/components/multi-select/index.tsx index 3159014edd..7c5c4b21df 100644 --- a/apps/web/modules/ui/components/multi-select/index.tsx +++ b/apps/web/modules/ui/components/multi-select/index.tsx @@ -1,10 +1,10 @@ "use client"; -import { Command, CommandGroup, CommandItem, CommandList } from "@/modules/ui/components/command"; -import { Badge } from "@/modules/ui/components/multi-select/badge"; import { Command as CommandPrimitive } from "cmdk"; import { X } from "lucide-react"; import * as React from "react"; +import { Command, CommandGroup, CommandItem, CommandList } from "@/modules/ui/components/command"; +import { Badge } from "@/modules/ui/components/multi-select/badge"; interface TOption { value: T; diff --git a/apps/web/modules/ui/components/no-code-action-form/components/css-selector.tsx b/apps/web/modules/ui/components/no-code-action-form/components/css-selector.tsx index 8cd72984c4..fe5b31e4dc 100644 --- a/apps/web/modules/ui/components/no-code-action-form/components/css-selector.tsx +++ b/apps/web/modules/ui/components/no-code-action-form/components/css-selector.tsx @@ -1,11 +1,11 @@ "use client"; -import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; -import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; import { useTranslate } from "@tolgee/react"; import { UseFormReturn } from "react-hook-form"; import { TActionClassInput } from "@formbricks/types/action-classes"; +import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; +import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; interface CssSelectorProps { form: UseFormReturn; diff --git a/apps/web/modules/ui/components/no-code-action-form/components/inner-html-selector.tsx b/apps/web/modules/ui/components/no-code-action-form/components/inner-html-selector.tsx index bd999cf3d2..e22333e80d 100644 --- a/apps/web/modules/ui/components/no-code-action-form/components/inner-html-selector.tsx +++ b/apps/web/modules/ui/components/no-code-action-form/components/inner-html-selector.tsx @@ -1,11 +1,11 @@ "use client"; -import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; -import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; import { useTranslate } from "@tolgee/react"; import { UseFormReturn } from "react-hook-form"; import { TActionClassInput } from "@formbricks/types/action-classes"; +import { AdvancedOptionToggle } from "@/modules/ui/components/advanced-option-toggle"; +import { FormControl, FormField, FormItem } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; interface InnerHtmlSelectorProps { form: UseFormReturn; diff --git a/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.test.tsx b/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.test.tsx index 95a8c1b434..75fe723147 100644 --- a/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.test.tsx +++ b/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.test.tsx @@ -1,4 +1,3 @@ -import { Select, SelectContent, SelectItem } from "@/modules/ui/components/select"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; @@ -6,6 +5,7 @@ import React from "react"; import { useForm } from "react-hook-form"; import { afterEach, describe, expect, test, vi } from "vitest"; import { ACTION_CLASS_PAGE_URL_RULES, TActionClassInput } from "@formbricks/types/action-classes"; +import { Select, SelectContent, SelectItem } from "@/modules/ui/components/select"; import { PageUrlSelector } from "./page-url-selector"; // Mock testURLmatch function diff --git a/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.tsx b/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.tsx index e9d3bbca5f..e47a987a1e 100644 --- a/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.tsx +++ b/apps/web/modules/ui/components/no-code-action-form/components/page-url-selector.tsx @@ -1,19 +1,5 @@ "use client"; -import { cn } from "@/lib/cn"; -import { testURLmatch } from "@/lib/utils/url"; -import { Button } from "@/modules/ui/components/button"; -import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; -import { Input } from "@/modules/ui/components/input"; -import { Label } from "@/modules/ui/components/label"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/modules/ui/components/select"; -import { TabToggle } from "@/modules/ui/components/tab-toggle"; import { TFnType, useTranslate } from "@tolgee/react"; import { PlusIcon, TrashIcon } from "lucide-react"; import { useMemo, useState } from "react"; @@ -31,6 +17,20 @@ import { TActionClassInput, TActionClassPageUrlRule, } from "@formbricks/types/action-classes"; +import { cn } from "@/lib/cn"; +import { testURLmatch } from "@/lib/utils/url"; +import { Button } from "@/modules/ui/components/button"; +import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; +import { Input } from "@/modules/ui/components/input"; +import { Label } from "@/modules/ui/components/label"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/modules/ui/components/select"; +import { TabToggle } from "@/modules/ui/components/tab-toggle"; const getRuleLabel = (rule: TActionClassPageUrlRule, t: TFnType): string => { switch (rule) { diff --git a/apps/web/modules/ui/components/no-code-action-form/index.tsx b/apps/web/modules/ui/components/no-code-action-form/index.tsx index 42c98a4bfb..74af4d3bbe 100644 --- a/apps/web/modules/ui/components/no-code-action-form/index.tsx +++ b/apps/web/modules/ui/components/no-code-action-form/index.tsx @@ -1,13 +1,13 @@ "use client"; -import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; -import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; -import { Label } from "@/modules/ui/components/label"; -import { TabToggle } from "@/modules/ui/components/tab-toggle"; import { useTranslate } from "@tolgee/react"; import { InfoIcon } from "lucide-react"; import { UseFormReturn } from "react-hook-form"; import { TActionClassInput } from "@formbricks/types/action-classes"; +import { Alert, AlertDescription, AlertTitle } from "@/modules/ui/components/alert"; +import { FormControl, FormError, FormField, FormItem } from "@/modules/ui/components/form"; +import { Label } from "@/modules/ui/components/label"; +import { TabToggle } from "@/modules/ui/components/tab-toggle"; import { CssSelector } from "./components/css-selector"; import { InnerHtmlSelector } from "./components/inner-html-selector"; import { PageUrlSelector } from "./components/page-url-selector"; diff --git a/apps/web/modules/ui/components/option-card/index.tsx b/apps/web/modules/ui/components/option-card/index.tsx index c1446e6bfb..271da6f0bb 100644 --- a/apps/web/modules/ui/components/option-card/index.tsx +++ b/apps/web/modules/ui/components/option-card/index.tsx @@ -1,5 +1,5 @@ -import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; import React from "react"; +import { LoadingSpinner } from "@/modules/ui/components/loading-spinner"; interface PathwayOptionProps { size: "sm" | "md" | "lg"; diff --git a/apps/web/modules/ui/components/otp-input/index.tsx b/apps/web/modules/ui/components/otp-input/index.tsx index 9aab652d82..800738803b 100644 --- a/apps/web/modules/ui/components/otp-input/index.tsx +++ b/apps/web/modules/ui/components/otp-input/index.tsx @@ -1,6 +1,6 @@ +import React, { useMemo } from "react"; import { cn } from "@/lib/cn"; import { Input } from "@/modules/ui/components/input"; -import React, { useMemo } from "react"; export type OTPInputProps = { value: string; diff --git a/apps/web/modules/ui/components/page-header/stories.tsx b/apps/web/modules/ui/components/page-header/stories.tsx index 91005aece4..0423a4da38 100644 --- a/apps/web/modules/ui/components/page-header/stories.tsx +++ b/apps/web/modules/ui/components/page-header/stories.tsx @@ -1,6 +1,6 @@ +import { Meta, StoryObj } from "@storybook/react-vite"; import { Button } from "@/modules/ui/components/button"; import { PageHeader } from "@/modules/ui/components/page-header"; -import { Meta, StoryObj } from "@storybook/react-vite"; const meta: Meta = { title: "UI/PageHeader", diff --git a/apps/web/modules/ui/components/password-input/index.tsx b/apps/web/modules/ui/components/password-input/index.tsx index 11a19263cb..2b96bc02a9 100644 --- a/apps/web/modules/ui/components/password-input/index.tsx +++ b/apps/web/modules/ui/components/password-input/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import { EyeIcon, EyeOff } from "lucide-react"; import { forwardRef, useState } from "react"; +import { cn } from "@/lib/cn"; export interface PasswordInputProps extends Omit, "type"> { containerClassName?: string; diff --git a/apps/web/modules/ui/components/picture-selection-response/index.tsx b/apps/web/modules/ui/components/picture-selection-response/index.tsx index 487cd179d9..886cda492f 100644 --- a/apps/web/modules/ui/components/picture-selection-response/index.tsx +++ b/apps/web/modules/ui/components/picture-selection-response/index.tsx @@ -1,8 +1,8 @@ "use client"; +import Image from "next/image"; import { cn } from "@/lib/cn"; import { IdBadge } from "@/modules/ui/components/id-badge"; -import Image from "next/image"; interface PictureSelectionResponseProps { choices: { id: string; imageUrl: string }[]; diff --git a/apps/web/modules/ui/components/popover/index.tsx b/apps/web/modules/ui/components/popover/index.tsx index 43577e249b..1192e5500a 100644 --- a/apps/web/modules/ui/components/popover/index.tsx +++ b/apps/web/modules/ui/components/popover/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import * as PopoverPrimitive from "@radix-ui/react-popover"; import * as React from "react"; +import { cn } from "@/lib/cn"; const Popover: React.FC> = PopoverPrimitive.Root; diff --git a/apps/web/modules/ui/components/preview-survey/components/modal.tsx b/apps/web/modules/ui/components/preview-survey/components/modal.tsx index 8a4fe82250..b507fcaed0 100644 --- a/apps/web/modules/ui/components/preview-survey/components/modal.tsx +++ b/apps/web/modules/ui/components/preview-survey/components/modal.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import { ReactNode, useEffect, useRef, useState } from "react"; import { TPlacement } from "@formbricks/types/common"; +import { cn } from "@/lib/cn"; import { getPlacementStyle } from "../lib/utils"; interface ModalProps { diff --git a/apps/web/modules/ui/components/preview-survey/index.tsx b/apps/web/modules/ui/components/preview-survey/index.tsx index 1ed1ddd8f9..db76e70173 100644 --- a/apps/web/modules/ui/components/preview-survey/index.tsx +++ b/apps/web/modules/ui/components/preview-survey/index.tsx @@ -1,9 +1,5 @@ "use client"; -import { ClientLogo } from "@/modules/ui/components/client-logo"; -import { MediaBackground } from "@/modules/ui/components/media-background"; -import { ResetProgressButton } from "@/modules/ui/components/reset-progress-button"; -import { SurveyInline } from "@/modules/ui/components/survey"; import { Environment, Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { Variants, motion } from "framer-motion"; @@ -11,6 +7,10 @@ import { ExpandIcon, MonitorIcon, ShrinkIcon, SmartphoneIcon } from "lucide-reac import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { TProjectStyling } from "@formbricks/types/project"; import { TSurvey, TSurveyQuestionId, TSurveyStyling } from "@formbricks/types/surveys/types"; +import { ClientLogo } from "@/modules/ui/components/client-logo"; +import { MediaBackground } from "@/modules/ui/components/media-background"; +import { ResetProgressButton } from "@/modules/ui/components/reset-progress-button"; +import { SurveyInline } from "@/modules/ui/components/survey"; import { Modal } from "./components/modal"; import { TabOption } from "./components/tab-option"; diff --git a/apps/web/modules/ui/components/question-toggle-table/index.tsx b/apps/web/modules/ui/components/question-toggle-table/index.tsx index 30226c554f..0a782caa0a 100644 --- a/apps/web/modules/ui/components/question-toggle-table/index.tsx +++ b/apps/web/modules/ui/components/question-toggle-table/index.tsx @@ -1,7 +1,5 @@ "use client"; -import { QuestionFormInput } from "@/modules/survey/components/question-form-input"; -import { Switch } from "@/modules/ui/components/switch"; import { useTranslate } from "@tolgee/react"; import { TI18nString, @@ -10,6 +8,8 @@ import { TSurveyContactInfoQuestion, } from "@formbricks/types/surveys/types"; import { TUserLocale } from "@formbricks/types/user"; +import { QuestionFormInput } from "@/modules/survey/components/question-form-input"; +import { Switch } from "@/modules/ui/components/switch"; interface QuestionToggleTableProps { type: "address" | "contact"; diff --git a/apps/web/modules/ui/components/radio-group/index.tsx b/apps/web/modules/ui/components/radio-group/index.tsx index c9ab2abb7e..51d006fac0 100644 --- a/apps/web/modules/ui/components/radio-group/index.tsx +++ b/apps/web/modules/ui/components/radio-group/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"; import { Circle } from "lucide-react"; import * as React from "react"; +import { cn } from "@/lib/cn"; const RadioGroup: React.FC> = React.forwardRef( ({ className, ...props }, ref) => { diff --git a/apps/web/modules/ui/components/rating-response/index.tsx b/apps/web/modules/ui/components/rating-response/index.tsx index e348a423a7..e9204c8119 100644 --- a/apps/web/modules/ui/components/rating-response/index.tsx +++ b/apps/web/modules/ui/components/rating-response/index.tsx @@ -1,5 +1,5 @@ -import { RatingSmiley } from "@/modules/analysis/components/RatingSmiley"; import { StarIcon } from "lucide-react"; +import { RatingSmiley } from "@/modules/analysis/components/RatingSmiley"; interface RatingResponseProps { scale?: "number" | "star" | "smiley"; diff --git a/apps/web/modules/ui/components/reset-progress-button/index.tsx b/apps/web/modules/ui/components/reset-progress-button/index.tsx index 39edf24d11..fef5fe2b87 100644 --- a/apps/web/modules/ui/components/reset-progress-button/index.tsx +++ b/apps/web/modules/ui/components/reset-progress-button/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { Button } from "@/modules/ui/components/button"; import { useTranslate } from "@tolgee/react"; import { Repeat2 } from "lucide-react"; +import { Button } from "@/modules/ui/components/button"; interface ResetProgressButtonProps { onClick: () => void; diff --git a/apps/web/modules/ui/components/response-badges/index.tsx b/apps/web/modules/ui/components/response-badges/index.tsx index 607ce09d78..7d25ae51a0 100644 --- a/apps/web/modules/ui/components/response-badges/index.tsx +++ b/apps/web/modules/ui/components/response-badges/index.tsx @@ -1,6 +1,6 @@ +import React from "react"; import { cn } from "@/lib/cn"; import { IdBadge } from "@/modules/ui/components/id-badge"; -import React from "react"; interface ResponseBadgesProps { items: { value: string | number; id?: string }[]; diff --git a/apps/web/modules/ui/components/save-as-new-segment-modal/index.tsx b/apps/web/modules/ui/components/save-as-new-segment-modal/index.tsx index a01ed841f0..2ad52f3947 100644 --- a/apps/web/modules/ui/components/save-as-new-segment-modal/index.tsx +++ b/apps/web/modules/ui/components/save-as-new-segment-modal/index.tsx @@ -1,5 +1,12 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { UsersIcon } from "lucide-react"; +import { useState } from "react"; +import { SubmitHandler, useForm } from "react-hook-form"; +import toast from "react-hot-toast"; +import { TSegment, TSegmentCreateInput, TSegmentUpdateInput } from "@formbricks/types/segment"; +import { TSurvey } from "@formbricks/types/surveys/types"; import { Button } from "@/modules/ui/components/button"; import { Dialog, @@ -11,13 +18,6 @@ import { DialogTitle, } from "@/modules/ui/components/dialog"; import { Input } from "@/modules/ui/components/input"; -import { useTranslate } from "@tolgee/react"; -import { UsersIcon } from "lucide-react"; -import { useState } from "react"; -import { SubmitHandler, useForm } from "react-hook-form"; -import toast from "react-hot-toast"; -import { TSegment, TSegmentCreateInput, TSegmentUpdateInput } from "@formbricks/types/segment"; -import { TSurvey } from "@formbricks/types/surveys/types"; interface SaveAsNewSegmentModalProps { open: boolean; diff --git a/apps/web/modules/ui/components/search-bar/index.tsx b/apps/web/modules/ui/components/search-bar/index.tsx index c3c33e8f77..16f5c5bc58 100644 --- a/apps/web/modules/ui/components/search-bar/index.tsx +++ b/apps/web/modules/ui/components/search-bar/index.tsx @@ -1,6 +1,6 @@ -import { cn } from "@/lib/cn"; import { Search } from "lucide-react"; import React from "react"; +import { cn } from "@/lib/cn"; interface SearchBarProps { value: string; diff --git a/apps/web/modules/ui/components/secondary-navigation/index.tsx b/apps/web/modules/ui/components/secondary-navigation/index.tsx index 1f36229763..b76eed0ab4 100644 --- a/apps/web/modules/ui/components/secondary-navigation/index.tsx +++ b/apps/web/modules/ui/components/secondary-navigation/index.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/cn"; import Link from "next/link"; +import { cn } from "@/lib/cn"; interface SecondaryNavbarProps { navigation: { diff --git a/apps/web/modules/ui/components/select/index.tsx b/apps/web/modules/ui/components/select/index.tsx index 66deff275c..493f28be24 100644 --- a/apps/web/modules/ui/components/select/index.tsx +++ b/apps/web/modules/ui/components/select/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as SelectPrimitive from "@radix-ui/react-select"; import { ChevronDown } from "lucide-react"; import * as React from "react"; +import { cn } from "@/lib/cn"; const Select: React.ComponentType = SelectPrimitive.Root; diff --git a/apps/web/modules/ui/components/separator/index.tsx b/apps/web/modules/ui/components/separator/index.tsx index 88bdc8ea71..7f5ec30b08 100644 --- a/apps/web/modules/ui/components/separator/index.tsx +++ b/apps/web/modules/ui/components/separator/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/modules/ui/lib/utils"; import * as SeparatorPrimitive from "@radix-ui/react-separator"; import * as React from "react"; +import { cn } from "@/modules/ui/lib/utils"; const Separator = React.forwardRef< React.ComponentRef, diff --git a/apps/web/modules/ui/components/sheet/index.tsx b/apps/web/modules/ui/components/sheet/index.tsx index 387a2816c1..8de3e49a67 100644 --- a/apps/web/modules/ui/components/sheet/index.tsx +++ b/apps/web/modules/ui/components/sheet/index.tsx @@ -1,10 +1,10 @@ "use client"; -import { cn } from "@/modules/ui/lib/utils"; import * as SheetPrimitive from "@radix-ui/react-dialog"; import { type VariantProps, cva } from "class-variance-authority"; import { XIcon } from "lucide-react"; import * as React from "react"; +import { cn } from "@/modules/ui/lib/utils"; const Sheet = SheetPrimitive.Root; diff --git a/apps/web/modules/ui/components/shuffle-option-select/index.tsx b/apps/web/modules/ui/components/shuffle-option-select/index.tsx index 0f5ab07e3e..f0ce13cf3a 100644 --- a/apps/web/modules/ui/components/shuffle-option-select/index.tsx +++ b/apps/web/modules/ui/components/shuffle-option-select/index.tsx @@ -1,12 +1,5 @@ "use client"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/modules/ui/components/select"; import { useTranslate } from "@tolgee/react"; import { TShuffleOption, @@ -14,6 +7,13 @@ import { TSurveyMultipleChoiceQuestion, TSurveyRankingQuestion, } from "@formbricks/types/surveys/types"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/modules/ui/components/select"; interface ShuffleOptionType { id: string; diff --git a/apps/web/modules/ui/components/sidebar/index.tsx b/apps/web/modules/ui/components/sidebar/index.tsx index d2bee1f12c..c1cb6da257 100644 --- a/apps/web/modules/ui/components/sidebar/index.tsx +++ b/apps/web/modules/ui/components/sidebar/index.tsx @@ -1,5 +1,9 @@ "use client"; +import { Slot } from "@radix-ui/react-slot"; +import { VariantProps, cva } from "class-variance-authority"; +import { Columns2Icon } from "lucide-react"; +import * as React from "react"; import { Button } from "@/modules/ui/components/button"; import { Input } from "@/modules/ui/components/input"; import { Separator } from "@/modules/ui/components/separator"; @@ -14,10 +18,6 @@ import { Skeleton } from "@/modules/ui/components/skeleton"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useIsMobile } from "@/modules/ui/hooks/use-mobile"; import { cn } from "@/modules/ui/lib/utils"; -import { Slot } from "@radix-ui/react-slot"; -import { VariantProps, cva } from "class-variance-authority"; -import { Columns2Icon } from "lucide-react"; -import * as React from "react"; const SIDEBAR_COOKIE_NAME = "sidebar_state"; const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; diff --git a/apps/web/modules/ui/components/slider/index.tsx b/apps/web/modules/ui/components/slider/index.tsx index 8e4a7301cd..28faf7ebb0 100644 --- a/apps/web/modules/ui/components/slider/index.tsx +++ b/apps/web/modules/ui/components/slider/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import * as SliderPrimitive from "@radix-ui/react-slider"; import * as React from "react"; +import { cn } from "@/lib/cn"; export const Slider: React.ForwardRefExoticComponent< React.ComponentPropsWithoutRef & diff --git a/apps/web/modules/ui/components/styling-tabs/index.tsx b/apps/web/modules/ui/components/styling-tabs/index.tsx index 813e137650..dbb992571e 100644 --- a/apps/web/modules/ui/components/styling-tabs/index.tsx +++ b/apps/web/modules/ui/components/styling-tabs/index.tsx @@ -1,6 +1,6 @@ +import React, { useState } from "react"; import { cn } from "@/lib/cn"; import { Label } from "@/modules/ui/components/label"; -import React, { useState } from "react"; interface Option { value: T; diff --git a/apps/web/modules/ui/components/survey-status-indicator/index.tsx b/apps/web/modules/ui/components/survey-status-indicator/index.tsx index c522eb0878..6ec6d7a6be 100644 --- a/apps/web/modules/ui/components/survey-status-indicator/index.tsx +++ b/apps/web/modules/ui/components/survey-status-indicator/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; import { useTranslate } from "@tolgee/react"; import { CheckIcon, PauseIcon, PencilIcon } from "lucide-react"; import { TSurvey } from "@formbricks/types/surveys/types"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/modules/ui/components/tooltip"; interface SurveyStatusIndicatorProps { status: TSurvey["status"]; diff --git a/apps/web/modules/ui/components/survey/index.tsx b/apps/web/modules/ui/components/survey/index.tsx index 34ee558476..ca5bb6e496 100644 --- a/apps/web/modules/ui/components/survey/index.tsx +++ b/apps/web/modules/ui/components/survey/index.tsx @@ -1,6 +1,6 @@ -import { executeRecaptcha, loadRecaptchaScript } from "@/modules/ui/components/survey/recaptcha"; import { useCallback, useEffect, useMemo, useState } from "react"; import { SurveyContainerProps } from "@formbricks/types/formbricks-surveys"; +import { executeRecaptcha, loadRecaptchaScript } from "@/modules/ui/components/survey/recaptcha"; const createContainerId = () => `formbricks-survey-container`; declare global { diff --git a/apps/web/modules/ui/components/switch/index.tsx b/apps/web/modules/ui/components/switch/index.tsx index 9b9da49f5c..31bf66fc79 100644 --- a/apps/web/modules/ui/components/switch/index.tsx +++ b/apps/web/modules/ui/components/switch/index.tsx @@ -1,8 +1,8 @@ "use client"; -import { cn } from "@/lib/cn"; import * as SwitchPrimitives from "@radix-ui/react-switch"; import * as React from "react"; +import { cn } from "@/lib/cn"; const Switch: React.ComponentType = React.forwardRef< React.ElementRef, diff --git a/apps/web/modules/ui/components/tab-toggle/index.tsx b/apps/web/modules/ui/components/tab-toggle/index.tsx index 553c1c44f0..a65efe6650 100644 --- a/apps/web/modules/ui/components/tab-toggle/index.tsx +++ b/apps/web/modules/ui/components/tab-toggle/index.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/cn"; import React, { useState } from "react"; +import { cn } from "@/lib/cn"; interface Option { value: T; diff --git a/apps/web/modules/ui/components/table/index.tsx b/apps/web/modules/ui/components/table/index.tsx index 2668b01889..c57ffc326c 100644 --- a/apps/web/modules/ui/components/table/index.tsx +++ b/apps/web/modules/ui/components/table/index.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/cn"; import * as React from "react"; +import { cn } from "@/lib/cn"; const Table = React.forwardRef>( ({ className, ...props }, ref) => ( diff --git a/apps/web/modules/ui/components/tabs/index.tsx b/apps/web/modules/ui/components/tabs/index.tsx index ed15efbbad..4c8a1e3a8d 100644 --- a/apps/web/modules/ui/components/tabs/index.tsx +++ b/apps/web/modules/ui/components/tabs/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as TabsPrimitive from "@radix-ui/react-tabs"; import { type VariantProps, cva } from "class-variance-authority"; import * as React from "react"; +import { cn } from "@/lib/cn"; const tabsVariants = cva( "bg-slate-100 rounded-lg p-1 inline-flex items-center overflow-x-auto [scrollbar-width:none]", diff --git a/apps/web/modules/ui/components/tag/index.tsx b/apps/web/modules/ui/components/tag/index.tsx index 9f1f7ad2f4..c5fad3d4e7 100644 --- a/apps/web/modules/ui/components/tag/index.tsx +++ b/apps/web/modules/ui/components/tag/index.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/cn"; import { XCircleIcon } from "lucide-react"; +import { cn } from "@/lib/cn"; interface Tag { tagId: string; diff --git a/apps/web/modules/ui/components/tags-combobox/index.tsx b/apps/web/modules/ui/components/tags-combobox/index.tsx index ccffe4451d..ebc464b175 100644 --- a/apps/web/modules/ui/components/tags-combobox/index.tsx +++ b/apps/web/modules/ui/components/tags-combobox/index.tsx @@ -1,5 +1,7 @@ "use client"; +import { useTranslate } from "@tolgee/react"; +import { useEffect, useMemo } from "react"; import { Button } from "@/modules/ui/components/button"; import { Command, @@ -9,8 +11,6 @@ import { CommandList, } from "@/modules/ui/components/command"; import { Popover, PopoverContent, PopoverTrigger } from "@/modules/ui/components/popover"; -import { useTranslate } from "@tolgee/react"; -import { useEffect, useMemo } from "react"; interface ITagsComboboxProps { tags: Tag[]; diff --git a/apps/web/modules/ui/components/theme-styling-preview-survey/index.tsx b/apps/web/modules/ui/components/theme-styling-preview-survey/index.tsx index cbda21856c..fb7b6050f5 100644 --- a/apps/web/modules/ui/components/theme-styling-preview-survey/index.tsx +++ b/apps/web/modules/ui/components/theme-styling-preview-survey/index.tsx @@ -1,15 +1,15 @@ "use client"; -import { ClientLogo } from "@/modules/ui/components/client-logo"; -import { MediaBackground } from "@/modules/ui/components/media-background"; -import { Modal } from "@/modules/ui/components/preview-survey/components/modal"; -import { ResetProgressButton } from "@/modules/ui/components/reset-progress-button"; -import { SurveyInline } from "@/modules/ui/components/survey"; import { Project } from "@prisma/client"; import { useTranslate } from "@tolgee/react"; import { Variants, motion } from "framer-motion"; import { Fragment, useRef, useState } from "react"; import { TSurvey, TSurveyType } from "@formbricks/types/surveys/types"; +import { ClientLogo } from "@/modules/ui/components/client-logo"; +import { MediaBackground } from "@/modules/ui/components/media-background"; +import { Modal } from "@/modules/ui/components/preview-survey/components/modal"; +import { ResetProgressButton } from "@/modules/ui/components/reset-progress-button"; +import { SurveyInline } from "@/modules/ui/components/survey"; interface ThemeStylingPreviewSurveyProps { survey: TSurvey; diff --git a/apps/web/modules/ui/components/tooltip/index.tsx b/apps/web/modules/ui/components/tooltip/index.tsx index 4c4899990d..dc701ea45e 100644 --- a/apps/web/modules/ui/components/tooltip/index.tsx +++ b/apps/web/modules/ui/components/tooltip/index.tsx @@ -1,9 +1,9 @@ "use client"; -import { cn } from "@/lib/cn"; import * as TooltipPrimitive from "@radix-ui/react-tooltip"; import * as React from "react"; import { ReactNode } from "react"; +import { cn } from "@/lib/cn"; const TooltipProvider: React.ComponentType = TooltipPrimitive.Provider; diff --git a/apps/web/modules/ui/components/typography/index.tsx b/apps/web/modules/ui/components/typography/index.tsx index 0369825719..373348c382 100644 --- a/apps/web/modules/ui/components/typography/index.tsx +++ b/apps/web/modules/ui/components/typography/index.tsx @@ -1,6 +1,6 @@ -import { cn } from "@/modules/ui/lib/utils"; import { cva } from "class-variance-authority"; import React, { forwardRef } from "react"; +import { cn } from "@/modules/ui/lib/utils"; const H1 = forwardRef>((props, ref) => { return ( diff --git a/apps/web/modules/ui/components/upgrade-prompt/index.tsx b/apps/web/modules/ui/components/upgrade-prompt/index.tsx index a1cbeacdd0..70066e7424 100644 --- a/apps/web/modules/ui/components/upgrade-prompt/index.tsx +++ b/apps/web/modules/ui/components/upgrade-prompt/index.tsx @@ -1,6 +1,6 @@ -import { Button } from "@/modules/ui/components/button"; import { KeyIcon } from "lucide-react"; import Link from "next/link"; +import { Button } from "@/modules/ui/components/button"; export type ModalButton = { text: string; diff --git a/apps/web/modules/utils/hooks/actions.ts b/apps/web/modules/utils/hooks/actions.ts index a669be31bd..7611b88893 100644 --- a/apps/web/modules/utils/hooks/actions.ts +++ b/apps/web/modules/utils/hooks/actions.ts @@ -1,10 +1,10 @@ "use server"; +import { z } from "zod"; +import { ZId } from "@formbricks/types/common"; import { getOrganization } from "@/lib/organization/service"; import { authenticatedActionClient } from "@/lib/utils/action-client"; import { checkAuthorizationUpdated } from "@/lib/utils/action-client/action-client-middleware"; -import { z } from "zod"; -import { ZId } from "@formbricks/types/common"; const ZGetOrganizationBillingInfoAction = z.object({ organizationId: ZId, diff --git a/apps/web/playwright/api/management/webhook.spec.ts b/apps/web/playwright/api/management/webhook.spec.ts index d0b86c7296..388dd141c3 100644 --- a/apps/web/playwright/api/management/webhook.spec.ts +++ b/apps/web/playwright/api/management/webhook.spec.ts @@ -1,6 +1,6 @@ -import { SURVEYS_API_URL, WEBHOOKS_API_URL } from "@/playwright/api/constants"; import { expect } from "@playwright/test"; import { logger } from "@formbricks/logger"; +import { SURVEYS_API_URL, WEBHOOKS_API_URL } from "@/playwright/api/constants"; import { test } from "../../lib/fixtures"; import { loginAndGetApiKey } from "../../lib/utils"; diff --git a/apps/web/playwright/api/organization/project-team.spec.ts b/apps/web/playwright/api/organization/project-team.spec.ts index 2aeb919743..fa69847c1b 100644 --- a/apps/web/playwright/api/organization/project-team.spec.ts +++ b/apps/web/playwright/api/organization/project-team.spec.ts @@ -1,6 +1,6 @@ -import { ME_API_URL, PROJECT_TEAMS_API_URL, TEAMS_API_URL } from "@/playwright/api/constants"; import { expect } from "@playwright/test"; import { logger } from "@formbricks/logger"; +import { ME_API_URL, PROJECT_TEAMS_API_URL, TEAMS_API_URL } from "@/playwright/api/constants"; import { test } from "../../lib/fixtures"; import { loginAndGetApiKey } from "../../lib/utils"; diff --git a/apps/web/playwright/api/organization/team.spec.ts b/apps/web/playwright/api/organization/team.spec.ts index 4573f9dae6..1632d2b7ac 100644 --- a/apps/web/playwright/api/organization/team.spec.ts +++ b/apps/web/playwright/api/organization/team.spec.ts @@ -1,6 +1,6 @@ -import { ME_API_URL, TEAMS_API_URL } from "@/playwright/api/constants"; import { expect } from "@playwright/test"; import { logger } from "@formbricks/logger"; +import { ME_API_URL, TEAMS_API_URL } from "@/playwright/api/constants"; import { test } from "../../lib/fixtures"; import { loginAndGetApiKey } from "../../lib/utils"; diff --git a/apps/web/playwright/api/organization/user.spec.ts b/apps/web/playwright/api/organization/user.spec.ts index e81858c1fa..83e3a832e6 100644 --- a/apps/web/playwright/api/organization/user.spec.ts +++ b/apps/web/playwright/api/organization/user.spec.ts @@ -1,6 +1,6 @@ -import { ME_API_URL, TEAMS_API_URL, USERS_API_URL } from "@/playwright/api/constants"; import { expect } from "@playwright/test"; import { logger } from "@formbricks/logger"; +import { ME_API_URL, TEAMS_API_URL, USERS_API_URL } from "@/playwright/api/constants"; import { test } from "../../lib/fixtures"; import { loginAndGetApiKey } from "../../lib/utils"; diff --git a/apps/web/playwright/api/role.spec.ts b/apps/web/playwright/api/role.spec.ts index 3e639172cf..c176786bd1 100644 --- a/apps/web/playwright/api/role.spec.ts +++ b/apps/web/playwright/api/role.spec.ts @@ -1,6 +1,6 @@ -import { ROLES_API_URL } from "@/playwright/api/constants"; import { expect } from "@playwright/test"; import { logger } from "@formbricks/logger"; +import { ROLES_API_URL } from "@/playwright/api/constants"; import { test } from "../lib/fixtures"; import { loginAndGetApiKey } from "../lib/utils"; diff --git a/apps/web/sentry.edge.config.ts b/apps/web/sentry.edge.config.ts index ef96081777..a39b15e9b9 100644 --- a/apps/web/sentry.edge.config.ts +++ b/apps/web/sentry.edge.config.ts @@ -2,9 +2,9 @@ // The config you add here will be used whenever one of the edge features is loaded. // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally. // https://docs.sentry.io/platforms/javascript/guides/nextjs/ -import { SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE } from "@/lib/constants"; import * as Sentry from "@sentry/nextjs"; import { logger } from "@formbricks/logger"; +import { SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE } from "@/lib/constants"; if (SENTRY_DSN) { logger.info("Sentry DSN found, enabling Sentry on the edge"); diff --git a/apps/web/sentry.server.config.ts b/apps/web/sentry.server.config.ts index 77839d5aec..f64ddf7d8a 100644 --- a/apps/web/sentry.server.config.ts +++ b/apps/web/sentry.server.config.ts @@ -1,9 +1,9 @@ // This file configures the initialization of Sentry on the server. // The config you add here will be used whenever the server handles a request. // https://docs.sentry.io/platforms/javascript/guides/nextjs/ -import { SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE } from "@/lib/constants"; import * as Sentry from "@sentry/nextjs"; import { logger } from "@formbricks/logger"; +import { SENTRY_DSN, SENTRY_ENVIRONMENT, SENTRY_RELEASE } from "@/lib/constants"; if (SENTRY_DSN) { logger.info("Sentry DSN found, enabling Sentry on the server"); diff --git a/apps/web/tolgee/language.ts b/apps/web/tolgee/language.ts index 21c8cfe810..eb95f697e4 100644 --- a/apps/web/tolgee/language.ts +++ b/apps/web/tolgee/language.ts @@ -1,8 +1,8 @@ +import { getServerSession } from "next-auth"; import { DEFAULT_LOCALE } from "@/lib/constants"; import { getUserLocale } from "@/lib/user/service"; import { findMatchingLocale } from "@/lib/utils/locale"; import { authOptions } from "@/modules/auth/lib/authOptions"; -import { getServerSession } from "next-auth"; export async function getLocale() { const session = await getServerSession(authOptions); diff --git a/helm-chart/README.md b/helm-chart/README.md index f76a491d66..8a06e85abf 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -8,149 +8,150 @@ A Helm chart for Formbricks with PostgreSQL, Redis ## Maintainers -| Name | Email | Url | -| ---- | ------ | --- | -| Formbricks | | | +| Name | Email | Url | +| ---------- | --------------------- | --- | +| Formbricks | | | ## Requirements -| Repository | Name | Version | -|------------|------|---------| +| Repository | Name | Version | +| ---------------------------------------- | ---------- | ------- | | oci://registry-1.docker.io/bitnamicharts | postgresql | 16.4.16 | -| oci://registry-1.docker.io/bitnamicharts | redis | 20.11.2 | +| oci://registry-1.docker.io/bitnamicharts | redis | 20.11.2 | ## Values -| Key | Type | Default | Description | -|-----|------|---------|-------------| -| autoscaling.additionalLabels | object | `{}` | | -| autoscaling.annotations | object | `{}` | | -| autoscaling.enabled | bool | `true` | | -| autoscaling.maxReplicas | int | `10` | | -| autoscaling.metrics[0].resource.name | string | `"cpu"` | | -| autoscaling.metrics[0].resource.target.averageUtilization | int | `60` | | -| autoscaling.metrics[0].resource.target.type | string | `"Utilization"` | | -| autoscaling.metrics[0].type | string | `"Resource"` | | -| autoscaling.metrics[1].resource.name | string | `"memory"` | | -| autoscaling.metrics[1].resource.target.averageUtilization | int | `60` | | -| autoscaling.metrics[1].resource.target.type | string | `"Utilization"` | | -| autoscaling.metrics[1].type | string | `"Resource"` | | -| autoscaling.minReplicas | int | `1` | | -| componentOverride | string | `""` | | -| cronJob.enabled | bool | `false` | | -| cronJob.jobs | object | `{}` | | -| deployment.additionalLabels | object | `{}` | | -| deployment.additionalPodAnnotations | object | `{}` | | -| deployment.additionalPodLabels | object | `{}` | | -| deployment.affinity | object | `{}` | | -| deployment.annotations | object | `{}` | | -| deployment.args | list | `[]` | | -| deployment.command | list | `[]` | | -| deployment.containerSecurityContext.readOnlyRootFilesystem | bool | `true` | | -| deployment.containerSecurityContext.runAsNonRoot | bool | `true` | | -| deployment.env.EMAIL_VERIFICATION_DISABLED.value | string | `"1"` | | -| deployment.env.PASSWORD_RESET_DISABLED.value | string | `"1"` | | -| deployment.envFrom | string | `nil` | | -| deployment.image.digest | string | `""` | | -| deployment.image.pullPolicy | string | `"IfNotPresent"` | | -| deployment.image.repository | string | `"ghcr.io/formbricks/formbricks"` | | -| deployment.imagePullSecrets | string | `""` | | -| deployment.nodeSelector | object | `{}` | | -| deployment.ports.http.containerPort | int | `3000` | | -| deployment.ports.http.exposed | bool | `true` | | -| deployment.ports.http.protocol | string | `"TCP"` | | -| deployment.ports.metrics.containerPort | int | `9464` | | -| deployment.ports.metrics.exposed | bool | `true` | | -| deployment.ports.metrics.protocol | string | `"TCP"` | | -| deployment.probes.livenessProbe.failureThreshold | int | `5` | | -| deployment.probes.livenessProbe.httpGet.path | string | `"/health"` | | -| deployment.probes.livenessProbe.httpGet.port | int | `3000` | | -| deployment.probes.livenessProbe.initialDelaySeconds | int | `10` | | -| deployment.probes.livenessProbe.periodSeconds | int | `10` | | -| deployment.probes.livenessProbe.successThreshold | int | `1` | | -| deployment.probes.livenessProbe.timeoutSeconds | int | `5` | | -| deployment.probes.readinessProbe.failureThreshold | int | `5` | | -| deployment.probes.readinessProbe.httpGet.path | string | `"/health"` | | -| deployment.probes.readinessProbe.httpGet.port | int | `3000` | | -| deployment.probes.readinessProbe.initialDelaySeconds | int | `10` | | -| deployment.probes.readinessProbe.periodSeconds | int | `10` | | -| deployment.probes.readinessProbe.successThreshold | int | `1` | | -| deployment.probes.readinessProbe.timeoutSeconds | int | `5` | | -| deployment.probes.startupProbe.failureThreshold | int | `30` | | -| deployment.probes.startupProbe.periodSeconds | int | `10` | | -| deployment.probes.startupProbe.tcpSocket.port | int | `3000` | | -| deployment.reloadOnChange | bool | `false` | | -| deployment.replicas | int | `1` | | -| deployment.resources.limits.memory | string | `"2Gi"` | | -| deployment.resources.requests.cpu | string | `"1"` | | -| deployment.resources.requests.memory | string | `"1Gi"` | | -| deployment.revisionHistoryLimit | int | `2` | | -| deployment.securityContext | object | `{}` | | -| deployment.strategy.type | string | `"RollingUpdate"` | | -| deployment.tolerations | list | `[]` | | -| deployment.topologySpreadConstraints | list | `[]` | | -| enterprise.enabled | bool | `false` | | -| enterprise.licenseKey | string | `""` | | -| externalSecret.enabled | bool | `false` | | -| externalSecret.files | object | `{}` | | -| externalSecret.refreshInterval | string | `"1h"` | | -| externalSecret.secretStore.kind | string | `"ClusterSecretStore"` | | -| externalSecret.secretStore.name | string | `"aws-secrets-manager"` | | -| ingress.annotations | object | `{}` | | -| ingress.enabled | bool | `false` | | -| ingress.hosts[0].host | string | `"k8s.formbricks.com"` | | -| ingress.hosts[0].paths[0].path | string | `"/"` | | -| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | | -| ingress.hosts[0].paths[0].serviceName | string | `"formbricks"` | | -| ingress.ingressClassName | string | `"alb"` | | -| nameOverride | string | `""` | | -| partOfOverride | string | `""` | | -| postgresql.auth.database | string | `"formbricks"` | | -| postgresql.auth.existingSecret | string | `"formbricks-app-secrets"` | | -| postgresql.auth.secretKeys.adminPasswordKey | string | `"POSTGRES_ADMIN_PASSWORD"` | | -| postgresql.auth.secretKeys.userPasswordKey | string | `"POSTGRES_USER_PASSWORD"` | | -| postgresql.auth.username | string | `"formbricks"` | | -| postgresql.enabled | bool | `true` | | -| postgresql.externalDatabaseUrl | string | `""` | | -| postgresql.fullnameOverride | string | `"formbricks-postgresql"` | | -| postgresql.global.security.allowInsecureImages | bool | `true` | | -| postgresql.image.repository | string | `"pgvector/pgvector"` | | -| postgresql.image.tag | string | `"0.8.0-pg17"` | | -| postgresql.primary.containerSecurityContext.enabled | bool | `true` | | -| postgresql.primary.containerSecurityContext.readOnlyRootFilesystem | bool | `false` | | -| postgresql.primary.containerSecurityContext.runAsUser | int | `1001` | | -| postgresql.primary.networkPolicy.enabled | bool | `false` | | -| postgresql.primary.persistence.enabled | bool | `true` | | -| postgresql.primary.persistence.size | string | `"10Gi"` | | -| postgresql.primary.podSecurityContext.enabled | bool | `true` | | -| postgresql.primary.podSecurityContext.fsGroup | int | `1001` | | -| postgresql.primary.podSecurityContext.runAsUser | int | `1001` | | -| rbac.enabled | bool | `false` | | -| rbac.serviceAccount.additionalLabels | object | `{}` | | -| rbac.serviceAccount.annotations | object | `{}` | | -| rbac.serviceAccount.enabled | bool | `false` | | -| rbac.serviceAccount.name | string | `""` | | -| redis.architecture | string | `"standalone"` | | -| redis.auth.enabled | bool | `true` | | -| redis.auth.existingSecret | string | `"formbricks-app-secrets"` | | -| redis.auth.existingSecretPasswordKey | string | `"REDIS_PASSWORD"` | | -| redis.enabled | bool | `true` | | -| redis.externalRedisUrl | string | `""` | | -| redis.fullnameOverride | string | `"formbricks-redis"` | | -| redis.master.persistence.enabled | bool | `true` | | -| redis.networkPolicy.enabled | bool | `false` | | -| secret.enabled | bool | `true` | | -| service.additionalLabels | object | `{}` | | -| service.annotations | object | `{}` | | -| service.enabled | bool | `true` | | -| service.ports | list | `[]` | | -| service.type | string | `"ClusterIP"` | | -| serviceMonitor.additionalLabels | string | `nil` | | -| serviceMonitor.annotations | string | `nil` | | -| serviceMonitor.enabled | bool | `true` | | -| serviceMonitor.endpoints[0].interval | string | `"5s"` | | -| serviceMonitor.endpoints[0].path | string | `"/metrics"` | | -| serviceMonitor.endpoints[0].port | string | `"metrics"` | | +| Key | Type | Default | Description | +| ------------------------------------------------------------------ | ------ | --------------------------------- | ----------- | +| autoscaling.additionalLabels | object | `{}` | | +| autoscaling.annotations | object | `{}` | | +| autoscaling.enabled | bool | `true` | | +| autoscaling.maxReplicas | int | `10` | | +| autoscaling.metrics[0].resource.name | string | `"cpu"` | | +| autoscaling.metrics[0].resource.target.averageUtilization | int | `60` | | +| autoscaling.metrics[0].resource.target.type | string | `"Utilization"` | | +| autoscaling.metrics[0].type | string | `"Resource"` | | +| autoscaling.metrics[1].resource.name | string | `"memory"` | | +| autoscaling.metrics[1].resource.target.averageUtilization | int | `60` | | +| autoscaling.metrics[1].resource.target.type | string | `"Utilization"` | | +| autoscaling.metrics[1].type | string | `"Resource"` | | +| autoscaling.minReplicas | int | `1` | | +| componentOverride | string | `""` | | +| cronJob.enabled | bool | `false` | | +| cronJob.jobs | object | `{}` | | +| deployment.additionalLabels | object | `{}` | | +| deployment.additionalPodAnnotations | object | `{}` | | +| deployment.additionalPodLabels | object | `{}` | | +| deployment.affinity | object | `{}` | | +| deployment.annotations | object | `{}` | | +| deployment.args | list | `[]` | | +| deployment.command | list | `[]` | | +| deployment.containerSecurityContext.readOnlyRootFilesystem | bool | `true` | | +| deployment.containerSecurityContext.runAsNonRoot | bool | `true` | | +| deployment.env.EMAIL_VERIFICATION_DISABLED.value | string | `"1"` | | +| deployment.env.PASSWORD_RESET_DISABLED.value | string | `"1"` | | +| deployment.envFrom | string | `nil` | | +| deployment.image.digest | string | `""` | | +| deployment.image.pullPolicy | string | `"IfNotPresent"` | | +| deployment.image.repository | string | `"ghcr.io/formbricks/formbricks"` | | +| deployment.imagePullSecrets | string | `""` | | +| deployment.nodeSelector | object | `{}` | | +| deployment.ports.http.containerPort | int | `3000` | | +| deployment.ports.http.exposed | bool | `true` | | +| deployment.ports.http.protocol | string | `"TCP"` | | +| deployment.ports.metrics.containerPort | int | `9464` | | +| deployment.ports.metrics.exposed | bool | `true` | | +| deployment.ports.metrics.protocol | string | `"TCP"` | | +| deployment.probes.livenessProbe.failureThreshold | int | `5` | | +| deployment.probes.livenessProbe.httpGet.path | string | `"/health"` | | +| deployment.probes.livenessProbe.httpGet.port | int | `3000` | | +| deployment.probes.livenessProbe.initialDelaySeconds | int | `10` | | +| deployment.probes.livenessProbe.periodSeconds | int | `10` | | +| deployment.probes.livenessProbe.successThreshold | int | `1` | | +| deployment.probes.livenessProbe.timeoutSeconds | int | `5` | | +| deployment.probes.readinessProbe.failureThreshold | int | `5` | | +| deployment.probes.readinessProbe.httpGet.path | string | `"/health"` | | +| deployment.probes.readinessProbe.httpGet.port | int | `3000` | | +| deployment.probes.readinessProbe.initialDelaySeconds | int | `10` | | +| deployment.probes.readinessProbe.periodSeconds | int | `10` | | +| deployment.probes.readinessProbe.successThreshold | int | `1` | | +| deployment.probes.readinessProbe.timeoutSeconds | int | `5` | | +| deployment.probes.startupProbe.failureThreshold | int | `30` | | +| deployment.probes.startupProbe.periodSeconds | int | `10` | | +| deployment.probes.startupProbe.tcpSocket.port | int | `3000` | | +| deployment.reloadOnChange | bool | `false` | | +| deployment.replicas | int | `1` | | +| deployment.resources.limits.memory | string | `"2Gi"` | | +| deployment.resources.requests.cpu | string | `"1"` | | +| deployment.resources.requests.memory | string | `"1Gi"` | | +| deployment.revisionHistoryLimit | int | `2` | | +| deployment.securityContext | object | `{}` | | +| deployment.strategy.type | string | `"RollingUpdate"` | | +| deployment.tolerations | list | `[]` | | +| deployment.topologySpreadConstraints | list | `[]` | | +| enterprise.enabled | bool | `false` | | +| enterprise.licenseKey | string | `""` | | +| externalSecret.enabled | bool | `false` | | +| externalSecret.files | object | `{}` | | +| externalSecret.refreshInterval | string | `"1h"` | | +| externalSecret.secretStore.kind | string | `"ClusterSecretStore"` | | +| externalSecret.secretStore.name | string | `"aws-secrets-manager"` | | +| ingress.annotations | object | `{}` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"k8s.formbricks.com"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | | +| ingress.hosts[0].paths[0].serviceName | string | `"formbricks"` | | +| ingress.ingressClassName | string | `"alb"` | | +| nameOverride | string | `""` | | +| partOfOverride | string | `""` | | +| postgresql.auth.database | string | `"formbricks"` | | +| postgresql.auth.existingSecret | string | `"formbricks-app-secrets"` | | +| postgresql.auth.secretKeys.adminPasswordKey | string | `"POSTGRES_ADMIN_PASSWORD"` | | +| postgresql.auth.secretKeys.userPasswordKey | string | `"POSTGRES_USER_PASSWORD"` | | +| postgresql.auth.username | string | `"formbricks"` | | +| postgresql.enabled | bool | `true` | | +| postgresql.externalDatabaseUrl | string | `""` | | +| postgresql.fullnameOverride | string | `"formbricks-postgresql"` | | +| postgresql.global.security.allowInsecureImages | bool | `true` | | +| postgresql.image.repository | string | `"pgvector/pgvector"` | | +| postgresql.image.tag | string | `"0.8.0-pg17"` | | +| postgresql.primary.containerSecurityContext.enabled | bool | `true` | | +| postgresql.primary.containerSecurityContext.readOnlyRootFilesystem | bool | `false` | | +| postgresql.primary.containerSecurityContext.runAsUser | int | `1001` | | +| postgresql.primary.networkPolicy.enabled | bool | `false` | | +| postgresql.primary.persistence.enabled | bool | `true` | | +| postgresql.primary.persistence.size | string | `"10Gi"` | | +| postgresql.primary.podSecurityContext.enabled | bool | `true` | | +| postgresql.primary.podSecurityContext.fsGroup | int | `1001` | | +| postgresql.primary.podSecurityContext.runAsUser | int | `1001` | | +| rbac.enabled | bool | `false` | | +| rbac.serviceAccount.additionalLabels | object | `{}` | | +| rbac.serviceAccount.annotations | object | `{}` | | +| rbac.serviceAccount.enabled | bool | `false` | | +| rbac.serviceAccount.name | string | `""` | | +| redis.architecture | string | `"standalone"` | | +| redis.auth.enabled | bool | `true` | | +| redis.auth.existingSecret | string | `"formbricks-app-secrets"` | | +| redis.auth.existingSecretPasswordKey | string | `"REDIS_PASSWORD"` | | +| redis.enabled | bool | `true` | | +| redis.externalRedisUrl | string | `""` | | +| redis.fullnameOverride | string | `"formbricks-redis"` | | +| redis.master.persistence.enabled | bool | `true` | | +| redis.networkPolicy.enabled | bool | `false` | | +| secret.enabled | bool | `true` | | +| service.additionalLabels | object | `{}` | | +| service.annotations | object | `{}` | | +| service.enabled | bool | `true` | | +| service.ports | list | `[]` | | +| service.type | string | `"ClusterIP"` | | +| serviceMonitor.additionalLabels | string | `nil` | | +| serviceMonitor.annotations | string | `nil` | | +| serviceMonitor.enabled | bool | `true` | | +| serviceMonitor.endpoints[0].interval | string | `"5s"` | | +| serviceMonitor.endpoints[0].path | string | `"/metrics"` | | +| serviceMonitor.endpoints[0].port | string | `"metrics"` | | + +--- ----------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/packages/cache/.cursor/rules/cache-package.md b/packages/cache/.cursor/rules/cache-package.md index ca06700d1e..4376c73cc9 100644 --- a/packages/cache/.cursor/rules/cache-package.md +++ b/packages/cache/.cursor/rules/cache-package.md @@ -3,6 +3,7 @@ ## Core Principles ### Redis-Only Architecture + - **Mandatory Redis**: All deployments MUST use Redis via `REDIS_URL` environment variable - **Singleton Client**: Use `getCacheService()` - returns singleton instance per process using `globalThis` - **Result Types**: Core operations return `Result` for explicit error handling @@ -10,6 +11,7 @@ - **Cross-Platform**: Uses `globalThis` for Edge Runtime, Lambda, and HMR compatibility ### Type Safety & Validation + - **Branded Cache Keys**: Use `CacheKey` type to prevent raw string usage - **Runtime Validation**: Use `validateInputs()` function with Zod schemas - **Error Codes**: Use `ErrorCode` enum for consistent error categorization @@ -38,9 +40,17 @@ types/ ## Required Patterns ### globalThis Singleton Pattern + ```typescript // ✅ GOOD - Use globalThis singleton client import { getCacheService } from "@formbricks/cache"; +// ✅ GOOD - Production validation (index.ts) +import { validateRedisConfig } from "@formbricks/cache"; +// Throws if REDIS_URL missing in production + +// ❌ BAD - CacheService class not exported for direct instantiation +import { CacheService } from "@formbricks/cache"; + const result = await getCacheService(); if (!result.ok) { // Handle initialization error - Redis connection failed @@ -49,15 +59,13 @@ if (!result.ok) { } const cacheService = result.data; -// ✅ GOOD - Production validation (index.ts) -import { validateRedisConfig } from "@formbricks/cache"; validateRedisConfig(); // Throws if REDIS_URL missing in production -// ❌ BAD - CacheService class not exported for direct instantiation -import { CacheService } from "@formbricks/cache"; // Won't work! +// Won't work! ``` ### Result Type Error Handling + ```typescript // ✅ GOOD - Core operations return Result const result = await cacheService.get(key); @@ -85,21 +93,27 @@ logger.warn({ error }, "Cache unavailable; executing function directly"); ``` ### Core Validation & Error Types + ```typescript // Unified error interface -interface CacheError { code: ErrorCode; } +interface CacheError { + code: ErrorCode; +} enum ErrorCode { Unknown = "unknown", - CacheValidationError = "cache_validation_error", + CacheValidationError = "cache_validation_error", RedisConnectionError = "redis_connection_error", RedisOperationError = "redis_operation_error", CacheCorruptionError = "cache_corruption_error", } // Key validation: min 1 char, non-whitespace -export const ZCacheKey = z.string().min(1).refine(k => k.trim().length > 0); -// TTL validation: min 1000ms for Redis seconds conversion +export const ZCacheKey = z + .string() + .min(1) + .refine((k) => k.trim().length > 0); +// TTL validation: min 1000ms for Redis seconds conversion export const ZTtlMs = z.number().int().min(1000).finite(); // Generic validation function (returns array of validated values) @@ -109,6 +123,7 @@ export function validateInputs(...pairs: [unknown, ZodType][]): Result` - true if Redis is available and responsive - Used for health monitoring, status checks, and external validation ### Service Implementation - Cognitive Complexity Reduction + The `withCache` method is split into helper methods to reduce cognitive complexity: ```typescript @@ -172,7 +191,7 @@ async withCache(fn: () => Promise, key: CacheKey, ttlMs: number): Promise< // Early returns for Redis availability and validation const cachedValue = await this.tryGetCachedValue(key, ttlMs); if (cachedValue !== undefined) return cachedValue; - + const fresh = await fn(); await this.trySetCache(key, fresh, ttlMs); return fresh; @@ -186,6 +205,7 @@ private async trySetCache(key, value, ttlMs): Promise ## Null vs Undefined Handling ### Caching Behavior + - **`null` values**: Cached normally (represents intentional absence) - **`undefined` values**: NOT cached (preserves JavaScript semantics) - **Cache miss**: Returns `null` (Redis returns null for missing keys) @@ -198,7 +218,7 @@ const nullResult = await cacheService.withCache( ttl ); // Returns null, value is cached -// ✅ GOOD - Undefined values are NOT cached +// ✅ GOOD - Undefined values are NOT cached const undefinedResult = await cacheService.withCache( () => Promise.resolve(undefined), // Undefined result key, @@ -220,6 +240,7 @@ if (result.ok && result.data === null) { ## Logging Standards ### Error Logging Strategy + - **Detailed logging at source** - Log full context where errors occur - **Clean Result objects** - Only error codes in Result, not messages - **Level strategy**: @@ -231,10 +252,10 @@ if (result.ok && result.data === null) { ```typescript // ✅ GOOD - Rich logging, clean Result -logger.error("Cache validation failed", { - value, +logger.error("Cache validation failed", { + value, error: "TTL must be at least 1000ms", - validationErrors: [...] + validationErrors: [...] }); return err({ code: ErrorCode.CacheValidationError }); @@ -245,14 +266,16 @@ return await fn(); // Always return function result ## Testing Patterns -### Unit Tests (*.test.ts) +### Unit Tests (\*.test.ts) + - **Result error cases**: Validation, Redis, corruption errors - **Null vs undefined**: Caching behavior differences -- **withCache fallbacks**: Cache failures gracefully handled +- **withCache fallbacks**: Cache failures gracefully handled - **Edge cases**: Empty arrays, invalid TTLs, malformed keys - **Mock dependencies**: Redis client, logger with all levels ### Integration Tests (cache-integration.test.ts) + - **End-to-End Redis Operations**: Tests against live Redis instance - **Auto-Skip Logic**: Automatically skips when Redis unavailable (`REDIS_URL` not set) - **Comprehensive Coverage**: All cache operations through real code paths @@ -284,6 +307,7 @@ describe("Cache Integration Tests", () => { ## Web App Integration Pattern ### Cache Facade (apps/web/lib/cache/index.ts) + The web app uses a simplified Proxy-based facade that calls `getCacheService()` directly: ```typescript @@ -306,6 +330,7 @@ const redis = await cache.getRedisClient(); ``` ### Proxy Implementation + - **Lazy Initialization**: Calls `getCacheService()` for each operation via Proxy - **Graceful Degradation**: `withCache` falls back to direct execution on cache failure - **Server-Only**: Uses "server-only" import to prevent client-side usage @@ -314,6 +339,7 @@ const redis = await cache.getRedisClient(); ## Architecture Updates ### globalThis Singleton (client.ts) + ```typescript // Cross-platform singleton using globalThis (not global) const globalForCache = globalThis as unknown as { @@ -326,6 +352,7 @@ export async function getCacheService(): Promise` - no throwing +2. **Result Types**: Core ops return `Result` - no throwing 3. **Never-Failing withCache**: Returns `T` directly, handles cache errors internally 4. **Standardized Redis Check**: Use `isRedisAvailable()` method with ping test 5. **Structured Logging**: Context object first, then message string @@ -343,4 +370,4 @@ export async function getCacheService(): Promise void; diff --git a/packages/surveys/src/components/general/cal-embed.tsx b/packages/surveys/src/components/general/cal-embed.tsx index 7d8b4612d4..e93ac0fb99 100644 --- a/packages/surveys/src/components/general/cal-embed.tsx +++ b/packages/surveys/src/components/general/cal-embed.tsx @@ -1,7 +1,7 @@ -import { cn } from "@/lib/utils"; import snippet from "@calcom/embed-snippet"; import { useEffect, useMemo } from "preact/hooks"; import { type TSurveyCalQuestion } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/utils"; interface CalEmbedProps { question: TSurveyCalQuestion; diff --git a/packages/surveys/src/components/general/ending-card.tsx b/packages/surveys/src/components/general/ending-card.tsx index e4a8ee8597..2f0fadeeaa 100644 --- a/packages/surveys/src/components/general/ending-card.tsx +++ b/packages/surveys/src/components/general/ending-card.tsx @@ -1,3 +1,8 @@ +import { useEffect } from "preact/hooks"; +import { useTranslation } from "react-i18next"; +import { type TJsEnvironmentStateSurvey } from "@formbricks/types/js"; +import { type TResponseData, type TResponseVariables } from "@formbricks/types/responses"; +import { type TSurveyEndScreenCard, type TSurveyRedirectUrlCard } from "@formbricks/types/surveys/types"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; import { LoadingSpinner } from "@/components/general/loading-spinner"; @@ -6,11 +11,6 @@ import { Subheader } from "@/components/general/subheader"; import { ScrollableContainer } from "@/components/wrappers/scrollable-container"; import { getLocalizedValue } from "@/lib/i18n"; import { replaceRecallInfo } from "@/lib/recall"; -import { useEffect } from "preact/hooks"; -import { useTranslation } from "react-i18next"; -import { type TJsEnvironmentStateSurvey } from "@formbricks/types/js"; -import { type TResponseData, type TResponseVariables } from "@formbricks/types/responses"; -import { type TSurveyEndScreenCard, type TSurveyRedirectUrlCard } from "@formbricks/types/surveys/types"; interface EndingCardProps { survey: TJsEnvironmentStateSurvey; diff --git a/packages/surveys/src/components/general/error-component.test.tsx b/packages/surveys/src/components/general/error-component.test.tsx index 7cfa6f1015..0041e3ab19 100644 --- a/packages/surveys/src/components/general/error-component.test.tsx +++ b/packages/surveys/src/components/general/error-component.test.tsx @@ -1,7 +1,7 @@ -import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/preact"; import { afterEach, describe, expect, test } from "vitest"; +import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import { ErrorComponent } from "./error-component"; describe("ErrorComponent", () => { diff --git a/packages/surveys/src/components/general/error-component.tsx b/packages/surveys/src/components/general/error-component.tsx index d00fe4de3e..1254ae0aa1 100644 --- a/packages/surveys/src/components/general/error-component.tsx +++ b/packages/surveys/src/components/general/error-component.tsx @@ -1,5 +1,5 @@ -import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import { useTranslation } from "react-i18next"; +import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; interface ErrorComponentProps { readonly errorType: TResponseErrorCodesEnum.RecaptchaError | TResponseErrorCodesEnum.InvalidDeviceError; diff --git a/packages/surveys/src/components/general/file-input.tsx b/packages/surveys/src/components/general/file-input.tsx index d95378e49f..9ffaef5001 100644 --- a/packages/surveys/src/components/general/file-input.tsx +++ b/packages/surveys/src/components/general/file-input.tsx @@ -1,12 +1,12 @@ -import { FILE_PICK_EVENT } from "@/lib/constants"; -import { getOriginalFileNameFromUrl } from "@/lib/storage"; -import { getMimeType, isFulfilled, isRejected } from "@/lib/utils"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import { useCallback, useEffect, useMemo, useState } from "preact/hooks"; import { type JSXInternal } from "preact/src/jsx"; import { useTranslation } from "react-i18next"; import { type TJsFileUploadParams } from "@formbricks/types/js"; import { TAllowedFileExtension, type TUploadFileConfig, mimeTypes } from "@formbricks/types/storage"; +import { FILE_PICK_EVENT } from "@/lib/constants"; +import { getOriginalFileNameFromUrl } from "@/lib/storage"; +import { getMimeType, isFulfilled, isRejected } from "@/lib/utils"; interface FileInputProps { allowedFileExtensions?: TAllowedFileExtension[]; diff --git a/packages/surveys/src/components/general/input.tsx b/packages/surveys/src/components/general/input.tsx index a7c408ad7b..6458c5a832 100644 --- a/packages/surveys/src/components/general/input.tsx +++ b/packages/surveys/src/components/general/input.tsx @@ -1,5 +1,5 @@ -import { cn } from "@/lib/utils"; import { InputHTMLAttributes, forwardRef } from "preact/compat"; +import { cn } from "@/lib/utils"; export interface InputProps extends InputHTMLAttributes { className?: string; diff --git a/packages/surveys/src/components/general/language-switch.tsx b/packages/surveys/src/components/general/language-switch.tsx index db879e3446..88e2b74936 100644 --- a/packages/surveys/src/components/general/language-switch.tsx +++ b/packages/surveys/src/components/general/language-switch.tsx @@ -1,14 +1,14 @@ +import { useRef, useState } from "preact/hooks"; +import { useTranslation } from "react-i18next"; +import { getLanguageLabel } from "@formbricks/i18n-utils/src"; +import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; +import { type TSurveyLanguage } from "@formbricks/types/surveys/types"; import { LanguageIcon } from "@/components/icons/language-icon"; import { mixColor } from "@/lib/color"; import { getI18nLanguage } from "@/lib/i18n-utils"; import i18n from "@/lib/i18n.config"; import { useClickOutside } from "@/lib/use-click-outside-hook"; import { checkIfSurveyIsRTL, cn } from "@/lib/utils"; -import { useRef, useState } from "preact/hooks"; -import { useTranslation } from "react-i18next"; -import { getLanguageLabel } from "@formbricks/i18n-utils/src"; -import { TJsEnvironmentStateSurvey } from "@formbricks/types/js"; -import { type TSurveyLanguage } from "@formbricks/types/surveys/types"; interface LanguageSwitchProps { survey: TJsEnvironmentStateSurvey; diff --git a/packages/surveys/src/components/general/progress-bar.tsx b/packages/surveys/src/components/general/progress-bar.tsx index 100a99c0a4..b5a699357e 100644 --- a/packages/surveys/src/components/general/progress-bar.tsx +++ b/packages/surveys/src/components/general/progress-bar.tsx @@ -1,8 +1,8 @@ -import { Progress } from "@/components/general/progress"; -import { calculateElementIdx } from "@/lib/utils"; import { useCallback, useMemo } from "preact/hooks"; import { type TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { type TSurveyQuestionId } from "@formbricks/types/surveys/types"; +import { Progress } from "@/components/general/progress"; +import { calculateElementIdx } from "@/lib/utils"; interface ProgressBarProps { survey: TJsEnvironmentStateSurvey; diff --git a/packages/surveys/src/components/general/question-conditional.tsx b/packages/surveys/src/components/general/question-conditional.tsx index 9b29c27a8e..a77ab8bfcb 100644 --- a/packages/surveys/src/components/general/question-conditional.tsx +++ b/packages/surveys/src/components/general/question-conditional.tsx @@ -1,3 +1,13 @@ +import { useEffect } from "react"; +import { type TJsFileUploadParams } from "@formbricks/types/js"; +import { type TResponseData, type TResponseDataValue, type TResponseTtc } from "@formbricks/types/responses"; +import { type TUploadFileConfig } from "@formbricks/types/storage"; +import { + type TSurveyQuestion, + type TSurveyQuestionChoice, + type TSurveyQuestionId, + TSurveyQuestionTypeEnum, +} from "@formbricks/types/surveys/types"; import { AddressQuestion } from "@/components/questions/address-question"; import { CalQuestion } from "@/components/questions/cal-question"; import { ConsentQuestion } from "@/components/questions/consent-question"; @@ -14,16 +24,6 @@ import { PictureSelectionQuestion } from "@/components/questions/picture-selecti import { RankingQuestion } from "@/components/questions/ranking-question"; import { RatingQuestion } from "@/components/questions/rating-question"; import { getLocalizedValue } from "@/lib/i18n"; -import { useEffect } from "react"; -import { type TJsFileUploadParams } from "@formbricks/types/js"; -import { type TResponseData, type TResponseDataValue, type TResponseTtc } from "@formbricks/types/responses"; -import { type TUploadFileConfig } from "@formbricks/types/storage"; -import { - type TSurveyQuestion, - type TSurveyQuestionChoice, - type TSurveyQuestionId, - TSurveyQuestionTypeEnum, -} from "@formbricks/types/surveys/types"; interface QuestionConditionalProps { question: TSurveyQuestion; diff --git a/packages/surveys/src/components/general/question-media.test.tsx b/packages/surveys/src/components/general/question-media.test.tsx index eb1361a6f2..da5a6fce57 100644 --- a/packages/surveys/src/components/general/question-media.test.tsx +++ b/packages/surveys/src/components/general/question-media.test.tsx @@ -1,6 +1,6 @@ -import { convertToEmbedUrl } from "@/lib/video-upload"; import { cleanup, render, screen } from "@testing-library/preact"; import { afterEach, describe, expect, test } from "vitest"; +import { convertToEmbedUrl } from "@/lib/video-upload"; import { QuestionMedia } from "./question-media"; describe("QuestionMedia", () => { diff --git a/packages/surveys/src/components/general/question-media.tsx b/packages/surveys/src/components/general/question-media.tsx index 59be6fa7b0..f2fee3d9af 100644 --- a/packages/surveys/src/components/general/question-media.tsx +++ b/packages/surveys/src/components/general/question-media.tsx @@ -1,9 +1,9 @@ +import { useState } from "preact/hooks"; +import { useTranslation } from "react-i18next"; import { ExpandIcon } from "@/components/icons/expand-icon"; import { ImageDownIcon } from "@/components/icons/image-down-icon"; import { cn } from "@/lib/utils"; import { checkForLoomUrl, checkForVimeoUrl, checkForYoutubeUrl, convertToEmbedUrl } from "@/lib/video-upload"; -import { useState } from "preact/hooks"; -import { useTranslation } from "react-i18next"; //Function to add extra params to videoUrls in order to reduce video controls const getVideoUrlWithParams = (videoUrl: string): string => { diff --git a/packages/surveys/src/components/general/render-survey.tsx b/packages/surveys/src/components/general/render-survey.tsx index a89b6b11d9..e3bed61a2b 100644 --- a/packages/surveys/src/components/general/render-survey.tsx +++ b/packages/surveys/src/components/general/render-survey.tsx @@ -1,6 +1,6 @@ -import { checkIfSurveyIsRTL } from "@/lib/utils"; import { useEffect, useRef, useState } from "react"; import { SurveyContainerProps } from "@formbricks/types/formbricks-surveys"; +import { checkIfSurveyIsRTL } from "@/lib/utils"; import { SurveyContainer } from "../wrappers/survey-container"; import { Survey } from "./survey"; diff --git a/packages/surveys/src/components/general/response-error-component.tsx b/packages/surveys/src/components/general/response-error-component.tsx index 7457474d37..799767bcf3 100644 --- a/packages/surveys/src/components/general/response-error-component.tsx +++ b/packages/surveys/src/components/general/response-error-component.tsx @@ -1,8 +1,8 @@ -import { SubmitButton } from "@/components/buttons/submit-button"; -import { processResponseData } from "@/lib/response"; import { useTranslation } from "react-i18next"; import { type TResponseData } from "@formbricks/types/responses"; import { type TSurveyQuestion } from "@formbricks/types/surveys/types"; +import { SubmitButton } from "@/components/buttons/submit-button"; +import { processResponseData } from "@/lib/response"; interface ResponseErrorComponentProps { questions: TSurveyQuestion[]; diff --git a/packages/surveys/src/components/general/survey-close-button.tsx b/packages/surveys/src/components/general/survey-close-button.tsx index 9d56002a57..ed4179419d 100644 --- a/packages/surveys/src/components/general/survey-close-button.tsx +++ b/packages/surveys/src/components/general/survey-close-button.tsx @@ -1,8 +1,8 @@ +import { useState } from "preact/hooks"; +import { useTranslation } from "react-i18next"; import { CloseIcon } from "@/components/icons/close-icon"; import { mixColor } from "@/lib/color"; import { cn } from "@/lib/utils"; -import { useState } from "preact/hooks"; -import { useTranslation } from "react-i18next"; interface SurveyCloseButtonProps { onClose?: () => void; diff --git a/packages/surveys/src/components/questions/address-question.test.tsx b/packages/surveys/src/components/questions/address-question.test.tsx index 280fc8ce20..35f56d6880 100644 --- a/packages/surveys/src/components/questions/address-question.test.tsx +++ b/packages/surveys/src/components/questions/address-question.test.tsx @@ -1,9 +1,9 @@ -import { getUpdatedTtc } from "@/lib/ttc"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/preact"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { type TSurveyAddressQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getUpdatedTtc } from "@/lib/ttc"; import { AddressQuestion } from "./address-question"; vi.mock("@/lib/i18n", () => ({ diff --git a/packages/surveys/src/components/questions/address-question.tsx b/packages/surveys/src/components/questions/address-question.tsx index d8191d22cd..2d073a58a4 100644 --- a/packages/surveys/src/components/questions/address-question.tsx +++ b/packages/surveys/src/components/questions/address-question.tsx @@ -1,3 +1,7 @@ +import { useMemo, useRef, useState } from "preact/hooks"; +import { useCallback } from "react"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import type { TSurveyAddressQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; @@ -8,10 +12,6 @@ import { Subheader } from "@/components/general/subheader"; import { ScrollableContainer } from "@/components/wrappers/scrollable-container"; import { getLocalizedValue } from "@/lib/i18n"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; -import { useMemo, useRef, useState } from "preact/hooks"; -import { useCallback } from "react"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import type { TSurveyAddressQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; interface AddressQuestionProps { question: TSurveyAddressQuestion; diff --git a/packages/surveys/src/components/questions/cal-question.tsx b/packages/surveys/src/components/questions/cal-question.tsx index 4d8901ccb8..c8f0d1305d 100644 --- a/packages/surveys/src/components/questions/cal-question.tsx +++ b/packages/surveys/src/components/questions/cal-question.tsx @@ -1,3 +1,7 @@ +import { useCallback, useRef, useState } from "preact/hooks"; +import { useTranslation } from "react-i18next"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import { type TSurveyCalQuestion, type TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { CalEmbed } from "@/components/general/cal-embed"; @@ -10,10 +14,6 @@ import { } from "@/components/wrappers/scrollable-container"; import { getLocalizedValue } from "@/lib/i18n"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; -import { useCallback, useRef, useState } from "preact/hooks"; -import { useTranslation } from "react-i18next"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import { type TSurveyCalQuestion, type TSurveyQuestionId } from "@formbricks/types/surveys/types"; interface CalQuestionProps { question: TSurveyCalQuestion; diff --git a/packages/surveys/src/components/questions/contact-info-question.test.tsx b/packages/surveys/src/components/questions/contact-info-question.test.tsx index 8fd3774816..21ef0eb485 100644 --- a/packages/surveys/src/components/questions/contact-info-question.test.tsx +++ b/packages/surveys/src/components/questions/contact-info-question.test.tsx @@ -1,9 +1,9 @@ -import { getUpdatedTtc } from "@/lib/ttc"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/preact"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { type TSurveyContactInfoQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getUpdatedTtc } from "@/lib/ttc"; import { ContactInfoQuestion } from "./contact-info-question"; vi.mock("@/lib/i18n", () => ({ diff --git a/packages/surveys/src/components/questions/contact-info-question.tsx b/packages/surveys/src/components/questions/contact-info-question.tsx index 9a519e1b4e..535bb7d129 100644 --- a/packages/surveys/src/components/questions/contact-info-question.tsx +++ b/packages/surveys/src/components/questions/contact-info-question.tsx @@ -1,3 +1,6 @@ +import { useCallback, useMemo, useRef, useState } from "preact/hooks"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import type { TSurveyContactInfoQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; @@ -8,9 +11,6 @@ import { Subheader } from "@/components/general/subheader"; import { ScrollableContainer } from "@/components/wrappers/scrollable-container"; import { getLocalizedValue } from "@/lib/i18n"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; -import { useCallback, useMemo, useRef, useState } from "preact/hooks"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import type { TSurveyContactInfoQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; interface ContactInfoQuestionProps { question: TSurveyContactInfoQuestion; diff --git a/packages/surveys/src/components/questions/date-question.tsx b/packages/surveys/src/components/questions/date-question.tsx index 59917da2ae..8f27aa1026 100644 --- a/packages/surveys/src/components/questions/date-question.tsx +++ b/packages/surveys/src/components/questions/date-question.tsx @@ -1,3 +1,9 @@ +import { useEffect, useMemo, useState } from "preact/hooks"; +import DatePicker from "react-date-picker"; +import { DatePickerProps } from "react-date-picker"; +import { useTranslation } from "react-i18next"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import type { TSurveyDateQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; @@ -8,12 +14,6 @@ import { getMonthName, getOrdinalDate } from "@/lib/date-time"; import { getLocalizedValue } from "@/lib/i18n"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; import { cn } from "@/lib/utils"; -import { useEffect, useMemo, useState } from "preact/hooks"; -import DatePicker from "react-date-picker"; -import { DatePickerProps } from "react-date-picker"; -import { useTranslation } from "react-i18next"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import type { TSurveyDateQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import "../../styles/date-picker.css"; interface DateQuestionProps { diff --git a/packages/surveys/src/components/questions/file-upload-question.tsx b/packages/surveys/src/components/questions/file-upload-question.tsx index c8c62ce857..c15b56adf6 100644 --- a/packages/surveys/src/components/questions/file-upload-question.tsx +++ b/packages/surveys/src/components/questions/file-upload-question.tsx @@ -1,15 +1,15 @@ -import { SubmitButton } from "@/components/buttons/submit-button"; -import { Headline } from "@/components/general/headline"; -import { QuestionMedia } from "@/components/general/question-media"; -import { ScrollableContainer } from "@/components/wrappers/scrollable-container"; -import { getLocalizedValue } from "@/lib/i18n"; -import { getUpdatedTtc, useTtc } from "@/lib/ttc"; import { useState } from "preact/hooks"; import { useTranslation } from "react-i18next"; import { type TJsFileUploadParams } from "@formbricks/types/js"; import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; import { type TUploadFileConfig } from "@formbricks/types/storage"; import type { TSurveyFileUploadQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; +import { SubmitButton } from "@/components/buttons/submit-button"; +import { Headline } from "@/components/general/headline"; +import { QuestionMedia } from "@/components/general/question-media"; +import { ScrollableContainer } from "@/components/wrappers/scrollable-container"; +import { getLocalizedValue } from "@/lib/i18n"; +import { getUpdatedTtc, useTtc } from "@/lib/ttc"; import { BackButton } from "../buttons/back-button"; import { FileInput } from "../general/file-input"; import { Subheader } from "../general/subheader"; diff --git a/packages/surveys/src/components/questions/matrix-question.test.tsx b/packages/surveys/src/components/questions/matrix-question.test.tsx index 67fc288caf..d37e498964 100644 --- a/packages/surveys/src/components/questions/matrix-question.test.tsx +++ b/packages/surveys/src/components/questions/matrix-question.test.tsx @@ -1,9 +1,9 @@ -import { getShuffledRowIndices } from "@/lib/utils"; import "@testing-library/jest-dom/vitest"; import { cleanup, render, screen } from "@testing-library/preact"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { type TSurveyMatrixQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getShuffledRowIndices } from "@/lib/utils"; import { MatrixQuestion } from "./matrix-question"; // Mock dependencies diff --git a/packages/surveys/src/components/questions/nps-question.test.tsx b/packages/surveys/src/components/questions/nps-question.test.tsx index 8f3837f440..3cd8283ebd 100644 --- a/packages/surveys/src/components/questions/nps-question.test.tsx +++ b/packages/surveys/src/components/questions/nps-question.test.tsx @@ -1,10 +1,10 @@ -import { getUpdatedTtc } from "@/lib/ttc"; import "@testing-library/jest-dom/vitest"; import { cleanup, fireEvent, render, screen } from "@testing-library/preact"; import userEvent from "@testing-library/user-event"; import { afterEach, describe, expect, test, vi } from "vitest"; import { type TResponseTtc } from "@formbricks/types/responses"; import { type TSurveyNPSQuestion, TSurveyQuestionTypeEnum } from "@formbricks/types/surveys/types"; +import { getUpdatedTtc } from "@/lib/ttc"; import { NPSQuestion } from "./nps-question"; vi.mock("@/lib/i18n", () => ({ diff --git a/packages/surveys/src/components/questions/nps-question.tsx b/packages/surveys/src/components/questions/nps-question.tsx index 4f9b0fca85..2f792c2e4d 100644 --- a/packages/surveys/src/components/questions/nps-question.tsx +++ b/packages/surveys/src/components/questions/nps-question.tsx @@ -1,3 +1,6 @@ +import { useState } from "preact/hooks"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import type { TSurveyNPSQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; @@ -7,9 +10,6 @@ import { ScrollableContainer } from "@/components/wrappers/scrollable-container" import { getLocalizedValue } from "@/lib/i18n"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; import { cn } from "@/lib/utils"; -import { useState } from "preact/hooks"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import type { TSurveyNPSQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; interface NPSQuestionProps { question: TSurveyNPSQuestion; diff --git a/packages/surveys/src/components/questions/picture-selection-question.tsx b/packages/surveys/src/components/questions/picture-selection-question.tsx index a9e9b4872f..d535f15cca 100644 --- a/packages/surveys/src/components/questions/picture-selection-question.tsx +++ b/packages/surveys/src/components/questions/picture-selection-question.tsx @@ -1,3 +1,7 @@ +import { useEffect, useState } from "preact/hooks"; +import { useTranslation } from "react-i18next"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import type { TSurveyPictureSelectionQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; @@ -9,10 +13,6 @@ import { getLocalizedValue } from "@/lib/i18n"; import { getOriginalFileNameFromUrl } from "@/lib/storage"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; import { cn } from "@/lib/utils"; -import { useEffect, useState } from "preact/hooks"; -import { useTranslation } from "react-i18next"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import type { TSurveyPictureSelectionQuestion, TSurveyQuestionId } from "@formbricks/types/surveys/types"; interface PictureSelectionProps { question: TSurveyPictureSelectionQuestion; diff --git a/packages/surveys/src/components/questions/rating-question.tsx b/packages/surveys/src/components/questions/rating-question.tsx index 2a4e7833ef..c8b663ce5e 100644 --- a/packages/surveys/src/components/questions/rating-question.tsx +++ b/packages/surveys/src/components/questions/rating-question.tsx @@ -1,3 +1,7 @@ +import { useEffect, useState } from "preact/hooks"; +import type { JSX } from "react"; +import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; +import type { TSurveyQuestionId, TSurveyRatingQuestion } from "@formbricks/types/surveys/types"; import { BackButton } from "@/components/buttons/back-button"; import { SubmitButton } from "@/components/buttons/submit-button"; import { Headline } from "@/components/general/headline"; @@ -6,10 +10,6 @@ import { ScrollableContainer } from "@/components/wrappers/scrollable-container" import { getLocalizedValue } from "@/lib/i18n"; import { getUpdatedTtc, useTtc } from "@/lib/ttc"; import { cn } from "@/lib/utils"; -import { useEffect, useState } from "preact/hooks"; -import type { JSX } from "react"; -import { type TResponseData, type TResponseTtc } from "@formbricks/types/responses"; -import type { TSurveyQuestionId, TSurveyRatingQuestion } from "@formbricks/types/surveys/types"; import { ConfusedFace, FrowningFace, diff --git a/packages/surveys/src/components/wrappers/auto-close-wrapper.test.tsx b/packages/surveys/src/components/wrappers/auto-close-wrapper.test.tsx index 82aaf88573..67b2b8e871 100644 --- a/packages/surveys/src/components/wrappers/auto-close-wrapper.test.tsx +++ b/packages/surveys/src/components/wrappers/auto-close-wrapper.test.tsx @@ -1,6 +1,6 @@ -import { AutoCloseProgressBar } from "@/components/general/auto-close-progress-bar"; import { cleanup, fireEvent, render } from "@testing-library/preact"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; +import { AutoCloseProgressBar } from "@/components/general/auto-close-progress-bar"; import { AutoCloseWrapper } from "./auto-close-wrapper"; // Mock the AutoCloseProgressBar component diff --git a/packages/surveys/src/components/wrappers/auto-close-wrapper.tsx b/packages/surveys/src/components/wrappers/auto-close-wrapper.tsx index 82abcbeca2..975cb434a7 100644 --- a/packages/surveys/src/components/wrappers/auto-close-wrapper.tsx +++ b/packages/surveys/src/components/wrappers/auto-close-wrapper.tsx @@ -1,8 +1,8 @@ -import { AutoCloseProgressBar } from "@/components/general/auto-close-progress-bar"; import React from "preact/compat"; import { useEffect, useMemo, useRef, useState } from "preact/hooks"; import { useTranslation } from "react-i18next"; import { type TJsEnvironmentStateSurvey } from "@formbricks/types/js"; +import { AutoCloseProgressBar } from "@/components/general/auto-close-progress-bar"; interface AutoCloseProps { survey: TJsEnvironmentStateSurvey; diff --git a/packages/surveys/src/components/wrappers/scrollable-container.tsx b/packages/surveys/src/components/wrappers/scrollable-container.tsx index 2ef8a8e712..c6365aa638 100644 --- a/packages/surveys/src/components/wrappers/scrollable-container.tsx +++ b/packages/surveys/src/components/wrappers/scrollable-container.tsx @@ -1,7 +1,7 @@ -import { cn } from "@/lib/utils"; import type { JSX, Ref } from "preact"; import { forwardRef } from "preact/compat"; import { useEffect, useImperativeHandle, useRef, useState } from "preact/hooks"; +import { cn } from "@/lib/utils"; interface ScrollableContainerProps { children: JSX.Element; diff --git a/packages/surveys/src/components/wrappers/stacked-cards-container.tsx b/packages/surveys/src/components/wrappers/stacked-cards-container.tsx index 0cf62e2e23..9409024674 100644 --- a/packages/surveys/src/components/wrappers/stacked-cards-container.tsx +++ b/packages/surveys/src/components/wrappers/stacked-cards-container.tsx @@ -1,10 +1,10 @@ -import { cn } from "@/lib/utils"; import { useEffect, useMemo, useRef, useState } from "preact/hooks"; import type { JSX } from "react"; import { type TJsEnvironmentStateSurvey } from "@formbricks/types/js"; import { type TProjectStyling } from "@formbricks/types/project"; import { type TCardArrangementOptions } from "@formbricks/types/styling"; import { type TSurveyQuestionId, type TSurveyStyling } from "@formbricks/types/surveys/types"; +import { cn } from "@/lib/utils"; import { StackedCard } from "./stacked-card"; // offset = 0 -> Current question card diff --git a/packages/surveys/src/components/wrappers/survey-container.tsx b/packages/surveys/src/components/wrappers/survey-container.tsx index 9ac7da6a1c..557bfed417 100644 --- a/packages/surveys/src/components/wrappers/survey-container.tsx +++ b/packages/surveys/src/components/wrappers/survey-container.tsx @@ -1,6 +1,6 @@ -import { cn } from "@/lib/utils"; import { useEffect, useRef } from "preact/hooks"; import { type TPlacement } from "@formbricks/types/common"; +import { cn } from "@/lib/utils"; interface SurveyContainerProps { mode: "modal" | "inline"; diff --git a/packages/surveys/src/index.ts b/packages/surveys/src/index.ts index 30ed456511..f7c59554f8 100644 --- a/packages/surveys/src/index.ts +++ b/packages/surveys/src/index.ts @@ -1,10 +1,10 @@ +import { h, render } from "preact"; +import { SurveyContainerProps } from "@formbricks/types/formbricks-surveys"; import { RenderSurvey } from "@/components/general/render-survey"; import { I18nProvider } from "@/components/i18n/provider"; import { FILE_PICK_EVENT } from "@/lib/constants"; import { getI18nLanguage } from "@/lib/i18n-utils"; import { addCustomThemeToDom, addStylesToDom } from "@/lib/styles"; -import { h, render } from "preact"; -import { SurveyContainerProps } from "@formbricks/types/formbricks-surveys"; export const renderSurveyInline = (props: SurveyContainerProps) => { const inlineProps: SurveyContainerProps = { diff --git a/packages/surveys/src/lib/api-client.ts b/packages/surveys/src/lib/api-client.ts index 911d053d83..825a5f01e4 100644 --- a/packages/surveys/src/lib/api-client.ts +++ b/packages/surveys/src/lib/api-client.ts @@ -1,10 +1,10 @@ -import { makeRequest } from "@/lib/utils"; import { TDisplayCreateInput } from "@formbricks/types/displays"; import { Result } from "@formbricks/types/error-handlers"; import { ApiErrorResponse } from "@formbricks/types/errors"; import { TSurveyQuotaAction } from "@formbricks/types/quota"; import { TResponseInput, TResponseUpdateInput } from "@formbricks/types/responses"; import { TUploadFileConfig, TUploadFileResponse } from "@formbricks/types/storage"; +import { makeRequest } from "@/lib/utils"; type TResponseCreateResponseQuotaFull = { quotaFull: true; diff --git a/packages/surveys/src/lib/response-queue.ts b/packages/surveys/src/lib/response-queue.ts index 699523ce92..7a4d0dd006 100644 --- a/packages/surveys/src/lib/response-queue.ts +++ b/packages/surveys/src/lib/response-queue.ts @@ -1,9 +1,9 @@ -import { RECAPTCHA_VERIFICATION_ERROR_CODE } from "@/lib/constants"; -import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import { Result, err, ok } from "@formbricks/types/error-handlers"; import { ApiErrorResponse } from "@formbricks/types/errors"; import { TQuotaFullResponse } from "@formbricks/types/quota"; import { TResponseUpdate } from "@formbricks/types/responses"; +import { RECAPTCHA_VERIFICATION_ERROR_CODE } from "@/lib/constants"; +import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import { ApiClient } from "./api-client"; import { SurveyState } from "./survey-state"; diff --git a/packages/surveys/src/lib/response.queue.test.ts b/packages/surveys/src/lib/response.queue.test.ts index 14698c04c3..093e6bc825 100644 --- a/packages/surveys/src/lib/response.queue.test.ts +++ b/packages/surveys/src/lib/response.queue.test.ts @@ -1,7 +1,7 @@ -import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import { beforeEach, describe, expect, test, vi } from "vitest"; import { err, ok } from "@formbricks/types/error-handlers"; import { TResponseUpdate } from "@formbricks/types/responses"; +import { TResponseErrorCodesEnum } from "@/types/response-error-codes"; import { ResponseQueue, delay } from "./response-queue"; import { SurveyState } from "./survey-state"; diff --git a/packages/surveys/src/lib/styles.ts b/packages/surveys/src/lib/styles.ts index 7b26afb4c6..02ce37c5e9 100644 --- a/packages/surveys/src/lib/styles.ts +++ b/packages/surveys/src/lib/styles.ts @@ -1,10 +1,10 @@ -import { isLight, mixColor } from "@/lib/color"; -import global from "@/styles/global.css?inline"; -import preflight from "@/styles/preflight.css?inline"; import calendarCss from "react-calendar/dist/Calendar.css?inline"; import datePickerCss from "react-date-picker/dist/DatePicker.css?inline"; import { type TProjectStyling } from "@formbricks/types/project"; import { type TSurveyStyling } from "@formbricks/types/surveys/types"; +import { isLight, mixColor } from "@/lib/color"; +import global from "@/styles/global.css?inline"; +import preflight from "@/styles/preflight.css?inline"; import editorCss from "../../../../apps/web/modules/ui/components/editor/styles-editor-frontend.css?inline"; import datePickerCustomCss from "../styles/date-picker.css?inline"; diff --git a/playwright.config.ts b/playwright.config.ts index 18bddb935b..e802a888e1 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -22,9 +22,7 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ // workers: os.cpus().length, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: [ - ['html', { outputFolder: 'playwright-report', open: 'never' }], - ], + reporter: [["html", { outputFolder: "playwright-report", open: "never" }]], /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */