@amplitude/unified 1.0.0-beta.1 → 1.0.0-beta.2

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.
@@ -1 +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,gEACV,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"}
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,OAAO,sGACP,UAAU,gEACV,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"}
package/lib/cjs/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
4
  var tslib_1 = require("tslib");
5
+ /* eslint-disable @typescript-eslint/unbound-method */
5
6
  var unified_client_factory_1 = tslib_1.__importDefault(require("./unified-client-factory"));
6
7
  var unified_client_factory_2 = require("./unified-client-factory");
7
8
  Object.defineProperty(exports, "createInstance", { enumerable: true, get: function () { return unified_client_factory_2.createInstance; } });
8
- // eslint-disable-next-line @typescript-eslint/unbound-method
9
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
10
  var analytics_browser_1 = require("@amplitude/analytics-browser");
11
11
  Object.defineProperty(exports, "Types", { enumerable: true, get: function () { return analytics_browser_1.Types; } });
@@ -1 +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"]}
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,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":["/* eslint-disable @typescript-eslint/unbound-method */\nimport client from './unified-client-factory';\nexport { createInstance } from './unified-client-factory';\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"]}
@@ -1,3 +1,3 @@
1
1
  import { Types } from '@amplitude/analytics-browser';
2
- export declare const libraryPlugin: () => Types.BeforePlugin;
2
+ export declare const libraryPlugin: () => Types.EnrichmentPlugin;
3
3
  //# sourceMappingURL=library.d.ts.map
@@ -1 +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,YAStC,CAAC"}
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"}
@@ -6,7 +6,7 @@ var version_1 = require("./version");
6
6
  var LIBPREFIX = 'amplitude-ts-unified';
7
7
  var libraryPlugin = function () {
8
8
  return {
9
- type: 'before',
9
+ type: 'enrichment',
10
10
  name: '@amplitude/unified-library-plugin',
11
11
  execute: function (event) {
12
12
  var _a;
@@ -1 +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,QAAQ;QACd,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.BeforePlugin => {\n return {\n type: 'before',\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"]}
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"]}
@@ -50,10 +50,10 @@ var AmplitudeUnified = /** @class */ (function (_super) {
50
50
  serverZone: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.serverZone,
51
51
  instanceName: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.instanceName,
52
52
  };
53
+ _super.prototype.add.call(this, (0, library_1.libraryPlugin)());
53
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];
54
55
  case 1:
55
56
  _a.sent();
56
- _super.prototype.add.call(this, (0, library_1.libraryPlugin)());
57
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.sr), sharedOptions))).promise];
58
58
  case 2:
59
59
  _a.sent();
