@internetarchive/ia-book-actions 0.0.29-alpha5 → 0.0.29-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
@@ -128,8 +128,8 @@
128
128
  iaBookActions.returnUrl = 'https://openlibrary.org';
129
129
  iaBookActions.localCache = localCache;
130
130
  iaBookActions.autoRenewConfig = {
131
- totalTime: 20, // 60 second = 1 min
132
- autoCheckAt: 15, // totalTime - 10th minute
131
+ totalTime: 60, // 60 second = 1 min
132
+ autoCheckAt: 55, // totalTime - 10th minute
133
133
  FlippedInLast: 15, // within last 15 second/minute
134
134
  };
135
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.29-alpha5",
3
+ "version": "0.0.29-alpha6",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "scripts": {
13
13
  "start": "web-dev-server",
14
- "lint": "eslint --ext .js",
15
- "format": "eslint --ext .js,",
14
+ "lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.js\" --check --ignore-path .gitignore",
15
+ "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.js\" --write --ignore-path .gitignore",
16
16
  "test": "yarn run lint && yarn test:fast",
17
17
  "test:fast": "web-test-runner --coverage --playwright --browsers chromium firefox webkit",
18
18
  "test:watch": "web-test-runner --watch --playwright --browsers chromium firefox webkit"
@@ -43,6 +43,12 @@
43
43
  "sinon": "^13.0.2"
44
44
  },
