@internetarchive/ia-book-actions 0.0.22-2 → 0.0.22-3

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.22-2",
3
+ "version": "0.0.22-3",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@internetarchive/icon-info": "^1.2.6",
22
22
  "@internetarchive/local-cache": "^0.2.0",
23
- "@internetarchive/modal-manager": "^0.2.1",
23
+ "@internetarchive/modal-manager": "^0.2.2",
24
24
  "@internetarchive/shared-resize-observer": "^0.2.0",
25
- "lit": "^2.2.1"
25
+ "lit": "^2.2.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@open-wc/eslint-config": "^4.2.0",
@@ -14,15 +14,18 @@ export default css`
14
14
  align-items: center;
15
15
  }
16
16
  .action-buttons .ia-button {
17
- margin: 0;
17
+ display: inline-flex;
18
+ align-items: center;
19
+ vertical-align: middle;
18
20
  height: 3.5rem;
21
+ transition: all 0.1s ease 0s;
22
+ vertical-align: middle;
23
+ padding: 0 1rem;
24
+ margin: 0 3px;
19
25
  }
20
26
  .primary,
21
27
  .secondary {
22
28
  position: relative;
23
- background-color: var(--white, #fff);
24
- border-radius: 5px;
25
- margin: 0 3px;
26
29
  }
27
30
  .primary .initial {
28
31
  border-radius: 0.4rem 0 0 0.4rem;
@@ -48,9 +51,9 @@ export default css`
48
51
  }
