@internetarchive/ia-book-actions 1.3.0 → 1.4.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
|
@@ -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
|
}
|