Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions types/google-publisher-tag/google-publisher-tag-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Tests for Google Publisher Tag 1.20250728
// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/02d9acb6d6e8578a1a5fc39691ec36cd799f0a6b
// Tests for Google Publisher Tag 1.20250811
// Synced from: https://github.com/googleads/google-publisher-tag-types/commit/a3d900bc56c2ce535e539ce139d7e59bc9fe7be4

// Test for googletag.cmd
function test_googletag_cmd() {
Expand Down Expand Up @@ -1210,6 +1210,27 @@ function test_googletag_events_rewardedSlotClosedEvent() {
}
}

// Test for googletag.events.RewardedSlotVideoCompletedEvent
function test_googletag_events_rewardedSlotVideoCompletedEvent() {
const targetSlot = googletag.defineOutOfPageSlot("/1234567/example", googletag.enums.OutOfPageFormat.REWARDED);

// Slot returns null if the page or device does not support rewarded ads.
if (targetSlot) {
targetSlot.addService(googletag.pubads());

// This listener is called when the video in a rewarded ad slot has
// finished playing.
googletag.pubads().addEventListener("rewardedSlotVideoCompleted", event => {
const slot = event.slot;
console.log("Video in rewarded ad slot", slot.getSlotElementId(), "has finished playing.");

if (slot === targetSlot) {
// Slot specific logic.
}
});
}
}

