@amplitude/unified 1.0.0-AMP-140206-change-encoding-gtm-snippet-to-gz.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -0
  3. package/lib/cjs/index.d.ts +4 -0
  4. package/lib/cjs/index.d.ts.map +1 -0
  5. package/lib/cjs/index.js +14 -0
  6. package/lib/cjs/index.js.map +1 -0
  7. package/lib/cjs/library.d.ts +3 -0
  8. package/lib/cjs/library.d.ts.map +1 -0
  9. package/lib/cjs/library.js +23 -0
  10. package/lib/cjs/library.js.map +1 -0
  11. package/lib/cjs/unified-client-factory.d.ts +5 -0
  12. package/lib/cjs/unified-client-factory.d.ts.map +1 -0
  13. package/lib/cjs/unified-client-factory.js +39 -0
  14. package/lib/cjs/unified-client-factory.js.map +1 -0
  15. package/lib/cjs/unified.d.ts +38 -0
  16. package/lib/cjs/unified.d.ts.map +1 -0
  17. package/lib/cjs/unified.js +90 -0
  18. package/lib/cjs/unified.js.map +1 -0
  19. package/lib/cjs/version.d.ts +2 -0
  20. package/lib/cjs/version.d.ts.map +1 -0
  21. package/lib/cjs/version.js +6 -0
  22. package/lib/cjs/version.js.map +1 -0
  23. package/lib/esm/index.d.ts +4 -0
  24. package/lib/esm/index.d.ts.map +1 -0
  25. package/lib/esm/index.js +6 -0
  26. package/lib/esm/index.js.map +1 -0
  27. package/lib/esm/library.d.ts +3 -0
  28. package/lib/esm/library.d.ts.map +1 -0
  29. package/lib/esm/library.js +19 -0
  30. package/lib/esm/library.js.map +1 -0
  31. package/lib/esm/unified-client-factory.d.ts +5 -0
  32. package/lib/esm/unified-client-factory.d.ts.map +1 -0
  33. package/lib/esm/unified-client-factory.js +35 -0
  34. package/lib/esm/unified-client-factory.js.map +1 -0
  35. package/lib/esm/unified.d.ts +38 -0
  36. package/lib/esm/unified.d.ts.map +1 -0
  37. package/lib/esm/unified.js +87 -0
  38. package/lib/esm/unified.js.map +1 -0
  39. package/lib/esm/version.d.ts +2 -0
  40. package/lib/esm/version.d.ts.map +1 -0
  41. package/lib/esm/version.js +3 -0
  42. package/lib/esm/version.js.map +1 -0
  43. package/lib/scripts/amplitude-min.umd.js +1 -0
  44. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  45. package/lib/scripts/index.d.ts +4 -0
  46. package/lib/scripts/index.d.ts.map +1 -0
  47. package/lib/scripts/library.d.ts +3 -0
  48. package/lib/scripts/library.d.ts.map +1 -0
  49. package/lib/scripts/unified-client-factory.d.ts +5 -0
  50. package/lib/scripts/unified-client-factory.d.ts.map +1 -0
  51. package/lib/scripts/unified.d.ts +38 -0
  52. package/lib/scripts/unified.d.ts.map +1 -0
  53. package/lib/scripts/version.d.ts +2 -0
  54. package/lib/scripts/version.d.ts.map +1 -0
  55. package/package.json +60 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Amplitude Analytics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ <p align="center">
