@internetarchive/ia-book-actions 1.1.1 → 1.3.0-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
|
@@ -133,9 +133,9 @@ export class CollapsibleActionGroup extends ActionsHandler {
|
|
|
133
133
|
return html`
|
|
134
134
|
<div
|
|
135
135
|
class="${classMap({
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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>
|
|
@@ -280,9 +280,9 @@ export class CollapsibleActionGroup extends ActionsHandler {
|
|
|
280
280
|
get getLoaderIcon() {
|
|
281
281
|
return html`<img
|
|
282
282
|
class="${classMap({
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
actionloader: true,
|
|
284
|
+
disabled: this.disabled,
|
|
285
|
+
})}"
|
|
286
286
|
alt=""
|
|
287
287
|
src="${this.loaderIcon}"
|
|
288
288
|
/>`;
|
|
@@ -116,6 +116,8 @@ export default class ActionsHandler extends LitElement {
|
|
|
116
116
|
const { category, action } = detail.event;
|
|
117
117
|
this.loanAnanlytics?.sendEvent(category, action, this.identifier);
|
|
118
118
|
|
|
119
|
+
this.setStickyAdminAccess(true);
|
|
120
|
+
|
|
119
121
|
// keep existing params and add new one
|
|
120
122
|
const url = new URL(window.location.href);
|
|
121
123
|
url.searchParams.append('admin', 1);
|
|
@@ -125,6 +127,8 @@ export default class ActionsHandler extends LitElement {
|
|
|
125
127
|
this.addEventListener('exitAdminAccess', ({ detail }) => {
|
|
126
128
|
const { category, action } = detail.event;
|
|
127
129
|
this.loanAnanlytics?.sendEvent(category, action, this.identifier);
|
|
130
|
+
|
|
131
|
+
this.setStickyAdminAccess(false);
|
|
128
132
|
});
|
|
129
133
|
|
|
130
134
|
this.addEventListener('bookTitleBar', ({ detail }) => {
|
|
@@ -372,4 +376,16 @@ export default class ActionsHandler extends LitElement {
|
|
|
372
376
|
'.archive.org'
|
|
373
377
|
);
|
|
374
378
|
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Set sticky admin access on or off.
|
|
382
|
+
* @see WEBDEV-6835
|
|
383
|
+
*
|
|
384
|
+
* @param {boolean} value - Whether to enable or disable sticky admin access.
|
|
385
|
+
* @returns {void}
|
|
386
|
+
*/
|
|
387
|
+
setStickyAdminAccess(value) {
|
|
388
|
+
const domain = window.location.hostname === 'localhost' ? 'localhost' : '.archive.org';
|
|
389
|
+
Cookies.setItem('sticky-admin-access', value, '', '/', domain);
|
|
390
|
+
}
|
|
375
391
|
}
|
|
@@ -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
|
},
|
|
@@ -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
|
];
|