@schibsted/pulse-sdk 8.0.0-rc.7 → 8.0.0-rc.9

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.
Files changed (32) hide show
  1. package/dist/cjs/Tracker.js +16 -21
  2. package/dist/cjs/Tracker.test-d.js +0 -2
  3. package/dist/cjs/builders/consents.js +2 -2
  4. package/dist/cjs/builders/events-node.js +3 -3
  5. package/dist/cjs/builders/experiments.js +1 -0
  6. package/dist/cjs/version.js +1 -1
  7. package/dist/ejs/Tracker.js +17 -22
  8. package/dist/ejs/Tracker.test-d.js +0 -2
  9. package/dist/ejs/builders/consents.js +2 -2
  10. package/dist/ejs/builders/events-node.js +3 -3
  11. package/dist/ejs/builders/experiments.js +1 -1
  12. package/dist/ejs/version.js +1 -1
  13. package/dist/types/Tracker.d.ts +11 -15
  14. package/dist/types/builders/consents.d.ts +2 -2
  15. package/dist/types/builders/experiments.d.ts +1 -0
  16. package/dist/types/builders/index.d.ts +1 -1
  17. package/dist/types/index.d.ts +0 -1
  18. package/dist/types/version.d.ts +1 -1
  19. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +3 -1
  20. package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +53 -51
  21. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +3 -1
  22. package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +53 -51
  23. package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +66 -49
  24. package/node_modules/@schibsted/tpaas-event-builder/package.json +1 -0
  25. package/node_modules/@schibsted/tpaas-schemas/dist/cjs/constants.js +56 -56
  26. package/node_modules/@schibsted/tpaas-schemas/dist/cjs/index.js +1 -0
  27. package/node_modules/@schibsted/tpaas-schemas/dist/cjs/types.js +2 -0
  28. package/node_modules/@schibsted/tpaas-schemas/dist/ejs/constants.js +56 -56
  29. package/node_modules/@schibsted/tpaas-schemas/dist/ejs/index.js +1 -0
  30. package/node_modules/@schibsted/tpaas-schemas/dist/ejs/types.js +1 -0
  31. package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +129 -72
  32. package/package.json +5 -5
@@ -53,6 +53,7 @@ const consent_manager_1 = require("./builders/consent-manager");
53
53
  const consents_1 = require("./builders/consents");
54
54
  const events_1 = require("./builders/events");
55
55
  const events_anonymous_node_1 = require("./builders/events-anonymous-node");
56
+ const experiments_1 = require("./builders/experiments");
56
57
  const session_browser_1 = require("./builders/session-browser");
57
58
  const config_1 = require("./config");
58
59
  const config_browser_1 = require("./config-browser");
