@amplitude/analytics-core 2.47.1 → 2.48.1-sr-idb-multitab-test-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/cjs/index.d.ts +1 -0
  2. package/lib/cjs/index.d.ts.map +1 -1
  3. package/lib/cjs/index.js +3 -1
  4. package/lib/cjs/index.js.map +1 -1
  5. package/lib/cjs/plugins/destination.d.ts.map +1 -1
  6. package/lib/cjs/plugins/destination.js +1 -1
  7. package/lib/cjs/plugins/destination.js.map +1 -1
  8. package/lib/cjs/timeline.d.ts +3 -0
  9. package/lib/cjs/timeline.d.ts.map +1 -1
  10. package/lib/cjs/timeline.js +25 -8
  11. package/lib/cjs/timeline.js.map +1 -1
  12. package/lib/cjs/types/client/browser-client.d.ts +0 -6
  13. package/lib/cjs/types/client/browser-client.d.ts.map +1 -1
  14. package/lib/cjs/types/client/browser-client.js.map +1 -1
  15. package/lib/cjs/types/config/browser-config.d.ts +1 -2
  16. package/lib/cjs/types/config/browser-config.d.ts.map +1 -1
  17. package/lib/cjs/types/config/browser-config.js.map +1 -1
  18. package/lib/cjs/types/config/core-config.d.ts +0 -6
  19. package/lib/cjs/types/config/core-config.d.ts.map +1 -1
  20. package/lib/cjs/types/config/core-config.js.map +1 -1
  21. package/lib/cjs/types/config/node-config.d.ts +1 -1
  22. package/lib/cjs/types/config/node-config.d.ts.map +1 -1
  23. package/lib/cjs/types/config/node-config.js.map +1 -1
  24. package/lib/cjs/types/config/react-native-config.d.ts +1 -1
  25. package/lib/cjs/types/config/react-native-config.d.ts.map +1 -1
  26. package/lib/cjs/types/config/react-native-config.js.map +1 -1
  27. package/lib/cjs/utils/environment.d.ts +2 -0
  28. package/lib/cjs/utils/environment.d.ts.map +1 -0
  29. package/lib/cjs/utils/environment.js +11 -0
  30. package/lib/cjs/utils/environment.js.map +1 -0
  31. package/lib/esm/index.d.ts +1 -0
  32. package/lib/esm/index.d.ts.map +1 -1
  33. package/lib/esm/index.js +1 -0
  34. package/lib/esm/index.js.map +1 -1
  35. package/lib/esm/plugins/destination.d.ts.map +1 -1
  36. package/lib/esm/plugins/destination.js +1 -1
  37. package/lib/esm/plugins/destination.js.map +1 -1
  38. package/lib/esm/timeline.d.ts +3 -0
  39. package/lib/esm/timeline.d.ts.map +1 -1
  40. package/lib/esm/timeline.js +25 -8
  41. package/lib/esm/timeline.js.map +1 -1
  42. package/lib/esm/types/client/browser-client.d.ts +0 -6
  43. package/lib/esm/types/client/browser-client.d.ts.map +1 -1
  44. package/lib/esm/types/client/browser-client.js.map +1 -1
  45. package/lib/esm/types/config/browser-config.d.ts +1 -2
  46. package/lib/esm/types/config/browser-config.d.ts.map +1 -1
  47. package/lib/esm/types/config/browser-config.js.map +1 -1
  48. package/lib/esm/types/config/core-config.d.ts +0 -6
  49. package/lib/esm/types/config/core-config.d.ts.map +1 -1
  50. package/lib/esm/types/config/core-config.js.map +1 -1
  51. package/lib/esm/types/config/node-config.d.ts +1 -1
  52. package/lib/esm/types/config/node-config.d.ts.map +1 -1
  53. package/lib/esm/types/config/node-config.js.map +1 -1
  54. package/lib/esm/types/config/react-native-config.d.ts +1 -1
  55. package/lib/esm/types/config/react-native-config.d.ts.map +1 -1
  56. package/lib/esm/types/config/react-native-config.js.map +1 -1
  57. package/lib/esm/utils/environment.d.ts +2 -0
  58. package/lib/esm/utils/environment.d.ts.map +1 -0
  59. package/lib/esm/utils/environment.js +7 -0
  60. package/lib/esm/utils/environment.js.map +1 -0
  61. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/timeline.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;IAaE,kBAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAZtC,UAAK,GAA6B,EAAE,CAAC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AAjC,QAAQ;;;;wBAEf,qBAAM,QAAQ,CAAC,MAAM,CAAC,EAAA;;wBAAtB,SAAsB,CAAC;;;;wBAEvB,0BAA0B;wBAC1B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,+BAA+B,EAAE,GAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;KAGnE;IAED,0BAAO,GAAP;QACE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;;YAC1B,gEAAgE;YAChE,wDAAwD;YACxD,0DAA0D;YAC1D,0BAA0B;YAC1B,KAAK,CAAA,MAAA,MAAM,CAAC,OAAO,sDAAI,CAAA,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IACH,eAAC;AAAD,CAAC,AA5OD,IA4OC","sourcesContent":["import { AnalyticsIdentity, BeforePlugin, DestinationPlugin, EnrichmentPlugin, Plugin } from './types/plugin';\nimport { CoreClient } from './types/client/core-client';\nimport { IConfig } from './types/config/core-config';\nimport { ILogger } from './logger';\nimport { EventCallback } from './types/event-callback';\nimport { Event } from './types/event/event';\nimport { Result } from './types/result';\nimport { buildResult } from './utils/result-builder';\nimport { UUID } from './utils/uuid';\n\nexport class Timeline {\n queue: [Event, EventCallback][] = [];\n // Flag to guarantee one schedule apply is running\n applying = false;\n // Flag indicates whether timeline is ready to process event\n // Events collected before timeline is ready will stay in the queue to be processed later\n plugins: Plugin[] = [];\n // loggerProvider is set by the client at _init()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n loggerProvider: ILogger;\n _optOutListeners: ((optOut: boolean) => Promise<void>)[] = [];\n\n constructor(private client: CoreClient) {}\n\n async register(plugin: Plugin, config: IConfig) {\n if (this.plugins.some((existingPlugin) => existingPlugin.name === plugin.name)) {\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n this.loggerProvider.warn(`Plugin with name ${plugin.name} already exists, skipping registration`);\n return;\n }\n\n if (plugin.name === undefined) {\n plugin.name = UUID();\n this.loggerProvider.warn(`Plugin name is undefined. \n Generating a random UUID for plugin name: ${plugin.name}. \n Set a name for the plugin to prevent it from being added multiple times.`);\n }\n\n plugin.type = plugin.type ?? 'enrichment';\n await plugin.setup?.(config, this.client);\n this.plugins.push(plugin);\n }\n\n async deregister(pluginName: string, config: IConfig) {\n const index = this.plugins.findIndex((plugin) => plugin.name === pluginName);\n if (index === -1) {\n config.loggerProvider.warn(`Plugin with name ${pluginName} does not exist, skipping deregistration`);\n return;\n }\n const plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n await plugin.teardown?.();\n }\n\n reset(client: CoreClient) {\n this._clearOptOutListeners();\n this.applying = false;\n const plugins = this.plugins;\n plugins.map((plugin) => plugin.teardown?.());\n this.plugins = [];\n this.client = client;\n }\n\n push(event: Event) {\n return new Promise<Result>((resolve) => {\n this.queue.push([event, resolve]);\n this.scheduleApply(0);\n });\n }\n\n scheduleApply(timeout: number) {\n if (this.applying) return;\n this.applying = true;\n setTimeout(() => {\n void this.apply(this.queue.shift()).then(() => {\n this.applying = false;\n if (this.queue.length > 0) {\n this.scheduleApply(0);\n }\n });\n }, timeout);\n }\n\n async apply(item: [Event, EventCallback] | undefined) {\n if (!item) {\n return;\n }\n\n let [event] = item;\n const [, resolve] = item;\n\n // Log initial event\n this.loggerProvider.log('Timeline.apply: Initial event', event);\n\n const before = this.plugins.filter<BeforePlugin>(\n (plugin: Plugin): plugin is BeforePlugin => plugin.type === 'before',\n );\n\n for (const plugin of before) {\n /* istanbul ignore if */\n if (!plugin.execute) {\n // do nothing\n continue;\n }\n const e = await plugin.execute({ ...event });\n if (e === null) {\n this.loggerProvider.log(\n `Timeline.apply: Event filtered out by before plugin '${String(plugin.name)}', event: ${JSON.stringify(\n event,\n )}`,\n );\n resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\n this.loggerProvider.log(\n `Timeline.apply: Event after before plugin '${String(plugin.name)}', event: ${JSON.stringify(event)}`,\n );\n }\n }\n\n const enrichment = this.plugins.filter<EnrichmentPlugin>(\n (plugin: Plugin): plugin is EnrichmentPlugin => plugin.type === 'enrichment' || plugin.type === undefined,\n );\n\n for (const plugin of enrichment) {\n /* istanbul ignore if */\n if (!plugin.execute) {\n // do nothing\n continue;\n }\n const e = await plugin.execute({ ...event });\n if (e === null) {\n this.loggerProvider.log(\n `Timeline.apply: Event filtered out by enrichment plugin '${String(plugin.name)}', event: ${JSON.stringify(\n event,\n )}`,\n );\n resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\n this.loggerProvider.log(\n `Timeline.apply: Event after enrichment plugin '${String(plugin.name)}', event: ${JSON.stringify(event)}`,\n );\n }\n }\n\n const destination = this.plugins.filter<DestinationPlugin>(\n (plugin: Plugin): plugin is DestinationPlugin => plugin.type === 'destination',\n );\n\n // Log final event before sending to destinations\n this.loggerProvider.log(`Timeline.apply: Final event before destinations, event: ${JSON.stringify(event)}`);\n\n const executeDestinations = destination.map((plugin) => {\n const eventClone = { ...event };\n return plugin.execute(eventClone).catch((e) => buildResult(eventClone, 0, String(e)));\n });\n\n void Promise.all(executeDestinations).then(([result]) => {\n const resolveResult =\n result || buildResult(event, 100, 'Event not tracked, no destination plugins on the instance');\n resolve(resolveResult);\n });\n\n return;\n }\n\n async flush() {\n const queue = this.queue;\n this.queue = [];\n\n await Promise.all(queue.map((item) => this.apply(item)));\n\n const destination = this.plugins.filter<DestinationPlugin>(\n (plugin: Plugin): plugin is DestinationPlugin => plugin.type === 'destination',\n );\n\n const executeDestinations = destination.map((plugin) => {\n return plugin.flush && plugin.flush();\n });\n\n await Promise.all(executeDestinations);\n }\n\n addOptOutListener(cb: (optOut: boolean) => Promise<void>) {\n this._optOutListeners.push(cb);\n }\n\n _clearOptOutListeners() {\n this._optOutListeners = [];\n }\n\n onIdentityChanged(identity: AnalyticsIdentity) {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onIdentityChanged() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onIdentityChanged?.(identity);\n });\n }\n\n onSessionIdChanged(sessionId: number) {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onSessionIdChanged() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onSessionIdChanged?.(sessionId);\n });\n }\n\n onOptOutChanged(optOut: boolean) {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onOptOutChanged() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onOptOutChanged?.(optOut);\n });\n void this._callOptOutListeners(optOut);\n }\n\n async _callOptOutListeners(optOut: boolean) {\n for (const listener of this._optOutListeners) {\n try {\n await listener(optOut);\n } catch (e) {\n /* istanbul ignore next */\n this.loggerProvider.error('Error calling optOut listener', e);\n }\n }\n }\n\n onReset() {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onReset() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onReset?.();\n });\n }\n}\n"]}
1
+ {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/timeline.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC;IAgBE,kBAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAftC,UAAK,GAA6B,EAAE,CAAC;QACrC,kDAAkD;QAClD,aAAQ,GAAG,KAAK,CAAC;QACjB,YAAO,GAAa,EAAE,CAAC;QACvB,mFAAmF;QACnF,wFAAwF;QACxF,sFAAsF;QACtF,wCAAwC;QACxC,iBAAY,GAA8B,IAAI,GAAG,EAAE,CAAC;QAKpD,qBAAgB,GAA2C,EAAE,CAAC;IAErB,CAAC;IAEpC,2BAAQ,GAAd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,eAAe,uDAAG,MAAM,CAAC,CAAA,CAAC;QACxC,CAAC,CAAC,CAAC;QACH,KAAK,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAEK,uCAAoB,GAA1B,UAA2B,MAAe;;;;;;;;wBACjB,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA;;;;wBAAjC,QAAQ;;;;wBAEf,qBAAM,QAAQ,CAAC,MAAM,CAAC,EAAA;;wBAAtB,SAAsB,CAAC;;;;wBAEvB,0BAA0B;wBAC1B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,+BAA+B,EAAE,GAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;KAGnE;IAED,0BAAO,GAAP;QACE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;;YAC1B,gEAAgE;YAChE,wDAAwD;YACxD,0DAA0D;YAC1D,0BAA0B;YAC1B,KAAK,CAAA,MAAA,MAAM,CAAC,OAAO,sDAAI,CAAA,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IACH,eAAC;AAAD,CAAC,AA5PD,IA4PC","sourcesContent":["import { AnalyticsIdentity, BeforePlugin, DestinationPlugin, EnrichmentPlugin, Plugin } from './types/plugin';\nimport { CoreClient } from './types/client/core-client';\nimport { IConfig } from './types/config/core-config';\nimport { ILogger } from './logger';\nimport { EventCallback } from './types/event-callback';\nimport { Event } from './types/event/event';\nimport { Result } from './types/result';\nimport { buildResult } from './utils/result-builder';\nimport { UUID } from './utils/uuid';\n\ntype PluginStatus = 'locked' | 'installed';\n\nexport class Timeline {\n queue: [Event, EventCallback][] = [];\n // Flag to guarantee one schedule apply is running\n applying = false;\n plugins: Plugin[] = [];\n // Locks plugin names synchronously before `await plugin.setup?.()` so a concurrent\n // register() with the same name bails. plugins[] only contains fully-installed plugins,\n // so this map is the only source of truth for in-flight installs. Cleared per-name by\n // deregister() and en masse by reset().\n pluginStatus: Map<string, PluginStatus> = new Map();\n // loggerProvider is set by the client at _init()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n loggerProvider: ILogger;\n _optOutListeners: ((optOut: boolean) => Promise<void>)[] = [];\n\n constructor(private client: CoreClient) {}\n\n async register(plugin: Plugin, config: IConfig) {\n if (plugin.name === undefined) {\n plugin.name = UUID();\n this.loggerProvider.warn(`Plugin name is undefined.\n Generating a random UUID for plugin name: ${plugin.name}.\n Set a name for the plugin to prevent it from being added multiple times.`);\n }\n const name = plugin.name;\n\n if (this.pluginStatus.has(name)) {\n this.loggerProvider.warn(`Plugin with name ${name} already exists, skipping registration`);\n return;\n }\n\n plugin.type = plugin.type ?? 'enrichment';\n // Lock the name synchronously to close the TOCTOU window across `await setup`.\n // If setup throws, the entry stays as 'locked' and blocks future re-registration —\n // a same-named plugin would just fail again, so retry isn't useful.\n this.pluginStatus.set(name, 'locked');\n await plugin.setup?.(config, this.client);\n // reset() may have cleared the status map while setup was awaiting.\n if (this.pluginStatus.get(name) !== 'locked') {\n return;\n }\n this.plugins.push(plugin);\n this.pluginStatus.set(name, 'installed');\n }\n\n async deregister(pluginName: string, config: IConfig) {\n // Clear the status first so a name stuck in 'locked' (mid-install, or setup() threw)\n // can be unlocked via deregister(). Map.delete is a no-op if the key is missing.\n this.pluginStatus.delete(pluginName);\n const index = this.plugins.findIndex((plugin) => plugin.name === pluginName);\n if (index === -1) {\n config.loggerProvider.warn(`Plugin with name ${pluginName} does not exist, skipping deregistration`);\n return;\n }\n const plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n await plugin.teardown?.();\n }\n\n reset(client: CoreClient) {\n this._clearOptOutListeners();\n this.applying = false;\n const plugins = this.plugins;\n plugins.map((plugin) => plugin.teardown?.());\n this.plugins = [];\n this.pluginStatus.clear();\n this.client = client;\n }\n\n push(event: Event) {\n return new Promise<Result>((resolve) => {\n this.queue.push([event, resolve]);\n this.scheduleApply(0);\n });\n }\n\n scheduleApply(timeout: number) {\n if (this.applying) return;\n this.applying = true;\n setTimeout(() => {\n void this.apply(this.queue.shift()).then(() => {\n this.applying = false;\n if (this.queue.length > 0) {\n this.scheduleApply(0);\n }\n });\n }, timeout);\n }\n\n async apply(item: [Event, EventCallback] | undefined) {\n if (!item) {\n return;\n }\n\n let [event] = item;\n const [, resolve] = item;\n\n // Log initial event\n this.loggerProvider.log('Timeline.apply: Initial event', event);\n\n const before = this.plugins.filter<BeforePlugin>(\n (plugin: Plugin): plugin is BeforePlugin => plugin.type === 'before',\n );\n\n for (const plugin of before) {\n /* istanbul ignore if */\n if (!plugin.execute) {\n // do nothing\n continue;\n }\n const e = await plugin.execute({ ...event });\n if (e === null) {\n this.loggerProvider.log(\n `Timeline.apply: Event filtered out by before plugin '${String(plugin.name)}', event: ${JSON.stringify(\n event,\n )}`,\n );\n resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\n this.loggerProvider.log(\n `Timeline.apply: Event after before plugin '${String(plugin.name)}', event: ${JSON.stringify(event)}`,\n );\n }\n }\n\n const enrichment = this.plugins.filter<EnrichmentPlugin>(\n (plugin: Plugin): plugin is EnrichmentPlugin => plugin.type === 'enrichment' || plugin.type === undefined,\n );\n\n for (const plugin of enrichment) {\n /* istanbul ignore if */\n if (!plugin.execute) {\n // do nothing\n continue;\n }\n const e = await plugin.execute({ ...event });\n if (e === null) {\n this.loggerProvider.log(\n `Timeline.apply: Event filtered out by enrichment plugin '${String(plugin.name)}', event: ${JSON.stringify(\n event,\n )}`,\n );\n resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\n this.loggerProvider.log(\n `Timeline.apply: Event after enrichment plugin '${String(plugin.name)}', event: ${JSON.stringify(event)}`,\n );\n }\n }\n\n const destination = this.plugins.filter<DestinationPlugin>(\n (plugin: Plugin): plugin is DestinationPlugin => plugin.type === 'destination',\n );\n\n // Log final event before sending to destinations\n this.loggerProvider.log(`Timeline.apply: Final event before destinations, event: ${JSON.stringify(event)}`);\n\n const executeDestinations = destination.map((plugin) => {\n const eventClone = { ...event };\n return plugin.execute(eventClone).catch((e) => buildResult(eventClone, 0, String(e)));\n });\n\n void Promise.all(executeDestinations).then(([result]) => {\n const resolveResult =\n result || buildResult(event, 100, 'Event not tracked, no destination plugins on the instance');\n resolve(resolveResult);\n });\n\n return;\n }\n\n async flush() {\n const queue = this.queue;\n this.queue = [];\n\n await Promise.all(queue.map((item) => this.apply(item)));\n\n const destination = this.plugins.filter<DestinationPlugin>(\n (plugin: Plugin): plugin is DestinationPlugin => plugin.type === 'destination',\n );\n\n const executeDestinations = destination.map((plugin) => {\n return plugin.flush && plugin.flush();\n });\n\n await Promise.all(executeDestinations);\n }\n\n addOptOutListener(cb: (optOut: boolean) => Promise<void>) {\n this._optOutListeners.push(cb);\n }\n\n _clearOptOutListeners() {\n this._optOutListeners = [];\n }\n\n onIdentityChanged(identity: AnalyticsIdentity) {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onIdentityChanged() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onIdentityChanged?.(identity);\n });\n }\n\n onSessionIdChanged(sessionId: number) {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onSessionIdChanged() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onSessionIdChanged?.(sessionId);\n });\n }\n\n onOptOutChanged(optOut: boolean) {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onOptOutChanged() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onOptOutChanged?.(optOut);\n });\n void this._callOptOutListeners(optOut);\n }\n\n async _callOptOutListeners(optOut: boolean) {\n for (const listener of this._optOutListeners) {\n try {\n await listener(optOut);\n } catch (e) {\n /* istanbul ignore next */\n this.loggerProvider.error('Error calling optOut listener', e);\n }\n }\n }\n\n onReset() {\n this.plugins.forEach((plugin) => {\n // Intentionally to not await plugin.onReset() for non-blocking.\n // Ignore optional channing next line for test coverage.\n // If the plugin doesn't implement it, it won't be called.\n /* istanbul ignore next */\n void plugin.onReset?.();\n });\n }\n}\n"]}
@@ -108,11 +108,5 @@ export interface BrowserClient extends Client {
108
108
  * @param sampleRate - The sample rate to set
109
109
  */
110
110
  _setDiagnosticsSampleRate(sampleRate: number): void;
111
- /**
112
- * @experimental
113
- * WARNING: This method is for internal testing only and is not part of the public API.
114
- * It may be changed or removed at any time without notice.
115
- */
116
- _enableRequestBodyCompressionExperimental(enabled: boolean): void;
117
111
  }
118
112
  //# sourceMappingURL=browser-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../../../src/types/client/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvF;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,CAAC,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAEtD;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC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,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEzE;;;;;;OAMG;IACH,WAAW,IAAI,iBAAiB,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAExD;;;;;;OAMG;IACH,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;IAEjC;;;;;;;OAOG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../../../src/types/client/browser-client.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportTypeOrOptions } from '../transport';\nimport { Client } from './core-client';\nimport { AnalyticsIdentity, Plugin } from '../plugin';\nimport { AmplitudeReturn } from '../../utils/return-wrapper';\nimport { BrowserConfig, BrowserOptions } from '../config/browser-config';\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n *\n * // Use Fetch API with custom headers\n * setTransport({ type: 'fetch', headers: { 'X-Custom-Header': 'value' } });\n * ```\n */\n setTransport(transport: TransportTypeOrOptions): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n\n /**\n * Returns the current identity.\n *\n * ```typescript\n * const identity = getIdentity();\n * ```\n */\n getIdentity(): AnalyticsIdentity;\n\n /**\n * Sets the identity (userId, deviceId, and/or userProperties).\n * This is a unified shortcut for `setUserId()`, `setDeviceId()`, and setting user properties.\n * When userProperties change, an identify event is automatically sent.\n *\n * **Important limitation:** When userProperties are replaced, the local state is fully replaced\n * but the identify event sent to the server only includes `$set` operations for the new properties.\n * Properties removed from the local state are **not** `$unset` on the server.\n *\n * For example, changing from `{plan: 'premium', theme: 'dark'}` to `{plan: 'basic'}` removes\n * `theme` locally but leaves it on the server. To remove a property from the server, use\n * `identify()` with `Identify.unset()` directly.\n *\n * ```typescript\n * // Set user properties (auto-sends identify event with $set)\n * setIdentity({ userProperties: { plan: 'premium' } });\n *\n * // Set userId (equivalent to setUserId('user-123'))\n * setIdentity({ userId: 'user-123' });\n *\n * // Set deviceId (equivalent to setDeviceId('device-456'))\n * setIdentity({ deviceId: 'device-456' });\n *\n * // Set multiple identity fields together\n * setIdentity({ userId: 'user-123', deviceId: 'device-456', userProperties: { name: 'John' } });\n *\n * // To remove a property from the server, use identify() directly:\n * const identify = new Identify();\n * identify.unset('theme');\n * amplitude.identify(identify);\n * ```\n */\n setIdentity(identity: Partial<AnalyticsIdentity>): void;\n\n /**\n * Returns the current optOut config value.\n *\n * ```typescript\n * const optOut = getOptOut();\n * ```\n */\n getOptOut(): boolean | undefined;\n\n /**\n * @experimental\n * WARNING: This method is for internal testing only and is not part of the public API.\n * It may be changed or removed at any time without notice.\n *\n * Sets the diagnostics sample rate before amplitude.init()\n * @param sampleRate - The sample rate to set\n */\n _setDiagnosticsSampleRate(sampleRate: number): void;\n\n /**\n * @experimental\n * WARNING: This method is for internal testing only and is not part of the public API.\n * It may be changed or removed at any time without notice.\n */\n _enableRequestBodyCompressionExperimental(enabled: boolean): void;\n}\n"]}
1
+ {"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../../../src/types/client/browser-client.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportTypeOrOptions } from '../transport';\nimport { Client } from './core-client';\nimport { AnalyticsIdentity, Plugin } from '../plugin';\nimport { AmplitudeReturn } from '../../utils/return-wrapper';\nimport { BrowserConfig, BrowserOptions } from '../config/browser-config';\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n *\n * // Use Fetch API with custom headers\n * setTransport({ type: 'fetch', headers: { 'X-Custom-Header': 'value' } });\n * ```\n */\n setTransport(transport: TransportTypeOrOptions): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n\n /**\n * Returns the current identity.\n *\n * ```typescript\n * const identity = getIdentity();\n * ```\n */\n getIdentity(): AnalyticsIdentity;\n\n /**\n * Sets the identity (userId, deviceId, and/or userProperties).\n * This is a unified shortcut for `setUserId()`, `setDeviceId()`, and setting user properties.\n * When userProperties change, an identify event is automatically sent.\n *\n * **Important limitation:** When userProperties are replaced, the local state is fully replaced\n * but the identify event sent to the server only includes `$set` operations for the new properties.\n * Properties removed from the local state are **not** `$unset` on the server.\n *\n * For example, changing from `{plan: 'premium', theme: 'dark'}` to `{plan: 'basic'}` removes\n * `theme` locally but leaves it on the server. To remove a property from the server, use\n * `identify()` with `Identify.unset()` directly.\n *\n * ```typescript\n * // Set user properties (auto-sends identify event with $set)\n * setIdentity({ userProperties: { plan: 'premium' } });\n *\n * // Set userId (equivalent to setUserId('user-123'))\n * setIdentity({ userId: 'user-123' });\n *\n * // Set deviceId (equivalent to setDeviceId('device-456'))\n * setIdentity({ deviceId: 'device-456' });\n *\n * // Set multiple identity fields together\n * setIdentity({ userId: 'user-123', deviceId: 'device-456', userProperties: { name: 'John' } });\n *\n * // To remove a property from the server, use identify() directly:\n * const identify = new Identify();\n * identify.unset('theme');\n * amplitude.identify(identify);\n * ```\n */\n setIdentity(identity: Partial<AnalyticsIdentity>): void;\n\n /**\n * Returns the current optOut config value.\n *\n * ```typescript\n * const optOut = getOptOut();\n * ```\n */\n getOptOut(): boolean | undefined;\n\n /**\n * @experimental\n * WARNING: This method is for internal testing only and is not part of the public API.\n * It may be changed or removed at any time without notice.\n *\n * Sets the diagnostics sample rate before amplitude.init()\n * @param sampleRate - The sample rate to set\n */\n _setDiagnosticsSampleRate(sampleRate: number): void;\n}\n"]}
@@ -121,7 +121,6 @@ interface InternalBrowserConfig {
121
121
  remoteConfigClient?: IRemoteConfigClient;
122
122
  deferredSessionId?: number;
123
123
  topLevelDomain?: string;
124
- _enableRequestBodyCompressionExperimental?: boolean;
125
124
  }
126
125
  /**
127
126
  * @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.
@@ -329,7 +328,7 @@ export interface CookieOptions {
329
328
  */
330
329
  upgrade?: boolean;
331
330
  }
332
- type HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata' | '_enableRequestBodyCompressionExperimental';
331
+ type HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata';
333
332
  export interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {
334
333
  }
335
334
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../../src/types/config/browser-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,aAAc,SAAQ,qBAAqB,EAAE,qBAAqB;CAAG;AAEtF,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;IACnD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,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;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAC;IACnD;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,eAAO,MAAM,qCAAqC;;;CAGxC,CAAC;AAEX,KAAK,iCAAiC,GACpC,CAAC,OAAO,qCAAqC,CAAC,CAAC,MAAM,OAAO,qCAAqC,CAAC,CAAC;AAErG,MAAM,WAAW,+BAA+B;IAK9C,SAAS,CAAC,EAAE,iCAAiC,CAAC;CAC/C;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAGxE,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,aAAa,CAAC;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"browser-config.js","sourceRoot":"","sources":["../../../../src/types/config/browser-config.ts"],"names":[],"mappings":"AAiSA,MAAM,CAAC,IAAM,qCAAqC,GAAG;IACnD,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,iBAAiB;CAC1B,CAAC","sourcesContent":["import { UserSession } from '../user-session';\nimport { IdentityStorageType, Storage } from '../storage';\nimport { Transport, TransportTypeOrOptions } from '../transport';\nimport { IConfig } from './core-config';\nimport { ElementInteractionsOptions } from '../element-interactions';\nimport { FormInteractionsOptions } from '../form-interactions';\nimport { PageTrackingOptions } from '../page-view-tracking';\nimport { NetworkTrackingOptions } from '../network-tracking';\nimport { FrustrationInteractionsOptions } from '../frustration-interactions';\nimport { PerformanceTrackingOptions } from '../performance-tracking';\nimport { IDiagnosticsClient } from '../../diagnostics/diagnostics-client';\nimport { IRemoteConfigClient } from '../../remote-config/remote-config';\nimport { CustomEnrichmentOptions } from '../custom-enrichment';\n\nexport interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {}\n\nexport interface ExternalBrowserConfig extends IConfig {\n /**\n * An app version for events tracked. This can be the version of your application.\n * @defaultValue `undefined`\n */\n appVersion?: string;\n /**\n * @deprecated This property is deprecated and will be removed in future versions. Please migrate to using `autocapture` instead.\n * The default event tracking configuration.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events}.\n * @defaultValue `true`\n */\n defaultTracking?: boolean | DefaultTrackingOptions;\n /**\n * The configurations for auto-captured events.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/autocapture/}.\n */\n autocapture?: boolean | AutocaptureOptions;\n /**\n * The configurations for custom enrichment.\n * @defaultValue `false`\n */\n customEnrichment?: boolean | CustomEnrichmentOptions;\n /**\n * The identifier for the device running your application.\n * @defaultValue `UUID()`\n */\n deviceId?: string;\n /**\n * Configuration for cookie.\n */\n cookieOptions?: CookieOptions;\n /**\n * The storage for user identify.\n * @defaultValue `\"cookie\"`\n */\n identityStorage?: IdentityStorageType;\n /**\n * The partner identifier.\n * Amplitude requires the customer who built an event ingestion integration to add the partner identifier to partner_id.\n * @defaultValue `undefined`\n */\n partnerId?: string;\n /**\n * The custom Session ID for the current session.\n * @defaultValue `timestamp`\n */\n sessionId?: number;\n /**\n * The period of inactivity from the last tracked event before a session expires in milliseconds.\n * @defaultValue `1,800,000` (30 minutes)\n */\n sessionTimeout: number;\n /**\n * The configurations for tracking additional properties.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#optional-tracking}.\n */\n trackingOptions: TrackingOptions;\n /**\n * Network transport mechanism used to send events.\n * @defaultValue `\"fetch\"`\n */\n transport?: TransportTypeOrOptions;\n /**\n * The identifier for the user being tracked.\n * @defaultValue `undefined`\n */\n userId?: string;\n /**\n * User's Nth instance of performing a default Page Viewed event within a session.\n * Used for landing page analysis.\n */\n pageCounter?: number;\n /**\n * Whether to fetch remote configuration. The remote configuration can be updated in the Amplitude platform here:\n * https://app.amplitude.com/data/amplitude/{your_org_name}/settings/autocapture\n * @defaultValue `true`\n * @deprecated This property is deprecated and will be removed in future versions. Please use `remoteConfig.fetchRemoteConfig` instead.\n */\n fetchRemoteConfig?: boolean;\n /**\n * Remote configuration options.\n * @defaultValue `undefined`\n */\n remoteConfig?: RemoteConfigOptions;\n /**\n * Captures network requests and responses.\n * @defaultValue `undefined`\n * @deprecated use autocapture.networkTracking instead\n */\n networkTrackingOptions?: NetworkTrackingOptions;\n /**\n * Whether to enable diagnostics.\n * @defaultValue `true`\n */\n enableDiagnostics?: boolean;\n}\n\ninterface InternalBrowserConfig {\n cookieStorage: Storage<UserSession>;\n lastEventTime?: number;\n lastEventId?: number;\n transportProvider: Transport;\n version?: string;\n diagnosticsSampleRate?: number;\n diagnosticsClient?: IDiagnosticsClient;\n remoteConfigClient?: IRemoteConfigClient;\n deferredSessionId?: number;\n topLevelDomain?: string;\n _enableRequestBodyCompressionExperimental?: boolean;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.\n */\nexport interface DefaultTrackingOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking or configures with detailed options.\n * @defaultValue `true`\n */\n formInteractions?: boolean | FormInteractionsOptions;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n}\n\nexport interface AutocaptureOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking or configures with detailed options.\n * @defaultValue `true`\n */\n formInteractions?: boolean | FormInteractionsOptions;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n /**\n * Enables/disables user interactions tracking.\n * @defaultValue `false`\n */\n elementInteractions?: boolean | ElementInteractionsOptions;\n /**\n * Enables/disables frustration interactions tracking.\n * @defaultValue `false`\n */\n frustrationInteractions?: boolean | FrustrationInteractionsOptions;\n /**\n * Enables/disables network request tracking or config with detailed network tracking options.\n * @defaultValue `false`\n */\n networkTracking?: boolean | NetworkTrackingOptions;\n /**\n * Enables/disables web vitals tracking.\n * @defaultValue `false`\n */\n webVitals?: boolean;\n /**\n * Enables/disables performance tracking.\n * @defaultValue `false`\n */\n performanceTracking?: boolean | PerformanceTrackingOptions;\n /**\n * Enables/disables page url enrichment.\n * @defaultValue `true`\n * @experimental This feature is experimental and may not be stable\n */\n pageUrlEnrichment?: boolean;\n}\n\nexport interface TrackingOptions {\n /**\n * Enables/disables ip address tracking.\n * @defaultValue `true`\n */\n ipAddress?: boolean;\n /**\n * Enables/disables language tracking.\n * @defaultValue `true`\n */\n language?: boolean;\n /**\n * Enables/disables plantform tracking.\n * @defaultValue `true`\n */\n platform?: boolean;\n}\n\nexport type TrackingMethod = 'userProperty' | 'eventProperty';\n\nexport interface AttributionOptions {\n /**\n * The rules to determine which referrers are excluded from being tracked as traffic source.\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `[/your-domain\\.com$/]`\n */\n excludeReferrers?: (string | RegExp)[];\n /**\n * Exclude internal referrers from campaign attribution.\n * (a referrer is 'internal' if it is on the same domain as the current page)\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `false`\n */\n excludeInternalReferrers?: true | false | ExcludeInternalReferrersOptions;\n /**\n * The value to represent undefined/no initial campaign parameter for first-touch attribution.\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `\"EMPTY\"`\n */\n initialEmptyValue?: string;\n /**\n * The flag of if Amplitude to start a new session if any campaign parameter changes.\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `false`\n */\n resetSessionOnNewCampaign?: boolean;\n /**\n * The attribution persistence strategy for campaign parameters.\n * Provide a single method to enable one strategy, or an array to enable multiple methods at the same time.\n * When multiple methods are provided, each enabled method runs independently and their behaviors are combined.\n * For example, `['userProperty', 'eventProperty']` updates user properties and also attaches campaign params\n * to event properties.\n * @experimental this feature is experimental and may not be stable\n * @defaultValue `\"userProperty\"`\n */\n trackingMethod?: TrackingMethod | TrackingMethod[];\n /**\n * Fires an `[Amplitude] Attribution` event as a heartbeat on every page view,\n * such as on page load and SPA URL changes.\n * Applies only to `eventProperty` tracking.\n * Ignored by `userProperty` tracking.\n * @experimental this feature is experimental and may not be stable\n * @defaultValue `false`\n */\n fallbackAttributionEvent?: boolean;\n}\n\nexport const EXCLUDE_INTERNAL_REFERRERS_CONDITIONS = {\n always: 'always',\n ifEmptyCampaign: 'ifEmptyCampaign',\n} as const;\n\ntype ExcludeInternalReferrersCondition =\n (typeof EXCLUDE_INTERNAL_REFERRERS_CONDITIONS)[keyof typeof EXCLUDE_INTERNAL_REFERRERS_CONDITIONS];\n\nexport interface ExcludeInternalReferrersOptions {\n /*\n * The condition on which to exclude internal referrers for campaign attribution.\n * @defaultValue `\"always\"`\n */\n condition?: ExcludeInternalReferrersCondition;\n}\n\nexport interface RemoteConfigOptions {\n /**\n * Whether to fetch remote configuration. The remote configuration can be updated in the Amplitude platform here:\n * https://app.amplitude.com/data/amplitude/{your_org_name}/settings/autocapture\n * @defaultValue `true`\n */\n fetchRemoteConfig?: boolean;\n /**\n * Custom server URL for remote configuration requests. If not provided, defaults to the standard\n * Amplitude remote config endpoint based on serverZone (US or EU).\n * Use this to proxy remote config requests through your own server.\n * @defaultValue `undefined` (uses standard Amplitude remote config endpoint)\n */\n serverUrl?: string;\n}\n\nexport interface CookieOptions {\n /**\n * The domain property of cookies created.\n * @defaultValue `Your top level domain`\n */\n domain?: string;\n /**\n * The expiration of cookies created in days.\n * @defaultValue `365`\n */\n expiration?: number;\n /**\n * How cookies are sent with cross-site requests.\n * @defaultValue `\"Lax\"`\n */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /**\n * The flag of if send cookies over secure protocols.\n * @defaultValue `false`\n */\n secure?: boolean;\n /**\n * The flag of if upgrade the cookies created by maintenance Browser SDK.\n * @defaultValue `true`\n */\n upgrade?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata' | '_enableRequestBodyCompressionExperimental';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {}\n"]}
1
+ {"version":3,"file":"browser-config.js","sourceRoot":"","sources":["../../../../src/types/config/browser-config.ts"],"names":[],"mappings":"AAgSA,MAAM,CAAC,IAAM,qCAAqC,GAAG;IACnD,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,iBAAiB;CAC1B,CAAC","sourcesContent":["import { UserSession } from '../user-session';\nimport { IdentityStorageType, Storage } from '../storage';\nimport { Transport, TransportTypeOrOptions } from '../transport';\nimport { IConfig } from './core-config';\nimport { ElementInteractionsOptions } from '../element-interactions';\nimport { FormInteractionsOptions } from '../form-interactions';\nimport { PageTrackingOptions } from '../page-view-tracking';\nimport { NetworkTrackingOptions } from '../network-tracking';\nimport { FrustrationInteractionsOptions } from '../frustration-interactions';\nimport { PerformanceTrackingOptions } from '../performance-tracking';\nimport { IDiagnosticsClient } from '../../diagnostics/diagnostics-client';\nimport { IRemoteConfigClient } from '../../remote-config/remote-config';\nimport { CustomEnrichmentOptions } from '../custom-enrichment';\n\nexport interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {}\n\nexport interface ExternalBrowserConfig extends IConfig {\n /**\n * An app version for events tracked. This can be the version of your application.\n * @defaultValue `undefined`\n */\n appVersion?: string;\n /**\n * @deprecated This property is deprecated and will be removed in future versions. Please migrate to using `autocapture` instead.\n * The default event tracking configuration.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events}.\n * @defaultValue `true`\n */\n defaultTracking?: boolean | DefaultTrackingOptions;\n /**\n * The configurations for auto-captured events.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/autocapture/}.\n */\n autocapture?: boolean | AutocaptureOptions;\n /**\n * The configurations for custom enrichment.\n * @defaultValue `false`\n */\n customEnrichment?: boolean | CustomEnrichmentOptions;\n /**\n * The identifier for the device running your application.\n * @defaultValue `UUID()`\n */\n deviceId?: string;\n /**\n * Configuration for cookie.\n */\n cookieOptions?: CookieOptions;\n /**\n * The storage for user identify.\n * @defaultValue `\"cookie\"`\n */\n identityStorage?: IdentityStorageType;\n /**\n * The partner identifier.\n * Amplitude requires the customer who built an event ingestion integration to add the partner identifier to partner_id.\n * @defaultValue `undefined`\n */\n partnerId?: string;\n /**\n * The custom Session ID for the current session.\n * @defaultValue `timestamp`\n */\n sessionId?: number;\n /**\n * The period of inactivity from the last tracked event before a session expires in milliseconds.\n * @defaultValue `1,800,000` (30 minutes)\n */\n sessionTimeout: number;\n /**\n * The configurations for tracking additional properties.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#optional-tracking}.\n */\n trackingOptions: TrackingOptions;\n /**\n * Network transport mechanism used to send events.\n * @defaultValue `\"fetch\"`\n */\n transport?: TransportTypeOrOptions;\n /**\n * The identifier for the user being tracked.\n * @defaultValue `undefined`\n */\n userId?: string;\n /**\n * User's Nth instance of performing a default Page Viewed event within a session.\n * Used for landing page analysis.\n */\n pageCounter?: number;\n /**\n * Whether to fetch remote configuration. The remote configuration can be updated in the Amplitude platform here:\n * https://app.amplitude.com/data/amplitude/{your_org_name}/settings/autocapture\n * @defaultValue `true`\n * @deprecated This property is deprecated and will be removed in future versions. Please use `remoteConfig.fetchRemoteConfig` instead.\n */\n fetchRemoteConfig?: boolean;\n /**\n * Remote configuration options.\n * @defaultValue `undefined`\n */\n remoteConfig?: RemoteConfigOptions;\n /**\n * Captures network requests and responses.\n * @defaultValue `undefined`\n * @deprecated use autocapture.networkTracking instead\n */\n networkTrackingOptions?: NetworkTrackingOptions;\n /**\n * Whether to enable diagnostics.\n * @defaultValue `true`\n */\n enableDiagnostics?: boolean;\n}\n\ninterface InternalBrowserConfig {\n cookieStorage: Storage<UserSession>;\n lastEventTime?: number;\n lastEventId?: number;\n transportProvider: Transport;\n version?: string;\n diagnosticsSampleRate?: number;\n diagnosticsClient?: IDiagnosticsClient;\n remoteConfigClient?: IRemoteConfigClient;\n deferredSessionId?: number;\n topLevelDomain?: string;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.\n */\nexport interface DefaultTrackingOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking or configures with detailed options.\n * @defaultValue `true`\n */\n formInteractions?: boolean | FormInteractionsOptions;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n}\n\nexport interface AutocaptureOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking or configures with detailed options.\n * @defaultValue `true`\n */\n formInteractions?: boolean | FormInteractionsOptions;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n /**\n * Enables/disables user interactions tracking.\n * @defaultValue `false`\n */\n elementInteractions?: boolean | ElementInteractionsOptions;\n /**\n * Enables/disables frustration interactions tracking.\n * @defaultValue `false`\n */\n frustrationInteractions?: boolean | FrustrationInteractionsOptions;\n /**\n * Enables/disables network request tracking or config with detailed network tracking options.\n * @defaultValue `false`\n */\n networkTracking?: boolean | NetworkTrackingOptions;\n /**\n * Enables/disables web vitals tracking.\n * @defaultValue `false`\n */\n webVitals?: boolean;\n /**\n * Enables/disables performance tracking.\n * @defaultValue `false`\n */\n performanceTracking?: boolean | PerformanceTrackingOptions;\n /**\n * Enables/disables page url enrichment.\n * @defaultValue `true`\n * @experimental This feature is experimental and may not be stable\n */\n pageUrlEnrichment?: boolean;\n}\n\nexport interface TrackingOptions {\n /**\n * Enables/disables ip address tracking.\n * @defaultValue `true`\n */\n ipAddress?: boolean;\n /**\n * Enables/disables language tracking.\n * @defaultValue `true`\n */\n language?: boolean;\n /**\n * Enables/disables plantform tracking.\n * @defaultValue `true`\n */\n platform?: boolean;\n}\n\nexport type TrackingMethod = 'userProperty' | 'eventProperty';\n\nexport interface AttributionOptions {\n /**\n * The rules to determine which referrers are excluded from being tracked as traffic source.\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `[/your-domain\\.com$/]`\n */\n excludeReferrers?: (string | RegExp)[];\n /**\n * Exclude internal referrers from campaign attribution.\n * (a referrer is 'internal' if it is on the same domain as the current page)\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `false`\n */\n excludeInternalReferrers?: true | false | ExcludeInternalReferrersOptions;\n /**\n * The value to represent undefined/no initial campaign parameter for first-touch attribution.\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `\"EMPTY\"`\n */\n initialEmptyValue?: string;\n /**\n * The flag of if Amplitude to start a new session if any campaign parameter changes.\n * Applies only to `userProperty` tracking.\n * Ignored by `eventProperty` tracking.\n * @defaultValue `false`\n */\n resetSessionOnNewCampaign?: boolean;\n /**\n * The attribution persistence strategy for campaign parameters.\n * Provide a single method to enable one strategy, or an array to enable multiple methods at the same time.\n * When multiple methods are provided, each enabled method runs independently and their behaviors are combined.\n * For example, `['userProperty', 'eventProperty']` updates user properties and also attaches campaign params\n * to event properties.\n * @experimental this feature is experimental and may not be stable\n * @defaultValue `\"userProperty\"`\n */\n trackingMethod?: TrackingMethod | TrackingMethod[];\n /**\n * Fires an `[Amplitude] Attribution` event as a heartbeat on every page view,\n * such as on page load and SPA URL changes.\n * Applies only to `eventProperty` tracking.\n * Ignored by `userProperty` tracking.\n * @experimental this feature is experimental and may not be stable\n * @defaultValue `false`\n */\n fallbackAttributionEvent?: boolean;\n}\n\nexport const EXCLUDE_INTERNAL_REFERRERS_CONDITIONS = {\n always: 'always',\n ifEmptyCampaign: 'ifEmptyCampaign',\n} as const;\n\ntype ExcludeInternalReferrersCondition =\n (typeof EXCLUDE_INTERNAL_REFERRERS_CONDITIONS)[keyof typeof EXCLUDE_INTERNAL_REFERRERS_CONDITIONS];\n\nexport interface ExcludeInternalReferrersOptions {\n /*\n * The condition on which to exclude internal referrers for campaign attribution.\n * @defaultValue `\"always\"`\n */\n condition?: ExcludeInternalReferrersCondition;\n}\n\nexport interface RemoteConfigOptions {\n /**\n * Whether to fetch remote configuration. The remote configuration can be updated in the Amplitude platform here:\n * https://app.amplitude.com/data/amplitude/{your_org_name}/settings/autocapture\n * @defaultValue `true`\n */\n fetchRemoteConfig?: boolean;\n /**\n * Custom server URL for remote configuration requests. If not provided, defaults to the standard\n * Amplitude remote config endpoint based on serverZone (US or EU).\n * Use this to proxy remote config requests through your own server.\n * @defaultValue `undefined` (uses standard Amplitude remote config endpoint)\n */\n serverUrl?: string;\n}\n\nexport interface CookieOptions {\n /**\n * The domain property of cookies created.\n * @defaultValue `Your top level domain`\n */\n domain?: string;\n /**\n * The expiration of cookies created in days.\n * @defaultValue `365`\n */\n expiration?: number;\n /**\n * How cookies are sent with cross-site requests.\n * @defaultValue `\"Lax\"`\n */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /**\n * The flag of if send cookies over secure protocols.\n * @defaultValue `false`\n */\n secure?: boolean;\n /**\n * The flag of if upgrade the cookies created by maintenance Browser SDK.\n * @defaultValue `true`\n */\n upgrade?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {}\n"]}
@@ -71,12 +71,6 @@ export interface IConfig {
71
71
  * @defaultValue `false`
72
72
  */
73
73
  enableRequestBodyCompression?: boolean;
74
- /**
75
- * @experimental
76
- * WARNING: This config is for internal testing only and is not part of the public API.
77
- * It may be changed or removed at any time without notice.
78
- */
79
- _enableRequestBodyCompressionExperimental?: boolean;
80
74
  /**
81
75
  * The URL where events are upload to.
82
76
  */
@@ -1 +1 @@
1
- {"version":3,"file":"core-config.d.ts","sourceRoot":"","sources":["../../../../src/types/config/core-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE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GAAG,EAAE;QACH,OAAO,EAAE;YACP,SAAS,EAAE,iBAAiB,CAAC;SAC9B,CAAC;KACH,CAAC;IAEF,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CACpF;AAED,MAAM,WAAW,iBAAiB;IAChC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,oCAAoC,CAAC,EAAE,MAAM,CAAC;IAC9C,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC5C;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,aAAc,SAAQ,OAAO,CAAC,OAAO,CAAC;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,CAAC;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"core-config.js","sourceRoot":"","sources":["../../../../src/types/config/core-config.ts"],"names":[],"mappings":"","sourcesContent":["import { LogLevel } from '../loglevel';\nimport { ILogger } from '../../logger';\nimport { OfflineDisabled } from '../offline';\nimport { Plan } from '../event/plan';\nimport { IngestionMetadata } from '../event/ingestion-metadata';\nimport { ServerZoneType } from '../server-zone';\nimport { Transport } from '../transport';\nimport { Storage } from '../storage';\nimport { Event } from '../event/event';\nimport { IIdentify } from '../../identify';\n\nexport interface IConfig {\n /**\n * Your Amplitude Project API key.\n */\n apiKey: string;\n /**\n * The interval of uploading events to Amplitude in milliseconds.\n */\n flushIntervalMillis: number;\n /**\n * The maximum number of retries for failed upload attempts. This is only applicable to retryable errors.\n */\n flushMaxRetries: number;\n /**\n * The maximum number of events that are batched in a single upload attempt.\n */\n flushQueueSize: number;\n /**\n * The instance name. For tracking events to multiple Amplitude projects in your application.\n */\n instanceName?: string;\n /**\n * Level of logs to be printed in the developer console.\n * Valid values are `LogLevel.None`, `LogLevel.Error`, `LogLevel.Warn`, `LogLevel.Verbose`, `LogLevel.Debug`\n */\n logLevel: LogLevel;\n /**\n * A custom Logger class to emit log messages to desired destination.\n */\n loggerProvider: ILogger;\n /**\n * The minimum length for the value of userId and deviceId properties.\n */\n minIdLength?: number;\n /**\n * Whether the SDK is connected to network.\n */\n offline?: boolean | typeof OfflineDisabled;\n /**\n * The flag to opt this device out of Amplitude tracking.\n * If this flag is set, no additional information will be stored for the user.\n */\n optOut: boolean;\n /**\n * Tracking plan properties.\n * Amplitude internal use.\n */\n plan?: Plan;\n /**\n * Ingestion metadata.\n * Amplitude internal use.\n */\n ingestionMetadata?: IngestionMetadata;\n /**\n * Compress network request body payloads with gzip.\n *\n * For custom `serverUrl` values, this option controls whether compression is attempted.\n * For default Amplitude endpoints, compression remains enabled.\n * Compression is best-effort and only applies when the platform supports it,\n * the payload meets the minimum size threshold, and the transport can set request headers.\n * @defaultValue `false`\n */\n enableRequestBodyCompression?: boolean;\n /**\n * @experimental\n * WARNING: This config is for internal testing only and is not part of the public API.\n * It may be changed or removed at any time without notice.\n */\n _enableRequestBodyCompressionExperimental?: boolean;\n /**\n * The URL where events are upload to.\n */\n serverUrl?: string;\n /**\n * The Amplitude server zone.\n * Set this to EU for Amplitude projects created in EU data center.\n */\n serverZone?: ServerZoneType;\n /**\n * The storage provider to persist unsent events.\n */\n storageProvider?: Storage<Event[]>;\n /**\n * A customer Transport Class for sending data to a server.\n */\n transportProvider: Transport;\n /**\n * The flag of whether to upload events to Batch API instead of the default HTTP V2 API.\n */\n useBatch: boolean;\n /**\n * Metrics of the SDK.\n */\n requestMetadata?: IRequestMetadata;\n /**\n * Invokes identify on this Identify object prior to initializing the SDK.\n */\n identify?: IIdentify;\n}\n\nexport interface IRequestMetadata {\n sdk: {\n metrics: {\n histogram: IHistogramOptions;\n };\n };\n\n recordHistogram<T extends HistogramKey>(key: T, value: IHistogramOptions[T]): void;\n}\n\nexport interface IHistogramOptions {\n remote_config_fetch_time_IDB?: number;\n remote_config_fetch_time_API_success?: number;\n remote_config_fetch_time_API_fail?: number;\n}\n\nexport type HistogramKey = keyof IHistogramOptions;\n\nexport interface ConfigOptions extends Partial<IConfig> {\n apiKey: string;\n transportProvider: Transport;\n}\n"]}
1
+ {"version":3,"file":"core-config.js","sourceRoot":"","sources":["../../../../src/types/config/core-config.ts"],"names":[],"mappings":"","sourcesContent":["import { LogLevel } from '../loglevel';\nimport { ILogger } from '../../logger';\nimport { OfflineDisabled } from '../offline';\nimport { Plan } from '../event/plan';\nimport { IngestionMetadata } from '../event/ingestion-metadata';\nimport { ServerZoneType } from '../server-zone';\nimport { Transport } from '../transport';\nimport { Storage } from '../storage';\nimport { Event } from '../event/event';\nimport { IIdentify } from '../../identify';\n\nexport interface IConfig {\n /**\n * Your Amplitude Project API key.\n */\n apiKey: string;\n /**\n * The interval of uploading events to Amplitude in milliseconds.\n */\n flushIntervalMillis: number;\n /**\n * The maximum number of retries for failed upload attempts. This is only applicable to retryable errors.\n */\n flushMaxRetries: number;\n /**\n * The maximum number of events that are batched in a single upload attempt.\n */\n flushQueueSize: number;\n /**\n * The instance name. For tracking events to multiple Amplitude projects in your application.\n */\n instanceName?: string;\n /**\n * Level of logs to be printed in the developer console.\n * Valid values are `LogLevel.None`, `LogLevel.Error`, `LogLevel.Warn`, `LogLevel.Verbose`, `LogLevel.Debug`\n */\n logLevel: LogLevel;\n /**\n * A custom Logger class to emit log messages to desired destination.\n */\n loggerProvider: ILogger;\n /**\n * The minimum length for the value of userId and deviceId properties.\n */\n minIdLength?: number;\n /**\n * Whether the SDK is connected to network.\n */\n offline?: boolean | typeof OfflineDisabled;\n /**\n * The flag to opt this device out of Amplitude tracking.\n * If this flag is set, no additional information will be stored for the user.\n */\n optOut: boolean;\n /**\n * Tracking plan properties.\n * Amplitude internal use.\n */\n plan?: Plan;\n /**\n * Ingestion metadata.\n * Amplitude internal use.\n */\n ingestionMetadata?: IngestionMetadata;\n /**\n * Compress network request body payloads with gzip.\n *\n * For custom `serverUrl` values, this option controls whether compression is attempted.\n * For default Amplitude endpoints, compression remains enabled.\n * Compression is best-effort and only applies when the platform supports it,\n * the payload meets the minimum size threshold, and the transport can set request headers.\n * @defaultValue `false`\n */\n enableRequestBodyCompression?: boolean;\n /**\n * The URL where events are upload to.\n */\n serverUrl?: string;\n /**\n * The Amplitude server zone.\n * Set this to EU for Amplitude projects created in EU data center.\n */\n serverZone?: ServerZoneType;\n /**\n * The storage provider to persist unsent events.\n */\n storageProvider?: Storage<Event[]>;\n /**\n * A customer Transport Class for sending data to a server.\n */\n transportProvider: Transport;\n /**\n * The flag of whether to upload events to Batch API instead of the default HTTP V2 API.\n */\n useBatch: boolean;\n /**\n * Metrics of the SDK.\n */\n requestMetadata?: IRequestMetadata;\n /**\n * Invokes identify on this Identify object prior to initializing the SDK.\n */\n identify?: IIdentify;\n}\n\nexport interface IRequestMetadata {\n sdk: {\n metrics: {\n histogram: IHistogramOptions;\n };\n };\n\n recordHistogram<T extends HistogramKey>(key: T, value: IHistogramOptions[T]): void;\n}\n\nexport interface IHistogramOptions {\n remote_config_fetch_time_IDB?: number;\n remote_config_fetch_time_API_success?: number;\n remote_config_fetch_time_API_fail?: number;\n}\n\nexport type HistogramKey = keyof IHistogramOptions;\n\nexport interface ConfigOptions extends Partial<IConfig> {\n apiKey: string;\n transportProvider: Transport;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import { IConfig } from './core-config';
2
2
  export type NodeConfig = IConfig;
3
- export type NodeOptions = Omit<Partial<NodeConfig>, 'apiKey' | '_enableRequestBodyCompressionExperimental'>;
3
+ export type NodeOptions = Omit<Partial<NodeConfig>, 'apiKey'>;
4
4
  //# sourceMappingURL=node-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-config.d.ts","sourceRoot":"","sources":["../../../../src/types/config/node-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,2CAA2C,CAAC,CAAC"}
1
+ {"version":3,"file":"node-config.d.ts","sourceRoot":"","sources":["../../../../src/types/config/node-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"node-config.js","sourceRoot":"","sources":["../../../../src/types/config/node-config.ts"],"names":[],"mappings":"","sourcesContent":["import { IConfig } from './core-config';\n\nexport type NodeConfig = IConfig;\n\nexport type NodeOptions = Omit<Partial<NodeConfig>, 'apiKey' | '_enableRequestBodyCompressionExperimental'>;\n"]}
1
+ {"version":3,"file":"node-config.js","sourceRoot":"","sources":["../../../../src/types/config/node-config.ts"],"names":[],"mappings":"","sourcesContent":["import { IConfig } from './core-config';\n\nexport type NodeConfig = IConfig;\n\nexport type NodeOptions = Omit<Partial<NodeConfig>, 'apiKey'>;\n"]}
@@ -1,7 +1,7 @@
1
1
  import { IConfig } from './core-config';
2
2
  import { Storage } from '../storage';
3
3
  import { UserSession } from '../user-session';
4
- type HiddenOptions = 'apiKey' | 'lastEventId' | '_enableRequestBodyCompressionExperimental';
4
+ type HiddenOptions = 'apiKey' | 'lastEventId';
5
5
  export type ReactNativeOptions = Omit<Partial<ReactNativeConfig>, HiddenOptions>;
6
6
  export interface ReactNativeConfig extends Omit<IConfig, 'offline' | 'requestMetadata'> {
7
7
  trackingOptions: ReactNativeTrackingOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"react-native-config.d.ts","sourceRoot":"","sources":["../../../../src/types/config/react-native-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,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SAAS,CAAC;CACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"react-native-config.js","sourceRoot":"","sources":["../../../../src/types/config/react-native-config.ts"],"names":[],"mappings":"","sourcesContent":["import { IConfig } from './core-config';\nimport { Storage } from '../storage';\nimport { UserSession } from '../user-session';\n\ntype HiddenOptions = 'apiKey' | 'lastEventId' | '_enableRequestBodyCompressionExperimental';\n\nexport type ReactNativeOptions = Omit<Partial<ReactNativeConfig>, HiddenOptions>;\n\nexport interface ReactNativeConfig extends Omit<IConfig, 'offline' | 'requestMetadata'> {\n trackingOptions: ReactNativeTrackingOptions;\n trackingSessionEvents?: boolean;\n migrateLegacyData?: boolean;\n appVersion?: string;\n attribution?: ReactNativeAttributionOptions;\n deviceId?: string;\n cookieExpiration: number;\n cookieSameSite: string;\n cookieSecure: boolean;\n cookieStorage: Storage<UserSession>;\n cookieUpgrade: boolean;\n disableCookies: boolean;\n domain: string;\n lastEventTime?: number;\n lastEventId?: number;\n partnerId?: string;\n sessionId?: number;\n sessionTimeout: number;\n userId?: string;\n}\n\nexport interface ReactNativeAttributionOptions {\n disabled?: boolean;\n excludeReferrers?: string[];\n initialEmptyValue?: string;\n trackNewCampaigns?: boolean;\n trackPageViews?: boolean;\n resetSessionOnNewCampaign?: boolean;\n}\n\nexport interface ReactNativeTrackingOptions {\n adid?: boolean;\n carrier?: boolean;\n appSetId?: boolean;\n idfv?: boolean;\n country?: boolean;\n\n deviceManufacturer?: boolean;\n deviceModel?: boolean;\n ipAddress?: boolean;\n language?: boolean;\n osName?: boolean;\n osVersion?: boolean;\n platform?: boolean;\n [key: string]: boolean | undefined;\n}\n"]}
1
+ {"version":3,"file":"react-native-config.js","sourceRoot":"","sources":["../../../../src/types/config/react-native-config.ts"],"names":[],"mappings":"","sourcesContent":["import { IConfig } from './core-config';\nimport { Storage } from '../storage';\nimport { UserSession } from '../user-session';\n\ntype HiddenOptions = 'apiKey' | 'lastEventId';\n\nexport type ReactNativeOptions = Omit<Partial<ReactNativeConfig>, HiddenOptions>;\n\nexport interface ReactNativeConfig extends Omit<IConfig, 'offline' | 'requestMetadata'> {\n trackingOptions: ReactNativeTrackingOptions;\n trackingSessionEvents?: boolean;\n migrateLegacyData?: boolean;\n appVersion?: string;\n attribution?: ReactNativeAttributionOptions;\n deviceId?: string;\n cookieExpiration: number;\n cookieSameSite: string;\n cookieSecure: boolean;\n cookieStorage: Storage<UserSession>;\n cookieUpgrade: boolean;\n disableCookies: boolean;\n domain: string;\n lastEventTime?: number;\n lastEventId?: number;\n partnerId?: string;\n sessionId?: number;\n sessionTimeout: number;\n userId?: string;\n}\n\nexport interface ReactNativeAttributionOptions {\n disabled?: boolean;\n excludeReferrers?: string[];\n initialEmptyValue?: string;\n trackNewCampaigns?: boolean;\n trackPageViews?: boolean;\n resetSessionOnNewCampaign?: boolean;\n}\n\nexport interface ReactNativeTrackingOptions {\n adid?: boolean;\n carrier?: boolean;\n appSetId?: boolean;\n idfv?: boolean;\n country?: boolean;\n\n deviceManufacturer?: boolean;\n deviceModel?: boolean;\n ipAddress?: boolean;\n language?: boolean;\n osName?: boolean;\n osVersion?: boolean;\n platform?: boolean;\n [key: string]: boolean | undefined;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isChromeExtension(): boolean;
2
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/utils/environment.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C"}
@@ -0,0 +1,7 @@
1
+ import { getGlobalScope } from '../global-scope';
2
+ export function isChromeExtension() {
3
+ var _a, _b;
4
+ var globalScope = getGlobalScope();
5
+ return typeof ((_b = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.chrome) === null || _a === void 0 ? void 0 : _a.runtime) === null || _b === void 0 ? void 0 : _b.id) === 'string';
6
+ }
7
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../src/utils/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,UAAU,iBAAiB;;IAC/B,IAAM,WAAW,GAAG,cAAc,EAAgD,CAAC;IACnF,OAAO,OAAO,CAAA,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,0CAAE,OAAO,0CAAE,EAAE,CAAA,KAAK,QAAQ,CAAC;AAC9D,CAAC","sourcesContent":["import { getGlobalScope } from '../global-scope';\n\nexport function isChromeExtension(): boolean {\n const globalScope = getGlobalScope() as { chrome?: { runtime?: { id?: string } } };\n return typeof globalScope?.chrome?.runtime?.id === 'string';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/analytics-core",
3
- "version": "2.47.1",
3
+ "version": "2.48.1-sr-idb-multitab-test-rc.0",
4
4
  "description": "",
5
5
  "author": "Amplitude Inc",
6
6
  "homepage": "https://github.com/amplitude/Amplitude-TypeScript",