Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amplitude/plugin-session-replay-browser

Package Overview
Dependencies
Maintainers
0
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/plugin-session-replay-browser - npm Package Compare versions

Comparing version 1.7.0-srtargeting.0 to 1.7.0-srtargeting.1

14

lib/cjs/session-replay.d.ts

@@ -1,13 +0,11 @@

import { BrowserClient, BrowserConfig, DestinationPlugin, Event, Result } from '@amplitude/analytics-types';
import { BrowserConfig, EnrichmentPlugin, Event } from '@amplitude/analytics-types';
import { SessionReplayOptions } from './typings/session-replay';
export declare class SessionReplayPlugin implements DestinationPlugin {
export declare class SessionReplayPlugin implements EnrichmentPlugin {
name: string;
type: "destination";
clientRemove: BrowserClient['remove'];
type: "enrichment";
config: BrowserConfig;
options: SessionReplayOptions;
constructor(options?: SessionReplayOptions);
setup(config: BrowserConfig, client?: BrowserClient): Promise<void>;
execute(event: Event): Promise<Result>;
flush(): Promise<void>;
setup(config: BrowserConfig): Promise<void>;
execute(event: Event): Promise<Event>;
teardown(): Promise<void>;

@@ -18,3 +16,3 @@ getSessionReplayProperties(): {

}
export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => DestinationPlugin;
export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => EnrichmentPlugin;
//# sourceMappingURL=session-replay.d.ts.map

@@ -9,57 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });

var version_1 = require("./version");
var ENRICHMENT_PLUGIN_NAME = '@amplitude/plugin-session-replay-enrichment-browser';
var SessionReplayEnrichmentPlugin = /** @class */ (function () {
function SessionReplayEnrichmentPlugin() {
this.name = ENRICHMENT_PLUGIN_NAME;
this.type = 'enrichment';
}
SessionReplayEnrichmentPlugin.prototype.setup = function (_config, _client) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
this.config = _config;
return [2 /*return*/];
});
});
};
SessionReplayEnrichmentPlugin.prototype.execute = function (event) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var userProperties, identityStore, userProperties, sessionRecordingProperties;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId())) return [3 /*break*/, 2];
userProperties = void 0;
if (this.config.instanceName) {
identityStore = (0, analytics_client_common_1.getAnalyticsConnector)(this.config.instanceName).identityStore;
userProperties = identityStore.getIdentity().userProperties;
}
return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {
userProperties: userProperties || {},
}).promise];
case 1:
_a.sent();
_a.label = 2;
case 2:
if (!(this.config.sessionId && this.config.sessionId === event.session_id)) return [3 /*break*/, 4];
userProperties = void 0;
if (event.event_type === analytics_types_1.SpecialEventType.IDENTIFY) {
userProperties = (0, helpers_1.parseUserProperties)(event);
}
return [4 /*yield*/, sessionReplay.evaluateTargetingAndCapture({ event: event, userProperties: userProperties })];
case 3:
_a.sent();
sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
event.event_properties = tslib_1.__assign(tslib_1.__assign({}, event.event_properties), sessionRecordingProperties);
_a.label = 4;
case 4: return [2 /*return*/, Promise.resolve(event)];
}
});
});
};
return SessionReplayEnrichmentPlugin;
}());
var SessionReplayPlugin = /** @class */ (function () {
function SessionReplayPlugin(options) {
this.name = '@amplitude/plugin-session-replay-browser';
this.type = 'destination';
this.type = 'enrichment';
this.options = tslib_1.__assign({}, options);

@@ -71,3 +20,3 @@ // The user did not explicitly configure forceSessionTracking to false, default to true.

}
SessionReplayPlugin.prototype.setup = function (config, client) {
SessionReplayPlugin.prototype.setup = function (config) {
var _a, _b, _c, _d;

@@ -79,8 +28,3 @@ return tslib_1.__awaiter(this, void 0, void 0, function () {

case 0:
if (!client) {
config.loggerProvider.error('SessionReplayPlugin requires v1.9.1+ of the Amplitude SDK.');
return [2 /*return*/];
}
config.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(version_1.VERSION, "."));
this.clientRemove = client.remove.bind(client);
this.config = config;

@@ -128,7 +72,2 @@ if (this.options.forceSessionTracking) {

_e.sent();
// add enrichment plugin to add session replay properties to events
return [4 /*yield*/, client.add(new SessionReplayEnrichmentPlugin()).promise];
case 2:
// add enrichment plugin to add session replay properties to events
_e.sent();
return [2 /*return*/];

@@ -141,19 +80,28 @@ }

return tslib_1.__awaiter(this, void 0, void 0, function () {
var identityStore, userProperties, userProperties, sessionRecordingProperties;
return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, Promise.resolve({
event: event,
code: 200,
message: 'success',
})];
});
});
};
SessionReplayPlugin.prototype.flush = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, sessionReplay.flush(false)];
case 0:
if (!(this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId())) return [3 /*break*/, 2];
identityStore = (0, analytics_client_common_1.getAnalyticsConnector)(this.config.instanceName).identityStore;
userProperties = identityStore.getIdentity().userProperties;
return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {
userProperties: userProperties || {},
}).promise];
case 1:
_a.sent();
return [2 /*return*/];
_a.label = 2;
case 2:
if (!(this.config.sessionId && this.config.sessionId === event.session_id)) return [3 /*break*/, 4];
userProperties = void 0;
if (event.event_type === analytics_types_1.SpecialEventType.IDENTIFY) {
userProperties = (0, helpers_1.parseUserProperties)(event);
}
return [4 /*yield*/, sessionReplay.evaluateTargetingAndCapture({ event: event, userProperties: userProperties })];
case 3:
_a.sent();
sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
event.event_properties = tslib_1.__assign(tslib_1.__assign({}, event.event_properties), sessionRecordingProperties);
_a.label = 4;
case 4: return [2 /*return*/, Promise.resolve(event)];
}

