<commit_before>import "utils/polyfills" // necessary for IE11
import React from "react"
import ReactDOM from "react-dom"
import { Provider } from "react-redux"
import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles"
import { ConnectedRouter } from "connected-react-router"
import { ApolloProvider } from "@apollo/react-hooks"
import { ApolloClient } from "apollo-client"
import { InMemoryCache } from "apollo-cache-inmemory"
import { createHttpLink } from "apollo-link-http"
import { persistCache } from "apollo-cache-persist"
import { createPersistedQueryLink } from "apollo-link-persisted-queries"
import CssBaseline from "@material-ui/core/CssBaseline"
import { hydrateAll, hydrateStore } from "dicty-components-redux"
import configureStore from "store"
import history from "utils/routerHistory"
import App from "components/App"
import "typeface-roboto"

// load state from localStorage(if any) to set the
// initial state for the store
const initialState = hydrateAll(
  hydrateStore({ key: "auth", namespace: "auth" }),
  hydrateStore({ key: "cart", namespace: "shoppingCart" }),
)
const store = configureStore(initialState)

// set up automatic persisted queries
// https://www.apollographql.com/docs/apollo-server/performance/apq/
const link = createPersistedQueryLink().concat(
  createHttpLink({ uri: `${process.env.REACT_APP_GRAPHQL_SERVER}/graphql` }),
)

// Use an InMemoryCache, but keep it synced to localStorage
const cache = new InMemoryCache()
const storage = window.localStorage
const waitOnCache = persistCache({ cache, storage })

export const client = new ApolloClient({
  link,
  cache,
})

const setGoogleAnalytics = async (location, action) => {
  try {
    const module = await import("react-ga")
    let ReactGA = module.default
    ReactGA.initialize(process.env.REACT_APP_GA_TRACKING_ID)
    ReactGA.set({ page: window.location.pathname, anonymizeIp: true })
    ReactGA.pageview(window.location.pathname)
  } catch (e) {
    console.error("could not load react-ga module", JSON.stringify(e))
  }
}

if (process.env.NODE_ENV === "production") {
  history.listen((location, action) => {
    setGoogleAnalytics(location, action)
  })
}

const theme = createMuiTheme({
  palette: {
    primary: {
      main: "#004080",
    },
  },
})

// Wait for the cache to sync before starting the app
waitOnCache.then(() => {
  ReactDOM.render(
    <ApolloProvider client={client}>
      <Provider store={store}>
        <ConnectedRouter history={history}>
          <MuiThemeProvider theme={theme}>
            <CssBaseline />
            <App />
          </MuiThemeProvider>
        </ConnectedRouter>
      </Provider>
    </ApolloProvider>,
    document.getElementById("root"),
  )
})
<commit_msg>refactor: set button default to not be all caps<commit_after>import "utils/polyfills" // necessary for IE11
import React from "react"
import ReactDOM from "react-dom"
import { Provider } from "react-redux"
import { MuiThemeProvider, createMuiTheme } from "@material-ui/core/styles"
import { ConnectedRouter } from "connected-react-router"
import { ApolloProvider } from "@apollo/react-hooks"
import { ApolloClient } from "apollo-client"
import { InMemoryCache } from "apollo-cache-inmemory"
import { createHttpLink } from "apollo-link-http"
import { persistCache } from "apollo-cache-persist"
import { createPersistedQueryLink } from "apollo-link-persisted-queries"
import CssBaseline from "@material-ui/core/CssBaseline"
import { hydrateAll, hydrateStore } from "dicty-components-redux"
import configureStore from "store"
import history from "utils/routerHistory"
import App from "components/App"
import "typeface-roboto"

// load state from localStorage(if any) to set the
// initial state for the store
const initialState = hydrateAll(
  hydrateStore({ key: "auth", namespace: "auth" }),
  hydrateStore({ key: "cart", namespace: "shoppingCart" }),
)
const store = configureStore(initialState)

// set up automatic persisted queries
// https://www.apollographql.com/docs/apollo-server/performance/apq/
const link = createPersistedQueryLink().concat(
  createHttpLink({ uri: `${process.env.REACT_APP_GRAPHQL_SERVER}/graphql` }),
)

// Use an InMemoryCache, but keep it synced to localStorage
const cache = new InMemoryCache()
const storage = window.localStorage
const waitOnCache = persistCache({ cache, storage })

export const client = new ApolloClient({
  link,
  cache,
})

const setGoogleAnalytics = async (location, action) => {
  try {
    const module = await import("react-ga")
    let ReactGA = module.default
    ReactGA.initialize(process.env.REACT_APP_GA_TRACKING_ID)
    ReactGA.set({ page: window.location.pathname, anonymizeIp: true })
    ReactGA.pageview(window.location.pathname)
  } catch (e) {
    console.error("could not load react-ga module", JSON.stringify(e))
  }
}

if (process.env.NODE_ENV === "production") {
  history.listen((location, action) => {
    setGoogleAnalytics(location, action)
  })
}

const theme = createMuiTheme({
  palette: {
    primary: {
      main: "#004080",
    },
  },
  typography: {
    button: {
      textTransform: "none",
    },
  },
})

// Wait for the cache to sync before starting the app
waitOnCache.then(() => {
  ReactDOM.render(
    <ApolloProvider client={client}>
      <Provider store={store}>
        <ConnectedRouter history={history}>
          <MuiThemeProvider theme={theme}>
            <CssBaseline />
            <App />
          </MuiThemeProvider>
        </ConnectedRouter>
      </Provider>
    </ApolloProvider>,
    document.getElementById("root"),
  )
})

{'fraction_non_alphanumeric': 0.12390173928635467, 'fraction_numerical': 0.002868925945849023, 'mean_word_length': 4.131554737810488, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '858912', 'n_tokens_mistral': 1730, 'n_tokens_neox': 1693, 'n_words': 434}