Adds last bits to NPS feedback form
This commit is contained in:
parent
ba22156bd8
commit
b108dc79ac
|
@ -1,9 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount, onDestroy } from "svelte"
|
import { onMount, onDestroy } from "svelte"
|
||||||
import { Button, Modal, notifications, ModalContent } from "@budibase/bbui"
|
import { Button, Modal, notifications, ModalContent } from "@budibase/bbui"
|
||||||
import FeedbackIframe from "../feedback/FeedbackIframe.svelte"
|
|
||||||
import Feedback from "./Feedback.svelte"
|
|
||||||
import { store } from "builderStore"
|
|
||||||
import api from "builderStore/api"
|
import api from "builderStore/api"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
|
||||||
|
@ -20,8 +17,6 @@
|
||||||
let poll
|
let poll
|
||||||
let publishModal
|
let publishModal
|
||||||
|
|
||||||
$: appId = $store.appId
|
|
||||||
|
|
||||||
async function deployApp() {
|
async function deployApp() {
|
||||||
try {
|
try {
|
||||||
const response = await api.post("/api/deploy")
|
const response = await api.post("/api/deploy")
|
||||||
|
@ -93,8 +88,6 @@
|
||||||
onDestroy(() => clearInterval(poll))
|
onDestroy(() => clearInterval(poll))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Feedback />
|
|
||||||
|
|
||||||
<Button secondary on:click={publishModal.show}>Publish</Button>
|
<Button secondary on:click={publishModal.show}>Publish</Button>
|
||||||
<Modal bind:this={feedbackModal}>
|
<Modal bind:this={feedbackModal}>
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
@ -102,9 +95,7 @@
|
||||||
size="L"
|
size="L"
|
||||||
showConfirmButton={false}
|
showConfirmButton={false}
|
||||||
showCancelButton={false}
|
showCancelButton={false}
|
||||||
>
|
/>
|
||||||
<FeedbackIframe on:finished={feedbackModal.hide} />
|
|
||||||
</ModalContent>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal bind:this={publishModal}>
|
<Modal bind:this={publishModal}>
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
|
import analytics from "analytics"
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
import { fly } from "svelte/transition"
|
||||||
import {
|
import {
|
||||||
ActionButton,
|
ActionButton,
|
||||||
RadioGroup,
|
RadioGroup,
|
||||||
|
@ -21,6 +24,8 @@
|
||||||
"Documentation",
|
"Documentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
// Data to send off
|
// Data to send off
|
||||||
let rating
|
let rating
|
||||||
let improvements
|
let improvements
|
||||||
|
@ -31,20 +36,23 @@
|
||||||
step = 1
|
step = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitFeedback() {
|
function submitFeedback(ev) {
|
||||||
// 1. Submit feedback
|
// 1. Submit feedback
|
||||||
// 2. dispatch event to parent and publish event
|
// 2. dispatch event to parent and publish event
|
||||||
// 3. Store cookie, flip user flag
|
// 3. Store cookie, flip user flag
|
||||||
console.log({
|
|
||||||
|
analytics.submitFeedback({
|
||||||
rating,
|
rating,
|
||||||
improvements,
|
improvements,
|
||||||
comment,
|
comment,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
dispatch("submitted")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="overlay">
|
<div class="position">
|
||||||
<div class="feedback-frame">
|
<div class="feedback-frame" transition:fly>
|
||||||
<Layout gap="XS">
|
<Layout gap="XS">
|
||||||
{#if step === 0}
|
{#if step === 0}
|
||||||
<Heading size="XS"
|
<Heading size="XS"
|
||||||
|
@ -103,7 +111,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.overlay {
|
.position {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: var(--spacing-l);
|
right: var(--spacing-l);
|
||||||
bottom: calc(5 * var(--spacing-xl));
|
bottom: calc(5 * var(--spacing-xl));
|
|
@ -5,6 +5,7 @@
|
||||||
import DeployModal from "components/deploy/DeployModal.svelte"
|
import DeployModal from "components/deploy/DeployModal.svelte"
|
||||||
import RevertModal from "components/deploy/RevertModal.svelte"
|
import RevertModal from "components/deploy/RevertModal.svelte"
|
||||||
import VersionModal from "components/deploy/VersionModal.svelte"
|
import VersionModal from "components/deploy/VersionModal.svelte"
|
||||||
|
import NPSFeedbackForm from "components/feedback/NPSFeedbackForm.svelte"
|
||||||
import { get } from "builderStore/api"
|
import { get } from "builderStore/api"
|
||||||
import { isActive, goto, layout } from "@roxi/routify"
|
import { isActive, goto, layout } from "@roxi/routify"
|
||||||
import Logo from "assets/bb-emblem.svg"
|
import Logo from "assets/bb-emblem.svg"
|
||||||
|
@ -18,6 +19,27 @@
|
||||||
$layout.children.find(layout => $isActive(layout.path))?.title ?? "data"
|
$layout.children.find(layout => $isActive(layout.path))?.title ?? "data"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let userShouldPostFeedback = false
|
||||||
|
|
||||||
|
function checkIfUserHasSubmittedFeedback() {
|
||||||
|
return document.cookie
|
||||||
|
?.split("; ")
|
||||||
|
?.find(row => row.startsWith("feedbackSubmitted="))
|
||||||
|
?.split("=")[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
function previewApp() {
|
||||||
|
if (!checkIfUserHasSubmittedFeedback() === true) {
|
||||||
|
userShouldPostFeedback = true
|
||||||
|
}
|
||||||
|
window.open(`/${application}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function feedbackSubmitted() {
|
||||||
|
userShouldPostFeedback = false
|
||||||
|
document.cookie = "feedbackSubmitted=true"
|
||||||
|
}
|
||||||
|
|
||||||
async function getPackage() {
|
async function getPackage() {
|
||||||
const res = await get(`/api/applications/${application}/appPackage`)
|
const res = await get(`/api/applications/${application}/appPackage`)
|
||||||
const pkg = await res.json()
|
const pkg = await res.json()
|
||||||
|
@ -83,13 +105,7 @@
|
||||||
<div class="toprightnav">
|
<div class="toprightnav">
|
||||||
<VersionModal />
|
<VersionModal />
|
||||||
<RevertModal />
|
<RevertModal />
|
||||||
<Icon
|
<Icon name="Play" hoverable on:click={previewApp} />
|
||||||
name="Play"
|
|
||||||
hoverable
|
|
||||||
on:click={() => {
|
|
||||||
window.open(`/${application}`)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<DeployModal />
|
<DeployModal />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -99,6 +115,10 @@
|
||||||
<p>Something went wrong: {error.message}</p>
|
<p>Something went wrong: {error.message}</p>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
|
{#if userShouldPostFeedback}
|
||||||
|
<NPSFeedbackForm on:submitted={feedbackSubmitted} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.loading {
|
.loading {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
|
Loading…
Reference in New Issue