@internetarchive/ia-book-actions 0.0.15 → 0.0.16
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
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
iaBookActions.modalConfig = modalConfig;
|
|
120
120
|
iaBookActions.lendingBarPostInit = lendingBarPostInit;
|
|
121
121
|
iaBookActions.tokenDelay = 2000; // 2 seconds
|
|
122
|
+
iaBookActions.returnUrl = 'https://openlibrary.org';
|
|
122
123
|
|
|
123
124
|
let lendingStatus1 = iaBookActions.lendingStatus;
|
|
124
125
|
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export class CollapsibleActionGroup extends ActionsHandler {
|
|
|
27
27
|
hasAdminAccess: { type: Boolean },
|
|
28
28
|
dropdownArrow: { type: String },
|
|
29
29
|
disabled: { type: Boolean },
|
|
30
|
+
returnUrl: { type: String },
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -45,6 +46,7 @@ export class CollapsibleActionGroup extends ActionsHandler {
|
|
|
45
46
|
this.title = '';
|
|
46
47
|
this.loaderIcon = 'https://archive.org/upload/images/tree/loading.gif';
|
|
47
48
|
this.disabled = false;
|
|
49
|
+
this.returnUrl = '';
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
updated(changed) {
|
|
@@ -13,11 +13,18 @@ import * as Cookies from '../doc-cookies.js';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
export default class ActionsHandler extends LitElement {
|
|
16
|
+
static properties() {
|
|
17
|
+
return {
|
|
18
|
+
returnUrl: { type: String },
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
constructor(identifier) {
|
|
17
23
|
super();
|
|
18
24
|
this.identifier = identifier;
|
|
19
25
|
this.ajaxTimeout = 6000;
|
|
20
26
|
this.bindEvents();
|
|
27
|
+
this.returnUrl = '';
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
sendEvent(eventCategory, eventAction) {
|
|
@@ -121,7 +128,7 @@ export default class ActionsHandler extends LitElement {
|
|
|
121
128
|
identifier: this.identifier,
|
|
122
129
|
success: () => {
|
|
123
130
|
this.deleteLoanCookies();
|
|
124
|
-
URLHelper.goToUrl(
|
|
131
|
+
URLHelper.goToUrl(this.returnUrl, true);
|
|
125
132
|
},
|
|
126
133
|
error: data => {
|
|
127
134
|
this.dispatchActionError(action, data);
|
package/src/ia-book-actions.js
CHANGED
|
@@ -24,6 +24,7 @@ export default class IABookActions extends LitElement {
|
|
|
24
24
|
identifier: { type: String },
|
|
25
25
|
bookTitle: { type: String },
|
|
26
26
|
lendingStatus: { type: Object },
|
|
27
|
+
returnUrl: { type: String },
|
|
27
28
|
width: { type: Number },
|
|
28
29
|
bwbPurchaseUrl: { type: String },
|
|
29
30
|
lendingBarPostInit: {
|
|
@@ -43,6 +44,7 @@ export default class IABookActions extends LitElement {
|
|
|
43
44
|
this.userid = '';
|
|
44
45
|
this.identifier = '';
|
|
45
46
|
this.bookTitle = '';
|
|
47
|
+
this.returnUrl = '';
|
|
46
48
|
this.lendingStatus = {};
|
|
47
49
|
this.width = 0;
|
|
48
50
|
this.bwbPurchaseUrl = '';
|
|
@@ -221,6 +223,7 @@ export default class IABookActions extends LitElement {
|
|
|
221
223
|
.secondaryActions=${this.secondaryActions}
|
|
222
224
|
.width=${this.width}
|
|
223
225
|
.borrowType=${this.borrowType}
|
|
226
|
+
.returnUrl=${this.returnUrl}
|
|
224
227
|
?hasAdminAccess=${this.hasAdminAccess}
|
|
225
228
|
?disabled=${this.disableActionGroup}
|
|
226
229
|
@lendingActionError=${this.handleLendingActionError}
|
|
@@ -29,6 +29,7 @@ const container = ({
|
|
|
29
29
|
.primaryActions=${primaryActions}
|
|
30
30
|
.secondaryActions=${secondaryActions}
|
|
31
31
|
.borrowType=${borrowType}
|
|
32
|
+
.returnUrl=${'https://openlibrary.org'}
|
|
32
33
|
></collapsible-action-group>`;
|
|
33
34
|
|
|
34
35
|
describe('<collapsible-action-group>', () => {
|
|
@@ -83,4 +84,8 @@ describe('<collapsible-action-group>', () => {
|
|
|
83
84
|
expect(eAnalytics.category).to.equal('Lending');
|
|
84
85
|
expect(eAnalytics.action).to.equal('Browse');
|
|
85
86
|
});
|
|
87
|
+
it('receives `loanUrl`', async () => {
|
|
88
|
+
const el = await fixture(container());
|
|
89
|
+
expect(el.returnUrl).to.equal('https://openlibrary.org');
|
|
90
|
+
});
|
|
86
91
|
});
|