@@ -166,17 +114,9 @@ });

return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clientRemove(ENRICHMENT_PLUGIN_NAME).promise];
case 1:
_a.sent();
sessionReplay.shutdown();
// the following are initialized in setup() which will always be called first
// here we reset them to null to prevent memory leaks
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.config = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.clientRemove = null;
return [2 /*return*/];
}
sessionReplay.shutdown();
// the following are initialized in setup() which will always be called first
// here we reset them to null to prevent memory leaks
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.config = null;
return [2 /*return*/];
});

@@ -183,0 +123,0 @@ });

@@ -1,2 +0,2 @@

export declare const VERSION = "1.7.0-srtargeting.0";
export declare const VERSION = "1.7.0-srtargeting.1";
//# sourceMappingURL=version.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
// Autogenerated by `yarn version-file`. DO NOT EDIT
exports.VERSION = '1.7.0-srtargeting.0';
exports.VERSION = '1.7.0-srtargeting.1';
//# sourceMappingURL=version.js.map

@@ -1,13 +0,11 @@

import { BrowserClient, BrowserConfig, DestinationPlugin, Event, Result } from '@amplitude/analytics-types';
import { BrowserConfig, EnrichmentPlugin, Event } from '@amplitude/analytics-types';
import { SessionReplayOptions } from './typings/session-replay';
export declare class SessionReplayPlugin implements DestinationPlugin {
export declare class SessionReplayPlugin implements EnrichmentPlugin {
name: string;
type: "destination";
clientRemove: BrowserClient['remove'];
type: "enrichment";
config: BrowserConfig;
options: SessionReplayOptions;
constructor(options?: SessionReplayOptions);
setup(config: BrowserConfig, client?: BrowserClient): Promise<void>;
execute(event: Event): Promise<Result>;
flush(): Promise<void>;
setup(config: BrowserConfig): Promise<void>;
execute(event: Event): Promise<Event>;
teardown(): Promise<void>;

@@ -18,3 +16,3 @@ getSessionReplayProperties(): {

}
export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => DestinationPlugin;
export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => EnrichmentPlugin;
//# sourceMappingURL=session-replay.d.ts.map
import { __assign, __awaiter, __generator } from "tslib";
import { getAnalyticsConnector } from '@amplitude/analytics-client-common';
import { SpecialEventType, } from '@amplitude/analytics-types';
import { SpecialEventType } from '@amplitude/analytics-types';
import * as sessionReplay from '@amplitude/session-replay-browser';
import { parseUserProperties } from './helpers';
import { VERSION } from './version';
var ENRICHMENT_PLUGIN_NAME = '@amplitude/plugin-session-replay-enrichment-browser';
var SessionReplayEnrichmentPlugin = /** @class */ (function () {
function SessionReplayEnrichmentPlugin() {
this.name = ENRICHMENT_PLUGIN_NAME;
this.type = 'enrichment';
}
SessionReplayEnrichmentPlugin.prototype.setup = function (_config, _client) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.config = _config;
return [2 /*return*/];
});
});
};
SessionReplayEnrichmentPlugin.prototype.execute = function (event) {
return __awaiter(this, void 0, void 0, function () {
var userProperties, identityStore, userProperties, sessionRecordingProperties;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!(this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId())) return [3 /*break*/, 2];
userProperties = void 0;
if (this.config.instanceName) {
identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;
userProperties = identityStore.getIdentity().userProperties;
}
return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {
userProperties: userProperties || {},
}).promise];
case 1:
_a.sent();
_a.label = 2;
case 2:
if (!(this.config.sessionId && this.config.sessionId === event.session_id)) return [3 /*break*/, 4];
userProperties = void 0;
if (event.event_type === SpecialEventType.IDENTIFY) {
userProperties = parseUserProperties(event);
}
return [4 /*yield*/, sessionReplay.evaluateTargetingAndCapture({ event: event, userProperties: userProperties })];
case 3:
_a.sent();
sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
event.event_properties = __assign(__assign({}, event.event_properties), sessionRecordingProperties);
_a.label = 4;
case 4: return [2 /*return*/, Promise.resolve(event)];
}
});
});
};
return SessionReplayEnrichmentPlugin;
}());
var SessionReplayPlugin = /** @class */ (function () {
function SessionReplayPlugin(options) {
this.name = '@amplitude/plugin-session-replay-browser';
this.type = 'destination';
this.type = 'enrichment';
this.options = __assign({}, options);

@@ -68,3 +17,3 @@ // The user did not explicitly configure forceSessionTracking to false, default to true.

}
SessionReplayPlugin.prototype.setup = function (config, client) {
SessionReplayPlugin.prototype.setup = function (config) {
var _a, _b, _c, _d;

@@ -76,8 +25,3 @@ return __awaiter(this, void 0, void 0, function () {

case 0:
if (!client) {
config.loggerProvider.error('SessionReplayPlugin requires v1.9.1+ of the Amplitude SDK.');
return [2 /*return*/];
}
config.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(VERSION, "."));
this.clientRemove = client.remove.bind(client);
this.config = config;

@@ -125,7 +69,2 @@ if (this.options.forceSessionTracking) {

_e.sent();
// add enrichment plugin to add session replay properties to events
return [4 /*yield*/, client.add(new SessionReplayEnrichmentPlugin()).promise];
case 2:
// add enrichment plugin to add session replay properties to events
_e.sent();
return [2 /*return*/];

@@ -138,19 +77,28 @@ }

return __awaiter(this, void 0, void 0, function () {
var identityStore, userProperties, userProperties, sessionRecordingProperties;
return __generator(this, function (_a) {
return [2 /*return*/, Promise.resolve({
event: event,
code: 200,
message: 'success',
})];
});
});
};
SessionReplayPlugin.prototype.flush = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, sessionReplay.flush(false)];
case 0:
if (!(this.config.sessionId && this.config.sessionId !== sessionReplay.getSessionId())) return [3 /*break*/, 2];
identityStore = getAnalyticsConnector(this.config.instanceName).identityStore;
userProperties = identityStore.getIdentity().userProperties;
return [4 /*yield*/, sessionReplay.setSessionId(this.config.sessionId, this.config.deviceId, {
userProperties: userProperties || {},
}).promise];
case 1:
_a.sent();
return [2 /*return*/];
_a.label = 2;
case 2:
if (!(this.config.sessionId && this.config.sessionId === event.session_id)) return [3 /*break*/, 4];
userProperties = void 0;
if (event.event_type === SpecialEventType.IDENTIFY) {
userProperties = parseUserProperties(event);
}
return [4 /*yield*/, sessionReplay.evaluateTargetingAndCapture({ event: event, userProperties: userProperties })];
case 3:
_a.sent();
sessionRecordingProperties = sessionReplay.getSessionReplayProperties();
event.event_properties = __assign(__assign({}, event.event_properties), sessionRecordingProperties);
_a.label = 4;
case 4: return [2 /*return*/, Promise.resolve(event)];
}

@@ -163,17 +111,9 @@ });

