@surfside/ads-core 1.0.6
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 +64 -0
- package/lib/index.js +1 -0
- package/lib/types/constant-values/index.d.ts +46 -0
- package/lib/types/errors/index.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 +4 -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/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 +19 -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/index.d.ts +4 -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/index.d.ts +3 -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/index.d.ts +3 -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/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 +3 -0
- package/lib/types/models/vast/Vast.d.ts +50 -0
- package/lib/types/models/vast/index.d.ts +1 -0
- package/lib/types/services/OverrideService.d.ts +10 -0
- package/lib/types/services/index.d.ts +5 -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/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 +47 -0
|
@@ -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,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,50 @@
|
|
|
1
|
+
import type { IProductInformation } from '../../models';
|
|
2
|
+
export interface IVast {
|
|
3
|
+
version: string;
|
|
4
|
+
ads: IAd[];
|
|
5
|
+
}
|
|
6
|
+
export interface IAd {
|
|
7
|
+
id: string | null;
|
|
8
|
+
inline: IInline;
|
|
9
|
+
}
|
|
10
|
+
export interface IVastProductData extends IProductInformation {
|
|
11
|
+
productId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IInline {
|
|
14
|
+
impression: IImpression;
|
|
15
|
+
adSystem: string;
|
|
16
|
+
adTitle: string;
|
|
17
|
+
creatives: ICreative[];
|
|
18
|
+
product?: IVastProductData;
|
|
19
|
+
}
|
|
20
|
+
export interface IImpression {
|
|
21
|
+
id: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ICreative extends Record<string, unknown> {
|
|
25
|
+
}
|
|
26
|
+
export interface ICompanionAds extends ICreative {
|
|
27
|
+
}
|
|
28
|
+
export interface ILinear extends ICreative {
|
|
29
|
+
duration: string;
|
|
30
|
+
trackingEvents: ITrackingEvent[];
|
|
31
|
+
mediaFiles: IMediaFile[];
|
|
32
|
+
videoClicks: IVideoClick[];
|
|
33
|
+
}
|
|
34
|
+
export interface ITrackingEvent {
|
|
35
|
+
event: string;
|
|
36
|
+
url: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IMediaFile {
|
|
39
|
+
id: string | null;
|
|
40
|
+
delivery: string;
|
|
41
|
+
type: string;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
bitrate: string | null;
|
|
45
|
+
url: string;
|
|
46
|
+
}
|
|
47
|
+
export interface IVideoClick {
|
|
48
|
+
id: string | null;
|
|
49
|
+
url: string;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Vast';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ILoggerService } from './logger';
|
|
2
|
+
export declare abstract class OverrideService<T> {
|
|
3
|
+
private readonly _selector;
|
|
4
|
+
protected readonly logger?: ILoggerService | undefined;
|
|
5
|
+
protected overrideData: T | null;
|
|
6
|
+
protected overrideNode: HTMLElement | null;
|
|
7
|
+
constructor(_selector: string, logger?: ILoggerService | undefined);
|
|
8
|
+
protected getOverrideNode(): HTMLElement | null;
|
|
9
|
+
abstract mapDataSetToData(dataset: DOMStringMap): T | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
NONE = 0,
|
|
3
|
+
ERRORS = 1,
|
|
4
|
+
INFO = 2,
|
|
5
|
+
DEBUG = 3
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Interface for a logger service
|
|
9
|
+
*/
|
|
10
|
+
export interface ILoggerService {
|
|
11
|
+
/**
|
|
12
|
+
* Prints info. This is useful for tracking the lifecycle of a bid request
|
|
13
|
+
*
|
|
14
|
+
* @param args The arguments to print
|
|
15
|
+
*/
|
|
16
|
+
info: (...args: any[]) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Prints a warning. This is useful for tracking potential issues, but not critical errors. Warnings should not
|
|
19
|
+
* prevent the bidding process from continuing, but may disable certain features such as commerce media or certain
|
|
20
|
+
* types of targeting
|
|
21
|
+
*
|
|
22
|
+
* @param args
|
|
23
|
+
*/
|
|
24
|
+
warn: (...args: any[]) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Prints an error. This is useful for tracking critical errors. Printing an error should indicate that the bidding
|
|
27
|
+
* process can go no further.
|
|
28
|
+
*
|
|
29
|
+
* @param args The arguments to print
|
|
30
|
+
*/
|
|
31
|
+
error: (...args: any[]) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Spammy messages. This is useful for tracking the lifecycle of a bid request and debugging issues with special
|
|
34
|
+
* flags enabled. When there is an issue on the client side, enabling debug logs will help the developer understand
|
|
35
|
+
* where the issue is in the code and potentially what the issue is. These should be added to every function.
|
|
36
|
+
* @param args The arguments to print
|
|
37
|
+
*/
|
|
38
|
+
debug: (...args: any[]) => void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ILoggerService, LogLevel } from '../../services';
|
|
2
|
+
/**
|
|
3
|
+
* Logger service which adds some color to the console logs
|
|
4
|
+
*/
|
|
5
|
+
export declare class LocalLoggerService implements ILoggerService {
|
|
6
|
+
private readonly _logLevel;
|
|
7
|
+
constructor(_logLevel: LogLevel);
|
|
8
|
+
debug(...args: any[]): void;
|
|
9
|
+
info(...args: any[]): void;
|
|
10
|
+
warn(...args: any[]): void;
|
|
11
|
+
error(...args: any[]): void;
|
|
12
|
+
/**
|
|
13
|
+
* Shows a log message with [SURF] prepended and colored
|
|
14
|
+
* @param log The console log function to use (e.g: console.log, console.error, etc.)
|
|
15
|
+
* @param args The actual log message
|
|
16
|
+
* @param color The color to use for the log message
|
|
17
|
+
*/
|
|
18
|
+
private _log;
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IProductInformation } from '../../models';
|
|
2
|
+
export interface IProductFeedService {
|
|
3
|
+
getProduct: (accountId: string, siteId: string, locationId: string, productId: string) => Promise<IProductInformation | null>;
|
|
4
|
+
getNativeProduct: (accountId: string, siteId: string, locationId: string, productId: string) => Promise<IProductInformation | null>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IProductInformation } from '../../models';
|
|
2
|
+
import type { ILoggerService, IProductFeedService } from '../../services';
|
|
3
|
+
export declare class SurfsideProductFeedService implements IProductFeedService {
|
|
4
|
+
private readonly _logger?;
|
|
5
|
+
private readonly _url;
|
|
6
|
+
constructor(url: string, _logger?: ILoggerService | undefined);
|
|
7
|
+
getProduct(accountId: string, siteId: string, locationId: string, productId: string): Promise<IProductInformation | null>;
|
|
8
|
+
getNativeProduct(accountId: string, siteId: string | undefined, locationId: string, productId: string): Promise<IProductInformation | null>;
|
|
9
|
+
private _mapResponseToProductInformation;
|
|
10
|
+
private _getFieldOrNull;
|
|
11
|
+
}
|