@amplitude/analytics-core 2.62.0-codexsemantic-review-integration.0 → 2.62.0-video-analytics-8.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/config.d.ts +1 -0
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +1 -0
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/heartbeat.d.ts +23 -4
- package/lib/cjs/heartbeat.d.ts.map +1 -1
- package/lib/cjs/heartbeat.js +108 -18
- package/lib/cjs/heartbeat.js.map +1 -1
- package/lib/cjs/index.d.ts +3 -3
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +4 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/observers/video.d.ts +6 -3
- package/lib/cjs/observers/video.d.ts.map +1 -1
- package/lib/cjs/observers/video.js +41 -8
- package/lib/cjs/observers/video.js.map +1 -1
- package/lib/cjs/page-view-id.d.ts +3 -1
- package/lib/cjs/page-view-id.d.ts.map +1 -1
- package/lib/cjs/page-view-id.js +4 -2
- package/lib/cjs/page-view-id.js.map +1 -1
- package/lib/cjs/plugins/destination.d.ts +21 -1
- package/lib/cjs/plugins/destination.d.ts.map +1 -1
- package/lib/cjs/plugins/destination.js +180 -25
- package/lib/cjs/plugins/destination.js.map +1 -1
- package/lib/cjs/types/config/core-config.d.ts +5 -0
- package/lib/cjs/types/config/core-config.d.ts.map +1 -1
- package/lib/cjs/types/config/core-config.js.map +1 -1
- package/lib/cjs/types/event/base-event.d.ts +1 -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/types/event/event.d.ts +4 -1
- package/lib/cjs/types/event/event.d.ts.map +1 -1
- package/lib/cjs/types/event/event.js.map +1 -1
- package/lib/cjs/types/page-view-tracking.d.ts +24 -0
- package/lib/cjs/types/page-view-tracking.d.ts.map +1 -1
- package/lib/cjs/types/page-view-tracking.js.map +1 -1
- package/lib/cjs/types/payload.d.ts +5 -0
- package/lib/cjs/types/payload.d.ts.map +1 -1
- package/lib/cjs/types/payload.js.map +1 -1
- package/lib/cjs/video-analytics/track-video.d.ts +1 -1
- package/lib/cjs/video-analytics/track-video.d.ts.map +1 -1
- package/lib/cjs/video-analytics/track-video.js +107 -19
- package/lib/cjs/video-analytics/track-video.js.map +1 -1
- package/lib/cjs/video-analytics/types.d.ts +6 -5
- package/lib/cjs/video-analytics/types.d.ts.map +1 -1
- package/lib/cjs/video-analytics/types.js.map +1 -1
- package/lib/esm/config.d.ts +1 -0
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +1 -0
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/heartbeat.d.ts +23 -4
- package/lib/esm/heartbeat.d.ts.map +1 -1
- package/lib/esm/heartbeat.js +108 -18
- package/lib/esm/heartbeat.js.map +1 -1
- package/lib/esm/index.d.ts +3 -3
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/observers/video.d.ts +6 -3
- package/lib/esm/observers/video.d.ts.map +1 -1
- package/lib/esm/observers/video.js +41 -8
- package/lib/esm/observers/video.js.map +1 -1
- package/lib/esm/page-view-id.d.ts +3 -1
- package/lib/esm/page-view-id.d.ts.map +1 -1
- package/lib/esm/page-view-id.js +4 -2
- package/lib/esm/page-view-id.js.map +1 -1
- package/lib/esm/plugins/destination.d.ts +21 -1
- package/lib/esm/plugins/destination.d.ts.map +1 -1
- package/lib/esm/plugins/destination.js +181 -26
- package/lib/esm/plugins/destination.js.map +1 -1
- package/lib/esm/types/config/core-config.d.ts +5 -0
- package/lib/esm/types/config/core-config.d.ts.map +1 -1
- package/lib/esm/types/config/core-config.js.map +1 -1
- package/lib/esm/types/event/base-event.d.ts +1 -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/types/event/event.d.ts +4 -1
- package/lib/esm/types/event/event.d.ts.map +1 -1
- package/lib/esm/types/event/event.js.map +1 -1
- package/lib/esm/types/page-view-tracking.d.ts +24 -0
- package/lib/esm/types/page-view-tracking.d.ts.map +1 -1
- package/lib/esm/types/page-view-tracking.js.map +1 -1
- package/lib/esm/types/payload.d.ts +5 -0
- package/lib/esm/types/payload.d.ts.map +1 -1
- package/lib/esm/types/payload.js.map +1 -1
- package/lib/esm/video-analytics/track-video.d.ts +1 -1
- package/lib/esm/video-analytics/track-video.d.ts.map +1 -1
- package/lib/esm/video-analytics/track-video.js +107 -19
- package/lib/esm/video-analytics/track-video.js.map +1 -1
- package/lib/esm/video-analytics/types.d.ts +6 -5
- package/lib/esm/video-analytics/types.d.ts.map +1 -1
- package/lib/esm/video-analytics/types.js.map +1 -1
- package/package.json +1 -1
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,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,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAA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AAwB,EACxB,qBAAqB,EACrB,uCAAuC,GACxC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,+BAA+B,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AAEvH,OAAO,EAAE,aAAa,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EACL,mBAAmB,EACnB,KAAK,MAAM,IAAI,WAAW,EAC1B,cAAc,EACd,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,4BAA4B,EAC5B,SAAS,EACT,oCAAoC,EACpC,8BAA8B,EAC9B,kCAAkC,GACnC,MAAM,wBAAwB,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { AmplitudeCore } from './core-client';
|
|
|
2
2
|
export { Identify } from './identify';
|
|
3
3
|
export { Revenue, RevenueProperty } from './revenue';
|
|
4
4
|
export { Destination } from './plugins/destination';
|
|
5
|
-
export { getHeartbeatInstance } from './heartbeat';
|
|
5
|
+
export { Heartbeat, getHeartbeatInstance } from './heartbeat';
|
|
6
6
|
export { IdentityEventSender } from './plugins/identity';
|
|
7
7
|
export { Config, RequestMetadata } from './config';
|
|
8
8
|
export { Logger } from './logger';
|
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;AAI9C,OAAO,EAAE,QAAQ,EAAgC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,OAAO,EAAY,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAA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mB,EAAqD,MAAM,yBAAyB,CAAC;AAEjH,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AASpE,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;AAgC3B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAG5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,uCAAuC,GACxC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAmC,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AAEvH,OAAO,EAAE,aAAa,EAAiD,MAAM,mBAAmB,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,4BAA4B,EAC5B,SAAS,EACT,oCAAoC,GAGrC,MAAM,wBAAwB,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, 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 { normalizeInstanceName } from './utils/instance-name';\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 {\n PAGE_VIEW_SESSION_STORAGE_KEY,\n getOrCreatePageViewId,\n getCurrentPageViewId,\n clearPageViewState,\n} from './page-view-id';\nexport {\n AMPLITUDE_EVENT_PROP_SDK_INITIALIZATION_OFFSET,\n getSdkInitializationOffset,\n clearSdkInitializationOffset,\n} from './sdk-initialization-offset';\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, HistogramStats } from './diagnostics/diagnostics-client';\nexport {\n IDiagnosticsStorage,\n TagRecord,\n CounterRecord,\n HistogramRecord,\n EventRecord,\n} from './diagnostics/diagnostics-storage';\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 RemoteConfigGroup,\n RemoteConfigInfo,\n RemoteConfigStorage,\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, StorageData, 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 { normalizeNetworkCaptureRules } from './utils/network-tracking-config';\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';\nexport { WebVitalsOptions } from './types/web-vitals';\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 ReactNativeAutocaptureOptions,\n ReactNativeFrustrationInteractionsOptions,\n ReactNativeTrackingOptions,\n ReactNativeOptions,\n ReactNativeAttributionOptions,\n ReactNativeStorageData,\n} from './types/config/react-native-config';\nexport { ReactNativeClient, NavigationState } 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';\nexport { pruneJson } from './utils/json-query';\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 type {\n BackgroundCaptureDeviceMode,\n InitializeBackgroundCaptureData,\n} from './messenger/background-capture-types';\nexport { parseBackgroundCaptureDeviceMode } from './messenger/background-capture-types';\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';\nexport {\n translateRemoteConfigToLocal,\n mergeUrls,\n transformNetworkTrackingRemoteConfig,\n NetworkCaptureRuleRemoteConfig,\n NetworkTrackingOptionsRemoteConfig,\n} from './config/joined-config';\n"]}
|
|
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,EAAgC,M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B,CAAC;AACvE,OAAO,EACL,4BAA4B,EAC5B,SAAS,EACT,oCAAoC,GAGrC,MAAM,wBAAwB,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, ValidPropertyType } from './identify';\nexport { Revenue, IRevenue, RevenueProperty } from './revenue';\nexport { Destination } from './plugins/destination';\nexport { Heartbeat, 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 { normalizeInstanceName } from './utils/instance-name';\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 {\n PAGE_VIEW_SESSION_STORAGE_KEY,\n getOrCreatePageViewId,\n getCurrentPageViewId,\n clearPageViewState,\n} from './page-view-id';\nexport {\n AMPLITUDE_EVENT_PROP_SDK_INITIALIZATION_OFFSET,\n getSdkInitializationOffset,\n clearSdkInitializationOffset,\n} from './sdk-initialization-offset';\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, HistogramStats } from './diagnostics/diagnostics-client';\nexport {\n IDiagnosticsStorage,\n TagRecord,\n CounterRecord,\n HistogramRecord,\n EventRecord,\n} from './diagnostics/diagnostics-storage';\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 RemoteConfigGroup,\n RemoteConfigInfo,\n RemoteConfigStorage,\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, StorageData, 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 {\n EngagedTimeOptions,\n PageTrackingOptions,\n PageTrackingTrackOn,\n PageTrackingHistoryChanges,\n} 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 { normalizeNetworkCaptureRules } from './utils/network-tracking-config';\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';\nexport { WebVitalsOptions } from './types/web-vitals';\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 ReactNativeAutocaptureOptions,\n ReactNativeFrustrationInteractionsOptions,\n ReactNativeTrackingOptions,\n ReactNativeOptions,\n ReactNativeAttributionOptions,\n ReactNativeStorageData,\n} from './types/config/react-native-config';\nexport { ReactNativeClient, NavigationState } 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';\nexport { pruneJson } from './utils/json-query';\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 type {\n BackgroundCaptureDeviceMode,\n InitializeBackgroundCaptureData,\n} from './messenger/background-capture-types';\nexport { parseBackgroundCaptureDeviceMode } from './messenger/background-capture-types';\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 {\n EmbeddedVideoPlayer,\n type Vendor as VideoVendor,\n VideoStopCause,\n VideoStopReason,\n} from './video-analytics/types';\nexport { isChromeExtension, isReactNative } from './utils/environment';\nexport {\n translateRemoteConfigToLocal,\n mergeUrls,\n transformNetworkTrackingRemoteConfig,\n NetworkCaptureRuleRemoteConfig,\n NetworkTrackingOptionsRemoteConfig,\n} from './config/joined-config';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { VideoEvent, EmbeddedVideoPlayer, MuxElement, Vendor } from '../video-analytics/types';
|
|
1
|
+
import type { VideoEvent, EmbeddedVideoPlayer, MuxElement, Vendor, VideoStopCause } from '../video-analytics/types';
|
|
2
2
|
export type { Vendor };
|
|
3
|
-
type PlaybackState = 'playing' | 'paused' | 'ended' | 'error' | 'seeking';
|
|
3
|
+
type PlaybackState = 'playing' | 'paused' | 'ended' | 'error' | 'seeking' | 'waiting';
|
|
4
4
|
export type State = {
|
|
5
5
|
playbackState: PlaybackState;
|
|
6
6
|
errorMessage?: string;
|
|
@@ -8,15 +8,17 @@ export type State = {
|
|
|
8
8
|
watchTime?: number;
|
|
9
9
|
position?: number | null;
|
|
10
10
|
isSeeking?: boolean;
|
|
11
|
+
cause?: VideoStopCause;
|
|
11
12
|
};
|
|
12
13
|
export type VideoObserverParams = {
|
|
13
|
-
videoEl:
|
|
14
|
+
videoEl: HTMLMediaElement | EmbeddedVideoPlayer | MuxElement;
|
|
14
15
|
onStateChange: (previousState: State, nextState: State) => void;
|
|
15
16
|
vendor?: Vendor;
|
|
16
17
|
isEmbedded?: boolean;
|
|
17
18
|
};
|
|
18
19
|
export declare class VideoObserver {
|
|
19
20
|
private state;
|
|
21
|
+
private waitingInterval;
|
|
20
22
|
private untrack;
|
|
21
23
|
private onStateChange;
|
|
22
24
|
private handler;
|
|
@@ -24,6 +26,7 @@ export declare class VideoObserver {
|
|
|
24
26
|
private stateChangeHandler;
|
|
25
27
|
private updateStateWithError;
|
|
26
28
|
private updatePlaybackState;
|
|
29
|
+
private clearWaitingInterval;
|
|
27
30
|
private updateTime;
|
|
28
31
|
private updateState;
|
|
29
32
|
destroy(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/observers/video.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,MAAM,
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/observers/video.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,MAAM,EAEN,cAAc,EACf,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,MAAM,EAAE,CAAC;AAEvB,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtF,MAAM,MAAM,KAAK,GAAG;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,GAAG,UAAU,CAAC;IAC7D,aAAa,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,KAAK,IAAI,CAAC;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAEX;IAEF,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,aAAa,CAAmD;IACxE,OAAO,CAAC,OAAO,CA+Bb;gBAEU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,mBAAmB;IAS/E,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,mBAAmB;IAoC3B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,WAAW;IAMnB,OAAO;CAIR"}
|
|
@@ -7,6 +7,7 @@ var VideoObserver = /** @class */ (function () {
|
|
|
7
7
|
this.state = {
|
|
8
8
|
playbackState: 'paused',
|
|
9
9
|
};
|
|
10
|
+
this.waitingInterval = null;
|
|
10
11
|
this.handler = {
|
|
11
12
|
onPlay: function (evt) {
|
|
12
13
|
_this.updatePlaybackState('playing', evt);
|
|
@@ -14,15 +15,15 @@ var VideoObserver = /** @class */ (function () {
|
|
|
14
15
|
onPause: function (evt) {
|
|
15
16
|
_this.updatePlaybackState('paused', evt);
|
|
16
17
|
},
|
|
17
|
-
onEnded: function (evt) {
|
|
18
|
-
_this.updatePlaybackState('ended', evt);
|
|
18
|
+
onEnded: function (evt, cause) {
|
|
19
|
+
_this.updatePlaybackState('ended', evt, cause);
|
|
19
20
|
},
|
|
20
21
|
onSeeking: function () {
|
|
21
22
|
var nextState = __assign(__assign({}, _this.state), { isSeeking: true });
|
|
22
23
|
_this.updateState(nextState);
|
|
23
24
|
},
|
|
24
25
|
onSeeked: function (event) {
|
|
25
|
-
var nextState = __assign(__assign({}, _this.state), { isSeeking: false, position: event.
|
|
26
|
+
var nextState = __assign(__assign({}, _this.state), { isSeeking: false, position: event.position });
|
|
26
27
|
_this.updateState(nextState);
|
|
27
28
|
},
|
|
28
29
|
onError: function (errorMessage) {
|
|
@@ -49,18 +50,49 @@ var VideoObserver = /** @class */ (function () {
|
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
52
|
VideoObserver.prototype.updateStateWithError = function (error) {
|
|
53
|
+
this.clearWaitingInterval();
|
|
52
54
|
var previousState = this.state;
|
|
53
|
-
var nextState = __assign(__assign({}, previousState), { playbackState: 'error', errorMessage: error });
|
|
55
|
+
var nextState = __assign(__assign({}, previousState), { playbackState: 'error', errorMessage: error, cause: undefined });
|
|
54
56
|
this.updateState(nextState);
|
|
55
57
|
};
|
|
56
|
-
VideoObserver.prototype.updatePlaybackState = function (playbackState, event) {
|
|
57
|
-
var
|
|
58
|
+
VideoObserver.prototype.updatePlaybackState = function (playbackState, event, cause) {
|
|
59
|
+
var _this = this;
|
|
60
|
+
var previousPlayback = this.state.playbackState;
|
|
61
|
+
// Aborting a load does not emit `seeked`. A seek still open when this media
|
|
62
|
+
// ends, or when the replacement starts, must not stick to the next stream.
|
|
63
|
+
var clearSeeking = !!this.state.isSeeking &&
|
|
64
|
+
(playbackState === 'ended' || (playbackState === 'playing' && previousPlayback === 'ended'));
|
|
65
|
+
var nextState = __assign(__assign(__assign({}, this.state), { playbackState: playbackState, errorMessage: undefined, lastEvent: event, position: event.position, cause: cause }), (clearSeeking ? { isSeeking: false } : {}));
|
|
58
66
|
this.updateState(nextState);
|
|
67
|
+
this.clearWaitingInterval();
|
|
68
|
+
if (playbackState !== 'playing') {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// if it's in a playing state, but the playhead is not moving,
|
|
72
|
+
// then transition playback from 'playing' to 'waiting'
|
|
73
|
+
// (the "waiting" listener isn't reliable, so this is a fallback)
|
|
74
|
+
var prevPosition = this.state.position;
|
|
75
|
+
this.waitingInterval = setInterval(function () {
|
|
76
|
+
var position = _this.state.position;
|
|
77
|
+
if (_this.state.playbackState === 'playing' && typeof prevPosition === 'number' && prevPosition === position) {
|
|
78
|
+
// no new player event backs this transition, so carry the current position and metadata over
|
|
79
|
+
_this.updateState(__assign(__assign({}, _this.state), { playbackState: 'waiting' }));
|
|
80
|
+
}
|
|
81
|
+
prevPosition = position;
|
|
82
|
+
}, 1000);
|
|
83
|
+
};
|
|
84
|
+
VideoObserver.prototype.clearWaitingInterval = function () {
|
|
85
|
+
if (this.waitingInterval) {
|
|
86
|
+
clearInterval(this.waitingInterval);
|
|
87
|
+
this.waitingInterval = null;
|
|
88
|
+
}
|
|
59
89
|
};
|
|
60
90
|
VideoObserver.prototype.updateTime = function (event) {
|
|
61
91
|
var _a, _b;
|
|
62
92
|
var lastVideoEvent = this.state.lastEvent;
|
|
63
|
-
|
|
93
|
+
var isWaiting = this.state.playbackState === 'waiting';
|
|
94
|
+
var isPlaying = this.state.playbackState === 'playing';
|
|
95
|
+
if (!lastVideoEvent || (!isPlaying && !isWaiting)) {
|
|
64
96
|
return;
|
|
65
97
|
}
|
|
66
98
|
var isSeeking = event.isSeeking || this.state.isSeeking;
|
|
@@ -71,7 +103,7 @@ var VideoObserver = /** @class */ (function () {
|
|
|
71
103
|
return;
|
|
72
104
|
}
|
|
73
105
|
var timeDelta = nextPosition - lastPosition;
|
|
74
|
-
var nextState = __assign(__assign({}, this.state), { position: nextPosition, watchTime: ((_b = this.state.watchTime) !== null && _b !== void 0 ? _b : 0) + timeDelta });
|
|
106
|
+
var nextState = __assign(__assign({}, this.state), { playbackState: 'playing', position: nextPosition, watchTime: ((_b = this.state.watchTime) !== null && _b !== void 0 ? _b : 0) + timeDelta });
|
|
75
107
|
this.updateState(nextState);
|
|
76
108
|
};
|
|
77
109
|
VideoObserver.prototype.updateState = function (nextState) {
|
|
@@ -80,6 +112,7 @@ var VideoObserver = /** @class */ (function () {
|
|
|
80
112
|
this.stateChangeHandler(previousState, nextState);
|
|
81
113
|
};
|
|
82
114
|
VideoObserver.prototype.destroy = function () {
|
|
115
|
+
this.clearWaitingInterval();
|
|
83
116
|
this.untrack();
|
|
84
117
|
};
|
|
85
118
|
return VideoObserver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/observers/video.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/observers/video.ts"],"names":[],"mappings":";AAAA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,SAAS,IAAI,CAAC,SAAS,CAAC,EAAE;YACjD,OAAO;SACR;QACD,IAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC1D,IAAM,YAAY,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,mCAAI,CAAC,CAAC;QAC9C,IAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC;QACpC,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,KAAK,yBACL,IAAI,CAAC,KAAK,KACb,QAAQ,EAAE,YAAY,GACvB,CAAC;YACF,OAAO;SACR;QACD,IAAM,SAAS,GAAG,YAAY,GAAG,YAAY,CAAC;QAC9C,IAAM,SAAS,yBACV,IAAI,CAAC,KAAK,KACb,aAAa,EAAE,SAAS,EACxB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,SAAS,mCAAI,CAAC,CAAC,GAAG,SAAS,GACnD,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAEO,mCAAW,GAAnB,UAAoB,SAAgB;QAClC,IAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IAED,+BAAO,GAAP;QACE,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IACH,oBAAC;AAAD,CAAC,AAtJD,IAsJC","sourcesContent":["import { trackHtmlVideo, trackEmbeddedVideo } from '../video-analytics/track-video';\nimport type {\n VideoHandler,\n VideoEvent,\n EmbeddedVideoPlayer,\n MuxElement,\n Vendor,\n TimeUpdateEvent,\n VideoStopCause,\n} from '../video-analytics/types';\n\nexport type { Vendor };\n\ntype PlaybackState = 'playing' | 'paused' | 'ended' | 'error' | 'seeking' | 'waiting';\n\nexport type State = {\n playbackState: PlaybackState;\n errorMessage?: string;\n lastEvent?: VideoEvent;\n watchTime?: number;\n position?: number | null;\n isSeeking?: boolean;\n cause?: VideoStopCause; // the reason for the playback state change\n};\n\nexport type VideoObserverParams = {\n videoEl: HTMLMediaElement | EmbeddedVideoPlayer | MuxElement;\n onStateChange: (previousState: State, nextState: State) => void;\n vendor?: Vendor;\n isEmbedded?: boolean;\n};\n\nexport class VideoObserver {\n private state: State = {\n playbackState: 'paused',\n };\n\n private waitingInterval: ReturnType<typeof setTimeout> | null = null;\n private untrack: () => void;\n private onStateChange: (previousState: State, nextState: State) => void;\n private handler: VideoHandler = {\n onPlay: (evt: VideoEvent) => {\n this.updatePlaybackState('playing', evt);\n },\n onPause: (evt: VideoEvent) => {\n this.updatePlaybackState('paused', evt);\n },\n onEnded: (evt: VideoEvent, cause?: VideoStopCause) => {\n this.updatePlaybackState('ended', evt, cause);\n },\n onSeeking: () => {\n const nextState: State = {\n ...this.state,\n isSeeking: true,\n };\n this.updateState(nextState);\n },\n onSeeked: (event: VideoEvent) => {\n const nextState: State = {\n ...this.state,\n isSeeking: false,\n position: event.position,\n };\n this.updateState(nextState);\n },\n onError: (errorMessage: string) => {\n this.updateStateWithError(errorMessage);\n },\n onTimeUpdate: (evt: TimeUpdateEvent) => {\n this.updateTime(evt);\n },\n };\n\n constructor({ videoEl, onStateChange, vendor, isEmbedded }: VideoObserverParams) {\n this.onStateChange = onStateChange;\n if (isEmbedded) {\n this.untrack = trackEmbeddedVideo(videoEl as EmbeddedVideoPlayer, this.handler, vendor);\n } else {\n this.untrack = trackHtmlVideo(videoEl as HTMLMediaElement, this.handler, vendor);\n }\n }\n\n private stateChangeHandler(previousState: State, nextState: State) {\n try {\n this.onStateChange(previousState, nextState);\n } catch (_error) {\n // Swallow callback errors to keep observer state consistent.\n }\n }\n\n private updateStateWithError(error: string) {\n this.clearWaitingInterval();\n const previousState = this.state;\n const nextState: State = {\n ...previousState,\n playbackState: 'error',\n errorMessage: error,\n cause: undefined,\n };\n this.updateState(nextState);\n }\n\n private updatePlaybackState(playbackState: PlaybackState, event: VideoEvent, cause?: VideoStopCause) {\n const previousPlayback = this.state.playbackState;\n // Aborting a load does not emit `seeked`. A seek still open when this media\n // ends, or when the replacement starts, must not stick to the next stream.\n const clearSeeking =\n !!this.state.isSeeking &&\n (playbackState === 'ended' || (playbackState === 'playing' && previousPlayback === 'ended'));\n const nextState: State = {\n ...this.state,\n playbackState,\n errorMessage: undefined,\n lastEvent: event,\n position: event.position,\n cause,\n ...(clearSeeking ? { isSeeking: false } : {}),\n };\n this.updateState(nextState);\n\n this.clearWaitingInterval();\n if (playbackState !== 'playing') {\n return;\n }\n // if it's in a playing state, but the playhead is not moving,\n // then transition playback from 'playing' to 'waiting'\n // (the \"waiting\" listener isn't reliable, so this is a fallback)\n let prevPosition: number | null | undefined = this.state.position;\n this.waitingInterval = setInterval(() => {\n const position = this.state.position;\n if (this.state.playbackState === 'playing' && typeof prevPosition === 'number' && prevPosition === position) {\n // no new player event backs this transition, so carry the current position and metadata over\n this.updateState({ ...this.state, playbackState: 'waiting' });\n }\n prevPosition = position;\n }, 1_000);\n }\n\n private clearWaitingInterval() {\n if (this.waitingInterval) {\n clearInterval(this.waitingInterval);\n this.waitingInterval = null;\n }\n }\n\n private updateTime(event: TimeUpdateEvent) {\n const lastVideoEvent = this.state.lastEvent;\n const isWaiting = this.state.playbackState === 'waiting';\n const isPlaying = this.state.playbackState === 'playing';\n if (!lastVideoEvent || (!isPlaying && !isWaiting)) {\n return;\n }\n const isSeeking = event.isSeeking || this.state.isSeeking;\n const lastPosition = this.state.position ?? 0;\n const nextPosition = event.position;\n if (isSeeking) {\n this.state = {\n ...this.state,\n position: nextPosition,\n };\n return;\n }\n const timeDelta = nextPosition - lastPosition;\n const nextState: State = {\n ...this.state,\n playbackState: 'playing',\n position: nextPosition,\n watchTime: (this.state.watchTime ?? 0) + timeDelta,\n };\n this.updateState(nextState);\n }\n\n private updateState(nextState: State) {\n const previousState = this.state;\n this.state = nextState;\n this.stateChangeHandler(previousState, nextState);\n }\n\n destroy() {\n this.clearWaitingInterval();\n this.untrack();\n }\n}\n"]}
|
|
@@ -8,8 +8,10 @@ export declare const PAGE_VIEW_SESSION_STORAGE_KEY = "AMP_PAGE_VIEW";
|
|
|
8
8
|
* Returns the page view id for this project and document URL.
|
|
9
9
|
* Another SDK initialized with the same API key reuses the id for the current
|
|
10
10
|
* page instead of overwriting the value autocapture later reads.
|
|
11
|
+
* Pass the previous id to renew an engagement view. If another SDK has already
|
|
12
|
+
* renewed it, reuse that new id so the instances stay in sync.
|
|
11
13
|
*/
|
|
12
|
-
export declare const getOrCreatePageViewId: (apiKey: string | undefined, href: string) => string | undefined;
|
|
14
|
+
export declare const getOrCreatePageViewId: (apiKey: string | undefined, href: string, previousPageViewId?: string) => string | undefined;
|
|
13
15
|
/** Reads the current page view id for a project, from memory or session storage. */
|
|
14
16
|
export declare const getCurrentPageViewId: (apiKey?: string) => string | undefined;
|
|
15
17
|
/** Drops in-memory page view ids. Session storage is left unchanged. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-view-id.d.ts","sourceRoot":"","sources":["../../src/page-view-id.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AA8E7D
|
|
1
|
+
{"version":3,"file":"page-view-id.d.ts","sourceRoot":"","sources":["../../src/page-view-id.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AA8E7D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,WACxB,MAAM,GAAG,SAAS,QACpB,MAAM,uBACS,MAAM,KAC1B,MAAM,GAAG,SAiBX,CAAC;AAeF,oFAAoF;AACpF,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,MAAM,GAAG,SAM/D,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,QAAO,IAKrC,CAAC"}
|
package/lib/esm/page-view-id.js
CHANGED
|
@@ -74,8 +74,10 @@ var persistPageViewId = function (scope, apiKey, pageViewId) {
|
|
|
74
74
|
* Returns the page view id for this project and document URL.
|
|
75
75
|
* Another SDK initialized with the same API key reuses the id for the current
|
|
76
76
|
* page instead of overwriting the value autocapture later reads.
|
|
77
|
+
* Pass the previous id to renew an engagement view. If another SDK has already
|
|
78
|
+
* renewed it, reuse that new id so the instances stay in sync.
|
|
77
79
|
*/
|
|
78
|
-
export var getOrCreatePageViewId = function (apiKey, href) {
|
|
80
|
+
export var getOrCreatePageViewId = function (apiKey, href, previousPageViewId) {
|
|
79
81
|
var _a;
|
|
80
82
|
var scope = getScope();
|
|
81
83
|
if (!scope) {
|
|
@@ -84,7 +86,7 @@ export var getOrCreatePageViewId = function (apiKey, href) {
|
|
|
84
86
|
var key = storageKeyFor(apiKey);
|
|
85
87
|
var state = (_a = scope[PAGE_VIEW_STATE]) !== null && _a !== void 0 ? _a : { byApiKey: {} };
|
|
86
88
|
var existing = state.byApiKey[key];
|
|
87
|
-
if (existing && existing.href === href) {
|
|
89
|
+
if (existing && existing.href === href && existing.pageViewId !== previousPageViewId) {
|
|
88
90
|
persistPageViewId(scope, apiKey, existing.pageViewId);
|
|
89
91
|
return existing.pageViewId;
|
|
90
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-view-id.js","sourceRoot":"","sources":["../../src/page-view-id.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,IAAM,6BAA6B,GAAG,eAAe,CAAC;AAE7D,IAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAkBjE,IAAM,aAAa,GAAG,UAAC,MAA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C/B;AACH,CAAC,CAAC","sourcesContent":["import { getGlobalScope } from './global-scope';\nimport { UUID } from './utils/uuid';\n\n/**\n * Session storage key shared by page view tracking and autocapture.\n * `pageViewId` is the legacy single-id field. `byApiKey` keeps one id per project\n * so a second SDK cannot replace another project's id.\n */\nexport const PAGE_VIEW_SESSION_STORAGE_KEY = 'AMP_PAGE_VIEW';\n\nconst PAGE_VIEW_STATE = Symbol.for('@amplitude/page-view-state');\n\ninterface PageViewEntry {\n pageViewId: string;\n href: string;\n}\n\ninterface PageViewState {\n byApiKey: Record<string, PageViewEntry>;\n}\n\ninterface StoredPageViews {\n pageViewId?: unknown;\n byApiKey?: unknown;\n}\n\ntype PageViewScope = NonNullable<ReturnType<typeof getGlobalScope>> & Record<symbol, PageViewState | undefined>;\n\nconst storageKeyFor = (apiKey: string | undefined): string => apiKey || '';\n\nconst getScope = (): PageViewScope | undefined => getGlobalScope() as PageViewScope | undefined;\n\nconst readState = (): PageViewState | undefined => getScope()?.[PAGE_VIEW_STATE];\n\nconst readStored = (scope: PageViewScope | undefined = getScope()): StoredPageViews | undefined => {\n try {\n const raw = scope?.sessionStorage?.getItem(PAGE_VIEW_SESSION_STORAGE_KEY);\n if (!raw) {\n return undefined;\n }\n const parsed: unknown = JSON.parse(raw);\n if (!parsed || typeof parsed !== 'object') {\n return undefined;\n }\n return parsed as StoredPageViews;\n } catch {\n return undefined;\n }\n};\n\nconst copyStoredIds = (byApiKey: unknown): Record<string, string> => {\n const ids: Record<string, string> = {};\n if (!byApiKey || typeof byApiKey !== 'object') {\n return ids;\n }\n for (const [key, value] of Object.entries(byApiKey as Record<string, unknown>)) {\n if (typeof value === 'string') {\n ids[key] = value;\n }\n }\n return ids;\n};\n\nconst persistPageViewId = (scope: PageViewScope, apiKey: string | undefined, pageViewId: string): void => {\n try {\n const storage = scope.sessionStorage;\n if (!storage) {\n return;\n }\n const byApiKey = copyStoredIds(readStored(scope)?.byApiKey);\n const key = storageKeyFor(apiKey);\n if (key) {\n byApiKey[key] = pageViewId;\n }\n storage.setItem(\n PAGE_VIEW_SESSION_STORAGE_KEY,\n JSON.stringify({\n pageViewId,\n ...(Object.keys(byApiKey).length > 0 ? { byApiKey } : {}),\n }),\n );\n } catch {\n // sessionStorage can throw in sandboxed documents\n }\n};\n\n/**\n * Returns the page view id for this project and document URL.\n * Another SDK initialized with the same API key reuses the id for the current\n * page instead of overwriting the value autocapture later reads.\n * Pass the previous id to renew an engagement view. If another SDK has already\n * renewed it, reuse that new id so the instances stay in sync.\n */\nexport const getOrCreatePageViewId = (\n apiKey: string | undefined,\n href: string,\n previousPageViewId?: string,\n): string | undefined => {\n const scope = getScope();\n if (!scope) {\n return undefined;\n }\n const key = storageKeyFor(apiKey);\n const state = scope[PAGE_VIEW_STATE] ?? { byApiKey: {} };\n const existing = state.byApiKey[key];\n if (existing && existing.href === href && existing.pageViewId !== previousPageViewId) {\n persistPageViewId(scope, apiKey, existing.pageViewId);\n return existing.pageViewId;\n }\n const pageViewId = UUID();\n state.byApiKey[key] = { pageViewId, href };\n scope[PAGE_VIEW_STATE] = state;\n persistPageViewId(scope, apiKey, pageViewId);\n return pageViewId;\n};\n\nconst readScopedStoredId = (apiKey: string | undefined): string | undefined => {\n const stored = readStored();\n if (!stored) {\n return undefined;\n }\n const key = storageKeyFor(apiKey);\n if (key && stored.byApiKey && typeof stored.byApiKey === 'object') {\n const scoped = (stored.byApiKey as Record<string, unknown>)[key];\n return typeof scoped === 'string' ? scoped : undefined;\n }\n return typeof stored.pageViewId === 'string' ? stored.pageViewId : undefined;\n};\n\n/** Reads the current page view id for a project, from memory or session storage. */\nexport const getCurrentPageViewId = (apiKey?: string): string | undefined => {\n const inMemory = readState()?.byApiKey[storageKeyFor(apiKey)]?.pageViewId;\n if (inMemory) {\n return inMemory;\n }\n return readScopedStoredId(apiKey);\n};\n\n/** Drops in-memory page view ids. Session storage is left unchanged. */\nexport const clearPageViewState = (): void => {\n const scope = getScope();\n if (scope) {\n delete scope[PAGE_VIEW_STATE];\n }\n};\n"]}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { DestinationPlugin } from '../types/plugin';
|
|
2
2
|
import { Event } from '../types/event/event';
|
|
3
|
+
import { Delay } from '../types/event/base-event';
|
|
3
4
|
import { Result } from '../types/result';
|
|
4
5
|
import { Response, InvalidResponse, PayloadTooLargeResponse, RateLimitResponse, SuccessResponse } from '../types/response';
|
|
5
6
|
import { IConfig } from '../types/config/core-config';
|
|
6
7
|
import { EventCallback } from '../types/event-callback';
|
|
7
8
|
import { IDiagnosticsClient } from '../diagnostics/diagnostics-client';
|
|
9
|
+
import { DelayedPayload, Payload } from '../types/payload';
|
|
8
10
|
export interface Context {
|
|
9
11
|
event: Event;
|
|
10
12
|
attempts: number;
|
|
11
13
|
callback: EventCallback;
|
|
12
14
|
timeout: number;
|
|
15
|
+
delay?: Delay;
|
|
13
16
|
}
|
|
17
|
+
type DelayedEventsById = Record<string, Context[]>;
|
|
14
18
|
export declare function getResponseBodyString(res: Response): string;
|
|
15
19
|
export declare class Destination implements DestinationPlugin {
|
|
16
20
|
name: string;
|
|
@@ -24,17 +28,32 @@ export declare class Destination implements DestinationPlugin {
|
|
|
24
28
|
flushId: ReturnType<typeof setTimeout> | null;
|
|
25
29
|
queue: Context[];
|
|
26
30
|
diagnosticsClient: IDiagnosticsClient | undefined;
|
|
31
|
+
inFlightDelayedEvents: Record<string, boolean>;
|
|
27
32
|
constructor(context?: {
|
|
28
33
|
diagnosticsClient: IDiagnosticsClient;
|
|
29
34
|
});
|
|
30
35
|
setup(config: IConfig): Promise<undefined>;
|
|
31
36
|
execute(event: Event): Promise<Result>;
|
|
37
|
+
/**
|
|
38
|
+
* If a stale delayed event is sitting in the queue, and it is not in flight,
|
|
39
|
+
* remove it and resolve as "stale" with status code 0.
|
|
40
|
+
*
|
|
41
|
+
* If a matching delayed event is already in flight, clone `delay` onto the
|
|
42
|
+
* incoming event and set skipRemoval so the in-flight send does not drop the
|
|
43
|
+
* replacement. Earlier replacements waiting on the same send are discarded
|
|
44
|
+
* as stale so only the latest copy remains.
|
|
45
|
+
* @param incomingEvent { Event } the new event to check old events against
|
|
46
|
+
* @returns void
|
|
47
|
+
*/
|
|
48
|
+
private removeStaleDelayedEvents;
|
|
32
49
|
removeEventsExceedFlushMaxRetries(list: Context[]): Context[];
|
|
33
50
|
scheduleEvents(list: Context[]): void;
|
|
34
51
|
schedule(timeout: number): void;
|
|
35
52
|
resetSchedule(): void;
|
|
36
53
|
flush(useRetry?: boolean): Promise<void>;
|
|
37
|
-
|
|
54
|
+
sendDelayedEvents(delayed: DelayedEventsById, useRetry: boolean): Promise<void>;
|
|
55
|
+
translatePayloadToDelayedPayload(payload: Payload & Partial<DelayedPayload>, list: Context[]): void;
|
|
56
|
+
send(list: Context[], useRetry?: boolean, delay?: boolean): Promise<void>;
|
|
38
57
|
handleResponse(res: Response, list: Context[]): void;
|
|
39
58
|
handleSuccessResponse(res: SuccessResponse, list: Context[]): void;
|
|
40
59
|
handleInvalidResponse(res: InvalidResponse, list: Context[]): void;
|
|
@@ -55,4 +74,5 @@ export declare class Destination implements DestinationPlugin {
|
|
|
55
74
|
*/
|
|
56
75
|
removeEvents(eventsToRemove: Context[]): void;
|
|
57
76
|
}
|
|
77
|
+
export {};
|
|
58
78
|
//# sourceMappingURL=destination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../../src/plugins/destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../../src/plugins/destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAgB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACl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