@guardian/ophan-tracker-js 2.2.5 → 2.2.7

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.
@@ -1,12 +1,12 @@
1
- import type { Consent } from './consent.js';
1
+ import type { AbTestInfo } from './abtest.js';
2
+ import type { Acquisition } from './acquisition.js';
2
3
  import type { ComponentEvent } from './component-event.js';
4
+ import type { Consent } from './consent.js';
3
5
  import type { InPageClick } from './inpageclick.js';
4
- import type { AbTestInfo } from './abtest.js';
6
+ import { Interaction } from './interaction.js';
5
7
  import type { AudioEvent, VideoEvent } from './media.js';
6
- import type { TMembershipTier, TSubscriptionType } from './subscription.js';
7
8
  import type { TPlatform } from './platform.js';
8
- import type { Acquisition } from './acquisition.js';
9
- import { Interaction } from './interaction.js';
9
+ import type { TMembershipTier, TSubscriptionType } from './subscription.js';
10
10
  /**
11
11
  * Details about a page view - only populated for _PAGE_VIEW
12
12
  * event types
@@ -26,7 +26,7 @@ interface PageView {
26
26
  totalDaysVisited?: number;
27
27
  /** Calculated average days between recent visits */
28
28
  averageDaysBetweenRecentVisits?: number;
29
- /** Is this browser a regular visitor to the Guardian */
29
+ /** No longer used in Ophan. Replaced by Frequency */
30
30
  regular?: boolean;
31
31
  subscriptionType?: TSubscriptionType;
32
32
  membershipTier?: TMembershipTier;
@@ -81,7 +81,7 @@ interface LazyComponents {
81
81
  components: Component[];
82
82
  }
83
83
  export type TEdition = 'UK' | 'US' | 'AU' | 'International' | 'Europe';
84
- export interface EventPayload extends Partial<Consent> {
84
+ export interface EventPayload extends Partial<Consent>, Partial<InPageClick> {
85
85
  /** If the user is logged in, the identity user id */
86
86
  userId?: string;
87
87
  pageView?: PageView;
@@ -91,7 +91,6 @@ export interface EventPayload extends Partial<Consent> {
91
91
  video?: VideoEvent;
92
92
  ab?: AbTestInfo;
93
93
  lazyComponents?: LazyComponents;
94
- inPageClick?: InPageClick;
95
94
  interaction?: Interaction;
96
95
  inPrivateBrowsingMode?: boolean;
97
96
  adUnitWasHidden?: boolean;
@@ -3,9 +3,9 @@ export interface InPageClick {
3
3
  /**
4
4
  * the component that contained the item clicked on
5
5
  */
6
- component?: string;
6
+ clickComponent?: string;
7
7
  /**
8
8
  * The link name associated with the element clicked.
9
9
  */
10
- linkName?: LinkName;
10
+ clickLinkNames?: LinkName;
11
11
  }
@@ -50,4 +50,4 @@ export type Product =
50
50
  /**
51
51
  * Supporter plus tier.
52
52
  */
53
- | "SUPPORTER_PLUS";
53
+ | "GUARDIAN_PATRON" | "SUPPORTER_PLUS";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/ophan-tracker-js",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -11,6 +11,23 @@
11
11
  ],
12
12
  "main": "NPM-dist/ng.js",
13
13
  "types": "NPM-dist/types/ng.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./NPM-dist/ng.js",
17
+ "types": "./NPM-dist/types/ng.d.ts"
18
+ },
19
+ "./MMA": {
20
+ "import": "./NPM-dist/manage-my-account.js",
21
+ "types": "./NPM-dist/types/manage-my-account.d.ts"
22
+ }
23
+ },
24
+ "typesVersions": {
25
+ "*": {
26
+ "MMA": [
27
+ "NPM-dist/types/manage-my-account.d.ts"
28
+ ]
29
+ }
30
+ },
14
31
  "devDependencies": {
15
32
  "@babel/preset-env": "^7.22.10",
16
33
  "@babel/preset-typescript": "^7.24.7",
@@ -23,7 +40,7 @@
23
40
  "babel-jest": "^29.7.0",
24
41
  "jest": "^29.7.0",
25
42
  "jest-environment-jsdom": "^29.7.0",
26
- "rollup": "3.28.0",
43
+ "rollup": "3.29.5",
27
44
  "rollup-jest": "^3.1.0",
28
45
  "ts-jest": "^29.1.4",
29
46
  "typescript": "^5.4.4"
@@ -1,26 +0,0 @@
1
- /**
2
- * A set of UTM parameters
3
- * https://en.wikipedia.org/wiki/UTM_parameters
4
- */
5
- interface UtmParameters {
6
- /**
7
- * Identifies which site sent the traffic
8
- */
9
- utmSource?: string;
10
- /**
11
- * Identifies what type of link was used, such as cost per click or email.
12
- */
13
- utmMedium?: string;
14
- /**
15
- * Identifies a specific product promotion or strategic campaign.
16
- */
17
- utmCampaign?: string;
18
- /**
19
- * Identifies search terms.
20
- */
21
- utmTerm?: string;
22
- /**
23
- * Identifies what specifically was clicked to bring the user to the site, such as a banner ad or a text link. It is often used for A/B testing and content-targeted ads.
24
- */
25
- utmContent?: string;
26
- }
@@ -1 +0,0 @@
1
- "use strict";