@glomex/integration-analytics 1.1522.0 → 1.1522.2

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,5 +1,8 @@
1
1
  // src/base-event-mapper.ts
2
- import { IntegrationEvent } from "@glomex/integration-web-component";
2
+ import {
3
+ ContentStopReason,
4
+ IntegrationEvent
5
+ } from "@glomex/integration-web-component";
3
6
  var PLAYBACK_EVENTS = [
4
7
  IntegrationEvent.CONTENT_START,
5
8
  IntegrationEvent.CONTENT_IMPRESSION,
@@ -73,7 +76,7 @@ var BaseEventMapper = class {
73
76
  }
74
77
  #handleEvent(event) {
75
78
  if (this.#stopped) return;
76
- const handler = this.#getHandler(event.type);
79
+ const handler = this.#getHandler(event);
77
80
  if (!handler) return;
78
81
  this.#enqueue(() => {
79
82
  try {
@@ -83,8 +86,8 @@ var BaseEventMapper = class {
83
86
  }
84
87
  });
85
88
  }
86
- #getHandler(type) {
87
- switch (type) {
89
+ #getHandler(event) {
90
+ switch (event.type) {
88
91
  case IntegrationEvent.CONTENT_START:
89
92
  return () => {
90
93
  this.#contentStarted = true;
@@ -107,6 +110,7 @@ var BaseEventMapper = class {
107
110
  case IntegrationEvent.CONTENT_PAUSE:
108
111
  return () => {
109
112
  if (!this.#hasContentImpression) return;
113
+ if (this.integration.ended) return;
110
114
  this.onContentPause();
111
115
  };
112
116
  case IntegrationEvent.CONTENT_SEEKING:
@@ -134,8 +138,10 @@ var BaseEventMapper = class {
134
138
  if (!this.#hasContentImpression) return;
135
139
  this.onContentEnded();
136
140
  };
137
- case IntegrationEvent.CONTENT_STOP:
138
- return () => this.destroy();
141
+ case IntegrationEvent.CONTENT_STOP: {
142
+ const reason = event.detail?.reason;
143
+ return () => this.destroy({ skipOnDestroy: reason === ContentStopReason.ENDED });
144
+ }
139
145
  case IntegrationEvent.CONTENT_TIME_UPDATE:
140
146
  return () => {
141
147
  if (!this.#hasContentImpression) return;
@@ -240,18 +246,12 @@ var BaseEventMapper = class {
240
246
  if (!ad) return false;
241
247
  return ad.adFormat === "linear";
242
248
  }
243
- /**
244
- * Tears down the event mapper:
245
- * 1. Marks as stopped (prevents further event processing)
246
- * 2. Calls onDestroy() for SDK-specific cleanup
247
- * 3. Removes all event listeners
248
- *
249
- * Safe to call multiple times - subsequent calls are no-ops.
250
- */
251
- destroy() {
249
+ destroy({ skipOnDestroy = false } = {}) {
252
250
  if (this.#stopped) return;
253
251
  this.#stopped = true;
254
- this.onDestroy();
252
+ if (!skipOnDestroy) {
253
+ this.onDestroy();
254
+ }
255
255
  for (const eventType of PLAYBACK_EVENTS) {
256
256
  this.integration.removeEventListener(eventType, this.#eventHandler);
257
257
  }
@@ -261,4 +261,4 @@ var BaseEventMapper = class {
261
261
  export {
262
262
  BaseEventMapper
263
263
  };
264
- //# sourceMappingURL=chunk-65MGYUYT.js.map
264
+ //# sourceMappingURL=chunk-AWTU6VPO.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseEventMapper
3
- } from "../chunk-65MGYUYT.js";
3
+ } from "../chunk-AWTU6VPO.js";
4
4
 
5
5
  // src/comscore/index.ts
6
6
  import { IntegrationEvent } from "@glomex/integration-web-component";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseEventMapper
3
- } from "../chunk-65MGYUYT.js";
3
+ } from "../chunk-AWTU6VPO.js";
4
4
 
5
5
  // src/nielsen/index.ts
6
6
  import { IntegrationEvent } from "@glomex/integration-web-component";
@@ -20,7 +20,7 @@ import {
20
20
  // package.json
21
21
  var package_default = {
22
22
  name: "@glomex/integration-analytics",
23
- version: "1.1522.0",
23
+ version: "1.1522.2",
24
24
  description: "Analytics integrations for the turbo player",
25
25
  documentation: "https://docs.glomex.com",
26
26
  homepage: "https://glomex.com",
@@ -73,7 +73,7 @@ var package_default = {
73
73
  },
74
74
  dependencies: {
75
75
  "@comscore/analytics": "^7.13.2",
76
- "@glomex/integration-web-component": "1.1522.0",
76
+ "@glomex/integration-web-component": "1.1522.2",
77
77
  "npaw-plugin": "^7.3.18"
78
78
  },
79
79
  devDependencies: {
@@ -85,7 +85,7 @@ var package_default = {
85
85
  access: "public"
86
86
  },
87
87
  license: "MIT",
88
- gitHead: "6c0ad21f332a2e33447a558342a926dd8a9118bc"
88
+ gitHead: "00242d98fa7dac70142a3f4ccbe0708d93935160"
89
89
  };
90
90
 
91
91
  // src/npaw/package-info.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseEventMapper
3
- } from "../chunk-65MGYUYT.js";
3
+ } from "../chunk-AWTU6VPO.js";
4
4
 
5
5
  // src/sensic/index.ts
6
6
  import { IntegrationEvent } from "@glomex/integration-web-component";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glomex/integration-analytics",
3
- "version": "1.1522.0",
3
+ "version": "1.1522.2",
4
4
  "description": "Analytics integrations for the turbo player",
5
5
  "documentation": "https://docs.glomex.com",
6
6
  "homepage": "https://glomex.com",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@comscore/analytics": "^7.13.2",
56
- "@glomex/integration-web-component": "1.1522.0",
56
+ "@glomex/integration-web-component": "1.1522.2",
57
57
  "npaw-plugin": "^7.3.18"
58
58
  },
59
59
  "devDependencies": {
@@ -65,5 +65,5 @@
65
65
  "access": "public"
66
66
  },
67
67
  "license": "MIT",
68
- "gitHead": "6c0ad21f332a2e33447a558342a926dd8a9118bc"
68
+ "gitHead": "00242d98fa7dac70142a3f4ccbe0708d93935160"
69
69
  }