@amplitude/analytics-core 2.9.0 → 2.10.1

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 (53) hide show
  1. package/lib/cjs/core-client.d.ts +36 -4
  2. package/lib/cjs/core-client.d.ts.map +1 -1
  3. package/lib/cjs/core-client.js +89 -2
  4. package/lib/cjs/core-client.js.map +1 -1
  5. package/lib/cjs/identify.d.ts +4 -0
  6. package/lib/cjs/identify.d.ts.map +1 -1
  7. package/lib/cjs/identify.js +16 -1
  8. package/lib/cjs/identify.js.map +1 -1
  9. package/lib/cjs/index.d.ts +1 -0
  10. package/lib/cjs/index.d.ts.map +1 -1
  11. package/lib/cjs/index.js +4 -1
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/cjs/network-observer.d.ts +44 -0
  14. package/lib/cjs/network-observer.d.ts.map +1 -0
  15. package/lib/cjs/network-observer.js +170 -0
  16. package/lib/cjs/network-observer.js.map +1 -0
  17. package/lib/cjs/timeline.d.ts +4 -1
  18. package/lib/cjs/timeline.d.ts.map +1 -1
  19. package/lib/cjs/timeline.js +30 -0
  20. package/lib/cjs/timeline.js.map +1 -1
  21. package/lib/cjs/types/event/event.d.ts +33 -0
  22. package/lib/cjs/types/event/event.d.ts.map +1 -1
  23. package/lib/cjs/types/event/event.js.map +1 -1
  24. package/lib/cjs/types/plugin.d.ts +22 -0
  25. package/lib/cjs/types/plugin.d.ts.map +1 -1
  26. package/lib/cjs/types/plugin.js.map +1 -1
  27. package/lib/esm/core-client.d.ts +36 -4
  28. package/lib/esm/core-client.d.ts.map +1 -1
  29. package/lib/esm/core-client.js +89 -2
  30. package/lib/esm/core-client.js.map +1 -1
  31. package/lib/esm/identify.d.ts +4 -0
  32. package/lib/esm/identify.d.ts.map +1 -1
  33. package/lib/esm/identify.js +15 -0
  34. package/lib/esm/identify.js.map +1 -1
  35. package/lib/esm/index.d.ts +1 -0
  36. package/lib/esm/index.d.ts.map +1 -1
  37. package/lib/esm/index.js +1 -0
  38. package/lib/esm/index.js.map +1 -1
  39. package/lib/esm/network-observer.d.ts +44 -0
  40. package/lib/esm/network-observer.d.ts.map +1 -0
  41. package/lib/esm/network-observer.js +166 -0
  42. package/lib/esm/network-observer.js.map +1 -0
  43. package/lib/esm/timeline.d.ts +4 -1
  44. package/lib/esm/timeline.d.ts.map +1 -1
  45. package/lib/esm/timeline.js +30 -0
  46. package/lib/esm/timeline.js.map +1 -1
  47. package/lib/esm/types/event/event.d.ts +33 -0
  48. package/lib/esm/types/event/event.d.ts.map +1 -1
  49. package/lib/esm/types/event/event.js.map +1 -1
  50. package/lib/esm/types/plugin.d.ts +22 -0
  51. package/lib/esm/types/plugin.d.ts.map +1 -1
  52. package/lib/esm/types/plugin.js.map +1 -1
  53. package/package.json +3 -2
@@ -217,6 +217,36 @@ var Timeline = /** @class */ (function () {
217
217
  });
218
218
  });
219
219
  };
220
+ Timeline.prototype.onIdentityChanged = function (identity) {
221
+ this.plugins.forEach(function (plugin) {
222
+ var _a;
223
+ // Intentionally to not await plugin.onIdentityChanged() for non-blocking.
224
+ // Ignore optional channing next line for test coverage.
225
+ // If the plugin doesn't implement it, it won't be called.
226
+ /* istanbul ignore next */
227
+ void ((_a = plugin.onIdentityChanged) === null || _a === void 0 ? void 0 : _a.call(plugin, identity));
228
+ });
229
+ };
230
+ Timeline.prototype.onSessionIdChanged = function (sessionId) {
231
+ this.plugins.forEach(function (plugin) {
232
+ var _a;
233
+ // Intentionally to not await plugin.onSessionIdChanged() for non-blocking.
234
+ // Ignore optional channing next line for test coverage.
235
+ // If the plugin doesn't implement it, it won't be called.
236
+ /* istanbul ignore next */
237
+ void ((_a = plugin.onSessionIdChanged) === null || _a === void 0 ? void 0 : _a.call(plugin, sessionId));
238
+ });
239
+ };
240
+ Timeline.prototype.onOptOutChanged = function (optOut) {
241
+ this.plugins.forEach(function (plugin) {
242
+ var _a;
243
+ // Intentionally to not await plugin.onOptOutChanged() for non-blocking.
244
+ // Ignore optional channing next line for test coverage.
245
+ // If the plugin doesn't implement it, it won't be called.
246
+ /* istanbul ignore next */
247
+ void ((_a = plugin.onOptOutChanged) === null || _a === void 0 ? void 0 : _a.call(plugin, optOut));
248
+ });
249
+ };
220
250
  return Timeline;
