@internetarchive/ia-book-actions 0.1.4-alpha4 → 0.1.4-alpha6

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/demo/index.html CHANGED
@@ -131,8 +131,8 @@
131
131
  iaBookActions.returnUrl = 'https://openlibrary.org';
132
132
  iaBookActions.localCache = localCache;
133
133
 
134
- let loanTotalTime2Min = { loanTotalTime: 300, loanRenewAtLast: 120, pageChangedInLast: 60 };
135
- let loanTotalTime5Min = { loanTotalTime: 300, loanRenewAtLast: 180, pageChangedInLast: 15 };
134
+ let loanTotalTime2Min = { loanTotalTime: 20, loanRenewAtLast: 15, pageChangedInLast: 5 };
135
+ let loanTotalTime5Min = { loanTotalTime: 300, loanRenewAtLast: 290, pageChangedInLast: 15 };
136
136
  let loanTotalTime1Hour = { loanTotalTime: 3600, loanRenewAtLast: 600, pageChangedInLast: 900 };
137
137
 
138
138
  iaBookActions.loanRenewTimeConfig = loanTotalTime2Min;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.1.4-alpha4",
3
+ "version": "0.1.4-alpha6",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -32,10 +32,10 @@ export default class TimerCountdown extends LitElement {
32
32
  this.loanRenewAtLast = 0;
33
33
 
34
34
  /**
35
- * timer which is not reduced along with timer
35
+ * store time when timer is started
36
36
  * @type {string}
37
37
  */
38
- this.timeWhenTimerStart = undefined;
38
+ this.timeWhenTimerStart = '';
39
39
 
40
40
  /**
41
41
  * delay seconds in setInterval function
@@ -89,8 +89,8 @@ export default class TimerCountdown extends LitElement {
89
89
  this.dispatchLoanRenewEvent(secondsLeft);
90
90
  }
91
91
 
92
- // clear interval
93
- if (secondsLeft <= 10) {
92
+ // clear interval in secondsLeft if less
93
+ if (secondsLeft <= this.timerExecutionSeconds) {
94
94
  this.disconnectedCallback();
95
95
  window?.Sentry?.captureMessage(sentryLogs.clearOneHourTimer);
96
96
  }
@@ -260,20 +260,19 @@ export default class IABookActions extends LitElement {
260
260
  * dispatched this event from bookreader page changed
261
261
  */
262
262
  window.addEventListener('BookReader:userAction', () => {
263
+ console.log('user action executed');
264
+ this.suppressToast = true;
265
+
263
266
  if (this.borrowType === 'browsed') {
264
- this.suppressToast = false;
265
267
  this.autoLoanRenewChecker(true);
266
- } else {
267
- this.suppressToast = true;
268
268
  }
269
-
270
- return nothing;
271
269
  });
272
270
 
273
271
  /**
274
272
  * detect click-event on document to close toast-template
275
273
  */
276
- document.addEventListener('click', e => {
274
+ window.addEventListener('click', e => {
275
+ console.log('document click executed');
277
276
  if (this.loanRenewHelper && this.loanRenewResult.secondsLeft > 0) {
278
277
  this.suppressToast = true;
279
278
  }