@internetarchive/ia-book-actions 0.1.5-b2 → 0.1.6
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
|
@@ -132,10 +132,10 @@
|
|
|
132
132
|
iaBookActions.localCache = localCache;
|
|
133
133
|
|
|
134
134
|
let loanTotalTime2Min = { loanTotalTime: 10, loanRenewAtLast: 5, pageChangedInLast: 5 };
|
|
135
|
-
let loanTotalTime5Min = { loanTotalTime: 300, loanRenewAtLast:
|
|
135
|
+
let loanTotalTime5Min = { loanTotalTime: 300, loanRenewAtLast: 180, pageChangedInLast: 15 };
|
|
136
136
|
let loanTotalTime1Hour = { loanTotalTime: 3600, loanRenewAtLast: 600, pageChangedInLast: 900 };
|
|
137
137
|
|
|
138
|
-
iaBookActions.loanRenewTimeConfig =
|
|
138
|
+
iaBookActions.loanRenewTimeConfig = loanTotalTime2Min;
|
|
139
139
|
|
|
140
140
|
let lendingStatus1 = iaBookActions.lendingStatus;
|
|
141
141
|
let secondsLeftOnLoan = iaBookActions.loanRenewTimeConfig.loanTotalTime;
|
package/package.json
CHANGED
|
@@ -144,14 +144,14 @@ export default class LoanAnanlytics {
|
|
|
144
144
|
* @memberof LoanAnanlytics
|
|
145
145
|
*/
|
|
146
146
|
sendEvent(eventCategory, eventAction, label, extraParams) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
console.log(
|
|
148
|
+
'eventCategory:-',
|
|
149
|
+
eventCategory,
|
|
150
|
+
'\t||\teventAction:-',
|
|
151
|
+
eventAction,
|
|
152
|
+
'\t||\tlabel:-',
|
|
153
|
+
label
|
|
154
|
+
);
|
|
155
155
|
|
|
156
156
|
window?.archive_analytics?.send_event_no_sampling(
|
|
157
157
|
eventCategory,
|
|
@@ -126,13 +126,6 @@ export class LoanRenewHelper {
|
|
|
126
126
|
// convert time from second to minute
|
|
127
127
|
timeLeft = Math.ceil(timeLeft / 60);
|
|
128
128
|
|
|
129
|
-
/**
|
|
130
|
-
* reduce 1 min from the auto return warning texts
|
|
131
|
-
* to compensate for the 50 second buffer we’ve introduced to handle the race condition
|
|
132
|
-
* @see IABookActions:loanRenew addEventListener
|
|
133
|
-
*/
|
|
134
|
-
if (timeLeft > 1) timeLeft = timeLeft - 1;
|
|
135
|
-
|
|
136
129
|
// convert time from minute to hour
|
|
137
130
|
if (timeLeft > 59) {
|
|
138
131
|
timeLeft = 1; // 1 hour
|
|
@@ -2,7 +2,11 @@ import { html, fixture, expect, aTimeout } from '@open-wc/testing';
|
|
|
2
2
|
import '../../src/ia-book-actions.js';
|
|
3
3
|
import '../../src/components/timer-countdown.js';
|
|
4
4
|
|
|
5
|
-
const container = ({
|
|
5
|
+
const container = ({
|
|
6
|
+
secondsLeftOnLoan,
|
|
7
|
+
loanTotalTime,
|
|
8
|
+
loanRenewAtLast,
|
|
9
|
+
} = {}) =>
|
|
6
10
|
html`<timer-countdown
|
|
7
11
|
.secondsLeftOnLoan=${secondsLeftOnLoan}
|
|
8
12
|
.loanTotalTime=${loanTotalTime}
|
|
@@ -20,7 +24,7 @@ describe('<timer-countdown>', () => {
|
|
|
20
24
|
);
|
|
21
25
|
|
|
22
26
|
await el.updateComplete;
|
|
23
|
-
// expect(
|
|
27
|
+
// expect(window.IALendingIntervals.timerCountdown).to.be.undefined;
|
|
24
28
|
});
|
|
25
29
|
|
|
26
30
|
it('timer interval is not undefined when loan is active', async () => {
|
|
@@ -36,6 +40,6 @@ describe('<timer-countdown>', () => {
|
|
|
36
40
|
await el.updateComplete;
|
|
37
41
|
|
|
38
42
|
expect(el.secondsLeftOnLoan).to.equal(2);
|
|
39
|
-
// expect(el.
|
|
43
|
+
// expect(el.timerCountdown).to.not.be.undefined;
|
|
40
44
|
});
|
|
41
45
|
});
|
|
@@ -79,9 +79,8 @@ describe('Loan Renew Determine', () => {
|
|
|
79
79
|
'65' // in seconds
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
-
// we will get 1 min remaining since, we reduced 1 min from remaining time
|
|
83
82
|
expect(toastMsg).to.be.equal(
|
|
84
|
-
'This book will be automatically returned in
|
|
83
|
+
'This book will be automatically returned in 2 minutes unless you turn a page.'
|
|
85
84
|
);
|
|
86
85
|
});
|
|
87
86
|
});
|