@internetarchive/ia-book-actions 0.0.29-alpha10 → 0.0.29-alpha11

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.29-alpha10",
3
+ "version": "0.0.29-alpha11",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -9,6 +9,10 @@ import CollapsibleActionGroupStyle from '../assets/styles/collapsible-action-gro
9
9
 
10
10
  import { tabletContainerWidth } from '../core/config/constants.js';
11
11
  import { purchaseIcon } from '../assets/data/purchase.js';
12
+ import {
13
+ analyticsCategories,
14
+ analyticsActions,
15
+ } from '../config/analytics-event-and-category.js';
12
16
  import {
13
17
  dropdownOpened,
14
18
  dropdownClosed,
@@ -66,10 +70,15 @@ export class CollapsibleActionGroup extends ActionsHandler {
66
70
 
67
71
  // dispatch this event to loan renew handler
68
72
  dispatchAutoRenewBookEvent() {
73
+ const { category, action } = {
74
+ category: analyticsCategories.browse,
75
+ action: analyticsActions.browseAutoRenew,
76
+ };
77
+
69
78
  this.dispatchEvent(
70
79
  new CustomEvent('autoRenewLoan', {
71
80
  detail: {
72
- event: { autoRenewed1Hour: 'browseBook' },
81
+ event: { category, action },
73
82
  },
74
83
  })
75
84
  );
@@ -13,6 +13,7 @@ export const analyticsCategories = {
13
13
  export const analyticsActions = {
14
14
  browse: 'Borrow-1Hour',
15
15
  browseAgain: 'Borrow-Again',
16
+ browseAutoRenew: 'Borrow-Auto-Renew',
16
17
  borrow: 'Borrow-14Days',
17
18
  waitlistJoin: 'JoinWaitlist',
18
19
  waitlistLeave: 'LeaveWaitlist',
@@ -113,6 +113,10 @@ export default class IABookActions extends LitElement {
113
113
 
114
114
  bindAutoRenewEvent() {
115
115
  // dispatched this event from timer-countdown
116
+ this.addEventListener('BookReader:pageChanged', event => {
117
+ console.log('here: ', event)
118
+ })
119
+
116
120
  this.addEventListener('autoRenewAttempt', async event => {
117
121
  const isPageClick = event.detail.bookPageChange;
118
122