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

index.js « merge_request_experience « surveys « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6073bde56c06587cf6d7c4952b8082ab4873e8ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Tracker } from '~/tracking/tracker';

const MR_SURVEY_WAIT_DURATION = 10000;

const broadcastNotificationVisible = () => {
  // We don't want to clutter up the UI by displaying the survey when broadcast message(s)
  // are visible as well.
  return Boolean(document.querySelector('.broadcast-notification-message'));
};

export const initMrExperienceSurvey = () => {
  if (!gon.features?.mrExperienceSurvey) return;
  if (!gon.current_user_id) return;
  if (!Tracker.enabled()) return;
  if (broadcastNotificationVisible()) return;

  setTimeout(() => {
    // eslint-disable-next-line promise/catch-or-return
    import('./app').then(({ startMrSurveyApp }) => {
      startMrSurveyApp();
    });
  }, MR_SURVEY_WAIT_DURATION);
};