@schibsted/pulse-sdk 8.0.0-rc.0 → 8.0.0-rc.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.
@@ -64,7 +64,7 @@ const leaveTrackingTpaas_1 = require("./leaveTrackingTpaas");
64
64
  const network_1 = __importDefault(require("./network"));
65
65
  const config = __importStar(require("./remoteConfig"));
66
66
  const proxy_provider_1 = require("./tracker-proxy/proxy-provider");
67
- const version_json_1 = __importDefault(require("./version.json"));
67
+ const version_1 = require("./version");
68
68
  const visibility_observer_1 = require("./visibility-observer");
69
69
  const warnOnce_1 = __importDefault(require("./warnOnce"));
70
70
  const event_builder_1 = require("./wrapper/engagement/ui-element/event-builder");
@@ -186,6 +186,11 @@ class Tracker {
186
186
  * @private
187
187
  */
188
188
  this.sessionIdPromise = null;
189
+ /**
190
+ * A simple flag used to prevent duplicate listeners being registered
191
+ * if `exposeToProxyClients` or `startProxyProviderListener` is called more than once.
192
+ */
193
+ this.hasProxyListener = false;
189
194
  this.setPageDefaults = (pageViewEvent) => {
190
195
  this.legacyCurrentPage = (0, page_from_page_view_1.pageFromPageView)(pageViewEvent);
191
196
  if (pageViewEvent.origin) {
@@ -250,7 +255,7 @@ class Tracker {
250
255
  id: providerId,
251
256
  },
252
257
  tracker: {
253
- version: version_json_1.default.SDK_VERSION,
258
+ version: version_1.SDK_VERSION,
254
259
  },
255
260
  });
256
261
  this.bookmark = new Map();
@@ -450,7 +455,7 @@ class Tracker {
450
455
  }
451
456
  return {
452
457
  autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
453
- version: version_json_1.default.SDK_VERSION,
458
+ version: version_1.SDK_VERSION,
454
459
  isHybrid: !!this.state.isHybrid,
455
460
  pageviewId: this.state.pageViewId,
456
461
  providerId: this.state.providerId,
@@ -526,7 +531,7 @@ class Tracker {
526
531
  const { environmentId, jwe } = (0, pulse_cis_sync_1.parsePulseCookies)();
527
532
  return {
528
533
  autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
529
- version: version_json_1.default.SDK_VERSION,
534
+ version: version_1.SDK_VERSION,
530
535
  isHybrid: !!this.state.isHybrid,
531
536
  user: adaptActorToNewFormat(actor),
532
537
  consents: adaptConsentsToNewFormat(consents),
@@ -840,6 +845,36 @@ class Tracker {
840
845
  }
841
846
  return result;
842
847
  }
848
+ /**
849
+ * @param input
850
+ * @param options
851
+ * @category TPaaS Tracking
852
+ */
853
+ async trackViewSportsPage(input, options) {
854
+ this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
855
+ this.setCurrentPage(input.object.objectId, 'Page'); // ViewSportsPage.object.objectType is SportsPage, which is not allowed as a pageType
856
+ const dependencies = await this.prepareTpaasEvent();
857
+ const event = (0, tpaas_event_builder_1.buildViewSportsPageEvent)(input, dependencies);
858
+ const result = this.sendTpaasEvent(event);
859
+ if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
860
+ const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
861
+ const leaveSportsPageCallback = (leave) => {
862
+ this.trackLeaveSportsPage({
863
+ leave,
864
+ ...input,
865
+ });
866
+ };
867
+ (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
868
+ objectElement,
869
+ pageElement,
870
+ objectResizable,
871
+ heightBuilder,
872
+ schema: tpaas_schemas_1.LeaveSportsPage.object.objectType,
873
+ trackMethod: leaveSportsPageCallback,
874
+ });
875
+ }
876
+ return result;
877
+ }
843
878
  /**
844
879
  * @param input
845
880
  * @category TPaaS Tracking
@@ -1488,6 +1523,15 @@ class Tracker {
1488
1523
  const event = (0, tpaas_event_builder_1.buildLeavePageEvent)(input, dependencies);
1489
1524
  return this.sendTpaasEvent(event);
1490
1525
  }
1526
+ /**
1527
+ * @param input
1528
+ * @category TPaaS Tracking
1529
+ */
1530
+ async trackLeaveSportsPage(input) {
1531
+ const dependencies = await this.prepareTpaasEvent();
1532
+ const event = (0, tpaas_event_builder_1.buildLeaveSportsPageEvent)(input, dependencies);
1533
+ return this.sendTpaasEvent(event);
1534
+ }
1491
1535
  /**
1492
1536
  * @param input
1493
1537
  * @category TPaaS Tracking
@@ -65,7 +65,7 @@ function anonymousTrackerEvent({ eventInput, sdkConfig } = {}) {
65
65
  return Object.assign({}, (0, pulse_utils_1.omit)(eventInput, ['type']), {
66
66
  '@type': eventInput?.type || 'View',
67
67
  schema: eventInput?.schema ||
68
- `http://${sdkConfig?.schemaLocation || events_node_1.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/351.json`,
68
+ `http://${sdkConfig?.schemaLocation || events_node_1.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/360.json`,
69
69
  consents: (0, consents_1.default)(parentInput),
70
70
  experiments: (0, experiments_1.default)(parentInput),
71
71
  experimentMetadata: (0, experimentMetadata_1.default)(parentInput),
@@ -98,7 +98,7 @@ function trackerEvent({ eventInput, sdkConfig } = {}) {
98
98
  '@type': eventInput?.type || 'View',
99
99
  pageViewId: pageViewIdInput || pageViewIdSdk,
100
100
  schema: eventInput?.schema ||
101
- `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/359.json`,
101
+ `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/360.json`,
102
102
  actor: (0, actor_1.default)(parentInput),
103
103
  consents: (0, consents_1.default)(parentInput),
104
104
  experiments: (0, experiments_1.default)(parentInput),
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.defaultValue = void 0;
7
4
  exports.default = tracker;
8
- const version_json_1 = __importDefault(require("../version.json"));
5
+ const version_1 = require("../version");
9
6
  /**
10
7
  * Format tracker objects
11
8
  */
@@ -14,7 +11,7 @@ function tracker(input) {
14
11
  const base = {
15
12
  name: 'Pulse Node.js SDK',
16
13
  type: 'JS',
17
- version: version_json_1.default.SDK_VERSION,
14
+ version: version_1.SDK_VERSION,
18
15
  };
19
16
  return Object.assign({}, base, trackerInput);
20
17
  }
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.requireCisSyncCallForAdvertisingIds = exports.cisSync = exports.clearCookieJweIfStale = void 0;
7
4
  const pulse_cis_sync_1 = require("@schibsted/pulse-cis-sync");
8
5
  Object.defineProperty(exports, "clearCookieJweIfStale", { enumerable: true, get: function () { return pulse_cis_sync_1.clearCookieJweIfStale; } });
9
- const version_json_1 = __importDefault(require("../version.json"));
6
+ const version_1 = require("../version");
10
7
  const actor_1 = require("./actor");
11
8
  const requireCisSyncCallForAdvertisingIds = () => {
12
9
  (0, pulse_cis_sync_1.resetRefreshAfter)(new Date());
@@ -55,7 +52,7 @@ const cisSync = async (data, builders, config) => {
55
52
  // @ts-expect-error
56
53
  return (0, pulse_cis_sync_1.syncWithCis)(
57
54
  // @ts-expect-error
58
- id, nativeJwe, cisBaseUrl, realm, providerId, isHybrid ? 'Hybrid' : 'Web', version_json_1.default.SDK_VERSION, {
55
+ id, nativeJwe, cisBaseUrl, realm, providerId, isHybrid ? 'Hybrid' : 'Web', version_1.SDK_VERSION, {
59
56
  includeAdvertising,
60
57
  vendors,
61
58
  trackerId,
@@ -13,6 +13,11 @@ function startProxyProviderListener(tracker) {
13
13
  loglevel_1.default.debug('Proxy Provider - Not in browser environment, skipping message listener');
14
14
  return () => { };
15
15
  }
16
+ if (tracker.hasProxyListener) {
17
+ loglevel_1.default.debug('Proxy Provider - Message listener already registered for this tracker, skipping');
18
+ return () => { };
19
+ }
20
+ tracker.hasProxyListener = true;
16
21
  loglevel_1.default.debug('Proxy Provider - Added message listener for proxy provider');
17
22
  const listener = async (event) => {
18
23
  loglevel_1.default.debug('Proxy Provider - message received', event.data);
@@ -64,5 +69,6 @@ function startProxyProviderListener(tracker) {
64
69
  window.addEventListener('message', listener);
65
70
  return () => {
66
71
  window.removeEventListener('message', listener);
72
+ tracker.hasProxyListener = false;
67
73
  };
68
74
  }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SDK_VERSION = void 0;
4
+ // This file is auto-generated by bin/generate-version.js. Do not edit manually.
5
+ exports.SDK_VERSION = '8.0.0-rc.2';
@@ -1,7 +1,7 @@
1
1
  import { parsePulseCookies } from '@schibsted/pulse-cis-sync';
2
2
  import { evaluateAndFlatten, isBrowser, isFunction, isPromise, isString, pulseMerge, throttle, } from '@schibsted/pulse-utils';
3
- import { buildAnonymousViewUIElementEvent, buildCompletedHealthActionEvent, buildEngagementAudioEvent, buildEngagementFormEvent, buildEngagementHealthUIElementEvent, buildEngagementOfferEvent, buildEngagementTeaserEvent, buildEngagementUIElementEvent, buildEngagementVideoAdEvent, buildEngagementVideoEvent, buildEngagementWidgetEvent, buildImpressionAdSlotEvent, buildImpressionFormEvent, buildImpressionHealthUIElementEvent, buildImpressionOfferEvent, buildImpressionPlayerEvent, buildImpressionTeaserEvent, buildImpressionUIElementEvent, buildImpressionWidgetEvent, buildLeaveArticleEvent, buildLeaveAudioPageEvent, buildLeaveErrorEvent, buildLeaveFrontpageEvent, buildLeaveLandingpageEvent, buildLeaveListingEvent, buildLeaveLockedArticleEvent, buildLeaveLockedAudioEvent, buildLeaveLockedAudioPageEvent, buildLeaveLockedVideoEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildViewArticleEvent, buildViewAudioEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioEvent, buildViewLockedAudioPageEvent, buildViewLockedVideoEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewTitleEvent, buildViewVideoEvent, buildViewVideoPageEvent, buildViewWeatherEvent, getCommonBuildersOutput, } from '@schibsted/tpaas-event-builder';
4
- import { LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudioPage, LeaveLockedVideoPage, LeavePage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewError, ViewFrontpage, ViewListing, ViewLockedArticle, ViewLockedVideo, ViewPage, ViewTitle, } from '@schibsted/tpaas-schemas';
3
+ import { buildAnonymousViewUIElementEvent, buildCompletedHealthActionEvent, buildEngagementAudioEvent, buildEngagementFormEvent, buildEngagementHealthUIElementEvent, buildEngagementOfferEvent, buildEngagementTeaserEvent, buildEngagementUIElementEvent, buildEngagementVideoAdEvent, buildEngagementVideoEvent, buildEngagementWidgetEvent, buildImpressionAdSlotEvent, buildImpressionFormEvent, buildImpressionHealthUIElementEvent, buildImpressionOfferEvent, buildImpressionPlayerEvent, buildImpressionTeaserEvent, buildImpressionUIElementEvent, buildImpressionWidgetEvent, buildLeaveArticleEvent, buildLeaveAudioPageEvent, buildLeaveErrorEvent, buildLeaveFrontpageEvent, buildLeaveLandingpageEvent, buildLeaveListingEvent, buildLeaveLockedArticleEvent, buildLeaveLockedAudioEvent, buildLeaveLockedAudioPageEvent, buildLeaveLockedVideoEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveSportsPageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildViewArticleEvent, buildViewAudioEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioEvent, buildViewLockedAudioPageEvent, buildViewLockedVideoEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewSportsPageEvent, buildViewTitleEvent, buildViewVideoEvent, buildViewVideoPageEvent, buildViewWeatherEvent, getCommonBuildersOutput, } from '@schibsted/tpaas-event-builder';
4
+ import { LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudioPage, LeaveLockedVideoPage, LeavePage, LeaveSportsPage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewError, ViewFrontpage, ViewListing, ViewLockedArticle, ViewLockedVideo, ViewPage, ViewTitle, } from '@schibsted/tpaas-schemas';
5
5
  import logger from 'loglevel';
6
6
  import { v4 } from 'uuid';
7
7
  import { getDefaultAltHandler, getDefaultNativeJwe } from './app-integration';
@@ -21,7 +21,7 @@ import { addTpaasLeaveTracking, getTpaasLeaveObject, leaveTpaasTrackingIsActive,
21
21
  import send from './network';
22
22
  import * as config from './remoteConfig';
23
23
  import { startProxyProviderListener } from './tracker-proxy/proxy-provider';
24
- import version from './version.json';
24
+ import { SDK_VERSION } from './version';
25
25
  import { VisibilityObserver } from './visibility-observer';
26
26
  import warnOnce from './warnOnce';
27
27
  import { buildClickUIElementEvent } from './wrapper/engagement/ui-element/event-builder';
@@ -143,6 +143,11 @@ export default class Tracker {
143
143
  * @private
144
144
  */
145
145
  this.sessionIdPromise = null;
146
+ /**
147
+ * A simple flag used to prevent duplicate listeners being registered
148
+ * if `exposeToProxyClients` or `startProxyProviderListener` is called more than once.
149
+ */
150
+ this.hasProxyListener = false;
146
151
  this.setPageDefaults = (pageViewEvent) => {
147
152
  this.legacyCurrentPage = pageFromPageView(pageViewEvent);
148
153
  if (pageViewEvent.origin) {
@@ -207,7 +212,7 @@ export default class Tracker {
207
212
  id: providerId,
208
213
  },
209
214
  tracker: {
210
- version: version.SDK_VERSION,
215
+ version: SDK_VERSION,
211
216
  },
212
217
  });
213
218
  this.bookmark = new Map();
@@ -407,7 +412,7 @@ export default class Tracker {
407
412
  }
408
413
  return {
409
414
  autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
410
- version: version.SDK_VERSION,
415
+ version: SDK_VERSION,
411
416
  isHybrid: !!this.state.isHybrid,
412
417
  pageviewId: this.state.pageViewId,
413
418
  providerId: this.state.providerId,
@@ -483,7 +488,7 @@ export default class Tracker {
483
488
  const { environmentId, jwe } = parsePulseCookies();
484
489
  return {
485
490
  autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
486
- version: version.SDK_VERSION,
491
+ version: SDK_VERSION,
487
492
  isHybrid: !!this.state.isHybrid,
488
493
  user: adaptActorToNewFormat(actor),
489
494
  consents: adaptConsentsToNewFormat(consents),
@@ -797,6 +802,36 @@ export default class Tracker {
797
802
  }
798
803
  return result;
799
804
  }
805
+ /**
806
+ * @param input
807
+ * @param options
808
+ * @category TPaaS Tracking
809
+ */
810
+ async trackViewSportsPage(input, options) {
811
+ this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
812
+ this.setCurrentPage(input.object.objectId, 'Page'); // ViewSportsPage.object.objectType is SportsPage, which is not allowed as a pageType
813
+ const dependencies = await this.prepareTpaasEvent();
814
+ const event = buildViewSportsPageEvent(input, dependencies);
815
+ const result = this.sendTpaasEvent(event);
816
+ if (shouldEnableLeaveTracking(options.leaveTracking)) {
817
+ const { objectElement, pageElement, heightBuilder, objectResizable } = options.leaveTracking;
818
+ const leaveSportsPageCallback = (leave) => {
819
+ this.trackLeaveSportsPage({
820
+ leave,
821
+ ...input,
822
+ });
823
+ };
824
+ addTpaasLeaveTracking({
825
+ objectElement,
826
+ pageElement,
827
+ objectResizable,
828
+ heightBuilder,
829
+ schema: LeaveSportsPage.object.objectType,
830
+ trackMethod: leaveSportsPageCallback,
831
+ });
832
+ }
833
+ return result;
834
+ }
800
835
  /**
801
836
  * @param input
802
837
  * @category TPaaS Tracking
@@ -1445,6 +1480,15 @@ export default class Tracker {
1445
1480
  const event = buildLeavePageEvent(input, dependencies);
1446
1481
  return this.sendTpaasEvent(event);
1447
1482
  }
1483
+ /**
1484
+ * @param input
1485
+ * @category TPaaS Tracking
1486
+ */
1487
+ async trackLeaveSportsPage(input) {
1488
+ const dependencies = await this.prepareTpaasEvent();
1489
+ const event = buildLeaveSportsPageEvent(input, dependencies);
1490
+ return this.sendTpaasEvent(event);
1491
+ }
1448
1492
  /**
1449
1493
  * @param input
1450
1494
  * @category TPaaS Tracking
@@ -25,7 +25,7 @@ export function anonymousTrackerEvent({ eventInput, sdkConfig } = {}) {
25
25
  return Object.assign({}, omit(eventInput, ['type']), {
26
26
  '@type': eventInput?.type || 'View',
27
27
  schema: eventInput?.schema ||
28
- `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/351.json`,
28
+ `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/360.json`,
29
29
  consents: consentsBuilder(parentInput),
30
30
  experiments: experimentsBuilder(parentInput),
31
31
  experimentMetadata: experimentMetadataBuilder(parentInput),
@@ -55,7 +55,7 @@ export function trackerEvent({ eventInput, sdkConfig } = {}) {
55
55
  '@type': eventInput?.type || 'View',
56
56
  pageViewId: pageViewIdInput || pageViewIdSdk,
57
57
  schema: eventInput?.schema ||
58
- `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/359.json`,
58
+ `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/360.json`,
59
59
  actor: actorBuilder(parentInput),
60
60
  consents: consentsBuilder(parentInput),
61
61
  experiments: experimentsBuilder(parentInput),
@@ -1,4 +1,4 @@
1
- import version from '../version.json';
1
+ import { SDK_VERSION } from '../version';
2
2
  /**
3
3
  * Format tracker objects
4
4
  */
@@ -7,7 +7,7 @@ export default function tracker(input) {
7
7
  const base = {
8
8
  name: 'Pulse Node.js SDK',
9
9
  type: 'JS',
10
- version: version.SDK_VERSION,
10
+ version: SDK_VERSION,
11
11
  };
12
12
  return Object.assign({}, base, trackerInput);
13
13
  }
@@ -1,5 +1,5 @@
1
1
  import { clearCookieJweIfStale, resetRefreshAfter, syncWithCis } from '@schibsted/pulse-cis-sync';
2
- import version from '../version.json';
2
+ import { SDK_VERSION } from '../version';
3
3
  import { evaluateActor } from './actor';
4
4
  const requireCisSyncCallForAdvertisingIds = () => {
5
5
  resetRefreshAfter(new Date());
@@ -47,7 +47,7 @@ const cisSync = async (data, builders, config) => {
47
47
  // @ts-expect-error
48
48
  return syncWithCis(
49
49
  // @ts-expect-error
50
- id, nativeJwe, cisBaseUrl, realm, providerId, isHybrid ? 'Hybrid' : 'Web', version.SDK_VERSION, {
50
+ id, nativeJwe, cisBaseUrl, realm, providerId, isHybrid ? 'Hybrid' : 'Web', SDK_VERSION, {
51
51
  includeAdvertising,
52
52
  vendors,
53
53
  trackerId,
@@ -7,6 +7,11 @@ export function startProxyProviderListener(tracker) {
7
7
  logger.debug('Proxy Provider - Not in browser environment, skipping message listener');
8
8
  return () => { };
9
9
  }
10
+ if (tracker.hasProxyListener) {
11
+ logger.debug('Proxy Provider - Message listener already registered for this tracker, skipping');
12
+ return () => { };
13
+ }
14
+ tracker.hasProxyListener = true;
10
15
  logger.debug('Proxy Provider - Added message listener for proxy provider');
11
16
  const listener = async (event) => {
12
17
  logger.debug('Proxy Provider - message received', event.data);
@@ -58,5 +63,6 @@ export function startProxyProviderListener(tracker) {
58
63
  window.addEventListener('message', listener);
59
64
  return () => {
60
65
  window.removeEventListener('message', listener);
66
+ tracker.hasProxyListener = false;
61
67
  };
62
68
  }
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated by bin/generate-version.js. Do not edit manually.
2
+ export const SDK_VERSION = '8.0.0-rc.2';
@@ -1,6 +1,6 @@
1
1
  import { type AdvertisingIdentifiers, type AdvertisingVendor } from '@schibsted/pulse-cis-sync';
2
2
  import { getCommonBuildersOutput, type InputParams } from '@schibsted/tpaas-event-builder';
3
- import { type IAnonymousViewUIElement, type ICompletedHealthAction, type IEngagementAudio, type IEngagementForm, type IEngagementHealthUIElement, type IEngagementOffer, type IEngagementTeaser, type IEngagementUIElement, type IEngagementVideo, type IEngagementVideoAd, type IEngagementWidget, type IImpressionAdSlot, type IImpressionForm, type IImpressionHealthUIElement, type IImpressionOffer, type IImpressionPlayer, type IImpressionTeaser, type IImpressionUIElement, type IImpressionWidget, type ILeave, type ILeaveArticle, type ILeaveAudioPage, type ILeaveError, type ILeaveFrontpage, type ILeaveLandingpage, type ILeaveListing, type ILeaveLockedArticle, type ILeaveLockedAudio, type ILeaveLockedAudioPage, type ILeaveLockedVideo, type ILeaveLockedVideoPage, type ILeavePage, type ILeaveVideoPage, type ILeaveWeather, type ITpaasEvent, type IViewArticle, type IViewAudio, type IViewAudioPage, type IViewError, type IViewFrontpage, type IViewHealthPage, type IViewLandingpage, type IViewListing, type IViewLockedArticle, type IViewLockedAudio, type IViewLockedAudioPage, type IViewLockedVideo, type IViewLockedVideoPage, type IViewPage, type IViewTitle, type IViewVideo, type IViewVideoPage, type IViewWeather } from '@schibsted/tpaas-schemas';
3
+ import { type IAnonymousViewUIElement, type ICompletedHealthAction, type IEngagementAudio, type IEngagementForm, type IEngagementHealthUIElement, type IEngagementOffer, type IEngagementTeaser, type IEngagementUIElement, type IEngagementVideo, type IEngagementVideoAd, type IEngagementWidget, type IImpressionAdSlot, type IImpressionForm, type IImpressionHealthUIElement, type IImpressionOffer, type IImpressionPlayer, type IImpressionTeaser, type IImpressionUIElement, type IImpressionWidget, type ILeave, type ILeaveArticle, type ILeaveAudioPage, type ILeaveError, type ILeaveFrontpage, type ILeaveLandingpage, type ILeaveListing, type ILeaveLockedArticle, type ILeaveLockedAudio, type ILeaveLockedAudioPage, type ILeaveLockedVideo, type ILeaveLockedVideoPage, type ILeavePage, type ILeaveSportsPage, type ILeaveVideoPage, type ILeaveWeather, type ITpaasEvent, type IViewArticle, type IViewAudio, type IViewAudioPage, type IViewError, type IViewFrontpage, type IViewHealthPage, type IViewLandingpage, type IViewListing, type IViewLockedArticle, type IViewLockedAudio, type IViewLockedAudioPage, type IViewLockedVideo, type IViewLockedVideoPage, type IViewPage, type IViewSportsPage, type IViewTitle, type IViewVideo, type IViewVideoPage, type IViewWeather } from '@schibsted/tpaas-schemas';
4
4
  import logger from 'loglevel';
5
5
  import type { ActorInput, Consents, ConsentsInput, DeviceInput, LocationInput, ObjectInput, OriginInput, ProviderInput, TrackerInput } from './builders';
6
6
  import { engagementEvent, identityEvent, routableEvent, trackerEvent } from './builders/events';
@@ -285,6 +285,11 @@ export default class Tracker {
285
285
  * @private
286
286
  */
287
287
  private sessionIdPromise;
288
+ /**
289
+ * A simple flag used to prevent duplicate listeners being registered
290
+ * if `exposeToProxyClients` or `startProxyProviderListener` is called more than once.
291
+ */
292
+ hasProxyListener: boolean;
288
293
  /**
289
294
  * > [!WARNING]
290
295
  * >
@@ -557,6 +562,12 @@ export default class Tracker {
557
562
  * @category TPaaS Tracking
558
563
  */
559
564
  trackViewPage(input: InputParams<IViewPage>, options: TrackViewEventOptions): Promise<unknown>;
565
+ /**
566
+ * @param input
567
+ * @param options
568
+ * @category TPaaS Tracking
569
+ */
570
+ trackViewSportsPage(input: InputParams<IViewSportsPage>, options: TrackViewEventOptions): Promise<unknown>;
560
571
  /**
561
572
  * @param input
562
573
  * @category TPaaS Tracking
@@ -817,6 +828,11 @@ export default class Tracker {
817
828
  * @category TPaaS Tracking
818
829
  */
819
830
  trackLeavePage(input: InputParams<ILeavePage>): Promise<unknown>;
831
+ /**
832
+ * @param input
833
+ * @category TPaaS Tracking
834
+ */
835
+ trackLeaveSportsPage(input: InputParams<ILeaveSportsPage>): Promise<unknown>;
820
836
  /**
821
837
  * @param input
822
838
  * @category TPaaS Tracking
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "8.0.0-rc.2";
@@ -5,6 +5,7 @@ type ClickUIElementInputObject = {
5
5
  id: string;
6
6
  elementType: string;
7
7
  name: string;
8
+ containerName?: string;
8
9
  duration?: number;
9
10
  layout?: Layout;
10
11
  page?: Page;
@@ -5,6 +5,7 @@ type ViewUIElementInputObject = {
5
5
  elementType: string;
6
6
  name: string;
7
7
  placement: Placement;
8
+ containerName?: string;
8
9
  duration?: number;
9
10
  layout?: Layout;
10
11
  /** added automatically */
@@ -16,6 +16,7 @@ exports.buildViewLockedVideoEvent = buildViewLockedVideoEvent;
16
16
  exports.buildViewLockedVideoPageEvent = buildViewLockedVideoPageEvent;
17
17
  exports.buildLeaveLockedVideoPageEvent = buildLeaveLockedVideoPageEvent;
18
18
  exports.buildViewPageEvent = buildViewPageEvent;
19
+ exports.buildViewSportsPageEvent = buildViewSportsPageEvent;
19
20
  exports.buildViewTitleEvent = buildViewTitleEvent;
20
21
  exports.buildViewVideoEvent = buildViewVideoEvent;
21
22
  exports.buildViewVideoPageEvent = buildViewVideoPageEvent;
@@ -31,6 +32,7 @@ exports.buildLeaveLockedAudioEvent = buildLeaveLockedAudioEvent;
31
32
  exports.buildLeaveLockedAudioPageEvent = buildLeaveLockedAudioPageEvent;
32
33
  exports.buildLeaveLockedVideoEvent = buildLeaveLockedVideoEvent;
33
34
  exports.buildLeavePageEvent = buildLeavePageEvent;
35
+ exports.buildLeaveSportsPageEvent = buildLeaveSportsPageEvent;
34
36
  exports.buildLeaveVideoPageEvent = buildLeaveVideoPageEvent;
35
37
  exports.buildLeaveWeatherEvent = buildLeaveWeatherEvent;
36
38
  exports.buildEngagementAudioEvent = buildEngagementAudioEvent;
@@ -143,6 +145,9 @@ function buildLeaveLockedVideoPageEvent(input, dependencies) {
143
145
  function buildViewPageEvent(input, dependencies) {
144
146
  return (0, ts_deepmerge_1.merge)(omitNavigationType(input), tpaas_schemas_1.ViewPage, (0, exports.getCommonBuildersOutput)(new Date(), dependencies), (0, experiments_1.builder)(dependencies.experiments, input.experiments), (0, navigationType_1.builder)(input.page.navigationType));
145
147
  }
148
+ function buildViewSportsPageEvent(input, dependencies) {
149
+ return (0, ts_deepmerge_1.merge)(omitNavigationType(input), tpaas_schemas_1.ViewSportsPage, (0, exports.getCommonBuildersOutput)(new Date(), dependencies), (0, experiments_1.builder)(dependencies.experiments, input.experiments), (0, navigationType_1.builder)(input.page.navigationType));
150
+ }
146
151
  function buildViewTitleEvent(input, dependencies) {
147
152
  return (0, ts_deepmerge_1.merge)(omitNavigationType(input), tpaas_schemas_1.ViewTitle, (0, exports.getCommonBuildersOutput)(new Date(), dependencies), (0, experiments_1.builder)(dependencies.experiments, input.experiments), (0, navigationType_1.builder)(input.page.navigationType));
148
153
  }
@@ -190,6 +195,9 @@ function buildLeaveLockedVideoEvent(input, dependencies) {
190
195
  function buildLeavePageEvent(input, dependencies) {
191
196
  return (0, ts_deepmerge_1.merge)(omitNavigationType(input), tpaas_schemas_1.LeavePage, (0, exports.getCommonBuildersOutput)(new Date(), dependencies), (0, navigationType_1.builder)(input.page.navigationType), (0, experiments_1.builder)(dependencies.experiments, input.experiments));
192
197
  }
198
+ function buildLeaveSportsPageEvent(input, dependencies) {
199
+ return (0, ts_deepmerge_1.merge)(omitNavigationType(input), tpaas_schemas_1.LeaveSportsPage, (0, exports.getCommonBuildersOutput)(new Date(), dependencies), (0, navigationType_1.builder)(input.page.navigationType), (0, experiments_1.builder)(dependencies.experiments, input.experiments));
200
+ }
193
201
  function buildLeaveVideoPageEvent(input, dependencies) {
194
202
  return (0, ts_deepmerge_1.merge)(omitNavigationType(input), tpaas_schemas_1.LeaveVideoPage, (0, exports.getCommonBuildersOutput)(new Date(), dependencies), (0, navigationType_1.builder)(input.page.navigationType));
195
203
  }
@@ -1,4 +1,4 @@
1
- import { AnonymousViewUIElement, CompletedHealthAction, EngagementAudio, EngagementForm, EngagementHealthUIElement, EngagementOffer, EngagementTeaser, EngagementUIElement, EngagementVideo, EngagementVideoAd, EngagementWidget, ImpressionAdSlot, ImpressionForm, ImpressionHealthUIElement, ImpressionOffer, ImpressionPlayer, ImpressionTeaser, ImpressionUIElement, ImpressionWidget, LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudio, LeaveLockedAudioPage, LeaveLockedVideo, LeaveLockedVideoPage, LeavePage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewAudio, ViewAudioPage, ViewError, ViewFrontpage, ViewHealthPage, ViewLandingpage, ViewListing, ViewLockedArticle, ViewLockedAudio, ViewLockedAudioPage, ViewLockedVideo, ViewLockedVideoPage, ViewPage, ViewTitle, ViewVideo, ViewVideoPage, ViewWeather, } from '@schibsted/tpaas-schemas';
1
+ import { AnonymousViewUIElement, CompletedHealthAction, EngagementAudio, EngagementForm, EngagementHealthUIElement, EngagementOffer, EngagementTeaser, EngagementUIElement, EngagementVideo, EngagementVideoAd, EngagementWidget, ImpressionAdSlot, ImpressionForm, ImpressionHealthUIElement, ImpressionOffer, ImpressionPlayer, ImpressionTeaser, ImpressionUIElement, ImpressionWidget, LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudio, LeaveLockedAudioPage, LeaveLockedVideo, LeaveLockedVideoPage, LeavePage, LeaveSportsPage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewAudio, ViewAudioPage, ViewError, ViewFrontpage, ViewHealthPage, ViewLandingpage, ViewListing, ViewLockedArticle, ViewLockedAudio, ViewLockedAudioPage, ViewLockedVideo, ViewLockedVideoPage, ViewPage, ViewSportsPage, ViewTitle, ViewVideo, ViewVideoPage, ViewWeather, } from '@schibsted/tpaas-schemas';
2
2
  import { merge } from 'ts-deepmerge';
3
3
  import { builder as anonymousBuilder } from './builders/anonymous';
4
4
  import { builder as baseEventBuilder } from './builders/baseEvent';
@@ -88,6 +88,9 @@ export function buildLeaveLockedVideoPageEvent(input, dependencies) {
88
88
  export function buildViewPageEvent(input, dependencies) {
89
89
  return merge(omitNavigationType(input), ViewPage, getCommonBuildersOutput(new Date(), dependencies), experimentsBuilder(dependencies.experiments, input.experiments), navigationTypeBuilder(input.page.navigationType));
90
90
  }
91
+ export function buildViewSportsPageEvent(input, dependencies) {
92
+ return merge(omitNavigationType(input), ViewSportsPage, getCommonBuildersOutput(new Date(), dependencies), experimentsBuilder(dependencies.experiments, input.experiments), navigationTypeBuilder(input.page.navigationType));
93
+ }
91
94
  export function buildViewTitleEvent(input, dependencies) {
92
95
  return merge(omitNavigationType(input), ViewTitle, getCommonBuildersOutput(new Date(), dependencies), experimentsBuilder(dependencies.experiments, input.experiments), navigationTypeBuilder(input.page.navigationType));
93
96
  }
@@ -135,6 +138,9 @@ export function buildLeaveLockedVideoEvent(input, dependencies) {
135
138
  export function buildLeavePageEvent(input, dependencies) {
136
139
  return merge(omitNavigationType(input), LeavePage, getCommonBuildersOutput(new Date(), dependencies), navigationTypeBuilder(input.page.navigationType), experimentsBuilder(dependencies.experiments, input.experiments));
137
140
  }
141
+ export function buildLeaveSportsPageEvent(input, dependencies) {
142
+ return merge(omitNavigationType(input), LeaveSportsPage, getCommonBuildersOutput(new Date(), dependencies), navigationTypeBuilder(input.page.navigationType), experimentsBuilder(dependencies.experiments, input.experiments));
143
+ }
138
144
  export function buildLeaveVideoPageEvent(input, dependencies) {
139
145
  return merge(omitNavigationType(input), LeaveVideoPage, getCommonBuildersOutput(new Date(), dependencies), navigationTypeBuilder(input.page.navigationType));
140
146
  }