// Test for googletag.events.RewardedSlotReadyEvent
function test_googletag_events_rewardedSlotReadyEvent() {
// This listener is called when a rewarded ad slot becomes ready to be
Expand Down
50 changes: 47 additions & 3 deletions types/google-publisher-tag/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2151,7 +2151,7 @@ declare namespace googletag {
* @see [Collapse empty ad slots](https://developers.google.com/publisher-tag/samples/collapse-empty-ad-slots)
* @see [Minimize layout shift](https://developers.google.com/publisher-tag/guides/minimize-layout-shift)
*/
collapseDiv?: "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL" | null;
collapseDiv?: CollapseDivBehavior | null;

/**
* Setting to enable or disable Single Request Architecture (SRA).
Expand Down Expand Up @@ -2263,6 +2263,14 @@ declare namespace googletag {
adsenseAttributes?: AdSenseAttributesConfig | null;
}

/**
* Supported values for controlling the collapsing behavior of ad slots.
*
* @see {@link googletag.config.PageSettingsConfig.collapseDiv | PageSettingsConfig.collapseDiv}
* @see {@link googletag.config.SlotSettingsConfig.collapseDiv | SlotSettingsConfig.collapseDiv}
*/
type CollapseDivBehavior = "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL";

/**
* Settings to control publisher privacy treatments.
*/
Expand Down Expand Up @@ -2565,7 +2573,7 @@ declare namespace googletag {
* @see [Collapse empty ad slots](https://developers.google.com/publisher-tag/samples/collapse-empty-ad-slots)
* @see [Minimize layout shift](https://developers.google.com/publisher-tag/guides/minimize-layout-shift)
*/
collapseDiv?: "DISABLED" | "BEFORE_FETCH" | "ON_NO_FILL" | null;
collapseDiv?: CollapseDivBehavior | null;

/**
* Setting to configure ad category exclusions.
Expand Down Expand Up @@ -3344,10 +3352,41 @@ declare namespace googletag {
* @see [Ad event listeners](https://developers.google.com/publisher-tag/samples/ad-event-listeners)
* @see [Display a rewarded ad](https://developers.google.com/publisher-tag/samples/display-rewarded-ad)
*/

// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface RewardedSlotClosedEvent extends Event {}

/**
* This event is fired when a rewarded video ad has finished playing.
* @example
* const targetSlot = googletag.defineOutOfPageSlot(
* '/1234567/example',
* googletag.enums.OutOfPageFormat.REWARDED);
*
* // Slot returns null if the page or device does not support rewarded ads.
* if(targetSlot) {
* targetSlot.addService(googletag.pubads());
*
* // This listener is called when the video in a rewarded ad slot has
* // finished playing.
* googletag.pubads().addEventListener('rewardedSlotVideoCompleted',
* (event) => {
* const slot = event.slot;
* console.log('Video in rewarded ad slot', slot.getSlotElementId(),
* 'has finished playing.');
*
* if (slot === targetSlot) {
* // Slot specific logic.
* }
* }
* );
* }
*
* @see [Ad event listeners](https://developers.google.com/publisher-tag/samples/ad-event-listeners)
* @see [Display a rewarded ad](https://developers.google.com/publisher-tag/samples/display-rewarded-ad)
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface RewardedSlotVideoCompletedEvent extends Event {}

/**
* This event is fired when a
* [rewarded ad](https://support.google.com/admanager/answer/9116812) is
Expand Down Expand Up @@ -3518,6 +3557,11 @@ declare namespace googletag {
*/
rewardedSlotClosed: RewardedSlotClosedEvent;

/**
* Alias for {@link events.RewardedSlotVideoCompletedEvent}.
*/
rewardedSlotVideoCompleted: RewardedSlotVideoCompletedEvent;

/**
* Alias for {@link events.RewardedSlotReadyEvent}.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/google-publisher-tag/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/google-publisher-tag",
"version": "1.20250728.9999",
"version": "1.20250811.9999",
"nonNpm": true,
"nonNpmDescription": "Google Publisher Tag",
"projects": [
Expand Down
28 changes: 26 additions & 2 deletions types/jsoneditor/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,28 @@ export interface Template {
value: any;
}

export type AutoCompleteCompletion = null | string[] | { startFrom: number; options: string[] };
export interface AutoCompleteOption {
/**
* The display text for the autocomplete option
*/
text?: string;
/**
* The value to be used when the option is selected
*/
value: string;
/**
* Additional properties are allowed for custom metadata or future extensibility.
* These properties will be preserved but ignored by the current JSONEditor implementation.
*/
[key: string]: any;
}

export type AutoCompleteOptionItem = string | AutoCompleteOption;

export type AutoCompleteCompletion = null | AutoCompleteOptionItem[] | {
startFrom: number;
options: AutoCompleteOptionItem[];
};

export type AutoCompleteMatchingStrategy = "start" | "contain";

Expand All @@ -98,7 +119,10 @@ export interface AutoCompleteOptions {
* - 'start': Match your input from the start, e.g. 'ap' matches 'apple' but 'pl' does not.
* - 'contain': Contains the user's input or not, e.g. 'pl' matches 'apple' too.
*/
filter?: AutoCompleteMatchingStrategy | ((query: string) => boolean) | undefined;
filter?:
| AutoCompleteMatchingStrategy
| ((query: string, match: AutoCompleteOptionItem, config: AutoCompleteOptions) => boolean)
| undefined;
/**
* Indicate the way to trigger autocomplete menu.
* - 'keydown': When you type something in the field or value, it will trigger autocomplete immediately.
Expand Down
58 changes: 58 additions & 0 deletions types/jsoneditor/jsoneditor-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,67 @@ autocomplete.filter = undefined;
autocomplete.filter = "start";
autocomplete.filter = "contain";
autocomplete.filter = input => true;
autocomplete.filter = (query, match, config) => true;

autocomplete.getOptions = undefined;
autocomplete.getOptions = (text, path, type, editor) => [];
autocomplete.getOptions = (text, path, type, editor) => ["string1", "string2"];
autocomplete.getOptions = (text, path, type, editor) => [{ text: "Display Text", value: "actual_value" }];
autocomplete.getOptions = (text, path, type, editor) => [
"string_option",
{ text: "Object Option", value: "object_value" },
{ text: "Object with text only", value: "object_text_only" },
];
autocomplete.getOptions = (text, path, type, editor) => ({ startFrom: 0, options: ["option1", "option2"] });
autocomplete.getOptions = (text, path, type, editor) => ({
startFrom: 0,
options: [{ text: "Display", value: "val" }],
});
autocomplete.getOptions = (text, path, type, editor) => new Promise(() => ["async1", "async2"]);
autocomplete.getOptions = (text, path, type, editor) =>
new Promise(() => [{ text: "Async Option", value: "async_val" }]);

// Test getOptions with extended AutoCompleteOption properties
autocomplete.getOptions = (text, path, type, editor) => [
"simple_string",
{
text: "Premium Feature",
value: "premium_val",
category: "premium",
icon: "star",
description: "This is a premium feature",
},
{
text: "Advanced Option",
value: "advanced_val",
metadata: { id: 123, priority: "high" },
customData: { anything: "custom" },
},
];

autocomplete.getOptions = (text, path, type, editor) => ({
startFrom: 0,
options: [
"basic_option",
{
text: "Extended Option",
value: "ext_val",
tooltip: "Additional information",
disabled: false,
group: "category1",
},
],
});

autocomplete.getOptions = (text, path, type, editor) =>
Promise.resolve([
{
text: "Async Extended",
value: "async_ext",
category: "async",
metadata: { loadTime: Date.now() },
},
]);

autocomplete.trigger = undefined;
autocomplete.trigger = "keydown";
Expand Down