@schibsted/sps-sdk 5.2.0-CBT-20903.3 → 5.2.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.
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderPosterInIframe = void 0;
4
- const resetDocumentSpacing = (doc) => {
5
- [doc.documentElement, doc.body].forEach((el) => {
6
- el.style.margin = "0";
7
- el.style.padding = "0";
8
- el.style.overflow = "hidden";
9
- });
10
- };
11
- const navigateTopOnLinkClick = (doc) => {
12
- doc.addEventListener("click", (event) => {
13
- const anchor = event.target?.closest("a");
14
- if (!anchor?.href) {
15
- return;
16
- }
17
- event.preventDefault();
18
- // Delay navigation so click tracking inside the poster has time to fire
19
- setTimeout(() => window.top?.location.assign(anchor.href), 100);
20
- });
21
- };
22
- /**
23
- * Renders poster content in an iframe that replaces the children of `element`.
24
- * The iframe grows to the height of its content, and links navigate the top window.
25
- * Resolves once the iframe has loaded and its first height is applied.
26
- */
27
- const renderPosterInIframe = (element, iframeId, content) => new Promise((resolve) => {
28
- const iframe = document.createElement("iframe");
29
- iframe.id = iframeId;
30
- iframe.style.border = "0";
31
- iframe.style.display = "block";
32
- iframe.style.width = "100%";
33
- iframe.addEventListener("load", () => {
34
- const doc = iframe.contentDocument;
35
- resetDocumentSpacing(doc);
36
- navigateTopOnLinkClick(doc);
37
- const updateHeight = () => {
38
- iframe.style.height = `${doc.body.scrollHeight}px`;
39
- };
40
- updateHeight();
41
- new ResizeObserver(updateHeight).observe(doc.body);
42
- resolve();
43
- }, { once: true });
44
- iframe.srcdoc = content;
45
- element.replaceChildren(iframe);
46
- });
47
- exports.renderPosterInIframe = renderPosterInIframe;
48
- //# sourceMappingURL=iframe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iframe.js","sourceRoot":"","sources":["../../../src/actions/iframe.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG,CAAC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AM,CAAC;IAC5B,MAAM,CAAC,gBAAgB,CACrB,MAAM,EACN,GAAG,EAAE;QACH,MAAM,GAAG,GAAG,MAAM,CAAC,eAAgB,CAAC;QACpC,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC1B,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAE5B,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC;QACrD,CAAC,CAAC;QACF,YAAY,EAAE,CAAC;QACf,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,EAAE,CAAC;IACZ,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACF,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC;IACxB,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AA7BQ,QAAA,oBAAoB,wBA6B5B"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Renders poster content in an iframe that replaces the children of `element`.
3
- * The iframe grows to the height of its content, and links navigate the top window.
4
- * Resolves once the iframe has loaded and its first height is applied.
5
- */
6
- export declare const renderPosterInIframe: (element: HTMLElement, iframeId: string, content: string) => Promise<void>;
@@ -1,44 +0,0 @@
1
- const resetDocumentSpacing = (doc) => {
2
- [doc.documentElement, doc.body].forEach((el) => {
3
- el.style.margin = "0";
4
- el.style.padding = "0";
5
- el.style.overflow = "hidden";
6
- });
7
- };
8
- const navigateTopOnLinkClick = (doc) => {
9
- doc.addEventListener("click", (event) => {
10
- const anchor = event.target?.closest("a");
11
- if (!anchor?.href) {
12
- return;
13
- }
14
- event.preventDefault();
15
- // Delay navigation so click tracking inside the poster has time to fire
16
- setTimeout(() => window.top?.location.assign(anchor.href), 100);
17
- });
18
- };
19
- /**
20
- * Renders poster content in an iframe that replaces the children of `element`.
21
- * The iframe grows to the height of its content, and links navigate the top window.
22
- * Resolves once the iframe has loaded and its first height is applied.
23
- */
24
- export const renderPosterInIframe = (element, iframeId, content) => new Promise((resolve) => {
25
- const iframe = document.createElement("iframe");
26
- iframe.id = iframeId;
27
- iframe.style.border = "0";
28
- iframe.style.display = "block";
29
- iframe.style.width = "100%";
30
- iframe.addEventListener("load", () => {
31
- const doc = iframe.contentDocument;
32
- resetDocumentSpacing(doc);
33
- navigateTopOnLinkClick(doc);
34
- const updateHeight = () => {
35
- iframe.style.height = `${doc.body.scrollHeight}px`;
36
- };
37
- updateHeight();
38
- new ResizeObserver(updateHeight).observe(doc.body);
39
- resolve();
40
- }, { once: true });
41
- iframe.srcdoc = content;
42
- element.replaceChildren(iframe);
43
- });
44
- //# sourceMappingURL=iframe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iframe.js","sourceRoot":"","sources":["../../../src/actions/iframe.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAAG,CAAC,GAAa,EAAQ,EAAE;IACnD,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QAC7C,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;QACtB,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;QACvB,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,GAAa,EAAQ,EAAE;IACrD,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACtC,MAAM,MAAM,GAAI,KAAK,CAAC,MAAyB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YAClB,OAAO;QACT,CAAC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