@@ -238,6 +239,9 @@ class Tracker {
238
239
  if (!providerId || !(typeof providerId === 'string')) {
239
240
  throw new Error('Required parameter `providerId` missing');
240
241
  }
242
+ if (config?.componentVersion !== undefined && config?.component === undefined) {
243
+ throw new Error('`componentVersion` cannot be provided without `component`');
244
+ }
241
245
  let includeAdvertising;
242
246
  if (pulse_utils_1.isBrowser && config?.autoCreateConsents) {
243
247
  config.consents = (0, consent_manager_1.getConsentsWaitForAnalytics)((consents) => {
@@ -281,6 +285,8 @@ class Tracker {
281
285
  this.builders = (0, pulse_utils_1.pulseMerge)({}, builders, {
282
286
  provider: {
283
287
  id: providerId,
288
+ ...(config?.component !== undefined && { component: config.component }),
289
+ ...(config?.componentVersion !== undefined && { componentVersion: config.componentVersion }),
284
290
  },
285
291
  tracker: {
286
292
  version: version_1.SDK_VERSION,
@@ -471,7 +477,9 @@ class Tracker {
471
477
  return {
472
478
  name: exp.name || exp.id,
473
479
  variant: exp.variant || '',
474
- experimentSdrn: exp.id,
480
+ // nobody should be sending experiment id with an sdrn format, but in case they do
481
+ // we want to be able to handle it and not generate an invalid sdrn by adding another layer to it
482
+ experimentSdrn: exp.id.startsWith('sdrn:') ? exp.id : (0, experiments_1.generateExperimentSDRN)(exp.id, exp.platform),
475
483
  platform: exp.platform || '',
476
484
  testId: exp.custom?.testId,
477
485
  };
@@ -495,6 +503,8 @@ class Tracker {
495
503
  isHybrid: !!this.state.isHybrid,
496
504
  pageviewId: this.state.pageViewId,
497
505
  providerId: this.state.providerId,
506
+ component: this.state.component,
507
+ componentVersion: this.state.componentVersion,
498
508
  experiments: await this.adaptExperiments(this.builders.experiments),
499
509
  };
500
510
  }
@@ -572,6 +582,8 @@ class Tracker {
572
582
  user: adaptActorToNewFormat(actor),
573
583
  consents: adaptConsentsToNewFormat(consents),
574
584
  providerId: this.state.providerId,
585
+ component: this.state.component,
586
+ componentVersion: this.state.componentVersion,
575
587
  pageviewId: this.state.pageViewId,
576
588
  currentPage,
577
589
  experiments,
@@ -579,22 +591,6 @@ class Tracker {
579
591
  jwe,
580
592
  };
581
593
  }
582
- /**
583
- * Generate a generic TPaaS event with common builders output
584
- * The method should be used for experiments, not for real production work.
585
- * It doesn't have any real TPaaS schema associated with it.
586
- * The method doesn't queue or send the event, it just returns the merged object.
587
- * The method can be removed at any time in the future, so use it with caution.
588
- *
589
- * @param input - The input object to merge with the common builders output
590
- * @returns A promise that resolves to the merged object
591
- * @private
592
- * @category TPaaS Tracking
593
- */
594
- async generateGenericTpaasEvent(input) {
595
- const dependencies = await this.prepareTpaasEvent();
596
- return (0, pulse_utils_1.pulseMerge)({}, input, (0, tpaas_event_builder_1.getCommonBuildersOutput)(new Date(), dependencies));
597
- }
598
594
  /**
599
595
  * This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
600
596
  *
@@ -616,6 +612,9 @@ class Tracker {
616
612
  * @category Tracking
617
613
  */
618
614
  addExperiments(experiments) {
615
+ if (experiments.some((experiment) => experiment.id.startsWith('sdrn:'))) {
616
+ loglevel_1.default.warn('Pulse - addExperiments received an experiment id starting with "sdrn:"; pass the raw experiment id instead. The SDK will generate the sdrn automatically.');
617
+ }
619
618
  this.update({ experiments }, true);
620
619
  }
621
620
  /**
@@ -1198,10 +1197,6 @@ class Tracker {
1198
1197
  await this.trackLeaveListing({
1199
1198
  leave,
1200
1199
  ...input,
1201
- object: {
1202
- ...input.object,
1203
- listingType: 'Tag,Story,Section,Search,Author,Other', // TODO: listingType is broken for this catalog. will be fixed in the next one
1204
- },
1205
1200
  });
1206
1201
  };
1207
1202
  (0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
@@ -37,8 +37,6 @@ const ARTICLE_PAYLOAD = {
37
37
  },
38
38
  },
39
39
  provider: {
40
- component: 'test-component',
41
- componentVersion: '1.0.0',
42
40
  product: 'test-product',
43
41
  stage: 'Dev',
44
42
  version: '1.0.0',
@@ -14,7 +14,7 @@ const pulse_utils_1 = require("@schibsted/pulse-utils");
14
14
  const warnOnce_1 = __importDefault(require("../warnOnce"));
15
15
  const consent_manager_1 = require("./consent-manager");
16
16
  /**
17
- * @enum ConsentCategory
17
+ * @enum ConsentsCategory
18
18
  */
19
19
  var ConsentsCategory;
20
20
  (function (ConsentsCategory) {
@@ -23,7 +23,7 @@ var ConsentsCategory;
23
23
  ConsentsCategory["CMP_ADVERTISING"] = "CMP_ADVERTISING";
24
24
  ConsentsCategory["CMP_PERSONALIZATION"] = "CMP_PERSONALIZATION";
25
25
  })(ConsentsCategory || (exports.ConsentsCategory = ConsentsCategory = {}));
26
- exports.ConsentsSourceValues = ['default', 'cmp', 'cache'];
26
+ exports.ConsentsSourceValues = ['default', 'cmp', 'cache', 'url'];
27
27
  exports.ConsentsPurposeCategoryStatusValues = ['accepted', 'rejected', 'unknown'];
28
28
  const isLegacyConsentsPurpose = (consentsPurposeCategory) => {
29
29
  return !consentsPurposeCategory?.status;
@@ -65,7 +65,7 @@ function routableEventDefaults(eventInput) {
65
65
  function routableEvent({ eventInput, sdkConfig } = {}) {
66
66
  return Object.assign({}, eventInput, {
67
67
  schema: eventInput?.schema ||
68
- `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/base-routable-event.json/246.json#`,
68
+ `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/base-routable-event.json/248.json#`,
69
69
  provider: (0, provider_1.default)(eventInput),
70
70
  actor: (0, actor_1.default)(eventInput),
71
71
  });
@@ -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/360.json`,
101
+ `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/361.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),
@@ -116,7 +116,7 @@ trackerEvent.defaults = trackerEventInput;
116
116
  function engagementEvent({ eventInput, sdkConfig } = {}) {
117
117
  return Object.assign(trackerEvent({ eventInput, sdkConfig }), {
118
118
  schema: eventInput?.schema ||
119
- `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/engagement-event.json/386.json`,
119
+ `http://${sdkConfig?.schemaLocation || exports.DEFAULT_SCHEMA_LOCATION}/events/engagement-event.json/388.json`,
120
120
  '@type': 'Engagement',
121
121
  });
122
122
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultValue = void 0;
4
+ exports.generateExperimentSDRN = generateExperimentSDRN;
4
5
  exports.default = experiments;
5
6
  function generateExperimentSDRN(id, experimentationPlatform) {
6
7
  return `sdrn:${experimentationPlatform}:experiment:${id}`;
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
4
  // This file is auto-generated by bin/generate-version.js. Do not edit manually.
5
- exports.SDK_VERSION = '8.0.0-rc.7';
5
+ exports.SDK_VERSION = '8.0.0-rc.9';
@@ -1,6 +1,6 @@
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, buildLeaveLockedAudioPageEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveSportsPageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildViewArticleEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioPageEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewSportsPageEvent, buildViewTitleEvent, buildViewVideoPageEvent, buildViewWeatherEvent, getCommonBuildersOutput, isPageType, } from '@schibsted/tpaas-event-builder';
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, buildLeaveLockedAudioPageEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveSportsPageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildViewArticleEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioPageEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewSportsPageEvent, buildViewTitleEvent, buildViewVideoPageEvent, buildViewWeatherEvent, isPageType, } from '@schibsted/tpaas-event-builder';
4
4
  import { LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudioPage, LeaveLockedVideoPage, LeavePage, LeaveSportsPage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewAudioPage, ViewError, ViewFrontpage, ViewHealthPage, ViewLandingpage, ViewListing, ViewLockedArticle, ViewLockedAudioPage, ViewLockedVideoPage, ViewPage, ViewSportsPage, ViewTitle, ViewVideoPage, ViewWeather, } from '@schibsted/tpaas-schemas';
5
5
  import logger from 'loglevel';
6
6
  import { v4 } from 'uuid';
@@ -10,6 +10,7 @@ import { getConsentsWaitForAnalytics, getFallbackConsents } from './builders/con
10
10
  import { applyAdvertisingConsent, applyAdvertisingConsentSync, } from './builders/consents';
11
11
  import { engagementEvent, identityEvent, routableEvent, trackerEvent } from './builders/events';
12
12
  import { anonymousEngagementEvent, anonymousTrackerEvent } from './builders/events-anonymous-node';
13
+ import { generateExperimentSDRN } from './builders/experiments';
13
14
  import { readSession } from './builders/session-browser';
14
15
  import { baseConfig as defaultConfig } from './config';
15
16
  import { CISEndpoints, collectorEndpoints, remoteConfig } from './config-browser';
@@ -195,6 +196,9 @@ export default class Tracker {
195
196
  if (!providerId || !(typeof providerId === 'string')) {
196
197
  throw new Error('Required parameter `providerId` missing');
197
198
  }
199
+ if (config?.componentVersion !== undefined && config?.component === undefined) {
200
+ throw new Error('`componentVersion` cannot be provided without `component`');
201
+ }
198
202
  let includeAdvertising;
199
203
  if (isBrowser && config?.autoCreateConsents) {
200
204
  config.consents = getConsentsWaitForAnalytics((consents) => {
@@ -238,6 +242,8 @@ export default class Tracker {
238
242
  this.builders = pulseMerge({}, builders, {
239
243
  provider: {
240
244
  id: providerId,
245
+ ...(config?.component !== undefined && { component: config.component }),
246
+ ...(config?.componentVersion !== undefined && { componentVersion: config.componentVersion }),
241
247
  },
242
248
  tracker: {
243
249
  version: SDK_VERSION,
@@ -428,7 +434,9 @@ export default class Tracker {
428
434
  return {
429
435
  name: exp.name || exp.id,
430
436
  variant: exp.variant || '',
431
- experimentSdrn: exp.id,
437
+ // nobody should be sending experiment id with an sdrn format, but in case they do
438
+ // we want to be able to handle it and not generate an invalid sdrn by adding another layer to it
439
+ experimentSdrn: exp.id.startsWith('sdrn:') ? exp.id : generateExperimentSDRN(exp.id, exp.platform),
432
440
  platform: exp.platform || '',
433
441
  testId: exp.custom?.testId,
434
442
  };
@@ -452,6 +460,8 @@ export default class Tracker {
452
460
  isHybrid: !!this.state.isHybrid,
453
461
  pageviewId: this.state.pageViewId,
454
462
  providerId: this.state.providerId,
463
+ component: this.state.component,
464
+ componentVersion: this.state.componentVersion,
455
465
  experiments: await this.adaptExperiments(this.builders.experiments),
456
466
  };
457
467
  }
@@ -529,6 +539,8 @@ export default class Tracker {
529
539
  user: adaptActorToNewFormat(actor),
530
540
  consents: adaptConsentsToNewFormat(consents),
531
541
  providerId: this.state.providerId,
542
+ component: this.state.component,
543
+ componentVersion: this.state.componentVersion,
532
544
  pageviewId: this.state.pageViewId,
533
545
  currentPage,
534
546
  experiments,
@@ -536,22 +548,6 @@ export default class Tracker {
536
548
  jwe,
537
549
  };
538
550
  }
539
- /**
540
- * Generate a generic TPaaS event with common builders output
541
- * The method should be used for experiments, not for real production work.
542
- * It doesn't have any real TPaaS schema associated with it.
543
- * The method doesn't queue or send the event, it just returns the merged object.
544
- * The method can be removed at any time in the future, so use it with caution.
545
- *
546
- * @param input - The input object to merge with the common builders output
547
- * @returns A promise that resolves to the merged object
548
- * @private
549
- * @category TPaaS Tracking
550
- */
551
- async generateGenericTpaasEvent(input) {
552
- const dependencies = await this.prepareTpaasEvent();
553
- return pulseMerge({}, input, getCommonBuildersOutput(new Date(), dependencies));
554
- }
555
551
  /**
556
552
  * This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
557
553
  *
@@ -573,6 +569,9 @@ export default class Tracker {
573
569
  * @category Tracking
574
570
  */
575
571
  addExperiments(experiments) {
572
+ if (experiments.some((experiment) => experiment.id.startsWith('sdrn:'))) {
573
+ logger.warn('Pulse - addExperiments received an experiment id starting with "sdrn:"; pass the raw experiment id instead. The SDK will generate the sdrn automatically.');
574
+ }
576
575
  this.update({ experiments }, true);
577
576
  }
578
577
  /**
@@ -1155,10 +1154,6 @@ export default class Tracker {
1155
1154
  await this.trackLeaveListing({
1156
1155
  leave,
1157
1156
  ...input,
1158
- object: {
1159
- ...input.object,
1160
- listingType: 'Tag,Story,Section,Search,Author,Other', // TODO: listingType is broken for this catalog. will be fixed in the next one
1161
- },
1162
1157
  });
1163
1158
  };
1164
1159
  addTpaasLeaveTracking({
@@ -32,8 +32,6 @@ const ARTICLE_PAYLOAD = {
32
32
  },
33
33
  },
34
34
  provider: {
35
- component: 'test-component',
36
- componentVersion: '1.0.0',
37
35
  product: 'test-product',
38
36
  stage: 'Dev',
39
37
  version: '1.0.0',
@@ -3,7 +3,7 @@ import { isPromise } from '@schibsted/pulse-utils';
3
3
  import warnOnce from '../warnOnce';
4
4
  import { getFallbackConsents } from './consent-manager';
5
5
  /**
6
- * @enum ConsentCategory
6
+ * @enum ConsentsCategory
7
7
  */
8
8
  export var ConsentsCategory;
9
9
  (function (ConsentsCategory) {
@@ -12,7 +12,7 @@ export var ConsentsCategory;
12
12
  ConsentsCategory["CMP_ADVERTISING"] = "CMP_ADVERTISING";
13
13
  ConsentsCategory["CMP_PERSONALIZATION"] = "CMP_PERSONALIZATION";
14
14
  })(ConsentsCategory || (ConsentsCategory = {}));
15
- export const ConsentsSourceValues = ['default', 'cmp', 'cache'];
15
+ export const ConsentsSourceValues = ['default', 'cmp', 'cache', 'url'];
16
16
  export const ConsentsPurposeCategoryStatusValues = ['accepted', 'rejected', 'unknown'];
17
17
  const isLegacyConsentsPurpose = (consentsPurposeCategory) => {
18
18
  return !consentsPurposeCategory?.status;
@@ -22,7 +22,7 @@ function routableEventDefaults(eventInput) {
22
22
  export function routableEvent({ eventInput, sdkConfig } = {}) {
23
23
  return Object.assign({}, eventInput, {
24
24
  schema: eventInput?.schema ||
25
- `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/base-routable-event.json/246.json#`,
25
+ `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/base-routable-event.json/248.json#`,
26
26
  provider: providerBuilder(eventInput),
27
27
  actor: actorBuilder(eventInput),
28
28
  });
@@ -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/360.json`,
58
+ `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/tracker-event.json/361.json`,
59
59
  actor: actorBuilder(parentInput),
60
60
  consents: consentsBuilder(parentInput),
61
61
  experiments: experimentsBuilder(parentInput),
@@ -73,7 +73,7 @@ trackerEvent.defaults = trackerEventInput;
73
73
  export function engagementEvent({ eventInput, sdkConfig } = {}) {
74
74
  return Object.assign(trackerEvent({ eventInput, sdkConfig }), {
75
75
  schema: eventInput?.schema ||
76
- `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/engagement-event.json/386.json`,
76
+ `http://${sdkConfig?.schemaLocation || DEFAULT_SCHEMA_LOCATION}/events/engagement-event.json/388.json`,
77
77
  '@type': 'Engagement',
78
78
  });
79
79
  }
@@ -1,4 +1,4 @@
1
- function generateExperimentSDRN(id, experimentationPlatform) {
1
+ export function generateExperimentSDRN(id, experimentationPlatform) {
2
2
  return `sdrn:${experimentationPlatform}:experiment:${id}`;
3
3
  }
4
4
  /**
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated by bin/generate-version.js. Do not edit manually.
2
- export const SDK_VERSION = '8.0.0-rc.7';
2
+ export const SDK_VERSION = '8.0.0-rc.9';
@@ -1,6 +1,5 @@
1
1
  import { type AdvertisingIdentifiers, type AdvertisingVendor } from '@schibsted/pulse-cis-sync';
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 ILeaveLockedAudioPage, type ILeaveLockedVideoPage, type ILeavePage, type ILeaveSportsPage, type ILeaveVideoPage, type ILeaveWeather, type ITpaasEvent, type IViewArticle, type IViewAudioPage, type IViewError, type IViewFrontpage, type IViewHealthPage, type IViewLandingpage, type IViewListing, type IViewLockedArticle, type IViewLockedAudioPage, type IViewLockedVideoPage, type IViewPage, type IViewSportsPage, type IViewTitle, type IViewVideoPage, type IViewWeather } from '@schibsted/tpaas-schemas';
2
+ 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 ILeaveLockedAudioPage, type ILeaveLockedVideoPage, type ILeavePage, type ILeaveSportsPage, type ILeaveVideoPage, type ILeaveWeather, type InputParams, type IProvider, type ITpaasEvent, type IViewArticle, type IViewAudioPage, type IViewError, type IViewFrontpage, type IViewHealthPage, type IViewLandingpage, type IViewListing, type IViewLockedArticle, type IViewLockedAudioPage, type IViewLockedVideoPage, type IViewPage, type IViewSportsPage, type IViewTitle, type IViewVideoPage, type IViewWeather } from '@schibsted/tpaas-schemas';
4
3
  import logger from 'loglevel';
5
4
  import type { ActorInput, Consents, ConsentsInput, DeviceInput, LocationInput, ObjectInput, OriginInput, ProviderInput, TrackerInput } from './builders';
6
5
  import { engagementEvent, identityEvent, routableEvent, trackerEvent } from './builders/events';
@@ -82,6 +81,16 @@ export interface SDKConfigInput {
82
81
  * @see requireAdvertisingOptIn
83
82
  */
84
83
  adChoicesEnabled?: boolean;
84
+ /**
85
+ * The component name to include in tracked events.
86
+ * Automatically populated as `.provider.component` for both TPaaS and legacy events.
87
+ */
88
+ component?: IProvider['component'];
89
+ /**
90
+ * The component version to include in tracked events.
91
+ * Automatically populated as `.provider.componentVersion` for both TPaaS and legacy events.
92
+ */
93
+ componentVersion?: IProvider['componentVersion'];
85
94
  /**
86
95
  * Function handler to call in place of the built-in tracker call.
87
96
  * @function
@@ -389,19 +398,6 @@ export default class Tracker {
389
398
  * @category TPaaS Tracking
390
399
  */
391
400
  private prepareTpaasEvent;
392
- /**
393
- * Generate a generic TPaaS event with common builders output
394
- * The method should be used for experiments, not for real production work.
395
- * It doesn't have any real TPaaS schema associated with it.
396
- * The method doesn't queue or send the event, it just returns the merged object.
397
- * The method can be removed at any time in the future, so use it with caution.
398
- *
399
- * @param input - The input object to merge with the common builders output
400
- * @returns A promise that resolves to the merged object
401
- * @private
402
- * @category TPaaS Tracking
403
- */
404
- generateGenericTpaasEvent<T>(input: T): Promise<T & ReturnType<typeof getCommonBuildersOutput>>;
405
401
  /**
406
402
  * This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
407
403
  *
@@ -1,6 +1,6 @@
1
1
  import type { TrackerEventInput } from './events';
2
2
  /**
3
- * @enum ConsentCategory
3
+ * @enum ConsentsCategory
4
4
  */
5
5
  export declare enum ConsentsCategory {
6
6
  CMP_ANALYTICS = "CMP_ANALYTICS",
@@ -8,7 +8,7 @@ export declare enum ConsentsCategory {
8
8
  CMP_ADVERTISING = "CMP_ADVERTISING",
9
9
  CMP_PERSONALIZATION = "CMP_PERSONALIZATION"
10
10
  }
11
- export declare const ConsentsSourceValues: readonly ["default", "cmp", "cache"];
11
+ export declare const ConsentsSourceValues: readonly ["default", "cmp", "cache", "url"];
12
12
  export type ConsentsSource = (typeof ConsentsSourceValues)[number];
13
13
  export declare const ConsentsPurposeCategoryStatusValues: readonly ["accepted", "rejected", "unknown"];
14
14
  export type ConsentsPurposeCategoryStatus = (typeof ConsentsPurposeCategoryStatusValues)[number];
@@ -1,4 +1,5 @@
1
1
  import type { TrackerEventInput } from './events';
2
+ export declare function generateExperimentSDRN(id?: string | number, experimentationPlatform?: string): string;
2
3
  /**
3
4
  * The necessary values to construct a valid "sdrn" for experiment.
4
5
  * Additional properties are allowed.
@@ -1,6 +1,6 @@
1
1
  export type { ActorInput } from './actor';
2
2
  export * as actor from './actor';
3
- export type { ConsentCategory, ConsentedToPurposeInput, ConsentPurposeCategory, Consents, ConsentsInput, ConsentsOutput, } from './consents';
3
+ export type { ConsentCategory, ConsentedToPurposeInput, ConsentPurposeCategory, Consents, ConsentsCategory, ConsentsInput, ConsentsOutput, ConsentsPurposeCategory, } from './consents';
4
4
  export * as consents from './consents';
5
5
  export type { DeviceInput } from './device';
6
6
  export * as device from './device';
@@ -5,7 +5,6 @@ export { TrackerEventInput } from './builders/events-node';
5
5
  export * from './Tracker';
6
6
  export { EventInput } from './types';
7
7
  export { T as Tracker };
8
- export type { InputParams } from '@schibsted/tpaas-event-builder';
9
8
  export * from '@schibsted/tpaas-schemas';
10
9
  export type { IPulseTrackerCreateParams } from './createPulseTracker';
11
10
  export { createPulseTracker } from './createPulseTracker';
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "8.0.0-rc.7";
1
+ export declare const SDK_VERSION = "8.0.0-rc.9";
@@ -2,11 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.builder = builder;
4
4
  const generateProviderSDRN = (providerId) => `sdrn:schibsted:client:${providerId}`;
5
- function builder(providerId) {
5
+ function builder(providerId, component, componentVersion) {
6
6
  return {
7
7
  provider: {
8
8
  providerId,
9
9
  providerSdrn: generateProviderSDRN(providerId),
10
+ ...(component !== undefined && { component }),
11
+ ...(componentVersion !== undefined && { componentVersion }),
10
12
  },
11
13
  };
12
14
  }