@surfside/ads-core 2.1.0 → 2.3.0-c2d1d13c.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/README.md +15 -15
- package/lib/cjs/Api.js +8 -0
- package/lib/cjs/Api.js.map +1 -1
- package/lib/cjs/BuildInfo.js +3 -3
- package/lib/cjs/BuildInfo.js.map +1 -1
- package/lib/cjs/Init.js +137 -4
- package/lib/cjs/Init.js.map +1 -1
- package/lib/cjs/helpers/RequestBuilder.js +1 -0
- package/lib/cjs/helpers/RequestBuilder.js.map +1 -1
- package/lib/cjs/helpers/response/Banner.js +83 -0
- package/lib/cjs/helpers/response/Banner.js.map +1 -1
- package/lib/cjs/helpers/response/Carousel.js +65 -1
- package/lib/cjs/helpers/response/Carousel.js.map +1 -1
- package/lib/cjs/helpers/response/Html.js +37 -0
- package/lib/cjs/helpers/response/Html.js.map +1 -0
- package/lib/cjs/helpers/response/ProductCard.js +5 -130
- package/lib/cjs/helpers/response/ProductCard.js.map +1 -1
- package/lib/cjs/helpers/response/Products.js +163 -0
- package/lib/cjs/helpers/response/Products.js.map +1 -0
- package/lib/cjs/helpers/response/Video.js +52 -0
- package/lib/cjs/helpers/response/Video.js.map +1 -1
- package/lib/cjs/helpers/response/index.js +59 -0
- package/lib/cjs/helpers/response/index.js.map +1 -1
- package/lib/cjs/models/retail/Configuration.js +34 -1
- package/lib/cjs/models/retail/Configuration.js.map +1 -1
- package/lib/cjs/services/Bidder.js +9 -1
- package/lib/cjs/services/Bidder.js.map +1 -1
- package/lib/cjs/services/Configuration.js.map +1 -1
- package/lib/cjs/services/Memo.js +82 -14
- package/lib/cjs/services/Memo.js.map +1 -1
- package/lib/esm/Api.js +10 -2
- package/lib/esm/Api.js.map +1 -1
- package/lib/esm/BuildInfo.js +3 -3
- package/lib/esm/BuildInfo.js.map +1 -1
- package/lib/esm/Init.js +133 -5
- package/lib/esm/Init.js.map +1 -1
- package/lib/esm/helpers/RequestBuilder.js +1 -0
- package/lib/esm/helpers/RequestBuilder.js.map +1 -1
- package/lib/esm/helpers/response/Banner.js +79 -1
- package/lib/esm/helpers/response/Banner.js.map +1 -1
- package/lib/esm/helpers/response/Carousel.js +62 -0
- package/lib/esm/helpers/response/Carousel.js.map +1 -1
- package/lib/esm/helpers/response/Html.js +33 -0
- package/lib/esm/helpers/response/Html.js.map +1 -0
- package/lib/esm/helpers/response/ProductCard.js +5 -130
- package/lib/esm/helpers/response/ProductCard.js.map +1 -1
- package/lib/esm/helpers/response/Products.js +158 -0
- package/lib/esm/helpers/response/Products.js.map +1 -0
- package/lib/esm/helpers/response/Video.js +49 -1
- package/lib/esm/helpers/response/Video.js.map +1 -1
- package/lib/esm/helpers/response/index.js +56 -0
- package/lib/esm/helpers/response/index.js.map +1 -1
- package/lib/esm/models/retail/Configuration.js +32 -0
- package/lib/esm/models/retail/Configuration.js.map +1 -1
- package/lib/esm/services/Bidder.js +9 -1
- package/lib/esm/services/Bidder.js.map +1 -1
- package/lib/esm/services/Configuration.js.map +1 -1
- package/lib/esm/services/Memo.js +79 -13
- package/lib/esm/services/Memo.js.map +1 -1
- package/lib/types/Api.d.ts +9 -2
- package/lib/types/Init.d.ts +49 -1
- package/lib/types/helpers/response/Banner.d.ts +10 -0
- package/lib/types/helpers/response/Carousel.d.ts +10 -2
- package/lib/types/helpers/response/Html.d.ts +2 -0
- package/lib/types/helpers/response/Products.d.ts +8 -0
- package/lib/types/helpers/response/Video.d.ts +13 -2
- package/lib/types/helpers/response/index.d.ts +12 -0
- package/lib/types/models/retail/Configuration.d.ts +7 -0
- package/lib/types/services/Configuration.d.ts +2 -0
- package/lib/types/services/Memo.d.ts +28 -2
- package/package.json +48 -47
package/lib/types/Init.d.ts
CHANGED
|
@@ -2,9 +2,34 @@ import { type ISurfsideApi } from './Api';
|
|
|
2
2
|
import Handlebars from 'handlebars/runtime';
|
|
3
3
|
import { type BuildAllSponsoredProductCardResponsesFn, type GenerateSponsoredProductCardResponseFn, type HandlebarsHelpers, type RequestBuilderFn } from './helpers';
|
|
4
4
|
import { type IDevice, type ICompiledPublisherConfiguration, type IGeoContext, type INativeTemplateDelegateWindow } from './models';
|
|
5
|
-
import { type RequestBidsFn, type GetAllSponsoredProductFromNativeIdFn, type GetRecommendedProductFromProductIdFn, type NonPersonalRecommenderFn, type PersonalRecommenderFn, type GetDynamicZoneFn, type EvaluateProductCardTemplateFn, type EvaluateClickthroughTemplateFn, type IProductTrackerService, type ILogger, type ITelemetryCollector, type IScreen, type INavigator, type Result, type AsyncResult } from './services';
|
|
5
|
+
import { type RequestBidsFn, type GetAllSponsoredProductFromNativeIdFn, type GetRecommendedProductFromProductIdFn, type NonPersonalRecommenderFn, type PersonalRecommenderFn, type GetDynamicZoneFn, type EvaluateProductCardTemplateFn, type EvaluateClickthroughTemplateFn, type IProductTrackerService, type ILogger, type ITelemetryCollector, type IScreen, type INavigator, type Result, type AsyncResult, type LoadConfigurationFileFn, type LoadGlobalCategoryConfigurationFn } from './services';
|
|
6
6
|
import { type MapCategoriesFn } from './services/Category';
|
|
7
7
|
export type OverrideFactory<T, U = ISurfAdsCoreConfiguration> = (config: U, original: T) => Result<T>;
|
|
8
|
+
export type AsyncOverrideFactory<T, U = ISurfAdsCoreConfiguration> = (config: U, original: T) => AsyncResult<T>;
|
|
9
|
+
export declare const MemoizeOverride: <TArgs extends unknown[], TReturn, U = ISurfAdsCoreConfiguration>(time?: Partial<{
|
|
10
|
+
minutes: number;
|
|
11
|
+
hours: number;
|
|
12
|
+
seconds: number;
|
|
13
|
+
milliseconds: number;
|
|
14
|
+
}>) => OverrideFactory<(...args: TArgs) => TReturn, U>;
|
|
15
|
+
export declare const MemoizeOverrideAsync: <TArgs extends unknown[], TReturn, U = ISurfAdsCoreConfiguration>(time?: Partial<{
|
|
16
|
+
minutes: number;
|
|
17
|
+
hours: number;
|
|
18
|
+
seconds: number;
|
|
19
|
+
milliseconds: number;
|
|
20
|
+
}>) => AsyncOverrideFactory<(...args: TArgs) => Promise<TReturn>, U>;
|
|
21
|
+
export declare const CacheOverride: <TArgs extends unknown[], TReturn, U = ISurfAdsCoreConfiguration>(timeout?: Partial<{
|
|
22
|
+
minutes: number;
|
|
23
|
+
hours: number;
|
|
24
|
+
seconds: number;
|
|
25
|
+
milliseconds: number;
|
|
26
|
+
}>) => OverrideFactory<(...args: TArgs) => TReturn, U>;
|
|
27
|
+
export declare const AsyncCacheOverride: <TArgs extends unknown[], TReturn, U = ISurfAdsCoreConfiguration>(timeout?: Partial<{
|
|
28
|
+
minutes: number;
|
|
29
|
+
hours: number;
|
|
30
|
+
seconds: number;
|
|
31
|
+
milliseconds: number;
|
|
32
|
+
}>) => OverrideFactory<(...args: TArgs) => Promise<TReturn>, U>;
|
|
8
33
|
export interface ISurfAdsCoreConfigurationOverrides {
|
|
9
34
|
mapCategories: OverrideFactory<(categories: string[]) => string[]>;
|
|
10
35
|
generateCategories: OverrideFactory<MapCategoriesFn>;
|
|
@@ -23,6 +48,8 @@ export interface ISurfAdsCoreConfigurationOverrides {
|
|
|
23
48
|
startRequest: (config: ISurfAdsCoreConfiguration, startRequest: RequestBuilderFn) => Result<RequestBuilderFn>;
|
|
24
49
|
trackerService: OverrideFactory<IProductTrackerService>;
|
|
25
50
|
createTelemetryCollector: OverrideFactory<ITelemetryCollector | undefined, Omit<ISurfAdsCoreConfiguration, 'geo' | 'handlebars' | 'configuration' | 'logger'>>;
|
|
51
|
+
loadConfigurationFile: OverrideFactory<LoadConfigurationFileFn, ILoadSurfAdsCoreConfigurationDependenciesConfig>;
|
|
52
|
+
loadGlobalCategoryConfiguration: OverrideFactory<LoadGlobalCategoryConfigurationFn, ILoadSurfAdsCoreConfigurationDependenciesConfig>;
|
|
26
53
|
}
|
|
27
54
|
export interface ISurfAdsCoreConfiguration extends ISurfAdsCoreDependencies {
|
|
28
55
|
windowInfo: INativeTemplateDelegateWindow;
|
|
@@ -73,6 +100,10 @@ export interface ILoadSurfAdsCoreConfigurationDependenciesConfig {
|
|
|
73
100
|
handlebars: typeof Handlebars;
|
|
74
101
|
handlebarsHelpers: HandlebarsHelpers;
|
|
75
102
|
overrides?: {
|
|
103
|
+
services?: Partial<{
|
|
104
|
+
loadConfigurationFile: OverrideFactory<LoadConfigurationFileFn, ILoadSurfAdsCoreConfigurationDependenciesConfig>;
|
|
105
|
+
loadGlobalCategoryConfiguration: OverrideFactory<LoadGlobalCategoryConfigurationFn, ILoadSurfAdsCoreConfigurationDependenciesConfig>;
|
|
106
|
+
}>;
|
|
76
107
|
dependencies?: Partial<ISurfAdsCoreDependencies>;
|
|
77
108
|
};
|
|
78
109
|
}
|
|
@@ -97,3 +128,20 @@ export declare const LoadSurfAdsCoreDeviceDependencies: (config: ILoadSurfAdsCor
|
|
|
97
128
|
export declare const LoadSurfAdsCoreDependencies: (config: ILoadSurfAdsCoreConfiguration) => AsyncResult<ISurfAdsCoreDependencies>;
|
|
98
129
|
export declare const LoadSurfAdsCore: (config: ILoadSurfAdsCoreConfiguration) => AsyncResult<ISurfsideApi>;
|
|
99
130
|
export declare const LoadAdsCoreBrowser: (accountId: string, channelId: string, siteId: string, locationId: string, userId?: string, logger?: ILogger) => AsyncResult<ISurfsideApi>;
|
|
131
|
+
export type LoadsSurfAdsCoreHeadlessConfig = {
|
|
132
|
+
accountId: string;
|
|
133
|
+
siteId: string;
|
|
134
|
+
channelId: string;
|
|
135
|
+
locationId: string;
|
|
136
|
+
userId?: string;
|
|
137
|
+
ip: string;
|
|
138
|
+
telemetry?: boolean;
|
|
139
|
+
logging?: boolean;
|
|
140
|
+
userAgent: string;
|
|
141
|
+
url: string;
|
|
142
|
+
overrides?: {
|
|
143
|
+
services?: Partial<ISurfAdsCoreConfigurationOverrides>;
|
|
144
|
+
dependencies?: Partial<ISurfAdsCoreDependencies>;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export declare const LoadSurfAdsCoreHeadless: (config: LoadsSurfAdsCoreHeadlessConfig) => AsyncResult<ISurfsideApi>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type IBidResponse, type IBid, type ICompiledPublisherConfiguration, type INativeTemplateDelegateWindow } from '../../models';
|
|
2
|
+
import { type ILogger, type Result } from '../../services';
|
|
1
3
|
import { type IBuiltResponse } from './BuiltResponse';
|
|
2
4
|
/**
|
|
3
5
|
* A built banner response - includes the `adm` field for the banner as well as the rendered commerce media
|
|
@@ -19,4 +21,12 @@ export interface IBuiltBannerResponse extends IBuiltResponse {
|
|
|
19
21
|
* the clickthrough URL template). For regular static banners that click out to 3rd party sites, this is `undefined`
|
|
20
22
|
*/
|
|
21
23
|
clickthrough?: string;
|
|
24
|
+
win: string;
|
|
25
|
+
}
|
|
26
|
+
export type BuildBannerResponseCoreFn = (bid: IBid) => Result<IBuiltBannerResponse>;
|
|
27
|
+
export declare const BuildBannerResponseCore: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, config: ICompiledPublisherConfiguration, bid: IBid) => Result<IBuiltBannerResponse>;
|
|
28
|
+
export type BuildAllBannersCoreFn = (bidResponse: IBidResponse) => Result<IBuiltBannerResponse[]>;
|
|
29
|
+
export declare const BuildAllBannersCore: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, config: ICompiledPublisherConfiguration, bidResponse: IBidResponse) => Result<IBuiltBannerResponse[]>;
|
|
30
|
+
export declare class MissingCoreProductInfoError extends Error {
|
|
31
|
+
constructor();
|
|
22
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type IBid, type IBidRequest } from '../../models';
|
|
2
|
-
import { type ILogger, type NonPersonalRecommenderFn, type PersonalRecommenderFn, type RequestBidsFn, type Result } from '../../services';
|
|
1
|
+
import { type IBid, type IBidRequest, type ICompiledPublisherConfiguration, type INativeTemplateDelegateWindow, type IBidResponse } from '../../models';
|
|
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
5
|
import type { GenerateSponsoredProductCardResponseFn, IBuiltProductCardResponse } from './ProductCard';
|
|
@@ -13,6 +13,10 @@ export interface IBuiltCarousel {
|
|
|
13
13
|
type: 'carousel';
|
|
14
14
|
getProduct: CarouselNextProductFn;
|
|
15
15
|
}
|
|
16
|
+
export interface ISimpleBuiltCarousel {
|
|
17
|
+
type: 'simpleCarousel';
|
|
18
|
+
products: IBuiltProductCardResponse[];
|
|
19
|
+
}
|
|
16
20
|
export type RecommenderType = 'top-products' | 'for-you' | 'past-purchases';
|
|
17
21
|
export interface IPublicTopProductsRecommenderType {
|
|
18
22
|
type: 'top-products';
|
|
@@ -46,6 +50,10 @@ export declare const BuildSponsoredCarouselFromInitialBid: (logger: ILogger | un
|
|
|
46
50
|
export declare const BuildRecommendedCarousel: (logger: ILogger | undefined, evaluateClickthroughTemplate: EvaluateClickthroughTemplateFn, topProductGenerator: NonPersonalRecommenderFn, forYouProductGenerator: PersonalRecommenderFn, pastPurchasesProductGenerator: PersonalRecommenderFn, userId: string | undefined, trackers: IProductTrackerService, recommenderType: PublicRecommenderType, category?: string) => Result<IBuiltCarousel>;
|
|
47
51
|
export declare const BuildHybridCarousel: (logger: ILogger | undefined, evaluateClickthroughTemplate: EvaluateClickthroughTemplateFn, requestBids: RequestBidsFn, generateProductCardResponse: GenerateSponsoredProductCardResponseFn, topProductGenerator: NonPersonalRecommenderFn, forYouProductGenerator: PersonalRecommenderFn, pastPurchasesProductGenerator: PersonalRecommenderFn, userId: string | undefined, trackers: IProductTrackerService, excludedZones: string[] | undefined, recommenderType: PublicRecommenderType, request: IBidRequest) => Result<IBuiltCarousel>;
|
|
48
52
|
export declare const BuildHybridCarouselFromInitialBid: (logger: ILogger | undefined, evaluateClickthroughTemplate: EvaluateClickthroughTemplateFn, requestBids: RequestBidsFn, generateProductCardResponse: GenerateSponsoredProductCardResponseFn, topProductGenerator: NonPersonalRecommenderFn, forYouProductGenerator: PersonalRecommenderFn, pastPurchasesProductGenerator: PersonalRecommenderFn, userId: string | undefined, trackers: IProductTrackerService, excludedZones: string[] | undefined, recommenderType: PublicRecommenderType, request: IBidRequest, initialBid: IBid) => Result<IBuiltCarousel>;
|
|
53
|
+
export type BuildSimpleCarouselFn = (bid: IBid) => AsyncResult<ISimpleBuiltCarousel>;
|
|
54
|
+
export declare const BuildSimpleCarousel: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, config: ICompiledPublisherConfiguration, bid: IBid) => AsyncResult<ISimpleBuiltCarousel>;
|
|
55
|
+
export type BuildAllSimpleCarouselsFn = (bidResponse: IBidResponse) => AsyncResult<ISimpleBuiltCarousel[]>;
|
|
56
|
+
export declare const BuildAllSimpleCarousels: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, config: ICompiledPublisherConfiguration, bidResponse: IBidResponse) => AsyncResult<ISimpleBuiltCarousel[]>;
|
|
49
57
|
export declare class InvalidRecommenderTypeError extends Error {
|
|
50
58
|
type: string;
|
|
51
59
|
constructor(type: string);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IBid, type ICompiledPublisherConfiguration, type INativeResponse, type IProductInformation } from '../../models';
|
|
2
|
+
import { type AsyncResult, type GetAllSponsoredProductFromNativeIdFn, type ILogger, type Result } from '../../services';
|
|
3
|
+
import { type ITrackerObject } from './ProductCard';
|
|
4
|
+
export declare const fetchProductsFromBid: (logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, config: ICompiledPublisherConfiguration, bid: IBid) => AsyncResult<{
|
|
5
|
+
products: IProductInformation[];
|
|
6
|
+
native: INativeResponse;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const getTrackers: (logger: ILogger | undefined, bid: IBid, native: INativeResponse, productIds?: string[]) => Result<ITrackerObject>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { IVast } from '../../models';
|
|
2
|
-
import type
|
|
1
|
+
import type { IBid, IBidResponse, ICompiledPublisherConfiguration, INativeTemplateDelegateWindow, IVast } from '../../models';
|
|
2
|
+
import { type ILogger, type Result } from '../../services';
|
|
3
|
+
import { type IBuiltResponse } from './BuiltResponse';
|
|
3
4
|
/**
|
|
4
5
|
* A built video response. The raw Vast XML response from the bidder has been parsed out into a structure object here.
|
|
5
6
|
* @expandType IBuiltResponse
|
|
@@ -15,3 +16,13 @@ export interface IBuiltVideo extends IBuiltResponse {
|
|
|
15
16
|
*/
|
|
16
17
|
clickthrough: string;
|
|
17
18
|
}
|
|
19
|
+
export interface IBuiltVideoCore extends IBuiltResponse {
|
|
20
|
+
type: 'video';
|
|
21
|
+
video: string;
|
|
22
|
+
clickthrough: string;
|
|
23
|
+
win: string;
|
|
24
|
+
}
|
|
25
|
+
export type BuildVideoResponseCoreFn = (bid: IBid) => Result<IBuiltVideoCore>;
|
|
26
|
+
export declare const BuildVideoResponseCore: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bid: IBid) => Result<IBuiltVideoCore>;
|
|
27
|
+
export type BuildAllVideosCoreFn = (bidResponse: IBidResponse) => Result<IBuiltVideoCore[]>;
|
|
28
|
+
export declare const BuildAllVideosCore: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bidResponse: IBidResponse) => Result<IBuiltVideoCore[]>;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
import type { IBid, IBidResponse, ICompiledPublisherConfiguration, INativeTemplateDelegateWindow } from '../../models';
|
|
2
|
+
import { type AsyncResult, type GetAllSponsoredProductFromNativeIdFn, type ILogger } from '../../services';
|
|
3
|
+
import { type IBuiltBannerResponse } from './Banner';
|
|
4
|
+
import { type ISimpleBuiltCarousel } from './Carousel';
|
|
5
|
+
import { type IBuiltVideoCore } from './Video';
|
|
1
6
|
export * from './BuiltResponse';
|
|
2
7
|
export * from './Banner';
|
|
3
8
|
export * from './Clickthrough';
|
|
4
9
|
export * from './ProductCard';
|
|
5
10
|
export * from './Video';
|
|
6
11
|
export * from './Carousel';
|
|
12
|
+
type CreativeResponsesCore = IBuiltBannerResponse | IBuiltVideoCore | ISimpleBuiltCarousel;
|
|
13
|
+
export type BuildAllResponsesCoreFn = (bidResponse: IBidResponse) => AsyncResult<CreativeResponsesCore[]>;
|
|
14
|
+
export declare const BuildAllResponsesCore: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, config: ICompiledPublisherConfiguration, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, bidResponse: IBidResponse) => AsyncResult<CreativeResponsesCore[]>;
|
|
15
|
+
export declare class InvalidCreativeTypeError extends Error {
|
|
16
|
+
readonly bid: IBid;
|
|
17
|
+
constructor(bid: IBid);
|
|
18
|
+
}
|
|
@@ -89,3 +89,10 @@ export interface ICompiledPublisherConfiguration {
|
|
|
89
89
|
dynamicZones?: Record<string, IDynamicZone>;
|
|
90
90
|
}
|
|
91
91
|
export declare const DefaultProductCallbackExtras: () => ProductCallbackExtras;
|
|
92
|
+
export declare class Configuration implements ICompiledPublisherConfiguration {
|
|
93
|
+
settings: ICompiledPublisherConfigurationSettingsDTO;
|
|
94
|
+
templates: ICompiledPublisherConfigurationTemplates;
|
|
95
|
+
category: ICompiledCategoryPublisherConfiguration;
|
|
96
|
+
dynamicZones?: Record<string, IDynamicZone> | undefined;
|
|
97
|
+
constructor(overrides?: Partial<ICompiledPublisherConfiguration>);
|
|
98
|
+
}
|
|
@@ -5,11 +5,13 @@ import { type HandlebarsHelpers } from '../helpers';
|
|
|
5
5
|
import { type ICompiledCategoryGlobalConfigDTO, type ICompiledCategoryPublisherConfiguration, type ICompiledCategoryPublisherConfigurationDTO } from '../models/retail/Category';
|
|
6
6
|
export type GetConfigurationFn = () => AsyncResult<ICompiledPublisherConfiguration>;
|
|
7
7
|
export declare const GetConfiguration: (logger: ILogger | undefined, url: string, handlebars: typeof Handlebars, helpers: HandlebarsHelpers, accountId: string, siteId: string) => AsyncResult<ICompiledPublisherConfiguration>;
|
|
8
|
+
export type LoadConfigurationFileFn = (accountId: string, siteId: string) => AsyncResult<ICompiledPublisherConfigurationDTO>;
|
|
8
9
|
export declare const LoadConfigurationFile: (logger: ILogger | undefined, accountId: string, siteId: string) => AsyncResult<ICompiledPublisherConfigurationDTO>;
|
|
9
10
|
export declare const LoadConfigurationTemplateModules: (logger: ILogger | undefined, configurationDto: ICompiledPublisherConfigurationDTO) => AsyncResult<ILoadedTemplateModules>;
|
|
10
11
|
export declare const CreateCompiledConfiguration: (logger: ILogger | undefined, loadedTemplateModules: ILoadedTemplateModules, configurationDto: ICompiledPublisherConfigurationDTO, handlebars: typeof Handlebars, handlebarsHelpers: HandlebarsHelpers, globalCategories: ICompiledCategoryGlobalConfigDTO) => Result<ICompiledPublisherConfiguration>;
|
|
11
12
|
export declare const LoadCompiledConfiguration: (logger: ILogger | undefined, configurationDto: ICompiledPublisherConfigurationDTO, handlebars: typeof Handlebars, handlebarsHelpers: HandlebarsHelpers) => AsyncResult<Omit<ICompiledPublisherConfiguration, "category">>;
|
|
12
13
|
export declare const CreateCategoryConfiguration: (logger: ILogger | undefined, globalCategories: ICompiledCategoryGlobalConfigDTO, publisherCategories: ICompiledCategoryPublisherConfigurationDTO | undefined) => Result<ICompiledCategoryPublisherConfiguration>;
|
|
14
|
+
export type LoadGlobalCategoryConfigurationFn = () => AsyncResult<ICompiledCategoryGlobalConfigDTO>;
|
|
13
15
|
export declare const LoadGlobalCategoryConfiguration: (logger: ILogger | undefined) => AsyncResult<ICompiledCategoryGlobalConfigDTO>;
|
|
14
16
|
export declare const LoadConfiguration: (logger: ILogger | undefined, accountId: string, siteId: string, handlebars: typeof Handlebars, handlebarsHelpers: HandlebarsHelpers) => AsyncResult<ICompiledPublisherConfiguration>;
|
|
15
17
|
export declare class FailedToFetchConfigurationError extends Error {
|
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
export declare const Memoize: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => TReturn
|
|
2
|
-
|
|
1
|
+
export declare const Memoize: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => TReturn, { minutes, hours, seconds, milliseconds, cache }?: Partial<{
|
|
2
|
+
minutes: number;
|
|
3
|
+
hours: number;
|
|
4
|
+
seconds: number;
|
|
5
|
+
milliseconds: number;
|
|
6
|
+
cache: Map<string, [last: number, value: TReturn]>;
|
|
7
|
+
}>) => (...args: TArgs) => TReturn;
|
|
8
|
+
export declare const MemoizeAsync: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, { minutes, hours, seconds, milliseconds, cache }?: Partial<{
|
|
9
|
+
minutes: number;
|
|
10
|
+
hours: number;
|
|
11
|
+
seconds: number;
|
|
12
|
+
milliseconds: number;
|
|
13
|
+
cache: Map<string, [last: number, value: Promise<TReturn>]>;
|
|
14
|
+
}>) => (...args: TArgs) => Promise<TReturn>;
|
|
15
|
+
export declare const Cache: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => TReturn, { minutes, hours, seconds, milliseconds, cache }: Partial<{
|
|
16
|
+
minutes: number;
|
|
17
|
+
hours: number;
|
|
18
|
+
seconds: number;
|
|
19
|
+
milliseconds: number;
|
|
20
|
+
cache: [last: number, value: TReturn];
|
|
21
|
+
}>) => (...args: TArgs) => TReturn;
|
|
22
|
+
export declare const CacheAsync: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, { minutes, hours, seconds, milliseconds, cache }: Partial<{
|
|
23
|
+
minutes: number;
|
|
24
|
+
hours: number;
|
|
25
|
+
seconds: number;
|
|
26
|
+
milliseconds: number;
|
|
27
|
+
cache: [last: number, value: Promise<TReturn>];
|
|
28
|
+
}>) => (...args: TArgs) => Promise<TReturn>;
|
package/package.json
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@surfside/ads-core",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"module": "./lib/esm/index.js",
|
|
5
|
-
"main": "./lib/cjs/index.js",
|
|
6
|
-
"types": "./lib/types/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": "./lib/esm/index.js",
|
|
10
|
-
"require": "./lib/cjs/index.js",
|
|
11
|
-
"types": "./lib/types/index.d.ts"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"license": "UNLICENSED",
|
|
15
|
-
"type": "module",
|
|
16
|
-
"files": [
|
|
17
|
-
"lib/",
|
|
18
|
-
"README.md"
|
|
19
|
-
],
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@eslint/js": "^9.25.1",
|
|
22
|
-
"@types/bun": "latest",
|
|
23
|
-
"@types/handlebars": "^4.1.0",
|
|
24
|
-
"@types/jest": "^29.5.14",
|
|
25
|
-
"eslint": "^9.25.1",
|
|
26
|
-
"jest": "^29.7.0",
|
|
27
|
-
"npm-run-all": "^4.1.5",
|
|
28
|
-
"ts-jest": "^29.3.2",
|
|
29
|
-
"typedoc": "^0.28.5",
|
|
30
|
-
"typescript-eslint": "^8.41.0"
|
|
31
|
-
},
|
|
32
|
-
"peerDependencies": {
|
|
33
|
-
"typescript": "^5.8.3"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"handlebars": "^4.7.8"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"clean": "rm -rf ./lib",
|
|
40
|
-
"build": "bun x npm-run-all --parallel \"types\" \"esm\" \"cjs\"",
|
|
41
|
-
"build:debug": "bun ./debug.build.ts",
|
|
42
|
-
"types": "tsc -p ./tsconfig.types.json",
|
|
43
|
-
"esm": "tsc -p ./tsconfig.esm.json",
|
|
44
|
-
"cjs": "tsc -p tsconfig.cjs.json",
|
|
45
|
-
"lint": "npx eslint"
|
|
46
|
-
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@surfside/ads-core",
|
|
3
|
+
"version": "2.3.0-c2d1d13c.0",
|
|
4
|
+
"module": "./lib/esm/index.js",
|
|
5
|
+
"main": "./lib/cjs/index.js",
|
|
6
|
+
"types": "./lib/types/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./lib/esm/index.js",
|
|
10
|
+
"require": "./lib/cjs/index.js",
|
|
11
|
+
"types": "./lib/types/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"license": "UNLICENSED",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"lib/",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@eslint/js": "^9.25.1",
|
|
22
|
+
"@types/bun": "latest",
|
|
23
|
+
"@types/handlebars": "^4.1.0",
|
|
24
|
+
"@types/jest": "^29.5.14",
|
|
25
|
+
"eslint": "^9.25.1",
|
|
26
|
+
"jest": "^29.7.0",
|
|
27
|
+
"npm-run-all": "^4.1.5",
|
|
28
|
+
"ts-jest": "^29.3.2",
|
|
29
|
+
"typedoc": "^0.28.5",
|
|
30
|
+
"typescript-eslint": "^8.41.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"typescript": "^5.8.3"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"handlebars": "^4.7.8"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"clean": "rm -rf ./lib",
|
|
40
|
+
"build": "bun x npm-run-all --parallel \"types\" \"esm\" \"cjs\"",
|
|
41
|
+
"build:debug": "bun ./debug.build.ts",
|
|
42
|
+
"types": "tsc -p ./tsconfig.types.json",
|
|
43
|
+
"esm": "tsc -p ./tsconfig.esm.json",
|
|
44
|
+
"cjs": "tsc -p tsconfig.cjs.json",
|
|
45
|
+
"lint": "npx eslint",
|
|
46
|
+
"test": "jest --config jest.config.cjs"
|
|
47
|
+
}
|
|
48
|
+
}
|