<commit_before>#
# CLient-side code that runs **everywhere**. STOP! Think if what you're about
# to include in this file can actually live somewhere else like a relavent app
# or component.
#

$ = require 'jquery'
Backbone = require 'backbone'
Backbone.$ = $
_ = require 'underscore'
{ uniqBy } = require 'lodash'
Cookies = require 'cookies-js'
imagesLoaded = require 'imagesloaded'
Raven = require 'raven-js'
sd = require('sharify').data
mediator = require './mediator.coffee'
templateModules = require './template_modules.coffee'
setupSplitTests = require '../components/split_test/setup.coffee'
listenForInvert = require '../components/eggs/invert/index.coffee'
listenForBounce = require '../components/eggs/bounce/index.coffee'
confirmation = require '../components/confirmation/index.coffee'
globalReactModules = require('./global_react_modules')
{ componentRenderer } = require('@artsy/stitch/iso')
{ initModalManager } = require('../../desktop/apps/auth2/client/index')

module.exports = ->
  setupErrorReporting()
  setupJquery()
  setupReferrerTracking()
  syncAuth()
  listenForInvert()
  listenForBounce()
  confirmation.check()
  mountStitchBlocks()


ensureFreshUser = (data) ->
  return unless sd.CURRENT_USER
  for attr in ['id', 'type', 'name', 'email', 'phone', 'lab_features',
               'default_profile_id', 'has_partner_access', 'collector_level']

    # NOTE:
    # If any of the above props have changed between two routes, and the second
    # route fails to mount sd.locals.CURRENT_USER with the latest req.user.fetch()
    # data, a hard refresh will occur once the client-side mounts as the two<commit_msg>Re-add initModalManager call<commit_after>#
# CLient-side code that runs **everywhere**. STOP! Think if what you're about
# to include in this file can actually live somewhere else like a relavent app
# or component.
#

$ = require 'jquery'
Backbone = require 'backbone'
Backbone.$ = $
_ = require 'underscore'
{ uniqBy } = require 'lodash'
Cookies = require 'cookies-js'
imagesLoaded = require 'imagesloaded'
Raven = require 'raven-js'
sd = require('sharify').data
mediator = require './mediator.coffee'
templateModules = require './template_modules.coffee'
setupSplitTests = require '../components/split_test/setup.coffee'
listenForInvert = require '../components/eggs/invert/index.coffee'
listenForBounce = require '../components/eggs/bounce/index.coffee'
confirmation = require '../components/confirmation/index.coffee'
globalReactModules = require('./global_react_modules')
{ componentRenderer } = require('@artsy/stitch/iso')
{ initModalManager } = require('../../desktop/apps/auth2/client/index')

module.exports = ->
  setupErrorReporting()
  setupJquery()
  setupReferrerTracking()
  syncAuth()
  listenForInvert()
  listenForBounce()
  confirmation.check()
  initModalManager()
  mountStitchBlocks()


ensureFreshUser = (data) ->
  return unless sd.CURRENT_USER
  for attr in ['id', 'type', 'name', 'email', 'phone', 'lab_features',
               'default_profile_id', 'has_partner_access', 'collector_level']

    # NOTE:
    # If any of the above props have changed between two routes, and the second
    # route fails to mount sd.locals.CURRENT_USER with the latest req.user.fetch()
    # data, a hard refresh will occur once the client-side mounts as the two
{'fraction_non_alphanumeric': 0.12537764350453173, 'fraction_numerical': 0.0006042296072507553, 'mean_word_length': 4.564705882352941, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7475927', 'n_tokens_mistral': 1015, 'n_tokens_neox': 994, 'n_words': 276}