@guardian/commercial-core 5.2.0 → 5.3.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.
@@ -150,25 +150,22 @@ const slotSizeMappings = {
150
150
  mobile: [
151
151
  adSizes.outOfPage,
152
152
  adSizes.empty,
153
- adSizes.halfPage,
154
153
  adSizes.outstreamMobile,
155
154
  adSizes.mpu,
156
155
  adSizes.googleCard,
157
156
  adSizes.fluid,
158
157
  ],
159
- desktop: [
158
+ phablet: [
160
159
  adSizes.outOfPage,
161
160
  adSizes.empty,
161
+ adSizes.outstreamMobile,
162
162
  adSizes.mpu,
163
163
  adSizes.googleCard,
164
164
  adSizes.fluid,
165
- adSizes.halfPage,
166
- adSizes.skyscraper,
167
165
  ],
168
- phablet: [
166
+ desktop: [
169
167
  adSizes.outOfPage,
170
168
  adSizes.empty,
171
- adSizes.outstreamMobile,
172
169
  adSizes.mpu,
173
170
  adSizes.googleCard,
174
171
  adSizes.fluid,
@@ -220,22 +217,22 @@ const slotSizeMappings = {
220
217
  adSizes.googleCard,
221
218
  adSizes.fluid,
222
219
  ],
223
- tablet: [
220
+ phablet: [
224
221
  adSizes.outOfPage,
225
222
  adSizes.empty,
223
+ adSizes.outstreamMobile,
226
224
  adSizes.mpu,
227
225
  adSizes.googleCard,
228
226
  adSizes.halfPage,
229
- adSizes.leaderboard,
230
227
  adSizes.fluid,
231
228
  ],
232
- phablet: [
229
+ tablet: [
233
230
  adSizes.outOfPage,
234
231
  adSizes.empty,
235
- adSizes.outstreamMobile,
236
232
  adSizes.mpu,
237
233
  adSizes.googleCard,
238
234
  adSizes.halfPage,
235
+ adSizes.leaderboard,
239
236
  adSizes.fluid,
240
237
  ],
241
238
  desktop: [
@@ -287,8 +284,8 @@ const slotSizeMappings = {
287
284
  mobile: [adSizes.mobilesticky],
288
285
  },
289
286
  'crossword-banner': {
290
- tablet: [adSizes.outOfPage, adSizes.empty, adSizes.leaderboard],
291
287
  phablet: [adSizes.outOfPage, adSizes.empty, adSizes.leaderboard],
288
+ tablet: [adSizes.outOfPage, adSizes.empty, adSizes.leaderboard],
292
289
  },
293
290
  exclusion: {
294
291
  mobile: [adSizes.empty],
@@ -28,6 +28,7 @@ interface EventTimerProperties {
28
28
  type?: ConnectionType;
29
29
  downlink?: number;
30
30
  effectiveType?: string;
31
+ offlineCount?: number;
31
32
  adSlotsInline?: number;
32
33
  adSlotsTotal?: number;
33
34
  pageHeightVH?: number;
@@ -93,20 +93,15 @@ class EventTimer {
93
93
  },
94
94
  ],
95
95
  };
96
- this.properties =
97
- 'connection' in window.navigator
98
- ? {
99
- type: 'type' in window.navigator.connection
100
- ? window.navigator.connection.type
101
- : undefined,
102
- downlink: 'downlink' in window.navigator.connection
103
- ? window.navigator.connection.downlink
104
- : undefined,
105
- effectiveType: 'effectiveType' in window.navigator.connection
106
- ? window.navigator.connection.effectiveType
107
- : undefined,
108
- }
109
- : {};
96
+ this.properties = {
97
+ offlineCount: window.guardian.offlineCount,
98
+ };
99
+ if (window.navigator.connection) {
100
+ this.properties.type = window.navigator.connection.type;
101
+ this.properties.downlink = window.navigator.connection.downlink;
102
+ this.properties.effectiveType =
103
+ window.navigator.connection.effectiveType;
104
+ }
110
105
  }
111
106
  /**
112
107
  * Adds an event timer property
@@ -3,7 +3,7 @@ import type { GoogleTagParams, GoogleTrackConversionObject, GuardianWindowConfig
3
3
  import type { EventTimer } from '.';
4
4
  declare global {
5
5
  interface Navigator {
6
- readonly connection: NetworkInformation;
6
+ readonly connection?: NetworkInformation;
7
7
  }
8
8
  interface Window {
9
9
  google_trackConversion?: (arg0: GoogleTrackConversionObject) => void;
@@ -15,6 +15,7 @@ declare global {
15
15
  guardian: {
16
16
  commercialTimer?: EventTimer;
17
17
  config: GuardianWindowConfig;
18
+ offlineCount?: number;
18
19
  };
19
20
  ga: UniversalAnalytics.ga | null;
20
21
  readonly navigator: Navigator;
@@ -15,6 +15,7 @@ type EventProperties = {
15
15
  type?: ConnectionType;
16
16
  downlink?: number;
17
17
  effectiveType?: string;
18
+ offlineCount?: number;
18
19
  };
19
20
  declare enum Endpoints {
20
21
  CODE = "//performance-events.code.dev-guardianapis.com/commercial-metrics",
@@ -143,25 +143,22 @@ const slotSizeMappings = {
143
143
  mobile: [
144
144
  adSizes.outOfPage,
145
145
  adSizes.empty,
146
- adSizes.halfPage,
147
146
  adSizes.outstreamMobile,
148
147
  adSizes.mpu,
149
148
  adSizes.googleCard,
150
149
  adSizes.fluid,
151
150
  ],
152
- desktop: [
151
+ phablet: [
153
152
  adSizes.outOfPage,
154
153
  adSizes.empty,
154
+ adSizes.outstreamMobile,
155
155
  adSizes.mpu,
156
156
  adSizes.googleCard,
157
157
  adSizes.fluid,
158
- adSizes.halfPage,
159
- adSizes.skyscraper,
160
158
  ],
161
- phablet: [
159
+ desktop: [
162
160
  adSizes.outOfPage,
163
161
  adSizes.empty,
164
- adSizes.outstreamMobile,
165
162
  adSizes.mpu,
166
163
  adSizes.googleCard,
167
164
  adSizes.fluid,
@@ -213,22 +210,22 @@ const slotSizeMappings = {
213
210
  adSizes.googleCard,
214
211
  adSizes.fluid,
215
212
  ],
216
- tablet: [
213
+ phablet: [
217
214
  adSizes.outOfPage,
218
215
  adSizes.empty,
216
+ adSizes.outstreamMobile,
219
217
  adSizes.mpu,
220
218
  adSizes.googleCard,
221
219
  adSizes.halfPage,
222
- adSizes.leaderboard,
223
220
  adSizes.fluid,
224
221
  ],
225
- phablet: [
222
+ tablet: [
226
223
  adSizes.outOfPage,
227
224
  adSizes.empty,
228
- adSizes.outstreamMobile,
229
225
  adSizes.mpu,
230
226
  adSizes.googleCard,
231
227
  adSizes.halfPage,
228
+ adSizes.leaderboard,
232
229
  adSizes.fluid,
233
230
  ],
234
231
  desktop: [
@@ -280,8 +277,8 @@ const slotSizeMappings = {
280
277
  mobile: [adSizes.mobilesticky],
281
278
  },
282
279
  'crossword-banner': {
283
- tablet: [adSizes.outOfPage, adSizes.empty, adSizes.leaderboard],
284
280
  phablet: [adSizes.outOfPage, adSizes.empty, adSizes.leaderboard],
281
+ tablet: [adSizes.outOfPage, adSizes.empty, adSizes.leaderboard],
285
282
  },
286
283
  exclusion: {
287
284
  mobile: [adSizes.empty],
@@ -28,6 +28,7 @@ interface EventTimerProperties {
28
28
  type?: ConnectionType;
29
29
  downlink?: number;
30
30
  effectiveType?: string;
31
+ offlineCount?: number;
31
32
  adSlotsInline?: number;
32
33
  adSlotsTotal?: number;
33
34
  pageHeightVH?: number;
@@ -90,20 +90,15 @@ class EventTimer {
90
90
  },
91
91
  ],
92
92
  };
93
- this.properties =
94
- 'connection' in window.navigator
95
- ? {
96
- type: 'type' in window.navigator.connection
97
- ? window.navigator.connection.type
98
- : undefined,
99
- downlink: 'downlink' in window.navigator.connection
100
- ? window.navigator.connection.downlink
101
- : undefined,
102
- effectiveType: 'effectiveType' in window.navigator.connection
103
- ? window.navigator.connection.effectiveType
104
- : undefined,
105
- }
106
- : {};
93
+ this.properties = {
94
+ offlineCount: window.guardian.offlineCount,
95
+ };
96
+ if (window.navigator.connection) {
97
+ this.properties.type = window.navigator.connection.type;
98
+ this.properties.downlink = window.navigator.connection.downlink;
99
+ this.properties.effectiveType =
100
+ window.navigator.connection.effectiveType;
101
+ }
107
102
  }
108
103
  /**
109
104
  * Adds an event timer property
@@ -3,7 +3,7 @@ import type { GoogleTagParams, GoogleTrackConversionObject, GuardianWindowConfig
3
3
  import type { EventTimer } from '.';
4
4
  declare global {
5
5
  interface Navigator {
6
- readonly connection: NetworkInformation;
6
+ readonly connection?: NetworkInformation;
7
7
  }
8
8
  interface Window {
9
9
  google_trackConversion?: (arg0: GoogleTrackConversionObject) => void;
@@ -15,6 +15,7 @@ declare global {
15
15
  guardian: {
16
16
  commercialTimer?: EventTimer;
17
17
  config: GuardianWindowConfig;
18
+ offlineCount?: number;
18
19
  };
19
20
  ga: UniversalAnalytics.ga | null;
20
21
  readonly navigator: Navigator;
@@ -15,6 +15,7 @@ type EventProperties = {
15
15
  type?: ConnectionType;
16
16
  downlink?: number;
17
17
  effectiveType?: string;
18
+ offlineCount?: number;
18
19
  };
19
20
  declare enum Endpoints {
20
21
  CODE = "//performance-events.code.dev-guardianapis.com/commercial-metrics",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/commercial-core",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "Guardian advertising business logic",
5
5
  "homepage": "https://github.com/guardian/commercial-core#readme",
6
6
  "bugs": {