@amplitude/unified 1.1.32 → 1.1.33

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.
package/README.md CHANGED
@@ -25,16 +25,12 @@ yarn add @amplitude/unified
25
25
 
26
26
  The Unified SDK provides a single entry point for all Amplitude features, including Analytics, Experiment, and Session Replay. It simplifies the integration process by handling the initialization and configuration of all components.
27
27
 
28
- ### 1. Import Amplitude Unified SDK
28
+ ### 1. Initialize Amplitude Unified SDK
29
29
 
30
30
  ```typescript
31
- import { initAll } from '@amplitude/unified';
32
- ```
33
-
34
- ### 2. Initialize the SDK
31
+ import { Identify, experiment, identify, initAll, sessionReplay, track } from '@amplitude/unified';
35
32
 
36
- ```typescript
37
- initAll('YOUR_API_KEY', {
33
+ await initAll('YOUR_API_KEY', {
38
34
  // Shared options for all SDKs (optional)
39
35
  serverZone: 'US', // or 'EU'
40
36
  instanceName: 'my-instance',
@@ -61,18 +57,11 @@ initAll('YOUR_API_KEY', {
61
57
  });
62
58
  ```
63
59
 
64
- ### 3. Access SDK Features
60
+ ### 2. Access SDK Features
65
61
 
66
62
  The Unified SDK provides access to all Amplitude features through a single interface:
67
63
 
68
64
  ```typescript
69
- import {
70
- track,
71
- identify,
72
- experiment,
73
- sessionReplay
74
- } from '@amplitude/unified';
75
-
76
65
  // Track events
77
66
  track('Button Clicked', { buttonName: 'Sign Up' });
78
67
 
@@ -80,13 +69,17 @@ track('Button Clicked', { buttonName: 'Sign Up' });
80
69
  identify(new Identify().set('userType', 'premium'));
81
70
 
82
71
  // Access Experiment features
83
- const variant = await experiment.fetch('experiment-key');
72
+ const experimentClient = experiment();
73
+ if (experimentClient) {
74
+ await experimentClient.fetch();
75
+ const variant = experimentClient.variant('experiment-key');
76
+ }
84
77
 
85
78
  // Access Session Replay features
86
- sessionReplay.flush();
79
+ await sessionReplay()?.flush(false);
87
80
 
88
81
  // Access Guides and Surveys features via engagement global
89
- const activeGuidesAndSurveys = await engagement.gs.list();
82
+ const activeGuidesAndSurveys = window.engagement.gs.list();
90
83
  ```
91
84
 
92
85
  ## Configuration Options
