UNPKG

@datadog/browser-logs

Version:
40 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.startRUMInternalContext = startRUMInternalContext; const browser_core_1 = require("@datadog/browser-core"); function startRUMInternalContext(hooks) { const browserWindow = browser_core_1.globalObject; hooks.register(0 /* HookNames.Assemble */, ({ startTime }) => { const internalContext = getRUMInternalContext(startTime); if (!internalContext) { return browser_core_1.SKIPPED; } return internalContext; }); hooks.register(1 /* HookNames.AssembleTelemetry */, ({ startTime }) => { var _a, _b; const internalContext = getRUMInternalContext(startTime); if (!internalContext) { return browser_core_1.SKIPPED; } return { application: { id: internalContext.application_id }, view: { id: (_a = internalContext.view) === null || _a === void 0 ? void 0 : _a.id }, action: { id: (_b = internalContext.user_action) === null || _b === void 0 ? void 0 : _b.id }, }; }); function getRUMInternalContext(startTime) { const willSyntheticsInjectRumResult = (0, browser_core_1.willSyntheticsInjectRum)(); const rumSource = willSyntheticsInjectRumResult ? browserWindow.DD_RUM_SYNTHETICS : browserWindow.DD_RUM; const rumContext = getInternalContextFromRumGlobal(startTime, rumSource); if (rumContext) { return rumContext; } } function getInternalContextFromRumGlobal(startTime, rumGlobal) { if (rumGlobal && rumGlobal.getInternalContext) { return rumGlobal.getInternalContext(startTime); } } } //# sourceMappingURL=rumInternalContext.js.map