@internetarchive/ia-book-actions 0.0.20 → 0.0.22-1-alpha1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.20",
3
+ "version": "0.0.22-1-alpha1",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@internetarchive/icon-info": "^1.2.6",
22
22
  "@internetarchive/local-cache": "^0.2.0",
23
- "@internetarchive/modal-manager": "^0.1.0",
23
+ "@internetarchive/modal-manager": "^0.2.1",
24
24
  "@internetarchive/shared-resize-observer": "^0.2.0",
25
25
  "lit": "^2.2.1"
26
26
  },
@@ -8,6 +8,7 @@ export class URLHelper {
8
8
  try {
9
9
  return window.self !== window.top;
10
10
  } catch (e) {
11
+ window?.Sentry?.captureException(e);
11
12
  return true;
12
13
  }
13
14
  }
@@ -64,5 +64,7 @@ export default async function ActionsHandlerService(options) {
64
64
  option?.error(data);
65
65
  }
66
66
  });
67
- } catch (err) {}
67
+ } catch (err) {
68
+ window?.Sentry?.captureException(err);
69
+ }
68
70
  }
@@ -258,6 +258,7 @@ export default class ActionsHandler extends LitElement {
258
258
  // set new value
259
259
  Cookies.setItem(storageKey, newCount, date, '/');
260
260
  } catch (error) {
261
+ window?.Sentry?.captureException(error);
261
262
  this.sendEvent('Cookies-Error-Actions', error);
262
263
  }
263
264
  }
@@ -86,6 +86,7 @@ export class GetLendingActions {
86
86
  primaryTitle: '',
87
87
  primaryActions: [],
88
88
  secondaryActions: [this.actionsConfig.adminOrPrintDisabledExitConfig()],
89
+ borrowType: 'adminBorrowed',
89
90
  };
90
91
  }
91
92
 
@@ -21,6 +21,9 @@ export class LoanTokenPoller {
21
21
  disconnectedInterval() {
22
22
  clearInterval(this.loanTokenInterval);
23
23
  this.loanTokenInterval = undefined;
24
+ if (window.Sentry) {
25
+ window?.Sentry?.captureMessage('loan token interval cleared');
26
+ }
24
27
  }
25
28
 
26
29
  async enableBookAccess() {
@@ -35,6 +38,7 @@ export class LoanTokenPoller {
35
38
  );
36
39
  consecutiveLoanCounts = existingCount ?? 1;
37
40
  } catch (error) {
41
+ window?.Sentry?.captureException(error);
38
42
  this.sendEvent('Cookies-Error-Token', error);
39
43
  }
40
44
  }
@@ -42,6 +46,9 @@ export class LoanTokenPoller {
42
46
  // Do an initial token, then set an interval
43
47
  this.handleLoanTokenPoller(true);
44
48
 
49
+ // if `this.borrowType` = adminBorrowed, early return
50
+ if (this.borrowType === 'adminBorrowed') return;
51
+
45
52
  this.loanTokenInterval = setInterval(() => {
46
53
  this.handleLoanTokenPoller();
47
54
  }, this.pollerDelay);
@@ -54,6 +61,7 @@ export class LoanTokenPoller {
54
61
 
55
62
  this.sendEvent(category, action);
56
63
  } else {
64
+ window?.Sentry?.captureMessage('enableBookAccess error');
57
65
  // if book is not browsed, just clear token polling interval
58
66
  this.disconnectedInterval(); // stop token fetch api
59
67
  }
@@ -75,6 +83,7 @@ export class LoanTokenPoller {
75
83
  identifier: this.identifier,
76
84
  action,
77
85
  error: data => {
86
+ window?.Sentry?.captureMessage('handleLoanTokenPoller error');
78
87
  this.disconnectedInterval(); // stop token fetch api
79
88
  this.errorCallback({ detail: { action, data } });
80
89
  },
@@ -66,6 +66,8 @@ export default class IABookActions extends LitElement {
66
66
  }
67
67
 
68
68
  disconnectedCallback() {
69
+ this.tokenPoller?.disconnectedInterval();
70
+ window?.Sentry?.captureMessage('disconnectedCallback');
69
71
  this.disconnectResizeObserver();
70
72
  }
71
73
 
@@ -167,6 +169,7 @@ export default class IABookActions extends LitElement {
167
169
  'browsingExpired' in this.lendingStatus &&
168
170
  this.lendingStatus?.browsingExpired;
169
171
  if (hasExpired) {
172
+ window?.Sentry?.captureMessage('setupLendingToolbarActions hasExpired');
170
173
  this.tokenPoller?.disconnectedInterval();
171
174
  /** Global event - always fire */
172
175
  this.dispatchEvent(
@@ -239,6 +242,7 @@ export default class IABookActions extends LitElement {
239
242
  */
240
243
  startLoanTokenPoller() {
241
244
  if (this.tokenPoller) {
245
+ window?.Sentry?.captureMessage('startLoanTokenPoller clearing interval');
242
246
  this.tokenPoller.disconnectedInterval();
243
247
  }
244
248
  const successCallback = () => {