Move a few more files into events src (#36574)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import Cookies from 'js-cookie'
|
||||
import { UnderlineNav } from '@primer/react'
|
||||
import { sendEvent, EventType } from 'src/events/browser'
|
||||
import { sendEvent, EventType } from 'src/events/components/events'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
type Option = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { useArticleContext } from 'components/context/ArticleContext'
|
||||
import { parseUserAgent } from 'components/lib/user-agent'
|
||||
import { parseUserAgent } from 'src/events/components/user-agent'
|
||||
import { InArticlePicker } from './InArticlePicker'
|
||||
|
||||
const platformQueryKey = 'platform'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import cx from 'classnames'
|
||||
|
||||
import { Survey } from 'components/page-footer/Survey'
|
||||
import { Survey } from 'src/events/components/Survey'
|
||||
import { Contribution } from 'components/page-footer/Contribution'
|
||||
import { Support } from 'components/page-footer/Support'
|
||||
import { useMainContext } from 'components/context/MainContext'
|
||||
|
||||
@@ -3,7 +3,7 @@ import { TreeView } from '@primer/react'
|
||||
|
||||
import { Link } from 'components/Link'
|
||||
import { ProductTreeNode } from 'components/context/MainContext'
|
||||
import { EventType, sendEvent } from 'src/events/browser'
|
||||
import { EventType, sendEvent } from 'src/events/components/events'
|
||||
|
||||
type SectionProps = {
|
||||
routePath: string
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useState, useEffect } from 'react'
|
||||
import { TreeView } from '@primer/react'
|
||||
|
||||
import { ProductTreeNode } from 'components/context/MainContext'
|
||||
import { EventType, sendEvent } from 'src/events/browser'
|
||||
import { EventType, sendEvent } from 'src/events/components/events'
|
||||
import { useAutomatedPageContext } from 'components/context/AutomatedPageContext'
|
||||
import type { MiniTocItem } from 'components/context/ArticleContext'
|
||||
import { Link } from 'components/Link'
|
||||
|
||||
@@ -15,7 +15,7 @@ import { productMap } from './all-products.js'
|
||||
import slash from 'slash'
|
||||
import readFileContents from './read-file-contents.js'
|
||||
import getLinkData from './get-link-data.js'
|
||||
import getDocumentType from './get-document-type.js'
|
||||
import getDocumentType from '../src/events/lib/get-document-type.js'
|
||||
import { union } from 'lodash-es'
|
||||
import { allTools } from './all-tools.js'
|
||||
import { renderContentWithFallback } from './render-with-fallback.js'
|
||||
|
||||
@@ -6,8 +6,8 @@ import { ThemeProvider, SSRProvider } from '@primer/react'
|
||||
|
||||
import '../stylesheets/index.scss'
|
||||
|
||||
import { initializeEvents } from 'src/events/browser'
|
||||
import { initializeExperiments } from 'src/events/experiment'
|
||||
import { initializeEvents } from 'src/events/components/events'
|
||||
import { initializeExperiments } from 'src/events/components/experiment'
|
||||
import {
|
||||
LanguagesContext,
|
||||
LanguagesContextT,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router'
|
||||
import { ThumbsdownIcon, ThumbsupIcon } from '@primer/octicons-react'
|
||||
import { useTranslation } from 'components/hooks/useTranslation'
|
||||
import { Link } from 'components/Link'
|
||||
import { sendEvent, EventType } from 'src/events/browser'
|
||||
import { sendEvent, EventType } from 'src/events/components/events'
|
||||
|
||||
import styles from './Survey.module.scss'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Cookies from 'js-cookie'
|
||||
import { parseUserAgent } from '../../components/lib/user-agent'
|
||||
import { parseUserAgent } from './user-agent'
|
||||
|
||||
const COOKIE_NAME = '_docs-events'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import murmur from 'imurmurhash'
|
||||
import { getUserEventsId, sendEvent, EventType } from './browser'
|
||||
import { getUserEventsId, sendEvent, EventType } from './events'
|
||||
|
||||
let initialized = false
|
||||
|
||||
@@ -2,9 +2,9 @@ import { createHmac } from 'crypto'
|
||||
import { Agent } from 'node:https'
|
||||
import got from 'got'
|
||||
import { isNil } from 'lodash-es'
|
||||
import statsd from '../../lib/statsd.js'
|
||||
import { report } from '../../lib/failbot.js'
|
||||
import { MAX_REQUEST_TIMEOUT } from '../../lib/constants.js'
|
||||
import statsd from '../../../lib/statsd.js'
|
||||
import { report } from '../../../lib/failbot.js'
|
||||
import { MAX_REQUEST_TIMEOUT } from '../../../lib/constants.js'
|
||||
|
||||
const TIME_OUT_TEXT = 'ms has passed since batch creation'
|
||||
const SERVER_DISCONNECT_TEXT = 'The server disconnected before a response was received'
|
||||
@@ -1,7 +1,7 @@
|
||||
import { languageKeys } from '../../lib/languages.js'
|
||||
import { allVersionKeys } from '../../lib/all-versions.js'
|
||||
import { productIds } from '../../lib/all-products.js'
|
||||
import { allTools } from '../../lib/all-tools.js'
|
||||
import { languageKeys } from '../../../lib/languages.js'
|
||||
import { allVersionKeys } from '../../../lib/all-versions.js'
|
||||
import { productIds } from '../../../lib/all-products.js'
|
||||
import { allTools } from '../../../lib/all-tools.js'
|
||||
|
||||
const versionPattern = '^\\d+(\\.\\d+)?(\\.\\d+)?$' // eslint-disable-line
|
||||
|
||||
@@ -2,11 +2,11 @@ import express from 'express'
|
||||
import { omit, without, mapValues } from 'lodash-es'
|
||||
import Ajv from 'ajv'
|
||||
import addFormats from 'ajv-formats'
|
||||
import { schemas, hydroNames } from './schema.js'
|
||||
import { schemas, hydroNames } from './lib/schema.js'
|
||||
import catchMiddlewareError from '../../middleware/catch-middleware-error.js'
|
||||
import { noCacheControl } from '../../middleware/cache-control.js'
|
||||
import { formatErrors } from './middleware-errors.js'
|
||||
import { publish as _publish } from './hydro.js'
|
||||
import { formatErrors } from './lib/middleware-errors.js'
|
||||
import { publish as _publish } from './lib/hydro.js'
|
||||
|
||||
const router = express.Router()
|
||||
const ajv = new Ajv()
|
||||
@@ -43,7 +43,7 @@ router.post(
|
||||
const validate = validations[type]
|
||||
if (!validate(req.body)) {
|
||||
// Track validation errors in Hydro so that we can know if
|
||||
// there's a widespread problem in browser.ts
|
||||
// there's a widespread problem in events.ts
|
||||
await publish(
|
||||
formatErrors(validate.errors, req.body).map((error) => ({
|
||||
schema: hydroNames.validation,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { afterEach } from '@jest/globals'
|
||||
import nock from 'nock'
|
||||
import { publish } from '../hydro.js'
|
||||
import { publish } from '../lib/hydro.js'
|
||||
|
||||
describe('Hydro', () => {
|
||||
const secret = '3BD22A91'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Ajv from 'ajv'
|
||||
import addFormats from 'ajv-formats'
|
||||
import { formatErrors } from '../middleware-errors.js'
|
||||
import { schemas } from '../schema.js'
|
||||
import { formatErrors } from '../lib/middleware-errors.js'
|
||||
import { schemas } from '../lib/schema.js'
|
||||
|
||||
const ajv = new Ajv()
|
||||
addFormats(ajv)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parseUserAgent } from '../../components/lib/user-agent.ts'
|
||||
import { parseUserAgent } from '../components/user-agent.ts'
|
||||
|
||||
describe('parseUserAgent', () => {
|
||||
it('android, chrome', () => {
|
||||
@@ -7,7 +7,7 @@ import type { SearchResultsT, SearchResultHitT } from './types'
|
||||
import { useTranslation } from 'components/hooks/useTranslation'
|
||||
import { Link } from 'components/Link'
|
||||
import { useQuery } from 'components/hooks/useQuery'
|
||||
import { sendEvent, EventType } from 'src/events/browser'
|
||||
import { sendEvent, EventType } from 'src/events/components/events'
|
||||
|
||||
import styles from './SearchResults.module.scss'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
|
||||
import Head from 'next/head'
|
||||
import { Heading } from '@primer/react'
|
||||
|
||||
import { sendEvent, EventType } from 'src/events/browser'
|
||||
import { sendEvent, EventType } from 'src/events/components/events'
|
||||
import { useTranslation } from 'components/hooks/useTranslation'
|
||||
import { DEFAULT_VERSION, useVersion } from 'components/hooks/useVersion'
|
||||
import { useNumberFormatter } from 'components/hooks/useNumberFormatter'
|
||||
|
||||
Reference in New Issue
Block a user