221
251
  }());
222
252
  export { Timeline };
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/timeline.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;IAQE,kBAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAPtC,UAAK,GAA6B,EAAE,CAAC;QACrC,kDAAkD;QAClD,aAAQ,GAAG,KAAK,CAAC;QACjB,4DAA4D;QAC5D,yFAAyF;QACzF,YAAO,GAAa,EAAE,CAAC;IAEkB,CAAC;IAEpC,2BAAQ,GAAd,UAAe,MAAc,EAAE,MAAe;;;;;;wBAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,cAAc,IAAK,OAAA,cAAc,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAnC,CAAmC,CAAC,EAAE;4BAC9E,4EAA4E;4BAC5E,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,2BAAoB,MAAM,CAAC,IAAI,2CAAwC,CAAC,CAAC;4BACpG,sBAAO;yBACR;wBAED,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE;4BAC7B,MAAM,CAAC,IAAI,GAAG,IAAI,EAAE,CAAC;4BACrB,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,sFACiB,MAAM,CAAC,IAAI,uFACkB,CAAC,CAAC;yBAC5E;wBAED,MAAM,CAAC,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,mCAAI,YAAY,CAAC;wBAC1C,qBAAM,CAAA,MAAA,MAAM,CAAC,KAAK,uDAAG,MAAM,EAAE,I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CAAC,UAAC,EAAQ;gCAAR,KAAA,aAAQ,EAAP,MAAM,QAAA;4BACjD,IAAM,aAAa,GACjB,MAAM,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,2DAA2D,CAAC,CAAC;4BACjG,OAAO,CAAC,aAAa,CAAC,CAAC;wBACzB,CAAC,CAAC,CAAC;wBAEH,sBAAO;;;;KACR;IAEK,wBAAK,GAAX;;;;;;;wBACQ,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;wBACzB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;wBAEhB,qBAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,CAAC,EAAA;;wBAAxD,SAAwD,CAAC;wBAEnD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CACrC,UAAC,MAAc,IAAkC,OAAA,MAAM,CAAC,IAAI,KAAK,aAAa,EAA7B,CAA6B,CAC/E,CAAC;wBAEI,mBAAmB,GAAG,WAAW,CAAC,GAAG,CAAC,UAAC,MAAM;4BACjD,OAAO,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;wBACxC,CAAC,CAAC,CAAC;wBAEH,qBAAM,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAA;;wBAAtC,SAAsC,CAAC;;;;;KACxC;IACH,eAAC;AAAD,CAAC,AApJD,IAoJC","sourcesContent":["import { BeforePlugin, DestinationPlugin, EnrichmentPlugin, Plugin } from './types/plugin';\nimport { CoreClient } from './core-client';\nimport { IConfig } from './config';\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\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 config.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 config.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.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 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 resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\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 resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\n }\n }\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 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"]}
1
+ {"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/timeline.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;IAQE,kBAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAPtC,UAAK,GAA6B,EAAE,CAAC;QACrC,kDAAkD;QAClD,aAAQ,GAAG,KAAK,CAAC;QACjB,4DAA4D;QAC5D,yFAAyF;QACzF,YAAO,GAAa,EAAE,CAAC;IAEkB,CAAC;IAEpC,2BAAQ,GAAd,UAAe,MAAc,EAAE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AAM,CAAC,IAAI,KAAK,aAAa,EAA7B,CAA6B,CAC/E,CAAC;wBAEI,mBAAmB,GAAG,WAAW,CAAC,GAAG,CAAC,UAAC,MAAM;4BACjD,OAAO,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;wBACxC,CAAC,CAAC,CAAC;wBAEH,qBAAM,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAA;;wBAAtC,SAAsC,CAAC;;;;;KACxC;IAED,oCAAiB,GAAjB,UAAkB,QAA2B;QAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;;YAC1B,0EAA0E;YAC1E,wDAAwD;YACxD,0DAA0D;YAC1D,0BAA0B;YAC1B,KAAK,CAAA,MAAA,MAAM,CAAC,iBAAiB,uDAAG,QAAQ,CAAC,CAAA,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,qCAAkB,GAAlB,UAAmB,SAAiB;QAClC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;;YAC1B,2EAA2E;YAC3E,wDAAwD;YACxD,0DAA0D;YAC1D,0BAA0B;YAC1B,KAAK,CAAA,MAAA,MAAM,CAAC,kBAAkB,uDAAG,SAAS,CAAC,CAAA,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kCAAe,GAAf,UAAgB,MAAe;QAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;;YAC1B,wEAAwE;YACxE,wDAAwD;YACxD,0DAA0D;YAC1D,0BAA0B;YAC1B,KAAK,CAAA,MAAA,MAAM,CAAC,eAAe,uDAAG,MAAM,CAAC,CAAA,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IACH,eAAC;AAAD,CAAC,AAlLD,IAkLC","sourcesContent":["import { AnalyticsIdentity, BeforePlugin, DestinationPlugin, EnrichmentPlugin, Plugin } from './types/plugin';\nimport { CoreClient } from './core-client';\nimport { IConfig } from './config';\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\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 config.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 config.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.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 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 resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\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 resolve({ event, code: 0, message: '' });\n return;\n } else {\n event = e;\n }\n }\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 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 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 }\n}\n"]}
@@ -34,6 +34,39 @@ export interface IdentifyUserProperties {
34
34
  [IdentifyOperation.PREINSERT]?: BaseOperationConfig;
35
35
  [IdentifyOperation.REMOVE]?: BaseOperationConfig;
36
36
  }
