@amplitude/analytics-types 1.2.0 → 1.3.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.
- package/lib/cjs/base-event.d.ts +1 -0
- package/lib/cjs/base-event.d.ts.map +1 -1
- package/lib/cjs/base-event.js.map +1 -1
- package/lib/cjs/client/node-client.d.ts +20 -1
- package/lib/cjs/client/node-client.d.ts.map +1 -1
- package/lib/cjs/client/node-client.js.map +1 -1
- package/lib/cjs/client/web-client.d.ts +38 -1
- package/lib/cjs/client/web-client.d.ts.map +1 -1
- package/lib/cjs/client/web-client.js.map +1 -1
- package/lib/cjs/config/core.d.ts +1 -0
- package/lib/cjs/config/core.d.ts.map +1 -1
- package/lib/cjs/config/core.js.map +1 -1
- package/lib/cjs/config/react-native.d.ts +2 -0
- package/lib/cjs/config/react-native.d.ts.map +1 -1
- package/lib/cjs/config/react-native.js.map +1 -1
- package/lib/cjs/plugin.d.ts +7 -7
- package/lib/cjs/plugin.d.ts.map +1 -1
- package/lib/cjs/plugin.js.map +1 -1
- package/lib/esm/base-event.d.ts +1 -0
- package/lib/esm/base-event.d.ts.map +1 -1
- package/lib/esm/base-event.js.map +1 -1
- package/lib/esm/client/node-client.d.ts +20 -1
- package/lib/esm/client/node-client.d.ts.map +1 -1
- package/lib/esm/client/node-client.js.map +1 -1
- package/lib/esm/client/web-client.d.ts +38 -1
- package/lib/esm/client/web-client.d.ts.map +1 -1
- package/lib/esm/client/web-client.js.map +1 -1
- package/lib/esm/config/core.d.ts +1 -0
- package/lib/esm/config/core.d.ts.map +1 -1
- package/lib/esm/config/core.js.map +1 -1
- package/lib/esm/config/react-native.d.ts +2 -0
- package/lib/esm/config/react-native.d.ts.map +1 -1
- package/lib/esm/config/react-native.js.map +1 -1
- package/lib/esm/plugin.d.ts +7 -7
- package/lib/esm/plugin.d.ts.map +1 -1
- package/lib/esm/plugin.js.map +1 -1
- package/package.json +4 -3
package/lib/cjs/base-event.d.ts
CHANGED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AC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,kBAAkB,CAAC,EAAE,8BAA8B,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-event.js","sourceRoot":"","sources":["../../src/base-event.ts"],"names":[],"mappings":"","sourcesContent":["import { Plan } from './plan';\nimport { IngestionMetadataEventProperty } from './ingestion-metadata';\n\nexport interface BaseEvent extends EventOptions {\n event_type: string;\n event_properties?: { [key: string]: any } | undefined;\n user_properties?: { [key: string]: any } | undefined;\n group_properties?: { [key: string]: any } | undefined;\n groups?: { [key: string]: any } | undefined;\n}\n\nexport interface EventOptions {\n user_id?: string;\n device_id?: string;\n time?: number;\n location_lat?: number;\n location_lng?: number;\n app_version?: string;\n version_name?: string;\n library?: string;\n platform?: string;\n os_name?: string;\n os_version?: string;\n device_brand?: string;\n device_manufacturer?: string;\n device_model?: string;\n carrier?: string;\n country?: string;\n region?: string;\n city?: string;\n dma?: string;\n idfa?: string;\n idfv?: string;\n adid?: string;\n android_id?: string;\n language?: string;\n ip?: string;\n price?: number;\n quantity?: number;\n revenue?: number;\n productId?: string;\n revenueType?: string;\n event_id?: number;\n session_id?: number;\n insert_id?: string;\n plan?: Plan;\n ingestion_metadata?: IngestionMetadataEventProperty;\n partner_id?: string;\n user_agent?: string;\n extra?: { [key: string]: any };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-event.js","sourceRoot":"","sources":["../../src/base-event.ts"],"names":[],"mappings":"","sourcesContent":["import { Plan } from './plan';\nimport { IngestionMetadataEventProperty } from './ingestion-metadata';\n\nexport interface BaseEvent extends EventOptions {\n event_type: string;\n event_properties?: { [key: string]: any } | undefined;\n user_properties?: { [key: string]: any } | undefined;\n group_properties?: { [key: string]: any } | undefined;\n groups?: { [key: string]: any } | undefined;\n}\n\nexport interface EventOptions {\n user_id?: string;\n device_id?: string;\n time?: number;\n location_lat?: number;\n location_lng?: number;\n app_version?: string;\n version_name?: string;\n library?: string;\n platform?: string;\n os_name?: string;\n os_version?: string;\n device_brand?: string;\n device_manufacturer?: string;\n device_model?: string;\n carrier?: string;\n country?: string;\n region?: string;\n city?: string;\n dma?: string;\n idfa?: string;\n idfv?: string;\n adid?: string;\n android_id?: string;\n language?: string;\n ip?: string;\n price?: number;\n quantity?: number;\n revenue?: number;\n productId?: string;\n revenueType?: string;\n event_id?: number;\n session_id?: number;\n insert_id?: string;\n plan?: Plan;\n ingestion_metadata?: IngestionMetadataEventProperty;\n partner_id?: string;\n user_agent?: string;\n android_app_set_id?: string;\n extra?: { [key: string]: any };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AmplitudeReturn } from '../amplitude-promise';
|
|
2
|
-
import { NodeOptions } from '../config';
|
|
2
|
+
import { NodeConfig, NodeOptions } from '../config';
|
|
3
3
|
import { CoreClient } from './core-client';
|
|
4
|
+
import { Plugin } from '../plugin';
|
|
4
5
|
export interface NodeClient extends CoreClient {
|
|
5
6
|
/**
|
|
6
7
|
* Initializes the Amplitude SDK with your apiKey, optional configurations.
|
|
@@ -11,5 +12,23 @@ export interface NodeClient extends CoreClient {
|
|
|
11
12
|
* ```
|
|
12
13
|
*/
|
|
13
14
|
init(apiKey: string, options?: NodeOptions): AmplitudeReturn<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Adds a new plugin.
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const plugin = {
|
|
20
|
+
* name: 'my-plugin',
|
|
21
|
+
* type: 'enrichment',
|
|
22
|
+
* async setup(config: NodeConfig, amplitude: NodeClient) {
|
|
23
|
+
* return;
|
|
24
|
+
* },
|
|
25
|
+
* async execute(event: Event) {
|
|
26
|
+
* return event;
|
|
27
|
+
* },
|
|
28
|
+
* };
|
|
29
|
+
* amplitude.add(plugin);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
add(plugin: Plugin<NodeClient, NodeConfig>): AmplitudeReturn<void>;
|
|
14
33
|
}
|
|
15
34
|
//# sourceMappingURL=node-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEnE;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CACpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { NodeOptions } from '../config';\nimport { CoreClient } from './core-client';\n\nexport interface NodeClient extends CoreClient {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: NodeOptions): AmplitudeReturn<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { NodeConfig, NodeOptions } from '../config';\nimport { CoreClient } from './core-client';\nimport { Plugin } from '../plugin';\n\nexport interface NodeClient extends CoreClient {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: NodeOptions): AmplitudeReturn<void>;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: NodeConfig, amplitude: NodeClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<NodeClient, NodeConfig>): AmplitudeReturn<void>;\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AmplitudeReturn } from '../amplitude-promise';
|
|
2
|
-
import { BrowserOptions, ReactNativeOptions } from '../config';
|
|
2
|
+
import { BrowserConfig, BrowserOptions, ReactNativeConfig, ReactNativeOptions } from '../config';
|
|
3
3
|
import { TransportType } from '../transport';
|
|
4
4
|
import { CoreClient } from './core-client';
|
|
5
|
+
import { Plugin } from '../plugin';
|
|
5
6
|
interface Client extends CoreClient {
|
|
6
7
|
/**
|
|
7
8
|
* Returns current user ID.
|
|
@@ -106,6 +107,24 @@ export interface BrowserClient extends Client {
|
|
|
106
107
|
* ```
|
|
107
108
|
*/
|
|
108
109
|
setTransport(transport: TransportType): void;
|
|
110
|
+
/**
|
|
111
|
+
* Adds a new plugin.
|
|
112
|
+
*
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const plugin = {
|
|
115
|
+
* name: 'my-plugin',
|
|
116
|
+
* type: 'enrichment',
|
|
117
|
+
* async setup(config: BrowserConfig, amplitude: BrowserClient) {
|
|
118
|
+
* return;
|
|
119
|
+
* },
|
|
120
|
+
* async execute(event: Event) {
|
|
121
|
+
* return event;
|
|
122
|
+
* },
|
|
123
|
+
* };
|
|
124
|
+
* amplitude.add(plugin);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;
|
|
109
128
|
}
|
|
110
129
|
export interface ReactNativeClient extends Client {
|
|
111
130
|
/**
|
|
@@ -117,6 +136,24 @@ export interface ReactNativeClient extends Client {
|
|
|
117
136
|
* ```
|
|
118
137
|
*/
|
|
119
138
|
init(apiKey: string, userId?: string, options?: ReactNativeOptions): AmplitudeReturn<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Adds a new plugin.
|
|
141
|
+
*
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const plugin = {
|
|
144
|
+
* name: 'my-plugin',
|
|
145
|
+
* type: 'enrichment',
|
|
146
|
+
* async setup(config: ReactNativeConfig, amplitude: ReactNativeClient) {
|
|
147
|
+
* return;
|
|
148
|
+
* },
|
|
149
|
+
* async execute(event: Event) {
|
|
150
|
+
* return event;
|
|
151
|
+
* },
|
|
152
|
+
* };
|
|
153
|
+
* amplitude.add(plugin);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
add(plugin: Plugin<ReactNativeClient, ReactNativeConfig>): AmplitudeReturn<void>;
|
|
120
157
|
}
|
|
121
158
|
export {};
|
|
122
159
|
//# sourceMappingURL=web-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-client.d.ts","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"web-client.d.ts","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,UAAU,MAAO,SAAQ,UAAU;IACjC;;;;;;OAMG;IACH,SAAS,IAAI,MAAM,GAAG,SAAS,CAAC;IAEhC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAE5C;;;;;;OAMG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAAC;IAElC;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;;;;;;;;OASG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;;;;;;;;;;OAaG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvF;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,iBAAkB,SAAQ,MAAM;IAC/C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAE3F;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-client.js","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { BrowserOptions, ReactNativeOptions } from '../config';\nimport { TransportType } from '../transport';\nimport { CoreClient } from './core-client';\n\ninterface Client extends CoreClient {\n /**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\n getUserId(): string | undefined;\n\n /**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\n setUserId(userId: string | undefined): void;\n\n /**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\n getDeviceId(): string | undefined;\n\n /**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\n setDeviceId(deviceId: string): void;\n\n /**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\n getSessionId(): number | undefined;\n\n /**\n * Sets a new session ID.\n * When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\n setSessionId(sessionId: number): void;\n\n /**\n * Extends the current session (advanced)\n *\n * Normally sessions are extended automatically by track()'ing events. If you want to extend the session without\n * tracking and event, this will set the last user interaction to the current time.\n *\n * ```typescript\n * extendSession();\n * ```\n */\n extendSession(): void;\n\n /**\n * Anonymizes users after they log out, by:\n *\n * * setting userId to undefined\n * * setting deviceId to a new uuid value\n *\n * With an undefined userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n *\n * ```typescript\n * import { reset } from '@amplitude/analytics-browser';\n *\n * reset();\n * ```\n */\n reset(): void;\n}\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n}\n\nexport interface ReactNativeClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: ReactNativeOptions): AmplitudeReturn<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web-client.js","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { BrowserConfig, BrowserOptions, ReactNativeConfig, ReactNativeOptions } from '../config';\nimport { TransportType } from '../transport';\nimport { CoreClient } from './core-client';\nimport { Plugin } from '../plugin';\n\ninterface Client extends CoreClient {\n /**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\n getUserId(): string | undefined;\n\n /**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\n setUserId(userId: string | undefined): void;\n\n /**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\n getDeviceId(): string | undefined;\n\n /**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\n setDeviceId(deviceId: string): void;\n\n /**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\n getSessionId(): number | undefined;\n\n /**\n * Sets a new session ID.\n * When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\n setSessionId(sessionId: number): void;\n\n /**\n * Extends the current session (advanced)\n *\n * Normally sessions are extended automatically by track()'ing events. If you want to extend the session without\n * tracking and event, this will set the last user interaction to the current time.\n *\n * ```typescript\n * extendSession();\n * ```\n */\n extendSession(): void;\n\n /**\n * Anonymizes users after they log out, by:\n *\n * * setting userId to undefined\n * * setting deviceId to a new uuid value\n *\n * With an undefined userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n *\n * ```typescript\n * import { reset } from '@amplitude/analytics-browser';\n *\n * reset();\n * ```\n */\n reset(): void;\n}\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n}\n\nexport interface ReactNativeClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: ReactNativeOptions): AmplitudeReturn<void>;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: ReactNativeConfig, amplitude: ReactNativeClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<ReactNativeClient, ReactNativeConfig>): AmplitudeReturn<void>;\n}\n"]}
|
package/lib/cjs/config/core.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/config/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU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AS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,iBAAiB,EAAE,SAAS,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,OAAQ,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/config/core.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '../event';\nimport { IngestionMetadata } from '../ingestion-metadata';\nimport { Plan } from '../plan';\nimport { ServerZone } from '../server-zone';\nimport { Storage } from '../storage';\nimport { Transport } from '../transport';\nimport { Logger, LogLevel } from '../logger';\n\nexport interface Config {\n apiKey: string;\n flushIntervalMillis: number;\n flushMaxRetries: number;\n flushQueueSize: number;\n logLevel: LogLevel;\n loggerProvider: Logger;\n minIdLength?: number;\n optOut: boolean;\n plan?: Plan;\n ingestionMetadata?: IngestionMetadata;\n serverUrl?: string;\n serverZone?: keyof typeof ServerZone;\n storageProvider?: Storage<Event[]>;\n transportProvider: Transport;\n useBatch: boolean;\n}\n\nexport interface Options extends Partial<Config> {\n apiKey: string;\n transportProvider: Transport;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/config/core.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '../event';\nimport { IngestionMetadata } from '../ingestion-metadata';\nimport { Plan } from '../plan';\nimport { ServerZone } from '../server-zone';\nimport { Storage } from '../storage';\nimport { Transport } from '../transport';\nimport { Logger, LogLevel } from '../logger';\n\nexport interface Config {\n apiKey: string;\n flushIntervalMillis: number;\n flushMaxRetries: number;\n flushQueueSize: number;\n instanceName?: string;\n logLevel: LogLevel;\n loggerProvider: Logger;\n minIdLength?: number;\n optOut: boolean;\n plan?: Plan;\n ingestionMetadata?: IngestionMetadata;\n serverUrl?: string;\n serverZone?: keyof typeof ServerZone;\n storageProvider?: Storage<Event[]>;\n transportProvider: Transport;\n useBatch: boolean;\n}\n\nexport interface Options extends Partial<Config> {\n apiKey: string;\n transportProvider: Transport;\n}\n"]}
|
|
@@ -7,6 +7,8 @@ export interface ReactNativeConfig extends BrowserConfig {
|
|
|
7
7
|
export interface ReactNativeTrackingOptions extends TrackingOptions {
|
|
8
8
|
adid?: boolean;
|
|
9
9
|
carrier?: boolean;
|
|
10
|
+
appSetId?: boolean;
|
|
11
|
+
idfv?: boolean;
|
|
10
12
|
}
|
|
11
13
|
type HiddenOptions = 'apiKey' | 'lastEventId';
|
|
12
14
|
export interface ReactNativeOptions extends Omit<Partial<ReactNativeConfig>, HiddenOptions> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,eAAe,EAAE,0BAA0B,CAAC;IAC5C,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,eAAe,EAAE,0BAA0B,CAAC;IAC5C,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE9C,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;IACzF,SAAS,CAAC,EAAE,aAAa,GAAG,MAAM,OAAO,aAAa,CAAC;CACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from '../transport';\nimport { BrowserConfig, TrackingOptions } from './browser';\n\nexport interface ReactNativeConfig extends BrowserConfig {\n trackingOptions: ReactNativeTrackingOptions;\n trackingSessionEvents?: boolean;\n}\n\nexport interface ReactNativeTrackingOptions extends TrackingOptions {\n adid?: boolean;\n carrier?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'lastEventId';\n\nexport interface ReactNativeOptions extends Omit<Partial<ReactNativeConfig>, HiddenOptions> {\n transport?: TransportType | keyof typeof TransportType;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from '../transport';\nimport { BrowserConfig, TrackingOptions } from './browser';\n\nexport interface ReactNativeConfig extends BrowserConfig {\n trackingOptions: ReactNativeTrackingOptions;\n trackingSessionEvents?: boolean;\n}\n\nexport interface ReactNativeTrackingOptions extends TrackingOptions {\n adid?: boolean;\n carrier?: boolean;\n appSetId?: boolean;\n idfv?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'lastEventId';\n\nexport interface ReactNativeOptions extends Omit<Partial<ReactNativeConfig>, HiddenOptions> {\n transport?: TransportType | keyof typeof TransportType;\n}\n"]}
|
package/lib/cjs/plugin.d.ts
CHANGED
|
@@ -7,24 +7,24 @@ export declare enum PluginType {
|
|
|
7
7
|
ENRICHMENT = "enrichment",
|
|
8
8
|
DESTINATION = "destination"
|
|
9
9
|
}
|
|
10
|
-
export interface BeforePlugin<T = CoreClient> {
|
|
10
|
+
export interface BeforePlugin<T = CoreClient, U = Config> {
|
|
11
11
|
name: string;
|
|
12
12
|
type: PluginType.BEFORE;
|
|
13
|
-
setup(config:
|
|
13
|
+
setup(config: U, client?: T): Promise<void>;
|
|
14
14
|
execute(context: Event): Promise<Event | null>;
|
|
15
15
|
}
|
|
16
|
-
export interface EnrichmentPlugin<T = CoreClient> {
|
|
16
|
+
export interface EnrichmentPlugin<T = CoreClient, U = Config> {
|
|
17
17
|
name: string;
|
|
18
18
|
type: PluginType.ENRICHMENT;
|
|
19
|
-
setup(config:
|
|
19
|
+
setup(config: U, client?: T): Promise<void>;
|
|
20
20
|
execute(context: Event): Promise<Event | null>;
|
|
21
21
|
}
|
|
22
|
-
export interface DestinationPlugin<T = CoreClient> {
|
|
22
|
+
export interface DestinationPlugin<T = CoreClient, U = Config> {
|
|
23
23
|
name: string;
|
|
24
24
|
type: PluginType.DESTINATION;
|
|
25
|
-
setup(config:
|
|
25
|
+
setup(config: U, client?: T): Promise<void>;
|
|
26
26
|
execute(context: Event): Promise<Result>;
|
|
27
27
|
flush?(): Promise<void>;
|
|
28
28
|
}
|
|
29
|
-
export type Plugin = BeforePlugin | EnrichmentPlugin | DestinationPlugin
|
|
29
|
+
export type Plugin<T = CoreClient, U = Config> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;
|
|
30
30
|
//# sourceMappingURL=plugin.d.ts.map
|
package/lib/cjs/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,WAAW,gBAAg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iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/lib/cjs/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":";;AAKA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,uCAAyB,CAAA;IACzB,yCAA2B,CAAA;AAC7B,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB","sourcesContent":["import { Event } from './event';\nimport { Config } from './config';\nimport { Result } from './result';\nimport { CoreClient } from './client/core-client';\n\nexport enum PluginType {\n BEFORE = 'before',\n ENRICHMENT = 'enrichment',\n DESTINATION = 'destination',\n}\n\nexport interface BeforePlugin<T = CoreClient> {\n name: string;\n type: PluginType.BEFORE;\n setup(config:
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":";;AAKA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,uCAAyB,CAAA;IACzB,yCAA2B,CAAA;AAC7B,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB","sourcesContent":["import { Event } from './event';\nimport { Config } from './config';\nimport { Result } from './result';\nimport { CoreClient } from './client/core-client';\n\nexport enum PluginType {\n BEFORE = 'before',\n ENRICHMENT = 'enrichment',\n DESTINATION = 'destination',\n}\n\nexport interface BeforePlugin<T = CoreClient, U = Config> {\n name: string;\n type: PluginType.BEFORE;\n setup(config: U, client?: T): Promise<void>;\n execute(context: Event): Promise<Event | null>;\n}\n\nexport interface EnrichmentPlugin<T = CoreClient, U = Config> {\n name: string;\n type: PluginType.ENRICHMENT;\n setup(config: U, client?: T): Promise<void>;\n execute(context: Event): Promise<Event | null>;\n}\n\nexport interface DestinationPlugin<T = CoreClient, U = Config> {\n name: string;\n type: PluginType.DESTINATION;\n setup(config: U, client?: T): Promise<void>;\n execute(context: Event): Promise<Result>;\n flush?(): Promise<void>;\n}\n\nexport type Plugin<T = CoreClient, U = Config> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;\n"]}
|
package/lib/esm/base-event.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-event.d.ts","sourceRoot":"","sources":["../../src/base-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IACtD,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IACrD,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;IACtD,MAAM,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAA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AAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,kBAAkB,CAAC,EAAE,8BAA8B,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-event.js","sourceRoot":"","sources":["../../src/base-event.ts"],"names":[],"mappings":"","sourcesContent":["import { Plan } from './plan';\nimport { IngestionMetadataEventProperty } from './ingestion-metadata';\n\nexport interface BaseEvent extends EventOptions {\n event_type: string;\n event_properties?: { [key: string]: any } | undefined;\n user_properties?: { [key: string]: any } | undefined;\n group_properties?: { [key: string]: any } | undefined;\n groups?: { [key: string]: any } | undefined;\n}\n\nexport interface EventOptions {\n user_id?: string;\n device_id?: string;\n time?: number;\n location_lat?: number;\n location_lng?: number;\n app_version?: string;\n version_name?: string;\n library?: string;\n platform?: string;\n os_name?: string;\n os_version?: string;\n device_brand?: string;\n device_manufacturer?: string;\n device_model?: string;\n carrier?: string;\n country?: string;\n region?: string;\n city?: string;\n dma?: string;\n idfa?: string;\n idfv?: string;\n adid?: string;\n android_id?: string;\n language?: string;\n ip?: string;\n price?: number;\n quantity?: number;\n revenue?: number;\n productId?: string;\n revenueType?: string;\n event_id?: number;\n session_id?: number;\n insert_id?: string;\n plan?: Plan;\n ingestion_metadata?: IngestionMetadataEventProperty;\n partner_id?: string;\n user_agent?: string;\n extra?: { [key: string]: any };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-event.js","sourceRoot":"","sources":["../../src/base-event.ts"],"names":[],"mappings":"","sourcesContent":["import { Plan } from './plan';\nimport { IngestionMetadataEventProperty } from './ingestion-metadata';\n\nexport interface BaseEvent extends EventOptions {\n event_type: string;\n event_properties?: { [key: string]: any } | undefined;\n user_properties?: { [key: string]: any } | undefined;\n group_properties?: { [key: string]: any } | undefined;\n groups?: { [key: string]: any } | undefined;\n}\n\nexport interface EventOptions {\n user_id?: string;\n device_id?: string;\n time?: number;\n location_lat?: number;\n location_lng?: number;\n app_version?: string;\n version_name?: string;\n library?: string;\n platform?: string;\n os_name?: string;\n os_version?: string;\n device_brand?: string;\n device_manufacturer?: string;\n device_model?: string;\n carrier?: string;\n country?: string;\n region?: string;\n city?: string;\n dma?: string;\n idfa?: string;\n idfv?: string;\n adid?: string;\n android_id?: string;\n language?: string;\n ip?: string;\n price?: number;\n quantity?: number;\n revenue?: number;\n productId?: string;\n revenueType?: string;\n event_id?: number;\n session_id?: number;\n insert_id?: string;\n plan?: Plan;\n ingestion_metadata?: IngestionMetadataEventProperty;\n partner_id?: string;\n user_agent?: string;\n android_app_set_id?: string;\n extra?: { [key: string]: any };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AmplitudeReturn } from '../amplitude-promise';
|
|
2
|
-
import { NodeOptions } from '../config';
|
|
2
|
+
import { NodeConfig, NodeOptions } from '../config';
|
|
3
3
|
import { CoreClient } from './core-client';
|
|
4
|
+
import { Plugin } from '../plugin';
|
|
4
5
|
export interface NodeClient extends CoreClient {
|
|
5
6
|
/**
|
|
6
7
|
* Initializes the Amplitude SDK with your apiKey, optional configurations.
|
|
@@ -11,5 +12,23 @@ export interface NodeClient extends CoreClient {
|
|
|
11
12
|
* ```
|
|
12
13
|
*/
|
|
13
14
|
init(apiKey: string, options?: NodeOptions): AmplitudeReturn<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Adds a new plugin.
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const plugin = {
|
|
20
|
+
* name: 'my-plugin',
|
|
21
|
+
* type: 'enrichment',
|
|
22
|
+
* async setup(config: NodeConfig, amplitude: NodeClient) {
|
|
23
|
+
* return;
|
|
24
|
+
* },
|
|
25
|
+
* async execute(event: Event) {
|
|
26
|
+
* return event;
|
|
27
|
+
* },
|
|
28
|
+
* };
|
|
29
|
+
* amplitude.add(plugin);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
add(plugin: Plugin<NodeClient, NodeConfig>): AmplitudeReturn<void>;
|
|
14
33
|
}
|
|
15
34
|
//# sourceMappingURL=node-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"node-client.d.ts","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEnE;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CACpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { NodeOptions } from '../config';\nimport { CoreClient } from './core-client';\n\nexport interface NodeClient extends CoreClient {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: NodeOptions): AmplitudeReturn<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-client.js","sourceRoot":"","sources":["../../../src/client/node-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { NodeConfig, NodeOptions } from '../config';\nimport { CoreClient } from './core-client';\nimport { Plugin } from '../plugin';\n\nexport interface NodeClient extends CoreClient {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: NodeOptions): AmplitudeReturn<void>;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: NodeConfig, amplitude: NodeClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<NodeClient, NodeConfig>): AmplitudeReturn<void>;\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AmplitudeReturn } from '../amplitude-promise';
|
|
2
|
-
import { BrowserOptions, ReactNativeOptions } from '../config';
|
|
2
|
+
import { BrowserConfig, BrowserOptions, ReactNativeConfig, ReactNativeOptions } from '../config';
|
|
3
3
|
import { TransportType } from '../transport';
|
|
4
4
|
import { CoreClient } from './core-client';
|
|
5
|
+
import { Plugin } from '../plugin';
|
|
5
6
|
interface Client extends CoreClient {
|
|
6
7
|
/**
|
|
7
8
|
* Returns current user ID.
|
|
@@ -106,6 +107,24 @@ export interface BrowserClient extends Client {
|
|
|
106
107
|
* ```
|
|
107
108
|
*/
|
|
108
109
|
setTransport(transport: TransportType): void;
|
|
110
|
+
/**
|
|
111
|
+
* Adds a new plugin.
|
|
112
|
+
*
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const plugin = {
|
|
115
|
+
* name: 'my-plugin',
|
|
116
|
+
* type: 'enrichment',
|
|
117
|
+
* async setup(config: BrowserConfig, amplitude: BrowserClient) {
|
|
118
|
+
* return;
|
|
119
|
+
* },
|
|
120
|
+
* async execute(event: Event) {
|
|
121
|
+
* return event;
|
|
122
|
+
* },
|
|
123
|
+
* };
|
|
124
|
+
* amplitude.add(plugin);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;
|
|
109
128
|
}
|
|
110
129
|
export interface ReactNativeClient extends Client {
|
|
111
130
|
/**
|
|
@@ -117,6 +136,24 @@ export interface ReactNativeClient extends Client {
|
|
|
117
136
|
* ```
|
|
118
137
|
*/
|
|
119
138
|
init(apiKey: string, userId?: string, options?: ReactNativeOptions): AmplitudeReturn<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Adds a new plugin.
|
|
141
|
+
*
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const plugin = {
|
|
144
|
+
* name: 'my-plugin',
|
|
145
|
+
* type: 'enrichment',
|
|
146
|
+
* async setup(config: ReactNativeConfig, amplitude: ReactNativeClient) {
|
|
147
|
+
* return;
|
|
148
|
+
* },
|
|
149
|
+
* async execute(event: Event) {
|
|
150
|
+
* return event;
|
|
151
|
+
* },
|
|
152
|
+
* };
|
|
153
|
+
* amplitude.add(plugin);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
add(plugin: Plugin<ReactNativeClient, ReactNativeConfig>): AmplitudeReturn<void>;
|
|
120
157
|
}
|
|
121
158
|
export {};
|
|
122
159
|
//# sourceMappingURL=web-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-client.d.ts","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"web-client.d.ts","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,UAAU,MAAO,SAAQ,UAAU;IACjC;;;;;;OAMG;IACH,SAAS,IAAI,MAAM,GAAG,SAAS,CAAC;IAEhC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAE5C;;;;;;OAMG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAAC;IAElC;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;;;;;;;;OASG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;;;;;;;;;;OAaG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvF;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,iBAAkB,SAAQ,MAAM;IAC/C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAE3F;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;CAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-client.js","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { BrowserOptions, ReactNativeOptions } from '../config';\nimport { TransportType } from '../transport';\nimport { CoreClient } from './core-client';\n\ninterface Client extends CoreClient {\n /**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\n getUserId(): string | undefined;\n\n /**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\n setUserId(userId: string | undefined): void;\n\n /**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\n getDeviceId(): string | undefined;\n\n /**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\n setDeviceId(deviceId: string): void;\n\n /**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\n getSessionId(): number | undefined;\n\n /**\n * Sets a new session ID.\n * When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\n setSessionId(sessionId: number): void;\n\n /**\n * Extends the current session (advanced)\n *\n * Normally sessions are extended automatically by track()'ing events. If you want to extend the session without\n * tracking and event, this will set the last user interaction to the current time.\n *\n * ```typescript\n * extendSession();\n * ```\n */\n extendSession(): void;\n\n /**\n * Anonymizes users after they log out, by:\n *\n * * setting userId to undefined\n * * setting deviceId to a new uuid value\n *\n * With an undefined userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n *\n * ```typescript\n * import { reset } from '@amplitude/analytics-browser';\n *\n * reset();\n * ```\n */\n reset(): void;\n}\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n}\n\nexport interface ReactNativeClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: ReactNativeOptions): AmplitudeReturn<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web-client.js","sourceRoot":"","sources":["../../../src/client/web-client.ts"],"names":[],"mappings":"","sourcesContent":["import { AmplitudeReturn } from '../amplitude-promise';\nimport { BrowserConfig, BrowserOptions, ReactNativeConfig, ReactNativeOptions } from '../config';\nimport { TransportType } from '../transport';\nimport { CoreClient } from './core-client';\nimport { Plugin } from '../plugin';\n\ninterface Client extends CoreClient {\n /**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\n getUserId(): string | undefined;\n\n /**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\n setUserId(userId: string | undefined): void;\n\n /**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\n getDeviceId(): string | undefined;\n\n /**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\n setDeviceId(deviceId: string): void;\n\n /**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\n getSessionId(): number | undefined;\n\n /**\n * Sets a new session ID.\n * When setting a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\n setSessionId(sessionId: number): void;\n\n /**\n * Extends the current session (advanced)\n *\n * Normally sessions are extended automatically by track()'ing events. If you want to extend the session without\n * tracking and event, this will set the last user interaction to the current time.\n *\n * ```typescript\n * extendSession();\n * ```\n */\n extendSession(): void;\n\n /**\n * Anonymizes users after they log out, by:\n *\n * * setting userId to undefined\n * * setting deviceId to a new uuid value\n *\n * With an undefined userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n *\n * ```typescript\n * import { reset } from '@amplitude/analytics-browser';\n *\n * reset();\n * ```\n */\n reset(): void;\n}\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n}\n\nexport interface ReactNativeClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, userId?: string, options?: ReactNativeOptions): AmplitudeReturn<void>;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: ReactNativeConfig, amplitude: ReactNativeClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<ReactNativeClient, ReactNativeConfig>): AmplitudeReturn<void>;\n}\n"]}
|
package/lib/esm/config/core.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/config/core.ts"],"names":[],"mappings":"AAAA,O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1D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,iBAAiB,EAAE,SAAS,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,OAAQ,SAAQ,OAAO,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,CAAC;CAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/config/core.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '../event';\nimport { IngestionMetadata } from '../ingestion-metadata';\nimport { Plan } from '../plan';\nimport { ServerZone } from '../server-zone';\nimport { Storage } from '../storage';\nimport { Transport } from '../transport';\nimport { Logger, LogLevel } from '../logger';\n\nexport interface Config {\n apiKey: string;\n flushIntervalMillis: number;\n flushMaxRetries: number;\n flushQueueSize: number;\n logLevel: LogLevel;\n loggerProvider: Logger;\n minIdLength?: number;\n optOut: boolean;\n plan?: Plan;\n ingestionMetadata?: IngestionMetadata;\n serverUrl?: string;\n serverZone?: keyof typeof ServerZone;\n storageProvider?: Storage<Event[]>;\n transportProvider: Transport;\n useBatch: boolean;\n}\n\nexport interface Options extends Partial<Config> {\n apiKey: string;\n transportProvider: Transport;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/config/core.ts"],"names":[],"mappings":"","sourcesContent":["import { Event } from '../event';\nimport { IngestionMetadata } from '../ingestion-metadata';\nimport { Plan } from '../plan';\nimport { ServerZone } from '../server-zone';\nimport { Storage } from '../storage';\nimport { Transport } from '../transport';\nimport { Logger, LogLevel } from '../logger';\n\nexport interface Config {\n apiKey: string;\n flushIntervalMillis: number;\n flushMaxRetries: number;\n flushQueueSize: number;\n instanceName?: string;\n logLevel: LogLevel;\n loggerProvider: Logger;\n minIdLength?: number;\n optOut: boolean;\n plan?: Plan;\n ingestionMetadata?: IngestionMetadata;\n serverUrl?: string;\n serverZone?: keyof typeof ServerZone;\n storageProvider?: Storage<Event[]>;\n transportProvider: Transport;\n useBatch: boolean;\n}\n\nexport interface Options extends Partial<Config> {\n apiKey: string;\n transportProvider: Transport;\n}\n"]}
|
|
@@ -7,6 +7,8 @@ export interface ReactNativeConfig extends BrowserConfig {
|
|
|
7
7
|
export interface ReactNativeTrackingOptions extends TrackingOptions {
|
|
8
8
|
adid?: boolean;
|
|
9
9
|
carrier?: boolean;
|
|
10
|
+
appSetId?: boolean;
|
|
11
|
+
idfv?: boolean;
|
|
10
12
|
}
|
|
11
13
|
type HiddenOptions = 'apiKey' | 'lastEventId';
|
|
12
14
|
export interface ReactNativeOptions extends Omit<Partial<ReactNativeConfig>, HiddenOptions> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,eAAe,EAAE,0BAA0B,CAAC;IAC5C,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE3D,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,eAAe,EAAE,0BAA0B,CAAC;IAC5C,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE9C,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;IACzF,SAAS,CAAC,EAAE,aAAa,GAAG,MAAM,OAAO,aAAa,CAAC;CACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from '../transport';\nimport { BrowserConfig, TrackingOptions } from './browser';\n\nexport interface ReactNativeConfig extends BrowserConfig {\n trackingOptions: ReactNativeTrackingOptions;\n trackingSessionEvents?: boolean;\n}\n\nexport interface ReactNativeTrackingOptions extends TrackingOptions {\n adid?: boolean;\n carrier?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'lastEventId';\n\nexport interface ReactNativeOptions extends Omit<Partial<ReactNativeConfig>, HiddenOptions> {\n transport?: TransportType | keyof typeof TransportType;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"react-native.js","sourceRoot":"","sources":["../../../src/config/react-native.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from '../transport';\nimport { BrowserConfig, TrackingOptions } from './browser';\n\nexport interface ReactNativeConfig extends BrowserConfig {\n trackingOptions: ReactNativeTrackingOptions;\n trackingSessionEvents?: boolean;\n}\n\nexport interface ReactNativeTrackingOptions extends TrackingOptions {\n adid?: boolean;\n carrier?: boolean;\n appSetId?: boolean;\n idfv?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'lastEventId';\n\nexport interface ReactNativeOptions extends Omit<Partial<ReactNativeConfig>, HiddenOptions> {\n transport?: TransportType | keyof typeof TransportType;\n}\n"]}
|
package/lib/esm/plugin.d.ts
CHANGED
|
@@ -7,24 +7,24 @@ export declare enum PluginType {
|
|
|
7
7
|
ENRICHMENT = "enrichment",
|
|
8
8
|
DESTINATION = "destination"
|
|
9
9
|
}
|
|
10
|
-
export interface BeforePlugin<T = CoreClient> {
|
|
10
|
+
export interface BeforePlugin<T = CoreClient, U = Config> {
|
|
11
11
|
name: string;
|
|
12
12
|
type: PluginType.BEFORE;
|
|
13
|
-
setup(config:
|
|
13
|
+
setup(config: U, client?: T): Promise<void>;
|
|
14
14
|
execute(context: Event): Promise<Event | null>;
|
|
15
15
|
}
|
|
16
|
-
export interface EnrichmentPlugin<T = CoreClient> {
|
|
16
|
+
export interface EnrichmentPlugin<T = CoreClient, U = Config> {
|
|
17
17
|
name: string;
|
|
18
18
|
type: PluginType.ENRICHMENT;
|
|
19
|
-
setup(config:
|
|
19
|
+
setup(config: U, client?: T): Promise<void>;
|
|
20
20
|
execute(context: Event): Promise<Event | null>;
|
|
21
21
|
}
|
|
22
|
-
export interface DestinationPlugin<T = CoreClient> {
|
|
22
|
+
export interface DestinationPlugin<T = CoreClient, U = Config> {
|
|
23
23
|
name: string;
|
|
24
24
|
type: PluginType.DESTINATION;
|
|
25
|
-
setup(config:
|
|
25
|
+
setup(config: U, client?: T): Promise<void>;
|
|
26
26
|
execute(context: Event): Promise<Result>;
|
|
27
27
|
flush?(): Promise<void>;
|
|
28
28
|
}
|
|
29
|
-
export type Plugin = BeforePlugin | EnrichmentPlugin | DestinationPlugin
|
|
29
|
+
export type Plugin<T = CoreClient, U = Config> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;
|
|
30
30
|
//# sourceMappingURL=plugin.d.ts.map
|
package/lib/esm/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,O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;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,GAAG,MAAM,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/lib/esm/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,uCAAyB,CAAA;IACzB,yCAA2B,CAAA;AAC7B,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB","sourcesContent":["import { Event } from './event';\nimport { Config } from './config';\nimport { Result } from './result';\nimport { CoreClient } from './client/core-client';\n\nexport enum PluginType {\n BEFORE = 'before',\n ENRICHMENT = 'enrichment',\n DESTINATION = 'destination',\n}\n\nexport interface BeforePlugin<T = CoreClient> {\n name: string;\n type: PluginType.BEFORE;\n setup(config:
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,uCAAyB,CAAA;IACzB,yCAA2B,CAAA;AAC7B,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB","sourcesContent":["import { Event } from './event';\nimport { Config } from './config';\nimport { Result } from './result';\nimport { CoreClient } from './client/core-client';\n\nexport enum PluginType {\n BEFORE = 'before',\n ENRICHMENT = 'enrichment',\n DESTINATION = 'destination',\n}\n\nexport interface BeforePlugin<T = CoreClient, U = Config> {\n name: string;\n type: PluginType.BEFORE;\n setup(config: U, client?: T): Promise<void>;\n execute(context: Event): Promise<Event | null>;\n}\n\nexport interface EnrichmentPlugin<T = CoreClient, U = Config> {\n name: string;\n type: PluginType.ENRICHMENT;\n setup(config: U, client?: T): Promise<void>;\n execute(context: Event): Promise<Event | null>;\n}\n\nexport interface DestinationPlugin<T = CoreClient, U = Config> {\n name: string;\n type: PluginType.DESTINATION;\n setup(config: U, client?: T): Promise<void>;\n execute(context: Event): Promise<Result>;\n flush?(): Promise<void>;\n}\n\nexport type Plugin<T = CoreClient, U = Config> = BeforePlugin<T, U> | EnrichmentPlugin<T, U> | DestinationPlugin<T, U>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"types": "lib/esm/index.d.ts",
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
13
|
+
"access": "public",
|
|
14
|
+
"tag": "v1"
|
|
14
15
|
},
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"files": [
|
|
35
36
|
"lib"
|
|
36
37
|
],
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "01c20d61e8c51b59dc7fdf83d4abd57391aecf71"
|
|
38
39
|
}
|