@surfside/ads-core 2.0.16 → 2.0.17
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.map +1 -1
- package/lib/cjs/BuildInfo.js +1 -1
- package/lib/cjs/BuildInfo.js.map +1 -1
- package/lib/cjs/helpers/Handlebars.js +37 -4
- package/lib/cjs/helpers/Handlebars.js.map +1 -1
- package/lib/cjs/helpers/RequestBuilder.js +1 -1
- package/lib/cjs/helpers/RequestBuilder.js.map +1 -1
- package/lib/cjs/helpers/response/ProductCard.js +5 -2
- package/lib/cjs/helpers/response/ProductCard.js.map +1 -1
- package/lib/cjs/services/Bidder.js.map +1 -1
- package/lib/cjs/services/BotFiltering.js +9 -9
- package/lib/cjs/services/BotFiltering.js.map +1 -1
- package/lib/cjs/services/Configuration.js +4 -4
- package/lib/cjs/services/Configuration.js.map +1 -1
- package/lib/cjs/services/Memo.js +0 -5
- package/lib/cjs/services/Memo.js.map +1 -1
- package/lib/cjs/services/Product.js +28 -6
- package/lib/cjs/services/Product.js.map +1 -1
- package/lib/cjs/services/Recommender.js +11 -10
- package/lib/cjs/services/Recommender.js.map +1 -1
- package/lib/esm/Api.js.map +1 -1
- package/lib/esm/BuildInfo.js +1 -1
- package/lib/esm/BuildInfo.js.map +1 -1
- package/lib/esm/helpers/Handlebars.js +33 -3
- package/lib/esm/helpers/Handlebars.js.map +1 -1
- package/lib/esm/helpers/RequestBuilder.js +1 -1
- package/lib/esm/helpers/RequestBuilder.js.map +1 -1
- package/lib/esm/helpers/response/ProductCard.js +5 -2
- package/lib/esm/helpers/response/ProductCard.js.map +1 -1
- package/lib/esm/services/Bidder.js.map +1 -1
- package/lib/esm/services/BotFiltering.js +9 -9
- package/lib/esm/services/BotFiltering.js.map +1 -1
- package/lib/esm/services/Configuration.js +4 -4
- package/lib/esm/services/Configuration.js.map +1 -1
- package/lib/esm/services/Memo.js +0 -5
- package/lib/esm/services/Memo.js.map +1 -1
- package/lib/esm/services/Product.js +26 -5
- package/lib/esm/services/Product.js.map +1 -1
- package/lib/esm/services/Recommender.js +11 -10
- package/lib/esm/services/Recommender.js.map +1 -1
- package/lib/types/helpers/Handlebars.d.ts +18 -0
- package/lib/types/models/rtb/BidResponse.d.ts +4 -1
- package/lib/types/services/BotFiltering.d.ts +1 -1
- package/lib/types/services/Product.d.ts +8 -4
- package/lib/types/services/Recommender.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Product.js","sourceRoot":"src/","sources":["services/Product.ts"],"names":[],"mappings":"AACA,OAAO,EACH,GAAG,EAEN,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,GAAG,EACH,EAAE,EAGL,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Product.js","sourceRoot":"src/","sources":["services/Product.ts"],"names":[],"mappings":"AACA,OAAO,EACH,GAAG,EAEN,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,GAAG,EACH,EAAE,EAGL,MAAM,UAAU,CAAC;AASlB,MAAM,gBAAgB,GAAG,CACrB,WAAkC,EAClC,UAAgC,EAChC,YAAoC,EACtC,EAAE;IACA,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,CAAC,WAAW;aAChB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,SAAS,CAAE;aAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC;aACvD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC,CAAC,CACnE,CAAC;IACN,CAAC;IACD,OAAO,EAAE,CAAC,WAAW,CAAC,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AC;CACJ;AAED,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAC/B;IAAnB,YAAmB,QAAgB;QAC/B,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAD9B,aAAQ,GAAR,QAAQ,CAAQ;IAEnC,CAAC;CACJ;AACD,MAAM,OAAO,cAAe,SAAQ,KAAK;IAClB;IAAnB,YAAmB,SAAiB;QAChC,KAAK,CAAC,4CAA4C,GAAG,SAAS,CAAC,CAAC;QADjD,cAAS,GAAT,SAAS,CAAQ;IAEpC,CAAC;CACJ"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Ctx } from './Logger';
|
|
2
2
|
import { Err, Ok } from './Result';
|
|
3
|
-
export async function* GenerateTopProducts(logger, productFeed, url, accountId, siteId, locationId) {
|
|
3
|
+
export async function* GenerateTopProducts(logger, productFeed, url, accountId, siteId, locationId, category) {
|
|
4
4
|
const log = Ctx(logger)?.with('GenerateTopProducts').with(accountId).with(siteId).with(locationId);
|
|
5
5
|
log?.info('Generating top products');
|
|
6
|
-
yield* generateProductRecommendation(logger, productFeed, url, accountId, siteId, locationId, undefined, 'top-products');
|
|
6
|
+
yield* generateProductRecommendation(logger, productFeed, url, accountId, siteId, locationId, undefined, 'top-products', category);
|
|
7
7
|
}
|
|
8
|
-
export async function* GenerateForYou(logger, productFeed, url, accountId, siteId, locationId, userId) {
|
|
8
|
+
export async function* GenerateForYou(logger, productFeed, url, accountId, siteId, locationId, userId, category) {
|
|
9
9
|
const log = Ctx(logger)?.with('GenerateForYou').with(accountId).with(siteId).with(locationId).with(userId);
|
|
10
10
|
log?.info('Generating for you');
|
|
11
|
-
yield* generateProductRecommendation(logger, productFeed, url, accountId, siteId, locationId, userId, 'for-you');
|
|
11
|
+
yield* generateProductRecommendation(logger, productFeed, url, accountId, siteId, locationId, userId, 'for-you', category);
|
|
12
12
|
}
|
|
13
|
-
export async function* GeneratePreviousPurchases(logger, productFeed, url, accountId, siteId, locationId, userId) {
|
|
13
|
+
export async function* GeneratePreviousPurchases(logger, productFeed, url, accountId, siteId, locationId, userId, category) {
|
|
14
14
|
const log = Ctx(logger)
|
|
15
15
|
?.with('GeneratePreviousPurchases')
|
|
16
16
|
.with(accountId)
|
|
@@ -18,12 +18,12 @@ export async function* GeneratePreviousPurchases(logger, productFeed, url, accou
|
|
|
18
18
|
.with(locationId)
|
|
19
19
|
.with(userId);
|
|
20
20
|
log?.info('Generating previous purchases');
|
|
21
|
-
yield* generateProductRecommendation(log, productFeed, url, accountId, siteId, locationId, userId, 'buy-again');
|
|
21
|
+
yield* generateProductRecommendation(log, productFeed, url, accountId, siteId, locationId, userId, 'buy-again', category);
|
|
22
22
|
}
|
|
23
|
-
async function* generateProductRecommendation(logger, productFeed, url, accountId, siteId, locationId, userId, type) {
|
|
23
|
+
async function* generateProductRecommendation(logger, productFeed, url, accountId, siteId, locationId, userId, type, category) {
|
|
24
24
|
const log = Ctx(logger)?.with('generateProductRecommendation');
|
|
25
25
|
log?.debug('Generating product recommendation');
|
|
26
|
-
const recommendations = await fetchRecommendations(log, url, accountId, siteId, locationId, userId, type);
|
|
26
|
+
const recommendations = await fetchRecommendations(log, url, accountId, siteId, locationId, userId, type, category);
|
|
27
27
|
if (!recommendations.ok) {
|
|
28
28
|
log?.error(recommendations.error);
|
|
29
29
|
return;
|
|
@@ -31,10 +31,11 @@ async function* generateProductRecommendation(logger, productFeed, url, accountI
|
|
|
31
31
|
yield* generateProduct(log, productFeed, accountId, locationId, recommendations.value);
|
|
32
32
|
log?.debug('out of recommendations');
|
|
33
33
|
}
|
|
34
|
-
const fetchRecommendations = async (logger, url, accountId, siteId, locationId, userId, type) => {
|
|
34
|
+
const fetchRecommendations = async (logger, url, accountId, siteId, locationId, userId, type, category) => {
|
|
35
35
|
const log = Ctx(logger)?.with('fetchRecommendations');
|
|
36
36
|
log?.debug('Fetching recommendations');
|
|
37
|
-
const key = `accountId=${accountId}&siteId=${siteId}&locationId=${locationId}&userId=${userId ?? 'null'}
|
|
37
|
+
const key = `accountId=${accountId}&siteId=${siteId}&locationId=${locationId}&userId=${userId ?? 'null'}` +
|
|
38
|
+
(category !== undefined ? `&category=${category}` : '');
|
|
38
39
|
try {
|
|
39
40
|
const results = await fetch(`${url}/r/${type}?${key}&limit=100`);
|
|
40
41
|
if (results.status !== 200) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Recommender.js","sourceRoot":"src/","sources":["services/Recommender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAgB,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAoB,MAAM,UAAU,CAAC;AAKrD,MAAM,CAAC,KAAK,SAAU,CAAC,CAAA,mBAAmB,CACtC,MAA2B,EAC3B,WAAiD,EACjD,GAAW,EACX,SAAiB,EACjB,MAAc,EACd,UAAkB;
|
|
1
|
+
{"version":3,"file":"Recommender.js","sourceRoot":"src/","sources":["services/Recommender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAgB,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAoB,MAAM,UAAU,CAAC;AAKrD,MAAM,CAAC,KAAK,SAAU,CAAC,CAAA,mBAAmB,CACtC,MAA2B,EAC3B,WAAiD,EACjD,GAAW,EACX,SAAiB,EACjB,MAAc,EACd,UAAkB,EAClB,QAAiB;IAEjB,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnG,GAAG,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAErC,KAAK,CAAC,CAAC,6BAA6B,CAChC,MAAM,EACN,WAAW,EACX,GAAG,EACH,SAAS,EACT,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,EACd,QAAQ,CACX,CAAC;AACN,C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AM,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,GAAG,EAAE,IAAI,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;IAED,GAAG,EAAE,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7C;QACI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
|
@@ -37,6 +37,11 @@ export declare function slug(name: string, options: {
|
|
|
37
37
|
* @returns A lowercase version of the passed string
|
|
38
38
|
*/
|
|
39
39
|
export declare function lower(name: string): string;
|
|
40
|
+
export declare function split(str: string, options: {
|
|
41
|
+
hash: {
|
|
42
|
+
by?: string;
|
|
43
|
+
};
|
|
44
|
+
}): string[];
|
|
40
45
|
export declare function upper(name: string): string;
|
|
41
46
|
/**
|
|
42
47
|
* Returns the path component of the URL at the specified position, 1-indexed
|
|
@@ -50,6 +55,18 @@ export declare const path: (pathname: string) => (position: number, options: {
|
|
|
50
55
|
url?: string;
|
|
51
56
|
};
|
|
52
57
|
}) => string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the domain. By default strips out subdomains. Pass a number to increase the depth of the domain. For example
|
|
60
|
+
* if the url is http://shop.mysite.co/ then {{domain}} returns `mysite.co`. `{{domain 3}}` will return
|
|
61
|
+
* `shop.mysite.co` and `{{domain 1}}` returns `co`.
|
|
62
|
+
* @returns The domain
|
|
63
|
+
*/
|
|
64
|
+
export declare const domain: (hostname: string) => (options?: {
|
|
65
|
+
hash: {
|
|
66
|
+
url?: string;
|
|
67
|
+
depth?: number;
|
|
68
|
+
};
|
|
69
|
+
}) => string | undefined;
|
|
53
70
|
export declare function money(value: number | string, options: {
|
|
54
71
|
hash: {
|
|
55
72
|
cents?: boolean;
|
|
@@ -184,5 +201,6 @@ export declare function global(...args: any[]): any;
|
|
|
184
201
|
* @returns An array of the passed arguments
|
|
185
202
|
*/
|
|
186
203
|
export declare function array(...args: any[]): any[];
|
|
204
|
+
export declare function brand(options: Handlebars.HelperOptions): string | undefined;
|
|
187
205
|
export type HandlebarsHelpers = Record<string, HelperDelegate>;
|
|
188
206
|
export declare const GetHelpers: (windowInfo: INativeTemplateDelegateWindow) => HandlebarsHelpers;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export interface IBidExtensions extends Record<string, any> {
|
|
2
|
+
primaryCategory?: string;
|
|
3
|
+
}
|
|
1
4
|
export interface IBid {
|
|
2
5
|
id: string;
|
|
3
6
|
impid: string;
|
|
@@ -26,7 +29,7 @@ export interface IBid {
|
|
|
26
29
|
wratio?: number;
|
|
27
30
|
hratio?: number;
|
|
28
31
|
exp?: number;
|
|
29
|
-
ext?:
|
|
32
|
+
ext?: IBidExtensions;
|
|
30
33
|
dur?: number;
|
|
31
34
|
mtype?: number;
|
|
32
35
|
slotinpid?: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ILogger } from './Logger';
|
|
1
|
+
import { type ILogger } from './Logger';
|
|
2
2
|
export declare const FilterBots: <TArgs extends readonly unknown[], TReturn>(logger: ILogger | undefined, userAgent: string, fn: (...args: TArgs) => TReturn, fallback: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
3
3
|
export declare const FilterBotsAsyncGenerator: <TArgs extends readonly unknown[], TReturn>(logger: ILogger | undefined, userAgent: string, fn: (...args: TArgs) => AsyncGenerator<TReturn>) => (...args: TArgs) => AsyncGenerator<Awaited<TReturn>, void, any>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ICompiledPublisherConfiguration, IProductInformation } from '../models';
|
|
2
2
|
import { type ILogger } from './Logger';
|
|
3
3
|
import { type Result, type AsyncResult } from './Result';
|
|
4
|
-
export type GetSponsoredProductFromNativeIdFn = (nativeId: string) => AsyncGenerator<IProductInformation>;
|
|
5
|
-
export type GetAllSponsoredProductFromNativeIdFn = (nativeId: string) => Promise<Result<IProductInformation[]>>;
|
|
4
|
+
export type GetSponsoredProductFromNativeIdFn = (nativeId: string, categories?: string[]) => AsyncGenerator<IProductInformation>;
|
|
5
|
+
export type GetAllSponsoredProductFromNativeIdFn = (nativeId: string, categories?: string[]) => Promise<Result<IProductInformation[]>>;
|
|
6
6
|
export type GetRecommendedProductFromProductIdFn = (productId: string) => AsyncResult<IProductInformation>;
|
|
7
|
-
export declare const GetAllSponsoredProducts: (logger: ILogger | undefined, url: string, config: ICompiledPublisherConfiguration, accountId: string, locationId: string, nativeId: string) => Promise<Result<IProductInformation[]>>;
|
|
8
|
-
export declare const GetAllSponsoredBrandProducts: (logger: ILogger | undefined, url: string, config: ICompiledPublisherConfiguration, accountId: string, locationId: string, nativeId: string) => Promise<Result<IProductInformation[]>>;
|
|
7
|
+
export declare const GetAllSponsoredProducts: (logger: ILogger | undefined, url: string, config: ICompiledPublisherConfiguration, accountId: string, locationId: string, nativeId: string, categories?: string[]) => Promise<Result<IProductInformation[]>>;
|
|
8
|
+
export declare const GetAllSponsoredBrandProducts: (logger: ILogger | undefined, url: string, config: ICompiledPublisherConfiguration, accountId: string, locationId: string, nativeId: string, categories?: string[]) => Promise<Result<IProductInformation[]>>;
|
|
9
9
|
export declare const GetRecommendedProduct: (logger: ILogger | undefined, url: string, config: ICompiledPublisherConfiguration, accountId: string, locationId: string, productId: string) => AsyncResult<IProductInformation>;
|
|
10
10
|
export declare class NoNativeError extends Error {
|
|
11
11
|
nativeId: string;
|
|
@@ -15,3 +15,7 @@ export declare class MalformedBrandResponseError extends Error {
|
|
|
15
15
|
nativeId: string;
|
|
16
16
|
constructor(nativeId: string);
|
|
17
17
|
}
|
|
18
|
+
export declare class NoProductError extends Error {
|
|
19
|
+
productId: string;
|
|
20
|
+
constructor(productId: string);
|
|
21
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IProductInformation } from '../models';
|
|
2
2
|
import { type ILogger } from './Logger';
|
|
3
3
|
import type { GetRecommendedProductFromProductIdFn } from './Product';
|
|
4
|
-
export type NonPersonalRecommenderFn = () => AsyncGenerator<IProductInformation>;
|
|
5
|
-
export type PersonalRecommenderFn = (userId: string) => AsyncGenerator<IProductInformation>;
|
|
6
|
-
export declare function GenerateTopProducts(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string): AsyncGenerator<IProductInformation>;
|
|
7
|
-
export declare function GenerateForYou(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
|
|
8
|
-
export declare function GeneratePreviousPurchases(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
|
|
4
|
+
export type NonPersonalRecommenderFn = (category?: string) => AsyncGenerator<IProductInformation>;
|
|
5
|
+
export type PersonalRecommenderFn = (userId: string, category?: string) => AsyncGenerator<IProductInformation>;
|
|
6
|
+
export declare function GenerateTopProducts(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, category?: string): AsyncGenerator<IProductInformation>;
|
|
7
|
+
export declare function GenerateForYou(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, userId: string, category?: string): AsyncGenerator<IProductInformation>;
|
|
8
|
+
export declare function GeneratePreviousPurchases(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, userId: string, category?: string): AsyncGenerator<IProductInformation>;
|
|
9
9
|
export declare class NoRecommendationsError extends Error {
|
|
10
10
|
constructor();
|
|
11
11
|
}
|