@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,47 @@
|
|
|
1
|
+
import type { IProductInformation, IRecommendedProduct } from '../../models';
|
|
2
|
+
/**
|
|
3
|
+
* Recommender service, provides methods to get recommendations for products.
|
|
4
|
+
*/
|
|
5
|
+
export interface IRecommenderService {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `generateTopProduct` instead
|
|
8
|
+
*/
|
|
9
|
+
getTopProducts: (accountId: string, siteId: string, locationId: string, count: number) => Promise<IRecommendedProduct[] | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Generator function for the next existing top recommended product.
|
|
12
|
+
* Returns when out of existing products.
|
|
13
|
+
* @param accountId The account id of the client.
|
|
14
|
+
* @param siteId The site id of the client.
|
|
15
|
+
* @param locationId The location id on the site.
|
|
16
|
+
* @returns A recommended product.
|
|
17
|
+
*/
|
|
18
|
+
generateTopProduct: (accountId: string, siteId: string, locationId: string) => AsyncGenerator<IProductInformation>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `generateForYou` instead
|
|
21
|
+
*/
|
|
22
|
+
getForYou: (accountId: string, siteId: string, locationId: string, userId: string, count: number) => Promise<IRecommendedProduct[] | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Generator function for the next existing product recommended for the given user.
|
|
25
|
+
* Returns when out of existing products.
|
|
26
|
+
* @param accountId The account id of the client.
|
|
27
|
+
* @param siteId The site id of the client.
|
|
28
|
+
* @param locationId The location id on the site.
|
|
29
|
+
* @param userId The user id.
|
|
30
|
+
* @returns A recommended product.
|
|
31
|
+
*/
|
|
32
|
+
generateForYou: (accountId: string, siteId: string, locationId: string, userId: string) => AsyncGenerator<IProductInformation>;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use `generatePreviousPurchase` instead
|
|
35
|
+
*/
|
|
36
|
+
getPreviousPurchases: (accountId: string, siteId: string, locationId: string, userId: string, count: number) => Promise<IRecommendedProduct[] | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Generator function for the next existing product recommended based on the user's
|
|
39
|
+
* previous purchases. Returns when out of existing products.
|
|
40
|
+
* @param accountId The account id of the client.
|
|
41
|
+
* @param siteId The site id of the client.
|
|
42
|
+
* @param locationId The location id on the site.
|
|
43
|
+
* @param userId The user id.
|
|
44
|
+
* @returns A recommended product.
|
|
45
|
+
*/
|
|
46
|
+
generatePreviousPurchase: (accountId: string, siteId: string, locationId: string, userId: string) => AsyncGenerator<IProductInformation>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IProductInformation, IRecommendedProduct } from '../../models';
|
|
2
|
+
import type { ILoggerService, IProductFeedService, IRecommenderService } from '../../services';
|
|
3
|
+
export declare class SurfsideRecommenderService implements IRecommenderService {
|
|
4
|
+
private readonly _productFeedService;
|
|
5
|
+
private readonly _logger?;
|
|
6
|
+
private readonly _cache;
|
|
7
|
+
private readonly _url;
|
|
8
|
+
constructor(url: string, _productFeedService: IProductFeedService, _logger?: ILoggerService | undefined);
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `generateTopProduct` instead
|
|
11
|
+
*/
|
|
12
|
+
getTopProducts(accountId: string, siteId: string, locationId: string, count: number): Promise<IRecommendedProduct[] | null>;
|
|
13
|
+
generateTopProduct(accountId: string, siteId: string, locationId: string): AsyncGenerator<IProductInformation>;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `generateForYou` instead.
|
|
16
|
+
*/
|
|
17
|
+
getForYou(accountId: string, siteId: string, locationId: string, userId: string, count: number): Promise<IRecommendedProduct[] | null>;
|
|
18
|
+
generateForYou(accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `generatePreviousPurchase` instead.
|
|
21
|
+
*/
|
|
22
|
+
getPreviousPurchases(accountId: string, siteId: string, locationId: string, userId: string, count: number): Promise<IRecommendedProduct[] | null>;
|
|
23
|
+
generatePreviousPurchase(accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
|
|
24
|
+
private _generateProductRecommendation;
|
|
25
|
+
private _fetchRecommendations;
|
|
26
|
+
/**
|
|
27
|
+
* Used for the generator methods; just returns a simple list of products instead of managing a cache
|
|
28
|
+
*/
|
|
29
|
+
private _fetchRecommendationList;
|
|
30
|
+
private _generateProduct;
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IBidRequest, IBidResponse } from '../../../models';
|
|
2
|
+
/**
|
|
3
|
+
* The core service for sending bid requests and receiving bid responses.
|
|
4
|
+
*/
|
|
5
|
+
export interface IBidderService {
|
|
6
|
+
/**
|
|
7
|
+
* Sends a bid request to the bidder
|
|
8
|
+
* @param request an OpenRTB 2.6 bid request
|
|
9
|
+
* @returns a promise that resolves with the OpenRTB 2.6 bid response
|
|
10
|
+
*/
|
|
11
|
+
requestBids: (request: IBidRequest) => Promise<IBidResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IBidRequest, IBidResponse } from '../../../models';
|
|
2
|
+
import type { IBidderService } from './IBidderService';
|
|
3
|
+
import type { IConfigurationService, IDeviceService, IGeoService, ILoggerService, IUserIDService } from '../../../services';
|
|
4
|
+
/**
|
|
5
|
+
* The surfside implementation of the IBidderService interface. Sends all request to
|
|
6
|
+
* the surfside bidder.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SurfsideBidderService implements IBidderService {
|
|
9
|
+
private readonly _configService;
|
|
10
|
+
private readonly _geoService;
|
|
11
|
+
private readonly _deviceService;
|
|
12
|
+
private readonly _userService;
|
|
13
|
+
private readonly _logger?;
|
|
14
|
+
private readonly _url;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new instance of the SurfsideBidderService, sending requests to the specified URL
|
|
17
|
+
* @param _url The URL of the bidder API
|
|
18
|
+
* @param _logger An optional logger service, for debugging purposes
|
|
19
|
+
*/
|
|
20
|
+
constructor(url: string, _configService: IConfigurationService, _geoService: IGeoService, _deviceService: IDeviceService, _userService: IUserIDService, _logger?: ILoggerService | undefined);
|
|
21
|
+
/**
|
|
22
|
+
* Sends a bid request to the bidder. If the bidder returns a status code other than 200,
|
|
23
|
+
* a NoBidResponseError is thrown with the status code and status text as the message.
|
|
24
|
+
* @param request The OpenRTB 2.6 bid request
|
|
25
|
+
* @returns A promise that resolves with the OpenRTB 2.6 bid response
|
|
26
|
+
*/
|
|
27
|
+
requestBids(request: IBidRequest): Promise<IBidResponse>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ICompiledPublisherConfiguration } from '../../../models';
|
|
2
|
+
/**
|
|
3
|
+
* The configuration service interface. account and site IDs come from the creative component attributes.
|
|
4
|
+
* Publisher configurations have flags for features on the site, and templates for rendering commerce media creatives.
|
|
5
|
+
*/
|
|
6
|
+
export interface IConfigurationService {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the configuration for the given account and site IDs
|
|
9
|
+
* @param accountId The account ID of the component making the request
|
|
10
|
+
* @param siteId The site ID of the component making the request
|
|
11
|
+
* @returns The configuration for the account and site IDs, or null if no configuration is found
|
|
12
|
+
*/
|
|
13
|
+
getConfiguration: (accountId: string, siteId: string) => Promise<ICompiledPublisherConfiguration | null>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ICompiledPublisherConfiguration } from '../../../models';
|
|
2
|
+
import type { ILoggerService } from '../../../services';
|
|
3
|
+
import type { IConfigurationService } from './IConfigurationService';
|
|
4
|
+
/**
|
|
5
|
+
* The Surfside Configuration Service fetches the configuration for a given account and site.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SurfsideConfigurationService implements IConfigurationService {
|
|
8
|
+
private readonly _handlebars;
|
|
9
|
+
private readonly _logger?;
|
|
10
|
+
private readonly _url;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new instance of the Surfside Configuration Service with the specified URL and Handlebars instance.
|
|
13
|
+
* Handlebars is used to parse the clickthrough URL templates and product card templates for the configuration.
|
|
14
|
+
* It is a peer dependency, so you will need to add handlebars to your project.
|
|
15
|
+
* @param _url The URL of the configuration service
|
|
16
|
+
* @param _handlebars The Handlebars instance to use for parsing templates. Created with `Handlebars.create()`
|
|
17
|
+
* @param _logger An optional logger service, for debugging purposes
|
|
18
|
+
*/
|
|
19
|
+
constructor(url: string, _handlebars: typeof Handlebars, _logger?: ILoggerService | undefined);
|
|
20
|
+
/**
|
|
21
|
+
* Fetches the configuration for the specified account and site.
|
|
22
|
+
* @param accountId The account ID of the client
|
|
23
|
+
* @param siteId The site ID of the client
|
|
24
|
+
* @returns A promise that resolves with the compiled configuration, or null if the fetch fails
|
|
25
|
+
*/
|
|
26
|
+
getConfiguration(accountId: string, siteId: string): Promise<ICompiledPublisherConfiguration | null>;
|
|
27
|
+
private _mapConfig;
|
|
28
|
+
private _importModule;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OverrideService } from '../../../services/OverrideService';
|
|
2
|
+
import type { IDevice } from '../../../models';
|
|
3
|
+
import { type IDeviceService, type ILoggerService } from '../../../services';
|
|
4
|
+
export declare class DeviceOverrideService extends OverrideService<IDevice> implements IDeviceService {
|
|
5
|
+
constructor(logger?: ILoggerService);
|
|
6
|
+
getDeviceInfo(): Promise<IDevice | null>;
|
|
7
|
+
mapDataSetToData(dataset: DOMStringMap): IDevice | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ILoggerService } from '../../logger';
|
|
2
|
+
import { DeviceOverrideService } from './DeviceOverrideService';
|
|
3
|
+
import { type IBrandVersion, type IDevice } from '../../../models';
|
|
4
|
+
interface IDeviceContext {
|
|
5
|
+
make?: string;
|
|
6
|
+
model?: string;
|
|
7
|
+
os?: string;
|
|
8
|
+
osv?: string;
|
|
9
|
+
browser?: IBrandVersion;
|
|
10
|
+
}
|
|
11
|
+
export declare class SurfsideDeviceService extends DeviceOverrideService {
|
|
12
|
+
constructor(logger?: ILoggerService);
|
|
13
|
+
getDeviceInfo(): Promise<IDevice | null>;
|
|
14
|
+
}
|
|
15
|
+
export declare function TryGetDeviceInfo(): IDeviceContext | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { IBidRequest, IBidResponse } from '../../../models';
|
|
2
|
+
import type { IEventService, ILoggerService } from '../../../services';
|
|
3
|
+
interface ISurfTrackerOptions {
|
|
4
|
+
appId: string;
|
|
5
|
+
cookieName: string;
|
|
6
|
+
collectorUrl: string;
|
|
7
|
+
discoverRootDomain: boolean;
|
|
8
|
+
cookieSameSite: string;
|
|
9
|
+
}
|
|
10
|
+
type SurfTrack = (action: string, ...args: any[]) => void;
|
|
11
|
+
interface ISurfTracker extends SurfTrack {
|
|
12
|
+
q?: any[];
|
|
13
|
+
}
|
|
14
|
+
declare global {
|
|
15
|
+
interface Window {
|
|
16
|
+
surf: ISurfTracker;
|
|
17
|
+
surfContext: any[];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export interface ISurfsideEventServiceLazyLoadConfig extends Partial<ISurfTrackerOptions> {
|
|
21
|
+
lazyLoad: true;
|
|
22
|
+
src: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ISurfsideEventServiceDefaultConfig extends Partial<ISurfTrackerOptions> {
|
|
25
|
+
lazyLoad: false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The surfside event service. This service is responsible for tracking events. It converts
|
|
29
|
+
* bid requests and responses to legacy snowplow/prebidJS style events and sends them to the
|
|
30
|
+
* surfside tracker.
|
|
31
|
+
*/
|
|
32
|
+
export declare class SurfsideEventService implements IEventService {
|
|
33
|
+
private readonly _logger?;
|
|
34
|
+
private _surf;
|
|
35
|
+
private readonly _appId;
|
|
36
|
+
private readonly _collectorUrl;
|
|
37
|
+
private readonly _src?;
|
|
38
|
+
constructor(config?: ISurfsideEventServiceLazyLoadConfig | ISurfsideEventServiceDefaultConfig, _logger?: ILoggerService | undefined);
|
|
39
|
+
raiseBidRequested(request: IBidRequest): Promise<void>;
|
|
40
|
+
raiseBidResponded(response: IBidResponse, request: IBidRequest): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OverrideService } from '../../../services/OverrideService';
|
|
2
|
+
import type { IGeoContext } from '../../../models';
|
|
3
|
+
import { type IGeoService, type ILoggerService } from '../../../services';
|
|
4
|
+
export declare class GeoOverrideService extends OverrideService<IGeoContext> implements IGeoService {
|
|
5
|
+
constructor(logger?: ILoggerService);
|
|
6
|
+
mapDataSetToData(dataset: DOMStringMap): IGeoContext | null;
|
|
7
|
+
getGeo(): Promise<IGeoContext | null>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IGeoContext } from '../../../models';
|
|
2
|
+
/**
|
|
3
|
+
* The geo service interface. Returns the geo context for the user, as well as the IP address of the user.
|
|
4
|
+
* This is useful for targeting ads based on the user's location, and is added to the "device" object in the bid request
|
|
5
|
+
*/
|
|
6
|
+
export interface IGeoService {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the geo context for the user, including the user's location and IP address
|
|
9
|
+
* @returns The geo context, or null if the geo context could not be retrieved
|
|
10
|
+
*/
|
|
11
|
+
getGeo: () => Promise<IGeoContext | null>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IGeoContext } from '../../../models';
|
|
2
|
+
import type { ILoggerService } from '../../../services';
|
|
3
|
+
import { GeoOverrideService } from './GeoOverrideService';
|
|
4
|
+
export declare class SurfsideGeoService extends GeoOverrideService {
|
|
5
|
+
constructor(logger?: ILoggerService);
|
|
6
|
+
getGeo(): Promise<IGeoContext | null>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IUserID } from '../../../models';
|
|
2
|
+
import type { ILoggerService } from '../../../services';
|
|
3
|
+
import { UserOverrideService } from './UserOverrideService';
|
|
4
|
+
export declare class SurfsideUserIDService extends UserOverrideService {
|
|
5
|
+
constructor(logger?: ILoggerService);
|
|
6
|
+
getUserId(): Promise<IUserID | null>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OverrideService } from '../../../services/OverrideService';
|
|
2
|
+
import type { IUserID } from '../../../models';
|
|
3
|
+
import { type ILoggerService, type IUserIDService } from '../../../services';
|
|
4
|
+
export declare class UserOverrideService extends OverrideService<IUserID> implements IUserIDService {
|
|
5
|
+
constructor(logger?: ILoggerService);
|
|
6
|
+
getUserId(): Promise<IUserID | null>;
|
|
7
|
+
mapDataSetToData(dataset: DOMStringMap): string | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GetSafeUrl(relativeUrl: string): string;
|
|
@@ -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,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@surfside/ads-core",
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "My webpack project",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/types/index.d.ts",
|
|
7
|
+
"author": "Collin Oswalt, Ranveer Dhaliwal",
|
|
8
|
+
"license": "UNLICENSED",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"peerdependencies": {
|
|
14
|
+
"handlebars": "^4.7.8"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@stylistic/eslint-plugin-ts": "^1.5.4",
|
|
18
|
+
"@types/handlebars": "^4.1.0",
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
20
|
+
"@webpack-cli/generators": "^3.0.7",
|
|
21
|
+
"eslint": "^8.56.0",
|
|
22
|
+
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
23
|
+
"eslint-plugin-import": "^2.29.1",
|
|
24
|
+
"eslint-plugin-n": "^16.6.2",
|
|
25
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
26
|
+
"prettier": "^3.3.3",
|
|
27
|
+
"ts-loader": "^9.5.1",
|
|
28
|
+
"typescript": "^5.6.2",
|
|
29
|
+
"webpack": "^5.95.0",
|
|
30
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
31
|
+
"webpack-cli": "^6.0.1"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"lint": "npx eslint -c ./.eslintrc.json src/**/*.ts",
|
|
35
|
+
"build:mock": "npx webpack --mode=development --node-env=development",
|
|
36
|
+
"build:local": "npx webpack --mode=development --node-env=development",
|
|
37
|
+
"build:staging": "npx webpack --mode=production --node-env=development",
|
|
38
|
+
"build:prod": "npx webpack --mode=production --node-env=production",
|
|
39
|
+
"watch": "npx webpack --watch",
|
|
40
|
+
"serve": ";",
|
|
41
|
+
"serve:mock": ";",
|
|
42
|
+
"serve:local": ";",
|
|
43
|
+
"serve:staging": ";",
|
|
44
|
+
"serve:prod": ";",
|
|
45
|
+
"test": "echo test"
|
|
46
|
+
}
|
|
47
|
+
}
|