@pendo/agent 2.279.3 → 2.279.5

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
@@ -7228,7 +7228,7 @@ function getScreenPosition(element) {
7228
7228
  };
7229
7229
  }
7230
7230
 
7231
- var VERSION = '2.279.3_';
7231
+ var VERSION = '2.279.5_';
7232
7232
  function isExtensionAgent() {
7233
7233
  var installType = getPendoConfigValue('installType') || getPendoConfigFromEnclosingScope().installType;
7234
7234
  return installType === EXTENSION_INSTALL_TYPE;
@@ -3891,8 +3891,8 @@ var SERVER = '';
3891
3891
  var ASSET_HOST = '';
3892
3892
  var ASSET_PATH = '';
3893
3893
  var DESIGNER_ENV = '';
3894
- var VERSION = '2.279.3_';
3895
- var PACKAGE_VERSION = '2.279.3';
3894
+ var VERSION = '2.279.5_';
3895
+ var PACKAGE_VERSION = '2.279.5';
3896
3896
  var LOADER = 'xhr';
3897
3897
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3898
3898
  /**
@@ -11252,7 +11252,7 @@ class ElementGetter {
11252
11252
  if (el && !isInDoc) {
11253
11253
  return undefined;
11254
11254
  }
11255
- [el] = dom(this.cssSelector);
11255
+ el = dom(this.cssSelector)[0];
11256
11256
  if (!el) {
11257
11257
  return undefined;
11258
11258
  }
@@ -36432,7 +36432,6 @@ function getActiveEmbeddedGuides() {
36432
36432
  }
36433
36433
 
36434
36434
  const SESSION_ID = 'sessionId';
36435
- const SESSION_LAST_USER_INTERACTION_EVENT = 'sessionLastUserInteractionEvent';
36436
36435
  const THIRTY_MINUTES = 1000 * 60 * 30;
36437
36436
  class SessionManager {
36438
36437
  constructor() {
@@ -36442,7 +36441,6 @@ class SessionManager {
36442
36441
  this.api = PluginAPI;
36443
36442
  this.pendo = pendo;
36444
36443
  this.subscriptions = [
36445
- this.api.attachEvent(this.api.Events, 'ready', _.bind(this.ready, this)),
36446
36444
  this.api.attachEvent(this.api.Events, 'eventCaptured', _.bind(this.eventCaptured, this))
36447
36445
  ];
36448
36446
  this.inactivityDuration = this.api.ConfigReader.get('inactivityDuration', THIRTY_MINUTES);
@@ -36456,20 +36454,6 @@ class SessionManager {
36456
36454
  * @label SESSION_ID
36457
36455
  */
36458
36456
  this.api.agentStorage.registry.addLocal(SESSION_ID);
36459
- /**
36460
- * Stores the visitorId, accountId, and last user interaction timestamp.
36461
- * This is used to track inactivity across page loads for the purposes of
36462
- * expiring an old session and generating a new `pendo_sessionId`
36463
- *
36464
- * @name pendo_sessionLastUserInteractionEvent
36465
- * @category Cookies/localStorage
36466
- * @access public
36467
- * @label SESSION_LAST_USER_INTERACTION_EVENT
36468
- */
36469
- this.api.agentStorage.registry.addLocal(SESSION_LAST_USER_INTERACTION_EVENT);
36470
- if (this.api.store.getters['frames/isReady']()) {
36471
- this.ready();
36472
- }
36473
36457
  }
