@internetarchive/ia-book-actions 0.0.29-alpha6 → 0.0.29-alpha8

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": "0.0.29-alpha6",
3
+ "version": "0.0.29-alpha8",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -23,8 +23,6 @@ export default class TimerCountdown extends LitElement {
23
23
 
24
24
  updated(changed) {
25
25
  if (changed.has('time') && this.time > 0) {
26
- console.log('changed', this.time);
27
-
28
26
  clearInterval(this.timerInterval);
29
27
  this.timerCountdown();
30
28
  }
@@ -27,7 +27,7 @@ export class OneHourAutoRenew {
27
27
 
28
28
  // private props
29
29
  this.resultRes = {
30
- toastTexts: this.autoReturnMessage,
30
+ toastTexts: '',
31
31
  hideToast: true,
32
32
  renewNow: false,
33
33
  browseAgainNow: false,
@@ -36,7 +36,7 @@ export class OneHourAutoRenew {
36
36
  return this.handleBookAutoRenew();
37
37
  }
38
38
 
39
- async handleBookAutoRenew() {
39
+ handleBookAutoRenew() {
40
40
  try {
41
41
  // if page is not clicked in last 15 minutes,
42
42
  // instantaly renew it if user viewed new page in last 10 minutes
@@ -84,8 +84,6 @@ export class OneHourAutoRenew {
84
84
  this.resultRes.browseAgainNow = true;
85
85
 
86
86
  this.setNewBrowseTime();
87
- } else {
88
- console.log("can't autorenew this time!");
89
87
  }
90
88
 
91
89
  this.setPageFlippedTime();
@@ -117,6 +117,9 @@ export default class IABookActions extends LitElement {
117
117
  this.addEventListener('autoRenewAttempt', async event => {
118
118
  const isPageClick = event.detail.bookPageChange;
119
119
 
120
+ // early return if user is not browsed book
121
+ if (isPageClick && this.borrowType !== 'browsed') return nothing;
122
+
120
123
  this.autoRenewRes = await new OneHourAutoRenew(
121
124
  isPageClick,
122
125
  this.identifier,
@@ -133,8 +136,9 @@ export default class IABookActions extends LitElement {
133
136
 
134
137
  if (this.browseAgainNow) {
135
138
  await this.browseHasRenew();
136
- // this.resetTimerCountdown = true;
137
139
  }
140
+
141
+ return nothing;
138
142
  });
139
143
  }
140
144
 
@@ -315,7 +319,7 @@ export default class IABookActions extends LitElement {
315
319
 
316
320
  get bookActionBar() {
317
321
  return html`
318
- <button @click=${() => this.pageFlipEvent}>Page Flip</button>
322
+ <button @click=${() => this.pageFlipEvent()}>Page Flip</button>
319
323
  <collapsible-action-group
320
324
  .userid=${this.userid}
321
325
  .identifier=${this.identifier}
@@ -515,7 +519,7 @@ export default class IABookActions extends LitElement {
515
519
  }
516
520
 
517
521
  toast-message {
518
- --messageHeightFromTop: 14.5%;
522
+ --messageHeightFromTop: 17%;
519
523
  }
520
524
  `;
521
525
  }