mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(editor): Add follow up question nps (#17459)
This commit is contained in:
@@ -3,8 +3,9 @@ import { clearNotifications } from '../pages/notifications';
|
|||||||
import {
|
import {
|
||||||
getNpsSurvey,
|
getNpsSurvey,
|
||||||
getNpsSurveyClose,
|
getNpsSurveyClose,
|
||||||
getNpsSurveyEmail,
|
getNpsSurveyFeedback,
|
||||||
getNpsSurveyRatings,
|
getNpsSurveyRatings,
|
||||||
|
getNpsSurveySubmit,
|
||||||
} from '../pages/npsSurvey';
|
} from '../pages/npsSurvey';
|
||||||
import { WorkflowPage } from '../pages/workflow';
|
import { WorkflowPage } from '../pages/workflow';
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ describe('NpsSurvey', () => {
|
|||||||
cy.signin(INSTANCE_ADMIN);
|
cy.signin(INSTANCE_ADMIN);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows nps survey to recently activated user and can submit email ', () => {
|
it('shows nps survey to recently activated user and can submit feedback ', () => {
|
||||||
cy.intercept('/rest/settings', { middleware: true }, (req) => {
|
cy.intercept('/rest/settings', { middleware: true }, (req) => {
|
||||||
req.on('response', (res) => {
|
req.on('response', (res) => {
|
||||||
if (res.body.data) {
|
if (res.body.data) {
|
||||||
@@ -56,8 +57,8 @@ describe('NpsSurvey', () => {
|
|||||||
getNpsSurveyRatings().find('button').should('have.length', 11);
|
getNpsSurveyRatings().find('button').should('have.length', 11);
|
||||||
getNpsSurveyRatings().find('button').first().click();
|
getNpsSurveyRatings().find('button').first().click();
|
||||||
|
|
||||||
getNpsSurveyEmail().find('input').type('test@n8n.io');
|
getNpsSurveyFeedback().find('textarea').type('n8n is the best');
|
||||||
getNpsSurveyEmail().find('button').click();
|
getNpsSurveySubmit().find('button').click();
|
||||||
|
|
||||||
// test that modal does not show up again until 6 months later
|
// test that modal does not show up again until 6 months later
|
||||||
workflowPage.actions.visit(true, NOW + ONE_DAY);
|
workflowPage.actions.visit(true, NOW + ONE_DAY);
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ export const getNpsSurvey = () => cy.getByTestId('nps-survey-modal');
|
|||||||
|
|
||||||
export const getNpsSurveyRatings = () => cy.getByTestId('nps-survey-ratings');
|
export const getNpsSurveyRatings = () => cy.getByTestId('nps-survey-ratings');
|
||||||
|
|
||||||
export const getNpsSurveyEmail = () => cy.getByTestId('nps-survey-email');
|
export const getNpsSurveyFeedback = () => cy.getByTestId('nps-survey-feedback');
|
||||||
|
export const getNpsSurveySubmit = () => cy.getByTestId('nps-survey-feedback-button');
|
||||||
|
|
||||||
export const getNpsSurveyClose = () =>
|
export const getNpsSurveyClose = () =>
|
||||||
cy.getByTestId('nps-survey-modal').find('button.el-drawer__close-btn');
|
cy.getByTestId('nps-survey-modal').find('button.el-drawer__close-btn');
|
||||||
|
|||||||
@@ -1774,14 +1774,13 @@
|
|||||||
"pushConnection.executionError": "There was a problem executing the workflow{error}",
|
"pushConnection.executionError": "There was a problem executing the workflow{error}",
|
||||||
"pushConnection.executionError.openNode": "Open errored node",
|
"pushConnection.executionError.openNode": "Open errored node",
|
||||||
"pushConnection.executionError.details": "<br /><strong>{details}</strong>",
|
"pushConnection.executionError.details": "<br /><strong>{details}</strong>",
|
||||||
"prompts.productTeamMessage": "Our product team will get in touch personally",
|
|
||||||
"prompts.npsSurvey.recommendationQuestion": "How likely are you to recommend n8n to a friend or colleague?",
|
"prompts.npsSurvey.recommendationQuestion": "How likely are you to recommend n8n to a friend or colleague?",
|
||||||
"prompts.npsSurvey.greatFeedbackTitle": "Great to hear! Can we reach out to see how we can make n8n even better for you?",
|
"prompts.npsSurvey.greatFeedbackTitle": "Great to hear! Can we reach out to see how we can make n8n even better for you?",
|
||||||
"prompts.npsSurvey.defaultFeedbackTitle": "Thanks for your feedback! We'd love to understand how we can improve. Can we reach out?",
|
"prompts.npsSurvey.defaultFeedbackTitle": "Thanks for your feedback! We'd love to understand how we can improve. Can we reach out?",
|
||||||
|
"prompts.npsSurvey.feedbackQuestionTitle": "Thank you! Why did you choose this score?",
|
||||||
"prompts.npsSurvey.notLikely": "Not likely",
|
"prompts.npsSurvey.notLikely": "Not likely",
|
||||||
"prompts.npsSurvey.veryLikely": "Very likely",
|
"prompts.npsSurvey.veryLikely": "Very likely",
|
||||||
"prompts.npsSurvey.send": "Send",
|
"prompts.npsSurvey.send": "Send",
|
||||||
"prompts.npsSurvey.yourEmailAddress": "Your email address",
|
|
||||||
"prompts.npsSurvey.reviewUs": "If you’d like to help even more, leave us a <a target=\"_blank\" href=\"https://www.g2.com/products/n8n/reviews/start\">review on G2</a>.",
|
"prompts.npsSurvey.reviewUs": "If you’d like to help even more, leave us a <a target=\"_blank\" href=\"https://www.g2.com/products/n8n/reviews/start\">review on G2</a>.",
|
||||||
"prompts.npsSurvey.thanks": "Thanks for your feedback",
|
"prompts.npsSurvey.thanks": "Thanks for your feedback",
|
||||||
"renameAction.emptyName.message": "Please enter a name, or press 'esc' to go back to the old one",
|
"renameAction.emptyName.message": "Please enter a name, or press 'esc' to go back to the old one",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { VALID_EMAIL_REGEX, NPS_SURVEY_MODAL_KEY } from '@/constants';
|
import { NPS_SURVEY_MODAL_KEY } from '@/constants';
|
||||||
import { useRootStore } from '@n8n/stores/useRootStore';
|
import { useRootStore } from '@n8n/stores/useRootStore';
|
||||||
import ModalDrawer from '@/components/ModalDrawer.vue';
|
import ModalDrawer from '@/components/ModalDrawer.vue';
|
||||||
import { useToast } from '@/composables/useToast';
|
import { useToast } from '@/composables/useToast';
|
||||||
@@ -23,32 +23,33 @@ const { APP_Z_INDEXES } = useStyles();
|
|||||||
const DEFAULT_TITLE = i18n.baseText('prompts.npsSurvey.recommendationQuestion');
|
const DEFAULT_TITLE = i18n.baseText('prompts.npsSurvey.recommendationQuestion');
|
||||||
const GREAT_FEEDBACK_TITLE = i18n.baseText('prompts.npsSurvey.greatFeedbackTitle');
|
const GREAT_FEEDBACK_TITLE = i18n.baseText('prompts.npsSurvey.greatFeedbackTitle');
|
||||||
const DEFAULT_FEEDBACK_TITLE = i18n.baseText('prompts.npsSurvey.defaultFeedbackTitle');
|
const DEFAULT_FEEDBACK_TITLE = i18n.baseText('prompts.npsSurvey.defaultFeedbackTitle');
|
||||||
const PRODUCT_TEAM_MESSAGE = i18n.baseText('prompts.productTeamMessage');
|
const FEEDBACK_QUESTION_TITLE = i18n.baseText('prompts.npsSurvey.feedbackQuestionTitle');
|
||||||
const VERY_LIKELY_OPTION = i18n.baseText('prompts.npsSurvey.veryLikely');
|
const VERY_LIKELY_OPTION = i18n.baseText('prompts.npsSurvey.veryLikely');
|
||||||
const NOT_LIKELY_OPTION = i18n.baseText('prompts.npsSurvey.notLikely');
|
const NOT_LIKELY_OPTION = i18n.baseText('prompts.npsSurvey.notLikely');
|
||||||
const SEND = i18n.baseText('prompts.npsSurvey.send');
|
const SEND = i18n.baseText('prompts.npsSurvey.send');
|
||||||
const YOUR_EMAIL_ADDRESS = i18n.baseText('prompts.npsSurvey.yourEmailAddress');
|
|
||||||
|
|
||||||
const form = ref<{ value: string; email: string }>({ value: '', email: '' });
|
const form = ref<{ value: string; feedback: string }>({
|
||||||
|
value: '',
|
||||||
|
feedback: '',
|
||||||
|
});
|
||||||
const showButtons = ref(true);
|
const showButtons = ref(true);
|
||||||
|
const showFeedback = ref(false);
|
||||||
const modalBus = createEventBus();
|
const modalBus = createEventBus();
|
||||||
|
|
||||||
const modalTitle = computed(() => {
|
const modalTitle = computed(() => {
|
||||||
|
if (showFeedback.value) {
|
||||||
|
return FEEDBACK_QUESTION_TITLE;
|
||||||
|
}
|
||||||
if (form?.value?.value !== '') {
|
if (form?.value?.value !== '') {
|
||||||
if (Number(form.value) > 7) {
|
if (Number(form.value.value) > 7) {
|
||||||
return GREAT_FEEDBACK_TITLE;
|
return GREAT_FEEDBACK_TITLE;
|
||||||
} else {
|
} else {
|
||||||
return DEFAULT_FEEDBACK_TITLE;
|
return DEFAULT_FEEDBACK_TITLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DEFAULT_TITLE;
|
return DEFAULT_TITLE;
|
||||||
});
|
});
|
||||||
|
|
||||||
const isEmailValid = computed(
|
|
||||||
() => form?.value?.email && VALID_EMAIL_REGEX.test(String(form.value.email).toLowerCase()),
|
|
||||||
);
|
|
||||||
|
|
||||||
async function closeDialog(): Promise<void> {
|
async function closeDialog(): Promise<void> {
|
||||||
if (form.value.value === '') {
|
if (form.value.value === '') {
|
||||||
telemetry.track('User responded value survey score', {
|
telemetry.track('User responded value survey score', {
|
||||||
@@ -58,22 +59,22 @@ async function closeDialog(): Promise<void> {
|
|||||||
|
|
||||||
await useNpsSurveyStore().ignoreNpsSurvey();
|
await useNpsSurveyStore().ignoreNpsSurvey();
|
||||||
}
|
}
|
||||||
if (form.value.value !== '' && form.value.email === '') {
|
// If the user closes the nps modal, we send two events
|
||||||
telemetry.track('User responded value survey email', {
|
// 1. User responded value survey score
|
||||||
|
// 2. User responded value survey feedback (if not empty)
|
||||||
|
if (form.value.value !== '' && form.value.feedback.trim() === '') {
|
||||||
|
telemetry.track('User responded value survey feedback', {
|
||||||
instance_id: rootStore.instanceId,
|
instance_id: rootStore.instanceId,
|
||||||
email: '',
|
feedback: '',
|
||||||
nps: form.value.value,
|
nps: form.value.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInputChange(value: string) {
|
|
||||||
form.value.email = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function selectSurveyValue(value: string) {
|
async function selectSurveyValue(value: string) {
|
||||||
form.value.value = value;
|
form.value.value = value;
|
||||||
showButtons.value = false;
|
showButtons.value = false;
|
||||||
|
showFeedback.value = true;
|
||||||
|
|
||||||
telemetry.track('User responded value survey score', {
|
telemetry.track('User responded value survey score', {
|
||||||
instance_id: rootStore.instanceId,
|
instance_id: rootStore.instanceId,
|
||||||
@@ -83,12 +84,16 @@ async function selectSurveyValue(value: string) {
|
|||||||
await useNpsSurveyStore().respondNpsSurvey();
|
await useNpsSurveyStore().respondNpsSurvey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFeedbackInput(value: string) {
|
||||||
|
form.value.feedback = value;
|
||||||
|
}
|
||||||
|
|
||||||
async function send() {
|
async function send() {
|
||||||
if (isEmailValid.value) {
|
if (form.value.feedback.trim() !== '') {
|
||||||
telemetry.track('User responded value survey email', {
|
telemetry.track('User responded value survey feedback', {
|
||||||
instance_id: rootStore.instanceId,
|
instance_id: rootStore.instanceId,
|
||||||
email: form.value.email,
|
|
||||||
nps: form.value.value,
|
nps: form.value.value,
|
||||||
|
feedback: form.value.feedback,
|
||||||
});
|
});
|
||||||
|
|
||||||
toast.showMessage({
|
toast.showMessage({
|
||||||
@@ -100,8 +105,9 @@ async function send() {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
form.value.value = '';
|
form.value.value = '';
|
||||||
form.value.email = '';
|
form.value.feedback = '';
|
||||||
showButtons.value = true;
|
showButtons.value = true;
|
||||||
|
showFeedback.value = false;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
modalBus.emit('close');
|
modalBus.emit('close');
|
||||||
}
|
}
|
||||||
@@ -127,7 +133,7 @@ watch(
|
|||||||
:modal="true"
|
:modal="true"
|
||||||
:wrapper-closable="false"
|
:wrapper-closable="false"
|
||||||
direction="btt"
|
direction="btt"
|
||||||
width="120px"
|
width="auto"
|
||||||
class="nps-survey"
|
class="nps-survey"
|
||||||
:class="$style.npsSurvey"
|
:class="$style.npsSurvey"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@@ -157,21 +163,23 @@ watch(
|
|||||||
<n8n-text size="small" color="text-xlight">{{ VERY_LIKELY_OPTION }}</n8n-text>
|
<n8n-text size="small" color="text-xlight">{{ VERY_LIKELY_OPTION }}</n8n-text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else :class="$style.email">
|
<div v-else-if="showFeedback" :class="$style.feedback">
|
||||||
<div :class="$style.input" data-test-id="nps-survey-email" @keyup.enter="send">
|
<div :class="$style.input" data-test-id="nps-survey-feedback">
|
||||||
<n8n-input
|
<n8n-input
|
||||||
v-model="form.email"
|
v-model="form.feedback"
|
||||||
:placeholder="YOUR_EMAIL_ADDRESS"
|
type="textarea"
|
||||||
@update:model-value="onInputChange"
|
:rows="2"
|
||||||
|
:class="$style.feedbackInput"
|
||||||
|
@update:model-value="onFeedbackInput"
|
||||||
/>
|
/>
|
||||||
<div :class="$style.button">
|
|
||||||
<n8n-button :label="SEND" float="right" :disabled="!isEmailValid" @click="send" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.disclaimer">
|
<div :class="$style.button" data-test-id="nps-survey-feedback-button">
|
||||||
<n8n-text size="small" color="text-dark">
|
<n8n-button
|
||||||
{{ PRODUCT_TEAM_MESSAGE }}
|
:label="SEND"
|
||||||
</n8n-text>
|
float="right"
|
||||||
|
:disabled="!form.feedback.trim()"
|
||||||
|
@click="send"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -197,6 +205,7 @@ watch(
|
|||||||
.content {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
@media (max-width: $breakpoint-xs) {
|
@media (max-width: $breakpoint-xs) {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
@@ -246,8 +255,23 @@ watch(
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.disclaimer {
|
.feedback {
|
||||||
margin-top: var(--spacing-4xs);
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
margin-top: 2px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedbackInput {
|
||||||
|
width: 350px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feedbackInput textarea {
|
||||||
|
resize: none;
|
||||||
|
font-family: var(--font-family);
|
||||||
}
|
}
|
||||||
|
|
||||||
.npsSurvey {
|
.npsSurvey {
|
||||||
|
|||||||
Reference in New Issue
Block a user