36474
36458
  teardown() {
36475
36459
  _.each(this.subscriptions, function (unsubscribe) {
@@ -36477,14 +36461,8 @@ class SessionManager {
36477
36461
  });
36478
36462
  this.subscriptions.length = 0;
36479
36463
  }
36480
- ready() {
36481
- if (!this.isReady) {
36482
- this.sessionId(); // generate/load id
36483
- this.isReady = true;
36484
- }
36485
- }
36486
- isExpired(timestamp) {
36487
- const prevLastEmitTime = _.get(this._sessionInfo, 'timestamp');
36464
+ isExpired(sessionInfo, timestamp) {
36465
+ const prevLastEmitTime = _.get(sessionInfo, 'timestamp');
36488
36466
  if (prevLastEmitTime && timestamp - prevLastEmitTime > this.inactivityDuration) {
36489
36467
  return true;
36490
36468
  }
@@ -36494,41 +36472,34 @@ class SessionManager {
36494
36472
  if (!event || !event.data || !event.data.length)
36495
36473
  return;
36496
36474
  var capturedEvent = event.data[0];
36497
- this.ready(); // ensure IDs are loaded
36498
36475
  const eventTime = capturedEvent.browser_time || new Date().getTime();
36499
- if (this.isExpired(eventTime)) {
36476
+ let sessionInfo = this.sessionInfo();
36477
+ if (this.isExpired(sessionInfo, eventTime)) {
36500
36478
  // the current event will be attributed to the *new* session
36501
- this.clearSessionInfo();
36479
+ sessionInfo = this.clearSessionInfo();
36502
36480
  this.api.Events.sessionChanged.trigger();
36503
36481
  }
36504
- this.storeLastInteractionEventInformation(eventTime);
36505
- capturedEvent.sessionId = this.sessionId();
36482
+ this.storeLastInteractionEventInformation(sessionInfo, eventTime);
36483
+ capturedEvent.sessionId = sessionInfo.sessionId;
36506
36484
  }
36507
- sessionId(defaultId = this.pendo.randomString(16)) {
36508
- if (!this._sessionInfo) {
36509
- let currentSessionInfo = this.api.agentStorage.read(SESSION_ID);
36510
- if (!currentSessionInfo) {
36511
- currentSessionInfo = JSON.stringify({
36512
- 'sessionId': defaultId,
36513
- 'timestamp': new Date().getTime()
36514
- });
36515
- this.api.agentStorage.write(SESSION_ID, currentSessionInfo);
36516
- }
36517
- this._sessionInfo = JSON.parse(currentSessionInfo);
36485
+ sessionInfo(defaultId = this.pendo.randomString(16)) {
36486
+ let currentSessionInfo = this.api.agentStorage.read(SESSION_ID);
36487
+ if (!currentSessionInfo) {
36488
+ currentSessionInfo = JSON.stringify({
36489
+ 'sessionId': defaultId,
36490
+ 'timestamp': new Date().getTime()
36491
+ });
36492
+ this.api.agentStorage.write(SESSION_ID, currentSessionInfo);
36518
36493
  }
36519
- return this._sessionInfo.sessionId;
36494
+ return JSON.parse(currentSessionInfo);
36520
36495
  }
36521
36496
  clearSessionInfo() {
36522
- let currentSessionInfo = this.api.agentStorage.read(SESSION_ID);
36523
- if (currentSessionInfo && JSON.parse(currentSessionInfo).sessionId === this._sessionInfo.sessionId) {
36524
- this.api.agentStorage.clear(SESSION_ID);
36525
- }
36526
- delete this._sessionInfo;
36527
- this.sessionId();
36497
+ this.api.agentStorage.clear(SESSION_ID);
36498
+ return this.sessionInfo();
36528
36499
  }
36529
- storeLastInteractionEventInformation(timestamp) {
36530
- this._sessionInfo.timestamp = timestamp;
36531
- this.api.agentStorage.write(SESSION_ID, JSON.stringify(this._sessionInfo));
36500
+ storeLastInteractionEventInformation(sessionInfo, timestamp) {
36501
+ sessionInfo.timestamp = timestamp;
36502
+ this.api.agentStorage.write(SESSION_ID, JSON.stringify(sessionInfo));
36532
36503
  }
36533
36504
  }
36534
36505
  var SessionManager$1 = new SessionManager();