@@ -1 +1 @@
1
- {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";;;;AAAA,kEAAgE;AAChE,0FAKkD;AAClD,kFAK8C;AAE9C,qCAA0C;AAmB1C;IAAsC,4CAAgB;IAAtD;;IA2DA,CAAC;IAtDC,sBAAI,wCAAU;aAAd;YACE,gDAAgD;YAChD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC7B,OAAO,SAAS,CAAC;aAClB;YAED,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,4CAAgB,CAAC,CAAC;YAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,4CAAgB,CAAC,UAAU,0BAAuB,CAAC,CAAC;gBACxF,OAAO,SAAS,CAAC;aAClB;iBAAM,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBAClC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;aACjC;iBAAM;gBACL,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,gCAAyB,4CAAgB,CAAC,UAAU,gBAAa,CAAC,CAAC;gBACpG,OAAO,SAAS,CAAC;aAClB;QACH,CAAC;;;OAAA;IAED;;;;;;OAMG;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;wBACrF,iBAAM,GAAG,YAAC,IAAA,uBAAa,GAAE,CAAC,CAAC;wBAE3B,qBAAM,iBAAM,GAAG,YAAC,IAAA,mDAAmB,wCAAM,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,EAAE,GAAK,aAAa,EAAG,CAAC,CAAC,OAAO,EAAA;;wBAAzF,SAAyF,CAAC;wBAE1F,qBAAM,iBAAM,GAAG,YAAC,IAAA,4CAAgB,wCAAM,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,GAAK,aAAa,EAAG,CAAC,CAAC,OAAO,EAAA;;wBAA9F,SAA8F,CAAC;wBAEzF,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,mDAAmB,CAAC,UAAU,CAAC,CAAC;wBAC7D,IAAI,QAAQ,KAAK,SAAS,EAAE;4BAC1B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,mDAAmB,CAAC,UAAU,0BAAuB,CAAC,CAAC;yBAC5F;6BAAM;4BACL,IAAI,CAAC,EAAE,GAAI,QAAgC,CAAC,EAAE,CAAC;yBAChD;;;;;KACF;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,AA3DD,CAAsC,oCAAgB,GA2DrD;AA3DY,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 { 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 sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sr: 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 sr: AmplitudeSessionReplay;\n\n get 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 await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n super.add(libraryPlugin());\n\n await super.add(sessionReplayPlugin({ ...unifiedOptions?.sr, ...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.sr = (srPlugin as SessionReplayPlugin).sr;\n }\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";;;;AAAA,kEAAgE;AAChE,0FAKkD;AAClD,kFAK8C;AAE9C,qCAA0C;AAmB1C;IAAsC,4CAAgB;IAAtD;;IA2DA,CAAC;IAtDC,sBAAI,wCAAU;aAAd;YACE,gDAAgD;YAChD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC7B,OAAO,SAAS,CAAC;aAClB;YAED,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,4CAAgB,CAAC,CAAC;YAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,4CAAgB,CAAC,UAAU,0BAAuB,CAAC,CAAC;gBACxF,OAAO,SAAS,CAAC;aAClB;iBAAM,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBAClC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;aACjC;iBAAM;gBACL,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,gCAAyB,4CAAgB,CAAC,UAAU,gBAAa,CAAC,CAAC;gBACpG,OAAO,SAAS,CAAC;aAClB;QACH,CAAC;;;OAAA;IAED;;;;;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AAE,YAAY,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC;IACb,CAAC;IACH,uBAAC;AAAD,CAAC,AA3DD,CAAsC,oCAAgB,GA2DrD;AA3DY,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 { 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 sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sr: 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 sr: AmplitudeSessionReplay;\n\n get 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?.sr, ...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.sr = (srPlugin as SessionReplayPlugin).sr;\n }\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0-beta.0";
1
+ export declare const VERSION = "1.0.0-beta.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.0.0-beta.0';
4
+ exports.VERSION = '1.0.0-beta.2';
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,cAAc,CAAC","sourcesContent":["export const VERSION = '1.0.0-beta.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,cAAc,CAAC","sourcesContent":["export const VERSION = '1.0.0-beta.2';\n"]}
@@ -1 +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,gEACV,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"}
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,OAAO,sGACP,UAAU,gEACV,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"}
package/lib/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ /* eslint-disable @typescript-eslint/unbound-method */
1
2
  import client from './unified-client-factory';
2
3
  export { createInstance } from './unified-client-factory';
3
- // eslint-disable-next-line @typescript-eslint/unbound-method
4
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
5
  export { Types } from '@amplitude/analytics-browser';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +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"]}
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,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":["/* eslint-disable @typescript-eslint/unbound-method */\nimport client from './unified-client-factory';\nexport { createInstance } from './unified-client-factory';\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"]}
@@ -1,3 +1,3 @@
1
1
  import { Types } from '@amplitude/analytics-browser';
2
- export declare const libraryPlugin: () => Types.BeforePlugin;
2
+ export declare const libraryPlugin: () => Types.EnrichmentPlugin;
3
3
  //# sourceMappingURL=library.d.ts.map
@@ -1 +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,YAStC,CAAC"}
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"}
@@ -3,7 +3,7 @@ import { VERSION } from './version';
3
3
  var LIBPREFIX = 'amplitude-ts-unified';
4
4
  export var libraryPlugin = function () {
5
5
  return {
6
- type: 'before',
6
+ type: 'enrichment',
7
7
  name: '@amplitude/unified-library-plugin',
8
8
  execute: function (event) {
9
9
  var _a;
@@ -1 +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,QAAQ;QACd,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.BeforePlugin => {\n return {\n type: 'before',\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"]}
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"]}
@@ -47,10 +47,10 @@ var AmplitudeUnified = /** @class */ (function (_super) {
47
47
  serverZone: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.serverZone,
48
48
  instanceName: unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.instanceName,
49
49
  };
50
+ _super.prototype.add.call(this, libraryPlugin());
50
51
  return [4 /*yield*/, _super.prototype.init.call(this, apiKey, __assign(__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.analytics), sharedOptions)).promise];
51
52
  case 1:
52
53
  _a.sent();
53
- _super.prototype.add.call(this, libraryPlugin());
54
54
  return [4 /*yield*/, _super.prototype.add.call(this, sessionReplayPlugin(__assign(__assign({}, unifiedOptions === null || unifiedOptions === void 0 ? void 0 : unifiedOptions.sr), sharedOptions))).promise];
55
55
  case 2:
56
56
  _a.sent();
@@ -1 +1 @@
1
- {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAGL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAmB1C;IAAsC,oCAAgB;IAAtD;;IA2DA,CAAC;IAtDC,sBAAI,wCAAU;aAAd;YACE,gDAAgD;YAChD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC7B,OAAO,SAAS,CAAC;aAClB;YAED,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAClD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC3B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,gBAAgB,CAAC,UAAU,0BAAuB,CAAC,CAAC;gBACxF,OAAO,SAAS,CAAC;aAClB;iBAAM,IAAI,UAAU,CAAC,MAAM,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AC,EAAE,GAAI,QAAgC,CAAC,EAAE,CAAC;yBAChD;;;;;KACF;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,AA3DD,CAAsC,gBAAgB,GA2DrD","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 { 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 sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sr: 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 sr: AmplitudeSessionReplay;\n\n get 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 await super.init(apiKey, { ...unifiedOptions?.analytics, ...sharedOptions }).promise;\n super.add(libraryPlugin());\n\n await super.add(sessionReplayPlugin({ ...unifiedOptions?.sr, ...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.sr = (srPlugin as SessionReplayPlugin).sr;\n }\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
1
+ {"version":3,"file":"unified.js","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":";AAAA,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;AAE9C,OAAO,EAAE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AAE,GAAK,aAAa,EAAG,CAAC,CAAC,OAAO,EAAA;;wBAAzF,SAAyF,CAAC;wBAE1F,qBAAM,iBAAM,GAAG,YAAC,gBAAgB,uBAAM,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,GAAK,aAAa,EAAG,CAAC,CAAC,OAAO,EAAA;;wBAA9F,SAA8F,CAAC;wBAEzF,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;wBAC7D,IAAI,QAAQ,KAAK,SAAS,EAAE;4BAC1B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,UAAG,mBAAmB,CAAC,UAAU,0BAAuB,CAAC,CAAC;yBAC5F;6BAAM;4BACL,IAAI,CAAC,EAAE,GAAI,QAAgC,CAAC,EAAE,CAAC;yBAChD;;;;;KACF;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,AA3DD,CAAsC,gBAAgB,GA2DrD","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 { 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 sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions>;\n experiment?: Omit<ExperimentPluginConfig, keyof UnifiedSharedOptions>;\n};\n\nexport interface UnifiedClient extends BrowserClient {\n initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;\n sr: 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 sr: AmplitudeSessionReplay;\n\n get 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?.sr, ...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.sr = (srPlugin as SessionReplayPlugin).sr;\n }\n }\n\n /**\n * Only analytics SDK is initialized. Use initAll() instead to initialize all blade SDKs.\n */\n /* istanbul ignore next */\n init(apiKey = '', userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions) {\n const res = super.init(apiKey, userIdOrOptions, maybeOptions);\n return res;\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0-beta.0";
1
+ export declare const VERSION = "1.0.0-beta.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.0.0-beta.0';
1
+ export var VERSION = '1.0.0-beta.2';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["export const VERSION = '1.0.0-beta.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["export const VERSION = '1.0.0-beta.2';\n"]}