@@ -112,7 +105,7 @@ All options from `@amplitude/plugin-experiment-browser` are supported. See the [
112
105
 
113
106
  ### Guides and Surveys Options
114
107
 
115
- All options from `@amplitude/engagement-browser` are supported. See the [Guides and Surveys documentation](hhttps://amplitude.com/docs/guides-and-surveys/sdk) for details.
108
+ All options from `@amplitude/engagement-browser` are supported. See the [Guides and Surveys documentation](https://amplitude.com/docs/guides-and-surveys/sdk) for details.
116
109
 
117
110
  ## Learn More
118
111
 
@@ -1,5 +1,5 @@
1
1
  export { createInstance } from './unified-client-factory';
2
2
  export type { UnifiedClient, UnifiedOptions, UnifiedSharedOptions } from './unified';
3
- export declare const _setDiagnosticsSampleRate: (sampleRate: number) => void, initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: () => import("@amplitude/plugin-experiment-browser").IExperimentClient | undefined, sessionReplay: () => import("@amplitude/plugin-session-replay-browser").AmplitudeSessionReplay, add: (plugin: import("@amplitude/analytics-core").Plugin<import("@amplitude/analytics-core").BrowserClient, import("@amplitude/analytics-core").BrowserConfig>) => import("@amplitude/analytics-core").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-core").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getIdentity: () => import("@amplitude/analytics-core").AnalyticsIdentity, getOptOut: () => boolean | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, identify: (identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, logEvent: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, remove: (pluginName: string) => import("@amplitude/analytics-core").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-core").IRevenue, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setIdentity: (identity: Partial<import("@amplitude/analytics-core").AnalyticsIdentity>) => void, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportTypeOrOptions) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>;
3
+ export declare const _setDiagnosticsSampleRate: (sampleRate: number) => void, initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: () => import("@amplitude/plugin-experiment-browser").IExperimentClient | undefined, sessionReplay: () => import("@amplitude/plugin-session-replay-browser").AmplitudeSessionReplay | undefined, add: (plugin: import("@amplitude/analytics-core").Plugin<import("@amplitude/analytics-core").BrowserClient, import("@amplitude/analytics-core").BrowserConfig>) => import("@amplitude/analytics-core").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-core").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getIdentity: () => import("@amplitude/analytics-core").AnalyticsIdentity, getOptOut: () => boolean | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, identify: (identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, logEvent: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, remove: (pluginName: string) => import("@amplitude/analytics-core").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-core").IRevenue, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setIdentity: (identity: Partial<import("@amplitude/analytics-core").AnalyticsIdentity>) => void, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportTypeOrOptions) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>;
4
4
  export { Types, Revenue, Identify } from '@amplitude/analytics-browser';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrF,eAAO,MACL,yBAAyB,gCACzB,OAAO,sGACP,UAAU,sFACV,aAAa,mFACb,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,WAAW,+DACX,SAAS,6BACT,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,WAAW,sFACX,SAAS,6BACT,YAAY,+BACZ,YAAY,mFACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrF,eAAO,MACL,yBAAyB,gCACzB,OAAO,sGACP,UAAU,sFACV,aAAa,+FACb,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,WAAW,+DACX,SAAS,6BACT,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,WAAW,sFACX,SAAS,6BACT,YAAY,+BACZ,YAAY,mFACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
@@ -8,6 +8,10 @@ export interface UnifiedSharedOptions {
8
8
  instanceName?: string;
9
9
  }
