diff --git a/packages/builder/src/components/feedback/NPSFeedbackForm.svelte b/packages/builder/src/components/feedback/NPSFeedbackForm.svelte index bb4828d7a1..e0ba0e7525 100644 --- a/packages/builder/src/components/feedback/NPSFeedbackForm.svelte +++ b/packages/builder/src/components/feedback/NPSFeedbackForm.svelte @@ -14,6 +14,8 @@ Divider, Layout, } from "@budibase/bbui" + import { auth } from "stores/portal" + let step = 0 let ratings = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] let options = [ @@ -43,15 +45,21 @@ improvements, comment, }) - - document.cookie = "feedbackSubmitted=true" - - dispatch("submitted") + auth.updateSelf({ + flags: { + feedbackSubmitted: true, + }, + }) + dispatch("complete") } function cancelFeedback() { - document.cookie = "feedbackSubmitted=true" - dispatch("submitted") + auth.updateSelf({ + flags: { + feedbackSubmitted: true, + }, + }) + dispatch("complete") } diff --git a/packages/builder/src/pages/builder/app/[application]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/_layout.svelte index e2e9dcb40e..1d0b4e8583 100644 --- a/packages/builder/src/pages/builder/app/[application]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_layout.svelte @@ -7,6 +7,7 @@ import VersionModal from "components/deploy/VersionModal.svelte" import NPSFeedbackForm from "components/feedback/NPSFeedbackForm.svelte" import { get } from "builderStore/api" + import { auth } from "stores/portal" import { isActive, goto, layout } from "@roxi/routify" import Logo from "assets/bb-emblem.svg" import { capitalise } from "helpers" @@ -21,15 +22,8 @@ let userShouldPostFeedback = false - function checkIfUserHasSubmittedFeedback() { - return document.cookie - ?.split("; ") - ?.find(row => row.startsWith("feedbackSubmitted=")) - ?.split("=")[1] - } - function previewApp() { - if (!checkIfUserHasSubmittedFeedback() === true) { + if (!$auth?.user?.flags?.feedbackSubmitted === true) { userShouldPostFeedback = true } window.open(`/${application}`) @@ -111,7 +105,7 @@ {/await} {#if userShouldPostFeedback} - (userShouldPostFeedback = false)} /> + (userShouldPostFeedback = false)} /> {/if}