return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clientRemove(ENRICHMENT_PLUGIN_NAME).promise];
case 1:
_a.sent();
sessionReplay.shutdown();
// the following are initialized in setup() which will always be called first
// here we reset them to null to prevent memory leaks
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.config = null;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.clientRemove = null;
return [2 /*return*/];
}
sessionReplay.shutdown();
// the following are initialized in setup() which will always be called first
// here we reset them to null to prevent memory leaks
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
this.config = null;
return [2 /*return*/];
});

@@ -180,0 +120,0 @@ });

@@ -1,2 +0,2 @@

export declare const VERSION = "1.7.0-srtargeting.0";
export declare const VERSION = "1.7.0-srtargeting.1";
//# sourceMappingURL=version.d.ts.map
// Autogenerated by `yarn version-file`. DO NOT EDIT
export var VERSION = '1.7.0-srtargeting.0';
export var VERSION = '1.7.0-srtargeting.1';
//# sourceMappingURL=version.js.map

@@ -1,13 +0,11 @@

import { BrowserClient, BrowserConfig, DestinationPlugin, Event, Result } from '@amplitude/analytics-types';
import { BrowserConfig, EnrichmentPlugin, Event } from '@amplitude/analytics-types';
import { SessionReplayOptions } from './typings/session-replay';
export declare class SessionReplayPlugin implements DestinationPlugin {
export declare class SessionReplayPlugin implements EnrichmentPlugin {
name: string;
type: "destination";
clientRemove: BrowserClient['remove'];
type: "enrichment";
config: BrowserConfig;
options: SessionReplayOptions;
constructor(options?: SessionReplayOptions);
setup(config: BrowserConfig, client?: BrowserClient): Promise<void>;
execute(event: Event): Promise<Result>;
flush(): Promise<void>;
setup(config: BrowserConfig): Promise<void>;
execute(event: Event): Promise<Event>;
teardown(): Promise<void>;

@@ -18,3 +16,3 @@ getSessionReplayProperties(): {

}
export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => DestinationPlugin;
export declare const sessionReplayPlugin: (options?: SessionReplayOptions) => EnrichmentPlugin;
//# sourceMappingURL=session-replay.d.ts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "1.7.0-srtargeting.0";
export declare const VERSION = "1.7.0-srtargeting.1";
//# sourceMappingURL=version.d.ts.map
{
"name": "@amplitude/plugin-session-replay-browser",
"version": "1.7.0-srtargeting.0",
"version": "1.7.0-srtargeting.1",
"description": "",

@@ -44,3 +44,3 @@ "author": "Amplitude Inc",

"@amplitude/analytics-types": ">=1 <3",
"@amplitude/session-replay-browser": "^1.14.0-srtargeting.0",
"@amplitude/session-replay-browser": "^1.14.0-srtargeting.1",
"idb-keyval": "^6.2.1",

@@ -65,3 +65,3 @@ "tslib": "^2.4.1"

],
"gitHead": "ffe85701ecb0fea995ac90fa22efb49007a3a1e6"
"gitHead": "7f48cc2272cc0b1e652957d52f78127aa1b5eb00"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc