@guardian/commercial-core 0.31.0 → 0.32.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/README.md CHANGED
@@ -24,7 +24,7 @@
24
24
  [![Generic badge](https://img.shields.io/badge/google-chat-259082.svg)](https://chat.google.com/room/AAAAPL2MBvE)
25
25
 
26
26
  ```bash
27
- pnpm add @guardian/commercial-core
27
+ yarn add @guardian/commercial-core
28
28
  ```
29
29
 
30
30
  or
@@ -44,7 +44,7 @@ If your target environment does not support that, make sure you transpile this p
44
44
  ### Requirements
45
45
 
46
46
  1. [Node 14](https://nodejs.org/en/download/) ([nvm][] or [fnm][] recommended)
47
- 2. [PNPM](https://pnpm.io/installation)
47
+ 2. [Yarn](https://classic.yarnpkg.com/en/docs/install/)
48
48
 
49
49
  [nvm]: https://github.com/nvm-sh/nvm
50
50
  [fnm]: https://github.com/Schniz/fnm
@@ -58,7 +58,6 @@ export declare class EventTimer {
58
58
  */
59
59
  get events(): Event[];
60
60
  constructor();
61
- mark(name: string): void;
62
61
  /**
63
62
  * Creates a new performance mark
64
63
  * For slot events also ensures each TYPE of event event is marked only once for 'first'
@@ -68,6 +67,7 @@ export declare class EventTimer {
68
67
  * @param {origin} [origin=page] - Either 'page' (default) or the name of the slot
69
68
  */
70
69
  trigger(eventName: string, origin?: string): void;
71
- trackInGA(eventName: string, label?: string): void;
70
+ private mark;
71
+ private trackInGA;
72
72
  }
73
73
  export {};
@@ -102,20 +102,6 @@ class EventTimer {
102
102
  ]
103
103
  : this._events;
104
104
  }
105
- mark(name) {
106
- const longName = `gu.commercial.${name}`;
107
- if (typeof window.performance !== 'undefined' &&
108
- 'mark' in window.performance) {
109
- window.performance.mark(longName);
110
- // Most recent mark with this name is the event we just created.
111
- const mark = window.performance
112
- .getEntriesByName(longName, 'mark')
113
- .slice(-1)[0];
114
- if (typeof mark !== 'undefined') {
115
- this._events.push(new Event(name, mark));
116
- }
117
- }
118
- }
119
105
  /**
120
106
  * Creates a new performance mark
121
107
  * For slot events also ensures each TYPE of event event is marked only once for 'first'
@@ -148,6 +134,20 @@ class EventTimer {
148
134
  }
149
135
  }
150
136
  }
137
+ mark(name) {
138
+ const longName = `gu.commercial.${name}`;
139
+ if (typeof window.performance !== 'undefined' &&
140
+ 'mark' in window.performance) {
141
+ window.performance.mark(longName);
142
+ // Most recent mark with this name is the event we just created.
143
+ const mark = window.performance
144
+ .getEntriesByName(longName, 'mark')
145
+ .slice(-1)[0];
146
+ if (typeof mark !== 'undefined') {
147
+ this._events.push(new Event(name, mark));
148
+ }
149
+ }
150
+ }
151
151
  trackInGA(eventName, label = '') {
152
152
  const gaEvent = this.gaConfig.logEvents.find((e) => e.timingVariable === eventName);
153
153
  if (gaEvent) {
@@ -58,7 +58,6 @@ export declare class EventTimer {
58
58
  */
59
59
  get events(): Event[];
60
60
  constructor();
61
- mark(name: string): void;
62
61
  /**
63
62
  * Creates a new performance mark
64
63
  * For slot events also ensures each TYPE of event event is marked only once for 'first'
@@ -68,6 +67,7 @@ export declare class EventTimer {
68
67
  * @param {origin} [origin=page] - Either 'page' (default) or the name of the slot
69
68
  */
70
69
  trigger(eventName: string, origin?: string): void;
71
- trackInGA(eventName: string, label?: string): void;
70
+ private mark;
71
+ private trackInGA;
72
72
  }
73
73
  export {};
@@ -99,20 +99,6 @@ export class EventTimer {
99
99
  ]
100
100
  : this._events;
101
101
  }
102
- mark(name) {
103
- const longName = `gu.commercial.${name}`;
104
- if (typeof window.performance !== 'undefined' &&
105
- 'mark' in window.performance) {
106
- window.performance.mark(longName);
107
- // Most recent mark with this name is the event we just created.
108
- const mark = window.performance
109
- .getEntriesByName(longName, 'mark')
110
- .slice(-1)[0];
111
- if (typeof mark !== 'undefined') {
112
- this._events.push(new Event(name, mark));
113
- }
114
- }
115
- }
116
102
  /**
117
103
  * Creates a new performance mark
118
104
  * For slot events also ensures each TYPE of event event is marked only once for 'first'
@@ -145,6 +131,20 @@ export class EventTimer {
145
131
  }
146
132
  }
147
133
  }
134
+ mark(name) {
135
+ const longName = `gu.commercial.${name}`;
136
+ if (typeof window.performance !== 'undefined' &&
137
+ 'mark' in window.performance) {
138
+ window.performance.mark(longName);
139
+ // Most recent mark with this name is the event we just created.
140
+ const mark = window.performance
141
+ .getEntriesByName(longName, 'mark')
142
+ .slice(-1)[0];
143
+ if (typeof mark !== 'undefined') {
144
+ this._events.push(new Event(name, mark));
145
+ }
146
+ }
147
+ }
148
148
  trackInGA(eventName, label = '') {
149
149
  const gaEvent = this.gaConfig.logEvents.find((e) => e.timingVariable === eventName);
150
150
  if (gaEvent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/commercial-core",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Guardian advertising business logic",
5
5
  "homepage": "https://github.com/guardian/commercial-core#readme",
6
6
  "bugs": {