import { BID_RESPONSE, IMP, REQUEST, RESPONSE } from '../../src/pbjsORTB.js'; import type { MediaType } from "../../src/mediaTypes.ts"; import type { NativeRequest } from '../../src/types/ortb/native.d.ts'; import type { ORTBImp, ORTBRequest } from "../../src/types/ortb/request.d.ts"; import type { Currency, BidderCode } from "../../src/types/common.d.ts"; import type { BidderRequest, BidRequest } from "../../src/adapterManager.ts"; import type { BidResponse } from "../../src/bidfactory.ts"; import type { AdapterResponse } from "../../src/adapters/bidderFactory.ts"; import type { ORTBResponse } from "../../src/types/ortb/response"; type Context = { [key: string]: unknown; /** * A currency string (e.g. `'EUR'`). If specified, overrides the currency to use for computing price floors and `request.cur`. * If omitted, both default to `getConfig('currency.adServerCurrency')`. */ currency?: Currency; /** * A bid mediaType (`'banner'`, `'video'`, or `'native'`). If specified: * - disables `imp` generation for other media types (i.e., if `context.mediaType === 'banner'`, only `imp.banner` will be populated; `imp.video` and `imp.native` will not, even if the bid request specifies them); * - is passed as the `mediaType` option to `bidRequest.getFloor` when computing price floors; * - sets `bidResponse.mediaType`. */ mediaType?: MediaType; /** * A plain object that serves as the base value for `imp.native.request` (and is relevant only for native bid requests). * If not specified, the only property that is guaranteed to be populated is `assets`, since Prebid does not * require anything else to define a native adUnit. You can use `context.nativeRequest` to provide other properties; * for example, you may want to signal support for native impression trackers by setting it to `{eventtrackers: [{event: 1, methods: [1, 2]}]}` (see also the [ORTB Native spec](https://www.iab.com/wp-content/uploads/2018/03/OpenRTB-Native-Ads-Specification-Final-1.2.pdf)). */ nativeRequest?: Partial; /** * The value to set as `bidResponse.netRevenue`. This is a required property of bid responses that does not have a clear ORTB counterpart. */ netRevenue?: boolean; /** * the default value to use for `bidResponse.ttl` (if the ORTB response does not provide one in `seatbid[].bid[].exp`). */ ttl?: number; }; type RequestContext = Context & { /** * Map from imp id to the context object used to generate that imp. */ impContext: { [impId: string]: Context; }; }; type Params = { [IMP]: (bidRequest: BidRequest, context: Context & { bidderRequest: BidderRequest; }) => ORTBImp; [REQUEST]: (imps: ORTBImp[], bidderRequest: BidderRequest, context: RequestContext & { bidRequests: BidRequest[]; }) => ORTBRequest; [BID_RESPONSE]: (bid: ORTBResponse['seatbid'][number]['bid'][number], context: Context & { seatbid: ORTBResponse['seatbid'][number]; imp: ORTBImp; bidRequest: BidRequest; ortbRequest: ORTBRequest; ortbResponse: ORTBResponse; }) => BidResponse; [RESPONSE]: (bidResponses: BidResponse[], ortbResponse: ORTBResponse, context: RequestContext & { ortbRequest: ORTBRequest; bidderRequest: BidderRequest; bidRequests: BidRequest[]; }) => AdapterResponse; }; type Processors = { [M in keyof Params]?: { [name: string]: (...args: [Partial[M]>>, ...Parameters[M]>]) => void; }; }; type Customizers = { [M in keyof Params]?: (buildObject: Params[M], ...args: Parameters[M]>) => ReturnType[M]>; }; type Overrides = { [M in keyof Params]?: { [name: string]: (orig: Processors[M][string], ...args: Parameters[M][string]>) => void; }; }; type ConverterConfig = Customizers & { context?: Context; processors?: () => Processors; overrides?: Overrides; }; export declare function ortbConverter({ context: defaultContext, processors, overrides, imp, request, bidResponse, response, }?: ConverterConfig): { toORTB({ bidderRequest, bidRequests, context }: { bidderRequest: BidderRequest; bidRequests?: BidRequest[]; context?: Context; }): ORTBRequest; fromORTB({ request, response }: { request: ORTBRequest; response: ORTBResponse | null; }): AdapterResponse; }; export declare const defaultProcessors: any; export {};