@amplitude/analytics-core 2.51.0 → 2.52.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/heartbeat.d.ts +42 -0
- package/lib/cjs/heartbeat.d.ts.map +1 -0
- package/lib/cjs/heartbeat.js +189 -0
- package/lib/cjs/heartbeat.js.map +1 -0
- package/lib/cjs/index.d.ts +4 -3
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +5 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/messenger/constants.d.ts +1 -1
- package/lib/cjs/messenger/constants.js +1 -1
- package/lib/cjs/messenger/constants.js.map +1 -1
- package/lib/cjs/remote-config/remote-config.d.ts +20 -1
- package/lib/cjs/remote-config/remote-config.d.ts.map +1 -1
- package/lib/cjs/remote-config/remote-config.js +67 -32
- package/lib/cjs/remote-config/remote-config.js.map +1 -1
- package/lib/cjs/types/event/base-event.d.ts +5 -0
- package/lib/cjs/types/event/base-event.d.ts.map +1 -1
- package/lib/cjs/types/event/base-event.js.map +1 -1
- package/lib/cjs/utils/environment.d.ts +1 -0
- package/lib/cjs/utils/environment.d.ts.map +1 -1
- package/lib/cjs/utils/environment.js +7 -1
- package/lib/cjs/utils/environment.js.map +1 -1
- package/lib/esm/heartbeat.d.ts +42 -0
- package/lib/esm/heartbeat.d.ts.map +1 -0
- package/lib/esm/heartbeat.js +185 -0
- package/lib/esm/heartbeat.js.map +1 -0
- package/lib/esm/index.d.ts +4 -3
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +3 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/messenger/constants.d.ts +1 -1
- package/lib/esm/messenger/constants.js +1 -1
- package/lib/esm/messenger/constants.js.map +1 -1
- package/lib/esm/remote-config/remote-config.d.ts +20 -1
- package/lib/esm/remote-config/remote-config.d.ts.map +1 -1
- package/lib/esm/remote-config/remote-config.js +67 -32
- package/lib/esm/remote-config/remote-config.js.map +1 -1
- package/lib/esm/types/event/base-event.d.ts +5 -0
- package/lib/esm/types/event/base-event.d.ts.map +1 -1
- package/lib/esm/types/event/base-event.js.map +1 -1
- package/lib/esm/utils/environment.d.ts +1 -0
- package/lib/esm/utils/environment.d.ts.map +1 -1
- package/lib/esm/utils/environment.js +5 -0
- package/lib/esm/utils/environment.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ILogger } from './logger';
|
|
2
|
+
import { CoreClient } from './types/client/core-client';
|
|
3
|
+
import { BaseEvent } from './types/event/base-event';
|
|
4
|
+
import { Result } from './types/result';
|
|
5
|
+
export declare class Heartbeat {
|
|
6
|
+
private client;
|
|
7
|
+
private pulse;
|
|
8
|
+
private delayTimeout;
|
|
9
|
+
private logger?;
|
|
10
|
+
private events;
|
|
11
|
+
private delayId;
|
|
12
|
+
private interval;
|
|
13
|
+
private resetPromise;
|
|
14
|
+
constructor(client: CoreClient, pulse: number, delayTimeout: number, logger?: ILogger | undefined);
|
|
15
|
+
private heartbeat;
|
|
16
|
+
private resetHeartbeat;
|
|
17
|
+
/**
|
|
18
|
+
* An instant event is one that has no delay and gets ingested immediately
|
|
19
|
+
* @param event
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
private isInstantEvent;
|
|
23
|
+
private checkEventSizeLimit;
|
|
24
|
+
track(event: BaseEvent): Promise<Result | Error | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Ingest an event with no delay
|
|
27
|
+
*
|
|
28
|
+
* (This is different from normal "track". It sends the events to the "/delayed" endpoint
|
|
29
|
+
* so that it can be tracked in the same payload as other events, for atomicity)
|
|
30
|
+
* @param event
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
trackNoDelay(event: BaseEvent): Promise<Error | Result | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Update an existing event
|
|
36
|
+
* @param event
|
|
37
|
+
*/
|
|
38
|
+
update(event: BaseEvent): Promise<void>;
|
|
39
|
+
stop(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare function getHeartbeatInstance(client: CoreClient, logger?: ILogger): Heartbeat;
|
|
42
|
+
//# sourceMappingURL=heartbeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../../src/heartbeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAS,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AASxC,qBAAa,SAAS;IAOlB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,MAAM,CAAC;IATjB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,YAAY,CAAkC;gBAG5C,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,qBAAS;YAMZ,SAAS;YAwBT,cAAc;IAmB5B;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,mBAAmB;IAYrB,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAiBlE;;;;;;;OAOG;IACG,YAAY,CAAC,KAAK,EAAE,SAAS;IAKnC;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,SAAS;IAc7B,IAAI;CAKL;AAUD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAQpF"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHeartbeatInstance = exports.Heartbeat = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var uuid_1 = require("./utils/uuid");
|
|
6
|
+
var EVENTS_SIZE_LIMIT = 4 * 10000; // 4KB
|
|
7
|
+
var Heartbeat = /** @class */ (function () {
|
|
8
|
+
function Heartbeat(client, pulse, delayTimeout, logger) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.pulse = pulse;
|
|
11
|
+
this.delayTimeout = delayTimeout;
|
|
12
|
+
this.logger = logger;
|
|
13
|
+
this.interval = null;
|
|
14
|
+
this.resetPromise = null;
|
|
15
|
+
this.events = new Map();
|
|
16
|
+
this.delayId = (0, uuid_1.UUID)();
|
|
17
|
+
}
|
|
18
|
+
Heartbeat.prototype.heartbeat = function () {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
20
|
+
var trackedEvents, _loop_1, this_1, _a, _b, event_1;
|
|
21
|
+
var e_1, _c;
|
|
22
|
+
var _this = this;
|
|
23
|
+
return tslib_1.__generator(this, function (_d) {
|
|
24
|
+
switch (_d.label) {
|
|
25
|
+
case 0:
|
|
26
|
+
// stop sending heartbeats if no events are queued
|
|
27
|
+
if (this.events.size === 0) {
|
|
28
|
+
this.stop();
|
|
29
|
+
return [2 /*return*/, []];
|
|
30
|
+
}
|
|
31
|
+
trackedEvents = [];
|
|
32
|
+
_loop_1 = function (event_1) {
|
|
33
|
+
var event_type = event_1.event_type, event_properties = event_1.event_properties, eventOptions = tslib_1.__rest(event_1, ["event_type", "event_properties"]);
|
|
34
|
+
var eventPromise = this_1.client.track(event_type, event_properties, eventOptions).promise;
|
|
35
|
+
// if the event has no timeout, then it's instant ingested and we can
|
|
36
|
+
// delete it after it was ingested
|
|
37
|
+
if (this_1.isInstantEvent(event_1)) {
|
|
38
|
+
var insertId_1 = event_1.insert_id;
|
|
39
|
+
void eventPromise.finally(function () { return _this.events.delete(insertId_1); });
|
|
40
|
+
}
|
|
41
|
+
trackedEvents.push(eventPromise);
|
|
42
|
+
};
|
|
43
|
+
this_1 = this;
|
|
44
|
+
try {
|
|
45
|
+
for (_a = tslib_1.__values(this.events.values()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
46
|
+
event_1 = _b.value;
|
|
47
|
+
_loop_1(event_1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
51
|
+
finally {
|
|
52
|
+
try {
|
|
53
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
54
|
+
}
|
|
55
|
+
finally { if (e_1) throw e_1.error; }
|
|
56
|
+
}
|
|
57
|
+
return [4 /*yield*/, Promise.all(trackedEvents)];
|
|
58
|
+
case 1: return [2 /*return*/, _d.sent()];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
Heartbeat.prototype.resetHeartbeat = function () {
|
|
64
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var _this = this;
|
|
66
|
+
return tslib_1.__generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
if (!this.resetPromise) return [3 /*break*/, 2];
|
|
70
|
+
return [4 /*yield*/, this.resetPromise];
|
|
71
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
72
|
+
case 2:
|
|
73
|
+
// reset the heartbeat interval
|
|
74
|
+
if (this.interval)
|
|
75
|
+
clearInterval(this.interval);
|
|
76
|
+
this.interval = setInterval(function () { return void _this.heartbeat(); }, this.pulse);
|
|
77
|
+
// invoke heartbeat on the next macrotask tick
|
|
78
|
+
this.resetPromise = new Promise(function (resolve) {
|
|
79
|
+
setTimeout(function () {
|
|
80
|
+
resolve(_this.heartbeat());
|
|
81
|
+
}, 0);
|
|
82
|
+
});
|
|
83
|
+
this.resetPromise.finally(function () { return (_this.resetPromise = null); });
|
|
84
|
+
return [4 /*yield*/, this.resetPromise];
|
|
85
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* An instant event is one that has no delay and gets ingested immediately
|
|
92
|
+
* @param event
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
Heartbeat.prototype.isInstantEvent = function (event) {
|
|
96
|
+
return Boolean(event.insert_id && !event.delay.timeout);
|
|
97
|
+
};
|
|
98
|
+
Heartbeat.prototype.checkEventSizeLimit = function (event) {
|
|
99
|
+
var _a;
|
|
100
|
+
if (JSON.stringify(tslib_1.__spreadArray([], tslib_1.__read(this.events.values()), false)).length > EVENTS_SIZE_LIMIT) {
|
|
101
|
+
/* istanbul ignore next */
|
|
102
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.warn("Heartbeat: events size limit reached, rejecting event with id=".concat(event.insert_id));
|
|
103
|
+
if (event.insert_id) {
|
|
104
|
+
this.events.delete(event.insert_id);
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
};
|
|
110
|
+
Heartbeat.prototype.track = function (event) {
|
|
111
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
112
|
+
var heartbeatResult;
|
|
113
|
+
return tslib_1.__generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
if (!event.insert_id) {
|
|
117
|
+
return [2 /*return*/, new Error('insert_id is required on events tracked with heartbeat')];
|
|
118
|
+
}
|
|
119
|
+
this.events.set(event.insert_id, tslib_1.__assign(tslib_1.__assign({}, event), { delay: event.delay || { id: this.delayId, timeout: this.delayTimeout } }));
|
|
120
|
+
if (!this.checkEventSizeLimit(event)) {
|
|
121
|
+
return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
return [4 /*yield*/, this.resetHeartbeat()];
|
|
124
|
+
case 1:
|
|
125
|
+
heartbeatResult = _a.sent();
|
|
126
|
+
return [2 /*return*/, heartbeatResult.find(function (result) { return result.event.insert_id === event.insert_id; })];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Ingest an event with no delay
|
|
133
|
+
*
|
|
134
|
+
* (This is different from normal "track". It sends the events to the "/delayed" endpoint
|
|
135
|
+
* so that it can be tracked in the same payload as other events, for atomicity)
|
|
136
|
+
* @param event
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
Heartbeat.prototype.trackNoDelay = function (event) {
|
|
140
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
141
|
+
return tslib_1.__generator(this, function (_a) {
|
|
142
|
+
event.delay = { id: this.delayId };
|
|
143
|
+
return [2 /*return*/, this.track(event)];
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Update an existing event
|
|
149
|
+
* @param event
|
|
150
|
+
*/
|
|
151
|
+
Heartbeat.prototype.update = function (event) {
|
|
152
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
153
|
+
var backupEvent;
|
|
154
|
+
return tslib_1.__generator(this, function (_a) {
|
|
155
|
+
if (event.insert_id && this.events.has(event.insert_id)) {
|
|
156
|
+
backupEvent = this.events.get(event.insert_id);
|
|
157
|
+
this.events.set(event.insert_id, tslib_1.__assign(tslib_1.__assign({}, event), { delay: { id: this.delayId, timeout: this.delayTimeout } }));
|
|
158
|
+
if (!this.checkEventSizeLimit(event) && backupEvent) {
|
|
159
|
+
this.events.set(event.insert_id, backupEvent);
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [2 /*return*/];
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
Heartbeat.prototype.stop = function () {
|
|
168
|
+
this.interval && clearInterval(this.interval);
|
|
169
|
+
this.interval = null;
|
|
170
|
+
this.events.clear();
|
|
171
|
+
};
|
|
172
|
+
return Heartbeat;
|
|
173
|
+
}());
|
|
174
|
+
exports.Heartbeat = Heartbeat;
|
|
175
|
+
var DEFAULT_HEARTBEAT_INTERVAL = 60000;
|
|
176
|
+
// const DEFAULT_HEARTBEAT_INTERVAL = 2_000; // TODO: DO NOT MERGE THIS
|
|
177
|
+
var DEFAULT_HEARTBEAT_DELAY_TIMEOUT = 3600000;
|
|
178
|
+
var heartbeatMap = new Map();
|
|
179
|
+
function getHeartbeatInstance(client, logger) {
|
|
180
|
+
var existing = heartbeatMap.get(client);
|
|
181
|
+
if (existing) {
|
|
182
|
+
return existing;
|
|
183
|
+
}
|
|
184
|
+
var heartbeat = new Heartbeat(client, DEFAULT_HEARTBEAT_INTERVAL, DEFAULT_HEARTBEAT_DELAY_TIMEOUT, logger);
|
|
185
|
+
heartbeatMap.set(client, heartbeat);
|
|
186
|
+
return heartbeat;
|
|
187
|
+
}
|
|
188
|
+
exports.getHeartbeatInstance = getHeartbeatInstance;
|
|
189
|
+
//# sourceMappingURL=heartbeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../../src/heartbeat.ts"],"names":[],"mappings":";;;;AAIA,qCAAoC;AAMpC,IAAM,iBAAiB,GAAG,CAAC,GAAG,KAAM,CAAC,CAAC,MAAM;AAE5C;IAME,mBACU,MAAkB,EAClB,KAAa,EACb,YAAoB,EACpB,MAAgB;QAHhB,WAAM,GAAN,MAAM,CAAY;QAClB,UAAK,GAAL,KAAK,CAAQ;QACb,iBAAY,GAAZ,YAAY,CAAQ;QACpB,WAAM,GAAN,MAAM,CAAU;QAPlB,aAAQ,GAA0B,IAAI,CAAC;QACvC,iBAAY,GAA6B,IAAI,CAAC;QAQpD,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,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AAC,YAAY,EAAE,IACvD,CAAC;oBACH,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE;wBACnD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;wBAC9C,sBAAO;qBACR;iBACF;;;;KACF;IAED,wBAAI,GAAJ;QACE,IAAI,CAAC,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IACH,gBAAC;AAAD,CAAC,AArID,IAqIC;AArIY,8BAAS;AAuItB,IAAM,0BAA0B,GAAG,KAAM,CAAC;AAC1C,uEAAuE;AACvE,IAAM,+BAA+B,GAAG,OAAS,CAAC;AAIlD,IAAM,YAAY,GAAiB,IAAI,GAAG,EAAyB,CAAC;AAEpE,SAAgB,oBAAoB,CAAC,MAAkB,EAAE,MAAgB;IACvE,IAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,QAAQ,EAAE;QACZ,OAAO,QAAQ,CAAC;KACjB;IACD,IAAM,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,MAAM,CAAC,CAAC;IAC7G,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,oDAQC","sourcesContent":["import { ILogger } from './logger';\nimport { CoreClient } from './types/client/core-client';\nimport { BaseEvent, Delay } from './types/event/base-event';\nimport { Result } from './types/result';\nimport { UUID } from './utils/uuid';\n\ntype DelayedEvent = BaseEvent & {\n delay: Delay;\n};\n\nconst EVENTS_SIZE_LIMIT = 4 * 10_000; // 4KB\n\nexport class Heartbeat {\n private events: Map<string, DelayedEvent>;\n private delayId: string;\n private interval: NodeJS.Timeout | null = null;\n private resetPromise: Promise<Result[]> | null = null;\n\n constructor(\n private client: CoreClient,\n private pulse: number,\n private delayTimeout: number,\n private logger?: ILogger,\n ) {\n this.events = new Map<string, DelayedEvent>();\n this.delayId = UUID();\n }\n\n private async heartbeat(): Promise<Result[]> {\n // stop sending heartbeats if no events are queued\n if (this.events.size === 0) {\n this.stop();\n return [];\n }\n\n // track all of the delayed events\n const trackedEvents = [];\n for (const event of this.events.values()) {\n const { event_type, event_properties, ...eventOptions } = event;\n const eventPromise = this.client.track(event_type, event_properties, eventOptions).promise;\n\n // if the event has no timeout, then it's instant ingested and we can\n // delete it after it was ingested\n if (this.isInstantEvent(event)) {\n const insertId = event.insert_id;\n void eventPromise.finally(() => this.events.delete(insertId));\n }\n trackedEvents.push(eventPromise);\n }\n return await Promise.all(trackedEvents);\n }\n\n private async resetHeartbeat() {\n // if a reset is already in progress, return the existing promise\n if (this.resetPromise) return await this.resetPromise;\n\n // reset the heartbeat interval\n if (this.interval) clearInterval(this.interval);\n this.interval = setInterval(() => void this.heartbeat(), this.pulse);\n\n // invoke heartbeat on the next macrotask tick\n this.resetPromise = new Promise((resolve) => {\n setTimeout(() => {\n resolve(this.heartbeat());\n }, 0);\n });\n this.resetPromise.finally(() => (this.resetPromise = null));\n\n return await this.resetPromise;\n }\n\n /**\n * An instant event is one that has no delay and gets ingested immediately\n * @param event\n * @returns\n */\n private isInstantEvent(event: DelayedEvent): event is DelayedEvent & { insert_id: string } {\n return Boolean(event.insert_id && !event.delay.timeout);\n }\n\n private checkEventSizeLimit(event: BaseEvent) {\n if (JSON.stringify([...this.events.values()]).length > EVENTS_SIZE_LIMIT) {\n /* istanbul ignore next */\n this.logger?.warn(`Heartbeat: events size limit reached, rejecting event with id=${event.insert_id!}`);\n if (event.insert_id) {\n this.events.delete(event.insert_id);\n }\n return false;\n }\n return true;\n }\n\n async track(event: BaseEvent): Promise<Result | Error | undefined> {\n if (!event.insert_id) {\n return new Error('insert_id is required on events tracked with heartbeat');\n }\n this.events.set(event.insert_id, {\n ...event,\n delay: event.delay || { id: this.delayId, timeout: this.delayTimeout },\n });\n if (!this.checkEventSizeLimit(event)) {\n return;\n }\n\n // emit a heartbeat, restart interval and return the result\n const heartbeatResult = await this.resetHeartbeat();\n return heartbeatResult.find((result) => result.event.insert_id === event.insert_id);\n }\n\n /**\n * Ingest an event with no delay\n *\n * (This is different from normal \"track\". It sends the events to the \"/delayed\" endpoint\n * so that it can be tracked in the same payload as other events, for atomicity)\n * @param event\n * @returns\n */\n async trackNoDelay(event: BaseEvent) {\n event.delay = { id: this.delayId };\n return this.track(event);\n }\n\n /**\n * Update an existing event\n * @param event\n */\n async update(event: BaseEvent) {\n if (event.insert_id && this.events.has(event.insert_id)) {\n const backupEvent = this.events.get(event.insert_id);\n this.events.set(event.insert_id, {\n ...event,\n delay: { id: this.delayId, timeout: this.delayTimeout },\n });\n if (!this.checkEventSizeLimit(event) && backupEvent) {\n this.events.set(event.insert_id, backupEvent);\n return;\n }\n }\n }\n\n stop() {\n this.interval && clearInterval(this.interval);\n this.interval = null;\n this.events.clear();\n }\n}\n\nconst DEFAULT_HEARTBEAT_INTERVAL = 60_000;\n// const DEFAULT_HEARTBEAT_INTERVAL = 2_000; // TODO: DO NOT MERGE THIS\nconst DEFAULT_HEARTBEAT_DELAY_TIMEOUT = 3_600_000;\n\ntype HeartbeatMap = Map<CoreClient, Heartbeat>;\n\nconst heartbeatMap: HeartbeatMap = new Map<CoreClient, Heartbeat>();\n\nexport function getHeartbeatInstance(client: CoreClient, logger?: ILogger): Heartbeat {\n const existing = heartbeatMap.get(client);\n if (existing) {\n return existing;\n }\n const heartbeat = new Heartbeat(client, DEFAULT_HEARTBEAT_INTERVAL, DEFAULT_HEARTBEAT_DELAY_TIMEOUT, logger);\n heartbeatMap.set(client, heartbeat);\n return heartbeat;\n}\n"]}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { AmplitudeContext } from './types/amplitude-context';
|
|
|
5
5
|
export { Identify, IIdentify, ValidPropertyType } from './identify';
|
|
6
6
|
export { Revenue, IRevenue, RevenueProperty } from './revenue';
|
|
7
7
|
export { Destination } from './plugins/destination';
|
|
8
|
+
export { getHeartbeatInstance } from './heartbeat';
|
|
8
9
|
export { IdentityEventSender } from './plugins/identity';
|
|
9
10
|
export { Config, RequestMetadata } from './config';
|
|
10
11
|
export { IConfig } from './types/config/core-config';
|
|
@@ -31,7 +32,7 @@ export { registerSdkLoaderMetadata } from './diagnostics/uncaught-sdk-errors';
|
|
|
31
32
|
export { BaseTransport } from './transports/base';
|
|
32
33
|
export { FetchTransport } from './transports/fetch';
|
|
33
34
|
export { compressToGzipArrayBuffer, isCompressionStreamAvailable, MIN_GZIP_UPLOAD_BODY_SIZE_BYTES, } from './transports/gzip';
|
|
34
|
-
export { RemoteConfigClient, IRemoteConfigClient, RemoteConfig, Source } from './remote-config/remote-config';
|
|
35
|
+
export { RemoteConfigClient, IRemoteConfigClient, RemoteConfig, Source, RemoteConfigFetchRequest, RemoteConfigCustomFetch, } from './remote-config/remote-config';
|
|
35
36
|
export { LogLevel } from './types/loglevel';
|
|
36
37
|
export { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';
|
|
37
38
|
export { Storage, IdentityStorageType, CookieStorageConfig } from './types/storage';
|
|
@@ -55,7 +56,7 @@ export { FormInteractionsOptions } from './types/form-interactions';
|
|
|
55
56
|
export { Status } from './types/status';
|
|
56
57
|
export { NetworkEventCallback, networkObserver } from './observers/network';
|
|
57
58
|
export { NetworkRequestEvent, IRequestWrapper, JsonObject, JsonValue, JsonArray } from './network-request-event';
|
|
58
|
-
export { NetworkTrackingOptions, NetworkCaptureRule } from './types/network-tracking';
|
|
59
|
+
export { NetworkTrackingOptions, NetworkCaptureRule, BodyCaptureRule } from './types/network-tracking';
|
|
59
60
|
export { SAFE_HEADERS, FORBIDDEN_HEADERS } from './types/constants';
|
|
60
61
|
export { PageUrlEnrichmentOptions } from './types/page-url-enrichment';
|
|
61
62
|
export { CustomEnrichmentOptions } from './types/custom-enrichment';
|
|
@@ -80,5 +81,5 @@ export { AMPLITUDE_ORIGIN, AMPLITUDE_ORIGIN_EU, AMPLITUDE_ORIGIN_STAGING, AMPLIT
|
|
|
80
81
|
export { ExcludeInternalReferrersOptions, EXCLUDE_INTERNAL_REFERRERS_CONDITIONS } from './types/config/browser-config';
|
|
81
82
|
export { VideoObserver, State as VideoState, type VideoObserverParams } from './observers/video';
|
|
82
83
|
export { EmbeddedVideoPlayer, type Vendor as VideoVendor } from './video-analytics/types';
|
|
83
|
-
export { isChromeExtension } from './utils/environment';
|
|
84
|
+
export { isChromeExtension, isReactNative } from './utils/environment';
|
|
84
85
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE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ports.isChromeExtension = exports.VideoObserver = exports.EXCLUDE_INTERNAL_REFERRERS_CONDITIONS = exports.AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = exports.AMPLITUDE_ORIGINS_MAP = exports.AMPLITUDE_ORIGIN_STAGING = exports.AMPLITUDE_ORIGIN_EU = exports.AMPLITUDE_ORIGIN = exports.enableBackgroundCapture = exports.getOrCreateWindowMessenger = exports.safeJsonStringify = exports.multicast = exports.merge = exports.asyncMap = exports.Observable = exports.EMAIL_REGEX = exports.SSN_REGEX = exports.CC_REGEX = exports.replaceSensitiveString = exports.MASKED_TEXT_VALUE = exports.TEXT_MASK_ATTRIBUTE = exports.getPageTitle = exports.CampaignParser = exports.MKTG = exports.BASE_CAMPAIGN = exports.EMPTY_VALUE = exports.FORBIDDEN_HEADERS = exports.SAFE_HEADERS = exports.NetworkRequestEvent = exports.networkObserver = exports.NetworkEventCallback = exports.Status = exports.DEFAULT_DEAD_CLICK_WINDOW_MS = exports.DEFAULT_RAGE_CLICK_OUT_OF_BOUNDS_THRESHOLD = exports.DEFAULT_RAGE_CLICK_WINDOW_MS = exports.DEFAULT_RAGE_CLICK_THRESHOLD = exports.DEFAULT_ERROR_CLICK_ALLOWLIST = exports.DEFAULT_RAGE_CLICK_ALLOWLIST = exports.DEFAULT_DEAD_CLICK_ALLOWLIST = exports.DEFAULT_EXPOSURE_DURATION = exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = exports.OfflineDisabled = void 0;
|
|
3
|
+
exports.SpecialEventType = exports.IdentifyOperation = exports.consoleObserver = exports.STORAGE_PREFIX = exports.AMPLITUDE_PREFIX = exports.LogLevel = exports.RemoteConfigClient = exports.MIN_GZIP_UPLOAD_BODY_SIZE_BYTES = exports.isCompressionStreamAvailable = exports.compressToGzipArrayBuffer = exports.FetchTransport = exports.BaseTransport = exports.registerSdkLoaderMetadata = exports.DiagnosticsClient = exports.BrowserStorage = exports.getStorageKey = exports.decodeCookieValue = exports.isDomainEqual = exports.CookieStorage = exports.MemoryStorage = exports.omitUndefined = exports.isTimestampInSample = exports.generateHashCode = exports.getDecodeURI = exports.isUrlMatchAllowlist = 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.getHeartbeatInstance = exports.Destination = exports.RevenueProperty = exports.Revenue = exports.Identify = exports.AmplitudeCore = void 0;
|
|
4
|
+
exports.isReactNative = exports.isChromeExtension = exports.VideoObserver = exports.EXCLUDE_INTERNAL_REFERRERS_CONDITIONS = exports.AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = exports.AMPLITUDE_ORIGINS_MAP = exports.AMPLITUDE_ORIGIN_STAGING = exports.AMPLITUDE_ORIGIN_EU = exports.AMPLITUDE_ORIGIN = exports.enableBackgroundCapture = exports.getOrCreateWindowMessenger = exports.safeJsonStringify = exports.multicast = exports.merge = exports.asyncMap = exports.Observable = exports.EMAIL_REGEX = exports.SSN_REGEX = exports.CC_REGEX = exports.replaceSensitiveString = exports.MASKED_TEXT_VALUE = exports.TEXT_MASK_ATTRIBUTE = exports.getPageTitle = exports.CampaignParser = exports.MKTG = exports.BASE_CAMPAIGN = exports.EMPTY_VALUE = exports.FORBIDDEN_HEADERS = exports.SAFE_HEADERS = exports.NetworkRequestEvent = exports.networkObserver = exports.NetworkEventCallback = exports.Status = exports.DEFAULT_DEAD_CLICK_WINDOW_MS = exports.DEFAULT_RAGE_CLICK_OUT_OF_BOUNDS_THRESHOLD = exports.DEFAULT_RAGE_CLICK_WINDOW_MS = exports.DEFAULT_RAGE_CLICK_THRESHOLD = exports.DEFAULT_ERROR_CLICK_ALLOWLIST = exports.DEFAULT_RAGE_CLICK_ALLOWLIST = exports.DEFAULT_DEAD_CLICK_ALLOWLIST = exports.DEFAULT_EXPOSURE_DURATION = exports.DEFAULT_ACTION_CLICK_ALLOWLIST = exports.DEFAULT_DATA_ATTRIBUTE_PREFIX = exports.DEFAULT_CSS_SELECTOR_ALLOWLIST = exports.OfflineDisabled = exports.ServerZone = void 0;
|
|
5
5
|
var core_client_1 = require("./core-client");
|
|
6
6
|
Object.defineProperty(exports, "AmplitudeCore", { enumerable: true, get: function () { return core_client_1.AmplitudeCore; } });
|
|
7
7
|
var identify_1 = require("./identify");
|
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "Revenue", { enumerable: true, get: function () {
|
|
|
11
11
|
Object.defineProperty(exports, "RevenueProperty", { enumerable: true, get: function () { return revenue_1.RevenueProperty; } });
|
|
12
12
|
var destination_1 = require("./plugins/destination");
|
|
13
13
|
Object.defineProperty(exports, "Destination", { enumerable: true, get: function () { return destination_1.Destination; } });
|
|
14
|
+
var heartbeat_1 = require("./heartbeat");
|
|
15
|
+
Object.defineProperty(exports, "getHeartbeatInstance", { enumerable: true, get: function () { return heartbeat_1.getHeartbeatInstance; } });
|
|
14
16
|
var identity_1 = require("./plugins/identity");
|
|
15
17
|
Object.defineProperty(exports, "IdentityEventSender", { enumerable: true, get: function () { return identity_1.IdentityEventSender; } });
|
|
16
18
|
var config_1 = require("./config");
|
|
@@ -149,4 +151,5 @@ var video_1 = require("./observers/video");
|
|
|
149
151
|
Object.defineProperty(exports, "VideoObserver", { enumerable: true, get: function () { return video_1.VideoObserver; } });
|
|
150
152
|
var environment_1 = require("./utils/environment");
|
|
151
153
|
Object.defineProperty(exports, "isChromeExtension", { enumerable: true, get: function () { return environment_1.isChromeExtension; } });
|
|
154
|
+
Object.defineProperty(exports, "isReactNative", { enumerable: true, get: function () { return environment_1.isReactNative; } });
|
|
152
155
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED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AAA;AAC9C,iEAAiH;AAAxG,4HAAA,mBAAmB,OAAA;AAE5B,+CAAoE;AAA3D,yGAAA,YAAY,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAQxC,+CAAqE;AAA5D,wGAAA,WAAW,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,iGAAA,IAAI,OAAA;AACzC,8DAA4D;AAAnD,iHAAA,cAAc,OAAA;AACvB,6CAQ2B;AAPzB,uGAAA,YAAY,OAAA;AACZ,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,iHAAA,sBAAsB,OAAA;AACtB,mGAAA,QAAQ,OAAA;AACR,oGAAA,SAAS,OAAA;AACT,sGAAA,WAAW,OAAA;AA8Bb,iDAA4F;AAAnF,wGAAA,UAAU,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,uGAAA,SAAS,OAAA;AAG/C,yDAA2D;AAAlD,mHAAA,iBAAiB,OAAA;AAI1B,2EAA+E;AAAtE,mIAAA,0BAA0B,OAAA;AACnC,qEAAyE;AAAhE,6HAAA,uBAAuB,OAAA;AAChC,mDAM+B;AAL7B,6GAAA,gBAAgB,OAAA;AAChB,gHAAA,mBAAmB,OAAA;AACnB,qHAAA,wBAAwB,OAAA;AACxB,kHAAA,qBAAqB,OAAA;AACrB,oIAAA,uCAAuC,OAAA;AAGzC,gEAAuH;AAA7E,uIAAA,qCAAqC,OAAA;AAE/E,2CAAiG;AAAxF,sGAAA,aAAa,OAAA;AAEtB,mDAAwD;AAA/C,gHAAA,iBAAiB,OAAA","sourcesContent":["export { AmplitudeCore } from './core-client';\nexport { CoreClient, PluginHost } from './types/client/core-client';\nexport { AnalyticsClient } from './types/client/analytics-client';\nexport { AmplitudeContext } from './types/amplitude-context';\nexport { Identify, IIdentify, ValidPropertyType } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { IdentityEventSender } from './plugins/identity';\nexport { Config, RequestMetadata } from './config';\nexport { IConfig } from './types/config/core-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';\nexport { isUrlMatchAllowlist, getDecodeURI } from './utils/url-utils';\nexport { generateHashCode, isTimestampInSample } from './utils/sampling';\nexport { omitUndefined } from './utils/omit-undefined';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage, isDomainEqual, decodeCookieValue } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BrowserStorage } from './storage/browser-storage';\n\nexport { DiagnosticsClient, IDiagnosticsClient } from './diagnostics/diagnostics-client';\nexport { registerSdkLoaderMetadata } from './diagnostics/uncaught-sdk-errors';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\nexport {\n compressToGzipArrayBuffer,\n isCompressionStreamAvailable,\n MIN_GZIP_UPLOAD_BODY_SIZE_BYTES,\n} from './transports/gzip';\n\nexport { RemoteConfigClient, IRemoteConfigClient, RemoteConfig, Source } from './remote-config/remote-config';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType, CookieStorageConfig } from './types/storage';\nexport { consoleObserver } from './observers/console';\nexport {\n Event,\n IdentifyOperation,\n SpecialEventType,\n IdentifyEvent,\n GroupIdentifyEvent,\n IdentifyUserProperties,\n} 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, TransportOptions, TransportTypeOrOptions } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport {\n Plugin,\n BeforePlugin,\n DestinationPlugin,\n EnrichmentPlugin,\n PluginType,\n AnalyticsIdentity,\n} 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 DEFAULT_EXPOSURE_DURATION,\n LabeledEvent,\n Trigger,\n DataSource,\n} from './types/element-interactions';\n\nexport {\n FrustrationInteractionsOptions,\n DEFAULT_DEAD_CLICK_ALLOWLIST,\n DEFAULT_RAGE_CLICK_ALLOWLIST,\n DEFAULT_ERROR_CLICK_ALLOWLIST,\n DEFAULT_RAGE_CLICK_THRESHOLD,\n DEFAULT_RAGE_CLICK_WINDOW_MS,\n DEFAULT_RAGE_CLICK_OUT_OF_BOUNDS_THRESHOLD,\n DEFAULT_DEAD_CLICK_WINDOW_MS,\n} from './types/frustration-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { FormInteractionsOptions } from './types/form-interactions';\nexport { Status } from './types/status';\n\nexport { NetworkEventCallback, networkObserver } from './observers/network';\nexport { NetworkRequestEvent, IRequestWrapper, JsonObject, JsonValue, JsonArray } from './network-request-event';\nexport { NetworkTrackingOptions, NetworkCaptureRule } from './types/network-tracking';\nexport { SAFE_HEADERS, FORBIDDEN_HEADERS } from './types/constants';\n\nexport { PageUrlEnrichmentOptions } from './types/page-url-enrichment';\nexport { CustomEnrichmentOptions } from './types/custom-enrichment';\nexport { PerformanceTrackingOptions, MainThreadBlockOptions } from './types/performance-tracking';\n\n// Campaign\nexport { Campaign, UTMParameters, ReferrerParameters, ClickIdParameters, ICampaignParser } from './types/campaign';\nexport { EMPTY_VALUE, BASE_CAMPAIGN, MKTG } from './types/constants';\nexport { CampaignParser } from './campaign/campaign-parser';\nexport {\n getPageTitle,\n TEXT_MASK_ATTRIBUTE,\n MASKED_TEXT_VALUE,\n replaceSensitiveString,\n CC_REGEX,\n SSN_REGEX,\n EMAIL_REGEX,\n} from './plugins/helpers';\n\n// Browser\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n TrackingMethod,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n RemoteConfigOptions,\n} from './types/config/browser-config';\nexport { BrowserClient } from './types/client/browser-client';\n\n// Node\nexport { NodeClient } from './types/client/node-client';\nexport { NodeConfig, NodeOptions } from './types/config/node-config';\n\n// React Native\nexport {\n ReactNativeConfig,\n ReactNativeTrackingOptions,\n ReactNativeOptions,\n ReactNativeAttributionOptions,\n} from './types/config/react-native-config';\nexport { ReactNativeClient } from './types/client/react-native-client';\n\nexport { Observable, asyncMap, merge, multicast, Unsubscribable } from './utils/observable';\n\nexport { InstanceProxy } from './types/proxy';\nexport { safeJsonStringify } from './utils/safe-stringify';\n\n// Messenger (cross-window communication)\nexport type { BaseWindowMessenger, ActionHandler } from './messenger/base-window-messenger';\nexport { getOrCreateWindowMessenger } from './messenger/base-window-messenger';\nexport { enableBackgroundCapture } from './messenger/background-capture';\nexport {\n AMPLITUDE_ORIGIN,\n AMPLITUDE_ORIGIN_EU,\n AMPLITUDE_ORIGIN_STAGING,\n AMPLITUDE_ORIGINS_MAP,\n AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL,\n} from './messenger/constants';\n\nexport { ExcludeInternalReferrersOptions, EXCLUDE_INTERNAL_REFERRERS_CONDITIONS } from './types/config/browser-config';\n\nexport { VideoObserver, State as VideoState, type VideoObserverParams } from './observers/video';\nexport { EmbeddedVideoPlayer, type Vendor as VideoVendor } from './video-analytics/types';\nexport { isChromeExtension } from './utils/environment';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,6CAA8C;AAArC,4GAAA,aAAa,OAAA;AAItB,uCAAoE;AAA3D,oGAAA,QAAQ,OAAA;AACjB,qCAA+D;AAAtD,kGAAA,OAAO,OAAA;AAAY,0GAAA,eAAe,OAAA;AAC3C,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,yCAAmD;AAA1C,iHAAA,oBAAoB,OAAA;AAC7B,+CAAyD;AAAhD,+GAAA,mBAAmB,OAAA;AAC5B,mCAAmD;AAA1C,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AAEhC,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;AAC5B,+CAAsE;AAA7D,gHAAA,mBAAmB,OAAA;AAAE,yGAAA,YAAY,OAAA;AAC1C,6CAAyE;AAAhE,4GAAA,gBAAgB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAC9C,yDAAuD;AAA9C,+G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A,MAAM,OAAA;AAEf,+CAA4E;AAAnE,+GAAA,oBAAoB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAC9C,iEAAiH;AAAxG,4HAAA,mBAAmB,OAAA;AAE5B,+CAAoE;AAA3D,yGAAA,YAAY,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAQxC,+CAAqE;AAA5D,wGAAA,WAAW,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,iGAAA,IAAI,OAAA;AACzC,8DAA4D;AAAnD,iHAAA,cAAc,OAAA;AACvB,6CAQ2B;AAPzB,uGAAA,YAAY,OAAA;AACZ,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,iHAAA,sBAAsB,OAAA;AACtB,mGAAA,QAAQ,OAAA;AACR,oGAAA,SAAS,OAAA;AACT,sGAAA,WAAW,OAAA;AA8Bb,iDAA4F;AAAnF,wGAAA,UAAU,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,mGAAA,KAAK,OAAA;AAAE,uGAAA,SAAS,OAAA;AAG/C,yDAA2D;AAAlD,mHAAA,iBAAiB,OAAA;AAI1B,2EAA+E;AAAtE,mIAAA,0BAA0B,OAAA;AACnC,qEAAyE;AAAhE,6HAAA,uBAAuB,OAAA;AAChC,mDAM+B;AAL7B,6GAAA,gBAAgB,OAAA;AAChB,gHAAA,mBAAmB,OAAA;AACnB,qHAAA,wBAAwB,OAAA;AACxB,kHAAA,qBAAqB,OAAA;AACrB,oIAAA,uCAAuC,OAAA;AAGzC,gEAAuH;AAA7E,uIAAA,qCAAqC,OAAA;AAE/E,2CAAiG;AAAxF,sGAAA,aAAa,OAAA;AAEtB,mDAAuE;AAA9D,gHAAA,iBAAiB,OAAA;AAAE,4GAAA,aAAa,OAAA","sourcesContent":["export { AmplitudeCore } from './core-client';\nexport { CoreClient, PluginHost } from './types/client/core-client';\nexport { AnalyticsClient } from './types/client/analytics-client';\nexport { AmplitudeContext } from './types/amplitude-context';\nexport { Identify, IIdentify, ValidPropertyType } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { getHeartbeatInstance } from './heartbeat';\nexport { IdentityEventSender } from './plugins/identity';\nexport { Config, RequestMetadata } from './config';\nexport { IConfig } from './types/config/core-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';\nexport { isUrlMatchAllowlist, getDecodeURI } from './utils/url-utils';\nexport { generateHashCode, isTimestampInSample } from './utils/sampling';\nexport { omitUndefined } from './utils/omit-undefined';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage, isDomainEqual, decodeCookieValue } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BrowserStorage } from './storage/browser-storage';\n\nexport { DiagnosticsClient, IDiagnosticsClient } from './diagnostics/diagnostics-client';\nexport { registerSdkLoaderMetadata } from './diagnostics/uncaught-sdk-errors';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\nexport {\n compressToGzipArrayBuffer,\n isCompressionStreamAvailable,\n MIN_GZIP_UPLOAD_BODY_SIZE_BYTES,\n} from './transports/gzip';\n\nexport {\n RemoteConfigClient,\n IRemoteConfigClient,\n RemoteConfig,\n Source,\n RemoteConfigFetchRequest,\n RemoteConfigCustomFetch,\n} from './remote-config/remote-config';\n\nexport { LogLevel } from './types/loglevel';\nexport { AMPLITUDE_PREFIX, STORAGE_PREFIX } from './types/constants';\nexport { Storage, IdentityStorageType, CookieStorageConfig } from './types/storage';\nexport { consoleObserver } from './observers/console';\nexport {\n Event,\n IdentifyOperation,\n SpecialEventType,\n IdentifyEvent,\n GroupIdentifyEvent,\n IdentifyUserProperties,\n} 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, TransportOptions, TransportTypeOrOptions } from './types/transport';\nexport { Payload } from './types/payload';\nexport { Response } from './types/response';\nexport { UserSession } from './types/user-session';\nexport {\n Plugin,\n BeforePlugin,\n DestinationPlugin,\n EnrichmentPlugin,\n PluginType,\n AnalyticsIdentity,\n} 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 DEFAULT_EXPOSURE_DURATION,\n LabeledEvent,\n Trigger,\n DataSource,\n} from './types/element-interactions';\n\nexport {\n FrustrationInteractionsOptions,\n DEFAULT_DEAD_CLICK_ALLOWLIST,\n DEFAULT_RAGE_CLICK_ALLOWLIST,\n DEFAULT_ERROR_CLICK_ALLOWLIST,\n DEFAULT_RAGE_CLICK_THRESHOLD,\n DEFAULT_RAGE_CLICK_WINDOW_MS,\n DEFAULT_RAGE_CLICK_OUT_OF_BOUNDS_THRESHOLD,\n DEFAULT_DEAD_CLICK_WINDOW_MS,\n} from './types/frustration-interactions';\nexport { PageTrackingOptions, PageTrackingTrackOn, PageTrackingHistoryChanges } from './types/page-view-tracking';\nexport { FormInteractionsOptions } from './types/form-interactions';\nexport { Status } from './types/status';\n\nexport { NetworkEventCallback, networkObserver } from './observers/network';\nexport { NetworkRequestEvent, IRequestWrapper, JsonObject, JsonValue, JsonArray } from './network-request-event';\nexport { NetworkTrackingOptions, NetworkCaptureRule, BodyCaptureRule } from './types/network-tracking';\nexport { SAFE_HEADERS, FORBIDDEN_HEADERS } from './types/constants';\n\nexport { PageUrlEnrichmentOptions } from './types/page-url-enrichment';\nexport { CustomEnrichmentOptions } from './types/custom-enrichment';\nexport { PerformanceTrackingOptions, MainThreadBlockOptions } from './types/performance-tracking';\n\n// Campaign\nexport { Campaign, UTMParameters, ReferrerParameters, ClickIdParameters, ICampaignParser } from './types/campaign';\nexport { EMPTY_VALUE, BASE_CAMPAIGN, MKTG } from './types/constants';\nexport { CampaignParser } from './campaign/campaign-parser';\nexport {\n getPageTitle,\n TEXT_MASK_ATTRIBUTE,\n MASKED_TEXT_VALUE,\n replaceSensitiveString,\n CC_REGEX,\n SSN_REGEX,\n EMAIL_REGEX,\n} from './plugins/helpers';\n\n// Browser\nexport {\n BrowserConfig,\n BrowserOptions,\n DefaultTrackingOptions,\n TrackingOptions,\n TrackingMethod,\n AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\n RemoteConfigOptions,\n} from './types/config/browser-config';\nexport { BrowserClient } from './types/client/browser-client';\n\n// Node\nexport { NodeClient } from './types/client/node-client';\nexport { NodeConfig, NodeOptions } from './types/config/node-config';\n\n// React Native\nexport {\n ReactNativeConfig,\n ReactNativeTrackingOptions,\n ReactNativeOptions,\n ReactNativeAttributionOptions,\n} from './types/config/react-native-config';\nexport { ReactNativeClient } from './types/client/react-native-client';\n\nexport { Observable, asyncMap, merge, multicast, Unsubscribable } from './utils/observable';\n\nexport { InstanceProxy } from './types/proxy';\nexport { safeJsonStringify } from './utils/safe-stringify';\n\n// Messenger (cross-window communication)\nexport type { BaseWindowMessenger, ActionHandler } from './messenger/base-window-messenger';\nexport { getOrCreateWindowMessenger } from './messenger/base-window-messenger';\nexport { enableBackgroundCapture } from './messenger/background-capture';\nexport {\n AMPLITUDE_ORIGIN,\n AMPLITUDE_ORIGIN_EU,\n AMPLITUDE_ORIGIN_STAGING,\n AMPLITUDE_ORIGINS_MAP,\n AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL,\n} from './messenger/constants';\n\nexport { ExcludeInternalReferrersOptions, EXCLUDE_INTERNAL_REFERRERS_CONDITIONS } from './types/config/browser-config';\n\nexport { VideoObserver, State as VideoState, type VideoObserverParams } from './observers/video';\nexport { EmbeddedVideoPlayer, type Vendor as VideoVendor } from './video-analytics/types';\nexport { isChromeExtension, isReactNative } from './utils/environment';\n"]}
|
|
@@ -2,5 +2,5 @@ export declare const AMPLITUDE_ORIGIN = "https://app.amplitude.com";
|
|
|
2
2
|
export declare const AMPLITUDE_ORIGIN_EU = "https://app.eu.amplitude.com";
|
|
3
3
|
export declare const AMPLITUDE_ORIGIN_STAGING = "https://apps.stag2.amplitude.com";
|
|
4
4
|
export declare const AMPLITUDE_ORIGINS_MAP: Record<string, string>;
|
|
5
|
-
export declare const AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = "https://cdn.amplitude.com/libs/background-capture-1.0.
|
|
5
|
+
export declare const AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = "https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz";
|
|
6
6
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -11,5 +11,5 @@ exports.AMPLITUDE_ORIGINS_MAP = {
|
|
|
11
11
|
STAGING: exports.AMPLITUDE_ORIGIN_STAGING,
|
|
12
12
|
};
|
|
13
13
|
// Background capture script URL (shared between autocapture and session-replay)
|
|
14
|
-
exports.AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = 'https://cdn.amplitude.com/libs/background-capture-1.0.
|
|
14
|
+
exports.AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = 'https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz';
|
|
15
15
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/messenger/constants.ts"],"names":[],"mappings":";;;AAAA,mEAAmE;AACtD,QAAA,gBAAgB,GAAG,2BAA2B,CAAC;AAC/C,QAAA,mBAAmB,GAAG,8BAA8B,CAAC;AACrD,QAAA,wBAAwB,GAAG,kCAAkC,CAAC;AAC9D,QAAA,qBAAqB,GAA2B;IAC3D,EAAE,EAAE,wBAAgB;IACpB,EAAE,EAAE,2BAAmB;IACvB,OAAO,EAAE,gCAAwB;CAClC,CAAC;AAEF,gFAAgF;AACnE,QAAA,uCAAuC,GAAG,+DAA+D,CAAC","sourcesContent":["// Shared origin constants for Amplitude cross-window communication\nexport const AMPLITUDE_ORIGIN = 'https://app.amplitude.com';\nexport const AMPLITUDE_ORIGIN_EU = 'https://app.eu.amplitude.com';\nexport const AMPLITUDE_ORIGIN_STAGING = 'https://apps.stag2.amplitude.com';\nexport const AMPLITUDE_ORIGINS_MAP: Record<string, string> = {\n US: AMPLITUDE_ORIGIN,\n EU: AMPLITUDE_ORIGIN_EU,\n STAGING: AMPLITUDE_ORIGIN_STAGING,\n};\n\n// Background capture script URL (shared between autocapture and session-replay)\nexport const AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = 'https://cdn.amplitude.com/libs/background-capture-1.0.
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/messenger/constants.ts"],"names":[],"mappings":";;;AAAA,mEAAmE;AACtD,QAAA,gBAAgB,GAAG,2BAA2B,CAAC;AAC/C,QAAA,mBAAmB,GAAG,8BAA8B,CAAC;AACrD,QAAA,wBAAwB,GAAG,kCAAkC,CAAC;AAC9D,QAAA,qBAAqB,GAA2B;IAC3D,EAAE,EAAE,wBAAgB;IACpB,EAAE,EAAE,2BAAmB;IACvB,OAAO,EAAE,gCAAwB;CAClC,CAAC;AAEF,gFAAgF;AACnE,QAAA,uCAAuC,GAAG,+DAA+D,CAAC","sourcesContent":["// Shared origin constants for Amplitude cross-window communication\nexport const AMPLITUDE_ORIGIN = 'https://app.amplitude.com';\nexport const AMPLITUDE_ORIGIN_EU = 'https://app.eu.amplitude.com';\nexport const AMPLITUDE_ORIGIN_STAGING = 'https://apps.stag2.amplitude.com';\nexport const AMPLITUDE_ORIGINS_MAP: Record<string, string> = {\n US: AMPLITUDE_ORIGIN,\n EU: AMPLITUDE_ORIGIN_EU,\n STAGING: AMPLITUDE_ORIGIN_STAGING,\n};\n\n// Background capture script URL (shared between autocapture and session-replay)\nexport const AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = 'https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz';\n"]}
|
|
@@ -19,6 +19,24 @@ export type DeliveryMode = 'all' | {
|
|
|
19
19
|
* - `remote` - Fetched from remote.
|
|
20
20
|
*/
|
|
21
21
|
export type Source = 'cache' | 'remote';
|
|
22
|
+
/**
|
|
23
|
+
* The fully-formed remote-config request handed to a custom transport. Consumers that need to
|
|
24
|
+
* own the network call (e.g. to attach auth headers and route through a proxy) supply a
|
|
25
|
+
* {@link RemoteConfigCustomFetch} via the client constructor; the client builds this request
|
|
26
|
+
* (resolved URL, headers, abort signal) and the callback executes it.
|
|
27
|
+
*/
|
|
28
|
+
export interface RemoteConfigFetchRequest {
|
|
29
|
+
url: string;
|
|
30
|
+
method: 'GET';
|
|
31
|
+
headers: Record<string, string>;
|
|
32
|
+
/** Abort signal the client uses to enforce the fetch timeout; honor it in your fetch call. */
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Custom transport for the remote-config fetch. Must return a `Response`. Retry/backoff stays
|
|
37
|
+
* in the client around this callback, so it is invoked once per attempt.
|
|
38
|
+
*/
|
|
39
|
+
export type RemoteConfigCustomFetch = (request: RemoteConfigFetchRequest) => Promise<Response>;
|
|
22
40
|
export declare const US_SERVER_URL = "https://sr-client-cfg.amplitude.com/config";
|
|
23
41
|
export declare const EU_SERVER_URL = "https://sr-client-cfg.eu.amplitude.com/config";
|
|
24
42
|
export declare const DEFAULT_MAX_RETRIES = 3;
|
|
@@ -92,7 +110,8 @@ export declare class RemoteConfigClient implements IRemoteConfigClient {
|
|
|
92
110
|
lastSuccessfulFetch: number | null;
|
|
93
111
|
fetchPromise: Promise<RemoteConfigInfo> | null;
|
|
94
112
|
isLastFetchInvalidApiKey: boolean;
|
|
95
|
-
|
|
113
|
+
readonly customFetch?: RemoteConfigCustomFetch;
|
|
114
|
+
constructor(apiKey: string, logger: ILogger, serverZone?: ServerZoneType, serverUrl?: string, customFetch?: RemoteConfigCustomFetch);
|
|
96
115
|
subscribe(key: string | undefined, deliveryMode: DeliveryMode, callback: RemoteConfigCallback): string;
|
|
97
116
|
unsubscribe(id: string): boolean;
|
|
98
117
|
updateConfigs(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-config.d.ts","sourceRoot":"","sources":["../../../src/remote-config/remote-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExC,eAAO,MAAM,aAAa,+CAA+C,CAAC;AAC1E,eAAO,MAAM,aAAa,kDAAkD,CAAC;AAC7E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAmBrC,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAElC,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEzC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG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