From c87f5d84863048d4ef067fec38573996351ee515 Mon Sep 17 00:00:00 2001 From: nzambello Date: Tue, 24 Dec 2024 10:34:51 +0200 Subject: [PATCH] fix: showUpload from integration bool checking and fallbacks --- .../MemoriWidget/MemoriWidget.stories.tsx | 21 +++++++++++++++++++ src/components/MemoriWidget/MemoriWidget.tsx | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/MemoriWidget/MemoriWidget.stories.tsx b/src/components/MemoriWidget/MemoriWidget.stories.tsx index c28f97bc..e4ea7ffd 100644 --- a/src/components/MemoriWidget/MemoriWidget.stories.tsx +++ b/src/components/MemoriWidget/MemoriWidget.stories.tsx @@ -144,6 +144,27 @@ ShowClear.args = { showClear: true, }; +export const ShowUpload = Template.bind({}); +ShowUpload.args = { + memori, + tenant, + showUpload: true, +}; + +export const ShowUploadFromIntegration = Template.bind({}); +ShowUploadFromIntegration.args = { + memori, + tenant, + showUpload: false, + integration: { + ...integration, + customData: JSON.stringify({ + ...JSON.parse(integration.customData ?? '{}'), + showUpload: true, + }), + }, +}; + export const WithoutAudio = Template.bind({}); WithoutAudio.args = { memori, diff --git a/src/components/MemoriWidget/MemoriWidget.tsx b/src/components/MemoriWidget/MemoriWidget.tsx index d748a52b..b6208377 100644 --- a/src/components/MemoriWidget/MemoriWidget.tsx +++ b/src/components/MemoriWidget/MemoriWidget.tsx @@ -2555,7 +2555,7 @@ const MemoriWidget = ({ ? true : integrationConfig?.showAIicon; - const enableUpload = showUpload ?? integrationConfig?.showUpload ?? false; + const enableUpload = showUpload || !!integrationConfig?.showUpload; const showWhyThisAnswer = integrationConfig?.showWhyThisAnswer === undefined