import { REJECTION_REASON } from '../src/constants.js'; import { type MediaType } from '../src/mediaTypes.js'; import type { Currency, Size, BidderCode } from "../src/types/common.d.ts"; import type { BidRequest } from '../src/adapterManager.ts'; import type { Bid } from "../src/bidfactory.ts"; export declare const FLOOR_SKIPPED_REASON: { NOT_FOUND: string; RANDOM: string; }; declare const SYN_FIELD: unique symbol; /** * @summary Allowed fields for rules to have */ export declare const allowedFields: readonly [typeof SYN_FIELD, "gptSlot", "adUnitCode", "size", "domain", "mediaType"]; type DefaultField = { [K in (typeof allowedFields)[number]]: K extends string ? K : never; }[(typeof allowedFields)[number]]; /** * @summary Each auction can have differing floors data depending on execution time or per adunit setup * So we will be saving each auction offset by it's auctionId in order to make sure data is not changed * Once the auction commences */ export declare let _floorDataForAuction: {}; /** * @summary Check if a bidRequest contains any user IDs from the specified tiers * Returns an object with keys like 'userId.tierName' with boolean values (0/1) */ export declare function resolveTierUserIds(tiers: any, bidRequest: any): {}; /** * @summary floor field types with their matching functions to resolve the actual matched value */ export declare const fieldMatchingFunctions: { readonly [SYN_FIELD]: () => string; readonly size: (bidRequest: any, bidResponse: any) => string; readonly mediaType: (bidRequest: any, bidResponse: any) => any; readonly gptSlot: (bidRequest: any, bidResponse: any) => any; readonly domain: () => any; readonly adUnitCode: (bidRequest: any, bidResponse: any) => any; }; /** * @summary get's the first matching floor based on context provided. * Generates all possible rule matches and picks the first matching one. */ export declare function getFirstMatchingFloor(floorData: any, bidObject: any, responseObject?: {}): any; /** * @summary If a the input bidder has a registered cpmadjustment it returns the input CPM after being adjusted */ export declare function getBiddersCpmAdjustment(inputCpm: any, bid: any, bidRequest: any): number; /** * @summary This function takes the original floor and the adjusted floor in order to determine the bidders actual floor * With js rounding errors with decimal division we utilize similar method as shown in cpmBucketManager.js */ export declare function calculateAdjustedFloor(oldFloor: any, newFloor: any): number; type GetFloorParams = { currency?: Currency | '*'; mediaType?: MediaType | '*'; size?: Size | '*'; }; declare module '../src/adapterManager' { interface BaseBidRequest { getFloor: typeof getFloor; } } declare module '../src/bidderSettings' { interface BidderSettings { /** * Inverse of bidCpmAdjustment */ inverseBidAdjustment?: (floor: number, bidRequest: BidRequest, params: { [K in keyof GetFloorParams]?: Exclude; }) => number; } } /** * @summary This is the function which will return a single floor based on the input requests * and matching it to a rule for the current auction */ export declare function getFloor(requestParams?: GetFloorParams): { floor?: undefined; currency?: undefined; } | { floor: number; currency: any; }; /** * @summary Takes a floorsData object and converts it into a hash map with appropriate keys */ export declare function getFloorsDataForAuction(floorData: any, adUnitCode?: any): any; /** * @summary This function will take the adUnits and generate a floor data object to be used during the auction * Only called if no set config or fetch level data has returned */ export declare function getFloorDataFromAdUnits(adUnits: any): any; /** * @summary This function takes the adUnits for the auction and update them accordingly as well as returns the rules hashmap for the auction */ export declare function updateAdUnitsForAuction(adUnits: any, floorData: any, auctionId: any): void; export declare function pickRandomModel(modelGroups: any, weightSum: any): any; /** * @summary Updates the adUnits accordingly and returns the necessary floorsData for the current auction */ export declare function createFloorsDataForAuction(adUnits: any, auctionId: any): any; /** * @summary This is the function which will be called to exit our module and continue the auction. */ export declare function continueAuction(hookConfig: any): void; export declare function normalizeDefault(model: any): any; /** * @summary Fields array should have at least one entry and all should match allowed fields * Each rule in the values array should have a 'key' and 'floor' param * And each 'key' should have the correct number of 'fields' after splitting * on the delim. If rule does not match remove it. return if still at least 1 rule */ export declare function isFloorsDataValid(floorsData: any): any; /** * @summary This function updates the global Floors Data field based on the new one passed in if it is valid */ export declare function parseFloorData(floorsData: any, location: any): any; /** * * @param {Object} reqBidsConfigObj required; This is the same param that's used in pbjs.requestBids. * @param {function} fn required; The next function in the chain, used by hook.ts */ export declare const requestBidsHook: import("../src/hook.js").BeforeHook<"async", (options: import("../src/prebid.ts").PrivRequestBidsOptions | import("../src/prebid.ts").StartAuctionOptions) => void>; /** * This function handles the ajax response which comes from the user set URL to fetch floors data from * @param {object} fetchResponse The floors data response which came back from the url configured in config.floors */ export declare function handleFetchResponse(fetchResponse: any): void; /** * This function handles sending and receiving the AJAX call for a floors fetch * @param {object} floorEndpoint the floors endpoint coming from setConfig */ export declare function generateAndHandleFetch(floorEndpoint: any): void; type FloorsDef = { /** * Optional atribute used to signal to the Floor Provider’s Analytics adapter their floors are being applied. * They can opt to log only floors that are applied when they are the provider. If floorProvider is supplied in * both the top level of the floors object and within the data object, the data object’s configuration shall prevail. */ floorProvider?: string; /** * Currency of floor data. Floor Module will convert currency where necessary. */ currency?: Currency; /** * Used by floor providers to train on model version performance. * The expectation is a floor provider’s analytics adapter will pass the model verson back for algorithm training. */ modelVersion?: string; schema: { /** * Character separating the floor keys. Default is "|". */ delimiter?: string; fields: (DefaultField | string)[]; }; /** * Floor used if no matching rules are found. */ default?: number; /** * Map from delimited field of attribute values to a floor value. */ values: { [rule: string]: number; }; }; type BaseFloorData = { /** * Epoch timestamp associated with modelVersion. * Can be used to track model creation of floor file for post auction analysis. */ modelTimestamp?: string; /** * skipRate is a number between 0 and 100 to determine when to skip all floor logic, where 0 is always use floor data and 100 is always skip floor data. */ skipRate?: number; }; export type Schema1FloorData = FloorsDef & BaseFloorData & { floorsSchemaVersion?: 1; }; export type Schema2FloorData = BaseFloorData & { floorsSchemaVersion: 2; modelGroups: (FloorsDef & { /** * Used by the module to determine when to apply the specific model. */ modelWeight: number; /** * This is an array of bidders for which to avoid sending floors. * This is useful for bidders where the publisher has established different floor rules in their systems. */ noFloorSignalBidders?: BidderCode[]; })[]; }; declare module '../src/adUnits' { interface AdUnitDefinition { floors?: Partial; } } export type FloorsConfig = Pick & { enabled?: boolean; /** * The mimimum CPM floor used by the Price Floors Module. * The Price Floors Module will take the greater of floorMin and the matched rule CPM when evaluating getFloor() and enforcing floors. */ floorMin?: number; /** * Configuration for user ID tiers. Each tier is an array of EID sources * that will be matched against available EIDs in the bid request. */ userIds?: { [tierName: string]: string[]; }; enforcement?: Pick & { /** * If set to true (the default), the Price Floors Module will provide floors to bid adapters for bid request * matched rules and suppress any bids not exceeding a matching floor. * If set to false, the Price Floors Module will still provide floors for bid adapters, there will be no floor enforcement. */ enforceJS?: boolean; /** * If set to true (the default), the Price Floors Module will signal to Prebid Server to pass floors to it’s bid * adapters and enforce floors. * If set to false, the pbjs should still pass matched bid request floor data to PBS, however no enforcement will take place. */ enforcePBS?: boolean; /** * Enforce floors for deal bid requests. Default is false. */ floorDeals?: boolean; /** * If true (the default), the Price Floors Module will use the bidAdjustment function to adjust the floor * per bidder. * If false (or no bidAdjustment function is provided), floors will not be adjusted. * Note: Setting this parameter to false may have unexpected results, such as signaling a gross floor when * expecting net or vice versa. */ bidAdjustment?: boolean; }; /** * Map from custom field name to a function generating that field's value for either a bid or a bid request. */ additionalSchemaFields?: { [field: string]: (bidRequest?: BidRequest, bid?: Bid) => string; }; /** * How long (in milliseconds) auctions should be delayed to wait for dynamic floor data. */ auctionDelay?: number; endpoint?: { /** * URL of endpoint to retrieve dynamic floor data. */ url: string; }; data?: Schema1FloorData | Schema2FloorData; }; declare module '../src/config' { interface Config { floors?: FloorsConfig; } } /** * @summary This is the function which controls what happens during a pbjs.setConfig({...floors: {}}) is called */ export declare function handleSetFloorsConfig(config: any): void; export type BidFloorData = { floorValue: number; floorRule: string; floorRuleValue: number; floorCurrency: Currency; cpmAfterAdjustments: number; enforcements: FloorsConfig['enforcement']; matchedFields: { [fieldName: string]: string; }; }; declare module '../src/bidfactory' { interface BaseBid { floorData?: BidFloorData; } } /** * @summary The main driving force of floors. On bidResponse we hook in and intercept bidResponses. * And if the rule we find determines a bid should be floored we will do so. */ export declare const addBidResponseHook: import("../src/hook.js").BeforeHook<"async", import("../src/hook.js").Hookable<"async", (adUnitCode: string, bid: Partial, reject: (reason: (typeof REJECTION_REASON)[keyof typeof REJECTION_REASON]) => void, args_3: () => void) => void>>; /** * Sets bidfloor and bidfloorcur for ORTB imp objects */ export declare function setOrtbImpBidFloor(imp: any, bidRequest: any, context: any): void; /** * Set per-mediatype and per-format bidfloor */ export declare function setGranularBidfloors(imp: any, bidRequest: any, context: any): void; export declare function setImpExtPrebidFloors(imp: any, bidRequest: any, context: any): void; /** * PBS specific extension: set ext.prebid.floors.enabled = false if floors are processed client-side */ export declare function setOrtbExtPrebidFloors(ortbRequest: any, bidderRequest: any, context: any): void; export {};