@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.
- package/dist/cjs/Tracker.js +16 -21
- package/dist/cjs/Tracker.test-d.js +0 -2
- package/dist/cjs/builders/consents.js +2 -2
- package/dist/cjs/builders/events-node.js +3 -3
- package/dist/cjs/builders/experiments.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/ejs/Tracker.js +17 -22
- package/dist/ejs/Tracker.test-d.js +0 -2
- package/dist/ejs/builders/consents.js +2 -2
- package/dist/ejs/builders/events-node.js +3 -3
- package/dist/ejs/builders/experiments.js +1 -1
- package/dist/ejs/version.js +1 -1
- package/dist/types/Tracker.d.ts +11 -15
- package/dist/types/builders/consents.d.ts +2 -2
- package/dist/types/builders/experiments.d.ts +1 -0
- package/dist/types/builders/index.d.ts +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +3 -1
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +53 -51
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +3 -1
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +53 -51
- package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +66 -49
- package/node_modules/@schibsted/tpaas-event-builder/package.json +1 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/cjs/constants.js +56 -56
- package/node_modules/@schibsted/tpaas-schemas/dist/cjs/index.js +1 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/cjs/types.js +2 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/ejs/constants.js +56 -56
- package/node_modules/@schibsted/tpaas-schemas/dist/ejs/index.js +1 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/ejs/types.js +1 -0
- package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +129 -72
- package/package.json +5 -5
|
@@ -316,6 +316,7 @@ interface ICancelSubscription {
|
|
|
316
316
|
/**
|
|
317
317
|
* The environmentId.
|
|
318
318
|
* @pattern ^[0-9a-fA-F-]+$
|
|
319
|
+
* @example "42401e1f-7e04-4b73-8bed-1ceffc0ed8cc"
|
|
319
320
|
*/
|
|
320
321
|
environmentId: string;
|
|
321
322
|
};
|
|
@@ -539,14 +540,17 @@ interface IChangePushNotificationSettings {
|
|
|
539
540
|
interface IHealthOrigin {
|
|
540
541
|
/**
|
|
541
542
|
* The specific UI element or component that navigated to this page.
|
|
543
|
+
* @example "logging_hq_button"
|
|
542
544
|
*/
|
|
543
545
|
content?: string;
|
|
544
546
|
/**
|
|
545
547
|
* The feature area that navigated to this page
|
|
548
|
+
* @example "meal_logging"
|
|
546
549
|
*/
|
|
547
550
|
feature?: string;
|
|
548
551
|
/**
|
|
549
552
|
* The origin name / place that the user navigated from.
|
|
553
|
+
* @example "logbook"
|
|
550
554
|
*/
|
|
551
555
|
name?: string;
|
|
552
556
|
}
|
|
@@ -575,9 +579,9 @@ interface IContent {
|
|
|
575
579
|
*/
|
|
576
580
|
contentType: "Article" | "LiveArticle" | "SpecialArticle" | "Podcast" | "Episode" | "Audiobook" | "AudiobookSample" | "Movie" | "Series" | "Story";
|
|
577
581
|
/**
|
|
578
|
-
* The
|
|
582
|
+
* The namespace that the target content belongs to, for example its newsroom
|
|
579
583
|
*/
|
|
580
|
-
|
|
584
|
+
namespace: string;
|
|
581
585
|
/**
|
|
582
586
|
* A list of product features that give access to this content. (Uses OR, i.e., having one is enough for access.)
|
|
583
587
|
*/
|
|
@@ -1265,15 +1269,11 @@ interface IPlacement {
|
|
|
1265
1269
|
* The context in which the recommendation was made.
|
|
1266
1270
|
*/
|
|
1267
1271
|
curateContext?: string;
|
|
1268
|
-
/**
|
|
1269
|
-
* The source of the impression/engagement.
|
|
1270
|
-
*/
|
|
1271
|
-
curateSource?: string;
|
|
1272
1272
|
/**
|
|
1273
1273
|
* Indicator if the player was visible at pageload (“above”) or if the user had to scroll to it (“below”).
|
|
1274
1274
|
*/
|
|
1275
1275
|
foldPosition: "Above" | "Below" | "Unknown";
|
|
1276
|
-
positionInBundle
|
|
1276
|
+
positionInBundle?: number;
|
|
1277
1277
|
/**
|
|
1278
1278
|
* The parent’s primary direction along which components are laid out.
|
|
1279
1279
|
*/
|
|
@@ -2662,6 +2662,7 @@ interface IInternalAccessDecision {
|
|
|
2662
2662
|
deviceType?: "Desktop" | "Mobile" | "Tablet" | "SmartTv" | "Other";
|
|
2663
2663
|
/**
|
|
2664
2664
|
* The environment ID.
|
|
2665
|
+
* @example "42401e1f-7e04-4b73-8bed-1ceffc0ed8cc"
|
|
2665
2666
|
*/
|
|
2666
2667
|
environmentId: string;
|
|
2667
2668
|
/**
|
|
@@ -2684,7 +2685,7 @@ interface IInternalAccessDecision {
|
|
|
2684
2685
|
eventType: "Internal";
|
|
2685
2686
|
experiments?: IExperiments;
|
|
2686
2687
|
object: {
|
|
2687
|
-
arm
|
|
2688
|
+
arm?: {
|
|
2688
2689
|
/**
|
|
2689
2690
|
* Unique ID of the experimental arm the user is assigned to.
|
|
2690
2691
|
*/
|
|
@@ -2698,6 +2699,18 @@ interface IInternalAccessDecision {
|
|
|
2698
2699
|
*/
|
|
2699
2700
|
config: {
|
|
2700
2701
|
armId: string;
|
|
2702
|
+
rctProbabilities?: {
|
|
2703
|
+
/**
|
|
2704
|
+
* @minimum 0
|
|
2705
|
+
* @maximum 1
|
|
2706
|
+
*/
|
|
2707
|
+
close: number;
|
|
2708
|
+
/**
|
|
2709
|
+
* @minimum 0
|
|
2710
|
+
* @maximum 1
|
|
2711
|
+
*/
|
|
2712
|
+
open: number;
|
|
2713
|
+
};
|
|
2701
2714
|
version: string;
|
|
2702
2715
|
/**
|
|
2703
2716
|
* @minimum 0
|
|
@@ -2741,7 +2754,7 @@ interface IInternalAccessDecision {
|
|
|
2741
2754
|
* Categorization of how the decision was made.
|
|
2742
2755
|
*/
|
|
2743
2756
|
decisionType: "Policy" | "Replay" | "Fallback";
|
|
2744
|
-
episode
|
|
2757
|
+
episode?: {
|
|
2745
2758
|
/**
|
|
2746
2759
|
* End time of the episode in UTC.
|
|
2747
2760
|
* @format date-time
|
|
@@ -2757,6 +2770,10 @@ interface IInternalAccessDecision {
|
|
|
2757
2770
|
*/
|
|
2758
2771
|
startAt: string;
|
|
2759
2772
|
};
|
|
2773
|
+
/**
|
|
2774
|
+
* Internal Decision System error that caused the fallback.
|
|
2775
|
+
*/
|
|
2776
|
+
fallbackReason?: "EngineTimeout" | "EpisodeReadError" | "EpisodeWriteError" | "RequestCountError" | "ArmReadError" | "ArmWriteError";
|
|
2760
2777
|
/**
|
|
2761
2778
|
* The type of the object.
|
|
2762
2779
|
*/
|
|
@@ -2778,10 +2795,6 @@ interface IInternalAccessDecision {
|
|
|
2778
2795
|
schema: string;
|
|
2779
2796
|
target: {
|
|
2780
2797
|
content: {
|
|
2781
|
-
/**
|
|
2782
|
-
* The access restriction placed on the content.
|
|
2783
|
-
*/
|
|
2784
|
-
accessLevel?: "Free" | "Login" | "Meter" | "Paid" | "Dynamic";
|
|
2785
2798
|
/**
|
|
2786
2799
|
* The format that this content is presented in.
|
|
2787
2800
|
*/
|
|
@@ -2794,6 +2807,11 @@ interface IInternalAccessDecision {
|
|
|
2794
2807
|
* The subtype of the content.
|
|
2795
2808
|
*/
|
|
2796
2809
|
contentType?: "Article" | "LiveArticle" | "SpecialArticle" | "Podcast" | "Episode" | "Audiobook" | "AudiobookSample" | "Movie" | "Series" | "Story";
|
|
2810
|
+
layout?: string;
|
|
2811
|
+
/**
|
|
2812
|
+
* @minimum 1
|
|
2813
|
+
*/
|
|
2814
|
+
layoutPosition?: number;
|
|
2797
2815
|
/**
|
|
2798
2816
|
* The id of the provider that requested the access decision and where the result will be shown (svdse). Note: Not the same as .provider.providerId.
|
|
2799
2817
|
*/
|
|
@@ -3413,9 +3431,8 @@ interface ILeaveListing {
|
|
|
3413
3431
|
itemsTotal: number;
|
|
3414
3432
|
/**
|
|
3415
3433
|
* The type of listing page, e.g. 'tag', 'section' etc.
|
|
3416
|
-
* @pattern Tag,Story,Section,Search,Author,Other
|
|
3417
3434
|
*/
|
|
3418
|
-
listingType:
|
|
3435
|
+
listingType: "Tag" | "Story" | "Section" | "Search" | "Author" | "Other";
|
|
3419
3436
|
/**
|
|
3420
3437
|
* The unique ID of this page.
|
|
3421
3438
|
*/
|
|
@@ -4191,6 +4208,7 @@ interface IPurchaseSubscription {
|
|
|
4191
4208
|
/**
|
|
4192
4209
|
* The environmentId.
|
|
4193
4210
|
* @pattern ^[0-9a-fA-F-]+$
|
|
4211
|
+
* @example "42401e1f-7e04-4b73-8bed-1ceffc0ed8cc"
|
|
4194
4212
|
*/
|
|
4195
4213
|
environmentId?: string;
|
|
4196
4214
|
};
|
|
@@ -4285,6 +4303,7 @@ interface IPurchaseSubscription {
|
|
|
4285
4303
|
utm?: IUtmTags;
|
|
4286
4304
|
/**
|
|
4287
4305
|
* The session ID on a partner domain (set via query parameter), else the current session ID. This value is used to connect cross-domain events such as behavior events to purchase events.
|
|
4306
|
+
* @example "079bc17a-4ee8-42ab-a29f-2fbba4cd403f"
|
|
4288
4307
|
*/
|
|
4289
4308
|
xDomainId?: string;
|
|
4290
4309
|
};
|
|
@@ -5527,31 +5546,7 @@ interface IViewWeather {
|
|
|
5527
5546
|
user?: IUser;
|
|
5528
5547
|
}
|
|
5529
5548
|
type ITpaasEvent = IAnonymousViewUIElement | ICancelSubscription | IChangePushNotificationSettings | ICompletedHealthAction | IEngagementAudio | IEngagementForm | IEngagementHealthUIElement | IEngagementNotification | IEngagementOffer | IEngagementTeaser | IEngagementUIElement | IEngagementVideo | IEngagementVideoAd | IEngagementWidget | IImpressionAdSlot | IImpressionForm | IImpressionHealthUIElement | IImpressionNotification | IImpressionOffer | IImpressionPlayer | IImpressionTeaser | IImpressionUIElement | IImpressionWidget | IInternalAccessDecision | IInternalProbe | ILaunchApp | ILeaveArticle | ILeaveAudioPage | ILeaveError | ILeaveFrontpage | ILeaveLandingpage | ILeaveListing | ILeaveLockedArticle | ILeaveLockedAudioPage | ILeaveLockedVideoPage | ILeavePage | ILeaveSportsPage | ILeaveVideoPage | ILeaveWeather | IPurchaseSubscription | IViewArticle | IViewAudioPage | IViewError | IViewFrontpage | IViewHealthPage | IViewLandingpage | IViewListing | IViewLockedArticle | IViewLockedAudioPage | IViewLockedVideoPage | IViewPage | IViewSportsPage | IViewTitle | IViewVideoPage | IViewWeather;
|
|
5530
|
-
type
|
|
5531
|
-
id: string;
|
|
5532
|
-
realm: string;
|
|
5533
|
-
};
|
|
5534
|
-
/**
|
|
5535
|
-
* @private
|
|
5536
|
-
*
|
|
5537
|
-
* @privateRemarks
|
|
5538
|
-
* These can be different from one event type to another, depending on the builders used by that event type.
|
|
5539
|
-
* However, for now, we use the same dependencies for all event types. let's make it more complex only if needed.
|
|
5540
|
-
*/
|
|
5541
|
-
export interface TpaasEventBuilderDependencies {
|
|
5542
|
-
user?: UserParams;
|
|
5543
|
-
autoTrackerVersion: ITracker["autoTrackerVersion"];
|
|
5544
|
-
version: ITracker["version"];
|
|
5545
|
-
isHybrid: ITracker["isHybrid"];
|
|
5546
|
-
consents?: IConsents;
|
|
5547
|
-
providerId: IProvider["providerId"];
|
|
5548
|
-
environmentId: IDevice["environmentId"];
|
|
5549
|
-
jwe: IDevice["jweIds"];
|
|
5550
|
-
pageviewId: string;
|
|
5551
|
-
experiments?: IExperiments;
|
|
5552
|
-
currentPage?: IPageRef;
|
|
5553
|
-
}
|
|
5554
|
-
type OmittedProperties = "user" | "eventId" | "consents" | "device" | "time" | "tracker" | "session" | "eventType" | "schema" | "object.objectType" | "isAnonymous" | "provider.providerId" | "provider.providerSdrn" | "page.pageviewId" | "page.utm" | "page.info" | "page.referrer.url" | "catalogVersion";
|
|
5549
|
+
type OmittedProperties = "user" | "eventId" | "consents" | "device" | "time" | "tracker" | "session" | "eventType" | "schema" | "object.objectType" | "isAnonymous" | "provider.providerId" | "provider.providerSdrn" | "provider.component" | "provider.componentVersion" | "page.pageviewId" | "page.utm" | "page.info" | "page.referrer.url" | "catalogVersion";
|
|
5555
5550
|
type DeepOmit<T, K extends string> = T extends readonly unknown[] ? T : T extends object ? {
|
|
5556
5551
|
[P in keyof T as P extends K ? never : P]: DeepOmit<T[P], K extends `${Exclude<P, symbol>}.${infer R}` ? R : never>;
|
|
5557
5552
|
} extends infer Result ? {
|
|
@@ -5574,25 +5569,46 @@ type OptionalNavigationType<T> = T extends {
|
|
|
5574
5569
|
navigationType?: N;
|
|
5575
5570
|
};
|
|
5576
5571
|
} : T;
|
|
5572
|
+
type WithOptionalPage<T> = T extends TpaasOptionalPageSchemas ? Omit<T, "page"> & {
|
|
5573
|
+
page?: T["page"];
|
|
5574
|
+
} : T;
|
|
5575
|
+
type TpaasOptionalPageSchemas = IAnonymousViewUIElement | ICompletedHealthAction | IEngagementAudio | IEngagementForm | IEngagementHealthUIElement | IEngagementOffer | IEngagementTeaser | IEngagementUIElement | IEngagementVideo | IEngagementVideoAd | IEngagementWidget | IImpressionAdSlot | IImpressionForm | IImpressionHealthUIElement | IImpressionOffer | IImpressionPlayer | IImpressionTeaser | IImpressionUIElement | IImpressionWidget | ILeaveAudioPage | ILeaveError | ILeaveFrontpage | ILeaveLandingpage | ILeaveListing | ILeaveLockedAudioPage | ILeaveLockedVideoPage | ILeavePage | ILeaveSportsPage | ILeaveVideoPage | ILeaveWeather | IViewAudioPage | IViewError | IViewFrontpage | IViewHealthPage | IViewLandingpage | IViewListing | IViewLockedAudioPage | IViewLockedVideoPage | IViewPage | IViewSportsPage | IViewTitle | IViewVideoPage | IViewWeather;
|
|
5576
|
+
type InputParams<T extends ITpaasEvent> = DeepOmit<OptionalNavigationType<WithOptionalPage<T>>, OmittedProperties>;
|
|
5577
|
+
type UserParams = Pick<IUser, "hasAnySubscription" | "region"> & {
|
|
5578
|
+
id: string;
|
|
5579
|
+
realm: string;
|
|
5580
|
+
};
|
|
5577
5581
|
/**
|
|
5578
|
-
* InputParams is a utility type that omits certain properties from a given type T.
|
|
5579
|
-
* @param T - The type from which properties will be omitted.
|
|
5580
5582
|
* @private
|
|
5581
5583
|
*
|
|
5582
5584
|
* @privateRemarks
|
|
5585
|
+
* These can be different from one event type to another, depending on the builders used by that event type.
|
|
5586
|
+
* However, for now, we use the same dependencies for all event types. let's make it more complex only if needed.
|
|
5583
5587
|
*/
|
|
5584
|
-
export
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5588
|
+
export interface TpaasEventBuilderDependencies {
|
|
5589
|
+
user?: UserParams;
|
|
5590
|
+
autoTrackerVersion: ITracker["autoTrackerVersion"];
|
|
5591
|
+
version: ITracker["version"];
|
|
5592
|
+
isHybrid: ITracker["isHybrid"];
|
|
5593
|
+
consents?: IConsents;
|
|
5594
|
+
providerId: IProvider["providerId"];
|
|
5595
|
+
component?: IProvider["component"];
|
|
5596
|
+
componentVersion?: IProvider["componentVersion"];
|
|
5597
|
+
environmentId: IDevice["environmentId"];
|
|
5598
|
+
jwe: IDevice["jweIds"];
|
|
5599
|
+
pageviewId: string;
|
|
5600
|
+
experiments?: IExperiments;
|
|
5601
|
+
currentPage?: IPageRef;
|
|
5602
|
+
}
|
|
5589
5603
|
/**
|
|
5590
5604
|
* Common builders output to be merged into all events
|
|
5591
5605
|
* @param createdAt
|
|
5592
5606
|
* @param dependencies {TpaasEventBuilderDependencies}
|
|
5593
5607
|
* @private
|
|
5594
5608
|
*/
|
|
5595
|
-
export declare const getCommonBuildersOutput: (createdAt: Date,
|
|
5609
|
+
export declare const getCommonBuildersOutput: (createdAt: Date, dependencies: TpaasEventBuilderDependencies, input: InputParams<Extract<ITpaasEvent, {
|
|
5610
|
+
experiments?: IExperiments;
|
|
5611
|
+
}>>) => {
|
|
5596
5612
|
time: {
|
|
5597
5613
|
createdAt: string;
|
|
5598
5614
|
publishedAt: string | undefined;
|
|
@@ -5647,12 +5663,13 @@ export declare const getCommonBuildersOutput: (createdAt: Date, { autoTrackerVer
|
|
|
5647
5663
|
trackerType: "JS" | "IOS" | "Android" | "Backend";
|
|
5648
5664
|
};
|
|
5649
5665
|
catalogVersion: string;
|
|
5666
|
+
experiments: IExperiments | undefined;
|
|
5650
5667
|
provider: {
|
|
5651
5668
|
providerId: string;
|
|
5652
5669
|
providerSdrn: string;
|
|
5653
5670
|
};
|
|
5654
5671
|
};
|
|
5655
|
-
export declare function buildAnonymousViewUIElementEvent(input: InputParams<IAnonymousViewUIElement>, dependencies: Pick<TpaasEventBuilderDependencies, "autoTrackerVersion" | "isHybrid" | "version" | "pageviewId" | "providerId" | "experiments">): IAnonymousViewUIElement;
|
|
5672
|
+
export declare function buildAnonymousViewUIElementEvent(input: InputParams<IAnonymousViewUIElement>, dependencies: Pick<TpaasEventBuilderDependencies, "autoTrackerVersion" | "isHybrid" | "version" | "pageviewId" | "providerId" | "experiments" | "component" | "componentVersion">): IAnonymousViewUIElement;
|
|
5656
5673
|
export declare function buildViewArticleEvent(input: InputParams<IViewArticle>, dependencies: TpaasEventBuilderDependencies): IViewArticle;
|
|
5657
5674
|
export declare function buildViewAudioPageEvent(input: InputParams<IViewAudioPage>, dependencies: TpaasEventBuilderDependencies): IViewAudioPage;
|
|
5658
5675
|
export declare function buildViewErrorEvent(input: InputParams<IViewError>, dependencies: TpaasEventBuilderDependencies): IViewError;
|