@comet/site-react 9.0.0-beta.2 → 9.0.0-beta.4
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/blockLoader/blockLoader.d.ts.map +1 -1
- package/lib/blockLoader/blockLoader.js +1 -55
- package/lib/blocks/DamFileDownloadLinkBlock.d.ts.map +1 -1
- package/lib/blocks/DamFileDownloadLinkBlock.js +1 -27
- package/lib/blocks/DamVideoBlock.d.ts.map +1 -1
- package/lib/blocks/DamVideoBlock.js +5 -99
- package/lib/blocks/DamVideoBlock.module.scss.js +1 -14
- package/lib/blocks/EmailLinkBlock.d.ts.map +1 -1
- package/lib/blocks/EmailLinkBlock.js +1 -21
- package/lib/blocks/ExternalLinkBlock.d.ts.map +1 -1
- package/lib/blocks/ExternalLinkBlock.js +1 -47
- package/lib/blocks/PhoneLinkBlock.d.ts.map +1 -1
- package/lib/blocks/PhoneLinkBlock.js +1 -21
- package/lib/blocks/SvgImageBlock.d.ts.map +1 -1
- package/lib/blocks/SvgImageBlock.js +1 -28
- package/lib/blocks/VimeoVideoBlock.d.ts.map +1 -1
- package/lib/blocks/VimeoVideoBlock.js +4 -119
- package/lib/blocks/VimeoVideoBlock.module.scss.js +1 -14
- package/lib/blocks/YouTubeVideoBlock.d.ts.map +1 -1
- package/lib/blocks/YouTubeVideoBlock.js +4 -126
- package/lib/blocks/YouTubeVideoBlock.module.scss.js +1 -14
- package/lib/blocks/factories/BlocksBlock.d.ts.map +1 -1
- package/lib/blocks/factories/BlocksBlock.js +1 -27
- package/lib/blocks/factories/ListBlock.js +1 -13
- package/lib/blocks/factories/OneOfBlock.d.ts.map +1 -1
- package/lib/blocks/factories/OneOfBlock.js +1 -23
- package/lib/blocks/factories/OptionalBlock.d.ts.map +1 -1
- package/lib/blocks/factories/OptionalBlock.js +1 -10
- package/lib/blocks/factories/types.d.ts.map +1 -1
- package/lib/blocks/helpers/PlayPauseButton.js +1 -9
- package/lib/blocks/helpers/PlayPauseButton.module.scss.js +1 -14
- package/lib/blocks/helpers/RichTextBlockHelper.d.ts.map +1 -1
- package/lib/blocks/helpers/RichTextBlockHelper.js +1 -7
- package/lib/blocks/helpers/TipTapRichTextRenderer.d.ts +35 -0
- package/lib/blocks/helpers/TipTapRichTextRenderer.d.ts.map +1 -0
- package/lib/blocks/helpers/TipTapRichTextRenderer.js +3 -0
- package/lib/blocks/helpers/VideoPreviewImage.d.ts.map +1 -1
- package/lib/blocks/helpers/VideoPreviewImage.js +2 -23
- package/lib/blocks/helpers/VideoPreviewImage.module.scss.js +1 -17
- package/lib/blocks/helpers/useIsElementInViewport.d.ts.map +1 -1
- package/lib/blocks/helpers/useIsElementInViewport.js +1 -19
- package/lib/cookies/CookieApiContext.js +2 -18
- package/lib/cookies/CookieSafe.d.ts.map +1 -1
- package/lib/cookies/CookieSafe.js +2 -18
- package/lib/cookies/useCookieBotCookieApi.d.ts.map +1 -1
- package/lib/cookies/useCookieBotCookieApi.js +1 -33
- package/lib/cookies/useLocalStorageCookieApi.d.ts.map +1 -1
- package/lib/cookies/useLocalStorageCookieApi.js +1 -40
- package/lib/cookies/useOneTrustCookieApi.d.ts.map +1 -1
- package/lib/cookies/useOneTrustCookieApi.js +1 -48
- package/lib/errorHandler/ErrorHandlerBoundary.d.ts.map +1 -1
- package/lib/errorHandler/ErrorHandlerBoundary.js +2 -10
- package/lib/errorHandler/ErrorHandlerBoundaryInternal.js +1 -26
- package/lib/errorHandler/ErrorHandlerProvider.js +2 -20
- package/lib/graphQLFetch/fetchInMemoryCache.js +1 -37
- package/lib/graphQLFetch/graphQLFetch.js +1 -125
- package/lib/iframebridge/IFrameBridge.js +4 -253
- package/lib/iframebridge/IFrameBridge.module.scss.js +1 -8
- package/lib/iframebridge/IFrameMessage.d.ts.map +1 -1
- package/lib/iframebridge/IFrameMessage.js +1 -21
- package/lib/iframebridge/Preview.js +1 -56
- package/lib/iframebridge/Preview.module.scss.js +1 -8
- package/lib/iframebridge/PreviewOverlay.d.ts.map +1 -1
- package/lib/iframebridge/PreviewOverlay.js +1 -26
- package/lib/iframebridge/PreviewOverlay.module.scss.js +1 -8
- package/lib/iframebridge/PreviewOverlayElement.d.ts.map +1 -1
- package/lib/iframebridge/PreviewOverlayElement.js +2 -36
- package/lib/iframebridge/PreviewOverlayElement.module.scss.js +1 -20
- package/lib/iframebridge/useBlockPreviewFetch.js +1 -29
- package/lib/iframebridge/useIFrameBridge.js +1 -8
- package/lib/iframebridge/utils.d.ts.map +1 -1
- package/lib/iframebridge/utils.js +1 -44
- package/lib/iframebridge/withPreview.js +1 -33
- package/lib/image/Image.d.ts.map +1 -1
- package/lib/image/Image.js +2 -10
- package/lib/image/image.utils.d.ts.map +1 -1
- package/lib/image/image.utils.js +1 -51
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -96
- package/lib/jsonLd/JsonLd.d.ts +7 -0
- package/lib/jsonLd/JsonLd.d.ts.map +1 -0
- package/lib/jsonLd/JsonLd.js +1 -0
- package/lib/persistedQueries/createPersistedQueryGraphQLFetch.d.ts.map +1 -1
- package/lib/persistedQueries/createPersistedQueryGraphQLFetch.js +1 -68
- package/lib/persistedQueries/persistedQueryRoute.js +1 -100
- package/lib/persistedQueries/webpackPersistedQueriesLoader.js +1 -51
- package/lib/preview/BlockPreviewProvider.d.ts.map +1 -1
- package/lib/preview/BlockPreviewProvider.js +1 -32
- package/lib/preview/PreviewContext.js +1 -9
- package/lib/preview/usePreview.js +1 -41
- package/lib/previewskeleton/PreviewSkeleton.d.ts.map +1 -1
- package/lib/previewskeleton/PreviewSkeleton.js +8 -64
- package/lib/previewskeleton/PreviewSkeleton.module.scss.js +1 -17
- package/lib/server.d.ts +2 -0
- package/lib/server.d.ts.map +1 -0
- package/lib/server.js +1 -0
- package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.d.ts.map +1 -1
- package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.js +1 -8
- package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.d.ts.map +1 -1
- package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.js +1 -6
- package/lib/style.css +1 -1
- package/package.json +16 -9
|
@@ -1,127 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { PreviewSkeleton } from "../previewskeleton/PreviewSkeleton.js";
|
|
7
|
-
import { PlayPauseButton } from "./helpers/PlayPauseButton.js";
|
|
8
|
-
import { useIsElementInViewport } from "./helpers/useIsElementInViewport.js";
|
|
9
|
-
import styles from "./YouTubeVideoBlock.module.scss.js";
|
|
10
|
-
const EXPECTED_YT_ID_LENGTH = 11;
|
|
11
|
-
const parseYoutubeIdentifier = (value) => {
|
|
12
|
-
const regExp = /(https?:\/\/)?(((m|www)\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)([_0-9a-zA-Z-]+)/;
|
|
13
|
-
const match = value.match(regExp);
|
|
14
|
-
const youtubeId = value.length === EXPECTED_YT_ID_LENGTH ? value : match && match[8].length === EXPECTED_YT_ID_LENGTH ? match[8] : null;
|
|
15
|
-
return youtubeId ?? void 0;
|
|
16
|
-
};
|
|
17
|
-
const YouTubeVideoBlock = withPreview(
|
|
18
|
-
({
|
|
19
|
-
data: { youtubeIdentifier, autoplay, loop, showControls, previewImage },
|
|
20
|
-
aspectRatio = "16x9",
|
|
21
|
-
previewImageSizes,
|
|
22
|
-
renderPreviewImage,
|
|
23
|
-
fill,
|
|
24
|
-
previewImageIcon,
|
|
25
|
-
playButtonAriaLabel,
|
|
26
|
-
pauseButtonAriaLabel,
|
|
27
|
-
playPauseButton: PlayPauseButtonComponent
|
|
28
|
-
}) => {
|
|
29
|
-
const [showPreviewImage, setShowPreviewImage] = useState(true);
|
|
30
|
-
const [isPlaying, setIsPlaying] = useState(autoplay ?? false);
|
|
31
|
-
const [isHandledManually, setIsHandledManually] = useState(false);
|
|
32
|
-
const hasPreviewImage = !!(previewImage && previewImage.damFile);
|
|
33
|
-
const [iframeElement, setIframeElement] = useState(null);
|
|
34
|
-
const iframeRef = setIframeElement;
|
|
35
|
-
const inViewRef = useRef(null);
|
|
36
|
-
const pauseYouTubeVideo = useCallback(() => {
|
|
37
|
-
var _a;
|
|
38
|
-
(_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(`{"event":"command","func":"pauseVideo","args":""}`, "https://www.youtube-nocookie.com");
|
|
39
|
-
}, [iframeElement]);
|
|
40
|
-
const playYouTubeVideo = useCallback(() => {
|
|
41
|
-
var _a;
|
|
42
|
-
(_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(`{"event":"command","func":"playVideo","args":""}`, "https://www.youtube-nocookie.com");
|
|
43
|
-
}, [iframeElement]);
|
|
44
|
-
const handleInView = useCallback(
|
|
45
|
-
(inView) => {
|
|
46
|
-
if (!isHandledManually) {
|
|
47
|
-
if (inView && autoplay) {
|
|
48
|
-
playYouTubeVideo();
|
|
49
|
-
setIsPlaying(true);
|
|
50
|
-
} else {
|
|
51
|
-
pauseYouTubeVideo();
|
|
52
|
-
setIsPlaying(false);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
[autoplay, isHandledManually, playYouTubeVideo, pauseYouTubeVideo]
|
|
57
|
-
);
|
|
58
|
-
useIsElementInViewport(inViewRef, handleInView);
|
|
59
|
-
if (!youtubeIdentifier) {
|
|
60
|
-
return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
|
|
61
|
-
}
|
|
62
|
-
const identifier = parseYoutubeIdentifier(youtubeIdentifier);
|
|
63
|
-
const searchParams = new URLSearchParams();
|
|
64
|
-
searchParams.append("modestbranding", "1");
|
|
65
|
-
searchParams.append("rel", "0");
|
|
66
|
-
searchParams.append("enablejsapi", "1");
|
|
67
|
-
if (hasPreviewImage && !showPreviewImage) searchParams.append("autoplay", "1");
|
|
68
|
-
if (autoplay) searchParams.append("mute", "1");
|
|
69
|
-
if (showControls !== void 0) searchParams.append("controls", Number(showControls).toString());
|
|
70
|
-
if (loop !== void 0) searchParams.append("loop", Number(loop).toString());
|
|
71
|
-
if (loop && identifier) searchParams.append("playlist", identifier);
|
|
72
|
-
const youtubeBaseUrl = "https://www.youtube-nocookie.com/embed/";
|
|
73
|
-
const youtubeUrl = new URL(`${youtubeBaseUrl}${identifier ?? ""}`);
|
|
74
|
-
youtubeUrl.search = searchParams.toString();
|
|
75
|
-
const handlePlayPauseClick = () => {
|
|
76
|
-
if (isPlaying) {
|
|
77
|
-
setIsPlaying(false);
|
|
78
|
-
setIsHandledManually(true);
|
|
79
|
-
pauseYouTubeVideo();
|
|
80
|
-
} else {
|
|
81
|
-
setIsPlaying(true);
|
|
82
|
-
playYouTubeVideo();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage({
|
|
86
|
-
onPlay: () => setShowPreviewImage(false),
|
|
87
|
-
image: previewImage,
|
|
88
|
-
aspectRatio,
|
|
89
|
-
sizes: previewImageSizes,
|
|
90
|
-
fill,
|
|
91
|
-
icon: previewImageIcon,
|
|
92
|
-
playButtonAriaLabel
|
|
93
|
-
}) : /* @__PURE__ */ jsxs(
|
|
94
|
-
"div",
|
|
95
|
-
{
|
|
96
|
-
ref: inViewRef,
|
|
97
|
-
className: clsx(styles.videoContainer, fill && styles.fill),
|
|
98
|
-
style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", "/") } : void 0,
|
|
99
|
-
children: [
|
|
100
|
-
!showControls && (PlayPauseButtonComponent ? /* @__PURE__ */ jsx(PlayPauseButtonComponent, { isPlaying, onClick: handlePlayPauseClick }) : /* @__PURE__ */ jsx(
|
|
101
|
-
PlayPauseButton,
|
|
102
|
-
{
|
|
103
|
-
isPlaying,
|
|
104
|
-
onClick: handlePlayPauseClick,
|
|
105
|
-
ariaLabelPlay: playButtonAriaLabel,
|
|
106
|
-
ariaLabelPause: pauseButtonAriaLabel
|
|
107
|
-
}
|
|
108
|
-
)),
|
|
109
|
-
/* @__PURE__ */ jsx(
|
|
110
|
-
"iframe",
|
|
111
|
-
{
|
|
112
|
-
ref: iframeRef,
|
|
113
|
-
className: styles.youtubeContainer,
|
|
114
|
-
allow: "autoplay",
|
|
115
|
-
referrerPolicy: "strict-origin-when-cross-origin",
|
|
116
|
-
src: youtubeUrl.toString()
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
) });
|
|
122
|
-
},
|
|
123
|
-
{ label: "Video" }
|
|
124
|
-
);
|
|
125
|
-
export {
|
|
126
|
-
YouTubeVideoBlock
|
|
127
|
-
};
|
|
2
|
+
import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import a from"clsx";import{useState as i,useRef as r,useCallback as n}from"react";import{withPreview as s}from"../iframebridge/withPreview.js";import{PreviewSkeleton as l}from"../previewskeleton/PreviewSkeleton.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as m}from"./helpers/useIsElementInViewport.js";import u from"./YouTubeVideoBlock.module.scss.js";const c=s(({data:{youtubeIdentifier:s,autoplay:c,loop:d,showControls:w,previewImage:y},aspectRatio:g="16x9",previewImageSizes:b,renderPreviewImage:f,fill:v,previewImageIcon:h,playButtonAriaLabel:P,pauseButtonAriaLabel:k,playPauseButton:I})=>{const[j,L]=i(!0),[S,B]=i(c??!1),[C,x]=i(!1),R=!(!y||!y.damFile),[V,A]=i(null),N=A,z=r(null),M=n(()=>{V?.contentWindow?.postMessage('{"event":"command","func":"pauseVideo","args":""}',"https://www.youtube-nocookie.com")},[V]),U=n(()=>{V?.contentWindow?.postMessage('{"event":"command","func":"playVideo","args":""}',"https://www.youtube-nocookie.com")},[V]),W=n(e=>{C||(e&&c?(U(),B(!0)):(M(),B(!1)))},[c,C,U,M]);if(m(z,W),!s)/* @__PURE__ */
|
|
3
|
+
return e(l,{type:"media",hasContent:!1,aspectRatio:g});const E=(e=>{const o=e.match(/(https?:\/\/)?(((m|www)\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)([_0-9a-zA-Z-]+)/);return(11===e.length?e:o&&11===o[8].length?o[8]:null)??void 0})(s),F=new URLSearchParams;F.append("modestbranding","1"),F.append("rel","0"),F.append("enablejsapi","1"),R&&!j&&F.append("autoplay","1"),c&&F.append("mute","1"),void 0!==w&&F.append("controls",Number(w).toString()),void 0!==d&&F.append("loop",Number(d).toString()),d&&E&&F.append("playlist",E);const T=new URL(`https://www.youtube-nocookie.com/embed/${E??""}`);T.search=F.toString();const Y=()=>{S?(B(!1),x(!0),M()):(B(!0),U())};/* @__PURE__ */
|
|
4
|
+
return e(o,{children:R&&j?f({onPlay:()=>L(!1),image:y,aspectRatio:g,sizes:b,fill:v,icon:h,playButtonAriaLabel:P}):/* @__PURE__ */t("div",{ref:z,className:a(u.videoContainer,v&&u.fill),style:v?void 0:{"--aspect-ratio":g.replace("x","/")},children:[!w&&(I?/* @__PURE__ */e(I,{isPlaying:S,onClick:Y}):/* @__PURE__ */e(p,{isPlaying:S,onClick:Y,ariaLabelPlay:P,ariaLabelPause:k})),
|
|
5
|
+
/* @__PURE__ */e("iframe",{ref:N,className:u.youtubeContainer,allow:"autoplay",referrerPolicy:"strict-origin-when-cross-origin",src:T.toString()})]})})},{label:"Video"});export{c as YouTubeVideoBlock};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const fill = "_fill_bhmhr_7";
|
|
3
|
-
const youtubeContainer = "_youtubeContainer_bhmhr_12";
|
|
4
|
-
const styles = {
|
|
5
|
-
videoContainer,
|
|
6
|
-
fill,
|
|
7
|
-
youtubeContainer
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
styles as default,
|
|
11
|
-
fill,
|
|
12
|
-
videoContainer,
|
|
13
|
-
youtubeContainer
|
|
14
|
-
};
|
|
1
|
+
const e="_videoContainer_bhmhr_1",o="_fill_bhmhr_7",n="_youtubeContainer_bhmhr_12",t={videoContainer:e,fill:o,youtubeContainer:n};export{t as default,o as fill,e as videoContainer,n as youtubeContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/BlocksBlock.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"BlocksBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/BlocksBlock.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,UAAU,KAAK;IACX,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,EAAE;QACF,MAAM,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,OAAO,CAAC;YAAC,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;KAClF,CAAC;CACL;AAED,eAAO,MAAM,WAAW,GAAI,uCAAuC,KAAK,4CAgCvE,CAAC"}
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Fragment as Fragment$1 } from "react";
|
|
3
|
-
import { ErrorHandlerBoundary } from "../../errorHandler/ErrorHandlerBoundary.js";
|
|
4
|
-
import { PreviewSkeleton } from "../../previewskeleton/PreviewSkeleton.js";
|
|
5
|
-
const BlocksBlock = ({ supportedBlocks, data: { blocks } }) => {
|
|
6
|
-
if (blocks.length === 0) {
|
|
7
|
-
return /* @__PURE__ */ jsx(PreviewSkeleton, { hasContent: false });
|
|
8
|
-
}
|
|
9
|
-
return /* @__PURE__ */ jsx(Fragment, { children: blocks.map((block) => {
|
|
10
|
-
const blockFunction = supportedBlocks[block.type];
|
|
11
|
-
if (!blockFunction) {
|
|
12
|
-
if (process.env.NODE_ENV === "development") {
|
|
13
|
-
return /* @__PURE__ */ jsxs("pre", { children: [
|
|
14
|
-
"Unknown type (",
|
|
15
|
-
block.type,
|
|
16
|
-
"): ",
|
|
17
|
-
JSON.stringify(block.props)
|
|
18
|
-
] }, block.key);
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ErrorHandlerBoundary, { children: blockFunction(block.props) }) }, block.key);
|
|
23
|
-
}) });
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
BlocksBlock
|
|
27
|
-
};
|
|
1
|
+
import{jsx as r,Fragment as e,jsxs as o}from"react/jsx-runtime";import{Fragment as n}from"react";import{ErrorHandlerBoundary as t}from"../../errorHandler/ErrorHandlerBoundary.js";import{PreviewSkeleton as p}from"../../previewskeleton/PreviewSkeleton.js";const s=({supportedBlocks:s,data:{blocks:l}})=>0===l.length?/* @__PURE__ */r(p,{hasContent:!1}):/* @__PURE__ */r(e,{children:l.map(e=>{const p=s[e.type];return p?/* @__PURE__ */r(n,{children:/* @__PURE__ */r(t,{children:p(e.props)})},e.key):"development"===process.env.NODE_ENV?/* @__PURE__ */o("pre",{children:["Unknown type (",e.type,"): ",JSON.stringify(e.props)]},e.key):null})});export{s as BlocksBlock};
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Fragment as Fragment$1 } from "react";
|
|
3
|
-
import { ErrorHandlerBoundary } from "../../errorHandler/ErrorHandlerBoundary.js";
|
|
4
|
-
import { PreviewSkeleton } from "../../previewskeleton/PreviewSkeleton.js";
|
|
5
|
-
const ListBlock = ({ block: blockFunction, data: { blocks } }) => {
|
|
6
|
-
if (blocks.length === 0) {
|
|
7
|
-
return /* @__PURE__ */ jsx(PreviewSkeleton, { hasContent: false });
|
|
8
|
-
}
|
|
9
|
-
return /* @__PURE__ */ jsx(Fragment, { children: blocks.map((block) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(ErrorHandlerBoundary, { children: blockFunction(block.props) }) }, block.key)) });
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
ListBlock
|
|
13
|
-
};
|
|
1
|
+
import{jsx as r,Fragment as e}from"react/jsx-runtime";import{Fragment as o}from"react";import{ErrorHandlerBoundary as t}from"../../errorHandler/ErrorHandlerBoundary.js";import{PreviewSkeleton as n}from"../../previewskeleton/PreviewSkeleton.js";const a=({block:a,data:{blocks:m}})=>0===m.length?/* @__PURE__ */r(n,{hasContent:!1}):/* @__PURE__ */r(e,{children:m.map(e=>/* @__PURE__ */r(o,{children:/* @__PURE__ */r(t,{children:a(e.props)})},e.key))});export{a as ListBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneOfBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/OneOfBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"OneOfBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/OneOfBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,UAAU,KAAM,SAAQ,iBAAiB;IACrC,IAAI,EAAE;QACF,KAAK,CAAC,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YAEb,KAAK,EAAE,GAAG,CAAC;SACd,CAAC;KACL,CAAC;IACF,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,GAAI,+EAA+E,KAAK,mDAsB9G,CAAC"}
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ErrorHandlerBoundary } from "../../errorHandler/ErrorHandlerBoundary.js";
|
|
3
|
-
const OneOfBlock = ({ data: { block, ...additionalProps }, supportedBlocks, children, className }) => {
|
|
4
|
-
if (!block) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
const blockFunction = supportedBlocks[block.type];
|
|
8
|
-
if (!blockFunction) {
|
|
9
|
-
if (process.env.NODE_ENV === "development") {
|
|
10
|
-
return /* @__PURE__ */ jsxs("pre", { children: [
|
|
11
|
-
"Unknown type (",
|
|
12
|
-
block.type,
|
|
13
|
-
"): ",
|
|
14
|
-
JSON.stringify(block.props)
|
|
15
|
-
] });
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return /* @__PURE__ */ jsx(ErrorHandlerBoundary, { children: blockFunction({ ...block.props, ...additionalProps, children, className }) });
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
OneOfBlock
|
|
23
|
-
};
|
|
1
|
+
import{jsxs as r,jsx as e}from"react/jsx-runtime";import{ErrorHandlerBoundary as n}from"../../errorHandler/ErrorHandlerBoundary.js";const o=({data:{block:o,...t},supportedBlocks:l,children:p,className:s})=>{if(!o)return null;const c=l[o.type];return c?/* @__PURE__ */e(n,{children:c({...o.props,...t,children:p,className:s})}):"development"===process.env.NODE_ENV?/* @__PURE__ */r("pre",{children:["Unknown type (",o.type,"): ",JSON.stringify(o.props)]}):null};export{o as OneOfBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionalBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/OptionalBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"OptionalBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/OptionalBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,UAAU,KAAM,SAAQ,iBAAiB;IAErC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,CAAC;IACjC,IAAI,EAAE;QACF,OAAO,EAAE,OAAO,CAAC;QAEjB,KAAK,CAAC,EAAE,GAAG,CAAC;KACf,CAAC;CACL;AAED,eAAO,MAAM,aAAa,GAAI,8DAA8D,KAAK,mDAMhG,CAAC"}
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const OptionalBlock = ({ block: blockFunction, data: { visible, block }, children }) => {
|
|
3
|
-
if (!visible || !block) {
|
|
4
|
-
return null;
|
|
5
|
-
}
|
|
6
|
-
return /* @__PURE__ */ jsx(Fragment, { children: blockFunction({ ...block, children }) });
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
OptionalBlock
|
|
10
|
-
};
|
|
1
|
+
import{jsx as l,Fragment as r}from"react/jsx-runtime";const c=({block:c,data:{visible:e,block:i},children:n})=>e&&i?/* @__PURE__ */l(r,{children:c({...i,children:n})}):null;export{c as OptionalBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/blocks/factories/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAE5B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,GAAG,SAAS,CAAC;CACxD"}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import styles from "./PlayPauseButton.module.scss.js";
|
|
4
|
-
const PlayPauseButton = ({ isPlaying, onClick, ariaLabelPlay, ariaLabelPause }) => {
|
|
5
|
-
return /* @__PURE__ */ jsx("button", { className: clsx(styles.button), onClick, "aria-label": isPlaying ? ariaLabelPause ?? "Pause" : ariaLabelPlay ?? "Play", children: /* @__PURE__ */ jsx("div", { className: clsx(styles.animatedPlayPause, isPlaying && styles.animatedPlayPausePaused) }) });
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
PlayPauseButton
|
|
9
|
-
};
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import e from"clsx";import s from"./PlayPauseButton.module.scss.js";const l=({isPlaying:l,onClick:i,ariaLabelPlay:t,ariaLabelPause:o})=>/* @__PURE__ */a("button",{className:e(s.button),onClick:i,"aria-label":l?o??"Pause":t??"Play",children:/* @__PURE__ */a("div",{className:e(s.animatedPlayPause,l&&s.animatedPlayPausePaused)})});export{l as PlayPauseButton};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const animatedPlayPause = "_animatedPlayPause_4r8gs_23";
|
|
3
|
-
const animatedPlayPausePaused = "_animatedPlayPausePaused_4r8gs_32";
|
|
4
|
-
const styles = {
|
|
5
|
-
button,
|
|
6
|
-
animatedPlayPause,
|
|
7
|
-
animatedPlayPausePaused
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
animatedPlayPause,
|
|
11
|
-
animatedPlayPausePaused,
|
|
12
|
-
button,
|
|
13
|
-
styles as default
|
|
14
|
-
};
|
|
1
|
+
const a="_button_4r8gs_1",e="_animatedPlayPause_4r8gs_23",s="_animatedPlayPausePaused_4r8gs_32",t={button:a,animatedPlayPause:e,animatedPlayPausePaused:s};export{e as animatedPlayPause,s as animatedPlayPausePaused,a as button,t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextBlockHelper.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/RichTextBlockHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RichTextBlockHelper.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/RichTextBlockHelper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,eAAO,MAAM,uBAAuB,GAAI,MAAM,iBAAiB,YAG9D,CAAC"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const draftContent = data.draftContent;
|
|
3
|
-
return !(draftContent.blocks.length === 0 || draftContent.blocks.length === 1 && draftContent.blocks[0].text === "");
|
|
4
|
-
};
|
|
5
|
-
export {
|
|
6
|
-
hasRichTextBlockContent
|
|
7
|
-
};
|
|
1
|
+
const t=t=>{const n=t.draftContent;return!(0===n.blocks.length||1===n.blocks.length&&""===n.blocks[0].text)};export{t as hasRichTextBlockContent};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TipTapMark {
|
|
3
|
+
type: string;
|
|
4
|
+
attrs?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface TipTapNode {
|
|
7
|
+
type: string;
|
|
8
|
+
attrs?: Record<string, unknown>;
|
|
9
|
+
content?: TipTapNode[];
|
|
10
|
+
marks?: TipTapMark[];
|
|
11
|
+
text?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TipTapNodeHandlerProps {
|
|
14
|
+
node: TipTapNode;
|
|
15
|
+
parent?: TipTapNode;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export interface TipTapMarkHandlerProps {
|
|
19
|
+
mark: TipTapMark;
|
|
20
|
+
node: TipTapNode;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export type TipTapNodeHandler = (props: TipTapNodeHandlerProps) => ReactNode;
|
|
24
|
+
export type TipTapMarkHandler = (props: TipTapMarkHandlerProps) => ReactNode;
|
|
25
|
+
export interface RenderTipTapRichTextOptions {
|
|
26
|
+
content: TipTapNode;
|
|
27
|
+
nodeMapping?: Record<string, TipTapNodeHandler>;
|
|
28
|
+
markMapping?: Record<string, TipTapMarkHandler>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @experimental
|
|
32
|
+
*/
|
|
33
|
+
export declare function renderTipTapRichText({ content, nodeMapping, markMapping }: RenderTipTapRichTextOptions): ReactNode;
|
|
34
|
+
export declare function hasTipTapRichTextContent(content: TipTapNode | null | undefined): boolean;
|
|
35
|
+
//# sourceMappingURL=TipTapRichTextRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TipTapRichTextRenderer.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/TipTapRichTextRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,SAAS,CAAC;AAC7E,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,SAAS,CAAC;AAE7E,MAAM,WAAW,2BAA2B;IACxC,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CACnD;AA4BD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,2BAA2B,GAAG,SAAS,CAqClH;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAKxF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{jsx as r,Fragment as n}from"react/jsx-runtime";import{isValidElement as e,cloneElement as t}from"react";const i=String.fromCodePoint(160),c=String.fromCodePoint(173),o={paragraph:({children:n})=>/* @__PURE__ */r("p",{children:n}),heading:({node:n,children:e})=>{const t=n.attrs?.level??1;/* @__PURE__ */
|
|
2
|
+
return r(`h${t}`,{children:e})},bulletList:({children:n})=>/* @__PURE__ */r("ul",{children:n}),orderedList:({children:n})=>/* @__PURE__ */r("ol",{children:n}),listItem:({children:n})=>/* @__PURE__ */r("li",{children:n}),hardBreak:()=>/* @__PURE__ */r("br",{}),nonBreakingSpace:()=>i,softHyphen:()=>c},d={bold:({children:n})=>/* @__PURE__ */r("strong",{children:n}),italic:({children:n})=>/* @__PURE__ */r("em",{children:n}),strike:({children:n})=>/* @__PURE__ */r("s",{children:n}),superscript:({children:n})=>/* @__PURE__ */r("sup",{children:n}),subscript:({children:n})=>/* @__PURE__ */r("sub",{children:n})};function l({content:i,nodeMapping:c,markMapping:l}){const h={...o,...c},s={...d,...l},a=(r,n)=>{if(!n.marks||0===n.marks.length)return r;let e=r;for(const t of n.marks){const r=s[t.type];r&&(e=r({mark:t,node:n,children:e}))}return e},p=(i,c)=>{if("text"===i.type)return a(i.text??"",i);const o=i.content?.map((r,n)=>{const c=p(r,i);return e(c)?t(c,{key:n}):c});if("doc"===i.type)/* @__PURE__ */
|
|
3
|
+
return r(n,{children:o});const d=h[i.type],l=d?d({node:i,parent:c,children:o}):/* @__PURE__ */r(n,{children:o});return a(l,i)};return p(i,void 0)}function h(r){return!(!r?.content||!Array.isArray(r.content))&&r.content.some(r=>"paragraph"!==r.type||Array.isArray(r.content)&&r.content.length>0)}export{h as hasTipTapRichTextContent,l as renderTipTapRichText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPreviewImage.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/VideoPreviewImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VideoPreviewImage.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/VideoPreviewImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAGlE,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,eAAO,MAAM,iBAAiB,GAAI,iGAU/B,sBAAsB,GAAG;IACxB,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,YAAY,CAAC;CAC5H,4CASA,CAAC"}
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import styles from "./VideoPreviewImage.module.scss.js";
|
|
4
|
-
const VideoPreviewImage = ({
|
|
5
|
-
onPlay,
|
|
6
|
-
image,
|
|
7
|
-
aspectRatio,
|
|
8
|
-
sizes = "100vw",
|
|
9
|
-
fill,
|
|
10
|
-
playButtonAriaLabel = "Play video",
|
|
11
|
-
icon = /* @__PURE__ */ jsx(PlayIcon, { playButtonAriaLabel }),
|
|
12
|
-
className,
|
|
13
|
-
renderImage
|
|
14
|
-
}) => {
|
|
15
|
-
return /* @__PURE__ */ jsxs("div", { className: clsx(styles.root, fill && styles.fill, className), children: [
|
|
16
|
-
renderImage({ data: image, aspectRatio, sizes, fill }),
|
|
17
|
-
/* @__PURE__ */ jsx("button", { className: styles.iconWrapper, onClick: onPlay, children: icon })
|
|
18
|
-
] });
|
|
19
|
-
};
|
|
20
|
-
const PlayIcon = ({ playButtonAriaLabel }) => /* @__PURE__ */ jsx("span", { className: styles.playIcon, "aria-label": playButtonAriaLabel });
|
|
21
|
-
export {
|
|
22
|
-
VideoPreviewImage
|
|
23
|
-
};
|
|
1
|
+
import{jsxs as a,jsx as e}from"react/jsx-runtime";import l from"clsx";import i from"./VideoPreviewImage.module.scss.js";const o=({onPlay:o,image:r,aspectRatio:t,sizes:c="100vw",fill:m,playButtonAriaLabel:n="Play video",icon:p=/* @__PURE__ */e(s,{playButtonAriaLabel:n}),className:d,renderImage:f})=>/* @__PURE__ */a("div",{className:l(i.root,m&&i.fill,d),children:[f({data:r,aspectRatio:t,sizes:c,fill:m}),
|
|
2
|
+
/* @__PURE__ */e("button",{className:i.iconWrapper,onClick:o,children:p})]}),s=({playButtonAriaLabel:a})=>/* @__PURE__ */e("span",{className:i.playIcon,"aria-label":a});export{o as VideoPreviewImage};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const fill = "_fill_1k5a5_6";
|
|
3
|
-
const iconWrapper = "_iconWrapper_1k5a5_10";
|
|
4
|
-
const playIcon = "_playIcon_1k5a5_26";
|
|
5
|
-
const styles = {
|
|
6
|
-
root,
|
|
7
|
-
fill,
|
|
8
|
-
iconWrapper,
|
|
9
|
-
playIcon
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
styles as default,
|
|
13
|
-
fill,
|
|
14
|
-
iconWrapper,
|
|
15
|
-
playIcon,
|
|
16
|
-
root
|
|
17
|
-
};
|
|
1
|
+
const _="_root_1k5a5_1",a="_fill_1k5a5_6",o="_iconWrapper_1k5a5_10",l="_playIcon_1k5a5_26",p={root:_,fill:a,iconWrapper:o,playIcon:l};export{p as default,a as fill,o as iconWrapper,l as playIcon,_ as root};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsElementInViewport.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/useIsElementInViewport.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,eAAO,MAAM,sBAAsB,GAAI,KAAK,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"useIsElementInViewport.d.ts","sourceRoot":"","sources":["../../../src/blocks/helpers/useIsElementInViewport.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,eAAO,MAAM,sBAAsB,GAAI,KAAK,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,SAmBzG,CAAC"}
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
const useIsElementInViewport = (ref, callback) => {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
if (!ref.current) return;
|
|
6
|
-
const observer = new IntersectionObserver(
|
|
7
|
-
([entry]) => {
|
|
8
|
-
callback(entry.isIntersecting);
|
|
9
|
-
},
|
|
10
|
-
{ threshold: 0.5 }
|
|
11
|
-
);
|
|
12
|
-
observer.observe(ref.current);
|
|
13
|
-
return () => {
|
|
14
|
-
observer.disconnect();
|
|
15
|
-
};
|
|
16
|
-
}, [ref, callback]);
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
useIsElementInViewport
|
|
20
|
-
};
|
|
2
|
+
import{useEffect as r}from"react";const e=(e,t)=>{r(()=>{if(!e.current)return;const r=new IntersectionObserver(([r])=>{t(r.isIntersecting)},{threshold:.5});return r.observe(e.current),()=>{r.disconnect()}},[e,t])};export{e as useIsElementInViewport};
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const CookieApiContext = createContext(void 0);
|
|
5
|
-
const CookieApiProvider = ({ api: useCookieApi2, children }) => {
|
|
6
|
-
const api = useCookieApi2();
|
|
7
|
-
return /* @__PURE__ */ jsx(CookieApiContext.Provider, { value: api, children });
|
|
8
|
-
};
|
|
9
|
-
const useCookieApi = () => {
|
|
10
|
-
const cookieApi = useContext(CookieApiContext);
|
|
11
|
-
if (!cookieApi) {
|
|
12
|
-
throw new Error("Can only be used inside CookieApiProvider.");
|
|
13
|
-
}
|
|
14
|
-
return cookieApi;
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
CookieApiProvider,
|
|
18
|
-
useCookieApi
|
|
19
|
-
};
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import{useContext as e,createContext as o}from"react";const i=o(void 0),n=({api:e,children:o})=>{const n=e();/* @__PURE__ */
|
|
3
|
+
return r(i.Provider,{value:n,children:o})},t=()=>{const r=e(i);if(!r)throw new Error("Can only be used inside CookieApiProvider.");return r};export{n as CookieApiProvider,t as useCookieApi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieSafe.d.ts","sourceRoot":"","sources":["../../src/cookies/CookieSafe.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CookieSafe.d.ts","sourceRoot":"","sources":["../../src/cookies/CookieSafe.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;CACtB,CAAC,CAAC;AAEH,eAAO,MAAM,UAAU,GAAI,4CAA4C,KAAK,4CAc3E,CAAC"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import { useCookieApi } from "./CookieApiContext.js";
|
|
5
|
-
const CookieSafe = ({ consented, fallback, loading, children }) => {
|
|
6
|
-
const { initialized } = useCookieApi();
|
|
7
|
-
const { previewType } = usePreview();
|
|
8
|
-
const isInPreview = previewType !== "NoPreview";
|
|
9
|
-
if (initialized && consented || isInPreview) {
|
|
10
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
11
|
-
}
|
|
12
|
-
if (!initialized) {
|
|
13
|
-
return /* @__PURE__ */ jsx(Fragment, { children: loading });
|
|
14
|
-
}
|
|
15
|
-
return /* @__PURE__ */ jsx(Fragment, { children: fallback });
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
CookieSafe
|
|
19
|
-
};
|
|
2
|
+
import{jsx as e,Fragment as i}from"react/jsx-runtime";import{usePreview as r}from"../preview/usePreview.js";import{useCookieApi as o}from"./CookieApiContext.js";const n=({consented:n,fallback:t,loading:c,children:l})=>{const{initialized:p}=o(),{previewType:d}=r();/* @__PURE__ */
|
|
3
|
+
return e(i,p&&n||"NoPreview"!==d?{children:l}:p?{children:t}:{children:c})};export{n as CookieSafe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCookieBotCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useCookieBotCookieApi.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useCookieBotCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useCookieBotCookieApi.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcxD,eAAO,MAAM,qBAAqB,EAAE,aA6BnC,CAAC"}
|
|
@@ -1,34 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
const isWindowWithCookiebot = (window2) => {
|
|
4
|
-
return "Cookiebot" in window2;
|
|
5
|
-
};
|
|
6
|
-
const useCookieBotCookieApi = () => {
|
|
7
|
-
const [consentedCookies, setConsentedCookies] = useState([]);
|
|
8
|
-
const [initialized, setInitialized] = useState(false);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const handleCookieUpdated = () => {
|
|
11
|
-
if (isWindowWithCookiebot(window)) {
|
|
12
|
-
setInitialized(true);
|
|
13
|
-
const consentedList = window.Cookiebot.consent;
|
|
14
|
-
setConsentedCookies(Object.keys(consentedList).filter((key) => consentedList[key]));
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
window.addEventListener("CookiebotOnConsentReady", handleCookieUpdated);
|
|
18
|
-
return () => {
|
|
19
|
-
window.removeEventListener("CookiebotOnConsentReady", handleCookieUpdated);
|
|
20
|
-
};
|
|
21
|
-
}, []);
|
|
22
|
-
return {
|
|
23
|
-
initialized,
|
|
24
|
-
consentedCookies,
|
|
25
|
-
openCookieSettings: () => {
|
|
26
|
-
if (isWindowWithCookiebot(window)) {
|
|
27
|
-
window.Cookiebot.renew();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
useCookieBotCookieApi
|
|
34
|
-
};
|
|
2
|
+
import{useState as o,useEffect as e}from"react";const n=o=>"Cookiebot"in o,t=()=>{const[t,i]=o([]),[r,s]=o(!1);return e(()=>{const o=()=>{if(n(window)){s(!0);const o=window.Cookiebot.consent;i(Object.keys(o).filter(e=>o[e]))}};return window.addEventListener("CookiebotOnConsentReady",o),()=>{window.removeEventListener("CookiebotOnConsentReady",o)}},[]),{initialized:r,consentedCookies:t,openCookieSettings:()=>{n(window)&&window.Cookiebot.renew()}}};export{t as useCookieBotCookieApi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalStorageCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useLocalStorageCookieApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useLocalStorageCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useLocalStorageCookieApi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInE,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,0BAA0B,EAAE,SAAS,CAAC;KACzC;CACJ;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAmCtC,CAAC"}
|
|
@@ -1,41 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { useLocalStorage } from "usehooks-ts";
|
|
4
|
-
const localStorageCookieApiKey = "comet-dev-cookie-api-consented-cookies";
|
|
5
|
-
const useLocalStorageCookieApi = () => {
|
|
6
|
-
const [consentedCookies, setConsentedCookies] = useLocalStorage(localStorageCookieApiKey, []);
|
|
7
|
-
const [initialized, setInitialized] = useState(false);
|
|
8
|
-
const openCookieSettings = useCallback(() => {
|
|
9
|
-
const cookies = prompt('Define consented cookies (separated by ","):', consentedCookies.join(",")) ?? "";
|
|
10
|
-
const cookiesList = cookies.split(",").map((cookie) => cookie.trim());
|
|
11
|
-
setConsentedCookies(cookiesList);
|
|
12
|
-
logCookieUpdate(cookiesList);
|
|
13
|
-
}, [consentedCookies, setConsentedCookies]);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const storedCookies = window.localStorage.getItem(localStorageCookieApiKey);
|
|
16
|
-
const cookiesList = JSON.parse(storedCookies ?? "[]");
|
|
17
|
-
logCookieUpdate(cookiesList);
|
|
18
|
-
const simulateLoadingTimeout = setTimeout(() => {
|
|
19
|
-
setInitialized(true);
|
|
20
|
-
window.cometLocalStorageCookieApi = {
|
|
21
|
-
initialized: true,
|
|
22
|
-
consentedCookies,
|
|
23
|
-
openCookieSettings
|
|
24
|
-
};
|
|
25
|
-
}, 1e3);
|
|
26
|
-
return () => {
|
|
27
|
-
clearTimeout(simulateLoadingTimeout);
|
|
28
|
-
};
|
|
29
|
-
}, [consentedCookies, openCookieSettings]);
|
|
30
|
-
return {
|
|
31
|
-
initialized,
|
|
32
|
-
consentedCookies,
|
|
33
|
-
openCookieSettings
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const logCookieUpdate = (cookies) => {
|
|
37
|
-
console.info("Consented cookies updated:", cookies);
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
useLocalStorageCookieApi
|
|
41
|
-
};
|
|
2
|
+
import{useState as o,useCallback as e,useEffect as t}from"react";import{useLocalStorage as i}from"usehooks-ts";const n="comet-dev-cookie-api-consented-cookies",s=()=>{const[s,r]=i(n,[]),[a,p]=o(!1),d=e(()=>{const o=(prompt('Define consented cookies (separated by ","):',s.join(","))??"").split(",").map(o=>o.trim());r(o),c(o)},[s,r]);return t(()=>{const o=window.localStorage.getItem(n),e=JSON.parse(o??"[]");c(e);const t=setTimeout(()=>{p(!0),window.cometLocalStorageCookieApi={initialized:!0,consentedCookies:s,openCookieSettings:d}},1e3);return()=>{clearTimeout(t)}},[s,d]),{initialized:a,consentedCookies:s,openCookieSettings:d}},c=o=>{console.info("Consented cookies updated:",o)};export{s as useLocalStorageCookieApi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOneTrustCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useOneTrustCookieApi.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useOneTrustCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useOneTrustCookieApi.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAwBxD,eAAO,MAAM,oBAAoB,EAAE,aA8ClC,CAAC"}
|