@surfside/ads-core 2.5.0-3757d11d.0 → 2.5.0-4fcf80fb.0
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/lib/cjs/Api.js +2 -1
- package/lib/cjs/Api.js.map +1 -1
- package/lib/cjs/BuildInfo.js +2 -2
- package/lib/cjs/BuildInfo.js.map +1 -1
- package/lib/cjs/Init.js +8 -4
- package/lib/cjs/Init.js.map +1 -1
- package/lib/cjs/helpers/RequestBuilder.js +9 -4
- package/lib/cjs/helpers/RequestBuilder.js.map +1 -1
- package/lib/cjs/helpers/response/Carousel.js +25 -10
- package/lib/cjs/helpers/response/Carousel.js.map +1 -1
- package/lib/cjs/helpers/response/ProductCard.js +11 -10
- package/lib/cjs/helpers/response/ProductCard.js.map +1 -1
- package/lib/cjs/helpers/response/Products.js +19 -8
- package/lib/cjs/helpers/response/Products.js.map +1 -1
- package/lib/cjs/models/retail/Configuration.js +1 -0
- package/lib/cjs/models/retail/Configuration.js.map +1 -1
- package/lib/cjs/models/rtb/BidRequest.js +1 -0
- package/lib/cjs/models/rtb/BidRequest.js.map +1 -1
- package/lib/cjs/services/Bidder.js +47 -5
- package/lib/cjs/services/Bidder.js.map +1 -1
- package/lib/cjs/services/BotFiltering.js +1 -1
- package/lib/cjs/services/BotFiltering.js.map +1 -1
- package/lib/cjs/services/LocationOverrides.js +21 -0
- package/lib/cjs/services/LocationOverrides.js.map +1 -0
- package/lib/cjs/services/index.js +1 -0
- package/lib/cjs/services/index.js.map +1 -1
- package/lib/esm/Api.js +3 -2
- package/lib/esm/Api.js.map +1 -1
- package/lib/esm/BuildInfo.js +2 -2
- package/lib/esm/BuildInfo.js.map +1 -1
- package/lib/esm/Init.js +9 -5
- package/lib/esm/Init.js.map +1 -1
- package/lib/esm/helpers/RequestBuilder.js +9 -4
- package/lib/esm/helpers/RequestBuilder.js.map +1 -1
- package/lib/esm/helpers/response/Carousel.js +26 -11
- package/lib/esm/helpers/response/Carousel.js.map +1 -1
- package/lib/esm/helpers/response/ProductCard.js +12 -11
- package/lib/esm/helpers/response/ProductCard.js.map +1 -1
- package/lib/esm/helpers/response/Products.js +20 -9
- package/lib/esm/helpers/response/Products.js.map +1 -1
- package/lib/esm/models/retail/Configuration.js +1 -0
- package/lib/esm/models/retail/Configuration.js.map +1 -1
- package/lib/esm/models/rtb/BidRequest.js +1 -0
- package/lib/esm/models/rtb/BidRequest.js.map +1 -1
- package/lib/esm/services/Bidder.js +42 -4
- package/lib/esm/services/Bidder.js.map +1 -1
- package/lib/esm/services/BotFiltering.js +1 -1
- package/lib/esm/services/BotFiltering.js.map +1 -1
- package/lib/esm/services/LocationOverrides.js +17 -0
- package/lib/esm/services/LocationOverrides.js.map +1 -0
- package/lib/esm/services/index.js +1 -0
- package/lib/esm/services/index.js.map +1 -1
- package/lib/types/Init.d.ts +1 -0
- package/lib/types/helpers/RequestBuilder.d.ts +1 -1
- package/lib/types/helpers/response/Carousel.d.ts +2 -1
- package/lib/types/helpers/response/ProductCard.d.ts +10 -3
- package/lib/types/models/retail/Configuration.d.ts +6 -0
- package/lib/types/models/rtb/BidRequest.d.ts +5 -0
- package/lib/types/services/Bidder.d.ts +8 -1
- package/lib/types/services/LocationOverrides.d.ts +6 -0
- package/lib/types/services/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -26,4 +26,4 @@ export type ImpressionRequestBuilder = RequestBuilder & {
|
|
|
26
26
|
andNative: (request: string | INativeRequest, options?: Partial<INative>) => ImpressionRequestBuilder;
|
|
27
27
|
andProductCards: (nativeBuilder: NativeRequestBuilder, options?: Partial<INative>) => ImpressionRequestBuilder;
|
|
28
28
|
};
|
|
29
|
-
export declare function StartRequest(logger: ILogger | undefined, accountId: string, siteId: string, channelId: string, locationId: string, device: IDevice | undefined, geo: IGeoContext | undefined, userId: string | undefined, generateCategories: MapCategoriesFn, strictCategoryFiltering: boolean | undefined, zoneId: string, id?: string): RequestBuilder;
|
|
29
|
+
export declare function StartRequest(logger: ILogger | undefined, accountId: string, siteId: string, channelId: string, locationId: string, device: IDevice | undefined, geo: IGeoContext | undefined, userId: string | undefined, generateCategories: MapCategoriesFn, strictCategoryFiltering: boolean | undefined, brandTakeoversEnabled: boolean, zoneId: string, id?: string): RequestBuilder;
|
|
@@ -2,7 +2,7 @@ import { type IBid, type IBidRequest, type ICompiledPublisherConfiguration, type
|
|
|
2
2
|
import { type AsyncResult, type GetAllSponsoredProductFromNativeIdFn, type ILogger, type NonPersonalRecommenderFn, type PersonalRecommenderFn, type RequestBidsFn, type Result } from '../../services';
|
|
3
3
|
import { type EvaluateClickthroughTemplateFn } from '../../services/Template';
|
|
4
4
|
import { type IProductTrackerService } from '../../services/Tracker';
|
|
5
|
-
import type { GenerateSponsoredProductCardResponseFn, IBuiltProductCardResponse } from './ProductCard';
|
|
5
|
+
import type { GenerateSponsoredProductCardResponseFn, IBuiltProductCardResponse, NamedTrackers } from './ProductCard';
|
|
6
6
|
export type BuildSponsoredCarouselFn = (request: IBidRequest) => Result<IBuiltCarousel>;
|
|
7
7
|
export type BuildSponsoredCarouselFromInitialBidFn = (request: IBidRequest, initialBid: IBid) => Result<IBuiltCarousel>;
|
|
8
8
|
export type BuildRecommendedCarouselFn = (RecommenderType: PublicRecommenderType, category?: string) => Result<IBuiltCarousel>;
|
|
@@ -16,6 +16,7 @@ export interface IBuiltCarousel {
|
|
|
16
16
|
export interface ISimpleBuiltCarousel {
|
|
17
17
|
type: 'simpleCarousel';
|
|
18
18
|
products: IBuiltProductCardResponse[];
|
|
19
|
+
trackers: NamedTrackers;
|
|
19
20
|
}
|
|
20
21
|
export type RecommenderType = 'top-products' | 'for-you' | 'past-purchases';
|
|
21
22
|
export interface IPublicTopProductsRecommenderType {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IBid, type ICompiledPublisherConfiguration, type INativeResponse, type INativeTemplateDelegateWindow, type IProductInformation, type ProductCallbackExtras } from '../../models';
|
|
2
|
-
import { type AsyncResult, type GetAllSponsoredProductFromNativeIdFn, type ILogger } from '../../services';
|
|
2
|
+
import { type AsyncResult, type GetAllSponsoredProductFromNativeIdFn, type ILogger, type Result } from '../../services';
|
|
3
3
|
import { type ProductTrackerCallback } from '../../services/Tracker';
|
|
4
4
|
import { type IBuiltResponse } from './BuiltResponse';
|
|
5
5
|
export type BuildAllSponsoredProductCardResponsesFn = (bids: IBid[]) => AsyncResult<IBuiltProductCardBidResponse[]>;
|
|
@@ -21,6 +21,12 @@ export interface ITracker {
|
|
|
21
21
|
type: number;
|
|
22
22
|
url: string;
|
|
23
23
|
}
|
|
24
|
+
export type NamedTrackers = {
|
|
25
|
+
impression: TrackerObject[];
|
|
26
|
+
viewable?: TrackerObject[];
|
|
27
|
+
win: TrackerObject[];
|
|
28
|
+
[_: string]: TrackerObject[] | undefined;
|
|
29
|
+
};
|
|
24
30
|
export interface ITrackerObject {
|
|
25
31
|
/** @deprecated */
|
|
26
32
|
win: string;
|
|
@@ -28,7 +34,7 @@ export interface ITrackerObject {
|
|
|
28
34
|
imp: string[];
|
|
29
35
|
/** @deprecated */
|
|
30
36
|
others: ITracker[];
|
|
31
|
-
namedTrackers:
|
|
37
|
+
namedTrackers: NamedTrackers;
|
|
32
38
|
}
|
|
33
39
|
export type IBuiltProductCardBidResponse = IBuiltResponse & IBuiltProductCardResponse & {
|
|
34
40
|
native: INativeResponse;
|
|
@@ -40,6 +46,7 @@ export interface IBuiltProductCardResponse {
|
|
|
40
46
|
trackers?: ITrackerObject;
|
|
41
47
|
clickthrough: string;
|
|
42
48
|
sponsored: boolean;
|
|
49
|
+
wrapClick: (url: string) => Result<string>;
|
|
43
50
|
}
|
|
44
51
|
export declare const BuildAllSponsoredProductCardResponses: (logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]) => AsyncResult<IBuiltProductCardBidResponse[]>;
|
|
45
52
|
export declare function GenerateSponsoredProductCardResponse(logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]): AsyncGenerator<IBuiltProductCardBidResponse>;
|
|
@@ -59,4 +66,4 @@ export declare class MissingProductIdError extends Error {
|
|
|
59
66
|
readonly native: INativeResponse;
|
|
60
67
|
constructor(bid: IBid, native: INativeResponse);
|
|
61
68
|
}
|
|
62
|
-
export declare const NamedTrackersToCallbacks: (namedTrackers:
|
|
69
|
+
export declare const NamedTrackersToCallbacks: (namedTrackers: NamedTrackers | undefined) => ProductCallbackExtras;
|
|
@@ -71,11 +71,17 @@ export interface ICompiledPublisherConfigurationSettingsDTO {
|
|
|
71
71
|
excludedZones?: string[];
|
|
72
72
|
brandTakeover?: Record<string, string[]>;
|
|
73
73
|
}
|
|
74
|
+
/** Sparse per-location branch of config.json: only the compiled keys that location overrides. */
|
|
75
|
+
export interface ILocationConfigurationOverridesDTO {
|
|
76
|
+
templates?: Partial<ICompiledPublisherConfigurationTemplatesDTO>;
|
|
77
|
+
settings?: Partial<ICompiledPublisherConfigurationSettingsDTO>;
|
|
78
|
+
}
|
|
74
79
|
export interface ICompiledPublisherConfigurationDTO {
|
|
75
80
|
templates: ICompiledPublisherConfigurationTemplatesDTO;
|
|
76
81
|
settings: ICompiledPublisherConfigurationSettingsDTO;
|
|
77
82
|
category: ICompiledCategoryPublisherConfigurationDTO;
|
|
78
83
|
dynamicZones?: Record<string, IDynamicZone>;
|
|
84
|
+
locations?: Record<string, ILocationConfigurationOverridesDTO>;
|
|
79
85
|
}
|
|
80
86
|
export interface ILoadedTemplateModules {
|
|
81
87
|
productCardTemplateRaw?: TemplateSpecification;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IBidRequest, IBidResponse, ICompiledPublisherConfiguration, INativeTemplateDelegateWindow } from '../models';
|
|
1
|
+
import type { IBid, IBidRequest, IBidResponse, ICompiledPublisherConfiguration, INativeTemplateDelegateWindow } from '../models';
|
|
2
2
|
import { type ILogger } from './Logger';
|
|
3
3
|
import { type AsyncResult, type ErrResult, type Result } from './Result';
|
|
4
4
|
export type RequestBidsFn = (request: IBidRequest) => AsyncResult<IBidResponse>;
|
|
@@ -14,7 +14,10 @@ export declare class StatefulRequestBidsSubscriber {
|
|
|
14
14
|
kill(err: ErrResult): void;
|
|
15
15
|
debounce(bidRequest: IBidRequest, res: (value: Result<IBidResponse>) => void): void;
|
|
16
16
|
}
|
|
17
|
+
export declare const WrapNativeClick: (bid: IBid, clickthrough: string) => Result<string>;
|
|
18
|
+
export declare const ClickWrapper: (handler: string) => (clickthrough: string) => Result<string>;
|
|
17
19
|
export declare const DebounceBidRequests: (state: StatefulRequestBidsSubscriber) => (bidRequest: IBidRequest) => AsyncResult<IBidResponse>;
|
|
20
|
+
export declare const PageIsBrandTakeover: (logger: ILogger | undefined, config: ICompiledPublisherConfiguration, window: INativeTemplateDelegateWindow) => [false, undefined] | [true, string[]];
|
|
18
21
|
export declare const WrapBidRequestDebouncerIfEnabled: (logger: ILogger | undefined, config: ICompiledPublisherConfiguration, window: INativeTemplateDelegateWindow, requestBids: RequestBidsFn) => RequestBidsFn;
|
|
19
22
|
export declare class NoBidsError extends Error {
|
|
20
23
|
readonly request: IBidRequest;
|
|
@@ -45,3 +48,7 @@ export declare class MalformedBidResponseError extends Error {
|
|
|
45
48
|
export declare class MissingBidRequestInDebouncerError extends Error {
|
|
46
49
|
constructor();
|
|
47
50
|
}
|
|
51
|
+
export declare class MalformedNativeAdmError extends Error {
|
|
52
|
+
bid: IBid;
|
|
53
|
+
constructor(bid: IBid);
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ICompiledPublisherConfigurationDTO } from '../models/retail/Configuration';
|
|
2
|
+
/**
|
|
3
|
+
* Each key present in the location branch replaces the site value whole; the
|
|
4
|
+
* contract is shared with platform-services and platform-frontend.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ResolveLocationConfiguration: (configuration: ICompiledPublisherConfigurationDTO, locationId: string | undefined) => ICompiledPublisherConfigurationDTO;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surfside/ads-core",
|
|
3
|
-
"version": "2.5.0-
|
|
3
|
+
"version": "2.5.0-4fcf80fb.0",
|
|
4
4
|
"module": "./lib/esm/index.js",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"types": "./lib/types/index.d.ts",
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"esm": "tsc -p ./tsconfig.esm.json",
|
|
44
44
|
"cjs": "tsc -p tsconfig.cjs.json",
|
|
45
45
|
"lint": "npx eslint",
|
|
46
|
-
"test": "
|
|
46
|
+
"test": "bun test"
|
|
47
47
|
}
|
|
48
48
|
}
|