@amplitude/analytics-core 2.9.0 → 2.10.1
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/core-client.d.ts +36 -4
- package/lib/cjs/core-client.d.ts.map +1 -1
- package/lib/cjs/core-client.js +89 -2
- package/lib/cjs/core-client.js.map +1 -1
- package/lib/cjs/identify.d.ts +4 -0
- package/lib/cjs/identify.d.ts.map +1 -1
- package/lib/cjs/identify.js +16 -1
- package/lib/cjs/identify.js.map +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +4 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/network-observer.d.ts +44 -0
- package/lib/cjs/network-observer.d.ts.map +1 -0
- package/lib/cjs/network-observer.js +170 -0
- package/lib/cjs/network-observer.js.map +1 -0
- package/lib/cjs/timeline.d.ts +4 -1
- package/lib/cjs/timeline.d.ts.map +1 -1
- package/lib/cjs/timeline.js +30 -0
- package/lib/cjs/timeline.js.map +1 -1
- package/lib/cjs/types/event/event.d.ts +33 -0
- package/lib/cjs/types/event/event.d.ts.map +1 -1
- package/lib/cjs/types/event/event.js.map +1 -1
- package/lib/cjs/types/plugin.d.ts +22 -0
- package/lib/cjs/types/plugin.d.ts.map +1 -1
- package/lib/cjs/types/plugin.js.map +1 -1
- package/lib/esm/core-client.d.ts +36 -4
- package/lib/esm/core-client.d.ts.map +1 -1
- package/lib/esm/core-client.js +89 -2
- package/lib/esm/core-client.js.map +1 -1
- package/lib/esm/identify.d.ts +4 -0
- package/lib/esm/identify.d.ts.map +1 -1
- package/lib/esm/identify.js +15 -0
- package/lib/esm/identify.js.map +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/network-observer.d.ts +44 -0
- package/lib/esm/network-observer.d.ts.map +1 -0
- package/lib/esm/network-observer.js +166 -0
- package/lib/esm/network-observer.js.map +1 -0
- package/lib/esm/timeline.d.ts +4 -1
- package/lib/esm/timeline.d.ts.map +1 -1
- package/lib/esm/timeline.js +30 -0
- package/lib/esm/timeline.js.map +1 -1
- package/lib/esm/types/event/event.d.ts +33 -0
- package/lib/esm/types/event/event.d.ts.map +1 -1
- package/lib/esm/types/event/event.js.map +1 -1
- package/lib/esm/types/plugin.d.ts +22 -0
- package/lib/esm/types/plugin.d.ts.map +1 -1
- package/lib/esm/types/plugin.js.map +1 -1
- package/package.json +3 -2
package/lib/cjs/core-client.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ import { Plugin } from './types/plugin';
|
|
|
2
2
|
import { IConfig } from './config';
|
|
3
3
|
import { BaseEvent, EventOptions } from './types/event/base-event';
|
|
4
4
|
import { Result } from './types/result';
|
|
5
|
-
import { Event } from './types/event/event';
|
|
5
|
+
import { Event, UserProperties } from './types/event/event';
|
|
6
6
|
import { IIdentify } from './identify';
|
|
7
7
|
import { IRevenue } from './revenue';
|
|
8
8
|
import { Timeline } from './timeline';
|
|
9
|
-
import { returnWrapper } from './utils/return-wrapper';
|
|
10
|
-
|
|
9
|
+
import { AmplitudeReturn, returnWrapper } from './utils/return-wrapper';
|
|
10
|
+
interface PluginHost {
|
|
11
|
+
plugin(name: string): Plugin | undefined;
|
|
12
|
+
}
|
|
11
13
|
export interface CoreClient {
|
|
12
14
|
/**
|
|
13
15
|
* Adds a new plugin.
|
|
@@ -141,7 +143,7 @@ export interface CoreClient {
|
|
|
141
143
|
*/
|
|
142
144
|
flush(): AmplitudeReturn<void>;
|
|
143
145
|
}
|
|
144
|
-
export declare class AmplitudeCore implements CoreClient {
|
|
146
|
+
export declare class AmplitudeCore implements CoreClient, PluginHost {
|
|
145
147
|
protected initializing: boolean;
|
|
146
148
|
protected name: string;
|
|
147
149
|
config: IConfig;
|
|
@@ -164,9 +166,39 @@ export declare class AmplitudeCore implements CoreClient {
|
|
|
164
166
|
_removePlugin(pluginName: string): AmplitudeReturn<void>;
|
|
165
167
|
dispatchWithCallback(event: Event, callback: (result: Result) => void): void;
|
|
166
168
|
dispatch(event: Event): Promise<Result>;
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* This method applies identify operations to user properties and
|
|
172
|
+
* returns a single object representing the final user property state.
|
|
173
|
+
*
|
|
174
|
+
* This is a best-effort api that only supports $set, $clearAll, and $unset.
|
|
175
|
+
* Other operations are not supported and are ignored.
|
|
176
|
+
*
|
|
177
|
+
*
|
|
178
|
+
* @param userProperties The `event.userProperties` object from an Identify event.
|
|
179
|
+
* @returns A key-value object user properties without operations.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* Input:
|
|
183
|
+
* {
|
|
184
|
+
* $set: { plan: 'premium' },
|
|
185
|
+
* custom_flag: true
|
|
186
|
+
* }
|
|
187
|
+
*
|
|
188
|
+
* Output:
|
|
189
|
+
* {
|
|
190
|
+
* plan: 'premium',
|
|
191
|
+
* custom_flag: true
|
|
192
|
+
* }
|
|
193
|
+
*/
|
|
194
|
+
getOperationAppliedUserProperties(userProperties: UserProperties | undefined): {
|
|
195
|
+
[key: string]: any;
|
|
196
|
+
};
|
|
167
197
|
process(event: Event): Promise<Result>;
|
|
168
198
|
setOptOut(optOut: boolean): void;
|
|
169
199
|
_setOptOut(optOut: boolean): void;
|
|
170
200
|
flush(): AmplitudeReturn<void>;
|
|
201
|
+
plugin(name: string): Plugin | undefined;
|
|
171
202
|
}
|
|
203
|
+
export {};
|
|
172
204
|
//# sourceMappingURL=core-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client.d.ts","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BA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AAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IA8B5C,SAAS,CAAC,MAAM,EAAE,OAAO;IAQzB,UAAU,CAAC,MAAM,EAAE,OAAO;IAO1B,KAAK;IAIL,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CASzC"}
|
package/lib/cjs/core-client.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AmplitudeCore = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
var event_1 = require("./types/event/event");
|
|
6
|
+
var identify_1 = require("./identify");
|
|
5
7
|
var messages_1 = require("./types/messages");
|
|
6
8
|
var timeline_1 = require("./timeline");
|
|
7
9
|
var event_builder_1 = require("./utils/event-builder");
|
|
@@ -145,9 +147,79 @@ var AmplitudeCore = /** @class */ (function () {
|
|
|
145
147
|
});
|
|
146
148
|
});
|
|
147
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* This method applies identify operations to user properties and
|
|
153
|
+
* returns a single object representing the final user property state.
|
|
154
|
+
*
|
|
155
|
+
* This is a best-effort api that only supports $set, $clearAll, and $unset.
|
|
156
|
+
* Other operations are not supported and are ignored.
|
|
157
|
+
*
|
|
158
|
+
*
|
|
159
|
+
* @param userProperties The `event.userProperties` object from an Identify event.
|
|
160
|
+
* @returns A key-value object user properties without operations.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* Input:
|
|
164
|
+
* {
|
|
165
|
+
* $set: { plan: 'premium' },
|
|
166
|
+
* custom_flag: true
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* Output:
|
|
170
|
+
* {
|
|
171
|
+
* plan: 'premium',
|
|
172
|
+
* custom_flag: true
|
|
173
|
+
* }
|
|
174
|
+
*/
|
|
175
|
+
AmplitudeCore.prototype.getOperationAppliedUserProperties = function (userProperties) {
|
|
176
|
+
var updatedProperties = {};
|
|
177
|
+
if (userProperties === undefined) {
|
|
178
|
+
return updatedProperties;
|
|
179
|
+
}
|
|
180
|
+
// Keep non-operation keys for later merge
|
|
181
|
+
var nonOpProperties = {};
|
|
182
|
+
Object.keys(userProperties).forEach(function (key) {
|
|
183
|
+
if (!Object.values(event_1.IdentifyOperation).includes(key)) {
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
187
|
+
nonOpProperties[key] = userProperties[key];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
identify_1.OrderedIdentifyOperations.forEach(function (operation) {
|
|
191
|
+
// Skip when key is an operation.
|
|
192
|
+
if (!Object.keys(userProperties).includes(operation))
|
|
193
|
+
return;
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
195
|
+
var opProperties = userProperties[operation];
|
|
196
|
+
switch (operation) {
|
|
197
|
+
case event_1.IdentifyOperation.CLEAR_ALL:
|
|
198
|
+
// Due to operation order, the following line will never execute.
|
|
199
|
+
/* istanbul ignore next */
|
|
200
|
+
Object.keys(updatedProperties).forEach(function (prop) {
|
|
201
|
+
delete updatedProperties[prop];
|
|
202
|
+
});
|
|
203
|
+
break;
|
|
204
|
+
case event_1.IdentifyOperation.UNSET:
|
|
205
|
+
Object.keys(opProperties).forEach(function (prop) {
|
|
206
|
+
delete updatedProperties[prop];
|
|
207
|
+
});
|
|
208
|
+
break;
|
|
209
|
+
case event_1.IdentifyOperation.SET:
|
|
210
|
+
Object.assign(updatedProperties, opProperties);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
// Merge non-operation properties.
|
|
215
|
+
// Custom properties should not be affected by operations.
|
|
216
|
+
// https://github.com/amplitude/nova/blob/343f678ded83c032e83b189796b3c2be161b48f5/src/main/java/com/amplitude/userproperty/model/ModifyUserPropertiesIdent.java#L79-L83
|
|
217
|
+
Object.assign(updatedProperties, nonOpProperties);
|
|
218
|
+
return updatedProperties;
|
|
219
|
+
};
|
|
148
220
|
AmplitudeCore.prototype.process = function (event) {
|
|
149
221
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var result, e_2, message, result;
|
|
222
|
+
var userProperties, result, e_2, message, result;
|
|
151
223
|
return tslib_1.__generator(this, function (_a) {
|
|
152
224
|
switch (_a.label) {
|
|
153
225
|
case 0:
|
|
@@ -156,6 +228,10 @@ var AmplitudeCore = /** @class */ (function () {
|
|
|
156
228
|
if (this.config.optOut) {
|
|
157
229
|
return [2 /*return*/, (0, result_builder_1.buildResult)(event, 0, messages_1.OPT_OUT_MESSAGE)];
|
|
158
230
|
}
|
|
231
|
+
if (event.event_type === event_1.SpecialEventType.IDENTIFY) {
|
|
232
|
+
userProperties = this.getOperationAppliedUserProperties(event.user_properties);
|
|
233
|
+
this.timeline.onIdentityChanged({ userProperties: userProperties });
|
|
234
|
+
}
|
|
159
235
|
return [4 /*yield*/, this.timeline.push(event)];
|
|
160
236
|
case 1:
|
|
161
237
|
result = _a.sent();
|
|
@@ -184,11 +260,22 @@ var AmplitudeCore = /** @class */ (function () {
|
|
|
184
260
|
this._setOptOut(optOut);
|
|
185
261
|
};
|
|
186
262
|
AmplitudeCore.prototype._setOptOut = function (optOut) {
|
|
187
|
-
this.config.optOut
|
|
263
|
+
if (this.config.optOut !== optOut) {
|
|
264
|
+
this.timeline.onOptOutChanged(optOut);
|
|
265
|
+
this.config.optOut = Boolean(optOut);
|
|
266
|
+
}
|
|
188
267
|
};
|
|
189
268
|
AmplitudeCore.prototype.flush = function () {
|
|
190
269
|
return (0, return_wrapper_1.returnWrapper)(this.timeline.flush());
|
|
191
270
|
};
|
|
271
|
+
AmplitudeCore.prototype.plugin = function (name) {
|
|
272
|
+
var plugin = this.timeline.plugins.find(function (plugin) { return plugin.name === name; });
|
|
273
|
+
if (plugin === undefined) {
|
|
274
|
+
this.config.loggerProvider.debug("Cannot find plugin with name ".concat(name));
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
return plugin;
|
|
278
|
+
};
|
|
192
279
|
return AmplitudeCore;
|
|
193
280
|
}());
|
|
194
281
|
exports.AmplitudeCore = AmplitudeCore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client.js","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":";;;;AAOA,6CAA2E;AAC3E,uCAAsC;AACtC,uDAM+B;AAC/B,yDAAqD;AACrD,yDAAuD;AA+JvD;IAaE,uBAAY,IAAiB;QAAjB,qBAAA,EAAA,iBAAiB;QAZnB,iBAAY,GAAG,KAAK,CAAC;QAQ/B,YAAO,GAAG,KAAK,CAAC;QACN,MAAC,GAAmD,EAAE,CAAC;QACvD,cAAS,GAA4B,EAAE,CAAC;QAuClD,aAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QApC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEe,6BAAK,GAArB,UAAsB,MAAe;;;;;wBACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;wBACrB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;wBAC1B,qBAAM,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAA;;wBAAlC,SAAkC,CAAC;wBACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;;;;;KACrB;IAEK,0CAAkB,GAAxB,UAAyB,SAA4B;;;;;;;wBAC7C,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;wBACxC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;;;;wBACQ,oBAAA,iBAAA,eAAe,CAAA;;;;wBAAjC,cAAc;wBAIjB,GA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MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wBAErD,sBAAO,MAAM,EAAC;;;wBAER,OAAO,GAAG,MAAM,CAAC,GAAC,CAAC,CAAC;wBAC1B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBACpC,MAAM,GAAG,IAAA,4BAAW,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;wBAE9C,sBAAO,MAAM,EAAC;;;;;KAEjB;IAED,iCAAS,GAAT,UAAU,MAAe;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzD,OAAO;SACR;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,kCAAU,GAAV,UAAW,MAAe;QACxB,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,6BAAK,GAAL;QACE,OAAO,IAAA,8BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IACH,oBAAC;AAAD,CAAC,AAzJD,IAyJC;AAzJY,sCAAa","sourcesContent":["import { Plugin } from './types/plugin';\nimport { IConfig } from './config';\nimport { BaseEvent, EventOptions } from './types/event/base-event';\nimport { Result } from './types/result';\nimport { Event } from './types/event/event';\nimport { IIdentify } from './identify';\nimport { IRevenue } from './revenue';\nimport { CLIENT_NOT_INITIALIZED, OPT_OUT_MESSAGE } from './types/messages';\nimport { Timeline } from './timeline';\nimport {\n createGroupEvent,\n createGroupIdentifyEvent,\n createIdentifyEvent,\n createRevenueEvent,\n createTrackEvent,\n} from './utils/event-builder';\nimport { buildResult } from './utils/result-builder';\nimport { returnWrapper } from './utils/return-wrapper';\nimport { AmplitudeReturn } from './utils/return-wrapper';\n\nexport interface CoreClient {\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'myPlugin',\n * type: 'enrichment',\n * setup(config: Config) {\n * return;\n * },\n * execute(context: Event) {\n * return context;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin): AmplitudeReturn<void>;\n\n /**\n * Removes a plugin.\n *\n * ```typescript\n * amplitude.remove('myPlugin');\n * ```\n */\n remove(pluginName: string): AmplitudeReturn<void>;\n\n /**\n * Tracks user-defined event, with specified type, optional event properties and optional overwrites.\n *\n * ```typescript\n * // event tracking with event type only\n * track('Page Load');\n *\n * // event tracking with event type and additional event properties\n * track('Page Load', { loadTime: 1000 });\n *\n * // event tracking with event type, additional event properties, and overwritten event options\n * track('Page Load', { loadTime: 1000 }, { sessionId: -1 });\n *\n * // alternatively, this tracking method is awaitable\n * const result = await track('Page Load').promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n track(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Alias for track()\n */\n logEvent(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Sends an identify event containing user property operations\n *\n * ```typescript\n * const id = new Identify();\n * id.set('colors', ['rose', 'gold']);\n * identify(id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await identify(id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n identify(identify: IIdentify, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a group identify event containing group property operations.\n *\n * ```typescript\n * const id = new Identify();\n * id.set('skills', ['js', 'ts']);\n * const groupType = 'org';\n * const groupName = 'engineering';\n * groupIdentify(groupType, groupName, id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await groupIdentify(groupType, groupName, id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n groupIdentify(\n groupType: string,\n groupName: string | string[],\n identify: IIdentify,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Assigns a user to group\n *\n * ```typescript\n * const groupType = 'orgId';\n * const groupName = '15';\n * setGroup(groupType, groupName, { user_id: '12345' })\n * ```\n */\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a revenue event containing revenue property operations.\n *\n * ```typescript\n * const rev = new Revenue();\n * rev.setRevenue(100);\n * revenue(rev);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await revenue(rev).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n revenue(revenue: IRevenue, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sets a new optOut config value. This toggles event tracking on/off.\n *\n *```typescript\n * // Stops tracking\n * setOptOut(true);\n *\n * // Starts/resumes tracking\n * setOptOut(false);\n * ```\n */\n setOptOut(optOut: boolean): void;\n\n /**\n * Flush all unsent events.\n *\n *```typescript\n * flush();\n * ```\n */\n flush(): AmplitudeReturn<void>;\n}\n\nexport class AmplitudeCore implements CoreClient {\n protected initializing = false;\n protected name: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: IConfig;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n timeline: Timeline;\n isReady = false;\n protected q: Array<CallableFunction | typeof returnWrapper> = [];\n protected dispatchQ: Array<CallableFunction> = [];\n\n constructor(name = '$default') {\n this.timeline = new Timeline(this);\n this.name = name;\n }\n\n protected async _init(config: IConfig) {\n this.config = config;\n this.timeline.reset(this);\n await this.runQueuedFunctions('q');\n this.isReady = true;\n }\n\n async runQueuedFunctions(queueName: 'q' | 'dispatchQ') {\n const queuedFunctions = this[queueName];\n this[queueName] = [];\n for (const queuedFunction of queuedFunctions) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const val: ReturnType<typeof returnWrapper> | Promise<any> = queuedFunction();\n if (val && 'promise' in val) {\n await val.promise;\n } else {\n await val;\n }\n }\n // Rerun queued functions if the queue has accrued more while awaiting promises\n if (this[queueName].length) {\n await this.runQueuedFunctions(queueName);\n }\n }\n\n track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions) {\n const event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n logEvent = this.track.bind(this);\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n const event = createIdentifyEvent(identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n const event = createGroupIdentifyEvent(groupType, groupName, identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions) {\n const event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n const event = createRevenueEvent(revenue, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n add(plugin: Plugin) {\n if (!this.isReady) {\n this.q.push(this._addPlugin.bind(this, plugin));\n return returnWrapper();\n }\n return this._addPlugin(plugin);\n }\n\n _addPlugin(plugin: Plugin) {\n return returnWrapper(this.timeline.register(plugin, this.config));\n }\n\n remove(pluginName: string) {\n if (!this.isReady) {\n this.q.push(this._removePlugin.bind(this, pluginName));\n return returnWrapper();\n }\n return this._removePlugin(pluginName);\n }\n\n _removePlugin(pluginName: string) {\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n }\n\n dispatchWithCallback(event: Event, callback: (result: Result) => void): void {\n if (!this.isReady) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n }\n\n async dispatch(event: Event): Promise<Result> {\n if (!this.isReady) {\n return new Promise<Result>((resolve) => {\n this.dispatchQ.push(this.dispatchWithCallback.bind(this, event, resolve));\n });\n }\n\n return this.process(event);\n }\n\n async process(event: Event): Promise<Result> {\n try {\n // skip event processing if opt out\n if (this.config.optOut) {\n return buildResult(event, 0, OPT_OUT_MESSAGE);\n }\n\n const result = await this.timeline.push(event);\n\n result.code === 200\n ? this.config.loggerProvider.log(result.message)\n : result.code === 100\n ? this.config.loggerProvider.warn(result.message)\n : this.config.loggerProvider.error(result.message);\n\n return result;\n } catch (e) {\n const message = String(e);\n this.config.loggerProvider.error(message);\n const result = buildResult(event, 0, message);\n\n return result;\n }\n }\n\n setOptOut(optOut: boolean) {\n if (!this.isReady) {\n this.q.push(this._setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this._setOptOut(optOut);\n }\n\n _setOptOut(optOut: boolean) {\n this.config.optOut = Boolean(optOut);\n }\n\n flush() {\n return returnWrapper(this.timeline.flush());\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core-client.js","sourceRoot":"","sources":["../../src/core-client.ts"],"names":[],"mappings":";;;;AAIA,6CAM6B;AAC7B,uCAAkE;AAElE,6CAA2E;AAC3E,uCAAsC;AACtC,uDAM+B;AAC/B,yDAAqD;AACrD,yDAAwE;AAkKxE;IAaE,uBAAY,IAAiB;QAAjB,qBAAA,EAAA,iBAAiB;QAZnB,iBAAY,GAAG,KAAK,CAAC;QAQ/B,YAAO,GAAG,KAAK,CAAC;QACN,MAAC,GAAmD,EAAE,CAAC;QACvD,cAAS,GAA4B,EAAE,CAAC;QAuClD,aAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,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O,MAAM,CAAC;IAChB,CAAC;IACH,oBAAC;AAAD,CAAC,AA1PD,IA0PC;AA1PY,sCAAa","sourcesContent":["import { Plugin } from './types/plugin';\nimport { IConfig } from './config';\nimport { BaseEvent, EventOptions } from './types/event/base-event';\nimport { Result } from './types/result';\nimport {\n Event,\n IdentifyOperation,\n IdentifyUserProperties,\n SpecialEventType,\n UserProperties,\n} from './types/event/event';\nimport { IIdentify, OrderedIdentifyOperations } from './identify';\nimport { IRevenue } from './revenue';\nimport { CLIENT_NOT_INITIALIZED, OPT_OUT_MESSAGE } from './types/messages';\nimport { Timeline } from './timeline';\nimport {\n createGroupEvent,\n createGroupIdentifyEvent,\n createIdentifyEvent,\n createRevenueEvent,\n createTrackEvent,\n} from './utils/event-builder';\nimport { buildResult } from './utils/result-builder';\nimport { AmplitudeReturn, returnWrapper } from './utils/return-wrapper';\n\ninterface PluginHost {\n plugin(name: string): Plugin | undefined;\n}\n\nexport interface CoreClient {\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'myPlugin',\n * type: 'enrichment',\n * setup(config: Config) {\n * return;\n * },\n * execute(context: Event) {\n * return context;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin): AmplitudeReturn<void>;\n\n /**\n * Removes a plugin.\n *\n * ```typescript\n * amplitude.remove('myPlugin');\n * ```\n */\n remove(pluginName: string): AmplitudeReturn<void>;\n\n /**\n * Tracks user-defined event, with specified type, optional event properties and optional overwrites.\n *\n * ```typescript\n * // event tracking with event type only\n * track('Page Load');\n *\n * // event tracking with event type and additional event properties\n * track('Page Load', { loadTime: 1000 });\n *\n * // event tracking with event type, additional event properties, and overwritten event options\n * track('Page Load', { loadTime: 1000 }, { sessionId: -1 });\n *\n * // alternatively, this tracking method is awaitable\n * const result = await track('Page Load').promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n track(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Alias for track()\n */\n logEvent(\n eventInput: BaseEvent | string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Sends an identify event containing user property operations\n *\n * ```typescript\n * const id = new Identify();\n * id.set('colors', ['rose', 'gold']);\n * identify(id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await identify(id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n identify(identify: IIdentify, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a group identify event containing group property operations.\n *\n * ```typescript\n * const id = new Identify();\n * id.set('skills', ['js', 'ts']);\n * const groupType = 'org';\n * const groupName = 'engineering';\n * groupIdentify(groupType, groupName, id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await groupIdentify(groupType, groupName, id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n groupIdentify(\n groupType: string,\n groupName: string | string[],\n identify: IIdentify,\n eventOptions?: EventOptions,\n ): AmplitudeReturn<Result>;\n\n /**\n * Assigns a user to group\n *\n * ```typescript\n * const groupType = 'orgId';\n * const groupName = '15';\n * setGroup(groupType, groupName, { user_id: '12345' })\n * ```\n */\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sends a revenue event containing revenue property operations.\n *\n * ```typescript\n * const rev = new Revenue();\n * rev.setRevenue(100);\n * revenue(rev);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await revenue(rev).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\n revenue(revenue: IRevenue, eventOptions?: EventOptions): AmplitudeReturn<Result>;\n\n /**\n * Sets a new optOut config value. This toggles event tracking on/off.\n *\n *```typescript\n * // Stops tracking\n * setOptOut(true);\n *\n * // Starts/resumes tracking\n * setOptOut(false);\n * ```\n */\n setOptOut(optOut: boolean): void;\n\n /**\n * Flush all unsent events.\n *\n *```typescript\n * flush();\n * ```\n */\n flush(): AmplitudeReturn<void>;\n}\n\nexport class AmplitudeCore implements CoreClient, PluginHost {\n protected initializing = false;\n protected name: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n config: IConfig;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n timeline: Timeline;\n isReady = false;\n protected q: Array<CallableFunction | typeof returnWrapper> = [];\n protected dispatchQ: Array<CallableFunction> = [];\n\n constructor(name = '$default') {\n this.timeline = new Timeline(this);\n this.name = name;\n }\n\n protected async _init(config: IConfig) {\n this.config = config;\n this.timeline.reset(this);\n await this.runQueuedFunctions('q');\n this.isReady = true;\n }\n\n async runQueuedFunctions(queueName: 'q' | 'dispatchQ') {\n const queuedFunctions = this[queueName];\n this[queueName] = [];\n for (const queuedFunction of queuedFunctions) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const val: ReturnType<typeof returnWrapper> | Promise<any> = queuedFunction();\n if (val && 'promise' in val) {\n await val.promise;\n } else {\n await val;\n }\n }\n // Rerun queued functions if the queue has accrued more while awaiting promises\n if (this[queueName].length) {\n await this.runQueuedFunctions(queueName);\n }\n }\n\n track(eventInput: BaseEvent | string, eventProperties?: Record<string, any>, eventOptions?: EventOptions) {\n const event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n logEvent = this.track.bind(this);\n\n identify(identify: IIdentify, eventOptions?: EventOptions) {\n const event = createIdentifyEvent(identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n groupIdentify(groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions) {\n const event = createGroupIdentifyEvent(groupType, groupName, identify, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions) {\n const event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n const event = createRevenueEvent(revenue, eventOptions);\n return returnWrapper(this.dispatch(event));\n }\n\n add(plugin: Plugin) {\n if (!this.isReady) {\n this.q.push(this._addPlugin.bind(this, plugin));\n return returnWrapper();\n }\n return this._addPlugin(plugin);\n }\n\n _addPlugin(plugin: Plugin) {\n return returnWrapper(this.timeline.register(plugin, this.config));\n }\n\n remove(pluginName: string) {\n if (!this.isReady) {\n this.q.push(this._removePlugin.bind(this, pluginName));\n return returnWrapper();\n }\n return this._removePlugin(pluginName);\n }\n\n _removePlugin(pluginName: string) {\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n }\n\n dispatchWithCallback(event: Event, callback: (result: Result) => void): void {\n if (!this.isReady) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n }\n\n async dispatch(event: Event): Promise<Result> {\n if (!this.isReady) {\n return new Promise<Result>((resolve) => {\n this.dispatchQ.push(this.dispatchWithCallback.bind(this, event, resolve));\n });\n }\n\n return this.process(event);\n }\n\n /**\n *\n * This method applies identify operations to user properties and\n * returns a single object representing the final user property state.\n *\n * This is a best-effort api that only supports $set, $clearAll, and $unset.\n * Other operations are not supported and are ignored.\n *\n *\n * @param userProperties The `event.userProperties` object from an Identify event.\n * @returns A key-value object user properties without operations.\n *\n * @example\n * Input:\n * {\n * $set: { plan: 'premium' },\n * custom_flag: true\n * }\n *\n * Output:\n * {\n * plan: 'premium',\n * custom_flag: true\n * }\n */\n getOperationAppliedUserProperties(userProperties: UserProperties | undefined): { [key: string]: any } {\n const updatedProperties: { [key: string]: any } = {};\n\n if (userProperties === undefined) {\n return updatedProperties;\n }\n\n // Keep non-operation keys for later merge\n const nonOpProperties: {\n [key in Exclude<string, IdentifyOperation>]: any;\n } = {};\n Object.keys(userProperties).forEach((key) => {\n if (!Object.values(IdentifyOperation).includes(key as IdentifyOperation)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n nonOpProperties[key] = userProperties[key];\n }\n });\n\n OrderedIdentifyOperations.forEach((operation) => {\n // Skip when key is an operation.\n if (!Object.keys(userProperties).includes(operation)) return;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const opProperties: IdentifyUserProperties = userProperties[operation];\n\n switch (operation) {\n case IdentifyOperation.CLEAR_ALL:\n // Due to operation order, the following line will never execute.\n /* istanbul ignore next */\n Object.keys(updatedProperties).forEach((prop) => {\n delete updatedProperties[prop];\n });\n break;\n case IdentifyOperation.UNSET:\n Object.keys(opProperties).forEach((prop) => {\n delete updatedProperties[prop];\n });\n break;\n case IdentifyOperation.SET:\n Object.assign(updatedProperties, opProperties);\n break;\n }\n });\n\n // Merge non-operation properties.\n // Custom properties should not be affected by operations.\n // https://github.com/amplitude/nova/blob/343f678ded83c032e83b189796b3c2be161b48f5/src/main/java/com/amplitude/userproperty/model/ModifyUserPropertiesIdent.java#L79-L83\n Object.assign(updatedProperties, nonOpProperties);\n\n return updatedProperties;\n }\n\n async process(event: Event): Promise<Result> {\n try {\n // skip event processing if opt out\n if (this.config.optOut) {\n return buildResult(event, 0, OPT_OUT_MESSAGE);\n }\n\n if (event.event_type === SpecialEventType.IDENTIFY) {\n const userProperties = this.getOperationAppliedUserProperties(event.user_properties);\n this.timeline.onIdentityChanged({ userProperties: userProperties });\n }\n\n const result = await this.timeline.push(event);\n\n result.code === 200\n ? this.config.loggerProvider.log(result.message)\n : result.code === 100\n ? this.config.loggerProvider.warn(result.message)\n : this.config.loggerProvider.error(result.message);\n\n return result;\n } catch (e) {\n const message = String(e);\n this.config.loggerProvider.error(message);\n const result = buildResult(event, 0, message);\n\n return result;\n }\n }\n\n setOptOut(optOut: boolean) {\n if (!this.isReady) {\n this.q.push(this._setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this._setOptOut(optOut);\n }\n\n _setOptOut(optOut: boolean) {\n if (this.config.optOut !== optOut) {\n this.timeline.onOptOutChanged(optOut);\n this.config.optOut = Boolean(optOut);\n }\n }\n\n flush() {\n return returnWrapper(this.timeline.flush());\n }\n\n plugin(name: string): Plugin | undefined {\n const plugin = this.timeline.plugins.find((plugin) => plugin.name === name);\n if (plugin === undefined) {\n this.config.loggerProvider.debug(`Cannot find plugin with name ${name}`);\n return undefined;\n }\n\n return plugin;\n }\n}\n"]}
|
package/lib/cjs/identify.d.ts
CHANGED
|
@@ -62,5 +62,9 @@ export declare enum IdentifyOperation {
|
|
|
62
62
|
UNSET = "$unset",
|
|
63
63
|
CLEAR_ALL = "$clearAll"
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210
|
|
67
|
+
*/
|
|
68
|
+
export declare const OrderedIdentifyOperations: IdentifyOperation[];
|
|
65
69
|
export {};
|
|
66
70
|
//# sourceMappingURL=identify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.d.ts","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,iBAAiB,IAAI,sBAAsB,CAAC;IAC5C,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC/D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9D,OAAO,CAA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CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAGpD,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC;IAEhD,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;IAGpC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC;IAC9C,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACnD,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACjD,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,mBAAmB,CAAC;IAClD,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACrD,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,mBAAmB,CAAC;IACpD,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC;CAClD;AAED,oBAAY,iBAAiB;IAE3B,GAAG,SAAS;IACZ,QAAQ,aAAa;IAGrB,GAAG,SAAS;IACZ,MAAM,YAAY;IAClB,OAAO,aAAa;IACpB,MAAM,YAAY;IAGlB,SAAS,eAAe;IACxB,UAAU,gBAAgB;IAG1B,KAAK,WAAW;IAChB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAWrC,CAAC"}
|
package/lib/cjs/identify.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IdentifyOperation = exports.Identify = void 0;
|
|
3
|
+
exports.OrderedIdentifyOperations = exports.IdentifyOperation = exports.Identify = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var constants_1 = require("./types/constants");
|
|
6
6
|
var valid_properties_1 = require("./utils/valid-properties");
|
|
@@ -108,4 +108,19 @@ var IdentifyOperation;
|
|
|
108
108
|
IdentifyOperation["UNSET"] = "$unset";
|
|
109
109
|
IdentifyOperation["CLEAR_ALL"] = "$clearAll";
|
|
110
110
|
})(IdentifyOperation = exports.IdentifyOperation || (exports.IdentifyOperation = {}));
|
|
111
|
+
/**
|
|
112
|
+
* Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210
|
|
113
|
+
*/
|
|
114
|
+
exports.OrderedIdentifyOperations = [
|
|
115
|
+
IdentifyOperation.CLEAR_ALL,
|
|
116
|
+
IdentifyOperation.UNSET,
|
|
117
|
+
IdentifyOperation.SET,
|
|
118
|
+
IdentifyOperation.SET_ONCE,
|
|
119
|
+
IdentifyOperation.ADD,
|
|
120
|
+
IdentifyOperation.APPEND,
|
|
121
|
+
IdentifyOperation.PREPEND,
|
|
122
|
+
IdentifyOperation.PREINSERT,
|
|
123
|
+
IdentifyOperation.POSTINSERT,
|
|
124
|
+
IdentifyOperation.REMOVE,
|
|
125
|
+
];
|
|
111
126
|
//# sourceMappingURL=identify.js.map
|
package/lib/cjs/identify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,6DAA6D;AAgB7D;IAAA;QACqB,iBAAY,GAAgB,IAAI,GAAG,EAAU,CAAC;QACvD,gBAAW,GAA2B,EAAE,CAAC;IAmGrD,CAAC;IAjGQ,oCAAiB,GAAxB;QACE,4BAAY,IAAI,CAAC,WAAW,EAAG;IACjC,CAAC;IAEM,sBAAG,GAAV,UAAW,QAAgB,EAAE,KAAwB;QACnD,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,IA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AK,iBAAiB,CAAC,GAAG,EAAE;YACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;SAClC;QAED,IAAI,SAAS,KAAK,iBAAiB,CAAC,KAAK,IAAI,SAAS,KAAK,iBAAiB,CAAC,MAAM,EAAE;YACnF,OAAO,IAAA,oCAAiB,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACH,eAAC;AAAD,CAAC,AArGD,IAqGC;AArGY,4BAAQ;AAsIrB,IAAY,iBAkBX;AAlBD,WAAY,iBAAiB;IAC3B,gCAAgC;IAChC,iCAAY,CAAA;IACZ,0CAAqB,CAAA;IAErB,8CAA8C;IAC9C,iCAAY,CAAA;IACZ,uCAAkB,CAAA;IAClB,yCAAoB,CAAA;IACpB,uCAAkB,CAAA;IAElB,8DAA8D;IAC9D,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAE1B,+CAA+C;IAC/C,qCAAgB,CAAA;IAChB,4CAAuB,CAAA;AACzB,CAAC,EAlBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAkB5B","sourcesContent":["import { UNSET_VALUE } from './types/constants';\nimport { isValidProperties } from './utils/valid-properties';\n\nexport interface IIdentify {\n getUserProperties(): IdentifyUserProperties;\n set(property: string, value: ValidPropertyType): IIdentify;\n setOnce(property: string, value: ValidPropertyType): IIdentify;\n append(property: string, value: ValidPropertyType): IIdentify;\n prepend(property: string, value: ValidPropertyType): IIdentify;\n postInsert(property: string, value: ValidPropertyType): IIdentify;\n preInsert(property: string, value: ValidPropertyType): IIdentify;\n remove(property: string, value: ValidPropertyType): IIdentify;\n add(property: string, value: number): IIdentify;\n unset(property: string): IIdentify;\n clearAll(): IIdentify;\n}\n\nexport class Identify implements IIdentify {\n protected readonly _propertySet: Set<string> = new Set<string>();\n protected _properties: IdentifyUserProperties = {};\n\n public getUserProperties(): IdentifyUserProperties {\n return { ...this._properties };\n }\n\n public set(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n }\n\n public setOnce(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n }\n\n public append(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n }\n\n public prepend(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n }\n\n public postInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n }\n\n public preInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n }\n\n public remove(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n }\n\n public add(property: string, value: number): Identify {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n }\n\n public unset(property: string): Identify {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n }\n\n public clearAll(): Identify {\n // When clear all happens, all properties are unset. Reset the entire object.\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n\n return this;\n }\n\n // Returns whether or not this set actually worked.\n private _safeSet(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._validate(operation, property, value)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let userPropertyMap: any = this._properties[operation];\n if (userPropertyMap === undefined) {\n userPropertyMap = {};\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._properties[operation] = userPropertyMap;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n\n return false;\n }\n\n private _validate(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) {\n // clear all already set. Skipping operation;\n return false;\n }\n\n if (this._propertySet.has(property)) {\n // Property already used. Skipping operation\n return false;\n }\n\n if (operation === IdentifyOperation.ADD) {\n return typeof value === 'number';\n }\n\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n }\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n"]}
|
|
1
|
+
{"version":3,"file":"identify.js","sourceRoot":"","sources":["../../src/identify.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,6DAA6D;AAgB7D;IAAA;QACqB,iBAAY,GAAgB,IAAI,GAAG,E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IAC3B,iBAAiB,CAAC,UAAU;IAC5B,iBAAiB,CAAC,MAAM;CACzB,CAAC","sourcesContent":["import { UNSET_VALUE } from './types/constants';\nimport { isValidProperties } from './utils/valid-properties';\n\nexport interface IIdentify {\n getUserProperties(): IdentifyUserProperties;\n set(property: string, value: ValidPropertyType): IIdentify;\n setOnce(property: string, value: ValidPropertyType): IIdentify;\n append(property: string, value: ValidPropertyType): IIdentify;\n prepend(property: string, value: ValidPropertyType): IIdentify;\n postInsert(property: string, value: ValidPropertyType): IIdentify;\n preInsert(property: string, value: ValidPropertyType): IIdentify;\n remove(property: string, value: ValidPropertyType): IIdentify;\n add(property: string, value: number): IIdentify;\n unset(property: string): IIdentify;\n clearAll(): IIdentify;\n}\n\nexport class Identify implements IIdentify {\n protected readonly _propertySet: Set<string> = new Set<string>();\n protected _properties: IdentifyUserProperties = {};\n\n public getUserProperties(): IdentifyUserProperties {\n return { ...this._properties };\n }\n\n public set(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n }\n\n public setOnce(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n }\n\n public append(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n }\n\n public prepend(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n }\n\n public postInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n }\n\n public preInsert(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n }\n\n public remove(property: string, value: ValidPropertyType): Identify {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n }\n\n public add(property: string, value: number): Identify {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n }\n\n public unset(property: string): Identify {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n }\n\n public clearAll(): Identify {\n // When clear all happens, all properties are unset. Reset the entire object.\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n\n return this;\n }\n\n // Returns whether or not this set actually worked.\n private _safeSet(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._validate(operation, property, value)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let userPropertyMap: any = this._properties[operation];\n if (userPropertyMap === undefined) {\n userPropertyMap = {};\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this._properties[operation] = userPropertyMap;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n\n return false;\n }\n\n private _validate(operation: IdentifyOperation, property: string, value: ValidPropertyType): boolean {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) {\n // clear all already set. Skipping operation;\n return false;\n }\n\n if (this._propertySet.has(property)) {\n // Property already used. Skipping operation\n return false;\n }\n\n if (operation === IdentifyOperation.ADD) {\n return typeof value === 'number';\n }\n\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n }\n}\n\nexport type ValidPropertyType =\n | number\n | string\n | boolean\n | Array<string | number>\n | { [key: string]: ValidPropertyType }\n | Array<{ [key: string]: ValidPropertyType }>;\n\ninterface BaseOperationConfig {\n [key: string]: ValidPropertyType;\n}\n\nexport interface IdentifyUserProperties {\n // Add operations can only take numbers\n [IdentifyOperation.ADD]?: { [key: string]: number };\n\n // This reads the keys of the passed object, but the values are not used\n [IdentifyOperation.UNSET]?: BaseOperationConfig;\n // This option does not read the key as it unsets all user properties\n [IdentifyOperation.CLEAR_ALL]?: any;\n\n // These operations can take numbers, strings, or arrays of both.\n [IdentifyOperation.SET]?: BaseOperationConfig;\n [IdentifyOperation.SET_ONCE]?: BaseOperationConfig;\n [IdentifyOperation.APPEND]?: BaseOperationConfig;\n [IdentifyOperation.PREPEND]?: BaseOperationConfig;\n [IdentifyOperation.POSTINSERT]?: BaseOperationConfig;\n [IdentifyOperation.PREINSERT]?: BaseOperationConfig;\n [IdentifyOperation.REMOVE]?: BaseOperationConfig;\n}\n\nexport enum IdentifyOperation {\n // Base Operations to set values\n SET = '$set',\n SET_ONCE = '$setOnce',\n\n // Operations around modifying existing values\n ADD = '$add',\n APPEND = '$append',\n PREPEND = '$prepend',\n REMOVE = '$remove',\n\n // Operations around appending values *if* they aren't present\n PREINSERT = '$preInsert',\n POSTINSERT = '$postInsert',\n\n // Operations around removing properties/values\n UNSET = '$unset',\n CLEAR_ALL = '$clearAll',\n}\n\n/**\n * Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210\n */\nexport const OrderedIdentifyOperations = [\n IdentifyOperation.CLEAR_ALL,\n IdentifyOperation.UNSET,\n IdentifyOperation.SET,\n IdentifyOperation.SET_ONCE,\n IdentifyOperation.ADD,\n IdentifyOperation.APPEND,\n IdentifyOperation.PREPEND,\n IdentifyOperation.PREINSERT,\n IdentifyOperation.POSTINSERT,\n IdentifyOperation.REMOVE,\n];\n"]}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -40,4 +40,5 @@ export { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges }
|
|
|
40
40
|
export { Status } from './types/status';
|
|
41
41
|
export { BrowserConfig, BrowserOptions, DefaultTrackingOptions, TrackingOptions, AutocaptureOptions, CookieOptions, AttributionOptions, } from './types/browser-config';
|
|
42
42
|
export { BrowserClient } from './types/browser-client';
|
|
43
|
+
export { NetworkObserver, NetworkRequestEvent, NetworkEventCallback } from './network-observer';
|
|
43
44
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EACL,0BAA0B,EAC1B,SAAS,EACT,UAAU,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAClH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Status = exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = exports.OfflineDisabled = exports.ServerZone = exports.SpecialEventType = exports.IdentifyOperation = exports.STORAGE_PREFIX = exports.AMPLITUDE_PREFIX = exports.LogLevel = exports.FetchTransport = exports.BaseTransport = exports.getStorageKey = exports.CookieStorage = exports.MemoryStorage = exports.createIdentifyEvent = exports.UUID = exports.getClientStates = exports.getClientLogConfig = exports.debugWrapper = exports.returnWrapper = exports.getQueryParams = exports.getLanguage = exports.getOldCookieName = exports.getCookieName = exports.isNewSession = exports.setConnectorUserId = exports.setConnectorDeviceId = exports.getAnalyticsConnector = exports.getGlobalScope = exports.Logger = exports.RequestMetadata = exports.Config = exports.IdentityEventSender = exports.Destination = exports.RevenueProperty = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0;
|
|
3
|
+
exports.NetworkEventCallback = exports.NetworkObserver = exports.Status = exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = exports.OfflineDisabled = exports.ServerZone = exports.SpecialEventType = exports.IdentifyOperation = exports.STORAGE_PREFIX = exports.AMPLITUDE_PREFIX = exports.LogLevel = exports.FetchTransport = exports.BaseTransport = exports.getStorageKey = exports.CookieStorage = exports.MemoryStorage = exports.createIdentifyEvent = exports.UUID = exports.getClientStates = exports.getClientLogConfig = exports.debugWrapper = exports.returnWrapper = exports.getQueryParams = exports.getLanguage = exports.getOldCookieName = exports.getCookieName = exports.isNewSession = exports.setConnectorUserId = exports.setConnectorDeviceId = exports.getAnalyticsConnector = exports.getGlobalScope = exports.Logger = exports.RequestMetadata = exports.Config = exports.IdentityEventSender = exports.Destination = exports.RevenueProperty = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0;
|
|
4
4
|
var core_client_1 = require("./core-client");
|
|
5
5
|
Object.defineProperty(exports, "AmplitudeCore", { enumerable: true, get: function () { return core_client_1.AmplitudeCore; } });
|
|
6
6
|
var identify_1 = require("./identify");
|
|
@@ -70,4 +70,7 @@ Object.defineProperty(exports, "DEFAULT_DATA_ATTRIBUTE_PREFIX", { enumerable: tr
|
|
|
70
70
|
Object.defineProperty(exports, "DEFAULT_ACTION_CLICK_ALLOWLIST", { enumerable: true, get: function () { return element_interactions_1.DEFAULT_ACTION_CLICK_ALLOWLIST; } });
|
|
71
71
|
var status_1 = require("./types/status");
|
|
72
72
|
Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return status_1.Status; } });
|
|
73
|
+
var network_observer_1 = require("./network-observer");
|
|
74
|
+
Object.defineProperty(exports, "NetworkObserver", { enumerable: true, get: function () { return network_observer_1.NetworkObserver; } });
|
|
75
|
+
Object.defineProperty(exports, "NetworkEventCallback", { enumerable: true, get: function () { return network_observer_1.NetworkEventCallback; } });
|
|
73
76
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAAjD,4GAAA,aAAa,OAAA;AACtB,uCAAiD;AAAxC,oGAAA,QAAQ,OAAA;AACjB,qCAA+D;AAAtD,kGAAA,OAAO,OAAA;AAAY,0GAAA,eAAe,OAAA;AAC3C,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+CAAyD;AAAhD,+GAAA,mBAAmB,OAAA;AAC5B,mCAA4D;AAA1C,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACzC,mCAAsD;AAA7C,gGAAA,MAAM,OAAA;AACf,+CAAgD;AAAvC,8GAAA,cAAc,OAAA;AACvB,6DAAwG;AAA/F,4HAAA,qBAAqB,OAAA;AAAE,2HAAA,oBAAoB,OAAA;AAAE,yHAAA,kBAAkB,OAAA;AACxE,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,6CAAgE;AAAvD,4GAAA,aAAa,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AACxC,uCAAyC;AAAhC,uGAAA,WAAW,OAAA;AACpB,+CAAgD;AAAvC,8GAAA,cAAc,OAAA;AAEvB,yDAAwE;AAA/D,+GAAA,aAAa,OAAA;AACtB,uCAAkF;AAAzE,qGAAA,YAAY,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAC1D,qCAAoC;AAA3B,4FAAA,IAAI,OAAA;AACb,uDAA4D;AAAnD,oHAAA,mBAAmB,OAAA;AAE5B,2CAAiD;AAAxC,uGAAA,aAAa,OAAA;AACtB,2CAAiD;AAAxC,uGAAA,aAAa,OAAA;AACtB,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AAEtB,0CAAkD;AAAzC,qGAAA,aAAa,OAAA;AACtB,4CAAoD;AAA3C,uGAAA,cAAc,OAAA;AAEvB,6CAA4C;AAAnC,oGAAA,QAAQ,OAAA;AACjB,+CAAqE;AAA5D,6GAAA,gBAAgB,OAAA;AAAE,2GAAA,cAAc,OAAA;AAEzC,6CAAoH;AAApG,0GAAA,iBAAiB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAGnD,mDAAiE;AAAxC,yGAAA,UAAU,OAAA;AACnC,2CAAkD;AAAzC,0GAAA,eAAe,OAAA;AAQxB,qEAOsC;AAHpC,sIAAA,8BAA8B,OAAA;AAC9B,qIAAA,6BAA6B,OAAA;AAC7B,sIAAA,8BAA8B,OAAA;AAGhC,yCAAwC;AAA/B,gGAAA,MAAM,OAAA","sourcesContent":["export { AmplitudeCore, CoreClient } from './core-client';\nexport { Identify, IIdentify } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { IdentityEventSender } from './plugins/identity';\nexport { IConfig, Config, RequestMetadata } from './config';\nexport { Logger, ILogger, LogConfig } from './logger';\nexport { getGlobalScope } from './global-scope';\nexport { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';\nexport { isNewSession } from './session';\nexport { getCookieName, getOldCookieName } from './cookie-name';\nexport { getLanguage } from './language';\nexport { getQueryParams } from './query-params';\n\nexport { returnWrapper, AmplitudeReturn } from './utils/return-wrapper';\nexport { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug';\nexport { UUID } from './utils/uuid';\nexport { createIdentifyEvent } from './utils/event-builder';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType } from './types/storage';\nexport { Event, IdentifyOperation, SpecialEventType, IdentifyEvent, GroupIdentifyEvent } from './types/event/event';\nexport { EventOptions, BaseEvent } from './types/event/base-event';\nexport { IngestionMetadata } from './types/event/ingestion-metadata';\nexport { ServerZoneType, ServerZone } from './types/server-zone';\nexport { OfflineDisabled } from './types/offline';\nexport { Plan } from './types/event/plan';\nexport { TransportType, Transport } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport { Plugin, BeforePlugin, DestinationPlugin, EnrichmentPlugin, PluginType } from './types/plugin';\nexport { Result } from './types/result';\nexport {\n ElementInteractionsOptions,\n Messenger,\n ActionType,\n DEFAULT_CSS_SELECTOR_ALLOWLIST,\n DEFAULT_DATA_ATTRIBUTE_PREFIX,\n DEFAULT_ACTION_CLICK_ALLOWLIST,\n} from './types/element-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { Status } from './types/status';\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n} from './types/browser-config';\nexport { BrowserClient } from './types/browser-client';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAAjD,4GAAA,aAAa,OAAA;AACtB,uCAAiD;AAAxC,oGAAA,QAAQ,OAAA;AACjB,qCAA+D;AAAtD,kGAAA,OAAO,OAAA;AAAY,0GAAA,eAAe,OAAA;AAC3C,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+CAAyD;AAAhD,+GAAA,mBAAmB,OAAA;AAC5B,mCAA4D;AAA1C,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AACzC,mCAAsD;AAA7C,gGAAA,MAAM,OAAA;AACf,+CAAgD;AAAvC,8GAAA,cAAc,OAAA;AACvB,6DAAwG;AA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entify } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { IdentityEventSender } from './plugins/identity';\nexport { IConfig, Config, RequestMetadata } from './config';\nexport { Logger, ILogger, LogConfig } from './logger';\nexport { getGlobalScope } from './global-scope';\nexport { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';\nexport { isNewSession } from './session';\nexport { getCookieName, getOldCookieName } from './cookie-name';\nexport { getLanguage } from './language';\nexport { getQueryParams } from './query-params';\n\nexport { returnWrapper, AmplitudeReturn } from './utils/return-wrapper';\nexport { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug';\nexport { UUID } from './utils/uuid';\nexport { createIdentifyEvent } from './utils/event-builder';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType } from './types/storage';\nexport { Event, IdentifyOperation, SpecialEventType, IdentifyEvent, GroupIdentifyEvent } from './types/event/event';\nexport { EventOptions, BaseEvent } from './types/event/base-event';\nexport { IngestionMetadata } from './types/event/ingestion-metadata';\nexport { ServerZoneType, ServerZone } from './types/server-zone';\nexport { OfflineDisabled } from './types/offline';\nexport { Plan } from './types/event/plan';\nexport { TransportType, Transport } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport { Plugin, BeforePlugin, DestinationPlugin, EnrichmentPlugin, PluginType } from './types/plugin';\nexport { Result } from './types/result';\nexport {\n ElementInteractionsOptions,\n Messenger,\n ActionType,\n DEFAULT_CSS_SELECTOR_ALLOWLIST,\n DEFAULT_DATA_ATTRIBUTE_PREFIX,\n DEFAULT_ACTION_CLICK_ALLOWLIST,\n} from './types/element-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { Status } from './types/status';\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n} from './types/browser-config';\nexport { BrowserClient } from './types/browser-client';\n\nexport { NetworkObserver, NetworkRequestEvent, NetworkEventCallback } from './network-observer';\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ILogger } from '.';
|
|
2
|
+
export interface NetworkRequestEvent {
|
|
3
|
+
type: 'fetch';
|
|
4
|
+
method: string;
|
|
5
|
+
url: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
duration?: number;
|
|
8
|
+
requestBodySize?: number;
|
|
9
|
+
requestHeaders?: Record<string, string>;
|
|
10
|
+
responseBodySize?: number;
|
|
11
|
+
responseHeaders?: Record<string, string>;
|
|
12
|
+
error?: {
|
|
13
|
+
name: string;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
startTime?: number;
|
|
17
|
+
endTime?: number;
|
|
18
|
+
}
|
|
19
|
+
type FormDataEntryValueBrowser = string | Blob | null;
|
|
20
|
+
export interface FormDataBrowser {
|
|
21
|
+
entries(): IterableIterator<[string, FormDataEntryValueBrowser]>;
|
|
22
|
+
}
|
|
23
|
+
export type FetchRequestBody = string | Blob | ArrayBuffer | FormDataBrowser | URLSearchParams | null | undefined;
|
|
24
|
+
export declare function getRequestBodyLength(body: FetchRequestBody | null | undefined): number | undefined;
|
|
25
|
+
export type NetworkEventCallbackFn = (event: NetworkRequestEvent) => void;
|
|
26
|
+
export declare class NetworkEventCallback {
|
|
27
|
+
readonly callback: (event: NetworkRequestEvent) => void;
|
|
28
|
+
readonly id: string;
|
|
29
|
+
constructor(callback: (event: NetworkRequestEvent) => void, id?: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class NetworkObserver {
|
|
32
|
+
private originalFetch?;
|
|
33
|
+
private eventCallbacks;
|
|
34
|
+
private isObserving;
|
|
35
|
+
private globalScope?;
|
|
36
|
+
constructor(logger?: ILogger);
|
|
37
|
+
static isSupported(): boolean;
|
|
38
|
+
subscribe(eventCallback: NetworkEventCallback): void;
|
|
39
|
+
unsubscribe(eventCallback: NetworkEventCallback): void;
|
|
40
|
+
protected triggerEventCallbacks(event: NetworkRequestEvent): void;
|
|
41
|
+
private observeFetch;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=network-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-observer.d.ts","sourceRoot":"","sources":["../../src/network-observer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAC5B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,KAAK,yBAAyB,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AACtD,MAAM,WAAW,eAAe;IAC9B,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC;CAClE;AAED,MAAM,MA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