@internetarchive/ia-book-actions 0.1.11-b33 → 0.1.11-b35
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 +25 -1
- package/package.json +1 -1
- package/src/ia-book-actions.js +1 -0
package/demo/index.html
CHANGED
|
@@ -242,12 +242,32 @@
|
|
|
242
242
|
});
|
|
243
243
|
});
|
|
244
244
|
|
|
245
|
-
document.querySelector('#show_warning_modal').addEventListener('click', () => {
|
|
245
|
+
document.querySelector('#show_warning_modal').addEventListener('click', async () => {
|
|
246
|
+
if (!iaBookActions.lendingStatus.user_has_browsed) {
|
|
247
|
+
const newLendingStatus = { ...iaBookActions.lendingStatus, user_has_browsed: true };
|
|
248
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
249
|
+
iaBookActions.lendingStatus = newLendingStatus;
|
|
250
|
+
await iaBookActions.updateComplete;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
iaBookActions.showWarningModal();
|
|
254
|
+
|
|
246
255
|
if (iaBookActions.lendingStatus.user_has_browsed) {
|
|
247
256
|
iaBookActions.showWarningModal();
|
|
248
257
|
}
|
|
249
258
|
});
|
|
250
259
|
|
|
260
|
+
document.querySelector('#show_expired_modal').addEventListener('click', async () => {
|
|
261
|
+
if (!iaBookActions.lendingStatus.user_has_browsed) {
|
|
262
|
+
const newLendingStatus = { ...iaBookActions.lendingStatus, user_has_browsed: true };
|
|
263
|
+
iaBookActions.lendingStatus = newLendingStatus;
|
|
264
|
+
await iaBookActions.updateComplete;
|
|
265
|
+
}
|
|
266
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
267
|
+
|
|
268
|
+
iaBookActions.browseHasExpired();
|
|
269
|
+
});
|
|
270
|
+
|
|
251
271
|
document.querySelectorAll('.availableToBorrow input[type=radio]').forEach((item) => {
|
|
252
272
|
item.addEventListener('click', (e) => {
|
|
253
273
|
if (e.target.value === 'available_to_borrow') {
|
|
@@ -343,6 +363,10 @@
|
|
|
343
363
|
<div>
|
|
344
364
|
<button id="show_warning_modal">When Browsing (`user_has_browsed`), show Warning Modal</button>
|
|
345
365
|
</div>
|
|
366
|
+
<div>
|
|
367
|
+
<button id="show_expired_modal">While Browsing (`user_has_browsed`), Expire book & show its modal</button>
|
|
368
|
+
how_expired_modal
|
|
369
|
+
</div>
|
|
346
370
|
</td>
|
|
347
371
|
<td class="availableToBorrow">
|
|
348
372
|
<label><input type="radio" name="borrow" value="available_to_borrow" />available_to_borrow</label>
|
package/package.json
CHANGED
package/src/ia-book-actions.js
CHANGED
|
@@ -6,6 +6,7 @@ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
|
6
6
|
import { ModalConfig } from '@internetarchive/modal-manager';
|
|
7
7
|
import { ToastConfig } from '@internetarchive/toast-manager';
|
|
8
8
|
import { LocalCache } from '@internetarchive/local-cache';
|
|
9
|
+
import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
|
|
9
10
|
|
|
10
11
|
import './components/collapsible-action-group.js';
|
|
11
12
|
import './components/book-title-bar.js';
|