2
+ <a href="https://amplitude.com" target="_blank" align="center">
3
+ <img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
4
+ </a>
5
+ <br />
6
+ </p>
7
+
8
+ # @amplitude/unified
9
+
10
+ Official Amplitude SDK for Web analytics, experiment, session replay, Guides and Surveys, and more.
11
+
12
+ ## Installation
13
+
14
+ This package is published on NPM registry and is available to be installed using npm and yarn.
15
+
16
+ ```sh
17
+ # npm
18
+ npm install @amplitude/unified
19
+
20
+ # yarn
21
+ yarn add @amplitude/unified
22
+ ```
23
+
24
+ ## Usage
25
+
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
+
28
+ ### 1. Import Amplitude Unified SDK
29
+
30
+ ```typescript
31
+ import { initAll } from '@amplitude/unified';
32
+ ```
33
+
34
+ ### 2. Initialize the SDK
35
+
36
+ ```typescript
37
+ initAll('YOUR_API_KEY', {
38
+ // Shared options for all SDKs (optional)
39
+ serverZone: 'US', // or 'EU'
40
+ instanceName: 'my-instance',
41
+
42
+ // Analytics options
43
+ analytics: {
44
+ // Analytics configuration options
45
+ },
46
+
47
+ // Session Replay options
48
+ sessionReplay: {
49
+ // Session Replay configuration options
50
+ },
51
+
52
+ // Experiment options
53
+ experiment: {
54
+ // Experiment configuration options
55
+ },
56
+
57
+ // Guides and Surveys options
58
+ engagement: {
59
+ // Guides and Surveys configuration options
60
+ },
61
+ });
62
+ ```
63
+
64
+ ### 3. Access SDK Features
65
+
66
+ The Unified SDK provides access to all Amplitude features through a single interface:
67
+
68
+ ```typescript
69
+ import {
70
+ track,
71
+ identify,
72
+ experiment,
73
+ sessionReplay
74
+ } from '@amplitude/unified';
75
+
76
+ // Track events
77
+ track('Button Clicked', { buttonName: 'Sign Up' });
78
+
79
+ // Identify users
80
+ identify(new Identify().set('userType', 'premium'));
81
+
82
+ // Access Experiment features
83
+ const variant = await experiment.fetch('experiment-key');
84
+
85
+ // Access Session Replay features
86
+ sessionReplay.flush();
87
+
88
+ // Access Guides and Surveys features via engagement global
89
+ const activeGuidesAndSurveys = await engagement.gs.list();
90
+ ```
91
+
92
+ ## Configuration Options
93
+
94
+ ### Shared Options
95
+
96
+ | Name | Type | Default | Description |
97
+ | -------------- | ---------------- | ----------- | ------------------------------------------- |
98
+ | `serverZone` | `'US'` or `'EU'` | `'US'` | The server zone to use for all SDKs. |
99
+ | `instanceName` | `string` | `undefined` | A unique name for this instance of the SDK. |
100
+
101
+ ### Analytics Options
102
+
103
+ All options from `@amplitude/analytics-browser` are supported. See the [Analytics Browser SDK documentation](https://www.docs.developers.amplitude.com/analytics/browser/) for details.
104
+
105
+ ### Session Replay Options
106
+
107
+ All options from `@amplitude/plugin-session-replay-browser` are supported. See the [Session Replay documentation](https://www.docs.developers.amplitude.com/session-replay/) for details.
108
+
109
+ ### Experiment Options
110
+
111
+ All options from `@amplitude/plugin-experiment-browser` are supported. See the [Experiment documentation](https://www.docs.developers.amplitude.com/experiment/) for details.
112
+
113
+ ### Guides and Surveys Options
114
+
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.
116
+
117
+ ## Learn More
118
+
119
+ - [Analytics Browser SDK Documentation](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2)
120
+ - [Session Replay Documentation](https://amplitude.com/docs/session-replay/session-replay-standalone-sdk)
121
+ - [Experiment Documentation](https://amplitude.com/docs/sdks/experiment-sdks/experiment-javascript)
122
+ - [Guides and Surveys SDK Documentation](https://amplitude.com/docs/guides-and-surveys/sdk)
@@ -0,0 +1,4 @@
1
+ export { createInstance } from './unified-client-factory';
2
+ export declare const _setDiagnosticsSampleRate: (sampleRate: number) => void, initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: () => import("@amplitude/experiment-js-client").Client | undefined, sessionReplay: () => 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, Revenue, Identify } 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":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,eAAO,MACL,yBAAyB,gCACzB,OAAO,sGACP,UAAU,sEACV,aAAa,4EACb,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,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Identify = exports.Revenue = 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.sessionReplay = exports.experiment = exports.initAll = exports._setDiagnosticsSampleRate = exports.createInstance = void 0;
4
+ var tslib_1 = require("tslib");
5
+ /* eslint-disable @typescript-eslint/unbound-method */
6
+ var unified_client_factory_1 = tslib_1.__importDefault(require("./unified-client-factory"));
7
+ var unified_client_factory_2 = require("./unified-client-factory");
8
+ Object.defineProperty(exports, "createInstance", { enumerable: true, get: function () { return unified_client_factory_2.createInstance; } });
9
+ exports._setDiagnosticsSampleRate = unified_client_factory_1.default._setDiagnosticsSampleRate, exports.initAll = unified_client_factory_1.default.initAll, exports.experiment = unified_client_factory_1.default.experiment, exports.sessionReplay = unified_client_factory_1.default.sessionReplay, 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
+ Object.defineProperty(exports, "Revenue", { enumerable: true, get: function () { return analytics_browser_1.Revenue; } });
13
+ Object.defineProperty(exports, "Identify", { enumerable: true, get: function () { return analytics_browser_1.Identify; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,4FAA8C;AAC9C,mEAA0D;AAAjD,wHAAA,cAAc,OAAA;AAErB,QAAA,yBAAyB,GAuBvB,gCAAM,4BAtBR,QAAA,OAAO,GAsBL,gCAAM,UArBR,QAAA,UAAU,GAqBR,gCAAM,aApBR,QAAA,aAAa,GAoBX,gCAAM,gBAnBR,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,kEAAwE;AAA/D,0GAAA,KAAK,OAAA;AAAE,4GAAA,OAAO,OAAA;AAAE,6GAAA,QAAQ,OAAA","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\nimport client from './unified-client-factory';\nexport { createInstance } from './unified-client-factory';\nexport const {\n _setDiagnosticsSampleRate,\n initAll,\n experiment,\n sessionReplay,\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, Revenue, Identify } from '@amplitude/analytics-browser';\n"]}
@@ -0,0 +1,3 @@
1
+ import { Types } from '@amplitude/analytics-browser';
2
+ export declare const libraryPlugin: () => Types.EnrichmentPlugin;
3
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAKrD,eAAO,MAAM,aAAa,QAAO,MAAM,gBAStC,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.libraryPlugin = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var version_1 = require("./version");
6
+ var LIBPREFIX = 'amplitude-ts-unified';
7
+ var libraryPlugin = function () {
8
+ return {
9
+ type: 'enrichment',
10
+ name: '@amplitude/unified-library-plugin',
11
+ execute: function (event) {
12
+ var _a;
13
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
14
+ return tslib_1.__generator(this, function (_b) {
15
+ event.library = "".concat(LIBPREFIX, "/").concat(version_1.VERSION, "-").concat((_a = event.library) !== null && _a !== void 0 ? _a : '');
16
+ return [2 /*return*/, event];
17
+ });
18
+ });
19
+ },
20
+ };
21
+ };
22
+ exports.libraryPlugin = libraryPlugin;
23
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";;;;AACA,qCAAoC;AAEpC,IAAM,SAAS,GAAG,sBAAsB,CAAC;AAElC,IAAM,aAAa,GAAG;IAC3B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,mCAAmC;QACnC,OAAO,YAAC,KAAkB;;;;oBAC9B,KAAK,CAAC,OAAO,GAAG,UAAG,SAAS,cAAI,iBAAO,cAAI,MAAA,KAAK,CAAC,OAAO,mCAAI,EAAE,CAAE,CAAC;oBACjE,sBAAO,KAAK,EAAC;;;SACd;KACF,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,aAAa,iBASxB","sourcesContent":["import { Types } from '@amplitude/analytics-browser';\nimport { VERSION } from './version';\n\nconst LIBPREFIX = 'amplitude-ts-unified';\n\nexport const libraryPlugin = (): Types.EnrichmentPlugin => {\n return {\n type: 'enrichment',\n name: '@amplitude/unified-library-plugin',\n async execute(event: Types.Event): Promise<Types.Event | null> {\n event.library = `${LIBPREFIX}/${VERSION}-${event.library ?? ''}`;\n return event;\n },\n };\n};\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,aAgKjC,CAAC;;AAEF,wBAAgC"}
@@ -0,0 +1,39 @@
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
+ _setDiagnosticsSampleRate: (0, analytics_core_1.debugWrapper)(client._setDiagnosticsSampleRate.bind(client), '_setDiagnosticsSampleRate', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
10
+ experiment: (0, analytics_core_1.debugWrapper)(client.experiment.bind(client), 'experiment', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
11
+ sessionReplay: (0, analytics_core_1.debugWrapper)(client.sessionReplay.bind(client), 'sessionReplay', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
12
+ initAll: (0, analytics_core_1.debugWrapper)(client.initAll.bind(client), 'initAll', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
13
+ init: (0, analytics_core_1.debugWrapper)(client.init.bind(client), 'init', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
14
+ 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'])),
15
+ 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'])),
16
+ 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'])),
17
+ 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'])),
18
+ 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'])),
19
+ 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'])),
20
+ 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'])),
21
+ 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'])),
22
+ 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'])),
23
+ 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'])),
24
+ 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'])),
25
+ 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'])),
26
+ 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'])),
27
+ 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'])),
28
+ getSessionId: (0, analytics_core_1.debugWrapper)(client.getSessionId.bind(client), 'getSessionId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
29
+ setSessionId: (0, analytics_core_1.debugWrapper)(client.setSessionId.bind(client), 'setSessionId', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
30
+ extendSession: (0, analytics_core_1.debugWrapper)(client.extendSession.bind(client), 'extendSession', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
31
+ setOptOut: (0, analytics_core_1.debugWrapper)(client.setOptOut.bind(client), 'setOptOut', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
32
+ getOptOut: (0, analytics_core_1.debugWrapper)(client.getOptOut.bind(client), 'getOptOut', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
33
+ setTransport: (0, analytics_core_1.debugWrapper)(client.setTransport.bind(client), 'setTransport', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
34
+ getIdentity: (0, analytics_core_1.debugWrapper)(client.getIdentity.bind(client), 'getIdentity', (0, analytics_core_1.getClientLogConfig)(client), (0, analytics_core_1.getClientStates)(client, ['config'])),
35
+ };
36
+ };
37
+ exports.createInstance = createInstance;
38
+ exports.default = (0, exports.createInstance)();
39
+ //# 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,yBAAyB,EAAE,IAAA,6BAAY,EACrC,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,EAC7C,2BAA2B,EAC3B,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,UAAU,EAAE,IAAA,6BAAY,EACtB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAC9B,YAAY,EACZ,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,aAAa,EAAE,IAAA,6BAAY,EACzB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EACjC,eAAe,EACf,IAAA,mCAAkB,EAAC,MAAM,CAAC,EAC1B,IAAA,gCAAe,EAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CACpC;QACD,OAAO,EAAE,IAAA,6BAAY,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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 _setDiagnosticsSampleRate: debugWrapper(\n client._setDiagnosticsSampleRate.bind(client),\n '_setDiagnosticsSampleRate',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n experiment: debugWrapper(\n client.experiment.bind(client),\n 'experiment',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\n sessionReplay: debugWrapper(\n client.sessionReplay.bind(client),\n 'sessionReplay',\n getClientLogConfig(client),\n getClientStates(client, ['config']),\n ),\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 getOptOut: debugWrapper(\n client.getOptOut.bind(client),\n 'getOptOut',\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 getIdentity: debugWrapper(\n client.getIdentity.bind(client),\n 'getIdentity',\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, ExperimentPluginConfig } from '@amplitude/plugin-experiment-browser';
4
+ import { InitOptions } from '@amplitude/engagement-browser';
5
+ import { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';
6
+ export interface UnifiedSharedOptions {
7
+ serverZone?: 'US' | 'EU';
8
+ instanceName?: string;
9
+ }
10
+ export type UnifiedOptions = UnifiedSharedOptions & {
11
+ analytics?: BrowserOptions;
12
+ sessionReplay?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;
13
+ experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;
14
+ engagement?: Omit<InitOptions, keyof UnifiedSharedOptions>;
15
+ };
16
+ export interface UnifiedClient extends BrowserClient {
17
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
18
+ sessionReplay(): AmplitudeSessionReplay;
19
+ experiment(): IExperimentClient | undefined;
20
+ }
21
+ export declare class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {
22
+ private _sessionReplay;
23
+ sessionReplay(): AmplitudeSessionReplay;
24
+ experiment(): IExperimentClient | undefined;
25
+ /**
26
+ * Initialize SDKs with configuration options.
27
+ *
28
+ * @param apiKey Amplitude API key.
29
+ * @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.
30
+ * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
31
+ */
32
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
33
+ /**
34
+ * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.
35
+ */
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,sBAAsB,EAGvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAA8B,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG1E,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,aAAa,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC,CAAC;IACvE,UAAU,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,oBAAoB,CAAC,CAAC;IACtE,UAAU,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,oBAAoB,CAAC,CAAC;CAC5D,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,aAAa,IAAI,sBAAsB,CAAC;IACxC,UAAU,IAAI,iBAAiB,GAAG,SAAS,CAAC;CAC7C;AAED,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,aAAa;IAG7E,OAAO,CAAC,cAAc,CAAyB;IAE/C,aAAa,IAAI,sBAAsB;IAIvC,UAAU,IAAI,iBAAiB,GAAG,SAAS;IAkB3C;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc;IA4B7D;;OAEG;IAEH,IAAI,CAAC,MAAM,SAAK,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,YAAY,CAAC,EAAE,cAAc;CAI3F"}
@@ -0,0 +1,90 @@
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 engagement_browser_1 = require("@amplitude/engagement-browser");
9
+ var library_1 = require("./library");
10
+ var AmplitudeUnified = /** @class */ (function (_super) {
11
+ tslib_1.__extends(AmplitudeUnified, _super);
12
+ function AmplitudeUnified() {
13
+ return _super !== null && _super.apply(this, arguments) || this;
14
+ }
15
+ AmplitudeUnified.prototype.sessionReplay = function () {
16
+ return this._sessionReplay;
17
+ };
18
+ AmplitudeUnified.prototype.experiment = function () {
19
+ // Return when init() or initAll() is not called
20
+ if (this.config === undefined) {
21
+ return undefined;
22
+ }
23
+ var expPlugins = this.plugins(plugin_experiment_browser_1.ExperimentPlugin);
24
+ if (expPlugins.length === 0) {
25
+ this.config.loggerProvider.debug("".concat(plugin_experiment_browser_1.ExperimentPlugin.pluginName, " plugin is not found."));
26
+ return undefined;
27
+ }
28
+ else if (expPlugins.length === 1) {
29
+ return expPlugins[0].experiment;
30
+ }
31
+ else {
32
+ this.config.loggerProvider.debug("Multiple instances of ".concat(plugin_experiment_browser_1.ExperimentPlugin.pluginName, " are found."));
33
+ return undefined;
34
+ }
35
+ };
36
+ /**
37
+ * Initialize SDKs with configuration options.
38
+ *
39
+ * @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.
42
+ */
43
+ AmplitudeUnified.prototype.initAll = function (apiKey, unifiedOptions) {
44
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
45
+ var sharedOptions, srPlugin;
46
+ return tslib_1.__generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0:
49
+ sharedOptions = {
50
+ serverZone: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.serverZone,
51
+ instanceName: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.instanceName,
52
+ };
53
+ _super.prototype.add.call(this, (0, library_1.libraryPlugin)());
54
+ 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];
55
+ case 1:
56
+ _a.sent();
57
+ return [4 /*yield*/, _super.prototype.add.call(this, (0, plugin_session_replay_browser_1.sessionReplayPlugin)(tslib_1.__assign(tslib_1.__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sessionReplay), sharedOptions))).promise];
58
+ case 2:
59
+ _a.sent();
60
+ return [4 /*yield*/, _super.prototype.add.call(this, (0, plugin_experiment_browser_1.experimentPlugin)(tslib_1.__assign(tslib_1.__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.experiment), sharedOptions))).promise];
61
+ case 3:
62
+ _a.sent();
63
+ srPlugin = this.plugin(plugin_session_replay_browser_1.SessionReplayPlugin.pluginName);
64
+ if (srPlugin === undefined) {
65
+ this.config.loggerProvider.debug("".concat(plugin_session_replay_browser_1.SessionReplayPlugin.pluginName, " plugin is not found."));
66
+ }
67
+ else {
68
+ this._sessionReplay = srPlugin.sessionReplay;
69
+ }
70
+ return [4 /*yield*/, _super.prototype.add.call(this, (0, engagement_browser_1.plugin)(tslib_1.__assign(tslib_1.__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.engagement), sharedOptions))).promise];
71
+ case 4:
72
+ _a.sent();
73
+ return [2 /*return*/];
74
+ }
75
+ });
76
+ });
77
+ };
78
+ /**
79
+ * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.
80
+ */
81
+ /* istanbul ignore next */
82
+ AmplitudeUnified.prototype.init = function (apiKey, userIdOrOptions, maybeOptions) {
83
+ if (apiKey === void 0) { apiKey = ''; }
84
+ var res = _super.prototype.init.call(this, apiKey, userIdOrOptions, maybeOptions);
85
+ return res;
86
+ };
87
+ return AmplitudeUnified;
88
+ }(analytics_browser_1.AmplitudeBrowser));
89
+ exports.AmplitudeUnified = AmplitudeUnified;
90
+ //# 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;AAC9C,oEAAwF;AAExF,qCAA0C;AAoB1C;IAAsC,4CAAgB;IAAtD;;IAsEA,CAAC;IAjEC,wCAAa,GAAb;QACE,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,qCAAU,GAAV;QACE,gDAAgD;QAChD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,OAAO,SAAS,CAAC;SAClB;QAED,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,4CAAgB,CAAC,CAAC;QAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,4CAAgB,CAAC,UAAU,0BAAuB,CAAC,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DAAmB,CAAC,UAAU,0BAAuB,CAAC,CAAC;yBAC5F;6BAAM;4BACL,IAAI,CAAC,cAAc,GAAI,QAAgC,CAAC,aAAa,CAAC;yBACvE;wBAED,qBAAM,iBAAM,GAAG,YACb,IAAA,2BAAgB,wCACX,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,GAC1B,aAAa,EAChB,CACH,CAAC,OAAO,EAAA;;wBALT,SAKS,CAAC;;;;;KACX;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,AAtED,CAAsC,oCAAgB,GAsErD;AAtEY,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 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\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 const sharedOptions = {\n serverZone: unifiedOptions?.serverZone,\n instanceName: unifiedOptions?.instanceName,\n };\n\n super.add(libraryPlugin());\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 }\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"]}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "1.0.0-AMP-140206-change-encoding-gtm-snippet-to-gz.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,yDAAyD,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ // Autogenerated by `yarn version-file`. DO NOT EDIT
5
+ exports.VERSION = '1.0.0-AMP-140206-change-encoding-gtm-snippet-to-gz.0';
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACvC,QAAA,OAAO,GAAG,sDAAsD,CAAC","sourcesContent":["// Autogenerated by `yarn version-file`. DO NOT EDIT\nexport const VERSION = '1.0.0-AMP-140206-change-encoding-gtm-snippet-to-gz.0';\n"]}
@@ -0,0 +1,4 @@
1
+ export { createInstance } from './unified-client-factory';
2
+ export declare const _setDiagnosticsSampleRate: (sampleRate: number) => void, initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: () => import("@amplitude/experiment-js-client").Client | undefined, sessionReplay: () => 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, Revenue, Identify } 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":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,eAAO,MACL,yBAAyB,gCACzB,OAAO,sGACP,UAAU,sEACV,aAAa,4EACb,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,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/unbound-method */
2
+ import client from './unified-client-factory';
3
+ export { createInstance } from './unified-client-factory';
4
+ export var _setDiagnosticsSampleRate = client._setDiagnosticsSampleRate, initAll = client.initAll, experiment = client.experiment, sessionReplay = client.sessionReplay, 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, Revenue, Identify } 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,sDAAsD;AACtD,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,MAAM,CACJ,IAAA,yBAAyB,GAuBvB,MAAM,0BAvBiB,EACzB,OAAO,GAsBL,MAAM,QAtBD,EACP,UAAU,GAqBR,MAAM,WArBE,EACV,aAAa,GAoBX,MAAM,cApBK,EACb,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,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/unbound-method */\nimport client from './unified-client-factory';\nexport { createInstance } from './unified-client-factory';\nexport const {\n _setDiagnosticsSampleRate,\n initAll,\n experiment,\n sessionReplay,\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, Revenue, Identify } from '@amplitude/analytics-browser';\n"]}
@@ -0,0 +1,3 @@
1
+ import { Types } from '@amplitude/analytics-browser';
2
+ export declare const libraryPlugin: () => Types.EnrichmentPlugin;
3
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAKrD,eAAO,MAAM,aAAa,QAAO,MAAM,gBAStC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { __awaiter, __generator } from "tslib";
2
+ import { VERSION } from './version';
3
+ var LIBPREFIX = 'amplitude-ts-unified';
4
+ export var libraryPlugin = function () {
5
+ return {
6
+ type: 'enrichment',
7
+ name: '@amplitude/unified-library-plugin',
8
+ execute: function (event) {
9
+ var _a;
10
+ return __awaiter(this, void 0, void 0, function () {
11
+ return __generator(this, function (_b) {
12
+ event.library = "".concat(LIBPREFIX, "/").concat(VERSION, "-").concat((_a = event.library) !== null && _a !== void 0 ? _a : '');
13
+ return [2 /*return*/, event];
14
+ });
15
+ });
16
+ },
17
+ };
18
+ };
19
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/library.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,IAAM,SAAS,GAAG,sBAAsB,CAAC;AAEzC,MAAM,CAAC,IAAM,aAAa,GAAG;IAC3B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,mCAAmC;QACnC,OAAO,YAAC,KAAkB;;;;oBAC9B,KAAK,CAAC,OAAO,GAAG,UAAG,SAAS,cAAI,OAAO,cAAI,MAAA,KAAK,CAAC,OAAO,mCAAI,EAAE,CAAE,CAAC;oBACjE,sBAAO,KAAK,EAAC;;;SACd;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Types } from '@amplitude/analytics-browser';\nimport { VERSION } from './version';\n\nconst LIBPREFIX = 'amplitude-ts-unified';\n\nexport const libraryPlugin = (): Types.EnrichmentPlugin => {\n return {\n type: 'enrichment',\n name: '@amplitude/unified-library-plugin',\n async execute(event: Types.Event): Promise<Types.Event | null> {\n event.library = `${LIBPREFIX}/${VERSION}-${event.library ?? ''}`;\n return event;\n },\n };\n};\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,aAgKjC,CAAC;;AAEF,wBAAgC"}
@@ -0,0 +1,35 @@
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
+ _setDiagnosticsSampleRate: debugWrapper(client._setDiagnosticsSampleRate.bind(client), '_setDiagnosticsSampleRate', getClientLogConfig(client), getClientStates(client, ['config'])),
7
+ experiment: debugWrapper(client.experiment.bind(client), 'experiment', getClientLogConfig(client), getClientStates(client, ['config'])),
8
+ sessionReplay: debugWrapper(client.sessionReplay.bind(client), 'sessionReplay', getClientLogConfig(client), getClientStates(client, ['config'])),
9
+ initAll: debugWrapper(client.initAll.bind(client), 'initAll', getClientLogConfig(client), getClientStates(client, ['config'])),
10
+ init: debugWrapper(client.init.bind(client), 'init', getClientLogConfig(client), getClientStates(client, ['config'])),
11
+ add: debugWrapper(client.add.bind(client), 'add', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
12
+ remove: debugWrapper(client.remove.bind(client), 'remove', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.plugins'])),
13
+ track: debugWrapper(client.track.bind(client), 'track', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
14
+ logEvent: debugWrapper(client.logEvent.bind(client), 'logEvent', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
15
+ identify: debugWrapper(client.identify.bind(client), 'identify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
16
+ groupIdentify: debugWrapper(client.groupIdentify.bind(client), 'groupIdentify', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
17
+ setGroup: debugWrapper(client.setGroup.bind(client), 'setGroup', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
18
+ revenue: debugWrapper(client.revenue.bind(client), 'revenue', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
19
+ flush: debugWrapper(client.flush.bind(client), 'flush', getClientLogConfig(client), getClientStates(client, ['config.apiKey', 'timeline.queue.length'])),
20
+ getUserId: debugWrapper(client.getUserId.bind(client), 'getUserId', getClientLogConfig(client), getClientStates(client, ['config', 'config.userId'])),
21
+ setUserId: debugWrapper(client.setUserId.bind(client), 'setUserId', getClientLogConfig(client), getClientStates(client, ['config', 'config.userId'])),
22
+ getDeviceId: debugWrapper(client.getDeviceId.bind(client), 'getDeviceId', getClientLogConfig(client), getClientStates(client, ['config', 'config.deviceId'])),
23
+ setDeviceId: debugWrapper(client.setDeviceId.bind(client), 'setDeviceId', getClientLogConfig(client), getClientStates(client, ['config', 'config.deviceId'])),
24
+ reset: debugWrapper(client.reset.bind(client), 'reset', getClientLogConfig(client), getClientStates(client, ['config', 'config.userId', 'config.deviceId'])),
25
+ getSessionId: debugWrapper(client.getSessionId.bind(client), 'getSessionId', getClientLogConfig(client), getClientStates(client, ['config'])),
26
+ setSessionId: debugWrapper(client.setSessionId.bind(client), 'setSessionId', getClientLogConfig(client), getClientStates(client, ['config'])),
27
+ extendSession: debugWrapper(client.extendSession.bind(client), 'extendSession', getClientLogConfig(client), getClientStates(client, ['config'])),
28
+ setOptOut: debugWrapper(client.setOptOut.bind(client), 'setOptOut', getClientLogConfig(client), getClientStates(client, ['config'])),
29
+ getOptOut: debugWrapper(client.getOptOut.bind(client), 'getOptOut', getClientLogConfig(client), getClientStates(client, ['config'])),
30
+ setTransport: debugWrapper(client.setTransport.bind(client), 'setTransport', getClientLogConfig(client), getClientStates(client, ['config'])),
31
+ getIdentity: debugWrapper(client.getIdentity.bind(client), 'getIdentity', getClientLogConfig(client), getClientStates(client, ['config'])),
32
+ };
33
+ };
34
+ export default createInstance();
35
+ //# sourceMappingURL=unified-client-factory.js.map