Implement a `SurveyViewTrigger` component
See original GitHub issueFeature Description
User surveys require a trigger to be dispatched which may or may not result in a survey to be displayed. The first trigger that we will need is a view trigger. The easiest way to add this is by adding a dedicated component that triggers a view when it is first mounted. This requires the triggerSurvey action implemented in #3355.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- A
SurveyViewTriggercomponent should be added which when rendered dispatchestriggerSurveywith the necessary arguments provided via props, but should only do so once, when initially mounted- Should require a
triggerIDprop as a string - Should accept an optional
ttlprop as a number - Should only call
triggerSurveyif the site is connected via the proxy (seeisUsingProxyvia thecore/sitestore)
- Should require a
- Should be added to trigger a survey when the main Site Kit dashboard is rendered
triggerIDmust beview_dashboardttlshould be 1 hour in milliseconds- Should be conditionally rendered based on the enabled state of the
userFeedbackfeature flag
Implementation Brief
- Create
assets/js/components/surveys/SurveyViewTrigger.jswhich exports theSurveyViewTriggerfunctional component with the props defined in the AC. - Using the
useMounthook, check if the site is connected via the proxy by querying thecore/sitedata store via theisUsingProxyselector.- If this is the case, then dispatch the
triggerSurveyaction passing thetriggerIDprop andttlprop as parameters.
- If this is the case, then dispatch the
- Using the
DashboardAppcomponent,- Check if the
userFeedbackfeature flag is enabled by using theuseFeaturehook. - If this is the case, then render the
SurveyViewTriggercomponent with the prop values defined in the AC.
- Check if the
Test Coverage
- No new tests to be added.
Visual Regression Changes
- N/A
QA Brief
- Check that new components have been created, and changes implemented, as per the AC above
Changelog entry
- Add React component for triggering a user survey on view.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Complete Trigger, Vue Survey Library Example - SurveyJS
The complete trigger is called on the next page action. The complete trigger completes the survey if the ('question' value 'operator' 'value') returns...
Read more >Survey builder for vue.js applications - GitHub
This is a survey builder component for vue.js applications. How to install. You can install the component using npm i -S vue-survey-builder ...
Read more >$emit doesn't trigger parent component VueJs with TypeScript
I search the Internet and it looks like it should work but it doesn't. <template> <div> <h2>Survey Page 1</h2> ...
Read more >[Solved]-Navigating through Vue.Js survey-Vue.js
You should look at making a Vue component that is for a survey question that way you can easily create multiple different questions....
Read more >An introduction to Vue.js - Part 2: How to develop components ...
In the child component, you can use the $emit function provided by Vue.js to trigger an event. It is here, where the event...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@danielgent could you please update the QA Brief so Cole or Darren can QA it? This ticket doesn’t have the
QA: Engtag which means that it should be tested by a QA engineer.@aaemnnosttv Just a note about this line:
It should be the core/site store if am not mistaken 😁