37
+ /**
38
+ * Represents the structure of user properties that can be sent with an Identify or GroupIdentify event.
39
+ *
40
+ * This type supports both:
41
+ *
42
+ * 1. Reserved Amplitude identify operations via `IdentifyUserProperties`:
43
+ * These operations enable structured updates to user properties.
44
+ *
45
+ * Example:
46
+ * ```ts
47
+ * {
48
+ * $set: { plan: 'premium', login_count: 1 },
49
+ * $add: { login_count: 1 },
50
+ * $unset: { plan: '-' },
51
+ * $clearAll: '-'
52
+ * }
53
+ * ```
54
+ *
55
+ * 2. Custom user-defined properties (excluding reserved operation keys):
56
+ * Useful for assigning static properties without using Identify operations.
57
+ *
58
+ * Example:
59
+ * ```ts
60
+ * {
61
+ * custom_flag: true,
62
+ * experiment_group: 'B',
63
+ * favorite_color: 'blue'
64
+ * }
65
+ * ```
66
+ *
67
+ * This union ensures compatibility with Amplitude's identify semantics
68
+ * while allowing flexibility to define arbitrary non-reserved properties.
69
+ */
37
70
  export type UserProperties = IdentifyUserProperties | {
38
71
  [key in Exclude<string, IdentifyOperation>]: any;
39
72
  };
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../src/types/event/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc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,iBAAiB,KAAjB,iBAAiB,QAkB5B;AAuCD;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,0CAAsB,CAAA;IACtB,qDAAiC,CAAA;IACjC,8CAA0B,CAAA;AAC5B,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["import { BaseEvent } from './base-event';\nimport { RevenueEventProperties } from '../../revenue';\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport type UserProperties =\n | IdentifyUserProperties\n | {\n [key in Exclude<string, IdentifyOperation>]: any;\n };\n\n/**\n * Strings that have special meaning when used as an event's type\n * and have different specifications.\n */\nexport enum SpecialEventType {\n IDENTIFY = '$identify',\n GROUP_IDENTIFY = '$groupidentify',\n REVENUE = 'revenue_amount',\n}\n\nexport interface TrackEvent extends BaseEvent {\n event_type: Exclude<string, SpecialEventType>;\n}\n\nexport interface IdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.IDENTIFY;\n user_properties: UserProperties;\n}\n\nexport interface GroupIdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.GROUP_IDENTIFY;\n group_properties: UserProperties;\n}\n\nexport interface RevenueEvent extends BaseEvent {\n event_type: SpecialEventType.REVENUE;\n event_properties:\n | RevenueEventProperties\n | {\n [key: string]: any;\n };\n}\n\nexport type Event = TrackEvent | IdentifyEvent | GroupIdentifyEvent | RevenueEvent;\n"]}
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../src/types/event/event.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B,gCAAgC;IAChC,iCAAY,CAAA;IACZ,0CAAqB,CAAA;IAErB,8CAA8C;IAC9C,iCAAY,CAAA;IACZ,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,uCAAkB,CAAA;IAElB,8DAA8D;IAC9D,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAE1B,+CAA+C;IAC/C,qCAAgB,CAAA;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,KAAjB,iBAAiB,QAkB5B;AAwED;;;GAGG;AACH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,0CAAsB,CAAA;IACtB,qDAAiC,CAAA;IACjC,8CAA0B,CAAA;AAC5B,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["import { BaseEvent } from './base-event';\nimport { RevenueEventProperties } from '../../revenue';\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\n/**\n * Represents the structure of user properties that can be sent with an Identify or GroupIdentify event.\n *\n * This type supports both:\n *\n * 1. Reserved Amplitude identify operations via `IdentifyUserProperties`:\n * These operations enable structured updates to user properties.\n *\n * Example:\n * ```ts\n * {\n * $set: { plan: 'premium', login_count: 1 },\n * $add: { login_count: 1 },\n * $unset: { plan: '-' },\n * $clearAll: '-'\n * }\n * ```\n *\n * 2. Custom user-defined properties (excluding reserved operation keys):\n * Useful for assigning static properties without using Identify operations.\n *\n * Example:\n * ```ts\n * {\n * custom_flag: true,\n * experiment_group: 'B',\n * favorite_color: 'blue'\n * }\n * ```\n *\n * This union ensures compatibility with Amplitude's identify semantics\n * while allowing flexibility to define arbitrary non-reserved properties.\n */\nexport type UserProperties =\n | IdentifyUserProperties\n | {\n [key in Exclude<string, IdentifyOperation>]: any;\n };\n\n/**\n * Strings that have special meaning when used as an event's type\n * and have different specifications.\n */\nexport enum SpecialEventType {\n IDENTIFY = '$identify',\n GROUP_IDENTIFY = '$groupidentify',\n REVENUE = 'revenue_amount',\n}\n\nexport interface TrackEvent extends BaseEvent {\n event_type: Exclude<string, SpecialEventType>;\n}\n\nexport interface IdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.IDENTIFY;\n user_properties: UserProperties;\n}\n\nexport interface GroupIdentifyEvent extends BaseEvent {\n event_type: SpecialEventType.GROUP_IDENTIFY;\n group_properties: UserProperties;\n}\n\nexport interface RevenueEvent extends BaseEvent {\n event_type: SpecialEventType.REVENUE;\n event_properties:\n | RevenueEventProperties\n | {\n [key: string]: any;\n };\n}\n\nexport type Event = TrackEvent | IdentifyEvent | GroupIdentifyEvent | RevenueEvent;\n"]}
@@ -6,11 +6,33 @@ type PluginTypeBefore = 'before';
6
6
  type PluginTypeEnrichment = 'enrichment';
