@internetarchive/ia-book-actions 0.0.30-alpha4 → 0.0.30-alpha5

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.30-alpha4",
3
+ "version": "0.0.30-alpha5",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -83,7 +83,7 @@ export default class ActionsHandler extends LitElement {
83
83
  const { category, action } = detail.event;
84
84
  this.sendEvent(category, action);
85
85
 
86
- this.toggleStickyAdminAccess(true);
86
+ this.setStickyAdminAccess(true);
87
87
 
88
88
  // keep existing params and add new one
89
89
  const url = new URL(window.location.href);
@@ -95,7 +95,7 @@ export default class ActionsHandler extends LitElement {
95
95
  const { category, action } = detail.event;
96
96
  this.sendEvent(category, action);
97
97
 
98
- this.toggleStickyAdminAccess(false);
98
+ this.setStickyAdminAccess(false);
99
99
  });
100
100
 
101
101
  this.addEventListener('bookTitleBar', ({ detail }) => {
@@ -291,13 +291,14 @@ export default class ActionsHandler extends LitElement {
291
291
  }
292
292
 
293
293
  /**
294
- * Toggles sticky admin access on or off.
294
+ * Set sticky admin access on or off.
295
295
  * @see WEBDEV-6835
296
296
  *
297
297
  * @param {boolean} value - Whether to enable or disable sticky admin access.
298
298
  * @returns {void}
299
299
  */
300
- toggleStickyAdminAccess(value) {
301
- Cookies.setItem('sticky-admin-access', value);
300
+ setStickyAdminAccess(value) {
301
+ const domain = window.location.hostname !== 'localhost' ?? '.archive.org';
302
+ Cookies.setItem('sticky-admin-access', value, '', '/', domain);
302
303
  }
303
304
  }
@@ -77,9 +77,6 @@ export default class IABookActions extends LitElement {
77
77
  this.sharedObserver = new SharedResizeObserver();
78
78
  this.setupResizeObserver();
79
79
  }
80
-
81
- // manage sticky-admin-acces by cookie
82
- // this.hasStickyAdminAccess = getItem('sticky-admin-access') === 'true';
83
80
  }
84
81
 
85
82
  updated(changed) {