@internetarchive/ia-book-actions 0.0.26 → 0.0.27-a1

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
@@ -174,10 +174,8 @@
174
174
  document.querySelectorAll('.printDisabled input[type=checkbox]').forEach((item) => {
175
175
  item.addEventListener('click', (e) => {
176
176
  if (e.target.checked) {
177
- if (e.target.value === 'is_printdisabled') lendingStatus1.is_printdisabled = true;
178
177
  if (e.target.value === 'user_is_printdisabled') lendingStatus1.user_is_printdisabled = true;
179
178
  } else {
180
- if (e.target.value === 'is_printdisabled') lendingStatus1.is_printdisabled = false;
181
179
  if (e.target.value === 'user_is_printdisabled') lendingStatus1.user_is_printdisabled = false;
182
180
  }
183
181
 
@@ -279,7 +277,6 @@
279
277
  <label><input type="checkbox" name="user" value="isLoggedIn" />isLoggedIn</label>
280
278
  </td>
281
279
  <td class="printDisabled">
282
- <label><input type="checkbox" name="is_printdisabled" value="is_printdisabled" />is_printdisabled</label>
283
280
  <label><input type="checkbox" name="user_is_printdisabled" value="user_is_printdisabled" />user_is_printdisabled</label>
284
281
  </td>
285
282
  <td class="availableToBrowse">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.26",
3
+ "version": "0.0.27-a1",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -146,9 +146,17 @@ export class GetLendingActions {
146
146
  }
147
147
 
148
148
  borrowPrintDisabledAction() {
149
+ const lendingStatus = this.lendingStatus || {};
150
+ const browsingHasExpired =
151
+ !lendingStatus.available_to_browse && lendingStatus.browsingExpired;
152
+
153
+ // one hour borrow config
154
+ const oneHrBorrow = browsingHasExpired
155
+ ? this.actionsConfig.browseAgainConfig()
156
+ : this.actionsConfig.firstBrowseConfig();
149
157
  return {
150
158
  primaryTitle: bookTitles.eligible_pd,
151
- primaryActions: [this.actionsConfig.borrowBookConfig()],
159
+ primaryActions: [oneHrBorrow, this.actionsConfig.borrowBookConfig()],
152
160
  primaryColor: 'primary',
153
161
  secondaryActions: [
154
162
  this.actionsConfig.adminAccessConfig(),
@@ -401,8 +409,7 @@ export class GetLendingActions {
401
409
  const notBorrowable =
402
410
  !lendingStatus.available_to_borrow && !lendingStatus.available_to_browse;
403
411
 
404
- const userCanAccessPrintDisabled =
405
- lendingStatus.is_printdisabled && lendingStatus.user_is_printdisabled;
412
+ const userCanAccessPrintDisabled = lendingStatus.user_is_printdisabled;
406
413
 
407
414
  const canBorrow =
408
415
  (lendingStatus.available_to_browse ||