@surfside/ads-core-web 0.1.22 → 0.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/BuildInfo.js +6 -2
- package/lib/cjs/BuildInfo.js.map +1 -1
- package/lib/cjs/Init.js +92 -0
- package/lib/cjs/Init.js.map +1 -0
- package/lib/cjs/helpers/Dom.js.map +1 -1
- package/lib/cjs/helpers/Trackers.js +1 -1
- package/lib/cjs/helpers/Trackers.js.map +1 -1
- package/lib/cjs/helpers/UserId.js +4 -1
- package/lib/cjs/helpers/UserId.js.map +1 -1
- package/lib/cjs/helpers/WebTelemetryCollector.js +56 -0
- package/lib/cjs/helpers/WebTelemetryCollector.js.map +1 -0
- package/lib/cjs/helpers/index.js +1 -0
- package/lib/cjs/helpers/index.js.map +1 -1
- package/lib/cjs/index.js +29 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/rendering/Banner.js +31 -29
- package/lib/cjs/rendering/Banner.js.map +1 -1
- package/lib/cjs/rendering/Carousel.js +207 -126
- package/lib/cjs/rendering/Carousel.js.map +1 -1
- package/lib/cjs/rendering/Framework.js +4 -2
- package/lib/cjs/rendering/Framework.js.map +1 -1
- package/lib/cjs/rendering/ProductCard.js +25 -20
- package/lib/cjs/rendering/ProductCard.js.map +1 -1
- package/lib/cjs/rendering/Video.js +142 -130
- package/lib/cjs/rendering/Video.js.map +1 -1
- package/lib/cjs/rendering/Watermark.js +34 -34
- package/lib/cjs/rendering/Watermark.js.map +1 -1
- package/lib/cjs/rendering/index.js.map +1 -1
- package/lib/esm/BuildInfo.js +5 -1
- package/lib/esm/BuildInfo.js.map +1 -1
- package/lib/esm/Init.js +85 -0
- package/lib/esm/Init.js.map +1 -0
- package/lib/esm/helpers/Dom.js.map +1 -1
- package/lib/esm/helpers/Trackers.js +1 -1
- package/lib/esm/helpers/Trackers.js.map +1 -1
- package/lib/esm/helpers/UserId.js +4 -1
- package/lib/esm/helpers/UserId.js.map +1 -1
- package/lib/esm/helpers/WebTelemetryCollector.js +52 -0
- package/lib/esm/helpers/WebTelemetryCollector.js.map +1 -0
- package/lib/esm/helpers/index.js +1 -0
- package/lib/esm/helpers/index.js.map +1 -1
- package/lib/esm/index.js +6 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/rendering/Banner.js +31 -29
- package/lib/esm/rendering/Banner.js.map +1 -1
- package/lib/esm/rendering/Carousel.js +207 -126
- package/lib/esm/rendering/Carousel.js.map +1 -1
- package/lib/esm/rendering/Framework.js +4 -2
- package/lib/esm/rendering/Framework.js.map +1 -1
- package/lib/esm/rendering/ProductCard.js +25 -20
- package/lib/esm/rendering/ProductCard.js.map +1 -1
- package/lib/esm/rendering/Video.js +142 -130
- package/lib/esm/rendering/Video.js.map +1 -1
- package/lib/esm/rendering/Watermark.js +34 -34
- package/lib/esm/rendering/Watermark.js.map +1 -1
- package/lib/esm/rendering/index.js.map +1 -1
- package/lib/types/BuildInfo.d.ts +1 -1
- package/lib/types/Init.d.ts +24 -0
- package/lib/types/helpers/WebTelemetryCollector.d.ts +24 -0
- package/lib/types/helpers/index.d.ts +1 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/rendering/Video.d.ts +1 -0
- package/package.json +42 -41
- package/lib/cjs/debug/carousel.js +0 -74
- package/lib/cjs/debug/carousel.js.map +0 -1
- package/lib/esm/debug/carousel.js +0 -72
- package/lib/esm/debug/carousel.js.map +0 -1
- package/lib/types/debug/carousel.d.ts +0 -1
|
@@ -3,9 +3,9 @@ export const RenderWatermark = (logger) => {
|
|
|
3
3
|
const log = Ctx(logger)?.with('RenderWatermark');
|
|
4
4
|
const parser = new DOMParser();
|
|
5
5
|
const doc = parser.parseFromString(template, 'text/html');
|
|
6
|
-
const wrapper = document.createElement('div');
|
|
6
|
+
const wrapper = globalThis.document.createElement('div');
|
|
7
7
|
const shadow = wrapper.attachShadow({ mode: 'open' });
|
|
8
|
-
const stylesheet = document.createElement('style');
|
|
8
|
+
const stylesheet = globalThis.document.createElement('style');
|
|
9
9
|
stylesheet.innerHTML = style;
|
|
10
10
|
shadow.appendChild(stylesheet);
|
|
11
11
|
for (let i = 0; i < doc.body.children.length; i++) {
|
|
@@ -18,38 +18,38 @@ export const RenderWatermark = (logger) => {
|
|
|
18
18
|
}
|
|
19
19
|
return Ok(wrapper);
|
|
20
20
|
};
|
|
21
|
-
const template = `<div class="watermark">
|
|
22
|
-
<a href="https://surfside.io/contact" target="_blank">
|
|
23
|
-
<div class="watermark-svg">
|
|
24
|
-
<img src="https://cdn.surfside.io/assets/surfside-logo.svg" alt="Surfside logo"/>
|
|
25
|
-
</div>
|
|
26
|
-
</a>
|
|
27
|
-
</div>
|
|
21
|
+
const template = `<div class="watermark">
|
|
22
|
+
<a href="https://surfside.io/contact" target="_blank">
|
|
23
|
+
<div class="watermark-svg">
|
|
24
|
+
<img src="https://cdn.surfside.io/assets/surfside-logo.svg" alt="Surfside logo"/>
|
|
25
|
+
</div>
|
|
26
|
+
</a>
|
|
27
|
+
</div>
|
|
28
28
|
`;
|
|
29
|
-
const style = `.watermark {
|
|
30
|
-
background: rgba(255, 255, 255, 0.7);
|
|
31
|
-
|
|
32
|
-
position: absolute;
|
|
33
|
-
right: -67px;
|
|
34
|
-
width: 85px;
|
|
35
|
-
/* transform: scale(0.8); */
|
|
36
|
-
transform-origin: bottom right;
|
|
37
|
-
bottom: 0;
|
|
38
|
-
|
|
39
|
-
padding: 3px 2px 0px 6px;
|
|
40
|
-
border-radius: 5px 0 0 5px !important;
|
|
41
|
-
transition: right 300ms ease-out;
|
|
42
|
-
|
|
43
|
-
&:hover {
|
|
44
|
-
right: 0
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.surfside-video .watermark {
|
|
49
|
-
top: 0;
|
|
50
|
-
height: auto;
|
|
51
|
-
bottom: initial;
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
}
|
|
29
|
+
const style = `.watermark {
|
|
30
|
+
background: rgba(255, 255, 255, 0.7);
|
|
31
|
+
|
|
32
|
+
position: absolute;
|
|
33
|
+
right: -67px;
|
|
34
|
+
width: 85px;
|
|
35
|
+
/* transform: scale(0.8); */
|
|
36
|
+
transform-origin: bottom right;
|
|
37
|
+
bottom: 0;
|
|
38
|
+
|
|
39
|
+
padding: 3px 2px 0px 6px;
|
|
40
|
+
border-radius: 5px 0 0 5px !important;
|
|
41
|
+
transition: right 300ms ease-out;
|
|
42
|
+
|
|
43
|
+
&:hover {
|
|
44
|
+
right: 0
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.surfside-video .watermark {
|
|
49
|
+
top: 0;
|
|
50
|
+
height: auto;
|
|
51
|
+
bottom: initial;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
}
|
|
54
54
|
`;
|
|
55
55
|
//# sourceMappingURL=Watermark.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Watermark.js","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"Watermark.js","sourceRoot":"../@surfside-ads-core-web/","sources":["rendering/Watermark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAgB,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAExE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAA2B,EAAuB,EAAE;IAChF,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAE1D,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9D,UAAU,CAAC,SAAS,GAAG,KAAK,CAAC;IAC7B,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnB,GAAG,EAAE,IAAI,CAAC,qCAAqC,EAAE,CAAC,CAAC,CAAC;YACpD,SAAS;QACb,CAAC;QAED,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG;;;;;;;CAOhB,CAAC;AAEF,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../@surfside-ads-core-web/","sources":["rendering/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/lib/types/BuildInfo.d.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ILoadSurfAdsClientConfiguration, type ISurfAdsCoreConfiguration, type Result, type AsyncResult, type ISurfAdsClientDependencies, type ILogger, type ISurfAdsClientConfigurationOverrides } from '@surfside/ads-core-client';
|
|
2
|
+
import { type ISurfsideWebApi } from '.';
|
|
3
|
+
export interface ISurfAdsWebConfigurationOverrides extends ISurfAdsClientConfigurationOverrides {
|
|
4
|
+
}
|
|
5
|
+
export interface ISurfAdsWebConfiguration extends ISurfAdsCoreConfiguration {
|
|
6
|
+
overrides?: {
|
|
7
|
+
services?: Partial<ISurfAdsWebConfigurationOverrides>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface ILoadSurfAdsWebConfiguration extends ILoadSurfAdsClientConfiguration {
|
|
11
|
+
overrides?: {
|
|
12
|
+
services?: Partial<ISurfAdsWebConfigurationOverrides>;
|
|
13
|
+
dependencies?: Partial<ISurfAdsWebDependencies>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ISurfAdsWebDependencies extends ISurfAdsClientDependencies {
|
|
17
|
+
}
|
|
18
|
+
export declare const CreateSurfAdsWeb: (config: ISurfAdsWebConfiguration) => Result<ISurfsideWebApi>;
|
|
19
|
+
export declare const LoadSurfAdsWebDependencies: (config: ILoadSurfAdsWebConfiguration) => AsyncResult<ISurfAdsWebDependencies>;
|
|
20
|
+
export declare const LoadSurfAdsWeb: (config: ILoadSurfAdsWebConfiguration) => AsyncResult<ISurfsideWebApi>;
|
|
21
|
+
export declare const LoadSurfAdsWebSimple: (accountId: string, siteId: string, channelId: string, locationId: string, userId?: string, logger?: ILogger, telemetry?: boolean, overrides?: {
|
|
22
|
+
services?: Partial<ISurfAdsWebConfigurationOverrides>;
|
|
23
|
+
dependencies?: Partial<ISurfAdsWebDependencies>;
|
|
24
|
+
}) => AsyncResult<ISurfsideWebApi>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ITelemetryCollector, type ITelemetryDevice, type ITelemetryEntry } from '@surfside/ads-core';
|
|
2
|
+
export interface IWebTelemetryCollectorOptions {
|
|
3
|
+
accountId: string;
|
|
4
|
+
siteId: string;
|
|
5
|
+
channelId: string;
|
|
6
|
+
locationId: string;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
tags?: Record<string, string>;
|
|
9
|
+
batchIntervalMs?: number;
|
|
10
|
+
url?: string;
|
|
11
|
+
device: ITelemetryDevice | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare class WebTelemetryCollector extends ITelemetryCollector {
|
|
14
|
+
private readonly _endpoint;
|
|
15
|
+
private readonly _tags;
|
|
16
|
+
private readonly _batchIntervalMs;
|
|
17
|
+
private readonly _pageUrl;
|
|
18
|
+
private _queue;
|
|
19
|
+
private _flushTimer;
|
|
20
|
+
private _device;
|
|
21
|
+
constructor(options: IWebTelemetryCollectorOptions);
|
|
22
|
+
record(entry: ITelemetryEntry): void;
|
|
23
|
+
flush(): void;
|
|
24
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { type RenderCarouselFn } from './rendering/Carousel';
|
|
|
3
3
|
import { type RenderBannerFn } from './rendering';
|
|
4
4
|
import { type RenderProductCardFn } from './rendering/ProductCard';
|
|
5
5
|
import { type RenderVideoFn } from './rendering/Video';
|
|
6
|
+
export declare const PROD_TELEMETRY_SERVICE = "//telemetry.surfside.io/v1/ingest";
|
|
6
7
|
export * from './rendering';
|
|
7
8
|
export * from './helpers';
|
|
8
|
-
export * from './BuildInfo';
|
|
9
|
+
export * as SurfsideAdsCoreWebVersionInfo from './BuildInfo';
|
|
10
|
+
export * from './Init';
|
|
9
11
|
export interface ISurfsideWebApi extends ISurfsideClientApi {
|
|
10
12
|
renderBanner: RenderBannerFn;
|
|
11
13
|
renderVideo: RenderVideoFn;
|
|
@@ -12,5 +12,6 @@ export interface IVideoTrackers {
|
|
|
12
12
|
complete: ITrackerState;
|
|
13
13
|
stop: ITrackerState;
|
|
14
14
|
impression: ITrackerState;
|
|
15
|
+
pause: ITrackerState;
|
|
15
16
|
}
|
|
16
17
|
export declare const RenderVideo: (logger: ILogger | undefined, deviceInfo: IDevice | undefined, geo: IGeoContext | undefined, userAgent: string | undefined, builtVideo: IBuiltVideo) => Result<HTMLElement>;
|
package/package.json
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@surfside/ads-core-web",
|
|
3
|
-
"module": "./lib/esm/index.js",
|
|
4
|
-
"main": "./lib/cjs/index.js",
|
|
5
|
-
"types": "./lib/types/index.d.ts",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"import": "./lib/esm/index.js",
|
|
9
|
-
"require": "./lib/cjs/index.js",
|
|
10
|
-
"types": "./lib/types/index.d.ts"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"version": "0.
|
|
14
|
-
"license": "UNLICENSED",
|
|
15
|
-
"files": [
|
|
16
|
-
"lib/",
|
|
17
|
-
"README.md"
|
|
18
|
-
],
|
|
19
|
-
"type": "module",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"clean": "rm -rf ./lib",
|
|
22
|
-
"
|
|
23
|
-
"build": "
|
|
24
|
-
"types": "tsc -p ./tsconfig.types.json",
|
|
25
|
-
"esm": "tsc -p ./tsconfig.esm.json",
|
|
26
|
-
"cjs": "tsc -p tsconfig.cjs.json",
|
|
27
|
-
"lint": "npx eslint"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@surfside/ads-core-client": "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"typescript": "^5.8.3"
|
|
40
|
-
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@surfside/ads-core-web",
|
|
3
|
+
"module": "./lib/esm/index.js",
|
|
4
|
+
"main": "./lib/cjs/index.js",
|
|
5
|
+
"types": "./lib/types/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./lib/esm/index.js",
|
|
9
|
+
"require": "./lib/cjs/index.js",
|
|
10
|
+
"types": "./lib/types/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"version": "0.3.0-c2d1d13c.0",
|
|
14
|
+
"license": "UNLICENSED",
|
|
15
|
+
"files": [
|
|
16
|
+
"lib/",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"clean": "rm -rf ./lib",
|
|
22
|
+
"build": "bun x npm-run-all --parallel \"types\" \"esm\" \"cjs\"",
|
|
23
|
+
"build:debug": "bun ./debug.build.ts",
|
|
24
|
+
"types": "tsc -p ./tsconfig.types.json",
|
|
25
|
+
"esm": "tsc -p ./tsconfig.esm.json",
|
|
26
|
+
"cjs": "tsc -p tsconfig.cjs.json",
|
|
27
|
+
"lint": "npx eslint"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@surfside/ads-core-client": "0.3.0-c2d1d13c.0",
|
|
31
|
+
"@surfside/ads-core-mock": "0.3.0-c2d1d13c.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@eslint/js": "^9.25.1",
|
|
35
|
+
"@surfside/ads-core-mock": "0.3.0-c2d1d13c.0",
|
|
36
|
+
"@types/bun": "latest",
|
|
37
|
+
"eslint": "^9.25.1",
|
|
38
|
+
"handlebars": "^4.7.8",
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
|
+
"typescript-eslint": "^8.41.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const ads_core_client_1 = require("@surfside/ads-core-client");
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
const ads_core_mock_1 = require("@surfside/ads-core-mock");
|
|
6
|
-
await (async () => {
|
|
7
|
-
const { buildHybridCarousel, startRequest, defaultNative, buildBannerResponse, requestBids, renderCarousel, renderBanner, buildVideoResponse, renderVideo } = (0, ads_core_client_1.GetValueOrThrow)(await (0, __1.InitSurfAdsWebInternal)((0, ads_core_mock_1.InitSurfAdsCoreMock)('ec981', // Account ID
|
|
8
|
-
'544fa', // Channel ID
|
|
9
|
-
'bf9bc', // Site ID
|
|
10
|
-
'greengoddess', // Location ID
|
|
11
|
-
undefined, (0, ads_core_client_1.InitLogger)())));
|
|
12
|
-
/* ===== Carousel ===== */
|
|
13
|
-
/* Make request, build response */
|
|
14
|
-
const carouselRes = await buildHybridCarousel({
|
|
15
|
-
type: 'top-products',
|
|
16
|
-
}, startRequest('my-zone') // Zone ID
|
|
17
|
-
.withNative(defaultNative()
|
|
18
|
-
.withMetaProduct(80, false)
|
|
19
|
-
.withMetaBrand(80, false)
|
|
20
|
-
.build())
|
|
21
|
-
.build());
|
|
22
|
-
if (!carouselRes.ok) {
|
|
23
|
-
console.error(carouselRes.error);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const carousel = carouselRes.value;
|
|
27
|
-
/* Render carousel */
|
|
28
|
-
const rendered = (0, ads_core_client_1.GetValueOrThrow)(await renderCarousel(carousel, 300, {
|
|
29
|
-
type: 'infinite'
|
|
30
|
-
}, 'page'));
|
|
31
|
-
/* Add to page */
|
|
32
|
-
document.querySelector('.carousel-container').appendChild(rendered.element);
|
|
33
|
-
const success = await rendered.init();
|
|
34
|
-
if (!success.ok) {
|
|
35
|
-
throw success.error;
|
|
36
|
-
}
|
|
37
|
-
/* ===== Banner ===== */
|
|
38
|
-
const bidRes = await requestBids(startRequest('banner-zone')
|
|
39
|
-
.withBanner(4, 1)
|
|
40
|
-
.build());
|
|
41
|
-
if (!bidRes.ok) {
|
|
42
|
-
console.error('No banners');
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const bid = bidRes.value.seatbid?.[0]?.bid?.[0];
|
|
46
|
-
if (bid === undefined) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const banner = renderBanner((0, ads_core_client_1.GetValueOrThrow)(buildBannerResponse(bid)));
|
|
50
|
-
if (!banner.ok) {
|
|
51
|
-
throw banner.error;
|
|
52
|
-
}
|
|
53
|
-
document.querySelector('.banner-container')?.appendChild(banner.value);
|
|
54
|
-
const video = await (0, ads_core_client_1.AsyncPipe)(requestBids(startRequest('video-zone')
|
|
55
|
-
.withVideo(320, 240, 0, 30)
|
|
56
|
-
.build()))
|
|
57
|
-
.then(resp => (0, ads_core_client_1.WrapValue)(resp.seatbid?.[0]?.bid?.[0]))
|
|
58
|
-
.then(buildVideoResponse)
|
|
59
|
-
.then(renderVideo)
|
|
60
|
-
.result();
|
|
61
|
-
if (!video.ok) {
|
|
62
|
-
console.error('Video failed!');
|
|
63
|
-
throw video.error;
|
|
64
|
-
}
|
|
65
|
-
document.querySelector('.video-container')?.appendChild(video.value);
|
|
66
|
-
/* Dynamic Zones */
|
|
67
|
-
// const dynamicZone = GetValueOrThrow(await getDynamicZone('my-zone'));
|
|
68
|
-
// const dynamicZoneRequest = GetValueOrThrow(buildDynamicZoneRequest('my-zone', dynamicZone));
|
|
69
|
-
// const dynamicResponse = GetValueOrThrow(await buildDynamicResponse(dynamicZoneRequest));
|
|
70
|
-
// const htmlElement = buildDynamicCreative(dynamicResponse);
|
|
71
|
-
// const htmlElement = await getDynamicCreative('my-zone');
|
|
72
|
-
// console.log(dynamicResponse);
|
|
73
|
-
})();
|
|
74
|
-
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"src/","sources":["debug/carousel.ts"],"names":[],"mappings":";;AAAA,+DAA8F;AAC9F,0BAA4C;AAC5C,2DAA8D;AAE9D,MAAM,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,EACF,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACd,GACG,IAAA,iCAAe,EAAC,MA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,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAErE,mBAAmB;IACnB,wEAAwE;IACxE,+FAA+F;IAC/F,2FAA2F;IAC3F,6DAA6D;IAC7D,2DAA2D;IAE3D,gCAAgC;AACpC,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { AsyncPipe, GetValueOrThrow, InitLogger, WrapValue } from '@surfside/ads-core-client';
|
|
2
|
-
import { InitSurfAdsWebInternal } from '..';
|
|
3
|
-
import { InitSurfAdsCoreMock } from '@surfside/ads-core-mock';
|
|
4
|
-
await (async () => {
|
|
5
|
-
const { buildHybridCarousel, startRequest, defaultNative, buildBannerResponse, requestBids, renderCarousel, renderBanner, buildVideoResponse, renderVideo } = GetValueOrThrow(await InitSurfAdsWebInternal(InitSurfAdsCoreMock('ec981', // Account ID
|
|
6
|
-
'544fa', // Channel ID
|
|
7
|
-
'bf9bc', // Site ID
|
|
8
|
-
'greengoddess', // Location ID
|
|
9
|
-
undefined, InitLogger())));
|
|
10
|
-
/* ===== Carousel ===== */
|
|
11
|
-
/* Make request, build response */
|
|
12
|
-
const carouselRes = await buildHybridCarousel({
|
|
13
|
-
type: 'top-products',
|
|
14
|
-
}, startRequest('my-zone') // Zone ID
|
|
15
|
-
.withNative(defaultNative()
|
|
16
|
-
.withMetaProduct(80, false)
|
|
17
|
-
.withMetaBrand(80, false)
|
|
18
|
-
.build())
|
|
19
|
-
.build());
|
|
20
|
-
if (!carouselRes.ok) {
|
|
21
|
-
console.error(carouselRes.error);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const carousel = carouselRes.value;
|
|
25
|
-
/* Render carousel */
|
|
26
|
-
const rendered = GetValueOrThrow(await renderCarousel(carousel, 300, {
|
|
27
|
-
type: 'infinite'
|
|
28
|
-
}, 'page'));
|
|
29
|
-
/* Add to page */
|
|
30
|
-
document.querySelector('.carousel-container').appendChild(rendered.element);
|
|
31
|
-
const success = await rendered.init();
|
|
32
|
-
if (!success.ok) {
|
|
33
|
-
throw success.error;
|
|
34
|
-
}
|
|
35
|
-
/* ===== Banner ===== */
|
|
36
|
-
const bidRes = await requestBids(startRequest('banner-zone')
|
|
37
|
-
.withBanner(4, 1)
|
|
38
|
-
.build());
|
|
39
|
-
if (!bidRes.ok) {
|
|
40
|
-
console.error('No banners');
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const bid = bidRes.value.seatbid?.[0]?.bid?.[0];
|
|
44
|
-
if (bid === undefined) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const banner = renderBanner(GetValueOrThrow(buildBannerResponse(bid)));
|
|
48
|
-
if (!banner.ok) {
|
|
49
|
-
throw banner.error;
|
|
50
|
-
}
|
|
51
|
-
document.querySelector('.banner-container')?.appendChild(banner.value);
|
|
52
|
-
const video = await AsyncPipe(requestBids(startRequest('video-zone')
|
|
53
|
-
.withVideo(320, 240, 0, 30)
|
|
54
|
-
.build()))
|
|
55
|
-
.then(resp => WrapValue(resp.seatbid?.[0]?.bid?.[0]))
|
|
56
|
-
.then(buildVideoResponse)
|
|
57
|
-
.then(renderVideo)
|
|
58
|
-
.result();
|
|
59
|
-
if (!video.ok) {
|
|
60
|
-
console.error('Video failed!');
|
|
61
|
-
throw video.error;
|
|
62
|
-
}
|
|
63
|
-
document.querySelector('.video-container')?.appendChild(video.value);
|
|
64
|
-
/* Dynamic Zones */
|
|
65
|
-
// const dynamicZone = GetValueOrThrow(await getDynamicZone('my-zone'));
|
|
66
|
-
// const dynamicZoneRequest = GetValueOrThrow(buildDynamicZoneRequest('my-zone', dynamicZone));
|
|
67
|
-
// const dynamicResponse = GetValueOrThrow(await buildDynamicResponse(dynamicZoneRequest));
|
|
68
|
-
// const htmlElement = buildDynamicCreative(dynamicResponse);
|
|
69
|
-
// const htmlElement = await getDynamicCreative('my-zone');
|
|
70
|
-
// console.log(dynamicResponse);
|
|
71
|
-
})();
|
|
72
|
-
//# sourceMappingURL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