@surfside/ads-react 0.1.16 → 0.1.18
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/BuildInfo.js +1 -1
- package/lib/cjs/BuildInfo.js.map +1 -1
- package/lib/cjs/components/SurfsideBanner.js +46 -0
- package/lib/cjs/components/SurfsideBanner.js.map +1 -0
- package/lib/cjs/components/SurfsideBannerRenderer.js +45 -0
- package/lib/cjs/components/SurfsideBannerRenderer.js.map +1 -0
- package/lib/cjs/components/SurfsideBannerVideoRenderer.js +25 -0
- package/lib/cjs/components/SurfsideBannerVideoRenderer.js.map +1 -0
- package/lib/cjs/components/SurfsideCarousel.js +116 -0
- package/lib/cjs/components/SurfsideCarousel.js.map +1 -0
- package/lib/cjs/components/SurfsideDynamicZone.js +141 -0
- package/lib/cjs/components/SurfsideDynamicZone.js.map +1 -0
- package/lib/cjs/components/SurfsideProduct.js +118 -0
- package/lib/cjs/components/SurfsideProduct.js.map +1 -0
- package/lib/cjs/components/SurfsideVideo.js +84 -0
- package/lib/cjs/components/SurfsideVideo.js.map +1 -0
- package/lib/cjs/components/SurfsideVideoRenderer.js +42 -0
- package/lib/cjs/components/SurfsideVideoRenderer.js.map +1 -0
- package/lib/cjs/components/index.js +23 -0
- package/lib/cjs/components/index.js.map +1 -0
- package/lib/cjs/hooks/index.js +20 -0
- package/lib/cjs/hooks/index.js.map +1 -0
- package/lib/cjs/hooks/useSurfsideBanner.js +215 -0
- package/lib/cjs/hooks/useSurfsideBanner.js.map +1 -0
- package/lib/cjs/hooks/useSurfsideDynamicZone.js +283 -0
- package/lib/cjs/hooks/useSurfsideDynamicZone.js.map +1 -0
- package/lib/cjs/hooks/useSurfsideProducts.js +445 -0
- package/lib/cjs/hooks/useSurfsideProducts.js.map +1 -0
- package/lib/cjs/hooks/useSurfsideVideo.js +299 -0
- package/lib/cjs/hooks/useSurfsideVideo.js.map +1 -0
- package/lib/cjs/index.js +71 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/provider/SurfsideContextProvider.js +175 -0
- package/lib/cjs/provider/SurfsideContextProvider.js.map +1 -0
- package/lib/cjs/provider/index.js +9 -0
- package/lib/cjs/provider/index.js.map +1 -0
- package/lib/cjs/utils/Analytics.js +181 -0
- package/lib/cjs/utils/Analytics.js.map +1 -0
- package/lib/cjs/utils/index.js +12 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/esm/BuildInfo.js +1 -1
- package/lib/esm/BuildInfo.js.map +1 -1
- package/lib/esm/components/SurfsideDynamicZone.js +9 -1
- package/lib/esm/components/SurfsideDynamicZone.js.map +1 -1
- package/lib/esm/hooks/useSurfsideProducts.js +17 -6
- package/lib/esm/hooks/useSurfsideProducts.js.map +1 -1
- package/lib/esm/provider/SurfsideContextProvider.js +18 -2
- package/lib/esm/provider/SurfsideContextProvider.js.map +1 -1
- package/lib/types/components/SurfsideDynamicZone.d.ts +1 -1
- package/package.json +3 -3
package/lib/cjs/BuildInfo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SurfsideAdReactVersionInfo = void 0;
|
|
4
|
-
exports.SurfsideAdReactVersionInfo = { buildBranch: '
|
|
4
|
+
exports.SurfsideAdReactVersionInfo = { buildBranch: 'hotfix-0.1.18', buildHash: '9364f0d', buildVer: '0.1.18' };
|
|
5
5
|
//# sourceMappingURL=BuildInfo.js.map
|
package/lib/cjs/BuildInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildInfo.js","sourceRoot":"src/","sources":["BuildInfo.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"BuildInfo.js","sourceRoot":"src/","sources":["BuildInfo.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SurfsideBanner = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const hooks_1 = require("../hooks");
|
|
8
|
+
const provider_1 = require("../provider");
|
|
9
|
+
const ads_core_1 = require("@surfside/ads-core");
|
|
10
|
+
const _1 = require(".");
|
|
11
|
+
/**
|
|
12
|
+
* SurfsideBanner renders a banner ad using the `useSurfsideBanner` hook. It automatically
|
|
13
|
+
* manages banner fetching, win tracking, and optional UI fallback states.
|
|
14
|
+
*
|
|
15
|
+
* Customize the banner lifecycle using callbacks and optionally inject custom styles
|
|
16
|
+
* or loading/error content.
|
|
17
|
+
*
|
|
18
|
+
* @param {ISurfsideBannerProps} props Props used to configure the banner rendering behavior
|
|
19
|
+
* @returns A responsive ad container that manages display and state transitions
|
|
20
|
+
*/
|
|
21
|
+
exports.SurfsideBanner = (0, react_1.memo)(({ zoneId, size, enabled = true, category, renderLoading, renderError, onRender, onWin, onError, }) => {
|
|
22
|
+
const { banner, loading, error } = (0, hooks_1.useSurfsideBanner)({
|
|
23
|
+
zoneId,
|
|
24
|
+
size,
|
|
25
|
+
enabled,
|
|
26
|
+
category,
|
|
27
|
+
});
|
|
28
|
+
const { logger } = (0, provider_1.useSurfsideContext)();
|
|
29
|
+
const log = (0, ads_core_1.Ctx)(logger)?.with('SurfsideBanner');
|
|
30
|
+
// call user callback
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
if (banner !== undefined) {
|
|
33
|
+
log?.info('SurfsideBanner: win tracked', banner.id);
|
|
34
|
+
onWin?.(banner.id);
|
|
35
|
+
}
|
|
36
|
+
}, [banner]);
|
|
37
|
+
// Handle error callback
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
if (error !== undefined) {
|
|
40
|
+
log?.error('SurfsideBanner: error', error);
|
|
41
|
+
onError?.(error);
|
|
42
|
+
}
|
|
43
|
+
}, [error]);
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [loading && renderLoading?.(), error !== undefined && renderError?.(), banner !== undefined && ((0, jsx_runtime_1.jsx)(_1.SurfsideBannerRenderer, { banner: banner, onRender: onRender }))] }));
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=SurfsideBanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideBanner.js","sourceRoot":"src/","sources":["components/SurfsideBanner.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,iCAA+C;AAC/C,oCAA6C;AAC7C,0CAAiD;AACjD,iDAAyD;AACzD,wBAA2C;AAoE3C;;;;;;;;;GASG;AACU,QAAA,cAAc,GAAmC,IAAA,YAAI,EAAC,CAAC,EAChE,MAAM,EACN,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,QAAQ,EACR,aAAa,EACb,WAAW,EACX,QAAQ,EACR,KAAK,EACL,OAAO,GACV,EAAE,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,IAAA,yBAAiB,EAAC;QACjD,MAAM;QACN,IAAI;QACJ,OAAO;QACP,QAAQ;KACX,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,6BAAkB,GAAE,CAAC;IACxC,MAAM,GAAG,GAAG,IAAA,cAAG,EAAC,MAAM,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAEhD,qBAAqB;IACrB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,GAAG,EAAE,IAAI,CAAC,6BAA6B,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YACpD,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,wBAAwB;IACxB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,GAAG,EAAE,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;YAC3C,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACH,4CACK,OAAO,IAAI,aAAa,EAAE,EAAE,EAE5B,KAAK,KAAK,SAAS,IAAI,WAAW,EAAE,EAAE,EAEtC,MAAM,KAAK,SAAS,IAAI,CACrB,uBAAC,yBAAsB,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAI,CACjE,IACC,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SurfsideBannerRenderer = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const ads_core_client_1 = require("@surfside/ads-core-client");
|
|
8
|
+
const provider_1 = require("../provider");
|
|
9
|
+
/**
|
|
10
|
+
* SurfsideBannerRenderer renders a pre-fetched IBanner using internal RenderBanner logic.
|
|
11
|
+
* It handles win tracking, DOM injection, and lifecycle callbacks, but does not perform any banner fetching.
|
|
12
|
+
*
|
|
13
|
+
* Use this component if you already have an IBanner and want to render it directly.
|
|
14
|
+
*
|
|
15
|
+
* @param {ISurfsideBannerRendererProps} props Props used to configure the rendering behavior
|
|
16
|
+
* @returns A responsive ad container rendering the given banner
|
|
17
|
+
*/
|
|
18
|
+
const SurfsideBannerRenderer = ({ banner, onRender, onError, }) => {
|
|
19
|
+
// const [renderedBanner, setRenderedBanner] = useState<HTMLElement | undefined>();
|
|
20
|
+
const { logger, renderBanner, error: apiError } = (0, provider_1.useSurfsideContext)();
|
|
21
|
+
const log = (0, ads_core_client_1.Ctx)(logger)?.with('SurfsideBanner');
|
|
22
|
+
const ref = (0, react_1.useRef)(null);
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
const container = ref.current;
|
|
25
|
+
if (container === null || renderBanner === undefined) {
|
|
26
|
+
if (apiError !== undefined) {
|
|
27
|
+
onError?.(apiError);
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const result = renderBanner(banner);
|
|
32
|
+
if (!result.ok) {
|
|
33
|
+
log?.error('Banner render error', result.error);
|
|
34
|
+
onError?.(result);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
container.innerHTML = '';
|
|
38
|
+
container.appendChild(result.value);
|
|
39
|
+
log?.info('Banner rendered');
|
|
40
|
+
onRender?.(banner.id);
|
|
41
|
+
}, [banner, renderBanner, apiError]);
|
|
42
|
+
return (0, jsx_runtime_1.jsx)("div", { ref: ref });
|
|
43
|
+
};
|
|
44
|
+
exports.SurfsideBannerRenderer = SurfsideBannerRenderer;
|
|
45
|
+
//# sourceMappingURL=SurfsideBannerRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideBannerRenderer.js","sourceRoot":"src/","sources":["components/SurfsideBannerRenderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,iCAAiD;AACjD,+DAAgE;AAChE,0CAAiD;AAgCjD;;;;;;;;GAQG;AACI,MAAM,sBAAsB,GAA2C,CAAC,EAC3E,MAAM,EACN,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,mFAAmF;IACnF,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE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ideoRenderer = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const SurfsideBannerRenderer_1 = require("./SurfsideBannerRenderer");
|
|
7
|
+
const SurfsideVideoRenderer_1 = require("./SurfsideVideoRenderer");
|
|
8
|
+
/**
|
|
9
|
+
* SurfsideBannerVideoRenderer renders a banner or video ad based on which prop is provided.
|
|
10
|
+
* It assumes the creative has already been fetched and is ready for rendering.
|
|
11
|
+
*
|
|
12
|
+
* @param props A banner or video object with optional lifecycle callbacks
|
|
13
|
+
* @returns A rendered ad element or null if input is invalid
|
|
14
|
+
*/
|
|
15
|
+
const SurfsideBannerVideoRenderer = ({ banner, video, onRender, onError }) => {
|
|
16
|
+
if (banner !== undefined) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(SurfsideBannerRenderer_1.SurfsideBannerRenderer, { banner: banner, onRender: onRender, onError: onError }));
|
|
18
|
+
}
|
|
19
|
+
if (video !== undefined) {
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(SurfsideVideoRenderer_1.SurfsideVideoRenderer, { video: video, onRender: onRender, onError: onError }));
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
exports.SurfsideBannerVideoRenderer = SurfsideBannerVideoRenderer;
|
|
25
|
+
//# sourceMappingURL=SurfsideBannerVideoRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideBannerVideoRenderer.js","sourceRoot":"src/","sources":["components/SurfsideBannerVideoRenderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAKb,qEAAkE;AAClE,mEAAgE;AAuChE;;;;;;GAMG;AACI,MAAM,2BAA2B,GAEpC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IACzC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CACH,uBAAC,+CAAsB,IACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,GAClB,CACL,CAAC;IACN,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,CACH,uBAAC,6CAAqB,IAClB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,GAClB,CACL,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAxBW,QAAA,2BAA2B,+BAwBtC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SurfsideCarousel = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const ads_core_1 = require("@surfside/ads-core");
|
|
7
|
+
const provider_1 = require("../provider");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
;
|
|
10
|
+
const SurfsideCarousel = ({ zoneId, cardMinWidth, carouselLimits, nextType, recommender, requestBuilder, nativeRequestBuilder, enabled = true, strategy, category }) => {
|
|
11
|
+
const { isReady, error: apiError, hasError, startRequest, defaultNative, buildHybridCarousel, buildSponsoredCarousel, buildRecommendedCarousel, renderCarousel, logger } = (0, provider_1.useSurfsideContext)();
|
|
12
|
+
const log = (0, ads_core_1.Ctx)(logger)?.with('SurfsideCarousel');
|
|
13
|
+
const stableCategory = (0, react_1.useMemo)(() => category, [category?.join(',') ?? '']);
|
|
14
|
+
const [error, setError] = (0, react_1.useState)();
|
|
15
|
+
const [renderedCarousel, setRenderedCarousel] = (0, react_1.useState)();
|
|
16
|
+
const ref = (0, react_1.useRef)(null);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
if (!isReady || !enabled) {
|
|
20
|
+
if (hasError) {
|
|
21
|
+
setErrorState(apiError);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
setLoadingState();
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const request = (requestBuilder ?? startRequest(zoneId))
|
|
29
|
+
.withNative((nativeRequestBuilder ?? defaultNative())
|
|
30
|
+
.withMetaBrand(80, false)
|
|
31
|
+
.withMetaProduct(80, false)
|
|
32
|
+
.build()).withSurfCategory(stableCategory ?? []);
|
|
33
|
+
const builtCarousel = (0, ads_core_1.TryDoFlat)(() => {
|
|
34
|
+
switch (strategy) {
|
|
35
|
+
case 'hybrid': {
|
|
36
|
+
return buildHybridCarousel({
|
|
37
|
+
type: recommender,
|
|
38
|
+
}, request.build());
|
|
39
|
+
}
|
|
40
|
+
case 'recommended': {
|
|
41
|
+
return buildRecommendedCarousel({
|
|
42
|
+
type: recommender
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
case 'sponsored': {
|
|
46
|
+
return buildSponsoredCarousel(request.build());
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (!builtCarousel.ok) {
|
|
51
|
+
setErrorState(builtCarousel);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const builtCarouselValue = builtCarousel.value;
|
|
55
|
+
renderCarousel(builtCarouselValue, cardMinWidth, carouselLimits, nextType)
|
|
56
|
+
.then(renderedCarouselResult => {
|
|
57
|
+
if (cancelled) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!renderedCarouselResult.ok) {
|
|
61
|
+
setErrorState(renderedCarouselResult);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
setSuccessState(renderedCarouselResult.value);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return () => void (cancelled = true);
|
|
69
|
+
}, [
|
|
70
|
+
isReady,
|
|
71
|
+
apiError,
|
|
72
|
+
hasError,
|
|
73
|
+
zoneId,
|
|
74
|
+
strategy,
|
|
75
|
+
recommender,
|
|
76
|
+
cardMinWidth,
|
|
77
|
+
carouselLimits,
|
|
78
|
+
nextType,
|
|
79
|
+
stableCategory,
|
|
80
|
+
]);
|
|
81
|
+
(0, react_1.useEffect)(() => {
|
|
82
|
+
if (ref.current === null || renderedCarousel === undefined) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
ref.current.innerHTML = '';
|
|
86
|
+
ref.current.appendChild(renderedCarousel.element);
|
|
87
|
+
renderedCarousel.init()
|
|
88
|
+
.then(initResult => {
|
|
89
|
+
if (!initResult.ok) {
|
|
90
|
+
setErrorState(initResult);
|
|
91
|
+
if (ref.current !== null) {
|
|
92
|
+
log?.error('First page was null');
|
|
93
|
+
ref.current.innerHTML = '';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
;
|
|
98
|
+
}, [renderedCarousel]);
|
|
99
|
+
const setErrorState = (error) => {
|
|
100
|
+
setError(error);
|
|
101
|
+
setRenderedCarousel(undefined);
|
|
102
|
+
};
|
|
103
|
+
const setLoadingState = () => {
|
|
104
|
+
setError(undefined);
|
|
105
|
+
};
|
|
106
|
+
const setSuccessState = (renderedCarousel) => {
|
|
107
|
+
setRenderedCarousel(renderedCarousel);
|
|
108
|
+
setError(undefined);
|
|
109
|
+
};
|
|
110
|
+
if (error !== undefined) {
|
|
111
|
+
log?.error(error.error);
|
|
112
|
+
}
|
|
113
|
+
return (0, jsx_runtime_1.jsx)("div", { ref: ref });
|
|
114
|
+
};
|
|
115
|
+
exports.SurfsideCarousel = SurfsideCarousel;
|
|
116
|
+
//# sourceMappingURL=SurfsideCarousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideCarousel.js","sourceRoot":"src/","sources":["components/SurfsideCarousel.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,iDAM4B;AAE5B,0CAAiD;AACjD,iCAA6D;AAoB5D,CAAC;AAWK,MAAM,gBAAgB,GAAG,CAAC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AC;IAEF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,gCAAK,GAAG,EAAE,GAAG,GAAQ,CAAC;AACjC,CAAC,CAAC;AA7IW,QAAA,gBAAgB,oBA6I3B"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DynamicZoneUnmountedError = exports.SurfsideDynamicZone = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const ads_core_1 = require("@surfside/ads-core");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const provider_1 = require("../provider");
|
|
9
|
+
const SurfsideDynamicZone = ({ zoneId, carousel, enabled = true, category, onError }) => {
|
|
10
|
+
const { isReady: apiIsReady, hasError: apiHasError, error: apiError, getDynamicZone, buildDynamicZoneRequest, buildDynamicResponse, renderBanner, renderVideo, renderCarousel, logger } = (0, provider_1.useSurfsideContext)();
|
|
11
|
+
const log = (0, react_1.useMemo)(() => (0, ads_core_1.Ctx)(logger)?.with('SurfsideDynamicZone'), [logger]);
|
|
12
|
+
log?.info('Rendering SurfsideDynamicZone component');
|
|
13
|
+
const stableCategory = (0, react_1.useMemo)(() => category, [category?.join(',') ?? '']);
|
|
14
|
+
const [error, setError] = (0, react_1.useState)();
|
|
15
|
+
const [dynamicResponse, setDynamicResponse] = (0, react_1.useState)();
|
|
16
|
+
const ref = (0, react_1.useRef)(null);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
if (!apiIsReady || !enabled) {
|
|
20
|
+
if (apiHasError) {
|
|
21
|
+
setErrorState(apiError);
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
(0, ads_core_1.AsyncPipe)(getDynamicZone(zoneId))
|
|
26
|
+
.then(zone => buildDynamicZoneRequest(zoneId, zone, stableCategory ?? []))
|
|
27
|
+
.then(buildDynamicResponse)
|
|
28
|
+
.result()
|
|
29
|
+
.then(dynamicResponse => {
|
|
30
|
+
if (cancelled) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!dynamicResponse.ok) {
|
|
34
|
+
setErrorState(dynamicResponse);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setSuccessState(dynamicResponse.value);
|
|
38
|
+
});
|
|
39
|
+
return () => void (cancelled = true);
|
|
40
|
+
}, [
|
|
41
|
+
apiIsReady,
|
|
42
|
+
apiError,
|
|
43
|
+
apiHasError,
|
|
44
|
+
getDynamicZone,
|
|
45
|
+
buildDynamicZoneRequest,
|
|
46
|
+
buildDynamicResponse,
|
|
47
|
+
log,
|
|
48
|
+
zoneId,
|
|
49
|
+
enabled,
|
|
50
|
+
stableCategory
|
|
51
|
+
]);
|
|
52
|
+
(0, react_1.useEffect)(() => {
|
|
53
|
+
let cancelled = false;
|
|
54
|
+
if (!apiIsReady || !enabled ||
|
|
55
|
+
dynamicResponse === undefined ||
|
|
56
|
+
ref.current === null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
switch (dynamicResponse.type) {
|
|
60
|
+
case 'banner': {
|
|
61
|
+
const bannerResult = renderBanner(dynamicResponse);
|
|
62
|
+
if (!bannerResult.ok) {
|
|
63
|
+
setErrorState(bannerResult);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
ref.current.appendChild(bannerResult.value);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case 'video': {
|
|
70
|
+
const videoResult = renderVideo(dynamicResponse);
|
|
71
|
+
if (!videoResult.ok) {
|
|
72
|
+
setErrorState(videoResult);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
ref.current.appendChild(videoResult.value);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 'carousel': {
|
|
79
|
+
const request = dynamicResponse.dynamicCarouselRequest;
|
|
80
|
+
renderCarousel(dynamicResponse, carousel?.cardMinWidth ?? request.cardMinWidth, carousel?.carouselLimits ?? (request.maxItems !== undefined
|
|
81
|
+
? {
|
|
82
|
+
type: 'limited',
|
|
83
|
+
limit: request.maxItems
|
|
84
|
+
}
|
|
85
|
+
: {
|
|
86
|
+
type: 'infinite'
|
|
87
|
+
}), carousel?.nextType ?? request.nextType).then(carouselResponse => {
|
|
88
|
+
if (cancelled) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!carouselResponse.ok) {
|
|
92
|
+
setErrorState(carouselResponse);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Have to check ref again since we're in a promise.then
|
|
96
|
+
if (ref.current === null) {
|
|
97
|
+
setErrorState((0, ads_core_1.Err)(new DynamicZoneUnmountedError));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
ref.current.appendChild(carouselResponse.value.element);
|
|
101
|
+
carouselResponse.value.init()
|
|
102
|
+
.then(initResult => {
|
|
103
|
+
if (!initResult.ok) {
|
|
104
|
+
setErrorState(initResult);
|
|
105
|
+
if (ref.current !== null) {
|
|
106
|
+
ref.current.innerHTML = '';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return () => {
|
|
114
|
+
cancelled = true;
|
|
115
|
+
if (ref.current !== null) {
|
|
116
|
+
ref.current.innerHTML = '';
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}, [dynamicResponse, renderBanner, renderVideo, renderCarousel, enabled, stableCategory]);
|
|
120
|
+
const setErrorState = (error) => {
|
|
121
|
+
setError(error);
|
|
122
|
+
setDynamicResponse(undefined);
|
|
123
|
+
};
|
|
124
|
+
const setSuccessState = (response) => {
|
|
125
|
+
setError(undefined);
|
|
126
|
+
setDynamicResponse(response);
|
|
127
|
+
};
|
|
128
|
+
if (error !== undefined) {
|
|
129
|
+
log?.error(error.error);
|
|
130
|
+
onError?.(error);
|
|
131
|
+
}
|
|
132
|
+
return (0, jsx_runtime_1.jsx)("div", { ref: ref });
|
|
133
|
+
};
|
|
134
|
+
exports.SurfsideDynamicZone = SurfsideDynamicZone;
|
|
135
|
+
class DynamicZoneUnmountedError extends Error {
|
|
136
|
+
constructor() {
|
|
137
|
+
super('Dynamic zone container unmounted while processing carousel');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.DynamicZoneUnmountedError = DynamicZoneUnmountedError;
|
|
141
|
+
//# sourceMappingURL=SurfsideDynamicZone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideDynamicZone.js","sourceRoot":"src/","sources":["components/SurfsideDynamicZone.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAEb,iDAAyE;AAEzE,iCAA6D;AAC7D,0CAAiD;AAW1C,MAAM,mBAAmB,GAAG,CAAC,EAChC,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,IAAI,EACd,QAAQ,EACR,OAAO,EAC0B,EAAE,EAAE;IACrC,MAAM,EACF,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,WAAW,EACrB,KAAK,EAAE,QAAQ,EAEf,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EAEpB,YAAY,EACZ,WAAW,EACX,cAAc,EAEd,MAAM,EACT,GAAG,IAAA,6BAAkB,GAAE,CAAC;IAEzB,MAAM,GAAG,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,cAAG,EAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,GAAG,EAAE,IAAI,CAAC,yCAAyC,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,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E,EAAE;QACvC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChB,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,CAAC,QAA+B,EAAE,EAAE;QACxD,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpB,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,CAAC;IAEF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,gCAAK,GAAG,EAAE,GAAG,GAAQ,CAAC;AACjC,CAAC,CAAC;AApKW,QAAA,mBAAmB,uBAoK9B;AAEF,MAAa,yBAA0B,SAAQ,KAAK;IAChD;QACI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IACxE,CAAC;CACJ;AAJD,8DAIC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductCardUnmountedError = exports.NoProductsReturnedError = exports.SurfsideProductCard = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ads_core_1 = require("@surfside/ads-core");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const provider_1 = require("../provider");
|
|
8
|
+
;
|
|
9
|
+
;
|
|
10
|
+
exports.SurfsideProductCard = (0, react_1.memo)(({ zoneId, strategy, recommender, requestBuilder, nativeRequestBuilder, enabled, category }) => {
|
|
11
|
+
const { isReady, hasError, error: apiError, startRequest, defaultNative, renderProductCard, buildHybridCarousel, buildSponsoredCarousel, buildRecommendedCarousel, logger } = (0, provider_1.useSurfsideContext)();
|
|
12
|
+
const log = (0, ads_core_1.Ctx)(logger)?.with('SurfsideProductCard');
|
|
13
|
+
const stableCategory = (0, react_1.useMemo)(() => category, [category?.join(',') ?? '']);
|
|
14
|
+
const [error, setError] = (0, react_1.useState)();
|
|
15
|
+
const ref = (0, react_1.useRef)(null);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
log?.info('Getting product card');
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
if (!isReady || enabled === false) {
|
|
20
|
+
log?.info('API not ready');
|
|
21
|
+
if (hasError) {
|
|
22
|
+
setErrorState(apiError);
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const request = (requestBuilder ?? startRequest(zoneId))
|
|
27
|
+
.withNative((nativeRequestBuilder ?? defaultNative())
|
|
28
|
+
.withMetaBrand(80, false)
|
|
29
|
+
.withMetaProduct(80, false)
|
|
30
|
+
.build())
|
|
31
|
+
.withSurfCategory(stableCategory ?? []);
|
|
32
|
+
log?.debug(request);
|
|
33
|
+
const builtCarousel = (0, ads_core_1.TryDoFlat)(() => {
|
|
34
|
+
switch (strategy) {
|
|
35
|
+
case 'hybrid': {
|
|
36
|
+
log?.debug('Using hybrid product card');
|
|
37
|
+
return buildHybridCarousel({
|
|
38
|
+
type: recommender,
|
|
39
|
+
}, request.build());
|
|
40
|
+
}
|
|
41
|
+
case 'recommended': {
|
|
42
|
+
log?.debug('Using hybrid product card');
|
|
43
|
+
return buildRecommendedCarousel({
|
|
44
|
+
type: recommender
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
case 'sponsored': {
|
|
48
|
+
log?.debug('Using sponsored product card');
|
|
49
|
+
return buildSponsoredCarousel(request.build());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
if (!builtCarousel.ok) {
|
|
54
|
+
log?.warn('Product card carousel failed');
|
|
55
|
+
return void (setErrorState(builtCarousel));
|
|
56
|
+
}
|
|
57
|
+
const builtCarouselValue = builtCarousel.value;
|
|
58
|
+
(0, ads_core_1.ConsumeNAsync)(builtCarouselValue.getProduct(), 1)
|
|
59
|
+
.then(([[card]]) => {
|
|
60
|
+
if (cancelled) {
|
|
61
|
+
log?.debug('Cancelled');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
else if (card === undefined) {
|
|
65
|
+
log?.debug('No products returned by carousel');
|
|
66
|
+
return void (setErrorState((0, ads_core_1.Err)(new NoProductsReturnedError)));
|
|
67
|
+
}
|
|
68
|
+
else if (ref.current === null) {
|
|
69
|
+
log?.debug('Product card unmounted');
|
|
70
|
+
return void (setErrorState((0, ads_core_1.Err)(new ProductCardUnmountedError)));
|
|
71
|
+
}
|
|
72
|
+
log?.debug('Rendering product card');
|
|
73
|
+
const productCard = renderProductCard(card);
|
|
74
|
+
if (!productCard.ok) {
|
|
75
|
+
log?.debug('Product card failed to render');
|
|
76
|
+
return void (setErrorState(productCard));
|
|
77
|
+
}
|
|
78
|
+
log?.debug('Product card successfully rendered');
|
|
79
|
+
ref.current.innerHTML = '';
|
|
80
|
+
ref.current.appendChild(productCard.value);
|
|
81
|
+
});
|
|
82
|
+
return () => void (cancelled = true);
|
|
83
|
+
}, [
|
|
84
|
+
isReady,
|
|
85
|
+
hasError,
|
|
86
|
+
enabled,
|
|
87
|
+
requestBuilder,
|
|
88
|
+
startRequest,
|
|
89
|
+
nativeRequestBuilder,
|
|
90
|
+
defaultNative,
|
|
91
|
+
buildHybridCarousel,
|
|
92
|
+
buildSponsoredCarousel,
|
|
93
|
+
buildRecommendedCarousel,
|
|
94
|
+
renderProductCard,
|
|
95
|
+
stableCategory,
|
|
96
|
+
zoneId
|
|
97
|
+
]);
|
|
98
|
+
(0, react_1.useEffect)(() => {
|
|
99
|
+
if (error !== undefined) {
|
|
100
|
+
log?.error(error);
|
|
101
|
+
}
|
|
102
|
+
}, [error]);
|
|
103
|
+
const setErrorState = setError;
|
|
104
|
+
return (0, jsx_runtime_1.jsx)("div", { ref: ref });
|
|
105
|
+
});
|
|
106
|
+
class NoProductsReturnedError extends Error {
|
|
107
|
+
constructor() {
|
|
108
|
+
super('No product cards returned from recommender');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.NoProductsReturnedError = NoProductsReturnedError;
|
|
112
|
+
class ProductCardUnmountedError extends Error {
|
|
113
|
+
constructor() {
|
|
114
|
+
super('Product card unmounted while rendering');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.ProductCardUnmountedError = ProductCardUnmountedError;
|
|
118
|
+
//# sourceMappingURL=SurfsideProduct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideProduct.js","sourceRoot":"src/","sources":["components/SurfsideProduct.tsx"],"names":[],"mappings":";;;;AAAA,iDAQ4B;AAC5B,iCAAmE;AACnE,0CAAiD;AAQhD,CAAC;AAKD,CAAC;AAYW,QAAA,mBAAmB,GAAG,IAAA,YAAI,EAAC,CAAC,EACrC,MAAM,EACN,QAAQ,EACR,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,OAAO,EACP,QAAQ,EACe,EAAE,EAAE;IAE3B,MAAM,EACF,OAAO,EACP,QAAQ,EACR,KAAK,EAAE,QAAQ,EACf,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,MAAM,EACT,GAAG,IAAA,6BAAkB,GAAE,CAAC;IAEzB,MAAM,GAAG,GAAG,IAAA,cAAG,EAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAE5E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,GAAa,CAAC;IAChD,MAAM,GAAG,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAEzC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,GAA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AE,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACjD,GAAG,CAAC,OAAO,CAAC,SAAS,GAAG,EAAE,CAAC;YAC3B,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEP,OAAO,GAAG,EAAE,CAAC,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC,EAAE;QACC,OAAO;QACP,QAAQ;QACR,OAAO;QACP,cAAc;QACd,YAAY;QACZ,oBAAoB;QACpB,aAAa;QACb,mBAAmB;QACnB,sBAAsB;QACtB,wBAAwB;QACxB,iBAAiB;QACjB,cAAc;QACd,MAAM;KACT,CAAC,CAAC;IAEH,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,aAAa,GAAG,QAAQ,CAAC;IAE/B,OAAO,gCAAK,GAAG,EAAE,GAAG,GAAQ,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,MAAa,uBAAwB,SAAQ,KAAK;IAC9C;QACI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACxD,CAAC;CACJ;AAJD,0DAIC;AAED,MAAa,yBAA0B,SAAQ,KAAK;IAChD;QACI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACpD,CAAC;CACJ;AAJD,8DAIC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SurfsideVideo = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const SurfsideContextProvider_1 = require("../provider/SurfsideContextProvider");
|
|
8
|
+
const ads_core_client_1 = require("@surfside/ads-core-client");
|
|
9
|
+
/**
|
|
10
|
+
* SurfsideVideo renders a video ad using the `useSurfsideVideo` hook. It automatically
|
|
11
|
+
* manages video fetching, win tracking, and optional UI fallback states.
|
|
12
|
+
*
|
|
13
|
+
* Customize the video lifecycle using callbacks and optionally inject custom styles
|
|
14
|
+
* or loading/error content.
|
|
15
|
+
*
|
|
16
|
+
* @param {ISurfsideVideoProps} props Props used to configure the video rendering behavior
|
|
17
|
+
* @returns A responsive ad container that manages display and state transitions
|
|
18
|
+
*/
|
|
19
|
+
exports.SurfsideVideo = (0, react_1.memo)(({ zoneId, size, category, minDuration = 0, maxDuration, mimes, enabled = true, requestBuilder, onError }) => {
|
|
20
|
+
const { isReady: apiIsReady, error: apiError, hasError: apiHasError, startRequest, requestBids, buildVideoResponse, renderVideo, logger } = (0, SurfsideContextProvider_1.useSurfsideContext)();
|
|
21
|
+
const log = (0, react_1.useMemo)(() => (0, ads_core_client_1.Ctx)(logger)?.with('SurfsideVideo'), [logger]);
|
|
22
|
+
const stableCategory = (0, react_1.useMemo)(() => category, [category?.join(',') ?? '']);
|
|
23
|
+
const [error, setError] = (0, react_1.useState)();
|
|
24
|
+
const ref = (0, react_1.useRef)(null);
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
log?.info('Requesting video');
|
|
27
|
+
let cancelled = false;
|
|
28
|
+
if (!enabled || !apiIsReady) {
|
|
29
|
+
if (apiHasError) {
|
|
30
|
+
log?.info('Surfside provider failed to initialize');
|
|
31
|
+
return setError(apiError);
|
|
32
|
+
}
|
|
33
|
+
log?.info('Not ready yet');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const request = (requestBuilder ?? startRequest(zoneId))
|
|
37
|
+
.withSurfCategory(stableCategory ?? [])
|
|
38
|
+
.withVideo(size[0], size[1], minDuration, maxDuration, mimes)
|
|
39
|
+
.build();
|
|
40
|
+
log?.debug('request', request);
|
|
41
|
+
(0, ads_core_client_1.AsyncPipe)(requestBids(request))
|
|
42
|
+
.then(response => (0, ads_core_client_1.WrapValue)(response.seatbid?.[0]?.bid?.[0]))
|
|
43
|
+
.then(buildVideoResponse)
|
|
44
|
+
.then(renderVideo)
|
|
45
|
+
.result()
|
|
46
|
+
.then(video => {
|
|
47
|
+
log?.debug('Got video response', video);
|
|
48
|
+
if (cancelled) {
|
|
49
|
+
log?.info('Cancelled');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!video.ok) {
|
|
53
|
+
log?.debug('Got error');
|
|
54
|
+
return setError(video);
|
|
55
|
+
}
|
|
56
|
+
log?.info('Successful response. Appending video player');
|
|
57
|
+
ref.current.appendChild(video.value);
|
|
58
|
+
});
|
|
59
|
+
return () => void (cancelled = true);
|
|
60
|
+
}, [
|
|
61
|
+
apiIsReady,
|
|
62
|
+
apiError,
|
|
63
|
+
apiHasError,
|
|
64
|
+
zoneId,
|
|
65
|
+
size,
|
|
66
|
+
minDuration,
|
|
67
|
+
maxDuration,
|
|
68
|
+
mimes,
|
|
69
|
+
enabled,
|
|
70
|
+
size[0],
|
|
71
|
+
size[1],
|
|
72
|
+
requestBuilder,
|
|
73
|
+
startRequest,
|
|
74
|
+
stableCategory
|
|
75
|
+
]);
|
|
76
|
+
(0, react_1.useEffect)(() => {
|
|
77
|
+
if (error !== undefined) {
|
|
78
|
+
log?.error(error.error);
|
|
79
|
+
onError?.(error);
|
|
80
|
+
}
|
|
81
|
+
}, [error]);
|
|
82
|
+
return (0, jsx_runtime_1.jsx)("div", { ref: ref });
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=SurfsideVideo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SurfsideVideo.js","sourceRoot":"src/","sources":["components/SurfsideVideo.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;AAGb,iCAAmE;AACnE,iFAAyE;AACzE,+DAMmC;AA0EnC;;;;;;;;;GASG;AACU,QA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