@internetarchive/ia-book-actions 1.1.1 → 1.2.0

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": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -133,9 +133,9 @@ export class CollapsibleActionGroup extends ActionsHandler {
133
133
  return html`
134
134
  <div
135
135
  class="${classMap({
136
- actiongroup: true,
137
- disabled: this.disabled,
138
- })}"
136
+ actiongroup: true,
137
+ disabled: this.disabled,
138
+ })}"
139
139
  >
140
140
  ${this.getLoaderIcon}
141
141
  <section class="action-buttons primary">
@@ -194,12 +194,12 @@ export class CollapsibleActionGroup extends ActionsHandler {
194
194
  href="${action.url}"
195
195
  target=${action.target}
196
196
  @click=${() => {
197
- this.clickHandler(
198
- action.id,
199
- action.analyticsEvent,
200
- action?.borrowType
201
- );
202
- }}
197
+ this.clickHandler(
198
+ action.id,
199
+ action.analyticsEvent,
200
+ action?.borrowType
201
+ );
202
+ }}
203
203
  >
204
204
  ${action.id === 'purchaseBook' ? purchaseIcon : ''} ${action.text}
205
205
  <small>${action.subText}</small>
@@ -266,7 +266,6 @@ export class CollapsibleActionGroup extends ActionsHandler {
266
266
 
267
267
  get getPrimaryItems() {
268
268
  return this.primaryActions
269
- .slice(1)
270
269
  .map(
271
270
  action =>
272
271
  html`<li>${this.renderActionButton(action, this.initialButton)}</li>`
@@ -280,9 +279,9 @@ export class CollapsibleActionGroup extends ActionsHandler {
280
279
  get getLoaderIcon() {
281
280
  return html`<img
282
281
  class="${classMap({
283
- actionloader: true,
284
- disabled: this.disabled,
285
- })}"
282
+ actionloader: true,
283
+ disabled: this.disabled,
284
+ })}"
286
285
  alt=""
287
286
  src="${this.loaderIcon}"
288
287
  />`;
@@ -25,7 +25,7 @@ describe('Get Lending Actions', () => {
25
25
 
26
26
  expect(actions.primaryTitle).to.equal(bookTitles.available_1hr);
27
27
  expect(actions.primaryActions.length).to.equal(3);
28
- expect(actions.primaryActions[0].text).to.equal('Borrow');
28
+ expect(actions.primaryActions[0].text).to.equal('Borrow (auto-renewing)');
29
29
  expect(actions.primaryActions[1].text).to.equal('Borrow for 14 days');
30
30
  expect(actions.secondaryActions[1].text).to.equal('Purchase at ');
31
31
  });
@@ -111,7 +111,7 @@ describe('Get Lending Actions', () => {
111
111
  expect(actions.primaryTitle).to.equal(bookTitles.claim_waitlist);
112
112
  expect(actions.primaryActions.length).to.equal(3);
113
113
  expect(actions.primaryActions[0].text).to.equal('Borrow for 14 days');
114
- expect(actions.primaryActions[1].text).to.equal('Borrow');
114
+ expect(actions.primaryActions[1].text).to.equal('Borrow (auto-renewing)');
115
115
  expect(actions.primaryActions[2].text).to.equal('Leave Waitlist');
116
116
  expect(spy.called).to.be.true;
117
117
  });
@@ -138,7 +138,7 @@ describe('Get Lending Actions', () => {
138
138
  expect(actions.primaryTitle).to.equal(bookTitles.on_waitlist);
139
139
  expect(actions.primaryActions.length).to.equal(2);
140
140
  expect(actions.primaryActions[0].text).to.equal('Leave Waitlist');
141
- expect(actions.primaryActions[1].text).to.equal('Borrow');
141
+ expect(actions.primaryActions[1].text).to.equal('Borrow (auto-renewing)');
142
142
  expect(claimSpy.called).to.be.false;
143
143
  expect(waitlistSpy.called).to.be.true;
144
144
  });
@@ -162,7 +162,7 @@ describe('Get Lending Actions', () => {
162
162
  expect(actions.primaryTitle).to.equal(bookTitles.on_waitlist);
163
163
  expect(actions.primaryActions.length).to.equal(2);
164
164
  expect(actions.primaryActions[0].text).to.equal('Leave Waitlist');
165
- expect(actions.primaryActions[1].text).to.equal('Borrow');
165
+ expect(actions.primaryActions[1].text).to.equal('Borrow (auto-renewing)');
166
166
  expect(waitlistSpy.called).to.be.true;
167
167
  });
168
168
  });
@@ -149,12 +149,12 @@ describe('Primary Actions data', () => {
149
149
  const expectedPrimaryActions = [
150
150
  {
151
151
  text: 'Borrow', // changed from 'Borrow for 1 hour'
152
- callback: () => {},
152
+ callback: () => { },
153
153
  className: 'ia-button primary',
154
154
  },
155
155
  {
156
156
  text: 'Borrow for 14 days',
157
- callback: () => {},
157
+ callback: () => { },
158
158
  className: 'ia-button primary',
159
159
  disabled: false,
160
160
  },
@@ -228,7 +228,7 @@ describe('Borrow status actions', () => {
228
228
 
229
229
  // removed available_to_borrow from lending bar
230
230
  expect(el.lendingStatus.available_to_borrow).to.be.false;
231
- expect(el.primaryActions[0].text).to.equal('Borrow');
231
+ expect(el.primaryActions[0].text).to.equal('Borrow (auto-renewing)');
232
232
  });
233
233
 
234
234
  it('Check action for borrowable book without user', async () => {
@@ -244,7 +244,7 @@ describe('Borrow status actions', () => {
244
244
  const expectedPrimaryActions = [
245
245
  {
246
246
  text: 'Log In and Borrow',
247
- callback: () => {},
247
+ callback: () => { },
248
248
  className: 'ia-button danger',
249
249
  },
250
250
  ];