@pendo/agent 2.327.0 → 2.327.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
@@ -7497,7 +7497,7 @@ function applyMatrix2dRect(matrix2d, rect) {
7497
7497
  return transformedRect;
7498
7498
  }
7499
7499
 
7500
- var VERSION = '2.327.0_';
7500
+ var VERSION = '2.327.1_';
7501
7501
 
7502
7502
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7503
7503
 
@@ -7755,7 +7755,7 @@ var agentStorage = (function () {
7755
7755
  function read(name, isPlain, cookieSuffix) {
7756
7756
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
7757
7757
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
7758
- var keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly', false);
7758
+ var keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly');
7759
7759
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
7760
7760
  var rawValue;
7761
7761
  var deserialize = registry.getKeyDeserializer(name);
@@ -7825,7 +7825,7 @@ var agentStorage = (function () {
7825
7825
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
7826
7826
  isSecure = registry.getKeyConfig(name, 'isSecure', isSecure);
7827
7827
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
7828
- var keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly', false);
7828
+ var keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly');
7829
7829
  val = registry.getKeySerializer(name)(val);
7830
7830
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
7831
7831
  resetCache(storageAvailable);
@@ -7866,7 +7866,7 @@ var agentStorage = (function () {
7866
7866
  function clear(name, isPlain, cookieSuffix) {
7867
7867
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
7868
7868
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
7869
- var keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly', false);
7869
+ var keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly');
7870
7870
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
7871
7871
  if (storageIsDisabled()) {
7872
7872
  delete inMemoryStorage[key];
@@ -3979,8 +3979,8 @@ let SERVER = '';
3979
3979
  let ASSET_HOST = '';
3980
3980
  let ASSET_PATH = '';
3981
3981
  let DESIGNER_SERVER = '';
3982
- let VERSION = '2.327.0_';
3983
- let PACKAGE_VERSION = '2.327.0';
3982
+ let VERSION = '2.327.1_';
3983
+ let PACKAGE_VERSION = '2.327.1';
3984
3984
  let LOADER = 'xhr';
3985
3985
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3986
3986
  /**
@@ -4703,7 +4703,7 @@ var agentStorage = (function () {
4703
4703
  function read(name, isPlain, cookieSuffix) {
4704
4704
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
4705
4705
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
4706
- let keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly', false);
4706
+ let keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly');
4707
4707
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
4708
4708
  let rawValue;
4709
4709
  const deserialize = registry.getKeyDeserializer(name);
@@ -4773,7 +4773,7 @@ var agentStorage = (function () {
4773
4773
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
4774
4774
  isSecure = registry.getKeyConfig(name, 'isSecure', isSecure);
4775
4775
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
4776
- let keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly', false);
4776
+ let keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly');
4777
4777
  val = registry.getKeySerializer(name)(val);
4778
4778
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
4779
4779
  resetCache(storageAvailable);
@@ -4814,7 +4814,7 @@ var agentStorage = (function () {
4814
4814
  function clear(name, isPlain, cookieSuffix) {
4815
4815
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
4816
4816
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
4817
- let keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly', false);
4817
+ let keyLocalStorageOnly = registry.getKeyConfig(name, 'localStorageOnly');
4818
4818
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
4819
4819
  if (storageIsDisabled()) {
4820
4820
  delete inMemoryStorage[key];
@@ -12473,6 +12473,22 @@ class SendQueue {
12473
12473
 
12474
12474
  const UNSENT_EVENTS_KEY = 'unsentEvents';
12475
12475
  const UNSENT_EVENTS_MAX_AGE = 7 * 24 * 60 * 60 * 1000; // 7 days
12476
+ function mergeEvents(target, source) {
12477
+ _.each(source, (requests, key) => {
12478
+ target[key] = (target[key] || []).concat(requests);
12479
+ });
12480
+ return target;
12481
+ }
12482
+ function migrateLegacyCookieEvents(events) {
12483
+ const cookieValue = get_pendo_cookie(UNSENT_EVENTS_KEY);
12484
+ if (cookieValue) {
12485
+ try {
12486
+ mergeEvents(events, JSON.parse(cookieValue));
12487
+ }
12488
+ catch (e) { }
12489
+ clearCookie(getPendoCookieKey(UNSENT_EVENTS_KEY));
12490
+ }
12491
+ }
12476
12492
  class LocalStorageEventBuffer {
12477
12493
  constructor() {
12478
12494
  this.events = {};
@@ -12503,14 +12519,18 @@ class LocalStorageEventBuffer {
12503
12519
  * @access public
12504
12520
  * @label UNSENT_EVENTS_KEY
12505
12521
  */
12506
- storage.registry.addLocal(UNSENT_EVENTS_KEY);
12522
+ storage.registry.addLocal(UNSENT_EVENTS_KEY, {
12523
+ localStorageOnly: true,
12524
+ duration: UNSENT_EVENTS_MAX_AGE
12525
+ });
12507
12526
  try {
12508
12527
  this.events = JSON.parse(storage.read(UNSENT_EVENTS_KEY) || '{}');
12509
- storage.clear(UNSENT_EVENTS_KEY);
12510
12528
  }
12511
12529
  catch (e) {
12512
12530
  this.events = {};
12513
12531
  }
12532
+ migrateLegacyCookieEvents(this.events);
12533
+ storage.clear(UNSENT_EVENTS_KEY);
12514
12534
  }
12515
12535
  write(storage) {
12516
12536
  if (_.size(this.events) > 0) {
@@ -22979,7 +22999,7 @@ function advanceGuide(eventType, step, pendo) {
22979
22999
  step.attachEvent(btn, eventType, onEvent);
22980
23000
  }
22981
23001
  function attachBBAdvanceActions(step, pendo) {
22982
- let advanceActions = pendo._.get(step, 'attributes.advanceActions', {});
23002
+ let advanceActions = pendo._.get(step, 'attributes.advanceActions', {}) || {};
22983
23003
  if (advanceActions.elementHover) {
22984
23004
  advanceGuide('mouseover', step, pendo);
22985
23005
  }
@@ -49683,9 +49703,9 @@ var Transport = /** @class */ (function () {
49683
49703
  return Transport;
49684
49704
  }());
49685
49705
 
49686
- var ELEMENT_NODE = 1;
49687
- var INPUT_MASK = '*'.repeat(10);
49688
- var NUMBER_INPUT_MASK = '0'.repeat(10);
49706
+ const ELEMENT_NODE = 1;
49707
+ const INPUT_MASK = '*'.repeat(10);
49708
+ const NUMBER_INPUT_MASK = '0'.repeat(10);
49689
49709
  function isElementNode(node) {
49690
49710
  if (!node)
49691
49711
  return false;
@@ -49694,12 +49714,10 @@ function isElementNode(node) {
49694
49714
  return true;
49695
49715
  }
49696
49716
  function getParent(elem) {
49697
- var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
49717
+ const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
49698
49718
  return isElementShadowRoot ? elem.host : elem.parentNode;
49699
49719
  }
49700
- function distanceToMatch(node, selector, limit, distance) {
49701
- if (limit === void 0) { limit = Infinity; }
49702
- if (distance === void 0) { distance = 0; }
49720
+ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
49703
49721
  if (distance > limit)
49704
49722
  return -1;
49705
49723
  if (!node)
@@ -49713,13 +49731,13 @@ function distanceToMatch(node, selector, limit, distance) {
49713
49731
  return distanceToMatch(getParent(node), selector, limit, distance + 1);
49714
49732
  }
49715
49733
  function shouldMask(node, options) {
49716
- var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
49734
+ const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
49717
49735
  try {
49718
- var el = isElementNode(node) ? node : node.parentElement;
49736
+ const el = isElementNode(node) ? node : node.parentElement;
49719
49737
  if (el === null)
49720
49738
  return false;
49721
- var maskDistance = -1;
49722
- var unmaskDistance = -1;
49739
+ let maskDistance = -1;
49740
+ let unmaskDistance = -1;
49723
49741
  if (maskAllText) {
49724
49742
  unmaskDistance = distanceToMatch(el, unmaskTextSelector);
49725
49743
  if (unmaskDistance < 0) {
@@ -49752,8 +49770,8 @@ function isNumberInput(element) {
49752
49770
  }
49753
49771
  function shouldMaskInput(element, maskInputOptions) {
49754
49772
  if (maskInputOptions && isElementNode(element)) {
49755
- var tagName = (element.tagName || '').toLowerCase();
49756
- var type = (element.type || '').toLowerCase();
49773
+ const tagName = (element.tagName || '').toLowerCase();
49774
+ const type = (element.type || '').toLowerCase();
49757
49775
  if (maskInputOptions[tagName] || maskInputOptions[type]) {
49758
49776
  return true;
49759
49777
  }
@@ -51247,12 +51265,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
51247
51265
  }
51248
51266
  }
51249
51267
 
51250
- var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
51268
+ const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
51251
51269
  function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
51252
- var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
51253
- var matches = stringifiedRecordingPayload.match(fontURLRegex);
51270
+ const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
51271
+ const matches = stringifiedRecordingPayload.match(fontURLRegex);
51254
51272
  // de-duplicate matches
51255
- var hostedResources = matches ? Array.from(new Set(matches)) : [];
51273
+ const hostedResources = matches ? Array.from(new Set(matches)) : [];
51256
51274
  return {
51257
51275
  type: 'recording',
51258
51276
  visitorId: recordingEvent.visitorId,
@@ -51267,7 +51285,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
51267
51285
  recordingPayloadMetadata: [],
51268
51286
  sequence: 0,
51269
51287
  recordingPayloadCount: 0,
51270
- hostedResources: hostedResources
51288
+ hostedResources
51271
51289
  };
51272
51290
  }
51273
51291
  // keep in mind changes here may need addressing in the extension worker proxy as well
@@ -51275,69 +51293,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
51275
51293
  try {
51276
51294
  if (e.data.type === 'init' && e.data.lockID) {
51277
51295
  if (navigator.locks) {
51278
- navigator.locks.request(e.data.lockID, function () {
51296
+ navigator.locks.request(e.data.lockID, () => {
51279
51297
  postMessage({ ready: true });
51280
51298
  // This unresolved promise keeps the lock held with the worker until the worker is
51281
51299
  // terminated at which point the lock is released.
51282
- return new Promise$2(function () { });
51300
+ return new Promise$2(() => { });
51283
51301
  });
51284
51302
  }
51285
51303
  return;
51286
51304
  }
51287
51305
  if (e.data.url && e.data.payload) {
51288
- var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
51306
+ let { url, payload, shouldCacheResources } = e.data;
51289
51307
  if (Object.keys(payload).length === 0) {
51290
51308
  postMessage({
51291
51309
  type: 'emptyPayload'
51292
51310
  });
51293
51311
  }
51294
- var sequence_1 = payload.sequence;
51295
- var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
51312
+ const { sequence } = payload;
51313
+ const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
51296
51314
  // calculate and post back the recording payload size before the payload is compressed
51297
- var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
51298
- var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
51315
+ const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
51316
+ const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
51299
51317
  postMessage({
51300
51318
  type: 'recordingPayloadSize',
51301
- recordingPayloadSize: recordingPayloadSize,
51302
- exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
51319
+ recordingPayloadSize,
51320
+ exceedsPayloadSizeLimit
51303
51321
  });
51304
51322
  // don't attempt to send the payload if it exceeds the allowed limit
51305
51323
  if (exceedsPayloadSizeLimit)
51306
51324
  return;
51307
51325
  if (shouldCacheResources) {
51308
- var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
51326
+ const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
51309
51327
  if (hostedResourcesEvent.hostedResources.length) {
51310
51328
  postMessage({
51311
51329
  type: 'hostedResources',
51312
- hostedResourcesEvent: hostedResourcesEvent
51330
+ hostedResourcesEvent
51313
51331
  });
51314
51332
  }
51315
51333
  }
51316
51334
  payload.recordingSize = recordingPayloadSize;
51317
- var body = compress(payload, 'binary');
51335
+ const body = compress(payload, 'binary');
51318
51336
  // we want to calculate ct (current time) as close as we can to the actual POST request
51319
51337
  // so that it's as accurate as possible
51320
- url = "".concat(url, "&ct=").concat(new Date().getTime());
51338
+ url = `${url}&ct=${new Date().getTime()}`;
51321
51339
  fetch(url, {
51322
51340
  method: 'POST',
51323
- body: body
51341
+ body
51324
51342
  }).then(function (response) {
51325
51343
  if (response.status < 200 || response.status >= 300) {
51326
51344
  postMessage({
51327
- error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
51345
+ error: new Error(`received status code ${response.status}: ${response.statusText}`),
51328
51346
  status: response.status,
51329
- sequence: sequence_1
51347
+ sequence
51330
51348
  });
51331
51349
  }
51332
51350
  else {
51333
51351
  postMessage({
51334
- sequence: sequence_1
51352
+ sequence
51335
51353
  });
51336
51354
  }
51337
- })["catch"](function (e) {
51355
+ }).catch(function (e) {
51338
51356
  postMessage({
51339
51357
  error: e,
51340
- sequence: sequence_1
51358
+ sequence
51341
51359
  });
51342
51360
  });
51343
51361
  }