Source: sync/site/gf.site.sync.js

'use strict';

import '../../shared/debug-init';

/** Some small polyfills we want always. */
import 'url-search-params-polyfill';
import 'nodelist-foreach-polyfill';

/** Schedule and execute our site modules one at a time.
 *
 * - An exception thrown in the execution of a single module
 *   will not prevent another module from executing.
 *
 * TODO: Lowercase the names of imported functions, for consistency and best practice
 */

import JsCookiesGF from '../../shared/site/config/js-cookies-gf';
import GoogleTagManager from '../../shared/site/marketing/google-tag-manager';

import Bing from './marketing/bing';
import GoogleOptimizeHide from './marketing/google-optimize-hide';
import Trustpilot from './marketing/truspilot';

import LocaleDefault from './behavior/locale-default';
import LocaleRedirect from './behavior/locale-redirect';

import SearchAds from './session/search-ads';
import MarketingCampaign from './session/marketing-campaign';
import ReferralPlatform from './session/referral-platform';
import LandingPage from './session/landing-page';
import CJ from './session/cj'; // eslint-disable-line id-length
import HasOffers from './session/has-offers';
import ReferringSite from './session/referring-site';

import SentryErrorReporting from './logging/sentry-error-reporting';

import IpBanner from './visual/ip';
import CountDown from './visual/countdown';
import Popup from './visual/popup';
import IEsupportPopup from './visual/ie-support-popup';

import { runModules } from '../../shared/run-modules';

/** The list of modules in order of execution */
const modules = [
  /* Logging modules */
  SentryErrorReporting,

  /* Config */
  JsCookiesGF,

  /* Behavior Modules */
  LocaleDefault,  // Step 1: This may set our locale
  LocaleRedirect, // Step 2: This may redirect based on our locale

  /* Marketing Analytics, Tagging, etc. */
  Bing,
  GoogleOptimizeHide,
  GoogleTagManager,
  Trustpilot,

  // NOTE: SearchAds must come before LandingPage because SearchAds will
  //       strip the `__s` query params.  In the future, I will work in a
  //       system to specify dependencies so that it's codified and not
  //       a note.
  /* Session tracking modules */
  SearchAds,
  MarketingCampaign,
  ReferralPlatform,
  LandingPage,
  CJ,
  HasOffers,
  ReferringSite,

  /* Visual modifications */
  IpBanner,
  CountDown,
  Popup,
  IEsupportPopup,
];

runModules(modules);