This repository has been archived by the owner on Jul 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclasses.js
48 lines (43 loc) · 2.36 KB
/
classes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
export class ContextualBidResponse {
constructor (contextSignals, contextualAd, contextualBidValue) {
this.contextSignals = contextSignals // Custom JSON that later will be an argument for biddingFunction of interest-group-based ads.
this.contextualAd = contextualAd // Optional ad based only on received context information.
this.contextualBidValue = contextualBidValue // Fixed value of included contextual ad
}
}
export class Ad {
constructor (id, iframeContent, type, adPartner) {
this.id = id // Id of this ad. Should be unique for ad partner (ad may be overwritten on collision).
this.iframeContent = iframeContent // Proper content of ad.
this.type = type // Type of an ad. Now can be either "contextual" or "interest-group".
this.adPartner = adPartner // Partner that generated this ad.
}
}
export class InterestGroupAd extends Ad {
constructor (id, groupName, iframeContent, interestGroupSignals, bidFunctionSrc, adPartner) {
super(id, iframeContent, 'interest-group', adPartner)
this.groupName = groupName // interest group for which ad is intended
this.interestGroupSignals = interestGroupSignals // Interest-group-related object that further will be propagated to bid function.
this.bidFunctionSrc = bidFunctionSrc // Address to a function that consumes context signals with interestGroupSignals and returns bidValue.
}
}
export class ProductLevelInterestGroupAd extends InterestGroupAd {
constructor (id, groupName, iframeContent, interestGroupSignals, bidFunctionSrc, productsOwner, minProductsCount, productsCount, adPartner) {
super(id, groupName, iframeContent, interestGroupSignals, bidFunctionSrc, adPartner)
this.minProductsCount = minProductsCount || productsCount // States how many products have to be provided to ad to render it.
this.productsCount = productsCount // States how many products this ad wants to get (it may get any number between minProductsCount and productsCount)
this.productsOwner = productsOwner // Have to be fixed because products are tigthly coupled with IG owner.
}
}
export class ContextualAd extends Ad {
constructor (id, iframeContent, adPartner) {
super(id, iframeContent, 'contextual', adPartner)
}
}
export class Product {
constructor (owner, productId, iframeContent) {
this.owner = owner
this.productId = productId
this.iframeContent = iframeContent
}
}