From f70cda6e11f94b6844a6b23883ef7d6dfc05c31f Mon Sep 17 00:00:00 2001 From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com> Date: Fri, 20 Oct 2023 17:33:16 +0530 Subject: [PATCH] refactor: removes old types (#1288) Co-authored-by: Matthias Nannt --- .../components/dummyUI/CTAQuestion.tsx | 4 +- .../components/dummyUI/DemoPreview.tsx | 4 +- .../components/dummyUI/DemoView.tsx | 4 +- .../dummyUI/MultipleChoiceMultiQuestion.tsx | 4 +- .../dummyUI/MultipleChoiceSingleQuestion.tsx | 4 +- .../components/dummyUI/NPSQuestion.tsx | 4 +- .../components/dummyUI/OpenTextQuestion.tsx | 4 +- .../components/dummyUI/PreviewSurvey.tsx | 7 +- .../dummyUI/QuestionConditional.tsx | 16 +- .../components/dummyUI/RatingQuestion.tsx | 4 +- .../components/dummyUI/TemplateList.tsx | 8 +- .../components/dummyUI/templates.ts | 127 +++-- .../(actionsAndAttributes)/actions/actions.ts | 4 +- .../actions/components/ActionActivityTab.tsx | 2 +- .../actions/components/ActionClassesTable.tsx | 2 +- .../actions/components/ActionDetailModal.tsx | 2 +- .../actions/components/ActionRowData.tsx | 2 +- .../actions/components/ActionSettingsTab.tsx | 6 +- .../components/AddNoCodeActionModal.tsx | 6 +- .../attributes/actions.ts | 2 +- .../components/AttributeActivityTab.tsx | 2 +- .../components/AttributeClassesTable.tsx | 2 +- .../components/AttributeDetailModal.tsx | 2 +- .../environments/[environmentId]/actions.ts | 2 +- .../[environmentId]/components/Navigation.tsx | 6 +- .../integrations/airtable/Home.tsx | 8 +- .../integrations/airtable/actions.ts | 2 +- .../components/AddIntegrationModal.tsx | 6 +- .../airtable/components/AirtableWrapper.tsx | 8 +- .../integrations/airtable/lib/airtable.ts | 2 +- .../integrations/airtable/page.tsx | 4 +- .../integrations/google-sheets/actions.ts | 4 +- .../components/AddIntegrationModal.tsx | 6 +- .../components/GoogleSheetWrapper.tsx | 8 +- .../google-sheets/components/Home.tsx | 4 +- .../integrations/google-sheets/page.tsx | 4 +- .../integrations/webhooks/actions.ts | 4 +- .../webhooks/components/AddWebhookModal.tsx | 6 +- .../webhooks/components/HardcodedTriggers.tsx | 2 +- .../components/SurveyCheckboxGroup.tsx | 2 +- .../components/TriggerCheckboxGroup.tsx | 2 +- .../components/WebhookDetailModal.tsx | 4 +- .../components/WebhookOverviewTab.tsx | 4 +- .../webhooks/components/WebhookRowData.tsx | 4 +- .../components/WebhookSettingsTab.tsx | 6 +- .../webhooks/components/WebhookTable.tsx | 6 +- .../environments/[environmentId]/layout.tsx | 2 +- .../people/[personId]/actions.ts | 2 +- .../[personId]/components/ActivityFeed.tsx | 4 +- .../components/ActivityItemComponents.tsx | 2 +- .../components/ActivityTimeline.tsx | 4 +- .../[personId]/components/ResponseSection.tsx | 6 +- .../components/ResponseTimeline.tsx | 10 +- .../[personId]/components/ResponsesFeed.tsx | 10 +- .../people/[personId]/loading.tsx | 2 +- .../[environmentId]/people/page.tsx | 2 +- .../settings/api-keys/actions.ts | 4 +- .../api-keys/components/EditApiKeys.tsx | 2 +- .../billing/components/PricingTable.tsx | 2 +- .../settings/components/SettingsNavbar.tsx | 4 +- .../settings/lookandfeel/actions.ts | 4 +- .../lookandfeel/components/EditBrandColor.tsx | 2 +- .../components/EditHighlightBorder.tsx | 2 +- .../lookandfeel/components/EditPlacement.tsx | 8 +- .../lookandfeel/components/EditSignature.tsx | 2 +- .../settings/members/actions.ts | 6 +- .../members/components/DeleteTeam.tsx | 2 +- .../EditMemberships/EditMemberships.tsx | 4 +- .../EditMemberships/MemberActions.tsx | 6 +- .../EditMemberships/MembersInfo.tsx | 6 +- .../EditMemberships/MembershipRole.tsx | 2 +- .../EditMemberships/TeamActions.tsx | 4 +- .../members/components/EditTeamName.tsx | 2 +- .../settings/notifications/actions.ts | 6 +- .../components/NotificationSwitch.tsx | 4 +- .../settings/notifications/page.tsx | 7 +- .../settings/notifications/types.ts | 4 +- .../settings/product/actions.ts | 6 +- .../product/components/DeleteProduct.tsx | 2 +- .../components/DeleteProductRender.tsx | 2 +- .../product/components/EditProductName.tsx | 2 +- .../product/components/EditWaitingTime.tsx | 2 +- .../settings/profile/actions.ts | 4 +- .../profile/components/AccountSecurity.tsx | 2 +- .../settings/profile/components/EditName.tsx | 2 +- .../[environmentId]/settings/tags/actions.ts | 2 +- .../tags/components/EditTagsWrapper.tsx | 4 +- .../components/EmptyInAppSurveys.tsx | 2 +- .../(analysis)/responses/actions.ts | 2 +- .../responses/components/ResponsePage.tsx | 12 +- .../responses/components/ResponseTimeline.tsx | 10 +- .../[surveyId]/(analysis)/summary/actions.ts | 2 +- .../summary/components/CTASummary.tsx | 6 +- .../summary/components/ConsentSummary.tsx | 6 +- .../components/HiddenFieldsSummary.tsx | 6 +- .../summary/components/LinkModalButton.tsx | 6 +- .../components/LinkSingleUseSurveyModal.tsx | 2 +- .../components/MultipleChoiceSummary.tsx | 12 +- .../summary/components/NPSSummary.tsx | 6 +- .../summary/components/OpenTextSummary.tsx | 6 +- .../summary/components/RatingSummary.tsx | 10 +- .../summary/components/ShareEmbedSurvey.tsx | 6 +- .../summary/components/SuccessMessage.tsx | 8 +- .../summary/components/SummaryList.tsx | 38 +- .../summary/components/SummaryMetadata.tsx | 4 +- .../summary/components/SummaryPage.tsx | 12 +- .../components/shareEmbedTabs/EmailTab.tsx | 20 +- .../components/shareEmbedTabs/LinkTab.tsx | 2 +- .../[surveyId]/components/CustomFilter.tsx | 6 +- .../components/QuestionFilterComboBox.tsx | 9 +- .../components/QuestionsComboBox.tsx | 18 +- .../[surveyId]/components/ResponseFilter.tsx | 4 +- .../[surveyId]/components/SummaryHeader.tsx | 8 +- .../components/SurveyStatusDropdown.tsx | 4 +- .../surveys/[surveyId]/edit/actions.ts | 4 +- .../edit/components/AddQuestionButton.tsx | 2 +- .../edit/components/AdvancedSettings.tsx | 2 +- .../edit/components/CTAQuestionForm.tsx | 2 +- .../edit/components/ConsentQuestionForm.tsx | 2 +- .../edit/components/EditThankYouCard.tsx | 2 +- .../edit/components/EditWelcomeCard.tsx | 2 +- .../edit/components/HiddenFieldsCard.tsx | 2 +- .../edit/components/HowToSendCard.tsx | 4 +- .../edit/components/LogicEditor.tsx | 13 +- .../components/MultipleChoiceMultiForm.tsx | 2 +- .../components/MultipleChoiceSingleForm.tsx | 2 +- .../edit/components/NPSQuestionForm.tsx | 2 +- .../edit/components/OpenQuestionForm.tsx | 2 +- .../[surveyId]/edit/components/Placement.tsx | 8 +- .../edit/components/QuestionCard.tsx | 41 +- .../edit/components/QuestionFormInput.tsx | 2 +- .../edit/components/QuestionsView.tsx | 4 +- .../edit/components/RatingQuestionForm.tsx | 2 +- .../edit/components/RecontactOptionsCard.tsx | 2 +- .../edit/components/ResponseOptionsCard.tsx | 2 +- .../edit/components/SettingsView.tsx | 8 +- .../edit/components/StylingCard.tsx | 6 +- .../edit/components/SurveyEditor.tsx | 10 +- .../edit/components/SurveyMenuBar.tsx | 12 +- .../edit/components/UpdateQuestionId.tsx | 2 +- .../[surveyId]/edit/components/Validation.ts | 2 +- .../edit/components/WhenToSendCard.tsx | 4 +- .../edit/components/WhoToSendCard.tsx | 4 +- .../[environmentId]/surveys/actions.ts | 4 +- .../surveys/components/Modal.tsx | 4 +- .../surveys/components/PreviewSurvey.tsx | 6 +- .../surveys/components/SurveyDropDownMenu.tsx | 4 +- .../surveys/components/SurveyList.tsx | 2 +- .../surveys/components/SurveyStarter.tsx | 8 +- .../surveys/templates/TemplateContainer.tsx | 6 +- .../surveys/templates/TemplateList.tsx | 8 +- .../surveys/templates/actions.ts | 4 +- .../surveys/templates/templates.ts | 248 +++++----- apps/web/app/(app)/onboarding/actions.ts | 6 +- .../(app)/onboarding/components/Objective.tsx | 6 +- .../onboarding/components/Onboarding.tsx | 4 +- .../(app)/onboarding/components/Product.tsx | 2 +- .../app/(app)/onboarding/components/Role.tsx | 2 +- .../(redirects)/products/[productId]/route.ts | 2 +- .../app/(redirects)/teams/[teamId]/route.ts | 2 +- apps/web/app/api/cron/weekly_summary/types.ts | 6 +- .../api/pipeline/lib/handleIntegrations.ts | 8 +- apps/web/app/api/pipeline/route.ts | 10 +- apps/web/app/api/v1/auth.ts | 4 +- .../v1/client/displays/[displayId]/route.ts | 2 +- apps/web/app/api/v1/client/displays/route.ts | 4 +- .../v1/client/responses/[responseId]/route.ts | 4 +- apps/web/app/api/v1/client/responses/route.ts | 4 +- .../v1/integrations/airtable/tables/route.ts | 2 +- apps/web/app/api/v1/js/actions/route.ts | 4 +- .../people/[personId]/set-attribute/route.ts | 2 +- .../js/people/[personId]/set-user-id/route.ts | 2 +- apps/web/app/api/v1/js/sync/lib/surveys.ts | 4 +- apps/web/app/api/v1/js/sync/lib/sync.ts | 8 +- apps/web/app/api/v1/js/sync/route.ts | 2 +- .../action-classes/[actionClassId]/route.ts | 4 +- .../api/v1/management/action-classes/route.ts | 4 +- .../[attributeClassId]/route.ts | 4 +- .../v1/management/attribute-classes/route.ts | 4 +- .../v1/management/people/[personId]/route.ts | 4 +- .../web/app/api/v1/management/people/route.ts | 4 +- .../responses/[responseId]/route.ts | 2 +- .../app/api/v1/management/responses/route.ts | 2 +- .../v1/management/surveys/[surveyId]/route.ts | 2 +- .../app/api/v1/management/surveys/route.ts | 4 +- apps/web/app/api/v1/webhooks/route.ts | 4 +- apps/web/app/i/[shortUrlId]/page.tsx | 2 +- apps/web/app/lib/api/clientPerson.ts | 12 +- apps/web/app/lib/api/clientSession.ts | 4 +- apps/web/app/lib/api/clientSettings.ts | 6 +- apps/web/app/lib/email.ts | 6 +- apps/web/app/lib/pipelines.ts | 2 +- apps/web/app/lib/preview.ts | 4 +- apps/web/app/lib/questions.ts | 8 +- .../lib/responses/questionResponseMapping.ts | 6 +- apps/web/app/lib/surveys/surveys.ts | 42 +- apps/web/app/lib/templates.ts | 6 +- apps/web/app/lib/utils.ts | 2 +- apps/web/app/s/[surveyId]/actions.ts | 2 +- .../s/[surveyId]/components/LinkSurvey.tsx | 6 +- .../app/s/[surveyId]/components/PinScreen.tsx | 6 +- .../[surveyId]/components/SurveyInactive.tsx | 2 +- .../[surveyId]/components/SurveyLinkUsed.tsx | 4 +- .../s/[surveyId]/components/VerifyEmail.tsx | 2 +- apps/web/app/s/[surveyId]/lib/prefilling.ts | 36 +- apps/web/app/s/[surveyId]/page.tsx | 2 +- .../[accessType]/[fileName]/route.ts | 2 +- .../[environmentId]/events/index.ts | 2 +- .../responses/[responseId]/index.ts | 8 +- .../[environmentId]/responses/index.ts | 6 +- .../surveys/[surveyId]/index.ts | 6 +- .../[environmentId]/tags/[tagId]/index.ts | 4 +- .../[environmentId]/tags/index.ts | 2 +- .../[environmentId]/tags/merge.ts | 2 +- packages/api/src/api/client/display.ts | 6 +- packages/api/src/api/client/response.ts | 6 +- packages/api/src/utils/makeRequest.ts | 4 +- packages/database/jsonTypes.ts | 10 +- packages/database/zod-utils.ts | 10 +- packages/js/src/index.ts | 2 +- packages/js/src/lib/actions.ts | 2 +- packages/js/src/lib/config.ts | 2 +- packages/js/src/lib/display.ts | 4 +- packages/js/src/lib/errors.ts | 2 +- packages/js/src/lib/initialize.ts | 2 +- packages/js/src/lib/noCodeActions.ts | 4 +- packages/js/src/lib/person.ts | 4 +- packages/js/src/lib/response.ts | 4 +- packages/js/src/lib/session.ts | 2 +- packages/js/src/lib/sync.ts | 2 +- packages/js/src/lib/widget.ts | 4 +- packages/js/tests/index.test.ts | 2 +- packages/lib/action/service.ts | 10 +- packages/lib/actionClass/auth.ts | 2 +- packages/lib/actionClass/service.ts | 8 +- packages/lib/activity/service.ts | 6 +- packages/lib/activity/util.ts | 2 +- packages/lib/airtable/service.ts | 6 +- packages/lib/apiKey/auth.ts | 2 +- packages/lib/apiKey/service.ts | 8 +- packages/lib/attributeClass/auth.ts | 2 +- packages/lib/attributeClass/service.ts | 8 +- packages/lib/auth.ts | 2 +- packages/lib/client/display.ts | 2 +- packages/lib/client/response.ts | 2 +- packages/lib/display/service.ts | 13 +- packages/lib/display/util.ts | 2 +- packages/lib/emails/emails.ts | 6 +- packages/lib/environment/auth.ts | 2 +- packages/lib/environment/service.ts | 6 +- packages/lib/googleSheet/service.ts | 10 +- packages/lib/integration/auth.ts | 2 +- packages/lib/integration/service.ts | 8 +- packages/lib/invite/service.ts | 6 +- packages/lib/membership/service.ts | 6 +- packages/lib/person/auth.ts | 2 +- packages/lib/person/service.ts | 8 +- packages/lib/person/util.ts | 2 +- packages/lib/product/auth.ts | 2 +- packages/lib/product/service.ts | 10 +- packages/lib/profile/service.ts | 8 +- packages/lib/response/auth.ts | 2 +- packages/lib/response/service.ts | 12 +- packages/lib/response/util.ts | 2 +- packages/lib/responseNote/auth.ts | 2 +- packages/lib/responseNote/service.ts | 4 +- packages/lib/responseQueue.ts | 2 +- packages/lib/responses.ts | 6 +- packages/lib/session/service.ts | 8 +- packages/lib/shortUrl/service.ts | 4 +- packages/lib/survey/auth.ts | 2 +- packages/lib/survey/service.ts | 8 +- packages/lib/survey/util.ts | 2 +- packages/lib/surveyState.ts | 2 +- packages/lib/tag/auth.ts | 2 +- packages/lib/tag/service.ts | 6 +- packages/lib/tagOnResponse/auth.ts | 2 +- packages/lib/tagOnResponse/service.ts | 2 +- packages/lib/team/service.ts | 8 +- packages/lib/teamDetail/service.ts | 4 +- packages/lib/utils/validate.ts | 2 +- packages/lib/webhook/auth.ts | 2 +- packages/lib/webhook/service.ts | 8 +- .../src/components/AutoCloseWrapper.tsx | 2 +- .../surveys/src/components/CTAQuestion.tsx | 4 +- .../src/components/ConsentQuestion.tsx | 4 +- packages/surveys/src/components/Modal.tsx | 6 +- .../MultipleChoiceMultiQuestion.tsx | 4 +- .../MultipleChoiceSingleQuestion.tsx | 4 +- .../surveys/src/components/NPSQuestion.tsx | 4 +- .../src/components/OpenTextQuestion.tsx | 4 +- .../surveys/src/components/ProgressBar.tsx | 2 +- .../src/components/QuestionConditional.tsx | 18 +- .../surveys/src/components/RatingQuestion.tsx | 4 +- packages/surveys/src/components/Survey.tsx | 2 +- packages/surveys/src/lib/logicEvaluator.ts | 2 +- packages/surveys/src/types/props.ts | 4 +- packages/types/{v1 => }/actionClasses.ts | 32 ++ packages/types/{v1 => }/actions.ts | 0 packages/types/{v1 => }/activity.ts | 0 packages/types/{v1 => }/apiKeys.ts | 0 packages/types/{v1 => }/attributeClasses.ts | 0 packages/types/{v1 => }/auth.ts | 0 packages/types/{v1 => }/common.ts | 7 +- packages/types/{v1 => }/displays.ts | 0 packages/types/{v1 => }/environment.ts | 0 packages/types/{v1 => }/errorHandlers.ts | 0 packages/types/{v1 => }/errors.ts | 4 + packages/types/events.ts | 15 - .../types/{v1 => }/integration/airtable.ts | 0 .../types/{v1 => }/integration/googleSheet.ts | 0 packages/types/{v1 => }/integration/index.ts | 0 .../types/{v1 => }/integration/sharedTypes.ts | 0 packages/types/{v1 => }/invites.ts | 0 packages/types/js.ts | 187 +++---- packages/types/{v1 => }/memberships.ts | 0 packages/types/next-auth.d.ts | 2 +- packages/types/{v1 => }/people.ts | 0 packages/types/{v1 => }/pipelines.ts | 0 packages/types/{v1 => }/product.ts | 4 +- packages/types/{v1 => }/profile.ts | 10 +- packages/types/questions.ts | 160 ------ packages/types/responses.ts | 137 +++++- packages/types/{v1 => }/sessions.ts | 0 packages/types/{v1 => }/shortUrl.ts | 0 packages/types/{v1 => }/storage.ts | 0 packages/types/surveys.ts | 461 +++++++++++++++--- packages/types/{v1 => }/tags.ts | 0 packages/types/{v1 => }/teams.ts | 0 packages/types/templates.ts | 44 +- packages/types/users.ts | 16 +- packages/types/v1/js.ts | 83 ---- packages/types/v1/responses.ts | 115 ----- packages/types/v1/surveys.ts | 371 -------------- packages/types/v1/templates.ts | 30 -- packages/types/v1/users.ts | 8 - packages/types/{v1 => }/webhooks.ts | 0 packages/ui/EmptySpaceFiller/index.tsx | 2 +- packages/ui/QuestionTypeSelector/index.tsx | 4 +- packages/ui/SingleResponseCard/actions.ts | 2 +- .../components/QuestionSkip.tsx | 2 +- .../components/ResponseNote.tsx | 4 +- .../components/ResponseTagsWrapper.tsx | 2 +- packages/ui/SingleResponseCard/index.tsx | 14 +- packages/ui/Survey/index.tsx | 4 +- 345 files changed, 1637 insertions(+), 1938 deletions(-) rename packages/types/{v1 => }/actionClasses.ts (71%) rename packages/types/{v1 => }/actions.ts (100%) rename packages/types/{v1 => }/activity.ts (100%) rename packages/types/{v1 => }/apiKeys.ts (100%) rename packages/types/{v1 => }/attributeClasses.ts (100%) rename packages/types/{v1 => }/auth.ts (100%) rename packages/types/{v1 => }/common.ts (59%) rename packages/types/{v1 => }/displays.ts (100%) rename packages/types/{v1 => }/environment.ts (100%) rename packages/types/{v1 => }/errorHandlers.ts (100%) rename packages/types/{v1 => }/errors.ts (95%) delete mode 100644 packages/types/events.ts rename packages/types/{v1 => }/integration/airtable.ts (100%) rename packages/types/{v1 => }/integration/googleSheet.ts (100%) rename packages/types/{v1 => }/integration/index.ts (100%) rename packages/types/{v1 => }/integration/sharedTypes.ts (100%) rename packages/types/{v1 => }/invites.ts (100%) rename packages/types/{v1 => }/memberships.ts (100%) rename packages/types/{v1 => }/people.ts (100%) rename packages/types/{v1 => }/pipelines.ts (100%) rename packages/types/{v1 => }/product.ts (89%) rename packages/types/{v1 => }/profile.ts (84%) delete mode 100644 packages/types/questions.ts rename packages/types/{v1 => }/sessions.ts (100%) rename packages/types/{v1 => }/shortUrl.ts (100%) rename packages/types/{v1 => }/storage.ts (100%) rename packages/types/{v1 => }/tags.ts (100%) rename packages/types/{v1 => }/teams.ts (100%) delete mode 100644 packages/types/v1/js.ts delete mode 100644 packages/types/v1/responses.ts delete mode 100644 packages/types/v1/surveys.ts delete mode 100644 packages/types/v1/templates.ts delete mode 100644 packages/types/v1/users.ts rename packages/types/{v1 => }/webhooks.ts (100%) diff --git a/apps/formbricks-com/components/dummyUI/CTAQuestion.tsx b/apps/formbricks-com/components/dummyUI/CTAQuestion.tsx index a6e3f2bf43..8f5af6eb3b 100644 --- a/apps/formbricks-com/components/dummyUI/CTAQuestion.tsx +++ b/apps/formbricks-com/components/dummyUI/CTAQuestion.tsx @@ -1,9 +1,9 @@ -import type { CTAQuestion } from "@formbricks/types/questions"; +import { TSurveyCTAQuestion } from "@formbricks/types/surveys"; import Headline from "./Headline"; import HtmlBody from "./HtmlBody"; interface CTAQuestionProps { - question: CTAQuestion; + question: TSurveyCTAQuestion; onSubmit: (data: { [x: string]: any }) => void; lastQuestion: boolean; brandColor: string; diff --git a/apps/formbricks-com/components/dummyUI/DemoPreview.tsx b/apps/formbricks-com/components/dummyUI/DemoPreview.tsx index 6dfa00a1eb..34b46eb2f0 100644 --- a/apps/formbricks-com/components/dummyUI/DemoPreview.tsx +++ b/apps/formbricks-com/components/dummyUI/DemoPreview.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react"; import PreviewSurvey from "./PreviewSurvey"; import { findTemplateByName } from "./templates"; -import type { Template } from "@formbricks/types/templates"; +import { TTemplate } from "@formbricks/types/surveys"; interface DemoPreviewProps { template: string; @@ -10,7 +10,7 @@ interface DemoPreviewProps { const DemoPreview: React.FC = ({ template }) => { const [activeQuestionId, setActiveQuestionId] = useState(null); - const selectedTemplate: Template | undefined = findTemplateByName(template); + const selectedTemplate: TTemplate | undefined = findTemplateByName(template); useEffect(() => { if (selectedTemplate) { diff --git a/apps/formbricks-com/components/dummyUI/DemoView.tsx b/apps/formbricks-com/components/dummyUI/DemoView.tsx index b9928313d2..a6b015cde3 100644 --- a/apps/formbricks-com/components/dummyUI/DemoView.tsx +++ b/apps/formbricks-com/components/dummyUI/DemoView.tsx @@ -1,11 +1,11 @@ -import type { Template } from "@formbricks/types/templates"; +import { TTemplate } from "@formbricks/types/surveys"; import { useEffect, useState } from "react"; import PreviewSurvey from "./PreviewSurvey"; import TemplateList from "./TemplateList"; import { templates } from "./templates"; export default function SurveyTemplatesPage({}) { - const [activeTemplate, setActiveTemplate] = useState