Skip to content

Commit

Permalink
chore: rename and move utils to libs/global-analytics-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
oscb committed Sep 8, 2023
1 parent dae77ba commit 5a75461
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/browser/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { popSnippetWindowBuffer } from '../core/buffer/snippet'
import { ClassicIntegrationSource } from '../plugins/ajs-destination/types'
import { attachInspector } from '../core/inspector'
import { Stats } from '../core/stats'
import { setGlobalAnalyticsKey } from './utils'
import { setGlobalAnalyticsKey } from '../lib/global-analytics-helper'

export interface LegacyIntegrationConfiguration {
/* @deprecated - This does not indicate browser types anymore */
Expand Down
5 changes: 4 additions & 1 deletion packages/browser/src/browser/standalone-analytics.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { AnalyticsBrowser } from '.'
import { embeddedWriteKey } from '../lib/embedded-write-key'
import { AnalyticsSnippet } from './standalone-interface'
import { getGlobalAnalytics, setGlobalAnalytics } from './utils'
import {
getGlobalAnalytics,
setGlobalAnalytics,
} from '../lib/global-analytics-helper'

function getWriteKey(): string | undefined {
if (embeddedWriteKey()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/core/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {
isArrayOfStoreType,
} from '../storage'
import { PluginFactory } from '../../plugins/remote-loader'
import { setGlobalAnalytics } from '../../browser/utils'
import { setGlobalAnalytics } from '../../lib/global-analytics-helper'

const deprecationWarning =
'This is being deprecated and will be not be available in future releases of Analytics JS'
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/core/buffer/snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
PreInitMethodName,
PreInitMethodParams,
} from '.'
import { getGlobalAnalytics } from '../../browser/utils'
import { getGlobalAnalytics } from '../../lib/global-analytics-helper'

export function transformSnippetCall([
methodName,
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export * from './core/user'

export type { AnalyticsSnippet } from './browser/standalone-interface'
export type { MiddlewareFunction } from './plugins/middleware'
export { getGlobalAnalytics } from './browser/utils'
export { getGlobalAnalytics } from './lib/global-analytics-helper'
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AnalyticsSnippet } from './standalone-interface'
import { AnalyticsSnippet } from '../browser/standalone-interface'

/**
* Stores the global window analytics key
*/
let _globalAnalyticsKey = 'analytics'

/**
* Gets the global analytics instance/buffer
* Gets the global analytics/buffer
* @param key name of the window property where the buffer is stored (default: analytics)
* @returns AnalyticsSnippet
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/lib/parse-cdn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getGlobalAnalytics } from '../browser/utils'
import { getGlobalAnalytics } from './global-analytics-helper'
import { embeddedWriteKey } from './embedded-write-key'

const analyticsScriptRegex =
Expand Down

0 comments on commit 5a75461

Please sign in to comment.