7
7
  type PluginTypeDestination = 'destination';
8
8
  export type PluginType = PluginTypeBefore | PluginTypeEnrichment | PluginTypeDestination;
9
+ export interface AnalyticsIdentity {
10
+ deviceId?: string;
11
+ userId?: string;
12
+ userProperties?: {
13
+ [key: string]: any;
14
+ };
15
+ }
9
16
  interface PluginBase<T = CoreClient, U = IConfig> {
10
17
  name?: string;
11
18
  type?: PluginType;
12
19
  setup?(config: U, client: T): Promise<void>;
13
20
  teardown?(): Promise<void>;
21
+ /**
22
+ * Called when the identity is changed. This is a **best-effort** API and may not be triggered in all scenarios.
23
+ *
24
+ * Currently supported only in the Browser SDK. Not supported in React Native or Node SDKs.
25
+ *
26
+ * @param identity The changed identity. If a field is missing, it means it has not changed.
27
+ * For example, `{ userId: undefined }` means the userId was explicitly changed to `undefined`,
28
+ * while deviceId and userProperties remain unchanged.
29
+ *
30
+ * Note: `onIdentityChanged()` will be triggered when a user logs in via `setUserId()`.
31
+ * It will not be triggered on subsequent page loads (e.g., when a user reopens the site in a new tab).
32
+ */
33
+ onIdentityChanged?(identity: AnalyticsIdentity): Promise<void>;
34
+ onSessionIdChanged?(sessionId: number): Promise<void>;
35
+ onOptOutChanged?(optOut: boolean): Promise<void>;
14
36
  }