49
52
  .dropdown-content .ia-button {
50
53
  background: none;
51
- color: var(--primaryTextColor, #fff);
52
54
  border: none;
53
55
  box-sizing: border-box;
56
+ display: block;
54
57
  width: 100%;
55
58
  text-align: left;
56
59
  height: 3rem;
@@ -58,9 +61,6 @@ export default css`
58
61
  padding: 0.6rem 1.2rem;
59
62
  margin: 0;
60
63
  }
61
- .dropdown-content .ia-button:is(:focus-visible, :hover) {
62
- background: unset;
63
- }
64
64
  .dropdown-content li .ia-button {
65
65
  border-radius: 0;
66
66
  }
@@ -115,9 +115,6 @@ export default css`
115
115
  display: inline-block;
116
116
  vertical-align: middle;
117
117
  }
118
- .secondary .ia-button.exit-admin {
119
- background-color: var(--primaryBGColor);
120
- }
121
118
  .purchase small {
122
119
  display: block;
123
120
  font-size: 1rem;
@@ -3,88 +3,63 @@ import { css } from 'lit';
3
3
  export default css`
4
4
  .ia-button {
5
5
  min-height: 3rem;
6
+ border: none;
7
+ outline: none;
6
8
  cursor: pointer;
7
- color: var(--primaryTextColor, #fff);
9
+ color: #fff;
8
10
  line-height: normal;
9
11
  border-radius: 0.4rem;
12
+ text-align: center;
13
+ vertical-align: middle;
10
14
  font-size: 1.4rem;
11
15
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
16
+ display: inline-block;
17
+ padding: 0.85rem 1.2rem;
12
18
  border: 1px solid transparent;
13
19
  white-space: nowrap;
14
20
  appearance: auto;
15
21
  box-sizing: border-box;
16
- display: flex;
17
- align-items: center;
18
- transition: all 0.1s ease 0s;
19
- vertical-align: middle;
20
- padding: 0 1rem;
21
- outline-color: var(--primaryTextColor, #fff);
22
- outline-offset: -4px;
23
- user-select: none;
24
- text-decoration: none;
25
- width: fit-content;
26
22
  -webkit-user-select: none;
27
23
  -moz-user-select: none;
28
24
  -ms-user-select: none;
29
25
  -o-user-select: none;
26
+ user-select: none;
30
27
  }
31
- .ia-button:focus-visible {
32
- outline-style: double;
33
- }
34
-
35
- .ia-button:disabled {
28
+ .ia-button:disabled,
29
+ .ia-button.disabled {
36
30
  cursor: not-allowed;
37
31
  background-color: var(--primaryDisableCTAFill, #767676);
38
32
  border: 1px solid var(--secondaryCTABorder, #999);
33
+ color: var(--primaryTextColor, #fff);
39
34
  }
40
35
  .ia-button.transparent {
41
36
  background-color: transparent;
42
37
  }
43
38
 
44
- .ia-button.warning {
45
- background-color: #ee8950;
46
- border-color: #ec7939;
39
+ .ia-button.slim {
40
+ padding: 0;
47
41
  }
48
-
49
42
  .ia-button.primary {
50
- background-color: var(--primaryCTAFill, #194880);
43
+ background-color: #194880;
51
44
  border-color: #c5d1df;
52
45
  }
53
- .ia-button.primary:hover {
54
- background-color: rgba(27, 72, 128, 0.9);
55
- }
56
- .ia-button.primary:focus-visible {
57
- background-color: rgba(27, 72, 128, 0.8);
58
- }
59
- .ia-button.primary:active {
60
- background-color: rgba(27, 72, 128, 0.7);
61
- }
62
-
63
- .ia-button.danger {
64
- background-color: var(--primaryErrorCTAFill, #e51c26);
65
- border-color: #d43f3a;
66
- }
67
- .ia-button.danger:hover {
68
- background-color: rgba(229, 28, 38, 0.9);
69
- }
70
- .ia-button.danger:focus-visible {
71
- background-color: rgba(229, 28, 38, 0.8);
72
- }
73
- .ia-button.danger:active {
74
- background-color: rgba(229, 28, 38, 0.7);
75
- }
76
-
77
46
  .ia-button.dark {
78
- background-color: var(--secondaryCTAFill, #333);
47
+ color: #fff;
48
+ background-color: #333;
79
49
  border-color: #979797;
80
50
  }
81
- .ia-button.dark:hover {
82
- background-color: rgba(51, 51, 51, 0.9);
51
+ .ia-button.danger {
52
+ color: #fff;
53
+ background-color: #d9534f;
54
+ border-color: #d43f3a;
83
55
  }
84
- .ia-button.dark:focus-visible {
85
- background-color: rgba(51, 51, 51, 0.8);
56
+ .ia-button.warning {
57
+ color: #fff;
58
+ background-color: #ee8950;
59
+ border-color: #ec7939;
86
60
  }
87
- .ia-button.dark:active {
88
- background-color: rgba(51, 51, 51, 0.7);
61
+ .ia-button.cancel {
62
+ background-color: #e51c26;
63
+ border-color: #f8c6c8;
89
64
  }
90
65
  `;
@@ -50,10 +50,7 @@ export class CollapsibleActionGroup extends ActionsHandler {
50
50
  }
51
51
 
52
52
  updated(changed) {
53
- if (
54
- (changed.has('width') || changed.has('disabled')) &&
55
- this.isBelowTabletContainer
56
- ) {
53
+ if (changed.has('width') && this.isBelowTabletContainer) {
57
54
  this.resetActions();
58
55
  }
59
56
  }
@@ -113,9 +110,6 @@ export class CollapsibleActionGroup extends ActionsHandler {
113
110
  <section class="action-buttons secondary">
114
111
  ${this.renderSecondaryActions}
115
112
  </section>
116
- <section class="action-buttons secondary purchase">
117
- ${this.renderPurchaseAction}
118
- </section>
119
113
  </div>
120
114
  `;
121
115
  }
@@ -153,27 +147,13 @@ export class CollapsibleActionGroup extends ActionsHandler {
153
147
  return this.secondaryActions.map(action => this.renderActionLink(action));
154
148
  }
155
149
 
156
- get renderPurchaseAction() {
157
- if (!this.secondaryActions.length) return nothing;
158
-
159
- if (this.secondaryActions.length === 2) {
160
- return this.renderActionLink(this.secondaryActions[1], true);
161
- }
162
- if (this.secondaryActions[0].id === 'purchaseBook') {
163
- return this.renderActionLink(this.secondaryActions[0], true);
164
- }
165
- return nothing;
166
- }
167
-
168
150
  /**
169
- * Render action as a link for secondary actions like admin, printdisability links.
151
+ * Render action as a link for secondary actions like admin, purchase, printdisability links.
170
152
  * @param { Object } action
171
153
  * @param { Boolean } initialButton
172
154
  * @returns { HTMLElement }
173
155
  */
174
156
  renderActionLink(action, initialButton = false) {
175
- if (!initialButton && action?.id === 'purchaseBook') return nothing; // handle purchase action differerntly
176
-
177
157
  return html`<a
178
158
  class="ia-button ${action.className} ${initialButton ? 'initial' : ''}"
179
159
  href="${action.url}"
@@ -226,7 +226,7 @@ export default class ActionsConfig {
226
226
  text: message,
227
227
  url: URLHelper.getBackHref(),
228
228
  target: '_self',
229
- className: 'exit-admin',
229
+ className: 'ia-button',
230
230
  analyticsEvent: {
231
231
  category: this.analyticsCategories.adminAccess,
232
232
  action: this.analyticsActions.doneBorrowing,
@@ -22,6 +22,8 @@ export default class ActionsHandler extends LitElement {
22
22
  }
23
23
 
24
24
  sendEvent(eventCategory, eventAction) {
25
+ // eslint-disable-next-line no-console
26
+ console?.log('Book action: ', { eventCategory, eventAction });
25
27
  window?.archive_analytics?.send_event_no_sampling(
26
28
  eventCategory,
27
29
  eventAction,
@@ -439,6 +439,8 @@ export class GetLendingActions {
439
439
  lendingActions = this.restrictedAction();
440
440
  }
441
441
 
442
+ // debugging console
443
+ console.log(lendingActions.primaryTitle);
442
444
  return lendingActions;
443
445
  }
444
446
  }
@@ -65,6 +65,8 @@ export class LoanTokenPoller {
65
65
  }
66
66
 
67
67
  sendEvent(eventCategory, eventAction) {
68
+ // eslint-disable-next-line no-console
69
+ console?.log('Book action: ', { eventCategory, eventAction });
68
70
  window?.archive_analytics?.send_event_no_sampling(
69
71
  eventCategory,
70
72
  eventAction,
@@ -81,8 +83,6 @@ export class LoanTokenPoller {
81
83
  window?.Sentry?.captureMessage('handleLoanTokenPoller error');
82
84
  this.disconnectedInterval(); // stop token fetch api
83
85
  this.errorCallback({ detail: { action, data } });
84
- // send LendingServiceError to GA
85
- this.sendEvent('LendingServiceLoanError', action);
86
86
  },
87
87
  success: () => {
88
88
  if (isInitial) this.successCallback();