45
45
  "eslintConfig": {
46
+ "rules": {
47
+ "no-console": "off",
48
+ "no-unused-expressions": "off",
49
+ "class-methods-use-this": "off",
50
+ "lit-a11y/click-events-have-key-events": "off"
51
+ },
46
52
  "extends": [
47
53
  "@open-wc/eslint-config",
48
54
  "eslint-config-prettier"
@@ -28,8 +28,8 @@ export class CollapsibleActionGroup extends ActionsHandler {
28
28
  dropdownArrow: { type: String },
29
29
  disabled: { type: Boolean },
30
30
  returnUrl: { type: String },
31
+ localCache: { type: Function },
31
32
  browseAgainNow: { type: Boolean },
32
- autoRenewConfig: { type: Object },
33
33
  };
34
34
  }
35
35
 
@@ -49,8 +49,8 @@ export class CollapsibleActionGroup extends ActionsHandler {
49
49
  this.loaderIcon = 'https://archive.org/upload/images/tree/loading.gif';
50
50
  this.disabled = false;
51
51
  this.returnUrl = '';
52
+ this.localCache = undefined;
52
53
  this.browseAgainNow = false;
53
- this.autoRenewConfig = {};
54
54
  }
55
55
 
56
56
  updated(changed) {
@@ -61,11 +61,11 @@ export class CollapsibleActionGroup extends ActionsHandler {
61
61
  this.resetActions();
62
62
  }
63
63
 
64
- if (this.browseAgainNow === true) {
64
+ if (changed.has('browseAgainNow') && this.browseAgainNow === true) {
65
65
  this.dispatchEvent(
66
66
  new CustomEvent('autoBrowseBook', {
67
67
  detail: {
68
- event: { 'autoRenewed1Hour': 'browseBook' },
68
+ event: { autoRenewed1Hour: 'browseBook' },
69
69
  },
70
70
  })
71
71
  );
@@ -11,33 +11,31 @@ export default class TimerCountdown extends LitElement {
11
11
 
12
12
  constructor() {
13
13
  super();
14
- this.time = 60;
14
+ this.time = 0;
15
15
  this.autoCheckAt = 0;
16
16
  this.timerInterval = undefined;
17
17
  this.resetTimerCountdown = false;
18
18
  }
19
19
 
20
20
  disconnectedCallback() {
21
- clearInterval(this.timerInterval)
22
- }
23
-
24
- firstUpdated() {
25
- this.timerCountdown();
21
+ clearInterval(this.timerInterval);
26
22
  }
27
23
 
28
24
  updated(changed) {
29
- if (changed.has('resetTimerCountdown')) {
25
+ if (changed.has('time') && this.time > 0) {
26
+ console.log('changed', this.time);
27
+
30
28
  clearInterval(this.timerInterval);
31
- this.timerCountdown()
29
+ this.timerCountdown();
32
30
  }
33
31
  }
34
-
32
+
35
33
  timerCountdown() {
36
34
  this.timerInterval = setInterval(() => {
37
35
  this.time -= 1;
38
36
 
39
37
  // execute 50th minute check
40
- if (this.time === this.autoCheckAt) {
38
+ if (Math.round(this.time) === this.autoCheckAt) {
41
39
  this.dispatchEvent(
42
40
  new CustomEvent('autoRenewAttempt', {
43
41
  detail: {
@@ -51,18 +49,16 @@ export default class TimerCountdown extends LitElement {
51
49
  }
52
50
 
53
51
  if (this.time === 0) clearInterval(this.timerInterval);
54
-
55
52
  }, 1000);
56
53
  }
57
54
 
58
-
59
55
  render() {
60
56
  return html`<div id="countdown">
61
- <div id="countdown-number">${this.time}</div>
62
- <svg>
63
- <circle r="18" cx="20" cy="20"></circle>
64
- </svg>
65
- </div>`
57
+ <div id="countdown-number">${Math.round(this.time)}</div>
58
+ <svg>
59
+ <circle r="18" cx="20" cy="20"></circle>
60
+ </svg>
61
+ </div>`;
66
62
  }
67
63
 
68
64
  static get styles() {
@@ -72,22 +68,13 @@ export default class TimerCountdown extends LitElement {
72
68
  font-size: 14px;
73
69
  position: absolute;
74
70
  }
75
- #countdown1 {
76
- position: relative;
77
- margin: auto;
78
- margin-top: 100px;
79
- height: 40px;
80
- width: 40px;
81
- text-align: center;
82
- }
83
-
84
71
  #countdown-number {
85
72
  color: white;
86
73
  display: inline-block;
87
74
  line-height: 40px;
88
75
  margin-right: 12px;
89
76
  }
90
-
77
+
91
78
  svg {
92
79
  position: absolute;
93
80
  top: 0;
@@ -96,7 +83,7 @@ export default class TimerCountdown extends LitElement {
96
83
  height: 40px;
97
84
  transform: rotateY(-180deg) rotateZ(-90deg);
98
85
  }
99
-
86
+
100
87
  svg circle {
101
88
  stroke-dasharray: 113px;
102
89
  stroke-dashoffset: 0px;
@@ -106,7 +93,7 @@ export default class TimerCountdown extends LitElement {
106
93
  fill: none;
107
94
  animation: countdown 60s linear infinite forwards;
108
95
  }
109
-
96
+
110
97
  @keyframes countdown {
111
98
  from {
112
99
  stroke-dashoffset: 0px;
@@ -22,8 +22,11 @@ export class ToastMessage extends LitElement {
22
22
  <span
23
23
  class="toast-message fade-in ${this.textClass}"
24
24
  title="Click/tap to close"
25
- @click=${() => { this.dismisOnClick ? this.hideToast = true : nothing}}
26
- >${this.texts}</span>
25
+ @click=${() => {
26
+ this.dismisOnClick ? (this.hideToast = true) : nothing;
27
+ }}
28
+ >${this.texts}</span
29
+ >
27
30
  `
28
31
  : nothing;
29
32
  }
@@ -34,14 +37,13 @@ export class ToastMessage extends LitElement {
34
37
  return css`
35
38
  :host {
36
39
  display: inline-block;
37
-
38
40
  }
39
41
  .toast-message {
40
42
  z-index: 2;
41
43
  position: absolute;
42
44
  top: ${heightFromTop};
43
45
  font-size: 1.4rem;
44
- font-family: "Helvetica Neue";
46
+ font-family: 'Helvetica Neue';
45
47
  color: #fff;
46
48
  left: 50%;
47
49
  background: #333;
@@ -1,6 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
2
 
3
- import { LocalCache } from '@internetarchive/local-cache';
4
3
  import { URLHelper } from '../../config/url-helper.js';
5
4
  import ActionsHandlerService from './actions-handler-service.js';
6
5
  import * as Cookies from '../doc-cookies.js';
@@ -20,11 +19,6 @@ export default class ActionsHandler extends LitElement {
20
19
  this.ajaxTimeout = 6000;
21
20
  this.returnUrl = '';
22
21
  this.autoRenewConfig = {};
23
-
24
- this.localCache = new LocalCache({
25
- namespace: '1HourLoanStorage',
26
- });
27
-
28
22
  this.bindEvents();
29
23
  }
30
24
 
@@ -112,7 +106,7 @@ export default class ActionsHandler extends LitElement {
112
106
  handleBrowseIt() {
113
107
  const action = 'browse_book';
114
108
  this.dispatchToggleActionGroup();
115
- this.setBrowseTimeSession()
109
+ this.setBrowseTimeSession();
116
110
 
117
111
  ActionsHandlerService({
118
112
  action,
@@ -128,22 +122,20 @@ export default class ActionsHandler extends LitElement {
128
122
 
129
123
  handleAutoBrowseIt() {
130
124
  const action = 'renew_loan';
125
+ this.setBrowseTimeSession();
131
126
 
132
127
  ActionsHandlerService({
133
128
  action,
134
129
  identifier: this.identifier,
135
130
  success: () => {
136
- console.log('success!');
131
+ // console.log('success!');
137
132
  },
138
133
  error: data => {
139
- console.log(data);
140
- console.log('error!');
141
134
  this.dispatchActionError(action, data);
142
135
  },
143
136
  });
144
137
  }
145
138
 
146
-
147
139
  handleReturnIt() {
148
140
  const action = 'return_loan';
149
141
  this.dispatchToggleActionGroup();
@@ -294,17 +286,19 @@ export default class ActionsHandler extends LitElement {
294
286
  }
295
287
  }
296
288
 
297
- async setBrowseTimeSession(_date = '') {
289
+ async setBrowseTimeSession() {
298
290
  try {
299
291
  // set a value
300
292
  await this.localCache.set({
301
293
  key: `${this.identifier}-loanTime`,
302
294
  value: new Date(), // current time
303
295
  ttl: Number(this.autoRenewConfig.totalTime),
304
- })
296
+ });
305
297
 
306
298
  await this.localCache.delete(`${this.identifier}-pageFlipTime`);
307
- } catch (error) {}
299
+ } catch (error) {
300
+ console.log(error);
301
+ }
308
302
  }
309
303
 
310
304
  deleteLoanCookies() {
@@ -1,13 +1,18 @@
1
- import ActionsHandlerService from './actions-handler/actions-handler-service.js';
1
+ import { nothing } from 'lit';
2
2
 
3
3
  /**
4
4
  * This class is used to determine if use is eligible for auto renew loan.
5
5
  *
6
- * ActionsHandlerService is a function being used to execute
7
6
  */
8
7
  export class OneHourAutoRenew {
9
- constructor(pageClick, identifier, localCache, autoRenewConfig, userHasBrowsed) {
10
- this.pageClick = pageClick;
8
+ constructor(
9
+ isPageClick,
10
+ identifier,
11
+ localCache,
12
+ autoRenewConfig,
13
+ userHasBrowsed
14
+ ) {
15
+ this.isPageClick = isPageClick;
11
16
  this.identifier = identifier;
12
17
  this.localCache = localCache;
13
18
  this.autoRenewConfig = autoRenewConfig;
@@ -15,14 +20,17 @@ export class OneHourAutoRenew {
15
20
 
16
21
  // messages for auto return machenism
17
22
  this.autoRenewMessage = 'This book has been renewed for another hour.';
18
- this.autoReturnMessage = 'This book has been auto-returned due to inactivity.';
19
- this.autoReturnWarning = 'This book will be auto-returned in 10 minutes unless you turn a page.';
20
-
23
+ this.autoReturnMessage =
24
+ 'This book has been auto-returned due to inactivity.';
25
+ this.autoReturnWarning =
26
+ 'This book will be auto-returned in 10 minutes unless you turn a page.';
27
+
21
28
  // private props
22
29
  this.resultRes = {
23
30
  toastTexts: this.autoReturnMessage,
24
31
  hideToast: true,
25
32
  renewNow: false,
33
+ browseAgainNow: false,
26
34
  };
27
35
 
28
36
  return this.handleBookAutoRenew();
@@ -30,20 +38,19 @@ export class OneHourAutoRenew {
30
38
 
31
39
  async handleBookAutoRenew() {
32
40
  try {
33
- // if page is not flipped in last 15 minutes,
41
+ // if page is not clicked in last 15 minutes,
34
42
  // instantaly renew it if user viewed new page in last 10 minutes
35
- if (this.pageClick) {
36
- console.log('page flipped!')
37
- this.setPageFlippedTime();
43
+ if (this.isPageClick) {
44
+ console.log('page flipped!!');
38
45
  return this.userFlippedBookPage(); // user clicked on page
39
- } else {
40
- console.log('auto checker!')
41
- return this.autoCheckerTimer(); // auto checker at 50th minute
42
46
  }
43
-
47
+ console.log('auto checker!');
48
+ return this.autoCheckerTimer(); // auto checker at 50th minute
44
49
  } catch (error) {
45
- console.log(error)
50
+ console.log(error);
46
51
  }
52
+
53
+ return nothing;
47
54
  }
48
55
 
49
56
  async setPageFlippedTime() {
@@ -52,7 +59,7 @@ export class OneHourAutoRenew {
52
59
  key: `${this.identifier}-pageFlipTime`,
53
60
  value: new Date(), // current time
54
61
  ttl: Number(this.autoRenewConfig.totalTime),
55
- })
62
+ });
56
63
  }
57
64
 
58
65
  async userFlippedBookPage() {
@@ -60,53 +67,61 @@ export class OneHourAutoRenew {
60
67
  totalTime, // 60
61
68
  autoCheckAt, // 50
62
69
  } = this.autoRenewConfig;
63
- const currentDate = new Date();
70
+ const currentTime = new Date();
64
71
  const loanTime = await this.localCache.get(`${this.identifier}-loanTime`);
65
72
 
66
- const lastTimeFrame = await this.changeTime(
73
+ const lastTimeFrame = this.changeTime(
67
74
  loanTime,
68
75
  totalTime - autoCheckAt,
69
76
  'add'
70
77
  ); // 50 seconds
71
78
 
72
- if (currentDate >= lastTimeFrame) {
79
+ if (currentTime >= lastTimeFrame) {
73
80
  console.log('1 YES NOW BORROW IT AGAIN NOW!');
74
81
  this.resultRes.toastTexts = this.autoRenewMessage;
75
- this.resultRes.browseAgainNow = true;
76
82
  this.resultRes.hideToast = false;
77
83
  this.resultRes.renewNow = true;
84
+ this.resultRes.browseAgainNow = true;
78
85
 
79
86
  this.setNewBrowseTime();
87
+ } else {
88
+ console.log("can't autorenew this time!");
80
89
  }
81
90
 
91
+ this.setPageFlippedTime();
82
92
  return this.resultRes;
83
93
  }
84
94
 
85
95
  async autoCheckerTimer() {
86
- const currentDate = new Date();
96
+ const currentTime = new Date();
87
97
  const { FlippedInLast } = this.autoRenewConfig;
88
- const lastPageFlipTime = await this.localCache.get(`${this.identifier}-pageFlipTime`);
98
+ const lastPageFlipTime = await this.localCache.get(
99
+ `${this.identifier}-pageFlipTime`
100
+ );
89
101
 
90
102
  // last 15 min if used flipped a page.
91
- const lastFlipTimeFrame = await this.changeTime(
92
- currentDate,
103
+ const lastFlipTimeFrame = this.changeTime(
104
+ currentTime,
93
105
  FlippedInLast,
94
106
  'sub'
95
107
  ); // 15 seconds
96
108
 
97
- if (lastPageFlipTime === undefined || lastPageFlipTime <= lastFlipTimeFrame) { // not viewed
109
+ if (
110
+ lastPageFlipTime === undefined ||
111
+ lastPageFlipTime <= lastFlipTimeFrame
112
+ ) {
113
+ // not viewed
98
114
  console.log('2 not viewed, warning message!');
99
115
  this.resultRes.toastTexts = this.autoReturnWarning;
100
116
  this.resultRes.hideToast = false;
101
- } else if (lastPageFlipTime >= lastFlipTimeFrame) { // viewed in last time frame
117
+ } else if (lastPageFlipTime >= lastFlipTimeFrame) {
118
+ // viewed in last time frame
102
119
  console.log('3 viewed, auto renew and message!');
103
120
  this.resultRes.toastTexts = this.autoRenewMessage;
104
121
  this.resultRes.browseAgainNow = true;
105
122
  this.resultRes.hideToast = false;
106
123
  this.resultRes.renewNow = true;
107
124
 
108
- // delete pageFlipTime when book is auto renew at nth minute
109
- await this.localCache.delete(`${this.identifier}-pageFlipTime`);
110
125
  this.setNewBrowseTime();
111
126
  }
112
127
 
@@ -116,7 +131,7 @@ export class OneHourAutoRenew {
116
131
  async setNewBrowseTime() {
117
132
  try {
118
133
  // last 15 min if used flipped a page.
119
- const expireDate = await this.changeTime(
134
+ const expireDate = this.changeTime(
120
135
  new Date(),
121
136
  this.autoRenewConfig.totalTime,
122
137
  'add'
@@ -127,15 +142,18 @@ export class OneHourAutoRenew {
127
142
  key: `${this.identifier}-loanTime`,
128
143
  value: expireDate, // expireDate time
129
144
  ttl: Number(this.autoRenewConfig.totalTime),
130
- })
145
+ });
131
146
 
147
+ // delete pageFlipTime when book is auto renew at nth minute
132
148
  await this.localCache.delete(`${this.identifier}-pageFlipTime`);
133
- } catch (error) {}
149
+ } catch (error) {
150
+ console.log(error);
151
+ }
134
152
  }
135
153
 
136
- async changeTime(date, minutes, op) {
137
- if (date === undefined) return undefined;
138
-
154
+ changeTime(date, minutes, op) {
155
+ if (date === undefined) return nothing;
156
+
139
157
  if (op === 'sub') {
140
158
  return new Date(date.getTime() - minutes * 1000);
141
159
  }
@@ -143,7 +161,6 @@ export class OneHourAutoRenew {
143
161
  return new Date(date.getTime() + minutes * 1000);
144
162
  }
145
163
 
146
-
147
164
  sendEvent(eventCategory, eventAction) {
148
165
  window?.archive_analytics?.send_event(
149
166
  eventCategory,
@@ -36,7 +36,6 @@ export default class IABookActions extends LitElement {
36
36
  attribute: false,
37
37
  },
38
38
  barType: { type: String },
39
- autoRenew: { type: Boolean },
40
39
  sharedObserver: { attribute: false },
41
40
  disableActionGroup: { type: Boolean },
42
41
  modal: { Object },
@@ -61,16 +60,15 @@ export default class IABookActions extends LitElement {
61
60
  this.bwbPurchaseUrl = '';
62
61
  this.lendingBarPostInit = () => {};
63
62
  this.barType = 'action'; // 'title'|'action'
64
- this.autoRenew = false;
65
63
  this.sharedObserver = undefined;
66
64
  this.disableActionGroup = false;
67
65
  this.modal = undefined;
68
66
  this.tokenDelay = 120000; // 2 minutes
69
67
  this.localCache = new LocalCache({
70
- namespace: '1HourLoanStorage'
71
- }),
72
- this.autoRenewConfig = {},
73
- this.autoRenewObj = undefined;
68
+ namespace: '1HourLoanStorage',
69
+ });
70
+ this.autoRenewConfig = {};
71
+ this.autoRenewRes = undefined;
74
72
 
75
73
  // private props
76
74
  this.primaryActions = [];
@@ -108,9 +106,6 @@ export default class IABookActions extends LitElement {
108
106
  this.update();
109
107
  }
110
108
 
111
- if (changed.has('autoRenew')) {
112
- this.resetTimerCountdown = true;
113
- }
114
109
  if (changed.has('sharedObserver')) {
115
110
  this.disconnectResizeObserver();
116
111
  this.setupResizeObserver();
@@ -118,23 +113,27 @@ export default class IABookActions extends LitElement {
118
113
  }
119
114
 
120
115
  bindAutoRenewEvent() {
121
- // dispatched this event from timer-countdown
116
+ // dispatched this event from timer-countdown
122
117
  this.addEventListener('autoRenewAttempt', async event => {
123
- const isPageFlipped = event.detail.bookPageChange;
118
+ const isPageClick = event.detail.bookPageChange;
124
119
 
125
- this.autoRenewObj = await new OneHourAutoRenew(
126
- isPageFlipped,
120
+ this.autoRenewRes = await new OneHourAutoRenew(
121
+ isPageClick,
127
122
  this.identifier,
128
123
  this.localCache,
129
124
  this.autoRenewConfig,
130
- this.lendingStatus.user_has_browsed && !this.lendingStatus.browsingExpired
125
+ this.lendingStatus.user_has_browsed &&
126
+ !this.lendingStatus.browsingExpired
131
127
  );
128
+ console.log(this.autoRenewRes);
129
+
130
+ this.toastTexts = this.autoRenewRes.toastTexts;
131
+ this.hideToast = this.autoRenewRes.hideToast;
132
+ this.browseAgainNow = this.autoRenewRes.browseAgainNow;
132
133
 
133
- this.toastTexts = this.autoRenewObj.toastTexts;
134
- this.hideToast = this.autoRenewObj.hideToast;
135
- this.browseAgainNow = this.autoRenewObj.renewNow;
136
134
  if (this.browseAgainNow) {
137
135
  await this.browseHasRenew();
136
+ // this.resetTimerCountdown = true;
138
137
  }
139
138
  });
140
139
  }
@@ -154,15 +153,16 @@ export default class IABookActions extends LitElement {
154
153
 
155
154
  async browseHasRenew() {
156
155
  const loanTime = await this.localCache.get(`${this.identifier}-loanTime`);
157
- const secondsLeft =(loanTime - new Date()) / 1000; // different in seconds
156
+ const secondsLeft = (loanTime - new Date()) / 1000; // different in seconds
158
157
 
159
158
  const currStatus = {
160
159
  ...this.lendingStatus,
161
160
  user_has_browsed: true,
162
161
  browsingExpired: false,
163
- secondsLeftOnLoan: Math.abs(Math.round(secondsLeft)),
162
+ secondsLeftOnLoan: secondsLeft,
164
163
  };
165
164
  this.lendingStatus = currStatus;
165
+ // this.performUpdate()
166
166
 
167
167
  this.startBrowseTimer();
168
168
  }
@@ -293,6 +293,7 @@ export default class IABookActions extends LitElement {
293
293
  }
294
294
 
295
295
  get timerCountdownTemplate() {
296
+ // console.log(this.borrowType, this.remainingTime, this.autoRenewConfig.autoCheckAt, this.resetTimerCountdown);
296
297
  return this.borrowType === 'browsed'
297
298
  ? html`<timer-countdown
298
299
  time=${Number(this.remainingTime)}
@@ -306,7 +307,7 @@ export default class IABookActions extends LitElement {
306
307
  return html`
307
308
  <toast-message
308
309
  .texts=${this.toastTexts}
309
- ?dismisOnClick=${true}
310
+ ?dismisOnClick=${Boolean(true)}
310
311
  ?hideToast=${this.hideToast}
311
312
  ></toast-message>
312
313
  `;
@@ -314,7 +315,7 @@ export default class IABookActions extends LitElement {
314
315
 
315
316
  get bookActionBar() {
316
317
  return html`
317
- <button @click=${() => this.pageFlipEvent()}>Page Flip</button>
318
+ <button @click=${() => this.pageFlipEvent}>Page Flip</button>
318
319
  <collapsible-action-group
319
320
  .userid=${this.userid}
320
321
  .identifier=${this.identifier}
@@ -324,7 +325,7 @@ export default class IABookActions extends LitElement {
324
325
  .width=${this.width}
325
326
  .borrowType=${this.borrowType}
326
327
  .returnUrl=${this.returnUrl}
327
- .autoRenew=${this.autoRenew}
328
+ .localCache=${this.localCache}
328
329
  .autoRenewConfig=${this.autoRenewConfig}
329
330
  ?hasAdminAccess=${this.hasAdminAccess}
330
331
  ?disabled=${this.disableActionGroup}
@@ -339,15 +340,13 @@ export default class IABookActions extends LitElement {
339
340
  }
340
341
 
341
342
  // will move this function to bookreader...
342
- async pageFlipEvent() {
343
- try {
344
- // dispatch event to say book page has flipped
345
- document.querySelector("ia-book-actions").dispatchEvent(
346
- new CustomEvent("autoRenewAttempt", {
347
- detail: { bookPageChange: true },
348
- })
349
- );
350
- } catch (error) { console.log(error) }
343
+ pageFlipEvent() {
344
+ // dispatch event to say book page has flipped
345
+ document.querySelector('ia-book-actions').dispatchEvent(
346
+ new CustomEvent('autoRenewAttempt', {
347
+ detail: { bookPageChange: true },
348
+ })
349
+ );
351
350
  }
352
351
 
353
352
  /**
@@ -516,7 +515,7 @@ export default class IABookActions extends LitElement {
516
515
  }
517
516
 
518
517
  toast-message {
519
- --messageHeightFromTop: 18%;
518
+ --messageHeightFromTop: 14.5%;
520
519
  }
521
520
  `;
522
521
  }
@@ -1,58 +0,0 @@
1
- import { css } from 'lit';
2
-
3
- export default timerCountDownStyle = css`
4
- :host {
5
- right: 5px;
6
- font-size: 14px;
7
- position: absolute;
8
- }
9
- #countdown1 {
10
- position: relative;
11
- margin: auto;
12
- margin-top: 100px;
13
- height: 40px;
14
- width: 40px;
15
- text-align: center;
16
- }
17
-
18
- #countdown-number {
19
- color: white;
20
- display: inline-block;
21
- line-height: 40px;
22
- margin-right: 12px;
23
- }
24
-
25
- svg {
26
- position: absolute;
27
- top: 0;
28
- right: 0;
29
- width: 40px;
30
- height: 40px;
31
- transform: rotateY(-180deg) rotateZ(-90deg);
32
- }
33
-
34
- svg circle {
35
- stroke-dasharray: 113px;
36
- stroke-dashoffset: 0px;
37
- stroke-linecap: round;
38
- stroke-width: 3px;
39
- stroke: white;
40
- fill: none;
41
- animation: countdown 60s linear infinite forwards;
42
- }
43
-
44
- @keyframes countdown {
45
- from {
46
- stroke-dashoffset: 0px;
47
- }
48
- to {
49
- stroke-dashoffset: 113px;
50
- }
51
- }
52
- .hidden {
53
- display: none;
54
- }
55
- .visible {
56
- display: inline-block;
57
- }
58
- `;