@amplitude/analytics-core 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types/server-zone.d.ts +5 -1
- package/lib/cjs/types/server-zone.d.ts.map +1 -1
- package/lib/cjs/types/server-zone.js +4 -0
- package/lib/cjs/types/server-zone.js.map +1 -1
- package/lib/cjs/utils/uuid.d.ts +1 -1
- package/lib/cjs/utils/uuid.d.ts.map +1 -1
- package/lib/cjs/utils/uuid.js +23 -4
- package/lib/cjs/utils/uuid.js.map +1 -1
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types/server-zone.d.ts +5 -1
- package/lib/esm/types/server-zone.d.ts.map +1 -1
- package/lib/esm/types/server-zone.js +4 -0
- package/lib/esm/types/server-zone.js.map +1 -1
- package/lib/esm/utils/uuid.d.ts +1 -1
- package/lib/esm/utils/uuid.d.ts.map +1 -1
- package/lib/esm/utils/uuid.js +21 -2
- package/lib/esm/utils/uuid.js.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Revenue, IRevenue, RevenueProperty } from './revenue';
|
|
|
4
4
|
export { Destination } from './plugins/destination';
|
|
5
5
|
export { IdentityEventSender } from './plugins/identity';
|
|
6
6
|
export { IConfig, Config, RequestMetadata } from './config';
|
|
7
|
-
export { Logger, ILogger } from './logger';
|
|
7
|
+
export { Logger, ILogger, LogConfig } from './logger';
|
|
8
8
|
export { getGlobalScope } from './global-scope';
|
|
9
9
|
export { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';
|
|
10
10
|
export { isNewSession } from './session';
|
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,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,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,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,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,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAA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S,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,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"}
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceR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GAAA,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"]}
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare enum ServerZone {
|
|
5
5
|
US = "US",
|
|
6
|
-
EU = "EU"
|
|
6
|
+
EU = "EU",
|
|
7
|
+
/**
|
|
8
|
+
* Add for session-replay-browser migration from analytics-type v1.x.
|
|
9
|
+
*/
|
|
10
|
+
STAGING = "STAGING"
|
|
7
11
|
}
|
|
8
12
|
export type ServerZoneType = 'US' | 'EU';
|
|
9
13
|
//# sourceMappingURL=server-zone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-zone.d.ts","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,OAAO;IACT,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"server-zone.d.ts","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,OAAO;IACT,EAAE,OAAO;IACT;;OAEG;IACH,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -8,5 +8,9 @@ var ServerZone;
|
|
|
8
8
|
(function (ServerZone) {
|
|
9
9
|
ServerZone["US"] = "US";
|
|
10
10
|
ServerZone["EU"] = "EU";
|
|
11
|
+
/**
|
|
12
|
+
* Add for session-replay-browser migration from analytics-type v1.x.
|
|
13
|
+
*/
|
|
14
|
+
ServerZone["STAGING"] = "STAGING";
|
|
11
15
|
})(ServerZone = exports.ServerZone || (exports.ServerZone = {}));
|
|
12
16
|
//# sourceMappingURL=server-zone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-zone.js","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"server-zone.js","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,uBAAS,CAAA;IACT;;OAEG;IACH,iCAAmB,CAAA;AACrB,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB","sourcesContent":["/**\n * @deprecated use ServerZoneType instead\n */\nexport enum ServerZone {\n US = 'US',\n EU = 'EU',\n /**\n * Add for session-replay-browser migration from analytics-type v1.x.\n */\n STAGING = 'STAGING',\n}\n\nexport type ServerZoneType = 'US' | 'EU';\n"]}
|
package/lib/cjs/utils/uuid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Source: [jed's gist]{@link https://gist.github.com/982883}.
|
|
2
|
+
* Source: [jed's gist's comment]{@link https://gist.github.com/jed/982883?permalink_comment_id=3223002#gistcomment-3223002}.
|
|
3
3
|
* Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,
|
|
4
4
|
* where each x is replaced with a random hexadecimal digit from 0 to f, and
|
|
5
5
|
* y is replaced with a random hexadecimal digit from 8 to b.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+BH,eAAO,MAAM,IAAI,OAAQ,GAAG,KAAG,MAe9B,CAAC"}
|
package/lib/cjs/utils/uuid.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UUID = void 0;
|
|
4
2
|
/**
|
|
5
|
-
* Source: [jed's gist]{@link https://gist.github.com/982883}.
|
|
3
|
+
* Source: [jed's gist's comment]{@link https://gist.github.com/jed/982883?permalink_comment_id=3223002#gistcomment-3223002}.
|
|
6
4
|
* Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,
|
|
7
5
|
* where each x is replaced with a random hexadecimal digit from 0 to f, and
|
|
8
6
|
* y is replaced with a random hexadecimal digit from 8 to b.
|
|
9
7
|
* Used to generate UUIDs for deviceIds.
|
|
10
8
|
* @private
|
|
11
9
|
*/
|
|
12
|
-
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.UUID = void 0;
|
|
12
|
+
var tslib_1 = require("tslib");
|
|
13
|
+
var global_scope_1 = require("../global-scope");
|
|
14
|
+
var legacyUUID = function (a) {
|
|
13
15
|
return a // if the placeholder was passed, return
|
|
14
16
|
? // a random number from 0 to 15
|
|
15
17
|
(a ^ // unless b is 8,
|
|
@@ -28,5 +30,22 @@ var UUID = function (a) {
|
|
|
28
30
|
/[018]/g, // zeroes, ones, and eights with
|
|
29
31
|
exports.UUID);
|
|
30
32
|
};
|
|
33
|
+
var hex = tslib_1.__spreadArray([], tslib_1.__read(Array(256).keys()), false).map(function (index) { return index.toString(16).padStart(2, '0'); });
|
|
34
|
+
var UUID = function (a) {
|
|
35
|
+
var _a;
|
|
36
|
+
var globalScope = (0, global_scope_1.getGlobalScope)();
|
|
37
|
+
/* istanbul ignore next */
|
|
38
|
+
if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.crypto) === null || _a === void 0 ? void 0 : _a.getRandomValues)) {
|
|
39
|
+
// Fallback to legacy UUID generation if crypto is not available
|
|
40
|
+
return legacyUUID(a);
|
|
41
|
+
}
|
|
42
|
+
var r = globalScope.crypto.getRandomValues(new Uint8Array(16));
|
|
43
|
+
r[6] = (r[6] & 0x0f) | 0x40;
|
|
44
|
+
r[8] = (r[8] & 0x3f) | 0x80;
|
|
45
|
+
return tslib_1.__spreadArray([], tslib_1.__read(r.entries()), false).map(function (_a) {
|
|
46
|
+
var _b = tslib_1.__read(_a, 2), index = _b[0], int = _b[1];
|
|
47
|
+
return ([4, 6, 8, 10].includes(index) ? "-".concat(hex[int]) : hex[int]);
|
|
48
|
+
}).join('');
|
|
49
|
+
};
|
|
31
50
|
exports.UUID = UUID;
|
|
32
51
|
//# sourceMappingURL=uuid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;AAEH,gDAAiD;AAEjD,IAAM,UAAU,GAAG,UAAU,CAAO;IAClC,OAAO,CAAC,CAAC,wCAAwC;QAC/C,CAAC,CAAC,+BAA+B;YAC/B,CACE,CAAC,GAAG,iBAAiB;gBACrB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB;oBAChC,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AAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAE5B,OAAO,yCAAI,CAAC,CAAC,OAAO,EAAE,UAAE,GAAG,CAAC,UAAC,EAAY;YAAZ,KAAA,qBAAY,EAAX,KAAK,QAAA,EAAE,GAAG,QAAA;QAAM,OAAA,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAI,GAAG,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAA3D,CAA2D,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtH,CAAC,CAAC;AAfW,QAAA,IAAI,QAef","sourcesContent":["/**\n * Source: [jed's gist's comment]{@link https://gist.github.com/jed/982883?permalink_comment_id=3223002#gistcomment-3223002}.\n * Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,\n * where each x is replaced with a random hexadecimal digit from 0 to f, and\n * y is replaced with a random hexadecimal digit from 8 to b.\n * Used to generate UUIDs for deviceIds.\n * @private\n */\n\nimport { getGlobalScope } from '../global-scope';\n\nconst legacyUUID = function (a?: any): string {\n return a // if the placeholder was passed, return\n ? // a random number from 0 to 15\n (\n a ^ // unless b is 8,\n ((Math.random() * // in which case\n 16) >> // a random number from\n (a / 4))\n ) // 8 to 11\n .toString(16) // in hexadecimal\n : // or otherwise a concatenated string:\n (\n String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)\n ) // -100000000000,\n .replace(\n // replacing\n /[018]/g, // zeroes, ones, and eights with\n UUID, // random hex digits\n );\n};\n\nconst hex: string[] = [...Array(256).keys()].map((index) => index.toString(16).padStart(2, '0'));\n\nexport const UUID = (a?: any): string => {\n const globalScope = getGlobalScope();\n\n /* istanbul ignore next */\n if (!globalScope?.crypto?.getRandomValues) {\n // Fallback to legacy UUID generation if crypto is not available\n return legacyUUID(a);\n }\n\n const r = globalScope.crypto.getRandomValues(new Uint8Array(16));\n\n r[6] = (r[6] & 0x0f) | 0x40;\n r[8] = (r[8] & 0x3f) | 0x80;\n\n return [...r.entries()].map(([index, int]) => ([4, 6, 8, 10].includes(index) ? `-${hex[int]}` : hex[int])).join('');\n};\n"]}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Revenue, IRevenue, RevenueProperty } from './revenue';
|
|
|
4
4
|
export { Destination } from './plugins/destination';
|
|
5
5
|
export { IdentityEventSender } from './plugins/identity';
|
|
6
6
|
export { IConfig, Config, RequestMetadata } from './config';
|
|
7
|
-
export { Logger, ILogger } from './logger';
|
|
7
|
+
export { Logger, ILogger, LogConfig } from './logger';
|
|
8
8
|
export { getGlobalScope } from './global-scope';
|
|
9
9
|
export { getAnalyticsConnector, setConnectorDeviceId, setConnectorUserId } from './analytics-connector';
|
|
10
10
|
export { isNewSession } from './session';
|
package/lib/esm/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,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,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,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+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,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"}
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAa,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAW,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAa,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAW,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAsB,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE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ify, 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"]}
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare enum ServerZone {
|
|
5
5
|
US = "US",
|
|
6
|
-
EU = "EU"
|
|
6
|
+
EU = "EU",
|
|
7
|
+
/**
|
|
8
|
+
* Add for session-replay-browser migration from analytics-type v1.x.
|
|
9
|
+
*/
|
|
10
|
+
STAGING = "STAGING"
|
|
7
11
|
}
|
|
8
12
|
export type ServerZoneType = 'US' | 'EU';
|
|
9
13
|
//# sourceMappingURL=server-zone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-zone.d.ts","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,OAAO;IACT,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"server-zone.d.ts","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,OAAO;IACT,EAAE,OAAO;IACT;;OAEG;IACH,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -5,5 +5,9 @@ export var ServerZone;
|
|
|
5
5
|
(function (ServerZone) {
|
|
6
6
|
ServerZone["US"] = "US";
|
|
7
7
|
ServerZone["EU"] = "EU";
|
|
8
|
+
/**
|
|
9
|
+
* Add for session-replay-browser migration from analytics-type v1.x.
|
|
10
|
+
*/
|
|
11
|
+
ServerZone["STAGING"] = "STAGING";
|
|
8
12
|
})(ServerZone || (ServerZone = {}));
|
|
9
13
|
//# sourceMappingURL=server-zone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-zone.js","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"server-zone.js","sourceRoot":"","sources":["../../../src/types/server-zone.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,uBAAS,CAAA;IACT;;OAEG;IACH,iCAAmB,CAAA;AACrB,CAAC,EAPW,UAAU,KAAV,UAAU,QAOrB","sourcesContent":["/**\n * @deprecated use ServerZoneType instead\n */\nexport enum ServerZone {\n US = 'US',\n EU = 'EU',\n /**\n * Add for session-replay-browser migration from analytics-type v1.x.\n */\n STAGING = 'STAGING',\n}\n\nexport type ServerZoneType = 'US' | 'EU';\n"]}
|
package/lib/esm/utils/uuid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Source: [jed's gist]{@link https://gist.github.com/982883}.
|
|
2
|
+
* Source: [jed's gist's comment]{@link https://gist.github.com/jed/982883?permalink_comment_id=3223002#gistcomment-3223002}.
|
|
3
3
|
* Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,
|
|
4
4
|
* where each x is replaced with a random hexadecimal digit from 0 to f, and
|
|
5
5
|
* y is replaced with a random hexadecimal digit from 8 to b.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+BH,eAAO,MAAM,IAAI,OAAQ,GAAG,KAAG,MAe9B,CAAC"}
|
package/lib/esm/utils/uuid.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Source: [jed's gist]{@link https://gist.github.com/982883}.
|
|
2
|
+
* Source: [jed's gist's comment]{@link https://gist.github.com/jed/982883?permalink_comment_id=3223002#gistcomment-3223002}.
|
|
3
3
|
* Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,
|
|
4
4
|
* where each x is replaced with a random hexadecimal digit from 0 to f, and
|
|
5
5
|
* y is replaced with a random hexadecimal digit from 8 to b.
|
|
6
6
|
* Used to generate UUIDs for deviceIds.
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
import { __read, __spreadArray } from "tslib";
|
|
10
|
+
import { getGlobalScope } from '../global-scope';
|
|
11
|
+
var legacyUUID = function (a) {
|
|
10
12
|
return a // if the placeholder was passed, return
|
|
11
13
|
? // a random number from 0 to 15
|
|
12
14
|
(a ^ // unless b is 8,
|
|
@@ -25,4 +27,21 @@ export var UUID = function (a) {
|
|
|
25
27
|
/[018]/g, // zeroes, ones, and eights with
|
|
26
28
|
UUID);
|
|
27
29
|
};
|
|
30
|
+
var hex = __spreadArray([], __read(Array(256).keys()), false).map(function (index) { return index.toString(16).padStart(2, '0'); });
|
|
31
|
+
export var UUID = function (a) {
|
|
32
|
+
var _a;
|
|
33
|
+
var globalScope = getGlobalScope();
|
|
34
|
+
/* istanbul ignore next */
|
|
35
|
+
if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.crypto) === null || _a === void 0 ? void 0 : _a.getRandomValues)) {
|
|
36
|
+
// Fallback to legacy UUID generation if crypto is not available
|
|
37
|
+
return legacyUUID(a);
|
|
38
|
+
}
|
|
39
|
+
var r = globalScope.crypto.getRandomValues(new Uint8Array(16));
|
|
40
|
+
r[6] = (r[6] & 0x0f) | 0x40;
|
|
41
|
+
r[8] = (r[8] & 0x3f) | 0x80;
|
|
42
|
+
return __spreadArray([], __read(r.entries()), false).map(function (_a) {
|
|
43
|
+
var _b = __read(_a, 2), index = _b[0], int = _b[1];
|
|
44
|
+
return ([4, 6, 8, 10].includes(index) ? "-".concat(hex[int]) : hex[int]);
|
|
45
|
+
}).join('');
|
|
46
|
+
};
|
|
28
47
|
//# sourceMappingURL=uuid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,IAAM,UAAU,GAAG,UAAU,CAAO;IAClC,OAAO,CAAC,CAAC,wCAAwC;QAC/C,CAAC,CAAC,+BAA+B;YAC/B,CACE,CAAC,GAAG,iBAAiB;gBACrB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB;oBAChC,EAAE,CAAC,IAAI,uBAAuB;oBAC9B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CACX,CAAC,UAAU;iBACT,QAAQ,CAAC,EAAE,CAAC,CAAC,iBAAiB;QACnC,CAAC,CAAC,sCAAsC;YACtC,CACE,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa;gBAC3B,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,UAAU;gBACzB,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,UAAU;gBACzB,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc;gBAC7B,MAAM,CAAC,CAAC,IAAI,CAAC,CACd,CAAC,iBAAiB;iBAChB,OAAO;YACN,YAAY;YACZ,QAAQ,EAAE,gCAAgC;YAC1C,IAAI,CACL,CAAC;AACV,CAAC,CAAC;AAEF,IAAM,GAAG,GAAa,yBAAI,KAAK,CA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_id=3223002#gistcomment-3223002}.\n * Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,\n * where each x is replaced with a random hexadecimal digit from 0 to f, and\n * y is replaced with a random hexadecimal digit from 8 to b.\n * Used to generate UUIDs for deviceIds.\n * @private\n */\n\nimport { getGlobalScope } from '../global-scope';\n\nconst legacyUUID = function (a?: any): string {\n return a // if the placeholder was passed, return\n ? // a random number from 0 to 15\n (\n a ^ // unless b is 8,\n ((Math.random() * // in which case\n 16) >> // a random number from\n (a / 4))\n ) // 8 to 11\n .toString(16) // in hexadecimal\n : // or otherwise a concatenated string:\n (\n String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)\n ) // -100000000000,\n .replace(\n // replacing\n /[018]/g, // zeroes, ones, and eights with\n UUID, // random hex digits\n );\n};\n\nconst hex: string[] = [...Array(256).keys()].map((index) => index.toString(16).padStart(2, '0'));\n\nexport const UUID = (a?: any): string => {\n const globalScope = getGlobalScope();\n\n /* istanbul ignore next */\n if (!globalScope?.crypto?.getRandomValues) {\n // Fallback to legacy UUID generation if crypto is not available\n return legacyUUID(a);\n }\n\n const r = globalScope.crypto.getRandomValues(new Uint8Array(16));\n\n r[6] = (r[6] & 0x0f) | 0x40;\n r[8] = (r[8] & 0x3f) | 0x80;\n\n return [...r.entries()].map(([index, int]) => ([4, 6, 8, 10].includes(index) ? `-${hex[int]}` : hex[int])).join('');\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"lib"
|
|
42
42
|
],
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "bed8f4e611b944dab30a9aea4e48022655b0ddb0"
|
|
44
44
|
}
|