@amplitude/unified 1.0.0-beta.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.
@@ -0,0 +1,4 @@
1
+ export { createInstance } from './unified-client-factory';
2
+ export declare const initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: import("@amplitude/experiment-js-client").Client, sr: import("@amplitude/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, 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>, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportType) => 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 { Types } from '@amplitude/analytics-browser';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,eAAO,MACL,OAAO,sGACP,UAAU,oDACV,EAAE,sEACF,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,SAAS,6BACT,YAAY,+BACZ,YAAY,0EACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Types = exports.track = exports.setUserId = exports.setTransport = exports.setSessionId = exports.setOptOut = exports.setGroup = exports.setDeviceId = exports.revenue = exports.reset = exports.remove = exports.logEvent = exports.identify = exports.groupIdentify = exports.getUserId = exports.getSessionId = exports.getDeviceId = exports.flush = exports.extendSession = exports.add = exports.sr = exports.experiment = exports.initAll = exports.createInstance = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var unified_client_factory_1 = tslib_1.__importDefault(require("./unified-client-factory"));
6
+ var unified_client_factory_2 = require("./unified-client-factory");
7
+ Object.defineProperty(exports, "createInstance", { enumerable: true, get: function () { return unified_client_factory_2.createInstance; } });
8
+ // eslint-disable-next-line @typescript-eslint/unbound-method
9
+ exports.initAll = unified_client_factory_1.default.initAll, exports.experiment = unified_client_factory_1.default.experiment, exports.sr = unified_client_factory_1.default.sr, exports.add = unified_client_factory_1.default.add, exports.extendSession = unified_client_factory_1.default.extendSession, exports.flush = unified_client_factory_1.default.flush, exports.getDeviceId = unified_client_factory_1.default.getDeviceId, exports.getSessionId = unified_client_factory_1.default.getSessionId, exports.getUserId = unified_client_factory_1.default.getUserId, exports.groupIdentify = unified_client_factory_1.default.groupIdentify, exports.identify = unified_client_factory_1.default.identify, exports.logEvent = unified_client_factory_1.default.logEvent, exports.remove = unified_client_factory_1.default.remove, exports.reset = unified_client_factory_1.default.reset, exports.revenue = unified_client_factory_1.default.revenue, exports.setDeviceId = unified_client_factory_1.default.setDeviceId, exports.setGroup = unified_client_factory_1.default.setGroup, exports.setOptOut = unified_client_factory_1.default.setOptOut, exports.setSessionId = unified_client_factory_1.default.setSessionId, exports.setTransport = unified_client_factory_1.default.setTransport, exports.setUserId = unified_client_factory_1.default.setUserId, exports.track = unified_client_factory_1.default.track;
10
+ var analytics_browser_1 = require("@amplitude/analytics-browser");
11
+ Object.defineProperty(exports, "Types", { enumerable: true, get: function () { return analytics_browser_1.Types; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,4FAA8C;AAC9C,mEAA0D;AAAjD,wHAAA,cAAc,OAAA;AACvB,6DAA6D;AAE3D,QAAA,OAAO,GAsBL,gCAAM,UArBR,QAAA,UAAU,GAqBR,gCAAM,aApBR,QAAA,EAAE,GAoBA,gCAAM,KAnBR,QAAA,GAAG,GAmBD,gCAAM,MAlBR,QAAA,aAAa,GAkBX,gCAAM,gBAjBR,QAAA,KAAK,GAiBH,gCAAM,QAhBR,QAAA,WAAW,GAgBT,gCAAM,cAfR,QAAA,YAAY,GAeV,gCAAM,eAdR,QAAA,SAAS,GAcP,gCAAM,YAbR,QAAA,aAAa,GAaX,gCAAM,gBAZR,QAAA,QAAQ,GAYN,gCAAM,WAXR,QAAA,QAAQ,GAWN,gCAAM,WAVR,QAAA,MAAM,GAUJ,gCAAM,SATR,QAAA,KAAK,GASH,gCAAM,QARR,QAAA,OAAO,GAQL,gCAAM,UAPR,QAAA,WAAW,GAOT,gCAAM,cANR,QAAA,QAAQ,GAMN,gCAAM,WALR,QAAA,SAAS,GAKP,gCAAM,YAJR,QAAA,YAAY,GAIV,gCAAM,eAHR,QAAA,YAAY,GAGV,gCAAM,eAFR,QAAA,SAAS,GAEP,gCAAM,YADR,QAAA,KAAK,GACH,gCAAM,OAAC;AACX,kEAAqD;AAA5C,0GAAA,KAAK,OAAA","sourcesContent":["import client from './unified-client-factory';\nexport { createInstance } from './unified-client-factory';\n// eslint-disable-next-line @typescript-eslint/unbound-method\nexport const {\n initAll,\n experiment,\n sr,\n add,\n extendSession,\n flush,\n getDeviceId,\n getSessionId,\n getUserId,\n groupIdentify,\n identify,\n logEvent,\n remove,\n reset,\n revenue,\n setDeviceId,\n setGroup,\n setOptOut,\n setSessionId,\n setTransport,\n setUserId,\n track,\n} = client;\nexport { Types } from '@amplitude/analytics-browser';\n"]}
@@ -0,0 +1,5 @@
1
+ import { UnifiedClient } from './unified';
2
+ export declare const createInstance: () => UnifiedClient;
3
+ declare const _default: UnifiedClient;
4
+ export default _default;
5
+ //# sourceMappingURL=unified-client-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-client-factory.d.ts","sourceRoot":"","sources":["../../src/unified-client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,WAAW,CAAC;AAG5D,eAAO,MAAM,cAAc,QAAO,aAoIjC,CAAC;;AAEF,wBAAgC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInstance = void 0;
4
+ var unified_1 = require("./unified");
5
+ var analytics_core_1 = require("@amplitude/analytics-core");
6
+ var createInstance = function () {
7
+ var client = new unified_1.AmplitudeUnified();
8
+ return {
9
+ experiment: client.experiment,
10
+ sr: client.sr,
11
+ initAll: (0, analytics_core_1.debugWrapper)(client.initAll.bind(client), 'initAll', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
12
+ init: (0, analytics_core_1.debugWrapper)(client.init.bind(client), 'init', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
13
+ add: (0, analytics_core_1.debugWrapper)(client.add.bind(client), 'add', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.plugins'])),
14
+ remove: (0, analytics_core_1.debugWrapper)(client.remove.bind(client), 'remove', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.plugins'])),
15
+ track: (0, analytics_core_1.debugWrapper)(client.track.bind(client), 'track', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
16
+ logEvent: (0, analytics_core_1.debugWrapper)(client.logEvent.bind(client), 'logEvent', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
17
+ identify: (0, analytics_core_1.debugWrapper)(client.identify.bind(client), 'identify', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
18
+ groupIdentify: (0, analytics_core_1.debugWrapper)(client.groupIdentify.bind(client), 'groupIdentify', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
19
+ setGroup: (0, analytics_core_1.debugWrapper)(client.setGroup.bind(client), 'setGroup', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
20
+ revenue: (0, analytics_core_1.debugWrapper)(client.revenue.bind(client), 'revenue', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
21
+ flush: (0, analytics_core_1.debugWrapper)(client.flush.bind(client), 'flush', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])),
22
+ getUserId: (0, analytics_core_1.debugWrapper)(client.getUserId.bind(client), 'getUserId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config', 'config.userId'])),
23
+ setUserId: (0, analytics_core_1.debugWrapper)(client.setUserId.bind(client), 'setUserId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config', 'config.userId'])),
24
+ getDeviceId: (0, analytics_core_1.debugWrapper)(client.getDeviceId.bind(client), 'getDeviceId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config', 'config.deviceId'])),
25
+ setDeviceId: (0, analytics_core_1.debugWrapper)(client.setDeviceId.bind(client), 'setDeviceId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config', 'config.deviceId'])),
26
+ reset: (0, analytics_core_1.debugWrapper)(client.reset.bind(client), 'reset', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config', 'config.userId', 'config.deviceId'])),
27
+ getSessionId: (0, analytics_core_1.debugWrapper)(client.getSessionId.bind(client), 'getSessionId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
28
+ setSessionId: (0, analytics_core_1.debugWrapper)(client.setSessionId.bind(client), 'setSessionId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
29
+ extendSession: (0, analytics_core_1.debugWrapper)(client.extendSession.bind(client), 'extendSession', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
30
+ setOptOut: (0, analytics_core_1.debugWrapper)(client.setOptOut.bind(client), 'setOptOut', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
31
+ setTransport: (0, analytics_core_1.debugWrapper)(client.setTransport.bind(client), 'setTransport', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
32
+ };
33
+ };
34
+ exports.createInstance = createInstance;
35
+ exports.default = (0, exports.createInstance)();
36
+ //# sourceMappingURL=unified-client-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-client-factory.js","sourceRoot":"","sources":["../../src/unified-client-factory.ts"],"names":[],"mappings":";;;AAAA,qCAA4D;AAC5D,4DAA8F;AAEvF,IAAM,cAAc,GAAG;IAC5B,IAAM,MAAM,GAAG,IAAI,0BAAgB,EAAE,CAAC;IACtC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,OAAO,EAAE,IAAA,6BAAY,EACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3B,SAAS,EACT,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,IAAI,EAAE,IAAA,6BAAY,EAChB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EACxB,MAAM,EACN,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,GAAG,EAAE,IAAA,6BAAY,EACf,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EACvB,KAAK,EACL,IAAA,mCAAk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C,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,YAAY,EAAE,IAAA,6BAAY,EACxB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAChC,cAAc,EACd,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;KACF,CAAC;AACJ,CAAC,CAAC;AApIW,QAAA,cAAc,kBAoIzB;AAEF,kBAAe,IAAA,sBAAc,GAAE,CAAC","sourcesContent":["import { AmplitudeUnified, UnifiedClient } from './unified';\nimport { debugWrapper, getClientLogConfig, getClientStates } from '@amplitude/analytics-core';\n\nexport const createInstance = (): UnifiedClient => {\n const client = new AmplitudeUnified();\n return {\n experiment: client.experiment,\n sr: client.sr,\n initAll: debugWrapper(\n client.initAll.bind(client),\n 'initAll',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n init: debugWrapper(\n client.init.bind(client),\n 'init',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n add: debugWrapper(\n client.add.bind(client),\n 'add',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n remove: debugWrapper(\n client.remove.bind(client),\n 'remove',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n track: debugWrapper(\n client.track.bind(client),\n 'track',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n logEvent: debugWrapper(\n client.logEvent.bind(client),\n 'logEvent',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n identify: debugWrapper(\n client.identify.bind(client),\n 'identify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n groupIdentify: debugWrapper(\n client.groupIdentify.bind(client),\n 'groupIdentify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n setGroup: debugWrapper(\n client.setGroup.bind(client),\n 'setGroup',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n revenue: debugWrapper(\n client.revenue.bind(client),\n 'revenue',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n flush: debugWrapper(\n client.flush.bind(client),\n 'flush',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n getUserId: debugWrapper(\n client.getUserId.bind(client),\n 'getUserId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.userId']),\n ),\n setUserId: debugWrapper(\n client.setUserId.bind(client),\n 'setUserId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.userId']),\n ),\n getDeviceId: debugWrapper(\n client.getDeviceId.bind(client),\n 'getDeviceId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.deviceId']),\n ),\n setDeviceId: debugWrapper(\n client.setDeviceId.bind(client),\n 'setDeviceId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.deviceId']),\n ),\n reset: debugWrapper(\n client.reset.bind(client),\n 'reset',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.userId', 'config.deviceId']),\n ),\n getSessionId: debugWrapper(\n client.getSessionId.bind(client),\n 'getSessionId',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n setSessionId: debugWrapper(\n client.setSessionId.bind(client),\n 'setSessionId',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n extendSession: debugWrapper(\n client.extendSession.bind(client),\n 'extendSession',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n setOptOut: debugWrapper(\n client.setOptOut.bind(client),\n 'setOptOut',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n setTransport: debugWrapper(\n client.setTransport.bind(client),\n 'setTransport',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n };\n};\n\nexport default createInstance();\n"]}
@@ -0,0 +1,38 @@
1
+ import { AmplitudeBrowser } from '@amplitude/analytics-browser';
2
+ import { AmplitudeSessionReplay, SessionReplayOptions } from '@amplitude/plugin-session-replay-browser';
3
+ import { IExperimentClient, ExperimentConfig } from '@amplitude/plugin-experiment-browser';
4
+ import { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';
5
+ export interface UnifiedSharedOptions {
6
+ serverZone?: 'US' | 'EU';
7
+ instanceName?: string;
8
+ }
9
+ export type UnifiedOptions = UnifiedSharedOptions & {
10
+ analytics?: BrowserOptions;
11
+ sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions> | boolean;
12
+ experiment?: Omit<ExperimentConfig, keyof UnifiedSharedOptions> | boolean;
13
+ };
14
+ export interface UnifiedClient extends BrowserClient {
15
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
16
+ sr: AmplitudeSessionReplay;
17
+ experiment: IExperimentClient;
18
+ }
19
+ export declare class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {
20
+ experiment: IExperimentClient;
21
+ sr: AmplitudeSessionReplay;
22
+ /**
23
+ * Initialize SDKs with configuration options.
24
+ * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.
25
+ *
26
+ * For example, the serverZone will be 'EU' for all SDKs.
27
+ * ```
28
+ * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});
29
+ * ```
30
+ *
31
+ * @param apiKey Amplitude API key.
32
+ * @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.
33
+ * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
34
+ */
35
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
36
+ init(apiKey?: string, userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
37
+ }
38
+ //# sour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AG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;CAO3F"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AmplitudeUnified = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var analytics_browser_1 = require("@amplitude/analytics-browser");
6
+ var plugin_session_replay_browser_1 = require("@amplitude/plugin-session-replay-browser");
7
+ var plugin_experiment_browser_1 = require("@amplitude/plugin-experiment-browser");
8
+ var AmplitudeUnified = /** @class */ (function (_super) {
9
+ tslib_1.__extends(AmplitudeUnified, _super);
10
+ function AmplitudeUnified() {
11
+ return _super !== null && _super.apply(this, arguments) || this;
12
+ }
13
+ /**
14
+ * Initialize SDKs with configuration options.
15
+ * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.
16
+ *
17
+ * For example, the serverZone will be 'EU' for all SDKs.
18
+ * ```
19
+ * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});
20
+ * ```
21
+ *
22
+ * @param apiKey Amplitude API key.
23
+ * @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.
24
+ * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
25
+ */
26
+ AmplitudeUnified.prototype.initAll = function (apiKey, unifiedOptions) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
28
+ var sharedOptions, srPlugin, expPlugin;
29
+ return tslib_1.__generator(this, function (_a) {
30
+ switch (_a.label) {
31
+ case 0:
32
+ sharedOptions = {
33
+ serverZone: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.serverZone,
34
+ instanceName: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.instanceName,
35
+ };
36
+ return [4 /*yield*/, _super.prototype.init.call(this, apiKey, tslib_1.__assign(tslib_1.__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.analytics), sharedOptions)).promise];
37
+ case 1:
38
+ _a.sent();
39
+ if (!!(unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr)) return [3 /*break*/, 3];
40
+ return [4 /*yield*/, _super.prototype.add.call(this, (0, plugin_session_replay_browser_1.sessionReplayPlugin)(tslib_1.__assign(tslib_1.__assign({}, (typeof (unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr) === 'boolean' ? {} : unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr)), sharedOptions))).promise];
41
+ case 2:
42
+ _a.sent();
43
+ _a.label = 3;
44
+ case 3: return [4 /*yield*/, _super.prototype.add.call(this, (0, plugin_experiment_browser_1.experimentPlugin)(tslib_1.__assign(tslib_1.__assign({}, (typeof (unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.experiment) === 'boolean' ? {} : unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.experiment)), sharedOptions))).promise];
45
+ case 4:
46
+ _a.sent();
47
+ srPlugin = _super.prototype.plugin.call(this, plugin_session_replay_browser_1.SessionReplayPlugin.pluginName);
48
+ if (srPlugin === undefined) {
49
+ this.config.loggerProvider.debug('SR plugin is not found.');
50
+ }
51
+ else {
52
+ this.sr = srPlugin.sr;
53
+ }
54
+ expPlugin = _super.prototype.plugin.call(this, plugin_experiment_browser_1.ExperimentPlugin.pluginName);
55
+ if (expPlugin === undefined) {
56
+ this.config.loggerProvider.debug('Experiment plugin is not found.');
57
+ }
58
+ else {
59
+ this.experiment = expPlugin.experiment;
60
+ }
61
+ return [2 /*return*/];
62
+ }
63
+ });
64
+ });
65
+ };
66
+ AmplitudeUnified.prototype.init = function (apiKey, userIdOrOptions, maybeOptions) {
67
+ if (apiKey === void 0) { apiKey = ''; }
68
+ var res = _super.prototype.init.call(this, apiKey, userIdOrOptions, maybeOptions);
69
+ this.config.loggerProvider.debug('Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.');
70
+ return res;
71
+ };
72
+ return AmplitudeUnified;
73
+ }(analytics_browser_1.AmplitudeBrowser));
74
+ exports.AmplitudeUnified = AmplitudeUnified;
75
+ //# sourceMappingURL=unified.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";;;;AAAA,kEAAgE;AAChE,0FAKkD;AAClD,kFAK8C;AAoB9C;IAAsC,4CAAgB;IAAtD;;IAkEA,CAAC;IA1DC;;;;;;;;;;;;OAYG;IACG,kCAAO,GAAb,UAAc,MAAc,EAAE,cAA+B;;;;;;wBACrD,aAAa,GAAG;4BACpB,UAAU,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU;4BACtC,YAAY,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY;yBAC3C,CAAC;wBAEF,qBAAM,iBAAM,IAAI,YAAC,MAAM,wCAAO,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,SAAS,GAAK,aAAa,EAAG,CAAC,OAAO,EAAA;;wBAApF,SAAoF,CAAC;6BAEjF,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,EAAE,CAAA,EAAnB,wBAAmB;wBACrB,qBAAM,iBAAM,GAAG,YACb,IAAA,mDAAmB,wCACd,CAAC,OAAO,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,EAAE,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,EAAE,CAAC,GACnE,aAAa,EAChB,CACH,CAAC,OAAO,EAAA;;wBALT,SAKS,CAAC;;4BAEZ,qBAAM,iBAAM,GAAG,YACb,IAAA,4CAAgB,wCACX,CAAC,OAAO,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,CAAC,GACnF,aAAa,EAChB,CACH,CAAC,OAAO,EAAA;;wBALT,SAKS,CAAC;wBAEJ,QAAQ,GAAG,iBAAM,MAAM,YAAC,mDAAmB,CAAC,UAAU,CAAC,CAAC;wBAC9D,IAAI,QAAQ,KAAK,SAAS,EAAE;4BAC1B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;yBAC7D;6BAAM;4BACL,IAAI,CAAC,EAAE,GAAI,QAAgC,CAAC,EAAE,CAAC;yBAChD;wBAEK,SAAS,GAAG,iBAAM,MAAM,YAAC,4CAAgB,CAAC,UAAU,CAAC,CAAC;wBAC5D,IAAI,SAAS,KAAK,SAAS,EAAE;4BAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;yBACrE;6BAAM;4BACL,IAAI,CAAC,UAAU,GAAI,SAA8B,CAAC,UAAU,CAAC;yBAC9D;;;;;KACF;IAED,+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,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAC9B,wFAAwF,CACzF,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;IACH,uBAAC;AAAD,CAAC,AAlED,CAAsC,oCAAgB,GAkErD;AAlEY,4CAAgB","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 ExperimentConfig,\n ExperimentPlugin,\n experimentPlugin,\n} from '@amplitude/plugin-experiment-browser';\nimport { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';\n\nexport interface UnifiedSharedOptions {\n serverZone?: 'US' | 'EU';\n instanceName?: string;\n}\n\nexport type UnifiedOptions = UnifiedSharedOptions & {\n analytics?: BrowserOptions;\n sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions> | boolean;\n experiment?: Omit<ExperimentConfig, keyof UnifiedSharedOptions> | boolean;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sr: AmplitudeSessionReplay;\n experiment: IExperimentClient;\n}\n\nexport class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n experiment: IExperimentClient;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n sr: AmplitudeSessionReplay;\n\n /**\n * Initialize SDKs with configuration options.\n * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.\n *\n * For example, the serverZone will be 'EU' for all SDKs.\n * ```\n * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});\n * ```\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 const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n\n if (!unifiedOptions?.sr) {\n await super.add(\n sessionReplayPlugin({\n ...(typeof unifiedOptions?.sr === 'boolean' ? {} : unifiedOptions?.sr),\n ...sharedOptions,\n }),\n ).promise;\n }\n await super.add(\n experimentPlugin({\n ...(typeof unifiedOptions?.experiment === 'boolean' ? {} : unifiedOptions?.experiment),\n ...sharedOptions,\n }),\n ).promise;\n\n const srPlugin = super.plugin(SessionReplayPlugin.pluginName);\n if (srPlugin === undefined) {\n this.config.loggerProvider.debug('SR plugin is not found.');\n } else {\n this.sr = (srPlugin as SessionReplayPlugin).sr;\n }\n\n const expPlugin = super.plugin(ExperimentPlugin.pluginName);\n if (expPlugin === undefined) {\n this.config.loggerProvider.debug('Experiment plugin is not found.');\n } else {\n this.experiment = (expPlugin as ExperimentPlugin).experiment;\n }\n }\n\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n this.config.loggerProvider.debug(\n 'Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.',\n );\n return res;\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { createInstance } from './unified-client-factory';
2
+ export declare const initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: import("@amplitude/experiment-js-client").Client, sr: import("@amplitude/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, 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>, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportType) => 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 { Types } from '@amplitude/analytics-browser';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,eAAO,MACL,OAAO,sGACP,UAAU,oDACV,EAAE,sEACF,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,SAAS,6BACT,YAAY,+BACZ,YAAY,0EACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import client from './unified-client-factory';
2
+ export { createInstance } from './unified-client-factory';
3
+ // eslint-disable-next-line @typescript-eslint/unbound-method
4
+ export var initAll = client.initAll, experiment = client.experiment, sr = client.sr, add = client.add, extendSession = client.extendSession, flush = client.flush, getDeviceId = client.getDeviceId, getSessionId = client.getSessionId, getUserId = client.getUserId, groupIdentify = client.groupIdentify, identify = client.identify, logEvent = client.logEvent, remove = client.remove, reset = client.reset, revenue = client.revenue, setDeviceId = client.setDeviceId, setGroup = client.setGroup, setOptOut = client.setOptOut, setSessionId = client.setSessionId, setTransport = client.setTransport, setUserId = client.setUserId, track = client.track;
5
+ export { Types } from '@amplitude/analytics-browser';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,6DAA6D;AAC7D,MAAM,CACJ,IAAA,OAAO,GAsBL,MAAM,QAtBD,EACP,UAAU,GAqBR,MAAM,WArBE,EACV,EAAE,GAoBA,MAAM,GApBN,EACF,GAAG,GAmBD,MAAM,IAnBL,EACH,aAAa,GAkBX,MAAM,cAlBK,EACb,KAAK,GAiBH,MAAM,MAjBH,EACL,WAAW,GAgBT,MAAM,YAhBG,EACX,YAAY,GAeV,MAAM,aAfI,EACZ,SAAS,GAcP,MAAM,UAdC,EACT,aAAa,GAaX,MAAM,cAbK,EACb,QAAQ,GAYN,MAAM,SAZA,EACR,QAAQ,GAWN,MAAM,SAXA,EACR,MAAM,GAUJ,MAAM,OAVF,EACN,KAAK,GASH,MAAM,MATH,EACL,OAAO,GAQL,MAAM,QARD,EACP,WAAW,GAOT,MAAM,YAPG,EACX,QAAQ,GAMN,MAAM,SANA,EACR,SAAS,GAKP,MAAM,UALC,EACT,YAAY,GAIV,MAAM,aAJI,EACZ,YAAY,GAGV,MAAM,aAHI,EACZ,SAAS,GAEP,MAAM,UAFC,EACT,KAAK,GACH,MAAM,MADH,CACI;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["import client from './unified-client-factory';\nexport { createInstance } from './unified-client-factory';\n// eslint-disable-next-line @typescript-eslint/unbound-method\nexport const {\n initAll,\n experiment,\n sr,\n add,\n extendSession,\n flush,\n getDeviceId,\n getSessionId,\n getUserId,\n groupIdentify,\n identify,\n logEvent,\n remove,\n reset,\n revenue,\n setDeviceId,\n setGroup,\n setOptOut,\n setSessionId,\n setTransport,\n setUserId,\n track,\n} = client;\nexport { Types } from '@amplitude/analytics-browser';\n"]}
@@ -0,0 +1,5 @@
1
+ import { UnifiedClient } from './unified';
2
+ export declare const createInstance: () => UnifiedClient;
3
+ declare const _default: UnifiedClient;
4
+ export default _default;
5
+ //# sourceMappingURL=unified-client-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-client-factory.d.ts","sourceRoot":"","sources":["../../src/unified-client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,WAAW,CAAC;AAG5D,eAAO,MAAM,cAAc,QAAO,aAoIjC,CAAC;;AAEF,wBAAgC"}
@@ -0,0 +1,32 @@
1
+ import { AmplitudeUnified } from './unified';
2
+ import { debugWrapper, getClientLogConfig, getClientStates } from '@amplitude/analytics-core';
3
+ export var createInstance = function () {
4
+ var client = new AmplitudeUnified();
5
+ return {
6
+ experiment: client.experiment,
7
+ sr: client.sr,
8
+ initAll: debugWrapper(client.initAll.bind(client), 'initAll', getClientLogConfig(client), getClientStates(client, ['config'])),
9
+ init: debugWrapper(client.init.bind(client), 'init', getClientLogConfig(client), getClientStates(client, ['config'])),
10
+ add: debugWrapper(client.add.bind(client), 'add', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
11
+ remove: debugWrapper(client.remove.bind(client), 'remove', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
12
+ track: debugWrapper(client.track.bind(client), 'track', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
13
+ logEvent: debugWrapper(client.logEvent.bind(client), 'logEvent', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
14
+ identify: debugWrapper(client.identify.bind(client), 'identify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
15
+ groupIdentify: debugWrapper(client.groupIdentify.bind(client), 'groupIdentify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
16
+ setGroup: debugWrapper(client.setGroup.bind(client), 'setGroup', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
17
+ revenue: debugWrapper(client.revenue.bind(client), 'revenue', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
18
+ flush: debugWrapper(client.flush.bind(client), 'flush', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
19
+ getUserId: debugWrapper(client.getUserId.bind(client), 'getUserId', getClientLogConfig(client), getClientStates(client, ['config', 'config.userId'])),
20
+ setUserId: debugWrapper(client.setUserId.bind(client), 'setUserId', getClientLogConfig(client), getClientStates(client, ['config', 'config.userId'])),
21
+ getDeviceId: debugWrapper(client.getDeviceId.bind(client), 'getDeviceId', getClientLogConfig(client), getClientStates(client, ['config', 'config.deviceId'])),
22
+ setDeviceId: debugWrapper(client.setDeviceId.bind(client), 'setDeviceId', getClientLogConfig(client), getClientStates(client, ['config', 'config.deviceId'])),
23
+ reset: debugWrapper(client.reset.bind(client), 'reset', getClientLogConfig(client), getClientStates(client, ['config', 'config.userId', 'config.deviceId'])),
24
+ getSessionId: debugWrapper(client.getSessionId.bind(client), 'getSessionId', getClientLogConfig(client), getClientStates(client, ['config'])),
25
+ setSessionId: debugWrapper(client.setSessionId.bind(client), 'setSessionId', getClientLogConfig(client), getClientStates(client, ['config'])),
26
+ extendSession: debugWrapper(client.extendSession.bind(client), 'extendSession', getClientLogConfig(client), getClientStates(client, ['config'])),
27
+ setOptOut: debugWrapper(client.setOptOut.bind(client), 'setOptOut', getClientLogConfig(client), getClientStates(client, ['config'])),
28
+ setTransport: debugWrapper(client.setTransport.bind(client), 'setTransport', getClientLogConfig(client), getClientStates(client, ['config'])),
29
+ };
30
+ };
31
+ export default createInstance();
32
+ //# sourceMappingURL=unified-client-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-client-factory.js","sourceRoot":"","sources":["../../src/unified-client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiB,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE9F,MAAM,CAAC,IAAM,cAAc,GAAG;IAC5B,IAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACtC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,OAAO,EAAE,YAAY,CACnB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3B,SAAS,EACT,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,IAAI,EAAE,YAAY,CAChB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EACxB,MAAM,EACN,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,GAAG,EAAE,YAAY,CACf,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EACvB,KAAK,EACL,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAC/D;QACD,MAAM,EAAE,YAAY,CAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MA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QAAQ,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,CACxE;QACD,YAAY,EAAE,YAAY,CACxB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAChC,cAAc,EACd,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,YAAY,EAAE,YAAY,CACxB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAChC,cAAc,EACd,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,aAAa,EAAE,YAAY,CACzB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EACjC,eAAe,EACf,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,SAAS,EAAE,YAAY,CACrB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAC7B,WAAW,EACX,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,YAAY,EAAE,YAAY,CACxB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAChC,cAAc,EACd,kBAAkB,CAAC,MAAM,CAAC,EAC1B,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,EAAE,CAAC","sourcesContent":["import { AmplitudeUnified, UnifiedClient } from './unified';\nimport { debugWrapper, getClientLogConfig, getClientStates } from '@amplitude/analytics-core';\n\nexport const createInstance = (): UnifiedClient => {\n const client = new AmplitudeUnified();\n return {\n experiment: client.experiment,\n sr: client.sr,\n initAll: debugWrapper(\n client.initAll.bind(client),\n 'initAll',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n init: debugWrapper(\n client.init.bind(client),\n 'init',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n add: debugWrapper(\n client.add.bind(client),\n 'add',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n remove: debugWrapper(\n client.remove.bind(client),\n 'remove',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.plugins']),\n ),\n track: debugWrapper(\n client.track.bind(client),\n 'track',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n logEvent: debugWrapper(\n client.logEvent.bind(client),\n 'logEvent',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n identify: debugWrapper(\n client.identify.bind(client),\n 'identify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n groupIdentify: debugWrapper(\n client.groupIdentify.bind(client),\n 'groupIdentify',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n setGroup: debugWrapper(\n client.setGroup.bind(client),\n 'setGroup',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n revenue: debugWrapper(\n client.revenue.bind(client),\n 'revenue',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n flush: debugWrapper(\n client.flush.bind(client),\n 'flush',\n getClientLogConfig(client),\n getClientStates(client, ['config.apiKey', 'timeline.queue.length']),\n ),\n getUserId: debugWrapper(\n client.getUserId.bind(client),\n 'getUserId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.userId']),\n ),\n setUserId: debugWrapper(\n client.setUserId.bind(client),\n 'setUserId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.userId']),\n ),\n getDeviceId: debugWrapper(\n client.getDeviceId.bind(client),\n 'getDeviceId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.deviceId']),\n ),\n setDeviceId: debugWrapper(\n client.setDeviceId.bind(client),\n 'setDeviceId',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.deviceId']),\n ),\n reset: debugWrapper(\n client.reset.bind(client),\n 'reset',\n getClientLogConfig(client),\n getClientStates(client, ['config', 'config.userId', 'config.deviceId']),\n ),\n getSessionId: debugWrapper(\n client.getSessionId.bind(client),\n 'getSessionId',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n setSessionId: debugWrapper(\n client.setSessionId.bind(client),\n 'setSessionId',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n extendSession: debugWrapper(\n client.extendSession.bind(client),\n 'extendSession',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n setOptOut: debugWrapper(\n client.setOptOut.bind(client),\n 'setOptOut',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n setTransport: debugWrapper(\n client.setTransport.bind(client),\n 'setTransport',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n };\n};\n\nexport default createInstance();\n"]}
@@ -0,0 +1,38 @@
1
+ import { AmplitudeBrowser } from '@amplitude/analytics-browser';
2
+ import { AmplitudeSessionReplay, SessionReplayOptions } from '@amplitude/plugin-session-replay-browser';
3
+ import { IExperimentClient, ExperimentConfig } from '@amplitude/plugin-experiment-browser';
4
+ import { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';
5
+ export interface UnifiedSharedOptions {
6
+ serverZone?: 'US' | 'EU';
7
+ instanceName?: string;
8
+ }
9
+ export type UnifiedOptions = UnifiedSharedOptions & {
10
+ analytics?: BrowserOptions;
11
+ sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions> | boolean;
12
+ experiment?: Omit<ExperimentConfig, keyof UnifiedSharedOptions> | boolean;
13
+ };
14
+ export interface UnifiedClient extends BrowserClient {
15
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
16
+ sr: AmplitudeSessionReplay;
17
+ experiment: IExperimentClient;
18
+ }
19
+ export declare class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {
20
+ experiment: IExperimentClient;
21
+ sr: AmplitudeSessionReplay;
22
+ /**
23
+ * Initialize SDKs with configuration options.
24
+ * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.
25
+ *
26
+ * For example, the serverZone will be 'EU' for all SDKs.
27
+ * ```
28
+ * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});
29
+ * ```
30
+ *
31
+ * @param apiKey Amplitude API key.
32
+ * @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.
33
+ * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
34
+ */
35
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
36
+ init(apiKey?: string, userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
37
+ }
38
+ //# sourceMappingURL=unified.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EAGrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE1E,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG;IAClD,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,EAAE,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC,GAAG,OAAO,CAAC;IACtE,UAAU,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,oBAAoB,CAAC,GAAG,OAAO,CAAC;CAC3E,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,EAAE,EAAE,sBAAsB,CAAC;IAC3B,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,aAAa;IAG7E,UAAU,EAAE,iBAAiB,CAAC;IAG9B,EAAE,EAAE,sBAAsB,CAAC;IAE3B;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc;IAsC7D,IAAI,CAAC,MAAM,SAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;CAO3F"}
@@ -0,0 +1,72 @@
1
+ import { __assign, __awaiter, __extends, __generator } from "tslib";
2
+ import { AmplitudeBrowser } from '@amplitude/analytics-browser';
3
+ import { sessionReplayPlugin, SessionReplayPlugin, } from '@amplitude/plugin-session-replay-browser';
4
+ import { ExperimentPlugin, experimentPlugin, } from '@amplitude/plugin-experiment-browser';
5
+ var AmplitudeUnified = /** @class */ (function (_super) {
6
+ __extends(AmplitudeUnified, _super);
7
+ function AmplitudeUnified() {
8
+ return _super !== null && _super.apply(this, arguments) || this;
9
+ }
10
+ /**
11
+ * Initialize SDKs with configuration options.
12
+ * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.
13
+ *
14
+ * For example, the serverZone will be 'EU' for all SDKs.
15
+ * ```
16
+ * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});
17
+ * ```
18
+ *
19
+ * @param apiKey Amplitude API key.
20
+ * @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.
21
+ * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
22
+ */
23
+ AmplitudeUnified.prototype.initAll = function (apiKey, unifiedOptions) {
24
+ return __awaiter(this, void 0, void 0, function () {
25
+ var sharedOptions, srPlugin, expPlugin;
26
+ return __generator(this, function (_a) {
27
+ switch (_a.label) {
28
+ case 0:
29
+ sharedOptions = {
30
+ serverZone: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.serverZone,
31
+ instanceName: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.instanceName,
32
+ };
33
+ return [4 /*yield*/, _super.prototype.init.call(this, apiKey, __assign(__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.analytics), sharedOptions)).promise];
34
+ case 1:
35
+ _a.sent();
36
+ if (!!(unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr)) return [3 /*break*/, 3];
37
+ return [4 /*yield*/, _super.prototype.add.call(this, sessionReplayPlugin(__assign(__assign({}, (typeof (unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr) === 'boolean' ? {} : unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr)), sharedOptions))).promise];
38
+ case 2:
39
+ _a.sent();
40
+ _a.label = 3;
41
+ case 3: return [4 /*yield*/, _super.prototype.add.call(this, experimentPlugin(__assign(__assign({}, (typeof (unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.experiment) === 'boolean' ? {} : unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.experiment)), sharedOptions))).promise];
42
+ case 4:
43
+ _a.sent();
44
+ srPlugin = _super.prototype.plugin.call(this, SessionReplayPlugin.pluginName);
45
+ if (srPlugin === undefined) {
46
+ this.config.loggerProvider.debug('SR plugin is not found.');
47
+ }
48
+ else {
49
+ this.sr = srPlugin.sr;
50
+ }
51
+ expPlugin = _super.prototype.plugin.call(this, ExperimentPlugin.pluginName);
52
+ if (expPlugin === undefined) {
53
+ this.config.loggerProvider.debug('Experiment plugin is not found.');
54
+ }
55
+ else {
56
+ this.experiment = expPlugin.experiment;
57
+ }
58
+ return [2 /*return*/];
59
+ }
60
+ });
61
+ });
62
+ };
63
+ AmplitudeUnified.prototype.init = function (apiKey, userIdOrOptions, maybeOptions) {
64
+ if (apiKey === void 0) { apiKey = ''; }
65
+ var res = _super.prototype.init.call(this, apiKey, userIdOrOptions, maybeOptions);
66
+ this.config.loggerProvider.debug('Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.');
67
+ return res;
68
+ };
69
+ return AmplitudeUnified;
70
+ }(AmplitudeBrowser));
71
+ export { AmplitudeUnified };
72
+ //# sourceMappingURL=unified.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAGL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sCAAsC,CAAC;AAoB9C;IAAsC,oCAAgB;IAAtD;;IAkEA,CAAC;IA1DC;;;;;;;;;;;;OAYG;IACG,kCAAO,GAAb,UAAc,MAAc,EAAE,cAA+B;;;;;;wBACrD,aAAa,GAAG;4BACpB,UAAU,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU;4BACtC,YAAY,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY;yBAC3C,CAAC;wBAEF,qBAAM,iBAAM,IAAI,YAAC,MAAM,wBAAO,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,SAAS,GAAK,aAAa,EAAG,CAAC,OAAO,EA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AAK,MAAW,EAAE,eAAyC,EAAE,YAA6B;QAArF,uBAAA,EAAA,WAAW;QACd,IAAM,GAAG,GAAG,iBAAM,IAAI,YAAC,MAAM,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAC9B,wFAAwF,CACzF,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;IACH,uBAAC;AAAD,CAAC,AAlED,CAAsC,gBAAgB,GAkErD","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 ExperimentConfig,\n ExperimentPlugin,\n experimentPlugin,\n} from '@amplitude/plugin-experiment-browser';\nimport { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';\n\nexport interface UnifiedSharedOptions {\n serverZone?: 'US' | 'EU';\n instanceName?: string;\n}\n\nexport type UnifiedOptions = UnifiedSharedOptions & {\n analytics?: BrowserOptions;\n sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions> | boolean;\n experiment?: Omit<ExperimentConfig, keyof UnifiedSharedOptions> | boolean;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sr: AmplitudeSessionReplay;\n experiment: IExperimentClient;\n}\n\nexport class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n experiment: IExperimentClient;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n sr: AmplitudeSessionReplay;\n\n /**\n * Initialize SDKs with configuration options.\n * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.\n *\n * For example, the serverZone will be 'EU' for all SDKs.\n * ```\n * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});\n * ```\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 const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n\n if (!unifiedOptions?.sr) {\n await super.add(\n sessionReplayPlugin({\n ...(typeof unifiedOptions?.sr === 'boolean' ? {} : unifiedOptions?.sr),\n ...sharedOptions,\n }),\n ).promise;\n }\n await super.add(\n experimentPlugin({\n ...(typeof unifiedOptions?.experiment === 'boolean' ? {} : unifiedOptions?.experiment),\n ...sharedOptions,\n }),\n ).promise;\n\n const srPlugin = super.plugin(SessionReplayPlugin.pluginName);\n if (srPlugin === undefined) {\n this.config.loggerProvider.debug('SR plugin is not found.');\n } else {\n this.sr = (srPlugin as SessionReplayPlugin).sr;\n }\n\n const expPlugin = super.plugin(ExperimentPlugin.pluginName);\n if (expPlugin === undefined) {\n this.config.loggerProvider.debug('Experiment plugin is not found.');\n } else {\n this.experiment = (expPlugin as ExperimentPlugin).experiment;\n }\n }\n\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n this.config.loggerProvider.debug(\n 'Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.',\n );\n return res;\n }\n}\n"]}