@amplitude/unified 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ export { createInstance } from './unified-client-factory';
2
+ export declare const initAll: (apiKey: string, unifiedOptions?: import("./unified").UnifiedOptions | undefined) => Promise<void>, experiment: import("@amplitude/experiment-js-client").Client, sr: import("@amplitude/session-replay-browser").AmplitudeSessionReplay, add: (plugin: import("@amplitude/analytics-core").Plugin<import("@amplitude/analytics-core").BrowserClient, import("@amplitude/analytics-core").BrowserConfig>) => import("@amplitude/analytics-core").AmplitudeReturn<void>, extendSession: () => void, flush: () => import("@amplitude/analytics-core").AmplitudeReturn<void>, getDeviceId: () => string | undefined, getSessionId: () => number | undefined, getUserId: () => string | undefined, groupIdentify: (groupType: string, groupName: string | string[], identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, identify: (identify: import("@amplitude/analytics-core").IIdentify, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, logEvent: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, remove: (pluginName: string) => import("@amplitude/analytics-core").AmplitudeReturn<void>, reset: () => void, revenue: (revenue: import("@amplitude/analytics-core").IRevenue, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setDeviceId: (deviceId: string) => void, setGroup: (groupType: string, groupName: string | string[], eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>, setOptOut: (optOut: boolean) => void, setSessionId: (sessionId: number) => void, setTransport: (transport: import("@amplitude/analytics-core").TransportType) => void, setUserId: (userId: string | undefined) => void, track: (eventInput: string | import("@amplitude/analytics-core").BaseEvent, eventProperties?: Record<string, any> | undefined, eventOptions?: import("@amplitude/analytics-core").EventOptions | undefined) => import("@amplitude/analytics-core").AmplitudeReturn<import("@amplitude/analytics-core").Result>;
3
+ export { Types } from '@amplitude/analytics-browser';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,eAAO,MACL,OAAO,sGACP,UAAU,oDACV,EAAE,sEACF,GAAG,2NACH,aAAa,cACb,KAAK,mEACL,WAAW,4BACX,YAAY,4BACZ,SAAS,4BACT,aAAa,8RACb,QAAQ,6OACR,QAAQ,2SACR,MAAM,qFACN,KAAK,cACL,OAAO,2OACP,WAAW,8BACX,QAAQ,qOACR,SAAS,6BACT,YAAY,+BACZ,YAAY,0EACZ,SAAS,wCACT,KAAK,ySACG,CAAC;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { UnifiedClient } from './unified';
2
+ export declare const createInstance: () => UnifiedClient;
3
+ declare const _default: UnifiedClient;
4
+ export default _default;
5
+ //# sourceMappingURL=unified-client-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-client-factory.d.ts","sourceRoot":"","sources":["../../src/unified-client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,WAAW,CAAC;AAG5D,eAAO,MAAM,cAAc,QAAO,aAoIjC,CAAC;;AAEF,wBAAgC"}
@@ -0,0 +1,38 @@
1
+ import { AmplitudeBrowser } from '@amplitude/analytics-browser';
2
+ import { AmplitudeSessionReplay, SessionReplayOptions } from '@amplitude/plugin-session-replay-browser';
3
+ import { IExperimentClient, ExperimentConfig } from '@amplitude/plugin-experiment-browser';
4
+ import { BrowserClient, BrowserOptions } from '@amplitude/analytics-core';
5
+ export interface UnifiedSharedOptions {
6
+ serverZone?: 'US' | 'EU';
7
+ instanceName?: string;
8
+ }
9
+ export type UnifiedOptions = UnifiedSharedOptions & {
10
+ analytics?: BrowserOptions;
11
+ sr?: Omit<SessionReplayOptions, keyof UnifiedSharedOptions> | boolean;
12
+ experiment?: Omit<ExperimentConfig, keyof UnifiedSharedOptions> | boolean;
13
+ };
14
+ export interface UnifiedClient extends BrowserClient {
15
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
16
+ sr: AmplitudeSessionReplay;
17
+ experiment: IExperimentClient;
18
+ }
19
+ export declare class AmplitudeUnified extends AmplitudeBrowser implements UnifiedClient {
20
+ experiment: IExperimentClient;
21
+ sr: AmplitudeSessionReplay;
22
+ /**
23
+ * Initialize SDKs with configuration options.
24
+ * Note that shared configuration in unifiedOptions will override the value in analyticsOptions.
25
+ *
26
+ * For example, the serverZone will be 'EU' for all SDKs.
27
+ * ```
28
+ * init('API_KEY', {serverZone: 'US'}, {serverZone: 'EU'});
29
+ * ```
30
+ *
31
+ * @param apiKey Amplitude API key.
32
+ * @param analyticsOptions Analytics configuration options. Refer to {@link https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#configure-the-sdk here} for more info.
33
+ * @param unifiedOptions Shared configuration for all SDKs and for blade SDKs.
34
+ */
35
+ initAll(apiKey: string, unifiedOptions?: UnifiedOptions): Promise<void>;
36
+ init(apiKey?: string, userIdOrOptions?: string | BrowserOptions, maybeOptions?: BrowserOptions): import("@amplitude/analytics-core").AmplitudeReturn<void>;
37
+ }
38
+ //# sourceMappingURL=unified.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified.d.ts","sourceRoot":"","sources":["../../src/unified.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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.0-beta.0",
4
+ "description": "Official Amplitude SDK for Web analytics, experiment, session replay, and more.",
5
+ "keywords": [
6
+ "amplitude",
7
+ "analytics",
8
+ "experiment",
9
+ "session replay"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
14
+ },
15
+ "author": "Amplitude Inc",
16
+ "license": "MIT",
17
+ "main": "lib/cjs/index.js",
18
+ "module": "lib/esm/index.js",
19
+ "types": "lib/esm/index.d.ts",
20
+ "sideEffects": false,
21
+ "bugs": {
22
+ "url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
23
+ },
24
+ "private": false,
25
+ "files": [
26
+ "lib"
27
+ ],
28
+ "scripts": {
29
+ "build": "yarn bundle && yarn build:es5 && yarn build:esm",
30
+ "bundle": "rollup --config rollup.config.js",
31
+ "build:es5": "tsc -p ./tsconfig.es5.json",
32
+ "build:esm": "tsc -p ./tsconfig.esm.json",
33
+ "clean": "rimraf node_modules lib coverage",
34
+ "fix": "yarn fix:eslint & yarn fix:prettier",
35
+ "fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
36
+ "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
37
+ "lint": "yarn lint:eslint & yarn lint:prettier",
38
+ "lint:eslint": "eslint '{src,test}/**/*.ts'",
39
+ "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
40
+ "test": "jest",
41
+ "typecheck": "tsc -p ./tsconfig.json",
42
+ "version": "yarn version-file && GENERATE_SNIPPET=true yarn build",
43
+ "version-file": "echo '// Autogenerated by `yarn version-file`. DO NOT EDIT' > src/version.ts && node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" >> src/version.ts"
44
+ },
45
+ "dependencies": {
46
+ "@amplitude/analytics-browser": "^2.15.0",
47
+ "@amplitude/plugin-experiment-browser": "^1.0.0-beta.0",
48
+ "@amplitude/plugin-session-replay-browser": "^1.15.0"
49
+ }
50
+ }