diff --git a/modules/amxBidAdapter.js b/modules/amxBidAdapter.js
deleted file mode 100644
index 8d7e9682325..00000000000
--- a/modules/amxBidAdapter.js
+++ /dev/null
@@ -1,279 +0,0 @@
-import { registerBidder } from '../src/adapters/bidderFactory.js';
-import { BANNER, VIDEO } from '../src/mediaTypes.js';
-import { parseUrl, deepAccess, _each, formatQS, getUniqueIdentifierStr, triggerPixel } from '../src/utils.js';
-
-const BIDDER_CODE = 'amx';
-const SIMPLE_TLD_TEST = /\.co\.\w{2,4}$/;
-const DEFAULT_ENDPOINT = 'https://prebid.a-mo.net/a/c';
-const VERSION = 'pba1.0';
-const xmlDTDRxp = /^\s*<\?xml[^\?]+\?>/;
-const VAST_RXP = /^\s*<\??(?:vast|xml)/i;
-const TRACKING_ENDPOINT = 'https://1x1.a-mo.net/hbx/';
-
-const getLocation = (request) =>
- parseUrl(deepAccess(request, 'refererInfo.canonicalUrl', location.href))
-
-const largestSize = (sizes, mediaTypes) => {
- const allSizes = sizes
- .concat(deepAccess(mediaTypes, `${BANNER}.sizes`, []) || [])
- .concat(deepAccess(mediaTypes, `${VIDEO}.sizes`, []) || [])
-
- return allSizes.sort((a, b) => (b[0] * b[1]) - (a[0] * a[1]))[0];
-}
-
-const generateDTD = (xmlDocument) =>
- ``;
-
-const isVideoADM = (html) => html != null && VAST_RXP.test(html);
-const getMediaType = (bid) => isVideoADM(bid.adm) ? VIDEO : BANNER;
-const nullOrType = (value, type) =>
- value == null || (typeof value) === type // eslint-disable-line valid-typeof
-
-function getID(loc) {
- const host = loc.hostname.split('.');
- const short = host.slice(
- host.length - (SIMPLE_TLD_TEST.test(loc.host) ? 3 : 2)
- ).join('.');
- return btoa(short).replace(/=+$/, '');
-}
-
-const enc = encodeURIComponent;
-
-function nestedQs (qsData) {
- const out = [];
- Object.keys(qsData || {}).forEach((key) => {
- out.push(enc(key) + '=' + enc(String(qsData[key])));
- });
-
- return enc(out.join('&'));
-}
-
-function createBidMap(bids) {
- const out = {};
- for (const bid of bids) {
- out[bid.bidId] = convertRequest(bid)
- }
- return out;
-}
-
-const trackEvent = (eventName, data) =>
- triggerPixel(`${TRACKING_ENDPOINT}g_${eventName}?${formatQS({
- ...data,
- ts: Date.now(),
- eid: getUniqueIdentifierStr(),
- })}`);
-
-function convertRequest(bid) {
- const size = largestSize(bid.sizes, bid.mediaTypes) || [0, 0];
- const av = bid.mediaType === VIDEO || VIDEO in bid.mediaTypes;
- const tid = deepAccess(bid, 'params.tagId')
-
- const params = {
- av,
- aw: size[0],
- ah: size[1],
- tf: 0,
- };
-
- if (typeof tid === 'string' && tid.length > 0) {
- params.i = tid;
- }
- return params;
-}
-
-function decorateADM(bid) {
- const impressions = deepAccess(bid, 'ext.himp', [])
- .concat(bid.nurl != null ? [bid.nurl] : [])
- .filter((imp) => imp != null && imp.length > 0)
- .map((src) => `
`)
- .join('');
- return bid.adm + impressions;
-}
-
-function decorateVideoADM(bid) {
- const doc = new DOMParser().parseFromString(bid.adm, 'text/xml');
- if (doc.querySelector('parsererror') != null) {
- return null;
- }
-
- const root = doc.querySelector('InLine,Wrapper')
- if (root == null) {
- return null;
- }
-
- const pixels = [bid.nurl].concat(bid.ext.himp || [])
- .filter((url) => url != null);
-
- _each(pixels, (pxl) => {
- const imagePixel = doc.createElement('Impression');
- const cdata = doc.createCDATASection(pxl);
- imagePixel.appendChild(cdata);
- root.appendChild(imagePixel);
- });
-
- const dtdMatch = xmlDTDRxp.exec(bid.adm);
- return (dtdMatch != null ? dtdMatch[0] : generateDTD(doc)) + doc.documentElement.outerHTML;
-}
-
-function resolveSize(bid, request, bidId) {
- if (bid.w != null && bid.w > 1 && bid.h != null && bid.h > 1) {
- return [bid.w, bid.h];
- }
-
- const bidRequest = request.m[bidId];
- if (bidRequest == null) {
- return [0, 0];
- }
-
- return [bidRequest.aw, bidRequest.ah];
-}
-
-export const spec = {
- code: BIDDER_CODE,
- supportedMediaTypes: [BANNER, VIDEO],
-
- isBidRequestValid(bid) {
- return nullOrType(deepAccess(bid, 'params.endpoint', null), 'string') &&
- nullOrType(deepAccess(bid, 'params.tagId', null), 'string') &&
- nullOrType(deepAccess(bid, 'params.testMode', null), 'boolean');
- },
-
- buildRequests(bidRequests, bidderRequest) {
- const loc = getLocation(bidderRequest);
- const tagId = deepAccess(bidRequests[0], 'params.tagId', null);
- const testMode = deepAccess(bidRequests[0], 'params.testMode', 0);
-
- const payload = {
- a: bidderRequest.auctionId,
- B: 0,
- b: loc.host,
- tm: testMode,
- V: '$prebid.version$',
- i: (testMode && tagId != null) ? tagId : getID(loc),
- l: {},
- f: 0.01,
- cv: VERSION,
- st: 'prebid',
- h: screen.height,
- w: screen.width,
- gs: deepAccess(bidderRequest, 'gdprConsent.gdprApplies', '0'),
- gc: deepAccess(bidderRequest, 'gdprConsent.consentString', ''),
- u: deepAccess(bidderRequest, 'refererInfo.canonicalUrl', loc.href),
- do: loc.host,
- re: deepAccess(bidderRequest, 'refererInfo.referer'),
- usp: bidderRequest.uspConsent || '1---',
- smt: 9,
- d: '',
- m: createBidMap(bidRequests),
- };
-
- return {
- data: payload,
- method: 'POST',
- url: deepAccess(bidRequests[0], 'params.endpoint', DEFAULT_ENDPOINT),
- withCredentials: true,
- };
- },
-
- getUserSyncs(syncOptions, serverResponses) {
- return (serverResponses || [])
- .flatMap(({ body: response }) =>
- response != null && response.p != null ? (response.p.hreq || []) : [])
- .map((syncPixel) =>
- ({
- type: syncPixel.indexOf('__st=iframe') !== -1 ? 'iframe' : 'image',
- url: syncPixel
- })
- ).filter(({
- type
- }) => syncOptions.iframeEnabled || type === 'image')
- },
-
- interpretResponse(serverResponse, request) {
- // validate the body/response
- const response = serverResponse.body;
- if (response == null || typeof response === 'string') {
- return [];
- }
-
- return Object.keys(response.r).flatMap((bidID) => {
- const biddata = response.r[bidID];
- return biddata.flatMap((siteBid) =>
- siteBid.b.map((bid) => {
- const mediaType = getMediaType(bid);
- const ad = mediaType === BANNER ? decorateADM(bid) : decorateVideoADM(bid);
- if (ad == null) {
- return null;
- }
-
- const size = resolveSize(bid, request.data, bidID);
-
- return ({
- requestId: bidID,
- cpm: bid.price,
- width: size[0],
- height: size[1],
- creativeId: bid.crid,
- currency: 'USD',
- netRevenue: true,
- [mediaType === VIDEO ? 'vastXml' : 'ad']: ad,
- meta: {
- advertiserDomains: bid.adomain,
- mediaType,
- },
- ttl: mediaType === VIDEO ? 90 : 70
- });
- })).filter((possibleBid) => possibleBid != null);
- });
- },
-
- onSetTargeting(targetingData) {
- if (targetingData == null) {
- return;
- }
-
- trackEvent('pbst', {
- A: targetingData.bidder,
- w: targetingData.width,
- h: targetingData.height,
- bid: targetingData.adId,
- c1: targetingData.mediaType,
- np: targetingData.cpm,
- aud: targetingData.requestId,
- a: targetingData.adUnitCode,
- c2: nestedQs(targetingData.adserverTargeting),
- });
- },
-
- onTimeout(timeoutData) {
- if (timeoutData == null) {
- return;
- }
-
- trackEvent('pbto', {
- A: timeoutData.bidder,
- bid: timeoutData.bidId,
- a: timeoutData.adUnitCode,
- cn: timeoutData.timeout,
- aud: timeoutData.auctionId,
- });
- },
-
- onBidWon(bidWinData) {
- if (bidWinData == null) {
- return;
- }
-
- trackEvent('pbwin', {
- A: bidWinData.bidder,
- w: bidWinData.width,
- h: bidWinData.height,
- bid: bidWinData.adId,
- C: bidWinData.mediaType === BANNER ? 0 : 1,
- np: bidWinData.cpm,
- a: bidWinData.adUnitCode,
- });
- },
-};
-
-registerBidder(spec);
diff --git a/modules/amxBidAdapter.md b/modules/amxBidAdapter.md
deleted file mode 100644
index c06c2e7157c..00000000000
--- a/modules/amxBidAdapter.md
+++ /dev/null
@@ -1,37 +0,0 @@
-Overview
-========
-
-```
-Module Name: AMX Adapter
-Module Type: Bidder Adapter
-Maintainer: prebid.support@amxrtb.com
-```
-
-Description
-===========
-
-This module connects web publishers to AMX RTB video and display demand.
-
-# Bid Parameters
-
-| Key | Required | Example | Description |
-| --- | -------- | ------- | ----------- |
-| `endpoint` | **yes** | `https://prebid.a-mo.net/a/c` | The url including https:// and any path |
-| `testMode` | no | `true` | this will activate test mode / 100% fill with sample ads |
-| `tagId` | no | `"eh3hffb"` | can be used for more specific targeting of inventory. Your account manager will provide this ID if needed |
-
-# Test Parameters
-
-```
-var adUnits = [{
- code: 'test-div',
- sizes: [[300, 250]],
- bids: [{
- bidder: 'amx',
- params: {
- testMode: true,
- endpoint: 'https://prebid.a-mo.net/a/c',
- },
- }]
-}]
-```
diff --git a/test/spec/modules/amxBidAdapter_spec.js b/test/spec/modules/amxBidAdapter_spec.js
deleted file mode 100644
index e19de368361..00000000000
--- a/test/spec/modules/amxBidAdapter_spec.js
+++ /dev/null
@@ -1,390 +0,0 @@
-import * as utils from 'src/utils.js';
-import { config } from 'src/config.js';
-import { expect } from 'chai';
-import { newBidder } from 'src/adapters/bidderFactory.js';
-import { spec } from 'modules/amxBidAdapter.js';
-import { BANNER, VIDEO } from 'src/mediaTypes';
-import { formatQS } from 'src/utils';
-
-const sampleRequestId = '82c91e127a9b93e';
-const sampleDisplayAd = (additionalImpressions) => `${additionalImpressions}`;
-const sampleDisplayCRID = '78827819';
-// minimal example vast
-const sampleVideoAd = (addlImpression) => `
-00:00:15${addlImpression}
-`.replace(/\n+/g, '')
-
-const embeddedTrackingPixel = `https://1x1.a-mo.net/hbx/g_impression?A=sample&B=20903`;
-const sampleNurl = 'https://example.exchange/nurl';
-
-const sampleBidderRequest = {
- gdprConsent: {
- gdprApplies: true,
- consentString: utils.getUniqueIdentifierStr(),
- vendorData: {}
- },
- auctionId: utils.getUniqueIdentifierStr(),
- uspConsent: '1YYY',
- refererInfo: {
- referer: 'https://www.prebid.org',
- canonicalUrl: 'https://www.prebid.org/the/link/to/the/page'
- }
-};
-
-const sampleBidRequestBase = {
- bidder: spec.code,
- params: {
- endpoint: 'https://httpbin.org/post',
- },
- sizes: [[320, 50]],
- mediaTypes: {
- [BANNER]: {
- sizes: [[300, 250]]
- }
- },
- adUnitCode: 'div-gpt-ad-example',
- transactionId: utils.getUniqueIdentifierStr(),
- bidId: sampleRequestId,
- auctionId: utils.getUniqueIdentifierStr(),
-};
-
-const sampleBidRequestVideo = {
- ...sampleBidRequestBase,
- bidId: sampleRequestId + '_video',
- sizes: [[300, 150]],
- mediaTypes: {
- [VIDEO]: {
- sizes: [[360, 250]]
- }
- }
-};
-
-const sampleServerResponse = {
- 'p': {
- 'hreq': ['https://1x1.a-mo.net/hbx/g_sync?partner=test', 'https://1x1.a-mo.net/hbx/g_syncf?__st=iframe']
- },
- 'r': {
- [sampleRequestId]: [
- {
- 'b': [
- {
- 'adid': '78827819',
- 'adm': sampleDisplayAd(''),
- 'adomain': [
- 'example.com'
- ],
- 'crid': sampleDisplayCRID,
- 'ext': {
- 'himp': [
- embeddedTrackingPixel
- ],
- },
- 'nurl': sampleNurl,
- 'h': 600,
- 'id': '2014691335735134254',
- 'impid': '1',
- 'price': 0.25,
- 'w': 300
- },
- {
- 'adid': '222976952',
- 'adm': sampleVideoAd(''),
- 'adomain': [
- 'example.com'
- ],
- 'crid': sampleDisplayCRID,
- 'ext': {
- 'himp': [
- embeddedTrackingPixel
- ],
- },
- 'nurl': sampleNurl,
- 'h': 1,
- 'id': '7735706981389902829',
- 'impid': '1',
- 'price': 0.25,
- 'w': 1
- },
- ],
- }
- ]
- },
-}
-
-describe('AmxBidAdapter', () => {
- describe('isBidRequestValid', () => {
- it('endpoint must be an optional string', () => {
- expect(spec.isBidRequestValid({params: { endpoint: 1 }})).to.equal(false)
- expect(spec.isBidRequestValid({params: { endpoint: 'test' }})).to.equal(true)
- });
-
- it('tagId is an optional string', () => {
- expect(spec.isBidRequestValid({params: { tagId: 1 }})).to.equal(false)
- expect(spec.isBidRequestValid({params: { tagId: 'test' }})).to.equal(true)
- });
-
- it('testMode is an optional boolean', () => {
- expect(spec.isBidRequestValid({params: { testMode: 1 }})).to.equal(false)
- expect(spec.isBidRequestValid({params: { testMode: false }})).to.equal(true)
- });
-
- it('none of the params are required', () => {
- expect(spec.isBidRequestValid({})).to.equal(true)
- });
- })
- describe('getUserSync', () => {
- it('will only sync from valid server responses', () => {
- const syncs = spec.getUserSyncs({ iframeEnabled: true });
- expect(syncs).to.eql([]);
- });
-
- it('will return valid syncs from a server response', () => {
- const syncs = spec.getUserSyncs({ iframeEnabled: true }, [{body: sampleServerResponse}]);
- expect(syncs.length).to.equal(2);
- expect(syncs[0].type).to.equal('image');
- expect(syncs[1].type).to.equal('iframe');
- });
-
- it('will filter out iframe syncs based on options', () => {
- const syncs = spec.getUserSyncs({ iframeEnabled: false }, [{body: sampleServerResponse}, {body: sampleServerResponse}]);
- expect(syncs.length).to.equal(2);
- expect(syncs).to.satisfy((allSyncs) => allSyncs.every((sync) => sync.type === 'image'))
- });
- });
-
- describe('buildRequests', () => {
- it('will default to prebid.a-mo.net endpoint', () => {
- const { url } = spec.buildRequests([], sampleBidderRequest);
- expect(url).to.equal('https://prebid.a-mo.net/a/c')
- });
-
- it('reads test mode from the first bid request', () => {
- const { data } = spec.buildRequests([{
- ...sampleBidRequestBase,
- params: {
- testMode: true
- }
- }], sampleBidderRequest);
- expect(data.tm).to.equal(true);
- });
-
- it('handles referer data and GDPR, USP Consent', () => {
- const { data } = spec.buildRequests([sampleBidRequestBase], sampleBidderRequest);
- delete data.m; // don't deal with "m" in this test
-
- expect(data).to.deep.equal({
- a: sampleBidderRequest.auctionId,
- B: 0,
- b: 'www.prebid.org',
- tm: 0,
- V: '$prebid.version$',
- i: btoa('prebid.org').replace(/=+$/, ''),
- l: {},
- f: 0.01,
- cv: 'pba1.0',
- st: 'prebid',
- h: screen.height,
- w: screen.width,
- gs: sampleBidderRequest.gdprConsent.gdprApplies,
- gc: sampleBidderRequest.gdprConsent.consentString,
- u: sampleBidderRequest.refererInfo.canonicalUrl,
- do: 'www.prebid.org',
- re: sampleBidderRequest.refererInfo.referer,
- usp: sampleBidderRequest.uspConsent,
- smt: 9,
- d: '',
- })
- });
-
- it('can build a banner request', () => {
- const { method, url, data } = spec.buildRequests([sampleBidRequestBase, {
- ...sampleBidRequestBase,
- bidId: sampleRequestId + '_2',
- params: {
- ...sampleBidRequestBase.params,
- tagId: 'example'
- }
- }], sampleBidderRequest)
-
- expect(url).to.equal(sampleBidRequestBase.params.endpoint)
- expect(method).to.equal('POST');
- expect(Object.keys(data.m).length).to.equal(2);
- expect(data.m[sampleRequestId]).to.deep.equal({
- av: false,
- aw: 300,
- ah: 250,
- tf: 0
- });
- expect(data.m[sampleRequestId + '_2']).to.deep.equal({
- av: false,
- aw: 300,
- i: 'example',
- ah: 250,
- tf: 0
- });
- });
-
- it('can build a video request', () => {
- const { data } = spec.buildRequests([sampleBidRequestVideo], sampleBidderRequest);
- expect(Object.keys(data.m).length).to.equal(1);
- expect(data.m[sampleRequestId + '_video']).to.deep.equal({
- av: true,
- aw: 360,
- ah: 250,
- tf: 0
- });
- });
- });
-
- describe('interpretResponse', () => {
- const baseBidResponse = {
- requestId: sampleRequestId,
- cpm: 0.25,
- creativeId: sampleDisplayCRID,
- currency: 'USD',
- netRevenue: true,
- meta: {
- advertiserDomains: ['example.com'],
- },
- };
-
- const baseRequest = {
- data: {
- m: {
- [sampleRequestId]: {
- aw: 300,
- ah: 250,
- },
- }
- }
- };
-
- it('will handle a nobid response', () => {
- const parsed = spec.interpretResponse({ body: '' }, baseRequest)
- expect(parsed).to.eql([])
- });
-
- it('can parse a display ad', () => {
- const parsed = spec.interpretResponse({ body: sampleServerResponse }, baseRequest)
- expect(parsed.length).to.equal(2)
-
- // we should have display, video, display
- expect(parsed[0]).to.deep.equal({
- ...baseBidResponse,
- meta: {
- ...baseBidResponse.meta,
- mediaType: BANNER,
- },
- width: 300,
- height: 600, // from the bid itself
- ttl: 70,
- ad: sampleDisplayAd(
- `
` +
- `
`
- ),
- });
- });
-
- it('can parse a video ad', () => {
- const parsed = spec.interpretResponse({ body: sampleServerResponse }, baseRequest)
- expect(parsed.length).to.equal(2)
-
- // we should have display, video, display
- expect(parsed[1]).to.deep.equal({
- ...baseBidResponse,
- meta: {
- ...baseBidResponse.meta,
- mediaType: VIDEO,
- },
- width: 300,
- height: 250,
- ttl: 90,
- vastXml: sampleVideoAd(
- `` +
- ``
- ),
- });
- });
- });
-
- describe('analytics methods', () => {
- let firedPixels = [];
- let _Image = window.Image;
- before(() => {
- _Image = window.Image;
- window.Image = class FakeImage {
- set src(value) {
- firedPixels.push(value)
- }
- }
- });
-
- beforeEach(() => {
- firedPixels = [];
- });
-
- after(() => {
- window.Image = _Image;
- });
-
- it('will fire an event for onSetTargeting', () => {
- spec.onSetTargeting({
- bidder: 'example',
- width: 300,
- height: 250,
- adId: 'ad-id',
- mediaType: BANNER,
- cpm: 1.23,
- requestId: utils.getUniqueIdentifierStr(),
- adUnitCode: 'div-gpt-ad',
- adserverTargeting: {
- hb_pb: '1.23',
- hb_adid: 'ad-id',
- hb_bidder: 'example'
- }
- });
- expect(firedPixels.length).to.equal(1)
- expect(firedPixels[0]).to.match(/\/hbx\/g_pbst/)
- const parsed = new URL(firedPixels[0]);
- const nestedData = parsed.searchParams.get('c2');
- expect(nestedData).to.equal(formatQS({
- hb_pb: '1.23',
- hb_adid: 'ad-id',
- hb_bidder: 'example'
- }));
- });
-
- it('will log an event for timeout', () => {
- spec.onTimeout({
- bidder: 'example',
- bidId: 'test-bid-id',
- adUnitCode: 'div-gpt-ad',
- timeout: 300,
- auctionId: utils.getUniqueIdentifierStr()
- });
- expect(firedPixels.length).to.equal(1)
- expect(firedPixels[0]).to.match(/\/hbx\/g_pbto/)
- });
-
- it('will log an event for prebid win', () => {
- spec.onBidWon({
- bidder: 'example',
- adId: 'test-ad-id',
- width: 300,
- height: 250,
- mediaType: VIDEO,
- cpm: 1.34,
- adUnitCode: 'div-gpt-ad',
- timeout: 300,
- auctionId: utils.getUniqueIdentifierStr()
- });
- expect(firedPixels.length).to.equal(1)
- expect(firedPixels[0]).to.match(/\/hbx\/g_pbwin/)
-
- const pixel = firedPixels[0];
- const url = new URL(pixel);
- expect(url.searchParams.get('C')).to.equal('1')
- expect(url.searchParams.get('np')).to.equal('1.34')
- });
- });
-});