@surfside/ads-core 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/lib/cjs/index.js +3488 -0
- package/lib/cjs/index.js.map +54 -0
- package/lib/esm/index.js +3460 -0
- package/lib/esm/index.js.map +54 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/types/Api.d.ts +169 -0
- package/lib/types/constant-values/index.d.ts +46 -0
- package/lib/types/errors/index.d.ts +3 -0
- package/lib/types/helpers/Generator.d.ts +5 -0
- package/lib/types/helpers/Handlebars.d.ts +124 -0
- package/lib/types/helpers/NativeRequestBuilder.d.ts +29 -0
- package/lib/types/helpers/RequestBuilder.d.ts +16 -0
- package/lib/types/helpers/TryGet.d.ts +2 -0
- package/lib/types/helpers/Window.d.ts +3 -0
- package/lib/types/helpers/generators/CollectN.d.ts +2 -0
- package/lib/types/helpers/generators/index.d.ts +1 -0
- package/lib/types/helpers/handlebars/index.d.ts +119 -0
- package/lib/types/helpers/index.d.ts +7 -0
- package/lib/types/helpers/requests/RequestBuilder.d.ts +124 -0
- package/lib/types/helpers/requests/SimpleBannerRequest.d.ts +26 -0
- package/lib/types/helpers/requests/index.d.ts +2 -0
- package/lib/types/helpers/response/Banner.d.ts +22 -0
- package/lib/types/helpers/response/BuiltResponse.d.ts +31 -0
- package/lib/types/helpers/response/Carousel.d.ts +51 -0
- package/lib/types/helpers/response/Clickthrough.d.ts +3 -0
- package/lib/types/helpers/response/ProductCard.d.ts +49 -0
- package/lib/types/helpers/response/Video.d.ts +17 -0
- package/lib/types/helpers/response/index.d.ts +6 -0
- package/lib/types/helpers/responses/BuildBannerResponse.d.ts +10 -0
- package/lib/types/helpers/responses/BuildNativeResponse.d.ts +21 -0
- package/lib/types/helpers/responses/BuildVideoResponse.d.ts +0 -0
- package/lib/types/helpers/responses/ClickthroughHelpers.d.ts +2 -0
- package/lib/types/helpers/responses/VastHelpers.d.ts +4 -0
- package/lib/types/helpers/responses/index.d.ts +4 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/middleware/DeviceMiddleware.d.ts +3 -0
- package/lib/types/middleware/GeoMiddleware.d.ts +3 -0
- package/lib/types/middleware/IdentityMiddleware.d.ts +4 -0
- package/lib/types/middleware/index.d.ts +3 -0
- package/lib/types/models/dynamic/DynamicZone.d.ts +37 -0
- package/lib/types/models/dynamic/index.d.ts +1 -0
- package/lib/types/models/index.d.ts +5 -0
- package/lib/types/models/retail/Configuration.d.ts +66 -0
- package/lib/types/models/retail/IProductInformation.d.ts +37 -0
- package/lib/types/models/retail/IPublisherConfiguration.d.ts +64 -0
- package/lib/types/models/retail/IRecommenderResponse.d.ts +10 -0
- package/lib/types/models/retail/Product.d.ts +19 -0
- package/lib/types/models/retail/Recommended.d.ts +10 -0
- package/lib/types/models/retail/index.d.ts +3 -0
- package/lib/types/models/rtb/BidRequest.d.ts +409 -0
- package/lib/types/models/rtb/BidResponse.d.ts +47 -0
- package/lib/types/models/rtb/IBidRequest.d.ts +399 -0
- package/lib/types/models/rtb/IBidResponse.d.ts +47 -0
- package/lib/types/models/rtb/NativeRequest.d.ts +170 -0
- package/lib/types/models/rtb/NativeResponse.d.ts +60 -0
- package/lib/types/models/rtb/index.d.ts +4 -0
- package/lib/types/models/rtb/native/Constants.d.ts +60 -0
- package/lib/types/models/rtb/native/INativeRequest.d.ts +54 -0
- package/lib/types/models/rtb/native/INativeResponse.d.ts +60 -0
- package/lib/types/models/rtb/native/NativeConstants.d.ts +120 -0
- package/lib/types/models/rtb/native/NativeRequestBuilder.d.ts +158 -0
- package/lib/types/models/rtb/native/index.d.ts +4 -0
- package/lib/types/models/tracking/Geo.d.ts +14 -0
- package/lib/types/models/tracking/IEvents.d.ts +82 -0
- package/lib/types/models/tracking/IGeoContext.d.ts +14 -0
- package/lib/types/models/tracking/IUserID.d.ts +1 -0
- package/lib/types/models/tracking/index.d.ts +1 -0
- package/lib/types/models/vast/Vast.d.ts +47 -0
- package/lib/types/models/vast/index.d.ts +1 -0
- package/lib/types/services/Bidder.d.ts +31 -0
- package/lib/types/services/Configuration.d.ts +6 -0
- package/lib/types/services/Device.d.ts +12 -0
- package/lib/types/services/Dynamic.d.ts +26 -0
- package/lib/types/services/Geo.d.ts +6 -0
- package/lib/types/services/Logger.d.ts +14 -0
- package/lib/types/services/Memoization.d.ts +1 -0
- package/lib/types/services/OverrideService.d.ts +10 -0
- package/lib/types/services/Product.d.ts +13 -0
- package/lib/types/services/Recommender.d.ts +8 -0
- package/lib/types/services/Result.d.ts +57 -0
- package/lib/types/services/Template.d.ts +7 -0
- package/lib/types/services/index.d.ts +11 -0
- package/lib/types/services/logger/ILoggerService.d.ts +39 -0
- package/lib/types/services/logger/LocalLoggerService.d.ts +19 -0
- package/lib/types/services/logger/index.d.ts +2 -0
- package/lib/types/services/mock/Bidder.d.ts +1 -0
- package/lib/types/services/mock/index.d.ts +1 -0
- package/lib/types/services/product-feed/IProductFeedService.d.ts +5 -0
- package/lib/types/services/product-feed/SurfsideProductFeedService.d.ts +11 -0
- package/lib/types/services/product-feed/index.d.ts +2 -0
- package/lib/types/services/recommender/IRecommenderService.d.ts +47 -0
- package/lib/types/services/recommender/SurfsideRecommenderService.d.ts +31 -0
- package/lib/types/services/recommender/index.d.ts +2 -0
- package/lib/types/services/rtb/bidder/IBidderService.d.ts +12 -0
- package/lib/types/services/rtb/bidder/SurfsideBidderService.d.ts +28 -0
- package/lib/types/services/rtb/bidder/index.d.ts +2 -0
- package/lib/types/services/rtb/configuration/IConfigurationService.d.ts +14 -0
- package/lib/types/services/rtb/configuration/SurfsideConfigurationService.d.ts +29 -0
- package/lib/types/services/rtb/configuration/index.d.ts +2 -0
- package/lib/types/services/rtb/index.d.ts +2 -0
- package/lib/types/services/tracking/device/DeviceOverrideService.d.ts +8 -0
- package/lib/types/services/tracking/device/IDeviceService.d.ts +4 -0
- package/lib/types/services/tracking/device/SurfsideDeviceService.d.ts +16 -0
- package/lib/types/services/tracking/device/index.d.ts +3 -0
- package/lib/types/services/tracking/events/IEventService.d.ts +5 -0
- package/lib/types/services/tracking/events/SurfsideEventService.d.ts +42 -0
- package/lib/types/services/tracking/events/index.d.ts +2 -0
- package/lib/types/services/tracking/geo/GeoOverrideService.d.ts +8 -0
- package/lib/types/services/tracking/geo/IGeoService.d.ts +12 -0
- package/lib/types/services/tracking/geo/SurfsideGeoService.d.ts +7 -0
- package/lib/types/services/tracking/geo/index.d.ts +3 -0
- package/lib/types/services/tracking/index.d.ts +4 -0
- package/lib/types/services/tracking/user/IUserIDService.d.ts +4 -0
- package/lib/types/services/tracking/user/SurfsideUserIDService.d.ts +7 -0
- package/lib/types/services/tracking/user/UserOverrideService.d.ts +8 -0
- package/lib/types/services/tracking/user/index.d.ts +3 -0
- package/lib/types/utils/Protocol.d.ts +1 -0
- package/lib/types/utils/Rendering.d.ts +44 -0
- package/lib/types/utils/index.d.ts +2 -0
- package/package.json +34 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare enum CreativeType {
|
|
2
|
+
BANNER = 0,
|
|
3
|
+
INLINE = 1,
|
|
4
|
+
PRODUCT_CARD = 2,
|
|
5
|
+
PRODUCT_CAROUSEL = 3,
|
|
6
|
+
VIDEO = 4
|
|
7
|
+
}
|
|
8
|
+
export declare enum NativePosition {
|
|
9
|
+
UNKNOWN = 0,
|
|
10
|
+
ABOVE_THE_FOLD = 1,
|
|
11
|
+
BELOW_THE_FOLD = 3,
|
|
12
|
+
HEADER = 4,
|
|
13
|
+
FOOTER = 5,
|
|
14
|
+
SIDEBAR = 6,
|
|
15
|
+
FULL_SCREN = 7
|
|
16
|
+
}
|
|
17
|
+
export declare enum NativeImageTypes {
|
|
18
|
+
ICON = 1,
|
|
19
|
+
MAIN = 3
|
|
20
|
+
}
|
|
21
|
+
export declare enum NativeDataTypes {
|
|
22
|
+
SPONSORED = 1,
|
|
23
|
+
DESC = 2,
|
|
24
|
+
RATING = 3,
|
|
25
|
+
LIKES = 4,
|
|
26
|
+
DOWNLOADS = 5,
|
|
27
|
+
PRICE = 6,
|
|
28
|
+
SALEPRICE = 7,
|
|
29
|
+
PHONE = 8,
|
|
30
|
+
ADDRESS = 9,
|
|
31
|
+
DESC2 = 10,
|
|
32
|
+
DISPLAYURL = 11,
|
|
33
|
+
CTATEXT = 12,
|
|
34
|
+
SURF_STRAIN = 500,
|
|
35
|
+
SURF_THC = 501,
|
|
36
|
+
SURF_CBD = 502,
|
|
37
|
+
SURF_CATEGORY = 503
|
|
38
|
+
}
|
|
39
|
+
export declare enum NativeAssetId {
|
|
40
|
+
TITLE = 0,
|
|
41
|
+
IMAGE = 1,
|
|
42
|
+
SPONSORED = 2,
|
|
43
|
+
DESC = 3,
|
|
44
|
+
RATING = 4,
|
|
45
|
+
PRICE = 5,
|
|
46
|
+
SALEPRICE = 6,
|
|
47
|
+
DISPLAYURL = 7,
|
|
48
|
+
CTATEXT = 8,
|
|
49
|
+
SURF_CATEGORY = 9,
|
|
50
|
+
SURF_THC = 10,
|
|
51
|
+
SURF_CBD = 11,
|
|
52
|
+
SURF_STRAIN = 12
|
|
53
|
+
}
|
|
54
|
+
export interface INativeDataAsset {
|
|
55
|
+
id: number;
|
|
56
|
+
required: 0 | 1;
|
|
57
|
+
data: {
|
|
58
|
+
type: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ContextSubTypes, ContextTypes, EventTrackingMethods, EventTypes, NativeDataTypes, PlacementTypes, VideoMimes } from './NativeConstants';
|
|
2
|
+
export interface INativeRequest {
|
|
3
|
+
ver?: string;
|
|
4
|
+
context?: ContextTypes;
|
|
5
|
+
contextsubtype?: ContextSubTypes;
|
|
6
|
+
plcmttype?: PlacementTypes;
|
|
7
|
+
plcmtcnt?: number;
|
|
8
|
+
seq?: number;
|
|
9
|
+
assets: IAssetObject[];
|
|
10
|
+
aurlsupport?: number;
|
|
11
|
+
durlsupport?: number;
|
|
12
|
+
eventtrackers?: IEventTrackerRequestObject[];
|
|
13
|
+
privacy?: number;
|
|
14
|
+
ext?: any;
|
|
15
|
+
}
|
|
16
|
+
export interface IAssetObject {
|
|
17
|
+
id: number;
|
|
18
|
+
required?: number;
|
|
19
|
+
title?: ITitleRequestObject;
|
|
20
|
+
img?: IImageRequestObject;
|
|
21
|
+
video?: IVideoRequestObject;
|
|
22
|
+
data?: IDataRequestObject;
|
|
23
|
+
ext?: any;
|
|
24
|
+
}
|
|
25
|
+
export interface ITitleRequestObject {
|
|
26
|
+
len: number;
|
|
27
|
+
ext?: any;
|
|
28
|
+
}
|
|
29
|
+
export interface IImageRequestObject {
|
|
30
|
+
type?: number;
|
|
31
|
+
w?: number;
|
|
32
|
+
wmin?: number;
|
|
33
|
+
h?: number;
|
|
34
|
+
hmin?: number;
|
|
35
|
+
mimes?: string[];
|
|
36
|
+
ext?: any;
|
|
37
|
+
}
|
|
38
|
+
export interface IVideoRequestObject {
|
|
39
|
+
mimes: VideoMimes[] | string[];
|
|
40
|
+
minduration: number;
|
|
41
|
+
maxduration: number;
|
|
42
|
+
protocols: number[];
|
|
43
|
+
ext?: any;
|
|
44
|
+
}
|
|
45
|
+
export interface IDataRequestObject {
|
|
46
|
+
type: NativeDataTypes;
|
|
47
|
+
len?: number;
|
|
48
|
+
ext?: any;
|
|
49
|
+
}
|
|
50
|
+
export interface IEventTrackerRequestObject {
|
|
51
|
+
event: EventTypes;
|
|
52
|
+
methods: EventTrackingMethods[];
|
|
53
|
+
ext?: any;
|
|
54
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type EventTrackingMethods, type IProductInformation, type NativeDataTypes, NativeImageTypes, EventTypes } from '../../../models';
|
|
2
|
+
export interface INativeResponse {
|
|
3
|
+
native: INativeResponseDetails;
|
|
4
|
+
}
|
|
5
|
+
export interface INativeResponseDetails {
|
|
6
|
+
ver?: string;
|
|
7
|
+
assets?: IAssetResponseObject[];
|
|
8
|
+
assetsurl?: string;
|
|
9
|
+
dcourl?: string;
|
|
10
|
+
link: ILinkResponseObject;
|
|
11
|
+
imptrackers?: string[];
|
|
12
|
+
jstracker?: string;
|
|
13
|
+
eventtrackers?: IEventTrackerResponseObject[];
|
|
14
|
+
privacy?: string;
|
|
15
|
+
ext?: any;
|
|
16
|
+
}
|
|
17
|
+
export interface IAssetResponseObject {
|
|
18
|
+
id?: number;
|
|
19
|
+
required?: number;
|
|
20
|
+
title?: ITitleResponseObject;
|
|
21
|
+
img?: IImageResponseObject;
|
|
22
|
+
data?: IDataResponseObject;
|
|
23
|
+
video?: IVideoResponseObject;
|
|
24
|
+
link?: ILinkResponseObject;
|
|
25
|
+
ext?: any;
|
|
26
|
+
}
|
|
27
|
+
export interface ITitleResponseObject {
|
|
28
|
+
text: string;
|
|
29
|
+
len?: number;
|
|
30
|
+
ext?: any;
|
|
31
|
+
}
|
|
32
|
+
export interface IImageResponseObject {
|
|
33
|
+
type: NativeImageTypes;
|
|
34
|
+
url: string;
|
|
35
|
+
w?: number;
|
|
36
|
+
h?: number;
|
|
37
|
+
ext?: any;
|
|
38
|
+
}
|
|
39
|
+
export interface IDataResponseObject {
|
|
40
|
+
type?: NativeDataTypes;
|
|
41
|
+
value: string;
|
|
42
|
+
ext?: any;
|
|
43
|
+
}
|
|
44
|
+
export interface IVideoResponseObject {
|
|
45
|
+
vasttag: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ILinkResponseObject {
|
|
48
|
+
url: string;
|
|
49
|
+
clicktrackers?: string[];
|
|
50
|
+
fallback?: string;
|
|
51
|
+
ext?: any;
|
|
52
|
+
}
|
|
53
|
+
export interface IEventTrackerResponseObject {
|
|
54
|
+
event: EventTypes;
|
|
55
|
+
method: EventTrackingMethods;
|
|
56
|
+
url?: string;
|
|
57
|
+
customdata?: any;
|
|
58
|
+
ext?: any;
|
|
59
|
+
}
|
|
60
|
+
export declare function NativeResponseToProductInformation(native: INativeResponse): IProductInformation;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The position of the native ad, on the screen
|
|
3
|
+
*/
|
|
4
|
+
export declare enum NativePosition {
|
|
5
|
+
UNKNOWN = 0,
|
|
6
|
+
ABOVE_THE_FOLD = 1,
|
|
7
|
+
BELOW_THE_FOLD = 3,
|
|
8
|
+
HEADER = 4,
|
|
9
|
+
FOOTER = 5,
|
|
10
|
+
SIDEBAR = 6,
|
|
11
|
+
FULL_SCREN = 7
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The type of the image within native ad (icon vs main image)
|
|
15
|
+
*/
|
|
16
|
+
export declare enum NativeImageTypes {
|
|
17
|
+
ICON = 1,
|
|
18
|
+
MAIN = 3
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The type ID for each native asset type. IDs above 500 are surfside-specific fields, all
|
|
22
|
+
* others are OpenRTB Native Ad Spec 1.2 fields.
|
|
23
|
+
*/
|
|
24
|
+
export declare enum NativeDataTypes {
|
|
25
|
+
SPONSORED = 1,
|
|
26
|
+
DESC = 2,
|
|
27
|
+
RATING = 3,
|
|
28
|
+
LIKES = 4,
|
|
29
|
+
DOWNLOADS = 5,
|
|
30
|
+
PRICE = 6,
|
|
31
|
+
SALEPRICE = 7,
|
|
32
|
+
PHONE = 8,
|
|
33
|
+
ADDRESS = 9,
|
|
34
|
+
DESC2 = 10,
|
|
35
|
+
DISPLAYURL = 11,
|
|
36
|
+
CTATEXT = 12,
|
|
37
|
+
SURF_STRAIN = 500,
|
|
38
|
+
SURF_THC = 501,
|
|
39
|
+
SURF_CBD = 502,
|
|
40
|
+
SURF_CATEGORY = 503,
|
|
41
|
+
SURF_META_PRODUCT = 599
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The ID for each field within a surfside native ad request. The Asset ID matches the asset type, for simplicity.
|
|
45
|
+
*/
|
|
46
|
+
export declare enum NativeAssetId {
|
|
47
|
+
TITLE = 0,
|
|
48
|
+
IMAGE = 1,
|
|
49
|
+
SPONSORED = 2,
|
|
50
|
+
DESC = 3,
|
|
51
|
+
RATING = 4,
|
|
52
|
+
PRICE = 5,
|
|
53
|
+
SALEPRICE = 6,
|
|
54
|
+
DISPLAYURL = 7,
|
|
55
|
+
CTATEXT = 8,
|
|
56
|
+
SURF_STRAIN = 500,
|
|
57
|
+
SURF_THC = 501,
|
|
58
|
+
SURF_CBD = 502,
|
|
59
|
+
SURF_CATEGORY = 503,
|
|
60
|
+
SURF_META_PRODUCT = 599
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Event types which can be tracked by the native ad unit
|
|
64
|
+
*/
|
|
65
|
+
export declare enum EventTypes {
|
|
66
|
+
IMP = 1,
|
|
67
|
+
VIEWABLE_MRC50 = 2,
|
|
68
|
+
VIEWABLE_MRC100 = 3,
|
|
69
|
+
VIEWABLE_VIDEO50 = 4,
|
|
70
|
+
SURF_WIN = 500,
|
|
71
|
+
SURF_CLICK = 501
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The context of the page for the native ad unit, i.e what type of content is being displayed
|
|
75
|
+
*/
|
|
76
|
+
export declare enum ContextTypes {
|
|
77
|
+
CONTENT = 1,
|
|
78
|
+
SOCIAL = 2,
|
|
79
|
+
PRODUCT = 3
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The sub-type of the context
|
|
83
|
+
*/
|
|
84
|
+
export declare enum ContextSubTypes {
|
|
85
|
+
GENERAL = 10,
|
|
86
|
+
ARTICLE = 11,
|
|
87
|
+
VIDEO = 12,
|
|
88
|
+
AUDIO = 13,
|
|
89
|
+
IMAGE = 14,
|
|
90
|
+
USER_GENERATED = 15,
|
|
91
|
+
GENERAL_SOCIAL = 20,
|
|
92
|
+
EMAIL = 21,
|
|
93
|
+
CHAT = 22,
|
|
94
|
+
PRODUCT = 30,
|
|
95
|
+
APPLICATION = 31,
|
|
96
|
+
PRODUCT_REVIEWS = 32
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The format of the ad unit, i.e: what type of ad is being displayed and where
|
|
100
|
+
*/
|
|
101
|
+
export declare enum PlacementTypes {
|
|
102
|
+
IN_FEED = 1,
|
|
103
|
+
ATOMIC = 2,
|
|
104
|
+
OUTSIDE_CORE = 3,
|
|
105
|
+
RECOMMENDATION = 4
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Presets for default video MIME types
|
|
109
|
+
*/
|
|
110
|
+
export declare enum VideoMimes {
|
|
111
|
+
MP4 = "video/mp4",
|
|
112
|
+
WEBM = "video/webm"
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The method used to track events, 1x1 pixel of Javascript tag
|
|
116
|
+
*/
|
|
117
|
+
export declare enum EventTrackingMethods {
|
|
118
|
+
IMG = 1,
|
|
119
|
+
JS = 2
|
|
120
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { EventTrackingMethods, EventTypes, NativeAssetId, NativeDataTypes, type VideoMimes } from '../../../models';
|
|
2
|
+
import type { INativeRequest } from './INativeRequest';
|
|
3
|
+
/**
|
|
4
|
+
* Builder for creating an OpenRTB Native 1.2 request object.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NativeRequestBuilder {
|
|
7
|
+
private readonly _request;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new NativeRequestBuilder instance, using version 1.2 and product type context.
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Overrides the 1.2 version with the provided version.
|
|
14
|
+
* @param ver The version to use
|
|
15
|
+
* @returns The builder instance
|
|
16
|
+
*/
|
|
17
|
+
withVer(ver: string): this;
|
|
18
|
+
/**
|
|
19
|
+
* Overrides the native request context type with the provided context.
|
|
20
|
+
* @param context The context to use
|
|
21
|
+
* @returns The builder instance
|
|
22
|
+
*/
|
|
23
|
+
withContext(context: number): this;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a title asset to the request.
|
|
26
|
+
* @param length The lenght of the title, default is 80
|
|
27
|
+
* @param required Whether the title is required, default is true
|
|
28
|
+
* @returns The builder instance
|
|
29
|
+
*/
|
|
30
|
+
withTitle(length?: number, required?: boolean): this;
|
|
31
|
+
/**
|
|
32
|
+
* Adds an image asset to the request.
|
|
33
|
+
* @param width The full width of the image. If minWidth is not provided, this is the exact width.
|
|
34
|
+
* Otherwise, it is the max width
|
|
35
|
+
* @param height The full height of the image. If minHeight is not provided, this is the exact height.
|
|
36
|
+
* Otherwise, it is the max height
|
|
37
|
+
* @param minWidth The minimum width of the image. undefined by default
|
|
38
|
+
* @param minHeight The minimum height of the image. undefined by default
|
|
39
|
+
* @param required Whether the image is required, default is true
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
withImage(width: number, height: number, minWidth?: number, minHeight?: number, required?: boolean): this;
|
|
43
|
+
/**
|
|
44
|
+
* Adds a video asset to the request.
|
|
45
|
+
* @param mimes The supported MIME types for the video
|
|
46
|
+
* @param minDuration The minimum duration of the video
|
|
47
|
+
* @param maxDuration The maximum duration of the video
|
|
48
|
+
* @param required Whether the video is required, default is true
|
|
49
|
+
* @returns The builder instance
|
|
50
|
+
*/
|
|
51
|
+
withVideo(mimes: VideoMimes[] | string[], minDuration: number, maxDuration: number, required?: boolean): this;
|
|
52
|
+
/**
|
|
53
|
+
* Adds a data asset to the request.
|
|
54
|
+
* @param type The type ID of the data asset
|
|
55
|
+
* @param id The ID of the asset field; This number is used to address the asset
|
|
56
|
+
* in the response so it must be unique
|
|
57
|
+
* @param length The max length of the data asset's value, in characters
|
|
58
|
+
* @param required Whether the data asset is required, default is true
|
|
59
|
+
* @returns The builder instance
|
|
60
|
+
*/
|
|
61
|
+
withData(type: NativeDataTypes, id: NativeAssetId, length?: number, required?: boolean): this;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a sponsored field to the request.
|
|
64
|
+
* @param length The max length of the sponsored field, in characters. Default is 80
|
|
65
|
+
* @param required Whether the sponsored field is required. Default is true
|
|
66
|
+
* @returns The builder instance
|
|
67
|
+
*/
|
|
68
|
+
withSponsored(length?: number, required?: boolean): this;
|
|
69
|
+
/**
|
|
70
|
+
* Adds a description field to the request.
|
|
71
|
+
* @param length The max length of the description field, in characters. Default is 80
|
|
72
|
+
* @param required Whether the description field is required. Default is true
|
|
73
|
+
* @returns The builder instance
|
|
74
|
+
*/
|
|
75
|
+
withDescription(length?: number, required?: boolean): this;
|
|
76
|
+
/**
|
|
77
|
+
* Adds a rating field to the request.
|
|
78
|
+
* @param length The max length of the rating field, in characters. Default is 80
|
|
79
|
+
* @param required Whether the rating field is required. Default is true
|
|
80
|
+
* @returns The builder instance
|
|
81
|
+
*/
|
|
82
|
+
withRating(length?: number, required?: boolean): this;
|
|
83
|
+
/**
|
|
84
|
+
* Adds a price field to the request.
|
|
85
|
+
* @param length The max length of the price field, in characters. Default is 80
|
|
86
|
+
* @param required Whether the price field is required. Default is true
|
|
87
|
+
* @returns The builder instance
|
|
88
|
+
*/
|
|
89
|
+
withPrice(length?: number, required?: boolean): this;
|
|
90
|
+
/**
|
|
91
|
+
* Adds a sale price field to the request.
|
|
92
|
+
* @param length The max length of the sale price field, in characters. Default is 80
|
|
93
|
+
* @param required Whether the sale price field is required. Default is true
|
|
94
|
+
* @returns The builder instance
|
|
95
|
+
*/
|
|
96
|
+
withSalePrice(length?: number, required?: boolean): this;
|
|
97
|
+
/**
|
|
98
|
+
* Adds a display URL field to the request.
|
|
99
|
+
* @param length The max length of the display URL field, in characters. Default is 80
|
|
100
|
+
* @param required Whether the display URL field is required. Default is true
|
|
101
|
+
* @returns The builder instance
|
|
102
|
+
*/
|
|
103
|
+
withDisplayUrl(length?: number, required?: boolean): this;
|
|
104
|
+
/**
|
|
105
|
+
* Adds a CTA (call to action) text field to the request.
|
|
106
|
+
* @param length The max length of the call to action text field, in characters. Default is 80
|
|
107
|
+
* @param required Whether the call to action text field is required. Default is true
|
|
108
|
+
* @returns The builder instance
|
|
109
|
+
*/
|
|
110
|
+
withCtaText(length?: number, required?: boolean): this;
|
|
111
|
+
/**
|
|
112
|
+
* Adds a category field to the request.
|
|
113
|
+
* @param length The max length of the category field, in characters. Default is 80
|
|
114
|
+
* @param required Whether the category field is required. Default is true
|
|
115
|
+
* @returns The builder instance
|
|
116
|
+
*/
|
|
117
|
+
withCategory(length?: number, required?: boolean): this;
|
|
118
|
+
/**
|
|
119
|
+
* Adds a THC field to the request.
|
|
120
|
+
* @param length The max length of the THC field, in characters. Default is 80
|
|
121
|
+
* @param required Whether the THC field is required. Default is true
|
|
122
|
+
* @returns The builder instance
|
|
123
|
+
*/
|
|
124
|
+
withTHC(length?: number, required?: boolean): this;
|
|
125
|
+
/**
|
|
126
|
+
* Adds a CBD field to the request.
|
|
127
|
+
* @param length The max length of the CBD field, in characters. Default is 80
|
|
128
|
+
* @param required Whether the CBD field is required. Default is true
|
|
129
|
+
* @returns The builder instance
|
|
130
|
+
*/
|
|
131
|
+
withCBD(length?: number, required?: boolean): this;
|
|
132
|
+
/**
|
|
133
|
+
* Adds a strain field to the request.
|
|
134
|
+
* @param length The max length of the strain field, in characters. Default is 80
|
|
135
|
+
* @param required Whether the strain field is required. Default is true
|
|
136
|
+
* @returns The builder instance
|
|
137
|
+
*/
|
|
138
|
+
withStrain(length?: number, required?: boolean): this;
|
|
139
|
+
/**
|
|
140
|
+
* Adds a meta product field to the request.
|
|
141
|
+
* @param length The max length of the meta product field, in characters. Default is 80
|
|
142
|
+
* @param required Whether the meta product field is required. Default is true
|
|
143
|
+
* @returns The builder instance
|
|
144
|
+
*/
|
|
145
|
+
withMetaProduct(length?: number, required?: boolean): this;
|
|
146
|
+
/**
|
|
147
|
+
* Adds an event tracker to the request.
|
|
148
|
+
* @param event The type of event to be tracked
|
|
149
|
+
* @param methods Which methods are acceptable: either 1x1 image pixels or javascript tags, or both
|
|
150
|
+
* @returns The builder instance
|
|
151
|
+
*/
|
|
152
|
+
withEventTracker(event: EventTypes, methods: EventTrackingMethods[]): this;
|
|
153
|
+
/**
|
|
154
|
+
* Generate the native bid request object.
|
|
155
|
+
* @returns The native request object
|
|
156
|
+
*/
|
|
157
|
+
build(): INativeRequest;
|
|
158
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ICoordinates {
|
|
2
|
+
latitude: number;
|
|
3
|
+
longitude: number;
|
|
4
|
+
accuracy: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IGeoContext {
|
|
7
|
+
country: string;
|
|
8
|
+
region: string;
|
|
9
|
+
city: string;
|
|
10
|
+
zip: string;
|
|
11
|
+
coords: ICoordinates;
|
|
12
|
+
utcoffset: number;
|
|
13
|
+
ip: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ISite } from '../rtb';
|
|
2
|
+
export interface IBidRequestedEvent {
|
|
3
|
+
auctionId: string;
|
|
4
|
+
bidderRequestId: string;
|
|
5
|
+
bids: IEventBid[];
|
|
6
|
+
auctionStart: number;
|
|
7
|
+
timeout: number;
|
|
8
|
+
refererInfo: IEventRefererInfo;
|
|
9
|
+
start: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IBidderDoneEvent {
|
|
12
|
+
auctionId: string;
|
|
13
|
+
bidderRequestId: string;
|
|
14
|
+
bids?: IEventBid[];
|
|
15
|
+
auctionStart: number;
|
|
16
|
+
timeout: number;
|
|
17
|
+
refererInfo: IEventRefererInfo;
|
|
18
|
+
start: number;
|
|
19
|
+
}
|
|
20
|
+
export interface IEventBid {
|
|
21
|
+
params: IEventBidParams;
|
|
22
|
+
user?: IEventUser;
|
|
23
|
+
ortb2Imp: IEventOrtb2Imp;
|
|
24
|
+
mediaTypes: IEventMediaTypes;
|
|
25
|
+
transactionId: string;
|
|
26
|
+
sizes: number[][];
|
|
27
|
+
bidId: string;
|
|
28
|
+
ortb2: IEventOrtb2;
|
|
29
|
+
}
|
|
30
|
+
export interface IEventBidParams {
|
|
31
|
+
accountId: string;
|
|
32
|
+
channelId: string;
|
|
33
|
+
siteId: string;
|
|
34
|
+
placementId: string;
|
|
35
|
+
zone: string;
|
|
36
|
+
type: number | string;
|
|
37
|
+
storeId?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface IEventUser {
|
|
40
|
+
geo?: IEventGeo;
|
|
41
|
+
}
|
|
42
|
+
export interface IEventGeo {
|
|
43
|
+
coords?: IEventCoords;
|
|
44
|
+
country?: string | null;
|
|
45
|
+
region?: string | null;
|
|
46
|
+
city?: string | null;
|
|
47
|
+
zip?: string | null;
|
|
48
|
+
utcOffset?: number;
|
|
49
|
+
timezone?: string;
|
|
50
|
+
ip?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface IEventCoords {
|
|
53
|
+
lat: number;
|
|
54
|
+
lon: number;
|
|
55
|
+
accurary?: number | null;
|
|
56
|
+
}
|
|
57
|
+
export interface IEventOrtb2Imp {
|
|
58
|
+
ext?: {
|
|
59
|
+
tid?: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface IEventMediaTypes {
|
|
63
|
+
banner?: {
|
|
64
|
+
sizes: number[][];
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface IEventOrtb2 {
|
|
68
|
+
site?: ISite;
|
|
69
|
+
device?: {
|
|
70
|
+
w?: number;
|
|
71
|
+
h?: number;
|
|
72
|
+
dnt?: number;
|
|
73
|
+
ua?: string;
|
|
74
|
+
language?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface IEventRefererInfo {
|
|
78
|
+
stack: string[];
|
|
79
|
+
location: string;
|
|
80
|
+
page: string;
|
|
81
|
+
domain: string;
|
|
82
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ICoordinates {
|
|
2
|
+
latitude: number;
|
|
3
|
+
longitude: number;
|
|
4
|
+
accuracy: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IGeoContext {
|
|
7
|
+
country: string;
|
|
8
|
+
region: string;
|
|
9
|
+
city: string;
|
|
10
|
+
zip: string;
|
|
11
|
+
coords: ICoordinates;
|
|
12
|
+
utcoffset: number;
|
|
13
|
+
ip: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IUserID = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Geo';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IProductInformation } from '../../models';
|
|
2
|
+
export interface IVast {
|
|
3
|
+
version: string;
|
|
4
|
+
ads: IAd[];
|
|
5
|
+
}
|
|
6
|
+
export interface IAd {
|
|
7
|
+
id?: string;
|
|
8
|
+
inline: IInline;
|
|
9
|
+
}
|
|
10
|
+
export interface IInline {
|
|
11
|
+
impression: IImpression;
|
|
12
|
+
adSystem: string;
|
|
13
|
+
adTitle: string;
|
|
14
|
+
creatives: ILinear[];
|
|
15
|
+
product?: IProductInformation;
|
|
16
|
+
}
|
|
17
|
+
export interface IImpression {
|
|
18
|
+
id: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ICreative extends Record<string, unknown> {
|
|
22
|
+
}
|
|
23
|
+
export interface ICompanionAds extends ICreative {
|
|
24
|
+
}
|
|
25
|
+
export interface ILinear extends ICreative {
|
|
26
|
+
duration: string;
|
|
27
|
+
trackingEvents: ITrackingEvent[];
|
|
28
|
+
mediaFiles: IMediaFile[];
|
|
29
|
+
videoClicks: IVideoClick[];
|
|
30
|
+
}
|
|
31
|
+
export interface ITrackingEvent {
|
|
32
|
+
event: string;
|
|
33
|
+
url: string;
|
|
34
|
+
}
|
|
35
|
+
export interface IMediaFile {
|
|
36
|
+
id?: string;
|
|
37
|
+
delivery: string;
|
|
38
|
+
type: string;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
bitrate?: string;
|
|
42
|
+
url: string;
|
|
43
|
+
}
|
|
44
|
+
export interface IVideoClick {
|
|
45
|
+
id?: string;
|
|
46
|
+
url: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Vast';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IBidRequest, IBidResponse } from '../models';
|
|
2
|
+
import { ILogger } from './Logger';
|
|
3
|
+
import { AsyncResult } from './Result';
|
|
4
|
+
export type RequestBidsFn = (request: IBidRequest) => AsyncResult<IBidResponse>;
|
|
5
|
+
export declare const RequestBids: (logger: ILogger | undefined, url: string, accountId: string, siteId: string, locationId: string, channelId: string, bidRequest: IBidRequest) => AsyncResult<IBidResponse>;
|
|
6
|
+
export declare class NoBidsError extends Error {
|
|
7
|
+
readonly request: IBidRequest;
|
|
8
|
+
readonly response?: Response | undefined;
|
|
9
|
+
constructor(request: IBidRequest, response?: Response | undefined);
|
|
10
|
+
}
|
|
11
|
+
export declare class InternalServerError extends Error {
|
|
12
|
+
readonly request: IBidRequest;
|
|
13
|
+
readonly response: Response;
|
|
14
|
+
constructor(request: IBidRequest, response: Response);
|
|
15
|
+
}
|
|
16
|
+
export declare class BidderStartingUpError extends Error {
|
|
17
|
+
readonly request: IBidRequest;
|
|
18
|
+
readonly response: Response;
|
|
19
|
+
constructor(request: IBidRequest, response: Response);
|
|
20
|
+
}
|
|
21
|
+
export declare class UnknownBidderError extends Error {
|
|
22
|
+
readonly request: IBidRequest;
|
|
23
|
+
readonly response: Response;
|
|
24
|
+
constructor(request: IBidRequest, response: Response);
|
|
25
|
+
}
|
|
26
|
+
export declare class MalformedBidResponseError extends Error {
|
|
27
|
+
readonly request: IBidRequest;
|
|
28
|
+
readonly response: Response;
|
|
29
|
+
readonly bidResponse: unknown;
|
|
30
|
+
constructor(request: IBidRequest, response: Response, bidResponse: unknown);
|
|
31
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type Handlebars from 'handlebars/runtime';
|
|
2
|
+
import type { ICompiledPublisherConfiguration } from '../models';
|
|
3
|
+
import { type AsyncResult, type ILogger } from '.';
|
|
4
|
+
import { HandlebarsHelpers } from '../helpers';
|
|
5
|
+
export type GetConfigurationFn = () => AsyncResult<ICompiledPublisherConfiguration>;
|
|
6
|
+
export declare const GetConfiguration: (logger: ILogger | undefined, url: string, handlebars: typeof Handlebars, helpers: HandlebarsHelpers, accountId: string, siteId: string) => AsyncResult<ICompiledPublisherConfiguration>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IDevice } from '../models';
|
|
2
|
+
import { type ILogger, type Result } from '.';
|
|
3
|
+
export type GetDeviceFn = (screen: IScreen, navigator: INavigator, mobile: boolean) => Result<IDevice>;
|
|
4
|
+
export interface IScreen {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface INavigator {
|
|
9
|
+
userAgent: string;
|
|
10
|
+
language: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const GetDevice: (logger: ILogger | undefined, screen: IScreen, navigator: INavigator, mobile: boolean) => Result<IDevice>;
|