@internetarchive/ia-book-actions 1.1.0-alpha10 → 1.1.0-alpha12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "1.1.0-alpha10",
3
+ "version": "1.1.0-alpha12",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -89,7 +89,7 @@ export default class IABookActions extends LitElement {
89
89
  this.lendingOptions = {};
90
90
  this.borrowType = null; // 'browsed'|'borrowed'
91
91
  this.browseTimer = undefined; // timeout
92
- this.timerExecutionSeconds = 30;
92
+ this.timerExecutionSeconds = 60;
93
93
 
94
94
  /** @deprecated */
95
95
  this.toast = undefined;
@@ -128,10 +128,14 @@ export default class IABookActions extends LitElement {
128
128
  // clear all intervals for lending system
129
129
  window?.IALendingIntervals?.clearAll();
130
130
 
131
- window?.Sentry?.captureMessage(sentryLogs.disconnectedCallback);
131
+ this.sentryCaptureMsg(sentryLogs.disconnectedCallback);
132
132
  this.disconnectResizeObserver();
133
133
  }
134
134
 
135
+ sentryCaptureMsg(msg) {
136
+ if (window?.Sentry) window?.Sentry?.captureMessage(msg ?? '');
137
+ }
138
+
135
139
  firstUpdated() {
136
140
  // bind auto loan renew events
137
141
  this.bindLoanRenewEvents();
@@ -223,7 +227,7 @@ export default class IABookActions extends LitElement {
223
227
  log('setupLendingToolbarActions > hasExpired --- ');
224
228
 
225
229
  if (!this.tokenPoller) {
226
- window?.Sentry?.captureMessage(sentryLogs.bookWasExpired);
230
+ this.sentryCaptureMsg(sentryLogs.bookWasExpired);
227
231
  }
228
232
  window?.IALendingIntervals?.clearAll();
229
233
 
@@ -289,7 +293,7 @@ export default class IABookActions extends LitElement {
289
293
  */
290
294
  document.addEventListener("visibilitychange", async () => {
291
295
  if (!document.hidden) {
292
- log('visibilitychange', new Date().getMinutes, new Date().getSeconds());
296
+ log('visibilitychange is not hidden time: ------------------ ', new Date().getMinutes(), new Date().getSeconds());
293
297
 
294
298
  const loanTime = await this.localCache.get(`${this.identifier}-loanTime`);
295
299
  const secondsLeft = Math.round((loanTime - new Date()) / 1000); // different in seconds
@@ -530,7 +534,7 @@ export default class IABookActions extends LitElement {
530
534
 
531
535
  await this.showExpiredModal();
532
536
 
533
- window?.Sentry?.captureMessage(sentryLogs.browseHasExpired);
537
+ this.sentryCaptureMsg(sentryLogs.browseHasExpired);
534
538
  }
535
539
 
536
540
  async startBrowseTimer() {
@@ -653,7 +657,7 @@ export default class IABookActions extends LitElement {
653
657
  this.modal?.closeModal();
654
658
  this.modal.removeAttribute('id');
655
659
  this.modal.customModalContent = nothing;
656
- window?.Sentry?.captureMessage(sentryLogs.bookHasRenewed);
660
+ this.sentryCaptureMsg(sentryLogs.bookHasRenewed);
657
661
  }
658
662
  }
659
663
 
@@ -694,7 +698,6 @@ export default class IABookActions extends LitElement {
694
698
 
695
699
  if (resyncd?.hasSynced) {
696
700
  secondsLeft = resyncd.whatShouldLeft;
697
-
698
701
  log('startTimerCountdown --- stale, timer has resyncd', {
699
702
  secondsLeft,
700
703
  });
@@ -704,7 +707,7 @@ export default class IABookActions extends LitElement {
704
707
  resyncd,
705
708
  secondsLeft,
706
709
  loanRenewAtLast: this.loanRenewTimeConfig.loanRenewAtLast,
707
- }, new Date().getMinutes(), new Date().getSeconds());
710
+ }, 'time: ', new Date().getMinutes(), ':', new Date().getSeconds(), ', timerDelay: ', this.timerExecutionSeconds);
708
711
 
709
712
  /**
710
713
  * execute from last 10th minute to 0th minute
@@ -719,7 +722,7 @@ export default class IABookActions extends LitElement {
719
722
  // clear interval in secondsLeft if less
720
723
  if (secondsLeft <= this.timerExecutionSeconds) {
721
724
  this.disconnectedCallback();
722
- window?.Sentry?.captureMessage(sentryLogs.clearOneHourTimer);
725
+ this.sentryCaptureMsg(sentryLogs.clearOneHourTimer);
723
726
  }
724
727
  }
725
728