@pendo/agent 2.330.0 → 2.330.1

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/dom.esm.js CHANGED
@@ -7505,7 +7505,7 @@ function applyMatrix2dRect(matrix2d, rect) {
7505
7505
  return transformedRect;
7506
7506
  }
7507
7507
 
7508
- var VERSION = '2.330.0_';
7508
+ var VERSION = '2.330.1_';
7509
7509
 
7510
7510
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7511
7511
 
@@ -7624,7 +7624,13 @@ function hasCookieDomain() {
7624
7624
  return !!cookieDomain;
7625
7625
  }
7626
7626
  function clearCookie(name) {
7627
- document.cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
7627
+ // Always expire the cookie rather than overwriting it with an empty value.
7628
+ // When a cookieDomain is set the domain attribute must be included or the
7629
+ // domain-scoped cookie can't be matched for deletion -- omitting it (or
7630
+ // writing a blank value) leaves a permanent empty cookie that still costs
7631
+ // request-header space via its name.
7632
+ var cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
7633
+ document.cookie = cookie;
7628
7634
  }
7629
7635
  var getPendoCookieKey = function (name, cookieSuffix) {
7630
7636
  return "_pendo_".concat(name, ".").concat(cookieSuffix || pendo.apiKey);
@@ -4010,8 +4010,8 @@ let SERVER = '';
4010
4010
  let ASSET_HOST = '';
4011
4011
  let ASSET_PATH = '';
4012
4012
  let DESIGNER_SERVER = '';
4013
- let VERSION = '2.330.0_';
4014
- let PACKAGE_VERSION = '2.330.0';
4013
+ let VERSION = '2.330.1_';
4014
+ let PACKAGE_VERSION = '2.330.1';
4015
4015
  let LOADER = 'xhr';
4016
4016
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
4017
4017
  /**
@@ -4587,11 +4587,16 @@ function hasCookieDomain() {
4587
4587
  return !!cookieDomain;
4588
4588
  }
4589
4589
  function clearCookie(name) {
4590
- if (hasCookieDomain()) {
4591
- setCookie(name, '');
4592
- return;
4590
+ // Always expire the cookie rather than overwriting it with an empty value.
4591
+ // When a cookieDomain is set the domain attribute must be included or the
4592
+ // domain-scoped cookie can't be matched for deletion -- omitting it (or
4593
+ // writing a blank value) leaves a permanent empty cookie that still costs
4594
+ // request-header space via its name.
4595
+ var cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
4596
+ if (cookieDomain) {
4597
+ cookie += ';domain=' + cookieDomain;
4593
4598
  }
4594
- document.cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT';
4599
+ document.cookie = cookie;
4595
4600
  }
4596
4601
  var getPendoCookieKey = function (name, cookieSuffix) {
4597
4602
  return `_pendo_${name}.${cookieSuffix || pendo$1.apiKey}`;
@@ -24998,7 +25003,10 @@ var initGuides = function (observer) {
24998
25003
  * @access public
24999
25004
  * @label AD_BLOCK_STORAGE_KEY
25000
25005
  */
25001
- agentStorage.registry.addLocal(AD_BLOCK_STORAGE_KEY, { duration: 14400000 }); // 4 hours default duration
25006
+ agentStorage.registry.addLocal(AD_BLOCK_STORAGE_KEY, {
25007
+ duration: 14400000,
25008
+ localStorageOnly: true
25009
+ });
25002
25010
  GuideRuntime.initialize();
25003
25011
  registerPostrenderScripts(GuideRuntime);
25004
25012
  return () => {
@@ -27269,7 +27277,7 @@ function launchDesignerOrPreview(options) {
27269
27277
  * @access public
27270
27278
  * @label pendoPreview
27271
27279
  */
27272
- agentStorage.registry.addLocal(pendoPreview$1);
27280
+ agentStorage.registry.addLocal(pendoPreview$1, { localStorageOnly: true });
27273
27281
  /**
27274
27282
  * Application state while previewing a guide from the designer. Used while designer preview is active
27275
27283
  * to track step, status, etc., and cleared when designer preview is exited.
@@ -27279,7 +27287,7 @@ function launchDesignerOrPreview(options) {
27279
27287
  * @access public
27280
27288
  * @label designerPreview
27281
27289
  */
27282
- agentStorage.registry.addLocal(designerPreview$1);
27290
+ agentStorage.registry.addLocal(designerPreview$1, { localStorageOnly: true });
27283
27291
  // in order, try to launch:
27284
27292
  // 1) designer
27285
27293
  // 2) preview
@@ -30209,7 +30217,10 @@ function initLogging() {
30209
30217
  * @access public
30210
30218
  * @label LOG_ENABLED
30211
30219
  */
30212
- agentStorage.registry.addLocal(LOG_ENABLED, { isPlain: true });
30220
+ agentStorage.registry.addLocal(LOG_ENABLED, {
30221
+ isPlain: true,
30222
+ localStorageOnly: true
30223
+ });
30213
30224
  /**
30214
30225
  * DEPRECATED: Stores the active contexts for logging.
30215
30226
  *
@@ -30218,7 +30229,10 @@ function initLogging() {
30218
30229
  * @access private
30219
30230
  * @label ACTIVE_CONTEXTS
30220
30231
  */
30221
- agentStorage.registry.addLocal(ACTIVE_CONTEXTS, { isPlain: true });
30232
+ agentStorage.registry.addLocal(ACTIVE_CONTEXTS, {
30233
+ isPlain: true,
30234
+ localStorageOnly: true
30235
+ });
30222
30236
  }
30223
30237
  var createContexts = function (contexts, args) {
30224
30238
  return _.compact([].concat(contexts, args));
@@ -39414,7 +39428,10 @@ var initLauncherPlugin = function (pendo, PluginAPI) {
39414
39428
  * @access public
39415
39429
  * @label LAUNCHER_CLOSED
39416
39430
  */
39417
- PluginAPI.agentStorage.registry.addLocal(LAUNCHER_CLOSED, { duration: 10 * 24 * 60 * 60 * 1000 }); // 10 days default duration
39431
+ PluginAPI.agentStorage.registry.addLocal(LAUNCHER_CLOSED, {
39432
+ duration: 10 * 24 * 60 * 60 * 1000,
39433
+ localStorageOnly: true
39434
+ });
39418
39435
  };
39419
39436
  var teardownLauncherPlugin = function (pendo, PluginAPI) {
39420
39437
  deregisterLoadGuideJobs(loadLauncherContentHandler);
@@ -41017,7 +41034,12 @@ function initAgent(pendo, PendoConfig) {
41017
41034
  * @access public
41018
41035
  * @label debugEnabled
41019
41036
  */
41020
- agentStorage.registry.addLocal(debugEnabled, { isPlain: true, serializer: JSON.stringify, deserializer: SafeJsonDeserializer });
41037
+ agentStorage.registry.addLocal(debugEnabled, {
41038
+ isPlain: true,
41039
+ serializer: JSON.stringify,
41040
+ deserializer: SafeJsonDeserializer,
41041
+ localStorageOnly: true
41042
+ });
41021
41043
  setPendoConfig(PendoConfig);
41022
41044
  overwriteBuiltConfigWithPendoConfig();
41023
41045
  if (!loadAsModule(PendoConfig) && loadAlternateAgent(PendoConfig, pendo, isDebuggingEnabled()))
@@ -43134,7 +43156,7 @@ function Feedback() {
43134
43156
  * @access public
43135
43157
  * @label notificationCountCookie
43136
43158
  */
43137
- PluginAPI.agentStorage.registry.addLocal(notificationCountCookie);
43159
+ PluginAPI.agentStorage.registry.addLocal(notificationCountCookie, { localStorageOnly: true });
43138
43160
  /**
43139
43161
  * Stores the last ping time for the legacy Feedback widget. Used to control the
43140
43162
  * frequency of communication with the Feedback server.
@@ -43144,7 +43166,10 @@ function Feedback() {
43144
43166
  * @access public
43145
43167
  * @label PING_COOKIE
43146
43168
  */
43147
- PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
43169
+ PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, {
43170
+ duration: PING_COOKIE_EXPIRATION,
43171
+ localStorageOnly: true
43172
+ });
43148
43173
  return {
43149
43174
  validate
43150
43175
  };
@@ -49299,32 +49324,31 @@ var n;
49299
49324
  }(n || (n = {}));
49300
49325
  return record; }
49301
49326
 
49302
- var SessionRecorderBuffer = /** @class */ (function () {
49303
- function SessionRecorderBuffer(interval, maxCount) {
49304
- if (maxCount === void 0) { maxCount = Infinity; }
49327
+ class SessionRecorderBuffer {
49328
+ constructor(interval, maxCount = Infinity) {
49305
49329
  this.data = [];
49306
49330
  this.sequenceNumber = 0;
49307
49331
  this.interval = interval;
49308
49332
  this.maxCount = maxCount;
49309
49333
  this.doubledMaxCount = maxCount * 2;
49310
49334
  }
49311
- SessionRecorderBuffer.prototype.isEmpty = function () {
49335
+ isEmpty() {
49312
49336
  return this.data.length === 0;
49313
- };
49314
- SessionRecorderBuffer.prototype.count = function () {
49337
+ }
49338
+ count() {
49315
49339
  return this.data.length;
49316
- };
49317
- SessionRecorderBuffer.prototype.clear = function () {
49340
+ }
49341
+ clear() {
49318
49342
  this.data.length = 0;
49319
- };
49320
- SessionRecorderBuffer.prototype.clearSequence = function () {
49343
+ }
49344
+ clearSequence() {
49321
49345
  this.sequenceNumber = 0;
49322
- };
49323
- SessionRecorderBuffer.prototype.push = function (event) {
49346
+ }
49347
+ push(event) {
49324
49348
  this.data.push(event);
49325
49349
  this.checkRateLimit();
49326
- };
49327
- SessionRecorderBuffer.prototype.pack = function (envelope, _) {
49350
+ }
49351
+ pack(envelope, _) {
49328
49352
  var eventsToSend = this.data.splice(0, this.maxCount);
49329
49353
  envelope.recordingPayload = eventsToSend;
49330
49354
  envelope.sequence = this.sequenceNumber;
@@ -49332,8 +49356,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
49332
49356
  if (eventsToSend.length) {
49333
49357
  envelope.browserTime = eventsToSend[0].timestamp;
49334
49358
  }
49335
- envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
49336
- var metadata = _.pick(event, 'type', 'timestamp');
49359
+ envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
49360
+ const metadata = _.pick(event, 'type', 'timestamp');
49337
49361
  if (event.data) {
49338
49362
  metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
49339
49363
  }
@@ -49341,18 +49365,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
49341
49365
  });
49342
49366
  this.sequenceNumber += eventsToSend.length;
49343
49367
  return envelope;
49344
- };
49345
- SessionRecorderBuffer.prototype.checkRateLimit = function () {
49346
- var length = this.data.length;
49368
+ }
49369
+ checkRateLimit() {
49370
+ const length = this.data.length;
49347
49371
  if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
49348
- var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
49372
+ const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
49349
49373
  if (elapsed <= this.interval && this.onRateLimit) {
49350
49374
  this.onRateLimit();
49351
49375
  }
49352
49376
  }
49353
- };
49354
- return SessionRecorderBuffer;
49355
- }());
49377
+ }
49378
+ }
49356
49379
 
49357
49380
  function __rest(s, e) {
49358
49381
  var t = {};
@@ -49376,52 +49399,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
49376
49399
  });
49377
49400
  }
