@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.1.11-b33",
3
+ "version": "0.1.11-b35",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -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';