@myinterview/widget-react 1.0.57-ada6b21 → 1.0.57
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/dist/cjs/index.js +251 -123
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +251 -123
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -7656,7 +7656,7 @@ function useMachine(getMachine) {
|
|
|
7656
7656
|
? State.create(options.state)
|
|
7657
7657
|
: service.machine.initialState);
|
|
7658
7658
|
}
|
|
7659
|
-
return service.
|
|
7659
|
+
return service.getSnapshot();
|
|
7660
7660
|
}, [service]);
|
|
7661
7661
|
var isEqual = React.useCallback(function (prevState, nextState) {
|
|
7662
7662
|
if (service.status === InterpreterStatus.NotStarted) {
|
|
@@ -7688,6 +7688,42 @@ function useMachine(getMachine) {
|
|
|
7688
7688
|
return [storeSnapshot, service.send, service];
|
|
7689
7689
|
}
|
|
7690
7690
|
|
|
7691
|
+
(undefined && undefined.__read) || function (o, n) {
|
|
7692
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7693
|
+
if (!m) return o;
|
|
7694
|
+
var i = m.call(o), r, ar = [], e;
|
|
7695
|
+
try {
|
|
7696
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7697
|
+
}
|
|
7698
|
+
catch (error) { e = { error: error }; }
|
|
7699
|
+
finally {
|
|
7700
|
+
try {
|
|
7701
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
7702
|
+
}
|
|
7703
|
+
finally { if (e) throw e.error; }
|
|
7704
|
+
}
|
|
7705
|
+
return ar;
|
|
7706
|
+
};
|
|
7707
|
+
(undefined && undefined.__values) || function(o) {
|
|
7708
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
7709
|
+
if (m) return m.call(o);
|
|
7710
|
+
if (o && typeof o.length === "number") return {
|
|
7711
|
+
next: function () {
|
|
7712
|
+
if (o && i >= o.length) o = void 0;
|
|
7713
|
+
return { value: o && o[i++], done: !o };
|
|
7714
|
+
}
|
|
7715
|
+
};
|
|
7716
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
7717
|
+
};
|
|
7718
|
+
function getServiceSnapshot(service) {
|
|
7719
|
+
return service.status !== 0
|
|
7720
|
+
? service.getSnapshot()
|
|
7721
|
+
: service.machine.initialState;
|
|
7722
|
+
}
|
|
7723
|
+
function isService(actor) {
|
|
7724
|
+
return 'state' in actor && 'machine' in actor;
|
|
7725
|
+
}
|
|
7726
|
+
|
|
7691
7727
|
function isActorWithState(actorRef) {
|
|
7692
7728
|
return 'state' in actorRef;
|
|
7693
7729
|
}
|
|
@@ -7696,7 +7732,9 @@ function isDeferredActor(actorRef) {
|
|
|
7696
7732
|
}
|
|
7697
7733
|
function defaultGetSnapshot(actorRef) {
|
|
7698
7734
|
return 'getSnapshot' in actorRef
|
|
7699
|
-
? actorRef
|
|
7735
|
+
? isService(actorRef)
|
|
7736
|
+
? getServiceSnapshot(actorRef)
|
|
7737
|
+
: actorRef.getSnapshot()
|
|
7700
7738
|
: isActorWithState(actorRef)
|
|
7701
7739
|
? actorRef.state
|
|
7702
7740
|
: undefined;
|
|
@@ -7745,34 +7783,6 @@ function useActor(actorRef, getSnapshot) {
|
|
|
7745
7783
|
return [storeSnapshot, send];
|
|
7746
7784
|
}
|
|
7747
7785
|
|
|
7748
|
-
(undefined && undefined.__read) || function (o, n) {
|
|
7749
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7750
|
-
if (!m) return o;
|
|
7751
|
-
var i = m.call(o), r, ar = [], e;
|
|
7752
|
-
try {
|
|
7753
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7754
|
-
}
|
|
7755
|
-
catch (error) { e = { error: error }; }
|
|
7756
|
-
finally {
|
|
7757
|
-
try {
|
|
7758
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
7759
|
-
}
|
|
7760
|
-
finally { if (e) throw e.error; }
|
|
7761
|
-
}
|
|
7762
|
-
return ar;
|
|
7763
|
-
};
|
|
7764
|
-
(undefined && undefined.__values) || function(o) {
|
|
7765
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
7766
|
-
if (m) return m.call(o);
|
|
7767
|
-
if (o && typeof o.length === "number") return {
|
|
7768
|
-
next: function () {
|
|
7769
|
-
if (o && i >= o.length) o = void 0;
|
|
7770
|
-
return { value: o && o[i++], done: !o };
|
|
7771
|
-
}
|
|
7772
|
-
};
|
|
7773
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
7774
|
-
};
|
|
7775
|
-
|
|
7776
7786
|
var SPEED_TEST_LEVEL;
|
|
7777
7787
|
(function (SPEED_TEST_LEVEL) {
|
|
7778
7788
|
SPEED_TEST_LEVEL[SPEED_TEST_LEVEL["LOW"] = 0] = "LOW";
|
|
@@ -15714,9 +15724,7 @@ function urlEncode(object) {
|
|
|
15714
15724
|
* @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor
|
|
15715
15725
|
* an Error.
|
|
15716
15726
|
*/
|
|
15717
|
-
function convertToPlainObject(
|
|
15718
|
-
value,
|
|
15719
|
-
)
|
|
15727
|
+
function convertToPlainObject(value)
|
|
15720
15728
|
|
|
15721
15729
|
{
|
|
15722
15730
|
if (isError(value)) {
|
|
@@ -15909,6 +15917,14 @@ function createStackParser(...parsers) {
|
|
|
15909
15917
|
const frames = [];
|
|
15910
15918
|
|
|
15911
15919
|
for (const line of stack.split('\n').slice(skipFirst)) {
|
|
15920
|
+
// Ignore lines over 1kb as they are unlikely to be stack frames.
|
|
15921
|
+
// Many of the regular expressions use backtracking which results in run time that increases exponentially with
|
|
15922
|
+
// input size. Huge strings can result in hangs/Denial of Service:
|
|
15923
|
+
// https://github.com/getsentry/sentry-javascript/issues/2286
|
|
15924
|
+
if (line.length > 1024) {
|
|
15925
|
+
continue;
|
|
15926
|
+
}
|
|
15927
|
+
|
|
15912
15928
|
// https://github.com/getsentry/sentry-javascript/issues/5459
|
|
15913
15929
|
// Remove webpack (error: *) wrappers
|
|
15914
15930
|
const cleanedLine = line.replace(/\(error: (.*)\)/, '$1');
|
|
@@ -18743,7 +18759,7 @@ class Hub {
|
|
|
18743
18759
|
*/
|
|
18744
18760
|
captureEvent(event, hint) {
|
|
18745
18761
|
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
|
|
18746
|
-
if (event.type
|
|
18762
|
+
if (!event.type) {
|
|
18747
18763
|
this._lastEventId = eventId;
|
|
18748
18764
|
}
|
|
18749
18765
|
|
|
@@ -18768,7 +18784,6 @@ class Hub {
|
|
|
18768
18784
|
|
|
18769
18785
|
if (!scope || !client) return;
|
|
18770
18786
|
|
|
18771
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
18772
18787
|
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } =
|
|
18773
18788
|
(client.getOptions && client.getOptions()) || {};
|
|
18774
18789
|
|
|
@@ -19262,7 +19277,15 @@ function createEventEnvelope(
|
|
|
19262
19277
|
tunnel,
|
|
19263
19278
|
) {
|
|
19264
19279
|
const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
|
|
19265
|
-
|
|
19280
|
+
|
|
19281
|
+
/*
|
|
19282
|
+
Note: Due to TS, event.type may be `replay_event`, theoretically.
|
|
19283
|
+
In practice, we never call `createEventEnvelope` with `replay_event` type,
|
|
19284
|
+
and we'd have to adjut a looot of types to make this work properly.
|
|
19285
|
+
We want to avoid casting this around, as that could lead to bugs (e.g. when we add another type)
|
|
19286
|
+
So the safe choice is to really guard against the replay_event type here.
|
|
19287
|
+
*/
|
|
19288
|
+
const eventType = event.type && event.type !== 'replay_event' ? event.type : 'event';
|
|
19266
19289
|
|
|
19267
19290
|
enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
|
|
19268
19291
|
|
|
@@ -19290,18 +19313,23 @@ function setupIntegrations(integrations) {
|
|
|
19290
19313
|
const integrationIndex = {};
|
|
19291
19314
|
|
|
19292
19315
|
integrations.forEach(integration => {
|
|
19293
|
-
|
|
19294
|
-
|
|
19295
|
-
if (installedIntegrations.indexOf(integration.name) === -1) {
|
|
19296
|
-
integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
|
|
19297
|
-
installedIntegrations.push(integration.name);
|
|
19298
|
-
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log(`Integration installed: ${integration.name}`);
|
|
19299
|
-
}
|
|
19316
|
+
setupIntegration(integration, integrationIndex);
|
|
19300
19317
|
});
|
|
19301
19318
|
|
|
19302
19319
|
return integrationIndex;
|
|
19303
19320
|
}
|
|
19304
19321
|
|
|
19322
|
+
/** Setup a single integration. */
|
|
19323
|
+
function setupIntegration(integration, integrationIndex) {
|
|
19324
|
+
integrationIndex[integration.name] = integration;
|
|
19325
|
+
|
|
19326
|
+
if (installedIntegrations.indexOf(integration.name) === -1) {
|
|
19327
|
+
integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
|
|
19328
|
+
installedIntegrations.push(integration.name);
|
|
19329
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log(`Integration installed: ${integration.name}`);
|
|
19330
|
+
}
|
|
19331
|
+
}
|
|
19332
|
+
|
|
19305
19333
|
/**
|
|
19306
19334
|
* Adds common information to events.
|
|
19307
19335
|
*
|
|
@@ -19735,6 +19763,13 @@ class BaseClient {
|
|
|
19735
19763
|
}
|
|
19736
19764
|
}
|
|
19737
19765
|
|
|
19766
|
+
/**
|
|
19767
|
+
* @inheritDoc
|
|
19768
|
+
*/
|
|
19769
|
+
addIntegration(integration) {
|
|
19770
|
+
setupIntegration(integration, this._integrations);
|
|
19771
|
+
}
|
|
19772
|
+
|
|
19738
19773
|
/**
|
|
19739
19774
|
* @inheritDoc
|
|
19740
19775
|
*/
|
|
@@ -20126,7 +20161,9 @@ const DEFAULT_TRANSPORT_BUFFER_SIZE = 30;
|
|
|
20126
20161
|
function createTransport(
|
|
20127
20162
|
options,
|
|
20128
20163
|
makeRequest,
|
|
20129
|
-
buffer = makePromiseBuffer(
|
|
20164
|
+
buffer = makePromiseBuffer(
|
|
20165
|
+
options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE,
|
|
20166
|
+
),
|
|
20130
20167
|
) {
|
|
20131
20168
|
let rateLimits = {};
|
|
20132
20169
|
|
|
@@ -20171,10 +20208,11 @@ function createTransport(
|
|
|
20171
20208
|
}
|
|
20172
20209
|
|
|
20173
20210
|
rateLimits = updateRateLimits(rateLimits, response);
|
|
20211
|
+
return response;
|
|
20174
20212
|
},
|
|
20175
20213
|
error => {
|
|
20176
|
-
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error('Failed while sending event:', error);
|
|
20177
20214
|
recordEnvelopeLoss('network_error');
|
|
20215
|
+
throw error;
|
|
20178
20216
|
},
|
|
20179
20217
|
);
|
|
20180
20218
|
|
|
@@ -20206,7 +20244,7 @@ function getEventForEnvelopeItem(item, type) {
|
|
|
20206
20244
|
return Array.isArray(item) ? (item )[1] : undefined;
|
|
20207
20245
|
}
|
|
20208
20246
|
|
|
20209
|
-
const SDK_VERSION = '7.
|
|
20247
|
+
const SDK_VERSION = '7.30.0';
|
|
20210
20248
|
|
|
20211
20249
|
let originalFunctionToString;
|
|
20212
20250
|
|
|
@@ -22158,7 +22196,7 @@ class HttpContext {constructor() { HttpContext.prototype.__init.call(this); }
|
|
|
22158
22196
|
...(referrer && { Referer: referrer }),
|
|
22159
22197
|
...(userAgent && { 'User-Agent': userAgent }),
|
|
22160
22198
|
};
|
|
22161
|
-
const request = { ...(url && { url }), headers };
|
|
22199
|
+
const request = { ...event.request, ...(url && { url }), headers };
|
|
22162
22200
|
|
|
22163
22201
|
return { ...event, request };
|
|
22164
22202
|
}
|
|
@@ -29428,6 +29466,9 @@ var fdt = new u8(32);
|
|
|
29428
29466
|
for (var i = 0; i < 32; ++i)
|
|
29429
29467
|
fdt[i] = 5;
|
|
29430
29468
|
|
|
29469
|
+
/**
|
|
29470
|
+
* Create a breadcrumb for a replay.
|
|
29471
|
+
*/
|
|
29431
29472
|
function createBreadcrumb(
|
|
29432
29473
|
breadcrumb,
|
|
29433
29474
|
) {
|
|
@@ -29438,6 +29479,9 @@ function createBreadcrumb(
|
|
|
29438
29479
|
};
|
|
29439
29480
|
}
|
|
29440
29481
|
|
|
29482
|
+
/**
|
|
29483
|
+
* An event handler to react to DOM events.
|
|
29484
|
+
*/
|
|
29441
29485
|
function handleDom(handlerData) {
|
|
29442
29486
|
// Taken from https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L112
|
|
29443
29487
|
let target;
|
|
@@ -29480,6 +29524,9 @@ function isEventWithTarget(event) {
|
|
|
29480
29524
|
|
|
29481
29525
|
let _LAST_BREADCRUMB = null;
|
|
29482
29526
|
|
|
29527
|
+
/**
|
|
29528
|
+
* An event handler to handle scope changes.
|
|
29529
|
+
*/
|
|
29483
29530
|
function handleScope(scope) {
|
|
29484
29531
|
const newBreadcrumb = scope.getLastBreadcrumb();
|
|
29485
29532
|
|
|
@@ -29502,6 +29549,9 @@ function handleScope(scope) {
|
|
|
29502
29549
|
return createBreadcrumb(newBreadcrumb);
|
|
29503
29550
|
}
|
|
29504
29551
|
|
|
29552
|
+
/**
|
|
29553
|
+
* An event handler to react to breadcrumbs.
|
|
29554
|
+
*/
|
|
29505
29555
|
function breadcrumbHandler(type, handlerData) {
|
|
29506
29556
|
if (type === 'scope') {
|
|
29507
29557
|
return handleScope(handlerData );
|
|
@@ -29638,6 +29688,9 @@ function handleFetchSpanListener(replay) {
|
|
|
29638
29688
|
};
|
|
29639
29689
|
}
|
|
29640
29690
|
|
|
29691
|
+
/**
|
|
29692
|
+
* Returns true if we think the given event is an error originating inside of rrweb.
|
|
29693
|
+
*/
|
|
29641
29694
|
function isRrwebError(event) {
|
|
29642
29695
|
if (event.type || !_optionalChain([event, 'access', _ => _.exception, 'optionalAccess', _2 => _2.values, 'optionalAccess', _3 => _3.length])) {
|
|
29643
29696
|
return false;
|
|
@@ -29659,10 +29712,7 @@ function isRrwebError(event) {
|
|
|
29659
29712
|
function handleGlobalEventListener(replay) {
|
|
29660
29713
|
return (event) => {
|
|
29661
29714
|
// Do not apply replayId to the root event
|
|
29662
|
-
if (
|
|
29663
|
-
// @ts-ignore new event type
|
|
29664
|
-
event.type === REPLAY_EVENT_NAME
|
|
29665
|
-
) {
|
|
29715
|
+
if (event.type === REPLAY_EVENT_NAME) {
|
|
29666
29716
|
// Replays have separate set of breadcrumbs, do not include breadcrumbs
|
|
29667
29717
|
// from core SDK
|
|
29668
29718
|
delete event.breadcrumbs;
|
|
@@ -29678,7 +29728,7 @@ function handleGlobalEventListener(replay) {
|
|
|
29678
29728
|
|
|
29679
29729
|
// Only tag transactions with replayId if not waiting for an error
|
|
29680
29730
|
// @ts-ignore private
|
|
29681
|
-
if (event.type
|
|
29731
|
+
if (!event.type || replay.recordingMode === 'session') {
|
|
29682
29732
|
event.tags = { ...event.tags, replayId: _optionalChain([replay, 'access', _5 => _5.session, 'optionalAccess', _6 => _6.id]) };
|
|
29683
29733
|
}
|
|
29684
29734
|
|
|
@@ -29991,9 +30041,12 @@ const ENTRY_TYPES = {
|
|
|
29991
30041
|
// @ts-ignore TODO: entry type does not fit the create* functions entry type
|
|
29992
30042
|
navigation: createNavigationEntry,
|
|
29993
30043
|
// @ts-ignore TODO: entry type does not fit the create* functions entry type
|
|
29994
|
-
|
|
30044
|
+
'largest-contentful-paint': createLargestContentfulPaint,
|
|
29995
30045
|
};
|
|
29996
30046
|
|
|
30047
|
+
/**
|
|
30048
|
+
* Create replay performance entries from the browser performance entries.
|
|
30049
|
+
*/
|
|
29997
30050
|
function createPerformanceEntries(entries) {
|
|
29998
30051
|
return entries.map(createPerformanceEntry).filter(Boolean) ;
|
|
29999
30052
|
}
|
|
@@ -30012,8 +30065,6 @@ function getAbsoluteTime(time) {
|
|
|
30012
30065
|
return ((browserPerformanceTimeOrigin || WINDOW.performance.timeOrigin) + time) / 1000;
|
|
30013
30066
|
}
|
|
30014
30067
|
|
|
30015
|
-
// TODO: type definition!
|
|
30016
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
30017
30068
|
function createPaintEntry(entry) {
|
|
30018
30069
|
const { duration, entryType, name, startTime } = entry;
|
|
30019
30070
|
|
|
@@ -30026,8 +30077,6 @@ function createPaintEntry(entry) {
|
|
|
30026
30077
|
};
|
|
30027
30078
|
}
|
|
30028
30079
|
|
|
30029
|
-
// TODO: type definition!
|
|
30030
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
30031
30080
|
function createNavigationEntry(entry) {
|
|
30032
30081
|
// TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)
|
|
30033
30082
|
const { entryType, name, duration, domComplete, startTime, transferSize, type } = entry;
|
|
@@ -30049,8 +30098,6 @@ function createNavigationEntry(entry) {
|
|
|
30049
30098
|
};
|
|
30050
30099
|
}
|
|
30051
30100
|
|
|
30052
|
-
// TODO: type definition!
|
|
30053
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
30054
30101
|
function createResourceEntry(entry) {
|
|
30055
30102
|
const { entryType, initiatorType, name, responseEnd, startTime, encodedBodySize, transferSize } = entry;
|
|
30056
30103
|
|
|
@@ -30071,9 +30118,9 @@ function createResourceEntry(entry) {
|
|
|
30071
30118
|
};
|
|
30072
30119
|
}
|
|
30073
30120
|
|
|
30074
|
-
|
|
30075
|
-
|
|
30076
|
-
|
|
30121
|
+
function createLargestContentfulPaint(
|
|
30122
|
+
entry,
|
|
30123
|
+
) {
|
|
30077
30124
|
const { duration, entryType, startTime, size } = entry;
|
|
30078
30125
|
|
|
30079
30126
|
const start = getAbsoluteTime(startTime);
|
|
@@ -30098,6 +30145,9 @@ function t(t){let e=t.length;for(;--e>=0;)t[e]=0}const e=new Uint8Array([0,0,0,0
|
|
|
30098
30145
|
|
|
30099
30146
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
30100
30147
|
|
|
30148
|
+
/**
|
|
30149
|
+
* Create an event buffer for replays.
|
|
30150
|
+
*/
|
|
30101
30151
|
function createEventBuffer({ useCompression }) {
|
|
30102
30152
|
// eslint-disable-next-line no-restricted-globals
|
|
30103
30153
|
if (useCompression && window.Worker) {
|
|
@@ -30128,14 +30178,14 @@ class EventBufferArray {
|
|
|
30128
30178
|
this._events = [];
|
|
30129
30179
|
}
|
|
30130
30180
|
|
|
30131
|
-
destroy() {
|
|
30132
|
-
this._events = [];
|
|
30133
|
-
}
|
|
30134
|
-
|
|
30135
30181
|
get length() {
|
|
30136
30182
|
return this._events.length;
|
|
30137
30183
|
}
|
|
30138
30184
|
|
|
30185
|
+
destroy() {
|
|
30186
|
+
this._events = [];
|
|
30187
|
+
}
|
|
30188
|
+
|
|
30139
30189
|
addEvent(event, isCheckout) {
|
|
30140
30190
|
if (isCheckout) {
|
|
30141
30191
|
this._events = [event];
|
|
@@ -30157,7 +30207,10 @@ class EventBufferArray {
|
|
|
30157
30207
|
}
|
|
30158
30208
|
}
|
|
30159
30209
|
|
|
30160
|
-
|
|
30210
|
+
/**
|
|
30211
|
+
* Event buffer that uses a web worker to compress events.
|
|
30212
|
+
* Exported only for testing.
|
|
30213
|
+
*/
|
|
30161
30214
|
class EventBufferCompressionWorker {
|
|
30162
30215
|
|
|
30163
30216
|
__init() {this._eventBufferItemLength = 0;}
|
|
@@ -30167,12 +30220,6 @@ class EventBufferCompressionWorker {
|
|
|
30167
30220
|
this._worker = worker;
|
|
30168
30221
|
}
|
|
30169
30222
|
|
|
30170
|
-
destroy() {
|
|
30171
|
-
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('[Replay] Destroying compression worker');
|
|
30172
|
-
_optionalChain([this, 'access', _ => _._worker, 'optionalAccess', _2 => _2.terminate, 'call', _3 => _3()]);
|
|
30173
|
-
this._worker = null;
|
|
30174
|
-
}
|
|
30175
|
-
|
|
30176
30223
|
/**
|
|
30177
30224
|
* Note that this may not reflect what is actually in the event buffer. This
|
|
30178
30225
|
* is only a local count of the buffer size since `addEvent` is async.
|
|
@@ -30181,6 +30228,18 @@ class EventBufferCompressionWorker {
|
|
|
30181
30228
|
return this._eventBufferItemLength;
|
|
30182
30229
|
}
|
|
30183
30230
|
|
|
30231
|
+
/**
|
|
30232
|
+
* Destroy the event buffer.
|
|
30233
|
+
*/
|
|
30234
|
+
destroy() {
|
|
30235
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('[Replay] Destroying compression worker');
|
|
30236
|
+
_optionalChain([this, 'access', _ => _._worker, 'optionalAccess', _2 => _2.terminate, 'call', _3 => _3()]);
|
|
30237
|
+
this._worker = null;
|
|
30238
|
+
}
|
|
30239
|
+
|
|
30240
|
+
/**
|
|
30241
|
+
* Add an event to the event buffer.
|
|
30242
|
+
*/
|
|
30184
30243
|
async addEvent(event, isCheckout) {
|
|
30185
30244
|
if (isCheckout) {
|
|
30186
30245
|
// This event is a checkout, make sure worker buffer is cleared before
|
|
@@ -30195,6 +30254,9 @@ class EventBufferCompressionWorker {
|
|
|
30195
30254
|
return this._sendEventToWorker(event);
|
|
30196
30255
|
}
|
|
30197
30256
|
|
|
30257
|
+
/**
|
|
30258
|
+
* Finish the event buffer and return the compressed data.
|
|
30259
|
+
*/
|
|
30198
30260
|
finish() {
|
|
30199
30261
|
return this._finishRequest(this._getAndIncrementId());
|
|
30200
30262
|
}
|
|
@@ -30245,6 +30307,9 @@ class EventBufferCompressionWorker {
|
|
|
30245
30307
|
});
|
|
30246
30308
|
}
|
|
30247
30309
|
|
|
30310
|
+
/**
|
|
30311
|
+
* Send the event to the worker.
|
|
30312
|
+
*/
|
|
30248
30313
|
_sendEventToWorker(event) {
|
|
30249
30314
|
const promise = this._postMessage({
|
|
30250
30315
|
id: this._getAndIncrementId(),
|
|
@@ -30258,6 +30323,9 @@ class EventBufferCompressionWorker {
|
|
|
30258
30323
|
return promise;
|
|
30259
30324
|
}
|
|
30260
30325
|
|
|
30326
|
+
/**
|
|
30327
|
+
* Finish the request and return the compressed data from the worker.
|
|
30328
|
+
*/
|
|
30261
30329
|
async _finishRequest(id) {
|
|
30262
30330
|
const promise = this._postMessage({ id, method: 'finish', args: [] });
|
|
30263
30331
|
|
|
@@ -30267,6 +30335,7 @@ class EventBufferCompressionWorker {
|
|
|
30267
30335
|
return promise ;
|
|
30268
30336
|
}
|
|
30269
30337
|
|
|
30338
|
+
/** Get the current ID and increment it for the next call. */
|
|
30270
30339
|
_getAndIncrementId() {
|
|
30271
30340
|
return this._id++;
|
|
30272
30341
|
}
|
|
@@ -30324,6 +30393,9 @@ function isSessionExpired(session, idleTimeout, targetTime = +new Date()) {
|
|
|
30324
30393
|
);
|
|
30325
30394
|
}
|
|
30326
30395
|
|
|
30396
|
+
/**
|
|
30397
|
+
* Save a session to session storage.
|
|
30398
|
+
*/
|
|
30327
30399
|
function saveSession(session) {
|
|
30328
30400
|
const hasSessionStorage = 'sessionStorage' in WINDOW;
|
|
30329
30401
|
if (!hasSessionStorage) {
|
|
@@ -30478,7 +30550,30 @@ function addMemoryEntry(replay) {
|
|
|
30478
30550
|
}
|
|
30479
30551
|
}
|
|
30480
30552
|
|
|
30481
|
-
function
|
|
30553
|
+
function createMemoryEntry(memoryEntry) {
|
|
30554
|
+
const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry;
|
|
30555
|
+
// we don't want to use `getAbsoluteTime` because it adds the event time to the
|
|
30556
|
+
// time origin, so we get the current timestamp instead
|
|
30557
|
+
const time = new Date().getTime() / 1000;
|
|
30558
|
+
return {
|
|
30559
|
+
type: 'memory',
|
|
30560
|
+
name: 'memory',
|
|
30561
|
+
start: time,
|
|
30562
|
+
end: time,
|
|
30563
|
+
data: {
|
|
30564
|
+
memory: {
|
|
30565
|
+
jsHeapSizeLimit,
|
|
30566
|
+
totalJSHeapSize,
|
|
30567
|
+
usedJSHeapSize,
|
|
30568
|
+
},
|
|
30569
|
+
},
|
|
30570
|
+
};
|
|
30571
|
+
}
|
|
30572
|
+
|
|
30573
|
+
/**
|
|
30574
|
+
* Create the recording data ready to be sent.
|
|
30575
|
+
*/
|
|
30576
|
+
function createRecordingData({
|
|
30482
30577
|
events,
|
|
30483
30578
|
headers,
|
|
30484
30579
|
}
|
|
@@ -30505,6 +30600,10 @@ function createPayload({
|
|
|
30505
30600
|
return payloadWithSequence;
|
|
30506
30601
|
}
|
|
30507
30602
|
|
|
30603
|
+
/**
|
|
30604
|
+
* Create a replay envelope ready to be sent.
|
|
30605
|
+
* This includes both the replay event, as well as the recording data.
|
|
30606
|
+
*/
|
|
30508
30607
|
function createReplayEnvelope(
|
|
30509
30608
|
replayEvent,
|
|
30510
30609
|
recordingData,
|
|
@@ -30589,41 +30688,11 @@ function debounce(func, wait, options) {
|
|
|
30589
30688
|
return debounced;
|
|
30590
30689
|
}
|
|
30591
30690
|
|
|
30592
|
-
async function getReplayEvent({
|
|
30593
|
-
client,
|
|
30594
|
-
scope,
|
|
30595
|
-
replayId: event_id,
|
|
30596
|
-
event,
|
|
30597
|
-
}
|
|
30598
|
-
|
|
30599
|
-
) {
|
|
30600
|
-
const preparedEvent = (await prepareEvent(client.getOptions(), event, { event_id }, scope)) ;
|
|
30601
|
-
|
|
30602
|
-
// If e.g. a global event processor returned null
|
|
30603
|
-
if (!preparedEvent) {
|
|
30604
|
-
return null;
|
|
30605
|
-
}
|
|
30606
|
-
|
|
30607
|
-
// This normally happens in browser client "_prepareEvent"
|
|
30608
|
-
// but since we do not use this private method from the client, but rather the plain import
|
|
30609
|
-
// we need to do this manually.
|
|
30610
|
-
preparedEvent.platform = preparedEvent.platform || 'javascript';
|
|
30611
|
-
|
|
30612
|
-
// extract the SDK name because `client._prepareEvent` doesn't add it to the event
|
|
30613
|
-
const metadata = client.getSdkMetadata && client.getSdkMetadata();
|
|
30614
|
-
const name = (metadata && metadata.sdk && metadata.sdk.name) || 'sentry.javascript.unknown';
|
|
30615
|
-
|
|
30616
|
-
preparedEvent.sdk = {
|
|
30617
|
-
...preparedEvent.sdk,
|
|
30618
|
-
version: "7.29.0",
|
|
30619
|
-
name,
|
|
30620
|
-
};
|
|
30621
|
-
|
|
30622
|
-
return preparedEvent;
|
|
30623
|
-
}
|
|
30624
|
-
|
|
30625
30691
|
let _originalRecordDroppedEvent;
|
|
30626
30692
|
|
|
30693
|
+
/**
|
|
30694
|
+
* Overwrite the `recordDroppedEvent` method on the client, so we can find out which events were dropped.
|
|
30695
|
+
* */
|
|
30627
30696
|
function overwriteRecordDroppedEvent(errorIds) {
|
|
30628
30697
|
const client = getCurrentHub().getClient();
|
|
30629
30698
|
|
|
@@ -30649,6 +30718,9 @@ function overwriteRecordDroppedEvent(errorIds) {
|
|
|
30649
30718
|
_originalRecordDroppedEvent = _originalCallback;
|
|
30650
30719
|
}
|
|
30651
30720
|
|
|
30721
|
+
/**
|
|
30722
|
+
* Restore the original method.
|
|
30723
|
+
* */
|
|
30652
30724
|
function restoreRecordDroppedEvent() {
|
|
30653
30725
|
const client = getCurrentHub().getClient();
|
|
30654
30726
|
|
|
@@ -30659,6 +30731,42 @@ function restoreRecordDroppedEvent() {
|
|
|
30659
30731
|
client.recordDroppedEvent = _originalRecordDroppedEvent;
|
|
30660
30732
|
}
|
|
30661
30733
|
|
|
30734
|
+
/**
|
|
30735
|
+
* Prepare a replay event & enrich it with the SDK metadata.
|
|
30736
|
+
*/
|
|
30737
|
+
async function prepareReplayEvent({
|
|
30738
|
+
client,
|
|
30739
|
+
scope,
|
|
30740
|
+
replayId: event_id,
|
|
30741
|
+
event,
|
|
30742
|
+
}
|
|
30743
|
+
|
|
30744
|
+
) {
|
|
30745
|
+
const preparedEvent = (await prepareEvent(client.getOptions(), event, { event_id }, scope)) ;
|
|
30746
|
+
|
|
30747
|
+
// If e.g. a global event processor returned null
|
|
30748
|
+
if (!preparedEvent) {
|
|
30749
|
+
return null;
|
|
30750
|
+
}
|
|
30751
|
+
|
|
30752
|
+
// This normally happens in browser client "_prepareEvent"
|
|
30753
|
+
// but since we do not use this private method from the client, but rather the plain import
|
|
30754
|
+
// we need to do this manually.
|
|
30755
|
+
preparedEvent.platform = preparedEvent.platform || 'javascript';
|
|
30756
|
+
|
|
30757
|
+
// extract the SDK name because `client._prepareEvent` doesn't add it to the event
|
|
30758
|
+
const metadata = client.getSdkMetadata && client.getSdkMetadata();
|
|
30759
|
+
const name = (metadata && metadata.sdk && metadata.sdk.name) || 'sentry.javascript.unknown';
|
|
30760
|
+
|
|
30761
|
+
preparedEvent.sdk = {
|
|
30762
|
+
...preparedEvent.sdk,
|
|
30763
|
+
version: "7.30.0",
|
|
30764
|
+
name,
|
|
30765
|
+
};
|
|
30766
|
+
|
|
30767
|
+
return preparedEvent;
|
|
30768
|
+
}
|
|
30769
|
+
|
|
30662
30770
|
/* eslint-disable max-lines */ // TODO: We might want to split this file up
|
|
30663
30771
|
|
|
30664
30772
|
/**
|
|
@@ -30668,6 +30776,9 @@ function restoreRecordDroppedEvent() {
|
|
|
30668
30776
|
const BASE_RETRY_INTERVAL = 5000;
|
|
30669
30777
|
const MAX_RETRY_COUNT = 3;
|
|
30670
30778
|
|
|
30779
|
+
/**
|
|
30780
|
+
* The main replay container class, which holds all the state and methods for recording and sending replays.
|
|
30781
|
+
*/
|
|
30671
30782
|
class ReplayContainer {
|
|
30672
30783
|
__init() {this.eventBuffer = null;}
|
|
30673
30784
|
|
|
@@ -31510,7 +31621,7 @@ class ReplayContainer {
|
|
|
31510
31621
|
includeReplayStartTimestamp,
|
|
31511
31622
|
eventContext,
|
|
31512
31623
|
}) {
|
|
31513
|
-
const
|
|
31624
|
+
const recordingData = createRecordingData({
|
|
31514
31625
|
events,
|
|
31515
31626
|
headers: {
|
|
31516
31627
|
segment_id,
|
|
@@ -31527,7 +31638,7 @@ class ReplayContainer {
|
|
|
31527
31638
|
const transport = client && client.getTransport();
|
|
31528
31639
|
const dsn = _optionalChain([client, 'optionalAccess', _33 => _33.getDsn, 'call', _34 => _34()]);
|
|
31529
31640
|
|
|
31530
|
-
if (!client || !scope || !transport || !dsn) {
|
|
31641
|
+
if (!client || !scope || !transport || !dsn || !this.session || !this.session.sampled) {
|
|
31531
31642
|
return;
|
|
31532
31643
|
}
|
|
31533
31644
|
|
|
@@ -31541,9 +31652,10 @@ class ReplayContainer {
|
|
|
31541
31652
|
urls,
|
|
31542
31653
|
replay_id: replayId,
|
|
31543
31654
|
segment_id,
|
|
31655
|
+
replay_type: this.session.sampled,
|
|
31544
31656
|
};
|
|
31545
31657
|
|
|
31546
|
-
const replayEvent = await
|
|
31658
|
+
const replayEvent = await prepareReplayEvent({ scope, client, replayId, event: baseEvent });
|
|
31547
31659
|
|
|
31548
31660
|
if (!replayEvent) {
|
|
31549
31661
|
// Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
|
|
@@ -31556,7 +31668,6 @@ class ReplayContainer {
|
|
|
31556
31668
|
...replayEvent.tags,
|
|
31557
31669
|
sessionSampleRate: this._options.sessionSampleRate,
|
|
31558
31670
|
errorSampleRate: this._options.errorSampleRate,
|
|
31559
|
-
replayType: _optionalChain([this, 'access', _35 => _35.session, 'optionalAccess', _36 => _36.sampled]),
|
|
31560
31671
|
};
|
|
31561
31672
|
|
|
31562
31673
|
/*
|
|
@@ -31575,6 +31686,7 @@ class ReplayContainer {
|
|
|
31575
31686
|
],
|
|
31576
31687
|
"replay_id": "eventId",
|
|
31577
31688
|
"segment_id": 3,
|
|
31689
|
+
"replay_type": "error",
|
|
31578
31690
|
"platform": "javascript",
|
|
31579
31691
|
"event_id": "eventId",
|
|
31580
31692
|
"environment": "production",
|
|
@@ -31590,12 +31702,11 @@ class ReplayContainer {
|
|
|
31590
31702
|
"tags": {
|
|
31591
31703
|
"sessionSampleRate": 1,
|
|
31592
31704
|
"errorSampleRate": 0,
|
|
31593
|
-
"replayType": "error"
|
|
31594
31705
|
}
|
|
31595
31706
|
}
|
|
31596
31707
|
*/
|
|
31597
31708
|
|
|
31598
|
-
const envelope = createReplayEnvelope(replayEvent,
|
|
31709
|
+
const envelope = createReplayEnvelope(replayEvent, recordingData, dsn, client.getOptions().tunnel);
|
|
31599
31710
|
|
|
31600
31711
|
try {
|
|
31601
31712
|
return await transport.send(envelope);
|
|
@@ -31604,6 +31715,9 @@ class ReplayContainer {
|
|
|
31604
31715
|
}
|
|
31605
31716
|
}
|
|
31606
31717
|
|
|
31718
|
+
/**
|
|
31719
|
+
* Reset the counter of retries for sending replays.
|
|
31720
|
+
*/
|
|
31607
31721
|
resetRetries() {
|
|
31608
31722
|
this._retryCount = 0;
|
|
31609
31723
|
this._retryInterval = BASE_RETRY_INTERVAL;
|
|
@@ -31678,15 +31792,26 @@ class ReplayContainer {
|
|
|
31678
31792
|
}
|
|
31679
31793
|
}
|
|
31680
31794
|
|
|
31795
|
+
/**
|
|
31796
|
+
* Returns true if we are in the browser.
|
|
31797
|
+
*/
|
|
31681
31798
|
function isBrowser() {
|
|
31682
31799
|
// eslint-disable-next-line no-restricted-globals
|
|
31683
|
-
return typeof window !== 'undefined' && !isNodeEnv();
|
|
31800
|
+
return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());
|
|
31801
|
+
}
|
|
31802
|
+
|
|
31803
|
+
// Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them
|
|
31804
|
+
function isElectronNodeRenderer() {
|
|
31805
|
+
return typeof process !== 'undefined' && (process ).type === 'renderer';
|
|
31684
31806
|
}
|
|
31685
31807
|
|
|
31686
31808
|
const MEDIA_SELECTORS = 'img,image,svg,path,rect,area,video,object,picture,embed,map,audio';
|
|
31687
31809
|
|
|
31688
31810
|
let _initialized = false;
|
|
31689
31811
|
|
|
31812
|
+
/**
|
|
31813
|
+
* The main replay integration class, to be passed to `init({ integrations: [] })`.
|
|
31814
|
+
*/
|
|
31690
31815
|
class Replay {
|
|
31691
31816
|
/**
|
|
31692
31817
|
* @inheritDoc
|
|
@@ -31702,14 +31827,6 @@ class Replay {
|
|
|
31702
31827
|
* Options to pass to `rrweb.record()`
|
|
31703
31828
|
*/
|
|
31704
31829
|
|
|
31705
|
-
get _isInitialized() {
|
|
31706
|
-
return _initialized;
|
|
31707
|
-
}
|
|
31708
|
-
|
|
31709
|
-
set _isInitialized(value) {
|
|
31710
|
-
_initialized = value;
|
|
31711
|
-
}
|
|
31712
|
-
|
|
31713
31830
|
constructor({
|
|
31714
31831
|
flushMinDelay = DEFAULT_FLUSH_MIN_DELAY,
|
|
31715
31832
|
flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY,
|
|
@@ -31791,13 +31908,23 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
31791
31908
|
: `${this.recordingOptions.blockSelector},${MEDIA_SELECTORS}`;
|
|
31792
31909
|
}
|
|
31793
31910
|
|
|
31794
|
-
if (
|
|
31911
|
+
if (this._isInitialized && isBrowser()) {
|
|
31795
31912
|
throw new Error('Multiple Sentry Session Replay instances are not supported');
|
|
31796
31913
|
}
|
|
31797
31914
|
|
|
31798
31915
|
this._isInitialized = true;
|
|
31799
31916
|
}
|
|
31800
31917
|
|
|
31918
|
+
/** If replay has already been initialized */
|
|
31919
|
+
get _isInitialized() {
|
|
31920
|
+
return _initialized;
|
|
31921
|
+
}
|
|
31922
|
+
|
|
31923
|
+
/** Update _isInitialized */
|
|
31924
|
+
set _isInitialized(value) {
|
|
31925
|
+
_initialized = value;
|
|
31926
|
+
}
|
|
31927
|
+
|
|
31801
31928
|
/**
|
|
31802
31929
|
* We previously used to create a transaction in `setupOnce` and it would
|
|
31803
31930
|
* potentially create a transaction before some native SDK integrations have run
|
|
@@ -31845,6 +31972,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
|
31845
31972
|
this._replay.stop();
|
|
31846
31973
|
}
|
|
31847
31974
|
|
|
31975
|
+
/** Setup the integration. */
|
|
31848
31976
|
_setup() {
|
|
31849
31977
|
// Client is not available in constructor, so we need to wait until setupOnce
|
|
31850
31978
|
this._loadReplayOptionsFromClient();
|