Skip to content

Commit 4abe267

Browse files
🤖 Merge PR DefinitelyTyped#72179 Feature/pxr oneline add two missing methods show cmp and loadscript by @diogopxrnextday
1 parent be35a31 commit 4abe267

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

‎types/pxr-oneline/index.d.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ declare namespace OneLine {
44
adUnitRequest(arrFoAdIds?: string[], allowReload?: boolean): void;
55
preBidAdUnit(prebidBids: PrebidBids, gtag: string, isDebug: boolean): any;
66
requestVideoPlayerAds(onBiddingComplete: () => void): void;
7+
showCmp(): void;
8+
loadScript(src: string, priority: 'async' | 'defer' | 'instant' | 'async'): void;
79
buildVideoUrl(
810
bidder: BidderConfig[],
911
placementID: string,
@@ -72,6 +74,5 @@ declare namespace OneLine {
7274
type NoParamFunction = () => void;
7375
type ParamFunction = (arg: any) => void;
7476
}
75-
7677
declare const OneLine: OneLine.OneLine;
77-
export = OneLine;
78+
export = OneLine;

‎types/pxr-oneline/oneline-tests.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ const ndOne: OneLine.OneLine = {
7171
// This is a mock implementation and should be replaced with your actual logic
7272
return `https://example.com/video?placement=${placementID}&bidder=${bidder.map(b => b.bidder).join(",")}`;
7373
},
74+
showCmp: () => {
75+
// Mock implementation for showCmp
76+
console.log('Showing CMP screen...');
77+
const currentDomain = window.location.origin;
78+
if (currentDomain) {
79+
console.log(`Redirecting to: ${currentDomain}/#cmpscreen`);
80+
} else {
81+
console.warn("NDM: Unable to show CMP");
82+
}
83+
},
84+
loadScript: (src: string, priority: 'async' | 'defer' | 'instant' | 'async'): void => {
85+
// Mock implementation for loadScript
86+
console.log(`Loading script from: ${src} with priority: ${priority}`);
87+
},
7488
};
7589

7690
// Test cases
@@ -80,4 +94,4 @@ ndOne.adUnitRequest(["push-up-all"], true);
8094
ndOne.buildVideoUrl([{ bidder: "testBidder", params: { placementId: "testPlacementId" } }], "testPlacementId", {});
8195
ndOne.requestVideoPlayerAds(() => {
8296
console.log("Video player ads bidding complete");
83-
});
97+
});

0 commit comments

Comments
 (0)