@internetarchive/ia-book-actions 1.1.0-alpha13 → 1.1.0-alpha14

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-alpha13",
3
+ "version": "1.1.0-alpha14",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -298,14 +298,16 @@ export default class IABookActions extends LitElement {
298
298
  if (!document.hidden) {
299
299
  log('visibilitychange is not hidden time: ------------------ ', new Date().getMinutes(), new Date().getSeconds());
300
300
 
301
- const loanTime = await this.localCache.get(`${this.identifier}-loanTime`);
302
- const secondsLeft = Math.round((loanTime - new Date()) / 1000); // different in seconds
303
-
304
- if (secondsLeft >= this.timerExecutionSeconds) {
305
- this.setIntervalExecutionBlock(Number(secondsLeft));
306
- } else {
307
- this.browseHasExpired();
308
- this.disconnectedCallback();
301
+ if (this.borrowType === 'browsed' && this.lendingStatus.browsingExpired === false) {
302
+ const loanTime = await this.localCache.get(`${this.identifier}-loanTime`);
303
+ const secondsLeft = Math.round((loanTime - new Date()) / 1000); // different in seconds
304
+
305
+ if (secondsLeft >= this.timerExecutionSeconds) {
306
+ this.setIntervalExecutionBlock(Number(secondsLeft));
307
+ } else {
308
+ this.browseHasExpired();
309
+ this.disconnectedCallback();
310
+ }
309
311
  }
310
312
  }
311
313
  });