@amplitude/analytics-core 2.26.1 → 2.27.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/diagnostics/diagnostics-client.d.ts +32 -1
- package/lib/cjs/diagnostics/diagnostics-client.d.ts.map +1 -1
- package/lib/cjs/diagnostics/diagnostics-client.js +48 -23
- package/lib/cjs/diagnostics/diagnostics-client.js.map +1 -1
- package/lib/cjs/index.d.ts +3 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +15 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/plugins/helpers.d.ts +18 -0
- package/lib/cjs/plugins/helpers.d.ts.map +1 -0
- package/lib/cjs/plugins/helpers.js +67 -0
- package/lib/cjs/plugins/helpers.js.map +1 -0
- package/lib/cjs/types/amplitude-context.d.ts +7 -5
- package/lib/cjs/types/amplitude-context.d.ts.map +1 -1
- package/lib/cjs/types/amplitude-context.js +0 -30
- package/lib/cjs/types/amplitude-context.js.map +1 -1
- package/lib/cjs/types/client/browser-client.d.ts +9 -0
- package/lib/cjs/types/client/browser-client.d.ts.map +1 -1
- package/lib/cjs/types/client/browser-client.js.map +1 -1
- package/lib/cjs/types/config/browser-config.d.ts +10 -0
- package/lib/cjs/types/config/browser-config.d.ts.map +1 -1
- package/lib/cjs/types/config/browser-config.js.map +1 -1
- package/lib/cjs/types/network-tracking.d.ts +0 -5
- package/lib/cjs/types/network-tracking.d.ts.map +1 -1
- package/lib/cjs/types/network-tracking.js.map +1 -1
- package/lib/cjs/utils/sampling.d.ts +3 -0
- package/lib/cjs/utils/sampling.d.ts.map +1 -0
- package/lib/cjs/utils/sampling.js +24 -0
- package/lib/cjs/utils/sampling.js.map +1 -0
- package/lib/esm/diagnostics/diagnostics-client.d.ts +32 -1
- package/lib/esm/diagnostics/diagnostics-client.d.ts.map +1 -1
- package/lib/esm/diagnostics/diagnostics-client.js +48 -23
- package/lib/esm/diagnostics/diagnostics-client.js.map +1 -1
- package/lib/esm/index.d.ts +3 -0
- 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/plugins/helpers.d.ts +18 -0
- package/lib/esm/plugins/helpers.d.ts.map +1 -0
- package/lib/esm/plugins/helpers.js +62 -0
- package/lib/esm/plugins/helpers.js.map +1 -0
- package/lib/esm/types/amplitude-context.d.ts +7 -5
- package/lib/esm/types/amplitude-context.d.ts.map +1 -1
- package/lib/esm/types/amplitude-context.js +1 -29
- package/lib/esm/types/amplitude-context.js.map +1 -1
- package/lib/esm/types/client/browser-client.d.ts +9 -0
- package/lib/esm/types/client/browser-client.d.ts.map +1 -1
- package/lib/esm/types/client/browser-client.js.map +1 -1
- package/lib/esm/types/config/browser-config.d.ts +10 -0
- package/lib/esm/types/config/browser-config.d.ts.map +1 -1
- package/lib/esm/types/config/browser-config.js.map +1 -1
- package/lib/esm/types/network-tracking.d.ts +0 -5
- package/lib/esm/types/network-tracking.d.ts.map +1 -1
- package/lib/esm/types/network-tracking.js.map +1 -1
- package/lib/esm/utils/sampling.d.ts +3 -0
- package/lib/esm/utils/sampling.d.ts.map +1 -0
- package/lib/esm/utils/sampling.js +19 -0
- package/lib/esm/utils/sampling.js.map +1 -0
- package/package.json +2 -2
package/lib/esm/index.d.ts
CHANGED
|
@@ -20,10 +20,12 @@ export { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug
|
|
|
20
20
|
export { UUID } from './utils/uuid';
|
|
21
21
|
export { createIdentifyEvent } from './utils/event-builder';
|
|
22
22
|
export { isUrlMatchAllowlist, getDecodeURI } from './utils/url-utils';
|
|
23
|
+
export { generateHashCode, isTimestampInSample } from './utils/sampling';
|
|
23
24
|
export { MemoryStorage } from './storage/memory';
|
|
24
25
|
export { CookieStorage } from './storage/cookie';
|
|
25
26
|
export { getStorageKey } from './storage/helpers';
|
|
26
27
|
export { BrowserStorage } from './storage/browser-storage';
|
|
28
|
+
export { DiagnosticsClient, IDiagnosticsClient } from './diagnostics/diagnostics-client';
|
|
27
29
|
export { BaseTransport } from './transports/base';
|
|
28
30
|
export { FetchTransport } from './transports/fetch';
|
|
29
31
|
export { RemoteConfigClient, IRemoteConfigClient, RemoteConfig, Source } from './remote-config/remote-config';
|
|
@@ -54,6 +56,7 @@ export { PageUrlEnrichmentOptions } from './types/page-url-enrichment';
|
|
|
54
56
|
export { Campaign, UTMParameters, ReferrerParameters, ClickIdParameters, ICampaignParser } from './types/campaign';
|
|
55
57
|
export { EMPTY_VALUE, BASE_CAMPAIGN, MKTG } from './types/constants';
|
|
56
58
|
export { CampaignParser } from './campaign/campaign-parser';
|
|
59
|
+
export { getPageTitle, TEXT_MASK_ATTRIBUTE, MASKED_TEXT_VALUE, replaceSensitiveString, CC_REGEX, SSN_REGEX, EMAIL_REGEX, } from './plugins/helpers';
|
|
57
60
|
export { BrowserConfig, BrowserOptions, DefaultTrackingOptions, TrackingOptions, AutocaptureOptions, CookieOptions, AttributionOptions, } from './types/config/browser-config';
|
|
58
61
|
export { BrowserClient } from './types/client/browser-client';
|
|
59
62
|
export { NodeClient } from './types/client/node-client';
|
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,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,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,C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EAClB,aAAa,EACb,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { AmplitudeCore } from './core-client';
|
|
2
|
-
export { AmplitudeContext } from './types/amplitude-context';
|
|
3
2
|
export { Identify } from './identify';
|
|
4
3
|
export { Revenue, RevenueProperty } from './revenue';
|
|
5
4
|
export { Destination } from './plugins/destination';
|
|
@@ -17,11 +16,12 @@ export { debugWrapper, getClientLogConfig, getClientStates } from './utils/debug
|
|
|
17
16
|
export { UUID } from './utils/uuid';
|
|
18
17
|
export { createIdentifyEvent } from './utils/event-builder';
|
|
19
18
|
export { isUrlMatchAllowlist, getDecodeURI } from './utils/url-utils';
|
|
19
|
+
export { generateHashCode, isTimestampInSample } from './utils/sampling';
|
|
20
20
|
export { MemoryStorage } from './storage/memory';
|
|
21
21
|
export { CookieStorage } from './storage/cookie';
|
|
22
22
|
export { getStorageKey } from './storage/helpers';
|
|
23
23
|
export { BrowserStorage } from './storage/browser-storage';
|
|
24
|
-
|
|
24
|
+
export { DiagnosticsClient } from './diagnostics/diagnostics-client';
|
|
25
25
|
export { BaseTransport } from './transports/base';
|
|
26
26
|
export { FetchTransport } from './transports/fetch';
|
|
27
27
|
export { RemoteConfigClient } from './remote-config/remote-config';
|
|
@@ -38,4 +38,5 @@ export { NetworkRequestEvent } from './network-request-event';
|
|
|
38
38
|
export { SAFE_HEADERS, FORBIDDEN_HEADERS } from './types/constants';
|
|
39
39
|
export { EMPTY_VALUE, BASE_CAMPAIGN, MKTG } from './types/constants';
|
|
40
40
|
export { CampaignParser } from './campaign/campaign-parser';
|
|
41
|
+
export { getPageTitle, TEXT_MASK_ATTRIBUTE, MASKED_TEXT_VALUE, replaceSensitiveString, CC_REGEX, SSN_REGEX, EMAIL_REGEX, } from './plugins/helpers';
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
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,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C,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,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAsB,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,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,E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AC1C,4BAA4B,GAC7B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAqD,MAAM,yBAAyB,CAAC;AAEjH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAMpE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,MAAM,mBAAmB,CAAC","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 } 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';\n\nexport { MemoryStorage } from './storage/memory';\nexport { CookieStorage } from './storage/cookie';\nexport { getStorageKey } from './storage/helpers';\n\nexport { BrowserStorage } from './storage/browser-storage';\n\nexport { DiagnosticsClient, IDiagnosticsClient } from './diagnostics/diagnostics-client';\n\nexport { BaseTransport } from './transports/base';\nexport { FetchTransport } from './transports/fetch';\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 } 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 {\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} from './types/element-interactions';\n\nexport {\n FrustrationInteractionsOptions,\n DEFAULT_DEAD_CLICK_ALLOWLIST,\n DEFAULT_RAGE_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 { Status } from './types/status';\n\nexport { NetworkEventCallback, networkObserver } from './network-observer';\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';\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 AutocaptureOptions,\n CookieOptions,\n AttributionOptions,\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"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const TEXT_MASK_ATTRIBUTE = "data-amp-mask";
|
|
2
|
+
export declare const MASKED_TEXT_VALUE = "*****";
|
|
3
|
+
export declare const CC_REGEX: RegExp;
|
|
4
|
+
export declare const SSN_REGEX: RegExp;
|
|
5
|
+
export declare const EMAIL_REGEX: RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* Replaces sensitive strings (credit cards, SSNs, emails) and custom patterns with masked text
|
|
8
|
+
* @param text - The text to search for sensitive data
|
|
9
|
+
* @param additionalMaskTextPatterns - Optional array of additional regex patterns to mask
|
|
10
|
+
* @returns The text with sensitive data replaced by masked text
|
|
11
|
+
*/
|
|
12
|
+
export declare const replaceSensitiveString: (text: string | null, additionalMaskTextPatterns?: RegExp[]) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the page title, checking if the title element has data-amp-mask attribute
|
|
15
|
+
* @returns The page title, masked if the title element has data-amp-mask attribute
|
|
16
|
+
*/
|
|
17
|
+
export declare const getPageTitle: (parseTitleFunction?: ((title: string) => string) | undefined) => string;
|
|
18
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/plugins/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAGzC,eAAO,MAAM,QAAQ,QAA4B,CAAC;AAClD,eAAO,MAAM,SAAS,QAA2B,CAAC;AAClD,eAAO,MAAM,WAAW,QAA+B,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAAU,MAAM,GAAG,IAAI,+BAA8B,MAAM,EAAE,KAAQ,MA0BvG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,iCAAiC,MAAM,KAAK,MAAM,kBAAG,MAS7E,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __values } from "tslib";
|
|
2
|
+
export var TEXT_MASK_ATTRIBUTE = 'data-amp-mask';
|
|
3
|
+
export var MASKED_TEXT_VALUE = '*****';
|
|
4
|
+
// Regex patterns for sensitive data
|
|
5
|
+
export var CC_REGEX = /\b(?:\d[ -]*?){13,16}\b/;
|
|
6
|
+
export var SSN_REGEX = /(\d{3}-?\d{2}-?\d{4})/g;
|
|
7
|
+
export var EMAIL_REGEX = /[^\s@]+@[^\s@.]+\.[^\s@]+/g;
|
|
8
|
+
/**
|
|
9
|
+
* Replaces sensitive strings (credit cards, SSNs, emails) and custom patterns with masked text
|
|
10
|
+
* @param text - The text to search for sensitive data
|
|
11
|
+
* @param additionalMaskTextPatterns - Optional array of additional regex patterns to mask
|
|
12
|
+
* @returns The text with sensitive data replaced by masked text
|
|
13
|
+
*/
|
|
14
|
+
export var replaceSensitiveString = function (text, additionalMaskTextPatterns) {
|
|
15
|
+
var e_1, _a;
|
|
16
|
+
if (additionalMaskTextPatterns === void 0) { additionalMaskTextPatterns = []; }
|
|
17
|
+
if (typeof text !== 'string') {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
var result = text;
|
|
21
|
+
// Check for credit card number (with or without spaces/dashes)
|
|
22
|
+
result = result.replace(CC_REGEX, MASKED_TEXT_VALUE);
|
|
23
|
+
// Check for social security number
|
|
24
|
+
result = result.replace(SSN_REGEX, MASKED_TEXT_VALUE);
|
|
25
|
+
// Check for email
|
|
26
|
+
result = result.replace(EMAIL_REGEX, MASKED_TEXT_VALUE);
|
|
27
|
+
try {
|
|
28
|
+
// Check for additional mask text patterns
|
|
29
|
+
for (var additionalMaskTextPatterns_1 = __values(additionalMaskTextPatterns), additionalMaskTextPatterns_1_1 = additionalMaskTextPatterns_1.next(); !additionalMaskTextPatterns_1_1.done; additionalMaskTextPatterns_1_1 = additionalMaskTextPatterns_1.next()) {
|
|
30
|
+
var pattern = additionalMaskTextPatterns_1_1.value;
|
|
31
|
+
try {
|
|
32
|
+
result = result.replace(pattern, MASKED_TEXT_VALUE);
|
|
33
|
+
}
|
|
34
|
+
catch (_b) {
|
|
35
|
+
// ignore invalid pattern
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
40
|
+
finally {
|
|
41
|
+
try {
|
|
42
|
+
if (additionalMaskTextPatterns_1_1 && !additionalMaskTextPatterns_1_1.done && (_a = additionalMaskTextPatterns_1.return)) _a.call(additionalMaskTextPatterns_1);
|
|
43
|
+
}
|
|
44
|
+
finally { if (e_1) throw e_1.error; }
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Gets the page title, checking if the title element has data-amp-mask attribute
|
|
50
|
+
* @returns The page title, masked if the title element has data-amp-mask attribute
|
|
51
|
+
*/
|
|
52
|
+
export var getPageTitle = function (parseTitleFunction) {
|
|
53
|
+
if (typeof document === 'undefined' || !document.title) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
var titleElement = document.querySelector('title');
|
|
57
|
+
if (titleElement && titleElement.hasAttribute(TEXT_MASK_ATTRIBUTE)) {
|
|
58
|
+
return MASKED_TEXT_VALUE;
|
|
59
|
+
}
|
|
60
|
+
return parseTitleFunction ? parseTitleFunction(document.title) : document.title; // document.title is always synced to the first title element
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/plugins/helpers.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,IAAM,mBAAmB,GAAG,eAAe,CAAC;AACnD,MAAM,CAAC,IAAM,iBAAiB,GAAG,OAAO,CAAC;AAEzC,oCAAoC;AACpC,MAAM,CAAC,IAAM,QAAQ,GAAG,yBAAyB,CAAC;AAClD,MAAM,CAAC,IAAM,SAAS,GAAG,wBAAwB,CAAC;AAClD,MAAM,CAAC,IAAM,WAAW,GAAG,4BAA4B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAC,IAAmB,EAAE,0BAAyC;;IAAzC,2CAAA,EAAA,+BAAyC;IACnG,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,EAAE,CAAC;KACX;IAED,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,+DAA+D;IAC/D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAErD,mCAAmC;IACnC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEtD,kBAAkB;IAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;;QAExD,0CAA0C;QAC1C,KAAsB,IAAA,+BAAA,SAAA,0BAA0B,CAAA,sEAAA,8GAAE;YAA7C,IAAM,OAAO,uCAAA;YAChB,IAAI;gBACF,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;aACrD;YAAC,WAAM;gBACN,yBAAyB;aAC1B;SACF;;;;;;;;;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,kBAA8C;IACzE,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;QACtD,OAAO,EAAE,CAAC;KACX;IACD,IAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,YAAY,IAAI,YAAY,CAAC,YAAY,CAAC,mBAAmB,CAAC,EAAE;QAClE,OAAO,iBAAiB,CAAC;KAC1B;IACD,OAAO,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,6DAA6D;AAChJ,CAAC,CAAC","sourcesContent":["export const TEXT_MASK_ATTRIBUTE = 'data-amp-mask';\nexport const MASKED_TEXT_VALUE = '*****';\n\n// Regex patterns for sensitive data\nexport const CC_REGEX = /\\b(?:\\d[ -]*?){13,16}\\b/;\nexport const SSN_REGEX = /(\\d{3}-?\\d{2}-?\\d{4})/g;\nexport const EMAIL_REGEX = /[^\\s@]+@[^\\s@.]+\\.[^\\s@]+/g;\n\n/**\n * Replaces sensitive strings (credit cards, SSNs, emails) and custom patterns with masked text\n * @param text - The text to search for sensitive data\n * @param additionalMaskTextPatterns - Optional array of additional regex patterns to mask\n * @returns The text with sensitive data replaced by masked text\n */\nexport const replaceSensitiveString = (text: string | null, additionalMaskTextPatterns: RegExp[] = []): string => {\n if (typeof text !== 'string') {\n return '';\n }\n\n let result = text;\n\n // Check for credit card number (with or without spaces/dashes)\n result = result.replace(CC_REGEX, MASKED_TEXT_VALUE);\n\n // Check for social security number\n result = result.replace(SSN_REGEX, MASKED_TEXT_VALUE);\n\n // Check for email\n result = result.replace(EMAIL_REGEX, MASKED_TEXT_VALUE);\n\n // Check for additional mask text patterns\n for (const pattern of additionalMaskTextPatterns) {\n try {\n result = result.replace(pattern, MASKED_TEXT_VALUE);\n } catch {\n // ignore invalid pattern\n }\n }\n\n return result;\n};\n\n/**\n * Gets the page title, checking if the title element has data-amp-mask attribute\n * @returns The page title, masked if the title element has data-amp-mask attribute\n */\nexport const getPageTitle = (parseTitleFunction?: (title: string) => string): string => {\n if (typeof document === 'undefined' || !document.title) {\n return '';\n }\n const titleElement = document.querySelector('title');\n if (titleElement && titleElement.hasAttribute(TEXT_MASK_ATTRIBUTE)) {\n return MASKED_TEXT_VALUE;\n }\n return parseTitleFunction ? parseTitleFunction(document.title) : document.title; // document.title is always synced to the first title element\n};\n"]}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { ServerZoneType } from './server-zone';
|
|
2
|
-
import {
|
|
2
|
+
import { IRemoteConfigClient } from '../remote-config/remote-config';
|
|
3
3
|
import { ILogger } from '../logger';
|
|
4
|
+
import { IDiagnosticsClient } from '../diagnostics/diagnostics-client';
|
|
4
5
|
/**
|
|
5
6
|
* @experimental
|
|
6
7
|
* AmplitudeContext holds the core configuration and dependencies for an Amplitude instance.
|
|
7
8
|
* This includes API key, instance name, server zone, remote config client, and logger.
|
|
9
|
+
* They are all readonly and not nullable.
|
|
8
10
|
*/
|
|
9
|
-
export
|
|
11
|
+
export interface AmplitudeContext {
|
|
10
12
|
readonly apiKey: string;
|
|
11
13
|
readonly instanceName: string;
|
|
12
14
|
readonly serverZone: ServerZoneType;
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
|
|
15
|
+
readonly loggerProvider: ILogger;
|
|
16
|
+
readonly remoteConfigClient: IRemoteConfigClient;
|
|
17
|
+
readonly diagnosticsClient: IDiagnosticsClient;
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=amplitude-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplitude-context.d.ts","sourceRoot":"","sources":["../../../src/types/amplitude-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"amplitude-context.d.ts","sourceRoot":"","sources":["../../../src/types/amplitude-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC,QAAQ,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;IACjD,QAAQ,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;CAChD"}
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Logger } from '../logger';
|
|
3
|
-
import { LogLevel } from './loglevel';
|
|
4
|
-
import { DEFAULT_INSTANCE_NAME } from './constants';
|
|
5
|
-
/**
|
|
6
|
-
* @experimental
|
|
7
|
-
* AmplitudeContext holds the core configuration and dependencies for an Amplitude instance.
|
|
8
|
-
* This includes API key, instance name, server zone, remote config client, and logger.
|
|
9
|
-
*/
|
|
10
|
-
var AmplitudeContext = /** @class */ (function () {
|
|
11
|
-
function AmplitudeContext(apiKey, instanceName, serverZone, logger) {
|
|
12
|
-
if (instanceName === void 0) { instanceName = DEFAULT_INSTANCE_NAME; }
|
|
13
|
-
if (serverZone === void 0) { serverZone = 'US'; }
|
|
14
|
-
this.apiKey = apiKey;
|
|
15
|
-
this.instanceName = instanceName;
|
|
16
|
-
this.serverZone = serverZone;
|
|
17
|
-
if (!logger) {
|
|
18
|
-
var defaultLogger = new Logger();
|
|
19
|
-
defaultLogger.enable(LogLevel.Error);
|
|
20
|
-
this.logger = defaultLogger;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.logger = logger;
|
|
24
|
-
}
|
|
25
|
-
this.remoteConfigClient = new RemoteConfigClient(this.apiKey, this.logger, this.serverZone);
|
|
26
|
-
}
|
|
27
|
-
return AmplitudeContext;
|
|
28
|
-
}());
|
|
29
|
-
export { AmplitudeContext };
|
|
1
|
+
export {};
|
|
30
2
|
//# sourceMappingURL=amplitude-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amplitude-context.js","sourceRoot":"","sources":["../../../src/types/amplitude-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"amplitude-context.js","sourceRoot":"","sources":["../../../src/types/amplitude-context.ts"],"names":[],"mappings":"","sourcesContent":["import { ServerZoneType } from './server-zone';\nimport { IRemoteConfigClient } from '../remote-config/remote-config';\nimport { ILogger } from '../logger';\nimport { IDiagnosticsClient } from '../diagnostics/diagnostics-client';\n\n/**\n * @experimental\n * AmplitudeContext holds the core configuration and dependencies for an Amplitude instance.\n * This includes API key, instance name, server zone, remote config client, and logger.\n * They are all readonly and not nullable.\n */\nexport interface AmplitudeContext {\n readonly apiKey: string;\n readonly instanceName: string;\n readonly serverZone: ServerZoneType;\n readonly loggerProvider: ILogger;\n\n readonly remoteConfigClient: IRemoteConfigClient;\n readonly diagnosticsClient: IDiagnosticsClient;\n}\n"]}
|
|
@@ -63,5 +63,14 @@ export interface BrowserClient extends Client {
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
getOptOut(): boolean | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* @experimental
|
|
68
|
+
* WARNING: This method is for internal testing only and is not part of the public API.
|
|
69
|
+
* It may be changed or removed at any time without notice.
|
|
70
|
+
*
|
|
71
|
+
* Sets the diagnostics sample rate before amplitude.init()
|
|
72
|
+
* @param sampleRate - The sample rate to set
|
|
73
|
+
*/
|
|
74
|
+
_setDiagnosticsSampleRate(sampleRate: number): void;
|
|
66
75
|
}
|
|
67
76
|
//# sourceMappingURL=browser-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.d.ts","sourceRoot":"","sources":["../../../../src/types/client/browser-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEzE,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC3C;;;;;;;OAOG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CA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Aa,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEzE;;;;;;OAMG;IACH,WAAW,IAAI,iBAAiB,CAAC;IAEjC;;;;;;OAMG;IACH,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;IAEjC;;;;;;;OAOG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../../../src/types/client/browser-client.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from '../transport';\nimport { Client } from './core-client';\nimport { AnalyticsIdentity, Plugin } from '../plugin';\nimport { AmplitudeReturn } from '../../utils/return-wrapper';\nimport { BrowserConfig, BrowserOptions } from '../config/browser-config';\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n\n /**\n * Returns the current identity.\n *\n * ```typescript\n * const identity = getIdentity();\n * ```\n */\n getIdentity(): AnalyticsIdentity;\n\n /**\n * Returns the current optOut config value.\n *\n * ```typescript\n * const optOut = getOptOut();\n * ```\n */\n getOptOut(): boolean | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../../../src/types/client/browser-client.ts"],"names":[],"mappings":"","sourcesContent":["import { TransportType } from '../transport';\nimport { Client } from './core-client';\nimport { AnalyticsIdentity, Plugin } from '../plugin';\nimport { AmplitudeReturn } from '../../utils/return-wrapper';\nimport { BrowserConfig, BrowserOptions } from '../config/browser-config';\n\nexport interface BrowserClient extends Client {\n /**\n * Initializes the Amplitude SDK with your apiKey, optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, options).promise;\n * ```\n */\n init(apiKey: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n init(apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void>;\n\n /**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\n setTransport(transport: TransportType): void;\n\n /**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {\n * name: 'my-plugin',\n * type: 'enrichment',\n * async setup(config: BrowserConfig, amplitude: BrowserClient) {\n * return;\n * },\n * async execute(event: Event) {\n * return event;\n * },\n * };\n * amplitude.add(plugin);\n * ```\n */\n add(plugin: Plugin<BrowserClient, BrowserConfig>): AmplitudeReturn<void>;\n\n /**\n * Returns the current identity.\n *\n * ```typescript\n * const identity = getIdentity();\n * ```\n */\n getIdentity(): AnalyticsIdentity;\n\n /**\n * Returns the current optOut config value.\n *\n * ```typescript\n * const optOut = getOptOut();\n * ```\n */\n getOptOut(): boolean | undefined;\n\n /**\n * @experimental\n * WARNING: This method is for internal testing only and is not part of the public API.\n * It may be changed or removed at any time without notice.\n *\n * Sets the diagnostics sample rate before amplitude.init()\n * @param sampleRate - The sample rate to set\n */\n _setDiagnosticsSampleRate(sampleRate: number): void;\n}\n"]}
|
|
@@ -6,6 +6,8 @@ import { ElementInteractionsOptions } from '../element-interactions';
|
|
|
6
6
|
import { PageTrackingOptions } from '../page-view-tracking';
|
|
7
7
|
import { NetworkTrackingOptions } from '../network-tracking';
|
|
8
8
|
import { FrustrationInteractionsOptions } from '../frustration-interactions';
|
|
9
|
+
import { IDiagnosticsClient } from '../../diagnostics/diagnostics-client';
|
|
10
|
+
import { IRemoteConfigClient } from '../../remote-config/remote-config';
|
|
9
11
|
export interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {
|
|
10
12
|
}
|
|
11
13
|
export interface ExternalBrowserConfig extends IConfig {
|
|
@@ -88,6 +90,11 @@ export interface ExternalBrowserConfig extends IConfig {
|
|
|
88
90
|
* @deprecated use autocapture.networkTracking instead
|
|
89
91
|
*/
|
|
90
92
|
networkTrackingOptions?: NetworkTrackingOptions;
|
|
93
|
+
/**
|
|
94
|
+
* Whether to enable diagnostics.
|
|
95
|
+
* @defaultValue `true`
|
|
96
|
+
*/
|
|
97
|
+
enableDiagnostics?: boolean;
|
|
91
98
|
}
|
|
92
99
|
interface InternalBrowserConfig {
|
|
93
100
|
cookieStorage: Storage<UserSession>;
|
|
@@ -95,6 +102,9 @@ interface InternalBrowserConfig {
|
|
|
95
102
|
lastEventId?: number;
|
|
96
103
|
transportProvider: Transport;
|
|
97
104
|
version?: string;
|
|
105
|
+
diagnosticsSampleRate?: number;
|
|
106
|
+
diagnosticsClient?: IDiagnosticsClient;
|
|
107
|
+
remoteConfigClient?: IRemoteConfigClient;
|
|
98
108
|
}
|
|
99
109
|
/**
|
|
100
110
|
* @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../../src/types/config/browser-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OA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C;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAGxE,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,aAAa,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-config.js","sourceRoot":"","sources":["../../../../src/types/config/browser-config.ts"],"names":[],"mappings":"","sourcesContent":["import { UserSession } from '../user-session';\nimport { IdentityStorageType, Storage } from '../storage';\nimport { Transport } from '../transport';\nimport { IConfig } from './core-config';\nimport { ElementInteractionsOptions } from '../element-interactions';\nimport { PageTrackingOptions } from '../page-view-tracking';\nimport { NetworkTrackingOptions } from '../network-tracking';\nimport { FrustrationInteractionsOptions } from '../frustration-interactions';\n\nexport interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {}\n\nexport interface ExternalBrowserConfig extends IConfig {\n /**\n * An app version for events tracked. This can be the version of your application.\n * @defaultValue `undefined`\n */\n appVersion?: string;\n /**\n * @deprecated This property is deprecated and will be removed in future versions. Please migrate to using `autocapture` instead.\n * The default event tracking configuration.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events}.\n * @defaultValue `true`\n */\n defaultTracking?: boolean | DefaultTrackingOptions;\n /**\n * The configurations for auto-captured events.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/autocapture/}.\n */\n autocapture?: boolean | AutocaptureOptions;\n /**\n * The identifier for the device running your application.\n * @defaultValue `UUID()`\n */\n deviceId?: string;\n /**\n * Configuration for cookie.\n */\n cookieOptions?: CookieOptions;\n /**\n * The storage for user identify.\n * @defaultValue `\"cookie\"`\n */\n identityStorage?: IdentityStorageType;\n /**\n * The partner identifier.\n * Amplitude requires the customer who built an event ingestion integration to add the partner identifier to partner_id.\n * @defaultValue `undefined`\n */\n partnerId?: string;\n /**\n * The custom Session ID for the current session.\n * @defaultValue `timestamp`\n */\n sessionId?: number;\n /**\n * The period of inactivity from the last tracked event before a session expires in milliseconds.\n * @defaultValue `1,800,000` (30 minutes)\n */\n sessionTimeout: number;\n /**\n * The configurations for tracking additional properties.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#optional-tracking}.\n */\n trackingOptions: TrackingOptions;\n /**\n * Network transport mechanism used to send events.\n * @defaultValue `\"fetch\"`\n */\n transport?: 'fetch' | 'xhr' | 'beacon';\n /**\n * The identifier for the user being tracked.\n * @defaultValue `undefined`\n */\n userId?: string;\n /**\n * User's Nth instance of performing a default Page Viewed event within a session.\n * Used for landing page analysis.\n */\n pageCounter?: number;\n /**\n * Whether to fetch remote configuration. The remote configuration can be updated in the Amplitude platform here:\n * https://app.amplitude.com/data/amplitude/{your_org_name}/settings/autocapture\n * @defaultValue `true`\n */\n fetchRemoteConfig?: boolean;\n /**\n * Captures network requests and responses.\n * @defaultValue `undefined`\n * @deprecated use autocapture.networkTracking instead\n */\n networkTrackingOptions?: NetworkTrackingOptions;\n}\n\ninterface InternalBrowserConfig {\n cookieStorage: Storage<UserSession>;\n lastEventTime?: number;\n lastEventId?: number;\n transportProvider: Transport;\n version?: string;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.\n */\nexport interface DefaultTrackingOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking.\n * @defaultValue `true`\n */\n formInteractions?: boolean;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n}\n\nexport interface AutocaptureOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking.\n * @defaultValue `true`\n */\n formInteractions?: boolean;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n /**\n * Enables/disables user interactions tracking.\n * @defaultValue `false`\n */\n elementInteractions?: boolean | ElementInteractionsOptions;\n /**\n * Enables/disables frustration interactions tracking.\n * @defaultValue `false`\n */\n frustrationInteractions?: boolean | FrustrationInteractionsOptions;\n /**\n * Enables/disables network request tracking or config with detailed network tracking options.\n * @defaultValue `false`\n */\n networkTracking?: boolean | NetworkTrackingOptions;\n /**\n * Enables/disables web vitals tracking.\n * @defaultValue `false`\n * @experimental This feature is experimental and may not be stable\n */\n webVitals?: boolean;\n}\n\nexport interface TrackingOptions {\n /**\n * Enables/disables ip address tracking.\n * @defaultValue `true`\n */\n ipAddress?: boolean;\n /**\n * Enables/disables language tracking.\n * @defaultValue `true`\n */\n language?: boolean;\n /**\n * Enables/disables plantform tracking.\n * @defaultValue `true`\n */\n platform?: boolean;\n}\n\nexport interface AttributionOptions {\n /**\n * The rules to determine which referrers are excluded from being tracked as traffic source.\n * @defaultValue `[/your-domain\\.com$/]`\n */\n excludeReferrers?: (string | RegExp)[];\n /**\n * The value to represent undefined/no initial campaign parameter for first-touch attribution.\n * @defaultValue `\"EMPTY\"`\n */\n initialEmptyValue?: string;\n /**\n * The flag of if Amplitude to start a new session if any campaign parameter changes.\n * @defaultValue `false`\n */\n resetSessionOnNewCampaign?: boolean;\n}\n\nexport interface CookieOptions {\n /**\n * The domain property of cookies created.\n * @defaultValue `Your top level domain`\n */\n domain?: string;\n /**\n * The expiration of cookies created in days.\n * @defaultValue `365`\n */\n expiration?: number;\n /**\n * How cookies are sent with cross-site requests.\n * @defaultValue `\"Lax\"`\n */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /**\n * The flag of if send cookies over secure protocols.\n * @defaultValue `false`\n */\n secure?: boolean;\n /**\n * The flag of if upgrade the cookies created by maintenance Browser SDK.\n * @defaultValue `true`\n */\n upgrade?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {}\n"]}
|
|
1
|
+
{"version":3,"file":"browser-config.js","sourceRoot":"","sources":["../../../../src/types/config/browser-config.ts"],"names":[],"mappings":"","sourcesContent":["import { UserSession } from '../user-session';\nimport { IdentityStorageType, Storage } from '../storage';\nimport { Transport } from '../transport';\nimport { IConfig } from './core-config';\nimport { ElementInteractionsOptions } from '../element-interactions';\nimport { PageTrackingOptions } from '../page-view-tracking';\nimport { NetworkTrackingOptions } from '../network-tracking';\nimport { FrustrationInteractionsOptions } from '../frustration-interactions';\nimport { IDiagnosticsClient } from '../../diagnostics/diagnostics-client';\nimport { IRemoteConfigClient } from '../../remote-config/remote-config';\n\nexport interface BrowserConfig extends ExternalBrowserConfig, InternalBrowserConfig {}\n\nexport interface ExternalBrowserConfig extends IConfig {\n /**\n * An app version for events tracked. This can be the version of your application.\n * @defaultValue `undefined`\n */\n appVersion?: string;\n /**\n * @deprecated This property is deprecated and will be removed in future versions. Please migrate to using `autocapture` instead.\n * The default event tracking configuration.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events}.\n * @defaultValue `true`\n */\n defaultTracking?: boolean | DefaultTrackingOptions;\n /**\n * The configurations for auto-captured events.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/autocapture/}.\n */\n autocapture?: boolean | AutocaptureOptions;\n /**\n * The identifier for the device running your application.\n * @defaultValue `UUID()`\n */\n deviceId?: string;\n /**\n * Configuration for cookie.\n */\n cookieOptions?: CookieOptions;\n /**\n * The storage for user identify.\n * @defaultValue `\"cookie\"`\n */\n identityStorage?: IdentityStorageType;\n /**\n * The partner identifier.\n * Amplitude requires the customer who built an event ingestion integration to add the partner identifier to partner_id.\n * @defaultValue `undefined`\n */\n partnerId?: string;\n /**\n * The custom Session ID for the current session.\n * @defaultValue `timestamp`\n */\n sessionId?: number;\n /**\n * The period of inactivity from the last tracked event before a session expires in milliseconds.\n * @defaultValue `1,800,000` (30 minutes)\n */\n sessionTimeout: number;\n /**\n * The configurations for tracking additional properties.\n * See {@link https://www.docs.developers.amplitude.com/data/sdks/browser-2/#optional-tracking}.\n */\n trackingOptions: TrackingOptions;\n /**\n * Network transport mechanism used to send events.\n * @defaultValue `\"fetch\"`\n */\n transport?: 'fetch' | 'xhr' | 'beacon';\n /**\n * The identifier for the user being tracked.\n * @defaultValue `undefined`\n */\n userId?: string;\n /**\n * User's Nth instance of performing a default Page Viewed event within a session.\n * Used for landing page analysis.\n */\n pageCounter?: number;\n /**\n * Whether to fetch remote configuration. The remote configuration can be updated in the Amplitude platform here:\n * https://app.amplitude.com/data/amplitude/{your_org_name}/settings/autocapture\n * @defaultValue `true`\n */\n fetchRemoteConfig?: boolean;\n /**\n * Captures network requests and responses.\n * @defaultValue `undefined`\n * @deprecated use autocapture.networkTracking instead\n */\n networkTrackingOptions?: NetworkTrackingOptions;\n /**\n * Whether to enable diagnostics.\n * @defaultValue `true`\n */\n enableDiagnostics?: boolean;\n}\n\ninterface InternalBrowserConfig {\n cookieStorage: Storage<UserSession>;\n lastEventTime?: number;\n lastEventId?: number;\n transportProvider: Transport;\n version?: string;\n diagnosticsSampleRate?: number;\n diagnosticsClient?: IDiagnosticsClient;\n remoteConfigClient?: IRemoteConfigClient;\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in future versions. Please migrate to using `AutocaptureOptions` instead.\n */\nexport interface DefaultTrackingOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking.\n * @defaultValue `true`\n */\n formInteractions?: boolean;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n}\n\nexport interface AutocaptureOptions {\n /**\n * Enables/disables marketing attribution tracking or config with detailed attribution options.\n * @defaultValue `true`\n */\n attribution?: boolean | AttributionOptions;\n /**\n * Enables/disables form downloads tracking.\n * @defaultValue `true`\n */\n fileDownloads?: boolean;\n /**\n * Enables/disables form interaction tracking.\n * @defaultValue `true`\n */\n formInteractions?: boolean;\n /**\n * Enables/disables default page view tracking.\n * @defaultValue `true`\n */\n pageViews?: boolean | PageTrackingOptions;\n /**\n * Enables/disables session tracking.\n * @defaultValue `true`\n */\n sessions?: boolean;\n /**\n * Enables/disables user interactions tracking.\n * @defaultValue `false`\n */\n elementInteractions?: boolean | ElementInteractionsOptions;\n /**\n * Enables/disables frustration interactions tracking.\n * @defaultValue `false`\n */\n frustrationInteractions?: boolean | FrustrationInteractionsOptions;\n /**\n * Enables/disables network request tracking or config with detailed network tracking options.\n * @defaultValue `false`\n */\n networkTracking?: boolean | NetworkTrackingOptions;\n /**\n * Enables/disables web vitals tracking.\n * @defaultValue `false`\n * @experimental This feature is experimental and may not be stable\n */\n webVitals?: boolean;\n}\n\nexport interface TrackingOptions {\n /**\n * Enables/disables ip address tracking.\n * @defaultValue `true`\n */\n ipAddress?: boolean;\n /**\n * Enables/disables language tracking.\n * @defaultValue `true`\n */\n language?: boolean;\n /**\n * Enables/disables plantform tracking.\n * @defaultValue `true`\n */\n platform?: boolean;\n}\n\nexport interface AttributionOptions {\n /**\n * The rules to determine which referrers are excluded from being tracked as traffic source.\n * @defaultValue `[/your-domain\\.com$/]`\n */\n excludeReferrers?: (string | RegExp)[];\n /**\n * The value to represent undefined/no initial campaign parameter for first-touch attribution.\n * @defaultValue `\"EMPTY\"`\n */\n initialEmptyValue?: string;\n /**\n * The flag of if Amplitude to start a new session if any campaign parameter changes.\n * @defaultValue `false`\n */\n resetSessionOnNewCampaign?: boolean;\n}\n\nexport interface CookieOptions {\n /**\n * The domain property of cookies created.\n * @defaultValue `Your top level domain`\n */\n domain?: string;\n /**\n * The expiration of cookies created in days.\n * @defaultValue `365`\n */\n expiration?: number;\n /**\n * How cookies are sent with cross-site requests.\n * @defaultValue `\"Lax\"`\n */\n sameSite?: 'Strict' | 'Lax' | 'None';\n /**\n * The flag of if send cookies over secure protocols.\n * @defaultValue `false`\n */\n secure?: boolean;\n /**\n * The flag of if upgrade the cookies created by maintenance Browser SDK.\n * @defaultValue `true`\n */\n upgrade?: boolean;\n}\n\ntype HiddenOptions = 'apiKey' | 'transportProvider' | 'requestMetadata';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BrowserOptions extends Omit<Partial<ExternalBrowserConfig>, HiddenOptions> {}\n"]}
|
|
@@ -47,7 +47,6 @@ export interface NetworkCaptureRule {
|
|
|
47
47
|
* URL patterns to allow for network capture. Supports wildcard.
|
|
48
48
|
*
|
|
49
49
|
* This takes precedence over `hosts`
|
|
50
|
-
* @experimental This feature is experimental and may not be stable
|
|
51
50
|
* @defaultValue `["*"]` all URLs
|
|
52
51
|
*/
|
|
53
52
|
urls?: (string | RegExp)[];
|
|
@@ -67,7 +66,6 @@ export interface NetworkCaptureRule {
|
|
|
67
66
|
* If true, SAFE_HEADERS are captured. If false, no headers are captured.
|
|
68
67
|
* If a string array, the headers in the array are captured.
|
|
69
68
|
*
|
|
70
|
-
* @experimental This feature is experimental and may not be stable
|
|
71
69
|
* @defaultValue `false`
|
|
72
70
|
*/
|
|
73
71
|
responseHeaders?: string[] | boolean;
|
|
@@ -77,18 +75,15 @@ export interface NetworkCaptureRule {
|
|
|
77
75
|
* If true, SAFE_HEADERS are captured. If false, no headers are captured.
|
|
78
76
|
* If a string array, the headers in the array are captured.
|
|
79
77
|
*
|
|
80
|
-
* @experimental This feature is experimental and may not be stable
|
|
81
78
|
* @defaultValue `false`
|
|
82
79
|
*/
|
|
83
80
|
requestHeaders?: string[] | boolean;
|
|
84
81
|
/**
|
|
85
82
|
* Determines what to capture from the response body.
|
|
86
|
-
* @experimental This feature is experimental and may not be stable
|
|
87
83
|
*/
|
|
88
84
|
responseBody?: BodyCaptureRule;
|
|
89
85
|
/**
|
|
90
86
|
* Determines what to capture from the request body.
|
|
91
|
-
* @experimental This feature is experimental and may not be stable
|
|
92
87
|
*/
|
|
93
88
|
requestBody?: BodyCaptureRule;
|
|
94
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-tracking.d.ts","sourceRoot":"","sources":["../../../src/types/network-tracking.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"network-tracking.d.ts","sourceRoot":"","sources":["../../../src/types/network-tracking.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACrC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACpC;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;CAM/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-tracking.js","sourceRoot":"","sources":["../../../src/types/network-tracking.ts"],"names":[],"mappings":"","sourcesContent":["export interface NetworkTrackingOptions {\n /**\n * Suppresses tracking Amplitude requests from network capture.\n * @defaultValue `true`\n */\n ignoreAmplitudeRequests?: boolean;\n /**\n * Hosts to ignore for network capture. Supports wildcard.\n * @defaultValue `[]`\n */\n ignoreHosts?: string[];\n /**\n * Rules to determine which network requests should be captured.\n *\n * Performs matching on array in reverse order.\n */\n captureRules?: NetworkCaptureRule[];\n}\n\nexport interface BodyCaptureRule {\n /**\n * List of JSON pointers to capture from a request or response body (JSON objects only)\n *\n * Includes nothing, by default.\n * Any keys defined in excludelist will be excluded from the capture.\n *\n * Follows a syntax similar to [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901), except:\n * - The leading / is optional\n * - A wildcard * can be used to match any key\n * - A double-wildcard ** can be used to match any number of keys (or no keys)\n * - The structure of the JSON is preserved (ie: the captured body is a subset of the original body)\n */\n allowlist?: string[];\n /**\n * List of JSON pointers to exclude from a request or response body (JSON objects only)\n *\n * This \"uncaptures\" any attributes that are captured by the allowlist.\n */\n blocklist?: string[];\n}\n\nexport interface NetworkCaptureRule {\n /**\n * Hosts to allow for network capture. Supports wildcard.\n * @defaultValue `[\"*\"]` all hosts (except amplitude)\n */\n hosts?: string[];\n /**\n * URL patterns to allow for network capture. Supports wildcard.\n *\n * This takes precedence over `hosts`\n * @
|
|
1
|
+
{"version":3,"file":"network-tracking.js","sourceRoot":"","sources":["../../../src/types/network-tracking.ts"],"names":[],"mappings":"","sourcesContent":["export interface NetworkTrackingOptions {\n /**\n * Suppresses tracking Amplitude requests from network capture.\n * @defaultValue `true`\n */\n ignoreAmplitudeRequests?: boolean;\n /**\n * Hosts to ignore for network capture. Supports wildcard.\n * @defaultValue `[]`\n */\n ignoreHosts?: string[];\n /**\n * Rules to determine which network requests should be captured.\n *\n * Performs matching on array in reverse order.\n */\n captureRules?: NetworkCaptureRule[];\n}\n\nexport interface BodyCaptureRule {\n /**\n * List of JSON pointers to capture from a request or response body (JSON objects only)\n *\n * Includes nothing, by default.\n * Any keys defined in excludelist will be excluded from the capture.\n *\n * Follows a syntax similar to [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901), except:\n * - The leading / is optional\n * - A wildcard * can be used to match any key\n * - A double-wildcard ** can be used to match any number of keys (or no keys)\n * - The structure of the JSON is preserved (ie: the captured body is a subset of the original body)\n */\n allowlist?: string[];\n /**\n * List of JSON pointers to exclude from a request or response body (JSON objects only)\n *\n * This \"uncaptures\" any attributes that are captured by the allowlist.\n */\n blocklist?: string[];\n}\n\nexport interface NetworkCaptureRule {\n /**\n * Hosts to allow for network capture. Supports wildcard.\n * @defaultValue `[\"*\"]` all hosts (except amplitude)\n */\n hosts?: string[];\n /**\n * URL patterns to allow for network capture. Supports wildcard.\n *\n * This takes precedence over `hosts`\n * @defaultValue `[\"*\"]` all URLs\n */\n urls?: (string | RegExp)[];\n /**\n * Methods to allow for network capture.\n * @defaultValue `[\"*\"]` all methods\n */\n methods?: string[];\n /**\n * Range list that defines the status codes to be captured.\n * @defaultValue `500-599`\n */\n statusCodeRange?: string;\n /**\n * Capture headers from network response.\n *\n * If true, SAFE_HEADERS are captured. If false, no headers are captured.\n * If a string array, the headers in the array are captured.\n *\n * @defaultValue `false`\n */\n responseHeaders?: string[] | boolean;\n /**\n * Capture headers from network request.\n *\n * If true, SAFE_HEADERS are captured. If false, no headers are captured.\n * If a string array, the headers in the array are captured.\n *\n * @defaultValue `false`\n */\n requestHeaders?: string[] | boolean;\n /**\n * Determines what to capture from the response body.\n */\n responseBody?: BodyCaptureRule;\n /**\n * Determines what to capture from the request body.\n */\n requestBody?: BodyCaptureRule;\n /**\n * Threshold for what is classified as a slow request (in seconds).\n * @defaultValue `3`\n */\n // slowThreshold?: number;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampling.d.ts","sourceRoot":"","sources":["../../../src/utils/sampling.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,QAAkB,MAAM,WASpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,cAAwB,MAAM,GAAG,MAAM,cAAc,MAAM,YAM1F,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var generateHashCode = function (str) {
|
|
2
|
+
var hash = 0;
|
|
3
|
+
if (str.length === 0)
|
|
4
|
+
return hash;
|
|
5
|
+
for (var i = 0; i < str.length; i++) {
|
|
6
|
+
var chr = str.charCodeAt(i);
|
|
7
|
+
hash = (hash << 5) - hash + chr;
|
|
8
|
+
hash |= 0;
|
|
9
|
+
}
|
|
10
|
+
return hash;
|
|
11
|
+
};
|
|
12
|
+
export var isTimestampInSample = function (timestamp, sampleRate) {
|
|
13
|
+
var hashNumber = generateHashCode(timestamp.toString());
|
|
14
|
+
var absHash = Math.abs(hashNumber);
|
|
15
|
+
var absHashMultiply = absHash * 31;
|
|
16
|
+
var mod = absHashMultiply % 1000000;
|
|
17
|
+
return mod / 1000000 < sampleRate;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=sampling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampling.js","sourceRoot":"","sources":["../../../src/utils/sampling.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAU,GAAW;IACnD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QAChC,IAAI,IAAI,CAAC,CAAC;KACX;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,UAAU,SAA0B,EAAE,UAAkB;IACzF,IAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,IAAM,eAAe,GAAG,OAAO,GAAG,EAAE,CAAC;IACrC,IAAM,GAAG,GAAG,eAAe,GAAG,OAAO,CAAC;IACtC,OAAO,GAAG,GAAG,OAAO,GAAG,UAAU,CAAC;AACpC,CAAC,CAAC","sourcesContent":["export const generateHashCode = function (str: string) {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0;\n }\n return hash;\n};\n\nexport const isTimestampInSample = function (timestamp: string | number, sampleRate: number) {\n const hashNumber = generateHashCode(timestamp.toString());\n const absHash = Math.abs(hashNumber);\n const absHashMultiply = absHash * 31;\n const mod = absHashMultiply % 1000000;\n return mod / 1000000 < sampleRate;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/analytics-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"files": [
|
|
43
43
|
"lib"
|
|
44
44
|
],
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "9ad8b4e5050a8c1e02617661ab41ff301c003da2"
|
|
46
46
|
}
|