@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,44 @@
|
|
|
1
|
+
import type { ICompiledPublisherConfiguration, INativeTemplateDelegateWindow, IProductContext, IProductInformation, IPublisherConfiguration } from '../models';
|
|
2
|
+
import type Handlebars from 'handlebars/runtime';
|
|
3
|
+
import type { ILoggerService } from '../services';
|
|
4
|
+
export interface INativeTemplateDelegateData {
|
|
5
|
+
product: Partial<IProductInformation>;
|
|
6
|
+
window: INativeTemplateDelegateWindow;
|
|
7
|
+
publisher: IPublisherConfiguration;
|
|
8
|
+
catalog: IProductInformation;
|
|
9
|
+
ext: any;
|
|
10
|
+
}
|
|
11
|
+
export type NativeTemplateDelegate = Handlebars.TemplateDelegate<INativeTemplateDelegateData>;
|
|
12
|
+
export type EventHandler = (e: Event) => (void | Promise<void>);
|
|
13
|
+
export interface IEventHandleCallbackList {
|
|
14
|
+
click: EventHandler;
|
|
15
|
+
mousedown: EventHandler;
|
|
16
|
+
loadeddata: EventHandler;
|
|
17
|
+
error: EventHandler;
|
|
18
|
+
touchend: EventHandler;
|
|
19
|
+
touchstart: EventHandler;
|
|
20
|
+
touchmove: EventHandler;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Initializes Handlebars with all custom helpers
|
|
24
|
+
*
|
|
25
|
+
* @param logger The logger service for debug messages
|
|
26
|
+
*/
|
|
27
|
+
export declare function initHandlebars(handlebars: typeof Handlebars, logger?: ILoggerService): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a NativeTemplateDelegateWindow object with the current window location properties
|
|
30
|
+
*
|
|
31
|
+
* @returns A NativeTemplateDelegateWindow object with the current window location properties
|
|
32
|
+
*/
|
|
33
|
+
export declare function getNativeTemplateDelegateWindow(): INativeTemplateDelegateWindow;
|
|
34
|
+
/**
|
|
35
|
+
* Renders a URL template using the provided delegate, native slot, and publisher configuration.
|
|
36
|
+
* Gets the window location properties from the current window.
|
|
37
|
+
*
|
|
38
|
+
* @param delegate The Handlebars delegate function to render the template
|
|
39
|
+
* @param productInformation The native slot object to render
|
|
40
|
+
* @param publisherConfiguration The publisher configuration object to render
|
|
41
|
+
* @returns The rendered URL template
|
|
42
|
+
*/
|
|
43
|
+
export declare function RenderTemplate(delegate: HandlebarsTemplateDelegate<IProductContext>, productInformation: IProductInformation | undefined, publisherConfiguration: ICompiledPublisherConfiguration, clickthrough?: string, catalogProduct?: IProductInformation): Element;
|
|
44
|
+
export declare function RenderAndBind<T>(template: HandlebarsTemplateDelegate<T>, t: T & Partial<IEventHandleCallbackList>): Element;
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@surfside/ads-core",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"module": "./lib/esm/index.js",
|
|
5
|
+
"main": "./lib/cjs/index.js",
|
|
6
|
+
"types": "./lib/types/index.d.ts",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib/",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@eslint/js": "^9.25.1",
|
|
15
|
+
"@types/bun": "latest",
|
|
16
|
+
"@types/handlebars": "^4.1.0",
|
|
17
|
+
"@types/jest": "^29.5.14",
|
|
18
|
+
"eslint": "^9.25.1",
|
|
19
|
+
"jest": "^29.7.0",
|
|
20
|
+
"ts-jest": "^29.3.2",
|
|
21
|
+
"typedoc": "^0.28.5",
|
|
22
|
+
"typescript-eslint": "^8.31.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"typescript": "^5.8.3"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"handlebars": "^4.7.8"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "bun bun.build.ts",
|
|
32
|
+
"lint": "npx eslint"
|
|
33
|
+
}
|
|
34
|
+
}
|