Welcome to mirror list, hosted at ThFree Co, Russian Federation.

survey_banner.js « serverless « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 070e8f4c6615697998c8260cbd1f843a39ce01fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Vue from 'vue';
import { setUrlParams } from '~/lib/utils/url_utility';
import SurveyBanner from './survey_banner.vue';

let bannerInstance;
const SURVEY_URL_BASE = 'https://gitlab.fra1.qualtrics.com/jfe/form/SV_00PfofFfY9s8Shf';

export default function initServerlessSurveyBanner() {
  const el = document.querySelector('.js-serverless-survey-banner');
  if (el && !bannerInstance) {
    const { userName, userEmail } = el.dataset;

    // pre-populate survey fields
    const surveyUrl = setUrlParams(
      {
        Q_PopulateResponse: JSON.stringify({
          QID1: userEmail,
          QID2: userName,
          QID16: '1', // selects "yes" to "do you currently use GitLab?"
        }),
      },
      SURVEY_URL_BASE,
    );

    bannerInstance = new Vue({
      el,
      render(createElement) {
        return createElement(SurveyBanner, {
          props: {
            surveyUrl,
          },
        });
      },
    });
  }
}