diff --git a/playground/nextjs/pages/index.tsx b/playground/nextjs/pages/index.tsx index f2a72d5fb..ba13076b8 100644 --- a/playground/nextjs/pages/index.tsx +++ b/playground/nextjs/pages/index.tsx @@ -2,7 +2,7 @@ import { useActiveFeatureFlags, usePostHog } from 'posthog-js/react' import { useEffect, useState } from 'react' import { cookieConsentGiven, PERSON_PROCESSING_MODE } from '@/src/posthog' -import { setAllPersonProfilePropertiesAsPersonPropertiesForFlags } from 'posthog-js/lib/src/customizations/setAllPersonProfilePropertiesAsPersonPropertiesForFlags' +import { setAllPersonProfilePropertiesAsPersonPropertiesForFlags } from 'posthog-js/lib/customizations' import { STORED_PERSON_PROPERTIES_KEY } from '../../../src/constants' export default function Home() { diff --git a/rollup.config.js b/rollup.config.js index f947d51c8..b791c88eb 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -106,7 +106,7 @@ const entrypointTargets = entrypoints.map((file) => { const typeTargets = entrypoints .filter((file) => file.endsWith('.es.ts')) .map((file) => { - const source = `./lib/src/entrypoints/${file.replace('.ts', '.d.ts')}` + const source = `./lib/entrypoints/${file.replace('.ts', '.d.ts')}` /** @type {import('rollup').RollupOptions} */ return { input: source, diff --git a/src/customizations/index.ts b/src/customizations/index.ts new file mode 100644 index 000000000..7cb66f40b --- /dev/null +++ b/src/customizations/index.ts @@ -0,0 +1,2 @@ +export * from './setAllPersonProfilePropertiesAsPersonPropertiesForFlags' +export * from './before-send' diff --git a/src/entrypoints/customizations.full.ts b/src/entrypoints/customizations.full.ts new file mode 100644 index 000000000..eb17c13c0 --- /dev/null +++ b/src/entrypoints/customizations.full.ts @@ -0,0 +1,7 @@ +// this file is called customizations.full.ts because it includes all customizations +// this naming scheme allows us to create a lighter version in the future with only the most popular customizations +// without breaking backwards compatibility + +import * as customizations from '../customizations' +import { assignableWindow } from '../utils/globals' +assignableWindow.posthogCustomizations = customizations diff --git a/src/posthog-persistence.ts b/src/posthog-persistence.ts index 131c85ed6..0a5546c00 100644 --- a/src/posthog-persistence.ts +++ b/src/posthog-persistence.ts @@ -224,7 +224,7 @@ export class PostHogPersistence { const campaignParams = Info.campaignParams(this.config.custom_campaign_params) // only save campaign params if there were any if (!isEmptyObject(stripEmptyProperties(campaignParams))) { - this.register(Info.campaignParams(this.config.custom_campaign_params)) + this.register(campaignParams) } this.campaign_params_saved = true } diff --git a/tsconfig.json b/tsconfig.json index 07e5b9c4c..ccc976cd8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "rootDir": "./src", "outDir": "./lib", "target": "ES5", "lib": ["dom", "dom.iterable", "esnext"],