@internetarchive/ia-book-actions 0.0.27-a1 → 0.0.28
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,8 +174,10 @@
|
|
|
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;
|
|
177
178
|
if (e.target.value === 'user_is_printdisabled') lendingStatus1.user_is_printdisabled = true;
|
|
178
179
|
} else {
|
|
180
|
+
if (e.target.value === 'is_printdisabled') lendingStatus1.is_printdisabled = false;
|
|
179
181
|
if (e.target.value === 'user_is_printdisabled') lendingStatus1.user_is_printdisabled = false;
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -277,6 +279,7 @@
|
|
|
277
279
|
<label><input type="checkbox" name="user" value="isLoggedIn" />isLoggedIn</label>
|
|
278
280
|
</td>
|
|
279
281
|
<td class="printDisabled">
|
|
282
|
+
<label><input type="checkbox" name="is_printdisabled" value="is_printdisabled" />is_printdisabled</label>
|
|
280
283
|
<label><input type="checkbox" name="user_is_printdisabled" value="user_is_printdisabled" />user_is_printdisabled</label>
|
|
281
284
|
</td>
|
|
282
285
|
<td class="availableToBrowse">
|
package/package.json
CHANGED
|
@@ -146,17 +146,9 @@ 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();
|
|
157
149
|
return {
|
|
158
150
|
primaryTitle: bookTitles.eligible_pd,
|
|
159
|
-
primaryActions: [
|
|
151
|
+
primaryActions: [this.actionsConfig.borrowBookConfig()],
|
|
160
152
|
primaryColor: 'primary',
|
|
161
153
|
secondaryActions: [
|
|
162
154
|
this.actionsConfig.adminAccessConfig(),
|
|
@@ -409,7 +401,8 @@ export class GetLendingActions {
|
|
|
409
401
|
const notBorrowable =
|
|
410
402
|
!lendingStatus.available_to_borrow && !lendingStatus.available_to_browse;
|
|
411
403
|
|
|
412
|
-
const userCanAccessPrintDisabled =
|
|
404
|
+
const userCanAccessPrintDisabled =
|
|
405
|
+
lendingStatus.is_printdisabled && lendingStatus.user_is_printdisabled;
|
|
413
406
|
|
|
414
407
|
const canBorrow =
|
|
415
408
|
(lendingStatus.available_to_browse ||
|
|
@@ -21,9 +21,14 @@ export class LoanTokenPoller {
|
|
|
21
21
|
disconnectedInterval() {
|
|
22
22
|
clearInterval(this.loanTokenInterval);
|
|
23
23
|
this.loanTokenInterval = undefined;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
// temporary disabling sentry notice
|
|
26
|
+
// as message is informational, not critical nor an error.
|
|
27
|
+
// also, as of 11/28/2022, JS build maps are not working properly on petabox
|
|
28
|
+
// and as a result, this comment is not properly grouped.
|
|
29
|
+
// if (window.Sentry) {
|
|
30
|
+
// window?.Sentry?.captureMessage('loan token interval cleared');
|
|
31
|
+
// }
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
async enableBookAccess() {
|
|
@@ -83,7 +88,10 @@ export class LoanTokenPoller {
|
|
|
83
88
|
identifier: this.identifier,
|
|
84
89
|
action,
|
|
85
90
|
error: data => {
|
|
86
|
-
window?.Sentry?.captureMessage(
|
|
91
|
+
window?.Sentry?.captureMessage(
|
|
92
|
+
'handleLoanTokenPoller error',
|
|
93
|
+
JSON.stringify(data)
|
|
94
|
+
);
|
|
87
95
|
this.disconnectedInterval(); // stop token fetch api
|
|
88
96
|
this.errorCallback({ detail: { action, data } });
|
|
89
97
|
// send LendingServiceError to GA
|