From 48638e8ca2afe48848cb12635dc295b624cf4677 Mon Sep 17 00:00:00 2001
From: Dhruwang Jariwala <67850763+Dhruwang@users.noreply.github.com>
Date: Mon, 3 Jun 2024 20:36:50 +0530
Subject: [PATCH] fix: added support for date, matrix, address and cal question
to notion integration (#2726)
---
.../notion/components/AddIntegrationModal.tsx | 9 ++++++---
.../[environmentId]/integrations/notion/constants.ts | 4 ++++
apps/web/app/api/pipeline/lib/handleIntegrations.ts | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/apps/web/app/(app)/environments/[environmentId]/integrations/notion/components/AddIntegrationModal.tsx b/apps/web/app/(app)/environments/[environmentId]/integrations/notion/components/AddIntegrationModal.tsx
index 4cf41dac29..675d047db5 100644
--- a/apps/web/app/(app)/environments/[environmentId]/integrations/notion/components/AddIntegrationModal.tsx
+++ b/apps/web/app/(app)/environments/[environmentId]/integrations/notion/components/AddIntegrationModal.tsx
@@ -263,11 +263,14 @@ export const AddIntegrationModal = ({
>
);
case ERRORS.MAPPING:
+ const question = questionTypes.find((qt) => qt.id === ques.type);
+ if (!question) return null;
return (
<>
- - "{ques.name}" of type{" "}
- {questionTypes.find((qt) => qt.id === ques.type)?.label} can't be mapped to the
- column "{col.name}" of type {col.type}
+ - "{ques.name}" of type {question.label} can't be mapped to the
+ column "{col.name}" of type {col.type}. Instead use column of type{" "}
+ {""}
+ {TYPE_MAPPING[question.id].join(" ,")}.
>
);
default:
diff --git a/apps/web/app/(app)/environments/[environmentId]/integrations/notion/constants.ts b/apps/web/app/(app)/environments/[environmentId]/integrations/notion/constants.ts
index 3d9fbf0bdb..16bece7040 100644
--- a/apps/web/app/(app)/environments/[environmentId]/integrations/notion/constants.ts
+++ b/apps/web/app/(app)/environments/[environmentId]/integrations/notion/constants.ts
@@ -22,6 +22,10 @@ export const TYPE_MAPPING = {
[TSurveyQuestionType.Rating]: ["number"],
[TSurveyQuestionType.PictureSelection]: ["url"],
[TSurveyQuestionType.FileUpload]: ["url"],
+ [TSurveyQuestionType.Date]: ["date"],
+ [TSurveyQuestionType.Address]: ["rich_text"],
+ [TSurveyQuestionType.Matrix]: ["rich_text"],
+ [TSurveyQuestionType.Cal]: ["checkbox"],
};
export const UNSUPPORTED_TYPES_BY_NOTION = [
diff --git a/apps/web/app/api/pipeline/lib/handleIntegrations.ts b/apps/web/app/api/pipeline/lib/handleIntegrations.ts
index a400fdb32d..b5d0bc8903 100644
--- a/apps/web/app/api/pipeline/lib/handleIntegrations.ts
+++ b/apps/web/app/api/pipeline/lib/handleIntegrations.ts
@@ -165,7 +165,7 @@ const buildNotionPayloadProperties = (
const value = responses[map.question.id];
properties[map.column.name] = {
- [map.column.type]: getValue(map.column.type, value),
+ [map.column.type]: getValue(map.column.type, processResponseData(value)),
};
});