15
37
  export interface BeforePlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {
16
38
  type: PluginTypeBefore;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,KAAK,gBAAgB,GAAG,QAAQ,CAAC;AACjC,KAAK,oBAAoB,GAAG,YAAY,CAAC;AACzC,KAAK,qBAAqB,GAAG,aAAa,CAAC;AAC3C,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAEzF,UAAU,UAAU,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAE,SAAQ,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;IACjF,IAAI,EAAE,gBAAgB,CAAC;IAC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,EAAE,oBAAoB,CAAC;IAC5B,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,CAAE,SAAQ,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;IACtF,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,OAAO,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from './event/event';\nimport { IConfig } from '../config';\nimport { Result } from './result';\nimport { CoreClient } from '../core-client';\n\ntype PluginTypeBefore = 'before';\ntype PluginTypeEnrichment = 'enrichment';\ntype PluginTypeDestination = 'destination';\nexport type PluginType = PluginTypeBefore | PluginTypeEnrichment | PluginTypeDestination;\n\ninterface PluginBase<T = CoreClient, U = IConfig> {\n name?: string;\n type?: PluginType;\n setup?(config: U, client: T): Promise<void>;\n teardown?(): Promise<void>;\n}\n\nexport interface BeforePlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeBefore;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface EnrichmentPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type?: PluginTypeEnrichment;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface DestinationPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeDestination;\n execute(context: Event): Promise<Result>;\n flush?(): Promise<void>;\n}\n\nexport type Plugin<T = CoreClient, U = IConfig> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;\n"]}
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/types/plugin.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from './event/event';\nimport { IConfig } from '../config';\nimport { Result } from './result';\nimport { CoreClient } from '../core-client';\n\ntype PluginTypeBefore = 'before';\ntype PluginTypeEnrichment = 'enrichment';\ntype PluginTypeDestination = 'destination';\nexport type PluginType = PluginTypeBefore | PluginTypeEnrichment | PluginTypeDestination;\n\nexport interface AnalyticsIdentity {\n deviceId?: string;\n userId?: string;\n userProperties?: { [key: string]: any };\n}\n\ninterface PluginBase<T = CoreClient, U = IConfig> {\n name?: string;\n type?: PluginType;\n setup?(config: U, client: T): Promise<void>;\n teardown?(): Promise<void>;\n /**\n * Called when the identity is changed. This is a **best-effort** API and may not be triggered in all scenarios.\n *\n * Currently supported only in the Browser SDK. Not supported in React Native or Node SDKs.\n *\n * @param identity The changed identity. If a field is missing, it means it has not changed.\n * For example, `{ userId: undefined }` means the userId was explicitly changed to `undefined`,\n * while deviceId and userProperties remain unchanged.\n *\n * Note: `onIdentityChanged()` will be triggered when a user logs in via `setUserId()`.\n * It will not be triggered on subsequent page loads (e.g., when a user reopens the site in a new tab).\n */\n onIdentityChanged?(identity: AnalyticsIdentity): Promise<void>;\n onSessionIdChanged?(sessionId: number): Promise<void>;\n onOptOutChanged?(optOut: boolean): Promise<void>;\n}\n\nexport interface BeforePlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeBefore;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface EnrichmentPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type?: PluginTypeEnrichment;\n execute?(context: Event): Promise<Event | null>;\n}\n\nexport interface DestinationPlugin<T = CoreClient, U = IConfig> extends PluginBase<T, U> {\n type: PluginTypeDestination;\n execute(context: Event): Promise<Result>;\n flush?(): Promise<void>;\n}\n\nexport type Plugin<T = CoreClient, U = IConfig> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/analytics-core",
3
- "version": "2.9.0",
3
+ "version": "2.10.1",
4
4
  "description": "",
5
5
  "author": "Amplitude Inc",
6
6
  "homepage": "https://github.com/amplitude/Amplitude-TypeScript",
@@ -35,10 +35,11 @@
35
35
  "url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
36
36
  },
37
37
  "dependencies": {
38
+ "@amplitude/analytics-connector": "^1.6.4",
38
39
  "tslib": "^2.4.1"
39
40
  },
40
41
  "files": [
41
42
  "lib"
42
43
  ],
43
- "gitHead": "bed8f4e611b944dab30a9aea4e48022655b0ddb0"
44
+ "gitHead": "a810cb15d56f058d5eea1e8c53da430c5113bb3d"
44
45
  }