@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,26 @@
|
|
|
1
|
+
import type { IApp, IBidRequest, IDevice, IImp, IRegs, ISite, ISource, IUser } from '../../models';
|
|
2
|
+
export declare class SimpleBannerRequest implements IBidRequest {
|
|
3
|
+
id: string;
|
|
4
|
+
imp: IImp[];
|
|
5
|
+
site?: ISite | undefined;
|
|
6
|
+
app?: IApp | undefined;
|
|
7
|
+
device?: IDevice | undefined;
|
|
8
|
+
user?: IUser | undefined;
|
|
9
|
+
test?: number | undefined;
|
|
10
|
+
at?: number | undefined;
|
|
11
|
+
tmax?: number | undefined;
|
|
12
|
+
wseat?: string[] | undefined;
|
|
13
|
+
bseat?: string[] | undefined;
|
|
14
|
+
allimps?: number | undefined;
|
|
15
|
+
cur?: string[] | undefined;
|
|
16
|
+
wlang?: string[] | undefined;
|
|
17
|
+
wlangb?: string[] | undefined;
|
|
18
|
+
bcat?: string[] | undefined;
|
|
19
|
+
cattax?: number[] | undefined;
|
|
20
|
+
badv?: string[] | undefined;
|
|
21
|
+
bapp?: string[] | undefined;
|
|
22
|
+
source?: ISource | undefined;
|
|
23
|
+
regs?: IRegs | undefined;
|
|
24
|
+
ext?: any;
|
|
25
|
+
constructor(id: string, w: number, h: number);
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IBuiltResponse } from './BuiltResponse';
|
|
2
|
+
/**
|
|
3
|
+
* A built banner response - includes the `adm` field for the banner as well as the rendered commerce media
|
|
4
|
+
* clickthrough URL template, if applicable.
|
|
5
|
+
*
|
|
6
|
+
* @expandType IBuiltResponse
|
|
7
|
+
*/
|
|
8
|
+
export interface IBuiltBannerResponse extends IBuiltResponse {
|
|
9
|
+
/**
|
|
10
|
+
* Indicates the type of the {@link IBuiltResponse}. 0 means Banner
|
|
11
|
+
*/
|
|
12
|
+
type: 'banner';
|
|
13
|
+
/**
|
|
14
|
+
* The HTML of the banner creative
|
|
15
|
+
*/
|
|
16
|
+
adm: string;
|
|
17
|
+
/**
|
|
18
|
+
* The clickthrough URL of the creative, if it the banner is a commerce media creative (i.e, the URL is built from
|
|
19
|
+
* the clickthrough URL template). For regular static banners that click out to 3rd party sites, this is `undefined`
|
|
20
|
+
*/
|
|
21
|
+
clickthrough?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IBid } from '../../models';
|
|
2
|
+
export declare const CreativeType: {
|
|
3
|
+
readonly Banner: 0;
|
|
4
|
+
readonly Video: 1;
|
|
5
|
+
readonly ProductCard: 2;
|
|
6
|
+
readonly Carousel: 3;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A built creative response. Includes the bid response which fed the creative as well as a `type` field indicating what
|
|
10
|
+
* kind of creative it is (i.e, {@link IBuiltBannerResponse }, {@link IBuiltVideo}, {@link IBuiltProductCardResponse},
|
|
11
|
+
* {@link IBuiltCarousel}).
|
|
12
|
+
*
|
|
13
|
+
* @see IBuiltBannerResponse
|
|
14
|
+
* @see IBuiltVideo
|
|
15
|
+
* @see IBuiltProductCardResponse
|
|
16
|
+
* @see IBuiltCarousel
|
|
17
|
+
*/
|
|
18
|
+
export interface IBuiltResponse {
|
|
19
|
+
/**
|
|
20
|
+
* The OpenRTB Bid object which created this creative
|
|
21
|
+
*/
|
|
22
|
+
bid: IBid;
|
|
23
|
+
}
|
|
24
|
+
export declare class MissingAdmError extends Error {
|
|
25
|
+
readonly bid: IBid | null;
|
|
26
|
+
constructor(bid: IBid | null);
|
|
27
|
+
}
|
|
28
|
+
export declare class MissingProductError extends Error {
|
|
29
|
+
readonly bid?: IBid | undefined;
|
|
30
|
+
constructor(bid?: IBid | undefined);
|
|
31
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IBid, IBidRequest } from '../../models';
|
|
2
|
+
import { type ILogger, type NonPersonalRecommenderFn, type PersonalRecommenderFn, type RequestBidsFn, type Result } from '../../services';
|
|
3
|
+
import { EvaluateClickthroughTemplateFn } from '../../services/Template';
|
|
4
|
+
import type { GenerateSponsoredProductCardResponseFn, IBuiltProductCardResponse } from './ProductCard';
|
|
5
|
+
export type BuildSponsoredCarouselFn = (request: IBidRequest) => Result<IBuiltCarousel>;
|
|
6
|
+
export type BuildSponsoredCarouselFromInitialBidFn = (request: IBidRequest, initialBid: IBid) => Result<IBuiltCarousel>;
|
|
7
|
+
export type BuildRecommendedCarouselFn = (RecommenderType: PublicRecommenderType) => Result<IBuiltCarousel>;
|
|
8
|
+
export type BuildHybridCarouselFn = (recommenderType: PublicRecommenderType, request: IBidRequest) => Result<IBuiltCarousel>;
|
|
9
|
+
export type BuildHybridCarouselFromInitialBidFn = (RecommenderType: PublicRecommenderType, request: IBidRequest, initialBid: IBid) => Result<IBuiltCarousel>;
|
|
10
|
+
export type CarouselNextProductFn = () => AsyncGenerator<IBuiltProductCardResponse>;
|
|
11
|
+
export interface IBuiltCarousel {
|
|
12
|
+
type: 'carousel';
|
|
13
|
+
getProduct: CarouselNextProductFn;
|
|
14
|
+
}
|
|
15
|
+
export type RecommenderType = 'top-products' | 'for-you' | 'past-purchases';
|
|
16
|
+
export interface IPublicTopProductsRecommenderType {
|
|
17
|
+
type: 'top-products';
|
|
18
|
+
}
|
|
19
|
+
export interface IPublicForYouRecommenderType {
|
|
20
|
+
type: 'for-you';
|
|
21
|
+
}
|
|
22
|
+
export interface IPublicPastPurchasesRecommenderType {
|
|
23
|
+
type: 'past-purchases';
|
|
24
|
+
}
|
|
25
|
+
export type PublicRecommenderType = IPublicTopProductsRecommenderType | IPublicForYouRecommenderType | IPublicPastPurchasesRecommenderType;
|
|
26
|
+
export interface ITopProductRecommender {
|
|
27
|
+
recommenderType: 'top-products';
|
|
28
|
+
topProductGenerator: NonPersonalRecommenderFn;
|
|
29
|
+
}
|
|
30
|
+
export interface IForYouProductRecommender {
|
|
31
|
+
recommenderType: 'for-you';
|
|
32
|
+
forYouProductGenerator: PersonalRecommenderFn;
|
|
33
|
+
topProductGenerator: NonPersonalRecommenderFn;
|
|
34
|
+
userId?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IPastPurchasesProductRecommender {
|
|
37
|
+
recommenderType: 'past-purchases';
|
|
38
|
+
pastPurchasesProductGenerator: PersonalRecommenderFn;
|
|
39
|
+
topProductGenerator: NonPersonalRecommenderFn;
|
|
40
|
+
userId?: string;
|
|
41
|
+
}
|
|
42
|
+
export type ProductRecommender = ITopProductRecommender | IForYouProductRecommender | IPastPurchasesProductRecommender;
|
|
43
|
+
export declare const BuildSponsoredCarousel: (logger: ILogger | undefined, requestBids: RequestBidsFn, generateProductCardResponse: GenerateSponsoredProductCardResponseFn, request: IBidRequest) => Result<IBuiltCarousel>;
|
|
44
|
+
export declare const BuildSponsoredCarouselFromInitialBid: (logger: ILogger | undefined, requestBids: RequestBidsFn, generateProductCardResponse: GenerateSponsoredProductCardResponseFn, request: IBidRequest, initialBid: IBid) => Result<IBuiltCarousel>;
|
|
45
|
+
export declare const BuildRecommendedCarousel: (logger: ILogger | undefined, evaluateClickthroughTemplate: EvaluateClickthroughTemplateFn, topProductGenerator: NonPersonalRecommenderFn, forYouProductGenerator: PersonalRecommenderFn, pastPurchasesProductGenerator: PersonalRecommenderFn, userId: string | undefined, recommenderType: PublicRecommenderType) => Result<IBuiltCarousel>;
|
|
46
|
+
export declare const BuildHybridCarousel: (logger: ILogger | undefined, evaluateClickthroughTemplate: EvaluateClickthroughTemplateFn, requestBids: RequestBidsFn, generateProductCardResponse: GenerateSponsoredProductCardResponseFn, topProductGenerator: NonPersonalRecommenderFn, forYouProductGenerator: PersonalRecommenderFn, pastPurchasesProductGenerator: PersonalRecommenderFn, userId: string | undefined, recommenderType: PublicRecommenderType, request: IBidRequest) => Result<IBuiltCarousel>;
|
|
47
|
+
export declare const BuildHybridCarouselFromInitialBid: (logger: ILogger | undefined, evaluateClickthroughTemplate: EvaluateClickthroughTemplateFn, requestBids: RequestBidsFn, generateProductCardResponse: GenerateSponsoredProductCardResponseFn, topProductGenerator: NonPersonalRecommenderFn, forYouProductGenerator: PersonalRecommenderFn, pastPurchasesProductGenerator: PersonalRecommenderFn, userId: string | undefined, recommenderType: PublicRecommenderType, request: IBidRequest, initialBid: IBid) => Result<IBuiltCarousel>;
|
|
48
|
+
export declare class InvalidRecommenderTypeError extends Error {
|
|
49
|
+
type: string;
|
|
50
|
+
constructor(type: string);
|
|
51
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ICompiledPublisherConfiguration, INativeTemplateDelegateWindow, IProductInformation } from '../../models';
|
|
2
|
+
import { ILogger, Result } from '../../services';
|
|
3
|
+
export declare const BuildClickthroughUrl: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, product: IProductInformation) => Result<string>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IBid, ICompiledPublisherConfiguration, INativeResponse, INativeTemplateDelegateWindow, IProductInformation } from '../../models';
|
|
2
|
+
import { AsyncResult, GetAllSponsoredProductFromNativeIdFn, ILogger } from '../../services';
|
|
3
|
+
import { IBuiltResponse } from './BuiltResponse';
|
|
4
|
+
export type BuildAllSponsoredProductCardResponsesFn = (bids: IBid[]) => AsyncResult<IBuiltProductCardBidResponse[]>;
|
|
5
|
+
export type GenerateSponsoredProductCardResponseFn = (bids: IBid[]) => AsyncGenerator<IBuiltProductCardBidResponse>;
|
|
6
|
+
export interface ITracker {
|
|
7
|
+
type: number;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IPixelTracker extends ITracker {
|
|
11
|
+
type: 1;
|
|
12
|
+
}
|
|
13
|
+
export interface IScriptTracker extends ITracker {
|
|
14
|
+
type: 2;
|
|
15
|
+
}
|
|
16
|
+
export interface ITrackerObject {
|
|
17
|
+
win: string;
|
|
18
|
+
imp: string[];
|
|
19
|
+
others: ITracker[];
|
|
20
|
+
}
|
|
21
|
+
export type IBuiltProductCardBidResponse = IBuiltResponse & IBuiltProductCardResponse & {
|
|
22
|
+
native: INativeResponse;
|
|
23
|
+
sponsored: true;
|
|
24
|
+
};
|
|
25
|
+
export interface IBuiltProductCardResponse {
|
|
26
|
+
type: 'product-card';
|
|
27
|
+
product: IProductInformation;
|
|
28
|
+
trackers?: ITrackerObject;
|
|
29
|
+
clickthrough: string;
|
|
30
|
+
sponsored: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const BuildAllSponsoredProductCardResponses: (logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]) => AsyncResult<IBuiltProductCardBidResponse[]>;
|
|
33
|
+
export declare function GenerateSponsoredProductCardResponse(logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]): AsyncGenerator<IBuiltProductCardBidResponse>;
|
|
34
|
+
export declare class MissingBidsError extends Error {
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
37
|
+
export declare class MalformedNativeResponseError extends Error {
|
|
38
|
+
readonly bid: IBid;
|
|
39
|
+
constructor(bid: IBid);
|
|
40
|
+
}
|
|
41
|
+
export declare class MissingWinUrlError extends Error {
|
|
42
|
+
readonly bid: IBid;
|
|
43
|
+
constructor(bid: IBid);
|
|
44
|
+
}
|
|
45
|
+
export declare class MissingProductIdError extends Error {
|
|
46
|
+
readonly bid: IBid;
|
|
47
|
+
readonly native: INativeResponse;
|
|
48
|
+
constructor(bid: IBid, native: INativeResponse);
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IVast } from '../../models';
|
|
2
|
+
import { IBuiltResponse } from './BuiltResponse';
|
|
3
|
+
/**
|
|
4
|
+
* A built video response. The raw Vast XML response from the bidder has been parsed out into a structure object here.
|
|
5
|
+
* @expandType IBuiltResponse
|
|
6
|
+
*/
|
|
7
|
+
export interface IBuiltVideo extends IBuiltResponse {
|
|
8
|
+
type: 'video';
|
|
9
|
+
/**
|
|
10
|
+
* The parsed out Vast Video object
|
|
11
|
+
*/
|
|
12
|
+
video: IVast;
|
|
13
|
+
/**
|
|
14
|
+
* The clickthrough URL for the video
|
|
15
|
+
*/
|
|
16
|
+
clickthrough: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IBid, IBidResponse, ICompiledPublisherConfiguration, IProductInformation } from '../../models';
|
|
2
|
+
interface IBuiltBanner {
|
|
3
|
+
element: HTMLDivElement | null;
|
|
4
|
+
product: IProductInformation | null;
|
|
5
|
+
clickThrough: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function BuildBanner(response: IBidResponse | null, config?: ICompiledPublisherConfiguration): IBuiltBanner;
|
|
8
|
+
export declare function BuildBannerFromBid(bid: IBid): HTMLDivElement | null;
|
|
9
|
+
export declare function BuildProductInfoFromElement(element: HTMLDivElement): IProductInformation | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type IBidResponse, type ICompiledPublisherConfiguration, type INativeResponse } from '../../models';
|
|
2
|
+
import { ILoggerService, type IProductFeedService } from '../../services';
|
|
3
|
+
export interface ITrackers {
|
|
4
|
+
pixels: string[];
|
|
5
|
+
js: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface IBuiltNative {
|
|
8
|
+
data: INativeResponse;
|
|
9
|
+
clickThrough: string;
|
|
10
|
+
winUrl: string;
|
|
11
|
+
trackers: ITrackers;
|
|
12
|
+
element?: Element;
|
|
13
|
+
}
|
|
14
|
+
export interface IPublisherContext {
|
|
15
|
+
config: ICompiledPublisherConfiguration;
|
|
16
|
+
productService: IProductFeedService;
|
|
17
|
+
accountId: string;
|
|
18
|
+
siteId: string;
|
|
19
|
+
locationId: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function BuildNativeResponse(response: IBidResponse | null, context?: IPublisherContext, logger?: ILoggerService): Promise<IBuiltNative[]>;
|
|
File without changes
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IBidResponse, IVast } from '../../models';
|
|
2
|
+
import type { ILoggerService } from '../../services';
|
|
3
|
+
export declare function DeserializeVideo(response: IBidResponse, logger?: ILoggerService): IVast | null;
|
|
4
|
+
export declare function DeserializeVast(logger: ILoggerService | undefined, adm: string): IVast;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IBidRequest } from '../models';
|
|
2
|
+
import type { IDeviceService, ILoggerService } from '../services';
|
|
3
|
+
export declare function DeviceMiddleware(logger: ILoggerService | undefined, deviceService: IDeviceService | undefined, request: IBidRequest): Promise<IBidRequest>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IBidRequest } from '../models';
|
|
2
|
+
import type { IGeoService, ILoggerService } from '../services';
|
|
3
|
+
export declare function GeoMiddlewareImmediate(geoService: IGeoService, logger: ILoggerService | undefined, request: IBidRequest, geoTargetingEnabled: boolean, ipTargetingEnabled: boolean): Promise<IBidRequest>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type IBidRequest } from '../models';
|
|
2
|
+
import type { ILoggerService, IUserIDService } from '../services';
|
|
3
|
+
export declare function IdentityMiddleware(userIDService: IUserIDService, logger: ILoggerService | undefined, request: IBidRequest): Promise<IBidRequest>;
|
|
4
|
+
export declare const buildIdentityMiddleware: (userIdService: IUserIDService, logger: ILoggerService | undefined) => (request: IBidRequest) => Promise<IBidRequest>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface IDynamicZone {
|
|
2
|
+
value: IScreenSize[];
|
|
3
|
+
}
|
|
4
|
+
export interface IScreenSize {
|
|
5
|
+
size: 'default' | 'mobile' | 'tablet' | 'desktop';
|
|
6
|
+
values: DynamicCreative[];
|
|
7
|
+
}
|
|
8
|
+
export interface IDynamicCreative {
|
|
9
|
+
zoneId: string;
|
|
10
|
+
keywords?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface IDynamicSimpleCreative extends IDynamicCreative {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
export interface IDynamicCatalogCreative extends IDynamicCreative {
|
|
17
|
+
strategy?: 'sponsored' | 'hybrid' | 'recommended';
|
|
18
|
+
recommendation?: 'top-products' | 'for-you' | 'past-purchases';
|
|
19
|
+
}
|
|
20
|
+
export interface IDynamicVideo extends IDynamicSimpleCreative {
|
|
21
|
+
type: 'Video';
|
|
22
|
+
minDuration?: number;
|
|
23
|
+
maxDuration: number;
|
|
24
|
+
}
|
|
25
|
+
export interface IDynamicBanner extends IDynamicSimpleCreative {
|
|
26
|
+
type: 'Banner';
|
|
27
|
+
}
|
|
28
|
+
export interface IDynamicProductCard extends IDynamicCatalogCreative {
|
|
29
|
+
type: 'ProductCard';
|
|
30
|
+
}
|
|
31
|
+
export interface IDynamicCarousel extends IDynamicCatalogCreative {
|
|
32
|
+
type: 'Carousel';
|
|
33
|
+
maxItems?: number;
|
|
34
|
+
cardMinWidth: number;
|
|
35
|
+
nextType: 'page' | 'product';
|
|
36
|
+
}
|
|
37
|
+
export type DynamicCreative = IDynamicBanner | IDynamicCarousel | IDynamicProductCard | IDynamicVideo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DynamicZone';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { IDynamicZone, IProductInformation } from '../../models';
|
|
2
|
+
export type ProductCallback = (e: Event, product: IProductInformation) => void;
|
|
3
|
+
export type Callbacks = Record<string, ProductCallback>;
|
|
4
|
+
export type TemplateDelegate = (context: IProductContext) => string;
|
|
5
|
+
export interface INativeTemplateDelegateWindow {
|
|
6
|
+
href: string;
|
|
7
|
+
origin: string;
|
|
8
|
+
port: string;
|
|
9
|
+
path: string;
|
|
10
|
+
host: string;
|
|
11
|
+
host_name: string;
|
|
12
|
+
search: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
protocol: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IPublisherConfiguration {
|
|
17
|
+
geoTargeting?: boolean;
|
|
18
|
+
ipTargeting?: boolean;
|
|
19
|
+
clickThroughUrlTemplate?: string;
|
|
20
|
+
productCardTemplate?: string;
|
|
21
|
+
productCardStyleSheet?: string;
|
|
22
|
+
carouselStyleSheet?: string;
|
|
23
|
+
reAuctionEnabled?: boolean;
|
|
24
|
+
reAuctionInterval?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ICompiledPublisherConfigurationTemplatesDTO {
|
|
27
|
+
productCardTemplate: string;
|
|
28
|
+
productCardStylesheet: string;
|
|
29
|
+
clickThroughUrlTemplate: string;
|
|
30
|
+
carouselStylesheet: string;
|
|
31
|
+
javascriptCallbacks: string;
|
|
32
|
+
}
|
|
33
|
+
export interface IProductContext extends IProductInformation {
|
|
34
|
+
product: Partial<IProductInformation>;
|
|
35
|
+
window: INativeTemplateDelegateWindow;
|
|
36
|
+
publisher: ICompiledPublisherConfiguration;
|
|
37
|
+
catalog: IProductInformation;
|
|
38
|
+
clickthrough?: string;
|
|
39
|
+
ext?: any;
|
|
40
|
+
}
|
|
41
|
+
export interface ICompiledPublisherConfigurationTemplates {
|
|
42
|
+
productCardTemplate: TemplateDelegate;
|
|
43
|
+
clickThroughUrlTemplate: TemplateDelegate;
|
|
44
|
+
productCardStylesheet: string;
|
|
45
|
+
carouselStylesheet: string;
|
|
46
|
+
javascriptCallbacks: Callbacks;
|
|
47
|
+
}
|
|
48
|
+
export interface ICompiledPublisherConfigurationSettingsDTO {
|
|
49
|
+
commerceMediaEnabled: boolean;
|
|
50
|
+
ipTargetingEnabled: boolean;
|
|
51
|
+
geoTargetingEnabled: boolean;
|
|
52
|
+
reauctionEnabled: boolean;
|
|
53
|
+
reauctionIntervalMs: number;
|
|
54
|
+
productFeedEnabled: boolean;
|
|
55
|
+
sponsoredByEnabled?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface ICompiledPublisherConfigurationDTO {
|
|
58
|
+
templates: ICompiledPublisherConfigurationTemplatesDTO;
|
|
59
|
+
settings: ICompiledPublisherConfigurationSettingsDTO;
|
|
60
|
+
dynamicZones?: Record<string, IDynamicZone>;
|
|
61
|
+
}
|
|
62
|
+
export interface ICompiledPublisherConfiguration {
|
|
63
|
+
settings: ICompiledPublisherConfigurationSettingsDTO;
|
|
64
|
+
templates: ICompiledPublisherConfigurationTemplates;
|
|
65
|
+
dynamicZones?: Record<string, IDynamicZone>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface IProductInformation {
|
|
2
|
+
image: string | null;
|
|
3
|
+
price: string | null;
|
|
4
|
+
salePrice: string | null;
|
|
5
|
+
thc: string | null;
|
|
6
|
+
strain: string | null;
|
|
7
|
+
cbd: string | null;
|
|
8
|
+
name: string | null;
|
|
9
|
+
brand_name: string | null;
|
|
10
|
+
brandName: string | null;
|
|
11
|
+
productType: string | null;
|
|
12
|
+
details: string | null;
|
|
13
|
+
cta: string | null;
|
|
14
|
+
clickthroughUrl: string | null;
|
|
15
|
+
winUrl: string | null;
|
|
16
|
+
pixelUrl: string | null;
|
|
17
|
+
ext?: any;
|
|
18
|
+
}
|
|
19
|
+
export declare class DefaultProductInformation implements IProductInformation {
|
|
20
|
+
image: string | null;
|
|
21
|
+
price: string | null;
|
|
22
|
+
salePrice: string | null;
|
|
23
|
+
thc: string | null;
|
|
24
|
+
strain: string | null;
|
|
25
|
+
cbd: string | null;
|
|
26
|
+
name: string | null;
|
|
27
|
+
brand_name: string | null;
|
|
28
|
+
brandName: string | null;
|
|
29
|
+
productType: string | null;
|
|
30
|
+
details: string | null;
|
|
31
|
+
cta: string | null;
|
|
32
|
+
clickthroughUrl: string | null;
|
|
33
|
+
winUrl: string | null;
|
|
34
|
+
pixelUrl: string | null;
|
|
35
|
+
ext?: any;
|
|
36
|
+
constructor();
|
|
37
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { IProductInformation } from '../../models';
|
|
2
|
+
import type Handlebars from 'handlebars/runtime';
|
|
3
|
+
export type ProductCallback = (e: Event, product: IProductInformation) => void;
|
|
4
|
+
export interface ICallbacks extends Record<string, ProductCallback> {
|
|
5
|
+
}
|
|
6
|
+
export interface INativeTemplateDelegateWindow {
|
|
7
|
+
origin: string;
|
|
8
|
+
port: string;
|
|
9
|
+
path: string;
|
|
10
|
+
host: string;
|
|
11
|
+
host_name: string;
|
|
12
|
+
search: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
protocol: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IPublisherConfiguration {
|
|
17
|
+
geoTargeting?: boolean;
|
|
18
|
+
ipTargeting?: boolean;
|
|
19
|
+
clickThroughUrlTemplate?: string;
|
|
20
|
+
productCardTemplate?: string;
|
|
21
|
+
productCardStyleSheet?: string;
|
|
22
|
+
carouselStyleSheet?: string;
|
|
23
|
+
reAuctionEnabled?: boolean;
|
|
24
|
+
reAuctionInterval?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ICompiledPublisherConfigurationTemplatesDTO {
|
|
27
|
+
productCardTemplate: string;
|
|
28
|
+
productCardStylesheet: string;
|
|
29
|
+
clickThroughUrlTemplate: string;
|
|
30
|
+
carouselStylesheet: string;
|
|
31
|
+
javascriptCallbacks: string;
|
|
32
|
+
}
|
|
33
|
+
export interface IProductContext {
|
|
34
|
+
product: Partial<IProductInformation>;
|
|
35
|
+
window: INativeTemplateDelegateWindow;
|
|
36
|
+
publisher: ICompiledPublisherConfiguration;
|
|
37
|
+
catalog: IProductInformation;
|
|
38
|
+
clickthrough?: string;
|
|
39
|
+
ext: any;
|
|
40
|
+
}
|
|
41
|
+
export interface ICompiledPublisherConfigurationTemplates {
|
|
42
|
+
productCardTemplate: Handlebars.TemplateDelegate<IProductContext>;
|
|
43
|
+
clickThroughUrlTemplate: Handlebars.TemplateDelegate<IProductContext>;
|
|
44
|
+
productCardStylesheet: string;
|
|
45
|
+
carouselStylesheet: string;
|
|
46
|
+
javascriptCallbacks: ICallbacks;
|
|
47
|
+
}
|
|
48
|
+
export interface ICompiledPublisherConfigurationSettingsDTO {
|
|
49
|
+
commerceMediaEnabled: boolean;
|
|
50
|
+
ipTargetingEnabled: boolean;
|
|
51
|
+
geoTargetingEnabled: boolean;
|
|
52
|
+
reauctionEnabled: boolean;
|
|
53
|
+
reauctionIntervalMs: number;
|
|
54
|
+
productFeedEnabled: boolean;
|
|
55
|
+
sponsoredByEnabled?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface ICompiledPublisherConfigurationDTO {
|
|
58
|
+
templates: ICompiledPublisherConfigurationTemplatesDTO;
|
|
59
|
+
settings: ICompiledPublisherConfigurationSettingsDTO;
|
|
60
|
+
}
|
|
61
|
+
export interface ICompiledPublisherConfiguration {
|
|
62
|
+
settings: ICompiledPublisherConfigurationSettingsDTO;
|
|
63
|
+
templates: ICompiledPublisherConfigurationTemplates;
|
|
64
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IProductInformation {
|
|
2
|
+
id?: string;
|
|
3
|
+
image?: string;
|
|
4
|
+
price?: string;
|
|
5
|
+
salePrice?: string;
|
|
6
|
+
thc?: string;
|
|
7
|
+
strain?: string;
|
|
8
|
+
cbd?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
brand_name?: string;
|
|
11
|
+
brandName?: string;
|
|
12
|
+
productType?: string;
|
|
13
|
+
details?: string;
|
|
14
|
+
cta?: string;
|
|
15
|
+
clickthroughUrl?: string;
|
|
16
|
+
winUrl?: string;
|
|
17
|
+
pixelUrl?: string;
|
|
18
|
+
ext?: any;
|
|
19
|
+
}
|