mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-25 10:20:03 -06:00
fix: NPS response exported as empty string (#3080)
Co-authored-by: Johannes <johannes@formbricks.com>
This commit is contained in:
committed by
GitHub
parent
211fc22b2a
commit
198df84b89
@@ -59,7 +59,7 @@ export const SurveyLoadingAnimation = ({
|
||||
if (isMediaLoaded && minTimePassed) {
|
||||
const hideTimer = setTimeout(() => {
|
||||
setIsHidden(true);
|
||||
}, 1500);
|
||||
}, 500);
|
||||
|
||||
return () => clearTimeout(hideTimer);
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ export const SurveyLoadingAnimation = ({
|
||||
// Ensure the animation is shown for at least 1.5 seconds
|
||||
const minTimeTimer = setTimeout(() => {
|
||||
setMinTimePassed(true);
|
||||
}, 1500);
|
||||
}, 500);
|
||||
|
||||
// Observe the DOM for when the survey package (child elements) is added to the target node
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
|
||||
@@ -8,28 +8,25 @@ export const convertResponseValue = (
|
||||
answer: string | number | string[] | Record<string, string>,
|
||||
question: TSurveyQuestion
|
||||
): string | string[] => {
|
||||
if (!answer) return "";
|
||||
else {
|
||||
switch (question.type) {
|
||||
case "ranking":
|
||||
case "fileUpload":
|
||||
if (typeof answer === "string") {
|
||||
return [answer];
|
||||
} else return answer as string[];
|
||||
switch (question.type) {
|
||||
case "ranking":
|
||||
case "fileUpload":
|
||||
if (typeof answer === "string") {
|
||||
return [answer];
|
||||
} else return answer as string[];
|
||||
|
||||
case "pictureSelection":
|
||||
if (typeof answer === "string") {
|
||||
const imageUrl = question.choices.find((choice) => choice.id === answer)?.imageUrl;
|
||||
return imageUrl ? [imageUrl] : [];
|
||||
} else if (Array.isArray(answer)) {
|
||||
return answer
|
||||
.map((answerId) => question.choices.find((choice) => choice.id === answerId)?.imageUrl)
|
||||
.filter((url): url is string => url !== undefined);
|
||||
} else return [];
|
||||
case "pictureSelection":
|
||||
if (typeof answer === "string") {
|
||||
const imageUrl = question.choices.find((choice) => choice.id === answer)?.imageUrl;
|
||||
return imageUrl ? [imageUrl] : [];
|
||||
} else if (Array.isArray(answer)) {
|
||||
return answer
|
||||
.map((answerId) => question.choices.find((choice) => choice.id === answerId)?.imageUrl)
|
||||
.filter((url): url is string => url !== undefined);
|
||||
} else return [];
|
||||
|
||||
default:
|
||||
return processResponseData(answer);
|
||||
}
|
||||
default:
|
||||
return processResponseData(answer);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,8 +55,6 @@ export const getQuestionResponseMapping = (
|
||||
export const processResponseData = (
|
||||
responseData: string | number | string[] | Record<string, string>
|
||||
): string => {
|
||||
if (!responseData) return "";
|
||||
|
||||
switch (typeof responseData) {
|
||||
case "string":
|
||||
return responseData;
|
||||
|
||||
Reference in New Issue
Block a user