49378
49401
 
49379
- function __generator(thisArg, body) {
49380
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
49381
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
49382
- function verb(n) { return function (v) { return step([n, v]); }; }
49383
- function step(op) {
49384
- if (f) throw new TypeError("Generator is already executing.");
49385
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
49386
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
49387
- if (y = 0, t) op = [op[0] & 2, t.value];
49388
- switch (op[0]) {
49389
- case 0: case 1: t = op; break;
49390
- case 4: _.label++; return { value: op[1], done: false };
49391
- case 5: _.label++; y = op[1]; op = [0]; continue;
49392
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
49393
- default:
49394
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
49395
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
49396
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
49397
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
49398
- if (t[2]) _.ops.pop();
49399
- _.trys.pop(); continue;
49400
- }
49401
- op = body.call(thisArg, _);
49402
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49403
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49404
- }
49405
- }
49406
-
49407
49402
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
49408
49403
  var e = new Error(message);
49409
49404
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
49410
49405
  };
49411
49406
 
49412
- var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
49413
- var MAX_SIZE = 2000000;
49414
- var RESOURCE_CACHING$1 = 'resourceCaching';
49415
- var Transport = /** @class */ (function () {
49416
- function Transport(WorkerClass, pendo, api) {
49407
+ const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
49408
+ const MAX_SIZE = 2000000;
49409
+ const RESOURCE_CACHING$1 = 'resourceCaching';
49410
+ class Transport {
49411
+ constructor(WorkerClass, pendo, api) {
49417
49412
  this.WorkerClass = WorkerClass;
49418
49413
  this.pendo = pendo;
49419
49414
  this.api = api;
49420
49415
  this.maxSize = MAX_SIZE;
49421
- this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
49416
+ this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
49422
49417
  this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
49423
49418
  }
49424
- Transport.prototype.start = function (config) {
49419
+ start(config) {
49425
49420
  if (config.disableWorker)
49426
49421
  return;
49427
49422
  if (!this.worker) {
@@ -49431,7 +49426,7 @@ var Transport = /** @class */ (function () {
49431
49426
  this.worker = config.workerOverride;
49432
49427
  }
49433
49428
  else {
49434
- var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
49429
+ const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
49435
49430
  this.usesSelfHostedWorker = workerUrl != null;
49436
49431
  this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
49437
49432
  }
@@ -49445,35 +49440,34 @@ var Transport = /** @class */ (function () {
49445
49440
  this.worker = null;
49446
49441
  }
49447
49442
  }
49448
- };
49449
- Transport.prototype.stop = function () {
49443
+ }
49444
+ stop() {
49450
49445
  if (this.worker) {
49451
49446
  this.worker.terminate();
49452
49447
  delete this.worker;
49453
49448
  }
49454
- };
49455
- Transport.prototype.send = function (envelope, isUnload, failureCount) {
49456
- if (failureCount === void 0) { failureCount = 0; }
49457
- var url = envelope.url;
49458
- var payload = envelope.payload;
49449
+ }
49450
+ send(envelope, isUnload, failureCount = 0) {
49451
+ let { url } = envelope;
49452
+ const { payload } = envelope;
49459
49453
  if (failureCount > 0) {
49460
- url = "".concat(url, "&rt=").concat(failureCount);
49454
+ url = `${url}&rt=${failureCount}`;
49461
49455
  }
49462
49456
  if (this.worker && !isUnload && payload) {
49463
- var deferred_1 = {};
49464
- deferred_1.promise = new Promise$2(function (resolve, reject) {
49465
- deferred_1.resolve = resolve;
49466
- deferred_1.reject = reject;
49457
+ const deferred = {};
49458
+ deferred.promise = new Promise$2((resolve, reject) => {
49459
+ deferred.resolve = resolve;
49460
+ deferred.reject = reject;
49467
49461
  });
49468
- this.workerResponse = deferred_1;
49469
- this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
49470
- return deferred_1.promise;
49462
+ this.workerResponse = deferred;
49463
+ this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
49464
+ return deferred.promise;
49471
49465
  }
49472
49466
  else {
49473
49467
  if (!envelope.body) {
49474
- var strPayload = JSON.stringify(payload);
49468
+ const strPayload = JSON.stringify(payload);
49475
49469
  if (strPayload.length > this.maxSize) {
49476
- var error = new Error('maximum recording payload size exceeded');
49470
+ const error = new Error('maximum recording payload size exceeded');
49477
49471
  error.reason = 'HEAVY_EVENT';
49478
49472
  error.context = {
49479
49473
  size: strPayload.length,
@@ -49484,14 +49478,14 @@ var Transport = /** @class */ (function () {
49484
49478
  envelope.body = this.pendo.compress(strPayload, 'binary');
49485
49479
  delete envelope.payload;
49486
49480
  }
49487
- url = "".concat(url, "&ct=").concat(new Date().getTime());
49481
+ url = `${url}&ct=${new Date().getTime()}`;
49488
49482
  return this.post(url, {
49489
49483
  keepalive: isUnload,
49490
49484
  body: envelope.body
49491
49485
  });
49492
49486
  }
49493
- };
49494
- Transport.prototype.post = function (url, options) {
49487
+ }
49488
+ post(url, options) {
49495
49489
  options.method = 'POST';
49496
49490
  if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
49497
49491
  return this.api.transmit.fetchKeepalive(url, options);
@@ -49503,57 +49497,46 @@ var Transport = /** @class */ (function () {
49503
49497
  else {
49504
49498
  return this.pendo.ajax.post(url, options.body);
49505
49499
  }
49506
- };
49507
- Transport.prototype._onMessage = function (messageEvent) {
49508
- return __awaiter(this, void 0, void 0, function () {
49509
- return __generator(this, function (_a) {
49510
- switch (_a.label) {
49511
- case 0:
49512
- if (!(messageEvent.data && messageEvent.data.ready && navigator.locks)) return [3 /*break*/, 2];
49513
- // When the lock is released, we can assume the worker was terminated or closed
49514
- return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
49515
- case 1:
49516
- // When the lock is released, we can assume the worker was terminated or closed
49517
- _a.sent();
49518
- this.onWorkerMessage({ type: 'workerDied' });
49519
- _a.label = 2;
49520
- case 2:
49521
- // handle non-POST request responses from worker
49522
- if (messageEvent.data && messageEvent.data.type) {
49523
- this.onWorkerMessage(messageEvent.data);
49524
- return [2 /*return*/];
49525
- }
49526
- // handle POST request response from worker
49527
- if (messageEvent.data && messageEvent.data.error) {
49528
- if ((messageEvent.data.status && messageEvent.data.status < 500) ||
49529
- messageEvent.data.sequence == null) {
49530
- this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
49531
- }
49532
- if (this.workerResponse) {
49533
- this.workerResponse.reject();
49534
- this.workerResponse = null;
49535
- }
49536
- }
49537
- if (this.workerResponse) {
49538
- this.workerResponse.resolve();
49539
- this.workerResponse = null;
49540
- }
49541
- return [2 /*return*/];
49500
+ }
49501
+ _onMessage(messageEvent) {
49502
+ return __awaiter(this, void 0, void 0, function* () {
49503
+ if (messageEvent.data && messageEvent.data.ready && navigator.locks) {
49504
+ // When the lock is released, we can assume the worker was terminated or closed
49505
+ yield navigator.locks.request(this.lockID, () => { });
49506
+ this.onWorkerMessage({ type: 'workerDied' });
49507
+ }
49508
+ // handle non-POST request responses from worker
49509
+ if (messageEvent.data && messageEvent.data.type) {
49510
+ this.onWorkerMessage(messageEvent.data);
49511
+ return;
49512
+ }
49513
+ // handle POST request response from worker
49514
+ if (messageEvent.data && messageEvent.data.error) {
49515
+ if ((messageEvent.data.status && messageEvent.data.status < 500) ||
49516
+ messageEvent.data.sequence == null) {
49517
+ this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
49542
49518
  }
49543
- });
49519
+ if (this.workerResponse) {
49520
+ this.workerResponse.reject();
49521
+ this.workerResponse = null;
49522
+ }
49523
+ }
49524
+ if (this.workerResponse) {
49525
+ this.workerResponse.resolve();
49526
+ this.workerResponse = null;
49527
+ }
49544
49528
  });
49545
- };
49546
- Transport.prototype._onError = function () {
49529
+ }
49530
+ _onError() {
49547
49531
  if (this.onError) {
49548
49532
  this.onError();
49549
49533
  }
49550
- };
49551
- return Transport;
49552
- }());
49534
+ }
49535
+ }
49553
49536
 
49554
- var ELEMENT_NODE = 1;
49555
- var INPUT_MASK = '*'.repeat(10);
49556
- var NUMBER_INPUT_MASK = '0'.repeat(10);
49537
+ const ELEMENT_NODE = 1;
49538
+ const INPUT_MASK = '*'.repeat(10);
49539
+ const NUMBER_INPUT_MASK = '0'.repeat(10);
49557
49540
  function isElementNode(node) {
49558
49541
  if (!node)
49559
49542
  return false;
@@ -49562,12 +49545,10 @@ function isElementNode(node) {
49562
49545
  return true;
49563
49546
  }
49564
49547
  function getParent(elem) {
49565
- var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
49548
+ const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
49566
49549
  return isElementShadowRoot ? elem.host : elem.parentNode;
49567
49550
  }
49568
- function distanceToMatch(node, selector, limit, distance) {
49569
- if (limit === void 0) { limit = Infinity; }
49570
- if (distance === void 0) { distance = 0; }
49551
+ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
49571
49552
  if (distance > limit)
49572
49553
  return -1;
49573
49554
  if (!node)
@@ -49581,15 +49562,15 @@ function distanceToMatch(node, selector, limit, distance) {
49581
49562
  return distanceToMatch(getParent(node), selector, limit, distance + 1);
49582
49563
  }
49583
49564
  function shouldMask(node, options) {
49584
- var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
49565
+ const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
49585
49566
  try {
49586
- var el = isElementNode(node) ? node : node.parentElement;
49567
+ const el = isElementNode(node) ? node : node.parentElement;
49587
49568
  if (el === null)
49588
49569
  return false;
49589
49570
  if ((el.tagName || '').toUpperCase() === 'STYLE')
49590
49571
  return false;
49591
- var maskDistance = -1;
49592
- var unmaskDistance = -1;
49572
+ let maskDistance = -1;
49573
+ let unmaskDistance = -1;
49593
49574
  if (maskAllText) {
49594
49575
  unmaskDistance = distanceToMatch(el, unmaskTextSelector);
49595
49576
  if (unmaskDistance < 0) {
@@ -49622,8 +49603,8 @@ function isNumberInput(element) {
49622
49603
  }
49623
49604
  function shouldMaskInput(element, maskInputOptions) {
49624
49605
  if (maskInputOptions && isElementNode(element)) {
49625
- var tagName = (element.tagName || '').toLowerCase();
49626
- var type = (element.type || '').toLowerCase();
49606
+ const tagName = (element.tagName || '').toLowerCase();
49607
+ const type = (element.type || '').toLowerCase();
49627
49608
  if (maskInputOptions[tagName] || maskInputOptions[type]) {
49628
49609
  return true;
49629
49610
  }
@@ -51117,12 +51098,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
51117
51098
  }
51118
51099
  }
51119
51100
 
51120
- var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
51101
+ const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
51121
51102
  function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
51122
- var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
51123
- var matches = stringifiedRecordingPayload.match(fontURLRegex);
51103
+ const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
51104
+ const matches = stringifiedRecordingPayload.match(fontURLRegex);
51124
51105
  // de-duplicate matches
51125
- var hostedResources = matches ? Array.from(new Set(matches)) : [];
51106
+ const hostedResources = matches ? Array.from(new Set(matches)) : [];
51126
51107
  return {
51127
51108
  type: 'recording',
51128
51109
  visitorId: recordingEvent.visitorId,
@@ -51137,7 +51118,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
51137
51118
  recordingPayloadMetadata: [],
51138
51119
  sequence: 0,
51139
51120
  recordingPayloadCount: 0,
51140
- hostedResources: hostedResources
51121
+ hostedResources
51141
51122
  };
51142
51123
  }
51143
51124
  // keep in mind changes here may need addressing in the extension worker proxy as well
@@ -51145,69 +51126,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
51145
51126
  try {
51146
51127
  if (e.data.type === 'init' && e.data.lockID) {
51147
51128
  if (navigator.locks) {
51148
- navigator.locks.request(e.data.lockID, function () {
51129
+ navigator.locks.request(e.data.lockID, () => {
51149
51130
  postMessage({ ready: true });
51150
51131
  // This unresolved promise keeps the lock held with the worker until the worker is
51151
51132
  // terminated at which point the lock is released.
51152
- return new Promise$2(function () { });
51133
+ return new Promise$2(() => { });
51153
51134
  });
51154
51135
  }
51155
51136
  return;
51156
51137
  }
51157
51138
  if (e.data.url && e.data.payload) {
51158
- var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
51139
+ let { url, payload, shouldCacheResources } = e.data;
51159
51140
  if (Object.keys(payload).length === 0) {
51160
51141
  postMessage({
51161
51142
  type: 'emptyPayload'
51162
51143
  });
51163
51144
  }
51164
- var sequence_1 = payload.sequence;
51165
- var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
51145
+ const { sequence } = payload;
51146
+ const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
51166
51147
  // calculate and post back the recording payload size before the payload is compressed
51167
- var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
51168
- var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
51148
+ const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
51149
+ const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
51169
51150
  postMessage({
51170
51151
  type: 'recordingPayloadSize',
51171
- recordingPayloadSize: recordingPayloadSize,
51172
- exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
51152
+ recordingPayloadSize,
51153
+ exceedsPayloadSizeLimit
51173
51154
  });
51174
51155
  // don't attempt to send the payload if it exceeds the allowed limit
51175
51156
  if (exceedsPayloadSizeLimit)
51176
51157
  return;
51177
51158
  if (shouldCacheResources) {
51178
- var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
51159
+ const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
51179
51160
  if (hostedResourcesEvent.hostedResources.length) {
51180
51161
  postMessage({
51181
51162
  type: 'hostedResources',
51182
- hostedResourcesEvent: hostedResourcesEvent
51163
+ hostedResourcesEvent
51183
51164
  });
51184
51165
  }
51185
51166
  }
51186
51167
  payload.recordingSize = recordingPayloadSize;
51187
- var body = compress(payload, 'binary');
51168
+ const body = compress(payload, 'binary');
51188
51169
  // we want to calculate ct (current time) as close as we can to the actual POST request
51189
51170
  // so that it's as accurate as possible
51190
- url = "".concat(url, "&ct=").concat(new Date().getTime());
51171
+ url = `${url}&ct=${new Date().getTime()}`;
51191
51172
  fetch(url, {
51192
51173
  method: 'POST',
51193
- body: body
51174
+ body
51194
51175
  }).then(function (response) {
51195
51176
  if (response.status < 200 || response.status >= 300) {
51196
51177
  postMessage({
51197
- error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
51178
+ error: new Error(`received status code ${response.status}: ${response.statusText}`),
51198
51179
  status: response.status,
51199
- sequence: sequence_1
51180
+ sequence
51200
51181
  });
51201
51182
  }
51202
51183
  else {
51203
51184
  postMessage({
51204
- sequence: sequence_1
51185
+ sequence
51205
51186
  });
51206
51187
  }
51207
- })["catch"](function (e) {
51188
+ }).catch(function (e) {
51208
51189
  postMessage({
51209
51190
  error: e,
51210
- sequence: sequence_1
51191
+ sequence
51211
51192
  });
51212
51193
  });
51213
51194
  }