10
10
  export type UnifiedOptions = UnifiedSharedOptions & {
11
+ /**
12
+ * Analytics Browser SDK configuration options.
13
+ * See {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk | Configure the SDK}.
14
+ */
11
15
  analytics?: BrowserOptions;
12
16
  sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;
13
17
  experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;
@@ -15,20 +19,24 @@ export type UnifiedOptions = UnifiedSharedOptions & {
15
19
  };
16
20
  export interface UnifiedClient extends BrowserClient {
17
21
  initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
18
- sessionReplay(): AmplitudeSessionReplay;
22
+ sessionReplay(): AmplitudeSessionReplay | undefined;
19
23
  experiment(): IExperimentClient | undefined;
20
24
  }
21
25
  export declare class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {
22
- private _sessionReplay;
26
+ private _sessionReplay?;
23
27
  private _initAllPromise?;
24
- sessionReplay(): AmplitudeSessionReplay;
28
+ /**
29
+ * Returns the Session Replay client after initAll() has completed, or undefined before initialization or when the
30
+ * Session Replay plugin is unavailable.
31
+ */
32
+ sessionReplay(): AmplitudeSessionReplay | undefined;
25
33
  experiment(): IExperimentClient | undefined;
26
34
  /**
27
35
  * Initialize SDKs with configuration options.
28
36
  *
29
37
  * @param apiKey Amplitude API key.
30
- * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.
31
- * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
38
+ * @param unifiedOptions Shared and SDK-specific configuration options. `unifiedOptions.analytics` configures the
39
+ * Analytics Browser SDK.
32
40
  */
33
41
  initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
34
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OA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CAAC,eAAe,CAAC,CAAgB;IAExC;;;OAGG;IACH,aAAa,IAAI,sBAAsB,GAAG,SAAS;IAInD,UAAU,IAAI,iBAAiB,GAAG,SAAS;IAkB3C;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc;IAuC7D;;OAEG;IAEH,IAAI,CAAC,MAAM,SAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;CAI3F"}
@@ -12,6 +12,10 @@ var AmplitudeUnified = /** @class */ (function (_super) {
12
12
  function AmplitudeUnified() {
13
13
  return _super !== null && _super.apply(this, arguments) || this;
14
14
  }
15
+ /**
16
+ * Returns the Session Replay client after initAll() has completed, or undefined before initialization or when the
17
+ * Session Replay plugin is unavailable.
18
+ */
15
19
  AmplitudeUnified.prototype.sessionReplay = function () {
16
20
  return this._sessionReplay;
17
21
  };
@@ -37,8 +41,8 @@ var AmplitudeUnified = /** @class */ (function (_super) {
37
41
  * Initialize SDKs with configuration options.
38
42
  *
39
43
  * @param apiKey Amplitude API key.
40
- * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.
41
- * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
44
+ * @param unifiedOptions Shared and SDK-specific configuration options. `unifiedOptions.analytics` configures the
45
+ * Analytics Browser SDK.
42
46
  */
43
47
  AmplitudeUnified.prototype.initAll = function (apiKey, unifiedOptions) {
44
48
  return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -1 +1 @@
1
- {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";;;;AAAA,kEAAgE;AAChE,0FAKkD;AAClD,kFAK8C;AAC9C,oEAAwF;AAExF,qCAA0C;AAoB1C;IAAsC,4CAAgB;IAAtD;;IAkFA,CAAC;IA5EC,wCAAa,GAAb;QACE,OAAO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itudeBrowser } from '@amplitude/analytics-browser';\nimport {\n AmplitudeSessionReplay,\n SessionReplayOptions,\n sessionReplayPlugin,\n SessionReplayPlugin,\n} from '@amplitude/plugin-session-replay-browser';\nimport {\n IExperimentClient,\n ExperimentPluginConfig,\n ExperimentPlugin,\n experimentPlugin,\n} from '@amplitude/plugin-experiment-browser';\nimport { InitOptions, plugin as EngagementPlugin } from '@amplitude/engagement-browser';\nimport { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';\nimport { libraryPlugin } from './library';\n\nexport interface UnifiedSharedOptions {\n serverZone?: 'US' | 'EU';\n instanceName?: string;\n}\n\nexport type UnifiedOptions = UnifiedSharedOptions & {\n analytics?: BrowserOptions;\n sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n engagement?: Omit<InitOptions, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sessionReplay(): AmplitudeSessionReplay;\n experiment(): IExperimentClient | undefined;\n}\n\nexport class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n private _sessionReplay: AmplitudeSessionReplay;\n private _initAllPromise?: Promise<void>;\n\n sessionReplay(): AmplitudeSessionReplay {\n return this._sessionReplay;\n }\n\n experiment(): IExperimentClient | undefined {\n // Return when init() or initAll() is not called\n if (this.config === undefined) {\n return undefined;\n }\n\n const expPlugins = this.plugins(ExperimentPlugin);\n if (expPlugins.length === 0) {\n this.config.loggerProvider.debug(`${ExperimentPlugin.pluginName} plugin is not found.`);\n return undefined;\n } else if (expPlugins.length === 1) {\n return expPlugins[0].experiment;\n } else {\n this.config.loggerProvider.debug(`Multiple instances of ${ExperimentPlugin.pluginName} are found.`);\n return undefined;\n }\n }\n\n /**\n * Initialize SDKs with configuration options.\n *\n * @param apiKey Amplitude API key.\n * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.\n * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.\n */\n async initAll(apiKey: string, unifiedOptions?: UnifiedOptions) {\n if (this._initAllPromise) {\n return this._initAllPromise;\n }\n\n this._initAllPromise = (async () => {\n const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n super.add(libraryPlugin());\n\n await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n\n await super.add(sessionReplayPlugin({ ...unifiedOptions?.sessionReplay, ...sharedOptions })).promise;\n\n await super.add(experimentPlugin({ ...unifiedOptions?.experiment, ...sharedOptions })).promise;\n\n const srPlugin = this.plugin(SessionReplayPlugin.pluginName);\n if (srPlugin === undefined) {\n this.config.loggerProvider.debug(`${SessionReplayPlugin.pluginName} plugin is not found.`);\n } else {\n this._sessionReplay = (srPlugin as SessionReplayPlugin).sessionReplay;\n }\n\n await super.add(\n EngagementPlugin({\n ...unifiedOptions?.engagement,\n ...sharedOptions,\n }),\n ).promise;\n })().finally(() => {\n this._initAllPromise = undefined;\n });\n\n return this._initAllPromise;\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";;;;AAAA,kEAAgE;AAChE,0FAKkD;AAClD,kFAK8C;AAC9C,oEAAwF;AAExF,qCAA0C;AAwB1C;IAAsC,4CAAgB;IAAtD;;IAoFA,CAAC;IAhFC;;;OAGG;IACH,wCAAa,GAAb;QACE,OAAO,IAAI,CAAC,cAAc,CAAC;IAC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port {\n AmplitudeSessionReplay,\n SessionReplayOptions,\n sessionReplayPlugin,\n SessionReplayPlugin,\n} from '@amplitude/plugin-session-replay-browser';\nimport {\n IExperimentClient,\n ExperimentPluginConfig,\n ExperimentPlugin,\n experimentPlugin,\n} from '@amplitude/plugin-experiment-browser';\nimport { InitOptions, plugin as EngagementPlugin } from '@amplitude/engagement-browser';\nimport { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';\nimport { libraryPlugin } from './library';\n\nexport interface UnifiedSharedOptions {\n serverZone?: 'US' | 'EU';\n instanceName?: string;\n}\n\nexport type UnifiedOptions = UnifiedSharedOptions & {\n /**\n * Analytics Browser SDK configuration options.\n * See {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk | Configure the SDK}.\n */\n analytics?: BrowserOptions;\n sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n engagement?: Omit<InitOptions, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sessionReplay(): AmplitudeSessionReplay | undefined;\n experiment(): IExperimentClient | undefined;\n}\n\nexport class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {\n private _sessionReplay?: AmplitudeSessionReplay;\n private _initAllPromise?: Promise<void>;\n\n /**\n * Returns the Session Replay client after initAll() has completed, or undefined before initialization or when the\n * Session Replay plugin is unavailable.\n */\n sessionReplay(): AmplitudeSessionReplay | undefined {\n return this._sessionReplay;\n }\n\n experiment(): IExperimentClient | undefined {\n // Return when init() or initAll() is not called\n if (this.config === undefined) {\n return undefined;\n }\n\n const expPlugins = this.plugins(ExperimentPlugin);\n if (expPlugins.length === 0) {\n this.config.loggerProvider.debug(`${ExperimentPlugin.pluginName} plugin is not found.`);\n return undefined;\n } else if (expPlugins.length === 1) {\n return expPlugins[0].experiment;\n } else {\n this.config.loggerProvider.debug(`Multiple instances of ${ExperimentPlugin.pluginName} are found.`);\n return undefined;\n }\n }\n\n /**\n * Initialize SDKs with configuration options.\n *\n * @param apiKey Amplitude API key.\n * @param unifiedOptions Shared and SDK-specific configuration options. `unifiedOptions.analytics` configures the\n * Analytics Browser SDK.\n */\n async initAll(apiKey: string, unifiedOptions?: UnifiedOptions) {\n if (this._initAllPromise) {\n return this._initAllPromise;\n }\n\n this._initAllPromise = (async () => {\n const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n super.add(libraryPlugin());\n\n await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n\n await super.add(sessionReplayPlugin({ ...unifiedOptions?.sessionReplay, ...sharedOptions })).promise;\n\n await super.add(experimentPlugin({ ...unifiedOptions?.experiment, ...sharedOptions })).promise;\n\n const srPlugin = this.plugin(SessionReplayPlugin.pluginName);\n if (srPlugin === undefined) {\n this.config.loggerProvider.debug(`${SessionReplayPlugin.pluginName} plugin is not found.`);\n } else {\n this._sessionReplay = (srPlugin as SessionReplayPlugin).sessionReplay;\n }\n\n await super.add(\n EngagementPlugin({\n ...unifiedOptions?.engagement,\n ...sharedOptions,\n }),\n ).promise;\n })().finally(() => {\n this._initAllPromise = undefined;\n });\n\n return this._initAllPromise;\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.1.32";
1
+ export declare const VERSION = "1.1.33";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Autogenerated by `pnpm version-file`. DO NOT EDIT
5
- exports.VERSION = '1.1.32';
5
+ exports.VERSION = '1.1.33';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.1.32';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.1.33';\n"]}
@@ -1,5 +1,5 @@
1
1
  export { createInstance } from './unified-client-factory';
2
2
  export type { UnifiedClient, UnifiedOptions, UnifiedSharedOptions } from './unified';
3
- export declare const _setDiagnosticsSampleRate: (sampleRate: number) => void, initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: () => import("@amplitude/plugin-experiment-browser").IExperimentClient | undefined, sessionReplay: () => import("@amplitude/plugin-session-replay-browser").AmplitudeSessionReplay, add: (plugin: import("@amplitude/analytics-core").Plugin<import("@amplitude/analytics-core").BrowserClient, import("@amplitude/analytics-core").BrowserConfig>) => import("@amplitude/analytics-core").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-core").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getIdentity: () => import("@amplitude/analytics-core").AnalyticsIdentity, getOptOut: () => boolean | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, identify: (identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, logEvent: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, remove: (pluginName: string) => import("@amplitude/analytics-core").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-core").IRevenue, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setIdentity: (identity: Partial<import("@amplitude/analytics-core").AnalyticsIdentity>) => void, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportTypeOrOptions) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>;
3
+ export declare const _setDiagnosticsSampleRate: (sampleRate: number) => void, initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: () => import("@amplitude/plugin-experiment-browser").IExperimentClient | undefined, sessionReplay: () => import("@amplitude/plugin-session-replay-browser").AmplitudeSessionReplay | undefined, add: (plugin: import("@amplitude/analytics-core").Plugin<import("@amplitude/analytics-core").BrowserClient, import("@amplitude/analytics-core").BrowserConfig>) => import("@amplitude/analytics-core").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-core").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getIdentity: () => import("@amplitude/analytics-core").AnalyticsIdentity, getOptOut: () => boolean | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, identify: (identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, logEvent: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, remove: (pluginName: string) => import("@amplitude/analytics-core").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-core").IRevenue, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setIdentity: (identity: Partial<import("@amplitude/analytics-core").AnalyticsIdentity>) => void, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportTypeOrOptions) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>;
4
4
  export { Types, Revenue, Identify } from '@amplitude/analytics-browser';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrF,eAAO,MACL,yBAAyB,gCACzB,OAAO,sGACP,UAAU,sFACV,aAAa,mFACb,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,WAAW,+DACX,SAAS,6BACT,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,WAAW,sFACX,SAAS,6BACT,YAAY,+BACZ,YAAY,mFACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrF,eAAO,MACL,yBAAyB,gCACzB,OAAO,sGACP,UAAU,sFACV,aAAa,+FACb,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,WAAW,+DACX,SAAS,6BACT,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,WAAW,sFACX,SAAS,6BACT,YAAY,+BACZ,YAAY,mFACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
@@ -8,6 +8,10 @@ export interface UnifiedSharedOptions {
8
8
  instanceName?: string;
9
9
  }
10
10
  export type UnifiedOptions = UnifiedSharedOptions & {
11
+ /**
12
+ * Analytics Browser SDK configuration options.
13
+ * See {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk | Configure the SDK}.
14
+ */
11
15
  analytics?: BrowserOptions;
12
16
  sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;
13
17
  experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;
@@ -15,20 +19,24 @@ export type UnifiedOptions = UnifiedSharedOptions & {
15
19
  };
16
20
  export interface UnifiedClient extends BrowserClient {
17
21
  initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
18
- sessionReplay(): AmplitudeSessionReplay;
22
+ sessionReplay(): AmplitudeSessionReplay | undefined;
19
23
  experiment(): IExperimentClient | undefined;
20
24
  }
21
25
  export declare class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {
22
- private _sessionReplay;
26
+ private _sessionReplay?;
23
27
  private _initAllPromise?;
24
- sessionReplay(): AmplitudeSessionReplay;
28
+ /**
29
+ * Returns the Session Replay client after initAll() has completed, or undefined before initialization or when the
30
+ * Session Replay plugin is unavailable.
31
+ */
32
+ sessionReplay(): AmplitudeSessionReplay | undefined;
25
33
  experiment(): IExperimentClient | undefined;
26
34
  /**
27
35
  * Initialize SDKs with configuration options.
28
36
  *
29
37
  * @param apiKey Amplitude API key.
30
- * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.
31
- * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
38
+ * @param unifiedOptions Shared and SDK-specific configuration options. `unifiedOptions.analytics` configures the
39
+ * Analytics Browser SDK.
32
40
  */
33
41
  initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
34
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"unified.d.ts","sourceRoot":"","s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AAa,gBAAiB,SAAQ,gBAAiB,YAAW,aAAa;IAC7E,OAAO,CAAC,cAAc,CAAC,CAAyB;IAChD,OAAO,CAAC,eAAe,CAAC,CAAgB;IAExC;;;OAGG;IACH,aAAa,IAAI,sBAAsB,GAAG,SAAS;IAInD,UAAU,IAAI,iBAAiB,GAAG,SAAS;IAkB3C;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc;IAuC7D;;OAEG;IAEH,IAAI,CAAC,MAAM,SAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;CAI3F"}
@@ -9,6 +9,10 @@ var AmplitudeUnified = /** @class */ (function (_super) {
9
9
  function AmplitudeUnified() {
10
10
  return _super !== null && _super.apply(this, arguments) || this;
11
11
  }
12
+ /**
13
+ * Returns the Session Replay client after initAll() has completed, or undefined before initialization or when the
14
+ * Session Replay plugin is unavailable.
15
+ */
12
16
  AmplitudeUnified.prototype.sessionReplay = function () {
13
17
  return this._sessionReplay;
14
18
  };
@@ -34,8 +38,8 @@ var AmplitudeUnified = /** @class */ (function (_super) {
34
38
  * Initialize SDKs with configuration options.
35
39
  *
36
40
  * @param apiKey Amplitude API key.
37
- * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.
38
- * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
41
+ * @param unifiedOptions Shared and SDK-specific configuration options. `unifiedOptions.analytics` configures the
42
+ * Analytics Browser SDK.
39
43
  */
40
44
  AmplitudeUnified.prototype.initAll = function (apiKey, unifiedOptions) {
41
45
  return __awaiter(this, void 0, void 0, function () {
@@ -1 +1 @@
1
- {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAG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BAAI,GAAJ,UAAK,MAAW,EAAE,eAAyC,EAAE,YAA6B;QAArF,uBAAA,EAAA,WAAW;QACd,IAAM,GAAG,GAAG,iBAAM,IAAI,YAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC;IACb,CAAC;IACH,uBAAC;AAAD,CAAC,AAlFD,CAAsC,gBAAgB,GAkFrD","sourcesContent":["import { AmplitudeBrowser } from '@amplitude/analytics-browser';\nimport {\n AmplitudeSessionReplay,\n SessionReplayOptions,\n sessionReplayPlugin,\n SessionReplayPlugin,\n} from '@amplitude/plugin-session-replay-browser';\nimport {\n IExperimentClient,\n ExperimentPluginConfig,\n ExperimentPlugin,\n experimentPlugin,\n} from '@amplitude/plugin-experiment-browser';\nimport { InitOptions, plugin as EngagementPlugin } from '@amplitude/engagement-browser';\nimport { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';\nimport { libraryPlugin } from './library';\n\nexport interface UnifiedSharedOptions {\n serverZone?: 'US' | 'EU';\n instanceName?: string;\n}\n\nexport type UnifiedOptions = UnifiedSharedOptions & {\n analytics?: BrowserOptions;\n sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n engagement?: Omit<InitOptions, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sessionReplay(): AmplitudeSessionReplay;\n experiment(): IExperimentClient | undefined;\n}\n\nexport class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n private _sessionReplay: AmplitudeSessionReplay;\n private _initAllPromise?: Promise<void>;\n\n sessionReplay(): AmplitudeSessionReplay {\n return this._sessionReplay;\n }\n\n experiment(): IExperimentClient | undefined {\n // Return when init() or initAll() is not called\n if (this.config === undefined) {\n return undefined;\n }\n\n const expPlugins = this.plugins(ExperimentPlugin);\n if (expPlugins.length === 0) {\n this.config.loggerProvider.debug(`${ExperimentPlugin.pluginName} plugin is not found.`);\n return undefined;\n } else if (expPlugins.length === 1) {\n return expPlugins[0].experiment;\n } else {\n this.config.loggerProvider.debug(`Multiple instances of ${ExperimentPlugin.pluginName} are found.`);\n return undefined;\n }\n }\n\n /**\n * Initialize SDKs with configuration options.\n *\n * @param apiKey Amplitude API key.\n * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.\n * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.\n */\n async initAll(apiKey: string, unifiedOptions?: UnifiedOptions) {\n if (this._initAllPromise) {\n return this._initAllPromise;\n }\n\n this._initAllPromise = (async () => {\n const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n super.add(libraryPlugin());\n\n await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n\n await super.add(sessionReplayPlugin({ ...unifiedOptions?.sessionReplay, ...sharedOptions })).promise;\n\n await super.add(experimentPlugin({ ...unifiedOptions?.experiment, ...sharedOptions })).promise;\n\n const srPlugin = this.plugin(SessionReplayPlugin.pluginName);\n if (srPlugin === undefined) {\n this.config.loggerProvider.debug(`${SessionReplayPlugin.pluginName} plugin is not found.`);\n } else {\n this._sessionReplay = (srPlugin as SessionReplayPlugin).sessionReplay;\n }\n\n await super.add(\n EngagementPlugin({\n ...unifiedOptions?.engagement,\n ...sharedOptions,\n }),\n ).promise;\n })().finally(() => {\n this._initAllPromise = undefined;\n });\n\n return this._initAllPromise;\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n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CAAC;oBACX,KAAI,CAAC,eAAe,GAAG,SAAS,CAAC;gBACnC,CAAC,CAAC,CAAC;gBAEH,sBAAO,IAAI,CAAC,eAAe,EAAC;;;KAC7B;IAED;;OAEG;IACH,0BAA0B;IAC1B,+BAAI,GAAJ,UAAK,MAAW,EAAE,eAAyC,EAAE,YAA6B;QAArF,uBAAA,EAAA,WAAW;QACd,IAAM,GAAG,GAAG,iBAAM,IAAI,YAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC;IACb,CAAC;IACH,uBAAC;AAAD,CAAC,AApFD,CAAsC,gBAAgB,GAoFrD","sourcesContent":["import { AmplitudeBrowser } from '@amplitude/analytics-browser';\nimport {\n AmplitudeSessionReplay,\n SessionReplayOptions,\n sessionReplayPlugin,\n SessionReplayPlugin,\n} from '@amplitude/plugin-session-replay-browser';\nimport {\n IExperimentClient,\n ExperimentPluginConfig,\n ExperimentPlugin,\n experimentPlugin,\n} from '@amplitude/plugin-experiment-browser';\nimport { InitOptions, plugin as EngagementPlugin } from '@amplitude/engagement-browser';\nimport { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';\nimport { libraryPlugin } from './library';\n\nexport interface UnifiedSharedOptions {\n serverZone?: 'US' | 'EU';\n instanceName?: string;\n}\n\nexport type UnifiedOptions = UnifiedSharedOptions & {\n /**\n * Analytics Browser SDK configuration options.\n * See {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk | Configure the SDK}.\n */\n analytics?: BrowserOptions;\n sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n engagement?: Omit<InitOptions, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sessionReplay(): AmplitudeSessionReplay | undefined;\n experiment(): IExperimentClient | undefined;\n}\n\nexport class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {\n private _sessionReplay?: AmplitudeSessionReplay;\n private _initAllPromise?: Promise<void>;\n\n /**\n * Returns the Session Replay client after initAll() has completed, or undefined before initialization or when the\n * Session Replay plugin is unavailable.\n */\n sessionReplay(): AmplitudeSessionReplay | undefined {\n return this._sessionReplay;\n }\n\n experiment(): IExperimentClient | undefined {\n // Return when init() or initAll() is not called\n if (this.config === undefined) {\n return undefined;\n }\n\n const expPlugins = this.plugins(ExperimentPlugin);\n if (expPlugins.length === 0) {\n this.config.loggerProvider.debug(`${ExperimentPlugin.pluginName} plugin is not found.`);\n return undefined;\n } else if (expPlugins.length === 1) {\n return expPlugins[0].experiment;\n } else {\n this.config.loggerProvider.debug(`Multiple instances of ${ExperimentPlugin.pluginName} are found.`);\n return undefined;\n }\n }\n\n /**\n * Initialize SDKs with configuration options.\n *\n * @param apiKey Amplitude API key.\n * @param unifiedOptions Shared and SDK-specific configuration options. `unifiedOptions.analytics` configures the\n * Analytics Browser SDK.\n */\n async initAll(apiKey: string, unifiedOptions?: UnifiedOptions) {\n if (this._initAllPromise) {\n return this._initAllPromise;\n }\n\n this._initAllPromise = (async () => {\n const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n super.add(libraryPlugin());\n\n await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n\n await super.add(sessionReplayPlugin({ ...unifiedOptions?.sessionReplay, ...sharedOptions })).promise;\n\n await super.add(experimentPlugin({ ...unifiedOptions?.experiment, ...sharedOptions })).promise;\n\n const srPlugin = this.plugin(SessionReplayPlugin.pluginName);\n if (srPlugin === undefined) {\n this.config.loggerProvider.debug(`${SessionReplayPlugin.pluginName} plugin is not found.`);\n } else {\n this._sessionReplay = (srPlugin as SessionReplayPlugin).sessionReplay;\n }\n\n await super.add(\n EngagementPlugin({\n ...unifiedOptions?.engagement,\n ...sharedOptions,\n }),\n ).promise;\n })().finally(() => {\n this._initAllPromise = undefined;\n });\n\n return this._initAllPromise;\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.1.32";
1
+ export declare const VERSION = "1.1.33";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Autogenerated by `pnpm version-file`. DO NOT EDIT
2
- export var VERSION = '1.1.32';
2
+ export var VERSION = '1.1.33';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.1.32';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,IAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Autogenerated by `pnpm version-file`. DO NOT EDIT\nexport const VERSION = '1.1.33';\n"]}